2023-11-17 17:40:23 +00:00
|
|
|
import 'package:cw_core/balance.dart';
|
2024-03-18 12:15:54 +00:00
|
|
|
import 'package:cw_zano/zano_formatter.dart';
|
2023-10-02 14:17:35 +00:00
|
|
|
|
2023-11-17 17:40:23 +00:00
|
|
|
class ZanoBalance extends Balance {
|
2024-08-07 12:32:47 +00:00
|
|
|
final BigInt total;
|
|
|
|
final BigInt unlocked;
|
2024-03-18 12:15:54 +00:00
|
|
|
final int decimalPoint;
|
2024-08-07 12:32:47 +00:00
|
|
|
ZanoBalance({required this.total, required this.unlocked, this.decimalPoint = ZanoFormatter.defaultDecimalPoint}) : super(unlocked.isValidInt ? unlocked.toInt() : 0, (total - unlocked).isValidInt ? (total - unlocked).toInt() : 0);
|
2024-04-06 10:03:11 +00:00
|
|
|
|
2024-08-07 12:32:47 +00:00
|
|
|
ZanoBalance.empty({this.decimalPoint = ZanoFormatter.defaultDecimalPoint}): total = BigInt.zero, unlocked = BigInt.zero, super(0, 0);
|
2023-12-14 04:51:16 +00:00
|
|
|
|
2023-11-17 17:40:23 +00:00
|
|
|
@override
|
2024-08-07 12:32:47 +00:00
|
|
|
String get formattedAdditionalBalance => ZanoFormatter.bigIntAmountToString(total - unlocked, decimalPoint);
|
2023-11-17 17:40:23 +00:00
|
|
|
|
|
|
|
@override
|
2024-08-07 12:32:47 +00:00
|
|
|
String get formattedAvailableBalance => ZanoFormatter.bigIntAmountToString(unlocked, decimalPoint);
|
2023-11-17 17:40:23 +00:00
|
|
|
}
|