getBalance static method
Future<ICPTs>
getBalance({
- required AgentFactory agent,
- required String accountId,
- SignIdentity? identity,
Implementation
static Future<ICPTs> getBalance({
required AgentFactory agent,
required String accountId,
SignIdentity? identity,
}) async {
final ledgerInstance = Ledger.hook(agent)..setIdentity(identity);
final res = await ledgerInstance.agent.actor!.getFunc(
LedgerMethods.getBalance,
)!([AccountBalanceArgs(account: accountId).toJson()]);
if (res != null) {
return ICPTs.fromJson(res);
}
throw StateError('Request failed with the result: $res.');
}