File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed
apps/namadillo/src/App/Transfer Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -31,11 +31,13 @@ type AddressOption = {
3131type DestinationAddressModalProps = {
3232 onClose : ( ) => void ;
3333 onSelectAddress : ( address : Address ) => void ;
34+ sourceAddress : string ;
3435 sourceAsset ?: Asset ;
3536} ;
3637
3738export const DestinationAddressModal = ( {
3839 sourceAsset,
40+ sourceAddress,
3941 onClose,
4042 onSelectAddress,
4143} : DestinationAddressModalProps ) : JSX . Element => {
@@ -53,14 +55,21 @@ export const DestinationAddressModal = ({
5355 ( account ) => account . type === AccountType . ShieldedKeys
5456 ) ;
5557
58+ // Dont display an address if it matches the source address
59+ const isSourceAddressMatch = ( address : string ) : boolean =>
60+ address === sourceAddress ;
61+
5662 // Build your addresses options
5763 const addressOptions : AddressOption [ ] = [ ] ;
5864 if ( accounts ) {
5965 const transparentAccount = accounts . find (
6066 ( account ) => account . type !== AccountType . ShieldedKeys
6167 ) ;
6268
63- if ( transparentAccount ) {
69+ if (
70+ transparentAccount &&
71+ ! isSourceAddressMatch ( transparentAccount . address )
72+ ) {
6473 addressOptions . push ( {
6574 id : "transparent" ,
6675 label : "Transparent Address" ,
@@ -69,7 +78,7 @@ export const DestinationAddressModal = ({
6978 type : "transparent" ,
7079 } ) ;
7180 }
72- if ( shieldedAccount ) {
81+ if ( shieldedAccount && ! isSourceAddressMatch ( shieldedAccount . address ) ) {
7382 addressOptions . push ( {
7483 id : "shielded" ,
7584 label : "Shielded Address" ,
Original file line number Diff line number Diff line change @@ -309,6 +309,7 @@ export const TransferDestination = ({
309309 onClose = { handleCloseModal }
310310 onSelectAddress = { handleSelectAddress }
311311 sourceAsset = { sourceAsset }
312+ sourceAddress = { sourceAddress ?? "" }
312313 />
313314 ) }
314315 </ >
You can’t perform that action at this time.
0 commit comments