shrub/app/btc-wallet-hook.hoon

555 lines
15 KiB
Plaintext
Raw Normal View History

2020-10-24 19:13:36 +03:00
:: btc-wallet-hook.hoon
2020-10-28 16:20:24 +03:00
::
2020-11-04 16:55:47 +03:00
:: Subscribes to:
2020-10-28 16:20:24 +03:00
:: btc-provider:
2020-11-04 16:55:47 +03:00
:: - connection status
:: - RPC call results/errors
::
:: btc-wallet-store
:: - requests for address info
:: - updates to existing address info
::
:: Sends updates to:
2020-11-20 18:57:19 +03:00
:: /sign-me
2020-10-24 19:13:36 +03:00
::
2020-11-20 14:58:27 +03:00
/- *btc, *btc-wallet-hook, bws=btc-wallet-store
2020-12-07 11:59:30 +03:00
/+ dbug, default-agent, bp=btc-provider
2020-10-24 19:13:36 +03:00
|%
2020-11-20 14:58:27 +03:00
++ defaults
|%
2020-12-07 14:56:50 +03:00
++ fam-limit 10
++ piym-limit 3
2020-11-20 14:58:27 +03:00
--
2020-10-24 19:13:36 +03:00
+$ versioned-state
$% state-0
==
2020-11-19 17:42:53 +03:00
:: provider: maybe ship if provider is set
2020-12-07 11:59:30 +03:00
:: fam-limit: how many addresses a ship and its moons can request in piym
2020-12-07 14:56:50 +03:00
:: piym-limit: how many entries a given ship can have in pend-piym
:: A ship can only broadcast X payments to us until we see one of them in the mempool
2020-11-28 10:25:32 +03:00
:: feybs: fee/byte in sats used for a given ship payee
2020-10-24 19:13:36 +03:00
::
2020-11-04 16:55:47 +03:00
+$ state-0
$: %0
2020-11-09 16:27:04 +03:00
provider=(unit [host=ship connected=?])
2020-11-16 20:06:45 +03:00
=btc-state
2020-11-17 11:25:50 +03:00
def-wallet=(unit xpub)
2020-12-07 11:59:30 +03:00
fam-limit=@ud
2020-12-07 14:56:50 +03:00
piym-limit=@ud
2020-11-26 12:38:30 +03:00
feybs=(map ship sats)
2020-11-28 10:25:32 +03:00
=reqs
2020-11-17 13:10:54 +03:00
=piym
2020-12-06 14:46:32 +03:00
=poym
2020-12-07 11:59:30 +03:00
=pend-piym
2020-11-04 16:55:47 +03:00
==
2020-10-24 19:13:36 +03:00
::
2020-11-11 11:00:32 +03:00
+$ card card:agent:gall
2020-10-24 19:13:36 +03:00
--
=| state-0
=* state -
%- agent:dbug
^- agent:gall
=<
|_ =bowl:gall
+* this .
def ~(. (default-agent this %|) bowl)
hc ~(. +> bowl)
::
2020-12-08 12:56:32 +03:00
++ on-init
2020-10-24 19:13:36 +03:00
^- (quip card _this)
~& > '%btc-wallet-hook initialized'
2020-12-07 11:59:30 +03:00
:_ this(fam-limit.state fam-limit:defaults)
2020-11-04 16:55:47 +03:00
:~ [%pass /r/[(scot %da now.bowl)] %agent [our.bowl %btc-wallet-store] %watch /requests]
[%pass /u/[(scot %da now.bowl)] %agent [our.bowl %btc-wallet-store] %watch /updates]
==
2020-10-24 19:13:36 +03:00
++ on-save
^- vase
!>(state)
++ on-load
|= old-state=vase
^- (quip card _this)
~& > '%btc-wallet-hook recompiled'
`this(state !<(versioned-state old-state))
++ on-poke
|= [=mark =vase]
^- (quip card _this)
=^ cards state
?+ mark (on-poke:def mark vase)
%btc-wallet-hook-action
(handle-action:hc !<(action vase))
==
[cards this]
::
2020-11-22 17:49:55 +03:00
++ on-watch
|= pax=path
^- (quip card _this)
?+ pax (on-watch:def pax)
[%sign-me ~]
`this
==
2020-10-24 19:13:36 +03:00
++ on-leave on-leave:def
++ on-peek on-peek:def
++ on-agent
|= [=wire =sign:agent:gall]
2020-11-09 15:43:30 +03:00
^- (quip card _this)
2020-10-24 19:13:36 +03:00
?+ -.sign (on-agent:def wire sign)
%kick
2020-11-26 12:38:30 +03:00
~& >>> "kicked from provider {<src.bowl>}"
?~ provider `this
?: ?& ?=(%set-provider -.wire)
=(host.u.provider src.bowl)
==
`this(provider ~)
`this
::
2020-11-04 16:55:47 +03:00
%fact
=^ cards state
?+ p.cage.sign `state
%btc-provider-status
(handle-provider-status:hc !<(status:bp q.cage.sign))
::
2020-11-09 16:27:04 +03:00
%btc-provider-update
(handle-provider-update:hc !<(update:bp q.cage.sign))
::
2020-11-04 16:55:47 +03:00
%btc-wallet-store-request
2020-11-17 12:34:04 +03:00
(handle-wallet-store-request:hc !<(request:bws q.cage.sign))
::
%btc-wallet-store-update
2020-11-17 13:10:54 +03:00
(handle-wallet-store-update:hc wire !<(update:bws q.cage.sign))
2020-11-04 16:55:47 +03:00
==
[cards this]
2020-10-24 19:13:36 +03:00
==
2020-11-24 22:30:41 +03:00
++ on-arvo on-arvo:def
2020-10-24 19:13:36 +03:00
++ on-fail on-fail:def
--
|_ =bowl:gall
++ handle-action
|= act=action
^- (quip card _state)
?- -.act
%set-provider
2020-11-04 18:24:00 +03:00
=* sub-card
[%pass /set-provider %agent [provider.act %btc-provider] %watch /clients]
2020-11-09 18:34:29 +03:00
:_ state(provider [~ provider.act %.n])
2020-11-04 18:24:00 +03:00
?~ provider ~[sub-card]
:~ [%pass /set-provider %agent [host.u.provider %btc-provider] %leave ~]
2020-11-04 18:24:00 +03:00
sub-card
==
2020-11-16 20:47:00 +03:00
::
2020-11-17 11:25:50 +03:00
%set-default-wallet
=/ xs=(list xpub) scry-scanned
?. (gth (lent xs) 0) `state
`state(def-wallet `(snag 0 xs))
::
%req-pay-address
2020-11-26 12:38:30 +03:00
:: overwrites any payment being built currently
2020-11-17 13:10:54 +03:00
:: can't pay yourself; comets can't pay (could spam requests)
:: forwards poke to payee if payee isn't us
2020-12-06 14:46:32 +03:00
:: deletes poym since we'll be making a new outgoing payment
:: lets us set fee per byte and recall it once we get a payment address back
:: wire is /payer/value/timestamp
2020-11-17 13:10:54 +03:00
::
2020-11-26 12:38:30 +03:00
~| "Can't pay ourselves; no comets"
2020-11-17 13:10:54 +03:00
?< =(src.bowl payee.act)
2020-11-26 12:38:30 +03:00
?< ?=(%pawn (clan:title payee.act))
=+ feyb=?~(feyb.act fee.btc-state u.feyb.act)
=> .(poym ~, feybs (~(put by feybs) payee.act feyb))
2020-11-17 12:34:04 +03:00
:_ state
2020-11-26 12:38:30 +03:00
~[(poke-wallet-hook payee.act [%gen-pay-address value.act])]
2020-12-07 11:59:30 +03:00
:: can't pay yourself; comets can't pay (could spam requests)
:: must have default wallet set
:: reuses payment address for ship if exists in piym
2020-11-26 12:38:30 +03:00
::
%gen-pay-address
~| "Can't pay ourselves; no comets"
?< =(src.bowl our.bowl)
?< ?=(%pawn (clan:title src.bowl))
2020-12-07 11:59:30 +03:00
=^ cards state
(reuse-address src.bowl value.act)
?^ cards [cards state]
:: if no reuseable address, call store to generate
::
=+ f=(fam src.bowl)
=+ n=(~(gut by num-fam.piym) f 0)
2020-11-17 12:34:04 +03:00
?~ def-wallet ~|("btc-wallet-hook: no def-wallet set" !!)
2020-12-07 11:59:30 +03:00
?: (gte n fam-limit)
~|("More than {<fam-limit>} addresses for moons + planet" !!)
:_ state(num-fam.piym (~(put by num-fam.piym) f +(n)))
2020-11-26 12:38:30 +03:00
:~ %- poke-wallet-store
[%generate-address u.def-wallet %0 `[src.bowl value.act]]
==
2020-11-17 11:25:50 +03:00
::
2020-11-19 18:21:32 +03:00
%ret-pay-address
2020-11-26 12:38:30 +03:00
?: =(src.bowl our.bowl) ~|("Can't pay ourselves" !!)
2020-11-19 18:21:32 +03:00
?~ def-wallet ~|("btc-wallet-hook: no def-wallet set" !!)
2020-11-26 12:38:30 +03:00
=+ feyb=(~(gut by feybs) src.bowl fee.btc-state)
2020-11-19 18:21:32 +03:00
?> =(payer.act our.bowl)
:_ state
:~ %- poke-wallet-store
2020-12-08 20:31:21 +03:00
[%generate-txbu u.def-wallet `src.bowl feyb ~[[address.act value.act ~]]]
2020-11-19 18:21:32 +03:00
==
2020-12-06 14:46:32 +03:00
::
%broadcast-tx
2020-12-07 14:56:50 +03:00
:: TODO:
2020-12-07 16:27:26 +03:00
:: calc txid from poym's txbu
2020-12-07 14:56:50 +03:00
:: calc txid
2020-12-07 16:27:26 +03:00
:: make sure both are the same
:: remove from poym
:: broadcast to provider
:: add to wallet-store history
:: send message to peer
`state
2020-12-07 23:31:09 +03:00
::
2020-12-07 16:27:26 +03:00
:: - check that src.bowl isn't past piym-limit in pend-piym
:: - check that payment is in piym
2020-12-07 23:31:09 +03:00
:: - add payment to pend-piym
2020-12-07 17:31:48 +03:00
:: - send tx-info to provider (poke)
::
%expect-payment
2020-12-07 23:31:09 +03:00
~| "Too many %expect-payment sent, or payer+value not found in incoming payments"
=+ num-pend=(~(gut by num.pend-piym) payer.act 0)
2020-12-07 17:31:48 +03:00
?> (gte piym-limit num-pend)
=+ pay=(~(get by ps.piym) payer.act)
?~ pay !!
?> ?& =(payer.u.pay payer.act)
=(value.u.pay value.act)
==
2020-12-07 23:31:09 +03:00
:- ?~ provider ~
~[(get-tx-info host.u.provider txid.act)]
2020-12-07 17:31:48 +03:00
%= state
2020-12-07 23:31:09 +03:00
ps.pend-piym (~(put by ps.pend-piym) txid.act [u.pay vout-n.act])
num.pend-piym (~(put by num.pend-piym) payer.act +(num-pend))
2020-12-07 17:31:48 +03:00
==
2020-11-26 12:38:30 +03:00
::
%clear-poym
`state(poym ~)
2020-11-09 18:34:29 +03:00
::
%force-retry
2020-12-04 21:54:59 +03:00
[(retry-reqs block.btc-state) state]
2020-10-24 19:13:36 +03:00
==
2020-11-25 11:49:33 +03:00
:: +handle-provider-status: handle connectivity updates from provider
2020-12-07 23:31:09 +03:00
:: - retry pend-piym on any %connected event, since we're checking mempool
2020-12-04 21:54:59 +03:00
:: - if status is %connected, retry all pending address lookups
2020-12-09 11:56:38 +03:00
:: - only retry all if previously disconnected
2020-12-04 21:54:59 +03:00
:: - if block is updated, retry all address reqs
::
++ handle-provider-status
|= s=status:bp
^- (quip card _state)
?~ provider `state
?. =(host.u.provider src.bowl) `state
2020-11-16 20:06:45 +03:00
?- -.s
%connected
2020-12-04 21:54:59 +03:00
:_ %= state
provider `[host.u.provider %.y]
btc-state [block.s fee.s now.bowl]
==
?: ?!(connected.u.provider)
2020-12-07 23:31:09 +03:00
%- zing
:~ (retry-reqs block.s)
retry-txbu
retry-pend-piym
==
?. (lth block.btc-state block.s)
retry-pend-piym
2020-12-04 23:20:43 +03:00
~& > "got new block, retrying {<(lent (retry-reqs block.s))>} reqs "
2020-12-07 23:31:09 +03:00
(weld retry-pend-piym (retry-reqs block.s))
2020-12-04 21:54:59 +03:00
::
%disconnected
`state(provider `[host.u.provider %.n])
==
::
++ handle-provider-update
2020-11-20 14:58:27 +03:00
|= upd=update:bp
2020-11-17 11:25:50 +03:00
^- (quip card _state)
2020-11-20 14:58:27 +03:00
?. ?=(%.y -.upd) `state
?- -.body.p.upd
%address-info
2020-12-03 12:47:54 +03:00
=/ req=(unit request:bws)
(~(get by reqs) req-id.p.upd)
2020-11-25 11:49:33 +03:00
?~ req `state
2020-12-07 23:31:09 +03:00
?> ?=([%address-info *] u.req)
2020-12-03 12:47:54 +03:00
:_ state(reqs (~(del by reqs) req-id.p.upd))
2020-11-19 18:21:32 +03:00
:~ %- poke-wallet-store
2020-11-25 11:49:33 +03:00
:* %address-info xpub.u.req chyg.u.req idx.u.req
2020-12-03 12:47:54 +03:00
utxos.body.p.upd used.body.p.upd block.body.p.upd
==
==
2020-12-07 11:59:30 +03:00
::
%tx-info
2020-12-08 14:47:23 +03:00
:: %txinfo
2020-12-07 23:31:09 +03:00
:: - forward tx to wallet-store
:: - delete txid from pend-piym and decrement num.pend-piym
:: - check whether payment in pend-piym matches this tx's output values
:: if yes add to wallet-store-history
2020-12-08 14:47:23 +03:00
::
2020-12-07 23:31:09 +03:00
=/ ti=info:tx +.body.p.upd
=/ mh=(unit [=xpub =hest:bws])
(mk-hest ti (~(get by ps.pend-piym) txid.ti))
:_ state(pend-piym (del-txid txid.ti))
%+ weld ~[(poke-wallet-store [%tx-info ti])]
?~ mh ~
~[(poke-wallet-store [%add-history-entry xpub.u.mh hest.u.mh])]
2020-12-08 14:47:23 +03:00
:: %raw-tx
:: - if the req-id is for current poym, add txid/rawtx to the poym
:: - if the raw tx matches one of poym's inputs, add it
2020-11-20 14:58:27 +03:00
::
%raw-tx
2020-12-08 14:47:23 +03:00
=* rt body.p.upd
=. poym (update-poym-tx req-id.p.upd txid.rt rawtx.rt)
2020-11-26 12:38:30 +03:00
?~ poym `state
2020-12-08 14:47:23 +03:00
=. txis.u.poym (update-poym-txis txis.u.poym txid.rt rawtx.rt)
2020-11-20 18:57:19 +03:00
:_ state
2020-11-22 15:57:25 +03:00
?:(poym-ready ~[(send-sign-tx u.poym)] ~)
==
2020-12-04 21:54:59 +03:00
:: get address-info for the request if block in request is old
::
2020-11-17 12:34:04 +03:00
++ handle-wallet-store-request
2020-11-04 16:55:47 +03:00
|= req=request:bws
^- (quip card _state)
2020-12-07 23:31:09 +03:00
?~ provider `state
=/ should-send=?
?& provider-connected
(lth last-block.req block.btc-state)
==
2020-11-04 16:55:47 +03:00
?- -.req
2020-12-03 12:47:54 +03:00
%address-info
2020-11-25 11:49:33 +03:00
=+ ri=(gen-req-id:bp eny.bowl)
2020-12-03 12:47:54 +03:00
:_ state(reqs (~(put by reqs) ri req))
2020-12-07 23:31:09 +03:00
?: should-send
2020-11-10 14:09:59 +03:00
~[(get-address-info ri host.u.provider a.req)]
~
2020-12-07 23:31:09 +03:00
::
%tx-info
:: TODO: push the request out
:: put it in reqs
:: check whether last-block has passed
`state
2020-11-04 16:55:47 +03:00
==
::
2020-11-17 12:34:04 +03:00
++ handle-wallet-store-update
2020-11-17 13:10:54 +03:00
|= [=wire upd=update:bws]
2020-11-17 12:34:04 +03:00
^- (quip card _state)
?- -.upd
2020-12-08 15:24:02 +03:00
:: %generate-address
:: if no peta (payer/value), just prints address
2020-11-17 13:10:54 +03:00
::
2020-12-08 15:24:02 +03:00
%generate-address
2020-12-06 14:46:32 +03:00
?~ peta.upd ~&(> address.upd `state)
=/ [payer=ship value=sats] u.peta.upd
2020-12-07 11:59:30 +03:00
:_ state(ps.piym (~(put by ps.piym) payer [xpub.upd address.upd payer value]))
~[(poke-wallet-hook payer [%ret-pay-address address.upd payer value])]
2020-12-08 15:24:02 +03:00
:: %generate-txbu
:: - replace current txbu (otherwise can have UTXO overlap)
:: - request provider to create-raw-tx from txbu
2020-11-19 17:42:53 +03:00
::
%generate-txbu
2020-11-22 15:57:25 +03:00
:_ state(poym `txbu.upd)
2020-11-20 16:30:35 +03:00
?~ provider ~&(>>> "provider not set" ~)
2020-12-08 15:24:02 +03:00
%+ weld ~[(create-raw-tx host.u.provider txbu.upd)]
2020-11-20 16:30:35 +03:00
%+ turn txis.txbu.upd
|=(=txi:bws (get-raw-tx host.u.provider txid.utxo.txi))
2020-12-07 11:59:30 +03:00
::
%saw-piym
`state
2020-11-17 12:34:04 +03:00
::
%scan-done
2020-11-17 18:34:48 +03:00
?~ def-wallet
`state(def-wallet `xpub.upd)
2020-11-17 12:34:04 +03:00
`state
==
2020-12-07 11:59:30 +03:00
:: +reuse-address: if piym already has address for payer,
:: replace address and return to payer
2020-12-06 14:46:32 +03:00
::
2020-12-07 11:59:30 +03:00
++ reuse-address
|= [payer=ship value=sats]
^- (quip card _state)
=+ p=(~(get by ps.piym) payer)
?~ p `state
=+ newp=u.p(value value)
:_ state(ps.piym (~(put by ps.piym) payer newp))
:~ %+ poke-wallet-hook payer
[%ret-pay-address address.newp payer value]
==
2020-12-07 23:31:09 +03:00
:: +del-txid: delete txid from pend-piym
2020-11-19 17:42:53 +03:00
::
2020-12-07 23:31:09 +03:00
++ del-txid
|= =txid
^- ^pend-piym
=+ p=(~(get by ps.pend-piym) txid)
=. ps.pend-piym (~(del by ps.pend-piym) txid)
?~ p pend-piym
=* payer payer.pay.u.p
=+ n=(~(get by num.pend-piym) payer)
?~ n pend-piym
?: =(0 u.n) pend-piym
pend-piym(num (~(put by num.pend-piym) payer (dec u.n)))
:: +mk-hest: make a hest to add to wallet-store's history
:: - one of the outputs' value must match the payment from pend-piym
::
++ mk-hest
|= [=info:tx p=(unit [pay=payment vout-n=@ud])]
^- (unit [=xpub =hest:bws])
?~ p ~
?. ?& (gth (lent outputs.info) vout-n.u.p)
=(value.pay.u.p value:(snag vout-n.u.p outputs.info))
==
~
:- ~
:- xpub.pay.u.p
:* txid.info
confs.info
recvd.info
%+ turn inputs.info
|=(i=val:tx [i `payer.pay.u.p])
%+ turn outputs.info
|= o=val:tx
?: =(pos.o vout-n.u.p)
[o `our.bowl]
[o `payer.pay.u.p]
==
2020-12-07 11:59:30 +03:00
:: +fam: planet parent if s is a moon
::
++ fam
|= s=ship
^- ship
?. =(%earl (clan:title s)) s
(sein:title our.bowl now.bowl s)
2020-12-08 14:47:23 +03:00
:: +update-poym-tx
:: - check whether poym txbu's req-id matches this one
:: - if it does, add the txid and rawtx
::
++ update-poym-tx
|= [ri=req-id:bp =txid rt=rawtx]
^- ^poym
?~ poym ~
?~ txinfo.u.poym poym
?. =(ri req-id.u.poym) poym
`u.poym(txinfo `[txid rt])
:: check poym txbu
2020-11-25 11:49:33 +03:00
:: +update-poym-txis:
:: update outgoing payment with a rawtx, if the txid is in poym's txis
2020-11-17 12:34:04 +03:00
::
2020-11-22 15:57:25 +03:00
++ update-poym-txis
|= [txis=(list txi:bws) =txid rt=rawtx]
^- (list txi:bws)
2020-11-20 18:57:19 +03:00
=| i=@
2020-11-22 15:57:25 +03:00
|- ?: (gte i (lent txis)) txis
2020-11-20 18:57:19 +03:00
=/ ith=txi:bws (snag i txis)
=? txis =(txid txid.utxo.ith)
(snap txis i `txi:bws`ith(ur `rt))
$(i +(i))
2020-12-08 14:47:23 +03:00
:: +poym-ready: whether poym txbu is ready to sign
:: - is the txinfo filled in?
:: - do all txis in poym have rawtxs?
2020-11-20 18:57:19 +03:00
::
++ poym-ready
^- ?
2020-11-22 15:57:25 +03:00
?~ poym %.n
2020-12-08 14:47:23 +03:00
?& ?=(^ txinfo.u.poym)
%+ levy txis.u.poym
|=(t=txi:bws ?=(^ ur.t))
==
2020-12-04 21:54:59 +03:00
:: +retry-reqs: get-address-info for any reqs with old last-block
2020-11-20 18:57:19 +03:00
::
2020-12-03 12:47:54 +03:00
++ retry-reqs
2020-12-04 21:54:59 +03:00
|= [latest-block=@ud]
2020-11-09 16:27:04 +03:00
^- (list card)
?~ provider ~|("provider not set" !!)
2020-12-04 21:54:59 +03:00
%+ murn ~(tap by reqs)
2020-11-09 16:27:04 +03:00
|= [ri=req-id:bp req=request:bws]
2020-12-04 21:54:59 +03:00
?: (gte last-block.req latest-block) ~
2020-12-07 23:31:09 +03:00
?- -.req
%address-info
`(get-address-info ri host.u.provider a.req)
::
%tx-info
`(get-tx-info host.u.provider txid.req)
==
2020-11-09 16:27:04 +03:00
::
2020-11-22 15:57:25 +03:00
++ retry-txbu
^- (list card)
?~ poym ~
?~ provider ~|("provider not set" !!)
%+ turn txis.u.poym
|= =txi:bws
(get-raw-tx host.u.provider txid.utxo.txi)
2020-12-07 23:31:09 +03:00
:: +retry-pend-piym: check whether txids in pend-piym are in mempool
::
++ retry-pend-piym
^- (list card)
?~ provider ~|("provider not set" !!)
%+ turn ~(tap in ~(key by ps.pend-piym))
|=(=txid (get-tx-info host.u.provider txid))
2020-11-22 15:57:25 +03:00
::
2020-11-04 16:55:47 +03:00
++ get-address-info
2020-11-20 16:22:24 +03:00
|= [ri=req-id:bp host=ship a=address]
^- card
2020-12-08 15:24:02 +03:00
(poke-provider host `ri [%address-info a])
2020-11-20 14:58:27 +03:00
::
2020-11-20 16:22:24 +03:00
++ get-raw-tx
|= [host=ship =txid]
^- card
2020-12-08 15:24:02 +03:00
(poke-provider host ~ [%raw-tx txid])
::
++ create-raw-tx
|= [host=ship t=txbu:bws]
^- card
=/ ins=(list [txid @ud])
%+ turn txis.t
|=(=txi:bws [txid.utxo.txi pos.utxo.txi])
=/ outs=(list [address sats])
%+ turn txos.t
|=(=txo:bws [address.txo value.txo])
(poke-provider host `req-id.t [%create-raw-tx ins outs])
2020-11-20 16:22:24 +03:00
::
2020-12-07 17:31:48 +03:00
++ get-tx-info
|= [host=ship =txid]
^- card
2020-12-08 15:24:02 +03:00
(poke-provider host ~ [%tx-info txid])
::
++ poke-provider
|= [host=ship uri=(unit req-id:bp) actb=action-body:bp]
^- card
=+ ri=?^(uri u.uri (gen-req-id:bp eny.bowl))
2020-12-07 17:31:48 +03:00
:* %pass /[(scot %da now.bowl)] %agent [host %btc-provider]
2020-12-08 15:24:02 +03:00
%poke %btc-provider-action !>([ri actb])
2020-12-07 17:31:48 +03:00
==
::
2020-11-10 14:09:59 +03:00
++ provider-connected
^- ?
?~ provider %.n
connected.u.provider
2020-11-17 11:25:50 +03:00
::
2020-11-17 12:34:04 +03:00
++ poke-wallet-hook
|= [target=ship act=action]
^- card
2020-11-17 11:25:50 +03:00
:* %pass /[(scot %da now.bowl)] %agent
2020-11-17 12:34:04 +03:00
[target %btc-wallet-hook] %poke
%btc-wallet-hook-action !>(act)
==
::
2020-11-22 15:57:25 +03:00
++ send-sign-tx
|= =txbu:bws
2020-11-20 18:57:19 +03:00
^- card
2020-11-22 15:57:25 +03:00
[%give %fact ~[/sign-me] %btc-wallet-hook-request !>([%sign-tx txbu])]
2020-11-20 18:57:19 +03:00
::
2020-11-17 12:34:04 +03:00
++ poke-wallet-store
2020-11-19 18:21:32 +03:00
|= act=action:bws
2020-11-17 12:34:04 +03:00
^- card
2020-11-19 18:21:32 +03:00
:* %pass /[(scot %da now.bowl)]
2020-11-17 12:34:04 +03:00
%agent [our.bowl %btc-wallet-store] %poke
2020-11-17 11:25:50 +03:00
%btc-wallet-store-action !>(act)
==
::
++ scry-scanned
.^ (list xpub)
%gx
(scot %p our.bowl)
%btc-wallet-store
(scot %da now.bowl)
%scanned
%noun
==
2020-10-24 19:13:36 +03:00
--