@@ -10,6 +10,7 @@ import { useWithdrawFlow } from '@/context/WithdrawFlowContext'
1010import { useWallet } from '@/hooks/wallet/useWallet'
1111import { tokenSelectorContext } from '@/context/tokenSelector.context'
1212import { formatAmount } from '@/utils'
13+ import { getCountryFromAccount } from '@/utils/bridge.utils'
1314import { useRouter } from 'next/navigation'
1415import { useCallback , useEffect , useMemo , useState , useRef , useContext } from 'react'
1516import { formatUnits } from 'viem'
@@ -27,12 +28,12 @@ export default function WithdrawPage() {
2728 error,
2829 setUsdAmount,
2930 selectedMethod,
31+ selectedBankAccount,
3032 setSelectedMethod,
3133 setShowAllWithdrawMethods,
3234 } = useWithdrawFlow ( )
3335
34- // FIXED FLOW: Only crypto gets amount input on main page, countries route directly
35- const initialStep : WithdrawStep = selectedMethod ? 'inputAmount' : 'selectMethod'
36+ const initialStep : WithdrawStep = selectedMethod || selectedBankAccount ? 'inputAmount' : 'selectMethod'
3637
3738 const [ step , setStep ] = useState < WithdrawStep > ( initialStep )
3839
@@ -179,7 +180,14 @@ export default function WithdrawPage() {
179180 setUsdAmount ( usdVal . toString ( ) )
180181
181182 // Route based on selected method type
182- if ( selectedMethod . type === 'crypto' ) {
183+ if ( selectedBankAccount ) {
184+ const country = getCountryFromAccount ( selectedBankAccount )
185+ if ( country ) {
186+ router . push ( `/withdraw/${ country . path } /bank` )
187+ } else {
188+ throw new Error ( 'Failed to get country from bank account' )
189+ }
190+ } else if ( selectedMethod . type === 'crypto' ) {
183191 router . push ( '/withdraw/crypto' )
184192 } else if ( selectedMethod . type === 'manteca' ) {
185193 // Route directly to Manteca with method and country params
0 commit comments