Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
yenda committed May 20, 2019
1 parent 3cb2fe4 commit eb7dbee
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
7 changes: 5 additions & 2 deletions src/status_im/ethereum/json_rpc.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@
[status-im.ethereum.decode :as decode]
[status-im.native-module.core :as status]
[status-im.utils.ethereum.abi-spec :as abi-spec]
[status-im.utils.money :as money]
[status-im.utils.types :as types]
[taoensso.timbre :as log]))

(def json-rpc-api
{"eth_call" {}
"eth_getBalance"
{:on-result decode/uint}
{:on-result money/bignumber}
"eth_estimateGas"
{:on-result decode/uint}
{:on-result money/bignumber}
"eth_gasPrice"
{:on-result money/bignumber}
"eth_getBlockByHash"
{:on-result #(-> (update % :number decode/uint)
(update :timestamp decode/uint))}
Expand Down
4 changes: 2 additions & 2 deletions src/status_im/ethereum/transactions/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
(doseq [[block-hash block-transfers] transfers-by-block]
(json-rpc/call
{:method "eth_getBlockByHash"
:params [block-hash]
:params [block-hash false]
:on-success
(fn [{:keys [timestamp number]}]
(let [timestamp (str (* timestamp 1000))]
Expand All @@ -124,7 +124,7 @@
(json-rpc/call
{:method "eth_getTransactionReceipt"
:params [hash]
:on-sucess
:on-success
(fn [{:keys [gasUsed]}]
(re-frame/dispatch
[:ethereum.transactions/new
Expand Down
10 changes: 7 additions & 3 deletions src/status_im/wallet/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
(fn [{:keys [success-event edit?]}]
(json-rpc/call
{:method "eth_gasPrice"
:on-sucess
:on-success
#(re-frame/dispatch [success-event % edit?])})))

(re-frame/reg-fx
Expand Down Expand Up @@ -172,7 +172,7 @@
:outputs ["uint256"]
:on-success
(fn [[balance]]
(on-success symbol balance))
(on-success symbol (money/bignumber balance)))
:on-error #(on-error symbol %)}))))

(def min-gas-price-wei (money/bignumber 1))
Expand Down Expand Up @@ -253,7 +253,8 @@
(assoc :nonce nonce))))

;; SEND TRANSACTION -> RPC TRANSACTION
(defn prepare-send-transaction [from {:keys [amount to gas gas-price data nonce]}]
(defn prepare-send-transaction
[from {:keys [amount to gas gas-price data nonce]}]
(cond-> {:from (ethereum/normalized-address from)
:to (ethereum/normalized-address to)
:value (str "0x" (abi-spec/number-to-hex amount))
Expand Down Expand Up @@ -333,6 +334,9 @@
(fx/defn handle-transaction-error
[{:keys [db] :as cofx} {:keys [code message]}]
(let [{:keys [on-error]} (get-in db [:wallet :send-transaction])]
(log/error :wallet/transaction-error
:code code
:message message)
(case code
;;WRONG PASSWORD
constants/send-transaction-err-decrypt
Expand Down

0 comments on commit eb7dbee

Please sign in to comment.