fix: crash when user changes token and goes to transaction confirmation screen (#20187)

Signed-off-by: Brian Sztamfater <brian@status.im>
This commit is contained in:
Brian Sztamfater 2024-05-28 07:31:41 -03:00 committed by jo-mut
parent 8f7b641fa2
commit 47e5d663f9
No known key found for this signature in database
GPG Key ID: 76AE8CD103294A70
1 changed files with 3 additions and 2 deletions

View File

@ -220,14 +220,15 @@
(rf/reg-event-fx (rf/reg-event-fx
:wallet/edit-token-to-send :wallet/edit-token-to-send
(fn [{:keys [db]} [token]] (fn [{:keys [db]} [token]]
(let [{token-networks :networks} token (let [{token-networks :networks
token-symbol :symbol} token
receiver-networks (get-in db [:wallet :ui :send :receiver-networks]) receiver-networks (get-in db [:wallet :ui :send :receiver-networks])
token-networks-ids (mapv #(:chain-id %) token-networks) token-networks-ids (mapv #(:chain-id %) token-networks)
token-not-supported-in-receiver-networks? (not (some (set receiver-networks) token-not-supported-in-receiver-networks? (not (some (set receiver-networks)
token-networks-ids))] token-networks-ids))]
{:db (-> db {:db (-> db
(assoc-in [:wallet :ui :send :token] token) (assoc-in [:wallet :ui :send :token] token)
(assoc-in [:wallet :ui :send :token-display-name] token) (assoc-in [:wallet :ui :send :token-display-name] token-symbol)
(assoc-in [:wallet :ui :send :token-not-supported-in-receiver-networks?] (assoc-in [:wallet :ui :send :token-not-supported-in-receiver-networks?]
token-not-supported-in-receiver-networks?)) token-not-supported-in-receiver-networks?))
:fx [[:dispatch [:hide-bottom-sheet]] :fx [[:dispatch [:hide-bottom-sheet]]