mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 03:49:22 +00:00
eth contract isar schema
This commit is contained in:
parent
b4b4c5e696
commit
4cec54620a
5 changed files with 1573 additions and 0 deletions
|
@ -27,6 +27,7 @@ class MainDB {
|
|||
UTXOSchema,
|
||||
AddressSchema,
|
||||
AddressLabelSchema,
|
||||
EthContractSchema,
|
||||
],
|
||||
directory: (await StackFileSystem.applicationIsarDirectory()).path,
|
||||
// inspector: kDebugMode,
|
||||
|
|
3
lib/models/isar/models/contract.dart
Normal file
3
lib/models/isar/models/contract.dart
Normal file
|
@ -0,0 +1,3 @@
|
|||
abstract class Contract {
|
||||
// for possible future use
|
||||
}
|
42
lib/models/isar/models/ethereum/eth_contract.dart
Normal file
42
lib/models/isar/models/ethereum/eth_contract.dart
Normal file
|
@ -0,0 +1,42 @@
|
|||
import 'package:isar/isar.dart';
|
||||
import 'package:stackwallet/models/isar/models/contract.dart';
|
||||
|
||||
part 'eth_contract.g.dart';
|
||||
|
||||
@collection
|
||||
class EthContract extends Contract {
|
||||
EthContract({
|
||||
required this.address,
|
||||
required this.name,
|
||||
required this.symbol,
|
||||
required this.decimals,
|
||||
required this.type,
|
||||
this.abi,
|
||||
this.otherData,
|
||||
});
|
||||
|
||||
Id id = Isar.autoIncrement;
|
||||
|
||||
@Index(unique: true, replace: true)
|
||||
late final String address;
|
||||
|
||||
late final String name;
|
||||
|
||||
late final String symbol;
|
||||
|
||||
late final int decimals;
|
||||
|
||||
late final String? abi;
|
||||
|
||||
@enumerated
|
||||
late final EthContractType type;
|
||||
|
||||
late final String? otherData;
|
||||
}
|
||||
|
||||
// Used in Isar db and stored there as int indexes so adding/removing values
|
||||
// in this definition should be done extremely carefully in production
|
||||
enum EthContractType {
|
||||
erc20,
|
||||
erc721;
|
||||
}
|
1526
lib/models/isar/models/ethereum/eth_contract.g.dart
Normal file
1526
lib/models/isar/models/ethereum/eth_contract.g.dart
Normal file
File diff suppressed because it is too large
Load diff
|
@ -4,5 +4,6 @@ export 'blockchain_data/input.dart';
|
|||
export 'blockchain_data/output.dart';
|
||||
export 'blockchain_data/transaction.dart';
|
||||
export 'blockchain_data/utxo.dart';
|
||||
export 'ethereum/eth_contract.dart';
|
||||
export 'log.dart';
|
||||
export 'transaction_note.dart';
|
||||
|
|
Loading…
Reference in a new issue