refactor types into sur; initial types

This commit is contained in:
timlucmiptev 2020-10-05 14:57:50 +03:00 committed by ixv
parent 350c004411
commit a066d6f337
5 changed files with 17 additions and 11 deletions

View File

@ -43,7 +43,7 @@
?+ q.vase (on-poke:def mark vase)
%status
:_ this
~[[%pass / %agent [our.bowl %btc-node-hook] %poke %btc-node-hook-action !>([%get-block-count ~])]]
~[[%pass / %agent [our.bowl %btc-node-hook] %poke %btc-node-hook-action !>([%ping ~])]]
==
==
::

View File

@ -1,10 +1,9 @@
:: btc-scratch.hoon
/- *btc
/+ bip32, btc
=+ ecc=secp256k1:secp:crypto
=, bech32:btc
|%
+$ bech32-address $%([%bech32 tape])
+$ address ?(@uc bech32-address)
++ bip84
|_ [network=network:btc xpub=tape]
++ address

View File

@ -1,5 +1,5 @@
/- *btc
|%
+$ network ?(%main %testnet)
++ hash-160
|= pubkey=@ux
^- @ux
@ -154,5 +154,6 @@
%+ encode-raw u.prefix
(weld ~[0] (convert:bits 8 5 (hash-160 pubkey)))
--
::
--

View File

@ -1,14 +1,15 @@
/- *btc
|%
+$ address ?(@uc [%bech32 @t])
+$ tx @
+$ credentials [rpc-url=@t rpc-user=@t rpc-password=@t]
+$ bio $: mode=?(%remote %local)
=credentials :: for connecting to btc-provider
clients=(set ship) :: allowed clients for this node
+$ status
$: [%host connected=? clients=(set ship)]
[%client connected=? host=ship]
==
+$ action
$% [%connect =credentials]
[%status ~]
$% [%connect-as-host =credentials]
[%connect-as-client host=ship]
[%check-status ~]
[%balance =address]
[%transactions =address]
[%broadcast-tx =tx]

5
sur/btc.hoon Normal file
View File

@ -0,0 +1,5 @@
|%
+$ network ?(%main %testnet)
+$ bech32-address $%([%bech32 tape])
+$ address ?(@uc bech32-address)
--