@hashgraph/sdk
Version:
3 lines (2 loc) • 1.61 kB
JavaScript
import e from"./CustomFee.js";import t from"../account/AccountId.js";import o from"long";import r from"./CustomFixedFee.js";class l extends e{constructor(e={}){super(e),this._fallbackFee=null,null!=e.fallbackFee&&this.setFallbackFee(e.fallbackFee),this._numerator=null,null!=e.numerator&&this.setNumerator(e.numerator),this._denominator=null,null!=e.denominator&&this.setDenominator(e.denominator)}get fallbackFee(){return this._fallbackFee}setFallbackFee(e){return this._fallbackFee=e,this}get numerator(){return this._numerator}setNumerator(e){return this._numerator="number"==typeof e?o.fromNumber(e):e,this}get denominator(){return this._denominator}setDenominator(e){return this._denominator="number"==typeof e?o.fromNumber(e):e,this}static _fromProtobuf(e){const o=e.royaltyFee,n=o.exchangeValueFraction;return new l({feeCollectorAccountId:null!=e.feeCollectorAccountId?t._fromProtobuf(e.feeCollectorAccountId):void 0,allCollectorsAreExempt:null!=e.allCollectorsAreExempt?e.allCollectorsAreExempt:void 0,fallbackFee:null!=o.fallbackFee?r._fromProtobuf({fixedFee:o.fallbackFee}):void 0,numerator:null!=n.numerator?n.numerator:void 0,denominator:null!=n.denominator?n.denominator:void 0})}_toProtobuf(){return{feeCollectorAccountId:null!=this.feeCollectorAccountId?this.feeCollectorAccountId._toProtobuf():null,allCollectorsAreExempt:this.allCollectorsAreExempt,royaltyFee:{exchangeValueFraction:{numerator:this._numerator,denominator:this._denominator},fallbackFee:null!=this._fallbackFee?this._fallbackFee._toProtobuf().fixedFee:null}}}}export{l as default};
//# sourceMappingURL=CustomRoyaltyFee.js.map