fix: don't format wrap input amount (#7592)

* fix: don't format wrap input amount

* lint
This commit is contained in:
cartcrom 2023-11-15 13:58:57 -05:00 committed by GitHub
parent 79e74e1d13
commit 0aa5727cdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -31,7 +31,6 @@ import { ThemedText } from 'theme/components'
import invariant from 'tiny-invariant' import invariant from 'tiny-invariant'
import { isL2ChainId } from 'utils/chains' import { isL2ChainId } from 'utils/chains'
import { SignatureExpiredError } from 'utils/errors' import { SignatureExpiredError } from 'utils/errors'
import { NumberType, useFormatter } from 'utils/formatNumbers'
import { formatSwapPriceUpdatedEventProperties } from 'utils/loggingFormatters' import { formatSwapPriceUpdatedEventProperties } from 'utils/loggingFormatters'
import { didUserReject } from 'utils/swapErrorToUserReadableMessage' import { didUserReject } from 'utils/swapErrorToUserReadableMessage'
import { tradeMeaningfullyDiffers } from 'utils/tradeMeaningFullyDiffer' import { tradeMeaningfullyDiffers } from 'utils/tradeMeaningFullyDiffer'
@ -82,7 +81,6 @@ function useConfirmModalState({
const [confirmModalState, setConfirmModalState] = useState<ConfirmModalState>(ConfirmModalState.REVIEWING) const [confirmModalState, setConfirmModalState] = useState<ConfirmModalState>(ConfirmModalState.REVIEWING)
const [approvalError, setApprovalError] = useState<PendingModalError>() const [approvalError, setApprovalError] = useState<PendingModalError>()
const [pendingModalSteps, setPendingModalSteps] = useState<PendingConfirmModalState[]>([]) const [pendingModalSteps, setPendingModalSteps] = useState<PendingConfirmModalState[]>([])
const { formatCurrencyAmount } = useFormatter()
// This is a function instead of a memoized value because we do _not_ want it to update as the allowance changes. // This is a function instead of a memoized value because we do _not_ want it to update as the allowance changes.
// For example, if the user needs to complete 3 steps initially, we should always show 3 step indicators // For example, if the user needs to complete 3 steps initially, we should always show 3 step indicators
@ -117,14 +115,7 @@ function useConfirmModalState({
const nativeCurrency = useNativeCurrency(chainId) const nativeCurrency = useNativeCurrency(chainId)
const [wrapTxHash, setWrapTxHash] = useState<string>() const [wrapTxHash, setWrapTxHash] = useState<string>()
const { execute: onWrap } = useWrapCallback( const { execute: onWrap } = useWrapCallback(nativeCurrency, trade.inputAmount.currency, trade.inputAmount.toExact())
nativeCurrency,
trade.inputAmount.currency,
formatCurrencyAmount({
amount: trade.inputAmount,
type: NumberType.SwapTradeAmount,
})
)
const wrapConfirmed = useIsTransactionConfirmed(wrapTxHash) const wrapConfirmed = useIsTransactionConfirmed(wrapTxHash)
const prevWrapConfirmed = usePrevious(wrapConfirmed) const prevWrapConfirmed = usePrevious(wrapConfirmed)
const catchUserReject = async (e: any, errorType: PendingModalError) => { const catchUserReject = async (e: any, errorType: PendingModalError) => {