@lunch-money/coinbase-to-lunch-money
Version:
A wrapper around the coinbase API for enabling Lunch Money to gather information about a user's account.
43 lines (42 loc) • 1.42 kB
TypeScript
import { Method } from 'axios';
import { CoinbaseAccount, CoinbaseConfig, CoinbaseData, CoinbaseResult } from './types';
import { CryptoBalance } from './shared-types';
declare const BASE_URL = "https://api.coinbase.com";
declare const ENDPOINTS: {
accounts: string;
};
/**
* Coinbase Client
*
* Coinbase doesn't have an official node client, so a basic one is provided.
*
* There are two authentication methods: API key and OAuth2. Coinbase
* discourages the use of API Keys except when writing your own software, so
* OAuth2 is preferred.
*/
export declare class CoinbaseClient {
config: CoinbaseConfig;
/**
* Create the client instance with baseUrl and scopes
*/
constructor(config: CoinbaseConfig);
/**
* Execute a request and handle the response
*/
request(method: Method, path: string, query?: Record<string, unknown>, data?: CoinbaseData): Promise<CoinbaseResult['accounts']>;
/**
* Generate a JWT for the current request
*/
private generateSignedJwt;
/**
* Returns current coinbase accounts
*
* @see https://docs.cdp.coinbase.com/advanced-trade/reference/retailbrokerageapi_getaccounts
*/
getAccounts(): Promise<CoinbaseAccount[]>;
/**
* Returns current coinbase holdings
*/
getBalances(): Promise<CryptoBalance[]>;
}
export { BASE_URL as coinbaseAPIBaseUrl, ENDPOINTS as coinbaseEndpoints };