Create
The library currently supplies the following helper functions for creating transactions:
addFeeProxy()
addFeeProxy()
Helper function used to add a fee proxy to the extrinsic. It expects two parameters:
assetId
: the asset ID to pay the fee in (1 for ROOT, 2 for XRP, 3 for Vortex, etc).slippage
: the slippage to use for the fee (in percentage).
Example:
To get more information and retrieve a list of available tokens and their asset IDs, refer to the Tokens section in the Block Explorer of The Root Network.
addFuturePass()
addFuturePass()
Helper function used to add a FuturePass to the extrinsic. It expects one parameter:
futurePass
: the FuturePass address to proxy the extrinsic through.
Example:
addFuturePassAndFeeProxy()
addFuturePassAndFeeProxy()
Helper function used to add a FuturePass and a FeeProxy to the extrinsic. It expects three parameters:
futurePass
: the FuturePass address to proxy the extrinsic through.assetId
: the asset ID to pay the fee in (1 for ROOT, 2 for XRP, 3 for Vortex etc).slippage
: the slippage to use for the fee (in percentage).
Example:
To get more information and retrieve a list of available tokens and their asset IDs, refer to the Tokens section in the Block Explorer of The Root Network.
checkBalance()
checkBalance()
Helper function used to get the balance of an asset. It can receive two parameters:
walletAddress
: the wallet address to get the balance. Wallet address is optional. When not provided, the wallet address of the instance will be used instead.assetId
: the asset ID to get the balance for.
Example:
checkBalances()
checkBalances()
Helper function used to check the balances of multiple assets for a given wallet address. It can receive one parameter:
walletAddress
andassetsId
: an array of the [walletAddresses, assetId] pair to check balances for. Wallet address is optional. When not provided, the wallet address of the instance will be used instead.
This function throws an error if the API is not connected or if no wallet address and asset IDs are provided as parameters or by the instantiated class.
Example:
filterExtrinsicEvents()
filterExtrinsicEvents()
Helper function used to filter extrinsic events. It expects two parameters:
events
: array of events to filter.names
: array of names to filter by.
Example:
getAmountsIn()
getAmountsIn()
Helper function used to get the extrinsic to send. It expects three parameters:
amount
: the amount to get the amounts in for.assetId
: the asset ID to get the amounts in for.slippage
: the slippage to use for the amounts in. Defaults to value5
.
Example:
getExtrinsicToSend()
getExtrinsicToSend()
Helper function used to get the extrinsic to send. It has no parameters.
Example:
getFuturePass()
getFuturePass()
Helper function used to get the FuturePass for the wallet address. It can receive one parameter:
walletAddress
: the wallet address to get the FuturePass for. Wallet address is optional. When not provided, the wallet address of the instance will be used instead.
This function throws an error if the API is not connected or if no wallet address is provided as a parameter or by the instantiated class.
Example:
getGasFees()
getGasFees()
Helper function used to get the gas fees for the extrinsic. It has no parameters.
Example:
getPayloads()
getPayloads()
Helper function used to get the payloads for the extrinsic. It has no parameters.
Example:
signAndSend()
signAndSend()
Helper function used to sign and send the extrinsic. It can receive two parameters. Both are optional:
onSign
: callback function to call when extrinsic is signed.onSend
: callback function to call when extrinsic is sent.
Example:
Last updated