Generic fixes (#1619)

* update fee rates * periodically update fees * minor enhancements * minor enhancements * some improvements add solana node * handle empty hex as null * minor improvement * fix imports * fix app hanging on splash screen * update app versions temporarily disable sign/verify for hardware wallets

Omar Hatem committed Aug 18, 2024 at 03:37 UTC c59d39d42d4a8a27208ea3bad5144781801823a5
23 files changed +89 -92
assets/solana_node_list.yml
+3
@@ -1,4 +1,7 @@
1 -
2 uri: rpc.ankr.com
3 is_default: true
4 + useSSL: true
5 +-
6 + uri: api.mainnet-beta.solana.com:443
7 useSSL: true
\ No newline at end of file
assets/text/Monerocom_Release_Notes.txt
+2 -3
@@ -1,4 +1,3 @@
1 -Monero synchronization improvements
2 -Enhance error handling
3 -UI enhancements
1 +Scan and verify messages
2 +Synchronization enhancements
3 Bug fixes
\ No newline at end of file
assets/text/Release_Notes.txt
+2 -5
@@ -1,6 +1,3 @@
1 -Wallets enhancements
2 -Monero synchronization improvements
3 -Improve wallet backups
4 -Enhance error handling
5 -UI enhancements
1 +Scan and verify messages
2 +Synchronization enhancements
3 Bug fixes
\ No newline at end of file
cw_bitcoin/lib/electrum_wallet.dart
+9 -3
@@ -264,7 +264,8 @@ abstract class ElectrumWalletBase
264 void Function(FlutterErrorDetails)? _onError;
265 Timer? _reconnectTimer;
266 Timer? _autoSaveTimer;
267 - static const int _autoSaveInterval = 30;
267 + Timer? _updateFeeRateTimer;
268 + static const int _autoSaveInterval = 1;
269
270 Future<void> init() async {
271 await walletAddresses.init();
@@ -272,7 +273,7 @@ abstract class ElectrumWalletBase
273 await save();
274
275 _autoSaveTimer =
275 - Timer.periodic(Duration(seconds: _autoSaveInterval), (_) async => await save());
276 + Timer.periodic(Duration(minutes: _autoSaveInterval), (_) async => await save());
277 }
278
279 @action
@@ -425,6 +426,10 @@ abstract class ElectrumWalletBase
426 await updateTransactions();
427 await updateAllUnspents();
428 await updateBalance();
429 + updateFeeRates();
430 +
431 + _updateFeeRateTimer ??=
432 + Timer.periodic(const Duration(minutes: 1), (timer) async => await updateFeeRates());
433
434 if (alwaysScan == true) {
435 _setListeners(walletInfo.restoreHeight);
@@ -1213,6 +1218,7 @@ abstract class ElectrumWalletBase
1218 await electrumClient.close();
1219 } catch (_) {}
1220 _autoSaveTimer?.cancel();
1221 + _updateFeeRateTimer?.cancel();
1222 }
1223
1224 @action
@@ -1371,7 +1377,7 @@ abstract class ElectrumWalletBase
1377
1378 if (confirmations > 0) return false;
1379
1374 - if (transactionHex == null) {
1380 + if (transactionHex == null || transactionHex.isEmpty) {
1381 return false;
1382 }
1383
cw_evm/lib/evm_chain_wallet.dart
+4 -1
@@ -113,6 +113,8 @@ abstract class EVMChainWalletBase
113 int? gasBaseFee = 0;
114 int estimatedGasUnits = 0;
115
116 + Timer? _updateFeesTimer;
117 +
118 bool _isTransactionUpdating;
119
120 // TODO: remove after integrating our own node and having eth_newPendingTransactionFilter
@@ -263,6 +265,7 @@ abstract class EVMChainWalletBase
265 void close() {
266 _client.stop();
267 _transactionsUpdateTimer?.cancel();
268 + _updateFeesTimer?.cancel();
269 }
270
271 @action
@@ -297,7 +300,7 @@ abstract class EVMChainWalletBase
300
301 await _updateEstimatedGasFeeParams();
302
300 - Timer.periodic(const Duration(seconds: 10), (timer) async {
303 + _updateFeesTimer ??= Timer.periodic(const Duration(seconds: 30), (timer) async {
304 await _updateEstimatedGasFeeParams();
305 });
306
cw_monero/lib/monero_wallet_service.dart
+3 -3
@@ -119,7 +119,7 @@ class MoneroWalletService extends WalletService<
119 }
120
121 @override
122 - Future<MoneroWallet> openWallet(String name, String password) async {
122 + Future<MoneroWallet> openWallet(String name, String password, {bool? retryOnFailure}) async {
123 MoneroWallet? wallet;
124 try {
125 final path = await pathForWallet(name: name, type: getType());
@@ -181,12 +181,12 @@ class MoneroWalletService extends WalletService<
181 wallet.onError != null) {
182 wallet.onError!(FlutterErrorDetails(exception: e, stack: s));
183 }
184 - if (invalidPassword) {
184 + if (invalidPassword || retryOnFailure == false) {
185 rethrow;
186 }
187
188 await restoreOrResetWalletFiles(name);
189 - return openWallet(name, password);
189 + return openWallet(name, password, retryOnFailure: false);
190 }
191 }
192
cw_monero/pubspec.lock
+7 -8
@@ -295,10 +295,10 @@ packages:
295 dependency: transitive
296 description:
297 name: hashlib
298 - sha256: "5037d3b8c36384c03a728543ae67d962a56970c5432a50862279fe68ee4c8411"
298 + sha256: d41795742c10947930630118c6836608deeb9047cd05aee32d2baeb697afd66a
299 url: "https://pub.dev"
300 source: hosted
301 - version: "1.19.1"
301 + version: "1.19.2"
302 hashlib_codecs:
303 dependency: transitive
304 description:
@@ -575,12 +575,11 @@ packages:
575 polyseed:
576 dependency: "direct main"
577 description:
578 - path: "."
579 - ref: f9adc68dbf879fefadeae8e86d1c2983f5a2cc3f
580 - resolved-ref: f9adc68dbf879fefadeae8e86d1c2983f5a2cc3f
581 - url: "https://github.com/mrcyjanek/polyseed_dart"
582 - source: git
583 - version: "0.0.5"
578 + name: polyseed
579 + sha256: "11d4dbee409db053c5e9cd77382b2f5115f43fc2529158a826a96f3ba505d770"
580 + url: "https://pub.dev"
581 + source: hosted
582 + version: "0.0.6"
583 pool:
584 dependency: transitive
585 description:
cw_monero/pubspec.yaml
+1 -4
@@ -19,10 +19,7 @@ dependencies:
19 flutter_mobx: ^2.0.6+1
20 intl: ^0.18.0
21 encrypt: ^5.0.1
22 - polyseed:
23 - git:
24 - url: https://github.com/mrcyjanek/polyseed_dart
25 - ref: f9adc68dbf879fefadeae8e86d1c2983f5a2cc3f
22 + polyseed: ^0.0.6
23 cw_core:
24 path: ../cw_core
25 monero:
cw_wownero/pubspec.lock
+9 -10
@@ -295,18 +295,18 @@ packages:
295 dependency: transitive
296 description:
297 name: hashlib
298 - sha256: "71bf102329ddb8e50c8a995ee4645ae7f1728bb65e575c17196b4d8262121a96"
298 + sha256: d41795742c10947930630118c6836608deeb9047cd05aee32d2baeb697afd66a
299 url: "https://pub.dev"
300 source: hosted
301 - version: "1.12.0"
301 + version: "1.19.2"
302 hashlib_codecs:
303 dependency: transitive
304 description:
305 name: hashlib_codecs
306 - sha256: "49e2a471f74b15f1854263e58c2ac11f2b631b5b12c836f9708a35397d36d626"
306 + sha256: "2b570061f5a4b378425be28a576c1e11783450355ad4345a19f606ff3d96db0f"
307 url: "https://pub.dev"
308 source: hosted
309 - version: "2.2.0"
309 + version: "2.5.0"
310 hive:
311 dependency: transitive
312 description:
@@ -567,12 +567,11 @@ packages:
567 polyseed:
568 dependency: "direct main"
569 description:
570 - path: "."
571 - ref: f9adc68dbf879fefadeae8e86d1c2983f5a2cc3f
572 - resolved-ref: f9adc68dbf879fefadeae8e86d1c2983f5a2cc3f
573 - url: "https://github.com/mrcyjanek/polyseed_dart"
574 - source: git
575 - version: "0.0.5"
570 + name: polyseed
571 + sha256: "11d4dbee409db053c5e9cd77382b2f5115f43fc2529158a826a96f3ba505d770"
572 + url: "https://pub.dev"
573 + source: hosted
574 + version: "0.0.6"
575 pool:
576 dependency: transitive
577 description:
cw_wownero/pubspec.yaml
+1 -4
@@ -19,10 +19,7 @@ dependencies:
19 flutter_mobx: ^2.0.6+1
20 intl: ^0.18.0
21 encrypt: ^5.0.1
22 - polyseed:
23 - git:
24 - url: https://github.com/mrcyjanek/polyseed_dart
25 - ref: f9adc68dbf879fefadeae8e86d1c2983f5a2cc3f
22 + polyseed: ^0.0.6
23 cw_core:
24 path: ../cw_core
25 monero:
lib/core/wallet_loading_service.dart
+6 -2
@@ -60,7 +60,9 @@ class WalletLoadingService {
60 String corruptedWalletsSeeds = "Corrupted wallets seeds (if retrievable, empty otherwise):";
61 try {
62 corruptedWalletsSeeds += await _getCorruptedWalletSeeds(name, type);
63 - } catch (_) {}
63 + } catch (e) {
64 + corruptedWalletsSeeds += "\nFailed to fetch $name seeds: $e";
65 + }
66
67 // try opening another wallet that is not corrupted to give user access to the app
68 final walletInfoSource = await CakeHive.openBox<WalletInfo>(WalletInfo.boxName);
@@ -90,7 +92,9 @@ class WalletLoadingService {
92 if (!corruptedWalletsSeeds.contains(seeds)) {
93 corruptedWalletsSeeds += seeds;
94 }
93 - } catch (_) {}
95 + } catch (e) {
96 + corruptedWalletsSeeds += "\nFailed to fetch $name seeds: $e";
97 + }
98 }
99 }
100
lib/reactions/bootstrap.dart
+1 -1
@@ -27,7 +27,7 @@ Future<void> bootstrap(GlobalKey<NavigatorState> navigatorKey) async {
27 authenticationStore.installed();
28 }
29
30 - await startAuthenticationStateChange(authenticationStore, navigatorKey);
30 + startAuthenticationStateChange(authenticationStore, navigatorKey);
31 startCurrentWalletChangeReaction(appStore, settingsStore, fiatConversionStore);
32 startCurrentFiatChangeReaction(appStore, settingsStore, fiatConversionStore);
33 startCurrentFiatApiModeChangeReaction(appStore, settingsStore, fiatConversionStore);
lib/reactions/on_authentication_state_change.dart
+4 -13
@@ -7,26 +7,17 @@ import 'package:flutter/widgets.dart';
7 import 'package:mobx/mobx.dart';
8 import 'package:cake_wallet/entities/load_current_wallet.dart';
9 import 'package:cake_wallet/store/authentication_store.dart';
10 +import 'package:rxdart/subjects.dart';
11
12 ReactionDisposer? _onAuthenticationStateChange;
13
14 dynamic loginError;
14 -StreamController<dynamic> authenticatedErrorStreamController = StreamController<dynamic>();
15 +StreamController<dynamic> authenticatedErrorStreamController = BehaviorSubject<dynamic>();
16
16 -Future<void> reInitializeStreamController() async {
17 - if (!authenticatedErrorStreamController.isClosed) {
18 - await authenticatedErrorStreamController.close();
19 - }
20 -
21 - authenticatedErrorStreamController = StreamController<dynamic>();
22 -}
23 -
24 -Future<void> startAuthenticationStateChange(
17 +void startAuthenticationStateChange(
18 AuthenticationStore authenticationStore,
19 GlobalKey<NavigatorState> navigatorKey,
27 -) async {
28 - await reInitializeStreamController();
29 -
20 +) {
21 authenticatedErrorStreamController.stream.listen((event) {
22 if (authenticationStore.state == AuthenticationState.allowed) {
23 ExceptionHandler.showError(event.toString(), delayInSeconds: 3);
lib/src/screens/dashboard/pages/balance_page.dart
+2 -2
@@ -287,8 +287,8 @@ class CryptoBalanceWidget extends StatelessWidget {
287 padding: const EdgeInsets.fromLTRB(16, 0, 16, 8),
288 child: DashBoardRoundedCardWidget(
289 customBorder: 30,
290 - title: "Monero wallet is broken",
291 - subTitle: "Here are the things that are broken:\n - "
290 + title: "This wallet has encountered an issue",
291 + subTitle: "Here are the things that you should note:\n - "
292 +dashboardViewModel.isMoneroWalletBrokenReasons.join("\n - ")
293 +"\n\nPlease restart your wallet and if it doesn't help contact our support.",
294 onTap: () {},
lib/view_model/dashboard/dashboard_view_model.dart
+3 -1
@@ -32,7 +32,6 @@ import 'package:cake_wallet/view_model/dashboard/trade_list_item.dart';
32 import 'package:cake_wallet/view_model/dashboard/transaction_list_item.dart';
33 import 'package:cake_wallet/view_model/settings/sync_mode.dart';
34 import 'package:cake_wallet/wallet_type_utils.dart';
35 -import 'package:cake_wallet/wownero/wownero.dart' as wow;
35 import 'package:cryptography/cryptography.dart';
36 import 'package:cw_core/balance.dart';
37 import 'package:cw_core/cake_hive.dart';
@@ -485,6 +484,9 @@ abstract class DashboardViewModelBase with Store {
484
485 @computed
486 bool get hasSignMessages {
487 + if (wallet.isHardwareWallet) {
488 + return false;
489 + }
490 switch (wallet.type) {
491 case WalletType.monero:
492 case WalletType.litecoin:
lib/view_model/exchange/exchange_view_model.dart
+9
@@ -142,8 +142,17 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
142 _bestRate = 0;
143 _calculateBestRate();
144 });
145 +
146 + if (isElectrumWallet) {
147 + bitcoin!.updateFeeRates(wallet);
148 + }
149 }
150
151 + bool get isElectrumWallet =>
152 + wallet.type == WalletType.bitcoin ||
153 + wallet.type == WalletType.litecoin ||
154 + wallet.type == WalletType.bitcoinCash;
155 +
156 bool _useTorOnly;
157 final Box<Trade> trades;
158 final ExchangeTemplateStore _exchangeTemplateStore;
macos/Podfile.lock
+6 -12
@@ -17,15 +17,13 @@ PODS:
17 - in_app_review (0.2.0):
18 - FlutterMacOS
19 - OrderedSet (5.0.0)
20 - - package_info (0.0.1):
21 - - FlutterMacOS
20 - package_info_plus (0.0.1):
21 - FlutterMacOS
22 - path_provider_foundation (0.0.1):
23 - Flutter
24 - FlutterMacOS
25 - ReachabilitySwift (5.0.0)
28 - - share_plus_macos (0.0.1):
26 + - share_plus (0.0.1):
27 - FlutterMacOS
28 - shared_preferences_foundation (0.0.1):
29 - Flutter
@@ -46,10 +44,9 @@ DEPENDENCIES:
44 - flutter_secure_storage_macos (from `Flutter/ephemeral/.symlinks/plugins/flutter_secure_storage_macos/macos`)
45 - FlutterMacOS (from `Flutter/ephemeral`)
46 - in_app_review (from `Flutter/ephemeral/.symlinks/plugins/in_app_review/macos`)
49 - - package_info (from `Flutter/ephemeral/.symlinks/plugins/package_info/macos`)
47 - package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`)
48 - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`)
52 - - share_plus_macos (from `Flutter/ephemeral/.symlinks/plugins/share_plus_macos/macos`)
49 + - share_plus (from `Flutter/ephemeral/.symlinks/plugins/share_plus/macos`)
50 - shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`)
51 - sp_scanner (from `Flutter/ephemeral/.symlinks/plugins/sp_scanner/macos`)
52 - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
@@ -77,14 +74,12 @@ EXTERNAL SOURCES:
74 :path: Flutter/ephemeral
75 in_app_review:
76 :path: Flutter/ephemeral/.symlinks/plugins/in_app_review/macos
80 - package_info:
81 - :path: Flutter/ephemeral/.symlinks/plugins/package_info/macos
77 package_info_plus:
78 :path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos
79 path_provider_foundation:
80 :path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin
86 - share_plus_macos:
87 - :path: Flutter/ephemeral/.symlinks/plugins/share_plus_macos/macos
81 + share_plus:
82 + :path: Flutter/ephemeral/.symlinks/plugins/share_plus/macos
83 shared_preferences_foundation:
84 :path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin
85 sp_scanner:
@@ -104,11 +99,10 @@ SPEC CHECKSUMS:
99 FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
100 in_app_review: a850789fad746e89bce03d4aeee8078b45a53fd0
101 OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c
107 - package_info: 6eba2fd8d3371dda2d85c8db6fe97488f24b74b2
108 - package_info_plus: 02d7a575e80f194102bef286361c6c326e4c29ce
102 + package_info_plus: fa739dd842b393193c5ca93c26798dff6e3d0e0c
103 path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
104 ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
111 - share_plus_macos: 853ee48e7dce06b633998ca0735d482dd671ade4
105 + share_plus: 36537c04ce0c3e3f5bd297ce4318b6d5ee5fd6cf
106 shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
107 sp_scanner: 269d96e0ec3173e69156be7239b95182be3b8303
108 url_launcher_macos: 5f437abeda8c85500ceb03f5c1938a8c5a705399
pubspec_base.yaml
+2 -5
@@ -94,10 +94,7 @@ dependencies:
94 # ref: main
95 socks5_proxy: ^1.0.4
96 flutter_svg: ^2.0.9
97 - polyseed:
98 - git:
99 - url: https://github.com/mrcyjanek/polyseed_dart
100 - ref: f9adc68dbf879fefadeae8e86d1c2983f5a2cc3f
97 + polyseed: ^0.0.6
98 nostr_tools: ^1.0.9
99 solana: ^0.30.1
100 bitcoin_base:
@@ -105,7 +102,7 @@ dependencies:
102 url: https://github.com/cake-tech/bitcoin_base
103 ref: cake-update-v5
104 ledger_flutter: ^1.0.1
108 - hashlib: 1.12.0
105 + hashlib: ^1.19.2
106
107 dev_dependencies:
108 flutter_test:
scripts/android/app_env.sh
+4 -4
@@ -15,15 +15,15 @@ TYPES=($MONERO_COM $CAKEWALLET $HAVEN)
15 APP_ANDROID_TYPE=$1
16
17 MONERO_COM_NAME="Monero.com"
18 -MONERO_COM_VERSION="1.16.3"
19 -MONERO_COM_BUILD_NUMBER=97
18 +MONERO_COM_VERSION="1.16.4"
19 +MONERO_COM_BUILD_NUMBER=98
20 MONERO_COM_BUNDLE_ID="com.monero.app"
21 MONERO_COM_PACKAGE="com.monero.app"
22 MONERO_COM_SCHEME="monero.com"
23
24 CAKEWALLET_NAME="Cake Wallet"
25 -CAKEWALLET_VERSION="4.19.3"
26 -CAKEWALLET_BUILD_NUMBER=224
25 +CAKEWALLET_VERSION="4.19.4"
26 +CAKEWALLET_BUILD_NUMBER=225
27 CAKEWALLET_BUNDLE_ID="com.cakewallet.cake_wallet"
28 CAKEWALLET_PACKAGE="com.cakewallet.cake_wallet"
29 CAKEWALLET_SCHEME="cakewallet"
scripts/ios/app_env.sh
+4 -4
@@ -13,13 +13,13 @@ TYPES=($MONERO_COM $CAKEWALLET $HAVEN)
13 APP_IOS_TYPE=$1
14
15 MONERO_COM_NAME="Monero.com"
16 -MONERO_COM_VERSION="1.16.3"
17 -MONERO_COM_BUILD_NUMBER=95
16 +MONERO_COM_VERSION="1.16.4"
17 +MONERO_COM_BUILD_NUMBER=96
18 MONERO_COM_BUNDLE_ID="com.cakewallet.monero"
19
20 CAKEWALLET_NAME="Cake Wallet"
21 -CAKEWALLET_VERSION="4.19.3"
22 -CAKEWALLET_BUILD_NUMBER=262
21 +CAKEWALLET_VERSION="4.19.4"
22 +CAKEWALLET_BUILD_NUMBER=263
23 CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet"
24
25 HAVEN_NAME="Haven"
scripts/linux/app_env.sh
+2 -2
@@ -14,8 +14,8 @@ if [ -n "$1" ]; then
14 fi
15
16 CAKEWALLET_NAME="Cake Wallet"
17 -CAKEWALLET_VERSION="1.9.2"
18 -CAKEWALLET_BUILD_NUMBER=30
17 +CAKEWALLET_VERSION="1.9.4"
18 +CAKEWALLET_BUILD_NUMBER=31
19
20 if ! [[ " ${TYPES[*]} " =~ " ${APP_LINUX_TYPE} " ]]; then
21 echo "Wrong app type."
scripts/macos/app_env.sh
+4 -4
@@ -16,13 +16,13 @@ if [ -n "$1" ]; then
16 fi
17
18 MONERO_COM_NAME="Monero.com"
19 -MONERO_COM_VERSION="1.6.2"
20 -MONERO_COM_BUILD_NUMBER=27
19 +MONERO_COM_VERSION="1.6.4"
20 +MONERO_COM_BUILD_NUMBER=28
21 MONERO_COM_BUNDLE_ID="com.cakewallet.monero"
22
23 CAKEWALLET_NAME="Cake Wallet"
24 -CAKEWALLET_VERSION="1.12.2"
25 -CAKEWALLET_BUILD_NUMBER=83
24 +CAKEWALLET_VERSION="1.12.4"
25 +CAKEWALLET_BUILD_NUMBER=84
26 CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet"
27
28 if ! [[ " ${TYPES[*]} " =~ " ${APP_MACOS_TYPE} " ]]; then
scripts/windows/build_exe_installer.iss
+1 -1
@@ -1,5 +1,5 @@
1 #define MyAppName "Cake Wallet"
2 -#define MyAppVersion "0.0.4"
2 +#define MyAppVersion "0.0.5"
3 #define MyAppPublisher "Cake Labs LLC"
4 #define MyAppURL "https://cakewallet.com/"
5 #define MyAppExeName "CakeWallet.exe"