Commit 54b4567a authored by eddie's avatar eddie Committed by GitHub

test: add e2e test for usdt special case (#6784)

* feat: revoke USDT approvals in ConfirmSwapModal

* chore: fix bad merge

* test: add e2e test for usdt special case

* fix: refactor test

* fix: make variable static

* fix: comments
parent fc45a504
This diff is collapsed.
...@@ -7,6 +7,8 @@ import { ApproveTransactionInfo, TransactionType } from 'state/transactions/type ...@@ -7,6 +7,8 @@ import { ApproveTransactionInfo, TransactionType } from 'state/transactions/type
import { UserRejectedRequestError } from 'utils/errors' import { UserRejectedRequestError } from 'utils/errors'
import { didUserReject } from 'utils/swapErrorToUserReadableMessage' import { didUserReject } from 'utils/swapErrorToUserReadableMessage'
const MAX_ALLOWANCE = MaxUint256.toString()
export function useTokenAllowance( export function useTokenAllowance(
token?: Token, token?: Token,
owner?: string, owner?: string,
...@@ -48,8 +50,7 @@ export function useUpdateTokenAllowance( ...@@ -48,8 +50,7 @@ export function useUpdateTokenAllowance(
if (!contract) throw new Error('missing contract') if (!contract) throw new Error('missing contract')
if (!spender) throw new Error('missing spender') if (!spender) throw new Error('missing spender')
const maxAllowance = MaxUint256.toString() const allowance = amount.equalTo(0) ? '0' : MAX_ALLOWANCE
const allowance = amount.equalTo(0) ? '0' : maxAllowance
const response = await contract.approve(spender, allowance) const response = await contract.approve(spender, allowance)
return { return {
response, response,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment