cake_wallet/cw_core/lib/wownero_balance.dart
David Adegoke c9a6abeea4
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>
2024-12-27 05:54:47 +02:00

28 lines
No EOL
1 KiB
Dart

import 'package:cw_core/balance.dart';
import 'package:cw_core/wownero_amount_format.dart';
class WowneroBalance extends Balance {
WowneroBalance({required this.fullBalance, required this.unlockedBalance, this.frozenBalance = 0})
: formattedUnconfirmedBalance = wowneroAmountToString(amount: fullBalance - unlockedBalance),
formattedUnlockedBalance = wowneroAmountToString(amount: unlockedBalance - frozenBalance),
formattedFrozenBalance =
wowneroAmountToString(amount: frozenBalance),
super(unlockedBalance, fullBalance);
final int fullBalance;
final int unlockedBalance;
final int frozenBalance;
final String formattedUnconfirmedBalance;
final String formattedUnlockedBalance;
final String formattedFrozenBalance;
@override
String get formattedUnAvailableBalance =>
formattedFrozenBalance == '0.0' ? '' : formattedFrozenBalance;
@override
String get formattedAvailableBalance => formattedUnlockedBalance;
@override
String get formattedAdditionalBalance => formattedUnconfirmedBalance;
}