From 71211ee7b9d630f6ef0033a2187d31941c457bc7 Mon Sep 17 00:00:00 2001 From: yqrashawn Date: Wed, 3 Aug 2022 22:13:37 +0800 Subject: [PATCH] fix: set max option not work when send from qrcode (#13733) --- .../wallet/choose_recipient/core.cljs | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/status_im/wallet/choose_recipient/core.cljs b/src/status_im/wallet/choose_recipient/core.cljs index ac4276489b..1d34f19766 100644 --- a/src/status_im/wallet/choose_recipient/core.cljs +++ b/src/status_im/wallet/choose_recipient/core.cljs @@ -1,17 +1,17 @@ (ns status-im.wallet.choose-recipient.core (:require [re-frame.core :as re-frame] + [status-im.bottom-sheet.core :as bottom-sheet] [status-im.contact.db :as contact.db] [status-im.ethereum.core :as ethereum] [status-im.ethereum.eip681 :as eip681] [status-im.ethereum.ens :as ens] [status-im.i18n.i18n :as i18n] - [status-im.utils.money :as money] - [status-im.utils.fx :as fx] - [status-im.router.core :as router] - [status-im.qr-scanner.core :as qr-scaner] - [status-im.bottom-sheet.core :as bottom-sheet] [status-im.navigation :as navigation] + [status-im.qr-scanner.core :as qr-scaner] + [status-im.router.core :as router] + [status-im.utils.fx :as fx] [status-im.utils.http :as http] + [status-im.utils.money :as money] [status-im.utils.universal-links.utils :as links] [status-im.utils.wallet-connect :as wallet-connect])) @@ -75,7 +75,7 @@ :wallet/keys [all-tokens] :as db} :db} {:keys [chain-id] :as data} uri] - (let [{:keys [address] :as details} + (let [{:keys [address gasPrice] :as details} (eip681/extract-request-details data all-tokens)] (if address (if (:wallet/recipient db) @@ -85,8 +85,15 @@ {:db (update db :wallet/prepare-transaction assoc :to address :to-name (find-address-name db address))} (let [current-chain-id (get-in networks [current-network :config :NetworkId])] - (merge {:db (fill-prepare-transaction-details db details all-tokens) + (merge {:db (fill-prepare-transaction-details db details all-tokens) :dispatch [:open-modal :prepare-send-transaction]} + (when-not gasPrice + {:signing/update-gas-price + {:success-callback + #(re-frame/dispatch + [:wallet.send/update-gas-price-success :wallet/prepare-transaction %]) + :network-id (get-in (ethereum/current-network db) + [:config :NetworkId])}}) (when (and chain-id (not= current-chain-id chain-id)) {:ui/show-error (i18n/label :t/wallet-invalid-chain-id {:data uri :chain current-chain-id})})))))