⚠️ multiTransfer(contract, sender, receiver, nftIdx, currencyId)

Feature

Return raw operation to transfer multiple NFTs. The owner of the NFT or an approved account delegated can execute the operation to transfer ownership of the NFT to the 'receiver'.

Parameters

string | string[] contract address, // If given a string, it is automatically converted to an array filled with the same values.

string sender (= owner or approved account),

string[] receiver,

int[] nftIdx,

string currency Id

Return Value

object transfer Operation with multi item.

example1. transfer two nfts with index 0, 1 in contract (0x4d…) to receiver (0xA1…)

const contractAddress = "0x4d30d89CDb19DBc1Eb22DDBF5343D29932F2fF0afca";
const sender = "0x79245aF85B1D3d2CD49c77a717919dDF5537c11dfca";
const receiver = "0xA16532383f12A9a3dF61E9ff997a0211483AA8dEfca"
const currencyID = "MCC";

const mintOperation = mitum.nft.multiTransfer(contractAddress, sender, [receiver, receiver], [1, 2], currencyID);
console.log(mintOperation);

// output
Operation {
  id: 'mitum',
  fact: TransferFact {
    hint: Hint { s: 'mitum-nft-transfer-operation-fact' },
    token: Token { s: '2025-01-14 05:25:09.792 +0000 UTC' },
    _hash: <Buffer 1b dc 48 41 f5 58 4e 80 c0 e0 fe 42 42 e3 26 52 4e 99 2c 82 f4 3f c3 42 93 42 7e 97 3d bb 5d 93>,
    sender: Address {
      s: '0x79245aF85B1D3d2CD49c77a717919dDF5537c11dfca',
      type: 'mitum'
    },
    items: [ [TransferItem], [TransferItem] ]
  },
  hint: Hint { s: 'mitum-nft-transfer-operation' },
  _factSigns: [],
  _hash: <Buffer >
}

example2. transfer a nft with index 0 in contract (0x4d…) to receiver (0xA1…) and transfer nft with index 0 in contract (0xd7…) to receiver (0x64…).


const contract1 = "0x4d30d89CDb19DBc1Eb22DDBF5343D29932F2fF0afca";
const contract2 = "0xd7244844B2bBc93555B658B00EE95876e96C9503fca";
const sender = "0x79245aF85B1D3d2CD49c77a717919dDF5537c11dfca";
const receiver1 = "0xA16532383f12A9a3dF61E9ff997a0211483AA8dEfca";
const receiver2 = "0x6464B8E6970b76690343e883A668093198355D42fca";
const currencyID = "MCC";

const mintOperation = mitum.nft.multiTransfer([contract1, contract2], sender, [receiver1, receiver2], [0, 0], currencyID);
console.log(mintOperation);

// output
Operation {
  id: 'mitum',
  fact: TransferFact {
    hint: Hint { s: 'mitum-nft-transfer-operation-fact' },
    token: Token { s: '2025-01-14 05:40:44.215 +0000 UTC' },
    _hash: <Buffer 78 1d 69 a5 88 6c ad 3b dd 84 6a b2 b1 77 95 e1 58 4a c3 13 4a ae c8 8d 9c 52 84 fa ac fa 98 c9>,
    sender: Address {
      s: '0x79245aF85B1D3d2CD49c77a717919dDF5537c11dfca',
      type: 'mitum'
    },
    items: [ [TransferItem], [TransferItem] ]
  },
  hint: Hint { s: 'mitum-nft-transfer-operation' },
  _factSigns: [],
  _hash: <Buffer >
}

Last updated