When I try to use hasAllowance function, I get an error. And I do not know what to do.
the code I start on load:
const serverUrl = 'my server url' ;
const appId = 'my app id';
await Moralis.start({ serverUrl, appId });
await Moralis.initPlugins();
await Moralis.enableWeb3();
my code (userAddress and fromToken.address works okay):
async function hasAllowance() {
const allowance = await Moralis.Plugins.oneInch.hasAllowance({
chain: 'bsc',
fromTokenAddress: fromToken.address,
fromAddress: userAddress,
amount: '1000000',
});
console.log(`The user has enough allowance: ${allowance}`);
}
My payload:
1. amount: "1000000"
2. chain: "bsc"
3. fromAddress: "0x249c0b91b8825ac08f811a7cb5c6b2d490a194c1"
4. fromTokenAddress: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
5. _ApplicationId: "37q2D...(I deleted it)"
6. _ClientVersion: "js1.6.0"
7. _InstallationId: "6b6d901b-f03e-48c5-8923-cae0e8e9dfc6"
8. _SessionToken: "r:d8b28a68e60903752e21ca8c132eb3ff"
The response:
{"code":141,"error":{"status":502,"headers":{"x-powered-by":"Express","access-control-allow-origin":"*","content-type":"application/json; charset=utf-8","content-length":"24","etag":"W/\"18-py7kky+nYw+KpM//zLTacYk1OLw\"","x-response-time":"52.047ms","date":"Thu, 05 May 2022 22:20:26 GMT","connection":"close"},"buffer":{"type":"Buffer","data":[123,34,101,114,114,111,114,34,58,116,114,117,101,44,34,100,97,116,97,34,58,123,125,125]},"text":"{\"error\":true,\"data\":{}}","data":{"error":true,"data":{}}}}
Thanks!