2020-12-15 16:29:10 +00:00
|
|
|
import 'package:cake_wallet/entities/balance.dart';
|
|
|
|
import 'package:cake_wallet/entities/balance_display_mode.dart';
|
2020-06-01 18:13:56 +00:00
|
|
|
import 'package:flutter/foundation.dart';
|
2020-09-21 11:50:26 +00:00
|
|
|
import 'package:cake_wallet/monero/monero_amount_format.dart';
|
2020-06-01 18:13:56 +00:00
|
|
|
|
2020-12-15 16:29:10 +00:00
|
|
|
class MoneroBalance extends Balance {
|
2020-06-01 18:13:56 +00:00
|
|
|
MoneroBalance({@required this.fullBalance, @required this.unlockedBalance})
|
|
|
|
: formattedFullBalance = moneroAmountToString(amount: fullBalance),
|
|
|
|
formattedUnlockedBalance =
|
2020-12-15 16:29:10 +00:00
|
|
|
moneroAmountToString(amount: unlockedBalance),
|
2021-01-11 17:15:27 +00:00
|
|
|
super(unlockedBalance, fullBalance);
|
2020-06-01 18:13:56 +00:00
|
|
|
|
|
|
|
MoneroBalance.fromString(
|
|
|
|
{@required this.formattedFullBalance,
|
2020-12-15 16:29:10 +00:00
|
|
|
@required this.formattedUnlockedBalance})
|
2020-06-01 18:13:56 +00:00
|
|
|
: fullBalance = moneroParseAmount(amount: formattedFullBalance),
|
2020-12-15 16:29:10 +00:00
|
|
|
unlockedBalance = moneroParseAmount(amount: formattedUnlockedBalance),
|
2021-01-11 17:15:27 +00:00
|
|
|
super(moneroParseAmount(amount: formattedUnlockedBalance),
|
|
|
|
moneroParseAmount(amount: formattedFullBalance));
|
2020-06-01 18:13:56 +00:00
|
|
|
|
|
|
|
final int fullBalance;
|
|
|
|
final int unlockedBalance;
|
|
|
|
final String formattedFullBalance;
|
|
|
|
final String formattedUnlockedBalance;
|
2020-12-15 16:29:10 +00:00
|
|
|
|
|
|
|
@override
|
2021-01-11 17:15:27 +00:00
|
|
|
String get formattedAvailableBalance => formattedUnlockedBalance;
|
|
|
|
|
|
|
|
@override
|
|
|
|
String get formattedAdditionalBalance => formattedFullBalance;
|
2020-12-15 16:29:10 +00:00
|
|
|
}
|