@hiero-ledger/sdk
Version:
3 lines (2 loc) • 3.2 kB
JavaScript
import e from"../Timestamp.js";import t from"../account/AccountId.js";import i,{TRANSACTION_REGISTRY as r,SCHEDULE_CREATE_TRANSACTION as n}from"../transaction/Transaction.js";import o from"../Key.js";import s from"../Hbar.js";import*as a from"@hashgraph/proto";class u extends i{constructor(e={}){super(),this._adminKey=null,this._scheduledTransaction=null,this._payerAccountId=null,this._scheduleMemo=null,this._scheduledSignerPublicKeys=new Set,this._expirationTime=null,this._waitForExpiry=null,null!=e.adminKey&&this.setAdminKey(e.adminKey),null!=e.payerAccountID&&this.setPayerAccountId(e.payerAccountID),null!=e.scheduleMemo&&this.setScheduleMemo(e.scheduleMemo),this._defaultMaxTransactionFee=new s(5)}static _fromProtobuf(r,n,s,c,d){const h=d[0],l=h.scheduleCreate,m=new u({adminKey:null!=l.adminKey?o._fromProtobufKey(l.adminKey):void 0,payerAccountID:null!=l.payerAccountID?t._fromProtobuf(l.payerAccountID):void 0,scheduleMemo:null!=l.memo?l.memo:void 0,waitForExpiry:null!=l.waitForExpiry?l.waitForExpiry:void 0,expirationTime:null!=l.expirationTime?e._fromProtobuf(l.expirationTime):void 0});if(null!=h.scheduleCreate){const e=h.scheduleCreate.scheduledTransactionBody,t=a.proto.TransactionBody.encode(e).finish(),r={signedTransactionBytes:a.proto.SignedTransaction.encode({bodyBytes:t}).finish()},n=a.proto.TransactionList.encode({transactionList:[r]}).finish(),o=i.fromBytes(n);m._setScheduledTransaction(o)}return i._fromProtobufTransactions(m,r,n,s,c,d)}_setScheduledTransaction(e){return this._scheduledTransaction=e,this}get adminKey(){return this._adminKey}setAdminKey(e){return this._requireNotFrozen(),this._adminKey=e,this}get payerAccountId(){return this._payerAccountId}setPayerAccountId(e){return this._requireNotFrozen(),this._payerAccountId=e,this}setScheduleMemo(e){return this._requireNotFrozen(),this._scheduleMemo=e,this}get getScheduleMemo(){return this._requireNotFrozen(),this._scheduleMemo}setScheduledTransaction(e){return this._requireNotFrozen(),e._requireNotFrozen(),this._scheduledTransaction=e.schedule()._scheduledTransaction,this}_validateChecksums(e){null!=this._payerAccountId&&this._payerAccountId.validateChecksum(e)}_execute(e,t){return e.schedule.createSchedule(t)}_getTransactionDataCase(){return"scheduleCreate"}_makeTransactionData(){return{adminKey:null!=this._adminKey?this._adminKey._toProtobufKey():null,payerAccountID:null!=this._payerAccountId?this._payerAccountId._toProtobuf():null,scheduledTransactionBody:null!=this._scheduledTransaction?this._scheduledTransaction._getScheduledTransactionBody():null,memo:this._scheduleMemo,waitForExpiry:this._waitForExpiry,expirationTime:null!=this._expirationTime?this._expirationTime._toProtobuf():null}}_getLogId(){return`ScheduleCreateTransaction:${this._transactionIds.current.validStart.toString()}`}setExpirationTime(e){return this._expirationTime=e,this}get expirationTime(){return this._requireNotFrozen(),this._expirationTime}setWaitForExpiry(e){return this._waitForExpiry=e,this}get waitForExpiry(){return this._requireNotFrozen(),this._waitForExpiry}}r.set("scheduleCreate",u._fromProtobuf),n.push(()=>new u);export{u as default};
//# sourceMappingURL=ScheduleCreateTransaction.js.map