UNPKG

@pokt-network/pocket-js

Version:

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

72 lines 4.54 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Configuration = void 0; /** * * * @class Configuration */ var Configuration = /** @class */ (function () { /** * Stores multiple properties used to interact with the Pocket Network. * @constructor * @param {number} maxDispatchers - (optional) Maximun amount of dispatchers urls to stored in rounting table, default 50. * @param {number} maxSessions - (optional) Maximun amount of sessions to stored for the session manager, default 0. * @param {number} consensusNodeCount - (optional) Maximun amount of nodes for local consensus, mandatory ODD number, default 0. * @param {number} requestTimeOut - (optional) Maximun timeout for every request in miliseconds, default 0. * @param {boolean} acceptDisputedResponses - (optional) Accept or reject responses based on having a full consensus, default false. * @param {number} sessionBlockFrequency - (optional) Amount of blocks that need to elapse for a new session to be tumbled, look at https://github.com/pokt-network/pocket-network-genesis for more information. * @param {number} blockTime - (optional) Amount of time (in milliseconds) for a new block to be produced in the Pocket Network. * @param {number} maxSessionRefreshRetries - (optional) Amount of times to perform a session refresh in case of getting error code 1124 (Invalid Session), default 1. * @param {boolean} validateRelayResponses - (optional) If True the relay responses are validated againt's the relay request information, False will not validate. * @param {boolean} rejectSelfSignedCertificates - (optional) If True the HTTP RPC provider will force certificates to come from CAs, False will allow self signed. * @param {boolean} useLegacyTxCodec - (optional) If True the legacy tx codec will be used (AminoJS), false will use the new ProtoBuf encoding, default is true. * @memberof Configuration */ function Configuration(maxDispatchers, maxSessions, consensusNodeCount, requestTimeOut, acceptDisputedResponses, sessionBlockFrequency, blockTime, maxSessionRefreshRetries, validateRelayResponses, rejectSelfSignedCertificates, useLegacyTxCodec) { if (maxDispatchers === void 0) { maxDispatchers = 50; } if (maxSessions === void 0) { maxSessions = 0; } if (consensusNodeCount === void 0) { consensusNodeCount = 0; } if (requestTimeOut === void 0) { requestTimeOut = 0; } if (acceptDisputedResponses === void 0) { acceptDisputedResponses = false; } if (sessionBlockFrequency === void 0) { sessionBlockFrequency = 25; } if (blockTime === void 0) { blockTime = 60000; } if (maxSessionRefreshRetries === void 0) { maxSessionRefreshRetries = 1; } if (validateRelayResponses === void 0) { validateRelayResponses = true; } if (rejectSelfSignedCertificates === void 0) { rejectSelfSignedCertificates = true; } if (useLegacyTxCodec === void 0) { useLegacyTxCodec = false; } this.maxDispatchers = 50; this.maxSessions = 0; this.consensusNodeCount = 0; this.requestTimeOut = 0; this.acceptDisputedResponses = false; this.sessionBlockFrequency = 4; this.blockTime = 900000; this.maxSessionRefreshRetries = 1; this.validateRelayResponses = true; this.rejectSelfSignedCertificates = true; this.useLegacyTxCodec = false; this.maxDispatchers = maxDispatchers; this.maxSessions = maxSessions; if (consensusNodeCount % 2 === 1 || consensusNodeCount === 0) { this.consensusNodeCount = consensusNodeCount; } else { throw new Error("Failed to instantiate a Configuration class object due to consensusNodeCount not being an odd number."); } this.requestTimeOut = requestTimeOut; this.acceptDisputedResponses = acceptDisputedResponses; this.sessionBlockFrequency = sessionBlockFrequency; this.blockTime = blockTime; this.maxSessionRefreshRetries = maxSessionRefreshRetries; this.validateRelayResponses = validateRelayResponses; this.rejectSelfSignedCertificates = rejectSelfSignedCertificates; this.useLegacyTxCodec = useLegacyTxCodec; } Configuration.prototype.setconsensusNodeCount = function (v) { this.consensusNodeCount = v; }; return Configuration; }()); exports.Configuration = Configuration; //# sourceMappingURL=configuration.js.map