mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-16 09:17:37 +00:00
breaking changes to wallet mnemonic verification
This commit is contained in:
parent
42e18397d7
commit
e5a4382153
14 changed files with 699 additions and 138 deletions
|
@ -23,6 +23,7 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
|||
import 'package:stackwallet/utilities/stack_file_system.dart';
|
||||
import 'package:stackwallet/wallets/isar/models/spark_coin.dart';
|
||||
import 'package:stackwallet/wallets/isar/models/wallet_info.dart';
|
||||
import 'package:stackwallet/wallets/isar/models/wallet_info_meta.dart';
|
||||
import 'package:tuple/tuple.dart';
|
||||
|
||||
part '../queries/queries.dart';
|
||||
|
@ -63,6 +64,7 @@ class MainDB {
|
|||
WalletInfoSchema,
|
||||
TransactionV2Schema,
|
||||
SparkCoinSchema,
|
||||
WalletInfoMetaSchema,
|
||||
],
|
||||
directory: (await StackFileSystem.applicationIsarDirectory()).path,
|
||||
// inspector: kDebugMode,
|
||||
|
|
|
@ -168,13 +168,14 @@ class Wallets {
|
|||
|
||||
for (final walletInfo in walletInfoList) {
|
||||
try {
|
||||
final isVerified = await walletInfo.isMnemonicVerified(mainDB.isar);
|
||||
Logging.instance.log(
|
||||
"LOADING WALLET: ${walletInfo.name}:${walletInfo.walletId} "
|
||||
"IS VERIFIED: ${walletInfo.isMnemonicVerified}",
|
||||
"IS VERIFIED: $isVerified",
|
||||
level: LogLevel.Info,
|
||||
);
|
||||
|
||||
if (walletInfo.isMnemonicVerified) {
|
||||
if (isVerified) {
|
||||
// TODO: integrate this into the new wallets somehow?
|
||||
// requires some thinking
|
||||
final txTracker =
|
||||
|
@ -248,12 +249,13 @@ class Wallets {
|
|||
}
|
||||
|
||||
for (final wallet in wallets) {
|
||||
final isVerified = await wallet.info.isMnemonicVerified(mainDB.isar);
|
||||
Logging.instance.log(
|
||||
"LOADING WALLET: ${wallet.info.name}:${wallet.walletId} IS VERIFIED: ${wallet.info.isMnemonicVerified}",
|
||||
"LOADING WALLET: ${wallet.info.name}:${wallet.walletId} IS VERIFIED: $isVerified",
|
||||
level: LogLevel.Info,
|
||||
);
|
||||
|
||||
if (wallet.info.isMnemonicVerified) {
|
||||
if (isVerified) {
|
||||
final shouldSetAutoSync = shouldAutoSyncAll ||
|
||||
walletIdsToEnableAutoSync.contains(wallet.walletId);
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import 'package:stackwallet/models/balance.dart';
|
|||
import 'package:stackwallet/models/isar/models/blockchain_data/address.dart';
|
||||
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
||||
import 'package:stackwallet/wallets/isar/isar_id_interface.dart';
|
||||
import 'package:stackwallet/wallets/isar/models/wallet_info_meta.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
|
||||
part 'wallet_info.g.dart';
|
||||
|
@ -55,11 +56,6 @@ class WalletInfo implements IsarId {
|
|||
int get favouriteOrderIndex => _favouriteOrderIndex;
|
||||
int _favouriteOrderIndex;
|
||||
|
||||
/// Wallets without this flag set to true should be deleted on next app run
|
||||
/// and should not be displayed in the ui.
|
||||
bool get isMnemonicVerified => _isMnemonicVerified;
|
||||
bool _isMnemonicVerified;
|
||||
|
||||
/// The highest block height the wallet has scanned.
|
||||
int get cachedChainHeight => _cachedChainHeight;
|
||||
int _cachedChainHeight;
|
||||
|
@ -129,6 +125,11 @@ class WalletInfo implements IsarId {
|
|||
? {}
|
||||
: Map<String, dynamic>.from(jsonDecode(otherDataJsonString!) as Map);
|
||||
|
||||
Future<bool> isMnemonicVerified(Isar isar) async =>
|
||||
(await isar.walletInfoMeta.where().walletIdEqualTo(walletId).findFirst())
|
||||
?.isMnemonicVerified ==
|
||||
true;
|
||||
|
||||
//============================================================================
|
||||
//============= Updaters ================================================
|
||||
|
||||
|
@ -289,12 +290,26 @@ class WalletInfo implements IsarId {
|
|||
Future<void> setMnemonicVerified({
|
||||
required Isar isar,
|
||||
}) async {
|
||||
// only update if there were changes to the name
|
||||
if (!isMnemonicVerified) {
|
||||
_isMnemonicVerified = true;
|
||||
final meta =
|
||||
await isar.walletInfoMeta.where().walletIdEqualTo(walletId).findFirst();
|
||||
if (meta == null) {
|
||||
await isar.writeTxn(() async {
|
||||
await isar.walletInfo.deleteByWalletId(walletId);
|
||||
await isar.walletInfo.put(this);
|
||||
await isar.walletInfoMeta.deleteByWalletId(walletId);
|
||||
await isar.walletInfoMeta.put(
|
||||
WalletInfoMeta(
|
||||
walletId: walletId,
|
||||
isMnemonicVerified: true,
|
||||
),
|
||||
);
|
||||
});
|
||||
} else if (meta.isMnemonicVerified == false) {
|
||||
await isar.writeTxn(() async {
|
||||
await isar.walletInfoMeta.put(
|
||||
WalletInfoMeta(
|
||||
walletId: walletId,
|
||||
isMnemonicVerified: true,
|
||||
),
|
||||
);
|
||||
});
|
||||
} else {
|
||||
throw Exception(
|
||||
|
@ -332,7 +347,6 @@ class WalletInfo implements IsarId {
|
|||
_favouriteOrderIndex = favouriteOrderIndex,
|
||||
_cachedChainHeight = cachedChainHeight,
|
||||
_restoreHeight = restoreHeight,
|
||||
_isMnemonicVerified = isMnemonicVerified,
|
||||
_cachedBalanceString = cachedBalanceString,
|
||||
_cachedBalanceSecondaryString = cachedBalanceSecondaryString,
|
||||
_cachedBalanceTertiaryString = cachedBalanceTertiaryString,
|
||||
|
|
|
@ -57,39 +57,34 @@ const WalletInfoSchema = CollectionSchema(
|
|||
name: r'isFavourite',
|
||||
type: IsarType.bool,
|
||||
),
|
||||
r'isMnemonicVerified': PropertySchema(
|
||||
id: 8,
|
||||
name: r'isMnemonicVerified',
|
||||
type: IsarType.bool,
|
||||
),
|
||||
r'mainAddressType': PropertySchema(
|
||||
id: 9,
|
||||
id: 8,
|
||||
name: r'mainAddressType',
|
||||
type: IsarType.byte,
|
||||
enumMap: _WalletInfomainAddressTypeEnumValueMap,
|
||||
),
|
||||
r'name': PropertySchema(
|
||||
id: 10,
|
||||
id: 9,
|
||||
name: r'name',
|
||||
type: IsarType.string,
|
||||
),
|
||||
r'otherDataJsonString': PropertySchema(
|
||||
id: 11,
|
||||
id: 10,
|
||||
name: r'otherDataJsonString',
|
||||
type: IsarType.string,
|
||||
),
|
||||
r'restoreHeight': PropertySchema(
|
||||
id: 12,
|
||||
id: 11,
|
||||
name: r'restoreHeight',
|
||||
type: IsarType.long,
|
||||
),
|
||||
r'tokenContractAddresses': PropertySchema(
|
||||
id: 13,
|
||||
id: 12,
|
||||
name: r'tokenContractAddresses',
|
||||
type: IsarType.stringList,
|
||||
),
|
||||
r'walletId': PropertySchema(
|
||||
id: 14,
|
||||
id: 13,
|
||||
name: r'walletId',
|
||||
type: IsarType.string,
|
||||
)
|
||||
|
@ -180,13 +175,12 @@ void _walletInfoSerialize(
|
|||
writer.writeString(offsets[5], object.coinName);
|
||||
writer.writeLong(offsets[6], object.favouriteOrderIndex);
|
||||
writer.writeBool(offsets[7], object.isFavourite);
|
||||
writer.writeBool(offsets[8], object.isMnemonicVerified);
|
||||
writer.writeByte(offsets[9], object.mainAddressType.index);
|
||||
writer.writeString(offsets[10], object.name);
|
||||
writer.writeString(offsets[11], object.otherDataJsonString);
|
||||
writer.writeLong(offsets[12], object.restoreHeight);
|
||||
writer.writeStringList(offsets[13], object.tokenContractAddresses);
|
||||
writer.writeString(offsets[14], object.walletId);
|
||||
writer.writeByte(offsets[8], object.mainAddressType.index);
|
||||
writer.writeString(offsets[9], object.name);
|
||||
writer.writeString(offsets[10], object.otherDataJsonString);
|
||||
writer.writeLong(offsets[11], object.restoreHeight);
|
||||
writer.writeStringList(offsets[12], object.tokenContractAddresses);
|
||||
writer.writeString(offsets[13], object.walletId);
|
||||
}
|
||||
|
||||
WalletInfo _walletInfoDeserialize(
|
||||
|
@ -203,14 +197,13 @@ WalletInfo _walletInfoDeserialize(
|
|||
cachedReceivingAddress: reader.readStringOrNull(offsets[4]) ?? "",
|
||||
coinName: reader.readString(offsets[5]),
|
||||
favouriteOrderIndex: reader.readLongOrNull(offsets[6]) ?? -1,
|
||||
isMnemonicVerified: reader.readBoolOrNull(offsets[8]) ?? false,
|
||||
mainAddressType: _WalletInfomainAddressTypeValueEnumMap[
|
||||
reader.readByteOrNull(offsets[9])] ??
|
||||
reader.readByteOrNull(offsets[8])] ??
|
||||
AddressType.p2pkh,
|
||||
name: reader.readString(offsets[10]),
|
||||
otherDataJsonString: reader.readStringOrNull(offsets[11]),
|
||||
restoreHeight: reader.readLongOrNull(offsets[12]) ?? 0,
|
||||
walletId: reader.readString(offsets[14]),
|
||||
name: reader.readString(offsets[9]),
|
||||
otherDataJsonString: reader.readStringOrNull(offsets[10]),
|
||||
restoreHeight: reader.readLongOrNull(offsets[11]) ?? 0,
|
||||
walletId: reader.readString(offsets[13]),
|
||||
);
|
||||
object.id = id;
|
||||
return object;
|
||||
|
@ -240,20 +233,18 @@ P _walletInfoDeserializeProp<P>(
|
|||
case 7:
|
||||
return (reader.readBool(offset)) as P;
|
||||
case 8:
|
||||
return (reader.readBoolOrNull(offset) ?? false) as P;
|
||||
case 9:
|
||||
return (_WalletInfomainAddressTypeValueEnumMap[
|
||||
reader.readByteOrNull(offset)] ??
|
||||
AddressType.p2pkh) as P;
|
||||
case 10:
|
||||
case 9:
|
||||
return (reader.readString(offset)) as P;
|
||||
case 11:
|
||||
case 10:
|
||||
return (reader.readStringOrNull(offset)) as P;
|
||||
case 12:
|
||||
case 11:
|
||||
return (reader.readLongOrNull(offset) ?? 0) as P;
|
||||
case 13:
|
||||
case 12:
|
||||
return (reader.readStringList(offset) ?? []) as P;
|
||||
case 14:
|
||||
case 13:
|
||||
return (reader.readString(offset)) as P;
|
||||
default:
|
||||
throw IsarError('Unknown property with id $propertyId');
|
||||
|
@ -1391,16 +1382,6 @@ extension WalletInfoQueryFilter
|
|||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfo, WalletInfo, QAfterFilterCondition>
|
||||
isMnemonicVerifiedEqualTo(bool value) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.equalTo(
|
||||
property: r'isMnemonicVerified',
|
||||
value: value,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfo, WalletInfo, QAfterFilterCondition>
|
||||
mainAddressTypeEqualTo(AddressType value) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
|
@ -2274,20 +2255,6 @@ extension WalletInfoQuerySortBy
|
|||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfo, WalletInfo, QAfterSortBy>
|
||||
sortByIsMnemonicVerified() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(r'isMnemonicVerified', Sort.asc);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfo, WalletInfo, QAfterSortBy>
|
||||
sortByIsMnemonicVerifiedDesc() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(r'isMnemonicVerified', Sort.desc);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfo, WalletInfo, QAfterSortBy> sortByMainAddressType() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(r'mainAddressType', Sort.asc);
|
||||
|
@ -2473,20 +2440,6 @@ extension WalletInfoQuerySortThenBy
|
|||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfo, WalletInfo, QAfterSortBy>
|
||||
thenByIsMnemonicVerified() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(r'isMnemonicVerified', Sort.asc);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfo, WalletInfo, QAfterSortBy>
|
||||
thenByIsMnemonicVerifiedDesc() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(r'isMnemonicVerified', Sort.desc);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfo, WalletInfo, QAfterSortBy> thenByMainAddressType() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(r'mainAddressType', Sort.asc);
|
||||
|
@ -2612,13 +2565,6 @@ extension WalletInfoQueryWhereDistinct
|
|||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfo, WalletInfo, QDistinct>
|
||||
distinctByIsMnemonicVerified() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addDistinctBy(r'isMnemonicVerified');
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfo, WalletInfo, QDistinct> distinctByMainAddressType() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addDistinctBy(r'mainAddressType');
|
||||
|
@ -2722,13 +2668,6 @@ extension WalletInfoQueryProperty
|
|||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfo, bool, QQueryOperations>
|
||||
isMnemonicVerifiedProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addPropertyName(r'isMnemonicVerified');
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfo, AddressType, QQueryOperations>
|
||||
mainAddressTypeProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
|
|
22
lib/wallets/isar/models/wallet_info_meta.dart
Normal file
22
lib/wallets/isar/models/wallet_info_meta.dart
Normal file
|
@ -0,0 +1,22 @@
|
|||
import 'package:isar/isar.dart';
|
||||
import 'package:stackwallet/wallets/isar/isar_id_interface.dart';
|
||||
|
||||
part 'wallet_info_meta.g.dart';
|
||||
|
||||
@Collection(accessor: "walletInfoMeta", inheritance: false)
|
||||
class WalletInfoMeta implements IsarId {
|
||||
@override
|
||||
Id id = Isar.autoIncrement;
|
||||
|
||||
@Index(unique: true, replace: false)
|
||||
final String walletId;
|
||||
|
||||
/// Wallets without this flag set to true should be deleted on next app run
|
||||
/// and should not be displayed in the ui.
|
||||
final bool isMnemonicVerified;
|
||||
|
||||
WalletInfoMeta({
|
||||
required this.walletId,
|
||||
required this.isMnemonicVerified,
|
||||
});
|
||||
}
|
622
lib/wallets/isar/models/wallet_info_meta.g.dart
Normal file
622
lib/wallets/isar/models/wallet_info_meta.g.dart
Normal file
|
@ -0,0 +1,622 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'wallet_info_meta.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// IsarCollectionGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// coverage:ignore-file
|
||||
// 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 GetWalletInfoMetaCollection on Isar {
|
||||
IsarCollection<WalletInfoMeta> get walletInfoMeta => this.collection();
|
||||
}
|
||||
|
||||
const WalletInfoMetaSchema = CollectionSchema(
|
||||
name: r'WalletInfoMeta',
|
||||
id: -4749826865193299377,
|
||||
properties: {
|
||||
r'isMnemonicVerified': PropertySchema(
|
||||
id: 0,
|
||||
name: r'isMnemonicVerified',
|
||||
type: IsarType.bool,
|
||||
),
|
||||
r'walletId': PropertySchema(
|
||||
id: 1,
|
||||
name: r'walletId',
|
||||
type: IsarType.string,
|
||||
)
|
||||
},
|
||||
estimateSize: _walletInfoMetaEstimateSize,
|
||||
serialize: _walletInfoMetaSerialize,
|
||||
deserialize: _walletInfoMetaDeserialize,
|
||||
deserializeProp: _walletInfoMetaDeserializeProp,
|
||||
idName: r'id',
|
||||
indexes: {
|
||||
r'walletId': IndexSchema(
|
||||
id: -1783113319798776304,
|
||||
name: r'walletId',
|
||||
unique: true,
|
||||
replace: false,
|
||||
properties: [
|
||||
IndexPropertySchema(
|
||||
name: r'walletId',
|
||||
type: IndexType.hash,
|
||||
caseSensitive: true,
|
||||
)
|
||||
],
|
||||
)
|
||||
},
|
||||
links: {},
|
||||
embeddedSchemas: {},
|
||||
getId: _walletInfoMetaGetId,
|
||||
getLinks: _walletInfoMetaGetLinks,
|
||||
attach: _walletInfoMetaAttach,
|
||||
version: '3.0.5',
|
||||
);
|
||||
|
||||
int _walletInfoMetaEstimateSize(
|
||||
WalletInfoMeta object,
|
||||
List<int> offsets,
|
||||
Map<Type, List<int>> allOffsets,
|
||||
) {
|
||||
var bytesCount = offsets.last;
|
||||
bytesCount += 3 + object.walletId.length * 3;
|
||||
return bytesCount;
|
||||
}
|
||||
|
||||
void _walletInfoMetaSerialize(
|
||||
WalletInfoMeta object,
|
||||
IsarWriter writer,
|
||||
List<int> offsets,
|
||||
Map<Type, List<int>> allOffsets,
|
||||
) {
|
||||
writer.writeBool(offsets[0], object.isMnemonicVerified);
|
||||
writer.writeString(offsets[1], object.walletId);
|
||||
}
|
||||
|
||||
WalletInfoMeta _walletInfoMetaDeserialize(
|
||||
Id id,
|
||||
IsarReader reader,
|
||||
List<int> offsets,
|
||||
Map<Type, List<int>> allOffsets,
|
||||
) {
|
||||
final object = WalletInfoMeta(
|
||||
isMnemonicVerified: reader.readBool(offsets[0]),
|
||||
walletId: reader.readString(offsets[1]),
|
||||
);
|
||||
object.id = id;
|
||||
return object;
|
||||
}
|
||||
|
||||
P _walletInfoMetaDeserializeProp<P>(
|
||||
IsarReader reader,
|
||||
int propertyId,
|
||||
int offset,
|
||||
Map<Type, List<int>> allOffsets,
|
||||
) {
|
||||
switch (propertyId) {
|
||||
case 0:
|
||||
return (reader.readBool(offset)) as P;
|
||||
case 1:
|
||||
return (reader.readString(offset)) as P;
|
||||
default:
|
||||
throw IsarError('Unknown property with id $propertyId');
|
||||
}
|
||||
}
|
||||
|
||||
Id _walletInfoMetaGetId(WalletInfoMeta object) {
|
||||
return object.id;
|
||||
}
|
||||
|
||||
List<IsarLinkBase<dynamic>> _walletInfoMetaGetLinks(WalletInfoMeta object) {
|
||||
return [];
|
||||
}
|
||||
|
||||
void _walletInfoMetaAttach(
|
||||
IsarCollection<dynamic> col, Id id, WalletInfoMeta object) {
|
||||
object.id = id;
|
||||
}
|
||||
|
||||
extension WalletInfoMetaByIndex on IsarCollection<WalletInfoMeta> {
|
||||
Future<WalletInfoMeta?> getByWalletId(String walletId) {
|
||||
return getByIndex(r'walletId', [walletId]);
|
||||
}
|
||||
|
||||
WalletInfoMeta? getByWalletIdSync(String walletId) {
|
||||
return getByIndexSync(r'walletId', [walletId]);
|
||||
}
|
||||
|
||||
Future<bool> deleteByWalletId(String walletId) {
|
||||
return deleteByIndex(r'walletId', [walletId]);
|
||||
}
|
||||
|
||||
bool deleteByWalletIdSync(String walletId) {
|
||||
return deleteByIndexSync(r'walletId', [walletId]);
|
||||
}
|
||||
|
||||
Future<List<WalletInfoMeta?>> getAllByWalletId(List<String> walletIdValues) {
|
||||
final values = walletIdValues.map((e) => [e]).toList();
|
||||
return getAllByIndex(r'walletId', values);
|
||||
}
|
||||
|
||||
List<WalletInfoMeta?> getAllByWalletIdSync(List<String> walletIdValues) {
|
||||
final values = walletIdValues.map((e) => [e]).toList();
|
||||
return getAllByIndexSync(r'walletId', values);
|
||||
}
|
||||
|
||||
Future<int> deleteAllByWalletId(List<String> walletIdValues) {
|
||||
final values = walletIdValues.map((e) => [e]).toList();
|
||||
return deleteAllByIndex(r'walletId', values);
|
||||
}
|
||||
|
||||
int deleteAllByWalletIdSync(List<String> walletIdValues) {
|
||||
final values = walletIdValues.map((e) => [e]).toList();
|
||||
return deleteAllByIndexSync(r'walletId', values);
|
||||
}
|
||||
|
||||
Future<Id> putByWalletId(WalletInfoMeta object) {
|
||||
return putByIndex(r'walletId', object);
|
||||
}
|
||||
|
||||
Id putByWalletIdSync(WalletInfoMeta object, {bool saveLinks = true}) {
|
||||
return putByIndexSync(r'walletId', object, saveLinks: saveLinks);
|
||||
}
|
||||
|
||||
Future<List<Id>> putAllByWalletId(List<WalletInfoMeta> objects) {
|
||||
return putAllByIndex(r'walletId', objects);
|
||||
}
|
||||
|
||||
List<Id> putAllByWalletIdSync(List<WalletInfoMeta> objects,
|
||||
{bool saveLinks = true}) {
|
||||
return putAllByIndexSync(r'walletId', objects, saveLinks: saveLinks);
|
||||
}
|
||||
}
|
||||
|
||||
extension WalletInfoMetaQueryWhereSort
|
||||
on QueryBuilder<WalletInfoMeta, WalletInfoMeta, QWhere> {
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterWhere> anyId() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addWhereClause(const IdWhereClause.any());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
extension WalletInfoMetaQueryWhere
|
||||
on QueryBuilder<WalletInfoMeta, WalletInfoMeta, QWhereClause> {
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterWhereClause> idEqualTo(
|
||||
Id id) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addWhereClause(IdWhereClause.between(
|
||||
lower: id,
|
||||
upper: id,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterWhereClause> idNotEqualTo(
|
||||
Id id) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
if (query.whereSort == Sort.asc) {
|
||||
return query
|
||||
.addWhereClause(
|
||||
IdWhereClause.lessThan(upper: id, includeUpper: false),
|
||||
)
|
||||
.addWhereClause(
|
||||
IdWhereClause.greaterThan(lower: id, includeLower: false),
|
||||
);
|
||||
} else {
|
||||
return query
|
||||
.addWhereClause(
|
||||
IdWhereClause.greaterThan(lower: id, includeLower: false),
|
||||
)
|
||||
.addWhereClause(
|
||||
IdWhereClause.lessThan(upper: id, includeUpper: false),
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterWhereClause> idGreaterThan(
|
||||
Id id,
|
||||
{bool include = false}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addWhereClause(
|
||||
IdWhereClause.greaterThan(lower: id, includeLower: include),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterWhereClause> idLessThan(
|
||||
Id id,
|
||||
{bool include = false}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addWhereClause(
|
||||
IdWhereClause.lessThan(upper: id, includeUpper: include),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterWhereClause> idBetween(
|
||||
Id lowerId,
|
||||
Id upperId, {
|
||||
bool includeLower = true,
|
||||
bool includeUpper = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addWhereClause(IdWhereClause.between(
|
||||
lower: lowerId,
|
||||
includeLower: includeLower,
|
||||
upper: upperId,
|
||||
includeUpper: includeUpper,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterWhereClause>
|
||||
walletIdEqualTo(String walletId) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addWhereClause(IndexWhereClause.equalTo(
|
||||
indexName: r'walletId',
|
||||
value: [walletId],
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterWhereClause>
|
||||
walletIdNotEqualTo(String walletId) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
if (query.whereSort == Sort.asc) {
|
||||
return query
|
||||
.addWhereClause(IndexWhereClause.between(
|
||||
indexName: r'walletId',
|
||||
lower: [],
|
||||
upper: [walletId],
|
||||
includeUpper: false,
|
||||
))
|
||||
.addWhereClause(IndexWhereClause.between(
|
||||
indexName: r'walletId',
|
||||
lower: [walletId],
|
||||
includeLower: false,
|
||||
upper: [],
|
||||
));
|
||||
} else {
|
||||
return query
|
||||
.addWhereClause(IndexWhereClause.between(
|
||||
indexName: r'walletId',
|
||||
lower: [walletId],
|
||||
includeLower: false,
|
||||
upper: [],
|
||||
))
|
||||
.addWhereClause(IndexWhereClause.between(
|
||||
indexName: r'walletId',
|
||||
lower: [],
|
||||
upper: [walletId],
|
||||
includeUpper: false,
|
||||
));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
extension WalletInfoMetaQueryFilter
|
||||
on QueryBuilder<WalletInfoMeta, WalletInfoMeta, QFilterCondition> {
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterFilterCondition> idEqualTo(
|
||||
Id value) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.equalTo(
|
||||
property: r'id',
|
||||
value: value,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterFilterCondition>
|
||||
idGreaterThan(
|
||||
Id value, {
|
||||
bool include = false,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.greaterThan(
|
||||
include: include,
|
||||
property: r'id',
|
||||
value: value,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterFilterCondition>
|
||||
idLessThan(
|
||||
Id value, {
|
||||
bool include = false,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.lessThan(
|
||||
include: include,
|
||||
property: r'id',
|
||||
value: value,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterFilterCondition> idBetween(
|
||||
Id lower,
|
||||
Id upper, {
|
||||
bool includeLower = true,
|
||||
bool includeUpper = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.between(
|
||||
property: r'id',
|
||||
lower: lower,
|
||||
includeLower: includeLower,
|
||||
upper: upper,
|
||||
includeUpper: includeUpper,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterFilterCondition>
|
||||
isMnemonicVerifiedEqualTo(bool value) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.equalTo(
|
||||
property: r'isMnemonicVerified',
|
||||
value: value,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterFilterCondition>
|
||||
walletIdEqualTo(
|
||||
String value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.equalTo(
|
||||
property: r'walletId',
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterFilterCondition>
|
||||
walletIdGreaterThan(
|
||||
String value, {
|
||||
bool include = false,
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.greaterThan(
|
||||
include: include,
|
||||
property: r'walletId',
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterFilterCondition>
|
||||
walletIdLessThan(
|
||||
String value, {
|
||||
bool include = false,
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.lessThan(
|
||||
include: include,
|
||||
property: r'walletId',
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterFilterCondition>
|
||||
walletIdBetween(
|
||||
String lower,
|
||||
String upper, {
|
||||
bool includeLower = true,
|
||||
bool includeUpper = true,
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.between(
|
||||
property: r'walletId',
|
||||
lower: lower,
|
||||
includeLower: includeLower,
|
||||
upper: upper,
|
||||
includeUpper: includeUpper,
|
||||
caseSensitive: caseSensitive,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterFilterCondition>
|
||||
walletIdStartsWith(
|
||||
String value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.startsWith(
|
||||
property: r'walletId',
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterFilterCondition>
|
||||
walletIdEndsWith(
|
||||
String value, {
|
||||
bool caseSensitive = true,
|
||||
}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.endsWith(
|
||||
property: r'walletId',
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterFilterCondition>
|
||||
walletIdContains(String value, {bool caseSensitive = true}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.contains(
|
||||
property: r'walletId',
|
||||
value: value,
|
||||
caseSensitive: caseSensitive,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterFilterCondition>
|
||||
walletIdMatches(String pattern, {bool caseSensitive = true}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.matches(
|
||||
property: r'walletId',
|
||||
wildcard: pattern,
|
||||
caseSensitive: caseSensitive,
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterFilterCondition>
|
||||
walletIdIsEmpty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.equalTo(
|
||||
property: r'walletId',
|
||||
value: '',
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterFilterCondition>
|
||||
walletIdIsNotEmpty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.greaterThan(
|
||||
property: r'walletId',
|
||||
value: '',
|
||||
));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
extension WalletInfoMetaQueryObject
|
||||
on QueryBuilder<WalletInfoMeta, WalletInfoMeta, QFilterCondition> {}
|
||||
|
||||
extension WalletInfoMetaQueryLinks
|
||||
on QueryBuilder<WalletInfoMeta, WalletInfoMeta, QFilterCondition> {}
|
||||
|
||||
extension WalletInfoMetaQuerySortBy
|
||||
on QueryBuilder<WalletInfoMeta, WalletInfoMeta, QSortBy> {
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterSortBy>
|
||||
sortByIsMnemonicVerified() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(r'isMnemonicVerified', Sort.asc);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterSortBy>
|
||||
sortByIsMnemonicVerifiedDesc() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(r'isMnemonicVerified', Sort.desc);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterSortBy> sortByWalletId() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(r'walletId', Sort.asc);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterSortBy>
|
||||
sortByWalletIdDesc() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(r'walletId', Sort.desc);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
extension WalletInfoMetaQuerySortThenBy
|
||||
on QueryBuilder<WalletInfoMeta, WalletInfoMeta, QSortThenBy> {
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterSortBy> thenById() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(r'id', Sort.asc);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterSortBy> thenByIdDesc() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(r'id', Sort.desc);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterSortBy>
|
||||
thenByIsMnemonicVerified() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(r'isMnemonicVerified', Sort.asc);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterSortBy>
|
||||
thenByIsMnemonicVerifiedDesc() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(r'isMnemonicVerified', Sort.desc);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterSortBy> thenByWalletId() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(r'walletId', Sort.asc);
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QAfterSortBy>
|
||||
thenByWalletIdDesc() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addSortBy(r'walletId', Sort.desc);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
extension WalletInfoMetaQueryWhereDistinct
|
||||
on QueryBuilder<WalletInfoMeta, WalletInfoMeta, QDistinct> {
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QDistinct>
|
||||
distinctByIsMnemonicVerified() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addDistinctBy(r'isMnemonicVerified');
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, WalletInfoMeta, QDistinct> distinctByWalletId(
|
||||
{bool caseSensitive = true}) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addDistinctBy(r'walletId', caseSensitive: caseSensitive);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
extension WalletInfoMetaQueryProperty
|
||||
on QueryBuilder<WalletInfoMeta, WalletInfoMeta, QQueryProperty> {
|
||||
QueryBuilder<WalletInfoMeta, int, QQueryOperations> idProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addPropertyName(r'id');
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, bool, QQueryOperations>
|
||||
isMnemonicVerifiedProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addPropertyName(r'isMnemonicVerified');
|
||||
});
|
||||
}
|
||||
|
||||
QueryBuilder<WalletInfoMeta, String, QQueryOperations> walletIdProperty() {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addPropertyName(r'walletId');
|
||||
});
|
||||
}
|
||||
}
|
|
@ -180,11 +180,6 @@ class MockWallets extends _i1.Mock implements _i12.Wallets {
|
|||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
bool get hasWallets => (super.noSuchMethod(
|
||||
Invocation.getter(#hasWallets),
|
||||
returnValue: false,
|
||||
) as bool);
|
||||
@override
|
||||
List<_i5.Wallet<_i4.CryptoCurrency>> get wallets => (super.noSuchMethod(
|
||||
Invocation.getter(#wallets),
|
||||
returnValue: <_i5.Wallet<_i4.CryptoCurrency>>[],
|
||||
|
|
|
@ -180,11 +180,6 @@ class MockWallets extends _i1.Mock implements _i12.Wallets {
|
|||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
bool get hasWallets => (super.noSuchMethod(
|
||||
Invocation.getter(#hasWallets),
|
||||
returnValue: false,
|
||||
) as bool);
|
||||
@override
|
||||
List<_i5.Wallet<_i4.CryptoCurrency>> get wallets => (super.noSuchMethod(
|
||||
Invocation.getter(#wallets),
|
||||
returnValue: <_i5.Wallet<_i4.CryptoCurrency>>[],
|
||||
|
|
|
@ -145,11 +145,6 @@ class MockWallets extends _i1.Mock implements _i9.Wallets {
|
|||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
bool get hasWallets => (super.noSuchMethod(
|
||||
Invocation.getter(#hasWallets),
|
||||
returnValue: false,
|
||||
) as bool);
|
||||
@override
|
||||
List<_i5.Wallet<_i4.CryptoCurrency>> get wallets => (super.noSuchMethod(
|
||||
Invocation.getter(#wallets),
|
||||
returnValue: <_i5.Wallet<_i4.CryptoCurrency>>[],
|
||||
|
|
|
@ -152,11 +152,6 @@ class MockWallets extends _i1.Mock implements _i10.Wallets {
|
|||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
bool get hasWallets => (super.noSuchMethod(
|
||||
Invocation.getter(#hasWallets),
|
||||
returnValue: false,
|
||||
) as bool);
|
||||
@override
|
||||
List<_i5.Wallet<_i4.CryptoCurrency>> get wallets => (super.noSuchMethod(
|
||||
Invocation.getter(#wallets),
|
||||
returnValue: <_i5.Wallet<_i4.CryptoCurrency>>[],
|
||||
|
|
|
@ -217,11 +217,6 @@ class MockWallets extends _i1.Mock implements _i13.Wallets {
|
|||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
bool get hasWallets => (super.noSuchMethod(
|
||||
Invocation.getter(#hasWallets),
|
||||
returnValue: false,
|
||||
) as bool);
|
||||
@override
|
||||
List<_i5.Wallet<_i4.CryptoCurrency>> get wallets => (super.noSuchMethod(
|
||||
Invocation.getter(#wallets),
|
||||
returnValue: <_i5.Wallet<_i4.CryptoCurrency>>[],
|
||||
|
|
|
@ -116,11 +116,6 @@ class MockWallets extends _i1.Mock implements _i7.Wallets {
|
|||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
bool get hasWallets => (super.noSuchMethod(
|
||||
Invocation.getter(#hasWallets),
|
||||
returnValue: false,
|
||||
) as bool);
|
||||
@override
|
||||
List<_i5.Wallet<_i4.CryptoCurrency>> get wallets => (super.noSuchMethod(
|
||||
Invocation.getter(#wallets),
|
||||
returnValue: <_i5.Wallet<_i4.CryptoCurrency>>[],
|
||||
|
|
|
@ -150,11 +150,6 @@ class MockWallets extends _i1.Mock implements _i10.Wallets {
|
|||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
bool get hasWallets => (super.noSuchMethod(
|
||||
Invocation.getter(#hasWallets),
|
||||
returnValue: false,
|
||||
) as bool);
|
||||
@override
|
||||
List<_i5.Wallet<_i4.CryptoCurrency>> get wallets => (super.noSuchMethod(
|
||||
Invocation.getter(#wallets),
|
||||
returnValue: <_i5.Wallet<_i4.CryptoCurrency>>[],
|
||||
|
|
|
@ -164,11 +164,6 @@ class MockWallets extends _i1.Mock implements _i11.Wallets {
|
|||
returnValueForMissingStub: null,
|
||||
);
|
||||
@override
|
||||
bool get hasWallets => (super.noSuchMethod(
|
||||
Invocation.getter(#hasWallets),
|
||||
returnValue: false,
|
||||
) as bool);
|
||||
@override
|
||||
List<_i5.Wallet<_i4.CryptoCurrency>> get wallets => (super.noSuchMethod(
|
||||
Invocation.getter(#wallets),
|
||||
returnValue: <_i5.Wallet<_i4.CryptoCurrency>>[],
|
||||
|
|
Loading…
Reference in a new issue