File tree Expand file tree Collapse file tree 5 files changed +22
-7
lines changed
settings/wallet/saved_addresses Expand file tree Collapse file tree 5 files changed +22
-7
lines changed Original file line number Diff line number Diff line change 144144 on-change-text (rn/use-callback
145145 (fn [new-value]
146146 (let [trimmed-value (string/trim new-value)]
147- (set-error (validate (string/lower-case trimmed-value)))
148147 (set-address-or-ens trimmed-value)
149148 (set-ens-address " " )
149+ (set-error (validate (string/lower-case trimmed-value)))
150150 (when (validation/ens-name? trimmed-value)
151151 (debounce/debounce-and-dispatch
152152 [:wallet/resolve-ens
Original file line number Diff line number Diff line change 154154 {:db (update-in db [:wallet :ui ] dissoc :saved-address )})
155155
156156(rf/reg-event-fx :wallet/clear-address-to-save clear-address-to-save)
157+
158+ (defn check-remaining-capacity-for-saved-addresses
159+ [{:keys [db]} [{:keys [on-success on-error]}]]
160+ (let [test-networks-enabled? (boolean (get-in db [:profile/profile :test-networks-enabled? ]))]
161+ {:fx [[:json-rpc/call
162+ [{:method " wakuext_remainingCapacityForSavedAddresses"
163+ :params [test-networks-enabled?]
164+ :on-success on-success
165+ :on-error on-error}]]]}))
166+
167+ (rf/reg-event-fx :wallet/check-remaining-capacity-for-saved-addresses
168+ check-remaining-capacity-for-saved-addresses)
Original file line number Diff line number Diff line change 103103
104104(defn- add-address-to-save
105105 []
106- (rf/dispatch [:open-modal :screen/settings.add-address-to-save ]))
106+ (rf/dispatch [:wallet/check-remaining-capacity-for-saved-addresses
107+ {:on-success #(rf/dispatch [:open-modal :screen/settings.add-address-to-save ])
108+ :on-error #(rf/dispatch [:toasts/upsert
109+ {:type :negative
110+ :theme :dark
111+ :text (i18n/label
112+ :t/saved-addresses-limit-reached-toast )}])}]))
107113
108114(defn view
109115 []
Original file line number Diff line number Diff line change 55 [clojure.string :as string]
66 [status-im.constants :as constants]
77 [status-im.contexts.wallet.collectible.utils :as collectible-utils]
8- [status-im.contexts.wallet.common.utils.networks :as network-utils]
98 [status-im.contexts.wallet.send.utils :as send-utils]
109 [utils.collection :as utils.collection]
1110 [utils.money :as money]
165164
166165(defn- add-keys-to-saved-address
167166 [saved-address]
168- (-> saved-address
169- (assoc :network-preferences-names
170- (network-utils/network-preference-prefix->network-names (:chain-short-names saved-address)))
171- (assoc :ens? (not (string/blank? (:ens saved-address))))))
167+ (assoc saved-address :ens? (not (string/blank? (:ens saved-address)))))
172168
173169(defn rpc->saved-address
174170 [saved-address]
Original file line number Diff line number Diff line change 22792279 "saved-address-network-preference-selection-description" : " Only change if you know which networks the address owner is happy to to receive funds on" ,
22802280 "saved-address-removed" : " Saved address removed" ,
22812281 "saved-addresses" : " Saved addresses" ,
2282+ "saved-addresses-limit-reached-toast" : " Limit of 20 saved addresses reached. Remove a saved address to add a new one." ,
22822283 "saving-keys-to-device" : " Saving keys to device..." ,
22832284 "say-hi" : " Say hi" ,
22842285 "scan-an-account-qr-code" : " Scan an account QR code" ,
You can’t perform that action at this time.
0 commit comments