2023-01-04 14:51:23 +00:00
|
|
|
import 'dart:convert';
|
|
|
|
|
2022-12-28 15:02:04 +00:00
|
|
|
import 'package:cw_core/balance.dart';
|
2023-01-04 14:51:23 +00:00
|
|
|
import 'package:web3dart/web3dart.dart';
|
2022-12-28 15:02:04 +00:00
|
|
|
|
|
|
|
class EthereumBalance extends Balance {
|
|
|
|
EthereumBalance(super.available, super.additional);
|
|
|
|
|
|
|
|
@override
|
2023-01-04 14:51:23 +00:00
|
|
|
String get formattedAdditionalBalance {
|
|
|
|
return EtherAmount.fromUnitAndValue(EtherUnit.ether, additional.toString())
|
|
|
|
.getInEther
|
|
|
|
.toString();
|
|
|
|
}
|
2022-12-28 15:02:04 +00:00
|
|
|
|
|
|
|
@override
|
2023-01-04 14:51:23 +00:00
|
|
|
String get formattedAvailableBalance =>
|
|
|
|
EtherAmount.fromUnitAndValue(EtherUnit.ether, available.toString()).getInEther.toString();
|
|
|
|
|
|
|
|
String toJSON() => json.encode({'available': available, 'additional': additional});
|
|
|
|
}
|