Created
September 7, 2017 14:35
-
-
Save mathewmeconry/68c42c6e88b88ef4f80483021e23643d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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