@@ -7,10 +7,9 @@ import { useMemo } from 'react'
7
7
import { usePool } from '../../PoolProvider'
8
8
import { LiquidityActionHelpers } from '../LiquidityActionHelpers'
9
9
import { AddLiquidityStepParams , useAddLiquidityStep } from './useAddLiquidityStep'
10
- import { getVaultConfig } from '../../pool.helpers'
10
+ import { requiresPermit2Approval } from '../../pool.helpers'
11
11
import { useSignRelayerStep } from '@/lib/modules/transactions/transaction-steps/useSignRelayerStep'
12
- import { Address } from 'viem'
13
- import { isCowAmmPool } from '../../pool.helpers'
12
+ import { getSpenderForAddLiquidity } from '@/lib/modules/tokens/token.helpers'
14
13
15
14
type AddLiquidityStepsParams = AddLiquidityStepParams & {
16
15
helpers : LiquidityActionHelpers
@@ -22,7 +21,6 @@ export function useAddLiquiditySteps({
22
21
simulationQuery,
23
22
} : AddLiquidityStepsParams ) {
24
23
const { pool, chainId, chain } = usePool ( )
25
- const { vaultAddress } = getVaultConfig ( pool )
26
24
const relayerMode = useRelayerMode ( pool )
27
25
const shouldSignRelayerApproval = useShouldSignRelayerApproval ( chainId , relayerMode )
28
26
@@ -37,10 +35,11 @@ export function useAddLiquiditySteps({
37
35
38
36
const { isLoading : isLoadingTokenApprovalSteps , steps : tokenApprovalSteps } =
39
37
useTokenApprovalSteps ( {
40
- spenderAddress : isCowAmmPool ( pool . type ) ? ( pool . address as Address ) : vaultAddress ,
38
+ spenderAddress : getSpenderForAddLiquidity ( pool ) ,
41
39
chain : pool . chain ,
42
40
approvalAmounts : inputAmounts ,
43
41
actionType : 'AddLiquidity' ,
42
+ isPermit2 : requiresPermit2Approval ( pool ) ,
44
43
} )
45
44
46
45
const addLiquidityStep = useAddLiquidityStep ( {
0 commit comments