mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-05 20:07:44 +00:00
39 lines
928 B
Dart
39 lines
928 B
Dart
import 'package:decimal/decimal.dart';
|
|
import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
|
import 'package:stackwallet/utilities/format.dart';
|
|
|
|
class Balance {
|
|
final Coin coin;
|
|
final int total;
|
|
final int spendable;
|
|
final int blockedTotal;
|
|
final int pendingSpendable;
|
|
|
|
Balance({
|
|
required this.coin,
|
|
required this.total,
|
|
required this.spendable,
|
|
required this.blockedTotal,
|
|
required this.pendingSpendable,
|
|
});
|
|
|
|
Decimal getTotal({bool includeBlocked = false}) => Format.satoshisToAmount(
|
|
includeBlocked ? total : total - blockedTotal,
|
|
coin: coin,
|
|
);
|
|
|
|
Decimal getSpendable() => Format.satoshisToAmount(
|
|
spendable,
|
|
coin: coin,
|
|
);
|
|
|
|
Decimal getPending() => Format.satoshisToAmount(
|
|
pendingSpendable,
|
|
coin: coin,
|
|
);
|
|
|
|
Decimal getBlocked() => Format.satoshisToAmount(
|
|
blockedTotal,
|
|
coin: coin,
|
|
);
|
|
}
|