@hashgraph/sdk
Version:
78 lines (71 loc) • 2.88 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var HieroProto = _interopRequireWildcard(require("@hashgraph/proto"));
var _FeeSchedule = _interopRequireDefault(require("./FeeSchedule.cjs"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
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
/**
* Represents a pair of fee schedules on the Hedera network - the currently active fee schedule
* and the next upcoming fee schedule. This structure allows for transparent fee updates by making
* future fee changes visible before they take effect.
*/
class FeeSchedules {
/**
* @param {object} [props]
* @param {FeeSchedule} [props.currentFeeSchedule]
* @param {FeeSchedule} [props.nextFeeSchedule]
*/
constructor(props = {}) {
/*
* Contains current Fee Schedule
*
* @type {FeeSchedule}
*/
this.current = props.currentFeeSchedule;
/*
* Contains next Fee Schedule
*
* @type {FeeSchedule}
*/
this.next = props.nextFeeSchedule;
}
/**
* @param {Uint8Array} bytes
* @returns {FeeSchedules}
*/
static fromBytes(bytes) {
return FeeSchedules._fromProtobuf(HieroProto.proto.CurrentAndNextFeeSchedule.decode(bytes));
}
/**
* @internal
* @param {HieroProto.proto.ICurrentAndNextFeeSchedule} feeSchedules
* @returns {FeeSchedules}
*/
static _fromProtobuf(feeSchedules) {
return new FeeSchedules({
currentFeeSchedule: feeSchedules.currentFeeSchedule != null ? _FeeSchedule.default._fromProtobuf(feeSchedules.currentFeeSchedule) : undefined,
nextFeeSchedule: feeSchedules.nextFeeSchedule != null ? _FeeSchedule.default._fromProtobuf(feeSchedules.nextFeeSchedule) : undefined
});
}
/**
* @internal
* @returns {HieroProto.proto.ICurrentAndNextFeeSchedule}
*/
_toProtobuf() {
return {
currentFeeSchedule: this.current != null ? this.current._toProtobuf() : undefined,
nextFeeSchedule: this.next != null ? this.next._toProtobuf() : undefined
};
}
/**
* @returns {Uint8Array}
*/
toBytes() {
return HieroProto.proto.CurrentAndNextFeeSchedule.encode(this._toProtobuf()).finish();
}
}
exports.default = FeeSchedules;
;