mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-01 11:33:41 +03:00
btc: add balance events on handle-address-info
This commit is contained in:
parent
84ccb732e6
commit
4a0caa9fc3
@ -957,6 +957,7 @@
|
||||
[cad ah]
|
||||
:- [(poke-provider [%tx-info txid.u]) cad]
|
||||
(~(put by ah) txid.u)
|
||||
=. cards (snoc cards (give-update %balance current-balance))
|
||||
:: if the wallet+chyg is being scanned, update the scan batch
|
||||
::
|
||||
=/ b (~(get by scans) [xpub.w chyg])
|
||||
|
@ -107,6 +107,7 @@
|
||||
%new-tx (hest hest.upd)
|
||||
%cancel-tx (hexb txid.upd)
|
||||
%new-address (address address.upd)
|
||||
%balance (balance balance.upd)
|
||||
==
|
||||
::
|
||||
++ initial
|
||||
|
@ -118,7 +118,7 @@
|
||||
$% $: %initial
|
||||
provider=(unit provider)
|
||||
wallet=(unit xpub)
|
||||
balance=(unit [p=sats q=sats])
|
||||
balance=(unit [confirmed=sats unconfirmed=sats])
|
||||
=history
|
||||
=btc-state
|
||||
address=(unit address)
|
||||
@ -130,6 +130,7 @@
|
||||
[%new-tx =hest]
|
||||
[%cancel-tx =txid]
|
||||
[%new-address =address]
|
||||
[%balance balance=(unit [confirmed=sats unconfirmed=sats])]
|
||||
==
|
||||
::
|
||||
+$ condition
|
||||
|
@ -33,6 +33,9 @@ export class UpdateReducer {
|
||||
if (json.address) {
|
||||
this.reduceAddress(json.address, state);
|
||||
}
|
||||
if (json.balance) {
|
||||
this.reduceBalance(json.balance, state);
|
||||
}
|
||||
}
|
||||
|
||||
reduceProviderStatus(json, state) {
|
||||
@ -91,4 +94,9 @@ export class UpdateReducer {
|
||||
reduceAddress(json, state) {
|
||||
state.address = json;
|
||||
}
|
||||
|
||||
reduceBalance(json, state) {
|
||||
state.unconfirmedBalance = json.unconfirmed;
|
||||
state.confirmedBalance = json.confirmed;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user