UNPKG

@sova-labs/sdk

Version:
40 lines 1.93 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.SovaClient = void 0; exports.getTestnetClient = getTestnetClient; exports.getMainnetClient = getMainnetClient; const services_1 = require("./services"); class SovaClient { constructor(url, secureConnection, authToken) { this.url = url; this.secureConnection = secureConnection; this.authToken = authToken; } authenticate(privateKey) { return __awaiter(this, void 0, void 0, function* () { const authenticationService = new services_1.AuthenticationService(this.url, privateKey, this.secureConnection); this.authToken = yield authenticationService.authenticate(); }); } getSearcher() { var _a; return new services_1.SearcherService(this.url, this.secureConnection, ((_a = this.authToken) === null || _a === void 0 ? void 0 : _a.accessToken) || undefined); } } exports.SovaClient = SovaClient; function getTestnetClient(authToken) { return new SovaClient("testnet-engine.sova.network:30020", true, authToken); } function getMainnetClient(authToken) { return new SovaClient("engine.sova.network:30020", true, authToken); } //# sourceMappingURL=index.js.map