@@ -8,9 +8,11 @@ export enum NeuronWalletActions {
88 UpdateCurrentWallet = 'updateCurrentWallet' ,
99 UpdateWalletList = 'updateWalletList' ,
1010 UpdateAddressListAndBalance = 'updateAddressListAndBalance' ,
11+ UpdateAddressDescription = 'updateAddressDescription' ,
1112 // transactions
1213 UpdateTransactionList = 'updateTransactionList' ,
1314 UpdateTransaction = 'updateTransaction' ,
15+ UpdateTransactionDescription = 'updateTransactionDescription' ,
1416 // networks
1517 UpdateNetworkList = 'updateNetworkList' ,
1618 UpdateCurrentNetworkID = 'updateCurrentNetworkID' ,
@@ -132,6 +134,23 @@ export const reducer = (
132134 } ,
133135 }
134136 }
137+ case NeuronWalletActions . UpdateAddressDescription : {
138+ /**
139+ * payload:{
140+ * address: string
141+ * description: string
142+ * }
143+ */
144+ return {
145+ ...state ,
146+ wallet : {
147+ ...wallet ,
148+ addresses : wallet . addresses . map ( addr =>
149+ addr . address === payload . address ? { ...addr , description : payload . description } : addr
150+ ) ,
151+ } ,
152+ }
153+ }
135154 case NeuronWalletActions . UpdateAddressListAndBalance : {
136155 return {
137156 ...state ,
@@ -150,6 +169,26 @@ export const reducer = (
150169 } ,
151170 }
152171 }
172+ case NeuronWalletActions . UpdateTransactionDescription : {
173+ /**
174+ * payload: {
175+ * hash: string,
176+ * description: string
177+ * }
178+ */
179+ return {
180+ ...state ,
181+ chain : {
182+ ...chain ,
183+ transactions : {
184+ ...chain . transactions ,
185+ items : chain . transactions . items . map ( tx =>
186+ tx . hash === payload . hash ? { ...tx , description : payload . description } : tx
187+ ) ,
188+ } ,
189+ } ,
190+ }
191+ }
153192 case NeuronWalletActions . UpdateTransaction : {
154193 return {
155194 ...state ,
0 commit comments