mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-10 20:54:33 +00:00
update isar models
This commit is contained in:
parent
822bb219b6
commit
5937d92aee
5 changed files with 695 additions and 461 deletions
|
@ -8,7 +8,7 @@ class AddressException extends SWException {
|
|||
AddressException(super.message);
|
||||
}
|
||||
|
||||
@collection
|
||||
@Collection(accessor: "addresses")
|
||||
class Address extends CryptoCurrencyAddress {
|
||||
Id id = Isar.autoIncrement;
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ part of 'address.dart';
|
|||
// ignore_for_file: duplicate_ignore, non_constant_identifier_names, constant_identifier_names, invalid_use_of_protected_member, unnecessary_cast, prefer_const_constructors, lines_longer_than_80_chars, require_trailing_commas, inference_failure_on_function_invocation, unnecessary_parenthesis, unnecessary_raw_strings, unnecessary_null_checks, join_return_with_assignment, prefer_final_locals, avoid_js_rounded_ints, avoid_positional_boolean_parameters
|
||||
|
||||
extension GetAddressCollection on Isar {
|
||||
IsarCollection<Address> get address => this.collection();
|
||||
IsarCollection<Address> get addresses => this.collection();
|
||||
}
|
||||
|
||||
const AddressSchema = CollectionSchema(
|
||||
|
|
|
@ -253,7 +253,7 @@ const _TransactionsubTypeValueEnumMap = {
|
|||
const _TransactiontypeEnumValueMap = {
|
||||
'outgoing': 0,
|
||||
'incoming': 1,
|
||||
'sendToSelf': 2,
|
||||
'sentToSelf': 2,
|
||||
'unknown': 3,
|
||||
'anonymize': 4,
|
||||
};
|
||||
|
|
|
@ -4,37 +4,35 @@ import 'package:isar/isar.dart';
|
|||
|
||||
part 'utxo.g.dart';
|
||||
|
||||
@Collection()
|
||||
@Collection(accessor: "utxos")
|
||||
class UTXO {
|
||||
Id id = Isar.autoIncrement;
|
||||
|
||||
@Index(unique: true, replace: true)
|
||||
late String txid;
|
||||
|
||||
late int vout;
|
||||
|
||||
late Status status;
|
||||
|
||||
late int value;
|
||||
|
||||
late String txName;
|
||||
late String name;
|
||||
|
||||
late bool blocked;
|
||||
@Index()
|
||||
late bool isBlocked;
|
||||
|
||||
late String? blockedReason;
|
||||
|
||||
late bool isCoinbase;
|
||||
}
|
||||
|
||||
@Embedded()
|
||||
class Status {
|
||||
late String blockHash;
|
||||
late String? blockHash;
|
||||
|
||||
late int blockHeight;
|
||||
late int? blockHeight;
|
||||
|
||||
late int blockTime;
|
||||
late int? blockTime;
|
||||
|
||||
int getConfirmations(int currentChainHeight) {
|
||||
return max(0, currentChainHeight - blockHeight);
|
||||
if (blockHeight == null) return 0;
|
||||
return max(0, currentChainHeight - blockHeight!);
|
||||
}
|
||||
|
||||
bool isConfirmed(int currentChainHeight, int minimumConfirms) {
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue