UNPKG

@binance/c2c

Version:

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

299 lines (297 loc) 9.28 kB
import { BadRequestError, C2C_REST_API_PROD_URL, ConfigurationRestAPI, ConnectorClientError, ForbiddenError, NetworkError, NotFoundError, RateLimitBanError, RequiredError, RestApiResponse, ServerError, TooManyRequestsError, UnauthorizedError } from "@binance/common"; //#region rolldown:runtime //#endregion //#region src/rest-api/types/get-c2-ctrade-history-response-data-inner.d.ts /** * 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 | bigint} * @memberof GetC2CTradeHistoryResponseDataInner */ createTime?: number | bigint; /** * * @type {string} * @memberof GetC2CTradeHistoryResponseDataInner */ commission?: string; /** * * @type {string} * @memberof GetC2CTradeHistoryResponseDataInner */ counterPartNickName?: string; /** * * @type {string} * @memberof GetC2CTradeHistoryResponseDataInner */ advertisementRole?: string; } //#endregion //#region src/rest-api/types/get-c2-ctrade-history-response.d.ts /** * * @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 | bigint} * @memberof GetC2CTradeHistoryResponse */ total?: number | bigint; /** * * @type {boolean} * @memberof GetC2CTradeHistoryResponse */ success?: boolean; } //#endregion //#region src/rest-api/modules/c2-capi.d.ts /** * C2CApi - interface * @interface C2CApi */ interface C2CApiInterface { /** * Get C2C Trade History * * The max interval between startTimestamp and endTimestamp is 30 days. * If startTimestamp and endTimestamp are not sent, the recent 30 days' data will be returned. * You can only view data from the past 6 months. To see all C2C orders, please check https://c2c.binance.com/en/fiatOrder * * 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 { /** * BUY, SELL * @type {string} * @memberof C2CApiGetC2CTradeHistory */ readonly tradeType?: string; /** * * @type {number | bigint} * @memberof C2CApiGetC2CTradeHistory */ readonly startTimestamp?: number | bigint; /** * * @type {number | bigint} * @memberof C2CApiGetC2CTradeHistory */ readonly endTimestamp?: number | bigint; /** * Default 1 * @type {number | bigint} * @memberof C2CApiGetC2CTradeHistory */ readonly page?: number | bigint; /** * default 100, max 100 * @type {number | bigint} * @memberof C2CApiGetC2CTradeHistory */ readonly rows?: number | bigint; /** * * @type {number | bigint} * @memberof C2CApiGetC2CTradeHistory */ readonly recvWindow?: number | bigint; } /** * 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 startTimestamp and endTimestamp is 30 days. * If startTimestamp and endTimestamp are not sent, the recent 30 days' data will be returned. * You can only view data from the past 6 months. To see all C2C orders, please check https://c2c.binance.com/en/fiatOrder * * 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>>; } //#endregion //#region src/rest-api/rest-api.d.ts 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 queryParams - Query parameters for the request. * @param bodyParams - Body parameters for the request. * * @returns A promise resolving to the response data object. */ sendRequest<T>(endpoint: string, method: 'GET' | 'POST' | 'DELETE' | 'PUT' | 'PATCH', queryParams?: Record<string, unknown>, bodyParams?: 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 queryParams - Query parameters for the request. * @param bodyParams - Body parameters for the request. * * @returns A promise resolving to the response data object. */ sendSignedRequest<T>(endpoint: string, method: 'GET' | 'POST' | 'DELETE' | 'PUT' | 'PATCH', queryParams?: Record<string, unknown>, bodyParams?: Record<string, unknown>): Promise<RestApiResponse<T>>; /** * Get C2C Trade History * * The max interval between startTimestamp and endTimestamp is 30 days. * If startTimestamp and endTimestamp are not sent, the recent 30 days' data will be returned. * You can only view data from the past 6 months. To see all C2C orders, please check https://c2c.binance.com/en/fiatOrder * * 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>>; } declare namespace index_d_exports { export { C2CApi, C2CApiInterface, GetC2CTradeHistoryRequest, GetC2CTradeHistoryResponse, GetC2CTradeHistoryResponseDataInner, RestAPI }; } //#endregion //#region src/c2c.d.ts interface ConfigurationC2C { configurationRestAPI?: ConfigurationRestAPI; } declare class C2C { restAPI: RestAPI; constructor(config: ConfigurationC2C); } //#endregion export { BadRequestError, C2C, index_d_exports as C2CRestAPI, C2C_REST_API_PROD_URL, type ConfigurationC2C, ConnectorClientError, ForbiddenError, NetworkError, NotFoundError, RateLimitBanError, RequiredError, ServerError, TooManyRequestsError, UnauthorizedError }; //# sourceMappingURL=index.d.ts.map