mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-19 21:02:01 +03:00
Merge branch 'release/bitcoin-wallet' of github.com:urbit/urbit into release/bitcoin-wallet
This commit is contained in:
commit
71c2cbaea6
@ -3,7 +3,7 @@
|
|||||||
:: Scrys
|
:: Scrys
|
||||||
:: 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, file-server, launch-store
|
/- *btc-wallet, bp=btc-provider, file-server, launch-store, settings
|
||||||
/+ dbug, default-agent, bl=btc, bc=bitcoin, bcu=bitcoin-utils, bip32
|
/+ dbug, default-agent, bl=btc, bc=bitcoin, bcu=bitcoin-utils, bip32
|
||||||
~% %btc-wallet-top ..part ~
|
~% %btc-wallet-top ..part ~
|
||||||
|%
|
|%
|
||||||
@ -69,21 +69,28 @@
|
|||||||
++ on-init
|
++ on-init
|
||||||
^- (quip card _this)
|
^- (quip card _this)
|
||||||
~& > '%btc-wallet initialized'
|
~& > '%btc-wallet initialized'
|
||||||
=/ file
|
::
|
||||||
[%file-server-action !>([%serve-dir /'~btc' /app/btc-wallet %.n %.y])]
|
=/ warning=event:settings [%put-entry %btc-wallet %warning %b %.y]
|
||||||
=/ tile
|
=/ currency=event:settings [%put-entry %btc-wallet %currency %s 'USD']
|
||||||
:- %launch-action
|
=/ cards=(list card)
|
||||||
!> :+ %add
|
:~ (poke-our:hc %settings-store %settings-event !>(warning))
|
||||||
%btc-wallet
|
(poke-our:hc %settings-store %settings-event !>(currency))
|
||||||
[[%custom `'/~btc' `'/~btc/img/tile.svg'] %.y]
|
==
|
||||||
=/ warning [%settings-event !>([%put-entry %btc-wallet %warning %b %.y])]
|
::
|
||||||
=/ currency
|
=/ has-file=? (gall-scry:hc ? %file-server /url/'~btc'/noun)
|
||||||
[%settings-event !>([%put-entry %btc-wallet %currency %s 'USD'])]
|
=/ has-tile=?
|
||||||
:- :~ [%pass /btc-wallet-server %agent [our.bowl %file-server] %poke file]
|
(~(has in (gall-scry:hc (set @tas) %launch /keys/noun)) %btc-wallet)
|
||||||
[%pass /btc-wallet-tile %agent [our.bowl %launch] %poke tile]
|
=? cards !has-file
|
||||||
[%pass /warn %agent [our.bowl %settings-store] %poke warning]
|
=/ file=action:file-server [%serve-dir /'~btc' /app/btc-wallet %.n %.y]
|
||||||
[%pass /warn %agent [our.bowl %settings-store] %poke currency]
|
:_ cards
|
||||||
==
|
(poke-our:hc %file-server %file-server-action !>(file))
|
||||||
|
=? cards !has-tile
|
||||||
|
=/ tile=action:launch-store
|
||||||
|
[%add %btc-wallet [%custom `'/~btc' `'/~btc/img/tile.svg'] %.y]
|
||||||
|
:_ cards
|
||||||
|
(poke-our:hc %launch %launch-action !>(tile))
|
||||||
|
::
|
||||||
|
:- cards
|
||||||
%_ this
|
%_ this
|
||||||
state
|
state
|
||||||
:* %1
|
:* %1
|
||||||
@ -203,7 +210,8 @@
|
|||||||
[(silt (gulf 0 endpoint)) endpoint %.n]
|
[(silt (gulf 0 endpoint)) endpoint %.n]
|
||||||
=^ cards0 state (req-scan:hc b xpub %0)
|
=^ cards0 state (req-scan:hc b xpub %0)
|
||||||
=^ cards1 state (req-scan:hc b xpub %1)
|
=^ cards1 state (req-scan:hc b xpub %1)
|
||||||
[(weld cards0 cards1) state]
|
:_ state
|
||||||
|
[(scan-progress:hc xpub) (weld cards0 cards1)]
|
||||||
--
|
--
|
||||||
::
|
::
|
||||||
%delete-wallet
|
%delete-wallet
|
||||||
@ -595,7 +603,7 @@
|
|||||||
(turn inputs.ti |=(i=val:tx [i `payer]))
|
(turn inputs.ti |=(i=val:tx [i `payer]))
|
||||||
%+ turn outputs.ti
|
%+ turn outputs.ti
|
||||||
|= o=val:tx
|
|= o=val:tx
|
||||||
?: =(pos.o vout)
|
?: =(pos.o vout)
|
||||||
:: check whether this is the output that went to payee
|
:: check whether this is the output that went to payee
|
||||||
[o payee]
|
[o payee]
|
||||||
[o `payer]
|
[o `payer]
|
||||||
@ -957,7 +965,8 @@
|
|||||||
(bump-batch xpub %0)
|
(bump-batch xpub %0)
|
||||||
=^ cards1=(list card) state
|
=^ cards1=(list card) state
|
||||||
(bump-batch xpub %1)
|
(bump-batch xpub %1)
|
||||||
[(weld cards0 cards1) state]
|
:_ state
|
||||||
|
[(scan-progress:hc xpub) (weld cards0 cards1)]
|
||||||
::
|
::
|
||||||
:: delete the xpub from scans and set wallet to scanned
|
:: delete the xpub from scans and set wallet to scanned
|
||||||
::
|
::
|
||||||
@ -970,7 +979,9 @@
|
|||||||
walts (~(put by walts) xpub w(scanned %.y))
|
walts (~(put by walts) xpub w(scanned %.y))
|
||||||
==
|
==
|
||||||
%- (slog ~[leaf+"Scanned xpub {<xpub>}"])
|
%- (slog ~[leaf+"Scanned xpub {<xpub>}"])
|
||||||
(set-curr-xpub:hc xpub)
|
=^ cards state
|
||||||
|
(set-curr-xpub:hc xpub)
|
||||||
|
[[(give-update:hc [%scan-progress ~ ~]) cards] state]
|
||||||
::
|
::
|
||||||
:: +bump-batch
|
:: +bump-batch
|
||||||
:: if the batch is done but the wallet isn't done scanning,
|
:: if the batch is done but the wallet isn't done scanning,
|
||||||
@ -1201,11 +1212,31 @@
|
|||||||
%btc-wallet-internal !>(intr)
|
%btc-wallet-internal !>(intr)
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
|
++ poke-our
|
||||||
|
|= [app=term =cage]
|
||||||
|
^- card
|
||||||
|
[%pass / %agent [our.bowl app] %poke cage]
|
||||||
|
::
|
||||||
++ give-update
|
++ give-update
|
||||||
|= upd=update
|
|= upd=update
|
||||||
^- card
|
^- card
|
||||||
[%give %fact ~[/all] %btc-wallet-update !>(upd)]
|
[%give %fact ~[/all] %btc-wallet-update !>(upd)]
|
||||||
::
|
::
|
||||||
|
++ scan-progress
|
||||||
|
|= [=xpub:bc]
|
||||||
|
|^ ^- card
|
||||||
|
%- give-update
|
||||||
|
:+ %scan-progress
|
||||||
|
(to-idx (~(gut by scans.state) [xpub %0] *batch))
|
||||||
|
(to-idx (~(gut by scans.state) [xpub %1] *batch))
|
||||||
|
++ to-idx
|
||||||
|
|= b=batch
|
||||||
|
^- (unit idx:bc)
|
||||||
|
=/ s=(list idx:bc)
|
||||||
|
(sort ~(tap in todo.b) lth)
|
||||||
|
?~ s ~ `i.s
|
||||||
|
--
|
||||||
|
::
|
||||||
++ watch-provider
|
++ watch-provider
|
||||||
|= who=@p
|
|= who=@p
|
||||||
^- card
|
^- card
|
||||||
@ -1287,4 +1318,8 @@
|
|||||||
|= [=xpub:bc w=walt]
|
|= [=xpub:bc w=walt]
|
||||||
^- (unit xpub:bc)
|
^- (unit xpub:bc)
|
||||||
?:(scanned.w `xpub ~)
|
?:(scanned.w `xpub ~)
|
||||||
|
::
|
||||||
|
++ gall-scry
|
||||||
|
|* [=mold app=@tas =path]
|
||||||
|
.^(mold %gx (weld /(scot %p our.bowl)/[app]/(scot %da now.bowl) path))
|
||||||
--
|
--
|
||||||
|
@ -352,6 +352,10 @@
|
|||||||
[%x %clay %base %hash ~]
|
[%x %clay %base %hash ~]
|
||||||
=/ versions (base-hash:version [our now]:bowl)
|
=/ versions (base-hash:version [our now]:bowl)
|
||||||
``hash+!>(?~(versions 0v0 (end [0 25] i.versions)))
|
``hash+!>(?~(versions 0v0 (end [0 25] i.versions)))
|
||||||
|
::
|
||||||
|
[%x %url *]
|
||||||
|
=/ url t.t.path
|
||||||
|
``noun+!>((~(has by serving) url))
|
||||||
==
|
==
|
||||||
++ on-agent on-agent:def
|
++ on-agent on-agent:def
|
||||||
++ on-fail on-fail:def
|
++ on-fail on-fail:def
|
||||||
|
@ -110,6 +110,7 @@
|
|||||||
%cancel-tx (hexb txid.upd)
|
%cancel-tx (hexb txid.upd)
|
||||||
%new-address (address address.upd)
|
%new-address (address address.upd)
|
||||||
%balance (balance balance.upd)
|
%balance (balance balance.upd)
|
||||||
|
%scan-progress (scan-progress main.upd change.upd)
|
||||||
%error s+error.upd
|
%error s+error.upd
|
||||||
%broadcast-success ~
|
%broadcast-success ~
|
||||||
==
|
==
|
||||||
@ -161,6 +162,19 @@
|
|||||||
unconfirmed+(numb q.u.b)
|
unconfirmed+(numb q.u.b)
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
|
++ scan-progress
|
||||||
|
|= [main=(unit idx:bitcoin) change=(unit idx:bitcoin)]
|
||||||
|
|^ ^- json
|
||||||
|
%- pairs
|
||||||
|
:~ main+(from-unit main)
|
||||||
|
change+(from-unit change)
|
||||||
|
==
|
||||||
|
++ from-unit
|
||||||
|
|= i=(unit idx:bitcoin)
|
||||||
|
?~ i ~
|
||||||
|
(numb u.i)
|
||||||
|
--
|
||||||
|
::
|
||||||
++ btc-state
|
++ btc-state
|
||||||
|= bs=btc-state:btc-wallet
|
|= bs=btc-state:btc-wallet
|
||||||
^- json
|
^- json
|
||||||
|
@ -162,6 +162,10 @@
|
|||||||
[%new-address =address]
|
[%new-address =address]
|
||||||
[%balance balance=(unit [confirmed=sats unconfirmed=sats])]
|
[%balance balance=(unit [confirmed=sats unconfirmed=sats])]
|
||||||
[%error =error]
|
[%error =error]
|
||||||
|
:: current index being scanned in each wallet part
|
||||||
|
:: ~ if scan of that part is done
|
||||||
|
::
|
||||||
|
[%scan-progress main=(unit idx) change=(unit idx)]
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
--
|
--
|
||||||
|
Loading…
Reference in New Issue
Block a user