Skip to content

Commit

Permalink
fix: support partial approve it classic eth flow
Browse files Browse the repository at this point in the history
  • Loading branch information
shoom3301 committed Dec 26, 2024
1 parent aa42dfc commit 98be3cd
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { Currency, CurrencyAmount } from '@uniswap/sdk-core'

import { useSingleActivityDescriptor } from 'legacy/hooks/useRecentActivity'
import { WrapUnwrapCallback } from 'legacy/hooks/useWrapCallback'
import { usePartialApprove } from 'legacy/state/user/hooks'

import { getDerivedEthFlowState } from 'modules/swap/containers/EthFlow/utils/getDerivedEthFlowState'
import { EthFlowModalContent } from 'modules/swap/pure/EthFlow/EthFlowModalContent'
Expand All @@ -25,7 +26,6 @@ import { useEthFlowActions } from './hooks/useEthFlowActions'
import useRemainingNativeTxsAndCosts from './hooks/useRemainingNativeTxsAndCosts'
import { useSetupEthFlow } from './hooks/useSetupEthFlow'


export interface EthFlowProps {
nativeInput?: CurrencyAmount<Currency>
hasEnoughWrappedBalanceForSwap: boolean
Expand All @@ -45,10 +45,12 @@ export function EthFlowModal({
const native = useNativeCurrency()
const wrapped = useWrappedToken()
const { state: approvalState } = useApproveState(nativeInput || null)
const [isPartialApprove] = usePartialApprove()

const ethFlowContext = useAtomValue(ethFlowContextAtom)
const approveCallback = useTradeApproveCallback(
(nativeInput && currencyAmountToTokenAmount(nativeInput)) || undefined
(nativeInput && currencyAmountToTokenAmount(nativeInput)) || undefined,
isPartialApprove,
)
const ethFlowActions = useEthFlowActions({
wrap: wrapCallback,
Expand Down Expand Up @@ -86,7 +88,7 @@ export function EthFlowModal({
approvalState,
approveActivity,
wrapActivity,
onDismiss
onDismiss,
})

return (
Expand Down

0 comments on commit 98be3cd

Please sign in to comment.