UNPKG

@liskhq/lisk-api-client

Version:
51 lines 1.79 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.APIClient = void 0; const node_methods_1 = require("./node_methods"); const block_methods_1 = require("./block_methods"); const transaction_methods_1 = require("./transaction_methods"); const event_methods_1 = require("./event_methods"); class APIClient { constructor(channel) { this._channel = channel; } async init() { const { modules } = await this._channel.invoke('system_getMetadata'); this._metadata = modules; this._schema = await this._channel.invoke('system_getSchema'); this._nodeMethods = new node_methods_1.NodeMethods(this._channel); this._blockMethods = new block_methods_1.BlockMethods(this._channel, this._schema, this._metadata); this._nodeInfo = await this._nodeMethods.getNodeInfo(); this._transactionMethods = new transaction_methods_1.TransactionMethods(this._channel, this._schema, this._metadata, this._nodeInfo); this._eventMethods = new event_methods_1.EventMethods(this._channel, this._metadata); } async disconnect() { return this._channel.disconnect(); } async invoke(actionName, params) { return this._channel.invoke(actionName, params); } subscribe(eventName, cb) { this._channel.subscribe(eventName, cb); } get schema() { return this._schema; } get metadata() { return this._metadata; } get node() { return this._nodeMethods; } get block() { return this._blockMethods; } get transaction() { return this._transactionMethods; } get event() { return this._eventMethods; } } exports.APIClient = APIClient; //# sourceMappingURL=api_client.js.map