@binance/staking
Version:
Official Binance Staking Connector - A lightweight library that provides a convenient interface to Binance's Staking REST API.
1,273 lines (1,268 loc) • 133 kB
JavaScript
var __defProp = Object.defineProperty;
var __export = (target, all) => {
for (var name2 in all)
__defProp(target, name2, { get: all[name2], enumerable: true });
};
// src/staking.ts
import { buildUserAgent, ConfigurationRestAPI as ConfigurationRestAPI5, STAKING_REST_API_PROD_URL } from "@binance/common";
// package.json
var name = "@binance/staking";
var version = "3.0.2";
// src/rest-api/index.ts
var rest_api_exports = {};
__export(rest_api_exports, {
EthStakingApi: () => EthStakingApi,
OnChainYieldsApi: () => OnChainYieldsApi,
RestAPI: () => RestAPI,
SolStakingApi: () => SolStakingApi
});
// src/rest-api/modules/eth-staking-api.ts
import {
assertParamExists,
sendRequest
} from "@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) => {
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) => {
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) => {
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 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 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 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 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 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 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 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 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 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 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 sendRequest(
this.configuration,
localVarAxiosArgs.endpoint,
localVarAxiosArgs.method,
localVarAxiosArgs.params,
localVarAxiosArgs?.timeUnit,
{ isSigned: true }
);
}
};
// src/rest-api/modules/on-chain-yields-api.ts
import {
assertParamExists as assertParamExists2,
sendRequest as sendRequest2
} from "@binance/common";
var OnChainYieldsApiAxiosParamCreator = function(configuration) {
return {
/**
* Get On-chain Yields Locked Personal Left Quota
*
* Weight: 50
*
* @summary Get On-chain Yields Locked Personal Left Quota (USER_DATA)
* @param {string} projectId
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
getOnChainYieldsLockedPersonalLeftQuota: async (projectId, recvWindow) => {
assertParamExists2("getOnChainYieldsLockedPersonalLeftQuota", "projectId", projectId);
const localVarQueryParameter = {};
if (projectId !== void 0 && projectId !== null) {
localVarQueryParameter["projectId"] = projectId;
}
if (recvWindow !== void 0 && recvWindow !== null) {
localVarQueryParameter["recvWindow"] = recvWindow;
}
let _timeUnit;
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
return {
endpoint: "/sapi/v1/onchain-yields/locked/personalLeftQuota",
method: "GET",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* Get available On-chain Yields Locked product list
*
* Get available On-chain Yields Locked product list
*
* Weight: 50
*
* @summary Get On-chain Yields Locked Product List (USER_DATA)
* @param {string} [asset] WBETH or BETH, default to BETH
* @param {number} [current] Currently querying page. Start from 1. Default:1
* @param {number} [size] Default:10, Max:100
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
getOnChainYieldsLockedProductList: async (asset, current, size, recvWindow) => {
const localVarQueryParameter = {};
if (asset !== void 0 && asset !== null) {
localVarQueryParameter["asset"] = asset;
}
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/onchain-yields/locked/list",
method: "GET",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* Get On-chain Yields Locked Product Position
*
* Weight: 50
*
* @summary Get On-chain Yields Locked Product Position (USER_DATA)
* @param {string} [asset] WBETH or BETH, default to BETH
* @param {number} [positionId]
* @param {string} [projectId]
* @param {number} [current] Currently querying page. Start from 1. Default:1
* @param {number} [size] Default:10, Max:100
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
getOnChainYieldsLockedProductPosition: async (asset, positionId, projectId, current, size, recvWindow) => {
const localVarQueryParameter = {};
if (asset !== void 0 && asset !== null) {
localVarQueryParameter["asset"] = asset;
}
if (positionId !== void 0 && positionId !== null) {
localVarQueryParameter["positionId"] = positionId;
}
if (projectId !== void 0 && projectId !== null) {
localVarQueryParameter["projectId"] = projectId;
}
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/onchain-yields/locked/position",
method: "GET",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* Get On-chain Yields Locked Redemption Record
*
* 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: 50
*
* @summary Get On-chain Yields Locked Redemption Record (USER_DATA)
* @param {number} [positionId]
* @param {string} [redeemId]
* @param {string} [asset] WBETH or BETH, default to BETH
* @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}
*/
getOnChainYieldsLockedRedemptionRecord: async (positionId, redeemId, asset, startTime, endTime, current, size, recvWindow) => {
const localVarQueryParameter = {};
if (positionId !== void 0 && positionId !== null) {
localVarQueryParameter["positionId"] = positionId;
}
if (redeemId !== void 0 && redeemId !== null) {
localVarQueryParameter["redeemId"] = redeemId;
}
if (asset !== void 0 && asset !== null) {
localVarQueryParameter["asset"] = asset;
}
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/onchain-yields/locked/history/redemptionRecord",
method: "GET",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* Get On-chain Yields Locked 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: 50
*
* @summary Get On-chain Yields Locked Rewards History (USER_DATA)
* @param {string} [positionId]
* @param {string} [asset] WBETH or BETH, default to BETH
* @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}
*/
getOnChainYieldsLockedRewardsHistory: async (positionId, asset, startTime, endTime, current, size, recvWindow) => {
const localVarQueryParameter = {};
if (positionId !== void 0 && positionId !== null) {
localVarQueryParameter["positionId"] = positionId;
}
if (asset !== void 0 && asset !== null) {
localVarQueryParameter["asset"] = asset;
}
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/onchain-yields/locked/history/rewardsRecord",
method: "GET",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* Get On-chain Yields Locked Subscription Preview
*
* Weight: 50
*
* @summary Get On-chain Yields Locked Subscription Preview (USER_DATA)
* @param {string} projectId
* @param {number} amount Amount in SOL.
* @param {boolean} [autoSubscribe] true or false, default true.
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
getOnChainYieldsLockedSubscriptionPreview: async (projectId, amount, autoSubscribe, recvWindow) => {
assertParamExists2("getOnChainYieldsLockedSubscriptionPreview", "projectId", projectId);
assertParamExists2("getOnChainYieldsLockedSubscriptionPreview", "amount", amount);
const localVarQueryParameter = {};
if (projectId !== void 0 && projectId !== null) {
localVarQueryParameter["projectId"] = projectId;
}
if (amount !== void 0 && amount !== null) {
localVarQueryParameter["amount"] = amount;
}
if (autoSubscribe !== void 0 && autoSubscribe !== null) {
localVarQueryParameter["autoSubscribe"] = autoSubscribe;
}
if (recvWindow !== void 0 && recvWindow !== null) {
localVarQueryParameter["recvWindow"] = recvWindow;
}
let _timeUnit;
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
return {
endpoint: "/sapi/v1/onchain-yields/locked/subscriptionPreview",
method: "GET",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* Get On-chain Yields Locked Subscription Record
*
* 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: 50
*
* @summary Get On-chain Yields Locked Subscription Record (USER_DATA)
* @param {string} [purchaseId]
* @param {string} [clientId]
* @param {string} [asset] WBETH or BETH, default to BETH
* @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}
*/
getOnChainYieldsLockedSubscriptionRecord: async (purchaseId, clientId, asset, startTime, endTime, current, size, recvWindow) => {
const localVarQueryParameter = {};
if (purchaseId !== void 0 && purchaseId !== null) {
localVarQueryParameter["purchaseId"] = purchaseId;
}
if (clientId !== void 0 && clientId !== null) {
localVarQueryParameter["clientId"] = clientId;
}
if (asset !== void 0 && asset !== null) {
localVarQueryParameter["asset"] = asset;
}
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/onchain-yields/locked/history/subscriptionRecord",
method: "GET",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* On-chain Yields Account query
*
* Weight: 50
*
* @summary On-chain Yields Account (USER_DATA)
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
onChainYieldsAccount: 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/onchain-yields/account",
method: "GET",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* Redeem On-chain Yields Locked Product
*
* You need to open `Enable Spot & Margin Trading` permission for the API Key which requests this endpoint.
*
* Weight: 1/3s per account
*
* @summary Redeem On-chain Yields Locked Product (TRADE)
* @param {string} positionId
* @param {string} [channelId]
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
redeemOnChainYieldsLockedProduct: async (positionId, channelId, recvWindow) => {
assertParamExists2("redeemOnChainYieldsLockedProduct", "positionId", positionId);
const localVarQueryParameter = {};
if (positionId !== void 0 && positionId !== null) {
localVarQueryParameter["positionId"] = positionId;
}
if (channelId !== void 0 && channelId !== null) {
localVarQueryParameter["channelId"] = channelId;
}
if (recvWindow !== void 0 && recvWindow !== null) {
localVarQueryParameter["recvWindow"] = recvWindow;
}
let _timeUnit;
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
return {
endpoint: "/sapi/v1/onchain-yields/locked/redeem",
method: "POST",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* Set On-chain Yield locked auto subscribe
*
* Weight: 50
*
* @summary Set On-chain Yields Locked Auto Subscribe(USER_DATA)
* @param {string} positionId
* @param {boolean} autoSubscribe true or false
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
setOnChainYieldsLockedAutoSubscribe: async (positionId, autoSubscribe, recvWindow) => {
assertParamExists2("setOnChainYieldsLockedAutoSubscribe", "positionId", positionId);
assertParamExists2(
"setOnChainYieldsLockedAutoSubscribe",
"autoSubscribe",
autoSubscribe
);
const localVarQueryParameter = {};
if (positionId !== void 0 && positionId !== null) {
localVarQueryParameter["positionId"] = positionId;
}
if (autoSubscribe !== void 0 && autoSubscribe !== null) {
localVarQueryParameter["autoSubscribe"] = autoSubscribe;
}
if (recvWindow !== void 0 && recvWindow !== null) {
localVarQueryParameter["recvWindow"] = recvWindow;
}
let _timeUnit;
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
return {
endpoint: "/sapi/v1/onchain-yields/locked/setAutoSubscribe",
method: "POST",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* Set On-chain Yields redeem option for Locked product
*
* Weight: 50
*
* @summary Set On-chain Yields Locked Product Redeem Option(USER_DATA)
* @param {string} positionId
* @param {string} redeemTo 'SPOT','FLEXIBLE'
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
setOnChainYieldsLockedProductRedeemOption: async (positionId, redeemTo, recvWindow) => {
assertParamExists2(
"setOnChainYieldsLockedProductRedeemOption",
"positionId",
positionId
);
assertParamExists2("setOnChainYieldsLockedProductRedeemOption", "redeemTo", redeemTo);
const localVarQueryParameter = {};
if (positionId !== void 0 && positionId !== null) {
localVarQueryParameter["positionId"] = positionId;
}
if (redeemTo !== void 0 && redeemTo !== null) {
localVarQueryParameter["redeemTo"] = redeemTo;
}
if (recvWindow !== void 0 && recvWindow !== null) {
localVarQueryParameter["recvWindow"] = recvWindow;
}
let _timeUnit;
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
return {
endpoint: "/sapi/v1/onchain-yields/locked/setRedeemOption",
method: "POST",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* Subscribe On-chain Yields Locked Product
*
* You need to open `Enable Spot & Margin Trading` permission for the API Key which requests this endpoint.
*
* Weight: 200
*
* @summary Subscribe On-chain Yields Locked Product(TRADE)
* @param {string} projectId
* @param {number} amount Amount in SOL.
* @param {boolean} [autoSubscribe] true or false, default true.
* @param {string} [sourceAccount] `SPOT`,`FUND`,`ALL`, default `SPOT`
* @param {string} [redeemTo] `SPOT`,`FLEXIBLE`, default `FLEXIBLE` Takes effect when Auto Subscribe is false
* @param {string} [channelId]
* @param {string} [clientId]
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
subscribeOnChainYieldsLockedProduct: async (projectId, amount, autoSubscribe, sourceAccount, redeemTo, channelId, clientId, recvWindow) => {
assertParamExists2("subscribeOnChainYieldsLockedProduct", "projectId", projectId);
assertParamExists2("subscribeOnChainYieldsLockedProduct", "amount", amount);
co