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 ## 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|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 [%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 ## Transactions

View File

@ -19,12 +19,17 @@
++ request-to-http ++ request-to-http
|= [endpoint=@t req=request:electrum:rpc] |= [endpoint=@t req=request:electrum:rpc]
^- request:http ^- request:http
%- http-request
?- -.req ?- -.req
%get-address-balance %get-address-balance
%- http-request
%^ cat 3 %^ cat 3
(cat 3 endpoint '/addresses/balance/') (cat 3 endpoint '/addresses/balance/')
(address-to-cord address.req) (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] +$ credentials [bc=btc-credentials ec=electrum-credentials]
+$ status [creds=credentials connected=? clients=(set ship)] +$ status [creds=credentials connected=? clients=(set ship)]
+$ action +$ action
$% [%get-balance addresses=(set address)] $% [%get-address-info =address]
[%get-transactions addresses=(set address)]
== ==
+$ response +$ response
$% [%block-count count=@] $% [%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.) +$ update :: sub updates from /clients path (connection etc.)
$% [%status connected=?] $% [%status connected=?]
@ -30,6 +31,7 @@
|% |%
+$ request +$ request
$% [%get-address-balance =address] $% [%get-address-balance =address]
[%get-address-utxos =address]
== ==
-- --
++ bitcoin-core ++ bitcoin-core

View File

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

View File

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