TypeScript
Node.js util.promisify()

by Benny Neugebauer

import * as coinbase from 'coinbase';
import * as util from 'util';

private async clientGetAccounts(): Promise<coinbase.Account[]> {
  const options = {};
  return await util.promisify(this.client.getAccounts.bind(this.client))(options);
}

import * as coinbase from 'coinbase';

private clientGetAccounts(): Promise<coinbase.Account[]> {
  return new Promise(async (resolve, reject) => {
    const options = {};

    const callback = (error: Error, accounts: coinbase.Account[]) => {
      return error ? reject(error) : resolve(accounts);
    };

    this.client.getAccounts(options, callback);
  });
}