Compare commits

...

2 Commits

Author SHA1 Message Date
eddie
a6f9fc5edf fix: use ConfirmSwapModal in expert mode (#6674) 2023-05-31 17:46:22 -04:00
UL Service Account
04c5ecc9ec ci: add global CODEOWNERS 2023-05-26 16:19:42 +00:00
3 changed files with 36 additions and 11 deletions

1
CODEOWNERS Normal file
View File

@@ -0,0 +1 @@
@uniswap/web-admins

View File

@@ -81,6 +81,34 @@ describe('Permit2', () => {
})
})
it('swaps after completing full permit2 approval process in expert mode', () => {
// Sets up a swap between INPUT_TOKEN and OUTPUT_TOKEN.
cy.visit(`/swap/?inputCurrency=${INPUT_TOKEN.address}&outputCurrency=${OUTPUT_TOKEN.address}&ape=true`, {
ethereum: 'hardhat',
})
cy.get('#swap-currency-input .token-amount-input').type(TEST_BALANCE_INCREMENT.toString())
cy.hardhat().then(({ provider }) => {
cy.spy(provider, 'send').as('permitApprovalSpy')
})
initiateSwap()
cy.contains('Enable spending limits for DAI on Uniswap').should('exist')
cy.contains('Approved').should('exist')
cy.contains('Allow DAI to be used for swapping').should('exist')
cy.contains('Confirm Swap').should('exist')
cy.then(() => {
const approvalTime = Date.now()
cy.contains('Swapped').should('exist')
expectTokenAllowanceForPermit2ToBeMax()
expectPermit2AllowanceForUniversalRouterToBeMax(approvalTime)
cy.get('@permitApprovalSpy').should('have.been.calledWith', 'eth_signTypedData_v4')
})
})
it('swaps after handling user rejection of both approval and signature', () => {
const USER_REJECTION = { code: 4001 }
cy.hardhat().then((hardhat) => {

View File

@@ -693,17 +693,13 @@ export function Swap({
) : (
<ButtonError
onClick={() => {
if (isExpertMode) {
handleSwap()
} else {
setSwapState({
tradeToConfirm: trade,
attemptingTxn: false,
swapError: undefined,
showConfirm: true,
txHash: undefined,
})
}
setSwapState({
tradeToConfirm: trade,
attemptingTxn: false,
swapError: undefined,
showConfirm: true,
txHash: undefined,
})
}}
id="swap-button"
data-testid="swap-button"