From 87482802790cdc22d15e35ca77c453bd34a3cece Mon Sep 17 00:00:00 2001 From: Andrea Maria Piana Date: Fri, 4 Dec 2020 14:48:42 +0100 Subject: [PATCH] [Fixes: #10777] Always convert value to string When calling `SendTransaction` sometimes the value would be a string (most cases), sometimes the value would instead big a `BigInt`, which would be serialized to an integer, and status-go would be unable to parse it as it expects values to be a string. This commit makes sure that values are always serialized as string before sending them over. Signed-off-by: Andrea Maria Piana --- src/status_im/signing/core.cljs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/status_im/signing/core.cljs b/src/status_im/signing/core.cljs index 46217cf35a..4de7765c1f 100644 --- a/src/status_im/signing/core.cljs +++ b/src/status_im/signing/core.cljs @@ -232,7 +232,9 @@ {:events [:sign/send-transaction-message]} [cofx chat-id value contract transaction-hash signature] {::json-rpc/call [{:method (json-rpc/call-ext-method "sendTransaction") - :params [chat-id value contract transaction-hash + ;; We make sure `value` is serialized as string, and not + ;; as an integer or big-int + :params [chat-id (str value) contract transaction-hash (or (:result (types/json->clj signature)) (ethereum/normalized-hex signature))] :on-success @@ -512,4 +514,4 @@ (when (and from nonce) (sign cofx {:tx-obj (-> tx (select-keys [:from :to :value :input :gas :nonce :hash]) - (clojure.set/rename-keys {:input :data}))}))) \ No newline at end of file + (clojure.set/rename-keys {:input :data}))})))