gives me this address to swap 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee
this is list token function
async function listAvailableTokens() {
const result = await Moralis.Plugins.oneInch.getSupportedTokens({
chain: âbscâ, // The blockchain you want to use (eth/bsc/polygon)
});
tokens = result.tokens;
let parent = document.getElementById(âtoken_listâ);
for (const address in tokens) {
let token = tokens[address];
let div = document.createElement(âdivâ);
div.setAttribute(âdata-addressâ, address);
div.className = âtoken_rowâ;
let html = <img class="token_list_img" src="${token.logoURI}"> <span class="token_list_text">${token.symbol}</span>
;
div.innerHTML = html;
div.onclick = () => {
selectToken(address);
};
parent.appendChild(div);
}
}
this could be the address used for 1Inch as a way to represent BNB that is a native currency
ok thanks, is there a function to convert it?
You need to fix this by replacing it with this
if (currentTrade.from.symbol !== "BNB") {
I tried, it goes wrong
Which token are you swapping from and which token are you swapping to ?
For example if I use cake and usdt, everything is ok, if I use bnb from what I understand it gives me the native address and goes into error
thank you very much, i will check
Iâm going crazy: (I donât understand why it doesnât go with bnb
What is the error message associated with that 400 error code?
You should be able to see it in network tab in browser
{âresultâ:{âstatusâ:200,âdataâ:{âsuccessâ:true,âresultâ:{âerrorâ:422,âmessageâ:âMissing parametersâ}}}}
That is in response?
You can also look at the sent payload
{âchainâ:âbscâ,âfromTokenAddressâ:â0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeâ,âtoTokenAddressâ:â0x55d398326f99059ff775485246999027b3197955â,âamountâ:1000000000000000000,âfromAddressâ:â0xb1881beda759b8c4e0a71521ba9543fef5889e90â,âslippageâ:49,"_ApplicationId":âVekfg0LulQYGrKA1CvfgRjhktqCQD7wMXNIHmoqvâ,"_ClientVersion":âjs1.7.0â,"_InstallationId":â97a43697-8a7a-4823-a454-46428db1c2b3â,"_SessionToken":âr:93e74393d7f8f2c79198aadc10c02b76â}