UNPKG

@exchanges/binance

Version:

Exchange provider for Binance API

53 lines 2.34 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.BinanceSignedClient = void 0; const api_1 = require("../api"); const binanceKeyClient_1 = require("./binanceKeyClient"); class BinanceSignedClient extends binanceKeyClient_1.BinanceKeyClient { constructor(options) { super(options); this._options = null; this.checkFuturesAPIConnection = () => __awaiter(this, void 0, void 0, function* () { try { yield api_1.usdtFutures.accountTrades.accountInformationV2(this); return true; } catch (err) { return false; } }); this.checkSpotAPIConnection = () => __awaiter(this, void 0, void 0, function* () { try { yield api_1.spotMarginSavingsMaining.spotAccountTrade.accountInformation(this); return true; } catch (err) { return false; } }); if (!options) throw new TypeError('BinanceSignedClientOptions constructor options is empty'); if (typeof options !== 'object') throw new TypeError('BinanceSignedClientOptions constructor options is not object'); if (!options.apiSecret) throw new TypeError('BinanceSignedClientOptions constructor options.apiSecret is empty'); this._options = options; } get options() { return this._options; } get apiSecret() { return this.options.apiSecret; } } exports.BinanceSignedClient = BinanceSignedClient; //# sourceMappingURL=binanceSignedClient.js.map