@hashgraph/sdk
Version:
80 lines (73 loc) • 2.78 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _SemanticVersion = _interopRequireDefault(require("./SemanticVersion.cjs"));
var HieroProto = _interopRequireWildcard(require("@hiero-ledger/proto"));
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
// SPDX-License-Identifier: Apache-2.0
/**
* Response when the client sends the node CryptoGetVersionInfoQuery.
*/
class NetworkVersionInfo {
/**
* @private
* @param {object} props
* @param {SemanticVersion} props.protobufVersion
* @param {SemanticVersion} props.servicesVersion
*/
constructor(props) {
/**
* The account ID for which this information applies.
*
* @readonly
*/
this.protobufVersion = props.protobufVersion;
/**
* The account ID for which this information applies.
*
* @readonly
*/
this.servicesVersion = props.servicesVersion;
Object.freeze(this);
}
/**
* @internal
* @param {HieroProto.proto.INetworkGetVersionInfoResponse} info
* @returns {NetworkVersionInfo}
*/
static _fromProtobuf(info) {
return new NetworkVersionInfo({
protobufVersion: _SemanticVersion.default._fromProtobuf(/** @type {HieroProto.proto.ISemanticVersion} */
info.hapiProtoVersion),
servicesVersion: _SemanticVersion.default._fromProtobuf(/** @type {HieroProto.proto.ISemanticVersion} */
info.hederaServicesVersion)
});
}
/**
* @internal
* @returns {HieroProto.proto.INetworkGetVersionInfoResponse}
*/
_toProtobuf() {
return {
hapiProtoVersion: this.protobufVersion._toProtobuf(),
hederaServicesVersion: this.servicesVersion._toProtobuf()
};
}
/**
* @param {Uint8Array} bytes
* @returns {NetworkVersionInfo}
*/
static fromBytes(bytes) {
return NetworkVersionInfo._fromProtobuf(HieroProto.proto.NetworkGetVersionInfoResponse.decode(bytes));
}
/**
* @returns {Uint8Array}
*/
toBytes() {
return HieroProto.proto.NetworkGetVersionInfoResponse.encode(this._toProtobuf()).finish();
}
}
exports.default = NetworkVersionInfo;