declare class Client { | |
constructor(config: Coinbase.ClientConfig) | |
public getAccounts(nothing: {}, callback: Coinbase.Callback<Array<Account>>): void | |
public getAccount(accountId: string, callback: Coinbase.Callback<Account>): void | |
public getBuyPrice(args: Coinbase.BuyPrice, callback: Coinbase.Callback<Coinbase.BuyPriceResponse>): void; | |
} | |
export = Client | |
declare namespace Coinbase { | |
interface ClientConfig { | |
apiKey: string; | |
apiSecret: string | |
} | |
interface Callback<T> { | |
(error: any, result: T): void | |
} | |
interface Balance { | |
amount: number; | |
currency: Currency; | |
} | |
interface MoneyHash { | |
amount: string; | |
currency: Currency; | |
} | |
interface SellBuyResponse { | |
id: string; | |
status: Status; | |
payment_method: PaymentMethod; | |
transaction: PaymentMethod; | |
amount: MoneyHash; | |
total: MoneyHash; | |
subtotal: MoneyHash; | |
fee: MoneyHash; | |
created_at: Date; | |
updated_at: Date; | |
resource: string; | |
resource_path: string; | |
commited: boolean; | |
instant: boolean; | |
payout_at?: Date; | |
} | |
interface PaymentMethod { | |
id: string; | |
resource: string; | |
resource_path: string; | |
} | |
interface Status { | |
CREATED: 'created'; | |
COMPLETED: 'completed'; | |
CANCELED: 'canceled'; | |
} | |
interface BuyPrice { | |
currencyPair: CurrencyPair | |
} | |
interface Buy { | |
amount: string; | |
currency: Currency; | |
payment_method: string; | |
} | |
export interface Currency { | |
BTC: "BTC"; | |
} | |
export class CurrencyPair { | |
public static BTC_USD: 'BTC-USD'; | |
public static LTC_EUR: 'LTC-EUR'; | |
public static BTC_EUR: 'BTC-EUR'; | |
} | |
export interface BuyPriceResponse { | |
data: SellBuyResponse; | |
} | |
export class Account { | |
public id: string; | |
public name: string; | |
public primary: boolean; | |
public type: string; | |
public currency: string; | |
public balance: Balance; | |
public native_balance: Balance; | |
public created_at: Date; | |
public updated_at: Date; | |
public resource: string; | |
public resource_path: string | |
public sell(args: MoneyHash, callback: Callback<SellBuyResponse>): void | |
public buy(args: Buy, callback: Callback<SellBuyResponse>): void | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment