summaryrefslogtreecommitdiff
path: root/app/sur
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2025-11-12 07:11:07 +0700
committerpolwex <polwex@sortug.com>2025-11-12 07:11:07 +0700
commit284ce9ce7d9f81e54e91f917329d48926487fbf4 (patch)
tree7a156986323fd799e1457c8b7663806e32b2af7d /app/sur
parent7305d67ff7f9e78b73326ef0e1f68a9613d34205 (diff)
fixes to engagement handling
Diffstat (limited to 'app/sur')
-rw-r--r--app/sur/bitcoin.hoon84
-rw-r--r--app/sur/nostrill.hoon11
-rw-r--r--app/sur/nostrill/comms.hoon11
3 files changed, 97 insertions, 9 deletions
diff --git a/app/sur/bitcoin.hoon b/app/sur/bitcoin.hoon
new file mode 100644
index 0000000..4b83b5b
--- /dev/null
+++ b/app/sur/bitcoin.hoon
@@ -0,0 +1,84 @@
+:: sur/btc.hoon
+:: Utilities for working with BTC data types and transactions
+::
+:: chyg: whether account is (non-)change. 0 or 1
+:: bytc: "btc-byts" with dat cast to @ux
+|%
++$ network ?(%main %testnet %regtest)
++$ hexb [wid=@ dat=@ux] :: hex byts
++$ bits [wid=@ dat=@ub]
++$ xpub @ta
++$ address
+ $% [%base58 @uc]
+ [%bech32 cord]
+ ==
++$ fprint hexb
++$ bipt $?(%44 %49 %84)
++$ chyg $?(%0 %1)
++$ idx @ud
++$ hdkey [=fprint pubkey=hexb =network =bipt =chyg =idx]
++$ sats @ud
++$ vbytes @ud
++$ txid hexb
++$ utxo [pos=@ =txid height=@ value=sats recvd=(unit @da)]
+++ address-info
+ $: =address
+ confirmed-value=sats
+ unconfirmed-value=sats
+ utxos=(set utxo)
+ ==
+++ tx
+ |%
+ +$ data
+ $: is=(list input)
+ os=(list output)
+ locktime=@ud
+ nversion=@ud
+ segwit=(unit @ud)
+ ==
+ +$ val
+ $: =txid
+ pos=@ud
+ =address
+ value=sats
+ ==
+ :: included: whether tx is in the mempool or blockchain
+ ::
+ +$ info
+ $: included=?
+ =txid
+ confs=@ud
+ recvd=(unit @da)
+ inputs=(list val)
+ outputs=(list val)
+ ==
+ +$ input
+ $: =txid
+ pos=@ud
+ sequence=hexb
+ script-sig=(unit hexb)
+ pubkey=(unit hexb)
+ value=sats
+ ==
+ +$ output
+ $: script-pubkey=hexb
+ value=sats
+ ==
+ --
+++ psbt
+ |%
+ +$ base64 cord
+ +$ in [=utxo rawtx=hexb =hdkey]
+ +$ out [=address hk=(unit hdkey)]
+ +$ target $?(%input %output)
+ +$ keyval [key=hexb val=hexb]
+ +$ map (list keyval)
+ --
+++ ops
+ |%
+ ++ op-dup 118
+ ++ op-equalverify 136
+ ++ op-hash160 169
+ ++ op-checksig 172
+ --
+--
diff --git a/app/sur/nostrill.hoon b/app/sur/nostrill.hoon
index c5c5ae8..92a0876 100644
--- a/app/sur/nostrill.hoon
+++ b/app/sur/nostrill.hoon
@@ -15,6 +15,7 @@
:: profiles
profiles=(map user user-meta:nostr)
following=(map user =feed:trill)
+ following2=feed:trill
follow-graph=(map user (set user))
:: TODO global feed somehow?
@@ -39,7 +40,6 @@ $: pub=(unit @ux)
$% [%fols fols-poke]
[%begs begs-poke]
[%post post-poke]
- :: [%reac reac-poke]
[%prof prof-poke]
[%keys ~] :: cycle-keys
[%rela relay-poke]
@@ -50,11 +50,12 @@ $: pub=(unit @ux)
==
+$ post-poke
$% [%add content=@t]
- [%reply content=@t host=@p id=@ thread=@]
- [%quote content=@t host=@p id=@]
- [%rp host=@p id=@] :: NIP-18
+ [%reply content=@t host=@p id=@da thread=@da]
+ [%quote content=@t host=@p id=@da]
+ [%rp host=@p id=@da] :: NIP-18
+ [%reaction host=@p id=@da reaction=@t]
:: [%rt id=@ux pubkey=@ux relay=@t] :: NIP-18
- :: [%del pubkey=@ux]
+ [%del host=@p id=@da]
==
+$ fols-poke
$% [%add =user]
diff --git a/app/sur/nostrill/comms.hoon b/app/sur/nostrill/comms.hoon
index 42ea1ba..fa60989 100644
--- a/app/sur/nostrill/comms.hoon
+++ b/app/sur/nostrill/comms.hoon
@@ -3,12 +3,15 @@
+$ poke
$% [%req req]
[%res res]
+ [%eng engagement]
[%dbug *]
==
-+$ emgagement
- $% [%reply host=@p id=@da]
- [%del-reply host=@p id=@da]
- [%reaction host=@p id=@da reaction=@t]
++$ engagement
+ $% [%reply parent=@da child=post:post]
+ [%del-reply parent=@da child=@da]
+ [%quote src=@da =post:post]
+ [%rp src=@da rt=@da]
+ [%reaction post=@da reaction=@t]
==
+$ req
$% [%feed ~]