mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-12 09:27:01 +00:00
start using provider for MainDB in ui and add contract getters
This commit is contained in:
parent
e29d8dc047
commit
ad53b30e2e
2 changed files with 10 additions and 0 deletions
|
@ -404,6 +404,12 @@ class MainDB {
|
|||
QueryBuilder<EthContract, EthContract, QWhere> getEthContracts() =>
|
||||
isar.ethContracts.where();
|
||||
|
||||
Future<EthContract?> getEthContract(String contractAddress) =>
|
||||
isar.ethContracts.where().addressEqualTo(contractAddress).findFirst();
|
||||
|
||||
EthContract? getEthContractSync(String contractAddress) =>
|
||||
isar.ethContracts.where().addressEqualTo(contractAddress).findFirstSync();
|
||||
|
||||
Future<int> putEthContract(EthContract contract) => isar.writeTxn(() async {
|
||||
return await isar.ethContracts.put(contract);
|
||||
});
|
||||
|
|
4
lib/providers/db/main_db_provider.dart
Normal file
4
lib/providers/db/main_db_provider.dart
Normal file
|
@ -0,0 +1,4 @@
|
|||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:stackwallet/db/isar/main_db.dart';
|
||||
|
||||
final mainDBProvider = Provider((ref) => MainDB.instance);
|
Loading…
Reference in a new issue