UNPKG

@sova-labs/sdk

Version:
34 lines 1.73 kB
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()); }); }; import { AuthenticationService, SearcherService } from "./services"; export 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 AuthenticationService(this.url, privateKey, this.secureConnection); this.authToken = yield authenticationService.authenticate(); }); } getSearcher() { var _a; return new SearcherService(this.url, this.secureConnection, ((_a = this.authToken) === null || _a === void 0 ? void 0 : _a.accessToken) || undefined); } } export function getTestnetClient(authToken) { return new SovaClient("testnet-engine.sova.network:30020", true, authToken); } export function getMainnetClient(authToken) { return new SovaClient("engine.sova.network:30020", true, authToken); } //# sourceMappingURL=index.js.map