UNPKG

@hashgraph/sdk

Version:
72 lines (66 loc) 2.41 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var HieroProto = _interopRequireWildcard(require("@hashgraph/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); } // SPDX-License-Identifier: Apache-2.0 /** * @deprecated - Use mirror node for contract traceability instead */ class StorageChange { /** * @private * @param {object} props * @param {Uint8Array} props.slot * @param {Uint8Array} props.valueRead * @param {Uint8Array?} props.valueWritten */ constructor(props) { this.slot = props.slot; this.valueRead = props.valueRead; this.valueWritten = props.valueWritten; } /** * @internal * @param {HieroProto.proto.IStorageChange} change * @returns {StorageChange} */ static _fromProtobuf(change) { // eslint-disable-next-line deprecation/deprecation return new StorageChange({ slot: (/** @type {Uint8Array} */change.slot), valueRead: (/** @type {Uint8Array} */change.valueRead), valueWritten: change.valueWritten != null && change.valueWritten.value != null ? change.valueWritten.value : null }); } /** * @param {Uint8Array} bytes * @returns {StorageChange} */ static fromBytes(bytes) { // eslint-disable-next-line deprecation/deprecation return StorageChange._fromProtobuf(HieroProto.proto.StorageChange.decode(bytes)); } /** * @internal * @returns {HieroProto.proto.IStorageChange} */ _toProtobuf() { return { slot: this.slot, valueRead: this.valueRead, valueWritten: this.valueWritten != null ? { value: this.valueWritten } : null }; } /** * @returns {Uint8Array} */ toBytes() { return HieroProto.proto.StorageChange.encode(this._toProtobuf()).finish(); } } exports.default = StorageChange;