File tree 3 files changed +22
-8
lines changed
src/status_im/contexts/wallet
new_keypair/backup_recovery_phrase
3 files changed +22
-8
lines changed Original file line number Diff line number Diff line change 49
49
secret-phrase (reagent/atom [])
50
50
random-phrase (reagent/atom [])]
51
51
(fn []
52
- (rn/use-effect
52
+ (rn/use-mount
53
53
(fn []
54
54
(native-module/get-random-mnemonic #(reset! secret-phrase (string/split % #"\s " )))
55
55
(native-module/get-random-mnemonic #(reset! random-phrase (string/split % #"\s " )))))
Original file line number Diff line number Diff line change 65
65
{window-width :width } (rn/get-window )]
66
66
(fn [{:keys [theme]}]
67
67
(let [{:keys [new-keypair]} (rf/sub [:wallet/create-account ])]
68
- (rn/use-effect ( fn [] #(rf/dispatch [:wallet/clear-new-keypair ]) ))
68
+ (rn/use-unmount #(rf/dispatch [:wallet/clear-new-keypair ]))
69
69
[rn/view {:style {:flex 1 }}
70
70
[quo/page-nav
71
71
{:type :no-title
Original file line number Diff line number Diff line change 207
207
208
208
(defn add-keypair-and-create-account
209
209
[_ [{:keys [sha3-pwd new-keypair]}]]
210
- {:fx [[:json-rpc/call
211
- [{:method " accounts_addKeypair"
212
- :params [sha3-pwd new-keypair]
213
- :on-success [:wallet/add-account-success (comp string/lower-case (:address new-keypair))]
214
- :on-error #(log/info " failed to create keypair " %)}]]]})
210
+ (let [lowercase-address (if (:address new-keypair)
211
+ (string/lower-case (:address new-keypair))
212
+ (:address new-keypair))]
213
+ {:fx [[:json-rpc/call
214
+ [{:method " accounts_addKeypair"
215
+ :params [sha3-pwd new-keypair]
216
+ :on-success [:wallet/add-account-success lowercase-address]
217
+ :on-error #(log/info " failed to create keypair " %)}]]]}))
215
218
216
219
(rf/reg-event-fx :wallet/add-keypair-and-create-account add-keypair-and-create-account)
217
220
226
229
(rf/reg-event-fx :wallet/get-keypairs get-keypairs)
227
230
228
231
232
+ (defn rename-color-id-in-data
233
+ [data]
234
+ (map (fn [item]
235
+ (update item
236
+ :accounts
237
+ (fn [accounts]
238
+ (map (fn [account]
239
+ (set/rename-keys account {:color-id :customization-color }))
240
+ accounts))))
241
+ data))
242
+
229
243
(defn get-keypairs-success
230
244
[{:keys [db]} [keypairs]]
231
- (let [renamed-data (set/ rename-keys keypairs { :colorId :customization-color } )]
245
+ (let [renamed-data (rename-color-id-in-data keypairs)]
232
246
{:db (assoc-in db [:wallet :keypairs ] (cske/transform-keys csk/->kebab-case-keyword renamed-data))}))
233
247
234
248
(rf/reg-event-fx :wallet/get-keypairs-success get-keypairs-success)
You can’t perform that action at this time.
0 commit comments