Full balance (#1457)

* fix: Confirm widget is still mounted

* feat: Modify balance display to include full balance

* fix: Modifying balance

* chore: Feature cleanup

* fix: Add frozen balance into consideration when taking available balance  and add field to make full balance display only on bitcoin and litecoin wallets

* fix: Adjust balance card to display correct available and unavailable balance, unavailable balance should only be displayed when there is one WIP

* fix: Cleanup balance page and balance page view_model

* chore: Revert formatting

* fix: Remove full balance

* fix: Remove full balance

* fix: Remove full balance

* chore: Rever formating [skip ci]

* feat: Finalize display only available and unavailable balance

* fix: Modify the way balance is displayed, activate frozen balance with label, remove unavailable/additional balance for bitcoin wallet type

* fix: Issues coming from syncing with main

* fix: Modify additional balance label

* fix: Monero and Wownero balances display bug

* fix: Resolve merge conflicts

* feat: Activate CPFP for BTC, LTC and BCH, also fix issues with frozen balance display

* - minor fix
- remove unused functions

* Fix conflicts

---------

Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
Co-authored-by: tuxsudo <tuxsudo@tux.pizza>
This commit is contained in:
David Adegoke 2024-12-27 04:54:47 +01:00 committed by GitHub
parent b1c9be637f
commit c9a6abeea4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
43 changed files with 1257 additions and 1232 deletions

View file

@ -39,7 +39,7 @@ class ElectrumBalance extends Balance {
int secondUnconfirmed = 0;
@override
String get formattedAvailableBalance => bitcoinAmountToString(amount: confirmed - frozen);
String get formattedAvailableBalance => bitcoinAmountToString(amount: ((confirmed + unconfirmed) - frozen) );
@override
String get formattedAdditionalBalance => bitcoinAmountToString(amount: unconfirmed);
@ -58,7 +58,7 @@ class ElectrumBalance extends Balance {
@override
String get formattedFullAvailableBalance =>
bitcoinAmountToString(amount: confirmed + secondConfirmed - frozen);
bitcoinAmountToString(amount: (confirmed + unconfirmed) + secondConfirmed - frozen);
String toJSON() => json.encode({
'confirmed': confirmed,

View file

@ -2213,18 +2213,6 @@ abstract class ElectrumWalletBase
var totalConfirmed = 0;
var totalUnconfirmed = 0;
unspentCoinsInfo.values.forEach((info) {
unspentCoins.forEach((element) {
if (element.hash == info.hash &&
element.vout == info.vout &&
info.isFrozen &&
element.bitcoinAddressRecord.address == info.address &&
element.value == info.value) {
totalFrozen += element.value;
}
});
});
if (hasSilentPaymentsScanning) {
// Add values from unspent coins that are not fetched by the address list
// i.e. scanned silent payments
@ -2240,6 +2228,20 @@ abstract class ElectrumWalletBase
});
}
unspentCoinsInfo.values.forEach((info) {
unspentCoins.forEach((element) {
if (element.bitcoinAddressRecord is BitcoinSilentPaymentAddressRecord) return;
if (element.hash == info.hash &&
element.vout == info.vout &&
info.isFrozen &&
element.bitcoinAddressRecord.address == info.address &&
element.value == info.value) {
totalFrozen += element.value;
}
});
});
final balances = await Future.wait(balanceFutures);
if (balances.isNotEmpty && balances.first['confirmed'] == null) {