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 {
try {
var ledgerInstance = Ledger.hook(agent)..setIdentity(identity);
var res =
await ledgerInstance.agent.actor!.getFunc(LedgerMethods.getBalance)!(
[AccountBalanceArgs(account: accountId).toJson()]);
if (res != null) {
return ICPTs.fromMap(res);
}
throw "Cannot get count but $res";
} catch (e) {
rethrow;
}
}