2020-10-24 19:13:36 +03:00
|
|
|
:: btc-wallet-store.hoon
|
2020-10-19 12:04:51 +03:00
|
|
|
:: Manages wallet pubkeys
|
|
|
|
::
|
2020-10-28 16:20:24 +03:00
|
|
|
:: Subscriptions: none
|
|
|
|
:: To Subscribers:
|
|
|
|
:: watched address updates
|
|
|
|
::
|
2020-10-29 15:10:54 +03:00
|
|
|
/- *btc-wallet-store
|
2020-10-30 14:45:38 +03:00
|
|
|
/+ dbug, default-agent, *btc-wallet-store, btc, bip32
|
2020-10-19 12:04:51 +03:00
|
|
|
|%
|
|
|
|
+$ versioned-state
|
|
|
|
$% state-0
|
|
|
|
==
|
|
|
|
::
|
2020-10-30 12:06:42 +03:00
|
|
|
+$ state-0
|
|
|
|
$: %0
|
2020-10-31 12:41:00 +03:00
|
|
|
walts=(map xpub:btc walt)
|
2020-10-30 12:06:42 +03:00
|
|
|
max-gap=@
|
|
|
|
==
|
2020-10-19 12:04:51 +03:00
|
|
|
::
|
2020-10-24 19:13:36 +03:00
|
|
|
+$ card card:agent:gall
|
2020-10-19 12:04:51 +03:00
|
|
|
::
|
|
|
|
--
|
|
|
|
=| state-0
|
|
|
|
=* state -
|
|
|
|
%- agent:dbug
|
|
|
|
^- agent:gall
|
2020-10-29 15:10:54 +03:00
|
|
|
=<
|
2020-10-19 12:04:51 +03:00
|
|
|
|_ =bowl:gall
|
|
|
|
+* this .
|
|
|
|
def ~(. (default-agent this %|) bowl)
|
2020-10-29 15:10:54 +03:00
|
|
|
hc ~(. +> bowl)
|
2020-10-19 12:04:51 +03:00
|
|
|
::
|
|
|
|
++ on-init
|
|
|
|
^- (quip card _this)
|
2020-10-24 19:13:36 +03:00
|
|
|
~& > '%btc-wallet-store initialized'
|
2020-10-30 12:06:42 +03:00
|
|
|
`this(state [%0 *(map tape walt) max-gap=20])
|
2020-10-19 12:04:51 +03:00
|
|
|
++ on-save
|
|
|
|
^- vase
|
|
|
|
!>(state)
|
|
|
|
++ on-load
|
|
|
|
|= old-state=vase
|
|
|
|
^- (quip card _this)
|
2020-10-24 19:13:36 +03:00
|
|
|
~& > '%btc-wallet-store recompiled'
|
2020-10-19 12:04:51 +03:00
|
|
|
`this(state !<(versioned-state old-state))
|
|
|
|
++ on-poke
|
|
|
|
|= [=mark =vase]
|
|
|
|
^- (quip card _this)
|
2020-10-29 15:10:54 +03:00
|
|
|
?> (team:title our.bowl src.bowl)
|
|
|
|
=^ cards state
|
|
|
|
?+ mark (on-poke:def mark vase)
|
|
|
|
%btc-wallet-store-action
|
|
|
|
(handle-action:hc !<(action vase))
|
|
|
|
==
|
|
|
|
[cards this]
|
2020-10-19 12:04:51 +03:00
|
|
|
::
|
2020-10-29 21:07:43 +03:00
|
|
|
++ on-watch
|
|
|
|
|= pax=path
|
|
|
|
^- (quip card _this)
|
|
|
|
?> (team:title our.bowl src.bowl)
|
|
|
|
?> ?=([%wallets *] pax)
|
|
|
|
`this
|
2020-10-19 12:04:51 +03:00
|
|
|
++ on-leave on-leave:def
|
|
|
|
++ on-peek on-peek:def
|
|
|
|
++ on-agent on-agent:def
|
|
|
|
++ on-arvo on-arvo:def
|
|
|
|
++ on-fail on-fail:def
|
|
|
|
--
|
2020-10-29 15:10:54 +03:00
|
|
|
::
|
|
|
|
|_ =bowl:gall
|
|
|
|
++ handle-action
|
|
|
|
|= act=action
|
|
|
|
^- (quip card _state)
|
|
|
|
?- -.act
|
|
|
|
%add-wallet
|
2020-10-30 14:45:38 +03:00
|
|
|
`state
|
|
|
|
:: (add-wallet +.act)
|
2020-10-29 21:07:43 +03:00
|
|
|
::
|
|
|
|
%update-address
|
2020-10-29 15:10:54 +03:00
|
|
|
`state
|
2020-10-30 14:45:38 +03:00
|
|
|
:: (update-address +.act)
|
|
|
|
==
|
2020-10-29 15:10:54 +03:00
|
|
|
--
|