UNPKG

avail-js-sdk

Version:

Avail library of functions to interact with blockchain and manipulate transactions

35 lines (34 loc) 1.51 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.SDK = void 0; const chain_1 = require("../chain"); const sdk_transactions_1 = require("./sdk_transactions"); const _1 = require("."); class SDK { static New(endpoint) { return __awaiter(this, void 0, void 0, function* () { const api = yield (0, chain_1.initialize)(endpoint); return new SDK(new _1.Client(api)); }); } constructor(client) { this.client = client; this.tx = new sdk_transactions_1.Transactions(client); } static oneAvail() { return new _1.BN(10).pow(new _1.BN(18)); } } exports.SDK = SDK; SDK.localEndpoint = "ws://127.0.0.1:9944"; SDK.turingEndpoint = "wss://turing-rpc.avail.so/ws"; SDK.mainnetEndpoint = "wss://mainnet-rpc.avail.so/ws";