1nch getQuote function type def error : "amount should be a number string"

If you get that number to not be in that e+ notation that it may work

Thank you for your screenshots @Assan
I tried to replicate the issue.

  const getQuote = async (params) => {
    console.log('From Amount:', params.fromAmount);
    console.log('Token Amount:', Moralis.Units.Token(params.fromAmount, params.fromToken.decimals).toString())
    await Moralis.Plugins.oneInch.quote({
      chain: params.chain, // The blockchain  you want to use (eth/bsc/polygon)
      fromTokenAddress: params.fromToken.address, // The token you want to swap
      toTokenAddress: params.toToken.address, // The token you want to receive
      amount: Moralis.Units.Token(params.fromAmount, params.fromToken.decimals).toString(),
    });
  }

I never get scientific notations when trying to getQuote.

If I remember correctly, I did fix the e notation here Moralis.Units.Token few months ago.
What is the version of the server you are currently running?

You can find the version in your admin panel:

image

Please make sure your server is up to date and try again.

Keep me posted.

Thank you so much @Dani! Yes, the issue was with the server version I was actually using V 0.0.322. Now that I have it updated to 0.0.330 it’s all good. Thanks again!

1 Like