diff --git a/cw_shared_external/pubspec.lock b/cw_shared_external/pubspec.lock index 440f635ed..ef01c9f9a 100644 --- a/cw_shared_external/pubspec.lock +++ b/cw_shared_external/pubspec.lock @@ -5,50 +5,51 @@ packages: dependency: transitive description: name: async - sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "2.11.0" + version: "2.5.0" boolean_selector: dependency: transitive description: name: boolean_selector - sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "2.1.0" characters: dependency: transitive description: name: characters - sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "1.3.0" + version: "1.1.0" + charcode: + dependency: transitive + description: + name: charcode + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" clock: dependency: transitive description: name: clock - sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "1.1.1" + version: "1.1.0" collection: dependency: transitive description: name: collection - sha256: "4a07be6cb69c84d677a6c3096fcf960cc3285a8330b4603e0d463d15d9bd934c" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "1.17.1" + version: "1.15.0" fake_async: dependency: transitive description: name: fake_async - sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "1.3.1" + version: "1.2.0" flutter: dependency: "direct main" description: flutter @@ -59,46 +60,27 @@ packages: description: flutter source: sdk version: "0.0.0" - js: - dependency: transitive - description: - name: js - sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 - url: "https://pub.dev" - source: hosted - version: "0.6.7" matcher: dependency: transitive description: name: matcher - sha256: "6501fbd55da300384b768785b83e5ce66991266cec21af89ab9ae7f5ce1c4cbb" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "0.12.15" - material_color_utilities: - dependency: transitive - description: - name: material_color_utilities - sha256: d92141dc6fe1dad30722f9aa826c7fbc896d021d792f80678280601aff8cf724 - url: "https://pub.dev" - source: hosted - version: "0.2.0" + version: "0.12.10" meta: dependency: transitive description: name: meta - sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "1.9.1" + version: "1.3.0" path: dependency: transitive description: name: path - sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "1.8.3" + version: "1.8.0" sky_engine: dependency: transitive description: flutter @@ -108,58 +90,58 @@ packages: dependency: transitive description: name: source_span - sha256: dd904f795d4b4f3b870833847c461801f6750a9fa8e61ea5ac53f9422b31f250 - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "1.9.1" + version: "1.8.0" stack_trace: dependency: transitive description: name: stack_trace - sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "1.11.0" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel - sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner - sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "1.2.0" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph - sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "1.2.1" + version: "1.2.0" test_api: dependency: transitive description: name: test_api - sha256: eb6ac1540b26de412b3403a163d919ba86f6a973fe6cc50ae3541b80092fdcfb - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "0.5.1" + version: "0.2.19" + typed_data: + dependency: transitive + description: + name: typed_data + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math - sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" - url: "https://pub.dev" + url: "https://pub.dartlang.org" source: hosted - version: "2.1.4" + version: "2.1.0" sdks: - dart: ">=3.0.0-0 <4.0.0" + dart: ">=2.12.0-0.0 <3.0.0" flutter: ">=1.20.0" diff --git a/lib/core/validator.dart b/lib/core/validator.dart index 6ede96e57..34e985991 100644 --- a/lib/core/validator.dart +++ b/lib/core/validator.dart @@ -48,7 +48,7 @@ class TextValidator extends Validator { final valueMatched = match(value); final valueValidated = useAdditionalValidation != null - ? useAdditionalValidation!(value) && valueMatched + ? useAdditionalValidation!(value) || valueMatched : valueMatched; return valueValidated; diff --git a/lib/haven/cw_haven.dart b/lib/haven/cw_haven.dart index 6d473051e..57c4e49c3 100644 --- a/lib/haven/cw_haven.dart +++ b/lib/haven/cw_haven.dart @@ -8,7 +8,6 @@ class CWHavenAccountList extends HavenAccountList { @override @computed ObservableList get accounts { - debugPrint("CWHavenAccountList get accounts"); final havenWallet = _wallet as HavenWallet; final accounts = havenWallet.walletAddresses.accountList.accounts .map((acc) => Account(id: acc.id, label: acc.label)) @@ -18,21 +17,18 @@ class CWHavenAccountList extends HavenAccountList { @override void update(Object wallet) { - debugPrint("CWHavenAccountList update $wallet"); final havenWallet = wallet as HavenWallet; havenWallet.walletAddresses.accountList.update(); } @override void refresh(Object wallet) { - debugPrint("CWHavenAccountList refresh $wallet"); final havenWallet = wallet as HavenWallet; havenWallet.walletAddresses.accountList.refresh(); } @override List getAll(Object wallet) { - debugPrint("CWHavenAccountList getAll $wallet"); final havenWallet = wallet as HavenWallet; return havenWallet.walletAddresses.accountList .getAll() @@ -42,7 +38,6 @@ class CWHavenAccountList extends HavenAccountList { @override Future addAccount(Object wallet, {required String label}) async { - debugPrint("CWHavenAccountList addAccount $wallet $label"); final havenWallet = wallet as HavenWallet; await havenWallet.walletAddresses.accountList.addAccount(label: label); } @@ -50,7 +45,6 @@ class CWHavenAccountList extends HavenAccountList { @override Future setLabelAccount(Object wallet, {required int accountIndex, required String label}) async { - debugPrint("CWHavenAccountList setLabelAccount $wallet $accountIndex $label"); final havenWallet = wallet as HavenWallet; await havenWallet.walletAddresses.accountList .setLabelAccount(accountIndex: accountIndex, label: label); @@ -65,7 +59,6 @@ class CWHavenSubaddressList extends MoneroSubaddressList { @override @computed ObservableList get subaddresses { - debugPrint("CWHavenSubaddressList get subaddresses"); final havenWallet = _wallet as HavenWallet; final subAddresses = havenWallet.walletAddresses.subaddressList.subaddresses .map((sub) => Subaddress(id: sub.id, address: sub.address, label: sub.label)) @@ -75,21 +68,18 @@ class CWHavenSubaddressList extends MoneroSubaddressList { @override void update(Object wallet, {required int accountIndex}) { - debugPrint("CWHavenSubaddressList update $wallet $accountIndex"); final havenWallet = wallet as HavenWallet; havenWallet.walletAddresses.subaddressList.update(accountIndex: accountIndex); } @override void refresh(Object wallet, {required int accountIndex}) { - debugPrint("CWHavenSubaddressList refresh $wallet $accountIndex"); final havenWallet = wallet as HavenWallet; havenWallet.walletAddresses.subaddressList.refresh(accountIndex: accountIndex); } @override List getAll(Object wallet) { - debugPrint("CWHavenSubaddressList getAll $wallet"); final havenWallet = wallet as HavenWallet; return havenWallet.walletAddresses.subaddressList .getAll() @@ -100,7 +90,6 @@ class CWHavenSubaddressList extends MoneroSubaddressList { @override Future addSubaddress(Object wallet, {required int accountIndex, required String label}) async { - debugPrint("CWHavenSubaddressList addSubaddress $wallet $accountIndex $label"); final havenWallet = wallet as HavenWallet; await havenWallet.walletAddresses.subaddressList .addSubaddress(accountIndex: accountIndex, label: label); @@ -109,7 +98,6 @@ class CWHavenSubaddressList extends MoneroSubaddressList { @override Future setLabelSubaddress(Object wallet, {required int accountIndex, required int addressIndex, required String label}) async { - debugPrint("CWHavenSubaddressList setLabelSubaddress $wallet $accountIndex $addressIndex $label"); final havenWallet = wallet as HavenWallet; await havenWallet.walletAddresses.subaddressList .setLabelSubaddress(accountIndex: accountIndex, addressIndex: addressIndex, label: label); @@ -124,7 +112,6 @@ class CWHavenWalletDetails extends HavenWalletDetails { @computed @override Account get account { - debugPrint("CWHavenWalletDetails get account"); final havenWallet = _wallet as HavenWallet; final acc = havenWallet.walletAddresses.account as monero_account.Account; return Account(id: acc.id, label: acc.label); @@ -133,7 +120,6 @@ class CWHavenWalletDetails extends HavenWalletDetails { @computed @override HavenBalance get balance { - debugPrint("CWHavenWalletDetails get balance"); final havenWallet = _wallet as HavenWallet; final balance = havenWallet.balance; throw Exception('Unimplemented'); @@ -146,62 +132,48 @@ class CWHavenWalletDetails extends HavenWalletDetails { class CWHaven extends Haven { @override HavenAccountList getAccountList(Object wallet) { - debugPrint("CWHaven getAccountList $wallet"); return CWHavenAccountList(wallet); } @override MoneroSubaddressList getSubaddressList(Object wallet) { - debugPrint("CWHaven getSubaddressList $wallet"); return CWHavenSubaddressList(wallet); } @override TransactionHistoryBase getTransactionHistory(Object wallet) { - debugPrint("CWHaven getTransactionHistory $wallet"); final havenWallet = wallet as HavenWallet; return havenWallet.transactionHistory; } @override HavenWalletDetails getMoneroWalletDetails(Object wallet) { - debugPrint("CWHaven getMoneroWalletDetails $wallet"); return CWHavenWalletDetails(wallet); } @override - int getHeightByDate({required DateTime date}) { - debugPrint("CWHaven getHeightByDate $date"); - return getHavenHeightByDate(date: date); - } + int getHeightByDate({required DateTime date}) => getHavenHeightByDate(date: date); @override - Future getCurrentHeight() { - debugPrint("CWHaven getCurrentHeight"); - return getHavenCurrentHeight(); - } + Future getCurrentHeight() => getHavenCurrentHeight(); @override TransactionPriority getDefaultTransactionPriority() { - debugPrint("CWHaven getDefaultTransactionPriority"); return MoneroTransactionPriority.automatic; } @override TransactionPriority deserializeMoneroTransactionPriority({required int raw}) { - debugPrint("CWHaven deserializeMoneroTransactionPriority $raw"); return MoneroTransactionPriority.deserialize(raw: raw); } @override List getTransactionPriorities() { - debugPrint("CWHaven getTransactionPriorities"); return MoneroTransactionPriority.all; } @override List getMoneroWordList(String language) { - debugPrint("CWHaven getMoneroWordList $language"); switch (language.toLowerCase()) { case 'english': return EnglishMnemonics.words; @@ -237,7 +209,6 @@ class CWHaven extends Haven { required String password, required String language, required int height}) { - debugPrint("CWHaven createHavenRestoreWalletFromKeysCredentials $name $spendKey $viewKey $address $password $language $height"); return HavenRestoreWalletFromKeysCredentials( name: name, spendKey: spendKey, @@ -254,7 +225,6 @@ class CWHaven extends Haven { required String password, required int height, required String mnemonic}) { - debugPrint("CWHaven createHavenRestoreWalletFromSeedCredentials $name $password $height $mnemonic"); return HavenRestoreWalletFromSeedCredentials( name: name, password: password, height: height, mnemonic: mnemonic); } @@ -262,13 +232,11 @@ class CWHaven extends Haven { @override WalletCredentials createHavenNewWalletCredentials( {required String name, required String language, String? password}) { - debugPrint("CWHaven createHavenNewWalletCredentials $name $language $password"); return HavenNewWalletCredentials(name: name, password: password, language: language); } @override Map getKeys(Object wallet) { - debugPrint("CWHaven getKeys $wallet"); final havenWallet = wallet as HavenWallet; final keys = havenWallet.keys; return { @@ -284,7 +252,6 @@ class CWHaven extends Haven { {required List outputs, required TransactionPriority priority, required String assetType}) { - debugPrint("CWHaven createHavenTransactionCreationCredentials $outputs $priority $assetType"); return HavenTransactionCreationCredentials( outputs: outputs .map((out) => OutputInfo( @@ -303,25 +270,21 @@ class CWHaven extends Haven { @override String formatterMoneroAmountToString({required int amount}) { - debugPrint("CWHaven formatterMoneroAmountToString $amount"); return moneroAmountToString(amount: amount); } @override double formatterMoneroAmountToDouble({required int amount}) { - debugPrint("CWHaven formatterMoneroAmountToDouble $amount"); return moneroAmountToDouble(amount: amount); } @override int formatterMoneroParseAmount({required String amount}) { - debugPrint("CWHaven formatterMoneroParseAmount $amount"); return moneroParseAmount(amount: amount); } @override Account getCurrentAccount(Object wallet) { - debugPrint("CWHaven getCurrentAccount $wallet"); final havenWallet = wallet as HavenWallet; final acc = havenWallet.walletAddresses.account as monero_account.Account; return Account(id: acc.id, label: acc.label); @@ -329,49 +292,40 @@ class CWHaven extends Haven { @override void setCurrentAccount(Object wallet, int id, String label) { - debugPrint("CWHaven setCurrentAccount $wallet $id $label"); final havenWallet = wallet as HavenWallet; havenWallet.walletAddresses.account = monero_account.Account(id: id, label: label); } @override void onStartup() { - debugPrint("CWHaven onStartup"); monero_wallet_api.onStartup(); } @override int getTransactionInfoAccountId(TransactionInfo tx) { - debugPrint("CWHaven getTransactionInfoAccountId $tx"); final havenTransactionInfo = tx as HavenTransactionInfo; return havenTransactionInfo.accountIndex; } @override WalletService createHavenWalletService(Box walletInfoSource) { - debugPrint("CWHaven createHavenWalletService $walletInfoSource"); return HavenWalletService(walletInfoSource); } @override String getTransactionAddress(Object wallet, int accountIndex, int addressIndex) { - debugPrint("CWHaven getTransactionAddress $wallet $accountIndex $addressIndex"); final havenWallet = wallet as HavenWallet; return havenWallet.getTransactionAddress(accountIndex, addressIndex); } @override CryptoCurrency assetOfTransaction(TransactionInfo tx) { - debugPrint("CWHaven assetOfTransaction $tx"); final transaction = tx as HavenTransactionInfo; final asset = CryptoCurrency.fromString(transaction.assetType); return asset; } @override - List getAssetRate() { - final result = getRate().map((rate) => AssetRate(rate.getAssetType(), rate.getRate())).toList(); - debugPrint("CWHaven getAssetRate: ${result.map((e) => '{${e.asset}: ${e.rate}}').join(" ")}"); - return result; - } + List getAssetRate() => + getRate().map((rate) => AssetRate(rate.getAssetType(), rate.getRate())).toList(); } diff --git a/lib/src/screens/restore/wallet_restore_page.dart b/lib/src/screens/restore/wallet_restore_page.dart index 75ded88a5..bea84a7c9 100644 --- a/lib/src/screens/restore/wallet_restore_page.dart +++ b/lib/src/screens/restore/wallet_restore_page.dart @@ -211,8 +211,6 @@ class WalletRestorePage extends BasePage { final seedWords = walletRestoreFromSeedFormKey.currentState!.seedWidgetStateKey.currentState!.text.split(' '); - if (walletRestoreViewModel.type == WalletType.zano) return true; - if ((walletRestoreViewModel.type == WalletType.monero || walletRestoreViewModel.type == WalletType.haven) && seedWords.length != WalletRestoreViewModelBase.moneroSeedMnemonicLength) {