UNPKG

@pokt-network/pocket-js

Version:

Pocket-js core package with the main functionalities to interact with the Pocket Network.

58 lines 1.6 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.QueryNodeResponse = void 0; var __1 = require("../"); /** * * * @class QueryNodeResponse */ var QueryNodeResponse = /** @class */ (function () { /** * Node Response. * @constructor * @param {Node} node - Node object. */ function QueryNodeResponse(node) { this.node = node; if (!this.isValid()) { throw new TypeError("Invalid Node Response properties length."); } } /** * * Creates a QueryNodeResponse object using a JSON string * @param {String} json - JSON string. * @returns {QueryNodeResponse} - QueryNodeResponse object. * @memberof QueryNodeResponse */ QueryNodeResponse.fromJSON = function (json) { try { return new QueryNodeResponse(__1.Node.fromJSON(json)); } catch (error) { throw error; } }; /** * * Creates a JSON object with the QueryNodeResponse properties * @returns {JSON} - JSON Object. * @memberof QueryNodeResponse */ QueryNodeResponse.prototype.toJSON = function () { return this.node.toJSON(); }; /** * * Check if the QueryNodeResponse object is valid * @returns {boolean} - True or false. * @memberof QueryNodeResponse */ QueryNodeResponse.prototype.isValid = function () { return this.node.isValid(); }; return QueryNodeResponse; }()); exports.QueryNodeResponse = QueryNodeResponse; //# sourceMappingURL=query-node-response.js.map