@@ -5,19 +5,18 @@ import {
55 getSelectedEvmInternalAccount ,
66 getSelectedInternalAccount ,
77} from '../../../selectors' ;
8- import { getToChain , getFromChain } from '../../../ducks/bridge/selectors' ;
8+ import { getToChain } from '../../../ducks/bridge/selectors' ;
99import { getLastSelectedSolanaAccount } from '../../../selectors/multichain' ;
1010import type { DestinationAccount } from '../prepare/types' ;
1111
12- export const useDestinationAccount = ( ) => {
12+ export const useDestinationAccount = ( isSwap : boolean ) => {
1313 const [ selectedDestinationAccount , setSelectedDestinationAccount ] =
1414 useState < DestinationAccount | null > ( null ) ;
1515
1616 const selectedEvmAccount = useSelector ( getSelectedEvmInternalAccount ) ;
1717 const selectedSolanaAccount = useSelector ( getLastSelectedSolanaAccount ) ;
1818 const currentlySelectedAccount = useSelector ( getSelectedInternalAccount ) ;
1919
20- const fromChain = useSelector ( getFromChain ) ;
2120 const toChain = useSelector ( getToChain ) ;
2221 const isDestinationSolana = toChain && isSolanaChainId ( toChain . chainId ) ;
2322
@@ -29,9 +28,8 @@ export const useDestinationAccount = () => {
2928 return ;
3029 }
3130
32- // Check if it's a swap (same chain)
33- const isSwap = fromChain ?. chainId === toChain ?. chainId ;
34-
31+ // Use isSwap parameter to determine behavior
32+ // This preserves legacy behavior when unified UI is disabled
3533 if ( isSwap ) {
3634 // For swaps, always use the currently selected account
3735 setSelectedDestinationAccount ( currentlySelectedAccount ) ;
@@ -46,8 +44,8 @@ export const useDestinationAccount = () => {
4644 selectedSolanaAccount ,
4745 selectedEvmAccount ,
4846 toChain ,
49- fromChain ,
5047 currentlySelectedAccount ,
48+ isSwap ,
5149 ] ) ;
5250
5351 return { selectedDestinationAccount, setSelectedDestinationAccount } ;
0 commit comments