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 GitHub
parent 8d1898ccc0
commit 964d2b9478
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 2 deletions

View File

@ -220,14 +220,15 @@
(rf/reg-event-fx
:wallet/edit-token-to-send
(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])
token-networks-ids (mapv #(:chain-id %) token-networks)
token-not-supported-in-receiver-networks? (not (some (set receiver-networks)
token-networks-ids))]
{:db (-> db
(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?]
token-not-supported-in-receiver-networks?))
:fx [[:dispatch [:hide-bottom-sheet]]