UNPKG

@hashgraph/sdk

Version:
3 lines (2 loc) 2.57 kB
import t,{TRANSACTION_REGISTRY as r}from"../transaction/Transaction.js";import n from"./ContractId.js";import e from"../account/AccountId.js";class a extends t{constructor(t={}){super(),this._contractId=null,this._transferAccountId=null,this._transferContractId=null,this._permanentRemoval=!1,null!=t.contractId&&this.setContractId(t.contractId),null!=t.transferAccountId&&this.setTransferAccountId(t.transferAccountId),null!=t.transferContractId&&this.setTransferContractId(t.transferContractId),null!=t.permanentRemoval&&this.setPermanentRemoval(t.permanentRemoval)}static _fromProtobuf(r,o,c,s,u){const i=u[0].contractDeleteInstance;return t._fromProtobufTransactions(new a({contractId:null!=i.contractID?n._fromProtobuf(i.contractID):void 0,transferAccountId:null!=i.transferAccountID?e._fromProtobuf(i.transferAccountID):void 0,transferContractId:null!=i.transferContractID?n._fromProtobuf(i.transferContractID):void 0,permanentRemoval:i.permanentRemoval??!1}),r,o,c,s,u)}get contractId(){return this._contractId}setContractId(t){return this._requireNotFrozen(),this._contractId="string"==typeof t?n.fromString(t):t.clone(),this}get transferContractId(){return this._transferContractId}setTransferContractId(t){return this._requireNotFrozen(),this._transferContractId=t instanceof n?t:n.fromString(t),this._transferAccountId=null,this}get transferAccountId(){return this._transferAccountId}setTransferAccountId(t){return this._requireNotFrozen(),this._transferAccountId=t instanceof e?t:e.fromString(t),this._transferContractId=null,this}get permanentRemoval(){return this._permanentRemoval}setPermanentRemoval(t){return this._requireNotFrozen(),this._permanentRemoval=t,this}_validateChecksums(t){null!=this._contractId&&this._contractId.validateChecksum(t),null!=this._transferAccountId&&this._transferAccountId.validateChecksum(t),null!=this._transferContractId&&this._transferContractId.validateChecksum(t)}_execute(t,r){return t.smartContract.deleteContract(r)}_getTransactionDataCase(){return"contractDeleteInstance"}_makeTransactionData(){return{contractID:null!=this._contractId?this._contractId._toProtobuf():null,transferAccountID:this._transferAccountId?this._transferAccountId._toProtobuf():null,transferContractID:null!=this._transferContractId?this._transferContractId._toProtobuf():null,permanentRemoval:this._permanentRemoval}}_getLogId(){return`ContractDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}r.set("contractDeleteInstance",a._fromProtobuf);export{a as default}; //# sourceMappingURL=ContractDeleteTransaction.js.map