fix: set max option not work when send from qrcode (#13733)

This commit is contained in:
yqrashawn 2022-08-03 22:13:37 +08:00 committed by GitHub
parent c5bcb0123f
commit 71211ee7b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 7 deletions

View File

@ -1,17 +1,17 @@
(ns status-im.wallet.choose-recipient.core (ns status-im.wallet.choose-recipient.core
(:require [re-frame.core :as re-frame] (:require [re-frame.core :as re-frame]
[status-im.bottom-sheet.core :as bottom-sheet]
[status-im.contact.db :as contact.db] [status-im.contact.db :as contact.db]
[status-im.ethereum.core :as ethereum] [status-im.ethereum.core :as ethereum]
[status-im.ethereum.eip681 :as eip681] [status-im.ethereum.eip681 :as eip681]
[status-im.ethereum.ens :as ens] [status-im.ethereum.ens :as ens]
[status-im.i18n.i18n :as i18n] [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.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.http :as http]
[status-im.utils.money :as money]
[status-im.utils.universal-links.utils :as links] [status-im.utils.universal-links.utils :as links]
[status-im.utils.wallet-connect :as wallet-connect])) [status-im.utils.wallet-connect :as wallet-connect]))
@ -75,7 +75,7 @@
:wallet/keys [all-tokens] :as db} :db} :wallet/keys [all-tokens] :as db} :db}
{:keys [chain-id] :as data} {:keys [chain-id] :as data}
uri] uri]
(let [{:keys [address] :as details} (let [{:keys [address gasPrice] :as details}
(eip681/extract-request-details data all-tokens)] (eip681/extract-request-details data all-tokens)]
(if address (if address
(if (:wallet/recipient db) (if (:wallet/recipient db)
@ -85,8 +85,15 @@
{:db (update db :wallet/prepare-transaction assoc {:db (update db :wallet/prepare-transaction assoc
:to address :to-name (find-address-name db address))} :to address :to-name (find-address-name db address))}
(let [current-chain-id (get-in networks [current-network :config :NetworkId])] (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]} :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)) (when (and chain-id (not= current-chain-id chain-id))
{:ui/show-error (i18n/label :t/wallet-invalid-chain-id {:ui/show-error (i18n/label :t/wallet-invalid-chain-id
{:data uri :chain current-chain-id})}))))) {:data uri :chain current-chain-id})})))))