refactored rpc response
=^ cards state
?+ +<.sign-arvo (on-arvo:def wire sign-arvo)
%http-response
+ ?. ?=(%finished -.response)
+ `state
+ =/ [status=@ud rpc-resp=response:rpc:jstd]
+ [status-code.response-header.response (get-rpc-response:hc response)]
?+ wire (on-arvo:def wire sign-arvo)
[%erpc *]
- (electrum-http-response:hc wire response)
+ (electrum-http-response:hc status rpc-resp)
[%brpc *]
- (btc-http-response:hc wire response)
+ (btc-http-response:hc status rpc-resp)
==
==
[cards this]
|= req=request:electrum:rpc
%+ request-to-http:electrum-rpc:elib
rpc-url.ec.creds.status req
+::
++ gen-request
|= ract=rpc-action
^- request:http
~| jon
`(parse-error jon)
::
+++ get-rpc-response
+ |= response=client-response:iris
+ ^- response:rpc:jstd
+ ?> ?=(%finished -.response)
+ %- httr-to-rpc-response
+ %+ to-httr:iris
+ response-header.response
+ full-file.response
+::
++ parse-error
|= =json
^- response:rpc:jstd
== ==
::
++ btc-http-response
- |= [=wire response=client-response:iris]
+ |= [status=@ud rpc-resp=response:rpc:jstd]
^- (quip card _state)
- ?. ?=(%finished -.response)
- [~ state]
- =* status status-code.response-header.response
- =/ rpc-resp=response:rpc:jstd
- %- httr-to-rpc-response
- %+ to-httr:iris
- response-header.response
- full-file.response
?. ?=([%result *] rpc-resp)
~& [%error +.rpc-resp]
[~ state]
[~ state]
::
++ electrum-http-response
- |= [=wire response=client-response:iris]
+ |= [status=@ud rpc-resp=response:rpc:jstd]
^- (quip card _state)
- ?. ?=(%finished -.response)
- `state
- =* status-code status-code.response-header.response
- =/ rpc-resp=response:rpc:jstd
- %- httr-to-rpc-response
- %+ to-httr:iris
- response-header.response
- full-file.response
~& > rpc-resp
`state
::
