registerModel(contract, sender, data, currency)
Feature
Return raw operation for registering a new nft model. Notes: The contract must already be deployed on the network. Handler of contract also can execute the function.
Parameters
string
contract address,
string
sender, // owner or handler of contract
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[];
}
name: The name of the collection
uri: Path to the collection's representative image
royalty: The commission inside the collection (Must be under 100)
minterWhitelist: Accounts who have permissions to mint nft. Duplicated elements not allowed. If whitelist is empty array, any account can mint the nft.
example
const contractAddress = "0xe1842cCaAf7Df28467ECFdFbD3bdB7de84dEDC3Dfca";
const sender = "0x626410F061e62d79294f82603b872Db7d1711Bf7fca";
const name = "MyNFT";
const uri = "www.MyNFT.com";
const royalty = 30;
const whitelist = ["0x78f707a5CB15924b5edf7E45cD8df06b577984F7fca"];
const collectionData = {
name: name,
uri: uri,
royalty: royalty,
minterWhitelist: whitelist,
};
const currencyID = "MCC";
const op = mitum.nft.registerModel(contractAddress, sender, collectionData, currencyID);
console.log(op);
// output
Operation {
id: 'mitum',
fact: RegisterModelFact {
hint: Hint { s: 'mitum-nft-register-model-operation-fact' },
token: Token { s: '2024-06-25 04:55:21.886 +0000 UTC' },
_hash: <Buffer 88 34 92 2f 98 9e a7 af ff d7 1e 5c 8c 6e 0e a5 09 64 1e c2 f0 68 aa 90 2c a3 e8 7d 10 e6 9f 07>,
sender: Address {
s: '0x626410F061e62d79294f82603b872Db7d1711Bf7fca',
type: 'mitum'
},
contract: Address {
s: '0xe1842cCaAf7Df28467ECFdFbD3bdB7de84dEDC3Dfca',
type: 'mitum'
},
currency: CurrencyID { s: 'MCC' },
name: LongString { s: 'MyNFT' },
royalty: Big { big: 30n },
uri: LongString { s: 'www.MyNFT.com' },
minterWhitelist: [ [Address] ]
},
hint: Hint { s: 'mitum-nft-register-model-operation' },
_factSigns: [],
_hash: <Buffer >
}
Last updated