From fd0655b068f51c60a4eed75913e7f4a426fadfce Mon Sep 17 00:00:00 2001 From: timlucmiptev Date: Mon, 12 Oct 2020 11:56:32 +0300 Subject: [PATCH] working JSON request and parsing --- app/btc-bridge.hoon | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/app/btc-bridge.hoon b/app/btc-bridge.hoon index 0ecc344e28..8095f7d3d8 100644 --- a/app/btc-bridge.hoon +++ b/app/btc-bridge.hoon @@ -47,8 +47,11 @@ %btc-bridge-command (handle-command:hc !<(command vase)) %btc-bridge-rpc-action - ~& > !<(rpc-action vase) - `state + =/ act=rpc-action !<(rpc-action vase) + ?+ -.act (on-poke:def mark vase) + %brpc + (handle-action +.act) + == == [cards this] :: @@ -76,8 +79,7 @@ ^- (quip card _state) ?- -.comm %become-host - :: TODO send a subscription to the node hook; update status in on-agent when ack'd - `state(credentials credentials.comm) + `state(credentials credentials.comm, status [%host connected=%.y clients=*(set ship)]) %connect-as-client :: TODO send a subscription to the btc-bridge host :: update status in on-agent when ack'd by BTC-BRIDGE @@ -170,6 +172,7 @@ ++ http-response |= [=wire response=client-response:iris] ^- (quip card _state) + ~& >> response ?. ?=(%finished -.response) [~ state] =* status status-code.response-header.response @@ -181,8 +184,7 @@ ?. ?=([%result *] rpc-resp) ~& [%error +.rpc-resp] [~ state] + ~& > (parse-response:btc-rpc:lib rpc-resp) [~ state] -:: %- handle-btc-response -:: (parse-response:btc-rpc:lib rpc-resp) :: --