Axelar query API
This module is a nice-to-have of common queries made into the Axelar network and its services that are abstracted into easy-to-use JavaScript one-liners.
Install the AxelarJS SDK module (AxelarQueryAPI
)
Install the AxelarJS SDK:
Instantiate the AxelarQueryAPI
module:
Possible queries
estimateGasFee
This is a useful query for GMP transactions, when invoking callContract
or callContractWithToken
to get an estimate of the appropriate gas payment to be made to the gas receiver on the source chain.
IMPORTANT NOTES:
- You must ensure the correct
gasLimit
is used for your gas estimation. ThegasLimit
parameter can be used here to override the default 700K gas limit that is used. - The
minGasPrice
andgasMultipler
parameters can be adjusted to enhance execution certainty of cross-chain transactions. - The response to the method gives a single value (in
wei
) of the total estimated gas required for the cross-chain call. In the GMPParams parameter, there is an option to show a full breakdown of fees instead by specifyingtrue
forshowDetailedFees
. If you do this, you will have to add the individual components of the fees yourself, e.g.(baseFee + executionFeeWithMultiplier)
for regular way GMP calls, or(baseFee + executionFeeWithMultiplier + expressFee)
for GMP Express calls
getTransferFee
Given a source chain, destination chain and amount of an asset, this query retrieves the base fee that the network would assess for that transaction.
getFeeForChainAndAsset
Given a chain and asset, retrieves the base fee that the network would assess.
getDenomFromSymbol
Get the denom for an asset given its symbol on a chain. For all the assets that Axelar supports natively, the network identifies the asset by a denom
, while most EVM chains have a symbol
for the asset.
The method below allows you to translate the asset symbol (as identified on an EVM chain) to the underlying denom.
For example, let’s say you have Axelar’s canonical testnet aUSDC
. The symbol for this asset on EVM chains is aUSDC
, and the denom is uausdc
. Sample usage to get denom from symbol:
getSymbolFromDenom
Get the symbol for an asset on a given chain given its denom. For all the assets that Axelar supports natively, the network identifies the asset by a denom
, while most EVM chains have a symbol
for the asset.
The method below allows you to translate the asset denom to the asset symbol (as identified on an EVM chain).
For example, let’s say you have Axelar’s canonical testnet aUSDC
. The symbol for this asset on EVM chains is aUSDC
, and the denom is uausdc
. Sample usage to get symbol from denom: