mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-21 22:58:49 +00:00
add currentHeight getter
This commit is contained in:
parent
ce05a647f0
commit
8ee9428758
6 changed files with 30 additions and 7 deletions
|
@ -253,7 +253,8 @@ class BitcoinCashWallet extends CoinServiceAPI {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<int> get storedChainHeight async {
|
@override
|
||||||
|
int get storedChainHeight {
|
||||||
final storedHeight = DB.instance
|
final storedHeight = DB.instance
|
||||||
.get<dynamic>(boxName: walletId, key: "storedChainHeight") as int?;
|
.get<dynamic>(boxName: walletId, key: "storedChainHeight") as int?;
|
||||||
return storedHeight ?? 0;
|
return storedHeight ?? 0;
|
||||||
|
@ -1174,7 +1175,8 @@ class BitcoinCashWallet extends CoinServiceAPI {
|
||||||
final priceData =
|
final priceData =
|
||||||
await _priceAPI.getPricesAnd24hChange(baseCurrency: _prefs.currency);
|
await _priceAPI.getPricesAnd24hChange(baseCurrency: _prefs.currency);
|
||||||
Decimal currentPrice = priceData[coin]?.item1 ?? Decimal.zero;
|
Decimal currentPrice = priceData[coin]?.item1 ?? Decimal.zero;
|
||||||
final locale = Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
|
final locale =
|
||||||
|
Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
|
||||||
final String worthNow = Format.localizedStringAsFixed(
|
final String worthNow = Format.localizedStringAsFixed(
|
||||||
value:
|
value:
|
||||||
((currentPrice * Decimal.fromInt(txData["recipientAmt"] as int)) /
|
((currentPrice * Decimal.fromInt(txData["recipientAmt"] as int)) /
|
||||||
|
|
|
@ -307,4 +307,6 @@ abstract class CoinServiceAPI {
|
||||||
|
|
||||||
// used for electrumx coins
|
// used for electrumx coins
|
||||||
Future<void> updateSentCachedTxData(Map<String, dynamic> txData);
|
Future<void> updateSentCachedTxData(Map<String, dynamic> txData);
|
||||||
|
|
||||||
|
int get storedChainHeight;
|
||||||
}
|
}
|
||||||
|
|
|
@ -883,7 +883,8 @@ class FiroWallet extends CoinServiceAPI {
|
||||||
@override
|
@override
|
||||||
Future<void> updateSentCachedTxData(Map<String, dynamic> txData) async {
|
Future<void> updateSentCachedTxData(Map<String, dynamic> txData) async {
|
||||||
final currentPrice = await firoPrice;
|
final currentPrice = await firoPrice;
|
||||||
final locale = Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
|
final locale =
|
||||||
|
Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
|
||||||
final String worthNow = Format.localizedStringAsFixed(
|
final String worthNow = Format.localizedStringAsFixed(
|
||||||
value:
|
value:
|
||||||
((currentPrice * Decimal.fromInt(txData["recipientAmt"] as int)) /
|
((currentPrice * Decimal.fromInt(txData["recipientAmt"] as int)) /
|
||||||
|
@ -2756,7 +2757,8 @@ class FiroWallet extends CoinServiceAPI {
|
||||||
var price = await firoPrice;
|
var price = await firoPrice;
|
||||||
var builtHex = txb.build();
|
var builtHex = txb.build();
|
||||||
// return builtHex;
|
// return builtHex;
|
||||||
final locale =Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
|
final locale =
|
||||||
|
Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
|
||||||
return {
|
return {
|
||||||
"transaction": builtHex,
|
"transaction": builtHex,
|
||||||
"txid": txId,
|
"txid": txId,
|
||||||
|
@ -2810,7 +2812,8 @@ class FiroWallet extends CoinServiceAPI {
|
||||||
final currentPrice = await firoPrice;
|
final currentPrice = await firoPrice;
|
||||||
// Grab the most recent information on all the joinsplits
|
// Grab the most recent information on all the joinsplits
|
||||||
|
|
||||||
final locale = Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
|
final locale =
|
||||||
|
Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
|
||||||
final updatedJSplit = await getJMintTransactions(cachedElectrumXClient,
|
final updatedJSplit = await getJMintTransactions(cachedElectrumXClient,
|
||||||
joinsplits, _prefs.currency, coin, currentPrice, locale!);
|
joinsplits, _prefs.currency, coin, currentPrice, locale!);
|
||||||
|
|
||||||
|
@ -3249,7 +3252,8 @@ class FiroWallet extends CoinServiceAPI {
|
||||||
final currentPrice = await firoPrice;
|
final currentPrice = await firoPrice;
|
||||||
final List<Map<String, dynamic>> midSortedArray = [];
|
final List<Map<String, dynamic>> midSortedArray = [];
|
||||||
|
|
||||||
final locale = Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
|
final locale =
|
||||||
|
Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
|
||||||
|
|
||||||
Logging.instance.log("refresh the txs", level: LogLevel.Info);
|
Logging.instance.log("refresh the txs", level: LogLevel.Info);
|
||||||
for (final txObject in allTransactions) {
|
for (final txObject in allTransactions) {
|
||||||
|
@ -4375,7 +4379,8 @@ class FiroWallet extends CoinServiceAPI {
|
||||||
final lelantusEntry = await _getLelantusEntry();
|
final lelantusEntry = await _getLelantusEntry();
|
||||||
final anonymitySets = await fetchAnonymitySets();
|
final anonymitySets = await fetchAnonymitySets();
|
||||||
final locktime = await getBlockHead(electrumXClient);
|
final locktime = await getBlockHead(electrumXClient);
|
||||||
final locale = Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
|
final locale =
|
||||||
|
Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
|
||||||
|
|
||||||
ReceivePort receivePort = await getIsolate({
|
ReceivePort receivePort = await getIsolate({
|
||||||
"function": "createJoinSplit",
|
"function": "createJoinSplit",
|
||||||
|
@ -4806,4 +4811,8 @@ class FiroWallet extends CoinServiceAPI {
|
||||||
Future<Decimal> availablePublicBalance() async {
|
Future<Decimal> availablePublicBalance() async {
|
||||||
return (await balances)[4];
|
return (await balances)[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement storedChainHeight
|
||||||
|
int get storedChainHeight => throw UnimplementedError();
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,4 +278,6 @@ class Manager with ChangeNotifier {
|
||||||
}
|
}
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int get currentHeight => _currentWallet.storedChainHeight;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1334,4 +1334,8 @@ class MoneroWallet extends CoinServiceAPI {
|
||||||
key: "highestPercentCached",
|
key: "highestPercentCached",
|
||||||
value: value,
|
value: value,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement storedChainHeight
|
||||||
|
int get storedChainHeight => throw UnimplementedError();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1378,4 +1378,8 @@ class WowneroWallet extends CoinServiceAPI {
|
||||||
key: "highestPercentCached",
|
key: "highestPercentCached",
|
||||||
value: value,
|
value: value,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement storedChainHeight
|
||||||
|
int get storedChainHeight => throw UnimplementedError();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue