diff --git a/lib/db/sqlite/firo_cache_coordinator.dart b/lib/db/sqlite/firo_cache_coordinator.dart index 610504d5f..83943f3cc 100644 --- a/lib/db/sqlite/firo_cache_coordinator.dart +++ b/lib/db/sqlite/firo_cache_coordinator.dart @@ -120,15 +120,32 @@ abstract class FiroCacheCoordinator { ); } - static Future getSetCoinsForGroupId( + static Future< + List< + ({ + String serialized, + String txHash, + String context, + })>> getSetCoinsForGroupId( int groupId, { int? newerThanTimeStamp, }) async { - return await _Reader._getSetCoinsForGroupId( + final resultSet = await _Reader._getSetCoinsForGroupId( groupId, db: _FiroCache.setCacheDB, newerThanTimeStamp: newerThanTimeStamp, ); + return resultSet + .map( + (row) => ( + serialized: row["serialized"] as String, + txHash: row["txHash"] as String, + context: row["context"] as String, + ), + ) + .toList() + .reversed + .toList(); } static Future< diff --git a/lib/db/sqlite/firo_cache_writer.dart b/lib/db/sqlite/firo_cache_writer.dart index 0bf1d938b..b1ee201bd 100644 --- a/lib/db/sqlite/firo_cache_writer.dart +++ b/lib/db/sqlite/firo_cache_writer.dart @@ -104,7 +104,8 @@ FCResult _updateSparkAnonSetCoinsWith( e[2] as String, ], ) - .toList(); + .toList() + .reversed; final timestamp = DateTime.now().toUtc().millisecondsSinceEpoch ~/ 1000; diff --git a/lib/wallets/wallet/wallet.dart b/lib/wallets/wallet/wallet.dart index b579f9632..7b0851ee5 100644 --- a/lib/wallets/wallet/wallet.dart +++ b/lib/wallets/wallet/wallet.dart @@ -1,5 +1,4 @@ import 'dart:async'; -import 'dart:convert'; import 'package:isar/isar.dart'; import 'package:meta/meta.dart'; @@ -560,15 +559,8 @@ abstract class Wallet { // TODO: [prio=low] handle this differently. Extra modification of this file for coin specific functionality should be avoided. if (this is LelantusInterface) { - // Parse otherDataJsonString to get the enableLelantusScanning value. - bool enableLelantusScanning = false; - if (this.info.otherDataJsonString != null) { - final otherDataJson = json.decode(this.info.otherDataJsonString!); - enableLelantusScanning = - otherDataJson[WalletInfoKeys.enableLelantusScanning] as bool? ?? - false; - } - if (enableLelantusScanning) { + if (info.otherData[WalletInfoKeys.enableLelantusScanning] as bool? ?? + false) { await (this as LelantusInterface).refreshLelantusData(); } } diff --git a/lib/wallets/wallet/wallet_mixin_interfaces/spark_interface.dart b/lib/wallets/wallet/wallet_mixin_interfaces/spark_interface.dart index af7f1b6cc..acdd9ae98 100644 --- a/lib/wallets/wallet/wallet_mixin_interfaces/spark_interface.dart +++ b/lib/wallets/wallet/wallet_mixin_interfaces/spark_interface.dart @@ -297,10 +297,10 @@ mixin SparkInterface "coinGroupID": i, "coins": resultSet .map( - (row) => [ - row["serialized"] as String, - row["txHash"] as String, - row["context"] as String, + (e) => [ + e.serialized, + e.txHash, + e.context, ], ) .toList(), @@ -799,10 +799,10 @@ mixin SparkInterface ); final coinsRaw = anonymitySetResult .map( - (row) => [ - row["serialized"] as String, - row["txHash"] as String, - row["context"] as String, + (e) => [ + e.serialized, + e.txHash, + e.context, ], ) .toList();