NFT

nft()

Creates an NftBuilder class instance, which provides methods to build transactions for the NFT Pallet on The Root Network. It expects four parameters:

  • api: the trnApi to use for interaction.

  • signer: the signer to use for signing transactions.

  • walletAddress: the wallet address to use for interaction. Note: It should be the EOA address for the signer, not the FuturePass address.

  • collectionId: the Collection ID to target. Optional parameter.

Example:

const nftBuilder = await TransactionBuilder.nft(api, signer, walletAddress, collectionId)

The nft method allows developers to mint, transfer, burn, amongst other actions listed below.

mint()

Sets the base extrinsic to mint NFTs with the given quantity to the provided wallet address. It expects two parameters.

  • quantity: the number of NFTs to mint.

  • walletAddress: the wallet address to mint the NFTs to.

Example:

const nftBuilder = await TransactionBuilder.nft(api, signer, walletAddress, collectionId).mint({ quantity: 1, walletAddress: userSession?.futurepass });

transfer()

Sets the base extrinsic to transfer NFTs with the given serial numbers. It expects two parameters:

  • serialNumbers: an array of serial numbers of the NFTs to transfer.

  • walletAddress: the wallet address to mint the NFTs to.

Example:

const nftBuilder = await TransactionBuilder.nft(api, signer, walletAddress, collectionId).transfer({ serialNumber, walletAddress: userSession?.futurepass });

burn()

Sets the base extrinsic to burn NFTs with the given serial number. It expects one parameter:

  • serialNumber: the serial number of the NFT to burn.

Example:

const nftBuilder = await TransactionBuilder.nft(api, signer, walletAddress, collectionId).burn(serialNumber);

createCollection()

Creates a new NFT Collection. It expects seven parameters.

  • name: the name of the collection.

  • initialIssuance: the initial issuance of the collection. Optional parameter. The value can be a number, bigint or string. Defaults to null.

  • maxIssuance: the maximum issuance of the collection. Optional parameter. The value can be a number, bigint or string. Defaults to null.

  • tokenOwner: the owner of the collection.

  • metadataUri: the metadata URI of the collection.

  • royalties: the royalties of the collection.

  • crossChain: the cross chain compatibility of the collection.

publicMintOn()

Toggles public minting on or off. It expects one parameter:

  • publicMintOn: value to set public minting to.

setCollectionId()

Set the collection ID. It expects one parameter:

  • collectionId: the collection ID to set.

setPrice()

Updates the mint fee of the collection. It expects two parameters:

  • token: the token to update the mint fee for.

  • price: the price to update to.

transferCollection()

Transfer ownership of the collection. It expects one parameter:

  • newOwner: the new owner to update to.

updateMetadataUri()

Updates the metadata URI of the collection. It expects one parameter.

  • uri: the metadata URI to update to.

updateMaxIssuance()

Update the max issuance of the collection. It expects one parameter.

  • maxIssuance: the max issuance to update to.

updateRoyalties()

Updates the royalties of the collection. It expects one parameter.

  • royalties: the royalties to update to.

More examples of the methods above can be found in Guides.

Last updated

© 2023 -> ♾️