@hashgraph/sdk
Version:
3 lines (2 loc) • 1.51 kB
JavaScript
import t,{TRANSACTION_REGISTRY as e}from"../transaction/Transaction.js";import n from"./AccountId.js";import o from"../token/NftId.js";import l from"./TokenNftAllowance.js";class r extends t{constructor(t={}){super(),this._nftAllowances=null!=t.nftAllowances?t.nftAllowances:[]}static _fromProtobuf(e,n,o,s,a){const c=a[0].cryptoDeleteAllowance;return t._fromProtobufTransactions(new r({nftAllowances:(null!=c.nftAllowances?c.nftAllowances:[]).map(t=>l._fromProtobuf(t))}),e,n,o,s,a)}get tokenNftAllowanceDeletions(){return this._nftAllowances}deleteAllTokenNftAllowances(t,e){this._requireNotFrozen();const r="string"==typeof t?o.fromString(t):t,s="string"==typeof e?n.fromString(e):e;let a=!1;for(const t of this._nftAllowances)if(0===t.tokenId.compare(r.tokenId)){null!=t.serialNumbers&&t.serialNumbers.push(r.serial),a=!0;break}return a||this._nftAllowances.push(new l({tokenId:r.tokenId,spenderAccountId:null,serialNumbers:[r.serial],ownerAccountId:s,allSerials:!1,delegatingSpender:null})),this}_validateChecksums(t){this._nftAllowances.map(e=>e._validateChecksums(t))}_execute(t,e){return t.crypto.deleteAllowances(e)}_getTransactionDataCase(){return"cryptoDeleteAllowance"}_makeTransactionData(){return{nftAllowances:this._nftAllowances.map(t=>t._toProtobuf())}}_getLogId(){return`AccountAllowanceDeleteTransaction:${this._transactionIds.current.validStart.toString()}`}}e.set("cryptoDeleteAllowance",r._fromProtobuf);export{r as default};
//# sourceMappingURL=AccountAllowanceDeleteTransaction.js.map