updateModelConfig(contract, sender, data, currency)

Feature

Create an operation that resets the policy of a specific collection. Notes: The contract must already be deployed on the network. Handler of contract also can execute the function.

Parameters

string contract address, string sender, object collectionData, string currency ID

Return Value

object raw operation

// [ parameter for collectionData structure ]

type collectionData {
   name: string,
   uri: string,
   royalty: string | number | Buffer | BigInt | Uint8Array,
   minterWhitelist: string[];       // Duplicated elements not allowed.
}

example

const contractAddress = "0xe1842cCaAf7Df28467ECFdFbD3bdB7de84dEDC3Dfca";
const sender = "0x626410F061e62d79294f82603b872Db7d1711Bf7fca";

const name = "abcd";
const uri = "www.abcd_efgh.com";
const royalty = 15;
const whitelist = ["0x78f707a5CB15924b5edf7E45cD8df06b577984F7fca"];

const newCollectionData = {
    name: name,
    uri: uri,
    royalty: royalty,
    minterWhitelist: whitelist,
};
const currencyID = "MCC";

const policyOperation = mitum.nft.updateModelConfig(contractAddress, sender, newCollectionData, currencyID);
console.log(policyOperation);

// output
Operation {
  id: 'mitum',
  fact: UpdateCollectionPolicyFact {
    hint: Hint { s: 'mitum-nft-update-collection-policy-operation-fact' },
    token: Token { s: '2023-10-10 01:19:44.481 +0000 UTC' },
    _hash: <Buffer d7 fd 96 ea 14 35 ae 52 75 ea dd 11 44 76 98 96 1c e0 5b 87 0c 1a fe 69 ee 88 34 5b 96 c6 af da>,
    sender: Address {
      s: '0x626410F061e62d79294f82603b872Db7d1711Bf7fca',
      type: 'mitum'
    },
    contract: Address {
      s: '0xe1842cCaAf7Df28467ECFdFbD3bdB7de84dEDC3Dfca',
      type: 'mitum'
    },
    currency: CurrencyID { s: 'MCC' },
    name: LongString { s: 'abcd' },
    royalty: Big { big: 15n },
    uri: LongString { s: 'www.abcd_efgh.com' },
    whitelist: [ [Address] ]
  },
  hint: Hint { s: 'mitum-nft-update-collection-policy-operation' },
  _factSigns: [],
  _hash: <Buffer >
}

Last updated