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
This commit is contained in:
Omar Hatem 2024-08-18 03:37:15 +03:00 committed by GitHub
parent 7c9b72483a
commit c59d39d42d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 89 additions and 92 deletions

View file

@ -1,4 +1,7 @@
-
uri: rpc.ankr.com
is_default: true
useSSL: true
-
uri: api.mainnet-beta.solana.com:443
useSSL: true

View file

@ -1,4 +1,3 @@
Monero synchronization improvements
Enhance error handling
UI enhancements
Scan and verify messages
Synchronization enhancements
Bug fixes

View file

@ -1,6 +1,3 @@
Wallets enhancements
Monero synchronization improvements
Improve wallet backups
Enhance error handling
UI enhancements
Scan and verify messages
Synchronization enhancements
Bug fixes

View file

@ -264,7 +264,8 @@ abstract class ElectrumWalletBase
void Function(FlutterErrorDetails)? _onError;
Timer? _reconnectTimer;
Timer? _autoSaveTimer;
static const int _autoSaveInterval = 30;
Timer? _updateFeeRateTimer;
static const int _autoSaveInterval = 1;
Future<void> init() async {
await walletAddresses.init();
@ -272,7 +273,7 @@ abstract class ElectrumWalletBase
await save();
_autoSaveTimer =
Timer.periodic(Duration(seconds: _autoSaveInterval), (_) async => await save());
Timer.periodic(Duration(minutes: _autoSaveInterval), (_) async => await save());
}
@action
@ -425,6 +426,10 @@ abstract class ElectrumWalletBase
await updateTransactions();
await updateAllUnspents();
await updateBalance();
updateFeeRates();
_updateFeeRateTimer ??=
Timer.periodic(const Duration(minutes: 1), (timer) async => await updateFeeRates());
if (alwaysScan == true) {
_setListeners(walletInfo.restoreHeight);
@ -1213,6 +1218,7 @@ abstract class ElectrumWalletBase
await electrumClient.close();
} catch (_) {}
_autoSaveTimer?.cancel();
_updateFeeRateTimer?.cancel();
}
@action
@ -1371,7 +1377,7 @@ abstract class ElectrumWalletBase
if (confirmations > 0) return false;
if (transactionHex == null) {
if (transactionHex == null || transactionHex.isEmpty) {
return false;
}

View file

@ -113,6 +113,8 @@ abstract class EVMChainWalletBase
int? gasBaseFee = 0;
int estimatedGasUnits = 0;
Timer? _updateFeesTimer;
bool _isTransactionUpdating;
// TODO: remove after integrating our own node and having eth_newPendingTransactionFilter
@ -263,6 +265,7 @@ abstract class EVMChainWalletBase
void close() {
_client.stop();
_transactionsUpdateTimer?.cancel();
_updateFeesTimer?.cancel();
}
@action
@ -297,7 +300,7 @@ abstract class EVMChainWalletBase
await _updateEstimatedGasFeeParams();
Timer.periodic(const Duration(seconds: 10), (timer) async {
_updateFeesTimer ??= Timer.periodic(const Duration(seconds: 30), (timer) async {
await _updateEstimatedGasFeeParams();
});

View file

@ -119,7 +119,7 @@ class MoneroWalletService extends WalletService<
}
@override
Future<MoneroWallet> openWallet(String name, String password) async {
Future<MoneroWallet> openWallet(String name, String password, {bool? retryOnFailure}) async {
MoneroWallet? wallet;
try {
final path = await pathForWallet(name: name, type: getType());
@ -181,12 +181,12 @@ class MoneroWalletService extends WalletService<
wallet.onError != null) {
wallet.onError!(FlutterErrorDetails(exception: e, stack: s));
}
if (invalidPassword) {
if (invalidPassword || retryOnFailure == false) {
rethrow;
}
await restoreOrResetWalletFiles(name);
return openWallet(name, password);
return openWallet(name, password, retryOnFailure: false);
}
}

View file

@ -295,10 +295,10 @@ packages:
dependency: transitive
description:
name: hashlib
sha256: "5037d3b8c36384c03a728543ae67d962a56970c5432a50862279fe68ee4c8411"
sha256: d41795742c10947930630118c6836608deeb9047cd05aee32d2baeb697afd66a
url: "https://pub.dev"
source: hosted
version: "1.19.1"
version: "1.19.2"
hashlib_codecs:
dependency: transitive
description:
@ -575,12 +575,11 @@ packages:
polyseed:
dependency: "direct main"
description:
path: "."
ref: f9adc68dbf879fefadeae8e86d1c2983f5a2cc3f
resolved-ref: f9adc68dbf879fefadeae8e86d1c2983f5a2cc3f
url: "https://github.com/mrcyjanek/polyseed_dart"
source: git
version: "0.0.5"
name: polyseed
sha256: "11d4dbee409db053c5e9cd77382b2f5115f43fc2529158a826a96f3ba505d770"
url: "https://pub.dev"
source: hosted
version: "0.0.6"
pool:
dependency: transitive
description:

View file

@ -19,10 +19,7 @@ dependencies:
flutter_mobx: ^2.0.6+1
intl: ^0.18.0
encrypt: ^5.0.1
polyseed:
git:
url: https://github.com/mrcyjanek/polyseed_dart
ref: f9adc68dbf879fefadeae8e86d1c2983f5a2cc3f
polyseed: ^0.0.6
cw_core:
path: ../cw_core
monero:

View file

@ -295,18 +295,18 @@ packages:
dependency: transitive
description:
name: hashlib
sha256: "71bf102329ddb8e50c8a995ee4645ae7f1728bb65e575c17196b4d8262121a96"
sha256: d41795742c10947930630118c6836608deeb9047cd05aee32d2baeb697afd66a
url: "https://pub.dev"
source: hosted
version: "1.12.0"
version: "1.19.2"
hashlib_codecs:
dependency: transitive
description:
name: hashlib_codecs
sha256: "49e2a471f74b15f1854263e58c2ac11f2b631b5b12c836f9708a35397d36d626"
sha256: "2b570061f5a4b378425be28a576c1e11783450355ad4345a19f606ff3d96db0f"
url: "https://pub.dev"
source: hosted
version: "2.2.0"
version: "2.5.0"
hive:
dependency: transitive
description:
@ -567,12 +567,11 @@ packages:
polyseed:
dependency: "direct main"
description:
path: "."
ref: f9adc68dbf879fefadeae8e86d1c2983f5a2cc3f
resolved-ref: f9adc68dbf879fefadeae8e86d1c2983f5a2cc3f
url: "https://github.com/mrcyjanek/polyseed_dart"
source: git
version: "0.0.5"
name: polyseed
sha256: "11d4dbee409db053c5e9cd77382b2f5115f43fc2529158a826a96f3ba505d770"
url: "https://pub.dev"
source: hosted
version: "0.0.6"
pool:
dependency: transitive
description:

View file

@ -19,10 +19,7 @@ dependencies:
flutter_mobx: ^2.0.6+1
intl: ^0.18.0
encrypt: ^5.0.1
polyseed:
git:
url: https://github.com/mrcyjanek/polyseed_dart
ref: f9adc68dbf879fefadeae8e86d1c2983f5a2cc3f
polyseed: ^0.0.6
cw_core:
path: ../cw_core
monero:

View file

@ -60,7 +60,9 @@ class WalletLoadingService {
String corruptedWalletsSeeds = "Corrupted wallets seeds (if retrievable, empty otherwise):";
try {
corruptedWalletsSeeds += await _getCorruptedWalletSeeds(name, type);
} catch (_) {}
} catch (e) {
corruptedWalletsSeeds += "\nFailed to fetch $name seeds: $e";
}
// try opening another wallet that is not corrupted to give user access to the app
final walletInfoSource = await CakeHive.openBox<WalletInfo>(WalletInfo.boxName);
@ -90,7 +92,9 @@ class WalletLoadingService {
if (!corruptedWalletsSeeds.contains(seeds)) {
corruptedWalletsSeeds += seeds;
}
} catch (_) {}
} catch (e) {
corruptedWalletsSeeds += "\nFailed to fetch $name seeds: $e";
}
}
}

