From f5960c656c9b9eb8c1120a1b540aa1b0913efd53 Mon Sep 17 00:00:00 2001 From: timlucmiptev Date: Tue, 24 Nov 2020 21:30:41 +0200 Subject: [PATCH] add marks --- WALLET.scratch.md | 31 ++++++++++++------------------- app/btc-wallet-hook.hoon | 2 +- install.sh | 2 +- lib/btc-wallet-store.hoon | 14 +++++++++++++- mar/btc-provider/action.hoon | 12 ++++++++++++ mar/btc-provider/status.hoon | 12 ++++++++++++ mar/btc-provider/update.hoon | 12 ++++++++++++ mar/btc-wallet/hook-action.hoon | 12 ++++++++++++ sur/btc-provider.hoon | 1 + 9 files changed, 76 insertions(+), 22 deletions(-) create mode 100644 mar/btc-provider/action.hoon create mode 100644 mar/btc-provider/status.hoon create mode 100644 mar/btc-provider/update.hoon create mode 100644 mar/btc-wallet/hook-action.hoon diff --git a/WALLET.scratch.md b/WALLET.scratch.md index 5ba054e26..ab3d13d37 100644 --- a/WALLET.scratch.md +++ b/WALLET.scratch.md @@ -99,6 +99,18 @@ Above tests w 2 outputs, total fees with 2 inputs of 27.500. Gives: 1. 500.000 input 2. Inputs 0 and 3 +## Make a full TXBU +Provider is `~zod`, `~dopzod` is a client. +On `~zod`: +``` +:btc-provider|command [%set-credentials api-url='http://localhost:50002'] +:btc-provider|command [%whitelist-clients `(set ship)`(sy ~[~dopzod])] +``` + +on `~dopzod`: +``` +:btc-wallet-hook|action [%set-provider ~zod] +``` ## scrys ``` @@ -107,22 +119,3 @@ Above tests w 2 outputs, total fees with 2 inputs of 27.500. Gives: .^(@ud %gx /=btc-wallet-store=/balance/[xpub]/noun) ``` -## Algos - -### Monitor addresses -- nixt also stores next 50 addresses for each account. -- every update-address call also checks those - -### make a payment -* make payment - - get address - - on-agent gets return value, construct tx - - store tx (view or other command can get it) - -:: -++ send-address-update - |= [xpub=tape =walt a=address:btc us=(set utxo)] - ^- (quip card _state) - :_ state(walts (~(put by walts.state) xpub walt)) - ~[[%give %fact ~[/wallets] %btc-wallet-store-update !>([%address a us])]] -:: diff --git a/app/btc-wallet-hook.hoon b/app/btc-wallet-hook.hoon index 744b18be8..ea48394b5 100644 --- a/app/btc-wallet-hook.hoon +++ b/app/btc-wallet-hook.hoon @@ -114,7 +114,7 @@ == [cards this] == -++ on-arvo on-arvo:def +++ on-arvo on-arvo:def ++ on-fail on-fail:def -- |_ =bowl:gall diff --git a/install.sh b/install.sh index 973a4dcff..3231ddc1b 100755 --- a/install.sh +++ b/install.sh @@ -19,7 +19,7 @@ while getopts "w" opt; do done if [ -z "$WATCH_MODE" ]; then - echo "Installed %bippy" + echo "Installed btc-agents" rsync -r --exclude-from=$EXCLUDE_FILE * $PIER/ else echo "Watching for changes to copy to ${PIER}..." diff --git a/lib/btc-wallet-store.hoon b/lib/btc-wallet-store.hoon index a2ec92b88..0b9ed37f0 100644 --- a/lib/btc-wallet-store.hoon +++ b/lib/btc-wallet-store.hoon @@ -12,7 +12,19 @@ ++ txbu |= =^txbu ^- json - [%s 'txbu placeholder'] + %- pairs + :~ [%inputs ~] + ['associatedKeysets' s+'hi'] + ['changePath' s+'hi'] + ['outputScriptHex' s+'hi'] + ['lockTime' s+'hi'] + ['sigHashType' s+'hi'] + [%segwit s+'hi'] + ['initialTimestamp' s+'hi'] + == + :: TODO inputs, keysets, changeppath, outputscripthex, locktime, sigHashType, segwit, initialTimestamp + :: , additionals ("bech32") + :: TODO: use 'pairs' at the top level -- :: ++ defaults diff --git a/mar/btc-provider/action.hoon b/mar/btc-provider/action.hoon new file mode 100644 index 000000000..52a0e1cbe --- /dev/null +++ b/mar/btc-provider/action.hoon @@ -0,0 +1,12 @@ +/- *btc-provider +|_ act=action +++ grad %noun +++ grow + |% + ++ noun act + -- +++ grab + |% + ++ noun action + -- +-- diff --git a/mar/btc-provider/status.hoon b/mar/btc-provider/status.hoon new file mode 100644 index 000000000..2fd76eda0 --- /dev/null +++ b/mar/btc-provider/status.hoon @@ -0,0 +1,12 @@ +/- *btc-provider +|_ sta=status +++ grad %noun +++ grow + |% + ++ noun sta + -- +++ grab + |% + ++ noun status + -- +-- diff --git a/mar/btc-provider/update.hoon b/mar/btc-provider/update.hoon new file mode 100644 index 000000000..fae20d82b --- /dev/null +++ b/mar/btc-provider/update.hoon @@ -0,0 +1,12 @@ +/- *btc-provider +|_ upd=update +++ grad %noun +++ grow + |% + ++ noun upd + -- +++ grab +|% + ++ noun update + -- +-- diff --git a/mar/btc-wallet/hook-action.hoon b/mar/btc-wallet/hook-action.hoon new file mode 100644 index 000000000..69eaeb6c0 --- /dev/null +++ b/mar/btc-wallet/hook-action.hoon @@ -0,0 +1,12 @@ +/- *btc-wallet-hook +|_ act=action +++ grad %noun +++ grow + |% + ++ noun act + -- +++ grab + |% + ++ noun action + -- +-- diff --git a/sur/btc-provider.hoon b/sur/btc-provider.hoon index 2b963f2bb..de391c11c 100644 --- a/sur/btc-provider.hoon +++ b/sur/btc-provider.hoon @@ -44,6 +44,7 @@ [%get-raw-tx =txid =rawtx] [%get-block-count blockcount=@ud] [%get-block-and-fee blockcount=@ud fee=sats] + == -- --