I am trying to use 1inch swap API, but getting error most of the time. I'm trying to swap USDT to one custom token. The required allowance has already been provided.
I sometime get the response (even this has some issue, will highlight it below)
But for most of the time, Im getting cannot estimate
error.
Error response:
{
"statusCode": 400,
"error": "Bad Request",
"description": "cannot estimate",
"meta": [],
"requestId": "46c5abbb-347d-43d1-9c90-35ab8a220449"
}
And when getting the response, the value is always 0.
Response:
{
"fromToken": {
"symbol": "USDT",
"name": "Tether USD",
"decimals": 18,
"address": "0x55d398326f99059ff775485246999027b3197955",
"logoURI": "https://tokens.1inch.io/0xdac17f958d2ee523a2206206994597c13d831ec7.png"
},
"toToken": {
"address": "0xaf3889ba617ac973b358513d9031778d2bc783df",
"decimals": 9,
"symbol": "SHIBIC",
"name": "Shiba Inu Classic",
"logoURI": "https://etherscan.io/images/main/empty-token.png",
"isCustom": true
},
"toTokenAmount": "1502695685638969",
"fromTokenAmount": "1000000000000000000",
"protocols": [
[
[
{
"name": "PANCAKESWAP_V2",
"part": 100,
"fromTokenAddress": "0x55d398326f99059ff775485246999027b3197955",
"toTokenAddress": "0xaf3889ba617ac973b358513d9031778d2bc783df"
}
]
]
],
"tx": {
"from": "0x06125e1457f833E29D5aebAaCdF8eED8A6Febaee",
"to": "0x1111111254fb6c44bac0bed2854e76f90643097d",
"data": "0x7c0252000000000000000000000000003790c9b5a9b9d9aa1c69140a5f01a57c9b868e1e0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000018000000000000000000000000055d398326f99059ff775485246999027b3197955000000000000000000000000af3889ba617ac973b358513d9031778d2bc783df0000000000000000000000005f59de0d25fc7b40d797df79f91c2bd55aa5f26100000000000000000000000006125e1457f833e29d5aebaacdf8eed8a6febaee0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000004e95bb724e90b00000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a4b757fed60000000000000000000000005f59de0d25fc7b40d797df79f91c2bd55aa5f26100000000000000000000000055d398326f99059ff775485246999027b3197955000000000000000000000000af3889ba617ac973b358513d9031778d2bc783df0000000000000000002625a01111111254fb6c44bac0bed2854e76f90643097d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000cfee7c08",
"value": "0", // THIS IS ALWAYS ZERO
"gas": 1089735,
"gasPrice": "15000000000"
}
}
Can someone suggest me what exactly is the issue here?