2020-11-09 15:29:30 +03:00
|
|
|
/- *btc, bws=btc-wallet-store, bp=btc-provider
|
2020-10-24 19:13:36 +03:00
|
|
|
|%
|
2020-11-28 10:25:32 +03:00
|
|
|
:: btc-state: state from the provider; t is last update time
|
2020-12-23 15:58:23 +03:00
|
|
|
:: reqs: last block checked for an address/tx request to provider.
|
|
|
|
:: Used to determine whether to retry request
|
2020-11-17 11:25:50 +03:00
|
|
|
::
|
2020-12-07 11:59:30 +03:00
|
|
|
:: payment: a payment expected from another ship
|
2020-11-17 11:25:50 +03:00
|
|
|
:: - address: address generated for this payment
|
2020-11-20 14:58:27 +03:00
|
|
|
:: piym: incoming payments. Stores all ship moons under their planet.
|
2020-12-07 11:59:30 +03:00
|
|
|
:: - num-fam: total payments (addresses) outstanding for ship and its moons
|
|
|
|
:: pend-piym: incoming payment txs that peer says they have broadcast
|
2020-12-06 14:46:32 +03:00
|
|
|
:: poym: outgoing payments. One at a time: new replaces old
|
2020-11-04 16:55:47 +03:00
|
|
|
::
|
2021-01-26 21:36:21 +03:00
|
|
|
+$ txid hexb
|
2021-01-26 14:27:32 +03:00
|
|
|
+$ provider [host=ship connected=?]
|
2020-12-23 15:58:23 +03:00
|
|
|
+$ block @ud
|
|
|
|
+$ btc-state [=block fee=sats t=@da]
|
|
|
|
+$ reqs (map $?(address txid) request:bws)
|
2020-11-17 11:25:50 +03:00
|
|
|
::
|
2020-12-16 15:40:24 +03:00
|
|
|
+$ payment [pend=(unit txid) =xpub =address payer=ship value=sats]
|
2020-12-07 11:59:30 +03:00
|
|
|
+$ piym [ps=(map ship payment) num-fam=(map ship @ud)]
|
2020-12-16 15:40:24 +03:00
|
|
|
+$ pend-piym (map txid payment)
|
2020-12-06 14:46:32 +03:00
|
|
|
+$ poym (unit txbu:bws)
|
2020-11-26 12:38:30 +03:00
|
|
|
:: req-pay-address: request a payment address from another ship
|
2020-12-07 11:59:30 +03:00
|
|
|
:: - target of action is local ship
|
2020-11-26 12:38:30 +03:00
|
|
|
:: gen-pay-address: generate a payment address from our ship to another
|
2020-12-06 14:46:32 +03:00
|
|
|
:: ret-pay-address: give an address to a payer who requested it
|
2020-12-07 16:27:26 +03:00
|
|
|
:: broadcast-tx: broadcast a signed-psbt, must be current poym
|
|
|
|
:: expect-payment: tell another ship that we're paying a previously requested address
|
2020-12-07 23:31:09 +03:00
|
|
|
:: - vout-n is the index of the output that has value
|
2020-11-16 20:47:00 +03:00
|
|
|
::
|
2020-10-24 19:13:36 +03:00
|
|
|
+$ action
|
2021-02-09 13:25:38 +03:00
|
|
|
$% api
|
2020-12-21 12:50:33 +03:00
|
|
|
local
|
|
|
|
peer
|
|
|
|
==
|
2021-02-09 13:25:38 +03:00
|
|
|
+$ api
|
2021-01-28 14:03:53 +03:00
|
|
|
$% [%set-provider provider=ship =network]
|
2020-11-17 11:25:50 +03:00
|
|
|
[%set-default-wallet ~]
|
2020-11-26 12:38:30 +03:00
|
|
|
[%clear-poym ~]
|
2020-11-09 18:34:29 +03:00
|
|
|
[%force-retry ~]
|
2021-02-09 13:25:38 +03:00
|
|
|
[%req-pay-address payee=ship value=sats feyb=(unit sats)]
|
|
|
|
[%broadcast-tx txhex=cord]
|
2020-10-24 19:13:36 +03:00
|
|
|
==
|
2021-02-09 13:25:38 +03:00
|
|
|
:: local and peer pokes are initiated by the agent itself
|
|
|
|
:: they exist to make the state machine explicit
|
|
|
|
:: they are not part of the API
|
|
|
|
::
|
2020-12-21 12:50:33 +03:00
|
|
|
+$ local
|
2021-02-09 13:25:38 +03:00
|
|
|
$% [%add-piym =xpub =address payer=ship value=sats]
|
2020-12-23 12:26:42 +03:00
|
|
|
[%add-poym =txbu:bws]
|
2021-01-26 21:36:21 +03:00
|
|
|
[%add-poym-txi txid=hexb rawtx=hexb]
|
2020-12-23 14:21:48 +03:00
|
|
|
[%close-pym ti=info:tx]
|
2021-01-26 21:36:21 +03:00
|
|
|
[%fail-broadcast-tx txid=hexb]
|
|
|
|
[%succeed-broadcast-tx txid=hexb]
|
2020-12-21 12:50:33 +03:00
|
|
|
==
|
2021-02-09 13:25:38 +03:00
|
|
|
::
|
2020-12-21 12:50:33 +03:00
|
|
|
+$ peer
|
|
|
|
$% [%gen-pay-address value=sats]
|
|
|
|
[%ret-pay-address =address payer=ship value=sats]
|
2021-01-26 21:36:21 +03:00
|
|
|
[%expect-payment txid=hexb value=sats]
|
2020-12-21 12:50:33 +03:00
|
|
|
==
|
|
|
|
::
|
|
|
|
::
|
2020-12-15 19:05:50 +03:00
|
|
|
+$ update
|
|
|
|
$% request
|
|
|
|
error
|
|
|
|
==
|
|
|
|
::
|
2020-11-20 18:57:19 +03:00
|
|
|
+$ request
|
2020-11-22 15:57:25 +03:00
|
|
|
$% [%sign-tx txbu:bws]
|
2020-11-20 18:57:19 +03:00
|
|
|
==
|
2020-12-15 19:05:50 +03:00
|
|
|
::
|
|
|
|
+$ error
|
2021-01-26 21:36:21 +03:00
|
|
|
$% [%broadcast-tx-mismatch-poym signed=hexb]
|
|
|
|
[%broadcast-tx-spent-utxos txid=hexb]
|
2020-12-15 19:05:50 +03:00
|
|
|
==
|
2020-10-24 19:13:36 +03:00
|
|
|
--
|