diff --git a/android/build.gradle b/android/build.gradle index b309554fd..cd89d3a8b 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -2,11 +2,11 @@ buildscript { ext.kotlin_version = '1.7.20' repositories { google() - jcenter() + mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:4.1.2' + classpath 'com.android.tools.build:gradle:7.3.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -14,7 +14,7 @@ buildscript { allprojects { repositories { google() - jcenter() + mavenCentral() } } @@ -26,6 +26,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 562c5e444..6b665338b 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip diff --git a/crypto_plugins/flutter_libmonero b/crypto_plugins/flutter_libmonero index 0a9196aa4..a470c4a97 160000 --- a/crypto_plugins/flutter_libmonero +++ b/crypto_plugins/flutter_libmonero @@ -1 +1 @@ -Subproject commit 0a9196aa454c14c886b848add3911da2c91e90ba +Subproject commit a470c4a974f888eff04ed9d81d87365106675b01 diff --git a/lib/hive/db.dart b/lib/db/hive/db.dart similarity index 100% rename from lib/hive/db.dart rename to lib/db/hive/db.dart diff --git a/lib/db/main_db.dart b/lib/db/isar/main_db.dart similarity index 99% rename from lib/db/main_db.dart rename to lib/db/isar/main_db.dart index d6ad19275..761b378b7 100644 --- a/lib/db/main_db.dart +++ b/lib/db/isar/main_db.dart @@ -11,7 +11,7 @@ import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/stack_file_system.dart'; import 'package:tuple/tuple.dart'; -part 'queries/queries.dart'; +part '../queries/queries.dart'; class MainDB { MainDB._(); diff --git a/lib/db/queries/queries.dart b/lib/db/queries/queries.dart index bf7064d83..99f266973 100644 --- a/lib/db/queries/queries.dart +++ b/lib/db/queries/queries.dart @@ -1,4 +1,4 @@ -part of 'package:stackduo/db/main_db.dart'; +part of 'package:stackduo/db/isar/main_db.dart'; enum CCFilter { all, diff --git a/lib/electrumx_rpc/cached_electrumx.dart b/lib/electrumx_rpc/cached_electrumx.dart index 2ae26d847..7b1c8f76c 100644 --- a/lib/electrumx_rpc/cached_electrumx.dart +++ b/lib/electrumx_rpc/cached_electrumx.dart @@ -1,7 +1,7 @@ import 'dart:convert'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/electrumx_rpc/electrumx.dart'; -import 'package:stackduo/hive/db.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/logger.dart'; import 'package:string_validator/string_validator.dart'; @@ -86,8 +86,9 @@ class CachedElectrumX { key: groupId, value: set); Logging.instance.log( - "Updated currently anonymity set for ${coin.name} with group ID $groupId", - level: LogLevel.Info); + "Updated current anonymity set for ${coin.name} with group ID $groupId", + level: LogLevel.Info, + ); } return set; diff --git a/lib/electrumx_rpc/electrumx.dart b/lib/electrumx_rpc/electrumx.dart index 78adc6cd5..a6ac25897 100644 --- a/lib/electrumx_rpc/electrumx.dart +++ b/lib/electrumx_rpc/electrumx.dart @@ -150,7 +150,7 @@ class ElectrumX { "JSONRPC response\n" " command: $command\n" " args: $args\n" - " error: $response.data", + " error: ${response.data}", ); } @@ -567,8 +567,9 @@ class ElectrumX { bool verbose = true, String? requestID, }) async { + dynamic response; try { - final response = await request( + response = await request( requestID: requestID, command: 'blockchain.transaction.get', args: [ @@ -582,6 +583,10 @@ class ElectrumX { return Map.from(response["result"] as Map); } catch (e) { + Logging.instance.log( + "getTransaction($txHash) response: $response", + level: LogLevel.Error, + ); rethrow; } } diff --git a/lib/exceptions/sw_exception.dart b/lib/exceptions/sw_exception.dart index 34ab664f2..0296da10a 100644 --- a/lib/exceptions/sw_exception.dart +++ b/lib/exceptions/sw_exception.dart @@ -1,7 +1,7 @@ // generic stack wallet exception which all other custom exceptions should // extend from -class SWException with Exception { +class SWException implements Exception { SWException(this.message); final String message; diff --git a/lib/main.dart b/lib/main.dart index 2af01e602..f41e3d9da 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -17,8 +17,8 @@ import 'package:hive_flutter/hive_flutter.dart'; import 'package:isar/isar.dart'; import 'package:keyboard_dismisser/keyboard_dismisser.dart'; import 'package:path_provider/path_provider.dart'; -import 'package:stackduo/db/main_db.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/exchange/change_now/exchange_transaction.dart'; import 'package:stackduo/models/exchange/change_now/exchange_transaction_status.dart'; import 'package:stackduo/models/exchange/response_objects/trade.dart'; @@ -69,7 +69,7 @@ final openedFromSWBFileStringStateProvider = // runs the MyApp widget and checks for new users, caching the value in the // miscellaneous box for later use void main() async { - WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized(); + WidgetsFlutterBinding.ensureInitialized(); GoogleFonts.config.allowRuntimeFetching = false; if (Platform.isIOS) { Util.libraryPath = await getLibraryDirectory(); @@ -177,7 +177,9 @@ void main() async { } } - monero.onStartup(); + if (!Platform.isWindows) { + monero.onStartup(); + } // SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, // overlays: [SystemUiOverlay.bottom]); @@ -440,6 +442,12 @@ class _MaterialAppWithThemeState extends ConsumerState super.dispose(); } + @override + void didChangeLocales(List? locales) { + ref.read(localeServiceChangeNotifierProvider).loadLocale(); + super.didChangeLocales(locales); + } + @override void didChangeAppLifecycleState(AppLifecycleState state) async { debugPrint("didChangeAppLifecycleState: ${state.name}"); diff --git a/lib/models/add_wallet_list_entity/add_wallet_list_entity.dart b/lib/models/add_wallet_list_entity/add_wallet_list_entity.dart new file mode 100644 index 000000000..0e4c8d12d --- /dev/null +++ b/lib/models/add_wallet_list_entity/add_wallet_list_entity.dart @@ -0,0 +1,18 @@ +/* + * This file is part of Stack Wallet. + * + * Copyright (c) 2023 Cypher Stack + * All Rights Reserved. + * The code is distributed under GPLv3 license, see LICENSE file for details. + * Generated by Cypher Stack on 2023-05-26 + * + */ + +import 'package:equatable/equatable.dart'; +import 'package:stackduo/utilities/enums/coin_enum.dart'; + +abstract class AddWalletListEntity extends Equatable { + Coin get coin; + String get name; + String get ticker; +} diff --git a/lib/models/add_wallet_list_entity/sub_classes/coin_entity.dart b/lib/models/add_wallet_list_entity/sub_classes/coin_entity.dart new file mode 100644 index 000000000..50ced5c62 --- /dev/null +++ b/lib/models/add_wallet_list_entity/sub_classes/coin_entity.dart @@ -0,0 +1,30 @@ +/* + * This file is part of Stack Wallet. + * + * Copyright (c) 2023 Cypher Stack + * All Rights Reserved. + * The code is distributed under GPLv3 license, see LICENSE file for details. + * Generated by Cypher Stack on 2023-05-26 + * + */ + +import 'package:stackduo/models/add_wallet_list_entity/add_wallet_list_entity.dart'; +import 'package:stackduo/utilities/enums/coin_enum.dart'; + +class CoinEntity extends AddWalletListEntity { + CoinEntity(this._coin); + + final Coin _coin; + + @override + Coin get coin => _coin; + + @override + String get name => coin.prettyName; + + @override + String get ticker => coin.ticker; + + @override + List get props => [coin, name, ticker]; +} diff --git a/lib/models/isar/models/blockchain_data/address.dart b/lib/models/isar/models/blockchain_data/address.dart index 5b1c6e28c..b6b186c76 100644 --- a/lib/models/isar/models/blockchain_data/address.dart +++ b/lib/models/isar/models/blockchain_data/address.dart @@ -122,7 +122,10 @@ enum AddressType { cryptonote, mimbleWimble, unknown, - nonWallet; + nonWallet, + ethereum, + nano, + banano; String get readableName { switch (this) { @@ -140,6 +143,12 @@ enum AddressType { return "Unknown"; case AddressType.nonWallet: return "Non wallet/unknown"; + case AddressType.ethereum: + return "Ethereum"; + case AddressType.nano: + return "Nano"; + case AddressType.banano: + return "Banano"; } } } diff --git a/lib/models/isar/models/blockchain_data/address.g.dart b/lib/models/isar/models/blockchain_data/address.g.dart index 37186584b..356904d2c 100644 --- a/lib/models/isar/models/blockchain_data/address.g.dart +++ b/lib/models/isar/models/blockchain_data/address.g.dart @@ -260,6 +260,9 @@ const _AddresstypeEnumValueMap = { 'mimbleWimble': 4, 'unknown': 5, 'nonWallet': 6, + 'ethereum': 7, + 'nano': 8, + 'banano': 9, }; const _AddresstypeValueEnumMap = { 0: AddressType.p2pkh, @@ -269,6 +272,9 @@ const _AddresstypeValueEnumMap = { 4: AddressType.mimbleWimble, 5: AddressType.unknown, 6: AddressType.nonWallet, + 7: AddressType.ethereum, + 8: AddressType.nano, + 9: AddressType.banano, }; Id _addressGetId(Address object) { diff --git a/lib/models/isar/models/blockchain_data/transaction.dart b/lib/models/isar/models/blockchain_data/transaction.dart index 70322d385..3b22287f4 100644 --- a/lib/models/isar/models/blockchain_data/transaction.dart +++ b/lib/models/isar/models/blockchain_data/transaction.dart @@ -12,6 +12,7 @@ part 'transaction.g.dart'; @Collection() class Transaction { + Transaction({ required this.walletId, required this.txid, @@ -29,6 +30,7 @@ class Transaction { required this.inputs, required this.outputs, required this.nonce, + required this.numberOfMessages, }); Tuple2 copyWith({ @@ -50,6 +52,7 @@ class Transaction { int? nonce, Id? id, Address? address, + int? numberOfMessages, }) { return Tuple2( Transaction( @@ -68,7 +71,8 @@ class Transaction { otherData: otherData ?? this.otherData, nonce: nonce ?? this.nonce, inputs: inputs ?? this.inputs, - outputs: outputs ?? this.outputs) + outputs: outputs ?? this.outputs, + numberOfMessages: numberOfMessages ?? this.numberOfMessages) ..id = id ?? this.id, address ?? this.address.value, ); @@ -114,6 +118,8 @@ class Transaction { late final List outputs; + late final int? numberOfMessages; + @Backlink(to: "transactions") final address = IsarLink
(); @@ -154,6 +160,7 @@ class Transaction { "address: ${address.value}, " "inputsLength: ${inputs.length}, " "outputsLength: ${outputs.length}, " + "numberOfMessages: $numberOfMessages, " "}"; String toJsonString() { @@ -175,6 +182,7 @@ class Transaction { "address": address.value?.toJsonString(), "inputs": inputs.map((e) => e.toJsonString()).toList(), "outputs": outputs.map((e) => e.toJsonString()).toList(), + "numberOfMessages": numberOfMessages, }; return jsonEncode(result); } @@ -205,6 +213,7 @@ class Transaction { outputs: List.from(json["outputs"] as List) .map((e) => Output.fromJsonString(e)) .toList(), + numberOfMessages: json["numberOfMessages"] as int, ); if (json["address"] == null) { return Tuple2(transaction, null); diff --git a/lib/models/isar/models/blockchain_data/transaction.g.dart b/lib/models/isar/models/blockchain_data/transaction.g.dart index 74a5a1652..c11649ddb 100644 --- a/lib/models/isar/models/blockchain_data/transaction.g.dart +++ b/lib/models/isar/models/blockchain_data/transaction.g.dart @@ -58,46 +58,51 @@ const TransactionSchema = CollectionSchema( name: r'nonce', type: IsarType.long, ), - r'otherData': PropertySchema( + r'numberOfMessages': PropertySchema( id: 8, + name: r'numberOfMessages', + type: IsarType.long, + ), + r'otherData': PropertySchema( + id: 9, name: r'otherData', type: IsarType.string, ), r'outputs': PropertySchema( - id: 9, + id: 10, name: r'outputs', type: IsarType.objectList, target: r'Output', ), r'slateId': PropertySchema( - id: 10, + id: 11, name: r'slateId', type: IsarType.string, ), r'subType': PropertySchema( - id: 11, + id: 12, name: r'subType', type: IsarType.byte, enumMap: _TransactionsubTypeEnumValueMap, ), r'timestamp': PropertySchema( - id: 12, + id: 13, name: r'timestamp', type: IsarType.long, ), r'txid': PropertySchema( - id: 13, + id: 14, name: r'txid', type: IsarType.string, ), r'type': PropertySchema( - id: 14, + id: 15, name: r'type', type: IsarType.byte, enumMap: _TransactiontypeEnumValueMap, ), r'walletId': PropertySchema( - id: 15, + id: 16, name: r'walletId', type: IsarType.string, ) @@ -233,19 +238,20 @@ void _transactionSerialize( writer.writeBool(offsets[5], object.isCancelled); writer.writeBool(offsets[6], object.isLelantus); writer.writeLong(offsets[7], object.nonce); - writer.writeString(offsets[8], object.otherData); + writer.writeLong(offsets[8], object.numberOfMessages); + writer.writeString(offsets[9], object.otherData); writer.writeObjectList( - offsets[9], + offsets[10], allOffsets, OutputSchema.serialize, object.outputs, ); - writer.writeString(offsets[10], object.slateId); - writer.writeByte(offsets[11], object.subType.index); - writer.writeLong(offsets[12], object.timestamp); - writer.writeString(offsets[13], object.txid); - writer.writeByte(offsets[14], object.type.index); - writer.writeString(offsets[15], object.walletId); + writer.writeString(offsets[11], object.slateId); + writer.writeByte(offsets[12], object.subType.index); + writer.writeLong(offsets[13], object.timestamp); + writer.writeString(offsets[14], object.txid); + writer.writeByte(offsets[15], object.type.index); + writer.writeString(offsets[16], object.walletId); } Transaction _transactionDeserialize( @@ -269,23 +275,24 @@ Transaction _transactionDeserialize( isCancelled: reader.readBool(offsets[5]), isLelantus: reader.readBoolOrNull(offsets[6]), nonce: reader.readLongOrNull(offsets[7]), - otherData: reader.readStringOrNull(offsets[8]), + numberOfMessages: reader.readLongOrNull(offsets[8]), + otherData: reader.readStringOrNull(offsets[9]), outputs: reader.readObjectList( - offsets[9], + offsets[10], OutputSchema.deserialize, allOffsets, Output(), ) ?? [], - slateId: reader.readStringOrNull(offsets[10]), + slateId: reader.readStringOrNull(offsets[11]), subType: - _TransactionsubTypeValueEnumMap[reader.readByteOrNull(offsets[11])] ?? + _TransactionsubTypeValueEnumMap[reader.readByteOrNull(offsets[12])] ?? TransactionSubType.none, - timestamp: reader.readLong(offsets[12]), - txid: reader.readString(offsets[13]), - type: _TransactiontypeValueEnumMap[reader.readByteOrNull(offsets[14])] ?? + timestamp: reader.readLong(offsets[13]), + txid: reader.readString(offsets[14]), + type: _TransactiontypeValueEnumMap[reader.readByteOrNull(offsets[15])] ?? TransactionType.outgoing, - walletId: reader.readString(offsets[15]), + walletId: reader.readString(offsets[16]), ); object.id = id; return object; @@ -321,8 +328,10 @@ P _transactionDeserializeProp

( case 7: return (reader.readLongOrNull(offset)) as P; case 8: - return (reader.readStringOrNull(offset)) as P; + return (reader.readLongOrNull(offset)) as P; case 9: + return (reader.readStringOrNull(offset)) as P; + case 10: return (reader.readObjectList( offset, OutputSchema.deserialize, @@ -330,19 +339,19 @@ P _transactionDeserializeProp

( Output(), ) ?? []) as P; - case 10: - return (reader.readStringOrNull(offset)) as P; case 11: + return (reader.readStringOrNull(offset)) as P; + case 12: return (_TransactionsubTypeValueEnumMap[reader.readByteOrNull(offset)] ?? TransactionSubType.none) as P; - case 12: - return (reader.readLong(offset)) as P; case 13: - return (reader.readString(offset)) as P; + return (reader.readLong(offset)) as P; case 14: + return (reader.readString(offset)) as P; + case 15: return (_TransactiontypeValueEnumMap[reader.readByteOrNull(offset)] ?? TransactionType.outgoing) as P; - case 15: + case 16: return (reader.readString(offset)) as P; default: throw IsarError('Unknown property with id $propertyId'); @@ -1374,6 +1383,80 @@ extension TransactionQueryFilter }); } + QueryBuilder + numberOfMessagesIsNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNull( + property: r'numberOfMessages', + )); + }); + } + + QueryBuilder + numberOfMessagesIsNotNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNotNull( + property: r'numberOfMessages', + )); + }); + } + + QueryBuilder + numberOfMessagesEqualTo(int? value) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'numberOfMessages', + value: value, + )); + }); + } + + QueryBuilder + numberOfMessagesGreaterThan( + int? value, { + bool include = false, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'numberOfMessages', + value: value, + )); + }); + } + + QueryBuilder + numberOfMessagesLessThan( + int? value, { + bool include = false, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'numberOfMessages', + value: value, + )); + }); + } + + QueryBuilder + numberOfMessagesBetween( + int? lower, + int? upper, { + bool includeLower = true, + bool includeUpper = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.between( + property: r'numberOfMessages', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + )); + }); + } + QueryBuilder otherDataIsNull() { return QueryBuilder.apply(this, (query) { @@ -2320,6 +2403,20 @@ extension TransactionQuerySortBy }); } + QueryBuilder + sortByNumberOfMessages() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'numberOfMessages', Sort.asc); + }); + } + + QueryBuilder + sortByNumberOfMessagesDesc() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'numberOfMessages', Sort.desc); + }); + } + QueryBuilder sortByOtherData() { return QueryBuilder.apply(this, (query) { return query.addSortBy(r'otherData', Sort.asc); @@ -2504,6 +2601,20 @@ extension TransactionQuerySortThenBy }); } + QueryBuilder + thenByNumberOfMessages() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'numberOfMessages', Sort.asc); + }); + } + + QueryBuilder + thenByNumberOfMessagesDesc() { + return QueryBuilder.apply(this, (query) { + return query.addSortBy(r'numberOfMessages', Sort.desc); + }); + } + QueryBuilder thenByOtherData() { return QueryBuilder.apply(this, (query) { return query.addSortBy(r'otherData', Sort.asc); @@ -2634,6 +2745,13 @@ extension TransactionQueryWhereDistinct }); } + QueryBuilder + distinctByNumberOfMessages() { + return QueryBuilder.apply(this, (query) { + return query.addDistinctBy(r'numberOfMessages'); + }); + } + QueryBuilder distinctByOtherData( {bool caseSensitive = true}) { return QueryBuilder.apply(this, (query) { @@ -2737,6 +2855,12 @@ extension TransactionQueryProperty }); } + QueryBuilder numberOfMessagesProperty() { + return QueryBuilder.apply(this, (query) { + return query.addPropertyName(r'numberOfMessages'); + }); + } + QueryBuilder otherDataProperty() { return QueryBuilder.apply(this, (query) { return query.addPropertyName(r'otherData'); diff --git a/lib/models/isar/stack_theme.dart b/lib/models/isar/stack_theme.dart index a76be7ad9..7c4a2c930 100644 --- a/lib/models/isar/stack_theme.dart +++ b/lib/models/isar/stack_theme.dart @@ -1483,8 +1483,12 @@ class StackTheme { late final ThemeAssetsV2? assetsV2; + // cheat build runner into adding this at end of property id list in isar + @Name("zAssetsV3") + late final ThemeAssetsV3? assetsV3; + @ignore - IThemeAssets get assets => assetsV2 ?? assetsV1!; + IThemeAssets get assets => assetsV3 ?? assetsV2 ?? assetsV1!; // =========================================================================== @@ -1507,13 +1511,20 @@ class StackTheme { themeId: json["id"] as String, ) : null - ..assetsV2 = version >= 2 + ..assetsV2 = version == 2 ? ThemeAssetsV2.fromJson( json: Map.from(json["assets"] as Map), applicationThemesDirectoryPath: applicationThemesDirectoryPath, themeId: json["id"] as String, ) : null + ..assetsV3 = version >= 3 + ? ThemeAssetsV3.fromJson( + json: Map.from(json["assets"] as Map), + applicationThemesDirectoryPath: applicationThemesDirectoryPath, + themeId: json["id"] as String, + ) + : null ..themeId = json["id"] as String ..name = json["name"] as String ..brightnessString = json["brightness"] as String @@ -1866,11 +1877,8 @@ class ThemeAssets implements IThemeAssets { late final String personaEasy; @override late final String stack; - @override - @Deprecated("Use assets.dart's appIcon()") late final String stackIcon; - @override late final String receive; @override @@ -1932,8 +1940,6 @@ class ThemeAssets implements IThemeAssets { @override late final String? background; - // todo: add all assets expected in json - ThemeAssets(); factory ThemeAssets.fromJson({ @@ -2215,6 +2221,261 @@ class ThemeAssetsV2 implements IThemeAssets { return result; } + + @override + String toString() { + return 'ThemeAssetsV2(' + 'bellNew: $bellNew, ' + 'buy: $buy, ' + 'exchange: $exchange, ' + 'personaIncognito: $personaIncognito, ' + 'personaEasy: $personaEasy, ' + 'stack: $stack, ' + 'stackIcon: $stackIcon, ' + 'receive: $receive, ' + 'receivePending: $receivePending, ' + 'receiveCancelled: $receiveCancelled, ' + 'send: $send, ' + 'sendPending: $sendPending, ' + 'sendCancelled: $sendCancelled, ' + 'themeSelector: $themeSelector, ' + 'themePreview: $themePreview, ' + 'txExchange: $txExchange, ' + 'txExchangePending: $txExchangePending, ' + 'txExchangeFailed: $txExchangeFailed, ' + 'loadingGif: $loadingGif, ' + 'background: $background, ' + 'coinPlaceholder: $coinPlaceholder, ' + 'coinIcons: $coinIcons, ' + 'coinImages: $coinImages, ' + 'coinSecondaryImages: $coinSecondaryImages, ' + ')'; + } +} + +@Embedded(inheritance: false) +class ThemeAssetsV3 implements IThemeAssets { + @override + late final String bellNew; + @override + late final String buy; + @override + late final String exchange; + @override + late final String personaIncognito; + @override + late final String personaEasy; + @override + late final String stack; + @override + late final String stackIcon; + @override + late final String receive; + @override + late final String receivePending; + @override + late final String receiveCancelled; + @override + late final String send; + @override + late final String sendPending; + @override + late final String sendCancelled; + @override + late final String themeSelector; + @override + late final String themePreview; + @override + late final String txExchange; + @override + late final String txExchangePending; + @override + late final String txExchangeFailed; + @override + late final String? loadingGif; + @override + late final String? background; + + late final String coinPlaceholder; + + // Added some future proof params in case we want to add anything else + // This should provide some buffer in stead of creating assetsV4 etc + @Name("otherStringParam1") + late final String? dummy1; + @Name("otherStringParam2") + late final String? dummy2; + @Name("otherStringParam3") + late final String? dummy3; + + @ignore + Map get coinIcons => _coinIcons ??= parseCoinAssetsString( + coinIconsString, + placeHolder: coinPlaceholder, + ); + @ignore + Map? _coinIcons; + late final String coinIconsString; + + @ignore + Map get coinImages => _coinImages ??= parseCoinAssetsString( + coinImagesString, + placeHolder: coinPlaceholder, + ); + @ignore + Map? _coinImages; + late final String coinImagesString; + + @ignore + Map get coinSecondaryImages => + _coinSecondaryImages ??= parseCoinAssetsString( + coinSecondaryImagesString, + placeHolder: coinPlaceholder, + ); + @ignore + Map? _coinSecondaryImages; + late final String coinSecondaryImagesString; + + @ignore + Map? get coinCardImages => + _coinCardImages ??= coinCardImagesString == null + ? null + : parseCoinAssetsString( + coinCardImagesString!, + placeHolder: coinPlaceholder, + ); + @ignore + Map? _coinCardImages; + late final String? coinCardImagesString; + + ThemeAssetsV3(); + + factory ThemeAssetsV3.fromJson({ + required Map json, + required String applicationThemesDirectoryPath, + required String themeId, + }) { + return ThemeAssetsV3() + ..bellNew = + "$applicationThemesDirectoryPath/$themeId/assets/${json["bell_new"] as String}" + ..buy = + "$applicationThemesDirectoryPath/$themeId/assets/${json["buy"] as String}" + ..exchange = + "$applicationThemesDirectoryPath/$themeId/assets/${json["exchange"] as String}" + ..personaIncognito = + "$applicationThemesDirectoryPath/$themeId/assets/${json["persona_incognito"] as String}" + ..personaEasy = + "$applicationThemesDirectoryPath/$themeId/assets/${json["persona_easy"] as String}" + ..stack = + "$applicationThemesDirectoryPath/$themeId/assets/${json["stack"] as String}" + ..stackIcon = + "$applicationThemesDirectoryPath/$themeId/assets/${json["stack_icon"] as String}" + ..receive = + "$applicationThemesDirectoryPath/$themeId/assets/${json["receive"] as String}" + ..receivePending = + "$applicationThemesDirectoryPath/$themeId/assets/${json["receive_pending"] as String}" + ..receiveCancelled = + "$applicationThemesDirectoryPath/$themeId/assets/${json["receive_cancelled"] as String}" + ..send = + "$applicationThemesDirectoryPath/$themeId/assets/${json["send"] as String}" + ..sendPending = + "$applicationThemesDirectoryPath/$themeId/assets/${json["send_pending"] as String}" + ..sendCancelled = + "$applicationThemesDirectoryPath/$themeId/assets/${json["send_cancelled"] as String}" + ..themeSelector = + "$applicationThemesDirectoryPath/$themeId/assets/${json["theme_selector"] as String}" + ..themePreview = + "$applicationThemesDirectoryPath/$themeId/assets/${json["theme_preview"] as String}" + ..txExchange = + "$applicationThemesDirectoryPath/$themeId/assets/${json["tx_exchange"] as String}" + ..txExchangePending = + "$applicationThemesDirectoryPath/$themeId/assets/${json["tx_exchange_pending"] as String}" + ..txExchangeFailed = + "$applicationThemesDirectoryPath/$themeId/assets/${json["tx_exchange_failed"] as String}" + ..coinPlaceholder = + "$applicationThemesDirectoryPath/$themeId/assets/${json["coin_placeholder"] as String}" + ..coinIconsString = createCoinAssetsString( + "$applicationThemesDirectoryPath/$themeId/assets", + Map.from(json["coins"]["icons"] as Map), + ) + ..coinImagesString = createCoinAssetsString( + "$applicationThemesDirectoryPath/$themeId/assets", + Map.from(json["coins"]["images"] as Map), + ) + ..coinSecondaryImagesString = createCoinAssetsString( + "$applicationThemesDirectoryPath/$themeId/assets", + Map.from(json["coins"]["secondaries"] as Map), + ) + ..coinCardImagesString = json["coins"]["cards"] is Map + ? createCoinAssetsString( + "$applicationThemesDirectoryPath/$themeId/assets", + Map.from(json["coins"]["cards"] as Map), + ) + : null + ..loadingGif = json["loading_gif"] is String + ? "$applicationThemesDirectoryPath/$themeId/assets/${json["loading_gif"] as String}" + : null + ..background = json["background"] is String + ? "$applicationThemesDirectoryPath/$themeId/assets/${json["background"] as String}" + : null + ..dummy1 = null + ..dummy2 = null + ..dummy3 = null; + } + + static String createCoinAssetsString(String path, Map json) { + final Map map = {}; + for (final entry in json.entries) { + map[entry.key] = "$path/${entry.value as String}"; + } + return jsonEncode(map); + } + + static Map parseCoinAssetsString( + String jsonString, { + required String placeHolder, + }) { + final json = jsonDecode(jsonString) as Map; + final map = Map.from(json); + + final Map result = {}; + + for (final coin in Coin.values) { + result[coin] = map[coin.name] as String? ?? placeHolder; + } + + return result; + } + + @override + String toString() { + return 'ThemeAssetsV3(' + 'bellNew: $bellNew, ' + 'buy: $buy, ' + 'exchange: $exchange, ' + 'personaIncognito: $personaIncognito, ' + 'personaEasy: $personaEasy, ' + 'stack: $stack, ' + 'stackIcon: $stackIcon, ' + 'receive: $receive, ' + 'receivePending: $receivePending, ' + 'receiveCancelled: $receiveCancelled, ' + 'send: $send, ' + 'sendPending: $sendPending, ' + 'sendCancelled: $sendCancelled, ' + 'themeSelector: $themeSelector, ' + 'themePreview: $themePreview, ' + 'txExchange: $txExchange, ' + 'txExchangePending: $txExchangePending, ' + 'txExchangeFailed: $txExchangeFailed, ' + 'loadingGif: $loadingGif, ' + 'background: $background, ' + 'coinPlaceholder: $coinPlaceholder, ' + 'coinIcons: $coinIcons, ' + 'coinImages: $coinImages, ' + 'coinSecondaryImages: $coinSecondaryImages, ' + 'coinCardImages: $coinCardImages' + ')'; + } } abstract class IThemeAssets { diff --git a/lib/models/isar/stack_theme.g.dart b/lib/models/isar/stack_theme.g.dart index ad6f905bd..e1bb0a549 100644 --- a/lib/models/isar/stack_theme.g.dart +++ b/lib/models/isar/stack_theme.g.dart @@ -823,6 +823,12 @@ const StackThemeSchema = CollectionSchema( id: 160, name: r'warningForegroundInt', type: IsarType.long, + ), + r'zAssetsV3': PropertySchema( + id: 161, + name: r'zAssetsV3', + type: IsarType.object, + target: r'ThemeAssetsV3', ) }, estimateSize: _stackThemeEstimateSize, @@ -848,7 +854,8 @@ const StackThemeSchema = CollectionSchema( links: {}, embeddedSchemas: { r'ThemeAssets': ThemeAssetsSchema, - r'ThemeAssetsV2': ThemeAssetsV2Schema + r'ThemeAssetsV2': ThemeAssetsV2Schema, + r'ThemeAssetsV3': ThemeAssetsV3Schema }, getId: _stackThemeGetId, getLinks: _stackThemeGetLinks, @@ -895,6 +902,14 @@ int _stackThemeEstimateSize( bytesCount += 3 + object.name.length * 3; bytesCount += 3 + object.standardBoxShadowString.length * 3; bytesCount += 3 + object.themeId.length * 3; + { + final value = object.assetsV3; + if (value != null) { + bytesCount += 3 + + ThemeAssetsV3Schema.estimateSize( + value, allOffsets[ThemeAssetsV3]!, allOffsets); + } + } return bytesCount; } @@ -1075,6 +1090,12 @@ void _stackThemeSerialize( writer.writeLong(offsets[158], object.version); writer.writeLong(offsets[159], object.warningBackgroundInt); writer.writeLong(offsets[160], object.warningForegroundInt); + writer.writeObject( + offsets[161], + allOffsets, + ThemeAssetsV3Schema.serialize, + object.assetsV3, + ); } StackTheme _stackThemeDeserialize( @@ -1255,6 +1276,11 @@ StackTheme _stackThemeDeserialize( object.version = reader.readLongOrNull(offsets[158]); object.warningBackgroundInt = reader.readLong(offsets[159]); object.warningForegroundInt = reader.readLong(offsets[160]); + object.assetsV3 = reader.readObjectOrNull( + offsets[161], + ThemeAssetsV3Schema.deserialize, + allOffsets, + ); return object; } @@ -1595,6 +1621,12 @@ P _stackThemeDeserializeProp

( return (reader.readLong(offset)) as P; case 160: return (reader.readLong(offset)) as P; + case 161: + return (reader.readObjectOrNull( + offset, + ThemeAssetsV3Schema.deserialize, + allOffsets, + )) as P; default: throw IsarError('Unknown property with id $propertyId'); } @@ -11382,6 +11414,23 @@ extension StackThemeQueryFilter )); }); } + + QueryBuilder assetsV3IsNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNull( + property: r'zAssetsV3', + )); + }); + } + + QueryBuilder + assetsV3IsNotNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNotNull( + property: r'zAssetsV3', + )); + }); + } } extension StackThemeQueryObject @@ -11399,6 +11448,13 @@ extension StackThemeQueryObject return query.object(q, r'assetsV2'); }); } + + QueryBuilder assetsV3( + FilterQuery q) { + return QueryBuilder.apply(this, (query) { + return query.object(q, r'zAssetsV3'); + }); + } } extension StackThemeQueryLinks @@ -17942,6 +17998,13 @@ extension StackThemeQueryProperty return query.addPropertyName(r'warningForegroundInt'); }); } + + QueryBuilder + assetsV3Property() { + return QueryBuilder.apply(this, (query) { + return query.addPropertyName(r'zAssetsV3'); + }); + } } // ************************************************************************** @@ -29376,3 +29439,4287 @@ extension ThemeAssetsV2QueryFilter extension ThemeAssetsV2QueryObject on QueryBuilder {} + +// 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 + +const ThemeAssetsV3Schema = Schema( + name: r'ThemeAssetsV3', + id: -8828098514594684151, + properties: { + r'background': PropertySchema( + id: 0, + name: r'background', + type: IsarType.string, + ), + r'bellNew': PropertySchema( + id: 1, + name: r'bellNew', + type: IsarType.string, + ), + r'buy': PropertySchema( + id: 2, + name: r'buy', + type: IsarType.string, + ), + r'coinCardImagesString': PropertySchema( + id: 3, + name: r'coinCardImagesString', + type: IsarType.string, + ), + r'coinIconsString': PropertySchema( + id: 4, + name: r'coinIconsString', + type: IsarType.string, + ), + r'coinImagesString': PropertySchema( + id: 5, + name: r'coinImagesString', + type: IsarType.string, + ), + r'coinPlaceholder': PropertySchema( + id: 6, + name: r'coinPlaceholder', + type: IsarType.string, + ), + r'coinSecondaryImagesString': PropertySchema( + id: 7, + name: r'coinSecondaryImagesString', + type: IsarType.string, + ), + r'exchange': PropertySchema( + id: 8, + name: r'exchange', + type: IsarType.string, + ), + r'loadingGif': PropertySchema( + id: 9, + name: r'loadingGif', + type: IsarType.string, + ), + r'otherStringParam1': PropertySchema( + id: 10, + name: r'otherStringParam1', + type: IsarType.string, + ), + r'otherStringParam2': PropertySchema( + id: 11, + name: r'otherStringParam2', + type: IsarType.string, + ), + r'otherStringParam3': PropertySchema( + id: 12, + name: r'otherStringParam3', + type: IsarType.string, + ), + r'personaEasy': PropertySchema( + id: 13, + name: r'personaEasy', + type: IsarType.string, + ), + r'personaIncognito': PropertySchema( + id: 14, + name: r'personaIncognito', + type: IsarType.string, + ), + r'receive': PropertySchema( + id: 15, + name: r'receive', + type: IsarType.string, + ), + r'receiveCancelled': PropertySchema( + id: 16, + name: r'receiveCancelled', + type: IsarType.string, + ), + r'receivePending': PropertySchema( + id: 17, + name: r'receivePending', + type: IsarType.string, + ), + r'send': PropertySchema( + id: 18, + name: r'send', + type: IsarType.string, + ), + r'sendCancelled': PropertySchema( + id: 19, + name: r'sendCancelled', + type: IsarType.string, + ), + r'sendPending': PropertySchema( + id: 20, + name: r'sendPending', + type: IsarType.string, + ), + r'stack': PropertySchema( + id: 21, + name: r'stack', + type: IsarType.string, + ), + r'stackIcon': PropertySchema( + id: 22, + name: r'stackIcon', + type: IsarType.string, + ), + r'themePreview': PropertySchema( + id: 23, + name: r'themePreview', + type: IsarType.string, + ), + r'themeSelector': PropertySchema( + id: 24, + name: r'themeSelector', + type: IsarType.string, + ), + r'txExchange': PropertySchema( + id: 25, + name: r'txExchange', + type: IsarType.string, + ), + r'txExchangeFailed': PropertySchema( + id: 26, + name: r'txExchangeFailed', + type: IsarType.string, + ), + r'txExchangePending': PropertySchema( + id: 27, + name: r'txExchangePending', + type: IsarType.string, + ) + }, + estimateSize: _themeAssetsV3EstimateSize, + serialize: _themeAssetsV3Serialize, + deserialize: _themeAssetsV3Deserialize, + deserializeProp: _themeAssetsV3DeserializeProp, +); + +int _themeAssetsV3EstimateSize( + ThemeAssetsV3 object, + List offsets, + Map> allOffsets, +) { + var bytesCount = offsets.last; + { + final value = object.background; + if (value != null) { + bytesCount += 3 + value.length * 3; + } + } + bytesCount += 3 + object.bellNew.length * 3; + bytesCount += 3 + object.buy.length * 3; + { + final value = object.coinCardImagesString; + if (value != null) { + bytesCount += 3 + value.length * 3; + } + } + bytesCount += 3 + object.coinIconsString.length * 3; + bytesCount += 3 + object.coinImagesString.length * 3; + bytesCount += 3 + object.coinPlaceholder.length * 3; + bytesCount += 3 + object.coinSecondaryImagesString.length * 3; + bytesCount += 3 + object.exchange.length * 3; + { + final value = object.loadingGif; + if (value != null) { + bytesCount += 3 + value.length * 3; + } + } + { + final value = object.dummy1; + if (value != null) { + bytesCount += 3 + value.length * 3; + } + } + { + final value = object.dummy2; + if (value != null) { + bytesCount += 3 + value.length * 3; + } + } + { + final value = object.dummy3; + if (value != null) { + bytesCount += 3 + value.length * 3; + } + } + bytesCount += 3 + object.personaEasy.length * 3; + bytesCount += 3 + object.personaIncognito.length * 3; + bytesCount += 3 + object.receive.length * 3; + bytesCount += 3 + object.receiveCancelled.length * 3; + bytesCount += 3 + object.receivePending.length * 3; + bytesCount += 3 + object.send.length * 3; + bytesCount += 3 + object.sendCancelled.length * 3; + bytesCount += 3 + object.sendPending.length * 3; + bytesCount += 3 + object.stack.length * 3; + bytesCount += 3 + object.stackIcon.length * 3; + bytesCount += 3 + object.themePreview.length * 3; + bytesCount += 3 + object.themeSelector.length * 3; + bytesCount += 3 + object.txExchange.length * 3; + bytesCount += 3 + object.txExchangeFailed.length * 3; + bytesCount += 3 + object.txExchangePending.length * 3; + return bytesCount; +} + +void _themeAssetsV3Serialize( + ThemeAssetsV3 object, + IsarWriter writer, + List offsets, + Map> allOffsets, +) { + writer.writeString(offsets[0], object.background); + writer.writeString(offsets[1], object.bellNew); + writer.writeString(offsets[2], object.buy); + writer.writeString(offsets[3], object.coinCardImagesString); + writer.writeString(offsets[4], object.coinIconsString); + writer.writeString(offsets[5], object.coinImagesString); + writer.writeString(offsets[6], object.coinPlaceholder); + writer.writeString(offsets[7], object.coinSecondaryImagesString); + writer.writeString(offsets[8], object.exchange); + writer.writeString(offsets[9], object.loadingGif); + writer.writeString(offsets[10], object.dummy1); + writer.writeString(offsets[11], object.dummy2); + writer.writeString(offsets[12], object.dummy3); + writer.writeString(offsets[13], object.personaEasy); + writer.writeString(offsets[14], object.personaIncognito); + writer.writeString(offsets[15], object.receive); + writer.writeString(offsets[16], object.receiveCancelled); + writer.writeString(offsets[17], object.receivePending); + writer.writeString(offsets[18], object.send); + writer.writeString(offsets[19], object.sendCancelled); + writer.writeString(offsets[20], object.sendPending); + writer.writeString(offsets[21], object.stack); + writer.writeString(offsets[22], object.stackIcon); + writer.writeString(offsets[23], object.themePreview); + writer.writeString(offsets[24], object.themeSelector); + writer.writeString(offsets[25], object.txExchange); + writer.writeString(offsets[26], object.txExchangeFailed); + writer.writeString(offsets[27], object.txExchangePending); +} + +ThemeAssetsV3 _themeAssetsV3Deserialize( + Id id, + IsarReader reader, + List offsets, + Map> allOffsets, +) { + final object = ThemeAssetsV3(); + object.background = reader.readStringOrNull(offsets[0]); + object.bellNew = reader.readString(offsets[1]); + object.buy = reader.readString(offsets[2]); + object.coinCardImagesString = reader.readStringOrNull(offsets[3]); + object.coinIconsString = reader.readString(offsets[4]); + object.coinImagesString = reader.readString(offsets[5]); + object.coinPlaceholder = reader.readString(offsets[6]); + object.coinSecondaryImagesString = reader.readString(offsets[7]); + object.exchange = reader.readString(offsets[8]); + object.loadingGif = reader.readStringOrNull(offsets[9]); + object.dummy1 = reader.readStringOrNull(offsets[10]); + object.dummy2 = reader.readStringOrNull(offsets[11]); + object.dummy3 = reader.readStringOrNull(offsets[12]); + object.personaEasy = reader.readString(offsets[13]); + object.personaIncognito = reader.readString(offsets[14]); + object.receive = reader.readString(offsets[15]); + object.receiveCancelled = reader.readString(offsets[16]); + object.receivePending = reader.readString(offsets[17]); + object.send = reader.readString(offsets[18]); + object.sendCancelled = reader.readString(offsets[19]); + object.sendPending = reader.readString(offsets[20]); + object.stack = reader.readString(offsets[21]); + object.stackIcon = reader.readString(offsets[22]); + object.themePreview = reader.readString(offsets[23]); + object.themeSelector = reader.readString(offsets[24]); + object.txExchange = reader.readString(offsets[25]); + object.txExchangeFailed = reader.readString(offsets[26]); + object.txExchangePending = reader.readString(offsets[27]); + return object; +} + +P _themeAssetsV3DeserializeProp

( + IsarReader reader, + int propertyId, + int offset, + Map> allOffsets, +) { + switch (propertyId) { + case 0: + return (reader.readStringOrNull(offset)) as P; + case 1: + return (reader.readString(offset)) as P; + case 2: + return (reader.readString(offset)) as P; + case 3: + return (reader.readStringOrNull(offset)) as P; + case 4: + return (reader.readString(offset)) as P; + case 5: + return (reader.readString(offset)) as P; + case 6: + return (reader.readString(offset)) as P; + case 7: + return (reader.readString(offset)) as P; + case 8: + return (reader.readString(offset)) as P; + case 9: + return (reader.readStringOrNull(offset)) as P; + case 10: + return (reader.readStringOrNull(offset)) as P; + case 11: + return (reader.readStringOrNull(offset)) as P; + case 12: + return (reader.readStringOrNull(offset)) as P; + case 13: + return (reader.readString(offset)) as P; + case 14: + return (reader.readString(offset)) as P; + case 15: + return (reader.readString(offset)) as P; + case 16: + return (reader.readString(offset)) as P; + case 17: + return (reader.readString(offset)) as P; + case 18: + return (reader.readString(offset)) as P; + case 19: + return (reader.readString(offset)) as P; + case 20: + return (reader.readString(offset)) as P; + case 21: + return (reader.readString(offset)) as P; + case 22: + return (reader.readString(offset)) as P; + case 23: + return (reader.readString(offset)) as P; + case 24: + return (reader.readString(offset)) as P; + case 25: + return (reader.readString(offset)) as P; + case 26: + return (reader.readString(offset)) as P; + case 27: + return (reader.readString(offset)) as P; + default: + throw IsarError('Unknown property with id $propertyId'); + } +} + +extension ThemeAssetsV3QueryFilter + on QueryBuilder { + QueryBuilder + backgroundIsNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNull( + property: r'background', + )); + }); + } + + QueryBuilder + backgroundIsNotNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNotNull( + property: r'background', + )); + }); + } + + QueryBuilder + backgroundEqualTo( + String? value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'background', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + backgroundGreaterThan( + String? value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'background', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + backgroundLessThan( + String? value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'background', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + backgroundBetween( + 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'background', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + backgroundStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'background', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + backgroundEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'background', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + backgroundContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'background', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + backgroundMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'background', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + backgroundIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'background', + value: '', + )); + }); + } + + QueryBuilder + backgroundIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'background', + value: '', + )); + }); + } + + QueryBuilder + bellNewEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'bellNew', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + bellNewGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'bellNew', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + bellNewLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'bellNew', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + bellNewBetween( + 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'bellNew', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + bellNewStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'bellNew', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + bellNewEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'bellNew', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + bellNewContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'bellNew', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + bellNewMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'bellNew', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + bellNewIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'bellNew', + value: '', + )); + }); + } + + QueryBuilder + bellNewIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'bellNew', + value: '', + )); + }); + } + + QueryBuilder buyEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'buy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + buyGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'buy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder buyLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'buy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder buyBetween( + 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'buy', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + buyStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'buy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder buyEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'buy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder buyContains( + String value, + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'buy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder buyMatches( + String pattern, + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'buy', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + buyIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'buy', + value: '', + )); + }); + } + + QueryBuilder + buyIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'buy', + value: '', + )); + }); + } + + QueryBuilder + coinCardImagesStringIsNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNull( + property: r'coinCardImagesString', + )); + }); + } + + QueryBuilder + coinCardImagesStringIsNotNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNotNull( + property: r'coinCardImagesString', + )); + }); + } + + QueryBuilder + coinCardImagesStringEqualTo( + String? value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'coinCardImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinCardImagesStringGreaterThan( + String? value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'coinCardImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinCardImagesStringLessThan( + String? value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'coinCardImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinCardImagesStringBetween( + 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'coinCardImagesString', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinCardImagesStringStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'coinCardImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinCardImagesStringEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'coinCardImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinCardImagesStringContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'coinCardImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinCardImagesStringMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'coinCardImagesString', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinCardImagesStringIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'coinCardImagesString', + value: '', + )); + }); + } + + QueryBuilder + coinCardImagesStringIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'coinCardImagesString', + value: '', + )); + }); + } + + QueryBuilder + coinIconsStringEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'coinIconsString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinIconsStringGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'coinIconsString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinIconsStringLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'coinIconsString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinIconsStringBetween( + 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'coinIconsString', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinIconsStringStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'coinIconsString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinIconsStringEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'coinIconsString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinIconsStringContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'coinIconsString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinIconsStringMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'coinIconsString', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinIconsStringIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'coinIconsString', + value: '', + )); + }); + } + + QueryBuilder + coinIconsStringIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'coinIconsString', + value: '', + )); + }); + } + + QueryBuilder + coinImagesStringEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'coinImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinImagesStringGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'coinImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinImagesStringLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'coinImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinImagesStringBetween( + 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'coinImagesString', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinImagesStringStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'coinImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinImagesStringEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'coinImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinImagesStringContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'coinImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinImagesStringMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'coinImagesString', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinImagesStringIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'coinImagesString', + value: '', + )); + }); + } + + QueryBuilder + coinImagesStringIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'coinImagesString', + value: '', + )); + }); + } + + QueryBuilder + coinPlaceholderEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'coinPlaceholder', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinPlaceholderGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'coinPlaceholder', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinPlaceholderLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'coinPlaceholder', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinPlaceholderBetween( + 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'coinPlaceholder', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinPlaceholderStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'coinPlaceholder', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinPlaceholderEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'coinPlaceholder', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinPlaceholderContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'coinPlaceholder', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinPlaceholderMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'coinPlaceholder', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinPlaceholderIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'coinPlaceholder', + value: '', + )); + }); + } + + QueryBuilder + coinPlaceholderIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'coinPlaceholder', + value: '', + )); + }); + } + + QueryBuilder + coinSecondaryImagesStringEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'coinSecondaryImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinSecondaryImagesStringGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'coinSecondaryImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinSecondaryImagesStringLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'coinSecondaryImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinSecondaryImagesStringBetween( + 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'coinSecondaryImagesString', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinSecondaryImagesStringStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'coinSecondaryImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinSecondaryImagesStringEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'coinSecondaryImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinSecondaryImagesStringContains(String value, + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'coinSecondaryImagesString', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinSecondaryImagesStringMatches(String pattern, + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'coinSecondaryImagesString', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + coinSecondaryImagesStringIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'coinSecondaryImagesString', + value: '', + )); + }); + } + + QueryBuilder + coinSecondaryImagesStringIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'coinSecondaryImagesString', + value: '', + )); + }); + } + + QueryBuilder + exchangeEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'exchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + exchangeGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'exchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + exchangeLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'exchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + exchangeBetween( + 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'exchange', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + exchangeStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'exchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + exchangeEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'exchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + exchangeContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'exchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + exchangeMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'exchange', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + exchangeIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'exchange', + value: '', + )); + }); + } + + QueryBuilder + exchangeIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'exchange', + value: '', + )); + }); + } + + QueryBuilder + loadingGifIsNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNull( + property: r'loadingGif', + )); + }); + } + + QueryBuilder + loadingGifIsNotNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNotNull( + property: r'loadingGif', + )); + }); + } + + QueryBuilder + loadingGifEqualTo( + String? value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'loadingGif', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + loadingGifGreaterThan( + String? value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'loadingGif', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + loadingGifLessThan( + String? value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'loadingGif', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + loadingGifBetween( + 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'loadingGif', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + loadingGifStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'loadingGif', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + loadingGifEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'loadingGif', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + loadingGifContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'loadingGif', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + loadingGifMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'loadingGif', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + loadingGifIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'loadingGif', + value: '', + )); + }); + } + + QueryBuilder + loadingGifIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'loadingGif', + value: '', + )); + }); + } + + QueryBuilder + dummy1IsNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNull( + property: r'otherStringParam1', + )); + }); + } + + QueryBuilder + dummy1IsNotNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNotNull( + property: r'otherStringParam1', + )); + }); + } + + QueryBuilder + dummy1EqualTo( + String? value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'otherStringParam1', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + dummy1GreaterThan( + String? value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'otherStringParam1', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + dummy1LessThan( + String? value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'otherStringParam1', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + dummy1Between( + 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'otherStringParam1', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + dummy1StartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'otherStringParam1', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + dummy1EndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'otherStringParam1', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + dummy1Contains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'otherStringParam1', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + dummy1Matches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'otherStringParam1', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + dummy1IsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'otherStringParam1', + value: '', + )); + }); + } + + QueryBuilder + dummy1IsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'otherStringParam1', + value: '', + )); + }); + } + + QueryBuilder + dummy2IsNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNull( + property: r'otherStringParam2', + )); + }); + } + + QueryBuilder + dummy2IsNotNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNotNull( + property: r'otherStringParam2', + )); + }); + } + + QueryBuilder + dummy2EqualTo( + String? value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'otherStringParam2', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + dummy2GreaterThan( + String? value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'otherStringParam2', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + dummy2LessThan( + String? value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'otherStringParam2', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + dummy2Between( + 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'otherStringParam2', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + dummy2StartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'otherStringParam2', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + dummy2EndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'otherStringParam2', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + dummy2Contains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'otherStringParam2', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + dummy2Matches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'otherStringParam2', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + dummy2IsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'otherStringParam2', + value: '', + )); + }); + } + + QueryBuilder + dummy2IsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'otherStringParam2', + value: '', + )); + }); + } + + QueryBuilder + dummy3IsNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNull( + property: r'otherStringParam3', + )); + }); + } + + QueryBuilder + dummy3IsNotNull() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(const FilterCondition.isNotNull( + property: r'otherStringParam3', + )); + }); + } + + QueryBuilder + dummy3EqualTo( + String? value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'otherStringParam3', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + dummy3GreaterThan( + String? value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'otherStringParam3', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + dummy3LessThan( + String? value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'otherStringParam3', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + dummy3Between( + 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'otherStringParam3', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + dummy3StartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'otherStringParam3', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + dummy3EndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'otherStringParam3', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + dummy3Contains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'otherStringParam3', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + dummy3Matches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'otherStringParam3', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + dummy3IsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'otherStringParam3', + value: '', + )); + }); + } + + QueryBuilder + dummy3IsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'otherStringParam3', + value: '', + )); + }); + } + + QueryBuilder + personaEasyEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'personaEasy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaEasyGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'personaEasy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaEasyLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'personaEasy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaEasyBetween( + 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'personaEasy', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaEasyStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'personaEasy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaEasyEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'personaEasy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaEasyContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'personaEasy', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaEasyMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'personaEasy', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaEasyIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'personaEasy', + value: '', + )); + }); + } + + QueryBuilder + personaEasyIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'personaEasy', + value: '', + )); + }); + } + + QueryBuilder + personaIncognitoEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'personaIncognito', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaIncognitoGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'personaIncognito', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaIncognitoLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'personaIncognito', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaIncognitoBetween( + 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'personaIncognito', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaIncognitoStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'personaIncognito', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaIncognitoEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'personaIncognito', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaIncognitoContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'personaIncognito', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaIncognitoMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'personaIncognito', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + personaIncognitoIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'personaIncognito', + value: '', + )); + }); + } + + QueryBuilder + personaIncognitoIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'personaIncognito', + value: '', + )); + }); + } + + QueryBuilder + receiveEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'receive', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'receive', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'receive', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveBetween( + 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'receive', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'receive', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'receive', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'receive', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'receive', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'receive', + value: '', + )); + }); + } + + QueryBuilder + receiveIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'receive', + value: '', + )); + }); + } + + QueryBuilder + receiveCancelledEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'receiveCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveCancelledGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'receiveCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveCancelledLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'receiveCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveCancelledBetween( + 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'receiveCancelled', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveCancelledStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'receiveCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveCancelledEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'receiveCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveCancelledContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'receiveCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveCancelledMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'receiveCancelled', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receiveCancelledIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'receiveCancelled', + value: '', + )); + }); + } + + QueryBuilder + receiveCancelledIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'receiveCancelled', + value: '', + )); + }); + } + + QueryBuilder + receivePendingEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'receivePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receivePendingGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'receivePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receivePendingLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'receivePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receivePendingBetween( + 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'receivePending', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receivePendingStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'receivePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receivePendingEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'receivePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receivePendingContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'receivePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receivePendingMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'receivePending', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + receivePendingIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'receivePending', + value: '', + )); + }); + } + + QueryBuilder + receivePendingIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'receivePending', + value: '', + )); + }); + } + + QueryBuilder sendEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'send', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'send', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'send', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder sendBetween( + 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'send', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'send', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'send', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'send', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder sendMatches( + String pattern, + {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'send', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'send', + value: '', + )); + }); + } + + QueryBuilder + sendIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'send', + value: '', + )); + }); + } + + QueryBuilder + sendCancelledEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'sendCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendCancelledGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'sendCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendCancelledLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'sendCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendCancelledBetween( + 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'sendCancelled', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendCancelledStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'sendCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendCancelledEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'sendCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendCancelledContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'sendCancelled', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendCancelledMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'sendCancelled', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendCancelledIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'sendCancelled', + value: '', + )); + }); + } + + QueryBuilder + sendCancelledIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'sendCancelled', + value: '', + )); + }); + } + + QueryBuilder + sendPendingEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'sendPending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendPendingGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'sendPending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendPendingLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'sendPending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendPendingBetween( + 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'sendPending', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendPendingStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'sendPending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendPendingEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'sendPending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendPendingContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'sendPending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendPendingMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'sendPending', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + sendPendingIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'sendPending', + value: '', + )); + }); + } + + QueryBuilder + sendPendingIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'sendPending', + value: '', + )); + }); + } + + QueryBuilder + stackEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'stack', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'stack', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'stack', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackBetween( + 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'stack', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'stack', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'stack', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'stack', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'stack', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'stack', + value: '', + )); + }); + } + + QueryBuilder + stackIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'stack', + value: '', + )); + }); + } + + QueryBuilder + stackIconEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'stackIcon', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackIconGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'stackIcon', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackIconLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'stackIcon', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackIconBetween( + 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'stackIcon', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackIconStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'stackIcon', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackIconEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'stackIcon', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackIconContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'stackIcon', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackIconMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'stackIcon', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + stackIconIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'stackIcon', + value: '', + )); + }); + } + + QueryBuilder + stackIconIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'stackIcon', + value: '', + )); + }); + } + + QueryBuilder + themePreviewEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'themePreview', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themePreviewGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'themePreview', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themePreviewLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'themePreview', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themePreviewBetween( + 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'themePreview', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themePreviewStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'themePreview', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themePreviewEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'themePreview', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themePreviewContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'themePreview', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themePreviewMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'themePreview', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themePreviewIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'themePreview', + value: '', + )); + }); + } + + QueryBuilder + themePreviewIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'themePreview', + value: '', + )); + }); + } + + QueryBuilder + themeSelectorEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'themeSelector', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'themeSelector', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'themeSelector', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorBetween( + 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'themeSelector', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'themeSelector', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'themeSelector', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'themeSelector', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'themeSelector', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + themeSelectorIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'themeSelector', + value: '', + )); + }); + } + + QueryBuilder + themeSelectorIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'themeSelector', + value: '', + )); + }); + } + + QueryBuilder + txExchangeEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'txExchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'txExchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'txExchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeBetween( + 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'txExchange', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'txExchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'txExchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'txExchange', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'txExchange', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'txExchange', + value: '', + )); + }); + } + + QueryBuilder + txExchangeIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'txExchange', + value: '', + )); + }); + } + + QueryBuilder + txExchangeFailedEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'txExchangeFailed', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeFailedGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'txExchangeFailed', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeFailedLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'txExchangeFailed', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeFailedBetween( + 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'txExchangeFailed', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeFailedStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'txExchangeFailed', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeFailedEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'txExchangeFailed', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeFailedContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'txExchangeFailed', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeFailedMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'txExchangeFailed', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangeFailedIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'txExchangeFailed', + value: '', + )); + }); + } + + QueryBuilder + txExchangeFailedIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'txExchangeFailed', + value: '', + )); + }); + } + + QueryBuilder + txExchangePendingEqualTo( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'txExchangePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangePendingGreaterThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + include: include, + property: r'txExchangePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangePendingLessThan( + String value, { + bool include = false, + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.lessThan( + include: include, + property: r'txExchangePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangePendingBetween( + 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'txExchangePending', + lower: lower, + includeLower: includeLower, + upper: upper, + includeUpper: includeUpper, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangePendingStartsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.startsWith( + property: r'txExchangePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangePendingEndsWith( + String value, { + bool caseSensitive = true, + }) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.endsWith( + property: r'txExchangePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangePendingContains(String value, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.contains( + property: r'txExchangePending', + value: value, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangePendingMatches(String pattern, {bool caseSensitive = true}) { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.matches( + property: r'txExchangePending', + wildcard: pattern, + caseSensitive: caseSensitive, + )); + }); + } + + QueryBuilder + txExchangePendingIsEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.equalTo( + property: r'txExchangePending', + value: '', + )); + }); + } + + QueryBuilder + txExchangePendingIsNotEmpty() { + return QueryBuilder.apply(this, (query) { + return query.addFilterCondition(FilterCondition.greaterThan( + property: r'txExchangePending', + value: '', + )); + }); + } +} + +extension ThemeAssetsV3QueryObject + on QueryBuilder {} diff --git a/lib/models/paymint/transactions_model.dart b/lib/models/paymint/transactions_model.dart index 987c4c3c5..f952fa4fd 100644 --- a/lib/models/paymint/transactions_model.dart +++ b/lib/models/paymint/transactions_model.dart @@ -362,8 +362,8 @@ class Output { scriptpubkeyType: json['scriptPubKey']['type'] as String?, scriptpubkeyAddress: address, value: (Decimal.parse((json["value"] ?? 0).toString()) * - Decimal.fromInt(Constants.satsPerCoin(Coin - .bitcoin))) // dirty hack but we need 8 decimal places here to keep consistent data structure + Decimal.fromInt(Constants.satsPerCoin(Coin.bitcoin) + .toInt())) // dirty hack but we need 8 decimal places here to keep consistent data structure .toBigInt() .toInt(), ); @@ -375,8 +375,8 @@ class Output { scriptpubkeyType: "", scriptpubkeyAddress: "", value: (Decimal.parse(0.toString()) * - Decimal.fromInt(Constants.satsPerCoin(Coin - .bitcoin))) // dirty hack but we need 8 decimal places here to keep consistent data structure + Decimal.fromInt(Constants.satsPerCoin(Coin.bitcoin) + .toInt())) // dirty hack but we need 8 decimal places here to keep consistent data structure .toBigInt() .toInt()); } diff --git a/lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart b/lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart index 8f1f22187..d9d5f87b2 100644 --- a/lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart +++ b/lib/pages/add_wallet_views/add_wallet_view/add_wallet_view.dart @@ -1,12 +1,15 @@ import 'dart:io'; import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:stackduo/models/add_wallet_list_entity/add_wallet_list_entity.dart'; +import 'package:stackduo/models/add_wallet_list_entity/sub_classes/coin_entity.dart'; import 'package:stackduo/pages/add_wallet_views/add_wallet_view/sub_widgets/add_wallet_text.dart'; -import 'package:stackduo/pages/add_wallet_views/add_wallet_view/sub_widgets/mobile_coin_list.dart'; +import 'package:stackduo/pages/add_wallet_views/add_wallet_view/sub_widgets/expanding_sub_list_item.dart'; import 'package:stackduo/pages/add_wallet_views/add_wallet_view/sub_widgets/next_button.dart'; -import 'package:stackduo/pages/add_wallet_views/add_wallet_view/sub_widgets/searchable_coin_list.dart'; import 'package:stackduo/pages_desktop_specific/my_stack_view/exit_to_my_stack_button.dart'; +import 'package:stackduo/providers/providers.dart'; import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/constants.dart'; @@ -17,39 +20,119 @@ import 'package:stackduo/widgets/background.dart'; import 'package:stackduo/widgets/custom_buttons/app_bar_icon_button.dart'; import 'package:stackduo/widgets/desktop/desktop_app_bar.dart'; import 'package:stackduo/widgets/desktop/desktop_scaffold.dart'; +import 'package:stackduo/widgets/expandable.dart'; import 'package:stackduo/widgets/icon_widgets/x_icon.dart'; import 'package:stackduo/widgets/rounded_white_container.dart'; import 'package:stackduo/widgets/stack_text_field.dart'; import 'package:stackduo/widgets/textfield_icon_button.dart'; -class AddWalletView extends StatefulWidget { +class AddWalletView extends ConsumerStatefulWidget { const AddWalletView({Key? key}) : super(key: key); static const routeName = "/addWallet"; @override - State createState() => _AddWalletViewState(); + ConsumerState createState() => _AddWalletViewState(); } -class _AddWalletViewState extends State { +class _AddWalletViewState extends ConsumerState { late final TextEditingController _searchFieldController; late final FocusNode _searchFocusNode; String _searchTerm = ""; - final List coins = [...Coin.values]; + final List _coinsTestnet = [ + ...Coin.values.sublist(Coin.values.length - kTestNetCoinCount), + ]; + final List _coins = [ + ...Coin.values.sublist(0, Coin.values.length - kTestNetCoinCount) + ]; + final List coinEntities = []; final bool isDesktop = Util.isDesktop; + List filter( + String text, + List entities, + ) { + final _entities = [...entities]; + if (text.isNotEmpty) { + final lowercaseTerm = text.toLowerCase(); + _entities.retainWhere( + (e) => + e.ticker.toLowerCase().contains(lowercaseTerm) || + e.name.toLowerCase().contains(lowercaseTerm) || + e.coin.name.toLowerCase().contains(lowercaseTerm), + ); + } + + return _entities; + } + + // Future _addToken() async { + // EthContract? contract; + // if (isDesktop) { + // contract = await showDialog( + // context: context, + // builder: (context) => const DesktopDialog( + // maxWidth: 580, + // maxHeight: 500, + // child: AddCustomTokenView(), + // ), + // ); + // } else { + // contract = await Navigator.of(context).pushNamed( + // AddCustomTokenView.routeName, + // ); + // } + // + // if (contract != null) { + // await MainDB.instance.putEthContract(contract); + // if (mounted) { + // setState(() { + // if (tokenEntities + // .where((e) => e.token.address == contract!.address) + // .isEmpty) { + // tokenEntities.add(EthTokenEntity(contract!)); + // tokenEntities.sort((a, b) => a.token.name.compareTo(b.token.name)); + // } + // }); + // } + // } + // } + @override void initState() { _searchFieldController = TextEditingController(); _searchFocusNode = FocusNode(); - if (isDesktop) { - if (Platform.isWindows) { - coins.remove(Coin.monero); - } + // _coinsTestnet.remove(Coin.firoTestNet); + if (Platform.isWindows) { + _coins.remove(Coin.monero); + // _coins.remove(Coin.wownero); + } else if (Platform.isLinux) { + // _coins.remove(Coin.wownero); } + + coinEntities.addAll(_coins.map((e) => CoinEntity(e))); + + if (ref.read(prefsChangeNotifierProvider).showTestNetCoins) { + coinEntities.addAll(_coinsTestnet.map((e) => CoinEntity(e))); + } + + // final contracts = + // MainDB.instance.getEthContracts().sortByName().findAllSync(); + // + // if (contracts.isEmpty) { + // contracts.addAll(DefaultTokens.list); + // MainDB.instance.putEthContracts(contracts); + // } + // + // tokenEntities.addAll(contracts.map((e) => EthTokenEntity(e))); + + WidgetsBinding.instance.addPostFrameCallback((_) { + ref.refresh(addWalletSelectedEntityStateProvider); + }); + super.initState(); } @@ -95,87 +178,102 @@ class _AddWalletViewState extends State { Padding( padding: const EdgeInsets.all(4.0), child: ClipRRect( - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + child: TextField( + autocorrect: Util.isDesktop ? false : true, + enableSuggestions: Util.isDesktop ? false : true, + controller: _searchFieldController, + focusNode: _searchFocusNode, + onChanged: (value) { + setState(() { + _searchTerm = value; + }); + }, + style: + STextStyles.desktopTextMedium(context).copyWith( + height: 2, ), - child: Semantics( - label: - "Search Text Field. Inputs Text To Search In Wallets.", - excludeSemantics: true, - child: TextField( - autocorrect: Util.isDesktop ? false : true, - enableSuggestions: - Util.isDesktop ? false : true, - controller: _searchFieldController, - focusNode: _searchFocusNode, - onChanged: (value) { - setState(() { - _searchTerm = value; - }); - }, - style: STextStyles.desktopTextMedium(context) - .copyWith( - height: 2, + decoration: standardInputDecoration( + "Search", + _searchFocusNode, + context, + ).copyWith( + contentPadding: const EdgeInsets.symmetric( + vertical: 10, + ), + prefixIcon: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 16, + // vertical: 20, ), - decoration: standardInputDecoration( - "Search", - _searchFocusNode, - context, - ).copyWith( - contentPadding: const EdgeInsets.symmetric( - vertical: 10, - ), - prefixIcon: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 16, - // vertical: 20, - ), - child: SvgPicture.asset( - Assets.svg.search, - width: 24, - height: 24, - color: Theme.of(context) - .extension()! - .textFieldDefaultSearchIconLeft, - ), - ), - suffixIcon: _searchFieldController - .text.isNotEmpty - ? Padding( - padding: - const EdgeInsets.only(right: 10), - child: UnconstrainedBox( - child: Row( - children: [ - TextFieldIconButton( - child: const XIcon( - width: 24, - height: 24, - ), - onTap: () async { - setState(() { - _searchFieldController - .text = ""; - _searchTerm = ""; - }); - }, - ), - ], - ), - ), - ) - : null, + child: SvgPicture.asset( + Assets.svg.search, + width: 24, + height: 24, + color: Theme.of(context) + .extension()! + .textFieldDefaultSearchIconLeft, ), ), - )), + suffixIcon: _searchFieldController.text.isNotEmpty + ? Padding( + padding: const EdgeInsets.only(right: 10), + child: UnconstrainedBox( + child: Row( + children: [ + TextFieldIconButton( + child: const XIcon( + width: 24, + height: 24, + ), + onTap: () async { + setState(() { + _searchFieldController.text = + ""; + _searchTerm = ""; + }); + }, + ), + ], + ), + ), + ) + : null, + ), + ), + ), + ), + const SizedBox( + height: 8, ), Expanded( - child: SearchableCoinList( - coins: coins, - isDesktop: true, - searchTerm: _searchTerm, + child: SingleChildScrollView( + child: Column( + children: [ + ExpandingSubListItem( + title: "Coins", + entities: filter(_searchTerm, coinEntities), + initialState: ExpandableState.expanded, + animationDurationMultiplier: 0.5, + ), + // ExpandingSubListItem( + // title: "Tokens", + // entities: filter(_searchTerm, tokenEntities), + // initialState: ExpandableState.expanded, + // animationDurationMultiplier: 0.5, + // trailing: AddCustomTokenSelector( + // addFunction: _addToken, + // ), + // ), + ], + ), ), ), + const SizedBox( + height: 20, + ), ], ), ), @@ -222,9 +320,83 @@ class _AddWalletViewState extends State { const SizedBox( height: 16, ), + ClipRRect( + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + child: Semantics( + label: + "Search Text Field. Inputs Text To Search In Wallets.", + excludeSemantics: true, + child: TextField( + autofocus: isDesktop, + autocorrect: !isDesktop, + enableSuggestions: !isDesktop, + controller: _searchFieldController, + focusNode: _searchFocusNode, + onChanged: (value) => + setState(() => _searchTerm = value), + style: STextStyles.field(context), + decoration: standardInputDecoration( + "Search", + _searchFocusNode, + context, + desktopMed: isDesktop, + ).copyWith( + prefixIcon: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 10, + vertical: 16, + ), + child: SvgPicture.asset( + Assets.svg.search, + width: 16, + height: 16, + ), + ), + suffixIcon: _searchFieldController.text.isNotEmpty + ? Padding( + padding: const EdgeInsets.only(right: 0), + child: UnconstrainedBox( + child: Row( + children: [ + TextFieldIconButton( + child: const XIcon(), + onTap: () async { + setState(() { + _searchFieldController.text = + ""; + _searchTerm = ""; + }); + }, + ), + ], + ), + ), + ) + : null, + ), + ), + )), + const SizedBox( + height: 10, + ), Expanded( - child: MobileCoinList( - coins: coins, + child: SingleChildScrollView( + child: Column( + children: [ + ExpandingSubListItem( + title: "Coins", + entities: filter(_searchTerm, coinEntities), + initialState: ExpandableState.expanded, + ), + // ExpandingSubListItem( + // title: "Tokens", + // entities: filter(_searchTerm, tokenEntities), + // initialState: ExpandableState.expanded, + // ), + ], + ), ), ), const SizedBox( diff --git a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/add_wallet_entity_list.dart b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/add_wallet_entity_list.dart new file mode 100644 index 000000000..bbafbe2cc --- /dev/null +++ b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/add_wallet_entity_list.dart @@ -0,0 +1,48 @@ +/* + * This file is part of Stack Wallet. + * + * Copyright (c) 2023 Cypher Stack + * All Rights Reserved. + * The code is distributed under GPLv3 license, see LICENSE file for details. + * Generated by Cypher Stack on 2023-05-26 + * + */ + +import 'package:flutter/material.dart'; +import 'package:stackduo/models/add_wallet_list_entity/add_wallet_list_entity.dart'; +import 'package:stackduo/pages/add_wallet_views/add_wallet_view/sub_widgets/coin_select_item.dart'; + +class AddWalletEntityList extends StatelessWidget { + const AddWalletEntityList({ + Key? key, + required this.entities, + this.trailing, + }) : super(key: key); + + final List entities; + final Widget? trailing; + + @override + Widget build(BuildContext context) { + return ListView.builder( + shrinkWrap: true, + primary: false, + itemCount: trailing != null ? entities.length + 1 : entities.length, + itemBuilder: (ctx, index) { + if (trailing != null && index == entities.length) { + return Padding( + padding: const EdgeInsets.all(4), + child: trailing, + ); + } else { + return Padding( + padding: const EdgeInsets.all(4), + child: CoinSelectItem( + entity: entities[index], + ), + ); + } + }, + ); + } +} diff --git a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/coin_select_item.dart b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/coin_select_item.dart index 4354aae6c..1600d2104 100644 --- a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/coin_select_item.dart +++ b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/coin_select_item.dart @@ -3,6 +3,7 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:stackduo/models/add_wallet_list_entity/add_wallet_list_entity.dart'; import 'package:stackduo/providers/providers.dart'; import 'package:stackduo/themes/coin_icon_provider.dart'; import 'package:stackduo/themes/stack_colors.dart'; @@ -15,30 +16,44 @@ import 'package:stackduo/utilities/util.dart'; class CoinSelectItem extends ConsumerWidget { const CoinSelectItem({ Key? key, - required this.coin, + required this.entity, }) : super(key: key); - final Coin coin; + final AddWalletListEntity entity; @override Widget build(BuildContext context, WidgetRef ref) { - debugPrint("BUILD: CoinSelectItem for ${coin.name}"); - final selectedCoin = ref.watch(addWalletSelectedCoinStateProvider); + debugPrint("BUILD: CoinSelectItem for ${entity.name}"); + final selectedEntity = ref.watch(addWalletSelectedEntityStateProvider); final isDesktop = Util.isDesktop; + String? tokenImageUri; + // if (entity is EthTokenEntity) { + // final currency = ExchangeDataLoadingService.instance.isar.currencies + // .where() + // .exchangeNameEqualTo(ChangeNowExchange.exchangeName) + // .filter() + // .tokenContractEqualTo( + // (entity as EthTokenEntity).token.address, + // caseSensitive: false, + // ) + // .and() + // .imageIsNotEmpty() + // .findFirstSync(); + // tokenImageUri = currency?.image; + // } + return Container( decoration: BoxDecoration( - // color: selectedCoin == coin ? CFColors.selection : CFColors.white, - color: selectedCoin == coin + color: selectedEntity == entity ? Theme.of(context).extension()!.textFieldActiveBG : Theme.of(context).extension()!.popupBG, borderRadius: BorderRadius.circular(Constants.size.circularBorderRadius), ), child: MaterialButton( - // splashColor: Theme.of(context).extension()!.highlight, - key: Key("coinSelectItemButtonKey_${coin.name}"), + key: Key("coinSelectItemButtonKey_${entity.name}${entity.ticker}"), padding: isDesktop ? const EdgeInsets.only(left: 24) : const EdgeInsets.all(12), @@ -53,26 +68,32 @@ class CoinSelectItem extends ConsumerWidget { ), child: Row( children: [ - SvgPicture.file( - File( - ref.watch(coinIconProvider(coin)), - ), - width: 26, - height: 26, - ), + tokenImageUri != null + ? SvgPicture.network( + tokenImageUri, + width: 26, + height: 26, + ) + : SvgPicture.file( + File( + ref.watch(coinIconProvider(entity.coin)), + ), + width: 26, + height: 26, + ), SizedBox( width: isDesktop ? 12 : 10, ), Text( - coin.prettyName, + "${entity.name} (${entity.ticker})", style: isDesktop ? STextStyles.desktopTextMedium(context) : STextStyles.subtitle600(context).copyWith( fontSize: 14, ), ), - if (isDesktop && selectedCoin == coin) const Spacer(), - if (isDesktop && selectedCoin == coin) + if (isDesktop && selectedEntity == entity) const Spacer(), + if (isDesktop && selectedEntity == entity) Padding( padding: const EdgeInsets.only( right: 18, @@ -91,8 +112,9 @@ class CoinSelectItem extends ConsumerWidget { ], ), ), - onPressed: () => - ref.read(addWalletSelectedCoinStateProvider.state).state = coin, + onPressed: () { + ref.read(addWalletSelectedEntityStateProvider.state).state = entity; + }, ), ); } diff --git a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/expanding_sub_list_item.dart b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/expanding_sub_list_item.dart new file mode 100644 index 000000000..6f6f7ddc5 --- /dev/null +++ b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/expanding_sub_list_item.dart @@ -0,0 +1,133 @@ +/* + * This file is part of Stack Wallet. + * + * Copyright (c) 2023 Cypher Stack + * All Rights Reserved. + * The code is distributed under GPLv3 license, see LICENSE file for details. + * Generated by Cypher Stack on 2023-05-26 + * + */ + +import 'package:flutter/material.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:stackduo/models/add_wallet_list_entity/add_wallet_list_entity.dart'; +import 'package:stackduo/pages/add_wallet_views/add_wallet_view/sub_widgets/add_wallet_entity_list.dart'; +import 'package:stackduo/themes/stack_colors.dart'; +import 'package:stackduo/utilities/assets.dart'; +import 'package:stackduo/utilities/text_styles.dart'; +import 'package:stackduo/utilities/util.dart'; +import 'package:stackduo/widgets/animated_widgets/rotate_icon.dart'; +import 'package:stackduo/widgets/expandable.dart'; + +class ExpandingSubListItem extends StatefulWidget { + const ExpandingSubListItem({ + Key? key, + required this.title, + required this.entities, + this.trailing, + required this.initialState, + double? animationDurationMultiplier, + this.curve = Curves.easeInOutCubicEmphasized, + }) : animationDurationMultiplier = + animationDurationMultiplier ?? entities.length * 0.11, + super(key: key); + + final String title; + final List entities; + final Widget? trailing; + final ExpandableState initialState; + final double animationDurationMultiplier; + final Curve curve; + + @override + State createState() => _ExpandingSubListItemState(); +} + +class _ExpandingSubListItemState extends State { + final isDesktop = Util.isDesktop; + + late final ExpandableController _controller; + late final RotateIconController _rotateIconController; + + @override + void initState() { + _controller = ExpandableController(); + _rotateIconController = RotateIconController(); + WidgetsBinding.instance.addPostFrameCallback((_) { + if (widget.initialState == ExpandableState.expanded) { + _controller.toggle?.call(); + } + }); + super.initState(); + } + + @override + void dispose() { + _controller.toggle = null; + _rotateIconController.forward = null; + _rotateIconController.reverse = null; + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Expandable( + animationDurationMultiplier: widget.animationDurationMultiplier, + curve: widget.curve, + controller: _controller, + onExpandWillChange: (state) { + if (state == ExpandableState.expanded) { + _rotateIconController.forward?.call(); + } else { + _rotateIconController.reverse?.call(); + } + }, + header: Container( + color: Colors.transparent, + child: Padding( + padding: const EdgeInsets.only( + top: 8.0, + bottom: 8.0, + right: 10, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + widget.title, + style: isDesktop + ? STextStyles.desktopTextMedium(context).copyWith( + color: Theme.of(context) + .extension()! + .textDark3, + ) + : STextStyles.smallMed12(context), + textAlign: TextAlign.left, + ), + RotateIcon( + icon: SvgPicture.asset( + Assets.svg.chevronDown, + width: isDesktop ? 20 : 12, + height: isDesktop ? 10 : 6, + color: Theme.of(context) + .extension()! + .textFieldActiveSearchIconRight, + ), + curve: widget.curve, + animationDurationMultiplier: widget.animationDurationMultiplier, + controller: _rotateIconController, + ), + ], + ), + ), + ), + body: SingleChildScrollView( + primary: false, + child: AddWalletEntityList( + entities: widget.entities, + trailing: widget.trailing, + ), + ), + ); + } +} diff --git a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/mobile_coin_list.dart b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/mobile_coin_list.dart deleted file mode 100644 index b238c6833..000000000 --- a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/mobile_coin_list.dart +++ /dev/null @@ -1,38 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:stackduo/pages/add_wallet_views/add_wallet_view/sub_widgets/coin_select_item.dart'; -import 'package:stackduo/providers/global/prefs_provider.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; - -class MobileCoinList extends StatelessWidget { - const MobileCoinList({ - Key? key, - required this.coins, - }) : super(key: key); - - final List coins; - - @override - Widget build(BuildContext context) { - return Consumer( - builder: (_, ref, __) { - bool showTestNet = ref.watch( - prefsChangeNotifierProvider.select((value) => value.showTestNetCoins), - ); - - return ListView.builder( - itemCount: - showTestNet ? coins.length : coins.length - (kTestNetCoinCount), - itemBuilder: (ctx, index) { - return Padding( - padding: const EdgeInsets.all(4), - child: CoinSelectItem( - coin: coins[index], - ), - ); - }, - ); - }, - ); - } -} diff --git a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/next_button.dart b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/next_button.dart index 2d7d3f36f..e872b2373 100644 --- a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/next_button.dart +++ b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/next_button.dart @@ -2,8 +2,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:stackduo/pages/add_wallet_views/create_or_restore_wallet_view/create_or_restore_wallet_view.dart'; import 'package:stackduo/providers/providers.dart'; -import 'package:stackduo/utilities/text_styles.dart'; import 'package:stackduo/themes/stack_colors.dart'; +import 'package:stackduo/utilities/text_styles.dart'; class AddWalletNextButton extends ConsumerWidget { const AddWalletNextButton({ @@ -17,7 +17,7 @@ class AddWalletNextButton extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { debugPrint("BUILD: NextButton"); final selectedCoin = - ref.watch(addWalletSelectedCoinStateProvider.state).state; + ref.watch(addWalletSelectedEntityStateProvider.state).state; final enabled = selectedCoin != null; @@ -25,13 +25,17 @@ class AddWalletNextButton extends ConsumerWidget { onPressed: !enabled ? null : () { - final selectedCoin = - ref.read(addWalletSelectedCoinStateProvider.state).state; - + // if (selectedCoin is EthTokenEntity) { + // Navigator.of(context).pushNamed( + // SelectWalletForTokenView.routeName, + // arguments: selectedCoin, + // ); + // } else { Navigator.of(context).pushNamed( CreateOrRestoreWalletView.routeName, arguments: selectedCoin, ); + // } }, style: enabled ? Theme.of(context) diff --git a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/searchable_coin_list.dart b/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/searchable_coin_list.dart deleted file mode 100644 index c7d063e29..000000000 --- a/lib/pages/add_wallet_views/add_wallet_view/sub_widgets/searchable_coin_list.dart +++ /dev/null @@ -1,57 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:stackduo/pages/add_wallet_views/add_wallet_view/sub_widgets/coin_select_item.dart'; -import 'package:stackduo/providers/global/prefs_provider.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; - -class SearchableCoinList extends ConsumerWidget { - const SearchableCoinList({ - Key? key, - required this.coins, - required this.isDesktop, - required this.searchTerm, - }) : super(key: key); - - final List coins; - final bool isDesktop; - final String searchTerm; - - List filterCoins(String text, bool showTestNetCoins) { - final _coins = [...coins]; - if (text.isNotEmpty) { - final lowercaseTerm = text.toLowerCase(); - _coins.retainWhere((e) => - e.ticker.toLowerCase().contains(lowercaseTerm) || - e.prettyName.toLowerCase().contains(lowercaseTerm) || - e.name.toLowerCase().contains(lowercaseTerm)); - } - - // Kidgloves for Wownero on desktop - // if(isDesktop) { - // _coins.remove(Coin.wownero); - // } - - return _coins; - } - - @override - Widget build(BuildContext context, WidgetRef ref) { - bool showTestNet = ref.watch( - prefsChangeNotifierProvider.select((value) => value.showTestNetCoins), - ); - - final _coins = filterCoins(searchTerm, showTestNet); - - return ListView.builder( - itemCount: _coins.length, - itemBuilder: (ctx, index) { - return Padding( - padding: const EdgeInsets.all(4), - child: CoinSelectItem( - coin: _coins[index], - ), - ); - }, - ); - } -} diff --git a/lib/pages/add_wallet_views/create_or_restore_wallet_view/create_or_restore_wallet_view.dart b/lib/pages/add_wallet_views/create_or_restore_wallet_view/create_or_restore_wallet_view.dart index 796b27515..6dd6862ce 100644 --- a/lib/pages/add_wallet_views/create_or_restore_wallet_view/create_or_restore_wallet_view.dart +++ b/lib/pages/add_wallet_views/create_or_restore_wallet_view/create_or_restore_wallet_view.dart @@ -1,11 +1,11 @@ import 'package:flutter/material.dart'; +import 'package:stackduo/models/add_wallet_list_entity/add_wallet_list_entity.dart'; import 'package:stackduo/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/coin_image.dart'; import 'package:stackduo/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_or_restore_wallet_subtitle.dart'; import 'package:stackduo/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_or_restore_wallet_title.dart'; import 'package:stackduo/pages/add_wallet_views/create_or_restore_wallet_view/sub_widgets/create_wallet_button_group.dart'; import 'package:stackduo/pages_desktop_specific/my_stack_view/exit_to_my_stack_button.dart'; import 'package:stackduo/themes/stack_colors.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/util.dart'; import 'package:stackduo/widgets/background.dart'; import 'package:stackduo/widgets/custom_buttons/app_bar_icon_button.dart'; @@ -15,12 +15,12 @@ import 'package:stackduo/widgets/desktop/desktop_scaffold.dart'; class CreateOrRestoreWalletView extends StatelessWidget { const CreateOrRestoreWalletView({ Key? key, - required this.coin, + required this.entity, }) : super(key: key); static const routeName = "/createOrRestoreWallet"; - final Coin coin; + final AddWalletListEntity entity; @override Widget build(BuildContext context) { @@ -44,7 +44,7 @@ class CreateOrRestoreWalletView extends StatelessWidget { flex: 10, ), CreateRestoreWalletTitle( - coin: coin, + coin: entity.coin, isDesktop: isDesktop, ), const SizedBox( @@ -60,7 +60,7 @@ class CreateOrRestoreWalletView extends StatelessWidget { height: 32, ), CoinImage( - coin: coin, + coin: entity.coin, width: isDesktop ? 324 : MediaQuery.of(context).size.width / 1.6, height: @@ -70,7 +70,7 @@ class CreateOrRestoreWalletView extends StatelessWidget { height: 32, ), CreateWalletButtonGroup( - coin: coin, + coin: entity.coin, isDesktop: isDesktop, ), const Spacer( @@ -112,7 +112,7 @@ class CreateOrRestoreWalletView extends StatelessWidget { flex: 2, ), CoinImage( - coin: coin, + coin: entity.coin, width: isDesktop ? 324 : MediaQuery.of(context).size.width / 1.6, @@ -124,7 +124,7 @@ class CreateOrRestoreWalletView extends StatelessWidget { flex: 2, ), CreateRestoreWalletTitle( - coin: coin, + coin: entity.coin, isDesktop: isDesktop, ), const SizedBox( @@ -137,7 +137,7 @@ class CreateOrRestoreWalletView extends StatelessWidget { flex: 5, ), CreateWalletButtonGroup( - coin: coin, + coin: entity.coin, isDesktop: isDesktop, ), ], diff --git a/lib/pages/add_wallet_views/name_your_wallet_view/name_your_wallet_view.dart b/lib/pages/add_wallet_views/name_your_wallet_view/name_your_wallet_view.dart index ce8befeb0..79340722d 100644 --- a/lib/pages/add_wallet_views/name_your_wallet_view/name_your_wallet_view.dart +++ b/lib/pages/add_wallet_views/name_your_wallet_view/name_your_wallet_view.dart @@ -327,19 +327,15 @@ class _NameYourWalletViewState extends ConsumerState { final name = textEditingController.text; if (await walletsService.checkForDuplicate(name)) { - if (mounted) { - unawaited( - showFloatingFlushBar( - type: FlushBarType.warning, - message: "Wallet name already in use.", - iconAsset: Assets.svg.circleAlert, - context: context, - ), - ); - } + unawaited(showFloatingFlushBar( + type: FlushBarType.warning, + message: "Wallet name already in use.", + iconAsset: Assets.svg.circleAlert, + context: context, + )); } else { // hide keyboard if has focus - if (mounted && FocusScope.of(context).hasFocus) { + if (FocusScope.of(context).hasFocus) { FocusScope.of(context).unfocus(); await Future.delayed( const Duration(milliseconds: 50)); diff --git a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart index 439733a48..a78cff398 100644 --- a/lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart +++ b/lib/pages/add_wallet_views/new_wallet_recovery_phrase_warning_view/new_wallet_recovery_phrase_warning_view.dart @@ -63,10 +63,6 @@ class _NewWalletRecoveryPhraseWarningViewState Widget build(BuildContext context) { debugPrint("BUILD: $runtimeType"); - final _numberOfPhraseWords = coin == Coin.monero - ? Constants.seedPhraseWordCountMonero - : Constants.seedPhraseWordCountBip39; - return MasterScaffold( isDesktop: isDesktop, appBar: isDesktop @@ -165,7 +161,15 @@ class _NewWalletRecoveryPhraseWarningViewState width: isDesktop ? 480 : null, child: isDesktop ? Text( - "On the next screen you will see $_numberOfPhraseWords words that make up your recovery phrase.\n\nPlease write it down. Keep it safe and never share it with anyone. Your recovery phrase is the only way you can access your funds if you forget your PIN, lose your phone, etc.\n\nStack Duo does not keep nor is able to restore your recover phrase. Only you have access to your wallet.", + "On the next screen you will see " + "${Constants.defaultSeedPhraseLengthFor(coin: coin)} " + "words that make up your recovery phrase.\n\nPlease " + "write it down. Keep it safe and never share it with " + "anyone. Your recovery phrase is the only way you can" + " access your funds if you forget your PIN, lose your" + " phone, etc.\n\nStack Wallet does not keep nor is " + "able to restore your recover phrase. Only you have " + "access to your wallet.", style: isDesktop ? STextStyles.desktopTextMediumRegular(context) : STextStyles.subtitle(context).copyWith( @@ -202,7 +206,9 @@ class _NewWalletRecoveryPhraseWarningViewState ), ), TextSpan( - text: "$_numberOfPhraseWords words", + text: + "${Constants.defaultSeedPhraseLengthFor(coin: coin)}" + " words", style: STextStyles.desktopH3(context).copyWith( color: Theme.of(context) .extension()! diff --git a/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart index 413130e68..c4883829c 100644 --- a/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart +++ b/lib/pages/add_wallet_views/restore_wallet_view/restore_options_view/restore_options_view.dart @@ -391,32 +391,32 @@ class _RestoreOptionsViewState extends ConsumerState { } }, isExpanded: true, - icon: SvgPicture.asset( - Assets.svg.chevronDown, - width: 12, - height: 6, - color: Theme.of(context) - .extension()! - .textFieldActiveSearchIconRight, - ), - buttonPadding: const EdgeInsets.symmetric( - horizontal: 16, - vertical: 8, + iconStyleData: IconStyleData( + icon: SvgPicture.asset( + Assets.svg.chevronDown, + width: 12, + height: 6, + color: Theme.of(context) + .extension()! + .textFieldActiveSearchIconRight, + ), ), - buttonDecoration: BoxDecoration( - color: Theme.of(context) - .extension()! - .textFieldDefaultBG, - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, + dropdownStyleData: DropdownStyleData( + offset: const Offset(0, -10), + elevation: 0, + decoration: BoxDecoration( + color: Theme.of(context) + .extension()! + .textFieldDefaultBG, + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), ), ), - dropdownDecoration: BoxDecoration( - color: Theme.of(context) - .extension()! - .textFieldDefaultBG, - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, + menuItemStyleData: const MenuItemStyleData( + padding: EdgeInsets.symmetric( + horizontal: 16, + vertical: 8, ), ), ), diff --git a/lib/pages/address_book_views/subviews/add_address_book_entry_view.dart b/lib/pages/address_book_views/subviews/add_address_book_entry_view.dart index 797ac6ec8..32c9ada28 100644 --- a/lib/pages/address_book_views/subviews/add_address_book_entry_view.dart +++ b/lib/pages/address_book_views/subviews/add_address_book_entry_view.dart @@ -693,7 +693,7 @@ class _AddAddressBookEntryViewState name: nameController.text, addresses: entries, isFavorite: _isFavorite, - customId: const Uuid().v1(), + customId: const Uuid().v1(), ); if (await ref diff --git a/lib/pages/address_book_views/subviews/new_contact_address_entry_form.dart b/lib/pages/address_book_views/subviews/new_contact_address_entry_form.dart index 06646300e..d079ee139 100644 --- a/lib/pages/address_book_views/subviews/new_contact_address_entry_form.dart +++ b/lib/pages/address_book_views/subviews/new_contact_address_entry_form.dart @@ -98,9 +98,25 @@ class _NewContactAddressEntryFormState "Select cryptocurrency", style: STextStyles.fieldLabel(context), ), - offset: const Offset(0, -10), + dropdownStyleData: DropdownStyleData( + offset: const Offset(0, -10), + elevation: 0, + decoration: BoxDecoration( + color: Theme.of(context) + .extension()! + .textFieldDefaultBG, + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + ), + ), + menuItemStyleData: const MenuItemStyleData( + padding: EdgeInsets.symmetric( + horizontal: 16, + vertical: 4, + ), + ), isExpanded: true, - dropdownElevation: 0, value: ref.watch(addressEntryDataProvider(widget.id) .select((value) => value.coin)), onChanged: (value) { @@ -108,30 +124,12 @@ class _NewContactAddressEntryFormState ref.read(addressEntryDataProvider(widget.id)).coin = value; } }, - icon: SvgPicture.asset( - Assets.svg.chevronDown, - width: 10, - height: 5, - color: Theme.of(context).extension()!.textDark3, - ), - buttonPadding: const EdgeInsets.symmetric( - horizontal: 16, - vertical: 4, - ), - buttonDecoration: BoxDecoration( - color: Theme.of(context) - .extension()! - .textFieldDefaultBG, - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, - ), - ), - dropdownDecoration: BoxDecoration( - color: Theme.of(context) - .extension()! - .textFieldDefaultBG, - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, + iconStyleData: IconStyleData( + icon: SvgPicture.asset( + Assets.svg.chevronDown, + width: 10, + height: 5, + color: Theme.of(context).extension()!.textDark3, ), ), items: [ diff --git a/lib/pages/coin_control/coin_control_view.dart b/lib/pages/coin_control/coin_control_view.dart index 3d9ff5c4d..3a6094b41 100644 --- a/lib/pages/coin_control/coin_control_view.dart +++ b/lib/pages/coin_control/coin_control_view.dart @@ -4,19 +4,19 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/isar_models.dart'; import 'package:stackduo/pages/coin_control/utxo_card.dart'; import 'package:stackduo/pages/coin_control/utxo_details_view.dart'; -import 'package:stackduo/providers/global/locale_provider.dart'; import 'package:stackduo/providers/global/wallets_provider.dart'; import 'package:stackduo/services/mixins/coin_control_interface.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/widgets/animated_widgets/rotate_icon.dart'; import 'package:stackduo/widgets/app_bar_field.dart'; import 'package:stackduo/widgets/background.dart'; @@ -687,14 +687,9 @@ class _CoinControlViewState extends ConsumerState { fractionDigits: coin.decimals, ); return Text( - "${selectedSum.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider - .select( - (value) => value.locale, - ), - ), - )} ${coin.ticker}", + ref + .watch(pAmountFormatter(coin)) + .format(selectedSum), style: widget.requestedTotal == null ? STextStyles.w600_14(context) : STextStyles.w600_14(context).copyWith( @@ -735,14 +730,9 @@ class _CoinControlViewState extends ConsumerState { style: STextStyles.w600_14(context), ), Text( - "${widget.requestedTotal!.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider - .select( - (value) => value.locale, - ), - ), - )} ${coin.ticker}", + ref + .watch(pAmountFormatter(coin)) + .format(widget.requestedTotal!), style: STextStyles.w600_14(context), ), ], diff --git a/lib/pages/coin_control/utxo_card.dart b/lib/pages/coin_control/utxo_card.dart index cd8366184..3560e90b4 100644 --- a/lib/pages/coin_control/utxo_card.dart +++ b/lib/pages/coin_control/utxo_card.dart @@ -1,14 +1,14 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/isar_models.dart'; -import 'package:stackduo/providers/global/locale_provider.dart'; import 'package:stackduo/providers/global/wallets_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/widgets/conditional_parent.dart'; import 'package:stackduo/widgets/icon_widgets/utxo_status_icon.dart'; import 'package:stackduo/widgets/rounded_container.dart'; @@ -124,15 +124,11 @@ class _UtxoCardState extends ConsumerState { mainAxisSize: MainAxisSize.min, children: [ Text( - "${utxo.value.toAmountAsRaw( - fractionDigits: coin.decimals, - ).localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), + ref.watch(pAmountFormatter(coin)).format( + utxo.value.toAmountAsRaw( + fractionDigits: coin.decimals, ), - )} ${coin.ticker}", + ), style: STextStyles.w600_14(context), ), const SizedBox( diff --git a/lib/pages/coin_control/utxo_details_view.dart b/lib/pages/coin_control/utxo_details_view.dart index 0d14a961a..4fd62b35b 100644 --- a/lib/pages/coin_control/utxo_details_view.dart +++ b/lib/pages/coin_control/utxo_details_view.dart @@ -3,15 +3,15 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/isar_models.dart'; import 'package:stackduo/pages/wallet_view/transaction_views/transaction_details_view.dart'; -import 'package:stackduo/providers/global/locale_provider.dart'; import 'package:stackduo/providers/global/wallets_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/util.dart'; import 'package:stackduo/widgets/background.dart'; import 'package:stackduo/widgets/conditional_parent.dart'; @@ -240,13 +240,11 @@ class _UtxoDetailsViewState extends ConsumerState { width: 16, ), Text( - "${utxo!.value.toAmountAsRaw(fractionDigits: coin.decimals).localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), + ref.watch(pAmountFormatter(coin)).format( + utxo!.value.toAmountAsRaw( + fractionDigits: coin.decimals, ), - )} ${coin.ticker}", + ), style: STextStyles.pageTitleH2(context), ), ], diff --git a/lib/pages/exchange_view/confirm_change_now_send.dart b/lib/pages/exchange_view/confirm_change_now_send.dart index 72a2088ea..d49da08be 100644 --- a/lib/pages/exchange_view/confirm_change_now_send.dart +++ b/lib/pages/exchange_view/confirm_change_now_send.dart @@ -10,11 +10,13 @@ import 'package:stackduo/pages/wallet_view/wallet_view.dart'; import 'package:stackduo/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_auth_send.dart'; import 'package:stackduo/providers/providers.dart'; import 'package:stackduo/route_generator.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; +import 'package:stackduo/utilities/logger.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/util.dart'; import 'package:stackduo/widgets/background.dart'; import 'package:stackduo/widgets/conditional_parent.dart'; @@ -139,7 +141,12 @@ class _ConfirmChangeNowSendViewState Navigator.of(context).popUntil(ModalRoute.withName(routeOnSuccessName)); } - } catch (e) { + } catch (e, s) { + Logging.instance.log( + "Broadcast transaction failed: $e\n$s", + level: LogLevel.Error, + ); + // pop sending dialog Navigator.of(context).pop(); @@ -188,9 +195,9 @@ class _ConfirmChangeNowSendViewState child: Column( mainAxisSize: MainAxisSize.min, children: [ - Row( + const Row( mainAxisAlignment: MainAxisAlignment.end, - children: const [ + children: [ DesktopDialogCloseButton(), ], ), @@ -360,20 +367,19 @@ class _ConfirmChangeNowSendViewState mainAxisAlignment: MainAxisAlignment.end, children: [ Text( - "${(transactionInfo["fee"] is Amount ? transactionInfo["fee"] as Amount : (transactionInfo["fee"] as int).toAmountAsRaw( - fractionDigits: ref.watch( - managerProvider - .select((value) => value.coin.decimals), - ), - )).localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), - ), - )} ${ref.watch( + ref + .watch(pAmountFormatter(ref.watch( managerProvider.select((value) => value.coin), - ).ticker}", + ))) + .format(transactionInfo["fee"] is Amount + ? transactionInfo["fee"] as Amount + : (transactionInfo["fee"] as int) + .toAmountAsRaw( + fractionDigits: ref.watch( + managerProvider.select( + (value) => value.coin.decimals), + ), + )), style: STextStyles.desktopTextExtraExtraSmall(context) .copyWith( @@ -417,16 +423,9 @@ class _ConfirmChangeNowSendViewState final amount = transactionInfo["recipientAmt"] as Amount; final total = amount + fee; - final locale = ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), - ); + return Text( - "${total.localizedStringAsFixed( - locale: locale, - )}" - " ${coin.ticker}", + ref.watch(pAmountFormatter(coin)).format(total), style: STextStyles.itemSubtitle12(context) .copyWith( color: Theme.of(context) @@ -599,7 +598,7 @@ class _ConfirmChangeNowSendViewState ); return Text( - " | ${value.localizedStringAsFixed(locale: locale)} $currency", + " | ${value.fiatString(locale: locale)} $currency", style: STextStyles.desktopTextExtraExtraSmall(context) .copyWith( @@ -612,15 +611,11 @@ class _ConfirmChangeNowSendViewState ], ), child: Text( - "${(transactionInfo["recipientAmt"] as Amount).localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), - ), - )} ${ref.watch( - managerProvider.select((value) => value.coin), - ).ticker}", + ref + .watch(pAmountFormatter(ref.watch( + walletsChangeNotifierProvider.select( + (value) => value.getManager(walletId).coin)))) + .format((transactionInfo["recipientAmt"] as Amount)), style: STextStyles.itemSubtitle12(context), textAlign: TextAlign.right, ), @@ -646,19 +641,20 @@ class _ConfirmChangeNowSendViewState style: STextStyles.smallMed12(context), ), Text( - "${(transactionInfo["fee"] is Amount ? transactionInfo["fee"] as Amount : (transactionInfo["fee"] as int).toAmountAsRaw(fractionDigits: ref.watch( - managerProvider.select( - (value) => value.coin.decimals, - ), - ))).localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), - ), - )} ${ref.watch( + ref + .watch(pAmountFormatter(ref.watch( managerProvider.select((value) => value.coin), - ).ticker}", + ))) + .format( + (transactionInfo["fee"] is Amount + ? transactionInfo["fee"] as Amount + : (transactionInfo["fee"] as int).toAmountAsRaw( + fractionDigits: ref.watch( + managerProvider.select( + (value) => value.coin.decimals, + ), + ))), + ), style: STextStyles.itemSubtitle12(context), textAlign: TextAlign.right, ), @@ -750,16 +746,9 @@ class _ConfirmChangeNowSendViewState final amount = transactionInfo["recipientAmt"] as Amount; final total = amount + fee; - final locale = ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), - ); + return Text( - "${total.localizedStringAsFixed( - locale: locale, - )}" - " ${coin.ticker}", + ref.watch(pAmountFormatter(coin)).format(total), style: STextStyles.itemSubtitle12(context).copyWith( color: Theme.of(context) .extension()! diff --git a/lib/pages/exchange_view/exchange_coin_selection/exchange_currency_selection_view.dart b/lib/pages/exchange_view/exchange_coin_selection/exchange_currency_selection_view.dart index f53fb9292..63f212206 100644 --- a/lib/pages/exchange_view/exchange_coin_selection/exchange_currency_selection_view.dart +++ b/lib/pages/exchange_view/exchange_coin_selection/exchange_currency_selection_view.dart @@ -9,11 +9,11 @@ import 'package:stackduo/models/isar/exchange_cache/pair.dart'; import 'package:stackduo/services/exchange/change_now/change_now_exchange.dart'; import 'package:stackduo/services/exchange/exchange_data_loading_service.dart'; import 'package:stackduo/services/exchange/majestic_bank/majestic_bank_exchange.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/util.dart'; import 'package:stackduo/widgets/background.dart'; import 'package:stackduo/widgets/conditional_parent.dart'; @@ -371,18 +371,27 @@ class _ExchangeCurrencySelectionViewState SizedBox( width: 24, height: 24, - child: hasImageUrl - ? SvgPicture.network( - items[index].image, - width: 24, - height: 24, - placeholderBuilder: (_) => - const LoadingIndicator(), - ) - : const SizedBox( - width: 24, - height: 24, - ), + child: + // isStackCoin(items[index].ticker) + // ? CoinIconForTicker( + // ticker: items[index].ticker, size: 24) + // // ? getIconForTicker( + // // items[index].ticker, + // // size: 24, + // // ) + // : + hasImageUrl + ? SvgPicture.network( + items[index].image, + width: 24, + height: 24, + placeholderBuilder: (_) => + const LoadingIndicator(), + ) + : const SizedBox( + width: 24, + height: 24, + ), ), const SizedBox( width: 10, diff --git a/lib/pages/exchange_view/exchange_step_views/step_4_view.dart b/lib/pages/exchange_view/exchange_step_views/step_4_view.dart index a5af66551..68e69148b 100644 --- a/lib/pages/exchange_view/exchange_step_views/step_4_view.dart +++ b/lib/pages/exchange_view/exchange_step_views/step_4_view.dart @@ -567,7 +567,7 @@ class _Step4ViewState extends ConsumerState { height: 24, ), Center( - child: QrImage( + child: QrImageView( // TODO: grab coin uri scheme from somewhere // data: "${coin.uriScheme}:$receivingAddress", data: model.trade!.payInAddress, diff --git a/lib/pages/exchange_view/exchange_view.dart b/lib/pages/exchange_view/exchange_view.dart index c77b28c59..a4faa9956 100644 --- a/lib/pages/exchange_view/exchange_view.dart +++ b/lib/pages/exchange_view/exchange_view.dart @@ -3,16 +3,16 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/blockchain_data/transaction.dart'; import 'package:stackduo/pages/exchange_view/exchange_form.dart'; import 'package:stackduo/pages/exchange_view/trade_details_view.dart'; import 'package:stackduo/providers/global/trades_service_provider.dart'; import 'package:stackduo/providers/providers.dart'; import 'package:stackduo/services/exchange/exchange_data_loading_service.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/widgets/conditional_parent.dart'; import 'package:stackduo/widgets/custom_loading_overlay.dart'; import 'package:stackduo/widgets/trade_card.dart'; diff --git a/lib/pages/exchange_view/send_from_view.dart b/lib/pages/exchange_view/send_from_view.dart index b845835f1..0e1e17496 100644 --- a/lib/pages/exchange_view/send_from_view.dart +++ b/lib/pages/exchange_view/send_from_view.dart @@ -15,6 +15,7 @@ import 'package:stackduo/services/coins/manager.dart'; import 'package:stackduo/themes/coin_icon_provider.dart'; import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; @@ -146,13 +147,7 @@ class _SendFromViewState extends ConsumerState { Row( children: [ Text( - "You need to send ${amount.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), - ), - )} ${coin.ticker}", + "You need to send ${ref.watch(pAmountFormatter(coin)).format(amount)}", style: isDesktop ? STextStyles.desktopTextExtraExtraSmall(context) : STextStyles.itemSubtitle(context), @@ -426,6 +421,13 @@ class _SendFromCardState extends ConsumerState { "Use private balance", style: STextStyles.itemSubtitle(context), ), + // Text( + // ref.watch(pAmountFormatter(coin)).format( + // (manager.wallet as FiroWallet) + // .availablePrivateBalance(), + // ), + // style: STextStyles.itemSubtitle(context), + // ), ], ), SvgPicture.asset( @@ -482,6 +484,12 @@ class _SendFromCardState extends ConsumerState { "Use public balance", style: STextStyles.itemSubtitle(context), ), + // Text( + // ref.watch(pAmountFormatter(coin)).format( + // (manager.wallet as FiroWallet) + // .availablePublicBalance()), + // style: STextStyles.itemSubtitle(context), + // ), ], ), SvgPicture.asset( @@ -567,9 +575,9 @@ class _SendFromCardState extends ConsumerState { ), if (!isFiro) Text( - "${manager.balance.spendable.localizedStringAsFixed( - locale: locale, - )} ${coin.ticker}", + ref + .watch(pAmountFormatter(coin)) + .format(manager.balance.spendable), style: STextStyles.itemSubtitle(context), ), ], diff --git a/lib/pages/exchange_view/sub_widgets/exchange_provider_option.dart b/lib/pages/exchange_view/sub_widgets/exchange_provider_option.dart index 565f8cd0d..de90ff7d2 100644 --- a/lib/pages/exchange_view/sub_widgets/exchange_provider_option.dart +++ b/lib/pages/exchange_view/sub_widgets/exchange_provider_option.dart @@ -6,13 +6,15 @@ import 'package:stackduo/models/exchange/response_objects/estimate.dart'; import 'package:stackduo/providers/exchange/exchange_form_state_provider.dart'; import 'package:stackduo/providers/global/locale_provider.dart'; import 'package:stackduo/services/exchange/exchange.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; +import 'package:stackduo/utilities/amount/amount_unit.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/enums/exchange_rate_type_enum.dart'; import 'package:stackduo/utilities/logger.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/util.dart'; import 'package:stackduo/widgets/animated_text.dart'; import 'package:stackduo/widgets/conditional_parent.dart'; @@ -97,13 +99,32 @@ class _ExchangeOptionState extends ConsumerState { .toAmount(fractionDigits: decimals); } - final rateString = - "1 ${sendCurrency.ticker.toUpperCase()} ~ ${rate.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider - .select((value) => value.locale), - ), - )} ${receivingCurrency.ticker.toUpperCase()}"; + Coin? coin; + try { + coin = coinFromTickerCaseInsensitive( + receivingCurrency.ticker); + } catch (_) { + coin = null; + } + + final String rateString; + if (coin != null) { + rateString = "1 ${sendCurrency.ticker.toUpperCase()} " + "~ ${ref.watch(pAmountFormatter(coin)).format(rate)}"; + } else { + final formatter = AmountFormatter( + unit: AmountUnit.normal, + locale: ref.watch( + localeServiceChangeNotifierProvider + .select((value) => value.locale), + ), + coin: Coin.bitcoin, // some sane default + maxDecimals: 8, // some sane default + ); + rateString = "1 ${sendCurrency.ticker.toUpperCase()} " + "~ ${formatter.format(rate, withUnitName: false)}" + " ${receivingCurrency.ticker.toUpperCase()}"; + } return ConditionalParent( condition: i > 0, diff --git a/lib/pages/exchange_view/trade_details_view.dart b/lib/pages/exchange_view/trade_details_view.dart index 3431d4296..d8dc6a0fa 100644 --- a/lib/pages/exchange_view/trade_details_view.dart +++ b/lib/pages/exchange_view/trade_details_view.dart @@ -26,6 +26,7 @@ import 'package:stackduo/services/exchange/trocador/trocador_exchange.dart'; import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/themes/theme_providers.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/clipboard_interface.dart'; import 'package:stackduo/utilities/constants.dart'; @@ -356,13 +357,9 @@ class _TradeDetailsViewState extends ConsumerState { trade.payInCurrency); final amount = sendAmount.toAmount( fractionDigits: coin.decimals); - text = amount.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), - ), - ); + text = ref + .watch(pAmountFormatter(coin)) + .format(amount); } catch (_) { text = sendAmount.toStringAsFixed( trade.payInCurrency.toLowerCase() == "xmr" @@ -771,7 +768,7 @@ class _TradeDetailsViewState extends ConsumerState { child: SizedBox( width: width + 20, height: width + 20, - child: QrImage( + child: QrImageView( data: trade.payInAddress, size: width, backgroundColor: Theme.of(context) diff --git a/lib/pages/paynym/dialogs/confirm_paynym_connect_dialog.dart b/lib/pages/paynym/dialogs/confirm_paynym_connect_dialog.dart index 3b4511a20..2d413399a 100644 --- a/lib/pages/paynym/dialogs/confirm_paynym_connect_dialog.dart +++ b/lib/pages/paynym/dialogs/confirm_paynym_connect_dialog.dart @@ -1,10 +1,12 @@ import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/util.dart'; import 'package:stackduo/widgets/desktop/desktop_dialog.dart'; import 'package:stackduo/widgets/desktop/desktop_dialog_close_button.dart'; @@ -12,7 +14,7 @@ import 'package:stackduo/widgets/desktop/primary_button.dart'; import 'package:stackduo/widgets/desktop/secondary_button.dart'; import 'package:stackduo/widgets/stack_dialog.dart'; -class ConfirmPaynymConnectDialog extends StatelessWidget { +class ConfirmPaynymConnectDialog extends ConsumerWidget { const ConfirmPaynymConnectDialog({ Key? key, required this.nymName, @@ -30,14 +32,14 @@ class ConfirmPaynymConnectDialog extends StatelessWidget { String get title => "Connect to $nymName"; - String get message => "A one-time connection fee of " - "${amount.localizedStringAsFixed(locale: locale)} ${coin.ticker} " + String message(String amountString) => "A one-time connection fee of " + "$amountString " "will be charged to connect to this PayNym.\n\nThis fee " "covers the cost of creating a one-time transaction to create a " "record on the blockchain. This keeps PayNyms decentralized."; @override - Widget build(BuildContext context) { + Widget build(BuildContext context, WidgetRef ref) { if (Util.isDesktop) { return DesktopDialog( maxHeight: double.infinity, @@ -76,7 +78,7 @@ class ConfirmPaynymConnectDialog extends StatelessWidget { right: 40, ), child: Text( - message, + message(ref.watch(pAmountFormatter(coin)).format(amount)), style: STextStyles.desktopTextMedium(context).copyWith( color: Theme.of(context).extension()!.textDark3, ), @@ -123,7 +125,7 @@ class ConfirmPaynymConnectDialog extends StatelessWidget { width: 24, height: 24, ), - message: message, + message: message(ref.watch(pAmountFormatter(coin)).format(amount)), leftButton: SecondaryButton( buttonHeight: ButtonHeight.xl, label: "Cancel", diff --git a/lib/pages/paynym/dialogs/paynym_details_popup.dart b/lib/pages/paynym/dialogs/paynym_details_popup.dart index 0fdc2b427..c2e81773f 100644 --- a/lib/pages/paynym/dialogs/paynym_details_popup.dart +++ b/lib/pages/paynym/dialogs/paynym_details_popup.dart @@ -138,6 +138,9 @@ class _PaynymDetailsPopupState extends ConsumerState { nymName: widget.accountLite.nymName, locale: ref.read(localeServiceChangeNotifierProvider).locale, onConfirmPressed: () { + // + print("CONFIRM NOTIF TX: $preparedTx"); + Navigator.of(context).push( RouteGenerator.getRoute( builder: (_) => ConfirmTransactionView( @@ -366,7 +369,7 @@ class _PaynymDetailsPopupState extends ConsumerState { const SizedBox( width: 20, ), - QrImage( + QrImageView( padding: const EdgeInsets.all(0), size: 100, data: widget.accountLite.code, diff --git a/lib/pages/paynym/dialogs/paynym_qr_popup.dart b/lib/pages/paynym/dialogs/paynym_qr_popup.dart index 19adf19c0..23c1303d3 100644 --- a/lib/pages/paynym/dialogs/paynym_qr_popup.dart +++ b/lib/pages/paynym/dialogs/paynym_qr_popup.dart @@ -147,7 +147,7 @@ class PaynymQrPopup extends StatelessWidget { const SizedBox( width: 20, ), - QrImage( + QrImageView( padding: const EdgeInsets.all(0), size: 130, data: paynymAccount.nonSegwitPaymentCode.code, diff --git a/lib/pages/paynym/subwidgets/desktop_paynym_details.dart b/lib/pages/paynym/subwidgets/desktop_paynym_details.dart index 7eb7b2832..81c3ed341 100644 --- a/lib/pages/paynym/subwidgets/desktop_paynym_details.dart +++ b/lib/pages/paynym/subwidgets/desktop_paynym_details.dart @@ -356,7 +356,7 @@ class _PaynymDetailsPopupState extends ConsumerState { const SizedBox( width: 20, ), - QrImage( + QrImageView( padding: const EdgeInsets.all(0), size: 100, data: widget.accountLite.code, diff --git a/lib/pages/receive_view/addresses/address_card.dart b/lib/pages/receive_view/addresses/address_card.dart index df5484ff8..b9ad4956f 100644 --- a/lib/pages/receive_view/addresses/address_card.dart +++ b/lib/pages/receive_view/addresses/address_card.dart @@ -5,7 +5,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/isar_models.dart'; import 'package:stackduo/pages/receive_view/addresses/address_tag.dart'; import 'package:stackduo/themes/coin_icon_provider.dart'; diff --git a/lib/pages/receive_view/addresses/address_details_view.dart b/lib/pages/receive_view/addresses/address_details_view.dart index 3ea6dc51f..ecbe7cd4a 100644 --- a/lib/pages/receive_view/addresses/address_details_view.dart +++ b/lib/pages/receive_view/addresses/address_details_view.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:isar/isar.dart'; import 'package:qr_flutter/qr_flutter.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/isar_models.dart'; import 'package:stackduo/pages/receive_view/addresses/address_tag.dart'; import 'package:stackduo/pages/wallet_view/sub_widgets/no_transactions_found.dart'; @@ -77,7 +77,7 @@ class _AddressDetailsViewState extends ConsumerState { Center( child: RepaintBoundary( key: _qrKey, - child: QrImage( + child: QrImageView( data: AddressUtils.buildUriString( ref.watch(walletsChangeNotifierProvider.select( (value) => @@ -266,7 +266,7 @@ class _AddressDetailsViewState extends ConsumerState { Center( child: RepaintBoundary( key: _qrKey, - child: QrImage( + child: QrImageView( data: AddressUtils.buildUriString( ref.watch(walletsChangeNotifierProvider.select( (value) => diff --git a/lib/pages/receive_view/addresses/address_qr_popup.dart b/lib/pages/receive_view/addresses/address_qr_popup.dart index f93e33b21..e8d27165a 100644 --- a/lib/pages/receive_view/addresses/address_qr_popup.dart +++ b/lib/pages/receive_view/addresses/address_qr_popup.dart @@ -126,7 +126,7 @@ class _AddressQrPopupState extends State { Center( child: RepaintBoundary( key: _qrKey, - child: QrImage( + child: QrImageView( data: AddressUtils.buildUriString( widget.coin, widget.addressString, diff --git a/lib/pages/receive_view/addresses/edit_address_label_view.dart b/lib/pages/receive_view/addresses/edit_address_label_view.dart index 0f69f9f0a..a23d64ed5 100644 --- a/lib/pages/receive_view/addresses/edit_address_label_view.dart +++ b/lib/pages/receive_view/addresses/edit_address_label_view.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/address_label.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/text_styles.dart'; diff --git a/lib/pages/receive_view/addresses/wallet_addresses_view.dart b/lib/pages/receive_view/addresses/wallet_addresses_view.dart index e597c4c84..06b9ce19a 100644 --- a/lib/pages/receive_view/addresses/wallet_addresses_view.dart +++ b/lib/pages/receive_view/addresses/wallet_addresses_view.dart @@ -2,15 +2,15 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/isar_models.dart'; import 'package:stackduo/pages/receive_view/addresses/address_card.dart'; import 'package:stackduo/pages/receive_view/addresses/address_details_view.dart'; import 'package:stackduo/providers/global/wallets_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/util.dart'; import 'package:stackduo/widgets/background.dart'; import 'package:stackduo/widgets/conditional_parent.dart'; diff --git a/lib/pages/receive_view/generate_receiving_uri_qr_code_view.dart b/lib/pages/receive_view/generate_receiving_uri_qr_code_view.dart index f8524fc0a..0782e26bc 100644 --- a/lib/pages/receive_view/generate_receiving_uri_qr_code_view.dart +++ b/lib/pages/receive_view/generate_receiving_uri_qr_code_view.dart @@ -13,15 +13,14 @@ import 'package:path_provider/path_provider.dart'; import 'package:qr_flutter/qr_flutter.dart'; import 'package:share_plus/share_plus.dart'; import 'package:stackduo/notifications/show_flush_bar.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/address_utils.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/clipboard_interface.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; -import 'package:stackduo/utilities/enums/flush_bar_type.dart'; import 'package:stackduo/utilities/logger.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/util.dart'; import 'package:stackduo/widgets/background.dart'; import 'package:stackduo/widgets/conditional_parent.dart'; @@ -194,7 +193,7 @@ class _GenerateUriQrCodeViewState extends State { child: SizedBox( width: width + 20, height: width + 20, - child: QrImage( + child: QrImageView( data: uriString, size: width, backgroundColor: @@ -529,7 +528,7 @@ class _GenerateUriQrCodeViewState extends State { child: SizedBox( width: 234, height: 234, - child: QrImage( + child: QrImageView( data: _uriString, size: 220, backgroundColor: Theme.of(context) diff --git a/lib/pages/receive_view/receive_view.dart b/lib/pages/receive_view/receive_view.dart index 416ef408b..7362b376c 100644 --- a/lib/pages/receive_view/receive_view.dart +++ b/lib/pages/receive_view/receive_view.dart @@ -25,15 +25,15 @@ import 'package:stackduo/widgets/rounded_white_container.dart'; class ReceiveView extends ConsumerStatefulWidget { const ReceiveView({ Key? key, - required this.coin, required this.walletId, + this.tokenContract, this.clipboard = const ClipboardWrapper(), }) : super(key: key); static const String routeName = "/receiveView"; - final Coin coin; final String walletId; + final dynamic? tokenContract; final ClipboardInterface clipboard; @override @@ -86,7 +86,7 @@ class _ReceiveViewState extends ConsumerState { @override void initState() { walletId = widget.walletId; - coin = widget.coin; + coin = ref.read(walletsChangeNotifierProvider).getManager(walletId).coin; clipboard = widget.clipboard; WidgetsBinding.instance.addPostFrameCallback((timeStamp) async { @@ -117,6 +117,8 @@ class _ReceiveViewState extends ConsumerState { } }); + final ticker = widget.tokenContract?.symbol ?? coin.ticker; + return Background( child: Scaffold( backgroundColor: Theme.of(context).extension()!.background, @@ -127,7 +129,7 @@ class _ReceiveViewState extends ConsumerState { }, ), title: Text( - "Receive ${coin.ticker}", + "Receive $ticker", style: STextStyles.navBarTitle(context), ), actions: [ @@ -248,7 +250,7 @@ class _ReceiveViewState extends ConsumerState { Row( children: [ Text( - "Your ${coin.ticker} address", + "Your $ticker address", style: STextStyles.itemSubtitle(context), ), const Spacer(), @@ -315,7 +317,7 @@ class _ReceiveViewState extends ConsumerState { child: Center( child: Column( children: [ - QrImage( + QrImageView( data: "${coin.uriScheme}:$receivingAddress", size: MediaQuery.of(context).size.width / 2, foregroundColor: Theme.of(context) diff --git a/lib/pages/send_view/confirm_transaction_view.dart b/lib/pages/send_view/confirm_transaction_view.dart index 84ae8ac7c..2acd2e601 100644 --- a/lib/pages/send_view/confirm_transaction_view.dart +++ b/lib/pages/send_view/confirm_transaction_view.dart @@ -18,6 +18,7 @@ import 'package:stackduo/services/mixins/paynym_wallet_interface.dart'; import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/themes/theme_providers.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/text_styles.dart'; @@ -44,6 +45,7 @@ class ConfirmTransactionView extends ConsumerStatefulWidget { this.isTradeTransaction = false, this.isPaynymTransaction = false, this.isPaynymNotificationTransaction = false, + this.isTokenTx = false, this.onSuccessInsteadOfRouteOnSuccess, }) : super(key: key); @@ -55,6 +57,7 @@ class ConfirmTransactionView extends ConsumerStatefulWidget { final bool isTradeTransaction; final bool isPaynymTransaction; final bool isPaynymNotificationTransaction; + final bool isTokenTx; final VoidCallback? onSuccessInsteadOfRouteOnSuccess; @override @@ -104,13 +107,26 @@ class _ConfirmTransactionViewState final note = noteController.text; try { - if (widget.isPaynymNotificationTransaction) { + // if (widget.isTokenTx) { + // txidFuture = ref + // .read(tokenServiceProvider)! + // .confirmSend(txData: transactionInfo); + // } else + if (widget.isPaynymNotificationTransaction) { txidFuture = (manager.wallet as PaynymWalletInterface) .broadcastNotificationTx(preparedTx: transactionInfo); } else if (widget.isPaynymTransaction) { txidFuture = manager.confirmSend(txData: transactionInfo); } else { - txidFuture = manager.confirmSend(txData: transactionInfo); + // final coin = manager.coin; + // if ((coin == Coin.firo || coin == Coin.firoTestNet) && + // ref.read(publicPrivateBalanceStateProvider.state).state != + // "Private") { + // txidFuture = (manager.wallet as FiroWallet) + // .confirmSendPublic(txData: transactionInfo); + // } else { + txidFuture = manager.confirmSend(txData: transactionInfo); + // } } final results = await Future.wait([ @@ -140,6 +156,20 @@ class _ConfirmTransactionViewState widget.onSuccessInsteadOfRouteOnSuccess!.call(); } } + // } on BadEpicHttpAddressException catch (_) { + // if (mounted) { + // // pop building dialog + // Navigator.of(context).pop(); + // unawaited( + // showFloatingFlushBar( + // type: FlushBarType.warning, + // message: + // "Connection failed. Please check the address and try again.", + // context: context, + // ), + // ); + // return; + // } } catch (e, s) { //todo: comeback to this debugPrint("$e\n$s"); @@ -241,8 +271,16 @@ class _ConfirmTransactionViewState final managerProvider = ref.watch(walletsChangeNotifierProvider .select((value) => value.getManagerProvider(walletId))); - final String unit = ref.watch(walletsChangeNotifierProvider - .select((value) => value.getManager(walletId).coin.ticker)); + final coin = ref.watch(walletsChangeNotifierProvider + .select((value) => value.getManager(walletId).coin)); + + final String unit; + // if (widget.isTokenTx) { + // unit = ref.watch( + // tokenServiceProvider.select((value) => value!.tokenContract.symbol)); + // } else { + unit = coin.ticker; + // } return ConditionalParent( condition: !isDesktop, @@ -369,50 +407,76 @@ class _ConfirmTransactionViewState style: STextStyles.smallMed12(context), ), Text( - "${(transactionInfo["recipientAmt"] as Amount).localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider - .select((value) => value.locale), - ), - )} $unit", + ref.watch(pAmountFormatter(coin)).format( + transactionInfo["recipientAmt"] as Amount, + // ethContract: + // ref + // .watch(tokenServiceProvider) + // ?.tokenContract, + ), style: STextStyles.itemSubtitle12(context), textAlign: TextAlign.right, ), ], ), ), - const SizedBox( - height: 12, - ), - RoundedWhiteContainer( - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - "Transaction fee", - style: STextStyles.smallMed12(context), - ), - Text( - "${(transactionInfo["fee"] is Amount ? transactionInfo["fee"] as Amount : (transactionInfo["fee"] as int).toAmountAsRaw( - fractionDigits: ref.watch( - managerProvider.select( - (value) => value.coin.decimals, + // if (coin != Coin.banano && coin != Coin.nano) + const SizedBox( + height: 12, + ), + // if (coin != Coin.banano && coin != Coin.nano) + RoundedWhiteContainer( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "Transaction fee", + style: STextStyles.smallMed12(context), + ), + Text( + ref.watch(pAmountFormatter(coin)).format( + (transactionInfo["fee"] is Amount + ? transactionInfo["fee"] as Amount + : (transactionInfo["fee"] as int) + .toAmountAsRaw( + fractionDigits: ref.watch( + managerProvider.select( + (value) => value.coin.decimals, + ), + ), + )), ), - ), - )).localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider - .select((value) => value.locale), - ), - )} ${ref.watch( - managerProvider.select((value) => value.coin), - ).ticker}", - style: STextStyles.itemSubtitle12(context), - textAlign: TextAlign.right, - ), - ], + style: STextStyles.itemSubtitle12(context), + textAlign: TextAlign.right, + ), + ], + ), + ), + if (transactionInfo["fee"] is int && + transactionInfo["vSize"] is int) + const SizedBox( + height: 12, + ), + if (transactionInfo["fee"] is int && + transactionInfo["vSize"] is int) + RoundedWhiteContainer( + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "sats/vByte", + style: STextStyles.smallMed12(context), + ), + const SizedBox( + height: 4, + ), + Text( + "~${(transactionInfo["fee"] / transactionInfo["vSize"]).toInt()}", + style: STextStyles.itemSubtitle12(context), + ), + ], + ), ), - ), const SizedBox( height: 12, ), @@ -524,14 +588,28 @@ class _ConfirmTransactionViewState String fiatAmount = "N/A"; if (externalCalls) { - final price = ref - .read(priceAnd24hChangeNotifierProvider) - .getPrice(coin) - .item1; + final price = + // widget.isTokenTx + // ? ref + // .read( + // priceAnd24hChangeNotifierProvider) + // .getTokenPrice( + // ref + // .read(tokenServiceProvider)! + // .tokenContract + // .address, + // ) + // .item1 + // : + ref + .read( + priceAnd24hChangeNotifierProvider) + .getPrice(coin) + .item1; if (price > Decimal.zero) { fiatAmount = (amount.decimal * price) .toAmount(fractionDigits: 2) - .localizedStringAsFixed( + .fiatString( locale: ref .read( localeServiceChangeNotifierProvider) @@ -543,12 +621,12 @@ class _ConfirmTransactionViewState return Row( children: [ Text( - "${amount.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider - .select((value) => value.locale), - ), - )} $unit", + ref.watch(pAmountFormatter(coin)).format( + amount, + // ethContract: ref + // .read(tokenServiceProvider) + // ?.tokenContract + ), style: STextStyles .desktopTextExtraExtraSmall( context) @@ -658,14 +736,9 @@ class _ConfirmTransactionViewState ); return Text( - "${fee.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider - .select( - (value) => value.locale, - ), - ), - )} ${coin.ticker}", + ref + .watch(pAmountFormatter(coin)) + .format(fee), style: STextStyles.desktopTextExtraExtraSmall( context) @@ -838,75 +911,76 @@ class _ConfirmTransactionViewState ); return Text( - "${fee.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), - ), - )} ${coin.ticker}", + ref.watch(pAmountFormatter(coin)).format(fee), style: STextStyles.itemSubtitle(context), ); }, ), ), ), + if (isDesktop && + !widget.isPaynymTransaction && + transactionInfo["fee"] is int && + transactionInfo["vSize"] is int) + Padding( + padding: const EdgeInsets.only( + left: 32, + ), + child: Text( + "sats/vByte", + style: STextStyles.desktopTextExtraExtraSmall(context), + ), + ), + if (isDesktop && + !widget.isPaynymTransaction && + transactionInfo["fee"] is int && + transactionInfo["vSize"] is int) + Padding( + padding: const EdgeInsets.only( + top: 10, + left: 32, + right: 32, + ), + child: RoundedContainer( + padding: const EdgeInsets.symmetric( + horizontal: 16, + vertical: 18, + ), + color: Theme.of(context) + .extension()! + .textFieldDefaultBG, + child: Text( + "~${(transactionInfo["fee"] / transactionInfo["vSize"]).toInt()}", + style: STextStyles.itemSubtitle(context), + ), + ), + ), if (!isDesktop) const Spacer(), SizedBox( height: isDesktop ? 23 : 12, ), - Padding( - padding: isDesktop - ? const EdgeInsets.symmetric( - horizontal: 32, - ) - : const EdgeInsets.all(0), - child: RoundedContainer( + if (!widget.isTokenTx) + Padding( padding: isDesktop ? const EdgeInsets.symmetric( - horizontal: 16, - vertical: 18, + horizontal: 32, ) - : const EdgeInsets.all(12), - color: Theme.of(context) - .extension()! - .snackBarBackSuccess, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - isDesktop ? "Total amount to send" : "Total amount", - style: isDesktop - ? STextStyles.desktopTextExtraExtraSmall(context) - .copyWith( - color: Theme.of(context) - .extension()! - .textConfirmTotalAmount, - ) - : STextStyles.titleBold12(context).copyWith( - color: Theme.of(context) - .extension()! - .textConfirmTotalAmount, - ), - ), - Builder(builder: (context) { - final coin = ref.watch(walletsChangeNotifierProvider - .select((value) => value.getManager(walletId).coin)); - final fee = transactionInfo["fee"] is Amount - ? transactionInfo["fee"] as Amount - : (transactionInfo["fee"] as int) - .toAmountAsRaw(fractionDigits: coin.decimals); - final locale = ref.watch( - localeServiceChangeNotifierProvider - .select((value) => value.locale), - ); - final amount = transactionInfo["recipientAmt"] as Amount; - return Text( - "${(amount + fee).localizedStringAsFixed( - locale: locale, - )} ${ref.watch( - managerProvider.select((value) => value.coin), - ).ticker}", + : const EdgeInsets.all(0), + child: RoundedContainer( + padding: isDesktop + ? const EdgeInsets.symmetric( + horizontal: 16, + vertical: 18, + ) + : const EdgeInsets.all(12), + color: Theme.of(context) + .extension()! + .snackBarBackSuccess, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + isDesktop ? "Total amount to send" : "Total amount", style: isDesktop ? STextStyles.desktopTextExtraExtraSmall(context) .copyWith( @@ -914,18 +988,46 @@ class _ConfirmTransactionViewState .extension()! .textConfirmTotalAmount, ) - : STextStyles.itemSubtitle12(context).copyWith( + : STextStyles.titleBold12(context).copyWith( color: Theme.of(context) .extension()! .textConfirmTotalAmount, ), - textAlign: TextAlign.right, - ); - }), - ], + ), + Builder(builder: (context) { + final coin = ref.watch( + walletsChangeNotifierProvider.select( + (value) => value.getManager(walletId).coin)); + final fee = transactionInfo["fee"] is Amount + ? transactionInfo["fee"] as Amount + : (transactionInfo["fee"] as int) + .toAmountAsRaw(fractionDigits: coin.decimals); + + final amount = + transactionInfo["recipientAmt"] as Amount; + return Text( + ref + .watch(pAmountFormatter(coin)) + .format(amount + fee), + style: isDesktop + ? STextStyles.desktopTextExtraExtraSmall(context) + .copyWith( + color: Theme.of(context) + .extension()! + .textConfirmTotalAmount, + ) + : STextStyles.itemSubtitle12(context).copyWith( + color: Theme.of(context) + .extension()! + .textConfirmTotalAmount, + ), + textAlign: TextAlign.right, + ); + }), + ], + ), ), ), - ), SizedBox( height: isDesktop ? 28 : 16, ), diff --git a/lib/pages/send_view/send_view.dart b/lib/pages/send_view/send_view.dart index 97cf1f839..277850348 100644 --- a/lib/pages/send_view/send_view.dart +++ b/lib/pages/send_view/send_view.dart @@ -26,6 +26,9 @@ import 'package:stackduo/themes/coin_icon_provider.dart'; import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/address_utils.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; +import 'package:stackduo/utilities/amount/amount_input_formatter.dart'; +import 'package:stackduo/utilities/amount/amount_unit.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/barcode_scanner_interface.dart'; import 'package:stackduo/utilities/clipboard_interface.dart'; @@ -40,6 +43,7 @@ import 'package:stackduo/widgets/animated_text.dart'; import 'package:stackduo/widgets/background.dart'; import 'package:stackduo/widgets/custom_buttons/app_bar_icon_button.dart'; import 'package:stackduo/widgets/custom_buttons/blue_text_button.dart'; +import 'package:stackduo/widgets/fee_slider.dart'; import 'package:stackduo/widgets/icon_widgets/addressbook_icon.dart'; import 'package:stackduo/widgets/icon_widgets/clipboard_icon.dart'; import 'package:stackduo/widgets/icon_widgets/qrcode_icon.dart'; @@ -108,15 +112,11 @@ class _SendViewState extends ConsumerState { void _cryptoAmountChanged() async { if (!_cryptoAmountChangeLock) { - final String cryptoAmount = cryptoAmountController.text; - if (cryptoAmount.isNotEmpty && - cryptoAmount != "." && - cryptoAmount != ",") { - _amountToSend = cryptoAmount.contains(",") - ? Decimal.parse(cryptoAmount.replaceFirst(",", ".")) - .toAmount(fractionDigits: coin.decimals) - : Decimal.parse(cryptoAmount) - .toAmount(fractionDigits: coin.decimals); + final cryptoAmount = ref.read(pAmountFormatter(coin)).tryParse( + cryptoAmountController.text, + ); + if (cryptoAmount != null) { + _amountToSend = cryptoAmount; if (_cachedAmountToSend != null && _cachedAmountToSend == _amountToSend) { return; @@ -133,7 +133,7 @@ class _SendViewState extends ConsumerState { .toAmount( fractionDigits: 2, ) - .localizedStringAsFixed( + .fiatString( locale: ref.read(localeServiceChangeNotifierProvider).locale, ); } @@ -182,6 +182,15 @@ class _SendViewState extends ConsumerState { late Amount _currentFee; void _setCurrentFee(String fee, bool shouldSetState) { + fee = fee.trim(); + + if (fee.startsWith("~")) { + fee = fee.substring(1); + } + if (fee.contains(" ")) { + fee = fee.split(" ").first; + } + final value = fee.contains(",") ? Decimal.parse(fee.replaceFirst(",", ".")) .toAmount(fractionDigits: coin.decimals) @@ -249,9 +258,10 @@ class _SendViewState extends ConsumerState { case FeeRateType.slow: feeRate = feeObject.slow; break; + default: + feeRate = -1; } - final String locale = ref.read(localeServiceChangeNotifierProvider).locale; Amount fee; if (coin == Coin.monero) { MoneroTransactionPriority specialMoneroId; @@ -265,15 +275,25 @@ class _SendViewState extends ConsumerState { case FeeRateType.slow: specialMoneroId = MoneroTransactionPriority.slow; break; + default: + throw ArgumentError("custom fee not available for monero"); } fee = await manager.estimateFeeFor(amount, specialMoneroId.raw!); - cachedFees[amount] = fee.localizedStringAsFixed(locale: locale); + cachedFees[amount] = ref.read(pAmountFormatter(coin)).format( + fee, + withUnitName: true, + indicatePrecisionLoss: false, + ); return cachedFees[amount]!; } else { fee = await manager.estimateFeeFor(amount, feeRate); - cachedFees[amount] = fee.localizedStringAsFixed(locale: locale); + cachedFees[amount] = ref.read(pAmountFormatter(coin)).format( + fee, + withUnitName: true, + indicatePrecisionLoss: false, + ); return cachedFees[amount]!; } @@ -394,6 +414,7 @@ class _SendViewState extends ConsumerState { isSegwit: widget.accountLite!.segwit, amount: amount, args: { + "satsPerVByte": isCustomFee ? customFeeRate : null, "feeRate": feeRate, "UTXOs": (manager.hasCoinControlSupport && coinControlEnabled && @@ -408,6 +429,7 @@ class _SendViewState extends ConsumerState { amount: amount, args: { "feeRate": ref.read(feeRateTypeStateProvider), + "satsPerVByte": isCustomFee ? customFeeRate : null, "UTXOs": (manager.hasCoinControlSupport && coinControlEnabled && selectedUTXOs.isNotEmpty) @@ -485,6 +507,10 @@ class _SendViewState extends ConsumerState { bool get isPaynymSend => widget.accountLite != null; + bool isCustomFee = false; + + int customFeeRate = 1; + @override void initState() { coin = widget.coin; @@ -510,7 +536,15 @@ class _SendViewState extends ConsumerState { if (_data != null) { if (_data!.amount != null) { - cryptoAmountController.text = _data!.amount!.toString(); + final amount = Amount.fromDecimal( + _data!.amount!, + fractionDigits: coin.decimals, + ); + + cryptoAmountController.text = ref.read(pAmountFormatter(coin)).format( + amount, + withUnitName: false, + ); } sendToController.text = _data!.contactLabel; _address = _data!.address.trim(); @@ -700,10 +734,12 @@ class _SendViewState extends ConsumerState { if (_cachedBalance != null) { return GestureDetector( onTap: () { - cryptoAmountController.text = - _cachedBalance! - .localizedStringAsFixed( - locale: locale); + cryptoAmountController.text = ref + .read(pAmountFormatter(coin)) + .format( + _cachedBalance!, + withUnitName: false, + ); }, child: Container( color: Colors.transparent, @@ -712,9 +748,10 @@ class _SendViewState extends ConsumerState { CrossAxisAlignment.end, children: [ Text( - "${_cachedBalance!.localizedStringAsFixed( - locale: locale, - )} ${coin.ticker}", + ref + .watch(pAmountFormatter( + coin)) + .format(_cachedBalance!), style: STextStyles.titleBold12( context) @@ -726,7 +763,7 @@ class _SendViewState extends ConsumerState { Text( "${(_cachedBalance!.decimal * ref.watch(priceAnd24hChangeNotifierProvider.select((value) => value.getPrice(coin).item1))).toAmount( fractionDigits: 2, - ).localizedStringAsFixed( + ).fiatString( locale: locale, )} ${ref.watch(prefsChangeNotifierProvider.select((value) => value.currency))}", style: STextStyles.subtitle( @@ -786,10 +823,32 @@ class _SendViewState extends ConsumerState { const SizedBox( height: 16, ), - Text( - isPaynymSend ? "Send to PayNym address" : "Send to", - style: STextStyles.smallMed12(context), - textAlign: TextAlign.left, + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + isPaynymSend + ? "Send to PayNym address" + : "Send to", + style: STextStyles.smallMed12(context), + textAlign: TextAlign.left, + ), + // if (coin == Coin.monero) + // CustomTextButton( + // text: "Use OpenAlias", + // onTap: () async { + // await showModalBottomSheet( + // context: context, + // builder: (context) => + // OpenAliasBottomSheet( + // onSelected: (address) { + // sendToController.text = address; + // }, + // ), + // ); + // }, + // ), + ], ), const SizedBox( height: 8, @@ -1011,10 +1070,15 @@ class _SendViewState extends ConsumerState { ); cryptoAmountController .text = - amount - .localizedStringAsFixed( - locale: locale, - ); + ref + .read( + pAmountFormatter( + coin)) + .format( + amount, + withUnitName: + false, + ); _amountToSend = amount; } @@ -1120,11 +1184,11 @@ class _SendViewState extends ConsumerState { text: "Send all ${coin.ticker}", onTap: () async { cryptoAmountController.text = ref - .read(provider) - .balance - .spendable - .localizedStringAsFixed(locale: locale); - + .read(pAmountFormatter(coin)) + .format( + ref.read(provider).balance.spendable, + withUnitName: false, + ); _cryptoAmountChanged(); }, ), @@ -1153,13 +1217,21 @@ class _SendViewState extends ConsumerState { ), textAlign: TextAlign.right, inputFormatters: [ + AmountInputFormatter( + decimals: coin.decimals, + unit: ref.watch(pAmountUnit(coin)), + locale: locale, + ), + // regex to validate a crypto amount with 8 decimal places - TextInputFormatter.withFunction((oldValue, - newValue) => - RegExp(r'^([0-9]*[,.]?[0-9]{0,8}|[,.][0-9]{0,8})$') - .hasMatch(newValue.text) - ? newValue - : oldValue), + // TextInputFormatter.withFunction((oldValue, + // newValue) => + // // RegExp(r'^([0-9]*[,.]?[0-9]{0,8}|[,.][0-9]{0,8})$') + // // RegExp(r'^\d{1,3}([,\.]\d+)?|[,\.\d]+$') + // getAmountRegex(locale, coin.decimals) + // .hasMatch(newValue.text) + // ? newValue + // : oldValue), ], decoration: InputDecoration( contentPadding: const EdgeInsets.only( @@ -1176,7 +1248,9 @@ class _SendViewState extends ConsumerState { child: Padding( padding: const EdgeInsets.all(12), child: Text( - coin.ticker, + ref + .watch(pAmountUnit(coin)) + .unitForCoin(coin), style: STextStyles.smallMed14(context) .copyWith( color: Theme.of(context) @@ -1212,26 +1286,25 @@ class _SendViewState extends ConsumerState { ), textAlign: TextAlign.right, inputFormatters: [ + AmountInputFormatter( + decimals: 2, + locale: locale, + ), // regex to validate a fiat amount with 2 decimal places - TextInputFormatter.withFunction((oldValue, - newValue) => - RegExp(r'^([0-9]*[,.]?[0-9]{0,2}|[,.][0-9]{0,2})$') - .hasMatch(newValue.text) - ? newValue - : oldValue), + // TextInputFormatter.withFunction((oldValue, + // newValue) => + // // RegExp(r'^([0-9]*[,.]?[0-9]{0,2}|[,.][0-9]{0,2})$') + // getAmountRegex(locale, 2) + // .hasMatch(newValue.text) + // ? newValue + // : oldValue), ], onChanged: (baseAmountString) { - if (baseAmountString.isNotEmpty && - baseAmountString != "." && - baseAmountString != ",") { - final Amount baseAmount = - baseAmountString.contains(",") - ? Decimal.parse(baseAmountString - .replaceFirst(",", ".")) - .toAmount(fractionDigits: 2) - : Decimal.parse(baseAmountString) - .toAmount(fractionDigits: 2); - + final baseAmount = Amount.tryParseFiatString( + baseAmountString, + locale: locale, + ); + if (baseAmount != null) { final Decimal _price = ref .read(priceAnd24hChangeNotifierProvider) .getPrice(coin) @@ -1262,12 +1335,10 @@ class _SendViewState extends ConsumerState { level: LogLevel.Info); final amountString = - _amountToSend!.localizedStringAsFixed( - locale: ref - .read( - localeServiceChangeNotifierProvider) - .locale, - ); + ref.read(pAmountFormatter(coin)).format( + _amountToSend!, + withUnitName: false, + ); _cryptoAmountChangeLock = true; cryptoAmountController.text = amountString; @@ -1439,14 +1510,23 @@ class _SendViewState extends ConsumerState { const SizedBox( height: 12, ), + // if (coin != Coin.epicCash && + // coin != Coin.nano && + // coin != Coin.banano) Text( "Transaction fee (estimated)", style: STextStyles.smallMed12(context), textAlign: TextAlign.left, ), + // if (coin != Coin.epicCash && + // coin != Coin.nano && + // coin != Coin.banano) const SizedBox( height: 8, ), + // if (coin != Coin.epicCash && + // coin != Coin.nano && + // coin != Coin.banano) Stack( children: [ TextField( @@ -1470,7 +1550,18 @@ class _SendViewState extends ConsumerState { Constants.size.circularBorderRadius, ), ), - onPressed: () { + onPressed: + // (coin == Coin.firo || + // coin == Coin.firoTestNet) && + // ref + // .watch( + // publicPrivateBalanceStateProvider + // .state) + // .state == + // "Private" + // ? null + // : + () { showModalBottomSheet( backgroundColor: Colors.transparent, context: context, @@ -1485,11 +1576,21 @@ class _SendViewState extends ConsumerState { amount: (Decimal.tryParse( cryptoAmountController .text) ?? + _amountToSend?.decimal ?? Decimal.zero) .toAmount( fractionDigits: coin.decimals, ), updateChosen: (String fee) { + if (fee == "custom") { + if (!isCustomFee) { + setState(() { + isCustomFee = true; + }); + } + return; + } + _setCurrentFee( fee, true, @@ -1497,12 +1598,61 @@ class _SendViewState extends ConsumerState { setState(() { _calculateFeesFuture = Future(() => fee); + if (isCustomFee) { + isCustomFee = false; + } }); }, ), ); }, - child: Row( + child: + // ((coin == Coin.firo || + // coin == Coin.firoTestNet) && + // ref + // .watch( + // publicPrivateBalanceStateProvider + // .state) + // .state == + // "Private") + // ? Row( + // children: [ + // FutureBuilder( + // future: _calculateFeesFuture, + // builder: (context, snapshot) { + // if (snapshot.connectionState == + // ConnectionState + // .done && + // snapshot.hasData) { + // _setCurrentFee( + // snapshot.data!, + // false, + // ); + // return Text( + // "~${snapshot.data!}", + // style: STextStyles + // .itemSubtitle( + // context), + // ); + // } else { + // return AnimatedText( + // stringsToLoopThrough: const [ + // "Calculating", + // "Calculating.", + // "Calculating..", + // "Calculating...", + // ], + // style: STextStyles + // .itemSubtitle( + // context), + // ); + // } + // }, + // ), + // ], + // ) + // : + Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -1527,11 +1677,13 @@ class _SendViewState extends ConsumerState { ConnectionState.done && snapshot.hasData) { _setCurrentFee( - snapshot.data! as String, + snapshot.data!, false, ); return Text( - "~${snapshot.data! as String} ${coin.ticker}", + isCustomFee + ? "" + : "~${snapshot.data!}", style: STextStyles.itemSubtitle( context), @@ -1567,6 +1719,18 @@ class _SendViewState extends ConsumerState { ) ], ), + if (isCustomFee) + Padding( + padding: const EdgeInsets.only( + bottom: 12, + top: 16, + ), + child: FeeSlider( + onSatVByteChanged: (rate) { + customFeeRate = rate; + }, + ), + ), const Spacer(), const SizedBox( height: 12, diff --git a/lib/pages/send_view/sub_widgets/openalias_sheet.dart b/lib/pages/send_view/sub_widgets/openalias_sheet.dart new file mode 100644 index 000000000..9c9d9a0f8 --- /dev/null +++ b/lib/pages/send_view/sub_widgets/openalias_sheet.dart @@ -0,0 +1,151 @@ +// /* +// * This file is part of Stack Wallet. +// * +// * Copyright (c) 2023 Cypher Stack +// * All Rights Reserved. +// * The code is distributed under GPLv3 license, see LICENSE file for details. +// * Generated by Cypher Stack on 2023-05-26 +// * +// */ +// +// import 'package:basic_utils/basic_utils.dart'; +// import 'package:flutter/material.dart'; +// import 'package:flutter_riverpod/flutter_riverpod.dart'; +// import 'package:stackduo/themes/stack_colors.dart'; +// import 'package:stackduo/utilities/constants.dart'; +// import 'package:stackduo/utilities/text_styles.dart'; +// +// class OpenAliasBottomSheet extends ConsumerStatefulWidget { +// const OpenAliasBottomSheet({ +// Key? key, +// required this.onSelected, +// }) : super(key: key); +// +// final Null Function(String) onSelected; +// +// @override +// ConsumerState createState() => +// _OpenAliasBottomSheetState(); +// } +// +// class _OpenAliasBottomSheetState extends ConsumerState { +// late TextEditingController textEditingController; +// +// @override +// void initState() { +// super.initState(); +// textEditingController = TextEditingController(); +// } +// +// @override +// Widget build(BuildContext context) { +// return SingleChildScrollView( +// child: Padding( +// padding: +// EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), +// child: Container( +// decoration: BoxDecoration( +// color: Theme.of(context).extension()!.popupBG, +// borderRadius: const BorderRadius.vertical( +// top: Radius.circular(20), +// ), +// ), +// child: Padding( +// padding: const EdgeInsets.only( +// top: 20, +// left: 20, +// right: 20, +// bottom: 20, +// ), +// child: Column( +// mainAxisSize: MainAxisSize.min, +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Center( +// child: Container( +// decoration: BoxDecoration( +// color: Theme.of(context) +// .extension()! +// .textFieldDefaultBG, +// borderRadius: BorderRadius.circular( +// Constants.size.circularBorderRadius, +// ), +// ), +// width: 60, +// height: 4, +// ), +// ), +// const SizedBox( +// height: 36, +// ), +// Text( +// 'OpenAlias Address', +// style: STextStyles.smallMed12(context), +// textAlign: TextAlign.left, +// ), +// const SizedBox( +// height: 8, +// ), +// TextField( +// controller: textEditingController, +// decoration: const InputDecoration( +// border: OutlineInputBorder(), +// ), +// ), +// const SizedBox( +// height: 16, +// ), +// Align( +// alignment: Alignment.bottomCenter, +// child: ConstrainedBox( +// constraints: const BoxConstraints( +// minWidth: 480, +// minHeight: 70, +// ), +// child: TextButton( +// style: Theme.of(context) +// .extension()! +// .getPrimaryEnabledButtonStyle(context), +// onPressed: () async { +// String text = textEditingController.text +// .trim() +// .replaceAll("@", "."); +// List? result = +// await DnsUtils.lookupRecord(text, RRecordType.TXT); +// String address = ""; +// if (result != null && result.isNotEmpty) { +// for (RRecord record in result) { +// if (record.data.startsWith("oa1:xmr")) { +// List datas = record.data.split(" "); +// for (String data in datas) { +// if (data.startsWith("recipient_address=")) { +// address = data +// .substring("recipient_address=".length) +// .replaceAll(";", ""); +// break; +// } +// } +// break; +// } +// } +// } +// widget.onSelected(address); +// if (mounted) { +// Navigator.of(context).pop(); +// } +// }, +// child: Text( +// "Enter", +// style: STextStyles.button(context), +// ), +// ), +// ), +// ) +// ], +// ), +// ), +// ), +// ), +// ); +// } +// } diff --git a/lib/pages/send_view/sub_widgets/transaction_fee_selection_sheet.dart b/lib/pages/send_view/sub_widgets/transaction_fee_selection_sheet.dart index f844f0e41..a0f59a315 100644 --- a/lib/pages/send_view/sub_widgets/transaction_fee_selection_sheet.dart +++ b/lib/pages/send_view/sub_widgets/transaction_fee_selection_sheet.dart @@ -1,17 +1,17 @@ import 'package:cw_core/monero_transaction_priority.dart'; -import 'package:decimal/decimal.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:stackduo/models/paymint/fee_object_model.dart'; import 'package:stackduo/providers/providers.dart'; import 'package:stackduo/providers/ui/fee_rate_type_state_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/enums/fee_rate_type_enum.dart'; import 'package:stackduo/utilities/logger.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/widgets/animated_text.dart'; final feeSheetSessionCacheProvider = @@ -33,11 +33,13 @@ class TransactionFeeSelectionSheet extends ConsumerStatefulWidget { required this.walletId, required this.amount, required this.updateChosen, + this.isToken = false, }) : super(key: key); final String walletId; final Amount amount; final Function updateChosen; + final bool isToken; @override ConsumerState createState() => @@ -67,49 +69,88 @@ class _TransactionFeeSelectionSheetState switch (feeRateType) { case FeeRateType.fast: if (ref.read(feeSheetSessionCacheProvider).fast[amount] == null) { + // if (widget.isToken == false) { final manager = ref.read(walletsChangeNotifierProvider).getManager(walletId); - if (coin == Coin.monero) { + if (coin == Coin.monero /*|| coin == Coin.wownero*/) { final fee = await manager.estimateFeeFor( amount, MoneroTransactionPriority.fast.raw!); ref.read(feeSheetSessionCacheProvider).fast[amount] = fee; + // } else if ((coin == Coin.firo || coin == Coin.firoTestNet) && + // ref.read(publicPrivateBalanceStateProvider.state).state != + // "Private") { + // ref.read(feeSheetSessionCacheProvider).fast[amount] = + // await (manager.wallet as FiroWallet) + // .estimateFeeForPublic(amount, feeRate); } else { ref.read(feeSheetSessionCacheProvider).fast[amount] = await manager.estimateFeeFor(amount, feeRate); } + // } else { + // final tokenWallet = ref.read(tokenServiceProvider)!; + // final fee = tokenWallet.estimateFeeFor(feeRate); + // ref.read(feeSheetSessionCacheProvider).fast[amount] = fee; + // } } return ref.read(feeSheetSessionCacheProvider).fast[amount]!; case FeeRateType.average: if (ref.read(feeSheetSessionCacheProvider).average[amount] == null) { + // if (widget.isToken == false) { final manager = ref.read(walletsChangeNotifierProvider).getManager(walletId); - if (coin == Coin.monero) { + if (coin == Coin.monero /* || coin == Coin.wownero*/) { final fee = await manager.estimateFeeFor( amount, MoneroTransactionPriority.regular.raw!); ref.read(feeSheetSessionCacheProvider).average[amount] = fee; + // } else if ((coin == Coin.firo || coin == Coin.firoTestNet) && + // ref.read(publicPrivateBalanceStateProvider.state).state != + // "Private") { + // ref.read(feeSheetSessionCacheProvider).average[amount] = + // await (manager.wallet as FiroWallet) + // .estimateFeeForPublic(amount, feeRate); } else { ref.read(feeSheetSessionCacheProvider).average[amount] = await manager.estimateFeeFor(amount, feeRate); } + // } else { + // final tokenWallet = ref.read(tokenServiceProvider)!; + // final fee = tokenWallet.estimateFeeFor(feeRate); + // ref.read(feeSheetSessionCacheProvider).average[amount] = fee; + // } } return ref.read(feeSheetSessionCacheProvider).average[amount]!; case FeeRateType.slow: if (ref.read(feeSheetSessionCacheProvider).slow[amount] == null) { + // if (widget.isToken == false) { final manager = ref.read(walletsChangeNotifierProvider).getManager(walletId); - if (coin == Coin.monero) { + if (coin == Coin.monero /*|| coin == Coin.wownero*/) { final fee = await manager.estimateFeeFor( amount, MoneroTransactionPriority.slow.raw!); ref.read(feeSheetSessionCacheProvider).slow[amount] = fee; + // } else if ((coin == Coin.firo || coin == Coin.firoTestNet) && + // ref.read(publicPrivateBalanceStateProvider.state).state != + // "Private") { + // ref.read(feeSheetSessionCacheProvider).slow[amount] = + // await (manager.wallet as FiroWallet) + // .estimateFeeForPublic(amount, feeRate); } else { ref.read(feeSheetSessionCacheProvider).slow[amount] = await manager.estimateFeeFor(amount, feeRate); } + // } else { + // final tokenWallet = ref.read(tokenServiceProvider)!; + // final fee = tokenWallet.estimateFeeFor(feeRate); + // ref.read(feeSheetSessionCacheProvider).slow[amount] = fee; + // } } return ref.read(feeSheetSessionCacheProvider).slow[amount]!; + + default: + return Amount.zero; } } @@ -188,7 +229,11 @@ class _TransactionFeeSelectionSheetState height: 36, ), FutureBuilder( - future: manager.fees, + future: + // widget.isToken + // ? ref.read(tokenServiceProvider)!.fees + // : + manager.fees, builder: (context, AsyncSnapshot snapshot) { if (snapshot.connectionState == ConnectionState.done && snapshot.hasData) { @@ -282,20 +327,21 @@ class _TransactionFeeSelectionSheetState feeRate: feeObject!.fast, amount: amount, ), - // future: manager.estimateFeeFor( - // Format.decimalAmountToSatoshis( - // amount), - // feeObject!.fast), builder: (_, AsyncSnapshot snapshot) { if (snapshot.connectionState == ConnectionState.done && snapshot.hasData) { return Text( - "(~${snapshot.data!.decimal.toStringAsFixed( - manager.coin.decimals, - )}" - " ${manager.coin.ticker})", + "(~${ref.watch( + pAmountFormatter( + manager.coin, + ), + ).format( + snapshot.data!, + indicatePrecisionLoss: + false, + )})", style: STextStyles.itemSubtitle( context), textAlign: TextAlign.left, @@ -315,13 +361,19 @@ class _TransactionFeeSelectionSheetState const SizedBox( height: 2, ), - if (feeObject == null) + if (feeObject == + null /* && + manager.coin != Coin.ethereum*/ + ) AnimatedText( stringsToLoopThrough: stringsToLoopThrough, style: STextStyles.itemSubtitle(context), ), - if (feeObject != null) + if (feeObject != + null /* && + manager.coin != Coin.ethereum*/ + ) Text( estimatedTimeToBeIncludedInNextBlock( Constants.targetBlockTimeInSeconds( @@ -416,18 +468,21 @@ class _TransactionFeeSelectionSheetState feeRate: feeObject!.medium, amount: amount, ), - // future: manager.estimateFeeFor( - // Format.decimalAmountToSatoshis( - // amount), - // feeObject!.fast), builder: (_, AsyncSnapshot snapshot) { if (snapshot.connectionState == ConnectionState.done && snapshot.hasData) { return Text( - "(~${snapshot.data!.decimal.toStringAsFixed(manager.coin.decimals)}" - " ${manager.coin.ticker})", + "(~${ref.watch( + pAmountFormatter( + manager.coin, + ), + ).format( + snapshot.data!, + indicatePrecisionLoss: + false, + )})", style: STextStyles.itemSubtitle( context), textAlign: TextAlign.left, @@ -506,8 +561,6 @@ class _TransactionFeeSelectionSheetState .watch(feeRateTypeStateProvider.state) .state, onChanged: (x) { - //todo: check if print needed - // debugPrint(x.toString()); ref .read(feeRateTypeStateProvider.state) .state = FeeRateType.slow; @@ -549,17 +602,21 @@ class _TransactionFeeSelectionSheetState feeRate: feeObject!.slow, amount: amount, ), - // future: manager.estimateFeeFor( - // Format.decimalAmountToSatoshis( - // amount), - // feeObject!.fast), builder: (_, AsyncSnapshot snapshot) { if (snapshot.connectionState == ConnectionState.done && snapshot.hasData) { return Text( - "(~${snapshot.data!.decimal.toStringAsFixed(manager.coin.decimals)} ${manager.coin.ticker})", + "(~${ref.watch( + pAmountFormatter( + manager.coin, + ), + ).format( + snapshot.data!, + indicatePrecisionLoss: + false, + )})", style: STextStyles.itemSubtitle( context), textAlign: TextAlign.left, @@ -605,6 +662,79 @@ class _TransactionFeeSelectionSheetState const SizedBox( height: 24, ), + if (manager.coin.isElectrumXCoin) + GestureDetector( + onTap: () { + final state = + ref.read(feeRateTypeStateProvider.state).state; + if (state != FeeRateType.custom) { + ref.read(feeRateTypeStateProvider.state).state = + FeeRateType.custom; + } + widget.updateChosen("custom"); + + Navigator.of(context).pop(); + }, + child: Container( + color: Colors.transparent, + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + children: [ + SizedBox( + width: 20, + height: 20, + child: Radio( + activeColor: Theme.of(context) + .extension()! + .radioButtonIconEnabled, + value: FeeRateType.custom, + groupValue: ref + .watch(feeRateTypeStateProvider.state) + .state, + onChanged: (x) { + ref + .read( + feeRateTypeStateProvider.state) + .state = FeeRateType.custom; + Navigator.of(context).pop(); + }, + ), + ), + ], + ), + const SizedBox( + width: 12, + ), + Flexible( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Text( + FeeRateType.custom.prettyName, + style: + STextStyles.titleBold12(context), + textAlign: TextAlign.left, + ), + ], + ), + const SizedBox( + height: 2, + ), + ], + ), + ), + ], + ), + ), + ), + if (manager.coin.isElectrumXCoin) + const SizedBox( + height: 24, + ), ], ); }, @@ -620,27 +750,35 @@ class _TransactionFeeSelectionSheetState switch (feeRateType) { case FeeRateType.fast: if (ref.read(feeSheetSessionCacheProvider).fast[amount] != null) { - return (ref.read(feeSheetSessionCacheProvider).fast[amount] - as Decimal) - .toStringAsFixed(coin.decimals); + return ref.read(pAmountFormatter(coin)).format( + ref.read(feeSheetSessionCacheProvider).fast[amount]!, + indicatePrecisionLoss: false, + withUnitName: false, + ); } return null; case FeeRateType.average: if (ref.read(feeSheetSessionCacheProvider).average[amount] != null) { - return (ref.read(feeSheetSessionCacheProvider).average[amount] - as Decimal) - .toStringAsFixed(coin.decimals); + return ref.read(pAmountFormatter(coin)).format( + ref.read(feeSheetSessionCacheProvider).average[amount]!, + indicatePrecisionLoss: false, + withUnitName: false, + ); } return null; case FeeRateType.slow: if (ref.read(feeSheetSessionCacheProvider).slow[amount] != null) { - return (ref.read(feeSheetSessionCacheProvider).slow[amount] - as Decimal) - .toStringAsFixed(coin.decimals); + return ref.read(pAmountFormatter(coin)).format( + ref.read(feeSheetSessionCacheProvider).slow[amount]!, + indicatePrecisionLoss: false, + withUnitName: false, + ); } return null; + case FeeRateType.custom: + return null; } } catch (e, s) { Logging.instance.log("$e $s", level: LogLevel.Warning); diff --git a/lib/pages/settings_views/global_settings_view/advanced_views/advanced_settings_view.dart b/lib/pages/settings_views/global_settings_view/advanced_views/advanced_settings_view.dart index 9c3284ae3..7bbc9f4e7 100644 --- a/lib/pages/settings_views/global_settings_view/advanced_views/advanced_settings_view.dart +++ b/lib/pages/settings_views/global_settings_view/advanced_views/advanced_settings_view.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:stackduo/pages/settings_views/global_settings_view/advanced_views/debug_view.dart'; +import 'package:stackduo/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/manage_coin_units_view.dart'; import 'package:stackduo/pages/settings_views/global_settings_view/advanced_views/manage_explorer_view.dart'; import 'package:stackduo/pages/stack_privacy_calls.dart'; import 'package:stackduo/providers/global/prefs_provider.dart'; @@ -227,6 +228,43 @@ class AdvancedSettingsView extends StatelessWidget { const SizedBox( height: 8, ), + RoundedWhiteContainer( + padding: const EdgeInsets.all(0), + child: RawMaterialButton( + // splashColor: Theme.of(context).extension()!.highlight, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + ), + onPressed: () { + Navigator.of(context).pushNamed(ChooseCoinView.routeName, + arguments: const Tuple3( + "Manage block explorers", + "block explorer", + ManageExplorerView.routeName)); + }, + child: Padding( + padding: const EdgeInsets.symmetric( + horizontal: 12, + vertical: 20, + ), + child: Row( + children: [ + Text( + "Change block explorer", + style: STextStyles.titleBold12(context), + textAlign: TextAlign.left, + ), + ], + ), + ), + ), + ), + const SizedBox( + height: 8, + ), RoundedWhiteContainer( padding: const EdgeInsets.all(0), child: RawMaterialButton( @@ -239,12 +277,7 @@ class AdvancedSettingsView extends StatelessWidget { ), onPressed: () { Navigator.of(context).pushNamed( - ChooseCoinView.routeName, - arguments: const Tuple3( - "Manage block explorers", - "block explorer", - ManageExplorerView.routeName, - ), + ManageCoinUnitsView.routeName, ); }, child: Padding( @@ -255,7 +288,7 @@ class AdvancedSettingsView extends StatelessWidget { child: Row( children: [ Text( - "Change block explorer", + "Units", style: STextStyles.titleBold12(context), textAlign: TextAlign.left, ), diff --git a/lib/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/choose_unit_sheet.dart b/lib/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/choose_unit_sheet.dart new file mode 100644 index 000000000..4aecfc4b8 --- /dev/null +++ b/lib/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/choose_unit_sheet.dart @@ -0,0 +1,144 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:stackduo/themes/stack_colors.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; +import 'package:stackduo/utilities/amount/amount_unit.dart'; +import 'package:stackduo/utilities/constants.dart'; +import 'package:stackduo/utilities/enums/coin_enum.dart'; +import 'package:stackduo/utilities/text_styles.dart'; + +class ChooseUnitSheet extends ConsumerStatefulWidget { + const ChooseUnitSheet({ + Key? key, + required this.coin, + }) : super(key: key); + + final Coin coin; + + @override + ConsumerState createState() => _ChooseUnitSheetState(); +} + +class _ChooseUnitSheetState extends ConsumerState { + late AmountUnit _current; + late final List values; + + @override + void initState() { + values = AmountUnit.valuesForCoin(widget.coin); + _current = ref.read(pAmountUnit(widget.coin)); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Container( + decoration: BoxDecoration( + color: Theme.of(context).extension()!.popupBG, + borderRadius: const BorderRadius.vertical( + top: Radius.circular(20), + ), + ), + child: Padding( + padding: const EdgeInsets.only( + left: 24, + right: 24, + top: 10, + bottom: 0, + ), + child: SingleChildScrollView( + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Center( + child: Container( + decoration: BoxDecoration( + color: Theme.of(context) + .extension()! + .textFieldDefaultBG, + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + ), + width: 60, + height: 4, + ), + ), + const SizedBox( + height: 36, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + "Coin units", + style: STextStyles.pageTitleH2(context), + textAlign: TextAlign.left, + ), + const SizedBox( + height: 16, + ), + for (int i = 0; i < values.length; i++) + Column( + children: [ + GestureDetector( + onTap: () { + setState(() { + _current = values[i]; + }); + + Navigator.of(context).pop(_current); + }, + child: Container( + color: Colors.transparent, + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + SizedBox( + width: 20, + height: 20, + child: Radio( + activeColor: Theme.of(context) + .extension()! + .radioButtonIconEnabled, + value: values[i], + groupValue: _current, + onChanged: (x) { + setState(() { + _current = values[i]; + }); + + Navigator.of(context).pop(_current); + }, + ), + ), + const SizedBox( + width: 12, + ), + Text( + values[i].unitForCoin(widget.coin), + style: STextStyles.titleBold12(context), + textAlign: TextAlign.left, + ), + ], + ), + ), + ), + const SizedBox( + height: 16, + ), + ], + ), + const SizedBox( + height: 8, + ), + ], + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/edit_coin_units_view.dart b/lib/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/edit_coin_units_view.dart new file mode 100644 index 000000000..e83e5aa4d --- /dev/null +++ b/lib/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/edit_coin_units_view.dart @@ -0,0 +1,343 @@ +import 'package:dropdown_button2/dropdown_button2.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:stackduo/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/choose_unit_sheet.dart'; +import 'package:stackduo/providers/global/prefs_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; +import 'package:stackduo/utilities/amount/amount_unit.dart'; +import 'package:stackduo/utilities/assets.dart'; +import 'package:stackduo/utilities/constants.dart'; +import 'package:stackduo/utilities/enums/coin_enum.dart'; +import 'package:stackduo/utilities/text_styles.dart'; +import 'package:stackduo/utilities/util.dart'; +import 'package:stackduo/widgets/background.dart'; +import 'package:stackduo/widgets/conditional_parent.dart'; +import 'package:stackduo/widgets/custom_buttons/app_bar_icon_button.dart'; +import 'package:stackduo/widgets/desktop/desktop_dialog.dart'; +import 'package:stackduo/widgets/desktop/desktop_dialog_close_button.dart'; +import 'package:stackduo/widgets/desktop/primary_button.dart'; +import 'package:stackduo/widgets/desktop/secondary_button.dart'; +import 'package:stackduo/widgets/icon_widgets/x_icon.dart'; +import 'package:stackduo/widgets/stack_text_field.dart'; +import 'package:stackduo/widgets/textfield_icon_button.dart'; + +class EditCoinUnitsView extends ConsumerStatefulWidget { + const EditCoinUnitsView({ + Key? key, + required this.coin, + }) : super(key: key); + + final Coin coin; + + static const String routeName = "/editCoinUnitsView"; + + @override + ConsumerState createState() => _EditCoinUnitsViewState(); +} + +class _EditCoinUnitsViewState extends ConsumerState { + late final TextEditingController _decimalsController; + late final FocusNode _decimalsFocusNode; + + late AmountUnit _currentUnit; + + void onSave() { + final maxDecimals = int.tryParse(_decimalsController.text); + + if (maxDecimals == null) { + // TODO show dialog error thing + return; + } + + ref.read(prefsChangeNotifierProvider).updateAmountUnit( + coin: widget.coin, + amountUnit: _currentUnit, + ); + ref.read(prefsChangeNotifierProvider).updateMaxDecimals( + coin: widget.coin, + maxDecimals: maxDecimals, + ); + + Navigator.of(context).pop(); + } + + Future chooseUnit() async { + final chosenUnit = await showModalBottomSheet( + backgroundColor: Colors.transparent, + context: context, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.vertical( + top: Radius.circular(20), + ), + ), + builder: (_) { + return ChooseUnitSheet( + coin: widget.coin, + ); + }, + ); + + if (chosenUnit != null) { + setState(() { + _currentUnit = chosenUnit; + }); + } + } + + @override + void initState() { + _decimalsFocusNode = FocusNode(); + _decimalsController = TextEditingController() + ..text = ref.read(pMaxDecimals(widget.coin)).toString(); + _currentUnit = ref.read(pAmountUnit(widget.coin)); + super.initState(); + } + + @override + void dispose() { + _decimalsFocusNode.dispose(); + _decimalsController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return ConditionalParent( + condition: Util.isDesktop, + builder: (child) => DesktopDialog( + maxHeight: 350, + maxWidth: 500, + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: const EdgeInsets.only(left: 32), + child: Text( + "Edit ${widget.coin.prettyName} units", + style: STextStyles.desktopH3(context), + ), + ), + const DesktopDialogCloseButton(), + ], + ), + Expanded( + child: Padding( + padding: const EdgeInsets.only( + left: 32, + right: 32, + bottom: 32, + ), + child: child, + ), + ), + ], + ), + ), + child: ConditionalParent( + condition: !Util.isDesktop, + builder: (child) => Background( + child: Scaffold( + backgroundColor: + Theme.of(context).extension()!.background, + appBar: AppBar( + leading: AppBarBackButton( + onPressed: () { + Navigator.of(context).pop(); + }, + ), + title: Text( + "Edit ${widget.coin.prettyName} units", + style: STextStyles.navBarTitle(context), + ), + ), + body: Padding( + padding: const EdgeInsets.all(16), + child: child, + ), + ), + ), + child: Column( + children: [ + if (Util.isDesktop) + DropdownButtonHideUnderline( + child: DropdownButton2( + value: _currentUnit, + items: [ + ...AmountUnit.valuesForCoin(widget.coin).map( + (e) => DropdownMenuItem( + value: e, + child: Text( + e.unitForCoin(widget.coin), + style: STextStyles.desktopTextMedium(context), + ), + ), + ), + ], + onChanged: (value) { + if (value is AmountUnit) { + _currentUnit = value; + } + }, + isExpanded: true, + iconStyleData: IconStyleData( + icon: SvgPicture.asset( + Assets.svg.chevronDown, + width: 12, + height: 6, + color: Theme.of(context) + .extension()! + .textFieldActiveSearchIconRight, + ), + ), + dropdownStyleData: DropdownStyleData( + offset: const Offset(0, -10), + elevation: 0, + decoration: BoxDecoration( + color: Theme.of(context) + .extension()! + .textFieldDefaultBG, + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + ), + ), + menuItemStyleData: const MenuItemStyleData( + padding: EdgeInsets.symmetric( + horizontal: 16, + vertical: 8, + ), + ), + ), + ), + if (!Util.isDesktop) + Stack( + children: [ + TextField( + autocorrect: Util.isDesktop ? false : true, + enableSuggestions: Util.isDesktop ? false : true, + // controller: _lengthController, + readOnly: true, + textInputAction: TextInputAction.none, + ), + Positioned.fill( + child: RawMaterialButton( + splashColor: + Theme.of(context).extension()!.highlight, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + ), + onPressed: chooseUnit, + child: Padding( + padding: const EdgeInsets.only( + left: 12, + right: 17, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + _currentUnit.unitForCoin(widget.coin), + style: STextStyles.itemSubtitle12(context), + ), + SvgPicture.asset( + Assets.svg.chevronDown, + width: 14, + height: 6, + color: Theme.of(context) + .extension()! + .textFieldActiveSearchIconRight, + ), + ], + ), + ), + ), + ) + ], + ), + SizedBox( + height: Util.isDesktop ? 24 : 8, + ), + ClipRRect( + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + child: TextField( + autocorrect: Util.isDesktop ? false : true, + enableSuggestions: Util.isDesktop ? false : true, + key: const Key("addCustomNodeNodeNameFieldKey"), + controller: _decimalsController, + focusNode: _decimalsFocusNode, + keyboardType: const TextInputType.numberWithOptions( + signed: false, + decimal: false, + ), + style: STextStyles.field(context), + decoration: standardInputDecoration( + "Maximum precision", + _decimalsFocusNode, + context, + ).copyWith( + labelStyle: + Util.isDesktop ? STextStyles.fieldLabel(context) : null, + suffixIcon: _decimalsController.text.isNotEmpty + ? Padding( + padding: const EdgeInsets.only(right: 0), + child: UnconstrainedBox( + child: Row( + children: [ + TextFieldIconButton( + child: const XIcon(), + onTap: () async { + _decimalsController.text = ""; + setState(() {}); + }, + ), + ], + ), + ), + ) + : null, + ), + ), + ), + const SizedBox( + height: 24, + ), + const Spacer(), + ConditionalParent( + condition: Util.isDesktop, + builder: (child) => Row( + children: [ + Expanded( + child: SecondaryButton( + label: "Cancel", + buttonHeight: ButtonHeight.l, + onPressed: Navigator.of(context).pop, + ), + ), + const SizedBox( + width: 16, + ), + Expanded( + child: child, + ), + ], + ), + child: PrimaryButton( + label: "Save", + buttonHeight: Util.isDesktop ? ButtonHeight.l : ButtonHeight.xl, + onPressed: onSave, + ), + ), + ], + ), + ), + ); + } +} diff --git a/lib/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/manage_coin_units_view.dart b/lib/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/manage_coin_units_view.dart new file mode 100644 index 000000000..3ffee2af1 --- /dev/null +++ b/lib/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/manage_coin_units_view.dart @@ -0,0 +1,177 @@ +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_svg/svg.dart'; +import 'package:stackduo/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/edit_coin_units_view.dart'; +import 'package:stackduo/providers/global/prefs_provider.dart'; +import 'package:stackduo/themes/coin_icon_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; +import 'package:stackduo/utilities/assets.dart'; +import 'package:stackduo/utilities/enums/coin_enum.dart'; +import 'package:stackduo/utilities/text_styles.dart'; +import 'package:stackduo/utilities/util.dart'; +import 'package:stackduo/widgets/background.dart'; +import 'package:stackduo/widgets/conditional_parent.dart'; +import 'package:stackduo/widgets/custom_buttons/app_bar_icon_button.dart'; +import 'package:stackduo/widgets/desktop/desktop_dialog.dart'; +import 'package:stackduo/widgets/desktop/desktop_dialog_close_button.dart'; +import 'package:stackduo/widgets/rounded_white_container.dart'; + +class ManageCoinUnitsView extends ConsumerWidget { + const ManageCoinUnitsView({Key? key}) : super(key: key); + + static const String routeName = "/manageCoinUnitsView"; + + void onEditPressed(Coin coin, BuildContext context) { + if (Util.isDesktop) { + showDialog( + context: context, + builder: (context) => EditCoinUnitsView(coin: coin), + ); + } else { + Navigator.of(context).pushNamed( + EditCoinUnitsView.routeName, + arguments: coin, + ); + } + } + + @override + Widget build(BuildContext context, WidgetRef ref) { + bool showTestNet = ref.watch( + prefsChangeNotifierProvider.select((value) => value.showTestNetCoins), + ); + + final _coins = + Coin.values /*.where((e) => e != Coin.firoTestNet)*/ .toList(); + + List coins = showTestNet + ? _coins + : _coins.sublist(0, _coins.length - kTestNetCoinCount); + + return ConditionalParent( + condition: Util.isDesktop, + builder: (child) => DesktopDialog( + maxHeight: 850, + maxWidth: 600, + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: const EdgeInsets.only(left: 32), + child: Text( + "Units", + style: STextStyles.desktopH3(context), + ), + ), + const DesktopDialogCloseButton(), + ], + ), + Expanded( + child: Padding( + padding: const EdgeInsets.only( + left: 32, + right: 32, + bottom: 32, + ), + child: child, + ), + ), + ], + ), + ), + child: ConditionalParent( + condition: !Util.isDesktop, + builder: (child) => Background( + child: Scaffold( + backgroundColor: + Theme.of(context).extension()!.background, + appBar: AppBar( + leading: AppBarBackButton( + onPressed: () { + Navigator.of(context).pop(); + }, + ), + title: Text( + "Units", + style: STextStyles.navBarTitle(context), + ), + ), + body: child, + ), + ), + child: ListView.separated( + itemCount: Util.isDesktop ? coins.length : coins.length + 2, + separatorBuilder: (_, __) => const SizedBox( + height: 12, + ), + itemBuilder: (_, index) { + if (!Util.isDesktop) { + if (index == 0) { + return const SizedBox(height: 0); + } else if (index > coins.length) { + return const SizedBox(height: 10); + } + } + + final coin = coins[Util.isDesktop ? index : index - 1]; + return Padding( + padding: Util.isDesktop + ? EdgeInsets.zero + : const EdgeInsets.symmetric( + horizontal: 16, + ), + child: RoundedWhiteContainer( + padding: Util.isDesktop + ? const EdgeInsets.symmetric( + vertical: 16, + horizontal: 14, + ) + : const EdgeInsets.all(12), + borderColor: Util.isDesktop + ? Theme.of(context).extension()!.textSubtitle6 + : null, + onPressed: () { + onEditPressed(coin, context); + }, + child: Row( + children: [ + SvgPicture.file( + File( + ref.watch( + coinIconProvider(coin), + ), + ), + width: 24, + height: 24, + ), + const SizedBox( + width: 12, + ), + Expanded( + child: Text( + "Edit ${coin.prettyName} units", + style: STextStyles.titleBold12(context), + ), + ), + const SizedBox( + width: 12, + ), + SvgPicture.asset( + Assets.svg.chevronRight, + width: Util.isDesktop ? 20 : 14, + height: Util.isDesktop ? 20 : 14, + ), + ], + ), + ), + ); + }, + ), + ), + ); + } +} diff --git a/lib/pages/settings_views/global_settings_view/stack_backup_views/edit_auto_backup_view.dart b/lib/pages/settings_views/global_settings_view/stack_backup_views/edit_auto_backup_view.dart index ee4da4467..f55356792 100644 --- a/lib/pages/settings_views/global_settings_view/stack_backup_views/edit_auto_backup_view.dart +++ b/lib/pages/settings_views/global_settings_view/stack_backup_views/edit_auto_backup_view.dart @@ -616,9 +616,7 @@ class _EditAutoBackupViewState extends ConsumerState { if (isDesktop) DropdownButtonHideUnderline( child: DropdownButton2( - offset: const Offset(0, -10), isExpanded: true, - dropdownElevation: 0, value: _currentDropDownValue, items: [ ..._dropDownItems.map( @@ -662,30 +660,31 @@ class _EditAutoBackupViewState extends ConsumerState { }); } }, - icon: SvgPicture.asset( - Assets.svg.chevronDown, - width: 10, - height: 5, - color: Theme.of(context).extension()!.textDark3, - ), - buttonPadding: const EdgeInsets.symmetric( - horizontal: 16, - vertical: 8, + iconStyleData: IconStyleData( + icon: SvgPicture.asset( + Assets.svg.chevronDown, + width: 10, + height: 5, + color: + Theme.of(context).extension()!.textDark3, + ), ), - buttonDecoration: BoxDecoration( - color: Theme.of(context) - .extension()! - .textFieldDefaultBG, - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, + dropdownStyleData: DropdownStyleData( + offset: const Offset(0, -10), + elevation: 0, + decoration: BoxDecoration( + color: Theme.of(context) + .extension()! + .textFieldDefaultBG, + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), ), ), - dropdownDecoration: BoxDecoration( - color: Theme.of(context) - .extension()! - .textFieldDefaultBG, - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, + menuItemStyleData: const MenuItemStyleData( + padding: EdgeInsets.symmetric( + horizontal: 16, + vertical: 8, ), ), ), diff --git a/lib/pages/settings_views/global_settings_view/stack_backup_views/helpers/restore_create_backup.dart b/lib/pages/settings_views/global_settings_view/stack_backup_views/helpers/restore_create_backup.dart index a2b115159..b1b57748c 100644 --- a/lib/pages/settings_views/global_settings_view/stack_backup_views/helpers/restore_create_backup.dart +++ b/lib/pages/settings_views/global_settings_view/stack_backup_views/helpers/restore_create_backup.dart @@ -4,7 +4,7 @@ import 'dart:io'; import 'dart:typed_data'; import 'package:stack_wallet_backup/stack_wallet_backup.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/models/exchange/change_now/exchange_transaction.dart'; import 'package:stackduo/models/exchange/response_objects/trade.dart'; import 'package:stackduo/models/isar/models/contact_entry.dart'; diff --git a/lib/pages/settings_views/global_settings_view/syncing_preferences_views/wallet_syncing_options_view.dart b/lib/pages/settings_views/global_settings_view/syncing_preferences_views/wallet_syncing_options_view.dart index b070384ea..59fe27a04 100644 --- a/lib/pages/settings_views/global_settings_view/syncing_preferences_views/wallet_syncing_options_view.dart +++ b/lib/pages/settings_views/global_settings_view/syncing_preferences_views/wallet_syncing_options_view.dart @@ -6,8 +6,8 @@ import 'package:flutter_svg/svg.dart'; import 'package:stackduo/providers/providers.dart'; import 'package:stackduo/themes/coin_icon_provider.dart'; import 'package:stackduo/themes/stack_colors.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/constants.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/enums/sync_type_enum.dart'; import 'package:stackduo/utilities/text_styles.dart'; import 'package:stackduo/utilities/util.dart'; @@ -147,14 +147,10 @@ class WalletSyncingOptionsView extends ConsumerWidget { height: 2, ), Text( - "${manager.balance.total.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider - .select( - (value) => value.locale, - ), - ), - )} ${manager.coin.ticker}", + ref + .watch(pAmountFormatter( + manager.coin)) + .format(manager.balance.total), style: STextStyles.itemSubtitle(context), ) @@ -191,9 +187,9 @@ class WalletSyncingOptionsView extends ConsumerWidget { } break; case SyncingType - .selectedWalletsAtStartup: + .selectedWalletsAtStartup: case SyncingType - .allWalletsOnStartup: + .allWalletsOnStartup: manager.shouldAutoSync = value; break; } diff --git a/lib/pages/settings_views/global_settings_view/xpub_view.dart b/lib/pages/settings_views/global_settings_view/xpub_view.dart index d5b77d2b4..b98d9915d 100644 --- a/lib/pages/settings_views/global_settings_view/xpub_view.dart +++ b/lib/pages/settings_views/global_settings_view/xpub_view.dart @@ -243,7 +243,7 @@ class _XPub extends StatelessWidget { builder: (child) => RoundedWhiteContainer( child: child, ), - child: QrImage( + child: QrImageView( data: xpub, size: isDesktop ? 280 : MediaQuery.of(context).size.width / 1.5, foregroundColor: diff --git a/lib/pages/settings_views/wallet_settings_view/wallet_backup_views/wallet_backup_view.dart b/lib/pages/settings_views/wallet_settings_view/wallet_backup_views/wallet_backup_view.dart index 23ebc9c2c..4d8cb6cfd 100644 --- a/lib/pages/settings_views/wallet_settings_view/wallet_backup_views/wallet_backup_view.dart +++ b/lib/pages/settings_views/wallet_settings_view/wallet_backup_views/wallet_backup_view.dart @@ -6,10 +6,10 @@ import 'package:flutter_windowmanager/flutter_windowmanager.dart'; import 'package:qr_flutter/qr_flutter.dart'; import 'package:stackduo/pages/add_wallet_views/new_wallet_recovery_phrase_view/sub_widgets/mnemonic_table.dart'; import 'package:stackduo/providers/global/wallets_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/address_utils.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/widgets/background.dart'; import 'package:stackduo/widgets/custom_buttons/app_bar_icon_button.dart'; import 'package:stackduo/widgets/stack_dialog.dart'; @@ -162,7 +162,7 @@ class _WalletBackupViewState extends ConsumerState { child: SizedBox( width: width + 20, height: width + 20, - child: QrImage( + child: QrImageView( data: data, size: width, backgroundColor: Theme.of(context) diff --git a/lib/pages/stack_privacy_calls.dart b/lib/pages/stack_privacy_calls.dart index 2a95a89c4..cd511e3fd 100644 --- a/lib/pages/stack_privacy_calls.dart +++ b/lib/pages/stack_privacy_calls.dart @@ -4,7 +4,7 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/pages/pinpad_views/create_pin_view.dart'; import 'package:stackduo/pages_desktop_specific/password/create_password_view.dart'; import 'package:stackduo/providers/global/prefs_provider.dart'; diff --git a/lib/pages/wallet_view/sub_widgets/wallet_balance_toggle_sheet.dart b/lib/pages/wallet_view/sub_widgets/wallet_balance_toggle_sheet.dart index 28b5dfd52..7954516b4 100644 --- a/lib/pages/wallet_view/sub_widgets/wallet_balance_toggle_sheet.dart +++ b/lib/pages/wallet_view/sub_widgets/wallet_balance_toggle_sheet.dart @@ -2,12 +2,13 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:stackduo/providers/providers.dart'; import 'package:stackduo/providers/wallet/wallet_balance_toggle_state_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/enums/wallet_balance_toggle_state.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; enum _BalanceType { available, @@ -199,13 +200,7 @@ class BalanceSelector extends ConsumerWidget { height: 2, ), Text( - "${balance.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), - ), - )} ${coin.ticker}", + ref.watch(pAmountFormatter(coin)).format(balance), style: STextStyles.itemSubtitle12(context).copyWith( color: Theme.of(context) .extension()! diff --git a/lib/pages/wallet_view/sub_widgets/wallet_refresh_button.dart b/lib/pages/wallet_view/sub_widgets/wallet_refresh_button.dart index 8c3db8085..3a2dc0735 100644 --- a/lib/pages/wallet_view/sub_widgets/wallet_refresh_button.dart +++ b/lib/pages/wallet_view/sub_widgets/wallet_refresh_button.dart @@ -52,13 +52,19 @@ class _RefreshButtonState extends ConsumerState { if (event.walletId == widget.walletId) { switch (event.newStatus) { case WalletSyncStatus.unableToSync: - _spinController.stop?.call(); + if (_spinController.hasLoadedAnimation) { + _spinController.stop?.call(); + } break; case WalletSyncStatus.synced: - _spinController.stop?.call(); + if (_spinController.hasLoadedAnimation) { + _spinController.stop?.call(); + } break; case WalletSyncStatus.syncing: - _spinController.repeat?.call(); + if (_spinController.hasLoadedAnimation) { + _spinController.repeat?.call(); + } break; } } @@ -84,6 +90,7 @@ class _RefreshButtonState extends ConsumerState { width: isDesktop ? 22 : 36, child: Semantics( label: "Refresh Button. Refreshes The Values In Summary.", + excludeSemantics: true, child: MaterialButton( color: isDesktop ? Theme.of(context) diff --git a/lib/pages/wallet_view/sub_widgets/wallet_summary.dart b/lib/pages/wallet_view/sub_widgets/wallet_summary.dart index 9d2486146..27979d7ce 100644 --- a/lib/pages/wallet_view/sub_widgets/wallet_summary.dart +++ b/lib/pages/wallet_view/sub_widgets/wallet_summary.dart @@ -1,18 +1,12 @@ import 'package:flutter/material.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:flutter_svg/flutter_svg.dart'; import 'package:stackduo/pages/wallet_view/sub_widgets/wallet_summary_info.dart'; -import 'package:stackduo/services/coins/manager.dart'; import 'package:stackduo/services/event_bus/events/global/wallet_sync_status_changed_event.dart'; -import 'package:stackduo/utilities/assets.dart'; -import 'package:stackduo/utilities/constants.dart'; -import 'package:stackduo/themes/stack_colors.dart'; +import 'package:stackduo/widgets/coin_card.dart'; class WalletSummary extends StatelessWidget { const WalletSummary({ Key? key, required this.walletId, - required this.managerProvider, required this.initialSyncStatus, this.aspectRatio = 2.0, this.minHeight = 100.0, @@ -22,7 +16,6 @@ class WalletSummary extends StatelessWidget { }) : super(key: key); final String walletId; - final ChangeNotifierProvider managerProvider; final WalletSyncStatus initialSyncStatus; final double aspectRatio; @@ -42,83 +35,25 @@ class WalletSummary extends StatelessWidget { maxHeight: maxHeight, maxWidth: minWidth, ), - child: Stack( - children: [ - Consumer( - builder: (_, ref, __) { - return Container( - decoration: BoxDecoration( - color: Theme.of(context) - .extension()! - .colorForCoin(ref.watch( - managerProvider.select((value) => value.coin))), - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, - ), - ), - ); - }, - ), - Positioned.fill( - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const Spacer( - flex: 5, - ), - Expanded( - flex: 6, - child: SvgPicture.asset( - Assets.svg.ellipse1, - // fit: BoxFit.fitWidth, - // clipBehavior: Clip.none, - ), - ), - const SizedBox( - width: 25, - ), - ], + child: LayoutBuilder( + builder: (_, constraints) => Stack( + children: [ + CoinCard( + walletId: walletId, + width: constraints.maxWidth, + height: constraints.maxHeight, ), - ), - // Positioned.fill( - // child: - // Column( - // mainAxisAlignment: MainAxisAlignment.end, - // children: [ - Align( - alignment: Alignment.bottomCenter, - child: Row( - children: [ - const Spacer( - flex: 1, + Positioned.fill( + child: Padding( + padding: const EdgeInsets.all(16.0), + child: WalletSummaryInfo( + walletId: walletId, + initialSyncStatus: initialSyncStatus, ), - Expanded( - flex: 3, - child: SvgPicture.asset( - Assets.svg.ellipse2, - // fit: BoxFit.f, - // clipBehavior: Clip.none, - ), - ), - const SizedBox( - width: 13, - ), - ], - ), - ), - // ], - // ), - // ), - Positioned.fill( - child: Padding( - padding: const EdgeInsets.all(16.0), - child: WalletSummaryInfo( - walletId: walletId, - initialSyncStatus: initialSyncStatus, ), ), - ), - ], + ], + ), ), ), ); diff --git a/lib/pages/wallet_view/sub_widgets/wallet_summary_info.dart b/lib/pages/wallet_view/sub_widgets/wallet_summary_info.dart index 705792b63..c6d10e300 100644 --- a/lib/pages/wallet_view/sub_widgets/wallet_summary_info.dart +++ b/lib/pages/wallet_view/sub_widgets/wallet_summary_info.dart @@ -14,8 +14,8 @@ import 'package:stackduo/services/event_bus/global_event_bus.dart'; import 'package:stackduo/themes/coin_icon_provider.dart'; import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/assets.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/enums/wallet_balance_toggle_state.dart'; import 'package:stackduo/utilities/text_styles.dart'; @@ -131,9 +131,7 @@ class _WalletSummaryInfoState extends ConsumerState { FittedBox( fit: BoxFit.scaleDown, child: SelectableText( - "${balanceToShow.localizedStringAsFixed( - locale: locale, - )} ${coin.ticker}", + ref.watch(pAmountFormatter(coin)).format(balanceToShow), style: STextStyles.pageTitleH1(context).copyWith( fontSize: 24, color: Theme.of(context) @@ -146,7 +144,7 @@ class _WalletSummaryInfoState extends ConsumerState { Text( "${(priceTuple.item1 * balanceToShow.decimal).toAmount( fractionDigits: 2, - ).localizedStringAsFixed( + ).fiatString( locale: locale, )} $baseCurrency", style: STextStyles.subtitle500(context).copyWith( diff --git a/lib/pages/wallet_view/transaction_views/all_transactions_view.dart b/lib/pages/wallet_view/transaction_views/all_transactions_view.dart index 7d486c40c..934d36ae6 100644 --- a/lib/pages/wallet_view/transaction_views/all_transactions_view.dart +++ b/lib/pages/wallet_view/transaction_views/all_transactions_view.dart @@ -14,6 +14,7 @@ import 'package:stackduo/providers/providers.dart'; import 'package:stackduo/providers/ui/transaction_filter_provider.dart'; import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; @@ -941,9 +942,7 @@ class _DesktopTransactionCardRowState builder: (_) { final amount = _transaction.realAmount; return Text( - "$prefix${amount.localizedStringAsFixed( - locale: locale, - )} ${coin.ticker}", + "$prefix${ref.watch(pAmountFormatter(coin)).format(amount)}", style: STextStyles.desktopTextExtraExtraSmall(context) .copyWith( color: Theme.of(context) @@ -965,7 +964,7 @@ class _DesktopTransactionCardRowState return Text( "$prefix${(amount.decimal * price).toAmount( fractionDigits: 2, - ).localizedStringAsFixed( + ).fiatString( locale: locale, )} $baseCurrency", style: STextStyles.desktopTextExtraExtraSmall(context), diff --git a/lib/pages/wallet_view/transaction_views/transaction_details_view.dart b/lib/pages/wallet_view/transaction_views/transaction_details_view.dart index 326e0c4f2..04380421e 100644 --- a/lib/pages/wallet_view/transaction_views/transaction_details_view.dart +++ b/lib/pages/wallet_view/transaction_views/transaction_details_view.dart @@ -1,16 +1,20 @@ import 'dart:async'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:stackduo/models/isar/models/blockchain_data/transaction.dart'; import 'package:stackduo/notifications/show_flush_bar.dart'; +import 'package:stackduo/pages/receive_view/addresses/address_details_view.dart'; import 'package:stackduo/pages/wallet_view/sub_widgets/tx_icon.dart'; import 'package:stackduo/pages/wallet_view/transaction_views/edit_note_view.dart'; import 'package:stackduo/providers/global/address_book_service_provider.dart'; import 'package:stackduo/providers/providers.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/block_explorers.dart'; import 'package:stackduo/utilities/constants.dart'; @@ -18,7 +22,6 @@ import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/format.dart'; import 'package:stackduo/utilities/logger.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/util.dart'; import 'package:stackduo/widgets/background.dart'; import 'package:stackduo/widgets/conditional_parent.dart'; @@ -66,6 +69,7 @@ class _TransactionDetailsViewState late final String amountPrefix; late final String unit; late final bool isTokenTx; + late final dynamic? ethContract; bool showFeePending = false; @@ -73,17 +77,33 @@ class _TransactionDetailsViewState void initState() { isDesktop = Util.isDesktop; _transaction = widget.transaction; - isTokenTx = false; + isTokenTx = _transaction.subType == TransactionSubType.ethToken; walletId = widget.walletId; coin = widget.coin; amount = _transaction.realAmount; fee = _transaction.fee.toAmountAsRaw(fractionDigits: coin.decimals); + // if ((coin == Coin.firo || coin == Coin.firoTestNet) && + // _transaction.subType == TransactionSubType.mint) { + // amountPrefix = ""; + // } else { amountPrefix = _transaction.type == TransactionType.outgoing ? "-" : "+"; + // } + + ethContract = + // isTokenTx + // ? ref.read(mainDBProvider).getEthContractSync(_transaction.otherData!) + // : + null; - unit = coin.ticker; + unit = /*isTokenTx ? ethContract!.symbol :*/ coin.ticker; + // if (coin == Coin.firo || coin == Coin.firoTestNet) { + // showFeePending = true; + // } else { + // showFeePending = false; + // } super.initState(); } @@ -92,18 +112,59 @@ class _TransactionDetailsViewState super.dispose(); } - String whatIsIt(TransactionType type, int height) { + String whatIsIt(Transaction tx, int height) { + final type = tx.type; + // if (coin == Coin.firo || coin == Coin.firoTestNet) { + // if (tx.subType == TransactionSubType.mint) { + // if (tx.isConfirmed(height, coin.requiredConfirmations)) { + // return "Minted"; + // } else { + // return "Minting"; + // } + // } + // } + + // if (coin == Coin.epicCash) { + // if (_transaction.isCancelled) { + // return "Cancelled"; + // } else if (type == TransactionType.incoming) { + // if (tx.isConfirmed(height, coin.requiredConfirmations)) { + // return "Received"; + // } else { + // if (_transaction.numberOfMessages == 1) { + // return "Receiving (waiting for sender)"; + // } else if ((_transaction.numberOfMessages ?? 0) > 1) { + // return "Receiving (waiting for confirmations)"; // TODO test if the sender still has to open again after the receiver has 2 messages present, ie. sender->receiver->sender->node (yes) vs. sender->receiver->node (no) + // } else { + // return "Receiving"; + // } + // } + // } else if (type == TransactionType.outgoing) { + // if (tx.isConfirmed(height, coin.requiredConfirmations)) { + // return "Sent (confirmed)"; + // } else { + // if (_transaction.numberOfMessages == 1) { + // return "Sending (waiting for receiver)"; + // } else if ((_transaction.numberOfMessages ?? 0) > 1) { + // return "Sending (waiting for confirmations)"; + // } else { + // return "Sending"; + // } + // } + // } + // } + if (type == TransactionType.incoming) { // if (_transaction.isMinting) { // return "Minting"; // } else - if (_transaction.isConfirmed(height, coin.requiredConfirmations)) { + if (tx.isConfirmed(height, coin.requiredConfirmations)) { return "Received"; } else { return "Receiving"; } } else if (type == TransactionType.outgoing) { - if (_transaction.isConfirmed(height, coin.requiredConfirmations)) { + if (tx.isConfirmed(height, coin.requiredConfirmations)) { return "Sent"; } else { return "Sending"; @@ -398,7 +459,7 @@ class _TransactionDetailsViewState _transaction.isCancelled ? "Cancelled" : whatIsIt( - _transaction.type, + _transaction, currentHeight, ), style: @@ -413,13 +474,7 @@ class _TransactionDetailsViewState : CrossAxisAlignment.start, children: [ SelectableText( - "$amountPrefix${amount.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider - .select((value) => - value.locale), - ), - )} $unit", + "$amountPrefix${ref.watch(pAmountFormatter(coin)).format(amount, ethContract: ethContract)}", style: isDesktop ? STextStyles .desktopTextExtraExtraSmall( @@ -444,11 +499,18 @@ class _TransactionDetailsViewState "$amountPrefix${(amount.decimal * ref.watch( priceAnd24hChangeNotifierProvider .select((value) => + // isTokenTx + // ? value + // .getTokenPrice( + // _transaction + // .otherData!) + // .item1 + // : value .getPrice( coin) .item1), - )).toAmount(fractionDigits: 2).localizedStringAsFixed( + )).toAmount(fractionDigits: 2).fiatString( locale: ref.watch( localeServiceChangeNotifierProvider .select( @@ -510,7 +572,7 @@ class _TransactionDetailsViewState _transaction.isCancelled ? "Cancelled" : whatIsIt( - _transaction.type, + _transaction, currentHeight, ), style: isDesktop @@ -534,21 +596,37 @@ class _TransactionDetailsViewState ], ), ), - if (!((coin == Coin.monero) && + if (!((coin == + Coin + .monero /* || + coin == Coin.wownero*/ + ) && _transaction.type == - TransactionType.outgoing) && - !(_transaction.subType == - TransactionSubType.mint)) + TransactionType.outgoing) + // && + // !((coin == Coin.firo || + // coin == Coin.firoTestNet) && + // _transaction.subType == + // TransactionSubType.mint) + ) isDesktop ? const _Divider() : const SizedBox( height: 12, ), - if (!((coin == Coin.monero) && + if (!((coin == + Coin + .monero /*|| + coin == Coin.wownero*/ + ) && _transaction.type == - TransactionType.outgoing) && - !(_transaction.subType == - TransactionSubType.mint)) + TransactionType.outgoing) + // && + // !((coin == Coin.firo || + // coin == Coin.firoTestNet) && + // _transaction.subType == + // TransactionSubType.mint) + ) RoundedWhiteContainer( padding: isDesktop ? const EdgeInsets.all(16) @@ -563,17 +641,66 @@ class _TransactionDetailsViewState crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - _transaction.type == - TransactionType.outgoing - ? "Sent to" - : "Receiving address", - style: isDesktop - ? STextStyles - .desktopTextExtraExtraSmall( - context) - : STextStyles.itemSubtitle( - context), + ConditionalParent( + condition: kDebugMode, + builder: (child) { + return Row( + mainAxisAlignment: + MainAxisAlignment + .spaceBetween, + children: [ + child, + CustomTextButton( + text: "Info", + onTap: () { + if (isDesktop) { + showDialog( + context: context, + builder: (_) => + DesktopDialog( + maxHeight: + double.infinity, + child: + AddressDetailsView( + addressId: + _transaction + .address + .value! + .id, + walletId: widget + .walletId, + ), + ), + ); + } else { + Navigator.of(context) + .pushNamed( + AddressDetailsView + .routeName, + arguments: Tuple2( + _transaction.address + .value!.id, + widget.walletId, + ), + ); + } + }, + ) + ], + ); + }, + child: Text( + _transaction.type == + TransactionType.outgoing + ? "Sent to" + : "Receiving address", + style: isDesktop + ? STextStyles + .desktopTextExtraExtraSmall( + context) + : STextStyles.itemSubtitle( + context), + ), ), const SizedBox( height: 8, @@ -833,11 +960,13 @@ class _TransactionDetailsViewState ], ), ), + // if (coin != Coin.banano && coin != Coin.nano) isDesktop ? const _Divider() : const SizedBox( height: 12, ), + // if (coin != Coin.banano && coin != Coin.nano) RoundedWhiteContainer( padding: isDesktop ? const EdgeInsets.all(16) @@ -848,23 +977,17 @@ class _TransactionDetailsViewState currentHeight, coin.requiredConfirmations, ) - ? fee.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider - .select( - (value) => value.locale), - ), - ) + ? ref + .watch(pAmountFormatter(coin)) + .format( + fee, + withUnitName: isTokenTx, + ) : "Pending" - : fee.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider - .select((value) => value.locale), - ), - ); - if (isTokenTx) { - feeString += " ${coin.ticker}"; - } + : ref.watch(pAmountFormatter(coin)).format( + fee, + withUnitName: isTokenTx, + ); return Row( mainAxisAlignment: @@ -937,16 +1060,28 @@ class _TransactionDetailsViewState ? const EdgeInsets.all(16) : const EdgeInsets.all(12), child: Builder(builder: (context) { - final height = _transaction.isConfirmed( - currentHeight, - coin.requiredConfirmations, - ) - ? "${_transaction.height == 0 ? "Unknown" : _transaction.height}" - : _transaction.getConfirmations( + final String height; + + // if (widget.coin == Coin.bitcoincash || + // widget.coin == Coin.eCash || + // widget.coin == Coin.bitcoincashTestnet) { + // height = + // "${_transaction.height != null && _transaction.height! > 0 ? _transaction.height! : "Pending"}"; + // } else { + height = + // widget.coin != Coin.epicCash && + // _transaction.isConfirmed( + // currentHeight, + // coin.requiredConfirmations, + // ) + // ? "${_transaction.height == 0 ? "Unknown" : _transaction.height}" + // : + _transaction.getConfirmations( currentHeight) > 0 ? "${_transaction.height}" : "Pending"; + // } return Row( mainAxisAlignment: @@ -1008,6 +1143,86 @@ class _TransactionDetailsViewState ); }), ), + // if (coin == Coin.ethereum) + // isDesktop + // ? const _Divider() + // : const SizedBox( + // height: 12, + // ), + // if (coin == Coin.ethereum) + // RoundedWhiteContainer( + // padding: isDesktop + // ? const EdgeInsets.all(16) + // : const EdgeInsets.all(12), + // child: Row( + // crossAxisAlignment: CrossAxisAlignment.start, + // mainAxisAlignment: + // MainAxisAlignment.spaceBetween, + // children: [ + // Text( + // "Nonce", + // style: isDesktop + // ? STextStyles + // .desktopTextExtraExtraSmall( + // context) + // : STextStyles.itemSubtitle(context), + // ), + // SelectableText( + // _transaction.nonce.toString(), + // style: isDesktop + // ? STextStyles + // .desktopTextExtraExtraSmall( + // context) + // .copyWith( + // color: Theme.of(context) + // .extension()! + // .textDark, + // ) + // : STextStyles.itemSubtitle12(context), + // ), + // ], + // ), + // ), + if (kDebugMode) + isDesktop + ? const _Divider() + : const SizedBox( + height: 12, + ), + if (kDebugMode) + RoundedWhiteContainer( + padding: isDesktop + ? const EdgeInsets.all(16) + : const EdgeInsets.all(12), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.spaceBetween, + children: [ + Text( + "Tx sub type", + style: isDesktop + ? STextStyles + .desktopTextExtraExtraSmall( + context) + : STextStyles.itemSubtitle(context), + ), + SelectableText( + _transaction.subType.toString(), + style: isDesktop + ? STextStyles + .desktopTextExtraExtraSmall( + context) + .copyWith( + color: Theme.of(context) + .extension()! + .textDark, + ) + : STextStyles.itemSubtitle12(context), + ), + ], + ), + ), isDesktop ? const _Divider() : const SizedBox( @@ -1057,11 +1272,11 @@ class _TransactionDetailsViewState : STextStyles.itemSubtitle12( context), ), - // ), - // ), + // if (coin != Coin.epicCash) const SizedBox( height: 8, ), + // if (coin != Coin.epicCash) CustomTextButton( text: "Open in block explorer", onTap: () async { @@ -1123,6 +1338,8 @@ class _TransactionDetailsViewState } }, ), + // ), + // ), ], ), ), diff --git a/lib/pages/wallet_view/transaction_views/transaction_search_filter_view.dart b/lib/pages/wallet_view/transaction_views/transaction_search_filter_view.dart index 48795142d..466a726a0 100644 --- a/lib/pages/wallet_view/transaction_views/transaction_search_filter_view.dart +++ b/lib/pages/wallet_view/transaction_views/transaction_search_filter_view.dart @@ -1,6 +1,5 @@ import 'package:decimal/decimal.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_rounded_date_picker/flutter_rounded_date_picker.dart'; import 'package:flutter_svg/svg.dart'; @@ -10,6 +9,8 @@ import 'package:stackduo/providers/ui/transaction_filter_provider.dart'; import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/themes/theme_providers.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; +import 'package:stackduo/utilities/amount/amount_input_formatter.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; @@ -76,11 +77,12 @@ class _TransactionSearchViewState _toDateString = _selectedToDate == null ? "" : Format.formatDate(_selectedToDate!); - final String amount = filterState.amount?.localizedStringAsFixed( - locale: ref.read(localeServiceChangeNotifierProvider).locale, - decimalPlaces: widget.coin.decimals, - ) ?? - ""; + final String amount = filterState.amount == null + ? "" + : ref.read(pAmountFormatter(widget.coin)).format( + filterState.amount!, + withUnitName: false, + ); _amountTextEditingController.text = amount; } @@ -746,12 +748,20 @@ class _TransactionSearchViewState decimal: true, ), inputFormatters: [ - // regex to validate a crypto amount with 8 decimal places - TextInputFormatter.withFunction((oldValue, newValue) => - RegExp(r'^([0-9]*[,.]?[0-9]{0,8}|[,.][0-9]{0,8})$') - .hasMatch(newValue.text) - ? newValue - : oldValue), + AmountInputFormatter( + decimals: widget.coin.decimals, + unit: ref.watch(pAmountUnit(widget.coin)), + locale: ref.watch( + localeServiceChangeNotifierProvider + .select((value) => value.locale), + ), + ), + // // regex to validate a crypto amount with 8 decimal places + // TextInputFormatter.withFunction((oldValue, newValue) => + // RegExp(r'^([0-9]*[,.]?[0-9]{0,8}|[,.][0-9]{0,8})$') + // .hasMatch(newValue.text) + // ? newValue + // : oldValue), ], style: isDesktop ? STextStyles.desktopTextExtraSmall(context).copyWith( diff --git a/lib/pages/wallet_view/wallet_view.dart b/lib/pages/wallet_view/wallet_view.dart index 792742fd4..124c28c59 100644 --- a/lib/pages/wallet_view/wallet_view.dart +++ b/lib/pages/wallet_view/wallet_view.dart @@ -572,7 +572,7 @@ class _WalletViewState extends ConsumerState { padding: const EdgeInsets.symmetric(horizontal: 16), child: WalletSummary( walletId: walletId, - managerProvider: managerProvider, + aspectRatio: 1.75, initialSyncStatus: ref.watch(managerProvider .select((value) => value.isRefreshing)) ? WalletSyncStatus.syncing @@ -678,15 +678,11 @@ class _WalletViewState extends ConsumerState { label: "Receive", icon: const ReceiveNavIcon(), onTap: () { - final coin = ref.read(managerProvider).coin; if (mounted) { unawaited( Navigator.of(context).pushNamed( ReceiveView.routeName, - arguments: Tuple2( - walletId, - coin, - ), + arguments: walletId, ), ); } diff --git a/lib/pages/wallets_view/sub_widgets/favorite_card.dart b/lib/pages/wallets_view/sub_widgets/favorite_card.dart index 2f8c6de2a..629ad62d5 100644 --- a/lib/pages/wallets_view/sub_widgets/favorite_card.dart +++ b/lib/pages/wallets_view/sub_widgets/favorite_card.dart @@ -9,11 +9,12 @@ import 'package:stackduo/providers/providers.dart'; import 'package:stackduo/themes/coin_icon_provider.dart'; import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; -import 'package:stackduo/utilities/assets.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/text_styles.dart'; import 'package:stackduo/utilities/util.dart'; +import 'package:stackduo/widgets/coin_card.dart'; import 'package:stackduo/widgets/conditional_parent.dart'; import 'package:tuple/tuple.dart'; @@ -133,66 +134,10 @@ class _FavoriteCardState extends ConsumerState { width: widget.width, height: widget.height, child: CardOverlayStack( - background: Stack( - children: [ - Container( - width: widget.width, - height: widget.height, - decoration: BoxDecoration( - color: Theme.of(context) - .extension()! - .colorForCoin(coin), - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, - ), - ), - ), - Column( - children: [ - const Spacer(), - SizedBox( - height: widget.width * 0.3, - child: Row( - children: [ - const Spacer( - flex: 9, - ), - SvgPicture.asset( - Assets.svg.ellipse2, - height: widget.width * 0.3, - ), - // ), - const Spacer( - flex: 2, - ), - ], - ), - ), - ], - ), - Row( - children: [ - const Spacer( - flex: 5, - ), - SizedBox( - width: widget.width * 0.45, - child: Column( - children: [ - SvgPicture.asset( - Assets.svg.ellipse1, - width: widget.width * 0.45, - ), - const Spacer(), - ], - ), - ), - const Spacer( - flex: 1, - ), - ], - ), - ], + background: CoinCard( + walletId: widget.walletId, + width: widget.width, + height: widget.height, ), child: Padding( padding: const EdgeInsets.all(12.0), @@ -260,14 +205,7 @@ class _FavoriteCardState extends ConsumerState { FittedBox( fit: BoxFit.scaleDown, child: Text( - "${total.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), - ), - decimalPlaces: coin.decimals, - )} ${coin.ticker}", + ref.watch(pAmountFormatter(coin)).format(total), style: STextStyles.titleBold12(context).copyWith( fontSize: 16, color: Theme.of(context) @@ -282,13 +220,12 @@ class _FavoriteCardState extends ConsumerState { ), if (externalCalls) Text( - "${fiatTotal.localizedStringAsFixed( + "${fiatTotal.fiatString( locale: ref.watch( localeServiceChangeNotifierProvider.select( (value) => value.locale, ), ), - decimalPlaces: 2, )} ${ref.watch( prefsChangeNotifierProvider.select( (value) => value.currency, diff --git a/lib/pages/wallets_view/sub_widgets/wallet_list_item.dart b/lib/pages/wallets_view/sub_widgets/wallet_list_item.dart index b28010bb8..971e17fb4 100644 --- a/lib/pages/wallets_view/sub_widgets/wallet_list_item.dart +++ b/lib/pages/wallets_view/sub_widgets/wallet_list_item.dart @@ -98,12 +98,12 @@ class WalletListItem extends ConsumerWidget { final calls = ref.watch(prefsChangeNotifierProvider).externalCalls; - final priceString = tuple.item1 - .toAmount(fractionDigits: 2) - .localizedStringAsFixed( - locale: ref.watch(localeServiceChangeNotifierProvider - .select((value) => value.locale)), - ); + final priceString = + tuple.item1.toAmount(fractionDigits: 2).fiatString( + locale: ref.watch( + localeServiceChangeNotifierProvider + .select((value) => value.locale)), + ); final double percentChange = tuple.item2; diff --git a/lib/pages/wallets_view/wallets_overview.dart b/lib/pages/wallets_view/wallets_overview.dart index 92194af35..2ae47352a 100644 --- a/lib/pages/wallets_view/wallets_overview.dart +++ b/lib/pages/wallets_view/wallets_overview.dart @@ -1,19 +1,22 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:stackduo/models/add_wallet_list_entity/sub_classes/coin_entity.dart'; import 'package:stackduo/pages/add_wallet_views/create_or_restore_wallet_view/create_or_restore_wallet_view.dart'; +import 'package:stackduo/pages_desktop_specific/my_stack_view/dialogs/desktop_expanding_wallet_card.dart'; import 'package:stackduo/providers/providers.dart'; import 'package:stackduo/services/coins/manager.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/util.dart'; import 'package:stackduo/widgets/background.dart'; import 'package:stackduo/widgets/conditional_parent.dart'; import 'package:stackduo/widgets/custom_buttons/app_bar_icon_button.dart'; import 'package:stackduo/widgets/icon_widgets/x_icon.dart'; +import 'package:stackduo/widgets/master_wallet_card.dart'; import 'package:stackduo/widgets/rounded_white_container.dart'; import 'package:stackduo/widgets/stack_text_field.dart'; import 'package:stackduo/widgets/textfield_icon_button.dart'; @@ -170,7 +173,7 @@ class _EthWalletsOverviewState extends ConsumerState { onPressed: () { Navigator.of(context).pushNamed( CreateOrRestoreWalletView.routeName, - arguments: widget.coin, + arguments: CoinEntity(widget.coin), ); }, ), @@ -260,40 +263,40 @@ class _EthWalletsOverviewState extends ConsumerState { itemBuilder: (_, index) { final element = data[index]; - // if (element.item1.hasTokenSupport) { - // if (isDesktop) { - // return DesktopExpandingWalletCard( - // key: Key( - // "${element.item1.walletName}_${element.item2.map((e) => e.address).join()}"), - // data: element, - // navigatorState: widget.navigatorState!, - // ); - // } else { - // return MasterWalletCard( - // walletId: element.item1.walletId, - // ); - // } - // } else { - return ConditionalParent( - condition: isDesktop, - builder: (child) => RoundedWhiteContainer( - padding: const EdgeInsets.symmetric( - vertical: 14, - horizontal: 20, + if (element.item1.hasTokenSupport) { + if (isDesktop) { + return DesktopExpandingWalletCard( + key: Key( + "${element.item1.walletName}_${element.item2.map((e) => e.address).join()}"), + data: element, + navigatorState: widget.navigatorState!, + ); + } else { + return MasterWalletCard( + walletId: element.item1.walletId, + ); + } + } else { + return ConditionalParent( + condition: isDesktop, + builder: (child) => RoundedWhiteContainer( + padding: const EdgeInsets.symmetric( + vertical: 14, + horizontal: 20, + ), + borderColor: Theme.of(context) + .extension()! + .backgroundAppBar, + child: child, ), - borderColor: Theme.of(context) - .extension()! - .backgroundAppBar, - child: child, - ), - child: SimpleWalletCard( - walletId: element.item1.walletId, - popPrevious: isDesktop, - desktopNavigatorState: - isDesktop ? widget.navigatorState : null, - ), - ); - // } + child: SimpleWalletCard( + walletId: element.item1.walletId, + popPrevious: isDesktop, + desktopNavigatorState: + isDesktop ? widget.navigatorState : null, + ), + ); + } }, separatorBuilder: (_, __) => SizedBox( height: isDesktop ? 10 : 8, diff --git a/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_contact_details.dart b/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_contact_details.dart index a81284895..b5f34f857 100644 --- a/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_contact_details.dart +++ b/lib/pages_desktop_specific/address_book_view/subwidgets/desktop_contact_details.dart @@ -2,7 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/contact_entry.dart'; import 'package:stackduo/models/isar/models/isar_models.dart'; import 'package:stackduo/pages/address_book_views/subviews/add_new_contact_address_view.dart'; diff --git a/lib/pages_desktop_specific/coin_control/desktop_coin_control_use_dialog.dart b/lib/pages_desktop_specific/coin_control/desktop_coin_control_use_dialog.dart index b66d5758c..b475dca83 100644 --- a/lib/pages_desktop_specific/coin_control/desktop_coin_control_use_dialog.dart +++ b/lib/pages_desktop_specific/coin_control/desktop_coin_control_use_dialog.dart @@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/blockchain_data/utxo.dart'; import 'package:stackduo/pages_desktop_specific/coin_control/utxo_row.dart'; import 'package:stackduo/providers/global/wallets_provider.dart'; diff --git a/lib/pages_desktop_specific/coin_control/desktop_coin_control_view.dart b/lib/pages_desktop_specific/coin_control/desktop_coin_control_view.dart index bfda3654f..a57246cb0 100644 --- a/lib/pages_desktop_specific/coin_control/desktop_coin_control_view.dart +++ b/lib/pages_desktop_specific/coin_control/desktop_coin_control_view.dart @@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/blockchain_data/utxo.dart'; import 'package:stackduo/pages_desktop_specific/coin_control/freeze_button.dart'; import 'package:stackduo/pages_desktop_specific/coin_control/utxo_row.dart'; diff --git a/lib/pages_desktop_specific/coin_control/freeze_button.dart b/lib/pages_desktop_specific/coin_control/freeze_button.dart index 21b3ba11e..5c79d881e 100644 --- a/lib/pages_desktop_specific/coin_control/freeze_button.dart +++ b/lib/pages_desktop_specific/coin_control/freeze_button.dart @@ -1,7 +1,7 @@ import 'package:async/async.dart'; import 'package:flutter/material.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/blockchain_data/utxo.dart'; import 'package:stackduo/pages_desktop_specific/coin_control/utxo_row.dart'; import 'package:stackduo/utilities/logger.dart'; diff --git a/lib/pages_desktop_specific/coin_control/utxo_row.dart b/lib/pages_desktop_specific/coin_control/utxo_row.dart index fce3bb710..426327d83 100644 --- a/lib/pages_desktop_specific/coin_control/utxo_row.dart +++ b/lib/pages_desktop_specific/coin_control/utxo_row.dart @@ -1,15 +1,15 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/isar_models.dart'; import 'package:stackduo/pages/coin_control/utxo_details_view.dart'; -import 'package:stackduo/providers/global/locale_provider.dart'; import 'package:stackduo/providers/global/wallets_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/widgets/conditional_parent.dart'; import 'package:stackduo/widgets/custom_buttons/blue_text_button.dart'; import 'package:stackduo/widgets/desktop/secondary_button.dart'; @@ -144,16 +144,12 @@ class _UtxoRowState extends ConsumerState { ), if (!widget.compact) Text( - "${Amount( - rawValue: BigInt.from(utxo.value), - fractionDigits: coin.decimals, - ).localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, + ref.watch(pAmountFormatter(coin)).format( + Amount( + rawValue: BigInt.from(utxo.value), + fractionDigits: coin.decimals, + ), ), - ), - )} ${coin.ticker}", textAlign: TextAlign.right, style: STextStyles.w600_14(context), ), @@ -170,16 +166,12 @@ class _UtxoRowState extends ConsumerState { mainAxisSize: MainAxisSize.min, children: [ Text( - "${Amount( - rawValue: BigInt.from(utxo.value), - fractionDigits: coin.decimals, - ).localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, + ref.watch(pAmountFormatter(coin)).format( + Amount( + rawValue: BigInt.from(utxo.value), + fractionDigits: coin.decimals, + ), ), - ), - )} ${coin.ticker}", textAlign: TextAlign.right, style: STextStyles.w600_14(context), ), diff --git a/lib/pages_desktop_specific/desktop_exchange/desktop_all_trades_view.dart b/lib/pages_desktop_specific/desktop_exchange/desktop_all_trades_view.dart index 9c411ddf3..e4fc11709 100644 --- a/lib/pages_desktop_specific/desktop_exchange/desktop_all_trades_view.dart +++ b/lib/pages_desktop_specific/desktop_exchange/desktop_all_trades_view.dart @@ -6,7 +6,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/exchange/change_now/exchange_transaction_status.dart'; import 'package:stackduo/models/exchange/response_objects/trade.dart'; import 'package:stackduo/models/isar/models/isar_models.dart'; diff --git a/lib/pages_desktop_specific/desktop_exchange/exchange_steps/step_scaffold.dart b/lib/pages_desktop_specific/desktop_exchange/exchange_steps/step_scaffold.dart index 768f19b19..d176b210b 100644 --- a/lib/pages_desktop_specific/desktop_exchange/exchange_steps/step_scaffold.dart +++ b/lib/pages_desktop_specific/desktop_exchange/exchange_steps/step_scaffold.dart @@ -374,7 +374,7 @@ class _StepScaffoldState extends ConsumerState { height: 48, ), Center( - child: QrImage( + child: QrImageView( // TODO: grab coin uri scheme from somewhere // data: "${coin.uriScheme}:$receivingAddress", data: ref.watch(desktopExchangeModelProvider diff --git a/lib/pages_desktop_specific/desktop_exchange/subwidgets/desktop_choose_from_stack.dart b/lib/pages_desktop_specific/desktop_exchange/subwidgets/desktop_choose_from_stack.dart index 6c60a6c29..0ea21f721 100644 --- a/lib/pages_desktop_specific/desktop_exchange/subwidgets/desktop_choose_from_stack.dart +++ b/lib/pages_desktop_specific/desktop_exchange/subwidgets/desktop_choose_from_stack.dart @@ -2,12 +2,13 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:stackduo/providers/providers.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/widgets/custom_buttons/blue_text_button.dart'; import 'package:stackduo/widgets/desktop/secondary_button.dart'; import 'package:stackduo/widgets/icon_widgets/x_icon.dart'; @@ -278,14 +279,11 @@ class _BalanceDisplay extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final manager = ref.watch(walletsChangeNotifierProvider .select((value) => value.getManager(walletId))); - final locale = ref.watch( - localeServiceChangeNotifierProvider.select((value) => value.locale)); final Amount total = manager.balance.total; return Text( - "${total.localizedStringAsFixed(locale: locale)} " - "${manager.coin.ticker}", + ref.watch(pAmountFormatter(manager.coin)).format(total), style: STextStyles.desktopTextExtraSmall(context).copyWith( color: Theme.of(context).extension()!.textSubtitle1, ), diff --git a/lib/pages_desktop_specific/desktop_exchange/subwidgets/desktop_trade_history.dart b/lib/pages_desktop_specific/desktop_exchange/subwidgets/desktop_trade_history.dart index 712426990..69f9e8ee5 100644 --- a/lib/pages_desktop_specific/desktop_exchange/subwidgets/desktop_trade_history.dart +++ b/lib/pages_desktop_specific/desktop_exchange/subwidgets/desktop_trade_history.dart @@ -5,21 +5,19 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:isar/isar.dart'; import 'package:stackduo/models/isar/models/blockchain_data/transaction.dart'; import 'package:stackduo/pages/exchange_view/trade_details_view.dart'; -import 'package:stackduo/pages_desktop_specific/desktop_exchange/desktop_all_trades_view.dart'; import 'package:stackduo/providers/exchange/trade_sent_from_stack_lookup_provider.dart'; import 'package:stackduo/providers/global/trades_service_provider.dart'; import 'package:stackduo/providers/global/wallets_provider.dart'; import 'package:stackduo/route_generator.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; -import 'package:stackduo/widgets/custom_buttons/blue_text_button.dart'; import 'package:stackduo/widgets/desktop/desktop_dialog.dart'; import 'package:stackduo/widgets/desktop/desktop_dialog_close_button.dart'; import 'package:stackduo/widgets/rounded_white_container.dart'; import 'package:stackduo/widgets/trade_card.dart'; -import '../../../db/main_db.dart'; +import '../../../db/isar/main_db.dart'; class DesktopTradeHistory extends ConsumerStatefulWidget { const DesktopTradeHistory({Key? key}) : super(key: key); diff --git a/lib/pages_desktop_specific/my_stack_view/paynym/desktop_paynym_send_dialog.dart b/lib/pages_desktop_specific/my_stack_view/paynym/desktop_paynym_send_dialog.dart index 6501d57bd..7fc2aef69 100644 --- a/lib/pages_desktop_specific/my_stack_view/paynym/desktop_paynym_send_dialog.dart +++ b/lib/pages_desktop_specific/my_stack_view/paynym/desktop_paynym_send_dialog.dart @@ -13,6 +13,7 @@ import 'package:stackduo/providers/global/wallets_provider.dart'; import 'package:stackduo/themes/coin_icon_provider.dart'; import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/barcode_scanner_interface.dart'; import 'package:stackduo/utilities/clipboard_interface.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; @@ -118,9 +119,26 @@ class _DesktopPaynymSendDialogState crossAxisAlignment: CrossAxisAlignment.end, children: [ Text( - "${manager.balance.spendable.localizedStringAsFixed( - locale: locale, - )} ${coin.ticker}", + // !isFiro + // ? + ref + .watch(pAmountFormatter(coin)) + .format(manager.balance.spendable) + // : ref + // .watch( + // publicPrivateBalanceStateProvider + // .state, + // ) + // .state == + // "Private" + // ? ref.watch(pAmountFormatter(coin)).format( + // (manager.wallet as FiroWallet) + // .availablePrivateBalance()) + // : ref.watch(pAmountFormatter(coin)).format( + // (manager.wallet as FiroWallet) + // .availablePublicBalance(), + // ) + , style: STextStyles.titleBold12(context), textAlign: TextAlign.right, ), @@ -128,19 +146,15 @@ class _DesktopPaynymSendDialogState height: 2, ), Text( - "${(manager.balance.spendable.decimal * ref.watch( + "${((/*!isFiro ?*/ manager.balance.spendable.decimal /*: ref.watch(publicPrivateBalanceStateProvider.state).state == "Private" ? (manager.wallet as FiroWallet).availablePrivateBalance().decimal : (manager.wallet as FiroWallet).availablePublicBalance().decimal*/) * ref.watch( priceAnd24hChangeNotifierProvider.select( (value) => value.getPrice(coin).item1, ), - )).toAmount( - fractionDigits: 2, - ).localizedStringAsFixed( + )).toAmount(fractionDigits: 2).fiatString( locale: locale, - )} ${ref.watch( - prefsChangeNotifierProvider.select( - (value) => value.currency, - ), - )}", + )} ${ref.watch(prefsChangeNotifierProvider.select( + (value) => value.currency, + ))}", style: STextStyles.baseXS(context).copyWith( color: Theme.of(context) .extension()! diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_summary_table.dart b/lib/pages_desktop_specific/my_stack_view/wallet_summary_table.dart index aa26b837d..58470932c 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_summary_table.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_summary_table.dart @@ -214,13 +214,12 @@ class TablePriceInfo extends ConsumerWidget { final priceString = Amount.fromDecimal( tuple.item1, fractionDigits: 2, - ).localizedStringAsFixed( + ).fiatString( locale: ref .watch( localeServiceChangeNotifierProvider.notifier, ) .locale, - decimalPlaces: 2, ); final double percentChange = tuple.item2; diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_fee_dropdown.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_fee_dropdown.dart index 9cb346724..c57032014 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_fee_dropdown.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_fee_dropdown.dart @@ -7,22 +7,25 @@ import 'package:stackduo/models/models.dart'; import 'package:stackduo/pages/send_view/sub_widgets/transaction_fee_selection_sheet.dart'; import 'package:stackduo/providers/global/wallets_provider.dart'; import 'package:stackduo/providers/ui/fee_rate_type_state_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/enums/fee_rate_type_enum.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/widgets/animated_text.dart'; class DesktopFeeDropDown extends ConsumerStatefulWidget { const DesktopFeeDropDown({ Key? key, required this.walletId, + this.isToken = false, }) : super(key: key); final String walletId; + final bool isToken; @override ConsumerState createState() => _DesktopFeeDropDownState(); @@ -49,55 +52,114 @@ class _DesktopFeeDropDownState extends ConsumerState { }) async { switch (feeRateType) { case FeeRateType.fast: - if (ref.read(feeSheetSessionCacheProvider).fast[amount] == null) { + if (ref.read( + // widget.isToken + // ? tokenFeeSessionCacheProvider + // : + feeSheetSessionCacheProvider).fast[amount] == null) { + // if (widget.isToken == false) { final manager = ref.read(walletsChangeNotifierProvider).getManager(walletId); - if (coin == Coin.monero) { + if (coin == Coin.monero /*|| coin == Coin.wownero*/) { final fee = await manager.estimateFeeFor( amount, MoneroTransactionPriority.fast.raw!); ref.read(feeSheetSessionCacheProvider).fast[amount] = fee; + // } else if ((coin == Coin.firo || coin == Coin.firoTestNet) && + // ref.read(publicPrivateBalanceStateProvider.state).state != + // "Private") { + // ref.read(feeSheetSessionCacheProvider).fast[amount] = + // await (manager.wallet as FiroWallet) + // .estimateFeeForPublic(amount, feeRate); } else { ref.read(feeSheetSessionCacheProvider).fast[amount] = await manager.estimateFeeFor(amount, feeRate); } + // } else { + // final tokenWallet = ref.read(tokenServiceProvider)!; + // final fee = tokenWallet.estimateFeeFor(feeRate); + // ref.read(tokenFeeSessionCacheProvider).fast[amount] = fee; + // } } - - return ref.read(feeSheetSessionCacheProvider).fast[amount]!; + return ref.read( + // widget.isToken + // ? tokenFeeSessionCacheProvider + // : + feeSheetSessionCacheProvider).fast[amount]!; case FeeRateType.average: - if (ref.read(feeSheetSessionCacheProvider).average[amount] == null) { + if (ref.read( + // widget.isToken + // ? tokenFeeSessionCacheProvider + // : + feeSheetSessionCacheProvider).average[amount] == null) { + // if (widget.isToken == false) { final manager = ref.read(walletsChangeNotifierProvider).getManager(walletId); - if (coin == Coin.monero) { + if (coin == Coin.monero /*|| coin == Coin.wownero*/) { final fee = await manager.estimateFeeFor( amount, MoneroTransactionPriority.regular.raw!); ref.read(feeSheetSessionCacheProvider).average[amount] = fee; + // } else if ((coin == Coin.firo || coin == Coin.firoTestNet) && + // ref.read(publicPrivateBalanceStateProvider.state).state != + // "Private") { + // ref.read(feeSheetSessionCacheProvider).average[amount] = + // await (manager.wallet as FiroWallet) + // .estimateFeeForPublic(amount, feeRate); } else { ref.read(feeSheetSessionCacheProvider).average[amount] = await manager.estimateFeeFor(amount, feeRate); } + // } else { + // final tokenWallet = ref.read(tokenServiceProvider)!; + // final fee = tokenWallet.estimateFeeFor(feeRate); + // ref.read(tokenFeeSessionCacheProvider).average[amount] = fee; + // } } - - return ref.read(feeSheetSessionCacheProvider).average[amount]!; + return ref.read( + // widget.isToken + // ? tokenFeeSessionCacheProvider + // : + feeSheetSessionCacheProvider).average[amount]!; case FeeRateType.slow: - if (ref.read(feeSheetSessionCacheProvider).slow[amount] == null) { + if (ref.read( + // widget.isToken + // ? tokenFeeSessionCacheProvider + // : + feeSheetSessionCacheProvider).slow[amount] == null) { + // if (widget.isToken == false) { final manager = ref.read(walletsChangeNotifierProvider).getManager(walletId); - if (coin == Coin.monero) { + if (coin == Coin.monero /*|| coin == Coin.wownero*/) { final fee = await manager.estimateFeeFor( amount, MoneroTransactionPriority.slow.raw!); ref.read(feeSheetSessionCacheProvider).slow[amount] = fee; + // } else if ((coin == Coin.firo || coin == Coin.firoTestNet) && + // ref.read(publicPrivateBalanceStateProvider.state).state != + // "Private") { + // ref.read(feeSheetSessionCacheProvider).slow[amount] = + // await (manager.wallet as FiroWallet) + // .estimateFeeForPublic(amount, feeRate); } else { ref.read(feeSheetSessionCacheProvider).slow[amount] = await manager.estimateFeeFor(amount, feeRate); } + // } else { + // final tokenWallet = ref.read(tokenServiceProvider)!; + // final fee = tokenWallet.estimateFeeFor(feeRate); + // ref.read(tokenFeeSessionCacheProvider).slow[amount] = fee; + // } } - - return ref.read(feeSheetSessionCacheProvider).slow[amount]!; + return ref.read( + // widget.isToken + // ? tokenFeeSessionCacheProvider + // : + feeSheetSessionCacheProvider).slow[amount]!; + default: + return Amount.zero; } } @@ -119,65 +181,47 @@ class _DesktopFeeDropDownState extends ConsumerState { .select((value) => value.getManager(walletId))); return FutureBuilder( - future: manager.fees, - builder: (context, AsyncSnapshot snapshot) { - if (snapshot.connectionState == ConnectionState.done && - snapshot.hasData) { - feeObject = snapshot.data!; - } - return DropdownButtonHideUnderline( - child: DropdownButton2( - offset: const Offset(0, -10), - isExpanded: true, - dropdownElevation: 0, - value: ref.watch(feeRateTypeStateProvider.state).state, - // selectedItemBuilder: (s) { - // return [ - // ...FeeRateType.values.map( - // (e) => DropdownMenuItem( - // value: e, - // child: FeeDropDownChild( - // feeObject: feeObject, - // feeRateType: e, - // walletId: walletId, - // amount: amount, - // feeFor: feeFor, - // isSelected: true, - // ), - // ), - // ), - // ]; - // }, - items: [ - ...FeeRateType.values.map( - (e) => DropdownMenuItem( - value: e, - child: FeeDropDownChild( - feeObject: feeObject, - feeRateType: e, - walletId: walletId, - feeFor: feeFor, - isSelected: false, - ), + future: manager.fees, + builder: (context, AsyncSnapshot snapshot) { + if (snapshot.connectionState == ConnectionState.done && + snapshot.hasData) { + feeObject = snapshot.data!; + } + return DropdownButtonHideUnderline( + child: DropdownButton2( + isExpanded: true, + value: ref.watch(feeRateTypeStateProvider.state).state, + items: [ + ...FeeRateType.values.map( + (e) => DropdownMenuItem( + value: e, + child: FeeDropDownChild( + feeObject: feeObject, + feeRateType: e, + walletId: walletId, + feeFor: feeFor, + isSelected: false, ), ), - ], - onChanged: (newRateType) { - if (newRateType is FeeRateType) { - ref.read(feeRateTypeStateProvider.state).state = newRateType; - } - }, + ), + ], + onChanged: (newRateType) { + if (newRateType is FeeRateType) { + ref.read(feeRateTypeStateProvider.state).state = newRateType; + } + }, + iconStyleData: IconStyleData( icon: SvgPicture.asset( Assets.svg.chevronDown, width: 12, height: 6, color: Theme.of(context).extension()!.textDark3, ), - buttonPadding: const EdgeInsets.symmetric( - horizontal: 16, - vertical: 8, - ), - buttonDecoration: BoxDecoration( + ), + dropdownStyleData: DropdownStyleData( + offset: const Offset(0, -10), + elevation: 0, + decoration: BoxDecoration( color: Theme.of(context) .extension()! .textFieldDefaultBG, @@ -185,17 +229,17 @@ class _DesktopFeeDropDownState extends ConsumerState { Constants.size.circularBorderRadius, ), ), - dropdownDecoration: BoxDecoration( - color: Theme.of(context) - .extension()! - .textFieldDefaultBG, - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, - ), + ), + menuItemStyleData: const MenuItemStyleData( + padding: EdgeInsets.symmetric( + horizontal: 16, + vertical: 8, ), ), - ); - }); + ), + ); + }, + ); } } @@ -290,10 +334,10 @@ class FeeDropDownChild extends ConsumerWidget { children: [ Text( "${feeRateType.prettyName} " - "(~${snapshot.data!.decimal.toStringAsFixed( - manager.coin.decimals, - )} " - "${manager.coin.ticker})", + "(~${ref.watch(pAmountFormatter(manager.coin)).format( + snapshot.data!, + indicatePrecisionLoss: false, + )})", style: STextStyles.desktopTextExtraExtraSmall(context).copyWith( color: Theme.of(context) @@ -304,6 +348,9 @@ class FeeDropDownChild extends ConsumerWidget { ), if (feeObject != null) Text( + // manager.coin == Coin.ethereum + // ? "" + // : estimatedTimeToBeIncludedInNextBlock( Constants.targetBlockTimeInSeconds(manager.coin), feeRateType == FeeRateType.fast diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_receive.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_receive.dart index efa1cb4e1..521b50f6e 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_receive.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_receive.dart @@ -27,10 +27,12 @@ class DesktopReceive extends ConsumerStatefulWidget { const DesktopReceive({ Key? key, required this.walletId, + this.contractAddress, this.clipboard = const ClipboardWrapper(), }) : super(key: key); final String walletId; + final String? contractAddress; final ClipboardInterface clipboard; @override @@ -148,7 +150,15 @@ class _DesktopReceiveState extends ConsumerState { Row( children: [ Text( - "Your ${coin.ticker} address", + "Your ${ + // widget.contractAddress == null ? + coin.ticker + // : ref.watch( + // tokenServiceProvider.select( + // (value) => value!.tokenContract.symbol, + // ), + // ) + } address", style: STextStyles.itemSubtitle(context), ), const Spacer(), @@ -210,7 +220,7 @@ class _DesktopReceiveState extends ConsumerState { height: 32, ), Center( - child: QrImage( + child: QrImageView( data: "${coin.uriScheme}:$receivingAddress", size: 200, foregroundColor: diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart index 690aace10..64ef3d428 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart @@ -1,6 +1,8 @@ import 'dart:async'; +import 'dart:math'; import 'package:bip47/bip47.dart'; +import 'package:cw_core/monero_transaction_priority.dart'; import 'package:decimal/decimal.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -23,20 +25,27 @@ import 'package:stackduo/services/mixins/paynym_wallet_interface.dart'; import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/address_utils.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; +import 'package:stackduo/utilities/amount/amount_input_formatter.dart'; +import 'package:stackduo/utilities/amount/amount_unit.dart'; import 'package:stackduo/utilities/barcode_scanner_interface.dart'; import 'package:stackduo/utilities/clipboard_interface.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; +import 'package:stackduo/utilities/enums/fee_rate_type_enum.dart'; import 'package:stackduo/utilities/logger.dart'; import 'package:stackduo/utilities/prefs.dart'; import 'package:stackduo/utilities/text_styles.dart'; import 'package:stackduo/utilities/util.dart'; import 'package:stackduo/widgets/animated_text.dart'; +import 'package:stackduo/widgets/conditional_parent.dart'; import 'package:stackduo/widgets/custom_buttons/blue_text_button.dart'; import 'package:stackduo/widgets/desktop/desktop_dialog.dart'; import 'package:stackduo/widgets/desktop/desktop_dialog_close_button.dart'; +import 'package:stackduo/widgets/desktop/desktop_fee_dialog.dart'; import 'package:stackduo/widgets/desktop/primary_button.dart'; import 'package:stackduo/widgets/desktop/secondary_button.dart'; +import 'package:stackduo/widgets/fee_slider.dart'; import 'package:stackduo/widgets/icon_widgets/addressbook_icon.dart'; import 'package:stackduo/widgets/icon_widgets/clipboard_icon.dart'; import 'package:stackduo/widgets/icon_widgets/x_icon.dart'; @@ -97,6 +106,17 @@ class _DesktopSendState extends ConsumerState { bool get isPaynymSend => widget.accountLite != null; + bool isCustomFee = false; + int customFeeRate = 1; + (FeeRateType, String?, String?)? feeSelectionResult; + + final stringsToLoopThrough = [ + "Calculating", + "Calculating.", + "Calculating..", + "Calculating...", + ]; + Future previewSend() async { final manager = ref.read(walletsChangeNotifierProvider).getManager(walletId); @@ -253,6 +273,7 @@ class _DesktopSendState extends ConsumerState { isSegwit: widget.accountLite!.segwit, amount: amount, args: { + "satsPerVByte": isCustomFee ? customFeeRate : null, "feeRate": feeRate, "UTXOs": (manager.hasCoinControlSupport && coinControlEnabled && @@ -267,6 +288,7 @@ class _DesktopSendState extends ConsumerState { amount: amount, args: { "feeRate": ref.read(feeRateTypeStateProvider), + "satsPerVByte": isCustomFee ? customFeeRate : null, "UTXOs": (manager.hasCoinControlSupport && coinControlEnabled && ref.read(desktopUseUTXOs).isNotEmpty) @@ -397,14 +419,26 @@ class _DesktopSendState extends ConsumerState { void _cryptoAmountChanged() async { if (!_cryptoAmountChangeLock) { - final String cryptoAmount = cryptoAmountController.text; + String cryptoAmount = cryptoAmountController.text; if (cryptoAmount.isNotEmpty && cryptoAmount != "." && cryptoAmount != ",") { + if (cryptoAmount.startsWith("~")) { + cryptoAmount = cryptoAmount.substring(1); + } + if (cryptoAmount.contains(" ")) { + cryptoAmount = cryptoAmount.split(" ").first; + } + + // ensure we don't shift past minimum atomic value + final shift = min(ref.read(pAmountUnit(coin)).shift, coin.decimals); + _amountToSend = cryptoAmount.contains(",") ? Decimal.parse(cryptoAmount.replaceFirst(",", ".")) + .shift(0 - shift) .toAmount(fractionDigits: coin.decimals) : Decimal.parse(cryptoAmount) + .shift(0 - shift) .toAmount(fractionDigits: coin.decimals); if (_cachedAmountToSend != null && _cachedAmountToSend == _amountToSend) { @@ -420,7 +454,7 @@ class _DesktopSendState extends ConsumerState { if (price > Decimal.zero) { final String fiatAmountString = (_amountToSend!.decimal * price) .toAmount(fractionDigits: 2) - .localizedStringAsFixed( + .fiatString( locale: ref.read(localeServiceChangeNotifierProvider).locale, ); @@ -474,22 +508,17 @@ class _DesktopSendState extends ConsumerState { } if (private && _privateBalanceString != null) { return Text( - "$_privateBalanceString ${coin.ticker}", + "$_privateBalanceString", style: STextStyles.itemSubtitle(context), ); } else if (!private && _publicBalanceString != null) { return Text( - "$_publicBalanceString ${coin.ticker}", + "$_publicBalanceString", style: STextStyles.itemSubtitle(context), ); } else { return AnimatedText( - stringsToLoopThrough: const [ - "Loading balance", - "Loading balance.", - "Loading balance..", - "Loading balance...", - ], + stringsToLoopThrough: stringsToLoopThrough, style: STextStyles.itemSubtitle(context), ); } @@ -528,11 +557,9 @@ class _DesktopSendState extends ConsumerState { final amount = Decimal.parse(results["amount"]!).toAmount( fractionDigits: coin.decimals, ); - cryptoAmountController.text = amount.localizedStringAsFixed( - locale: ref.read(localeServiceChangeNotifierProvider).locale, - decimalPlaces: Constants.decimalPlacesForCoin(coin), - ); - amount.toString(); + cryptoAmountController.text = ref + .read(pAmountFormatter(coin)) + .format(amount, withUnitName: false); _amountToSend = amount; } @@ -609,10 +636,10 @@ class _DesktopSendState extends ConsumerState { Logging.instance.log("it changed $_amountToSend $_cachedAmountToSend", level: LogLevel.Info); - final amountString = _amountToSend!.localizedStringAsFixed( - locale: ref.read(localeServiceChangeNotifierProvider).locale, - decimalPlaces: coin.decimals, - ); + final amountString = ref.read(pAmountFormatter(coin)).format( + _amountToSend!, + withUnitName: false, + ); _cryptoAmountChangeLock = true; cryptoAmountController.text = amountString; @@ -815,12 +842,21 @@ class _DesktopSendState extends ConsumerState { ), textAlign: TextAlign.right, inputFormatters: [ - // regex to validate a crypto amount with 8 decimal places - TextInputFormatter.withFunction((oldValue, newValue) => - RegExp(r'^([0-9]*[,.]?[0-9]{0,8}|[,.][0-9]{0,8})$') - .hasMatch(newValue.text) - ? newValue - : oldValue), + AmountInputFormatter( + decimals: coin.decimals, + unit: ref.watch(pAmountUnit(coin)), + locale: ref.watch( + localeServiceChangeNotifierProvider.select( + (value) => value.locale, + ), + ), + ), + // // regex to validate a crypto amount with 8 decimal places + // TextInputFormatter.withFunction((oldValue, newValue) => + // RegExp(r'^([0-9]*[,.]?[0-9]{0,8}|[,.][0-9]{0,8})$') + // .hasMatch(newValue.text) + // ? newValue + // : oldValue), ], onChanged: (newValue) {}, decoration: InputDecoration( @@ -840,7 +876,7 @@ class _DesktopSendState extends ConsumerState { child: Padding( padding: const EdgeInsets.all(12), child: Text( - coin.ticker, + ref.watch(pAmountUnit(coin)).unitForCoin(coin), style: STextStyles.smallMed14(context).copyWith( color: Theme.of(context) .extension()! @@ -872,12 +908,20 @@ class _DesktopSendState extends ConsumerState { ), textAlign: TextAlign.right, inputFormatters: [ - // regex to validate a fiat amount with 2 decimal places - TextInputFormatter.withFunction((oldValue, newValue) => - RegExp(r'^([0-9]*[,.]?[0-9]{0,2}|[,.][0-9]{0,2})$') - .hasMatch(newValue.text) - ? newValue - : oldValue), + AmountInputFormatter( + decimals: 2, + locale: ref.watch( + localeServiceChangeNotifierProvider.select( + (value) => value.locale, + ), + ), + ), + // // regex to validate a fiat amount with 2 decimal places + // TextInputFormatter.withFunction((oldValue, newValue) => + // RegExp(r'^([0-9]*[,.]?[0-9]{0,2}|[,.][0-9]{0,2})$') + // .hasMatch(newValue.text) + // ? newValue + // : oldValue), ], onChanged: fiatTextFieldOnChanged, decoration: InputDecoration( @@ -1134,77 +1178,179 @@ class _DesktopSendState extends ConsumerState { } }, ), - // const SizedBox( - // height: 20, - // ), - // Text( - // "Note (optional)", - // style: STextStyles.desktopTextExtraSmall(context).copyWith( - // color: Theme.of(context) - // .extension()! - // .textFieldActiveSearchIconRight, - // ), - // textAlign: TextAlign.left, - // ), - // const SizedBox( - // height: 10, - // ), - // ClipRRect( - // borderRadius: BorderRadius.circular( - // Constants.size.circularBorderRadius, - // ), - // child: TextField( - // minLines: 1, - // maxLines: 5, - // autocorrect: Util.isDesktop ? false : true, - // enableSuggestions: Util.isDesktop ? false : true, - // controller: noteController, - // focusNode: _noteFocusNode, - // style: STextStyles.desktopTextExtraSmall(context).copyWith( - // color: Theme.of(context) - // .extension()! - // .textFieldActiveText, - // height: 1.8, - // ), - // onChanged: (_) => setState(() {}), - // decoration: standardInputDecoration( - // "Type something...", - // _noteFocusNode, - // context, - // desktopMed: true, - // ).copyWith( - // contentPadding: const EdgeInsets.only( - // left: 16, - // top: 11, - // bottom: 12, - // right: 5, - // ), - // suffixIcon: noteController.text.isNotEmpty - // ? Padding( - // padding: const EdgeInsets.only(right: 0), - // child: UnconstrainedBox( - // child: Row( - // children: [ - // TextFieldIconButton( - // child: const XIcon(), - // onTap: () async { - // setState(() { - // noteController.text = ""; - // }); - // }, - // ), - // ], - // ), - // ), - // ) - // : null, - // ), - // ), - // ), if (!isPaynymSend) const SizedBox( height: 20, ), + // if (!([Coin.nano, Coin.banano, Coin.epicCash].contains(coin))) + ConditionalParent( + condition: coin.isElectrumXCoin, + builder: (child) => Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + child, + CustomTextButton( + text: "Edit", + onTap: () async { + feeSelectionResult = await showDialog< + ( + FeeRateType, + String?, + String?, + )?>( + context: context, + builder: (_) => DesktopFeeDialog( + walletId: walletId, + ), + ); + + if (feeSelectionResult != null) { + if (isCustomFee && + feeSelectionResult!.$1 != FeeRateType.custom) { + isCustomFee = false; + } else if (!isCustomFee && + feeSelectionResult!.$1 == FeeRateType.custom) { + isCustomFee = true; + } + } + + setState(() {}); + }, + ), + ], + ), + child: Text( + "Transaction fee" + "${isCustomFee ? "" : " (${/*coin == Coin.ethereum ? "max" : */ "estimated"})"}", + style: STextStyles.desktopTextExtraSmall(context).copyWith( + color: Theme.of(context) + .extension()! + .textFieldActiveSearchIconRight, + ), + textAlign: TextAlign.left, + ), + ), + // if (!([Coin.nano, Coin.banano, Coin.epicCash].contains(coin))) + const SizedBox( + height: 10, + ), + // if (!([Coin.nano, Coin.banano, Coin.epicCash].contains(coin))) + if (!isCustomFee) + (feeSelectionResult?.$2 == null) + ? FutureBuilder( + future: ref.watch( + walletsChangeNotifierProvider.select( + (value) => value.getManager(walletId).fees, + ), + ), + builder: (context, snapshot) { + if (snapshot.connectionState == ConnectionState.done && + snapshot.hasData) { + return DesktopFeeItem( + feeObject: snapshot.data, + feeRateType: FeeRateType.average, + walletId: walletId, + feeFor: ({ + required Amount amount, + required FeeRateType feeRateType, + required int feeRate, + required Coin coin, + }) async { + if (ref + .read(feeSheetSessionCacheProvider) + .average[amount] == + null) { + final manager = ref + .read(walletsChangeNotifierProvider) + .getManager(walletId); + + if (coin == + Coin.monero /* || coin == Coin.wownero*/) { + final fee = await manager.estimateFeeFor(amount, + MoneroTransactionPriority.regular.raw!); + ref + .read(feeSheetSessionCacheProvider) + .average[amount] = fee; + // } else if ((coin == Coin.firo || + // coin == Coin.firoTestNet) && + // ref + // .read( + // publicPrivateBalanceStateProvider + // .state) + // .state != + // "Private") { + // ref + // .read(feeSheetSessionCacheProvider) + // .average[amount] = + // await (manager.wallet as FiroWallet) + // .estimateFeeForPublic(amount, feeRate); + } else { + ref + .read(feeSheetSessionCacheProvider) + .average[amount] = + await manager.estimateFeeFor(amount, feeRate); + } + } + return ref + .read(feeSheetSessionCacheProvider) + .average[amount]!; + }, + isSelected: true, + ); + } else { + return Row( + children: [ + AnimatedText( + stringsToLoopThrough: stringsToLoopThrough, + style: + STextStyles.desktopTextExtraExtraSmall(context) + .copyWith( + color: Theme.of(context) + .extension()! + .textFieldActiveText, + ), + ), + ], + ); + } + }, + ) + : Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + feeSelectionResult?.$2 ?? "", + style: STextStyles.desktopTextExtraExtraSmall(context) + .copyWith( + color: Theme.of(context) + .extension()! + .textFieldActiveText, + ), + textAlign: TextAlign.left, + ), + Text( + feeSelectionResult?.$3 ?? "", + style: STextStyles.desktopTextExtraExtraSmall(context) + .copyWith( + color: Theme.of(context) + .extension()! + .textFieldActiveSearchIconRight, + ), + ), + ], + ), + if (isCustomFee) + Padding( + padding: const EdgeInsets.only( + bottom: 12, + top: 16, + ), + child: FeeSlider( + onSatVByteChanged: (rate) { + customFeeRate = rate; + }, + ), + ), const SizedBox( height: 36, ), diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_features.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_features.dart index 7f1839987..a6db300ee 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_features.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_features.dart @@ -134,7 +134,12 @@ class _DesktopWalletFeaturesState extends ConsumerState { ); final showMore = manager.hasPaynymSupport || - manager.hasCoinControlSupport || + (manager.hasCoinControlSupport && + ref.watch( + prefsChangeNotifierProvider.select( + (value) => value.enableCoinControl, + ), + )) || manager.hasWhirlpoolSupport; return Row( diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_summary.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_summary.dart index 49b0e3068..3d02fcbcb 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_summary.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_summary.dart @@ -6,21 +6,23 @@ import 'package:stackduo/pages_desktop_specific/my_stack_view/wallet_view/sub_wi import 'package:stackduo/providers/providers.dart'; import 'package:stackduo/providers/wallet/wallet_balance_toggle_state_provider.dart'; import 'package:stackduo/services/event_bus/events/global/wallet_sync_status_changed_event.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/enums/wallet_balance_toggle_state.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; class DesktopWalletSummary extends ConsumerStatefulWidget { const DesktopWalletSummary({ Key? key, required this.walletId, required this.initialSyncStatus, + this.isToken = false, }) : super(key: key); final String walletId; final WalletSyncStatus initialSyncStatus; + final bool isToken; @override ConsumerState createState() => @@ -56,26 +58,59 @@ class _WDesktopWalletSummaryState extends ConsumerState { final baseCurrency = ref .watch(prefsChangeNotifierProvider.select((value) => value.currency)); - final priceTuple = ref.watch(priceAnd24hChangeNotifierProvider - .select((value) => value.getPrice(coin))); + final tokenContract = + // widget.isToken + // ? ref + // .watch(tokenServiceProvider.select((value) => value!.tokenContract)) + // : + null; + + final priceTuple = + // widget.isToken + // ? ref.watch(priceAnd24hChangeNotifierProvider + // .select((value) => value.getTokenPrice(tokenContract!.address))) + // : + ref.watch(priceAnd24hChangeNotifierProvider + .select((value) => value.getPrice(coin))); final _showAvailable = ref.watch(walletBalanceToggleStateProvider.state).state == WalletBalanceToggleState.available; - final unit = coin.ticker; - final decimalPlaces = coin.decimals; - - Balance balance = ref.watch(walletsChangeNotifierProvider - .select((value) => value.getManager(walletId).balance)); + Balance balance = + // widget.isToken + // ? ref.watch(tokenServiceProvider.select((value) => value!.balance)) + // : + ref.watch(walletsChangeNotifierProvider + .select((value) => value.getManager(walletId).balance)); Amount balanceToShow; - + // if (coin == Coin.firo || coin == Coin.firoTestNet) { + // Balance? balanceSecondary = ref + // .watch( + // walletsChangeNotifierProvider.select( + // (value) => + // value.getManager(widget.walletId).wallet as FiroWallet?, + // ), + // ) + // ?.balancePrivate; + // final showPrivate = + // ref.watch(walletPrivateBalanceToggleStateProvider.state).state == + // WalletBalanceToggleState.available; + // + // if (_showAvailable) { + // balanceToShow = + // showPrivate ? balanceSecondary!.spendable : balance.spendable; + // } else { + // balanceToShow = showPrivate ? balanceSecondary!.total : balance.total; + // } + // } else { if (_showAvailable) { balanceToShow = balance.spendable; } else { balanceToShow = balance.total; } + // } return Consumer( builder: (context, ref, __) { @@ -88,10 +123,9 @@ class _WDesktopWalletSummaryState extends ConsumerState { FittedBox( fit: BoxFit.scaleDown, child: Text( - "${balanceToShow.localizedStringAsFixed( - locale: locale, - decimalPlaces: decimalPlaces, - )} $unit", + ref + .watch(pAmountFormatter(coin)) + .format(balanceToShow, ethContract: tokenContract), style: STextStyles.desktopH3(context), ), ), @@ -100,9 +134,8 @@ class _WDesktopWalletSummaryState extends ConsumerState { "${Amount.fromDecimal( priceTuple.item1 * balanceToShow.decimal, fractionDigits: 2, - ).localizedStringAsFixed( + ).fiatString( locale: locale, - decimalPlaces: 2, )} $baseCurrency", style: STextStyles.desktopTextExtraSmall(context).copyWith( color: Theme.of(context) diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/my_wallet.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/my_wallet.dart index 325759e29..e4bff727e 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/my_wallet.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/my_wallet.dart @@ -1,7 +1,9 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:stackduo/pages/wallet_view/sub_widgets/transactions_list.dart'; import 'package:stackduo/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_receive.dart'; import 'package:stackduo/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_send.dart'; +import 'package:stackduo/providers/global/wallets_provider.dart'; import 'package:stackduo/widgets/custom_tab_view.dart'; import 'package:stackduo/widgets/rounded_white_container.dart'; @@ -9,9 +11,11 @@ class MyWallet extends ConsumerStatefulWidget { const MyWallet({ Key? key, required this.walletId, + this.contractAddress, }) : super(key: key); final String walletId; + final String? contractAddress; @override ConsumerState createState() => _MyWalletState(); @@ -27,7 +31,8 @@ class _MyWalletState extends ConsumerState { @override void initState() { - // isEth = ref + isEth = false; + //ref // .read(walletsChangeNotifierProvider) // .getManager(widget.walletId) // .coin == @@ -50,37 +55,47 @@ class _MyWalletState extends ConsumerState { child: CustomTabView( titles: titles, children: [ + // widget.contractAddress == null + // ? Padding( padding: const EdgeInsets.all(20), child: DesktopSend( walletId: widget.walletId, ), - ), + ) + // : Padding( + // padding: const EdgeInsets.all(20), + // child: DesktopTokenSend( + // walletId: widget.walletId, + // ), + // ) + , Padding( padding: const EdgeInsets.all(20), child: DesktopReceive( walletId: widget.walletId, + contractAddress: widget.contractAddress, ), ), - // if (isEth && widget.contractAddress == null) - // Padding( - // padding: const EdgeInsets.only(top: 8.0), - // child: ConstrainedBox( - // constraints: BoxConstraints( - // maxHeight: MediaQuery.of(context).size.height - 362, - // ), - // child: TransactionsList( - // walletId: widget.walletId, - // managerProvider: ref.watch( - // walletsChangeNotifierProvider.select( - // (value) => value.getManagerProvider( - // widget.walletId, - // ), - // ), - // ), - // ), - // ), - // ), + if (isEth && widget.contractAddress == null) + Padding( + padding: const EdgeInsets.only(top: 8.0), + child: ConstrainedBox( + constraints: BoxConstraints( + maxHeight: MediaQuery.of(context).size.height - 362, + ), + child: TransactionsList( + walletId: widget.walletId, + managerProvider: ref.watch( + walletsChangeNotifierProvider.select( + (value) => value.getManagerProvider( + widget.walletId, + ), + ), + ), + ), + ), + ), ], ), ), diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/qr_code_desktop_popup_content.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/qr_code_desktop_popup_content.dart index 8dadd748a..7c7ac6381 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/qr_code_desktop_popup_content.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/qr_code_desktop_popup_content.dart @@ -20,16 +20,16 @@ class QRCodeDesktopPopupContent extends StatelessWidget { maxWidth: 614, child: Column( children: [ - Row( + const Row( mainAxisAlignment: MainAxisAlignment.end, - children: const [ + children: [ DesktopDialogCloseButton(), ], ), const SizedBox( height: 14, ), - QrImage( + QrImageView( data: value, size: 300, foregroundColor: diff --git a/lib/pages_desktop_specific/password/delete_password_warning_view.dart b/lib/pages_desktop_specific/password/delete_password_warning_view.dart index 0e08f5e8f..7677165e5 100644 --- a/lib/pages_desktop_specific/password/delete_password_warning_view.dart +++ b/lib/pages_desktop_specific/password/delete_password_warning_view.dart @@ -5,7 +5,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:hive/hive.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:isar/isar.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/notifications/show_flush_bar.dart'; import 'package:stackduo/pages/intro_view.dart'; import 'package:stackduo/utilities/assets.dart'; @@ -42,7 +43,17 @@ class _ForgotPasswordDesktopViewState try { await Hive.close(); - if (Platform.isWindows || Platform.isLinux) { + if (Platform.isWindows) { + final xmrDir = Directory("${appRoot.path}/wallets"); + if (xmrDir.existsSync()) { + await xmrDir.delete(recursive: true); + } + + await Isar.getInstance("desktopStore")?.close(deleteFromDisk: true); + + await (await StackFileSystem.applicationHiveDirectory()) + .delete(recursive: true); + } else if (Platform.isLinux) { await appRoot.delete(recursive: true); } else { // macos in ipad mode diff --git a/lib/pages_desktop_specific/password/desktop_login_view.dart b/lib/pages_desktop_specific/password/desktop_login_view.dart index 5df99914c..c069c205a 100644 --- a/lib/pages_desktop_specific/password/desktop_login_view.dart +++ b/lib/pages_desktop_specific/password/desktop_login_view.dart @@ -3,7 +3,7 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/notifications/show_flush_bar.dart'; import 'package:stackduo/pages_desktop_specific/desktop_home_view.dart'; import 'package:stackduo/pages_desktop_specific/password/forgot_password_desktop_view.dart'; diff --git a/lib/pages_desktop_specific/password/forgotten_passphrase_restore_from_swb.dart b/lib/pages_desktop_specific/password/forgotten_passphrase_restore_from_swb.dart index bd08a438d..72e9f2081 100644 --- a/lib/pages_desktop_specific/password/forgotten_passphrase_restore_from_swb.dart +++ b/lib/pages_desktop_specific/password/forgotten_passphrase_restore_from_swb.dart @@ -6,7 +6,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:hive_flutter/hive_flutter.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/notifications/show_flush_bar.dart'; import 'package:stackduo/pages/settings_views/global_settings_view/stack_backup_views/helpers/restore_create_backup.dart'; import 'package:stackduo/pages/settings_views/global_settings_view/stack_backup_views/helpers/swb_file_system.dart'; diff --git a/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/stack_privacy_dialog.dart b/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/stack_privacy_dialog.dart index 9a2a1d1d4..dec46f390 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/stack_privacy_dialog.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/stack_privacy_dialog.dart @@ -4,7 +4,7 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/providers/global/prefs_provider.dart'; import 'package:stackduo/providers/global/price_provider.dart'; import 'package:stackduo/services/exchange/exchange_data_loading_service.dart'; diff --git a/lib/pages_desktop_specific/settings/settings_menu/appearance_settings/appearance_settings.dart b/lib/pages_desktop_specific/settings/settings_menu/appearance_settings/appearance_settings.dart index fe9c38aac..e8340f7c8 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/appearance_settings/appearance_settings.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/appearance_settings/appearance_settings.dart @@ -167,7 +167,7 @@ class ThemeToggle extends ConsumerStatefulWidget { class _ThemeToggle extends ConsumerState { late final StreamSubscription _subscription; - late int _current; + int _current = 0; List> installedThemeIdNames = []; diff --git a/lib/pages_desktop_specific/settings/settings_menu/backup_and_restore/create_auto_backup.dart b/lib/pages_desktop_specific/settings/settings_menu/backup_and_restore/create_auto_backup.dart index a9b1bfdd5..cf495d824 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/backup_and_restore/create_auto_backup.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/backup_and_restore/create_auto_backup.dart @@ -469,9 +469,7 @@ class _CreateAutoBackup extends ConsumerState { child: isDesktop ? DropdownButtonHideUnderline( child: DropdownButton2( - offset: const Offset(0, -10), isExpanded: true, - dropdownElevation: 0, value: _currentDropDownValue, items: [ ..._dropDownItems.map( @@ -516,32 +514,32 @@ class _CreateAutoBackup extends ConsumerState { }); } }, - icon: SvgPicture.asset( - Assets.svg.chevronDown, - width: 10, - height: 5, - color: Theme.of(context) - .extension()! - .textDark3, - ), - buttonPadding: const EdgeInsets.symmetric( - horizontal: 16, - vertical: 8, + iconStyleData: IconStyleData( + icon: SvgPicture.asset( + Assets.svg.chevronDown, + width: 10, + height: 5, + color: Theme.of(context) + .extension()! + .textDark3, + ), ), - buttonDecoration: BoxDecoration( - color: Theme.of(context) - .extension()! - .textFieldDefaultBG, - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, + dropdownStyleData: DropdownStyleData( + offset: const Offset(0, -10), + elevation: 0, + decoration: BoxDecoration( + color: Theme.of(context) + .extension()! + .textFieldDefaultBG, + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), ), ), - dropdownDecoration: BoxDecoration( - color: Theme.of(context) - .extension()! - .textFieldDefaultBG, - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, + menuItemStyleData: const MenuItemStyleData( + padding: EdgeInsets.symmetric( + horizontal: 16, + vertical: 8, ), ), ), diff --git a/lib/providers/db/main_db_provider.dart b/lib/providers/db/main_db_provider.dart index f447287e0..183615305 100644 --- a/lib/providers/db/main_db_provider.dart +++ b/lib/providers/db/main_db_provider.dart @@ -1,4 +1,4 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; final mainDBProvider = Provider((ref) => MainDB.instance); diff --git a/lib/providers/ui/add_wallet_selected_coin_provider.dart b/lib/providers/ui/add_wallet_selected_coin_provider.dart index 49d117c69..093207a5f 100644 --- a/lib/providers/ui/add_wallet_selected_coin_provider.dart +++ b/lib/providers/ui/add_wallet_selected_coin_provider.dart @@ -1,14 +1,5 @@ -import 'package:flutter/foundation.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; +import 'package:stackduo/models/add_wallet_list_entity/add_wallet_list_entity.dart'; -int _count = 0; - -final addWalletSelectedCoinStateProvider = - StateProvider.autoDispose((_) { - if (kDebugMode) { - _count++; - } - - return null; -}); +final addWalletSelectedEntityStateProvider = + StateProvider.autoDispose((_) => null); diff --git a/lib/route_generator.dart b/lib/route_generator.dart index b9ff2d771..99adf7358 100644 --- a/lib/route_generator.dart +++ b/lib/route_generator.dart @@ -2,6 +2,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:isar/isar.dart'; +import 'package:stackduo/models/add_wallet_list_entity/add_wallet_list_entity.dart'; import 'package:stackduo/models/exchange/incomplete_exchange.dart'; import 'package:stackduo/models/exchange/response_objects/trade.dart'; import 'package:stackduo/models/isar/models/contact_entry.dart'; @@ -53,6 +54,8 @@ import 'package:stackduo/pages/send_view/send_view.dart'; import 'package:stackduo/pages/settings_views/global_settings_view/about_view.dart'; import 'package:stackduo/pages/settings_views/global_settings_view/advanced_views/advanced_settings_view.dart'; import 'package:stackduo/pages/settings_views/global_settings_view/advanced_views/debug_view.dart'; +import 'package:stackduo/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/edit_coin_units_view.dart'; +import 'package:stackduo/pages/settings_views/global_settings_view/advanced_views/manage_coin_units/manage_coin_units_view.dart'; import 'package:stackduo/pages/settings_views/global_settings_view/advanced_views/manage_explorer_view.dart'; import 'package:stackduo/pages/settings_views/global_settings_view/appearance_settings/appearance_settings_view.dart'; import 'package:stackduo/pages/settings_views/global_settings_view/appearance_settings/manage_themes.dart'; @@ -138,6 +141,11 @@ import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/widgets/choose_coin_view.dart'; import 'package:tuple/tuple.dart'; +/* + * This file contains all the routes for the app. + * To add a new route, add it to the switch statement in the generateRoute method. + */ + class RouteGenerator { static const bool useMaterialPageRoute = true; @@ -194,18 +202,6 @@ class RouteGenerator { builder: (_) => const StackPrivacyCalls(isSettings: false), settings: RouteSettings(name: settings.name)); - case WalletsView.routeName: - return getRoute( - shouldUseMaterialRoute: useMaterialPageRoute, - builder: (_) => const WalletsView(), - settings: RouteSettings(name: settings.name)); - - case AddWalletView.routeName: - return getRoute( - shouldUseMaterialRoute: useMaterialPageRoute, - builder: (_) => const AddWalletView(), - settings: RouteSettings(name: settings.name)); - case ChooseCoinView.routeName: if (args is Tuple3) { return getRoute( @@ -236,6 +232,18 @@ class RouteGenerator { } return _routeError("${settings.name} invalid args: ${args.toString()}"); + case WalletsView.routeName: + return getRoute( + shouldUseMaterialRoute: useMaterialPageRoute, + builder: (_) => const WalletsView(), + settings: RouteSettings(name: settings.name)); + + case AddWalletView.routeName: + return getRoute( + shouldUseMaterialRoute: useMaterialPageRoute, + builder: (_) => const AddWalletView(), + settings: RouteSettings(name: settings.name)); + case WalletsOverview.routeName: if (args is Coin) { return getRoute( @@ -534,6 +542,26 @@ class RouteGenerator { } return _routeError("${settings.name} invalid args: ${args.toString()}"); + case ManageCoinUnitsView.routeName: + return getRoute( + shouldUseMaterialRoute: useMaterialPageRoute, + builder: (_) => const ManageCoinUnitsView(), + settings: RouteSettings(name: settings.name)); + + case EditCoinUnitsView.routeName: + if (args is Coin) { + return getRoute( + shouldUseMaterialRoute: useMaterialPageRoute, + builder: (_) => EditCoinUnitsView( + coin: args, + ), + settings: RouteSettings( + name: settings.name, + ), + ); + } + return _routeError("${settings.name} invalid args: ${args.toString()}"); + case CreateBackupInfoView.routeName: return getRoute( shouldUseMaterialRoute: useMaterialPageRoute, @@ -784,11 +812,11 @@ class RouteGenerator { return _routeError("${settings.name} invalid args: ${args.toString()}"); case CreateOrRestoreWalletView.routeName: - if (args is Coin) { + if (args is AddWalletListEntity) { return getRoute( shouldUseMaterialRoute: useMaterialPageRoute, builder: (_) => CreateOrRestoreWalletView( - coin: args, + entity: args, ), settings: RouteSettings( name: settings.name, @@ -954,12 +982,11 @@ class RouteGenerator { return _routeError("${settings.name} invalid args: ${args.toString()}"); case ReceiveView.routeName: - if (args is Tuple2) { + if (args is String) { return getRoute( shouldUseMaterialRoute: useMaterialPageRoute, builder: (_) => ReceiveView( - walletId: args.item1, - coin: args.item2, + walletId: args, ), settings: RouteSettings( name: settings.name, diff --git a/lib/services/address_book_service.dart b/lib/services/address_book_service.dart index 91dfa08d4..96e33a7cf 100644 --- a/lib/services/address_book_service.dart +++ b/lib/services/address_book_service.dart @@ -1,6 +1,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/contact_entry.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; diff --git a/lib/services/coins/bitcoin/bitcoin_wallet.dart b/lib/services/coins/bitcoin/bitcoin_wallet.dart index 0fa906a9e..55e7634c8 100644 --- a/lib/services/coins/bitcoin/bitcoin_wallet.dart +++ b/lib/services/coins/bitcoin/bitcoin_wallet.dart @@ -11,7 +11,7 @@ import 'package:bs58check/bs58check.dart' as bs58check; import 'package:decimal/decimal.dart'; import 'package:flutter/foundation.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/electrumx_rpc/cached_electrumx.dart'; import 'package:stackduo/electrumx_rpc/electrumx.dart'; import 'package:stackduo/exceptions/electrumx/no_such_transaction.dart'; @@ -277,8 +277,8 @@ class BitcoinWallet extends CoinServiceAPI @override Future get maxFee async { final fee = (await fees).fast as String; - final satsFee = - Decimal.parse(fee) * Decimal.fromInt(Constants.satsPerCoin(coin)); + final satsFee = Decimal.parse(fee) * + Decimal.fromInt(Constants.satsPerCoin(coin).toInt()); return satsFee.floor().toBigInt().toInt(); } @@ -1060,9 +1060,60 @@ class BitcoinWallet extends CoinServiceAPI }) async { try { final feeRateType = args?["feeRate"]; + final customSatsPerVByte = args?["satsPerVByte"] as int?; final feeRateAmount = args?["feeRateAmount"]; final utxos = args?["UTXOs"] as Set?; - if (feeRateType is FeeRateType || feeRateAmount is int) { + + if (customSatsPerVByte != null) { + // check for send all + bool isSendAll = false; + if (amount == balance.spendable) { + isSendAll = true; + } + + final bool coinControl = utxos != null; + + final result = await coinSelection( + satoshiAmountToSend: amount.raw.toInt(), + selectedTxFeeRate: -1, + satsPerVByte: customSatsPerVByte, + recipientAddress: address, + isSendAll: isSendAll, + utxos: utxos?.toList(), + coinControl: coinControl, + ); + + Logging.instance + .log("PREPARE SEND RESULT: $result", level: LogLevel.Info); + if (result is int) { + switch (result) { + case 1: + throw Exception("Insufficient balance!"); + case 2: + throw Exception("Insufficient funds to pay for transaction fee!"); + default: + throw Exception("Transaction failed with error code $result"); + } + } else { + final hex = result["hex"]; + if (hex is String) { + final fee = result["fee"] as int; + final vSize = result["vSize"] as int; + + Logging.instance.log("txHex: $hex", level: LogLevel.Info); + Logging.instance.log("fee: $fee", level: LogLevel.Info); + Logging.instance.log("vsize: $vSize", level: LogLevel.Info); + // fee should never be less than vSize sanity check + if (fee < vSize) { + throw Exception( + "Error in fee calculation: Transaction fee cannot be less than vSize"); + } + return result as Map; + } else { + throw Exception("sent hex is not a String!!!"); + } + } + } else if (feeRateType is FeeRateType || feeRateAmount is int) { late final int rate; if (feeRateType is FeeRateType) { int fee = 0; @@ -1077,6 +1128,8 @@ class BitcoinWallet extends CoinServiceAPI case FeeRateType.slow: fee = feeObject.slow; break; + default: + throw ArgumentError("Invalid use of custom fee"); } rate = fee; } else { @@ -1293,6 +1346,7 @@ class BitcoinWallet extends CoinServiceAPI nonce: null, inputs: [], outputs: [], + numberOfMessages: null, ); final address = txData["address"] is String @@ -2190,6 +2244,7 @@ class BitcoinWallet extends CoinServiceAPI required String recipientAddress, required bool coinControl, required bool isSendAll, + int? satsPerVByte, int additionalOutputs = 0, List? utxos, }) async { @@ -2297,18 +2352,22 @@ class BitcoinWallet extends CoinServiceAPI recipients: [recipientAddress], satoshiAmounts: [satoshisBeingUsed - 1], ))["vSize"] as int; - int feeForOneOutput = estimateTxFee( - vSize: vSizeForOneOutput, - feeRatePerKB: selectedTxFeeRate, - ); + int feeForOneOutput = satsPerVByte != null + ? (satsPerVByte * vSizeForOneOutput) + : estimateTxFee( + vSize: vSizeForOneOutput, + feeRatePerKB: selectedTxFeeRate, + ); - final int roughEstimate = roughFeeEstimate( - spendableOutputs.length, - 1, - selectedTxFeeRate, - ).raw.toInt(); - if (feeForOneOutput < roughEstimate) { - feeForOneOutput = roughEstimate; + if (satsPerVByte == null) { + final int roughEstimate = roughFeeEstimate( + spendableOutputs.length, + 1, + selectedTxFeeRate, + ).raw.toInt(); + if (feeForOneOutput < roughEstimate) { + feeForOneOutput = roughEstimate; + } } final int amount = satoshiAmountToSend - feeForOneOutput; @@ -2362,15 +2421,19 @@ class BitcoinWallet extends CoinServiceAPI } // Assume 1 output, only for recipient and no change - final feeForOneOutput = estimateTxFee( - vSize: vSizeForOneOutput, - feeRatePerKB: selectedTxFeeRate, - ); + final feeForOneOutput = satsPerVByte != null + ? (satsPerVByte * vSizeForOneOutput) + : estimateTxFee( + vSize: vSizeForOneOutput, + feeRatePerKB: selectedTxFeeRate, + ); // Assume 2 outputs, one for recipient and one for change - final feeForTwoOutputs = estimateTxFee( - vSize: vSizeForTwoOutPuts, - feeRatePerKB: selectedTxFeeRate, - ); + final feeForTwoOutputs = satsPerVByte != null + ? (satsPerVByte * vSizeForTwoOutPuts) + : estimateTxFee( + vSize: vSizeForTwoOutPuts, + feeRatePerKB: selectedTxFeeRate, + ); Logging.instance .log("feeForTwoOutputs: $feeForTwoOutputs", level: LogLevel.Info); @@ -2565,6 +2628,7 @@ class BitcoinWallet extends CoinServiceAPI return coinSelection( satoshiAmountToSend: satoshiAmountToSend, selectedTxFeeRate: selectedTxFeeRate, + satsPerVByte: satsPerVByte, recipientAddress: recipientAddress, isSendAll: isSendAll, additionalOutputs: additionalOutputs + 1, diff --git a/lib/services/coins/manager.dart b/lib/services/coins/manager.dart index 932ac9ddb..94dfe5577 100644 --- a/lib/services/coins/manager.dart +++ b/lib/services/coins/manager.dart @@ -2,7 +2,7 @@ import 'dart:async'; import 'package:event_bus/event_bus.dart'; import 'package:flutter/material.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/models/balance.dart'; import 'package:stackduo/models/isar/models/isar_models.dart' as isar_models; import 'package:stackduo/models/models.dart'; @@ -234,6 +234,8 @@ class Manager with ChangeNotifier { bool get hasCoinControlSupport => _currentWallet is CoinControlInterface; + bool get hasTokenSupport => false; + bool get hasWhirlpoolSupport => false; int get rescanOnOpenVersion => diff --git a/lib/services/coins/monero/monero_wallet.dart b/lib/services/coins/monero/monero_wallet.dart index d58ea882a..947c3958d 100644 --- a/lib/services/coins/monero/monero_wallet.dart +++ b/lib/services/coins/monero/monero_wallet.dart @@ -23,8 +23,8 @@ import 'package:flutter_libmonero/monero/monero.dart'; import 'package:flutter_libmonero/view_model/send/output.dart' as monero_output; import 'package:isar/isar.dart'; import 'package:mutex/mutex.dart'; -import 'package:stackduo/db/main_db.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/models/balance.dart'; import 'package:stackduo/models/isar/models/isar_models.dart' as isar_models; import 'package:stackduo/models/node_model.dart'; @@ -448,6 +448,8 @@ class MoneroWallet extends CoinServiceAPI with WalletCache, WalletDB { case FeeRateType.slow: feePriority = MoneroTransactionPriority.slow; break; + default: + throw ArgumentError("Invalid use of custom fee"); } Future? awaitPendingTransaction; @@ -854,6 +856,10 @@ class MoneroWallet extends CoinServiceAPI with WalletCache, WalletDB { // String address = walletBase!.getTransactionAddress(chain, index); + if (address.contains("111")) { + return await _generateAddressForChain(chain, index + 1); + } + return isar_models.Address( walletId: walletId, derivationIndex: index, @@ -954,6 +960,7 @@ class MoneroWallet extends CoinServiceAPI with WalletCache, WalletDB { nonce: null, inputs: [], outputs: [], + numberOfMessages: null, ); txnsData.add(Tuple2(txn, address)); diff --git a/lib/services/debug_service.dart b/lib/services/debug_service.dart index 3909cd541..295403d55 100644 --- a/lib/services/debug_service.dart +++ b/lib/services/debug_service.dart @@ -34,7 +34,7 @@ class DebugService extends ChangeNotifier { // }); } - List get recentLogs => isar.logs.where().limit(200).findAllSync(); + List get recentLogs => isar.logs.where().sortByTimestampInMillisUTCDesc().limit(100).findAllSync(); // Future updateRecentLogs() async { // int totalCount = await isar.logs.count(); diff --git a/lib/services/exchange/change_now/change_now_api.dart b/lib/services/exchange/change_now/change_now_api.dart index f6246d30c..d3dd088f9 100644 --- a/lib/services/exchange/change_now/change_now_api.dart +++ b/lib/services/exchange/change_now/change_now_api.dart @@ -201,6 +201,89 @@ class ChangeNowAPI { } } + Future>> getCurrenciesV2( + // { + // bool? fixedRate, + // bool? active, + // } + ) async { + Map? params; + + // if (active != null || fixedRate != null) { + // params = {}; + // if (fixedRate != null) { + // params.addAll({"fixedRate": fixedRate.toString()}); + // } + // if (active != null) { + // params.addAll({"active": active.toString()}); + // } + // } + + final uri = _buildUriV2("/exchange/currencies", params); + + try { + // json array is expected here + final jsonArray = await _makeGetRequest(uri); + + try { + final result = await compute( + _parseV2CurrenciesJson, + jsonArray as List, + ); + return result; + } catch (e, s) { + Logging.instance.log("getAvailableCurrencies exception: $e\n$s", + level: LogLevel.Error); + return ExchangeResponse( + exception: ExchangeException( + "Error: $jsonArray", + ExchangeExceptionType.serializeResponseError, + ), + ); + } + } catch (e, s) { + Logging.instance.log("getAvailableCurrencies exception: $e\n$s", + level: LogLevel.Error); + return ExchangeResponse( + exception: ExchangeException( + e.toString(), + ExchangeExceptionType.generic, + ), + ); + } + } + + ExchangeResponse> _parseV2CurrenciesJson( + List args, + ) { + try { + List currencies = []; + + for (final json in args) { + try { + final map = Map.from(json as Map); + currencies.add( + Currency.fromJson( + map, + rateType: (map["supportsFixedRate"] as bool) + ? SupportedRateType.both + : SupportedRateType.estimated, + exchangeName: ChangeNowExchange.exchangeName, + ), + ); + } catch (_) { + return ExchangeResponse( + exception: ExchangeException("Failed to serialize $json", + ExchangeExceptionType.serializeResponseError)); + } + } + + return ExchangeResponse(value: currencies); + } catch (_) { + rethrow; + } + } + /// This API endpoint returns the array of markets available for the specified currency be default. /// The availability of a particular pair is determined by the 'isAvailable' field. /// diff --git a/lib/services/exchange/change_now/change_now_exchange.dart b/lib/services/exchange/change_now/change_now_exchange.dart index 391851a40..4dc52e830 100644 --- a/lib/services/exchange/change_now/change_now_exchange.dart +++ b/lib/services/exchange/change_now/change_now_exchange.dart @@ -82,10 +82,11 @@ class ChangeNowExchange extends Exchange { Future>> getAllCurrencies( bool fixedRate, ) async { - return await ChangeNowAPI.instance.getAvailableCurrencies( - fixedRate: fixedRate ? true : null, - active: true, - ); + return await ChangeNowAPI.instance.getCurrenciesV2(); + // return await ChangeNowAPI.instance.getAvailableCurrencies( + // fixedRate: fixedRate ? true : null, + // active: true, + // ); } @override diff --git a/lib/services/exchange/exchange_data_loading_service.dart b/lib/services/exchange/exchange_data_loading_service.dart index 62edcadf1..7a9ac144b 100644 --- a/lib/services/exchange/exchange_data_loading_service.dart +++ b/lib/services/exchange/exchange_data_loading_service.dart @@ -1,6 +1,6 @@ import 'package:flutter/foundation.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/models/exchange/active_pair.dart'; import 'package:stackduo/models/exchange/aggregate_currency.dart'; import 'package:stackduo/models/isar/exchange_cache/currency.dart'; diff --git a/lib/services/mixins/coin_control_interface.dart b/lib/services/mixins/coin_control_interface.dart index dd0a99194..c4f25e2ab 100644 --- a/lib/services/mixins/coin_control_interface.dart +++ b/lib/services/mixins/coin_control_interface.dart @@ -1,7 +1,7 @@ import 'dart:async'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/balance.dart'; import 'package:stackduo/services/event_bus/events/global/balance_refreshed_event.dart'; import 'package:stackduo/services/event_bus/global_event_bus.dart'; diff --git a/lib/services/mixins/electrum_x_parsing.dart b/lib/services/mixins/electrum_x_parsing.dart index 0865cb8ee..31bb51b24 100644 --- a/lib/services/mixins/electrum_x_parsing.dart +++ b/lib/services/mixins/electrum_x_parsing.dart @@ -258,6 +258,7 @@ mixin ElectrumXParsing { nonce: null, inputs: ins, outputs: outs, + numberOfMessages: null, ); return Tuple2(tx, transactionAddress); diff --git a/lib/services/mixins/paynym_wallet_interface.dart b/lib/services/mixins/paynym_wallet_interface.dart index bb09e2622..179a55388 100644 --- a/lib/services/mixins/paynym_wallet_interface.dart +++ b/lib/services/mixins/paynym_wallet_interface.dart @@ -10,7 +10,7 @@ import 'package:bitcoindart/src/utils/constants/op.dart' as op; import 'package:bitcoindart/src/utils/script.dart' as bscript; import 'package:isar/isar.dart'; import 'package:pointycastle/digests/sha256.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/electrumx_rpc/electrumx.dart'; import 'package:stackduo/exceptions/wallet/insufficient_balance_exception.dart'; import 'package:stackduo/exceptions/wallet/paynym_send_exception.dart'; diff --git a/lib/services/mixins/wallet_cache.dart b/lib/services/mixins/wallet_cache.dart index da18230cd..9ad5a7eb5 100644 --- a/lib/services/mixins/wallet_cache.dart +++ b/lib/services/mixins/wallet_cache.dart @@ -1,4 +1,4 @@ -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/models/balance.dart'; import 'package:stackduo/utilities/amount/amount.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; diff --git a/lib/services/mixins/wallet_db.dart b/lib/services/mixins/wallet_db.dart index 5958521a7..4b4ba4b52 100644 --- a/lib/services/mixins/wallet_db.dart +++ b/lib/services/mixins/wallet_db.dart @@ -1,4 +1,4 @@ -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; mixin WalletDB { MainDB? _db; diff --git a/lib/services/node_service.dart b/lib/services/node_service.dart index fccc0de69..779ccba56 100644 --- a/lib/services/node_service.dart +++ b/lib/services/node_service.dart @@ -2,7 +2,7 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:http/http.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/models/node_model.dart'; import 'package:stackduo/utilities/default_nodes.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; diff --git a/lib/services/notes_service.dart b/lib/services/notes_service.dart index caeaf2370..d93749293 100644 --- a/lib/services/notes_service.dart +++ b/lib/services/notes_service.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/utilities/logger.dart'; class NotesService extends ChangeNotifier { diff --git a/lib/services/notifications_service.dart b/lib/services/notifications_service.dart index dc54d42fd..c60b8d79a 100644 --- a/lib/services/notifications_service.dart +++ b/lib/services/notifications_service.dart @@ -3,7 +3,7 @@ import 'dart:async'; import 'package:flutter/foundation.dart'; import 'package:stackduo/electrumx_rpc/electrumx.dart'; import 'package:stackduo/exceptions/electrumx/no_such_transaction.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/models/exchange/response_objects/trade.dart'; import 'package:stackduo/models/notification_model.dart'; import 'package:stackduo/services/exchange/exchange.dart'; diff --git a/lib/services/price.dart b/lib/services/price.dart index 3319d55db..ce4c475de 100644 --- a/lib/services/price.dart +++ b/lib/services/price.dart @@ -4,7 +4,7 @@ import 'dart:convert'; import 'package:decimal/decimal.dart'; import 'package:flutter/foundation.dart'; import 'package:http/http.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/logger.dart'; import 'package:stackduo/utilities/prefs.dart'; diff --git a/lib/services/trade_notes_service.dart b/lib/services/trade_notes_service.dart index c42e6b4d1..8e02b7528 100644 --- a/lib/services/trade_notes_service.dart +++ b/lib/services/trade_notes_service.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; class TradeNotesService extends ChangeNotifier { Map get all { diff --git a/lib/services/trade_sent_from_stack_service.dart b/lib/services/trade_sent_from_stack_service.dart index 3d796741c..6824f3977 100644 --- a/lib/services/trade_sent_from_stack_service.dart +++ b/lib/services/trade_sent_from_stack_service.dart @@ -1,5 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/models/trade_wallet_lookup.dart'; class TradeSentFromStackService extends ChangeNotifier { diff --git a/lib/services/trade_service.dart b/lib/services/trade_service.dart index 2b13b0105..aa749f63e 100644 --- a/lib/services/trade_service.dart +++ b/lib/services/trade_service.dart @@ -1,5 +1,5 @@ import 'package:flutter/cupertino.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/models/exchange/response_objects/trade.dart'; class TradesService extends ChangeNotifier { diff --git a/lib/services/transaction_notification_tracker.dart b/lib/services/transaction_notification_tracker.dart index 5de3777a5..4e4f2acaa 100644 --- a/lib/services/transaction_notification_tracker.dart +++ b/lib/services/transaction_notification_tracker.dart @@ -1,4 +1,4 @@ -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; class TransactionNotificationTracker { final String walletId; diff --git a/lib/services/wallets.dart b/lib/services/wallets.dart index 7d009f061..a254997ea 100644 --- a/lib/services/wallets.dart +++ b/lib/services/wallets.dart @@ -1,6 +1,6 @@ import 'package:flutter/foundation.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/models/node_model.dart'; import 'package:stackduo/services/coins/coin_service.dart'; import 'package:stackduo/services/coins/manager.dart'; diff --git a/lib/services/wallets_service.dart b/lib/services/wallets_service.dart index 3024ea284..43d182270 100644 --- a/lib/services/wallets_service.dart +++ b/lib/services/wallets_service.dart @@ -2,8 +2,8 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:flutter_libmonero/monero/monero.dart'; -import 'package:stackduo/db/main_db.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/services/notifications_service.dart'; import 'package:stackduo/services/trade_sent_from_stack_service.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; diff --git a/lib/themes/coin_card_provider.dart b/lib/themes/coin_card_provider.dart new file mode 100644 index 000000000..fae5b7d34 --- /dev/null +++ b/lib/themes/coin_card_provider.dart @@ -0,0 +1,24 @@ +/* + * This file is part of Stack Wallet. + * + * Copyright (c) 2023 Cypher Stack + * All Rights Reserved. + * The code is distributed under GPLv3 license, see LICENSE file for details. + * Generated by Cypher Stack on 2023-05-26 + * + */ + +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:stackduo/models/isar/stack_theme.dart'; +import 'package:stackduo/themes/theme_providers.dart'; +import 'package:stackduo/utilities/enums/coin_enum.dart'; + +final coinCardProvider = Provider.family((ref, coin) { + final assets = ref.watch(themeAssetsProvider); + + if (assets is ThemeAssetsV3) { + return assets.coinCardImages?[coin.mainNetVersion]; + } else { + return null; + } +}); diff --git a/lib/themes/coin_icon_provider.dart b/lib/themes/coin_icon_provider.dart index 6af8cfc1e..c1d83d627 100644 --- a/lib/themes/coin_icon_provider.dart +++ b/lib/themes/coin_icon_provider.dart @@ -14,7 +14,9 @@ final coinIconProvider = Provider.family((ref, coin) { case Coin.monero: return assets.monero; } + } else if (assets is ThemeAssetsV2) { + return (assets).coinIcons[coin.mainNetVersion]!; } else { - return (assets as ThemeAssetsV2).coinIcons[coin.mainNetVersion]!; + return (assets as ThemeAssetsV3).coinIcons[coin.mainNetVersion]!; } }); diff --git a/lib/themes/coin_image_provider.dart b/lib/themes/coin_image_provider.dart index ca4a19698..3761aab37 100644 --- a/lib/themes/coin_image_provider.dart +++ b/lib/themes/coin_image_provider.dart @@ -15,8 +15,10 @@ final coinImageProvider = Provider.family((ref, coin) { case Coin.monero: return assets.moneroImage; } + } else if (assets is ThemeAssetsV2) { + return (assets).coinImages[coin.mainNetVersion]!; } else { - return (assets as ThemeAssetsV2).coinImages[coin.mainNetVersion]!; + return (assets as ThemeAssetsV3).coinImages[coin.mainNetVersion]!; } }); @@ -31,8 +33,13 @@ final coinImageSecondaryProvider = Provider.family((ref, coin) { case Coin.monero: return assets.moneroImageSecondary; + + default: + return assets.stackIcon; } + } else if (assets is ThemeAssetsV2) { + return (assets).coinSecondaryImages[coin.mainNetVersion]!; } else { - return (assets as ThemeAssetsV2).coinSecondaryImages[coin.mainNetVersion]!; + return (assets as ThemeAssetsV3).coinSecondaryImages[coin.mainNetVersion]!; } }); diff --git a/lib/themes/theme_service.dart b/lib/themes/theme_service.dart index db5b851e1..ad72e491a 100644 --- a/lib/themes/theme_service.dart +++ b/lib/themes/theme_service.dart @@ -7,7 +7,7 @@ import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:http/http.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/stack_theme.dart'; import 'package:stackduo/utilities/logger.dart'; import 'package:stackduo/utilities/stack_file_system.dart'; diff --git a/lib/utilities/amount/amount.dart b/lib/utilities/amount/amount.dart index 30619bb0d..198b1c5f0 100644 --- a/lib/utilities/amount/amount.dart +++ b/lib/utilities/amount/amount.dart @@ -22,6 +22,39 @@ class Amount { : assert(fractionDigits >= 0), _value = amount.shift(fractionDigits).toBigInt(); + static Amount? tryParseFiatString( + String value, { + required String locale, + }) { + final parts = value.split(" "); + + if (parts.first.isEmpty) { + return null; + } + + String str = parts.first; + if (str.startsWith(RegExp(r'[+-]'))) { + str = str.substring(1); + } + + if (str.isEmpty) { + return null; + } + + // get number symbols for decimal place and group separator + final numberSymbols = numberFormatSymbols[locale] as NumberSymbols? ?? + numberFormatSymbols[locale.substring(0, 2)] as NumberSymbols?; + + final groupSeparator = numberSymbols?.GROUP_SEP ?? ","; + final decimalSeparator = numberSymbols?.DECIMAL_SEP ?? "."; + + str = str.replaceAll(groupSeparator, ""); + + final decimalString = str.replaceFirst(decimalSeparator, "."); + + return Decimal.tryParse(decimalString)?.toAmount(fractionDigits: 2); + } + // =========================================================================== // ======= Instance properties =============================================== @@ -52,29 +85,52 @@ class Amount { return jsonEncode(toMap()); } - String localizedStringAsFixed({ + String fiatString({ required String locale, - int? decimalPlaces, }) { - decimalPlaces ??= fractionDigits; - assert(decimalPlaces >= 0); - final wholeNumber = decimal.truncate(); - if (decimalPlaces == 0) { - return wholeNumber.toStringAsFixed(0); - } + // get number symbols for decimal place and group separator + final numberSymbols = numberFormatSymbols[locale] as NumberSymbols? ?? + numberFormatSymbols[locale.substring(0, 2)] as NumberSymbols?; - final String separator = - (numberFormatSymbols[locale] as NumberSymbols?)?.DECIMAL_SEP ?? - (numberFormatSymbols[locale.substring(0, 2)] as NumberSymbols?) - ?.DECIMAL_SEP ?? - "."; + final String separator = numberSymbols?.DECIMAL_SEP ?? "."; final fraction = decimal - wholeNumber; - return "${wholeNumber.toStringAsFixed(0)}$separator${fraction.toStringAsFixed(decimalPlaces).substring(2)}"; + String wholeNumberString = wholeNumber.toStringAsFixed(0); + // insert group separator + final regex = RegExp(r'\B(?=(\d{3})+(?!\d))'); + wholeNumberString = wholeNumberString.replaceAllMapped( + regex, + (m) => "${m.group(0)}${numberSymbols?.GROUP_SEP ?? ","}", + ); + + return "$wholeNumberString$separator${fraction.toStringAsFixed(2).substring(2)}"; } + // String localizedStringAsFixed({ + // required String locale, + // int? decimalPlaces, + // }) { + // decimalPlaces ??= fractionDigits; + // assert(decimalPlaces >= 0); + // + // final wholeNumber = decimal.truncate(); + // + // if (decimalPlaces == 0) { + // return wholeNumber.toStringAsFixed(0); + // } + // + // final String separator = + // (numberFormatSymbols[locale] as NumberSymbols?)?.DECIMAL_SEP ?? + // (numberFormatSymbols[locale.substring(0, 2)] as NumberSymbols?) + // ?.DECIMAL_SEP ?? + // "."; + // + // final fraction = decimal - wholeNumber; + // + // return "${wholeNumber.toStringAsFixed(0)}$separator${fraction.toStringAsFixed(decimalPlaces).substring(2)}"; + // } // =========================================================================== // ======= Deserialization =================================================== diff --git a/lib/utilities/amount/amount_formatter.dart b/lib/utilities/amount/amount_formatter.dart new file mode 100644 index 000000000..db119c537 --- /dev/null +++ b/lib/utilities/amount/amount_formatter.dart @@ -0,0 +1,72 @@ +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:stackduo/providers/global/locale_provider.dart'; +import 'package:stackduo/providers/global/prefs_provider.dart'; +import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_unit.dart'; +import 'package:stackduo/utilities/enums/coin_enum.dart'; + +final pAmountUnit = Provider.family( + (ref, coin) => ref.watch( + prefsChangeNotifierProvider.select( + (value) => value.amountUnit(coin), + ), + ), +); +final pMaxDecimals = Provider.family( + (ref, coin) => ref.watch( + prefsChangeNotifierProvider.select( + (value) => value.maxDecimals(coin), + ), + ), +); + +final pAmountFormatter = Provider.family((ref, coin) { + return AmountFormatter( + unit: ref.watch(pAmountUnit(coin)), + locale: ref.watch( + localeServiceChangeNotifierProvider.select((value) => value.locale), + ), + coin: coin, + maxDecimals: ref.watch(pMaxDecimals(coin)), + ); +}); + +class AmountFormatter { + final AmountUnit unit; + final String locale; + final Coin coin; + final int maxDecimals; + + AmountFormatter({ + required this.unit, + required this.locale, + required this.coin, + required this.maxDecimals, + }); + + String format( + Amount amount, { + String? overrideUnit, + dynamic ethContract, + bool withUnitName = true, + bool indicatePrecisionLoss = true, + }) { + return unit.displayAmount( + amount: amount, + locale: locale, + coin: coin, + maxDecimalPlaces: maxDecimals, + withUnitName: withUnitName, + indicatePrecisionLoss: indicatePrecisionLoss, + overrideUnit: overrideUnit, + tokenContract: ethContract, + ); + } + + Amount? tryParse( + String string, { + dynamic ethContract, + }) { + return unit.tryParse(string, locale: locale, coin: coin); + } +} diff --git a/lib/utilities/amount/amount_input_formatter.dart b/lib/utilities/amount/amount_input_formatter.dart new file mode 100644 index 000000000..99c55e387 --- /dev/null +++ b/lib/utilities/amount/amount_input_formatter.dart @@ -0,0 +1,93 @@ +import 'dart:math'; + +import 'package:flutter/services.dart'; +import 'package:intl/number_symbols.dart'; +import 'package:intl/number_symbols_data.dart'; +import 'package:stackduo/utilities/amount/amount_unit.dart'; + +class AmountInputFormatter extends TextInputFormatter { + final int decimals; + final String locale; + final AmountUnit? unit; + + AmountInputFormatter({ + required this.decimals, + required this.locale, + this.unit, + }); + + @override + TextEditingValue formatEditUpdate( + TextEditingValue oldValue, TextEditingValue newValue) { + // get number symbols for decimal place and group separator + final numberSymbols = numberFormatSymbols[locale] as NumberSymbols? ?? + numberFormatSymbols[locale.substring(0, 2)] as NumberSymbols?; + + final decimalSeparator = numberSymbols?.DECIMAL_SEP ?? "."; + final groupSeparator = numberSymbols?.GROUP_SEP ?? ","; + + String newText = newValue.text.replaceAll(groupSeparator, ""); + + final selectionIndexFromTheRight = + newValue.text.length - newValue.selection.end; + + String? fraction; + if (newText.contains(decimalSeparator)) { + final parts = newText.split(decimalSeparator); + + if (parts.length > 2) { + return oldValue; + } + if (newText.startsWith(decimalSeparator)) { + return TextEditingValue( + text: newText, + selection: TextSelection.collapsed( + offset: newText.length - selectionIndexFromTheRight, + ), + ); + } + + newText = parts.first; + if (parts.length == 2) { + fraction = parts.last; + } else { + fraction = ""; + } + + final fractionDigits = + unit == null ? decimals : max(decimals - unit!.shift, 0); + + if (fraction.length > fractionDigits) { + return oldValue; + } + } + + if (newText.trim() == '' || newText.trim() == '0') { + return newValue.copyWith(text: ''); + } else if (BigInt.parse(newText) < BigInt.one) { + return newValue.copyWith(text: ''); + } + + // insert group separator + final regex = RegExp(r'\B(?=(\d{3})+(?!\d))'); + + String newString = newText.replaceAllMapped( + regex, + (m) => "${m.group(0)}${numberSymbols?.GROUP_SEP ?? ","}", + ); + + if (fraction != null) { + newString += decimalSeparator; + if (fraction.isNotEmpty) { + newString += fraction; + } + } + + return TextEditingValue( + text: newString, + selection: TextSelection.collapsed( + offset: newString.length - selectionIndexFromTheRight, + ), + ); + } +} diff --git a/lib/utilities/amount/amount_unit.dart b/lib/utilities/amount/amount_unit.dart index 114fbaa57..afaf31639 100644 --- a/lib/utilities/amount/amount_unit.dart +++ b/lib/utilities/amount/amount_unit.dart @@ -6,6 +6,7 @@ import 'package:intl/number_symbols_data.dart'; import 'package:stackduo/utilities/amount/amount.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; +// preserve index order as index is used to store value in preferences enum AmountUnit { normal(0), milli(3), @@ -14,10 +15,25 @@ enum AmountUnit { pico(12), femto(15), atto(18), + zepto(21), + yocto(24), + ronto(27), + quecto(30), ; const AmountUnit(this.shift); final int shift; + + static List valuesForCoin(Coin coin) { + switch (coin) { + case Coin.bitcoinTestNet: + case Coin.bitcoin: + return AmountUnit.values.sublist(0, 4); + + case Coin.monero: + return AmountUnit.values.sublist(0, 5); + } + } } extension AmountUnitExt on AmountUnit { @@ -30,21 +46,144 @@ extension AmountUnitExt on AmountUnit { case AmountUnit.micro: return "µ${coin.ticker}"; case AmountUnit.nano: - if (coin == Coin.monero) { + // if (coin == Coin.ethereum) { + // return "gwei"; + // } else + if ( + // coin == Coin.wownero || + coin == Coin.monero + // || + // coin == Coin.nano || + // coin == Coin.banano + ) { return "n${coin.ticker}"; } else { return "sats"; } case AmountUnit.pico: - if (coin == Coin.monero) { + // if (coin == Coin.ethereum) { + // return "mwei"; + // } else + if ( + // coin == Coin.wownero || + coin == Coin.monero + // || + // coin == Coin.nano || + // coin == Coin.banano + ) { return "p${coin.ticker}"; } else { return "invalid"; } case AmountUnit.femto: + // if (coin == Coin.ethereum) { + // return "kwei"; + // } else if (coin == Coin.nano || coin == Coin.banano) { + // return "f${coin.ticker}"; + // } else { + // return "invalid"; + // } case AmountUnit.atto: + // if (coin == Coin.ethereum) { + // return "wei"; + // } else if (coin == Coin.nano || coin == Coin.banano) { + // return "a${coin.ticker}"; + // } else { + // return "invalid"; + // } + case AmountUnit.zepto: + // if (coin == Coin.nano || coin == Coin.banano) { + // return "z${coin.ticker}"; + // } else { + // return "invalid"; + // } + case AmountUnit.yocto: + // if (coin == Coin.nano || coin == Coin.banano) { + // return "y${coin.ticker}"; + // } else { + // return "invalid"; + // } + case AmountUnit.ronto: + // if (coin == Coin.nano || coin == Coin.banano) { + // return "r${coin.ticker}"; + // } else { + // return "invalid"; + // } + case AmountUnit.quecto: + // if (coin == Coin.nano || coin == Coin.banano) { + // return "q${coin.ticker}"; + // } else { return "invalid"; + // } + } + } + + String unitForContract(dynamic contract) { + switch (this) { + // case AmountUnit.normal: + // return contract.symbol; + // case AmountUnit.milli: + // return "m${contract.symbol}"; + // case AmountUnit.micro: + // return "µ${contract.symbol}"; + // case AmountUnit.nano: + // return "gwei"; + // case AmountUnit.pico: + // return "mwei"; + // case AmountUnit.femto: + // return "kwei"; + // case AmountUnit.atto: + // return "wei"; + default: + throw ArgumentError( + "Duo has no eth", + ); + } + } + + Amount? tryParse( + String value, { + required String locale, + required Coin coin, + dynamic tokenContract, + }) { + final precisionLost = value.startsWith("~"); + + final parts = (precisionLost ? value.substring(1) : value).split(" "); + + if (parts.first.isEmpty) { + return null; + } + + String str = parts.first; + if (str.startsWith(RegExp(r'[+-]'))) { + str = str.substring(1); + } + + if (str.isEmpty) { + return null; + } + + // get number symbols for decimal place and group separator + final numberSymbols = numberFormatSymbols[locale] as NumberSymbols? ?? + numberFormatSymbols[locale.substring(0, 2)] as NumberSymbols?; + + final groupSeparator = numberSymbols?.GROUP_SEP ?? ","; + final decimalSeparator = numberSymbols?.DECIMAL_SEP ?? "."; + + str = str.replaceAll(groupSeparator, ""); + + final decimalString = str.replaceFirst(decimalSeparator, "."); + final Decimal? decimal = Decimal.tryParse(decimalString); + + if (decimal == null) { + return null; } + + final int decimalPlaces = tokenContract?.decimals as int? ?? coin.decimals; + final realShift = math.min(shift, decimalPlaces); + + return decimal.shift(0 - realShift).toAmount(fractionDigits: decimalPlaces); } String displayAmount({ @@ -52,8 +191,13 @@ extension AmountUnitExt on AmountUnit { required String locale, required Coin coin, required int maxDecimalPlaces, + bool withUnitName = true, + bool indicatePrecisionLoss = true, + String? overrideUnit, + dynamic? tokenContract, }) { assert(maxDecimalPlaces >= 0); + // ensure we don't shift past minimum atomic value final realShift = math.min(shift, amount.fractionDigits); @@ -69,18 +213,55 @@ extension AmountUnitExt on AmountUnit { // start building the return value with just the whole value String returnValue = wholeNumber.toString(); + // get number symbols for decimal place and group separator + final numberSymbols = numberFormatSymbols[locale] as NumberSymbols? ?? + numberFormatSymbols[locale.substring(0, 2)] as NumberSymbols?; + + // insert group separator + final regex = RegExp(r'\B(?=(\d{3})+(?!\d))'); + returnValue = returnValue.replaceAllMapped( + regex, + (m) => "${m.group(0)}${numberSymbols?.GROUP_SEP ?? ","}", + ); + + // if true and withUnitName is true, we will show "~" prepended on amount + bool didLosePrecision = false; + // if any decimal places should be shown continue building the return value if (places > 0) { // get the fractional value final Decimal fraction = shifted - shifted.truncate(); - // get final decimal based on max precision wanted - final int actualDecimalPlaces = math.min(places, maxDecimalPlaces); + // get final decimal based on max precision wanted while ensuring that + // maxDecimalPlaces doesn't exceed the max per coin + final int updatedMax; + if (tokenContract != null) { + updatedMax = maxDecimalPlaces > (tokenContract.decimals as int) + ? tokenContract.decimals as int + : maxDecimalPlaces; + } else { + updatedMax = + maxDecimalPlaces > coin.decimals ? coin.decimals : maxDecimalPlaces; + } + final int actualDecimalPlaces = math.min(places, updatedMax); // get remainder string without the prepending "0." - String remainder = fraction.toString().substring(2); + final fractionString = fraction.toString(); + String remainder; + if (fractionString.length > 2) { + remainder = fraction.toString().substring(2); + } else { + remainder = "0"; + } if (remainder.length > actualDecimalPlaces) { + // check for loss of precision + final remainingRemainder = + BigInt.tryParse(remainder.substring(actualDecimalPlaces)); + if (remainingRemainder != null) { + didLosePrecision = remainingRemainder > BigInt.zero; + } + // trim unwanted trailing digits remainder = remainder.substring(0, actualDecimalPlaces); } else if (remainder.length < actualDecimalPlaces) { @@ -91,17 +272,29 @@ extension AmountUnitExt on AmountUnit { } // get decimal separator based on locale - final String separator = - (numberFormatSymbols[locale] as NumberSymbols?)?.DECIMAL_SEP ?? - (numberFormatSymbols[locale.substring(0, 2)] as NumberSymbols?) - ?.DECIMAL_SEP ?? - "."; + final String separator = numberSymbols?.DECIMAL_SEP ?? "."; // append separator and fractional amount returnValue += "$separator$remainder"; } + if (!withUnitName && !indicatePrecisionLoss) { + return returnValue; + } + + if (didLosePrecision && indicatePrecisionLoss) { + returnValue = "~$returnValue"; + } + + if (!withUnitName && indicatePrecisionLoss) { + return returnValue; + } + // return the value with the proper unit symbol - return "$returnValue ${unitForCoin(coin)}"; + if (tokenContract != null) { + overrideUnit = unitForContract(tokenContract); + } + + return "$returnValue ${overrideUnit ?? unitForCoin(coin)}"; } } diff --git a/lib/utilities/block_explorers.dart b/lib/utilities/block_explorers.dart index 7d3836db7..322ee953c 100644 --- a/lib/utilities/block_explorers.dart +++ b/lib/utilities/block_explorers.dart @@ -1,4 +1,4 @@ -import 'package:stackduo/db/main_db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; import 'package:stackduo/models/isar/models/block_explorer.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; @@ -29,6 +29,7 @@ Future setBlockExplorerForCoin({ ); } +// Returns the block explorer URL for the given coin and txid Uri getBlockExplorerTransactionUrlFor({ required Coin coin, required String txid, diff --git a/lib/utilities/clipboard_interface.dart b/lib/utilities/clipboard_interface.dart index 80cdf8a47..b1451cb31 100644 --- a/lib/utilities/clipboard_interface.dart +++ b/lib/utilities/clipboard_interface.dart @@ -23,8 +23,8 @@ class FakeClipboard implements ClipboardInterface { String? _value; @override - Future getData(String format) async { - return ClipboardData(text: _value); + Future getData(String format) async { + return _value == null ? null : ClipboardData(text: _value!); } @override diff --git a/lib/utilities/constants.dart b/lib/utilities/constants.dart index 7285e0a6d..e566caaea 100644 --- a/lib/utilities/constants.dart +++ b/lib/utilities/constants.dart @@ -25,9 +25,15 @@ abstract class Constants { // static bool enableBuy = enableExchange; // // true; // true for development, - //TODO: correct for monero? - static const int _satsPerCoinMonero = 1000000000000; - static const int _satsPerCoin = 100000000; + static final BigInt _satsPerCoinECash = BigInt.from(100); + static final BigInt _satsPerCoinEthereum = BigInt.from(1000000000000000000); + static final BigInt _satsPerCoinMonero = BigInt.from(1000000000000); + static final BigInt _satsPerCoinWownero = BigInt.from(100000000000); + static final BigInt _satsPerCoinNano = + BigInt.parse("1000000000000000000000000000000"); // 1*10^30 + static final BigInt _satsPerCoinBanano = + BigInt.parse("100000000000000000000000000000"); // 1*10^29 + static final BigInt _satsPerCoin = BigInt.from(100000000); static const int _decimalPlaces = 8; static const int _decimalPlacesWownero = 11; static const int _decimalPlacesMonero = 12; @@ -38,12 +44,11 @@ abstract class Constants { // Enable Logger.print statements static const bool disableLogger = false; - static const int currentHiveDbVersion = 9; static const int currentDataVersion = 10; static const int rescanV1 = 1; - static int satsPerCoin(Coin coin) { + static BigInt satsPerCoin(Coin coin) { switch (coin) { case Coin.bitcoin: case Coin.bitcoinTestNet: @@ -92,8 +97,16 @@ abstract class Constants { } } - static const int seedPhraseWordCountBip39 = 12; - static const int seedPhraseWordCountMonero = 25; + static int defaultSeedPhraseLengthFor({required Coin coin}) { + switch (coin) { + case Coin.bitcoin: + case Coin.bitcoinTestNet: + return 12; + + case Coin.monero: + return 25; + } + } static const Map monthMapShort = { 1: 'Jan', diff --git a/lib/utilities/db_version_migration.dart b/lib/utilities/db_version_migration.dart index 4a594ff24..0945e811d 100644 --- a/lib/utilities/db_version_migration.dart +++ b/lib/utilities/db_version_migration.dart @@ -1,7 +1,7 @@ import 'package:hive/hive.dart'; import 'package:isar/isar.dart'; -import 'package:stackduo/db/main_db.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/isar/main_db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/models/contact.dart'; import 'package:stackduo/models/exchange/change_now/exchange_transaction.dart'; import 'package:stackduo/models/exchange/response_objects/trade.dart'; diff --git a/lib/utilities/delete_everything.dart b/lib/utilities/delete_everything.dart index c8ba5f41c..a5f14415d 100644 --- a/lib/utilities/delete_everything.dart +++ b/lib/utilities/delete_everything.dart @@ -1,4 +1,4 @@ -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/utilities/logger.dart'; Future deleteEverything() async { diff --git a/lib/utilities/desktop_password_service.dart b/lib/utilities/desktop_password_service.dart index d71dbd7b6..d1c9a1f8c 100644 --- a/lib/utilities/desktop_password_service.dart +++ b/lib/utilities/desktop_password_service.dart @@ -1,6 +1,6 @@ import 'package:hive/hive.dart'; import 'package:stack_wallet_backup/secure_storage.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/utilities/logger.dart'; const String _kKeyBlobKey = "swbKeyBlobKeyStringID"; diff --git a/lib/utilities/enums/fee_rate_type_enum.dart b/lib/utilities/enums/fee_rate_type_enum.dart index 95374453e..dafd49e34 100644 --- a/lib/utilities/enums/fee_rate_type_enum.dart +++ b/lib/utilities/enums/fee_rate_type_enum.dart @@ -1,4 +1,4 @@ -enum FeeRateType { fast, average, slow } +enum FeeRateType { fast, average, slow, custom } extension FeeRateTypeExt on FeeRateType { String get prettyName { @@ -9,6 +9,8 @@ extension FeeRateTypeExt on FeeRateType { return "Average"; case FeeRateType.slow: return "Slow"; + case FeeRateType.custom: + return "Custom"; } } } diff --git a/lib/utilities/prefs.dart b/lib/utilities/prefs.dart index 6e989d49f..6ced2f232 100644 --- a/lib/utilities/prefs.dart +++ b/lib/utilities/prefs.dart @@ -1,7 +1,9 @@ import 'package:flutter/cupertino.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; +import 'package:stackduo/utilities/amount/amount_unit.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/backup_frequency_type.dart'; +import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/enums/languages_enum.dart'; import 'package:stackduo/utilities/enums/sync_type_enum.dart'; import 'package:uuid/uuid.dart'; @@ -46,6 +48,8 @@ class Prefs extends ChangeNotifier { _themeId = await _getThemeId(); _systemBrightnessLightThemeId = await _getSystemBrightnessLightThemeId(); _systemBrightnessDarkThemeId = await _getSystemBrightnessDarkTheme(); + await _setAmountUnits(); + await _setMaxDecimals(); _initialized = true; } @@ -796,4 +800,63 @@ class Prefs extends ChangeNotifier { ) as String? ?? "dark"; } + + // coin amount unit settings + + final Map _amountUnits = {}; + + AmountUnit amountUnit(Coin coin) => _amountUnits[coin] ?? AmountUnit.normal; + + void updateAmountUnit({required Coin coin, required AmountUnit amountUnit}) { + if (this.amountUnit(coin) != amountUnit) { + DB.instance.put( + boxName: DB.boxNamePrefs, + key: "amountUnitFor${coin.name}", + value: amountUnit.index, + ); + _amountUnits[coin] = amountUnit; + notifyListeners(); + } + } + + Future _setAmountUnits() async { + for (final coin in Coin.values) { + final unitIndex = await DB.instance.get( + boxName: DB.boxNamePrefs, + key: "amountUnitFor${coin.name}", + ) as int? ?? + 0; // 0 is "normal" + _amountUnits[coin] = AmountUnit.values[unitIndex]; + } + } + + // coin precision setting (max decimal places to show) + + final Map _amountDecimals = {}; + + int maxDecimals(Coin coin) => _amountDecimals[coin] ?? coin.decimals; + + void updateMaxDecimals({required Coin coin, required int maxDecimals}) { + if (this.maxDecimals(coin) != maxDecimals) { + DB.instance.put( + boxName: DB.boxNamePrefs, + key: "maxDecimalsFor${coin.name}", + value: maxDecimals, + ); + _amountDecimals[coin] = maxDecimals; + notifyListeners(); + } + } + + Future _setMaxDecimals() async { + for (final coin in Coin.values) { + final decimals = await DB.instance.get( + boxName: DB.boxNamePrefs, + key: "maxDecimalsFor${coin.name}", + ) as int? ?? + (coin.decimals > 18 ? 18 : coin.decimals); + // use some sane max rather than up to 30 that nano uses + _amountDecimals[coin] = decimals; + } + } } diff --git a/lib/widgets/address_book_card.dart b/lib/widgets/address_book_card.dart index 633045af8..fd4f34184 100644 --- a/lib/widgets/address_book_card.dart +++ b/lib/widgets/address_book_card.dart @@ -120,29 +120,31 @@ class _AddressBookCardState extends ConsumerState { const SizedBox( width: 16, ), - if (isDesktop && !desktopSendFrom) const Spacer(), - if (isDesktop) - Text( - coinsString, - style: STextStyles.label(context), - ), - if (!isDesktop) - Column( - crossAxisAlignment: CrossAxisAlignment.start, + Expanded( + child: Column( + crossAxisAlignment: isDesktop && !desktopSendFrom + ? CrossAxisAlignment.end + : CrossAxisAlignment.start, children: [ - Text( - contact.name, - style: STextStyles.itemSubtitle12(context), - ), - const SizedBox( - height: 4, - ), + if (!isDesktop) + Text( + contact.name, + style: STextStyles.itemSubtitle12(context), + ), + if (!isDesktop) + const SizedBox( + height: 4, + ), Text( coinsString, style: STextStyles.label(context), + textAlign: isDesktop && !desktopSendFrom + ? TextAlign.right + : TextAlign.left, ), ], ), + ), if (isDesktop && desktopSendFrom) const Spacer(), if (isDesktop && desktopSendFrom) SvgPicture.asset( diff --git a/lib/widgets/animated_widgets/rotating_arrows.dart b/lib/widgets/animated_widgets/rotating_arrows.dart index dc16973b4..6532e94c3 100644 --- a/lib/widgets/animated_widgets/rotating_arrows.dart +++ b/lib/widgets/animated_widgets/rotating_arrows.dart @@ -7,6 +7,8 @@ class RotatingArrowsController { VoidCallback? forward; VoidCallback? repeat; VoidCallback? stop; + + bool hasLoadedAnimation = false; } class RotatingArrows extends StatefulWidget { @@ -76,6 +78,7 @@ class _RotatingArrowsState extends State ), onLoaded: (composition) { animationController.duration = composition.duration; + widget.controller?.hasLoadedAnimation = true; // if controller was not set just assume continuous repeat if (widget.spinByDefault) { diff --git a/lib/widgets/coin_card.dart b/lib/widgets/coin_card.dart new file mode 100644 index 000000000..421e71ca1 --- /dev/null +++ b/lib/widgets/coin_card.dart @@ -0,0 +1,126 @@ +/* + * This file is part of Stack Wallet. + * + * Copyright (c) 2023 Cypher Stack + * All Rights Reserved. + * The code is distributed under GPLv3 license, see LICENSE file for details. + * Generated by Cypher Stack on 2023-05-26 + * + */ + +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:stackduo/providers/providers.dart'; +import 'package:stackduo/themes/coin_card_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; +import 'package:stackduo/utilities/assets.dart'; +import 'package:stackduo/utilities/constants.dart'; + +class CoinCard extends ConsumerWidget { + const CoinCard({ + super.key, + required this.walletId, + required this.width, + required this.height, + }); + + final String walletId; + final double width; + final double height; + + @override + Widget build(BuildContext context, WidgetRef ref) { + final coin = ref.watch( + walletsChangeNotifierProvider + .select((value) => value.getManager(walletId).coin), + ); + + final bool hasCardImageBg = ref.watch(coinCardProvider(coin)) != null; + + return Stack( + children: [ + if (hasCardImageBg) + Container( + width: width, + height: height, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + image: DecorationImage( + fit: BoxFit.cover, + image: FileImage( + File( + ref.watch(coinCardProvider(coin))!, + ), + ), + ), + ), + ), + if (!hasCardImageBg) + Container( + width: width, + height: height, + decoration: BoxDecoration( + color: Theme.of(context) + .extension()! + .colorForCoin(coin), + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + ), + ), + if (!hasCardImageBg) + Column( + children: [ + const Spacer(), + SizedBox( + height: width * 0.3, + child: Row( + children: [ + const Spacer( + flex: 9, + ), + SvgPicture.asset( + Assets.svg.ellipse2, + height: width * 0.3, + ), + // ), + const Spacer( + flex: 2, + ), + ], + ), + ), + ], + ), + if (!hasCardImageBg) + Row( + children: [ + const Spacer( + flex: 5, + ), + SizedBox( + width: width * 0.45, + child: Column( + children: [ + SvgPicture.asset( + Assets.svg.ellipse1, + width: width * 0.45, + ), + const Spacer(), + ], + ), + ), + const Spacer( + flex: 1, + ), + ], + ), + ], + ); + } +} diff --git a/lib/widgets/custom_buttons/app_bar_icon_button.dart b/lib/widgets/custom_buttons/app_bar_icon_button.dart index 0eba786dd..ab423a9b2 100644 --- a/lib/widgets/custom_buttons/app_bar_icon_button.dart +++ b/lib/widgets/custom_buttons/app_bar_icon_button.dart @@ -36,8 +36,8 @@ class AppBarIconButton extends StatelessWidget { boxShadow: shadows, ), child: Semantics( - label: semanticsLabel, excludeSemantics: true, + label: semanticsLabel, child: MaterialButton( splashColor: Theme.of(context).extension()!.highlight, padding: EdgeInsets.zero, @@ -72,32 +72,32 @@ class AppBarBackButton extends StatelessWidget { Widget build(BuildContext context) { final isDesktop = Util.isDesktop; return Padding( - padding: isDesktop - ? const EdgeInsets.symmetric( - vertical: 20, - horizontal: 24, - ) - : const EdgeInsets.all(10), - child: AppBarIconButton( - semanticsLabel: semanticsLabel, - size: size ?? - (isDesktop - ? isCompact - ? 42 - : 56 - : 32), - color: isDesktop - ? Theme.of(context).extension()!.textFieldDefaultBG - : Theme.of(context).extension()!.background, - shadows: const [], - icon: SvgPicture.asset( - Assets.svg.arrowLeft, - width: iconSize ?? (isCompact ? 18 : 24), - height: iconSize ?? (isCompact ? 18 : 24), - color: Theme.of(context).extension()!.topNavIconPrimary, - ), - onPressed: onPressed ?? Navigator.of(context).pop, - ), - ); + padding: isDesktop + ? const EdgeInsets.symmetric( + vertical: 20, + horizontal: 24, + ) + : const EdgeInsets.all(10), + child: AppBarIconButton( + semanticsLabel: semanticsLabel, + size: size ?? + (isDesktop + ? isCompact + ? 42 + : 56 + : 32), + color: isDesktop + ? Theme.of(context).extension()!.textFieldDefaultBG + : Theme.of(context).extension()!.background, + shadows: const [], + icon: SvgPicture.asset( + Assets.svg.arrowLeft, + width: iconSize ?? (isCompact ? 18 : 24), + height: iconSize ?? (isCompact ? 18 : 24), + color: + Theme.of(context).extension()!.topNavIconPrimary, + ), + onPressed: onPressed ?? Navigator.of(context).pop, + )); } } diff --git a/lib/widgets/custom_page_view/custom_page_view.dart b/lib/widgets/custom_page_view/custom_page_view.dart index e0fe15110..e7e00fd9b 100644 --- a/lib/widgets/custom_page_view/custom_page_view.dart +++ b/lib/widgets/custom_page_view/custom_page_view.dart @@ -255,6 +255,7 @@ class PageMetrics extends FixedScrollMetrics { required double? pixels, required double? viewportDimension, required AxisDirection axisDirection, + required double devicePixelRatio, required this.viewportFraction, }) : super( minScrollExtent: minScrollExtent, @@ -262,6 +263,7 @@ class PageMetrics extends FixedScrollMetrics { pixels: pixels, viewportDimension: viewportDimension, axisDirection: axisDirection, + devicePixelRatio: devicePixelRatio, ); @override @@ -271,6 +273,7 @@ class PageMetrics extends FixedScrollMetrics { double? pixels, double? viewportDimension, AxisDirection? axisDirection, + double? devicePixelRatio, double? viewportFraction, }) { return PageMetrics( @@ -282,6 +285,7 @@ class PageMetrics extends FixedScrollMetrics { viewportDimension: viewportDimension ?? (hasViewportDimension ? this.viewportDimension : null), axisDirection: axisDirection ?? this.axisDirection, + devicePixelRatio: devicePixelRatio ?? this.devicePixelRatio, viewportFraction: viewportFraction ?? this.viewportFraction, ); } @@ -397,7 +401,7 @@ class _PagePosition extends ScrollPositionWithSingleContext @override void saveScrollOffset() { - PageStorage.of(context.storageContext)?.writeState(context.storageContext, + PageStorage.of(context.storageContext).writeState(context.storageContext, _cachedPage ?? getPageFromPixels(pixels, viewportDimension)); } @@ -405,7 +409,7 @@ class _PagePosition extends ScrollPositionWithSingleContext void restoreScrollOffset() { if (!hasPixels) { final double? value = PageStorage.of(context.storageContext) - ?.readState(context.storageContext) as double?; + .readState(context.storageContext) as double?; if (value != null) _pageToUseOnStartup = value; } } @@ -472,6 +476,7 @@ class _PagePosition extends ScrollPositionWithSingleContext double? pixels, double? viewportDimension, AxisDirection? axisDirection, + double? devicePixelRatio, double? viewportFraction, }) { return PageMetrics( @@ -483,6 +488,7 @@ class _PagePosition extends ScrollPositionWithSingleContext viewportDimension: viewportDimension ?? (hasViewportDimension ? this.viewportDimension : null), axisDirection: axisDirection ?? this.axisDirection, + devicePixelRatio: devicePixelRatio ?? this.devicePixelRatio, viewportFraction: viewportFraction ?? this.viewportFraction, ); } diff --git a/lib/widgets/desktop/desktop_fee_dialog.dart b/lib/widgets/desktop/desktop_fee_dialog.dart new file mode 100644 index 000000000..3b9cf93f2 --- /dev/null +++ b/lib/widgets/desktop/desktop_fee_dialog.dart @@ -0,0 +1,381 @@ +import 'package:cw_core/monero_transaction_priority.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:stackduo/models/models.dart'; +import 'package:stackduo/pages/send_view/sub_widgets/transaction_fee_selection_sheet.dart'; +import 'package:stackduo/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_fee_dropdown.dart'; +import 'package:stackduo/providers/global/wallets_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; +import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; +import 'package:stackduo/utilities/constants.dart'; +import 'package:stackduo/utilities/enums/coin_enum.dart'; +import 'package:stackduo/utilities/enums/fee_rate_type_enum.dart'; +import 'package:stackduo/utilities/text_styles.dart'; +import 'package:stackduo/widgets/animated_text.dart'; +import 'package:stackduo/widgets/desktop/desktop_dialog.dart'; +import 'package:stackduo/widgets/desktop/desktop_dialog_close_button.dart'; + +class DesktopFeeDialog extends ConsumerStatefulWidget { + const DesktopFeeDialog({ + Key? key, + required this.walletId, + this.isToken = false, + }) : super(key: key); + + final String walletId; + final bool isToken; + + @override + ConsumerState createState() => _DesktopFeeDialogState(); +} + +class _DesktopFeeDialogState extends ConsumerState { + late final String walletId; + + FeeObject? feeObject; + FeeRateType feeRateType = FeeRateType.average; + + Future feeFor({ + required Amount amount, + required FeeRateType feeRateType, + required int feeRate, + required Coin coin, + }) async { + switch (feeRateType) { + case FeeRateType.fast: + if (ref.read(feeSheetSessionCacheProvider).fast[amount] == null) { + // if (widget.isToken == false) { + final manager = + ref.read(walletsChangeNotifierProvider).getManager(walletId); + + if (coin == Coin.monero) { + final fee = await manager.estimateFeeFor( + amount, MoneroTransactionPriority.fast.raw!); + ref.read(feeSheetSessionCacheProvider).fast[amount] = fee; + // } else if ((coin == Coin.firo || coin == Coin.firoTestNet) && + // ref.read(publicPrivateBalanceStateProvider.state).state != + // "Private") { + // ref.read(feeSheetSessionCacheProvider).fast[amount] = + // await (manager.wallet as FiroWallet) + // .estimateFeeForPublic(amount, feeRate); + } else { + ref.read(feeSheetSessionCacheProvider).fast[amount] = + await manager.estimateFeeFor(amount, feeRate); + } + // } else { + // final tokenWallet = ref.read(tokenServiceProvider)!; + // final fee = tokenWallet.estimateFeeFor(feeRate); + // ref.read(tokenFeeSessionCacheProvider).fast[amount] = fee; + // } + } + return ref.read(feeSheetSessionCacheProvider).fast[amount]!; + + case FeeRateType.average: + if (ref.read(feeSheetSessionCacheProvider).average[amount] == null) { + // if (widget.isToken == false) { + final manager = + ref.read(walletsChangeNotifierProvider).getManager(walletId); + + if (coin == Coin.monero) { + final fee = await manager.estimateFeeFor( + amount, MoneroTransactionPriority.regular.raw!); + ref.read(feeSheetSessionCacheProvider).average[amount] = fee; + // } else if ((coin == Coin.firo || coin == Coin.firoTestNet) && + // ref.read(publicPrivateBalanceStateProvider.state).state != + // "Private") { + // ref.read(feeSheetSessionCacheProvider).average[amount] = + // await (manager.wallet as FiroWallet) + // .estimateFeeForPublic(amount, feeRate); + } else { + ref.read(feeSheetSessionCacheProvider).average[amount] = + await manager.estimateFeeFor(amount, feeRate); + } + // } else { + // final tokenWallet = ref.read(tokenServiceProvider)!; + // final fee = tokenWallet.estimateFeeFor(feeRate); + // ref.read(tokenFeeSessionCacheProvider).average[amount] = fee; + // } + } + return ref.read(feeSheetSessionCacheProvider).average[amount]!; + + case FeeRateType.slow: + if (ref.read(feeSheetSessionCacheProvider).slow[amount] == null) { + // if (widget.isToken == false) { + final manager = + ref.read(walletsChangeNotifierProvider).getManager(walletId); + + if (coin == Coin.monero) { + final fee = await manager.estimateFeeFor( + amount, MoneroTransactionPriority.slow.raw!); + ref.read(feeSheetSessionCacheProvider).slow[amount] = fee; + // } else if ((coin == Coin.firo || coin == Coin.firoTestNet) && + // ref.read(publicPrivateBalanceStateProvider.state).state != + // "Private") { + // ref.read(feeSheetSessionCacheProvider).slow[amount] = + // await (manager.wallet as FiroWallet) + // .estimateFeeForPublic(amount, feeRate); + } else { + ref.read(feeSheetSessionCacheProvider).slow[amount] = + await manager.estimateFeeFor(amount, feeRate); + } + // } else { + // final tokenWallet = ref.read(tokenServiceProvider)!; + // final fee = tokenWallet.estimateFeeFor(feeRate); + // ref.read(tokenFeeSessionCacheProvider).slow[amount] = fee; + // } + } + return ref.read(feeSheetSessionCacheProvider).slow[amount]!; + + default: + return Amount.zero; + } + } + + @override + void initState() { + walletId = widget.walletId; + super.initState(); + } + + @override + Widget build(BuildContext context) { + return DesktopDialog( + maxWidth: 450, + maxHeight: double.infinity, + child: FutureBuilder( + future: ref.watch( + walletsChangeNotifierProvider.select( + (value) => value.getManager(walletId).fees, + ), + ), + builder: (context, AsyncSnapshot snapshot) { + if (snapshot.connectionState == ConnectionState.done && + snapshot.hasData) { + feeObject = snapshot.data!; + } + + return Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Padding( + padding: const EdgeInsets.only(left: 32), + child: Text( + "Choose fee", + style: STextStyles.desktopH3(context), + ), + ), + const DesktopDialogCloseButton(), + ], + ), + ...FeeRateType.values.map( + (e) => Padding( + padding: const EdgeInsets.only( + left: 32, + right: 32, + bottom: 16, + ), + child: DesktopFeeItem( + feeObject: feeObject, + feeRateType: e, + walletId: walletId, + feeFor: feeFor, + isSelected: false, + ), + ), + ), + const SizedBox( + height: 16, + ), + ], + ); + }, + ), + ); + } +} + +class DesktopFeeItem extends ConsumerStatefulWidget { + const DesktopFeeItem({ + Key? key, + required this.feeObject, + required this.feeRateType, + required this.walletId, + required this.feeFor, + required this.isSelected, + }) : super(key: key); + + final FeeObject? feeObject; + final FeeRateType feeRateType; + final String walletId; + final Future Function({ + required Amount amount, + required FeeRateType feeRateType, + required int feeRate, + required Coin coin, + }) feeFor; + final bool isSelected; + + @override + ConsumerState createState() => _DesktopFeeItemState(); +} + +class _DesktopFeeItemState extends ConsumerState { + String? feeString; + String? timeString; + + static const stringsToLoopThrough = [ + "Calculating", + "Calculating.", + "Calculating..", + "Calculating...", + ]; + + String estimatedTimeToBeIncludedInNextBlock( + int targetBlockTime, int estimatedNumberOfBlocks) { + int time = targetBlockTime * estimatedNumberOfBlocks; + + int hours = (time / 3600).floor(); + if (hours > 1) { + return "~$hours hours"; + } else if (hours == 1) { + return "~$hours hour"; + } + + // less than an hour + + final string = (time / 60).toStringAsFixed(1); + + if (string == "1.0") { + return "~1 minute"; + } else { + if (string.endsWith(".0")) { + return "~${(time / 60).floor()} minutes"; + } + return "~$string minutes"; + } + } + + @override + Widget build(BuildContext context) { + debugPrint("BUILD: $runtimeType : ${widget.feeRateType}"); + + return MaterialButton( + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + onPressed: () { + Navigator.of(context).pop( + ( + widget.feeRateType, + feeString, + timeString, + ), + ); + }, + child: Builder( + builder: (_) { + if (widget.feeRateType == FeeRateType.custom) { + return Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + widget.feeRateType.prettyName, + style: + STextStyles.desktopTextExtraExtraSmall(context).copyWith( + color: Theme.of(context) + .extension()! + .textFieldActiveText, + ), + textAlign: TextAlign.left, + ), + ], + ); + } + + final manager = ref.watch(walletsChangeNotifierProvider + .select((value) => value.getManager(widget.walletId))); + + if (widget.feeObject == null) { + return AnimatedText( + stringsToLoopThrough: stringsToLoopThrough, + style: STextStyles.desktopTextExtraExtraSmall(context).copyWith( + color: Theme.of(context) + .extension()! + .textFieldActiveText, + ), + ); + } else { + return FutureBuilder( + future: widget.feeFor( + coin: manager.coin, + feeRateType: widget.feeRateType, + feeRate: widget.feeRateType == FeeRateType.fast + ? widget.feeObject!.fast + : widget.feeRateType == FeeRateType.slow + ? widget.feeObject!.slow + : widget.feeObject!.medium, + amount: ref.watch(sendAmountProvider.state).state, + ), + builder: (_, AsyncSnapshot snapshot) { + if (snapshot.connectionState == ConnectionState.done && + snapshot.hasData) { + feeString = "${widget.feeRateType.prettyName} " + "(~${ref.watch(pAmountFormatter(manager.coin)).format( + snapshot.data!, + indicatePrecisionLoss: false, + )})"; + + timeString = estimatedTimeToBeIncludedInNextBlock( + Constants.targetBlockTimeInSeconds(manager.coin), + widget.feeRateType == FeeRateType.fast + ? widget.feeObject!.numberOfBlocksFast + : widget.feeRateType == FeeRateType.slow + ? widget.feeObject!.numberOfBlocksSlow + : widget.feeObject!.numberOfBlocksAverage, + ); + + return Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + feeString!, + style: STextStyles.desktopTextExtraExtraSmall(context) + .copyWith( + color: Theme.of(context) + .extension()! + .textFieldActiveText, + ), + textAlign: TextAlign.left, + ), + if (widget.feeObject != null) + Text( + timeString!, + style: STextStyles.desktopTextExtraExtraSmall(context) + .copyWith( + color: Theme.of(context) + .extension()! + .textFieldActiveSearchIconRight, + ), + ), + ], + ); + } else { + return AnimatedText( + stringsToLoopThrough: stringsToLoopThrough, + style: STextStyles.desktopTextExtraExtraSmall(context) + .copyWith( + color: Theme.of(context) + .extension()! + .textFieldActiveText, + ), + ); + } + }, + ); + } + }, + ), + ); + } +} diff --git a/lib/widgets/fee_slider.dart b/lib/widgets/fee_slider.dart new file mode 100644 index 000000000..7a225063c --- /dev/null +++ b/lib/widgets/fee_slider.dart @@ -0,0 +1,56 @@ +import 'dart:math'; + +import 'package:flutter/material.dart'; +import 'package:stackduo/utilities/text_styles.dart'; + +class FeeSlider extends StatefulWidget { + const FeeSlider({ + super.key, + required this.onSatVByteChanged, + }); + + final void Function(int) onSatVByteChanged; + + @override + State createState() => _FeeSliderState(); +} + +class _FeeSliderState extends State { + static const int min = 1; + static const int max = 4; + + double sliderValue = 0; + + int rate = min; + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "sat/vByte", + style: STextStyles.smallMed12(context), + ), + Text( + "$rate", + style: STextStyles.smallMed12(context), + ), + ], + ), + Slider( + value: sliderValue, + onChanged: (value) { + setState(() { + sliderValue = value; + rate = pow(sliderValue * (max - min) + min, 4).toInt(); + }); + widget.onSatVByteChanged(rate); + }, + ), + ], + ); + } +} diff --git a/lib/widgets/gradient_card.dart b/lib/widgets/gradient_card.dart new file mode 100644 index 000000000..9d103cb59 --- /dev/null +++ b/lib/widgets/gradient_card.dart @@ -0,0 +1,44 @@ +/* + * This file is part of Stack Wallet. + * + * Copyright (c) 2023 Cypher Stack + * All Rights Reserved. + * The code is distributed under GPLv3 license, see LICENSE file for details. + * Generated by Cypher Stack on 2023-05-26 + * + */ + +// import 'package:flutter/material.dart'; +// import 'package:stackduo/utilities/cfcolors.dart'; +// const GradientCard( +// {Key key, +// this.child, +// @required this.gradient, +// this.backgroundColorForTransparentGradient = Colors.white, +// this.circularBorderRadius = 0.0}) +// : super(key: key); +// +// final Widget child; +// final Gradient gradient; +// final Color backgroundColorForTransparentGradient; +// final double circularBorderRadius; +// +// @override +// Widget build(BuildContext context) { +// return Material( +// color: backgroundColorForTransparentGradient, +// borderRadius: BorderRadius.circular(circularBorderRadius), +// elevation: 0, +// child: Container( +// decoration: BoxDecoration( +// gradient: gradient, +// borderRadius: BorderRadius.circular(circularBorderRadius), +// boxShadow: [ +// CFColors.standardBoxShadow, +// ], +// ), +// child: child, +// ), +// ); +// } +// } diff --git a/lib/widgets/managed_favorite.dart b/lib/widgets/managed_favorite.dart index 663b2329f..db75b78bc 100644 --- a/lib/widgets/managed_favorite.dart +++ b/lib/widgets/managed_favorite.dart @@ -7,8 +7,8 @@ import 'package:stackduo/providers/providers.dart'; import 'package:stackduo/themes/coin_icon_provider.dart'; import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/constants.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/text_styles.dart'; import 'package:stackduo/utilities/util.dart'; import 'package:stackduo/widgets/custom_buttons/favorite_toggle.dart'; @@ -116,14 +116,11 @@ class _ManagedFavoriteCardState extends ConsumerState { ), Expanded( child: Text( - "${total.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), - ), - decimalPlaces: manager.coin.decimals, - )} ${manager.coin.ticker}", + ref + .watch( + pAmountFormatter(manager.coin), + ) + .format(total), style: STextStyles.itemSubtitle(context), ), ), @@ -159,14 +156,11 @@ class _ManagedFavoriteCardState extends ConsumerState { height: 2, ), Text( - "${total.localizedStringAsFixed( - locale: ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), - ), - decimalPlaces: manager.coin.decimals, - )} ${manager.coin.ticker}", + ref + .watch( + pAmountFormatter(manager.coin), + ) + .format(total), style: STextStyles.itemSubtitle(context), ), ], diff --git a/lib/widgets/textfields/exchange_textfield.dart b/lib/widgets/textfields/exchange_textfield.dart index a32fde585..c904f9f30 100644 --- a/lib/widgets/textfields/exchange_textfield.dart +++ b/lib/widgets/textfields/exchange_textfield.dart @@ -1,14 +1,16 @@ import 'package:flutter/material.dart'; -import 'package:flutter/services.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; import 'package:stackduo/models/exchange/aggregate_currency.dart'; +import 'package:stackduo/providers/global/locale_provider.dart'; +import 'package:stackduo/themes/stack_colors.dart'; +import 'package:stackduo/utilities/amount/amount_input_formatter.dart'; import 'package:stackduo/utilities/assets.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/util.dart'; import 'package:stackduo/widgets/loading_indicator.dart'; -class ExchangeTextField extends StatefulWidget { +class ExchangeTextField extends ConsumerStatefulWidget { const ExchangeTextField({ Key? key, this.borderRadius = 0, @@ -44,10 +46,10 @@ class ExchangeTextField extends StatefulWidget { final AggregateCurrency? currency; @override - State createState() => _ExchangeTextFieldState(); + ConsumerState createState() => _ExchangeTextFieldState(); } -class _ExchangeTextFieldState extends State { +class _ExchangeTextFieldState extends ConsumerState { late final TextEditingController controller; late final FocusNode focusNode; late final TextStyle textStyle; @@ -119,12 +121,17 @@ class _ExchangeTextFieldState extends State { ), ), inputFormatters: [ - // regex to validate a crypto amount with 8 decimal places - TextInputFormatter.withFunction((oldValue, newValue) => - RegExp(r'^([0-9]*[,.]?[0-9]{0,8}|[,.][0-9]{0,8})$') - .hasMatch(newValue.text) - ? newValue - : oldValue), + AmountInputFormatter( + decimals: 8, // todo change this + locale: ref.watch(localeServiceChangeNotifierProvider + .select((value) => value.locale)), + ), + // // regex to validate a crypto amount with 8 decimal places + // TextInputFormatter.withFunction((oldValue, newValue) => + // RegExp(r'^([0-9]*[,.]?[0-9]{0,8}|[,.][0-9]{0,8})$') + // .hasMatch(newValue.text) + // ? newValue + // : oldValue), ], ), ), diff --git a/lib/widgets/transaction_card.dart b/lib/widgets/transaction_card.dart index 60fb0c8e7..21c610002 100644 --- a/lib/widgets/transaction_card.dart +++ b/lib/widgets/transaction_card.dart @@ -8,6 +8,7 @@ import 'package:stackduo/pages/wallet_view/transaction_views/transaction_details import 'package:stackduo/providers/providers.dart'; import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/constants.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/format.dart'; @@ -33,9 +34,11 @@ class TransactionCard extends ConsumerStatefulWidget { class _TransactionCardState extends ConsumerState { late final Transaction _transaction; late final String walletId; + late final bool isTokenTx; late final String prefix; late final String unit; late final Coin coin; + late final dynamic tokenContract; String whatIsIt( TransactionType type, @@ -92,6 +95,7 @@ class _TransactionCardState extends ConsumerState { void initState() { walletId = widget.walletId; _transaction = widget.transaction; + isTokenTx = _transaction.subType == TransactionSubType.ethToken; if (Util.isDesktop) { if (_transaction.type == TransactionType.outgoing) { prefix = "-"; @@ -108,6 +112,8 @@ class _TransactionCardState extends ConsumerState { .getManager(widget.walletId) .coin; + tokenContract = null; + unit = coin.ticker; super.initState(); } @@ -216,9 +222,7 @@ class _TransactionCardState extends ConsumerState { final amount = _transaction.realAmount; return Text( - "$prefix${amount.localizedStringAsFixed( - locale: locale, - )} $unit", + "$prefix${ref.watch(pAmountFormatter(coin)).format(amount, ethContract: tokenContract)}", style: STextStyles.itemSubtitle12(context), ); }, @@ -261,9 +265,8 @@ class _TransactionCardState extends ConsumerState { "$prefix${Amount.fromDecimal( amount.decimal * price, fractionDigits: 2, - ).localizedStringAsFixed( + ).fiatString( locale: locale, - decimalPlaces: 2, )} $baseCurrency", style: STextStyles.label(context), ); diff --git a/lib/widgets/wallet_card.dart b/lib/widgets/wallet_card.dart index 0a14b87c5..6fcc523e2 100644 --- a/lib/widgets/wallet_card.dart +++ b/lib/widgets/wallet_card.dart @@ -17,11 +17,13 @@ class SimpleWalletCard extends ConsumerWidget { const SimpleWalletCard({ Key? key, required this.walletId, + this.contractAddress, this.popPrevious = false, this.desktopNavigatorState, }) : super(key: key); final String walletId; + final String? contractAddress; final bool popPrevious; final NavigatorState? desktopNavigatorState; @@ -81,6 +83,7 @@ class SimpleWalletCard extends ConsumerWidget { ), child: WalletInfoRow( walletId: walletId, + contractAddress: null, onPressedDesktop: Util.isDesktop ? () => _openWallet(context, ref) : null, ), diff --git a/lib/widgets/wallet_info_row/sub_widgets/wallet_info_row_balance.dart b/lib/widgets/wallet_info_row/sub_widgets/wallet_info_row_balance.dart index db4eedcaa..4cb60bef0 100644 --- a/lib/widgets/wallet_info_row/sub_widgets/wallet_info_row_balance.dart +++ b/lib/widgets/wallet_info_row/sub_widgets/wallet_info_row_balance.dart @@ -1,10 +1,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:stackduo/providers/providers.dart'; +import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/amount/amount.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; +import 'package:stackduo/utilities/amount/amount_formatter.dart'; import 'package:stackduo/utilities/text_styles.dart'; -import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/util.dart'; class WalletInfoRowBalance extends ConsumerWidget { @@ -23,24 +23,25 @@ class WalletInfoRowBalance extends ConsumerWidget { .watch(walletsChangeNotifierProvider.notifier) .getManagerProvider(walletId)); - final locale = ref.watch( - localeServiceChangeNotifierProvider.select( - (value) => value.locale, - ), - ); - Amount totalBalance; - int decimals; - String unit; + // EthContract? contract; + // if (contractAddress == null) { totalBalance = manager.balance.total; - unit = manager.coin.ticker; - decimals = manager.coin.decimals; + // if (manager.coin == Coin.firo || manager.coin == Coin.firoTestNet) { + // totalBalance = + // totalBalance + (manager.wallet as FiroWallet).balancePrivate.total; + // } + // contract = null; + // } else { + // final ethWallet = manager.wallet as EthereumWallet; + // contract = MainDB.instance.getEthContractSync(contractAddress!)!; + // totalBalance = ethWallet.getCachedTokenBalance(contract).total; + // } return Text( - "${totalBalance.localizedStringAsFixed( - locale: locale, - decimalPlaces: decimals, - )} $unit", + ref + .watch(pAmountFormatter(manager.coin)) + .format(totalBalance, ethContract: null), style: Util.isDesktop ? STextStyles.desktopTextExtraSmall(context).copyWith( color: Theme.of(context).extension()!.textSubtitle1, diff --git a/lib/widgets/wallet_info_row/sub_widgets/wallet_info_row_coin_icon.dart b/lib/widgets/wallet_info_row/sub_widgets/wallet_info_row_coin_icon.dart index a15857c8c..a49da1cb7 100644 --- a/lib/widgets/wallet_info_row/sub_widgets/wallet_info_row_coin_icon.dart +++ b/lib/widgets/wallet_info_row/sub_widgets/wallet_info_row_coin_icon.dart @@ -3,6 +3,10 @@ import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_svg/svg.dart'; +import 'package:isar/isar.dart'; +import 'package:stackduo/models/isar/exchange_cache/currency.dart'; +import 'package:stackduo/services/exchange/change_now/change_now_exchange.dart'; +import 'package:stackduo/services/exchange/exchange_data_loading_service.dart'; import 'package:stackduo/themes/coin_icon_provider.dart'; import 'package:stackduo/themes/stack_colors.dart'; import 'package:stackduo/utilities/constants.dart'; @@ -13,13 +17,30 @@ class WalletInfoCoinIcon extends ConsumerWidget { Key? key, required this.coin, this.size = 32, + this.contractAddress, }) : super(key: key); final Coin coin; + final String? contractAddress; final double size; @override Widget build(BuildContext context, WidgetRef ref) { + Currency? currency; + if (contractAddress != null) { + currency = ExchangeDataLoadingService.instance.isar.currencies + .where() + .exchangeNameEqualTo(ChangeNowExchange.exchangeName) + .filter() + .tokenContractEqualTo( + contractAddress!, + caseSensitive: false, + ) + .and() + .imageIsNotEmpty() + .findFirstSync(); + } + return Container( width: size, height: size, @@ -33,14 +54,20 @@ class WalletInfoCoinIcon extends ConsumerWidget { ), ), child: Padding( - padding: const EdgeInsets.all(4), - child: SvgPicture.file( - File( - ref.watch(coinIconProvider(coin)), - ), - width: 20, - height: 20, - ), + padding: EdgeInsets.all(size / 5), + child: currency != null && currency.image.isNotEmpty + ? SvgPicture.network( + currency.image, + width: 20, + height: 20, + ) + : SvgPicture.file( + File( + ref.watch(coinIconProvider(coin)), + ), + width: 20, + height: 20, + ), ), ); } diff --git a/lib/widgets/wallet_info_row/wallet_info_row.dart b/lib/widgets/wallet_info_row/wallet_info_row.dart index 93f4f9577..f00425ed2 100644 --- a/lib/widgets/wallet_info_row/wallet_info_row.dart +++ b/lib/widgets/wallet_info_row/wallet_info_row.dart @@ -13,10 +13,12 @@ class WalletInfoRow extends ConsumerWidget { Key? key, required this.walletId, this.onPressedDesktop, + this.contractAddress, this.padding = const EdgeInsets.all(0), }) : super(key: key); final String walletId; + final String? contractAddress; final VoidCallback? onPressedDesktop; final EdgeInsets padding; @@ -26,6 +28,12 @@ class WalletInfoRow extends ConsumerWidget { .watch(walletsChangeNotifierProvider.notifier) .getManagerProvider(walletId)); + // EthContract? contract; + // if (contractAddress != null) { + // contract = ref.watch(mainDBProvider + // .select((value) => value.getEthContractSync(contractAddress!))); + // } + if (Util.isDesktop) { return Padding( padding: padding, @@ -39,19 +47,42 @@ class WalletInfoRow extends ConsumerWidget { children: [ WalletInfoCoinIcon( coin: manager.coin, + contractAddress: contractAddress, ), const SizedBox( width: 12, ), + // contract != null + // ? Row( + // children: [ + // Text( + // contract.name, + // style: + // STextStyles.desktopTextExtraSmall(context) + // .copyWith( + // color: Theme.of(context) + // .extension()! + // .textDark, + // ), + // ), + // const SizedBox( + // width: 4, + // ), + // CoinTickerTag( + // walletId: walletId, + // ), + // ], + // ) + // : Text( - manager.walletName, - style: - STextStyles.desktopTextExtraSmall(context).copyWith( - color: Theme.of(context) - .extension()! - .textDark, - ), - ), + manager.walletName, + style: STextStyles.desktopTextExtraSmall(context) + .copyWith( + color: Theme.of(context) + .extension()! + .textDark, + ), + ), ], ), ), @@ -59,6 +90,7 @@ class WalletInfoRow extends ConsumerWidget { flex: 4, child: WalletInfoRowBalance( walletId: walletId, + contractAddress: contractAddress, ), ), Expanded( @@ -82,6 +114,7 @@ class WalletInfoRow extends ConsumerWidget { children: [ WalletInfoCoinIcon( coin: manager.coin, + contractAddress: contractAddress, ), const SizedBox( width: 12, @@ -91,15 +124,32 @@ class WalletInfoRow extends ConsumerWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: [ + // contract != null + // ? Row( + // children: [ + // Text( + // contract.name, + // style: STextStyles.titleBold12(context), + // ), + // const SizedBox( + // width: 4, + // ), + // CoinTickerTag( + // walletId: walletId, + // ), + // ], + // ) + // : Text( - manager.walletName, - style: STextStyles.titleBold12(context), - ), + manager.walletName, + style: STextStyles.titleBold12(context), + ), const SizedBox( height: 2, ), WalletInfoRowBalance( walletId: walletId, + contractAddress: contractAddress, ), ], ), diff --git a/macos/Flutter/GeneratedPluginRegistrant.swift b/macos/Flutter/GeneratedPluginRegistrant.swift index 5dfa9cfa1..77eddb2e3 100644 --- a/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,14 +5,14 @@ import FlutterMacOS import Foundation -import connectivity_plus_macos +import connectivity_plus import desktop_drop import device_info_plus import devicelocale import flutter_local_notifications import flutter_secure_storage_macos import isar_flutter_libs -import package_info_plus_macos +import package_info_plus import path_provider_foundation import share_plus import shared_preferences_foundation @@ -27,7 +27,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) DevicelocalePlugin.register(with: registry.registrar(forPlugin: "DevicelocalePlugin")) FlutterLocalNotificationsPlugin.register(with: registry.registrar(forPlugin: "FlutterLocalNotificationsPlugin")) - FlutterSecureStorageMacosPlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStorageMacosPlugin")) + FlutterSecureStoragePlugin.register(with: registry.registrar(forPlugin: "FlutterSecureStoragePlugin")) IsarFlutterLibsPlugin.register(with: registry.registrar(forPlugin: "IsarFlutterLibsPlugin")) FLTPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlusPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) diff --git a/pubspec.lock b/pubspec.lock index ac75e9761..171a10c62 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,26 +5,18 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: "4897882604d919befd350648c7f91926a9d5de99e67b455bf0917cc2362f4bb8" + sha256: ae92f5d747aee634b87f89d9946000c2de774be1d6ac3e58268224348cd0101a url: "https://pub.dev" source: hosted - version: "47.0.0" + version: "61.0.0" analyzer: dependency: "direct dev" description: name: analyzer - sha256: "690e335554a8385bc9d787117d9eb52c0c03ee207a607e593de3c9d71b1cfe80" + sha256: ea3d8652bda62982addfd92fdc2d0214e5f82e43325104990d4f4c4a2a313562 url: "https://pub.dev" source: hosted - version: "4.7.0" - animations: - dependency: "direct main" - description: - name: animations - sha256: fe8a6bdca435f718bb1dc8a11661b2c22504c6da40ef934cee8327ed77934164 - url: "https://pub.dev" - source: hosted - version: "2.0.7" + version: "5.13.0" another_flushbar: dependency: "direct main" description: @@ -33,14 +25,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.12.29" - app_settings: - dependency: "direct main" - description: - name: app_settings - sha256: "66715a323ac36d6c8201035ba678777c0d2ea869e4d7064300d95af10c3bb8cb" - url: "https://pub.dev" - source: hosted - version: "4.2.0" archive: dependency: "direct main" description: @@ -69,24 +53,24 @@ packages: dependency: "direct main" description: name: async - sha256: bfe67ef28df125b7dddcea62755991f807aa39a2492a23e1550161692950bbe0 + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" url: "https://pub.dev" source: hosted - version: "2.10.0" + version: "2.11.0" barcode_scan2: dependency: "direct main" description: name: barcode_scan2 - sha256: f9af9252b8f3f5fa446f5456fd45f8871d09f883d8389a1d608b39231bfbc3fa + sha256: "0b0625d27841a21e36e896195d86b2aada335e3c486f63647cce701495718e16" url: "https://pub.dev" source: hosted - version: "4.2.3" + version: "4.2.4" bech32: dependency: "direct main" description: path: "." - ref: "22279d4bb24ed541b431acd269a1bc50af0f36a0" - resolved-ref: "22279d4bb24ed541b431acd269a1bc50af0f36a0" + ref: b6d2a5b4cd17311d917787c0f9505f04932659b1 + resolved-ref: b6d2a5b4cd17311d917787c0f9505f04932659b1 url: "https://github.com/cypherstack/bech32.git" source: git version: "0.2.1" @@ -102,8 +86,8 @@ packages: dependency: "direct main" description: path: "." - ref: "3bef5acc21340f3cc78df0ad1dce5868a3ed68a5" - resolved-ref: "3bef5acc21340f3cc78df0ad1dce5868a3ed68a5" + ref: "0cd6d54e2860bea68fc50c801cb9db2a760192fb" + resolved-ref: "0cd6d54e2860bea68fc50c801cb9db2a760192fb" url: "https://github.com/cypherstack/stack-bip39.git" source: git version: "1.0.6" @@ -111,26 +95,17 @@ packages: dependency: "direct main" description: path: "." - ref: "38847255d035c0f6ec5bc93d19130ec804cf90e9" - resolved-ref: "38847255d035c0f6ec5bc93d19130ec804cf90e9" + ref: "081ca1863c2feba00c35bb5b297902f12f499941" + resolved-ref: "081ca1863c2feba00c35bb5b297902f12f499941" url: "https://github.com/cypherstack/bip47.git" source: git version: "2.0.0" - bitbox: - dependency: "direct main" - description: - path: "." - ref: ea65073efbaf395a5557e8cd7bd72f195cd7eb11 - resolved-ref: ea65073efbaf395a5557e8cd7bd72f195cd7eb11 - url: "https://github.com/Quppy/bitbox-flutter.git" - source: git - version: "1.0.1" bitcoindart: dependency: "direct main" description: path: "." - ref: "004d6f82dff7389b561e5078b4649adcd2d9c10f" - resolved-ref: "004d6f82dff7389b561e5078b4649adcd2d9c10f" + ref: af6d6c27edfe2e7cc35772ed2684eb4cc826f0e4 + resolved-ref: af6d6c27edfe2e7cc35772ed2684eb4cc826f0e4 url: "https://github.com/cypherstack/bitcoindart.git" source: git version: "3.0.1" @@ -170,10 +145,10 @@ packages: dependency: transitive description: name: build_daemon - sha256: "6bc5544ea6ce4428266e7ea680e945c68806c4aae2da0eb5e9ccf38df8d6acbf" + sha256: "5f02d73eb2ba16483e693f80bee4f088563a820e47d1027d4cdfe62b5bb43e65" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "4.0.0" build_resolvers: dependency: transitive description: @@ -186,10 +161,10 @@ packages: dependency: "direct dev" description: name: build_runner - sha256: "93f05c041932674be039b0a2323d6cf57e5f2bbf884a3c0382f9e53fc45ebace" + sha256: "5e1929ad37d48bd382b124266cb8e521de5548d406a45a5ae6656c13dab73e37" url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.4.5" build_runner_core: dependency: transitive description: @@ -218,10 +193,10 @@ packages: dependency: transitive description: name: characters - sha256: e6a326c8af69605aec75ed6c187d06b349707a27fbff8222ca9cc2cff167975c + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" url: "https://pub.dev" source: hosted - version: "1.2.1" + version: "1.3.0" checked_yaml: dependency: transitive description: @@ -250,42 +225,26 @@ packages: dependency: transitive description: name: code_builder - sha256: "0d43dd1288fd145de1ecc9a3948ad4a6d5a82f0a14c4fdd0892260787d975cbe" + sha256: "4ad01d6e56db961d29661561effde45e519939fdaeb46c351275b182eac70189" url: "https://pub.dev" source: hosted - version: "4.4.0" + version: "4.5.0" collection: dependency: transitive description: name: collection - sha256: cfc915e6923fe5ce6e153b0723c753045de46de1b4d63771530504004a45fae0 + sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" url: "https://pub.dev" source: hosted - version: "1.17.0" + version: "1.17.1" connectivity_plus: dependency: "direct main" description: name: connectivity_plus - sha256: e18bbd0243342ceca6fb33718fd2737c468c1a881ad7fed4b0a47258b5838d9d + sha256: "8599ae9edca5ff96163fca3e36f8e481ea917d1e71cdad912c084b5579913f34" url: "https://pub.dev" source: hosted - version: "2.3.6+1" - connectivity_plus_linux: - dependency: transitive - description: - name: connectivity_plus_linux - sha256: "3caf859d001f10407b8e48134c761483e4495ae38094ffcca97193f6c271f5e2" - url: "https://pub.dev" - source: hosted - version: "1.3.1" - connectivity_plus_macos: - dependency: transitive - description: - name: connectivity_plus_macos - sha256: "488d2de1e47e1224ad486e501b20b088686ba1f4ee9c4420ecbc3b9824f0b920" - url: "https://pub.dev" - source: hosted - version: "1.2.6" + version: "4.0.1" connectivity_plus_platform_interface: dependency: transitive description: @@ -294,38 +253,22 @@ packages: url: "https://pub.dev" source: hosted version: "1.2.4" - connectivity_plus_web: - dependency: transitive - description: - name: connectivity_plus_web - sha256: "81332be1b4baf8898fed17bb4fdef27abb7c6fd990bf98c54fd978478adf2f1a" - url: "https://pub.dev" - source: hosted - version: "1.2.5" - connectivity_plus_windows: - dependency: transitive - description: - name: connectivity_plus_windows - sha256: "535b0404b4d5605c4dd8453d67e5d6d2ea0dd36e3b477f50f31af51b0aeab9dd" - url: "https://pub.dev" - source: hosted - version: "1.2.2" convert: dependency: transitive description: name: convert - sha256: "196284f26f69444b7f5c50692b55ec25da86d9e500451dc09333bf2e3ad69259" + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.1.1" coverage: dependency: transitive description: name: coverage - sha256: "525ac94733f9ce82507a050bfd62ad89eb1dcbc56308e1e2e17ab11abeee4a75" + sha256: "2fb815080e44a09b85e0f2ca8a820b15053982b2e714b59267719e8a9ff17097" url: "https://pub.dev" source: hosted - version: "1.5.0" + version: "1.6.3" cross_file: dependency: transitive description: @@ -463,34 +406,34 @@ packages: dependency: "direct main" description: name: device_info_plus - sha256: "8d99246809e63d93e4e68fade79495d81f445ad735bde2b129b19c0adddcaf1a" + sha256: "2c35b6d1682b028e42d07b3aee4b98fa62996c10bc12cb651ec856a80d6a761b" url: "https://pub.dev" source: hosted - version: "7.0.1" + version: "9.0.2" device_info_plus_platform_interface: dependency: transitive description: name: device_info_plus_platform_interface - sha256: "8b8b65e598b84fdb82c26cf9b3f05a6c4978636e99b0c070bae5905a24728199" + sha256: d3b01d5868b50ae571cd1dc6e502fc94d956b665756180f7b16ead09e836fd64 url: "https://pub.dev" source: hosted - version: "6.0.1" + version: "7.0.0" devicelocale: dependency: "direct main" description: name: devicelocale - sha256: "5fd46b8c2a987b1c14b1551433be1974dbca5ec6ab00e7d53288b5197a21863e" + sha256: "09cc0bce937b34dafcaac0b2a9b350d763dd16770f15e59560b7abaaaad3d65b" url: "https://pub.dev" source: hosted - version: "0.5.5" + version: "0.6.0" dropdown_button2: dependency: "direct main" description: name: dropdown_button2 - sha256: "1a00301a1ec87666b1f1938f373865e3f5fb3056e4e36e1b3c2c0dc0c11f4737" + sha256: "107444581478342c6511040c2eb52850748400df4f3295df3da8be75693180a5" url: "https://pub.dev" source: hosted - version: "1.7.2" + version: "2.1.4" emojis: dependency: "direct main" description: @@ -551,10 +494,10 @@ packages: dependency: "direct main" description: name: file_picker - sha256: d090ae03df98b0247b82e5928f44d1b959867049d18d73635e2e0bc3f49542b9 + sha256: b1729fc96627dd44012d0a901558177418818d6bd428df59dcfeb594e5f66432 url: "https://pub.dev" source: hosted - version: "5.2.5" + version: "5.3.2" fixnum: dependency: transitive description: @@ -563,14 +506,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.1" - flare_flutter: - dependency: "direct main" - description: - name: flare_flutter - sha256: "99d63c60f00fac81249ce6410ee015d7b125c63d8278a30da81edf3317a1f6a0" - url: "https://pub.dev" - source: hosted - version: "3.0.2" flutter: dependency: "direct main" description: flutter @@ -656,10 +591,10 @@ packages: dependency: transitive description: name: flutter_plugin_android_lifecycle - sha256: "60fc7b78455b94e6de2333d2f95196d32cf5c22f4b0b0520a628804cb463503b" + sha256: "950e77c2bbe1692bc0874fc7fb491b96a4dc340457f4ea1641443d0a6c1ea360" url: "https://pub.dev" source: hosted - version: "2.0.7" + version: "2.0.15" flutter_riverpod: dependency: "direct main" description: @@ -672,18 +607,18 @@ packages: dependency: "direct main" description: name: flutter_rounded_date_picker - sha256: "369f7c63c1518d24c63f5da889ea9a6fb9a0a6f105ba9d22ccbba7665475784f" + sha256: e6aa2dc5d3b44e8bbe85ef901be69eac59ba4136427f11f4c8b2a303e1e774e7 url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.4" flutter_secure_storage: dependency: "direct main" description: name: flutter_secure_storage - sha256: "5abe3d5c25ab435e48c47fb61bac25606062a305fac637c2f020e25abd30014a" + sha256: "98352186ee7ad3639ccc77ad7924b773ff6883076ab952437d20f18a61f0a7c5" url: "https://pub.dev" source: hosted - version: "5.1.2" + version: "8.0.0" flutter_secure_storage_linux: dependency: transitive description: @@ -696,10 +631,10 @@ packages: dependency: transitive description: name: flutter_secure_storage_macos - sha256: "388f76fd0f093e7415a39ec4c169ae7cceeee6d9f9ba529d788a13f2be4de7bd" + sha256: "083add01847fc1c80a07a08e1ed6927e9acd9618a35e330239d4422cd2a58c50" url: "https://pub.dev" source: hosted - version: "1.1.2" + version: "3.0.0" flutter_secure_storage_platform_interface: dependency: transitive description: @@ -720,18 +655,10 @@ packages: dependency: transitive description: name: flutter_secure_storage_windows - sha256: ca89c8059cf439985aa83c59619b3674c7ef6cc2e86943d169a7369d6a69cab5 + sha256: fc2910ec9b28d60598216c29ea763b3a96c401f0ce1d13cdf69ccb0e5c93c3ee url: "https://pub.dev" source: hosted - version: "1.1.3" - flutter_spinkit: - dependency: "direct main" - description: - name: flutter_spinkit - sha256: "77a2117c0517ff909221f3160b8eb20052ab5216107581168af574ac1f05dff8" - url: "https://pub.dev" - source: hosted - version: "5.1.0" + version: "2.0.0" flutter_svg: dependency: "direct main" description: @@ -762,10 +689,10 @@ packages: dependency: transitive description: name: frontend_server_client - sha256: "4f4a162323c86ffc1245765cfe138872b8f069deb42f7dbb36115fa27f31469b" + sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "3.2.0" fuchsia_remote_debug_protocol: dependency: transitive description: flutter @@ -783,10 +710,10 @@ packages: dependency: "direct main" description: name: google_fonts - sha256: e70521755a6b08c6bde14ddae27dff5bf21010033888fc61da6c595f8a9f58c1 + sha256: "6b6f10f0ce3c42f6552d1c70d2c28d764cf22bb487f50f66cca31dcd5194f4d6" url: "https://pub.dev" source: hosted - version: "2.3.3" + version: "4.0.4" graphs: dependency: transitive description: @@ -823,10 +750,10 @@ packages: dependency: "direct dev" description: name: hive_generator - sha256: "81fd20125cb2ce8fd23623d7744ffbaf653aae93706c9bd3bf7019ea0ace3938" + sha256: "65998cc4d2cd9680a3d9709d893d2f6bb15e6c1f92626c3f1fa650b4b3281521" url: "https://pub.dev" source: hosted - version: "1.1.3" + version: "2.0.0" hive_test: dependency: "direct dev" description: @@ -932,10 +859,10 @@ packages: dependency: transitive description: name: js - sha256: "5528c2f391ededb7775ec1daa69e65a2d61276f7552de2b5f7b8d34ee9fd4ab7" + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 url: "https://pub.dev" source: hosted - version: "0.6.5" + version: "0.6.7" json_annotation: dependency: transitive description: @@ -944,14 +871,6 @@ packages: url: "https://pub.dev" source: hosted version: "4.8.0" - jsonrpc2: - dependency: "direct main" - description: - name: jsonrpc2 - sha256: "98a71b834240ca6d003499ab8f28d1c35aa8ca90235b51e972e0f70596b86bd3" - url: "https://pub.dev" - source: hosted - version: "3.0.1" keyboard_dismisser: dependency: "direct main" description: @@ -988,18 +907,18 @@ packages: dependency: "direct main" description: name: lottie - sha256: "893da7a0022ec2fcaa616f34529a081f617e86cc501105b856e5a3184c58c7c2" + sha256: f461105d3a35887b27089abf9c292334478dd292f7b47ecdccb6ae5c37a22c80 url: "https://pub.dev" source: hosted - version: "1.4.3" + version: "2.4.0" matcher: dependency: transitive description: name: matcher - sha256: "16db949ceee371e9b99d22f88fa3a73c4e59fd0afed0bd25fc336eb76c198b72" + sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb" url: "https://pub.dev" source: hosted - version: "0.12.13" + version: "0.12.15" material_color_utilities: dependency: transitive description: @@ -1012,10 +931,10 @@ packages: dependency: transitive description: name: meta - sha256: "6c268b42ed578a53088d834796959e4a1814b5e9e164f147f580a386e5decf42" + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.9.1" mime: dependency: transitive description: @@ -1044,10 +963,10 @@ packages: dependency: "direct dev" description: name: mockito - sha256: "2a8a17b82b1bde04d514e75d90d634a0ac23f6cb4991f6098009dd56836aeafe" + sha256: "7d5b53bcd556c1bc7ffbe4e4d5a19c3e112b7e925e9e172dd7c6ad0630812616" url: "https://pub.dev" source: hosted - version: "5.3.2" + version: "5.4.2" mocktail: dependency: transitive description: @@ -1092,58 +1011,26 @@ packages: dependency: "direct main" description: name: package_info_plus - sha256: f62d7253edc197fe3c88d7c2ddab82d68f555e778d55390ccc3537eca8e8d637 - url: "https://pub.dev" - source: hosted - version: "1.4.3+1" - package_info_plus_linux: - dependency: transitive - description: - name: package_info_plus_linux - sha256: "04b575f44233d30edbb80a94e57cad9107aada334fc02aabb42b6becd13c43fc" - url: "https://pub.dev" - source: hosted - version: "1.0.5" - package_info_plus_macos: - dependency: transitive - description: - name: package_info_plus_macos - sha256: a2ad8b4acf4cd479d4a0afa5a74ea3f5b1c7563b77e52cc32b3ee6956d5482a6 + sha256: ceb027f6bc6a60674a233b4a90a7658af1aebdea833da0b5b53c1e9821a78c7b url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "4.0.2" package_info_plus_platform_interface: dependency: transitive description: name: package_info_plus_platform_interface - sha256: f7a0c8f1e7e981bc65f8b64137a53fd3c195b18d429fba960babc59a5a1c7ae8 - url: "https://pub.dev" - source: hosted - version: "1.0.2" - package_info_plus_web: - dependency: transitive - description: - name: package_info_plus_web - sha256: f0829327eb534789e0a16ccac8936a80beed4e2401c4d3a74f3f39094a822d3b - url: "https://pub.dev" - source: hosted - version: "1.0.6" - package_info_plus_windows: - dependency: transitive - description: - name: package_info_plus_windows - sha256: "79524f11c42dd9078b96d797b3cf79c0a2883a50c4920dc43da8562c115089bc" + sha256: "9bc8ba46813a4cc42c66ab781470711781940780fd8beddd0c3da62506d3a6c6" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.0.1" path: dependency: transitive description: name: path - sha256: db9d4f58c908a4ba5953fcee2ae317c94889433e5024c27ce74a37f94267945b + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" url: "https://pub.dev" source: hosted - version: "1.8.2" + version: "1.8.3" path_drawing: dependency: transitive description: @@ -1164,10 +1051,10 @@ packages: dependency: "direct main" description: name: path_provider - sha256: dcea5feb97d8abf90cab9e9030b497fb7c3cbf26b7a1fe9e3ef7dcb0a1ddec95 + sha256: "3087813781ab814e4157b172f1a11c46be20179fcc9bea043e0fba36bc0acaa2" url: "https://pub.dev" source: hosted - version: "2.0.12" + version: "2.0.15" path_provider_android: dependency: transitive description: @@ -1204,10 +1091,10 @@ packages: dependency: transitive description: name: path_provider_windows - sha256: bcabbe399d4042b8ee687e17548d5d3f527255253b4a639f5f8d2094a9c2b45c + sha256: "1cb68ba4cd3a795033de62ba1b7b4564dace301f952de6bfb3cd91b202b6ee96" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.7" permission_handler: dependency: "direct main" description: @@ -1268,10 +1155,10 @@ packages: dependency: transitive description: name: plugin_platform_interface - sha256: dbf0f707c78beedc9200146ad3cb0ab4d5da13c246336987be6940f026500d3a + sha256: "6a2128648c854906c53fa8e33986fc0247a1116122f9534dd20e3ab9e16a32bc" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.4" pointycastle: dependency: "direct main" description: @@ -1324,20 +1211,20 @@ packages: dependency: transitive description: name: qr - sha256: "5c4208b4dc0d55c3184d10d83ee0ded6212dc2b5e2ba17c5a0c0aab279128d21" + sha256: "64957a3930367bf97cc211a5af99551d630f2f4625e38af10edd6b19131b64b3" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "3.0.1" qr_flutter: dependency: "direct main" description: name: qr_flutter - sha256: c5c121c54cb6dd837b9b9d57eb7bc7ec6df4aee741032060c8833a678c80b87e + sha256: "5095f0fc6e3f71d08adef8feccc8cea4f12eec18a2e31c2e8d82cb6019f4b097" url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "4.1.0" rational: - dependency: "direct main" + dependency: transitive description: name: rational sha256: ba58e9e18df9abde280e8b10051e4bce85091e41e8e7e411b6cde2e738d357cf @@ -1352,22 +1239,6 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.3" - rpc_dispatcher: - dependency: transitive - description: - name: rpc_dispatcher - sha256: b6ddcae58b3fbc1172a7c2dc8ab30d2f1090db8c7a728e4405bd10142dc48a47 - url: "https://pub.dev" - source: hosted - version: "1.0.1" - rpc_exceptions: - dependency: transitive - description: - name: rpc_exceptions - sha256: "09b2e5f3f805b65a262b40e3410d79fb916ff5be2a65e2f6b8b0eeef7aa965b7" - url: "https://pub.dev" - source: hosted - version: "1.0.1" rxdart: dependency: "direct main" description: @@ -1380,18 +1251,18 @@ packages: dependency: "direct main" description: name: share_plus - sha256: "8c6892037b1824e2d7e8f59d54b3105932899008642e6372e5079c6939b4b625" + sha256: ed3fcea4f789ed95913328e629c0c53e69e80e08b6c24542f1b3576046c614e8 url: "https://pub.dev" source: hosted - version: "6.3.1" + version: "7.0.2" share_plus_platform_interface: dependency: transitive description: name: share_plus_platform_interface - sha256: "82ddd4ab9260c295e6e39612d4ff00390b9a7a21f1bb1da771e2f232d80ab8a1" + sha256: "0c6e61471bd71b04a138b8b588fa388e66d8b005e6f2deda63371c5c505a0981" url: "https://pub.dev" source: hosted - version: "3.2.0" + version: "3.2.1" shared_preferences: dependency: transitive description: @@ -1537,8 +1408,8 @@ packages: dependency: "direct main" description: path: "." - ref: e4b08d2b8965a5ae49bd57f598fa9011dd0c25e9 - resolved-ref: e4b08d2b8965a5ae49bd57f598fa9011dd0c25e9 + ref: ee1da8a9ba1cbeb50c5b354ea1fd5a25b7c5a3ed + resolved-ref: ee1da8a9ba1cbeb50c5b354ea1fd5a25b7c5a3ed url: "https://github.com/cypherstack/stack_wallet_backup.git" source: git version: "0.0.1" @@ -1602,26 +1473,26 @@ packages: dependency: transitive description: name: test - sha256: a5fcd2d25eeadbb6589e80198a47d6a464ba3e2049da473943b8af9797900c2d + sha256: "3dac9aecf2c3991d09b9cdde4f98ded7b30804a88a0d7e4e7e1678e78d6b97f4" url: "https://pub.dev" source: hosted - version: "1.22.0" + version: "1.24.1" test_api: dependency: transitive description: name: test_api - sha256: ad540f65f92caa91bf21dfc8ffb8c589d6e4dc0c2267818b4cc2792857706206 + sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb url: "https://pub.dev" source: hosted - version: "0.4.16" + version: "0.5.1" test_core: dependency: transitive description: name: test_core - sha256: "0ef9755ec6d746951ba0aabe62f874b707690b5ede0fecc818b138fcc9b14888" + sha256: "5138dbffb77b2289ecb12b81c11ba46036590b72a64a7a90d6ffb880f1a29e93" url: "https://pub.dev" source: hosted - version: "0.4.20" + version: "0.5.1" time: dependency: transitive description: @@ -1654,14 +1525,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.1" - toast: - dependency: "direct main" - description: - name: toast - sha256: bedb96d37030acf9c4c06a7ac2ffd1f1f365e780cda9458c9e24e6a1e1ab6fd9 - url: "https://pub.dev" - source: hosted - version: "0.1.5" tuple: dependency: "direct main" description: @@ -1714,10 +1577,10 @@ packages: dependency: transitive description: name: url_launcher_linux - sha256: "318c42cba924e18180c029be69caf0a1a710191b9ec49bb42b5998fdcccee3cc" + sha256: "207f4ddda99b95b4d4868320a352d374b0b7e05eefad95a4a26f57da413443f5" url: "https://pub.dev" source: hosted - version: "3.0.2" + version: "3.0.5" url_launcher_macos: dependency: transitive description: @@ -1730,26 +1593,26 @@ packages: dependency: transitive description: name: url_launcher_platform_interface - sha256: "4eae912628763eb48fc214522e58e942fd16ce195407dbf45638239523c759a6" + sha256: bfdfa402f1f3298637d71ca8ecfe840b4696698213d5346e9d12d4ab647ee2ea url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.3" url_launcher_web: dependency: transitive description: name: url_launcher_web - sha256: "44d79408ce9f07052095ef1f9a693c258d6373dc3944249374e30eff7219ccb0" + sha256: "6bb1e5d7fe53daf02a8fee85352432a40b1f868a81880e99ec7440113d5cfcab" url: "https://pub.dev" source: hosted - version: "2.0.14" + version: "2.0.17" url_launcher_windows: dependency: transitive description: name: url_launcher_windows - sha256: b6217370f8eb1fd85c8890c539f5a639a01ab209a36db82c921ebeacefc7a615 + sha256: "254708f17f7c20a9c8c471f67d86d76d4a3f9c1591aad1e15292008aceb82771" url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "3.0.6" uuid: dependency: "direct main" description: @@ -1770,10 +1633,10 @@ packages: dependency: transitive description: name: vm_service - sha256: e7fb6c2282f7631712b69c19d1bff82f3767eea33a2321c14fa59ad67ea391c7 + sha256: f6deed8ed625c52864792459709183da231ebf66ff0cf09e69b573227c377efe url: "https://pub.dev" source: hosted - version: "9.4.0" + version: "11.3.0" wakelock: dependency: "direct main" description: @@ -1807,13 +1670,14 @@ packages: source: hosted version: "0.4.0" wakelock_windows: - dependency: transitive + dependency: "direct overridden" description: - name: wakelock_windows - sha256: "857f77b3fe6ae82dd045455baa626bc4b93cb9bb6c86bf3f27c182167c3a5567" - url: "https://pub.dev" - source: hosted - version: "0.2.1" + path: wakelock_windows + ref: "2a9bca63a540771f241d688562351482b2cf234c" + resolved-ref: "2a9bca63a540771f241d688562351482b2cf234c" + url: "https://github.com/diegotori/wakelock" + source: git + version: "0.2.2" watcher: dependency: transitive description: @@ -1834,10 +1698,10 @@ packages: dependency: transitive description: name: webdriver - sha256: ef67178f0cc7e32c1494645b11639dd1335f1d18814aa8435113a92e9ef9d841 + sha256: "3c923e918918feeb90c4c9fdf1fe39220fa4c0e8e2c0fffaded174498ef86c49" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.2" webkit_inspection_protocol: dependency: transitive description: @@ -1858,10 +1722,18 @@ packages: dependency: transitive description: name: win32 - sha256: c9ebe7ee4ab0c2194e65d3a07d8c54c5d00bb001b76081c4a04cdb8448b59e46 + sha256: "7dacfda1edcca378031db9905ad7d7bd56b29fd1a90b0908b71a52a12c41e36b" + url: "https://pub.dev" + source: hosted + version: "5.0.3" + win32_registry: + dependency: transitive + description: + name: win32_registry + sha256: e4506d60b7244251bc59df15656a3093501c37fb5af02105a944d73eb95be4c9 url: "https://pub.dev" source: hosted - version: "3.1.3" + version: "1.1.1" window_size: dependency: "direct main" description: @@ -1912,5 +1784,5 @@ packages: source: hosted version: "1.0.0" sdks: - dart: ">=2.18.5 <3.0.0" - flutter: ">=3.3.0" + dart: ">=3.0.2 <4.0.0" + flutter: ">=3.10.5" diff --git a/pubspec.yaml b/pubspec.yaml index 1c236f939..245e4a6d5 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -14,7 +14,8 @@ description: Stack Duo version: 1.0.8+13 environment: - sdk: ">=2.17.0 <3.0.0" + sdk: ">=3.0.2 <4.0.0" + flutter: ^3.10.5 dependencies: flutter: @@ -34,35 +35,27 @@ dependencies: path: ./crypto_plugins/flutter_libmonero/cw_core -# firo_flutter: -# git: -# url: https://github.com/cypherstack/firo_flutter.git -# ref: update - # path: ./crypto_plugins/firo_flutter - bitcoindart: git: url: https://github.com/cypherstack/bitcoindart.git - ref: 004d6f82dff7389b561e5078b4649adcd2d9c10f + ref: af6d6c27edfe2e7cc35772ed2684eb4cc826f0e4 stack_wallet_backup: git: url: https://github.com/cypherstack/stack_wallet_backup.git - ref: e4b08d2b8965a5ae49bd57f598fa9011dd0c25e9 + ref: ee1da8a9ba1cbeb50c5b354ea1fd5a25b7c5a3ed bip47: git: url: https://github.com/cypherstack/bip47.git - ref: 38847255d035c0f6ec5bc93d19130ec804cf90e9 + ref: 081ca1863c2feba00c35bb5b297902f12f499941 # Utility plugins -# provider: ^6.0.1 - http: ^0.13.4 + http: ^0.13.0 local_auth: ^1.1.10 permission_handler: ^10.0.0 flutter_local_notifications: ^9.4.0 rxdart: ^0.27.3 -# filesystem_picker: ^3.0.0-beta.1 zxcvbn: ^1.0.0 dart_numerics: ^0.0.6 @@ -75,63 +68,51 @@ dependencies: bip39: git: url: https://github.com/cypherstack/stack-bip39.git - ref: 3bef5acc21340f3cc78df0ad1dce5868a3ed68a5 - bitbox: - git: - url: https://github.com/Quppy/bitbox-flutter.git - ref: ea65073efbaf395a5557e8cd7bd72f195cd7eb11 + ref: 0cd6d54e2860bea68fc50c801cb9db2a760192fb bip32: ^2.0.0 bech32: git: url: https://github.com/cypherstack/bech32.git - ref: 22279d4bb24ed541b431acd269a1bc50af0f36a0 + ref: b6d2a5b4cd17311d917787c0f9505f04932659b1 bs58check: ^1.0.2 # Storage plugins - flutter_secure_storage: ^5.0.2 + flutter_secure_storage: ^8.0.0 hive: ^2.0.5 hive_flutter: ^1.1.0 - path_provider: ^2.0.8 + path_provider: ^2.0.15 # UI/Component plugins flutter_native_splash: ^2.2.4 - animations: ^2.0.2 - toast: ^0.1.5 - flare_flutter: ^3.0.2 - google_fonts: ^2.2.0 + google_fonts: ^4.0.4 url_launcher: ^6.0.5 flutter_svg: ^1.0.1 flutter_feather_icons: ^2.0.0+1 - flutter_spinkit: ^5.1.0 decimal: ^2.1.0 event_bus: ^2.0.0 uuid: ^3.0.5 - flutter_rounded_date_picker: ^3.0.1 + flutter_rounded_date_picker: ^3.0.4 crypto: ^3.0.2 - jsonrpc2: ^3.0.1 - barcode_scan2: ^4.2.0 - app_settings: ^4.1.1 + barcode_scan2: ^4.2.4 wakelock: ^0.6.2 intl: ^0.17.0 - devicelocale: ^0.5.0 - device_info_plus: ^7.0.1 + devicelocale: ^0.6.0 + device_info_plus: ^9.0.2 keyboard_dismisser: ^3.0.0 another_flushbar: ^1.10.28 tuple: ^2.0.0 flutter_riverpod: ^1.0.3 - qr_flutter: ^4.0.0 - share_plus: ^6.3.0 + qr_flutter: ^4.1.0 + share_plus: ^7.0.2 emojis: ^0.9.9 pointycastle: ^3.6.0 - package_info_plus: ^1.4.2 - lottie: ^1.3.0 -# shared_preferences: ^2.0.15 - file_picker: ^5.0.1 - connectivity_plus: 2.3.6+1 -# document_file_save_plus: ^1.0.5 + package_info_plus: ^4.0.2 + lottie: ^2.3.2 + file_picker: ^5.3.1 + connectivity_plus: ^4.0.1 isar: 3.0.5 isar_flutter_libs: 3.0.5 # contains the binaries - dropdown_button2: 1.7.2 + dropdown_button2: ^2.1.3 string_validator: ^0.3.0 equatable: ^2.0.5 async: ^2.10.0 @@ -139,7 +120,6 @@ dependencies: dart_bs58: ^1.0.1 dart_bs58check: ^3.0.2 hex: ^0.2.0 - rational: ^2.2.2 archive: ^3.3.2 desktop_drop: ^0.4.1 @@ -150,13 +130,13 @@ dev_dependencies: sdk: flutter build_runner: ^2.1.7 flutter_launcher_icons: ^0.11.0 - hive_generator: ^1.1.2 + hive_generator: ^2.0.0 dependency_validator: ^3.1.2 hive_test: ^1.0.1 - mockito: ^5.1.0 + mockito: ^5.4.1 mockingjay: ^0.2.0 # lint: ^1.10.0 - analyzer: ^4.6.0 + analyzer: ^5.13.0 import_sorter: ^4.6.0 flutter_lints: ^2.0.1 isar_generator: 3.0.5 @@ -182,11 +162,21 @@ flutter_native_splash: android_disable_fullscreen: true dependency_overrides: - bip39: + + # required for dart 3, at least until a fix is merged upstream + wakelock_windows: git: - url: https://github.com/cypherstack/stack-bip39.git - ref: 3bef5acc21340f3cc78df0ad1dce5868a3ed68a5 - crypto: 3.0.2 + url: https://github.com/diegotori/wakelock + ref: 2a9bca63a540771f241d688562351482b2cf234c + path: wakelock_windows + + # required for libmonero - can remove once libmonero has been updated, PR has been merged in swb + stack_wallet_backup: + git: + url: https://github.com/cypherstack/stack_wallet_backup.git + ref: ee1da8a9ba1cbeb50c5b354ea1fd5a25b7c5a3ed + + # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec diff --git a/test/cached_electrumx_test.mocks.dart b/test/cached_electrumx_test.mocks.dart index 598fefec5..79b13f9fd 100644 --- a/test/cached_electrumx_test.mocks.dart +++ b/test/cached_electrumx_test.mocks.dart @@ -1,15 +1,16 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/cached_electrumx_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i4; -import 'dart:ui' as _i8; import 'package:decimal/decimal.dart' as _i2; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/electrumx_rpc/electrumx.dart' as _i3; +import 'package:stackduo/utilities/amount/amount_unit.dart' as _i8; import 'package:stackduo/utilities/enums/backup_frequency_type.dart' as _i7; +import 'package:stackduo/utilities/enums/coin_enum.dart' as _i9; import 'package:stackduo/utilities/enums/sync_type_enum.dart' as _i6; import 'package:stackduo/utilities/prefs.dart' as _i5; @@ -782,7 +783,55 @@ class MockPrefs extends _i1.Mock implements _i5.Prefs { returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - void addListener(_i8.VoidCallback? listener) => super.noSuchMethod( + _i8.AmountUnit amountUnit(_i9.Coin? coin) => (super.noSuchMethod( + Invocation.method( + #amountUnit, + [coin], + ), + returnValue: _i8.AmountUnit.normal, + ) as _i8.AmountUnit); + @override + void updateAmountUnit({ + required _i9.Coin? coin, + required _i8.AmountUnit? amountUnit, + }) => + super.noSuchMethod( + Invocation.method( + #updateAmountUnit, + [], + { + #coin: coin, + #amountUnit: amountUnit, + }, + ), + returnValueForMissingStub: null, + ); + @override + int maxDecimals(_i9.Coin? coin) => (super.noSuchMethod( + Invocation.method( + #maxDecimals, + [coin], + ), + returnValue: 0, + ) as int); + @override + void updateMaxDecimals({ + required _i9.Coin? coin, + required int? maxDecimals, + }) => + super.noSuchMethod( + Invocation.method( + #updateMaxDecimals, + [], + { + #coin: coin, + #maxDecimals: maxDecimals, + }, + ), + returnValueForMissingStub: null, + ); + @override + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -790,7 +839,7 @@ class MockPrefs extends _i1.Mock implements _i5.Prefs { returnValueForMissingStub: null, ); @override - void removeListener(_i8.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/electrumx_test.dart b/test/electrumx_test.dart index 8d29f63e9..d8f3022fa 100644 --- a/test/electrumx_test.dart +++ b/test/electrumx_test.dart @@ -1,1303 +1,1303 @@ -import 'package:flutter_test/flutter_test.dart'; -import 'package:mockito/annotations.dart'; -import 'package:mockito/mockito.dart'; -import 'package:stackwallet/electrumx_rpc/electrumx.dart'; -import 'package:stackwallet/electrumx_rpc/rpc.dart'; -import 'package:stackwallet/utilities/prefs.dart'; - -import 'electrumx_test.mocks.dart'; -import 'sample_data/get_anonymity_set_sample_data.dart'; -import 'sample_data/get_used_serials_sample_data.dart'; -import 'sample_data/transaction_data_samples.dart'; - -@GenerateMocks([JsonRPC, Prefs]) -void main() { - group("factory constructors and getters", () { - test("electrumxnode .from factory", () { - final nodeA = ElectrumXNode( - address: "some address", - port: 1, - name: "some name", - id: "some ID", - useSSL: true, - ); - - final nodeB = ElectrumXNode.from(nodeA); - - expect(nodeB.toString(), nodeA.toString()); - expect(nodeA == nodeB, false); - }); - - test("electrumx .from factory", () { - final node = ElectrumXNode( - address: "some address", - port: 1, - name: "some name", - id: "some ID", - useSSL: true, - ); - - final mockPrefs = MockPrefs(); - - final client = - ElectrumX.from(node: node, failovers: [], prefs: mockPrefs); - - expect(client.useSSL, node.useSSL); - expect(client.host, node.address); - expect(client.port, node.port); - expect(client.rpcClient, null); - - verifyNoMoreInteractions(mockPrefs); - }); - }); - - test("Server error", () { - final mockClient = MockJsonRPC(); - const command = "blockchain.transaction.get"; - const jsonArgs = '["",true]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenAnswer( - (_) async => JsonRPCResponse(data: { - "jsonrpc": "2.0", - "error": { - "code": 1, - "message": "None should be a transaction hash", - }, - "id": "some requestId", - }), - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - failovers: [], - prefs: mockPrefs); - - expect(() => client.getTransaction(requestID: "some requestId", txHash: ''), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - group("getBlockHeadTip", () { - test("getBlockHeadTip success", () async { - final mockClient = MockJsonRPC(); - const command = "blockchain.headers.subscribe"; - const jsonArgs = '[]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenAnswer( - (_) async => JsonRPCResponse(data: { - "jsonrpc": "2.0", - "result": {"height": 520481, "hex": "some block hex string"}, - "id": "some requestId" - }), - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = - await (client.getBlockHeadTip(requestID: "some requestId")); - - expect(result["height"], 520481); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getBlockHeadTip throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "blockchain.headers.subscribe"; - const jsonArgs = '[]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect(() => client.getBlockHeadTip(requestID: "some requestId"), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("ping", () { - test("ping success", () async { - final mockClient = MockJsonRPC(); - const command = "server.ping"; - const jsonArgs = '[]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenAnswer( - (_) async => JsonRPCResponse(data: { - "jsonrpc": "2.0", - "result": null, - "id": "some requestId", - }), - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.ping(requestID: "some requestId"); - - expect(result, true); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("ping throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "server.ping"; - const jsonArgs = '[]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect(() => client.ping(requestID: "some requestId"), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("getServerFeatures", () { - test("getServerFeatures success", () async { - final mockClient = MockJsonRPC(); - const command = "server.features"; - const jsonArgs = '[]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenAnswer( - (_) async => JsonRPCResponse(data: { - "jsonrpc": "2.0", - "result": { - "genesis_hash": - "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943", - "hosts": { - "0.0.0.0": {"tcp_port": 51001, "ssl_port": 51002} - }, - "protocol_max": "1.0", - "protocol_min": "1.0", - "pruning": null, - "server_version": "ElectrumX 1.0.17", - "hash_function": "sha256" - }, - "id": "some requestId" - }), - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = - await client.getServerFeatures(requestID: "some requestId"); - - expect(result, { - "genesis_hash": - "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943", - "hosts": { - "0.0.0.0": {"tcp_port": 51001, "ssl_port": 51002} - }, - "protocol_max": "1.0", - "protocol_min": "1.0", - "pruning": null, - "server_version": "ElectrumX 1.0.17", - "hash_function": "sha256", - }); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getServerFeatures throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "server.features"; - const jsonArgs = '[]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect(() => client.getServerFeatures(requestID: "some requestId"), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("broadcastTransaction", () { - test("broadcastTransaction success", () async { - final mockClient = MockJsonRPC(); - const command = "blockchain.transaction.broadcast"; - const jsonArgs = '["some raw transaction string"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenAnswer( - (_) async => JsonRPCResponse(data: { - "jsonrpc": "2.0", - "result": "the txid of the rawtx", - "id": "some requestId" - }), - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.broadcastTransaction( - rawTx: "some raw transaction string", requestID: "some requestId"); - - expect(result, "the txid of the rawtx"); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("broadcastTransaction throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "blockchain.transaction.broadcast"; - const jsonArgs = '["some raw transaction string"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect( - () => client.broadcastTransaction( - rawTx: "some raw transaction string", - requestID: "some requestId"), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("getBalance", () { - test("getBalance success", () async { - final mockClient = MockJsonRPC(); - const command = "blockchain.scripthash.get_balance"; - const jsonArgs = '["dummy hash"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenAnswer( - (_) async => JsonRPCResponse(data: { - "jsonrpc": "2.0", - "result": { - "confirmed": 103873966, - "unconfirmed": 23684400, - }, - "id": "some requestId" - }), - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.getBalance( - scripthash: "dummy hash", requestID: "some requestId"); - - expect(result, {"confirmed": 103873966, "unconfirmed": 23684400}); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getBalance throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "blockchain.scripthash.get_balance"; - const jsonArgs = '["dummy hash"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect( - () => client.getBalance( - scripthash: "dummy hash", requestID: "some requestId"), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("getHistory", () { - test("getHistory success", () async { - final mockClient = MockJsonRPC(); - const command = "blockchain.scripthash.get_history"; - const jsonArgs = '["dummy hash"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenAnswer( - (_) async => JsonRPCResponse(data: { - "jsonrpc": "2.0", - "result": [ - { - "height": 200004, - "tx_hash": - "acc3758bd2a26f869fcc67d48ff30b96464d476bca82c1cd6656e7d506816412" - }, - { - "height": 215008, - "tx_hash": - "f3e1bf48975b8d6060a9de8884296abb80be618dc00ae3cb2f6cee3085e09403" - } - ], - "id": "some requestId" - }), - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.getHistory( - scripthash: "dummy hash", requestID: "some requestId"); - - expect(result, [ - { - "height": 200004, - "tx_hash": - "acc3758bd2a26f869fcc67d48ff30b96464d476bca82c1cd6656e7d506816412" - }, - { - "height": 215008, - "tx_hash": - "f3e1bf48975b8d6060a9de8884296abb80be618dc00ae3cb2f6cee3085e09403" - } - ]); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getHistory throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "blockchain.scripthash.get_history"; - const jsonArgs = '["dummy hash"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect( - () => client.getHistory( - scripthash: "dummy hash", requestID: "some requestId"), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("getUTXOs", () { - test("getUTXOs success", () async { - final mockClient = MockJsonRPC(); - const command = "blockchain.scripthash.listunspent"; - const jsonArgs = '["dummy hash"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenAnswer( - (_) async => JsonRPCResponse(data: { - "jsonrpc": "2.0", - "result": [ - { - "tx_pos": 0, - "value": 45318048, - "tx_hash": - "9f2c45a12db0144909b5db269415f7319179105982ac70ed80d76ea79d923ebf", - "height": 437146 - }, - { - "tx_pos": 0, - "value": 919195, - "tx_hash": - "3d2290c93436a3e964cfc2f0950174d8847b1fbe3946432c4784e168da0f019f", - "height": 441696 - } - ], - "id": "some requestId" - }), - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.getUTXOs( - scripthash: "dummy hash", requestID: "some requestId"); - - expect(result, [ - { - "tx_pos": 0, - "value": 45318048, - "tx_hash": - "9f2c45a12db0144909b5db269415f7319179105982ac70ed80d76ea79d923ebf", - "height": 437146 - }, - { - "tx_pos": 0, - "value": 919195, - "tx_hash": - "3d2290c93436a3e964cfc2f0950174d8847b1fbe3946432c4784e168da0f019f", - "height": 441696 - } - ]); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getUTXOs throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "blockchain.scripthash.listunspent"; - const jsonArgs = '["dummy hash"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect( - () => client.getUTXOs( - scripthash: "dummy hash", requestID: "some requestId"), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("getTransaction", () { - test("getTransaction success", () async { - final mockClient = MockJsonRPC(); - const command = "blockchain.transaction.get"; - const jsonArgs = '["${SampleGetTransactionData.txHash0}",true]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenAnswer( - (_) async => JsonRPCResponse(data: { - "jsonrpc": "2.0", - "result": SampleGetTransactionData.txData0, - "id": "some requestId" - }), - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.getTransaction( - txHash: SampleGetTransactionData.txHash0, - verbose: true, - requestID: "some requestId"); - - expect(result, SampleGetTransactionData.txData0); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getTransaction throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "blockchain.transaction.get"; - const jsonArgs = '["${SampleGetTransactionData.txHash0}",true]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect( - () => client.getTransaction( - txHash: SampleGetTransactionData.txHash0, - requestID: "some requestId"), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("getAnonymitySet", () { - test("getAnonymitySet success", () async { - final mockClient = MockJsonRPC(); - const command = "lelantus.getanonymityset"; - const jsonArgs = '["1",""]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenAnswer( - (_) async => JsonRPCResponse(data: { - "jsonrpc": "2.0", - "result": GetAnonymitySetSampleData.data, - "id": "some requestId" - }), - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.getAnonymitySet( - groupId: "1", blockhash: "", requestID: "some requestId"); - - expect(result, GetAnonymitySetSampleData.data); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getAnonymitySet throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "lelantus.getanonymityset"; - const jsonArgs = '["1",""]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect( - () => - client.getAnonymitySet(groupId: "1", requestID: "some requestId"), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("getMintData", () { - test("getMintData success", () async { - final mockClient = MockJsonRPC(); - const command = "lelantus.getmintmetadata"; - const jsonArgs = '["some mints"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenAnswer( - (_) async => JsonRPCResponse(data: { - "jsonrpc": "2.0", - "result": "mint meta data", - "id": "some requestId" - }), - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.getMintData( - mints: "some mints", requestID: "some requestId"); - - expect(result, "mint meta data"); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getMintData throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "lelantus.getmintmetadata"; - const jsonArgs = '["some mints"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect( - () => client.getMintData( - mints: "some mints", requestID: "some requestId"), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("getUsedCoinSerials", () { - test("getUsedCoinSerials success", () async { - final mockClient = MockJsonRPC(); - const command = "lelantus.getusedcoinserials"; - const jsonArgs = '["0"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenAnswer( - (_) async => JsonRPCResponse(data: { - "jsonrpc": "2.0", - "result": GetUsedSerialsSampleData.serials, - "id": "some requestId" - }), - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.getUsedCoinSerials( - requestID: "some requestId", startNumber: 0); - - expect(result, GetUsedSerialsSampleData.serials); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getUsedCoinSerials throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "lelantus.getusedcoinserials"; - const jsonArgs = '["0"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect( - () => client.getUsedCoinSerials( - requestID: "some requestId", startNumber: 0), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("getLatestCoinId", () { - test("getLatestCoinId success", () async { - final mockClient = MockJsonRPC(); - const command = "lelantus.getlatestcoinid"; - const jsonArgs = '[]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenAnswer( - (_) async => JsonRPCResponse(data: { - "jsonrpc": "2.0", - "result": 1, - "id": "some requestId", - }), - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.getLatestCoinId(requestID: "some requestId"); - - expect(result, 1); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getLatestCoinId throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "lelantus.getlatestcoinid"; - const jsonArgs = '[]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect( - () => client.getLatestCoinId( - requestID: "some requestId", - ), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("getCoinsForRecovery", () { - test("getCoinsForRecovery success", () async { - final mockClient = MockJsonRPC(); - const command = "lelantus.getanonymityset"; - const jsonArgs = '["1",""]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenAnswer( - (_) async => JsonRPCResponse(data: { - "jsonrpc": "2.0", - "result": GetAnonymitySetSampleData.data, - "id": "some requestId" - }), - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.getAnonymitySet( - groupId: "1", blockhash: "", requestID: "some requestId"); - - expect(result, GetAnonymitySetSampleData.data); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getAnonymitySet throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "lelantus.getanonymityset"; - const jsonArgs = '["1",""]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect( - () => client.getAnonymitySet( - groupId: "1", - requestID: "some requestId", - ), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("getMintData", () { - test("getMintData success", () async { - final mockClient = MockJsonRPC(); - const command = "lelantus.getmintmetadata"; - const jsonArgs = '["some mints"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenAnswer( - (_) async => JsonRPCResponse(data: { - "jsonrpc": "2.0", - "result": "mint meta data", - "id": "some requestId" - }), - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.getMintData( - mints: "some mints", requestID: "some requestId"); - - expect(result, "mint meta data"); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getMintData throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "lelantus.getmintmetadata"; - const jsonArgs = '["some mints"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect( - () => client.getMintData( - mints: "some mints", - requestID: "some requestId", - ), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("getUsedCoinSerials", () { - test("getUsedCoinSerials success", () async { - final mockClient = MockJsonRPC(); - const command = "lelantus.getusedcoinserials"; - const jsonArgs = '["0"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenAnswer( - (_) async => JsonRPCResponse(data: { - "jsonrpc": "2.0", - "result": GetUsedSerialsSampleData.serials, - "id": "some requestId" - }), - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.getUsedCoinSerials( - requestID: "some requestId", startNumber: 0); - - expect(result, GetUsedSerialsSampleData.serials); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getUsedCoinSerials throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "lelantus.getusedcoinserials"; - const jsonArgs = '["0"]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect( - () => client.getUsedCoinSerials( - requestID: "some requestId", startNumber: 0), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("getLatestCoinId", () { - test("getLatestCoinId success", () async { - final mockClient = MockJsonRPC(); - const command = "lelantus.getlatestcoinid"; - const jsonArgs = '[]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenAnswer( - (_) async => JsonRPCResponse(data: { - "jsonrpc": "2.0", - "result": 1, - "id": "some requestId", - }), - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.getLatestCoinId(requestID: "some requestId"); - - expect(result, 1); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getLatestCoinId throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "lelantus.getlatestcoinid"; - const jsonArgs = '[]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect(() => client.getLatestCoinId(requestID: "some requestId"), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - group("getFeeRate", () { - test("getFeeRate success", () async { - final mockClient = MockJsonRPC(); - const command = "blockchain.getfeerate"; - const jsonArgs = '[]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenAnswer( - (_) async => JsonRPCResponse(data: { - "jsonrpc": "2.0", - "result": { - "rate": 1000, - }, - "id": "some requestId" - }), - ); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - final result = await client.getFeeRate(requestID: "some requestId"); - - expect(result, {"rate": 1000}); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - - test("getFeeRate throws/fails", () { - final mockClient = MockJsonRPC(); - const command = "blockchain.getfeerate"; - const jsonArgs = '[]'; - when( - mockClient.request( - '{"jsonrpc": "2.0", "id": "some requestId",' - '"method": "$command","params": $jsonArgs}', - ), - ).thenThrow(Exception()); - - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - host: "some server", - port: 0, - useSSL: true, - client: mockClient, - prefs: mockPrefs, - failovers: []); - - expect(() => client.getFeeRate(requestID: "some requestId"), - throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); - }); - - test("rpcClient is null throws with bad server info", () { - final mockPrefs = MockPrefs(); - when(mockPrefs.wifiOnly).thenAnswer((_) => false); - final client = ElectrumX( - client: null, - port: -10, - host: "_ :sa %", - useSSL: false, - prefs: mockPrefs, - failovers: [], - ); - - expect(() => client.getFeeRate(), throwsA(isA())); - verify(mockPrefs.wifiOnly).called(1); - verifyNoMoreInteractions(mockPrefs); - }); -} +// import 'package:flutter_test/flutter_test.dart'; +// import 'package:mockito/annotations.dart'; +// import 'package:mockito/mockito.dart'; +// import 'package:stackwallet/electrumx_rpc/electrumx.dart'; +// import 'package:stackwallet/electrumx_rpc/rpc.dart'; +// import 'package:stackwallet/utilities/prefs.dart'; +// +// import 'electrumx_test.mocks.dart'; +// import 'sample_data/get_anonymity_set_sample_data.dart'; +// import 'sample_data/get_used_serials_sample_data.dart'; +// import 'sample_data/transaction_data_samples.dart'; +// +// @GenerateMocks([JsonRPC, Prefs]) +// void main() { +// group("factory constructors and getters", () { +// test("electrumxnode .from factory", () { +// final nodeA = ElectrumXNode( +// address: "some address", +// port: 1, +// name: "some name", +// id: "some ID", +// useSSL: true, +// ); +// +// final nodeB = ElectrumXNode.from(nodeA); +// +// expect(nodeB.toString(), nodeA.toString()); +// expect(nodeA == nodeB, false); +// }); +// +// test("electrumx .from factory", () { +// final node = ElectrumXNode( +// address: "some address", +// port: 1, +// name: "some name", +// id: "some ID", +// useSSL: true, +// ); +// +// final mockPrefs = MockPrefs(); +// +// final client = +// ElectrumX.from(node: node, failovers: [], prefs: mockPrefs); +// +// expect(client.useSSL, node.useSSL); +// expect(client.host, node.address); +// expect(client.port, node.port); +// expect(client.rpcClient, null); +// +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// test("Server error", () { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.transaction.get"; +// const jsonArgs = '["",true]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "error": { +// "code": 1, +// "message": "None should be a transaction hash", +// }, +// "id": "some requestId", +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// failovers: [], +// prefs: mockPrefs); +// +// expect(() => client.getTransaction(requestID: "some requestId", txHash: ''), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// group("getBlockHeadTip", () { +// test("getBlockHeadTip success", () async { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.headers.subscribe"; +// const jsonArgs = '[]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": {"height": 520481, "hex": "some block hex string"}, +// "id": "some requestId" +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = +// await (client.getBlockHeadTip(requestID: "some requestId")); +// +// expect(result["height"], 520481); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getBlockHeadTip throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.headers.subscribe"; +// const jsonArgs = '[]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect(() => client.getBlockHeadTip(requestID: "some requestId"), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("ping", () { +// test("ping success", () async { +// final mockClient = MockJsonRPC(); +// const command = "server.ping"; +// const jsonArgs = '[]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": null, +// "id": "some requestId", +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.ping(requestID: "some requestId"); +// +// expect(result, true); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("ping throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "server.ping"; +// const jsonArgs = '[]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect(() => client.ping(requestID: "some requestId"), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("getServerFeatures", () { +// test("getServerFeatures success", () async { +// final mockClient = MockJsonRPC(); +// const command = "server.features"; +// const jsonArgs = '[]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": { +// "genesis_hash": +// "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943", +// "hosts": { +// "0.0.0.0": {"tcp_port": 51001, "ssl_port": 51002} +// }, +// "protocol_max": "1.0", +// "protocol_min": "1.0", +// "pruning": null, +// "server_version": "ElectrumX 1.0.17", +// "hash_function": "sha256" +// }, +// "id": "some requestId" +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = +// await client.getServerFeatures(requestID: "some requestId"); +// +// expect(result, { +// "genesis_hash": +// "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943", +// "hosts": { +// "0.0.0.0": {"tcp_port": 51001, "ssl_port": 51002} +// }, +// "protocol_max": "1.0", +// "protocol_min": "1.0", +// "pruning": null, +// "server_version": "ElectrumX 1.0.17", +// "hash_function": "sha256", +// }); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getServerFeatures throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "server.features"; +// const jsonArgs = '[]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect(() => client.getServerFeatures(requestID: "some requestId"), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("broadcastTransaction", () { +// test("broadcastTransaction success", () async { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.transaction.broadcast"; +// const jsonArgs = '["some raw transaction string"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": "the txid of the rawtx", +// "id": "some requestId" +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.broadcastTransaction( +// rawTx: "some raw transaction string", requestID: "some requestId"); +// +// expect(result, "the txid of the rawtx"); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("broadcastTransaction throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.transaction.broadcast"; +// const jsonArgs = '["some raw transaction string"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect( +// () => client.broadcastTransaction( +// rawTx: "some raw transaction string", +// requestID: "some requestId"), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("getBalance", () { +// test("getBalance success", () async { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.scripthash.get_balance"; +// const jsonArgs = '["dummy hash"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": { +// "confirmed": 103873966, +// "unconfirmed": 23684400, +// }, +// "id": "some requestId" +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.getBalance( +// scripthash: "dummy hash", requestID: "some requestId"); +// +// expect(result, {"confirmed": 103873966, "unconfirmed": 23684400}); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getBalance throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.scripthash.get_balance"; +// const jsonArgs = '["dummy hash"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect( +// () => client.getBalance( +// scripthash: "dummy hash", requestID: "some requestId"), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("getHistory", () { +// test("getHistory success", () async { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.scripthash.get_history"; +// const jsonArgs = '["dummy hash"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": [ +// { +// "height": 200004, +// "tx_hash": +// "acc3758bd2a26f869fcc67d48ff30b96464d476bca82c1cd6656e7d506816412" +// }, +// { +// "height": 215008, +// "tx_hash": +// "f3e1bf48975b8d6060a9de8884296abb80be618dc00ae3cb2f6cee3085e09403" +// } +// ], +// "id": "some requestId" +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.getHistory( +// scripthash: "dummy hash", requestID: "some requestId"); +// +// expect(result, [ +// { +// "height": 200004, +// "tx_hash": +// "acc3758bd2a26f869fcc67d48ff30b96464d476bca82c1cd6656e7d506816412" +// }, +// { +// "height": 215008, +// "tx_hash": +// "f3e1bf48975b8d6060a9de8884296abb80be618dc00ae3cb2f6cee3085e09403" +// } +// ]); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getHistory throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.scripthash.get_history"; +// const jsonArgs = '["dummy hash"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect( +// () => client.getHistory( +// scripthash: "dummy hash", requestID: "some requestId"), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("getUTXOs", () { +// test("getUTXOs success", () async { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.scripthash.listunspent"; +// const jsonArgs = '["dummy hash"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": [ +// { +// "tx_pos": 0, +// "value": 45318048, +// "tx_hash": +// "9f2c45a12db0144909b5db269415f7319179105982ac70ed80d76ea79d923ebf", +// "height": 437146 +// }, +// { +// "tx_pos": 0, +// "value": 919195, +// "tx_hash": +// "3d2290c93436a3e964cfc2f0950174d8847b1fbe3946432c4784e168da0f019f", +// "height": 441696 +// } +// ], +// "id": "some requestId" +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.getUTXOs( +// scripthash: "dummy hash", requestID: "some requestId"); +// +// expect(result, [ +// { +// "tx_pos": 0, +// "value": 45318048, +// "tx_hash": +// "9f2c45a12db0144909b5db269415f7319179105982ac70ed80d76ea79d923ebf", +// "height": 437146 +// }, +// { +// "tx_pos": 0, +// "value": 919195, +// "tx_hash": +// "3d2290c93436a3e964cfc2f0950174d8847b1fbe3946432c4784e168da0f019f", +// "height": 441696 +// } +// ]); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getUTXOs throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.scripthash.listunspent"; +// const jsonArgs = '["dummy hash"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect( +// () => client.getUTXOs( +// scripthash: "dummy hash", requestID: "some requestId"), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("getTransaction", () { +// test("getTransaction success", () async { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.transaction.get"; +// const jsonArgs = '["${SampleGetTransactionData.txHash0}",true]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": SampleGetTransactionData.txData0, +// "id": "some requestId" +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.getTransaction( +// txHash: SampleGetTransactionData.txHash0, +// verbose: true, +// requestID: "some requestId"); +// +// expect(result, SampleGetTransactionData.txData0); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getTransaction throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.transaction.get"; +// const jsonArgs = '["${SampleGetTransactionData.txHash0}",true]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect( +// () => client.getTransaction( +// txHash: SampleGetTransactionData.txHash0, +// requestID: "some requestId"), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("getAnonymitySet", () { +// test("getAnonymitySet success", () async { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getanonymityset"; +// const jsonArgs = '["1",""]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": GetAnonymitySetSampleData.data, +// "id": "some requestId" +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.getAnonymitySet( +// groupId: "1", blockhash: "", requestID: "some requestId"); +// +// expect(result, GetAnonymitySetSampleData.data); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getAnonymitySet throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getanonymityset"; +// const jsonArgs = '["1",""]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect( +// () => +// client.getAnonymitySet(groupId: "1", requestID: "some requestId"), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("getMintData", () { +// test("getMintData success", () async { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getmintmetadata"; +// const jsonArgs = '["some mints"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": "mint meta data", +// "id": "some requestId" +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.getMintData( +// mints: "some mints", requestID: "some requestId"); +// +// expect(result, "mint meta data"); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getMintData throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getmintmetadata"; +// const jsonArgs = '["some mints"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect( +// () => client.getMintData( +// mints: "some mints", requestID: "some requestId"), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("getUsedCoinSerials", () { +// test("getUsedCoinSerials success", () async { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getusedcoinserials"; +// const jsonArgs = '["0"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": GetUsedSerialsSampleData.serials, +// "id": "some requestId" +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.getUsedCoinSerials( +// requestID: "some requestId", startNumber: 0); +// +// expect(result, GetUsedSerialsSampleData.serials); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getUsedCoinSerials throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getusedcoinserials"; +// const jsonArgs = '["0"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect( +// () => client.getUsedCoinSerials( +// requestID: "some requestId", startNumber: 0), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("getLatestCoinId", () { +// test("getLatestCoinId success", () async { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getlatestcoinid"; +// const jsonArgs = '[]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": 1, +// "id": "some requestId", +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.getLatestCoinId(requestID: "some requestId"); +// +// expect(result, 1); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getLatestCoinId throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getlatestcoinid"; +// const jsonArgs = '[]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect( +// () => client.getLatestCoinId( +// requestID: "some requestId", +// ), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("getCoinsForRecovery", () { +// test("getCoinsForRecovery success", () async { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getanonymityset"; +// const jsonArgs = '["1",""]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": GetAnonymitySetSampleData.data, +// "id": "some requestId" +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.getAnonymitySet( +// groupId: "1", blockhash: "", requestID: "some requestId"); +// +// expect(result, GetAnonymitySetSampleData.data); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getAnonymitySet throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getanonymityset"; +// const jsonArgs = '["1",""]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect( +// () => client.getAnonymitySet( +// groupId: "1", +// requestID: "some requestId", +// ), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("getMintData", () { +// test("getMintData success", () async { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getmintmetadata"; +// const jsonArgs = '["some mints"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": "mint meta data", +// "id": "some requestId" +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.getMintData( +// mints: "some mints", requestID: "some requestId"); +// +// expect(result, "mint meta data"); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getMintData throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getmintmetadata"; +// const jsonArgs = '["some mints"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect( +// () => client.getMintData( +// mints: "some mints", +// requestID: "some requestId", +// ), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("getUsedCoinSerials", () { +// test("getUsedCoinSerials success", () async { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getusedcoinserials"; +// const jsonArgs = '["0"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": GetUsedSerialsSampleData.serials, +// "id": "some requestId" +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.getUsedCoinSerials( +// requestID: "some requestId", startNumber: 0); +// +// expect(result, GetUsedSerialsSampleData.serials); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getUsedCoinSerials throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getusedcoinserials"; +// const jsonArgs = '["0"]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect( +// () => client.getUsedCoinSerials( +// requestID: "some requestId", startNumber: 0), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("getLatestCoinId", () { +// test("getLatestCoinId success", () async { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getlatestcoinid"; +// const jsonArgs = '[]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": 1, +// "id": "some requestId", +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.getLatestCoinId(requestID: "some requestId"); +// +// expect(result, 1); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getLatestCoinId throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "lelantus.getlatestcoinid"; +// const jsonArgs = '[]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect(() => client.getLatestCoinId(requestID: "some requestId"), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// group("getFeeRate", () { +// test("getFeeRate success", () async { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.getfeerate"; +// const jsonArgs = '[]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenAnswer( +// (_) async => JsonRPCResponse(data: { +// "jsonrpc": "2.0", +// "result": { +// "rate": 1000, +// }, +// "id": "some requestId" +// }), +// ); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// final result = await client.getFeeRate(requestID: "some requestId"); +// +// expect(result, {"rate": 1000}); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// +// test("getFeeRate throws/fails", () { +// final mockClient = MockJsonRPC(); +// const command = "blockchain.getfeerate"; +// const jsonArgs = '[]'; +// when( +// mockClient.request( +// '{"jsonrpc": "2.0", "id": "some requestId",' +// '"method": "$command","params": $jsonArgs}', +// ), +// ).thenThrow(Exception()); +// +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// host: "some server", +// port: 0, +// useSSL: true, +// client: mockClient, +// prefs: mockPrefs, +// failovers: []); +// +// expect(() => client.getFeeRate(requestID: "some requestId"), +// throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// }); +// +// test("rpcClient is null throws with bad server info", () { +// final mockPrefs = MockPrefs(); +// when(mockPrefs.wifiOnly).thenAnswer((_) => false); +// final client = ElectrumX( +// client: null, +// port: -10, +// host: "_ :sa %", +// useSSL: false, +// prefs: mockPrefs, +// failovers: [], +// ); +// +// expect(() => client.getFeeRate(), throwsA(isA())); +// verify(mockPrefs.wifiOnly).called(1); +// verifyNoMoreInteractions(mockPrefs); +// }); +// } diff --git a/test/electrumx_test.mocks.dart b/test/electrumx_test.mocks.dart deleted file mode 100644 index 8c9649d20..000000000 --- a/test/electrumx_test.mocks.dart +++ /dev/null @@ -1,543 +0,0 @@ -// Mocks generated by Mockito 5.3.2 from annotations -// in stackduo/test/electrumx_test.dart. -// Do not manually edit this file. - -// ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i3; -import 'dart:ui' as _i7; - -import 'package:mockito/mockito.dart' as _i1; -import 'package:stackduo/electrumx_rpc/rpc.dart' as _i2; -import 'package:stackduo/utilities/enums/backup_frequency_type.dart' as _i6; -import 'package:stackduo/utilities/enums/sync_type_enum.dart' as _i5; -import 'package:stackduo/utilities/prefs.dart' as _i4; - -// ignore_for_file: type=lint -// ignore_for_file: avoid_redundant_argument_values -// ignore_for_file: avoid_setters_without_getters -// ignore_for_file: comment_references -// ignore_for_file: implementation_imports -// ignore_for_file: invalid_use_of_visible_for_testing_member -// ignore_for_file: prefer_const_constructors -// ignore_for_file: unnecessary_parenthesis -// ignore_for_file: camel_case_types -// ignore_for_file: subtype_of_sealed_class - -class _FakeDuration_0 extends _i1.SmartFake implements Duration { - _FakeDuration_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeJsonRPCResponse_1 extends _i1.SmartFake - implements _i2.JsonRPCResponse { - _FakeJsonRPCResponse_1( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -/// A class which mocks [JsonRPC]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockJsonRPC extends _i1.Mock implements _i2.JsonRPC { - MockJsonRPC() { - _i1.throwOnMissingStub(this); - } - - @override - bool get useSSL => (super.noSuchMethod( - Invocation.getter(#useSSL), - returnValue: false, - ) as bool); - @override - String get host => (super.noSuchMethod( - Invocation.getter(#host), - returnValue: '', - ) as String); - @override - int get port => (super.noSuchMethod( - Invocation.getter(#port), - returnValue: 0, - ) as int); - @override - Duration get connectionTimeout => (super.noSuchMethod( - Invocation.getter(#connectionTimeout), - returnValue: _FakeDuration_0( - this, - Invocation.getter(#connectionTimeout), - ), - ) as Duration); - @override - _i3.Future<_i2.JsonRPCResponse> request(String? jsonRpcRequest) => - (super.noSuchMethod( - Invocation.method( - #request, - [jsonRpcRequest], - ), - returnValue: - _i3.Future<_i2.JsonRPCResponse>.value(_FakeJsonRPCResponse_1( - this, - Invocation.method( - #request, - [jsonRpcRequest], - ), - )), - ) as _i3.Future<_i2.JsonRPCResponse>); - @override - _i3.Future disconnect({required String? reason}) => (super.noSuchMethod( - Invocation.method( - #disconnect, - [], - {#reason: reason}, - ), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); - @override - _i3.Future connect() => (super.noSuchMethod( - Invocation.method( - #connect, - [], - ), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); -} - -/// A class which mocks [Prefs]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockPrefs extends _i1.Mock implements _i4.Prefs { - MockPrefs() { - _i1.throwOnMissingStub(this); - } - - @override - bool get isInitialized => (super.noSuchMethod( - Invocation.getter(#isInitialized), - returnValue: false, - ) as bool); - @override - int get lastUnlockedTimeout => (super.noSuchMethod( - Invocation.getter(#lastUnlockedTimeout), - returnValue: 0, - ) as int); - @override - set lastUnlockedTimeout(int? lastUnlockedTimeout) => super.noSuchMethod( - Invocation.setter( - #lastUnlockedTimeout, - lastUnlockedTimeout, - ), - returnValueForMissingStub: null, - ); - @override - int get lastUnlocked => (super.noSuchMethod( - Invocation.getter(#lastUnlocked), - returnValue: 0, - ) as int); - @override - set lastUnlocked(int? lastUnlocked) => super.noSuchMethod( - Invocation.setter( - #lastUnlocked, - lastUnlocked, - ), - returnValueForMissingStub: null, - ); - @override - int get currentNotificationId => (super.noSuchMethod( - Invocation.getter(#currentNotificationId), - returnValue: 0, - ) as int); - @override - List get walletIdsSyncOnStartup => (super.noSuchMethod( - Invocation.getter(#walletIdsSyncOnStartup), - returnValue: [], - ) as List); - @override - set walletIdsSyncOnStartup(List? walletIdsSyncOnStartup) => - super.noSuchMethod( - Invocation.setter( - #walletIdsSyncOnStartup, - walletIdsSyncOnStartup, - ), - returnValueForMissingStub: null, - ); - @override - _i5.SyncingType get syncType => (super.noSuchMethod( - Invocation.getter(#syncType), - returnValue: _i5.SyncingType.currentWalletOnly, - ) as _i5.SyncingType); - @override - set syncType(_i5.SyncingType? syncType) => super.noSuchMethod( - Invocation.setter( - #syncType, - syncType, - ), - returnValueForMissingStub: null, - ); - @override - bool get wifiOnly => (super.noSuchMethod( - Invocation.getter(#wifiOnly), - returnValue: false, - ) as bool); - @override - set wifiOnly(bool? wifiOnly) => super.noSuchMethod( - Invocation.setter( - #wifiOnly, - wifiOnly, - ), - returnValueForMissingStub: null, - ); - @override - bool get showFavoriteWallets => (super.noSuchMethod( - Invocation.getter(#showFavoriteWallets), - returnValue: false, - ) as bool); - @override - set showFavoriteWallets(bool? showFavoriteWallets) => super.noSuchMethod( - Invocation.setter( - #showFavoriteWallets, - showFavoriteWallets, - ), - returnValueForMissingStub: null, - ); - @override - String get language => (super.noSuchMethod( - Invocation.getter(#language), - returnValue: '', - ) as String); - @override - set language(String? newLanguage) => super.noSuchMethod( - Invocation.setter( - #language, - newLanguage, - ), - returnValueForMissingStub: null, - ); - @override - String get currency => (super.noSuchMethod( - Invocation.getter(#currency), - returnValue: '', - ) as String); - @override - set currency(String? newCurrency) => super.noSuchMethod( - Invocation.setter( - #currency, - newCurrency, - ), - returnValueForMissingStub: null, - ); - @override - bool get randomizePIN => (super.noSuchMethod( - Invocation.getter(#randomizePIN), - returnValue: false, - ) as bool); - @override - set randomizePIN(bool? randomizePIN) => super.noSuchMethod( - Invocation.setter( - #randomizePIN, - randomizePIN, - ), - returnValueForMissingStub: null, - ); - @override - bool get useBiometrics => (super.noSuchMethod( - Invocation.getter(#useBiometrics), - returnValue: false, - ) as bool); - @override - set useBiometrics(bool? useBiometrics) => super.noSuchMethod( - Invocation.setter( - #useBiometrics, - useBiometrics, - ), - returnValueForMissingStub: null, - ); - @override - bool get hasPin => (super.noSuchMethod( - Invocation.getter(#hasPin), - returnValue: false, - ) as bool); - @override - set hasPin(bool? hasPin) => super.noSuchMethod( - Invocation.setter( - #hasPin, - hasPin, - ), - returnValueForMissingStub: null, - ); - @override - int get familiarity => (super.noSuchMethod( - Invocation.getter(#familiarity), - returnValue: 0, - ) as int); - @override - set familiarity(int? familiarity) => super.noSuchMethod( - Invocation.setter( - #familiarity, - familiarity, - ), - returnValueForMissingStub: null, - ); - @override - bool get showTestNetCoins => (super.noSuchMethod( - Invocation.getter(#showTestNetCoins), - returnValue: false, - ) as bool); - @override - set showTestNetCoins(bool? showTestNetCoins) => super.noSuchMethod( - Invocation.setter( - #showTestNetCoins, - showTestNetCoins, - ), - returnValueForMissingStub: null, - ); - @override - bool get isAutoBackupEnabled => (super.noSuchMethod( - Invocation.getter(#isAutoBackupEnabled), - returnValue: false, - ) as bool); - @override - set isAutoBackupEnabled(bool? isAutoBackupEnabled) => super.noSuchMethod( - Invocation.setter( - #isAutoBackupEnabled, - isAutoBackupEnabled, - ), - returnValueForMissingStub: null, - ); - @override - set autoBackupLocation(String? autoBackupLocation) => super.noSuchMethod( - Invocation.setter( - #autoBackupLocation, - autoBackupLocation, - ), - returnValueForMissingStub: null, - ); - @override - _i6.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod( - Invocation.getter(#backupFrequencyType), - returnValue: _i6.BackupFrequencyType.everyTenMinutes, - ) as _i6.BackupFrequencyType); - @override - set backupFrequencyType(_i6.BackupFrequencyType? backupFrequencyType) => - super.noSuchMethod( - Invocation.setter( - #backupFrequencyType, - backupFrequencyType, - ), - returnValueForMissingStub: null, - ); - @override - set lastAutoBackup(DateTime? lastAutoBackup) => super.noSuchMethod( - Invocation.setter( - #lastAutoBackup, - lastAutoBackup, - ), - returnValueForMissingStub: null, - ); - @override - bool get hideBlockExplorerWarning => (super.noSuchMethod( - Invocation.getter(#hideBlockExplorerWarning), - returnValue: false, - ) as bool); - @override - set hideBlockExplorerWarning(bool? hideBlockExplorerWarning) => - super.noSuchMethod( - Invocation.setter( - #hideBlockExplorerWarning, - hideBlockExplorerWarning, - ), - returnValueForMissingStub: null, - ); - @override - bool get gotoWalletOnStartup => (super.noSuchMethod( - Invocation.getter(#gotoWalletOnStartup), - returnValue: false, - ) as bool); - @override - set gotoWalletOnStartup(bool? gotoWalletOnStartup) => super.noSuchMethod( - Invocation.setter( - #gotoWalletOnStartup, - gotoWalletOnStartup, - ), - returnValueForMissingStub: null, - ); - @override - set startupWalletId(String? startupWalletId) => super.noSuchMethod( - Invocation.setter( - #startupWalletId, - startupWalletId, - ), - returnValueForMissingStub: null, - ); - @override - bool get externalCalls => (super.noSuchMethod( - Invocation.getter(#externalCalls), - returnValue: false, - ) as bool); - @override - set externalCalls(bool? externalCalls) => super.noSuchMethod( - Invocation.setter( - #externalCalls, - externalCalls, - ), - returnValueForMissingStub: null, - ); - @override - bool get enableCoinControl => (super.noSuchMethod( - Invocation.getter(#enableCoinControl), - returnValue: false, - ) as bool); - @override - set enableCoinControl(bool? enableCoinControl) => super.noSuchMethod( - Invocation.setter( - #enableCoinControl, - enableCoinControl, - ), - returnValueForMissingStub: null, - ); - @override - bool get enableSystemBrightness => (super.noSuchMethod( - Invocation.getter(#enableSystemBrightness), - returnValue: false, - ) as bool); - @override - set enableSystemBrightness(bool? enableSystemBrightness) => - super.noSuchMethod( - Invocation.setter( - #enableSystemBrightness, - enableSystemBrightness, - ), - returnValueForMissingStub: null, - ); - @override - String get themeId => (super.noSuchMethod( - Invocation.getter(#themeId), - returnValue: '', - ) as String); - @override - set themeId(String? themeId) => super.noSuchMethod( - Invocation.setter( - #themeId, - themeId, - ), - returnValueForMissingStub: null, - ); - @override - String get systemBrightnessLightThemeId => (super.noSuchMethod( - Invocation.getter(#systemBrightnessLightThemeId), - returnValue: '', - ) as String); - @override - set systemBrightnessLightThemeId(String? systemBrightnessLightThemeId) => - super.noSuchMethod( - Invocation.setter( - #systemBrightnessLightThemeId, - systemBrightnessLightThemeId, - ), - returnValueForMissingStub: null, - ); - @override - String get systemBrightnessDarkThemeId => (super.noSuchMethod( - Invocation.getter(#systemBrightnessDarkThemeId), - returnValue: '', - ) as String); - @override - set systemBrightnessDarkThemeId(String? systemBrightnessDarkThemeId) => - super.noSuchMethod( - Invocation.setter( - #systemBrightnessDarkThemeId, - systemBrightnessDarkThemeId, - ), - returnValueForMissingStub: null, - ); - @override - bool get hasListeners => (super.noSuchMethod( - Invocation.getter(#hasListeners), - returnValue: false, - ) as bool); - @override - _i3.Future init() => (super.noSuchMethod( - Invocation.method( - #init, - [], - ), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); - @override - _i3.Future incrementCurrentNotificationIndex() => (super.noSuchMethod( - Invocation.method( - #incrementCurrentNotificationIndex, - [], - ), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); - @override - _i3.Future isExternalCallsSet() => (super.noSuchMethod( - Invocation.method( - #isExternalCallsSet, - [], - ), - returnValue: _i3.Future.value(false), - ) as _i3.Future); - @override - _i3.Future saveUserID(String? userId) => (super.noSuchMethod( - Invocation.method( - #saveUserID, - [userId], - ), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); - @override - _i3.Future saveSignupEpoch(int? signupEpoch) => (super.noSuchMethod( - Invocation.method( - #saveSignupEpoch, - [signupEpoch], - ), - returnValue: _i3.Future.value(), - returnValueForMissingStub: _i3.Future.value(), - ) as _i3.Future); - @override - void addListener(_i7.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #addListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void removeListener(_i7.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #removeListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void dispose() => super.noSuchMethod( - Invocation.method( - #dispose, - [], - ), - returnValueForMissingStub: null, - ); - @override - void notifyListeners() => super.noSuchMethod( - Invocation.method( - #notifyListeners, - [], - ), - returnValueForMissingStub: null, - ); -} diff --git a/test/flutter_secure_storage_interface_test.mocks.dart b/test/flutter_secure_storage_interface_test.mocks.dart index f37422cdc..f310de330 100644 --- a/test/flutter_secure_storage_interface_test.mocks.dart +++ b/test/flutter_secure_storage_interface_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/flutter_secure_storage_interface_test.dart. // Do not manually edit this file. diff --git a/test/hive/db_test.dart b/test/hive/db_test.dart index 486bf13d3..bba2bc666 100644 --- a/test/hive/db_test.dart +++ b/test/hive/db_test.dart @@ -1,6 +1,6 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:hive_test/hive_test.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; void main() { diff --git a/test/models/type_adapter_tests/lelantus_coin_adapter_test.mocks.dart b/test/models/type_adapter_tests/lelantus_coin_adapter_test.mocks.dart index 5a3f0677f..1d3200c42 100644 --- a/test/models/type_adapter_tests/lelantus_coin_adapter_test.mocks.dart +++ b/test/models/type_adapter_tests/lelantus_coin_adapter_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/models/type_adapter_tests/lelantus_coin_adapter_test.dart. // Do not manually edit this file. diff --git a/test/models/type_adapter_tests/transactions_model_adapter_test.mocks.dart b/test/models/type_adapter_tests/transactions_model_adapter_test.mocks.dart index 8d92283c8..2f14b4009 100644 --- a/test/models/type_adapter_tests/transactions_model_adapter_test.mocks.dart +++ b/test/models/type_adapter_tests/transactions_model_adapter_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/models/type_adapter_tests/transactions_model_adapter_test.dart. // Do not manually edit this file. diff --git a/test/models/type_adapter_tests/utxo_model_adapter_test.mocks.dart b/test/models/type_adapter_tests/utxo_model_adapter_test.mocks.dart index 86b0748d5..dc060f638 100644 --- a/test/models/type_adapter_tests/utxo_model_adapter_test.mocks.dart +++ b/test/models/type_adapter_tests/utxo_model_adapter_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/models/type_adapter_tests/utxo_model_adapter_test.dart. // Do not manually edit this file. diff --git a/test/notifications/notification_card_test.dart b/test/notifications/notification_card_test.dart index 30fe71ed8..7c8872844 100644 --- a/test/notifications/notification_card_test.dart +++ b/test/notifications/notification_card_test.dart @@ -1,46 +1,46 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_svg/svg.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:stackduo/models/notification_model.dart'; -import 'package:stackduo/notifications/notification_card.dart'; -import 'package:stackduo/utilities/assets.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; - -void main() { - testWidgets("test notification card", (widgetTester) async { - final key = UniqueKey(); - final notificationCard = NotificationCard( - key: key, - notification: NotificationModel( - id: 1, - title: "notification title", - description: "notification description", - iconAssetName: Assets.svg.iconFor(coin: Coin.bitcoin), - date: DateTime.parse("1662544771"), - walletId: "wallet id", - read: true, - shouldWatchForUpdates: true, - coinName: "Bitcoin"), - ); - - await widgetTester.pumpWidget( - MaterialApp( - theme: ThemeData( - extensions: [ - StackColors.fromStackColorTheme(LightColors()), - ], - ), - home: Material( - child: notificationCard, - ), - ), - ); - - expect(find.byWidget(notificationCard), findsOneWidget); - expect(find.text("notification title"), findsOneWidget); - expect(find.text("notification description"), findsOneWidget); - expect(find.byType(SvgPicture), findsOneWidget); - }); -} +// import 'package:flutter/material.dart'; +// import 'package:flutter_svg/svg.dart'; +// import 'package:flutter_test/flutter_test.dart'; +// import 'package:stackduo/models/notification_model.dart'; +// import 'package:stackduo/notifications/notification_card.dart'; +// import 'package:stackduo/utilities/assets.dart'; +// import 'package:stackduo/utilities/enums/coin_enum.dart'; +// import 'package:stackduo/utilities/theme/light_colors.dart'; +// import 'package:stackduo/utilities/theme/stack_colors.dart'; +// +// void main() { +// testWidgets("test notification card", (widgetTester) async { +// final key = UniqueKey(); +// final notificationCard = NotificationCard( +// key: key, +// notification: NotificationModel( +// id: 1, +// title: "notification title", +// description: "notification description", +// iconAssetName: Assets.svg.iconFor(coin: Coin.bitcoin), +// date: DateTime.parse("1662544771"), +// walletId: "wallet id", +// read: true, +// shouldWatchForUpdates: true, +// coinName: "Bitcoin"), +// ); +// +// await widgetTester.pumpWidget( +// MaterialApp( +// theme: ThemeData( +// extensions: [ +// StackColors.fromStackColorTheme(LightColors()), +// ], +// ), +// home: Material( +// child: notificationCard, +// ), +// ), +// ); +// +// expect(find.byWidget(notificationCard), findsOneWidget); +// expect(find.text("notification title"), findsOneWidget); +// expect(find.text("notification description"), findsOneWidget); +// expect(find.byType(SvgPicture), findsOneWidget); +// }); +// } diff --git a/test/notifications/notification_card_test.mocks.dart b/test/notifications/notification_card_test.mocks.dart deleted file mode 100644 index bb8b8ae74..000000000 --- a/test/notifications/notification_card_test.mocks.dart +++ /dev/null @@ -1,131 +0,0 @@ -// Mocks generated by Mockito 5.3.2 from annotations -// in stackwallet/test/notifications/notification_card_test.dart. -// Do not manually edit this file. - -// ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i5; -import 'dart:typed_data' as _i6; - -import 'package:mockito/mockito.dart' as _i1; -import 'package:stackwallet/db/isar/main_db.dart' as _i2; -import 'package:stackwallet/models/isar/stack_theme.dart' as _i4; -import 'package:stackwallet/themes/theme_service.dart' as _i3; - -// ignore_for_file: type=lint -// ignore_for_file: avoid_redundant_argument_values -// ignore_for_file: avoid_setters_without_getters -// ignore_for_file: comment_references -// ignore_for_file: implementation_imports -// ignore_for_file: invalid_use_of_visible_for_testing_member -// ignore_for_file: prefer_const_constructors -// ignore_for_file: unnecessary_parenthesis -// ignore_for_file: camel_case_types -// ignore_for_file: subtype_of_sealed_class - -class _FakeMainDB_0 extends _i1.SmartFake implements _i2.MainDB { - _FakeMainDB_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -/// A class which mocks [ThemeService]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockThemeService extends _i1.Mock implements _i3.ThemeService { - MockThemeService() { - _i1.throwOnMissingStub(this); - } - - @override - _i2.MainDB get db => (super.noSuchMethod( - Invocation.getter(#db), - returnValue: _FakeMainDB_0( - this, - Invocation.getter(#db), - ), - ) as _i2.MainDB); - @override - List<_i4.StackTheme> get installedThemes => (super.noSuchMethod( - Invocation.getter(#installedThemes), - returnValue: <_i4.StackTheme>[], - ) as List<_i4.StackTheme>); - @override - void init(_i2.MainDB? db) => super.noSuchMethod( - Invocation.method( - #init, - [db], - ), - returnValueForMissingStub: null, - ); - @override - _i5.Future install({required _i6.Uint8List? themeArchiveData}) => - (super.noSuchMethod( - Invocation.method( - #install, - [], - {#themeArchiveData: themeArchiveData}, - ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); - @override - _i5.Future remove({required String? themeId}) => (super.noSuchMethod( - Invocation.method( - #remove, - [], - {#themeId: themeId}, - ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); - @override - _i5.Future checkDefaultThemesOnStartup() => (super.noSuchMethod( - Invocation.method( - #checkDefaultThemesOnStartup, - [], - ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); - @override - _i5.Future verifyInstalled({required String? themeId}) => - (super.noSuchMethod( - Invocation.method( - #verifyInstalled, - [], - {#themeId: themeId}, - ), - returnValue: _i5.Future.value(false), - ) as _i5.Future); - @override - _i5.Future> fetchThemes() => (super.noSuchMethod( - Invocation.method( - #fetchThemes, - [], - ), - returnValue: _i5.Future>.value( - <_i3.StackThemeMetaData>[]), - ) as _i5.Future>); - @override - _i5.Future<_i6.Uint8List> fetchTheme( - {required _i3.StackThemeMetaData? themeMetaData}) => - (super.noSuchMethod( - Invocation.method( - #fetchTheme, - [], - {#themeMetaData: themeMetaData}, - ), - returnValue: _i5.Future<_i6.Uint8List>.value(_i6.Uint8List(0)), - ) as _i5.Future<_i6.Uint8List>); - @override - _i4.StackTheme? getTheme({required String? themeId}) => - (super.noSuchMethod(Invocation.method( - #getTheme, - [], - {#themeId: themeId}, - )) as _i4.StackTheme?); -} diff --git a/test/pages/send_view/send_view_test.dart b/test/pages/send_view/send_view_test.dart index 5e0e1ff0f..dc94abb1a 100644 --- a/test/pages/send_view/send_view_test.dart +++ b/test/pages/send_view/send_view_test.dart @@ -1,164 +1,164 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:mockito/annotations.dart'; -import 'package:mockito/mockito.dart'; -import 'package:stackduo/models/send_view_auto_fill_data.dart'; -import 'package:stackduo/pages/send_view/send_view.dart'; -import 'package:stackduo/providers/providers.dart'; -import 'package:stackduo/services/coins/bitcoin/bitcoin_wallet.dart'; -import 'package:stackduo/services/coins/coin_service.dart'; -import 'package:stackduo/services/coins/manager.dart'; -import 'package:stackduo/services/locale_service.dart'; -import 'package:stackduo/services/node_service.dart'; -import 'package:stackduo/services/wallets.dart'; -import 'package:stackduo/services/wallets_service.dart'; -import 'package:stackduo/utilities/enums/coin_enum.dart'; -import 'package:stackduo/utilities/prefs.dart'; -import 'package:stackduo/utilities/theme/light_colors.dart'; -import 'package:stackduo/utilities/theme/stack_colors.dart'; - -import 'send_view_test.mocks.dart'; - -@GenerateMocks([ - Wallets, - WalletsService, - NodeService, - BitcoinWallet, - LocaleService, - Prefs, -], customMocks: [ - MockSpec(returnNullOnMissingStub: true), - MockSpec(returnNullOnMissingStub: true), -]) -void main() { - testWidgets("Send to valid address", (widgetTester) async { - final mockWallets = MockWallets(); - final mockWalletsService = MockWalletsService(); - final mockNodeService = MockNodeService(); - final CoinServiceAPI wallet = MockBitcoinWallet(); - final mockLocaleService = MockLocaleService(); - final mockPrefs = MockPrefs(); - - when(wallet.coin).thenAnswer((_) => Coin.bitcoin); - when(wallet.walletName).thenAnswer((_) => "some wallet"); - when(wallet.walletId).thenAnswer((_) => "wallet id"); - - final manager = Manager(wallet); - when(mockWallets.getManagerProvider("wallet id")).thenAnswer( - (realInvocation) => ChangeNotifierProvider((ref) => manager)); - when(mockWallets.getManager("wallet id")) - .thenAnswer((realInvocation) => manager); - - when(mockLocaleService.locale).thenAnswer((_) => "en_US"); - when(mockPrefs.currency).thenAnswer((_) => "USD"); - when(mockPrefs.enableCoinControl).thenAnswer((_) => false); - when(wallet.validateAddress("send to address")) - .thenAnswer((realInvocation) => true); - - await widgetTester.pumpWidget( - ProviderScope( - overrides: [ - walletsChangeNotifierProvider.overrideWithValue(mockWallets), - walletsServiceChangeNotifierProvider - .overrideWithValue(mockWalletsService), - nodeServiceChangeNotifierProvider.overrideWithValue(mockNodeService), - localeServiceChangeNotifierProvider - .overrideWithValue(mockLocaleService), - prefsChangeNotifierProvider.overrideWithValue(mockPrefs), - // previewTxButtonStateProvider - ], - child: MaterialApp( - theme: ThemeData( - extensions: [ - StackColors.fromStackColorTheme( - LightColors(), - ), - ], - ), - home: SendView( - walletId: "wallet id", - coin: Coin.bitcoin, - autoFillData: SendViewAutoFillData( - address: "send to address", contactLabel: "contact label"), - ), - ), - ), - ); - - await widgetTester.pumpAndSettle(); - - expect(find.text("Send to"), findsOneWidget); - expect(find.text("Amount"), findsOneWidget); - expect(find.text("Note (optional)"), findsOneWidget); - expect(find.text("Transaction fee (estimated)"), findsOneWidget); - verify(manager.validateAddress("send to address")).called(1); - }); - - testWidgets("Send to invalid address", (widgetTester) async { - final mockWallets = MockWallets(); - final mockWalletsService = MockWalletsService(); - final mockNodeService = MockNodeService(); - final CoinServiceAPI wallet = MockBitcoinWallet(); - final mockLocaleService = MockLocaleService(); - final mockPrefs = MockPrefs(); - - when(wallet.coin).thenAnswer((_) => Coin.bitcoin); - when(wallet.walletName).thenAnswer((_) => "some wallet"); - when(wallet.walletId).thenAnswer((_) => "wallet id"); - - final manager = Manager(wallet); - when(mockWallets.getManagerProvider("wallet id")).thenAnswer( - (realInvocation) => ChangeNotifierProvider((ref) => manager)); - when(mockWallets.getManager("wallet id")) - .thenAnswer((realInvocation) => manager); - - when(mockLocaleService.locale).thenAnswer((_) => "en_US"); - when(mockPrefs.currency).thenAnswer((_) => "USD"); - when(mockPrefs.enableCoinControl).thenAnswer((_) => false); - when(wallet.validateAddress("send to address")) - .thenAnswer((realInvocation) => false); - - // when(manager.isOwnAddress("send to address")) - // .thenAnswer((realInvocation) => Future(() => true)); - - await widgetTester.pumpWidget( - ProviderScope( - overrides: [ - walletsChangeNotifierProvider.overrideWithValue(mockWallets), - walletsServiceChangeNotifierProvider - .overrideWithValue(mockWalletsService), - nodeServiceChangeNotifierProvider.overrideWithValue(mockNodeService), - localeServiceChangeNotifierProvider - .overrideWithValue(mockLocaleService), - prefsChangeNotifierProvider.overrideWithValue(mockPrefs), - // previewTxButtonStateProvider - ], - child: MaterialApp( - theme: ThemeData( - extensions: [ - StackColors.fromStackColorTheme( - LightColors(), - ), - ], - ), - home: SendView( - walletId: "wallet id", - coin: Coin.bitcoin, - autoFillData: SendViewAutoFillData( - address: "send to address", contactLabel: "contact label"), - ), - ), - ), - ); - - await widgetTester.pumpAndSettle(); - - expect(find.text("Send to"), findsOneWidget); - expect(find.text("Amount"), findsOneWidget); - expect(find.text("Note (optional)"), findsOneWidget); - expect(find.text("Transaction fee (estimated)"), findsOneWidget); - expect(find.text("Invalid address"), findsOneWidget); - verify(manager.validateAddress("send to address")).called(1); - }); -} +// import 'package:flutter/material.dart'; +// import 'package:flutter_riverpod/flutter_riverpod.dart'; +// import 'package:flutter_test/flutter_test.dart'; +// import 'package:mockito/annotations.dart'; +// import 'package:mockito/mockito.dart'; +// import 'package:stackduo/models/send_view_auto_fill_data.dart'; +// import 'package:stackduo/pages/send_view/send_view.dart'; +// import 'package:stackduo/providers/providers.dart'; +// import 'package:stackduo/services/coins/bitcoin/bitcoin_wallet.dart'; +// import 'package:stackduo/services/coins/coin_service.dart'; +// import 'package:stackduo/services/coins/manager.dart'; +// import 'package:stackduo/services/locale_service.dart'; +// import 'package:stackduo/services/node_service.dart'; +// import 'package:stackduo/services/wallets.dart'; +// import 'package:stackduo/services/wallets_service.dart'; +// import 'package:stackduo/utilities/enums/coin_enum.dart'; +// import 'package:stackduo/utilities/prefs.dart'; +// import 'package:stackduo/utilities/theme/light_colors.dart'; +// import 'package:stackduo/utilities/theme/stack_colors.dart'; +// +// import 'send_view_test.mocks.dart'; +// +// @GenerateMocks([ +// Wallets, +// WalletsService, +// NodeService, +// BitcoinWallet, +// LocaleService, +// Prefs, +// ], customMocks: [ +// MockSpec(returnNullOnMissingStub: true), +// MockSpec(returnNullOnMissingStub: true), +// ]) +// void main() { +// testWidgets("Send to valid address", (widgetTester) async { +// final mockWallets = MockWallets(); +// final mockWalletsService = MockWalletsService(); +// final mockNodeService = MockNodeService(); +// final CoinServiceAPI wallet = MockBitcoinWallet(); +// final mockLocaleService = MockLocaleService(); +// final mockPrefs = MockPrefs(); +// +// when(wallet.coin).thenAnswer((_) => Coin.bitcoin); +// when(wallet.walletName).thenAnswer((_) => "some wallet"); +// when(wallet.walletId).thenAnswer((_) => "wallet id"); +// +// final manager = Manager(wallet); +// when(mockWallets.getManagerProvider("wallet id")).thenAnswer( +// (realInvocation) => ChangeNotifierProvider((ref) => manager)); +// when(mockWallets.getManager("wallet id")) +// .thenAnswer((realInvocation) => manager); +// +// when(mockLocaleService.locale).thenAnswer((_) => "en_US"); +// when(mockPrefs.currency).thenAnswer((_) => "USD"); +// when(mockPrefs.enableCoinControl).thenAnswer((_) => false); +// when(wallet.validateAddress("send to address")) +// .thenAnswer((realInvocation) => true); +// +// await widgetTester.pumpWidget( +// ProviderScope( +// overrides: [ +// walletsChangeNotifierProvider.overrideWithValue(mockWallets), +// walletsServiceChangeNotifierProvider +// .overrideWithValue(mockWalletsService), +// nodeServiceChangeNotifierProvider.overrideWithValue(mockNodeService), +// localeServiceChangeNotifierProvider +// .overrideWithValue(mockLocaleService), +// prefsChangeNotifierProvider.overrideWithValue(mockPrefs), +// // previewTxButtonStateProvider +// ], +// child: MaterialApp( +// theme: ThemeData( +// extensions: [ +// StackColors.fromStackColorTheme( +// LightColors(), +// ), +// ], +// ), +// home: SendView( +// walletId: "wallet id", +// coin: Coin.bitcoin, +// autoFillData: SendViewAutoFillData( +// address: "send to address", contactLabel: "contact label"), +// ), +// ), +// ), +// ); +// +// await widgetTester.pumpAndSettle(); +// +// expect(find.text("Send to"), findsOneWidget); +// expect(find.text("Amount"), findsOneWidget); +// expect(find.text("Note (optional)"), findsOneWidget); +// expect(find.text("Transaction fee (estimated)"), findsOneWidget); +// verify(manager.validateAddress("send to address")).called(1); +// }); +// +// testWidgets("Send to invalid address", (widgetTester) async { +// final mockWallets = MockWallets(); +// final mockWalletsService = MockWalletsService(); +// final mockNodeService = MockNodeService(); +// final CoinServiceAPI wallet = MockBitcoinWallet(); +// final mockLocaleService = MockLocaleService(); +// final mockPrefs = MockPrefs(); +// +// when(wallet.coin).thenAnswer((_) => Coin.bitcoin); +// when(wallet.walletName).thenAnswer((_) => "some wallet"); +// when(wallet.walletId).thenAnswer((_) => "wallet id"); +// +// final manager = Manager(wallet); +// when(mockWallets.getManagerProvider("wallet id")).thenAnswer( +// (realInvocation) => ChangeNotifierProvider((ref) => manager)); +// when(mockWallets.getManager("wallet id")) +// .thenAnswer((realInvocation) => manager); +// +// when(mockLocaleService.locale).thenAnswer((_) => "en_US"); +// when(mockPrefs.currency).thenAnswer((_) => "USD"); +// when(mockPrefs.enableCoinControl).thenAnswer((_) => false); +// when(wallet.validateAddress("send to address")) +// .thenAnswer((realInvocation) => false); +// +// // when(manager.isOwnAddress("send to address")) +// // .thenAnswer((realInvocation) => Future(() => true)); +// +// await widgetTester.pumpWidget( +// ProviderScope( +// overrides: [ +// walletsChangeNotifierProvider.overrideWithValue(mockWallets), +// walletsServiceChangeNotifierProvider +// .overrideWithValue(mockWalletsService), +// nodeServiceChangeNotifierProvider.overrideWithValue(mockNodeService), +// localeServiceChangeNotifierProvider +// .overrideWithValue(mockLocaleService), +// prefsChangeNotifierProvider.overrideWithValue(mockPrefs), +// // previewTxButtonStateProvider +// ], +// child: MaterialApp( +// theme: ThemeData( +// extensions: [ +// StackColors.fromStackColorTheme( +// LightColors(), +// ), +// ], +// ), +// home: SendView( +// walletId: "wallet id", +// coin: Coin.bitcoin, +// autoFillData: SendViewAutoFillData( +// address: "send to address", contactLabel: "contact label"), +// ), +// ), +// ), +// ); +// +// await widgetTester.pumpAndSettle(); +// +// expect(find.text("Send to"), findsOneWidget); +// expect(find.text("Amount"), findsOneWidget); +// expect(find.text("Note (optional)"), findsOneWidget); +// expect(find.text("Transaction fee (estimated)"), findsOneWidget); +// expect(find.text("Invalid address"), findsOneWidget); +// verify(manager.validateAddress("send to address")).called(1); +// }); +// } diff --git a/test/pages/send_view/send_view_test.mocks.dart b/test/pages/send_view/send_view_test.mocks.dart deleted file mode 100644 index 2276836ce..000000000 --- a/test/pages/send_view/send_view_test.mocks.dart +++ /dev/null @@ -1,3449 +0,0 @@ -// Mocks generated by Mockito 5.3.2 from annotations -// in stackwallet/test/pages/send_view/send_view_test.dart. -// Do not manually edit this file. - -// ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i23; -import 'dart:typed_data' as _i30; -import 'dart:ui' as _i25; - -import 'package:bip32/bip32.dart' as _i17; -import 'package:bip47/bip47.dart' as _i19; -import 'package:bitcoindart/bitcoindart.dart' as _i14; -import 'package:flutter/foundation.dart' as _i4; -import 'package:flutter_riverpod/flutter_riverpod.dart' as _i5; -import 'package:mockito/mockito.dart' as _i1; -import 'package:stackwallet/db/isar/main_db.dart' as _i13; -import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i11; -import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i10; -import 'package:stackwallet/models/balance.dart' as _i12; -import 'package:stackwallet/models/isar/models/isar_models.dart' as _i18; -import 'package:stackwallet/models/isar/stack_theme.dart' as _i33; -import 'package:stackwallet/models/node_model.dart' as _i26; -import 'package:stackwallet/models/paymint/fee_object_model.dart' as _i9; -import 'package:stackwallet/models/signing_data.dart' as _i29; -import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart' as _i27; -import 'package:stackwallet/services/coins/coin_service.dart' as _i20; -import 'package:stackwallet/services/coins/manager.dart' as _i6; -import 'package:stackwallet/services/locale_service.dart' as _i31; -import 'package:stackwallet/services/node_service.dart' as _i3; -import 'package:stackwallet/services/transaction_notification_tracker.dart' - as _i8; -import 'package:stackwallet/services/wallets.dart' as _i21; -import 'package:stackwallet/services/wallets_service.dart' as _i2; -import 'package:stackwallet/themes/theme_service.dart' as _i32; -import 'package:stackwallet/utilities/amount/amount.dart' as _i15; -import 'package:stackwallet/utilities/enums/backup_frequency_type.dart' as _i35; -import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i22; -import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart' as _i28; -import 'package:stackwallet/utilities/enums/sync_type_enum.dart' as _i34; -import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart' - as _i7; -import 'package:stackwallet/utilities/prefs.dart' as _i24; -import 'package:tuple/tuple.dart' as _i16; - -// ignore_for_file: type=lint -// ignore_for_file: avoid_redundant_argument_values -// ignore_for_file: avoid_setters_without_getters -// ignore_for_file: comment_references -// ignore_for_file: implementation_imports -// ignore_for_file: invalid_use_of_visible_for_testing_member -// ignore_for_file: prefer_const_constructors -// ignore_for_file: unnecessary_parenthesis -// ignore_for_file: camel_case_types -// ignore_for_file: subtype_of_sealed_class - -class _FakeWalletsService_0 extends _i1.SmartFake - implements _i2.WalletsService { - _FakeWalletsService_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeNodeService_1 extends _i1.SmartFake implements _i3.NodeService { - _FakeNodeService_1( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeChangeNotifierProvider_2 - extends _i1.SmartFake implements _i5.ChangeNotifierProvider { - _FakeChangeNotifierProvider_2( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeManager_3 extends _i1.SmartFake implements _i6.Manager { - _FakeManager_3( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeSecureStorageInterface_4 extends _i1.SmartFake - implements _i7.SecureStorageInterface { - _FakeSecureStorageInterface_4( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeTransactionNotificationTracker_5 extends _i1.SmartFake - implements _i8.TransactionNotificationTracker { - _FakeTransactionNotificationTracker_5( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeFeeObject_6 extends _i1.SmartFake implements _i9.FeeObject { - _FakeFeeObject_6( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeElectrumX_7 extends _i1.SmartFake implements _i10.ElectrumX { - _FakeElectrumX_7( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeCachedElectrumX_8 extends _i1.SmartFake - implements _i11.CachedElectrumX { - _FakeCachedElectrumX_8( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeBalance_9 extends _i1.SmartFake implements _i12.Balance { - _FakeBalance_9( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeMainDB_10 extends _i1.SmartFake implements _i13.MainDB { - _FakeMainDB_10( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeNetworkType_11 extends _i1.SmartFake implements _i14.NetworkType { - _FakeNetworkType_11( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeElectrumXNode_12 extends _i1.SmartFake - implements _i10.ElectrumXNode { - _FakeElectrumXNode_12( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeAmount_13 extends _i1.SmartFake implements _i15.Amount { - _FakeAmount_13( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeTuple2_14 extends _i1.SmartFake - implements _i16.Tuple2 { - _FakeTuple2_14( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeBIP32_15 extends _i1.SmartFake implements _i17.BIP32 { - _FakeBIP32_15( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeAddress_16 extends _i1.SmartFake implements _i18.Address { - _FakeAddress_16( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakePaymentCode_17 extends _i1.SmartFake implements _i19.PaymentCode { - _FakePaymentCode_17( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeCoinServiceAPI_18 extends _i1.SmartFake - implements _i20.CoinServiceAPI { - _FakeCoinServiceAPI_18( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -/// A class which mocks [Wallets]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockWallets extends _i1.Mock implements _i21.Wallets { - MockWallets() { - _i1.throwOnMissingStub(this); - } - - @override - _i2.WalletsService get walletsService => (super.noSuchMethod( - Invocation.getter(#walletsService), - returnValue: _FakeWalletsService_0( - this, - Invocation.getter(#walletsService), - ), - ) as _i2.WalletsService); - @override - set walletsService(_i2.WalletsService? _walletsService) => super.noSuchMethod( - Invocation.setter( - #walletsService, - _walletsService, - ), - returnValueForMissingStub: null, - ); - @override - _i3.NodeService get nodeService => (super.noSuchMethod( - Invocation.getter(#nodeService), - returnValue: _FakeNodeService_1( - this, - Invocation.getter(#nodeService), - ), - ) as _i3.NodeService); - @override - set nodeService(_i3.NodeService? _nodeService) => super.noSuchMethod( - Invocation.setter( - #nodeService, - _nodeService, - ), - returnValueForMissingStub: null, - ); - @override - bool get hasWallets => (super.noSuchMethod( - Invocation.getter(#hasWallets), - returnValue: false, - ) as bool); - @override - List<_i5.ChangeNotifierProvider<_i6.Manager>> get managerProviders => - (super.noSuchMethod( - Invocation.getter(#managerProviders), - returnValue: <_i5.ChangeNotifierProvider<_i6.Manager>>[], - ) as List<_i5.ChangeNotifierProvider<_i6.Manager>>); - @override - List<_i6.Manager> get managers => (super.noSuchMethod( - Invocation.getter(#managers), - returnValue: <_i6.Manager>[], - ) as List<_i6.Manager>); - @override - bool get hasListeners => (super.noSuchMethod( - Invocation.getter(#hasListeners), - returnValue: false, - ) as bool); - @override - void dispose() => super.noSuchMethod( - Invocation.method( - #dispose, - [], - ), - returnValueForMissingStub: null, - ); - @override - List getWalletIdsFor({required _i22.Coin? coin}) => - (super.noSuchMethod( - Invocation.method( - #getWalletIdsFor, - [], - {#coin: coin}, - ), - returnValue: [], - ) as List); - @override - List<_i16.Tuple2<_i22.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>> - getManagerProvidersByCoin() => (super.noSuchMethod( - Invocation.method( - #getManagerProvidersByCoin, - [], - ), - returnValue: < - _i16.Tuple2<_i22.Coin, - List<_i5.ChangeNotifierProvider<_i6.Manager>>>>[], - ) as List< - _i16.Tuple2<_i22.Coin, - List<_i5.ChangeNotifierProvider<_i6.Manager>>>>); - @override - List<_i5.ChangeNotifierProvider<_i6.Manager>> getManagerProvidersForCoin( - _i22.Coin? coin) => - (super.noSuchMethod( - Invocation.method( - #getManagerProvidersForCoin, - [coin], - ), - returnValue: <_i5.ChangeNotifierProvider<_i6.Manager>>[], - ) as List<_i5.ChangeNotifierProvider<_i6.Manager>>); - @override - _i5.ChangeNotifierProvider<_i6.Manager> getManagerProvider( - String? walletId) => - (super.noSuchMethod( - Invocation.method( - #getManagerProvider, - [walletId], - ), - returnValue: _FakeChangeNotifierProvider_2<_i6.Manager>( - this, - Invocation.method( - #getManagerProvider, - [walletId], - ), - ), - ) as _i5.ChangeNotifierProvider<_i6.Manager>); - @override - _i6.Manager getManager(String? walletId) => (super.noSuchMethod( - Invocation.method( - #getManager, - [walletId], - ), - returnValue: _FakeManager_3( - this, - Invocation.method( - #getManager, - [walletId], - ), - ), - ) as _i6.Manager); - @override - void addWallet({ - required String? walletId, - required _i6.Manager? manager, - }) => - super.noSuchMethod( - Invocation.method( - #addWallet, - [], - { - #walletId: walletId, - #manager: manager, - }, - ), - returnValueForMissingStub: null, - ); - @override - void removeWallet({required String? walletId}) => super.noSuchMethod( - Invocation.method( - #removeWallet, - [], - {#walletId: walletId}, - ), - returnValueForMissingStub: null, - ); - @override - _i23.Future load(_i24.Prefs? prefs) => (super.noSuchMethod( - Invocation.method( - #load, - [prefs], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future loadAfterStackRestore( - _i24.Prefs? prefs, - List<_i6.Manager>? managers, - ) => - (super.noSuchMethod( - Invocation.method( - #loadAfterStackRestore, - [ - prefs, - managers, - ], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #addListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #removeListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void notifyListeners() => super.noSuchMethod( - Invocation.method( - #notifyListeners, - [], - ), - returnValueForMissingStub: null, - ); -} - -/// A class which mocks [WalletsService]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockWalletsService extends _i1.Mock implements _i2.WalletsService { - MockWalletsService() { - _i1.throwOnMissingStub(this); - } - - @override - _i23.Future> get walletNames => - (super.noSuchMethod( - Invocation.getter(#walletNames), - returnValue: _i23.Future>.value( - {}), - ) as _i23.Future>); - @override - bool get hasListeners => (super.noSuchMethod( - Invocation.getter(#hasListeners), - returnValue: false, - ) as bool); - @override - _i23.Future renameWallet({ - required String? from, - required String? to, - required bool? shouldNotifyListeners, - }) => - (super.noSuchMethod( - Invocation.method( - #renameWallet, - [], - { - #from: from, - #to: to, - #shouldNotifyListeners: shouldNotifyListeners, - }, - ), - returnValue: _i23.Future.value(false), - ) as _i23.Future); - @override - Map fetchWalletsData() => (super.noSuchMethod( - Invocation.method( - #fetchWalletsData, - [], - ), - returnValue: {}, - ) as Map); - @override - _i23.Future addExistingStackWallet({ - required String? name, - required String? walletId, - required _i22.Coin? coin, - required bool? shouldNotifyListeners, - }) => - (super.noSuchMethod( - Invocation.method( - #addExistingStackWallet, - [], - { - #name: name, - #walletId: walletId, - #coin: coin, - #shouldNotifyListeners: shouldNotifyListeners, - }, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future addNewWallet({ - required String? name, - required _i22.Coin? coin, - required bool? shouldNotifyListeners, - }) => - (super.noSuchMethod( - Invocation.method( - #addNewWallet, - [], - { - #name: name, - #coin: coin, - #shouldNotifyListeners: shouldNotifyListeners, - }, - ), - returnValue: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future> getFavoriteWalletIds() => (super.noSuchMethod( - Invocation.method( - #getFavoriteWalletIds, - [], - ), - returnValue: _i23.Future>.value([]), - ) as _i23.Future>); - @override - _i23.Future saveFavoriteWalletIds(List? walletIds) => - (super.noSuchMethod( - Invocation.method( - #saveFavoriteWalletIds, - [walletIds], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future addFavorite(String? walletId) => (super.noSuchMethod( - Invocation.method( - #addFavorite, - [walletId], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future removeFavorite(String? walletId) => (super.noSuchMethod( - Invocation.method( - #removeFavorite, - [walletId], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future moveFavorite({ - required int? fromIndex, - required int? toIndex, - }) => - (super.noSuchMethod( - Invocation.method( - #moveFavorite, - [], - { - #fromIndex: fromIndex, - #toIndex: toIndex, - }, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future checkForDuplicate(String? name) => (super.noSuchMethod( - Invocation.method( - #checkForDuplicate, - [name], - ), - returnValue: _i23.Future.value(false), - ) as _i23.Future); - @override - _i23.Future getWalletId(String? walletName) => (super.noSuchMethod( - Invocation.method( - #getWalletId, - [walletName], - ), - returnValue: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future isMnemonicVerified({required String? walletId}) => - (super.noSuchMethod( - Invocation.method( - #isMnemonicVerified, - [], - {#walletId: walletId}, - ), - returnValue: _i23.Future.value(false), - ) as _i23.Future); - @override - _i23.Future setMnemonicVerified({required String? walletId}) => - (super.noSuchMethod( - Invocation.method( - #setMnemonicVerified, - [], - {#walletId: walletId}, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future deleteWallet( - String? name, - bool? shouldNotifyListeners, - ) => - (super.noSuchMethod( - Invocation.method( - #deleteWallet, - [ - name, - shouldNotifyListeners, - ], - ), - returnValue: _i23.Future.value(0), - ) as _i23.Future); - @override - _i23.Future refreshWallets(bool? shouldNotifyListeners) => - (super.noSuchMethod( - Invocation.method( - #refreshWallets, - [shouldNotifyListeners], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #addListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #removeListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void dispose() => super.noSuchMethod( - Invocation.method( - #dispose, - [], - ), - returnValueForMissingStub: null, - ); - @override - void notifyListeners() => super.noSuchMethod( - Invocation.method( - #notifyListeners, - [], - ), - returnValueForMissingStub: null, - ); -} - -/// A class which mocks [NodeService]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockNodeService extends _i1.Mock implements _i3.NodeService { - MockNodeService() { - _i1.throwOnMissingStub(this); - } - - @override - _i7.SecureStorageInterface get secureStorageInterface => (super.noSuchMethod( - Invocation.getter(#secureStorageInterface), - returnValue: _FakeSecureStorageInterface_4( - this, - Invocation.getter(#secureStorageInterface), - ), - ) as _i7.SecureStorageInterface); - @override - List<_i26.NodeModel> get primaryNodes => (super.noSuchMethod( - Invocation.getter(#primaryNodes), - returnValue: <_i26.NodeModel>[], - ) as List<_i26.NodeModel>); - @override - List<_i26.NodeModel> get nodes => (super.noSuchMethod( - Invocation.getter(#nodes), - returnValue: <_i26.NodeModel>[], - ) as List<_i26.NodeModel>); - @override - bool get hasListeners => (super.noSuchMethod( - Invocation.getter(#hasListeners), - returnValue: false, - ) as bool); - @override - _i23.Future updateDefaults() => (super.noSuchMethod( - Invocation.method( - #updateDefaults, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future setPrimaryNodeFor({ - required _i22.Coin? coin, - required _i26.NodeModel? node, - bool? shouldNotifyListeners = false, - }) => - (super.noSuchMethod( - Invocation.method( - #setPrimaryNodeFor, - [], - { - #coin: coin, - #node: node, - #shouldNotifyListeners: shouldNotifyListeners, - }, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i26.NodeModel? getPrimaryNodeFor({required _i22.Coin? coin}) => - (super.noSuchMethod(Invocation.method( - #getPrimaryNodeFor, - [], - {#coin: coin}, - )) as _i26.NodeModel?); - @override - List<_i26.NodeModel> getNodesFor(_i22.Coin? coin) => (super.noSuchMethod( - Invocation.method( - #getNodesFor, - [coin], - ), - returnValue: <_i26.NodeModel>[], - ) as List<_i26.NodeModel>); - @override - _i26.NodeModel? getNodeById({required String? id}) => - (super.noSuchMethod(Invocation.method( - #getNodeById, - [], - {#id: id}, - )) as _i26.NodeModel?); - @override - List<_i26.NodeModel> failoverNodesFor({required _i22.Coin? coin}) => - (super.noSuchMethod( - Invocation.method( - #failoverNodesFor, - [], - {#coin: coin}, - ), - returnValue: <_i26.NodeModel>[], - ) as List<_i26.NodeModel>); - @override - _i23.Future add( - _i26.NodeModel? node, - String? password, - bool? shouldNotifyListeners, - ) => - (super.noSuchMethod( - Invocation.method( - #add, - [ - node, - password, - shouldNotifyListeners, - ], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future delete( - String? id, - bool? shouldNotifyListeners, - ) => - (super.noSuchMethod( - Invocation.method( - #delete, - [ - id, - shouldNotifyListeners, - ], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future setEnabledState( - String? id, - bool? enabled, - bool? shouldNotifyListeners, - ) => - (super.noSuchMethod( - Invocation.method( - #setEnabledState, - [ - id, - enabled, - shouldNotifyListeners, - ], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future edit( - _i26.NodeModel? editedNode, - String? password, - bool? shouldNotifyListeners, - ) => - (super.noSuchMethod( - Invocation.method( - #edit, - [ - editedNode, - password, - shouldNotifyListeners, - ], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future updateCommunityNodes() => (super.noSuchMethod( - Invocation.method( - #updateCommunityNodes, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #addListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #removeListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void dispose() => super.noSuchMethod( - Invocation.method( - #dispose, - [], - ), - returnValueForMissingStub: null, - ); - @override - void notifyListeners() => super.noSuchMethod( - Invocation.method( - #notifyListeners, - [], - ), - returnValueForMissingStub: null, - ); -} - -/// A class which mocks [BitcoinWallet]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockBitcoinWallet extends _i1.Mock implements _i27.BitcoinWallet { - MockBitcoinWallet() { - _i1.throwOnMissingStub(this); - } - - @override - set timer(_i23.Timer? _timer) => super.noSuchMethod( - Invocation.setter( - #timer, - _timer, - ), - returnValueForMissingStub: null, - ); - @override - _i8.TransactionNotificationTracker get txTracker => (super.noSuchMethod( - Invocation.getter(#txTracker), - returnValue: _FakeTransactionNotificationTracker_5( - this, - Invocation.getter(#txTracker), - ), - ) as _i8.TransactionNotificationTracker); - @override - set txTracker(_i8.TransactionNotificationTracker? _txTracker) => - super.noSuchMethod( - Invocation.setter( - #txTracker, - _txTracker, - ), - returnValueForMissingStub: null, - ); - @override - bool get longMutex => (super.noSuchMethod( - Invocation.getter(#longMutex), - returnValue: false, - ) as bool); - @override - set longMutex(bool? _longMutex) => super.noSuchMethod( - Invocation.setter( - #longMutex, - _longMutex, - ), - returnValueForMissingStub: null, - ); - @override - bool get refreshMutex => (super.noSuchMethod( - Invocation.getter(#refreshMutex), - returnValue: false, - ) as bool); - @override - set refreshMutex(bool? _refreshMutex) => super.noSuchMethod( - Invocation.setter( - #refreshMutex, - _refreshMutex, - ), - returnValueForMissingStub: null, - ); - @override - bool get isActive => (super.noSuchMethod( - Invocation.getter(#isActive), - returnValue: false, - ) as bool); - @override - set isActive(bool? _isActive) => super.noSuchMethod( - Invocation.setter( - #isActive, - _isActive, - ), - returnValueForMissingStub: null, - ); - @override - set isFavorite(bool? markFavorite) => super.noSuchMethod( - Invocation.setter( - #isFavorite, - markFavorite, - ), - returnValueForMissingStub: null, - ); - @override - bool get isFavorite => (super.noSuchMethod( - Invocation.getter(#isFavorite), - returnValue: false, - ) as bool); - @override - _i22.Coin get coin => (super.noSuchMethod( - Invocation.getter(#coin), - returnValue: _i22.Coin.bitcoin, - ) as _i22.Coin); - @override - _i23.Future> get utxos => (super.noSuchMethod( - Invocation.getter(#utxos), - returnValue: _i23.Future>.value(<_i18.UTXO>[]), - ) as _i23.Future>); - @override - _i23.Future> get transactions => (super.noSuchMethod( - Invocation.getter(#transactions), - returnValue: - _i23.Future>.value(<_i18.Transaction>[]), - ) as _i23.Future>); - @override - _i23.Future get currentReceivingAddress => (super.noSuchMethod( - Invocation.getter(#currentReceivingAddress), - returnValue: _i23.Future.value(''), - ) as _i23.Future); - @override - _i23.Future get currentChangeAddress => (super.noSuchMethod( - Invocation.getter(#currentChangeAddress), - returnValue: _i23.Future.value(''), - ) as _i23.Future); - @override - _i23.Future get currentChangeAddressP2PKH => (super.noSuchMethod( - Invocation.getter(#currentChangeAddressP2PKH), - returnValue: _i23.Future.value(''), - ) as _i23.Future); - @override - bool get hasCalledExit => (super.noSuchMethod( - Invocation.getter(#hasCalledExit), - returnValue: false, - ) as bool); - @override - _i23.Future<_i9.FeeObject> get fees => (super.noSuchMethod( - Invocation.getter(#fees), - returnValue: _i23.Future<_i9.FeeObject>.value(_FakeFeeObject_6( - this, - Invocation.getter(#fees), - )), - ) as _i23.Future<_i9.FeeObject>); - @override - _i23.Future get maxFee => (super.noSuchMethod( - Invocation.getter(#maxFee), - returnValue: _i23.Future.value(0), - ) as _i23.Future); - @override - _i23.Future> get mnemonic => (super.noSuchMethod( - Invocation.getter(#mnemonic), - returnValue: _i23.Future>.value([]), - ) as _i23.Future>); - @override - _i23.Future get mnemonicString => (super.noSuchMethod( - Invocation.getter(#mnemonicString), - returnValue: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future get mnemonicPassphrase => (super.noSuchMethod( - Invocation.getter(#mnemonicPassphrase), - returnValue: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future get chainHeight => (super.noSuchMethod( - Invocation.getter(#chainHeight), - returnValue: _i23.Future.value(0), - ) as _i23.Future); - @override - int get storedChainHeight => (super.noSuchMethod( - Invocation.getter(#storedChainHeight), - returnValue: 0, - ) as int); - @override - bool get shouldAutoSync => (super.noSuchMethod( - Invocation.getter(#shouldAutoSync), - returnValue: false, - ) as bool); - @override - set shouldAutoSync(bool? shouldAutoSync) => super.noSuchMethod( - Invocation.setter( - #shouldAutoSync, - shouldAutoSync, - ), - returnValueForMissingStub: null, - ); - @override - bool get isRefreshing => (super.noSuchMethod( - Invocation.getter(#isRefreshing), - returnValue: false, - ) as bool); - @override - bool get isConnected => (super.noSuchMethod( - Invocation.getter(#isConnected), - returnValue: false, - ) as bool); - @override - String get walletId => (super.noSuchMethod( - Invocation.getter(#walletId), - returnValue: '', - ) as String); - @override - String get walletName => (super.noSuchMethod( - Invocation.getter(#walletName), - returnValue: '', - ) as String); - @override - set walletName(String? newName) => super.noSuchMethod( - Invocation.setter( - #walletName, - newName, - ), - returnValueForMissingStub: null, - ); - @override - _i10.ElectrumX get electrumXClient => (super.noSuchMethod( - Invocation.getter(#electrumXClient), - returnValue: _FakeElectrumX_7( - this, - Invocation.getter(#electrumXClient), - ), - ) as _i10.ElectrumX); - @override - _i11.CachedElectrumX get cachedElectrumXClient => (super.noSuchMethod( - Invocation.getter(#cachedElectrumXClient), - returnValue: _FakeCachedElectrumX_8( - this, - Invocation.getter(#cachedElectrumXClient), - ), - ) as _i11.CachedElectrumX); - @override - _i12.Balance get balance => (super.noSuchMethod( - Invocation.getter(#balance), - returnValue: _FakeBalance_9( - this, - Invocation.getter(#balance), - ), - ) as _i12.Balance); - @override - _i23.Future get xpub => (super.noSuchMethod( - Invocation.getter(#xpub), - returnValue: _i23.Future.value(''), - ) as _i23.Future); - @override - set onIsActiveWalletChanged(void Function(bool)? _onIsActiveWalletChanged) => - super.noSuchMethod( - Invocation.setter( - #onIsActiveWalletChanged, - _onIsActiveWalletChanged, - ), - returnValueForMissingStub: null, - ); - @override - _i13.MainDB get db => (super.noSuchMethod( - Invocation.getter(#db), - returnValue: _FakeMainDB_10( - this, - Invocation.getter(#db), - ), - ) as _i13.MainDB); - @override - _i14.NetworkType get networkType => (super.noSuchMethod( - Invocation.getter(#networkType), - returnValue: _FakeNetworkType_11( - this, - Invocation.getter(#networkType), - ), - ) as _i14.NetworkType); - @override - _i23.Future exit() => (super.noSuchMethod( - Invocation.method( - #exit, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i28.DerivePathType addressType({required String? address}) => - (super.noSuchMethod( - Invocation.method( - #addressType, - [], - {#address: address}, - ), - returnValue: _i28.DerivePathType.bip44, - ) as _i28.DerivePathType); - @override - _i23.Future recoverFromMnemonic({ - required String? mnemonic, - String? mnemonicPassphrase, - required int? maxUnusedAddressGap, - required int? maxNumberOfIndexesToCheck, - required int? height, - }) => - (super.noSuchMethod( - Invocation.method( - #recoverFromMnemonic, - [], - { - #mnemonic: mnemonic, - #mnemonicPassphrase: mnemonicPassphrase, - #maxUnusedAddressGap: maxUnusedAddressGap, - #maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck, - #height: height, - }, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future getTransactionCacheEarly(List? allAddresses) => - (super.noSuchMethod( - Invocation.method( - #getTransactionCacheEarly, - [allAddresses], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future refreshIfThereIsNewData() => (super.noSuchMethod( - Invocation.method( - #refreshIfThereIsNewData, - [], - ), - returnValue: _i23.Future.value(false), - ) as _i23.Future); - @override - _i23.Future getAllTxsToWatch() => (super.noSuchMethod( - Invocation.method( - #getAllTxsToWatch, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future refresh() => (super.noSuchMethod( - Invocation.method( - #refresh, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future> prepareSend({ - required String? address, - required _i15.Amount? amount, - Map? args, - }) => - (super.noSuchMethod( - Invocation.method( - #prepareSend, - [], - { - #address: address, - #amount: amount, - #args: args, - }, - ), - returnValue: - _i23.Future>.value({}), - ) as _i23.Future>); - @override - _i23.Future confirmSend({required Map? txData}) => - (super.noSuchMethod( - Invocation.method( - #confirmSend, - [], - {#txData: txData}, - ), - returnValue: _i23.Future.value(''), - ) as _i23.Future); - @override - _i23.Future testNetworkConnection() => (super.noSuchMethod( - Invocation.method( - #testNetworkConnection, - [], - ), - returnValue: _i23.Future.value(false), - ) as _i23.Future); - @override - void startNetworkAlivePinging() => super.noSuchMethod( - Invocation.method( - #startNetworkAlivePinging, - [], - ), - returnValueForMissingStub: null, - ); - @override - void stopNetworkAlivePinging() => super.noSuchMethod( - Invocation.method( - #stopNetworkAlivePinging, - [], - ), - returnValueForMissingStub: null, - ); - @override - _i23.Future initializeNew() => (super.noSuchMethod( - Invocation.method( - #initializeNew, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future initializeExisting() => (super.noSuchMethod( - Invocation.method( - #initializeExisting, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future updateSentCachedTxData(Map? txData) => - (super.noSuchMethod( - Invocation.method( - #updateSentCachedTxData, - [txData], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - bool validateAddress(String? address) => (super.noSuchMethod( - Invocation.method( - #validateAddress, - [address], - ), - returnValue: false, - ) as bool); - @override - _i23.Future updateNode(bool? shouldRefresh) => (super.noSuchMethod( - Invocation.method( - #updateNode, - [shouldRefresh], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future<_i10.ElectrumXNode> getCurrentNode() => (super.noSuchMethod( - Invocation.method( - #getCurrentNode, - [], - ), - returnValue: - _i23.Future<_i10.ElectrumXNode>.value(_FakeElectrumXNode_12( - this, - Invocation.method( - #getCurrentNode, - [], - ), - )), - ) as _i23.Future<_i10.ElectrumXNode>); - @override - _i23.Future>> fastFetch( - List? allTxHashes) => - (super.noSuchMethod( - Invocation.method( - #fastFetch, - [allTxHashes], - ), - returnValue: _i23.Future>>.value( - >[]), - ) as _i23.Future>>); - @override - _i23.Future getTxCount({required String? address}) => - (super.noSuchMethod( - Invocation.method( - #getTxCount, - [], - {#address: address}, - ), - returnValue: _i23.Future.value(0), - ) as _i23.Future); - @override - _i23.Future checkCurrentReceivingAddressesForTransactions() => - (super.noSuchMethod( - Invocation.method( - #checkCurrentReceivingAddressesForTransactions, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future checkCurrentChangeAddressesForTransactions() => - (super.noSuchMethod( - Invocation.method( - #checkCurrentChangeAddressesForTransactions, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - int estimateTxFee({ - required int? vSize, - required int? feeRatePerKB, - }) => - (super.noSuchMethod( - Invocation.method( - #estimateTxFee, - [], - { - #vSize: vSize, - #feeRatePerKB: feeRatePerKB, - }, - ), - returnValue: 0, - ) as int); - @override - dynamic coinSelection({ - required int? satoshiAmountToSend, - required int? selectedTxFeeRate, - required String? recipientAddress, - required bool? coinControl, - required bool? isSendAll, - int? additionalOutputs = 0, - List<_i18.UTXO>? utxos, - }) => - super.noSuchMethod(Invocation.method( - #coinSelection, - [], - { - #satoshiAmountToSend: satoshiAmountToSend, - #selectedTxFeeRate: selectedTxFeeRate, - #recipientAddress: recipientAddress, - #coinControl: coinControl, - #isSendAll: isSendAll, - #additionalOutputs: additionalOutputs, - #utxos: utxos, - }, - )); - @override - _i23.Future> fetchBuildTxData( - List<_i18.UTXO>? utxosToUse) => - (super.noSuchMethod( - Invocation.method( - #fetchBuildTxData, - [utxosToUse], - ), - returnValue: - _i23.Future>.value(<_i29.SigningData>[]), - ) as _i23.Future>); - @override - _i23.Future> buildTransaction({ - required List<_i29.SigningData>? utxoSigningData, - required List? recipients, - required List? satoshiAmounts, - }) => - (super.noSuchMethod( - Invocation.method( - #buildTransaction, - [], - { - #utxoSigningData: utxoSigningData, - #recipients: recipients, - #satoshiAmounts: satoshiAmounts, - }, - ), - returnValue: - _i23.Future>.value({}), - ) as _i23.Future>); - @override - _i23.Future fullRescan( - int? maxUnusedAddressGap, - int? maxNumberOfIndexesToCheck, - ) => - (super.noSuchMethod( - Invocation.method( - #fullRescan, - [ - maxUnusedAddressGap, - maxNumberOfIndexesToCheck, - ], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future<_i15.Amount> estimateFeeFor( - _i15.Amount? amount, - int? feeRate, - ) => - (super.noSuchMethod( - Invocation.method( - #estimateFeeFor, - [ - amount, - feeRate, - ], - ), - returnValue: _i23.Future<_i15.Amount>.value(_FakeAmount_13( - this, - Invocation.method( - #estimateFeeFor, - [ - amount, - feeRate, - ], - ), - )), - ) as _i23.Future<_i15.Amount>); - @override - _i15.Amount roughFeeEstimate( - int? inputCount, - int? outputCount, - int? feeRatePerKB, - ) => - (super.noSuchMethod( - Invocation.method( - #roughFeeEstimate, - [ - inputCount, - outputCount, - feeRatePerKB, - ], - ), - returnValue: _FakeAmount_13( - this, - Invocation.method( - #roughFeeEstimate, - [ - inputCount, - outputCount, - feeRatePerKB, - ], - ), - ), - ) as _i15.Amount); - @override - _i23.Future<_i15.Amount> sweepAllEstimate(int? feeRate) => - (super.noSuchMethod( - Invocation.method( - #sweepAllEstimate, - [feeRate], - ), - returnValue: _i23.Future<_i15.Amount>.value(_FakeAmount_13( - this, - Invocation.method( - #sweepAllEstimate, - [feeRate], - ), - )), - ) as _i23.Future<_i15.Amount>); - @override - _i23.Future generateNewAddress() => (super.noSuchMethod( - Invocation.method( - #generateNewAddress, - [], - ), - returnValue: _i23.Future.value(false), - ) as _i23.Future); - @override - void initCache( - String? walletId, - _i22.Coin? coin, - ) => - super.noSuchMethod( - Invocation.method( - #initCache, - [ - walletId, - coin, - ], - ), - returnValueForMissingStub: null, - ); - @override - _i23.Future updateCachedId(String? id) => (super.noSuchMethod( - Invocation.method( - #updateCachedId, - [id], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - int getCachedChainHeight() => (super.noSuchMethod( - Invocation.method( - #getCachedChainHeight, - [], - ), - returnValue: 0, - ) as int); - @override - _i23.Future updateCachedChainHeight(int? height) => (super.noSuchMethod( - Invocation.method( - #updateCachedChainHeight, - [height], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - bool getCachedIsFavorite() => (super.noSuchMethod( - Invocation.method( - #getCachedIsFavorite, - [], - ), - returnValue: false, - ) as bool); - @override - _i23.Future updateCachedIsFavorite(bool? isFavorite) => - (super.noSuchMethod( - Invocation.method( - #updateCachedIsFavorite, - [isFavorite], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i12.Balance getCachedBalance() => (super.noSuchMethod( - Invocation.method( - #getCachedBalance, - [], - ), - returnValue: _FakeBalance_9( - this, - Invocation.method( - #getCachedBalance, - [], - ), - ), - ) as _i12.Balance); - @override - _i23.Future updateCachedBalance(_i12.Balance? balance) => - (super.noSuchMethod( - Invocation.method( - #updateCachedBalance, - [balance], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i12.Balance getCachedBalanceSecondary() => (super.noSuchMethod( - Invocation.method( - #getCachedBalanceSecondary, - [], - ), - returnValue: _FakeBalance_9( - this, - Invocation.method( - #getCachedBalanceSecondary, - [], - ), - ), - ) as _i12.Balance); - @override - _i23.Future updateCachedBalanceSecondary(_i12.Balance? balance) => - (super.noSuchMethod( - Invocation.method( - #updateCachedBalanceSecondary, - [balance], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - List getWalletTokenContractAddresses() => (super.noSuchMethod( - Invocation.method( - #getWalletTokenContractAddresses, - [], - ), - returnValue: [], - ) as List); - @override - _i23.Future updateWalletTokenContractAddresses( - List? contractAddresses) => - (super.noSuchMethod( - Invocation.method( - #updateWalletTokenContractAddresses, - [contractAddresses], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - void initWalletDB({_i13.MainDB? mockableOverride}) => super.noSuchMethod( - Invocation.method( - #initWalletDB, - [], - {#mockableOverride: mockableOverride}, - ), - returnValueForMissingStub: null, - ); - @override - _i23.Future<_i16.Tuple2<_i18.Transaction, _i18.Address>> parseTransaction( - Map? txData, - dynamic electrumxClient, - List<_i18.Address>? myAddresses, - _i22.Coin? coin, - int? minConfirms, - String? walletId, - ) => - (super.noSuchMethod( - Invocation.method( - #parseTransaction, - [ - txData, - electrumxClient, - myAddresses, - coin, - minConfirms, - walletId, - ], - ), - returnValue: - _i23.Future<_i16.Tuple2<_i18.Transaction, _i18.Address>>.value( - _FakeTuple2_14<_i18.Transaction, _i18.Address>( - this, - Invocation.method( - #parseTransaction, - [ - txData, - electrumxClient, - myAddresses, - coin, - minConfirms, - walletId, - ], - ), - )), - ) as _i23.Future<_i16.Tuple2<_i18.Transaction, _i18.Address>>); - @override - void initPaynymWalletInterface({ - required String? walletId, - required String? walletName, - required _i14.NetworkType? network, - required _i22.Coin? coin, - required _i13.MainDB? db, - required _i10.ElectrumX? electrumXClient, - required _i7.SecureStorageInterface? secureStorage, - required int? dustLimit, - required int? dustLimitP2PKH, - required int? minConfirms, - required _i23.Future Function()? getMnemonicString, - required _i23.Future Function()? getMnemonicPassphrase, - required _i23.Future Function()? getChainHeight, - required _i23.Future Function()? getCurrentChangeAddress, - required int Function({ - required int feeRatePerKB, - required int vSize, - })? - estimateTxFee, - required _i23.Future> Function({ - required String address, - required _i15.Amount amount, - Map? args, - })? - prepareSend, - required _i23.Future Function({required String address})? getTxCount, - required _i23.Future> Function(List<_i18.UTXO>)? - fetchBuildTxData, - required _i23.Future Function()? refresh, - required _i23.Future Function()? checkChangeAddressForTransactions, - }) => - super.noSuchMethod( - Invocation.method( - #initPaynymWalletInterface, - [], - { - #walletId: walletId, - #walletName: walletName, - #network: network, - #coin: coin, - #db: db, - #electrumXClient: electrumXClient, - #secureStorage: secureStorage, - #dustLimit: dustLimit, - #dustLimitP2PKH: dustLimitP2PKH, - #minConfirms: minConfirms, - #getMnemonicString: getMnemonicString, - #getMnemonicPassphrase: getMnemonicPassphrase, - #getChainHeight: getChainHeight, - #getCurrentChangeAddress: getCurrentChangeAddress, - #estimateTxFee: estimateTxFee, - #prepareSend: prepareSend, - #getTxCount: getTxCount, - #fetchBuildTxData: fetchBuildTxData, - #refresh: refresh, - #checkChangeAddressForTransactions: - checkChangeAddressForTransactions, - }, - ), - returnValueForMissingStub: null, - ); - @override - _i23.Future<_i17.BIP32> getBip47BaseNode() => (super.noSuchMethod( - Invocation.method( - #getBip47BaseNode, - [], - ), - returnValue: _i23.Future<_i17.BIP32>.value(_FakeBIP32_15( - this, - Invocation.method( - #getBip47BaseNode, - [], - ), - )), - ) as _i23.Future<_i17.BIP32>); - @override - _i23.Future<_i30.Uint8List> getPrivateKeyForPaynymReceivingAddress({ - required String? paymentCodeString, - required int? index, - }) => - (super.noSuchMethod( - Invocation.method( - #getPrivateKeyForPaynymReceivingAddress, - [], - { - #paymentCodeString: paymentCodeString, - #index: index, - }, - ), - returnValue: _i23.Future<_i30.Uint8List>.value(_i30.Uint8List(0)), - ) as _i23.Future<_i30.Uint8List>); - @override - _i23.Future<_i18.Address> currentReceivingPaynymAddress({ - required _i19.PaymentCode? sender, - required bool? isSegwit, - }) => - (super.noSuchMethod( - Invocation.method( - #currentReceivingPaynymAddress, - [], - { - #sender: sender, - #isSegwit: isSegwit, - }, - ), - returnValue: _i23.Future<_i18.Address>.value(_FakeAddress_16( - this, - Invocation.method( - #currentReceivingPaynymAddress, - [], - { - #sender: sender, - #isSegwit: isSegwit, - }, - ), - )), - ) as _i23.Future<_i18.Address>); - @override - _i23.Future checkCurrentPaynymReceivingAddressForTransactions({ - required _i19.PaymentCode? sender, - required bool? isSegwit, - }) => - (super.noSuchMethod( - Invocation.method( - #checkCurrentPaynymReceivingAddressForTransactions, - [], - { - #sender: sender, - #isSegwit: isSegwit, - }, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future checkAllCurrentReceivingPaynymAddressesForTransactions() => - (super.noSuchMethod( - Invocation.method( - #checkAllCurrentReceivingPaynymAddressesForTransactions, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future<_i17.BIP32> deriveNotificationBip32Node() => (super.noSuchMethod( - Invocation.method( - #deriveNotificationBip32Node, - [], - ), - returnValue: _i23.Future<_i17.BIP32>.value(_FakeBIP32_15( - this, - Invocation.method( - #deriveNotificationBip32Node, - [], - ), - )), - ) as _i23.Future<_i17.BIP32>); - @override - _i23.Future<_i19.PaymentCode> getPaymentCode({required bool? isSegwit}) => - (super.noSuchMethod( - Invocation.method( - #getPaymentCode, - [], - {#isSegwit: isSegwit}, - ), - returnValue: _i23.Future<_i19.PaymentCode>.value(_FakePaymentCode_17( - this, - Invocation.method( - #getPaymentCode, - [], - {#isSegwit: isSegwit}, - ), - )), - ) as _i23.Future<_i19.PaymentCode>); - @override - _i23.Future<_i30.Uint8List> signWithNotificationKey(_i30.Uint8List? data) => - (super.noSuchMethod( - Invocation.method( - #signWithNotificationKey, - [data], - ), - returnValue: _i23.Future<_i30.Uint8List>.value(_i30.Uint8List(0)), - ) as _i23.Future<_i30.Uint8List>); - @override - _i23.Future signStringWithNotificationKey(String? data) => - (super.noSuchMethod( - Invocation.method( - #signStringWithNotificationKey, - [data], - ), - returnValue: _i23.Future.value(''), - ) as _i23.Future); - @override - _i23.Future> preparePaymentCodeSend({ - required _i19.PaymentCode? paymentCode, - required bool? isSegwit, - required _i15.Amount? amount, - Map? args, - }) => - (super.noSuchMethod( - Invocation.method( - #preparePaymentCodeSend, - [], - { - #paymentCode: paymentCode, - #isSegwit: isSegwit, - #amount: amount, - #args: args, - }, - ), - returnValue: - _i23.Future>.value({}), - ) as _i23.Future>); - @override - _i23.Future<_i18.Address> nextUnusedSendAddressFrom({ - required _i19.PaymentCode? pCode, - required bool? isSegwit, - required _i17.BIP32? privateKeyNode, - int? startIndex = 0, - }) => - (super.noSuchMethod( - Invocation.method( - #nextUnusedSendAddressFrom, - [], - { - #pCode: pCode, - #isSegwit: isSegwit, - #privateKeyNode: privateKeyNode, - #startIndex: startIndex, - }, - ), - returnValue: _i23.Future<_i18.Address>.value(_FakeAddress_16( - this, - Invocation.method( - #nextUnusedSendAddressFrom, - [], - { - #pCode: pCode, - #isSegwit: isSegwit, - #privateKeyNode: privateKeyNode, - #startIndex: startIndex, - }, - ), - )), - ) as _i23.Future<_i18.Address>); - @override - _i23.Future> prepareNotificationTx({ - required int? selectedTxFeeRate, - required String? targetPaymentCodeString, - int? additionalOutputs = 0, - List<_i18.UTXO>? utxos, - }) => - (super.noSuchMethod( - Invocation.method( - #prepareNotificationTx, - [], - { - #selectedTxFeeRate: selectedTxFeeRate, - #targetPaymentCodeString: targetPaymentCodeString, - #additionalOutputs: additionalOutputs, - #utxos: utxos, - }, - ), - returnValue: - _i23.Future>.value({}), - ) as _i23.Future>); - @override - _i23.Future broadcastNotificationTx( - {required Map? preparedTx}) => - (super.noSuchMethod( - Invocation.method( - #broadcastNotificationTx, - [], - {#preparedTx: preparedTx}, - ), - returnValue: _i23.Future.value(''), - ) as _i23.Future); - @override - _i23.Future hasConnected(String? paymentCodeString) => - (super.noSuchMethod( - Invocation.method( - #hasConnected, - [paymentCodeString], - ), - returnValue: _i23.Future.value(false), - ) as _i23.Future); - @override - _i23.Future<_i19.PaymentCode?> unBlindedPaymentCodeFromTransaction( - {required _i18.Transaction? transaction}) => - (super.noSuchMethod( - Invocation.method( - #unBlindedPaymentCodeFromTransaction, - [], - {#transaction: transaction}, - ), - returnValue: _i23.Future<_i19.PaymentCode?>.value(), - ) as _i23.Future<_i19.PaymentCode?>); - @override - _i23.Future<_i19.PaymentCode?> unBlindedPaymentCodeFromTransactionBad( - {required _i18.Transaction? transaction}) => - (super.noSuchMethod( - Invocation.method( - #unBlindedPaymentCodeFromTransactionBad, - [], - {#transaction: transaction}, - ), - returnValue: _i23.Future<_i19.PaymentCode?>.value(), - ) as _i23.Future<_i19.PaymentCode?>); - @override - _i23.Future> - getAllPaymentCodesFromNotificationTransactions() => (super.noSuchMethod( - Invocation.method( - #getAllPaymentCodesFromNotificationTransactions, - [], - ), - returnValue: - _i23.Future>.value(<_i19.PaymentCode>[]), - ) as _i23.Future>); - @override - _i23.Future checkForNotificationTransactionsTo( - Set? otherCodeStrings) => - (super.noSuchMethod( - Invocation.method( - #checkForNotificationTransactionsTo, - [otherCodeStrings], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future restoreAllHistory({ - required int? maxUnusedAddressGap, - required int? maxNumberOfIndexesToCheck, - required Set? paymentCodeStrings, - }) => - (super.noSuchMethod( - Invocation.method( - #restoreAllHistory, - [], - { - #maxUnusedAddressGap: maxUnusedAddressGap, - #maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck, - #paymentCodeStrings: paymentCodeStrings, - }, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future restoreHistoryWith({ - required _i19.PaymentCode? other, - required bool? checkSegwitAsWell, - required int? maxUnusedAddressGap, - required int? maxNumberOfIndexesToCheck, - }) => - (super.noSuchMethod( - Invocation.method( - #restoreHistoryWith, - [], - { - #other: other, - #checkSegwitAsWell: checkSegwitAsWell, - #maxUnusedAddressGap: maxUnusedAddressGap, - #maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck, - }, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future<_i18.Address> getMyNotificationAddress() => (super.noSuchMethod( - Invocation.method( - #getMyNotificationAddress, - [], - ), - returnValue: _i23.Future<_i18.Address>.value(_FakeAddress_16( - this, - Invocation.method( - #getMyNotificationAddress, - [], - ), - )), - ) as _i23.Future<_i18.Address>); - @override - _i23.Future> lookupKey(String? paymentCodeString) => - (super.noSuchMethod( - Invocation.method( - #lookupKey, - [paymentCodeString], - ), - returnValue: _i23.Future>.value([]), - ) as _i23.Future>); - @override - _i23.Future paymentCodeStringByKey(String? key) => - (super.noSuchMethod( - Invocation.method( - #paymentCodeStringByKey, - [key], - ), - returnValue: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future storeCode(String? paymentCodeString) => - (super.noSuchMethod( - Invocation.method( - #storeCode, - [paymentCodeString], - ), - returnValue: _i23.Future.value(''), - ) as _i23.Future); - @override - void initCoinControlInterface({ - required String? walletId, - required String? walletName, - required _i22.Coin? coin, - required _i13.MainDB? db, - required _i23.Future Function()? getChainHeight, - required _i23.Future Function(_i12.Balance)? refreshedBalanceCallback, - }) => - super.noSuchMethod( - Invocation.method( - #initCoinControlInterface, - [], - { - #walletId: walletId, - #walletName: walletName, - #coin: coin, - #db: db, - #getChainHeight: getChainHeight, - #refreshedBalanceCallback: refreshedBalanceCallback, - }, - ), - returnValueForMissingStub: null, - ); - @override - _i23.Future refreshBalance({bool? notify = false}) => - (super.noSuchMethod( - Invocation.method( - #refreshBalance, - [], - {#notify: notify}, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); -} - -/// A class which mocks [LocaleService]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockLocaleService extends _i1.Mock implements _i31.LocaleService { - MockLocaleService() { - _i1.throwOnMissingStub(this); - } - - @override - String get locale => (super.noSuchMethod( - Invocation.getter(#locale), - returnValue: '', - ) as String); - @override - bool get hasListeners => (super.noSuchMethod( - Invocation.getter(#hasListeners), - returnValue: false, - ) as bool); - @override - _i23.Future loadLocale({bool? notify = true}) => (super.noSuchMethod( - Invocation.method( - #loadLocale, - [], - {#notify: notify}, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #addListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #removeListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void dispose() => super.noSuchMethod( - Invocation.method( - #dispose, - [], - ), - returnValueForMissingStub: null, - ); - @override - void notifyListeners() => super.noSuchMethod( - Invocation.method( - #notifyListeners, - [], - ), - returnValueForMissingStub: null, - ); -} - -/// A class which mocks [ThemeService]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockThemeService extends _i1.Mock implements _i32.ThemeService { - MockThemeService() { - _i1.throwOnMissingStub(this); - } - - @override - _i13.MainDB get db => (super.noSuchMethod( - Invocation.getter(#db), - returnValue: _FakeMainDB_10( - this, - Invocation.getter(#db), - ), - ) as _i13.MainDB); - @override - List<_i33.StackTheme> get installedThemes => (super.noSuchMethod( - Invocation.getter(#installedThemes), - returnValue: <_i33.StackTheme>[], - ) as List<_i33.StackTheme>); - @override - void init(_i13.MainDB? db) => super.noSuchMethod( - Invocation.method( - #init, - [db], - ), - returnValueForMissingStub: null, - ); - @override - _i23.Future install({required _i30.Uint8List? themeArchiveData}) => - (super.noSuchMethod( - Invocation.method( - #install, - [], - {#themeArchiveData: themeArchiveData}, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future remove({required String? themeId}) => (super.noSuchMethod( - Invocation.method( - #remove, - [], - {#themeId: themeId}, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future checkDefaultThemesOnStartup() => (super.noSuchMethod( - Invocation.method( - #checkDefaultThemesOnStartup, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future verifyInstalled({required String? themeId}) => - (super.noSuchMethod( - Invocation.method( - #verifyInstalled, - [], - {#themeId: themeId}, - ), - returnValue: _i23.Future.value(false), - ) as _i23.Future); - @override - _i23.Future> fetchThemes() => - (super.noSuchMethod( - Invocation.method( - #fetchThemes, - [], - ), - returnValue: _i23.Future>.value( - <_i32.StackThemeMetaData>[]), - ) as _i23.Future>); - @override - _i23.Future<_i30.Uint8List> fetchTheme( - {required _i32.StackThemeMetaData? themeMetaData}) => - (super.noSuchMethod( - Invocation.method( - #fetchTheme, - [], - {#themeMetaData: themeMetaData}, - ), - returnValue: _i23.Future<_i30.Uint8List>.value(_i30.Uint8List(0)), - ) as _i23.Future<_i30.Uint8List>); - @override - _i33.StackTheme? getTheme({required String? themeId}) => - (super.noSuchMethod(Invocation.method( - #getTheme, - [], - {#themeId: themeId}, - )) as _i33.StackTheme?); -} - -/// A class which mocks [Prefs]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockPrefs extends _i1.Mock implements _i24.Prefs { - MockPrefs() { - _i1.throwOnMissingStub(this); - } - - @override - bool get isInitialized => (super.noSuchMethod( - Invocation.getter(#isInitialized), - returnValue: false, - ) as bool); - @override - int get lastUnlockedTimeout => (super.noSuchMethod( - Invocation.getter(#lastUnlockedTimeout), - returnValue: 0, - ) as int); - @override - set lastUnlockedTimeout(int? lastUnlockedTimeout) => super.noSuchMethod( - Invocation.setter( - #lastUnlockedTimeout, - lastUnlockedTimeout, - ), - returnValueForMissingStub: null, - ); - @override - int get lastUnlocked => (super.noSuchMethod( - Invocation.getter(#lastUnlocked), - returnValue: 0, - ) as int); - @override - set lastUnlocked(int? lastUnlocked) => super.noSuchMethod( - Invocation.setter( - #lastUnlocked, - lastUnlocked, - ), - returnValueForMissingStub: null, - ); - @override - int get currentNotificationId => (super.noSuchMethod( - Invocation.getter(#currentNotificationId), - returnValue: 0, - ) as int); - @override - List get walletIdsSyncOnStartup => (super.noSuchMethod( - Invocation.getter(#walletIdsSyncOnStartup), - returnValue: [], - ) as List); - @override - set walletIdsSyncOnStartup(List? walletIdsSyncOnStartup) => - super.noSuchMethod( - Invocation.setter( - #walletIdsSyncOnStartup, - walletIdsSyncOnStartup, - ), - returnValueForMissingStub: null, - ); - @override - _i34.SyncingType get syncType => (super.noSuchMethod( - Invocation.getter(#syncType), - returnValue: _i34.SyncingType.currentWalletOnly, - ) as _i34.SyncingType); - @override - set syncType(_i34.SyncingType? syncType) => super.noSuchMethod( - Invocation.setter( - #syncType, - syncType, - ), - returnValueForMissingStub: null, - ); - @override - bool get wifiOnly => (super.noSuchMethod( - Invocation.getter(#wifiOnly), - returnValue: false, - ) as bool); - @override - set wifiOnly(bool? wifiOnly) => super.noSuchMethod( - Invocation.setter( - #wifiOnly, - wifiOnly, - ), - returnValueForMissingStub: null, - ); - @override - bool get showFavoriteWallets => (super.noSuchMethod( - Invocation.getter(#showFavoriteWallets), - returnValue: false, - ) as bool); - @override - set showFavoriteWallets(bool? showFavoriteWallets) => super.noSuchMethod( - Invocation.setter( - #showFavoriteWallets, - showFavoriteWallets, - ), - returnValueForMissingStub: null, - ); - @override - String get language => (super.noSuchMethod( - Invocation.getter(#language), - returnValue: '', - ) as String); - @override - set language(String? newLanguage) => super.noSuchMethod( - Invocation.setter( - #language, - newLanguage, - ), - returnValueForMissingStub: null, - ); - @override - String get currency => (super.noSuchMethod( - Invocation.getter(#currency), - returnValue: '', - ) as String); - @override - set currency(String? newCurrency) => super.noSuchMethod( - Invocation.setter( - #currency, - newCurrency, - ), - returnValueForMissingStub: null, - ); - @override - bool get randomizePIN => (super.noSuchMethod( - Invocation.getter(#randomizePIN), - returnValue: false, - ) as bool); - @override - set randomizePIN(bool? randomizePIN) => super.noSuchMethod( - Invocation.setter( - #randomizePIN, - randomizePIN, - ), - returnValueForMissingStub: null, - ); - @override - bool get useBiometrics => (super.noSuchMethod( - Invocation.getter(#useBiometrics), - returnValue: false, - ) as bool); - @override - set useBiometrics(bool? useBiometrics) => super.noSuchMethod( - Invocation.setter( - #useBiometrics, - useBiometrics, - ), - returnValueForMissingStub: null, - ); - @override - bool get hasPin => (super.noSuchMethod( - Invocation.getter(#hasPin), - returnValue: false, - ) as bool); - @override - set hasPin(bool? hasPin) => super.noSuchMethod( - Invocation.setter( - #hasPin, - hasPin, - ), - returnValueForMissingStub: null, - ); - @override - int get familiarity => (super.noSuchMethod( - Invocation.getter(#familiarity), - returnValue: 0, - ) as int); - @override - set familiarity(int? familiarity) => super.noSuchMethod( - Invocation.setter( - #familiarity, - familiarity, - ), - returnValueForMissingStub: null, - ); - @override - bool get showTestNetCoins => (super.noSuchMethod( - Invocation.getter(#showTestNetCoins), - returnValue: false, - ) as bool); - @override - set showTestNetCoins(bool? showTestNetCoins) => super.noSuchMethod( - Invocation.setter( - #showTestNetCoins, - showTestNetCoins, - ), - returnValueForMissingStub: null, - ); - @override - bool get isAutoBackupEnabled => (super.noSuchMethod( - Invocation.getter(#isAutoBackupEnabled), - returnValue: false, - ) as bool); - @override - set isAutoBackupEnabled(bool? isAutoBackupEnabled) => super.noSuchMethod( - Invocation.setter( - #isAutoBackupEnabled, - isAutoBackupEnabled, - ), - returnValueForMissingStub: null, - ); - @override - set autoBackupLocation(String? autoBackupLocation) => super.noSuchMethod( - Invocation.setter( - #autoBackupLocation, - autoBackupLocation, - ), - returnValueForMissingStub: null, - ); - @override - _i35.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod( - Invocation.getter(#backupFrequencyType), - returnValue: _i35.BackupFrequencyType.everyTenMinutes, - ) as _i35.BackupFrequencyType); - @override - set backupFrequencyType(_i35.BackupFrequencyType? backupFrequencyType) => - super.noSuchMethod( - Invocation.setter( - #backupFrequencyType, - backupFrequencyType, - ), - returnValueForMissingStub: null, - ); - @override - set lastAutoBackup(DateTime? lastAutoBackup) => super.noSuchMethod( - Invocation.setter( - #lastAutoBackup, - lastAutoBackup, - ), - returnValueForMissingStub: null, - ); - @override - bool get hideBlockExplorerWarning => (super.noSuchMethod( - Invocation.getter(#hideBlockExplorerWarning), - returnValue: false, - ) as bool); - @override - set hideBlockExplorerWarning(bool? hideBlockExplorerWarning) => - super.noSuchMethod( - Invocation.setter( - #hideBlockExplorerWarning, - hideBlockExplorerWarning, - ), - returnValueForMissingStub: null, - ); - @override - bool get gotoWalletOnStartup => (super.noSuchMethod( - Invocation.getter(#gotoWalletOnStartup), - returnValue: false, - ) as bool); - @override - set gotoWalletOnStartup(bool? gotoWalletOnStartup) => super.noSuchMethod( - Invocation.setter( - #gotoWalletOnStartup, - gotoWalletOnStartup, - ), - returnValueForMissingStub: null, - ); - @override - set startupWalletId(String? startupWalletId) => super.noSuchMethod( - Invocation.setter( - #startupWalletId, - startupWalletId, - ), - returnValueForMissingStub: null, - ); - @override - bool get externalCalls => (super.noSuchMethod( - Invocation.getter(#externalCalls), - returnValue: false, - ) as bool); - @override - set externalCalls(bool? externalCalls) => super.noSuchMethod( - Invocation.setter( - #externalCalls, - externalCalls, - ), - returnValueForMissingStub: null, - ); - @override - bool get enableCoinControl => (super.noSuchMethod( - Invocation.getter(#enableCoinControl), - returnValue: false, - ) as bool); - @override - set enableCoinControl(bool? enableCoinControl) => super.noSuchMethod( - Invocation.setter( - #enableCoinControl, - enableCoinControl, - ), - returnValueForMissingStub: null, - ); - @override - bool get enableSystemBrightness => (super.noSuchMethod( - Invocation.getter(#enableSystemBrightness), - returnValue: false, - ) as bool); - @override - set enableSystemBrightness(bool? enableSystemBrightness) => - super.noSuchMethod( - Invocation.setter( - #enableSystemBrightness, - enableSystemBrightness, - ), - returnValueForMissingStub: null, - ); - @override - String get themeId => (super.noSuchMethod( - Invocation.getter(#themeId), - returnValue: '', - ) as String); - @override - set themeId(String? themeId) => super.noSuchMethod( - Invocation.setter( - #themeId, - themeId, - ), - returnValueForMissingStub: null, - ); - @override - String get systemBrightnessLightThemeId => (super.noSuchMethod( - Invocation.getter(#systemBrightnessLightThemeId), - returnValue: '', - ) as String); - @override - set systemBrightnessLightThemeId(String? systemBrightnessLightThemeId) => - super.noSuchMethod( - Invocation.setter( - #systemBrightnessLightThemeId, - systemBrightnessLightThemeId, - ), - returnValueForMissingStub: null, - ); - @override - String get systemBrightnessDarkThemeId => (super.noSuchMethod( - Invocation.getter(#systemBrightnessDarkThemeId), - returnValue: '', - ) as String); - @override - set systemBrightnessDarkThemeId(String? systemBrightnessDarkThemeId) => - super.noSuchMethod( - Invocation.setter( - #systemBrightnessDarkThemeId, - systemBrightnessDarkThemeId, - ), - returnValueForMissingStub: null, - ); - @override - bool get hasListeners => (super.noSuchMethod( - Invocation.getter(#hasListeners), - returnValue: false, - ) as bool); - @override - _i23.Future init() => (super.noSuchMethod( - Invocation.method( - #init, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future incrementCurrentNotificationIndex() => (super.noSuchMethod( - Invocation.method( - #incrementCurrentNotificationIndex, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future isExternalCallsSet() => (super.noSuchMethod( - Invocation.method( - #isExternalCallsSet, - [], - ), - returnValue: _i23.Future.value(false), - ) as _i23.Future); - @override - _i23.Future saveUserID(String? userId) => (super.noSuchMethod( - Invocation.method( - #saveUserID, - [userId], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future saveSignupEpoch(int? signupEpoch) => (super.noSuchMethod( - Invocation.method( - #saveSignupEpoch, - [signupEpoch], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #addListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #removeListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void dispose() => super.noSuchMethod( - Invocation.method( - #dispose, - [], - ), - returnValueForMissingStub: null, - ); - @override - void notifyListeners() => super.noSuchMethod( - Invocation.method( - #notifyListeners, - [], - ), - returnValueForMissingStub: null, - ); -} - -/// A class which mocks [Manager]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i6.Manager { - @override - bool get isActiveWallet => (super.noSuchMethod( - Invocation.getter(#isActiveWallet), - returnValue: false, - ) as bool); - @override - set isActiveWallet(bool? isActive) => super.noSuchMethod( - Invocation.setter( - #isActiveWallet, - isActive, - ), - returnValueForMissingStub: null, - ); - @override - _i20.CoinServiceAPI get wallet => (super.noSuchMethod( - Invocation.getter(#wallet), - returnValue: _FakeCoinServiceAPI_18( - this, - Invocation.getter(#wallet), - ), - ) as _i20.CoinServiceAPI); - @override - bool get hasBackgroundRefreshListener => (super.noSuchMethod( - Invocation.getter(#hasBackgroundRefreshListener), - returnValue: false, - ) as bool); - @override - _i22.Coin get coin => (super.noSuchMethod( - Invocation.getter(#coin), - returnValue: _i22.Coin.bitcoin, - ) as _i22.Coin); - @override - bool get isRefreshing => (super.noSuchMethod( - Invocation.getter(#isRefreshing), - returnValue: false, - ) as bool); - @override - bool get shouldAutoSync => (super.noSuchMethod( - Invocation.getter(#shouldAutoSync), - returnValue: false, - ) as bool); - @override - set shouldAutoSync(bool? shouldAutoSync) => super.noSuchMethod( - Invocation.setter( - #shouldAutoSync, - shouldAutoSync, - ), - returnValueForMissingStub: null, - ); - @override - bool get isFavorite => (super.noSuchMethod( - Invocation.getter(#isFavorite), - returnValue: false, - ) as bool); - @override - set isFavorite(bool? markFavorite) => super.noSuchMethod( - Invocation.setter( - #isFavorite, - markFavorite, - ), - returnValueForMissingStub: null, - ); - @override - _i23.Future<_i9.FeeObject> get fees => (super.noSuchMethod( - Invocation.getter(#fees), - returnValue: _i23.Future<_i9.FeeObject>.value(_FakeFeeObject_6( - this, - Invocation.getter(#fees), - )), - ) as _i23.Future<_i9.FeeObject>); - @override - _i23.Future get maxFee => (super.noSuchMethod( - Invocation.getter(#maxFee), - returnValue: _i23.Future.value(0), - ) as _i23.Future); - @override - _i23.Future get currentReceivingAddress => (super.noSuchMethod( - Invocation.getter(#currentReceivingAddress), - returnValue: _i23.Future.value(''), - ) as _i23.Future); - @override - _i12.Balance get balance => (super.noSuchMethod( - Invocation.getter(#balance), - returnValue: _FakeBalance_9( - this, - Invocation.getter(#balance), - ), - ) as _i12.Balance); - @override - _i23.Future> get transactions => (super.noSuchMethod( - Invocation.getter(#transactions), - returnValue: - _i23.Future>.value(<_i18.Transaction>[]), - ) as _i23.Future>); - @override - _i23.Future> get utxos => (super.noSuchMethod( - Invocation.getter(#utxos), - returnValue: _i23.Future>.value(<_i18.UTXO>[]), - ) as _i23.Future>); - @override - set walletName(String? newName) => super.noSuchMethod( - Invocation.setter( - #walletName, - newName, - ), - returnValueForMissingStub: null, - ); - @override - String get walletName => (super.noSuchMethod( - Invocation.getter(#walletName), - returnValue: '', - ) as String); - @override - String get walletId => (super.noSuchMethod( - Invocation.getter(#walletId), - returnValue: '', - ) as String); - @override - _i23.Future> get mnemonic => (super.noSuchMethod( - Invocation.getter(#mnemonic), - returnValue: _i23.Future>.value([]), - ) as _i23.Future>); - @override - _i23.Future get mnemonicPassphrase => (super.noSuchMethod( - Invocation.getter(#mnemonicPassphrase), - returnValue: _i23.Future.value(), - ) as _i23.Future); - @override - bool get isConnected => (super.noSuchMethod( - Invocation.getter(#isConnected), - returnValue: false, - ) as bool); - @override - int get currentHeight => (super.noSuchMethod( - Invocation.getter(#currentHeight), - returnValue: 0, - ) as int); - @override - bool get hasPaynymSupport => (super.noSuchMethod( - Invocation.getter(#hasPaynymSupport), - returnValue: false, - ) as bool); - @override - bool get hasCoinControlSupport => (super.noSuchMethod( - Invocation.getter(#hasCoinControlSupport), - returnValue: false, - ) as bool); - @override - bool get hasTokenSupport => (super.noSuchMethod( - Invocation.getter(#hasTokenSupport), - returnValue: false, - ) as bool); - @override - bool get hasWhirlpoolSupport => (super.noSuchMethod( - Invocation.getter(#hasWhirlpoolSupport), - returnValue: false, - ) as bool); - @override - int get rescanOnOpenVersion => (super.noSuchMethod( - Invocation.getter(#rescanOnOpenVersion), - returnValue: 0, - ) as int); - @override - bool get hasXPub => (super.noSuchMethod( - Invocation.getter(#hasXPub), - returnValue: false, - ) as bool); - @override - _i23.Future get xpub => (super.noSuchMethod( - Invocation.getter(#xpub), - returnValue: _i23.Future.value(''), - ) as _i23.Future); - @override - bool get hasListeners => (super.noSuchMethod( - Invocation.getter(#hasListeners), - returnValue: false, - ) as bool); - @override - _i23.Future updateNode(bool? shouldRefresh) => (super.noSuchMethod( - Invocation.method( - #updateNode, - [shouldRefresh], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - void dispose() => super.noSuchMethod( - Invocation.method( - #dispose, - [], - ), - returnValueForMissingStub: null, - ); - @override - _i23.Future> prepareSend({ - required String? address, - required _i15.Amount? amount, - Map? args, - }) => - (super.noSuchMethod( - Invocation.method( - #prepareSend, - [], - { - #address: address, - #amount: amount, - #args: args, - }, - ), - returnValue: - _i23.Future>.value({}), - ) as _i23.Future>); - @override - _i23.Future confirmSend({required Map? txData}) => - (super.noSuchMethod( - Invocation.method( - #confirmSend, - [], - {#txData: txData}, - ), - returnValue: _i23.Future.value(''), - ) as _i23.Future); - @override - _i23.Future refresh() => (super.noSuchMethod( - Invocation.method( - #refresh, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - bool validateAddress(String? address) => (super.noSuchMethod( - Invocation.method( - #validateAddress, - [address], - ), - returnValue: false, - ) as bool); - @override - _i23.Future testNetworkConnection() => (super.noSuchMethod( - Invocation.method( - #testNetworkConnection, - [], - ), - returnValue: _i23.Future.value(false), - ) as _i23.Future); - @override - _i23.Future initializeNew() => (super.noSuchMethod( - Invocation.method( - #initializeNew, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future initializeExisting() => (super.noSuchMethod( - Invocation.method( - #initializeExisting, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future recoverFromMnemonic({ - required String? mnemonic, - String? mnemonicPassphrase, - required int? maxUnusedAddressGap, - required int? maxNumberOfIndexesToCheck, - required int? height, - }) => - (super.noSuchMethod( - Invocation.method( - #recoverFromMnemonic, - [], - { - #mnemonic: mnemonic, - #mnemonicPassphrase: mnemonicPassphrase, - #maxUnusedAddressGap: maxUnusedAddressGap, - #maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck, - #height: height, - }, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future exitCurrentWallet() => (super.noSuchMethod( - Invocation.method( - #exitCurrentWallet, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future fullRescan( - int? maxUnusedAddressGap, - int? maxNumberOfIndexesToCheck, - ) => - (super.noSuchMethod( - Invocation.method( - #fullRescan, - [ - maxUnusedAddressGap, - maxNumberOfIndexesToCheck, - ], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future<_i15.Amount> estimateFeeFor( - _i15.Amount? amount, - int? feeRate, - ) => - (super.noSuchMethod( - Invocation.method( - #estimateFeeFor, - [ - amount, - feeRate, - ], - ), - returnValue: _i23.Future<_i15.Amount>.value(_FakeAmount_13( - this, - Invocation.method( - #estimateFeeFor, - [ - amount, - feeRate, - ], - ), - )), - ) as _i23.Future<_i15.Amount>); - @override - _i23.Future generateNewAddress() => (super.noSuchMethod( - Invocation.method( - #generateNewAddress, - [], - ), - returnValue: _i23.Future.value(false), - ) as _i23.Future); - @override - _i23.Future resetRescanOnOpen() => (super.noSuchMethod( - Invocation.method( - #resetRescanOnOpen, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #addListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #removeListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void notifyListeners() => super.noSuchMethod( - Invocation.method( - #notifyListeners, - [], - ), - returnValueForMissingStub: null, - ); -} - -/// A class which mocks [CoinServiceAPI]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockCoinServiceAPI extends _i1.Mock implements _i20.CoinServiceAPI { - @override - set onIsActiveWalletChanged(void Function(bool)? _onIsActiveWalletChanged) => - super.noSuchMethod( - Invocation.setter( - #onIsActiveWalletChanged, - _onIsActiveWalletChanged, - ), - returnValueForMissingStub: null, - ); - @override - _i22.Coin get coin => (super.noSuchMethod( - Invocation.getter(#coin), - returnValue: _i22.Coin.bitcoin, - ) as _i22.Coin); - @override - bool get isRefreshing => (super.noSuchMethod( - Invocation.getter(#isRefreshing), - returnValue: false, - ) as bool); - @override - bool get shouldAutoSync => (super.noSuchMethod( - Invocation.getter(#shouldAutoSync), - returnValue: false, - ) as bool); - @override - set shouldAutoSync(bool? shouldAutoSync) => super.noSuchMethod( - Invocation.setter( - #shouldAutoSync, - shouldAutoSync, - ), - returnValueForMissingStub: null, - ); - @override - bool get isFavorite => (super.noSuchMethod( - Invocation.getter(#isFavorite), - returnValue: false, - ) as bool); - @override - set isFavorite(bool? markFavorite) => super.noSuchMethod( - Invocation.setter( - #isFavorite, - markFavorite, - ), - returnValueForMissingStub: null, - ); - @override - _i23.Future<_i9.FeeObject> get fees => (super.noSuchMethod( - Invocation.getter(#fees), - returnValue: _i23.Future<_i9.FeeObject>.value(_FakeFeeObject_6( - this, - Invocation.getter(#fees), - )), - ) as _i23.Future<_i9.FeeObject>); - @override - _i23.Future get maxFee => (super.noSuchMethod( - Invocation.getter(#maxFee), - returnValue: _i23.Future.value(0), - ) as _i23.Future); - @override - _i23.Future get currentReceivingAddress => (super.noSuchMethod( - Invocation.getter(#currentReceivingAddress), - returnValue: _i23.Future.value(''), - ) as _i23.Future); - @override - _i12.Balance get balance => (super.noSuchMethod( - Invocation.getter(#balance), - returnValue: _FakeBalance_9( - this, - Invocation.getter(#balance), - ), - ) as _i12.Balance); - @override - _i23.Future> get transactions => (super.noSuchMethod( - Invocation.getter(#transactions), - returnValue: - _i23.Future>.value(<_i18.Transaction>[]), - ) as _i23.Future>); - @override - _i23.Future> get utxos => (super.noSuchMethod( - Invocation.getter(#utxos), - returnValue: _i23.Future>.value(<_i18.UTXO>[]), - ) as _i23.Future>); - @override - set walletName(String? newName) => super.noSuchMethod( - Invocation.setter( - #walletName, - newName, - ), - returnValueForMissingStub: null, - ); - @override - String get walletName => (super.noSuchMethod( - Invocation.getter(#walletName), - returnValue: '', - ) as String); - @override - String get walletId => (super.noSuchMethod( - Invocation.getter(#walletId), - returnValue: '', - ) as String); - @override - _i23.Future> get mnemonic => (super.noSuchMethod( - Invocation.getter(#mnemonic), - returnValue: _i23.Future>.value([]), - ) as _i23.Future>); - @override - _i23.Future get mnemonicString => (super.noSuchMethod( - Invocation.getter(#mnemonicString), - returnValue: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future get mnemonicPassphrase => (super.noSuchMethod( - Invocation.getter(#mnemonicPassphrase), - returnValue: _i23.Future.value(), - ) as _i23.Future); - @override - bool get hasCalledExit => (super.noSuchMethod( - Invocation.getter(#hasCalledExit), - returnValue: false, - ) as bool); - @override - bool get isConnected => (super.noSuchMethod( - Invocation.getter(#isConnected), - returnValue: false, - ) as bool); - @override - int get storedChainHeight => (super.noSuchMethod( - Invocation.getter(#storedChainHeight), - returnValue: 0, - ) as int); - @override - _i23.Future> prepareSend({ - required String? address, - required _i15.Amount? amount, - Map? args, - }) => - (super.noSuchMethod( - Invocation.method( - #prepareSend, - [], - { - #address: address, - #amount: amount, - #args: args, - }, - ), - returnValue: - _i23.Future>.value({}), - ) as _i23.Future>); - @override - _i23.Future confirmSend({required Map? txData}) => - (super.noSuchMethod( - Invocation.method( - #confirmSend, - [], - {#txData: txData}, - ), - returnValue: _i23.Future.value(''), - ) as _i23.Future); - @override - _i23.Future refresh() => (super.noSuchMethod( - Invocation.method( - #refresh, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future updateNode(bool? shouldRefresh) => (super.noSuchMethod( - Invocation.method( - #updateNode, - [shouldRefresh], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - bool validateAddress(String? address) => (super.noSuchMethod( - Invocation.method( - #validateAddress, - [address], - ), - returnValue: false, - ) as bool); - @override - _i23.Future testNetworkConnection() => (super.noSuchMethod( - Invocation.method( - #testNetworkConnection, - [], - ), - returnValue: _i23.Future.value(false), - ) as _i23.Future); - @override - _i23.Future recoverFromMnemonic({ - required String? mnemonic, - String? mnemonicPassphrase, - required int? maxUnusedAddressGap, - required int? maxNumberOfIndexesToCheck, - required int? height, - }) => - (super.noSuchMethod( - Invocation.method( - #recoverFromMnemonic, - [], - { - #mnemonic: mnemonic, - #mnemonicPassphrase: mnemonicPassphrase, - #maxUnusedAddressGap: maxUnusedAddressGap, - #maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck, - #height: height, - }, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future initializeNew() => (super.noSuchMethod( - Invocation.method( - #initializeNew, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future initializeExisting() => (super.noSuchMethod( - Invocation.method( - #initializeExisting, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future exit() => (super.noSuchMethod( - Invocation.method( - #exit, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future fullRescan( - int? maxUnusedAddressGap, - int? maxNumberOfIndexesToCheck, - ) => - (super.noSuchMethod( - Invocation.method( - #fullRescan, - [ - maxUnusedAddressGap, - maxNumberOfIndexesToCheck, - ], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future<_i15.Amount> estimateFeeFor( - _i15.Amount? amount, - int? feeRate, - ) => - (super.noSuchMethod( - Invocation.method( - #estimateFeeFor, - [ - amount, - feeRate, - ], - ), - returnValue: _i23.Future<_i15.Amount>.value(_FakeAmount_13( - this, - Invocation.method( - #estimateFeeFor, - [ - amount, - feeRate, - ], - ), - )), - ) as _i23.Future<_i15.Amount>); - @override - _i23.Future generateNewAddress() => (super.noSuchMethod( - Invocation.method( - #generateNewAddress, - [], - ), - returnValue: _i23.Future.value(false), - ) as _i23.Future); - @override - _i23.Future updateSentCachedTxData(Map? txData) => - (super.noSuchMethod( - Invocation.method( - #updateSentCachedTxData, - [txData], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); -} diff --git a/test/price_test.dart b/test/price_test.dart index f9e2930e1..6a361f38a 100644 --- a/test/price_test.dart +++ b/test/price_test.dart @@ -6,7 +6,7 @@ import 'package:hive_test/hive_test.dart'; import 'package:http/http.dart'; import 'package:mockito/annotations.dart'; import 'package:mockito/mockito.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/services/price.dart'; import 'price_test.mocks.dart'; diff --git a/test/price_test.mocks.dart b/test/price_test.mocks.dart index df95b18a5..f9f667a66 100644 --- a/test/price_test.mocks.dart +++ b/test/price_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/price_test.dart. // Do not manually edit this file. diff --git a/test/screen_tests/address_book_view/address_book_view_screen_test.mocks.dart b/test/screen_tests/address_book_view/address_book_view_screen_test.mocks.dart index d25eea4d0..52f3544c1 100644 --- a/test/screen_tests/address_book_view/address_book_view_screen_test.mocks.dart +++ b/test/screen_tests/address_book_view/address_book_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/address_book_view/address_book_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i4; -import 'dart:ui' as _i5; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/isar/models/contact_entry.dart' as _i2; @@ -112,7 +111,7 @@ class MockAddressBookService extends _i1.Mock returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - void addListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -120,7 +119,7 @@ class MockAddressBookService extends _i1.Mock returnValueForMissingStub: null, ); @override - void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/address_book_view/subviews/add_address_book_view_screen_test.mocks.dart b/test/screen_tests/address_book_view/subviews/add_address_book_view_screen_test.mocks.dart index 2188808b6..1a1b2d646 100644 --- a/test/screen_tests/address_book_view/subviews/add_address_book_view_screen_test.mocks.dart +++ b/test/screen_tests/address_book_view/subviews/add_address_book_view_screen_test.mocks.dart @@ -1,23 +1,22 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/address_book_view/subviews/add_address_book_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i9; -import 'dart:ui' as _i11; import 'package:barcode_scan2/barcode_scan2.dart' as _i2; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i6; import 'package:stackduo/models/isar/models/contact_entry.dart' as _i3; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i14; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i13; import 'package:stackduo/models/models.dart' as _i5; import 'package:stackduo/services/address_book_service.dart' as _i10; import 'package:stackduo/services/coins/coin_service.dart' as _i4; -import 'package:stackduo/services/coins/manager.dart' as _i12; +import 'package:stackduo/services/coins/manager.dart' as _i11; import 'package:stackduo/utilities/amount/amount.dart' as _i7; import 'package:stackduo/utilities/barcode_scanner_interface.dart' as _i8; -import 'package:stackduo/utilities/enums/coin_enum.dart' as _i13; +import 'package:stackduo/utilities/enums/coin_enum.dart' as _i12; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -201,7 +200,7 @@ class MockAddressBookService extends _i1.Mock returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - void addListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -209,7 +208,7 @@ class MockAddressBookService extends _i1.Mock returnValueForMissingStub: null, ); @override - void removeListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -237,7 +236,7 @@ class MockAddressBookService extends _i1.Mock /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i12.Manager { +class MockManager extends _i1.Mock implements _i11.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -265,10 +264,10 @@ class MockManager extends _i1.Mock implements _i12.Manager { returnValue: false, ) as bool); @override - _i13.Coin get coin => (super.noSuchMethod( + _i12.Coin get coin => (super.noSuchMethod( Invocation.getter(#coin), - returnValue: _i13.Coin.bitcoin, - ) as _i13.Coin); + returnValue: _i12.Coin.bitcoin, + ) as _i12.Coin); @override bool get isRefreshing => (super.noSuchMethod( Invocation.getter(#isRefreshing), @@ -327,16 +326,16 @@ class MockManager extends _i1.Mock implements _i12.Manager { ), ) as _i6.Balance); @override - _i9.Future> get transactions => (super.noSuchMethod( + _i9.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i9.Future>.value(<_i14.Transaction>[]), - ) as _i9.Future>); + _i9.Future>.value(<_i13.Transaction>[]), + ) as _i9.Future>); @override - _i9.Future> get utxos => (super.noSuchMethod( + _i9.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i9.Future>.value(<_i14.UTXO>[]), - ) as _i9.Future>); + returnValue: _i9.Future>.value(<_i13.UTXO>[]), + ) as _i9.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -386,6 +385,11 @@ class MockManager extends _i1.Mock implements _i12.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -589,7 +593,7 @@ class MockManager extends _i1.Mock implements _i12.Manager { returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - void addListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -597,7 +601,7 @@ class MockManager extends _i1.Mock implements _i12.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/address_book_view/subviews/address_book_entry_details_view_screen_test.mocks.dart b/test/screen_tests/address_book_view/subviews/address_book_entry_details_view_screen_test.mocks.dart index a2d4fd374..69df025e9 100644 --- a/test/screen_tests/address_book_view/subviews/address_book_entry_details_view_screen_test.mocks.dart +++ b/test/screen_tests/address_book_view/subviews/address_book_entry_details_view_screen_test.mocks.dart @@ -1,23 +1,22 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/address_book_view/subviews/address_book_entry_details_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i9; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i5; import 'package:stackduo/models/isar/models/contact_entry.dart' as _i2; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i12; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i11; import 'package:stackduo/models/models.dart' as _i4; import 'package:stackduo/services/address_book_service.dart' as _i7; import 'package:stackduo/services/coins/coin_service.dart' as _i3; -import 'package:stackduo/services/coins/manager.dart' as _i10; -import 'package:stackduo/services/locale_service.dart' as _i14; -import 'package:stackduo/services/notes_service.dart' as _i13; +import 'package:stackduo/services/coins/manager.dart' as _i9; +import 'package:stackduo/services/locale_service.dart' as _i13; +import 'package:stackduo/services/notes_service.dart' as _i12; import 'package:stackduo/utilities/amount/amount.dart' as _i6; -import 'package:stackduo/utilities/enums/coin_enum.dart' as _i11; +import 'package:stackduo/utilities/enums/coin_enum.dart' as _i10; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -162,7 +161,7 @@ class MockAddressBookService extends _i1.Mock returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -170,7 +169,7 @@ class MockAddressBookService extends _i1.Mock returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -198,7 +197,7 @@ class MockAddressBookService extends _i1.Mock /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i10.Manager { +class MockManager extends _i1.Mock implements _i9.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -226,10 +225,10 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValue: false, ) as bool); @override - _i11.Coin get coin => (super.noSuchMethod( + _i10.Coin get coin => (super.noSuchMethod( Invocation.getter(#coin), - returnValue: _i11.Coin.bitcoin, - ) as _i11.Coin); + returnValue: _i10.Coin.bitcoin, + ) as _i10.Coin); @override bool get isRefreshing => (super.noSuchMethod( Invocation.getter(#isRefreshing), @@ -288,16 +287,16 @@ class MockManager extends _i1.Mock implements _i10.Manager { ), ) as _i5.Balance); @override - _i8.Future> get transactions => (super.noSuchMethod( + _i8.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i8.Future>.value(<_i12.Transaction>[]), - ) as _i8.Future>); + _i8.Future>.value(<_i11.Transaction>[]), + ) as _i8.Future>); @override - _i8.Future> get utxos => (super.noSuchMethod( + _i8.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i8.Future>.value(<_i12.UTXO>[]), - ) as _i8.Future>); + returnValue: _i8.Future>.value(<_i11.UTXO>[]), + ) as _i8.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -347,6 +346,11 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -550,7 +554,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -558,7 +562,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -578,7 +582,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { /// A class which mocks [NotesService]. /// /// See the documentation for Mockito's code generation for more information. -class MockNotesService extends _i1.Mock implements _i13.NotesService { +class MockNotesService extends _i1.Mock implements _i12.NotesService { @override String get walletId => (super.noSuchMethod( Invocation.getter(#walletId), @@ -644,7 +648,7 @@ class MockNotesService extends _i1.Mock implements _i13.NotesService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -652,7 +656,7 @@ class MockNotesService extends _i1.Mock implements _i13.NotesService { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -680,7 +684,7 @@ class MockNotesService extends _i1.Mock implements _i13.NotesService { /// A class which mocks [LocaleService]. /// /// See the documentation for Mockito's code generation for more information. -class MockLocaleService extends _i1.Mock implements _i14.LocaleService { +class MockLocaleService extends _i1.Mock implements _i13.LocaleService { @override String get locale => (super.noSuchMethod( Invocation.getter(#locale), @@ -702,7 +706,7 @@ class MockLocaleService extends _i1.Mock implements _i14.LocaleService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -710,7 +714,7 @@ class MockLocaleService extends _i1.Mock implements _i14.LocaleService { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/address_book_view/subviews/edit_address_book_entry_view_screen_test.mocks.dart b/test/screen_tests/address_book_view/subviews/edit_address_book_entry_view_screen_test.mocks.dart index aac8644df..50a1edf60 100644 --- a/test/screen_tests/address_book_view/subviews/edit_address_book_entry_view_screen_test.mocks.dart +++ b/test/screen_tests/address_book_view/subviews/edit_address_book_entry_view_screen_test.mocks.dart @@ -1,21 +1,20 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/address_book_view/subviews/edit_address_book_entry_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i9; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i5; import 'package:stackduo/models/isar/models/contact_entry.dart' as _i2; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i12; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i11; import 'package:stackduo/models/models.dart' as _i4; import 'package:stackduo/services/address_book_service.dart' as _i7; import 'package:stackduo/services/coins/coin_service.dart' as _i3; -import 'package:stackduo/services/coins/manager.dart' as _i10; +import 'package:stackduo/services/coins/manager.dart' as _i9; import 'package:stackduo/utilities/amount/amount.dart' as _i6; -import 'package:stackduo/utilities/enums/coin_enum.dart' as _i11; +import 'package:stackduo/utilities/enums/coin_enum.dart' as _i10; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -160,7 +159,7 @@ class MockAddressBookService extends _i1.Mock returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -168,7 +167,7 @@ class MockAddressBookService extends _i1.Mock returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -196,7 +195,7 @@ class MockAddressBookService extends _i1.Mock /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i10.Manager { +class MockManager extends _i1.Mock implements _i9.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -224,10 +223,10 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValue: false, ) as bool); @override - _i11.Coin get coin => (super.noSuchMethod( + _i10.Coin get coin => (super.noSuchMethod( Invocation.getter(#coin), - returnValue: _i11.Coin.bitcoin, - ) as _i11.Coin); + returnValue: _i10.Coin.bitcoin, + ) as _i10.Coin); @override bool get isRefreshing => (super.noSuchMethod( Invocation.getter(#isRefreshing), @@ -286,16 +285,16 @@ class MockManager extends _i1.Mock implements _i10.Manager { ), ) as _i5.Balance); @override - _i8.Future> get transactions => (super.noSuchMethod( + _i8.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i8.Future>.value(<_i12.Transaction>[]), - ) as _i8.Future>); + _i8.Future>.value(<_i11.Transaction>[]), + ) as _i8.Future>); @override - _i8.Future> get utxos => (super.noSuchMethod( + _i8.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i8.Future>.value(<_i12.UTXO>[]), - ) as _i8.Future>); + returnValue: _i8.Future>.value(<_i11.UTXO>[]), + ) as _i8.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -345,6 +344,11 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -548,7 +552,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -556,7 +560,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/exchange/exchange_view_test.mocks.dart b/test/screen_tests/exchange/exchange_view_test.mocks.dart index 4fa685de2..98d94d5d8 100644 --- a/test/screen_tests/exchange/exchange_view_test.mocks.dart +++ b/test/screen_tests/exchange/exchange_view_test.mocks.dart @@ -1,34 +1,35 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/exchange/exchange_view_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i6; -import 'dart:ui' as _i7; -import 'package:decimal/decimal.dart' as _i14; -import 'package:http/http.dart' as _i12; +import 'package:decimal/decimal.dart' as _i15; +import 'package:http/http.dart' as _i13; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/exchange/change_now/cn_exchange_estimate.dart' - as _i17; + as _i18; import 'package:stackduo/models/exchange/change_now/exchange_transaction.dart' - as _i19; -import 'package:stackduo/models/exchange/change_now/exchange_transaction_status.dart' as _i20; +import 'package:stackduo/models/exchange/change_now/exchange_transaction_status.dart' + as _i21; import 'package:stackduo/models/exchange/response_objects/estimate.dart' - as _i16; + as _i17; import 'package:stackduo/models/exchange/response_objects/fixed_rate_market.dart' - as _i18; -import 'package:stackduo/models/exchange/response_objects/range.dart' as _i15; -import 'package:stackduo/models/exchange/response_objects/trade.dart' as _i9; -import 'package:stackduo/models/isar/exchange_cache/currency.dart' as _i13; -import 'package:stackduo/models/isar/exchange_cache/pair.dart' as _i21; + as _i19; +import 'package:stackduo/models/exchange/response_objects/range.dart' as _i16; +import 'package:stackduo/models/exchange/response_objects/trade.dart' as _i10; +import 'package:stackduo/models/isar/exchange_cache/currency.dart' as _i14; +import 'package:stackduo/models/isar/exchange_cache/pair.dart' as _i22; import 'package:stackduo/services/exchange/change_now/change_now_api.dart' - as _i11; + as _i12; import 'package:stackduo/services/exchange/exchange_response.dart' as _i2; -import 'package:stackduo/services/trade_notes_service.dart' as _i10; -import 'package:stackduo/services/trade_service.dart' as _i8; +import 'package:stackduo/services/trade_notes_service.dart' as _i11; +import 'package:stackduo/services/trade_service.dart' as _i9; +import 'package:stackduo/utilities/amount/amount_unit.dart' as _i7; import 'package:stackduo/utilities/enums/backup_frequency_type.dart' as _i5; +import 'package:stackduo/utilities/enums/coin_enum.dart' as _i8; import 'package:stackduo/utilities/enums/sync_type_enum.dart' as _i4; import 'package:stackduo/utilities/prefs.dart' as _i3; @@ -451,7 +452,55 @@ class MockPrefs extends _i1.Mock implements _i3.Prefs { returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); @override - void addListener(_i7.VoidCallback? listener) => super.noSuchMethod( + _i7.AmountUnit amountUnit(_i8.Coin? coin) => (super.noSuchMethod( + Invocation.method( + #amountUnit, + [coin], + ), + returnValue: _i7.AmountUnit.normal, + ) as _i7.AmountUnit); + @override + void updateAmountUnit({ + required _i8.Coin? coin, + required _i7.AmountUnit? amountUnit, + }) => + super.noSuchMethod( + Invocation.method( + #updateAmountUnit, + [], + { + #coin: coin, + #amountUnit: amountUnit, + }, + ), + returnValueForMissingStub: null, + ); + @override + int maxDecimals(_i8.Coin? coin) => (super.noSuchMethod( + Invocation.method( + #maxDecimals, + [coin], + ), + returnValue: 0, + ) as int); + @override + void updateMaxDecimals({ + required _i8.Coin? coin, + required int? maxDecimals, + }) => + super.noSuchMethod( + Invocation.method( + #updateMaxDecimals, + [], + { + #coin: coin, + #maxDecimals: maxDecimals, + }, + ), + returnValueForMissingStub: null, + ); + @override + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -459,7 +508,7 @@ class MockPrefs extends _i1.Mock implements _i3.Prefs { returnValueForMissingStub: null, ); @override - void removeListener(_i7.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -487,29 +536,29 @@ class MockPrefs extends _i1.Mock implements _i3.Prefs { /// A class which mocks [TradesService]. /// /// See the documentation for Mockito's code generation for more information. -class MockTradesService extends _i1.Mock implements _i8.TradesService { +class MockTradesService extends _i1.Mock implements _i9.TradesService { MockTradesService() { _i1.throwOnMissingStub(this); } @override - List<_i9.Trade> get trades => (super.noSuchMethod( + List<_i10.Trade> get trades => (super.noSuchMethod( Invocation.getter(#trades), - returnValue: <_i9.Trade>[], - ) as List<_i9.Trade>); + returnValue: <_i10.Trade>[], + ) as List<_i10.Trade>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), returnValue: false, ) as bool); @override - _i9.Trade? get(String? tradeId) => (super.noSuchMethod(Invocation.method( + _i10.Trade? get(String? tradeId) => (super.noSuchMethod(Invocation.method( #get, [tradeId], - )) as _i9.Trade?); + )) as _i10.Trade?); @override _i6.Future add({ - required _i9.Trade? trade, + required _i10.Trade? trade, required bool? shouldNotifyListeners, }) => (super.noSuchMethod( @@ -526,7 +575,7 @@ class MockTradesService extends _i1.Mock implements _i8.TradesService { ) as _i6.Future); @override _i6.Future edit({ - required _i9.Trade? trade, + required _i10.Trade? trade, required bool? shouldNotifyListeners, }) => (super.noSuchMethod( @@ -543,7 +592,7 @@ class MockTradesService extends _i1.Mock implements _i8.TradesService { ) as _i6.Future); @override _i6.Future delete({ - required _i9.Trade? trade, + required _i10.Trade? trade, required bool? shouldNotifyListeners, }) => (super.noSuchMethod( @@ -576,7 +625,7 @@ class MockTradesService extends _i1.Mock implements _i8.TradesService { returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); @override - void addListener(_i7.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -584,7 +633,7 @@ class MockTradesService extends _i1.Mock implements _i8.TradesService { returnValueForMissingStub: null, ); @override - void removeListener(_i7.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -612,7 +661,7 @@ class MockTradesService extends _i1.Mock implements _i8.TradesService { /// A class which mocks [TradeNotesService]. /// /// See the documentation for Mockito's code generation for more information. -class MockTradeNotesService extends _i1.Mock implements _i10.TradeNotesService { +class MockTradeNotesService extends _i1.Mock implements _i11.TradeNotesService { MockTradeNotesService() { _i1.throwOnMissingStub(this); } @@ -664,7 +713,7 @@ class MockTradeNotesService extends _i1.Mock implements _i10.TradeNotesService { returnValueForMissingStub: _i6.Future.value(), ) as _i6.Future); @override - void addListener(_i7.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -672,7 +721,7 @@ class MockTradeNotesService extends _i1.Mock implements _i10.TradeNotesService { returnValueForMissingStub: null, ); @override - void removeListener(_i7.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -700,13 +749,13 @@ class MockTradeNotesService extends _i1.Mock implements _i10.TradeNotesService { /// A class which mocks [ChangeNowAPI]. /// /// See the documentation for Mockito's code generation for more information. -class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { +class MockChangeNowAPI extends _i1.Mock implements _i12.ChangeNowAPI { MockChangeNowAPI() { _i1.throwOnMissingStub(this); } @override - set client(_i12.Client? _client) => super.noSuchMethod( + set client(_i13.Client? _client) => super.noSuchMethod( Invocation.setter( #client, _client, @@ -714,7 +763,7 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { returnValueForMissingStub: null, ); @override - _i6.Future<_i2.ExchangeResponse>> getAvailableCurrencies({ + _i6.Future<_i2.ExchangeResponse>> getAvailableCurrencies({ bool? fixedRate, bool? active, }) => @@ -728,8 +777,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), returnValue: - _i6.Future<_i2.ExchangeResponse>>.value( - _FakeExchangeResponse_0>( + _i6.Future<_i2.ExchangeResponse>>.value( + _FakeExchangeResponse_0>( this, Invocation.method( #getAvailableCurrencies, @@ -740,9 +789,26 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), )), - ) as _i6.Future<_i2.ExchangeResponse>>); + ) as _i6.Future<_i2.ExchangeResponse>>); + @override + _i6.Future<_i2.ExchangeResponse>> getCurrenciesV2() => + (super.noSuchMethod( + Invocation.method( + #getCurrenciesV2, + [], + ), + returnValue: + _i6.Future<_i2.ExchangeResponse>>.value( + _FakeExchangeResponse_0>( + this, + Invocation.method( + #getCurrenciesV2, + [], + ), + )), + ) as _i6.Future<_i2.ExchangeResponse>>); @override - _i6.Future<_i2.ExchangeResponse>> getPairedCurrencies({ + _i6.Future<_i2.ExchangeResponse>> getPairedCurrencies({ required String? ticker, bool? fixedRate, }) => @@ -756,8 +822,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), returnValue: - _i6.Future<_i2.ExchangeResponse>>.value( - _FakeExchangeResponse_0>( + _i6.Future<_i2.ExchangeResponse>>.value( + _FakeExchangeResponse_0>( this, Invocation.method( #getPairedCurrencies, @@ -768,9 +834,9 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), )), - ) as _i6.Future<_i2.ExchangeResponse>>); + ) as _i6.Future<_i2.ExchangeResponse>>); @override - _i6.Future<_i2.ExchangeResponse<_i14.Decimal>> getMinimalExchangeAmount({ + _i6.Future<_i2.ExchangeResponse<_i15.Decimal>> getMinimalExchangeAmount({ required String? fromTicker, required String? toTicker, String? apiKey, @@ -785,8 +851,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { #apiKey: apiKey, }, ), - returnValue: _i6.Future<_i2.ExchangeResponse<_i14.Decimal>>.value( - _FakeExchangeResponse_0<_i14.Decimal>( + returnValue: _i6.Future<_i2.ExchangeResponse<_i15.Decimal>>.value( + _FakeExchangeResponse_0<_i15.Decimal>( this, Invocation.method( #getMinimalExchangeAmount, @@ -798,9 +864,9 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), )), - ) as _i6.Future<_i2.ExchangeResponse<_i14.Decimal>>); + ) as _i6.Future<_i2.ExchangeResponse<_i15.Decimal>>); @override - _i6.Future<_i2.ExchangeResponse<_i15.Range>> getRange({ + _i6.Future<_i2.ExchangeResponse<_i16.Range>> getRange({ required String? fromTicker, required String? toTicker, required bool? isFixedRate, @@ -817,8 +883,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { #apiKey: apiKey, }, ), - returnValue: _i6.Future<_i2.ExchangeResponse<_i15.Range>>.value( - _FakeExchangeResponse_0<_i15.Range>( + returnValue: _i6.Future<_i2.ExchangeResponse<_i16.Range>>.value( + _FakeExchangeResponse_0<_i16.Range>( this, Invocation.method( #getRange, @@ -831,12 +897,12 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), )), - ) as _i6.Future<_i2.ExchangeResponse<_i15.Range>>); + ) as _i6.Future<_i2.ExchangeResponse<_i16.Range>>); @override - _i6.Future<_i2.ExchangeResponse<_i16.Estimate>> getEstimatedExchangeAmount({ + _i6.Future<_i2.ExchangeResponse<_i17.Estimate>> getEstimatedExchangeAmount({ required String? fromTicker, required String? toTicker, - required _i14.Decimal? fromAmount, + required _i15.Decimal? fromAmount, String? apiKey, }) => (super.noSuchMethod( @@ -850,8 +916,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { #apiKey: apiKey, }, ), - returnValue: _i6.Future<_i2.ExchangeResponse<_i16.Estimate>>.value( - _FakeExchangeResponse_0<_i16.Estimate>( + returnValue: _i6.Future<_i2.ExchangeResponse<_i17.Estimate>>.value( + _FakeExchangeResponse_0<_i17.Estimate>( this, Invocation.method( #getEstimatedExchangeAmount, @@ -864,13 +930,13 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), )), - ) as _i6.Future<_i2.ExchangeResponse<_i16.Estimate>>); + ) as _i6.Future<_i2.ExchangeResponse<_i17.Estimate>>); @override - _i6.Future<_i2.ExchangeResponse<_i16.Estimate>> + _i6.Future<_i2.ExchangeResponse<_i17.Estimate>> getEstimatedExchangeAmountFixedRate({ required String? fromTicker, required String? toTicker, - required _i14.Decimal? fromAmount, + required _i15.Decimal? fromAmount, required bool? reversed, bool? useRateId = true, String? apiKey, @@ -888,8 +954,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { #apiKey: apiKey, }, ), - returnValue: _i6.Future<_i2.ExchangeResponse<_i16.Estimate>>.value( - _FakeExchangeResponse_0<_i16.Estimate>( + returnValue: _i6.Future<_i2.ExchangeResponse<_i17.Estimate>>.value( + _FakeExchangeResponse_0<_i17.Estimate>( this, Invocation.method( #getEstimatedExchangeAmountFixedRate, @@ -904,17 +970,17 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), )), - ) as _i6.Future<_i2.ExchangeResponse<_i16.Estimate>>); + ) as _i6.Future<_i2.ExchangeResponse<_i17.Estimate>>); @override - _i6.Future<_i2.ExchangeResponse<_i17.CNExchangeEstimate>> + _i6.Future<_i2.ExchangeResponse<_i18.CNExchangeEstimate>> getEstimatedExchangeAmountV2({ required String? fromTicker, required String? toTicker, - required _i17.CNEstimateType? fromOrTo, - required _i14.Decimal? amount, + required _i18.CNEstimateType? fromOrTo, + required _i15.Decimal? amount, String? fromNetwork, String? toNetwork, - _i17.CNFlowType? flow = _i17.CNFlowType.standard, + _i18.CNFlowType? flow = _i18.CNFlowType.standard, String? apiKey, }) => (super.noSuchMethod( @@ -933,8 +999,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), returnValue: - _i6.Future<_i2.ExchangeResponse<_i17.CNExchangeEstimate>>.value( - _FakeExchangeResponse_0<_i17.CNExchangeEstimate>( + _i6.Future<_i2.ExchangeResponse<_i18.CNExchangeEstimate>>.value( + _FakeExchangeResponse_0<_i18.CNExchangeEstimate>( this, Invocation.method( #getEstimatedExchangeAmountV2, @@ -951,9 +1017,9 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), )), - ) as _i6.Future<_i2.ExchangeResponse<_i17.CNExchangeEstimate>>); + ) as _i6.Future<_i2.ExchangeResponse<_i18.CNExchangeEstimate>>); @override - _i6.Future<_i2.ExchangeResponse>> + _i6.Future<_i2.ExchangeResponse>> getAvailableFixedRateMarkets({String? apiKey}) => (super.noSuchMethod( Invocation.method( #getAvailableFixedRateMarkets, @@ -961,8 +1027,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { {#apiKey: apiKey}, ), returnValue: _i6.Future< - _i2.ExchangeResponse>>.value( - _FakeExchangeResponse_0>( + _i2.ExchangeResponse>>.value( + _FakeExchangeResponse_0>( this, Invocation.method( #getAvailableFixedRateMarkets, @@ -970,14 +1036,14 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { {#apiKey: apiKey}, ), )), - ) as _i6.Future<_i2.ExchangeResponse>>); + ) as _i6.Future<_i2.ExchangeResponse>>); @override - _i6.Future<_i2.ExchangeResponse<_i19.ExchangeTransaction>> + _i6.Future<_i2.ExchangeResponse<_i20.ExchangeTransaction>> createStandardExchangeTransaction({ required String? fromTicker, required String? toTicker, required String? receivingAddress, - required _i14.Decimal? amount, + required _i15.Decimal? amount, String? extraId = r'', String? userId = r'', String? contactEmail = r'', @@ -1003,8 +1069,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), returnValue: _i6.Future< - _i2.ExchangeResponse<_i19.ExchangeTransaction>>.value( - _FakeExchangeResponse_0<_i19.ExchangeTransaction>( + _i2.ExchangeResponse<_i20.ExchangeTransaction>>.value( + _FakeExchangeResponse_0<_i20.ExchangeTransaction>( this, Invocation.method( #createStandardExchangeTransaction, @@ -1023,14 +1089,14 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), )), - ) as _i6.Future<_i2.ExchangeResponse<_i19.ExchangeTransaction>>); + ) as _i6.Future<_i2.ExchangeResponse<_i20.ExchangeTransaction>>); @override - _i6.Future<_i2.ExchangeResponse<_i19.ExchangeTransaction>> + _i6.Future<_i2.ExchangeResponse<_i20.ExchangeTransaction>> createFixedRateExchangeTransaction({ required String? fromTicker, required String? toTicker, required String? receivingAddress, - required _i14.Decimal? amount, + required _i15.Decimal? amount, required String? rateId, required bool? reversed, String? extraId = r'', @@ -1060,8 +1126,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), returnValue: _i6.Future< - _i2.ExchangeResponse<_i19.ExchangeTransaction>>.value( - _FakeExchangeResponse_0<_i19.ExchangeTransaction>( + _i2.ExchangeResponse<_i20.ExchangeTransaction>>.value( + _FakeExchangeResponse_0<_i20.ExchangeTransaction>( this, Invocation.method( #createFixedRateExchangeTransaction, @@ -1082,9 +1148,9 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), )), - ) as _i6.Future<_i2.ExchangeResponse<_i19.ExchangeTransaction>>); + ) as _i6.Future<_i2.ExchangeResponse<_i20.ExchangeTransaction>>); @override - _i6.Future<_i2.ExchangeResponse<_i20.ExchangeTransactionStatus>> + _i6.Future<_i2.ExchangeResponse<_i21.ExchangeTransactionStatus>> getTransactionStatus({ required String? id, String? apiKey, @@ -1099,8 +1165,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { }, ), returnValue: _i6.Future< - _i2.ExchangeResponse<_i20.ExchangeTransactionStatus>>.value( - _FakeExchangeResponse_0<_i20.ExchangeTransactionStatus>( + _i2.ExchangeResponse<_i21.ExchangeTransactionStatus>>.value( + _FakeExchangeResponse_0<_i21.ExchangeTransactionStatus>( this, Invocation.method( #getTransactionStatus, @@ -1112,9 +1178,9 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { ), )), ) as _i6 - .Future<_i2.ExchangeResponse<_i20.ExchangeTransactionStatus>>); + .Future<_i2.ExchangeResponse<_i21.ExchangeTransactionStatus>>); @override - _i6.Future<_i2.ExchangeResponse>> + _i6.Future<_i2.ExchangeResponse>> getAvailableFloatingRatePairs({bool? includePartners = false}) => (super.noSuchMethod( Invocation.method( @@ -1123,8 +1189,8 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { {#includePartners: includePartners}, ), returnValue: - _i6.Future<_i2.ExchangeResponse>>.value( - _FakeExchangeResponse_0>( + _i6.Future<_i2.ExchangeResponse>>.value( + _FakeExchangeResponse_0>( this, Invocation.method( #getAvailableFloatingRatePairs, @@ -1132,5 +1198,5 @@ class MockChangeNowAPI extends _i1.Mock implements _i11.ChangeNowAPI { {#includePartners: includePartners}, ), )), - ) as _i6.Future<_i2.ExchangeResponse>>); + ) as _i6.Future<_i2.ExchangeResponse>>); } diff --git a/test/screen_tests/lockscreen_view_screen_test.mocks.dart b/test/screen_tests/lockscreen_view_screen_test.mocks.dart index c93aee6b0..27cf63a5a 100644 --- a/test/screen_tests/lockscreen_view_screen_test.mocks.dart +++ b/test/screen_tests/lockscreen_view_screen_test.mocks.dart @@ -1,19 +1,18 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/lockscreen_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i10; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i5; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i14; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i13; import 'package:stackduo/models/models.dart' as _i4; -import 'package:stackduo/models/node_model.dart' as _i12; +import 'package:stackduo/models/node_model.dart' as _i11; import 'package:stackduo/services/coins/coin_service.dart' as _i3; -import 'package:stackduo/services/coins/manager.dart' as _i13; -import 'package:stackduo/services/node_service.dart' as _i11; +import 'package:stackduo/services/coins/manager.dart' as _i12; +import 'package:stackduo/services/node_service.dart' as _i10; import 'package:stackduo/services/wallets_service.dart' as _i7; import 'package:stackduo/utilities/amount/amount.dart' as _i6; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i9; @@ -280,7 +279,7 @@ class MockWalletsService extends _i1.Mock implements _i7.WalletsService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -288,7 +287,7 @@ class MockWalletsService extends _i1.Mock implements _i7.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -316,7 +315,7 @@ class MockWalletsService extends _i1.Mock implements _i7.WalletsService { /// A class which mocks [NodeService]. /// /// See the documentation for Mockito's code generation for more information. -class MockNodeService extends _i1.Mock implements _i11.NodeService { +class MockNodeService extends _i1.Mock implements _i10.NodeService { @override _i2.SecureStorageInterface get secureStorageInterface => (super.noSuchMethod( Invocation.getter(#secureStorageInterface), @@ -326,15 +325,15 @@ class MockNodeService extends _i1.Mock implements _i11.NodeService { ), ) as _i2.SecureStorageInterface); @override - List<_i12.NodeModel> get primaryNodes => (super.noSuchMethod( + List<_i11.NodeModel> get primaryNodes => (super.noSuchMethod( Invocation.getter(#primaryNodes), - returnValue: <_i12.NodeModel>[], - ) as List<_i12.NodeModel>); + returnValue: <_i11.NodeModel>[], + ) as List<_i11.NodeModel>); @override - List<_i12.NodeModel> get nodes => (super.noSuchMethod( + List<_i11.NodeModel> get nodes => (super.noSuchMethod( Invocation.getter(#nodes), - returnValue: <_i12.NodeModel>[], - ) as List<_i12.NodeModel>); + returnValue: <_i11.NodeModel>[], + ) as List<_i11.NodeModel>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), @@ -352,7 +351,7 @@ class MockNodeService extends _i1.Mock implements _i11.NodeService { @override _i8.Future setPrimaryNodeFor({ required _i9.Coin? coin, - required _i12.NodeModel? node, + required _i11.NodeModel? node, bool? shouldNotifyListeners = false, }) => (super.noSuchMethod( @@ -369,40 +368,40 @@ class MockNodeService extends _i1.Mock implements _i11.NodeService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - _i12.NodeModel? getPrimaryNodeFor({required _i9.Coin? coin}) => + _i11.NodeModel? getPrimaryNodeFor({required _i9.Coin? coin}) => (super.noSuchMethod(Invocation.method( #getPrimaryNodeFor, [], {#coin: coin}, - )) as _i12.NodeModel?); + )) as _i11.NodeModel?); @override - List<_i12.NodeModel> getNodesFor(_i9.Coin? coin) => (super.noSuchMethod( + List<_i11.NodeModel> getNodesFor(_i9.Coin? coin) => (super.noSuchMethod( Invocation.method( #getNodesFor, [coin], ), - returnValue: <_i12.NodeModel>[], - ) as List<_i12.NodeModel>); + returnValue: <_i11.NodeModel>[], + ) as List<_i11.NodeModel>); @override - _i12.NodeModel? getNodeById({required String? id}) => + _i11.NodeModel? getNodeById({required String? id}) => (super.noSuchMethod(Invocation.method( #getNodeById, [], {#id: id}, - )) as _i12.NodeModel?); + )) as _i11.NodeModel?); @override - List<_i12.NodeModel> failoverNodesFor({required _i9.Coin? coin}) => + List<_i11.NodeModel> failoverNodesFor({required _i9.Coin? coin}) => (super.noSuchMethod( Invocation.method( #failoverNodesFor, [], {#coin: coin}, ), - returnValue: <_i12.NodeModel>[], - ) as List<_i12.NodeModel>); + returnValue: <_i11.NodeModel>[], + ) as List<_i11.NodeModel>); @override _i8.Future add( - _i12.NodeModel? node, + _i11.NodeModel? node, String? password, bool? shouldNotifyListeners, ) => @@ -454,7 +453,7 @@ class MockNodeService extends _i1.Mock implements _i11.NodeService { ) as _i8.Future); @override _i8.Future edit( - _i12.NodeModel? editedNode, + _i11.NodeModel? editedNode, String? password, bool? shouldNotifyListeners, ) => @@ -480,7 +479,7 @@ class MockNodeService extends _i1.Mock implements _i11.NodeService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -488,7 +487,7 @@ class MockNodeService extends _i1.Mock implements _i11.NodeService { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -516,7 +515,7 @@ class MockNodeService extends _i1.Mock implements _i11.NodeService { /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i13.Manager { +class MockManager extends _i1.Mock implements _i12.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -606,16 +605,16 @@ class MockManager extends _i1.Mock implements _i13.Manager { ), ) as _i5.Balance); @override - _i8.Future> get transactions => (super.noSuchMethod( + _i8.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i8.Future>.value(<_i14.Transaction>[]), - ) as _i8.Future>); + _i8.Future>.value(<_i13.Transaction>[]), + ) as _i8.Future>); @override - _i8.Future> get utxos => (super.noSuchMethod( + _i8.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i8.Future>.value(<_i14.UTXO>[]), - ) as _i8.Future>); + returnValue: _i8.Future>.value(<_i13.UTXO>[]), + ) as _i8.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -665,6 +664,11 @@ class MockManager extends _i1.Mock implements _i13.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -868,7 +872,7 @@ class MockManager extends _i1.Mock implements _i13.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -876,7 +880,7 @@ class MockManager extends _i1.Mock implements _i13.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/main_view_tests/main_view_screen_testA_test.mocks.dart b/test/screen_tests/main_view_tests/main_view_screen_testA_test.mocks.dart index 5df61cd29..26a5c4fc1 100644 --- a/test/screen_tests/main_view_tests/main_view_screen_testA_test.mocks.dart +++ b/test/screen_tests/main_view_tests/main_view_screen_testA_test.mocks.dart @@ -1,19 +1,18 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/main_view_tests/main_view_screen_testA_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i7; -import 'dart:ui' as _i9; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i11; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i10; import 'package:stackduo/models/models.dart' as _i3; import 'package:stackduo/services/coins/coin_service.dart' as _i2; -import 'package:stackduo/services/coins/manager.dart' as _i10; -import 'package:stackduo/services/locale_service.dart' as _i13; -import 'package:stackduo/services/notes_service.dart' as _i12; +import 'package:stackduo/services/coins/manager.dart' as _i9; +import 'package:stackduo/services/locale_service.dart' as _i12; +import 'package:stackduo/services/notes_service.dart' as _i11; import 'package:stackduo/services/wallets_service.dart' as _i6; import 'package:stackduo/utilities/amount/amount.dart' as _i5; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i8; @@ -267,7 +266,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -275,7 +274,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -303,7 +302,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i10.Manager { +class MockManager extends _i1.Mock implements _i9.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -393,16 +392,16 @@ class MockManager extends _i1.Mock implements _i10.Manager { ), ) as _i4.Balance); @override - _i7.Future> get transactions => (super.noSuchMethod( + _i7.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i7.Future>.value(<_i11.Transaction>[]), - ) as _i7.Future>); + _i7.Future>.value(<_i10.Transaction>[]), + ) as _i7.Future>); @override - _i7.Future> get utxos => (super.noSuchMethod( + _i7.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i7.Future>.value(<_i11.UTXO>[]), - ) as _i7.Future>); + returnValue: _i7.Future>.value(<_i10.UTXO>[]), + ) as _i7.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -452,6 +451,11 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -655,7 +659,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -663,7 +667,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -683,7 +687,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { /// A class which mocks [NotesService]. /// /// See the documentation for Mockito's code generation for more information. -class MockNotesService extends _i1.Mock implements _i12.NotesService { +class MockNotesService extends _i1.Mock implements _i11.NotesService { @override String get walletId => (super.noSuchMethod( Invocation.getter(#walletId), @@ -749,7 +753,7 @@ class MockNotesService extends _i1.Mock implements _i12.NotesService { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -757,7 +761,7 @@ class MockNotesService extends _i1.Mock implements _i12.NotesService { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -785,7 +789,7 @@ class MockNotesService extends _i1.Mock implements _i12.NotesService { /// A class which mocks [LocaleService]. /// /// See the documentation for Mockito's code generation for more information. -class MockLocaleService extends _i1.Mock implements _i13.LocaleService { +class MockLocaleService extends _i1.Mock implements _i12.LocaleService { @override String get locale => (super.noSuchMethod( Invocation.getter(#locale), @@ -807,7 +811,7 @@ class MockLocaleService extends _i1.Mock implements _i13.LocaleService { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -815,7 +819,7 @@ class MockLocaleService extends _i1.Mock implements _i13.LocaleService { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/main_view_tests/main_view_screen_testB_test.mocks.dart b/test/screen_tests/main_view_tests/main_view_screen_testB_test.mocks.dart index 60597cc76..22f5cf2f7 100644 --- a/test/screen_tests/main_view_tests/main_view_screen_testB_test.mocks.dart +++ b/test/screen_tests/main_view_tests/main_view_screen_testB_test.mocks.dart @@ -1,19 +1,18 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/main_view_tests/main_view_screen_testB_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i7; -import 'dart:ui' as _i9; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i11; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i10; import 'package:stackduo/models/models.dart' as _i3; import 'package:stackduo/services/coins/coin_service.dart' as _i2; -import 'package:stackduo/services/coins/manager.dart' as _i10; -import 'package:stackduo/services/locale_service.dart' as _i13; -import 'package:stackduo/services/notes_service.dart' as _i12; +import 'package:stackduo/services/coins/manager.dart' as _i9; +import 'package:stackduo/services/locale_service.dart' as _i12; +import 'package:stackduo/services/notes_service.dart' as _i11; import 'package:stackduo/services/wallets_service.dart' as _i6; import 'package:stackduo/utilities/amount/amount.dart' as _i5; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i8; @@ -267,7 +266,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -275,7 +274,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -303,7 +302,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i10.Manager { +class MockManager extends _i1.Mock implements _i9.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -393,16 +392,16 @@ class MockManager extends _i1.Mock implements _i10.Manager { ), ) as _i4.Balance); @override - _i7.Future> get transactions => (super.noSuchMethod( + _i7.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i7.Future>.value(<_i11.Transaction>[]), - ) as _i7.Future>); + _i7.Future>.value(<_i10.Transaction>[]), + ) as _i7.Future>); @override - _i7.Future> get utxos => (super.noSuchMethod( + _i7.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i7.Future>.value(<_i11.UTXO>[]), - ) as _i7.Future>); + returnValue: _i7.Future>.value(<_i10.UTXO>[]), + ) as _i7.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -452,6 +451,11 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -655,7 +659,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -663,7 +667,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -683,7 +687,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { /// A class which mocks [NotesService]. /// /// See the documentation for Mockito's code generation for more information. -class MockNotesService extends _i1.Mock implements _i12.NotesService { +class MockNotesService extends _i1.Mock implements _i11.NotesService { @override String get walletId => (super.noSuchMethod( Invocation.getter(#walletId), @@ -749,7 +753,7 @@ class MockNotesService extends _i1.Mock implements _i12.NotesService { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -757,7 +761,7 @@ class MockNotesService extends _i1.Mock implements _i12.NotesService { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -785,7 +789,7 @@ class MockNotesService extends _i1.Mock implements _i12.NotesService { /// A class which mocks [LocaleService]. /// /// See the documentation for Mockito's code generation for more information. -class MockLocaleService extends _i1.Mock implements _i13.LocaleService { +class MockLocaleService extends _i1.Mock implements _i12.LocaleService { @override String get locale => (super.noSuchMethod( Invocation.getter(#locale), @@ -807,7 +811,7 @@ class MockLocaleService extends _i1.Mock implements _i13.LocaleService { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -815,7 +819,7 @@ class MockLocaleService extends _i1.Mock implements _i13.LocaleService { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/main_view_tests/main_view_screen_testC_test.mocks.dart b/test/screen_tests/main_view_tests/main_view_screen_testC_test.mocks.dart index 5b08e0385..a296ab840 100644 --- a/test/screen_tests/main_view_tests/main_view_screen_testC_test.mocks.dart +++ b/test/screen_tests/main_view_tests/main_view_screen_testC_test.mocks.dart @@ -1,19 +1,18 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/main_view_tests/main_view_screen_testC_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i7; -import 'dart:ui' as _i9; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i11; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i10; import 'package:stackduo/models/models.dart' as _i3; import 'package:stackduo/services/coins/coin_service.dart' as _i2; -import 'package:stackduo/services/coins/manager.dart' as _i10; -import 'package:stackduo/services/locale_service.dart' as _i13; -import 'package:stackduo/services/notes_service.dart' as _i12; +import 'package:stackduo/services/coins/manager.dart' as _i9; +import 'package:stackduo/services/locale_service.dart' as _i12; +import 'package:stackduo/services/notes_service.dart' as _i11; import 'package:stackduo/services/wallets_service.dart' as _i6; import 'package:stackduo/utilities/amount/amount.dart' as _i5; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i8; @@ -267,7 +266,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -275,7 +274,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -303,7 +302,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i10.Manager { +class MockManager extends _i1.Mock implements _i9.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -393,16 +392,16 @@ class MockManager extends _i1.Mock implements _i10.Manager { ), ) as _i4.Balance); @override - _i7.Future> get transactions => (super.noSuchMethod( + _i7.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i7.Future>.value(<_i11.Transaction>[]), - ) as _i7.Future>); + _i7.Future>.value(<_i10.Transaction>[]), + ) as _i7.Future>); @override - _i7.Future> get utxos => (super.noSuchMethod( + _i7.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i7.Future>.value(<_i11.UTXO>[]), - ) as _i7.Future>); + returnValue: _i7.Future>.value(<_i10.UTXO>[]), + ) as _i7.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -452,6 +451,11 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -655,7 +659,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -663,7 +667,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -683,7 +687,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { /// A class which mocks [NotesService]. /// /// See the documentation for Mockito's code generation for more information. -class MockNotesService extends _i1.Mock implements _i12.NotesService { +class MockNotesService extends _i1.Mock implements _i11.NotesService { @override String get walletId => (super.noSuchMethod( Invocation.getter(#walletId), @@ -749,7 +753,7 @@ class MockNotesService extends _i1.Mock implements _i12.NotesService { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -757,7 +761,7 @@ class MockNotesService extends _i1.Mock implements _i12.NotesService { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -785,7 +789,7 @@ class MockNotesService extends _i1.Mock implements _i12.NotesService { /// A class which mocks [LocaleService]. /// /// See the documentation for Mockito's code generation for more information. -class MockLocaleService extends _i1.Mock implements _i13.LocaleService { +class MockLocaleService extends _i1.Mock implements _i12.LocaleService { @override String get locale => (super.noSuchMethod( Invocation.getter(#locale), @@ -807,7 +811,7 @@ class MockLocaleService extends _i1.Mock implements _i13.LocaleService { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -815,7 +819,7 @@ class MockLocaleService extends _i1.Mock implements _i13.LocaleService { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/onboarding/backup_key_view_screen_test.mocks.dart b/test/screen_tests/onboarding/backup_key_view_screen_test.mocks.dart index 6cd533c0b..cc5c0cf44 100644 --- a/test/screen_tests/onboarding/backup_key_view_screen_test.mocks.dart +++ b/test/screen_tests/onboarding/backup_key_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/onboarding/backup_key_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i10; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; @@ -219,6 +218,11 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -422,7 +426,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -430,7 +434,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/onboarding/backup_key_warning_view_screen_test.mocks.dart b/test/screen_tests/onboarding/backup_key_warning_view_screen_test.mocks.dart index 65990a7d5..b9f6f7d32 100644 --- a/test/screen_tests/onboarding/backup_key_warning_view_screen_test.mocks.dart +++ b/test/screen_tests/onboarding/backup_key_warning_view_screen_test.mocks.dart @@ -1,17 +1,16 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/onboarding/backup_key_warning_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i7; -import 'dart:ui' as _i9; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i11; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i10; import 'package:stackduo/models/models.dart' as _i3; import 'package:stackduo/services/coins/coin_service.dart' as _i2; -import 'package:stackduo/services/coins/manager.dart' as _i10; +import 'package:stackduo/services/coins/manager.dart' as _i9; import 'package:stackduo/services/wallets_service.dart' as _i6; import 'package:stackduo/utilities/amount/amount.dart' as _i5; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i8; @@ -265,7 +264,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -273,7 +272,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -301,7 +300,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i10.Manager { +class MockManager extends _i1.Mock implements _i9.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -391,16 +390,16 @@ class MockManager extends _i1.Mock implements _i10.Manager { ), ) as _i4.Balance); @override - _i7.Future> get transactions => (super.noSuchMethod( + _i7.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i7.Future>.value(<_i11.Transaction>[]), - ) as _i7.Future>); + _i7.Future>.value(<_i10.Transaction>[]), + ) as _i7.Future>); @override - _i7.Future> get utxos => (super.noSuchMethod( + _i7.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i7.Future>.value(<_i11.UTXO>[]), - ) as _i7.Future>); + returnValue: _i7.Future>.value(<_i10.UTXO>[]), + ) as _i7.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -450,6 +449,11 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -653,7 +657,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -661,7 +665,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/onboarding/create_pin_view_screen_test.mocks.dart b/test/screen_tests/onboarding/create_pin_view_screen_test.mocks.dart index 08aad855c..6cdbfe153 100644 --- a/test/screen_tests/onboarding/create_pin_view_screen_test.mocks.dart +++ b/test/screen_tests/onboarding/create_pin_view_screen_test.mocks.dart @@ -1,19 +1,18 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/onboarding/create_pin_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i10; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i5; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i14; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i13; import 'package:stackduo/models/models.dart' as _i4; -import 'package:stackduo/models/node_model.dart' as _i12; +import 'package:stackduo/models/node_model.dart' as _i11; import 'package:stackduo/services/coins/coin_service.dart' as _i3; -import 'package:stackduo/services/coins/manager.dart' as _i13; -import 'package:stackduo/services/node_service.dart' as _i11; +import 'package:stackduo/services/coins/manager.dart' as _i12; +import 'package:stackduo/services/node_service.dart' as _i10; import 'package:stackduo/services/wallets_service.dart' as _i7; import 'package:stackduo/utilities/amount/amount.dart' as _i6; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i9; @@ -280,7 +279,7 @@ class MockWalletsService extends _i1.Mock implements _i7.WalletsService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -288,7 +287,7 @@ class MockWalletsService extends _i1.Mock implements _i7.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -316,7 +315,7 @@ class MockWalletsService extends _i1.Mock implements _i7.WalletsService { /// A class which mocks [NodeService]. /// /// See the documentation for Mockito's code generation for more information. -class MockNodeService extends _i1.Mock implements _i11.NodeService { +class MockNodeService extends _i1.Mock implements _i10.NodeService { @override _i2.SecureStorageInterface get secureStorageInterface => (super.noSuchMethod( Invocation.getter(#secureStorageInterface), @@ -326,15 +325,15 @@ class MockNodeService extends _i1.Mock implements _i11.NodeService { ), ) as _i2.SecureStorageInterface); @override - List<_i12.NodeModel> get primaryNodes => (super.noSuchMethod( + List<_i11.NodeModel> get primaryNodes => (super.noSuchMethod( Invocation.getter(#primaryNodes), - returnValue: <_i12.NodeModel>[], - ) as List<_i12.NodeModel>); + returnValue: <_i11.NodeModel>[], + ) as List<_i11.NodeModel>); @override - List<_i12.NodeModel> get nodes => (super.noSuchMethod( + List<_i11.NodeModel> get nodes => (super.noSuchMethod( Invocation.getter(#nodes), - returnValue: <_i12.NodeModel>[], - ) as List<_i12.NodeModel>); + returnValue: <_i11.NodeModel>[], + ) as List<_i11.NodeModel>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), @@ -352,7 +351,7 @@ class MockNodeService extends _i1.Mock implements _i11.NodeService { @override _i8.Future setPrimaryNodeFor({ required _i9.Coin? coin, - required _i12.NodeModel? node, + required _i11.NodeModel? node, bool? shouldNotifyListeners = false, }) => (super.noSuchMethod( @@ -369,40 +368,40 @@ class MockNodeService extends _i1.Mock implements _i11.NodeService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - _i12.NodeModel? getPrimaryNodeFor({required _i9.Coin? coin}) => + _i11.NodeModel? getPrimaryNodeFor({required _i9.Coin? coin}) => (super.noSuchMethod(Invocation.method( #getPrimaryNodeFor, [], {#coin: coin}, - )) as _i12.NodeModel?); + )) as _i11.NodeModel?); @override - List<_i12.NodeModel> getNodesFor(_i9.Coin? coin) => (super.noSuchMethod( + List<_i11.NodeModel> getNodesFor(_i9.Coin? coin) => (super.noSuchMethod( Invocation.method( #getNodesFor, [coin], ), - returnValue: <_i12.NodeModel>[], - ) as List<_i12.NodeModel>); + returnValue: <_i11.NodeModel>[], + ) as List<_i11.NodeModel>); @override - _i12.NodeModel? getNodeById({required String? id}) => + _i11.NodeModel? getNodeById({required String? id}) => (super.noSuchMethod(Invocation.method( #getNodeById, [], {#id: id}, - )) as _i12.NodeModel?); + )) as _i11.NodeModel?); @override - List<_i12.NodeModel> failoverNodesFor({required _i9.Coin? coin}) => + List<_i11.NodeModel> failoverNodesFor({required _i9.Coin? coin}) => (super.noSuchMethod( Invocation.method( #failoverNodesFor, [], {#coin: coin}, ), - returnValue: <_i12.NodeModel>[], - ) as List<_i12.NodeModel>); + returnValue: <_i11.NodeModel>[], + ) as List<_i11.NodeModel>); @override _i8.Future add( - _i12.NodeModel? node, + _i11.NodeModel? node, String? password, bool? shouldNotifyListeners, ) => @@ -454,7 +453,7 @@ class MockNodeService extends _i1.Mock implements _i11.NodeService { ) as _i8.Future); @override _i8.Future edit( - _i12.NodeModel? editedNode, + _i11.NodeModel? editedNode, String? password, bool? shouldNotifyListeners, ) => @@ -480,7 +479,7 @@ class MockNodeService extends _i1.Mock implements _i11.NodeService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -488,7 +487,7 @@ class MockNodeService extends _i1.Mock implements _i11.NodeService { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -516,7 +515,7 @@ class MockNodeService extends _i1.Mock implements _i11.NodeService { /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i13.Manager { +class MockManager extends _i1.Mock implements _i12.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -606,16 +605,16 @@ class MockManager extends _i1.Mock implements _i13.Manager { ), ) as _i5.Balance); @override - _i8.Future> get transactions => (super.noSuchMethod( + _i8.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i8.Future>.value(<_i14.Transaction>[]), - ) as _i8.Future>); + _i8.Future>.value(<_i13.Transaction>[]), + ) as _i8.Future>); @override - _i8.Future> get utxos => (super.noSuchMethod( + _i8.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i8.Future>.value(<_i14.UTXO>[]), - ) as _i8.Future>); + returnValue: _i8.Future>.value(<_i13.UTXO>[]), + ) as _i8.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -665,6 +664,11 @@ class MockManager extends _i1.Mock implements _i13.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -868,7 +872,7 @@ class MockManager extends _i1.Mock implements _i13.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -876,7 +880,7 @@ class MockManager extends _i1.Mock implements _i13.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/onboarding/name_your_wallet_view_screen_test.mocks.dart b/test/screen_tests/onboarding/name_your_wallet_view_screen_test.mocks.dart index 841db542c..61b791b30 100644 --- a/test/screen_tests/onboarding/name_your_wallet_view_screen_test.mocks.dart +++ b/test/screen_tests/onboarding/name_your_wallet_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/onboarding/name_your_wallet_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i3; -import 'dart:ui' as _i5; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/services/wallets_service.dart' as _i2; @@ -218,7 +217,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - void addListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -226,7 +225,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/onboarding/restore_wallet_view_screen_test.mocks.dart b/test/screen_tests/onboarding/restore_wallet_view_screen_test.mocks.dart index fd1b01af8..b096c588b 100644 --- a/test/screen_tests/onboarding/restore_wallet_view_screen_test.mocks.dart +++ b/test/screen_tests/onboarding/restore_wallet_view_screen_test.mocks.dart @@ -1,20 +1,19 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/onboarding/restore_wallet_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i9; -import 'dart:ui' as _i12; import 'package:barcode_scan2/barcode_scan2.dart' as _i2; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i5; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i14; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i13; import 'package:stackduo/models/models.dart' as _i4; -import 'package:stackduo/models/node_model.dart' as _i16; +import 'package:stackduo/models/node_model.dart' as _i15; import 'package:stackduo/services/coins/coin_service.dart' as _i3; -import 'package:stackduo/services/coins/manager.dart' as _i13; -import 'package:stackduo/services/node_service.dart' as _i15; +import 'package:stackduo/services/coins/manager.dart' as _i12; +import 'package:stackduo/services/node_service.dart' as _i14; import 'package:stackduo/services/wallets_service.dart' as _i10; import 'package:stackduo/utilities/amount/amount.dart' as _i6; import 'package:stackduo/utilities/barcode_scanner_interface.dart' as _i8; @@ -321,7 +320,7 @@ class MockWalletsService extends _i1.Mock implements _i10.WalletsService { returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - void addListener(_i12.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -329,7 +328,7 @@ class MockWalletsService extends _i1.Mock implements _i10.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i12.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -357,7 +356,7 @@ class MockWalletsService extends _i1.Mock implements _i10.WalletsService { /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i13.Manager { +class MockManager extends _i1.Mock implements _i12.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -447,16 +446,16 @@ class MockManager extends _i1.Mock implements _i13.Manager { ), ) as _i5.Balance); @override - _i9.Future> get transactions => (super.noSuchMethod( + _i9.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i9.Future>.value(<_i14.Transaction>[]), - ) as _i9.Future>); + _i9.Future>.value(<_i13.Transaction>[]), + ) as _i9.Future>); @override - _i9.Future> get utxos => (super.noSuchMethod( + _i9.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i9.Future>.value(<_i14.UTXO>[]), - ) as _i9.Future>); + returnValue: _i9.Future>.value(<_i13.UTXO>[]), + ) as _i9.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -506,6 +505,11 @@ class MockManager extends _i1.Mock implements _i13.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -709,7 +713,7 @@ class MockManager extends _i1.Mock implements _i13.Manager { returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - void addListener(_i12.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -717,7 +721,7 @@ class MockManager extends _i1.Mock implements _i13.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i12.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -737,7 +741,7 @@ class MockManager extends _i1.Mock implements _i13.Manager { /// A class which mocks [NodeService]. /// /// See the documentation for Mockito's code generation for more information. -class MockNodeService extends _i1.Mock implements _i15.NodeService { +class MockNodeService extends _i1.Mock implements _i14.NodeService { @override _i7.SecureStorageInterface get secureStorageInterface => (super.noSuchMethod( Invocation.getter(#secureStorageInterface), @@ -747,15 +751,15 @@ class MockNodeService extends _i1.Mock implements _i15.NodeService { ), ) as _i7.SecureStorageInterface); @override - List<_i16.NodeModel> get primaryNodes => (super.noSuchMethod( + List<_i15.NodeModel> get primaryNodes => (super.noSuchMethod( Invocation.getter(#primaryNodes), - returnValue: <_i16.NodeModel>[], - ) as List<_i16.NodeModel>); + returnValue: <_i15.NodeModel>[], + ) as List<_i15.NodeModel>); @override - List<_i16.NodeModel> get nodes => (super.noSuchMethod( + List<_i15.NodeModel> get nodes => (super.noSuchMethod( Invocation.getter(#nodes), - returnValue: <_i16.NodeModel>[], - ) as List<_i16.NodeModel>); + returnValue: <_i15.NodeModel>[], + ) as List<_i15.NodeModel>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), @@ -773,7 +777,7 @@ class MockNodeService extends _i1.Mock implements _i15.NodeService { @override _i9.Future setPrimaryNodeFor({ required _i11.Coin? coin, - required _i16.NodeModel? node, + required _i15.NodeModel? node, bool? shouldNotifyListeners = false, }) => (super.noSuchMethod( @@ -790,40 +794,40 @@ class MockNodeService extends _i1.Mock implements _i15.NodeService { returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - _i16.NodeModel? getPrimaryNodeFor({required _i11.Coin? coin}) => + _i15.NodeModel? getPrimaryNodeFor({required _i11.Coin? coin}) => (super.noSuchMethod(Invocation.method( #getPrimaryNodeFor, [], {#coin: coin}, - )) as _i16.NodeModel?); + )) as _i15.NodeModel?); @override - List<_i16.NodeModel> getNodesFor(_i11.Coin? coin) => (super.noSuchMethod( + List<_i15.NodeModel> getNodesFor(_i11.Coin? coin) => (super.noSuchMethod( Invocation.method( #getNodesFor, [coin], ), - returnValue: <_i16.NodeModel>[], - ) as List<_i16.NodeModel>); + returnValue: <_i15.NodeModel>[], + ) as List<_i15.NodeModel>); @override - _i16.NodeModel? getNodeById({required String? id}) => + _i15.NodeModel? getNodeById({required String? id}) => (super.noSuchMethod(Invocation.method( #getNodeById, [], {#id: id}, - )) as _i16.NodeModel?); + )) as _i15.NodeModel?); @override - List<_i16.NodeModel> failoverNodesFor({required _i11.Coin? coin}) => + List<_i15.NodeModel> failoverNodesFor({required _i11.Coin? coin}) => (super.noSuchMethod( Invocation.method( #failoverNodesFor, [], {#coin: coin}, ), - returnValue: <_i16.NodeModel>[], - ) as List<_i16.NodeModel>); + returnValue: <_i15.NodeModel>[], + ) as List<_i15.NodeModel>); @override _i9.Future add( - _i16.NodeModel? node, + _i15.NodeModel? node, String? password, bool? shouldNotifyListeners, ) => @@ -875,7 +879,7 @@ class MockNodeService extends _i1.Mock implements _i15.NodeService { ) as _i9.Future); @override _i9.Future edit( - _i16.NodeModel? editedNode, + _i15.NodeModel? editedNode, String? password, bool? shouldNotifyListeners, ) => @@ -901,7 +905,7 @@ class MockNodeService extends _i1.Mock implements _i15.NodeService { returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - void addListener(_i12.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -909,7 +913,7 @@ class MockNodeService extends _i1.Mock implements _i15.NodeService { returnValueForMissingStub: null, ); @override - void removeListener(_i12.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/onboarding/verify_backup_key_view_screen_test.mocks.dart b/test/screen_tests/onboarding/verify_backup_key_view_screen_test.mocks.dart index 0543f8e19..8c829f1fd 100644 --- a/test/screen_tests/onboarding/verify_backup_key_view_screen_test.mocks.dart +++ b/test/screen_tests/onboarding/verify_backup_key_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/onboarding/verify_backup_key_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i10; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; @@ -219,6 +218,11 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -422,7 +426,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -430,7 +434,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/settings_view/settings_subviews/currency_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_subviews/currency_view_screen_test.mocks.dart index f336f7484..ff11120ac 100644 --- a/test/screen_tests/settings_view/settings_subviews/currency_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_subviews/currency_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/settings_view/settings_subviews/currency_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i10; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; @@ -219,6 +218,11 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -422,7 +426,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -430,7 +434,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/add_custom_node_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/add_custom_node_view_screen_test.mocks.dart index 57ce3c89c..74eae8db6 100644 --- a/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/add_custom_node_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/add_custom_node_view_screen_test.mocks.dart @@ -1,18 +1,17 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/add_custom_node_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i9; -import 'dart:ui' as _i11; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i5; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i13; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i12; import 'package:stackduo/models/models.dart' as _i4; import 'package:stackduo/models/node_model.dart' as _i8; import 'package:stackduo/services/coins/coin_service.dart' as _i3; -import 'package:stackduo/services/coins/manager.dart' as _i12; +import 'package:stackduo/services/coins/manager.dart' as _i11; import 'package:stackduo/services/node_service.dart' as _i7; import 'package:stackduo/utilities/amount/amount.dart' as _i6; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i10; @@ -249,7 +248,7 @@ class MockNodeService extends _i1.Mock implements _i7.NodeService { returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - void addListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -257,7 +256,7 @@ class MockNodeService extends _i1.Mock implements _i7.NodeService { returnValueForMissingStub: null, ); @override - void removeListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -285,7 +284,7 @@ class MockNodeService extends _i1.Mock implements _i7.NodeService { /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i12.Manager { +class MockManager extends _i1.Mock implements _i11.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -375,16 +374,16 @@ class MockManager extends _i1.Mock implements _i12.Manager { ), ) as _i5.Balance); @override - _i9.Future> get transactions => (super.noSuchMethod( + _i9.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i9.Future>.value(<_i13.Transaction>[]), - ) as _i9.Future>); + _i9.Future>.value(<_i12.Transaction>[]), + ) as _i9.Future>); @override - _i9.Future> get utxos => (super.noSuchMethod( + _i9.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i9.Future>.value(<_i13.UTXO>[]), - ) as _i9.Future>); + returnValue: _i9.Future>.value(<_i12.UTXO>[]), + ) as _i9.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -434,6 +433,11 @@ class MockManager extends _i1.Mock implements _i12.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -637,7 +641,7 @@ class MockManager extends _i1.Mock implements _i12.Manager { returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - void addListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -645,7 +649,7 @@ class MockManager extends _i1.Mock implements _i12.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/node_details_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/node_details_view_screen_test.mocks.dart index b26913fc5..da3575947 100644 --- a/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/node_details_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/node_details_view_screen_test.mocks.dart @@ -1,18 +1,17 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/settings_view/settings_subviews/network_settings_subviews/node_details_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i9; -import 'dart:ui' as _i11; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i5; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i13; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i12; import 'package:stackduo/models/models.dart' as _i4; import 'package:stackduo/models/node_model.dart' as _i8; import 'package:stackduo/services/coins/coin_service.dart' as _i3; -import 'package:stackduo/services/coins/manager.dart' as _i12; +import 'package:stackduo/services/coins/manager.dart' as _i11; import 'package:stackduo/services/node_service.dart' as _i7; import 'package:stackduo/utilities/amount/amount.dart' as _i6; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i10; @@ -249,7 +248,7 @@ class MockNodeService extends _i1.Mock implements _i7.NodeService { returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - void addListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -257,7 +256,7 @@ class MockNodeService extends _i1.Mock implements _i7.NodeService { returnValueForMissingStub: null, ); @override - void removeListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -285,7 +284,7 @@ class MockNodeService extends _i1.Mock implements _i7.NodeService { /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i12.Manager { +class MockManager extends _i1.Mock implements _i11.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -375,16 +374,16 @@ class MockManager extends _i1.Mock implements _i12.Manager { ), ) as _i5.Balance); @override - _i9.Future> get transactions => (super.noSuchMethod( + _i9.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i9.Future>.value(<_i13.Transaction>[]), - ) as _i9.Future>); + _i9.Future>.value(<_i12.Transaction>[]), + ) as _i9.Future>); @override - _i9.Future> get utxos => (super.noSuchMethod( + _i9.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i9.Future>.value(<_i13.UTXO>[]), - ) as _i9.Future>); + returnValue: _i9.Future>.value(<_i12.UTXO>[]), + ) as _i9.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -434,6 +433,11 @@ class MockManager extends _i1.Mock implements _i12.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -637,7 +641,7 @@ class MockManager extends _i1.Mock implements _i12.Manager { returnValueForMissingStub: _i9.Future.value(), ) as _i9.Future); @override - void addListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -645,7 +649,7 @@ class MockManager extends _i1.Mock implements _i12.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i11.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/settings_view/settings_subviews/network_settings_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_subviews/network_settings_view_screen_test.mocks.dart index 84bef5546..a2fb14c5d 100644 --- a/test/screen_tests/settings_view/settings_subviews/network_settings_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_subviews/network_settings_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/settings_view/settings_subviews/network_settings_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i5; -import 'dart:ui' as _i7; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/node_model.dart' as _i4; @@ -202,7 +201,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override - void addListener(_i7.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -210,7 +209,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: null, ); @override - void removeListener(_i7.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/settings_view/settings_subviews/wallet_backup_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_subviews/wallet_backup_view_screen_test.mocks.dart index f003f64a3..12447d37a 100644 --- a/test/screen_tests/settings_view/settings_subviews/wallet_backup_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_subviews/wallet_backup_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/settings_view/settings_subviews/wallet_backup_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i10; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; @@ -219,6 +218,11 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -422,7 +426,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -430,7 +434,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/change_pin_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/change_pin_view_screen_test.mocks.dart index 4ee0bcfc5..f4cb358fa 100644 --- a/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/change_pin_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/change_pin_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/change_pin_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i3; -import 'dart:ui' as _i5; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/services/wallets_service.dart' as _i2; @@ -218,7 +217,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - void addListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -226,7 +225,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rename_wallet_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rename_wallet_view_screen_test.mocks.dart index 995809892..eb1987bd7 100644 --- a/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rename_wallet_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rename_wallet_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rename_wallet_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i3; -import 'dart:ui' as _i5; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/services/wallets_service.dart' as _i2; @@ -218,7 +217,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { returnValueForMissingStub: _i3.Future.value(), ) as _i3.Future); @override - void addListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -226,7 +225,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rescan_warning_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rescan_warning_view_screen_test.mocks.dart index 2c8a3e794..c32ecedb4 100644 --- a/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rescan_warning_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rescan_warning_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/rescan_warning_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i10; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; @@ -219,6 +218,11 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -422,7 +426,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -430,7 +434,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/wallet_delete_mnemonic_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/wallet_delete_mnemonic_view_screen_test.mocks.dart index f4c82b201..1e9ebd946 100644 --- a/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/wallet_delete_mnemonic_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/wallet_delete_mnemonic_view_screen_test.mocks.dart @@ -1,17 +1,16 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/settings_view/settings_subviews/wallet_settings_subviews/wallet_delete_mnemonic_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i7; -import 'dart:ui' as _i9; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i11; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i10; import 'package:stackduo/models/models.dart' as _i3; import 'package:stackduo/services/coins/coin_service.dart' as _i2; -import 'package:stackduo/services/coins/manager.dart' as _i10; +import 'package:stackduo/services/coins/manager.dart' as _i9; import 'package:stackduo/services/wallets_service.dart' as _i6; import 'package:stackduo/utilities/amount/amount.dart' as _i5; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i8; @@ -265,7 +264,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -273,7 +272,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -301,7 +300,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i10.Manager { +class MockManager extends _i1.Mock implements _i9.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -391,16 +390,16 @@ class MockManager extends _i1.Mock implements _i10.Manager { ), ) as _i4.Balance); @override - _i7.Future> get transactions => (super.noSuchMethod( + _i7.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i7.Future>.value(<_i11.Transaction>[]), - ) as _i7.Future>); + _i7.Future>.value(<_i10.Transaction>[]), + ) as _i7.Future>); @override - _i7.Future> get utxos => (super.noSuchMethod( + _i7.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i7.Future>.value(<_i11.UTXO>[]), - ) as _i7.Future>); + returnValue: _i7.Future>.value(<_i10.UTXO>[]), + ) as _i7.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -450,6 +449,11 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -653,7 +657,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -661,7 +665,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/settings_view/settings_subviews/wallet_settings_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_subviews/wallet_settings_view_screen_test.mocks.dart index df8c7958c..76cc99835 100644 --- a/test/screen_tests/settings_view/settings_subviews/wallet_settings_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_subviews/wallet_settings_view_screen_test.mocks.dart @@ -1,25 +1,24 @@ -// Mocks generated by Mockito 5.3.2 from annotations -// in stackwallet/test/screen_tests/settings_view/settings_subviews/wallet_settings_view_screen_test.dart. +// Mocks generated by Mockito 5.4.2 from annotations +// in stackduo/test/screen_tests/settings_view/settings_subviews/wallet_settings_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i14; import 'package:local_auth/auth_strings.dart' as _i11; import 'package:local_auth/local_auth.dart' as _i10; import 'package:mockito/mockito.dart' as _i1; -import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i7; -import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i2; -import 'package:stackwallet/models/balance.dart' as _i5; -import 'package:stackwallet/models/isar/models/isar_models.dart' as _i16; -import 'package:stackwallet/models/models.dart' as _i4; -import 'package:stackwallet/services/coins/coin_service.dart' as _i3; -import 'package:stackwallet/services/coins/manager.dart' as _i15; -import 'package:stackwallet/services/wallets_service.dart' as _i13; -import 'package:stackwallet/utilities/amount/amount.dart' as _i6; -import 'package:stackwallet/utilities/biometrics.dart' as _i12; -import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i9; +import 'package:stackduo/electrumx_rpc/cached_electrumx.dart' as _i7; +import 'package:stackduo/electrumx_rpc/electrumx.dart' as _i2; +import 'package:stackduo/models/balance.dart' as _i5; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i15; +import 'package:stackduo/models/models.dart' as _i4; +import 'package:stackduo/services/coins/coin_service.dart' as _i3; +import 'package:stackduo/services/coins/manager.dart' as _i14; +import 'package:stackduo/services/wallets_service.dart' as _i13; +import 'package:stackduo/utilities/amount/amount.dart' as _i6; +import 'package:stackduo/utilities/biometrics.dart' as _i12; +import 'package:stackduo/utilities/enums/coin_enum.dart' as _i9; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -501,7 +500,7 @@ class MockWalletsService extends _i1.Mock implements _i13.WalletsService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i14.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -509,7 +508,7 @@ class MockWalletsService extends _i1.Mock implements _i13.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i14.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -537,7 +536,7 @@ class MockWalletsService extends _i1.Mock implements _i13.WalletsService { /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i15.Manager { +class MockManager extends _i1.Mock implements _i14.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -627,16 +626,16 @@ class MockManager extends _i1.Mock implements _i15.Manager { ), ) as _i5.Balance); @override - _i8.Future> get transactions => (super.noSuchMethod( + _i8.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i8.Future>.value(<_i16.Transaction>[]), - ) as _i8.Future>); + _i8.Future>.value(<_i15.Transaction>[]), + ) as _i8.Future>); @override - _i8.Future> get utxos => (super.noSuchMethod( + _i8.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i8.Future>.value(<_i16.UTXO>[]), - ) as _i8.Future>); + returnValue: _i8.Future>.value(<_i15.UTXO>[]), + ) as _i8.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -894,7 +893,7 @@ class MockManager extends _i1.Mock implements _i15.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i14.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -902,7 +901,7 @@ class MockManager extends _i1.Mock implements _i15.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i14.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/settings_view/settings_view_screen_test.mocks.dart b/test/screen_tests/settings_view/settings_view_screen_test.mocks.dart index 9adc92a2c..3a2cbf82d 100644 --- a/test/screen_tests/settings_view/settings_view_screen_test.mocks.dart +++ b/test/screen_tests/settings_view/settings_view_screen_test.mocks.dart @@ -1,17 +1,16 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/settings_view/settings_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i7; -import 'dart:ui' as _i9; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; -import 'package:stackduo/models/isar/models/isar_models.dart' as _i11; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i10; import 'package:stackduo/models/models.dart' as _i3; import 'package:stackduo/services/coins/coin_service.dart' as _i2; -import 'package:stackduo/services/coins/manager.dart' as _i10; +import 'package:stackduo/services/coins/manager.dart' as _i9; import 'package:stackduo/services/wallets_service.dart' as _i6; import 'package:stackduo/utilities/amount/amount.dart' as _i5; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i8; @@ -265,7 +264,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -273,7 +272,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -301,7 +300,7 @@ class MockWalletsService extends _i1.Mock implements _i6.WalletsService { /// A class which mocks [Manager]. /// /// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i10.Manager { +class MockManager extends _i1.Mock implements _i9.Manager { @override bool get isActiveWallet => (super.noSuchMethod( Invocation.getter(#isActiveWallet), @@ -391,16 +390,16 @@ class MockManager extends _i1.Mock implements _i10.Manager { ), ) as _i4.Balance); @override - _i7.Future> get transactions => (super.noSuchMethod( + _i7.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), returnValue: - _i7.Future>.value(<_i11.Transaction>[]), - ) as _i7.Future>); + _i7.Future>.value(<_i10.Transaction>[]), + ) as _i7.Future>); @override - _i7.Future> get utxos => (super.noSuchMethod( + _i7.Future> get utxos => (super.noSuchMethod( Invocation.getter(#utxos), - returnValue: _i7.Future>.value(<_i11.UTXO>[]), - ) as _i7.Future>); + returnValue: _i7.Future>.value(<_i10.UTXO>[]), + ) as _i7.Future>); @override set walletName(String? newName) => super.noSuchMethod( Invocation.setter( @@ -450,6 +449,11 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -653,7 +657,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: _i7.Future.value(), ) as _i7.Future); @override - void addListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -661,7 +665,7 @@ class MockManager extends _i1.Mock implements _i10.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i9.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/transaction_subviews/transaction_details_view_screen_test.mocks.dart b/test/screen_tests/transaction_subviews/transaction_details_view_screen_test.mocks.dart index 22a63e60a..c67bf0e5e 100644 --- a/test/screen_tests/transaction_subviews/transaction_details_view_screen_test.mocks.dart +++ b/test/screen_tests/transaction_subviews/transaction_details_view_screen_test.mocks.dart @@ -1,15 +1,14 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/transaction_subviews/transaction_details_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i4; -import 'dart:ui' as _i5; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/isar/models/contact_entry.dart' as _i2; -import 'package:stackduo/services/address_book_service.dart' as _i6; -import 'package:stackduo/services/locale_service.dart' as _i7; +import 'package:stackduo/services/address_book_service.dart' as _i5; +import 'package:stackduo/services/locale_service.dart' as _i6; import 'package:stackduo/services/notes_service.dart' as _i3; // ignore_for_file: type=lint @@ -102,7 +101,7 @@ class MockNotesService extends _i1.Mock implements _i3.NotesService { returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - void addListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -110,7 +109,7 @@ class MockNotesService extends _i1.Mock implements _i3.NotesService { returnValueForMissingStub: null, ); @override - void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -139,7 +138,7 @@ class MockNotesService extends _i1.Mock implements _i3.NotesService { /// /// See the documentation for Mockito's code generation for more information. class MockAddressBookService extends _i1.Mock - implements _i6.AddressBookService { + implements _i5.AddressBookService { @override List<_i2.ContactEntry> get contacts => (super.noSuchMethod( Invocation.getter(#contacts), @@ -216,7 +215,7 @@ class MockAddressBookService extends _i1.Mock returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - void addListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -224,7 +223,7 @@ class MockAddressBookService extends _i1.Mock returnValueForMissingStub: null, ); @override - void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -252,7 +251,7 @@ class MockAddressBookService extends _i1.Mock /// A class which mocks [LocaleService]. /// /// See the documentation for Mockito's code generation for more information. -class MockLocaleService extends _i1.Mock implements _i7.LocaleService { +class MockLocaleService extends _i1.Mock implements _i6.LocaleService { @override String get locale => (super.noSuchMethod( Invocation.getter(#locale), @@ -274,7 +273,7 @@ class MockLocaleService extends _i1.Mock implements _i7.LocaleService { returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - void addListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -282,7 +281,7 @@ class MockLocaleService extends _i1.Mock implements _i7.LocaleService { returnValueForMissingStub: null, ); @override - void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/transaction_subviews/transaction_search_results_view_screen_test.mocks.dart b/test/screen_tests/transaction_subviews/transaction_search_results_view_screen_test.mocks.dart index 865675c14..ab5382202 100644 --- a/test/screen_tests/transaction_subviews/transaction_search_results_view_screen_test.mocks.dart +++ b/test/screen_tests/transaction_subviews/transaction_search_results_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/transaction_subviews/transaction_search_results_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i10; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; @@ -12,8 +11,8 @@ import 'package:stackduo/models/isar/models/isar_models.dart' as _i9; import 'package:stackduo/models/models.dart' as _i3; import 'package:stackduo/services/coins/coin_service.dart' as _i2; import 'package:stackduo/services/coins/manager.dart' as _i6; -import 'package:stackduo/services/locale_service.dart' as _i12; -import 'package:stackduo/services/notes_service.dart' as _i11; +import 'package:stackduo/services/locale_service.dart' as _i11; +import 'package:stackduo/services/notes_service.dart' as _i10; import 'package:stackduo/utilities/amount/amount.dart' as _i5; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i7; @@ -221,6 +220,11 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -424,7 +428,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -432,7 +436,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -452,7 +456,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { /// A class which mocks [NotesService]. /// /// See the documentation for Mockito's code generation for more information. -class MockNotesService extends _i1.Mock implements _i11.NotesService { +class MockNotesService extends _i1.Mock implements _i10.NotesService { @override String get walletId => (super.noSuchMethod( Invocation.getter(#walletId), @@ -518,7 +522,7 @@ class MockNotesService extends _i1.Mock implements _i11.NotesService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -526,7 +530,7 @@ class MockNotesService extends _i1.Mock implements _i11.NotesService { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -554,7 +558,7 @@ class MockNotesService extends _i1.Mock implements _i11.NotesService { /// A class which mocks [LocaleService]. /// /// See the documentation for Mockito's code generation for more information. -class MockLocaleService extends _i1.Mock implements _i12.LocaleService { +class MockLocaleService extends _i1.Mock implements _i11.LocaleService { @override String get locale => (super.noSuchMethod( Invocation.getter(#locale), @@ -576,7 +580,7 @@ class MockLocaleService extends _i1.Mock implements _i12.LocaleService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -584,7 +588,7 @@ class MockLocaleService extends _i1.Mock implements _i12.LocaleService { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/transaction_subviews/transaction_search_view_screen_test.mocks.dart b/test/screen_tests/transaction_subviews/transaction_search_view_screen_test.mocks.dart index 0b8520813..2cbcd57fe 100644 --- a/test/screen_tests/transaction_subviews/transaction_search_view_screen_test.mocks.dart +++ b/test/screen_tests/transaction_subviews/transaction_search_view_screen_test.mocks.dart @@ -1,15 +1,14 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/transaction_subviews/transaction_search_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i4; -import 'dart:ui' as _i5; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/isar/models/contact_entry.dart' as _i2; import 'package:stackduo/services/address_book_service.dart' as _i3; -import 'package:stackduo/services/notes_service.dart' as _i6; +import 'package:stackduo/services/notes_service.dart' as _i5; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values @@ -113,7 +112,7 @@ class MockAddressBookService extends _i1.Mock returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - void addListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -121,7 +120,7 @@ class MockAddressBookService extends _i1.Mock returnValueForMissingStub: null, ); @override - void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -149,7 +148,7 @@ class MockAddressBookService extends _i1.Mock /// A class which mocks [NotesService]. /// /// See the documentation for Mockito's code generation for more information. -class MockNotesService extends _i1.Mock implements _i6.NotesService { +class MockNotesService extends _i1.Mock implements _i5.NotesService { @override String get walletId => (super.noSuchMethod( Invocation.getter(#walletId), @@ -215,7 +214,7 @@ class MockNotesService extends _i1.Mock implements _i6.NotesService { returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - void addListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -223,7 +222,7 @@ class MockNotesService extends _i1.Mock implements _i6.NotesService { returnValueForMissingStub: null, ); @override - void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/wallet_view/confirm_send_view_screen_test.mocks.dart b/test/screen_tests/wallet_view/confirm_send_view_screen_test.mocks.dart index 08d1ce9dd..5b874e20b 100644 --- a/test/screen_tests/wallet_view/confirm_send_view_screen_test.mocks.dart +++ b/test/screen_tests/wallet_view/confirm_send_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/wallet_view/confirm_send_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i10; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; @@ -12,7 +11,7 @@ import 'package:stackduo/models/isar/models/isar_models.dart' as _i9; import 'package:stackduo/models/models.dart' as _i3; import 'package:stackduo/services/coins/coin_service.dart' as _i2; import 'package:stackduo/services/coins/manager.dart' as _i6; -import 'package:stackduo/services/notes_service.dart' as _i11; +import 'package:stackduo/services/notes_service.dart' as _i10; import 'package:stackduo/utilities/amount/amount.dart' as _i5; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i7; @@ -220,6 +219,11 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -423,7 +427,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -431,7 +435,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -451,7 +455,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { /// A class which mocks [NotesService]. /// /// See the documentation for Mockito's code generation for more information. -class MockNotesService extends _i1.Mock implements _i11.NotesService { +class MockNotesService extends _i1.Mock implements _i10.NotesService { @override String get walletId => (super.noSuchMethod( Invocation.getter(#walletId), @@ -517,7 +521,7 @@ class MockNotesService extends _i1.Mock implements _i11.NotesService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -525,7 +529,7 @@ class MockNotesService extends _i1.Mock implements _i11.NotesService { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/wallet_view/receive_view_screen_test.mocks.dart b/test/screen_tests/wallet_view/receive_view_screen_test.mocks.dart index 91c7e023c..5a7116c68 100644 --- a/test/screen_tests/wallet_view/receive_view_screen_test.mocks.dart +++ b/test/screen_tests/wallet_view/receive_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/wallet_view/receive_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i10; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; @@ -219,6 +218,11 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -422,7 +426,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -430,7 +434,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/wallet_view/send_view_screen_test.mocks.dart b/test/screen_tests/wallet_view/send_view_screen_test.mocks.dart index f6d4d33df..d62512015 100644 --- a/test/screen_tests/wallet_view/send_view_screen_test.mocks.dart +++ b/test/screen_tests/wallet_view/send_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/wallet_view/send_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i12; import 'package:barcode_scan2/barcode_scan2.dart' as _i2; import 'package:mockito/mockito.dart' as _i1; @@ -13,7 +12,7 @@ import 'package:stackduo/models/isar/models/isar_models.dart' as _i11; import 'package:stackduo/models/models.dart' as _i4; import 'package:stackduo/services/coins/coin_service.dart' as _i3; import 'package:stackduo/services/coins/manager.dart' as _i9; -import 'package:stackduo/services/notes_service.dart' as _i13; +import 'package:stackduo/services/notes_service.dart' as _i12; import 'package:stackduo/utilities/amount/amount.dart' as _i6; import 'package:stackduo/utilities/barcode_scanner_interface.dart' as _i7; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i10; @@ -261,6 +260,11 @@ class MockManager extends _i1.Mock implements _i9.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -464,7 +468,7 @@ class MockManager extends _i1.Mock implements _i9.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i12.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -472,7 +476,7 @@ class MockManager extends _i1.Mock implements _i9.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i12.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -492,7 +496,7 @@ class MockManager extends _i1.Mock implements _i9.Manager { /// A class which mocks [NotesService]. /// /// See the documentation for Mockito's code generation for more information. -class MockNotesService extends _i1.Mock implements _i13.NotesService { +class MockNotesService extends _i1.Mock implements _i12.NotesService { @override String get walletId => (super.noSuchMethod( Invocation.getter(#walletId), @@ -558,7 +562,7 @@ class MockNotesService extends _i1.Mock implements _i13.NotesService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i12.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -566,7 +570,7 @@ class MockNotesService extends _i1.Mock implements _i13.NotesService { returnValueForMissingStub: null, ); @override - void removeListener(_i12.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/screen_tests/wallet_view/wallet_view_screen_test.mocks.dart b/test/screen_tests/wallet_view/wallet_view_screen_test.mocks.dart index f097be991..6ccae9c67 100644 --- a/test/screen_tests/wallet_view/wallet_view_screen_test.mocks.dart +++ b/test/screen_tests/wallet_view/wallet_view_screen_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/screen_tests/wallet_view/wallet_view_screen_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i8; -import 'dart:ui' as _i10; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/balance.dart' as _i4; @@ -12,8 +11,8 @@ import 'package:stackduo/models/isar/models/isar_models.dart' as _i9; import 'package:stackduo/models/models.dart' as _i3; import 'package:stackduo/services/coins/coin_service.dart' as _i2; import 'package:stackduo/services/coins/manager.dart' as _i6; -import 'package:stackduo/services/locale_service.dart' as _i12; -import 'package:stackduo/services/notes_service.dart' as _i11; +import 'package:stackduo/services/locale_service.dart' as _i11; +import 'package:stackduo/services/notes_service.dart' as _i10; import 'package:stackduo/utilities/amount/amount.dart' as _i5; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i7; @@ -221,6 +220,11 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -424,7 +428,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -432,7 +436,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -452,7 +456,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { /// A class which mocks [NotesService]. /// /// See the documentation for Mockito's code generation for more information. -class MockNotesService extends _i1.Mock implements _i11.NotesService { +class MockNotesService extends _i1.Mock implements _i10.NotesService { @override String get walletId => (super.noSuchMethod( Invocation.getter(#walletId), @@ -518,7 +522,7 @@ class MockNotesService extends _i1.Mock implements _i11.NotesService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -526,7 +530,7 @@ class MockNotesService extends _i1.Mock implements _i11.NotesService { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -554,7 +558,7 @@ class MockNotesService extends _i1.Mock implements _i11.NotesService { /// A class which mocks [LocaleService]. /// /// See the documentation for Mockito's code generation for more information. -class MockLocaleService extends _i1.Mock implements _i12.LocaleService { +class MockLocaleService extends _i1.Mock implements _i11.LocaleService { @override String get locale => (super.noSuchMethod( Invocation.getter(#locale), @@ -576,7 +580,7 @@ class MockLocaleService extends _i1.Mock implements _i12.LocaleService { returnValueForMissingStub: _i8.Future.value(), ) as _i8.Future); @override - void addListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -584,7 +588,7 @@ class MockLocaleService extends _i1.Mock implements _i12.LocaleService { returnValueForMissingStub: null, ); @override - void removeListener(_i10.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/services/change_now/change_now_test.mocks.dart b/test/services/change_now/change_now_test.mocks.dart index 9251ea6eb..ac466dff9 100644 --- a/test/services/change_now/change_now_test.mocks.dart +++ b/test/services/change_now/change_now_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/services/change_now/change_now_test.dart. // Do not manually edit this file. diff --git a/test/services/coins/bitcoin/bitcoin_wallet_test.mocks.dart b/test/services/coins/bitcoin/bitcoin_wallet_test.mocks.dart index f88574029..36bed59f4 100644 --- a/test/services/coins/bitcoin/bitcoin_wallet_test.mocks.dart +++ b/test/services/coins/bitcoin/bitcoin_wallet_test.mocks.dart @@ -1,5 +1,5 @@ -// Mocks generated by Mockito 5.3.2 from annotations -// in stackwallet/test/services/coins/bitcoin/bitcoin_wallet_test.dart. +// Mocks generated by Mockito 5.4.2 from annotations +// in stackduo/test/services/coins/bitcoin/bitcoin_wallet_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes @@ -7,11 +7,10 @@ import 'dart:async' as _i4; import 'package:decimal/decimal.dart' as _i2; import 'package:mockito/mockito.dart' as _i1; -import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i5; -import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i3; -import 'package:stackwallet/services/transaction_notification_tracker.dart' - as _i7; -import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i6; +import 'package:stackduo/electrumx_rpc/cached_electrumx.dart' as _i5; +import 'package:stackduo/electrumx_rpc/electrumx.dart' as _i3; +import 'package:stackduo/services/transaction_notification_tracker.dart' as _i7; +import 'package:stackduo/utilities/enums/coin_enum.dart' as _i6; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values diff --git a/test/services/coins/manager_test.dart b/test/services/coins/manager_test.dart index fcc246882..ffabd3916 100644 --- a/test/services/coins/manager_test.dart +++ b/test/services/coins/manager_test.dart @@ -1,352 +1,352 @@ -import 'package:decimal/decimal.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:mockito/annotations.dart'; -import 'package:mockito/mockito.dart'; -import 'package:stackwallet/electrumx_rpc/electrumx.dart'; -import 'package:stackwallet/models/balance.dart'; -import 'package:stackwallet/models/isar/models/isar_models.dart'; -import 'package:stackwallet/models/paymint/fee_object_model.dart'; -import 'package:stackwallet/services/coins/coin_service.dart'; -import 'package:stackwallet/services/coins/firo/firo_wallet.dart'; -import 'package:stackwallet/services/coins/manager.dart'; -import 'package:stackwallet/utilities/amount/amount.dart'; -import 'package:stackwallet/utilities/enums/coin_enum.dart'; - -import 'manager_test.mocks.dart'; - -/// quick amount constructor wrapper. Using an int is bad practice but for -/// testing with small amounts this should be fine -Amount _a(int i) => Amount.fromDecimal( - Decimal.fromInt(i), - fractionDigits: 8, - ); - -@GenerateMocks([FiroWallet, ElectrumX]) -void main() { - test("Manager should have a backgroundRefreshListener on initialization", () { - final manager = Manager(MockFiroWallet()); - - expect(manager.hasBackgroundRefreshListener, true); - }); - - test("get coin", () { - final CoinServiceAPI wallet = MockFiroWallet(); - when(wallet.coin).thenAnswer((_) => Coin.firo); - final manager = Manager(wallet); - - expect(manager.coin, Coin.firo); - }); - - test("fees", () async { - final CoinServiceAPI wallet = MockFiroWallet(); - when(wallet.fees).thenAnswer((_) async => FeeObject( - fast: 10, - medium: 5, - slow: 1, - numberOfBlocksFast: 4, - numberOfBlocksSlow: 2, - numberOfBlocksAverage: 3)); - - final manager = Manager(wallet); - - final feeObject = await manager.fees; - - expect(feeObject.fast, 10); - expect(feeObject.medium, 5); - expect(feeObject.slow, 1); - expect(feeObject.numberOfBlocksFast, 4); - expect(feeObject.numberOfBlocksAverage, 3); - expect(feeObject.numberOfBlocksSlow, 2); - }); - - test("maxFee", () async { - final CoinServiceAPI wallet = MockFiroWallet(); - when(wallet.maxFee).thenAnswer((_) async => 10); - - final manager = Manager(wallet); - - final fee = await manager.maxFee; - - expect(fee, 10); - }); - - test("get currentReceivingAddress", () async { - final CoinServiceAPI wallet = MockFiroWallet(); - when(wallet.currentReceivingAddress) - .thenAnswer((_) async => "Some address string"); - - final manager = Manager(wallet); - - expect(await manager.currentReceivingAddress, "Some address string"); - }); - - group("get balances", () { - test("balance", () async { - final CoinServiceAPI wallet = MockFiroWallet(); - final balance = Balance( - total: _a(10), - spendable: _a(1), - blockedTotal: _a(0), - pendingSpendable: _a(9), - ); - - when(wallet.coin).thenAnswer((_) => Coin.firo); - when(wallet.balance).thenAnswer( - (_) => balance, - ); - - final manager = Manager(wallet); - - expect(manager.balance, balance); - }); - }); - - test("transactions", () async { - final CoinServiceAPI wallet = MockFiroWallet(); - - when(wallet.coin).thenAnswer((realInvocation) => Coin.firo); - - final tx = Transaction( - walletId: "walletId", - txid: "txid", - timestamp: 6, - type: TransactionType.incoming, - subType: TransactionSubType.mint, - amount: 123, - amountString: Amount( - rawValue: BigInt.from(123), - fractionDigits: wallet.coin.decimals, - ).toJsonString(), - fee: 3, - height: 123, - isCancelled: false, - isLelantus: true, - slateId: null, - otherData: null, - nonce: null, - inputs: [], - outputs: [], - numberOfMessages: null, - ); - when(wallet.transactions).thenAnswer((_) async => [ - tx, - ]); - - final manager = Manager(wallet); - - final result = await manager.transactions; - - expect(result.length, 1); - - expect(result.first, tx); - }); - - test("refresh", () async { - final CoinServiceAPI wallet = MockFiroWallet(); - when(wallet.refresh()).thenAnswer((_) => Future(() => {})); - - final manager = Manager(wallet); - - await manager.refresh(); - - verify(wallet.refresh()).called(1); - }); - - test("get walletName", () { - final CoinServiceAPI wallet = MockFiroWallet(); - when(wallet.walletName).thenAnswer((_) => "Some wallet name"); - final manager = Manager(wallet); - - expect(manager.walletName, "Some wallet name"); - }); - - test("get walletId", () { - final CoinServiceAPI wallet = MockFiroWallet(); - when(wallet.walletId).thenAnswer((_) => "Some wallet ID"); - - final manager = Manager(wallet); - - expect(manager.walletId, "Some wallet ID"); - }); - - group("validateAddress", () { - test("some valid address", () { - final CoinServiceAPI wallet = MockFiroWallet(); - when(wallet.validateAddress("a valid address")).thenAnswer((_) => true); - - final manager = Manager(wallet); - - expect(manager.validateAddress("a valid address"), true); - }); - - test("some invalid address", () { - final CoinServiceAPI wallet = MockFiroWallet(); - when(wallet.validateAddress("an invalid address")) - .thenAnswer((_) => false); - - final manager = Manager(wallet); - - expect(manager.validateAddress("an invalid address"), false); - }); - }); - - test("get mnemonic", () async { - final CoinServiceAPI wallet = MockFiroWallet(); - when(wallet.mnemonic) - .thenAnswer((_) async => ["Some", "seed", "word", "list"]); - - final manager = Manager(wallet); - - expect(await manager.mnemonic, ["Some", "seed", "word", "list"]); - }); - - test("testNetworkConnection", () async { - final CoinServiceAPI wallet = MockFiroWallet(); - when(wallet.testNetworkConnection()).thenAnswer((_) async => true); - - final manager = Manager(wallet); - - expect(await manager.testNetworkConnection(), true); - }); - - group("recoverFromMnemonic", () { - test("successfully recover", () async { - final CoinServiceAPI wallet = MockFiroWallet(); - when(wallet.recoverFromMnemonic( - mnemonic: "Some valid mnemonic", - maxUnusedAddressGap: 20, - maxNumberOfIndexesToCheck: 1000, - height: 0)) - .thenAnswer((realInvocation) => Future(() => {})); - - final manager = Manager(wallet); - - await manager.recoverFromMnemonic( - mnemonic: "Some valid mnemonic", - maxUnusedAddressGap: 20, - maxNumberOfIndexesToCheck: 1000, - height: 0); - - verify(wallet.recoverFromMnemonic( - mnemonic: "Some valid mnemonic", - maxUnusedAddressGap: 20, - maxNumberOfIndexesToCheck: 1000, - height: 0)) - .called(1); - }); - - test("failed recovery", () async { - final CoinServiceAPI wallet = MockFiroWallet(); - when(wallet.recoverFromMnemonic( - mnemonic: "Some invalid mnemonic", - maxUnusedAddressGap: 20, - maxNumberOfIndexesToCheck: 1000, - height: 0)) - .thenThrow(Exception("Invalid mnemonic")); - - final manager = Manager(wallet); - - expect( - () => manager.recoverFromMnemonic( - mnemonic: "Some invalid mnemonic", - maxUnusedAddressGap: 20, - maxNumberOfIndexesToCheck: 1000, - height: 0), - throwsA(isA())); - - verify(wallet.recoverFromMnemonic( - mnemonic: "Some invalid mnemonic", - maxUnusedAddressGap: 20, - maxNumberOfIndexesToCheck: 1000, - height: 0)) - .called(1); - }); - - test("failed recovery due to some other error", () async { - final CoinServiceAPI wallet = MockFiroWallet(); - when(wallet.recoverFromMnemonic( - mnemonic: "Some valid mnemonic", - maxUnusedAddressGap: 20, - maxNumberOfIndexesToCheck: 1000, - height: 0)) - .thenThrow(Error()); - - final manager = Manager(wallet); - - expect( - () => manager.recoverFromMnemonic( - mnemonic: "Some valid mnemonic", - maxUnusedAddressGap: 20, - maxNumberOfIndexesToCheck: 1000, - height: 0), - throwsA(isA())); - - verify(wallet.recoverFromMnemonic( - mnemonic: "Some valid mnemonic", - maxUnusedAddressGap: 20, - maxNumberOfIndexesToCheck: 1000, - height: 0)) - .called(1); - }); - }); - - test("exitCurrentWallet", () async { - final CoinServiceAPI wallet = MockFiroWallet(); - when(wallet.exit()).thenAnswer((realInvocation) => Future(() => {})); - when(wallet.walletId).thenAnswer((realInvocation) => "some id"); - when(wallet.walletName).thenAnswer((realInvocation) => "some name"); - - final manager = Manager(wallet); - - await manager.exitCurrentWallet(); - - verify(wallet.exit()).called(1); - verify(wallet.walletName).called(1); - verify(wallet.walletId).called(1); - - expect(manager.hasBackgroundRefreshListener, false); - }); - - test("dispose", () async { - final CoinServiceAPI wallet = MockFiroWallet(); - when(wallet.exit()).thenAnswer((realInvocation) => Future(() => {})); - when(wallet.walletId).thenAnswer((realInvocation) => "some id"); - when(wallet.walletName).thenAnswer((realInvocation) => "some name"); - - final manager = Manager(wallet); - - expect(() => manager.dispose(), returnsNormally); - }); - - test("fullRescan succeeds", () { - final CoinServiceAPI wallet = MockFiroWallet(); - when(wallet.fullRescan(20, 1000)).thenAnswer((_) async {}); - - final manager = Manager(wallet); - - expect(() => manager.fullRescan(20, 1000), returnsNormally); - }); - - test("fullRescan fails", () { - final CoinServiceAPI wallet = MockFiroWallet(); - when(wallet.fullRescan(20, 1000)).thenThrow(Exception()); - - final manager = Manager(wallet); - - expect(() => manager.fullRescan(20, 1000), throwsA(isA())); - }); - - // test("act on event", () async { - // final CoinServiceAPI wallet = MockFiroWallet(); - // when(wallet.exit()).thenAnswer((realInvocation) => Future(() => {})); - // - // final manager = Manager(wallet); - // - // expect( - // () => GlobalEventBus.instance.fire(UpdatedInBackgroundEvent( - // "act on event - test message", "wallet ID")), - // returnsNormally); - // - // expect(() => manager.dispose(), returnsNormally); - // }); -} +// import 'package:decimal/decimal.dart'; +// import 'package:flutter_test/flutter_test.dart'; +// import 'package:mockito/annotations.dart'; +// import 'package:mockito/mockito.dart'; +// import 'package:stackwallet/electrumx_rpc/electrumx.dart'; +// import 'package:stackwallet/models/balance.dart'; +// import 'package:stackwallet/models/isar/models/isar_models.dart'; +// import 'package:stackwallet/models/paymint/fee_object_model.dart'; +// import 'package:stackwallet/services/coins/coin_service.dart'; +// import 'package:stackwallet/services/coins/firo/firo_wallet.dart'; +// import 'package:stackwallet/services/coins/manager.dart'; +// import 'package:stackwallet/utilities/amount/amount.dart'; +// import 'package:stackwallet/utilities/enums/coin_enum.dart'; +// +// import 'manager_test.mocks.dart'; +// +// /// quick amount constructor wrapper. Using an int is bad practice but for +// /// testing with small amounts this should be fine +// Amount _a(int i) => Amount.fromDecimal( +// Decimal.fromInt(i), +// fractionDigits: 8, +// ); +// +// @GenerateMocks([FiroWallet, ElectrumX]) +// void main() { +// test("Manager should have a backgroundRefreshListener on initialization", () { +// final manager = Manager(MockFiroWallet()); +// +// expect(manager.hasBackgroundRefreshListener, true); +// }); +// +// test("get coin", () { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.coin).thenAnswer((_) => Coin.firo); +// final manager = Manager(wallet); +// +// expect(manager.coin, Coin.firo); +// }); +// +// test("fees", () async { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.fees).thenAnswer((_) async => FeeObject( +// fast: 10, +// medium: 5, +// slow: 1, +// numberOfBlocksFast: 4, +// numberOfBlocksSlow: 2, +// numberOfBlocksAverage: 3)); +// +// final manager = Manager(wallet); +// +// final feeObject = await manager.fees; +// +// expect(feeObject.fast, 10); +// expect(feeObject.medium, 5); +// expect(feeObject.slow, 1); +// expect(feeObject.numberOfBlocksFast, 4); +// expect(feeObject.numberOfBlocksAverage, 3); +// expect(feeObject.numberOfBlocksSlow, 2); +// }); +// +// test("maxFee", () async { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.maxFee).thenAnswer((_) async => 10); +// +// final manager = Manager(wallet); +// +// final fee = await manager.maxFee; +// +// expect(fee, 10); +// }); +// +// test("get currentReceivingAddress", () async { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.currentReceivingAddress) +// .thenAnswer((_) async => "Some address string"); +// +// final manager = Manager(wallet); +// +// expect(await manager.currentReceivingAddress, "Some address string"); +// }); +// +// group("get balances", () { +// test("balance", () async { +// final CoinServiceAPI wallet = MockFiroWallet(); +// final balance = Balance( +// total: _a(10), +// spendable: _a(1), +// blockedTotal: _a(0), +// pendingSpendable: _a(9), +// ); +// +// when(wallet.coin).thenAnswer((_) => Coin.firo); +// when(wallet.balance).thenAnswer( +// (_) => balance, +// ); +// +// final manager = Manager(wallet); +// +// expect(manager.balance, balance); +// }); +// }); +// +// test("transactions", () async { +// final CoinServiceAPI wallet = MockFiroWallet(); +// +// when(wallet.coin).thenAnswer((realInvocation) => Coin.firo); +// +// final tx = Transaction( +// walletId: "walletId", +// txid: "txid", +// timestamp: 6, +// type: TransactionType.incoming, +// subType: TransactionSubType.mint, +// amount: 123, +// amountString: Amount( +// rawValue: BigInt.from(123), +// fractionDigits: wallet.coin.decimals, +// ).toJsonString(), +// fee: 3, +// height: 123, +// isCancelled: false, +// isLelantus: true, +// slateId: null, +// otherData: null, +// nonce: null, +// inputs: [], +// outputs: [], +// numberOfMessages: null, +// ); +// when(wallet.transactions).thenAnswer((_) async => [ +// tx, +// ]); +// +// final manager = Manager(wallet); +// +// final result = await manager.transactions; +// +// expect(result.length, 1); +// +// expect(result.first, tx); +// }); +// +// test("refresh", () async { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.refresh()).thenAnswer((_) => Future(() => {})); +// +// final manager = Manager(wallet); +// +// await manager.refresh(); +// +// verify(wallet.refresh()).called(1); +// }); +// +// test("get walletName", () { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.walletName).thenAnswer((_) => "Some wallet name"); +// final manager = Manager(wallet); +// +// expect(manager.walletName, "Some wallet name"); +// }); +// +// test("get walletId", () { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.walletId).thenAnswer((_) => "Some wallet ID"); +// +// final manager = Manager(wallet); +// +// expect(manager.walletId, "Some wallet ID"); +// }); +// +// group("validateAddress", () { +// test("some valid address", () { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.validateAddress("a valid address")).thenAnswer((_) => true); +// +// final manager = Manager(wallet); +// +// expect(manager.validateAddress("a valid address"), true); +// }); +// +// test("some invalid address", () { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.validateAddress("an invalid address")) +// .thenAnswer((_) => false); +// +// final manager = Manager(wallet); +// +// expect(manager.validateAddress("an invalid address"), false); +// }); +// }); +// +// test("get mnemonic", () async { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.mnemonic) +// .thenAnswer((_) async => ["Some", "seed", "word", "list"]); +// +// final manager = Manager(wallet); +// +// expect(await manager.mnemonic, ["Some", "seed", "word", "list"]); +// }); +// +// test("testNetworkConnection", () async { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.testNetworkConnection()).thenAnswer((_) async => true); +// +// final manager = Manager(wallet); +// +// expect(await manager.testNetworkConnection(), true); +// }); +// +// group("recoverFromMnemonic", () { +// test("successfully recover", () async { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.recoverFromMnemonic( +// mnemonic: "Some valid mnemonic", +// maxUnusedAddressGap: 20, +// maxNumberOfIndexesToCheck: 1000, +// height: 0)) +// .thenAnswer((realInvocation) => Future(() => {})); +// +// final manager = Manager(wallet); +// +// await manager.recoverFromMnemonic( +// mnemonic: "Some valid mnemonic", +// maxUnusedAddressGap: 20, +// maxNumberOfIndexesToCheck: 1000, +// height: 0); +// +// verify(wallet.recoverFromMnemonic( +// mnemonic: "Some valid mnemonic", +// maxUnusedAddressGap: 20, +// maxNumberOfIndexesToCheck: 1000, +// height: 0)) +// .called(1); +// }); +// +// test("failed recovery", () async { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.recoverFromMnemonic( +// mnemonic: "Some invalid mnemonic", +// maxUnusedAddressGap: 20, +// maxNumberOfIndexesToCheck: 1000, +// height: 0)) +// .thenThrow(Exception("Invalid mnemonic")); +// +// final manager = Manager(wallet); +// +// expect( +// () => manager.recoverFromMnemonic( +// mnemonic: "Some invalid mnemonic", +// maxUnusedAddressGap: 20, +// maxNumberOfIndexesToCheck: 1000, +// height: 0), +// throwsA(isA())); +// +// verify(wallet.recoverFromMnemonic( +// mnemonic: "Some invalid mnemonic", +// maxUnusedAddressGap: 20, +// maxNumberOfIndexesToCheck: 1000, +// height: 0)) +// .called(1); +// }); +// +// test("failed recovery due to some other error", () async { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.recoverFromMnemonic( +// mnemonic: "Some valid mnemonic", +// maxUnusedAddressGap: 20, +// maxNumberOfIndexesToCheck: 1000, +// height: 0)) +// .thenThrow(Error()); +// +// final manager = Manager(wallet); +// +// expect( +// () => manager.recoverFromMnemonic( +// mnemonic: "Some valid mnemonic", +// maxUnusedAddressGap: 20, +// maxNumberOfIndexesToCheck: 1000, +// height: 0), +// throwsA(isA())); +// +// verify(wallet.recoverFromMnemonic( +// mnemonic: "Some valid mnemonic", +// maxUnusedAddressGap: 20, +// maxNumberOfIndexesToCheck: 1000, +// height: 0)) +// .called(1); +// }); +// }); +// +// test("exitCurrentWallet", () async { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.exit()).thenAnswer((realInvocation) => Future(() => {})); +// when(wallet.walletId).thenAnswer((realInvocation) => "some id"); +// when(wallet.walletName).thenAnswer((realInvocation) => "some name"); +// +// final manager = Manager(wallet); +// +// await manager.exitCurrentWallet(); +// +// verify(wallet.exit()).called(1); +// verify(wallet.walletName).called(1); +// verify(wallet.walletId).called(1); +// +// expect(manager.hasBackgroundRefreshListener, false); +// }); +// +// test("dispose", () async { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.exit()).thenAnswer((realInvocation) => Future(() => {})); +// when(wallet.walletId).thenAnswer((realInvocation) => "some id"); +// when(wallet.walletName).thenAnswer((realInvocation) => "some name"); +// +// final manager = Manager(wallet); +// +// expect(() => manager.dispose(), returnsNormally); +// }); +// +// test("fullRescan succeeds", () { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.fullRescan(20, 1000)).thenAnswer((_) async {}); +// +// final manager = Manager(wallet); +// +// expect(() => manager.fullRescan(20, 1000), returnsNormally); +// }); +// +// test("fullRescan fails", () { +// final CoinServiceAPI wallet = MockFiroWallet(); +// when(wallet.fullRescan(20, 1000)).thenThrow(Exception()); +// +// final manager = Manager(wallet); +// +// expect(() => manager.fullRescan(20, 1000), throwsA(isA())); +// }); +// +// // test("act on event", () async { +// // final CoinServiceAPI wallet = MockFiroWallet(); +// // when(wallet.exit()).thenAnswer((realInvocation) => Future(() => {})); +// // +// // final manager = Manager(wallet); +// // +// // expect( +// // () => GlobalEventBus.instance.fire(UpdatedInBackgroundEvent( +// // "act on event - test message", "wallet ID")), +// // returnsNormally); +// // +// // expect(() => manager.dispose(), returnsNormally); +// // }); +// } diff --git a/test/services/coins/manager_test.mocks.dart b/test/services/coins/manager_test.mocks.dart deleted file mode 100644 index 821da6efc..000000000 --- a/test/services/coins/manager_test.mocks.dart +++ /dev/null @@ -1,1456 +0,0 @@ -// Mocks generated by Mockito 5.3.2 from annotations -// in stackwallet/test/services/coins/manager_test.dart. -// Do not manually edit this file. - -// ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i11; - -import 'package:decimal/decimal.dart' as _i9; -import 'package:mockito/mockito.dart' as _i1; -import 'package:stackwallet/db/isar/main_db.dart' as _i7; -import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i5; -import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i4; -import 'package:stackwallet/models/balance.dart' as _i6; -import 'package:stackwallet/models/isar/models/isar_models.dart' as _i13; -import 'package:stackwallet/models/lelantus_coin.dart' as _i15; -import 'package:stackwallet/models/paymint/fee_object_model.dart' as _i3; -import 'package:stackwallet/models/signing_data.dart' as _i14; -import 'package:stackwallet/services/coins/firo/firo_wallet.dart' as _i10; -import 'package:stackwallet/services/transaction_notification_tracker.dart' - as _i2; -import 'package:stackwallet/utilities/amount/amount.dart' as _i8; -import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i12; - -// ignore_for_file: type=lint -// ignore_for_file: avoid_redundant_argument_values -// ignore_for_file: avoid_setters_without_getters -// ignore_for_file: comment_references -// ignore_for_file: implementation_imports -// ignore_for_file: invalid_use_of_visible_for_testing_member -// ignore_for_file: prefer_const_constructors -// ignore_for_file: unnecessary_parenthesis -// ignore_for_file: camel_case_types -// ignore_for_file: subtype_of_sealed_class - -class _FakeTransactionNotificationTracker_0 extends _i1.SmartFake - implements _i2.TransactionNotificationTracker { - _FakeTransactionNotificationTracker_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeFeeObject_1 extends _i1.SmartFake implements _i3.FeeObject { - _FakeFeeObject_1( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeElectrumX_2 extends _i1.SmartFake implements _i4.ElectrumX { - _FakeElectrumX_2( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeCachedElectrumX_3 extends _i1.SmartFake - implements _i5.CachedElectrumX { - _FakeCachedElectrumX_3( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeBalance_4 extends _i1.SmartFake implements _i6.Balance { - _FakeBalance_4( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeMainDB_5 extends _i1.SmartFake implements _i7.MainDB { - _FakeMainDB_5( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeAmount_6 extends _i1.SmartFake implements _i8.Amount { - _FakeAmount_6( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeDecimal_7 extends _i1.SmartFake implements _i9.Decimal { - _FakeDecimal_7( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -/// A class which mocks [FiroWallet]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockFiroWallet extends _i1.Mock implements _i10.FiroWallet { - MockFiroWallet() { - _i1.throwOnMissingStub(this); - } - - @override - set timer(_i11.Timer? _timer) => super.noSuchMethod( - Invocation.setter( - #timer, - _timer, - ), - returnValueForMissingStub: null, - ); - @override - _i2.TransactionNotificationTracker get txTracker => (super.noSuchMethod( - Invocation.getter(#txTracker), - returnValue: _FakeTransactionNotificationTracker_0( - this, - Invocation.getter(#txTracker), - ), - ) as _i2.TransactionNotificationTracker); - @override - set txTracker(_i2.TransactionNotificationTracker? _txTracker) => - super.noSuchMethod( - Invocation.setter( - #txTracker, - _txTracker, - ), - returnValueForMissingStub: null, - ); - @override - bool get refreshMutex => (super.noSuchMethod( - Invocation.getter(#refreshMutex), - returnValue: false, - ) as bool); - @override - set refreshMutex(bool? _refreshMutex) => super.noSuchMethod( - Invocation.setter( - #refreshMutex, - _refreshMutex, - ), - returnValueForMissingStub: null, - ); - @override - bool get longMutex => (super.noSuchMethod( - Invocation.getter(#longMutex), - returnValue: false, - ) as bool); - @override - set longMutex(bool? _longMutex) => super.noSuchMethod( - Invocation.setter( - #longMutex, - _longMutex, - ), - returnValueForMissingStub: null, - ); - @override - bool get isActive => (super.noSuchMethod( - Invocation.getter(#isActive), - returnValue: false, - ) as bool); - @override - set isActive(bool? _isActive) => super.noSuchMethod( - Invocation.setter( - #isActive, - _isActive, - ), - returnValueForMissingStub: null, - ); - @override - bool get shouldAutoSync => (super.noSuchMethod( - Invocation.getter(#shouldAutoSync), - returnValue: false, - ) as bool); - @override - set shouldAutoSync(bool? shouldAutoSync) => super.noSuchMethod( - Invocation.setter( - #shouldAutoSync, - shouldAutoSync, - ), - returnValueForMissingStub: null, - ); - @override - set isFavorite(bool? markFavorite) => super.noSuchMethod( - Invocation.setter( - #isFavorite, - markFavorite, - ), - returnValueForMissingStub: null, - ); - @override - bool get isFavorite => (super.noSuchMethod( - Invocation.getter(#isFavorite), - returnValue: false, - ) as bool); - @override - _i12.Coin get coin => (super.noSuchMethod( - Invocation.getter(#coin), - returnValue: _i12.Coin.bitcoin, - ) as _i12.Coin); - @override - _i11.Future> get mnemonic => (super.noSuchMethod( - Invocation.getter(#mnemonic), - returnValue: _i11.Future>.value([]), - ) as _i11.Future>); - @override - _i11.Future get mnemonicString => (super.noSuchMethod( - Invocation.getter(#mnemonicString), - returnValue: _i11.Future.value(), - ) as _i11.Future); - @override - _i11.Future get mnemonicPassphrase => (super.noSuchMethod( - Invocation.getter(#mnemonicPassphrase), - returnValue: _i11.Future.value(), - ) as _i11.Future); - @override - _i11.Future get maxFee => (super.noSuchMethod( - Invocation.getter(#maxFee), - returnValue: _i11.Future.value(0), - ) as _i11.Future); - @override - _i11.Future<_i3.FeeObject> get fees => (super.noSuchMethod( - Invocation.getter(#fees), - returnValue: _i11.Future<_i3.FeeObject>.value(_FakeFeeObject_1( - this, - Invocation.getter(#fees), - )), - ) as _i11.Future<_i3.FeeObject>); - @override - _i11.Future get currentReceivingAddress => (super.noSuchMethod( - Invocation.getter(#currentReceivingAddress), - returnValue: _i11.Future.value(''), - ) as _i11.Future); - @override - _i11.Future get currentChangeAddress => (super.noSuchMethod( - Invocation.getter(#currentChangeAddress), - returnValue: _i11.Future.value(''), - ) as _i11.Future); - @override - String get walletName => (super.noSuchMethod( - Invocation.getter(#walletName), - returnValue: '', - ) as String); - @override - set walletName(String? newName) => super.noSuchMethod( - Invocation.setter( - #walletName, - newName, - ), - returnValueForMissingStub: null, - ); - @override - String get walletId => (super.noSuchMethod( - Invocation.getter(#walletId), - returnValue: '', - ) as String); - @override - bool get isConnected => (super.noSuchMethod( - Invocation.getter(#isConnected), - returnValue: false, - ) as bool); - @override - _i4.ElectrumX get electrumXClient => (super.noSuchMethod( - Invocation.getter(#electrumXClient), - returnValue: _FakeElectrumX_2( - this, - Invocation.getter(#electrumXClient), - ), - ) as _i4.ElectrumX); - @override - _i5.CachedElectrumX get cachedElectrumXClient => (super.noSuchMethod( - Invocation.getter(#cachedElectrumXClient), - returnValue: _FakeCachedElectrumX_3( - this, - Invocation.getter(#cachedElectrumXClient), - ), - ) as _i5.CachedElectrumX); - @override - bool get isRefreshing => (super.noSuchMethod( - Invocation.getter(#isRefreshing), - returnValue: false, - ) as bool); - @override - bool get hasCalledExit => (super.noSuchMethod( - Invocation.getter(#hasCalledExit), - returnValue: false, - ) as bool); - @override - _i11.Future get chainHeight => (super.noSuchMethod( - Invocation.getter(#chainHeight), - returnValue: _i11.Future.value(0), - ) as _i11.Future); - @override - int get storedChainHeight => (super.noSuchMethod( - Invocation.getter(#storedChainHeight), - returnValue: 0, - ) as int); - @override - _i6.Balance get balance => (super.noSuchMethod( - Invocation.getter(#balance), - returnValue: _FakeBalance_4( - this, - Invocation.getter(#balance), - ), - ) as _i6.Balance); - @override - _i6.Balance get balancePrivate => (super.noSuchMethod( - Invocation.getter(#balancePrivate), - returnValue: _FakeBalance_4( - this, - Invocation.getter(#balancePrivate), - ), - ) as _i6.Balance); - @override - _i11.Future> get utxos => (super.noSuchMethod( - Invocation.getter(#utxos), - returnValue: _i11.Future>.value(<_i13.UTXO>[]), - ) as _i11.Future>); - @override - _i11.Future> get transactions => (super.noSuchMethod( - Invocation.getter(#transactions), - returnValue: - _i11.Future>.value(<_i13.Transaction>[]), - ) as _i11.Future>); - @override - _i11.Future get xpub => (super.noSuchMethod( - Invocation.getter(#xpub), - returnValue: _i11.Future.value(''), - ) as _i11.Future); - @override - set onIsActiveWalletChanged(void Function(bool)? _onIsActiveWalletChanged) => - super.noSuchMethod( - Invocation.setter( - #onIsActiveWalletChanged, - _onIsActiveWalletChanged, - ), - returnValueForMissingStub: null, - ); - @override - _i7.MainDB get db => (super.noSuchMethod( - Invocation.getter(#db), - returnValue: _FakeMainDB_5( - this, - Invocation.getter(#db), - ), - ) as _i7.MainDB); - @override - bool validateAddress(String? address) => (super.noSuchMethod( - Invocation.method( - #validateAddress, - [address], - ), - returnValue: false, - ) as bool); - @override - _i11.Future updateSentCachedTxData(Map? txData) => - (super.noSuchMethod( - Invocation.method( - #updateSentCachedTxData, - [txData], - ), - returnValue: _i11.Future.value(), - returnValueForMissingStub: _i11.Future.value(), - ) as _i11.Future); - @override - _i11.Future testNetworkConnection() => (super.noSuchMethod( - Invocation.method( - #testNetworkConnection, - [], - ), - returnValue: _i11.Future.value(false), - ) as _i11.Future); - @override - void startNetworkAlivePinging() => super.noSuchMethod( - Invocation.method( - #startNetworkAlivePinging, - [], - ), - returnValueForMissingStub: null, - ); - @override - void stopNetworkAlivePinging() => super.noSuchMethod( - Invocation.method( - #stopNetworkAlivePinging, - [], - ), - returnValueForMissingStub: null, - ); - @override - _i11.Future> prepareSendPublic({ - required String? address, - required _i8.Amount? amount, - Map? args, - }) => - (super.noSuchMethod( - Invocation.method( - #prepareSendPublic, - [], - { - #address: address, - #amount: amount, - #args: args, - }, - ), - returnValue: - _i11.Future>.value({}), - ) as _i11.Future>); - @override - _i11.Future confirmSendPublic({dynamic txData}) => - (super.noSuchMethod( - Invocation.method( - #confirmSendPublic, - [], - {#txData: txData}, - ), - returnValue: _i11.Future.value(''), - ) as _i11.Future); - @override - _i11.Future> prepareSend({ - required String? address, - required _i8.Amount? amount, - Map? args, - }) => - (super.noSuchMethod( - Invocation.method( - #prepareSend, - [], - { - #address: address, - #amount: amount, - #args: args, - }, - ), - returnValue: - _i11.Future>.value({}), - ) as _i11.Future>); - @override - _i11.Future confirmSend({required Map? txData}) => - (super.noSuchMethod( - Invocation.method( - #confirmSend, - [], - {#txData: txData}, - ), - returnValue: _i11.Future.value(''), - ) as _i11.Future); - @override - int estimateTxFee({ - required int? vSize, - required int? feeRatePerKB, - }) => - (super.noSuchMethod( - Invocation.method( - #estimateTxFee, - [], - { - #vSize: vSize, - #feeRatePerKB: feeRatePerKB, - }, - ), - returnValue: 0, - ) as int); - @override - dynamic coinSelection( - int? satoshiAmountToSend, - int? selectedTxFeeRate, - String? _recipientAddress, - bool? isSendAll, { - int? additionalOutputs = 0, - List<_i13.UTXO>? utxos, - }) => - super.noSuchMethod(Invocation.method( - #coinSelection, - [ - satoshiAmountToSend, - selectedTxFeeRate, - _recipientAddress, - isSendAll, - ], - { - #additionalOutputs: additionalOutputs, - #utxos: utxos, - }, - )); - @override - _i11.Future> fetchBuildTxData( - List<_i13.UTXO>? utxosToUse) => - (super.noSuchMethod( - Invocation.method( - #fetchBuildTxData, - [utxosToUse], - ), - returnValue: - _i11.Future>.value(<_i14.SigningData>[]), - ) as _i11.Future>); - @override - _i11.Future> buildTransaction({ - required List<_i14.SigningData>? utxoSigningData, - required List? recipients, - required List? satoshiAmounts, - }) => - (super.noSuchMethod( - Invocation.method( - #buildTransaction, - [], - { - #utxoSigningData: utxoSigningData, - #recipients: recipients, - #satoshiAmounts: satoshiAmounts, - }, - ), - returnValue: - _i11.Future>.value({}), - ) as _i11.Future>); - @override - _i11.Future updateNode(bool? shouldRefresh) => (super.noSuchMethod( - Invocation.method( - #updateNode, - [shouldRefresh], - ), - returnValue: _i11.Future.value(), - returnValueForMissingStub: _i11.Future.value(), - ) as _i11.Future); - @override - _i11.Future initializeNew() => (super.noSuchMethod( - Invocation.method( - #initializeNew, - [], - ), - returnValue: _i11.Future.value(), - returnValueForMissingStub: _i11.Future.value(), - ) as _i11.Future); - @override - _i11.Future initializeExisting() => (super.noSuchMethod( - Invocation.method( - #initializeExisting, - [], - ), - returnValue: _i11.Future.value(), - returnValueForMissingStub: _i11.Future.value(), - ) as _i11.Future); - @override - _i11.Future refreshIfThereIsNewData() => (super.noSuchMethod( - Invocation.method( - #refreshIfThereIsNewData, - [], - ), - returnValue: _i11.Future.value(false), - ) as _i11.Future); - @override - _i11.Future getAllTxsToWatch() => (super.noSuchMethod( - Invocation.method( - #getAllTxsToWatch, - [], - ), - returnValue: _i11.Future.value(), - returnValueForMissingStub: _i11.Future.value(), - ) as _i11.Future); - @override - _i11.Future refresh() => (super.noSuchMethod( - Invocation.method( - #refresh, - [], - ), - returnValue: _i11.Future.value(), - returnValueForMissingStub: _i11.Future.value(), - ) as _i11.Future); - @override - List> getLelantusCoinMap() => - (super.noSuchMethod( - Invocation.method( - #getLelantusCoinMap, - [], - ), - returnValue: >[], - ) as List>); - @override - _i11.Future anonymizeAllPublicFunds() => (super.noSuchMethod( - Invocation.method( - #anonymizeAllPublicFunds, - [], - ), - returnValue: _i11.Future.value(), - returnValueForMissingStub: _i11.Future.value(), - ) as _i11.Future); - @override - _i11.Future>> createMintsFromAmount(int? total) => - (super.noSuchMethod( - Invocation.method( - #createMintsFromAmount, - [total], - ), - returnValue: _i11.Future>>.value( - >[]), - ) as _i11.Future>>); - @override - _i11.Future submitHexToNetwork(String? hex) => (super.noSuchMethod( - Invocation.method( - #submitHexToNetwork, - [hex], - ), - returnValue: _i11.Future.value(''), - ) as _i11.Future); - @override - _i11.Future> buildMintTransaction( - List<_i13.UTXO>? utxosToUse, - int? satoshisPerRecipient, - List>? mintsMap, - ) => - (super.noSuchMethod( - Invocation.method( - #buildMintTransaction, - [ - utxosToUse, - satoshisPerRecipient, - mintsMap, - ], - ), - returnValue: - _i11.Future>.value({}), - ) as _i11.Future>); - @override - _i11.Future checkReceivingAddressForTransactions() => - (super.noSuchMethod( - Invocation.method( - #checkReceivingAddressForTransactions, - [], - ), - returnValue: _i11.Future.value(), - returnValueForMissingStub: _i11.Future.value(), - ) as _i11.Future); - @override - _i11.Future checkChangeAddressForTransactions() => (super.noSuchMethod( - Invocation.method( - #checkChangeAddressForTransactions, - [], - ), - returnValue: _i11.Future.value(), - returnValueForMissingStub: _i11.Future.value(), - ) as _i11.Future); - @override - _i11.Future fullRescan( - int? maxUnusedAddressGap, - int? maxNumberOfIndexesToCheck, - ) => - (super.noSuchMethod( - Invocation.method( - #fullRescan, - [ - maxUnusedAddressGap, - maxNumberOfIndexesToCheck, - ], - ), - returnValue: _i11.Future.value(), - returnValueForMissingStub: _i11.Future.value(), - ) as _i11.Future); - @override - _i11.Future recoverFromMnemonic({ - required String? mnemonic, - String? mnemonicPassphrase, - required int? maxUnusedAddressGap, - required int? maxNumberOfIndexesToCheck, - required int? height, - }) => - (super.noSuchMethod( - Invocation.method( - #recoverFromMnemonic, - [], - { - #mnemonic: mnemonic, - #mnemonicPassphrase: mnemonicPassphrase, - #maxUnusedAddressGap: maxUnusedAddressGap, - #maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck, - #height: height, - }, - ), - returnValue: _i11.Future.value(), - returnValueForMissingStub: _i11.Future.value(), - ) as _i11.Future); - @override - _i11.Future> getSetDataMap(int? latestSetId) => - (super.noSuchMethod( - Invocation.method( - #getSetDataMap, - [latestSetId], - ), - returnValue: _i11.Future>.value({}), - ) as _i11.Future>); - @override - _i11.Future getTransactionCacheEarly(List? allAddresses) => - (super.noSuchMethod( - Invocation.method( - #getTransactionCacheEarly, - [allAddresses], - ), - returnValue: _i11.Future.value(), - returnValueForMissingStub: _i11.Future.value(), - ) as _i11.Future); - @override - _i11.Future>> fetchAnonymitySets() => - (super.noSuchMethod( - Invocation.method( - #fetchAnonymitySets, - [], - ), - returnValue: _i11.Future>>.value( - >[]), - ) as _i11.Future>>); - @override - _i11.Future getLatestSetId() => (super.noSuchMethod( - Invocation.method( - #getLatestSetId, - [], - ), - returnValue: _i11.Future.value(0), - ) as _i11.Future); - @override - _i11.Future> getUsedCoinSerials() => (super.noSuchMethod( - Invocation.method( - #getUsedCoinSerials, - [], - ), - returnValue: _i11.Future>.value([]), - ) as _i11.Future>); - @override - _i11.Future exit() => (super.noSuchMethod( - Invocation.method( - #exit, - [], - ), - returnValue: _i11.Future.value(), - returnValueForMissingStub: _i11.Future.value(), - ) as _i11.Future); - @override - _i11.Future getCoinsToJoinSplit(int? required) => - (super.noSuchMethod( - Invocation.method( - #getCoinsToJoinSplit, - [required], - ), - returnValue: _i11.Future.value(), - ) as _i11.Future); - @override - _i11.Future estimateJoinSplitFee(int? spendAmount) => - (super.noSuchMethod( - Invocation.method( - #estimateJoinSplitFee, - [spendAmount], - ), - returnValue: _i11.Future.value(0), - ) as _i11.Future); - @override - _i11.Future<_i8.Amount> estimateFeeFor( - _i8.Amount? amount, - int? feeRate, - ) => - (super.noSuchMethod( - Invocation.method( - #estimateFeeFor, - [ - amount, - feeRate, - ], - ), - returnValue: _i11.Future<_i8.Amount>.value(_FakeAmount_6( - this, - Invocation.method( - #estimateFeeFor, - [ - amount, - feeRate, - ], - ), - )), - ) as _i11.Future<_i8.Amount>); - @override - _i11.Future<_i8.Amount> estimateFeeForPublic( - _i8.Amount? amount, - int? feeRate, - ) => - (super.noSuchMethod( - Invocation.method( - #estimateFeeForPublic, - [ - amount, - feeRate, - ], - ), - returnValue: _i11.Future<_i8.Amount>.value(_FakeAmount_6( - this, - Invocation.method( - #estimateFeeForPublic, - [ - amount, - feeRate, - ], - ), - )), - ) as _i11.Future<_i8.Amount>); - @override - _i8.Amount roughFeeEstimate( - int? inputCount, - int? outputCount, - int? feeRatePerKB, - ) => - (super.noSuchMethod( - Invocation.method( - #roughFeeEstimate, - [ - inputCount, - outputCount, - feeRatePerKB, - ], - ), - returnValue: _FakeAmount_6( - this, - Invocation.method( - #roughFeeEstimate, - [ - inputCount, - outputCount, - feeRatePerKB, - ], - ), - ), - ) as _i8.Amount); - @override - _i11.Future<_i8.Amount> sweepAllEstimate(int? feeRate) => (super.noSuchMethod( - Invocation.method( - #sweepAllEstimate, - [feeRate], - ), - returnValue: _i11.Future<_i8.Amount>.value(_FakeAmount_6( - this, - Invocation.method( - #sweepAllEstimate, - [feeRate], - ), - )), - ) as _i11.Future<_i8.Amount>); - @override - _i11.Future>> fastFetch( - List? allTxHashes) => - (super.noSuchMethod( - Invocation.method( - #fastFetch, - [allTxHashes], - ), - returnValue: _i11.Future>>.value( - >[]), - ) as _i11.Future>>); - @override - _i11.Future> getJMintTransactions( - _i5.CachedElectrumX? cachedClient, - List? transactions, - _i12.Coin? coin, - ) => - (super.noSuchMethod( - Invocation.method( - #getJMintTransactions, - [ - cachedClient, - transactions, - coin, - ], - ), - returnValue: _i11.Future>.value( - <_i13.Address, _i13.Transaction>{}), - ) as _i11.Future>); - @override - _i11.Future generateNewAddress() => (super.noSuchMethod( - Invocation.method( - #generateNewAddress, - [], - ), - returnValue: _i11.Future.value(false), - ) as _i11.Future); - @override - _i8.Amount availablePrivateBalance() => (super.noSuchMethod( - Invocation.method( - #availablePrivateBalance, - [], - ), - returnValue: _FakeAmount_6( - this, - Invocation.method( - #availablePrivateBalance, - [], - ), - ), - ) as _i8.Amount); - @override - _i8.Amount availablePublicBalance() => (super.noSuchMethod( - Invocation.method( - #availablePublicBalance, - [], - ), - returnValue: _FakeAmount_6( - this, - Invocation.method( - #availablePublicBalance, - [], - ), - ), - ) as _i8.Amount); - @override - void initCache( - String? walletId, - _i12.Coin? coin, - ) => - super.noSuchMethod( - Invocation.method( - #initCache, - [ - walletId, - coin, - ], - ), - returnValueForMissingStub: null, - ); - @override - _i11.Future updateCachedId(String? id) => (super.noSuchMethod( - Invocation.method( - #updateCachedId, - [id], - ), - returnValue: _i11.Future.value(), - returnValueForMissingStub: _i11.Future.value(), - ) as _i11.Future); - @override - int getCachedChainHeight() => (super.noSuchMethod( - Invocation.method( - #getCachedChainHeight, - [], - ), - returnValue: 0, - ) as int); - @override - _i11.Future updateCachedChainHeight(int? height) => (super.noSuchMethod( - Invocation.method( - #updateCachedChainHeight, - [height], - ), - returnValue: _i11.Future.value(), - returnValueForMissingStub: _i11.Future.value(), - ) as _i11.Future); - @override - bool getCachedIsFavorite() => (super.noSuchMethod( - Invocation.method( - #getCachedIsFavorite, - [], - ), - returnValue: false, - ) as bool); - @override - _i11.Future updateCachedIsFavorite(bool? isFavorite) => - (super.noSuchMethod( - Invocation.method( - #updateCachedIsFavorite, - [isFavorite], - ), - returnValue: _i11.Future.value(), - returnValueForMissingStub: _i11.Future.value(), - ) as _i11.Future); - @override - _i6.Balance getCachedBalance() => (super.noSuchMethod( - Invocation.method( - #getCachedBalance, - [], - ), - returnValue: _FakeBalance_4( - this, - Invocation.method( - #getCachedBalance, - [], - ), - ), - ) as _i6.Balance); - @override - _i11.Future updateCachedBalance(_i6.Balance? balance) => - (super.noSuchMethod( - Invocation.method( - #updateCachedBalance, - [balance], - ), - returnValue: _i11.Future.value(), - returnValueForMissingStub: _i11.Future.value(), - ) as _i11.Future); - @override - _i6.Balance getCachedBalanceSecondary() => (super.noSuchMethod( - Invocation.method( - #getCachedBalanceSecondary, - [], - ), - returnValue: _FakeBalance_4( - this, - Invocation.method( - #getCachedBalanceSecondary, - [], - ), - ), - ) as _i6.Balance); - @override - _i11.Future updateCachedBalanceSecondary(_i6.Balance? balance) => - (super.noSuchMethod( - Invocation.method( - #updateCachedBalanceSecondary, - [balance], - ), - returnValue: _i11.Future.value(), - returnValueForMissingStub: _i11.Future.value(), - ) as _i11.Future); - @override - List getWalletTokenContractAddresses() => (super.noSuchMethod( - Invocation.method( - #getWalletTokenContractAddresses, - [], - ), - returnValue: [], - ) as List); - @override - _i11.Future updateWalletTokenContractAddresses( - List? contractAddresses) => - (super.noSuchMethod( - Invocation.method( - #updateWalletTokenContractAddresses, - [contractAddresses], - ), - returnValue: _i11.Future.value(), - returnValueForMissingStub: _i11.Future.value(), - ) as _i11.Future); - @override - void initWalletDB({_i7.MainDB? mockableOverride}) => super.noSuchMethod( - Invocation.method( - #initWalletDB, - [], - {#mockableOverride: mockableOverride}, - ), - returnValueForMissingStub: null, - ); - @override - void initFiroHive(String? walletId) => super.noSuchMethod( - Invocation.method( - #initFiroHive, - [walletId], - ), - returnValueForMissingStub: null, - ); - @override - _i11.Future firoUpdateJIndex(List? jIndex) => - (super.noSuchMethod( - Invocation.method( - #firoUpdateJIndex, - [jIndex], - ), - returnValue: _i11.Future.value(), - returnValueForMissingStub: _i11.Future.value(), - ) as _i11.Future); - @override - _i11.Future firoUpdateLelantusCoins(List? lelantusCoins) => - (super.noSuchMethod( - Invocation.method( - #firoUpdateLelantusCoins, - [lelantusCoins], - ), - returnValue: _i11.Future.value(), - returnValueForMissingStub: _i11.Future.value(), - ) as _i11.Future); - @override - int firoGetMintIndex() => (super.noSuchMethod( - Invocation.method( - #firoGetMintIndex, - [], - ), - returnValue: 0, - ) as int); - @override - _i11.Future firoUpdateMintIndex(int? mintIndex) => (super.noSuchMethod( - Invocation.method( - #firoUpdateMintIndex, - [mintIndex], - ), - returnValue: _i11.Future.value(), - returnValueForMissingStub: _i11.Future.value(), - ) as _i11.Future); -} - -/// A class which mocks [ElectrumX]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockElectrumX extends _i1.Mock implements _i4.ElectrumX { - MockElectrumX() { - _i1.throwOnMissingStub(this); - } - - @override - set failovers(List<_i4.ElectrumXNode>? _failovers) => super.noSuchMethod( - Invocation.setter( - #failovers, - _failovers, - ), - returnValueForMissingStub: null, - ); - @override - int get currentFailoverIndex => (super.noSuchMethod( - Invocation.getter(#currentFailoverIndex), - returnValue: 0, - ) as int); - @override - set currentFailoverIndex(int? _currentFailoverIndex) => super.noSuchMethod( - Invocation.setter( - #currentFailoverIndex, - _currentFailoverIndex, - ), - returnValueForMissingStub: null, - ); - @override - String get host => (super.noSuchMethod( - Invocation.getter(#host), - returnValue: '', - ) as String); - @override - int get port => (super.noSuchMethod( - Invocation.getter(#port), - returnValue: 0, - ) as int); - @override - bool get useSSL => (super.noSuchMethod( - Invocation.getter(#useSSL), - returnValue: false, - ) as bool); - @override - _i11.Future request({ - required String? command, - List? args = const [], - Duration? connectionTimeout = const Duration(seconds: 60), - String? requestID, - int? retries = 2, - }) => - (super.noSuchMethod( - Invocation.method( - #request, - [], - { - #command: command, - #args: args, - #connectionTimeout: connectionTimeout, - #requestID: requestID, - #retries: retries, - }, - ), - returnValue: _i11.Future.value(), - ) as _i11.Future); - @override - _i11.Future>> batchRequest({ - required String? command, - required Map>? args, - Duration? connectionTimeout = const Duration(seconds: 60), - int? retries = 2, - }) => - (super.noSuchMethod( - Invocation.method( - #batchRequest, - [], - { - #command: command, - #args: args, - #connectionTimeout: connectionTimeout, - #retries: retries, - }, - ), - returnValue: _i11.Future>>.value( - >[]), - ) as _i11.Future>>); - @override - _i11.Future ping({ - String? requestID, - int? retryCount = 1, - }) => - (super.noSuchMethod( - Invocation.method( - #ping, - [], - { - #requestID: requestID, - #retryCount: retryCount, - }, - ), - returnValue: _i11.Future.value(false), - ) as _i11.Future); - @override - _i11.Future> getBlockHeadTip({String? requestID}) => - (super.noSuchMethod( - Invocation.method( - #getBlockHeadTip, - [], - {#requestID: requestID}, - ), - returnValue: - _i11.Future>.value({}), - ) as _i11.Future>); - @override - _i11.Future> getServerFeatures({String? requestID}) => - (super.noSuchMethod( - Invocation.method( - #getServerFeatures, - [], - {#requestID: requestID}, - ), - returnValue: - _i11.Future>.value({}), - ) as _i11.Future>); - @override - _i11.Future broadcastTransaction({ - required String? rawTx, - String? requestID, - }) => - (super.noSuchMethod( - Invocation.method( - #broadcastTransaction, - [], - { - #rawTx: rawTx, - #requestID: requestID, - }, - ), - returnValue: _i11.Future.value(''), - ) as _i11.Future); - @override - _i11.Future> getBalance({ - required String? scripthash, - String? requestID, - }) => - (super.noSuchMethod( - Invocation.method( - #getBalance, - [], - { - #scripthash: scripthash, - #requestID: requestID, - }, - ), - returnValue: - _i11.Future>.value({}), - ) as _i11.Future>); - @override - _i11.Future>> getHistory({ - required String? scripthash, - String? requestID, - }) => - (super.noSuchMethod( - Invocation.method( - #getHistory, - [], - { - #scripthash: scripthash, - #requestID: requestID, - }, - ), - returnValue: _i11.Future>>.value( - >[]), - ) as _i11.Future>>); - @override - _i11.Future>>> getBatchHistory( - {required Map>? args}) => - (super.noSuchMethod( - Invocation.method( - #getBatchHistory, - [], - {#args: args}, - ), - returnValue: _i11.Future>>>.value( - >>{}), - ) as _i11.Future>>>); - @override - _i11.Future>> getUTXOs({ - required String? scripthash, - String? requestID, - }) => - (super.noSuchMethod( - Invocation.method( - #getUTXOs, - [], - { - #scripthash: scripthash, - #requestID: requestID, - }, - ), - returnValue: _i11.Future>>.value( - >[]), - ) as _i11.Future>>); - @override - _i11.Future>>> getBatchUTXOs( - {required Map>? args}) => - (super.noSuchMethod( - Invocation.method( - #getBatchUTXOs, - [], - {#args: args}, - ), - returnValue: _i11.Future>>>.value( - >>{}), - ) as _i11.Future>>>); - @override - _i11.Future> getTransaction({ - required String? txHash, - bool? verbose = true, - String? requestID, - }) => - (super.noSuchMethod( - Invocation.method( - #getTransaction, - [], - { - #txHash: txHash, - #verbose: verbose, - #requestID: requestID, - }, - ), - returnValue: - _i11.Future>.value({}), - ) as _i11.Future>); - @override - _i11.Future> getAnonymitySet({ - String? groupId = r'1', - String? blockhash = r'', - String? requestID, - }) => - (super.noSuchMethod( - Invocation.method( - #getAnonymitySet, - [], - { - #groupId: groupId, - #blockhash: blockhash, - #requestID: requestID, - }, - ), - returnValue: - _i11.Future>.value({}), - ) as _i11.Future>); - @override - _i11.Future getMintData({ - dynamic mints, - String? requestID, - }) => - (super.noSuchMethod( - Invocation.method( - #getMintData, - [], - { - #mints: mints, - #requestID: requestID, - }, - ), - returnValue: _i11.Future.value(), - ) as _i11.Future); - @override - _i11.Future> getUsedCoinSerials({ - String? requestID, - required int? startNumber, - }) => - (super.noSuchMethod( - Invocation.method( - #getUsedCoinSerials, - [], - { - #requestID: requestID, - #startNumber: startNumber, - }, - ), - returnValue: - _i11.Future>.value({}), - ) as _i11.Future>); - @override - _i11.Future getLatestCoinId({String? requestID}) => (super.noSuchMethod( - Invocation.method( - #getLatestCoinId, - [], - {#requestID: requestID}, - ), - returnValue: _i11.Future.value(0), - ) as _i11.Future); - @override - _i11.Future> getFeeRate({String? requestID}) => - (super.noSuchMethod( - Invocation.method( - #getFeeRate, - [], - {#requestID: requestID}, - ), - returnValue: - _i11.Future>.value({}), - ) as _i11.Future>); - @override - _i11.Future<_i9.Decimal> estimateFee({ - String? requestID, - required int? blocks, - }) => - (super.noSuchMethod( - Invocation.method( - #estimateFee, - [], - { - #requestID: requestID, - #blocks: blocks, - }, - ), - returnValue: _i11.Future<_i9.Decimal>.value(_FakeDecimal_7( - this, - Invocation.method( - #estimateFee, - [], - { - #requestID: requestID, - #blocks: blocks, - }, - ), - )), - ) as _i11.Future<_i9.Decimal>); - @override - _i11.Future<_i9.Decimal> relayFee({String? requestID}) => (super.noSuchMethod( - Invocation.method( - #relayFee, - [], - {#requestID: requestID}, - ), - returnValue: _i11.Future<_i9.Decimal>.value(_FakeDecimal_7( - this, - Invocation.method( - #relayFee, - [], - {#requestID: requestID}, - ), - )), - ) as _i11.Future<_i9.Decimal>); -} diff --git a/test/services/node_service_test.dart b/test/services/node_service_test.dart index 1c5f53aa7..4439e44b2 100644 --- a/test/services/node_service_test.dart +++ b/test/services/node_service_test.dart @@ -1,7 +1,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:hive/hive.dart'; import 'package:hive_test/hive_test.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/models/node_model.dart'; import 'package:stackduo/services/node_service.dart'; import 'package:stackduo/utilities/default_nodes.dart'; diff --git a/test/services/wallets_service_test.dart b/test/services/wallets_service_test.dart index eb598a0d9..b60e33160 100644 --- a/test/services/wallets_service_test.dart +++ b/test/services/wallets_service_test.dart @@ -2,7 +2,7 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:hive/hive.dart'; import 'package:hive_test/hive_test.dart'; import 'package:mockito/annotations.dart'; -import 'package:stackduo/hive/db.dart'; +import 'package:stackduo/db/hive/db.dart'; import 'package:stackduo/services/wallets_service.dart'; import 'package:stackduo/utilities/enums/coin_enum.dart'; import 'package:stackduo/utilities/flutter_secure_storage_interface.dart'; diff --git a/test/services/wallets_service_test.mocks.dart b/test/services/wallets_service_test.mocks.dart index e9f219940..f3caf16e4 100644 --- a/test/services/wallets_service_test.mocks.dart +++ b/test/services/wallets_service_test.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/services/wallets_service_test.dart. // Do not manually edit this file. diff --git a/test/widget_tests/address_book_card_test.mocks.dart b/test/widget_tests/address_book_card_test.mocks.dart index 186bb028b..9b66437f8 100644 --- a/test/widget_tests/address_book_card_test.mocks.dart +++ b/test/widget_tests/address_book_card_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/widget_tests/address_book_card_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i4; -import 'dart:ui' as _i5; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/isar/models/contact_entry.dart' as _i2; @@ -116,7 +115,7 @@ class MockAddressBookService extends _i1.Mock returnValueForMissingStub: _i4.Future.value(), ) as _i4.Future); @override - void addListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -124,7 +123,7 @@ class MockAddressBookService extends _i1.Mock returnValueForMissingStub: null, ); @override - void removeListener(_i5.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/widget_tests/custom_buttons/favorite_toggle_test.mocks.dart b/test/widget_tests/custom_buttons/favorite_toggle_test.mocks.dart deleted file mode 100644 index 59e02607b..000000000 --- a/test/widget_tests/custom_buttons/favorite_toggle_test.mocks.dart +++ /dev/null @@ -1,131 +0,0 @@ -// Mocks generated by Mockito 5.3.2 from annotations -// in stackwallet/test/widget_tests/custom_buttons/favorite_toggle_test.dart. -// Do not manually edit this file. - -// ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i5; -import 'dart:typed_data' as _i6; - -import 'package:mockito/mockito.dart' as _i1; -import 'package:stackwallet/db/isar/main_db.dart' as _i2; -import 'package:stackwallet/models/isar/stack_theme.dart' as _i4; -import 'package:stackwallet/themes/theme_service.dart' as _i3; - -// ignore_for_file: type=lint -// ignore_for_file: avoid_redundant_argument_values -// ignore_for_file: avoid_setters_without_getters -// ignore_for_file: comment_references -// ignore_for_file: implementation_imports -// ignore_for_file: invalid_use_of_visible_for_testing_member -// ignore_for_file: prefer_const_constructors -// ignore_for_file: unnecessary_parenthesis -// ignore_for_file: camel_case_types -// ignore_for_file: subtype_of_sealed_class - -class _FakeMainDB_0 extends _i1.SmartFake implements _i2.MainDB { - _FakeMainDB_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -/// A class which mocks [ThemeService]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockThemeService extends _i1.Mock implements _i3.ThemeService { - MockThemeService() { - _i1.throwOnMissingStub(this); - } - - @override - _i2.MainDB get db => (super.noSuchMethod( - Invocation.getter(#db), - returnValue: _FakeMainDB_0( - this, - Invocation.getter(#db), - ), - ) as _i2.MainDB); - @override - List<_i4.StackTheme> get installedThemes => (super.noSuchMethod( - Invocation.getter(#installedThemes), - returnValue: <_i4.StackTheme>[], - ) as List<_i4.StackTheme>); - @override - void init(_i2.MainDB? db) => super.noSuchMethod( - Invocation.method( - #init, - [db], - ), - returnValueForMissingStub: null, - ); - @override - _i5.Future install({required _i6.Uint8List? themeArchiveData}) => - (super.noSuchMethod( - Invocation.method( - #install, - [], - {#themeArchiveData: themeArchiveData}, - ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); - @override - _i5.Future remove({required String? themeId}) => (super.noSuchMethod( - Invocation.method( - #remove, - [], - {#themeId: themeId}, - ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); - @override - _i5.Future checkDefaultThemesOnStartup() => (super.noSuchMethod( - Invocation.method( - #checkDefaultThemesOnStartup, - [], - ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); - @override - _i5.Future verifyInstalled({required String? themeId}) => - (super.noSuchMethod( - Invocation.method( - #verifyInstalled, - [], - {#themeId: themeId}, - ), - returnValue: _i5.Future.value(false), - ) as _i5.Future); - @override - _i5.Future> fetchThemes() => (super.noSuchMethod( - Invocation.method( - #fetchThemes, - [], - ), - returnValue: _i5.Future>.value( - <_i3.StackThemeMetaData>[]), - ) as _i5.Future>); - @override - _i5.Future<_i6.Uint8List> fetchTheme( - {required _i3.StackThemeMetaData? themeMetaData}) => - (super.noSuchMethod( - Invocation.method( - #fetchTheme, - [], - {#themeMetaData: themeMetaData}, - ), - returnValue: _i5.Future<_i6.Uint8List>.value(_i6.Uint8List(0)), - ) as _i5.Future<_i6.Uint8List>); - @override - _i4.StackTheme? getTheme({required String? themeId}) => - (super.noSuchMethod(Invocation.method( - #getTheme, - [], - {#themeId: themeId}, - )) as _i4.StackTheme?); -} diff --git a/test/widget_tests/custom_loading_overlay_test.mocks.dart b/test/widget_tests/custom_loading_overlay_test.mocks.dart deleted file mode 100644 index f192714d8..000000000 --- a/test/widget_tests/custom_loading_overlay_test.mocks.dart +++ /dev/null @@ -1,131 +0,0 @@ -// Mocks generated by Mockito 5.3.2 from annotations -// in stackwallet/test/widget_tests/custom_loading_overlay_test.dart. -// Do not manually edit this file. - -// ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i5; -import 'dart:typed_data' as _i6; - -import 'package:mockito/mockito.dart' as _i1; -import 'package:stackwallet/db/isar/main_db.dart' as _i2; -import 'package:stackwallet/models/isar/stack_theme.dart' as _i4; -import 'package:stackwallet/themes/theme_service.dart' as _i3; - -// ignore_for_file: type=lint -// ignore_for_file: avoid_redundant_argument_values -// ignore_for_file: avoid_setters_without_getters -// ignore_for_file: comment_references -// ignore_for_file: implementation_imports -// ignore_for_file: invalid_use_of_visible_for_testing_member -// ignore_for_file: prefer_const_constructors -// ignore_for_file: unnecessary_parenthesis -// ignore_for_file: camel_case_types -// ignore_for_file: subtype_of_sealed_class - -class _FakeMainDB_0 extends _i1.SmartFake implements _i2.MainDB { - _FakeMainDB_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -/// A class which mocks [ThemeService]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockThemeService extends _i1.Mock implements _i3.ThemeService { - MockThemeService() { - _i1.throwOnMissingStub(this); - } - - @override - _i2.MainDB get db => (super.noSuchMethod( - Invocation.getter(#db), - returnValue: _FakeMainDB_0( - this, - Invocation.getter(#db), - ), - ) as _i2.MainDB); - @override - List<_i4.StackTheme> get installedThemes => (super.noSuchMethod( - Invocation.getter(#installedThemes), - returnValue: <_i4.StackTheme>[], - ) as List<_i4.StackTheme>); - @override - void init(_i2.MainDB? db) => super.noSuchMethod( - Invocation.method( - #init, - [db], - ), - returnValueForMissingStub: null, - ); - @override - _i5.Future install({required _i6.Uint8List? themeArchiveData}) => - (super.noSuchMethod( - Invocation.method( - #install, - [], - {#themeArchiveData: themeArchiveData}, - ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); - @override - _i5.Future remove({required String? themeId}) => (super.noSuchMethod( - Invocation.method( - #remove, - [], - {#themeId: themeId}, - ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); - @override - _i5.Future checkDefaultThemesOnStartup() => (super.noSuchMethod( - Invocation.method( - #checkDefaultThemesOnStartup, - [], - ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); - @override - _i5.Future verifyInstalled({required String? themeId}) => - (super.noSuchMethod( - Invocation.method( - #verifyInstalled, - [], - {#themeId: themeId}, - ), - returnValue: _i5.Future.value(false), - ) as _i5.Future); - @override - _i5.Future> fetchThemes() => (super.noSuchMethod( - Invocation.method( - #fetchThemes, - [], - ), - returnValue: _i5.Future>.value( - <_i3.StackThemeMetaData>[]), - ) as _i5.Future>); - @override - _i5.Future<_i6.Uint8List> fetchTheme( - {required _i3.StackThemeMetaData? themeMetaData}) => - (super.noSuchMethod( - Invocation.method( - #fetchTheme, - [], - {#themeMetaData: themeMetaData}, - ), - returnValue: _i5.Future<_i6.Uint8List>.value(_i6.Uint8List(0)), - ) as _i5.Future<_i6.Uint8List>); - @override - _i4.StackTheme? getTheme({required String? themeId}) => - (super.noSuchMethod(Invocation.method( - #getTheme, - [], - {#themeId: themeId}, - )) as _i4.StackTheme?); -} diff --git a/test/widget_tests/desktop/desktop_scaffold_test.mocks.dart b/test/widget_tests/desktop/desktop_scaffold_test.mocks.dart deleted file mode 100644 index 5972c21c2..000000000 --- a/test/widget_tests/desktop/desktop_scaffold_test.mocks.dart +++ /dev/null @@ -1,131 +0,0 @@ -// Mocks generated by Mockito 5.3.2 from annotations -// in stackwallet/test/widget_tests/desktop/desktop_scaffold_test.dart. -// Do not manually edit this file. - -// ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i5; -import 'dart:typed_data' as _i6; - -import 'package:mockito/mockito.dart' as _i1; -import 'package:stackwallet/db/isar/main_db.dart' as _i2; -import 'package:stackwallet/models/isar/stack_theme.dart' as _i4; -import 'package:stackwallet/themes/theme_service.dart' as _i3; - -// ignore_for_file: type=lint -// ignore_for_file: avoid_redundant_argument_values -// ignore_for_file: avoid_setters_without_getters -// ignore_for_file: comment_references -// ignore_for_file: implementation_imports -// ignore_for_file: invalid_use_of_visible_for_testing_member -// ignore_for_file: prefer_const_constructors -// ignore_for_file: unnecessary_parenthesis -// ignore_for_file: camel_case_types -// ignore_for_file: subtype_of_sealed_class - -class _FakeMainDB_0 extends _i1.SmartFake implements _i2.MainDB { - _FakeMainDB_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -/// A class which mocks [ThemeService]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockThemeService extends _i1.Mock implements _i3.ThemeService { - MockThemeService() { - _i1.throwOnMissingStub(this); - } - - @override - _i2.MainDB get db => (super.noSuchMethod( - Invocation.getter(#db), - returnValue: _FakeMainDB_0( - this, - Invocation.getter(#db), - ), - ) as _i2.MainDB); - @override - List<_i4.StackTheme> get installedThemes => (super.noSuchMethod( - Invocation.getter(#installedThemes), - returnValue: <_i4.StackTheme>[], - ) as List<_i4.StackTheme>); - @override - void init(_i2.MainDB? db) => super.noSuchMethod( - Invocation.method( - #init, - [db], - ), - returnValueForMissingStub: null, - ); - @override - _i5.Future install({required _i6.Uint8List? themeArchiveData}) => - (super.noSuchMethod( - Invocation.method( - #install, - [], - {#themeArchiveData: themeArchiveData}, - ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); - @override - _i5.Future remove({required String? themeId}) => (super.noSuchMethod( - Invocation.method( - #remove, - [], - {#themeId: themeId}, - ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); - @override - _i5.Future checkDefaultThemesOnStartup() => (super.noSuchMethod( - Invocation.method( - #checkDefaultThemesOnStartup, - [], - ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); - @override - _i5.Future verifyInstalled({required String? themeId}) => - (super.noSuchMethod( - Invocation.method( - #verifyInstalled, - [], - {#themeId: themeId}, - ), - returnValue: _i5.Future.value(false), - ) as _i5.Future); - @override - _i5.Future> fetchThemes() => (super.noSuchMethod( - Invocation.method( - #fetchThemes, - [], - ), - returnValue: _i5.Future>.value( - <_i3.StackThemeMetaData>[]), - ) as _i5.Future>); - @override - _i5.Future<_i6.Uint8List> fetchTheme( - {required _i3.StackThemeMetaData? themeMetaData}) => - (super.noSuchMethod( - Invocation.method( - #fetchTheme, - [], - {#themeMetaData: themeMetaData}, - ), - returnValue: _i5.Future<_i6.Uint8List>.value(_i6.Uint8List(0)), - ) as _i5.Future<_i6.Uint8List>); - @override - _i4.StackTheme? getTheme({required String? themeId}) => - (super.noSuchMethod(Invocation.method( - #getTheme, - [], - {#themeId: themeId}, - )) as _i4.StackTheme?); -} diff --git a/test/widget_tests/managed_favorite_test.mocks.dart b/test/widget_tests/managed_favorite_test.mocks.dart index 5bd694533..0984ce454 100644 --- a/test/widget_tests/managed_favorite_test.mocks.dart +++ b/test/widget_tests/managed_favorite_test.mocks.dart @@ -1,11 +1,10 @@ -// Mocks generated by Mockito 5.3.2 from annotations -// in stackwallet/test/widget_tests/managed_favorite_test.dart. +// Mocks generated by Mockito 5.4.2 from annotations +// in stackduo/test/widget_tests/managed_favorite_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i23; -import 'dart:typed_data' as _i29; -import 'dart:ui' as _i25; +import 'dart:typed_data' as _i28; import 'package:bip32/bip32.dart' as _i16; import 'package:bip47/bip47.dart' as _i18; @@ -13,31 +12,28 @@ import 'package:bitcoindart/bitcoindart.dart' as _i13; import 'package:flutter/foundation.dart' as _i4; import 'package:flutter_riverpod/flutter_riverpod.dart' as _i5; import 'package:mockito/mockito.dart' as _i1; -import 'package:stackwallet/db/isar/main_db.dart' as _i12; -import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i10; -import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i9; -import 'package:stackwallet/models/balance.dart' as _i11; -import 'package:stackwallet/models/isar/models/isar_models.dart' as _i17; -import 'package:stackwallet/models/isar/stack_theme.dart' as _i31; -import 'package:stackwallet/models/node_model.dart' as _i33; -import 'package:stackwallet/models/paymint/fee_object_model.dart' as _i8; -import 'package:stackwallet/models/signing_data.dart' as _i28; -import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart' as _i26; -import 'package:stackwallet/services/coins/coin_service.dart' as _i20; -import 'package:stackwallet/services/coins/manager.dart' as _i6; -import 'package:stackwallet/services/locale_service.dart' as _i32; -import 'package:stackwallet/services/node_service.dart' as _i3; -import 'package:stackwallet/services/transaction_notification_tracker.dart' - as _i7; -import 'package:stackwallet/services/wallets.dart' as _i21; -import 'package:stackwallet/services/wallets_service.dart' as _i2; -import 'package:stackwallet/themes/theme_service.dart' as _i30; -import 'package:stackwallet/utilities/amount/amount.dart' as _i14; -import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i22; -import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart' as _i27; -import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart' +import 'package:stackduo/db/isar/main_db.dart' as _i12; +import 'package:stackduo/electrumx_rpc/cached_electrumx.dart' as _i10; +import 'package:stackduo/electrumx_rpc/electrumx.dart' as _i9; +import 'package:stackduo/models/balance.dart' as _i11; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i17; +import 'package:stackduo/models/node_model.dart' as _i30; +import 'package:stackduo/models/paymint/fee_object_model.dart' as _i8; +import 'package:stackduo/models/signing_data.dart' as _i27; +import 'package:stackduo/services/coins/bitcoin/bitcoin_wallet.dart' as _i25; +import 'package:stackduo/services/coins/coin_service.dart' as _i20; +import 'package:stackduo/services/coins/manager.dart' as _i6; +import 'package:stackduo/services/locale_service.dart' as _i29; +import 'package:stackduo/services/node_service.dart' as _i3; +import 'package:stackduo/services/transaction_notification_tracker.dart' as _i7; +import 'package:stackduo/services/wallets.dart' as _i21; +import 'package:stackduo/services/wallets_service.dart' as _i2; +import 'package:stackduo/utilities/amount/amount.dart' as _i14; +import 'package:stackduo/utilities/enums/coin_enum.dart' as _i22; +import 'package:stackduo/utilities/enums/derive_path_type_enum.dart' as _i26; +import 'package:stackduo/utilities/flutter_secure_storage_interface.dart' as _i19; -import 'package:stackwallet/utilities/prefs.dart' as _i24; +import 'package:stackduo/utilities/prefs.dart' as _i24; import 'package:tuple/tuple.dart' as _i15; // ignore_for_file: type=lint @@ -431,7 +427,7 @@ class MockWallets extends _i1.Mock implements _i21.Wallets { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -439,7 +435,7 @@ class MockWallets extends _i1.Mock implements _i21.Wallets { returnValueForMissingStub: null, ); @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -657,7 +653,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -665,7 +661,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -693,7 +689,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { /// A class which mocks [BitcoinWallet]. /// /// See the documentation for Mockito's code generation for more information. -class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { +class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet { MockBitcoinWallet() { _i1.throwOnMissingStub(this); } @@ -954,15 +950,15 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - _i27.DerivePathType addressType({required String? address}) => + _i26.DerivePathType addressType({required String? address}) => (super.noSuchMethod( Invocation.method( #addressType, [], {#address: address}, ), - returnValue: _i27.DerivePathType.bip44, - ) as _i27.DerivePathType); + returnValue: _i26.DerivePathType.bip44, + ) as _i26.DerivePathType); @override _i23.Future recoverFromMnemonic({ required String? mnemonic, @@ -1198,6 +1194,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { required String? recipientAddress, required bool? coinControl, required bool? isSendAll, + int? satsPerVByte, int? additionalOutputs = 0, List<_i17.UTXO>? utxos, }) => @@ -1210,12 +1207,13 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { #recipientAddress: recipientAddress, #coinControl: coinControl, #isSendAll: isSendAll, + #satsPerVByte: satsPerVByte, #additionalOutputs: additionalOutputs, #utxos: utxos, }, )); @override - _i23.Future> fetchBuildTxData( + _i23.Future> fetchBuildTxData( List<_i17.UTXO>? utxosToUse) => (super.noSuchMethod( Invocation.method( @@ -1223,11 +1221,11 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { [utxosToUse], ), returnValue: - _i23.Future>.value(<_i28.SigningData>[]), - ) as _i23.Future>); + _i23.Future>.value(<_i27.SigningData>[]), + ) as _i23.Future>); @override _i23.Future> buildTransaction({ - required List<_i28.SigningData>? utxoSigningData, + required List<_i27.SigningData>? utxoSigningData, required List? recipients, required List? satoshiAmounts, }) => @@ -1442,25 +1440,6 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - List getWalletTokenContractAddresses() => (super.noSuchMethod( - Invocation.method( - #getWalletTokenContractAddresses, - [], - ), - returnValue: [], - ) as List); - @override - _i23.Future updateWalletTokenContractAddresses( - List? contractAddresses) => - (super.noSuchMethod( - Invocation.method( - #updateWalletTokenContractAddresses, - [contractAddresses], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override void initWalletDB({_i12.MainDB? mockableOverride}) => super.noSuchMethod( Invocation.method( #initWalletDB, @@ -1535,7 +1514,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { })? prepareSend, required _i23.Future Function({required String address})? getTxCount, - required _i23.Future> Function(List<_i17.UTXO>)? + required _i23.Future> Function(List<_i17.UTXO>)? fetchBuildTxData, required _i23.Future Function()? refresh, required _i23.Future Function()? checkChangeAddressForTransactions, @@ -1585,7 +1564,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { )), ) as _i23.Future<_i16.BIP32>); @override - _i23.Future<_i29.Uint8List> getPrivateKeyForPaynymReceivingAddress({ + _i23.Future<_i28.Uint8List> getPrivateKeyForPaynymReceivingAddress({ required String? paymentCodeString, required int? index, }) => @@ -1598,8 +1577,8 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { #index: index, }, ), - returnValue: _i23.Future<_i29.Uint8List>.value(_i29.Uint8List(0)), - ) as _i23.Future<_i29.Uint8List>); + returnValue: _i23.Future<_i28.Uint8List>.value(_i28.Uint8List(0)), + ) as _i23.Future<_i28.Uint8List>); @override _i23.Future<_i17.Address> currentReceivingPaynymAddress({ required _i18.PaymentCode? sender, @@ -1685,14 +1664,14 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { )), ) as _i23.Future<_i18.PaymentCode>); @override - _i23.Future<_i29.Uint8List> signWithNotificationKey(_i29.Uint8List? data) => + _i23.Future<_i28.Uint8List> signWithNotificationKey(_i28.Uint8List? data) => (super.noSuchMethod( Invocation.method( #signWithNotificationKey, [data], ), - returnValue: _i23.Future<_i29.Uint8List>.value(_i29.Uint8List(0)), - ) as _i23.Future<_i29.Uint8List>); + returnValue: _i23.Future<_i28.Uint8List>.value(_i28.Uint8List(0)), + ) as _i23.Future<_i28.Uint8List>); @override _i23.Future signStringWithNotificationKey(String? data) => (super.noSuchMethod( @@ -1957,109 +1936,10 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { ) as _i23.Future); } -/// A class which mocks [ThemeService]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockThemeService extends _i1.Mock implements _i30.ThemeService { - MockThemeService() { - _i1.throwOnMissingStub(this); - } - - @override - _i12.MainDB get db => (super.noSuchMethod( - Invocation.getter(#db), - returnValue: _FakeMainDB_9( - this, - Invocation.getter(#db), - ), - ) as _i12.MainDB); - @override - List<_i31.StackTheme> get installedThemes => (super.noSuchMethod( - Invocation.getter(#installedThemes), - returnValue: <_i31.StackTheme>[], - ) as List<_i31.StackTheme>); - @override - void init(_i12.MainDB? db) => super.noSuchMethod( - Invocation.method( - #init, - [db], - ), - returnValueForMissingStub: null, - ); - @override - _i23.Future install({required _i29.Uint8List? themeArchiveData}) => - (super.noSuchMethod( - Invocation.method( - #install, - [], - {#themeArchiveData: themeArchiveData}, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future remove({required String? themeId}) => (super.noSuchMethod( - Invocation.method( - #remove, - [], - {#themeId: themeId}, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future checkDefaultThemesOnStartup() => (super.noSuchMethod( - Invocation.method( - #checkDefaultThemesOnStartup, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future verifyInstalled({required String? themeId}) => - (super.noSuchMethod( - Invocation.method( - #verifyInstalled, - [], - {#themeId: themeId}, - ), - returnValue: _i23.Future.value(false), - ) as _i23.Future); - @override - _i23.Future> fetchThemes() => - (super.noSuchMethod( - Invocation.method( - #fetchThemes, - [], - ), - returnValue: _i23.Future>.value( - <_i30.StackThemeMetaData>[]), - ) as _i23.Future>); - @override - _i23.Future<_i29.Uint8List> fetchTheme( - {required _i30.StackThemeMetaData? themeMetaData}) => - (super.noSuchMethod( - Invocation.method( - #fetchTheme, - [], - {#themeMetaData: themeMetaData}, - ), - returnValue: _i23.Future<_i29.Uint8List>.value(_i29.Uint8List(0)), - ) as _i23.Future<_i29.Uint8List>); - @override - _i31.StackTheme? getTheme({required String? themeId}) => - (super.noSuchMethod(Invocation.method( - #getTheme, - [], - {#themeId: themeId}, - )) as _i31.StackTheme?); -} - /// A class which mocks [LocaleService]. /// /// See the documentation for Mockito's code generation for more information. -class MockLocaleService extends _i1.Mock implements _i32.LocaleService { +class MockLocaleService extends _i1.Mock implements _i29.LocaleService { MockLocaleService() { _i1.throwOnMissingStub(this); } @@ -2085,7 +1965,7 @@ class MockLocaleService extends _i1.Mock implements _i32.LocaleService { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -2093,7 +1973,7 @@ class MockLocaleService extends _i1.Mock implements _i32.LocaleService { returnValueForMissingStub: null, ); @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -2131,15 +2011,15 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { ), ) as _i19.SecureStorageInterface); @override - List<_i33.NodeModel> get primaryNodes => (super.noSuchMethod( + List<_i30.NodeModel> get primaryNodes => (super.noSuchMethod( Invocation.getter(#primaryNodes), - returnValue: <_i33.NodeModel>[], - ) as List<_i33.NodeModel>); + returnValue: <_i30.NodeModel>[], + ) as List<_i30.NodeModel>); @override - List<_i33.NodeModel> get nodes => (super.noSuchMethod( + List<_i30.NodeModel> get nodes => (super.noSuchMethod( Invocation.getter(#nodes), - returnValue: <_i33.NodeModel>[], - ) as List<_i33.NodeModel>); + returnValue: <_i30.NodeModel>[], + ) as List<_i30.NodeModel>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), @@ -2157,7 +2037,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { @override _i23.Future setPrimaryNodeFor({ required _i22.Coin? coin, - required _i33.NodeModel? node, + required _i30.NodeModel? node, bool? shouldNotifyListeners = false, }) => (super.noSuchMethod( @@ -2174,40 +2054,40 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - _i33.NodeModel? getPrimaryNodeFor({required _i22.Coin? coin}) => + _i30.NodeModel? getPrimaryNodeFor({required _i22.Coin? coin}) => (super.noSuchMethod(Invocation.method( #getPrimaryNodeFor, [], {#coin: coin}, - )) as _i33.NodeModel?); + )) as _i30.NodeModel?); @override - List<_i33.NodeModel> getNodesFor(_i22.Coin? coin) => (super.noSuchMethod( + List<_i30.NodeModel> getNodesFor(_i22.Coin? coin) => (super.noSuchMethod( Invocation.method( #getNodesFor, [coin], ), - returnValue: <_i33.NodeModel>[], - ) as List<_i33.NodeModel>); + returnValue: <_i30.NodeModel>[], + ) as List<_i30.NodeModel>); @override - _i33.NodeModel? getNodeById({required String? id}) => + _i30.NodeModel? getNodeById({required String? id}) => (super.noSuchMethod(Invocation.method( #getNodeById, [], {#id: id}, - )) as _i33.NodeModel?); + )) as _i30.NodeModel?); @override - List<_i33.NodeModel> failoverNodesFor({required _i22.Coin? coin}) => + List<_i30.NodeModel> failoverNodesFor({required _i22.Coin? coin}) => (super.noSuchMethod( Invocation.method( #failoverNodesFor, [], {#coin: coin}, ), - returnValue: <_i33.NodeModel>[], - ) as List<_i33.NodeModel>); + returnValue: <_i30.NodeModel>[], + ) as List<_i30.NodeModel>); @override _i23.Future add( - _i33.NodeModel? node, + _i30.NodeModel? node, String? password, bool? shouldNotifyListeners, ) => @@ -2259,7 +2139,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { ) as _i23.Future); @override _i23.Future edit( - _i33.NodeModel? editedNode, + _i30.NodeModel? editedNode, String? password, bool? shouldNotifyListeners, ) => @@ -2285,7 +2165,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -2293,7 +2173,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: null, ); @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -2678,7 +2558,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -2686,7 +2566,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/widget_tests/node_card_test.mocks.dart b/test/widget_tests/node_card_test.mocks.dart index 59c032c4c..790991f1e 100644 --- a/test/widget_tests/node_card_test.mocks.dart +++ b/test/widget_tests/node_card_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/widget_tests/node_card_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i5; -import 'dart:ui' as _i7; import 'package:mockito/mockito.dart' as _i1; import 'package:stackduo/models/node_model.dart' as _i4; @@ -206,7 +205,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); @override - void addListener(_i7.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -214,7 +213,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: null, ); @override - void removeListener(_i7.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/widget_tests/node_options_sheet_test.mocks.dart b/test/widget_tests/node_options_sheet_test.mocks.dart index 56bfe6949..03ca0e9fa 100644 --- a/test/widget_tests/node_options_sheet_test.mocks.dart +++ b/test/widget_tests/node_options_sheet_test.mocks.dart @@ -1,10 +1,9 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/widget_tests/node_options_sheet_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i11; -import 'dart:ui' as _i13; import 'package:flutter/foundation.dart' as _i4; import 'package:flutter_riverpod/flutter_riverpod.dart' as _i5; @@ -14,9 +13,10 @@ import 'package:stackduo/services/coins/manager.dart' as _i6; import 'package:stackduo/services/node_service.dart' as _i3; import 'package:stackduo/services/wallets.dart' as _i8; import 'package:stackduo/services/wallets_service.dart' as _i2; -import 'package:stackduo/utilities/enums/backup_frequency_type.dart' as _i15; +import 'package:stackduo/utilities/amount/amount_unit.dart' as _i15; +import 'package:stackduo/utilities/enums/backup_frequency_type.dart' as _i14; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i9; -import 'package:stackduo/utilities/enums/sync_type_enum.dart' as _i14; +import 'package:stackduo/utilities/enums/sync_type_enum.dart' as _i13; import 'package:stackduo/utilities/flutter_secure_storage_interface.dart' as _i7; import 'package:stackduo/utilities/prefs.dart' as _i12; @@ -269,7 +269,7 @@ class MockWallets extends _i1.Mock implements _i8.Wallets { returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override - void addListener(_i13.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -277,7 +277,7 @@ class MockWallets extends _i1.Mock implements _i8.Wallets { returnValueForMissingStub: null, ); @override - void removeListener(_i13.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -353,12 +353,12 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { returnValueForMissingStub: null, ); @override - _i14.SyncingType get syncType => (super.noSuchMethod( + _i13.SyncingType get syncType => (super.noSuchMethod( Invocation.getter(#syncType), - returnValue: _i14.SyncingType.currentWalletOnly, - ) as _i14.SyncingType); + returnValue: _i13.SyncingType.currentWalletOnly, + ) as _i13.SyncingType); @override - set syncType(_i14.SyncingType? syncType) => super.noSuchMethod( + set syncType(_i13.SyncingType? syncType) => super.noSuchMethod( Invocation.setter( #syncType, syncType, @@ -504,12 +504,12 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { returnValueForMissingStub: null, ); @override - _i15.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod( + _i14.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod( Invocation.getter(#backupFrequencyType), - returnValue: _i15.BackupFrequencyType.everyTenMinutes, - ) as _i15.BackupFrequencyType); + returnValue: _i14.BackupFrequencyType.everyTenMinutes, + ) as _i14.BackupFrequencyType); @override - set backupFrequencyType(_i15.BackupFrequencyType? backupFrequencyType) => + set backupFrequencyType(_i14.BackupFrequencyType? backupFrequencyType) => super.noSuchMethod( Invocation.setter( #backupFrequencyType, @@ -691,7 +691,55 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override - void addListener(_i13.VoidCallback? listener) => super.noSuchMethod( + _i15.AmountUnit amountUnit(_i9.Coin? coin) => (super.noSuchMethod( + Invocation.method( + #amountUnit, + [coin], + ), + returnValue: _i15.AmountUnit.normal, + ) as _i15.AmountUnit); + @override + void updateAmountUnit({ + required _i9.Coin? coin, + required _i15.AmountUnit? amountUnit, + }) => + super.noSuchMethod( + Invocation.method( + #updateAmountUnit, + [], + { + #coin: coin, + #amountUnit: amountUnit, + }, + ), + returnValueForMissingStub: null, + ); + @override + int maxDecimals(_i9.Coin? coin) => (super.noSuchMethod( + Invocation.method( + #maxDecimals, + [coin], + ), + returnValue: 0, + ) as int); + @override + void updateMaxDecimals({ + required _i9.Coin? coin, + required int? maxDecimals, + }) => + super.noSuchMethod( + Invocation.method( + #updateMaxDecimals, + [], + { + #coin: coin, + #maxDecimals: maxDecimals, + }, + ), + returnValueForMissingStub: null, + ); + @override + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -699,7 +747,7 @@ class MockPrefs extends _i1.Mock implements _i12.Prefs { returnValueForMissingStub: null, ); @override - void removeListener(_i13.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -895,7 +943,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: _i11.Future.value(), ) as _i11.Future); @override - void addListener(_i13.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -903,7 +951,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: null, ); @override - void removeListener(_i13.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/widget_tests/table_view/table_view_row_test.mocks.dart b/test/widget_tests/table_view/table_view_row_test.mocks.dart index d86e3d82d..feca2694f 100644 --- a/test/widget_tests/table_view/table_view_row_test.mocks.dart +++ b/test/widget_tests/table_view/table_view_row_test.mocks.dart @@ -1,11 +1,10 @@ -// Mocks generated by Mockito 5.3.2 from annotations -// in stackwallet/test/widget_tests/table_view/table_view_row_test.dart. +// Mocks generated by Mockito 5.4.2 from annotations +// in stackduo/test/widget_tests/table_view/table_view_row_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i22; -import 'dart:typed_data' as _i27; -import 'dart:ui' as _i24; +import 'dart:typed_data' as _i28; import 'package:bip32/bip32.dart' as _i16; import 'package:bip47/bip47.dart' as _i18; @@ -13,29 +12,26 @@ import 'package:bitcoindart/bitcoindart.dart' as _i13; import 'package:flutter/foundation.dart' as _i4; import 'package:flutter_riverpod/flutter_riverpod.dart' as _i5; import 'package:mockito/mockito.dart' as _i1; -import 'package:stackwallet/db/isar/main_db.dart' as _i7; -import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i11; -import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i10; -import 'package:stackwallet/models/balance.dart' as _i12; -import 'package:stackwallet/models/isar/models/isar_models.dart' as _i17; -import 'package:stackwallet/models/isar/stack_theme.dart' as _i26; -import 'package:stackwallet/models/paymint/fee_object_model.dart' as _i9; -import 'package:stackwallet/models/signing_data.dart' as _i30; -import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart' as _i28; -import 'package:stackwallet/services/coins/coin_service.dart' as _i19; -import 'package:stackwallet/services/coins/manager.dart' as _i6; -import 'package:stackwallet/services/node_service.dart' as _i3; -import 'package:stackwallet/services/transaction_notification_tracker.dart' - as _i8; -import 'package:stackwallet/services/wallets.dart' as _i20; -import 'package:stackwallet/services/wallets_service.dart' as _i2; -import 'package:stackwallet/themes/theme_service.dart' as _i25; -import 'package:stackwallet/utilities/amount/amount.dart' as _i14; -import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i21; -import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart' as _i29; -import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart' - as _i31; -import 'package:stackwallet/utilities/prefs.dart' as _i23; +import 'package:stackduo/db/isar/main_db.dart' as _i12; +import 'package:stackduo/electrumx_rpc/cached_electrumx.dart' as _i10; +import 'package:stackduo/electrumx_rpc/electrumx.dart' as _i9; +import 'package:stackduo/models/balance.dart' as _i11; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i17; +import 'package:stackduo/models/paymint/fee_object_model.dart' as _i8; +import 'package:stackduo/models/signing_data.dart' as _i26; +import 'package:stackduo/services/coins/bitcoin/bitcoin_wallet.dart' as _i24; +import 'package:stackduo/services/coins/coin_service.dart' as _i19; +import 'package:stackduo/services/coins/manager.dart' as _i6; +import 'package:stackduo/services/node_service.dart' as _i3; +import 'package:stackduo/services/transaction_notification_tracker.dart' as _i7; +import 'package:stackduo/services/wallets.dart' as _i20; +import 'package:stackduo/services/wallets_service.dart' as _i2; +import 'package:stackduo/utilities/amount/amount.dart' as _i14; +import 'package:stackduo/utilities/enums/coin_enum.dart' as _i21; +import 'package:stackduo/utilities/enums/derive_path_type_enum.dart' as _i25; +import 'package:stackduo/utilities/flutter_secure_storage_interface.dart' + as _i27; +import 'package:stackduo/utilities/prefs.dart' as _i23; import 'package:tuple/tuple.dart' as _i15; // ignore_for_file: type=lint @@ -91,8 +87,9 @@ class _FakeManager_3 extends _i1.SmartFake implements _i6.Manager { ); } -class _FakeMainDB_4 extends _i1.SmartFake implements _i7.MainDB { - _FakeMainDB_4( +class _FakeTransactionNotificationTracker_4 extends _i1.SmartFake + implements _i7.TransactionNotificationTracker { + _FakeTransactionNotificationTracker_4( Object parent, Invocation parentInvocation, ) : super( @@ -101,9 +98,8 @@ class _FakeMainDB_4 extends _i1.SmartFake implements _i7.MainDB { ); } -class _FakeTransactionNotificationTracker_5 extends _i1.SmartFake - implements _i8.TransactionNotificationTracker { - _FakeTransactionNotificationTracker_5( +class _FakeFeeObject_5 extends _i1.SmartFake implements _i8.FeeObject { + _FakeFeeObject_5( Object parent, Invocation parentInvocation, ) : super( @@ -112,8 +108,8 @@ class _FakeTransactionNotificationTracker_5 extends _i1.SmartFake ); } -class _FakeFeeObject_6 extends _i1.SmartFake implements _i9.FeeObject { - _FakeFeeObject_6( +class _FakeElectrumX_6 extends _i1.SmartFake implements _i9.ElectrumX { + _FakeElectrumX_6( Object parent, Invocation parentInvocation, ) : super( @@ -122,8 +118,9 @@ class _FakeFeeObject_6 extends _i1.SmartFake implements _i9.FeeObject { ); } -class _FakeElectrumX_7 extends _i1.SmartFake implements _i10.ElectrumX { - _FakeElectrumX_7( +class _FakeCachedElectrumX_7 extends _i1.SmartFake + implements _i10.CachedElectrumX { + _FakeCachedElectrumX_7( Object parent, Invocation parentInvocation, ) : super( @@ -132,9 +129,8 @@ class _FakeElectrumX_7 extends _i1.SmartFake implements _i10.ElectrumX { ); } -class _FakeCachedElectrumX_8 extends _i1.SmartFake - implements _i11.CachedElectrumX { - _FakeCachedElectrumX_8( +class _FakeBalance_8 extends _i1.SmartFake implements _i11.Balance { + _FakeBalance_8( Object parent, Invocation parentInvocation, ) : super( @@ -143,8 +139,8 @@ class _FakeCachedElectrumX_8 extends _i1.SmartFake ); } -class _FakeBalance_9 extends _i1.SmartFake implements _i12.Balance { - _FakeBalance_9( +class _FakeMainDB_9 extends _i1.SmartFake implements _i12.MainDB { + _FakeMainDB_9( Object parent, Invocation parentInvocation, ) : super( @@ -163,8 +159,7 @@ class _FakeNetworkType_10 extends _i1.SmartFake implements _i13.NetworkType { ); } -class _FakeElectrumXNode_11 extends _i1.SmartFake - implements _i10.ElectrumXNode { +class _FakeElectrumXNode_11 extends _i1.SmartFake implements _i9.ElectrumXNode { _FakeElectrumXNode_11( Object parent, Invocation parentInvocation, @@ -419,7 +414,7 @@ class MockWallets extends _i1.Mock implements _i20.Wallets { returnValueForMissingStub: _i22.Future.value(), ) as _i22.Future); @override - void addListener(_i24.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -427,7 +422,7 @@ class MockWallets extends _i1.Mock implements _i20.Wallets { returnValueForMissingStub: null, ); @override - void removeListener(_i24.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -645,7 +640,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { returnValueForMissingStub: _i22.Future.value(), ) as _i22.Future); @override - void addListener(_i24.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -653,7 +648,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i24.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -678,109 +673,10 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { ); } -/// A class which mocks [ThemeService]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockThemeService extends _i1.Mock implements _i25.ThemeService { - MockThemeService() { - _i1.throwOnMissingStub(this); - } - - @override - _i7.MainDB get db => (super.noSuchMethod( - Invocation.getter(#db), - returnValue: _FakeMainDB_4( - this, - Invocation.getter(#db), - ), - ) as _i7.MainDB); - @override - List<_i26.StackTheme> get installedThemes => (super.noSuchMethod( - Invocation.getter(#installedThemes), - returnValue: <_i26.StackTheme>[], - ) as List<_i26.StackTheme>); - @override - void init(_i7.MainDB? db) => super.noSuchMethod( - Invocation.method( - #init, - [db], - ), - returnValueForMissingStub: null, - ); - @override - _i22.Future install({required _i27.Uint8List? themeArchiveData}) => - (super.noSuchMethod( - Invocation.method( - #install, - [], - {#themeArchiveData: themeArchiveData}, - ), - returnValue: _i22.Future.value(), - returnValueForMissingStub: _i22.Future.value(), - ) as _i22.Future); - @override - _i22.Future remove({required String? themeId}) => (super.noSuchMethod( - Invocation.method( - #remove, - [], - {#themeId: themeId}, - ), - returnValue: _i22.Future.value(), - returnValueForMissingStub: _i22.Future.value(), - ) as _i22.Future); - @override - _i22.Future checkDefaultThemesOnStartup() => (super.noSuchMethod( - Invocation.method( - #checkDefaultThemesOnStartup, - [], - ), - returnValue: _i22.Future.value(), - returnValueForMissingStub: _i22.Future.value(), - ) as _i22.Future); - @override - _i22.Future verifyInstalled({required String? themeId}) => - (super.noSuchMethod( - Invocation.method( - #verifyInstalled, - [], - {#themeId: themeId}, - ), - returnValue: _i22.Future.value(false), - ) as _i22.Future); - @override - _i22.Future> fetchThemes() => - (super.noSuchMethod( - Invocation.method( - #fetchThemes, - [], - ), - returnValue: _i22.Future>.value( - <_i25.StackThemeMetaData>[]), - ) as _i22.Future>); - @override - _i22.Future<_i27.Uint8List> fetchTheme( - {required _i25.StackThemeMetaData? themeMetaData}) => - (super.noSuchMethod( - Invocation.method( - #fetchTheme, - [], - {#themeMetaData: themeMetaData}, - ), - returnValue: _i22.Future<_i27.Uint8List>.value(_i27.Uint8List(0)), - ) as _i22.Future<_i27.Uint8List>); - @override - _i26.StackTheme? getTheme({required String? themeId}) => - (super.noSuchMethod(Invocation.method( - #getTheme, - [], - {#themeId: themeId}, - )) as _i26.StackTheme?); -} - /// A class which mocks [BitcoinWallet]. /// /// See the documentation for Mockito's code generation for more information. -class MockBitcoinWallet extends _i1.Mock implements _i28.BitcoinWallet { +class MockBitcoinWallet extends _i1.Mock implements _i24.BitcoinWallet { MockBitcoinWallet() { _i1.throwOnMissingStub(this); } @@ -794,15 +690,15 @@ class MockBitcoinWallet extends _i1.Mock implements _i28.BitcoinWallet { returnValueForMissingStub: null, ); @override - _i8.TransactionNotificationTracker get txTracker => (super.noSuchMethod( + _i7.TransactionNotificationTracker get txTracker => (super.noSuchMethod( Invocation.getter(#txTracker), - returnValue: _FakeTransactionNotificationTracker_5( + returnValue: _FakeTransactionNotificationTracker_4( this, Invocation.getter(#txTracker), ), - ) as _i8.TransactionNotificationTracker); + ) as _i7.TransactionNotificationTracker); @override - set txTracker(_i8.TransactionNotificationTracker? _txTracker) => + set txTracker(_i7.TransactionNotificationTracker? _txTracker) => super.noSuchMethod( Invocation.setter( #txTracker, @@ -899,13 +795,13 @@ class MockBitcoinWallet extends _i1.Mock implements _i28.BitcoinWallet { returnValue: false, ) as bool); @override - _i22.Future<_i9.FeeObject> get fees => (super.noSuchMethod( + _i22.Future<_i8.FeeObject> get fees => (super.noSuchMethod( Invocation.getter(#fees), - returnValue: _i22.Future<_i9.FeeObject>.value(_FakeFeeObject_6( + returnValue: _i22.Future<_i8.FeeObject>.value(_FakeFeeObject_5( this, Invocation.getter(#fees), )), - ) as _i22.Future<_i9.FeeObject>); + ) as _i22.Future<_i8.FeeObject>); @override _i22.Future get maxFee => (super.noSuchMethod( Invocation.getter(#maxFee), @@ -978,29 +874,29 @@ class MockBitcoinWallet extends _i1.Mock implements _i28.BitcoinWallet { returnValueForMissingStub: null, ); @override - _i10.ElectrumX get electrumXClient => (super.noSuchMethod( + _i9.ElectrumX get electrumXClient => (super.noSuchMethod( Invocation.getter(#electrumXClient), - returnValue: _FakeElectrumX_7( + returnValue: _FakeElectrumX_6( this, Invocation.getter(#electrumXClient), ), - ) as _i10.ElectrumX); + ) as _i9.ElectrumX); @override - _i11.CachedElectrumX get cachedElectrumXClient => (super.noSuchMethod( + _i10.CachedElectrumX get cachedElectrumXClient => (super.noSuchMethod( Invocation.getter(#cachedElectrumXClient), - returnValue: _FakeCachedElectrumX_8( + returnValue: _FakeCachedElectrumX_7( this, Invocation.getter(#cachedElectrumXClient), ), - ) as _i11.CachedElectrumX); + ) as _i10.CachedElectrumX); @override - _i12.Balance get balance => (super.noSuchMethod( + _i11.Balance get balance => (super.noSuchMethod( Invocation.getter(#balance), - returnValue: _FakeBalance_9( + returnValue: _FakeBalance_8( this, Invocation.getter(#balance), ), - ) as _i12.Balance); + ) as _i11.Balance); @override _i22.Future get xpub => (super.noSuchMethod( Invocation.getter(#xpub), @@ -1016,13 +912,13 @@ class MockBitcoinWallet extends _i1.Mock implements _i28.BitcoinWallet { returnValueForMissingStub: null, ); @override - _i7.MainDB get db => (super.noSuchMethod( + _i12.MainDB get db => (super.noSuchMethod( Invocation.getter(#db), - returnValue: _FakeMainDB_4( + returnValue: _FakeMainDB_9( this, Invocation.getter(#db), ), - ) as _i7.MainDB); + ) as _i12.MainDB); @override _i13.NetworkType get networkType => (super.noSuchMethod( Invocation.getter(#networkType), @@ -1041,15 +937,15 @@ class MockBitcoinWallet extends _i1.Mock implements _i28.BitcoinWallet { returnValueForMissingStub: _i22.Future.value(), ) as _i22.Future); @override - _i29.DerivePathType addressType({required String? address}) => + _i25.DerivePathType addressType({required String? address}) => (super.noSuchMethod( Invocation.method( #addressType, [], {#address: address}, ), - returnValue: _i29.DerivePathType.bip44, - ) as _i29.DerivePathType); + returnValue: _i25.DerivePathType.bip44, + ) as _i25.DerivePathType); @override _i22.Future recoverFromMnemonic({ required String? mnemonic, @@ -1208,20 +1104,19 @@ class MockBitcoinWallet extends _i1.Mock implements _i28.BitcoinWallet { returnValueForMissingStub: _i22.Future.value(), ) as _i22.Future); @override - _i22.Future<_i10.ElectrumXNode> getCurrentNode() => (super.noSuchMethod( + _i22.Future<_i9.ElectrumXNode> getCurrentNode() => (super.noSuchMethod( Invocation.method( #getCurrentNode, [], ), - returnValue: - _i22.Future<_i10.ElectrumXNode>.value(_FakeElectrumXNode_11( + returnValue: _i22.Future<_i9.ElectrumXNode>.value(_FakeElectrumXNode_11( this, Invocation.method( #getCurrentNode, [], ), )), - ) as _i22.Future<_i10.ElectrumXNode>); + ) as _i22.Future<_i9.ElectrumXNode>); @override _i22.Future>> fastFetch( List? allTxHashes) => @@ -1286,6 +1181,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i28.BitcoinWallet { required String? recipientAddress, required bool? coinControl, required bool? isSendAll, + int? satsPerVByte, int? additionalOutputs = 0, List<_i17.UTXO>? utxos, }) => @@ -1298,12 +1194,13 @@ class MockBitcoinWallet extends _i1.Mock implements _i28.BitcoinWallet { #recipientAddress: recipientAddress, #coinControl: coinControl, #isSendAll: isSendAll, + #satsPerVByte: satsPerVByte, #additionalOutputs: additionalOutputs, #utxos: utxos, }, )); @override - _i22.Future> fetchBuildTxData( + _i22.Future> fetchBuildTxData( List<_i17.UTXO>? utxosToUse) => (super.noSuchMethod( Invocation.method( @@ -1311,11 +1208,11 @@ class MockBitcoinWallet extends _i1.Mock implements _i28.BitcoinWallet { [utxosToUse], ), returnValue: - _i22.Future>.value(<_i30.SigningData>[]), - ) as _i22.Future>); + _i22.Future>.value(<_i26.SigningData>[]), + ) as _i22.Future>); @override _i22.Future> buildTransaction({ - required List<_i30.SigningData>? utxoSigningData, + required List<_i26.SigningData>? utxoSigningData, required List? recipients, required List? satoshiAmounts, }) => @@ -1482,21 +1379,21 @@ class MockBitcoinWallet extends _i1.Mock implements _i28.BitcoinWallet { returnValueForMissingStub: _i22.Future.value(), ) as _i22.Future); @override - _i12.Balance getCachedBalance() => (super.noSuchMethod( + _i11.Balance getCachedBalance() => (super.noSuchMethod( Invocation.method( #getCachedBalance, [], ), - returnValue: _FakeBalance_9( + returnValue: _FakeBalance_8( this, Invocation.method( #getCachedBalance, [], ), ), - ) as _i12.Balance); + ) as _i11.Balance); @override - _i22.Future updateCachedBalance(_i12.Balance? balance) => + _i22.Future updateCachedBalance(_i11.Balance? balance) => (super.noSuchMethod( Invocation.method( #updateCachedBalance, @@ -1506,21 +1403,21 @@ class MockBitcoinWallet extends _i1.Mock implements _i28.BitcoinWallet { returnValueForMissingStub: _i22.Future.value(), ) as _i22.Future); @override - _i12.Balance getCachedBalanceSecondary() => (super.noSuchMethod( + _i11.Balance getCachedBalanceSecondary() => (super.noSuchMethod( Invocation.method( #getCachedBalanceSecondary, [], ), - returnValue: _FakeBalance_9( + returnValue: _FakeBalance_8( this, Invocation.method( #getCachedBalanceSecondary, [], ), ), - ) as _i12.Balance); + ) as _i11.Balance); @override - _i22.Future updateCachedBalanceSecondary(_i12.Balance? balance) => + _i22.Future updateCachedBalanceSecondary(_i11.Balance? balance) => (super.noSuchMethod( Invocation.method( #updateCachedBalanceSecondary, @@ -1530,26 +1427,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i28.BitcoinWallet { returnValueForMissingStub: _i22.Future.value(), ) as _i22.Future); @override - List getWalletTokenContractAddresses() => (super.noSuchMethod( - Invocation.method( - #getWalletTokenContractAddresses, - [], - ), - returnValue: [], - ) as List); - @override - _i22.Future updateWalletTokenContractAddresses( - List? contractAddresses) => - (super.noSuchMethod( - Invocation.method( - #updateWalletTokenContractAddresses, - [contractAddresses], - ), - returnValue: _i22.Future.value(), - returnValueForMissingStub: _i22.Future.value(), - ) as _i22.Future); - @override - void initWalletDB({_i7.MainDB? mockableOverride}) => super.noSuchMethod( + void initWalletDB({_i12.MainDB? mockableOverride}) => super.noSuchMethod( Invocation.method( #initWalletDB, [], @@ -1601,9 +1479,9 @@ class MockBitcoinWallet extends _i1.Mock implements _i28.BitcoinWallet { required String? walletName, required _i13.NetworkType? network, required _i21.Coin? coin, - required _i7.MainDB? db, - required _i10.ElectrumX? electrumXClient, - required _i31.SecureStorageInterface? secureStorage, + required _i12.MainDB? db, + required _i9.ElectrumX? electrumXClient, + required _i27.SecureStorageInterface? secureStorage, required int? dustLimit, required int? dustLimitP2PKH, required int? minConfirms, @@ -1623,7 +1501,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i28.BitcoinWallet { })? prepareSend, required _i22.Future Function({required String address})? getTxCount, - required _i22.Future> Function(List<_i17.UTXO>)? + required _i22.Future> Function(List<_i17.UTXO>)? fetchBuildTxData, required _i22.Future Function()? refresh, required _i22.Future Function()? checkChangeAddressForTransactions, @@ -1673,7 +1551,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i28.BitcoinWallet { )), ) as _i22.Future<_i16.BIP32>); @override - _i22.Future<_i27.Uint8List> getPrivateKeyForPaynymReceivingAddress({ + _i22.Future<_i28.Uint8List> getPrivateKeyForPaynymReceivingAddress({ required String? paymentCodeString, required int? index, }) => @@ -1686,8 +1564,8 @@ class MockBitcoinWallet extends _i1.Mock implements _i28.BitcoinWallet { #index: index, }, ), - returnValue: _i22.Future<_i27.Uint8List>.value(_i27.Uint8List(0)), - ) as _i22.Future<_i27.Uint8List>); + returnValue: _i22.Future<_i28.Uint8List>.value(_i28.Uint8List(0)), + ) as _i22.Future<_i28.Uint8List>); @override _i22.Future<_i17.Address> currentReceivingPaynymAddress({ required _i18.PaymentCode? sender, @@ -1773,14 +1651,14 @@ class MockBitcoinWallet extends _i1.Mock implements _i28.BitcoinWallet { )), ) as _i22.Future<_i18.PaymentCode>); @override - _i22.Future<_i27.Uint8List> signWithNotificationKey(_i27.Uint8List? data) => + _i22.Future<_i28.Uint8List> signWithNotificationKey(_i28.Uint8List? data) => (super.noSuchMethod( Invocation.method( #signWithNotificationKey, [data], ), - returnValue: _i22.Future<_i27.Uint8List>.value(_i27.Uint8List(0)), - ) as _i22.Future<_i27.Uint8List>); + returnValue: _i22.Future<_i28.Uint8List>.value(_i28.Uint8List(0)), + ) as _i22.Future<_i28.Uint8List>); @override _i22.Future signStringWithNotificationKey(String? data) => (super.noSuchMethod( @@ -2013,9 +1891,9 @@ class MockBitcoinWallet extends _i1.Mock implements _i28.BitcoinWallet { required String? walletId, required String? walletName, required _i21.Coin? coin, - required _i7.MainDB? db, + required _i12.MainDB? db, required _i22.Future Function()? getChainHeight, - required _i22.Future Function(_i12.Balance)? refreshedBalanceCallback, + required _i22.Future Function(_i11.Balance)? refreshedBalanceCallback, }) => super.noSuchMethod( Invocation.method( @@ -2112,13 +1990,13 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: null, ); @override - _i22.Future<_i9.FeeObject> get fees => (super.noSuchMethod( + _i22.Future<_i8.FeeObject> get fees => (super.noSuchMethod( Invocation.getter(#fees), - returnValue: _i22.Future<_i9.FeeObject>.value(_FakeFeeObject_6( + returnValue: _i22.Future<_i8.FeeObject>.value(_FakeFeeObject_5( this, Invocation.getter(#fees), )), - ) as _i22.Future<_i9.FeeObject>); + ) as _i22.Future<_i8.FeeObject>); @override _i22.Future get maxFee => (super.noSuchMethod( Invocation.getter(#maxFee), @@ -2130,13 +2008,13 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValue: _i22.Future.value(''), ) as _i22.Future); @override - _i12.Balance get balance => (super.noSuchMethod( + _i11.Balance get balance => (super.noSuchMethod( Invocation.getter(#balance), - returnValue: _FakeBalance_9( + returnValue: _FakeBalance_8( this, Invocation.getter(#balance), ), - ) as _i12.Balance); + ) as _i11.Balance); @override _i22.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), @@ -2405,7 +2283,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: _i22.Future.value(), ) as _i22.Future); @override - void addListener(_i24.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -2413,7 +2291,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i24.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -2480,13 +2358,13 @@ class MockCoinServiceAPI extends _i1.Mock implements _i19.CoinServiceAPI { returnValueForMissingStub: null, ); @override - _i22.Future<_i9.FeeObject> get fees => (super.noSuchMethod( + _i22.Future<_i8.FeeObject> get fees => (super.noSuchMethod( Invocation.getter(#fees), - returnValue: _i22.Future<_i9.FeeObject>.value(_FakeFeeObject_6( + returnValue: _i22.Future<_i8.FeeObject>.value(_FakeFeeObject_5( this, Invocation.getter(#fees), )), - ) as _i22.Future<_i9.FeeObject>); + ) as _i22.Future<_i8.FeeObject>); @override _i22.Future get maxFee => (super.noSuchMethod( Invocation.getter(#maxFee), @@ -2498,13 +2376,13 @@ class MockCoinServiceAPI extends _i1.Mock implements _i19.CoinServiceAPI { returnValue: _i22.Future.value(''), ) as _i22.Future); @override - _i12.Balance get balance => (super.noSuchMethod( + _i11.Balance get balance => (super.noSuchMethod( Invocation.getter(#balance), - returnValue: _FakeBalance_9( + returnValue: _FakeBalance_8( this, Invocation.getter(#balance), ), - ) as _i12.Balance); + ) as _i11.Balance); @override _i22.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), diff --git a/test/widget_tests/trade_card_test.mocks.dart b/test/widget_tests/trade_card_test.mocks.dart deleted file mode 100644 index 55895389f..000000000 --- a/test/widget_tests/trade_card_test.mocks.dart +++ /dev/null @@ -1,131 +0,0 @@ -// Mocks generated by Mockito 5.3.2 from annotations -// in stackwallet/test/widget_tests/trade_card_test.dart. -// Do not manually edit this file. - -// ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i5; -import 'dart:typed_data' as _i6; - -import 'package:mockito/mockito.dart' as _i1; -import 'package:stackwallet/db/isar/main_db.dart' as _i2; -import 'package:stackwallet/models/isar/stack_theme.dart' as _i4; -import 'package:stackwallet/themes/theme_service.dart' as _i3; - -// ignore_for_file: type=lint -// ignore_for_file: avoid_redundant_argument_values -// ignore_for_file: avoid_setters_without_getters -// ignore_for_file: comment_references -// ignore_for_file: implementation_imports -// ignore_for_file: invalid_use_of_visible_for_testing_member -// ignore_for_file: prefer_const_constructors -// ignore_for_file: unnecessary_parenthesis -// ignore_for_file: camel_case_types -// ignore_for_file: subtype_of_sealed_class - -class _FakeMainDB_0 extends _i1.SmartFake implements _i2.MainDB { - _FakeMainDB_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -/// A class which mocks [ThemeService]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockThemeService extends _i1.Mock implements _i3.ThemeService { - MockThemeService() { - _i1.throwOnMissingStub(this); - } - - @override - _i2.MainDB get db => (super.noSuchMethod( - Invocation.getter(#db), - returnValue: _FakeMainDB_0( - this, - Invocation.getter(#db), - ), - ) as _i2.MainDB); - @override - List<_i4.StackTheme> get installedThemes => (super.noSuchMethod( - Invocation.getter(#installedThemes), - returnValue: <_i4.StackTheme>[], - ) as List<_i4.StackTheme>); - @override - void init(_i2.MainDB? db) => super.noSuchMethod( - Invocation.method( - #init, - [db], - ), - returnValueForMissingStub: null, - ); - @override - _i5.Future install({required _i6.Uint8List? themeArchiveData}) => - (super.noSuchMethod( - Invocation.method( - #install, - [], - {#themeArchiveData: themeArchiveData}, - ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); - @override - _i5.Future remove({required String? themeId}) => (super.noSuchMethod( - Invocation.method( - #remove, - [], - {#themeId: themeId}, - ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); - @override - _i5.Future checkDefaultThemesOnStartup() => (super.noSuchMethod( - Invocation.method( - #checkDefaultThemesOnStartup, - [], - ), - returnValue: _i5.Future.value(), - returnValueForMissingStub: _i5.Future.value(), - ) as _i5.Future); - @override - _i5.Future verifyInstalled({required String? themeId}) => - (super.noSuchMethod( - Invocation.method( - #verifyInstalled, - [], - {#themeId: themeId}, - ), - returnValue: _i5.Future.value(false), - ) as _i5.Future); - @override - _i5.Future> fetchThemes() => (super.noSuchMethod( - Invocation.method( - #fetchThemes, - [], - ), - returnValue: _i5.Future>.value( - <_i3.StackThemeMetaData>[]), - ) as _i5.Future>); - @override - _i5.Future<_i6.Uint8List> fetchTheme( - {required _i3.StackThemeMetaData? themeMetaData}) => - (super.noSuchMethod( - Invocation.method( - #fetchTheme, - [], - {#themeMetaData: themeMetaData}, - ), - returnValue: _i5.Future<_i6.Uint8List>.value(_i6.Uint8List(0)), - ) as _i5.Future<_i6.Uint8List>); - @override - _i4.StackTheme? getTheme({required String? themeId}) => - (super.noSuchMethod(Invocation.method( - #getTheme, - [], - {#themeId: themeId}, - )) as _i4.StackTheme?); -} diff --git a/test/widget_tests/transaction_card_test.dart b/test/widget_tests/transaction_card_test.dart index d3d16b655..a5e2209af 100644 --- a/test/widget_tests/transaction_card_test.dart +++ b/test/widget_tests/transaction_card_test.dart @@ -1,505 +1,505 @@ -import 'package:decimal/decimal.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_feather_icons/flutter_feather_icons.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:flutter_test/flutter_test.dart'; -import 'package:mockingjay/mockingjay.dart' as mockingjay; -import 'package:mockito/annotations.dart'; -import 'package:mockito/mockito.dart'; -import 'package:stackwallet/models/isar/models/blockchain_data/address.dart'; -import 'package:stackwallet/models/isar/models/blockchain_data/transaction.dart'; -import 'package:stackwallet/models/isar/stack_theme.dart'; -import 'package:stackwallet/pages/wallet_view/transaction_views/transaction_details_view.dart'; -import 'package:stackwallet/providers/providers.dart'; -import 'package:stackwallet/services/coins/coin_service.dart'; -import 'package:stackwallet/services/coins/firo/firo_wallet.dart'; -import 'package:stackwallet/services/coins/manager.dart'; -import 'package:stackwallet/services/locale_service.dart'; -import 'package:stackwallet/services/notes_service.dart'; -import 'package:stackwallet/services/price_service.dart'; -import 'package:stackwallet/services/wallets.dart'; -import 'package:stackwallet/themes/stack_colors.dart'; -import 'package:stackwallet/themes/theme_service.dart'; -import 'package:stackwallet/utilities/amount/amount.dart'; -import 'package:stackwallet/utilities/enums/coin_enum.dart'; -import 'package:stackwallet/utilities/prefs.dart'; -import 'package:stackwallet/utilities/util.dart'; -import 'package:stackwallet/widgets/transaction_card.dart'; -import 'package:tuple/tuple.dart'; - -import '../sample_data/theme_json.dart'; -import 'transaction_card_test.mocks.dart'; - -@GenerateMocks([ - Wallets, - Manager, - CoinServiceAPI, - FiroWallet, - LocaleService, - Prefs, - PriceService, - NotesService, - ThemeService, -], customMocks: []) -void main() { - TestWidgetsFlutterBinding.ensureInitialized(); - testWidgets("Sent confirmed tx displays correctly", (tester) async { - final mockManager = MockManager(); - final mockLocaleService = MockLocaleService(); - final wallets = MockWallets(); - final mockPrefs = MockPrefs(); - final mockPriceService = MockPriceService(); - final mockThemeService = MockThemeService(); - - final tx = Transaction( - txid: "some txid", - timestamp: 1648595998, - type: TransactionType.outgoing, - amount: 100000000, - amountString: Amount( - rawValue: BigInt.from(100000000), - fractionDigits: Coin.firo.decimals, - ).toJsonString(), - fee: 3794, - height: 450123, - subType: TransactionSubType.none, - isCancelled: false, - walletId: '', - isLelantus: null, - slateId: '', - otherData: '', - nonce: null, - inputs: [], - outputs: [], - numberOfMessages: null, - )..address.value = Address( - walletId: "walletId", - value: "", - publicKey: [], - derivationIndex: 0, - derivationPath: null, - type: AddressType.p2pkh, - subType: AddressSubType.receiving); - - final CoinServiceAPI wallet = MockFiroWallet(); - - when(mockThemeService.getTheme(themeId: "light")).thenAnswer( - (_) => StackTheme.fromJson( - json: lightThemeJsonMap, - applicationThemesDirectoryPath: "test", - ), - ); - when(wallet.coin.ticker).thenAnswer((_) => "FIRO"); - when(mockLocaleService.locale).thenAnswer((_) => "en_US"); - when(mockPrefs.currency).thenAnswer((_) => "USD"); - when(mockPrefs.externalCalls).thenAnswer((_) => true); - when(mockPriceService.getPrice(Coin.firo)) - .thenAnswer((realInvocation) => Tuple2(Decimal.ten, 0.00)); - - when(wallet.coin).thenAnswer((_) => Coin.firo); - - when(wallets.getManager("wallet-id")) - .thenAnswer((realInvocation) => Manager(wallet)); - - when(wallet.storedChainHeight).thenAnswer((_) => 6000000); - // - await tester.pumpWidget( - ProviderScope( - overrides: [ - walletsChangeNotifierProvider.overrideWithValue(wallets), - localeServiceChangeNotifierProvider - .overrideWithValue(mockLocaleService), - pThemeService.overrideWithValue(mockThemeService), - prefsChangeNotifierProvider.overrideWithValue(mockPrefs), - priceAnd24hChangeNotifierProvider.overrideWithValue(mockPriceService) - ], - child: MaterialApp( - theme: ThemeData( - extensions: [ - StackColors.fromStackColorTheme( - StackTheme.fromJson( - json: lightThemeJsonMap, - applicationThemesDirectoryPath: "test", - ), - ), - ], - ), - home: TransactionCard(transaction: tx, walletId: "wallet-id"), - ), - ), - ); - - // - final title = find.text("Sent"); - // final price1 = find.text("0.00 USD"); - final amount = Util.isDesktop - ? find.text("-1.00000000 FIRO") - : find.text("1.00000000 FIRO"); - - final icon = find.byIcon(FeatherIcons.arrowUp); - - expect(title, findsOneWidget); - // expect(price1, findsOneWidget); - expect(amount, findsOneWidget); - // expect(icon, findsOneWidget); - // - await tester.pumpAndSettle(const Duration(seconds: 2)); - // - // final price2 = find.text("\$10.00"); - // expect(price2, findsOneWidget); - // - // verify(mockManager.addListener(any)).called(1); - verify(mockLocaleService.addListener(any)).called(1); - - verify(mockPrefs.currency).called(1); - verify(mockPriceService.getPrice(Coin.firo)).called(1); - verify(wallet.coin.ticker).called(1); - - verify(mockLocaleService.locale).called(1); - - verifyNoMoreInteractions(mockManager); - verifyNoMoreInteractions(mockLocaleService); - }); - - testWidgets("Anonymized confirmed tx displays correctly", (tester) async { - final mockManager = MockManager(); - final mockLocaleService = MockLocaleService(); - final wallets = MockWallets(); - final mockPrefs = MockPrefs(); - final mockPriceService = MockPriceService(); - final mockThemeService = MockThemeService(); - - final tx = Transaction( - txid: "some txid", - timestamp: 1648595998, - type: TransactionType.outgoing, - amount: 9659, - amountString: Amount( - rawValue: BigInt.from(9659), - fractionDigits: Coin.firo.decimals, - ).toJsonString(), - fee: 3794, - height: 450123, - subType: TransactionSubType.mint, - isCancelled: false, - walletId: '', - isLelantus: null, - slateId: '', - otherData: '', - nonce: null, - inputs: [], - outputs: [], - numberOfMessages: null, - )..address.value = Address( - walletId: "walletId", - value: "", - publicKey: [], - derivationIndex: 0, - derivationPath: null, - type: AddressType.p2pkh, - subType: AddressSubType.receiving); - - final CoinServiceAPI wallet = MockFiroWallet(); - - when(mockThemeService.getTheme(themeId: "light")).thenAnswer( - (_) => StackTheme.fromJson( - json: lightThemeJsonMap, - applicationThemesDirectoryPath: "test", - ), - ); - when(wallet.coin.ticker).thenAnswer((_) => "FIRO"); - when(mockLocaleService.locale).thenAnswer((_) => "en_US"); - when(mockPrefs.currency).thenAnswer((_) => "USD"); - when(mockPrefs.externalCalls).thenAnswer((_) => true); - when(mockPriceService.getPrice(Coin.firo)) - .thenAnswer((realInvocation) => Tuple2(Decimal.ten, 0.00)); - - when(wallet.coin).thenAnswer((_) => Coin.firo); - when(wallet.storedChainHeight).thenAnswer((_) => 6000000); - - when(wallets.getManager("wallet-id")) - .thenAnswer((realInvocation) => Manager(wallet)); - // - await tester.pumpWidget( - ProviderScope( - overrides: [ - walletsChangeNotifierProvider.overrideWithValue(wallets), - localeServiceChangeNotifierProvider - .overrideWithValue(mockLocaleService), - prefsChangeNotifierProvider.overrideWithValue(mockPrefs), - pThemeService.overrideWithValue(mockThemeService), - priceAnd24hChangeNotifierProvider.overrideWithValue(mockPriceService) - ], - child: MaterialApp( - theme: ThemeData( - extensions: [ - StackColors.fromStackColorTheme( - StackTheme.fromJson( - json: lightThemeJsonMap, - applicationThemesDirectoryPath: "test", - ), - ), - ], - ), - home: TransactionCard(transaction: tx, walletId: "wallet-id"), - ), - ), - ); - - // - final title = find.text("Anonymized"); - // final price1 = find.text("0.00 USD"); - final amount = find.text("-0.00009659 FIRO"); - - final icon = find.byIcon(FeatherIcons.arrowUp); - - expect(title, findsOneWidget); - // expect(price1, findsOneWidget); - expect(amount, findsOneWidget); - // expect(icon, findsOneWidget); - // - await tester.pumpAndSettle(const Duration(seconds: 2)); - // - // final price2 = find.text("\$10.00"); - // expect(price2, findsOneWidget); - // - // verify(mockManager.addListener(any)).called(1); - verify(mockLocaleService.addListener(any)).called(1); - - verify(mockPrefs.currency).called(1); - verify(mockPriceService.getPrice(Coin.firo)).called(1); - verify(wallet.coin.ticker).called(1); - - verify(mockLocaleService.locale).called(1); - - verifyNoMoreInteractions(mockManager); - verifyNoMoreInteractions(mockLocaleService); - }); - - testWidgets("Received unconfirmed tx displays correctly", (tester) async { - final mockManager = MockManager(); - final mockLocaleService = MockLocaleService(); - final wallets = MockWallets(); - final mockPrefs = MockPrefs(); - final mockPriceService = MockPriceService(); - final mockThemeService = MockThemeService(); - - final tx = Transaction( - txid: "some txid", - timestamp: 1648595998, - type: TransactionType.incoming, - amount: 100000000, - amountString: Amount( - rawValue: BigInt.from(100000000), - fractionDigits: Coin.firo.decimals, - ).toJsonString(), - fee: 3794, - height: 450123, - subType: TransactionSubType.none, - isCancelled: false, - walletId: '', - isLelantus: null, - slateId: '', - otherData: '', - nonce: null, - inputs: [], - outputs: [], - numberOfMessages: null, - )..address.value = Address( - walletId: "walletId", - value: "", - publicKey: [], - derivationIndex: 0, - derivationPath: null, - type: AddressType.p2pkh, - subType: AddressSubType.receiving); - - final CoinServiceAPI wallet = MockFiroWallet(); - - when(mockThemeService.getTheme(themeId: "light")).thenAnswer( - (_) => StackTheme.fromJson( - json: lightThemeJsonMap, - applicationThemesDirectoryPath: "test", - ), - ); - when(wallet.coin.ticker).thenAnswer((_) => "FIRO"); - when(mockLocaleService.locale).thenAnswer((_) => "en_US"); - when(mockPrefs.currency).thenAnswer((_) => "USD"); - when(mockPrefs.externalCalls).thenAnswer((_) => true); - when(mockPriceService.getPrice(Coin.firo)) - .thenAnswer((realInvocation) => Tuple2(Decimal.ten, 0.00)); - - when(wallet.coin).thenAnswer((_) => Coin.firo); - - when(wallets.getManager("wallet-id")) - .thenAnswer((realInvocation) => Manager(wallet)); - - when(wallet.storedChainHeight).thenAnswer((_) => 6000000); - - await tester.pumpWidget( - ProviderScope( - overrides: [ - walletsChangeNotifierProvider.overrideWithValue(wallets), - localeServiceChangeNotifierProvider - .overrideWithValue(mockLocaleService), - prefsChangeNotifierProvider.overrideWithValue(mockPrefs), - pThemeService.overrideWithValue(mockThemeService), - priceAnd24hChangeNotifierProvider.overrideWithValue(mockPriceService) - ], - child: MaterialApp( - theme: ThemeData( - extensions: [ - StackColors.fromStackColorTheme( - StackTheme.fromJson( - json: lightThemeJsonMap, - applicationThemesDirectoryPath: "test", - ), - ), - ], - ), - home: TransactionCard(transaction: tx, walletId: "wallet-id"), - ), - ), - ); - - final title = find.text("Received"); - final amount = Util.isDesktop - ? find.text("+1.00000000 FIRO") - : find.text("1.00000000 FIRO"); - - expect(title, findsOneWidget); - expect(amount, findsOneWidget); - - await tester.pumpAndSettle(const Duration(seconds: 2)); - - verify(mockLocaleService.addListener(any)).called(1); - - verify(mockPrefs.currency).called(1); - verify(mockPriceService.getPrice(Coin.firo)).called(1); - verify(wallet.coin.ticker).called(1); - - verify(mockLocaleService.locale).called(1); - - verifyNoMoreInteractions(mockManager); - verifyNoMoreInteractions(mockLocaleService); - }); - - testWidgets("Tap gesture", (tester) async { - final mockManager = MockManager(); - final mockLocaleService = MockLocaleService(); - final wallets = MockWallets(); - final mockPrefs = MockPrefs(); - final mockPriceService = MockPriceService(); - final mockThemeService = MockThemeService(); - final navigator = mockingjay.MockNavigator(); - - final tx = Transaction( - txid: "some txid", - timestamp: 1648595998, - type: TransactionType.outgoing, - amount: 100000000, - amountString: Amount( - rawValue: BigInt.from(100000000), - fractionDigits: Coin.firo.decimals, - ).toJsonString(), - fee: 3794, - height: 450123, - subType: TransactionSubType.none, - isCancelled: false, - walletId: '', - isLelantus: null, - slateId: '', - otherData: '', - nonce: null, - inputs: [], - outputs: [], - numberOfMessages: null, - )..address.value = Address( - walletId: "walletId", - value: "", - publicKey: [], - derivationIndex: 0, - derivationPath: null, - type: AddressType.p2pkh, - subType: AddressSubType.receiving); - - final CoinServiceAPI wallet = MockFiroWallet(); - - when(mockThemeService.getTheme(themeId: "light")).thenAnswer( - (_) => StackTheme.fromJson( - json: lightThemeJsonMap, - applicationThemesDirectoryPath: "test", - ), - ); - when(wallet.coin.ticker).thenAnswer((_) => "FIRO"); - when(mockLocaleService.locale).thenAnswer((_) => "en_US"); - when(mockPrefs.currency).thenAnswer((_) => "USD"); - when(mockPrefs.externalCalls).thenAnswer((_) => true); - when(mockPriceService.getPrice(Coin.firo)) - .thenAnswer((realInvocation) => Tuple2(Decimal.ten, 0.00)); - - when(wallet.coin).thenAnswer((_) => Coin.firo); - - when(wallets.getManager("wallet id")) - .thenAnswer((realInvocation) => Manager(wallet)); - - when(wallet.storedChainHeight).thenAnswer((_) => 6000000); - - mockingjay - .when(() => navigator.pushNamed("/transactionDetails", - arguments: Tuple3(tx, Coin.firo, "wallet id"))) - .thenAnswer((_) async => {}); - - await tester.pumpWidget( - ProviderScope( - overrides: [ - walletsChangeNotifierProvider.overrideWithValue(wallets), - localeServiceChangeNotifierProvider - .overrideWithValue(mockLocaleService), - prefsChangeNotifierProvider.overrideWithValue(mockPrefs), - pThemeService.overrideWithValue(mockThemeService), - priceAnd24hChangeNotifierProvider.overrideWithValue(mockPriceService) - ], - child: MaterialApp( - theme: ThemeData( - extensions: [ - StackColors.fromStackColorTheme( - StackTheme.fromJson( - json: lightThemeJsonMap, - applicationThemesDirectoryPath: "test", - ), - ), - ], - ), - home: mockingjay.MockNavigatorProvider( - navigator: navigator, - child: TransactionCard(transaction: tx, walletId: "wallet id")), - ), - ), - ); - - expect(find.byType(GestureDetector), findsOneWidget); - - await tester.tap(find.byType(GestureDetector)); - await tester.pump(); - - verify(mockLocaleService.addListener(any)).called(1); - - verify(mockPrefs.currency).called(2); - verify(mockLocaleService.locale).called(4); - verify(wallet.coin.ticker).called(1); - verify(wallet.storedChainHeight).called(2); - - verifyNoMoreInteractions(wallet); - verifyNoMoreInteractions(mockLocaleService); - - if (Util.isDesktop) { - expect(find.byType(TransactionDetailsView), findsOneWidget); - } else { - mockingjay - .verify(() => navigator.pushNamed("/transactionDetails", - arguments: Tuple3(tx, Coin.firo, "wallet id"))) - .called(1); - } - }); -} +// import 'package:decimal/decimal.dart'; +// import 'package:flutter/material.dart'; +// import 'package:flutter_feather_icons/flutter_feather_icons.dart'; +// import 'package:flutter_riverpod/flutter_riverpod.dart'; +// import 'package:flutter_test/flutter_test.dart'; +// import 'package:mockingjay/mockingjay.dart' as mockingjay; +// import 'package:mockito/annotations.dart'; +// import 'package:mockito/mockito.dart'; +// import 'package:stackwallet/models/isar/models/blockchain_data/address.dart'; +// import 'package:stackwallet/models/isar/models/blockchain_data/transaction.dart'; +// import 'package:stackwallet/models/isar/stack_theme.dart'; +// import 'package:stackwallet/pages/wallet_view/transaction_views/transaction_details_view.dart'; +// import 'package:stackwallet/providers/providers.dart'; +// import 'package:stackwallet/services/coins/coin_service.dart'; +// import 'package:stackwallet/services/coins/firo/firo_wallet.dart'; +// import 'package:stackwallet/services/coins/manager.dart'; +// import 'package:stackwallet/services/locale_service.dart'; +// import 'package:stackwallet/services/notes_service.dart'; +// import 'package:stackwallet/services/price_service.dart'; +// import 'package:stackwallet/services/wallets.dart'; +// import 'package:stackwallet/themes/stack_colors.dart'; +// import 'package:stackwallet/themes/theme_service.dart'; +// import 'package:stackwallet/utilities/amount/amount.dart'; +// import 'package:stackwallet/utilities/enums/coin_enum.dart'; +// import 'package:stackwallet/utilities/prefs.dart'; +// import 'package:stackwallet/utilities/util.dart'; +// import 'package:stackwallet/widgets/transaction_card.dart'; +// import 'package:tuple/tuple.dart'; +// +// import '../sample_data/theme_json.dart'; +// import 'transaction_card_test.mocks.dart'; +// +// @GenerateMocks([ +// Wallets, +// Manager, +// CoinServiceAPI, +// FiroWallet, +// LocaleService, +// Prefs, +// PriceService, +// NotesService, +// ThemeService, +// ], customMocks: []) +// void main() { +// TestWidgetsFlutterBinding.ensureInitialized(); +// testWidgets("Sent confirmed tx displays correctly", (tester) async { +// final mockManager = MockManager(); +// final mockLocaleService = MockLocaleService(); +// final wallets = MockWallets(); +// final mockPrefs = MockPrefs(); +// final mockPriceService = MockPriceService(); +// final mockThemeService = MockThemeService(); +// +// final tx = Transaction( +// txid: "some txid", +// timestamp: 1648595998, +// type: TransactionType.outgoing, +// amount: 100000000, +// amountString: Amount( +// rawValue: BigInt.from(100000000), +// fractionDigits: Coin.firo.decimals, +// ).toJsonString(), +// fee: 3794, +// height: 450123, +// subType: TransactionSubType.none, +// isCancelled: false, +// walletId: '', +// isLelantus: null, +// slateId: '', +// otherData: '', +// nonce: null, +// inputs: [], +// outputs: [], +// numberOfMessages: null, +// )..address.value = Address( +// walletId: "walletId", +// value: "", +// publicKey: [], +// derivationIndex: 0, +// derivationPath: null, +// type: AddressType.p2pkh, +// subType: AddressSubType.receiving); +// +// final CoinServiceAPI wallet = MockFiroWallet(); +// +// when(mockThemeService.getTheme(themeId: "light")).thenAnswer( +// (_) => StackTheme.fromJson( +// json: lightThemeJsonMap, +// applicationThemesDirectoryPath: "test", +// ), +// ); +// when(wallet.coin.ticker).thenAnswer((_) => "FIRO"); +// when(mockLocaleService.locale).thenAnswer((_) => "en_US"); +// when(mockPrefs.currency).thenAnswer((_) => "USD"); +// when(mockPrefs.externalCalls).thenAnswer((_) => true); +// when(mockPriceService.getPrice(Coin.firo)) +// .thenAnswer((realInvocation) => Tuple2(Decimal.ten, 0.00)); +// +// when(wallet.coin).thenAnswer((_) => Coin.firo); +// +// when(wallets.getManager("wallet-id")) +// .thenAnswer((realInvocation) => Manager(wallet)); +// +// when(wallet.storedChainHeight).thenAnswer((_) => 6000000); +// // +// await tester.pumpWidget( +// ProviderScope( +// overrides: [ +// walletsChangeNotifierProvider.overrideWithValue(wallets), +// localeServiceChangeNotifierProvider +// .overrideWithValue(mockLocaleService), +// pThemeService.overrideWithValue(mockThemeService), +// prefsChangeNotifierProvider.overrideWithValue(mockPrefs), +// priceAnd24hChangeNotifierProvider.overrideWithValue(mockPriceService) +// ], +// child: MaterialApp( +// theme: ThemeData( +// extensions: [ +// StackColors.fromStackColorTheme( +// StackTheme.fromJson( +// json: lightThemeJsonMap, +// applicationThemesDirectoryPath: "test", +// ), +// ), +// ], +// ), +// home: TransactionCard(transaction: tx, walletId: "wallet-id"), +// ), +// ), +// ); +// +// // +// final title = find.text("Sent"); +// // final price1 = find.text("0.00 USD"); +// final amount = Util.isDesktop +// ? find.text("-1.00000000 FIRO") +// : find.text("1.00000000 FIRO"); +// +// final icon = find.byIcon(FeatherIcons.arrowUp); +// +// expect(title, findsOneWidget); +// // expect(price1, findsOneWidget); +// expect(amount, findsOneWidget); +// // expect(icon, findsOneWidget); +// // +// await tester.pumpAndSettle(const Duration(seconds: 2)); +// // +// // final price2 = find.text("\$10.00"); +// // expect(price2, findsOneWidget); +// // +// // verify(mockManager.addListener(any)).called(1); +// verify(mockLocaleService.addListener(any)).called(1); +// +// verify(mockPrefs.currency).called(1); +// verify(mockPriceService.getPrice(Coin.firo)).called(1); +// verify(wallet.coin.ticker).called(1); +// +// verify(mockLocaleService.locale).called(1); +// +// verifyNoMoreInteractions(mockManager); +// verifyNoMoreInteractions(mockLocaleService); +// }); +// +// testWidgets("Anonymized confirmed tx displays correctly", (tester) async { +// final mockManager = MockManager(); +// final mockLocaleService = MockLocaleService(); +// final wallets = MockWallets(); +// final mockPrefs = MockPrefs(); +// final mockPriceService = MockPriceService(); +// final mockThemeService = MockThemeService(); +// +// final tx = Transaction( +// txid: "some txid", +// timestamp: 1648595998, +// type: TransactionType.outgoing, +// amount: 9659, +// amountString: Amount( +// rawValue: BigInt.from(9659), +// fractionDigits: Coin.firo.decimals, +// ).toJsonString(), +// fee: 3794, +// height: 450123, +// subType: TransactionSubType.mint, +// isCancelled: false, +// walletId: '', +// isLelantus: null, +// slateId: '', +// otherData: '', +// nonce: null, +// inputs: [], +// outputs: [], +// numberOfMessages: null, +// )..address.value = Address( +// walletId: "walletId", +// value: "", +// publicKey: [], +// derivationIndex: 0, +// derivationPath: null, +// type: AddressType.p2pkh, +// subType: AddressSubType.receiving); +// +// final CoinServiceAPI wallet = MockFiroWallet(); +// +// when(mockThemeService.getTheme(themeId: "light")).thenAnswer( +// (_) => StackTheme.fromJson( +// json: lightThemeJsonMap, +// applicationThemesDirectoryPath: "test", +// ), +// ); +// when(wallet.coin.ticker).thenAnswer((_) => "FIRO"); +// when(mockLocaleService.locale).thenAnswer((_) => "en_US"); +// when(mockPrefs.currency).thenAnswer((_) => "USD"); +// when(mockPrefs.externalCalls).thenAnswer((_) => true); +// when(mockPriceService.getPrice(Coin.firo)) +// .thenAnswer((realInvocation) => Tuple2(Decimal.ten, 0.00)); +// +// when(wallet.coin).thenAnswer((_) => Coin.firo); +// when(wallet.storedChainHeight).thenAnswer((_) => 6000000); +// +// when(wallets.getManager("wallet-id")) +// .thenAnswer((realInvocation) => Manager(wallet)); +// // +// await tester.pumpWidget( +// ProviderScope( +// overrides: [ +// walletsChangeNotifierProvider.overrideWithValue(wallets), +// localeServiceChangeNotifierProvider +// .overrideWithValue(mockLocaleService), +// prefsChangeNotifierProvider.overrideWithValue(mockPrefs), +// pThemeService.overrideWithValue(mockThemeService), +// priceAnd24hChangeNotifierProvider.overrideWithValue(mockPriceService) +// ], +// child: MaterialApp( +// theme: ThemeData( +// extensions: [ +// StackColors.fromStackColorTheme( +// StackTheme.fromJson( +// json: lightThemeJsonMap, +// applicationThemesDirectoryPath: "test", +// ), +// ), +// ], +// ), +// home: TransactionCard(transaction: tx, walletId: "wallet-id"), +// ), +// ), +// ); +// +// // +// final title = find.text("Anonymized"); +// // final price1 = find.text("0.00 USD"); +// final amount = find.text("-0.00009659 FIRO"); +// +// final icon = find.byIcon(FeatherIcons.arrowUp); +// +// expect(title, findsOneWidget); +// // expect(price1, findsOneWidget); +// expect(amount, findsOneWidget); +// // expect(icon, findsOneWidget); +// // +// await tester.pumpAndSettle(const Duration(seconds: 2)); +// // +// // final price2 = find.text("\$10.00"); +// // expect(price2, findsOneWidget); +// // +// // verify(mockManager.addListener(any)).called(1); +// verify(mockLocaleService.addListener(any)).called(1); +// +// verify(mockPrefs.currency).called(1); +// verify(mockPriceService.getPrice(Coin.firo)).called(1); +// verify(wallet.coin.ticker).called(1); +// +// verify(mockLocaleService.locale).called(1); +// +// verifyNoMoreInteractions(mockManager); +// verifyNoMoreInteractions(mockLocaleService); +// }); +// +// testWidgets("Received unconfirmed tx displays correctly", (tester) async { +// final mockManager = MockManager(); +// final mockLocaleService = MockLocaleService(); +// final wallets = MockWallets(); +// final mockPrefs = MockPrefs(); +// final mockPriceService = MockPriceService(); +// final mockThemeService = MockThemeService(); +// +// final tx = Transaction( +// txid: "some txid", +// timestamp: 1648595998, +// type: TransactionType.incoming, +// amount: 100000000, +// amountString: Amount( +// rawValue: BigInt.from(100000000), +// fractionDigits: Coin.firo.decimals, +// ).toJsonString(), +// fee: 3794, +// height: 450123, +// subType: TransactionSubType.none, +// isCancelled: false, +// walletId: '', +// isLelantus: null, +// slateId: '', +// otherData: '', +// nonce: null, +// inputs: [], +// outputs: [], +// numberOfMessages: null, +// )..address.value = Address( +// walletId: "walletId", +// value: "", +// publicKey: [], +// derivationIndex: 0, +// derivationPath: null, +// type: AddressType.p2pkh, +// subType: AddressSubType.receiving); +// +// final CoinServiceAPI wallet = MockFiroWallet(); +// +// when(mockThemeService.getTheme(themeId: "light")).thenAnswer( +// (_) => StackTheme.fromJson( +// json: lightThemeJsonMap, +// applicationThemesDirectoryPath: "test", +// ), +// ); +// when(wallet.coin.ticker).thenAnswer((_) => "FIRO"); +// when(mockLocaleService.locale).thenAnswer((_) => "en_US"); +// when(mockPrefs.currency).thenAnswer((_) => "USD"); +// when(mockPrefs.externalCalls).thenAnswer((_) => true); +// when(mockPriceService.getPrice(Coin.firo)) +// .thenAnswer((realInvocation) => Tuple2(Decimal.ten, 0.00)); +// +// when(wallet.coin).thenAnswer((_) => Coin.firo); +// +// when(wallets.getManager("wallet-id")) +// .thenAnswer((realInvocation) => Manager(wallet)); +// +// when(wallet.storedChainHeight).thenAnswer((_) => 6000000); +// +// await tester.pumpWidget( +// ProviderScope( +// overrides: [ +// walletsChangeNotifierProvider.overrideWithValue(wallets), +// localeServiceChangeNotifierProvider +// .overrideWithValue(mockLocaleService), +// prefsChangeNotifierProvider.overrideWithValue(mockPrefs), +// pThemeService.overrideWithValue(mockThemeService), +// priceAnd24hChangeNotifierProvider.overrideWithValue(mockPriceService) +// ], +// child: MaterialApp( +// theme: ThemeData( +// extensions: [ +// StackColors.fromStackColorTheme( +// StackTheme.fromJson( +// json: lightThemeJsonMap, +// applicationThemesDirectoryPath: "test", +// ), +// ), +// ], +// ), +// home: TransactionCard(transaction: tx, walletId: "wallet-id"), +// ), +// ), +// ); +// +// final title = find.text("Received"); +// final amount = Util.isDesktop +// ? find.text("+1.00000000 FIRO") +// : find.text("1.00000000 FIRO"); +// +// expect(title, findsOneWidget); +// expect(amount, findsOneWidget); +// +// await tester.pumpAndSettle(const Duration(seconds: 2)); +// +// verify(mockLocaleService.addListener(any)).called(1); +// +// verify(mockPrefs.currency).called(1); +// verify(mockPriceService.getPrice(Coin.firo)).called(1); +// verify(wallet.coin.ticker).called(1); +// +// verify(mockLocaleService.locale).called(1); +// +// verifyNoMoreInteractions(mockManager); +// verifyNoMoreInteractions(mockLocaleService); +// }); +// +// testWidgets("Tap gesture", (tester) async { +// final mockManager = MockManager(); +// final mockLocaleService = MockLocaleService(); +// final wallets = MockWallets(); +// final mockPrefs = MockPrefs(); +// final mockPriceService = MockPriceService(); +// final mockThemeService = MockThemeService(); +// final navigator = mockingjay.MockNavigator(); +// +// final tx = Transaction( +// txid: "some txid", +// timestamp: 1648595998, +// type: TransactionType.outgoing, +// amount: 100000000, +// amountString: Amount( +// rawValue: BigInt.from(100000000), +// fractionDigits: Coin.firo.decimals, +// ).toJsonString(), +// fee: 3794, +// height: 450123, +// subType: TransactionSubType.none, +// isCancelled: false, +// walletId: '', +// isLelantus: null, +// slateId: '', +// otherData: '', +// nonce: null, +// inputs: [], +// outputs: [], +// numberOfMessages: null, +// )..address.value = Address( +// walletId: "walletId", +// value: "", +// publicKey: [], +// derivationIndex: 0, +// derivationPath: null, +// type: AddressType.p2pkh, +// subType: AddressSubType.receiving); +// +// final CoinServiceAPI wallet = MockFiroWallet(); +// +// when(mockThemeService.getTheme(themeId: "light")).thenAnswer( +// (_) => StackTheme.fromJson( +// json: lightThemeJsonMap, +// applicationThemesDirectoryPath: "test", +// ), +// ); +// when(wallet.coin.ticker).thenAnswer((_) => "FIRO"); +// when(mockLocaleService.locale).thenAnswer((_) => "en_US"); +// when(mockPrefs.currency).thenAnswer((_) => "USD"); +// when(mockPrefs.externalCalls).thenAnswer((_) => true); +// when(mockPriceService.getPrice(Coin.firo)) +// .thenAnswer((realInvocation) => Tuple2(Decimal.ten, 0.00)); +// +// when(wallet.coin).thenAnswer((_) => Coin.firo); +// +// when(wallets.getManager("wallet id")) +// .thenAnswer((realInvocation) => Manager(wallet)); +// +// when(wallet.storedChainHeight).thenAnswer((_) => 6000000); +// +// mockingjay +// .when(() => navigator.pushNamed("/transactionDetails", +// arguments: Tuple3(tx, Coin.firo, "wallet id"))) +// .thenAnswer((_) async => {}); +// +// await tester.pumpWidget( +// ProviderScope( +// overrides: [ +// walletsChangeNotifierProvider.overrideWithValue(wallets), +// localeServiceChangeNotifierProvider +// .overrideWithValue(mockLocaleService), +// prefsChangeNotifierProvider.overrideWithValue(mockPrefs), +// pThemeService.overrideWithValue(mockThemeService), +// priceAnd24hChangeNotifierProvider.overrideWithValue(mockPriceService) +// ], +// child: MaterialApp( +// theme: ThemeData( +// extensions: [ +// StackColors.fromStackColorTheme( +// StackTheme.fromJson( +// json: lightThemeJsonMap, +// applicationThemesDirectoryPath: "test", +// ), +// ), +// ], +// ), +// home: mockingjay.MockNavigatorProvider( +// navigator: navigator, +// child: TransactionCard(transaction: tx, walletId: "wallet id")), +// ), +// ), +// ); +// +// expect(find.byType(GestureDetector), findsOneWidget); +// +// await tester.tap(find.byType(GestureDetector)); +// await tester.pump(); +// +// verify(mockLocaleService.addListener(any)).called(1); +// +// verify(mockPrefs.currency).called(2); +// verify(mockLocaleService.locale).called(4); +// verify(wallet.coin.ticker).called(1); +// verify(wallet.storedChainHeight).called(2); +// +// verifyNoMoreInteractions(wallet); +// verifyNoMoreInteractions(mockLocaleService); +// +// if (Util.isDesktop) { +// expect(find.byType(TransactionDetailsView), findsOneWidget); +// } else { +// mockingjay +// .verify(() => navigator.pushNamed("/transactionDetails", +// arguments: Tuple3(tx, Coin.firo, "wallet id"))) +// .called(1); +// } +// }); +// } diff --git a/test/widget_tests/transaction_card_test.mocks.dart b/test/widget_tests/transaction_card_test.mocks.dart deleted file mode 100644 index 93cc0c9a7..000000000 --- a/test/widget_tests/transaction_card_test.mocks.dart +++ /dev/null @@ -1,2921 +0,0 @@ -// Mocks generated by Mockito 5.3.2 from annotations -// in stackwallet/test/widget_tests/transaction_card_test.dart. -// Do not manually edit this file. - -// ignore_for_file: no_leading_underscores_for_library_prefixes -import 'dart:async' as _i18; -import 'dart:typed_data' as _i32; -import 'dart:ui' as _i20; - -import 'package:decimal/decimal.dart' as _i28; -import 'package:flutter/foundation.dart' as _i4; -import 'package:flutter_riverpod/flutter_riverpod.dart' as _i5; -import 'package:mockito/mockito.dart' as _i1; -import 'package:stackwallet/db/isar/main_db.dart' as _i14; -import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i13; -import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i12; -import 'package:stackwallet/models/balance.dart' as _i9; -import 'package:stackwallet/models/isar/models/isar_models.dart' as _i21; -import 'package:stackwallet/models/isar/stack_theme.dart' as _i31; -import 'package:stackwallet/models/models.dart' as _i8; -import 'package:stackwallet/models/signing_data.dart' as _i23; -import 'package:stackwallet/services/coins/coin_service.dart' as _i7; -import 'package:stackwallet/services/coins/firo/firo_wallet.dart' as _i22; -import 'package:stackwallet/services/coins/manager.dart' as _i6; -import 'package:stackwallet/services/locale_service.dart' as _i24; -import 'package:stackwallet/services/node_service.dart' as _i3; -import 'package:stackwallet/services/notes_service.dart' as _i29; -import 'package:stackwallet/services/price_service.dart' as _i27; -import 'package:stackwallet/services/transaction_notification_tracker.dart' - as _i11; -import 'package:stackwallet/services/wallets.dart' as _i16; -import 'package:stackwallet/services/wallets_service.dart' as _i2; -import 'package:stackwallet/themes/theme_service.dart' as _i30; -import 'package:stackwallet/utilities/amount/amount.dart' as _i10; -import 'package:stackwallet/utilities/enums/backup_frequency_type.dart' as _i26; -import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i17; -import 'package:stackwallet/utilities/enums/sync_type_enum.dart' as _i25; -import 'package:stackwallet/utilities/prefs.dart' as _i19; -import 'package:tuple/tuple.dart' as _i15; - -// ignore_for_file: type=lint -// ignore_for_file: avoid_redundant_argument_values -// ignore_for_file: avoid_setters_without_getters -// ignore_for_file: comment_references -// ignore_for_file: implementation_imports -// ignore_for_file: invalid_use_of_visible_for_testing_member -// ignore_for_file: prefer_const_constructors -// ignore_for_file: unnecessary_parenthesis -// ignore_for_file: camel_case_types -// ignore_for_file: subtype_of_sealed_class - -class _FakeWalletsService_0 extends _i1.SmartFake - implements _i2.WalletsService { - _FakeWalletsService_0( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeNodeService_1 extends _i1.SmartFake implements _i3.NodeService { - _FakeNodeService_1( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeChangeNotifierProvider_2 - extends _i1.SmartFake implements _i5.ChangeNotifierProvider { - _FakeChangeNotifierProvider_2( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeManager_3 extends _i1.SmartFake implements _i6.Manager { - _FakeManager_3( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeCoinServiceAPI_4 extends _i1.SmartFake - implements _i7.CoinServiceAPI { - _FakeCoinServiceAPI_4( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeFeeObject_5 extends _i1.SmartFake implements _i8.FeeObject { - _FakeFeeObject_5( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeBalance_6 extends _i1.SmartFake implements _i9.Balance { - _FakeBalance_6( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeAmount_7 extends _i1.SmartFake implements _i10.Amount { - _FakeAmount_7( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeTransactionNotificationTracker_8 extends _i1.SmartFake - implements _i11.TransactionNotificationTracker { - _FakeTransactionNotificationTracker_8( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeElectrumX_9 extends _i1.SmartFake implements _i12.ElectrumX { - _FakeElectrumX_9( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeCachedElectrumX_10 extends _i1.SmartFake - implements _i13.CachedElectrumX { - _FakeCachedElectrumX_10( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeMainDB_11 extends _i1.SmartFake implements _i14.MainDB { - _FakeMainDB_11( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeDuration_12 extends _i1.SmartFake implements Duration { - _FakeDuration_12( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -class _FakeTuple2_13 extends _i1.SmartFake - implements _i15.Tuple2 { - _FakeTuple2_13( - Object parent, - Invocation parentInvocation, - ) : super( - parent, - parentInvocation, - ); -} - -/// A class which mocks [Wallets]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockWallets extends _i1.Mock implements _i16.Wallets { - MockWallets() { - _i1.throwOnMissingStub(this); - } - - @override - _i2.WalletsService get walletsService => (super.noSuchMethod( - Invocation.getter(#walletsService), - returnValue: _FakeWalletsService_0( - this, - Invocation.getter(#walletsService), - ), - ) as _i2.WalletsService); - @override - set walletsService(_i2.WalletsService? _walletsService) => super.noSuchMethod( - Invocation.setter( - #walletsService, - _walletsService, - ), - returnValueForMissingStub: null, - ); - @override - _i3.NodeService get nodeService => (super.noSuchMethod( - Invocation.getter(#nodeService), - returnValue: _FakeNodeService_1( - this, - Invocation.getter(#nodeService), - ), - ) as _i3.NodeService); - @override - set nodeService(_i3.NodeService? _nodeService) => super.noSuchMethod( - Invocation.setter( - #nodeService, - _nodeService, - ), - returnValueForMissingStub: null, - ); - @override - bool get hasWallets => (super.noSuchMethod( - Invocation.getter(#hasWallets), - returnValue: false, - ) as bool); - @override - List<_i5.ChangeNotifierProvider<_i6.Manager>> get managerProviders => - (super.noSuchMethod( - Invocation.getter(#managerProviders), - returnValue: <_i5.ChangeNotifierProvider<_i6.Manager>>[], - ) as List<_i5.ChangeNotifierProvider<_i6.Manager>>); - @override - List<_i6.Manager> get managers => (super.noSuchMethod( - Invocation.getter(#managers), - returnValue: <_i6.Manager>[], - ) as List<_i6.Manager>); - @override - bool get hasListeners => (super.noSuchMethod( - Invocation.getter(#hasListeners), - returnValue: false, - ) as bool); - @override - void dispose() => super.noSuchMethod( - Invocation.method( - #dispose, - [], - ), - returnValueForMissingStub: null, - ); - @override - List getWalletIdsFor({required _i17.Coin? coin}) => - (super.noSuchMethod( - Invocation.method( - #getWalletIdsFor, - [], - {#coin: coin}, - ), - returnValue: [], - ) as List); - @override - List<_i15.Tuple2<_i17.Coin, List<_i5.ChangeNotifierProvider<_i6.Manager>>>> - getManagerProvidersByCoin() => (super.noSuchMethod( - Invocation.method( - #getManagerProvidersByCoin, - [], - ), - returnValue: < - _i15.Tuple2<_i17.Coin, - List<_i5.ChangeNotifierProvider<_i6.Manager>>>>[], - ) as List< - _i15.Tuple2<_i17.Coin, - List<_i5.ChangeNotifierProvider<_i6.Manager>>>>); - @override - List<_i5.ChangeNotifierProvider<_i6.Manager>> getManagerProvidersForCoin( - _i17.Coin? coin) => - (super.noSuchMethod( - Invocation.method( - #getManagerProvidersForCoin, - [coin], - ), - returnValue: <_i5.ChangeNotifierProvider<_i6.Manager>>[], - ) as List<_i5.ChangeNotifierProvider<_i6.Manager>>); - @override - _i5.ChangeNotifierProvider<_i6.Manager> getManagerProvider( - String? walletId) => - (super.noSuchMethod( - Invocation.method( - #getManagerProvider, - [walletId], - ), - returnValue: _FakeChangeNotifierProvider_2<_i6.Manager>( - this, - Invocation.method( - #getManagerProvider, - [walletId], - ), - ), - ) as _i5.ChangeNotifierProvider<_i6.Manager>); - @override - _i6.Manager getManager(String? walletId) => (super.noSuchMethod( - Invocation.method( - #getManager, - [walletId], - ), - returnValue: _FakeManager_3( - this, - Invocation.method( - #getManager, - [walletId], - ), - ), - ) as _i6.Manager); - @override - void addWallet({ - required String? walletId, - required _i6.Manager? manager, - }) => - super.noSuchMethod( - Invocation.method( - #addWallet, - [], - { - #walletId: walletId, - #manager: manager, - }, - ), - returnValueForMissingStub: null, - ); - @override - void removeWallet({required String? walletId}) => super.noSuchMethod( - Invocation.method( - #removeWallet, - [], - {#walletId: walletId}, - ), - returnValueForMissingStub: null, - ); - @override - _i18.Future load(_i19.Prefs? prefs) => (super.noSuchMethod( - Invocation.method( - #load, - [prefs], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future loadAfterStackRestore( - _i19.Prefs? prefs, - List<_i6.Manager>? managers, - ) => - (super.noSuchMethod( - Invocation.method( - #loadAfterStackRestore, - [ - prefs, - managers, - ], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - void addListener(_i20.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #addListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void removeListener(_i20.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #removeListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void notifyListeners() => super.noSuchMethod( - Invocation.method( - #notifyListeners, - [], - ), - returnValueForMissingStub: null, - ); -} - -/// A class which mocks [Manager]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockManager extends _i1.Mock implements _i6.Manager { - MockManager() { - _i1.throwOnMissingStub(this); - } - - @override - bool get isActiveWallet => (super.noSuchMethod( - Invocation.getter(#isActiveWallet), - returnValue: false, - ) as bool); - @override - set isActiveWallet(bool? isActive) => super.noSuchMethod( - Invocation.setter( - #isActiveWallet, - isActive, - ), - returnValueForMissingStub: null, - ); - @override - _i7.CoinServiceAPI get wallet => (super.noSuchMethod( - Invocation.getter(#wallet), - returnValue: _FakeCoinServiceAPI_4( - this, - Invocation.getter(#wallet), - ), - ) as _i7.CoinServiceAPI); - @override - bool get hasBackgroundRefreshListener => (super.noSuchMethod( - Invocation.getter(#hasBackgroundRefreshListener), - returnValue: false, - ) as bool); - @override - _i17.Coin get coin => (super.noSuchMethod( - Invocation.getter(#coin), - returnValue: _i17.Coin.bitcoin, - ) as _i17.Coin); - @override - bool get isRefreshing => (super.noSuchMethod( - Invocation.getter(#isRefreshing), - returnValue: false, - ) as bool); - @override - bool get shouldAutoSync => (super.noSuchMethod( - Invocation.getter(#shouldAutoSync), - returnValue: false, - ) as bool); - @override - set shouldAutoSync(bool? shouldAutoSync) => super.noSuchMethod( - Invocation.setter( - #shouldAutoSync, - shouldAutoSync, - ), - returnValueForMissingStub: null, - ); - @override - bool get isFavorite => (super.noSuchMethod( - Invocation.getter(#isFavorite), - returnValue: false, - ) as bool); - @override - set isFavorite(bool? markFavorite) => super.noSuchMethod( - Invocation.setter( - #isFavorite, - markFavorite, - ), - returnValueForMissingStub: null, - ); - @override - _i18.Future<_i8.FeeObject> get fees => (super.noSuchMethod( - Invocation.getter(#fees), - returnValue: _i18.Future<_i8.FeeObject>.value(_FakeFeeObject_5( - this, - Invocation.getter(#fees), - )), - ) as _i18.Future<_i8.FeeObject>); - @override - _i18.Future get maxFee => (super.noSuchMethod( - Invocation.getter(#maxFee), - returnValue: _i18.Future.value(0), - ) as _i18.Future); - @override - _i18.Future get currentReceivingAddress => (super.noSuchMethod( - Invocation.getter(#currentReceivingAddress), - returnValue: _i18.Future.value(''), - ) as _i18.Future); - @override - _i9.Balance get balance => (super.noSuchMethod( - Invocation.getter(#balance), - returnValue: _FakeBalance_6( - this, - Invocation.getter(#balance), - ), - ) as _i9.Balance); - @override - _i18.Future> get transactions => (super.noSuchMethod( - Invocation.getter(#transactions), - returnValue: - _i18.Future>.value(<_i21.Transaction>[]), - ) as _i18.Future>); - @override - _i18.Future> get utxos => (super.noSuchMethod( - Invocation.getter(#utxos), - returnValue: _i18.Future>.value(<_i21.UTXO>[]), - ) as _i18.Future>); - @override - set walletName(String? newName) => super.noSuchMethod( - Invocation.setter( - #walletName, - newName, - ), - returnValueForMissingStub: null, - ); - @override - String get walletName => (super.noSuchMethod( - Invocation.getter(#walletName), - returnValue: '', - ) as String); - @override - String get walletId => (super.noSuchMethod( - Invocation.getter(#walletId), - returnValue: '', - ) as String); - @override - _i18.Future> get mnemonic => (super.noSuchMethod( - Invocation.getter(#mnemonic), - returnValue: _i18.Future>.value([]), - ) as _i18.Future>); - @override - _i18.Future get mnemonicPassphrase => (super.noSuchMethod( - Invocation.getter(#mnemonicPassphrase), - returnValue: _i18.Future.value(), - ) as _i18.Future); - @override - bool get isConnected => (super.noSuchMethod( - Invocation.getter(#isConnected), - returnValue: false, - ) as bool); - @override - int get currentHeight => (super.noSuchMethod( - Invocation.getter(#currentHeight), - returnValue: 0, - ) as int); - @override - bool get hasPaynymSupport => (super.noSuchMethod( - Invocation.getter(#hasPaynymSupport), - returnValue: false, - ) as bool); - @override - bool get hasCoinControlSupport => (super.noSuchMethod( - Invocation.getter(#hasCoinControlSupport), - returnValue: false, - ) as bool); - @override - bool get hasTokenSupport => (super.noSuchMethod( - Invocation.getter(#hasTokenSupport), - returnValue: false, - ) as bool); - @override - bool get hasWhirlpoolSupport => (super.noSuchMethod( - Invocation.getter(#hasWhirlpoolSupport), - returnValue: false, - ) as bool); - @override - int get rescanOnOpenVersion => (super.noSuchMethod( - Invocation.getter(#rescanOnOpenVersion), - returnValue: 0, - ) as int); - @override - bool get hasXPub => (super.noSuchMethod( - Invocation.getter(#hasXPub), - returnValue: false, - ) as bool); - @override - _i18.Future get xpub => (super.noSuchMethod( - Invocation.getter(#xpub), - returnValue: _i18.Future.value(''), - ) as _i18.Future); - @override - bool get hasListeners => (super.noSuchMethod( - Invocation.getter(#hasListeners), - returnValue: false, - ) as bool); - @override - _i18.Future updateNode(bool? shouldRefresh) => (super.noSuchMethod( - Invocation.method( - #updateNode, - [shouldRefresh], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - void dispose() => super.noSuchMethod( - Invocation.method( - #dispose, - [], - ), - returnValueForMissingStub: null, - ); - @override - _i18.Future> prepareSend({ - required String? address, - required _i10.Amount? amount, - Map? args, - }) => - (super.noSuchMethod( - Invocation.method( - #prepareSend, - [], - { - #address: address, - #amount: amount, - #args: args, - }, - ), - returnValue: - _i18.Future>.value({}), - ) as _i18.Future>); - @override - _i18.Future confirmSend({required Map? txData}) => - (super.noSuchMethod( - Invocation.method( - #confirmSend, - [], - {#txData: txData}, - ), - returnValue: _i18.Future.value(''), - ) as _i18.Future); - @override - _i18.Future refresh() => (super.noSuchMethod( - Invocation.method( - #refresh, - [], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - bool validateAddress(String? address) => (super.noSuchMethod( - Invocation.method( - #validateAddress, - [address], - ), - returnValue: false, - ) as bool); - @override - _i18.Future testNetworkConnection() => (super.noSuchMethod( - Invocation.method( - #testNetworkConnection, - [], - ), - returnValue: _i18.Future.value(false), - ) as _i18.Future); - @override - _i18.Future initializeNew() => (super.noSuchMethod( - Invocation.method( - #initializeNew, - [], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future initializeExisting() => (super.noSuchMethod( - Invocation.method( - #initializeExisting, - [], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future recoverFromMnemonic({ - required String? mnemonic, - String? mnemonicPassphrase, - required int? maxUnusedAddressGap, - required int? maxNumberOfIndexesToCheck, - required int? height, - }) => - (super.noSuchMethod( - Invocation.method( - #recoverFromMnemonic, - [], - { - #mnemonic: mnemonic, - #mnemonicPassphrase: mnemonicPassphrase, - #maxUnusedAddressGap: maxUnusedAddressGap, - #maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck, - #height: height, - }, - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future exitCurrentWallet() => (super.noSuchMethod( - Invocation.method( - #exitCurrentWallet, - [], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future fullRescan( - int? maxUnusedAddressGap, - int? maxNumberOfIndexesToCheck, - ) => - (super.noSuchMethod( - Invocation.method( - #fullRescan, - [ - maxUnusedAddressGap, - maxNumberOfIndexesToCheck, - ], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future<_i10.Amount> estimateFeeFor( - _i10.Amount? amount, - int? feeRate, - ) => - (super.noSuchMethod( - Invocation.method( - #estimateFeeFor, - [ - amount, - feeRate, - ], - ), - returnValue: _i18.Future<_i10.Amount>.value(_FakeAmount_7( - this, - Invocation.method( - #estimateFeeFor, - [ - amount, - feeRate, - ], - ), - )), - ) as _i18.Future<_i10.Amount>); - @override - _i18.Future generateNewAddress() => (super.noSuchMethod( - Invocation.method( - #generateNewAddress, - [], - ), - returnValue: _i18.Future.value(false), - ) as _i18.Future); - @override - _i18.Future resetRescanOnOpen() => (super.noSuchMethod( - Invocation.method( - #resetRescanOnOpen, - [], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - void addListener(_i20.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #addListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void removeListener(_i20.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #removeListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void notifyListeners() => super.noSuchMethod( - Invocation.method( - #notifyListeners, - [], - ), - returnValueForMissingStub: null, - ); -} - -/// A class which mocks [CoinServiceAPI]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockCoinServiceAPI extends _i1.Mock implements _i7.CoinServiceAPI { - MockCoinServiceAPI() { - _i1.throwOnMissingStub(this); - } - - @override - set onIsActiveWalletChanged(void Function(bool)? _onIsActiveWalletChanged) => - super.noSuchMethod( - Invocation.setter( - #onIsActiveWalletChanged, - _onIsActiveWalletChanged, - ), - returnValueForMissingStub: null, - ); - @override - _i17.Coin get coin => (super.noSuchMethod( - Invocation.getter(#coin), - returnValue: _i17.Coin.bitcoin, - ) as _i17.Coin); - @override - bool get isRefreshing => (super.noSuchMethod( - Invocation.getter(#isRefreshing), - returnValue: false, - ) as bool); - @override - bool get shouldAutoSync => (super.noSuchMethod( - Invocation.getter(#shouldAutoSync), - returnValue: false, - ) as bool); - @override - set shouldAutoSync(bool? shouldAutoSync) => super.noSuchMethod( - Invocation.setter( - #shouldAutoSync, - shouldAutoSync, - ), - returnValueForMissingStub: null, - ); - @override - bool get isFavorite => (super.noSuchMethod( - Invocation.getter(#isFavorite), - returnValue: false, - ) as bool); - @override - set isFavorite(bool? markFavorite) => super.noSuchMethod( - Invocation.setter( - #isFavorite, - markFavorite, - ), - returnValueForMissingStub: null, - ); - @override - _i18.Future<_i8.FeeObject> get fees => (super.noSuchMethod( - Invocation.getter(#fees), - returnValue: _i18.Future<_i8.FeeObject>.value(_FakeFeeObject_5( - this, - Invocation.getter(#fees), - )), - ) as _i18.Future<_i8.FeeObject>); - @override - _i18.Future get maxFee => (super.noSuchMethod( - Invocation.getter(#maxFee), - returnValue: _i18.Future.value(0), - ) as _i18.Future); - @override - _i18.Future get currentReceivingAddress => (super.noSuchMethod( - Invocation.getter(#currentReceivingAddress), - returnValue: _i18.Future.value(''), - ) as _i18.Future); - @override - _i9.Balance get balance => (super.noSuchMethod( - Invocation.getter(#balance), - returnValue: _FakeBalance_6( - this, - Invocation.getter(#balance), - ), - ) as _i9.Balance); - @override - _i18.Future> get transactions => (super.noSuchMethod( - Invocation.getter(#transactions), - returnValue: - _i18.Future>.value(<_i21.Transaction>[]), - ) as _i18.Future>); - @override - _i18.Future> get utxos => (super.noSuchMethod( - Invocation.getter(#utxos), - returnValue: _i18.Future>.value(<_i21.UTXO>[]), - ) as _i18.Future>); - @override - set walletName(String? newName) => super.noSuchMethod( - Invocation.setter( - #walletName, - newName, - ), - returnValueForMissingStub: null, - ); - @override - String get walletName => (super.noSuchMethod( - Invocation.getter(#walletName), - returnValue: '', - ) as String); - @override - String get walletId => (super.noSuchMethod( - Invocation.getter(#walletId), - returnValue: '', - ) as String); - @override - _i18.Future> get mnemonic => (super.noSuchMethod( - Invocation.getter(#mnemonic), - returnValue: _i18.Future>.value([]), - ) as _i18.Future>); - @override - _i18.Future get mnemonicString => (super.noSuchMethod( - Invocation.getter(#mnemonicString), - returnValue: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future get mnemonicPassphrase => (super.noSuchMethod( - Invocation.getter(#mnemonicPassphrase), - returnValue: _i18.Future.value(), - ) as _i18.Future); - @override - bool get hasCalledExit => (super.noSuchMethod( - Invocation.getter(#hasCalledExit), - returnValue: false, - ) as bool); - @override - bool get isConnected => (super.noSuchMethod( - Invocation.getter(#isConnected), - returnValue: false, - ) as bool); - @override - int get storedChainHeight => (super.noSuchMethod( - Invocation.getter(#storedChainHeight), - returnValue: 0, - ) as int); - @override - _i18.Future> prepareSend({ - required String? address, - required _i10.Amount? amount, - Map? args, - }) => - (super.noSuchMethod( - Invocation.method( - #prepareSend, - [], - { - #address: address, - #amount: amount, - #args: args, - }, - ), - returnValue: - _i18.Future>.value({}), - ) as _i18.Future>); - @override - _i18.Future confirmSend({required Map? txData}) => - (super.noSuchMethod( - Invocation.method( - #confirmSend, - [], - {#txData: txData}, - ), - returnValue: _i18.Future.value(''), - ) as _i18.Future); - @override - _i18.Future refresh() => (super.noSuchMethod( - Invocation.method( - #refresh, - [], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future updateNode(bool? shouldRefresh) => (super.noSuchMethod( - Invocation.method( - #updateNode, - [shouldRefresh], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - bool validateAddress(String? address) => (super.noSuchMethod( - Invocation.method( - #validateAddress, - [address], - ), - returnValue: false, - ) as bool); - @override - _i18.Future testNetworkConnection() => (super.noSuchMethod( - Invocation.method( - #testNetworkConnection, - [], - ), - returnValue: _i18.Future.value(false), - ) as _i18.Future); - @override - _i18.Future recoverFromMnemonic({ - required String? mnemonic, - String? mnemonicPassphrase, - required int? maxUnusedAddressGap, - required int? maxNumberOfIndexesToCheck, - required int? height, - }) => - (super.noSuchMethod( - Invocation.method( - #recoverFromMnemonic, - [], - { - #mnemonic: mnemonic, - #mnemonicPassphrase: mnemonicPassphrase, - #maxUnusedAddressGap: maxUnusedAddressGap, - #maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck, - #height: height, - }, - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future initializeNew() => (super.noSuchMethod( - Invocation.method( - #initializeNew, - [], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future initializeExisting() => (super.noSuchMethod( - Invocation.method( - #initializeExisting, - [], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future exit() => (super.noSuchMethod( - Invocation.method( - #exit, - [], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future fullRescan( - int? maxUnusedAddressGap, - int? maxNumberOfIndexesToCheck, - ) => - (super.noSuchMethod( - Invocation.method( - #fullRescan, - [ - maxUnusedAddressGap, - maxNumberOfIndexesToCheck, - ], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future<_i10.Amount> estimateFeeFor( - _i10.Amount? amount, - int? feeRate, - ) => - (super.noSuchMethod( - Invocation.method( - #estimateFeeFor, - [ - amount, - feeRate, - ], - ), - returnValue: _i18.Future<_i10.Amount>.value(_FakeAmount_7( - this, - Invocation.method( - #estimateFeeFor, - [ - amount, - feeRate, - ], - ), - )), - ) as _i18.Future<_i10.Amount>); - @override - _i18.Future generateNewAddress() => (super.noSuchMethod( - Invocation.method( - #generateNewAddress, - [], - ), - returnValue: _i18.Future.value(false), - ) as _i18.Future); - @override - _i18.Future updateSentCachedTxData(Map? txData) => - (super.noSuchMethod( - Invocation.method( - #updateSentCachedTxData, - [txData], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); -} - -/// A class which mocks [FiroWallet]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockFiroWallet extends _i1.Mock implements _i22.FiroWallet { - MockFiroWallet() { - _i1.throwOnMissingStub(this); - } - - @override - set timer(_i18.Timer? _timer) => super.noSuchMethod( - Invocation.setter( - #timer, - _timer, - ), - returnValueForMissingStub: null, - ); - @override - _i11.TransactionNotificationTracker get txTracker => (super.noSuchMethod( - Invocation.getter(#txTracker), - returnValue: _FakeTransactionNotificationTracker_8( - this, - Invocation.getter(#txTracker), - ), - ) as _i11.TransactionNotificationTracker); - @override - set txTracker(_i11.TransactionNotificationTracker? _txTracker) => - super.noSuchMethod( - Invocation.setter( - #txTracker, - _txTracker, - ), - returnValueForMissingStub: null, - ); - @override - bool get refreshMutex => (super.noSuchMethod( - Invocation.getter(#refreshMutex), - returnValue: false, - ) as bool); - @override - set refreshMutex(bool? _refreshMutex) => super.noSuchMethod( - Invocation.setter( - #refreshMutex, - _refreshMutex, - ), - returnValueForMissingStub: null, - ); - @override - bool get longMutex => (super.noSuchMethod( - Invocation.getter(#longMutex), - returnValue: false, - ) as bool); - @override - set longMutex(bool? _longMutex) => super.noSuchMethod( - Invocation.setter( - #longMutex, - _longMutex, - ), - returnValueForMissingStub: null, - ); - @override - bool get isActive => (super.noSuchMethod( - Invocation.getter(#isActive), - returnValue: false, - ) as bool); - @override - set isActive(bool? _isActive) => super.noSuchMethod( - Invocation.setter( - #isActive, - _isActive, - ), - returnValueForMissingStub: null, - ); - @override - bool get shouldAutoSync => (super.noSuchMethod( - Invocation.getter(#shouldAutoSync), - returnValue: false, - ) as bool); - @override - set shouldAutoSync(bool? shouldAutoSync) => super.noSuchMethod( - Invocation.setter( - #shouldAutoSync, - shouldAutoSync, - ), - returnValueForMissingStub: null, - ); - @override - set isFavorite(bool? markFavorite) => super.noSuchMethod( - Invocation.setter( - #isFavorite, - markFavorite, - ), - returnValueForMissingStub: null, - ); - @override - bool get isFavorite => (super.noSuchMethod( - Invocation.getter(#isFavorite), - returnValue: false, - ) as bool); - @override - _i17.Coin get coin => (super.noSuchMethod( - Invocation.getter(#coin), - returnValue: _i17.Coin.bitcoin, - ) as _i17.Coin); - @override - _i18.Future> get mnemonic => (super.noSuchMethod( - Invocation.getter(#mnemonic), - returnValue: _i18.Future>.value([]), - ) as _i18.Future>); - @override - _i18.Future get mnemonicString => (super.noSuchMethod( - Invocation.getter(#mnemonicString), - returnValue: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future get mnemonicPassphrase => (super.noSuchMethod( - Invocation.getter(#mnemonicPassphrase), - returnValue: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future get maxFee => (super.noSuchMethod( - Invocation.getter(#maxFee), - returnValue: _i18.Future.value(0), - ) as _i18.Future); - @override - _i18.Future<_i8.FeeObject> get fees => (super.noSuchMethod( - Invocation.getter(#fees), - returnValue: _i18.Future<_i8.FeeObject>.value(_FakeFeeObject_5( - this, - Invocation.getter(#fees), - )), - ) as _i18.Future<_i8.FeeObject>); - @override - _i18.Future get currentReceivingAddress => (super.noSuchMethod( - Invocation.getter(#currentReceivingAddress), - returnValue: _i18.Future.value(''), - ) as _i18.Future); - @override - _i18.Future get currentChangeAddress => (super.noSuchMethod( - Invocation.getter(#currentChangeAddress), - returnValue: _i18.Future.value(''), - ) as _i18.Future); - @override - String get walletName => (super.noSuchMethod( - Invocation.getter(#walletName), - returnValue: '', - ) as String); - @override - set walletName(String? newName) => super.noSuchMethod( - Invocation.setter( - #walletName, - newName, - ), - returnValueForMissingStub: null, - ); - @override - String get walletId => (super.noSuchMethod( - Invocation.getter(#walletId), - returnValue: '', - ) as String); - @override - bool get isConnected => (super.noSuchMethod( - Invocation.getter(#isConnected), - returnValue: false, - ) as bool); - @override - _i12.ElectrumX get electrumXClient => (super.noSuchMethod( - Invocation.getter(#electrumXClient), - returnValue: _FakeElectrumX_9( - this, - Invocation.getter(#electrumXClient), - ), - ) as _i12.ElectrumX); - @override - _i13.CachedElectrumX get cachedElectrumXClient => (super.noSuchMethod( - Invocation.getter(#cachedElectrumXClient), - returnValue: _FakeCachedElectrumX_10( - this, - Invocation.getter(#cachedElectrumXClient), - ), - ) as _i13.CachedElectrumX); - @override - bool get isRefreshing => (super.noSuchMethod( - Invocation.getter(#isRefreshing), - returnValue: false, - ) as bool); - @override - bool get hasCalledExit => (super.noSuchMethod( - Invocation.getter(#hasCalledExit), - returnValue: false, - ) as bool); - @override - _i18.Future get chainHeight => (super.noSuchMethod( - Invocation.getter(#chainHeight), - returnValue: _i18.Future.value(0), - ) as _i18.Future); - @override - int get storedChainHeight => (super.noSuchMethod( - Invocation.getter(#storedChainHeight), - returnValue: 0, - ) as int); - @override - _i9.Balance get balance => (super.noSuchMethod( - Invocation.getter(#balance), - returnValue: _FakeBalance_6( - this, - Invocation.getter(#balance), - ), - ) as _i9.Balance); - @override - _i9.Balance get balancePrivate => (super.noSuchMethod( - Invocation.getter(#balancePrivate), - returnValue: _FakeBalance_6( - this, - Invocation.getter(#balancePrivate), - ), - ) as _i9.Balance); - @override - _i18.Future> get utxos => (super.noSuchMethod( - Invocation.getter(#utxos), - returnValue: _i18.Future>.value(<_i21.UTXO>[]), - ) as _i18.Future>); - @override - _i18.Future> get transactions => (super.noSuchMethod( - Invocation.getter(#transactions), - returnValue: - _i18.Future>.value(<_i21.Transaction>[]), - ) as _i18.Future>); - @override - _i18.Future get xpub => (super.noSuchMethod( - Invocation.getter(#xpub), - returnValue: _i18.Future.value(''), - ) as _i18.Future); - @override - set onIsActiveWalletChanged(void Function(bool)? _onIsActiveWalletChanged) => - super.noSuchMethod( - Invocation.setter( - #onIsActiveWalletChanged, - _onIsActiveWalletChanged, - ), - returnValueForMissingStub: null, - ); - @override - _i14.MainDB get db => (super.noSuchMethod( - Invocation.getter(#db), - returnValue: _FakeMainDB_11( - this, - Invocation.getter(#db), - ), - ) as _i14.MainDB); - @override - bool validateAddress(String? address) => (super.noSuchMethod( - Invocation.method( - #validateAddress, - [address], - ), - returnValue: false, - ) as bool); - @override - _i18.Future updateSentCachedTxData(Map? txData) => - (super.noSuchMethod( - Invocation.method( - #updateSentCachedTxData, - [txData], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future testNetworkConnection() => (super.noSuchMethod( - Invocation.method( - #testNetworkConnection, - [], - ), - returnValue: _i18.Future.value(false), - ) as _i18.Future); - @override - void startNetworkAlivePinging() => super.noSuchMethod( - Invocation.method( - #startNetworkAlivePinging, - [], - ), - returnValueForMissingStub: null, - ); - @override - void stopNetworkAlivePinging() => super.noSuchMethod( - Invocation.method( - #stopNetworkAlivePinging, - [], - ), - returnValueForMissingStub: null, - ); - @override - _i18.Future> prepareSendPublic({ - required String? address, - required _i10.Amount? amount, - Map? args, - }) => - (super.noSuchMethod( - Invocation.method( - #prepareSendPublic, - [], - { - #address: address, - #amount: amount, - #args: args, - }, - ), - returnValue: - _i18.Future>.value({}), - ) as _i18.Future>); - @override - _i18.Future confirmSendPublic({dynamic txData}) => - (super.noSuchMethod( - Invocation.method( - #confirmSendPublic, - [], - {#txData: txData}, - ), - returnValue: _i18.Future.value(''), - ) as _i18.Future); - @override - _i18.Future> prepareSend({ - required String? address, - required _i10.Amount? amount, - Map? args, - }) => - (super.noSuchMethod( - Invocation.method( - #prepareSend, - [], - { - #address: address, - #amount: amount, - #args: args, - }, - ), - returnValue: - _i18.Future>.value({}), - ) as _i18.Future>); - @override - _i18.Future confirmSend({required Map? txData}) => - (super.noSuchMethod( - Invocation.method( - #confirmSend, - [], - {#txData: txData}, - ), - returnValue: _i18.Future.value(''), - ) as _i18.Future); - @override - int estimateTxFee({ - required int? vSize, - required int? feeRatePerKB, - }) => - (super.noSuchMethod( - Invocation.method( - #estimateTxFee, - [], - { - #vSize: vSize, - #feeRatePerKB: feeRatePerKB, - }, - ), - returnValue: 0, - ) as int); - @override - dynamic coinSelection( - int? satoshiAmountToSend, - int? selectedTxFeeRate, - String? _recipientAddress, - bool? isSendAll, { - int? additionalOutputs = 0, - List<_i21.UTXO>? utxos, - }) => - super.noSuchMethod(Invocation.method( - #coinSelection, - [ - satoshiAmountToSend, - selectedTxFeeRate, - _recipientAddress, - isSendAll, - ], - { - #additionalOutputs: additionalOutputs, - #utxos: utxos, - }, - )); - @override - _i18.Future> fetchBuildTxData( - List<_i21.UTXO>? utxosToUse) => - (super.noSuchMethod( - Invocation.method( - #fetchBuildTxData, - [utxosToUse], - ), - returnValue: - _i18.Future>.value(<_i23.SigningData>[]), - ) as _i18.Future>); - @override - _i18.Future> buildTransaction({ - required List<_i23.SigningData>? utxoSigningData, - required List? recipients, - required List? satoshiAmounts, - }) => - (super.noSuchMethod( - Invocation.method( - #buildTransaction, - [], - { - #utxoSigningData: utxoSigningData, - #recipients: recipients, - #satoshiAmounts: satoshiAmounts, - }, - ), - returnValue: - _i18.Future>.value({}), - ) as _i18.Future>); - @override - _i18.Future updateNode(bool? shouldRefresh) => (super.noSuchMethod( - Invocation.method( - #updateNode, - [shouldRefresh], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future initializeNew() => (super.noSuchMethod( - Invocation.method( - #initializeNew, - [], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future initializeExisting() => (super.noSuchMethod( - Invocation.method( - #initializeExisting, - [], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future refreshIfThereIsNewData() => (super.noSuchMethod( - Invocation.method( - #refreshIfThereIsNewData, - [], - ), - returnValue: _i18.Future.value(false), - ) as _i18.Future); - @override - _i18.Future getAllTxsToWatch() => (super.noSuchMethod( - Invocation.method( - #getAllTxsToWatch, - [], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future refresh() => (super.noSuchMethod( - Invocation.method( - #refresh, - [], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - List> getLelantusCoinMap() => - (super.noSuchMethod( - Invocation.method( - #getLelantusCoinMap, - [], - ), - returnValue: >[], - ) as List>); - @override - _i18.Future anonymizeAllPublicFunds() => (super.noSuchMethod( - Invocation.method( - #anonymizeAllPublicFunds, - [], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future>> createMintsFromAmount(int? total) => - (super.noSuchMethod( - Invocation.method( - #createMintsFromAmount, - [total], - ), - returnValue: _i18.Future>>.value( - >[]), - ) as _i18.Future>>); - @override - _i18.Future submitHexToNetwork(String? hex) => (super.noSuchMethod( - Invocation.method( - #submitHexToNetwork, - [hex], - ), - returnValue: _i18.Future.value(''), - ) as _i18.Future); - @override - _i18.Future> buildMintTransaction( - List<_i21.UTXO>? utxosToUse, - int? satoshisPerRecipient, - List>? mintsMap, - ) => - (super.noSuchMethod( - Invocation.method( - #buildMintTransaction, - [ - utxosToUse, - satoshisPerRecipient, - mintsMap, - ], - ), - returnValue: - _i18.Future>.value({}), - ) as _i18.Future>); - @override - _i18.Future checkReceivingAddressForTransactions() => - (super.noSuchMethod( - Invocation.method( - #checkReceivingAddressForTransactions, - [], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future checkChangeAddressForTransactions() => (super.noSuchMethod( - Invocation.method( - #checkChangeAddressForTransactions, - [], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future fullRescan( - int? maxUnusedAddressGap, - int? maxNumberOfIndexesToCheck, - ) => - (super.noSuchMethod( - Invocation.method( - #fullRescan, - [ - maxUnusedAddressGap, - maxNumberOfIndexesToCheck, - ], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future recoverFromMnemonic({ - required String? mnemonic, - String? mnemonicPassphrase, - required int? maxUnusedAddressGap, - required int? maxNumberOfIndexesToCheck, - required int? height, - }) => - (super.noSuchMethod( - Invocation.method( - #recoverFromMnemonic, - [], - { - #mnemonic: mnemonic, - #mnemonicPassphrase: mnemonicPassphrase, - #maxUnusedAddressGap: maxUnusedAddressGap, - #maxNumberOfIndexesToCheck: maxNumberOfIndexesToCheck, - #height: height, - }, - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future> getSetDataMap(int? latestSetId) => - (super.noSuchMethod( - Invocation.method( - #getSetDataMap, - [latestSetId], - ), - returnValue: _i18.Future>.value({}), - ) as _i18.Future>); - @override - _i18.Future getTransactionCacheEarly(List? allAddresses) => - (super.noSuchMethod( - Invocation.method( - #getTransactionCacheEarly, - [allAddresses], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future>> fetchAnonymitySets() => - (super.noSuchMethod( - Invocation.method( - #fetchAnonymitySets, - [], - ), - returnValue: _i18.Future>>.value( - >[]), - ) as _i18.Future>>); - @override - _i18.Future getLatestSetId() => (super.noSuchMethod( - Invocation.method( - #getLatestSetId, - [], - ), - returnValue: _i18.Future.value(0), - ) as _i18.Future); - @override - _i18.Future> getUsedCoinSerials() => (super.noSuchMethod( - Invocation.method( - #getUsedCoinSerials, - [], - ), - returnValue: _i18.Future>.value([]), - ) as _i18.Future>); - @override - _i18.Future exit() => (super.noSuchMethod( - Invocation.method( - #exit, - [], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future getCoinsToJoinSplit(int? required) => - (super.noSuchMethod( - Invocation.method( - #getCoinsToJoinSplit, - [required], - ), - returnValue: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future estimateJoinSplitFee(int? spendAmount) => - (super.noSuchMethod( - Invocation.method( - #estimateJoinSplitFee, - [spendAmount], - ), - returnValue: _i18.Future.value(0), - ) as _i18.Future); - @override - _i18.Future<_i10.Amount> estimateFeeFor( - _i10.Amount? amount, - int? feeRate, - ) => - (super.noSuchMethod( - Invocation.method( - #estimateFeeFor, - [ - amount, - feeRate, - ], - ), - returnValue: _i18.Future<_i10.Amount>.value(_FakeAmount_7( - this, - Invocation.method( - #estimateFeeFor, - [ - amount, - feeRate, - ], - ), - )), - ) as _i18.Future<_i10.Amount>); - @override - _i18.Future<_i10.Amount> estimateFeeForPublic( - _i10.Amount? amount, - int? feeRate, - ) => - (super.noSuchMethod( - Invocation.method( - #estimateFeeForPublic, - [ - amount, - feeRate, - ], - ), - returnValue: _i18.Future<_i10.Amount>.value(_FakeAmount_7( - this, - Invocation.method( - #estimateFeeForPublic, - [ - amount, - feeRate, - ], - ), - )), - ) as _i18.Future<_i10.Amount>); - @override - _i10.Amount roughFeeEstimate( - int? inputCount, - int? outputCount, - int? feeRatePerKB, - ) => - (super.noSuchMethod( - Invocation.method( - #roughFeeEstimate, - [ - inputCount, - outputCount, - feeRatePerKB, - ], - ), - returnValue: _FakeAmount_7( - this, - Invocation.method( - #roughFeeEstimate, - [ - inputCount, - outputCount, - feeRatePerKB, - ], - ), - ), - ) as _i10.Amount); - @override - _i18.Future<_i10.Amount> sweepAllEstimate(int? feeRate) => - (super.noSuchMethod( - Invocation.method( - #sweepAllEstimate, - [feeRate], - ), - returnValue: _i18.Future<_i10.Amount>.value(_FakeAmount_7( - this, - Invocation.method( - #sweepAllEstimate, - [feeRate], - ), - )), - ) as _i18.Future<_i10.Amount>); - @override - _i18.Future>> fastFetch( - List? allTxHashes) => - (super.noSuchMethod( - Invocation.method( - #fastFetch, - [allTxHashes], - ), - returnValue: _i18.Future>>.value( - >[]), - ) as _i18.Future>>); - @override - _i18.Future> getJMintTransactions( - _i13.CachedElectrumX? cachedClient, - List? transactions, - _i17.Coin? coin, - ) => - (super.noSuchMethod( - Invocation.method( - #getJMintTransactions, - [ - cachedClient, - transactions, - coin, - ], - ), - returnValue: _i18.Future>.value( - <_i21.Address, _i21.Transaction>{}), - ) as _i18.Future>); - @override - _i18.Future generateNewAddress() => (super.noSuchMethod( - Invocation.method( - #generateNewAddress, - [], - ), - returnValue: _i18.Future.value(false), - ) as _i18.Future); - @override - _i10.Amount availablePrivateBalance() => (super.noSuchMethod( - Invocation.method( - #availablePrivateBalance, - [], - ), - returnValue: _FakeAmount_7( - this, - Invocation.method( - #availablePrivateBalance, - [], - ), - ), - ) as _i10.Amount); - @override - _i10.Amount availablePublicBalance() => (super.noSuchMethod( - Invocation.method( - #availablePublicBalance, - [], - ), - returnValue: _FakeAmount_7( - this, - Invocation.method( - #availablePublicBalance, - [], - ), - ), - ) as _i10.Amount); - @override - void initCache( - String? walletId, - _i17.Coin? coin, - ) => - super.noSuchMethod( - Invocation.method( - #initCache, - [ - walletId, - coin, - ], - ), - returnValueForMissingStub: null, - ); - @override - _i18.Future updateCachedId(String? id) => (super.noSuchMethod( - Invocation.method( - #updateCachedId, - [id], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - int getCachedChainHeight() => (super.noSuchMethod( - Invocation.method( - #getCachedChainHeight, - [], - ), - returnValue: 0, - ) as int); - @override - _i18.Future updateCachedChainHeight(int? height) => (super.noSuchMethod( - Invocation.method( - #updateCachedChainHeight, - [height], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - bool getCachedIsFavorite() => (super.noSuchMethod( - Invocation.method( - #getCachedIsFavorite, - [], - ), - returnValue: false, - ) as bool); - @override - _i18.Future updateCachedIsFavorite(bool? isFavorite) => - (super.noSuchMethod( - Invocation.method( - #updateCachedIsFavorite, - [isFavorite], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i9.Balance getCachedBalance() => (super.noSuchMethod( - Invocation.method( - #getCachedBalance, - [], - ), - returnValue: _FakeBalance_6( - this, - Invocation.method( - #getCachedBalance, - [], - ), - ), - ) as _i9.Balance); - @override - _i18.Future updateCachedBalance(_i9.Balance? balance) => - (super.noSuchMethod( - Invocation.method( - #updateCachedBalance, - [balance], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i9.Balance getCachedBalanceSecondary() => (super.noSuchMethod( - Invocation.method( - #getCachedBalanceSecondary, - [], - ), - returnValue: _FakeBalance_6( - this, - Invocation.method( - #getCachedBalanceSecondary, - [], - ), - ), - ) as _i9.Balance); - @override - _i18.Future updateCachedBalanceSecondary(_i9.Balance? balance) => - (super.noSuchMethod( - Invocation.method( - #updateCachedBalanceSecondary, - [balance], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - List getWalletTokenContractAddresses() => (super.noSuchMethod( - Invocation.method( - #getWalletTokenContractAddresses, - [], - ), - returnValue: [], - ) as List); - @override - _i18.Future updateWalletTokenContractAddresses( - List? contractAddresses) => - (super.noSuchMethod( - Invocation.method( - #updateWalletTokenContractAddresses, - [contractAddresses], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - void initWalletDB({_i14.MainDB? mockableOverride}) => super.noSuchMethod( - Invocation.method( - #initWalletDB, - [], - {#mockableOverride: mockableOverride}, - ), - returnValueForMissingStub: null, - ); - @override - void initFiroHive(String? walletId) => super.noSuchMethod( - Invocation.method( - #initFiroHive, - [walletId], - ), - returnValueForMissingStub: null, - ); - @override - _i18.Future firoUpdateJIndex(List? jIndex) => - (super.noSuchMethod( - Invocation.method( - #firoUpdateJIndex, - [jIndex], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future firoUpdateLelantusCoins(List? lelantusCoins) => - (super.noSuchMethod( - Invocation.method( - #firoUpdateLelantusCoins, - [lelantusCoins], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - int firoGetMintIndex() => (super.noSuchMethod( - Invocation.method( - #firoGetMintIndex, - [], - ), - returnValue: 0, - ) as int); - @override - _i18.Future firoUpdateMintIndex(int? mintIndex) => (super.noSuchMethod( - Invocation.method( - #firoUpdateMintIndex, - [mintIndex], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); -} - -/// A class which mocks [LocaleService]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockLocaleService extends _i1.Mock implements _i24.LocaleService { - MockLocaleService() { - _i1.throwOnMissingStub(this); - } - - @override - String get locale => (super.noSuchMethod( - Invocation.getter(#locale), - returnValue: '', - ) as String); - @override - bool get hasListeners => (super.noSuchMethod( - Invocation.getter(#hasListeners), - returnValue: false, - ) as bool); - @override - _i18.Future loadLocale({bool? notify = true}) => (super.noSuchMethod( - Invocation.method( - #loadLocale, - [], - {#notify: notify}, - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - void addListener(_i20.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #addListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void removeListener(_i20.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #removeListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void dispose() => super.noSuchMethod( - Invocation.method( - #dispose, - [], - ), - returnValueForMissingStub: null, - ); - @override - void notifyListeners() => super.noSuchMethod( - Invocation.method( - #notifyListeners, - [], - ), - returnValueForMissingStub: null, - ); -} - -/// A class which mocks [Prefs]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockPrefs extends _i1.Mock implements _i19.Prefs { - MockPrefs() { - _i1.throwOnMissingStub(this); - } - - @override - bool get isInitialized => (super.noSuchMethod( - Invocation.getter(#isInitialized), - returnValue: false, - ) as bool); - @override - int get lastUnlockedTimeout => (super.noSuchMethod( - Invocation.getter(#lastUnlockedTimeout), - returnValue: 0, - ) as int); - @override - set lastUnlockedTimeout(int? lastUnlockedTimeout) => super.noSuchMethod( - Invocation.setter( - #lastUnlockedTimeout, - lastUnlockedTimeout, - ), - returnValueForMissingStub: null, - ); - @override - int get lastUnlocked => (super.noSuchMethod( - Invocation.getter(#lastUnlocked), - returnValue: 0, - ) as int); - @override - set lastUnlocked(int? lastUnlocked) => super.noSuchMethod( - Invocation.setter( - #lastUnlocked, - lastUnlocked, - ), - returnValueForMissingStub: null, - ); - @override - int get currentNotificationId => (super.noSuchMethod( - Invocation.getter(#currentNotificationId), - returnValue: 0, - ) as int); - @override - List get walletIdsSyncOnStartup => (super.noSuchMethod( - Invocation.getter(#walletIdsSyncOnStartup), - returnValue: [], - ) as List); - @override - set walletIdsSyncOnStartup(List? walletIdsSyncOnStartup) => - super.noSuchMethod( - Invocation.setter( - #walletIdsSyncOnStartup, - walletIdsSyncOnStartup, - ), - returnValueForMissingStub: null, - ); - @override - _i25.SyncingType get syncType => (super.noSuchMethod( - Invocation.getter(#syncType), - returnValue: _i25.SyncingType.currentWalletOnly, - ) as _i25.SyncingType); - @override - set syncType(_i25.SyncingType? syncType) => super.noSuchMethod( - Invocation.setter( - #syncType, - syncType, - ), - returnValueForMissingStub: null, - ); - @override - bool get wifiOnly => (super.noSuchMethod( - Invocation.getter(#wifiOnly), - returnValue: false, - ) as bool); - @override - set wifiOnly(bool? wifiOnly) => super.noSuchMethod( - Invocation.setter( - #wifiOnly, - wifiOnly, - ), - returnValueForMissingStub: null, - ); - @override - bool get showFavoriteWallets => (super.noSuchMethod( - Invocation.getter(#showFavoriteWallets), - returnValue: false, - ) as bool); - @override - set showFavoriteWallets(bool? showFavoriteWallets) => super.noSuchMethod( - Invocation.setter( - #showFavoriteWallets, - showFavoriteWallets, - ), - returnValueForMissingStub: null, - ); - @override - String get language => (super.noSuchMethod( - Invocation.getter(#language), - returnValue: '', - ) as String); - @override - set language(String? newLanguage) => super.noSuchMethod( - Invocation.setter( - #language, - newLanguage, - ), - returnValueForMissingStub: null, - ); - @override - String get currency => (super.noSuchMethod( - Invocation.getter(#currency), - returnValue: '', - ) as String); - @override - set currency(String? newCurrency) => super.noSuchMethod( - Invocation.setter( - #currency, - newCurrency, - ), - returnValueForMissingStub: null, - ); - @override - bool get randomizePIN => (super.noSuchMethod( - Invocation.getter(#randomizePIN), - returnValue: false, - ) as bool); - @override - set randomizePIN(bool? randomizePIN) => super.noSuchMethod( - Invocation.setter( - #randomizePIN, - randomizePIN, - ), - returnValueForMissingStub: null, - ); - @override - bool get useBiometrics => (super.noSuchMethod( - Invocation.getter(#useBiometrics), - returnValue: false, - ) as bool); - @override - set useBiometrics(bool? useBiometrics) => super.noSuchMethod( - Invocation.setter( - #useBiometrics, - useBiometrics, - ), - returnValueForMissingStub: null, - ); - @override - bool get hasPin => (super.noSuchMethod( - Invocation.getter(#hasPin), - returnValue: false, - ) as bool); - @override - set hasPin(bool? hasPin) => super.noSuchMethod( - Invocation.setter( - #hasPin, - hasPin, - ), - returnValueForMissingStub: null, - ); - @override - int get familiarity => (super.noSuchMethod( - Invocation.getter(#familiarity), - returnValue: 0, - ) as int); - @override - set familiarity(int? familiarity) => super.noSuchMethod( - Invocation.setter( - #familiarity, - familiarity, - ), - returnValueForMissingStub: null, - ); - @override - bool get showTestNetCoins => (super.noSuchMethod( - Invocation.getter(#showTestNetCoins), - returnValue: false, - ) as bool); - @override - set showTestNetCoins(bool? showTestNetCoins) => super.noSuchMethod( - Invocation.setter( - #showTestNetCoins, - showTestNetCoins, - ), - returnValueForMissingStub: null, - ); - @override - bool get isAutoBackupEnabled => (super.noSuchMethod( - Invocation.getter(#isAutoBackupEnabled), - returnValue: false, - ) as bool); - @override - set isAutoBackupEnabled(bool? isAutoBackupEnabled) => super.noSuchMethod( - Invocation.setter( - #isAutoBackupEnabled, - isAutoBackupEnabled, - ), - returnValueForMissingStub: null, - ); - @override - set autoBackupLocation(String? autoBackupLocation) => super.noSuchMethod( - Invocation.setter( - #autoBackupLocation, - autoBackupLocation, - ), - returnValueForMissingStub: null, - ); - @override - _i26.BackupFrequencyType get backupFrequencyType => (super.noSuchMethod( - Invocation.getter(#backupFrequencyType), - returnValue: _i26.BackupFrequencyType.everyTenMinutes, - ) as _i26.BackupFrequencyType); - @override - set backupFrequencyType(_i26.BackupFrequencyType? backupFrequencyType) => - super.noSuchMethod( - Invocation.setter( - #backupFrequencyType, - backupFrequencyType, - ), - returnValueForMissingStub: null, - ); - @override - set lastAutoBackup(DateTime? lastAutoBackup) => super.noSuchMethod( - Invocation.setter( - #lastAutoBackup, - lastAutoBackup, - ), - returnValueForMissingStub: null, - ); - @override - bool get hideBlockExplorerWarning => (super.noSuchMethod( - Invocation.getter(#hideBlockExplorerWarning), - returnValue: false, - ) as bool); - @override - set hideBlockExplorerWarning(bool? hideBlockExplorerWarning) => - super.noSuchMethod( - Invocation.setter( - #hideBlockExplorerWarning, - hideBlockExplorerWarning, - ), - returnValueForMissingStub: null, - ); - @override - bool get gotoWalletOnStartup => (super.noSuchMethod( - Invocation.getter(#gotoWalletOnStartup), - returnValue: false, - ) as bool); - @override - set gotoWalletOnStartup(bool? gotoWalletOnStartup) => super.noSuchMethod( - Invocation.setter( - #gotoWalletOnStartup, - gotoWalletOnStartup, - ), - returnValueForMissingStub: null, - ); - @override - set startupWalletId(String? startupWalletId) => super.noSuchMethod( - Invocation.setter( - #startupWalletId, - startupWalletId, - ), - returnValueForMissingStub: null, - ); - @override - bool get externalCalls => (super.noSuchMethod( - Invocation.getter(#externalCalls), - returnValue: false, - ) as bool); - @override - set externalCalls(bool? externalCalls) => super.noSuchMethod( - Invocation.setter( - #externalCalls, - externalCalls, - ), - returnValueForMissingStub: null, - ); - @override - bool get enableCoinControl => (super.noSuchMethod( - Invocation.getter(#enableCoinControl), - returnValue: false, - ) as bool); - @override - set enableCoinControl(bool? enableCoinControl) => super.noSuchMethod( - Invocation.setter( - #enableCoinControl, - enableCoinControl, - ), - returnValueForMissingStub: null, - ); - @override - bool get enableSystemBrightness => (super.noSuchMethod( - Invocation.getter(#enableSystemBrightness), - returnValue: false, - ) as bool); - @override - set enableSystemBrightness(bool? enableSystemBrightness) => - super.noSuchMethod( - Invocation.setter( - #enableSystemBrightness, - enableSystemBrightness, - ), - returnValueForMissingStub: null, - ); - @override - String get themeId => (super.noSuchMethod( - Invocation.getter(#themeId), - returnValue: '', - ) as String); - @override - set themeId(String? themeId) => super.noSuchMethod( - Invocation.setter( - #themeId, - themeId, - ), - returnValueForMissingStub: null, - ); - @override - String get systemBrightnessLightThemeId => (super.noSuchMethod( - Invocation.getter(#systemBrightnessLightThemeId), - returnValue: '', - ) as String); - @override - set systemBrightnessLightThemeId(String? systemBrightnessLightThemeId) => - super.noSuchMethod( - Invocation.setter( - #systemBrightnessLightThemeId, - systemBrightnessLightThemeId, - ), - returnValueForMissingStub: null, - ); - @override - String get systemBrightnessDarkThemeId => (super.noSuchMethod( - Invocation.getter(#systemBrightnessDarkThemeId), - returnValue: '', - ) as String); - @override - set systemBrightnessDarkThemeId(String? systemBrightnessDarkThemeId) => - super.noSuchMethod( - Invocation.setter( - #systemBrightnessDarkThemeId, - systemBrightnessDarkThemeId, - ), - returnValueForMissingStub: null, - ); - @override - bool get hasListeners => (super.noSuchMethod( - Invocation.getter(#hasListeners), - returnValue: false, - ) as bool); - @override - _i18.Future init() => (super.noSuchMethod( - Invocation.method( - #init, - [], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future incrementCurrentNotificationIndex() => (super.noSuchMethod( - Invocation.method( - #incrementCurrentNotificationIndex, - [], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future isExternalCallsSet() => (super.noSuchMethod( - Invocation.method( - #isExternalCallsSet, - [], - ), - returnValue: _i18.Future.value(false), - ) as _i18.Future); - @override - _i18.Future saveUserID(String? userId) => (super.noSuchMethod( - Invocation.method( - #saveUserID, - [userId], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future saveSignupEpoch(int? signupEpoch) => (super.noSuchMethod( - Invocation.method( - #saveSignupEpoch, - [signupEpoch], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - void addListener(_i20.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #addListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void removeListener(_i20.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #removeListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void dispose() => super.noSuchMethod( - Invocation.method( - #dispose, - [], - ), - returnValueForMissingStub: null, - ); - @override - void notifyListeners() => super.noSuchMethod( - Invocation.method( - #notifyListeners, - [], - ), - returnValueForMissingStub: null, - ); -} - -/// A class which mocks [PriceService]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockPriceService extends _i1.Mock implements _i27.PriceService { - MockPriceService() { - _i1.throwOnMissingStub(this); - } - - @override - String get baseTicker => (super.noSuchMethod( - Invocation.getter(#baseTicker), - returnValue: '', - ) as String); - @override - set baseTicker(String? _baseTicker) => super.noSuchMethod( - Invocation.setter( - #baseTicker, - _baseTicker, - ), - returnValueForMissingStub: null, - ); - @override - Set get tokenContractAddressesToCheck => (super.noSuchMethod( - Invocation.getter(#tokenContractAddressesToCheck), - returnValue: {}, - ) as Set); - @override - Duration get updateInterval => (super.noSuchMethod( - Invocation.getter(#updateInterval), - returnValue: _FakeDuration_12( - this, - Invocation.getter(#updateInterval), - ), - ) as Duration); - @override - bool get hasListeners => (super.noSuchMethod( - Invocation.getter(#hasListeners), - returnValue: false, - ) as bool); - @override - _i15.Tuple2<_i28.Decimal, double> getPrice(_i17.Coin? coin) => - (super.noSuchMethod( - Invocation.method( - #getPrice, - [coin], - ), - returnValue: _FakeTuple2_13<_i28.Decimal, double>( - this, - Invocation.method( - #getPrice, - [coin], - ), - ), - ) as _i15.Tuple2<_i28.Decimal, double>); - @override - _i15.Tuple2<_i28.Decimal, double> getTokenPrice(String? contractAddress) => - (super.noSuchMethod( - Invocation.method( - #getTokenPrice, - [contractAddress], - ), - returnValue: _FakeTuple2_13<_i28.Decimal, double>( - this, - Invocation.method( - #getTokenPrice, - [contractAddress], - ), - ), - ) as _i15.Tuple2<_i28.Decimal, double>); - @override - _i18.Future updatePrice() => (super.noSuchMethod( - Invocation.method( - #updatePrice, - [], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - void cancel() => super.noSuchMethod( - Invocation.method( - #cancel, - [], - ), - returnValueForMissingStub: null, - ); - @override - void start(bool? rightAway) => super.noSuchMethod( - Invocation.method( - #start, - [rightAway], - ), - returnValueForMissingStub: null, - ); - @override - void dispose() => super.noSuchMethod( - Invocation.method( - #dispose, - [], - ), - returnValueForMissingStub: null, - ); - @override - void addListener(_i20.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #addListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void removeListener(_i20.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #removeListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void notifyListeners() => super.noSuchMethod( - Invocation.method( - #notifyListeners, - [], - ), - returnValueForMissingStub: null, - ); -} - -/// A class which mocks [NotesService]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockNotesService extends _i1.Mock implements _i29.NotesService { - MockNotesService() { - _i1.throwOnMissingStub(this); - } - - @override - String get walletId => (super.noSuchMethod( - Invocation.getter(#walletId), - returnValue: '', - ) as String); - @override - Map get notesSync => (super.noSuchMethod( - Invocation.getter(#notesSync), - returnValue: {}, - ) as Map); - @override - _i18.Future> get notes => (super.noSuchMethod( - Invocation.getter(#notes), - returnValue: _i18.Future>.value({}), - ) as _i18.Future>); - @override - bool get hasListeners => (super.noSuchMethod( - Invocation.getter(#hasListeners), - returnValue: false, - ) as bool); - @override - _i18.Future> search(String? text) => (super.noSuchMethod( - Invocation.method( - #search, - [text], - ), - returnValue: _i18.Future>.value({}), - ) as _i18.Future>); - @override - _i18.Future getNoteFor({required String? txid}) => - (super.noSuchMethod( - Invocation.method( - #getNoteFor, - [], - {#txid: txid}, - ), - returnValue: _i18.Future.value(''), - ) as _i18.Future); - @override - _i18.Future editOrAddNote({ - required String? txid, - required String? note, - }) => - (super.noSuchMethod( - Invocation.method( - #editOrAddNote, - [], - { - #txid: txid, - #note: note, - }, - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future deleteNote({required String? txid}) => (super.noSuchMethod( - Invocation.method( - #deleteNote, - [], - {#txid: txid}, - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - void addListener(_i20.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #addListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void removeListener(_i20.VoidCallback? listener) => super.noSuchMethod( - Invocation.method( - #removeListener, - [listener], - ), - returnValueForMissingStub: null, - ); - @override - void dispose() => super.noSuchMethod( - Invocation.method( - #dispose, - [], - ), - returnValueForMissingStub: null, - ); - @override - void notifyListeners() => super.noSuchMethod( - Invocation.method( - #notifyListeners, - [], - ), - returnValueForMissingStub: null, - ); -} - -/// A class which mocks [ThemeService]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockThemeService extends _i1.Mock implements _i30.ThemeService { - MockThemeService() { - _i1.throwOnMissingStub(this); - } - - @override - _i14.MainDB get db => (super.noSuchMethod( - Invocation.getter(#db), - returnValue: _FakeMainDB_11( - this, - Invocation.getter(#db), - ), - ) as _i14.MainDB); - @override - List<_i31.StackTheme> get installedThemes => (super.noSuchMethod( - Invocation.getter(#installedThemes), - returnValue: <_i31.StackTheme>[], - ) as List<_i31.StackTheme>); - @override - void init(_i14.MainDB? db) => super.noSuchMethod( - Invocation.method( - #init, - [db], - ), - returnValueForMissingStub: null, - ); - @override - _i18.Future install({required _i32.Uint8List? themeArchiveData}) => - (super.noSuchMethod( - Invocation.method( - #install, - [], - {#themeArchiveData: themeArchiveData}, - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future remove({required String? themeId}) => (super.noSuchMethod( - Invocation.method( - #remove, - [], - {#themeId: themeId}, - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future checkDefaultThemesOnStartup() => (super.noSuchMethod( - Invocation.method( - #checkDefaultThemesOnStartup, - [], - ), - returnValue: _i18.Future.value(), - returnValueForMissingStub: _i18.Future.value(), - ) as _i18.Future); - @override - _i18.Future verifyInstalled({required String? themeId}) => - (super.noSuchMethod( - Invocation.method( - #verifyInstalled, - [], - {#themeId: themeId}, - ), - returnValue: _i18.Future.value(false), - ) as _i18.Future); - @override - _i18.Future> fetchThemes() => - (super.noSuchMethod( - Invocation.method( - #fetchThemes, - [], - ), - returnValue: _i18.Future>.value( - <_i30.StackThemeMetaData>[]), - ) as _i18.Future>); - @override - _i18.Future<_i32.Uint8List> fetchTheme( - {required _i30.StackThemeMetaData? themeMetaData}) => - (super.noSuchMethod( - Invocation.method( - #fetchTheme, - [], - {#themeMetaData: themeMetaData}, - ), - returnValue: _i18.Future<_i32.Uint8List>.value(_i32.Uint8List(0)), - ) as _i18.Future<_i32.Uint8List>); - @override - _i31.StackTheme? getTheme({required String? themeId}) => - (super.noSuchMethod(Invocation.method( - #getTheme, - [], - {#themeId: themeId}, - )) as _i31.StackTheme?); -} diff --git a/test/widget_tests/wallet_info_row/sub_widgets/wallet_info_row_balance_future_test.mocks.dart b/test/widget_tests/wallet_info_row/sub_widgets/wallet_info_row_balance_future_test.mocks.dart index 3278f946f..79a4cbf64 100644 --- a/test/widget_tests/wallet_info_row/sub_widgets/wallet_info_row_balance_future_test.mocks.dart +++ b/test/widget_tests/wallet_info_row/sub_widgets/wallet_info_row_balance_future_test.mocks.dart @@ -1,11 +1,10 @@ -// Mocks generated by Mockito 5.3.2 from annotations +// Mocks generated by Mockito 5.4.2 from annotations // in stackduo/test/widget_tests/wallet_info_row/sub_widgets/wallet_info_row_balance_future_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i23; -import 'dart:typed_data' as _i29; -import 'dart:ui' as _i25; +import 'dart:typed_data' as _i28; import 'package:bip32/bip32.dart' as _i16; import 'package:bip47/bip47.dart' as _i18; @@ -13,15 +12,15 @@ import 'package:bitcoindart/bitcoindart.dart' as _i13; import 'package:flutter/foundation.dart' as _i4; import 'package:flutter_riverpod/flutter_riverpod.dart' as _i5; import 'package:mockito/mockito.dart' as _i1; -import 'package:stackduo/db/main_db.dart' as _i12; +import 'package:stackduo/db/isar/main_db.dart' as _i12; import 'package:stackduo/electrumx_rpc/cached_electrumx.dart' as _i10; import 'package:stackduo/electrumx_rpc/electrumx.dart' as _i9; import 'package:stackduo/models/balance.dart' as _i11; import 'package:stackduo/models/isar/models/isar_models.dart' as _i17; -import 'package:stackduo/models/node_model.dart' as _i30; +import 'package:stackduo/models/node_model.dart' as _i29; import 'package:stackduo/models/paymint/fee_object_model.dart' as _i8; -import 'package:stackduo/models/signing_data.dart' as _i28; -import 'package:stackduo/services/coins/bitcoin/bitcoin_wallet.dart' as _i26; +import 'package:stackduo/models/signing_data.dart' as _i27; +import 'package:stackduo/services/coins/bitcoin/bitcoin_wallet.dart' as _i25; import 'package:stackduo/services/coins/coin_service.dart' as _i20; import 'package:stackduo/services/coins/manager.dart' as _i6; import 'package:stackduo/services/node_service.dart' as _i3; @@ -30,7 +29,7 @@ import 'package:stackduo/services/wallets.dart' as _i21; import 'package:stackduo/services/wallets_service.dart' as _i2; import 'package:stackduo/utilities/amount/amount.dart' as _i14; import 'package:stackduo/utilities/enums/coin_enum.dart' as _i22; -import 'package:stackduo/utilities/enums/derive_path_type_enum.dart' as _i27; +import 'package:stackduo/utilities/enums/derive_path_type_enum.dart' as _i26; import 'package:stackduo/utilities/flutter_secure_storage_interface.dart' as _i19; import 'package:stackduo/utilities/prefs.dart' as _i24; @@ -427,7 +426,7 @@ class MockWallets extends _i1.Mock implements _i21.Wallets { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -435,7 +434,7 @@ class MockWallets extends _i1.Mock implements _i21.Wallets { returnValueForMissingStub: null, ); @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -653,7 +652,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -661,7 +660,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -689,7 +688,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { /// A class which mocks [BitcoinWallet]. /// /// See the documentation for Mockito's code generation for more information. -class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { +class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet { MockBitcoinWallet() { _i1.throwOnMissingStub(this); } @@ -950,15 +949,15 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - _i27.DerivePathType addressType({required String? address}) => + _i26.DerivePathType addressType({required String? address}) => (super.noSuchMethod( Invocation.method( #addressType, [], {#address: address}, ), - returnValue: _i27.DerivePathType.bip44, - ) as _i27.DerivePathType); + returnValue: _i26.DerivePathType.bip44, + ) as _i26.DerivePathType); @override _i23.Future recoverFromMnemonic({ required String? mnemonic, @@ -1194,6 +1193,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { required String? recipientAddress, required bool? coinControl, required bool? isSendAll, + int? satsPerVByte, int? additionalOutputs = 0, List<_i17.UTXO>? utxos, }) => @@ -1206,12 +1206,13 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { #recipientAddress: recipientAddress, #coinControl: coinControl, #isSendAll: isSendAll, + #satsPerVByte: satsPerVByte, #additionalOutputs: additionalOutputs, #utxos: utxos, }, )); @override - _i23.Future> fetchBuildTxData( + _i23.Future> fetchBuildTxData( List<_i17.UTXO>? utxosToUse) => (super.noSuchMethod( Invocation.method( @@ -1219,11 +1220,11 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { [utxosToUse], ), returnValue: - _i23.Future>.value(<_i28.SigningData>[]), - ) as _i23.Future>); + _i23.Future>.value(<_i27.SigningData>[]), + ) as _i23.Future>); @override _i23.Future> buildTransaction({ - required List<_i28.SigningData>? utxoSigningData, + required List<_i27.SigningData>? utxoSigningData, required List? recipients, required List? satoshiAmounts, }) => @@ -1512,7 +1513,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { })? prepareSend, required _i23.Future Function({required String address})? getTxCount, - required _i23.Future> Function(List<_i17.UTXO>)? + required _i23.Future> Function(List<_i17.UTXO>)? fetchBuildTxData, required _i23.Future Function()? refresh, required _i23.Future Function()? checkChangeAddressForTransactions, @@ -1562,7 +1563,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { )), ) as _i23.Future<_i16.BIP32>); @override - _i23.Future<_i29.Uint8List> getPrivateKeyForPaynymReceivingAddress({ + _i23.Future<_i28.Uint8List> getPrivateKeyForPaynymReceivingAddress({ required String? paymentCodeString, required int? index, }) => @@ -1575,8 +1576,8 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { #index: index, }, ), - returnValue: _i23.Future<_i29.Uint8List>.value(_i29.Uint8List(0)), - ) as _i23.Future<_i29.Uint8List>); + returnValue: _i23.Future<_i28.Uint8List>.value(_i28.Uint8List(0)), + ) as _i23.Future<_i28.Uint8List>); @override _i23.Future<_i17.Address> currentReceivingPaynymAddress({ required _i18.PaymentCode? sender, @@ -1662,14 +1663,14 @@ class MockBitcoinWallet extends _i1.Mock implements _i26.BitcoinWallet { )), ) as _i23.Future<_i18.PaymentCode>); @override - _i23.Future<_i29.Uint8List> signWithNotificationKey(_i29.Uint8List? data) => + _i23.Future<_i28.Uint8List> signWithNotificationKey(_i28.Uint8List? data) => (super.noSuchMethod( Invocation.method( #signWithNotificationKey, [data], ), - returnValue: _i23.Future<_i29.Uint8List>.value(_i29.Uint8List(0)), - ) as _i23.Future<_i29.Uint8List>); + returnValue: _i23.Future<_i28.Uint8List>.value(_i28.Uint8List(0)), + ) as _i23.Future<_i28.Uint8List>); @override _i23.Future signStringWithNotificationKey(String? data) => (super.noSuchMethod( @@ -1947,15 +1948,15 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { ), ) as _i19.SecureStorageInterface); @override - List<_i30.NodeModel> get primaryNodes => (super.noSuchMethod( + List<_i29.NodeModel> get primaryNodes => (super.noSuchMethod( Invocation.getter(#primaryNodes), - returnValue: <_i30.NodeModel>[], - ) as List<_i30.NodeModel>); + returnValue: <_i29.NodeModel>[], + ) as List<_i29.NodeModel>); @override - List<_i30.NodeModel> get nodes => (super.noSuchMethod( + List<_i29.NodeModel> get nodes => (super.noSuchMethod( Invocation.getter(#nodes), - returnValue: <_i30.NodeModel>[], - ) as List<_i30.NodeModel>); + returnValue: <_i29.NodeModel>[], + ) as List<_i29.NodeModel>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), @@ -1973,7 +1974,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { @override _i23.Future setPrimaryNodeFor({ required _i22.Coin? coin, - required _i30.NodeModel? node, + required _i29.NodeModel? node, bool? shouldNotifyListeners = false, }) => (super.noSuchMethod( @@ -1990,40 +1991,40 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - _i30.NodeModel? getPrimaryNodeFor({required _i22.Coin? coin}) => + _i29.NodeModel? getPrimaryNodeFor({required _i22.Coin? coin}) => (super.noSuchMethod(Invocation.method( #getPrimaryNodeFor, [], {#coin: coin}, - )) as _i30.NodeModel?); + )) as _i29.NodeModel?); @override - List<_i30.NodeModel> getNodesFor(_i22.Coin? coin) => (super.noSuchMethod( + List<_i29.NodeModel> getNodesFor(_i22.Coin? coin) => (super.noSuchMethod( Invocation.method( #getNodesFor, [coin], ), - returnValue: <_i30.NodeModel>[], - ) as List<_i30.NodeModel>); + returnValue: <_i29.NodeModel>[], + ) as List<_i29.NodeModel>); @override - _i30.NodeModel? getNodeById({required String? id}) => + _i29.NodeModel? getNodeById({required String? id}) => (super.noSuchMethod(Invocation.method( #getNodeById, [], {#id: id}, - )) as _i30.NodeModel?); + )) as _i29.NodeModel?); @override - List<_i30.NodeModel> failoverNodesFor({required _i22.Coin? coin}) => + List<_i29.NodeModel> failoverNodesFor({required _i22.Coin? coin}) => (super.noSuchMethod( Invocation.method( #failoverNodesFor, [], {#coin: coin}, ), - returnValue: <_i30.NodeModel>[], - ) as List<_i30.NodeModel>); + returnValue: <_i29.NodeModel>[], + ) as List<_i29.NodeModel>); @override _i23.Future add( - _i30.NodeModel? node, + _i29.NodeModel? node, String? password, bool? shouldNotifyListeners, ) => @@ -2075,7 +2076,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { ) as _i23.Future); @override _i23.Future edit( - _i30.NodeModel? editedNode, + _i29.NodeModel? editedNode, String? password, bool? shouldNotifyListeners, ) => @@ -2101,7 +2102,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -2109,7 +2110,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: null, ); @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -2286,6 +2287,11 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValue: false, ) as bool); @override + bool get hasTokenSupport => (super.noSuchMethod( + Invocation.getter(#hasTokenSupport), + returnValue: false, + ) as bool); + @override bool get hasWhirlpoolSupport => (super.noSuchMethod( Invocation.getter(#hasWhirlpoolSupport), returnValue: false, @@ -2489,7 +2495,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -2497,7 +2503,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], diff --git a/test/widget_tests/wallet_info_row/wallet_info_row_test.mocks.dart b/test/widget_tests/wallet_info_row/wallet_info_row_test.mocks.dart index f76a04c74..cdc37b791 100644 --- a/test/widget_tests/wallet_info_row/wallet_info_row_test.mocks.dart +++ b/test/widget_tests/wallet_info_row/wallet_info_row_test.mocks.dart @@ -1,11 +1,10 @@ -// Mocks generated by Mockito 5.3.2 from annotations -// in stackwallet/test/widget_tests/wallet_info_row/wallet_info_row_test.dart. +// Mocks generated by Mockito 5.4.2 from annotations +// in stackduo/test/widget_tests/wallet_info_row/wallet_info_row_test.dart. // Do not manually edit this file. // ignore_for_file: no_leading_underscores_for_library_prefixes import 'dart:async' as _i23; import 'dart:typed_data' as _i28; -import 'dart:ui' as _i25; import 'package:bip32/bip32.dart' as _i16; import 'package:bip47/bip47.dart' as _i18; @@ -13,30 +12,27 @@ import 'package:bitcoindart/bitcoindart.dart' as _i13; import 'package:flutter/foundation.dart' as _i4; import 'package:flutter_riverpod/flutter_riverpod.dart' as _i5; import 'package:mockito/mockito.dart' as _i1; -import 'package:stackwallet/db/isar/main_db.dart' as _i7; -import 'package:stackwallet/electrumx_rpc/cached_electrumx.dart' as _i11; -import 'package:stackwallet/electrumx_rpc/electrumx.dart' as _i10; -import 'package:stackwallet/models/balance.dart' as _i12; -import 'package:stackwallet/models/isar/models/isar_models.dart' as _i17; -import 'package:stackwallet/models/isar/stack_theme.dart' as _i27; -import 'package:stackwallet/models/node_model.dart' as _i32; -import 'package:stackwallet/models/paymint/fee_object_model.dart' as _i9; -import 'package:stackwallet/models/signing_data.dart' as _i31; -import 'package:stackwallet/services/coins/bitcoin/bitcoin_wallet.dart' as _i29; -import 'package:stackwallet/services/coins/coin_service.dart' as _i20; -import 'package:stackwallet/services/coins/manager.dart' as _i6; -import 'package:stackwallet/services/node_service.dart' as _i3; -import 'package:stackwallet/services/transaction_notification_tracker.dart' - as _i8; -import 'package:stackwallet/services/wallets.dart' as _i21; -import 'package:stackwallet/services/wallets_service.dart' as _i2; -import 'package:stackwallet/themes/theme_service.dart' as _i26; -import 'package:stackwallet/utilities/amount/amount.dart' as _i14; -import 'package:stackwallet/utilities/enums/coin_enum.dart' as _i22; -import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart' as _i30; -import 'package:stackwallet/utilities/flutter_secure_storage_interface.dart' +import 'package:stackduo/db/isar/main_db.dart' as _i12; +import 'package:stackduo/electrumx_rpc/cached_electrumx.dart' as _i10; +import 'package:stackduo/electrumx_rpc/electrumx.dart' as _i9; +import 'package:stackduo/models/balance.dart' as _i11; +import 'package:stackduo/models/isar/models/isar_models.dart' as _i17; +import 'package:stackduo/models/node_model.dart' as _i29; +import 'package:stackduo/models/paymint/fee_object_model.dart' as _i8; +import 'package:stackduo/models/signing_data.dart' as _i27; +import 'package:stackduo/services/coins/bitcoin/bitcoin_wallet.dart' as _i25; +import 'package:stackduo/services/coins/coin_service.dart' as _i20; +import 'package:stackduo/services/coins/manager.dart' as _i6; +import 'package:stackduo/services/node_service.dart' as _i3; +import 'package:stackduo/services/transaction_notification_tracker.dart' as _i7; +import 'package:stackduo/services/wallets.dart' as _i21; +import 'package:stackduo/services/wallets_service.dart' as _i2; +import 'package:stackduo/utilities/amount/amount.dart' as _i14; +import 'package:stackduo/utilities/enums/coin_enum.dart' as _i22; +import 'package:stackduo/utilities/enums/derive_path_type_enum.dart' as _i26; +import 'package:stackduo/utilities/flutter_secure_storage_interface.dart' as _i19; -import 'package:stackwallet/utilities/prefs.dart' as _i24; +import 'package:stackduo/utilities/prefs.dart' as _i24; import 'package:tuple/tuple.dart' as _i15; // ignore_for_file: type=lint @@ -92,8 +88,9 @@ class _FakeManager_3 extends _i1.SmartFake implements _i6.Manager { ); } -class _FakeMainDB_4 extends _i1.SmartFake implements _i7.MainDB { - _FakeMainDB_4( +class _FakeTransactionNotificationTracker_4 extends _i1.SmartFake + implements _i7.TransactionNotificationTracker { + _FakeTransactionNotificationTracker_4( Object parent, Invocation parentInvocation, ) : super( @@ -102,9 +99,8 @@ class _FakeMainDB_4 extends _i1.SmartFake implements _i7.MainDB { ); } -class _FakeTransactionNotificationTracker_5 extends _i1.SmartFake - implements _i8.TransactionNotificationTracker { - _FakeTransactionNotificationTracker_5( +class _FakeFeeObject_5 extends _i1.SmartFake implements _i8.FeeObject { + _FakeFeeObject_5( Object parent, Invocation parentInvocation, ) : super( @@ -113,8 +109,8 @@ class _FakeTransactionNotificationTracker_5 extends _i1.SmartFake ); } -class _FakeFeeObject_6 extends _i1.SmartFake implements _i9.FeeObject { - _FakeFeeObject_6( +class _FakeElectrumX_6 extends _i1.SmartFake implements _i9.ElectrumX { + _FakeElectrumX_6( Object parent, Invocation parentInvocation, ) : super( @@ -123,8 +119,9 @@ class _FakeFeeObject_6 extends _i1.SmartFake implements _i9.FeeObject { ); } -class _FakeElectrumX_7 extends _i1.SmartFake implements _i10.ElectrumX { - _FakeElectrumX_7( +class _FakeCachedElectrumX_7 extends _i1.SmartFake + implements _i10.CachedElectrumX { + _FakeCachedElectrumX_7( Object parent, Invocation parentInvocation, ) : super( @@ -133,9 +130,8 @@ class _FakeElectrumX_7 extends _i1.SmartFake implements _i10.ElectrumX { ); } -class _FakeCachedElectrumX_8 extends _i1.SmartFake - implements _i11.CachedElectrumX { - _FakeCachedElectrumX_8( +class _FakeBalance_8 extends _i1.SmartFake implements _i11.Balance { + _FakeBalance_8( Object parent, Invocation parentInvocation, ) : super( @@ -144,8 +140,8 @@ class _FakeCachedElectrumX_8 extends _i1.SmartFake ); } -class _FakeBalance_9 extends _i1.SmartFake implements _i12.Balance { - _FakeBalance_9( +class _FakeMainDB_9 extends _i1.SmartFake implements _i12.MainDB { + _FakeMainDB_9( Object parent, Invocation parentInvocation, ) : super( @@ -164,8 +160,7 @@ class _FakeNetworkType_10 extends _i1.SmartFake implements _i13.NetworkType { ); } -class _FakeElectrumXNode_11 extends _i1.SmartFake - implements _i10.ElectrumXNode { +class _FakeElectrumXNode_11 extends _i1.SmartFake implements _i9.ElectrumXNode { _FakeElectrumXNode_11( Object parent, Invocation parentInvocation, @@ -431,7 +426,7 @@ class MockWallets extends _i1.Mock implements _i21.Wallets { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -439,7 +434,7 @@ class MockWallets extends _i1.Mock implements _i21.Wallets { returnValueForMissingStub: null, ); @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -657,7 +652,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -665,7 +660,7 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { returnValueForMissingStub: null, ); @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -690,109 +685,10 @@ class MockWalletsService extends _i1.Mock implements _i2.WalletsService { ); } -/// A class which mocks [ThemeService]. -/// -/// See the documentation for Mockito's code generation for more information. -class MockThemeService extends _i1.Mock implements _i26.ThemeService { - MockThemeService() { - _i1.throwOnMissingStub(this); - } - - @override - _i7.MainDB get db => (super.noSuchMethod( - Invocation.getter(#db), - returnValue: _FakeMainDB_4( - this, - Invocation.getter(#db), - ), - ) as _i7.MainDB); - @override - List<_i27.StackTheme> get installedThemes => (super.noSuchMethod( - Invocation.getter(#installedThemes), - returnValue: <_i27.StackTheme>[], - ) as List<_i27.StackTheme>); - @override - void init(_i7.MainDB? db) => super.noSuchMethod( - Invocation.method( - #init, - [db], - ), - returnValueForMissingStub: null, - ); - @override - _i23.Future install({required _i28.Uint8List? themeArchiveData}) => - (super.noSuchMethod( - Invocation.method( - #install, - [], - {#themeArchiveData: themeArchiveData}, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future remove({required String? themeId}) => (super.noSuchMethod( - Invocation.method( - #remove, - [], - {#themeId: themeId}, - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future checkDefaultThemesOnStartup() => (super.noSuchMethod( - Invocation.method( - #checkDefaultThemesOnStartup, - [], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - _i23.Future verifyInstalled({required String? themeId}) => - (super.noSuchMethod( - Invocation.method( - #verifyInstalled, - [], - {#themeId: themeId}, - ), - returnValue: _i23.Future.value(false), - ) as _i23.Future); - @override - _i23.Future> fetchThemes() => - (super.noSuchMethod( - Invocation.method( - #fetchThemes, - [], - ), - returnValue: _i23.Future>.value( - <_i26.StackThemeMetaData>[]), - ) as _i23.Future>); - @override - _i23.Future<_i28.Uint8List> fetchTheme( - {required _i26.StackThemeMetaData? themeMetaData}) => - (super.noSuchMethod( - Invocation.method( - #fetchTheme, - [], - {#themeMetaData: themeMetaData}, - ), - returnValue: _i23.Future<_i28.Uint8List>.value(_i28.Uint8List(0)), - ) as _i23.Future<_i28.Uint8List>); - @override - _i27.StackTheme? getTheme({required String? themeId}) => - (super.noSuchMethod(Invocation.method( - #getTheme, - [], - {#themeId: themeId}, - )) as _i27.StackTheme?); -} - /// A class which mocks [BitcoinWallet]. /// /// See the documentation for Mockito's code generation for more information. -class MockBitcoinWallet extends _i1.Mock implements _i29.BitcoinWallet { +class MockBitcoinWallet extends _i1.Mock implements _i25.BitcoinWallet { MockBitcoinWallet() { _i1.throwOnMissingStub(this); } @@ -806,15 +702,15 @@ class MockBitcoinWallet extends _i1.Mock implements _i29.BitcoinWallet { returnValueForMissingStub: null, ); @override - _i8.TransactionNotificationTracker get txTracker => (super.noSuchMethod( + _i7.TransactionNotificationTracker get txTracker => (super.noSuchMethod( Invocation.getter(#txTracker), - returnValue: _FakeTransactionNotificationTracker_5( + returnValue: _FakeTransactionNotificationTracker_4( this, Invocation.getter(#txTracker), ), - ) as _i8.TransactionNotificationTracker); + ) as _i7.TransactionNotificationTracker); @override - set txTracker(_i8.TransactionNotificationTracker? _txTracker) => + set txTracker(_i7.TransactionNotificationTracker? _txTracker) => super.noSuchMethod( Invocation.setter( #txTracker, @@ -911,13 +807,13 @@ class MockBitcoinWallet extends _i1.Mock implements _i29.BitcoinWallet { returnValue: false, ) as bool); @override - _i23.Future<_i9.FeeObject> get fees => (super.noSuchMethod( + _i23.Future<_i8.FeeObject> get fees => (super.noSuchMethod( Invocation.getter(#fees), - returnValue: _i23.Future<_i9.FeeObject>.value(_FakeFeeObject_6( + returnValue: _i23.Future<_i8.FeeObject>.value(_FakeFeeObject_5( this, Invocation.getter(#fees), )), - ) as _i23.Future<_i9.FeeObject>); + ) as _i23.Future<_i8.FeeObject>); @override _i23.Future get maxFee => (super.noSuchMethod( Invocation.getter(#maxFee), @@ -990,29 +886,29 @@ class MockBitcoinWallet extends _i1.Mock implements _i29.BitcoinWallet { returnValueForMissingStub: null, ); @override - _i10.ElectrumX get electrumXClient => (super.noSuchMethod( + _i9.ElectrumX get electrumXClient => (super.noSuchMethod( Invocation.getter(#electrumXClient), - returnValue: _FakeElectrumX_7( + returnValue: _FakeElectrumX_6( this, Invocation.getter(#electrumXClient), ), - ) as _i10.ElectrumX); + ) as _i9.ElectrumX); @override - _i11.CachedElectrumX get cachedElectrumXClient => (super.noSuchMethod( + _i10.CachedElectrumX get cachedElectrumXClient => (super.noSuchMethod( Invocation.getter(#cachedElectrumXClient), - returnValue: _FakeCachedElectrumX_8( + returnValue: _FakeCachedElectrumX_7( this, Invocation.getter(#cachedElectrumXClient), ), - ) as _i11.CachedElectrumX); + ) as _i10.CachedElectrumX); @override - _i12.Balance get balance => (super.noSuchMethod( + _i11.Balance get balance => (super.noSuchMethod( Invocation.getter(#balance), - returnValue: _FakeBalance_9( + returnValue: _FakeBalance_8( this, Invocation.getter(#balance), ), - ) as _i12.Balance); + ) as _i11.Balance); @override _i23.Future get xpub => (super.noSuchMethod( Invocation.getter(#xpub), @@ -1028,13 +924,13 @@ class MockBitcoinWallet extends _i1.Mock implements _i29.BitcoinWallet { returnValueForMissingStub: null, ); @override - _i7.MainDB get db => (super.noSuchMethod( + _i12.MainDB get db => (super.noSuchMethod( Invocation.getter(#db), - returnValue: _FakeMainDB_4( + returnValue: _FakeMainDB_9( this, Invocation.getter(#db), ), - ) as _i7.MainDB); + ) as _i12.MainDB); @override _i13.NetworkType get networkType => (super.noSuchMethod( Invocation.getter(#networkType), @@ -1053,15 +949,15 @@ class MockBitcoinWallet extends _i1.Mock implements _i29.BitcoinWallet { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - _i30.DerivePathType addressType({required String? address}) => + _i26.DerivePathType addressType({required String? address}) => (super.noSuchMethod( Invocation.method( #addressType, [], {#address: address}, ), - returnValue: _i30.DerivePathType.bip44, - ) as _i30.DerivePathType); + returnValue: _i26.DerivePathType.bip44, + ) as _i26.DerivePathType); @override _i23.Future recoverFromMnemonic({ required String? mnemonic, @@ -1220,20 +1116,19 @@ class MockBitcoinWallet extends _i1.Mock implements _i29.BitcoinWallet { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - _i23.Future<_i10.ElectrumXNode> getCurrentNode() => (super.noSuchMethod( + _i23.Future<_i9.ElectrumXNode> getCurrentNode() => (super.noSuchMethod( Invocation.method( #getCurrentNode, [], ), - returnValue: - _i23.Future<_i10.ElectrumXNode>.value(_FakeElectrumXNode_11( + returnValue: _i23.Future<_i9.ElectrumXNode>.value(_FakeElectrumXNode_11( this, Invocation.method( #getCurrentNode, [], ), )), - ) as _i23.Future<_i10.ElectrumXNode>); + ) as _i23.Future<_i9.ElectrumXNode>); @override _i23.Future>> fastFetch( List? allTxHashes) => @@ -1298,6 +1193,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i29.BitcoinWallet { required String? recipientAddress, required bool? coinControl, required bool? isSendAll, + int? satsPerVByte, int? additionalOutputs = 0, List<_i17.UTXO>? utxos, }) => @@ -1310,12 +1206,13 @@ class MockBitcoinWallet extends _i1.Mock implements _i29.BitcoinWallet { #recipientAddress: recipientAddress, #coinControl: coinControl, #isSendAll: isSendAll, + #satsPerVByte: satsPerVByte, #additionalOutputs: additionalOutputs, #utxos: utxos, }, )); @override - _i23.Future> fetchBuildTxData( + _i23.Future> fetchBuildTxData( List<_i17.UTXO>? utxosToUse) => (super.noSuchMethod( Invocation.method( @@ -1323,11 +1220,11 @@ class MockBitcoinWallet extends _i1.Mock implements _i29.BitcoinWallet { [utxosToUse], ), returnValue: - _i23.Future>.value(<_i31.SigningData>[]), - ) as _i23.Future>); + _i23.Future>.value(<_i27.SigningData>[]), + ) as _i23.Future>); @override _i23.Future> buildTransaction({ - required List<_i31.SigningData>? utxoSigningData, + required List<_i27.SigningData>? utxoSigningData, required List? recipients, required List? satoshiAmounts, }) => @@ -1494,21 +1391,21 @@ class MockBitcoinWallet extends _i1.Mock implements _i29.BitcoinWallet { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - _i12.Balance getCachedBalance() => (super.noSuchMethod( + _i11.Balance getCachedBalance() => (super.noSuchMethod( Invocation.method( #getCachedBalance, [], ), - returnValue: _FakeBalance_9( + returnValue: _FakeBalance_8( this, Invocation.method( #getCachedBalance, [], ), ), - ) as _i12.Balance); + ) as _i11.Balance); @override - _i23.Future updateCachedBalance(_i12.Balance? balance) => + _i23.Future updateCachedBalance(_i11.Balance? balance) => (super.noSuchMethod( Invocation.method( #updateCachedBalance, @@ -1518,21 +1415,21 @@ class MockBitcoinWallet extends _i1.Mock implements _i29.BitcoinWallet { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - _i12.Balance getCachedBalanceSecondary() => (super.noSuchMethod( + _i11.Balance getCachedBalanceSecondary() => (super.noSuchMethod( Invocation.method( #getCachedBalanceSecondary, [], ), - returnValue: _FakeBalance_9( + returnValue: _FakeBalance_8( this, Invocation.method( #getCachedBalanceSecondary, [], ), ), - ) as _i12.Balance); + ) as _i11.Balance); @override - _i23.Future updateCachedBalanceSecondary(_i12.Balance? balance) => + _i23.Future updateCachedBalanceSecondary(_i11.Balance? balance) => (super.noSuchMethod( Invocation.method( #updateCachedBalanceSecondary, @@ -1542,26 +1439,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i29.BitcoinWallet { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - List getWalletTokenContractAddresses() => (super.noSuchMethod( - Invocation.method( - #getWalletTokenContractAddresses, - [], - ), - returnValue: [], - ) as List); - @override - _i23.Future updateWalletTokenContractAddresses( - List? contractAddresses) => - (super.noSuchMethod( - Invocation.method( - #updateWalletTokenContractAddresses, - [contractAddresses], - ), - returnValue: _i23.Future.value(), - returnValueForMissingStub: _i23.Future.value(), - ) as _i23.Future); - @override - void initWalletDB({_i7.MainDB? mockableOverride}) => super.noSuchMethod( + void initWalletDB({_i12.MainDB? mockableOverride}) => super.noSuchMethod( Invocation.method( #initWalletDB, [], @@ -1613,8 +1491,8 @@ class MockBitcoinWallet extends _i1.Mock implements _i29.BitcoinWallet { required String? walletName, required _i13.NetworkType? network, required _i22.Coin? coin, - required _i7.MainDB? db, - required _i10.ElectrumX? electrumXClient, + required _i12.MainDB? db, + required _i9.ElectrumX? electrumXClient, required _i19.SecureStorageInterface? secureStorage, required int? dustLimit, required int? dustLimitP2PKH, @@ -1635,7 +1513,7 @@ class MockBitcoinWallet extends _i1.Mock implements _i29.BitcoinWallet { })? prepareSend, required _i23.Future Function({required String address})? getTxCount, - required _i23.Future> Function(List<_i17.UTXO>)? + required _i23.Future> Function(List<_i17.UTXO>)? fetchBuildTxData, required _i23.Future Function()? refresh, required _i23.Future Function()? checkChangeAddressForTransactions, @@ -2025,9 +1903,9 @@ class MockBitcoinWallet extends _i1.Mock implements _i29.BitcoinWallet { required String? walletId, required String? walletName, required _i22.Coin? coin, - required _i7.MainDB? db, + required _i12.MainDB? db, required _i23.Future Function()? getChainHeight, - required _i23.Future Function(_i12.Balance)? refreshedBalanceCallback, + required _i23.Future Function(_i11.Balance)? refreshedBalanceCallback, }) => super.noSuchMethod( Invocation.method( @@ -2070,15 +1948,15 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { ), ) as _i19.SecureStorageInterface); @override - List<_i32.NodeModel> get primaryNodes => (super.noSuchMethod( + List<_i29.NodeModel> get primaryNodes => (super.noSuchMethod( Invocation.getter(#primaryNodes), - returnValue: <_i32.NodeModel>[], - ) as List<_i32.NodeModel>); + returnValue: <_i29.NodeModel>[], + ) as List<_i29.NodeModel>); @override - List<_i32.NodeModel> get nodes => (super.noSuchMethod( + List<_i29.NodeModel> get nodes => (super.noSuchMethod( Invocation.getter(#nodes), - returnValue: <_i32.NodeModel>[], - ) as List<_i32.NodeModel>); + returnValue: <_i29.NodeModel>[], + ) as List<_i29.NodeModel>); @override bool get hasListeners => (super.noSuchMethod( Invocation.getter(#hasListeners), @@ -2096,7 +1974,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { @override _i23.Future setPrimaryNodeFor({ required _i22.Coin? coin, - required _i32.NodeModel? node, + required _i29.NodeModel? node, bool? shouldNotifyListeners = false, }) => (super.noSuchMethod( @@ -2113,40 +1991,40 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - _i32.NodeModel? getPrimaryNodeFor({required _i22.Coin? coin}) => + _i29.NodeModel? getPrimaryNodeFor({required _i22.Coin? coin}) => (super.noSuchMethod(Invocation.method( #getPrimaryNodeFor, [], {#coin: coin}, - )) as _i32.NodeModel?); + )) as _i29.NodeModel?); @override - List<_i32.NodeModel> getNodesFor(_i22.Coin? coin) => (super.noSuchMethod( + List<_i29.NodeModel> getNodesFor(_i22.Coin? coin) => (super.noSuchMethod( Invocation.method( #getNodesFor, [coin], ), - returnValue: <_i32.NodeModel>[], - ) as List<_i32.NodeModel>); + returnValue: <_i29.NodeModel>[], + ) as List<_i29.NodeModel>); @override - _i32.NodeModel? getNodeById({required String? id}) => + _i29.NodeModel? getNodeById({required String? id}) => (super.noSuchMethod(Invocation.method( #getNodeById, [], {#id: id}, - )) as _i32.NodeModel?); + )) as _i29.NodeModel?); @override - List<_i32.NodeModel> failoverNodesFor({required _i22.Coin? coin}) => + List<_i29.NodeModel> failoverNodesFor({required _i22.Coin? coin}) => (super.noSuchMethod( Invocation.method( #failoverNodesFor, [], {#coin: coin}, ), - returnValue: <_i32.NodeModel>[], - ) as List<_i32.NodeModel>); + returnValue: <_i29.NodeModel>[], + ) as List<_i29.NodeModel>); @override _i23.Future add( - _i32.NodeModel? node, + _i29.NodeModel? node, String? password, bool? shouldNotifyListeners, ) => @@ -2198,7 +2076,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { ) as _i23.Future); @override _i23.Future edit( - _i32.NodeModel? editedNode, + _i29.NodeModel? editedNode, String? password, bool? shouldNotifyListeners, ) => @@ -2224,7 +2102,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -2232,7 +2110,7 @@ class MockNodeService extends _i1.Mock implements _i3.NodeService { returnValueForMissingStub: null, ); @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -2324,13 +2202,13 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: null, ); @override - _i23.Future<_i9.FeeObject> get fees => (super.noSuchMethod( + _i23.Future<_i8.FeeObject> get fees => (super.noSuchMethod( Invocation.getter(#fees), - returnValue: _i23.Future<_i9.FeeObject>.value(_FakeFeeObject_6( + returnValue: _i23.Future<_i8.FeeObject>.value(_FakeFeeObject_5( this, Invocation.getter(#fees), )), - ) as _i23.Future<_i9.FeeObject>); + ) as _i23.Future<_i8.FeeObject>); @override _i23.Future get maxFee => (super.noSuchMethod( Invocation.getter(#maxFee), @@ -2342,13 +2220,13 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValue: _i23.Future.value(''), ) as _i23.Future); @override - _i12.Balance get balance => (super.noSuchMethod( + _i11.Balance get balance => (super.noSuchMethod( Invocation.getter(#balance), - returnValue: _FakeBalance_9( + returnValue: _FakeBalance_8( this, Invocation.getter(#balance), ), - ) as _i12.Balance); + ) as _i11.Balance); @override _i23.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), @@ -2617,7 +2495,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: _i23.Future.value(), ) as _i23.Future); @override - void addListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void addListener(dynamic listener) => super.noSuchMethod( Invocation.method( #addListener, [listener], @@ -2625,7 +2503,7 @@ class MockManager extends _i1.Mock implements _i6.Manager { returnValueForMissingStub: null, ); @override - void removeListener(_i25.VoidCallback? listener) => super.noSuchMethod( + void removeListener(dynamic listener) => super.noSuchMethod( Invocation.method( #removeListener, [listener], @@ -2692,13 +2570,13 @@ class MockCoinServiceAPI extends _i1.Mock implements _i20.CoinServiceAPI { returnValueForMissingStub: null, ); @override - _i23.Future<_i9.FeeObject> get fees => (super.noSuchMethod( + _i23.Future<_i8.FeeObject> get fees => (super.noSuchMethod( Invocation.getter(#fees), - returnValue: _i23.Future<_i9.FeeObject>.value(_FakeFeeObject_6( + returnValue: _i23.Future<_i8.FeeObject>.value(_FakeFeeObject_5( this, Invocation.getter(#fees), )), - ) as _i23.Future<_i9.FeeObject>); + ) as _i23.Future<_i8.FeeObject>); @override _i23.Future get maxFee => (super.noSuchMethod( Invocation.getter(#maxFee), @@ -2710,13 +2588,13 @@ class MockCoinServiceAPI extends _i1.Mock implements _i20.CoinServiceAPI { returnValue: _i23.Future.value(''), ) as _i23.Future); @override - _i12.Balance get balance => (super.noSuchMethod( + _i11.Balance get balance => (super.noSuchMethod( Invocation.getter(#balance), - returnValue: _FakeBalance_9( + returnValue: _FakeBalance_8( this, Invocation.getter(#balance), ), - ) as _i12.Balance); + ) as _i11.Balance); @override _i23.Future> get transactions => (super.noSuchMethod( Invocation.getter(#transactions), diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 7c293146f..d81eabadc 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -6,7 +6,7 @@ #include "generated_plugin_registrant.h" -#include +#include #include #include #include diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index 200adfcda..80b508c45 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -3,7 +3,7 @@ # list(APPEND FLUTTER_PLUGIN_LIST - connectivity_plus_windows + connectivity_plus desktop_drop flutter_secure_storage_windows isar_flutter_libs