fix: disable showing approve cost for arbitrum (#7594)
disable showing approve cost for arbitrum
This commit is contained in:
parent
52dc441e31
commit
79e74e1d13
@ -1,5 +1,5 @@
|
|||||||
import { MaxUint256, PERMIT2_ADDRESS } from '@uniswap/permit2-sdk'
|
import { MaxUint256, PERMIT2_ADDRESS } from '@uniswap/permit2-sdk'
|
||||||
import { Currency } from '@uniswap/sdk-core'
|
import { ChainId, Currency } from '@uniswap/sdk-core'
|
||||||
import ERC20_ABI from 'abis/erc20.json'
|
import ERC20_ABI from 'abis/erc20.json'
|
||||||
import { Erc20, Weth } from 'abis/types'
|
import { Erc20, Weth } from 'abis/types'
|
||||||
import WETH_ABI from 'abis/weth.json'
|
import WETH_ABI from 'abis/weth.json'
|
||||||
@ -26,6 +26,12 @@ export async function getApproveInfo(
|
|||||||
// If any of these arguments aren't provided, then we cannot generate approval cost info
|
// If any of these arguments aren't provided, then we cannot generate approval cost info
|
||||||
if (!account || !usdCostPerGas) return { needsApprove: false }
|
if (!account || !usdCostPerGas) return { needsApprove: false }
|
||||||
|
|
||||||
|
// routing-api under estimates gas for Arbitrum swaps so it inflates cost per gas by a lot
|
||||||
|
// so disable showing approves for Arbitrum until routing-api gives more accurate gas estimates
|
||||||
|
if (currency.chainId === ChainId.ARBITRUM_ONE || currency.chainId === ChainId.ARBITRUM_GOERLI) {
|
||||||
|
return { needsApprove: false }
|
||||||
|
}
|
||||||
|
|
||||||
const provider = DEPRECATED_RPC_PROVIDERS[currency.chainId as SupportedInterfaceChain]
|
const provider = DEPRECATED_RPC_PROVIDERS[currency.chainId as SupportedInterfaceChain]
|
||||||
const tokenContract = getContract(currency.address, ERC20_ABI, provider) as Erc20
|
const tokenContract = getContract(currency.address, ERC20_ABI, provider) as Erc20
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user