diff --git a/pkg/arvo/lib/ethio.hoon b/pkg/arvo/lib/ethio.hoon index fb919460fa..cfecb50ccb 100644 --- a/pkg/arvo/lib/ethio.hoon +++ b/pkg/arvo/lib/ethio.hoon @@ -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