View file

@ -27,7 +27,7 @@ Future<void> bootstrap(GlobalKey<NavigatorState> navigatorKey) async {
authenticationStore.installed();
}
await startAuthenticationStateChange(authenticationStore, navigatorKey);
startAuthenticationStateChange(authenticationStore, navigatorKey);
startCurrentWalletChangeReaction(appStore, settingsStore, fiatConversionStore);
startCurrentFiatChangeReaction(appStore, settingsStore, fiatConversionStore);
startCurrentFiatApiModeChangeReaction(appStore, settingsStore, fiatConversionStore);

View file

@ -7,26 +7,17 @@ import 'package:flutter/widgets.dart';
import 'package:mobx/mobx.dart';
import 'package:cake_wallet/entities/load_current_wallet.dart';
import 'package:cake_wallet/store/authentication_store.dart';
import 'package:rxdart/subjects.dart';
ReactionDisposer? _onAuthenticationStateChange;
dynamic loginError;
StreamController<dynamic> authenticatedErrorStreamController = StreamController<dynamic>();
StreamController<dynamic> authenticatedErrorStreamController = BehaviorSubject<dynamic>();
Future<void> reInitializeStreamController() async {
if (!authenticatedErrorStreamController.isClosed) {
await authenticatedErrorStreamController.close();
}
authenticatedErrorStreamController = StreamController<dynamic>();
}
Future<void> startAuthenticationStateChange(
void startAuthenticationStateChange(
AuthenticationStore authenticationStore,
GlobalKey<NavigatorState> navigatorKey,
) async {
await reInitializeStreamController();
) {
authenticatedErrorStreamController.stream.listen((event) {
if (authenticationStore.state == AuthenticationState.allowed) {
ExceptionHandler.showError(event.toString(), delayInSeconds: 3);

View file

@ -287,8 +287,8 @@ class CryptoBalanceWidget extends StatelessWidget {
padding: const EdgeInsets.fromLTRB(16, 0, 16, 8),
child: DashBoardRoundedCardWidget(
customBorder: 30,
title: "Monero wallet is broken",
subTitle: "Here are the things that are broken:\n - "
title: "This wallet has encountered an issue",
subTitle: "Here are the things that you should note:\n - "
+dashboardViewModel.isMoneroWalletBrokenReasons.join("\n - ")
+"\n\nPlease restart your wallet and if it doesn't help contact our support.",
onTap: () {},

View file

@ -32,7 +32,6 @@ import 'package:cake_wallet/view_model/dashboard/trade_list_item.dart';
import 'package:cake_wallet/view_model/dashboard/transaction_list_item.dart';
import 'package:cake_wallet/view_model/settings/sync_mode.dart';
import 'package:cake_wallet/wallet_type_utils.dart';
import 'package:cake_wallet/wownero/wownero.dart' as wow;
import 'package:cryptography/cryptography.dart';
import 'package:cw_core/balance.dart';
import 'package:cw_core/cake_hive.dart';
@ -485,6 +484,9 @@ abstract class DashboardViewModelBase with Store {
@computed
bool get hasSignMessages {
if (wallet.isHardwareWallet) {
return false;
}
switch (wallet.type) {
case WalletType.monero:
case WalletType.litecoin:

View file

@ -142,8 +142,17 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with
_bestRate = 0;
_calculateBestRate();
});
if (isElectrumWallet) {
bitcoin!.updateFeeRates(wallet);
}
}
bool get isElectrumWallet =>
wallet.type == WalletType.bitcoin ||
wallet.type == WalletType.litecoin ||
wallet.type == WalletType.bitcoinCash;
bool _useTorOnly;
final Box<Trade> trades;
final ExchangeTemplateStore _exchangeTemplateStore;

View file

@ -17,15 +17,13 @@ PODS:
- in_app_review (0.2.0):
- FlutterMacOS
- OrderedSet (5.0.0)
- package_info (0.0.1):
- FlutterMacOS
- package_info_plus (0.0.1):
- FlutterMacOS
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- ReachabilitySwift (5.0.0)
- share_plus_macos (0.0.1):
- share_plus (0.0.1):
- FlutterMacOS
- shared_preferences_foundation (0.0.1):
- Flutter
@ -46,10 +44,9 @@ DEPENDENCIES:
- flutter_secure_storage_macos (from `Flutter/ephemeral/.symlinks/plugins/flutter_secure_storage_macos/macos`)
- FlutterMacOS (from `Flutter/ephemeral`)
- in_app_review (from `Flutter/ephemeral/.symlinks/plugins/in_app_review/macos`)
- package_info (from `Flutter/ephemeral/.symlinks/plugins/package_info/macos`)
- package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`)
- path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`)
- share_plus_macos (from `Flutter/ephemeral/.symlinks/plugins/share_plus_macos/macos`)
- share_plus (from `Flutter/ephemeral/.symlinks/plugins/share_plus/macos`)
- shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`)
- sp_scanner (from `Flutter/ephemeral/.symlinks/plugins/sp_scanner/macos`)
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
@ -77,14 +74,12 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral
in_app_review:
:path: Flutter/ephemeral/.symlinks/plugins/in_app_review/macos
package_info:
:path: Flutter/ephemeral/.symlinks/plugins/package_info/macos
package_info_plus:
:path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos
path_provider_foundation:
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin
share_plus_macos:
:path: Flutter/ephemeral/.symlinks/plugins/share_plus_macos/macos
share_plus:
:path: Flutter/ephemeral/.symlinks/plugins/share_plus/macos
shared_preferences_foundation:
:path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin
sp_scanner:
@ -104,11 +99,10 @@ SPEC CHECKSUMS:
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
in_app_review: a850789fad746e89bce03d4aeee8078b45a53fd0
OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c
package_info: 6eba2fd8d3371dda2d85c8db6fe97488f24b74b2
package_info_plus: 02d7a575e80f194102bef286361c6c326e4c29ce
package_info_plus: fa739dd842b393193c5ca93c26798dff6e3d0e0c
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
share_plus_macos: 853ee48e7dce06b633998ca0735d482dd671ade4
share_plus: 36537c04ce0c3e3f5bd297ce4318b6d5ee5fd6cf
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
sp_scanner: 269d96e0ec3173e69156be7239b95182be3b8303
url_launcher_macos: 5f437abeda8c85500ceb03f5c1938a8c5a705399

View file

@ -94,10 +94,7 @@ dependencies:
# ref: main
socks5_proxy: ^1.0.4
flutter_svg: ^2.0.9
polyseed:
git:
url: https://github.com/mrcyjanek/polyseed_dart
ref: f9adc68dbf879fefadeae8e86d1c2983f5a2cc3f
polyseed: ^0.0.6
nostr_tools: ^1.0.9
solana: ^0.30.1
bitcoin_base:
@ -105,7 +102,7 @@ dependencies:
url: https://github.com/cake-tech/bitcoin_base
ref: cake-update-v5
ledger_flutter: ^1.0.1
hashlib: 1.12.0
hashlib: ^1.19.2
dev_dependencies:
flutter_test:

View file

@ -15,15 +15,15 @@ TYPES=($MONERO_COM $CAKEWALLET $HAVEN)
APP_ANDROID_TYPE=$1
MONERO_COM_NAME="Monero.com"
MONERO_COM_VERSION="1.16.3"
MONERO_COM_BUILD_NUMBER=97
MONERO_COM_VERSION="1.16.4"
MONERO_COM_BUILD_NUMBER=98
MONERO_COM_BUNDLE_ID="com.monero.app"
MONERO_COM_PACKAGE="com.monero.app"
MONERO_COM_SCHEME="monero.com"
CAKEWALLET_NAME="Cake Wallet"
CAKEWALLET_VERSION="4.19.3"
CAKEWALLET_BUILD_NUMBER=224
CAKEWALLET_VERSION="4.19.4"
CAKEWALLET_BUILD_NUMBER=225
CAKEWALLET_BUNDLE_ID="com.cakewallet.cake_wallet"
CAKEWALLET_PACKAGE="com.cakewallet.cake_wallet"
CAKEWALLET_SCHEME="cakewallet"

View file

@ -13,13 +13,13 @@ TYPES=($MONERO_COM $CAKEWALLET $HAVEN)
APP_IOS_TYPE=$1
MONERO_COM_NAME="Monero.com"
MONERO_COM_VERSION="1.16.3"
MONERO_COM_BUILD_NUMBER=95
MONERO_COM_VERSION="1.16.4"
MONERO_COM_BUILD_NUMBER=96
MONERO_COM_BUNDLE_ID="com.cakewallet.monero"
CAKEWALLET_NAME="Cake Wallet"
CAKEWALLET_VERSION="4.19.3"
CAKEWALLET_BUILD_NUMBER=262
CAKEWALLET_VERSION="4.19.4"
CAKEWALLET_BUILD_NUMBER=263
CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet"
HAVEN_NAME="Haven"

View file

@ -14,8 +14,8 @@ if [ -n "$1" ]; then
fi
CAKEWALLET_NAME="Cake Wallet"
CAKEWALLET_VERSION="1.9.2"
CAKEWALLET_BUILD_NUMBER=30
CAKEWALLET_VERSION="1.9.4"
CAKEWALLET_BUILD_NUMBER=31
if ! [[ " ${TYPES[*]} " =~ " ${APP_LINUX_TYPE} " ]]; then
echo "Wrong app type."

View file

@ -16,13 +16,13 @@ if [ -n "$1" ]; then
fi
MONERO_COM_NAME="Monero.com"
MONERO_COM_VERSION="1.6.2"
MONERO_COM_BUILD_NUMBER=27
MONERO_COM_VERSION="1.6.4"
MONERO_COM_BUILD_NUMBER=28
MONERO_COM_BUNDLE_ID="com.cakewallet.monero"
CAKEWALLET_NAME="Cake Wallet"
CAKEWALLET_VERSION="1.12.2"
CAKEWALLET_BUILD_NUMBER=83
CAKEWALLET_VERSION="1.12.4"
CAKEWALLET_BUILD_NUMBER=84
CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet"
if ! [[ " ${TYPES[*]} " =~ " ${APP_MACOS_TYPE} " ]]; then

View file

@ -1,5 +1,5 @@
#define MyAppName "Cake Wallet"
#define MyAppVersion "0.0.4"
#define MyAppVersion "0.0.5"
#define MyAppPublisher "Cake Labs LLC"
#define MyAppURL "https://cakewallet.com/"
#define MyAppExeName "CakeWallet.exe"