widgets
widgets copied to clipboard
Cannot Approve Token For Swap
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
- Connect wallet to widget
- 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

@talonZack think you have to set the permit2 use
function App() {
<div className="Uniswap">
<SwapWidget
permit2 = true
/>
</div>
}
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
@Rachel-Eichenberger But what if we dont want to use permit2? why isnt it working with regular approve?