UNPKG

@binance/staking

Version:

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

1,284 lines (1,278 loc) 87.1 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name2 in all) __defProp(target, name2, { get: all[name2], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/index.ts var src_exports = {}; __export(src_exports, { BadRequestError: () => import_common5.BadRequestError, ConnectorClientError: () => import_common5.ConnectorClientError, ForbiddenError: () => import_common5.ForbiddenError, NetworkError: () => import_common5.NetworkError, NotFoundError: () => import_common5.NotFoundError, RateLimitBanError: () => import_common5.RateLimitBanError, RequiredError: () => import_common5.RequiredError, STAKING_REST_API_PROD_URL: () => import_common5.STAKING_REST_API_PROD_URL, STAKING_REST_API_TESTNET_URL: () => import_common5.STAKING_REST_API_TESTNET_URL, ServerError: () => import_common5.ServerError, Staking: () => Staking, StakingRestAPI: () => rest_api_exports, TooManyRequestsError: () => import_common5.TooManyRequestsError, UnauthorizedError: () => import_common5.UnauthorizedError }); module.exports = __toCommonJS(src_exports); // src/staking.ts var import_os = require("os"); var import_common4 = require("@binance/common"); // package.json var name = "@binance/staking"; var version = "1.0.0"; // src/rest-api/index.ts var rest_api_exports = {}; __export(rest_api_exports, { EthStakingApi: () => EthStakingApi, RestAPI: () => RestAPI, SolStakingApi: () => SolStakingApi }); // src/rest-api/modules/eth-staking-api.ts var import_common = require("@binance/common"); var EthStakingApiAxiosParamCreator = function(configuration) { return { /** * ETH Staking account * * Weight: 150 * * @summary ETH Staking account(USER_DATA) * @param {number} [recvWindow] * * @throws {RequiredError} */ ethStakingAccount: async (recvWindow) => { const localVarQueryParameter = {}; if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/sapi/v2/eth-staking/account", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Get current ETH staking quota * * Weight: 150 * * @summary Get current ETH staking quota(USER_DATA) * @param {number} [recvWindow] * * @throws {RequiredError} */ getCurrentEthStakingQuota: async (recvWindow) => { const localVarQueryParameter = {}; if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/sapi/v1/eth-staking/eth/quota", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Get ETH redemption history * * The time between `startTime` and `endTime` cannot be longer than 3 months. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. * * Weight: 150 * * @summary Get ETH redemption history(USER_DATA) * @param {number} [startTime] * @param {number} [endTime] * @param {number} [current] Currently querying page. Start from 1. Default:1 * @param {number} [size] Default:10, Max:100 * @param {number} [recvWindow] * * @throws {RequiredError} */ getEthRedemptionHistory: async (startTime, endTime, current, size, recvWindow) => { const localVarQueryParameter = {}; if (startTime !== void 0 && startTime !== null) { localVarQueryParameter["startTime"] = startTime; } if (endTime !== void 0 && endTime !== null) { localVarQueryParameter["endTime"] = endTime; } if (current !== void 0 && current !== null) { localVarQueryParameter["current"] = current; } if (size !== void 0 && size !== null) { localVarQueryParameter["size"] = size; } if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/sapi/v1/eth-staking/eth/history/redemptionHistory", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Get ETH staking history * * The time between `startTime` and `endTime` cannot be longer than 3 months. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. * * Weight: 150 * * @summary Get ETH staking history(USER_DATA) * @param {number} [startTime] * @param {number} [endTime] * @param {number} [current] Currently querying page. Start from 1. Default:1 * @param {number} [size] Default:10, Max:100 * @param {number} [recvWindow] * * @throws {RequiredError} */ getEthStakingHistory: async (startTime, endTime, current, size, recvWindow) => { const localVarQueryParameter = {}; if (startTime !== void 0 && startTime !== null) { localVarQueryParameter["startTime"] = startTime; } if (endTime !== void 0 && endTime !== null) { localVarQueryParameter["endTime"] = endTime; } if (current !== void 0 && current !== null) { localVarQueryParameter["current"] = current; } if (size !== void 0 && size !== null) { localVarQueryParameter["size"] = size; } if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/sapi/v1/eth-staking/eth/history/stakingHistory", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Get WBETH Rate History * * The time between `startTime` and `endTime` cannot be longer than 3 months. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. * * Weight: 150 * * @summary Get WBETH Rate History(USER_DATA) * @param {number} [startTime] * @param {number} [endTime] * @param {number} [current] Currently querying page. Start from 1. Default:1 * @param {number} [size] Default:10, Max:100 * @param {number} [recvWindow] * * @throws {RequiredError} */ getWbethRateHistory: async (startTime, endTime, current, size, recvWindow) => { const localVarQueryParameter = {}; if (startTime !== void 0 && startTime !== null) { localVarQueryParameter["startTime"] = startTime; } if (endTime !== void 0 && endTime !== null) { localVarQueryParameter["endTime"] = endTime; } if (current !== void 0 && current !== null) { localVarQueryParameter["current"] = current; } if (size !== void 0 && size !== null) { localVarQueryParameter["size"] = size; } if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/sapi/v1/eth-staking/eth/history/rateHistory", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Get WBETH rewards history * * The time between `startTime` and `endTime` cannot be longer than 3 months. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. * * Weight: 150 * * @summary Get WBETH rewards history(USER_DATA) * @param {number} [startTime] * @param {number} [endTime] * @param {number} [current] Currently querying page. Start from 1. Default:1 * @param {number} [size] Default:10, Max:100 * @param {number} [recvWindow] * * @throws {RequiredError} */ getWbethRewardsHistory: async (startTime, endTime, current, size, recvWindow) => { const localVarQueryParameter = {}; if (startTime !== void 0 && startTime !== null) { localVarQueryParameter["startTime"] = startTime; } if (endTime !== void 0 && endTime !== null) { localVarQueryParameter["endTime"] = endTime; } if (current !== void 0 && current !== null) { localVarQueryParameter["current"] = current; } if (size !== void 0 && size !== null) { localVarQueryParameter["size"] = size; } if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/sapi/v1/eth-staking/eth/history/wbethRewardsHistory", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Get WBETH unwrap history * * The time between `startTime` and `endTime` cannot be longer than 3 months. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. * * Weight: 150 * * @summary Get WBETH unwrap history(USER_DATA) * @param {number} [startTime] * @param {number} [endTime] * @param {number} [current] Currently querying page. Start from 1. Default:1 * @param {number} [size] Default:10, Max:100 * @param {number} [recvWindow] * * @throws {RequiredError} */ getWbethUnwrapHistory: async (startTime, endTime, current, size, recvWindow) => { const localVarQueryParameter = {}; if (startTime !== void 0 && startTime !== null) { localVarQueryParameter["startTime"] = startTime; } if (endTime !== void 0 && endTime !== null) { localVarQueryParameter["endTime"] = endTime; } if (current !== void 0 && current !== null) { localVarQueryParameter["current"] = current; } if (size !== void 0 && size !== null) { localVarQueryParameter["size"] = size; } if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/sapi/v1/eth-staking/wbeth/history/unwrapHistory", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Get WBETH wrap history * * The time between `startTime` and `endTime` cannot be longer than 3 months. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. * * Weight: 150 * * @summary Get WBETH wrap history(USER_DATA) * @param {number} [startTime] * @param {number} [endTime] * @param {number} [current] Currently querying page. Start from 1. Default:1 * @param {number} [size] Default:10, Max:100 * @param {number} [recvWindow] * * @throws {RequiredError} */ getWbethWrapHistory: async (startTime, endTime, current, size, recvWindow) => { const localVarQueryParameter = {}; if (startTime !== void 0 && startTime !== null) { localVarQueryParameter["startTime"] = startTime; } if (endTime !== void 0 && endTime !== null) { localVarQueryParameter["endTime"] = endTime; } if (current !== void 0 && current !== null) { localVarQueryParameter["current"] = current; } if (size !== void 0 && size !== null) { localVarQueryParameter["size"] = size; } if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/sapi/v1/eth-staking/wbeth/history/wrapHistory", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Redeem WBETH or BETH and get ETH * * You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint. * * Weight: 150 * * @summary Redeem ETH(TRADE) * @param {number} amount Amount in SOL. * @param {string} [asset] WBETH or BETH, default to BETH * @param {number} [recvWindow] * * @throws {RequiredError} */ redeemEth: async (amount, asset, recvWindow) => { (0, import_common.assertParamExists)("redeemEth", "amount", amount); const localVarQueryParameter = {}; if (amount !== void 0 && amount !== null) { localVarQueryParameter["amount"] = amount; } if (asset !== void 0 && asset !== null) { localVarQueryParameter["asset"] = asset; } if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/sapi/v1/eth-staking/eth/redeem", method: "POST", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Subscribe ETH Staking * * You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint. * * Weight: 150 * * @summary Subscribe ETH Staking(TRADE) * @param {number} amount Amount in SOL. * @param {number} [recvWindow] * * @throws {RequiredError} */ subscribeEthStaking: async (amount, recvWindow) => { (0, import_common.assertParamExists)("subscribeEthStaking", "amount", amount); const localVarQueryParameter = {}; if (amount !== void 0 && amount !== null) { localVarQueryParameter["amount"] = amount; } if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/sapi/v2/eth-staking/eth/stake", method: "POST", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Wrap BETH * * You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint. * * Weight: 150 * * @summary Wrap BETH(TRADE) * @param {number} amount Amount in SOL. * @param {number} [recvWindow] * * @throws {RequiredError} */ wrapBeth: async (amount, recvWindow) => { (0, import_common.assertParamExists)("wrapBeth", "amount", amount); const localVarQueryParameter = {}; if (amount !== void 0 && amount !== null) { localVarQueryParameter["amount"] = amount; } if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/sapi/v1/eth-staking/wbeth/wrap", method: "POST", params: localVarQueryParameter, timeUnit: _timeUnit }; } }; }; var EthStakingApi = class { constructor(configuration) { this.configuration = configuration; this.localVarAxiosParamCreator = EthStakingApiAxiosParamCreator(configuration); } /** * ETH Staking account * * Weight: 150 * * @summary ETH Staking account(USER_DATA) * @param {EthStakingAccountRequest} requestParameters Request parameters. * @returns {Promise<RestApiResponse<EthStakingAccountResponse>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof EthStakingApi * @see {@link https://developers.binance.com/docs/staking/eth-staking/account/ETH-Staking-account Binance API Documentation} */ async ethStakingAccount(requestParameters = {}) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.ethStakingAccount( requestParameters?.recvWindow ); return (0, import_common.sendRequest)( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * Get current ETH staking quota * * Weight: 150 * * @summary Get current ETH staking quota(USER_DATA) * @param {GetCurrentEthStakingQuotaRequest} requestParameters Request parameters. * @returns {Promise<RestApiResponse<GetCurrentEthStakingQuotaResponse>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof EthStakingApi * @see {@link https://developers.binance.com/docs/staking/eth-staking/account/Get-current-ETH-staking-quota Binance API Documentation} */ async getCurrentEthStakingQuota(requestParameters = {}) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.getCurrentEthStakingQuota( requestParameters?.recvWindow ); return (0, import_common.sendRequest)( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * Get ETH redemption history * * The time between `startTime` and `endTime` cannot be longer than 3 months. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. * * Weight: 150 * * @summary Get ETH redemption history(USER_DATA) * @param {GetEthRedemptionHistoryRequest} requestParameters Request parameters. * @returns {Promise<RestApiResponse<GetEthRedemptionHistoryResponse>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof EthStakingApi * @see {@link https://developers.binance.com/docs/staking/eth-staking/history/Get-ETH-redemption-history Binance API Documentation} */ async getEthRedemptionHistory(requestParameters = {}) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.getEthRedemptionHistory( requestParameters?.startTime, requestParameters?.endTime, requestParameters?.current, requestParameters?.size, requestParameters?.recvWindow ); return (0, import_common.sendRequest)( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * Get ETH staking history * * The time between `startTime` and `endTime` cannot be longer than 3 months. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. * * Weight: 150 * * @summary Get ETH staking history(USER_DATA) * @param {GetEthStakingHistoryRequest} requestParameters Request parameters. * @returns {Promise<RestApiResponse<GetEthStakingHistoryResponse>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof EthStakingApi * @see {@link https://developers.binance.com/docs/staking/eth-staking/history/Get-ETH-staking-history Binance API Documentation} */ async getEthStakingHistory(requestParameters = {}) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.getEthStakingHistory( requestParameters?.startTime, requestParameters?.endTime, requestParameters?.current, requestParameters?.size, requestParameters?.recvWindow ); return (0, import_common.sendRequest)( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * Get WBETH Rate History * * The time between `startTime` and `endTime` cannot be longer than 3 months. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. * * Weight: 150 * * @summary Get WBETH Rate History(USER_DATA) * @param {GetWbethRateHistoryRequest} requestParameters Request parameters. * @returns {Promise<RestApiResponse<GetWbethRateHistoryResponse>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof EthStakingApi * @see {@link https://developers.binance.com/docs/staking/eth-staking/history/Get-BETH-Rate-History Binance API Documentation} */ async getWbethRateHistory(requestParameters = {}) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.getWbethRateHistory( requestParameters?.startTime, requestParameters?.endTime, requestParameters?.current, requestParameters?.size, requestParameters?.recvWindow ); return (0, import_common.sendRequest)( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * Get WBETH rewards history * * The time between `startTime` and `endTime` cannot be longer than 3 months. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. * * Weight: 150 * * @summary Get WBETH rewards history(USER_DATA) * @param {GetWbethRewardsHistoryRequest} requestParameters Request parameters. * @returns {Promise<RestApiResponse<GetWbethRewardsHistoryResponse>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof EthStakingApi * @see {@link https://developers.binance.com/docs/staking/eth-staking/history/Get-WBETH-rewards-history Binance API Documentation} */ async getWbethRewardsHistory(requestParameters = {}) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.getWbethRewardsHistory( requestParameters?.startTime, requestParameters?.endTime, requestParameters?.current, requestParameters?.size, requestParameters?.recvWindow ); return (0, import_common.sendRequest)( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * Get WBETH unwrap history * * The time between `startTime` and `endTime` cannot be longer than 3 months. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. * * Weight: 150 * * @summary Get WBETH unwrap history(USER_DATA) * @param {GetWbethUnwrapHistoryRequest} requestParameters Request parameters. * @returns {Promise<RestApiResponse<GetWbethUnwrapHistoryResponse>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof EthStakingApi * @see {@link https://developers.binance.com/docs/staking/eth-staking/history/Get-WBETH-unwrap-history Binance API Documentation} */ async getWbethUnwrapHistory(requestParameters = {}) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.getWbethUnwrapHistory( requestParameters?.startTime, requestParameters?.endTime, requestParameters?.current, requestParameters?.size, requestParameters?.recvWindow ); return (0, import_common.sendRequest)( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * Get WBETH wrap history * * The time between `startTime` and `endTime` cannot be longer than 3 months. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. * * Weight: 150 * * @summary Get WBETH wrap history(USER_DATA) * @param {GetWbethWrapHistoryRequest} requestParameters Request parameters. * @returns {Promise<RestApiResponse<GetWbethWrapHistoryResponse>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof EthStakingApi * @see {@link https://developers.binance.com/docs/staking/eth-staking/history/Get-WBETH-wrap-history Binance API Documentation} */ async getWbethWrapHistory(requestParameters = {}) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.getWbethWrapHistory( requestParameters?.startTime, requestParameters?.endTime, requestParameters?.current, requestParameters?.size, requestParameters?.recvWindow ); return (0, import_common.sendRequest)( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * Redeem WBETH or BETH and get ETH * * You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint. * * Weight: 150 * * @summary Redeem ETH(TRADE) * @param {RedeemEthRequest} requestParameters Request parameters. * @returns {Promise<RestApiResponse<RedeemEthResponse>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof EthStakingApi * @see {@link https://developers.binance.com/docs/staking/eth-staking/staking/Redeem-ETH Binance API Documentation} */ async redeemEth(requestParameters) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.redeemEth( requestParameters?.amount, requestParameters?.asset, requestParameters?.recvWindow ); return (0, import_common.sendRequest)( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * Subscribe ETH Staking * * You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint. * * Weight: 150 * * @summary Subscribe ETH Staking(TRADE) * @param {SubscribeEthStakingRequest} requestParameters Request parameters. * @returns {Promise<RestApiResponse<SubscribeEthStakingResponse>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof EthStakingApi * @see {@link https://developers.binance.com/docs/staking/eth-staking/staking/Subscribe-ETH-Staking Binance API Documentation} */ async subscribeEthStaking(requestParameters) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.subscribeEthStaking( requestParameters?.amount, requestParameters?.recvWindow ); return (0, import_common.sendRequest)( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * Wrap BETH * * You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint. * * Weight: 150 * * @summary Wrap BETH(TRADE) * @param {WrapBethRequest} requestParameters Request parameters. * @returns {Promise<RestApiResponse<WrapBethResponse>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof EthStakingApi * @see {@link https://developers.binance.com/docs/staking/eth-staking/staking/Wrap-BETH Binance API Documentation} */ async wrapBeth(requestParameters) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.wrapBeth( requestParameters?.amount, requestParameters?.recvWindow ); return (0, import_common.sendRequest)( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } }; // src/rest-api/modules/sol-staking-api.ts var import_common2 = require("@binance/common"); var SolStakingApiAxiosParamCreator = function(configuration) { return { /** * Claim Boost APR Airdrop Rewards * * You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint. * * Weight: 150 * * @summary Claim Boost Rewards(TRADE) * @param {number} [recvWindow] * * @throws {RequiredError} */ claimBoostRewards: async (recvWindow) => { const localVarQueryParameter = {}; if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/sapi/v1/sol-staking/sol/claim", method: "POST", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Get BNSOL Rate History * * The time between `startTime` and `endTime` cannot be longer than 3 months. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. * * Weight: 150 * * @summary Get BNSOL Rate History(USER_DATA) * @param {number} [startTime] * @param {number} [endTime] * @param {number} [current] Currently querying page. Start from 1. Default:1 * @param {number} [size] Default:10, Max:100 * @param {number} [recvWindow] * * @throws {RequiredError} */ getBnsolRateHistory: async (startTime, endTime, current, size, recvWindow) => { const localVarQueryParameter = {}; if (startTime !== void 0 && startTime !== null) { localVarQueryParameter["startTime"] = startTime; } if (endTime !== void 0 && endTime !== null) { localVarQueryParameter["endTime"] = endTime; } if (current !== void 0 && current !== null) { localVarQueryParameter["current"] = current; } if (size !== void 0 && size !== null) { localVarQueryParameter["size"] = size; } if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/sapi/v1/sol-staking/sol/history/rateHistory", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Get BNSOL rewards history * * The time between `startTime` and `endTime` cannot be longer than 3 months. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. * * Weight: 150 * * @summary Get BNSOL rewards history(USER_DATA) * @param {number} [startTime] * @param {number} [endTime] * @param {number} [current] Currently querying page. Start from 1. Default:1 * @param {number} [size] Default:10, Max:100 * @param {number} [recvWindow] * * @throws {RequiredError} */ getBnsolRewardsHistory: async (startTime, endTime, current, size, recvWindow) => { const localVarQueryParameter = {}; if (startTime !== void 0 && startTime !== null) { localVarQueryParameter["startTime"] = startTime; } if (endTime !== void 0 && endTime !== null) { localVarQueryParameter["endTime"] = endTime; } if (current !== void 0 && current !== null) { localVarQueryParameter["current"] = current; } if (size !== void 0 && size !== null) { localVarQueryParameter["size"] = size; } if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/sapi/v1/sol-staking/sol/history/bnsolRewardsHistory", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Get Boost rewards history * * The time between `startTime` and `endTime` cannot be longer than 3 months. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. * * Weight: 150 * * @summary Get Boost Rewards History(USER_DATA) * @param {string} type "CLAIM", "DISTRIBUTE", default "CLAIM" * @param {number} [startTime] * @param {number} [endTime] * @param {number} [current] Currently querying page. Start from 1. Default:1 * @param {number} [size] Default:10, Max:100 * @param {number} [recvWindow] * * @throws {RequiredError} */ getBoostRewardsHistory: async (type, startTime, endTime, current, size, recvWindow) => { (0, import_common2.assertParamExists)("getBoostRewardsHistory", "type", type); const localVarQueryParameter = {}; if (type !== void 0 && type !== null) { localVarQueryParameter["type"] = type; } if (startTime !== void 0 && startTime !== null) { localVarQueryParameter["startTime"] = startTime; } if (endTime !== void 0 && endTime !== null) { localVarQueryParameter["endTime"] = endTime; } if (current !== void 0 && current !== null) { localVarQueryParameter["current"] = current; } if (size !== void 0 && size !== null) { localVarQueryParameter["size"] = size; } if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/sapi/v1/sol-staking/sol/history/boostRewardsHistory", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Get SOL redemption history * * The time between `startTime` and `endTime` cannot be longer than 3 months. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. * * Weight: 150 * * @summary Get SOL redemption history(USER_DATA) * @param {number} [startTime] * @param {number} [endTime] * @param {number} [current] Currently querying page. Start from 1. Default:1 * @param {number} [size] Default:10, Max:100 * @param {number} [recvWindow] * * @throws {RequiredError} */ getSolRedemptionHistory: async (startTime, endTime, current, size, recvWindow) => { const localVarQueryParameter = {}; if (startTime !== void 0 && startTime !== null) { localVarQueryParameter["startTime"] = startTime; } if (endTime !== void 0 && endTime !== null) { localVarQueryParameter["endTime"] = endTime; } if (current !== void 0 && current !== null) { localVarQueryParameter["current"] = current; } if (size !== void 0 && size !== null) { localVarQueryParameter["size"] = size; } if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/sapi/v1/sol-staking/sol/history/redemptionHistory", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Get SOL staking history * * The time between `startTime` and `endTime` cannot be longer than 3 months. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. * * Weight: 150 * * @summary Get SOL staking history(USER_DATA) * @param {number} [startTime] * @param {number} [endTime] * @param {number} [current] Currently querying page. Start from 1. Default:1 * @param {number} [size] Default:10, Max:100 * @param {number} [recvWindow] * * @throws {RequiredError} */ getSolStakingHistory: async (startTime, endTime, current, size, recvWindow) => { const localVarQueryParameter = {}; if (startTime !== void 0 && startTime !== null) { localVarQueryParameter["startTime"] = startTime; } if (endTime !== void 0 && endTime !== null) { localVarQueryParameter["endTime"] = endTime; } if (current !== void 0 && current !== null) { localVarQueryParameter["current"] = current; } if (size !== void 0 && size !== null) { localVarQueryParameter["size"] = size; } if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/sapi/v1/sol-staking/sol/history/stakingHistory", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Get SOL staking quota * * Weight: 150 * * @summary Get SOL staking quota details(USER_DATA) * @param {number} [recvWindow] * * @throws {RequiredError} */ getSolStakingQuotaDetails: async (recvWindow) => { const localVarQueryParameter = {}; if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/sapi/v1/sol-staking/sol/quota", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Get Unclaimed rewards * * The time between `startTime` and `endTime` cannot be longer than 3 months. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `endTime` will be returned. * * Weight: 150 * * @summary Get Unclaimed Rewards(USER_DATA) * @param {number} [recvWindow] * * @throws {RequiredError} */ getUnclaimedRewards: async (recvWindow) => { const localVarQueryParameter = {}; if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/sapi/v1/sol-staking/sol/history/unclaimedRewards", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Redeem BNSOL get SOL * * You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint. * * Weight: 150 * * @summary Redeem SOL(TRADE) * @param {number} amount Amount in SOL. * @param {number} [recvWindow] * * @throws {RequiredError} */ redeemSol: async (amount, recvWindow) => { (0, import_common2.assertParamExists)("redeemSol", "amount", amount); const localVarQueryParameter = {}; if (amount !== void 0 && amount !== null) { localVarQueryParameter["amount"] = amount; } if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/sapi/v1/sol-staking/sol/redeem", method: "POST", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * SOL Staking account * * Weight: 150 * * @summary SOL Staking account(USER_DATA) * @param {number} [recvWindow] * * @throws {RequiredError} */ solStakingAccount: async (recvWindow) => { const localVarQueryParameter = {}; if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/sapi/v1/sol-staking/account", method: "GET", params: localVarQueryParameter, timeUnit: _timeUnit }; }, /** * Subscribe SOL Staking * * You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint. * * Weight: 150 * * @summary Subscribe SOL Staking(TRADE) * @param {number} amount Amount in SOL. * @param {number} [recvWindow] * * @throws {RequiredError} */ subscribeSolStaking: async (amount, recvWindow) => { (0, import_common2.assertParamExists)("subscribeSolStaking", "amount", amount); const localVarQueryParameter = {}; if (amount !== void 0 && amount !== null) { localVarQueryParameter["amount"] = amount; } if (recvWindow !== void 0 && recvWindow !== null) { localVarQueryParameter["recvWindow"] = recvWindow; } let _timeUnit; if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit; return { endpoint: "/sapi/v1/sol-staking/sol/stake", method: "POST", params: localVarQueryParameter, timeUnit: _timeUnit }; } }; }; var SolStakingApi = class { constructor(configuration) { this.configuration = configuration; this.localVarAxiosParamCreator = SolStakingApiAxiosParamCreator(configuration); } /** * Claim Boost APR Airdrop Rewards * * You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint. * * Weight: 150 * * @summary Claim Boost Rewards(TRADE) * @param {ClaimBoostRewardsRequest} requestParameters Request parameters. * @returns {Promise<RestApiResponse<ClaimBoostRewardsResponse>>} * @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError} * @memberof SolStakingApi * @see {@link https://developers.binance.com/docs/staking/sol-staking/staking/Claim-Boost-Rewards Binance API Documentation} */ async claimBoostRewards(requestParameters = {}) { const localVarAxiosArgs = await this.localVarAxiosParamCreator.claimBoostRewards( requestParameters?.recvWindow ); return (0, import_common2.sendRequest)( this.configuration, localVarAxiosArgs.endpoint, localVarAxiosArgs.method, localVarAxiosArgs.params, localVarAxiosArgs?.timeUnit, { isSigned: true } ); } /** * Get BNSOL Rate History * * The time between `startTime` and `endTime` cannot be longer than 3 months. * If `startTime` and `endTime` are both not sent, then the last 30 days' data will be returned. * If `startTime` is sent but `endTime` is not sent, the next 30 days' data beginning from `startTime` will be returned. * If `endTime` is sent but `startTime` is not sent, the 30 days' data before `en