@hashgraph/sdk
Version:
3 lines (2 loc) • 7.33 kB
JavaScript
import e from"./TokenId.js";import t,{TRANSACTION_REGISTRY as o}from"../transaction/Transaction.js";import n from"../account/AccountId.js";import i from"../Timestamp.js";import r from"../Duration.js";import u from"../Key.js";import s from"./TokenKeyValidation.js";class a extends t{constructor(e={}){super(),this._tokenId=null,this._tokenName=null,this._tokenSymbol=null,this._treasuryAccountId=null,this._adminKey=null,this._kycKey=null,this._freezeKey=null,this._wipeKey=null,this._supplyKey=null,this._autoRenewAccountId=null,this._expirationTime=null,this._autoRenewPeriod=null,this._tokenMemo=null,this._feeScheduleKey=null,this._pauseKey=null,this._metadataKey=null,this._metadata=null,this._keyVerificationMode=s.FullValidation,null!=e.tokenId&&this.setTokenId(e.tokenId),null!=e.tokenName&&this.setTokenName(e.tokenName),null!=e.tokenSymbol&&this.setTokenSymbol(e.tokenSymbol),null!=e.treasuryAccountId&&this.setTreasuryAccountId(e.treasuryAccountId),null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.kycKey&&this.setKycKey(e.kycKey),null!=e.freezeKey&&this.setFreezeKey(e.freezeKey),null!=e.wipeKey&&this.setWipeKey(e.wipeKey),null!=e.supplyKey&&this.setSupplyKey(e.supplyKey),null!=e.autoRenewAccountId&&this.setAutoRenewAccountId(e.autoRenewAccountId),null!=e.expirationTime&&this.setExpirationTime(e.expirationTime),null!=e.autoRenewPeriod&&this.setAutoRenewPeriod(e.autoRenewPeriod),null!=e.tokenMemo&&this.setTokenMemo(e.tokenMemo),null!=e.feeScheduleKey&&this.setFeeScheduleKey(e.feeScheduleKey),null!=e.pauseKey&&this.setPauseKey(e.pauseKey),null!=e.metadataKey&&this.setMetadataKey(e.metadataKey),null!=e.metadata&&this.setMetadata(e.metadata),null!=e.keyVerificationMode&&this.setKeyVerificationMode(e.keyVerificationMode)}static _fromProtobuf(o,l,y,h,d){const _=d[0].tokenUpdate;return t._fromProtobufTransactions(new a({tokenId:null!=_.token?e._fromProtobuf(_.token):void 0,tokenName:Object.hasOwn(_,"name")?_.name:void 0,tokenSymbol:Object.hasOwn(_,"symbol")?_.symbol:void 0,treasuryAccountId:null!=_.treasury?n._fromProtobuf(_.treasury):void 0,adminKey:null!=_.adminKey?u._fromProtobufKey(_.adminKey):void 0,kycKey:null!=_.kycKey?u._fromProtobufKey(_.kycKey):void 0,freezeKey:null!=_.freezeKey?u._fromProtobufKey(_.freezeKey):void 0,wipeKey:null!=_.wipeKey?u._fromProtobufKey(_.wipeKey):void 0,supplyKey:null!=_.supplyKey?u._fromProtobufKey(_.supplyKey):void 0,autoRenewAccountId:null!=_.autoRenewAccount?n._fromProtobuf(_.autoRenewAccount):void 0,expirationTime:null!=_.expiry?i._fromProtobuf(_.expiry):void 0,autoRenewPeriod:null!=_.autoRenewPeriod?r._fromProtobuf(_.autoRenewPeriod):void 0,tokenMemo:null!=_.memo&&Object.hasOwn(_.memo,"value")?_.memo.value:void 0,feeScheduleKey:null!=_.feeScheduleKey?u._fromProtobufKey(_.feeScheduleKey):void 0,pauseKey:null!=_.pauseKey?u._fromProtobufKey(_.pauseKey):void 0,metadataKey:null!=_.metadataKey?u._fromProtobufKey(_.metadataKey):void 0,metadata:null!=_.metadata&&Object.hasOwn(_.metadata,"value")?_.metadata.value:void 0,keyVerificationMode:null!=_.keyVerificationMode?s._fromCode(_.keyVerificationMode):void 0}),o,l,y,h,d)}get tokenId(){return this._tokenId}setTokenId(t){return this._requireNotFrozen(),this._tokenId="string"==typeof t?e.fromString(t):t.clone(),this}get tokenName(){return this._tokenName}setTokenName(e){return this._requireNotFrozen(),this._tokenName=e,this}get tokenSymbol(){return this._tokenSymbol}setTokenSymbol(e){return this._requireNotFrozen(),this._tokenSymbol=e,this}get treasuryAccountId(){return this._treasuryAccountId}setTreasuryAccountId(e){return this._requireNotFrozen(),this._treasuryAccountId="string"==typeof e?n.fromString(e):e.clone(),this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get kycKey(){return this._kycKey}setKycKey(e){return this._requireNotFrozen(),this._kycKey=e,this}get freezeKey(){return this._freezeKey}setFreezeKey(e){return this._requireNotFrozen(),this._freezeKey=e,this}get wipeKey(){return this._wipeKey}setWipeKey(e){return this._requireNotFrozen(),this._wipeKey=e,this}get supplyKey(){return this._supplyKey}setSupplyKey(e){return this._requireNotFrozen(),this._supplyKey=e,this}setsupplyKey(e){return this._requireNotFrozen(),this._supplyKey=e,this}get expirationTime(){return this._expirationTime}setExpirationTime(e){return this._requireNotFrozen(),this._expirationTime=e instanceof i?e:i.fromDate(e),this}get autoRenewAccountId(){return this._autoRenewAccountId}setAutoRenewAccountId(e){return this._requireNotFrozen(),this._autoRenewAccountId=e instanceof n?e:n.fromString(e),this}get autoRenewPeriod(){return this._autoRenewPeriod}setAutoRenewPeriod(e){return this._requireNotFrozen(),this._autoRenewPeriod=e instanceof r?e:new r(e),this}get tokenMemo(){return this._tokenMemo}setTokenMemo(e){return this._requireNotFrozen(),this._tokenMemo=e,this}get feeScheduleKey(){return this._feeScheduleKey}setFeeScheduleKey(e){return this._requireNotFrozen(),this._feeScheduleKey=e,this}get pauseKey(){return this._pauseKey}setPauseKey(e){return this._requireNotFrozen(),this._pauseKey=e,this}get metadataKey(){return this._metadataKey}setMetadataKey(e){return this._requireNotFrozen(),this._metadataKey=e,this}get metadata(){return this._metadata}setMetadata(e){return this._requireNotFrozen(),this._metadata=e,this}get keyVerificationMode(){return this._keyVerificationMode}setKeyVerificationMode(e){return this._requireNotFrozen(),this._keyVerificationMode=e,this}clearTokenMemo(){return this._requireNotFrozen(),this._tokenMemo=null,this}_validateChecksums(e){null!=this._tokenId&&this._tokenId.validateChecksum(e),null!=this._treasuryAccountId&&this._treasuryAccountId.validateChecksum(e),null!=this._autoRenewAccountId&&this._autoRenewAccountId.validateChecksum(e)}_execute(e,t){return e.token.updateToken(t)}_getTransactionDataCase(){return"tokenUpdate"}_makeTransactionData(){return{token:null!=this._tokenId?this._tokenId._toProtobuf():null,name:null!=this.tokenName?this.tokenName:null,symbol:this.tokenSymbol,treasury:null!=this._treasuryAccountId?this._treasuryAccountId._toProtobuf():null,adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,kycKey:null!=this._kycKey?this._kycKey._toProtobufKey():null,freezeKey:null!=this._freezeKey?this._freezeKey._toProtobufKey():null,pauseKey:null!=this._pauseKey?this._pauseKey._toProtobufKey():null,wipeKey:null!=this._wipeKey?this._wipeKey._toProtobufKey():null,supplyKey:null!=this._supplyKey?this._supplyKey._toProtobufKey():null,autoRenewAccount:null!=this._autoRenewAccountId?this._autoRenewAccountId._toProtobuf():null,expiry:null!=this._expirationTime?this._expirationTime._toProtobuf():null,autoRenewPeriod:null!=this._autoRenewPeriod?this._autoRenewPeriod._toProtobuf():null,memo:null!=this._tokenMemo?{value:this._tokenMemo}:null,feeScheduleKey:null!=this._feeScheduleKey?this._feeScheduleKey._toProtobufKey():null,metadataKey:null!=this._metadataKey?this._metadataKey._toProtobufKey():null,metadata:null!=this._metadata?{value:this._metadata}:null,keyVerificationMode:null!=this._keyVerificationMode?this._keyVerificationMode._code:void 0}}_getLogId(){return`TokenUpdateTransaction:${this._transactionIds.current.validStart.toString()}`}}o.set("tokenUpdate",a._fromProtobuf);export{a as default};
//# sourceMappingURL=TokenUpdateTransaction.js.map