From eb7a6ce45a6c522117a87d5462a173690531369c Mon Sep 17 00:00:00 2001 From: andrey Date: Tue, 11 Jan 2022 16:32:02 +0100 Subject: [PATCH] [#12991] Error when trying to edit 'per-gas price limit' on 1inch.exchange Signed-off-by: andrey --- src/status_im/signing/core.cljs | 15 +++++++-------- src/status_im/wallet/core.cljs | 8 ++++---- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/status_im/signing/core.cljs b/src/status_im/signing/core.cljs index b407cb0207..36e1f1dc81 100644 --- a/src/status_im/signing/core.cljs +++ b/src/status_im/signing/core.cljs @@ -272,14 +272,13 @@ :success-event :signing/update-estimated-gas-success :error-event :signing/update-estimated-gas-error}}) (fn [cofx] - (when-not (or maxFeePerGas gasPrice) - {:db (assoc-in (:db cofx) [:signing/edit-fee :gas-price-loading?] true) - :signing/update-gas-price - {:success-callback #(re-frame/dispatch - [:wallet.send/update-gas-price-success :signing/tx %]) - :error-callback #(re-frame/dispatch [:signing/update-gas-price-error %]) - :network-id (get-in (ethereum/current-network db) - [:config :NetworkId])}})))))) + {:db (assoc-in (:db cofx) [:signing/edit-fee :gas-price-loading?] true) + :signing/update-gas-price + {:success-callback #(re-frame/dispatch + [:wallet.send/update-gas-price-success :signing/tx % tx-obj]) + :error-callback #(re-frame/dispatch [:signing/update-gas-price-error %]) + :network-id (get-in (ethereum/current-network db) + [:config :NetworkId])}}))))) (fx/defn check-queue [{:keys [db] :as cofx}] (let [{:signing/keys [tx queue]} db] diff --git a/src/status_im/wallet/core.cljs b/src/status_im/wallet/core.cljs index 6f68e8b4b5..f317e7ea4a 100644 --- a/src/status_im/wallet/core.cljs +++ b/src/status_im/wallet/core.cljs @@ -434,7 +434,7 @@ (fx/defn wallet-send-gas-price-success {:events [:wallet.send/update-gas-price-success]} - [{db :db} tx-entry price] + [{db :db} tx-entry price {:keys [maxFeePerGas maxPriorityFeePerGas gasPrice]}] (if (eip1559/sync-enabled?) (let [{:keys [slow-base-fee normal-base-fee fast-base-fee current-base-fee max-priority-fee]} @@ -447,8 +447,8 @@ tip-cap (money/to-hex max-priority-fee-bn)] {:db (-> db (update tx-entry assoc - :maxFeePerGas fee-cap - :maxPriorityFeePerGas tip-cap) + :maxFeePerGas (or maxFeePerGas fee-cap) + :maxPriorityFeePerGas (or maxPriorityFeePerGas tip-cap)) (assoc :wallet/current-base-fee current-base-fee :wallet/normal-base-fee normal-base-fee :wallet/slow-base-fee slow-base-fee @@ -456,7 +456,7 @@ :wallet/current-priority-fee max-priority-fee) (assoc-in [:signing/edit-fee :gas-price-loading?] false))}) {:db (-> db - (assoc-in [:wallet/prepare-transaction :gasPrice] price) + (assoc-in [:wallet/prepare-transaction :gasPrice] (or gasPrice price)) (assoc-in [:signing/edit-fee :gas-price-loading?] false))})) (fx/defn set-max-amount