EstimateTransferTokensGas
Description
This function can be used to estimate the Gas Limit and Gas Price that will be required by a TransferTokens
invocation. The information can be presented to users before they confirm the transaction.
Details
Signature
async EstimateTransferTokensGas(args, apiKey)
Arguments
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
Return Value
Handling Large Numerical Values
The result of the estimation is returned in the BigNumber format. A conversion will need to be made to display the result in a human-readable format, and the following function can be used:
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.
Example
Calling TransferTokens for a native currency:
Last updated