TypeScript
Using a Promise-based library

by Benny Neugebauer

public getBalance(): Promise<string> {
  return this.client.accountInfo()
    .then((info: AccountInfoResponse) => {
      const matchingBalance: Balance = info.balances.find((balance) => balance.asset === this.asset);
      return matchingBalance.free;
    });
}

public async getBalance(): Promise<string> {
  const info: AccountInfoResponse = this.client.accountInfo();
  const matchingBalance: Balance = info.balances.find((balance) => balance.asset === this.asset);
  return matchingBalance.free;
}