working JSON request and parsing

This commit is contained in:
timlucmiptev 2020-10-12 11:56:32 +03:00 committed by ixv
parent 8ef372f1c0
commit fd0655b068

View File

@ -47,8 +47,11 @@
%btc-bridge-command %btc-bridge-command
(handle-command:hc !<(command vase)) (handle-command:hc !<(command vase))
%btc-bridge-rpc-action %btc-bridge-rpc-action
~& > !<(rpc-action vase) =/ act=rpc-action !<(rpc-action vase)
`state ?+ -.act (on-poke:def mark vase)
%brpc
(handle-action +.act)
==
== ==
[cards this] [cards this]
:: ::
@ -76,8 +79,7 @@
^- (quip card _state) ^- (quip card _state)
?- -.comm ?- -.comm
%become-host %become-host
:: TODO send a subscription to the node hook; update status in on-agent when ack'd `state(credentials credentials.comm, status [%host connected=%.y clients=*(set ship)])
`state(credentials credentials.comm)
%connect-as-client %connect-as-client
:: TODO send a subscription to the btc-bridge host :: TODO send a subscription to the btc-bridge host
:: update status in on-agent when ack'd by BTC-BRIDGE :: update status in on-agent when ack'd by BTC-BRIDGE
@ -170,6 +172,7 @@
++ http-response ++ http-response
|= [=wire response=client-response:iris] |= [=wire response=client-response:iris]
^- (quip card _state) ^- (quip card _state)
~& >> response
?. ?=(%finished -.response) ?. ?=(%finished -.response)
[~ state] [~ state]
=* status status-code.response-header.response =* status status-code.response-header.response
@ -181,8 +184,7 @@
?. ?=([%result *] rpc-resp) ?. ?=([%result *] rpc-resp)
~& [%error +.rpc-resp] ~& [%error +.rpc-resp]
[~ state] [~ state]
~& > (parse-response:btc-rpc:lib rpc-resp)
[~ state] [~ state]
:: %- handle-btc-response
:: (parse-response:btc-rpc:lib rpc-resp)
:: ::
-- --