From 7c8a2b926d99dcfe10851d8527e896f68e38edf9 Mon Sep 17 00:00:00 2001 From: Omar Hatem Date: Thu, 23 Apr 2026 01:31:44 +0200 Subject: [PATCH] Fix monero swaps (#3195) * Fix monero swaps not showing in history * await more sublist instances * await more sublist instances --- cw_monero/lib/monero_subaddress_list.dart | 4 ++-- cw_monero/lib/monero_wallet.dart | 11 +++++------ cw_monero/lib/monero_wallet_addresses.dart | 10 +++++----- lib/monero/cw_monero.dart | 4 ++-- .../wallet_address_list_view_model.dart | 2 +- scripts/android/app_env.sh | 8 ++++---- scripts/ios/app_env.sh | 8 ++++---- tool/configure.dart | 2 +- 8 files changed, 24 insertions(+), 25 deletions(-) diff --git a/cw_monero/lib/monero_subaddress_list.dart b/cw_monero/lib/monero_subaddress_list.dart index 779b1d303..0c5284d93 100644 --- a/cw_monero/lib/monero_subaddress_list.dart +++ b/cw_monero/lib/monero_subaddress_list.dart @@ -67,14 +67,14 @@ abstract class MoneroSubaddressListBase with Store { Future addSubaddress({required int accountIndex, required String label}) async { await subaddress_list.addSubaddress(accountIndex: accountIndex, label: label); - update(accountIndex: accountIndex); + await update(accountIndex: accountIndex); } Future setLabelSubaddress( {required int accountIndex, required int addressIndex, required String label}) async { await subaddress_list.setLabelForSubaddress( accountIndex: accountIndex, addressIndex: addressIndex, label: label); - update(accountIndex: accountIndex); + await update(accountIndex: accountIndex); } void refresh({required int accountIndex}) { diff --git a/cw_monero/lib/monero_wallet.dart b/cw_monero/lib/monero_wallet.dart index 81771193b..e315f24fa 100644 --- a/cw_monero/lib/monero_wallet.dart +++ b/cw_monero/lib/monero_wallet.dart @@ -3,7 +3,6 @@ import 'dart:ffi'; import 'dart:io'; import 'dart:isolate'; -import 'package:cw_core/format_fixed.dart'; import 'package:cw_core/monero_amount_format.dart'; import 'package:cw_core/pathForWallet.dart'; import 'package:cw_core/transaction_priority.dart'; @@ -180,7 +179,7 @@ abstract class MoneroWalletBase extends WalletBase await save()); // update transaction details after restore - walletAddresses.subaddressList.update(accountIndex: walletAddresses.account?.id??0); + await walletAddresses.subaddressList.update(accountIndex: walletAddresses.account?.id??0); } @override @@ -504,7 +503,7 @@ abstract class MoneroWalletBase extends WalletBase _updateSubAddress(bool enableAutoGenerate, {Account? account}) async { if (enableAutoGenerate) { - walletAddresses.updateUnusedSubaddress( + await walletAddresses.updateUnusedSubaddress( accountIndex: account?.id ?? 0, defaultLabel: account?.label ?? '', ); } else { - walletAddresses.updateSubaddressList(accountIndex: account?.id ?? 0); + await walletAddresses.updateSubaddressList(accountIndex: account?.id ?? 0); } } diff --git a/cw_monero/lib/monero_wallet_addresses.dart b/cw_monero/lib/monero_wallet_addresses.dart index 9a7264c03..00fbf7cc1 100644 --- a/cw_monero/lib/monero_wallet_addresses.dart +++ b/cw_monero/lib/monero_wallet_addresses.dart @@ -72,7 +72,7 @@ abstract class MoneroWalletAddressesBase extends WalletAddresses with Store { Future init() async { accountList.update(); account = accountList.accounts.isEmpty ? Account(id: 0, label: "Primary address") : accountList.accounts.first; - updateSubaddressList(accountIndex: account?.id ?? 0); + await updateSubaddressList(accountIndex: account?.id ?? 0); await updateAddressesInBox(); } @@ -84,8 +84,8 @@ abstract class MoneroWalletAddressesBase extends WalletAddresses with Store { addressesMap.clear(); addressInfos.clear(); - accountList.accounts.forEach((account) { - _subaddressList.update(accountIndex: account.id); + accountList.accounts.forEach((account) async { + await _subaddressList.update(accountIndex: account.id); _subaddressList.subaddresses.forEach((subaddress) { addressesMap[subaddress.address] = subaddress.label; addressInfos[account.id] ??= []; @@ -122,8 +122,8 @@ abstract class MoneroWalletAddressesBase extends WalletAddresses with Store { return true; } - void updateSubaddressList({required int accountIndex}) { - subaddressList.update(accountIndex: accountIndex); + Future updateSubaddressList({required int accountIndex}) async { + await subaddressList.update(accountIndex: accountIndex); address = subaddressList.subaddresses.isNotEmpty ? subaddressList.subaddresses.first.address : getAddress(); diff --git a/lib/monero/cw_monero.dart b/lib/monero/cw_monero.dart index 5cc0412b4..08143b3b3 100644 --- a/lib/monero/cw_monero.dart +++ b/lib/monero/cw_monero.dart @@ -77,9 +77,9 @@ class CWMoneroSubaddressList extends MoneroSubaddressList { } @override - void update(Object wallet, {required int accountIndex}) { + Future update(Object wallet, {required int accountIndex}) async { final moneroWallet = wallet as MoneroWallet; - moneroWallet.walletAddresses.subaddressList.update(accountIndex: accountIndex); + await moneroWallet.walletAddresses.subaddressList.update(accountIndex: accountIndex); } @override diff --git a/lib/view_model/wallet_address_list/wallet_address_list_view_model.dart b/lib/view_model/wallet_address_list/wallet_address_list_view_model.dart index 4fc003077..b4aaa2a94 100644 --- a/lib/view_model/wallet_address_list/wallet_address_list_view_model.dart +++ b/lib/view_model/wallet_address_list/wallet_address_list_view_model.dart @@ -409,7 +409,7 @@ abstract class WalletAddressListViewModelBase extends WalletChangeListenerViewMo // update the address list: await wallet.walletAddresses.saveAddressesInBox(); if (wallet.type == WalletType.monero) { - monero! + await monero! .getSubaddressList(wallet) .update(wallet, accountIndex: monero!.getCurrentAccount(wallet).id); } else if (wallet.type == WalletType.wownero) { diff --git a/scripts/android/app_env.sh b/scripts/android/app_env.sh index 5874fff1f..00bed6ce4 100644 --- a/scripts/android/app_env.sh +++ b/scripts/android/app_env.sh @@ -14,15 +14,15 @@ TYPES=($MONERO_COM $CAKEWALLET) APP_ANDROID_TYPE=$1 MONERO_COM_NAME="Monero.com" -MONERO_COM_VERSION="6.1.0" -MONERO_COM_BUILD_NUMBER=4157 +MONERO_COM_VERSION="6.1.2" +MONERO_COM_BUILD_NUMBER=4158 MONERO_COM_BUNDLE_ID="com.monero.app" MONERO_COM_PACKAGE="com.monero.app" MONERO_COM_SCHEME="monero.com" CAKEWALLET_NAME="Cake Wallet" -CAKEWALLET_VERSION="6.1.1" -CAKEWALLET_BUILD_NUMBER=4409 +CAKEWALLET_VERSION="6.1.2" +CAKEWALLET_BUILD_NUMBER=4410 CAKEWALLET_BUNDLE_ID="com.cakewallet.cake_wallet" CAKEWALLET_PACKAGE="com.cakewallet.cake_wallet" CAKEWALLET_SCHEME="cakewallet" diff --git a/scripts/ios/app_env.sh b/scripts/ios/app_env.sh index d3e4ba53b..7f12ba31f 100644 --- a/scripts/ios/app_env.sh +++ b/scripts/ios/app_env.sh @@ -12,13 +12,13 @@ TYPES=($MONERO_COM $CAKEWALLET) APP_IOS_TYPE=$1 MONERO_COM_NAME="Monero.com" -MONERO_COM_VERSION="6.1.0" -MONERO_COM_BUILD_NUMBER=162 +MONERO_COM_VERSION="6.1.2" +MONERO_COM_BUILD_NUMBER=163 MONERO_COM_BUNDLE_ID="com.cakewallet.monero" CAKEWALLET_NAME="Cake Wallet" -CAKEWALLET_VERSION="6.1.1" -CAKEWALLET_BUILD_NUMBER=417 +CAKEWALLET_VERSION="6.1.2" +CAKEWALLET_BUILD_NUMBER=418 CAKEWALLET_BUNDLE_ID="com.fotolockr.cakewallet" diff --git a/tool/configure.dart b/tool/configure.dart index 81def5b22..afbdae4f2 100644 --- a/tool/configure.dart +++ b/tool/configure.dart @@ -490,7 +490,7 @@ WalletCredentials createMoneroNewWalletCredentials({required String name, requir abstract class MoneroSubaddressList { ObservableList get subaddresses; - void update(Object wallet, {required int accountIndex}); + Future update(Object wallet, {required int accountIndex}); void refresh(Object wallet, {required int accountIndex}); Future> getAll(Object wallet); Future addSubaddress(Object wallet, {required int accountIndex, required String label});