[#12668] Fix gas estimation after using Set max

This commit is contained in:
Roman Volosovskyi 2021-10-01 09:54:22 +03:00
parent d0b3b4e293
commit 943fc37543
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
1 changed files with 8 additions and 4 deletions

View File

@ -228,6 +228,7 @@
(fx/defn update-estimated-gas-error
{:events [:signing/update-estimated-gas-error]}
[{db :db} {:keys [message]}]
(log/warn "signing/update-estimated-gas-error" message)
{:db (-> db
(assoc-in [:signing/edit-fee :gas-loading?] false)
(assoc-in [:signing/tx :gas-error-message] message))})
@ -366,7 +367,10 @@
(re-frame/reg-fx
:signing/update-estimated-gas
(fn [{:keys [obj success-event error-event]}]
(let [value (:value obj)]
(json-rpc/call {:method "eth_estimateGas"
:params [obj]
:params [(if value
(assoc obj :value "0x0")
obj)]
:on-success #(re-frame/dispatch [success-event %])
:on-error #(re-frame/dispatch [error-event %])})))
:on-error #(re-frame/dispatch [error-event %])}))))