v4.25.0 Release Candidate (#2153)

* v4.25.0 Release Candidate

* update rest of platforms version [skip ci]

* replace macos icons [skip ci]

* fix: incorrect balance reporting (#2155)

* fix: monero frozen coins, call updateSendingBalance, display "ALL" balance properly

* fix: decred formatting on send page

---------

Co-authored-by: cyan <cyjan@mrcyjanek.net>
This commit is contained in:
Omar Hatem
2025-04-04 00:49:44 +02:00
committed by GitHub
co-authored by cyan
parent 2b493ff6dc
commit 24ec5fa7fd
21 changed files with 99 additions and 79 deletions
+2 -2
View File
@@ -245,7 +245,7 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
}
@computed
String get sendingBalance {
Future<String> get sendingBalance async {
// only for electrum, monero, wownero, decred wallets atm:
switch (wallet.type) {
case WalletType.bitcoin:
@@ -255,7 +255,7 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor
case WalletType.wownero:
case WalletType.decred:
return wallet.formatCryptoAmount(
unspentCoinsListViewModel.getSendingBalance(coinTypeToSpendFrom).toString());
(await unspentCoinsListViewModel.getSendingBalance(coinTypeToSpendFrom)).toString());
default:
return balance;
}
@@ -149,12 +149,15 @@ abstract class UnspentCoinsListViewModelBase with Store {
}
@action
int getSendingBalance(UnspentCoinType overrideCoinTypeToSpendFrom) {
Future<int> getSendingBalance(UnspentCoinType overrideCoinTypeToSpendFrom) async {
// return items.where((element) => element.isSending).fold(0, (previousValue, element) => previousValue + element.value);
// go through all unspent coins and add up the value minus frozen and non sending:
int total = 0;
await _updateUnspents();
Set<String> seen = {};
for (final item in _getSpecificUnspents(overrideCoinTypeToSpendFrom)) {
if (seen.contains(item.hash)) continue;
seen.add(item.hash);
if (item.isFrozen || !item.isSending) continue;
total += item.value;
}