gateio-api-nw
Version:
Complete & robust Node.js SDK for Gate.io's REST APIs, WebSockets & WebSocket APIs, with TypeScript declarations.
39 lines (38 loc) • 1.68 kB
TypeScript
import WebSocket from 'isomorphic-ws';
import { GateBaseUrlKey } from '../types/shared.js';
export interface RestClientOptions {
/** Your API key */
apiKey?: string;
/** Your API secret */
apiSecret?: 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.gate.io'
**/
baseUrl?: string;
baseUrlKey?: GateBaseUrlKey;
/** 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>;
}
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(restClientOptions: RestClientOptions): string;
export declare const CHANNEL_ID = "nwnw";
export interface MessageEventLike {
target: WebSocket;
type: 'message';
data: string;
}
export declare function isMessageEvent(msg: unknown): msg is MessageEventLike;