| 1 | import 'package:cw_core/amount/money.dart'; |
| 2 | import 'package:cw_core/balance.dart'; |
| 3 | import 'package:cw_core/crypto_currency.dart'; |
| 4 | |
| 5 | class NanoBalance extends Balance { |
| 6 | final Money currentBalance; |
| 7 | final Money receivableBalance; |
| 8 | |
| 9 | NanoBalance({required this.currentBalance, required this.receivableBalance}) |
| 10 | : super(currentBalance, receivableBalance); |
| 11 | |
| 12 | factory NanoBalance.fromRawString({ |
| 13 | required String currentBalance, |
| 14 | required String receivableBalance, |
| 15 | }) => |
| 16 | NanoBalance( |
| 17 | currentBalance: |
| 18 | Money.tryParse(currentBalance, CryptoCurrency.nano) ?? Money.zero(CryptoCurrency.nano), |
| 19 | receivableBalance: Money.tryParse(receivableBalance, CryptoCurrency.nano) ?? |
| 20 | Money.zero(CryptoCurrency.nano), |
| 21 | ); |
| 22 | } |