⚠️ multiApprove(contract, sender, approved, nft

Feature
Return raw operation for approving permission for multiple NFT of sender to other accounts.

Parameters

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

string sender,

string[] approved, // array of account to approve each nft

int[] nftIdx, // array of index of nft to approve

string currency

Return Value

object approve operation with multi item

example1. approve two nfts with index 0 and 1 of one CA(0x41…) to account(0x07…).

const contractAddress = "0x41EFb6902ADcb1214a7123b01af66b1D13b89864fca";
const sender = "0x4874C17C354c498cf44D2946612DBe47fBcE7E87fca";
const approved = ["0x07469989b2562afF5E5C3B116CD3AA5Ef814e5a1fca", "0x07469989b2562afF5E5C3B116CD3AA5Ef814e5a1fca"];
const nftIdx = [0,1];
const currencyID = "MCC";
const approveOperation = mitum.nft.multiApprove(contractAddress, sender, approved, nftIdx, currencyID);
console.log(approveOperation);

// output
Operation {
  id: 'mitum',
  fact: ApproveFact {
    hint: Hint { s: 'mitum-nft-approve-operation-fact' },
    token: Token { s: '2023-10-10 04:53:48.582 +0000 UTC' },
    _hash: <Buffer 95 13 b1 c0 86 87 f7 d5 2e 18 c4 25 10 fa d8 0b 91 ee 66 c3 92 30 15 d7 c4 43 95 d7 6a 31 6a cc>,
    sender: Address {
      s: '0x4874C17C354c498cf44D2946612DBe47fBcE7E87fca',
      type: 'mitum'
    },
    items: [ [ApproveItem] ]
  },
  hint: Hint { s: 'mitum-nft-approve-operation' },
  _factSigns: [],
  _hash: <Buffer >
}

example2. approve nft with index 0 of CA(0x41…) to account(0x07…) and nft with index 0 of CA(0xA1…) to account(0xAB…) at once.

Last updated