mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-24 06:48:38 +02:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user