mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-25 08:38:45 +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);
|
AddressException(super.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@collection
|
@Collection(accessor: "addresses")
|
||||||
class Address extends CryptoCurrencyAddress {
|
class Address extends CryptoCurrencyAddress {
|
||||||
Id id = Isar.autoIncrement;
|
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
|
// 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 {
|
extension GetAddressCollection on Isar {
|
||||||
IsarCollection<Address> get address => this.collection();
|
IsarCollection<Address> get addresses => this.collection();
|
||||||
}
|
}
|
||||||
|
|
||||||
const AddressSchema = CollectionSchema(
|
const AddressSchema = CollectionSchema(
|
||||||
|
|
|
@ -253,7 +253,7 @@ const _TransactionsubTypeValueEnumMap = {
|
||||||
const _TransactiontypeEnumValueMap = {
|
const _TransactiontypeEnumValueMap = {
|
||||||
'outgoing': 0,
|
'outgoing': 0,
|
||||||
'incoming': 1,
|
'incoming': 1,
|
||||||
'sendToSelf': 2,
|
'sentToSelf': 2,
|
||||||
'unknown': 3,
|
'unknown': 3,
|
||||||
'anonymize': 4,
|
'anonymize': 4,
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,37 +4,35 @@ import 'package:isar/isar.dart';
|
||||||
|
|
||||||
part 'utxo.g.dart';
|
part 'utxo.g.dart';
|
||||||
|
|
||||||
@Collection()
|
@Collection(accessor: "utxos")
|
||||||
class UTXO {
|
class UTXO {
|
||||||
Id id = Isar.autoIncrement;
|
Id id = Isar.autoIncrement;
|
||||||
|
|
||||||
|
@Index(unique: true, replace: true)
|
||||||
late String txid;
|
late String txid;
|
||||||
|
|
||||||
late int vout;
|
late int vout;
|
||||||
|
|
||||||
late Status status;
|
|
||||||
|
|
||||||
late int value;
|
late int value;
|
||||||
|
|
||||||
late String txName;
|
late String name;
|
||||||
|
|
||||||
late bool blocked;
|
@Index()
|
||||||
|
late bool isBlocked;
|
||||||
|
|
||||||
late String? blockedReason;
|
late String? blockedReason;
|
||||||
|
|
||||||
late bool isCoinbase;
|
late bool isCoinbase;
|
||||||
}
|
|
||||||
|
|
||||||
@Embedded()
|
late String? blockHash;
|
||||||
class Status {
|
|
||||||
late String blockHash;
|
|
||||||
|
|
||||||
late int blockHeight;
|
late int? blockHeight;
|
||||||
|
|
||||||
late int blockTime;
|
late int? blockTime;
|
||||||
|
|
||||||
int getConfirmations(int currentChainHeight) {
|
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) {
|
bool isConfirmed(int currentChainHeight, int minimumConfirms) {
|
||||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue