0

I am using the Axelar network to transfer tokens from chain A to chain B I am using the function callContractWithToken in the Axelar network I need to figure out the gas fee which I should send to the Axelar network so I can be executed successfully I am ready to pay gas in Native token MATIC and well as the token which is being transferred.

I have already explored the Doc but it does not list the functionality of how the gas calculation can be done On chain? It has the SDK which can be used locally but I think that is not the best way to calculate the gas.

2 Answers 2

0

Is this to build a dapp on Axelar? If you’re just trying to bridge assets personally - I’d check out Cypher Wallet. EVM + cosmos bridges for $1-2. Alternate but more expensive and slower bridges are multi chain but gets the job done

0

Hey try out estimateGasFee() from axelarjs for this. https://docs.axelar.dev/dev/axelarjs-sdk/axelar-query-api#estimategasfee As is defined here

 public async estimateGasFee(
    sourceChainId: EvmChain | string,
    destinationChainId: EvmChain | string,
    sourceChainTokenSymbol: GasToken | string,
    gasLimit: number = DEFAULT_ESTIMATED_GAS,
    gasMultiplier = 1.1,
    minGasPrice = "0",
    gmpParams?: GMPParams
  ): Promise<string | AxelarQueryAPIFeeResponse> 

Currently there is no way to know the gas amount on both chains from within solidity code on a single chain. Just a heads up though any gas that you overpay in a cross chain transaction with axelar will be refunded to you so it is better to pay more than less and just leverage the refund to make life easier.

1
  • 1
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Oct 2, 2023 at 11:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.