EstimateTransferTokensGas
Last updated
Last updated
This function can be used to estimate the that will be required by a invocation. The information can be presented to users before they confirm the transaction.
async EstimateTransferTokensGas(args, apiKey)
args.to
String
Address to send tokens to.
args.amount
String
Amount to send in display units of the currency. So if you want the user to pay 0.5 ETH, pass in '0.5' to this field.
args.currency
Asset (class)
Asset object of the currency you want to send. You can pass a custom token here as well, please refer to the example below.
apiKey
String
ConvertBigNumberToNumber(bigNumber, decimal)
- Use this method while converting response values from a smart contract function call (which are in BigNumber format) to a JS Number.
Calling TransferTokens for a native currency:
The API Key generated from the
The result of the estimation is returned in the format. A conversion will need to be made to display the result in a human-readable format, and the following function can be used: