UNPKG

@hashgraph/sdk

Version:
3 lines (2 loc) 2 kB
import t,{TRANSACTION_REGISTRY as s}from"../transaction/Transaction.js";import o from"./AccountId.js";import r from"../Duration.js";import n from"../Key.js";import e from"../KeyList.js";class i extends t{constructor(t={}){super(),this._hash=null,this._keys=null,this._duration=null,this._accountId=null,null!=t.hash&&this.setHash(t.hash),null!=t.keys&&this.setKeys(t.keys),null!=t.duration&&this.setDuration(t.duration),null!=t.accountId&&this.setAccountId(t.accountId)}static _fromProtobuf(s,r,e,a,u){const h=u[0].cryptoAddLiveHash.liveHash;return t._fromProtobufTransactions(new i({hash:null!=h.hash?h.hash:void 0,keys:null!=h.keys&&null!=h.keys.keys?h.keys.keys.map(t=>n._fromProtobufKey(t)):void 0,duration:null!=h.duration&&null!=h.duration.seconds?h.duration.seconds:void 0,accountId:null!=h.accountId?o._fromProtobuf(h.accountId):void 0}),s,r,e,a,u)}get hash(){return this._hash}setHash(t){return this._requireNotFrozen(),this._hash=t,this}get keys(){return this._keys}setKeys(t){return this._requireNotFrozen(),this._keys=t instanceof e?t.toArray():t,this}get duration(){return this._duration}setDuration(t){return this._requireNotFrozen(),this._duration=t instanceof r?t:new r(t),this}get accountId(){return this._accountId}setAccountId(t){return this._requireNotFrozen(),this._accountId="string"==typeof t?o.fromString(t):t.clone(),this}_validateChecksums(t){null!=this._accountId&&this._accountId.validateChecksum(t)}_execute(t,s){return t.crypto.addLiveHash(s)}_getTransactionDataCase(){return"cryptoAddLiveHash"}_makeTransactionData(){return{liveHash:{hash:this._hash,keys:null!=this._keys?{keys:this._keys.map(t=>t._toProtobufKey())}:void 0,duration:null!=this._duration?this._duration._toProtobuf():null,accountId:null!=this._accountId?this._accountId._toProtobuf():null}}}_getLogId(){return`LiveHashAddTransaction:${this._transactionIds.current.validStart.toString()}`}}s.set("cryptoAddLiveHash",i._fromProtobuf);export{i as default}; //# sourceMappingURL=LiveHashAddTransaction.js.map