fix: rm approval invariant (#3569)

This commit is contained in:
Zach Pomerantz 2022-03-21 13:40:27 -07:00 committed by GitHub
parent 6567f18bf5
commit 9e2dc9a435
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -7,7 +7,6 @@ import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { useERC20PermitFromTrade, UseERC20PermitState } from 'hooks/useERC20Permit'
import useTransactionDeadline from 'lib/hooks/useTransactionDeadline'
import { useCallback, useMemo, useState } from 'react'
import invariant from 'tiny-invariant'
import { getTxOptimizedSwapRouter, SwapRouterVersion } from 'utils/getTxOptimizedSwapRouter'
import { ApprovalState, useApproval, useApprovalStateForSpender } from '../useApproval'
@ -75,10 +74,6 @@ export default function useSwapApproval(
const spender = useSwapRouterAddress(trade)
const approval = useApproval(amountToApprove, spender, useIsPendingApproval)
if (trade instanceof V2Trade || trade instanceof V3Trade) {
const approvalState = approval[0]
invariant(approvalState === ApprovalState.APPROVED, 'Trying to approve legacy router')
}
return approval
}