mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-03 02:35:52 +03:00
ethio: add +read-contract for chain state reading
This commit is contained in:
parent
82e25e3940
commit
e402cbc550
@ -102,4 +102,17 @@
|
||||
=, dejs-soft:format
|
||||
(ot id+so error+(ot code+no message+so ~) ~)
|
||||
--
|
||||
:: +read-contract: calls a read function on a contract, produces result hex
|
||||
::
|
||||
++ read-contract
|
||||
|= [url=@t proto-read-request:rpc:ethereum]
|
||||
=/ m (async:stdio ,@t)
|
||||
;< =json bind:m
|
||||
%^ request-rpc url id
|
||||
:+ %eth-call
|
||||
^- call:rpc:ethereum
|
||||
[~ to ~ ~ ~ `tape`(encode-call:rpc:ethereum function arguments)]
|
||||
[%label %latest]
|
||||
?. ?=(%s -.json) (async-fail:stdio %request-rpc-fail >json< ~)
|
||||
(pure:m p.json)
|
||||
--
|
Loading…
Reference in New Issue
Block a user