Processing 1Inch

Continuing the discussion from [Partner Guide] 1inch:

Ok so I have a ReactJS component that calls the 1Inch API approve and swap methods.

But:

  • I don’t get the mythical ‘tx’ field back from either call.
  • I never see anything pop up for the approval in my wallet.
  • By the time the swap order fires its complaining that the approve didn’t.
    Am I missing something stupid…again? Am I supposed to do something Web3’y with the “data” field?
    I don’t understand. The 1Inch forum guys keep talking about a “tx” field I never see.

Hi,
That error looks like it requires allowance before being able to make the trade.

In their swagger I remember was an api request for approving

Indeed. It’s the previous authorization API call that never went anywhere. It just bounced off their server with effectively just an echo. No Web3 was called.

Yeah, that’s what I’m trying to get working.

Hey @TheBubbleGuy

After call ​/v3.0​/56​/approve​/calldata you will recieve a response:

image

It’s a body for sendTransaction:

const web3 = await Moralis.Web3.enable();
            web3.eth
                .sendTransaction({
                    "data": "0x0.ddsdsd",
                    "gasPrice": "1000000000",
                    "to": "0xe9e7cea3dedca5984780bafc599bd69add087d56",
                    "value": "0",
                    from: "0x259DB2fD041d370e803f4D44951bE0E4722b7a45" // input it manually
                })

Hope this will help you :mage:

Hi, is there a way to check allowance not using 1inch plugin? I don’t see this api method on 1inch api?

https://docs.moralis.io/moralis-server/web3-sdk/token#gettokenallowance

Thx! Forgot to check Token tab sry :slight_smile: