0

I'm currently implementing the Avalanche 0x API for swapping in our UI. The quote arguments are the same as what we use for the ETH mainnet, but it returns Gas estimation failed; not sure how to debug this, can someone please help?

Below is an example call we make:

https://avalanche.api.0x.org/swap/v1/quote?&buyToken=0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664&sellToken=0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7&slippagePercentage=0.0025&sellAmount=550000000000000000

buyToken: AVAX contract address
sellToken: USDC contract address
takerAddress: the address of the user that is initiating the swap
sellAmount: amount in AVAX
NOTE: we also use affiliateAddress and slippagePercentage but I haven't included them in the link above

Thanks!

1
  • I think this refers to the available gas. The function call first estimates if it's been allocated enough gas to accomplish/run the function. If not, it will not run as that would just spend the allocated gas without accomplishing anything.
    – Sky
    Commented Nov 10, 2021 at 13:08

1 Answer 1

0

This usually happens if takerAddress does not have the funds or allowances set up to make the trade.

Your Answer

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