eth: Adjust format-param to prepend "0x";

use format-param in get-transaction-receipt
fix execute fn to properly invoke get-signed-tx
This commit is contained in:
Vitaliy Vlasov 2018-02-15 20:29:41 +02:00 committed by Tetiana Churikova
parent b1b28db640
commit 5fd22660d2
1 changed files with 8 additions and 8 deletions

View File

@ -132,15 +132,15 @@
[account digits]
(hex->eth (get-balance-hex account) digits))
(defn get-transaction-receipt
[hash]
(eth-rpc "eth_getTransactionReceipt" [hash]))
(defn- format-param
[param]
(if (number? param)
(format "%064x" param)
(clojure.string/replace (format "%64s" (subs param 2)) " " "0")))
(clojure.string/replace (format "0x%64s" (subs param 2)) " " "0")))
(defn get-transaction-receipt
[hash]
(eth-rpc "eth_getTransactionReceipt" [(format-param hash)]))
(defn format-call-params
[method-id & params]
@ -166,12 +166,12 @@
(merge {:to contract}))
gas (if gas-limit gas-limit
(estimate-gas from contract value params))
params (cond-> (assoc params :gas gas)
(offline-signing?)
params (if (offline-signing?)
(web3j/get-signed-tx (biginteger gas-price)
(hex->big-integer gas)
contract
data))]
data)
(assoc params :gas gas))]
(if (offline-signing?)
(eth-rpc
"eth_sendRawTransaction"