the bad request with amout >= 1000 with only tokens with decimals =18
const getQuote = async function () {
if (
!currentTrade.from ||
!currentTrade.to ||
!document.querySelector('#from-amount').value || document.querySelector('#from-amount').value <= 0
)
return;
const amount =Moralis.Units.Token(document.querySelector('#from-amount').value, currentTrade.from.decimals).toString();
console.log("fromamount:" + amount);
const quote = await Moralis.Plugins.oneInch.quote({
chain: 'bsc', // The blockchain you want to use (eth/bsc/polygon)
fromTokenAddress: currentTrade.from.address, // The token you want to swap
toTokenAddress: currentTrade.to.address, // The token you want to receive
amount: amount,
});
console.log(quote);
const t_amount= Moralis.Units.FromWei(quote.toTokenAmount, currentTrade.to.decimals);
document.querySelector('#to-amount').value =t_amount;
document.querySelector('#gas').innerHTML = quote.estimatedGas;
checkallow();
};