mirror of
https://github.com/urbit/shrub.git
synced 2024-12-21 18:01:32 +03:00
bitcoin: revive settings-store migration
This commit is contained in:
parent
22eae5ea06
commit
794d3fe570
@ -4,7 +4,7 @@
|
|||||||
:: x/scanned: (list xpub) of all scanned wallets
|
:: x/scanned: (list xpub) of all scanned wallets
|
||||||
:: x/balance/xpub: balance (in sats) of wallet
|
:: x/balance/xpub: balance (in sats) of wallet
|
||||||
/- *btc-wallet, bp=btc-provider, settings
|
/- *btc-wallet, bp=btc-provider, settings
|
||||||
/+ dbug, default-agent, bl=btc, bc=bitcoin, bcu=bitcoin-utils, bip32
|
/+ dbug, default-agent, bl=btc, bc=bitcoin, bcu=bitcoin-utils, bip32, agentio
|
||||||
~% %btc-wallet-top ..part ~
|
~% %btc-wallet-top ..part ~
|
||||||
|%
|
|%
|
||||||
+$ card card:agent:gall
|
+$ card card:agent:gall
|
||||||
@ -24,6 +24,7 @@
|
|||||||
$% state-0
|
$% state-0
|
||||||
state-1
|
state-1
|
||||||
state-2
|
state-2
|
||||||
|
state-3
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
+$ state-0
|
+$ state-0
|
||||||
@ -57,8 +58,9 @@
|
|||||||
::
|
::
|
||||||
+$ state-1 [%1 base-state]
|
+$ state-1 [%1 base-state]
|
||||||
+$ state-2 [%2 base-state]
|
+$ state-2 [%2 base-state]
|
||||||
|
+$ state-3 [%3 base-state]
|
||||||
--
|
--
|
||||||
=| state-2
|
=| state-3
|
||||||
=* state -
|
=* state -
|
||||||
%- agent:dbug
|
%- agent:dbug
|
||||||
^- agent:gall
|
^- agent:gall
|
||||||
@ -68,6 +70,8 @@
|
|||||||
+* this .
|
+* this .
|
||||||
def ~(. (default-agent this %|) bowl)
|
def ~(. (default-agent this %|) bowl)
|
||||||
hc ~(. +> bowl)
|
hc ~(. +> bowl)
|
||||||
|
io ~(. agentio bowl)
|
||||||
|
pass pass:io
|
||||||
::
|
::
|
||||||
++ on-init
|
++ on-init
|
||||||
^- (quip card _this)
|
^- (quip card _this)
|
||||||
@ -83,7 +87,7 @@
|
|||||||
:- cards
|
:- cards
|
||||||
%_ this
|
%_ this
|
||||||
state
|
state
|
||||||
:* %2
|
:* %3
|
||||||
~
|
~
|
||||||
*(map xpub:bc walt)
|
*(map xpub:bc walt)
|
||||||
*^btc-state
|
*^btc-state
|
||||||
@ -110,8 +114,14 @@
|
|||||||
=| cards=(list card)
|
=| cards=(list card)
|
||||||
|-
|
|-
|
||||||
?- -.ver
|
?- -.ver
|
||||||
|
%3
|
||||||
|
[(flop cards) this(state ver)]
|
||||||
|
::
|
||||||
%2
|
%2
|
||||||
[cards this(state ver)]
|
%_ $
|
||||||
|
-.ver %3
|
||||||
|
cards :_(cards (~(wait pass /migrate-settings) (add now.bowl ~s1)))
|
||||||
|
==
|
||||||
::
|
::
|
||||||
%1
|
%1
|
||||||
=? cards ?=(^ prov.ver)
|
=? cards ?=(^ prov.ver)
|
||||||
@ -138,6 +148,11 @@
|
|||||||
|^
|
|^
|
||||||
=^ cards state
|
=^ cards state
|
||||||
?+ mark (on-poke:def mark vase)
|
?+ mark (on-poke:def mark vase)
|
||||||
|
::
|
||||||
|
%noun
|
||||||
|
?> =(our.bowl src.bowl)
|
||||||
|
(handle-noun q.vase)
|
||||||
|
::
|
||||||
%btc-wallet-command
|
%btc-wallet-command
|
||||||
?> =(our.bowl src.bowl)
|
?> =(our.bowl src.bowl)
|
||||||
(handle-command !<(command vase))
|
(handle-command !<(command vase))
|
||||||
@ -152,6 +167,37 @@
|
|||||||
==
|
==
|
||||||
[cards this]
|
[cards this]
|
||||||
::
|
::
|
||||||
|
++ handle-noun
|
||||||
|
|= non=*
|
||||||
|
?> ?=(%migrate-settings non)
|
||||||
|
:_ state
|
||||||
|
^- (list card)
|
||||||
|
=/ bas=path /(scot %p our.bowl)/settings-store/(scot %da now.bowl)
|
||||||
|
?. .^(? %gu bas)
|
||||||
|
~& [dap.bowl %settings-store-mia]
|
||||||
|
~
|
||||||
|
?. .^(? %gx (weld bas /has-bucket/landscape/btc-wallet/noun))
|
||||||
|
~
|
||||||
|
=/ dat
|
||||||
|
.^(data:settings %gx (weld bas /bucket/landscape/btc-wallet/noun))
|
||||||
|
?> ?=(%bucket -.dat)
|
||||||
|
|^ :- =/ del=event:settings [%del-bucket %landscape %btc-wallet]
|
||||||
|
(poke-our:hc %settings-store %settings-event !>(del))
|
||||||
|
%- zing
|
||||||
|
%+ turn ~(tap by bucket.dat)
|
||||||
|
(cork copy-if-missing drop)
|
||||||
|
::
|
||||||
|
++ copy-if-missing
|
||||||
|
|= [=key:settings =val:settings]
|
||||||
|
^- (unit card)
|
||||||
|
=/ hav=?
|
||||||
|
.^(? %gx (weld bas /has-entry/[q.byk.bowl]/btc-wallet/[key]/noun))
|
||||||
|
?: hav ~
|
||||||
|
~& [dap.bowl %importing-previous-setting key]
|
||||||
|
=/ put=event:settings [%put-entry q.byk.bowl %btc-wallet key val]
|
||||||
|
`(poke-our:hc %settings-store %settings-event !>(put))
|
||||||
|
--
|
||||||
|
::
|
||||||
++ handle-command
|
++ handle-command
|
||||||
|= comm=command
|
|= comm=command
|
||||||
^- (quip card _state)
|
^- (quip card _state)
|
||||||
@ -864,7 +910,7 @@
|
|||||||
::
|
::
|
||||||
%tx-info
|
%tx-info
|
||||||
:: TODO: why do we get a nest-fail when using =^ ?
|
:: TODO: why do we get a nest-fail when using =^ ?
|
||||||
=/ [cards=(list card) sty=state-2]
|
=/ [cards=(list card) sty=state-3]
|
||||||
(handle-tx-info:hc info.p.upd)
|
(handle-tx-info:hc info.p.upd)
|
||||||
:_ sty
|
:_ sty
|
||||||
:_ cards
|
:_ cards
|
||||||
@ -1056,7 +1102,12 @@
|
|||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ on-leave on-leave:def
|
++ on-leave on-leave:def
|
||||||
++ on-arvo on-arvo:def
|
++ on-arvo
|
||||||
|
|= [=wire sign=sign-arvo]
|
||||||
|
^- (quip card _this)
|
||||||
|
?. ?=([%migrate-settings ~] wire) (on-arvo:def wire sign)
|
||||||
|
?> ?=([%behn *] sign)
|
||||||
|
(on-poke %noun !>(%migrate-settings))
|
||||||
++ on-fail on-fail:def
|
++ on-fail on-fail:def
|
||||||
--
|
--
|
||||||
~% %btc-wallet-helper ..card ~
|
~% %btc-wallet-helper ..card ~
|
||||||
|
Loading…
Reference in New Issue
Block a user