mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 09:47:37 +00:00
add height change notify
This commit is contained in:
parent
6e54ddec86
commit
a41f80ac55
8 changed files with 64 additions and 0 deletions
|
@ -251,6 +251,14 @@ class BitcoinWallet extends CoinServiceAPI
|
|||
final result = await _electrumXClient.getBlockHeadTip();
|
||||
final height = result["height"] as int;
|
||||
await updateCachedChainHeight(height);
|
||||
if (height > storedChainHeight) {
|
||||
GlobalEventBus.instance.fire(
|
||||
UpdatedInBackgroundEvent(
|
||||
"Updated current chain height in $walletId $walletName!",
|
||||
walletId,
|
||||
),
|
||||
);
|
||||
}
|
||||
return height;
|
||||
} catch (e, s) {
|
||||
Logging.instance.log("Exception caught in chainHeight: $e\n$s",
|
||||
|
|
|
@ -217,6 +217,14 @@ class BitcoinCashWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
|||
final result = await _electrumXClient.getBlockHeadTip();
|
||||
final height = result["height"] as int;
|
||||
await updateCachedChainHeight(height);
|
||||
if (height > storedChainHeight) {
|
||||
GlobalEventBus.instance.fire(
|
||||
UpdatedInBackgroundEvent(
|
||||
"Updated current chain height in $walletId $walletName!",
|
||||
walletId,
|
||||
),
|
||||
);
|
||||
}
|
||||
return height;
|
||||
} catch (e, s) {
|
||||
Logging.instance.log("Exception caught in chainHeight: $e\n$s",
|
||||
|
|
|
@ -226,6 +226,14 @@ class DogecoinWallet extends CoinServiceAPI
|
|||
final result = await _electrumXClient.getBlockHeadTip();
|
||||
final height = result["height"] as int;
|
||||
await updateCachedChainHeight(height);
|
||||
if (height > storedChainHeight) {
|
||||
GlobalEventBus.instance.fire(
|
||||
UpdatedInBackgroundEvent(
|
||||
"Updated current chain height in $walletId $walletName!",
|
||||
walletId,
|
||||
),
|
||||
);
|
||||
}
|
||||
return height;
|
||||
} catch (e, s) {
|
||||
Logging.instance.log("Exception caught in chainHeight: $e\n$s",
|
||||
|
|
|
@ -1416,6 +1416,14 @@ class EpicCashWallet extends CoinServiceAPI
|
|||
});
|
||||
|
||||
await updateCachedChainHeight(latestHeight!);
|
||||
if (latestHeight! > storedChainHeight) {
|
||||
GlobalEventBus.instance.fire(
|
||||
UpdatedInBackgroundEvent(
|
||||
"Updated current chain height in $walletId $walletName!",
|
||||
walletId,
|
||||
),
|
||||
);
|
||||
}
|
||||
return latestHeight!;
|
||||
} catch (e, s) {
|
||||
Logging.instance.log("Exception caught in chainHeight: $e\n$s",
|
||||
|
|
|
@ -4897,6 +4897,14 @@ class FiroWallet extends CoinServiceAPI with WalletCache, WalletDB, FiroHive {
|
|||
final result = await _electrumXClient.getBlockHeadTip();
|
||||
final height = result["height"] as int;
|
||||
await updateCachedChainHeight(height);
|
||||
if (height > storedChainHeight) {
|
||||
GlobalEventBus.instance.fire(
|
||||
UpdatedInBackgroundEvent(
|
||||
"Updated current chain height in $walletId $walletName!",
|
||||
walletId,
|
||||
),
|
||||
);
|
||||
}
|
||||
return height;
|
||||
} catch (e, s) {
|
||||
Logging.instance.log("Exception caught in chainHeight: $e\n$s",
|
||||
|
|
|
@ -241,6 +241,14 @@ class LitecoinWallet extends CoinServiceAPI
|
|||
final result = await _electrumXClient.getBlockHeadTip();
|
||||
final height = result["height"] as int;
|
||||
await updateCachedChainHeight(height);
|
||||
if (height > storedChainHeight) {
|
||||
GlobalEventBus.instance.fire(
|
||||
UpdatedInBackgroundEvent(
|
||||
"Updated current chain height in $walletId $walletName!",
|
||||
walletId,
|
||||
),
|
||||
);
|
||||
}
|
||||
return height;
|
||||
} catch (e, s) {
|
||||
Logging.instance.log("Exception caught in chainHeight: $e\n$s",
|
||||
|
|
|
@ -236,6 +236,14 @@ class NamecoinWallet extends CoinServiceAPI
|
|||
final result = await _electrumXClient.getBlockHeadTip();
|
||||
final height = result["height"] as int;
|
||||
await updateCachedChainHeight(height);
|
||||
if (height > storedChainHeight) {
|
||||
GlobalEventBus.instance.fire(
|
||||
UpdatedInBackgroundEvent(
|
||||
"Updated current chain height in $walletId $walletName!",
|
||||
walletId,
|
||||
),
|
||||
);
|
||||
}
|
||||
return height;
|
||||
} catch (e, s) {
|
||||
Logging.instance.log("Exception caught in chainHeight: $e\n$s",
|
||||
|
|
|
@ -231,6 +231,14 @@ class ParticlWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
|||
final result = await _electrumXClient.getBlockHeadTip();
|
||||
final height = result["height"] as int;
|
||||
await updateCachedChainHeight(height);
|
||||
if (height > storedChainHeight) {
|
||||
GlobalEventBus.instance.fire(
|
||||
UpdatedInBackgroundEvent(
|
||||
"Updated current chain height in $walletId $walletName!",
|
||||
walletId,
|
||||
),
|
||||
);
|
||||
}
|
||||
return height;
|
||||
} catch (e, s) {
|
||||
Logging.instance.log("Exception caught in chainHeight: $e\n$s",
|
||||
|
|
Loading…
Reference in a new issue