Fix monero swaps (#3195)

* Fix monero swaps not showing in history

* await more sublist instances

* await more sublist instances
This commit is contained in:
Omar Hatem
2026-04-23 01:31:44 +02:00
committed by GitHub
parent 2c9d3dae9e
commit 7c8a2b926d
8 changed files with 24 additions and 25 deletions
+2 -2
View File
@@ -67,14 +67,14 @@ abstract class MoneroSubaddressListBase with Store {
Future<void> addSubaddress({required int accountIndex, required String label}) async {
await subaddress_list.addSubaddress(accountIndex: accountIndex, label: label);
update(accountIndex: accountIndex);
await update(accountIndex: accountIndex);
}
Future<void> 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}) {
+5 -6
View File
@@ -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<MoneroBalance,
_autoSaveTimer = Timer.periodic(
Duration(seconds: _autoSaveInterval), (_) async => 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<MoneroBalance,
await walletAddresses.updateUsedSubaddress();
if (isEnabledAutoGenerateSubaddress) {
walletAddresses.updateUnusedSubaddress(
await walletAddresses.updateUnusedSubaddress(
accountIndex: walletAddresses.account?.id ?? 0,
defaultLabel: walletAddresses.account?.label ?? '');
}
@@ -951,14 +950,14 @@ abstract class MoneroWalletBase extends WalletBase<MoneroBalance,
}
}
void _updateSubAddress(bool enableAutoGenerate, {Account? account}) {
Future<void> _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);
}
}
+5 -5
View File
@@ -72,7 +72,7 @@ abstract class MoneroWalletAddressesBase extends WalletAddresses with Store {
Future<void> 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<void> updateSubaddressList({required int accountIndex}) async {
await subaddressList.update(accountIndex: accountIndex);
address = subaddressList.subaddresses.isNotEmpty
? subaddressList.subaddresses.first.address
: getAddress();