add currentHeight getter

This commit is contained in:
julian 2023-01-10 17:50:22 -06:00
parent ce05a647f0
commit 8ee9428758
6 changed files with 30 additions and 7 deletions

View file

@ -253,7 +253,8 @@ class BitcoinCashWallet extends CoinServiceAPI {
}
}
Future<int> get storedChainHeight async {
@override
int get storedChainHeight {
final storedHeight = DB.instance
.get<dynamic>(boxName: walletId, key: "storedChainHeight") as int?;
return storedHeight ?? 0;
@ -1174,7 +1175,8 @@ class BitcoinCashWallet extends CoinServiceAPI {
final priceData =
await _priceAPI.getPricesAnd24hChange(baseCurrency: _prefs.currency);
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(
value:
((currentPrice * Decimal.fromInt(txData["recipientAmt"] as int)) /

View file

@ -307,4 +307,6 @@ abstract class CoinServiceAPI {
// used for electrumx coins
Future<void> updateSentCachedTxData(Map<String, dynamic> txData);
int get storedChainHeight;
}

View file

@ -883,7 +883,8 @@ class FiroWallet extends CoinServiceAPI {
@override
Future<void> updateSentCachedTxData(Map<String, dynamic> txData) async {
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(
value:
((currentPrice * Decimal.fromInt(txData["recipientAmt"] as int)) /
@ -2756,7 +2757,8 @@ class FiroWallet extends CoinServiceAPI {
var price = await firoPrice;
var builtHex = txb.build();
// return builtHex;
final locale =Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
final locale =
Platform.isWindows ? "en_US" : await Devicelocale.currentLocale;
return {
"transaction": builtHex,
"txid": txId,
@ -2810,7 +2812,8 @@ class FiroWallet extends CoinServiceAPI {
final currentPrice = await firoPrice;
// 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,
joinsplits, _prefs.currency, coin, currentPrice, locale!);
@ -3249,7 +3252,8 @@ class FiroWallet extends CoinServiceAPI {
final currentPrice = await firoPrice;
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);
for (final txObject in allTransactions) {
@ -4375,7 +4379,8 @@ class FiroWallet extends CoinServiceAPI {
final lelantusEntry = await _getLelantusEntry();
final anonymitySets = await fetchAnonymitySets();
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({
"function": "createJoinSplit",
@ -4806,4 +4811,8 @@ class FiroWallet extends CoinServiceAPI {
Future<Decimal> availablePublicBalance() async {
return (await balances)[4];
}
@override
// TODO: implement storedChainHeight
int get storedChainHeight => throw UnimplementedError();
}

View file

@ -278,4 +278,6 @@ class Manager with ChangeNotifier {
}
return success;
}
int get currentHeight => _currentWallet.storedChainHeight;
}

View file

@ -1334,4 +1334,8 @@ class MoneroWallet extends CoinServiceAPI {
key: "highestPercentCached",
value: value,
);
@override
// TODO: implement storedChainHeight
int get storedChainHeight => throw UnimplementedError();
}

View file

@ -1378,4 +1378,8 @@ class WowneroWallet extends CoinServiceAPI {
key: "highestPercentCached",
value: value,
);
@override
// TODO: implement storedChainHeight
int get storedChainHeight => throw UnimplementedError();
}