@hiero-ledger/sdk
Version:
3 lines (2 loc) • 5.63 kB
JavaScript
import e,{TRANSACTION_REGISTRY as t}from"../transaction/Transaction.js";import o from"../account/AccountId.js";import i from"./TopicId.js";import s from"../Duration.js";import u from"../Key.js";import n from"../Timestamp.js";import r from"../token/CustomFixedFee.js";class l extends e{constructor(e={}){super(),this._topicId=null,null!=e.topicId&&this.setTopicId(e.topicId),this._topicMemo=null,null!=e.topicMemo&&this.setTopicMemo(e.topicMemo),this._submitKey=null,null!=e.submitKey&&this.setSubmitKey(e.submitKey),this._adminKey=null,null!=e.adminKey&&this.setAdminKey(e.adminKey),this._feeScheduleKey=null,null!=e.feeScheduleKey&&this.setFeeScheduleKey(e.feeScheduleKey),this._feeExemptKeys=null,null!=e.feeExemptKeys&&this.setFeeExemptKeys(e.feeExemptKeys),this._autoRenewAccountId=null,null!=e.autoRenewAccountId&&this.setAutoRenewAccountId(e.autoRenewAccountId),this._autoRenewPeriod=null,null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),this._customFees=null,null!=e.customFees&&this.setCustomFees(e.customFees),this._expirationTime=null,null!=e.expirationTime&&this.setExpirationTime(e.expirationTime)}static _fromProtobuf(t,s,m,c,h){const a=h[0].consensusUpdateTopic;return e._fromProtobufTransactions(new l({topicId:null!=a.topicID?i._fromProtobuf(a.topicID):void 0,adminKey:null!=a.adminKey?u._fromProtobufKey(a.adminKey):void 0,submitKey:null!=a.submitKey?u._fromProtobufKey(a.submitKey):void 0,feeScheduleKey:null!=a.feeScheduleKey?u._fromProtobufKey(a.feeScheduleKey):void 0,feeExemptKeys:null!=a.feeExemptKeyList&&null!=a.feeExemptKeyList.keys?a?.feeExemptKeyList.keys.map(e=>u._fromProtobufKey(e)):void 0,autoRenewAccountId:null!=a.autoRenewAccount?o._fromProtobuf(a.autoRenewAccount):void 0,autoRenewPeriod:null!=a.autoRenewPeriod&&null!=a.autoRenewPeriod.seconds?a.autoRenewPeriod.seconds:void 0,customFees:null!=a.customFees&&null!=a.customFees.fees?a.customFees.fees.map(e=>r._fromProtobuf(e)):void 0,topicMemo:null!=a.memo&&Object.hasOwn(a.memo,"value")?a.memo.value:void 0,expirationTime:null!=a.expirationTime?n._fromProtobuf(a.expirationTime):void 0}),t,s,m,c,h)}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof Date?n.fromDate(e):e,this}get topicId(){return this._topicId}setTopicId(e){return this._requireNotFrozen(),this._topicId="string"==typeof e?i.fromString(e):e.clone(),this}clearTopicId(){return this._requireNotFrozen(),this._topicId=null,this}get topicMemo(){return this._topicMemo}setTopicMemo(e){return this._requireNotFrozen(),this._topicMemo=e,this}clearTopicMemo(){return this._requireNotFrozen(),this._topicMemo=null,this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}clearAdminKey(){return this._requireNotFrozen(),this._adminKey=null,this}get submitKey(){return this._submitKey}setSubmitKey(e){return this._requireNotFrozen(),this._submitKey=e,this}clearSubmitKey(){return this._requireNotFrozen(),this._submitKey=null,this}getFeeScheduleKey(){return this._feeScheduleKey}setFeeScheduleKey(e){return this._requireNotFrozen(),this._feeScheduleKey=e,this}clearFeeScheduleKey(){return this._requireNotFrozen(),this._feeScheduleKey=null,this}getFeeExemptKeys(){return this._feeExemptKeys}setFeeExemptKeys(e){return this._requireNotFrozen(),this._feeExemptKeys=e,this}addFeeExemptKey(e){return this._requireNotFrozen(),null==this._feeExemptKeys&&(this._feeExemptKeys=[]),this._feeExemptKeys.push(e),this}clearFeeExemptKeys(){return this._requireNotFrozen(),this._feeExemptKeys=[],this}get autoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(e){return this._requireNotFrozen(),this._autoRenewAccountId=e instanceof o?e:o.fromString(e),this}clearAutoRenewAccountId(){return this._requireNotFrozen(),this._autoRenewAccountId=null,this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof s?e:new s(e),this}getCustomFees(){return this._customFees}setCustomFees(e){return this._requireNotFrozen(),this._customFees=e,this}addCustomFee(e){return this._requireNotFrozen(),null==this._customFees&&(this._customFees=[]),this._customFees.push(e),this}clearCustomFees(){return this._requireNotFrozen(),this._customFees=[],this}_validateChecksums(e){null!=this._topicId&&this._topicId.validateChecksum(e),null!=this._autoRenewAccountId&&this._autoRenewAccountId.validateChecksum(e)}_execute(e,t){return e.consensus.updateTopic(t)}_getTransactionDataCase(){return"consensusUpdateTopic"}_makeTransactionData(){return{topicID:null!=this._topicId?this._topicId._toProtobuf():null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,submitKey:null!=this._submitKey?this._submitKey._toProtobufKey():null,feeScheduleKey:null!=this._feeScheduleKey?this._feeScheduleKey._toProtobufKey():null,feeExemptKeyList:null!=this._feeExemptKeys?{keys:this._feeExemptKeys.map(e=>e._toProtobufKey())}:null,memo:null!=this._topicMemo?{value:this._topicMemo}:null,autoRenewAccount:null!=this._autoRenewAccountId?this._autoRenewAccountId._toProtobuf():null,autoRenewPeriod:null!=this._autoRenewPeriod?this._autoRenewPeriod._toProtobuf():null,customFees:null!=this._customFees?{fees:this._customFees.map(e=>e._toTopicFeeProtobuf())}:null,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null}}_getLogId(){return`TopicUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}t.set("consensusUpdateTopic",l._fromProtobuf);export{l as default};
//# sourceMappingURL=TopicUpdateTransaction.js.map