2021-12-24 12:52:08 +00:00
|
|
|
import 'package:cw_core/balance.dart';
|
2022-03-30 15:57:04 +00:00
|
|
|
import 'package:cw_core/monero_amount_format.dart';
|
2021-12-24 12:52:08 +00:00
|
|
|
|
|
|
|
class MoneroBalance extends Balance {
|
2023-08-24 13:54:05 +00:00
|
|
|
MoneroBalance({required this.fullBalance, required this.unlockedBalance, this.frozenBalance = 0})
|
2024-12-27 03:54:47 +00:00
|
|
|
: formattedUnconfirmedBalance = moneroAmountToString(amount: fullBalance - unlockedBalance),
|
2024-12-28 05:15:59 +00:00
|
|
|
formattedUnlockedBalance = moneroAmountToString(amount: unlockedBalance),
|
2024-12-27 03:54:47 +00:00
|
|
|
formattedFrozenBalance = moneroAmountToString(amount: frozenBalance),
|
2021-12-24 12:52:08 +00:00
|
|
|
super(unlockedBalance, fullBalance);
|
|
|
|
|
|
|
|
final int fullBalance;
|
|
|
|
final int unlockedBalance;
|
2023-08-24 13:54:05 +00:00
|
|
|
final int frozenBalance;
|
2024-12-27 03:54:47 +00:00
|
|
|
final String formattedUnconfirmedBalance;
|
2021-12-24 12:52:08 +00:00
|
|
|
final String formattedUnlockedBalance;
|
2024-12-27 03:54:47 +00:00
|
|
|
final String formattedFrozenBalance;
|
2023-08-24 13:54:05 +00:00
|
|
|
|
|
|
|
@override
|
2023-11-16 23:22:10 +00:00
|
|
|
String get formattedUnAvailableBalance =>
|
2024-12-27 03:54:47 +00:00
|
|
|
formattedFrozenBalance == '0.0' ? '' : formattedFrozenBalance;
|
2021-12-24 12:52:08 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
String get formattedAvailableBalance => formattedUnlockedBalance;
|
|
|
|
|
|
|
|
@override
|
2024-12-27 03:54:47 +00:00
|
|
|
String get formattedAdditionalBalance => formattedUnconfirmedBalance;
|
2021-12-24 12:52:08 +00:00
|
|
|
}
|