UNPKG

@binance/c2c

Version:

Official Binance C2C Connector - A lightweight library that provides a convenient interface to Binance's C2C REST API.

341 lines (329 loc) 10.3 kB
import { RestApiResponse, ConfigurationRestAPI } from '@binance/common'; export { BadRequestError, C2C_REST_API_PROD_URL, ConnectorClientError, ForbiddenError, NetworkError, NotFoundError, RateLimitBanError, RequiredError, ServerError, TooManyRequestsError, UnauthorizedError } from '@binance/common'; /** * Binance C2C REST API * * OpenAPI Specification for the Binance C2C REST API * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface GetC2CTradeHistoryResponseDataInner */ interface GetC2CTradeHistoryResponseDataInner { /** * * @type {string} * @memberof GetC2CTradeHistoryResponseDataInner */ orderNumber?: string; /** * * @type {string} * @memberof GetC2CTradeHistoryResponseDataInner */ advNo?: string; /** * * @type {string} * @memberof GetC2CTradeHistoryResponseDataInner */ tradeType?: string; /** * * @type {string} * @memberof GetC2CTradeHistoryResponseDataInner */ asset?: string; /** * * @type {string} * @memberof GetC2CTradeHistoryResponseDataInner */ fiat?: string; /** * * @type {string} * @memberof GetC2CTradeHistoryResponseDataInner */ fiatSymbol?: string; /** * * @type {string} * @memberof GetC2CTradeHistoryResponseDataInner */ amount?: string; /** * * @type {string} * @memberof GetC2CTradeHistoryResponseDataInner */ totalPrice?: string; /** * * @type {string} * @memberof GetC2CTradeHistoryResponseDataInner */ unitPrice?: string; /** * * @type {string} * @memberof GetC2CTradeHistoryResponseDataInner */ orderStatus?: string; /** * * @type {number} * @memberof GetC2CTradeHistoryResponseDataInner */ createTime?: number; /** * * @type {string} * @memberof GetC2CTradeHistoryResponseDataInner */ commission?: string; /** * * @type {string} * @memberof GetC2CTradeHistoryResponseDataInner */ counterPartNickName?: string; /** * * @type {string} * @memberof GetC2CTradeHistoryResponseDataInner */ advertisementRole?: string; } /** * Binance C2C REST API * * OpenAPI Specification for the Binance C2C REST API * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * * @export * @interface GetC2CTradeHistoryResponse */ interface GetC2CTradeHistoryResponse { /** * * @type {string} * @memberof GetC2CTradeHistoryResponse */ code?: string; /** * * @type {string} * @memberof GetC2CTradeHistoryResponse */ message?: string; /** * * @type {Array<GetC2CTradeHistoryResponseDataInner>} * @memberof GetC2CTradeHistoryResponse */ data?: Array<GetC2CTradeHistoryResponseDataInner>; /** * * @type {number} * @memberof GetC2CTradeHistoryResponse */ total?: number; /** * * @type {boolean} * @memberof GetC2CTradeHistoryResponse */ success?: boolean; } /** * Binance C2C REST API * * OpenAPI Specification for the Binance C2C REST API * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ /** * C2CApi - interface * @interface C2CApi */ interface C2CApiInterface { /** * Get C2C Trade History * * The max interval between startTime and endTime is 30 days. * If startTime and endTime are not sent, the recent 7 days' data will be returned. * The earliest startTime is supported on June 10, 2020 * Return up to 200 records per request. * * Weight: 1 * * @summary Get C2C Trade History (USER_DATA) * @param {GetC2CTradeHistoryRequest} requestParameters Request parameters. * * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof C2CApiInterface */ getC2CTradeHistory(requestParameters?: GetC2CTradeHistoryRequest): Promise<RestApiResponse<GetC2CTradeHistoryResponse>>; } /** * Request parameters for getC2CTradeHistory operation in C2CApi. * @interface GetC2CTradeHistoryRequest */ interface GetC2CTradeHistoryRequest { /** * * @type {number} * @memberof C2CApiGetC2CTradeHistory */ readonly startTime?: number; /** * * @type {number} * @memberof C2CApiGetC2CTradeHistory */ readonly endTime?: number; /** * Default 1 * @type {number} * @memberof C2CApiGetC2CTradeHistory */ readonly page?: number; /** * * @type {number} * @memberof C2CApiGetC2CTradeHistory */ readonly recvWindow?: number; } /** * C2CApi - object-oriented interface * @class C2CApi */ declare class C2CApi implements C2CApiInterface { private readonly configuration; private localVarAxiosParamCreator; constructor(configuration: ConfigurationRestAPI); /** * Get C2C Trade History * * The max interval between startTime and endTime is 30 days. * If startTime and endTime are not sent, the recent 7 days' data will be returned. * The earliest startTime is supported on June 10, 2020 * Return up to 200 records per request. * * Weight: 1 * * @summary Get C2C Trade History (USER_DATA) * @param {GetC2CTradeHistoryRequest} requestParameters Request parameters. * @returns {Promise<RestApiResponse<GetC2CTradeHistoryResponse>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof C2CApi * @see {@link https://developers.binance.com/docs/c2c/rest-api/Get-C2C-Trade-History Binance API Documentation} */ getC2CTradeHistory(requestParameters?: GetC2CTradeHistoryRequest): Promise<RestApiResponse<GetC2CTradeHistoryResponse>>; } /** * Binance C2C REST API * * OpenAPI Specification for the Binance C2C REST API * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ declare class RestAPI { private configuration; private c2CApi; constructor(configuration: ConfigurationRestAPI); /** * Generic function to send a request. * @param endpoint - The API endpoint to call. * @param method - HTTP method to use (GET, POST, DELETE, etc.). * @param params - Query parameters for the request. * * @returns A promise resolving to the response data object. */ sendRequest<T>(endpoint: string, method: 'GET' | 'POST' | 'DELETE' | 'PUT' | 'PATCH', params?: Record<string, unknown>): Promise<RestApiResponse<T>>; /** * Generic function to send a signed request. * @param endpoint - The API endpoint to call. * @param method - HTTP method to use (GET, POST, DELETE, etc.). * @param params - Query parameters for the request. * * @returns A promise resolving to the response data object. */ sendSignedRequest<T>(endpoint: string, method: 'GET' | 'POST' | 'DELETE' | 'PUT' | 'PATCH', params?: Record<string, unknown>): Promise<RestApiResponse<T>>; /** * Get C2C Trade History * * The max interval between startTime and endTime is 30 days. * If startTime and endTime are not sent, the recent 7 days' data will be returned. * The earliest startTime is supported on June 10, 2020 * Return up to 200 records per request. * * Weight: 1 * * @summary Get C2C Trade History (USER_DATA) * @param {GetC2CTradeHistoryRequest} requestParameters Request parameters. * @returns {Promise<RestApiResponse<GetC2CTradeHistoryResponse>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @see {@link https://developers.binance.com/docs/c2c/rest-api/Get-C2C-Trade-History Binance API Documentation} */ getC2CTradeHistory(requestParameters?: GetC2CTradeHistoryRequest): Promise<RestApiResponse<GetC2CTradeHistoryResponse>>; } /** * Binance C2C REST API * * OpenAPI Specification for the Binance C2C REST API * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ type index_C2CApi = C2CApi; declare const index_C2CApi: typeof C2CApi; type index_C2CApiInterface = C2CApiInterface; type index_GetC2CTradeHistoryRequest = GetC2CTradeHistoryRequest; type index_GetC2CTradeHistoryResponse = GetC2CTradeHistoryResponse; type index_GetC2CTradeHistoryResponseDataInner = GetC2CTradeHistoryResponseDataInner; type index_RestAPI = RestAPI; declare const index_RestAPI: typeof RestAPI; declare namespace index { export { index_C2CApi as C2CApi, type index_C2CApiInterface as C2CApiInterface, type index_GetC2CTradeHistoryRequest as GetC2CTradeHistoryRequest, type index_GetC2CTradeHistoryResponse as GetC2CTradeHistoryResponse, type index_GetC2CTradeHistoryResponseDataInner as GetC2CTradeHistoryResponseDataInner, index_RestAPI as RestAPI }; } interface ConfigurationC2C { configurationRestAPI?: ConfigurationRestAPI; } declare class C2C { restAPI: RestAPI; constructor(config: ConfigurationC2C); } export { C2C, index as C2CRestAPI, type ConfigurationC2C };