getBalanceBreakdown method

  1. @override
Future<CoinBalanceBreakdown> getBalanceBreakdown(
  1. String owner,
  2. String coinType
)
override

The owner's coinType balance split into coin-object vs address-balance sources — needed to resolve CoinWithBalance intents that may draw from the address balance. Transports without address-balance support (e.g. JSON-RPC) throw; the resolver only reaches this on the gRPC path.

Implementation

@override
Future<CoinBalanceBreakdown> getBalanceBreakdown(
  String owner,
  String coinType,
) async {
  // The gRPC Balance message carries the total plus its address-balance and
  // coin-object components, which the CoinWithBalance resolver needs to pick
  // between the gasless (address-balance) and coin-object sources.
  final b = await core.getBalance(owner, coinType: coinType);
  return CoinBalanceBreakdown(
    total: BigInt.parse(b.balance.toString()),
    addressBalance: BigInt.parse(b.addressBalance.toString()),
    coinBalance: BigInt.parse(b.coinBalance.toString()),
  );
}