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
import { UserRejectedRequestError } from 'utils/errors'
import { didUserReject } from 'utils/swapErrorToUserReadableMessage'
const MAX_ALLOWANCE = MaxUint256.toString()
export function useTokenAllowance(
token?: Token,
owner?: string,
......@@ -48,8 +50,7 @@ export function useUpdateTokenAllowance(
if (!contract) throw new Error('missing contract')
if (!spender) throw new Error('missing spender')
const maxAllowance = MaxUint256.toString()
const allowance = amount.equalTo(0) ? '0' : maxAllowance
const allowance = amount.equalTo(0) ? '0' : MAX_ALLOWANCE
const response = await contract.approve(spender, allowance)
return {
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