From 8d55f90cbcc448d2f85acd1ee6e6eb7733ee894e Mon Sep 17 00:00:00 2001 From: Willy <11148913+willyfromtheblock@users.noreply.github.com> Date: Tue, 27 Dec 2022 12:01:00 +0100 Subject: [PATCH] 1.1.2 (#209) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * version bump * 2dos * don't show wallet_scan_notice_bg_notifications on web * temporarily disable persisting labels for more than 100 addresses on web * Translated using Weblate (Norwegian Bokmål) Currently translated at 100.0% (341 of 341 strings) Translation: Peercoin Flutter/Translations Translate-URL: https://weblate.ppc.lol/projects/peercoin-flutter/translations/nb_NO/ * Translated using Weblate (Swedish) Currently translated at 100.0% (341 of 341 strings) Translation: Peercoin Flutter/Translations Translate-URL: https://weblate.ppc.lol/projects/peercoin-flutter/translations/sv/ * Translated using Weblate (Danish) Currently translated at 100.0% (341 of 341 strings) Translation: Peercoin Flutter/Translations Translate-URL: https://weblate.ppc.lol/projects/peercoin-flutter/translations/da/ * upgrade coinslib * compatability with coinslib 3.1.5 * require_trailing_commas * Translated using Weblate (German) Currently translated at 100.0% (343 of 343 strings) Translation: Peercoin Flutter/Translations Translate-URL: https://weblate.ppc.lol/projects/peercoin-flutter/translations/de/ * Translated using Weblate (Norwegian Bokmål) Currently translated at 100.0% (343 of 343 strings) Translation: Peercoin Flutter/Translations Translate-URL: https://weblate.ppc.lol/projects/peercoin-flutter/translations/nb_NO/ * Translated using Weblate (Swedish) Currently translated at 100.0% (343 of 343 strings) Translation: Peercoin Flutter/Translations Translate-URL: https://weblate.ppc.lol/projects/peercoin-flutter/translations/sv/ * Translated using Weblate (Danish) Currently translated at 100.0% (343 of 343 strings) Translation: Peercoin Flutter/Translations Translate-URL: https://weblate.ppc.lol/projects/peercoin-flutter/translations/da/ * indentation * remove null checks for new coinslib version * bump coinslib * adapt to new coinslib version * center appbar titles * verify messages widget and tests * adaptions for web Co-authored-by: Marius Kjærstad --- CHANGELOG.md | 3 + analysis_options.yaml | 6 +- android/build.gradle | 2 +- assets/translations/da.json | 7 +- assets/translations/de.json | 4 +- assets/translations/en.json | 11 + assets/translations/nb_NO.json | 7 +- assets/translations/sv.json | 7 +- ios/Podfile.lock | 6 + lib/generated/marisma.pb.dart | 1030 +++++++++++------ lib/generated/marisma.pbenum.dart | 1 - lib/generated/marisma.pbjson.dart | 178 +-- lib/main.dart | 26 +- lib/models/coin_wallet.dart | 3 +- lib/providers/active_wallets.dart | 58 +- lib/providers/electrum_connection.dart | 9 +- lib/providers/encrypted_box.dart | 4 +- lib/providers/servers.dart | 13 +- lib/screens/about.dart | 20 +- lib/screens/changelog.dart | 1 + lib/screens/qrcode_scanner.dart | 1 + lib/screens/secure_storage_error_screen.dart | 1 + lib/screens/server_settings/server_add.dart | 110 +- .../server_settings/server_settings.dart | 61 +- .../settings/app_settings_notifications.dart | 14 +- lib/screens/settings/app_settings_screen.dart | 167 +-- lib/screens/setup/setup.dart | 9 +- lib/screens/setup/setup_auth.dart | 23 +- lib/screens/setup/setup_create_wallet.dart | 42 +- lib/screens/setup/setup_data_feeds.dart | 4 +- lib/screens/setup/setup_import_seed.dart | 30 +- lib/screens/setup/setup_language.dart | 8 +- lib/screens/setup/setup_legal.dart | 8 +- lib/screens/wallet/address_selector.dart | 1 + lib/screens/wallet/import_paper_wallet.dart | 40 +- lib/screens/wallet/import_wif.dart | 20 +- .../wallet/transaction_confirmation.dart | 12 +- lib/screens/wallet/transaction_details.dart | 8 +- lib/screens/wallet/wallet_home.dart | 81 +- lib/screens/wallet/wallet_import_scan.dart | 12 +- ..._signing.dart => wallet_sign_message.dart} | 60 +- lib/screens/wallet/wallet_verify_message.dart | 317 +++++ lib/tools/app_localizations.dart | 3 +- lib/tools/app_routes.dart | 15 +- lib/tools/app_themes.dart | 30 +- lib/tools/auth.dart | 51 +- lib/tools/background_sync.dart | 24 +- lib/tools/price_ticker.dart | 5 +- lib/tools/session_checker.dart | 4 +- lib/widgets/buttons.dart | 7 +- lib/widgets/double_tab_to_clipboard.dart | 14 +- lib/widgets/expanded_section.dart | 4 +- lib/widgets/logout_dialog_dummy.dart | 4 +- lib/widgets/settings/settings_auth.dart | 126 +- .../settings/settings_price_ticker.dart | 7 +- lib/widgets/wallet/addresses_tab.dart | 109 +- lib/widgets/wallet/new_wallet.dart | 53 +- lib/widgets/wallet/receive_tab.dart | 18 +- lib/widgets/wallet/send_tab.dart | 19 +- lib/widgets/wallet/send_tab_navigator.dart | 26 +- lib/widgets/wallet/transactions_list.dart | 55 +- lib/widgets/wallet/wallet_home_qr.dart | 7 +- pubspec.lock | 2 +- pubspec.yaml | 4 +- test/transaction_building_test.dart | 6 +- test_driver/key_imported.dart | 61 +- test_driver/key_new.dart | 21 +- windows/.gitignore | 17 - windows/CMakeLists.txt | 95 -- windows/flutter/CMakeLists.txt | 103 -- .../flutter/generated_plugin_registrant.cc | 26 - windows/flutter/generated_plugin_registrant.h | 15 - windows/flutter/generated_plugins.cmake | 28 - windows/runner/CMakeLists.txt | 17 - windows/runner/Runner.rc | 121 -- windows/runner/flutter_window.cpp | 61 - windows/runner/flutter_window.h | 33 - windows/runner/main.cpp | 43 - windows/runner/resource.h | 16 - windows/runner/resources/app_icon.ico | Bin 33772 -> 0 bytes windows/runner/runner.exe.manifest | 20 - windows/runner/utils.cpp | 64 - windows/runner/utils.h | 19 - windows/runner/win32_window.cpp | 245 ---- windows/runner/win32_window.h | 98 -- 85 files changed, 2107 insertions(+), 2014 deletions(-) rename lib/screens/wallet/{wallet_signing.dart => wallet_sign_message.dart} (87%) create mode 100644 lib/screens/wallet/wallet_verify_message.dart delete mode 100644 windows/.gitignore delete mode 100644 windows/CMakeLists.txt delete mode 100644 windows/flutter/CMakeLists.txt delete mode 100644 windows/flutter/generated_plugin_registrant.cc delete mode 100644 windows/flutter/generated_plugin_registrant.h delete mode 100644 windows/flutter/generated_plugins.cmake delete mode 100644 windows/runner/CMakeLists.txt delete mode 100644 windows/runner/Runner.rc delete mode 100644 windows/runner/flutter_window.cpp delete mode 100644 windows/runner/flutter_window.h delete mode 100644 windows/runner/main.cpp delete mode 100644 windows/runner/resource.h delete mode 100644 windows/runner/resources/app_icon.ico delete mode 100644 windows/runner/runner.exe.manifest delete mode 100644 windows/runner/utils.cpp delete mode 100644 windows/runner/utils.h delete mode 100644 windows/runner/win32_window.cpp delete mode 100644 windows/runner/win32_window.h diff --git a/CHANGELOG.md b/CHANGELOG.md index 6379f93c..ea64e37a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +### **1.1.2** (2022-12-27) +* Allow verification of signed messages + ### **1.1.1** (2022-12-06) * Address book: allow hiding of sending addresses * Send tab: allow fast forwarding or rewiding to addresses diff --git a/analysis_options.yaml b/analysis_options.yaml index e9db1d46..930daf47 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,4 +1,8 @@ include: package:flutter_lints/flutter.yaml analyzer: exclude: - - lib/generated/** \ No newline at end of file + - lib/generated/** + +linter: + rules: + - require_trailing_commas \ No newline at end of file diff --git a/android/build.gradle b/android/build.gradle index f88c22c1..0a26e897 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -4,7 +4,7 @@ buildscript { compileSdkVersion = 33 targetSdkVersion = 33 appCompatVersion = "1.1.0" - } + } repositories { google() diff --git a/assets/translations/da.json b/assets/translations/da.json index b7031a1e..b538ab53 100644 --- a/assets/translations/da.json +++ b/assets/translations/da.json @@ -336,5 +336,10 @@ "send_address_already_exists": "Adressen findes allerede", "tx_recipients": "Modtagere", "app_settings_delete": "Slet konto", - "send_navigator": "Adresse $index af $maximum" + "send_navigator": "Adresse $index af $maximum", + "tx_retry_broadcast": "Prøv at udsende igen", + "tx_show_hex": "Vis transaktionshex", + "tx_retry_snack": "Udsendelsen er blevet forsøgt igen. Hvis det lykkedes, opdateres transaktionen om lidt.", + "wallet_scan_notice_bg_notifications": "Aktivering af baggrundsmeddelelser i appindstillinger kan forbedre scanningens pålidelighed betydeligt.", + "send_errors_cant_pay_fees": "Kan ikke betale for gebyrer. $feesMissing $letter_code mangler i øjeblikket. Overvej at fjerne adresser eller reducere transaktionsbeløbet." } diff --git a/assets/translations/de.json b/assets/translations/de.json index f64b9495..d09cbd33 100644 --- a/assets/translations/de.json +++ b/assets/translations/de.json @@ -339,5 +339,7 @@ "send_add_address": "Adresse hinzufügen", "send_navigator": "Adresse $index von $maximum", "send_address_already_exists": "Adresse existiert bereits", - "tx_recipients": "Empfänger" + "tx_recipients": "Empfänger", + "send_errors_cant_pay_fees": "Kann nicht für Gebühren bezahlen. $feesMissing $letter_code fehlen derzeit. Bedenke Adressen zu entfernen oder den Betrag zu verringern.", + "wallet_scan_notice_bg_notifications": "Aktivierung der Hintergrundbenachrichtungen in den App Einstellungen kann die Zuverlässigkeit signifikant erhöhen." } diff --git a/assets/translations/en.json b/assets/translations/en.json index a57c9294..4048cf08 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -210,6 +210,8 @@ "send_fees_deducted": "Information: Mandatory transaction fees have been deducted from the last recipient. The amount transferred to this address is now lower.", "send_empty": "Empty wallet", "send_enter_address": "Please enter an address", + "verify_enter_message": "Please enter a message", + "verify_enter_signature": "Please enter a signature", "send_enter_amount": "Please enter an amount", "send_errors_solve": "Please resolve errors …", "send_errors_cant_pay_fees": "Can not pay for fees. $feesMissing $letter_code are presently missing. Consider removing addresses or reducing their transaction amount.", @@ -297,6 +299,7 @@ "wallet_pop_menu_signing": "Sign Messages", "wallet_pop_menu_rescan": "Rescan", "wallet_pop_menu_servers": "Adjust Servers", + "wallet_pop_menu_verification": "Verify Messages", "wallet_receive": "Receive", "wallet_receive_label_hint": "Pressing the Share button will save the address label.", "wallet_receive_label_hint_privacy": "Reusing your address is discouraged for privacy reasons. If you want to reuse this address, you have to set it to \"watched\" in the address book after having used it.", @@ -318,6 +321,8 @@ "store_description": "Send and receive Peercoin, the pioneer of Proof-of-Stake, on your phone.\n\nKeep your wallet seed protected. \nThis app comes with absolutely no warranty. \nUse at own risk.\n\nFeatures:\n- Based on electrum protocol.\n- Send and receive peercoin.\n- Ready to transact after installation (no waiting).\n- Peercoin and Peercoin testnet wallets.\n- Address book management.\n- Import paper wallets.\n- Import & export private keys (WIF).\n- Server management.\n- Multi-language support.\n- Background notifications.\n\nKnown limitations can be found in the Github repository.", "store_short": "Your mobile wallet for Peercoin and Peercoin testnet.", "sign_step_1": "Select Address", + "verify_step_1": "Enter Address", + "verify_step_3": "Enter Signature", "sign_step_1_description": "Select the address which should sign the message", "sign_step_1_button": "Select", "sign_step_1_button_alt": "Change", @@ -325,9 +330,15 @@ "sign_step_3": "Sign message", "sign_step_3_description": "This is your signature. You may double tap to copy it to the clipboard.", "sign_step_3_button": "Sign", + "verify_step_3_button": "Verify", "sign_step_3_button_alt": "Copy signature to clipboard", "sign_snack_text": "$address selected", "sign_input_label": "Message to sign", + "verify_input_label_message": "Message to verify", + "verify_input_label_address": "Address to verify", + "verify_input_label_signature": "Signature to verify", + "verify_success": "Message verified.", + "verify_fail": "Message could not be verified.", "sign_reset_button": "Reset", "sign_reset_alert_title": "Do you want to start over?", "sign_reset_alert_body": "This will reset all fields and clear your signature.", diff --git a/assets/translations/nb_NO.json b/assets/translations/nb_NO.json index 767b57ed..b873daeb 100644 --- a/assets/translations/nb_NO.json +++ b/assets/translations/nb_NO.json @@ -336,5 +336,10 @@ "send_address_already_exists": "Adressen finnes allerede", "tx_recipients": "Mottakere", "app_settings_delete": "Slett konto", - "app_settings_delete_description": "Siden du ikke har opprettet en konto i denne appen, er det ingenting å slette. Du skapte en gjenopprettingsfrase, som er en kryptografisk operasjon. Gjenopprettingsfrasen din er matematikk. Den kan brukes i alle programmer som støtter gjenopprettingsfraser. Du har heller ingen kontoer med bakgrunnsvarsling eller API for prisfeed. Denne appen verdsetter personvernet ditt og er privat av design." + "app_settings_delete_description": "Siden du ikke har opprettet en konto i denne appen, er det ingenting å slette. Du skapte en gjenopprettingsfrase, som er en kryptografisk operasjon. Gjenopprettingsfrasen din er matematikk. Den kan brukes i alle programmer som støtter gjenopprettingsfraser. Du har heller ingen kontoer med bakgrunnsvarsling eller API for prisfeed. Denne appen verdsetter personvernet ditt og er privat av design.", + "tx_show_hex": "Vis transaksjonshex", + "tx_retry_broadcast": "Prøv å kringkaste på nytt", + "tx_retry_snack": "Kringkastingen er forsøkt på nytt. Hvis den var vellykket, vil transaksjonen oppdateres om litt.", + "send_errors_cant_pay_fees": "Kan ikke betale for gebyrer. $feesMissing $letter_code mangler for øyeblikket. Vurder å fjerne adresser eller redusere transaksjonsbeløpet.", + "wallet_scan_notice_bg_notifications": "Aktivering av bakgrunnsvarsler i appinnstillinger kan forbedre skanningens pålitelighet betydelig." } diff --git a/assets/translations/sv.json b/assets/translations/sv.json index 0c9cb91e..f87bf367 100644 --- a/assets/translations/sv.json +++ b/assets/translations/sv.json @@ -336,5 +336,10 @@ "send_navigator": "Adress $index av $maximum", "send_address_already_exists": "Adressen finns redan", "tx_recipients": "Mottagare", - "app_settings_delete": "Radera konto" + "app_settings_delete": "Radera konto", + "tx_retry_broadcast": "Försök att sända igen", + "tx_show_hex": "Visa transaktionshex", + "tx_retry_snack": "Sändningen har försökts igen. Om det lyckades kommer transaktionen att uppdateras om en stund.", + "send_errors_cant_pay_fees": "Kan inte betala avgifter. $feesMissing $letter_code saknas för närvarande. Överväg att ta bort adresser eller minska transaktionsbeloppet.", + "wallet_scan_notice_bg_notifications": "Aktivering av bakgrundsaviseringar i appinställningar kan förbättra skanningens tillförlitlighet avsevärt." } diff --git a/ios/Podfile.lock b/ios/Podfile.lock index a69b9697..3437861f 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -6,6 +6,8 @@ PODS: - connectivity_plus (0.0.1): - Flutter - ReachabilitySwift + - cryptography_flutter (0.1.0): + - Flutter - DKImagePickerController/Core (4.3.4): - DKImagePickerController/ImageDataManager - DKImagePickerController/Resource @@ -81,6 +83,7 @@ DEPENDENCIES: - background_fetch (from `.symlinks/plugins/background_fetch/ios`) - camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`) - connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`) + - cryptography_flutter (from `.symlinks/plugins/cryptography_flutter/ios`) - file_picker (from `.symlinks/plugins/file_picker/ios`) - Flutter (from `Flutter`) - flutter_keyboard_visibility (from `.symlinks/plugins/flutter_keyboard_visibility/ios`) @@ -114,6 +117,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/camera_avfoundation/ios" connectivity_plus: :path: ".symlinks/plugins/connectivity_plus/ios" + cryptography_flutter: + :path: ".symlinks/plugins/cryptography_flutter/ios" file_picker: :path: ".symlinks/plugins/file_picker/ios" Flutter: @@ -149,6 +154,7 @@ SPEC CHECKSUMS: background_fetch: aaf8fc9d1da7f04e5373aabd4bb239704a5be6eb camera_avfoundation: 07c77549ea54ad95d8581be86617c094a46280d9 connectivity_plus: 413a8857dd5d9f1c399a39130850d02fe0feaf7e + cryptography_flutter: a2c541ba25ff28549f989f856dde126c961defcd DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179 file_picker: 817ab1d8cd2da9d2da412a417162deee3500fc95 diff --git a/lib/generated/marisma.pb.dart b/lib/generated/marisma.pb.dart index d0594f74..a85640e1 100644 --- a/lib/generated/marisma.pb.dart +++ b/lib/generated/marisma.pb.dart @@ -11,39 +11,64 @@ import 'package:fixnum/fixnum.dart' as $fixnum; import 'package:protobuf/protobuf.dart' as $pb; class BlockHeightRequest extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'BlockHeightRequest', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'marisma'), createEmptyInstance: create) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + const $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'BlockHeightRequest', + package: const $pb.PackageName( + $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'marisma'), + createEmptyInstance: create) + ..hasRequiredFields = false; BlockHeightRequest._() : super(); factory BlockHeightRequest() => create(); - factory BlockHeightRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory BlockHeightRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') + factory BlockHeightRequest.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory BlockHeightRequest.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') BlockHeightRequest clone() => BlockHeightRequest()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - BlockHeightRequest copyWith(void Function(BlockHeightRequest) updates) => super.copyWith((message) => updates(message as BlockHeightRequest)) as BlockHeightRequest; // ignore: deprecated_member_use + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + BlockHeightRequest copyWith(void Function(BlockHeightRequest) updates) => + super.copyWith((message) => updates(message as BlockHeightRequest)) + as BlockHeightRequest; // ignore: deprecated_member_use $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static BlockHeightRequest create() => BlockHeightRequest._(); BlockHeightRequest createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static BlockHeightRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static BlockHeightRequest getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static BlockHeightRequest? _defaultInstance; } class BlockHeightReply extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'BlockHeightReply', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'marisma'), createEmptyInstance: create) - ..a<$core.int>(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'height', $pb.PbFieldType.OU3) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + const $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'BlockHeightReply', + package: const $pb.PackageName( + $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'marisma'), + createEmptyInstance: create) + ..a<$core.int>( + 1, + const $core.bool.fromEnvironment('protobuf.omit_field_names') + ? '' + : 'height', + $pb.PbFieldType.OU3) + ..hasRequiredFields = false; BlockHeightReply._() : super(); factory BlockHeightReply({ @@ -55,31 +80,40 @@ class BlockHeightReply extends $pb.GeneratedMessage { } return _result; } - factory BlockHeightReply.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory BlockHeightReply.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') + factory BlockHeightReply.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory BlockHeightReply.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') BlockHeightReply clone() => BlockHeightReply()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - BlockHeightReply copyWith(void Function(BlockHeightReply) updates) => super.copyWith((message) => updates(message as BlockHeightReply)) as BlockHeightReply; // ignore: deprecated_member_use + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + BlockHeightReply copyWith(void Function(BlockHeightReply) updates) => + super.copyWith((message) => updates(message as BlockHeightReply)) + as BlockHeightReply; // ignore: deprecated_member_use $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static BlockHeightReply create() => BlockHeightReply._(); BlockHeightReply createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static BlockHeightReply getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static BlockHeightReply getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static BlockHeightReply? _defaultInstance; @$pb.TagNumber(1) $core.int get height => $_getIZ(0); @$pb.TagNumber(1) - set height($core.int v) { $_setUnsignedInt32(0, v); } + set height($core.int v) { + $_setUnsignedInt32(0, v); + } + @$pb.TagNumber(1) $core.bool hasHeight() => $_has(0); @$pb.TagNumber(1) @@ -87,10 +121,23 @@ class BlockHeightReply extends $pb.GeneratedMessage { } class EstimateFeeRequest extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'EstimateFeeRequest', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'marisma'), createEmptyInstance: create) - ..a<$core.int>(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'blockTarget', $pb.PbFieldType.OU3, protoName: 'blockTarget') - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + const $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'EstimateFeeRequest', + package: const $pb.PackageName( + $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'marisma'), + createEmptyInstance: create) + ..a<$core.int>( + 1, + const $core.bool.fromEnvironment('protobuf.omit_field_names') + ? '' + : 'blockTarget', + $pb.PbFieldType.OU3, + protoName: 'blockTarget') + ..hasRequiredFields = false; EstimateFeeRequest._() : super(); factory EstimateFeeRequest({ @@ -102,31 +149,40 @@ class EstimateFeeRequest extends $pb.GeneratedMessage { } return _result; } - factory EstimateFeeRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory EstimateFeeRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') + factory EstimateFeeRequest.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory EstimateFeeRequest.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') EstimateFeeRequest clone() => EstimateFeeRequest()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - EstimateFeeRequest copyWith(void Function(EstimateFeeRequest) updates) => super.copyWith((message) => updates(message as EstimateFeeRequest)) as EstimateFeeRequest; // ignore: deprecated_member_use + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + EstimateFeeRequest copyWith(void Function(EstimateFeeRequest) updates) => + super.copyWith((message) => updates(message as EstimateFeeRequest)) + as EstimateFeeRequest; // ignore: deprecated_member_use $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static EstimateFeeRequest create() => EstimateFeeRequest._(); EstimateFeeRequest createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static EstimateFeeRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static EstimateFeeRequest getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static EstimateFeeRequest? _defaultInstance; @$pb.TagNumber(1) $core.int get blockTarget => $_getIZ(0); @$pb.TagNumber(1) - set blockTarget($core.int v) { $_setUnsignedInt32(0, v); } + set blockTarget($core.int v) { + $_setUnsignedInt32(0, v); + } + @$pb.TagNumber(1) $core.bool hasBlockTarget() => $_has(0); @$pb.TagNumber(1) @@ -134,10 +190,24 @@ class EstimateFeeRequest extends $pb.GeneratedMessage { } class EstimateFeeReply extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'EstimateFeeReply', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'marisma'), createEmptyInstance: create) - ..a<$fixnum.Int64>(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'feePerKb', $pb.PbFieldType.OU6, protoName: 'feePerKb', defaultOrMaker: $fixnum.Int64.ZERO) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + const $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'EstimateFeeReply', + package: const $pb.PackageName( + $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'marisma'), + createEmptyInstance: create) + ..a<$fixnum.Int64>( + 1, + const $core.bool.fromEnvironment('protobuf.omit_field_names') + ? '' + : 'feePerKb', + $pb.PbFieldType.OU6, + protoName: 'feePerKb', + defaultOrMaker: $fixnum.Int64.ZERO) + ..hasRequiredFields = false; EstimateFeeReply._() : super(); factory EstimateFeeReply({ @@ -149,31 +219,40 @@ class EstimateFeeReply extends $pb.GeneratedMessage { } return _result; } - factory EstimateFeeReply.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory EstimateFeeReply.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') + factory EstimateFeeReply.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory EstimateFeeReply.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') EstimateFeeReply clone() => EstimateFeeReply()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - EstimateFeeReply copyWith(void Function(EstimateFeeReply) updates) => super.copyWith((message) => updates(message as EstimateFeeReply)) as EstimateFeeReply; // ignore: deprecated_member_use + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + EstimateFeeReply copyWith(void Function(EstimateFeeReply) updates) => + super.copyWith((message) => updates(message as EstimateFeeReply)) + as EstimateFeeReply; // ignore: deprecated_member_use $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static EstimateFeeReply create() => EstimateFeeReply._(); EstimateFeeReply createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static EstimateFeeReply getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static EstimateFeeReply getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static EstimateFeeReply? _defaultInstance; @$pb.TagNumber(1) $fixnum.Int64 get feePerKb => $_getI64(0); @$pb.TagNumber(1) - set feePerKb($fixnum.Int64 v) { $_setInt64(0, v); } + set feePerKb($fixnum.Int64 v) { + $_setInt64(0, v); + } + @$pb.TagNumber(1) $core.bool hasFeePerKb() => $_has(0); @$pb.TagNumber(1) @@ -181,10 +260,21 @@ class EstimateFeeReply extends $pb.GeneratedMessage { } class BroadCastTransactionRequest extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'BroadCastTransactionRequest', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'marisma'), createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'hex') - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + const $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'BroadCastTransactionRequest', + package: const $pb.PackageName( + $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'marisma'), + createEmptyInstance: create) + ..aOS( + 1, + const $core.bool.fromEnvironment('protobuf.omit_field_names') + ? '' + : 'hex') + ..hasRequiredFields = false; BroadCastTransactionRequest._() : super(); factory BroadCastTransactionRequest({ @@ -196,31 +286,44 @@ class BroadCastTransactionRequest extends $pb.GeneratedMessage { } return _result; } - factory BroadCastTransactionRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory BroadCastTransactionRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - BroadCastTransactionRequest clone() => BroadCastTransactionRequest()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - BroadCastTransactionRequest copyWith(void Function(BroadCastTransactionRequest) updates) => super.copyWith((message) => updates(message as BroadCastTransactionRequest)) as BroadCastTransactionRequest; // ignore: deprecated_member_use + factory BroadCastTransactionRequest.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory BroadCastTransactionRequest.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + BroadCastTransactionRequest clone() => + BroadCastTransactionRequest()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + BroadCastTransactionRequest copyWith( + void Function(BroadCastTransactionRequest) updates) => + super.copyWith( + (message) => updates(message as BroadCastTransactionRequest)) + as BroadCastTransactionRequest; // ignore: deprecated_member_use $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') - static BroadCastTransactionRequest create() => BroadCastTransactionRequest._(); + static BroadCastTransactionRequest create() => + BroadCastTransactionRequest._(); BroadCastTransactionRequest createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static BroadCastTransactionRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static BroadCastTransactionRequest getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static BroadCastTransactionRequest? _defaultInstance; @$pb.TagNumber(1) $core.String get hex => $_getSZ(0); @$pb.TagNumber(1) - set hex($core.String v) { $_setString(0, v); } + set hex($core.String v) { + $_setString(0, v); + } + @$pb.TagNumber(1) $core.bool hasHex() => $_has(0); @$pb.TagNumber(1) @@ -228,11 +331,27 @@ class BroadCastTransactionRequest extends $pb.GeneratedMessage { } class BroadCastTransactionReply extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'BroadCastTransactionReply', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'marisma'), createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'txid') - ..aOS(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'rpcError', protoName: 'rpcError') - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + const $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'BroadCastTransactionReply', + package: const $pb.PackageName( + $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'marisma'), + createEmptyInstance: create) + ..aOS( + 1, + const $core.bool.fromEnvironment('protobuf.omit_field_names') + ? '' + : 'txid') + ..aOS( + 2, + const $core.bool.fromEnvironment('protobuf.omit_field_names') + ? '' + : 'rpcError', + protoName: 'rpcError') + ..hasRequiredFields = false; BroadCastTransactionReply._() : super(); factory BroadCastTransactionReply({ @@ -248,31 +367,42 @@ class BroadCastTransactionReply extends $pb.GeneratedMessage { } return _result; } - factory BroadCastTransactionReply.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory BroadCastTransactionReply.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - BroadCastTransactionReply clone() => BroadCastTransactionReply()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - BroadCastTransactionReply copyWith(void Function(BroadCastTransactionReply) updates) => super.copyWith((message) => updates(message as BroadCastTransactionReply)) as BroadCastTransactionReply; // ignore: deprecated_member_use + factory BroadCastTransactionReply.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory BroadCastTransactionReply.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + BroadCastTransactionReply clone() => + BroadCastTransactionReply()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + BroadCastTransactionReply copyWith( + void Function(BroadCastTransactionReply) updates) => + super.copyWith((message) => updates(message as BroadCastTransactionReply)) + as BroadCastTransactionReply; // ignore: deprecated_member_use $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static BroadCastTransactionReply create() => BroadCastTransactionReply._(); BroadCastTransactionReply createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static BroadCastTransactionReply getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static BroadCastTransactionReply getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static BroadCastTransactionReply? _defaultInstance; @$pb.TagNumber(1) $core.String get txid => $_getSZ(0); @$pb.TagNumber(1) - set txid($core.String v) { $_setString(0, v); } + set txid($core.String v) { + $_setString(0, v); + } + @$pb.TagNumber(1) $core.bool hasTxid() => $_has(0); @$pb.TagNumber(1) @@ -281,7 +411,10 @@ class BroadCastTransactionReply extends $pb.GeneratedMessage { @$pb.TagNumber(2) $core.String get rpcError => $_getSZ(1); @$pb.TagNumber(2) - set rpcError($core.String v) { $_setString(1, v); } + set rpcError($core.String v) { + $_setString(1, v); + } + @$pb.TagNumber(2) $core.bool hasRpcError() => $_has(1); @$pb.TagNumber(2) @@ -289,10 +422,21 @@ class BroadCastTransactionReply extends $pb.GeneratedMessage { } class AddressRequest extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'AddressRequest', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'marisma'), createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'address') - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + const $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'AddressRequest', + package: const $pb.PackageName( + $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'marisma'), + createEmptyInstance: create) + ..aOS( + 1, + const $core.bool.fromEnvironment('protobuf.omit_field_names') + ? '' + : 'address') + ..hasRequiredFields = false; AddressRequest._() : super(); factory AddressRequest({ @@ -304,31 +448,40 @@ class AddressRequest extends $pb.GeneratedMessage { } return _result; } - factory AddressRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory AddressRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') + factory AddressRequest.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory AddressRequest.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') AddressRequest clone() => AddressRequest()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - AddressRequest copyWith(void Function(AddressRequest) updates) => super.copyWith((message) => updates(message as AddressRequest)) as AddressRequest; // ignore: deprecated_member_use + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + AddressRequest copyWith(void Function(AddressRequest) updates) => + super.copyWith((message) => updates(message as AddressRequest)) + as AddressRequest; // ignore: deprecated_member_use $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static AddressRequest create() => AddressRequest._(); AddressRequest createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static AddressRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static AddressRequest getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static AddressRequest? _defaultInstance; @$pb.TagNumber(1) $core.String get address => $_getSZ(0); @$pb.TagNumber(1) - set address($core.String v) { $_setString(0, v); } + set address($core.String v) { + $_setString(0, v); + } + @$pb.TagNumber(1) $core.bool hasAddress() => $_has(0); @$pb.TagNumber(1) @@ -336,11 +489,26 @@ class AddressRequest extends $pb.GeneratedMessage { } class AddressListRequest extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'AddressListRequest', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'marisma'), createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'address') - ..aOB(2, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'ascending') - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + const $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'AddressListRequest', + package: const $pb.PackageName( + $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'marisma'), + createEmptyInstance: create) + ..aOS( + 1, + const $core.bool.fromEnvironment('protobuf.omit_field_names') + ? '' + : 'address') + ..aOB( + 2, + const $core.bool.fromEnvironment('protobuf.omit_field_names') + ? '' + : 'ascending') + ..hasRequiredFields = false; AddressListRequest._() : super(); factory AddressListRequest({ @@ -356,31 +524,40 @@ class AddressListRequest extends $pb.GeneratedMessage { } return _result; } - factory AddressListRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory AddressListRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') + factory AddressListRequest.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory AddressListRequest.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') AddressListRequest clone() => AddressListRequest()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - AddressListRequest copyWith(void Function(AddressListRequest) updates) => super.copyWith((message) => updates(message as AddressListRequest)) as AddressListRequest; // ignore: deprecated_member_use + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + AddressListRequest copyWith(void Function(AddressListRequest) updates) => + super.copyWith((message) => updates(message as AddressListRequest)) + as AddressListRequest; // ignore: deprecated_member_use $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static AddressListRequest create() => AddressListRequest._(); AddressListRequest createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static AddressListRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static AddressListRequest getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static AddressListRequest? _defaultInstance; @$pb.TagNumber(1) $core.String get address => $_getSZ(0); @$pb.TagNumber(1) - set address($core.String v) { $_setString(0, v); } + set address($core.String v) { + $_setString(0, v); + } + @$pb.TagNumber(1) $core.bool hasAddress() => $_has(0); @$pb.TagNumber(1) @@ -389,7 +566,10 @@ class AddressListRequest extends $pb.GeneratedMessage { @$pb.TagNumber(2) $core.bool get ascending => $_getBF(1); @$pb.TagNumber(2) - set ascending($core.bool v) { $_setBool(1, v); } + set ascending($core.bool v) { + $_setBool(1, v); + } + @$pb.TagNumber(2) $core.bool hasAscending() => $_has(1); @$pb.TagNumber(2) @@ -397,10 +577,23 @@ class AddressListRequest extends $pb.GeneratedMessage { } class AddressBalanceReply extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'AddressBalanceReply', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'marisma'), createEmptyInstance: create) - ..a<$fixnum.Int64>(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'balance', $pb.PbFieldType.OU6, defaultOrMaker: $fixnum.Int64.ZERO) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + const $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'AddressBalanceReply', + package: const $pb.PackageName( + $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'marisma'), + createEmptyInstance: create) + ..a<$fixnum.Int64>( + 1, + const $core.bool.fromEnvironment('protobuf.omit_field_names') + ? '' + : 'balance', + $pb.PbFieldType.OU6, + defaultOrMaker: $fixnum.Int64.ZERO) + ..hasRequiredFields = false; AddressBalanceReply._() : super(); factory AddressBalanceReply({ @@ -412,31 +605,40 @@ class AddressBalanceReply extends $pb.GeneratedMessage { } return _result; } - factory AddressBalanceReply.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory AddressBalanceReply.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') + factory AddressBalanceReply.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory AddressBalanceReply.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') AddressBalanceReply clone() => AddressBalanceReply()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - AddressBalanceReply copyWith(void Function(AddressBalanceReply) updates) => super.copyWith((message) => updates(message as AddressBalanceReply)) as AddressBalanceReply; // ignore: deprecated_member_use + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + AddressBalanceReply copyWith(void Function(AddressBalanceReply) updates) => + super.copyWith((message) => updates(message as AddressBalanceReply)) + as AddressBalanceReply; // ignore: deprecated_member_use $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static AddressBalanceReply create() => AddressBalanceReply._(); AddressBalanceReply createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static AddressBalanceReply getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static AddressBalanceReply getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static AddressBalanceReply? _defaultInstance; @$pb.TagNumber(1) $fixnum.Int64 get balance => $_getI64(0); @$pb.TagNumber(1) - set balance($fixnum.Int64 v) { $_setInt64(0, v); } + set balance($fixnum.Int64 v) { + $_setInt64(0, v); + } + @$pb.TagNumber(1) $core.bool hasBalance() => $_has(0); @$pb.TagNumber(1) @@ -444,10 +646,21 @@ class AddressBalanceReply extends $pb.GeneratedMessage { } class AddressUtxoListReply extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'AddressUtxoListReply', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'marisma'), createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'utxos') - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + const $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'AddressUtxoListReply', + package: const $pb.PackageName( + $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'marisma'), + createEmptyInstance: create) + ..aOS( + 1, + const $core.bool.fromEnvironment('protobuf.omit_field_names') + ? '' + : 'utxos') + ..hasRequiredFields = false; AddressUtxoListReply._() : super(); factory AddressUtxoListReply({ @@ -459,31 +672,41 @@ class AddressUtxoListReply extends $pb.GeneratedMessage { } return _result; } - factory AddressUtxoListReply.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory AddressUtxoListReply.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - AddressUtxoListReply clone() => AddressUtxoListReply()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - AddressUtxoListReply copyWith(void Function(AddressUtxoListReply) updates) => super.copyWith((message) => updates(message as AddressUtxoListReply)) as AddressUtxoListReply; // ignore: deprecated_member_use + factory AddressUtxoListReply.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory AddressUtxoListReply.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + AddressUtxoListReply clone() => + AddressUtxoListReply()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + AddressUtxoListReply copyWith(void Function(AddressUtxoListReply) updates) => + super.copyWith((message) => updates(message as AddressUtxoListReply)) + as AddressUtxoListReply; // ignore: deprecated_member_use $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static AddressUtxoListReply create() => AddressUtxoListReply._(); AddressUtxoListReply createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static AddressUtxoListReply getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static AddressUtxoListReply getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static AddressUtxoListReply? _defaultInstance; @$pb.TagNumber(1) $core.String get utxos => $_getSZ(0); @$pb.TagNumber(1) - set utxos($core.String v) { $_setString(0, v); } + set utxos($core.String v) { + $_setString(0, v); + } + @$pb.TagNumber(1) $core.bool hasUtxos() => $_has(0); @$pb.TagNumber(1) @@ -491,10 +714,21 @@ class AddressUtxoListReply extends $pb.GeneratedMessage { } class AddressHistoryReply extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'AddressHistoryReply', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'marisma'), createEmptyInstance: create) - ..pPS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'history') - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + const $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'AddressHistoryReply', + package: const $pb.PackageName( + $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'marisma'), + createEmptyInstance: create) + ..pPS( + 1, + const $core.bool.fromEnvironment('protobuf.omit_field_names') + ? '' + : 'history') + ..hasRequiredFields = false; AddressHistoryReply._() : super(); factory AddressHistoryReply({ @@ -506,25 +740,31 @@ class AddressHistoryReply extends $pb.GeneratedMessage { } return _result; } - factory AddressHistoryReply.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory AddressHistoryReply.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') + factory AddressHistoryReply.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory AddressHistoryReply.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') AddressHistoryReply clone() => AddressHistoryReply()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - AddressHistoryReply copyWith(void Function(AddressHistoryReply) updates) => super.copyWith((message) => updates(message as AddressHistoryReply)) as AddressHistoryReply; // ignore: deprecated_member_use + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + AddressHistoryReply copyWith(void Function(AddressHistoryReply) updates) => + super.copyWith((message) => updates(message as AddressHistoryReply)) + as AddressHistoryReply; // ignore: deprecated_member_use $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static AddressHistoryReply create() => AddressHistoryReply._(); AddressHistoryReply createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static AddressHistoryReply getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static AddressHistoryReply getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static AddressHistoryReply? _defaultInstance; @$pb.TagNumber(1) @@ -532,10 +772,21 @@ class AddressHistoryReply extends $pb.GeneratedMessage { } class AddressHasUtxosReply extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'AddressHasUtxosReply', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'marisma'), createEmptyInstance: create) - ..aOB(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'hasUtxos') - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + const $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'AddressHasUtxosReply', + package: const $pb.PackageName( + $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'marisma'), + createEmptyInstance: create) + ..aOB( + 1, + const $core.bool.fromEnvironment('protobuf.omit_field_names') + ? '' + : 'hasUtxos') + ..hasRequiredFields = false; AddressHasUtxosReply._() : super(); factory AddressHasUtxosReply({ @@ -547,31 +798,41 @@ class AddressHasUtxosReply extends $pb.GeneratedMessage { } return _result; } - factory AddressHasUtxosReply.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory AddressHasUtxosReply.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - AddressHasUtxosReply clone() => AddressHasUtxosReply()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - AddressHasUtxosReply copyWith(void Function(AddressHasUtxosReply) updates) => super.copyWith((message) => updates(message as AddressHasUtxosReply)) as AddressHasUtxosReply; // ignore: deprecated_member_use + factory AddressHasUtxosReply.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory AddressHasUtxosReply.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + AddressHasUtxosReply clone() => + AddressHasUtxosReply()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + AddressHasUtxosReply copyWith(void Function(AddressHasUtxosReply) updates) => + super.copyWith((message) => updates(message as AddressHasUtxosReply)) + as AddressHasUtxosReply; // ignore: deprecated_member_use $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static AddressHasUtxosReply create() => AddressHasUtxosReply._(); AddressHasUtxosReply createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static AddressHasUtxosReply getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static AddressHasUtxosReply getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static AddressHasUtxosReply? _defaultInstance; @$pb.TagNumber(1) $core.bool get hasUtxos => $_getBF(0); @$pb.TagNumber(1) - set hasUtxos($core.bool v) { $_setBool(0, v); } + set hasUtxos($core.bool v) { + $_setBool(0, v); + } + @$pb.TagNumber(1) $core.bool hasHasUtxos() => $_has(0); @$pb.TagNumber(1) @@ -579,10 +840,22 @@ class AddressHasUtxosReply extends $pb.GeneratedMessage { } class AddressNumberOfUtxosReply extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'AddressNumberOfUtxosReply', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'marisma'), createEmptyInstance: create) - ..a<$core.int>(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'n', $pb.PbFieldType.OU3) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + const $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'AddressNumberOfUtxosReply', + package: const $pb.PackageName( + $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'marisma'), + createEmptyInstance: create) + ..a<$core.int>( + 1, + const $core.bool.fromEnvironment('protobuf.omit_field_names') + ? '' + : 'n', + $pb.PbFieldType.OU3) + ..hasRequiredFields = false; AddressNumberOfUtxosReply._() : super(); factory AddressNumberOfUtxosReply({ @@ -594,31 +867,42 @@ class AddressNumberOfUtxosReply extends $pb.GeneratedMessage { } return _result; } - factory AddressNumberOfUtxosReply.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory AddressNumberOfUtxosReply.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') - AddressNumberOfUtxosReply clone() => AddressNumberOfUtxosReply()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - AddressNumberOfUtxosReply copyWith(void Function(AddressNumberOfUtxosReply) updates) => super.copyWith((message) => updates(message as AddressNumberOfUtxosReply)) as AddressNumberOfUtxosReply; // ignore: deprecated_member_use + factory AddressNumberOfUtxosReply.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory AddressNumberOfUtxosReply.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') + AddressNumberOfUtxosReply clone() => + AddressNumberOfUtxosReply()..mergeFromMessage(this); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + AddressNumberOfUtxosReply copyWith( + void Function(AddressNumberOfUtxosReply) updates) => + super.copyWith((message) => updates(message as AddressNumberOfUtxosReply)) + as AddressNumberOfUtxosReply; // ignore: deprecated_member_use $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static AddressNumberOfUtxosReply create() => AddressNumberOfUtxosReply._(); AddressNumberOfUtxosReply createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static AddressNumberOfUtxosReply getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static AddressNumberOfUtxosReply getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static AddressNumberOfUtxosReply? _defaultInstance; @$pb.TagNumber(1) $core.int get n => $_getIZ(0); @$pb.TagNumber(1) - set n($core.int v) { $_setUnsignedInt32(0, v); } + set n($core.int v) { + $_setUnsignedInt32(0, v); + } + @$pb.TagNumber(1) $core.bool hasN() => $_has(0); @$pb.TagNumber(1) @@ -626,10 +910,21 @@ class AddressNumberOfUtxosReply extends $pb.GeneratedMessage { } class AddressIsKnownReply extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'AddressIsKnownReply', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'marisma'), createEmptyInstance: create) - ..aOB(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'isKnown') - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + const $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'AddressIsKnownReply', + package: const $pb.PackageName( + $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'marisma'), + createEmptyInstance: create) + ..aOB( + 1, + const $core.bool.fromEnvironment('protobuf.omit_field_names') + ? '' + : 'isKnown') + ..hasRequiredFields = false; AddressIsKnownReply._() : super(); factory AddressIsKnownReply({ @@ -641,31 +936,40 @@ class AddressIsKnownReply extends $pb.GeneratedMessage { } return _result; } - factory AddressIsKnownReply.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory AddressIsKnownReply.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') + factory AddressIsKnownReply.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory AddressIsKnownReply.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') AddressIsKnownReply clone() => AddressIsKnownReply()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - AddressIsKnownReply copyWith(void Function(AddressIsKnownReply) updates) => super.copyWith((message) => updates(message as AddressIsKnownReply)) as AddressIsKnownReply; // ignore: deprecated_member_use + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + AddressIsKnownReply copyWith(void Function(AddressIsKnownReply) updates) => + super.copyWith((message) => updates(message as AddressIsKnownReply)) + as AddressIsKnownReply; // ignore: deprecated_member_use $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static AddressIsKnownReply create() => AddressIsKnownReply._(); AddressIsKnownReply createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static AddressIsKnownReply getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static AddressIsKnownReply getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static AddressIsKnownReply? _defaultInstance; @$pb.TagNumber(1) $core.bool get isKnown => $_getBF(0); @$pb.TagNumber(1) - set isKnown($core.bool v) { $_setBool(0, v); } + set isKnown($core.bool v) { + $_setBool(0, v); + } + @$pb.TagNumber(1) $core.bool hasIsKnown() => $_has(0); @$pb.TagNumber(1) @@ -673,10 +977,21 @@ class AddressIsKnownReply extends $pb.GeneratedMessage { } class TxRequest extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'TxRequest', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'marisma'), createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'txid') - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + const $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'TxRequest', + package: const $pb.PackageName( + $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'marisma'), + createEmptyInstance: create) + ..aOS( + 1, + const $core.bool.fromEnvironment('protobuf.omit_field_names') + ? '' + : 'txid') + ..hasRequiredFields = false; TxRequest._() : super(); factory TxRequest({ @@ -688,31 +1003,39 @@ class TxRequest extends $pb.GeneratedMessage { } return _result; } - factory TxRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory TxRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') + factory TxRequest.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory TxRequest.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') TxRequest clone() => TxRequest()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - TxRequest copyWith(void Function(TxRequest) updates) => super.copyWith((message) => updates(message as TxRequest)) as TxRequest; // ignore: deprecated_member_use + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + TxRequest copyWith(void Function(TxRequest) updates) => + super.copyWith((message) => updates(message as TxRequest)) + as TxRequest; // ignore: deprecated_member_use $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static TxRequest create() => TxRequest._(); TxRequest createEmptyInstance() => create(); static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') - static TxRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static TxRequest getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static TxRequest? _defaultInstance; @$pb.TagNumber(1) $core.String get txid => $_getSZ(0); @$pb.TagNumber(1) - set txid($core.String v) { $_setString(0, v); } + set txid($core.String v) { + $_setString(0, v); + } + @$pb.TagNumber(1) $core.bool hasTxid() => $_has(0); @$pb.TagNumber(1) @@ -720,10 +1043,21 @@ class TxRequest extends $pb.GeneratedMessage { } class TxReply extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'TxReply', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'marisma'), createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'tx') - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + const $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'TxReply', + package: const $pb.PackageName( + $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'marisma'), + createEmptyInstance: create) + ..aOS( + 1, + const $core.bool.fromEnvironment('protobuf.omit_field_names') + ? '' + : 'tx') + ..hasRequiredFields = false; TxReply._() : super(); factory TxReply({ @@ -735,31 +1069,39 @@ class TxReply extends $pb.GeneratedMessage { } return _result; } - factory TxReply.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory TxReply.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') + factory TxReply.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory TxReply.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') TxReply clone() => TxReply()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - TxReply copyWith(void Function(TxReply) updates) => super.copyWith((message) => updates(message as TxReply)) as TxReply; // ignore: deprecated_member_use + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + TxReply copyWith(void Function(TxReply) updates) => + super.copyWith((message) => updates(message as TxReply)) + as TxReply; // ignore: deprecated_member_use $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static TxReply create() => TxReply._(); TxReply createEmptyInstance() => create(); static $pb.PbList createRepeated() => $pb.PbList(); @$core.pragma('dart2js:noInline') - static TxReply getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static TxReply getDefault() => + _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); static TxReply? _defaultInstance; @$pb.TagNumber(1) $core.String get tx => $_getSZ(0); @$pb.TagNumber(1) - set tx($core.String v) { $_setString(0, v); } + set tx($core.String v) { + $_setString(0, v); + } + @$pb.TagNumber(1) $core.bool hasTx() => $_has(0); @$pb.TagNumber(1) @@ -767,39 +1109,63 @@ class TxReply extends $pb.GeneratedMessage { } class TestStreamRequest extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'TestStreamRequest', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'marisma'), createEmptyInstance: create) - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + const $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'TestStreamRequest', + package: const $pb.PackageName( + $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'marisma'), + createEmptyInstance: create) + ..hasRequiredFields = false; TestStreamRequest._() : super(); factory TestStreamRequest() => create(); - factory TestStreamRequest.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory TestStreamRequest.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') + factory TestStreamRequest.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory TestStreamRequest.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') TestStreamRequest clone() => TestStreamRequest()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - TestStreamRequest copyWith(void Function(TestStreamRequest) updates) => super.copyWith((message) => updates(message as TestStreamRequest)) as TestStreamRequest; // ignore: deprecated_member_use + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + TestStreamRequest copyWith(void Function(TestStreamRequest) updates) => + super.copyWith((message) => updates(message as TestStreamRequest)) + as TestStreamRequest; // ignore: deprecated_member_use $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static TestStreamRequest create() => TestStreamRequest._(); TestStreamRequest createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static TestStreamRequest getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static TestStreamRequest getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static TestStreamRequest? _defaultInstance; } class TestStreamReply extends $pb.GeneratedMessage { - static final $pb.BuilderInfo _i = $pb.BuilderInfo(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'TestStreamReply', package: const $pb.PackageName(const $core.bool.fromEnvironment('protobuf.omit_message_names') ? '' : 'marisma'), createEmptyInstance: create) - ..aOS(1, const $core.bool.fromEnvironment('protobuf.omit_field_names') ? '' : 'name') - ..hasRequiredFields = false - ; + static final $pb.BuilderInfo _i = $pb.BuilderInfo( + const $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'TestStreamReply', + package: const $pb.PackageName( + $core.bool.fromEnvironment('protobuf.omit_message_names') + ? '' + : 'marisma'), + createEmptyInstance: create) + ..aOS( + 1, + const $core.bool.fromEnvironment('protobuf.omit_field_names') + ? '' + : 'name') + ..hasRequiredFields = false; TestStreamReply._() : super(); factory TestStreamReply({ @@ -811,34 +1177,42 @@ class TestStreamReply extends $pb.GeneratedMessage { } return _result; } - factory TestStreamReply.fromBuffer($core.List<$core.int> i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromBuffer(i, r); - factory TestStreamReply.fromJson($core.String i, [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => create()..mergeFromJson(i, r); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' - 'Will be removed in next major version') + factory TestStreamReply.fromBuffer($core.List<$core.int> i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromBuffer(i, r); + factory TestStreamReply.fromJson($core.String i, + [$pb.ExtensionRegistry r = $pb.ExtensionRegistry.EMPTY]) => + create()..mergeFromJson(i, r); + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.deepCopy] instead. ' + 'Will be removed in next major version') TestStreamReply clone() => TestStreamReply()..mergeFromMessage(this); - @$core.Deprecated( - 'Using this can add significant overhead to your binary. ' - 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' - 'Will be removed in next major version') - TestStreamReply copyWith(void Function(TestStreamReply) updates) => super.copyWith((message) => updates(message as TestStreamReply)) as TestStreamReply; // ignore: deprecated_member_use + @$core.Deprecated('Using this can add significant overhead to your binary. ' + 'Use [GeneratedMessageGenericExtensions.rebuild] instead. ' + 'Will be removed in next major version') + TestStreamReply copyWith(void Function(TestStreamReply) updates) => + super.copyWith((message) => updates(message as TestStreamReply)) + as TestStreamReply; // ignore: deprecated_member_use $pb.BuilderInfo get info_ => _i; @$core.pragma('dart2js:noInline') static TestStreamReply create() => TestStreamReply._(); TestStreamReply createEmptyInstance() => create(); - static $pb.PbList createRepeated() => $pb.PbList(); + static $pb.PbList createRepeated() => + $pb.PbList(); @$core.pragma('dart2js:noInline') - static TestStreamReply getDefault() => _defaultInstance ??= $pb.GeneratedMessage.$_defaultFor(create); + static TestStreamReply getDefault() => _defaultInstance ??= + $pb.GeneratedMessage.$_defaultFor(create); static TestStreamReply? _defaultInstance; @$pb.TagNumber(1) $core.String get name => $_getSZ(0); @$pb.TagNumber(1) - set name($core.String v) { $_setString(0, v); } + set name($core.String v) { + $_setString(0, v); + } + @$pb.TagNumber(1) $core.bool hasName() => $_has(0); @$pb.TagNumber(1) void clearName() => clearField(1); } - diff --git a/lib/generated/marisma.pbenum.dart b/lib/generated/marisma.pbenum.dart index 31fc1d8c..001d358c 100644 --- a/lib/generated/marisma.pbenum.dart +++ b/lib/generated/marisma.pbenum.dart @@ -4,4 +4,3 @@ // // @dart = 2.12 // ignore_for_file: annotate_overrides,camel_case_types,constant_identifier_names,directives_ordering,library_prefixes,non_constant_identifier_names,prefer_final_fields,return_of_invalid_type,unnecessary_const,unnecessary_import,unnecessary_this,unused_import,unused_shown_name - diff --git a/lib/generated/marisma.pbjson.dart b/lib/generated/marisma.pbjson.dart index 6b277f0f..84924e6b 100644 --- a/lib/generated/marisma.pbjson.dart +++ b/lib/generated/marisma.pbjson.dart @@ -8,182 +8,216 @@ import 'dart:core' as $core; import 'dart:convert' as $convert; import 'dart:typed_data' as $typed_data; + @$core.Deprecated('Use blockHeightRequestDescriptor instead') -const BlockHeightRequest$json = const { +const BlockHeightRequest$json = { '1': 'BlockHeightRequest', }; /// Descriptor for `BlockHeightRequest`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List blockHeightRequestDescriptor = $convert.base64Decode('ChJCbG9ja0hlaWdodFJlcXVlc3Q='); +final $typed_data.Uint8List blockHeightRequestDescriptor = + $convert.base64Decode('ChJCbG9ja0hlaWdodFJlcXVlc3Q='); @$core.Deprecated('Use blockHeightReplyDescriptor instead') -const BlockHeightReply$json = const { +const BlockHeightReply$json = { '1': 'BlockHeightReply', - '2': const [ - const {'1': 'height', '3': 1, '4': 1, '5': 13, '10': 'height'}, + '2': [ + {'1': 'height', '3': 1, '4': 1, '5': 13, '10': 'height'}, ], }; /// Descriptor for `BlockHeightReply`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List blockHeightReplyDescriptor = $convert.base64Decode('ChBCbG9ja0hlaWdodFJlcGx5EhYKBmhlaWdodBgBIAEoDVIGaGVpZ2h0'); +final $typed_data.Uint8List blockHeightReplyDescriptor = $convert + .base64Decode('ChBCbG9ja0hlaWdodFJlcGx5EhYKBmhlaWdodBgBIAEoDVIGaGVpZ2h0'); @$core.Deprecated('Use estimateFeeRequestDescriptor instead') -const EstimateFeeRequest$json = const { +const EstimateFeeRequest$json = { '1': 'EstimateFeeRequest', - '2': const [ - const {'1': 'blockTarget', '3': 1, '4': 1, '5': 13, '10': 'blockTarget'}, + '2': [ + {'1': 'blockTarget', '3': 1, '4': 1, '5': 13, '10': 'blockTarget'}, ], }; /// Descriptor for `EstimateFeeRequest`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List estimateFeeRequestDescriptor = $convert.base64Decode('ChJFc3RpbWF0ZUZlZVJlcXVlc3QSIAoLYmxvY2tUYXJnZXQYASABKA1SC2Jsb2NrVGFyZ2V0'); +final $typed_data.Uint8List estimateFeeRequestDescriptor = $convert.base64Decode( + 'ChJFc3RpbWF0ZUZlZVJlcXVlc3QSIAoLYmxvY2tUYXJnZXQYASABKA1SC2Jsb2NrVGFyZ2V0'); @$core.Deprecated('Use estimateFeeReplyDescriptor instead') -const EstimateFeeReply$json = const { +const EstimateFeeReply$json = { '1': 'EstimateFeeReply', - '2': const [ - const {'1': 'feePerKb', '3': 1, '4': 1, '5': 4, '10': 'feePerKb'}, + '2': [ + {'1': 'feePerKb', '3': 1, '4': 1, '5': 4, '10': 'feePerKb'}, ], }; /// Descriptor for `EstimateFeeReply`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List estimateFeeReplyDescriptor = $convert.base64Decode('ChBFc3RpbWF0ZUZlZVJlcGx5EhoKCGZlZVBlcktiGAEgASgEUghmZWVQZXJLYg=='); +final $typed_data.Uint8List estimateFeeReplyDescriptor = $convert.base64Decode( + 'ChBFc3RpbWF0ZUZlZVJlcGx5EhoKCGZlZVBlcktiGAEgASgEUghmZWVQZXJLYg=='); @$core.Deprecated('Use broadCastTransactionRequestDescriptor instead') -const BroadCastTransactionRequest$json = const { +const BroadCastTransactionRequest$json = { '1': 'BroadCastTransactionRequest', - '2': const [ - const {'1': 'hex', '3': 1, '4': 1, '5': 9, '10': 'hex'}, + '2': [ + {'1': 'hex', '3': 1, '4': 1, '5': 9, '10': 'hex'}, ], }; /// Descriptor for `BroadCastTransactionRequest`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List broadCastTransactionRequestDescriptor = $convert.base64Decode('ChtCcm9hZENhc3RUcmFuc2FjdGlvblJlcXVlc3QSEAoDaGV4GAEgASgJUgNoZXg='); +final $typed_data.Uint8List broadCastTransactionRequestDescriptor = + $convert.base64Decode( + 'ChtCcm9hZENhc3RUcmFuc2FjdGlvblJlcXVlc3QSEAoDaGV4GAEgASgJUgNoZXg='); @$core.Deprecated('Use broadCastTransactionReplyDescriptor instead') -const BroadCastTransactionReply$json = const { +const BroadCastTransactionReply$json = { '1': 'BroadCastTransactionReply', - '2': const [ - const {'1': 'txid', '3': 1, '4': 1, '5': 9, '10': 'txid'}, - const {'1': 'rpcError', '3': 2, '4': 1, '5': 9, '9': 0, '10': 'rpcError', '17': true}, + '2': [ + {'1': 'txid', '3': 1, '4': 1, '5': 9, '10': 'txid'}, + { + '1': 'rpcError', + '3': 2, + '4': 1, + '5': 9, + '9': 0, + '10': 'rpcError', + '17': true + }, ], - '8': const [ - const {'1': '_rpcError'}, + '8': [ + {'1': '_rpcError'}, ], }; /// Descriptor for `BroadCastTransactionReply`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List broadCastTransactionReplyDescriptor = $convert.base64Decode('ChlCcm9hZENhc3RUcmFuc2FjdGlvblJlcGx5EhIKBHR4aWQYASABKAlSBHR4aWQSHwoIcnBjRXJyb3IYAiABKAlIAFIIcnBjRXJyb3KIAQFCCwoJX3JwY0Vycm9y'); +final $typed_data.Uint8List broadCastTransactionReplyDescriptor = + $convert.base64Decode( + 'ChlCcm9hZENhc3RUcmFuc2FjdGlvblJlcGx5EhIKBHR4aWQYASABKAlSBHR4aWQSHwoIcnBjRXJyb3IYAiABKAlIAFIIcnBjRXJyb3KIAQFCCwoJX3JwY0Vycm9y'); @$core.Deprecated('Use addressRequestDescriptor instead') -const AddressRequest$json = const { +const AddressRequest$json = { '1': 'AddressRequest', - '2': const [ - const {'1': 'address', '3': 1, '4': 1, '5': 9, '10': 'address'}, + '2': [ + {'1': 'address', '3': 1, '4': 1, '5': 9, '10': 'address'}, ], }; /// Descriptor for `AddressRequest`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List addressRequestDescriptor = $convert.base64Decode('Cg5BZGRyZXNzUmVxdWVzdBIYCgdhZGRyZXNzGAEgASgJUgdhZGRyZXNz'); +final $typed_data.Uint8List addressRequestDescriptor = $convert + .base64Decode('Cg5BZGRyZXNzUmVxdWVzdBIYCgdhZGRyZXNzGAEgASgJUgdhZGRyZXNz'); @$core.Deprecated('Use addressListRequestDescriptor instead') -const AddressListRequest$json = const { +const AddressListRequest$json = { '1': 'AddressListRequest', - '2': const [ - const {'1': 'address', '3': 1, '4': 1, '5': 9, '10': 'address'}, - const {'1': 'ascending', '3': 2, '4': 1, '5': 8, '10': 'ascending'}, + '2': [ + {'1': 'address', '3': 1, '4': 1, '5': 9, '10': 'address'}, + {'1': 'ascending', '3': 2, '4': 1, '5': 8, '10': 'ascending'}, ], }; /// Descriptor for `AddressListRequest`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List addressListRequestDescriptor = $convert.base64Decode('ChJBZGRyZXNzTGlzdFJlcXVlc3QSGAoHYWRkcmVzcxgBIAEoCVIHYWRkcmVzcxIcCglhc2NlbmRpbmcYAiABKAhSCWFzY2VuZGluZw=='); +final $typed_data.Uint8List addressListRequestDescriptor = $convert.base64Decode( + 'ChJBZGRyZXNzTGlzdFJlcXVlc3QSGAoHYWRkcmVzcxgBIAEoCVIHYWRkcmVzcxIcCglhc2NlbmRpbmcYAiABKAhSCWFzY2VuZGluZw=='); @$core.Deprecated('Use addressBalanceReplyDescriptor instead') -const AddressBalanceReply$json = const { +const AddressBalanceReply$json = { '1': 'AddressBalanceReply', - '2': const [ - const {'1': 'balance', '3': 1, '4': 1, '5': 4, '10': 'balance'}, + '2': [ + {'1': 'balance', '3': 1, '4': 1, '5': 4, '10': 'balance'}, ], }; /// Descriptor for `AddressBalanceReply`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List addressBalanceReplyDescriptor = $convert.base64Decode('ChNBZGRyZXNzQmFsYW5jZVJlcGx5EhgKB2JhbGFuY2UYASABKARSB2JhbGFuY2U='); +final $typed_data.Uint8List addressBalanceReplyDescriptor = + $convert.base64Decode( + 'ChNBZGRyZXNzQmFsYW5jZVJlcGx5EhgKB2JhbGFuY2UYASABKARSB2JhbGFuY2U='); @$core.Deprecated('Use addressUtxoListReplyDescriptor instead') -const AddressUtxoListReply$json = const { +const AddressUtxoListReply$json = { '1': 'AddressUtxoListReply', - '2': const [ - const {'1': 'utxos', '3': 1, '4': 1, '5': 9, '10': 'utxos'}, + '2': [ + {'1': 'utxos', '3': 1, '4': 1, '5': 9, '10': 'utxos'}, ], }; /// Descriptor for `AddressUtxoListReply`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List addressUtxoListReplyDescriptor = $convert.base64Decode('ChRBZGRyZXNzVXR4b0xpc3RSZXBseRIUCgV1dHhvcxgBIAEoCVIFdXR4b3M='); +final $typed_data.Uint8List addressUtxoListReplyDescriptor = + $convert.base64Decode( + 'ChRBZGRyZXNzVXR4b0xpc3RSZXBseRIUCgV1dHhvcxgBIAEoCVIFdXR4b3M='); @$core.Deprecated('Use addressHistoryReplyDescriptor instead') -const AddressHistoryReply$json = const { +const AddressHistoryReply$json = { '1': 'AddressHistoryReply', - '2': const [ - const {'1': 'history', '3': 1, '4': 3, '5': 9, '10': 'history'}, + '2': [ + {'1': 'history', '3': 1, '4': 3, '5': 9, '10': 'history'}, ], }; /// Descriptor for `AddressHistoryReply`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List addressHistoryReplyDescriptor = $convert.base64Decode('ChNBZGRyZXNzSGlzdG9yeVJlcGx5EhgKB2hpc3RvcnkYASADKAlSB2hpc3Rvcnk='); +final $typed_data.Uint8List addressHistoryReplyDescriptor = + $convert.base64Decode( + 'ChNBZGRyZXNzSGlzdG9yeVJlcGx5EhgKB2hpc3RvcnkYASADKAlSB2hpc3Rvcnk='); @$core.Deprecated('Use addressHasUtxosReplyDescriptor instead') -const AddressHasUtxosReply$json = const { +const AddressHasUtxosReply$json = { '1': 'AddressHasUtxosReply', - '2': const [ - const {'1': 'has_utxos', '3': 1, '4': 1, '5': 8, '10': 'hasUtxos'}, + '2': [ + {'1': 'has_utxos', '3': 1, '4': 1, '5': 8, '10': 'hasUtxos'}, ], }; /// Descriptor for `AddressHasUtxosReply`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List addressHasUtxosReplyDescriptor = $convert.base64Decode('ChRBZGRyZXNzSGFzVXR4b3NSZXBseRIbCgloYXNfdXR4b3MYASABKAhSCGhhc1V0eG9z'); +final $typed_data.Uint8List addressHasUtxosReplyDescriptor = + $convert.base64Decode( + 'ChRBZGRyZXNzSGFzVXR4b3NSZXBseRIbCgloYXNfdXR4b3MYASABKAhSCGhhc1V0eG9z'); @$core.Deprecated('Use addressNumberOfUtxosReplyDescriptor instead') -const AddressNumberOfUtxosReply$json = const { +const AddressNumberOfUtxosReply$json = { '1': 'AddressNumberOfUtxosReply', - '2': const [ - const {'1': 'n', '3': 1, '4': 1, '5': 13, '10': 'n'}, + '2': [ + {'1': 'n', '3': 1, '4': 1, '5': 13, '10': 'n'}, ], }; /// Descriptor for `AddressNumberOfUtxosReply`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List addressNumberOfUtxosReplyDescriptor = $convert.base64Decode('ChlBZGRyZXNzTnVtYmVyT2ZVdHhvc1JlcGx5EgwKAW4YASABKA1SAW4='); +final $typed_data.Uint8List addressNumberOfUtxosReplyDescriptor = $convert + .base64Decode('ChlBZGRyZXNzTnVtYmVyT2ZVdHhvc1JlcGx5EgwKAW4YASABKA1SAW4='); @$core.Deprecated('Use addressIsKnownReplyDescriptor instead') -const AddressIsKnownReply$json = const { +const AddressIsKnownReply$json = { '1': 'AddressIsKnownReply', - '2': const [ - const {'1': 'is_known', '3': 1, '4': 1, '5': 8, '10': 'isKnown'}, + '2': [ + {'1': 'is_known', '3': 1, '4': 1, '5': 8, '10': 'isKnown'}, ], }; /// Descriptor for `AddressIsKnownReply`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List addressIsKnownReplyDescriptor = $convert.base64Decode('ChNBZGRyZXNzSXNLbm93blJlcGx5EhkKCGlzX2tub3duGAEgASgIUgdpc0tub3du'); +final $typed_data.Uint8List addressIsKnownReplyDescriptor = + $convert.base64Decode( + 'ChNBZGRyZXNzSXNLbm93blJlcGx5EhkKCGlzX2tub3duGAEgASgIUgdpc0tub3du'); @$core.Deprecated('Use txRequestDescriptor instead') -const TxRequest$json = const { +const TxRequest$json = { '1': 'TxRequest', - '2': const [ - const {'1': 'txid', '3': 1, '4': 1, '5': 9, '10': 'txid'}, + '2': [ + {'1': 'txid', '3': 1, '4': 1, '5': 9, '10': 'txid'}, ], }; /// Descriptor for `TxRequest`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List txRequestDescriptor = $convert.base64Decode('CglUeFJlcXVlc3QSEgoEdHhpZBgBIAEoCVIEdHhpZA=='); +final $typed_data.Uint8List txRequestDescriptor = + $convert.base64Decode('CglUeFJlcXVlc3QSEgoEdHhpZBgBIAEoCVIEdHhpZA=='); @$core.Deprecated('Use txReplyDescriptor instead') -const TxReply$json = const { +const TxReply$json = { '1': 'TxReply', - '2': const [ - const {'1': 'tx', '3': 1, '4': 1, '5': 9, '10': 'tx'}, + '2': [ + {'1': 'tx', '3': 1, '4': 1, '5': 9, '10': 'tx'}, ], }; /// Descriptor for `TxReply`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List txReplyDescriptor = $convert.base64Decode('CgdUeFJlcGx5Eg4KAnR4GAEgASgJUgJ0eA=='); +final $typed_data.Uint8List txReplyDescriptor = + $convert.base64Decode('CgdUeFJlcGx5Eg4KAnR4GAEgASgJUgJ0eA=='); @$core.Deprecated('Use testStreamRequestDescriptor instead') -const TestStreamRequest$json = const { +const TestStreamRequest$json = { '1': 'TestStreamRequest', }; /// Descriptor for `TestStreamRequest`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List testStreamRequestDescriptor = $convert.base64Decode('ChFUZXN0U3RyZWFtUmVxdWVzdA=='); +final $typed_data.Uint8List testStreamRequestDescriptor = + $convert.base64Decode('ChFUZXN0U3RyZWFtUmVxdWVzdA=='); @$core.Deprecated('Use testStreamReplyDescriptor instead') -const TestStreamReply$json = const { +const TestStreamReply$json = { '1': 'TestStreamReply', - '2': const [ - const {'1': 'name', '3': 1, '4': 1, '5': 9, '10': 'name'}, + '2': [ + {'1': 'name', '3': 1, '4': 1, '5': 9, '10': 'name'}, ], }; /// Descriptor for `TestStreamReply`. Decode as a `google.protobuf.DescriptorProto`. -final $typed_data.Uint8List testStreamReplyDescriptor = $convert.base64Decode('Cg9UZXN0U3RyZWFtUmVwbHkSEgoEbmFtZRgBIAEoCVIEbmFtZQ=='); +final $typed_data.Uint8List testStreamReplyDescriptor = $convert + .base64Decode('Cg9UZXN0U3RyZWFtUmVwbHkSEgoEbmFtZRgBIAEoCVIEbmFtZQ=='); diff --git a/lib/main.dart b/lib/main.dart index 32ff860f..a2143c3e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -73,18 +73,20 @@ void main() async { android: initializationSettingsAndroid, iOS: DarwinInitializationSettings(), ); - await flutterLocalNotificationsPlugin.initialize(initializationSettings, - onDidReceiveNotificationResponse: ( - NotificationResponse notificationResponse, - ) async { - if (notificationResponse.payload != null) { - LoggerWrapper.logInfo( - 'notification', - 'payload', - notificationResponse.payload!, - ); - } - }); + await flutterLocalNotificationsPlugin.initialize( + initializationSettings, + onDidReceiveNotificationResponse: ( + NotificationResponse notificationResponse, + ) async { + if (notificationResponse.payload != null) { + LoggerWrapper.logInfo( + 'notification', + 'payload', + notificationResponse.payload!, + ); + } + }, + ); final notificationAppLaunchDetails = await flutterLocalNotificationsPlugin.getNotificationAppLaunchDetails(); diff --git a/lib/models/coin_wallet.dart b/lib/models/coin_wallet.dart index a6277096..7b5575f6 100644 --- a/lib/models/coin_wallet.dart +++ b/lib/models/coin_wallet.dart @@ -121,7 +121,8 @@ class CoinWallet extends HiveObject { if (pendingTransactionNotifications.isNotEmpty) { for (var pendingNotifcation in pendingTransactionNotifications) { var address = addresses.firstWhere( - (element) => element.address == pendingNotifcation.address); + (element) => element.address == pendingNotifcation.address, + ); if (pendingNotifcation.tx != address.notificationBackendCount) { address.newNotificationBackendCount = pendingNotifcation.tx; diff --git a/lib/providers/active_wallets.dart b/lib/providers/active_wallets.dart index 2c2abcd2..e120266d 100644 --- a/lib/providers/active_wallets.dart +++ b/lib/providers/active_wallets.dart @@ -67,8 +67,10 @@ class ActiveWallets with ChangeNotifier { return bip39.mnemonicToSeed(words); } - Future createPhrase( - [String? providedPhrase, int strength = 128]) async { + Future createPhrase([ + String? providedPhrase, + int strength = 128, + ]) async { if (providedPhrase == null) { var mnemonicSeed = bip39.generateMnemonic(strength: strength); await _vaultBox!.put('mnemonicSeed', mnemonicSeed); @@ -163,14 +165,14 @@ class ActiveWallets with ChangeNotifier { if (openWallet.addresses.isEmpty) { //generate new address openWallet.addNewAddress = WalletAddress( - address: hdWallet.address!, + address: hdWallet.address, addressBookName: '', used: false, status: null, isOurs: true, wif: hdWallet.wif ?? '', ); - unusedAddress = hdWallet.address!; + unusedAddress = hdWallet.address; } else { //wallet is not brand new, lets find an unused address String? unusedAddr; @@ -190,7 +192,8 @@ class ActiveWallets with ChangeNotifier { var derivePath = "m/0'/$numberOfOurAddr/0"; var newHdWallet = hdWallet.derivePath(derivePath); var newAddrResult = openWallet.addresses.firstWhereOrNull( - (element) => element.address == newHdWallet.address); + (element) => element.address == newHdWallet.address, + ); while (newAddrResult != null) { //next addr in derivePath already exists for some reason, find a non-existing one @@ -199,11 +202,12 @@ class ActiveWallets with ChangeNotifier { newHdWallet = hdWallet.derivePath(derivePath); newAddrResult = openWallet.addresses.firstWhereOrNull( - (element) => element.address == newHdWallet.address); + (element) => element.address == newHdWallet.address, + ); } openWallet.addNewAddress = WalletAddress( - address: newHdWallet.address!, + address: newHdWallet.address, addressBookName: '', used: false, status: null, @@ -211,7 +215,7 @@ class ActiveWallets with ChangeNotifier { wif: newHdWallet.wif ?? '', ); - unusedAddress = newHdWallet.address!; + unusedAddress = newHdWallet.address; } } await openWallet.save(); @@ -223,7 +227,8 @@ class ActiveWallets with ChangeNotifier { } Future> getWalletTransactions( - String identifier) async { + String identifier, + ) async { var openWallet = getSpecificCoinWallet(identifier); return openWallet.transactions; } @@ -234,7 +239,9 @@ class ActiveWallets with ChangeNotifier { } Future getWalletAddressStatus( - String identifier, String address) async { + String identifier, + String address, + ) async { var addresses = await getWalletAddresses(identifier); var targetWallet = addresses.firstWhereOrNull( (element) => element.address == address, @@ -405,7 +412,7 @@ class ActiveWallets with ChangeNotifier { final script = decompile(out.script)!; // Find OP_RETURN + push data if (script.length == 2 && - script[0] == OPS['OP_RETURN'] && + script[0] == ops['OP_RETURN'] && script[1] is Uint8List) { String? parsedMessage; @@ -445,7 +452,9 @@ class ActiveWallets with ChangeNotifier { await flutterLocalNotificationsPlugin.show( DateTime.now().millisecondsSinceEpoch ~/ 10000, AppLocalizations.instance.translate( - 'notification_title', {'walletTitle': openWallet.title}), + 'notification_title', + {'walletTitle': openWallet.title}, + ), tx['txid'], LocalNotificationSettings.platformChannelSpecifics, payload: identifier, @@ -516,7 +525,10 @@ class ActiveWallets with ChangeNotifier { } Future updateAddressStatus( - String identifier, String address, String? status) async { + String identifier, + String address, + String? status, + ) async { LoggerWrapper.logInfo( 'ActiveWallets', 'updateAddressStatus', @@ -580,9 +592,9 @@ class ActiveWallets with ChangeNotifier { for (var i = 0; i <= maxValue + 1; i++) { final child = hdWallet.derivePath("m/0'/$i/0"); - _wifs[child.address!] = child.wif!; + _wifs[child.address] = child.wif!; } - _wifs[hdWallet.address!] = hdWallet.wif!; + _wifs[hdWallet.address] = hdWallet.wif!; } Future buildTransaction({ @@ -864,8 +876,10 @@ class ActiveWallets with ChangeNotifier { return txAmount; } - Future getWalletScriptHashes(String identifier, - [String? address]) async { + Future getWalletScriptHashes( + String identifier, [ + String? address, + ]) async { List? addresses; var answerMap = {}; if (address == null) { @@ -896,7 +910,7 @@ class ActiveWallets with ChangeNotifier { String getScriptHash(String identifier, String address) { var network = AvailableCoins.getSpecificCoin(identifier).networkType; - var script = Address.addressToOutputScript(address, network); + var script = addressToOutputScript(address, network); var hash = sha256.convert(script).toString(); return (reverseString(hash)); } @@ -923,7 +937,8 @@ class ActiveWallets with ChangeNotifier { ) async { var openWallet = getSpecificCoinWallet(identifier); var tx = openWallet.transactions.firstWhereOrNull( - (element) => element.txid == txId && element.confirmations != -1); + (element) => element.txid == txId && element.confirmations != -1, + ); if (tx != null) { tx.newConfirmations = -1; @@ -991,7 +1006,10 @@ class ActiveWallets with ChangeNotifier { } Future updateAddressWatched( - String identifier, String address, bool newValue) async { + String identifier, + String address, + bool newValue, + ) async { var openWallet = getSpecificCoinWallet(identifier); var addr = openWallet.addresses.firstWhereOrNull( (element) => element.address == address, diff --git a/lib/providers/electrum_connection.dart b/lib/providers/electrum_connection.dart index c670fb46..52c274b9 100644 --- a/lib/providers/electrum_connection.dart +++ b/lib/providers/electrum_connection.dart @@ -325,7 +325,9 @@ class ElectrumConnection with ChangeNotifier { switch (decoded['method']) { case 'blockchain.scripthash.subscribe': handleScriptHashSubscribeNotification( - decoded['params'][0], decoded['params'][1]); + decoded['params'][0], + decoded['params'][1], + ); break; case 'blockchain.headers.subscribe': handleBlock(decoded['params'][0]['height']); @@ -516,8 +518,9 @@ class ElectrumConnection with ChangeNotifier { ) async { //got update notification for hash => get utxo final address = _addresses.keys.firstWhere( - (element) => _addresses[element] == hashId, - orElse: () => null); + (element) => _addresses[element] == hashId, + orElse: () => null, + ); LoggerWrapper.logInfo( 'ElectrumConnection', 'handleScriptHashSubscribeNotification', diff --git a/lib/providers/encrypted_box.dart b/lib/providers/encrypted_box.dart index 34e6ad96..9402c903 100644 --- a/lib/providers/encrypted_box.dart +++ b/lib/providers/encrypted_box.dart @@ -73,7 +73,9 @@ class EncryptedBox with ChangeNotifier { Future setFailedAuthAttempts(int newInt) async { await _secureStorage.write( - key: 'failedAuthAttempts', value: newInt.toString()); + key: 'failedAuthAttempts', + value: newInt.toString(), + ); _failedAuthAttempts = newInt; } diff --git a/lib/providers/servers.dart b/lib/providers/servers.dart index fe54ff9f..2499bd0b 100644 --- a/lib/providers/servers.dart +++ b/lib/providers/servers.dart @@ -24,7 +24,10 @@ class Servers with ChangeNotifier { //check first run if (_serverBox.isEmpty) { LoggerWrapper.logInfo( - 'Servers', 'init', 'server storage is empty, initializing'); + 'Servers', + 'init', + 'server storage is empty, initializing', + ); seedServers.asMap().forEach((index, hardcodedSeedAddress) { var newServer = Server( @@ -39,7 +42,8 @@ class Servers with ChangeNotifier { // check if all hard coded seeds for this coin are already in db for (var hardcodedSeedAddress in seedServers) { var res = _serverBox.values.firstWhereOrNull( - (element) => element.getAddress == hardcodedSeedAddress); + (element) => element.getAddress == hardcodedSeedAddress, + ); if (res == null) { //hard coded server not yet in storage LoggerWrapper.logInfo( @@ -54,8 +58,9 @@ class Servers with ChangeNotifier { for (var boxElement in _serverBox.values) { if (boxElement.userGenerated == false) { var res = seedServers.firstWhere( - (element) => element == boxElement.address, - orElse: () => null); + (element) => element == boxElement.address, + orElse: () => null, + ); if (res == null) { LoggerWrapper.logInfo( 'Servers', diff --git a/lib/screens/about.dart b/lib/screens/about.dart index 58ffe74c..d133f316 100644 --- a/lib/screens/about.dart +++ b/lib/screens/about.dart @@ -60,6 +60,7 @@ class _AboutScreenState extends State { if (_initial) return const SizedBox(); return Scaffold( appBar: AppBar( + centerTitle: true, title: Text( AppLocalizations.instance.translate('about'), ), @@ -122,15 +123,16 @@ class _AboutScreenState extends State { ), ), TextButton( - onPressed: () => _launchURL( - 'https://github.com/peercoin/peercoin_flutter', - ), - child: Text( - AppLocalizations.instance.translate( - 'about_view_source', - ), - textAlign: TextAlign.center, - )), + onPressed: () => _launchURL( + 'https://github.com/peercoin/peercoin_flutter', + ), + child: Text( + AppLocalizations.instance.translate( + 'about_view_source', + ), + textAlign: TextAlign.center, + ), + ), const Divider(), const SizedBox(height: 10), Text( diff --git a/lib/screens/changelog.dart b/lib/screens/changelog.dart index 86992123..c1b0d35c 100644 --- a/lib/screens/changelog.dart +++ b/lib/screens/changelog.dart @@ -10,6 +10,7 @@ class ChangeLogScreen extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( + centerTitle: true, title: Text( AppLocalizations.instance.translate('changelog_appbar'), ), diff --git a/lib/screens/qrcode_scanner.dart b/lib/screens/qrcode_scanner.dart index 40ee433b..68758ca0 100644 --- a/lib/screens/qrcode_scanner.dart +++ b/lib/screens/qrcode_scanner.dart @@ -29,6 +29,7 @@ class _QRScannerState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( + centerTitle: true, title: Text(ModalRoute.of(context)!.settings.arguments as String), ), body: Column( diff --git a/lib/screens/secure_storage_error_screen.dart b/lib/screens/secure_storage_error_screen.dart index b38092d5..30e82bce 100644 --- a/lib/screens/secure_storage_error_screen.dart +++ b/lib/screens/secure_storage_error_screen.dart @@ -9,6 +9,7 @@ class SecureStorageFailedScreen extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( + centerTitle: true, title: Center( child: Text( AppLocalizations.instance.translate( diff --git a/lib/screens/server_settings/server_add.dart b/lib/screens/server_settings/server_add.dart index 9bad9100..7134baea 100644 --- a/lib/screens/server_settings/server_add.dart +++ b/lib/screens/server_settings/server_add.dart @@ -61,13 +61,15 @@ class _ServerAddScreenState extends State { .firstWhereOrNull((element) => element.address == serverUrl) != null) { //show notification - scaffoldMessanger.showSnackBar(SnackBar( - content: Text( - AppLocalizations.instance.translate('server_add_server_exists'), - textAlign: TextAlign.center, + scaffoldMessanger.showSnackBar( + SnackBar( + content: Text( + AppLocalizations.instance.translate('server_add_server_exists'), + textAlign: TextAlign.center, + ), + duration: const Duration(seconds: 2), ), - duration: const Duration(seconds: 2), - )); + ); } else { //continue: try to connect LoggerWrapper.logInfo('ServerAdd', 'tryConnect', 'trying to connect'); @@ -144,14 +146,16 @@ class _ServerAddScreenState extends State { Navigator.of(context).pop(true); } else { //gensis hash doesn't match - ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text( - AppLocalizations.instance - .translate('server_add_server_wrong_genesis'), - textAlign: TextAlign.center, + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + AppLocalizations.instance + .translate('server_add_server_wrong_genesis'), + textAlign: TextAlign.center, + ), + duration: const Duration(seconds: 2), ), - duration: const Duration(seconds: 2), - )); + ); } } setState(() { @@ -168,11 +172,14 @@ class _ServerAddScreenState extends State { if (stream == null) return; - stream.listen((elem) { - replyHandler(elem); - }, onError: (error) { - displayError(error); - }); + stream.listen( + (elem) { + replyHandler(elem); + }, + onError: (error) { + displayError(error); + }, + ); sendMessage('server.features', 'features'); } @@ -203,6 +210,7 @@ class _ServerAddScreenState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( + centerTitle: true, title: Center( child: Text( AppLocalizations.instance.translate('server_add_title'), @@ -230,42 +238,42 @@ class _ServerAddScreenState extends State { child: Column( children: [ TextFormField( - textInputAction: TextInputAction.done, - key: _serverKey, - autocorrect: false, - controller: _serverController, - decoration: InputDecoration( - icon: const Icon(Icons.outbond), - labelText: AppLocalizations.instance - .translate('server_add_input_label'), - ), - maxLines: null, - onFieldSubmitted: (_) => - _formKey.currentState!.validate(), - validator: (value) { - var portRegex = RegExp(':[0-9]'); + textInputAction: TextInputAction.done, + key: _serverKey, + autocorrect: false, + controller: _serverController, + decoration: InputDecoration( + icon: const Icon(Icons.outbond), + labelText: AppLocalizations.instance + .translate('server_add_input_label'), + ), + maxLines: null, + onFieldSubmitted: (_) => _formKey.currentState!.validate(), + validator: (value) { + var portRegex = RegExp(':[0-9]'); - if (value!.isEmpty) { - return AppLocalizations.instance - .translate('server_add_input_empty'); - } else if (kIsWeb && !value.contains('wss://')) { - return AppLocalizations.instance - .translate('server_add_no_wss'); - } else if (!kIsWeb && - !value.contains('wss://') && - !value.contains('ssl://')) { - return AppLocalizations.instance - .translate('server_add_no_wss_or_ssl'); - } else if (!portRegex.hasMatch(value)) { - return AppLocalizations.instance - .translate('server_add_no_port'); - } - //valid string, try further + if (value!.isEmpty) { + return AppLocalizations.instance + .translate('server_add_input_empty'); + } else if (kIsWeb && !value.contains('wss://')) { + return AppLocalizations.instance + .translate('server_add_no_wss'); + } else if (!kIsWeb && + !value.contains('wss://') && + !value.contains('ssl://')) { + return AppLocalizations.instance + .translate('server_add_no_wss_or_ssl'); + } else if (!portRegex.hasMatch(value)) { + return AppLocalizations.instance + .translate('server_add_no_port'); + } + //valid string, try further - tryConnect(value); + tryConnect(value); - return null; - }), + return null; + }, + ), if (_loading) const Padding( padding: EdgeInsets.symmetric(vertical: 30), diff --git a/lib/screens/server_settings/server_settings.dart b/lib/screens/server_settings/server_settings.dart index 934d222a..757b4502 100644 --- a/lib/screens/server_settings/server_settings.dart +++ b/lib/screens/server_settings/server_settings.dart @@ -82,6 +82,7 @@ class _ServerSettingsScreenState extends State { context.watch().connectedServerUrl; return Scaffold( appBar: AppBar( + centerTitle: true, title: Center( child: Text( AppLocalizations.instance.translate('server_settings_title'), @@ -130,21 +131,29 @@ class _ServerSettingsScreenState extends State { return await showDialog( context: context, builder: (_) => AlertDialog( - title: Text(AppLocalizations.instance.translate( - 'server_settings_alert_generated_title')), + title: Text( + AppLocalizations.instance.translate( + 'server_settings_alert_generated_title', + ), + ), content: Text(_servers[index].address), actions: [ TextButton.icon( - label: Text(AppLocalizations.instance - .translate( - 'server_settings_alert_cancel')), - icon: const Icon(Icons.cancel), - onPressed: () { - Navigator.of(context).pop(false); - }), + label: Text( + AppLocalizations.instance.translate( + 'server_settings_alert_cancel', + ), + ), + icon: const Icon(Icons.cancel), + onPressed: () { + Navigator.of(context).pop(false); + }, + ), TextButton.icon( - label: Text(AppLocalizations.instance - .translate('jail_dialog_button')), + label: Text( + AppLocalizations.instance + .translate('jail_dialog_button'), + ), icon: const Icon(Icons.check), onPressed: () { Navigator.of(context).pop(true); @@ -157,10 +166,16 @@ class _ServerSettingsScreenState extends State { return await showDialog( context: context, builder: (_) => AlertDialog( - title: Text(AppLocalizations.instance.translate( - 'server_settings_alert_hardcoded_title')), - content: Text(AppLocalizations.instance.translate( - 'server_settings_alert_hardcoded_content')), + title: Text( + AppLocalizations.instance.translate( + 'server_settings_alert_hardcoded_title', + ), + ), + content: Text( + AppLocalizations.instance.translate( + 'server_settings_alert_hardcoded_content', + ), + ), actions: [ TextButton.icon( label: Text( @@ -187,7 +202,9 @@ class _ServerSettingsScreenState extends State { alignment: Alignment.centerRight, padding: const EdgeInsets.only(right: 10), margin: const EdgeInsets.symmetric( - horizontal: 15, vertical: 4), + horizontal: 15, + vertical: 4, + ), color: Theme.of(context).errorColor, child: const Icon( Icons.delete, @@ -217,15 +234,17 @@ class _ServerSettingsScreenState extends State { !_servers[index].connectable; }); //check if still one connectable server is left - if (_servers.firstWhereOrNull((element) => - element.connectable == true) == + if (_servers.firstWhereOrNull( + (element) => element.connectable == true, + ) == null) { //show snack bar ScaffoldMessenger.of(context).showSnackBar( SnackBar( content: Text( AppLocalizations.instance.translate( - 'server_settings_error_no_server_left'), + 'server_settings_error_no_server_left', + ), textAlign: TextAlign.center, ), duration: const Duration(seconds: 2), @@ -261,7 +280,9 @@ class _ServerSettingsScreenState extends State { ), ), tileColor: calculateTileColor( - index, _servers[index].connectable), + index, + _servers[index].connectable, + ), title: Text(_servers[index].address), subtitle: _servers[index].address == connectedServer ? Center( diff --git a/lib/screens/settings/app_settings_notifications.dart b/lib/screens/settings/app_settings_notifications.dart index d9ef8036..b92aaaf6 100644 --- a/lib/screens/settings/app_settings_notifications.dart +++ b/lib/screens/settings/app_settings_notifications.dart @@ -185,12 +185,13 @@ class _AppSettingsNotificationsScreenState ), ), Text( - AppLocalizations.instance - .translate('app_settings_notifications_hint_sync_2'), - style: TextStyle( - fontSize: 12, - color: Theme.of(context).colorScheme.secondary, - )), + AppLocalizations.instance + .translate('app_settings_notifications_hint_sync_2'), + style: TextStyle( + fontSize: 12, + color: Theme.of(context).colorScheme.secondary, + ), + ), const SizedBox(height: 10), const Divider(), const SizedBox(height: 10), @@ -211,6 +212,7 @@ class _AppSettingsNotificationsScreenState Widget build(BuildContext context) { return Scaffold( appBar: AppBar( + centerTitle: true, title: Text( AppLocalizations.instance.translate('app_settings_notifications'), ), diff --git a/lib/screens/settings/app_settings_screen.dart b/lib/screens/settings/app_settings_screen.dart index 87649b98..5d81b071 100644 --- a/lib/screens/settings/app_settings_screen.dart +++ b/lib/screens/settings/app_settings_screen.dart @@ -160,13 +160,15 @@ class _AppSettingsScreenState extends State { await AppLocalizations.delegate.load(Locale(lang)); //show notification - scaffoldMessenger.showSnackBar(SnackBar( - content: Text( - AppLocalizations.instance.translate('app_settings_saved_snack'), - textAlign: TextAlign.center, + scaffoldMessenger.showSnackBar( + SnackBar( + content: Text( + AppLocalizations.instance.translate('app_settings_saved_snack'), + textAlign: TextAlign.center, + ), + duration: const Duration(seconds: 2), ), - duration: const Duration(seconds: 2), - )); + ); } void saveTheme(String label, ThemeMode theme) async { @@ -176,13 +178,15 @@ class _AppSettingsScreenState extends State { _selectedTheme = label; }); //show notification - scaffoldMessenger.showSnackBar(SnackBar( - content: Text( - AppLocalizations.instance.translate('app_settings_saved_snack'), - textAlign: TextAlign.center, + scaffoldMessenger.showSnackBar( + SnackBar( + content: Text( + AppLocalizations.instance.translate('app_settings_saved_snack'), + textAlign: TextAlign.center, + ), + duration: const Duration(seconds: 2), ), - duration: const Duration(seconds: 2), - )); + ); } List generateDefaultWallets() { @@ -214,13 +218,15 @@ class _AppSettingsScreenState extends State { } void saveSnack(context) { - ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text( - AppLocalizations.instance.translate('app_settings_saved_snack'), - textAlign: TextAlign.center, + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + AppLocalizations.instance.translate('app_settings_saved_snack'), + textAlign: TextAlign.center, + ), + duration: const Duration(seconds: 2), ), - duration: const Duration(seconds: 2), - )); + ); } void saveDefaultWallet(String wallet) async { @@ -239,6 +245,7 @@ class _AppSettingsScreenState extends State { return Scaffold( appBar: AppBar( + centerTitle: true, title: Text( AppLocalizations.instance.translate('app_settings_appbar'), ), @@ -296,68 +303,73 @@ class _AppSettingsScreenState extends State { children: generateDefaultWallets(), ), ExpansionTile( - title: Text( - AppLocalizations.instance - .translate('app_settings_auth_header'), - style: Theme.of(context).textTheme.headline6), - childrenPadding: const EdgeInsets.all(10), - children: [ - _biometricsRevealed == false - ? PeerButton( - action: () => revealAuthOptions( - _settings.biometricsAllowed), - text: AppLocalizations.instance - .translate('app_settings_revealAuthButton'), - ) - : SettingsAuth( - _biometricsAllowed, - _biometricsAvailable, - _settings, - saveSnack, - _settings.authenticationOptions!, - ) - ]), + title: Text( + AppLocalizations.instance + .translate('app_settings_auth_header'), + style: Theme.of(context).textTheme.headline6, + ), + childrenPadding: const EdgeInsets.all(10), + children: [ + _biometricsRevealed == false + ? PeerButton( + action: () => revealAuthOptions( + _settings.biometricsAllowed, + ), + text: AppLocalizations.instance + .translate('app_settings_revealAuthButton'), + ) + : SettingsAuth( + _biometricsAllowed, + _biometricsAvailable, + _settings, + saveSnack, + _settings.authenticationOptions!, + ) + ], + ), ExpansionTile( - title: Text( - AppLocalizations.instance - .translate('app_settings_seed'), - style: Theme.of(context).textTheme.headline6), - childrenPadding: const EdgeInsets.all(10), - children: [ - _seedPhrase == '' - ? PeerButton( - action: () => - revealSeedPhrase(_settings.biometricsAllowed), - text: AppLocalizations.instance - .translate('app_settings_revealSeedButton'), - ) - : Column( - children: [ - const SizedBox(height: 20), - DoubleTabToClipboard( - clipBoardData: _seedPhrase, - child: SelectableText( - _seedPhrase, - textAlign: TextAlign.center, - ), + title: Text( + AppLocalizations.instance.translate('app_settings_seed'), + style: Theme.of(context).textTheme.headline6, + ), + childrenPadding: const EdgeInsets.all(10), + children: [ + _seedPhrase == '' + ? PeerButton( + action: () => + revealSeedPhrase(_settings.biometricsAllowed), + text: AppLocalizations.instance + .translate('app_settings_revealSeedButton'), + ) + : Column( + children: [ + const SizedBox(height: 20), + DoubleTabToClipboard( + clipBoardData: _seedPhrase, + child: SelectableText( + _seedPhrase, + textAlign: TextAlign.center, ), - const SizedBox(height: 20), - if (!kIsWeb) - PeerButton( - action: () => ShareWrapper.share( - context: context, - message: _seedPhrase, - ), - text: AppLocalizations.instance - .translate('app_settings_shareseed'), - ) - ], - ) - ]), + ), + const SizedBox(height: 20), + if (!kIsWeb) + PeerButton( + action: () => ShareWrapper.share( + context: context, + message: _seedPhrase, + ), + text: AppLocalizations.instance + .translate('app_settings_shareseed'), + ) + ], + ) + ], + ), ExpansionTile( title: Text( - AppLocalizations.instance.translate('app_settings_theme'), - style: Theme.of(context).textTheme.headline6), + AppLocalizations.instance.translate('app_settings_theme'), + style: Theme.of(context).textTheme.headline6, + ), childrenPadding: const EdgeInsets.all(10), children: _availableThemes.keys.map((theme) { return InkWell( @@ -397,7 +409,8 @@ class _AppSettingsScreenState extends State { children: [ PeerButton( text: AppLocalizations.instance.translate( - 'app_settings_notifications_open_button'), + 'app_settings_notifications_open_button', + ), action: () => Navigator.of(context).pushNamed( Routes.appSettingsNotifications, ), diff --git a/lib/screens/setup/setup.dart b/lib/screens/setup/setup.dart index 8ea30961..37fa5e12 100644 --- a/lib/screens/setup/setup.dart +++ b/lib/screens/setup/setup.dart @@ -32,6 +32,7 @@ class _SetupScreenState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( + centerTitle: true, toolbarHeight: 0, automaticallyImplyLeading: false, ), @@ -99,7 +100,9 @@ class _SetupScreenState extends State { Text( AppLocalizations.instance.translate('setup_text3'), style: const TextStyle( - color: Colors.white, fontSize: 20), + color: Colors.white, + fontSize: 20, + ), textAlign: TextAlign.center, ), PeerExplanationText( @@ -187,5 +190,5 @@ class PeerProgress extends StatelessWidget { } //TODO web: material icons are not rendered on firefox / -//also rendering issues with non latin characters (flutter render engine issue) -//-> use html renderer instead of canvas for now \ No newline at end of file +//also rendering issues with non latin characters (flutter render engine issue) +//-> use html renderer instead of canvas for now diff --git a/lib/screens/setup/setup_auth.dart b/lib/screens/setup/setup_auth.dart index 0526aeba..952417cb 100644 --- a/lib/screens/setup/setup_auth.dart +++ b/lib/screens/setup/setup_auth.dart @@ -48,6 +48,7 @@ class _SetupAuthScreenState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( + centerTitle: true, toolbarHeight: 0, automaticallyImplyLeading: false, ), @@ -87,7 +88,9 @@ class _SetupAuthScreenState extends State { AppLocalizations.instance .translate('app_settings_auth_header'), style: const TextStyle( - color: Colors.white, fontSize: 28), + color: Colors.white, + fontSize: 28, + ), ), const SizedBox( width: 40, @@ -116,15 +119,17 @@ class _SetupAuthScreenState extends State { inactiveThumbColor: Colors.grey, onChanged: (newState) { if (_biometricsAvailable == false) { - ScaffoldMessenger.of(context) - .showSnackBar(SnackBar( - content: Text( - AppLocalizations.instance.translate( - 'setup_pin_no_biometrics'), - textAlign: TextAlign.center, + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + AppLocalizations.instance.translate( + 'setup_pin_no_biometrics', + ), + textAlign: TextAlign.center, + ), + duration: const Duration(seconds: 5), ), - duration: const Duration(seconds: 5), - )); + ); } else { setState(() { _biometricsAllowed = newState; diff --git a/lib/screens/setup/setup_create_wallet.dart b/lib/screens/setup/setup_create_wallet.dart index 92c68144..cbc1a2f2 100644 --- a/lib/screens/setup/setup_create_wallet.dart +++ b/lib/screens/setup/setup_create_wallet.dart @@ -39,13 +39,15 @@ class _SetupCreateWalletScreenState extends State { await Clipboard.setData( ClipboardData(text: seed), ); - scaffoldMessenger.showSnackBar(SnackBar( - content: Text( - AppLocalizations.instance.translate('snack_copied'), - textAlign: TextAlign.center, + scaffoldMessenger.showSnackBar( + SnackBar( + content: Text( + AppLocalizations.instance.translate('snack_copied'), + textAlign: TextAlign.center, + ), + duration: const Duration(seconds: 2), ), - duration: const Duration(seconds: 2), - )); + ); } else { await ShareWrapper.share( context: context, @@ -166,6 +168,7 @@ class _SetupCreateWalletScreenState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( + centerTitle: true, toolbarHeight: 0, automaticallyImplyLeading: false, ), @@ -252,7 +255,8 @@ class _SetupCreateWalletScreenState extends State { child: Text( AppLocalizations.instance .translate( - 'setup_save_text1'), + 'setup_save_text1', + ), style: TextStyle( color: Theme.of(context) .colorScheme @@ -269,15 +273,17 @@ class _SetupCreateWalletScreenState extends State { GestureDetector( onDoubleTap: () { ScaffoldMessenger.of(context) - .showSnackBar(SnackBar( - content: Text( - AppLocalizations.instance - .translate('snack_copied'), - textAlign: TextAlign.center, + .showSnackBar( + SnackBar( + content: Text( + AppLocalizations.instance + .translate('snack_copied'), + textAlign: TextAlign.center, + ), + duration: + const Duration(seconds: 1), ), - duration: - const Duration(seconds: 1), - )); + ); Clipboard.setData( ClipboardData(text: _seed), ); @@ -288,7 +294,11 @@ class _SetupCreateWalletScreenState extends State { child: Container( height: 250, padding: const EdgeInsets.fromLTRB( - 16, 32, 16, 24), + 16, + 32, + 16, + 24, + ), decoration: BoxDecoration( borderRadius: const BorderRadius.all( diff --git a/lib/screens/setup/setup_data_feeds.dart b/lib/screens/setup/setup_data_feeds.dart index 29cae21c..03293c04 100644 --- a/lib/screens/setup/setup_data_feeds.dart +++ b/lib/screens/setup/setup_data_feeds.dart @@ -63,6 +63,7 @@ class _SetupDataFeedsScreenState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( + centerTitle: true, toolbarHeight: 0, automaticallyImplyLeading: false, ), @@ -183,7 +184,8 @@ class _SetupDataFeedsScreenState extends State { ), PeerButton( action: () => _launchURL( - 'https://github.com/peercoin/peercoin_flutter/blob/main/data_protection.md'), + 'https://github.com/peercoin/peercoin_flutter/blob/main/data_protection.md', + ), text: AppLocalizations.instance .translate('about_data_declaration'), ), diff --git a/lib/screens/setup/setup_import_seed.dart b/lib/screens/setup/setup_import_seed.dart index 53a563dd..137b6afd 100644 --- a/lib/screens/setup/setup_import_seed.dart +++ b/lib/screens/setup/setup_import_seed.dart @@ -44,13 +44,15 @@ class _SetupImportSeedState extends State { 'createWallet', e.toString(), ); - ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text( - AppLocalizations.instance.translate('setup_securebox_fail'), - textAlign: TextAlign.center, + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + AppLocalizations.instance.translate('setup_securebox_fail'), + textAlign: TextAlign.center, + ), + duration: const Duration(seconds: 10), ), - duration: const Duration(seconds: 10), - )); + ); } await activeWallets.createPhrase(_controller.text); var prefs = await SharedPreferences.getInstance(); @@ -75,6 +77,7 @@ class _SetupImportSeedState extends State { return Scaffold( appBar: AppBar( + centerTitle: true, toolbarHeight: 0, automaticallyImplyLeading: false, ), @@ -201,10 +204,11 @@ class _SetupImportSeedState extends State { return null; }, style: TextStyle( - color: Theme.of(context) - .colorScheme - .primaryContainer, - fontSize: 16), + color: Theme.of(context) + .colorScheme + .primaryContainer, + fontSize: 16, + ), decoration: InputDecoration( hintText: 'e.g. mushrooms pepper courgette onion asparagus garlic sweetcorn nut pumpkin potato bean spinach', @@ -222,7 +226,8 @@ class _SetupImportSeedState extends State { final focusScope = FocusScope.of(context); var data = await Clipboard.getData( - 'text/plain'); + 'text/plain', + ); if (data != null) { _controller.text = data.text!.trim(); } @@ -239,7 +244,8 @@ class _SetupImportSeedState extends State { focusedBorder: border, enabledBorder: border, errorStyle: TextStyle( - color: Theme.of(context).errorColor), + color: Theme.of(context).errorColor, + ), errorBorder: border, focusedErrorBorder: border, ), diff --git a/lib/screens/setup/setup_language.dart b/lib/screens/setup/setup_language.dart index 6737c92b..7512de0b 100644 --- a/lib/screens/setup/setup_language.dart +++ b/lib/screens/setup/setup_language.dart @@ -52,9 +52,11 @@ class _SetupLanguageScreenState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text( - AppLocalizations.instance.translate('app_settings_language'), - )), + centerTitle: true, + title: Text( + AppLocalizations.instance.translate('app_settings_language'), + ), + ), body: SingleChildScrollView( child: Padding( padding: const EdgeInsets.all(20.0), diff --git a/lib/screens/setup/setup_legal.dart b/lib/screens/setup/setup_legal.dart index 406d51e6..4d0d4b80 100644 --- a/lib/screens/setup/setup_legal.dart +++ b/lib/screens/setup/setup_legal.dart @@ -41,6 +41,7 @@ class _SetupLegalScreenState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( + centerTitle: true, toolbarHeight: 0, automaticallyImplyLeading: false, ), @@ -95,7 +96,8 @@ class _SetupLegalScreenState extends State { children: [ PeerButton( action: () => _launchURL( - 'https://github.com/peercoin/peercoin_flutter/blob/main/LICENSE'), + 'https://github.com/peercoin/peercoin_flutter/blob/main/LICENSE', + ), text: AppLocalizations.instance.translate( 'setup_legal_license', ), @@ -138,7 +140,9 @@ class _SetupLegalScreenState extends State { var prefs = await SharedPreferences.getInstance(); await prefs.setBool('setupFinished', true); await navigator.pushNamedAndRemoveUntil( - Routes.walletList, (_) => false); + Routes.walletList, + (_) => false, + ); }, ), const SizedBox( diff --git a/lib/screens/wallet/address_selector.dart b/lib/screens/wallet/address_selector.dart index 3a6edad7..35a13a19 100644 --- a/lib/screens/wallet/address_selector.dart +++ b/lib/screens/wallet/address_selector.dart @@ -116,6 +116,7 @@ class _AddressSelectorScreenState extends State { onWillPop: _onWillPop, child: Scaffold( appBar: AppBar( + centerTitle: true, leading: IconButton( icon: const Icon(Icons.arrow_back_rounded), tooltip: 'Back', diff --git a/lib/screens/wallet/import_paper_wallet.dart b/lib/screens/wallet/import_paper_wallet.dart index 3828294d..e2ef4339 100644 --- a/lib/screens/wallet/import_paper_wallet.dart +++ b/lib/screens/wallet/import_paper_wallet.dart @@ -108,7 +108,7 @@ class _ImportPaperWalletScreenState extends State { void validatePubKey(String pubKey) { String newKey; - if (Address.validateAddress(pubKey, _activeCoin.networkType)) { + if (validateAddress(pubKey, _activeCoin.networkType)) { newKey = pubKey; moveStep(2); } else { @@ -243,14 +243,16 @@ class _ImportPaperWalletScreenState extends State { //pop message Navigator.of(context).pop(); //pop again to close import screen - ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text( - AppLocalizations.instance - .translate('paperwallet_success'), - textAlign: TextAlign.center, + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + AppLocalizations.instance + .translate('paperwallet_success'), + textAlign: TextAlign.center, + ), + duration: const Duration(seconds: 5), ), - duration: const Duration(seconds: 5), - )); + ); Navigator.of(context).pop(); } catch (e) { LoggerWrapper.logError( @@ -307,6 +309,7 @@ class _ImportPaperWalletScreenState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( + centerTitle: true, title: Text( AppLocalizations.instance.translate('wallet_pop_menu_paperwallet'), ), @@ -325,9 +328,10 @@ class _ImportPaperWalletScreenState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - AppLocalizations.instance - .translate('paperwallet_step_1'), - style: Theme.of(context).textTheme.headline6), + AppLocalizations.instance + .translate('paperwallet_step_1'), + style: Theme.of(context).textTheme.headline6, + ), PeerButton( action: () => handlePress(1), text: AppLocalizations.instance.translate( @@ -344,9 +348,10 @@ class _ImportPaperWalletScreenState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - AppLocalizations.instance - .translate('paperwallet_step_2'), - style: Theme.of(context).textTheme.headline6), + AppLocalizations.instance + .translate('paperwallet_step_2'), + style: Theme.of(context).textTheme.headline6, + ), PeerButton( action: () => handlePress(2), text: AppLocalizations.instance @@ -386,9 +391,10 @@ class _ImportPaperWalletScreenState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - AppLocalizations.instance - .translate('paperwallet_step_4'), - style: Theme.of(context).textTheme.headline6), + AppLocalizations.instance + .translate('paperwallet_step_4'), + style: Theme.of(context).textTheme.headline6, + ), PeerButton( small: true, action: () => handlePress(4), diff --git a/lib/screens/wallet/import_wif.dart b/lib/screens/wallet/import_wif.dart index e8d54246..1d943893 100644 --- a/lib/screens/wallet/import_wif.dart +++ b/lib/screens/wallet/import_wif.dart @@ -101,9 +101,8 @@ class _ImportWifScreenState extends State { Future triggerConfirmMessage(BuildContext ctx, String privKey) async { final scaffoldMessenger = ScaffoldMessenger.of(ctx); - final publicAddress = - Wallet.fromWIF(privKey, _activeCoin.networkType).address ?? - ''; //TODO won't return a bech32 addr + final publicAddress = Wallet.fromWIF(privKey, _activeCoin.networkType) + .address; //TODO won't return a bech32 addr //check if that address is already in the list final walletAddresses = @@ -114,13 +113,15 @@ class _ImportWifScreenState extends State { if (specificAddressResult.isNotEmpty) { //we have that address already - scaffoldMessenger.showSnackBar(SnackBar( - content: Text( - AppLocalizations.instance.translate('import_wif_error_snack'), - textAlign: TextAlign.center, + scaffoldMessenger.showSnackBar( + SnackBar( + content: Text( + AppLocalizations.instance.translate('import_wif_error_snack'), + textAlign: TextAlign.center, + ), + duration: const Duration(seconds: 3), ), - duration: const Duration(seconds: 3), - )); + ); } else { await showDialog( context: ctx, @@ -166,6 +167,7 @@ class _ImportWifScreenState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( + centerTitle: true, title: Text( AppLocalizations.instance.translate('wallet_pop_menu_wif'), ), diff --git a/lib/screens/wallet/transaction_confirmation.dart b/lib/screens/wallet/transaction_confirmation.dart index c2396331..a28af48f 100644 --- a/lib/screens/wallet/transaction_confirmation.dart +++ b/lib/screens/wallet/transaction_confirmation.dart @@ -90,6 +90,7 @@ class _TransactionConfirmationScreenState return Scaffold( appBar: AppBar( + centerTitle: true, title: Text( AppLocalizations.instance.translate('send_confirm_transaction'), ), @@ -235,7 +236,8 @@ class _TransactionConfirmationScreenState AppLocalizations.instance .translate('send_op_return'), style: const TextStyle( - fontWeight: FontWeight.bold), + fontWeight: FontWeight.bold, + ), ), SelectableText(buildResult.opReturn) ], @@ -259,7 +261,10 @@ class _TransactionConfirmationScreenState children: [ _firstPress == false ? SizedBox( - width: MediaQuery.of(context).size.width / 2, + width: MediaQuery.of(context).size.width > + 1200 + ? MediaQuery.of(context).size.width / 3 + : MediaQuery.of(context).size.width / 2, child: const LoadingIndicator(), ) : PeerButton( @@ -298,7 +303,8 @@ class _TransactionConfirmationScreenState } //update balance await activeWallets.updateWalletBalance( - arguments.coinIdentifier); + arguments.coinIdentifier, + ); //pop message navigator.pop(); //navigate back to tx list diff --git a/lib/screens/wallet/transaction_details.dart b/lib/screens/wallet/transaction_details.dart index f015af05..330f9211 100644 --- a/lib/screens/wallet/transaction_details.dart +++ b/lib/screens/wallet/transaction_details.dart @@ -28,9 +28,11 @@ class TransactionDetails extends StatelessWidget { return Scaffold( appBar: AppBar( - title: Text( - AppLocalizations.instance.translate('transaction_details'), - )), + centerTitle: true, + title: Text( + AppLocalizations.instance.translate('transaction_details'), + ), + ), body: Align( child: PeerContainer( noSpacers: true, diff --git a/lib/screens/wallet/wallet_home.dart b/lib/screens/wallet/wallet_home.dart index 5832585d..b005cc84 100644 --- a/lib/screens/wallet/wallet_home.dart +++ b/lib/screens/wallet/wallet_home.dart @@ -158,7 +158,9 @@ class _WalletHomeState extends State //subscribe to newly created addresses _connectionProvider!.subscribeToScriptHashes( await _activeWallets.getWalletScriptHashes( - _wallet.name, _unusedAddress), + _wallet.name, + _unusedAddress, + ), ); } } @@ -171,11 +173,13 @@ class _WalletHomeState extends State ); _latestBlock = _connectionProvider!.latestBlock; - var unconfirmedTx = _walletTransactions.where((element) => - element.confirmations < 6 && - element.confirmations != -1 && - element.timestamp != -1 || - element.timestamp == null); + var unconfirmedTx = _walletTransactions.where( + (element) => + element.confirmations < 6 && + element.confirmations != -1 && + element.timestamp != -1 || + element.timestamp == null, + ); for (var element in unconfirmedTx) { LoggerWrapper.logInfo( 'WalletHome', @@ -196,8 +200,9 @@ class _WalletHomeState extends State } void rebroadCastUnsendTx() { - var nonBroadcastedTx = _walletTransactions.where((element) => - element.broadCasted == false && element.confirmations == 0); + var nonBroadcastedTx = _walletTransactions.where( + (element) => element.broadCasted == false && element.confirmations == 0, + ); for (var element in nonBroadcastedTx) { _connectionProvider!.broadcastTransaction( element.broadcastHex, @@ -226,22 +231,26 @@ class _WalletHomeState extends State await showDialog( context: context, builder: (_) => AlertDialog( - title: Text(AppLocalizations.instance - .translate('wallet_value_alert_title')), - content: Text(AppLocalizations.instance - .translate('wallet_value_alert_content')), + title: Text( + AppLocalizations.instance.translate('wallet_value_alert_title'), + ), + content: Text( + AppLocalizations.instance.translate('wallet_value_alert_content'), + ), actions: [ TextButton.icon( - label: Text(AppLocalizations.instance.translate('not_again')), - icon: const Icon(Icons.cancel), - onPressed: () async { - final navigator = Navigator.of(context); - await prefs.setBool('highValueNotice', true); - navigator.pop(); - }), + label: Text(AppLocalizations.instance.translate('not_again')), + icon: const Icon(Icons.cancel), + onPressed: () async { + final navigator = Navigator.of(context); + await prefs.setBool('highValueNotice', true); + navigator.pop(); + }, + ), TextButton.icon( label: Text( - AppLocalizations.instance.translate('jail_dialog_button')), + AppLocalizations.instance.translate('jail_dialog_button'), + ), icon: const Icon(Icons.check), onPressed: () => Navigator.of(context).pop(), ), @@ -283,7 +292,13 @@ class _WalletHomeState extends State break; case 'signing': Navigator.of(context).pushNamed( - Routes.walletSigning, + Routes.walletMessageSigning, + arguments: _wallet.name, + ); + break; + case 'verification': + Navigator.of(context).pushNamed( + Routes.walletMessageVerification, arguments: _wallet.name, ); break; @@ -299,8 +314,10 @@ class _WalletHomeState extends State ), actions: [ TextButton.icon( - label: Text(AppLocalizations.instance - .translate('server_settings_alert_cancel')), + label: Text( + AppLocalizations.instance + .translate('server_settings_alert_cancel'), + ), icon: const Icon(Icons.cancel), onPressed: () { Navigator.of(context).pop(); @@ -403,6 +420,19 @@ class _WalletHomeState extends State ), ), ), + PopupMenuItem( + value: 'verification', + child: ListTile( + leading: Icon( + Icons.fact_check, + color: Theme.of(context).colorScheme.secondary, + ), + title: Text( + AppLocalizations.instance + .translate('wallet_pop_menu_verification'), + ), + ), + ), ]; }, ) @@ -496,10 +526,9 @@ class _WalletHomeState extends State return Scaffold( bottomNavigationBar: _calcBottomNavBar(context), appBar: AppBar( + centerTitle: true, elevation: 1, - title: Center( - child: Text(_wallet.title), - ), + title: Text(_wallet.title), actions: _calcPopupMenuItems(context), ), body: _initial diff --git a/lib/screens/wallet/wallet_import_scan.dart b/lib/screens/wallet/wallet_import_scan.dart index 186e86e3..23100d24 100644 --- a/lib/screens/wallet/wallet_import_scan.dart +++ b/lib/screens/wallet/wallet_import_scan.dart @@ -1,5 +1,6 @@ import 'dart:async'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:peercoin/providers/app_settings.dart'; import 'package:provider/provider.dart'; @@ -38,11 +39,10 @@ class _WalletImportScanScreenState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Center( - child: Text( - AppLocalizations.instance.translate( - 'wallet_scan_appBar_title', - ), + centerTitle: true, + title: Text( + AppLocalizations.instance.translate( + 'wallet_scan_appBar_title', ), ), ), @@ -54,7 +54,7 @@ class _WalletImportScanScreenState extends State { Text( AppLocalizations.instance.translate('wallet_scan_notice'), ), - if (_backgroundNotificationsAvailable == false) + if (_backgroundNotificationsAvailable == false && !kIsWeb) Column( mainAxisAlignment: MainAxisAlignment.center, children: [ diff --git a/lib/screens/wallet/wallet_signing.dart b/lib/screens/wallet/wallet_sign_message.dart similarity index 87% rename from lib/screens/wallet/wallet_signing.dart rename to lib/screens/wallet/wallet_sign_message.dart index 122a65e3..1ca38197 100644 --- a/lib/screens/wallet/wallet_signing.dart +++ b/lib/screens/wallet/wallet_sign_message.dart @@ -16,14 +16,16 @@ import '../../widgets/buttons.dart'; import '../../widgets/double_tab_to_clipboard.dart'; import '../../widgets/service_container.dart'; -class WalletSigningScreen extends StatefulWidget { - const WalletSigningScreen({Key? key}) : super(key: key); +class WalletMessageSigningScreen extends StatefulWidget { + const WalletMessageSigningScreen({Key? key}) : super(key: key); @override - State createState() => _WalletSigningScreenState(); + State createState() => + _WalletMessageSigningScreenState(); } -class _WalletSigningScreenState extends State { +class _WalletMessageSigningScreenState + extends State { late String _walletName; late ActiveWallets _activeWallets; bool _initial = true; @@ -79,8 +81,11 @@ class _WalletSigningScreenState extends State { } Future _handleSign() async { - LoggerWrapper.logInfo('WalletSigning', 'handleSign', - 'signing message with $_signingAddress on $_walletName, message: ${_messageInputController.text}'); + LoggerWrapper.logInfo( + 'WalletSigning', + 'handleSign', + 'signing message with $_signingAddress on $_walletName, message: ${_messageInputController.text}', + ); try { var wif = await _activeWallets.getWif( @@ -98,7 +103,10 @@ class _WalletSigningScreenState extends State { }); LoggerWrapper.logInfo( - 'WalletSigning', 'handleSign', 'signature produced $_signature'); + 'WalletSigning', + 'handleSign', + 'signature produced $_signature', + ); } catch (e) { LoggerWrapper.logError('WalletSigning', 'handleSign', e.toString()); } @@ -116,21 +124,27 @@ class _WalletSigningScreenState extends State { ), actions: [ TextButton.icon( - label: Text(AppLocalizations.instance - .translate('server_settings_alert_cancel')), - icon: const Icon(Icons.cancel), - onPressed: () { - Navigator.of(context).pop(false); - }), + label: Text( + AppLocalizations.instance + .translate('server_settings_alert_cancel'), + ), + icon: const Icon(Icons.cancel), + onPressed: () { + Navigator.of(context).pop(false); + }, + ), TextButton.icon( label: Text(AppLocalizations.instance.translate('sign_reset_button')), icon: const Icon(Icons.check), onPressed: () async { LoggerWrapper.logInfo( - 'WalletSigning', '_performReset', 'reset performed'); + 'WalletSigning', + '_performReset', + 'reset performed', + ); await Navigator.of(ctx).pushNamedAndRemoveUntil( - Routes.walletSigning, + Routes.walletMessageSigning, (route) { if (route.settings.name == '/wallet-home') { return true; @@ -150,6 +164,7 @@ class _WalletSigningScreenState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( + centerTitle: true, title: Text( AppLocalizations.instance.translate('wallet_pop_menu_signing'), ), @@ -178,8 +193,10 @@ class _WalletSigningScreenState extends State { Padding( padding: const EdgeInsets.symmetric(vertical: 20), child: _signingAddress == '' - ? Text(AppLocalizations.instance - .translate('sign_step_1_description')) + ? Text( + AppLocalizations.instance + .translate('sign_step_1_description'), + ) : DoubleTabToClipboard( clipBoardData: _signingAddress, child: SelectableText(_signingAddress), @@ -206,9 +223,9 @@ class _WalletSigningScreenState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - AppLocalizations.instance - .translate('sign_step_2'), - style: Theme.of(context).textTheme.headline6), + AppLocalizations.instance.translate('sign_step_2'), + style: Theme.of(context).textTheme.headline6, + ), ], ), TextFormField( @@ -220,7 +237,8 @@ class _WalletSigningScreenState extends State { minLines: 5, maxLines: 5, onChanged: (_) => setState( - () {}), //to activate sign button on key stroke + () {}, + ), //to activate sign button on key stroke decoration: InputDecoration( suffixIcon: IconButton( onPressed: () async { diff --git a/lib/screens/wallet/wallet_verify_message.dart b/lib/screens/wallet/wallet_verify_message.dart new file mode 100644 index 00000000..f07d7435 --- /dev/null +++ b/lib/screens/wallet/wallet_verify_message.dart @@ -0,0 +1,317 @@ +import 'dart:convert'; + +import 'package:coinslib/coinslib.dart'; +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; + +import '../../models/available_coins.dart'; +import '../../models/coin.dart'; +import '../../tools/app_localizations.dart'; +import '../../tools/logger_wrapper.dart'; +import '../../widgets/buttons.dart'; +import '../../widgets/service_container.dart'; + +class WaleltMessagesVerificationScreen extends StatefulWidget { + const WaleltMessagesVerificationScreen({Key? key}) : super(key: key); + + @override + State createState() => + _WaleltMessagesVerificationScreenState(); +} + +class _WaleltMessagesVerificationScreenState + extends State { + late String _walletName; + bool _initial = true; + bool _verificationPerformed = false; + bool _verificationResult = false; + late Coin _activeCoin; + final _formKey = GlobalKey(); + final TextEditingController _signatureInputController = + TextEditingController(); + final TextEditingController _addressInputController = TextEditingController(); + final TextEditingController _messageInputController = TextEditingController(); + + @override + void didChangeDependencies() { + if (_initial == true) { + _walletName = ModalRoute.of(context)!.settings.arguments as String; + _activeCoin = AvailableCoins.getSpecificCoin(_walletName); + setState(() { + _initial = false; + }); + } + super.didChangeDependencies(); + } + + Future _handleVerification() async { + final message = _messageInputController.text; + final address = _addressInputController.text; + final signature = _signatureInputController.text; + + _formKey.currentState!.save(); + if (_formKey.currentState!.validate() == false) { + setState(() { + _verificationResult = false; + }); + } + + LoggerWrapper.logInfo( + 'WalletVerification', + 'handleVerification', + 'verifiying message: $message, signature $signature, address $address', + ); + + try { + final verificationResult = verifySignedMessageForAddress( + address: address, + message: message, + signature: base64.decode(signature), + network: _activeCoin.networkType, + ); + + setState(() { + _verificationPerformed = true; + _verificationResult = verificationResult; + }); + + LoggerWrapper.logInfo( + 'WalletSigning', + 'handleSign', + 'signature valid: $verificationResult', + ); + } catch (e) { + setState(() { + _verificationPerformed = true; + _verificationResult = false; + }); + LoggerWrapper.logError( + 'WalletVerification', + 'handleVerification', + e.toString(), + ); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + centerTitle: true, + title: Text( + AppLocalizations.instance.translate('wallet_pop_menu_verification'), + ), + actions: [ + IconButton( + key: const Key('verifyRestart'), + icon: const Icon(Icons.restart_alt), + onPressed: () { + _messageInputController.text = ''; + _addressInputController.text = ''; + _signatureInputController.text = ''; + setState(() { + _verificationPerformed = false; + _verificationResult = false; + }); + }, + ) + ], + ), + body: Column( + children: [ + Expanded( + child: SingleChildScrollView( + child: Align( + child: PeerContainer( + child: Form( + key: _formKey, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + AppLocalizations.instance + .translate('verify_step_1'), + style: Theme.of(context).textTheme.headline6, + ), + ], + ), + TextFormField( + textInputAction: TextInputAction.done, + key: const Key('verifyAddressInput'), + controller: _addressInputController, + autocorrect: false, + validator: (value) { + if (value!.isEmpty) { + return AppLocalizations.instance.translate( + 'send_enter_address', + ); + } + var sanitized = value.trim(); + if (validateAddress( + sanitized, + _activeCoin.networkType, + ) == + false) { + return AppLocalizations.instance.translate( + 'send_invalid_address', + ); + } + return null; + }, + decoration: InputDecoration( + suffixIcon: IconButton( + onPressed: () async { + var data = + await Clipboard.getData('text/plain'); + _addressInputController.text = + data!.text!.trim(); + }, + icon: Icon( + Icons.paste_rounded, + color: Theme.of(context).primaryColor, + ), + ), + labelText: AppLocalizations.instance + .translate('verify_input_label_address'), + ), + ), + const SizedBox( + height: 20, + ), + ], + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + AppLocalizations.instance + .translate('sign_step_2'), + style: Theme.of(context).textTheme.headline6, + ), + ], + ), + TextFormField( + textInputAction: TextInputAction.done, + key: const Key('verifyMessageInput'), + controller: _messageInputController, + autocorrect: false, + minLines: 5, + maxLines: 5, + validator: (value) { + if (value!.isEmpty) { + return AppLocalizations.instance.translate( + 'verify_enter_message', + ); + } + return null; + }, + decoration: InputDecoration( + suffixIcon: IconButton( + onPressed: () async { + var data = + await Clipboard.getData('text/plain'); + _messageInputController.text = + data!.text!.trim(); + }, + icon: Icon( + Icons.paste_rounded, + color: Theme.of(context).primaryColor, + ), + ), + labelText: AppLocalizations.instance + .translate('verify_input_label_message'), + ), + ), + const SizedBox( + height: 20, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + AppLocalizations.instance + .translate('verify_step_3'), + style: Theme.of(context).textTheme.headline6, + ), + ], + ), + TextFormField( + textInputAction: TextInputAction.done, + key: const Key('verifSignatureInput'), + controller: _signatureInputController, + autocorrect: false, + minLines: 5, + maxLines: 5, + validator: (value) { + if (value!.isEmpty) { + return AppLocalizations.instance.translate( + 'verify_enter_signature', + ); + } + return null; + }, + decoration: InputDecoration( + suffixIcon: IconButton( + onPressed: () async { + var data = + await Clipboard.getData('text/plain'); + _signatureInputController.text = + data!.text!.trim(); + }, + icon: Icon( + Icons.paste_rounded, + color: Theme.of(context).primaryColor, + ), + ), + labelText: AppLocalizations.instance + .translate('verify_input_label_signature'), + ), + ), + const SizedBox( + height: 10, + ), + if (kIsWeb) + const SizedBox( + height: 20, + ), + if (_verificationPerformed) + Padding( + padding: const EdgeInsets.symmetric(vertical: 10), + child: Text( + AppLocalizations.instance.translate( + _verificationResult == true + ? 'verify_success' + : 'verify_fail', + ), + style: TextStyle( + color: _verificationResult == true + ? Theme.of(context).primaryColor + : Theme.of(context).errorColor, + ), + ), + ), + PeerButton( + action: () => _handleVerification(), + text: AppLocalizations.instance.translate( + 'verify_step_3_button', + ), + small: true, + ), + ], + ), + ), + ), + ), + ), + ) + ], + ), + ); + } +} diff --git a/lib/tools/app_localizations.dart b/lib/tools/app_localizations.dart index 6d0ac5b0..3e91fbb8 100644 --- a/lib/tools/app_localizations.dart +++ b/lib/tools/app_localizations.dart @@ -79,7 +79,8 @@ class AppLocalizations { } Future> _loadLocalizedStrings( - Locale localeToBeLoaded) async { + Locale localeToBeLoaded, + ) async { String jsonString; var localizedStrings = {}; diff --git a/lib/tools/app_routes.dart b/lib/tools/app_routes.dart index 83926c89..75d716d4 100644 --- a/lib/tools/app_routes.dart +++ b/lib/tools/app_routes.dart @@ -1,5 +1,6 @@ import 'package:flutter/widgets.dart'; import 'package:peercoin/screens/wallet/transaction_confirmation.dart'; +import 'package:peercoin/screens/wallet/wallet_verify_message.dart'; import '../screens/settings/app_settings_notifications.dart'; import '../screens/settings/app_settings_screen.dart'; @@ -22,7 +23,7 @@ import '../screens/wallet/transaction_details.dart'; import '../screens/wallet/wallet_home.dart'; import '../screens/wallet/wallet_import_scan.dart'; import '../screens/wallet/wallet_list.dart'; -import '../screens/wallet/wallet_signing.dart'; +import '../screens/wallet/wallet_sign_message.dart'; class Routes { // Route name constants @@ -38,7 +39,9 @@ class Routes { static const String setupLegal = '/setup-legal'; static const String transaction = '/tx-detail'; static const String walletHome = '/wallet-home'; - static const String walletSigning = '/wallet-signing'; + static const String walletMessageSigning = '/wallet-message-signing'; + static const String walletMessageVerification = + '/wallet-message-verification'; static const String walletImportScan = '/wallet-import-scan'; static const String importPaperWallet = '/import-paperwallet'; static const String importWif = '/import-wif'; @@ -91,8 +94,12 @@ class Routes { widget: WalletImportScanScreen(), routeType: RouteTypes.requiresArguments, ), - Routes.walletSigning: (context) => const RouterMaster( - widget: WalletSigningScreen(), + Routes.walletMessageSigning: (context) => const RouterMaster( + widget: WalletMessageSigningScreen(), + routeType: RouteTypes.requiresArguments, + ), + Routes.walletMessageVerification: (context) => const RouterMaster( + widget: WaleltMessagesVerificationScreen(), routeType: RouteTypes.requiresArguments, ), Routes.addressSelector: (context) => const RouterMaster( diff --git a/lib/tools/app_themes.dart b/lib/tools/app_themes.dart index 62e3bc69..dd59a0b0 100644 --- a/lib/tools/app_themes.dart +++ b/lib/tools/app_themes.dart @@ -56,16 +56,18 @@ class MyTheme { ), elevatedButtonTheme: ElevatedButtonThemeData( style: ElevatedButton.styleFrom( - foregroundColor: LightColors.green, - backgroundColor: LightColors.green, - textStyle: TextStyle( - color: LightColors.white, - )), + foregroundColor: LightColors.green, + backgroundColor: LightColors.green, + textStyle: TextStyle( + color: LightColors.white, + ), + ), ), textButtonTheme: TextButtonThemeData( - style: TextButton.styleFrom( - foregroundColor: LightColors.green, - )), + style: TextButton.styleFrom( + foregroundColor: LightColors.green, + ), + ), ), ThemeMode.dark: ThemeData.dark().copyWith( colorScheme: ColorScheme( @@ -114,7 +116,10 @@ class MyTheme { bodyText1: TextStyle(color: DarkColors.white), bodyText2: TextStyle(color: DarkColors.white), button: TextStyle( - letterSpacing: 1.4, fontSize: 16, color: DarkColors.white), + letterSpacing: 1.4, + fontSize: 16, + color: DarkColors.white, + ), ), dialogTheme: DialogTheme( shape: RoundedRectangleBorder( @@ -138,9 +143,10 @@ class MyTheme { ), ), textButtonTheme: TextButtonThemeData( - style: TextButton.styleFrom( - foregroundColor: DarkColors.black, - )), + style: TextButton.styleFrom( + foregroundColor: DarkColors.black, + ), + ), inputDecorationTheme: InputDecorationTheme( labelStyle: TextStyle(color: DarkColors.white), focusedBorder: UnderlineInputBorder( diff --git a/lib/tools/auth.dart b/lib/tools/auth.dart index 72c7b90e..d340543d 100644 --- a/lib/tools/auth.dart +++ b/lib/tools/auth.dart @@ -16,7 +16,9 @@ class Auth { static int failedAuthAttempts = 0; static Future executeCallback( - BuildContext context, Function? callback) async { + BuildContext context, + Function? callback, + ) async { //reset unsuccesful login and attempt counter final encryptedBox = context.read(); final navigator = Navigator.of(context); @@ -71,36 +73,41 @@ class Auth { } static Future spawnJail( - BuildContext context, bool jailedFromHome) async { + BuildContext context, + bool jailedFromHome, + ) async { final navigator = Navigator.of(context); await showDialog( - context: context, - builder: (BuildContext context) { - return AlertDialog( - title: Text( - AppLocalizations.instance.translate('jail_dialog_title'), - textAlign: TextAlign.center, - ), - actions: [ - TextButton( - onPressed: () { - Navigator.of(context).pop(); - }, - child: Text( - AppLocalizations.instance.translate('jail_dialog_button'), - ), + context: context, + builder: (BuildContext context) { + return AlertDialog( + title: Text( + AppLocalizations.instance.translate('jail_dialog_title'), + textAlign: TextAlign.center, + ), + actions: [ + TextButton( + onPressed: () { + Navigator.of(context).pop(); + }, + child: Text( + AppLocalizations.instance.translate('jail_dialog_button'), ), - ], - ); - }); + ), + ], + ); + }, + ); await navigator.pushReplacementNamed( Routes.authJail, arguments: jailedFromHome, ); } - static Future localAuth(BuildContext context, - [Function? callback]) async { + static Future localAuth( + BuildContext context, [ + Function? callback, + ]) async { final localAuth = LocalAuthentication(); Future executeCB() async => executeCallback(context, callback); diff --git a/lib/tools/background_sync.dart b/lib/tools/background_sync.dart index b559911c..b5d04458 100644 --- a/lib/tools/background_sync.dart +++ b/lib/tools/background_sync.dart @@ -46,8 +46,10 @@ class BackgroundSync { BackgroundFetch.finish(taskId); } - static Future init( - {required int notificationInterval, bool needsStart = false}) async { + static Future init({ + required int notificationInterval, + bool needsStart = false, + }) async { Future initPlatformState() async { var status = await BackgroundFetch.configure( BackgroundFetchConfig( @@ -62,16 +64,25 @@ class BackgroundSync { requiredNetworkType: NetworkType.ANY, ), (String taskId) async { LoggerWrapper.logInfo( - 'BackgroundSync', 'init', 'Event received $taskId'); + 'BackgroundSync', + 'init', + 'Event received $taskId', + ); await BackgroundSync.executeSync(); BackgroundFetch.finish(taskId); }, (String taskId) async { LoggerWrapper.logInfo( - 'BackgroundSync', 'init', 'TASK TIMEOUT taskId: $taskId'); + 'BackgroundSync', + 'init', + 'TASK TIMEOUT taskId: $taskId', + ); BackgroundFetch.finish(taskId); }); LoggerWrapper.logInfo( - 'BackgroundSync', 'init', 'configure success: $status'); + 'BackgroundSync', + 'init', + 'configure success: $status', + ); } await initPlatformState(); @@ -142,7 +153,8 @@ class BackgroundSync { for (var walletAddress in wallet.addresses) { var utxoRes = utxos.firstWhereOrNull( - (element) => element.address == walletAddress.address); + (element) => element.address == walletAddress.address, + ); if (walletAddress.isOurs == true) { if (walletAddress.isWatched == true || diff --git a/lib/tools/price_ticker.dart b/lib/tools/price_ticker.dart index cb73963f..5e639526 100644 --- a/lib/tools/price_ticker.dart +++ b/lib/tools/price_ticker.dart @@ -76,7 +76,10 @@ class PriceTicker { static void checkUpdate(AppSettings settings) async { LoggerWrapper.logInfo( - 'PriceTicker', 'checkUpdate', 'checking price update'); + 'PriceTicker', + 'checkUpdate', + 'checking price update', + ); //check if last update was longer than an hour ago final oneHourAgo = (DateTime.now()) .subtract(const Duration(minutes: Duration.minutesPerHour)); diff --git a/lib/tools/session_checker.dart b/lib/tools/session_checker.dart index 85b258bc..78b4410c 100644 --- a/lib/tools/session_checker.dart +++ b/lib/tools/session_checker.dart @@ -7,8 +7,8 @@ import 'logger_wrapper.dart'; Future checkSessionExpired() async { if (kIsWeb) { final sessionExpiresAt = int.parse( - await const FlutterSecureStorage().read(key: 'sessionExpiresAt') ?? - '0'); + await const FlutterSecureStorage().read(key: 'sessionExpiresAt') ?? '0', + ); if (DateTime.now() .isAfter(DateTime.fromMillisecondsSinceEpoch(sessionExpiresAt))) { //session has expired diff --git a/lib/widgets/buttons.dart b/lib/widgets/buttons.dart index a7de55ae..14591a6d 100644 --- a/lib/widgets/buttons.dart +++ b/lib/widgets/buttons.dart @@ -76,9 +76,10 @@ class PeerButtonBorder extends StatelessWidget { child: Text( text, style: TextStyle( - letterSpacing: 1.4, - fontSize: 16, - color: Theme.of(context).primaryColor), + letterSpacing: 1.4, + fontSize: 16, + color: Theme.of(context).primaryColor, + ), ), ), ); diff --git a/lib/widgets/double_tab_to_clipboard.dart b/lib/widgets/double_tab_to_clipboard.dart index 0cb079ef..3993b557 100644 --- a/lib/widgets/double_tab_to_clipboard.dart +++ b/lib/widgets/double_tab_to_clipboard.dart @@ -14,13 +14,15 @@ class DoubleTabToClipboard extends StatelessWidget { }) : super(key: key); static void tapEvent(BuildContext context, String clipBoardData) { - ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text( - AppLocalizations.instance.translate('snack_copied'), - textAlign: TextAlign.center, + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + AppLocalizations.instance.translate('snack_copied'), + textAlign: TextAlign.center, + ), + duration: const Duration(seconds: 1), ), - duration: const Duration(seconds: 1), - )); + ); Clipboard.setData( ClipboardData(text: clipBoardData), ); diff --git a/lib/widgets/expanded_section.dart b/lib/widgets/expanded_section.dart index d4389480..d936763a 100644 --- a/lib/widgets/expanded_section.dart +++ b/lib/widgets/expanded_section.dart @@ -25,7 +25,9 @@ class _ExpandedSectionState extends State ///Setting up the animation void prepareAnimations() { expandController = AnimationController( - vsync: this, duration: const Duration(milliseconds: 500)); + vsync: this, + duration: const Duration(milliseconds: 500), + ); animation = CurvedAnimation( parent: expandController, curve: Curves.fastOutSlowIn, diff --git a/lib/widgets/logout_dialog_dummy.dart b/lib/widgets/logout_dialog_dummy.dart index 56eac488..5354681f 100644 --- a/lib/widgets/logout_dialog_dummy.dart +++ b/lib/widgets/logout_dialog_dummy.dart @@ -15,6 +15,4 @@ class LogoutDialog extends StatelessWidget { Widget build(BuildContext context) { return Container(); } -} - -/* This dummy is required to prevent build time errors since dart:html is not availble on native devices */ \ No newline at end of file +} /* This dummy is required to prevent build time errors since dart:html is not availble on native devices */ diff --git a/lib/widgets/settings/settings_auth.dart b/lib/widgets/settings/settings_auth.dart index 8f756c05..6b91a7ed 100644 --- a/lib/widgets/settings/settings_auth.dart +++ b/lib/widgets/settings/settings_auth.dart @@ -15,10 +15,14 @@ class SettingsAuth extends StatelessWidget { final Function _saveSnack; final Map _authenticationOptions; - const SettingsAuth(this._biometricsAllowed, this._biometricsAvailable, - this._settings, this._saveSnack, this._authenticationOptions, - {Key? key}) - : super(key: key); + const SettingsAuth( + this._biometricsAllowed, + this._biometricsAvailable, + this._settings, + this._saveSnack, + this._authenticationOptions, { + Key? key, + }) : super(key: key); void changePIN(BuildContext context, bool biometricsAllowed) async { await Auth.requireAuth( @@ -43,14 +47,16 @@ class SettingsAuth extends StatelessWidget { final scaffoldMessenger = ScaffoldMessenger.of(context); final navigator = Navigator.of(context); await context.read().setPassCode(matchedText); - scaffoldMessenger.showSnackBar(SnackBar( - content: Text( - AppLocalizations.instance - .translate('authenticate_change_pin_success'), - textAlign: TextAlign.center, + scaffoldMessenger.showSnackBar( + SnackBar( + content: Text( + AppLocalizations.instance + .translate('authenticate_change_pin_success'), + textAlign: TextAlign.center, + ), + duration: const Duration(seconds: 2), ), - duration: const Duration(seconds: 2), - )); + ); navigator.pop(); }, ), @@ -62,62 +68,68 @@ class SettingsAuth extends StatelessWidget { return Column( children: [ SwitchListTile( - title: Text( - AppLocalizations.instance.translate('app_settings_biometrics'), - ), - value: _biometricsAllowed, - onChanged: (newState) { - if (_biometricsAvailable == false) { - ScaffoldMessenger.of(context).showSnackBar(SnackBar( + title: Text( + AppLocalizations.instance.translate('app_settings_biometrics'), + ), + value: _biometricsAllowed, + onChanged: (newState) { + if (_biometricsAvailable == false) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( content: Text( AppLocalizations.instance .translate('setup_pin_no_biometrics'), textAlign: TextAlign.center, ), duration: const Duration(seconds: 5), - )); - } else { - _settings.setBiometricsAllowed(newState); - _saveSnack(context); - } - }), - SwitchListTile( - title: Text( - AppLocalizations.instance.translate('app_settings_walletList'), - ), - value: _authenticationOptions['walletList']!, - onChanged: (newState) { - _settings.setAuthenticationOptions('walletList', newState); + ), + ); + } else { + _settings.setBiometricsAllowed(newState); _saveSnack(context); - }), + } + }, + ), SwitchListTile( - title: Text( - AppLocalizations.instance.translate('app_settings_walletHome'), - ), - value: _authenticationOptions['walletHome']!, - onChanged: (newState) { - _settings.setAuthenticationOptions('walletHome', newState); - _saveSnack(context); - }), + title: Text( + AppLocalizations.instance.translate('app_settings_walletList'), + ), + value: _authenticationOptions['walletList']!, + onChanged: (newState) { + _settings.setAuthenticationOptions('walletList', newState); + _saveSnack(context); + }, + ), SwitchListTile( - title: Text( - AppLocalizations.instance - .translate('app_settings_sendTransaction'), - ), - value: _authenticationOptions['sendTransaction']!, - onChanged: (newState) { - _settings.setAuthenticationOptions('sendTransaction', newState); - _saveSnack(context); - }), + title: Text( + AppLocalizations.instance.translate('app_settings_walletHome'), + ), + value: _authenticationOptions['walletHome']!, + onChanged: (newState) { + _settings.setAuthenticationOptions('walletHome', newState); + _saveSnack(context); + }, + ), SwitchListTile( - title: Text( - AppLocalizations.instance.translate('app_settings_newWallet'), - ), - value: _authenticationOptions['newWallet']!, - onChanged: (newState) { - _settings.setAuthenticationOptions('newWallet', newState); - _saveSnack(context); - }), + title: Text( + AppLocalizations.instance.translate('app_settings_sendTransaction'), + ), + value: _authenticationOptions['sendTransaction']!, + onChanged: (newState) { + _settings.setAuthenticationOptions('sendTransaction', newState); + _saveSnack(context); + }, + ), + SwitchListTile( + title: Text( + AppLocalizations.instance.translate('app_settings_newWallet'), + ), + value: _authenticationOptions['newWallet']!, + onChanged: (newState) { + _settings.setAuthenticationOptions('newWallet', newState); + _saveSnack(context); + }, + ), PeerButton( action: () => changePIN(context, _settings.biometricsAllowed), text: AppLocalizations.instance.translate('app_settings_changeCode'), diff --git a/lib/widgets/settings/settings_price_ticker.dart b/lib/widgets/settings/settings_price_ticker.dart index 1c041a8e..d77b8ccc 100644 --- a/lib/widgets/settings/settings_price_ticker.dart +++ b/lib/widgets/settings/settings_price_ticker.dart @@ -130,9 +130,10 @@ class _SettingsPriceTickerState extends State { '1 PPC = ${PriceTicker.renderPrice(1, currency, "PPC", widget._settings.exchangeRates).toStringAsFixed(6)} $currency', ), leading: Radio( - value: currency, - groupValue: widget._settings.selectedCurrency, - onChanged: (dynamic _) => saveCurrency(ctx, currency)), + value: currency, + groupValue: widget._settings.selectedCurrency, + onChanged: (dynamic _) => saveCurrency(ctx, currency), + ), trailing: Text( PriceTicker.currencySymbols[currency] ?? '', style: const TextStyle(fontWeight: FontWeight.w500), diff --git a/lib/widgets/wallet/addresses_tab.dart b/lib/widgets/wallet/addresses_tab.dart index 57068e6d..d4ed2fa5 100644 --- a/lib/widgets/wallet/addresses_tab.dart +++ b/lib/widgets/wallet/addresses_tab.dart @@ -164,7 +164,9 @@ class _AddressTabState extends State { } Future _addressEditDialog( - BuildContext context, WalletAddress address) async { + BuildContext context, + WalletAddress address, + ) async { var textFieldController = TextEditingController(); textFieldController.text = address.addressBookName ?? ''; return showDialog( @@ -179,21 +181,27 @@ class _AddressTabState extends State { controller: textFieldController, maxLength: 32, decoration: InputDecoration( - hintText: AppLocalizations.instance - .translate('addressbook_edit_dialog_input')), + hintText: AppLocalizations.instance + .translate('addressbook_edit_dialog_input'), + ), ), actions: [ TextButton( onPressed: () { Navigator.pop(context); }, - child: Text(AppLocalizations.instance - .translate('server_settings_alert_cancel')), + child: Text( + AppLocalizations.instance + .translate('server_settings_alert_cancel'), + ), ), TextButton( onPressed: () { - context.read().updateLabel(widget.walletName, - address.address, textFieldController.text); + context.read().updateLabel( + widget.walletName, + address.address, + textFieldController.text, + ); Navigator.pop(context); }, child: Text( @@ -207,7 +215,9 @@ class _AddressTabState extends State { } Future _showAddressExportDialog( - BuildContext context, WalletAddress address) async { + BuildContext context, + WalletAddress address, + ) async { return showDialog( context: context, builder: (context) { @@ -302,8 +312,11 @@ class _AddressTabState extends State { if (!_listenedAddresses.containsKey(addr.address) && addr.isWatched == true) { //subscribe - LoggerWrapper.logInfo('AddressTab', '_toggleWatched', - 'watched and subscribed ${addr.address}'); + LoggerWrapper.logInfo( + 'AddressTab', + '_toggleWatched', + 'watched and subscribed ${addr.address}', + ); _connection.subscribeToScriptHashes( await _activeWallets.getWalletScriptHashes( widget.walletName, @@ -358,8 +371,10 @@ class _AddressTabState extends State { .translate('send_enter_address'); } var sanitized = value.trim(); - if (Address.validateAddress( - sanitized, _availableCoin.networkType) == + if (validateAddress( + sanitized, + _availableCoin.networkType, + ) == false) { return AppLocalizations.instance .translate('send_invalid_address'); @@ -387,8 +402,10 @@ class _AddressTabState extends State { onPressed: () { Navigator.pop(context); }, - child: Text(AppLocalizations.instance - .translate('server_settings_alert_cancel')), + child: Text( + AppLocalizations.instance + .translate('server_settings_alert_cancel'), + ), ), TextButton( onPressed: () { @@ -495,14 +512,16 @@ class _AddressTabState extends State { content: Text(addr.address), actions: [ TextButton.icon( - label: Text( - AppLocalizations.instance.translate( - 'server_settings_alert_cancel'), + label: Text( + AppLocalizations.instance.translate( + 'server_settings_alert_cancel', ), - icon: const Icon(Icons.cancel), - onPressed: () { - Navigator.of(context).pop(); - }), + ), + icon: const Icon(Icons.cancel), + onPressed: () { + Navigator.of(context).pop(); + }, + ), TextButton.icon( label: Text( AppLocalizations.instance @@ -785,28 +804,29 @@ class _AddressTabState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ ChoiceChip( - backgroundColor: Theme.of(context).backgroundColor, - selectedColor: Theme.of(context).shadowColor, - visualDensity: const VisualDensity( - horizontal: 0.0, - vertical: -4, - ), - label: AutoSizeText( - AppLocalizations.instance - .translate('addressbook_hide_used'), - textAlign: TextAlign.center, - minFontSize: 10, - style: TextStyle( - color: Theme.of(context).colorScheme.secondary, - ), + backgroundColor: Theme.of(context).backgroundColor, + selectedColor: Theme.of(context).shadowColor, + visualDensity: const VisualDensity( + horizontal: 0.0, + vertical: -4, + ), + label: AutoSizeText( + AppLocalizations.instance + .translate('addressbook_hide_used'), + textAlign: TextAlign.center, + minFontSize: 10, + style: TextStyle( + color: Theme.of(context).colorScheme.secondary, ), - selected: _showUsed, - onSelected: (_) { - setState(() { - _showUsed = _; - }); - applyFilter(); - }), + ), + selected: _showUsed, + onSelected: (_) { + setState(() { + _showUsed = _; + }); + applyFilter(); + }, + ), Padding( padding: const EdgeInsets.all(kIsWeb ? 8.0 : 0), child: ChoiceChip( @@ -903,8 +923,9 @@ class _AddressTabState extends State { //to set border radius to button borderRadius: BorderRadius.circular(10), side: BorderSide( - width: 2, - color: Theme.of(context).primaryColor), + width: 2, + color: Theme.of(context).primaryColor, + ), ), elevation: 0, ), diff --git a/lib/widgets/wallet/new_wallet.dart b/lib/widgets/wallet/new_wallet.dart index 576b949a..c1336f8c 100644 --- a/lib/widgets/wallet/new_wallet.dart +++ b/lib/widgets/wallet/new_wallet.dart @@ -50,15 +50,17 @@ class _NewWalletDialogState extends State { navigator.pop(); } } catch (e) { - ScaffoldMessenger.of(context).showSnackBar(SnackBar( - content: Text( - _coin == '' - ? AppLocalizations.instance.translate('select_coin') - : AppLocalizations.instance.translate('add_coin_failed'), - textAlign: TextAlign.center, + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text( + _coin == '' + ? AppLocalizations.instance.translate('select_coin') + : AppLocalizations.instance.translate('add_coin_failed'), + textAlign: TextAlign.center, + ), + duration: const Duration(seconds: 2), ), - duration: const Duration(seconds: 2), - )); + ); } } @@ -99,27 +101,32 @@ class _NewWalletDialogState extends State { if (actualAvailableWallets.isNotEmpty) { for (var wallet in actualAvailableWallets) { - list.add(SimpleDialogOption( - onPressed: () { - _coin = wallet; - addWallet(); - }, - child: ListTile( - leading: CircleAvatar( - backgroundColor: Colors.white, - child: Image.asset( + list.add( + SimpleDialogOption( + onPressed: () { + _coin = wallet; + addWallet(); + }, + child: ListTile( + leading: CircleAvatar( + backgroundColor: Colors.white, + child: Image.asset( AvailableCoins.getSpecificCoin(availableCoins[wallet]!.name) .iconPath, - width: 16), + width: 16, + ), + ), + title: Text(availableCoins[wallet]!.displayName), ), - title: Text(availableCoins[wallet]!.displayName), ), - )); + ); } } else { - list.add(Center( - child: Text(AppLocalizations.instance.translate('no_new_wallet')), - )); + list.add( + Center( + child: Text(AppLocalizations.instance.translate('no_new_wallet')), + ), + ); } return SimpleDialog( diff --git a/lib/widgets/wallet/receive_tab.dart b/lib/widgets/wallet/receive_tab.dart index 947ea6c5..f5061106 100644 --- a/lib/widgets/wallet/receive_tab.dart +++ b/lib/widgets/wallet/receive_tab.dart @@ -219,10 +219,12 @@ class _ReceiveTabState extends State { autocorrect: false, inputFormatters: [ FilteringTextInputFormatter.allow( - getValidator(_availableCoin.fractions)), + getValidator(_availableCoin.fractions), + ), ], keyboardType: const TextInputType.numberWithOptions( - decimal: true), + decimal: true, + ), decoration: InputDecoration( icon: Icon( Icons.money, @@ -255,9 +257,10 @@ class _ReceiveTabState extends State { action: () async { if (labelController.text != '') { context.read().updateLabel( - widget.wallet.name, - widget.unusedAddress, - labelController.text); + widget.wallet.name, + widget.unusedAddress, + labelController.text, + ); } await ShareWrapper.share( context: context, @@ -297,8 +300,9 @@ class _ReceiveTabState extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ PeerServiceTitle( - title: AppLocalizations.instance - .translate('receive_obtain')), + title: AppLocalizations.instance + .translate('receive_obtain'), + ), const SizedBox(height: 20), Text( AppLocalizations.instance diff --git a/lib/widgets/wallet/send_tab.dart b/lib/widgets/wallet/send_tab.dart index 15c0bebf..f4757258 100644 --- a/lib/widgets/wallet/send_tab.dart +++ b/lib/widgets/wallet/send_tab.dart @@ -188,8 +188,10 @@ class _SendTabState extends State { .translate('send_address_already_exists'); } var sanitized = value.trim(); - if (Address.validateAddress( - sanitized, _availableCoin.networkType) == + if (validateAddress( + sanitized, + _availableCoin.networkType, + ) == false) { return AppLocalizations.instance .translate('send_invalid_address'); @@ -576,8 +578,10 @@ class _SendTabState extends State { } if (txValueInSatoshis < _availableCoin.minimumTxValue && _opReturnController.text.isEmpty) { - return AppLocalizations.instance.translate('send_amount_below_minimum', - {'amount': '${_availableCoin.minimumTxValue / _decimalProduct}'}); + return AppLocalizations.instance.translate( + 'send_amount_below_minimum', + {'amount': '${_availableCoin.minimumTxValue / _decimalProduct}'}, + ); } if (txValueInSatoshis == widget.wallet.balance && widget.wallet.balance == _availableCoin.minimumTxValue) { @@ -755,6 +759,12 @@ class _SendTabState extends State { fiatCode: _appSettings.selectedCurrency, ), ); + + //temporarily disable persisting labels for more than 100 addresses on web + if (kIsWeb && buildResult.recipients.length > 100) { + return; + } //TODO fix underlying performance issue with Hive on web that makes this necessary + //persist labels _labelControllerList.asMap().forEach( (index, controller) { @@ -797,7 +807,6 @@ class _SendTabState extends State { _labelControllerList[0].text = label; _amountControllerList[0].text = amount.toString(); _requestedAmountInCoinsList[0] = amount; - setState(() {}); } else { _addNewAddress( address: address, diff --git a/lib/widgets/wallet/send_tab_navigator.dart b/lib/widgets/wallet/send_tab_navigator.dart index ba4f5219..b0ae0369 100644 --- a/lib/widgets/wallet/send_tab_navigator.dart +++ b/lib/widgets/wallet/send_tab_navigator.dart @@ -18,19 +18,21 @@ class SendTabNavigator extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ currentIndex - 1 > 0 - ? Row(children: [ - IconButton( - onPressed: () => raiseNewindex(1), - icon: const Icon( - Icons.fast_rewind_rounded, - size: 15, + ? Row( + children: [ + IconButton( + onPressed: () => raiseNewindex(1), + icon: const Icon( + Icons.fast_rewind_rounded, + size: 15, + ), + ), + IconButton( + onPressed: () => raiseNewindex(currentIndex - 1), + icon: const Icon(Icons.arrow_left_rounded), ), - ), - IconButton( - onPressed: () => raiseNewindex(currentIndex - 1), - icon: const Icon(Icons.arrow_left_rounded), - ), - ]) + ], + ) : const SizedBox( width: 96, ), diff --git a/lib/widgets/wallet/transactions_list.dart b/lib/widgets/wallet/transactions_list.dart index 2f4b9291..d1bbe82b 100644 --- a/lib/widgets/wallet/transactions_list.dart +++ b/lib/widgets/wallet/transactions_list.dart @@ -278,12 +278,13 @@ class _TransactionListState extends State { height: 30, decoration: BoxDecoration( gradient: LinearGradient( - colors: [ - Theme.of(context).bottomAppBarColor, - Theme.of(context).primaryColor, - ], - begin: Alignment.topCenter, - end: Alignment.bottomCenter), + colors: [ + Theme.of(context).bottomAppBarColor, + Theme.of(context).primaryColor, + ], + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + ), ), ), Container( @@ -299,7 +300,9 @@ class _TransactionListState extends State { selectedColor: Theme.of(context).shadowColor, visualDensity: const VisualDensity( - horizontal: 0.0, vertical: -4), + horizontal: 0.0, + vertical: -4, + ), label: Text( AppLocalizations.instance .translate('transactions_in'), @@ -318,15 +321,18 @@ class _TransactionListState extends State { selectedColor: Theme.of(context).shadowColor, visualDensity: const VisualDensity( - horizontal: 0.0, vertical: -4), + horizontal: 0.0, + vertical: -4, + ), label: Text( - AppLocalizations.instance - .translate('transactions_all'), - style: TextStyle( - color: Theme.of(context) - .colorScheme - .secondary, - )), + AppLocalizations.instance + .translate('transactions_all'), + style: TextStyle( + color: Theme.of(context) + .colorScheme + .secondary, + ), + ), selected: _filterChoice == 'all', onSelected: (_) => _handleSelect('all'), ), @@ -336,15 +342,18 @@ class _TransactionListState extends State { selectedColor: Theme.of(context).shadowColor, visualDensity: const VisualDensity( - horizontal: 0.0, vertical: -4), + horizontal: 0.0, + vertical: -4, + ), label: Text( - AppLocalizations.instance - .translate('transactions_out'), - style: TextStyle( - color: Theme.of(context) - .colorScheme - .secondary, - )), + AppLocalizations.instance + .translate('transactions_out'), + style: TextStyle( + color: Theme.of(context) + .colorScheme + .secondary, + ), + ), selected: _filterChoice == 'out', onSelected: (_) => _handleSelect('out'), ), diff --git a/lib/widgets/wallet/wallet_home_qr.dart b/lib/widgets/wallet/wallet_home_qr.dart index 9ff2a43a..5383df85 100644 --- a/lib/widgets/wallet/wallet_home_qr.dart +++ b/lib/widgets/wallet/wallet_home_qr.dart @@ -10,8 +10,11 @@ class WalletHomeQr extends StatelessWidget { final String _unusedAddress; const WalletHomeQr(this._unusedAddress, {Key? key}) : super(key: key); - static void showQrDialog(BuildContext context, String address, - [bool hideShareButton = false]) { + static void showQrDialog( + BuildContext context, + String address, [ + bool hideShareButton = false, + ]) { showDialog( context: context, builder: (BuildContext context) { diff --git a/pubspec.lock b/pubspec.lock index e75dad53..a92f5be6 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -203,7 +203,7 @@ packages: name: coinslib url: "https://pub.dartlang.org" source: hosted - version: "3.1.4" + version: "3.1.7" collection: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 26286c22..1cd947ea 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: peercoin description: A new Peercoin wallet. -version: 1.1.1+122 +version: 1.1.2+123 environment: sdk: '>=2.12.0 <3.0.0' @@ -16,7 +16,7 @@ dependencies: web_socket_channel: ^2.1.0 crypto: ^3.0.1 bip39: ^1.0.6 - coinslib: ^3.1.4 + coinslib: ^3.1.7 hive: ^2.2.3 hive_flutter: ^1.1.0 hive_generator: ^1.1.0 diff --git a/test/transaction_building_test.dart b/test/transaction_building_test.dart index 3a9214f6..25532caf 100644 --- a/test/transaction_building_test.dart +++ b/test/transaction_building_test.dart @@ -70,7 +70,8 @@ void main() async { () async { await wallet.generateUnusedAddress(walletName); assert( - wallet.getUnusedAddress == 'PXDR4KZn2WdTocNx1GPJXR96PfzZBvWqKQ'); + wallet.getUnusedAddress == 'PXDR4KZn2WdTocNx1GPJXR96PfzZBvWqKQ', + ); }, ); @@ -178,7 +179,8 @@ void main() async { () async { await wallet.generateUnusedAddress(testnetWalletName); assert( - wallet.getUnusedAddress == 'n49CCQFuncaXbtBoNm39gSP9dvRP2eFFSw'); + wallet.getUnusedAddress == 'n49CCQFuncaXbtBoNm39gSP9dvRP2eFFSw', + ); }, ); diff --git a/test_driver/key_imported.dart b/test_driver/key_imported.dart index 089891f3..09f5deb6 100644 --- a/test_driver/key_imported.dart +++ b/test_driver/key_imported.dart @@ -1,6 +1,5 @@ import 'package:flutter_driver/flutter_driver.dart'; import 'package:test/test.dart'; -// import 'dart:io'; void main() { const seedPhrase = @@ -109,7 +108,8 @@ void main() { timeout: const Timeout.factor(2), ); - test('Signing, tap into sign message, select address and sign message', + test( + 'Message signing, tap into sign message, select address and sign message', () async { await driver.tap(find.byTooltip('Show menu')); await driver.runUnsynchronized( @@ -132,6 +132,63 @@ void main() { ); }); + test('Message verification, tap into verify message and verify', + () async { + await driver.tap(find.pageBack()); + await driver.tap(find.byTooltip('Show menu')); + await driver.runUnsynchronized( + () async { + await driver.tap(find.text('Verify Messages')); + }, + ); + await driver.tap(find.byValueKey('verifyAddressInput')); + await driver.enterText( + 'mfdKHgpEzyMVHugqzttiEbhNvWjSGPy5fb', + ); + await driver.tap(find.byValueKey('verifyMessageInput')); + await driver.enterText( + 'sign message', + ); + await driver.tap(find.byValueKey('verifSignatureInput')); + await driver.enterText( + 'Hyd9cBXuT9CMgE8sK7YNeLQF1qaLxjQCMQv3pwKXCGdpOurIceSiuHfgXCnEtAhExq6iP/+vMn6sYC5OfpSBhRc=', + ); + await driver.tap(find.text('Verify')); + await driver.waitFor( + find.text( + 'Message verified.', + ), + ); + + //restart + await driver.tap(find.byValueKey('verifyRestart')); + expect(await driver.getText(find.byValueKey('verifyAddressInput')), ""); + expect(await driver.getText(find.byValueKey('verifyMessageInput')), ""); + expect( + await driver.getText(find.byValueKey('verifSignatureInput')), + "", + ); + + await driver.tap(find.byValueKey('verifyAddressInput')); + await driver.enterText( + 'mfdKHgpEzyMVHugqzttiEbhNvWjSGPy5fb', + ); + await driver.tap(find.byValueKey('verifyMessageInput')); + await driver.enterText( + 'sign message', + ); + await driver.tap(find.byValueKey('verifSignatureInput')); + await driver.enterText( + 'yd9cBXuT9CMgE8sK7YNeLQF1qaLxjQCMQv3pwKXCGdpOurIceSiuHfgXCnEtAhExq6iP/+vMn6sYC5OfpSBhRc=', + ); + await driver.tap(find.text('Verify')); + await driver.waitFor( + find.text( + 'Message could not be verified.', + ), + ); + }); + test('Settings, test lock into auth jail', () async { await driver.tap(find.pageBack()); await driver.runUnsynchronized( diff --git a/test_driver/key_new.dart b/test_driver/key_new.dart index eecf7e25..ecde4fa6 100644 --- a/test_driver/key_new.dart +++ b/test_driver/key_new.dart @@ -111,11 +111,16 @@ void main() { ); //main net server for testnet wallet await driver.tap(find.byValueKey('saveServerButton')); expect( - await driver.getText(find.text( - 'Genesis hash does not match.\nThis server does not support this coin.')), - 'Genesis hash does not match.\nThis server does not support this coin.'); + await driver.getText( + find.text( + 'Genesis hash does not match.\nThis server does not support this coin.', + ), + ), + 'Genesis hash does not match.\nThis server does not support this coin.', + ); await driver.enterText( - 'ssl://testnet-electrum.peercoinexplorer.net:50008'); //main net server for testnet wallet + 'ssl://testnet-electrum.peercoinexplorer.net:50008', + ); //main net server for testnet wallet await driver.tap(find.byValueKey('saveServerButton')); await driver.tap(find.pageBack()); await driver.tap(find.byTooltip('Show menu')); @@ -125,9 +130,11 @@ void main() { }, ); expect( - await driver.getText(find - .text('ssl://testnet-electrum.peercoinexplorer.net:50008')), - 'ssl://testnet-electrum.peercoinexplorer.net:50008'); + await driver.getText( + find.text('ssl://testnet-electrum.peercoinexplorer.net:50008'), + ), + 'ssl://testnet-electrum.peercoinexplorer.net:50008', + ); }, retry: 2, timeout: const Timeout.factor(2), diff --git a/windows/.gitignore b/windows/.gitignore deleted file mode 100644 index d492d0d9..00000000 --- a/windows/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ -flutter/ephemeral/ - -# Visual Studio user-specific files. -*.suo -*.user -*.userosscache -*.sln.docstates - -# Visual Studio build-related files. -x64/ -x86/ - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!*.[Cc]ache/ diff --git a/windows/CMakeLists.txt b/windows/CMakeLists.txt deleted file mode 100644 index 6c321b69..00000000 --- a/windows/CMakeLists.txt +++ /dev/null @@ -1,95 +0,0 @@ -cmake_minimum_required(VERSION 3.14) -project(peercoin_flutter LANGUAGES CXX) - -set(BINARY_NAME "peercoin_flutter") - -cmake_policy(SET CMP0063 NEW) - -set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") - -# Configure build options. -get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) -if(IS_MULTICONFIG) - set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" - CACHE STRING "" FORCE) -else() - if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) - set(CMAKE_BUILD_TYPE "Debug" CACHE - STRING "Flutter build mode" FORCE) - set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS - "Debug" "Profile" "Release") - endif() -endif() - -set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") -set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") -set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") -set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") - -# Use Unicode for all projects. -add_definitions(-DUNICODE -D_UNICODE) - -# Compilation settings that should be applied to most targets. -function(APPLY_STANDARD_SETTINGS TARGET) - target_compile_features(${TARGET} PUBLIC cxx_std_17) - target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") - target_compile_options(${TARGET} PRIVATE /EHsc) - target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") - target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") -endfunction() - -set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") - -# Flutter library and tool build rules. -add_subdirectory(${FLUTTER_MANAGED_DIR}) - -# Application build -add_subdirectory("runner") - -# Generated plugin build rules, which manage building the plugins and adding -# them to the application. -include(flutter/generated_plugins.cmake) - - -# === Installation === -# Support files are copied into place next to the executable, so that it can -# run in place. This is done instead of making a separate bundle (as on Linux) -# so that building and running from within Visual Studio will work. -set(BUILD_BUNDLE_DIR "$") -# Make the "install" step default, as it's required to run. -set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) -if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) - set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) -endif() - -set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") -set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") - -install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" - COMPONENT Runtime) - -install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" - COMPONENT Runtime) - -install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" - COMPONENT Runtime) - -if(PLUGIN_BUNDLED_LIBRARIES) - install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" - DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" - COMPONENT Runtime) -endif() - -# Fully re-copy the assets directory on each build to avoid having stale files -# from a previous install. -set(FLUTTER_ASSET_DIR_NAME "flutter_assets") -install(CODE " - file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") - " COMPONENT Runtime) -install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" - DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) - -# Install the AOT library on non-Debug builds only. -install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" - CONFIGURATIONS Profile;Release - COMPONENT Runtime) diff --git a/windows/flutter/CMakeLists.txt b/windows/flutter/CMakeLists.txt deleted file mode 100644 index b2e4bd8d..00000000 --- a/windows/flutter/CMakeLists.txt +++ /dev/null @@ -1,103 +0,0 @@ -cmake_minimum_required(VERSION 3.14) - -set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") - -# Configuration provided via flutter tool. -include(${EPHEMERAL_DIR}/generated_config.cmake) - -# TODO: Move the rest of this into files in ephemeral. See -# https://github.com/flutter/flutter/issues/57146. -set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") - -# === Flutter Library === -set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") - -# Published to parent scope for install step. -set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) -set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) -set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) -set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) - -list(APPEND FLUTTER_LIBRARY_HEADERS - "flutter_export.h" - "flutter_windows.h" - "flutter_messenger.h" - "flutter_plugin_registrar.h" - "flutter_texture_registrar.h" -) -list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") -add_library(flutter INTERFACE) -target_include_directories(flutter INTERFACE - "${EPHEMERAL_DIR}" -) -target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") -add_dependencies(flutter flutter_assemble) - -# === Wrapper === -list(APPEND CPP_WRAPPER_SOURCES_CORE - "core_implementations.cc" - "standard_codec.cc" -) -list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") -list(APPEND CPP_WRAPPER_SOURCES_PLUGIN - "plugin_registrar.cc" -) -list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") -list(APPEND CPP_WRAPPER_SOURCES_APP - "flutter_engine.cc" - "flutter_view_controller.cc" -) -list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") - -# Wrapper sources needed for a plugin. -add_library(flutter_wrapper_plugin STATIC - ${CPP_WRAPPER_SOURCES_CORE} - ${CPP_WRAPPER_SOURCES_PLUGIN} -) -apply_standard_settings(flutter_wrapper_plugin) -set_target_properties(flutter_wrapper_plugin PROPERTIES - POSITION_INDEPENDENT_CODE ON) -set_target_properties(flutter_wrapper_plugin PROPERTIES - CXX_VISIBILITY_PRESET hidden) -target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) -target_include_directories(flutter_wrapper_plugin PUBLIC - "${WRAPPER_ROOT}/include" -) -add_dependencies(flutter_wrapper_plugin flutter_assemble) - -# Wrapper sources needed for the runner. -add_library(flutter_wrapper_app STATIC - ${CPP_WRAPPER_SOURCES_CORE} - ${CPP_WRAPPER_SOURCES_APP} -) -apply_standard_settings(flutter_wrapper_app) -target_link_libraries(flutter_wrapper_app PUBLIC flutter) -target_include_directories(flutter_wrapper_app PUBLIC - "${WRAPPER_ROOT}/include" -) -add_dependencies(flutter_wrapper_app flutter_assemble) - -# === Flutter tool backend === -# _phony_ is a non-existent file to force this command to run every time, -# since currently there's no way to get a full input/output list from the -# flutter tool. -set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") -set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) -add_custom_command( - OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} - ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} - ${CPP_WRAPPER_SOURCES_APP} - ${PHONY_OUTPUT} - COMMAND ${CMAKE_COMMAND} -E env - ${FLUTTER_TOOL_ENVIRONMENT} - "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" - windows-x64 $ - VERBATIM -) -add_custom_target(flutter_assemble DEPENDS - "${FLUTTER_LIBRARY}" - ${FLUTTER_LIBRARY_HEADERS} - ${CPP_WRAPPER_SOURCES_CORE} - ${CPP_WRAPPER_SOURCES_PLUGIN} - ${CPP_WRAPPER_SOURCES_APP} -) diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc deleted file mode 100644 index d75b6b1c..00000000 --- a/windows/flutter/generated_plugin_registrant.cc +++ /dev/null @@ -1,26 +0,0 @@ -// -// Generated file. Do not edit. -// - -// clang-format off - -#include "generated_plugin_registrant.h" - -#include -#include -#include -#include -#include - -void RegisterPlugins(flutter::PluginRegistry* registry) { - ConnectivityPlusWindowsPluginRegisterWithRegistrar( - registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin")); - FlutterSecureStorageWindowsPluginRegisterWithRegistrar( - registry->GetRegistrarForPlugin("FlutterSecureStorageWindowsPlugin")); - LocalAuthPluginRegisterWithRegistrar( - registry->GetRegistrarForPlugin("LocalAuthPlugin")); - SharePlusWindowsPluginCApiRegisterWithRegistrar( - registry->GetRegistrarForPlugin("SharePlusWindowsPluginCApi")); - UrlLauncherWindowsRegisterWithRegistrar( - registry->GetRegistrarForPlugin("UrlLauncherWindows")); -} diff --git a/windows/flutter/generated_plugin_registrant.h b/windows/flutter/generated_plugin_registrant.h deleted file mode 100644 index dc139d85..00000000 --- a/windows/flutter/generated_plugin_registrant.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// Generated file. Do not edit. -// - -// clang-format off - -#ifndef GENERATED_PLUGIN_REGISTRANT_ -#define GENERATED_PLUGIN_REGISTRANT_ - -#include - -// Registers Flutter plugins. -void RegisterPlugins(flutter::PluginRegistry* registry); - -#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake deleted file mode 100644 index fe042685..00000000 --- a/windows/flutter/generated_plugins.cmake +++ /dev/null @@ -1,28 +0,0 @@ -# -# Generated file, do not edit. -# - -list(APPEND FLUTTER_PLUGIN_LIST - connectivity_plus - flutter_secure_storage_windows - local_auth_windows - share_plus - url_launcher_windows -) - -list(APPEND FLUTTER_FFI_PLUGIN_LIST -) - -set(PLUGIN_BUNDLED_LIBRARIES) - -foreach(plugin ${FLUTTER_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) - target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) - list(APPEND PLUGIN_BUNDLED_LIBRARIES $) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) -endforeach(plugin) - -foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) - add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) - list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) -endforeach(ffi_plugin) diff --git a/windows/runner/CMakeLists.txt b/windows/runner/CMakeLists.txt deleted file mode 100644 index de2d8916..00000000 --- a/windows/runner/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 3.14) -project(runner LANGUAGES CXX) - -add_executable(${BINARY_NAME} WIN32 - "flutter_window.cpp" - "main.cpp" - "utils.cpp" - "win32_window.cpp" - "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" - "Runner.rc" - "runner.exe.manifest" -) -apply_standard_settings(${BINARY_NAME}) -target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") -target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) -target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") -add_dependencies(${BINARY_NAME} flutter_assemble) diff --git a/windows/runner/Runner.rc b/windows/runner/Runner.rc deleted file mode 100644 index 78ef206d..00000000 --- a/windows/runner/Runner.rc +++ /dev/null @@ -1,121 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#pragma code_page(65001) -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (United States) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_APP_ICON ICON "resources\\app_icon.ico" - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -#ifdef FLUTTER_BUILD_NUMBER -#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER -#else -#define VERSION_AS_NUMBER 1,0,0 -#endif - -#ifdef FLUTTER_BUILD_NAME -#define VERSION_AS_STRING #FLUTTER_BUILD_NAME -#else -#define VERSION_AS_STRING "1.0.0" -#endif - -VS_VERSION_INFO VERSIONINFO - FILEVERSION VERSION_AS_NUMBER - PRODUCTVERSION VERSION_AS_NUMBER - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -#ifdef _DEBUG - FILEFLAGS VS_FF_DEBUG -#else - FILEFLAGS 0x0L -#endif - FILEOS VOS__WINDOWS32 - FILETYPE VFT_APP - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904e4" - BEGIN - VALUE "CompanyName", "com.coinerella" "\0" - VALUE "FileDescription", "peercoin_flutter" "\0" - VALUE "FileVersion", VERSION_AS_STRING "\0" - VALUE "InternalName", "peercoin_flutter" "\0" - VALUE "LegalCopyright", "Copyright (C) 2022 com.coinerella. All rights reserved." "\0" - VALUE "OriginalFilename", "peercoin_flutter.exe" "\0" - VALUE "ProductName", "peercoin_flutter" "\0" - VALUE "ProductVersion", VERSION_AS_STRING "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1252 - END -END - -#endif // English (United States) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED diff --git a/windows/runner/flutter_window.cpp b/windows/runner/flutter_window.cpp deleted file mode 100644 index b43b9095..00000000 --- a/windows/runner/flutter_window.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include "flutter_window.h" - -#include - -#include "flutter/generated_plugin_registrant.h" - -FlutterWindow::FlutterWindow(const flutter::DartProject& project) - : project_(project) {} - -FlutterWindow::~FlutterWindow() {} - -bool FlutterWindow::OnCreate() { - if (!Win32Window::OnCreate()) { - return false; - } - - RECT frame = GetClientArea(); - - // The size here must match the window dimensions to avoid unnecessary surface - // creation / destruction in the startup path. - flutter_controller_ = std::make_unique( - frame.right - frame.left, frame.bottom - frame.top, project_); - // Ensure that basic setup of the controller was successful. - if (!flutter_controller_->engine() || !flutter_controller_->view()) { - return false; - } - RegisterPlugins(flutter_controller_->engine()); - SetChildContent(flutter_controller_->view()->GetNativeWindow()); - return true; -} - -void FlutterWindow::OnDestroy() { - if (flutter_controller_) { - flutter_controller_ = nullptr; - } - - Win32Window::OnDestroy(); -} - -LRESULT -FlutterWindow::MessageHandler(HWND hwnd, UINT const message, - WPARAM const wparam, - LPARAM const lparam) noexcept { - // Give Flutter, including plugins, an opportunity to handle window messages. - if (flutter_controller_) { - std::optional result = - flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, - lparam); - if (result) { - return *result; - } - } - - switch (message) { - case WM_FONTCHANGE: - flutter_controller_->engine()->ReloadSystemFonts(); - break; - } - - return Win32Window::MessageHandler(hwnd, message, wparam, lparam); -} diff --git a/windows/runner/flutter_window.h b/windows/runner/flutter_window.h deleted file mode 100644 index 6da0652f..00000000 --- a/windows/runner/flutter_window.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef RUNNER_FLUTTER_WINDOW_H_ -#define RUNNER_FLUTTER_WINDOW_H_ - -#include -#include - -#include - -#include "win32_window.h" - -// A window that does nothing but host a Flutter view. -class FlutterWindow : public Win32Window { - public: - // Creates a new FlutterWindow hosting a Flutter view running |project|. - explicit FlutterWindow(const flutter::DartProject& project); - virtual ~FlutterWindow(); - - protected: - // Win32Window: - bool OnCreate() override; - void OnDestroy() override; - LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, - LPARAM const lparam) noexcept override; - - private: - // The project to run. - flutter::DartProject project_; - - // The Flutter instance hosted by this window. - std::unique_ptr flutter_controller_; -}; - -#endif // RUNNER_FLUTTER_WINDOW_H_ diff --git a/windows/runner/main.cpp b/windows/runner/main.cpp deleted file mode 100644 index 9fb19451..00000000 --- a/windows/runner/main.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include -#include - -#include "flutter_window.h" -#include "utils.h" - -int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, - _In_ wchar_t *command_line, _In_ int show_command) { - // Attach to console when present (e.g., 'flutter run') or create a - // new console when running with a debugger. - if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { - CreateAndAttachConsole(); - } - - // Initialize COM, so that it is available for use in the library and/or - // plugins. - ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); - - flutter::DartProject project(L"data"); - - std::vector command_line_arguments = - GetCommandLineArguments(); - - project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); - - FlutterWindow window(project); - Win32Window::Point origin(10, 10); - Win32Window::Size size(1280, 720); - if (!window.CreateAndShow(L"peercoin_flutter", origin, size)) { - return EXIT_FAILURE; - } - window.SetQuitOnClose(true); - - ::MSG msg; - while (::GetMessage(&msg, nullptr, 0, 0)) { - ::TranslateMessage(&msg); - ::DispatchMessage(&msg); - } - - ::CoUninitialize(); - return EXIT_SUCCESS; -} diff --git a/windows/runner/resource.h b/windows/runner/resource.h deleted file mode 100644 index 66a65d1e..00000000 --- a/windows/runner/resource.h +++ /dev/null @@ -1,16 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by Runner.rc -// -#define IDI_APP_ICON 101 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 102 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/windows/runner/resources/app_icon.ico b/windows/runner/resources/app_icon.ico deleted file mode 100644 index c04e20caf6370ebb9253ad831cc31de4a9c965f6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 33772 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 diff --git a/windows/runner/runner.exe.manifest b/windows/runner/runner.exe.manifest deleted file mode 100644 index c977c4a4..00000000 --- a/windows/runner/runner.exe.manifest +++ /dev/null @@ -1,20 +0,0 @@ - - - - - PerMonitorV2 - - - - - - - - - - - - - - - diff --git a/windows/runner/utils.cpp b/windows/runner/utils.cpp deleted file mode 100644 index d19bdbbc..00000000 --- a/windows/runner/utils.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include "utils.h" - -#include -#include -#include -#include - -#include - -void CreateAndAttachConsole() { - if (::AllocConsole()) { - FILE *unused; - if (freopen_s(&unused, "CONOUT$", "w", stdout)) { - _dup2(_fileno(stdout), 1); - } - if (freopen_s(&unused, "CONOUT$", "w", stderr)) { - _dup2(_fileno(stdout), 2); - } - std::ios::sync_with_stdio(); - FlutterDesktopResyncOutputStreams(); - } -} - -std::vector GetCommandLineArguments() { - // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. - int argc; - wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); - if (argv == nullptr) { - return std::vector(); - } - - std::vector command_line_arguments; - - // Skip the first argument as it's the binary name. - for (int i = 1; i < argc; i++) { - command_line_arguments.push_back(Utf8FromUtf16(argv[i])); - } - - ::LocalFree(argv); - - return command_line_arguments; -} - -std::string Utf8FromUtf16(const wchar_t* utf16_string) { - if (utf16_string == nullptr) { - return std::string(); - } - int target_length = ::WideCharToMultiByte( - CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, - -1, nullptr, 0, nullptr, nullptr); - if (target_length == 0) { - return std::string(); - } - std::string utf8_string; - utf8_string.resize(target_length); - int converted_length = ::WideCharToMultiByte( - CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, - -1, utf8_string.data(), - target_length, nullptr, nullptr); - if (converted_length == 0) { - return std::string(); - } - return utf8_string; -} diff --git a/windows/runner/utils.h b/windows/runner/utils.h deleted file mode 100644 index 3879d547..00000000 --- a/windows/runner/utils.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef RUNNER_UTILS_H_ -#define RUNNER_UTILS_H_ - -#include -#include - -// Creates a console for the process, and redirects stdout and stderr to -// it for both the runner and the Flutter library. -void CreateAndAttachConsole(); - -// Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string -// encoded in UTF-8. Returns an empty std::string on failure. -std::string Utf8FromUtf16(const wchar_t* utf16_string); - -// Gets the command line arguments passed in as a std::vector, -// encoded in UTF-8. Returns an empty std::vector on failure. -std::vector GetCommandLineArguments(); - -#endif // RUNNER_UTILS_H_ diff --git a/windows/runner/win32_window.cpp b/windows/runner/win32_window.cpp deleted file mode 100644 index c10f08dc..00000000 --- a/windows/runner/win32_window.cpp +++ /dev/null @@ -1,245 +0,0 @@ -#include "win32_window.h" - -#include - -#include "resource.h" - -namespace { - -constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; - -// The number of Win32Window objects that currently exist. -static int g_active_window_count = 0; - -using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); - -// Scale helper to convert logical scaler values to physical using passed in -// scale factor -int Scale(int source, double scale_factor) { - return static_cast(source * scale_factor); -} - -// Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. -// This API is only needed for PerMonitor V1 awareness mode. -void EnableFullDpiSupportIfAvailable(HWND hwnd) { - HMODULE user32_module = LoadLibraryA("User32.dll"); - if (!user32_module) { - return; - } - auto enable_non_client_dpi_scaling = - reinterpret_cast( - GetProcAddress(user32_module, "EnableNonClientDpiScaling")); - if (enable_non_client_dpi_scaling != nullptr) { - enable_non_client_dpi_scaling(hwnd); - FreeLibrary(user32_module); - } -} - -} // namespace - -// Manages the Win32Window's window class registration. -class WindowClassRegistrar { - public: - ~WindowClassRegistrar() = default; - - // Returns the singleton registar instance. - static WindowClassRegistrar* GetInstance() { - if (!instance_) { - instance_ = new WindowClassRegistrar(); - } - return instance_; - } - - // Returns the name of the window class, registering the class if it hasn't - // previously been registered. - const wchar_t* GetWindowClass(); - - // Unregisters the window class. Should only be called if there are no - // instances of the window. - void UnregisterWindowClass(); - - private: - WindowClassRegistrar() = default; - - static WindowClassRegistrar* instance_; - - bool class_registered_ = false; -}; - -WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; - -const wchar_t* WindowClassRegistrar::GetWindowClass() { - if (!class_registered_) { - WNDCLASS window_class{}; - window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); - window_class.lpszClassName = kWindowClassName; - window_class.style = CS_HREDRAW | CS_VREDRAW; - window_class.cbClsExtra = 0; - window_class.cbWndExtra = 0; - window_class.hInstance = GetModuleHandle(nullptr); - window_class.hIcon = - LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); - window_class.hbrBackground = 0; - window_class.lpszMenuName = nullptr; - window_class.lpfnWndProc = Win32Window::WndProc; - RegisterClass(&window_class); - class_registered_ = true; - } - return kWindowClassName; -} - -void WindowClassRegistrar::UnregisterWindowClass() { - UnregisterClass(kWindowClassName, nullptr); - class_registered_ = false; -} - -Win32Window::Win32Window() { - ++g_active_window_count; -} - -Win32Window::~Win32Window() { - --g_active_window_count; - Destroy(); -} - -bool Win32Window::CreateAndShow(const std::wstring& title, - const Point& origin, - const Size& size) { - Destroy(); - - const wchar_t* window_class = - WindowClassRegistrar::GetInstance()->GetWindowClass(); - - const POINT target_point = {static_cast(origin.x), - static_cast(origin.y)}; - HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); - UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); - double scale_factor = dpi / 96.0; - - HWND window = CreateWindow( - window_class, title.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE, - Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), - Scale(size.width, scale_factor), Scale(size.height, scale_factor), - nullptr, nullptr, GetModuleHandle(nullptr), this); - - if (!window) { - return false; - } - - return OnCreate(); -} - -// static -LRESULT CALLBACK Win32Window::WndProc(HWND const window, - UINT const message, - WPARAM const wparam, - LPARAM const lparam) noexcept { - if (message == WM_NCCREATE) { - auto window_struct = reinterpret_cast(lparam); - SetWindowLongPtr(window, GWLP_USERDATA, - reinterpret_cast(window_struct->lpCreateParams)); - - auto that = static_cast(window_struct->lpCreateParams); - EnableFullDpiSupportIfAvailable(window); - that->window_handle_ = window; - } else if (Win32Window* that = GetThisFromHandle(window)) { - return that->MessageHandler(window, message, wparam, lparam); - } - - return DefWindowProc(window, message, wparam, lparam); -} - -LRESULT -Win32Window::MessageHandler(HWND hwnd, - UINT const message, - WPARAM const wparam, - LPARAM const lparam) noexcept { - switch (message) { - case WM_DESTROY: - window_handle_ = nullptr; - Destroy(); - if (quit_on_close_) { - PostQuitMessage(0); - } - return 0; - - case WM_DPICHANGED: { - auto newRectSize = reinterpret_cast(lparam); - LONG newWidth = newRectSize->right - newRectSize->left; - LONG newHeight = newRectSize->bottom - newRectSize->top; - - SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, - newHeight, SWP_NOZORDER | SWP_NOACTIVATE); - - return 0; - } - case WM_SIZE: { - RECT rect = GetClientArea(); - if (child_content_ != nullptr) { - // Size and position the child window. - MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, - rect.bottom - rect.top, TRUE); - } - return 0; - } - - case WM_ACTIVATE: - if (child_content_ != nullptr) { - SetFocus(child_content_); - } - return 0; - } - - return DefWindowProc(window_handle_, message, wparam, lparam); -} - -void Win32Window::Destroy() { - OnDestroy(); - - if (window_handle_) { - DestroyWindow(window_handle_); - window_handle_ = nullptr; - } - if (g_active_window_count == 0) { - WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); - } -} - -Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { - return reinterpret_cast( - GetWindowLongPtr(window, GWLP_USERDATA)); -} - -void Win32Window::SetChildContent(HWND content) { - child_content_ = content; - SetParent(content, window_handle_); - RECT frame = GetClientArea(); - - MoveWindow(content, frame.left, frame.top, frame.right - frame.left, - frame.bottom - frame.top, true); - - SetFocus(child_content_); -} - -RECT Win32Window::GetClientArea() { - RECT frame; - GetClientRect(window_handle_, &frame); - return frame; -} - -HWND Win32Window::GetHandle() { - return window_handle_; -} - -void Win32Window::SetQuitOnClose(bool quit_on_close) { - quit_on_close_ = quit_on_close; -} - -bool Win32Window::OnCreate() { - // No-op; provided for subclasses. - return true; -} - -void Win32Window::OnDestroy() { - // No-op; provided for subclasses. -} diff --git a/windows/runner/win32_window.h b/windows/runner/win32_window.h deleted file mode 100644 index 17ba4311..00000000 --- a/windows/runner/win32_window.h +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef RUNNER_WIN32_WINDOW_H_ -#define RUNNER_WIN32_WINDOW_H_ - -#include - -#include -#include -#include - -// A class abstraction for a high DPI-aware Win32 Window. Intended to be -// inherited from by classes that wish to specialize with custom -// rendering and input handling -class Win32Window { - public: - struct Point { - unsigned int x; - unsigned int y; - Point(unsigned int x, unsigned int y) : x(x), y(y) {} - }; - - struct Size { - unsigned int width; - unsigned int height; - Size(unsigned int width, unsigned int height) - : width(width), height(height) {} - }; - - Win32Window(); - virtual ~Win32Window(); - - // Creates and shows a win32 window with |title| and position and size using - // |origin| and |size|. New windows are created on the default monitor. Window - // sizes are specified to the OS in physical pixels, hence to ensure a - // consistent size to will treat the width height passed in to this function - // as logical pixels and scale to appropriate for the default monitor. Returns - // true if the window was created successfully. - bool CreateAndShow(const std::wstring& title, - const Point& origin, - const Size& size); - - // Release OS resources associated with window. - void Destroy(); - - // Inserts |content| into the window tree. - void SetChildContent(HWND content); - - // Returns the backing Window handle to enable clients to set icon and other - // window properties. Returns nullptr if the window has been destroyed. - HWND GetHandle(); - - // If true, closing this window will quit the application. - void SetQuitOnClose(bool quit_on_close); - - // Return a RECT representing the bounds of the current client area. - RECT GetClientArea(); - - protected: - // Processes and route salient window messages for mouse handling, - // size change and DPI. Delegates handling of these to member overloads that - // inheriting classes can handle. - virtual LRESULT MessageHandler(HWND window, - UINT const message, - WPARAM const wparam, - LPARAM const lparam) noexcept; - - // Called when CreateAndShow is called, allowing subclass window-related - // setup. Subclasses should return false if setup fails. - virtual bool OnCreate(); - - // Called when Destroy is called. - virtual void OnDestroy(); - - private: - friend class WindowClassRegistrar; - - // OS callback called by message pump. Handles the WM_NCCREATE message which - // is passed when the non-client area is being created and enables automatic - // non-client DPI scaling so that the non-client area automatically - // responsponds to changes in DPI. All other messages are handled by - // MessageHandler. - static LRESULT CALLBACK WndProc(HWND const window, - UINT const message, - WPARAM const wparam, - LPARAM const lparam) noexcept; - - // Retrieves a class instance pointer for |window| - static Win32Window* GetThisFromHandle(HWND const window) noexcept; - - bool quit_on_close_ = false; - - // window handle for top level window. - HWND window_handle_ = nullptr; - - // window handle for hosted content. - HWND child_content_ = nullptr; -}; - -#endif // RUNNER_WIN32_WINDOW_H_