shrub/sur/btc-provider.hoon
2021-05-26 18:30:12 -07:00

52 lines
1.2 KiB
Plaintext

/- *btc, bnh=btc-node-hook
|%
+$ btc-credentials [rpc-url=@t rpc-user=@t rpc-password=@t]
+$ electrum-credentials [rpc-url=@t]
+$ credentials [bc=btc-credentials ec=electrum-credentials]
+$ status [creds=credentials connected=? clients=(set ship)]
+$ action
$% [%get-address-info =address]
==
+$ response
$% [%block-count count=@]
[%get-address-info info=address-info]
[%get-balance (set [=address balance=sats])]
[%get-transactions ~]
==
+$ update :: sub updates from /clients path (connection etc.)
$% [%status connected=?]
==
::
+$ command
$% [%set-credentials creds=credentials]
[%whitelist-clients clients=(set ship)]
==
+$ rpc-action
$% [%erpc request:electrum:rpc]
[%brpc request:bitcoin-core:rpc]
==
+$ rpc-response
$% [%erpc response:electrum:rpc]
[%brpc response:bitcoin-core:rpc]
==
++ rpc
|%
++ electrum
|%
+$ request
$% [%get-address-balance =address]
[%get-address-utxos =address]
==
+$ response
$% [%get-address-utxos utxos=(set utxo)]
==
--
++ bitcoin-core
|%
+$ request btc-node-hook-action:bnh
+$ response btc-node-hook-response:bnh
--
--
--