@exchanges/binance
Version:
Exchange provider for Binance API
37 lines • 1.87 kB
JavaScript
;
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.publicCall = void 0;
const utils_1 = require("../utils");
function publicCall(options) {
return __awaiter(this, void 0, void 0, function* () {
if (!options)
throw new TypeError('publicCall options is empty');
if (typeof options !== 'object')
throw new TypeError('publicCall options is not object');
if (!options.axios)
throw new TypeError('publicCall options.axios is empty');
if (!options.host)
throw new TypeError('publicCall options.host is empty');
if (!options.path)
throw new TypeError('publicCall options.path is empty');
if (!options.method)
throw new TypeError('publicCall options.method is empty');
const requestPath = (0, utils_1.getPath)({ host: options.host, path: options.path, data: options.data });
const response = yield options.axios(requestPath, {
method: options.method,
headers: options.headers,
});
return response.data;
});
}
exports.publicCall = publicCall;
//# sourceMappingURL=publicCall.js.map