@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.35 kB
TypeScript
import { AxiosError, AxiosResponse, Method } from 'axios';
/**
* Config for CoinbaseClient
*/
export interface CoinbaseConfig {
name: string;
privateKey: string;
testPagination?: boolean;
mockApiResponseTest?: boolean;
}
export type CoinbaseData = Record<string, string> | string;
export interface CoinbaseRequestHandler {
request: (method: Method, path: string, data?: CoinbaseData) => Promise<CoinbaseRequestHandlerResponse>;
}
export type CoinbaseRequestHandlerResponse = AxiosResponse | AxiosError['response'];
interface CurrencyAmount {
value: string;
currency: string;
}
export interface CoinbaseAccount {
uuid: string;
name: string;
currency: string;
available_balance: CurrencyAmount;
default: boolean;
active: boolean;
created_at: string;
updated_at: string;
deleted_at: string;
type: 'ACCOUNT_TYPE_UNSPECIFIED' | 'ACCOUNT_TYPE_CRYPTO' | 'ACCOUNT_TYPE_FIAT' | 'ACCOUNT_TYPE_VAULT' | 'ACCOUNT_TYPE_PERP_FUTURES';
ready: boolean;
hold: CurrencyAmount;
retail_portfolio_id: string;
platform: 'ACCOUNT_PLATFORM_UNSPECIFIED' | 'ACCOUNT_PLATFORM_CONSUMER' | 'ACCOUNT_PLATFORM_CFM_CONSUMER' | 'ACCOUNT_PLATFORM_INTX';
}
export interface CoinbaseResult {
accounts: CoinbaseAccount[];
has_next: boolean;
cursor: string;
size: number;
}
export {};