widgets icon indicating copy to clipboard operation
widgets copied to clipboard

Cannot Approve Token For Swap

Open talonZack opened this issue 2 years ago • 3 comments

Bug Description When trying to swap a token for the first time, I'm not given the option to approve it to be swapped

Steps to Reproduce

  1. Connect wallet to widget
  2. For the input token, select a token that a. The wallet holds b. The wallet has not approved uniswap to move (Allowance is 0)

Expected Behavior The action button should allow the user to approve Uniswap to move the tokens for a swap

Additional Context Present in Version 2.51.1 Screen Shot 2023-04-13 at 10 31 24 AM

talonZack avatar Apr 13 '23 15:04 talonZack

@talonZack think you have to set the permit2 use

function App() {
  <div className="Uniswap">
    <SwapWidget
      permit2 = true
    />
  </div>
}

Rachel-Eichenberger avatar Apr 18 '23 21:04 Rachel-Eichenberger

This issue has been mentioned here, too: https://github.com/Uniswap/widgets/issues/374#issuecomment-1471709474

I can confirm adding permit2 fixes the problem.

<SwapWidget
  permit2={true}
/>

I guess the Issue can be closed. However, I suggest adding it to the documentation of the widget.

Permit2 is a token approval contract that manages token approvals across different smart contracts.

Here is a link to the docs of Permit2, in case you wondered: https://blog.uniswap.org/permit2-and-universal-router#permit2---efficient-consistent-and-secure-approvals

rolandsaven avatar Jun 14 '23 19:06 rolandsaven

@Rachel-Eichenberger But what if we dont want to use permit2? why isnt it working with regular approve?

sirpy avatar Oct 30 '23 09:10 sirpy