Hi everyone,
Iām getting the following error when trying to swap BNB for 1INCH using Moralis 1Inch Plugin:
{"result":{"status":200,"data":{"success":true,"result":{"statusCode":400,"message":"cannot sync 0x525D885Bc1E047c9e8cce006914aCF9BE2fdA9f6","error":"Bad Request"}}}}
This is the code Iām executing:
// connect to Moralis server
Moralis.initialize("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
Moralis.serverURL = "https://b8frmk04vyhn.usemoralis.com:2053/server";
var dex;
(async function(){
await Moralis.initPlugins();
dex = Moralis.Plugins.oneInch;
await Moralis.enable();
Moralis.authenticate().then(function (user) {
console.log("authenticated");
})
})();
async function swap(){
const NATIVE_ADDRESS = "0x525D885Bc1E047c9e8cce006914aCF9BE2fdA9f6";
const ONEINCH_ADDRESS = "0x111111111117dc0aa78b770fa6a738034120c302";
const options = {chain:"bsc",
fromTokenAddress:NATIVE_ADDRESS,
toTokenAddress:ONEINCH_ADDRESS,
amount: Number(Moralis.Units.ETH("0.5")),
fromAddress: Moralis.User.current().get("ethAddress"),
slippage: 50
}
var receipt = await dex.swap(options);
console.log(receipt)
My server is: https://b8frmk04vyhn.usemoralis.com:2053/server
Thank you very much
Matias