@hashgraph/sdk
Version:
3 lines (2 loc) • 2.98 kB
JavaScript
import e from"./ScheduleId.js";import o from"../account/AccountId.js";import t from"../Timestamp.js";import n from"../transaction/Transaction.js";import*as i from"@hashgraph/proto";import r from"../transaction/TransactionId.js";import s from"../Key.js";import l from"../KeyList.js";const{proto:a}=i;class c{constructor(e){this.scheduleId=e.scheduleId,this.creatorAccountId=e.creatorAccountID,this.payerAccountId=e.payerAccountID,this.schedulableTransactionBody=e.schedulableTransactionBody,this.signers=e.signers,this.scheduleMemo=e.scheduleMemo,this.adminKey=null!=e.adminKey?e.adminKey:null,this.expirationTime=e.expirationTime,this.executed=e.executed,this.deleted=e.deleted,this.scheduledTransactionId=e.scheduledTransactionId,this.waitForExpiry=e.waitForExpiry,Object.freeze(this)}static _fromProtobuf(n){return new c({scheduleId:e._fromProtobuf(n.scheduleID),creatorAccountID:null!=n.creatorAccountID?o._fromProtobuf(n.creatorAccountID):null,payerAccountID:null!=n.payerAccountID?o._fromProtobuf(n.payerAccountID):null,schedulableTransactionBody:null!=n.scheduledTransactionBody?n.scheduledTransactionBody:null,adminKey:null!=n.adminKey?s._fromProtobufKey(n.adminKey):null,signers:null!=n.signers?l.__fromProtobufKeyList(n.signers):null,scheduleMemo:null!=n.memo?n.memo:null,expirationTime:null!=n.expirationTime?t._fromProtobuf(n.expirationTime):null,executed:null!=n.executionTime?t._fromProtobuf(n.executionTime):null,deleted:null!=n.deletionTime?t._fromProtobuf(n.deletionTime):null,scheduledTransactionId:null!=n.scheduledTransactionID?r._fromProtobuf(n.scheduledTransactionID):null,waitForExpiry:null!=n.waitForExpiry&&n.waitForExpiry})}_toProtobuf(){return{scheduleID:null!=this.scheduleId?this.scheduleId._toProtobuf():null,creatorAccountID:null!=this.creatorAccountId?this.creatorAccountId._toProtobuf():null,payerAccountID:null!=this.payerAccountId?this.payerAccountId._toProtobuf():null,scheduledTransactionBody:null!=this.schedulableTransactionBody?this.schedulableTransactionBody:null,adminKey:null!=this.adminKey?this.adminKey._toProtobufKey():null,signers:null!=this.signers?this.signers._toProtobufKey().keyList:null,memo:null!=this.scheduleMemo?this.scheduleMemo:"",expirationTime:null!=this.expirationTime?this.expirationTime._toProtobuf():null,scheduledTransactionID:null!=this.scheduledTransactionId?this.scheduledTransactionId._toProtobuf():null,waitForExpiry:this.waitForExpiry}}get scheduledTransaction(){if(null==this.schedulableTransactionBody)throw new Error("Scheduled transaction body is empty");const e=new a.SchedulableTransactionBody(this.schedulableTransactionBody),o=e.data;return n.fromBytes(a.TransactionList.encode({transactionList:[{signedTransactionBytes:a.SignedTransaction.encode({bodyBytes:a.TransactionBody.encode({transactionFee:this.schedulableTransactionBody.transactionFee,memo:this.schedulableTransactionBody.memo,[o]:e[o]}).finish()}).finish()}]}).finish())}}export{c as default};
//# sourceMappingURL=ScheduleInfo.js.map