fix: Revert "fix: deep link by swapping sooner after user interaction" (#6092)
Revert "fix: deep link by swapping sooner after user interaction (#6073)" This reverts commit 3eeb467266af5854d68ae1bfefc13600d42eb538.
This commit is contained in:
parent
1b8cee7e87
commit
1610356a18
@ -136,7 +136,7 @@
|
|||||||
"@types/react-window-infinite-loader": "^1.0.6",
|
"@types/react-window-infinite-loader": "^1.0.6",
|
||||||
"@uniswap/analytics": "^1.3.1",
|
"@uniswap/analytics": "^1.3.1",
|
||||||
"@uniswap/analytics-events": "^2.4.0",
|
"@uniswap/analytics-events": "^2.4.0",
|
||||||
"@uniswap/conedison": "^1.5.1",
|
"@uniswap/conedison": "^1.4.0",
|
||||||
"@uniswap/governance": "^1.0.2",
|
"@uniswap/governance": "^1.0.2",
|
||||||
"@uniswap/liquidity-staker": "^1.0.2",
|
"@uniswap/liquidity-staker": "^1.0.2",
|
||||||
"@uniswap/merkle-distributor": "1.0.1",
|
"@uniswap/merkle-distributor": "1.0.1",
|
||||||
|
@ -28,7 +28,3 @@ export const BLOCKED_PRICE_IMPACT_NON_EXPERT: Percent = new Percent(JSBI.BigInt(
|
|||||||
|
|
||||||
export const ZERO_PERCENT = new Percent('0')
|
export const ZERO_PERCENT = new Percent('0')
|
||||||
export const ONE_HUNDRED_PERCENT = new Percent('1')
|
export const ONE_HUNDRED_PERCENT = new Percent('1')
|
||||||
|
|
||||||
// gas margin to ensure successful transactions
|
|
||||||
export const TX_GAS_MARGIN = 0.2
|
|
||||||
export const NFT_TX_GAS_MARGIN = 0.05
|
|
||||||
|
@ -3,15 +3,14 @@ import { BigNumber } from '@ethersproject/bignumber'
|
|||||||
import { t } from '@lingui/macro'
|
import { t } from '@lingui/macro'
|
||||||
import { sendAnalyticsEvent } from '@uniswap/analytics'
|
import { sendAnalyticsEvent } from '@uniswap/analytics'
|
||||||
import { SwapEventName } from '@uniswap/analytics-events'
|
import { SwapEventName } from '@uniswap/analytics-events'
|
||||||
import { sendTransaction } from '@uniswap/conedison/provider/index'
|
|
||||||
import { Trade } from '@uniswap/router-sdk'
|
import { Trade } from '@uniswap/router-sdk'
|
||||||
import { Currency, Percent, TradeType } from '@uniswap/sdk-core'
|
import { Currency, Percent, TradeType } from '@uniswap/sdk-core'
|
||||||
import { SwapRouter, UNIVERSAL_ROUTER_ADDRESS } from '@uniswap/universal-router-sdk'
|
import { SwapRouter, UNIVERSAL_ROUTER_ADDRESS } from '@uniswap/universal-router-sdk'
|
||||||
import { FeeOptions, toHex } from '@uniswap/v3-sdk'
|
import { FeeOptions, toHex } from '@uniswap/v3-sdk'
|
||||||
import { useWeb3React } from '@web3-react/core'
|
import { useWeb3React } from '@web3-react/core'
|
||||||
import { TX_GAS_MARGIN } from 'constants/misc'
|
|
||||||
import { formatSwapSignedAnalyticsEventProperties } from 'lib/utils/analytics'
|
import { formatSwapSignedAnalyticsEventProperties } from 'lib/utils/analytics'
|
||||||
import { useCallback } from 'react'
|
import { useCallback } from 'react'
|
||||||
|
import { calculateGasMargin } from 'utils/calculateGasMargin'
|
||||||
import isZero from 'utils/isZero'
|
import isZero from 'utils/isZero'
|
||||||
import { swapErrorToUserReadableMessage } from 'utils/swapErrorToUserReadableMessage'
|
import { swapErrorToUserReadableMessage } from 'utils/swapErrorToUserReadableMessage'
|
||||||
|
|
||||||
@ -53,7 +52,18 @@ export function useUniversalRouterSwapCallback(
|
|||||||
...(value && !isZero(value) ? { value: toHex(value) } : {}),
|
...(value && !isZero(value) ? { value: toHex(value) } : {}),
|
||||||
}
|
}
|
||||||
|
|
||||||
const response = await sendTransaction(provider, tx, TX_GAS_MARGIN).then((response) => {
|
let gasEstimate: BigNumber
|
||||||
|
try {
|
||||||
|
gasEstimate = await provider.estimateGas(tx)
|
||||||
|
} catch (gasError) {
|
||||||
|
console.warn(gasError)
|
||||||
|
throw new Error('Your swap is expected to fail')
|
||||||
|
}
|
||||||
|
const gasLimit = calculateGasMargin(gasEstimate)
|
||||||
|
const response = await provider
|
||||||
|
.getSigner()
|
||||||
|
.sendTransaction({ ...tx, gasLimit })
|
||||||
|
.then((response) => {
|
||||||
sendAnalyticsEvent(
|
sendAnalyticsEvent(
|
||||||
SwapEventName.SWAP_SIGNED,
|
SwapEventName.SWAP_SIGNED,
|
||||||
formatSwapSignedAnalyticsEventProperties({ trade, txHash: response.hash })
|
formatSwapSignedAnalyticsEventProperties({ trade, txHash: response.hash })
|
||||||
|
@ -194,7 +194,7 @@ const Bag = () => {
|
|||||||
const purchaseAssets = async (routingData: RouteResponse, purchasingWithErc20: boolean) => {
|
const purchaseAssets = async (routingData: RouteResponse, purchasingWithErc20: boolean) => {
|
||||||
if (!provider || !routingData) return
|
if (!provider || !routingData) return
|
||||||
const purchaseResponse = await sendTransaction(
|
const purchaseResponse = await sendTransaction(
|
||||||
provider,
|
provider?.getSigner(),
|
||||||
itemsInBag.filter((item) => item.status !== BagItemStatus.UNAVAILABLE).map((item) => item.asset),
|
itemsInBag.filter((item) => item.status !== BagItemStatus.UNAVAILABLE).map((item) => item.asset),
|
||||||
routingData,
|
routingData,
|
||||||
purchasingWithErc20
|
purchasingWithErc20
|
||||||
|
@ -2,11 +2,9 @@ import { Interface } from '@ethersproject/abi'
|
|||||||
import { BigNumber } from '@ethersproject/bignumber'
|
import { BigNumber } from '@ethersproject/bignumber'
|
||||||
import { hexStripZeros } from '@ethersproject/bytes'
|
import { hexStripZeros } from '@ethersproject/bytes'
|
||||||
import { ContractReceipt } from '@ethersproject/contracts'
|
import { ContractReceipt } from '@ethersproject/contracts'
|
||||||
import { JsonRpcProvider } from '@ethersproject/providers'
|
import type { JsonRpcSigner } from '@ethersproject/providers'
|
||||||
import { sendAnalyticsEvent } from '@uniswap/analytics'
|
import { sendAnalyticsEvent } from '@uniswap/analytics'
|
||||||
import { NFTEventName } from '@uniswap/analytics-events'
|
import { NFTEventName } from '@uniswap/analytics-events'
|
||||||
import { sendTransaction } from '@uniswap/conedison/provider/index'
|
|
||||||
import { NFT_TX_GAS_MARGIN } from 'constants/misc'
|
|
||||||
import create from 'zustand'
|
import create from 'zustand'
|
||||||
import { devtools } from 'zustand/middleware'
|
import { devtools } from 'zustand/middleware'
|
||||||
|
|
||||||
@ -23,7 +21,7 @@ interface TxState {
|
|||||||
clearTxHash: () => void
|
clearTxHash: () => void
|
||||||
purchasedWithErc20: boolean
|
purchasedWithErc20: boolean
|
||||||
sendTransaction: (
|
sendTransaction: (
|
||||||
provider: JsonRpcProvider,
|
signer: JsonRpcSigner,
|
||||||
selectedAssets: UpdatedGenieAsset[],
|
selectedAssets: UpdatedGenieAsset[],
|
||||||
transactionData: RouteResponse,
|
transactionData: RouteResponse,
|
||||||
purchasedWithErc20: boolean
|
purchasedWithErc20: boolean
|
||||||
@ -38,18 +36,21 @@ export const useSendTransaction = create<TxState>()(
|
|||||||
purchasedWithErc20: false,
|
purchasedWithErc20: false,
|
||||||
clearTxHash: () => set({ txHash: '' }),
|
clearTxHash: () => set({ txHash: '' }),
|
||||||
setState: (newState) => set(() => ({ state: newState })),
|
setState: (newState) => set(() => ({ state: newState })),
|
||||||
sendTransaction: async (provider, selectedAssets, transactionData, purchasedWithErc20) => {
|
sendTransaction: async (signer, selectedAssets, transactionData, purchasedWithErc20) => {
|
||||||
const address = await provider.getSigner().getAddress()
|
const address = await signer.getAddress()
|
||||||
try {
|
try {
|
||||||
set({ state: TxStateType.Signing })
|
const txNoGasLimit = {
|
||||||
|
|
||||||
const tx = {
|
|
||||||
to: transactionData.to,
|
to: transactionData.to,
|
||||||
value: transactionData.valueToSend ? BigNumber.from(transactionData.valueToSend) : undefined,
|
value: transactionData.valueToSend ? BigNumber.from(transactionData.valueToSend) : undefined,
|
||||||
data: transactionData.data,
|
data: transactionData.data,
|
||||||
}
|
}
|
||||||
const res = await sendTransaction(provider, tx, NFT_TX_GAS_MARGIN)
|
|
||||||
|
|
||||||
|
const gasLimit = (await signer.estimateGas(txNoGasLimit)).mul(105).div(100)
|
||||||
|
// tx['gasLimit'] = gasLimit
|
||||||
|
const tx = { ...txNoGasLimit, gasLimit } // TODO test this works when firing off tx
|
||||||
|
|
||||||
|
set({ state: TxStateType.Signing })
|
||||||
|
const res = await signer.sendTransaction(tx)
|
||||||
set({ state: TxStateType.Confirming })
|
set({ state: TxStateType.Confirming })
|
||||||
set({ txHash: res.hash })
|
set({ txHash: res.hash })
|
||||||
set({ purchasedWithErc20 })
|
set({ purchasedWithErc20 })
|
||||||
|
@ -3,7 +3,6 @@ import type { TransactionResponse } from '@ethersproject/providers'
|
|||||||
import { Trans } from '@lingui/macro'
|
import { Trans } from '@lingui/macro'
|
||||||
import { TraceEvent } from '@uniswap/analytics'
|
import { TraceEvent } from '@uniswap/analytics'
|
||||||
import { BrowserEvent, InterfaceElementName, InterfaceEventName } from '@uniswap/analytics-events'
|
import { BrowserEvent, InterfaceElementName, InterfaceEventName } from '@uniswap/analytics-events'
|
||||||
import { sendTransaction } from '@uniswap/conedison/provider/index'
|
|
||||||
import { Currency, CurrencyAmount, Percent } from '@uniswap/sdk-core'
|
import { Currency, CurrencyAmount, Percent } from '@uniswap/sdk-core'
|
||||||
import { FeeAmount, NonfungiblePositionManager } from '@uniswap/v3-sdk'
|
import { FeeAmount, NonfungiblePositionManager } from '@uniswap/v3-sdk'
|
||||||
import { useWeb3React } from '@web3-react/core'
|
import { useWeb3React } from '@web3-react/core'
|
||||||
@ -38,7 +37,7 @@ import Row, { AutoRow, RowBetween, RowFixed } from '../../components/Row'
|
|||||||
import { SwitchLocaleLink } from '../../components/SwitchLocaleLink'
|
import { SwitchLocaleLink } from '../../components/SwitchLocaleLink'
|
||||||
import TransactionConfirmationModal, { ConfirmationModalContent } from '../../components/TransactionConfirmationModal'
|
import TransactionConfirmationModal, { ConfirmationModalContent } from '../../components/TransactionConfirmationModal'
|
||||||
import { NONFUNGIBLE_POSITION_MANAGER_ADDRESSES } from '../../constants/addresses'
|
import { NONFUNGIBLE_POSITION_MANAGER_ADDRESSES } from '../../constants/addresses'
|
||||||
import { TX_GAS_MARGIN, ZERO_PERCENT } from '../../constants/misc'
|
import { ZERO_PERCENT } from '../../constants/misc'
|
||||||
import { WRAPPED_NATIVE_CURRENCY } from '../../constants/tokens'
|
import { WRAPPED_NATIVE_CURRENCY } from '../../constants/tokens'
|
||||||
import { useCurrency } from '../../hooks/Tokens'
|
import { useCurrency } from '../../hooks/Tokens'
|
||||||
import { ApprovalState, useApproveCallback } from '../../hooks/useApproveCallback'
|
import { ApprovalState, useApproveCallback } from '../../hooks/useApproveCallback'
|
||||||
@ -56,6 +55,7 @@ import { TransactionType } from '../../state/transactions/types'
|
|||||||
import { useIsExpertMode, useUserSlippageToleranceWithDefault } from '../../state/user/hooks'
|
import { useIsExpertMode, useUserSlippageToleranceWithDefault } from '../../state/user/hooks'
|
||||||
import { ExternalLink, ThemedText } from '../../theme'
|
import { ExternalLink, ThemedText } from '../../theme'
|
||||||
import approveAmountCalldata from '../../utils/approveAmountCalldata'
|
import approveAmountCalldata from '../../utils/approveAmountCalldata'
|
||||||
|
import { calculateGasMargin } from '../../utils/calculateGasMargin'
|
||||||
import { currencyId } from '../../utils/currencyId'
|
import { currencyId } from '../../utils/currencyId'
|
||||||
import { maxAmountSpend } from '../../utils/maxAmountSpend'
|
import { maxAmountSpend } from '../../utils/maxAmountSpend'
|
||||||
import { Dots } from '../Pool/styleds'
|
import { Dots } from '../Pool/styleds'
|
||||||
@ -288,7 +288,18 @@ export default function AddLiquidity() {
|
|||||||
|
|
||||||
setAttemptingTxn(true)
|
setAttemptingTxn(true)
|
||||||
|
|
||||||
sendTransaction(provider, txn, TX_GAS_MARGIN)
|
provider
|
||||||
|
.getSigner()
|
||||||
|
.estimateGas(txn)
|
||||||
|
.then((estimate) => {
|
||||||
|
const newTxn = {
|
||||||
|
...txn,
|
||||||
|
gasLimit: calculateGasMargin(estimate),
|
||||||
|
}
|
||||||
|
|
||||||
|
return provider
|
||||||
|
.getSigner()
|
||||||
|
.sendTransaction(newTxn)
|
||||||
.then((response: TransactionResponse) => {
|
.then((response: TransactionResponse) => {
|
||||||
setAttemptingTxn(false)
|
setAttemptingTxn(false)
|
||||||
addTransaction(response, {
|
addTransaction(response, {
|
||||||
@ -307,6 +318,7 @@ export default function AddLiquidity() {
|
|||||||
label: [currencies[Field.CURRENCY_A]?.symbol, currencies[Field.CURRENCY_B]?.symbol].join('/'),
|
label: [currencies[Field.CURRENCY_A]?.symbol, currencies[Field.CURRENCY_B]?.symbol].join('/'),
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error('Failed to send transaction', error)
|
console.error('Failed to send transaction', error)
|
||||||
setAttemptingTxn(false)
|
setAttemptingTxn(false)
|
||||||
|
@ -3,7 +3,6 @@ import type { TransactionResponse } from '@ethersproject/providers'
|
|||||||
import { Trans } from '@lingui/macro'
|
import { Trans } from '@lingui/macro'
|
||||||
import { Trace } from '@uniswap/analytics'
|
import { Trace } from '@uniswap/analytics'
|
||||||
import { InterfacePageName } from '@uniswap/analytics-events'
|
import { InterfacePageName } from '@uniswap/analytics-events'
|
||||||
import { sendTransaction } from '@uniswap/conedison/provider/index'
|
|
||||||
import { Currency, CurrencyAmount, Fraction, Percent, Price, Token } from '@uniswap/sdk-core'
|
import { Currency, CurrencyAmount, Fraction, Percent, Price, Token } from '@uniswap/sdk-core'
|
||||||
import { NonfungiblePositionManager, Pool, Position } from '@uniswap/v3-sdk'
|
import { NonfungiblePositionManager, Pool, Position } from '@uniswap/v3-sdk'
|
||||||
import { useWeb3React } from '@web3-react/core'
|
import { useWeb3React } from '@web3-react/core'
|
||||||
@ -19,7 +18,6 @@ import { RowBetween, RowFixed } from 'components/Row'
|
|||||||
import { Dots } from 'components/swap/styleds'
|
import { Dots } from 'components/swap/styleds'
|
||||||
import Toggle from 'components/Toggle'
|
import Toggle from 'components/Toggle'
|
||||||
import TransactionConfirmationModal, { ConfirmationModalContent } from 'components/TransactionConfirmationModal'
|
import TransactionConfirmationModal, { ConfirmationModalContent } from 'components/TransactionConfirmationModal'
|
||||||
import { TX_GAS_MARGIN } from 'constants/misc'
|
|
||||||
import { useToken } from 'hooks/Tokens'
|
import { useToken } from 'hooks/Tokens'
|
||||||
import { useV3NFTPositionManagerContract } from 'hooks/useContract'
|
import { useV3NFTPositionManagerContract } from 'hooks/useContract'
|
||||||
import useIsTickAtLimit from 'hooks/useIsTickAtLimit'
|
import useIsTickAtLimit from 'hooks/useIsTickAtLimit'
|
||||||
@ -47,6 +45,7 @@ import RateToggle from '../../components/RateToggle'
|
|||||||
import { SwitchLocaleLink } from '../../components/SwitchLocaleLink'
|
import { SwitchLocaleLink } from '../../components/SwitchLocaleLink'
|
||||||
import { usePositionTokenURI } from '../../hooks/usePositionTokenURI'
|
import { usePositionTokenURI } from '../../hooks/usePositionTokenURI'
|
||||||
import { TransactionType } from '../../state/transactions/types'
|
import { TransactionType } from '../../state/transactions/types'
|
||||||
|
import { calculateGasMargin } from '../../utils/calculateGasMargin'
|
||||||
import { ExplorerDataType, getExplorerLink } from '../../utils/getExplorerLink'
|
import { ExplorerDataType, getExplorerLink } from '../../utils/getExplorerLink'
|
||||||
import { LoadingRows } from './styleds'
|
import { LoadingRows } from './styleds'
|
||||||
|
|
||||||
@ -464,7 +463,18 @@ export function PositionPage() {
|
|||||||
value,
|
value,
|
||||||
}
|
}
|
||||||
|
|
||||||
sendTransaction(provider, txn, TX_GAS_MARGIN)
|
provider
|
||||||
|
.getSigner()
|
||||||
|
.estimateGas(txn)
|
||||||
|
.then((estimate) => {
|
||||||
|
const newTxn = {
|
||||||
|
...txn,
|
||||||
|
gasLimit: calculateGasMargin(estimate),
|
||||||
|
}
|
||||||
|
|
||||||
|
return provider
|
||||||
|
.getSigner()
|
||||||
|
.sendTransaction(newTxn)
|
||||||
.then((response: TransactionResponse) => {
|
.then((response: TransactionResponse) => {
|
||||||
setCollectMigrationHash(response.hash)
|
setCollectMigrationHash(response.hash)
|
||||||
setCollecting(false)
|
setCollecting(false)
|
||||||
@ -483,6 +493,7 @@ export function PositionPage() {
|
|||||||
expectedCurrencyOwed1: CurrencyAmount.fromRawAmount(currency1ForFeeCollectionPurposes, 0).toExact(),
|
expectedCurrencyOwed1: CurrencyAmount.fromRawAmount(currency1ForFeeCollectionPurposes, 0).toExact(),
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
setCollecting(false)
|
setCollecting(false)
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { BigNumber } from '@ethersproject/bignumber'
|
import { BigNumber } from '@ethersproject/bignumber'
|
||||||
import type { TransactionResponse } from '@ethersproject/providers'
|
import type { TransactionResponse } from '@ethersproject/providers'
|
||||||
import { Trans } from '@lingui/macro'
|
import { Trans } from '@lingui/macro'
|
||||||
import { sendTransaction } from '@uniswap/conedison/provider/index'
|
|
||||||
import { CurrencyAmount, Percent } from '@uniswap/sdk-core'
|
import { CurrencyAmount, Percent } from '@uniswap/sdk-core'
|
||||||
import { NonfungiblePositionManager } from '@uniswap/v3-sdk'
|
import { NonfungiblePositionManager } from '@uniswap/v3-sdk'
|
||||||
import { useWeb3React } from '@web3-react/core'
|
import { useWeb3React } from '@web3-react/core'
|
||||||
@ -19,7 +18,6 @@ import { AddRemoveTabs } from 'components/NavigationTabs'
|
|||||||
import { AutoRow, RowBetween, RowFixed } from 'components/Row'
|
import { AutoRow, RowBetween, RowFixed } from 'components/Row'
|
||||||
import Slider from 'components/Slider'
|
import Slider from 'components/Slider'
|
||||||
import Toggle from 'components/Toggle'
|
import Toggle from 'components/Toggle'
|
||||||
import { TX_GAS_MARGIN } from 'constants/misc'
|
|
||||||
import { useV3NFTPositionManagerContract } from 'hooks/useContract'
|
import { useV3NFTPositionManagerContract } from 'hooks/useContract'
|
||||||
import useDebouncedChangeHandler from 'hooks/useDebouncedChangeHandler'
|
import useDebouncedChangeHandler from 'hooks/useDebouncedChangeHandler'
|
||||||
import useTransactionDeadline from 'hooks/useTransactionDeadline'
|
import useTransactionDeadline from 'hooks/useTransactionDeadline'
|
||||||
@ -37,6 +35,7 @@ import { ThemedText } from 'theme'
|
|||||||
import TransactionConfirmationModal, { ConfirmationModalContent } from '../../components/TransactionConfirmationModal'
|
import TransactionConfirmationModal, { ConfirmationModalContent } from '../../components/TransactionConfirmationModal'
|
||||||
import { WRAPPED_NATIVE_CURRENCY } from '../../constants/tokens'
|
import { WRAPPED_NATIVE_CURRENCY } from '../../constants/tokens'
|
||||||
import { TransactionType } from '../../state/transactions/types'
|
import { TransactionType } from '../../state/transactions/types'
|
||||||
|
import { calculateGasMargin } from '../../utils/calculateGasMargin'
|
||||||
import { currencyId } from '../../utils/currencyId'
|
import { currencyId } from '../../utils/currencyId'
|
||||||
import AppBody from '../AppBody'
|
import AppBody from '../AppBody'
|
||||||
import { ResponsiveHeaderText, SmallMaxButton, Wrapper } from './styled'
|
import { ResponsiveHeaderText, SmallMaxButton, Wrapper } from './styled'
|
||||||
@ -134,7 +133,18 @@ function Remove({ tokenId }: { tokenId: BigNumber }) {
|
|||||||
value,
|
value,
|
||||||
}
|
}
|
||||||
|
|
||||||
sendTransaction(provider, txn, TX_GAS_MARGIN)
|
provider
|
||||||
|
.getSigner()
|
||||||
|
.estimateGas(txn)
|
||||||
|
.then((estimate) => {
|
||||||
|
const newTxn = {
|
||||||
|
...txn,
|
||||||
|
gasLimit: calculateGasMargin(estimate),
|
||||||
|
}
|
||||||
|
|
||||||
|
return provider
|
||||||
|
.getSigner()
|
||||||
|
.sendTransaction(newTxn)
|
||||||
.then((response: TransactionResponse) => {
|
.then((response: TransactionResponse) => {
|
||||||
sendEvent({
|
sendEvent({
|
||||||
category: 'Liquidity',
|
category: 'Liquidity',
|
||||||
@ -151,6 +161,7 @@ function Remove({ tokenId }: { tokenId: BigNumber }) {
|
|||||||
expectedAmountQuoteRaw: liquidityValue1.quotient.toString(),
|
expectedAmountQuoteRaw: liquidityValue1.quotient.toString(),
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
setAttemptingTxn(false)
|
setAttemptingTxn(false)
|
||||||
console.error(error)
|
console.error(error)
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
import { BigNumber } from '@ethersproject/bignumber'
|
import { BigNumber } from '@ethersproject/bignumber'
|
||||||
import { TX_GAS_MARGIN } from 'constants/misc'
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the gas value plus a margin for unexpected or variable gas costs
|
* Returns the gas value plus a margin for unexpected or variable gas costs
|
||||||
* @param value the gas value to pad
|
* @param value the gas value to pad
|
||||||
*/
|
*/
|
||||||
export function calculateGasMargin(value: BigNumber): BigNumber {
|
export function calculateGasMargin(value: BigNumber): BigNumber {
|
||||||
return value.add(value.mul(Math.floor(TX_GAS_MARGIN * 100)).div(100))
|
return value.mul(120).div(100)
|
||||||
}
|
}
|
||||||
|
@ -5003,10 +5003,10 @@
|
|||||||
react "^18.2.0"
|
react "^18.2.0"
|
||||||
react-dom "^18.2.0"
|
react-dom "^18.2.0"
|
||||||
|
|
||||||
"@uniswap/conedison@^1.3.0", "@uniswap/conedison@^1.5.1":
|
"@uniswap/conedison@^1.3.0", "@uniswap/conedison@^1.4.0":
|
||||||
version "1.5.1"
|
version "1.4.0"
|
||||||
resolved "https://registry.yarnpkg.com/@uniswap/conedison/-/conedison-1.5.1.tgz#91527cc9928ce0187f30a5eb4abb705b8f0cd013"
|
resolved "https://registry.yarnpkg.com/@uniswap/conedison/-/conedison-1.4.0.tgz#44ad96333b92913a57be34bf5effcfee6534cba1"
|
||||||
integrity sha512-VJqUW4l54QVj5a4vAzAlWWd193iCcT8HMugFPB28S2Uqhs2elAg/RDQmiPOf9TOFB635MdBlD0S6xUuqo7FB4A==
|
integrity sha512-ZZMfPTjUiYpLvO0SuMPGNzkFrRpzf+bQYSL/CzaYKGSVdorRUj4XpeMdjlbuKUtHqUEunOWE8eDL3J1Hl4HOUg==
|
||||||
|
|
||||||
"@uniswap/default-token-list@^2.0.0":
|
"@uniswap/default-token-list@^2.0.0":
|
||||||
version "2.2.0"
|
version "2.2.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user