@@ -12,13 +12,11 @@ import {
1212 isTransparentAddress ,
1313} from "App/Transfer/common" ;
1414import { allDefaultAccountsAtom } from "atoms/accounts" ;
15- import { connectedWalletsAtom } from "atoms/integrations" ;
1615import { getAddressLabel } from "atoms/transfer/functions" ;
1716import BigNumber from "bignumber.js" ;
1817import clsx from "clsx" ;
1918import { TransactionFeeProps } from "hooks/useTransactionFee" ;
2019import { wallets } from "integrations" ;
21- import { KeplrWalletManager } from "integrations/Keplr" ;
2220import { getChainFromAddress , getChainImageUrl } from "integrations/utils" ;
2321import { useAtomValue } from "jotai" ;
2422import { useCallback , useEffect , useState } from "react" ;
@@ -51,7 +49,6 @@ type TransferDestinationProps = {
5149 sourceAsset : Asset | undefined ;
5250 onChangeAddress ?: ( address : Address ) => void ;
5351 onChangeMemo ?: ( address : string ) => void ;
54- setDestinationAddress ?: ( address : string ) => void ;
5552} ;
5653
5754export const TransferDestination = ( {
@@ -67,14 +64,12 @@ export const TransferDestination = ({
6764 sourceAddress,
6865 memo,
6966 sourceAsset,
70- setDestinationAddress ,
67+ onChangeAddress ,
7168 onChangeMemo,
7269} : TransferDestinationProps ) : JSX . Element => {
7370 const { data : accounts } = useAtomValue ( allDefaultAccountsAtom ) ;
7471 const [ isModalOpen , setIsModalOpen ] = useState ( false ) ;
7572 const location = useLocation ( ) ;
76- const connectedWallets = useAtomValue ( connectedWalletsAtom ) ;
77- const keplr = new KeplrWalletManager ( ) ;
7873
7974 const isIbcTransfer = isIbcAddress ( sourceAddress ?? "" ) ;
8075 const changeFeeEnabled = ! isIbcTransfer ;
@@ -99,36 +94,24 @@ export const TransferDestination = ({
9994 } ;
10095
10196 const handleSelectAddress = useCallback (
102- async ( selectedAddress : Address ) : Promise < void > => {
103- const isIbcAsset = ! isNamadaAddress ( selectedAddress ) ;
104- if ( isIbcAsset ) {
105- await keplr . connectAllKeplrChains ( ) ;
106- }
107- setDestinationAddress ?.( selectedAddress ) ;
108- } ,
109- [ keplr , setDestinationAddress ]
97+ ( selectedAddress : Address ) : void => onChangeAddress ?.( selectedAddress ) ,
98+ [ onChangeAddress ]
11099 ) ;
111100
112101 const isShieldingTransaction =
113102 routes . shield === location . pathname || routes . ibc === location . pathname ;
114103
115- // Make sure destination address isnt ibc if keplr is not connected
116- useEffect ( ( ) => {
117- if ( isIbcAddress ( destinationAddress ?? "" ) && ! connectedWallets . keplr )
118- setDestinationAddress ?.( "" ) ;
119- } , [ connectedWallets . keplr , destinationAddress , setDestinationAddress ] ) ;
120-
121104 // Make sure destination address is pre-filled if it's a shielding transaction
122105 useEffect ( ( ) => {
123106 if ( destinationAddress ) return ;
124107 if ( isShieldingTransaction && shieldedAccount ?. address ) {
125- setDestinationAddress ?.( shieldedAccount ?. address ?? "" ) ;
108+ onChangeAddress ?.( shieldedAccount ?. address ?? "" ) ;
126109 }
127110 } , [
128111 isShieldingTransaction ,
129112 shieldedAccount ?. address ,
130113 destinationAddress ,
131- setDestinationAddress ,
114+ onChangeAddress ,
132115 ] ) ;
133116
134117 // Write a customAddress variable that checks if the address doesn't come from our transparent or shielded accounts
0 commit comments