⚠️ multiApproveAll(contract, sender, approved, mode, currency)

Feature

Return raw operation with multiple item that delegates or cancels permission to the given account for all NFTs of given contract address owned by the sender.

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,

”allow” | ”cancel” mode,

string currency ID

Return Value

object approveAll operation

  • mode == “allow” : delegate all permissions to the operator.

  • mode == “cancel” : If mode is 'false', revoke all privileges delegated to operator.

example1. In contract(0x54…), all NFT rights owned by the sender are delegated to account(0x79…) and account(0xAB…).

const contractAddress = "0x548a042cDe4589880dD53BacE89de602BefC5E2bfca";
const sender = "0x4526f3D0EdC63D9EaeCD94D56551e0f061CFCa47fca";
const currencyID = "MCC";

const approved = ["0x79245aF85B1D3d2CD49c77a717919dDF5537c11dfca","0xABC52ebcd61C0D448863df7d69389612953Bc698fca"]

const mintOperation = mitum.nft.multiApproveAll(contractAddress, sender, approved, "cancel", currencyID);
console.log(mintOperation);

console.log(op);

// output
Operation {
  id: 'mitum',
  fact: ApproveAllFact {
    hint: Hint { s: 'mitum-nft-approve-all-operation-fact' },
    token: Token { s: '2025-01-14 04:56:57.091 +0000 UTC' },
    _hash: <Buffer 06 ab 64 b0 92 e3 19 9c fd 51 4c 47 d4 46 02 5b 57 0a a3 89 26 2b c1 88 58 7d 8d a9 f2 91 97 12>,
    sender: Address {
      s: '0x4526f3D0EdC63D9EaeCD94D56551e0f061CFCa47fca',
      type: 'mitum'
    },
    items: [ [ApproveAllItem], [ApproveAllItem] ]
  },
  hint: Hint { s: 'mitum-nft-approve-all-operation' },
  _factSigns: [],
  _hash: <Buffer >
}

example2. In contract (0x54…), the sender's NFT rights are delegated to account(0x4d…); in contract account(0x79…), they are delegated to account(0xAB…).

const contractAddress = ["0x548a042cDe4589880dD53BacE89de602BefC5E2bfca", "0x4d30d89CDb19DBc1Eb22DDBF5343D29932F2fF0afca"];
const sender = "0x4526f3D0EdC63D9EaeCD94D56551e0f061CFCa47fca";
const currencyID = "MCC";

const approved = ["0x79245aF85B1D3d2CD49c77a717919dDF5537c11dfca","0xABC52ebcd61C0D448863df7d69389612953Bc698fca"]

const mintOperation = mitum.nft.multiApproveAll(contractAddress, sender, approved, "cancel", currencyID);
console.log(mintOperation);

console.log(op);

// output
Operation {
  id: 'mitum',
  fact: ApproveAllFact {
    hint: Hint { s: 'mitum-nft-approve-all-operation-fact' },
    token: Token { s: '2025-01-14 04:56:57.091 +0000 UTC' },
    _hash: <Buffer 06 ab 64 b0 92 e3 19 9c fd 51 4c 47 d4 46 02 5b 57 0a a3 89 26 2b c1 88 58 7d 8d a9 f2 91 97 12>,
    sender: Address {
      s: '0x4526f3D0EdC63D9EaeCD94D56551e0f061CFCa47fca',
      type: 'mitum'
    },
    items: [ [ApproveAllItem], [ApproveAllItem] ]
  },
  hint: Hint { s: 'mitum-nft-approve-all-operation' },
  _factSigns: [],
  _hash: <Buffer >
}

Last updated