making rpc calls for listunspents

This commit is contained in:
timlucmiptev 2020-10-20 12:05:37 +03:00 committed by ixv
parent 91dfde532c
commit 9dfe6210d2
5 changed files with 20 additions and 7 deletions

View File

@ -3,11 +3,11 @@ The below requires norsyr's fix to `decompress-point` in order to work.
## Set Credentials and Ping Servers
```
=rpc-pass '57669fe0365412f8b2152cba2aa6fbada8a9483f9f01fee24b05ed407b1c1635'
=rpc-pass '22b159ae3ebfdc3404b446fc61df4760de0fece271586dfb5039e1260cb15775'
:btc-provider|command [%set-credentials [rpc-url='http://localhost:8332' rpc-user='__cookie__' rpc-pass] [rpc-url='http://localhost:50002']]
:btc-provider|rpc-action [%brpc %get-block-count ~]
:btc-provider|rpc-action [%erpc %get-address-balance [%bech32 'bc1q59u5epktervh6fxqay2dlph0wxu9hjnx6v8n66']]
:btc-provider|rpc-action [%erpc %get-address-utxos [%bech32 'bc1q59u5epktervh6fxqay2dlph0wxu9hjnx6v8n66']]
```
## Transactions

View File

@ -19,12 +19,17 @@
++ request-to-http
|= [endpoint=@t req=request:electrum:rpc]
^- request:http
%- http-request
?- -.req
%get-address-balance
%- http-request
%^ cat 3
(cat 3 endpoint '/addresses/balance/')
(address-to-cord address.req)
::
%get-address-utxos
%^ cat 3
(cat 3 endpoint '/addresses/listunspent/')
(address-to-cord address.req)
==
--
--

View File

@ -5,12 +5,13 @@
+$ credentials [bc=btc-credentials ec=electrum-credentials]
+$ status [creds=credentials connected=? clients=(set ship)]
+$ action
$% [%get-balance addresses=(set address)]
[%get-transactions addresses=(set address)]
$% [%get-address-info =address]
==
+$ response
$% [%block-count count=@]
[%balance (set [=address balance=sats])]
[%get-address-info info=address-info]
[%get-balance (set [=address balance=sats])]
[%get-transactions ~]
==
+$ update :: sub updates from /clients path (connection etc.)
$% [%status connected=?]
@ -30,6 +31,7 @@
|%
+$ request
$% [%get-address-balance =address]
[%get-address-utxos =address]
==
--
++ bitcoin-core

View File

@ -10,3 +10,4 @@
:: wallets
:: how many should we store?
:: seems like a list or a map keyed by xpub

View File

@ -8,8 +8,12 @@
+$ hash160 [wid=%20 dat=@ux]
+$ hash ?(hash256 hash160)
+$ buffer (list @ux)
+$ utxo [pos=@ tx-hash=hash256 block-height=@ value=sats]
++ address-info
$: =address
confirmed-value=sats
unconfirmed-value=sats
utxos=(set utxo)
==
++ tx
|%
@ -20,7 +24,7 @@
outputs=(list output)
==
+$ input
$: tx-hash=byts
$: tx-hash=hash256
tx-index=@
witness-ver=@
sequence=byts
@ -32,6 +36,7 @@
+$ output
$: =address
value=sats
==
--
++ ops