From 5fd22660d27cad58d4c14b323f234dfbb6bd7946 Mon Sep 17 00:00:00 2001 From: Vitaliy Vlasov Date: Thu, 15 Feb 2018 20:29:41 +0200 Subject: [PATCH] eth: Adjust format-param to prepend "0x"; use format-param in get-transaction-receipt fix execute fn to properly invoke get-signed-tx --- src/clj/commiteth/eth/core.clj | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/clj/commiteth/eth/core.clj b/src/clj/commiteth/eth/core.clj index c8e3e82..d9fffb6 100644 --- a/src/clj/commiteth/eth/core.clj +++ b/src/clj/commiteth/eth/core.clj @@ -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"