UNPKG

@hashgraph/proto

Version:
876 lines (801 loc) 3.8 MB
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ import * as $protobuf from "protobufjs/minimal"; // Common aliases const $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; // Exported root namespace const $root = $protobuf.roots.hashgraph || ($protobuf.roots.hashgraph = {}); export const com = $root.com = (() => { /** * Namespace com. * @exports com * @namespace */ const com = {}; com.hedera = (function() { /** * Namespace hedera. * @memberof com * @namespace */ const hedera = {}; hedera.hapi = (function() { /** * Namespace hapi. * @memberof com.hedera * @namespace */ const hapi = {}; hapi.block = (function() { /** * Namespace block. * @memberof com.hedera.hapi * @namespace */ const block = {}; block.stream = (function() { /** * Namespace stream. * @memberof com.hedera.hapi.block * @namespace */ const stream = {}; stream.ChainOfTrustProof = (function() { /** * Properties of a ChainOfTrustProof. * @memberof com.hedera.hapi.block.stream * @interface IChainOfTrustProof * @property {com.hedera.hapi.block.stream.INodeSignatures|null} [nodeSignatures] If there is not yet a SNARK proving the chain of trust from ledger id to * the hinTS verification key, the explicit list of Schnorr signatures on * the concatenation of the ledger id and genesis hinTS verification key * that serve as witnesses for the SNARK prover algorithm. * @property {Uint8Array|null} [wrapsProof] If known, a ZK-compressed SNARK proof proving the chain of trust from * the ledger id to this hinTS verification key. */ /** * Constructs a new ChainOfTrustProof. * @memberof com.hedera.hapi.block.stream * @classdesc Represents a ChainOfTrustProof. * @implements IChainOfTrustProof * @constructor * @param {com.hedera.hapi.block.stream.IChainOfTrustProof=} [p] Properties to set */ function ChainOfTrustProof(p) { if (p) for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; } /** * If there is not yet a SNARK proving the chain of trust from ledger id to * the hinTS verification key, the explicit list of Schnorr signatures on * the concatenation of the ledger id and genesis hinTS verification key * that serve as witnesses for the SNARK prover algorithm. * @member {com.hedera.hapi.block.stream.INodeSignatures|null|undefined} nodeSignatures * @memberof com.hedera.hapi.block.stream.ChainOfTrustProof * @instance */ ChainOfTrustProof.prototype.nodeSignatures = null; /** * If known, a ZK-compressed SNARK proof proving the chain of trust from * the ledger id to this hinTS verification key. * @member {Uint8Array|null|undefined} wrapsProof * @memberof com.hedera.hapi.block.stream.ChainOfTrustProof * @instance */ ChainOfTrustProof.prototype.wrapsProof = null; // OneOf field names bound to virtual getters and setters let $oneOfFields; /** * ChainOfTrustProof proof. * @member {"nodeSignatures"|"wrapsProof"|undefined} proof * @memberof com.hedera.hapi.block.stream.ChainOfTrustProof * @instance */ Object.defineProperty(ChainOfTrustProof.prototype, "proof", { get: $util.oneOfGetter($oneOfFields = ["nodeSignatures", "wrapsProof"]), set: $util.oneOfSetter($oneOfFields) }); /** * Creates a new ChainOfTrustProof instance using the specified properties. * @function create * @memberof com.hedera.hapi.block.stream.ChainOfTrustProof * @static * @param {com.hedera.hapi.block.stream.IChainOfTrustProof=} [properties] Properties to set * @returns {com.hedera.hapi.block.stream.ChainOfTrustProof} ChainOfTrustProof instance */ ChainOfTrustProof.create = function create(properties) { return new ChainOfTrustProof(properties); }; /** * Encodes the specified ChainOfTrustProof message. Does not implicitly {@link com.hedera.hapi.block.stream.ChainOfTrustProof.verify|verify} messages. * @function encode * @memberof com.hedera.hapi.block.stream.ChainOfTrustProof * @static * @param {com.hedera.hapi.block.stream.IChainOfTrustProof} m ChainOfTrustProof message or plain object to encode * @param {$protobuf.Writer} [w] Writer to encode to * @returns {$protobuf.Writer} Writer */ ChainOfTrustProof.encode = function encode(m, w) { if (!w) w = $Writer.create(); if (m.nodeSignatures != null && Object.hasOwnProperty.call(m, "nodeSignatures")) $root.com.hedera.hapi.block.stream.NodeSignatures.encode(m.nodeSignatures, w.uint32(10).fork()).ldelim(); if (m.wrapsProof != null && Object.hasOwnProperty.call(m, "wrapsProof")) w.uint32(18).bytes(m.wrapsProof); return w; }; /** * Decodes a ChainOfTrustProof message from the specified reader or buffer. * @function decode * @memberof com.hedera.hapi.block.stream.ChainOfTrustProof * @static * @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from * @param {number} [l] Message length if known beforehand * @returns {com.hedera.hapi.block.stream.ChainOfTrustProof} ChainOfTrustProof * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ ChainOfTrustProof.decode = function decode(r, l, e) { if (!(r instanceof $Reader)) r = $Reader.create(r); var c = l === undefined ? r.len : r.pos + l, m = new $root.com.hedera.hapi.block.stream.ChainOfTrustProof(); while (r.pos < c) { var t = r.uint32(); if (t === e) break; switch (t >>> 3) { case 1: { m.nodeSignatures = $root.com.hedera.hapi.block.stream.NodeSignatures.decode(r, r.uint32()); break; } case 2: { m.wrapsProof = r.bytes(); break; } default: r.skipType(t & 7); break; } } return m; }; /** * Gets the default type url for ChainOfTrustProof * @function getTypeUrl * @memberof com.hedera.hapi.block.stream.ChainOfTrustProof * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ ChainOfTrustProof.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/com.hedera.hapi.block.stream.ChainOfTrustProof"; }; return ChainOfTrustProof; })(); stream.NodeSignatures = (function() { /** * Properties of a NodeSignatures. * @memberof com.hedera.hapi.block.stream * @interface INodeSignatures * @property {Array.<com.hedera.hapi.block.stream.INodeSignature>|null} [nodeSignatures] NodeSignatures nodeSignatures */ /** * Constructs a new NodeSignatures. * @memberof com.hedera.hapi.block.stream * @classdesc A list of valid node signatures on some data assumed known from the context * of the message, ordered by node id. * <p> * Can be used to prove the genesis hinTS verification key in a block proof; but * not succinct and not recursive; hence in normal operations with TSS, used only * until the first recursive proof is available. * @implements INodeSignatures * @constructor * @param {com.hedera.hapi.block.stream.INodeSignatures=} [p] Properties to set */ function NodeSignatures(p) { this.nodeSignatures = []; if (p) for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; } /** * NodeSignatures nodeSignatures. * @member {Array.<com.hedera.hapi.block.stream.INodeSignature>} nodeSignatures * @memberof com.hedera.hapi.block.stream.NodeSignatures * @instance */ NodeSignatures.prototype.nodeSignatures = $util.emptyArray; /** * Creates a new NodeSignatures instance using the specified properties. * @function create * @memberof com.hedera.hapi.block.stream.NodeSignatures * @static * @param {com.hedera.hapi.block.stream.INodeSignatures=} [properties] Properties to set * @returns {com.hedera.hapi.block.stream.NodeSignatures} NodeSignatures instance */ NodeSignatures.create = function create(properties) { return new NodeSignatures(properties); }; /** * Encodes the specified NodeSignatures message. Does not implicitly {@link com.hedera.hapi.block.stream.NodeSignatures.verify|verify} messages. * @function encode * @memberof com.hedera.hapi.block.stream.NodeSignatures * @static * @param {com.hedera.hapi.block.stream.INodeSignatures} m NodeSignatures message or plain object to encode * @param {$protobuf.Writer} [w] Writer to encode to * @returns {$protobuf.Writer} Writer */ NodeSignatures.encode = function encode(m, w) { if (!w) w = $Writer.create(); if (m.nodeSignatures != null && m.nodeSignatures.length) { for (var i = 0; i < m.nodeSignatures.length; ++i) $root.com.hedera.hapi.block.stream.NodeSignature.encode(m.nodeSignatures[i], w.uint32(10).fork()).ldelim(); } return w; }; /** * Decodes a NodeSignatures message from the specified reader or buffer. * @function decode * @memberof com.hedera.hapi.block.stream.NodeSignatures * @static * @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from * @param {number} [l] Message length if known beforehand * @returns {com.hedera.hapi.block.stream.NodeSignatures} NodeSignatures * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ NodeSignatures.decode = function decode(r, l, e) { if (!(r instanceof $Reader)) r = $Reader.create(r); var c = l === undefined ? r.len : r.pos + l, m = new $root.com.hedera.hapi.block.stream.NodeSignatures(); while (r.pos < c) { var t = r.uint32(); if (t === e) break; switch (t >>> 3) { case 1: { if (!(m.nodeSignatures && m.nodeSignatures.length)) m.nodeSignatures = []; m.nodeSignatures.push($root.com.hedera.hapi.block.stream.NodeSignature.decode(r, r.uint32())); break; } default: r.skipType(t & 7); break; } } return m; }; /** * Gets the default type url for NodeSignatures * @function getTypeUrl * @memberof com.hedera.hapi.block.stream.NodeSignatures * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ NodeSignatures.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/com.hedera.hapi.block.stream.NodeSignatures"; }; return NodeSignatures; })(); stream.NodeSignature = (function() { /** * Properties of a NodeSignature. * @memberof com.hedera.hapi.block.stream * @interface INodeSignature * @property {Long|null} [nodeId] The node id of the signer. * @property {Uint8Array|null} [signature] The signature. */ /** * Constructs a new NodeSignature. * @memberof com.hedera.hapi.block.stream * @classdesc A signature from a node on some data assumed known from the context of the * message. * @implements INodeSignature * @constructor * @param {com.hedera.hapi.block.stream.INodeSignature=} [p] Properties to set */ function NodeSignature(p) { if (p) for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; } /** * The node id of the signer. * @member {Long} nodeId * @memberof com.hedera.hapi.block.stream.NodeSignature * @instance */ NodeSignature.prototype.nodeId = $util.Long ? $util.Long.fromBits(0,0,true) : 0; /** * The signature. * @member {Uint8Array} signature * @memberof com.hedera.hapi.block.stream.NodeSignature * @instance */ NodeSignature.prototype.signature = $util.newBuffer([]); /** * Creates a new NodeSignature instance using the specified properties. * @function create * @memberof com.hedera.hapi.block.stream.NodeSignature * @static * @param {com.hedera.hapi.block.stream.INodeSignature=} [properties] Properties to set * @returns {com.hedera.hapi.block.stream.NodeSignature} NodeSignature instance */ NodeSignature.create = function create(properties) { return new NodeSignature(properties); }; /** * Encodes the specified NodeSignature message. Does not implicitly {@link com.hedera.hapi.block.stream.NodeSignature.verify|verify} messages. * @function encode * @memberof com.hedera.hapi.block.stream.NodeSignature * @static * @param {com.hedera.hapi.block.stream.INodeSignature} m NodeSignature message or plain object to encode * @param {$protobuf.Writer} [w] Writer to encode to * @returns {$protobuf.Writer} Writer */ NodeSignature.encode = function encode(m, w) { if (!w) w = $Writer.create(); if (m.nodeId != null && Object.hasOwnProperty.call(m, "nodeId")) w.uint32(8).uint64(m.nodeId); if (m.signature != null && Object.hasOwnProperty.call(m, "signature")) w.uint32(18).bytes(m.signature); return w; }; /** * Decodes a NodeSignature message from the specified reader or buffer. * @function decode * @memberof com.hedera.hapi.block.stream.NodeSignature * @static * @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from * @param {number} [l] Message length if known beforehand * @returns {com.hedera.hapi.block.stream.NodeSignature} NodeSignature * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ NodeSignature.decode = function decode(r, l, e) { if (!(r instanceof $Reader)) r = $Reader.create(r); var c = l === undefined ? r.len : r.pos + l, m = new $root.com.hedera.hapi.block.stream.NodeSignature(); while (r.pos < c) { var t = r.uint32(); if (t === e) break; switch (t >>> 3) { case 1: { m.nodeId = r.uint64(); break; } case 2: { m.signature = r.bytes(); break; } default: r.skipType(t & 7); break; } } return m; }; /** * Gets the default type url for NodeSignature * @function getTypeUrl * @memberof com.hedera.hapi.block.stream.NodeSignature * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ NodeSignature.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/com.hedera.hapi.block.stream.NodeSignature"; }; return NodeSignature; })(); return stream; })(); return block; })(); hapi.platform = (function() { /** * Namespace platform. * @memberof com.hedera.hapi * @namespace */ const platform = {}; platform.state = (function() { /** * Namespace state. * @memberof com.hedera.hapi.platform * @namespace */ const state = {}; state.PlatformState = (function() { /** * Properties of a PlatformState. * @memberof com.hedera.hapi.platform.state * @interface IPlatformState * @property {proto.ISemanticVersion|null} [creationSoftwareVersion] A version describing the current version of application software. * <p> * This SHALL be the software version that created this state. * @property {number|null} [roundsNonAncient] A number of non-ancient rounds. * <p> * This SHALL be the count of rounds considered non-ancient. * @property {com.hedera.hapi.platform.state.IConsensusSnapshot|null} [consensusSnapshot] A snapshot of the consensus state at the end of the round. * <p> * This SHALL be used for restart/reconnect. * @property {proto.ITimestamp|null} [freezeTime] A timestamp for the next scheduled time when a freeze will start. * <p> * If a freeze is not scheduled, this SHALL NOT be set.<br/> * If a freeze is currently scheduled, this MUST be set, and MUST * match the timestamp requested for that freeze. * @property {proto.ITimestamp|null} [lastFrozenTime] A timestamp for the last time a freeze was performed.<br/> * If not set, there has never been a freeze. * @property {Long|null} [latestFreezeRound] The number of the latest round that was a freeze round. If this round * is a freeze round, then the value is the same as the current round. It * is set after executing all transactions in this round. <br/> * If there has never been a freeze round, this SHALL be zero.<br/> * @property {Uint8Array|null} [legacyRunningEventHash] A running event hash.<br/> * This is computed by the consensus event stream. * <p> * This will be _removed_ and the field number reserved once the consensus * event stream is retired. */ /** * Constructs a new PlatformState. * @memberof com.hedera.hapi.platform.state * @classdesc The current state of platform consensus.<br/> * This message stores the current consensus data for the platform * in network state. * * The platform state SHALL represent the latest round's consensus.<br/> * This data SHALL be used to ensure consistency and provide critical data for * restart and reconnect. * @implements IPlatformState * @constructor * @param {com.hedera.hapi.platform.state.IPlatformState=} [p] Properties to set */ function PlatformState(p) { if (p) for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; } /** * A version describing the current version of application software. * <p> * This SHALL be the software version that created this state. * @member {proto.ISemanticVersion|null|undefined} creationSoftwareVersion * @memberof com.hedera.hapi.platform.state.PlatformState * @instance */ PlatformState.prototype.creationSoftwareVersion = null; /** * A number of non-ancient rounds. * <p> * This SHALL be the count of rounds considered non-ancient. * @member {number} roundsNonAncient * @memberof com.hedera.hapi.platform.state.PlatformState * @instance */ PlatformState.prototype.roundsNonAncient = 0; /** * A snapshot of the consensus state at the end of the round. * <p> * This SHALL be used for restart/reconnect. * @member {com.hedera.hapi.platform.state.IConsensusSnapshot|null|undefined} consensusSnapshot * @memberof com.hedera.hapi.platform.state.PlatformState * @instance */ PlatformState.prototype.consensusSnapshot = null; /** * A timestamp for the next scheduled time when a freeze will start. * <p> * If a freeze is not scheduled, this SHALL NOT be set.<br/> * If a freeze is currently scheduled, this MUST be set, and MUST * match the timestamp requested for that freeze. * @member {proto.ITimestamp|null|undefined} freezeTime * @memberof com.hedera.hapi.platform.state.PlatformState * @instance */ PlatformState.prototype.freezeTime = null; /** * A timestamp for the last time a freeze was performed.<br/> * If not set, there has never been a freeze. * @member {proto.ITimestamp|null|undefined} lastFrozenTime * @memberof com.hedera.hapi.platform.state.PlatformState * @instance */ PlatformState.prototype.lastFrozenTime = null; /** * The number of the latest round that was a freeze round. If this round * is a freeze round, then the value is the same as the current round. It * is set after executing all transactions in this round. <br/> * If there has never been a freeze round, this SHALL be zero.<br/> * @member {Long} latestFreezeRound * @memberof com.hedera.hapi.platform.state.PlatformState * @instance */ PlatformState.prototype.latestFreezeRound = $util.Long ? $util.Long.fromBits(0,0,true) : 0; /** * A running event hash.<br/> * This is computed by the consensus event stream. * <p> * This will be _removed_ and the field number reserved once the consensus * event stream is retired. * @member {Uint8Array} legacyRunningEventHash * @memberof com.hedera.hapi.platform.state.PlatformState * @instance */ PlatformState.prototype.legacyRunningEventHash = $util.newBuffer([]); /** * Creates a new PlatformState instance using the specified properties. * @function create * @memberof com.hedera.hapi.platform.state.PlatformState * @static * @param {com.hedera.hapi.platform.state.IPlatformState=} [properties] Properties to set * @returns {com.hedera.hapi.platform.state.PlatformState} PlatformState instance */ PlatformState.create = function create(properties) { return new PlatformState(properties); }; /** * Encodes the specified PlatformState message. Does not implicitly {@link com.hedera.hapi.platform.state.PlatformState.verify|verify} messages. * @function encode * @memberof com.hedera.hapi.platform.state.PlatformState * @static * @param {com.hedera.hapi.platform.state.IPlatformState} m PlatformState message or plain object to encode * @param {$protobuf.Writer} [w] Writer to encode to * @returns {$protobuf.Writer} Writer */ PlatformState.encode = function encode(m, w) { if (!w) w = $Writer.create(); if (m.creationSoftwareVersion != null && Object.hasOwnProperty.call(m, "creationSoftwareVersion")) $root.proto.SemanticVersion.encode(m.creationSoftwareVersion, w.uint32(10).fork()).ldelim(); if (m.roundsNonAncient != null && Object.hasOwnProperty.call(m, "roundsNonAncient")) w.uint32(16).uint32(m.roundsNonAncient); if (m.consensusSnapshot != null && Object.hasOwnProperty.call(m, "consensusSnapshot")) $root.com.hedera.hapi.platform.state.ConsensusSnapshot.encode(m.consensusSnapshot, w.uint32(26).fork()).ldelim(); if (m.freezeTime != null && Object.hasOwnProperty.call(m, "freezeTime")) $root.proto.Timestamp.encode(m.freezeTime, w.uint32(34).fork()).ldelim(); if (m.lastFrozenTime != null && Object.hasOwnProperty.call(m, "lastFrozenTime")) $root.proto.Timestamp.encode(m.lastFrozenTime, w.uint32(42).fork()).ldelim(); if (m.latestFreezeRound != null && Object.hasOwnProperty.call(m, "latestFreezeRound")) w.uint32(48).uint64(m.latestFreezeRound); if (m.legacyRunningEventHash != null && Object.hasOwnProperty.call(m, "legacyRunningEventHash")) w.uint32(80002).bytes(m.legacyRunningEventHash); return w; }; /** * Decodes a PlatformState message from the specified reader or buffer. * @function decode * @memberof com.hedera.hapi.platform.state.PlatformState * @static * @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from * @param {number} [l] Message length if known beforehand * @returns {com.hedera.hapi.platform.state.PlatformState} PlatformState * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ PlatformState.decode = function decode(r, l, e) { if (!(r instanceof $Reader)) r = $Reader.create(r); var c = l === undefined ? r.len : r.pos + l, m = new $root.com.hedera.hapi.platform.state.PlatformState(); while (r.pos < c) { var t = r.uint32(); if (t === e) break; switch (t >>> 3) { case 1: { m.creationSoftwareVersion = $root.proto.SemanticVersion.decode(r, r.uint32()); break; } case 2: { m.roundsNonAncient = r.uint32(); break; } case 3: { m.consensusSnapshot = $root.com.hedera.hapi.platform.state.ConsensusSnapshot.decode(r, r.uint32()); break; } case 4: { m.freezeTime = $root.proto.Timestamp.decode(r, r.uint32()); break; } case 5: { m.lastFrozenTime = $root.proto.Timestamp.decode(r, r.uint32()); break; } case 6: { m.latestFreezeRound = r.uint64(); break; } case 10000: { m.legacyRunningEventHash = r.bytes(); break; } default: r.skipType(t & 7); break; } } return m; }; /** * Gets the default type url for PlatformState * @function getTypeUrl * @memberof com.hedera.hapi.platform.state.PlatformState * @static * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") * @returns {string} The default type url */ PlatformState.getTypeUrl = function getTypeUrl(typeUrlPrefix) { if (typeUrlPrefix === undefined) { typeUrlPrefix = "type.googleapis.com"; } return typeUrlPrefix + "/com.hedera.hapi.platform.state.PlatformState"; }; return PlatformState; })(); state.ConsensusSnapshot = (function() { /** * Properties of a ConsensusSnapshot. * @memberof com.hedera.hapi.platform.state * @interface IConsensusSnapshot * @property {Long|null} [round] A consensus round.<br/> * The round number of this snapshot. * @property {Array.<com.hedera.hapi.platform.state.IMinimumJudgeInfo>|null} [minimumJudgeInfoList] A list of minimum judge information entries.<br/> * These are "minimum ancient" entries for non-ancient rounds. * @property {Long|null} [nextConsensusNumber] A single consensus number.<br/> * The consensus order of the next event to reach consensus. * @property {proto.ITimestamp|null} [consensusTimestamp] A "consensus" timestamp.<br/> * The consensus timestamp of this snapshot. * <p> * Depending on the context this timestamp may have different meanings: * <ul> * <li>if there are transactions, the timestamp is equal to the timestamp of the last transaction</li> * <li>if there are no transactions, the timestamp is equal to the timestamp of the last event</li> * <li>if there are no events, the timestamp is equal to the timestamp of the previous round plus a small constant</li> * </ul> * <p> * This SHALL be a consensus value and MAY NOT correspond to an actual * "wall clock" timestamp.<br/> * Consensus Timestamps SHALL always increase. * @property {Array.<com.hedera.hapi.platform.state.IJudgeId>|null} [judgeIds] ConsensusSnapshot judgeIds */ /** * Constructs a new ConsensusSnapshot. * @memberof com.hedera.hapi.platform.state * @classdesc A consensus snapshot.<br/> * This is a snapshot of the consensus state for a particular round. * * This message SHALL record consensus data necessary for restart * and reconnect. * @implements IConsensusSnapshot * @constructor * @param {com.hedera.hapi.platform.state.IConsensusSnapshot=} [p] Properties to set */ function ConsensusSnapshot(p) { this.minimumJudgeInfoList = []; this.judgeIds = []; if (p) for (var ks = Object.keys(p), i = 0; i < ks.length; ++i) if (p[ks[i]] != null) this[ks[i]] = p[ks[i]]; } /** * A consensus round.<br/> * The round number of this snapshot. * @member {Long} round * @memberof com.hedera.hapi.platform.state.ConsensusSnapshot * @instance */ ConsensusSnapshot.prototype.round = $util.Long ? $util.Long.fromBits(0,0,true) : 0; /** * A list of minimum judge information entries.<br/> * These are "minimum ancient" entries for non-ancient rounds. * @member {Array.<com.hedera.hapi.platform.state.IMinimumJudgeInfo>} minimumJudgeInfoList * @memberof com.hedera.hapi.platform.state.ConsensusSnapshot * @instance */ ConsensusSnapshot.prototype.minimumJudgeInfoList = $util.emptyArray; /** * A single consensus number.<br/> * The consensus order of the next event to reach consensus. * @member {Long} nextConsensusNumber * @memberof com.hedera.hapi.platform.state.ConsensusSnapshot * @instance */ ConsensusSnapshot.prototype.nextConsensusNumber = $util.Long ? $util.Long.fromBits(0,0,true) : 0; /** * A "consensus" timestamp.<br/> * The consensus timestamp of this snapshot. * <p> * Depending on the context this timestamp may have different meanings: * <ul> * <li>if there are transactions, the timestamp is equal to the timestamp of the last transaction</li> * <li>if there are no transactions, the timestamp is equal to the timestamp of the last event</li> * <li>if there are no events, the timestamp is equal to the timestamp of the previous round plus a small constant</li> * </ul> * <p> * This SHALL be a consensus value and MAY NOT correspond to an actual * "wall clock" timestamp.<br/> * Consensus Timestamps SHALL always increase. * @member {proto.ITimestamp|null|undefined} consensusTimestamp * @memberof com.hedera.hapi.platform.state.ConsensusSnapshot * @instance */ ConsensusSnapshot.prototype.consensusTimestamp = null; /** * ConsensusSnapshot judgeIds. * @member {Array.<com.hedera.hapi.platform.state.IJudgeId>} judgeIds * @memberof com.hedera.hapi.platform.state.ConsensusSnapshot * @instance */ ConsensusSnapshot.prototype.judgeIds = $util.emptyArray; /** * Creates a new ConsensusSnapshot instance using the specified properties. * @function create * @memberof com.hedera.hapi.platform.state.ConsensusSnapshot * @static * @param {com.hedera.hapi.platform.state.IConsensusSnapshot=} [properties] Properties to set * @returns {com.hedera.hapi.platform.state.ConsensusSnapshot} ConsensusSnapshot instance */ ConsensusSnapshot.create = function create(properties) { return new ConsensusSnapshot(properties); }; /** * Encodes the specified ConsensusSnapshot message. Does not implicitly {@link com.hedera.hapi.platform.state.ConsensusSnapshot.verify|verify} messages. * @function encode * @memberof com.hedera.hapi.platform.state.ConsensusSnapshot * @static * @param {com.hedera.hapi.platform.state.IConsensusSnapshot} m ConsensusSnapshot message or plain object to encode * @param {$protobuf.Writer} [w] Writer to encode to * @returns {$protobuf.Writer} Writer */ ConsensusSnapshot.encode = function encode(m, w) { if (!w) w = $Writer.create(); if (m.round != null && Object.hasOwnProperty.call(m, "round")) w.uint32(8).uint64(m.round); if (m.minimumJudgeInfoList != null && m.minimumJudgeInfoList.length) { for (var i = 0; i < m.minimumJudgeInfoList.length; ++i) $root.com.hedera.hapi.platform.state.MinimumJudgeInfo.encode(m.minimumJudgeInfoList[i], w.uint32(26).fork()).ldelim(); } if (m.nextConsensusNumber != null && Object.hasOwnProperty.call(m, "nextConsensusNumber")) w.uint32(32).uint64(m.nextConsensusNumber); if (m.consensusTimestamp != null && Object.hasOwnProperty.call(m, "consensusTimestamp")) $root.proto.Timestamp.encode(m.consensusTimestamp, w.uint32(42).fork()).ldelim(); if (m.judgeIds != null && m.judgeIds.length) { for (var i = 0; i < m.judgeIds.length; ++i) $root.com.hedera.hapi.platform.state.JudgeId.encode(m.judgeIds[i], w.uint32(50).fork()).ldelim(); } return w; }; /** * Decodes a ConsensusSnapshot message from the specified reader or buffer. * @function decode * @memberof com.hedera.hapi.platform.state.ConsensusSnapshot * @static * @param {$protobuf.Reader|Uint8Array} r Reader or buffer to decode from * @param {number} [l] Message length if known beforehand * @returns {com.hedera.hapi.platform.state.ConsensusSnapshot} ConsensusSnapshot * @throws {Error} If the payload is not a reader or valid buffer * @throws {$protobuf.util.ProtocolError} If required fields are missing */ ConsensusSnapshot.decode = function decode(r, l, e) { if (!(r instanceof $Reader)) r = $Reader.create(r);