bitmart-api
Version:
Complete & robust Node.js SDK for BitMart's REST APIs and WebSockets, with TypeScript declarations.
56 lines (55 loc) • 2.46 kB
TypeScript
import WebSocket from 'isomorphic-ws';
import { RestClientType } from './BaseRestClient.js';
export interface RestClientOptions {
/** Your API key */
apiKey?: string;
/** Your API secret */
apiSecret?: string;
/** Your API memo (can be anything) that you included when creating this API key */
apiMemo?: string;
/**
* Override the default/global max size of the request window (in ms) for signed api calls.
* If you don't include a recv window when making an API call, this value will be used as default
*/
recvWindow?: number;
/** Default: false. If true, we'll throw errors if any params are undefined */
strictParamValidation?: boolean;
/**
* Optionally override API protocol + domain
* e.g baseUrl: 'https://api.bitmart.com'
**/
baseUrl?: string;
/**
* Default: false. If true, use the simulated trading demo environment.
* For V2 Futures: https://demo-api-cloud-v2.bitmart.com
* Note: The API keys for Simulated-Environment and Prod-Environment are the same.
*/
demoTrading?: boolean;
/** Default: true. whether to try and post-process request exceptions (and throw them). */
parseExceptions?: boolean;
/**
* Allows you to provide a custom "signMessage" function, e.g. to use node's much faster createHmac method
*
* Look in the examples folder for a demonstration on using node's createHmac instead.
*/
customSignMessageFn?: (message: string, secret: string) => Promise<string>;
/**
* Enable keep alive for REST API requests (via axios).
*/
keepAlive?: boolean;
/**
* When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000.
* Only relevant if keepAlive is set to true.
* Default: 1000 (defaults comes from https agent)
*/
keepAliveMsecs?: number;
}
export declare function serializeParams<T extends Record<string, any> | undefined = {}>(params: T, strict_validation: boolean | undefined, encodeValues: boolean, prefixWith: string): string;
export declare function getRestBaseUrl(useTestnet: boolean, restInverseOptions: RestClientOptions, restClientType: RestClientType): string;
export declare const APIID = "bitmartapinode1";
export interface MessageEventLike {
target: WebSocket;
type: 'message';
data: string;
}
export declare function isMessageEvent(msg: unknown): msg is MessageEventLike;