UNPKG

@interlay/interbtc

Version:

JavaScript library to interact with InterBTC

33 lines 1.83 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.DefaultInterBtc = exports.createInterbtc = exports.INDEX_LOCAL_URL = void 0; const interbtc_api_1 = require("@interlay/interbtc-api"); const interbtcIndex_1 = require("./interbtcIndex"); exports.INDEX_LOCAL_URL = "http://localhost:3007"; function createInterbtc(endpoint, network, indexEndpoint, account, autoConnect) { return __awaiter(this, void 0, void 0, function* () { const interBtcApi = yield (0, interbtc_api_1.createInterBtcApi)(endpoint, network, account, autoConnect); const polkadotApi = interBtcApi.api; const interBtcIndex = (0, interbtcIndex_1.DefaultIndexAPI)({ basePath: indexEndpoint }, interBtcApi); return new DefaultInterBtc(polkadotApi, interBtcApi, interBtcIndex); }); } exports.createInterbtc = createInterbtc; class DefaultInterBtc { constructor(polkadotApi, interBtcApi, interBtcIndex) { this.polkadotApi = polkadotApi; this.interBtcApi = interBtcApi; this.interBtcIndex = interBtcIndex; } } exports.DefaultInterBtc = DefaultInterBtc; //# sourceMappingURL=index.js.map