balance method

TransactionResult Function(Transaction) balance({
  1. required String owner,
  2. required String coinType,
})

Read an owner's stored custody balance for a coin type: chains load_account(wrapper) → balance<T>(account, root, clock). Compose in a dev-inspect/simulate PTB and read the u64 return of the LAST command.

Implementation

TransactionResult Function(Transaction) balance({
  required String owner,
  required String coinType,
}) =>
    (tx) {
      final acct = loadAccount(wrapperId: deriveAccountWrapperId(owner))(tx);
      return account.balance(
        config: _generatedConfig,
        typeArguments: [coinType],
        arguments: {'self': acct},
      )(tx);
    };