From 98f5701ccc075d0aab80c51d2ae98b2ce3de9bda Mon Sep 17 00:00:00 2001 From: timlucmiptev Date: Wed, 11 Nov 2020 10:17:54 +0200 Subject: [PATCH] generate address action --- app/btc-wallet-store.hoon | 15 +++++++++++---- sur/btc-wallet-store.hoon | 5 +++++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/btc-wallet-store.hoon b/app/btc-wallet-store.hoon index 7d01850a1c..0099b08f76 100644 --- a/app/btc-wallet-store.hoon +++ b/app/btc-wallet-store.hoon @@ -85,17 +85,24 @@ %add-wallet =/ w=_walt (from-xpub:walt +.act) =. walts (~(put by walts) xpub.act w) - =^ cards state - (init-batches xpub.act (dec max-gap.st.w)) - [cards state] + (init-batches xpub.act (dec max-gap.st.w)) :: %watch-address (watch-address +.act) :: %update-address `state + :: + %generate-address + =/ uw=(unit _walt) (~(get by walts) xpub.act) + ?~ uw + ~|("btc-wallet-store, %generate-address: non-existent wallet" !!) + =/ [a=address:btc w=_walt] + ~(gen-address u.uw chyg.act) + :_ state(walts (~(put by walts) xpub.act w)) + ~[[%give %fact ~[/updates] %btc-wallet-store-update !>([%generate-address a])]] == -:: Wallet-scan algorithm: +:: wallet scan algorithm: :: Initiate a batch for each chyg, with max-gap idxs in it :: Send that to /requests subscribers to call out to providers and get the info :: Whenever a %watch-address result comes back diff --git a/sur/btc-wallet-store.hoon b/sur/btc-wallet-store.hoon index 804f08ef9f..ee47b140ca 100644 --- a/sur/btc-wallet-store.hoon +++ b/sur/btc-wallet-store.hoon @@ -42,6 +42,11 @@ $% [%add-wallet =xpub scan-to=(unit scon) max-gap=(unit @)] [%watch-address =xpub =chyg =idx utxos=(set utxo) used=?] [%update-address a=address utxos=(set utxo)] + [%generate-address =xpub =chyg] + == +:: ++$ update + $% [%generate-address =address] == :: +$ req-method