@binance/wallet
Version:
Official Binance Wallet Connector - A lightweight library that provides a convenient interface to Binance's Wallet REST API.
1,333 lines (1,328 loc) • 177 kB
JavaScript
var __defProp = Object.defineProperty;
var __export = (target, all) => {
for (var name2 in all)
__defProp(target, name2, { get: all[name2], enumerable: true });
};
// src/wallet.ts
import { buildUserAgent, ConfigurationRestAPI as ConfigurationRestAPI7, WALLET_REST_API_PROD_URL } from "@binance/common";
// package.json
var name = "@binance/wallet";
var version = "11.0.0";
// src/rest-api/index.ts
var rest_api_exports = {};
__export(rest_api_exports, {
AccountApi: () => AccountApi,
AssetApi: () => AssetApi,
CapitalApi: () => CapitalApi,
OthersApi: () => OthersApi,
RestAPI: () => RestAPI,
TravelRuleApi: () => TravelRuleApi
});
// src/rest-api/modules/account-api.ts
import {
assertParamExists,
sendRequest
} from "@binance/common";
var AccountApiAxiosParamCreator = function(configuration) {
return {
/**
* Fetch account api trading status detail.
*
* Weight: 1
*
* @summary Account API Trading Status (USER_DATA)
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
accountApiTradingStatus: 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/account/apiTradingStatus",
method: "GET",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* Fetch account info detail.
*
* Weight: 1
*
* @summary Account info (USER_DATA)
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
accountInfo: 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/account/info",
method: "GET",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* Fetch account status detail.
*
* Weight: 1
*
* @summary Account Status (USER_DATA)
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
accountStatus: 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/account/status",
method: "GET",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* Daily account snapshot
*
* The query time period must be less then 30 days
* Support query within the last one month only
* If startTimeand endTime not sent, return records of the last 7 days by default
*
* Weight: 2400
*
* @summary Daily Account Snapshot (USER_DATA)
* @param {string} type
* @param {number} [startTime]
* @param {number} [endTime]
* @param {number} [limit] min 7, max 30, default 7
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
dailyAccountSnapshot: async (type, startTime, endTime, limit, recvWindow) => {
assertParamExists("dailyAccountSnapshot", "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 (limit !== void 0 && limit !== null) {
localVarQueryParameter["limit"] = limit;
}
if (recvWindow !== void 0 && recvWindow !== null) {
localVarQueryParameter["recvWindow"] = recvWindow;
}
let _timeUnit;
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
return {
endpoint: "/sapi/v1/accountSnapshot",
method: "GET",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
*
* Weight: 1
*
* @summary Disable Fast Withdraw Switch (USER_DATA)
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
disableFastWithdrawSwitch: 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/account/disableFastWithdrawSwitch",
method: "POST",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* Enable Fast Withdraw Switch (USER_DATA)
*
* This request will enable fastwithdraw switch under your account. <br></br>
* When Fast Withdraw Switch is on, transferring funds to a Binance account will be done instantly. There is no on-chain transaction, no transaction ID and no withdrawal fee.
*
* Weight: 1
*
* @summary Enable Fast Withdraw Switch (USER_DATA)
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
enableFastWithdrawSwitch: 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/account/enableFastWithdrawSwitch",
method: "POST",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* Get API Key Permission
*
* Weight: 1
*
* @summary Get API Key Permission (USER_DATA)
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
getApiKeyPermission: 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/account/apiRestrictions",
method: "GET",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
}
};
};
var AccountApi = class {
constructor(configuration) {
this.configuration = configuration;
this.localVarAxiosParamCreator = AccountApiAxiosParamCreator(configuration);
}
/**
* Fetch account api trading status detail.
*
* Weight: 1
*
* @summary Account API Trading Status (USER_DATA)
* @param {AccountApiTradingStatusRequest} requestParameters Request parameters.
* @returns {Promise<RestApiResponse<AccountApiTradingStatusResponse>>}
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
* @memberof AccountApi
* @see {@link https://developers.binance.com/docs/wallet/account/Account-API-Trading-Status Binance API Documentation}
*/
async accountApiTradingStatus(requestParameters = {}) {
const localVarAxiosArgs = await this.localVarAxiosParamCreator.accountApiTradingStatus(
requestParameters?.recvWindow
);
return sendRequest(
this.configuration,
localVarAxiosArgs.endpoint,
localVarAxiosArgs.method,
localVarAxiosArgs.params,
localVarAxiosArgs?.timeUnit,
{ isSigned: true }
);
}
/**
* Fetch account info detail.
*
* Weight: 1
*
* @summary Account info (USER_DATA)
* @param {AccountInfoRequest} requestParameters Request parameters.
* @returns {Promise<RestApiResponse<AccountInfoResponse>>}
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
* @memberof AccountApi
* @see {@link https://developers.binance.com/docs/wallet/account/Account-info Binance API Documentation}
*/
async accountInfo(requestParameters = {}) {
const localVarAxiosArgs = await this.localVarAxiosParamCreator.accountInfo(
requestParameters?.recvWindow
);
return sendRequest(
this.configuration,
localVarAxiosArgs.endpoint,
localVarAxiosArgs.method,
localVarAxiosArgs.params,
localVarAxiosArgs?.timeUnit,
{ isSigned: true }
);
}
/**
* Fetch account status detail.
*
* Weight: 1
*
* @summary Account Status (USER_DATA)
* @param {AccountStatusRequest} requestParameters Request parameters.
* @returns {Promise<RestApiResponse<AccountStatusResponse>>}
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
* @memberof AccountApi
* @see {@link https://developers.binance.com/docs/wallet/account/Account-Status Binance API Documentation}
*/
async accountStatus(requestParameters = {}) {
const localVarAxiosArgs = await this.localVarAxiosParamCreator.accountStatus(
requestParameters?.recvWindow
);
return sendRequest(
this.configuration,
localVarAxiosArgs.endpoint,
localVarAxiosArgs.method,
localVarAxiosArgs.params,
localVarAxiosArgs?.timeUnit,
{ isSigned: true }
);
}
/**
* Daily account snapshot
*
* The query time period must be less then 30 days
* Support query within the last one month only
* If startTimeand endTime not sent, return records of the last 7 days by default
*
* Weight: 2400
*
* @summary Daily Account Snapshot (USER_DATA)
* @param {DailyAccountSnapshotRequest} requestParameters Request parameters.
* @returns {Promise<RestApiResponse<DailyAccountSnapshotResponse>>}
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
* @memberof AccountApi
* @see {@link https://developers.binance.com/docs/wallet/account/daily-account-snapshoot Binance API Documentation}
*/
async dailyAccountSnapshot(requestParameters) {
const localVarAxiosArgs = await this.localVarAxiosParamCreator.dailyAccountSnapshot(
requestParameters?.type,
requestParameters?.startTime,
requestParameters?.endTime,
requestParameters?.limit,
requestParameters?.recvWindow
);
return sendRequest(
this.configuration,
localVarAxiosArgs.endpoint,
localVarAxiosArgs.method,
localVarAxiosArgs.params,
localVarAxiosArgs?.timeUnit,
{ isSigned: true }
);
}
/**
*
* Weight: 1
*
* @summary Disable Fast Withdraw Switch (USER_DATA)
* @param {DisableFastWithdrawSwitchRequest} requestParameters Request parameters.
* @returns {Promise<RestApiResponse<void>>}
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
* @memberof AccountApi
* @see {@link https://developers.binance.com/docs/wallet/account/Disable-Fast-Withdraw-Switch Binance API Documentation}
*/
async disableFastWithdrawSwitch(requestParameters = {}) {
const localVarAxiosArgs = await this.localVarAxiosParamCreator.disableFastWithdrawSwitch(
requestParameters?.recvWindow
);
return sendRequest(
this.configuration,
localVarAxiosArgs.endpoint,
localVarAxiosArgs.method,
localVarAxiosArgs.params,
localVarAxiosArgs?.timeUnit,
{ isSigned: true }
);
}
/**
* Enable Fast Withdraw Switch (USER_DATA)
*
* This request will enable fastwithdraw switch under your account. <br></br>
* When Fast Withdraw Switch is on, transferring funds to a Binance account will be done instantly. There is no on-chain transaction, no transaction ID and no withdrawal fee.
*
* Weight: 1
*
* @summary Enable Fast Withdraw Switch (USER_DATA)
* @param {EnableFastWithdrawSwitchRequest} requestParameters Request parameters.
* @returns {Promise<RestApiResponse<void>>}
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
* @memberof AccountApi
* @see {@link https://developers.binance.com/docs/wallet/account/Enable-Fast-Withdraw-Switch Binance API Documentation}
*/
async enableFastWithdrawSwitch(requestParameters = {}) {
const localVarAxiosArgs = await this.localVarAxiosParamCreator.enableFastWithdrawSwitch(
requestParameters?.recvWindow
);
return sendRequest(
this.configuration,
localVarAxiosArgs.endpoint,
localVarAxiosArgs.method,
localVarAxiosArgs.params,
localVarAxiosArgs?.timeUnit,
{ isSigned: true }
);
}
/**
* Get API Key Permission
*
* Weight: 1
*
* @summary Get API Key Permission (USER_DATA)
* @param {GetApiKeyPermissionRequest} requestParameters Request parameters.
* @returns {Promise<RestApiResponse<GetApiKeyPermissionResponse>>}
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
* @memberof AccountApi
* @see {@link https://developers.binance.com/docs/wallet/account/api-key-permission Binance API Documentation}
*/
async getApiKeyPermission(requestParameters = {}) {
const localVarAxiosArgs = await this.localVarAxiosParamCreator.getApiKeyPermission(
requestParameters?.recvWindow
);
return sendRequest(
this.configuration,
localVarAxiosArgs.endpoint,
localVarAxiosArgs.method,
localVarAxiosArgs.params,
localVarAxiosArgs?.timeUnit,
{ isSigned: true }
);
}
};
// src/rest-api/modules/asset-api.ts
import {
assertParamExists as assertParamExists2,
sendRequest as sendRequest2
} from "@binance/common";
var AssetApiAxiosParamCreator = function(configuration) {
return {
/**
* Fetch details of assets supported on Binance.
*
*
* Please get network and other deposit or withdraw details from ``GET /sapi/v1/capital/config/getall``.
*
* Weight: 1
*
* @summary Asset Detail (USER_DATA)
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
assetDetail: 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/asset/assetDetail",
method: "GET",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* Query asset dividend record.
*
*
* There cannot be more than 180 days between parameter `startTime` and `endTime`.
*
* Weight: 10
*
* @summary Asset Dividend Record (USER_DATA)
* @param {string} [asset] If asset is blank, then query all positive assets user have.
* @param {number} [startTime]
* @param {number} [endTime]
* @param {number} [limit] min 7, max 30, default 7
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
assetDividendRecord: async (asset, startTime, endTime, limit, recvWindow) => {
const localVarQueryParameter = {};
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 (limit !== void 0 && limit !== null) {
localVarQueryParameter["limit"] = limit;
}
if (recvWindow !== void 0 && recvWindow !== null) {
localVarQueryParameter["recvWindow"] = recvWindow;
}
let _timeUnit;
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
return {
endpoint: "/sapi/v1/asset/assetDividend",
method: "GET",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* Convert dust assets to BNB.
*
* You need to open`Enable Spot & Margin Trading` permission for the API Key which requests this endpoint.
*
* Weight: 10
*
* @summary Dust Transfer (USER_DATA)
* @param {string} asset
* @param {string} [accountType] `SPOT` or `MARGIN`,default `SPOT`
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
dustTransfer: async (asset, accountType, recvWindow) => {
assertParamExists2("dustTransfer", "asset", asset);
const localVarQueryParameter = {};
if (asset !== void 0 && asset !== null) {
localVarQueryParameter["asset"] = asset;
}
if (accountType !== void 0 && accountType !== null) {
localVarQueryParameter["accountType"] = accountType;
}
if (recvWindow !== void 0 && recvWindow !== null) {
localVarQueryParameter["recvWindow"] = recvWindow;
}
let _timeUnit;
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
return {
endpoint: "/sapi/v1/asset/dust",
method: "POST",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* Dustlog
*
* Only return last 100 records
* Only return records after 2020/12/01
*
* Weight: 1
*
* @summary DustLog(USER_DATA)
* @param {number} [startTime]
* @param {number} [endTime]
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
dustlog: async (startTime, endTime, recvWindow) => {
const localVarQueryParameter = {};
if (startTime !== void 0 && startTime !== null) {
localVarQueryParameter["startTime"] = startTime;
}
if (endTime !== void 0 && endTime !== null) {
localVarQueryParameter["endTime"] = endTime;
}
if (recvWindow !== void 0 && recvWindow !== null) {
localVarQueryParameter["recvWindow"] = recvWindow;
}
let _timeUnit;
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
return {
endpoint: "/sapi/v1/asset/dribblet",
method: "GET",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* Query Funding Wallet
*
*
* Currently supports querying the following business assets:Binance Pay, Binance Card, Binance Gift Card, Stock Token
*
* Weight: 1
*
* @summary Funding Wallet (USER_DATA)
* @param {string} [asset] If asset is blank, then query all positive assets user have.
* @param {string} [needBtcValuation] true or false
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
fundingWallet: async (asset, needBtcValuation, recvWindow) => {
const localVarQueryParameter = {};
if (asset !== void 0 && asset !== null) {
localVarQueryParameter["asset"] = asset;
}
if (needBtcValuation !== void 0 && needBtcValuation !== null) {
localVarQueryParameter["needBtcValuation"] = needBtcValuation;
}
if (recvWindow !== void 0 && recvWindow !== null) {
localVarQueryParameter["recvWindow"] = recvWindow;
}
let _timeUnit;
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
return {
endpoint: "/sapi/v1/asset/get-funding-asset",
method: "POST",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* Get Assets That Can Be Converted Into BNB
*
* Weight: 1
*
* @summary Get Assets That Can Be Converted Into BNB (USER_DATA)
* @param {string} [accountType] `SPOT` or `MARGIN`,default `SPOT`
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
getAssetsThatCanBeConvertedIntoBnb: async (accountType, recvWindow) => {
const localVarQueryParameter = {};
if (accountType !== void 0 && accountType !== null) {
localVarQueryParameter["accountType"] = accountType;
}
if (recvWindow !== void 0 && recvWindow !== null) {
localVarQueryParameter["recvWindow"] = recvWindow;
}
let _timeUnit;
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
return {
endpoint: "/sapi/v1/asset/dust-btc",
method: "POST",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* The query of Cloud-Mining payment and refund history
*
* Just return the SUCCESS records of payment and refund.
* For response, type = 248 means payment, type = 249 means refund, status =S means SUCCESS.
*
* Weight: 600
*
* @summary Get Cloud-Mining payment and refund history (USER_DATA)
* @param {number} startTime
* @param {number} endTime
* @param {number} [tranId] The transaction id
* @param {string} [clientTranId] The unique flag
* @param {string} [asset] If asset is blank, then query all positive assets user have.
* @param {number} [current] current page, default 1, the min value is 1
* @param {number} [size] page size, default 10, the max value is 100
*
* @throws {RequiredError}
*/
getCloudMiningPaymentAndRefundHistory: async (startTime, endTime, tranId, clientTranId, asset, current, size) => {
assertParamExists2("getCloudMiningPaymentAndRefundHistory", "startTime", startTime);
assertParamExists2("getCloudMiningPaymentAndRefundHistory", "endTime", endTime);
const localVarQueryParameter = {};
if (tranId !== void 0 && tranId !== null) {
localVarQueryParameter["tranId"] = tranId;
}
if (clientTranId !== void 0 && clientTranId !== null) {
localVarQueryParameter["clientTranId"] = clientTranId;
}
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;
}
let _timeUnit;
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
return {
endpoint: "/sapi/v1/asset/ledger-transfer/cloud-mining/queryByPage",
method: "GET",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* Get the list of symbols that are scheduled to be opened for trading in the market.
*
* Weight: 100
*
* @summary Get Open Symbol List (MARKET_DATA)
*
* @throws {RequiredError}
*/
getOpenSymbolList: async () => {
const localVarQueryParameter = {};
let _timeUnit;
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
return {
endpoint: "/sapi/v1/spot/open-symbol-list",
method: "GET",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* Query User Delegation History
*
* You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint
*
* Weight: 60
*
* @summary Query User Delegation History(For Master Account)(USER_DATA)
* @param {string} email
* @param {number} startTime
* @param {number} endTime
* @param {string} [type] Delegate/Undelegate
* @param {string} [asset] If asset is blank, then query all positive assets user have.
* @param {number} [current] current page, default 1, the min value is 1
* @param {number} [size] page size, default 10, the max value is 100
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
queryUserDelegationHistory: async (email, startTime, endTime, type, asset, current, size, recvWindow) => {
assertParamExists2("queryUserDelegationHistory", "email", email);
assertParamExists2("queryUserDelegationHistory", "startTime", startTime);
assertParamExists2("queryUserDelegationHistory", "endTime", endTime);
const localVarQueryParameter = {};
if (email !== void 0 && email !== null) {
localVarQueryParameter["email"] = email;
}
if (startTime !== void 0 && startTime !== null) {
localVarQueryParameter["startTime"] = startTime;
}
if (endTime !== void 0 && endTime !== null) {
localVarQueryParameter["endTime"] = endTime;
}
if (type !== void 0 && type !== null) {
localVarQueryParameter["type"] = type;
}
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/asset/custody/transfer-history",
method: "GET",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* Query User Universal Transfer History
*
*
* `fromSymbol` must be sent when type are ISOLATEDMARGIN_MARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN
* `toSymbol` must be sent when type are MARGIN_ISOLATEDMARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN
* Support query within the last 6 months only
* If `startTime`and `endTime` not sent, return records of the last 7 days by default
*
* Weight: 1
*
* @summary Query User Universal Transfer History(USER_DATA)
* @param {string} type
* @param {number} [startTime]
* @param {number} [endTime]
* @param {number} [current] current page, default 1, the min value is 1
* @param {number} [size] page size, default 10, the max value is 100
* @param {string} [fromSymbol]
* @param {string} [toSymbol]
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
queryUserUniversalTransferHistory: async (type, startTime, endTime, current, size, fromSymbol, toSymbol, recvWindow) => {
assertParamExists2("queryUserUniversalTransferHistory", "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 (fromSymbol !== void 0 && fromSymbol !== null) {
localVarQueryParameter["fromSymbol"] = fromSymbol;
}
if (toSymbol !== void 0 && toSymbol !== null) {
localVarQueryParameter["toSymbol"] = toSymbol;
}
if (recvWindow !== void 0 && recvWindow !== null) {
localVarQueryParameter["recvWindow"] = recvWindow;
}
let _timeUnit;
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
return {
endpoint: "/sapi/v1/asset/transfer",
method: "GET",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* Query User Wallet Balance
*
* Weight: 60
*
* @summary Query User Wallet Balance (USER_DATA)
* @param {string} [quoteAsset] `USDT`, `ETH`, `USDC`, `BNB`, etc. default `BTC`
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
queryUserWalletBalance: async (quoteAsset, recvWindow) => {
const localVarQueryParameter = {};
if (quoteAsset !== void 0 && quoteAsset !== null) {
localVarQueryParameter["quoteAsset"] = quoteAsset;
}
if (recvWindow !== void 0 && recvWindow !== null) {
localVarQueryParameter["recvWindow"] = recvWindow;
}
let _timeUnit;
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
return {
endpoint: "/sapi/v1/asset/wallet/balance",
method: "GET",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* Toggle BNB Burn On Spot Trade And Margin Interest
*
* "spotBNBBurn" and "interestBNBBurn" should be sent at least one.
*
* Weight: 1(IP)
*
* @summary Toggle BNB Burn On Spot Trade And Margin Interest (USER_DATA)
* @param {string} [spotBNBBurn] "true" or "false"; Determines whether to use BNB to pay for trading fees on SPOT
* @param {string} [interestBNBBurn] "true" or "false"; Determines whether to use BNB to pay for margin loan's interest
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
toggleBnbBurnOnSpotTradeAndMarginInterest: async (spotBNBBurn, interestBNBBurn, recvWindow) => {
const localVarQueryParameter = {};
if (spotBNBBurn !== void 0 && spotBNBBurn !== null) {
localVarQueryParameter["spotBNBBurn"] = spotBNBBurn;
}
if (interestBNBBurn !== void 0 && interestBNBBurn !== null) {
localVarQueryParameter["interestBNBBurn"] = interestBNBBurn;
}
if (recvWindow !== void 0 && recvWindow !== null) {
localVarQueryParameter["recvWindow"] = recvWindow;
}
let _timeUnit;
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
return {
endpoint: "/sapi/v1/bnbBurn",
method: "POST",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* Fetch trade fee
*
* Weight: 1
*
* @summary Trade Fee (USER_DATA)
* @param {string} [symbol]
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
tradeFee: async (symbol, recvWindow) => {
const localVarQueryParameter = {};
if (symbol !== void 0 && symbol !== null) {
localVarQueryParameter["symbol"] = symbol;
}
if (recvWindow !== void 0 && recvWindow !== null) {
localVarQueryParameter["recvWindow"] = recvWindow;
}
let _timeUnit;
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
return {
endpoint: "/sapi/v1/asset/tradeFee",
method: "GET",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* Get user assets, just for positive data.
*
* If asset is set, then return this asset, otherwise return all assets positive.
* If needBtcValuation is set, then return btcValudation.
*
* Weight: 5
*
* @summary User Asset (USER_DATA)
* @param {string} [asset] If asset is blank, then query all positive assets user have.
* @param {boolean} [needBtcValuation] Whether need btc valuation or not.
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
userAsset: async (asset, needBtcValuation, recvWindow) => {
const localVarQueryParameter = {};
if (asset !== void 0 && asset !== null) {
localVarQueryParameter["asset"] = asset;
}
if (needBtcValuation !== void 0 && needBtcValuation !== null) {
localVarQueryParameter["needBtcValuation"] = needBtcValuation;
}
if (recvWindow !== void 0 && recvWindow !== null) {
localVarQueryParameter["recvWindow"] = recvWindow;
}
let _timeUnit;
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
return {
endpoint: "/sapi/v3/asset/getUserAsset",
method: "POST",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
},
/**
* user universal transfer
*
* `fromSymbol` must be sent when type are ISOLATEDMARGIN_MARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN
* `toSymbol` must be sent when type are MARGIN_ISOLATEDMARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN
* ENUM of transfer types:
* MAIN_UMFUTURE Spot account transfer to USDⓈ-M Futures account
* MAIN_CMFUTURE Spot account transfer to COIN-M Futures account
* MAIN_MARGIN Spot account transfer to Margin(cross)account
* UMFUTURE_MAIN USDⓈ-M Futures account transfer to Spot account
* UMFUTURE_MARGIN USDⓈ-M Futures account transfer to Margin(cross)account
* CMFUTURE_MAIN COIN-M Futures account transfer to Spot account
* CMFUTURE_MARGIN COIN-M Futures account transfer to Margin(cross) account
* MARGIN_MAIN Margin(cross)account transfer to Spot account
* MARGIN_UMFUTURE Margin(cross)account transfer to USDⓈ-M Futures
* MARGIN_CMFUTURE Margin(cross)account transfer to COIN-M Futures
* ISOLATEDMARGIN_MARGIN Isolated margin account transfer to Margin(cross) account
* MARGIN_ISOLATEDMARGIN Margin(cross) account transfer to Isolated margin account
* ISOLATEDMARGIN_ISOLATEDMARGIN Isolated margin account transfer to Isolated margin account
* MAIN_FUNDING Spot account transfer to Funding account
* FUNDING_MAIN Funding account transfer to Spot account
* FUNDING_UMFUTURE Funding account transfer to UMFUTURE account
* UMFUTURE_FUNDING UMFUTURE account transfer to Funding account
* MARGIN_FUNDING MARGIN account transfer to Funding account
* FUNDING_MARGIN Funding account transfer to Margin account
* FUNDING_CMFUTURE Funding account transfer to CMFUTURE account
* CMFUTURE_FUNDING CMFUTURE account transfer to Funding account
* MAIN_OPTION Spot account transfer to Options account
* OPTION_MAIN Options account transfer to Spot account
* UMFUTURE_OPTION USDⓈ-M Futures account transfer to Options account
* OPTION_UMFUTURE Options account transfer to USDⓈ-M Futures account
* MARGIN_OPTION Margin(cross)account transfer to Options account
* OPTION_MARGIN Options account transfer to Margin(cross)account
* FUNDING_OPTION Funding account transfer to Options account
* OPTION_FUNDING Options account transfer to Funding account
* MAIN_PORTFOLIO_MARGIN Spot account transfer to Portfolio Margin account
* PORTFOLIO_MARGIN_MAIN Portfolio Margin account transfer to Spot account
*
* Weight: 900
*
* @summary User Universal Transfer (USER_DATA)
* @param {string} type
* @param {string} asset
* @param {number} amount
* @param {string} [fromSymbol]
* @param {string} [toSymbol]
* @param {number} [recvWindow]
*
* @throws {RequiredError}
*/
userUniversalTransfer: async (type, asset, amount, fromSymbol, toSymbol, recvWindow) => {
assertParamExists2("userUniversalTransfer", "type", type);
assertParamExists2("userUniversalTransfer", "asset", asset);
assertParamExists2("userUniversalTransfer", "amount", amount);
const localVarQueryParameter = {};
if (type !== void 0 && type !== null) {
localVarQueryParameter["type"] = type;
}
if (asset !== void 0 && asset !== null) {
localVarQueryParameter["asset"] = asset;
}
if (amount !== void 0 && amount !== null) {
localVarQueryParameter["amount"] = amount;
}
if (fromSymbol !== void 0 && fromSymbol !== null) {
localVarQueryParameter["fromSymbol"] = fromSymbol;
}
if (toSymbol !== void 0 && toSymbol !== null) {
localVarQueryParameter["toSymbol"] = toSymbol;
}
if (recvWindow !== void 0 && recvWindow !== null) {
localVarQueryParameter["recvWindow"] = recvWindow;
}
let _timeUnit;
if ("timeUnit" in configuration) _timeUnit = configuration.timeUnit;
return {
endpoint: "/sapi/v1/asset/transfer",
method: "POST",
params: localVarQueryParameter,
timeUnit: _timeUnit
};
}
};
};
var AssetApi = class {
constructor(configuration) {
this.configuration = configuration;
this.localVarAxiosParamCreator = AssetApiAxiosParamCreator(configuration);
}
/**
* Fetch details of assets supported on Binance.
*
*
* Please get network and other deposit or withdraw details from ``GET /sapi/v1/capital/config/getall``.
*
* Weight: 1
*
* @summary Asset Detail (USER_DATA)
* @param {AssetDetailRequest} requestParameters Request parameters.
* @returns {Promise<RestApiResponse<AssetDetailResponse>>}
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
* @memberof AssetApi
* @see {@link https://developers.binance.com/docs/wallet/asset/Asset-Detail Binance API Documentation}
*/
async assetDetail(requestParameters = {}) {
const localVarAxiosArgs = await this.localVarAxiosParamCreator.assetDetail(
requestParameters?.recvWindow
);
return sendRequest2(
this.configuration,
localVarAxiosArgs.endpoint,
localVarAxiosArgs.method,
localVarAxiosArgs.params,
localVarAxiosArgs?.timeUnit,
{ isSigned: true }
);
}
/**
* Query asset dividend record.
*
*
* There cannot be more than 180 days between parameter `startTime` and `endTime`.
*
* Weight: 10
*
* @summary Asset Dividend Record (USER_DATA)
* @param {AssetDividendRecordRequest} requestParameters Request parameters.
* @returns {Promise<RestApiResponse<AssetDividendRecordResponse>>}
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
* @memberof AssetApi
* @see {@link https://developers.binance.com/docs/wallet/asset/assets-divided-record Binance API Documentation}
*/
async assetDividendRecord(requestParameters = {}) {
const localVarAxiosArgs = await this.localVarAxiosParamCreator.assetDividendRecord(
requestParameters?.asset,
requestParameters?.startTime,
requestParameters?.endTime,
requestParameters?.limit,
requestParameters?.recvWindow
);
return sendRequest2(
this.configuration,
localVarAxiosArgs.endpoint,
localVarAxiosArgs.method,
localVarAxiosArgs.params,
localVarAxiosArgs?.timeUnit,
{ isSigned: true }
);
}
/**
* Convert dust assets to BNB.
*
* You need to open`Enable Spot & Margin Trading` permission for the API Key which requests this endpoint.
*
* Weight: 10
*
* @summary Dust Transfer (USER_DATA)
* @param {DustTransferRequest} requestParameters Request parameters.
* @returns {Promise<RestApiResponse<DustTransferResponse>>}
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
* @memberof AssetApi
* @see {@link https://developers.binance.com/docs/wallet/asset/Dust-Transfer Binance API Documentation}
*/
async dustTransfer(requestParameters) {
const localVarAxiosArgs = await this.localVarAxiosParamCreator.dustTransfer(
requestParameters?.asset,
requestParameters?.accountType,
requestParameters?.recvWindow
);
return sendRequest2(
this.configuration,
localVarAxiosArgs.endpoint,
localVarAxiosArgs.method,
localVarAxiosArgs.params,
localVarAxiosArgs?.timeUnit,
{ isSigned: true }
);
}
/**
* Dustlog
*
* Only return last 100 records
* Only return records after 2020/12/01
*
* Weight: 1
*
* @summary DustLog(USER_DATA)
* @param {DustlogRequest} requestParameters Request parameters.
* @returns {Promise<RestApiResponse<DustlogResponse>>}
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
* @memberof AssetApi
* @see {@link https://developers.binance.com/docs/wallet/asset/dust-log Binance API Documentation}
*/
async dustlog(requestParameters = {}) {
const localVarAxiosArgs = await this.localVarAxiosParamCreator.dustlog(
requestParameters?.startTime,
requestParameters?.endTime,
requestParameters?.recvWindow
);
return sendRequest2(
this.configuration,
localVarAxiosArgs.endpoint,
localVarAxiosArgs.method,
localVarAxiosArgs.params,
localVarAxiosArgs?.timeUnit,
{ isSigned: true }
);
}
/**
* Query Funding Wallet
*
*
* Currently supports querying the following business assets:Binance Pay, Binance Card, Binance Gift Card, Stock Token
*
* Weight: 1
*
* @summary Funding Wallet (USER_DATA)
* @param {FundingWalletRequest} requestParameters Request parameters.
* @returns {Promise<RestApiResponse<FundingWalletResponse>>}
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
* @memberof AssetApi
* @see {@link https://developers.binance.com/docs/wallet/asset/Funding-Wallet Binance API Documentation}
*/
async fundingWallet(requestParameters = {}) {
const localVarAxiosArgs = await this.localVarAxiosParamCreator.fundingWallet(
requestParameters?.asset,
requestParameters?.needBtcValuation,
requestParameters?.recvWindow
);
return sendRequest2(
this.configuration,
localVarAxiosArgs.endpoint,
localVarAxiosArgs.method,
localVarAxiosArgs.params,
localVarAxiosArgs?.timeUnit,
{ isSigned: true }
);
}
/**
* Get Assets That Can Be Converted Into BNB
*
* Weight: 1
*
* @summary Get Assets That Can Be Converted Into BNB (USER_DATA)
* @param {GetAssetsThatCanBeConvertedIntoBnbRequest} requestParameters Request parameters.
* @returns {Promise<RestApiResponse<GetAssetsThatCanBeConvertedIntoBnbResponse>>}
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
* @memberof AssetApi
* @see {@link https://developers.binance.com/docs/wallet/asset/assets-can-convert-bnb Binance API Documentation}
*/
async getAssetsThatCanBeConvertedIntoBnb(requestParameters = {}) {
const localVarAxiosArgs = await this.localVarAxiosParamCreator.getAssetsThatCanBeConvertedIntoBnb(
requestParameters?.accountType,
requestParameters?.recvWindow
);
return sendRequest2(
this.configuration,
localVarAxiosArgs.endpoint,
localVarAxiosArgs.method,
localVarAxiosArgs.params,
localVarAxiosArgs?.timeUnit,
{ isSigned: true }
);
}
/**
* The query of Cloud-Mining payment and refund history
*
* Just return the SUCCESS records of payment and refund.
* For response, type = 248 means payment, type = 249 means refund, status =S means SUCCESS.
*
* Weight: 600
*
* @summary Get Cloud-Mining payment and refund history (USER_DATA)
* @param {GetCloudMiningPaymentAndRefundHistoryRequest} requestParameters Request parameters.
* @returns {Promise<RestApiResponse<GetCloudMiningPaymentAndRefundHistoryResponse>>}
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
* @memberof AssetApi
* @see {@link https://developers.binance.com/docs/wallet/asset/cloud-mining-payment-and-refund-history Binance API Documentation}
*/
async getCloudMiningPaymentAndRefundHistory(requestParameters) {
const localVarAxiosArgs = await this.localVarAxiosParamCreator.getCloudMiningPaymentAndRefundHistory(
requestParameters?.startTime,
requestParameters?.endTime,
requestParameters?.tranId,
requestParameters?.clientTranId,
requestParameters?.asset,
requestParameters?.current,
requestParameters?.size
);
return sendRequest2(
this.configuration,
localVarAxiosArgs.endpoint,
localVarAxiosArgs.method,
localVarAxiosArgs.params,
localVarAxiosArgs?.timeUnit,
{ isSigned: true }
);
}
/**
* Get the list of symbols that are scheduled to be opened for trading in the market.
*
* Weight: 100
*
* @summary Get Open Symbol List (MARKET_DATA)
* @returns {Promise<RestApiResponse<GetOpenSymbolListResponse>>}
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
* @memberof AssetApi
* @see {@link https://developers.binance.com/docs/wallet/asset/open-symbol-list Binance API Documentation}
*/
async getOpenSymbolList() {
const localVarAxiosArgs = await this.localVarAxiosParamCreator.getOpenSymbolList();
return sendRequest2(
this.configuration,
localVarAxiosArgs.endpoint,
localVarAxiosArgs.method,
localVarAxiosArgs.params,
localVarAxiosArgs?.timeUnit,
{ isSigned: false }
);
}
/**
* Query User Delegation History
*
* You need to open Enable Spot & Margin Trading permission for the API Key which requests this endpoint
*
* Weight: 60
*
* @summary Query User Delegation History(For Master Account)(USER_DATA)
* @param {QueryUserDelegationHistoryRequest} requestParameters Request parameters.
* @returns {Promise<RestApiResponse<QueryUserDelegationHistoryResponse>>}
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
* @memberof AssetApi
* @see {@link https://developers.binance.com/docs/wallet/asset/query-user-delegation Binance API Documentation}
*/
async queryUserDelegationHistory(requestParameters) {
const localVarAxiosArgs = await this.localVarAxiosParamCreator.queryUserDelegationHistory(
requestParameters?.email,
requestParameters?.startTime,
requestParameters?.endTime,
requestParameters?.type,
requestParameters?.asset,
requestParameters?.current,
requestParameters?.size,
requestParameters?.recvWindow
);
return sendRequest2(
this.configuration,
localVarAxiosArgs.endpoint,
localVarAxiosArgs.method,
localVarAxiosArgs.params,
localVarAxiosArgs?.timeUnit,
{ isSigned: true }
);
}
/**
* Query User Universal Transfer History
*
*
* `fromSymbol` must be sent when type are ISOLATEDMARGIN_MARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN
* `toSymbol` must be sent when type are MARGIN_ISOLATEDMARGIN and ISOLATEDMARGIN_ISOLATEDMARGIN
* Support query within the last 6 months only
* If `startTime`and `endTime` not sent, return records of the last 7 days by default
*
* Weight: 1
*
* @summary Query User Universal Transfer History(USER_DATA)
* @param {QueryUserUniversalTransferHistoryRequest} requestParameters Request parameters.
* @returns {Promise<RestApiResponse<QueryUserUniversalTransferHistoryResponse>>}
* @throws {RequiredError | ConnectorClientError | UnauthorizedError | ForbiddenError | TooManyRequestsError | RateLimitBanError | ServerError | NotFoundError | NetworkError | BadRequestError}
* @memberof AssetApi
* @see {@link https://developers.binance.com/docs/wallet/asset/query-user-universal-transfer Binance API Documentation}
*/
async queryUserUniversalTransferHistory(requestParameters) {
const localVarAxiosArgs = await this.localVarAxiosParamCreator.queryUserUniversalTransferHistory(
requestParameters?.type,
requestParameters?.startTime,
requestParameters?.endTime,
requestParameters?.current,
requestParameters?.size,
requestParameters?.fromSymbol,
requestParameters?.toSymbol,
requestParameters?.recvWindow
);
return sendRequest2(
this.configuration,
localVarAxiosArgs.endpoint,
localVarAxiosArgs.method,
localVarAxiosArgs.params,
localVarAxiosArgs?.timeUnit,
{ isSigned: true }
);
}
/**