the problem is BNB token
what is the problem with BNB token?
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