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 = {
31
31
type DestinationAddressModalProps = {
32
32
onClose : ( ) => void ;
33
33
onSelectAddress : ( address : Address ) => void ;
34
+ sourceAddress : string ;
34
35
sourceAsset ?: Asset ;
35
36
} ;
36
37
37
38
export const DestinationAddressModal = ( {
38
39
sourceAsset,
40
+ sourceAddress,
39
41
onClose,
40
42
onSelectAddress,
41
43
} : DestinationAddressModalProps ) : JSX . Element => {
@@ -53,14 +55,21 @@ export const DestinationAddressModal = ({
53
55
( account ) => account . type === AccountType . ShieldedKeys
54
56
) ;
55
57
58
+ // Dont display an address if it matches the source address
59
+ const isSourceAddressMatch = ( address : string ) : boolean =>
60
+ address === sourceAddress ;
61
+
56
62
// Build your addresses options
57
63
const addressOptions : AddressOption [ ] = [ ] ;
58
64
if ( accounts ) {
59
65
const transparentAccount = accounts . find (
60
66
( account ) => account . type !== AccountType . ShieldedKeys
61
67
) ;
62
68
63
- if ( transparentAccount ) {
69
+ if (
70
+ transparentAccount &&
71
+ ! isSourceAddressMatch ( transparentAccount . address )
72
+ ) {
64
73
addressOptions . push ( {
65
74
id : "transparent" ,
66
75
label : "Transparent Address" ,
@@ -69,7 +78,7 @@ export const DestinationAddressModal = ({
69
78
type : "transparent" ,
70
79
} ) ;
71
80
}
72
- if ( shieldedAccount ) {
81
+ if ( shieldedAccount && ! isSourceAddressMatch ( shieldedAccount . address ) ) {
73
82
addressOptions . push ( {
74
83
id : "shielded" ,
75
84
label : "Shielded Address" ,
Original file line number Diff line number Diff line change @@ -309,6 +309,7 @@ export const TransferDestination = ({
309
309
onClose = { handleCloseModal }
310
310
onSelectAddress = { handleSelectAddress }
311
311
sourceAsset = { sourceAsset }
312
+ sourceAddress = { sourceAddress ?? "" }
312
313
/>
313
314
) }
314
315
</ >
You can’t perform that action at this time.
0 commit comments