mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-14 08:34:25 +03:00
refactored rpc response
This commit is contained in:
parent
4c385796c8
commit
1fccd2f85b
@ -70,11 +70,15 @@
|
||||
=^ 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]
|
||||
@ -133,6 +137,7 @@
|
||||
|= req=request:electrum:rpc
|
||||
%+ request-to-http:electrum-rpc:elib
|
||||
rpc-url.ec.creds.status req
|
||||
::
|
||||
++ gen-request
|
||||
|= ract=rpc-action
|
||||
^- request:http
|
||||
@ -182,6 +187,15 @@
|
||||
~| 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
|
||||
@ -200,16 +214,8 @@
|
||||
== ==
|
||||
::
|
||||
++ 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]
|
||||
@ -217,16 +223,8 @@
|
||||
[~ 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
|
||||
::
|
||||
|
Loading…
Reference in New Issue
Block a user