[fix] contract call effect should destructure keys not vector

- return params decoding should return nil and not "0x"

Signed-off-by: yenda <eric@status.im>
This commit is contained in:
yenda 2019-04-03 15:57:09 +02:00
parent 06f72e749e
commit c9a8fb2684
No known key found for this signature in database
GPG Key ID: 0095623C0069DCE6
2 changed files with 6 additions and 3 deletions

View File

@ -390,4 +390,5 @@
(let [bytes (subs bytes 2)]
(when-not (empty? bytes)
(let [offsets (get-offsets types)]
(map (dec-type bytes) offsets types))))))
(map #(when-not (= "0x" %) %)
(map (dec-type bytes) offsets types)))))))

View File

@ -34,7 +34,7 @@
(re-frame/reg-fx
::call
(fn [[address data callback]]
(fn [{:keys [address data callback]}]
(ethereum/call {:to address
:data data}
callback)))
@ -60,4 +60,6 @@
:on-result on-result})
{::call {:address contract-address
:data data
:callback #(callback (abi-spec/decode % return-params))}})))))
:callback #(callback (if (empty? return-params)
%
(abi-spec/decode % return-params)))}})))))