isar inspector active in debug mode and add single transaction fetch function

This commit is contained in:
julian 2023-01-27 10:04:15 -06:00
parent 9b74f52ce9
commit b76c9e6c6b

View file

@ -1,3 +1,4 @@
import 'package:flutter/foundation.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import 'package:stackwallet/models/isar/models/isar_models.dart'; import 'package:stackwallet/models/isar/models/isar_models.dart';
import 'package:stackwallet/utilities/stack_file_system.dart'; import 'package:stackwallet/utilities/stack_file_system.dart';
@ -28,7 +29,7 @@ class MainDB {
AddressSchema, AddressSchema,
], ],
directory: (await StackFileSystem.applicationIsarDirectory()).path, directory: (await StackFileSystem.applicationIsarDirectory()).path,
inspector: false, inspector: kDebugMode,
name: "wallet_data", name: "wallet_data",
); );
return true; return true;
@ -73,6 +74,10 @@ class MainDB {
await isar.transactions.putAll(transactions); await isar.transactions.putAll(transactions);
}); });
Future<Transaction?> getTransaction(String walletId, String txid) async {
return isar.transactions.getByTxidWalletId(txid, walletId);
}
// utxos // utxos
QueryBuilder<UTXO, UTXO, QAfterWhereClause> getUTXOs(String walletId) => QueryBuilder<UTXO, UTXO, QAfterWhereClause> getUTXOs(String walletId) =>
isar.utxos.where().walletIdEqualTo(walletId); isar.utxos.where().walletIdEqualTo(walletId);