Use 1inch API to swap native coin doesn't work

Hey, I am using 1inch API to swap from BNB/MATIC/ETH to token but it doesn’t work

it work for token swap but when I try to swap native coin to any token it doesn’t work, I get very big amount in confirmation pop up

also I use same response on TrustWallet and it is working perfectly

here is API response that I send in params

{
"from": "0xab4c8a98bd030029cf08ae5198bd6a347c2e12ec",
"to": "0x1111111254eeb25477b68fb85ed929f73a960582",
"data": "0x12aa3caf000000000000000000000000170d2ed0b2a5d9f450652be814784f964749ffa4000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee000000000000000000000000e9e7cea3dedca5984780bafc599bd69add087d56000000000000000000000000170d2ed0b2a5d9f450652be814784f964749ffa4000000000000000000000000ab4c8a98bd030029cf08ae5198bd6a347c2e12ec00000000000000000000000000000000000000000000000000017ff8d04c7800000000000000000000000000000000000000000000000000015c4a6093637b080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000009b00000000000000000000000000000000000000000000000000007d00001a4041bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095cd0e30db002a0000000000000000000000000000000000000000000000000015c4a6093637b08ee63c1e581cb99fe720124129520f7a09ca3cbef78d58ed934bb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c1111111254eeb25477b68fb85ed929f73a9605820000000000cfee7c08",
"value": "422181600000000",
}
``
![Screenshot 2023-06-09 at 2.43.23 PM|266x499](upload://zvamG5ouP34Rmf0ntkuf6fuujCt.jpeg)


I am using Flutter, 1inch API and Android/IOS
1 Like

1 Like

Hello @AmjadKhan2k18 !

Thanks for reporting!
Could you provide on the steps you take specifically when interacting with the swap 1inch API function ? Or provide source code with request and response object.
Perhaps there are some error logs in the console ?

1 Like

Hello @snwlprd.eth Thanks for quick response

there is no error in console

QA reported on IOS the amount is correct but when she tried to confirm transaction she got error

source code

`_walletConnectConnector.sendCustomRequest(
method: ‘eth_sendTransaction’,
params: [trxParams],
)

here is API and I use tx of response Map
api . 1inch dot io/ v5.0/56/swap?fromTokenAddress=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE&toTokenAddress=0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56&amount=422181600000000&fromAddress=0xab4c8a98bd030029cf08ae5198bd6a347c2e12ec&slippage=10
`

1 Like

@AmjadKhan2k18
You should test this using various RPC nodes. Some may not work correctly.

2 Likes

@snwlprd.eth but it’s working for token swap, I tried to swap USDT to MATIC/USDC and it worked perfectly and it worked for BUSD → BNB too

I don’t think it’s problem of RPC nodes

and same API work on TrustWallet for native coins

@snwlprd.eth how to test with various RPC nodes?

@AmjadKhan2k18

The Chainlist website has a list of available RPC nodes for BSC network:

1 Like

@snwlprd.eth I test it with different RPC nodes but none worked

@AmjadKhan2k18

You should open an issue in the official MetaMask repository if you haven’t already.

2 Likes

Yes I created an issue there

1 Like

@AmjadKhan2k18

Great! I am not an expert in Flutter development, so deploying your case pattern will take some time :grin:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.