This commit is contained in:
timlucmiptev 2020-10-05 15:21:23 +03:00 committed by ixv
parent a066d6f337
commit 449b760e4f
4 changed files with 41 additions and 18 deletions

View File

@ -8,7 +8,7 @@
$% state-0
==
::
+$ state-0 [%0 counter=@]
+$ state-0 [%0 =status]
::
+$ card card:agent:gall
::
@ -17,6 +17,7 @@
=| state-0
=* state -
^- agent:gall
=<
|_ =bowl:gall
+* this .
def ~(. (default-agent this %|) bowl)
@ -38,14 +39,13 @@
++ on-poke
|= [=mark =vase]
^- (quip card _this)
?+ mark (on-poke:def mark vase)
%noun
?+ q.vase (on-poke:def mark vase)
%status
:_ this
~[[%pass / %agent [our.bowl %btc-node-hook] %poke %btc-node-hook-action !>([%ping ~])]]
:: TODO only allow poke if we are a host (in status)
=^ cards state
?+ mark (on-poke:def mark vase)
%btc-bridge-command
(handle-command:hc !<(command vase))
==
==
[cards this]
::
++ on-watch on-watch:def
++ on-leave on-leave:def
@ -67,3 +67,10 @@
++ on-fail on-fail:def
--
:: helper core
|_ =bowl:gall
++ handle-command
|= comm=command
^- (quip card _state)
~& >>> comm
`state
--

View File

@ -1,7 +0,0 @@
/+ btca=btc-address
:- %say
|= [[now=@da eny=@uvJ bec=beak] [zpub=tape ~] ~]
:- %noun
=/ pp=(unit parsed-xpub:btca)
(parse-zpub:btca zpub)
pp

View File

@ -0,0 +1,19 @@
:: Sends a command to the BTC Bridge
::
:: Commands:
::
::
::
/- *btc-bridge
::
:- %say
|= $: [now=@da eny=@uvJ =beak]
[[comm=command ~] ~]
==
:- %btc-bridge-command
?+ -.comm ~| [%unsupported-command -.comm] !!
%connect-as-host comm
%connect-as-client comm
%add-clients comm
%broadcast-tx comm
==

View File

@ -7,11 +7,15 @@
[%client connected=? host=ship]
==
+$ action
$% [%connect-as-host =credentials]
[%connect-as-client host=ship]
[%check-status ~]
$% [%check-status ~]
[%balance =address]
[%transactions =address]
==
::
+$ command
$% [%connect-as-host =credentials]
[%connect-as-client host=ship]
[%add-clients clients=(set ship)]
[%broadcast-tx =tx]
==
--