@hashgraph/sdk
Version:
3 lines (2 loc) • 2.76 kB
JavaScript
import e from"./TopicId.js";import o from"../account/AccountId.js";import t from"../Timestamp.js";import u from"long";import n from"../Duration.js";import*as i from"@hashgraph/proto";import s from"../Key.js";import r from"../LedgerId.js";import m from"../token/CustomFixedFee.js";class l{constructor(e){this.topicId=e.topicId,this.topicMemo=e.topicMemo,this.runningHash=e.runningHash,this.sequenceNumber=e.sequenceNumber,this.expirationTime=e.expirationTime,this.adminKey=e.adminKey,this.submitKey=e.submitKey,this.feeScheduleKey=e.feeScheduleKey,this.feeExemptKeys=e.feeExemptKeys,this.autoRenewPeriod=e.autoRenewPeriod,this.autoRenewAccountId=e.autoRenewAccountId,this.customFees=e.customFees,this.ledgerId=e.ledgerId,Object.freeze(this)}static _fromProtobuf(i){const c=i.topicInfo;return new l({topicId:e._fromProtobuf(i.topicID),topicMemo:null!=c.memo?c.memo:"",runningHash:null!=c.runningHash?c.runningHash:new Uint8Array,sequenceNumber:null!=c.sequenceNumber?c.sequenceNumber instanceof u?c.sequenceNumber:u.fromValue(c.sequenceNumber):u.ZERO,expirationTime:null!=c.expirationTime?t._fromProtobuf(c.expirationTime):null,adminKey:null!=c.adminKey?s._fromProtobufKey(c.adminKey):null,submitKey:null!=c.submitKey?s._fromProtobufKey(c.submitKey):null,feeScheduleKey:null!=c.feeScheduleKey?s._fromProtobufKey(c.feeScheduleKey):null,feeExemptKeys:null!=c.feeExemptKeyList?c.feeExemptKeyList.map(e=>s._fromProtobufKey(e)):null,autoRenewPeriod:null!=c.autoRenewPeriod?new n(c.autoRenewPeriod.seconds):null,autoRenewAccountId:null!=c.autoRenewAccount?o._fromProtobuf(c.autoRenewAccount):null,customFees:null!=c.customFees?c.customFees.map(e=>m._fromProtobuf(e)):null,ledgerId:null!=c.ledgerId?r.fromBytes(c.ledgerId):null})}_toProtobuf(){return{topicID:this.topicId._toProtobuf(),topicInfo:{memo:this.topicMemo,runningHash:this.runningHash,sequenceNumber:this.sequenceNumber,expirationTime:null!=this.expirationTime?this.expirationTime._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?this.feeExemptKeys.map(e=>e._toProtobufKey()):null,autoRenewPeriod:null!=this.autoRenewPeriod?this.autoRenewPeriod._toProtobuf():null,autoRenewAccount:null!=this.autoRenewAccountId?this.autoRenewAccountId._toProtobuf():null,customFees:null!=this.customFees?this.customFees.map(e=>e._toProtobuf()):null}}}static fromBytes(e){return l._fromProtobuf(i.proto.ConsensusGetTopicInfoResponse.decode(e))}toBytes(){return i.proto.ConsensusGetTopicInfoResponse.encode(this._toProtobuf()).finish()}}export{l as default};
//# sourceMappingURL=TopicInfo.js.map