mirror of
https://github.com/urbit/shrub.git
synced 2024-12-19 00:13:12 +03:00
ethio: handles a result member in an error response
When using a Ganache for running a local Ethereum node, an error RPC response can contain a 'result' member with the hash of the transaction, even though that goes against the JSON-RPC spec
This commit is contained in:
parent
9e7cb91398
commit
31ae6c2227
@ -108,16 +108,25 @@
|
||||
++ parse-one-response
|
||||
|= =json
|
||||
^- (unit response:rpc)
|
||||
=/ res=(unit [@t ^json])
|
||||
?. &(?=([%o *] json) (~(has by p.json) 'error'))
|
||||
=/ res=(unit [@t ^json])
|
||||
%. json
|
||||
=, dejs-soft:format
|
||||
(ot id+so result+some ~)
|
||||
?~ res ~
|
||||
`[%result u.res]
|
||||
~| parse-one-response=json
|
||||
=/ error=(unit [id=@t ^json code=@ta mssg=@t])
|
||||
%. json
|
||||
=, dejs-soft:format
|
||||
(ot id+so result+some ~)
|
||||
?^ res `[%result u.res]
|
||||
~| parse-one-response=json
|
||||
:+ ~ %error %- need
|
||||
%. json
|
||||
=, dejs-soft:format
|
||||
(ot id+so error+(ot code+no message+so ~) ~)
|
||||
:: A 'result' member is present in the error
|
||||
:: response when using ganache, even though
|
||||
:: that goes against the JSON-RPC spec
|
||||
::
|
||||
(ot id+so result+some error+(ot code+no message+so ~) ~)
|
||||
?~ error ~
|
||||
=* err u.error
|
||||
`[%error id.err code.err mssg.err]
|
||||
--
|
||||
::
|
||||
:: +read-contract: calls a read function on a contract, produces result hex
|
||||
|
Loading…
Reference in New Issue
Block a user