File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -45,10 +45,19 @@ export function ReceiveAccountsContent({
45
45
return accountsData ?. map ( ( account ) => {
46
46
return {
47
47
label : account . name ,
48
- value : account . address ,
48
+ value : account . name ,
49
49
} ;
50
50
} ) ;
51
51
} , [ accountsData ] ) ;
52
+ const addressLookup = useMemo ( ( ) => {
53
+ return accountsData ?. reduce (
54
+ ( acc , account ) => {
55
+ acc [ account . name ] = account . address ;
56
+ return acc ;
57
+ } ,
58
+ { } as Record < string , string > ,
59
+ ) ;
60
+ } , [ accountsData ] ) ;
52
61
53
62
const defaultAccount = useMemo ( ( ) => {
54
63
const queryMatch = accountOptions ?. find (
@@ -73,7 +82,7 @@ export function ReceiveAccountsContent({
73
82
} ,
74
83
} ) ;
75
84
76
- const addressValue = watch ( "account" ) ;
85
+ const selectedAccount = watch ( "account" ) ;
77
86
78
87
return (
79
88
< MainLayout >
@@ -92,12 +101,12 @@ export function ReceiveAccountsContent({
92
101
< VStack alignItems = "stretch" gap = { 4 } >
93
102
< Select
94
103
{ ...register ( "account" ) }
95
- value = { addressValue }
104
+ value = { selectedAccount }
96
105
label = { formatMessage ( messages . fromLabel ) }
97
106
options = { accountOptions }
98
107
error = { errors . account ?. message }
99
108
/>
100
- < AccountAddressDisplay address = { addressValue } />
109
+ < AccountAddressDisplay address = { addressLookup [ selectedAccount ] } />
101
110
</ VStack >
102
111
) }
103
112
</ WithExplanatorySidebar >
You can’t perform that action at this time.
0 commit comments