Asset

asset()

Creates an AssetBuilder class instance, which provides methods to build transactions for AssetsExt 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 assetBuilder = await TransactionBuilder.asset(api, signer, walletAddress, assetId)

The asset method provides developers with the capability to perform extrinsic transfer.

transfer()

Sets the base extrinsic to an asset to a destination address. It expects two parameters:

  • destinationAddress: the destination address wallet address to transfer to.

  • amount: the amount to transfer. The value can be a number, bigint or string but must be a valid number, including decimals. For example, if you are transferring 1.3 tokens with a precision of 6 decimals, you should pass in 1300000 as the amount.

Example:

const assetBuilder = await TransactionBuilder.asset(api, signer, walletAddress, assetId).transfer({ destinationAddress: userSession?.futurepass, amount: 1 });

Last updated

© 2023 -> ♾️