binance
Version:
Professional Node.js & JavaScript SDK for Binance REST APIs & WebSockets, with TypeScript & end-to-end tests.
56 lines • 2.39 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RestClientCache = void 0;
const coinm_client_1 = require("../../coinm-client");
const main_client_1 = require("../../main-client");
const portfolio_client_1 = require("../../portfolio-client");
const usdm_client_1 = require("../../usdm-client");
class RestClientCache {
constructor() {
this.restClients = {};
}
getSpotRestClient(restOptions, requestOptions) {
if (restOptions.testnet) {
if (!this.restClients.spotTestnet) {
this.restClients.spotTestnet = new main_client_1.MainClient(Object.assign({}, restOptions), requestOptions);
}
return this.restClients.spotTestnet;
}
if (!this.restClients.spot) {
this.restClients.spot = new main_client_1.MainClient(restOptions, requestOptions);
}
return this.restClients.spot;
}
getUSDMRestClient(restOptions, requestOptions) {
if (restOptions.testnet) {
if (!this.restClients.usdmFuturesTestnet) {
this.restClients.usdmFuturesTestnet = new usdm_client_1.USDMClient(restOptions, requestOptions);
}
return this.restClients.usdmFuturesTestnet;
}
if (!this.restClients.usdmFutures) {
this.restClients.usdmFutures = new usdm_client_1.USDMClient(restOptions, requestOptions);
}
return this.restClients.usdmFutures;
}
getCOINMRestClient(restOptions, requestOptions) {
if (restOptions.testnet) {
if (!this.restClients.coinmFuturesTestnet) {
this.restClients.coinmFuturesTestnet = new coinm_client_1.CoinMClient(restOptions, requestOptions);
}
return this.restClients.coinmFuturesTestnet;
}
if (!this.restClients.coinmFutures) {
this.restClients.coinmFutures = new coinm_client_1.CoinMClient(restOptions, requestOptions);
}
return this.restClients.coinmFutures;
}
getPortfolioClient(restOptions, requestOptions) {
if (!this.restClients.portfolio) {
this.restClients.portfolio = new portfolio_client_1.PortfolioClient(restOptions, requestOptions);
}
return this.restClients.portfolio;
}
}
exports.RestClientCache = RestClientCache;
//# sourceMappingURL=rest-client-cache.js.map