@sentio/sdk-bundle 2.41.3-rc.4 → 2.41.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/aptos/builtin/0x1.js +1 -1
- package/lib/aptos/builtin/0x3.js +1 -1
- package/lib/aptos/builtin/index.js +1 -1
- package/lib/aptos/ext/index.js +1 -1
- package/lib/aptos/index.js +1 -1
- package/lib/btc/index.js +1 -1
- package/lib/{chunk-IAXITIIA.js → chunk-2QA4TUBF.js} +2 -2
- package/lib/{chunk-XVDCKPGR.js → chunk-3NB64JZP.js} +2 -2
- package/lib/{chunk-P7BM3HXN.js → chunk-4AM4A5YI.js} +2 -2
- package/lib/{chunk-RYTB6J33.js → chunk-6536NX5H.js} +2 -2
- package/lib/{chunk-77JAYVK7.js → chunk-6FED5COB.js} +2 -2
- package/lib/{chunk-MURSOPCW.js → chunk-6NKFKKM4.js} +2 -2
- package/lib/{chunk-CDDQGDL3.js → chunk-BRMJMPTX.js} +2 -2
- package/lib/{chunk-FS34VAVI.js → chunk-EVQTZUIB.js} +2 -2
- package/lib/{chunk-S6C3J4ZW.js → chunk-GREJR3T2.js} +2 -2
- package/lib/{chunk-DMIS4WAR.js → chunk-KGC37I7H.js} +2 -2
- package/lib/{chunk-QLJOKZKX.js → chunk-LJ2YH3TN.js} +2 -2
- package/lib/{chunk-JD7UBDUO.js → chunk-RJZXWBGU.js} +2 -2
- package/lib/{chunk-6VGVLPOB.js → chunk-S4VMIVT4.js} +2 -2
- package/lib/{chunk-5KL22MEC.js → chunk-UG7PKKD5.js} +2 -2
- package/lib/{chunk-UAAYQGYO.js → chunk-URRJSGRQ.js} +2 -2
- package/lib/{chunk-UAAYQGYO.js.map → chunk-URRJSGRQ.js.map} +1 -1
- package/lib/{chunk-PFDIKBIX.js → chunk-W6WR24QE.js} +2 -2
- package/lib/{chunk-7QRMPZAB.js → chunk-WEP3H77U.js} +2 -2
- package/lib/{chunk-IILXCBA4.js → chunk-YOQOYZZT.js} +2 -2
- package/lib/core/index.js +1 -1
- package/lib/eth/builtin/eacaggregatorproxy.js +1 -1
- package/lib/eth/builtin/erc1155.js +1 -1
- package/lib/eth/builtin/erc20.js +1 -1
- package/lib/eth/builtin/erc721.js +1 -1
- package/lib/eth/builtin/index.js +1 -1
- package/lib/eth/builtin/weth9.js +1 -1
- package/lib/eth/codegen/index.js +1 -1
- package/lib/eth/index.js +1 -1
- package/lib/fuel/index.js +1 -1
- package/lib/index.js +1 -1
- package/lib/move/index.js +1 -1
- package/lib/solana/builtin/index.js +1 -1
- package/lib/solana/index.js +1 -1
- package/lib/stark/index.js +1 -1
- package/lib/store/convert.d.ts.map +1 -1
- package/lib/store/index.js +1 -1
- package/lib/sui/builtin/0x1.js +1 -1
- package/lib/sui/builtin/0x2.js +1 -1
- package/lib/sui/builtin/0x3.js +1 -1
- package/lib/sui/builtin/index.js +1 -1
- package/lib/sui/ext/index.js +1 -1
- package/lib/sui/index.js +1 -1
- package/lib/testing/index.js +1 -1
- package/lib/utils/index.js +1 -1
- package/package.json +2 -2
- package/src/store/convert.ts +6 -2
- /package/lib/{chunk-IAXITIIA.js.map → chunk-2QA4TUBF.js.map} +0 -0
- /package/lib/{chunk-XVDCKPGR.js.map → chunk-3NB64JZP.js.map} +0 -0
- /package/lib/{chunk-P7BM3HXN.js.map → chunk-4AM4A5YI.js.map} +0 -0
- /package/lib/{chunk-RYTB6J33.js.map → chunk-6536NX5H.js.map} +0 -0
- /package/lib/{chunk-77JAYVK7.js.map → chunk-6FED5COB.js.map} +0 -0
- /package/lib/{chunk-MURSOPCW.js.map → chunk-6NKFKKM4.js.map} +0 -0
- /package/lib/{chunk-CDDQGDL3.js.map → chunk-BRMJMPTX.js.map} +0 -0
- /package/lib/{chunk-FS34VAVI.js.map → chunk-EVQTZUIB.js.map} +0 -0
- /package/lib/{chunk-S6C3J4ZW.js.map → chunk-GREJR3T2.js.map} +0 -0
- /package/lib/{chunk-DMIS4WAR.js.map → chunk-KGC37I7H.js.map} +0 -0
- /package/lib/{chunk-QLJOKZKX.js.map → chunk-LJ2YH3TN.js.map} +0 -0
- /package/lib/{chunk-JD7UBDUO.js.map → chunk-RJZXWBGU.js.map} +0 -0
- /package/lib/{chunk-6VGVLPOB.js.map → chunk-S4VMIVT4.js.map} +0 -0
- /package/lib/{chunk-5KL22MEC.js.map → chunk-UG7PKKD5.js.map} +0 -0
- /package/lib/{chunk-PFDIKBIX.js.map → chunk-W6WR24QE.js.map} +0 -0
- /package/lib/{chunk-7QRMPZAB.js.map → chunk-WEP3H77U.js.map} +0 -0
- /package/lib/{chunk-IILXCBA4.js.map → chunk-YOQOYZZT.js.map} +0 -0
|
@@ -915,7 +915,7 @@ Things may not work as expected.
|
|
|
915
915
|
Supported fuel-core version: ${r}.`)}createOperations(){let e=Mr.getFetchFn(this.options),t=new EC.GraphQLClient(this.url,{fetch:(r,i)=>e(r,i,this.options),responseMiddleware:r=>{if("response"in r){let i=r.response;if(Array.isArray(i?.errors))throw new v(v.CODES.INVALID_REQUEST,i.errors.map(a=>a.message).join(`
|
|
916
916
|
|
|
917
917
|
`))}}});return CQ((r,i)=>r.definitions.find(o=>o.kind==="OperationDefinition")?.operation==="subscription"?BC.create({url:this.url,query:r,fetchFn:(o,c)=>e(o,c,this.options),variables:i}):t.request(r,i))}async getVersion(){let{nodeInfo:{nodeVersion:e}}=await this.operations.getVersion();return e}async getBlockNumber(){let{chain:e}=await this.operations.getChain();return C(e.latestBlock.height,10)}async fetchNode(){let{nodeInfo:e}=await this.operations.getNodeInfo(),t={maxDepth:C(e.maxDepth),maxTx:C(e.maxTx),nodeVersion:e.nodeVersion,utxoValidation:e.utxoValidation,vmBacktrace:e.vmBacktrace};return Mr.nodeInfoCache[this.url]=t,t}async fetchChain(){let{chain:e}=await this.operations.getChain(),t=PU(e);return Mr.chainInfoCache[this.url]=t,t}getChainId(){let{consensusParameters:{chainId:e}}=this.getChain();return e.toNumber()}getBaseAssetId(){let{consensusParameters:{baseAssetId:e}}=this.getChain();return e}validateTransaction(e,t){let{maxOutputs:n,maxInputs:r}=t.txParameters;if(C(e.inputs.length).gt(r))throw new v(x.MAX_INPUTS_EXCEEDED,"The transaction exceeds the maximum allowed number of inputs.");if(C(e.outputs.length).gt(n))throw new v(x.MAX_OUTPUTS_EXCEEDED,"The transaction exceeds the maximum allowed number of outputs.")}async sendTransaction(e,{estimateTxDependencies:t=!0}={}){let n=On(e);t&&await this.estimateTxDependencies(n);let{consensusParameters:r}=this.getChain();this.validateTransaction(n,r);let i=L(n.toTransactionBytes()),a;La(n)&&(a=n.abis);let{submit:{id:s}}=await this.operations.submit({encodedTransaction:i});return A_(this,C_,zC).call(this,n.inputs,s),new E_(n,this,a)}async dryRun(e,{utxoValidation:t,estimateTxDependencies:n=!0}={}){let r=On(e);if(n)return this.estimateTxDependencies(r);let i=L(r.toTransactionBytes()),{dryRun:a}=await this.operations.dryRun({encodedTransactions:i,utxoValidation:t||!1}),[{receipts:s,status:o}]=a;return{receipts:s.map(Zs),dryRunStatus:o}}async estimatePredicates(e){if(!!!e.inputs.find(a=>"predicate"in a&&a.predicate&&!qh(P(a.predicate),P("0x"))&&new nr(a.predicateGasUsed).isZero()))return e;let n=L(e.toTransactionBytes()),r=await this.operations.estimatePredicates({encodedTransaction:n}),{estimatePredicates:{inputs:i}}=r;return i&&i.forEach((a,s)=>{"predicateGasUsed"in a&&C(a.predicateGasUsed).gt(0)&&(e.inputs[s].predicateGasUsed=a.predicateGasUsed)}),e}async estimateTxDependencies(e){if(VQ(e))return{receipts:[],outputVariables:0,missingContractIds:[]};let t=[],n=[],r=0,i;for(let a=0;a<pC;a++){let{dryRun:[{receipts:s,status:o}]}=await this.operations.dryRun({encodedTransactions:[L(e.toTransactionBytes())],utxoValidation:!1});t=s.map(Zs),i=o;let{missingOutputVariables:c,missingOutputContractIds:u}=lC(t);if((c.length!==0||u.length!==0)&&La(e)){r+=c.length,e.addVariableOutputs(c.length),u.forEach(({contractId:h})=>{e.addContractInputAndOutput(oe.fromString(h)),n.push(h)});let{maxFee:p}=await this.estimateTxGasAndFee({transactionRequest:e});e.maxFee=p}else break}return{receipts:t,outputVariables:r,missingContractIds:n,dryRunStatus:i}}async estimateMultipleTxDependencies(e){let t=e.map(()=>({receipts:[],outputVariables:0,missingContractIds:[],dryRunStatus:void 0})),n=qt(e),r=new Map;n.forEach((s,o)=>{La(s)&&r.set(o,L(s.toTransactionBytes()))});let i=Array.from(r.keys()),a=0;for(;i.length>0&&a<pC;){let s=i.map(u=>r.get(u)),o=await this.operations.dryRun({encodedTransactions:s,utxoValidation:!1}),c=[];for(let u=0;u<o.dryRun.length;u++){let d=i[u],{receipts:p,status:h}=o.dryRun[u],_=t[d];_.receipts=p.map(Zs),_.dryRunStatus=h;let{missingOutputVariables:w,missingOutputContractIds:A}=lC(_.receipts),I=w.length>0||A.length>0,b=n[d];if(I&&La(b)){_.outputVariables+=w.length,b.addVariableOutputs(w.length),A.forEach(({contractId:k})=>{b.addContractInputAndOutput(oe.fromString(k)),_.missingContractIds.push(k)});let{maxFee:T}=await this.estimateTxGasAndFee({transactionRequest:b});b.maxFee=T,r.set(d,L(b.toTransactionBytes())),c.push(d)}}i=c,a+=1}return t}async dryRunMultipleTransactions(e,{utxoValidation:t,estimateTxDependencies:n=!0}={}){if(n)return this.estimateMultipleTxDependencies(e);let r=e.map(s=>L(s.toTransactionBytes())),{dryRun:i}=await this.operations.dryRun({encodedTransactions:r,utxoValidation:t||!1});return i.map(({receipts:s,status:o})=>({receipts:s.map(Zs),dryRunStatus:o}))}async estimateTxGasAndFee(e){let{transactionRequest:t}=e,{gasPrice:n}=e,r=this.getChain(),{gasPriceFactor:i,maxGasPerTx:a}=this.getGasConfig(),s=t.calculateMinGas(r);n||(n=await this.estimateGasPrice(10));let o=Cd({gasPrice:C(n),gas:s,priceFactor:i,tip:t.tip}).add(1),c=C(0);La(t)&&(c=t.gasLimit,t.gasLimit.eq(0)&&(t.gasLimit=s,t.gasLimit=a.sub(t.calculateMaxGas(r,s)),c=t.gasLimit));let u=t.calculateMaxGas(r,s),d=Cd({gasPrice:C(n),gas:u,priceFactor:i,tip:t.tip}).add(1);return{minGas:s,minFee:o,maxGas:u,maxFee:d,gasPrice:n,gasLimit:c}}async simulate(e,{estimateTxDependencies:t=!0}={}){let n=On(e);if(t)return this.estimateTxDependencies(n);let r=[L(n.toTransactionBytes())],{dryRun:i}=await this.operations.dryRun({encodedTransactions:r,utxoValidation:!0});return{receipts:i.map(s=>{let{id:o,receipts:c,status:u}=s,d=c.map(Zs);return{id:o,receipts:d,status:u}})[0].receipts}}async getTransactionCost(e,{signatureCallback:t}={}){let n=qt(On(e)),r=n.maxFee.eq(0),i=La(n);i&&(n.gasLimit=C(0));let a=qt(n),s=0;if(t&&La(a)){let T=a.witnesses.length;await t(a),s=a.witnesses.length-T}await this.estimatePredicates(a),n.updatePredicateGasUsed(a.inputs);let{maxFee:o,maxGas:c,minFee:u,minGas:d,gasPrice:p,gasLimit:h}=await this.estimateTxGasAndFee({transactionRequest:a}),_=[],w,A=[],I=0,b=C(0);if(n.maxFee=o,i){if(n.gasLimit=h,t&&await t(n),{receipts:_,missingContractIds:A,outputVariables:I,dryRunStatus:w}=await this.estimateTxDependencies(n),w&&"reason"in w)throw this.extractDryRunError(n,_,w);b=Fu(_),n.gasLimit=b,{maxFee:o,maxGas:c,minFee:u,minGas:d,gasPrice:p}=await this.estimateTxGasAndFee({transactionRequest:n,gasPrice:p})}return{receipts:_,gasUsed:b,gasPrice:p,minGas:d,maxGas:c,minFee:u,maxFee:o,outputVariables:I,missingContractIds:A,addedSignatures:s,estimatedPredicates:n.inputs,dryRunStatus:w,updateMaxFee:r}}async getCoins(e,t,n){let r=oe.fromAddressOrString(e),{coins:{edges:i,pageInfo:a}}=await this.operations.getCoins({...this.validatePaginationArgs({paginationLimit:hC,inputArgs:n}),filter:{owner:r.toB256(),assetId:t&&L(t)}});return{coins:i.map(({node:o})=>({id:o.utxoId,assetId:o.assetId,amount:C(o.amount),owner:oe.fromAddressOrString(o.owner),blockCreated:C(o.blockCreated),txCreatedIdx:C(o.txCreatedIdx)})),pageInfo:a}}async getResourcesToSpend(e,t,n){let r=oe.fromAddressOrString(e),i={messages:n?.messages?.map(c=>L(c))||[],utxos:n?.utxos?.map(c=>L(c))||[]};if(this.cache){let c=this.cache.getActiveData();i.messages.push(...c.messages),i.utxos.push(...c.utxos)}let a={owner:r.toB256(),queryPerAsset:t.map(xd).map(({assetId:c,amount:u,max:d})=>({assetId:L(c),amount:u.toString(10),max:d?d.toString(10):void 0})),excludedIds:i};return(await this.operations.getCoinsToSpend(a)).coinsToSpend.flat().map(c=>{switch(c.type){case"MessageCoin":return{amount:C(c.amount),assetId:c.assetId,daHeight:C(c.daHeight),sender:oe.fromAddressOrString(c.sender),recipient:oe.fromAddressOrString(c.recipient),nonce:c.nonce};case"Coin":return{id:c.utxoId,amount:C(c.amount),assetId:c.assetId,owner:oe.fromAddressOrString(c.owner),blockCreated:C(c.blockCreated),txCreatedIdx:C(c.txCreatedIdx)};default:return null}}).filter(c=>!!c)}async getBlock(e){let t;typeof e=="number"?t={height:C(e).toString(10)}:e==="latest"?t={height:(await this.getBlockNumber()).toString(10)}:e.length===66?t={blockId:e}:t={blockId:C(e).toString(10)};let{block:n}=await this.operations.getBlock(t);return n?{id:n.id,height:C(n.height),time:n.header.time,transactionIds:n.transactions.map(r=>r.id)}:null}async getBlocks(e){let{blocks:{edges:t,pageInfo:n}}=await this.operations.getBlocks({...this.validatePaginationArgs({paginationLimit:kU,inputArgs:e})});return{blocks:t.map(({node:i})=>({id:i.id,height:C(i.height),time:i.header.time,transactionIds:i.transactions.map(a=>a.id)})),pageInfo:n}}async getBlockWithTransactions(e){let t;typeof e=="number"?t={blockHeight:C(e).toString(10)}:e==="latest"?t={blockHeight:(await this.getBlockNumber()).toString()}:t={blockId:e};let{block:n}=await this.operations.getBlockWithTransactions(t);return n?{id:n.id,height:C(n.height,10),time:n.header.time,transactionIds:n.transactions.map(r=>r.id),transactions:n.transactions.map(r=>new mn().decode(P(r.rawPayload),0)?.[0])}:null}async getTransaction(e){let{transaction:t}=await this.operations.getTransaction({transactionId:e});return t?new mn().decode(P(t.rawPayload),0)?.[0]:null}async getTransactions(e){let{transactions:{edges:t,pageInfo:n}}=await this.operations.getTransactions(e),r=new mn;return{transactions:t.map(({node:{rawPayload:a}})=>r.decode(P(a),0)[0]),pageInfo:n}}async getContract(e){let{contract:t}=await this.operations.getContract({contractId:e});return t||null}async getContractBalance(e,t){let{contractBalance:n}=await this.operations.getContractBalance({contract:oe.fromAddressOrString(e).toB256(),asset:L(t)});return C(n.amount,10)}async getBalance(e,t){let{balance:n}=await this.operations.getBalance({owner:oe.fromAddressOrString(e).toB256(),assetId:L(t)});return C(n.amount,10)}async getBalances(e){let{balances:{edges:t}}=await this.operations.getBalances({first:1e4,filter:{owner:oe.fromAddressOrString(e).toB256()}});return{balances:t.map(({node:r})=>({assetId:r.assetId,amount:C(r.amount)}))}}async getMessages(e,t){let{messages:{edges:n,pageInfo:r}}=await this.operations.getMessages({...this.validatePaginationArgs({inputArgs:t,paginationLimit:hC}),owner:oe.fromAddressOrString(e).toB256()});return{messages:n.map(({node:a})=>({messageId:xs.getMessageId({sender:a.sender,recipient:a.recipient,nonce:a.nonce,amount:C(a.amount),data:a.data}),sender:oe.fromAddressOrString(a.sender),recipient:oe.fromAddressOrString(a.recipient),nonce:a.nonce,amount:C(a.amount),data:xs.decodeData(a.data),daHeight:C(a.daHeight)})),pageInfo:r}}async getMessageProof(e,t,n,r){let i={transactionId:e,nonce:t};if(n&&r)throw new v(x.INVALID_INPUT_PARAMETERS,"commitBlockId and commitBlockHeight cannot be used together");n&&(i={...i,commitBlockId:n}),r&&(i={...i,commitBlockHeight:r.toNumber().toString()});let a=await this.operations.getMessageProof(i);if(!a.messageProof)return null;let{messageProof:s,messageBlockHeader:o,commitBlockHeader:c,blockProof:u,sender:d,recipient:p,amount:h,data:_}=a.messageProof;return{messageProof:{proofIndex:C(s.proofIndex),proofSet:s.proofSet},blockProof:{proofIndex:C(u.proofIndex),proofSet:u.proofSet},messageBlockHeader:{id:o.id,daHeight:C(o.daHeight),transactionsCount:Number(o.transactionsCount),transactionsRoot:o.transactionsRoot,height:C(o.height),prevRoot:o.prevRoot,time:o.time,applicationHash:o.applicationHash,messageReceiptCount:Number(o.messageReceiptCount),messageOutboxRoot:o.messageOutboxRoot,consensusParametersVersion:Number(o.consensusParametersVersion),eventInboxRoot:o.eventInboxRoot,stateTransitionBytecodeVersion:Number(o.stateTransitionBytecodeVersion)},commitBlockHeader:{id:c.id,daHeight:C(c.daHeight),transactionsCount:Number(c.transactionsCount),transactionsRoot:c.transactionsRoot,height:C(c.height),prevRoot:c.prevRoot,time:c.time,applicationHash:c.applicationHash,messageReceiptCount:Number(c.messageReceiptCount),messageOutboxRoot:c.messageOutboxRoot,consensusParametersVersion:Number(c.consensusParametersVersion),eventInboxRoot:c.eventInboxRoot,stateTransitionBytecodeVersion:Number(c.stateTransitionBytecodeVersion)},sender:oe.fromAddressOrString(d),recipient:oe.fromAddressOrString(p),nonce:t,amount:C(h),data:_}}async getLatestGasPrice(){let{latestGasPrice:e}=await this.operations.getLatestGasPrice();return C(e.gasPrice)}async estimateGasPrice(e){let{estimateGasPrice:t}=await this.operations.estimateGasPrice({blockHorizon:String(e)});return C(t.gasPrice)}async getMessageStatus(e){return(await this.operations.getMessageStatus({nonce:e})).messageStatus}async produceBlocks(e,t){let{produceBlocks:n}=await this.operations.produceBlocks({blocksToProduce:C(e).toString(10),startTimestamp:t?ql.fromUnixMilliseconds(t).toTai64():void 0});return C(n)}async getTransactionResponse(e){return new E_(e,this)}async getMessageByNonce(e){let{message:t}=await this.operations.getMessageByNonce({nonce:e});return t||null}async getRelayedTransactionStatus(e){let{relayedTransactionStatus:t}=await this.operations.getRelayedTransactionStatus({relayedTransactionId:e});return t||null}validatePaginationArgs(e){let{paginationLimit:t,inputArgs:n={}}=e,{first:r,last:i,after:a,before:s}=n;if(a&&s)throw new v(x.INVALID_INPUT_PARAMETERS,'Pagination arguments "after" and "before" cannot be used together');if((r||0)>t||(i||0)>t)throw new v(x.INVALID_INPUT_PARAMETERS,`Pagination limit for this query cannot exceed ${t} items`);if(r&&s)throw new v(x.INVALID_INPUT_PARAMETERS,'The use of pagination argument "first" with "before" is not supported');if(i&&a)throw new v(x.INVALID_INPUT_PARAMETERS,'The use of pagination argument "last" with "after" is not supported');return!r&&!i&&(n.first=t),n}extractDryRunError(e,t,n){let r=n,i=[];return e.abis&&(i=kd(t,e.abis.main,e.abis.otherContractsAbis)),Nd({logs:i,receipts:t,statusReason:r.reason})}},Sd=Mr;C_=new WeakSet;zC=function(e,t){if(!this.cache)return;let n=e.reduce((r,i)=>(i.type===ve.Coin?r.utxos.push(i.id):i.type===ve.Message&&r.messages.push(i.nonce),r),{utxos:[],messages:[]});this.cache.set(t,n)};et(Sd,"chainInfoCache",{});et(Sd,"nodeInfoCache",{});var wd={eth:{sepolia:11155111,foundry:31337},fuel:{devnet:0,testnet:0}};var DU="/",MU=/^\/|\/$/g,FU=(e="")=>e.replace(MU,"");function LU(e,...t){let n=e!=null,r=e?.[0]==="/"&&e.length>1,i=[e,...t].filter(Boolean).map(FU);return r&&n&&i.unshift(""),i.join(DU)}function QU(e,t="./"){return e.map(n=>({...n,icon:LU(t,n.icon)}))}var UU="https://cdn.fuel.network/assets/",qU=[{name:"Ethereum",symbol:"ETH",icon:"eth.svg",networks:[{type:"ethereum",chainId:wd.eth.sepolia,decimals:18},{type:"ethereum",chainId:wd.eth.foundry,decimals:18},{type:"fuel",chainId:wd.fuel.devnet,decimals:9,assetId:"0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"},{type:"fuel",chainId:wd.fuel.testnet,decimals:9,assetId:"0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07"}]}],Bee=QU(qU,UU),mC=(...e)=>{let t={};function n({amount:r,assetId:i}){t[i]?t[i]=t[i].add(r):t[i]=r}return e.forEach(r=>r.forEach(n)),Object.entries(t).map(([r,i])=>({assetId:r,amount:i}))},JU=e=>{let{assetId:t,amountToTransfer:n,hexlifiedContractId:r}=e,a=new H("u64").encode(new nr(n).toNumber());return Uint8Array.from([...P(r),...a,...P(t)])},zU=async e=>{let t=JU(e);await Zt.initWasm();let n=Zt.gtf(16,0,Zt.GTFArgs.ScriptData),r=Zt.addi(17,16,32),i=Zt.lw(18,17,0),a=Zt.addi(19,17,8),s=Zt.tr(16,18,19),o=Zt.ret(1);return{script:Uint8Array.from([...n.to_bytes(),...r.to_bytes(),...i.to_bytes(),...a.to_bytes(),...s.to_bytes(),...o.to_bytes()]),scriptData:t}},VU=5,D_=class extends Xl{address;_provider;_connector;constructor(e,t,n){super(),this._provider=t,this._connector=n,this.address=oe.fromDynamicInput(e)}get provider(){if(!this._provider)throw new v(x.MISSING_PROVIDER,"Provider not set");return this._provider}set provider(e){this._provider=e}connect(e){return this._provider=e,this.provider}async getResourcesToSpend(e,t){return this.provider.getResourcesToSpend(this.address,e,t)}async getCoins(e,t){return this.provider.getCoins(this.address,e,t)}async getMessages(e){return this.provider.getMessages(this.address,e)}async getBalance(e){let t=e??this.provider.getBaseAssetId();return await this.provider.getBalance(this.address,t)}async getBalances(){return this.provider.getBalances(this.address)}async fund(e,t){let{addedSignatures:n,estimatedPredicates:r,requiredQuantities:i,updateMaxFee:a,gasPrice:s}=t,o=e.maxFee,c=this.provider.getBaseAssetId(),u=i.find(b=>b.assetId===c)?.amount||C(0),d=I4({amount:C(o),assetId:c,coinQuantities:i}),p={};d.forEach(({amount:b,assetId:T})=>{p[T]={required:b,owned:C(0)}}),e.inputs.filter(Pu).forEach(b=>{let k=Lu(b)?String(b.assetId):c;p[k]&&(p[k].owned=p[k].owned.add(b.amount))});let h=[];Object.entries(p).forEach(([b,{owned:T,required:k}])=>{T.lt(k)&&h.push({assetId:b,amount:k.sub(T)})});let _=h.length>0,w=0;for(;_&&w<VU;){let b=await this.getResourcesToSpend(h,QQ(e.inputs,this.address));e.addResources(b),e.updatePredicateGasUsed(r);let T=qt(e);if(n&&Array.from({length:n}).forEach(()=>T.addEmptyWitness()),!a){_=!1;break}let{maxFee:k}=await this.provider.estimateTxGasAndFee({transactionRequest:T,gasPrice:s}),O=LQ(e.inputs,c,c),V=u.add(k);O.gt(V)?_=!1:h=[{amount:V.sub(O),assetId:c}],w+=1}if(_)throw new v(x.NOT_ENOUGH_FUNDS,`The account ${this.address} does not have enough base asset funds to cover the transaction execution.`);e.updatePredicateGasUsed(r);let A=qt(e);if(n&&Array.from({length:n}).forEach(()=>A.addEmptyWitness()),!a)return e;let{maxFee:I}=await this.provider.estimateTxGasAndFee({transactionRequest:A});return e.maxFee=I,e}async createTransfer(e,t,n,r={}){let i=new qi(r);return i=this.addTransfer(i,{destination:e,amount:t,assetId:n}),i=await this.estimateAndFundTransaction(i,r),i}async transfer(e,t,n,r={}){let i=await this.createTransfer(e,t,n,r);return this.sendTransaction(i,{estimateTxDependencies:!1})}async batchTransfer(e,t={}){let n=new qi(t);return n=this.addBatchTransfer(n,e),n=await this.estimateAndFundTransaction(n,t),this.sendTransaction(n,{estimateTxDependencies:!1})}addTransfer(e,t){let{destination:n,amount:r,assetId:i}=t;return this.validateTransferAmount(r),e.addCoinOutput(oe.fromAddressOrString(n),r,i??this.provider.getBaseAssetId()),e}addBatchTransfer(e,t){let n=this.provider.getBaseAssetId();return t.forEach(({destination:r,amount:i,assetId:a})=>{this.addTransfer(e,{destination:r,amount:i,assetId:a??n})}),e}async transferToContract(e,t,n,r={}){if(C(t).lte(0))throw new v(x.INVALID_TRANSFER_AMOUNT,"Transfer amount must be a positive number.");let i=oe.fromAddressOrString(e),a=n??this.provider.getBaseAssetId(),{script:s,scriptData:o}=await zU({hexlifiedContractId:i.toB256(),amountToTransfer:C(t),assetId:a}),c=new qi({...r,script:s,scriptData:o});c.addContractInputAndOutput(i);let u=await this.getTransactionCost(c,{quantities:[{amount:C(t),assetId:String(a)}]});return c=this.validateGasLimitAndMaxFee({transactionRequest:c,gasUsed:u.gasUsed,maxFee:u.maxFee,txParams:r}),await this.fund(c,u),this.sendTransaction(c)}async withdrawToBaseLayer(e,t,n={}){let r=oe.fromAddressOrString(e),i=P("0x".concat(r.toHexString().substring(2).padStart(64,"0"))),a=P("0x".concat(C(t).toHex().substring(2).padStart(16,"0"))),o={script:new Uint8Array([...P(zQ.bytes),...i,...a]),...n},c=this.provider.getBaseAssetId(),u=new qi(o),d=[{amount:C(t),assetId:c}],p=await this.getTransactionCost(u,{quantities:d});return u=this.validateGasLimitAndMaxFee({transactionRequest:u,gasUsed:p.gasUsed,maxFee:p.maxFee,txParams:n}),await this.fund(u,p),this.sendTransaction(u)}async getTransactionCost(e,{signatureCallback:t,quantities:n=[]}={}){let r=qt(On(e)),i=this.provider.getBaseAssetId(),a=r.getCoinOutputsQuantities(),s=mC(a,n),o=[{assetId:i,amount:C("100000000000000000")}],c=p=>r.inputs.find(h=>"assetId"in h?h.assetId===p:"recipient"in h?i===p:!1),u=(p,h)=>{let _=c(p),w=h;_&&"amount"in _?_.amount=w:r.addResources(this.generateFakeResources([{amount:h,assetId:p}]))};return mC(s,o).forEach(({amount:p,assetId:h})=>u(h,p)),{...await this.provider.getTransactionCost(r,{signatureCallback:t}),requiredQuantities:s}}async signMessage(e){if(!this._connector)throw new v(x.MISSING_CONNECTOR,"A connector is required to sign messages.");return this._connector.signMessage(this.address.toString(),e)}async signTransaction(e){if(!this._connector)throw new v(x.MISSING_CONNECTOR,"A connector is required to sign transactions.");return this._connector.signTransaction(this.address.toString(),e)}async sendTransaction(e,{estimateTxDependencies:t=!0}={}){if(this._connector)return this.provider.getTransactionResponse(await this._connector.sendTransaction(this.address.toString(),e));let n=On(e);return t&&await this.provider.estimateTxDependencies(n),this.provider.sendTransaction(n,{estimateTxDependencies:!1})}async simulateTransaction(e,{estimateTxDependencies:t=!0}={}){let n=On(e);return t&&await this.provider.estimateTxDependencies(n),this.provider.simulate(n,{estimateTxDependencies:!1})}generateFakeResources(e){return e.map(t=>({id:L(Ot(Ta)),owner:this.address,blockCreated:C(1),txCreatedIdx:C(1),...t}))}validateTransferAmount(e){if(C(e).lte(0))throw new v(x.INVALID_TRANSFER_AMOUNT,"Transfer amount must be a positive number.")}async estimateAndFundTransaction(e,t){let n=e,r=await this.getTransactionCost(n);return n=this.validateGasLimitAndMaxFee({transactionRequest:n,gasUsed:r.gasUsed,maxFee:r.maxFee,txParams:t}),n=await this.fund(n,r),n}validateGasLimitAndMaxFee({gasUsed:e,maxFee:t,transactionRequest:n,txParams:{gasLimit:r,maxFee:i}}){let a=On(n);if(!Rn(r))a.gasLimit=e;else if(e.gt(r))throw new v(x.GAS_LIMIT_TOO_LOW,`Gas limit '${r}' is lower than the required: '${e}'.`);if(!Rn(i))a.maxFee=t;else if(t.gt(i))throw new v(x.MAX_FEE_TOO_LOW,`Max fee '${i}' is lower than the required: '${t}'.`);return a}},Ys=class{address;publicKey;compressedPublicKey;privateKey;constructor(e){typeof e=="string"&&e.match(/^[0-9a-f]*$/i)&&e.length===64&&(e=`0x${e}`);let t=tn(e,32);this.privateKey=L(t),this.publicKey=L(di.getPublicKey(t,!1).slice(1)),this.compressedPublicKey=L(di.getPublicKey(t,!0)),this.address=oe.fromPublicKey(this.publicKey)}sign(e){let t=di.sign(P(e),P(this.privateKey)),n=tn(`0x${t.r.toString(16)}`,32),r=tn(`0x${t.s.toString(16)}`,32);return r[0]|=(t.recovery||0)<<7,L(te([n,r]))}addPoint(e){let t=di.ProjectivePoint.fromHex(P(this.compressedPublicKey)),n=di.ProjectivePoint.fromHex(P(e));return`0x${t.add(n).toHex(!0)}`}static recoverPublicKey(e,t){let n=P(t),r=n.slice(0,32),i=n.slice(32,64),a=(i[0]&128)>>7;i[0]&=127;let o=new di.Signature(BigInt(L(r)),BigInt(L(i))).addRecoveryBit(a).recoverPublicKey(P(e)).toRawBytes(!1).slice(1);return L(o)}static recoverAddress(e,t){return oe.fromPublicKey(Ys.recoverPublicKey(e,t))}static generatePrivateKey(e){return e?nn(te([Ot(32),P(e)])):Ot(32)}static extendPublicKey(e){let t=di.ProjectivePoint.fromHex(P(e));return L(t.toRawBytes(!1).slice(1))}},gC=13,_C=8,AC=1,h_=32,GU=16,yC=e=>/^0x/.test(e)?e.slice(2):e;async function WU(e,t,n){let r=rr(yC(e),"hex"),i=oe.fromAddressOrString(t),a=Ot(h_),s=wh({password:rr(n),salt:a,dklen:h_,n:2**gC,r:_C,p:AC}),o=Ot(GU),c=await Ab(r,s,o),u=Uint8Array.from([...s.subarray(16,32),...c]),d=bh(u),p=As(d,"hex"),h={id:wb(),version:3,address:yC(i.toHexString()),crypto:{cipher:"aes-128-ctr",mac:p,cipherparams:{iv:As(o,"hex")},ciphertext:As(c,"hex"),kdf:"scrypt",kdfparams:{dklen:h_,n:2**gC,p:AC,r:_C,salt:As(a,"hex")}}};return JSON.stringify(h)}async function HU(e,t){let n=JSON.parse(e),{crypto:{mac:r,ciphertext:i,cipherparams:{iv:a},kdfparams:{dklen:s,n:o,r:c,p:u,salt:d}}}=n,p=rr(i,"hex"),h=rr(a,"hex"),_=rr(d,"hex"),w=rr(t),A=wh({password:w,salt:_,n:o,p:u,r:c,dklen:s}),I=Uint8Array.from([...A.subarray(16,32),...p]),b=bh(I),T=As(b,"hex");if(r!==T)throw new v(x.INVALID_PASSWORD,"Failed to decrypt the keystore wallet, the provided password is incorrect.");let k=await _b(p,A,h);return L(k)}var VC=class extends D_{signer;constructor(e,t){let n=new Ys(e);super(n.address,t),this.signer=()=>n}get privateKey(){return this.signer().privateKey}get publicKey(){return this.signer().publicKey}async signMessage(e){let t=await this.signer().sign(Eb(e));return L(t)}async signTransaction(e){let t=On(e),n=this.provider.getChainId(),r=t.getTransactionId(n),i=await this.signer().sign(r);return L(i)}async populateTransactionWitnessesSignature(e){let t=On(e),n=await this.signTransaction(t);return t.updateWitnessByOwner(this.address,n),t}async sendTransaction(e,{estimateTxDependencies:t=!1}={}){let n=On(e);return t&&await this.provider.estimateTxDependencies(n),this.provider.sendTransaction(await this.populateTransactionWitnessesSignature(n),{estimateTxDependencies:!1})}async simulateTransaction(e,{estimateTxDependencies:t=!0}={}){let n=On(e);return t&&await this.provider.estimateTxDependencies(n),this.provider.dryRun(await this.populateTransactionWitnessesSignature(n),{utxoValidation:!0,estimateTxDependencies:!1})}async encrypt(e){return WU(this.privateKey,this.address,e)}};et(VC,"defaultPath","m/44'/1179993420'/0'/0/0");var bd=["abandon","ability","able","about","above","absent","absorb","abstract","absurd","abuse","access","accident","account","accuse","achieve","acid","acoustic","acquire","across","act","action","actor","actress","actual","adapt","add","addict","address","adjust","admit","adult","advance","advice","aerobic","affair","afford","afraid","again","age","agent","agree","ahead","aim","air","airport","aisle","alarm","album","alcohol","alert","alien","all","alley","allow","almost","alone","alpha","already","also","alter","always","amateur","amazing","among","amount","amused","analyst","anchor","ancient","anger","angle","angry","animal","ankle","announce","annual","another","answer","antenna","antique","anxiety","any","apart","apology","appear","apple","approve","april","arch","arctic","area","arena","argue","arm","armed","armor","army","around","arrange","arrest","arrive","arrow","art","artefact","artist","artwork","ask","aspect","assault","asset","assist","assume","asthma","athlete","atom","attack","attend","attitude","attract","auction","audit","august","aunt","author","auto","autumn","average","avocado","avoid","awake","aware","away","awesome","awful","awkward","axis","baby","bachelor","bacon","badge","bag","balance","balcony","ball","bamboo","banana","banner","bar","barely","bargain","barrel","base","basic","basket","battle","beach","bean","beauty","because","become","beef","before","begin","behave","behind","believe","below","belt","bench","benefit","best","betray","better","between","beyond","bicycle","bid","bike","bind","biology","bird","birth","bitter","black","blade","blame","blanket","blast","bleak","bless","blind","blood","blossom","blouse","blue","blur","blush","board","boat","body","boil","bomb","bone","bonus","book","boost","border","boring","borrow","boss","bottom","bounce","box","boy","bracket","brain","brand","brass","brave","bread","breeze","brick","bridge","brief","bright","bring","brisk","broccoli","broken","bronze","broom","brother","brown","brush","bubble","buddy","budget","buffalo","build","bulb","bulk","bullet","bundle","bunker","burden","burger","burst","bus","business","busy","butter","buyer","buzz","cabbage","cabin","cable","cactus","cage","cake","call","calm","camera","camp","can","canal","cancel","candy","cannon","canoe","canvas","canyon","capable","capital","captain","car","carbon","card","cargo","carpet","carry","cart","case","cash","casino","castle","casual","cat","catalog","catch","category","cattle","caught","cause","caution","cave","ceiling","celery","cement","census","century","cereal","certain","chair","chalk","champion","change","chaos","chapter","charge","chase","chat","cheap","check","cheese","chef","cherry","chest","chicken","chief","child","chimney","choice","choose","chronic","chuckle","chunk","churn","cigar","cinnamon","circle","citizen","city","civil","claim","clap","clarify","claw","clay","clean","clerk","clever","click","client","cliff","climb","clinic","clip","clock","clog","close","cloth","cloud","clown","club","clump","cluster","clutch","coach","coast","coconut","code","coffee","coil","coin","collect","color","column","combine","come","comfort","comic","common","company","concert","conduct","confirm","congress","connect","consider","control","convince","cook","cool","copper","copy","coral","core","corn","correct","cost","cotton","couch","country","couple","course","cousin","cover","coyote","crack","cradle","craft","cram","crane","crash","crater","crawl","crazy","cream","credit","creek","crew","cricket","crime","crisp","critic","crop","cross","crouch","crowd","crucial","cruel","cruise","crumble","crunch","crush","cry","crystal","cube","culture","cup","cupboard","curious","current","curtain","curve","cushion","custom","cute","cycle","dad","damage","damp","dance","danger","daring","dash","daughter","dawn","day","deal","debate","debris","decade","december","decide","decline","decorate","decrease","deer","defense","define","defy","degree","delay","deliver","demand","demise","denial","dentist","deny","depart","depend","deposit","depth","deputy","derive","describe","desert","design","desk","despair","destroy","detail","detect","develop","device","devote","diagram","dial","diamond","diary","dice","diesel","diet","differ","digital","dignity","dilemma","dinner","dinosaur","direct","dirt","disagree","discover","disease","dish","dismiss","disorder","display","distance","divert","divide","divorce","dizzy","doctor","document","dog","doll","dolphin","domain","donate","donkey","donor","door","dose","double","dove","draft","dragon","drama","drastic","draw","dream","dress","drift","drill","drink","drip","drive","drop","drum","dry","duck","dumb","dune","during","dust","dutch","duty","dwarf","dynamic","eager","eagle","early","earn","earth","easily","east","easy","echo","ecology","economy","edge","edit","educate","effort","egg","eight","either","elbow","elder","electric","elegant","element","elephant","elevator","elite","else","embark","embody","embrace","emerge","emotion","employ","empower","empty","enable","enact","end","endless","endorse","enemy","energy","enforce","engage","engine","enhance","enjoy","enlist","enough","enrich","enroll","ensure","enter","entire","entry","envelope","episode","equal","equip","era","erase","erode","erosion","error","erupt","escape","essay","essence","estate","eternal","ethics","evidence","evil","evoke","evolve","exact","example","excess","exchange","excite","exclude","excuse","execute","exercise","exhaust","exhibit","exile","exist","exit","exotic","expand","expect","expire","explain","expose","express","extend","extra","eye","eyebrow","fabric","face","faculty","fade","faint","faith","fall","false","fame","family","famous","fan","fancy","fantasy","farm","fashion","fat","fatal","father","fatigue","fault","favorite","feature","february","federal","fee","feed","feel","female","fence","festival","fetch","fever","few","fiber","fiction","field","figure","file","film","filter","final","find","fine","finger","finish","fire","firm","first","fiscal","fish","fit","fitness","fix","flag","flame","flash","flat","flavor","flee","flight","flip","float","flock","floor","flower","fluid","flush","fly","foam","focus","fog","foil","fold","follow","food","foot","force","forest","forget","fork","fortune","forum","forward","fossil","foster","found","fox","fragile","frame","frequent","fresh","friend","fringe","frog","front","frost","frown","frozen","fruit","fuel","fun","funny","furnace","fury","future","gadget","gain","galaxy","gallery","game","gap","garage","garbage","garden","garlic","garment","gas","gasp","gate","gather","gauge","gaze","general","genius","genre","gentle","genuine","gesture","ghost","giant","gift","giggle","ginger","giraffe","girl","give","glad","glance","glare","glass","glide","glimpse","globe","gloom","glory","glove","glow","glue","goat","goddess","gold","good","goose","gorilla","gospel","gossip","govern","gown","grab","grace","grain","grant","grape","grass","gravity","great","green","grid","grief","grit","grocery","group","grow","grunt","guard","guess","guide","guilt","guitar","gun","gym","habit","hair","half","hammer","hamster","hand","happy","harbor","hard","harsh","harvest","hat","have","hawk","hazard","head","health","heart","heavy","hedgehog","height","hello","helmet","help","hen","hero","hidden","high","hill","hint","hip","hire","history","hobby","hockey","hold","hole","holiday","hollow","home","honey","hood","hope","horn","horror","horse","hospital","host","hotel","hour","hover","hub","huge","human","humble","humor","hundred","hungry","hunt","hurdle","hurry","hurt","husband","hybrid","ice","icon","idea","identify","idle","ignore","ill","illegal","illness","image","imitate","immense","immune","impact","impose","improve","impulse","inch","include","income","increase","index","indicate","indoor","industry","infant","inflict","inform","inhale","inherit","initial","inject","injury","inmate","inner","innocent","input","inquiry","insane","insect","inside","inspire","install","intact","interest","into","invest","invite","involve","iron","island","isolate","issue","item","ivory","jacket","jaguar","jar","jazz","jealous","jeans","jelly","jewel","job","join","joke","journey","joy","judge","juice","jump","jungle","junior","junk","just","kangaroo","keen","keep","ketchup","key","kick","kid","kidney","kind","kingdom","kiss","kit","kitchen","kite","kitten","kiwi","knee","knife","knock","know","lab","label","labor","ladder","lady","lake","lamp","language","laptop","large","later","latin","laugh","laundry","lava","law","lawn","lawsuit","layer","lazy","leader","leaf","learn","leave","lecture","left","leg","legal","legend","leisure","lemon","lend","length","lens","leopard","lesson","letter","level","liar","liberty","library","license","life","lift","light","like","limb","limit","link","lion","liquid","list","little","live","lizard","load","loan","lobster","local","lock","logic","lonely","long","loop","lottery","loud","lounge","love","loyal","lucky","luggage","lumber","lunar","lunch","luxury","lyrics","machine","mad","magic","magnet","maid","mail","main","major","make","mammal","man","manage","mandate","mango","mansion","manual","maple","marble","march","margin","marine","market","marriage","mask","mass","master","match","material","math","matrix","matter","maximum","maze","meadow","mean","measure","meat","mechanic","medal","media","melody","melt","member","memory","mention","menu","mercy","merge","merit","merry","mesh","message","metal","method","middle","midnight","milk","million","mimic","mind","minimum","minor","minute","miracle","mirror","misery","miss","mistake","mix","mixed","mixture","mobile","model","modify","mom","moment","monitor","monkey","monster","month","moon","moral","more","morning","mosquito","mother","motion","motor","mountain","mouse","move","movie","much","muffin","mule","multiply","muscle","museum","mushroom","music","must","mutual","myself","mystery","myth","naive","name","napkin","narrow","nasty","nation","nature","near","neck","need","negative","neglect","neither","nephew","nerve","nest","net","network","neutral","never","news","next","nice","night","noble","noise","nominee","noodle","normal","north","nose","notable","note","nothing","notice","novel","now","nuclear","number","nurse","nut","oak","obey","object","oblige","obscure","observe","obtain","obvious","occur","ocean","october","odor","off","offer","office","often","oil","okay","old","olive","olympic","omit","once","one","onion","online","only","open","opera","opinion","oppose","option","orange","orbit","orchard","order","ordinary","organ","orient","original","orphan","ostrich","other","outdoor","outer","output","outside","oval","oven","over","own","owner","oxygen","oyster","ozone","pact","paddle","page","pair","palace","palm","panda","panel","panic","panther","paper","parade","parent","park","parrot","party","pass","patch","path","patient","patrol","pattern","pause","pave","payment","peace","peanut","pear","peasant","pelican","pen","penalty","pencil","people","pepper","perfect","permit","person","pet","phone","photo","phrase","physical","piano","picnic","picture","piece","pig","pigeon","pill","pilot","pink","pioneer","pipe","pistol","pitch","pizza","place","planet","plastic","plate","play","please","pledge","pluck","plug","plunge","poem","poet","point","polar","pole","police","pond","pony","pool","popular","portion","position","possible","post","potato","pottery","poverty","powder","power","practice","praise","predict","prefer","prepare","present","pretty","prevent","price","pride","primary","print","priority","prison","private","prize","problem","process","produce","profit","program","project","promote","proof","property","prosper","protect","proud","provide","public","pudding","pull","pulp","pulse","pumpkin","punch","pupil","puppy","purchase","purity","purpose","purse","push","put","puzzle","pyramid","quality","quantum","quarter","question","quick","quit","quiz","quote","rabbit","raccoon","race","rack","radar","radio","rail","rain","raise","rally","ramp","ranch","random","range","rapid","rare","rate","rather","raven","raw","razor","ready","real","reason","rebel","rebuild","recall","receive","recipe","record","recycle","reduce","reflect","reform","refuse","region","regret","regular","reject","relax","release","relief","rely","remain","remember","remind","remove","render","renew","rent","reopen","repair","repeat","replace","report","require","rescue","resemble","resist","resource","response","result","retire","retreat","return","reunion","reveal","review","reward","rhythm","rib","ribbon","rice","rich","ride","ridge","rifle","right","rigid","ring","riot","ripple","risk","ritual","rival","river","road","roast","robot","robust","rocket","romance","roof","rookie","room","rose","rotate","rough","round","route","royal","rubber","rude","rug","rule","run","runway","rural","sad","saddle","sadness","safe","sail","salad","salmon","salon","salt","salute","same","sample","sand","satisfy","satoshi","sauce","sausage","save","say","scale","scan","scare","scatter","scene","scheme","school","science","scissors","scorpion","scout","scrap","screen","script","scrub","sea","search","season","seat","second","secret","section","security","seed","seek","segment","select","sell","seminar","senior","sense","sentence","series","service","session","settle","setup","seven","shadow","shaft","shallow","share","shed","shell","sheriff","shield","shift","shine","ship","shiver","shock","shoe","shoot","shop","short","shoulder","shove","shrimp","shrug","shuffle","shy","sibling","sick","side","siege","sight","sign","silent","silk","silly","silver","similar","simple","since","sing","siren","sister","situate","six","size","skate","sketch","ski","skill","skin","skirt","skull","slab","slam","sleep","slender","slice","slide","slight","slim","slogan","slot","slow","slush","small","smart","smile","smoke","smooth","snack","snake","snap","sniff","snow","soap","soccer","social","sock","soda","soft","solar","soldier","solid","solution","solve","someone","song","soon","sorry","sort","soul","sound","soup","source","south","space","spare","spatial","spawn","speak","special","speed","spell","spend","sphere","spice","spider","spike","spin","spirit","split","spoil","sponsor","spoon","sport","spot","spray","spread","spring","spy","square","squeeze","squirrel","stable","stadium","staff","stage","stairs","stamp","stand","start","state","stay","steak","steel","stem","step","stereo","stick","still","sting","stock","stomach","stone","stool","story","stove","strategy","street","strike","strong","struggle","student","stuff","stumble","style","subject","submit","subway","success","such","sudden","suffer","sugar","suggest","suit","summer","sun","sunny","sunset","super","supply","supreme","sure","surface","surge","surprise","surround","survey","suspect","sustain","swallow","swamp","swap","swarm","swear","sweet","swift","swim","swing","switch","sword","symbol","symptom","syrup","system","table","tackle","tag","tail","talent","talk","tank","tape","target","task","taste","tattoo","taxi","teach","team","tell","ten","tenant","tennis","tent","term","test","text","thank","that","theme","then","theory","there","they","thing","this","thought","three","thrive","throw","thumb","thunder","ticket","tide","tiger","tilt","timber","time","tiny","tip","tired","tissue","title","toast","tobacco","today","toddler","toe","together","toilet","token","tomato","tomorrow","tone","tongue","tonight","tool","tooth","top","topic","topple","torch","tornado","tortoise","toss","total","tourist","toward","tower","town","toy","track","trade","traffic","tragic","train","transfer","trap","trash","travel","tray","treat","tree","trend","trial","tribe","trick","trigger","trim","trip","trophy","trouble","truck","true","truly","trumpet","trust","truth","try","tube","tuition","tumble","tuna","tunnel","turkey","turn","turtle","twelve","twenty","twice","twin","twist","two","type","typical","ugly","umbrella","unable","unaware","uncle","uncover","under","undo","unfair","unfold","unhappy","uniform","unique","unit","universe","unknown","unlock","until","unusual","unveil","update","upgrade","uphold","upon","upper","upset","urban","urge","usage","use","used","useful","useless","usual","utility","vacant","vacuum","vague","valid","valley","valve","van","vanish","vapor","various","vast","vault","vehicle","velvet","vendor","venture","venue","verb","verify","version","very","vessel","veteran","viable","vibrant","vicious","victory","video","view","village","vintage","violin","virtual","virus","visa","visit","visual","vital","vivid","vocal","voice","void","volcano","volume","vote","voyage","wage","wagon","wait","walk","wall","walnut","want","warfare","warm","warrior","wash","wasp","waste","water","wave","way","wealth","weapon","wear","weasel","weather","web","wedding","weekend","weird","welcome","west","wet","whale","what","wheat","wheel","when","where","whip","whisper","wide","width","wife","wild","will","win","window","wine","wing","wink","winner","winter","wire","wisdom","wise","wish","witness","wolf","woman","wonder","wood","wool","word","work","world","worry","worth","wrap","wreck","wrestle","wrist","write","wrong","yard","year","yellow","you","young","youth","zebra","zero","zone","zoo"];function ZU(e){return(1<<e)-1}function GC(e){return(1<<e)-1<<8-e}function m_(e){return Array.isArray(e)?e:e.split(/\s+/)}function XU(e){return Array.isArray(e)?e.join(" "):e}function YU(e){let t=[0],n=11;for(let a=0;a<e.length;a+=1)n>8?(t[t.length-1]<<=8,t[t.length-1]|=e[a],n-=8):(t[t.length-1]<<=n,t[t.length-1]|=e[a]>>8-n,t.push(e[a]&ZU(8-n)),n+=3);let r=e.length/4,i=P(Ke(e))[0]&GC(r);return t[t.length-1]<<=r,t[t.length-1]|=i>>8-r,t}function $U(e,t){let n=Math.ceil(11*e.length/8),r=P(new Uint8Array(n)),i=0;for(let u=0;u<e.length;u+=1){let d=t.indexOf(e[u].normalize("NFKD"));if(d===-1)throw new v(x.INVALID_MNEMONIC,`Invalid mnemonic: the word '${e[u]}' is not found in the provided wordlist.`);for(let p=0;p<11;p+=1)d&1<<10-p&&(r[i>>3]|=1<<7-i%8),i+=1}let a=32*e.length/3,s=e.length/3,o=GC(s);if((P(Ke(r.slice(0,a/8)))[0]&o)!==(r[r.length-1]&o))throw new v(x.INVALID_CHECKSUM,"Checksum validation failed for the provided mnemonic.");return r.slice(0,a/8)}var KU=Nr("Bitcoin seed"),jU="0x0488ade4",e6="0x04358394",vC=[12,15,18,21,24];function wC(e){if(e.length!==2048)throw new v(x.INVALID_WORD_LIST,`Expected word list length of 2048, but got ${e.length}.`)}function t6(e){if(e.length%4!==0||e.length<16||e.length>32)throw new v(x.INVALID_ENTROPY,`Entropy should be between 16 and 32 bytes and a multiple of 4, but got ${e.length} bytes.`)}function g_(e){if(!vC.includes(e.length)){let t=`Invalid mnemonic size. Expected one of [${vC.join(", ")}] words, but got ${e.length}.`;throw new v(x.INVALID_MNEMONIC,t)}}var Li=class{wordlist;constructor(e=bd){this.wordlist=e,wC(this.wordlist)}mnemonicToEntropy(e){return Li.mnemonicToEntropy(e,this.wordlist)}entropyToMnemonic(e){return Li.entropyToMnemonic(e,this.wordlist)}static mnemonicToEntropy(e,t=bd){let n=m_(e);return g_(n),L($U(n,t))}static entropyToMnemonic(e,t=bd){let n=P(e);return wC(t),t6(n),YU(n).map(r=>t[r]).join(" ")}static mnemonicToSeed(e,t=""){g_(m_(e));let n=Nr(XU(e)),r=Nr(`mnemonic${t}`);return yb(n,r,2048,64,"sha512")}static mnemonicToMasterKeys(e,t=""){let n=Li.mnemonicToSeed(e,t);return Li.masterKeysFromSeed(n)}static isMnemonicValid(e){let t=m_(e),n=0;try{g_(t)}catch{return!1}for(;n<t.length;){if(Li.binarySearch(t[n])===!1)return!1;n+=1}return!0}static binarySearch(e){let t=bd,n=0,r=t.length-1;for(;n<=r;){let i=Math.floor((n+r)/2);if(t[i]===e)return!0;e<t[i]?r=i-1:n=i+1}return!1}static masterKeysFromSeed(e){let t=P(e);if(t.length<16||t.length>64)throw new v(x.INVALID_SEED,`Seed length should be between 16 and 64 bytes, but received ${t.length} bytes.`);return P(Wl("sha512",KU,t))}static seedToExtendedKey(e,t=!1){let n=Li.masterKeysFromSeed(e),r=P(t?e6:jU),i="0x00",a="0x00000000",s="0x00000000",o=n.slice(32),c=n.slice(0,32),u=te([r,i,a,s,o,te(["0x00",c])]),d=Au(Ke(Ke(u)),0,4);return Jl(te([u,d]))}static generate(e=32,t=""){let n=t?Ke(te([Ot(e),P(t)])):Ot(e);return Li.entropyToMnemonic(n)}},M_=Li,WC=2147483648,HC=L("0x0488ade4"),F_=L("0x0488b21e"),ZC=L("0x04358394"),L_=L("0x043587cf");function bC(e){return Jl(te([e,Au(Ke(Ke(e)),0,4)]))}function n6(e=!1,t=!1){return e?t?L_:F_:t?ZC:HC}function r6(e){return[F_,L_].includes(L(e.slice(0,4)))}function i6(e){return[HC,ZC,F_,L_].includes(L(e.slice(0,4)))}function a6(e,t=0){let n=e.split("/");if(n.length===0||n[0]==="m"&&t!==0)throw new v(x.HD_WALLET_ERROR,`invalid path - ${e}`);return n[0]==="m"&&n.shift(),n.map(r=>~r.indexOf("'")?parseInt(r,10)+WC:parseInt(r,10))}var Xs=class{depth=0;index=0;fingerprint=L("0x00000000");parentFingerprint=L("0x00000000");privateKey;publicKey;chainCode;constructor(e){if(e.privateKey){let t=new Ys(e.privateKey);this.publicKey=L(t.compressedPublicKey),this.privateKey=L(e.privateKey)}else{if(!e.publicKey)throw new v(x.HD_WALLET_ERROR,"Both public and private Key cannot be missing. At least one should be provided.");this.publicKey=L(e.publicKey)}this.parentFingerprint=e.parentFingerprint||this.parentFingerprint,this.fingerprint=Au(vb(Ke(this.publicKey)),0,4),this.depth=e.depth||this.depth,this.index=e.index||this.index,this.chainCode=e.chainCode}get extendedKey(){return this.toExtendedKey()}deriveIndex(e){let t=this.privateKey&&P(this.privateKey),n=P(this.publicKey),r=P(this.chainCode),i=new Uint8Array(37);if(e&WC){if(!t)throw new v(x.HD_WALLET_ERROR,"Cannot derive a hardened index without a private Key.");i.set(t,1)}else i.set(P(this.publicKey));i.set(tn(e,4),33);let a=P(Wl("sha512",r,i)),s=a.slice(0,32),o=a.slice(32);if(t){let d="0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",p=C(s).add(t).mod(d).toBytes(32);return new Xs({privateKey:p,chainCode:o,index:e,depth:this.depth+1,parentFingerprint:this.fingerprint})}let u=new Ys(L(s)).addPoint(n);return new Xs({publicKey:u,chainCode:o,index:e,depth:this.depth+1,parentFingerprint:this.fingerprint})}derivePath(e){return a6(e,this.depth).reduce((n,r)=>n.deriveIndex(r),this)}toExtendedKey(e=!1,t=!1){if(this.depth>=256)throw new v(x.HD_WALLET_ERROR,`Exceeded max depth of 255. Current depth: ${this.depth}.`);let n=n6(this.privateKey==null||e,t),r=L(Uint8Array.from([this.depth])),i=this.parentFingerprint,a=hs(this.index,4),s=this.chainCode,o=this.privateKey!=null&&!e?te(["0x00",this.privateKey]):this.publicKey,c=P(te([n,r,i,a,s,o]));return bC(c)}static fromSeed(e){let t=M_.masterKeysFromSeed(e);return new Xs({chainCode:P(t.slice(32)),privateKey:P(t.slice(0,32))})}static fromExtendedKey(e){let t=L(tn(Vw(e))),n=P(t),r=bC(n.slice(0,78))===e;if(n.length!==82||!i6(n))throw new v(x.HD_WALLET_ERROR,"Provided key is not a valid extended key.");if(!r)throw new v(x.HD_WALLET_ERROR,"Provided key has an invalid checksum.");let i=n[4],a=L(n.slice(5,9)),s=parseInt(L(n.slice(9,13)).substring(2),16),o=L(n.slice(13,45)),c=n.slice(45,78);if(i===0&&a!=="0x00000000"||i===0&&s!==0)throw new v(x.HD_WALLET_ERROR,"Inconsistency detected: Depth is zero but fingerprint/index is non-zero.");if(r6(n)){if(c[0]!==3)throw new v(x.HD_WALLET_ERROR,"Invalid public extended key.");return new Xs({publicKey:c,chainCode:o,index:s,depth:i,parentFingerprint:a})}if(c[0]!==0)throw new v(x.HD_WALLET_ERROR,"Invalid private extended key.");return new Xs({privateKey:c.slice(1),chainCode:o,index:s,depth:i,parentFingerprint:a})}},__=Xs,XC=class extends D_{unlock(e){return new cn(e,this._provider)}},cn=class extends VC{lock(){return this.signer=()=>new Ys("0x00"),new XC(this.address,this._provider)}static generate(e){let t=Ys.generatePrivateKey(e?.entropy);return new cn(t,e?.provider)}static fromSeed(e,t,n){let i=__.fromSeed(e).derivePath(t||cn.defaultPath);return new cn(i.privateKey,n)}static fromMnemonic(e,t,n,r){let i=M_.mnemonicToSeed(e,n),s=__.fromSeed(i).derivePath(t||cn.defaultPath);return new cn(s.privateKey,r)}static fromExtendedKey(e,t){let n=__.fromExtendedKey(e);return new cn(n.privateKey,t)}static async fromEncryptedJson(e,t,n){let r=await HU(e,t);return new cn(r,n)}},Jt=class{static fromAddress(e,t){return new XC(e,t)}static fromPrivateKey(e,t){return new cn(e,t)}};et(Jt,"generate",cn.generate);et(Jt,"fromSeed",cn.fromSeed);et(Jt,"fromMnemonic",cn.fromMnemonic);et(Jt,"fromExtendedKey",cn.fromExtendedKey);et(Jt,"fromEncryptedJson",cn.fromEncryptedJson);var o6=class{storage=new Map;async getItem(e){return await this.storage.get(e)}async setItem(e,t){await this.storage.set(e,t)}async removeItem(e){await this.storage.delete(e)}async clear(){await this.storage.clear()}},Qa,YC=class{constructor(e){Ui(this,Qa,void 0),et(this,"pathKey","{}"),et(this,"rootPath",`m/44'/1179993420'/${this.pathKey}'/0/0`),et(this,"numberOfAccounts",0),sr(this,Qa,e.secret||M_.generate()),this.rootPath=e.rootPath||this.rootPath,this.numberOfAccounts=e.numberOfAccounts||1}getDerivePath(e){return this.rootPath.includes(this.pathKey)?this.rootPath.replace(this.pathKey,String(e)):`${this.rootPath}/${e}`}serialize(){return{secret:$e(this,Qa),rootPath:this.rootPath,numberOfAccounts:this.numberOfAccounts}}getAccounts(){let e=[],t=0;do{let n=Jt.fromMnemonic($e(this,Qa),this.getDerivePath(t));e.push({publicKey:n.publicKey,address:n.address}),t+=1}while(t<this.numberOfAccounts);return e}addAccount(){this.numberOfAccounts+=1;let e=Jt.fromMnemonic($e(this,Qa),this.getDerivePath(this.numberOfAccounts-1));return{publicKey:e.publicKey,address:e.address}}exportAccount(e){let t=0,n=oe.fromAddressOrString(e);do{let r=Jt.fromMnemonic($e(this,Qa),this.getDerivePath(t));if(r.address.equals(n))return r.privateKey;t+=1}while(t<this.numberOfAccounts);throw new v(x.WALLET_MANAGER_ERROR,`Account with address '${e}' not found in derived wallets.`)}getWallet(e){let t=this.exportAccount(e);return Jt.fromPrivateKey(t)}};Qa=new WeakMap;et(YC,"type","mnemonic");var Qi,$C=class{constructor(e={}){Ui(this,Qi,[]),e.secret?sr(this,Qi,[e.secret]):sr(this,Qi,e.accounts||[Jt.generate().privateKey])}serialize(){return{accounts:$e(this,Qi)}}getPublicAccount(e){let t=Jt.fromPrivateKey(e);return{address:t.address,publicKey:t.publicKey}}getAccounts(){return $e(this,Qi).map(e=>this.getPublicAccount(e))}addAccount(){let e=Jt.generate();return $e(this,Qi).push(e.privateKey),this.getPublicAccount(e.privateKey)}exportAccount(e){let t=oe.fromAddressOrString(e),n=$e(this,Qi).find(r=>Jt.fromPrivateKey(r).address.equals(t));if(!n)throw new v(x.WALLET_MANAGER_ERROR,`No private key found for address '${e}'.`);return n}getWallet(e){let t=this.exportAccount(e);return Jt.fromPrivateKey(t)}};Qi=new WeakMap;et($C,"type","privateKey");var pi={invalid_vault_type:"The provided Vault type is invalid.",address_not_found:"No private key found for address the specified wallet address.",vault_not_found:"The specified vault was not found.",wallet_not_unlocked:"The wallet is currently locked.",passphrase_not_match:"The provided passphrase did not match the expected value."};function hi(e,t){if(!e)throw new v(x.WALLET_MANAGER_ERROR,t)}var on,Ua,Fr,I_,KC,S_,jC,eI=class extends s6{constructor(e){super(),Ui(this,I_),Ui(this,S_),et(this,"storage",new o6),et(this,"STORAGE_KEY","WalletManager"),Ui(this,on,[]),Ui(this,Ua,""),Ui(this,Fr,!0),this.storage=e?.storage||this.storage}get isLocked(){return $e(this,Fr)}exportVault(e){hi(!$e(this,Fr),pi.wallet_not_unlocked);let t=$e(this,on).find((n,r)=>r===e);return hi(t,pi.vault_not_found),t.vault.serialize()}getVaults(){return $e(this,on).map((e,t)=>({title:e.title,type:e.type,vaultId:t}))}getAccounts(){return $e(this,on).flatMap((e,t)=>e.vault.getAccounts().map(n=>({...n,vaultId:t})))}getWallet(e){let t=oe.fromAddressOrString(e),n=$e(this,on).find(r=>r.vault.getAccounts().find(i=>i.address.equals(t)));return hi(n,pi.address_not_found),n.vault.getWallet(t)}exportPrivateKey(e){let t=oe.fromAddressOrString(e);hi(!$e(this,Fr),pi.wallet_not_unlocked);let n=$e(this,on).find(r=>r.vault.getAccounts().find(i=>i.address.equals(t)));return hi(n,pi.address_not_found),n.vault.exportAccount(t)}async addAccount(e){await this.loadState();let t=$e(this,on)[e?.vaultId||0];await hi(t,pi.vault_not_found);let n=t.vault.addAccount();return await this.saveState(),n}async removeVault(e){$e(this,on).splice(e,1),await this.saveState()}async addVault(e){await this.loadState();let t=this.getVaultClass(e.type),n=new t(e);sr(this,on,$e(this,on).concat({title:e.title,type:e.type,vault:n})),await this.saveState()}lock(){sr(this,Fr,!0),sr(this,on,[]),sr(this,Ua,""),this.emit("lock")}async unlock(e){sr(this,Ua,e),sr(this,Fr,!1);try{await this.loadState(),this.emit("unlock")}catch(t){throw await this.lock(),t}}async updatePassphrase(e,t){let n=$e(this,Fr);await this.unlock(e),sr(this,Ua,t),await this.saveState(),await this.loadState(),n&&await this.lock()}async loadState(){await hi(!$e(this,Fr),pi.wallet_not_unlocked);let e=await this.storage.getItem(this.STORAGE_KEY);if(e){let t=await mb($e(this,Ua),JSON.parse(e));sr(this,on,A_(this,S_,jC).call(this,t.vaults))}}async saveState(){await hi(!$e(this,Fr),pi.wallet_not_unlocked);let e=await gb($e(this,Ua),{vaults:A_(this,I_,KC).call(this,$e(this,on))});await this.storage.setItem(this.STORAGE_KEY,JSON.stringify(e)),this.emit("update")}getVaultClass(e){let t=eI.Vaults.find(n=>n.type===e);return hi(t,pi.invalid_vault_type),t}},c6=eI;on=new WeakMap;Ua=new WeakMap;Fr=new WeakMap;I_=new WeakSet;KC=function(e){return e.map(({title:t,type:n,vault:r})=>({title:t,type:n,data:r.serialize()}))};S_=new WeakSet;jC=function(e){return e.map(({title:t,type:n,data:r})=>{let i=this.getVaultClass(n);return{title:t,type:n,vault:new i(r)}})};et(c6,"Vaults",[YC,$C]);var u6=class{constructor(e){throw new v(x.NOT_IMPLEMENTED,"Not implemented.")}serialize(){throw new v(x.NOT_IMPLEMENTED,"Not implemented.")}getAccounts(){throw new v(x.NOT_IMPLEMENTED,"Not implemented.")}addAccount(){throw new v(x.NOT_IMPLEMENTED,"Not implemented.")}exportAccount(e){throw new v(x.NOT_IMPLEMENTED,"Not implemented.")}getWallet(e){throw new v(x.NOT_IMPLEMENTED,"Not implemented.")}};et(u6,"type");var tI=(e=>(e.ping="ping",e.version="version",e.connect="connect",e.disconnect="disconnect",e.isConnected="isConnected",e.accounts="accounts",e.currentAccount="currentAccount",e.signMessage="signMessage",e.sendTransaction="sendTransaction",e.assets="assets",e.addAsset="addAsset",e.addAssets="addAssets",e.networks="networks",e.currentNetwork="currentNetwork",e.addNetwork="addNetwork",e.selectNetwork="selectNetwork",e.addABI="addABI",e.getABI="getABI",e.hasABI="hasABI",e))(tI||{}),Q_=(e=>(e.connectors="connectors",e.currentConnector="currentConnector",e.connection="connection",e.accounts="accounts",e.currentAccount="currentAccount",e.networks="networks",e.currentNetwork="currentNetwork",e.assets="assets",e.abis="abis",e))(Q_||{}),d6="FuelConnector",f6=class{storage;constructor(e){this.storage=e}async setItem(e,t){this.storage.setItem(e,t)}async getItem(e){return this.storage.getItem(e)}async removeItem(e){this.storage.removeItem(e)}async clear(){this.storage.clear()}},p6=class extends l6{name="";metadata={};connected=!1;installed=!1;events=Q_;async ping(){throw new v(v.CODES.NOT_IMPLEMENTED,"Method not implemented.")}async version(){throw new v(v.CODES.NOT_IMPLEMENTED,"Method not implemented.")}async isConnected(){throw new v(v.CODES.NOT_IMPLEMENTED,"Method not implemented.")}async accounts(){throw new v(v.CODES.NOT_IMPLEMENTED,"Method not implemented.")}async connect(){throw new v(v.CODES.NOT_IMPLEMENTED,"Method not implemented.")}async disconnect(){throw new v(v.CODES.NOT_IMPLEMENTED,"Method not implemented.")}async signMessage(e,t){throw new v(v.CODES.NOT_IMPLEMENTED,"Method not implemented.")}async signTransaction(e,t){throw new v(v.CODES.NOT_IMPLEMENTED,"Method not implemented.")}async sendTransaction(e,t){throw new v(v.CODES.NOT_IMPLEMENTED,"Method not implemented.")}async currentAccount(){throw new v(v.CODES.NOT_IMPLEMENTED,"Method not implemented.")}async addAssets(e){throw new v(v.CODES.NOT_IMPLEMENTED,"Method not implemented.")}async addAsset(e){throw new v(v.CODES.NOT_IMPLEMENTED,"Method not implemented.")}async assets(){throw new v(v.CODES.NOT_IMPLEMENTED,"Method not implemented.")}async addNetwork(e){throw new v(v.CODES.NOT_IMPLEMENTED,"Method not implemented.")}async selectNetwork(e){throw new v(v.CODES.NOT_IMPLEMENTED,"Method not implemented.")}async networks(){throw new v(v.CODES.NOT_IMPLEMENTED,"Method not implemented.")}async currentNetwork(){throw new v(v.CODES.NOT_IMPLEMENTED,"Method not implemented.")}async addABI(e,t){throw new v(v.CODES.NOT_IMPLEMENTED,"Method not implemented.")}async getABI(e){throw new v(v.CODES.NOT_IMPLEMENTED,"Method not implemented.")}async hasABI(e){throw new v(v.CODES.NOT_IMPLEMENTED,"Method not implemented.")}on(e,t){return super.on(e,t),this}};function h6(e,{cache:t,cacheTime:n,key:r}){return async(...i)=>{if(t[r]&&t[r]?.value)return t[r]?.value;clearTimeout(t[r]?.timeout);let a=await e(...i);return t[r]={timeout:Number(setTimeout(()=>{t[r]=null},n)),value:a},a}}function m6(){let e={};return e.promise=new Promise((t,n)=>{e.reject=n,e.resolve=t}),e}async function Ed(e,t=1050){let n=new Promise((r,i)=>{setTimeout(()=>{i(new v(v.CODES.TIMEOUT_EXCEEDED,"Promise timed out"))},t)});return Promise.race([n,e])}var g6=2e3,_6=5e3,{warn:A6}=console,Ou=class extends p6{_storage=null;_connectors=[];_targetObject=null;_unsubscribes=[];_targetUnsubscribe;_pingCache={};_currentConnector;constructor(e=Ou.defaultConfig){super(),this.setMaxListeners(1e3),this._connectors=e.connectors??[],this._targetObject=this.getTargetObject(e.targetObject),this._storage=e.storage===void 0?this.getStorage():e.storage,this.setupMethods(),this.setDefaultConnector(),this._targetUnsubscribe=this.setupConnectorListener()}getTargetObject(e){return e||(typeof window<"u"?window:typeof document<"u"?document:null)}getStorage(){if(typeof window<"u")return new f6(window.localStorage)}async setDefaultConnector(){let e=await this._storage?.getItem(Ou.STORAGE_KEY)||this._connectors[0]?.name;if(e)return this.selectConnector(e,{emitEvents:!1})}setupConnectorEvents(e){if(!this._currentConnector)return;let t=this._currentConnector;this._unsubscribes.map(n=>n()),this._unsubscribes=e.map(n=>{let r=(...i)=>this.emit(n,...i);return t.on(n,r),()=>t.off(n,r)})}async callMethod(e,...t){let n=await this.hasConnector();if(await this.pingConnector(),!this._currentConnector||!n)throw new v(x.MISSING_CONNECTOR,`No connector selected for calling ${e}. Use hasConnector before executing other methods.`);if(typeof this._currentConnector[e]=="function")return this._currentConnector[e](...t)}setupMethods(){Object.values(tI).forEach(e=>{this[e]=async(...t)=>this.callMethod(e,...t)})}async fetchConnectorStatus(e){let t=Date.now(),[n,r]=await Promise.allSettled([Ed(e.isConnected()),Ed(this.pingConnector(e))]);return t<(e._latestUpdate||0)||(e._latestUpdate=Date.now(),e.installed=r.status==="fulfilled"&&r.value,e.connected=n.status==="fulfilled"&&n.value),{installed:e.installed,connected:e.connected}}async fetchConnectorsStatus(){return Promise.all(this._connectors.map(async e=>this.fetchConnectorStatus(e)))}async pingConnector(e){let t=e||this._currentConnector;if(!t)return!1;try{return await h6(async()=>Ed(t.ping()),{key:t.name,cache:this._pingCache,cacheTime:_6})()}catch{throw new v(x.INVALID_PROVIDER,"Current connector is not available.")}}setupConnectorListener=()=>{let{_targetObject:e}=this,t=d6;if(e?.on)return e.on(t,this.addConnector),()=>{e.off?.(t,this.addConnector)};if(e?.addEventListener){let n=r=>{this.addConnector(r.detail)};return e.addEventListener(t,n),()=>{e.removeEventListener?.(t,n)}}return()=>{}};addConnector=async e=>{this.getConnector(e)||this._connectors.push(e),await this.fetchConnectorStatus(e),this.emit(this.events.connectors,this._connectors),this._currentConnector||await this.selectConnector(e.name,{emitEvents:!1})};triggerConnectorEvents=async()=>{let[e,t,n]=await Promise.all([this.isConnected(),this.networks(),this.currentNetwork()]);if(this.emit(this.events.connection,e),this.emit(this.events.networks,t),this.emit(this.events.currentNetwork,n),e){let[r,i]=await Promise.all([this.accounts(),this.currentAccount()]);this.emit(this.events.accounts,r),this.emit(this.events.currentAccount,i)}};getConnector=e=>this._connectors.find(t=>{let n=typeof e=="string"?e:e.name;return t.name===n||t===e})||null;async connectors(){return await this.fetchConnectorsStatus(),this._connectors}async selectConnector(e,t={emitEvents:!0}){let n=this.getConnector(e);if(!n)return!1;if(this._currentConnector?.name===e)return!0;let{installed:r}=await this.fetchConnectorStatus(n);return r?(this._currentConnector=n,this.emit(this.events.currentConnector,n),this.setupConnectorEvents(Object.values(Q_)),await this._storage?.setItem(Ou.STORAGE_KEY,n.name),t.emitEvents&&this.triggerConnectorEvents(),!0):!1}currentConnector(){return this._currentConnector}async hasConnector(){if(this._currentConnector)return!0;let e=m6();return this.once(this.events.currentConnector,()=>{e.resolve(!0)}),Ed(e.promise,g6).then(()=>!0).catch(()=>!1)}async hasWallet(){return this.hasConnector()}async getProvider(e){return A6("getProvider is deprecated and is going to be removed in the future, use getWallet instead."),this._getProvider(e)}async _getProvider(e){let t;if(e&&"getTransactionResponse"in e)t=e;else if(e&&"chainId"in e&&"url"in e)t=await Sd.create(e.url);else{if(e)throw new v(x.INVALID_PROVIDER,"Provider is not valid.");{let n=await this.currentNetwork();t=await Sd.create(n.url)}}return t}async getWallet(e,t){let n=await this._getProvider(t);return new D_(e,n,this)}unsubscribe(){this._unsubscribes.map(e=>e()),this._targetUnsubscribe(),this.removeAllListeners()}async clean(){await this._storage?.removeItem(Ou.STORAGE_KEY)}async destroy(){this.unsubscribe(),await this.clean()}},nI=Ou;et(nI,"STORAGE_KEY","fuel-current-connector");et(nI,"defaultConfig",{});var oI=Tn(Bu(),1);var Mt=Tn(Bu(),1);function rI(e,t){if(!e)throw new v(x.TRANSACTION_ERROR,t)}function aI(e){return e.reduce((t,n,r)=>{let{program:i,externalAbis:a}=n.getCallConfig();return r===0?(t.main=i.interface.jsonAbi,t.otherContractsAbis={}):t.otherContractsAbis[i.id.toB256()]=i.interface.jsonAbi,t.otherContractsAbis={...t.otherContractsAbis,...a},t},{})}var sI=(e,t,n)=>{if(!t)return[];let{main:r,otherContractsAbis:i}=aI(n);return kd(e,r,i)},q_=class{#e;constructor(...e){this.#e=e||[]}entries(){return this.#e}push(...e){this.#e.push(...e)}concat(e){return this.#e.concat(e)}extend(e){this.#e.push(...e)}toBytes(){return te(this.#e.reduce((e,t)=>(e.push(t.to_bytes()),e),[]))}toHex(){return L(this.toBytes())}toString(){return`Program:
|
|
918
|
-
${JSON.stringify(this.#e,null,2)}`}byteLength(){return this.toBytes().byteLength}},y6=e=>Th+xh({maxInputs:e}),vne=ue+xa+Zl+ue+ue;function v6(e){let t=[...e.receipts],n,r;if(t.forEach(a=>{a.type===le.ScriptResult?n=a:(a.type===le.Return||a.type===le.ReturnData||a.type===le.Revert)&&(r=a)}),!n||!r)throw new v(x.SCRIPT_REVERTED,"Transaction reverted.");return{code:n.result,gasUsed:n.gasUsed,receipts:t,scriptResultReceipt:n,returnReceipt:r,callResult:e}}function J_(e,t,n=[]){try{let r=v6(e);return t(r)}catch(r){if(r.code===x.SCRIPT_REVERTED){let i=e?.dryRunStatus?.reason;throw Nd({logs:n,receipts:e.receipts,statusReason:i})}throw r}}function w6(e,t,n){return J_(e,r=>{if(r.returnReceipt.type===le.Revert)throw new v(x.SCRIPT_REVERTED,`Script Reverted. Logs: ${JSON.stringify(n)}`);if(r.returnReceipt.type!==le.Return&&r.returnReceipt.type!==le.ReturnData){let{type:a}=r.returnReceipt;throw new v(x.SCRIPT_REVERTED,`Script Return Type [${a}] Invalid. Logs: ${JSON.stringify({logs:n,receipt:r.returnReceipt})}`)}let i;return r.returnReceipt.type===le.Return&&(i=r.returnReceipt.val),r.returnReceipt.type===le.ReturnData&&(i=t.func.decodeOutput(r.returnReceipt.data)[0]),i},n)}var Qu=class{bytes;scriptDataEncoder;scriptResultDecoder;constructor(e,t,n){this.bytes=P(e),this.scriptDataEncoder=t,this.scriptResultDecoder=n}static getScriptDataOffsetWithScriptBytes(e,t){return xh({maxInputs:t})+Th+e}getScriptDataOffset(e){return Qu.getScriptDataOffsetWithScriptBytes(this.bytes.length,e)}encodeScriptData(e){let t=this.scriptDataEncoder(e);return ArrayBuffer.isView(t)?t:(this.bytes=P(t.script),t.data)}decodeCallResult(e,t=[]){return J_(e,this.scriptResultDecoder,t)}},cI={assetIdOffset:0,amountOffset:0,gasForwardedOffset:0,callDataOffset:0},b6=xe,uI=({callDataOffset:e,gasForwardedOffset:t,amountOffset:n,assetIdOffset:r})=>{let i=new q_(Mt.movi(16,e),Mt.movi(17,n),Mt.lw(17,17,0),Mt.movi(18,r));return t?i.push(Mt.movi(19,t),Mt.lw(19,19,0),Mt.call(16,17,18,19)):i.push(Mt.call(16,17,18,Mt.RegId.cgas().to_u8())),i};function iI(e){if(!e.length)return new Uint8Array;let t=new q_;for(let n=0;n<e.length;n+=1)t.extend(uI(e[n]).entries());return t.push(Mt.ret(1)),t.toBytes()}var E6=e=>e===le.Return||e===le.ReturnData,C6=(e,t)=>e.find(({type:n,from:r,to:i})=>n===le.Call&&r===b6&&i===t),I6=e=>t=>{if(Nn(t.code)!==0)throw new v(x.SCRIPT_REVERTED,"Transaction reverted.");let n=C6(t.receipts,e.toB256()),r=C(n?.is);return t.receipts.filter(({type:a})=>E6(a)).flatMap(a=>r.eq(C(a.is))?a.type===le.Return?[new H("u64").encode(a.val)]:a.type===le.ReturnData?[P(a.data)]:[new Uint8Array]:[])},S6=(e,t,n=[])=>J_(e,I6(t),n),x6=e=>e.reduce((t,n)=>{let r={...cI};return n.gas&&(r.gasForwardedOffset=1),t+uI(r).byteLength()},Mt.Instruction.size()),T6=(e,t)=>new Qu(iI(new Array(e.length).fill(cI)),n=>{let r=n.length;if(r===0)return{data:new Uint8Array,script:new Uint8Array};let i=x6(n),a=(8-i%8)%8,s=i+a,o=y6(t.toNumber())+s,c=[],u=o,d=[];for(let _=0;_<r;_+=1){let w=n[_],A=u,I=A+ue,b=I+xa,T=b+Zl+ue+ue,k=T+w.fnSelectorBytes.byteLength,O=P(w.data),V=0;d.push(new H("u64").encode(w.amount||0)),d.push(new X().encode(w.assetId?.toString()||xe)),d.push(w.contractId.toBytes()),d.push(new H("u64").encode(T)),d.push(new H("u64").encode(k)),d.push(w.fnSelectorBytes),d.push(O),w.gas&&(d.push(new H("u64").encode(w.gas)),V=k+O.byteLength);let Q={amountOffset:A,assetIdOffset:I,gasForwardedOffset:V,callDataOffset:b};c.push(Q),u=o+te(d).byteLength}let p=iI(c);return{data:te(d),script:p}},()=>[new Uint8Array]),lI=(e,t,n,r)=>{let i=e[0]?.getCallConfig();if(e.length===1&&i&&"bytes"in i.program)return w6({receipts:t},i,r);let s=S6({receipts:t},(i?.program).id,r).map((o,c)=>{let{func:u}=e[c].getCallConfig();return u.decodeOutput(o)?.[0]});return n?s:s?.[0]},N6=async e=>{let{funcScope:t,isMultiCall:n,program:r,transactionResponse:i}=e,a=await i.waitForResult(),{receipts:s}=a,o=Array.isArray(t)?t:[t],c=o[0]?.getCallConfig(),u=sI(s,c,o),d=lI(o,s,n,u),p=Fu(s);return{isMultiCall:n,functionScopes:o,value:d,program:r,transactionResult:a,transactionResponse:i,transactionId:i.id,logs:u,gasUsed:p}},U_=e=>{let{funcScopes:t,callResult:n,isMultiCall:r}=e,{receipts:i}=n,a=Array.isArray(t)?t:[t],s=a[0]?.getCallConfig(),o=sI(i,s,a),c=lI(a,i,r,o),u=Fu(i);return{functionScopes:a,callResult:n,isMultiCall:r,gasUsed:u,value:c}};function R6(e){let{program:t,args:n,forward:r,func:i,callParameters:a,externalAbis:s}=e.getCallConfig(),o=i.encodeArguments(n);return{contractId:t.id,fnSelectorBytes:i.selectorBytes,data:o,assetId:r?.assetId,amount:r?.amount,gas:a?.gasLimit,externalContractsAbis:s}}var dI=class{transactionRequest;program;functionInvocationScopes=[];txParameters;requiredCoins=[];isMultiCall=!1;hasCallParamsGasLimit=!1;externalAbis={};addSignersCallback;constructor(e,t){this.program=e,this.isMultiCall=t,this.transactionRequest=new qi}get calls(){if(!this.getProvider().getChain())throw new v(v.CODES.CHAIN_INFO_CACHE_EMPTY,"Provider chain info cache is empty. Please make sure to initialize the `Provider` properly by running `await Provider.create()``");return this.functionInvocationScopes.map(n=>R6(n))}updateScriptRequest(){let e=this.getProvider(),{consensusParameters:{txParameters:{maxInputs:t}}}=e.getChain(),n=T6(this.functionInvocationScopes,t);this.transactionRequest.setScript(n,this.calls)}updateContractInputAndOutput(){this.calls.forEach(t=>{t.contractId&&this.transactionRequest.addContractInputAndOutput(t.contractId),t.externalContractsAbis&&Object.keys(t.externalContractsAbis).forEach(n=>this.transactionRequest.addContractInputAndOutput(oe.fromB256(n)))})}getRequiredCoins(){return this.calls.map(t=>({assetId:String(t.assetId),amount:C(t.amount||0)})).filter(({assetId:t,amount:n})=>t&&!C(n).isZero())}updateRequiredCoins(){let e=this.getRequiredCoins(),t=(n,{assetId:r,amount:i})=>{let a=n.get(r)?.amount||C(0);return n.set(r,{assetId:String(r),amount:a.add(i)})};this.requiredCoins=Array.from(e.reduce(t,new Map).values())}addCall(e){return this.addCalls([e]),this}addCalls(e){return this.functionInvocationScopes.push(...e),this.updateContractInputAndOutput(),this.updateRequiredCoins(),this}async prepareTransaction(){await oI.initWasm(),this.updateScriptRequest(),this.updateRequiredCoins(),this.checkGasLimitTotal(),this.transactionRequest.type===Je.Script&&(this.transactionRequest.abis=aI(this.functionInvocationScopes))}checkGasLimitTotal(){let e=this.calls.reduce((t,n)=>t.add(n.gas||0),C(0));if(this.transactionRequest.gasLimit.eq(0))this.transactionRequest.gasLimit=e;else if(e.gt(this.transactionRequest.gasLimit))throw new v(x.TRANSACTION_ERROR,"Transaction's gasLimit must be equal to or greater than the combined forwarded gas of all calls.")}async getTransactionCost(){let e=qt(await this.getTransactionRequest());return(this.program.account??Jt.generate({provider:this.getProvider()})).getTransactionCost(e,{quantities:this.getRequiredCoins(),signatureCallback:this.addSignersCallback})}async fundWithRequiredCoins(){let e=await this.getTransactionRequest();e=qt(e);let t=await this.getTransactionCost(),{gasUsed:n,missingContractIds:r,outputVariables:i,maxFee:a}=t;return this.setDefaultTxParams(e,n,a),e.inputs=e.inputs.filter(s=>s.type!==ve.Coin),r.forEach(s=>{e.addContractInputAndOutput(oe.fromString(s))}),e.addVariableOutputs(i),await this.program.account?.fund(e,t),this.addSignersCallback&&await this.addSignersCallback(e),e}txParams(e){this.txParameters=e;let t=this.transactionRequest;return t.tip=C(e.tip||t.tip),t.gasLimit=C(e.gasLimit||t.gasLimit),t.maxFee=e.maxFee?C(e.maxFee):t.maxFee,t.witnessLimit=e.witnessLimit?C(e.witnessLimit):t.witnessLimit,t.maturity=e.maturity||t.maturity,t.addVariableOutputs(this.txParameters?.variableOutputs||0),this}addContracts(e){return e.forEach(t=>{this.transactionRequest.addContractInputAndOutput(t.id),this.externalAbis[t.id.toB256()]=t.interface.jsonAbi}),this}addTransfer(e){let{amount:t,destination:n,assetId:r}=e,i=this.getProvider().getBaseAssetId();return this.transactionRequest=this.transactionRequest.addCoinOutput(oe.fromAddressOrString(n),t,r||i),this}addBatchTransfer(e){let t=this.getProvider().getBaseAssetId();return e.forEach(({destination:n,amount:r,assetId:i})=>{this.transactionRequest=this.transactionRequest.addCoinOutput(oe.fromAddressOrString(n),r,i||t)}),this}addSigners(e){return this.addSignersCallback=async t=>t.addAccountWitnesses(e),this}async getTransactionRequest(){return await this.prepareTransaction(),this.transactionRequest}async call(){rI(this.program.account,"Wallet is required!");let e=await this.fundWithRequiredCoins(),t=await this.program.account.sendTransaction(e,{estimateTxDependencies:!1});return{transactionId:t.id,waitForResult:async()=>N6({funcScope:this.functionInvocationScopes,isMultiCall:this.isMultiCall,program:this.program,transactionResponse:t})}}async simulate(){if(rI(this.program.account,"Wallet is required!"),!("populateTransactionWitnessesSignature"in this.program.account))throw new v(x.ABI_MAIN_METHOD_MISSING,"An unlocked wallet is required to simulate a contract call.");let e=await this.fundWithRequiredCoins(),t=await this.program.account.simulateTransaction(e,{estimateTxDependencies:!1});return U_({funcScopes:this.functionInvocationScopes,callResult:t,isMultiCall:this.isMultiCall})}async dryRun(){let{receipts:e}=await this.getTransactionCost(),t={receipts:e};return U_({funcScopes:this.functionInvocationScopes,callResult:t,isMultiCall:this.isMultiCall})}async get(){let{receipts:e}=await this.getTransactionCost(),t={receipts:e};return U_({funcScopes:this.functionInvocationScopes,callResult:t,isMultiCall:this.isMultiCall})}getProvider(){return this.program.provider}async getTransactionId(e){let t=e??await this.getProvider().getChainId();return(await this.getTransactionRequest()).getTransactionId(t)}setDefaultTxParams(e,t,n){let r=Rn(this.txParameters?.gasLimit)||this.hasCallParamsGasLimit,i=Rn(this.txParameters?.maxFee),{gasLimit:a,maxFee:s}=e;if(!r)e.gasLimit=t;else if(a.lt(t))throw new v(x.GAS_LIMIT_TOO_LOW,`Gas limit '${a}' is lower than the required: '${t}'.`);if(!i)e.maxFee=n;else if(n.gt(s))throw new v(x.MAX_FEE_TOO_LOW,`Max fee '${s}' is lower than the required: '${n}'.`)}},fI=class extends dI{func;callParameters;forward;args;constructor(e,t,n){super(e,!1),this.func=t,this.args=n||[],this.setArguments(...n),super.addCall(this)}getCallConfig(){return{func:this.func,program:this.program,callParameters:this.callParameters,txParameters:this.txParameters,forward:this.forward,args:this.args,externalAbis:this.externalAbis}}setArguments(...e){return this.args=e||[],this}callParams(e){if(!this.hasCallParamsGasLimit&&e?.gasLimit!==void 0&&(this.hasCallParamsGasLimit=!0),this.callParameters=e,e?.forward){if(!this.func.attributes.find(t=>t.name==="payable"))throw new v(x.TRANSACTION_ERROR,`The target function ${this.func.name} cannot accept forwarded funds as it's not marked as 'payable'.`);this.forward=xd(e.forward)}return this.setArguments(...this.args),this.updateRequiredCoins(),this}},B6=class extends dI{constructor(e,t){super(e,!0),this.addCalls(t)}addCall(e){return super.addCalls([e])}addCalls(e){return super.addCalls(e)}},k6=class{id;provider;interface;account;functions={};constructor(e,t,n){this.interface=t instanceof Bn?t:new Bn(t),this.id=oe.fromAddressOrString(e),n&&"provider"in n?(this.provider=n.provider,this.account=n):(this.provider=n,this.account=null),Object.keys(this.interface.functions).forEach(r=>{let i=this.interface.getFunction(r);Object.defineProperty(this.functions,i.name,{value:this.buildFunction(i),writable:!1})})}buildFunction(e){return(()=>{let t=(...n)=>new fI(this,e,n);return Object.defineProperty(t,"isReadOnly",{value:()=>e.isReadOnly(),writable:!1}),t})()}multiCall(e){return new B6(this,e)}getBalance(e){return this.provider.getContractBalance(this.id,e)}};var Qne=new Qu("0x24000000",()=>new Uint8Array(0),()=>{});var Qr=Tn(Bu(),1);var O6=Object.defineProperty,P6=(e,t)=>{for(var n in t)O6(e,n,{get:t[n],enumerable:!0})};var D6={};P6(D6,{getContractId:()=>F6,getContractRoot:()=>pI,getContractStorageRoot:()=>M6,hexlifyWithPrefix:()=>L6});var pI=e=>{let n=P(e),r=hh(n,16384);return p_(r.map(i=>L(i)))},M6=e=>{let t=new cC;return e.forEach(({key:n,value:r})=>t.update(Ke(n),r)),t.root},F6=(e,t,n)=>{let r=pI(P(e));return Ke(te(["0x4655454C",t,r,n]))},L6=e=>L(e.startsWith("0x")?e:`0x${e}`);BigInt.prototype.asBigDecimal=function(){return new Ut(this.toString())};BigInt.prototype.scaleDown=function(e){return z_(this,e)};nr.prototype.asBigDecimal=function(){return new Ut(this.toString(10))};nr.prototype.scaleDown=function(e){return z_(BigInt(this.toString(10)),e)};function z_(e,t){let n=new Ut(10).pow(Number(t));return e.asBigDecimal().dividedBy(n)}var Pn=null;try{Pn=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function Ze(e,t,n){this.low=e|0,this.high=t|0,this.unsigned=!!n}Ze.prototype.__isLong__;Object.defineProperty(Ze.prototype,"__isLong__",{value:!0});function zt(e){return(e&&e.__isLong__)===!0}function hI(e){var t=Math.clz32(e&-e);return e?31-t:t}Ze.isLong=zt;var mI={},gI={};function qa(e,t){var n,r,i;return t?(e>>>=0,(i=0<=e&&e<256)&&(r=gI[e],r)?r:(n=Oe(e,0,!0),i&&(gI[e]=n),n)):(e|=0,(i=-128<=e&&e<128)&&(r=mI[e],r)?r:(n=Oe(e,e<0?-1:0,!1),i&&(mI[e]=n),n))}Ze.fromInt=qa;function Dn(e,t){if(isNaN(e))return t?mi:or;if(t){if(e<0)return mi;if(e>=vI)return EI}else{if(e<=-AI)return un;if(e+1>=AI)return bI}return e<0?Dn(-e,t).neg():Oe(e%eo|0,e/eo|0,t)}Ze.fromNumber=Dn;function Oe(e,t,n){return new Ze(e,t,n)}Ze.fromBits=Oe;var Od=Math.pow;function G_(e,t,n){if(e.length===0)throw Error("empty string");if(typeof t=="number"?(n=t,t=!1):t=!!t,e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t?mi:or;if(n=n||10,n<2||36<n)throw RangeError("radix");var r;if((r=e.indexOf("-"))>0)throw Error("interior hyphen");if(r===0)return G_(e.substring(1),t,n).neg();for(var i=Dn(Od(n,8)),a=or,s=0;s<e.length;s+=8){var o=Math.min(8,e.length-s),c=parseInt(e.substring(s,s+o),n);if(o<8){var u=Dn(Od(n,o));a=a.mul(u).add(Dn(c))}else a=a.mul(i),a=a.add(Dn(c))}return a.unsigned=t,a}Ze.fromString=G_;function cr(e,t){return typeof e=="number"?Dn(e,t):typeof e=="string"?G_(e,t):Oe(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}Ze.fromValue=cr;var _I=65536,Q6=1<<24,eo=_I*_I,vI=eo*eo,AI=vI/2,yI=qa(Q6),or=qa(0);Ze.ZERO=or;var mi=qa(0,!0);Ze.UZERO=mi;var js=qa(1);Ze.ONE=js;var wI=qa(1,!0);Ze.UONE=wI;var V_=qa(-1);Ze.NEG_ONE=V_;var bI=Oe(-1,2147483647,!1);Ze.MAX_VALUE=bI;var EI=Oe(-1,-1,!0);Ze.MAX_UNSIGNED_VALUE=EI;var un=Oe(0,-2147483648,!1);Ze.MIN_VALUE=un;var W=Ze.prototype;W.toInt=function(){return this.unsigned?this.low>>>0:this.low};W.toNumber=function(){return this.unsigned?(this.high>>>0)*eo+(this.low>>>0):this.high*eo+(this.low>>>0)};W.toString=function(t){if(t=t||10,t<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(un)){var n=Dn(t),r=this.div(n),i=r.mul(n).sub(this);return r.toString(t)+i.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var a=Dn(Od(t,6),this.unsigned),s=this,o="";;){var c=s.div(a),u=s.sub(c.mul(a)).toInt()>>>0,d=u.toString(t);if(s=c,s.isZero())return d+o;for(;d.length<6;)d="0"+d;o=""+d+o}};W.getHighBits=function(){return this.high};W.getHighBitsUnsigned=function(){return this.high>>>0};W.getLowBits=function(){return this.low};W.getLowBitsUnsigned=function(){return this.low>>>0};W.getNumBitsAbs=function(){if(this.isNegative())return this.eq(un)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,n=31;n>0&&!(t&1<<n);n--);return this.high!=0?n+33:n+1};W.isZero=function(){return this.high===0&&this.low===0};W.eqz=W.isZero;W.isNegative=function(){return!this.unsigned&&this.high<0};W.isPositive=function(){return this.unsigned||this.high>=0};W.isOdd=function(){return(this.low&1)===1};W.isEven=function(){return(this.low&1)===0};W.equals=function(t){return zt(t)||(t=cr(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low};W.eq=W.equals;W.notEquals=function(t){return!this.eq(t)};W.neq=W.notEquals;W.ne=W.notEquals;W.lessThan=function(t){return this.comp(t)<0};W.lt=W.lessThan;W.lessThanOrEqual=function(t){return this.comp(t)<=0};W.lte=W.lessThanOrEqual;W.le=W.lessThanOrEqual;W.greaterThan=function(t){return this.comp(t)>0};W.gt=W.greaterThan;W.greaterThanOrEqual=function(t){return this.comp(t)>=0};W.gte=W.greaterThanOrEqual;W.ge=W.greaterThanOrEqual;W.compare=function(t){if(zt(t)||(t=cr(t)),this.eq(t))return 0;var n=this.isNegative(),r=t.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1};W.comp=W.compare;W.negate=function(){return!this.unsigned&&this.eq(un)?un:this.not().add(js)};W.neg=W.negate;W.add=function(t){zt(t)||(t=cr(t));var n=this.high>>>16,r=this.high&65535,i=this.low>>>16,a=this.low&65535,s=t.high>>>16,o=t.high&65535,c=t.low>>>16,u=t.low&65535,d=0,p=0,h=0,_=0;return _+=a+u,h+=_>>>16,_&=65535,h+=i+c,p+=h>>>16,h&=65535,p+=r+o,d+=p>>>16,p&=65535,d+=n+s,d&=65535,Oe(h<<16|_,d<<16|p,this.unsigned)};W.subtract=function(t){return zt(t)||(t=cr(t)),this.add(t.neg())};W.sub=W.subtract;W.multiply=function(t){if(this.isZero())return this;if(zt(t)||(t=cr(t)),Pn){var n=Pn.mul(this.low,this.high,t.low,t.high);return Oe(n,Pn.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?mi:or;if(this.eq(un))return t.isOdd()?un:or;if(t.eq(un))return this.isOdd()?un:or;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(yI)&&t.lt(yI))return Dn(this.toNumber()*t.toNumber(),this.unsigned);var r=this.high>>>16,i=this.high&65535,a=this.low>>>16,s=this.low&65535,o=t.high>>>16,c=t.high&65535,u=t.low>>>16,d=t.low&65535,p=0,h=0,_=0,w=0;return w+=s*d,_+=w>>>16,w&=65535,_+=a*d,h+=_>>>16,_&=65535,_+=s*u,h+=_>>>16,_&=65535,h+=i*d,p+=h>>>16,h&=65535,h+=a*u,p+=h>>>16,h&=65535,h+=s*c,p+=h>>>16,h&=65535,p+=r*d+i*u+a*c+s*o,p&=65535,Oe(_<<16|w,p<<16|h,this.unsigned)};W.mul=W.multiply;W.divide=function(t){if(zt(t)||(t=cr(t)),t.isZero())throw Error("division by zero");if(Pn){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var n=(this.unsigned?Pn.div_u:Pn.div_s)(this.low,this.high,t.low,t.high);return Oe(n,Pn.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?mi:or;var r,i,a;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return mi;if(t.gt(this.shru(1)))return wI;a=mi}else{if(this.eq(un)){if(t.eq(js)||t.eq(V_))return un;if(t.eq(un))return js;var s=this.shr(1);return r=s.div(t).shl(1),r.eq(or)?t.isNegative()?js:V_:(i=this.sub(t.mul(r)),a=r.add(i.div(t)),a)}else if(t.eq(un))return this.unsigned?mi:or;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();a=or}for(i=this;i.gte(t);){r=Math.max(1,Math.floor(i.toNumber()/t.toNumber()));for(var o=Math.ceil(Math.log(r)/Math.LN2),c=o<=48?1:Od(2,o-48),u=Dn(r),d=u.mul(t);d.isNegative()||d.gt(i);)r-=c,u=Dn(r,this.unsigned),d=u.mul(t);u.isZero()&&(u=js),a=a.add(u),i=i.sub(d)}return a};W.div=W.divide;W.modulo=function(t){if(zt(t)||(t=cr(t)),Pn){var n=(this.unsigned?Pn.rem_u:Pn.rem_s)(this.low,this.high,t.low,t.high);return Oe(n,Pn.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};W.mod=W.modulo;W.rem=W.modulo;W.not=function(){return Oe(~this.low,~this.high,this.unsigned)};W.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};W.clz=W.countLeadingZeros;W.countTrailingZeros=function(){return this.low?hI(this.low):hI(this.high)+32};W.ctz=W.countTrailingZeros;W.and=function(t){return zt(t)||(t=cr(t)),Oe(this.low&t.low,this.high&t.high,this.unsigned)};W.or=function(t){return zt(t)||(t=cr(t)),Oe(this.low|t.low,this.high|t.high,this.unsigned)};W.xor=function(t){return zt(t)||(t=cr(t)),Oe(this.low^t.low,this.high^t.high,this.unsigned)};W.shiftLeft=function(t){return zt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?Oe(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):Oe(0,this.low<<t-32,this.unsigned)};W.shl=W.shiftLeft;W.shiftRight=function(t){return zt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?Oe(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):Oe(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};W.shr=W.shiftRight;W.shiftRightUnsigned=function(t){return zt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?Oe(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):t===32?Oe(this.high,0,this.unsigned):Oe(this.high>>>t-32,0,this.unsigned)};W.shru=W.shiftRightUnsigned;W.shr_u=W.shiftRightUnsigned;W.rotateLeft=function(t){var n;return zt(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?Oe(this.high,this.low,this.unsigned):t<32?(n=32-t,Oe(this.low<<t|this.high>>>n,this.high<<t|this.low>>>n,this.unsigned)):(t-=32,n=32-t,Oe(this.high<<t|this.low>>>n,this.low<<t|this.high>>>n,this.unsigned))};W.rotl=W.rotateLeft;W.rotateRight=function(t){var n;return zt(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?Oe(this.high,this.low,this.unsigned):t<32?(n=32-t,Oe(this.high<<n|this.low>>>t,this.low<<n|this.high>>>t,this.unsigned)):(t-=32,n=32-t,Oe(this.low<<n|this.high>>>t,this.high<<n|this.low>>>t,this.unsigned))};W.rotr=W.rotateRight;W.toSigned=function(){return this.unsigned?Oe(this.low,this.high,!1):this};W.toUnsigned=function(){return this.unsigned?this:Oe(this.low,this.high,!0)};W.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()};W.toBytesLE=function(){var t=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]};W.toBytesBE=function(){var t=this.high,n=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,n>>>24,n>>>16&255,n>>>8&255,n&255]};Ze.fromBytes=function(t,n,r){return r?Ze.fromBytesLE(t,n):Ze.fromBytesBE(t,n)};Ze.fromBytesLE=function(t,n){return new Ze(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,n)};Ze.fromBytesBE=function(t,n){return new Ze(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],n)};var gi=Ze;var g=Tn(no(),1);var Ud=Tn(no(),1);function mS(){return{}}var zu={encode(e,t=Ud.default.Writer.create()){return t},decode(e,t){let n=e instanceof Ud.default.Reader?e:Ud.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=mS();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{}},toJSON(e){return{}},create(e){return zu.fromPartial(e??{})},fromPartial(e){return mS()}};var yn=Tn(no(),1),Va;(function(e){e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Va||(Va={}));function X6(e){switch(e){case 0:case"NULL_VALUE":return Va.NULL_VALUE;case-1:case"UNRECOGNIZED":default:return Va.UNRECOGNIZED}}function Y6(e){switch(e){case Va.NULL_VALUE:return"NULL_VALUE";case Va.UNRECOGNIZED:default:return"UNRECOGNIZED"}}function cA(){return{fields:{}}}var M={encode(e,t=yn.default.Writer.create()){return Object.entries(e.fields).forEach(([n,r])=>{r!==void 0&&dA.encode({key:n,value:r},t.uint32(10).fork()).ldelim()}),t},decode(e,t){let n=e instanceof yn.default.Reader?e:yn.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=cA();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;let s=dA.decode(n,n.uint32());s.value!==void 0&&(i.fields[s.key]=s.value);continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{fields:_S(e.fields)?Object.entries(e.fields).reduce((t,[n,r])=>(t[n]=r,t),{}):{}}},toJSON(e){let t={};if(e.fields){let n=Object.entries(e.fields);n.length>0&&(t.fields={},n.forEach(([r,i])=>{t.fields[r]=i}))}return t},create(e){return M.fromPartial(e??{})},fromPartial(e){let t=cA();return t.fields=Object.entries(e.fields??{}).reduce((n,[r,i])=>(i!==void 0&&(n[r]=i),n),{}),t},wrap(e){let t=cA();if(e!==void 0)for(let n of Object.keys(e))t.fields[n]=e[n];return t},unwrap(e){let t={};if(e.fields)for(let n of Object.keys(e.fields))t[n]=e.fields[n];return t}};function gS(){return{key:"",value:void 0}}var dA={encode(e,t=yn.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&_i.encode(_i.wrap(e.value),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof yn.default.Reader?e:yn.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=gS();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.key=n.string();continue;case 2:if(a!==18)break;i.value=_i.unwrap(_i.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{key:ro(e.key)?globalThis.String(e.key):"",value:ro(e?.value)?e.value:void 0}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==void 0&&(t.value=e.value),t},create(e){return dA.fromPartial(e??{})},fromPartial(e){let t=gS();return t.key=e.key??"",t.value=e.value??void 0,t}};function uA(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var _i={encode(e,t=yn.default.Writer.create()){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&M.encode(M.wrap(e.structValue),t.uint32(42).fork()).ldelim(),e.listValue!==void 0&&Jr.encode(Jr.wrap(e.listValue),t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof yn.default.Reader?e:yn.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=uA();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.nullValue=n.int32();continue;case 2:if(a!==17)break;i.numberValue=n.double();continue;case 3:if(a!==26)break;i.stringValue=n.string();continue;case 4:if(a!==32)break;i.boolValue=n.bool();continue;case 5:if(a!==42)break;i.structValue=M.unwrap(M.decode(n,n.uint32()));continue;case 6:if(a!==50)break;i.listValue=Jr.unwrap(Jr.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{nullValue:ro(e.nullValue)?X6(e.nullValue):void 0,numberValue:ro(e.numberValue)?globalThis.Number(e.numberValue):void 0,stringValue:ro(e.stringValue)?globalThis.String(e.stringValue):void 0,boolValue:ro(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,structValue:_S(e.structValue)?e.structValue:void 0,listValue:globalThis.Array.isArray(e.listValue)?[...e.listValue]:void 0}},toJSON(e){let t={};return e.nullValue!==void 0&&(t.nullValue=Y6(e.nullValue)),e.numberValue!==void 0&&(t.numberValue=e.numberValue),e.stringValue!==void 0&&(t.stringValue=e.stringValue),e.boolValue!==void 0&&(t.boolValue=e.boolValue),e.structValue!==void 0&&(t.structValue=e.structValue),e.listValue!==void 0&&(t.listValue=e.listValue),t},create(e){return _i.fromPartial(e??{})},fromPartial(e){let t=uA();return t.nullValue=e.nullValue??void 0,t.numberValue=e.numberValue??void 0,t.stringValue=e.stringValue??void 0,t.boolValue=e.boolValue??void 0,t.structValue=e.structValue??void 0,t.listValue=e.listValue??void 0,t},wrap(e){let t=uA();if(e===null)t.nullValue=Va.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(globalThis.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new globalThis.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function lA(){return{values:[]}}var Jr={encode(e,t=yn.default.Writer.create()){for(let n of e.values)_i.encode(_i.wrap(n),t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof yn.default.Reader?e:yn.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=lA();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.values.push(_i.unwrap(_i.decode(n,n.uint32())));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{values:globalThis.Array.isArray(e?.values)?[...e.values]:[]}},toJSON(e){let t={};return e.values?.length&&(t.values=e.values),t},create(e){return Jr.fromPartial(e??{})},fromPartial(e){let t=lA();return t.values=e.values?.map(n=>n)||[],t},wrap(e){let t=lA();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&globalThis.Array.isArray(e.values)?e.values:e}};function _S(e){return typeof e=="object"&&e!==null}function ro(e){return e!=null}var Ga=Tn(no(),1);function AS(){return{seconds:BigInt("0"),nanos:0}}var Me={encode(e,t=Ga.default.Writer.create()){if(e.seconds!==BigInt("0")){if(BigInt.asIntN(64,e.seconds)!==e.seconds)throw new globalThis.Error("value provided for field message.seconds of type int64 too large");t.uint32(8).int64(e.seconds.toString())}return e.nanos!==0&&t.uint32(16).int32(e.nanos),t},decode(e,t){let n=e instanceof Ga.default.Reader?e:Ga.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=AS();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.seconds=$6(n.int64());continue;case 2:if(a!==16)break;i.nanos=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{seconds:yS(e.seconds)?BigInt(e.seconds):BigInt("0"),nanos:yS(e.nanos)?globalThis.Number(e.nanos):0}},toJSON(e){let t={};return e.seconds!==BigInt("0")&&(t.seconds=e.seconds.toString()),e.nanos!==0&&(t.nanos=Math.round(e.nanos)),t},create(e){return Me.fromPartial(e??{})},fromPartial(e){let t=AS();return t.seconds=e.seconds??BigInt("0"),t.nanos=e.nanos??0,t}};function $6(e){return BigInt(e.toString())}Ga.default.util.Long!==gi&&(Ga.default.util.Long=gi,Ga.default.configure());function yS(e){return e!=null}var Fe=Tn(no(),1);var vS;(function(e){e[e.FREE=0]="FREE",e[e.DEV=1]="DEV",e[e.PRO=2]="PRO",e[e.ENTERPRISE=3]="ENTERPRISE",e[e.ANONYMOUS=16]="ANONYMOUS",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(vS||(vS={}));var wS;(function(e){e[e.ORG_MEMBER=0]="ORG_MEMBER",e[e.ORG_ADMIN=1]="ORG_ADMIN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(wS||(wS={}));var bS;(function(e){e[e.AND=0]="AND",e[e.OR=1]="OR",e[e.THEN=2]="THEN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(bS||(bS={}));var ES;(function(e){e[e.READ=0]="READ",e[e.WRITE=1]="WRITE",e[e.ADMIN=2]="ADMIN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(ES||(ES={}));var CS;(function(e){e[e.GENERAL=0]="GENERAL",e[e.PROCESSOR_UPLOAD_FAILED=101]="PROCESSOR_UPLOAD_FAILED",e[e.PROCESSOR_UPLOAD_SUCCESS=102]="PROCESSOR_UPLOAD_SUCCESS",e[e.PROCESSOR_OBSOLETED=103]="PROCESSOR_OBSOLETED",e[e.PROCESSOR_STOPPED=104]="PROCESSOR_STOPPED",e[e.PROCESSOR_ACTIVATED=105]="PROCESSOR_ACTIVATED",e[e.PROCESSOR_GENERAL=106]="PROCESSOR_GENERAL",e[e.PROCESSOR_ERROR=107]="PROCESSOR_ERROR",e[e.EXPORT_TASK_FAILED=201]="EXPORT_TASK_FAILED",e[e.EXPORT_TASK_SUCCESS=202]="EXPORT_TASK_SUCCESS",e[e.BILLING_INVOICE=301]="BILLING_INVOICE",e[e.BILLING_PAYMENT=302]="BILLING_PAYMENT",e[e.BILLING_SUBSCRIPTION=303]="BILLING_SUBSCRIPTION",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(CS||(CS={}));var IS;(function(e){e[e.PENDING=0]="PENDING",e[e.SET_USERNAME=1]="SET_USERNAME",e[e.BANNED=9]="BANNED",e[e.ACTIVE=10]="ACTIVE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(IS||(IS={}));var SS;(function(e){e[e.PUBLIC=0]="PUBLIC",e[e.PRIVATE=1]="PRIVATE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(SS||(SS={}));var xS;(function(e){e[e.SENTIO=0]="SENTIO",e[e.SUBGRAPH=1]="SUBGRAPH",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(xS||(xS={}));var TS;(function(e){e[e.AVG=0]="AVG",e[e.SUM=1]="SUM",e[e.MIN=2]="MIN",e[e.MAX=3]="MAX",e[e.COUNT=4]="COUNT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(TS||(TS={}));var NS;(function(e){e[e.EQ=0]="EQ",e[e.NEQ=1]="NEQ",e[e.EXISTS=9]="EXISTS",e[e.NOT_EXISTS=10]="NOT_EXISTS",e[e.GT=2]="GT",e[e.GTE=3]="GTE",e[e.LT=4]="LT",e[e.LTE=5]="LTE",e[e.BETWEEN=7]="BETWEEN",e[e.NOT_BETWEEN=8]="NOT_BETWEEN",e[e.CONTAINS=11]="CONTAINS",e[e.NOT_CONTAINS=12]="NOT_CONTAINS",e[e.IN_COHORTS=13]="IN_COHORTS",e[e.NOT_IN_COHORTS=14]="NOT_IN_COHORTS",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(NS||(NS={}));var RS;(function(e){e[e.EVENTS=0]="EVENTS",e[e.COHORTS=1]="COHORTS",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(RS||(RS={}));var BS;(function(e){e[e.SUM=0]="SUM",e[e.CUMULATIVE_SUM=6]="CUMULATIVE_SUM",e[e.AVG=1]="AVG",e[e.MEDIAN=2]="MEDIAN",e[e.MIN=3]="MIN",e[e.MAX=4]="MAX",e[e.DISTINCT_COUNT=5]="DISTINCT_COUNT",e[e.CUMULATIVE_DISTINCT_COUNT=9]="CUMULATIVE_DISTINCT_COUNT",e[e.CUMULATIVE_COUNT=12]="CUMULATIVE_COUNT",e[e.LAST=7]="LAST",e[e.CUMULATIVE_LAST=10]="CUMULATIVE_LAST",e[e.FIRST=8]="FIRST",e[e.CUMULATIVE_FIRST=11]="CUMULATIVE_FIRST",e[e.PERCENTILE_25TH=20]="PERCENTILE_25TH",e[e.PERCENTILE_75TH=21]="PERCENTILE_75TH",e[e.PERCENTILE_90TH=22]="PERCENTILE_90TH",e[e.PERCENTILE_95TH=23]="PERCENTILE_95TH",e[e.PERCENTILE_99TH=24]="PERCENTILE_99TH",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(BS||(BS={}));var kS;(function(e){e[e.EQ=0]="EQ",e[e.NEQ=1]="NEQ",e[e.GT=2]="GT",e[e.GTE=3]="GTE",e[e.LT=4]="LT",e[e.LTE=5]="LTE",e[e.BETWEEN=7]="BETWEEN",e[e.NOT_BETWEEN=8]="NOT_BETWEEN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(kS||(kS={}));var OS;(function(e){e[e.SUM=0]="SUM",e[e.AVG=1]="AVG",e[e.MEDIAN=2]="MEDIAN",e[e.MIN=3]="MIN",e[e.MAX=4]="MAX",e[e.DISTINCT_COUNT=5]="DISTINCT_COUNT",e[e.LAST=6]="LAST",e[e.FIRST=7]="FIRST",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(OS||(OS={}));var PS;(function(e){e[e.PROCESSOR=0]="PROCESSOR",e[e.UI=1]="UI",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(PS||(PS={}));var DS;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.EMAIL=1]="EMAIL",e[e.SLACK=2]="SLACK",e[e.TELEGRAM=3]="TELEGRAM",e[e.WEBHOOK=4]="WEBHOOK",e[e.DISCORD=5]="DISCORD",e[e.PAGERDUTY=6]="PAGERDUTY",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(DS||(DS={}));var MS;(function(e){e[e.STRING=0]="STRING",e[e.NUMBER=1]="NUMBER",e[e.BOOLEAN=2]="BOOLEAN",e[e.LIST=3]="LIST",e[e.TIME=4]="TIME",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(MS||(MS={}));var FS;(function(e){e[e.OnOrAfter=0]="OnOrAfter",e[e.On=1]="On",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(FS||(FS={}));var LS;(function(e){e[e.Disable=0]="Disable",e[e.FirstInTimeRange=1]="FirstInTimeRange",e[e.FirstInGlobal=2]="FirstInGlobal",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(LS||(LS={}));var QS;(function(e){e[e.Day=0]="Day",e[e.Week=1]="Week",e[e.Month=2]="Month",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(QS||(QS={}));var US;(function(e){e[e.SUM=0]="SUM",e[e.AVG=1]="AVG",e[e.MEDIAN=2]="MEDIAN",e[e.MIN=3]="MIN",e[e.MAX=4]="MAX",e[e.DISTINCT_COUNT=5]="DISTINCT_COUNT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(US||(US={}));var At;(function(e){e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(At||(At={}));function K6(e){switch(e){case 0:case"NULL_VALUE":return At.NULL_VALUE;case-1:case"UNRECOGNIZED":default:return At.UNRECOGNIZED}}function j6(e){switch(e){case At.NULL_VALUE:return"NULL_VALUE";case At.UNRECOGNIZED:default:return"UNRECOGNIZED"}}function qS(){return{symbol:void 0,address:void 0}}var Vi={encode(e,t=Fe.default.Writer.create()){return e.symbol!==void 0&&t.uint32(10).string(e.symbol),e.address!==void 0&&io.encode(e.address,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof Fe.default.Reader?e:Fe.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=qS();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.symbol=n.string();continue;case 2:if(a!==18)break;i.address=io.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{symbol:ot(e.symbol)?globalThis.String(e.symbol):void 0,address:ot(e.address)?io.fromJSON(e.address):void 0}},toJSON(e){let t={};return e.symbol!==void 0&&(t.symbol=e.symbol),e.address!==void 0&&(t.address=io.toJSON(e.address)),t},create(e){return Vi.fromPartial(e??{})},fromPartial(e){let t=qS();return t.symbol=e.symbol??void 0,t.address=e.address!==void 0&&e.address!==null?io.fromPartial(e.address):void 0,t}};function JS(){return{address:"",chain:""}}var io={encode(e,t=Fe.default.Writer.create()){return e.address!==""&&t.uint32(10).string(e.address),e.chain!==""&&t.uint32(18).string(e.chain),t},decode(e,t){let n=e instanceof Fe.default.Reader?e:Fe.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=JS();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.address=n.string();continue;case 2:if(a!==18)break;i.chain=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{address:ot(e.address)?globalThis.String(e.address):"",chain:ot(e.chain)?globalThis.String(e.chain):""}},toJSON(e){let t={};return e.address!==""&&(t.address=e.address),e.chain!==""&&(t.chain=e.chain),t},create(e){return io.fromPartial(e??{})},fromPartial(e){let t=JS();return t.address=e.address??"",t.chain=e.chain??"",t}};function zS(){return{nullValue:void 0,intValue:void 0,floatValue:void 0,bytesValue:void 0,boolValue:void 0,stringValue:void 0,timestampValue:void 0,bigintValue:void 0,bigdecimalValue:void 0,listValue:void 0,structValue:void 0}}var Xt={encode(e,t=Fe.default.Writer.create()){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.intValue!==void 0&&t.uint32(16).int32(e.intValue),e.floatValue!==void 0&&t.uint32(25).double(e.floatValue),e.bytesValue!==void 0&&t.uint32(34).bytes(e.bytesValue),e.boolValue!==void 0&&t.uint32(40).bool(e.boolValue),e.stringValue!==void 0&&t.uint32(50).string(e.stringValue),e.timestampValue!==void 0&&Me.encode(eq(e.timestampValue),t.uint32(58).fork()).ldelim(),e.bigintValue!==void 0&&It.encode(e.bigintValue,t.uint32(66).fork()).ldelim(),e.bigdecimalValue!==void 0&&ao.encode(e.bigdecimalValue,t.uint32(74).fork()).ldelim(),e.listValue!==void 0&&Fn.encode(e.listValue,t.uint32(82).fork()).ldelim(),e.structValue!==void 0&&tt.encode(e.structValue,t.uint32(90).fork()).ldelim(),t},decode(e,t){let n=e instanceof Fe.default.Reader?e:Fe.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=zS();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.nullValue=n.int32();continue;case 2:if(a!==16)break;i.intValue=n.int32();continue;case 3:if(a!==25)break;i.floatValue=n.double();continue;case 4:if(a!==34)break;i.bytesValue=n.bytes();continue;case 5:if(a!==40)break;i.boolValue=n.bool();continue;case 6:if(a!==50)break;i.stringValue=n.string();continue;case 7:if(a!==58)break;i.timestampValue=KS(Me.decode(n,n.uint32()));continue;case 8:if(a!==66)break;i.bigintValue=It.decode(n,n.uint32());continue;case 9:if(a!==74)break;i.bigdecimalValue=ao.decode(n,n.uint32());continue;case 10:if(a!==82)break;i.listValue=Fn.decode(n,n.uint32());continue;case 11:if(a!==90)break;i.structValue=tt.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{nullValue:ot(e.nullValue)?K6(e.nullValue):void 0,intValue:ot(e.intValue)?globalThis.Number(e.intValue):void 0,floatValue:ot(e.floatValue)?globalThis.Number(e.floatValue):void 0,bytesValue:ot(e.bytesValue)?YS(e.bytesValue):void 0,boolValue:ot(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,stringValue:ot(e.stringValue)?globalThis.String(e.stringValue):void 0,timestampValue:ot(e.timestampValue)?tq(e.timestampValue):void 0,bigintValue:ot(e.bigintValue)?It.fromJSON(e.bigintValue):void 0,bigdecimalValue:ot(e.bigdecimalValue)?ao.fromJSON(e.bigdecimalValue):void 0,listValue:ot(e.listValue)?Fn.fromJSON(e.listValue):void 0,structValue:ot(e.structValue)?tt.fromJSON(e.structValue):void 0}},toJSON(e){let t={};return e.nullValue!==void 0&&(t.nullValue=j6(e.nullValue)),e.intValue!==void 0&&(t.intValue=Math.round(e.intValue)),e.floatValue!==void 0&&(t.floatValue=e.floatValue),e.bytesValue!==void 0&&(t.bytesValue=$S(e.bytesValue)),e.boolValue!==void 0&&(t.boolValue=e.boolValue),e.stringValue!==void 0&&(t.stringValue=e.stringValue),e.timestampValue!==void 0&&(t.timestampValue=e.timestampValue.toISOString()),e.bigintValue!==void 0&&(t.bigintValue=It.toJSON(e.bigintValue)),e.bigdecimalValue!==void 0&&(t.bigdecimalValue=ao.toJSON(e.bigdecimalValue)),e.listValue!==void 0&&(t.listValue=Fn.toJSON(e.listValue)),e.structValue!==void 0&&(t.structValue=tt.toJSON(e.structValue)),t},create(e){return Xt.fromPartial(e??{})},fromPartial(e){let t=zS();return t.nullValue=e.nullValue??void 0,t.intValue=e.intValue??void 0,t.floatValue=e.floatValue??void 0,t.bytesValue=e.bytesValue??void 0,t.boolValue=e.boolValue??void 0,t.stringValue=e.stringValue??void 0,t.timestampValue=e.timestampValue??void 0,t.bigintValue=e.bigintValue!==void 0&&e.bigintValue!==null?It.fromPartial(e.bigintValue):void 0,t.bigdecimalValue=e.bigdecimalValue!==void 0&&e.bigdecimalValue!==null?ao.fromPartial(e.bigdecimalValue):void 0,t.listValue=e.listValue!==void 0&&e.listValue!==null?Fn.fromPartial(e.listValue):void 0,t.structValue=e.structValue!==void 0&&e.structValue!==null?tt.fromPartial(e.structValue):void 0,t}};function VS(){return{fields:{}}}var tt={encode(e,t=Fe.default.Writer.create()){return Object.entries(e.fields).forEach(([n,r])=>{fA.encode({key:n,value:r},t.uint32(10).fork()).ldelim()}),t},decode(e,t){let n=e instanceof Fe.default.Reader?e:Fe.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=VS();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;let s=fA.decode(n,n.uint32());s.value!==void 0&&(i.fields[s.key]=s.value);continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{fields:nq(e.fields)?Object.entries(e.fields).reduce((t,[n,r])=>(t[n]=Xt.fromJSON(r),t),{}):{}}},toJSON(e){let t={};if(e.fields){let n=Object.entries(e.fields);n.length>0&&(t.fields={},n.forEach(([r,i])=>{t.fields[r]=Xt.toJSON(i)}))}return t},create(e){return tt.fromPartial(e??{})},fromPartial(e){let t=VS();return t.fields=Object.entries(e.fields??{}).reduce((n,[r,i])=>(i!==void 0&&(n[r]=Xt.fromPartial(i)),n),{}),t}};function GS(){return{key:"",value:void 0}}var fA={encode(e,t=Fe.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&Xt.encode(e.value,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof Fe.default.Reader?e:Fe.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=GS();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.key=n.string();continue;case 2:if(a!==18)break;i.value=Xt.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{key:ot(e.key)?globalThis.String(e.key):"",value:ot(e.value)?Xt.fromJSON(e.value):void 0}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==void 0&&(t.value=Xt.toJSON(e.value)),t},create(e){return fA.fromPartial(e??{})},fromPartial(e){let t=GS();return t.key=e.key??"",t.value=e.value!==void 0&&e.value!==null?Xt.fromPartial(e.value):void 0,t}};function WS(){return{values:[]}}var Fn={encode(e,t=Fe.default.Writer.create()){for(let n of e.values)Xt.encode(n,t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof Fe.default.Reader?e:Fe.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=WS();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.values.push(Xt.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{values:globalThis.Array.isArray(e?.values)?e.values.map(t=>Xt.fromJSON(t)):[]}},toJSON(e){let t={};return e.values?.length&&(t.values=e.values.map(n=>Xt.toJSON(n))),t},create(e){return Fn.fromPartial(e??{})},fromPartial(e){let t=WS();return t.values=e.values?.map(n=>Xt.fromPartial(n))||[],t}};function HS(){return{entities:[]}}var Gi={encode(e,t=Fe.default.Writer.create()){for(let n of e.entities)tt.encode(n,t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof Fe.default.Reader?e:Fe.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=HS();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.entities.push(tt.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{entities:globalThis.Array.isArray(e?.entities)?e.entities.map(t=>tt.fromJSON(t)):[]}},toJSON(e){let t={};return e.entities?.length&&(t.entities=e.entities.map(n=>tt.toJSON(n))),t},create(e){return Gi.fromPartial(e??{})},fromPartial(e){let t=HS();return t.entities=e.entities?.map(n=>tt.fromPartial(n))||[],t}};function ZS(){return{value:void 0,exp:0}}var ao={encode(e,t=Fe.default.Writer.create()){return e.value!==void 0&&It.encode(e.value,t.uint32(10).fork()).ldelim(),e.exp!==0&&t.uint32(16).int32(e.exp),t},decode(e,t){let n=e instanceof Fe.default.Reader?e:Fe.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=ZS();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.value=It.decode(n,n.uint32());continue;case 2:if(a!==16)break;i.exp=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{value:ot(e.value)?It.fromJSON(e.value):void 0,exp:ot(e.exp)?globalThis.Number(e.exp):0}},toJSON(e){let t={};return e.value!==void 0&&(t.value=It.toJSON(e.value)),e.exp!==0&&(t.exp=Math.round(e.exp)),t},create(e){return ao.fromPartial(e??{})},fromPartial(e){let t=ZS();return t.value=e.value!==void 0&&e.value!==null?It.fromPartial(e.value):void 0,t.exp=e.exp??0,t}};function XS(){return{negative:!1,data:new Uint8Array(0)}}var It={encode(e,t=Fe.default.Writer.create()){return e.negative!==!1&&t.uint32(8).bool(e.negative),e.data.length!==0&&t.uint32(18).bytes(e.data),t},decode(e,t){let n=e instanceof Fe.default.Reader?e:Fe.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=XS();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.negative=n.bool();continue;case 2:if(a!==18)break;i.data=n.bytes();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{negative:ot(e.negative)?globalThis.Boolean(e.negative):!1,data:ot(e.data)?YS(e.data):new Uint8Array(0)}},toJSON(e){let t={};return e.negative!==!1&&(t.negative=e.negative),e.data.length!==0&&(t.data=$S(e.data)),t},create(e){return It.fromPartial(e??{})},fromPartial(e){let t=XS();return t.negative=e.negative??!1,t.data=e.data??new Uint8Array(0),t}};function YS(e){if(globalThis.Buffer)return Uint8Array.from(globalThis.Buffer.from(e,"base64"));{let t=globalThis.atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;++r)n[r]=t.charCodeAt(r);return n}}function $S(e){if(globalThis.Buffer)return globalThis.Buffer.from(e).toString("base64");{let t=[];return e.forEach(n=>{t.push(globalThis.String.fromCharCode(n))}),globalThis.btoa(t.join(""))}}function eq(e){let t=BigInt(Math.trunc(e.getTime()/1e3)),n=e.getTime()%1e3*1e6;return{seconds:t,nanos:n}}function KS(e){let t=(globalThis.Number(e.seconds.toString())||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function tq(e){return e instanceof globalThis.Date?e:typeof e=="string"?new globalThis.Date(e):KS(Me.fromJSON(e))}Fe.default.util.Long!==gi&&(Fe.default.util.Long=gi,Fe.default.configure());function nq(e){return typeof e=="object"&&e!==null}function ot(e){return e!=null}var Tt;(function(e){e[e.UNKNOWN_TYPE=0]="UNKNOWN_TYPE",e[e.COUNTER=1]="COUNTER",e[e.GAUGE=2]="GAUGE",e[e.HISTOGRAM=3]="HISTOGRAM",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Tt||(Tt={}));function rq(e){switch(e){case 0:case"UNKNOWN_TYPE":return Tt.UNKNOWN_TYPE;case 1:case"COUNTER":return Tt.COUNTER;case 2:case"GAUGE":return Tt.GAUGE;case 3:case"HISTOGRAM":return Tt.HISTOGRAM;case-1:case"UNRECOGNIZED":default:return Tt.UNRECOGNIZED}}function iq(e){switch(e){case Tt.UNKNOWN_TYPE:return"UNKNOWN_TYPE";case Tt.COUNTER:return"COUNTER";case Tt.GAUGE:return"GAUGE";case Tt.HISTOGRAM:return"HISTOGRAM";case Tt.UNRECOGNIZED:default:return"UNRECOGNIZED"}}var yt;(function(e){e[e.COUNT=0]="COUNT",e[e.SUM=1]="SUM",e[e.AVG=2]="AVG",e[e.MIN=3]="MIN",e[e.MAX=4]="MAX",e[e.LAST=5]="LAST",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(yt||(yt={}));function aq(e){switch(e){case 0:case"COUNT":return yt.COUNT;case 1:case"SUM":return yt.SUM;case 2:case"AVG":return yt.AVG;case 3:case"MIN":return yt.MIN;case 4:case"MAX":return yt.MAX;case 5:case"LAST":return yt.LAST;case-1:case"UNRECOGNIZED":default:return yt.UNRECOGNIZED}}function sq(e){switch(e){case yt.COUNT:return"COUNT";case yt.SUM:return"SUM";case yt.AVG:return"AVG";case yt.MIN:return"MIN";case yt.MAX:return"MAX";case yt.LAST:return"LAST";case yt.UNRECOGNIZED:default:return"UNRECOGNIZED"}}var Vr;(function(e){e[e.ADDRESS=0]="ADDRESS",e[e.OBJECT=1]="OBJECT",e[e.WRAPPED_OBJECT=2]="WRAPPED_OBJECT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Vr||(Vr={}));function oq(e){switch(e){case 0:case"ADDRESS":return Vr.ADDRESS;case 1:case"OBJECT":return Vr.OBJECT;case 2:case"WRAPPED_OBJECT":return Vr.WRAPPED_OBJECT;case-1:case"UNRECOGNIZED":default:return Vr.UNRECOGNIZED}}function cq(e){switch(e){case Vr.ADDRESS:return"ADDRESS";case Vr.OBJECT:return"OBJECT";case Vr.WRAPPED_OBJECT:return"WRAPPED_OBJECT";case Vr.UNRECOGNIZED:default:return"UNRECOGNIZED"}}var Gr;(function(e){e[e.ERC20=0]="ERC20",e[e.ERC721=1]="ERC721",e[e.ERC1155=2]="ERC1155",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Gr||(Gr={}));function uq(e){switch(e){case 0:case"ERC20":return Gr.ERC20;case 1:case"ERC721":return Gr.ERC721;case 2:case"ERC1155":return Gr.ERC1155;case-1:case"UNRECOGNIZED":default:return Gr.UNRECOGNIZED}}function lq(e){switch(e){case Gr.ERC20:return"ERC20";case Gr.ERC721:return"ERC721";case Gr.ERC1155:return"ERC1155";case Gr.UNRECOGNIZED:default:return"UNRECOGNIZED"}}var Ce;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.ETH_LOG=1]="ETH_LOG",e[e.ETH_BLOCK=2]="ETH_BLOCK",e[e.ETH_TRACE=5]="ETH_TRACE",e[e.ETH_TRANSACTION=11]="ETH_TRANSACTION",e[e.SOL_INSTRUCTION=4]="SOL_INSTRUCTION",e[e.APT_EVENT=6]="APT_EVENT",e[e.APT_CALL=7]="APT_CALL",e[e.APT_RESOURCE=8]="APT_RESOURCE",e[e.SUI_EVENT=3]="SUI_EVENT",e[e.SUI_CALL=9]="SUI_CALL",e[e.SUI_OBJECT=10]="SUI_OBJECT",e[e.SUI_OBJECT_CHANGE=12]="SUI_OBJECT_CHANGE",e[e.FUEL_CALL=13]="FUEL_CALL",e[e.COSMOS_CALL=14]="COSMOS_CALL",e[e.STARKNET_EVENT=15]="STARKNET_EVENT",e[e.BTC_TRANSACTION=16]="BTC_TRANSACTION",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Ce||(Ce={}));function VT(e){switch(e){case 0:case"UNKNOWN":return Ce.UNKNOWN;case 1:case"ETH_LOG":return Ce.ETH_LOG;case 2:case"ETH_BLOCK":return Ce.ETH_BLOCK;case 5:case"ETH_TRACE":return Ce.ETH_TRACE;case 11:case"ETH_TRANSACTION":return Ce.ETH_TRANSACTION;case 4:case"SOL_INSTRUCTION":return Ce.SOL_INSTRUCTION;case 6:case"APT_EVENT":return Ce.APT_EVENT;case 7:case"APT_CALL":return Ce.APT_CALL;case 8:case"APT_RESOURCE":return Ce.APT_RESOURCE;case 3:case"SUI_EVENT":return Ce.SUI_EVENT;case 9:case"SUI_CALL":return Ce.SUI_CALL;case 10:case"SUI_OBJECT":return Ce.SUI_OBJECT;case 12:case"SUI_OBJECT_CHANGE":return Ce.SUI_OBJECT_CHANGE;case 13:case"FUEL_CALL":return Ce.FUEL_CALL;case 14:case"COSMOS_CALL":return Ce.COSMOS_CALL;case 15:case"STARKNET_EVENT":return Ce.STARKNET_EVENT;case 16:case"BTC_TRANSACTION":return Ce.BTC_TRANSACTION;case-1:case"UNRECOGNIZED":default:return Ce.UNRECOGNIZED}}function GT(e){switch(e){case Ce.UNKNOWN:return"UNKNOWN";case Ce.ETH_LOG:return"ETH_LOG";case Ce.ETH_BLOCK:return"ETH_BLOCK";case Ce.ETH_TRACE:return"ETH_TRACE";case Ce.ETH_TRANSACTION:return"ETH_TRANSACTION";case Ce.SOL_INSTRUCTION:return"SOL_INSTRUCTION";case Ce.APT_EVENT:return"APT_EVENT";case Ce.APT_CALL:return"APT_CALL";case Ce.APT_RESOURCE:return"APT_RESOURCE";case Ce.SUI_EVENT:return"SUI_EVENT";case Ce.SUI_CALL:return"SUI_CALL";case Ce.SUI_OBJECT:return"SUI_OBJECT";case Ce.SUI_OBJECT_CHANGE:return"SUI_OBJECT_CHANGE";case Ce.FUEL_CALL:return"FUEL_CALL";case Ce.COSMOS_CALL:return"COSMOS_CALL";case Ce.STARKNET_EVENT:return"STARKNET_EVENT";case Ce.BTC_TRANSACTION:return"BTC_TRANSACTION";case Ce.UNRECOGNIZED:default:return"UNRECOGNIZED"}}var xt;(function(e){e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARNING=2]="WARNING",e[e.ERROR=3]="ERROR",e[e.CRITICAL=4]="CRITICAL",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(xt||(xt={}));function dq(e){switch(e){case 0:case"DEBUG":return xt.DEBUG;case 1:case"INFO":return xt.INFO;case 2:case"WARNING":return xt.WARNING;case 3:case"ERROR":return xt.ERROR;case 4:case"CRITICAL":return xt.CRITICAL;case-1:case"UNRECOGNIZED":default:return xt.UNRECOGNIZED}}function fq(e){switch(e){case xt.DEBUG:return"DEBUG";case xt.INFO:return"INFO";case xt.WARNING:return"WARNING";case xt.ERROR:return"ERROR";case xt.CRITICAL:return"CRITICAL";case xt.UNRECOGNIZED:default:return"UNRECOGNIZED"}}var Hi;(function(e){e[e.AVG=0]="AVG",e[e.MEDIAN=1]="MEDIAN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Hi||(Hi={}));function oie(e){switch(e){case 0:case"AVG":return Hi.AVG;case 1:case"MEDIAN":return Hi.MEDIAN;case-1:case"UNRECOGNIZED":default:return Hi.UNRECOGNIZED}}function cie(e){switch(e){case Hi.AVG:return"AVG";case Hi.MEDIAN:return"MEDIAN";case Hi.UNRECOGNIZED:default:return"UNRECOGNIZED"}}var St;(function(e){e[e.STRING=0]="STRING",e[e.DOUBLE=1]="DOUBLE",e[e.BOOL=2]="BOOL",e[e.TIMESTAMP=3]="TIMESTAMP",e[e.BIG_INTEGER=4]="BIG_INTEGER",e[e.BIG_DECIMAL=5]="BIG_DECIMAL",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(St||(St={}));function pq(e){switch(e){case 0:case"STRING":return St.STRING;case 1:case"DOUBLE":return St.DOUBLE;case 2:case"BOOL":return St.BOOL;case 3:case"TIMESTAMP":return St.TIMESTAMP;case 4:case"BIG_INTEGER":return St.BIG_INTEGER;case 5:case"BIG_DECIMAL":return St.BIG_DECIMAL;case-1:case"UNRECOGNIZED":default:return St.UNRECOGNIZED}}function hq(e){switch(e){case St.STRING:return"STRING";case St.DOUBLE:return"DOUBLE";case St.BOOL:return"BOOL";case St.TIMESTAMP:return"TIMESTAMP";case St.BIG_INTEGER:return"BIG_INTEGER";case St.BIG_DECIMAL:return"BIG_DECIMAL";case St.UNRECOGNIZED:default:return"UNRECOGNIZED"}}var ye;(function(e){e[e.EQ=0]="EQ",e[e.NE=1]="NE",e[e.GT=2]="GT",e[e.GE=3]="GE",e[e.LT=4]="LT",e[e.LE=5]="LE",e[e.IN=6]="IN",e[e.NOT_IN=7]="NOT_IN",e[e.LIKE=8]="LIKE",e[e.NOT_LIKE=9]="NOT_LIKE",e[e.HAS_ALL=10]="HAS_ALL",e[e.HAS_ANY=11]="HAS_ANY",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(ye||(ye={}));function mq(e){switch(e){case 0:case"EQ":return ye.EQ;case 1:case"NE":return ye.NE;case 2:case"GT":return ye.GT;case 3:case"GE":return ye.GE;case 4:case"LT":return ye.LT;case 5:case"LE":return ye.LE;case 6:case"IN":return ye.IN;case 7:case"NOT_IN":return ye.NOT_IN;case 8:case"LIKE":return ye.LIKE;case 9:case"NOT_LIKE":return ye.NOT_LIKE;case 10:case"HAS_ALL":return ye.HAS_ALL;case 11:case"HAS_ANY":return ye.HAS_ANY;case-1:case"UNRECOGNIZED":default:return ye.UNRECOGNIZED}}function gq(e){switch(e){case ye.EQ:return"EQ";case ye.NE:return"NE";case ye.GT:return"GT";case ye.GE:return"GE";case ye.LT:return"LT";case ye.LE:return"LE";case ye.IN:return"IN";case ye.NOT_IN:return"NOT_IN";case ye.LIKE:return"LIKE";case ye.NOT_LIKE:return"NOT_LIKE";case ye.HAS_ALL:return"HAS_ALL";case ye.HAS_ANY:return"HAS_ANY";case ye.UNRECOGNIZED:default:return"UNRECOGNIZED"}}function jS(){return{name:"",version:""}}var so={encode(e,t=g.default.Writer.create()){return e.name!==""&&t.uint32(10).string(e.name),e.version!==""&&t.uint32(26).string(e.version),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=jS();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.name=n.string();continue;case 3:if(a!==26)break;i.version=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{name:S(e.name)?globalThis.String(e.name):"",version:S(e.version)?globalThis.String(e.version):""}},toJSON(e){let t={};return e.name!==""&&(t.name=e.name),e.version!==""&&(t.version=e.version),t},create(e){return so.fromPartial(e??{})},fromPartial(e){let t=jS();return t.name=e.name??"",t.version=e.version??"",t}};function ex(){return{sequential:!1,forceExactBlockTime:!1,processBindingTimeout:0}}var oo={encode(e,t=g.default.Writer.create()){return e.sequential!==!1&&t.uint32(8).bool(e.sequential),e.forceExactBlockTime!==!1&&t.uint32(16).bool(e.forceExactBlockTime),e.processBindingTimeout!==0&&t.uint32(24).int32(e.processBindingTimeout),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=ex();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.sequential=n.bool();continue;case 2:if(a!==16)break;i.forceExactBlockTime=n.bool();continue;case 3:if(a!==24)break;i.processBindingTimeout=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{sequential:S(e.sequential)?globalThis.Boolean(e.sequential):!1,forceExactBlockTime:S(e.forceExactBlockTime)?globalThis.Boolean(e.forceExactBlockTime):!1,processBindingTimeout:S(e.processBindingTimeout)?globalThis.Number(e.processBindingTimeout):0}},toJSON(e){let t={};return e.sequential!==!1&&(t.sequential=e.sequential),e.forceExactBlockTime!==!1&&(t.forceExactBlockTime=e.forceExactBlockTime),e.processBindingTimeout!==0&&(t.processBindingTimeout=Math.round(e.processBindingTimeout)),t},create(e){return oo.fromPartial(e??{})},fromPartial(e){let t=ex();return t.sequential=e.sequential??!1,t.forceExactBlockTime=e.forceExactBlockTime??!1,t.processBindingTimeout=e.processBindingTimeout??0,t}};function tx(){return{}}var WT={encode(e,t=g.default.Writer.create()){return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=tx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{}},toJSON(e){return{}},create(e){return WT.fromPartial(e??{})},fromPartial(e){return tx()}};function nx(){return{config:void 0,executionConfig:void 0,contractConfigs:[],templateInstances:[],accountConfigs:[],metricConfigs:[],eventTrackingConfigs:[],exportConfigs:[],eventLogConfigs:[],dbSchema:void 0}}var HT={encode(e,t=g.default.Writer.create()){e.config!==void 0&&so.encode(e.config,t.uint32(10).fork()).ldelim(),e.executionConfig!==void 0&&oo.encode(e.executionConfig,t.uint32(74).fork()).ldelim();for(let n of e.contractConfigs)co.encode(n,t.uint32(18).fork()).ldelim();for(let n of e.templateInstances)mr.encode(n,t.uint32(26).fork()).ldelim();for(let n of e.accountConfigs)go.encode(n,t.uint32(34).fork()).ldelim();for(let n of e.metricConfigs)zr.encode(n,t.uint32(42).fork()).ldelim();for(let n of e.eventTrackingConfigs)po.encode(n,t.uint32(50).fork()).ldelim();for(let n of e.exportConfigs)ho.encode(n,t.uint32(58).fork()).ldelim();for(let n of e.eventLogConfigs)Ai.encode(n,t.uint32(66).fork()).ldelim();return e.dbSchema!==void 0&&uo.encode(e.dbSchema,t.uint32(82).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=nx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.config=so.decode(n,n.uint32());continue;case 9:if(a!==74)break;i.executionConfig=oo.decode(n,n.uint32());continue;case 2:if(a!==18)break;i.contractConfigs.push(co.decode(n,n.uint32()));continue;case 3:if(a!==26)break;i.templateInstances.push(mr.decode(n,n.uint32()));continue;case 4:if(a!==34)break;i.accountConfigs.push(go.decode(n,n.uint32()));continue;case 5:if(a!==42)break;i.metricConfigs.push(zr.decode(n,n.uint32()));continue;case 6:if(a!==50)break;i.eventTrackingConfigs.push(po.decode(n,n.uint32()));continue;case 7:if(a!==58)break;i.exportConfigs.push(ho.decode(n,n.uint32()));continue;case 8:if(a!==66)break;i.eventLogConfigs.push(Ai.decode(n,n.uint32()));continue;case 10:if(a!==82)break;i.dbSchema=uo.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{config:S(e.config)?so.fromJSON(e.config):void 0,executionConfig:S(e.executionConfig)?oo.fromJSON(e.executionConfig):void 0,contractConfigs:globalThis.Array.isArray(e?.contractConfigs)?e.contractConfigs.map(t=>co.fromJSON(t)):[],templateInstances:globalThis.Array.isArray(e?.templateInstances)?e.templateInstances.map(t=>mr.fromJSON(t)):[],accountConfigs:globalThis.Array.isArray(e?.accountConfigs)?e.accountConfigs.map(t=>go.fromJSON(t)):[],metricConfigs:globalThis.Array.isArray(e?.metricConfigs)?e.metricConfigs.map(t=>zr.fromJSON(t)):[],eventTrackingConfigs:globalThis.Array.isArray(e?.eventTrackingConfigs)?e.eventTrackingConfigs.map(t=>po.fromJSON(t)):[],exportConfigs:globalThis.Array.isArray(e?.exportConfigs)?e.exportConfigs.map(t=>ho.fromJSON(t)):[],eventLogConfigs:globalThis.Array.isArray(e?.eventLogConfigs)?e.eventLogConfigs.map(t=>Ai.fromJSON(t)):[],dbSchema:S(e.dbSchema)?uo.fromJSON(e.dbSchema):void 0}},toJSON(e){let t={};return e.config!==void 0&&(t.config=so.toJSON(e.config)),e.executionConfig!==void 0&&(t.executionConfig=oo.toJSON(e.executionConfig)),e.contractConfigs?.length&&(t.contractConfigs=e.contractConfigs.map(n=>co.toJSON(n))),e.templateInstances?.length&&(t.templateInstances=e.templateInstances.map(n=>mr.toJSON(n))),e.accountConfigs?.length&&(t.accountConfigs=e.accountConfigs.map(n=>go.toJSON(n))),e.metricConfigs?.length&&(t.metricConfigs=e.metricConfigs.map(n=>zr.toJSON(n))),e.eventTrackingConfigs?.length&&(t.eventTrackingConfigs=e.eventTrackingConfigs.map(n=>po.toJSON(n))),e.exportConfigs?.length&&(t.exportConfigs=e.exportConfigs.map(n=>ho.toJSON(n))),e.eventLogConfigs?.length&&(t.eventLogConfigs=e.eventLogConfigs.map(n=>Ai.toJSON(n))),e.dbSchema!==void 0&&(t.dbSchema=uo.toJSON(e.dbSchema)),t},create(e){return HT.fromPartial(e??{})},fromPartial(e){let t=nx();return t.config=e.config!==void 0&&e.config!==null?so.fromPartial(e.config):void 0,t.executionConfig=e.executionConfig!==void 0&&e.executionConfig!==null?oo.fromPartial(e.executionConfig):void 0,t.contractConfigs=e.contractConfigs?.map(n=>co.fromPartial(n))||[],t.templateInstances=e.templateInstances?.map(n=>mr.fromPartial(n))||[],t.accountConfigs=e.accountConfigs?.map(n=>go.fromPartial(n))||[],t.metricConfigs=e.metricConfigs?.map(n=>zr.fromPartial(n))||[],t.eventTrackingConfigs=e.eventTrackingConfigs?.map(n=>po.fromPartial(n))||[],t.exportConfigs=e.exportConfigs?.map(n=>ho.fromPartial(n))||[],t.eventLogConfigs=e.eventLogConfigs?.map(n=>Ai.fromPartial(n))||[],t.dbSchema=e.dbSchema!==void 0&&e.dbSchema!==null?uo.fromPartial(e.dbSchema):void 0,t}};function rx(){return{contract:void 0,intervalConfigs:[],logConfigs:[],traceConfigs:[],transactionConfig:[],moveEventConfigs:[],moveCallConfigs:[],moveResourceChangeConfigs:[],fuelCallConfigs:[],assetConfigs:[],fuelLogConfigs:[],cosmosLogConfigs:[],starknetEventConfigs:[],btcTransactionConfigs:[],instructionConfig:void 0,startBlock:BigInt("0"),endBlock:BigInt("0"),processorType:""}}var co={encode(e,t=g.default.Writer.create()){e.contract!==void 0&&hr.encode(e.contract,t.uint32(10).fork()).ldelim();for(let n of e.intervalConfigs)ct.encode(n,t.uint32(90).fork()).ldelim();for(let n of e.logConfigs)gr.encode(n,t.uint32(26).fork()).ldelim();for(let n of e.traceConfigs)Ao.encode(n,t.uint32(18).fork()).ldelim();for(let n of e.transactionConfig)yo.encode(n,t.uint32(58).fork()).ldelim();for(let n of e.moveEventConfigs)To.encode(n,t.uint32(74).fork()).ldelim();for(let n of e.moveCallConfigs)Ar.encode(n,t.uint32(82).fork()).ldelim();for(let n of e.moveResourceChangeConfigs)Ro.encode(n,t.uint32(98).fork()).ldelim();for(let n of e.fuelCallConfigs)Lo.encode(n,t.uint32(106).fork()).ldelim();for(let n of e.assetConfigs)vo.encode(n,t.uint32(114).fork()).ldelim();for(let n of e.fuelLogConfigs)bo.encode(n,t.uint32(122).fork()).ldelim();for(let n of e.cosmosLogConfigs)Eo.encode(n,t.uint32(130).fork()).ldelim();for(let n of e.starknetEventConfigs)Oo.encode(n,t.uint32(138).fork()).ldelim();for(let n of e.btcTransactionConfigs)Po.encode(n,t.uint32(146).fork()).ldelim();if(e.instructionConfig!==void 0&&Io.encode(e.instructionConfig,t.uint32(50).fork()).ldelim(),e.startBlock!==BigInt("0")){if(BigInt.asUintN(64,e.startBlock)!==e.startBlock)throw new globalThis.Error("value provided for field message.startBlock of type uint64 too large");t.uint32(32).uint64(e.startBlock.toString())}if(e.endBlock!==BigInt("0")){if(BigInt.asUintN(64,e.endBlock)!==e.endBlock)throw new globalThis.Error("value provided for field message.endBlock of type uint64 too large");t.uint32(40).uint64(e.endBlock.toString())}return e.processorType!==""&&t.uint32(66).string(e.processorType),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=rx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.contract=hr.decode(n,n.uint32());continue;case 11:if(a!==90)break;i.intervalConfigs.push(ct.decode(n,n.uint32()));continue;case 3:if(a!==26)break;i.logConfigs.push(gr.decode(n,n.uint32()));continue;case 2:if(a!==18)break;i.traceConfigs.push(Ao.decode(n,n.uint32()));continue;case 7:if(a!==58)break;i.transactionConfig.push(yo.decode(n,n.uint32()));continue;case 9:if(a!==74)break;i.moveEventConfigs.push(To.decode(n,n.uint32()));continue;case 10:if(a!==82)break;i.moveCallConfigs.push(Ar.decode(n,n.uint32()));continue;case 12:if(a!==98)break;i.moveResourceChangeConfigs.push(Ro.decode(n,n.uint32()));continue;case 13:if(a!==106)break;i.fuelCallConfigs.push(Lo.decode(n,n.uint32()));continue;case 14:if(a!==114)break;i.assetConfigs.push(vo.decode(n,n.uint32()));continue;case 15:if(a!==122)break;i.fuelLogConfigs.push(bo.decode(n,n.uint32()));continue;case 16:if(a!==130)break;i.cosmosLogConfigs.push(Eo.decode(n,n.uint32()));continue;case 17:if(a!==138)break;i.starknetEventConfigs.push(Oo.decode(n,n.uint32()));continue;case 18:if(a!==146)break;i.btcTransactionConfigs.push(Po.decode(n,n.uint32()));continue;case 6:if(a!==50)break;i.instructionConfig=Io.decode(n,n.uint32());continue;case 4:if(a!==32)break;i.startBlock=Gt(n.uint64());continue;case 5:if(a!==40)break;i.endBlock=Gt(n.uint64());continue;case 8:if(a!==66)break;i.processorType=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{contract:S(e.contract)?hr.fromJSON(e.contract):void 0,intervalConfigs:globalThis.Array.isArray(e?.intervalConfigs)?e.intervalConfigs.map(t=>ct.fromJSON(t)):[],logConfigs:globalThis.Array.isArray(e?.logConfigs)?e.logConfigs.map(t=>gr.fromJSON(t)):[],traceConfigs:globalThis.Array.isArray(e?.traceConfigs)?e.traceConfigs.map(t=>Ao.fromJSON(t)):[],transactionConfig:globalThis.Array.isArray(e?.transactionConfig)?e.transactionConfig.map(t=>yo.fromJSON(t)):[],moveEventConfigs:globalThis.Array.isArray(e?.moveEventConfigs)?e.moveEventConfigs.map(t=>To.fromJSON(t)):[],moveCallConfigs:globalThis.Array.isArray(e?.moveCallConfigs)?e.moveCallConfigs.map(t=>Ar.fromJSON(t)):[],moveResourceChangeConfigs:globalThis.Array.isArray(e?.moveResourceChangeConfigs)?e.moveResourceChangeConfigs.map(t=>Ro.fromJSON(t)):[],fuelCallConfigs:globalThis.Array.isArray(e?.fuelCallConfigs)?e.fuelCallConfigs.map(t=>Lo.fromJSON(t)):[],assetConfigs:globalThis.Array.isArray(e?.assetConfigs)?e.assetConfigs.map(t=>vo.fromJSON(t)):[],fuelLogConfigs:globalThis.Array.isArray(e?.fuelLogConfigs)?e.fuelLogConfigs.map(t=>bo.fromJSON(t)):[],cosmosLogConfigs:globalThis.Array.isArray(e?.cosmosLogConfigs)?e.cosmosLogConfigs.map(t=>Eo.fromJSON(t)):[],starknetEventConfigs:globalThis.Array.isArray(e?.starknetEventConfigs)?e.starknetEventConfigs.map(t=>Oo.fromJSON(t)):[],btcTransactionConfigs:globalThis.Array.isArray(e?.btcTransactionConfigs)?e.btcTransactionConfigs.map(t=>Po.fromJSON(t)):[],instructionConfig:S(e.instructionConfig)?Io.fromJSON(e.instructionConfig):void 0,startBlock:S(e.startBlock)?BigInt(e.startBlock):BigInt("0"),endBlock:S(e.endBlock)?BigInt(e.endBlock):BigInt("0"),processorType:S(e.processorType)?globalThis.String(e.processorType):""}},toJSON(e){let t={};return e.contract!==void 0&&(t.contract=hr.toJSON(e.contract)),e.intervalConfigs?.length&&(t.intervalConfigs=e.intervalConfigs.map(n=>ct.toJSON(n))),e.logConfigs?.length&&(t.logConfigs=e.logConfigs.map(n=>gr.toJSON(n))),e.traceConfigs?.length&&(t.traceConfigs=e.traceConfigs.map(n=>Ao.toJSON(n))),e.transactionConfig?.length&&(t.transactionConfig=e.transactionConfig.map(n=>yo.toJSON(n))),e.moveEventConfigs?.length&&(t.moveEventConfigs=e.moveEventConfigs.map(n=>To.toJSON(n))),e.moveCallConfigs?.length&&(t.moveCallConfigs=e.moveCallConfigs.map(n=>Ar.toJSON(n))),e.moveResourceChangeConfigs?.length&&(t.moveResourceChangeConfigs=e.moveResourceChangeConfigs.map(n=>Ro.toJSON(n))),e.fuelCallConfigs?.length&&(t.fuelCallConfigs=e.fuelCallConfigs.map(n=>Lo.toJSON(n))),e.assetConfigs?.length&&(t.assetConfigs=e.assetConfigs.map(n=>vo.toJSON(n))),e.fuelLogConfigs?.length&&(t.fuelLogConfigs=e.fuelLogConfigs.map(n=>bo.toJSON(n))),e.cosmosLogConfigs?.length&&(t.cosmosLogConfigs=e.cosmosLogConfigs.map(n=>Eo.toJSON(n))),e.starknetEventConfigs?.length&&(t.starknetEventConfigs=e.starknetEventConfigs.map(n=>Oo.toJSON(n))),e.btcTransactionConfigs?.length&&(t.btcTransactionConfigs=e.btcTransactionConfigs.map(n=>Po.toJSON(n))),e.instructionConfig!==void 0&&(t.instructionConfig=Io.toJSON(e.instructionConfig)),e.startBlock!==BigInt("0")&&(t.startBlock=e.startBlock.toString()),e.endBlock!==BigInt("0")&&(t.endBlock=e.endBlock.toString()),e.processorType!==""&&(t.processorType=e.processorType),t},create(e){return co.fromPartial(e??{})},fromPartial(e){let t=rx();return t.contract=e.contract!==void 0&&e.contract!==null?hr.fromPartial(e.contract):void 0,t.intervalConfigs=e.intervalConfigs?.map(n=>ct.fromPartial(n))||[],t.logConfigs=e.logConfigs?.map(n=>gr.fromPartial(n))||[],t.traceConfigs=e.traceConfigs?.map(n=>Ao.fromPartial(n))||[],t.transactionConfig=e.transactionConfig?.map(n=>yo.fromPartial(n))||[],t.moveEventConfigs=e.moveEventConfigs?.map(n=>To.fromPartial(n))||[],t.moveCallConfigs=e.moveCallConfigs?.map(n=>Ar.fromPartial(n))||[],t.moveResourceChangeConfigs=e.moveResourceChangeConfigs?.map(n=>Ro.fromPartial(n))||[],t.fuelCallConfigs=e.fuelCallConfigs?.map(n=>Lo.fromPartial(n))||[],t.assetConfigs=e.assetConfigs?.map(n=>vo.fromPartial(n))||[],t.fuelLogConfigs=e.fuelLogConfigs?.map(n=>bo.fromPartial(n))||[],t.cosmosLogConfigs=e.cosmosLogConfigs?.map(n=>Eo.fromPartial(n))||[],t.starknetEventConfigs=e.starknetEventConfigs?.map(n=>Oo.fromPartial(n))||[],t.btcTransactionConfigs=e.btcTransactionConfigs?.map(n=>Po.fromPartial(n))||[],t.instructionConfig=e.instructionConfig!==void 0&&e.instructionConfig!==null?Io.fromPartial(e.instructionConfig):void 0,t.startBlock=e.startBlock??BigInt("0"),t.endBlock=e.endBlock??BigInt("0"),t.processorType=e.processorType??"",t}};function ix(){return{gqlSchema:""}}var uo={encode(e,t=g.default.Writer.create()){return e.gqlSchema!==""&&t.uint32(10).string(e.gqlSchema),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=ix();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.gqlSchema=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{gqlSchema:S(e.gqlSchema)?globalThis.String(e.gqlSchema):""}},toJSON(e){let t={};return e.gqlSchema!==""&&(t.gqlSchema=e.gqlSchema),t},create(e){return uo.fromPartial(e??{})},fromPartial(e){let t=ix();return t.gqlSchema=e.gqlSchema??"",t}};function ax(){return{}}var lo={encode(e,t=g.default.Writer.create()){return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=ax();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{}},toJSON(e){return{}},create(e){return lo.fromPartial(e??{})},fromPartial(e){return ax()}};function sx(){return{retentionEventName:"",days:0}}var fo={encode(e,t=g.default.Writer.create()){return e.retentionEventName!==""&&t.uint32(18).string(e.retentionEventName),e.days!==0&&t.uint32(24).int32(e.days),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=sx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 2:if(a!==18)break;i.retentionEventName=n.string();continue;case 3:if(a!==24)break;i.days=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{retentionEventName:S(e.retentionEventName)?globalThis.String(e.retentionEventName):"",days:S(e.days)?globalThis.Number(e.days):0}},toJSON(e){let t={};return e.retentionEventName!==""&&(t.retentionEventName=e.retentionEventName),e.days!==0&&(t.days=Math.round(e.days)),t},create(e){return fo.fromPartial(e??{})},fromPartial(e){let t=sx();return t.retentionEventName=e.retentionEventName??"",t.days=e.days??0,t}};function ox(){return{eventName:"",totalByDay:!1,unique:!1,totalPerEntity:void 0,distinctAggregationByDays:[],retentionConfig:void 0}}var po={encode(e,t=g.default.Writer.create()){e.eventName!==""&&t.uint32(10).string(e.eventName),e.totalByDay!==!1&&t.uint32(16).bool(e.totalByDay),e.unique!==!1&&t.uint32(24).bool(e.unique),e.totalPerEntity!==void 0&&lo.encode(e.totalPerEntity,t.uint32(34).fork()).ldelim(),t.uint32(42).fork();for(let n of e.distinctAggregationByDays)t.int32(n);return t.ldelim(),e.retentionConfig!==void 0&&fo.encode(e.retentionConfig,t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=ox();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.eventName=n.string();continue;case 2:if(a!==16)break;i.totalByDay=n.bool();continue;case 3:if(a!==24)break;i.unique=n.bool();continue;case 4:if(a!==34)break;i.totalPerEntity=lo.decode(n,n.uint32());continue;case 5:if(a===40){i.distinctAggregationByDays.push(n.int32());continue}if(a===42){let s=n.uint32()+n.pos;for(;n.pos<s;)i.distinctAggregationByDays.push(n.int32());continue}break;case 6:if(a!==50)break;i.retentionConfig=fo.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{eventName:S(e.eventName)?globalThis.String(e.eventName):"",totalByDay:S(e.totalByDay)?globalThis.Boolean(e.totalByDay):!1,unique:S(e.unique)?globalThis.Boolean(e.unique):!1,totalPerEntity:S(e.totalPerEntity)?lo.fromJSON(e.totalPerEntity):void 0,distinctAggregationByDays:globalThis.Array.isArray(e?.distinctAggregationByDays)?e.distinctAggregationByDays.map(t=>globalThis.Number(t)):[],retentionConfig:S(e.retentionConfig)?fo.fromJSON(e.retentionConfig):void 0}},toJSON(e){let t={};return e.eventName!==""&&(t.eventName=e.eventName),e.totalByDay!==!1&&(t.totalByDay=e.totalByDay),e.unique!==!1&&(t.unique=e.unique),e.totalPerEntity!==void 0&&(t.totalPerEntity=lo.toJSON(e.totalPerEntity)),e.distinctAggregationByDays?.length&&(t.distinctAggregationByDays=e.distinctAggregationByDays.map(n=>Math.round(n))),e.retentionConfig!==void 0&&(t.retentionConfig=fo.toJSON(e.retentionConfig)),t},create(e){return po.fromPartial(e??{})},fromPartial(e){let t=ox();return t.eventName=e.eventName??"",t.totalByDay=e.totalByDay??!1,t.unique=e.unique??!1,t.totalPerEntity=e.totalPerEntity!==void 0&&e.totalPerEntity!==null?lo.fromPartial(e.totalPerEntity):void 0,t.distinctAggregationByDays=e.distinctAggregationByDays?.map(n=>n)||[],t.retentionConfig=e.retentionConfig!==void 0&&e.retentionConfig!==null?fo.fromPartial(e.retentionConfig):void 0,t}};function cx(){return{name:"",channel:""}}var ho={encode(e,t=g.default.Writer.create()){return e.name!==""&&t.uint32(10).string(e.name),e.channel!==""&&t.uint32(18).string(e.channel),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=cx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.name=n.string();continue;case 2:if(a!==18)break;i.channel=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{name:S(e.name)?globalThis.String(e.name):"",channel:S(e.channel)?globalThis.String(e.channel):""}},toJSON(e){let t={};return e.name!==""&&(t.name=e.name),e.channel!==""&&(t.channel=e.channel),t},create(e){return ho.fromPartial(e??{})},fromPartial(e){let t=cx();return t.name=e.name??"",t.channel=e.channel??"",t}};function ux(){return{name:"",description:"",unit:"",sparse:!1,persistentBetweenVersion:!1,type:0,aggregationConfig:void 0}}var zr={encode(e,t=g.default.Writer.create()){return e.name!==""&&t.uint32(10).string(e.name),e.description!==""&&t.uint32(26).string(e.description),e.unit!==""&&t.uint32(18).string(e.unit),e.sparse!==!1&&t.uint32(32).bool(e.sparse),e.persistentBetweenVersion!==!1&&t.uint32(40).bool(e.persistentBetweenVersion),e.type!==0&&t.uint32(56).int32(e.type),e.aggregationConfig!==void 0&&mo.encode(e.aggregationConfig,t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=ux();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.name=n.string();continue;case 3:if(a!==26)break;i.description=n.string();continue;case 2:if(a!==18)break;i.unit=n.string();continue;case 4:if(a!==32)break;i.sparse=n.bool();continue;case 5:if(a!==40)break;i.persistentBetweenVersion=n.bool();continue;case 7:if(a!==56)break;i.type=n.int32();continue;case 6:if(a!==50)break;i.aggregationConfig=mo.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{name:S(e.name)?globalThis.String(e.name):"",description:S(e.description)?globalThis.String(e.description):"",unit:S(e.unit)?globalThis.String(e.unit):"",sparse:S(e.sparse)?globalThis.Boolean(e.sparse):!1,persistentBetweenVersion:S(e.persistentBetweenVersion)?globalThis.Boolean(e.persistentBetweenVersion):!1,type:S(e.type)?rq(e.type):0,aggregationConfig:S(e.aggregationConfig)?mo.fromJSON(e.aggregationConfig):void 0}},toJSON(e){let t={};return e.name!==""&&(t.name=e.name),e.description!==""&&(t.description=e.description),e.unit!==""&&(t.unit=e.unit),e.sparse!==!1&&(t.sparse=e.sparse),e.persistentBetweenVersion!==!1&&(t.persistentBetweenVersion=e.persistentBetweenVersion),e.type!==0&&(t.type=iq(e.type)),e.aggregationConfig!==void 0&&(t.aggregationConfig=mo.toJSON(e.aggregationConfig)),t},create(e){return zr.fromPartial(e??{})},fromPartial(e){let t=ux();return t.name=e.name??"",t.description=e.description??"",t.unit=e.unit??"",t.sparse=e.sparse??!1,t.persistentBetweenVersion=e.persistentBetweenVersion??!1,t.type=e.type??0,t.aggregationConfig=e.aggregationConfig!==void 0&&e.aggregationConfig!==null?mo.fromPartial(e.aggregationConfig):void 0,t}};function lx(){return{name:"",fields:[]}}var Ai={encode(e,t=g.default.Writer.create()){e.name!==""&&t.uint32(10).string(e.name);for(let n of e.fields)pr.encode(n,t.uint32(18).fork()).ldelim();return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=lx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.name=n.string();continue;case 2:if(a!==18)break;i.fields.push(pr.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{name:S(e.name)?globalThis.String(e.name):"",fields:globalThis.Array.isArray(e?.fields)?e.fields.map(t=>pr.fromJSON(t)):[]}},toJSON(e){let t={};return e.name!==""&&(t.name=e.name),e.fields?.length&&(t.fields=e.fields.map(n=>pr.toJSON(n))),t},create(e){return Ai.fromPartial(e??{})},fromPartial(e){let t=lx();return t.name=e.name??"",t.fields=e.fields?.map(n=>pr.fromPartial(n))||[],t}};function dx(){return{fields:[]}}var Wi={encode(e,t=g.default.Writer.create()){for(let n of e.fields)pr.encode(n,t.uint32(18).fork()).ldelim();return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=dx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 2:if(a!==18)break;i.fields.push(pr.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{fields:globalThis.Array.isArray(e?.fields)?e.fields.map(t=>pr.fromJSON(t)):[]}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>pr.toJSON(n))),t},create(e){return Wi.fromPartial(e??{})},fromPartial(e){let t=dx();return t.fields=e.fields?.map(n=>pr.fromPartial(n))||[],t}};function fx(){return{name:"",basicType:void 0,coinType:void 0,structType:void 0}}var pr={encode(e,t=g.default.Writer.create()){return e.name!==""&&t.uint32(10).string(e.name),e.basicType!==void 0&&t.uint32(16).int32(e.basicType),e.coinType!==void 0&&Vi.encode(e.coinType,t.uint32(26).fork()).ldelim(),e.structType!==void 0&&Wi.encode(e.structType,t.uint32(34).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=fx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.name=n.string();continue;case 2:if(a!==16)break;i.basicType=n.int32();continue;case 3:if(a!==26)break;i.coinType=Vi.decode(n,n.uint32());continue;case 4:if(a!==34)break;i.structType=Wi.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{name:S(e.name)?globalThis.String(e.name):"",basicType:S(e.basicType)?pq(e.basicType):void 0,coinType:S(e.coinType)?Vi.fromJSON(e.coinType):void 0,structType:S(e.structType)?Wi.fromJSON(e.structType):void 0}},toJSON(e){let t={};return e.name!==""&&(t.name=e.name),e.basicType!==void 0&&(t.basicType=hq(e.basicType)),e.coinType!==void 0&&(t.coinType=Vi.toJSON(e.coinType)),e.structType!==void 0&&(t.structType=Wi.toJSON(e.structType)),t},create(e){return pr.fromPartial(e??{})},fromPartial(e){let t=fx();return t.name=e.name??"",t.basicType=e.basicType??void 0,t.coinType=e.coinType!==void 0&&e.coinType!==null?Vi.fromPartial(e.coinType):void 0,t.structType=e.structType!==void 0&&e.structType!==null?Wi.fromPartial(e.structType):void 0,t}};function px(){return{intervalInMinutes:[],types:[],discardOrigin:!1}}var mo={encode(e,t=g.default.Writer.create()){t.uint32(10).fork();for(let n of e.intervalInMinutes)t.int32(n);t.ldelim(),t.uint32(18).fork();for(let n of e.types)t.int32(n);return t.ldelim(),e.discardOrigin!==!1&&t.uint32(24).bool(e.discardOrigin),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=px();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a===8){i.intervalInMinutes.push(n.int32());continue}if(a===10){let s=n.uint32()+n.pos;for(;n.pos<s;)i.intervalInMinutes.push(n.int32());continue}break;case 2:if(a===16){i.types.push(n.int32());continue}if(a===18){let s=n.uint32()+n.pos;for(;n.pos<s;)i.types.push(n.int32());continue}break;case 3:if(a!==24)break;i.discardOrigin=n.bool();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{intervalInMinutes:globalThis.Array.isArray(e?.intervalInMinutes)?e.intervalInMinutes.map(t=>globalThis.Number(t)):[],types:globalThis.Array.isArray(e?.types)?e.types.map(t=>aq(t)):[],discardOrigin:S(e.discardOrigin)?globalThis.Boolean(e.discardOrigin):!1}},toJSON(e){let t={};return e.intervalInMinutes?.length&&(t.intervalInMinutes=e.intervalInMinutes.map(n=>Math.round(n))),e.types?.length&&(t.types=e.types.map(n=>sq(n))),e.discardOrigin!==!1&&(t.discardOrigin=e.discardOrigin),t},create(e){return mo.fromPartial(e??{})},fromPartial(e){let t=px();return t.intervalInMinutes=e.intervalInMinutes?.map(n=>n)||[],t.types=e.types?.map(n=>n)||[],t.discardOrigin=e.discardOrigin??!1,t}};function hx(){return{chainId:"",address:"",startBlock:BigInt("0"),intervalConfigs:[],moveIntervalConfigs:[],moveCallConfigs:[],logConfigs:[]}}var go={encode(e,t=g.default.Writer.create()){if(e.chainId!==""&&t.uint32(10).string(e.chainId),e.address!==""&&t.uint32(18).string(e.address),e.startBlock!==BigInt("0")){if(BigInt.asUintN(64,e.startBlock)!==e.startBlock)throw new globalThis.Error("value provided for field message.startBlock of type uint64 too large");t.uint32(24).uint64(e.startBlock.toString())}for(let n of e.intervalConfigs)ct.encode(n,t.uint32(34).fork()).ldelim();for(let n of e.moveIntervalConfigs)_o.encode(n,t.uint32(58).fork()).ldelim();for(let n of e.moveCallConfigs)Ar.encode(n,t.uint32(66).fork()).ldelim();for(let n of e.logConfigs)gr.encode(n,t.uint32(50).fork()).ldelim();return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=hx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.chainId=n.string();continue;case 2:if(a!==18)break;i.address=n.string();continue;case 3:if(a!==24)break;i.startBlock=Gt(n.uint64());continue;case 4:if(a!==34)break;i.intervalConfigs.push(ct.decode(n,n.uint32()));continue;case 7:if(a!==58)break;i.moveIntervalConfigs.push(_o.decode(n,n.uint32()));continue;case 8:if(a!==66)break;i.moveCallConfigs.push(Ar.decode(n,n.uint32()));continue;case 6:if(a!==50)break;i.logConfigs.push(gr.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{chainId:S(e.chainId)?globalThis.String(e.chainId):"",address:S(e.address)?globalThis.String(e.address):"",startBlock:S(e.startBlock)?BigInt(e.startBlock):BigInt("0"),intervalConfigs:globalThis.Array.isArray(e?.intervalConfigs)?e.intervalConfigs.map(t=>ct.fromJSON(t)):[],moveIntervalConfigs:globalThis.Array.isArray(e?.moveIntervalConfigs)?e.moveIntervalConfigs.map(t=>_o.fromJSON(t)):[],moveCallConfigs:globalThis.Array.isArray(e?.moveCallConfigs)?e.moveCallConfigs.map(t=>Ar.fromJSON(t)):[],logConfigs:globalThis.Array.isArray(e?.logConfigs)?e.logConfigs.map(t=>gr.fromJSON(t)):[]}},toJSON(e){let t={};return e.chainId!==""&&(t.chainId=e.chainId),e.address!==""&&(t.address=e.address),e.startBlock!==BigInt("0")&&(t.startBlock=e.startBlock.toString()),e.intervalConfigs?.length&&(t.intervalConfigs=e.intervalConfigs.map(n=>ct.toJSON(n))),e.moveIntervalConfigs?.length&&(t.moveIntervalConfigs=e.moveIntervalConfigs.map(n=>_o.toJSON(n))),e.moveCallConfigs?.length&&(t.moveCallConfigs=e.moveCallConfigs.map(n=>Ar.toJSON(n))),e.logConfigs?.length&&(t.logConfigs=e.logConfigs.map(n=>gr.toJSON(n))),t},create(e){return go.fromPartial(e??{})},fromPartial(e){let t=hx();return t.chainId=e.chainId??"",t.address=e.address??"",t.startBlock=e.startBlock??BigInt("0"),t.intervalConfigs=e.intervalConfigs?.map(n=>ct.fromPartial(n))||[],t.moveIntervalConfigs=e.moveIntervalConfigs?.map(n=>_o.fromPartial(n))||[],t.moveCallConfigs=e.moveCallConfigs?.map(n=>Ar.fromPartial(n))||[],t.logConfigs=e.logConfigs?.map(n=>gr.fromPartial(n))||[],t}};function mx(){return{recentInterval:0,backfillInterval:0}}var fr={encode(e,t=g.default.Writer.create()){return e.recentInterval!==0&&t.uint32(8).int32(e.recentInterval),e.backfillInterval!==0&&t.uint32(16).int32(e.backfillInterval),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=mx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.recentInterval=n.int32();continue;case 2:if(a!==16)break;i.backfillInterval=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{recentInterval:S(e.recentInterval)?globalThis.Number(e.recentInterval):0,backfillInterval:S(e.backfillInterval)?globalThis.Number(e.backfillInterval):0}},toJSON(e){let t={};return e.recentInterval!==0&&(t.recentInterval=Math.round(e.recentInterval)),e.backfillInterval!==0&&(t.backfillInterval=Math.round(e.backfillInterval)),t},create(e){return fr.fromPartial(e??{})},fromPartial(e){let t=mx();return t.recentInterval=e.recentInterval??0,t.backfillInterval=e.backfillInterval??0,t}};function gx(){return{handlerId:0,minutes:0,minutesInterval:void 0,slot:0,slotInterval:void 0,fetchConfig:void 0}}var ct={encode(e,t=g.default.Writer.create()){return e.handlerId!==0&&t.uint32(8).int32(e.handlerId),e.minutes!==0&&t.uint32(16).int32(e.minutes),e.minutesInterval!==void 0&&fr.encode(e.minutesInterval,t.uint32(34).fork()).ldelim(),e.slot!==0&&t.uint32(24).int32(e.slot),e.slotInterval!==void 0&&fr.encode(e.slotInterval,t.uint32(42).fork()).ldelim(),e.fetchConfig!==void 0&&ut.encode(e.fetchConfig,t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=gx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.handlerId=n.int32();continue;case 2:if(a!==16)break;i.minutes=n.int32();continue;case 4:if(a!==34)break;i.minutesInterval=fr.decode(n,n.uint32());continue;case 3:if(a!==24)break;i.slot=n.int32();continue;case 5:if(a!==42)break;i.slotInterval=fr.decode(n,n.uint32());continue;case 6:if(a!==50)break;i.fetchConfig=ut.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{handlerId:S(e.handlerId)?globalThis.Number(e.handlerId):0,minutes:S(e.minutes)?globalThis.Number(e.minutes):0,minutesInterval:S(e.minutesInterval)?fr.fromJSON(e.minutesInterval):void 0,slot:S(e.slot)?globalThis.Number(e.slot):0,slotInterval:S(e.slotInterval)?fr.fromJSON(e.slotInterval):void 0,fetchConfig:S(e.fetchConfig)?ut.fromJSON(e.fetchConfig):void 0}},toJSON(e){let t={};return e.handlerId!==0&&(t.handlerId=Math.round(e.handlerId)),e.minutes!==0&&(t.minutes=Math.round(e.minutes)),e.minutesInterval!==void 0&&(t.minutesInterval=fr.toJSON(e.minutesInterval)),e.slot!==0&&(t.slot=Math.round(e.slot)),e.slotInterval!==void 0&&(t.slotInterval=fr.toJSON(e.slotInterval)),e.fetchConfig!==void 0&&(t.fetchConfig=ut.toJSON(e.fetchConfig)),t},create(e){return ct.fromPartial(e??{})},fromPartial(e){let t=gx();return t.handlerId=e.handlerId??0,t.minutes=e.minutes??0,t.minutesInterval=e.minutesInterval!==void 0&&e.minutesInterval!==null?fr.fromPartial(e.minutesInterval):void 0,t.slot=e.slot??0,t.slotInterval=e.slotInterval!==void 0&&e.slotInterval!==null?fr.fromPartial(e.slotInterval):void 0,t.fetchConfig=e.fetchConfig!==void 0&&e.fetchConfig!==null?ut.fromPartial(e.fetchConfig):void 0,t}};function _x(){return{intervalConfig:void 0,type:""}}var _q={encode(e,t=g.default.Writer.create()){return e.intervalConfig!==void 0&&ct.encode(e.intervalConfig,t.uint32(10).fork()).ldelim(),e.type!==""&&t.uint32(18).string(e.type),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=_x();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.intervalConfig=ct.decode(n,n.uint32());continue;case 2:if(a!==18)break;i.type=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{intervalConfig:S(e.intervalConfig)?ct.fromJSON(e.intervalConfig):void 0,type:S(e.type)?globalThis.String(e.type):""}},toJSON(e){let t={};return e.intervalConfig!==void 0&&(t.intervalConfig=ct.toJSON(e.intervalConfig)),e.type!==""&&(t.type=e.type),t},create(e){return _q.fromPartial(e??{})},fromPartial(e){let t=_x();return t.intervalConfig=e.intervalConfig!==void 0&&e.intervalConfig!==null?ct.fromPartial(e.intervalConfig):void 0,t.type=e.type??"",t}};function Ax(){return{intervalConfig:void 0,type:"",ownerType:0,fetchConfig:void 0}}var _o={encode(e,t=g.default.Writer.create()){return e.intervalConfig!==void 0&&ct.encode(e.intervalConfig,t.uint32(10).fork()).ldelim(),e.type!==""&&t.uint32(18).string(e.type),e.ownerType!==0&&t.uint32(24).int32(e.ownerType),e.fetchConfig!==void 0&&xo.encode(e.fetchConfig,t.uint32(34).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Ax();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.intervalConfig=ct.decode(n,n.uint32());continue;case 2:if(a!==18)break;i.type=n.string();continue;case 3:if(a!==24)break;i.ownerType=n.int32();continue;case 4:if(a!==34)break;i.fetchConfig=xo.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{intervalConfig:S(e.intervalConfig)?ct.fromJSON(e.intervalConfig):void 0,type:S(e.type)?globalThis.String(e.type):"",ownerType:S(e.ownerType)?oq(e.ownerType):0,fetchConfig:S(e.fetchConfig)?xo.fromJSON(e.fetchConfig):void 0}},toJSON(e){let t={};return e.intervalConfig!==void 0&&(t.intervalConfig=ct.toJSON(e.intervalConfig)),e.type!==""&&(t.type=e.type),e.ownerType!==0&&(t.ownerType=cq(e.ownerType)),e.fetchConfig!==void 0&&(t.fetchConfig=xo.toJSON(e.fetchConfig)),t},create(e){return _o.fromPartial(e??{})},fromPartial(e){let t=Ax();return t.intervalConfig=e.intervalConfig!==void 0&&e.intervalConfig!==null?ct.fromPartial(e.intervalConfig):void 0,t.type=e.type??"",t.ownerType=e.ownerType??0,t.fetchConfig=e.fetchConfig!==void 0&&e.fetchConfig!==null?xo.fromPartial(e.fetchConfig):void 0,t}};function yx(){return{name:"",chainId:"",address:"",abi:""}}var hr={encode(e,t=g.default.Writer.create()){return e.name!==""&&t.uint32(10).string(e.name),e.chainId!==""&&t.uint32(18).string(e.chainId),e.address!==""&&t.uint32(26).string(e.address),e.abi!==""&&t.uint32(34).string(e.abi),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=yx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.name=n.string();continue;case 2:if(a!==18)break;i.chainId=n.string();continue;case 3:if(a!==26)break;i.address=n.string();continue;case 4:if(a!==34)break;i.abi=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{name:S(e.name)?globalThis.String(e.name):"",chainId:S(e.chainId)?globalThis.String(e.chainId):"",address:S(e.address)?globalThis.String(e.address):"",abi:S(e.abi)?globalThis.String(e.abi):""}},toJSON(e){let t={};return e.name!==""&&(t.name=e.name),e.chainId!==""&&(t.chainId=e.chainId),e.address!==""&&(t.address=e.address),e.abi!==""&&(t.abi=e.abi),t},create(e){return hr.fromPartial(e??{})},fromPartial(e){let t=yx();return t.name=e.name??"",t.chainId=e.chainId??"",t.address=e.address??"",t.abi=e.abi??"",t}};function vx(){return{contract:void 0,startBlock:BigInt("0"),endBlock:BigInt("0"),templateId:0,baseLabels:void 0}}var mr={encode(e,t=g.default.Writer.create()){if(e.contract!==void 0&&hr.encode(e.contract,t.uint32(10).fork()).ldelim(),e.startBlock!==BigInt("0")){if(BigInt.asUintN(64,e.startBlock)!==e.startBlock)throw new globalThis.Error("value provided for field message.startBlock of type uint64 too large");t.uint32(16).uint64(e.startBlock.toString())}if(e.endBlock!==BigInt("0")){if(BigInt.asUintN(64,e.endBlock)!==e.endBlock)throw new globalThis.Error("value provided for field message.endBlock of type uint64 too large");t.uint32(24).uint64(e.endBlock.toString())}return e.templateId!==0&&t.uint32(32).int32(e.templateId),e.baseLabels!==void 0&&M.encode(M.wrap(e.baseLabels),t.uint32(42).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=vx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.contract=hr.decode(n,n.uint32());continue;case 2:if(a!==16)break;i.startBlock=Gt(n.uint64());continue;case 3:if(a!==24)break;i.endBlock=Gt(n.uint64());continue;case 4:if(a!==32)break;i.templateId=n.int32();continue;case 5:if(a!==42)break;i.baseLabels=M.unwrap(M.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{contract:S(e.contract)?hr.fromJSON(e.contract):void 0,startBlock:S(e.startBlock)?BigInt(e.startBlock):BigInt("0"),endBlock:S(e.endBlock)?BigInt(e.endBlock):BigInt("0"),templateId:S(e.templateId)?globalThis.Number(e.templateId):0,baseLabels:Ve(e.baseLabels)?e.baseLabels:void 0}},toJSON(e){let t={};return e.contract!==void 0&&(t.contract=hr.toJSON(e.contract)),e.startBlock!==BigInt("0")&&(t.startBlock=e.startBlock.toString()),e.endBlock!==BigInt("0")&&(t.endBlock=e.endBlock.toString()),e.templateId!==0&&(t.templateId=Math.round(e.templateId)),e.baseLabels!==void 0&&(t.baseLabels=e.baseLabels),t},create(e){return mr.fromPartial(e??{})},fromPartial(e){let t=vx();return t.contract=e.contract!==void 0&&e.contract!==null?hr.fromPartial(e.contract):void 0,t.startBlock=e.startBlock??BigInt("0"),t.endBlock=e.endBlock??BigInt("0"),t.templateId=e.templateId??0,t.baseLabels=e.baseLabels??void 0,t}};function wx(){return{templateInstances:[]}}var ZT={encode(e,t=g.default.Writer.create()){for(let n of e.templateInstances)mr.encode(n,t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=wx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.templateInstances.push(mr.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{templateInstances:globalThis.Array.isArray(e?.templateInstances)?e.templateInstances.map(t=>mr.fromJSON(t)):[]}},toJSON(e){let t={};return e.templateInstances?.length&&(t.templateInstances=e.templateInstances.map(n=>mr.toJSON(n))),t},create(e){return ZT.fromPartial(e??{})},fromPartial(e){let t=wx();return t.templateInstances=e.templateInstances?.map(n=>mr.fromPartial(n))||[],t}};function bx(){return{handlerId:0}}var Aq={encode(e,t=g.default.Writer.create()){return e.handlerId!==0&&t.uint32(8).int32(e.handlerId),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=bx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.handlerId=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{handlerId:S(e.handlerId)?globalThis.Number(e.handlerId):0}},toJSON(e){let t={};return e.handlerId!==0&&(t.handlerId=Math.round(e.handlerId)),t},create(e){return Aq.fromPartial(e??{})},fromPartial(e){let t=bx();return t.handlerId=e.handlerId??0,t}};function Ex(){return{transaction:!1,transactionReceipt:!1,transactionReceiptLogs:!1,block:!1,trace:!1}}var ut={encode(e,t=g.default.Writer.create()){return e.transaction!==!1&&t.uint32(8).bool(e.transaction),e.transactionReceipt!==!1&&t.uint32(16).bool(e.transactionReceipt),e.transactionReceiptLogs!==!1&&t.uint32(40).bool(e.transactionReceiptLogs),e.block!==!1&&t.uint32(24).bool(e.block),e.trace!==!1&&t.uint32(32).bool(e.trace),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Ex();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.transaction=n.bool();continue;case 2:if(a!==16)break;i.transactionReceipt=n.bool();continue;case 5:if(a!==40)break;i.transactionReceiptLogs=n.bool();continue;case 3:if(a!==24)break;i.block=n.bool();continue;case 4:if(a!==32)break;i.trace=n.bool();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{transaction:S(e.transaction)?globalThis.Boolean(e.transaction):!1,transactionReceipt:S(e.transactionReceipt)?globalThis.Boolean(e.transactionReceipt):!1,transactionReceiptLogs:S(e.transactionReceiptLogs)?globalThis.Boolean(e.transactionReceiptLogs):!1,block:S(e.block)?globalThis.Boolean(e.block):!1,trace:S(e.trace)?globalThis.Boolean(e.trace):!1}},toJSON(e){let t={};return e.transaction!==!1&&(t.transaction=e.transaction),e.transactionReceipt!==!1&&(t.transactionReceipt=e.transactionReceipt),e.transactionReceiptLogs!==!1&&(t.transactionReceiptLogs=e.transactionReceiptLogs),e.block!==!1&&(t.block=e.block),e.trace!==!1&&(t.trace=e.trace),t},create(e){return ut.fromPartial(e??{})},fromPartial(e){let t=Ex();return t.transaction=e.transaction??!1,t.transactionReceipt=e.transactionReceipt??!1,t.transactionReceiptLogs=e.transactionReceiptLogs??!1,t.block=e.block??!1,t.trace=e.trace??!1,t}};function Cx(){return{signature:"",handlerId:0,fetchConfig:void 0}}var Ao={encode(e,t=g.default.Writer.create()){return e.signature!==""&&t.uint32(10).string(e.signature),e.handlerId!==0&&t.uint32(16).int32(e.handlerId),e.fetchConfig!==void 0&&ut.encode(e.fetchConfig,t.uint32(26).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Cx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.signature=n.string();continue;case 2:if(a!==16)break;i.handlerId=n.int32();continue;case 3:if(a!==26)break;i.fetchConfig=ut.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{signature:S(e.signature)?globalThis.String(e.signature):"",handlerId:S(e.handlerId)?globalThis.Number(e.handlerId):0,fetchConfig:S(e.fetchConfig)?ut.fromJSON(e.fetchConfig):void 0}},toJSON(e){let t={};return e.signature!==""&&(t.signature=e.signature),e.handlerId!==0&&(t.handlerId=Math.round(e.handlerId)),e.fetchConfig!==void 0&&(t.fetchConfig=ut.toJSON(e.fetchConfig)),t},create(e){return Ao.fromPartial(e??{})},fromPartial(e){let t=Cx();return t.signature=e.signature??"",t.handlerId=e.handlerId??0,t.fetchConfig=e.fetchConfig!==void 0&&e.fetchConfig!==null?ut.fromPartial(e.fetchConfig):void 0,t}};function Ix(){return{handlerId:0,fetchConfig:void 0}}var yo={encode(e,t=g.default.Writer.create()){return e.handlerId!==0&&t.uint32(8).int32(e.handlerId),e.fetchConfig!==void 0&&ut.encode(e.fetchConfig,t.uint32(26).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Ix();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.handlerId=n.int32();continue;case 3:if(a!==26)break;i.fetchConfig=ut.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{handlerId:S(e.handlerId)?globalThis.Number(e.handlerId):0,fetchConfig:S(e.fetchConfig)?ut.fromJSON(e.fetchConfig):void 0}},toJSON(e){let t={};return e.handlerId!==0&&(t.handlerId=Math.round(e.handlerId)),e.fetchConfig!==void 0&&(t.fetchConfig=ut.toJSON(e.fetchConfig)),t},create(e){return yo.fromPartial(e??{})},fromPartial(e){let t=Ix();return t.handlerId=e.handlerId??0,t.fetchConfig=e.fetchConfig!==void 0&&e.fetchConfig!==null?ut.fromPartial(e.fetchConfig):void 0,t}};function Sx(){return{filters:[],handlerId:0,fetchConfig:void 0}}var gr={encode(e,t=g.default.Writer.create()){for(let n of e.filters)Co.encode(n,t.uint32(10).fork()).ldelim();return e.handlerId!==0&&t.uint32(16).int32(e.handlerId),e.fetchConfig!==void 0&&ut.encode(e.fetchConfig,t.uint32(26).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Sx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.filters.push(Co.decode(n,n.uint32()));continue;case 2:if(a!==16)break;i.handlerId=n.int32();continue;case 3:if(a!==26)break;i.fetchConfig=ut.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{filters:globalThis.Array.isArray(e?.filters)?e.filters.map(t=>Co.fromJSON(t)):[],handlerId:S(e.handlerId)?globalThis.Number(e.handlerId):0,fetchConfig:S(e.fetchConfig)?ut.fromJSON(e.fetchConfig):void 0}},toJSON(e){let t={};return e.filters?.length&&(t.filters=e.filters.map(n=>Co.toJSON(n))),e.handlerId!==0&&(t.handlerId=Math.round(e.handlerId)),e.fetchConfig!==void 0&&(t.fetchConfig=ut.toJSON(e.fetchConfig)),t},create(e){return gr.fromPartial(e??{})},fromPartial(e){let t=Sx();return t.filters=e.filters?.map(n=>Co.fromPartial(n))||[],t.handlerId=e.handlerId??0,t.fetchConfig=e.fetchConfig!==void 0&&e.fetchConfig!==null?ut.fromPartial(e.fetchConfig):void 0,t}};function xx(){return{filters:[],handlerId:0}}var vo={encode(e,t=g.default.Writer.create()){for(let n of e.filters)wo.encode(n,t.uint32(10).fork()).ldelim();return e.handlerId!==0&&t.uint32(16).int32(e.handlerId),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=xx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.filters.push(wo.decode(n,n.uint32()));continue;case 2:if(a!==16)break;i.handlerId=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{filters:globalThis.Array.isArray(e?.filters)?e.filters.map(t=>wo.fromJSON(t)):[],handlerId:S(e.handlerId)?globalThis.Number(e.handlerId):0}},toJSON(e){let t={};return e.filters?.length&&(t.filters=e.filters.map(n=>wo.toJSON(n))),e.handlerId!==0&&(t.handlerId=Math.round(e.handlerId)),t},create(e){return vo.fromPartial(e??{})},fromPartial(e){let t=xx();return t.filters=e.filters?.map(n=>wo.fromPartial(n))||[],t.handlerId=e.handlerId??0,t}};function Tx(){return{assetId:void 0,fromAddress:void 0,toAddress:void 0}}var wo={encode(e,t=g.default.Writer.create()){return e.assetId!==void 0&&t.uint32(10).string(e.assetId),e.fromAddress!==void 0&&t.uint32(18).string(e.fromAddress),e.toAddress!==void 0&&t.uint32(26).string(e.toAddress),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Tx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.assetId=n.string();continue;case 2:if(a!==18)break;i.fromAddress=n.string();continue;case 3:if(a!==26)break;i.toAddress=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{assetId:S(e.assetId)?globalThis.String(e.assetId):void 0,fromAddress:S(e.fromAddress)?globalThis.String(e.fromAddress):void 0,toAddress:S(e.toAddress)?globalThis.String(e.toAddress):void 0}},toJSON(e){let t={};return e.assetId!==void 0&&(t.assetId=e.assetId),e.fromAddress!==void 0&&(t.fromAddress=e.fromAddress),e.toAddress!==void 0&&(t.toAddress=e.toAddress),t},create(e){return wo.fromPartial(e??{})},fromPartial(e){let t=Tx();return t.assetId=e.assetId??void 0,t.fromAddress=e.fromAddress??void 0,t.toAddress=e.toAddress??void 0,t}};function Nx(){return{logIds:[],handlerId:0}}var bo={encode(e,t=g.default.Writer.create()){for(let n of e.logIds)t.uint32(10).string(n);return e.handlerId!==0&&t.uint32(16).int32(e.handlerId),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Nx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.logIds.push(n.string());continue;case 2:if(a!==16)break;i.handlerId=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{logIds:globalThis.Array.isArray(e?.logIds)?e.logIds.map(t=>globalThis.String(t)):[],handlerId:S(e.handlerId)?globalThis.Number(e.handlerId):0}},toJSON(e){let t={};return e.logIds?.length&&(t.logIds=e.logIds),e.handlerId!==0&&(t.handlerId=Math.round(e.handlerId)),t},create(e){return bo.fromPartial(e??{})},fromPartial(e){let t=Nx();return t.logIds=e.logIds?.map(n=>n)||[],t.handlerId=e.handlerId??0,t}};function Rx(){return{logFilters:[],handlerId:0}}var Eo={encode(e,t=g.default.Writer.create()){for(let n of e.logFilters)t.uint32(10).string(n);return e.handlerId!==0&&t.uint32(16).int32(e.handlerId),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Rx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.logFilters.push(n.string());continue;case 2:if(a!==16)break;i.handlerId=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{logFilters:globalThis.Array.isArray(e?.logFilters)?e.logFilters.map(t=>globalThis.String(t)):[],handlerId:S(e.handlerId)?globalThis.Number(e.handlerId):0}},toJSON(e){let t={};return e.logFilters?.length&&(t.logFilters=e.logFilters),e.handlerId!==0&&(t.handlerId=Math.round(e.handlerId)),t},create(e){return Eo.fromPartial(e??{})},fromPartial(e){let t=Rx();return t.logFilters=e.logFilters?.map(n=>n)||[],t.handlerId=e.handlerId??0,t}};function Bx(){return{topics:[],address:void 0,addressType:void 0}}var Co={encode(e,t=g.default.Writer.create()){for(let n of e.topics)Qo.encode(n,t.uint32(10).fork()).ldelim();return e.address!==void 0&&t.uint32(18).string(e.address),e.addressType!==void 0&&t.uint32(24).int32(e.addressType),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Bx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.topics.push(Qo.decode(n,n.uint32()));continue;case 2:if(a!==18)break;i.address=n.string();continue;case 3:if(a!==24)break;i.addressType=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{topics:globalThis.Array.isArray(e?.topics)?e.topics.map(t=>Qo.fromJSON(t)):[],address:S(e.address)?globalThis.String(e.address):void 0,addressType:S(e.addressType)?uq(e.addressType):void 0}},toJSON(e){let t={};return e.topics?.length&&(t.topics=e.topics.map(n=>Qo.toJSON(n))),e.address!==void 0&&(t.address=e.address),e.addressType!==void 0&&(t.addressType=lq(e.addressType)),t},create(e){return Co.fromPartial(e??{})},fromPartial(e){let t=Bx();return t.topics=e.topics?.map(n=>Qo.fromPartial(n))||[],t.address=e.address??void 0,t.addressType=e.addressType??void 0,t}};function kx(){return{innerInstruction:!1,parsedInstruction:!1,rawDataInstruction:!1}}var Io={encode(e,t=g.default.Writer.create()){return e.innerInstruction!==!1&&t.uint32(8).bool(e.innerInstruction),e.parsedInstruction!==!1&&t.uint32(16).bool(e.parsedInstruction),e.rawDataInstruction!==!1&&t.uint32(24).bool(e.rawDataInstruction),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=kx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.innerInstruction=n.bool();continue;case 2:if(a!==16)break;i.parsedInstruction=n.bool();continue;case 3:if(a!==24)break;i.rawDataInstruction=n.bool();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{innerInstruction:S(e.innerInstruction)?globalThis.Boolean(e.innerInstruction):!1,parsedInstruction:S(e.parsedInstruction)?globalThis.Boolean(e.parsedInstruction):!1,rawDataInstruction:S(e.rawDataInstruction)?globalThis.Boolean(e.rawDataInstruction):!1}},toJSON(e){let t={};return e.innerInstruction!==!1&&(t.innerInstruction=e.innerInstruction),e.parsedInstruction!==!1&&(t.parsedInstruction=e.parsedInstruction),e.rawDataInstruction!==!1&&(t.rawDataInstruction=e.rawDataInstruction),t},create(e){return Io.fromPartial(e??{})},fromPartial(e){let t=kx();return t.innerInstruction=e.innerInstruction??!1,t.parsedInstruction=e.parsedInstruction??!1,t.rawDataInstruction=e.rawDataInstruction??!1,t}};function Ox(){return{moveTypePrefix:""}}var So={encode(e,t=g.default.Writer.create()){return e.moveTypePrefix!==""&&t.uint32(10).string(e.moveTypePrefix),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Ox();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.moveTypePrefix=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{moveTypePrefix:S(e.moveTypePrefix)?globalThis.String(e.moveTypePrefix):""}},toJSON(e){let t={};return e.moveTypePrefix!==""&&(t.moveTypePrefix=e.moveTypePrefix),t},create(e){return So.fromPartial(e??{})},fromPartial(e){let t=Ox();return t.moveTypePrefix=e.moveTypePrefix??"",t}};function Px(){return{resourceChanges:!1,allEvents:!1,inputs:!1,resourceConfig:void 0}}var _r={encode(e,t=g.default.Writer.create()){return e.resourceChanges!==!1&&t.uint32(8).bool(e.resourceChanges),e.allEvents!==!1&&t.uint32(16).bool(e.allEvents),e.inputs!==!1&&t.uint32(32).bool(e.inputs),e.resourceConfig!==void 0&&So.encode(e.resourceConfig,t.uint32(26).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Px();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.resourceChanges=n.bool();continue;case 2:if(a!==16)break;i.allEvents=n.bool();continue;case 4:if(a!==32)break;i.inputs=n.bool();continue;case 3:if(a!==26)break;i.resourceConfig=So.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{resourceChanges:S(e.resourceChanges)?globalThis.Boolean(e.resourceChanges):!1,allEvents:S(e.allEvents)?globalThis.Boolean(e.allEvents):!1,inputs:S(e.inputs)?globalThis.Boolean(e.inputs):!1,resourceConfig:S(e.resourceConfig)?So.fromJSON(e.resourceConfig):void 0}},toJSON(e){let t={};return e.resourceChanges!==!1&&(t.resourceChanges=e.resourceChanges),e.allEvents!==!1&&(t.allEvents=e.allEvents),e.inputs!==!1&&(t.inputs=e.inputs),e.resourceConfig!==void 0&&(t.resourceConfig=So.toJSON(e.resourceConfig)),t},create(e){return _r.fromPartial(e??{})},fromPartial(e){let t=Px();return t.resourceChanges=e.resourceChanges??!1,t.allEvents=e.allEvents??!1,t.inputs=e.inputs??!1,t.resourceConfig=e.resourceConfig!==void 0&&e.resourceConfig!==null?So.fromPartial(e.resourceConfig):void 0,t}};function Dx(){return{owned:!1}}var xo={encode(e,t=g.default.Writer.create()){return e.owned!==!1&&t.uint32(8).bool(e.owned),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Dx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.owned=n.bool();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{owned:S(e.owned)?globalThis.Boolean(e.owned):!1}},toJSON(e){let t={};return e.owned!==!1&&(t.owned=e.owned),t},create(e){return xo.fromPartial(e??{})},fromPartial(e){let t=Dx();return t.owned=e.owned??!1,t}};function Mx(){return{filters:[],handlerId:0,fetchConfig:void 0}}var To={encode(e,t=g.default.Writer.create()){for(let n of e.filters)No.encode(n,t.uint32(10).fork()).ldelim();return e.handlerId!==0&&t.uint32(16).int32(e.handlerId),e.fetchConfig!==void 0&&_r.encode(e.fetchConfig,t.uint32(26).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Mx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.filters.push(No.decode(n,n.uint32()));continue;case 2:if(a!==16)break;i.handlerId=n.int32();continue;case 3:if(a!==26)break;i.fetchConfig=_r.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{filters:globalThis.Array.isArray(e?.filters)?e.filters.map(t=>No.fromJSON(t)):[],handlerId:S(e.handlerId)?globalThis.Number(e.handlerId):0,fetchConfig:S(e.fetchConfig)?_r.fromJSON(e.fetchConfig):void 0}},toJSON(e){let t={};return e.filters?.length&&(t.filters=e.filters.map(n=>No.toJSON(n))),e.handlerId!==0&&(t.handlerId=Math.round(e.handlerId)),e.fetchConfig!==void 0&&(t.fetchConfig=_r.toJSON(e.fetchConfig)),t},create(e){return To.fromPartial(e??{})},fromPartial(e){let t=Mx();return t.filters=e.filters?.map(n=>No.fromPartial(n))||[],t.handlerId=e.handlerId??0,t.fetchConfig=e.fetchConfig!==void 0&&e.fetchConfig!==null?_r.fromPartial(e.fetchConfig):void 0,t}};function Fx(){return{type:"",account:""}}var No={encode(e,t=g.default.Writer.create()){return e.type!==""&&t.uint32(10).string(e.type),e.account!==""&&t.uint32(18).string(e.account),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Fx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.type=n.string();continue;case 2:if(a!==18)break;i.account=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{type:S(e.type)?globalThis.String(e.type):"",account:S(e.account)?globalThis.String(e.account):""}},toJSON(e){let t={};return e.type!==""&&(t.type=e.type),e.account!==""&&(t.account=e.account),t},create(e){return No.fromPartial(e??{})},fromPartial(e){let t=Fx();return t.type=e.type??"",t.account=e.account??"",t}};function Lx(){return{filters:[],handlerId:0,fetchConfig:void 0}}var Ar={encode(e,t=g.default.Writer.create()){for(let n of e.filters)Bo.encode(n,t.uint32(10).fork()).ldelim();return e.handlerId!==0&&t.uint32(16).int32(e.handlerId),e.fetchConfig!==void 0&&_r.encode(e.fetchConfig,t.uint32(26).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Lx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.filters.push(Bo.decode(n,n.uint32()));continue;case 2:if(a!==16)break;i.handlerId=n.int32();continue;case 3:if(a!==26)break;i.fetchConfig=_r.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{filters:globalThis.Array.isArray(e?.filters)?e.filters.map(t=>Bo.fromJSON(t)):[],handlerId:S(e.handlerId)?globalThis.Number(e.handlerId):0,fetchConfig:S(e.fetchConfig)?_r.fromJSON(e.fetchConfig):void 0}},toJSON(e){let t={};return e.filters?.length&&(t.filters=e.filters.map(n=>Bo.toJSON(n))),e.handlerId!==0&&(t.handlerId=Math.round(e.handlerId)),e.fetchConfig!==void 0&&(t.fetchConfig=_r.toJSON(e.fetchConfig)),t},create(e){return Ar.fromPartial(e??{})},fromPartial(e){let t=Lx();return t.filters=e.filters?.map(n=>Bo.fromPartial(n))||[],t.handlerId=e.handlerId??0,t.fetchConfig=e.fetchConfig!==void 0&&e.fetchConfig!==null?_r.fromPartial(e.fetchConfig):void 0,t}};function Qx(){return{type:"",handlerId:0}}var Ro={encode(e,t=g.default.Writer.create()){return e.type!==""&&t.uint32(10).string(e.type),e.handlerId!==0&&t.uint32(16).int32(e.handlerId),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Qx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.type=n.string();continue;case 2:if(a!==16)break;i.handlerId=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{type:S(e.type)?globalThis.String(e.type):"",handlerId:S(e.handlerId)?globalThis.Number(e.handlerId):0}},toJSON(e){let t={};return e.type!==""&&(t.type=e.type),e.handlerId!==0&&(t.handlerId=Math.round(e.handlerId)),t},create(e){return Ro.fromPartial(e??{})},fromPartial(e){let t=Qx();return t.type=e.type??"",t.handlerId=e.handlerId??0,t}};function Ux(){return{function:"",typeArguments:[],withTypeArguments:!1,includeFailed:!1,publicKeyPrefix:"",fromAndToAddress:void 0}}var Bo={encode(e,t=g.default.Writer.create()){e.function!==""&&t.uint32(10).string(e.function);for(let n of e.typeArguments)t.uint32(18).string(n);return e.withTypeArguments!==!1&&t.uint32(24).bool(e.withTypeArguments),e.includeFailed!==!1&&t.uint32(32).bool(e.includeFailed),e.publicKeyPrefix!==""&&t.uint32(42).string(e.publicKeyPrefix),e.fromAndToAddress!==void 0&&ko.encode(e.fromAndToAddress,t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Ux();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.function=n.string();continue;case 2:if(a!==18)break;i.typeArguments.push(n.string());continue;case 3:if(a!==24)break;i.withTypeArguments=n.bool();continue;case 4:if(a!==32)break;i.includeFailed=n.bool();continue;case 5:if(a!==42)break;i.publicKeyPrefix=n.string();continue;case 6:if(a!==50)break;i.fromAndToAddress=ko.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{function:S(e.function)?globalThis.String(e.function):"",typeArguments:globalThis.Array.isArray(e?.typeArguments)?e.typeArguments.map(t=>globalThis.String(t)):[],withTypeArguments:S(e.withTypeArguments)?globalThis.Boolean(e.withTypeArguments):!1,includeFailed:S(e.includeFailed)?globalThis.Boolean(e.includeFailed):!1,publicKeyPrefix:S(e.publicKeyPrefix)?globalThis.String(e.publicKeyPrefix):"",fromAndToAddress:S(e.fromAndToAddress)?ko.fromJSON(e.fromAndToAddress):void 0}},toJSON(e){let t={};return e.function!==""&&(t.function=e.function),e.typeArguments?.length&&(t.typeArguments=e.typeArguments),e.withTypeArguments!==!1&&(t.withTypeArguments=e.withTypeArguments),e.includeFailed!==!1&&(t.includeFailed=e.includeFailed),e.publicKeyPrefix!==""&&(t.publicKeyPrefix=e.publicKeyPrefix),e.fromAndToAddress!==void 0&&(t.fromAndToAddress=ko.toJSON(e.fromAndToAddress)),t},create(e){return Bo.fromPartial(e??{})},fromPartial(e){let t=Ux();return t.function=e.function??"",t.typeArguments=e.typeArguments?.map(n=>n)||[],t.withTypeArguments=e.withTypeArguments??!1,t.includeFailed=e.includeFailed??!1,t.publicKeyPrefix=e.publicKeyPrefix??"",t.fromAndToAddress=e.fromAndToAddress!==void 0&&e.fromAndToAddress!==null?ko.fromPartial(e.fromAndToAddress):void 0,t}};function qx(){return{from:"",to:""}}var ko={encode(e,t=g.default.Writer.create()){return e.from!==""&&t.uint32(10).string(e.from),e.to!==""&&t.uint32(18).string(e.to),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=qx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.from=n.string();continue;case 2:if(a!==18)break;i.to=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{from:S(e.from)?globalThis.String(e.from):"",to:S(e.to)?globalThis.String(e.to):""}},toJSON(e){let t={};return e.from!==""&&(t.from=e.from),e.to!==""&&(t.to=e.to),t},create(e){return ko.fromPartial(e??{})},fromPartial(e){let t=qx();return t.from=e.from??"",t.to=e.to??"",t}};function Jx(){return{filters:[],handlerId:0}}var Oo={encode(e,t=g.default.Writer.create()){for(let n of e.filters)Mo.encode(n,t.uint32(10).fork()).ldelim();return e.handlerId!==0&&t.uint32(16).int32(e.handlerId),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Jx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.filters.push(Mo.decode(n,n.uint32()));continue;case 2:if(a!==16)break;i.handlerId=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{filters:globalThis.Array.isArray(e?.filters)?e.filters.map(t=>Mo.fromJSON(t)):[],handlerId:S(e.handlerId)?globalThis.Number(e.handlerId):0}},toJSON(e){let t={};return e.filters?.length&&(t.filters=e.filters.map(n=>Mo.toJSON(n))),e.handlerId!==0&&(t.handlerId=Math.round(e.handlerId)),t},create(e){return Oo.fromPartial(e??{})},fromPartial(e){let t=Jx();return t.filters=e.filters?.map(n=>Mo.fromPartial(n))||[],t.handlerId=e.handlerId??0,t}};function zx(){return{filters:[],handlerId:0}}var Po={encode(e,t=g.default.Writer.create()){for(let n of e.filters)Do.encode(n,t.uint32(10).fork()).ldelim();return e.handlerId!==0&&t.uint32(16).int32(e.handlerId),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=zx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.filters.push(Do.decode(n,n.uint32()));continue;case 2:if(a!==16)break;i.handlerId=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{filters:globalThis.Array.isArray(e?.filters)?e.filters.map(t=>Do.fromJSON(t)):[],handlerId:S(e.handlerId)?globalThis.Number(e.handlerId):0}},toJSON(e){let t={};return e.filters?.length&&(t.filters=e.filters.map(n=>Do.toJSON(n))),e.handlerId!==0&&(t.handlerId=Math.round(e.handlerId)),t},create(e){return Po.fromPartial(e??{})},fromPartial(e){let t=zx();return t.filters=e.filters?.map(n=>Do.fromPartial(n))||[],t.handlerId=e.handlerId??0,t}};function Vx(){return{address:""}}var Do={encode(e,t=g.default.Writer.create()){return e.address!==""&&t.uint32(10).string(e.address),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Vx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.address=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{address:S(e.address)?globalThis.String(e.address):""}},toJSON(e){let t={};return e.address!==""&&(t.address=e.address),t},create(e){return Do.fromPartial(e??{})},fromPartial(e){let t=Vx();return t.address=e.address??"",t}};function Gx(){return{address:"",keys:[]}}var Mo={encode(e,t=g.default.Writer.create()){e.address!==""&&t.uint32(10).string(e.address);for(let n of e.keys)t.uint32(18).string(n);return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Gx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.address=n.string();continue;case 2:if(a!==18)break;i.keys.push(n.string());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{address:S(e.address)?globalThis.String(e.address):"",keys:globalThis.Array.isArray(e?.keys)?e.keys.map(t=>globalThis.String(t)):[]}},toJSON(e){let t={};return e.address!==""&&(t.address=e.address),e.keys?.length&&(t.keys=e.keys),t},create(e){return Mo.fromPartial(e??{})},fromPartial(e){let t=Gx();return t.address=e.address??"",t.keys=e.keys?.map(n=>n)||[],t}};function Wx(){return{function:"",includeFailed:!1}}var Fo={encode(e,t=g.default.Writer.create()){return e.function!==""&&t.uint32(10).string(e.function),e.includeFailed!==!1&&t.uint32(16).bool(e.includeFailed),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Wx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.function=n.string();continue;case 2:if(a!==16)break;i.includeFailed=n.bool();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{function:S(e.function)?globalThis.String(e.function):"",includeFailed:S(e.includeFailed)?globalThis.Boolean(e.includeFailed):!1}},toJSON(e){let t={};return e.function!==""&&(t.function=e.function),e.includeFailed!==!1&&(t.includeFailed=e.includeFailed),t},create(e){return Fo.fromPartial(e??{})},fromPartial(e){let t=Wx();return t.function=e.function??"",t.includeFailed=e.includeFailed??!1,t}};function Hx(){return{filters:[],handlerId:0}}var Lo={encode(e,t=g.default.Writer.create()){for(let n of e.filters)Fo.encode(n,t.uint32(10).fork()).ldelim();return e.handlerId!==0&&t.uint32(16).int32(e.handlerId),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Hx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.filters.push(Fo.decode(n,n.uint32()));continue;case 2:if(a!==16)break;i.handlerId=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{filters:globalThis.Array.isArray(e?.filters)?e.filters.map(t=>Fo.fromJSON(t)):[],handlerId:S(e.handlerId)?globalThis.Number(e.handlerId):0}},toJSON(e){let t={};return e.filters?.length&&(t.filters=e.filters.map(n=>Fo.toJSON(n))),e.handlerId!==0&&(t.handlerId=Math.round(e.handlerId)),t},create(e){return Lo.fromPartial(e??{})},fromPartial(e){let t=Hx();return t.filters=e.filters?.map(n=>Fo.fromPartial(n))||[],t.handlerId=e.handlerId??0,t}};function Zx(){return{hashes:[]}}var Qo={encode(e,t=g.default.Writer.create()){for(let n of e.hashes)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Zx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.hashes.push(n.string());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{hashes:globalThis.Array.isArray(e?.hashes)?e.hashes.map(t=>globalThis.String(t)):[]}},toJSON(e){let t={};return e.hashes?.length&&(t.hashes=e.hashes),t},create(e){return Qo.fromPartial(e??{})},fromPartial(e){let t=Zx();return t.hashes=e.hashes?.map(n=>n)||[],t}};function Xx(){return{bindings:[]}}var XT={encode(e,t=g.default.Writer.create()){for(let n of e.bindings)Vt.encode(n,t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Xx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.bindings.push(Vt.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{bindings:globalThis.Array.isArray(e?.bindings)?e.bindings.map(t=>Vt.fromJSON(t)):[]}},toJSON(e){let t={};return e.bindings?.length&&(t.bindings=e.bindings.map(n=>Vt.toJSON(n))),t},create(e){return XT.fromPartial(e??{})},fromPartial(e){let t=Xx();return t.bindings=e.bindings?.map(n=>Vt.fromPartial(n))||[],t}};function Yx(){return{result:void 0}}var YT={encode(e,t=g.default.Writer.create()){return e.result!==void 0&&vn.encode(e.result,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Yx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.result=vn.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{result:S(e.result)?vn.fromJSON(e.result):void 0}},toJSON(e){let t={};return e.result!==void 0&&(t.result=vn.toJSON(e.result)),t},create(e){return YT.fromPartial(e??{})},fromPartial(e){let t=Yx();return t.result=e.result!==void 0&&e.result!==null?vn.fromPartial(e.result):void 0,t}};function $x(){return{processId:0,binding:void 0,dbResult:void 0}}var $T={encode(e,t=g.default.Writer.create()){return e.processId!==0&&t.uint32(8).int32(e.processId),e.binding!==void 0&&Vt.encode(e.binding,t.uint32(18).fork()).ldelim(),e.dbResult!==void 0&&yr.encode(e.dbResult,t.uint32(26).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=$x();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.processId=n.int32();continue;case 2:if(a!==18)break;i.binding=Vt.decode(n,n.uint32());continue;case 3:if(a!==26)break;i.dbResult=yr.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{processId:S(e.processId)?globalThis.Number(e.processId):0,binding:S(e.binding)?Vt.fromJSON(e.binding):void 0,dbResult:S(e.dbResult)?yr.fromJSON(e.dbResult):void 0}},toJSON(e){let t={};return e.processId!==0&&(t.processId=Math.round(e.processId)),e.binding!==void 0&&(t.binding=Vt.toJSON(e.binding)),e.dbResult!==void 0&&(t.dbResult=yr.toJSON(e.dbResult)),t},create(e){return $T.fromPartial(e??{})},fromPartial(e){let t=$x();return t.processId=e.processId??0,t.binding=e.binding!==void 0&&e.binding!==null?Vt.fromPartial(e.binding):void 0,t.dbResult=e.dbResult!==void 0&&e.dbResult!==null?yr.fromPartial(e.dbResult):void 0,t}};function Kx(){return{processId:0,dbRequest:void 0,result:void 0}}var KT={encode(e,t=g.default.Writer.create()){return e.processId!==0&&t.uint32(8).int32(e.processId),e.dbRequest!==void 0&&vr.encode(e.dbRequest,t.uint32(18).fork()).ldelim(),e.result!==void 0&&vn.encode(e.result,t.uint32(26).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Kx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.processId=n.int32();continue;case 2:if(a!==18)break;i.dbRequest=vr.decode(n,n.uint32());continue;case 3:if(a!==26)break;i.result=vn.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{processId:S(e.processId)?globalThis.Number(e.processId):0,dbRequest:S(e.dbRequest)?vr.fromJSON(e.dbRequest):void 0,result:S(e.result)?vn.fromJSON(e.result):void 0}},toJSON(e){let t={};return e.processId!==0&&(t.processId=Math.round(e.processId)),e.dbRequest!==void 0&&(t.dbRequest=vr.toJSON(e.dbRequest)),e.result!==void 0&&(t.result=vn.toJSON(e.result)),t},create(e){return KT.fromPartial(e??{})},fromPartial(e){let t=Kx();return t.processId=e.processId??0,t.dbRequest=e.dbRequest!==void 0&&e.dbRequest!==null?vr.fromPartial(e.dbRequest):void 0,t.result=e.result!==void 0&&e.result!==null?vn.fromPartial(e.result):void 0,t}};function jx(){return{processId:0,bindings:void 0,dbResult:void 0}}var jT={encode(e,t=g.default.Writer.create()){return e.processId!==0&&t.uint32(8).int32(e.processId),e.bindings!==void 0&&Uo.encode(e.bindings,t.uint32(18).fork()).ldelim(),e.dbResult!==void 0&&yr.encode(e.dbResult,t.uint32(26).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=jx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.processId=n.int32();continue;case 2:if(a!==18)break;i.bindings=Uo.decode(n,n.uint32());continue;case 3:if(a!==26)break;i.dbResult=yr.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{processId:S(e.processId)?globalThis.Number(e.processId):0,bindings:S(e.bindings)?Uo.fromJSON(e.bindings):void 0,dbResult:S(e.dbResult)?yr.fromJSON(e.dbResult):void 0}},toJSON(e){let t={};return e.processId!==0&&(t.processId=Math.round(e.processId)),e.bindings!==void 0&&(t.bindings=Uo.toJSON(e.bindings)),e.dbResult!==void 0&&(t.dbResult=yr.toJSON(e.dbResult)),t},create(e){return jT.fromPartial(e??{})},fromPartial(e){let t=jx();return t.processId=e.processId??0,t.bindings=e.bindings!==void 0&&e.bindings!==null?Uo.fromPartial(e.bindings):void 0,t.dbResult=e.dbResult!==void 0&&e.dbResult!==null?yr.fromPartial(e.dbResult):void 0,t}};function eT(){return{bindings:[]}}var Uo={encode(e,t=g.default.Writer.create()){for(let n of e.bindings)Vt.encode(n,t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=eT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.bindings.push(Vt.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{bindings:globalThis.Array.isArray(e?.bindings)?e.bindings.map(t=>Vt.fromJSON(t)):[]}},toJSON(e){let t={};return e.bindings?.length&&(t.bindings=e.bindings.map(n=>Vt.toJSON(n))),t},create(e){return Uo.fromPartial(e??{})},fromPartial(e){let t=eT();return t.bindings=e.bindings?.map(n=>Vt.fromPartial(n))||[],t}};function tT(){return{processId:0,dbRequest:void 0}}var eN={encode(e,t=g.default.Writer.create()){return e.processId!==0&&t.uint32(8).int32(e.processId),e.dbRequest!==void 0&&vr.encode(e.dbRequest,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=tT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.processId=n.int32();continue;case 2:if(a!==18)break;i.dbRequest=vr.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{processId:S(e.processId)?globalThis.Number(e.processId):0,dbRequest:S(e.dbRequest)?vr.fromJSON(e.dbRequest):void 0}},toJSON(e){let t={};return e.processId!==0&&(t.processId=Math.round(e.processId)),e.dbRequest!==void 0&&(t.dbRequest=vr.toJSON(e.dbRequest)),t},create(e){return eN.fromPartial(e??{})},fromPartial(e){let t=tT();return t.processId=e.processId??0,t.dbRequest=e.dbRequest!==void 0&&e.dbRequest!==null?vr.fromPartial(e.dbRequest):void 0,t}};function nT(){return{opId:BigInt("0"),data:void 0,list:void 0,error:void 0,entities:void 0,entityList:void 0,nextCursor:void 0}}var yr={encode(e,t=g.default.Writer.create()){if(e.opId!==BigInt("0")){if(BigInt.asUintN(64,e.opId)!==e.opId)throw new globalThis.Error("value provided for field message.opId of type uint64 too large");t.uint32(8).uint64(e.opId.toString())}return e.data!==void 0&&M.encode(M.wrap(e.data),t.uint32(18).fork()).ldelim(),e.list!==void 0&&Jr.encode(Jr.wrap(e.list),t.uint32(34).fork()).ldelim(),e.error!==void 0&&t.uint32(26).string(e.error),e.entities!==void 0&&Gi.encode(e.entities,t.uint32(50).fork()).ldelim(),e.entityList!==void 0&&Jo.encode(e.entityList,t.uint32(58).fork()).ldelim(),e.nextCursor!==void 0&&t.uint32(42).string(e.nextCursor),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=nT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.opId=Gt(n.uint64());continue;case 2:if(a!==18)break;i.data=M.unwrap(M.decode(n,n.uint32()));continue;case 4:if(a!==34)break;i.list=Jr.unwrap(Jr.decode(n,n.uint32()));continue;case 3:if(a!==26)break;i.error=n.string();continue;case 6:if(a!==50)break;i.entities=Gi.decode(n,n.uint32());continue;case 7:if(a!==58)break;i.entityList=Jo.decode(n,n.uint32());continue;case 5:if(a!==42)break;i.nextCursor=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{opId:S(e.opId)?BigInt(e.opId):BigInt("0"),data:Ve(e.data)?e.data:void 0,list:globalThis.Array.isArray(e.list)?[...e.list]:void 0,error:S(e.error)?globalThis.String(e.error):void 0,entities:S(e.entities)?Gi.fromJSON(e.entities):void 0,entityList:S(e.entityList)?Jo.fromJSON(e.entityList):void 0,nextCursor:S(e.nextCursor)?globalThis.String(e.nextCursor):void 0}},toJSON(e){let t={};return e.opId!==BigInt("0")&&(t.opId=e.opId.toString()),e.data!==void 0&&(t.data=e.data),e.list!==void 0&&(t.list=e.list),e.error!==void 0&&(t.error=e.error),e.entities!==void 0&&(t.entities=Gi.toJSON(e.entities)),e.entityList!==void 0&&(t.entityList=Jo.toJSON(e.entityList)),e.nextCursor!==void 0&&(t.nextCursor=e.nextCursor),t},create(e){return yr.fromPartial(e??{})},fromPartial(e){let t=nT();return t.opId=e.opId??BigInt("0"),t.data=e.data??void 0,t.list=e.list??void 0,t.error=e.error??void 0,t.entities=e.entities!==void 0&&e.entities!==null?Gi.fromPartial(e.entities):void 0,t.entityList=e.entityList!==void 0&&e.entityList!==null?Jo.fromPartial(e.entityList):void 0,t.nextCursor=e.nextCursor??void 0,t}};function rT(){return{entity:"",genBlockNumber:BigInt("0"),genBlockChain:"",genBlockTime:void 0,data:void 0}}var qo={encode(e,t=g.default.Writer.create()){if(e.entity!==""&&t.uint32(10).string(e.entity),e.genBlockNumber!==BigInt("0")){if(BigInt.asUintN(64,e.genBlockNumber)!==e.genBlockNumber)throw new globalThis.Error("value provided for field message.genBlockNumber of type uint64 too large");t.uint32(16).uint64(e.genBlockNumber.toString())}return e.genBlockChain!==""&&t.uint32(26).string(e.genBlockChain),e.genBlockTime!==void 0&&Me.encode(Ln(e.genBlockTime),t.uint32(34).fork()).ldelim(),e.data!==void 0&&tt.encode(e.data,t.uint32(42).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=rT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.entity=n.string();continue;case 2:if(a!==16)break;i.genBlockNumber=Gt(n.uint64());continue;case 3:if(a!==26)break;i.genBlockChain=n.string();continue;case 4:if(a!==34)break;i.genBlockTime=wn(Me.decode(n,n.uint32()));continue;case 5:if(a!==42)break;i.data=tt.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{entity:S(e.entity)?globalThis.String(e.entity):"",genBlockNumber:S(e.genBlockNumber)?BigInt(e.genBlockNumber):BigInt("0"),genBlockChain:S(e.genBlockChain)?globalThis.String(e.genBlockChain):"",genBlockTime:S(e.genBlockTime)?Qn(e.genBlockTime):void 0,data:S(e.data)?tt.fromJSON(e.data):void 0}},toJSON(e){let t={};return e.entity!==""&&(t.entity=e.entity),e.genBlockNumber!==BigInt("0")&&(t.genBlockNumber=e.genBlockNumber.toString()),e.genBlockChain!==""&&(t.genBlockChain=e.genBlockChain),e.genBlockTime!==void 0&&(t.genBlockTime=e.genBlockTime.toISOString()),e.data!==void 0&&(t.data=tt.toJSON(e.data)),t},create(e){return qo.fromPartial(e??{})},fromPartial(e){let t=rT();return t.entity=e.entity??"",t.genBlockNumber=e.genBlockNumber??BigInt("0"),t.genBlockChain=e.genBlockChain??"",t.genBlockTime=e.genBlockTime??void 0,t.data=e.data!==void 0&&e.data!==null?tt.fromPartial(e.data):void 0,t}};function iT(){return{entities:[]}}var Jo={encode(e,t=g.default.Writer.create()){for(let n of e.entities)qo.encode(n,t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=iT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.entities.push(qo.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{entities:globalThis.Array.isArray(e?.entities)?e.entities.map(t=>qo.fromJSON(t)):[]}},toJSON(e){let t={};return e.entities?.length&&(t.entities=e.entities.map(n=>qo.toJSON(n))),t},create(e){return Jo.fromPartial(e??{})},fromPartial(e){let t=iT();return t.entities=e.entities?.map(n=>qo.fromPartial(n))||[],t}};function aT(){return{opId:BigInt("0"),get:void 0,upsert:void 0,delete:void 0,list:void 0}}var vr={encode(e,t=g.default.Writer.create()){if(e.opId!==BigInt("0")){if(BigInt.asUintN(64,e.opId)!==e.opId)throw new globalThis.Error("value provided for field message.opId of type uint64 too large");t.uint32(8).uint64(e.opId.toString())}return e.get!==void 0&&zo.encode(e.get,t.uint32(18).fork()).ldelim(),e.upsert!==void 0&&Go.encode(e.upsert,t.uint32(26).fork()).ldelim(),e.delete!==void 0&&Wo.encode(e.delete,t.uint32(34).fork()).ldelim(),e.list!==void 0&&Vo.encode(e.list,t.uint32(42).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=aT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.opId=Gt(n.uint64());continue;case 2:if(a!==18)break;i.get=zo.decode(n,n.uint32());continue;case 3:if(a!==26)break;i.upsert=Go.decode(n,n.uint32());continue;case 4:if(a!==34)break;i.delete=Wo.decode(n,n.uint32());continue;case 5:if(a!==42)break;i.list=Vo.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{opId:S(e.opId)?BigInt(e.opId):BigInt("0"),get:S(e.get)?zo.fromJSON(e.get):void 0,upsert:S(e.upsert)?Go.fromJSON(e.upsert):void 0,delete:S(e.delete)?Wo.fromJSON(e.delete):void 0,list:S(e.list)?Vo.fromJSON(e.list):void 0}},toJSON(e){let t={};return e.opId!==BigInt("0")&&(t.opId=e.opId.toString()),e.get!==void 0&&(t.get=zo.toJSON(e.get)),e.upsert!==void 0&&(t.upsert=Go.toJSON(e.upsert)),e.delete!==void 0&&(t.delete=Wo.toJSON(e.delete)),e.list!==void 0&&(t.list=Vo.toJSON(e.list)),t},create(e){return vr.fromPartial(e??{})},fromPartial(e){let t=aT();return t.opId=e.opId??BigInt("0"),t.get=e.get!==void 0&&e.get!==null?zo.fromPartial(e.get):void 0,t.upsert=e.upsert!==void 0&&e.upsert!==null?Go.fromPartial(e.upsert):void 0,t.delete=e.delete!==void 0&&e.delete!==null?Wo.fromPartial(e.delete):void 0,t.list=e.list!==void 0&&e.list!==null?Vo.fromPartial(e.list):void 0,t}};function sT(){return{entity:"",id:""}}var zo={encode(e,t=g.default.Writer.create()){return e.entity!==""&&t.uint32(10).string(e.entity),e.id!==""&&t.uint32(18).string(e.id),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=sT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.entity=n.string();continue;case 2:if(a!==18)break;i.id=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{entity:S(e.entity)?globalThis.String(e.entity):"",id:S(e.id)?globalThis.String(e.id):""}},toJSON(e){let t={};return e.entity!==""&&(t.entity=e.entity),e.id!==""&&(t.id=e.id),t},create(e){return zo.fromPartial(e??{})},fromPartial(e){let t=sT();return t.entity=e.entity??"",t.id=e.id??"",t}};function oT(){return{entity:"",filters:[],cursor:"",pageSize:void 0}}var Vo={encode(e,t=g.default.Writer.create()){e.entity!==""&&t.uint32(10).string(e.entity);for(let n of e.filters)Ho.encode(n,t.uint32(34).fork()).ldelim();return e.cursor!==""&&t.uint32(42).string(e.cursor),e.pageSize!==void 0&&t.uint32(48).uint32(e.pageSize),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=oT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.entity=n.string();continue;case 4:if(a!==34)break;i.filters.push(Ho.decode(n,n.uint32()));continue;case 5:if(a!==42)break;i.cursor=n.string();continue;case 6:if(a!==48)break;i.pageSize=n.uint32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{entity:S(e.entity)?globalThis.String(e.entity):"",filters:globalThis.Array.isArray(e?.filters)?e.filters.map(t=>Ho.fromJSON(t)):[],cursor:S(e.cursor)?globalThis.String(e.cursor):"",pageSize:S(e.pageSize)?globalThis.Number(e.pageSize):void 0}},toJSON(e){let t={};return e.entity!==""&&(t.entity=e.entity),e.filters?.length&&(t.filters=e.filters.map(n=>Ho.toJSON(n))),e.cursor!==""&&(t.cursor=e.cursor),e.pageSize!==void 0&&(t.pageSize=Math.round(e.pageSize)),t},create(e){return Vo.fromPartial(e??{})},fromPartial(e){let t=oT();return t.entity=e.entity??"",t.filters=e.filters?.map(n=>Ho.fromPartial(n))||[],t.cursor=e.cursor??"",t.pageSize=e.pageSize??void 0,t}};function cT(){return{entity:[],id:[],data:[],entityData:[]}}var Go={encode(e,t=g.default.Writer.create()){for(let n of e.entity)t.uint32(10).string(n);for(let n of e.id)t.uint32(18).string(n);for(let n of e.data)M.encode(M.wrap(n),t.uint32(26).fork()).ldelim();for(let n of e.entityData)tt.encode(n,t.uint32(34).fork()).ldelim();return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=cT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.entity.push(n.string());continue;case 2:if(a!==18)break;i.id.push(n.string());continue;case 3:if(a!==26)break;i.data.push(M.unwrap(M.decode(n,n.uint32())));continue;case 4:if(a!==34)break;i.entityData.push(tt.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{entity:globalThis.Array.isArray(e?.entity)?e.entity.map(t=>globalThis.String(t)):[],id:globalThis.Array.isArray(e?.id)?e.id.map(t=>globalThis.String(t)):[],data:globalThis.Array.isArray(e?.data)?[...e.data]:[],entityData:globalThis.Array.isArray(e?.entityData)?e.entityData.map(t=>tt.fromJSON(t)):[]}},toJSON(e){let t={};return e.entity?.length&&(t.entity=e.entity),e.id?.length&&(t.id=e.id),e.data?.length&&(t.data=e.data),e.entityData?.length&&(t.entityData=e.entityData.map(n=>tt.toJSON(n))),t},create(e){return Go.fromPartial(e??{})},fromPartial(e){let t=cT();return t.entity=e.entity?.map(n=>n)||[],t.id=e.id?.map(n=>n)||[],t.data=e.data?.map(n=>n)||[],t.entityData=e.entityData?.map(n=>tt.fromPartial(n))||[],t}};function uT(){return{entity:[],id:[]}}var Wo={encode(e,t=g.default.Writer.create()){for(let n of e.entity)t.uint32(10).string(n);for(let n of e.id)t.uint32(18).string(n);return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=uT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.entity.push(n.string());continue;case 2:if(a!==18)break;i.id.push(n.string());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{entity:globalThis.Array.isArray(e?.entity)?e.entity.map(t=>globalThis.String(t)):[],id:globalThis.Array.isArray(e?.id)?e.id.map(t=>globalThis.String(t)):[]}},toJSON(e){let t={};return e.entity?.length&&(t.entity=e.entity),e.id?.length&&(t.id=e.id),t},create(e){return Wo.fromPartial(e??{})},fromPartial(e){let t=uT();return t.entity=e.entity?.map(n=>n)||[],t.id=e.id?.map(n=>n)||[],t}};function lT(){return{field:"",op:0,value:void 0}}var Ho={encode(e,t=g.default.Writer.create()){return e.field!==""&&t.uint32(10).string(e.field),e.op!==0&&t.uint32(16).int32(e.op),e.value!==void 0&&Fn.encode(e.value,t.uint32(26).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=lT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.field=n.string();continue;case 2:if(a!==16)break;i.op=n.int32();continue;case 3:if(a!==26)break;i.value=Fn.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{field:S(e.field)?globalThis.String(e.field):"",op:S(e.op)?mq(e.op):0,value:S(e.value)?Fn.fromJSON(e.value):void 0}},toJSON(e){let t={};return e.field!==""&&(t.field=e.field),e.op!==0&&(t.op=gq(e.op)),e.value!==void 0&&(t.value=Fn.toJSON(e.value)),t},create(e){return Ho.fromPartial(e??{})},fromPartial(e){let t=lT();return t.field=e.field??"",t.op=e.op??0,t.value=e.value!==void 0&&e.value!==null?Fn.fromPartial(e.value):void 0,t}};function dT(){return{ethLog:void 0,ethBlock:void 0,ethTransaction:void 0,ethTrace:void 0,solInstruction:void 0,aptEvent:void 0,aptCall:void 0,aptResource:void 0,suiEvent:void 0,suiCall:void 0,suiObject:void 0,suiObjectChange:void 0,fuelCall:void 0,cosmosCall:void 0,starknetEvents:void 0,btcTransaction:void 0}}var Zo={encode(e,t=g.default.Writer.create()){return e.ethLog!==void 0&&Xo.encode(e.ethLog,t.uint32(18).fork()).ldelim(),e.ethBlock!==void 0&&Yo.encode(e.ethBlock,t.uint32(26).fork()).ldelim(),e.ethTransaction!==void 0&&$o.encode(e.ethTransaction,t.uint32(34).fork()).ldelim(),e.ethTrace!==void 0&&Ko.encode(e.ethTrace,t.uint32(42).fork()).ldelim(),e.solInstruction!==void 0&&jo.encode(e.solInstruction,t.uint32(50).fork()).ldelim(),e.aptEvent!==void 0&&ec.encode(e.aptEvent,t.uint32(58).fork()).ldelim(),e.aptCall!==void 0&&tc.encode(e.aptCall,t.uint32(66).fork()).ldelim(),e.aptResource!==void 0&&nc.encode(e.aptResource,t.uint32(74).fork()).ldelim(),e.suiEvent!==void 0&&rc.encode(e.suiEvent,t.uint32(82).fork()).ldelim(),e.suiCall!==void 0&&ic.encode(e.suiCall,t.uint32(90).fork()).ldelim(),e.suiObject!==void 0&&ac.encode(e.suiObject,t.uint32(98).fork()).ldelim(),e.suiObjectChange!==void 0&&sc.encode(e.suiObjectChange,t.uint32(106).fork()).ldelim(),e.fuelCall!==void 0&&oc.encode(e.fuelCall,t.uint32(114).fork()).ldelim(),e.cosmosCall!==void 0&&cc.encode(e.cosmosCall,t.uint32(122).fork()).ldelim(),e.starknetEvents!==void 0&&uc.encode(e.starknetEvents,t.uint32(130).fork()).ldelim(),e.btcTransaction!==void 0&&lc.encode(e.btcTransaction,t.uint32(138).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=dT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 2:if(a!==18)break;i.ethLog=Xo.decode(n,n.uint32());continue;case 3:if(a!==26)break;i.ethBlock=Yo.decode(n,n.uint32());continue;case 4:if(a!==34)break;i.ethTransaction=$o.decode(n,n.uint32());continue;case 5:if(a!==42)break;i.ethTrace=Ko.decode(n,n.uint32());continue;case 6:if(a!==50)break;i.solInstruction=jo.decode(n,n.uint32());continue;case 7:if(a!==58)break;i.aptEvent=ec.decode(n,n.uint32());continue;case 8:if(a!==66)break;i.aptCall=tc.decode(n,n.uint32());continue;case 9:if(a!==74)break;i.aptResource=nc.decode(n,n.uint32());continue;case 10:if(a!==82)break;i.suiEvent=rc.decode(n,n.uint32());continue;case 11:if(a!==90)break;i.suiCall=ic.decode(n,n.uint32());continue;case 12:if(a!==98)break;i.suiObject=ac.decode(n,n.uint32());continue;case 13:if(a!==106)break;i.suiObjectChange=sc.decode(n,n.uint32());continue;case 14:if(a!==114)break;i.fuelCall=oc.decode(n,n.uint32());continue;case 15:if(a!==122)break;i.cosmosCall=cc.decode(n,n.uint32());continue;case 16:if(a!==130)break;i.starknetEvents=uc.decode(n,n.uint32());continue;case 17:if(a!==138)break;i.btcTransaction=lc.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{ethLog:S(e.ethLog)?Xo.fromJSON(e.ethLog):void 0,ethBlock:S(e.ethBlock)?Yo.fromJSON(e.ethBlock):void 0,ethTransaction:S(e.ethTransaction)?$o.fromJSON(e.ethTransaction):void 0,ethTrace:S(e.ethTrace)?Ko.fromJSON(e.ethTrace):void 0,solInstruction:S(e.solInstruction)?jo.fromJSON(e.solInstruction):void 0,aptEvent:S(e.aptEvent)?ec.fromJSON(e.aptEvent):void 0,aptCall:S(e.aptCall)?tc.fromJSON(e.aptCall):void 0,aptResource:S(e.aptResource)?nc.fromJSON(e.aptResource):void 0,suiEvent:S(e.suiEvent)?rc.fromJSON(e.suiEvent):void 0,suiCall:S(e.suiCall)?ic.fromJSON(e.suiCall):void 0,suiObject:S(e.suiObject)?ac.fromJSON(e.suiObject):void 0,suiObjectChange:S(e.suiObjectChange)?sc.fromJSON(e.suiObjectChange):void 0,fuelCall:S(e.fuelCall)?oc.fromJSON(e.fuelCall):void 0,cosmosCall:S(e.cosmosCall)?cc.fromJSON(e.cosmosCall):void 0,starknetEvents:S(e.starknetEvents)?uc.fromJSON(e.starknetEvents):void 0,btcTransaction:S(e.btcTransaction)?lc.fromJSON(e.btcTransaction):void 0}},toJSON(e){let t={};return e.ethLog!==void 0&&(t.ethLog=Xo.toJSON(e.ethLog)),e.ethBlock!==void 0&&(t.ethBlock=Yo.toJSON(e.ethBlock)),e.ethTransaction!==void 0&&(t.ethTransaction=$o.toJSON(e.ethTransaction)),e.ethTrace!==void 0&&(t.ethTrace=Ko.toJSON(e.ethTrace)),e.solInstruction!==void 0&&(t.solInstruction=jo.toJSON(e.solInstruction)),e.aptEvent!==void 0&&(t.aptEvent=ec.toJSON(e.aptEvent)),e.aptCall!==void 0&&(t.aptCall=tc.toJSON(e.aptCall)),e.aptResource!==void 0&&(t.aptResource=nc.toJSON(e.aptResource)),e.suiEvent!==void 0&&(t.suiEvent=rc.toJSON(e.suiEvent)),e.suiCall!==void 0&&(t.suiCall=ic.toJSON(e.suiCall)),e.suiObject!==void 0&&(t.suiObject=ac.toJSON(e.suiObject)),e.suiObjectChange!==void 0&&(t.suiObjectChange=sc.toJSON(e.suiObjectChange)),e.fuelCall!==void 0&&(t.fuelCall=oc.toJSON(e.fuelCall)),e.cosmosCall!==void 0&&(t.cosmosCall=cc.toJSON(e.cosmosCall)),e.starknetEvents!==void 0&&(t.starknetEvents=uc.toJSON(e.starknetEvents)),e.btcTransaction!==void 0&&(t.btcTransaction=lc.toJSON(e.btcTransaction)),t},create(e){return Zo.fromPartial(e??{})},fromPartial(e){let t=dT();return t.ethLog=e.ethLog!==void 0&&e.ethLog!==null?Xo.fromPartial(e.ethLog):void 0,t.ethBlock=e.ethBlock!==void 0&&e.ethBlock!==null?Yo.fromPartial(e.ethBlock):void 0,t.ethTransaction=e.ethTransaction!==void 0&&e.ethTransaction!==null?$o.fromPartial(e.ethTransaction):void 0,t.ethTrace=e.ethTrace!==void 0&&e.ethTrace!==null?Ko.fromPartial(e.ethTrace):void 0,t.solInstruction=e.solInstruction!==void 0&&e.solInstruction!==null?jo.fromPartial(e.solInstruction):void 0,t.aptEvent=e.aptEvent!==void 0&&e.aptEvent!==null?ec.fromPartial(e.aptEvent):void 0,t.aptCall=e.aptCall!==void 0&&e.aptCall!==null?tc.fromPartial(e.aptCall):void 0,t.aptResource=e.aptResource!==void 0&&e.aptResource!==null?nc.fromPartial(e.aptResource):void 0,t.suiEvent=e.suiEvent!==void 0&&e.suiEvent!==null?rc.fromPartial(e.suiEvent):void 0,t.suiCall=e.suiCall!==void 0&&e.suiCall!==null?ic.fromPartial(e.suiCall):void 0,t.suiObject=e.suiObject!==void 0&&e.suiObject!==null?ac.fromPartial(e.suiObject):void 0,t.suiObjectChange=e.suiObjectChange!==void 0&&e.suiObjectChange!==null?sc.fromPartial(e.suiObjectChange):void 0,t.fuelCall=e.fuelCall!==void 0&&e.fuelCall!==null?oc.fromPartial(e.fuelCall):void 0,t.cosmosCall=e.cosmosCall!==void 0&&e.cosmosCall!==null?cc.fromPartial(e.cosmosCall):void 0,t.starknetEvents=e.starknetEvents!==void 0&&e.starknetEvents!==null?uc.fromPartial(e.starknetEvents):void 0,t.btcTransaction=e.btcTransaction!==void 0&&e.btcTransaction!==null?lc.fromPartial(e.btcTransaction):void 0,t}};function fT(){return{log:void 0,timestamp:void 0,transaction:void 0,transactionReceipt:void 0,block:void 0}}var Xo={encode(e,t=g.default.Writer.create()){return e.log!==void 0&&M.encode(M.wrap(e.log),t.uint32(26).fork()).ldelim(),e.timestamp!==void 0&&Me.encode(Ln(e.timestamp),t.uint32(34).fork()).ldelim(),e.transaction!==void 0&&M.encode(M.wrap(e.transaction),t.uint32(18).fork()).ldelim(),e.transactionReceipt!==void 0&&M.encode(M.wrap(e.transactionReceipt),t.uint32(42).fork()).ldelim(),e.block!==void 0&&M.encode(M.wrap(e.block),t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=fT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 3:if(a!==26)break;i.log=M.unwrap(M.decode(n,n.uint32()));continue;case 4:if(a!==34)break;i.timestamp=wn(Me.decode(n,n.uint32()));continue;case 2:if(a!==18)break;i.transaction=M.unwrap(M.decode(n,n.uint32()));continue;case 5:if(a!==42)break;i.transactionReceipt=M.unwrap(M.decode(n,n.uint32()));continue;case 6:if(a!==50)break;i.block=M.unwrap(M.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{log:Ve(e.log)?e.log:void 0,timestamp:S(e.timestamp)?Qn(e.timestamp):void 0,transaction:Ve(e.transaction)?e.transaction:void 0,transactionReceipt:Ve(e.transactionReceipt)?e.transactionReceipt:void 0,block:Ve(e.block)?e.block:void 0}},toJSON(e){let t={};return e.log!==void 0&&(t.log=e.log),e.timestamp!==void 0&&(t.timestamp=e.timestamp.toISOString()),e.transaction!==void 0&&(t.transaction=e.transaction),e.transactionReceipt!==void 0&&(t.transactionReceipt=e.transactionReceipt),e.block!==void 0&&(t.block=e.block),t},create(e){return Xo.fromPartial(e??{})},fromPartial(e){let t=fT();return t.log=e.log??void 0,t.timestamp=e.timestamp??void 0,t.transaction=e.transaction??void 0,t.transactionReceipt=e.transactionReceipt??void 0,t.block=e.block??void 0,t}};function pT(){return{block:void 0}}var Yo={encode(e,t=g.default.Writer.create()){return e.block!==void 0&&M.encode(M.wrap(e.block),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=pT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 2:if(a!==18)break;i.block=M.unwrap(M.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{block:Ve(e.block)?e.block:void 0}},toJSON(e){let t={};return e.block!==void 0&&(t.block=e.block),t},create(e){return Yo.fromPartial(e??{})},fromPartial(e){let t=pT();return t.block=e.block??void 0,t}};function hT(){return{transaction:void 0,timestamp:void 0,transactionReceipt:void 0,block:void 0,trace:void 0}}var $o={encode(e,t=g.default.Writer.create()){return e.transaction!==void 0&&M.encode(M.wrap(e.transaction),t.uint32(34).fork()).ldelim(),e.timestamp!==void 0&&Me.encode(Ln(e.timestamp),t.uint32(42).fork()).ldelim(),e.transactionReceipt!==void 0&&M.encode(M.wrap(e.transactionReceipt),t.uint32(26).fork()).ldelim(),e.block!==void 0&&M.encode(M.wrap(e.block),t.uint32(50).fork()).ldelim(),e.trace!==void 0&&M.encode(M.wrap(e.trace),t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=hT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 4:if(a!==34)break;i.transaction=M.unwrap(M.decode(n,n.uint32()));continue;case 5:if(a!==42)break;i.timestamp=wn(Me.decode(n,n.uint32()));continue;case 3:if(a!==26)break;i.transactionReceipt=M.unwrap(M.decode(n,n.uint32()));continue;case 6:if(a!==50)break;i.block=M.unwrap(M.decode(n,n.uint32()));continue;case 7:if(a!==58)break;i.trace=M.unwrap(M.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{transaction:Ve(e.transaction)?e.transaction:void 0,timestamp:S(e.timestamp)?Qn(e.timestamp):void 0,transactionReceipt:Ve(e.transactionReceipt)?e.transactionReceipt:void 0,block:Ve(e.block)?e.block:void 0,trace:Ve(e.trace)?e.trace:void 0}},toJSON(e){let t={};return e.transaction!==void 0&&(t.transaction=e.transaction),e.timestamp!==void 0&&(t.timestamp=e.timestamp.toISOString()),e.transactionReceipt!==void 0&&(t.transactionReceipt=e.transactionReceipt),e.block!==void 0&&(t.block=e.block),e.trace!==void 0&&(t.trace=e.trace),t},create(e){return $o.fromPartial(e??{})},fromPartial(e){let t=hT();return t.transaction=e.transaction??void 0,t.timestamp=e.timestamp??void 0,t.transactionReceipt=e.transactionReceipt??void 0,t.block=e.block??void 0,t.trace=e.trace??void 0,t}};function mT(){return{trace:void 0,timestamp:void 0,transaction:void 0,transactionReceipt:void 0,block:void 0}}var Ko={encode(e,t=g.default.Writer.create()){return e.trace!==void 0&&M.encode(M.wrap(e.trace),t.uint32(34).fork()).ldelim(),e.timestamp!==void 0&&Me.encode(Ln(e.timestamp),t.uint32(42).fork()).ldelim(),e.transaction!==void 0&&M.encode(M.wrap(e.transaction),t.uint32(18).fork()).ldelim(),e.transactionReceipt!==void 0&&M.encode(M.wrap(e.transactionReceipt),t.uint32(26).fork()).ldelim(),e.block!==void 0&&M.encode(M.wrap(e.block),t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=mT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 4:if(a!==34)break;i.trace=M.unwrap(M.decode(n,n.uint32()));continue;case 5:if(a!==42)break;i.timestamp=wn(Me.decode(n,n.uint32()));continue;case 2:if(a!==18)break;i.transaction=M.unwrap(M.decode(n,n.uint32()));continue;case 3:if(a!==26)break;i.transactionReceipt=M.unwrap(M.decode(n,n.uint32()));continue;case 6:if(a!==50)break;i.block=M.unwrap(M.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{trace:Ve(e.trace)?e.trace:void 0,timestamp:S(e.timestamp)?Qn(e.timestamp):void 0,transaction:Ve(e.transaction)?e.transaction:void 0,transactionReceipt:Ve(e.transactionReceipt)?e.transactionReceipt:void 0,block:Ve(e.block)?e.block:void 0}},toJSON(e){let t={};return e.trace!==void 0&&(t.trace=e.trace),e.timestamp!==void 0&&(t.timestamp=e.timestamp.toISOString()),e.transaction!==void 0&&(t.transaction=e.transaction),e.transactionReceipt!==void 0&&(t.transactionReceipt=e.transactionReceipt),e.block!==void 0&&(t.block=e.block),t},create(e){return Ko.fromPartial(e??{})},fromPartial(e){let t=mT();return t.trace=e.trace??void 0,t.timestamp=e.timestamp??void 0,t.transaction=e.transaction??void 0,t.transactionReceipt=e.transactionReceipt??void 0,t.block=e.block??void 0,t}};function gT(){return{instructionData:"",slot:BigInt("0"),programAccountId:"",accounts:[],parsed:void 0}}var jo={encode(e,t=g.default.Writer.create()){if(e.instructionData!==""&&t.uint32(10).string(e.instructionData),e.slot!==BigInt("0")){if(BigInt.asUintN(64,e.slot)!==e.slot)throw new globalThis.Error("value provided for field message.slot of type uint64 too large");t.uint32(16).uint64(e.slot.toString())}e.programAccountId!==""&&t.uint32(26).string(e.programAccountId);for(let n of e.accounts)t.uint32(42).string(n);return e.parsed!==void 0&&M.encode(M.wrap(e.parsed),t.uint32(34).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=gT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.instructionData=n.string();continue;case 2:if(a!==16)break;i.slot=Gt(n.uint64());continue;case 3:if(a!==26)break;i.programAccountId=n.string();continue;case 5:if(a!==42)break;i.accounts.push(n.string());continue;case 4:if(a!==34)break;i.parsed=M.unwrap(M.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{instructionData:S(e.instructionData)?globalThis.String(e.instructionData):"",slot:S(e.slot)?BigInt(e.slot):BigInt("0"),programAccountId:S(e.programAccountId)?globalThis.String(e.programAccountId):"",accounts:globalThis.Array.isArray(e?.accounts)?e.accounts.map(t=>globalThis.String(t)):[],parsed:Ve(e.parsed)?e.parsed:void 0}},toJSON(e){let t={};return e.instructionData!==""&&(t.instructionData=e.instructionData),e.slot!==BigInt("0")&&(t.slot=e.slot.toString()),e.programAccountId!==""&&(t.programAccountId=e.programAccountId),e.accounts?.length&&(t.accounts=e.accounts),e.parsed!==void 0&&(t.parsed=e.parsed),t},create(e){return jo.fromPartial(e??{})},fromPartial(e){let t=gT();return t.instructionData=e.instructionData??"",t.slot=e.slot??BigInt("0"),t.programAccountId=e.programAccountId??"",t.accounts=e.accounts?.map(n=>n)||[],t.parsed=e.parsed??void 0,t}};function _T(){return{transaction:void 0}}var ec={encode(e,t=g.default.Writer.create()){return e.transaction!==void 0&&M.encode(M.wrap(e.transaction),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=_T();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 2:if(a!==18)break;i.transaction=M.unwrap(M.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{transaction:Ve(e.transaction)?e.transaction:void 0}},toJSON(e){let t={};return e.transaction!==void 0&&(t.transaction=e.transaction),t},create(e){return ec.fromPartial(e??{})},fromPartial(e){let t=_T();return t.transaction=e.transaction??void 0,t}};function AT(){return{transaction:void 0}}var tc={encode(e,t=g.default.Writer.create()){return e.transaction!==void 0&&M.encode(M.wrap(e.transaction),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=AT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 2:if(a!==18)break;i.transaction=M.unwrap(M.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{transaction:Ve(e.transaction)?e.transaction:void 0}},toJSON(e){let t={};return e.transaction!==void 0&&(t.transaction=e.transaction),t},create(e){return tc.fromPartial(e??{})},fromPartial(e){let t=AT();return t.transaction=e.transaction??void 0,t}};function yT(){return{resources:[],version:BigInt("0"),timestampMicros:BigInt("0")}}var nc={encode(e,t=g.default.Writer.create()){for(let n of e.resources)M.encode(M.wrap(n),t.uint32(34).fork()).ldelim();if(e.version!==BigInt("0")){if(BigInt.asIntN(64,e.version)!==e.version)throw new globalThis.Error("value provided for field message.version of type int64 too large");t.uint32(16).int64(e.version.toString())}if(e.timestampMicros!==BigInt("0")){if(BigInt.asIntN(64,e.timestampMicros)!==e.timestampMicros)throw new globalThis.Error("value provided for field message.timestampMicros of type int64 too large");t.uint32(40).int64(e.timestampMicros.toString())}return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=yT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 4:if(a!==34)break;i.resources.push(M.unwrap(M.decode(n,n.uint32())));continue;case 2:if(a!==16)break;i.version=Gt(n.int64());continue;case 5:if(a!==40)break;i.timestampMicros=Gt(n.int64());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{resources:globalThis.Array.isArray(e?.resources)?[...e.resources]:[],version:S(e.version)?BigInt(e.version):BigInt("0"),timestampMicros:S(e.timestampMicros)?BigInt(e.timestampMicros):BigInt("0")}},toJSON(e){let t={};return e.resources?.length&&(t.resources=e.resources),e.version!==BigInt("0")&&(t.version=e.version.toString()),e.timestampMicros!==BigInt("0")&&(t.timestampMicros=e.timestampMicros.toString()),t},create(e){return nc.fromPartial(e??{})},fromPartial(e){let t=yT();return t.resources=e.resources?.map(n=>n)||[],t.version=e.version??BigInt("0"),t.timestampMicros=e.timestampMicros??BigInt("0"),t}};function vT(){return{transaction:void 0,timestamp:void 0,slot:BigInt("0")}}var rc={encode(e,t=g.default.Writer.create()){if(e.transaction!==void 0&&M.encode(M.wrap(e.transaction),t.uint32(10).fork()).ldelim(),e.timestamp!==void 0&&Me.encode(Ln(e.timestamp),t.uint32(18).fork()).ldelim(),e.slot!==BigInt("0")){if(BigInt.asUintN(64,e.slot)!==e.slot)throw new globalThis.Error("value provided for field message.slot of type uint64 too large");t.uint32(24).uint64(e.slot.toString())}return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=vT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.transaction=M.unwrap(M.decode(n,n.uint32()));continue;case 2:if(a!==18)break;i.timestamp=wn(Me.decode(n,n.uint32()));continue;case 3:if(a!==24)break;i.slot=Gt(n.uint64());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{transaction:Ve(e.transaction)?e.transaction:void 0,timestamp:S(e.timestamp)?Qn(e.timestamp):void 0,slot:S(e.slot)?BigInt(e.slot):BigInt("0")}},toJSON(e){let t={};return e.transaction!==void 0&&(t.transaction=e.transaction),e.timestamp!==void 0&&(t.timestamp=e.timestamp.toISOString()),e.slot!==BigInt("0")&&(t.slot=e.slot.toString()),t},create(e){return rc.fromPartial(e??{})},fromPartial(e){let t=vT();return t.transaction=e.transaction??void 0,t.timestamp=e.timestamp??void 0,t.slot=e.slot??BigInt("0"),t}};function wT(){return{transaction:void 0,timestamp:void 0,slot:BigInt("0")}}var ic={encode(e,t=g.default.Writer.create()){if(e.transaction!==void 0&&M.encode(M.wrap(e.transaction),t.uint32(10).fork()).ldelim(),e.timestamp!==void 0&&Me.encode(Ln(e.timestamp),t.uint32(18).fork()).ldelim(),e.slot!==BigInt("0")){if(BigInt.asUintN(64,e.slot)!==e.slot)throw new globalThis.Error("value provided for field message.slot of type uint64 too large");t.uint32(24).uint64(e.slot.toString())}return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=wT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.transaction=M.unwrap(M.decode(n,n.uint32()));continue;case 2:if(a!==18)break;i.timestamp=wn(Me.decode(n,n.uint32()));continue;case 3:if(a!==24)break;i.slot=Gt(n.uint64());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{transaction:Ve(e.transaction)?e.transaction:void 0,timestamp:S(e.timestamp)?Qn(e.timestamp):void 0,slot:S(e.slot)?BigInt(e.slot):BigInt("0")}},toJSON(e){let t={};return e.transaction!==void 0&&(t.transaction=e.transaction),e.timestamp!==void 0&&(t.timestamp=e.timestamp.toISOString()),e.slot!==BigInt("0")&&(t.slot=e.slot.toString()),t},create(e){return ic.fromPartial(e??{})},fromPartial(e){let t=wT();return t.transaction=e.transaction??void 0,t.timestamp=e.timestamp??void 0,t.slot=e.slot??BigInt("0"),t}};function bT(){return{objects:[],self:void 0,timestamp:void 0,slot:BigInt("0")}}var ac={encode(e,t=g.default.Writer.create()){for(let n of e.objects)M.encode(M.wrap(n),t.uint32(10).fork()).ldelim();if(e.self!==void 0&&M.encode(M.wrap(e.self),t.uint32(34).fork()).ldelim(),e.timestamp!==void 0&&Me.encode(Ln(e.timestamp),t.uint32(18).fork()).ldelim(),e.slot!==BigInt("0")){if(BigInt.asUintN(64,e.slot)!==e.slot)throw new globalThis.Error("value provided for field message.slot of type uint64 too large");t.uint32(24).uint64(e.slot.toString())}return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=bT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.objects.push(M.unwrap(M.decode(n,n.uint32())));continue;case 4:if(a!==34)break;i.self=M.unwrap(M.decode(n,n.uint32()));continue;case 2:if(a!==18)break;i.timestamp=wn(Me.decode(n,n.uint32()));continue;case 3:if(a!==24)break;i.slot=Gt(n.uint64());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{objects:globalThis.Array.isArray(e?.objects)?[...e.objects]:[],self:Ve(e.self)?e.self:void 0,timestamp:S(e.timestamp)?Qn(e.timestamp):void 0,slot:S(e.slot)?BigInt(e.slot):BigInt("0")}},toJSON(e){let t={};return e.objects?.length&&(t.objects=e.objects),e.self!==void 0&&(t.self=e.self),e.timestamp!==void 0&&(t.timestamp=e.timestamp.toISOString()),e.slot!==BigInt("0")&&(t.slot=e.slot.toString()),t},create(e){return ac.fromPartial(e??{})},fromPartial(e){let t=bT();return t.objects=e.objects?.map(n=>n)||[],t.self=e.self??void 0,t.timestamp=e.timestamp??void 0,t.slot=e.slot??BigInt("0"),t}};function ET(){return{changes:[],timestamp:void 0,txDigest:"",slot:BigInt("0")}}var sc={encode(e,t=g.default.Writer.create()){for(let n of e.changes)M.encode(M.wrap(n),t.uint32(10).fork()).ldelim();if(e.timestamp!==void 0&&Me.encode(Ln(e.timestamp),t.uint32(18).fork()).ldelim(),e.txDigest!==""&&t.uint32(34).string(e.txDigest),e.slot!==BigInt("0")){if(BigInt.asUintN(64,e.slot)!==e.slot)throw new globalThis.Error("value provided for field message.slot of type uint64 too large");t.uint32(24).uint64(e.slot.toString())}return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=ET();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.changes.push(M.unwrap(M.decode(n,n.uint32())));continue;case 2:if(a!==18)break;i.timestamp=wn(Me.decode(n,n.uint32()));continue;case 4:if(a!==34)break;i.txDigest=n.string();continue;case 3:if(a!==24)break;i.slot=Gt(n.uint64());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{changes:globalThis.Array.isArray(e?.changes)?[...e.changes]:[],timestamp:S(e.timestamp)?Qn(e.timestamp):void 0,txDigest:S(e.txDigest)?globalThis.String(e.txDigest):"",slot:S(e.slot)?BigInt(e.slot):BigInt("0")}},toJSON(e){let t={};return e.changes?.length&&(t.changes=e.changes),e.timestamp!==void 0&&(t.timestamp=e.timestamp.toISOString()),e.txDigest!==""&&(t.txDigest=e.txDigest),e.slot!==BigInt("0")&&(t.slot=e.slot.toString()),t},create(e){return sc.fromPartial(e??{})},fromPartial(e){let t=ET();return t.changes=e.changes?.map(n=>n)||[],t.timestamp=e.timestamp??void 0,t.txDigest=e.txDigest??"",t.slot=e.slot??BigInt("0"),t}};function CT(){return{transaction:void 0,timestamp:void 0}}var oc={encode(e,t=g.default.Writer.create()){return e.transaction!==void 0&&M.encode(M.wrap(e.transaction),t.uint32(10).fork()).ldelim(),e.timestamp!==void 0&&Me.encode(Ln(e.timestamp),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=CT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.transaction=M.unwrap(M.decode(n,n.uint32()));continue;case 2:if(a!==18)break;i.timestamp=wn(Me.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{transaction:Ve(e.transaction)?e.transaction:void 0,timestamp:S(e.timestamp)?Qn(e.timestamp):void 0}},toJSON(e){let t={};return e.transaction!==void 0&&(t.transaction=e.transaction),e.timestamp!==void 0&&(t.timestamp=e.timestamp.toISOString()),t},create(e){return oc.fromPartial(e??{})},fromPartial(e){let t=CT();return t.transaction=e.transaction??void 0,t.timestamp=e.timestamp??void 0,t}};function IT(){return{transaction:void 0,timestamp:void 0}}var cc={encode(e,t=g.default.Writer.create()){return e.transaction!==void 0&&M.encode(M.wrap(e.transaction),t.uint32(10).fork()).ldelim(),e.timestamp!==void 0&&Me.encode(Ln(e.timestamp),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=IT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.transaction=M.unwrap(M.decode(n,n.uint32()));continue;case 2:if(a!==18)break;i.timestamp=wn(Me.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{transaction:Ve(e.transaction)?e.transaction:void 0,timestamp:S(e.timestamp)?Qn(e.timestamp):void 0}},toJSON(e){let t={};return e.transaction!==void 0&&(t.transaction=e.transaction),e.timestamp!==void 0&&(t.timestamp=e.timestamp.toISOString()),t},create(e){return cc.fromPartial(e??{})},fromPartial(e){let t=IT();return t.transaction=e.transaction??void 0,t.timestamp=e.timestamp??void 0,t}};function ST(){return{result:void 0,timestamp:void 0}}var uc={encode(e,t=g.default.Writer.create()){return e.result!==void 0&&M.encode(M.wrap(e.result),t.uint32(10).fork()).ldelim(),e.timestamp!==void 0&&Me.encode(Ln(e.timestamp),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=ST();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.result=M.unwrap(M.decode(n,n.uint32()));continue;case 2:if(a!==18)break;i.timestamp=wn(Me.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{result:Ve(e.result)?e.result:void 0,timestamp:S(e.timestamp)?Qn(e.timestamp):void 0}},toJSON(e){let t={};return e.result!==void 0&&(t.result=e.result),e.timestamp!==void 0&&(t.timestamp=e.timestamp.toISOString()),t},create(e){return uc.fromPartial(e??{})},fromPartial(e){let t=ST();return t.result=e.result??void 0,t.timestamp=e.timestamp??void 0,t}};function xT(){return{transaction:void 0,timestamp:void 0}}var lc={encode(e,t=g.default.Writer.create()){return e.transaction!==void 0&&M.encode(M.wrap(e.transaction),t.uint32(34).fork()).ldelim(),e.timestamp!==void 0&&Me.encode(Ln(e.timestamp),t.uint32(42).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=xT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 4:if(a!==34)break;i.transaction=M.unwrap(M.decode(n,n.uint32()));continue;case 5:if(a!==42)break;i.timestamp=wn(Me.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{transaction:Ve(e.transaction)?e.transaction:void 0,timestamp:S(e.timestamp)?Qn(e.timestamp):void 0}},toJSON(e){let t={};return e.transaction!==void 0&&(t.transaction=e.transaction),e.timestamp!==void 0&&(t.timestamp=e.timestamp.toISOString()),t},create(e){return lc.fromPartial(e??{})},fromPartial(e){let t=xT();return t.transaction=e.transaction??void 0,t.timestamp=e.timestamp??void 0,t}};function TT(){return{data:void 0,handlerType:0,handlerIds:[]}}var Vt={encode(e,t=g.default.Writer.create()){e.data!==void 0&&Zo.encode(e.data,t.uint32(10).fork()).ldelim(),e.handlerType!==0&&t.uint32(24).int32(e.handlerType),t.uint32(34).fork();for(let n of e.handlerIds)t.int32(n);return t.ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=TT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.data=Zo.decode(n,n.uint32());continue;case 3:if(a!==24)break;i.handlerType=n.int32();continue;case 4:if(a===32){i.handlerIds.push(n.int32());continue}if(a===34){let s=n.uint32()+n.pos;for(;n.pos<s;)i.handlerIds.push(n.int32());continue}break}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{data:S(e.data)?Zo.fromJSON(e.data):void 0,handlerType:S(e.handlerType)?VT(e.handlerType):0,handlerIds:globalThis.Array.isArray(e?.handlerIds)?e.handlerIds.map(t=>globalThis.Number(t)):[]}},toJSON(e){let t={};return e.data!==void 0&&(t.data=Zo.toJSON(e.data)),e.handlerType!==0&&(t.handlerType=GT(e.handlerType)),e.handlerIds?.length&&(t.handlerIds=e.handlerIds.map(n=>Math.round(n))),t},create(e){return Vt.fromPartial(e??{})},fromPartial(e){let t=TT();return t.data=e.data!==void 0&&e.data!==null?Zo.fromPartial(e.data):void 0,t.handlerType=e.handlerType??0,t.handlerIds=e.handlerIds?.map(n=>n)||[],t}};function NT(){return{configUpdated:!1,error:void 0}}var dc={encode(e,t=g.default.Writer.create()){return e.configUpdated!==!1&&t.uint32(8).bool(e.configUpdated),e.error!==void 0&&t.uint32(18).string(e.error),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=NT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.configUpdated=n.bool();continue;case 2:if(a!==18)break;i.error=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{configUpdated:S(e.configUpdated)?globalThis.Boolean(e.configUpdated):!1,error:S(e.error)?globalThis.String(e.error):void 0}},toJSON(e){let t={};return e.configUpdated!==!1&&(t.configUpdated=e.configUpdated),e.error!==void 0&&(t.error=e.error),t},create(e){return dc.fromPartial(e??{})},fromPartial(e){let t=NT();return t.configUpdated=e.configUpdated??!1,t.error=e.error??void 0,t}};function RT(){return{gauges:[],counters:[],events:[],exports:[],states:void 0}}var vn={encode(e,t=g.default.Writer.create()){for(let n of e.gauges)hc.encode(n,t.uint32(10).fork()).ldelim();for(let n of e.counters)mc.encode(n,t.uint32(18).fork()).ldelim();for(let n of e.events)gc.encode(n,t.uint32(34).fork()).ldelim();for(let n of e.exports)_c.encode(n,t.uint32(42).fork()).ldelim();return e.states!==void 0&&dc.encode(e.states,t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=RT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.gauges.push(hc.decode(n,n.uint32()));continue;case 2:if(a!==18)break;i.counters.push(mc.decode(n,n.uint32()));continue;case 4:if(a!==34)break;i.events.push(gc.decode(n,n.uint32()));continue;case 5:if(a!==42)break;i.exports.push(_c.decode(n,n.uint32()));continue;case 6:if(a!==50)break;i.states=dc.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{gauges:globalThis.Array.isArray(e?.gauges)?e.gauges.map(t=>hc.fromJSON(t)):[],counters:globalThis.Array.isArray(e?.counters)?e.counters.map(t=>mc.fromJSON(t)):[],events:globalThis.Array.isArray(e?.events)?e.events.map(t=>gc.fromJSON(t)):[],exports:globalThis.Array.isArray(e?.exports)?e.exports.map(t=>_c.fromJSON(t)):[],states:S(e.states)?dc.fromJSON(e.states):void 0}},toJSON(e){let t={};return e.gauges?.length&&(t.gauges=e.gauges.map(n=>hc.toJSON(n))),e.counters?.length&&(t.counters=e.counters.map(n=>mc.toJSON(n))),e.events?.length&&(t.events=e.events.map(n=>gc.toJSON(n))),e.exports?.length&&(t.exports=e.exports.map(n=>_c.toJSON(n))),e.states!==void 0&&(t.states=dc.toJSON(e.states)),t},create(e){return vn.fromPartial(e??{})},fromPartial(e){let t=RT();return t.gauges=e.gauges?.map(n=>hc.fromPartial(n))||[],t.counters=e.counters?.map(n=>mc.fromPartial(n))||[],t.events=e.events?.map(n=>gc.fromPartial(n))||[],t.exports=e.exports?.map(n=>_c.fromPartial(n))||[],t.states=e.states!==void 0&&e.states!==null?dc.fromPartial(e.states):void 0,t}};function BT(){return{context:void 0,calldata:""}}var fc={encode(e,t=g.default.Writer.create()){return e.context!==void 0&&pc.encode(e.context,t.uint32(10).fork()).ldelim(),e.calldata!==""&&t.uint32(18).string(e.calldata),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=BT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.context=pc.decode(n,n.uint32());continue;case 2:if(a!==18)break;i.calldata=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{context:S(e.context)?pc.fromJSON(e.context):void 0,calldata:S(e.calldata)?globalThis.String(e.calldata):""}},toJSON(e){let t={};return e.context!==void 0&&(t.context=pc.toJSON(e.context)),e.calldata!==""&&(t.calldata=e.calldata),t},create(e){return fc.fromPartial(e??{})},fromPartial(e){let t=BT();return t.context=e.context!==void 0&&e.context!==null?pc.fromPartial(e.context):void 0,t.calldata=e.calldata??"",t}};function kT(){return{chainId:"",address:"",blockTag:""}}var pc={encode(e,t=g.default.Writer.create()){return e.chainId!==""&&t.uint32(10).string(e.chainId),e.address!==""&&t.uint32(18).string(e.address),e.blockTag!==""&&t.uint32(26).string(e.blockTag),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=kT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.chainId=n.string();continue;case 2:if(a!==18)break;i.address=n.string();continue;case 3:if(a!==26)break;i.blockTag=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{chainId:S(e.chainId)?globalThis.String(e.chainId):"",address:S(e.address)?globalThis.String(e.address):"",blockTag:S(e.blockTag)?globalThis.String(e.blockTag):""}},toJSON(e){let t={};return e.chainId!==""&&(t.chainId=e.chainId),e.address!==""&&(t.address=e.address),e.blockTag!==""&&(t.blockTag=e.blockTag),t},create(e){return pc.fromPartial(e??{})},fromPartial(e){let t=kT();return t.chainId=e.chainId??"",t.address=e.address??"",t.blockTag=e.blockTag??"",t}};function OT(){return{ethCallParams:[]}}var yq={encode(e,t=g.default.Writer.create()){for(let n of e.ethCallParams)fc.encode(n,t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=OT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.ethCallParams.push(fc.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{ethCallParams:globalThis.Array.isArray(e?.ethCallParams)?e.ethCallParams.map(t=>fc.fromJSON(t)):[]}},toJSON(e){let t={};return e.ethCallParams?.length&&(t.ethCallParams=e.ethCallParams.map(n=>fc.toJSON(n))),t},create(e){return yq.fromPartial(e??{})},fromPartial(e){let t=OT();return t.ethCallParams=e.ethCallParams?.map(n=>fc.fromPartial(n))||[],t}};function PT(){return{ethCallResults:{}}}var vq={encode(e,t=g.default.Writer.create()){return Object.entries(e.ethCallResults).forEach(([n,r])=>{pA.encode({key:n,value:r},t.uint32(10).fork()).ldelim()}),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=PT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;let s=pA.decode(n,n.uint32());s.value!==void 0&&(i.ethCallResults[s.key]=s.value);continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{ethCallResults:Ve(e.ethCallResults)?Object.entries(e.ethCallResults).reduce((t,[n,r])=>(t[n]=String(r),t),{}):{}}},toJSON(e){let t={};if(e.ethCallResults){let n=Object.entries(e.ethCallResults);n.length>0&&(t.ethCallResults={},n.forEach(([r,i])=>{t.ethCallResults[r]=i}))}return t},create(e){return vq.fromPartial(e??{})},fromPartial(e){let t=PT();return t.ethCallResults=Object.entries(e.ethCallResults??{}).reduce((n,[r,i])=>(i!==void 0&&(n[r]=globalThis.String(i)),n),{}),t}};function DT(){return{key:"",value:""}}var pA={encode(e,t=g.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==""&&t.uint32(18).string(e.value),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=DT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.key=n.string();continue;case 2:if(a!==18)break;i.value=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{key:S(e.key)?globalThis.String(e.key):"",value:S(e.value)?globalThis.String(e.value):""}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==""&&(t.value=e.value),t},create(e){return pA.fromPartial(e??{})},fromPartial(e){let t=DT();return t.key=e.key??"",t.value=e.value??"",t}};function MT(){return{address:"",contractName:"",blockNumber:BigInt("0"),transactionHash:"",chainId:"",transactionIndex:0,logIndex:0,name:"",labels:{}}}var lt={encode(e,t=g.default.Writer.create()){if(e.address!==""&&t.uint32(10).string(e.address),e.contractName!==""&&t.uint32(74).string(e.contractName),e.blockNumber!==BigInt("0")){if(BigInt.asUintN(64,e.blockNumber)!==e.blockNumber)throw new globalThis.Error("value provided for field message.blockNumber of type uint64 too large");t.uint32(16).uint64(e.blockNumber.toString())}return e.transactionHash!==""&&t.uint32(50).string(e.transactionHash),e.chainId!==""&&t.uint32(42).string(e.chainId),e.transactionIndex!==0&&t.uint32(24).int32(e.transactionIndex),e.logIndex!==0&&t.uint32(32).int32(e.logIndex),e.name!==""&&t.uint32(82).string(e.name),Object.entries(e.labels).forEach(([n,r])=>{hA.encode({key:n,value:r},t.uint32(58).fork()).ldelim()}),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=MT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.address=n.string();continue;case 9:if(a!==74)break;i.contractName=n.string();continue;case 2:if(a!==16)break;i.blockNumber=Gt(n.uint64());continue;case 6:if(a!==50)break;i.transactionHash=n.string();continue;case 5:if(a!==42)break;i.chainId=n.string();continue;case 3:if(a!==24)break;i.transactionIndex=n.int32();continue;case 4:if(a!==32)break;i.logIndex=n.int32();continue;case 10:if(a!==82)break;i.name=n.string();continue;case 7:if(a!==58)break;let s=hA.decode(n,n.uint32());s.value!==void 0&&(i.labels[s.key]=s.value);continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{address:S(e.address)?globalThis.String(e.address):"",contractName:S(e.contractName)?globalThis.String(e.contractName):"",blockNumber:S(e.blockNumber)?BigInt(e.blockNumber):BigInt("0"),transactionHash:S(e.transactionHash)?globalThis.String(e.transactionHash):"",chainId:S(e.chainId)?globalThis.String(e.chainId):"",transactionIndex:S(e.transactionIndex)?globalThis.Number(e.transactionIndex):0,logIndex:S(e.logIndex)?globalThis.Number(e.logIndex):0,name:S(e.name)?globalThis.String(e.name):"",labels:Ve(e.labels)?Object.entries(e.labels).reduce((t,[n,r])=>(t[n]=String(r),t),{}):{}}},toJSON(e){let t={};if(e.address!==""&&(t.address=e.address),e.contractName!==""&&(t.contractName=e.contractName),e.blockNumber!==BigInt("0")&&(t.blockNumber=e.blockNumber.toString()),e.transactionHash!==""&&(t.transactionHash=e.transactionHash),e.chainId!==""&&(t.chainId=e.chainId),e.transactionIndex!==0&&(t.transactionIndex=Math.round(e.transactionIndex)),e.logIndex!==0&&(t.logIndex=Math.round(e.logIndex)),e.name!==""&&(t.name=e.name),e.labels){let n=Object.entries(e.labels);n.length>0&&(t.labels={},n.forEach(([r,i])=>{t.labels[r]=i}))}return t},create(e){return lt.fromPartial(e??{})},fromPartial(e){let t=MT();return t.address=e.address??"",t.contractName=e.contractName??"",t.blockNumber=e.blockNumber??BigInt("0"),t.transactionHash=e.transactionHash??"",t.chainId=e.chainId??"",t.transactionIndex=e.transactionIndex??0,t.logIndex=e.logIndex??0,t.name=e.name??"",t.labels=Object.entries(e.labels??{}).reduce((n,[r,i])=>(i!==void 0&&(n[r]=globalThis.String(i)),n),{}),t}};function FT(){return{key:"",value:""}}var hA={encode(e,t=g.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==""&&t.uint32(18).string(e.value),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=FT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.key=n.string();continue;case 2:if(a!==18)break;i.value=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{key:S(e.key)?globalThis.String(e.key):"",value:S(e.value)?globalThis.String(e.value):""}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==""&&(t.value=e.value),t},create(e){return hA.fromPartial(e??{})},fromPartial(e){let t=FT();return t.key=e.key??"",t.value=e.value??"",t}};function LT(){return{bigDecimal:void 0,doubleValue:void 0,bigInteger:void 0}}var Nt={encode(e,t=g.default.Writer.create()){return e.bigDecimal!==void 0&&t.uint32(10).string(e.bigDecimal),e.doubleValue!==void 0&&t.uint32(17).double(e.doubleValue),e.bigInteger!==void 0&&It.encode(e.bigInteger,t.uint32(26).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=LT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.bigDecimal=n.string();continue;case 2:if(a!==17)break;i.doubleValue=n.double();continue;case 3:if(a!==26)break;i.bigInteger=It.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{bigDecimal:S(e.bigDecimal)?globalThis.String(e.bigDecimal):void 0,doubleValue:S(e.doubleValue)?globalThis.Number(e.doubleValue):void 0,bigInteger:S(e.bigInteger)?It.fromJSON(e.bigInteger):void 0}},toJSON(e){let t={};return e.bigDecimal!==void 0&&(t.bigDecimal=e.bigDecimal),e.doubleValue!==void 0&&(t.doubleValue=e.doubleValue),e.bigInteger!==void 0&&(t.bigInteger=It.toJSON(e.bigInteger)),t},create(e){return Nt.fromPartial(e??{})},fromPartial(e){let t=LT();return t.bigDecimal=e.bigDecimal??void 0,t.doubleValue=e.doubleValue??void 0,t.bigInteger=e.bigInteger!==void 0&&e.bigInteger!==null?It.fromPartial(e.bigInteger):void 0,t}};function QT(){return{from:0}}var dt={encode(e,t=g.default.Writer.create()){return e.from!==0&&t.uint32(8).int32(e.from),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=QT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.from=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{from:S(e.from)?VT(e.from):0}},toJSON(e){let t={};return e.from!==0&&(t.from=GT(e.from)),t},create(e){return dt.fromPartial(e??{})},fromPartial(e){let t=QT();return t.from=e.from??0,t}};function UT(){return{metadata:void 0,metricValue:void 0,runtimeInfo:void 0}}var hc={encode(e,t=g.default.Writer.create()){return e.metadata!==void 0&<.encode(e.metadata,t.uint32(10).fork()).ldelim(),e.metricValue!==void 0&&Nt.encode(e.metricValue,t.uint32(18).fork()).ldelim(),e.runtimeInfo!==void 0&&dt.encode(e.runtimeInfo,t.uint32(26).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=UT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.metadata=lt.decode(n,n.uint32());continue;case 2:if(a!==18)break;i.metricValue=Nt.decode(n,n.uint32());continue;case 3:if(a!==26)break;i.runtimeInfo=dt.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{metadata:S(e.metadata)?lt.fromJSON(e.metadata):void 0,metricValue:S(e.metricValue)?Nt.fromJSON(e.metricValue):void 0,runtimeInfo:S(e.runtimeInfo)?dt.fromJSON(e.runtimeInfo):void 0}},toJSON(e){let t={};return e.metadata!==void 0&&(t.metadata=lt.toJSON(e.metadata)),e.metricValue!==void 0&&(t.metricValue=Nt.toJSON(e.metricValue)),e.runtimeInfo!==void 0&&(t.runtimeInfo=dt.toJSON(e.runtimeInfo)),t},create(e){return hc.fromPartial(e??{})},fromPartial(e){let t=UT();return t.metadata=e.metadata!==void 0&&e.metadata!==null?lt.fromPartial(e.metadata):void 0,t.metricValue=e.metricValue!==void 0&&e.metricValue!==null?Nt.fromPartial(e.metricValue):void 0,t.runtimeInfo=e.runtimeInfo!==void 0&&e.runtimeInfo!==null?dt.fromPartial(e.runtimeInfo):void 0,t}};function qT(){return{metadata:void 0,metricValue:void 0,add:!1,runtimeInfo:void 0}}var mc={encode(e,t=g.default.Writer.create()){return e.metadata!==void 0&<.encode(e.metadata,t.uint32(10).fork()).ldelim(),e.metricValue!==void 0&&Nt.encode(e.metricValue,t.uint32(18).fork()).ldelim(),e.add!==!1&&t.uint32(24).bool(e.add),e.runtimeInfo!==void 0&&dt.encode(e.runtimeInfo,t.uint32(34).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=qT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.metadata=lt.decode(n,n.uint32());continue;case 2:if(a!==18)break;i.metricValue=Nt.decode(n,n.uint32());continue;case 3:if(a!==24)break;i.add=n.bool();continue;case 4:if(a!==34)break;i.runtimeInfo=dt.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{metadata:S(e.metadata)?lt.fromJSON(e.metadata):void 0,metricValue:S(e.metricValue)?Nt.fromJSON(e.metricValue):void 0,add:S(e.add)?globalThis.Boolean(e.add):!1,runtimeInfo:S(e.runtimeInfo)?dt.fromJSON(e.runtimeInfo):void 0}},toJSON(e){let t={};return e.metadata!==void 0&&(t.metadata=lt.toJSON(e.metadata)),e.metricValue!==void 0&&(t.metricValue=Nt.toJSON(e.metricValue)),e.add!==!1&&(t.add=e.add),e.runtimeInfo!==void 0&&(t.runtimeInfo=dt.toJSON(e.runtimeInfo)),t},create(e){return mc.fromPartial(e??{})},fromPartial(e){let t=qT();return t.metadata=e.metadata!==void 0&&e.metadata!==null?lt.fromPartial(e.metadata):void 0,t.metricValue=e.metricValue!==void 0&&e.metricValue!==null?Nt.fromPartial(e.metricValue):void 0,t.add=e.add??!1,t.runtimeInfo=e.runtimeInfo!==void 0&&e.runtimeInfo!==null?dt.fromPartial(e.runtimeInfo):void 0,t}};function JT(){return{metadata:void 0,distinctEntityId:"",attributes:void 0,severity:0,message:"",runtimeInfo:void 0,noMetric:!1}}var gc={encode(e,t=g.default.Writer.create()){return e.metadata!==void 0&<.encode(e.metadata,t.uint32(10).fork()).ldelim(),e.distinctEntityId!==""&&t.uint32(18).string(e.distinctEntityId),e.attributes!==void 0&&M.encode(M.wrap(e.attributes),t.uint32(50).fork()).ldelim(),e.severity!==0&&t.uint32(56).int32(e.severity),e.message!==""&&t.uint32(66).string(e.message),e.runtimeInfo!==void 0&&dt.encode(e.runtimeInfo,t.uint32(42).fork()).ldelim(),e.noMetric!==!1&&t.uint32(24).bool(e.noMetric),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=JT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.metadata=lt.decode(n,n.uint32());continue;case 2:if(a!==18)break;i.distinctEntityId=n.string();continue;case 6:if(a!==50)break;i.attributes=M.unwrap(M.decode(n,n.uint32()));continue;case 7:if(a!==56)break;i.severity=n.int32();continue;case 8:if(a!==66)break;i.message=n.string();continue;case 5:if(a!==42)break;i.runtimeInfo=dt.decode(n,n.uint32());continue;case 3:if(a!==24)break;i.noMetric=n.bool();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{metadata:S(e.metadata)?lt.fromJSON(e.metadata):void 0,distinctEntityId:S(e.distinctEntityId)?globalThis.String(e.distinctEntityId):"",attributes:Ve(e.attributes)?e.attributes:void 0,severity:S(e.severity)?dq(e.severity):0,message:S(e.message)?globalThis.String(e.message):"",runtimeInfo:S(e.runtimeInfo)?dt.fromJSON(e.runtimeInfo):void 0,noMetric:S(e.noMetric)?globalThis.Boolean(e.noMetric):!1}},toJSON(e){let t={};return e.metadata!==void 0&&(t.metadata=lt.toJSON(e.metadata)),e.distinctEntityId!==""&&(t.distinctEntityId=e.distinctEntityId),e.attributes!==void 0&&(t.attributes=e.attributes),e.severity!==0&&(t.severity=fq(e.severity)),e.message!==""&&(t.message=e.message),e.runtimeInfo!==void 0&&(t.runtimeInfo=dt.toJSON(e.runtimeInfo)),e.noMetric!==!1&&(t.noMetric=e.noMetric),t},create(e){return gc.fromPartial(e??{})},fromPartial(e){let t=JT();return t.metadata=e.metadata!==void 0&&e.metadata!==null?lt.fromPartial(e.metadata):void 0,t.distinctEntityId=e.distinctEntityId??"",t.attributes=e.attributes??void 0,t.severity=e.severity??0,t.message=e.message??"",t.runtimeInfo=e.runtimeInfo!==void 0&&e.runtimeInfo!==null?dt.fromPartial(e.runtimeInfo):void 0,t.noMetric=e.noMetric??!1,t}};function zT(){return{metadata:void 0,payload:"",runtimeInfo:void 0}}var _c={encode(e,t=g.default.Writer.create()){return e.metadata!==void 0&<.encode(e.metadata,t.uint32(10).fork()).ldelim(),e.payload!==""&&t.uint32(18).string(e.payload),e.runtimeInfo!==void 0&&dt.encode(e.runtimeInfo,t.uint32(26).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=zT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.metadata=lt.decode(n,n.uint32());continue;case 2:if(a!==18)break;i.payload=n.string();continue;case 3:if(a!==26)break;i.runtimeInfo=dt.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{metadata:S(e.metadata)?lt.fromJSON(e.metadata):void 0,payload:S(e.payload)?globalThis.String(e.payload):"",runtimeInfo:S(e.runtimeInfo)?dt.fromJSON(e.runtimeInfo):void 0}},toJSON(e){let t={};return e.metadata!==void 0&&(t.metadata=lt.toJSON(e.metadata)),e.payload!==""&&(t.payload=e.payload),e.runtimeInfo!==void 0&&(t.runtimeInfo=dt.toJSON(e.runtimeInfo)),t},create(e){return _c.fromPartial(e??{})},fromPartial(e){let t=zT();return t.metadata=e.metadata!==void 0&&e.metadata!==null?lt.fromPartial(e.metadata):void 0,t.payload=e.payload??"",t.runtimeInfo=e.runtimeInfo!==void 0&&e.runtimeInfo!==null?dt.fromPartial(e.runtimeInfo):void 0,t}},uie={name:"Processor",fullName:"processor.Processor",methods:{start:{name:"Start",requestType:ZT,requestStream:!1,responseType:zu,responseStream:!1,options:{}},stop:{name:"Stop",requestType:zu,requestStream:!1,responseType:zu,responseStream:!1,options:{}},getConfig:{name:"GetConfig",requestType:WT,requestStream:!1,responseType:HT,responseStream:!1,options:{}},processBindings:{name:"ProcessBindings",requestType:XT,requestStream:!1,responseType:YT,responseStream:!1,options:{}},processBindingsStream:{name:"ProcessBindingsStream",requestType:$T,requestStream:!0,responseType:KT,responseStream:!0,options:{}},preprocessBindingsStream:{name:"PreprocessBindingsStream",requestType:jT,requestStream:!0,responseType:eN,responseStream:!0,options:{}}}};function Ln(e){let t=BigInt(Math.trunc(e.getTime()/1e3)),n=e.getTime()%1e3*1e6;return{seconds:t,nanos:n}}function wn(e){let t=(globalThis.Number(e.seconds.toString())||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function Qn(e){return e instanceof globalThis.Date?e:typeof e=="string"?new globalThis.Date(e):wn(Me.fromJSON(e))}function Gt(e){return BigInt(e.toString())}g.default.util.Long!==gi&&(g.default.util.Long=gi,g.default.configure());function Ve(e){return typeof e=="object"&&e!==null}function S(e){return e!=null}var tN=":sto_bi",wq=":sto_bd";function bq(e){return e.slice(0,128).replace(/[^_a-zA-Z0-9]/g,"_")}function mA(e){return e==="labels"?"labels_":bq(e)}function Eq(e){return e.length>1024?(console.warn(`${e} is exceed max length for value storage, will be truncate to 1024 characters`),e.slice(0,1024)):e}function gA(e){if(Object.keys(e).length===0)return e;let t={};for(let n in e)e[n]!==void 0?t[mA(n)]=Eq(e[n]):console.warn(`key: ${n} has empty value in attributes`);return t}function nN(e,t,n){let r;switch(typeof e){case"string":return e.slice(0,t);case"bigint":return e.toString()+tN;case"number":return e;case"function":return null;case"symbol":return null}if(Array.isArray(e))return console.warn(`Array type inside log/event payload is not currently supported and will be ignored. Path: ${n??""}`),null;if(e===Object(e)){if(e instanceof Date)return e.toISOString();if(e instanceof Ut)return e.isNaN()||!e.isFinite()?(console.error("can't submit NaN or Infinity value, will store as 0"),0):e.toString()+wq;if(nr.isBN(e))return e.toString(10)+tN;if(e instanceof Promise)return console.error("Cannot submit promise"),null;r={};for(let[a,s]of Object.entries(e)){let o=nN(s,t,`${n??""}.${a}`);o!=null&&(r[a]=o)}}else r=e;return r}function qd(e){return nN(e,1e3)}import{MapStateStorage as Iq}from"@sentio/runtime";import{ListStateStorage as Cq}from"@sentio/runtime";var _A=class extends Cq{},Zi=_A;en(Zi,"INSTANCE",new _A);var Xi=class{static register(t){Zi.INSTANCE.addValue(t)}static findEntity(t){for(let n of Zi.INSTANCE.getValues())if(n.entities[t])return n.entities[t]}};var AA=class extends Iq{},Ac=AA;en(Ac,"INSTANCE",new AA);var Jd=class{ctx;constructor(t){this.ctx=t}emit(t,n){aN(t),iN(this.ctx,t,n)}},Bie=St;function rN(e){let t=[];for(let[n,r]of Object.entries(e)){let i,a,s;typeof r=="number"?i=r:r.address||r.symbol?a=r:s=Wi.create({fields:rN(r)}),t.push({name:n,basicType:i,coinType:a,structType:s})}return t}var zd=class{eventName;config;constructor(t,n){this.eventName=t,this.config=n}static register(t,n){aN(t);let r=Ai.create();n?.fields&&(r=Ai.create({name:t,fields:rN(n.fields)}));let i=new zd(t,r);return Ac.INSTANCE.getOrSetValue(t,i)}emit(t,n){iN(t,this.eventName,n)}};function iN(e,t,n){let{distinctId:r,severity:i,message:a,...s}=n,o={metadata:e.getMetaData(t,{}),severity:i||xt.INFO,message:a||"",distinctEntityId:r||"",attributes:{...gA(e.baseLabels),...qd(s)},runtimeInfo:void 0,noMetric:!0};e.update({events:[o]})}function aN(e){if(Xi.findEntity(e))throw new Error(`Event name ${e} is already used in the database schema`)}function Gd(e){if(typeof e=="number"){if(Number.isNaN(e))throw new Error("Cannot record NaN value");if(!Number.isFinite(e))throw new Error("Cannot record infinite value");return Number.isInteger(e)&&!Number.isSafeInteger(e)?Nt.fromPartial({bigInteger:yA(e)}):Nt.fromPartial({doubleValue:Number(e)})}if(typeof e=="bigint")return Nt.fromPartial({bigInteger:yA(e)});if(typeof e=="string")return Nt.fromPartial({bigDecimal:e});if(e.isInteger())return Nt.fromPartial({bigInteger:sN(e)});if(e.isNaN())throw new Error("Cannot record NaN value");if(!e.isFinite())throw new Error("Cannot record infinite value");return Nt.fromPartial({bigDecimal:e.toString()})}function sN(e){let t=e.isNegative();return t&&(e=e.abs()),oN(e.toString(16),t)}function Vd(e){let t=e<0;return t&&(e=-e),oN(e.toString(16),t)}function yA(e){return typeof e=="number"||typeof e=="bigint"?Vd(e):typeof e=="string"?Vd(BigInt(e)):e instanceof Ut?sN(e):Vd(e)}function oN(e,t){e.length%2===1&&(e="0"+e);let n=Buffer.from(e,"hex");return{negative:t,data:new Uint8Array(n)}}var Yi=class{name;constructor(t){this.name=mA(t)}};import{MapStateStorage as Sq}from"@sentio/runtime";var vA=class{unit;description;sparse;aggregationConfig};var Wd=class extends Yi{config;constructor(t,n,r){super(n),this.config=zr.fromPartial({...r,name:this.name,type:t});let i=this.config.aggregationConfig;i&&i.intervalInMinutes.length&&(i.intervalInMinutes.length>1&&console.error("current only support one intervalInMinutes, only first interval will be used for",n),i.intervalInMinutes[0]>0&&i.types.length===0&&(i.types=[yt.SUM,yt.COUNT]))}},wA=class extends Sq{getOrRegisterMetric(t,n,r){let i=this.getOrRegister(),a=i.get(n);if(a&&a.config.type!==t)throw Error(`redefine ${n} of metric type ${t} that is previously ${a.config.type}`);return a||(t===Tt.COUNTER?a=Ha._create(n,r):a=Za._create(n,r)),i.set(n,a),a}},Wa=wA;en(Wa,"INSTANCE",new wA);var Ha=class extends Wd{static register(t,n){return Wa.INSTANCE.getOrRegisterMetric(Tt.COUNTER,t,n)}static _create(t,n){return new Ha(t,n)}constructor(t,n){super(Tt.COUNTER,t,zr.fromPartial({...n,aggregationConfig:{intervalInMinutes:n?.resolutionConfig?[n?.resolutionConfig?.intervalInMinutes]:[]}}))}add(t,n,r={}){this.record(t,n,r,!0)}sub(t,n,r={}){this.record(t,n,r,!1)}record(t,n,r,i){t.update({counters:[{metadata:t.getMetaData(this.name,r),metricValue:Gd(n),add:i,runtimeInfo:void 0}]})}},Hd=class{ctx;counter;constructor(t,n){this.counter=Ha._create(t),this.ctx=n}add(t,n={}){this.counter.add(this.ctx,t,n)}sub(t,n={}){this.counter.sub(this.ctx,t,n)}},Za=class extends Wd{static register(t,n){return Wa.INSTANCE.getOrRegisterMetric(Tt.GAUGE,t,n)}static _create(t,n){return new Za(t,n)}constructor(t,n){super(Tt.GAUGE,t,zr.fromPartial({...n}))}record(t,n,r={}){t.update({gauges:[{metadata:t.getMetaData(this.config.name,r),metricValue:Gd(n),runtimeInfo:void 0}]})}},Zd=class{gauge;ctx;constructor(t,n){this.gauge=Za._create(t),this.ctx=n}record(t,n={}){this.gauge.record(this.ctx,t,n)}},Vu=class{ctx;constructor(t){this.ctx=t}Counter(t){return new Hd(t,this.ctx)}Gauge(t){return new Zd(t,this.ctx)}};var gu=Tn(hk(),1);import{mergeProcessResults as Y9,PluginManager as $9}from"@sentio/runtime";var mk=new Error("Value is required but received null or undefined");function rce(e){let{from:t,to:n,...r}=e;return{from:i=>{if(i==null)throw mk;return t(i)},to:i=>{if(i==null||i.nullValue)throw mk;return n(i)},...r,required:!0}}function ice(e){return{from:t=>({listValue:{values:t.map(e.from)}}),to:t=>t.listValue?.values.map(e.to)||[],isArray:!0,isRelation:e.isRelation,relationName:e.relationName}}function ace(e){return{from:t=>t==null?{nullValue:At.NULL_VALUE}:{stringValue:e[t]},to(t){return t.stringValue}}}function sce(e){return{from:t=>typeof t=="string"?{stringValue:t}:t instanceof Uint8Array?{stringValue:`0x${Buffer.from(t).toString("hex")}`}:typeof t=="object"?{stringValue:t.id.toString()}:{nullValue:At.NULL_VALUE},to(t){return t.stringValue},isRelation:!0,relationName:e}}var Q9={from:e=>e==null?{nullValue:At.NULL_VALUE}:{stringValue:e},to(e){return e.stringValue}},U9={from:e=>e==null?{nullValue:At.NULL_VALUE}:{intValue:Math.floor(e)},to(e){return e.intValue}},q9={from:e=>e==null?{nullValue:At.NULL_VALUE}:{floatValue:e},to(e){return e.floatValue}},J9={from:e=>e==null?{nullValue:At.NULL_VALUE}:{boolValue:e},to(e){return e.boolValue}},z9={from:e=>e==null?{nullValue:At.NULL_VALUE}:{timestampValue:e},to(e){return e.timestampValue}},gk={from:e=>e==null?{nullValue:At.NULL_VALUE}:{bytesValue:e},to(e){return e.bytesValue}},V9={from(e){return typeof e=="string"?{stringValue:e}:e instanceof Uint8Array?{stringValue:`0x${Buffer.from(e).toString("hex")}`}:{nullValue:At.NULL_VALUE}},to(e){if(e.stringValue)return e.stringValue;if(e.bytesValue)return`0x${Buffer.from(e.bytesValue).toString("hex")}`}},G9={from:e=>{if(e==null)return{nullValue:At.NULL_VALUE};let t=(e.c||[]).join(""),n=-(t.length-(e.e??0)-1);return{bigdecimalValue:{value:sh(BigInt(t)),exp:n}}},to(e){let t=e.bigdecimalValue;if(t){let n=_k(t.value.data),r=new Ut(n.toString());return t.exp<0?r=r.dividedBy(new Ut(10).pow(-t.exp)):r=r.multipliedBy(new Ut(10).pow(t.exp)),r.multipliedBy(t.value?.negative?-1:1)}}},W9={from:e=>e==null?{nullValue:At.NULL_VALUE}:{bigintValue:sh(e)},to(e){if(e.bigintValue){let t=_k(e.bigintValue?.data);return e.bigintValue.negative&&(t=-t),t}}};function _k(e){let t=BigInt(0);for(let n=0;n<e.length;n++)t=t*BigInt(256)+BigInt(e[n]);return t}function sh(e){let t=e<0;t&&(e=-e);let n=e.toString(16);n.length%2===1&&(n="0"+n);let r=Buffer.from(n,"hex");return{negative:t,data:new Uint8Array(r)}}var oce={BigDecimal:G9,BigInt:W9,String:Q9,Boolean:J9,Uint8Array:gk,ID:V9,Bytes:gk,Int:U9,Float:q9,Timestamp:z9};import{PluginManager as H9}from"@sentio/runtime";var oh=class{cache=new Map;getKey(t,n){return`${t}-${n}`}has(t,n){return this.cache.has(this.getKey(t,n))}get(t,n){return this.cache.get(this.getKey(t,n))}set(t){let n=t.data?.fields.id.stringValue;if(n){let r=this.getKey(t.entity,n),i=t.data?.fields||{};if(this.cache.has(r)){let a=this.cache.get(r)?.data?.fields||{};i=Object.assign(a,i)}this.cache.set(r,{...t,data:{fields:i}})}}delete(t,n){n&&this.cache.delete(this.getKey(t,n))}};function ch(e){if(e==null)throw new Error("can't figure out entityName from undefined");if(typeof e=="string")return e;if(typeof e=="function")return e.entityName;if(typeof e=="object")return e.constructor.entityName;throw new Error(`can't figure out entityName from ${typeof e}`)}var Ml=class{constructor(t){this.context=t}cache=new oh;async get(t,n){let r=ch(t),i=this.cache.get(r,n);if(i)return Promise.resolve(this.newEntity(t,i));let s=await this.context.sendRequest({get:{entity:r,id:n.toString()}});if(s.entityList?.entities[0]){let o=s.entityList?.entities[0];return this.newEntity(t,o)}}async delete(t,n){let r={entity:[],id:[]},i=ch(t);if(n)if(Array.isArray(n))for(let a of n)r.entity.push(i),r.id.push(a.toString()),this.cache.delete(i,a.toString());else r.entity.push(i),r.id.push(n),this.cache.delete(i,n);else{let a=Array.isArray(t)?t:[t];for(let s of a)r.entity.push(i),r.id.push(s.id.toString()),this.cache.delete(i,n)}await this.context.sendRequest({delete:r})}async upsert(t){let n=Array.isArray(t)?t:[t],r={upsert:{entity:n.map(a=>ch(a)),id:n.map(a=>a.id.toString()),entityData:n.map(a=>a._data)}};return this.context.sendRequest(r).then(a=>{r.upsert?.entity.forEach((s,o)=>{this.cache.set({entity:s,data:r.upsert?.entityData[o],genBlockChain:"",genBlockTime:void 0,genBlockNumber:0n})})})}async*listIterator(t,n){let r;for(;;){let i=await this.listRequest(t,n||[],r);for(let a of i.entityList?.entities||[])yield this.newEntity(t,a);if(!i.nextCursor)break;r=i.nextCursor}}async*listBatched(t,n,r=100){let i;for(;;){let a=await this.listRequest(t,n||[],i,r);if(yield(a.entityList?.entities||[]).map(o=>this.newEntity(t,o)),!a.nextCursor)break;i=a.nextCursor}}async listRequest(t,n,r,i){let a=await this.context.sendRequest({list:{entity:ch(t),cursor:r,pageSize:i,filters:n?.map(s=>({field:s.field,op:Z9[s.op],value:{values:Array.isArray(s.value)?s.value.map(o=>Mw(o)):[Mw(s.value)]}}))||[]}},3600);return a.entityList?.entities?.forEach(s=>{this.cache.set(s)}),a}async list(t,n,r){if(r){let i=await this.listRequest(t,n||[],r.cursor,r.pageSize);return r.cursor=i.nextCursor,i.entityList?.entities.map(a=>this.newEntity(t,a))||[]}return this.fromAsync(this.listIterator(t,n??[]))}async fromAsync(t){let n=[];for await(let r of t)n.push(r);return n}newEntity(t,n){if(typeof t=="string"){let i=Xi.findEntity(t);if(!i&&(i=Xi.findEntity(n.entity),!i))throw new Error(`Entity ${t} not found`);t=i}let r=new t({});return r._data=n.data,r}},Z9={"=":ye.EQ,"!=":ye.NE,"<":ye.LT,"<=":ye.LE,">":ye.GT,">=":ye.GE,in:ye.IN,"not in":ye.NOT_IN,like:ye.LIKE,"not like":ye.NOT_LIKE,"has all":ye.HAS_ALL,"has any":ye.HAS_ANY};function Mw(e){return e==null?{nullValue:0}:typeof e=="boolean"?{boolValue:e}:typeof e=="string"?{stringValue:e}:typeof e=="number"?{floatValue:e}:typeof e=="bigint"?{bigintValue:sh(e)}:e instanceof Ut?X9(e):e instanceof Date?{timestampValue:e}:e instanceof Uint8Array?{bytesValue:e}:Array.isArray(e)?{listValue:{values:e.map(t=>Mw(t))}}:{nullValue:0}}function X9(e){return{bigdecimalValue:void 0}}function _ce(){let e=H9.INSTANCE.dbContextLocalStorage.getStore();if(e)return new Ml(e)}var Fw=class{meter;eventLogger;_store;baseLabels;active;_res={counters:[],events:[],exports:[],gauges:[],states:{configUpdated:!1}};update(t){if(this.active)this._res=Y9([this._res,vn.fromPartial(t)]);else throw new gu.ServerError(gu.Status.INTERNAL,"context not active, possible async function invoke without await")}constructor(t){this.meter=new Vu(this),this.eventLogger=new Jd(this),this.baseLabels=t||{},this.active=!0,this.initStore()}stopAndGetResult(){if(this.active)return this.active=!1,this._res;throw new gu.ServerError(gu.Status.INTERNAL,"Can't get result from same context twice")}metadataCache=new Map;getMetaData(t,n){if(Object.keys(n).length===0){let r=this.metadataCache.get(t);return r||(r={...this.baseLabels,...this.getMetaDataInternal(t,n)},this.metadataCache.set(t,r)),r}return{...this.baseLabels,...this.getMetaDataInternal(t,n)}}get store(){return this._store==null&&console.warn("Store is not set, please initialize the processor with your database schema first."),this._store}initStore(){let t=$9.INSTANCE.dbContextLocalStorage.getStore();t&&(this._store=new Ml(t))}};import{MapStateStorage as K9}from"@sentio/runtime";var Lw=class extends K9{},_u=Lw;en(_u,"INSTANCE",new Lw);var Fl=class extends Yi{static register(t,n){let r=new Fl(t,n);return _u.INSTANCE.getOrSetValue(t,r)}channel;constructor(t,n){super(t),this.channel=n}emit(t,n){let r={metadata:t.getMetaData(this.name,{}),payload:JSON.stringify(n),runtimeInfo:void 0};t.update({exports:[r]})}};import{MapStateStorage as j9}from"@sentio/runtime";var Uw=class extends j9{},ps=Uw;en(ps,"INSTANCE",new Uw);var lh=class extends Yi{static register(t,n){let r=new lh(t,{...lh.DEFAULT_OPTIONS,...n});return ps.INSTANCE.getOrSetValue(t,r)}options;constructor(t,n){super(t),this.options=n}trackEvent(t,n){let{distinctId:r,message:i,severity:a,...s}=n,o={message:i||"",severity:a||xt.INFO,metadata:t.getMetaData(this.name,{}),distinctEntityId:r||"",attributes:qd(s),runtimeInfo:void 0,noMetric:!1};t.update({events:[o]})}},uh=lh;en(uh,"DEFAULT_OPTIONS",{totalByDay:!0,unique:!0});var dh=class extends uh{static register(t,n){t?t=["user",t].join("_"):t="user";let r=new dh(t,{...dh.DEFAULT_OPTIONS,...n});return ps.INSTANCE.getOrSetValue(t,r)}},Qw=dh;en(Qw,"DEFAULT_OPTIONS",{totalByDay:!0,unique:!0,distinctByDays:[1,7,30]});import{Plugin as tZ,PluginManager as nZ}from"@sentio/runtime";import{ListStateStorage as eZ}from"@sentio/runtime";var qw=class extends eZ{},Ll=qw;en(Ll,"INSTANCE",new qw);var fh=class extends tZ{name="CorePlugin";async configure(t){t.templateInstances=[...Ll.INSTANCE.getValues()];for(let n of Wa.INSTANCE.getValues())t.metricConfigs.push({...n.config});for(let n of Ac.INSTANCE.getValues())t.eventLogConfigs.push({...n.config});for(let n of ps.INSTANCE.getValues())t.eventTrackingConfigs.push({distinctAggregationByDays:n.options.distinctByDays||[],eventName:n.name,retentionConfig:void 0,totalByDay:n.options.totalByDay||!1,totalPerEntity:void 0,unique:n.options.unique||!1});for(let n of _u.INSTANCE.getValues())t.exportConfigs.push({name:n.name,channel:n.channel});Zi.INSTANCE.getValues().length>0&&(t.dbSchema={gqlSchema:Zi.INSTANCE.getValues().map(n=>n.source).join(`
|
|
918
|
+
${JSON.stringify(this.#e,null,2)}`}byteLength(){return this.toBytes().byteLength}},y6=e=>Th+xh({maxInputs:e}),vne=ue+xa+Zl+ue+ue;function v6(e){let t=[...e.receipts],n,r;if(t.forEach(a=>{a.type===le.ScriptResult?n=a:(a.type===le.Return||a.type===le.ReturnData||a.type===le.Revert)&&(r=a)}),!n||!r)throw new v(x.SCRIPT_REVERTED,"Transaction reverted.");return{code:n.result,gasUsed:n.gasUsed,receipts:t,scriptResultReceipt:n,returnReceipt:r,callResult:e}}function J_(e,t,n=[]){try{let r=v6(e);return t(r)}catch(r){if(r.code===x.SCRIPT_REVERTED){let i=e?.dryRunStatus?.reason;throw Nd({logs:n,receipts:e.receipts,statusReason:i})}throw r}}function w6(e,t,n){return J_(e,r=>{if(r.returnReceipt.type===le.Revert)throw new v(x.SCRIPT_REVERTED,`Script Reverted. Logs: ${JSON.stringify(n)}`);if(r.returnReceipt.type!==le.Return&&r.returnReceipt.type!==le.ReturnData){let{type:a}=r.returnReceipt;throw new v(x.SCRIPT_REVERTED,`Script Return Type [${a}] Invalid. Logs: ${JSON.stringify({logs:n,receipt:r.returnReceipt})}`)}let i;return r.returnReceipt.type===le.Return&&(i=r.returnReceipt.val),r.returnReceipt.type===le.ReturnData&&(i=t.func.decodeOutput(r.returnReceipt.data)[0]),i},n)}var Qu=class{bytes;scriptDataEncoder;scriptResultDecoder;constructor(e,t,n){this.bytes=P(e),this.scriptDataEncoder=t,this.scriptResultDecoder=n}static getScriptDataOffsetWithScriptBytes(e,t){return xh({maxInputs:t})+Th+e}getScriptDataOffset(e){return Qu.getScriptDataOffsetWithScriptBytes(this.bytes.length,e)}encodeScriptData(e){let t=this.scriptDataEncoder(e);return ArrayBuffer.isView(t)?t:(this.bytes=P(t.script),t.data)}decodeCallResult(e,t=[]){return J_(e,this.scriptResultDecoder,t)}},cI={assetIdOffset:0,amountOffset:0,gasForwardedOffset:0,callDataOffset:0},b6=xe,uI=({callDataOffset:e,gasForwardedOffset:t,amountOffset:n,assetIdOffset:r})=>{let i=new q_(Mt.movi(16,e),Mt.movi(17,n),Mt.lw(17,17,0),Mt.movi(18,r));return t?i.push(Mt.movi(19,t),Mt.lw(19,19,0),Mt.call(16,17,18,19)):i.push(Mt.call(16,17,18,Mt.RegId.cgas().to_u8())),i};function iI(e){if(!e.length)return new Uint8Array;let t=new q_;for(let n=0;n<e.length;n+=1)t.extend(uI(e[n]).entries());return t.push(Mt.ret(1)),t.toBytes()}var E6=e=>e===le.Return||e===le.ReturnData,C6=(e,t)=>e.find(({type:n,from:r,to:i})=>n===le.Call&&r===b6&&i===t),I6=e=>t=>{if(Nn(t.code)!==0)throw new v(x.SCRIPT_REVERTED,"Transaction reverted.");let n=C6(t.receipts,e.toB256()),r=C(n?.is);return t.receipts.filter(({type:a})=>E6(a)).flatMap(a=>r.eq(C(a.is))?a.type===le.Return?[new H("u64").encode(a.val)]:a.type===le.ReturnData?[P(a.data)]:[new Uint8Array]:[])},S6=(e,t,n=[])=>J_(e,I6(t),n),x6=e=>e.reduce((t,n)=>{let r={...cI};return n.gas&&(r.gasForwardedOffset=1),t+uI(r).byteLength()},Mt.Instruction.size()),T6=(e,t)=>new Qu(iI(new Array(e.length).fill(cI)),n=>{let r=n.length;if(r===0)return{data:new Uint8Array,script:new Uint8Array};let i=x6(n),a=(8-i%8)%8,s=i+a,o=y6(t.toNumber())+s,c=[],u=o,d=[];for(let _=0;_<r;_+=1){let w=n[_],A=u,I=A+ue,b=I+xa,T=b+Zl+ue+ue,k=T+w.fnSelectorBytes.byteLength,O=P(w.data),V=0;d.push(new H("u64").encode(w.amount||0)),d.push(new X().encode(w.assetId?.toString()||xe)),d.push(w.contractId.toBytes()),d.push(new H("u64").encode(T)),d.push(new H("u64").encode(k)),d.push(w.fnSelectorBytes),d.push(O),w.gas&&(d.push(new H("u64").encode(w.gas)),V=k+O.byteLength);let Q={amountOffset:A,assetIdOffset:I,gasForwardedOffset:V,callDataOffset:b};c.push(Q),u=o+te(d).byteLength}let p=iI(c);return{data:te(d),script:p}},()=>[new Uint8Array]),lI=(e,t,n,r)=>{let i=e[0]?.getCallConfig();if(e.length===1&&i&&"bytes"in i.program)return w6({receipts:t},i,r);let s=S6({receipts:t},(i?.program).id,r).map((o,c)=>{let{func:u}=e[c].getCallConfig();return u.decodeOutput(o)?.[0]});return n?s:s?.[0]},N6=async e=>{let{funcScope:t,isMultiCall:n,program:r,transactionResponse:i}=e,a=await i.waitForResult(),{receipts:s}=a,o=Array.isArray(t)?t:[t],c=o[0]?.getCallConfig(),u=sI(s,c,o),d=lI(o,s,n,u),p=Fu(s);return{isMultiCall:n,functionScopes:o,value:d,program:r,transactionResult:a,transactionResponse:i,transactionId:i.id,logs:u,gasUsed:p}},U_=e=>{let{funcScopes:t,callResult:n,isMultiCall:r}=e,{receipts:i}=n,a=Array.isArray(t)?t:[t],s=a[0]?.getCallConfig(),o=sI(i,s,a),c=lI(a,i,r,o),u=Fu(i);return{functionScopes:a,callResult:n,isMultiCall:r,gasUsed:u,value:c}};function R6(e){let{program:t,args:n,forward:r,func:i,callParameters:a,externalAbis:s}=e.getCallConfig(),o=i.encodeArguments(n);return{contractId:t.id,fnSelectorBytes:i.selectorBytes,data:o,assetId:r?.assetId,amount:r?.amount,gas:a?.gasLimit,externalContractsAbis:s}}var dI=class{transactionRequest;program;functionInvocationScopes=[];txParameters;requiredCoins=[];isMultiCall=!1;hasCallParamsGasLimit=!1;externalAbis={};addSignersCallback;constructor(e,t){this.program=e,this.isMultiCall=t,this.transactionRequest=new qi}get calls(){if(!this.getProvider().getChain())throw new v(v.CODES.CHAIN_INFO_CACHE_EMPTY,"Provider chain info cache is empty. Please make sure to initialize the `Provider` properly by running `await Provider.create()``");return this.functionInvocationScopes.map(n=>R6(n))}updateScriptRequest(){let e=this.getProvider(),{consensusParameters:{txParameters:{maxInputs:t}}}=e.getChain(),n=T6(this.functionInvocationScopes,t);this.transactionRequest.setScript(n,this.calls)}updateContractInputAndOutput(){this.calls.forEach(t=>{t.contractId&&this.transactionRequest.addContractInputAndOutput(t.contractId),t.externalContractsAbis&&Object.keys(t.externalContractsAbis).forEach(n=>this.transactionRequest.addContractInputAndOutput(oe.fromB256(n)))})}getRequiredCoins(){return this.calls.map(t=>({assetId:String(t.assetId),amount:C(t.amount||0)})).filter(({assetId:t,amount:n})=>t&&!C(n).isZero())}updateRequiredCoins(){let e=this.getRequiredCoins(),t=(n,{assetId:r,amount:i})=>{let a=n.get(r)?.amount||C(0);return n.set(r,{assetId:String(r),amount:a.add(i)})};this.requiredCoins=Array.from(e.reduce(t,new Map).values())}addCall(e){return this.addCalls([e]),this}addCalls(e){return this.functionInvocationScopes.push(...e),this.updateContractInputAndOutput(),this.updateRequiredCoins(),this}async prepareTransaction(){await oI.initWasm(),this.updateScriptRequest(),this.updateRequiredCoins(),this.checkGasLimitTotal(),this.transactionRequest.type===Je.Script&&(this.transactionRequest.abis=aI(this.functionInvocationScopes))}checkGasLimitTotal(){let e=this.calls.reduce((t,n)=>t.add(n.gas||0),C(0));if(this.transactionRequest.gasLimit.eq(0))this.transactionRequest.gasLimit=e;else if(e.gt(this.transactionRequest.gasLimit))throw new v(x.TRANSACTION_ERROR,"Transaction's gasLimit must be equal to or greater than the combined forwarded gas of all calls.")}async getTransactionCost(){let e=qt(await this.getTransactionRequest());return(this.program.account??Jt.generate({provider:this.getProvider()})).getTransactionCost(e,{quantities:this.getRequiredCoins(),signatureCallback:this.addSignersCallback})}async fundWithRequiredCoins(){let e=await this.getTransactionRequest();e=qt(e);let t=await this.getTransactionCost(),{gasUsed:n,missingContractIds:r,outputVariables:i,maxFee:a}=t;return this.setDefaultTxParams(e,n,a),e.inputs=e.inputs.filter(s=>s.type!==ve.Coin),r.forEach(s=>{e.addContractInputAndOutput(oe.fromString(s))}),e.addVariableOutputs(i),await this.program.account?.fund(e,t),this.addSignersCallback&&await this.addSignersCallback(e),e}txParams(e){this.txParameters=e;let t=this.transactionRequest;return t.tip=C(e.tip||t.tip),t.gasLimit=C(e.gasLimit||t.gasLimit),t.maxFee=e.maxFee?C(e.maxFee):t.maxFee,t.witnessLimit=e.witnessLimit?C(e.witnessLimit):t.witnessLimit,t.maturity=e.maturity||t.maturity,t.addVariableOutputs(this.txParameters?.variableOutputs||0),this}addContracts(e){return e.forEach(t=>{this.transactionRequest.addContractInputAndOutput(t.id),this.externalAbis[t.id.toB256()]=t.interface.jsonAbi}),this}addTransfer(e){let{amount:t,destination:n,assetId:r}=e,i=this.getProvider().getBaseAssetId();return this.transactionRequest=this.transactionRequest.addCoinOutput(oe.fromAddressOrString(n),t,r||i),this}addBatchTransfer(e){let t=this.getProvider().getBaseAssetId();return e.forEach(({destination:n,amount:r,assetId:i})=>{this.transactionRequest=this.transactionRequest.addCoinOutput(oe.fromAddressOrString(n),r,i||t)}),this}addSigners(e){return this.addSignersCallback=async t=>t.addAccountWitnesses(e),this}async getTransactionRequest(){return await this.prepareTransaction(),this.transactionRequest}async call(){rI(this.program.account,"Wallet is required!");let e=await this.fundWithRequiredCoins(),t=await this.program.account.sendTransaction(e,{estimateTxDependencies:!1});return{transactionId:t.id,waitForResult:async()=>N6({funcScope:this.functionInvocationScopes,isMultiCall:this.isMultiCall,program:this.program,transactionResponse:t})}}async simulate(){if(rI(this.program.account,"Wallet is required!"),!("populateTransactionWitnessesSignature"in this.program.account))throw new v(x.ABI_MAIN_METHOD_MISSING,"An unlocked wallet is required to simulate a contract call.");let e=await this.fundWithRequiredCoins(),t=await this.program.account.simulateTransaction(e,{estimateTxDependencies:!1});return U_({funcScopes:this.functionInvocationScopes,callResult:t,isMultiCall:this.isMultiCall})}async dryRun(){let{receipts:e}=await this.getTransactionCost(),t={receipts:e};return U_({funcScopes:this.functionInvocationScopes,callResult:t,isMultiCall:this.isMultiCall})}async get(){let{receipts:e}=await this.getTransactionCost(),t={receipts:e};return U_({funcScopes:this.functionInvocationScopes,callResult:t,isMultiCall:this.isMultiCall})}getProvider(){return this.program.provider}async getTransactionId(e){let t=e??await this.getProvider().getChainId();return(await this.getTransactionRequest()).getTransactionId(t)}setDefaultTxParams(e,t,n){let r=Rn(this.txParameters?.gasLimit)||this.hasCallParamsGasLimit,i=Rn(this.txParameters?.maxFee),{gasLimit:a,maxFee:s}=e;if(!r)e.gasLimit=t;else if(a.lt(t))throw new v(x.GAS_LIMIT_TOO_LOW,`Gas limit '${a}' is lower than the required: '${t}'.`);if(!i)e.maxFee=n;else if(n.gt(s))throw new v(x.MAX_FEE_TOO_LOW,`Max fee '${s}' is lower than the required: '${n}'.`)}},fI=class extends dI{func;callParameters;forward;args;constructor(e,t,n){super(e,!1),this.func=t,this.args=n||[],this.setArguments(...n),super.addCall(this)}getCallConfig(){return{func:this.func,program:this.program,callParameters:this.callParameters,txParameters:this.txParameters,forward:this.forward,args:this.args,externalAbis:this.externalAbis}}setArguments(...e){return this.args=e||[],this}callParams(e){if(!this.hasCallParamsGasLimit&&e?.gasLimit!==void 0&&(this.hasCallParamsGasLimit=!0),this.callParameters=e,e?.forward){if(!this.func.attributes.find(t=>t.name==="payable"))throw new v(x.TRANSACTION_ERROR,`The target function ${this.func.name} cannot accept forwarded funds as it's not marked as 'payable'.`);this.forward=xd(e.forward)}return this.setArguments(...this.args),this.updateRequiredCoins(),this}},B6=class extends dI{constructor(e,t){super(e,!0),this.addCalls(t)}addCall(e){return super.addCalls([e])}addCalls(e){return super.addCalls(e)}},k6=class{id;provider;interface;account;functions={};constructor(e,t,n){this.interface=t instanceof Bn?t:new Bn(t),this.id=oe.fromAddressOrString(e),n&&"provider"in n?(this.provider=n.provider,this.account=n):(this.provider=n,this.account=null),Object.keys(this.interface.functions).forEach(r=>{let i=this.interface.getFunction(r);Object.defineProperty(this.functions,i.name,{value:this.buildFunction(i),writable:!1})})}buildFunction(e){return(()=>{let t=(...n)=>new fI(this,e,n);return Object.defineProperty(t,"isReadOnly",{value:()=>e.isReadOnly(),writable:!1}),t})()}multiCall(e){return new B6(this,e)}getBalance(e){return this.provider.getContractBalance(this.id,e)}};var Qne=new Qu("0x24000000",()=>new Uint8Array(0),()=>{});var Qr=Tn(Bu(),1);var O6=Object.defineProperty,P6=(e,t)=>{for(var n in t)O6(e,n,{get:t[n],enumerable:!0})};var D6={};P6(D6,{getContractId:()=>F6,getContractRoot:()=>pI,getContractStorageRoot:()=>M6,hexlifyWithPrefix:()=>L6});var pI=e=>{let n=P(e),r=hh(n,16384);return p_(r.map(i=>L(i)))},M6=e=>{let t=new cC;return e.forEach(({key:n,value:r})=>t.update(Ke(n),r)),t.root},F6=(e,t,n)=>{let r=pI(P(e));return Ke(te(["0x4655454C",t,r,n]))},L6=e=>L(e.startsWith("0x")?e:`0x${e}`);BigInt.prototype.asBigDecimal=function(){return new Ut(this.toString())};BigInt.prototype.scaleDown=function(e){return z_(this,e)};nr.prototype.asBigDecimal=function(){return new Ut(this.toString(10))};nr.prototype.scaleDown=function(e){return z_(BigInt(this.toString(10)),e)};function z_(e,t){let n=new Ut(10).pow(Number(t));return e.asBigDecimal().dividedBy(n)}var Pn=null;try{Pn=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function Ze(e,t,n){this.low=e|0,this.high=t|0,this.unsigned=!!n}Ze.prototype.__isLong__;Object.defineProperty(Ze.prototype,"__isLong__",{value:!0});function zt(e){return(e&&e.__isLong__)===!0}function hI(e){var t=Math.clz32(e&-e);return e?31-t:t}Ze.isLong=zt;var mI={},gI={};function qa(e,t){var n,r,i;return t?(e>>>=0,(i=0<=e&&e<256)&&(r=gI[e],r)?r:(n=Oe(e,0,!0),i&&(gI[e]=n),n)):(e|=0,(i=-128<=e&&e<128)&&(r=mI[e],r)?r:(n=Oe(e,e<0?-1:0,!1),i&&(mI[e]=n),n))}Ze.fromInt=qa;function Dn(e,t){if(isNaN(e))return t?mi:or;if(t){if(e<0)return mi;if(e>=vI)return EI}else{if(e<=-AI)return un;if(e+1>=AI)return bI}return e<0?Dn(-e,t).neg():Oe(e%eo|0,e/eo|0,t)}Ze.fromNumber=Dn;function Oe(e,t,n){return new Ze(e,t,n)}Ze.fromBits=Oe;var Od=Math.pow;function G_(e,t,n){if(e.length===0)throw Error("empty string");if(typeof t=="number"?(n=t,t=!1):t=!!t,e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return t?mi:or;if(n=n||10,n<2||36<n)throw RangeError("radix");var r;if((r=e.indexOf("-"))>0)throw Error("interior hyphen");if(r===0)return G_(e.substring(1),t,n).neg();for(var i=Dn(Od(n,8)),a=or,s=0;s<e.length;s+=8){var o=Math.min(8,e.length-s),c=parseInt(e.substring(s,s+o),n);if(o<8){var u=Dn(Od(n,o));a=a.mul(u).add(Dn(c))}else a=a.mul(i),a=a.add(Dn(c))}return a.unsigned=t,a}Ze.fromString=G_;function cr(e,t){return typeof e=="number"?Dn(e,t):typeof e=="string"?G_(e,t):Oe(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}Ze.fromValue=cr;var _I=65536,Q6=1<<24,eo=_I*_I,vI=eo*eo,AI=vI/2,yI=qa(Q6),or=qa(0);Ze.ZERO=or;var mi=qa(0,!0);Ze.UZERO=mi;var js=qa(1);Ze.ONE=js;var wI=qa(1,!0);Ze.UONE=wI;var V_=qa(-1);Ze.NEG_ONE=V_;var bI=Oe(-1,2147483647,!1);Ze.MAX_VALUE=bI;var EI=Oe(-1,-1,!0);Ze.MAX_UNSIGNED_VALUE=EI;var un=Oe(0,-2147483648,!1);Ze.MIN_VALUE=un;var W=Ze.prototype;W.toInt=function(){return this.unsigned?this.low>>>0:this.low};W.toNumber=function(){return this.unsigned?(this.high>>>0)*eo+(this.low>>>0):this.high*eo+(this.low>>>0)};W.toString=function(t){if(t=t||10,t<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(un)){var n=Dn(t),r=this.div(n),i=r.mul(n).sub(this);return r.toString(t)+i.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var a=Dn(Od(t,6),this.unsigned),s=this,o="";;){var c=s.div(a),u=s.sub(c.mul(a)).toInt()>>>0,d=u.toString(t);if(s=c,s.isZero())return d+o;for(;d.length<6;)d="0"+d;o=""+d+o}};W.getHighBits=function(){return this.high};W.getHighBitsUnsigned=function(){return this.high>>>0};W.getLowBits=function(){return this.low};W.getLowBitsUnsigned=function(){return this.low>>>0};W.getNumBitsAbs=function(){if(this.isNegative())return this.eq(un)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,n=31;n>0&&!(t&1<<n);n--);return this.high!=0?n+33:n+1};W.isZero=function(){return this.high===0&&this.low===0};W.eqz=W.isZero;W.isNegative=function(){return!this.unsigned&&this.high<0};W.isPositive=function(){return this.unsigned||this.high>=0};W.isOdd=function(){return(this.low&1)===1};W.isEven=function(){return(this.low&1)===0};W.equals=function(t){return zt(t)||(t=cr(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low};W.eq=W.equals;W.notEquals=function(t){return!this.eq(t)};W.neq=W.notEquals;W.ne=W.notEquals;W.lessThan=function(t){return this.comp(t)<0};W.lt=W.lessThan;W.lessThanOrEqual=function(t){return this.comp(t)<=0};W.lte=W.lessThanOrEqual;W.le=W.lessThanOrEqual;W.greaterThan=function(t){return this.comp(t)>0};W.gt=W.greaterThan;W.greaterThanOrEqual=function(t){return this.comp(t)>=0};W.gte=W.greaterThanOrEqual;W.ge=W.greaterThanOrEqual;W.compare=function(t){if(zt(t)||(t=cr(t)),this.eq(t))return 0;var n=this.isNegative(),r=t.isNegative();return n&&!r?-1:!n&&r?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1};W.comp=W.compare;W.negate=function(){return!this.unsigned&&this.eq(un)?un:this.not().add(js)};W.neg=W.negate;W.add=function(t){zt(t)||(t=cr(t));var n=this.high>>>16,r=this.high&65535,i=this.low>>>16,a=this.low&65535,s=t.high>>>16,o=t.high&65535,c=t.low>>>16,u=t.low&65535,d=0,p=0,h=0,_=0;return _+=a+u,h+=_>>>16,_&=65535,h+=i+c,p+=h>>>16,h&=65535,p+=r+o,d+=p>>>16,p&=65535,d+=n+s,d&=65535,Oe(h<<16|_,d<<16|p,this.unsigned)};W.subtract=function(t){return zt(t)||(t=cr(t)),this.add(t.neg())};W.sub=W.subtract;W.multiply=function(t){if(this.isZero())return this;if(zt(t)||(t=cr(t)),Pn){var n=Pn.mul(this.low,this.high,t.low,t.high);return Oe(n,Pn.get_high(),this.unsigned)}if(t.isZero())return this.unsigned?mi:or;if(this.eq(un))return t.isOdd()?un:or;if(t.eq(un))return this.isOdd()?un:or;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(yI)&&t.lt(yI))return Dn(this.toNumber()*t.toNumber(),this.unsigned);var r=this.high>>>16,i=this.high&65535,a=this.low>>>16,s=this.low&65535,o=t.high>>>16,c=t.high&65535,u=t.low>>>16,d=t.low&65535,p=0,h=0,_=0,w=0;return w+=s*d,_+=w>>>16,w&=65535,_+=a*d,h+=_>>>16,_&=65535,_+=s*u,h+=_>>>16,_&=65535,h+=i*d,p+=h>>>16,h&=65535,h+=a*u,p+=h>>>16,h&=65535,h+=s*c,p+=h>>>16,h&=65535,p+=r*d+i*u+a*c+s*o,p&=65535,Oe(_<<16|w,p<<16|h,this.unsigned)};W.mul=W.multiply;W.divide=function(t){if(zt(t)||(t=cr(t)),t.isZero())throw Error("division by zero");if(Pn){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var n=(this.unsigned?Pn.div_u:Pn.div_s)(this.low,this.high,t.low,t.high);return Oe(n,Pn.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?mi:or;var r,i,a;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return mi;if(t.gt(this.shru(1)))return wI;a=mi}else{if(this.eq(un)){if(t.eq(js)||t.eq(V_))return un;if(t.eq(un))return js;var s=this.shr(1);return r=s.div(t).shl(1),r.eq(or)?t.isNegative()?js:V_:(i=this.sub(t.mul(r)),a=r.add(i.div(t)),a)}else if(t.eq(un))return this.unsigned?mi:or;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();a=or}for(i=this;i.gte(t);){r=Math.max(1,Math.floor(i.toNumber()/t.toNumber()));for(var o=Math.ceil(Math.log(r)/Math.LN2),c=o<=48?1:Od(2,o-48),u=Dn(r),d=u.mul(t);d.isNegative()||d.gt(i);)r-=c,u=Dn(r,this.unsigned),d=u.mul(t);u.isZero()&&(u=js),a=a.add(u),i=i.sub(d)}return a};W.div=W.divide;W.modulo=function(t){if(zt(t)||(t=cr(t)),Pn){var n=(this.unsigned?Pn.rem_u:Pn.rem_s)(this.low,this.high,t.low,t.high);return Oe(n,Pn.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};W.mod=W.modulo;W.rem=W.modulo;W.not=function(){return Oe(~this.low,~this.high,this.unsigned)};W.countLeadingZeros=function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32};W.clz=W.countLeadingZeros;W.countTrailingZeros=function(){return this.low?hI(this.low):hI(this.high)+32};W.ctz=W.countTrailingZeros;W.and=function(t){return zt(t)||(t=cr(t)),Oe(this.low&t.low,this.high&t.high,this.unsigned)};W.or=function(t){return zt(t)||(t=cr(t)),Oe(this.low|t.low,this.high|t.high,this.unsigned)};W.xor=function(t){return zt(t)||(t=cr(t)),Oe(this.low^t.low,this.high^t.high,this.unsigned)};W.shiftLeft=function(t){return zt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?Oe(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):Oe(0,this.low<<t-32,this.unsigned)};W.shl=W.shiftLeft;W.shiftRight=function(t){return zt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?Oe(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):Oe(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};W.shr=W.shiftRight;W.shiftRightUnsigned=function(t){return zt(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?Oe(this.low>>>t|this.high<<32-t,this.high>>>t,this.unsigned):t===32?Oe(this.high,0,this.unsigned):Oe(this.high>>>t-32,0,this.unsigned)};W.shru=W.shiftRightUnsigned;W.shr_u=W.shiftRightUnsigned;W.rotateLeft=function(t){var n;return zt(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?Oe(this.high,this.low,this.unsigned):t<32?(n=32-t,Oe(this.low<<t|this.high>>>n,this.high<<t|this.low>>>n,this.unsigned)):(t-=32,n=32-t,Oe(this.high<<t|this.low>>>n,this.low<<t|this.high>>>n,this.unsigned))};W.rotl=W.rotateLeft;W.rotateRight=function(t){var n;return zt(t)&&(t=t.toInt()),(t&=63)===0?this:t===32?Oe(this.high,this.low,this.unsigned):t<32?(n=32-t,Oe(this.high<<n|this.low>>>t,this.low<<n|this.high>>>t,this.unsigned)):(t-=32,n=32-t,Oe(this.low<<n|this.high>>>t,this.high<<n|this.low>>>t,this.unsigned))};W.rotr=W.rotateRight;W.toSigned=function(){return this.unsigned?Oe(this.low,this.high,!1):this};W.toUnsigned=function(){return this.unsigned?this:Oe(this.low,this.high,!0)};W.toBytes=function(t){return t?this.toBytesLE():this.toBytesBE()};W.toBytesLE=function(){var t=this.high,n=this.low;return[n&255,n>>>8&255,n>>>16&255,n>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]};W.toBytesBE=function(){var t=this.high,n=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,n>>>24,n>>>16&255,n>>>8&255,n&255]};Ze.fromBytes=function(t,n,r){return r?Ze.fromBytesLE(t,n):Ze.fromBytesBE(t,n)};Ze.fromBytesLE=function(t,n){return new Ze(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,n)};Ze.fromBytesBE=function(t,n){return new Ze(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],n)};var gi=Ze;var g=Tn(no(),1);var Ud=Tn(no(),1);function mS(){return{}}var zu={encode(e,t=Ud.default.Writer.create()){return t},decode(e,t){let n=e instanceof Ud.default.Reader?e:Ud.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=mS();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{}},toJSON(e){return{}},create(e){return zu.fromPartial(e??{})},fromPartial(e){return mS()}};var yn=Tn(no(),1),Va;(function(e){e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Va||(Va={}));function X6(e){switch(e){case 0:case"NULL_VALUE":return Va.NULL_VALUE;case-1:case"UNRECOGNIZED":default:return Va.UNRECOGNIZED}}function Y6(e){switch(e){case Va.NULL_VALUE:return"NULL_VALUE";case Va.UNRECOGNIZED:default:return"UNRECOGNIZED"}}function cA(){return{fields:{}}}var M={encode(e,t=yn.default.Writer.create()){return Object.entries(e.fields).forEach(([n,r])=>{r!==void 0&&dA.encode({key:n,value:r},t.uint32(10).fork()).ldelim()}),t},decode(e,t){let n=e instanceof yn.default.Reader?e:yn.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=cA();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;let s=dA.decode(n,n.uint32());s.value!==void 0&&(i.fields[s.key]=s.value);continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{fields:_S(e.fields)?Object.entries(e.fields).reduce((t,[n,r])=>(t[n]=r,t),{}):{}}},toJSON(e){let t={};if(e.fields){let n=Object.entries(e.fields);n.length>0&&(t.fields={},n.forEach(([r,i])=>{t.fields[r]=i}))}return t},create(e){return M.fromPartial(e??{})},fromPartial(e){let t=cA();return t.fields=Object.entries(e.fields??{}).reduce((n,[r,i])=>(i!==void 0&&(n[r]=i),n),{}),t},wrap(e){let t=cA();if(e!==void 0)for(let n of Object.keys(e))t.fields[n]=e[n];return t},unwrap(e){let t={};if(e.fields)for(let n of Object.keys(e.fields))t[n]=e.fields[n];return t}};function gS(){return{key:"",value:void 0}}var dA={encode(e,t=yn.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&_i.encode(_i.wrap(e.value),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof yn.default.Reader?e:yn.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=gS();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.key=n.string();continue;case 2:if(a!==18)break;i.value=_i.unwrap(_i.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{key:ro(e.key)?globalThis.String(e.key):"",value:ro(e?.value)?e.value:void 0}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==void 0&&(t.value=e.value),t},create(e){return dA.fromPartial(e??{})},fromPartial(e){let t=gS();return t.key=e.key??"",t.value=e.value??void 0,t}};function uA(){return{nullValue:void 0,numberValue:void 0,stringValue:void 0,boolValue:void 0,structValue:void 0,listValue:void 0}}var _i={encode(e,t=yn.default.Writer.create()){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.numberValue!==void 0&&t.uint32(17).double(e.numberValue),e.stringValue!==void 0&&t.uint32(26).string(e.stringValue),e.boolValue!==void 0&&t.uint32(32).bool(e.boolValue),e.structValue!==void 0&&M.encode(M.wrap(e.structValue),t.uint32(42).fork()).ldelim(),e.listValue!==void 0&&Jr.encode(Jr.wrap(e.listValue),t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof yn.default.Reader?e:yn.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=uA();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.nullValue=n.int32();continue;case 2:if(a!==17)break;i.numberValue=n.double();continue;case 3:if(a!==26)break;i.stringValue=n.string();continue;case 4:if(a!==32)break;i.boolValue=n.bool();continue;case 5:if(a!==42)break;i.structValue=M.unwrap(M.decode(n,n.uint32()));continue;case 6:if(a!==50)break;i.listValue=Jr.unwrap(Jr.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{nullValue:ro(e.nullValue)?X6(e.nullValue):void 0,numberValue:ro(e.numberValue)?globalThis.Number(e.numberValue):void 0,stringValue:ro(e.stringValue)?globalThis.String(e.stringValue):void 0,boolValue:ro(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,structValue:_S(e.structValue)?e.structValue:void 0,listValue:globalThis.Array.isArray(e.listValue)?[...e.listValue]:void 0}},toJSON(e){let t={};return e.nullValue!==void 0&&(t.nullValue=Y6(e.nullValue)),e.numberValue!==void 0&&(t.numberValue=e.numberValue),e.stringValue!==void 0&&(t.stringValue=e.stringValue),e.boolValue!==void 0&&(t.boolValue=e.boolValue),e.structValue!==void 0&&(t.structValue=e.structValue),e.listValue!==void 0&&(t.listValue=e.listValue),t},create(e){return _i.fromPartial(e??{})},fromPartial(e){let t=uA();return t.nullValue=e.nullValue??void 0,t.numberValue=e.numberValue??void 0,t.stringValue=e.stringValue??void 0,t.boolValue=e.boolValue??void 0,t.structValue=e.structValue??void 0,t.listValue=e.listValue??void 0,t},wrap(e){let t=uA();if(e===null)t.nullValue=Va.NULL_VALUE;else if(typeof e=="boolean")t.boolValue=e;else if(typeof e=="number")t.numberValue=e;else if(typeof e=="string")t.stringValue=e;else if(globalThis.Array.isArray(e))t.listValue=e;else if(typeof e=="object")t.structValue=e;else if(typeof e<"u")throw new globalThis.Error("Unsupported any value type: "+typeof e);return t},unwrap(e){if(e.stringValue!==void 0)return e.stringValue;if(e?.numberValue!==void 0)return e.numberValue;if(e?.boolValue!==void 0)return e.boolValue;if(e?.structValue!==void 0)return e.structValue;if(e?.listValue!==void 0)return e.listValue;if(e?.nullValue!==void 0)return null}};function lA(){return{values:[]}}var Jr={encode(e,t=yn.default.Writer.create()){for(let n of e.values)_i.encode(_i.wrap(n),t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof yn.default.Reader?e:yn.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=lA();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.values.push(_i.unwrap(_i.decode(n,n.uint32())));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{values:globalThis.Array.isArray(e?.values)?[...e.values]:[]}},toJSON(e){let t={};return e.values?.length&&(t.values=e.values),t},create(e){return Jr.fromPartial(e??{})},fromPartial(e){let t=lA();return t.values=e.values?.map(n=>n)||[],t},wrap(e){let t=lA();return t.values=e??[],t},unwrap(e){return e?.hasOwnProperty("values")&&globalThis.Array.isArray(e.values)?e.values:e}};function _S(e){return typeof e=="object"&&e!==null}function ro(e){return e!=null}var Ga=Tn(no(),1);function AS(){return{seconds:BigInt("0"),nanos:0}}var Me={encode(e,t=Ga.default.Writer.create()){if(e.seconds!==BigInt("0")){if(BigInt.asIntN(64,e.seconds)!==e.seconds)throw new globalThis.Error("value provided for field message.seconds of type int64 too large");t.uint32(8).int64(e.seconds.toString())}return e.nanos!==0&&t.uint32(16).int32(e.nanos),t},decode(e,t){let n=e instanceof Ga.default.Reader?e:Ga.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=AS();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.seconds=$6(n.int64());continue;case 2:if(a!==16)break;i.nanos=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{seconds:yS(e.seconds)?BigInt(e.seconds):BigInt("0"),nanos:yS(e.nanos)?globalThis.Number(e.nanos):0}},toJSON(e){let t={};return e.seconds!==BigInt("0")&&(t.seconds=e.seconds.toString()),e.nanos!==0&&(t.nanos=Math.round(e.nanos)),t},create(e){return Me.fromPartial(e??{})},fromPartial(e){let t=AS();return t.seconds=e.seconds??BigInt("0"),t.nanos=e.nanos??0,t}};function $6(e){return BigInt(e.toString())}Ga.default.util.Long!==gi&&(Ga.default.util.Long=gi,Ga.default.configure());function yS(e){return e!=null}var Fe=Tn(no(),1);var vS;(function(e){e[e.FREE=0]="FREE",e[e.DEV=1]="DEV",e[e.PRO=2]="PRO",e[e.ENTERPRISE=3]="ENTERPRISE",e[e.ANONYMOUS=16]="ANONYMOUS",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(vS||(vS={}));var wS;(function(e){e[e.ORG_MEMBER=0]="ORG_MEMBER",e[e.ORG_ADMIN=1]="ORG_ADMIN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(wS||(wS={}));var bS;(function(e){e[e.AND=0]="AND",e[e.OR=1]="OR",e[e.THEN=2]="THEN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(bS||(bS={}));var ES;(function(e){e[e.READ=0]="READ",e[e.WRITE=1]="WRITE",e[e.ADMIN=2]="ADMIN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(ES||(ES={}));var CS;(function(e){e[e.GENERAL=0]="GENERAL",e[e.PROCESSOR_UPLOAD_FAILED=101]="PROCESSOR_UPLOAD_FAILED",e[e.PROCESSOR_UPLOAD_SUCCESS=102]="PROCESSOR_UPLOAD_SUCCESS",e[e.PROCESSOR_OBSOLETED=103]="PROCESSOR_OBSOLETED",e[e.PROCESSOR_STOPPED=104]="PROCESSOR_STOPPED",e[e.PROCESSOR_ACTIVATED=105]="PROCESSOR_ACTIVATED",e[e.PROCESSOR_GENERAL=106]="PROCESSOR_GENERAL",e[e.PROCESSOR_ERROR=107]="PROCESSOR_ERROR",e[e.EXPORT_TASK_FAILED=201]="EXPORT_TASK_FAILED",e[e.EXPORT_TASK_SUCCESS=202]="EXPORT_TASK_SUCCESS",e[e.BILLING_INVOICE=301]="BILLING_INVOICE",e[e.BILLING_PAYMENT=302]="BILLING_PAYMENT",e[e.BILLING_SUBSCRIPTION=303]="BILLING_SUBSCRIPTION",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(CS||(CS={}));var IS;(function(e){e[e.PENDING=0]="PENDING",e[e.SET_USERNAME=1]="SET_USERNAME",e[e.BANNED=9]="BANNED",e[e.ACTIVE=10]="ACTIVE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(IS||(IS={}));var SS;(function(e){e[e.PUBLIC=0]="PUBLIC",e[e.PRIVATE=1]="PRIVATE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(SS||(SS={}));var xS;(function(e){e[e.SENTIO=0]="SENTIO",e[e.SUBGRAPH=1]="SUBGRAPH",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(xS||(xS={}));var TS;(function(e){e[e.AVG=0]="AVG",e[e.SUM=1]="SUM",e[e.MIN=2]="MIN",e[e.MAX=3]="MAX",e[e.COUNT=4]="COUNT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(TS||(TS={}));var NS;(function(e){e[e.EQ=0]="EQ",e[e.NEQ=1]="NEQ",e[e.EXISTS=9]="EXISTS",e[e.NOT_EXISTS=10]="NOT_EXISTS",e[e.GT=2]="GT",e[e.GTE=3]="GTE",e[e.LT=4]="LT",e[e.LTE=5]="LTE",e[e.BETWEEN=7]="BETWEEN",e[e.NOT_BETWEEN=8]="NOT_BETWEEN",e[e.CONTAINS=11]="CONTAINS",e[e.NOT_CONTAINS=12]="NOT_CONTAINS",e[e.IN_COHORTS=13]="IN_COHORTS",e[e.NOT_IN_COHORTS=14]="NOT_IN_COHORTS",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(NS||(NS={}));var RS;(function(e){e[e.EVENTS=0]="EVENTS",e[e.COHORTS=1]="COHORTS",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(RS||(RS={}));var BS;(function(e){e[e.SUM=0]="SUM",e[e.CUMULATIVE_SUM=6]="CUMULATIVE_SUM",e[e.AVG=1]="AVG",e[e.MEDIAN=2]="MEDIAN",e[e.MIN=3]="MIN",e[e.MAX=4]="MAX",e[e.DISTINCT_COUNT=5]="DISTINCT_COUNT",e[e.CUMULATIVE_DISTINCT_COUNT=9]="CUMULATIVE_DISTINCT_COUNT",e[e.CUMULATIVE_COUNT=12]="CUMULATIVE_COUNT",e[e.LAST=7]="LAST",e[e.CUMULATIVE_LAST=10]="CUMULATIVE_LAST",e[e.FIRST=8]="FIRST",e[e.CUMULATIVE_FIRST=11]="CUMULATIVE_FIRST",e[e.PERCENTILE_25TH=20]="PERCENTILE_25TH",e[e.PERCENTILE_75TH=21]="PERCENTILE_75TH",e[e.PERCENTILE_90TH=22]="PERCENTILE_90TH",e[e.PERCENTILE_95TH=23]="PERCENTILE_95TH",e[e.PERCENTILE_99TH=24]="PERCENTILE_99TH",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(BS||(BS={}));var kS;(function(e){e[e.EQ=0]="EQ",e[e.NEQ=1]="NEQ",e[e.GT=2]="GT",e[e.GTE=3]="GTE",e[e.LT=4]="LT",e[e.LTE=5]="LTE",e[e.BETWEEN=7]="BETWEEN",e[e.NOT_BETWEEN=8]="NOT_BETWEEN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(kS||(kS={}));var OS;(function(e){e[e.SUM=0]="SUM",e[e.AVG=1]="AVG",e[e.MEDIAN=2]="MEDIAN",e[e.MIN=3]="MIN",e[e.MAX=4]="MAX",e[e.DISTINCT_COUNT=5]="DISTINCT_COUNT",e[e.LAST=6]="LAST",e[e.FIRST=7]="FIRST",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(OS||(OS={}));var PS;(function(e){e[e.PROCESSOR=0]="PROCESSOR",e[e.UI=1]="UI",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(PS||(PS={}));var DS;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.EMAIL=1]="EMAIL",e[e.SLACK=2]="SLACK",e[e.TELEGRAM=3]="TELEGRAM",e[e.WEBHOOK=4]="WEBHOOK",e[e.DISCORD=5]="DISCORD",e[e.PAGERDUTY=6]="PAGERDUTY",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(DS||(DS={}));var MS;(function(e){e[e.STRING=0]="STRING",e[e.NUMBER=1]="NUMBER",e[e.BOOLEAN=2]="BOOLEAN",e[e.LIST=3]="LIST",e[e.TIME=4]="TIME",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(MS||(MS={}));var FS;(function(e){e[e.OnOrAfter=0]="OnOrAfter",e[e.On=1]="On",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(FS||(FS={}));var LS;(function(e){e[e.Disable=0]="Disable",e[e.FirstInTimeRange=1]="FirstInTimeRange",e[e.FirstInGlobal=2]="FirstInGlobal",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(LS||(LS={}));var QS;(function(e){e[e.Day=0]="Day",e[e.Week=1]="Week",e[e.Month=2]="Month",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(QS||(QS={}));var US;(function(e){e[e.SUM=0]="SUM",e[e.AVG=1]="AVG",e[e.MEDIAN=2]="MEDIAN",e[e.MIN=3]="MIN",e[e.MAX=4]="MAX",e[e.DISTINCT_COUNT=5]="DISTINCT_COUNT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(US||(US={}));var At;(function(e){e[e.NULL_VALUE=0]="NULL_VALUE",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(At||(At={}));function K6(e){switch(e){case 0:case"NULL_VALUE":return At.NULL_VALUE;case-1:case"UNRECOGNIZED":default:return At.UNRECOGNIZED}}function j6(e){switch(e){case At.NULL_VALUE:return"NULL_VALUE";case At.UNRECOGNIZED:default:return"UNRECOGNIZED"}}function qS(){return{symbol:void 0,address:void 0}}var Vi={encode(e,t=Fe.default.Writer.create()){return e.symbol!==void 0&&t.uint32(10).string(e.symbol),e.address!==void 0&&io.encode(e.address,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof Fe.default.Reader?e:Fe.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=qS();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.symbol=n.string();continue;case 2:if(a!==18)break;i.address=io.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{symbol:ot(e.symbol)?globalThis.String(e.symbol):void 0,address:ot(e.address)?io.fromJSON(e.address):void 0}},toJSON(e){let t={};return e.symbol!==void 0&&(t.symbol=e.symbol),e.address!==void 0&&(t.address=io.toJSON(e.address)),t},create(e){return Vi.fromPartial(e??{})},fromPartial(e){let t=qS();return t.symbol=e.symbol??void 0,t.address=e.address!==void 0&&e.address!==null?io.fromPartial(e.address):void 0,t}};function JS(){return{address:"",chain:""}}var io={encode(e,t=Fe.default.Writer.create()){return e.address!==""&&t.uint32(10).string(e.address),e.chain!==""&&t.uint32(18).string(e.chain),t},decode(e,t){let n=e instanceof Fe.default.Reader?e:Fe.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=JS();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.address=n.string();continue;case 2:if(a!==18)break;i.chain=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{address:ot(e.address)?globalThis.String(e.address):"",chain:ot(e.chain)?globalThis.String(e.chain):""}},toJSON(e){let t={};return e.address!==""&&(t.address=e.address),e.chain!==""&&(t.chain=e.chain),t},create(e){return io.fromPartial(e??{})},fromPartial(e){let t=JS();return t.address=e.address??"",t.chain=e.chain??"",t}};function zS(){return{nullValue:void 0,intValue:void 0,floatValue:void 0,bytesValue:void 0,boolValue:void 0,stringValue:void 0,timestampValue:void 0,bigintValue:void 0,bigdecimalValue:void 0,listValue:void 0,structValue:void 0}}var Xt={encode(e,t=Fe.default.Writer.create()){return e.nullValue!==void 0&&t.uint32(8).int32(e.nullValue),e.intValue!==void 0&&t.uint32(16).int32(e.intValue),e.floatValue!==void 0&&t.uint32(25).double(e.floatValue),e.bytesValue!==void 0&&t.uint32(34).bytes(e.bytesValue),e.boolValue!==void 0&&t.uint32(40).bool(e.boolValue),e.stringValue!==void 0&&t.uint32(50).string(e.stringValue),e.timestampValue!==void 0&&Me.encode(eq(e.timestampValue),t.uint32(58).fork()).ldelim(),e.bigintValue!==void 0&&It.encode(e.bigintValue,t.uint32(66).fork()).ldelim(),e.bigdecimalValue!==void 0&&ao.encode(e.bigdecimalValue,t.uint32(74).fork()).ldelim(),e.listValue!==void 0&&Fn.encode(e.listValue,t.uint32(82).fork()).ldelim(),e.structValue!==void 0&&tt.encode(e.structValue,t.uint32(90).fork()).ldelim(),t},decode(e,t){let n=e instanceof Fe.default.Reader?e:Fe.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=zS();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.nullValue=n.int32();continue;case 2:if(a!==16)break;i.intValue=n.int32();continue;case 3:if(a!==25)break;i.floatValue=n.double();continue;case 4:if(a!==34)break;i.bytesValue=n.bytes();continue;case 5:if(a!==40)break;i.boolValue=n.bool();continue;case 6:if(a!==50)break;i.stringValue=n.string();continue;case 7:if(a!==58)break;i.timestampValue=KS(Me.decode(n,n.uint32()));continue;case 8:if(a!==66)break;i.bigintValue=It.decode(n,n.uint32());continue;case 9:if(a!==74)break;i.bigdecimalValue=ao.decode(n,n.uint32());continue;case 10:if(a!==82)break;i.listValue=Fn.decode(n,n.uint32());continue;case 11:if(a!==90)break;i.structValue=tt.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{nullValue:ot(e.nullValue)?K6(e.nullValue):void 0,intValue:ot(e.intValue)?globalThis.Number(e.intValue):void 0,floatValue:ot(e.floatValue)?globalThis.Number(e.floatValue):void 0,bytesValue:ot(e.bytesValue)?YS(e.bytesValue):void 0,boolValue:ot(e.boolValue)?globalThis.Boolean(e.boolValue):void 0,stringValue:ot(e.stringValue)?globalThis.String(e.stringValue):void 0,timestampValue:ot(e.timestampValue)?tq(e.timestampValue):void 0,bigintValue:ot(e.bigintValue)?It.fromJSON(e.bigintValue):void 0,bigdecimalValue:ot(e.bigdecimalValue)?ao.fromJSON(e.bigdecimalValue):void 0,listValue:ot(e.listValue)?Fn.fromJSON(e.listValue):void 0,structValue:ot(e.structValue)?tt.fromJSON(e.structValue):void 0}},toJSON(e){let t={};return e.nullValue!==void 0&&(t.nullValue=j6(e.nullValue)),e.intValue!==void 0&&(t.intValue=Math.round(e.intValue)),e.floatValue!==void 0&&(t.floatValue=e.floatValue),e.bytesValue!==void 0&&(t.bytesValue=$S(e.bytesValue)),e.boolValue!==void 0&&(t.boolValue=e.boolValue),e.stringValue!==void 0&&(t.stringValue=e.stringValue),e.timestampValue!==void 0&&(t.timestampValue=e.timestampValue.toISOString()),e.bigintValue!==void 0&&(t.bigintValue=It.toJSON(e.bigintValue)),e.bigdecimalValue!==void 0&&(t.bigdecimalValue=ao.toJSON(e.bigdecimalValue)),e.listValue!==void 0&&(t.listValue=Fn.toJSON(e.listValue)),e.structValue!==void 0&&(t.structValue=tt.toJSON(e.structValue)),t},create(e){return Xt.fromPartial(e??{})},fromPartial(e){let t=zS();return t.nullValue=e.nullValue??void 0,t.intValue=e.intValue??void 0,t.floatValue=e.floatValue??void 0,t.bytesValue=e.bytesValue??void 0,t.boolValue=e.boolValue??void 0,t.stringValue=e.stringValue??void 0,t.timestampValue=e.timestampValue??void 0,t.bigintValue=e.bigintValue!==void 0&&e.bigintValue!==null?It.fromPartial(e.bigintValue):void 0,t.bigdecimalValue=e.bigdecimalValue!==void 0&&e.bigdecimalValue!==null?ao.fromPartial(e.bigdecimalValue):void 0,t.listValue=e.listValue!==void 0&&e.listValue!==null?Fn.fromPartial(e.listValue):void 0,t.structValue=e.structValue!==void 0&&e.structValue!==null?tt.fromPartial(e.structValue):void 0,t}};function VS(){return{fields:{}}}var tt={encode(e,t=Fe.default.Writer.create()){return Object.entries(e.fields).forEach(([n,r])=>{fA.encode({key:n,value:r},t.uint32(10).fork()).ldelim()}),t},decode(e,t){let n=e instanceof Fe.default.Reader?e:Fe.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=VS();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;let s=fA.decode(n,n.uint32());s.value!==void 0&&(i.fields[s.key]=s.value);continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{fields:nq(e.fields)?Object.entries(e.fields).reduce((t,[n,r])=>(t[n]=Xt.fromJSON(r),t),{}):{}}},toJSON(e){let t={};if(e.fields){let n=Object.entries(e.fields);n.length>0&&(t.fields={},n.forEach(([r,i])=>{t.fields[r]=Xt.toJSON(i)}))}return t},create(e){return tt.fromPartial(e??{})},fromPartial(e){let t=VS();return t.fields=Object.entries(e.fields??{}).reduce((n,[r,i])=>(i!==void 0&&(n[r]=Xt.fromPartial(i)),n),{}),t}};function GS(){return{key:"",value:void 0}}var fA={encode(e,t=Fe.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==void 0&&Xt.encode(e.value,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof Fe.default.Reader?e:Fe.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=GS();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.key=n.string();continue;case 2:if(a!==18)break;i.value=Xt.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{key:ot(e.key)?globalThis.String(e.key):"",value:ot(e.value)?Xt.fromJSON(e.value):void 0}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==void 0&&(t.value=Xt.toJSON(e.value)),t},create(e){return fA.fromPartial(e??{})},fromPartial(e){let t=GS();return t.key=e.key??"",t.value=e.value!==void 0&&e.value!==null?Xt.fromPartial(e.value):void 0,t}};function WS(){return{values:[]}}var Fn={encode(e,t=Fe.default.Writer.create()){for(let n of e.values)Xt.encode(n,t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof Fe.default.Reader?e:Fe.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=WS();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.values.push(Xt.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{values:globalThis.Array.isArray(e?.values)?e.values.map(t=>Xt.fromJSON(t)):[]}},toJSON(e){let t={};return e.values?.length&&(t.values=e.values.map(n=>Xt.toJSON(n))),t},create(e){return Fn.fromPartial(e??{})},fromPartial(e){let t=WS();return t.values=e.values?.map(n=>Xt.fromPartial(n))||[],t}};function HS(){return{entities:[]}}var Gi={encode(e,t=Fe.default.Writer.create()){for(let n of e.entities)tt.encode(n,t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof Fe.default.Reader?e:Fe.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=HS();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.entities.push(tt.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{entities:globalThis.Array.isArray(e?.entities)?e.entities.map(t=>tt.fromJSON(t)):[]}},toJSON(e){let t={};return e.entities?.length&&(t.entities=e.entities.map(n=>tt.toJSON(n))),t},create(e){return Gi.fromPartial(e??{})},fromPartial(e){let t=HS();return t.entities=e.entities?.map(n=>tt.fromPartial(n))||[],t}};function ZS(){return{value:void 0,exp:0}}var ao={encode(e,t=Fe.default.Writer.create()){return e.value!==void 0&&It.encode(e.value,t.uint32(10).fork()).ldelim(),e.exp!==0&&t.uint32(16).int32(e.exp),t},decode(e,t){let n=e instanceof Fe.default.Reader?e:Fe.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=ZS();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.value=It.decode(n,n.uint32());continue;case 2:if(a!==16)break;i.exp=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{value:ot(e.value)?It.fromJSON(e.value):void 0,exp:ot(e.exp)?globalThis.Number(e.exp):0}},toJSON(e){let t={};return e.value!==void 0&&(t.value=It.toJSON(e.value)),e.exp!==0&&(t.exp=Math.round(e.exp)),t},create(e){return ao.fromPartial(e??{})},fromPartial(e){let t=ZS();return t.value=e.value!==void 0&&e.value!==null?It.fromPartial(e.value):void 0,t.exp=e.exp??0,t}};function XS(){return{negative:!1,data:new Uint8Array(0)}}var It={encode(e,t=Fe.default.Writer.create()){return e.negative!==!1&&t.uint32(8).bool(e.negative),e.data.length!==0&&t.uint32(18).bytes(e.data),t},decode(e,t){let n=e instanceof Fe.default.Reader?e:Fe.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=XS();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.negative=n.bool();continue;case 2:if(a!==18)break;i.data=n.bytes();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{negative:ot(e.negative)?globalThis.Boolean(e.negative):!1,data:ot(e.data)?YS(e.data):new Uint8Array(0)}},toJSON(e){let t={};return e.negative!==!1&&(t.negative=e.negative),e.data.length!==0&&(t.data=$S(e.data)),t},create(e){return It.fromPartial(e??{})},fromPartial(e){let t=XS();return t.negative=e.negative??!1,t.data=e.data??new Uint8Array(0),t}};function YS(e){if(globalThis.Buffer)return Uint8Array.from(globalThis.Buffer.from(e,"base64"));{let t=globalThis.atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;++r)n[r]=t.charCodeAt(r);return n}}function $S(e){if(globalThis.Buffer)return globalThis.Buffer.from(e).toString("base64");{let t=[];return e.forEach(n=>{t.push(globalThis.String.fromCharCode(n))}),globalThis.btoa(t.join(""))}}function eq(e){let t=BigInt(Math.trunc(e.getTime()/1e3)),n=e.getTime()%1e3*1e6;return{seconds:t,nanos:n}}function KS(e){let t=(globalThis.Number(e.seconds.toString())||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function tq(e){return e instanceof globalThis.Date?e:typeof e=="string"?new globalThis.Date(e):KS(Me.fromJSON(e))}Fe.default.util.Long!==gi&&(Fe.default.util.Long=gi,Fe.default.configure());function nq(e){return typeof e=="object"&&e!==null}function ot(e){return e!=null}var Tt;(function(e){e[e.UNKNOWN_TYPE=0]="UNKNOWN_TYPE",e[e.COUNTER=1]="COUNTER",e[e.GAUGE=2]="GAUGE",e[e.HISTOGRAM=3]="HISTOGRAM",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Tt||(Tt={}));function rq(e){switch(e){case 0:case"UNKNOWN_TYPE":return Tt.UNKNOWN_TYPE;case 1:case"COUNTER":return Tt.COUNTER;case 2:case"GAUGE":return Tt.GAUGE;case 3:case"HISTOGRAM":return Tt.HISTOGRAM;case-1:case"UNRECOGNIZED":default:return Tt.UNRECOGNIZED}}function iq(e){switch(e){case Tt.UNKNOWN_TYPE:return"UNKNOWN_TYPE";case Tt.COUNTER:return"COUNTER";case Tt.GAUGE:return"GAUGE";case Tt.HISTOGRAM:return"HISTOGRAM";case Tt.UNRECOGNIZED:default:return"UNRECOGNIZED"}}var yt;(function(e){e[e.COUNT=0]="COUNT",e[e.SUM=1]="SUM",e[e.AVG=2]="AVG",e[e.MIN=3]="MIN",e[e.MAX=4]="MAX",e[e.LAST=5]="LAST",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(yt||(yt={}));function aq(e){switch(e){case 0:case"COUNT":return yt.COUNT;case 1:case"SUM":return yt.SUM;case 2:case"AVG":return yt.AVG;case 3:case"MIN":return yt.MIN;case 4:case"MAX":return yt.MAX;case 5:case"LAST":return yt.LAST;case-1:case"UNRECOGNIZED":default:return yt.UNRECOGNIZED}}function sq(e){switch(e){case yt.COUNT:return"COUNT";case yt.SUM:return"SUM";case yt.AVG:return"AVG";case yt.MIN:return"MIN";case yt.MAX:return"MAX";case yt.LAST:return"LAST";case yt.UNRECOGNIZED:default:return"UNRECOGNIZED"}}var Vr;(function(e){e[e.ADDRESS=0]="ADDRESS",e[e.OBJECT=1]="OBJECT",e[e.WRAPPED_OBJECT=2]="WRAPPED_OBJECT",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Vr||(Vr={}));function oq(e){switch(e){case 0:case"ADDRESS":return Vr.ADDRESS;case 1:case"OBJECT":return Vr.OBJECT;case 2:case"WRAPPED_OBJECT":return Vr.WRAPPED_OBJECT;case-1:case"UNRECOGNIZED":default:return Vr.UNRECOGNIZED}}function cq(e){switch(e){case Vr.ADDRESS:return"ADDRESS";case Vr.OBJECT:return"OBJECT";case Vr.WRAPPED_OBJECT:return"WRAPPED_OBJECT";case Vr.UNRECOGNIZED:default:return"UNRECOGNIZED"}}var Gr;(function(e){e[e.ERC20=0]="ERC20",e[e.ERC721=1]="ERC721",e[e.ERC1155=2]="ERC1155",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Gr||(Gr={}));function uq(e){switch(e){case 0:case"ERC20":return Gr.ERC20;case 1:case"ERC721":return Gr.ERC721;case 2:case"ERC1155":return Gr.ERC1155;case-1:case"UNRECOGNIZED":default:return Gr.UNRECOGNIZED}}function lq(e){switch(e){case Gr.ERC20:return"ERC20";case Gr.ERC721:return"ERC721";case Gr.ERC1155:return"ERC1155";case Gr.UNRECOGNIZED:default:return"UNRECOGNIZED"}}var Ce;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.ETH_LOG=1]="ETH_LOG",e[e.ETH_BLOCK=2]="ETH_BLOCK",e[e.ETH_TRACE=5]="ETH_TRACE",e[e.ETH_TRANSACTION=11]="ETH_TRANSACTION",e[e.SOL_INSTRUCTION=4]="SOL_INSTRUCTION",e[e.APT_EVENT=6]="APT_EVENT",e[e.APT_CALL=7]="APT_CALL",e[e.APT_RESOURCE=8]="APT_RESOURCE",e[e.SUI_EVENT=3]="SUI_EVENT",e[e.SUI_CALL=9]="SUI_CALL",e[e.SUI_OBJECT=10]="SUI_OBJECT",e[e.SUI_OBJECT_CHANGE=12]="SUI_OBJECT_CHANGE",e[e.FUEL_CALL=13]="FUEL_CALL",e[e.COSMOS_CALL=14]="COSMOS_CALL",e[e.STARKNET_EVENT=15]="STARKNET_EVENT",e[e.BTC_TRANSACTION=16]="BTC_TRANSACTION",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Ce||(Ce={}));function VT(e){switch(e){case 0:case"UNKNOWN":return Ce.UNKNOWN;case 1:case"ETH_LOG":return Ce.ETH_LOG;case 2:case"ETH_BLOCK":return Ce.ETH_BLOCK;case 5:case"ETH_TRACE":return Ce.ETH_TRACE;case 11:case"ETH_TRANSACTION":return Ce.ETH_TRANSACTION;case 4:case"SOL_INSTRUCTION":return Ce.SOL_INSTRUCTION;case 6:case"APT_EVENT":return Ce.APT_EVENT;case 7:case"APT_CALL":return Ce.APT_CALL;case 8:case"APT_RESOURCE":return Ce.APT_RESOURCE;case 3:case"SUI_EVENT":return Ce.SUI_EVENT;case 9:case"SUI_CALL":return Ce.SUI_CALL;case 10:case"SUI_OBJECT":return Ce.SUI_OBJECT;case 12:case"SUI_OBJECT_CHANGE":return Ce.SUI_OBJECT_CHANGE;case 13:case"FUEL_CALL":return Ce.FUEL_CALL;case 14:case"COSMOS_CALL":return Ce.COSMOS_CALL;case 15:case"STARKNET_EVENT":return Ce.STARKNET_EVENT;case 16:case"BTC_TRANSACTION":return Ce.BTC_TRANSACTION;case-1:case"UNRECOGNIZED":default:return Ce.UNRECOGNIZED}}function GT(e){switch(e){case Ce.UNKNOWN:return"UNKNOWN";case Ce.ETH_LOG:return"ETH_LOG";case Ce.ETH_BLOCK:return"ETH_BLOCK";case Ce.ETH_TRACE:return"ETH_TRACE";case Ce.ETH_TRANSACTION:return"ETH_TRANSACTION";case Ce.SOL_INSTRUCTION:return"SOL_INSTRUCTION";case Ce.APT_EVENT:return"APT_EVENT";case Ce.APT_CALL:return"APT_CALL";case Ce.APT_RESOURCE:return"APT_RESOURCE";case Ce.SUI_EVENT:return"SUI_EVENT";case Ce.SUI_CALL:return"SUI_CALL";case Ce.SUI_OBJECT:return"SUI_OBJECT";case Ce.SUI_OBJECT_CHANGE:return"SUI_OBJECT_CHANGE";case Ce.FUEL_CALL:return"FUEL_CALL";case Ce.COSMOS_CALL:return"COSMOS_CALL";case Ce.STARKNET_EVENT:return"STARKNET_EVENT";case Ce.BTC_TRANSACTION:return"BTC_TRANSACTION";case Ce.UNRECOGNIZED:default:return"UNRECOGNIZED"}}var xt;(function(e){e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARNING=2]="WARNING",e[e.ERROR=3]="ERROR",e[e.CRITICAL=4]="CRITICAL",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(xt||(xt={}));function dq(e){switch(e){case 0:case"DEBUG":return xt.DEBUG;case 1:case"INFO":return xt.INFO;case 2:case"WARNING":return xt.WARNING;case 3:case"ERROR":return xt.ERROR;case 4:case"CRITICAL":return xt.CRITICAL;case-1:case"UNRECOGNIZED":default:return xt.UNRECOGNIZED}}function fq(e){switch(e){case xt.DEBUG:return"DEBUG";case xt.INFO:return"INFO";case xt.WARNING:return"WARNING";case xt.ERROR:return"ERROR";case xt.CRITICAL:return"CRITICAL";case xt.UNRECOGNIZED:default:return"UNRECOGNIZED"}}var Hi;(function(e){e[e.AVG=0]="AVG",e[e.MEDIAN=1]="MEDIAN",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(Hi||(Hi={}));function oie(e){switch(e){case 0:case"AVG":return Hi.AVG;case 1:case"MEDIAN":return Hi.MEDIAN;case-1:case"UNRECOGNIZED":default:return Hi.UNRECOGNIZED}}function cie(e){switch(e){case Hi.AVG:return"AVG";case Hi.MEDIAN:return"MEDIAN";case Hi.UNRECOGNIZED:default:return"UNRECOGNIZED"}}var St;(function(e){e[e.STRING=0]="STRING",e[e.DOUBLE=1]="DOUBLE",e[e.BOOL=2]="BOOL",e[e.TIMESTAMP=3]="TIMESTAMP",e[e.BIG_INTEGER=4]="BIG_INTEGER",e[e.BIG_DECIMAL=5]="BIG_DECIMAL",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(St||(St={}));function pq(e){switch(e){case 0:case"STRING":return St.STRING;case 1:case"DOUBLE":return St.DOUBLE;case 2:case"BOOL":return St.BOOL;case 3:case"TIMESTAMP":return St.TIMESTAMP;case 4:case"BIG_INTEGER":return St.BIG_INTEGER;case 5:case"BIG_DECIMAL":return St.BIG_DECIMAL;case-1:case"UNRECOGNIZED":default:return St.UNRECOGNIZED}}function hq(e){switch(e){case St.STRING:return"STRING";case St.DOUBLE:return"DOUBLE";case St.BOOL:return"BOOL";case St.TIMESTAMP:return"TIMESTAMP";case St.BIG_INTEGER:return"BIG_INTEGER";case St.BIG_DECIMAL:return"BIG_DECIMAL";case St.UNRECOGNIZED:default:return"UNRECOGNIZED"}}var ye;(function(e){e[e.EQ=0]="EQ",e[e.NE=1]="NE",e[e.GT=2]="GT",e[e.GE=3]="GE",e[e.LT=4]="LT",e[e.LE=5]="LE",e[e.IN=6]="IN",e[e.NOT_IN=7]="NOT_IN",e[e.LIKE=8]="LIKE",e[e.NOT_LIKE=9]="NOT_LIKE",e[e.HAS_ALL=10]="HAS_ALL",e[e.HAS_ANY=11]="HAS_ANY",e[e.UNRECOGNIZED=-1]="UNRECOGNIZED"})(ye||(ye={}));function mq(e){switch(e){case 0:case"EQ":return ye.EQ;case 1:case"NE":return ye.NE;case 2:case"GT":return ye.GT;case 3:case"GE":return ye.GE;case 4:case"LT":return ye.LT;case 5:case"LE":return ye.LE;case 6:case"IN":return ye.IN;case 7:case"NOT_IN":return ye.NOT_IN;case 8:case"LIKE":return ye.LIKE;case 9:case"NOT_LIKE":return ye.NOT_LIKE;case 10:case"HAS_ALL":return ye.HAS_ALL;case 11:case"HAS_ANY":return ye.HAS_ANY;case-1:case"UNRECOGNIZED":default:return ye.UNRECOGNIZED}}function gq(e){switch(e){case ye.EQ:return"EQ";case ye.NE:return"NE";case ye.GT:return"GT";case ye.GE:return"GE";case ye.LT:return"LT";case ye.LE:return"LE";case ye.IN:return"IN";case ye.NOT_IN:return"NOT_IN";case ye.LIKE:return"LIKE";case ye.NOT_LIKE:return"NOT_LIKE";case ye.HAS_ALL:return"HAS_ALL";case ye.HAS_ANY:return"HAS_ANY";case ye.UNRECOGNIZED:default:return"UNRECOGNIZED"}}function jS(){return{name:"",version:""}}var so={encode(e,t=g.default.Writer.create()){return e.name!==""&&t.uint32(10).string(e.name),e.version!==""&&t.uint32(26).string(e.version),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=jS();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.name=n.string();continue;case 3:if(a!==26)break;i.version=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{name:S(e.name)?globalThis.String(e.name):"",version:S(e.version)?globalThis.String(e.version):""}},toJSON(e){let t={};return e.name!==""&&(t.name=e.name),e.version!==""&&(t.version=e.version),t},create(e){return so.fromPartial(e??{})},fromPartial(e){let t=jS();return t.name=e.name??"",t.version=e.version??"",t}};function ex(){return{sequential:!1,forceExactBlockTime:!1,processBindingTimeout:0}}var oo={encode(e,t=g.default.Writer.create()){return e.sequential!==!1&&t.uint32(8).bool(e.sequential),e.forceExactBlockTime!==!1&&t.uint32(16).bool(e.forceExactBlockTime),e.processBindingTimeout!==0&&t.uint32(24).int32(e.processBindingTimeout),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=ex();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.sequential=n.bool();continue;case 2:if(a!==16)break;i.forceExactBlockTime=n.bool();continue;case 3:if(a!==24)break;i.processBindingTimeout=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{sequential:S(e.sequential)?globalThis.Boolean(e.sequential):!1,forceExactBlockTime:S(e.forceExactBlockTime)?globalThis.Boolean(e.forceExactBlockTime):!1,processBindingTimeout:S(e.processBindingTimeout)?globalThis.Number(e.processBindingTimeout):0}},toJSON(e){let t={};return e.sequential!==!1&&(t.sequential=e.sequential),e.forceExactBlockTime!==!1&&(t.forceExactBlockTime=e.forceExactBlockTime),e.processBindingTimeout!==0&&(t.processBindingTimeout=Math.round(e.processBindingTimeout)),t},create(e){return oo.fromPartial(e??{})},fromPartial(e){let t=ex();return t.sequential=e.sequential??!1,t.forceExactBlockTime=e.forceExactBlockTime??!1,t.processBindingTimeout=e.processBindingTimeout??0,t}};function tx(){return{}}var WT={encode(e,t=g.default.Writer.create()){return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=tx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{}},toJSON(e){return{}},create(e){return WT.fromPartial(e??{})},fromPartial(e){return tx()}};function nx(){return{config:void 0,executionConfig:void 0,contractConfigs:[],templateInstances:[],accountConfigs:[],metricConfigs:[],eventTrackingConfigs:[],exportConfigs:[],eventLogConfigs:[],dbSchema:void 0}}var HT={encode(e,t=g.default.Writer.create()){e.config!==void 0&&so.encode(e.config,t.uint32(10).fork()).ldelim(),e.executionConfig!==void 0&&oo.encode(e.executionConfig,t.uint32(74).fork()).ldelim();for(let n of e.contractConfigs)co.encode(n,t.uint32(18).fork()).ldelim();for(let n of e.templateInstances)mr.encode(n,t.uint32(26).fork()).ldelim();for(let n of e.accountConfigs)go.encode(n,t.uint32(34).fork()).ldelim();for(let n of e.metricConfigs)zr.encode(n,t.uint32(42).fork()).ldelim();for(let n of e.eventTrackingConfigs)po.encode(n,t.uint32(50).fork()).ldelim();for(let n of e.exportConfigs)ho.encode(n,t.uint32(58).fork()).ldelim();for(let n of e.eventLogConfigs)Ai.encode(n,t.uint32(66).fork()).ldelim();return e.dbSchema!==void 0&&uo.encode(e.dbSchema,t.uint32(82).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=nx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.config=so.decode(n,n.uint32());continue;case 9:if(a!==74)break;i.executionConfig=oo.decode(n,n.uint32());continue;case 2:if(a!==18)break;i.contractConfigs.push(co.decode(n,n.uint32()));continue;case 3:if(a!==26)break;i.templateInstances.push(mr.decode(n,n.uint32()));continue;case 4:if(a!==34)break;i.accountConfigs.push(go.decode(n,n.uint32()));continue;case 5:if(a!==42)break;i.metricConfigs.push(zr.decode(n,n.uint32()));continue;case 6:if(a!==50)break;i.eventTrackingConfigs.push(po.decode(n,n.uint32()));continue;case 7:if(a!==58)break;i.exportConfigs.push(ho.decode(n,n.uint32()));continue;case 8:if(a!==66)break;i.eventLogConfigs.push(Ai.decode(n,n.uint32()));continue;case 10:if(a!==82)break;i.dbSchema=uo.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{config:S(e.config)?so.fromJSON(e.config):void 0,executionConfig:S(e.executionConfig)?oo.fromJSON(e.executionConfig):void 0,contractConfigs:globalThis.Array.isArray(e?.contractConfigs)?e.contractConfigs.map(t=>co.fromJSON(t)):[],templateInstances:globalThis.Array.isArray(e?.templateInstances)?e.templateInstances.map(t=>mr.fromJSON(t)):[],accountConfigs:globalThis.Array.isArray(e?.accountConfigs)?e.accountConfigs.map(t=>go.fromJSON(t)):[],metricConfigs:globalThis.Array.isArray(e?.metricConfigs)?e.metricConfigs.map(t=>zr.fromJSON(t)):[],eventTrackingConfigs:globalThis.Array.isArray(e?.eventTrackingConfigs)?e.eventTrackingConfigs.map(t=>po.fromJSON(t)):[],exportConfigs:globalThis.Array.isArray(e?.exportConfigs)?e.exportConfigs.map(t=>ho.fromJSON(t)):[],eventLogConfigs:globalThis.Array.isArray(e?.eventLogConfigs)?e.eventLogConfigs.map(t=>Ai.fromJSON(t)):[],dbSchema:S(e.dbSchema)?uo.fromJSON(e.dbSchema):void 0}},toJSON(e){let t={};return e.config!==void 0&&(t.config=so.toJSON(e.config)),e.executionConfig!==void 0&&(t.executionConfig=oo.toJSON(e.executionConfig)),e.contractConfigs?.length&&(t.contractConfigs=e.contractConfigs.map(n=>co.toJSON(n))),e.templateInstances?.length&&(t.templateInstances=e.templateInstances.map(n=>mr.toJSON(n))),e.accountConfigs?.length&&(t.accountConfigs=e.accountConfigs.map(n=>go.toJSON(n))),e.metricConfigs?.length&&(t.metricConfigs=e.metricConfigs.map(n=>zr.toJSON(n))),e.eventTrackingConfigs?.length&&(t.eventTrackingConfigs=e.eventTrackingConfigs.map(n=>po.toJSON(n))),e.exportConfigs?.length&&(t.exportConfigs=e.exportConfigs.map(n=>ho.toJSON(n))),e.eventLogConfigs?.length&&(t.eventLogConfigs=e.eventLogConfigs.map(n=>Ai.toJSON(n))),e.dbSchema!==void 0&&(t.dbSchema=uo.toJSON(e.dbSchema)),t},create(e){return HT.fromPartial(e??{})},fromPartial(e){let t=nx();return t.config=e.config!==void 0&&e.config!==null?so.fromPartial(e.config):void 0,t.executionConfig=e.executionConfig!==void 0&&e.executionConfig!==null?oo.fromPartial(e.executionConfig):void 0,t.contractConfigs=e.contractConfigs?.map(n=>co.fromPartial(n))||[],t.templateInstances=e.templateInstances?.map(n=>mr.fromPartial(n))||[],t.accountConfigs=e.accountConfigs?.map(n=>go.fromPartial(n))||[],t.metricConfigs=e.metricConfigs?.map(n=>zr.fromPartial(n))||[],t.eventTrackingConfigs=e.eventTrackingConfigs?.map(n=>po.fromPartial(n))||[],t.exportConfigs=e.exportConfigs?.map(n=>ho.fromPartial(n))||[],t.eventLogConfigs=e.eventLogConfigs?.map(n=>Ai.fromPartial(n))||[],t.dbSchema=e.dbSchema!==void 0&&e.dbSchema!==null?uo.fromPartial(e.dbSchema):void 0,t}};function rx(){return{contract:void 0,intervalConfigs:[],logConfigs:[],traceConfigs:[],transactionConfig:[],moveEventConfigs:[],moveCallConfigs:[],moveResourceChangeConfigs:[],fuelCallConfigs:[],assetConfigs:[],fuelLogConfigs:[],cosmosLogConfigs:[],starknetEventConfigs:[],btcTransactionConfigs:[],instructionConfig:void 0,startBlock:BigInt("0"),endBlock:BigInt("0"),processorType:""}}var co={encode(e,t=g.default.Writer.create()){e.contract!==void 0&&hr.encode(e.contract,t.uint32(10).fork()).ldelim();for(let n of e.intervalConfigs)ct.encode(n,t.uint32(90).fork()).ldelim();for(let n of e.logConfigs)gr.encode(n,t.uint32(26).fork()).ldelim();for(let n of e.traceConfigs)Ao.encode(n,t.uint32(18).fork()).ldelim();for(let n of e.transactionConfig)yo.encode(n,t.uint32(58).fork()).ldelim();for(let n of e.moveEventConfigs)To.encode(n,t.uint32(74).fork()).ldelim();for(let n of e.moveCallConfigs)Ar.encode(n,t.uint32(82).fork()).ldelim();for(let n of e.moveResourceChangeConfigs)Ro.encode(n,t.uint32(98).fork()).ldelim();for(let n of e.fuelCallConfigs)Lo.encode(n,t.uint32(106).fork()).ldelim();for(let n of e.assetConfigs)vo.encode(n,t.uint32(114).fork()).ldelim();for(let n of e.fuelLogConfigs)bo.encode(n,t.uint32(122).fork()).ldelim();for(let n of e.cosmosLogConfigs)Eo.encode(n,t.uint32(130).fork()).ldelim();for(let n of e.starknetEventConfigs)Oo.encode(n,t.uint32(138).fork()).ldelim();for(let n of e.btcTransactionConfigs)Po.encode(n,t.uint32(146).fork()).ldelim();if(e.instructionConfig!==void 0&&Io.encode(e.instructionConfig,t.uint32(50).fork()).ldelim(),e.startBlock!==BigInt("0")){if(BigInt.asUintN(64,e.startBlock)!==e.startBlock)throw new globalThis.Error("value provided for field message.startBlock of type uint64 too large");t.uint32(32).uint64(e.startBlock.toString())}if(e.endBlock!==BigInt("0")){if(BigInt.asUintN(64,e.endBlock)!==e.endBlock)throw new globalThis.Error("value provided for field message.endBlock of type uint64 too large");t.uint32(40).uint64(e.endBlock.toString())}return e.processorType!==""&&t.uint32(66).string(e.processorType),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=rx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.contract=hr.decode(n,n.uint32());continue;case 11:if(a!==90)break;i.intervalConfigs.push(ct.decode(n,n.uint32()));continue;case 3:if(a!==26)break;i.logConfigs.push(gr.decode(n,n.uint32()));continue;case 2:if(a!==18)break;i.traceConfigs.push(Ao.decode(n,n.uint32()));continue;case 7:if(a!==58)break;i.transactionConfig.push(yo.decode(n,n.uint32()));continue;case 9:if(a!==74)break;i.moveEventConfigs.push(To.decode(n,n.uint32()));continue;case 10:if(a!==82)break;i.moveCallConfigs.push(Ar.decode(n,n.uint32()));continue;case 12:if(a!==98)break;i.moveResourceChangeConfigs.push(Ro.decode(n,n.uint32()));continue;case 13:if(a!==106)break;i.fuelCallConfigs.push(Lo.decode(n,n.uint32()));continue;case 14:if(a!==114)break;i.assetConfigs.push(vo.decode(n,n.uint32()));continue;case 15:if(a!==122)break;i.fuelLogConfigs.push(bo.decode(n,n.uint32()));continue;case 16:if(a!==130)break;i.cosmosLogConfigs.push(Eo.decode(n,n.uint32()));continue;case 17:if(a!==138)break;i.starknetEventConfigs.push(Oo.decode(n,n.uint32()));continue;case 18:if(a!==146)break;i.btcTransactionConfigs.push(Po.decode(n,n.uint32()));continue;case 6:if(a!==50)break;i.instructionConfig=Io.decode(n,n.uint32());continue;case 4:if(a!==32)break;i.startBlock=Gt(n.uint64());continue;case 5:if(a!==40)break;i.endBlock=Gt(n.uint64());continue;case 8:if(a!==66)break;i.processorType=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{contract:S(e.contract)?hr.fromJSON(e.contract):void 0,intervalConfigs:globalThis.Array.isArray(e?.intervalConfigs)?e.intervalConfigs.map(t=>ct.fromJSON(t)):[],logConfigs:globalThis.Array.isArray(e?.logConfigs)?e.logConfigs.map(t=>gr.fromJSON(t)):[],traceConfigs:globalThis.Array.isArray(e?.traceConfigs)?e.traceConfigs.map(t=>Ao.fromJSON(t)):[],transactionConfig:globalThis.Array.isArray(e?.transactionConfig)?e.transactionConfig.map(t=>yo.fromJSON(t)):[],moveEventConfigs:globalThis.Array.isArray(e?.moveEventConfigs)?e.moveEventConfigs.map(t=>To.fromJSON(t)):[],moveCallConfigs:globalThis.Array.isArray(e?.moveCallConfigs)?e.moveCallConfigs.map(t=>Ar.fromJSON(t)):[],moveResourceChangeConfigs:globalThis.Array.isArray(e?.moveResourceChangeConfigs)?e.moveResourceChangeConfigs.map(t=>Ro.fromJSON(t)):[],fuelCallConfigs:globalThis.Array.isArray(e?.fuelCallConfigs)?e.fuelCallConfigs.map(t=>Lo.fromJSON(t)):[],assetConfigs:globalThis.Array.isArray(e?.assetConfigs)?e.assetConfigs.map(t=>vo.fromJSON(t)):[],fuelLogConfigs:globalThis.Array.isArray(e?.fuelLogConfigs)?e.fuelLogConfigs.map(t=>bo.fromJSON(t)):[],cosmosLogConfigs:globalThis.Array.isArray(e?.cosmosLogConfigs)?e.cosmosLogConfigs.map(t=>Eo.fromJSON(t)):[],starknetEventConfigs:globalThis.Array.isArray(e?.starknetEventConfigs)?e.starknetEventConfigs.map(t=>Oo.fromJSON(t)):[],btcTransactionConfigs:globalThis.Array.isArray(e?.btcTransactionConfigs)?e.btcTransactionConfigs.map(t=>Po.fromJSON(t)):[],instructionConfig:S(e.instructionConfig)?Io.fromJSON(e.instructionConfig):void 0,startBlock:S(e.startBlock)?BigInt(e.startBlock):BigInt("0"),endBlock:S(e.endBlock)?BigInt(e.endBlock):BigInt("0"),processorType:S(e.processorType)?globalThis.String(e.processorType):""}},toJSON(e){let t={};return e.contract!==void 0&&(t.contract=hr.toJSON(e.contract)),e.intervalConfigs?.length&&(t.intervalConfigs=e.intervalConfigs.map(n=>ct.toJSON(n))),e.logConfigs?.length&&(t.logConfigs=e.logConfigs.map(n=>gr.toJSON(n))),e.traceConfigs?.length&&(t.traceConfigs=e.traceConfigs.map(n=>Ao.toJSON(n))),e.transactionConfig?.length&&(t.transactionConfig=e.transactionConfig.map(n=>yo.toJSON(n))),e.moveEventConfigs?.length&&(t.moveEventConfigs=e.moveEventConfigs.map(n=>To.toJSON(n))),e.moveCallConfigs?.length&&(t.moveCallConfigs=e.moveCallConfigs.map(n=>Ar.toJSON(n))),e.moveResourceChangeConfigs?.length&&(t.moveResourceChangeConfigs=e.moveResourceChangeConfigs.map(n=>Ro.toJSON(n))),e.fuelCallConfigs?.length&&(t.fuelCallConfigs=e.fuelCallConfigs.map(n=>Lo.toJSON(n))),e.assetConfigs?.length&&(t.assetConfigs=e.assetConfigs.map(n=>vo.toJSON(n))),e.fuelLogConfigs?.length&&(t.fuelLogConfigs=e.fuelLogConfigs.map(n=>bo.toJSON(n))),e.cosmosLogConfigs?.length&&(t.cosmosLogConfigs=e.cosmosLogConfigs.map(n=>Eo.toJSON(n))),e.starknetEventConfigs?.length&&(t.starknetEventConfigs=e.starknetEventConfigs.map(n=>Oo.toJSON(n))),e.btcTransactionConfigs?.length&&(t.btcTransactionConfigs=e.btcTransactionConfigs.map(n=>Po.toJSON(n))),e.instructionConfig!==void 0&&(t.instructionConfig=Io.toJSON(e.instructionConfig)),e.startBlock!==BigInt("0")&&(t.startBlock=e.startBlock.toString()),e.endBlock!==BigInt("0")&&(t.endBlock=e.endBlock.toString()),e.processorType!==""&&(t.processorType=e.processorType),t},create(e){return co.fromPartial(e??{})},fromPartial(e){let t=rx();return t.contract=e.contract!==void 0&&e.contract!==null?hr.fromPartial(e.contract):void 0,t.intervalConfigs=e.intervalConfigs?.map(n=>ct.fromPartial(n))||[],t.logConfigs=e.logConfigs?.map(n=>gr.fromPartial(n))||[],t.traceConfigs=e.traceConfigs?.map(n=>Ao.fromPartial(n))||[],t.transactionConfig=e.transactionConfig?.map(n=>yo.fromPartial(n))||[],t.moveEventConfigs=e.moveEventConfigs?.map(n=>To.fromPartial(n))||[],t.moveCallConfigs=e.moveCallConfigs?.map(n=>Ar.fromPartial(n))||[],t.moveResourceChangeConfigs=e.moveResourceChangeConfigs?.map(n=>Ro.fromPartial(n))||[],t.fuelCallConfigs=e.fuelCallConfigs?.map(n=>Lo.fromPartial(n))||[],t.assetConfigs=e.assetConfigs?.map(n=>vo.fromPartial(n))||[],t.fuelLogConfigs=e.fuelLogConfigs?.map(n=>bo.fromPartial(n))||[],t.cosmosLogConfigs=e.cosmosLogConfigs?.map(n=>Eo.fromPartial(n))||[],t.starknetEventConfigs=e.starknetEventConfigs?.map(n=>Oo.fromPartial(n))||[],t.btcTransactionConfigs=e.btcTransactionConfigs?.map(n=>Po.fromPartial(n))||[],t.instructionConfig=e.instructionConfig!==void 0&&e.instructionConfig!==null?Io.fromPartial(e.instructionConfig):void 0,t.startBlock=e.startBlock??BigInt("0"),t.endBlock=e.endBlock??BigInt("0"),t.processorType=e.processorType??"",t}};function ix(){return{gqlSchema:""}}var uo={encode(e,t=g.default.Writer.create()){return e.gqlSchema!==""&&t.uint32(10).string(e.gqlSchema),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=ix();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.gqlSchema=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{gqlSchema:S(e.gqlSchema)?globalThis.String(e.gqlSchema):""}},toJSON(e){let t={};return e.gqlSchema!==""&&(t.gqlSchema=e.gqlSchema),t},create(e){return uo.fromPartial(e??{})},fromPartial(e){let t=ix();return t.gqlSchema=e.gqlSchema??"",t}};function ax(){return{}}var lo={encode(e,t=g.default.Writer.create()){return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=ax();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{}},toJSON(e){return{}},create(e){return lo.fromPartial(e??{})},fromPartial(e){return ax()}};function sx(){return{retentionEventName:"",days:0}}var fo={encode(e,t=g.default.Writer.create()){return e.retentionEventName!==""&&t.uint32(18).string(e.retentionEventName),e.days!==0&&t.uint32(24).int32(e.days),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=sx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 2:if(a!==18)break;i.retentionEventName=n.string();continue;case 3:if(a!==24)break;i.days=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{retentionEventName:S(e.retentionEventName)?globalThis.String(e.retentionEventName):"",days:S(e.days)?globalThis.Number(e.days):0}},toJSON(e){let t={};return e.retentionEventName!==""&&(t.retentionEventName=e.retentionEventName),e.days!==0&&(t.days=Math.round(e.days)),t},create(e){return fo.fromPartial(e??{})},fromPartial(e){let t=sx();return t.retentionEventName=e.retentionEventName??"",t.days=e.days??0,t}};function ox(){return{eventName:"",totalByDay:!1,unique:!1,totalPerEntity:void 0,distinctAggregationByDays:[],retentionConfig:void 0}}var po={encode(e,t=g.default.Writer.create()){e.eventName!==""&&t.uint32(10).string(e.eventName),e.totalByDay!==!1&&t.uint32(16).bool(e.totalByDay),e.unique!==!1&&t.uint32(24).bool(e.unique),e.totalPerEntity!==void 0&&lo.encode(e.totalPerEntity,t.uint32(34).fork()).ldelim(),t.uint32(42).fork();for(let n of e.distinctAggregationByDays)t.int32(n);return t.ldelim(),e.retentionConfig!==void 0&&fo.encode(e.retentionConfig,t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=ox();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.eventName=n.string();continue;case 2:if(a!==16)break;i.totalByDay=n.bool();continue;case 3:if(a!==24)break;i.unique=n.bool();continue;case 4:if(a!==34)break;i.totalPerEntity=lo.decode(n,n.uint32());continue;case 5:if(a===40){i.distinctAggregationByDays.push(n.int32());continue}if(a===42){let s=n.uint32()+n.pos;for(;n.pos<s;)i.distinctAggregationByDays.push(n.int32());continue}break;case 6:if(a!==50)break;i.retentionConfig=fo.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{eventName:S(e.eventName)?globalThis.String(e.eventName):"",totalByDay:S(e.totalByDay)?globalThis.Boolean(e.totalByDay):!1,unique:S(e.unique)?globalThis.Boolean(e.unique):!1,totalPerEntity:S(e.totalPerEntity)?lo.fromJSON(e.totalPerEntity):void 0,distinctAggregationByDays:globalThis.Array.isArray(e?.distinctAggregationByDays)?e.distinctAggregationByDays.map(t=>globalThis.Number(t)):[],retentionConfig:S(e.retentionConfig)?fo.fromJSON(e.retentionConfig):void 0}},toJSON(e){let t={};return e.eventName!==""&&(t.eventName=e.eventName),e.totalByDay!==!1&&(t.totalByDay=e.totalByDay),e.unique!==!1&&(t.unique=e.unique),e.totalPerEntity!==void 0&&(t.totalPerEntity=lo.toJSON(e.totalPerEntity)),e.distinctAggregationByDays?.length&&(t.distinctAggregationByDays=e.distinctAggregationByDays.map(n=>Math.round(n))),e.retentionConfig!==void 0&&(t.retentionConfig=fo.toJSON(e.retentionConfig)),t},create(e){return po.fromPartial(e??{})},fromPartial(e){let t=ox();return t.eventName=e.eventName??"",t.totalByDay=e.totalByDay??!1,t.unique=e.unique??!1,t.totalPerEntity=e.totalPerEntity!==void 0&&e.totalPerEntity!==null?lo.fromPartial(e.totalPerEntity):void 0,t.distinctAggregationByDays=e.distinctAggregationByDays?.map(n=>n)||[],t.retentionConfig=e.retentionConfig!==void 0&&e.retentionConfig!==null?fo.fromPartial(e.retentionConfig):void 0,t}};function cx(){return{name:"",channel:""}}var ho={encode(e,t=g.default.Writer.create()){return e.name!==""&&t.uint32(10).string(e.name),e.channel!==""&&t.uint32(18).string(e.channel),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=cx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.name=n.string();continue;case 2:if(a!==18)break;i.channel=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{name:S(e.name)?globalThis.String(e.name):"",channel:S(e.channel)?globalThis.String(e.channel):""}},toJSON(e){let t={};return e.name!==""&&(t.name=e.name),e.channel!==""&&(t.channel=e.channel),t},create(e){return ho.fromPartial(e??{})},fromPartial(e){let t=cx();return t.name=e.name??"",t.channel=e.channel??"",t}};function ux(){return{name:"",description:"",unit:"",sparse:!1,persistentBetweenVersion:!1,type:0,aggregationConfig:void 0}}var zr={encode(e,t=g.default.Writer.create()){return e.name!==""&&t.uint32(10).string(e.name),e.description!==""&&t.uint32(26).string(e.description),e.unit!==""&&t.uint32(18).string(e.unit),e.sparse!==!1&&t.uint32(32).bool(e.sparse),e.persistentBetweenVersion!==!1&&t.uint32(40).bool(e.persistentBetweenVersion),e.type!==0&&t.uint32(56).int32(e.type),e.aggregationConfig!==void 0&&mo.encode(e.aggregationConfig,t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=ux();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.name=n.string();continue;case 3:if(a!==26)break;i.description=n.string();continue;case 2:if(a!==18)break;i.unit=n.string();continue;case 4:if(a!==32)break;i.sparse=n.bool();continue;case 5:if(a!==40)break;i.persistentBetweenVersion=n.bool();continue;case 7:if(a!==56)break;i.type=n.int32();continue;case 6:if(a!==50)break;i.aggregationConfig=mo.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{name:S(e.name)?globalThis.String(e.name):"",description:S(e.description)?globalThis.String(e.description):"",unit:S(e.unit)?globalThis.String(e.unit):"",sparse:S(e.sparse)?globalThis.Boolean(e.sparse):!1,persistentBetweenVersion:S(e.persistentBetweenVersion)?globalThis.Boolean(e.persistentBetweenVersion):!1,type:S(e.type)?rq(e.type):0,aggregationConfig:S(e.aggregationConfig)?mo.fromJSON(e.aggregationConfig):void 0}},toJSON(e){let t={};return e.name!==""&&(t.name=e.name),e.description!==""&&(t.description=e.description),e.unit!==""&&(t.unit=e.unit),e.sparse!==!1&&(t.sparse=e.sparse),e.persistentBetweenVersion!==!1&&(t.persistentBetweenVersion=e.persistentBetweenVersion),e.type!==0&&(t.type=iq(e.type)),e.aggregationConfig!==void 0&&(t.aggregationConfig=mo.toJSON(e.aggregationConfig)),t},create(e){return zr.fromPartial(e??{})},fromPartial(e){let t=ux();return t.name=e.name??"",t.description=e.description??"",t.unit=e.unit??"",t.sparse=e.sparse??!1,t.persistentBetweenVersion=e.persistentBetweenVersion??!1,t.type=e.type??0,t.aggregationConfig=e.aggregationConfig!==void 0&&e.aggregationConfig!==null?mo.fromPartial(e.aggregationConfig):void 0,t}};function lx(){return{name:"",fields:[]}}var Ai={encode(e,t=g.default.Writer.create()){e.name!==""&&t.uint32(10).string(e.name);for(let n of e.fields)pr.encode(n,t.uint32(18).fork()).ldelim();return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=lx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.name=n.string();continue;case 2:if(a!==18)break;i.fields.push(pr.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{name:S(e.name)?globalThis.String(e.name):"",fields:globalThis.Array.isArray(e?.fields)?e.fields.map(t=>pr.fromJSON(t)):[]}},toJSON(e){let t={};return e.name!==""&&(t.name=e.name),e.fields?.length&&(t.fields=e.fields.map(n=>pr.toJSON(n))),t},create(e){return Ai.fromPartial(e??{})},fromPartial(e){let t=lx();return t.name=e.name??"",t.fields=e.fields?.map(n=>pr.fromPartial(n))||[],t}};function dx(){return{fields:[]}}var Wi={encode(e,t=g.default.Writer.create()){for(let n of e.fields)pr.encode(n,t.uint32(18).fork()).ldelim();return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=dx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 2:if(a!==18)break;i.fields.push(pr.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{fields:globalThis.Array.isArray(e?.fields)?e.fields.map(t=>pr.fromJSON(t)):[]}},toJSON(e){let t={};return e.fields?.length&&(t.fields=e.fields.map(n=>pr.toJSON(n))),t},create(e){return Wi.fromPartial(e??{})},fromPartial(e){let t=dx();return t.fields=e.fields?.map(n=>pr.fromPartial(n))||[],t}};function fx(){return{name:"",basicType:void 0,coinType:void 0,structType:void 0}}var pr={encode(e,t=g.default.Writer.create()){return e.name!==""&&t.uint32(10).string(e.name),e.basicType!==void 0&&t.uint32(16).int32(e.basicType),e.coinType!==void 0&&Vi.encode(e.coinType,t.uint32(26).fork()).ldelim(),e.structType!==void 0&&Wi.encode(e.structType,t.uint32(34).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=fx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.name=n.string();continue;case 2:if(a!==16)break;i.basicType=n.int32();continue;case 3:if(a!==26)break;i.coinType=Vi.decode(n,n.uint32());continue;case 4:if(a!==34)break;i.structType=Wi.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{name:S(e.name)?globalThis.String(e.name):"",basicType:S(e.basicType)?pq(e.basicType):void 0,coinType:S(e.coinType)?Vi.fromJSON(e.coinType):void 0,structType:S(e.structType)?Wi.fromJSON(e.structType):void 0}},toJSON(e){let t={};return e.name!==""&&(t.name=e.name),e.basicType!==void 0&&(t.basicType=hq(e.basicType)),e.coinType!==void 0&&(t.coinType=Vi.toJSON(e.coinType)),e.structType!==void 0&&(t.structType=Wi.toJSON(e.structType)),t},create(e){return pr.fromPartial(e??{})},fromPartial(e){let t=fx();return t.name=e.name??"",t.basicType=e.basicType??void 0,t.coinType=e.coinType!==void 0&&e.coinType!==null?Vi.fromPartial(e.coinType):void 0,t.structType=e.structType!==void 0&&e.structType!==null?Wi.fromPartial(e.structType):void 0,t}};function px(){return{intervalInMinutes:[],types:[],discardOrigin:!1}}var mo={encode(e,t=g.default.Writer.create()){t.uint32(10).fork();for(let n of e.intervalInMinutes)t.int32(n);t.ldelim(),t.uint32(18).fork();for(let n of e.types)t.int32(n);return t.ldelim(),e.discardOrigin!==!1&&t.uint32(24).bool(e.discardOrigin),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=px();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a===8){i.intervalInMinutes.push(n.int32());continue}if(a===10){let s=n.uint32()+n.pos;for(;n.pos<s;)i.intervalInMinutes.push(n.int32());continue}break;case 2:if(a===16){i.types.push(n.int32());continue}if(a===18){let s=n.uint32()+n.pos;for(;n.pos<s;)i.types.push(n.int32());continue}break;case 3:if(a!==24)break;i.discardOrigin=n.bool();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{intervalInMinutes:globalThis.Array.isArray(e?.intervalInMinutes)?e.intervalInMinutes.map(t=>globalThis.Number(t)):[],types:globalThis.Array.isArray(e?.types)?e.types.map(t=>aq(t)):[],discardOrigin:S(e.discardOrigin)?globalThis.Boolean(e.discardOrigin):!1}},toJSON(e){let t={};return e.intervalInMinutes?.length&&(t.intervalInMinutes=e.intervalInMinutes.map(n=>Math.round(n))),e.types?.length&&(t.types=e.types.map(n=>sq(n))),e.discardOrigin!==!1&&(t.discardOrigin=e.discardOrigin),t},create(e){return mo.fromPartial(e??{})},fromPartial(e){let t=px();return t.intervalInMinutes=e.intervalInMinutes?.map(n=>n)||[],t.types=e.types?.map(n=>n)||[],t.discardOrigin=e.discardOrigin??!1,t}};function hx(){return{chainId:"",address:"",startBlock:BigInt("0"),intervalConfigs:[],moveIntervalConfigs:[],moveCallConfigs:[],logConfigs:[]}}var go={encode(e,t=g.default.Writer.create()){if(e.chainId!==""&&t.uint32(10).string(e.chainId),e.address!==""&&t.uint32(18).string(e.address),e.startBlock!==BigInt("0")){if(BigInt.asUintN(64,e.startBlock)!==e.startBlock)throw new globalThis.Error("value provided for field message.startBlock of type uint64 too large");t.uint32(24).uint64(e.startBlock.toString())}for(let n of e.intervalConfigs)ct.encode(n,t.uint32(34).fork()).ldelim();for(let n of e.moveIntervalConfigs)_o.encode(n,t.uint32(58).fork()).ldelim();for(let n of e.moveCallConfigs)Ar.encode(n,t.uint32(66).fork()).ldelim();for(let n of e.logConfigs)gr.encode(n,t.uint32(50).fork()).ldelim();return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=hx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.chainId=n.string();continue;case 2:if(a!==18)break;i.address=n.string();continue;case 3:if(a!==24)break;i.startBlock=Gt(n.uint64());continue;case 4:if(a!==34)break;i.intervalConfigs.push(ct.decode(n,n.uint32()));continue;case 7:if(a!==58)break;i.moveIntervalConfigs.push(_o.decode(n,n.uint32()));continue;case 8:if(a!==66)break;i.moveCallConfigs.push(Ar.decode(n,n.uint32()));continue;case 6:if(a!==50)break;i.logConfigs.push(gr.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{chainId:S(e.chainId)?globalThis.String(e.chainId):"",address:S(e.address)?globalThis.String(e.address):"",startBlock:S(e.startBlock)?BigInt(e.startBlock):BigInt("0"),intervalConfigs:globalThis.Array.isArray(e?.intervalConfigs)?e.intervalConfigs.map(t=>ct.fromJSON(t)):[],moveIntervalConfigs:globalThis.Array.isArray(e?.moveIntervalConfigs)?e.moveIntervalConfigs.map(t=>_o.fromJSON(t)):[],moveCallConfigs:globalThis.Array.isArray(e?.moveCallConfigs)?e.moveCallConfigs.map(t=>Ar.fromJSON(t)):[],logConfigs:globalThis.Array.isArray(e?.logConfigs)?e.logConfigs.map(t=>gr.fromJSON(t)):[]}},toJSON(e){let t={};return e.chainId!==""&&(t.chainId=e.chainId),e.address!==""&&(t.address=e.address),e.startBlock!==BigInt("0")&&(t.startBlock=e.startBlock.toString()),e.intervalConfigs?.length&&(t.intervalConfigs=e.intervalConfigs.map(n=>ct.toJSON(n))),e.moveIntervalConfigs?.length&&(t.moveIntervalConfigs=e.moveIntervalConfigs.map(n=>_o.toJSON(n))),e.moveCallConfigs?.length&&(t.moveCallConfigs=e.moveCallConfigs.map(n=>Ar.toJSON(n))),e.logConfigs?.length&&(t.logConfigs=e.logConfigs.map(n=>gr.toJSON(n))),t},create(e){return go.fromPartial(e??{})},fromPartial(e){let t=hx();return t.chainId=e.chainId??"",t.address=e.address??"",t.startBlock=e.startBlock??BigInt("0"),t.intervalConfigs=e.intervalConfigs?.map(n=>ct.fromPartial(n))||[],t.moveIntervalConfigs=e.moveIntervalConfigs?.map(n=>_o.fromPartial(n))||[],t.moveCallConfigs=e.moveCallConfigs?.map(n=>Ar.fromPartial(n))||[],t.logConfigs=e.logConfigs?.map(n=>gr.fromPartial(n))||[],t}};function mx(){return{recentInterval:0,backfillInterval:0}}var fr={encode(e,t=g.default.Writer.create()){return e.recentInterval!==0&&t.uint32(8).int32(e.recentInterval),e.backfillInterval!==0&&t.uint32(16).int32(e.backfillInterval),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=mx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.recentInterval=n.int32();continue;case 2:if(a!==16)break;i.backfillInterval=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{recentInterval:S(e.recentInterval)?globalThis.Number(e.recentInterval):0,backfillInterval:S(e.backfillInterval)?globalThis.Number(e.backfillInterval):0}},toJSON(e){let t={};return e.recentInterval!==0&&(t.recentInterval=Math.round(e.recentInterval)),e.backfillInterval!==0&&(t.backfillInterval=Math.round(e.backfillInterval)),t},create(e){return fr.fromPartial(e??{})},fromPartial(e){let t=mx();return t.recentInterval=e.recentInterval??0,t.backfillInterval=e.backfillInterval??0,t}};function gx(){return{handlerId:0,minutes:0,minutesInterval:void 0,slot:0,slotInterval:void 0,fetchConfig:void 0}}var ct={encode(e,t=g.default.Writer.create()){return e.handlerId!==0&&t.uint32(8).int32(e.handlerId),e.minutes!==0&&t.uint32(16).int32(e.minutes),e.minutesInterval!==void 0&&fr.encode(e.minutesInterval,t.uint32(34).fork()).ldelim(),e.slot!==0&&t.uint32(24).int32(e.slot),e.slotInterval!==void 0&&fr.encode(e.slotInterval,t.uint32(42).fork()).ldelim(),e.fetchConfig!==void 0&&ut.encode(e.fetchConfig,t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=gx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.handlerId=n.int32();continue;case 2:if(a!==16)break;i.minutes=n.int32();continue;case 4:if(a!==34)break;i.minutesInterval=fr.decode(n,n.uint32());continue;case 3:if(a!==24)break;i.slot=n.int32();continue;case 5:if(a!==42)break;i.slotInterval=fr.decode(n,n.uint32());continue;case 6:if(a!==50)break;i.fetchConfig=ut.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{handlerId:S(e.handlerId)?globalThis.Number(e.handlerId):0,minutes:S(e.minutes)?globalThis.Number(e.minutes):0,minutesInterval:S(e.minutesInterval)?fr.fromJSON(e.minutesInterval):void 0,slot:S(e.slot)?globalThis.Number(e.slot):0,slotInterval:S(e.slotInterval)?fr.fromJSON(e.slotInterval):void 0,fetchConfig:S(e.fetchConfig)?ut.fromJSON(e.fetchConfig):void 0}},toJSON(e){let t={};return e.handlerId!==0&&(t.handlerId=Math.round(e.handlerId)),e.minutes!==0&&(t.minutes=Math.round(e.minutes)),e.minutesInterval!==void 0&&(t.minutesInterval=fr.toJSON(e.minutesInterval)),e.slot!==0&&(t.slot=Math.round(e.slot)),e.slotInterval!==void 0&&(t.slotInterval=fr.toJSON(e.slotInterval)),e.fetchConfig!==void 0&&(t.fetchConfig=ut.toJSON(e.fetchConfig)),t},create(e){return ct.fromPartial(e??{})},fromPartial(e){let t=gx();return t.handlerId=e.handlerId??0,t.minutes=e.minutes??0,t.minutesInterval=e.minutesInterval!==void 0&&e.minutesInterval!==null?fr.fromPartial(e.minutesInterval):void 0,t.slot=e.slot??0,t.slotInterval=e.slotInterval!==void 0&&e.slotInterval!==null?fr.fromPartial(e.slotInterval):void 0,t.fetchConfig=e.fetchConfig!==void 0&&e.fetchConfig!==null?ut.fromPartial(e.fetchConfig):void 0,t}};function _x(){return{intervalConfig:void 0,type:""}}var _q={encode(e,t=g.default.Writer.create()){return e.intervalConfig!==void 0&&ct.encode(e.intervalConfig,t.uint32(10).fork()).ldelim(),e.type!==""&&t.uint32(18).string(e.type),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=_x();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.intervalConfig=ct.decode(n,n.uint32());continue;case 2:if(a!==18)break;i.type=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{intervalConfig:S(e.intervalConfig)?ct.fromJSON(e.intervalConfig):void 0,type:S(e.type)?globalThis.String(e.type):""}},toJSON(e){let t={};return e.intervalConfig!==void 0&&(t.intervalConfig=ct.toJSON(e.intervalConfig)),e.type!==""&&(t.type=e.type),t},create(e){return _q.fromPartial(e??{})},fromPartial(e){let t=_x();return t.intervalConfig=e.intervalConfig!==void 0&&e.intervalConfig!==null?ct.fromPartial(e.intervalConfig):void 0,t.type=e.type??"",t}};function Ax(){return{intervalConfig:void 0,type:"",ownerType:0,fetchConfig:void 0}}var _o={encode(e,t=g.default.Writer.create()){return e.intervalConfig!==void 0&&ct.encode(e.intervalConfig,t.uint32(10).fork()).ldelim(),e.type!==""&&t.uint32(18).string(e.type),e.ownerType!==0&&t.uint32(24).int32(e.ownerType),e.fetchConfig!==void 0&&xo.encode(e.fetchConfig,t.uint32(34).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Ax();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.intervalConfig=ct.decode(n,n.uint32());continue;case 2:if(a!==18)break;i.type=n.string();continue;case 3:if(a!==24)break;i.ownerType=n.int32();continue;case 4:if(a!==34)break;i.fetchConfig=xo.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{intervalConfig:S(e.intervalConfig)?ct.fromJSON(e.intervalConfig):void 0,type:S(e.type)?globalThis.String(e.type):"",ownerType:S(e.ownerType)?oq(e.ownerType):0,fetchConfig:S(e.fetchConfig)?xo.fromJSON(e.fetchConfig):void 0}},toJSON(e){let t={};return e.intervalConfig!==void 0&&(t.intervalConfig=ct.toJSON(e.intervalConfig)),e.type!==""&&(t.type=e.type),e.ownerType!==0&&(t.ownerType=cq(e.ownerType)),e.fetchConfig!==void 0&&(t.fetchConfig=xo.toJSON(e.fetchConfig)),t},create(e){return _o.fromPartial(e??{})},fromPartial(e){let t=Ax();return t.intervalConfig=e.intervalConfig!==void 0&&e.intervalConfig!==null?ct.fromPartial(e.intervalConfig):void 0,t.type=e.type??"",t.ownerType=e.ownerType??0,t.fetchConfig=e.fetchConfig!==void 0&&e.fetchConfig!==null?xo.fromPartial(e.fetchConfig):void 0,t}};function yx(){return{name:"",chainId:"",address:"",abi:""}}var hr={encode(e,t=g.default.Writer.create()){return e.name!==""&&t.uint32(10).string(e.name),e.chainId!==""&&t.uint32(18).string(e.chainId),e.address!==""&&t.uint32(26).string(e.address),e.abi!==""&&t.uint32(34).string(e.abi),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=yx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.name=n.string();continue;case 2:if(a!==18)break;i.chainId=n.string();continue;case 3:if(a!==26)break;i.address=n.string();continue;case 4:if(a!==34)break;i.abi=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{name:S(e.name)?globalThis.String(e.name):"",chainId:S(e.chainId)?globalThis.String(e.chainId):"",address:S(e.address)?globalThis.String(e.address):"",abi:S(e.abi)?globalThis.String(e.abi):""}},toJSON(e){let t={};return e.name!==""&&(t.name=e.name),e.chainId!==""&&(t.chainId=e.chainId),e.address!==""&&(t.address=e.address),e.abi!==""&&(t.abi=e.abi),t},create(e){return hr.fromPartial(e??{})},fromPartial(e){let t=yx();return t.name=e.name??"",t.chainId=e.chainId??"",t.address=e.address??"",t.abi=e.abi??"",t}};function vx(){return{contract:void 0,startBlock:BigInt("0"),endBlock:BigInt("0"),templateId:0,baseLabels:void 0}}var mr={encode(e,t=g.default.Writer.create()){if(e.contract!==void 0&&hr.encode(e.contract,t.uint32(10).fork()).ldelim(),e.startBlock!==BigInt("0")){if(BigInt.asUintN(64,e.startBlock)!==e.startBlock)throw new globalThis.Error("value provided for field message.startBlock of type uint64 too large");t.uint32(16).uint64(e.startBlock.toString())}if(e.endBlock!==BigInt("0")){if(BigInt.asUintN(64,e.endBlock)!==e.endBlock)throw new globalThis.Error("value provided for field message.endBlock of type uint64 too large");t.uint32(24).uint64(e.endBlock.toString())}return e.templateId!==0&&t.uint32(32).int32(e.templateId),e.baseLabels!==void 0&&M.encode(M.wrap(e.baseLabels),t.uint32(42).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=vx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.contract=hr.decode(n,n.uint32());continue;case 2:if(a!==16)break;i.startBlock=Gt(n.uint64());continue;case 3:if(a!==24)break;i.endBlock=Gt(n.uint64());continue;case 4:if(a!==32)break;i.templateId=n.int32();continue;case 5:if(a!==42)break;i.baseLabels=M.unwrap(M.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{contract:S(e.contract)?hr.fromJSON(e.contract):void 0,startBlock:S(e.startBlock)?BigInt(e.startBlock):BigInt("0"),endBlock:S(e.endBlock)?BigInt(e.endBlock):BigInt("0"),templateId:S(e.templateId)?globalThis.Number(e.templateId):0,baseLabels:Ve(e.baseLabels)?e.baseLabels:void 0}},toJSON(e){let t={};return e.contract!==void 0&&(t.contract=hr.toJSON(e.contract)),e.startBlock!==BigInt("0")&&(t.startBlock=e.startBlock.toString()),e.endBlock!==BigInt("0")&&(t.endBlock=e.endBlock.toString()),e.templateId!==0&&(t.templateId=Math.round(e.templateId)),e.baseLabels!==void 0&&(t.baseLabels=e.baseLabels),t},create(e){return mr.fromPartial(e??{})},fromPartial(e){let t=vx();return t.contract=e.contract!==void 0&&e.contract!==null?hr.fromPartial(e.contract):void 0,t.startBlock=e.startBlock??BigInt("0"),t.endBlock=e.endBlock??BigInt("0"),t.templateId=e.templateId??0,t.baseLabels=e.baseLabels??void 0,t}};function wx(){return{templateInstances:[]}}var ZT={encode(e,t=g.default.Writer.create()){for(let n of e.templateInstances)mr.encode(n,t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=wx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.templateInstances.push(mr.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{templateInstances:globalThis.Array.isArray(e?.templateInstances)?e.templateInstances.map(t=>mr.fromJSON(t)):[]}},toJSON(e){let t={};return e.templateInstances?.length&&(t.templateInstances=e.templateInstances.map(n=>mr.toJSON(n))),t},create(e){return ZT.fromPartial(e??{})},fromPartial(e){let t=wx();return t.templateInstances=e.templateInstances?.map(n=>mr.fromPartial(n))||[],t}};function bx(){return{handlerId:0}}var Aq={encode(e,t=g.default.Writer.create()){return e.handlerId!==0&&t.uint32(8).int32(e.handlerId),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=bx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.handlerId=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{handlerId:S(e.handlerId)?globalThis.Number(e.handlerId):0}},toJSON(e){let t={};return e.handlerId!==0&&(t.handlerId=Math.round(e.handlerId)),t},create(e){return Aq.fromPartial(e??{})},fromPartial(e){let t=bx();return t.handlerId=e.handlerId??0,t}};function Ex(){return{transaction:!1,transactionReceipt:!1,transactionReceiptLogs:!1,block:!1,trace:!1}}var ut={encode(e,t=g.default.Writer.create()){return e.transaction!==!1&&t.uint32(8).bool(e.transaction),e.transactionReceipt!==!1&&t.uint32(16).bool(e.transactionReceipt),e.transactionReceiptLogs!==!1&&t.uint32(40).bool(e.transactionReceiptLogs),e.block!==!1&&t.uint32(24).bool(e.block),e.trace!==!1&&t.uint32(32).bool(e.trace),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Ex();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.transaction=n.bool();continue;case 2:if(a!==16)break;i.transactionReceipt=n.bool();continue;case 5:if(a!==40)break;i.transactionReceiptLogs=n.bool();continue;case 3:if(a!==24)break;i.block=n.bool();continue;case 4:if(a!==32)break;i.trace=n.bool();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{transaction:S(e.transaction)?globalThis.Boolean(e.transaction):!1,transactionReceipt:S(e.transactionReceipt)?globalThis.Boolean(e.transactionReceipt):!1,transactionReceiptLogs:S(e.transactionReceiptLogs)?globalThis.Boolean(e.transactionReceiptLogs):!1,block:S(e.block)?globalThis.Boolean(e.block):!1,trace:S(e.trace)?globalThis.Boolean(e.trace):!1}},toJSON(e){let t={};return e.transaction!==!1&&(t.transaction=e.transaction),e.transactionReceipt!==!1&&(t.transactionReceipt=e.transactionReceipt),e.transactionReceiptLogs!==!1&&(t.transactionReceiptLogs=e.transactionReceiptLogs),e.block!==!1&&(t.block=e.block),e.trace!==!1&&(t.trace=e.trace),t},create(e){return ut.fromPartial(e??{})},fromPartial(e){let t=Ex();return t.transaction=e.transaction??!1,t.transactionReceipt=e.transactionReceipt??!1,t.transactionReceiptLogs=e.transactionReceiptLogs??!1,t.block=e.block??!1,t.trace=e.trace??!1,t}};function Cx(){return{signature:"",handlerId:0,fetchConfig:void 0}}var Ao={encode(e,t=g.default.Writer.create()){return e.signature!==""&&t.uint32(10).string(e.signature),e.handlerId!==0&&t.uint32(16).int32(e.handlerId),e.fetchConfig!==void 0&&ut.encode(e.fetchConfig,t.uint32(26).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Cx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.signature=n.string();continue;case 2:if(a!==16)break;i.handlerId=n.int32();continue;case 3:if(a!==26)break;i.fetchConfig=ut.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{signature:S(e.signature)?globalThis.String(e.signature):"",handlerId:S(e.handlerId)?globalThis.Number(e.handlerId):0,fetchConfig:S(e.fetchConfig)?ut.fromJSON(e.fetchConfig):void 0}},toJSON(e){let t={};return e.signature!==""&&(t.signature=e.signature),e.handlerId!==0&&(t.handlerId=Math.round(e.handlerId)),e.fetchConfig!==void 0&&(t.fetchConfig=ut.toJSON(e.fetchConfig)),t},create(e){return Ao.fromPartial(e??{})},fromPartial(e){let t=Cx();return t.signature=e.signature??"",t.handlerId=e.handlerId??0,t.fetchConfig=e.fetchConfig!==void 0&&e.fetchConfig!==null?ut.fromPartial(e.fetchConfig):void 0,t}};function Ix(){return{handlerId:0,fetchConfig:void 0}}var yo={encode(e,t=g.default.Writer.create()){return e.handlerId!==0&&t.uint32(8).int32(e.handlerId),e.fetchConfig!==void 0&&ut.encode(e.fetchConfig,t.uint32(26).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Ix();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.handlerId=n.int32();continue;case 3:if(a!==26)break;i.fetchConfig=ut.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{handlerId:S(e.handlerId)?globalThis.Number(e.handlerId):0,fetchConfig:S(e.fetchConfig)?ut.fromJSON(e.fetchConfig):void 0}},toJSON(e){let t={};return e.handlerId!==0&&(t.handlerId=Math.round(e.handlerId)),e.fetchConfig!==void 0&&(t.fetchConfig=ut.toJSON(e.fetchConfig)),t},create(e){return yo.fromPartial(e??{})},fromPartial(e){let t=Ix();return t.handlerId=e.handlerId??0,t.fetchConfig=e.fetchConfig!==void 0&&e.fetchConfig!==null?ut.fromPartial(e.fetchConfig):void 0,t}};function Sx(){return{filters:[],handlerId:0,fetchConfig:void 0}}var gr={encode(e,t=g.default.Writer.create()){for(let n of e.filters)Co.encode(n,t.uint32(10).fork()).ldelim();return e.handlerId!==0&&t.uint32(16).int32(e.handlerId),e.fetchConfig!==void 0&&ut.encode(e.fetchConfig,t.uint32(26).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Sx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.filters.push(Co.decode(n,n.uint32()));continue;case 2:if(a!==16)break;i.handlerId=n.int32();continue;case 3:if(a!==26)break;i.fetchConfig=ut.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{filters:globalThis.Array.isArray(e?.filters)?e.filters.map(t=>Co.fromJSON(t)):[],handlerId:S(e.handlerId)?globalThis.Number(e.handlerId):0,fetchConfig:S(e.fetchConfig)?ut.fromJSON(e.fetchConfig):void 0}},toJSON(e){let t={};return e.filters?.length&&(t.filters=e.filters.map(n=>Co.toJSON(n))),e.handlerId!==0&&(t.handlerId=Math.round(e.handlerId)),e.fetchConfig!==void 0&&(t.fetchConfig=ut.toJSON(e.fetchConfig)),t},create(e){return gr.fromPartial(e??{})},fromPartial(e){let t=Sx();return t.filters=e.filters?.map(n=>Co.fromPartial(n))||[],t.handlerId=e.handlerId??0,t.fetchConfig=e.fetchConfig!==void 0&&e.fetchConfig!==null?ut.fromPartial(e.fetchConfig):void 0,t}};function xx(){return{filters:[],handlerId:0}}var vo={encode(e,t=g.default.Writer.create()){for(let n of e.filters)wo.encode(n,t.uint32(10).fork()).ldelim();return e.handlerId!==0&&t.uint32(16).int32(e.handlerId),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=xx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.filters.push(wo.decode(n,n.uint32()));continue;case 2:if(a!==16)break;i.handlerId=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{filters:globalThis.Array.isArray(e?.filters)?e.filters.map(t=>wo.fromJSON(t)):[],handlerId:S(e.handlerId)?globalThis.Number(e.handlerId):0}},toJSON(e){let t={};return e.filters?.length&&(t.filters=e.filters.map(n=>wo.toJSON(n))),e.handlerId!==0&&(t.handlerId=Math.round(e.handlerId)),t},create(e){return vo.fromPartial(e??{})},fromPartial(e){let t=xx();return t.filters=e.filters?.map(n=>wo.fromPartial(n))||[],t.handlerId=e.handlerId??0,t}};function Tx(){return{assetId:void 0,fromAddress:void 0,toAddress:void 0}}var wo={encode(e,t=g.default.Writer.create()){return e.assetId!==void 0&&t.uint32(10).string(e.assetId),e.fromAddress!==void 0&&t.uint32(18).string(e.fromAddress),e.toAddress!==void 0&&t.uint32(26).string(e.toAddress),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Tx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.assetId=n.string();continue;case 2:if(a!==18)break;i.fromAddress=n.string();continue;case 3:if(a!==26)break;i.toAddress=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{assetId:S(e.assetId)?globalThis.String(e.assetId):void 0,fromAddress:S(e.fromAddress)?globalThis.String(e.fromAddress):void 0,toAddress:S(e.toAddress)?globalThis.String(e.toAddress):void 0}},toJSON(e){let t={};return e.assetId!==void 0&&(t.assetId=e.assetId),e.fromAddress!==void 0&&(t.fromAddress=e.fromAddress),e.toAddress!==void 0&&(t.toAddress=e.toAddress),t},create(e){return wo.fromPartial(e??{})},fromPartial(e){let t=Tx();return t.assetId=e.assetId??void 0,t.fromAddress=e.fromAddress??void 0,t.toAddress=e.toAddress??void 0,t}};function Nx(){return{logIds:[],handlerId:0}}var bo={encode(e,t=g.default.Writer.create()){for(let n of e.logIds)t.uint32(10).string(n);return e.handlerId!==0&&t.uint32(16).int32(e.handlerId),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Nx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.logIds.push(n.string());continue;case 2:if(a!==16)break;i.handlerId=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{logIds:globalThis.Array.isArray(e?.logIds)?e.logIds.map(t=>globalThis.String(t)):[],handlerId:S(e.handlerId)?globalThis.Number(e.handlerId):0}},toJSON(e){let t={};return e.logIds?.length&&(t.logIds=e.logIds),e.handlerId!==0&&(t.handlerId=Math.round(e.handlerId)),t},create(e){return bo.fromPartial(e??{})},fromPartial(e){let t=Nx();return t.logIds=e.logIds?.map(n=>n)||[],t.handlerId=e.handlerId??0,t}};function Rx(){return{logFilters:[],handlerId:0}}var Eo={encode(e,t=g.default.Writer.create()){for(let n of e.logFilters)t.uint32(10).string(n);return e.handlerId!==0&&t.uint32(16).int32(e.handlerId),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Rx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.logFilters.push(n.string());continue;case 2:if(a!==16)break;i.handlerId=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{logFilters:globalThis.Array.isArray(e?.logFilters)?e.logFilters.map(t=>globalThis.String(t)):[],handlerId:S(e.handlerId)?globalThis.Number(e.handlerId):0}},toJSON(e){let t={};return e.logFilters?.length&&(t.logFilters=e.logFilters),e.handlerId!==0&&(t.handlerId=Math.round(e.handlerId)),t},create(e){return Eo.fromPartial(e??{})},fromPartial(e){let t=Rx();return t.logFilters=e.logFilters?.map(n=>n)||[],t.handlerId=e.handlerId??0,t}};function Bx(){return{topics:[],address:void 0,addressType:void 0}}var Co={encode(e,t=g.default.Writer.create()){for(let n of e.topics)Qo.encode(n,t.uint32(10).fork()).ldelim();return e.address!==void 0&&t.uint32(18).string(e.address),e.addressType!==void 0&&t.uint32(24).int32(e.addressType),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Bx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.topics.push(Qo.decode(n,n.uint32()));continue;case 2:if(a!==18)break;i.address=n.string();continue;case 3:if(a!==24)break;i.addressType=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{topics:globalThis.Array.isArray(e?.topics)?e.topics.map(t=>Qo.fromJSON(t)):[],address:S(e.address)?globalThis.String(e.address):void 0,addressType:S(e.addressType)?uq(e.addressType):void 0}},toJSON(e){let t={};return e.topics?.length&&(t.topics=e.topics.map(n=>Qo.toJSON(n))),e.address!==void 0&&(t.address=e.address),e.addressType!==void 0&&(t.addressType=lq(e.addressType)),t},create(e){return Co.fromPartial(e??{})},fromPartial(e){let t=Bx();return t.topics=e.topics?.map(n=>Qo.fromPartial(n))||[],t.address=e.address??void 0,t.addressType=e.addressType??void 0,t}};function kx(){return{innerInstruction:!1,parsedInstruction:!1,rawDataInstruction:!1}}var Io={encode(e,t=g.default.Writer.create()){return e.innerInstruction!==!1&&t.uint32(8).bool(e.innerInstruction),e.parsedInstruction!==!1&&t.uint32(16).bool(e.parsedInstruction),e.rawDataInstruction!==!1&&t.uint32(24).bool(e.rawDataInstruction),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=kx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.innerInstruction=n.bool();continue;case 2:if(a!==16)break;i.parsedInstruction=n.bool();continue;case 3:if(a!==24)break;i.rawDataInstruction=n.bool();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{innerInstruction:S(e.innerInstruction)?globalThis.Boolean(e.innerInstruction):!1,parsedInstruction:S(e.parsedInstruction)?globalThis.Boolean(e.parsedInstruction):!1,rawDataInstruction:S(e.rawDataInstruction)?globalThis.Boolean(e.rawDataInstruction):!1}},toJSON(e){let t={};return e.innerInstruction!==!1&&(t.innerInstruction=e.innerInstruction),e.parsedInstruction!==!1&&(t.parsedInstruction=e.parsedInstruction),e.rawDataInstruction!==!1&&(t.rawDataInstruction=e.rawDataInstruction),t},create(e){return Io.fromPartial(e??{})},fromPartial(e){let t=kx();return t.innerInstruction=e.innerInstruction??!1,t.parsedInstruction=e.parsedInstruction??!1,t.rawDataInstruction=e.rawDataInstruction??!1,t}};function Ox(){return{moveTypePrefix:""}}var So={encode(e,t=g.default.Writer.create()){return e.moveTypePrefix!==""&&t.uint32(10).string(e.moveTypePrefix),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Ox();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.moveTypePrefix=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{moveTypePrefix:S(e.moveTypePrefix)?globalThis.String(e.moveTypePrefix):""}},toJSON(e){let t={};return e.moveTypePrefix!==""&&(t.moveTypePrefix=e.moveTypePrefix),t},create(e){return So.fromPartial(e??{})},fromPartial(e){let t=Ox();return t.moveTypePrefix=e.moveTypePrefix??"",t}};function Px(){return{resourceChanges:!1,allEvents:!1,inputs:!1,resourceConfig:void 0}}var _r={encode(e,t=g.default.Writer.create()){return e.resourceChanges!==!1&&t.uint32(8).bool(e.resourceChanges),e.allEvents!==!1&&t.uint32(16).bool(e.allEvents),e.inputs!==!1&&t.uint32(32).bool(e.inputs),e.resourceConfig!==void 0&&So.encode(e.resourceConfig,t.uint32(26).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Px();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.resourceChanges=n.bool();continue;case 2:if(a!==16)break;i.allEvents=n.bool();continue;case 4:if(a!==32)break;i.inputs=n.bool();continue;case 3:if(a!==26)break;i.resourceConfig=So.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{resourceChanges:S(e.resourceChanges)?globalThis.Boolean(e.resourceChanges):!1,allEvents:S(e.allEvents)?globalThis.Boolean(e.allEvents):!1,inputs:S(e.inputs)?globalThis.Boolean(e.inputs):!1,resourceConfig:S(e.resourceConfig)?So.fromJSON(e.resourceConfig):void 0}},toJSON(e){let t={};return e.resourceChanges!==!1&&(t.resourceChanges=e.resourceChanges),e.allEvents!==!1&&(t.allEvents=e.allEvents),e.inputs!==!1&&(t.inputs=e.inputs),e.resourceConfig!==void 0&&(t.resourceConfig=So.toJSON(e.resourceConfig)),t},create(e){return _r.fromPartial(e??{})},fromPartial(e){let t=Px();return t.resourceChanges=e.resourceChanges??!1,t.allEvents=e.allEvents??!1,t.inputs=e.inputs??!1,t.resourceConfig=e.resourceConfig!==void 0&&e.resourceConfig!==null?So.fromPartial(e.resourceConfig):void 0,t}};function Dx(){return{owned:!1}}var xo={encode(e,t=g.default.Writer.create()){return e.owned!==!1&&t.uint32(8).bool(e.owned),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Dx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.owned=n.bool();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{owned:S(e.owned)?globalThis.Boolean(e.owned):!1}},toJSON(e){let t={};return e.owned!==!1&&(t.owned=e.owned),t},create(e){return xo.fromPartial(e??{})},fromPartial(e){let t=Dx();return t.owned=e.owned??!1,t}};function Mx(){return{filters:[],handlerId:0,fetchConfig:void 0}}var To={encode(e,t=g.default.Writer.create()){for(let n of e.filters)No.encode(n,t.uint32(10).fork()).ldelim();return e.handlerId!==0&&t.uint32(16).int32(e.handlerId),e.fetchConfig!==void 0&&_r.encode(e.fetchConfig,t.uint32(26).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Mx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.filters.push(No.decode(n,n.uint32()));continue;case 2:if(a!==16)break;i.handlerId=n.int32();continue;case 3:if(a!==26)break;i.fetchConfig=_r.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{filters:globalThis.Array.isArray(e?.filters)?e.filters.map(t=>No.fromJSON(t)):[],handlerId:S(e.handlerId)?globalThis.Number(e.handlerId):0,fetchConfig:S(e.fetchConfig)?_r.fromJSON(e.fetchConfig):void 0}},toJSON(e){let t={};return e.filters?.length&&(t.filters=e.filters.map(n=>No.toJSON(n))),e.handlerId!==0&&(t.handlerId=Math.round(e.handlerId)),e.fetchConfig!==void 0&&(t.fetchConfig=_r.toJSON(e.fetchConfig)),t},create(e){return To.fromPartial(e??{})},fromPartial(e){let t=Mx();return t.filters=e.filters?.map(n=>No.fromPartial(n))||[],t.handlerId=e.handlerId??0,t.fetchConfig=e.fetchConfig!==void 0&&e.fetchConfig!==null?_r.fromPartial(e.fetchConfig):void 0,t}};function Fx(){return{type:"",account:""}}var No={encode(e,t=g.default.Writer.create()){return e.type!==""&&t.uint32(10).string(e.type),e.account!==""&&t.uint32(18).string(e.account),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Fx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.type=n.string();continue;case 2:if(a!==18)break;i.account=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{type:S(e.type)?globalThis.String(e.type):"",account:S(e.account)?globalThis.String(e.account):""}},toJSON(e){let t={};return e.type!==""&&(t.type=e.type),e.account!==""&&(t.account=e.account),t},create(e){return No.fromPartial(e??{})},fromPartial(e){let t=Fx();return t.type=e.type??"",t.account=e.account??"",t}};function Lx(){return{filters:[],handlerId:0,fetchConfig:void 0}}var Ar={encode(e,t=g.default.Writer.create()){for(let n of e.filters)Bo.encode(n,t.uint32(10).fork()).ldelim();return e.handlerId!==0&&t.uint32(16).int32(e.handlerId),e.fetchConfig!==void 0&&_r.encode(e.fetchConfig,t.uint32(26).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Lx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.filters.push(Bo.decode(n,n.uint32()));continue;case 2:if(a!==16)break;i.handlerId=n.int32();continue;case 3:if(a!==26)break;i.fetchConfig=_r.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{filters:globalThis.Array.isArray(e?.filters)?e.filters.map(t=>Bo.fromJSON(t)):[],handlerId:S(e.handlerId)?globalThis.Number(e.handlerId):0,fetchConfig:S(e.fetchConfig)?_r.fromJSON(e.fetchConfig):void 0}},toJSON(e){let t={};return e.filters?.length&&(t.filters=e.filters.map(n=>Bo.toJSON(n))),e.handlerId!==0&&(t.handlerId=Math.round(e.handlerId)),e.fetchConfig!==void 0&&(t.fetchConfig=_r.toJSON(e.fetchConfig)),t},create(e){return Ar.fromPartial(e??{})},fromPartial(e){let t=Lx();return t.filters=e.filters?.map(n=>Bo.fromPartial(n))||[],t.handlerId=e.handlerId??0,t.fetchConfig=e.fetchConfig!==void 0&&e.fetchConfig!==null?_r.fromPartial(e.fetchConfig):void 0,t}};function Qx(){return{type:"",handlerId:0}}var Ro={encode(e,t=g.default.Writer.create()){return e.type!==""&&t.uint32(10).string(e.type),e.handlerId!==0&&t.uint32(16).int32(e.handlerId),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Qx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.type=n.string();continue;case 2:if(a!==16)break;i.handlerId=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{type:S(e.type)?globalThis.String(e.type):"",handlerId:S(e.handlerId)?globalThis.Number(e.handlerId):0}},toJSON(e){let t={};return e.type!==""&&(t.type=e.type),e.handlerId!==0&&(t.handlerId=Math.round(e.handlerId)),t},create(e){return Ro.fromPartial(e??{})},fromPartial(e){let t=Qx();return t.type=e.type??"",t.handlerId=e.handlerId??0,t}};function Ux(){return{function:"",typeArguments:[],withTypeArguments:!1,includeFailed:!1,publicKeyPrefix:"",fromAndToAddress:void 0}}var Bo={encode(e,t=g.default.Writer.create()){e.function!==""&&t.uint32(10).string(e.function);for(let n of e.typeArguments)t.uint32(18).string(n);return e.withTypeArguments!==!1&&t.uint32(24).bool(e.withTypeArguments),e.includeFailed!==!1&&t.uint32(32).bool(e.includeFailed),e.publicKeyPrefix!==""&&t.uint32(42).string(e.publicKeyPrefix),e.fromAndToAddress!==void 0&&ko.encode(e.fromAndToAddress,t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Ux();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.function=n.string();continue;case 2:if(a!==18)break;i.typeArguments.push(n.string());continue;case 3:if(a!==24)break;i.withTypeArguments=n.bool();continue;case 4:if(a!==32)break;i.includeFailed=n.bool();continue;case 5:if(a!==42)break;i.publicKeyPrefix=n.string();continue;case 6:if(a!==50)break;i.fromAndToAddress=ko.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{function:S(e.function)?globalThis.String(e.function):"",typeArguments:globalThis.Array.isArray(e?.typeArguments)?e.typeArguments.map(t=>globalThis.String(t)):[],withTypeArguments:S(e.withTypeArguments)?globalThis.Boolean(e.withTypeArguments):!1,includeFailed:S(e.includeFailed)?globalThis.Boolean(e.includeFailed):!1,publicKeyPrefix:S(e.publicKeyPrefix)?globalThis.String(e.publicKeyPrefix):"",fromAndToAddress:S(e.fromAndToAddress)?ko.fromJSON(e.fromAndToAddress):void 0}},toJSON(e){let t={};return e.function!==""&&(t.function=e.function),e.typeArguments?.length&&(t.typeArguments=e.typeArguments),e.withTypeArguments!==!1&&(t.withTypeArguments=e.withTypeArguments),e.includeFailed!==!1&&(t.includeFailed=e.includeFailed),e.publicKeyPrefix!==""&&(t.publicKeyPrefix=e.publicKeyPrefix),e.fromAndToAddress!==void 0&&(t.fromAndToAddress=ko.toJSON(e.fromAndToAddress)),t},create(e){return Bo.fromPartial(e??{})},fromPartial(e){let t=Ux();return t.function=e.function??"",t.typeArguments=e.typeArguments?.map(n=>n)||[],t.withTypeArguments=e.withTypeArguments??!1,t.includeFailed=e.includeFailed??!1,t.publicKeyPrefix=e.publicKeyPrefix??"",t.fromAndToAddress=e.fromAndToAddress!==void 0&&e.fromAndToAddress!==null?ko.fromPartial(e.fromAndToAddress):void 0,t}};function qx(){return{from:"",to:""}}var ko={encode(e,t=g.default.Writer.create()){return e.from!==""&&t.uint32(10).string(e.from),e.to!==""&&t.uint32(18).string(e.to),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=qx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.from=n.string();continue;case 2:if(a!==18)break;i.to=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{from:S(e.from)?globalThis.String(e.from):"",to:S(e.to)?globalThis.String(e.to):""}},toJSON(e){let t={};return e.from!==""&&(t.from=e.from),e.to!==""&&(t.to=e.to),t},create(e){return ko.fromPartial(e??{})},fromPartial(e){let t=qx();return t.from=e.from??"",t.to=e.to??"",t}};function Jx(){return{filters:[],handlerId:0}}var Oo={encode(e,t=g.default.Writer.create()){for(let n of e.filters)Mo.encode(n,t.uint32(10).fork()).ldelim();return e.handlerId!==0&&t.uint32(16).int32(e.handlerId),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Jx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.filters.push(Mo.decode(n,n.uint32()));continue;case 2:if(a!==16)break;i.handlerId=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{filters:globalThis.Array.isArray(e?.filters)?e.filters.map(t=>Mo.fromJSON(t)):[],handlerId:S(e.handlerId)?globalThis.Number(e.handlerId):0}},toJSON(e){let t={};return e.filters?.length&&(t.filters=e.filters.map(n=>Mo.toJSON(n))),e.handlerId!==0&&(t.handlerId=Math.round(e.handlerId)),t},create(e){return Oo.fromPartial(e??{})},fromPartial(e){let t=Jx();return t.filters=e.filters?.map(n=>Mo.fromPartial(n))||[],t.handlerId=e.handlerId??0,t}};function zx(){return{filters:[],handlerId:0}}var Po={encode(e,t=g.default.Writer.create()){for(let n of e.filters)Do.encode(n,t.uint32(10).fork()).ldelim();return e.handlerId!==0&&t.uint32(16).int32(e.handlerId),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=zx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.filters.push(Do.decode(n,n.uint32()));continue;case 2:if(a!==16)break;i.handlerId=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{filters:globalThis.Array.isArray(e?.filters)?e.filters.map(t=>Do.fromJSON(t)):[],handlerId:S(e.handlerId)?globalThis.Number(e.handlerId):0}},toJSON(e){let t={};return e.filters?.length&&(t.filters=e.filters.map(n=>Do.toJSON(n))),e.handlerId!==0&&(t.handlerId=Math.round(e.handlerId)),t},create(e){return Po.fromPartial(e??{})},fromPartial(e){let t=zx();return t.filters=e.filters?.map(n=>Do.fromPartial(n))||[],t.handlerId=e.handlerId??0,t}};function Vx(){return{address:""}}var Do={encode(e,t=g.default.Writer.create()){return e.address!==""&&t.uint32(10).string(e.address),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Vx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.address=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{address:S(e.address)?globalThis.String(e.address):""}},toJSON(e){let t={};return e.address!==""&&(t.address=e.address),t},create(e){return Do.fromPartial(e??{})},fromPartial(e){let t=Vx();return t.address=e.address??"",t}};function Gx(){return{address:"",keys:[]}}var Mo={encode(e,t=g.default.Writer.create()){e.address!==""&&t.uint32(10).string(e.address);for(let n of e.keys)t.uint32(18).string(n);return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Gx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.address=n.string();continue;case 2:if(a!==18)break;i.keys.push(n.string());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{address:S(e.address)?globalThis.String(e.address):"",keys:globalThis.Array.isArray(e?.keys)?e.keys.map(t=>globalThis.String(t)):[]}},toJSON(e){let t={};return e.address!==""&&(t.address=e.address),e.keys?.length&&(t.keys=e.keys),t},create(e){return Mo.fromPartial(e??{})},fromPartial(e){let t=Gx();return t.address=e.address??"",t.keys=e.keys?.map(n=>n)||[],t}};function Wx(){return{function:"",includeFailed:!1}}var Fo={encode(e,t=g.default.Writer.create()){return e.function!==""&&t.uint32(10).string(e.function),e.includeFailed!==!1&&t.uint32(16).bool(e.includeFailed),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Wx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.function=n.string();continue;case 2:if(a!==16)break;i.includeFailed=n.bool();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{function:S(e.function)?globalThis.String(e.function):"",includeFailed:S(e.includeFailed)?globalThis.Boolean(e.includeFailed):!1}},toJSON(e){let t={};return e.function!==""&&(t.function=e.function),e.includeFailed!==!1&&(t.includeFailed=e.includeFailed),t},create(e){return Fo.fromPartial(e??{})},fromPartial(e){let t=Wx();return t.function=e.function??"",t.includeFailed=e.includeFailed??!1,t}};function Hx(){return{filters:[],handlerId:0}}var Lo={encode(e,t=g.default.Writer.create()){for(let n of e.filters)Fo.encode(n,t.uint32(10).fork()).ldelim();return e.handlerId!==0&&t.uint32(16).int32(e.handlerId),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Hx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.filters.push(Fo.decode(n,n.uint32()));continue;case 2:if(a!==16)break;i.handlerId=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{filters:globalThis.Array.isArray(e?.filters)?e.filters.map(t=>Fo.fromJSON(t)):[],handlerId:S(e.handlerId)?globalThis.Number(e.handlerId):0}},toJSON(e){let t={};return e.filters?.length&&(t.filters=e.filters.map(n=>Fo.toJSON(n))),e.handlerId!==0&&(t.handlerId=Math.round(e.handlerId)),t},create(e){return Lo.fromPartial(e??{})},fromPartial(e){let t=Hx();return t.filters=e.filters?.map(n=>Fo.fromPartial(n))||[],t.handlerId=e.handlerId??0,t}};function Zx(){return{hashes:[]}}var Qo={encode(e,t=g.default.Writer.create()){for(let n of e.hashes)t.uint32(10).string(n);return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Zx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.hashes.push(n.string());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{hashes:globalThis.Array.isArray(e?.hashes)?e.hashes.map(t=>globalThis.String(t)):[]}},toJSON(e){let t={};return e.hashes?.length&&(t.hashes=e.hashes),t},create(e){return Qo.fromPartial(e??{})},fromPartial(e){let t=Zx();return t.hashes=e.hashes?.map(n=>n)||[],t}};function Xx(){return{bindings:[]}}var XT={encode(e,t=g.default.Writer.create()){for(let n of e.bindings)Vt.encode(n,t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Xx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.bindings.push(Vt.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{bindings:globalThis.Array.isArray(e?.bindings)?e.bindings.map(t=>Vt.fromJSON(t)):[]}},toJSON(e){let t={};return e.bindings?.length&&(t.bindings=e.bindings.map(n=>Vt.toJSON(n))),t},create(e){return XT.fromPartial(e??{})},fromPartial(e){let t=Xx();return t.bindings=e.bindings?.map(n=>Vt.fromPartial(n))||[],t}};function Yx(){return{result:void 0}}var YT={encode(e,t=g.default.Writer.create()){return e.result!==void 0&&vn.encode(e.result,t.uint32(10).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Yx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.result=vn.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{result:S(e.result)?vn.fromJSON(e.result):void 0}},toJSON(e){let t={};return e.result!==void 0&&(t.result=vn.toJSON(e.result)),t},create(e){return YT.fromPartial(e??{})},fromPartial(e){let t=Yx();return t.result=e.result!==void 0&&e.result!==null?vn.fromPartial(e.result):void 0,t}};function $x(){return{processId:0,binding:void 0,dbResult:void 0}}var $T={encode(e,t=g.default.Writer.create()){return e.processId!==0&&t.uint32(8).int32(e.processId),e.binding!==void 0&&Vt.encode(e.binding,t.uint32(18).fork()).ldelim(),e.dbResult!==void 0&&yr.encode(e.dbResult,t.uint32(26).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=$x();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.processId=n.int32();continue;case 2:if(a!==18)break;i.binding=Vt.decode(n,n.uint32());continue;case 3:if(a!==26)break;i.dbResult=yr.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{processId:S(e.processId)?globalThis.Number(e.processId):0,binding:S(e.binding)?Vt.fromJSON(e.binding):void 0,dbResult:S(e.dbResult)?yr.fromJSON(e.dbResult):void 0}},toJSON(e){let t={};return e.processId!==0&&(t.processId=Math.round(e.processId)),e.binding!==void 0&&(t.binding=Vt.toJSON(e.binding)),e.dbResult!==void 0&&(t.dbResult=yr.toJSON(e.dbResult)),t},create(e){return $T.fromPartial(e??{})},fromPartial(e){let t=$x();return t.processId=e.processId??0,t.binding=e.binding!==void 0&&e.binding!==null?Vt.fromPartial(e.binding):void 0,t.dbResult=e.dbResult!==void 0&&e.dbResult!==null?yr.fromPartial(e.dbResult):void 0,t}};function Kx(){return{processId:0,dbRequest:void 0,result:void 0}}var KT={encode(e,t=g.default.Writer.create()){return e.processId!==0&&t.uint32(8).int32(e.processId),e.dbRequest!==void 0&&vr.encode(e.dbRequest,t.uint32(18).fork()).ldelim(),e.result!==void 0&&vn.encode(e.result,t.uint32(26).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=Kx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.processId=n.int32();continue;case 2:if(a!==18)break;i.dbRequest=vr.decode(n,n.uint32());continue;case 3:if(a!==26)break;i.result=vn.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{processId:S(e.processId)?globalThis.Number(e.processId):0,dbRequest:S(e.dbRequest)?vr.fromJSON(e.dbRequest):void 0,result:S(e.result)?vn.fromJSON(e.result):void 0}},toJSON(e){let t={};return e.processId!==0&&(t.processId=Math.round(e.processId)),e.dbRequest!==void 0&&(t.dbRequest=vr.toJSON(e.dbRequest)),e.result!==void 0&&(t.result=vn.toJSON(e.result)),t},create(e){return KT.fromPartial(e??{})},fromPartial(e){let t=Kx();return t.processId=e.processId??0,t.dbRequest=e.dbRequest!==void 0&&e.dbRequest!==null?vr.fromPartial(e.dbRequest):void 0,t.result=e.result!==void 0&&e.result!==null?vn.fromPartial(e.result):void 0,t}};function jx(){return{processId:0,bindings:void 0,dbResult:void 0}}var jT={encode(e,t=g.default.Writer.create()){return e.processId!==0&&t.uint32(8).int32(e.processId),e.bindings!==void 0&&Uo.encode(e.bindings,t.uint32(18).fork()).ldelim(),e.dbResult!==void 0&&yr.encode(e.dbResult,t.uint32(26).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=jx();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.processId=n.int32();continue;case 2:if(a!==18)break;i.bindings=Uo.decode(n,n.uint32());continue;case 3:if(a!==26)break;i.dbResult=yr.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{processId:S(e.processId)?globalThis.Number(e.processId):0,bindings:S(e.bindings)?Uo.fromJSON(e.bindings):void 0,dbResult:S(e.dbResult)?yr.fromJSON(e.dbResult):void 0}},toJSON(e){let t={};return e.processId!==0&&(t.processId=Math.round(e.processId)),e.bindings!==void 0&&(t.bindings=Uo.toJSON(e.bindings)),e.dbResult!==void 0&&(t.dbResult=yr.toJSON(e.dbResult)),t},create(e){return jT.fromPartial(e??{})},fromPartial(e){let t=jx();return t.processId=e.processId??0,t.bindings=e.bindings!==void 0&&e.bindings!==null?Uo.fromPartial(e.bindings):void 0,t.dbResult=e.dbResult!==void 0&&e.dbResult!==null?yr.fromPartial(e.dbResult):void 0,t}};function eT(){return{bindings:[]}}var Uo={encode(e,t=g.default.Writer.create()){for(let n of e.bindings)Vt.encode(n,t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=eT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.bindings.push(Vt.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{bindings:globalThis.Array.isArray(e?.bindings)?e.bindings.map(t=>Vt.fromJSON(t)):[]}},toJSON(e){let t={};return e.bindings?.length&&(t.bindings=e.bindings.map(n=>Vt.toJSON(n))),t},create(e){return Uo.fromPartial(e??{})},fromPartial(e){let t=eT();return t.bindings=e.bindings?.map(n=>Vt.fromPartial(n))||[],t}};function tT(){return{processId:0,dbRequest:void 0}}var eN={encode(e,t=g.default.Writer.create()){return e.processId!==0&&t.uint32(8).int32(e.processId),e.dbRequest!==void 0&&vr.encode(e.dbRequest,t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=tT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.processId=n.int32();continue;case 2:if(a!==18)break;i.dbRequest=vr.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{processId:S(e.processId)?globalThis.Number(e.processId):0,dbRequest:S(e.dbRequest)?vr.fromJSON(e.dbRequest):void 0}},toJSON(e){let t={};return e.processId!==0&&(t.processId=Math.round(e.processId)),e.dbRequest!==void 0&&(t.dbRequest=vr.toJSON(e.dbRequest)),t},create(e){return eN.fromPartial(e??{})},fromPartial(e){let t=tT();return t.processId=e.processId??0,t.dbRequest=e.dbRequest!==void 0&&e.dbRequest!==null?vr.fromPartial(e.dbRequest):void 0,t}};function nT(){return{opId:BigInt("0"),data:void 0,list:void 0,error:void 0,entities:void 0,entityList:void 0,nextCursor:void 0}}var yr={encode(e,t=g.default.Writer.create()){if(e.opId!==BigInt("0")){if(BigInt.asUintN(64,e.opId)!==e.opId)throw new globalThis.Error("value provided for field message.opId of type uint64 too large");t.uint32(8).uint64(e.opId.toString())}return e.data!==void 0&&M.encode(M.wrap(e.data),t.uint32(18).fork()).ldelim(),e.list!==void 0&&Jr.encode(Jr.wrap(e.list),t.uint32(34).fork()).ldelim(),e.error!==void 0&&t.uint32(26).string(e.error),e.entities!==void 0&&Gi.encode(e.entities,t.uint32(50).fork()).ldelim(),e.entityList!==void 0&&Jo.encode(e.entityList,t.uint32(58).fork()).ldelim(),e.nextCursor!==void 0&&t.uint32(42).string(e.nextCursor),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=nT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.opId=Gt(n.uint64());continue;case 2:if(a!==18)break;i.data=M.unwrap(M.decode(n,n.uint32()));continue;case 4:if(a!==34)break;i.list=Jr.unwrap(Jr.decode(n,n.uint32()));continue;case 3:if(a!==26)break;i.error=n.string();continue;case 6:if(a!==50)break;i.entities=Gi.decode(n,n.uint32());continue;case 7:if(a!==58)break;i.entityList=Jo.decode(n,n.uint32());continue;case 5:if(a!==42)break;i.nextCursor=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{opId:S(e.opId)?BigInt(e.opId):BigInt("0"),data:Ve(e.data)?e.data:void 0,list:globalThis.Array.isArray(e.list)?[...e.list]:void 0,error:S(e.error)?globalThis.String(e.error):void 0,entities:S(e.entities)?Gi.fromJSON(e.entities):void 0,entityList:S(e.entityList)?Jo.fromJSON(e.entityList):void 0,nextCursor:S(e.nextCursor)?globalThis.String(e.nextCursor):void 0}},toJSON(e){let t={};return e.opId!==BigInt("0")&&(t.opId=e.opId.toString()),e.data!==void 0&&(t.data=e.data),e.list!==void 0&&(t.list=e.list),e.error!==void 0&&(t.error=e.error),e.entities!==void 0&&(t.entities=Gi.toJSON(e.entities)),e.entityList!==void 0&&(t.entityList=Jo.toJSON(e.entityList)),e.nextCursor!==void 0&&(t.nextCursor=e.nextCursor),t},create(e){return yr.fromPartial(e??{})},fromPartial(e){let t=nT();return t.opId=e.opId??BigInt("0"),t.data=e.data??void 0,t.list=e.list??void 0,t.error=e.error??void 0,t.entities=e.entities!==void 0&&e.entities!==null?Gi.fromPartial(e.entities):void 0,t.entityList=e.entityList!==void 0&&e.entityList!==null?Jo.fromPartial(e.entityList):void 0,t.nextCursor=e.nextCursor??void 0,t}};function rT(){return{entity:"",genBlockNumber:BigInt("0"),genBlockChain:"",genBlockTime:void 0,data:void 0}}var qo={encode(e,t=g.default.Writer.create()){if(e.entity!==""&&t.uint32(10).string(e.entity),e.genBlockNumber!==BigInt("0")){if(BigInt.asUintN(64,e.genBlockNumber)!==e.genBlockNumber)throw new globalThis.Error("value provided for field message.genBlockNumber of type uint64 too large");t.uint32(16).uint64(e.genBlockNumber.toString())}return e.genBlockChain!==""&&t.uint32(26).string(e.genBlockChain),e.genBlockTime!==void 0&&Me.encode(Ln(e.genBlockTime),t.uint32(34).fork()).ldelim(),e.data!==void 0&&tt.encode(e.data,t.uint32(42).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=rT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.entity=n.string();continue;case 2:if(a!==16)break;i.genBlockNumber=Gt(n.uint64());continue;case 3:if(a!==26)break;i.genBlockChain=n.string();continue;case 4:if(a!==34)break;i.genBlockTime=wn(Me.decode(n,n.uint32()));continue;case 5:if(a!==42)break;i.data=tt.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{entity:S(e.entity)?globalThis.String(e.entity):"",genBlockNumber:S(e.genBlockNumber)?BigInt(e.genBlockNumber):BigInt("0"),genBlockChain:S(e.genBlockChain)?globalThis.String(e.genBlockChain):"",genBlockTime:S(e.genBlockTime)?Qn(e.genBlockTime):void 0,data:S(e.data)?tt.fromJSON(e.data):void 0}},toJSON(e){let t={};return e.entity!==""&&(t.entity=e.entity),e.genBlockNumber!==BigInt("0")&&(t.genBlockNumber=e.genBlockNumber.toString()),e.genBlockChain!==""&&(t.genBlockChain=e.genBlockChain),e.genBlockTime!==void 0&&(t.genBlockTime=e.genBlockTime.toISOString()),e.data!==void 0&&(t.data=tt.toJSON(e.data)),t},create(e){return qo.fromPartial(e??{})},fromPartial(e){let t=rT();return t.entity=e.entity??"",t.genBlockNumber=e.genBlockNumber??BigInt("0"),t.genBlockChain=e.genBlockChain??"",t.genBlockTime=e.genBlockTime??void 0,t.data=e.data!==void 0&&e.data!==null?tt.fromPartial(e.data):void 0,t}};function iT(){return{entities:[]}}var Jo={encode(e,t=g.default.Writer.create()){for(let n of e.entities)qo.encode(n,t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=iT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.entities.push(qo.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{entities:globalThis.Array.isArray(e?.entities)?e.entities.map(t=>qo.fromJSON(t)):[]}},toJSON(e){let t={};return e.entities?.length&&(t.entities=e.entities.map(n=>qo.toJSON(n))),t},create(e){return Jo.fromPartial(e??{})},fromPartial(e){let t=iT();return t.entities=e.entities?.map(n=>qo.fromPartial(n))||[],t}};function aT(){return{opId:BigInt("0"),get:void 0,upsert:void 0,delete:void 0,list:void 0}}var vr={encode(e,t=g.default.Writer.create()){if(e.opId!==BigInt("0")){if(BigInt.asUintN(64,e.opId)!==e.opId)throw new globalThis.Error("value provided for field message.opId of type uint64 too large");t.uint32(8).uint64(e.opId.toString())}return e.get!==void 0&&zo.encode(e.get,t.uint32(18).fork()).ldelim(),e.upsert!==void 0&&Go.encode(e.upsert,t.uint32(26).fork()).ldelim(),e.delete!==void 0&&Wo.encode(e.delete,t.uint32(34).fork()).ldelim(),e.list!==void 0&&Vo.encode(e.list,t.uint32(42).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=aT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.opId=Gt(n.uint64());continue;case 2:if(a!==18)break;i.get=zo.decode(n,n.uint32());continue;case 3:if(a!==26)break;i.upsert=Go.decode(n,n.uint32());continue;case 4:if(a!==34)break;i.delete=Wo.decode(n,n.uint32());continue;case 5:if(a!==42)break;i.list=Vo.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{opId:S(e.opId)?BigInt(e.opId):BigInt("0"),get:S(e.get)?zo.fromJSON(e.get):void 0,upsert:S(e.upsert)?Go.fromJSON(e.upsert):void 0,delete:S(e.delete)?Wo.fromJSON(e.delete):void 0,list:S(e.list)?Vo.fromJSON(e.list):void 0}},toJSON(e){let t={};return e.opId!==BigInt("0")&&(t.opId=e.opId.toString()),e.get!==void 0&&(t.get=zo.toJSON(e.get)),e.upsert!==void 0&&(t.upsert=Go.toJSON(e.upsert)),e.delete!==void 0&&(t.delete=Wo.toJSON(e.delete)),e.list!==void 0&&(t.list=Vo.toJSON(e.list)),t},create(e){return vr.fromPartial(e??{})},fromPartial(e){let t=aT();return t.opId=e.opId??BigInt("0"),t.get=e.get!==void 0&&e.get!==null?zo.fromPartial(e.get):void 0,t.upsert=e.upsert!==void 0&&e.upsert!==null?Go.fromPartial(e.upsert):void 0,t.delete=e.delete!==void 0&&e.delete!==null?Wo.fromPartial(e.delete):void 0,t.list=e.list!==void 0&&e.list!==null?Vo.fromPartial(e.list):void 0,t}};function sT(){return{entity:"",id:""}}var zo={encode(e,t=g.default.Writer.create()){return e.entity!==""&&t.uint32(10).string(e.entity),e.id!==""&&t.uint32(18).string(e.id),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=sT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.entity=n.string();continue;case 2:if(a!==18)break;i.id=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{entity:S(e.entity)?globalThis.String(e.entity):"",id:S(e.id)?globalThis.String(e.id):""}},toJSON(e){let t={};return e.entity!==""&&(t.entity=e.entity),e.id!==""&&(t.id=e.id),t},create(e){return zo.fromPartial(e??{})},fromPartial(e){let t=sT();return t.entity=e.entity??"",t.id=e.id??"",t}};function oT(){return{entity:"",filters:[],cursor:"",pageSize:void 0}}var Vo={encode(e,t=g.default.Writer.create()){e.entity!==""&&t.uint32(10).string(e.entity);for(let n of e.filters)Ho.encode(n,t.uint32(34).fork()).ldelim();return e.cursor!==""&&t.uint32(42).string(e.cursor),e.pageSize!==void 0&&t.uint32(48).uint32(e.pageSize),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=oT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.entity=n.string();continue;case 4:if(a!==34)break;i.filters.push(Ho.decode(n,n.uint32()));continue;case 5:if(a!==42)break;i.cursor=n.string();continue;case 6:if(a!==48)break;i.pageSize=n.uint32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{entity:S(e.entity)?globalThis.String(e.entity):"",filters:globalThis.Array.isArray(e?.filters)?e.filters.map(t=>Ho.fromJSON(t)):[],cursor:S(e.cursor)?globalThis.String(e.cursor):"",pageSize:S(e.pageSize)?globalThis.Number(e.pageSize):void 0}},toJSON(e){let t={};return e.entity!==""&&(t.entity=e.entity),e.filters?.length&&(t.filters=e.filters.map(n=>Ho.toJSON(n))),e.cursor!==""&&(t.cursor=e.cursor),e.pageSize!==void 0&&(t.pageSize=Math.round(e.pageSize)),t},create(e){return Vo.fromPartial(e??{})},fromPartial(e){let t=oT();return t.entity=e.entity??"",t.filters=e.filters?.map(n=>Ho.fromPartial(n))||[],t.cursor=e.cursor??"",t.pageSize=e.pageSize??void 0,t}};function cT(){return{entity:[],id:[],data:[],entityData:[]}}var Go={encode(e,t=g.default.Writer.create()){for(let n of e.entity)t.uint32(10).string(n);for(let n of e.id)t.uint32(18).string(n);for(let n of e.data)M.encode(M.wrap(n),t.uint32(26).fork()).ldelim();for(let n of e.entityData)tt.encode(n,t.uint32(34).fork()).ldelim();return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=cT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.entity.push(n.string());continue;case 2:if(a!==18)break;i.id.push(n.string());continue;case 3:if(a!==26)break;i.data.push(M.unwrap(M.decode(n,n.uint32())));continue;case 4:if(a!==34)break;i.entityData.push(tt.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{entity:globalThis.Array.isArray(e?.entity)?e.entity.map(t=>globalThis.String(t)):[],id:globalThis.Array.isArray(e?.id)?e.id.map(t=>globalThis.String(t)):[],data:globalThis.Array.isArray(e?.data)?[...e.data]:[],entityData:globalThis.Array.isArray(e?.entityData)?e.entityData.map(t=>tt.fromJSON(t)):[]}},toJSON(e){let t={};return e.entity?.length&&(t.entity=e.entity),e.id?.length&&(t.id=e.id),e.data?.length&&(t.data=e.data),e.entityData?.length&&(t.entityData=e.entityData.map(n=>tt.toJSON(n))),t},create(e){return Go.fromPartial(e??{})},fromPartial(e){let t=cT();return t.entity=e.entity?.map(n=>n)||[],t.id=e.id?.map(n=>n)||[],t.data=e.data?.map(n=>n)||[],t.entityData=e.entityData?.map(n=>tt.fromPartial(n))||[],t}};function uT(){return{entity:[],id:[]}}var Wo={encode(e,t=g.default.Writer.create()){for(let n of e.entity)t.uint32(10).string(n);for(let n of e.id)t.uint32(18).string(n);return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=uT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.entity.push(n.string());continue;case 2:if(a!==18)break;i.id.push(n.string());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{entity:globalThis.Array.isArray(e?.entity)?e.entity.map(t=>globalThis.String(t)):[],id:globalThis.Array.isArray(e?.id)?e.id.map(t=>globalThis.String(t)):[]}},toJSON(e){let t={};return e.entity?.length&&(t.entity=e.entity),e.id?.length&&(t.id=e.id),t},create(e){return Wo.fromPartial(e??{})},fromPartial(e){let t=uT();return t.entity=e.entity?.map(n=>n)||[],t.id=e.id?.map(n=>n)||[],t}};function lT(){return{field:"",op:0,value:void 0}}var Ho={encode(e,t=g.default.Writer.create()){return e.field!==""&&t.uint32(10).string(e.field),e.op!==0&&t.uint32(16).int32(e.op),e.value!==void 0&&Fn.encode(e.value,t.uint32(26).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=lT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.field=n.string();continue;case 2:if(a!==16)break;i.op=n.int32();continue;case 3:if(a!==26)break;i.value=Fn.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{field:S(e.field)?globalThis.String(e.field):"",op:S(e.op)?mq(e.op):0,value:S(e.value)?Fn.fromJSON(e.value):void 0}},toJSON(e){let t={};return e.field!==""&&(t.field=e.field),e.op!==0&&(t.op=gq(e.op)),e.value!==void 0&&(t.value=Fn.toJSON(e.value)),t},create(e){return Ho.fromPartial(e??{})},fromPartial(e){let t=lT();return t.field=e.field??"",t.op=e.op??0,t.value=e.value!==void 0&&e.value!==null?Fn.fromPartial(e.value):void 0,t}};function dT(){return{ethLog:void 0,ethBlock:void 0,ethTransaction:void 0,ethTrace:void 0,solInstruction:void 0,aptEvent:void 0,aptCall:void 0,aptResource:void 0,suiEvent:void 0,suiCall:void 0,suiObject:void 0,suiObjectChange:void 0,fuelCall:void 0,cosmosCall:void 0,starknetEvents:void 0,btcTransaction:void 0}}var Zo={encode(e,t=g.default.Writer.create()){return e.ethLog!==void 0&&Xo.encode(e.ethLog,t.uint32(18).fork()).ldelim(),e.ethBlock!==void 0&&Yo.encode(e.ethBlock,t.uint32(26).fork()).ldelim(),e.ethTransaction!==void 0&&$o.encode(e.ethTransaction,t.uint32(34).fork()).ldelim(),e.ethTrace!==void 0&&Ko.encode(e.ethTrace,t.uint32(42).fork()).ldelim(),e.solInstruction!==void 0&&jo.encode(e.solInstruction,t.uint32(50).fork()).ldelim(),e.aptEvent!==void 0&&ec.encode(e.aptEvent,t.uint32(58).fork()).ldelim(),e.aptCall!==void 0&&tc.encode(e.aptCall,t.uint32(66).fork()).ldelim(),e.aptResource!==void 0&&nc.encode(e.aptResource,t.uint32(74).fork()).ldelim(),e.suiEvent!==void 0&&rc.encode(e.suiEvent,t.uint32(82).fork()).ldelim(),e.suiCall!==void 0&&ic.encode(e.suiCall,t.uint32(90).fork()).ldelim(),e.suiObject!==void 0&&ac.encode(e.suiObject,t.uint32(98).fork()).ldelim(),e.suiObjectChange!==void 0&&sc.encode(e.suiObjectChange,t.uint32(106).fork()).ldelim(),e.fuelCall!==void 0&&oc.encode(e.fuelCall,t.uint32(114).fork()).ldelim(),e.cosmosCall!==void 0&&cc.encode(e.cosmosCall,t.uint32(122).fork()).ldelim(),e.starknetEvents!==void 0&&uc.encode(e.starknetEvents,t.uint32(130).fork()).ldelim(),e.btcTransaction!==void 0&&lc.encode(e.btcTransaction,t.uint32(138).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=dT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 2:if(a!==18)break;i.ethLog=Xo.decode(n,n.uint32());continue;case 3:if(a!==26)break;i.ethBlock=Yo.decode(n,n.uint32());continue;case 4:if(a!==34)break;i.ethTransaction=$o.decode(n,n.uint32());continue;case 5:if(a!==42)break;i.ethTrace=Ko.decode(n,n.uint32());continue;case 6:if(a!==50)break;i.solInstruction=jo.decode(n,n.uint32());continue;case 7:if(a!==58)break;i.aptEvent=ec.decode(n,n.uint32());continue;case 8:if(a!==66)break;i.aptCall=tc.decode(n,n.uint32());continue;case 9:if(a!==74)break;i.aptResource=nc.decode(n,n.uint32());continue;case 10:if(a!==82)break;i.suiEvent=rc.decode(n,n.uint32());continue;case 11:if(a!==90)break;i.suiCall=ic.decode(n,n.uint32());continue;case 12:if(a!==98)break;i.suiObject=ac.decode(n,n.uint32());continue;case 13:if(a!==106)break;i.suiObjectChange=sc.decode(n,n.uint32());continue;case 14:if(a!==114)break;i.fuelCall=oc.decode(n,n.uint32());continue;case 15:if(a!==122)break;i.cosmosCall=cc.decode(n,n.uint32());continue;case 16:if(a!==130)break;i.starknetEvents=uc.decode(n,n.uint32());continue;case 17:if(a!==138)break;i.btcTransaction=lc.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{ethLog:S(e.ethLog)?Xo.fromJSON(e.ethLog):void 0,ethBlock:S(e.ethBlock)?Yo.fromJSON(e.ethBlock):void 0,ethTransaction:S(e.ethTransaction)?$o.fromJSON(e.ethTransaction):void 0,ethTrace:S(e.ethTrace)?Ko.fromJSON(e.ethTrace):void 0,solInstruction:S(e.solInstruction)?jo.fromJSON(e.solInstruction):void 0,aptEvent:S(e.aptEvent)?ec.fromJSON(e.aptEvent):void 0,aptCall:S(e.aptCall)?tc.fromJSON(e.aptCall):void 0,aptResource:S(e.aptResource)?nc.fromJSON(e.aptResource):void 0,suiEvent:S(e.suiEvent)?rc.fromJSON(e.suiEvent):void 0,suiCall:S(e.suiCall)?ic.fromJSON(e.suiCall):void 0,suiObject:S(e.suiObject)?ac.fromJSON(e.suiObject):void 0,suiObjectChange:S(e.suiObjectChange)?sc.fromJSON(e.suiObjectChange):void 0,fuelCall:S(e.fuelCall)?oc.fromJSON(e.fuelCall):void 0,cosmosCall:S(e.cosmosCall)?cc.fromJSON(e.cosmosCall):void 0,starknetEvents:S(e.starknetEvents)?uc.fromJSON(e.starknetEvents):void 0,btcTransaction:S(e.btcTransaction)?lc.fromJSON(e.btcTransaction):void 0}},toJSON(e){let t={};return e.ethLog!==void 0&&(t.ethLog=Xo.toJSON(e.ethLog)),e.ethBlock!==void 0&&(t.ethBlock=Yo.toJSON(e.ethBlock)),e.ethTransaction!==void 0&&(t.ethTransaction=$o.toJSON(e.ethTransaction)),e.ethTrace!==void 0&&(t.ethTrace=Ko.toJSON(e.ethTrace)),e.solInstruction!==void 0&&(t.solInstruction=jo.toJSON(e.solInstruction)),e.aptEvent!==void 0&&(t.aptEvent=ec.toJSON(e.aptEvent)),e.aptCall!==void 0&&(t.aptCall=tc.toJSON(e.aptCall)),e.aptResource!==void 0&&(t.aptResource=nc.toJSON(e.aptResource)),e.suiEvent!==void 0&&(t.suiEvent=rc.toJSON(e.suiEvent)),e.suiCall!==void 0&&(t.suiCall=ic.toJSON(e.suiCall)),e.suiObject!==void 0&&(t.suiObject=ac.toJSON(e.suiObject)),e.suiObjectChange!==void 0&&(t.suiObjectChange=sc.toJSON(e.suiObjectChange)),e.fuelCall!==void 0&&(t.fuelCall=oc.toJSON(e.fuelCall)),e.cosmosCall!==void 0&&(t.cosmosCall=cc.toJSON(e.cosmosCall)),e.starknetEvents!==void 0&&(t.starknetEvents=uc.toJSON(e.starknetEvents)),e.btcTransaction!==void 0&&(t.btcTransaction=lc.toJSON(e.btcTransaction)),t},create(e){return Zo.fromPartial(e??{})},fromPartial(e){let t=dT();return t.ethLog=e.ethLog!==void 0&&e.ethLog!==null?Xo.fromPartial(e.ethLog):void 0,t.ethBlock=e.ethBlock!==void 0&&e.ethBlock!==null?Yo.fromPartial(e.ethBlock):void 0,t.ethTransaction=e.ethTransaction!==void 0&&e.ethTransaction!==null?$o.fromPartial(e.ethTransaction):void 0,t.ethTrace=e.ethTrace!==void 0&&e.ethTrace!==null?Ko.fromPartial(e.ethTrace):void 0,t.solInstruction=e.solInstruction!==void 0&&e.solInstruction!==null?jo.fromPartial(e.solInstruction):void 0,t.aptEvent=e.aptEvent!==void 0&&e.aptEvent!==null?ec.fromPartial(e.aptEvent):void 0,t.aptCall=e.aptCall!==void 0&&e.aptCall!==null?tc.fromPartial(e.aptCall):void 0,t.aptResource=e.aptResource!==void 0&&e.aptResource!==null?nc.fromPartial(e.aptResource):void 0,t.suiEvent=e.suiEvent!==void 0&&e.suiEvent!==null?rc.fromPartial(e.suiEvent):void 0,t.suiCall=e.suiCall!==void 0&&e.suiCall!==null?ic.fromPartial(e.suiCall):void 0,t.suiObject=e.suiObject!==void 0&&e.suiObject!==null?ac.fromPartial(e.suiObject):void 0,t.suiObjectChange=e.suiObjectChange!==void 0&&e.suiObjectChange!==null?sc.fromPartial(e.suiObjectChange):void 0,t.fuelCall=e.fuelCall!==void 0&&e.fuelCall!==null?oc.fromPartial(e.fuelCall):void 0,t.cosmosCall=e.cosmosCall!==void 0&&e.cosmosCall!==null?cc.fromPartial(e.cosmosCall):void 0,t.starknetEvents=e.starknetEvents!==void 0&&e.starknetEvents!==null?uc.fromPartial(e.starknetEvents):void 0,t.btcTransaction=e.btcTransaction!==void 0&&e.btcTransaction!==null?lc.fromPartial(e.btcTransaction):void 0,t}};function fT(){return{log:void 0,timestamp:void 0,transaction:void 0,transactionReceipt:void 0,block:void 0}}var Xo={encode(e,t=g.default.Writer.create()){return e.log!==void 0&&M.encode(M.wrap(e.log),t.uint32(26).fork()).ldelim(),e.timestamp!==void 0&&Me.encode(Ln(e.timestamp),t.uint32(34).fork()).ldelim(),e.transaction!==void 0&&M.encode(M.wrap(e.transaction),t.uint32(18).fork()).ldelim(),e.transactionReceipt!==void 0&&M.encode(M.wrap(e.transactionReceipt),t.uint32(42).fork()).ldelim(),e.block!==void 0&&M.encode(M.wrap(e.block),t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=fT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 3:if(a!==26)break;i.log=M.unwrap(M.decode(n,n.uint32()));continue;case 4:if(a!==34)break;i.timestamp=wn(Me.decode(n,n.uint32()));continue;case 2:if(a!==18)break;i.transaction=M.unwrap(M.decode(n,n.uint32()));continue;case 5:if(a!==42)break;i.transactionReceipt=M.unwrap(M.decode(n,n.uint32()));continue;case 6:if(a!==50)break;i.block=M.unwrap(M.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{log:Ve(e.log)?e.log:void 0,timestamp:S(e.timestamp)?Qn(e.timestamp):void 0,transaction:Ve(e.transaction)?e.transaction:void 0,transactionReceipt:Ve(e.transactionReceipt)?e.transactionReceipt:void 0,block:Ve(e.block)?e.block:void 0}},toJSON(e){let t={};return e.log!==void 0&&(t.log=e.log),e.timestamp!==void 0&&(t.timestamp=e.timestamp.toISOString()),e.transaction!==void 0&&(t.transaction=e.transaction),e.transactionReceipt!==void 0&&(t.transactionReceipt=e.transactionReceipt),e.block!==void 0&&(t.block=e.block),t},create(e){return Xo.fromPartial(e??{})},fromPartial(e){let t=fT();return t.log=e.log??void 0,t.timestamp=e.timestamp??void 0,t.transaction=e.transaction??void 0,t.transactionReceipt=e.transactionReceipt??void 0,t.block=e.block??void 0,t}};function pT(){return{block:void 0}}var Yo={encode(e,t=g.default.Writer.create()){return e.block!==void 0&&M.encode(M.wrap(e.block),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=pT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 2:if(a!==18)break;i.block=M.unwrap(M.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{block:Ve(e.block)?e.block:void 0}},toJSON(e){let t={};return e.block!==void 0&&(t.block=e.block),t},create(e){return Yo.fromPartial(e??{})},fromPartial(e){let t=pT();return t.block=e.block??void 0,t}};function hT(){return{transaction:void 0,timestamp:void 0,transactionReceipt:void 0,block:void 0,trace:void 0}}var $o={encode(e,t=g.default.Writer.create()){return e.transaction!==void 0&&M.encode(M.wrap(e.transaction),t.uint32(34).fork()).ldelim(),e.timestamp!==void 0&&Me.encode(Ln(e.timestamp),t.uint32(42).fork()).ldelim(),e.transactionReceipt!==void 0&&M.encode(M.wrap(e.transactionReceipt),t.uint32(26).fork()).ldelim(),e.block!==void 0&&M.encode(M.wrap(e.block),t.uint32(50).fork()).ldelim(),e.trace!==void 0&&M.encode(M.wrap(e.trace),t.uint32(58).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=hT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 4:if(a!==34)break;i.transaction=M.unwrap(M.decode(n,n.uint32()));continue;case 5:if(a!==42)break;i.timestamp=wn(Me.decode(n,n.uint32()));continue;case 3:if(a!==26)break;i.transactionReceipt=M.unwrap(M.decode(n,n.uint32()));continue;case 6:if(a!==50)break;i.block=M.unwrap(M.decode(n,n.uint32()));continue;case 7:if(a!==58)break;i.trace=M.unwrap(M.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{transaction:Ve(e.transaction)?e.transaction:void 0,timestamp:S(e.timestamp)?Qn(e.timestamp):void 0,transactionReceipt:Ve(e.transactionReceipt)?e.transactionReceipt:void 0,block:Ve(e.block)?e.block:void 0,trace:Ve(e.trace)?e.trace:void 0}},toJSON(e){let t={};return e.transaction!==void 0&&(t.transaction=e.transaction),e.timestamp!==void 0&&(t.timestamp=e.timestamp.toISOString()),e.transactionReceipt!==void 0&&(t.transactionReceipt=e.transactionReceipt),e.block!==void 0&&(t.block=e.block),e.trace!==void 0&&(t.trace=e.trace),t},create(e){return $o.fromPartial(e??{})},fromPartial(e){let t=hT();return t.transaction=e.transaction??void 0,t.timestamp=e.timestamp??void 0,t.transactionReceipt=e.transactionReceipt??void 0,t.block=e.block??void 0,t.trace=e.trace??void 0,t}};function mT(){return{trace:void 0,timestamp:void 0,transaction:void 0,transactionReceipt:void 0,block:void 0}}var Ko={encode(e,t=g.default.Writer.create()){return e.trace!==void 0&&M.encode(M.wrap(e.trace),t.uint32(34).fork()).ldelim(),e.timestamp!==void 0&&Me.encode(Ln(e.timestamp),t.uint32(42).fork()).ldelim(),e.transaction!==void 0&&M.encode(M.wrap(e.transaction),t.uint32(18).fork()).ldelim(),e.transactionReceipt!==void 0&&M.encode(M.wrap(e.transactionReceipt),t.uint32(26).fork()).ldelim(),e.block!==void 0&&M.encode(M.wrap(e.block),t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=mT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 4:if(a!==34)break;i.trace=M.unwrap(M.decode(n,n.uint32()));continue;case 5:if(a!==42)break;i.timestamp=wn(Me.decode(n,n.uint32()));continue;case 2:if(a!==18)break;i.transaction=M.unwrap(M.decode(n,n.uint32()));continue;case 3:if(a!==26)break;i.transactionReceipt=M.unwrap(M.decode(n,n.uint32()));continue;case 6:if(a!==50)break;i.block=M.unwrap(M.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{trace:Ve(e.trace)?e.trace:void 0,timestamp:S(e.timestamp)?Qn(e.timestamp):void 0,transaction:Ve(e.transaction)?e.transaction:void 0,transactionReceipt:Ve(e.transactionReceipt)?e.transactionReceipt:void 0,block:Ve(e.block)?e.block:void 0}},toJSON(e){let t={};return e.trace!==void 0&&(t.trace=e.trace),e.timestamp!==void 0&&(t.timestamp=e.timestamp.toISOString()),e.transaction!==void 0&&(t.transaction=e.transaction),e.transactionReceipt!==void 0&&(t.transactionReceipt=e.transactionReceipt),e.block!==void 0&&(t.block=e.block),t},create(e){return Ko.fromPartial(e??{})},fromPartial(e){let t=mT();return t.trace=e.trace??void 0,t.timestamp=e.timestamp??void 0,t.transaction=e.transaction??void 0,t.transactionReceipt=e.transactionReceipt??void 0,t.block=e.block??void 0,t}};function gT(){return{instructionData:"",slot:BigInt("0"),programAccountId:"",accounts:[],parsed:void 0}}var jo={encode(e,t=g.default.Writer.create()){if(e.instructionData!==""&&t.uint32(10).string(e.instructionData),e.slot!==BigInt("0")){if(BigInt.asUintN(64,e.slot)!==e.slot)throw new globalThis.Error("value provided for field message.slot of type uint64 too large");t.uint32(16).uint64(e.slot.toString())}e.programAccountId!==""&&t.uint32(26).string(e.programAccountId);for(let n of e.accounts)t.uint32(42).string(n);return e.parsed!==void 0&&M.encode(M.wrap(e.parsed),t.uint32(34).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=gT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.instructionData=n.string();continue;case 2:if(a!==16)break;i.slot=Gt(n.uint64());continue;case 3:if(a!==26)break;i.programAccountId=n.string();continue;case 5:if(a!==42)break;i.accounts.push(n.string());continue;case 4:if(a!==34)break;i.parsed=M.unwrap(M.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{instructionData:S(e.instructionData)?globalThis.String(e.instructionData):"",slot:S(e.slot)?BigInt(e.slot):BigInt("0"),programAccountId:S(e.programAccountId)?globalThis.String(e.programAccountId):"",accounts:globalThis.Array.isArray(e?.accounts)?e.accounts.map(t=>globalThis.String(t)):[],parsed:Ve(e.parsed)?e.parsed:void 0}},toJSON(e){let t={};return e.instructionData!==""&&(t.instructionData=e.instructionData),e.slot!==BigInt("0")&&(t.slot=e.slot.toString()),e.programAccountId!==""&&(t.programAccountId=e.programAccountId),e.accounts?.length&&(t.accounts=e.accounts),e.parsed!==void 0&&(t.parsed=e.parsed),t},create(e){return jo.fromPartial(e??{})},fromPartial(e){let t=gT();return t.instructionData=e.instructionData??"",t.slot=e.slot??BigInt("0"),t.programAccountId=e.programAccountId??"",t.accounts=e.accounts?.map(n=>n)||[],t.parsed=e.parsed??void 0,t}};function _T(){return{transaction:void 0}}var ec={encode(e,t=g.default.Writer.create()){return e.transaction!==void 0&&M.encode(M.wrap(e.transaction),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=_T();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 2:if(a!==18)break;i.transaction=M.unwrap(M.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{transaction:Ve(e.transaction)?e.transaction:void 0}},toJSON(e){let t={};return e.transaction!==void 0&&(t.transaction=e.transaction),t},create(e){return ec.fromPartial(e??{})},fromPartial(e){let t=_T();return t.transaction=e.transaction??void 0,t}};function AT(){return{transaction:void 0}}var tc={encode(e,t=g.default.Writer.create()){return e.transaction!==void 0&&M.encode(M.wrap(e.transaction),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=AT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 2:if(a!==18)break;i.transaction=M.unwrap(M.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{transaction:Ve(e.transaction)?e.transaction:void 0}},toJSON(e){let t={};return e.transaction!==void 0&&(t.transaction=e.transaction),t},create(e){return tc.fromPartial(e??{})},fromPartial(e){let t=AT();return t.transaction=e.transaction??void 0,t}};function yT(){return{resources:[],version:BigInt("0"),timestampMicros:BigInt("0")}}var nc={encode(e,t=g.default.Writer.create()){for(let n of e.resources)M.encode(M.wrap(n),t.uint32(34).fork()).ldelim();if(e.version!==BigInt("0")){if(BigInt.asIntN(64,e.version)!==e.version)throw new globalThis.Error("value provided for field message.version of type int64 too large");t.uint32(16).int64(e.version.toString())}if(e.timestampMicros!==BigInt("0")){if(BigInt.asIntN(64,e.timestampMicros)!==e.timestampMicros)throw new globalThis.Error("value provided for field message.timestampMicros of type int64 too large");t.uint32(40).int64(e.timestampMicros.toString())}return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=yT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 4:if(a!==34)break;i.resources.push(M.unwrap(M.decode(n,n.uint32())));continue;case 2:if(a!==16)break;i.version=Gt(n.int64());continue;case 5:if(a!==40)break;i.timestampMicros=Gt(n.int64());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{resources:globalThis.Array.isArray(e?.resources)?[...e.resources]:[],version:S(e.version)?BigInt(e.version):BigInt("0"),timestampMicros:S(e.timestampMicros)?BigInt(e.timestampMicros):BigInt("0")}},toJSON(e){let t={};return e.resources?.length&&(t.resources=e.resources),e.version!==BigInt("0")&&(t.version=e.version.toString()),e.timestampMicros!==BigInt("0")&&(t.timestampMicros=e.timestampMicros.toString()),t},create(e){return nc.fromPartial(e??{})},fromPartial(e){let t=yT();return t.resources=e.resources?.map(n=>n)||[],t.version=e.version??BigInt("0"),t.timestampMicros=e.timestampMicros??BigInt("0"),t}};function vT(){return{transaction:void 0,timestamp:void 0,slot:BigInt("0")}}var rc={encode(e,t=g.default.Writer.create()){if(e.transaction!==void 0&&M.encode(M.wrap(e.transaction),t.uint32(10).fork()).ldelim(),e.timestamp!==void 0&&Me.encode(Ln(e.timestamp),t.uint32(18).fork()).ldelim(),e.slot!==BigInt("0")){if(BigInt.asUintN(64,e.slot)!==e.slot)throw new globalThis.Error("value provided for field message.slot of type uint64 too large");t.uint32(24).uint64(e.slot.toString())}return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=vT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.transaction=M.unwrap(M.decode(n,n.uint32()));continue;case 2:if(a!==18)break;i.timestamp=wn(Me.decode(n,n.uint32()));continue;case 3:if(a!==24)break;i.slot=Gt(n.uint64());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{transaction:Ve(e.transaction)?e.transaction:void 0,timestamp:S(e.timestamp)?Qn(e.timestamp):void 0,slot:S(e.slot)?BigInt(e.slot):BigInt("0")}},toJSON(e){let t={};return e.transaction!==void 0&&(t.transaction=e.transaction),e.timestamp!==void 0&&(t.timestamp=e.timestamp.toISOString()),e.slot!==BigInt("0")&&(t.slot=e.slot.toString()),t},create(e){return rc.fromPartial(e??{})},fromPartial(e){let t=vT();return t.transaction=e.transaction??void 0,t.timestamp=e.timestamp??void 0,t.slot=e.slot??BigInt("0"),t}};function wT(){return{transaction:void 0,timestamp:void 0,slot:BigInt("0")}}var ic={encode(e,t=g.default.Writer.create()){if(e.transaction!==void 0&&M.encode(M.wrap(e.transaction),t.uint32(10).fork()).ldelim(),e.timestamp!==void 0&&Me.encode(Ln(e.timestamp),t.uint32(18).fork()).ldelim(),e.slot!==BigInt("0")){if(BigInt.asUintN(64,e.slot)!==e.slot)throw new globalThis.Error("value provided for field message.slot of type uint64 too large");t.uint32(24).uint64(e.slot.toString())}return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=wT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.transaction=M.unwrap(M.decode(n,n.uint32()));continue;case 2:if(a!==18)break;i.timestamp=wn(Me.decode(n,n.uint32()));continue;case 3:if(a!==24)break;i.slot=Gt(n.uint64());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{transaction:Ve(e.transaction)?e.transaction:void 0,timestamp:S(e.timestamp)?Qn(e.timestamp):void 0,slot:S(e.slot)?BigInt(e.slot):BigInt("0")}},toJSON(e){let t={};return e.transaction!==void 0&&(t.transaction=e.transaction),e.timestamp!==void 0&&(t.timestamp=e.timestamp.toISOString()),e.slot!==BigInt("0")&&(t.slot=e.slot.toString()),t},create(e){return ic.fromPartial(e??{})},fromPartial(e){let t=wT();return t.transaction=e.transaction??void 0,t.timestamp=e.timestamp??void 0,t.slot=e.slot??BigInt("0"),t}};function bT(){return{objects:[],self:void 0,timestamp:void 0,slot:BigInt("0")}}var ac={encode(e,t=g.default.Writer.create()){for(let n of e.objects)M.encode(M.wrap(n),t.uint32(10).fork()).ldelim();if(e.self!==void 0&&M.encode(M.wrap(e.self),t.uint32(34).fork()).ldelim(),e.timestamp!==void 0&&Me.encode(Ln(e.timestamp),t.uint32(18).fork()).ldelim(),e.slot!==BigInt("0")){if(BigInt.asUintN(64,e.slot)!==e.slot)throw new globalThis.Error("value provided for field message.slot of type uint64 too large");t.uint32(24).uint64(e.slot.toString())}return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=bT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.objects.push(M.unwrap(M.decode(n,n.uint32())));continue;case 4:if(a!==34)break;i.self=M.unwrap(M.decode(n,n.uint32()));continue;case 2:if(a!==18)break;i.timestamp=wn(Me.decode(n,n.uint32()));continue;case 3:if(a!==24)break;i.slot=Gt(n.uint64());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{objects:globalThis.Array.isArray(e?.objects)?[...e.objects]:[],self:Ve(e.self)?e.self:void 0,timestamp:S(e.timestamp)?Qn(e.timestamp):void 0,slot:S(e.slot)?BigInt(e.slot):BigInt("0")}},toJSON(e){let t={};return e.objects?.length&&(t.objects=e.objects),e.self!==void 0&&(t.self=e.self),e.timestamp!==void 0&&(t.timestamp=e.timestamp.toISOString()),e.slot!==BigInt("0")&&(t.slot=e.slot.toString()),t},create(e){return ac.fromPartial(e??{})},fromPartial(e){let t=bT();return t.objects=e.objects?.map(n=>n)||[],t.self=e.self??void 0,t.timestamp=e.timestamp??void 0,t.slot=e.slot??BigInt("0"),t}};function ET(){return{changes:[],timestamp:void 0,txDigest:"",slot:BigInt("0")}}var sc={encode(e,t=g.default.Writer.create()){for(let n of e.changes)M.encode(M.wrap(n),t.uint32(10).fork()).ldelim();if(e.timestamp!==void 0&&Me.encode(Ln(e.timestamp),t.uint32(18).fork()).ldelim(),e.txDigest!==""&&t.uint32(34).string(e.txDigest),e.slot!==BigInt("0")){if(BigInt.asUintN(64,e.slot)!==e.slot)throw new globalThis.Error("value provided for field message.slot of type uint64 too large");t.uint32(24).uint64(e.slot.toString())}return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=ET();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.changes.push(M.unwrap(M.decode(n,n.uint32())));continue;case 2:if(a!==18)break;i.timestamp=wn(Me.decode(n,n.uint32()));continue;case 4:if(a!==34)break;i.txDigest=n.string();continue;case 3:if(a!==24)break;i.slot=Gt(n.uint64());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{changes:globalThis.Array.isArray(e?.changes)?[...e.changes]:[],timestamp:S(e.timestamp)?Qn(e.timestamp):void 0,txDigest:S(e.txDigest)?globalThis.String(e.txDigest):"",slot:S(e.slot)?BigInt(e.slot):BigInt("0")}},toJSON(e){let t={};return e.changes?.length&&(t.changes=e.changes),e.timestamp!==void 0&&(t.timestamp=e.timestamp.toISOString()),e.txDigest!==""&&(t.txDigest=e.txDigest),e.slot!==BigInt("0")&&(t.slot=e.slot.toString()),t},create(e){return sc.fromPartial(e??{})},fromPartial(e){let t=ET();return t.changes=e.changes?.map(n=>n)||[],t.timestamp=e.timestamp??void 0,t.txDigest=e.txDigest??"",t.slot=e.slot??BigInt("0"),t}};function CT(){return{transaction:void 0,timestamp:void 0}}var oc={encode(e,t=g.default.Writer.create()){return e.transaction!==void 0&&M.encode(M.wrap(e.transaction),t.uint32(10).fork()).ldelim(),e.timestamp!==void 0&&Me.encode(Ln(e.timestamp),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=CT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.transaction=M.unwrap(M.decode(n,n.uint32()));continue;case 2:if(a!==18)break;i.timestamp=wn(Me.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{transaction:Ve(e.transaction)?e.transaction:void 0,timestamp:S(e.timestamp)?Qn(e.timestamp):void 0}},toJSON(e){let t={};return e.transaction!==void 0&&(t.transaction=e.transaction),e.timestamp!==void 0&&(t.timestamp=e.timestamp.toISOString()),t},create(e){return oc.fromPartial(e??{})},fromPartial(e){let t=CT();return t.transaction=e.transaction??void 0,t.timestamp=e.timestamp??void 0,t}};function IT(){return{transaction:void 0,timestamp:void 0}}var cc={encode(e,t=g.default.Writer.create()){return e.transaction!==void 0&&M.encode(M.wrap(e.transaction),t.uint32(10).fork()).ldelim(),e.timestamp!==void 0&&Me.encode(Ln(e.timestamp),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=IT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.transaction=M.unwrap(M.decode(n,n.uint32()));continue;case 2:if(a!==18)break;i.timestamp=wn(Me.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{transaction:Ve(e.transaction)?e.transaction:void 0,timestamp:S(e.timestamp)?Qn(e.timestamp):void 0}},toJSON(e){let t={};return e.transaction!==void 0&&(t.transaction=e.transaction),e.timestamp!==void 0&&(t.timestamp=e.timestamp.toISOString()),t},create(e){return cc.fromPartial(e??{})},fromPartial(e){let t=IT();return t.transaction=e.transaction??void 0,t.timestamp=e.timestamp??void 0,t}};function ST(){return{result:void 0,timestamp:void 0}}var uc={encode(e,t=g.default.Writer.create()){return e.result!==void 0&&M.encode(M.wrap(e.result),t.uint32(10).fork()).ldelim(),e.timestamp!==void 0&&Me.encode(Ln(e.timestamp),t.uint32(18).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=ST();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.result=M.unwrap(M.decode(n,n.uint32()));continue;case 2:if(a!==18)break;i.timestamp=wn(Me.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{result:Ve(e.result)?e.result:void 0,timestamp:S(e.timestamp)?Qn(e.timestamp):void 0}},toJSON(e){let t={};return e.result!==void 0&&(t.result=e.result),e.timestamp!==void 0&&(t.timestamp=e.timestamp.toISOString()),t},create(e){return uc.fromPartial(e??{})},fromPartial(e){let t=ST();return t.result=e.result??void 0,t.timestamp=e.timestamp??void 0,t}};function xT(){return{transaction:void 0,timestamp:void 0}}var lc={encode(e,t=g.default.Writer.create()){return e.transaction!==void 0&&M.encode(M.wrap(e.transaction),t.uint32(34).fork()).ldelim(),e.timestamp!==void 0&&Me.encode(Ln(e.timestamp),t.uint32(42).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=xT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 4:if(a!==34)break;i.transaction=M.unwrap(M.decode(n,n.uint32()));continue;case 5:if(a!==42)break;i.timestamp=wn(Me.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{transaction:Ve(e.transaction)?e.transaction:void 0,timestamp:S(e.timestamp)?Qn(e.timestamp):void 0}},toJSON(e){let t={};return e.transaction!==void 0&&(t.transaction=e.transaction),e.timestamp!==void 0&&(t.timestamp=e.timestamp.toISOString()),t},create(e){return lc.fromPartial(e??{})},fromPartial(e){let t=xT();return t.transaction=e.transaction??void 0,t.timestamp=e.timestamp??void 0,t}};function TT(){return{data:void 0,handlerType:0,handlerIds:[]}}var Vt={encode(e,t=g.default.Writer.create()){e.data!==void 0&&Zo.encode(e.data,t.uint32(10).fork()).ldelim(),e.handlerType!==0&&t.uint32(24).int32(e.handlerType),t.uint32(34).fork();for(let n of e.handlerIds)t.int32(n);return t.ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=TT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.data=Zo.decode(n,n.uint32());continue;case 3:if(a!==24)break;i.handlerType=n.int32();continue;case 4:if(a===32){i.handlerIds.push(n.int32());continue}if(a===34){let s=n.uint32()+n.pos;for(;n.pos<s;)i.handlerIds.push(n.int32());continue}break}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{data:S(e.data)?Zo.fromJSON(e.data):void 0,handlerType:S(e.handlerType)?VT(e.handlerType):0,handlerIds:globalThis.Array.isArray(e?.handlerIds)?e.handlerIds.map(t=>globalThis.Number(t)):[]}},toJSON(e){let t={};return e.data!==void 0&&(t.data=Zo.toJSON(e.data)),e.handlerType!==0&&(t.handlerType=GT(e.handlerType)),e.handlerIds?.length&&(t.handlerIds=e.handlerIds.map(n=>Math.round(n))),t},create(e){return Vt.fromPartial(e??{})},fromPartial(e){let t=TT();return t.data=e.data!==void 0&&e.data!==null?Zo.fromPartial(e.data):void 0,t.handlerType=e.handlerType??0,t.handlerIds=e.handlerIds?.map(n=>n)||[],t}};function NT(){return{configUpdated:!1,error:void 0}}var dc={encode(e,t=g.default.Writer.create()){return e.configUpdated!==!1&&t.uint32(8).bool(e.configUpdated),e.error!==void 0&&t.uint32(18).string(e.error),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=NT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.configUpdated=n.bool();continue;case 2:if(a!==18)break;i.error=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{configUpdated:S(e.configUpdated)?globalThis.Boolean(e.configUpdated):!1,error:S(e.error)?globalThis.String(e.error):void 0}},toJSON(e){let t={};return e.configUpdated!==!1&&(t.configUpdated=e.configUpdated),e.error!==void 0&&(t.error=e.error),t},create(e){return dc.fromPartial(e??{})},fromPartial(e){let t=NT();return t.configUpdated=e.configUpdated??!1,t.error=e.error??void 0,t}};function RT(){return{gauges:[],counters:[],events:[],exports:[],states:void 0}}var vn={encode(e,t=g.default.Writer.create()){for(let n of e.gauges)hc.encode(n,t.uint32(10).fork()).ldelim();for(let n of e.counters)mc.encode(n,t.uint32(18).fork()).ldelim();for(let n of e.events)gc.encode(n,t.uint32(34).fork()).ldelim();for(let n of e.exports)_c.encode(n,t.uint32(42).fork()).ldelim();return e.states!==void 0&&dc.encode(e.states,t.uint32(50).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=RT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.gauges.push(hc.decode(n,n.uint32()));continue;case 2:if(a!==18)break;i.counters.push(mc.decode(n,n.uint32()));continue;case 4:if(a!==34)break;i.events.push(gc.decode(n,n.uint32()));continue;case 5:if(a!==42)break;i.exports.push(_c.decode(n,n.uint32()));continue;case 6:if(a!==50)break;i.states=dc.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{gauges:globalThis.Array.isArray(e?.gauges)?e.gauges.map(t=>hc.fromJSON(t)):[],counters:globalThis.Array.isArray(e?.counters)?e.counters.map(t=>mc.fromJSON(t)):[],events:globalThis.Array.isArray(e?.events)?e.events.map(t=>gc.fromJSON(t)):[],exports:globalThis.Array.isArray(e?.exports)?e.exports.map(t=>_c.fromJSON(t)):[],states:S(e.states)?dc.fromJSON(e.states):void 0}},toJSON(e){let t={};return e.gauges?.length&&(t.gauges=e.gauges.map(n=>hc.toJSON(n))),e.counters?.length&&(t.counters=e.counters.map(n=>mc.toJSON(n))),e.events?.length&&(t.events=e.events.map(n=>gc.toJSON(n))),e.exports?.length&&(t.exports=e.exports.map(n=>_c.toJSON(n))),e.states!==void 0&&(t.states=dc.toJSON(e.states)),t},create(e){return vn.fromPartial(e??{})},fromPartial(e){let t=RT();return t.gauges=e.gauges?.map(n=>hc.fromPartial(n))||[],t.counters=e.counters?.map(n=>mc.fromPartial(n))||[],t.events=e.events?.map(n=>gc.fromPartial(n))||[],t.exports=e.exports?.map(n=>_c.fromPartial(n))||[],t.states=e.states!==void 0&&e.states!==null?dc.fromPartial(e.states):void 0,t}};function BT(){return{context:void 0,calldata:""}}var fc={encode(e,t=g.default.Writer.create()){return e.context!==void 0&&pc.encode(e.context,t.uint32(10).fork()).ldelim(),e.calldata!==""&&t.uint32(18).string(e.calldata),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=BT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.context=pc.decode(n,n.uint32());continue;case 2:if(a!==18)break;i.calldata=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{context:S(e.context)?pc.fromJSON(e.context):void 0,calldata:S(e.calldata)?globalThis.String(e.calldata):""}},toJSON(e){let t={};return e.context!==void 0&&(t.context=pc.toJSON(e.context)),e.calldata!==""&&(t.calldata=e.calldata),t},create(e){return fc.fromPartial(e??{})},fromPartial(e){let t=BT();return t.context=e.context!==void 0&&e.context!==null?pc.fromPartial(e.context):void 0,t.calldata=e.calldata??"",t}};function kT(){return{chainId:"",address:"",blockTag:""}}var pc={encode(e,t=g.default.Writer.create()){return e.chainId!==""&&t.uint32(10).string(e.chainId),e.address!==""&&t.uint32(18).string(e.address),e.blockTag!==""&&t.uint32(26).string(e.blockTag),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=kT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.chainId=n.string();continue;case 2:if(a!==18)break;i.address=n.string();continue;case 3:if(a!==26)break;i.blockTag=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{chainId:S(e.chainId)?globalThis.String(e.chainId):"",address:S(e.address)?globalThis.String(e.address):"",blockTag:S(e.blockTag)?globalThis.String(e.blockTag):""}},toJSON(e){let t={};return e.chainId!==""&&(t.chainId=e.chainId),e.address!==""&&(t.address=e.address),e.blockTag!==""&&(t.blockTag=e.blockTag),t},create(e){return pc.fromPartial(e??{})},fromPartial(e){let t=kT();return t.chainId=e.chainId??"",t.address=e.address??"",t.blockTag=e.blockTag??"",t}};function OT(){return{ethCallParams:[]}}var yq={encode(e,t=g.default.Writer.create()){for(let n of e.ethCallParams)fc.encode(n,t.uint32(10).fork()).ldelim();return t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=OT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.ethCallParams.push(fc.decode(n,n.uint32()));continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{ethCallParams:globalThis.Array.isArray(e?.ethCallParams)?e.ethCallParams.map(t=>fc.fromJSON(t)):[]}},toJSON(e){let t={};return e.ethCallParams?.length&&(t.ethCallParams=e.ethCallParams.map(n=>fc.toJSON(n))),t},create(e){return yq.fromPartial(e??{})},fromPartial(e){let t=OT();return t.ethCallParams=e.ethCallParams?.map(n=>fc.fromPartial(n))||[],t}};function PT(){return{ethCallResults:{}}}var vq={encode(e,t=g.default.Writer.create()){return Object.entries(e.ethCallResults).forEach(([n,r])=>{pA.encode({key:n,value:r},t.uint32(10).fork()).ldelim()}),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=PT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;let s=pA.decode(n,n.uint32());s.value!==void 0&&(i.ethCallResults[s.key]=s.value);continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{ethCallResults:Ve(e.ethCallResults)?Object.entries(e.ethCallResults).reduce((t,[n,r])=>(t[n]=String(r),t),{}):{}}},toJSON(e){let t={};if(e.ethCallResults){let n=Object.entries(e.ethCallResults);n.length>0&&(t.ethCallResults={},n.forEach(([r,i])=>{t.ethCallResults[r]=i}))}return t},create(e){return vq.fromPartial(e??{})},fromPartial(e){let t=PT();return t.ethCallResults=Object.entries(e.ethCallResults??{}).reduce((n,[r,i])=>(i!==void 0&&(n[r]=globalThis.String(i)),n),{}),t}};function DT(){return{key:"",value:""}}var pA={encode(e,t=g.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==""&&t.uint32(18).string(e.value),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=DT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.key=n.string();continue;case 2:if(a!==18)break;i.value=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{key:S(e.key)?globalThis.String(e.key):"",value:S(e.value)?globalThis.String(e.value):""}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==""&&(t.value=e.value),t},create(e){return pA.fromPartial(e??{})},fromPartial(e){let t=DT();return t.key=e.key??"",t.value=e.value??"",t}};function MT(){return{address:"",contractName:"",blockNumber:BigInt("0"),transactionHash:"",chainId:"",transactionIndex:0,logIndex:0,name:"",labels:{}}}var lt={encode(e,t=g.default.Writer.create()){if(e.address!==""&&t.uint32(10).string(e.address),e.contractName!==""&&t.uint32(74).string(e.contractName),e.blockNumber!==BigInt("0")){if(BigInt.asUintN(64,e.blockNumber)!==e.blockNumber)throw new globalThis.Error("value provided for field message.blockNumber of type uint64 too large");t.uint32(16).uint64(e.blockNumber.toString())}return e.transactionHash!==""&&t.uint32(50).string(e.transactionHash),e.chainId!==""&&t.uint32(42).string(e.chainId),e.transactionIndex!==0&&t.uint32(24).int32(e.transactionIndex),e.logIndex!==0&&t.uint32(32).int32(e.logIndex),e.name!==""&&t.uint32(82).string(e.name),Object.entries(e.labels).forEach(([n,r])=>{hA.encode({key:n,value:r},t.uint32(58).fork()).ldelim()}),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=MT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.address=n.string();continue;case 9:if(a!==74)break;i.contractName=n.string();continue;case 2:if(a!==16)break;i.blockNumber=Gt(n.uint64());continue;case 6:if(a!==50)break;i.transactionHash=n.string();continue;case 5:if(a!==42)break;i.chainId=n.string();continue;case 3:if(a!==24)break;i.transactionIndex=n.int32();continue;case 4:if(a!==32)break;i.logIndex=n.int32();continue;case 10:if(a!==82)break;i.name=n.string();continue;case 7:if(a!==58)break;let s=hA.decode(n,n.uint32());s.value!==void 0&&(i.labels[s.key]=s.value);continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{address:S(e.address)?globalThis.String(e.address):"",contractName:S(e.contractName)?globalThis.String(e.contractName):"",blockNumber:S(e.blockNumber)?BigInt(e.blockNumber):BigInt("0"),transactionHash:S(e.transactionHash)?globalThis.String(e.transactionHash):"",chainId:S(e.chainId)?globalThis.String(e.chainId):"",transactionIndex:S(e.transactionIndex)?globalThis.Number(e.transactionIndex):0,logIndex:S(e.logIndex)?globalThis.Number(e.logIndex):0,name:S(e.name)?globalThis.String(e.name):"",labels:Ve(e.labels)?Object.entries(e.labels).reduce((t,[n,r])=>(t[n]=String(r),t),{}):{}}},toJSON(e){let t={};if(e.address!==""&&(t.address=e.address),e.contractName!==""&&(t.contractName=e.contractName),e.blockNumber!==BigInt("0")&&(t.blockNumber=e.blockNumber.toString()),e.transactionHash!==""&&(t.transactionHash=e.transactionHash),e.chainId!==""&&(t.chainId=e.chainId),e.transactionIndex!==0&&(t.transactionIndex=Math.round(e.transactionIndex)),e.logIndex!==0&&(t.logIndex=Math.round(e.logIndex)),e.name!==""&&(t.name=e.name),e.labels){let n=Object.entries(e.labels);n.length>0&&(t.labels={},n.forEach(([r,i])=>{t.labels[r]=i}))}return t},create(e){return lt.fromPartial(e??{})},fromPartial(e){let t=MT();return t.address=e.address??"",t.contractName=e.contractName??"",t.blockNumber=e.blockNumber??BigInt("0"),t.transactionHash=e.transactionHash??"",t.chainId=e.chainId??"",t.transactionIndex=e.transactionIndex??0,t.logIndex=e.logIndex??0,t.name=e.name??"",t.labels=Object.entries(e.labels??{}).reduce((n,[r,i])=>(i!==void 0&&(n[r]=globalThis.String(i)),n),{}),t}};function FT(){return{key:"",value:""}}var hA={encode(e,t=g.default.Writer.create()){return e.key!==""&&t.uint32(10).string(e.key),e.value!==""&&t.uint32(18).string(e.value),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=FT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.key=n.string();continue;case 2:if(a!==18)break;i.value=n.string();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{key:S(e.key)?globalThis.String(e.key):"",value:S(e.value)?globalThis.String(e.value):""}},toJSON(e){let t={};return e.key!==""&&(t.key=e.key),e.value!==""&&(t.value=e.value),t},create(e){return hA.fromPartial(e??{})},fromPartial(e){let t=FT();return t.key=e.key??"",t.value=e.value??"",t}};function LT(){return{bigDecimal:void 0,doubleValue:void 0,bigInteger:void 0}}var Nt={encode(e,t=g.default.Writer.create()){return e.bigDecimal!==void 0&&t.uint32(10).string(e.bigDecimal),e.doubleValue!==void 0&&t.uint32(17).double(e.doubleValue),e.bigInteger!==void 0&&It.encode(e.bigInteger,t.uint32(26).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=LT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.bigDecimal=n.string();continue;case 2:if(a!==17)break;i.doubleValue=n.double();continue;case 3:if(a!==26)break;i.bigInteger=It.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{bigDecimal:S(e.bigDecimal)?globalThis.String(e.bigDecimal):void 0,doubleValue:S(e.doubleValue)?globalThis.Number(e.doubleValue):void 0,bigInteger:S(e.bigInteger)?It.fromJSON(e.bigInteger):void 0}},toJSON(e){let t={};return e.bigDecimal!==void 0&&(t.bigDecimal=e.bigDecimal),e.doubleValue!==void 0&&(t.doubleValue=e.doubleValue),e.bigInteger!==void 0&&(t.bigInteger=It.toJSON(e.bigInteger)),t},create(e){return Nt.fromPartial(e??{})},fromPartial(e){let t=LT();return t.bigDecimal=e.bigDecimal??void 0,t.doubleValue=e.doubleValue??void 0,t.bigInteger=e.bigInteger!==void 0&&e.bigInteger!==null?It.fromPartial(e.bigInteger):void 0,t}};function QT(){return{from:0}}var dt={encode(e,t=g.default.Writer.create()){return e.from!==0&&t.uint32(8).int32(e.from),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=QT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==8)break;i.from=n.int32();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{from:S(e.from)?VT(e.from):0}},toJSON(e){let t={};return e.from!==0&&(t.from=GT(e.from)),t},create(e){return dt.fromPartial(e??{})},fromPartial(e){let t=QT();return t.from=e.from??0,t}};function UT(){return{metadata:void 0,metricValue:void 0,runtimeInfo:void 0}}var hc={encode(e,t=g.default.Writer.create()){return e.metadata!==void 0&<.encode(e.metadata,t.uint32(10).fork()).ldelim(),e.metricValue!==void 0&&Nt.encode(e.metricValue,t.uint32(18).fork()).ldelim(),e.runtimeInfo!==void 0&&dt.encode(e.runtimeInfo,t.uint32(26).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=UT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.metadata=lt.decode(n,n.uint32());continue;case 2:if(a!==18)break;i.metricValue=Nt.decode(n,n.uint32());continue;case 3:if(a!==26)break;i.runtimeInfo=dt.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{metadata:S(e.metadata)?lt.fromJSON(e.metadata):void 0,metricValue:S(e.metricValue)?Nt.fromJSON(e.metricValue):void 0,runtimeInfo:S(e.runtimeInfo)?dt.fromJSON(e.runtimeInfo):void 0}},toJSON(e){let t={};return e.metadata!==void 0&&(t.metadata=lt.toJSON(e.metadata)),e.metricValue!==void 0&&(t.metricValue=Nt.toJSON(e.metricValue)),e.runtimeInfo!==void 0&&(t.runtimeInfo=dt.toJSON(e.runtimeInfo)),t},create(e){return hc.fromPartial(e??{})},fromPartial(e){let t=UT();return t.metadata=e.metadata!==void 0&&e.metadata!==null?lt.fromPartial(e.metadata):void 0,t.metricValue=e.metricValue!==void 0&&e.metricValue!==null?Nt.fromPartial(e.metricValue):void 0,t.runtimeInfo=e.runtimeInfo!==void 0&&e.runtimeInfo!==null?dt.fromPartial(e.runtimeInfo):void 0,t}};function qT(){return{metadata:void 0,metricValue:void 0,add:!1,runtimeInfo:void 0}}var mc={encode(e,t=g.default.Writer.create()){return e.metadata!==void 0&<.encode(e.metadata,t.uint32(10).fork()).ldelim(),e.metricValue!==void 0&&Nt.encode(e.metricValue,t.uint32(18).fork()).ldelim(),e.add!==!1&&t.uint32(24).bool(e.add),e.runtimeInfo!==void 0&&dt.encode(e.runtimeInfo,t.uint32(34).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=qT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.metadata=lt.decode(n,n.uint32());continue;case 2:if(a!==18)break;i.metricValue=Nt.decode(n,n.uint32());continue;case 3:if(a!==24)break;i.add=n.bool();continue;case 4:if(a!==34)break;i.runtimeInfo=dt.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{metadata:S(e.metadata)?lt.fromJSON(e.metadata):void 0,metricValue:S(e.metricValue)?Nt.fromJSON(e.metricValue):void 0,add:S(e.add)?globalThis.Boolean(e.add):!1,runtimeInfo:S(e.runtimeInfo)?dt.fromJSON(e.runtimeInfo):void 0}},toJSON(e){let t={};return e.metadata!==void 0&&(t.metadata=lt.toJSON(e.metadata)),e.metricValue!==void 0&&(t.metricValue=Nt.toJSON(e.metricValue)),e.add!==!1&&(t.add=e.add),e.runtimeInfo!==void 0&&(t.runtimeInfo=dt.toJSON(e.runtimeInfo)),t},create(e){return mc.fromPartial(e??{})},fromPartial(e){let t=qT();return t.metadata=e.metadata!==void 0&&e.metadata!==null?lt.fromPartial(e.metadata):void 0,t.metricValue=e.metricValue!==void 0&&e.metricValue!==null?Nt.fromPartial(e.metricValue):void 0,t.add=e.add??!1,t.runtimeInfo=e.runtimeInfo!==void 0&&e.runtimeInfo!==null?dt.fromPartial(e.runtimeInfo):void 0,t}};function JT(){return{metadata:void 0,distinctEntityId:"",attributes:void 0,severity:0,message:"",runtimeInfo:void 0,noMetric:!1}}var gc={encode(e,t=g.default.Writer.create()){return e.metadata!==void 0&<.encode(e.metadata,t.uint32(10).fork()).ldelim(),e.distinctEntityId!==""&&t.uint32(18).string(e.distinctEntityId),e.attributes!==void 0&&M.encode(M.wrap(e.attributes),t.uint32(50).fork()).ldelim(),e.severity!==0&&t.uint32(56).int32(e.severity),e.message!==""&&t.uint32(66).string(e.message),e.runtimeInfo!==void 0&&dt.encode(e.runtimeInfo,t.uint32(42).fork()).ldelim(),e.noMetric!==!1&&t.uint32(24).bool(e.noMetric),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=JT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.metadata=lt.decode(n,n.uint32());continue;case 2:if(a!==18)break;i.distinctEntityId=n.string();continue;case 6:if(a!==50)break;i.attributes=M.unwrap(M.decode(n,n.uint32()));continue;case 7:if(a!==56)break;i.severity=n.int32();continue;case 8:if(a!==66)break;i.message=n.string();continue;case 5:if(a!==42)break;i.runtimeInfo=dt.decode(n,n.uint32());continue;case 3:if(a!==24)break;i.noMetric=n.bool();continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{metadata:S(e.metadata)?lt.fromJSON(e.metadata):void 0,distinctEntityId:S(e.distinctEntityId)?globalThis.String(e.distinctEntityId):"",attributes:Ve(e.attributes)?e.attributes:void 0,severity:S(e.severity)?dq(e.severity):0,message:S(e.message)?globalThis.String(e.message):"",runtimeInfo:S(e.runtimeInfo)?dt.fromJSON(e.runtimeInfo):void 0,noMetric:S(e.noMetric)?globalThis.Boolean(e.noMetric):!1}},toJSON(e){let t={};return e.metadata!==void 0&&(t.metadata=lt.toJSON(e.metadata)),e.distinctEntityId!==""&&(t.distinctEntityId=e.distinctEntityId),e.attributes!==void 0&&(t.attributes=e.attributes),e.severity!==0&&(t.severity=fq(e.severity)),e.message!==""&&(t.message=e.message),e.runtimeInfo!==void 0&&(t.runtimeInfo=dt.toJSON(e.runtimeInfo)),e.noMetric!==!1&&(t.noMetric=e.noMetric),t},create(e){return gc.fromPartial(e??{})},fromPartial(e){let t=JT();return t.metadata=e.metadata!==void 0&&e.metadata!==null?lt.fromPartial(e.metadata):void 0,t.distinctEntityId=e.distinctEntityId??"",t.attributes=e.attributes??void 0,t.severity=e.severity??0,t.message=e.message??"",t.runtimeInfo=e.runtimeInfo!==void 0&&e.runtimeInfo!==null?dt.fromPartial(e.runtimeInfo):void 0,t.noMetric=e.noMetric??!1,t}};function zT(){return{metadata:void 0,payload:"",runtimeInfo:void 0}}var _c={encode(e,t=g.default.Writer.create()){return e.metadata!==void 0&<.encode(e.metadata,t.uint32(10).fork()).ldelim(),e.payload!==""&&t.uint32(18).string(e.payload),e.runtimeInfo!==void 0&&dt.encode(e.runtimeInfo,t.uint32(26).fork()).ldelim(),t},decode(e,t){let n=e instanceof g.default.Reader?e:g.default.Reader.create(e),r=t===void 0?n.len:n.pos+t,i=zT();for(;n.pos<r;){let a=n.uint32();switch(a>>>3){case 1:if(a!==10)break;i.metadata=lt.decode(n,n.uint32());continue;case 2:if(a!==18)break;i.payload=n.string();continue;case 3:if(a!==26)break;i.runtimeInfo=dt.decode(n,n.uint32());continue}if((a&7)===4||a===0)break;n.skipType(a&7)}return i},fromJSON(e){return{metadata:S(e.metadata)?lt.fromJSON(e.metadata):void 0,payload:S(e.payload)?globalThis.String(e.payload):"",runtimeInfo:S(e.runtimeInfo)?dt.fromJSON(e.runtimeInfo):void 0}},toJSON(e){let t={};return e.metadata!==void 0&&(t.metadata=lt.toJSON(e.metadata)),e.payload!==""&&(t.payload=e.payload),e.runtimeInfo!==void 0&&(t.runtimeInfo=dt.toJSON(e.runtimeInfo)),t},create(e){return _c.fromPartial(e??{})},fromPartial(e){let t=zT();return t.metadata=e.metadata!==void 0&&e.metadata!==null?lt.fromPartial(e.metadata):void 0,t.payload=e.payload??"",t.runtimeInfo=e.runtimeInfo!==void 0&&e.runtimeInfo!==null?dt.fromPartial(e.runtimeInfo):void 0,t}},uie={name:"Processor",fullName:"processor.Processor",methods:{start:{name:"Start",requestType:ZT,requestStream:!1,responseType:zu,responseStream:!1,options:{}},stop:{name:"Stop",requestType:zu,requestStream:!1,responseType:zu,responseStream:!1,options:{}},getConfig:{name:"GetConfig",requestType:WT,requestStream:!1,responseType:HT,responseStream:!1,options:{}},processBindings:{name:"ProcessBindings",requestType:XT,requestStream:!1,responseType:YT,responseStream:!1,options:{}},processBindingsStream:{name:"ProcessBindingsStream",requestType:$T,requestStream:!0,responseType:KT,responseStream:!0,options:{}},preprocessBindingsStream:{name:"PreprocessBindingsStream",requestType:jT,requestStream:!0,responseType:eN,responseStream:!0,options:{}}}};function Ln(e){let t=BigInt(Math.trunc(e.getTime()/1e3)),n=e.getTime()%1e3*1e6;return{seconds:t,nanos:n}}function wn(e){let t=(globalThis.Number(e.seconds.toString())||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function Qn(e){return e instanceof globalThis.Date?e:typeof e=="string"?new globalThis.Date(e):wn(Me.fromJSON(e))}function Gt(e){return BigInt(e.toString())}g.default.util.Long!==gi&&(g.default.util.Long=gi,g.default.configure());function Ve(e){return typeof e=="object"&&e!==null}function S(e){return e!=null}var tN=":sto_bi",wq=":sto_bd";function bq(e){return e.slice(0,128).replace(/[^_a-zA-Z0-9]/g,"_")}function mA(e){return e==="labels"?"labels_":bq(e)}function Eq(e){return e.length>1024?(console.warn(`${e} is exceed max length for value storage, will be truncate to 1024 characters`),e.slice(0,1024)):e}function gA(e){if(Object.keys(e).length===0)return e;let t={};for(let n in e)e[n]!==void 0?t[mA(n)]=Eq(e[n]):console.warn(`key: ${n} has empty value in attributes`);return t}function nN(e,t,n){let r;switch(typeof e){case"string":return e.slice(0,t);case"bigint":return e.toString()+tN;case"number":return e;case"function":return null;case"symbol":return null}if(Array.isArray(e))return console.warn(`Array type inside log/event payload is not currently supported and will be ignored. Path: ${n??""}`),null;if(e===Object(e)){if(e instanceof Date)return e.toISOString();if(e instanceof Ut)return e.isNaN()||!e.isFinite()?(console.error("can't submit NaN or Infinity value, will store as 0"),0):e.toString()+wq;if(nr.isBN(e))return e.toString(10)+tN;if(e instanceof Promise)return console.error("Cannot submit promise"),null;r={};for(let[a,s]of Object.entries(e)){let o=nN(s,t,`${n??""}.${a}`);o!=null&&(r[a]=o)}}else r=e;return r}function qd(e){return nN(e,1e3)}import{MapStateStorage as Iq}from"@sentio/runtime";import{ListStateStorage as Cq}from"@sentio/runtime";var _A=class extends Cq{},Zi=_A;en(Zi,"INSTANCE",new _A);var Xi=class{static register(t){Zi.INSTANCE.addValue(t)}static findEntity(t){for(let n of Zi.INSTANCE.getValues())if(n.entities[t])return n.entities[t]}};var AA=class extends Iq{},Ac=AA;en(Ac,"INSTANCE",new AA);var Jd=class{ctx;constructor(t){this.ctx=t}emit(t,n){aN(t),iN(this.ctx,t,n)}},Bie=St;function rN(e){let t=[];for(let[n,r]of Object.entries(e)){let i,a,s;typeof r=="number"?i=r:r.address||r.symbol?a=r:s=Wi.create({fields:rN(r)}),t.push({name:n,basicType:i,coinType:a,structType:s})}return t}var zd=class{eventName;config;constructor(t,n){this.eventName=t,this.config=n}static register(t,n){aN(t);let r=Ai.create();n?.fields&&(r=Ai.create({name:t,fields:rN(n.fields)}));let i=new zd(t,r);return Ac.INSTANCE.getOrSetValue(t,i)}emit(t,n){iN(t,this.eventName,n)}};function iN(e,t,n){let{distinctId:r,severity:i,message:a,...s}=n,o={metadata:e.getMetaData(t,{}),severity:i||xt.INFO,message:a||"",distinctEntityId:r||"",attributes:{...gA(e.baseLabels),...qd(s)},runtimeInfo:void 0,noMetric:!0};e.update({events:[o]})}function aN(e){if(Xi.findEntity(e))throw new Error(`Event name ${e} is already used in the database schema`)}function Gd(e){if(typeof e=="number"){if(Number.isNaN(e))throw new Error("Cannot record NaN value");if(!Number.isFinite(e))throw new Error("Cannot record infinite value");return Number.isInteger(e)&&!Number.isSafeInteger(e)?Nt.fromPartial({bigInteger:yA(e)}):Nt.fromPartial({doubleValue:Number(e)})}if(typeof e=="bigint")return Nt.fromPartial({bigInteger:yA(e)});if(typeof e=="string")return Nt.fromPartial({bigDecimal:e});if(e.isInteger())return Nt.fromPartial({bigInteger:sN(e)});if(e.isNaN())throw new Error("Cannot record NaN value");if(!e.isFinite())throw new Error("Cannot record infinite value");return Nt.fromPartial({bigDecimal:e.toString()})}function sN(e){let t=e.isNegative();return t&&(e=e.abs()),oN(e.toString(16),t)}function Vd(e){let t=e<0;return t&&(e=-e),oN(e.toString(16),t)}function yA(e){return typeof e=="number"||typeof e=="bigint"?Vd(e):typeof e=="string"?Vd(BigInt(e)):e instanceof Ut?sN(e):Vd(e)}function oN(e,t){e.length%2===1&&(e="0"+e);let n=Buffer.from(e,"hex");return{negative:t,data:new Uint8Array(n)}}var Yi=class{name;constructor(t){this.name=mA(t)}};import{MapStateStorage as Sq}from"@sentio/runtime";var vA=class{unit;description;sparse;aggregationConfig};var Wd=class extends Yi{config;constructor(t,n,r){super(n),this.config=zr.fromPartial({...r,name:this.name,type:t});let i=this.config.aggregationConfig;i&&i.intervalInMinutes.length&&(i.intervalInMinutes.length>1&&console.error("current only support one intervalInMinutes, only first interval will be used for",n),i.intervalInMinutes[0]>0&&i.types.length===0&&(i.types=[yt.SUM,yt.COUNT]))}},wA=class extends Sq{getOrRegisterMetric(t,n,r){let i=this.getOrRegister(),a=i.get(n);if(a&&a.config.type!==t)throw Error(`redefine ${n} of metric type ${t} that is previously ${a.config.type}`);return a||(t===Tt.COUNTER?a=Ha._create(n,r):a=Za._create(n,r)),i.set(n,a),a}},Wa=wA;en(Wa,"INSTANCE",new wA);var Ha=class extends Wd{static register(t,n){return Wa.INSTANCE.getOrRegisterMetric(Tt.COUNTER,t,n)}static _create(t,n){return new Ha(t,n)}constructor(t,n){super(Tt.COUNTER,t,zr.fromPartial({...n,aggregationConfig:{intervalInMinutes:n?.resolutionConfig?[n?.resolutionConfig?.intervalInMinutes]:[]}}))}add(t,n,r={}){this.record(t,n,r,!0)}sub(t,n,r={}){this.record(t,n,r,!1)}record(t,n,r,i){t.update({counters:[{metadata:t.getMetaData(this.name,r),metricValue:Gd(n),add:i,runtimeInfo:void 0}]})}},Hd=class{ctx;counter;constructor(t,n){this.counter=Ha._create(t),this.ctx=n}add(t,n={}){this.counter.add(this.ctx,t,n)}sub(t,n={}){this.counter.sub(this.ctx,t,n)}},Za=class extends Wd{static register(t,n){return Wa.INSTANCE.getOrRegisterMetric(Tt.GAUGE,t,n)}static _create(t,n){return new Za(t,n)}constructor(t,n){super(Tt.GAUGE,t,zr.fromPartial({...n}))}record(t,n,r={}){t.update({gauges:[{metadata:t.getMetaData(this.config.name,r),metricValue:Gd(n),runtimeInfo:void 0}]})}},Zd=class{gauge;ctx;constructor(t,n){this.gauge=Za._create(t),this.ctx=n}record(t,n={}){this.gauge.record(this.ctx,t,n)}},Vu=class{ctx;constructor(t){this.ctx=t}Counter(t){return new Hd(t,this.ctx)}Gauge(t){return new Zd(t,this.ctx)}};var gu=Tn(hk(),1);import{mergeProcessResults as Y9,PluginManager as $9}from"@sentio/runtime";var mk=new Error("Value is required but received null or undefined");function rce(e){let{from:t,to:n,...r}=e;return{from:i=>{if(i==null)throw mk;return t(i)},to:i=>{if(i==null||i.nullValue)throw mk;return n(i)},...r,required:!0}}function ice(e){return{from:t=>({listValue:{values:t.map(e.from)}}),to:t=>t.listValue?.values.map(e.to)||[],isArray:!0,isRelation:e.isRelation,relationName:e.relationName}}function ace(e){return{from:t=>t==null?{nullValue:At.NULL_VALUE}:{stringValue:e[t]},to(t){return t.stringValue}}}function sce(e){return{from:t=>typeof t=="string"?{stringValue:t}:t instanceof Uint8Array?{stringValue:`0x${Buffer.from(t).toString("hex")}`}:typeof t=="object"?{stringValue:t.id.toString()}:{nullValue:At.NULL_VALUE},to(t){return t.stringValue},isRelation:!0,relationName:e}}var Q9={from:e=>e==null?{nullValue:At.NULL_VALUE}:{stringValue:e},to(e){return e.stringValue}},U9={from:e=>e==null?{nullValue:At.NULL_VALUE}:{intValue:Math.floor(e)},to(e){return e.intValue}},q9={from:e=>e==null?{nullValue:At.NULL_VALUE}:{floatValue:e},to(e){return e.floatValue}},J9={from:e=>e==null?{nullValue:At.NULL_VALUE}:{boolValue:e},to(e){return e.boolValue}},z9={from:e=>e==null?{nullValue:At.NULL_VALUE}:{timestampValue:e},to(e){return e.timestampValue}},gk={from:e=>e==null?{nullValue:At.NULL_VALUE}:{bytesValue:e},to(e){return e.bytesValue}},V9={from(e){return typeof e=="string"?{stringValue:e}:e instanceof Uint8Array?{stringValue:`0x${Buffer.from(e).toString("hex")}`}:{nullValue:At.NULL_VALUE}},to(e){if(e.stringValue)return e.stringValue;if(e.bytesValue)return`0x${Buffer.from(e.bytesValue).toString("hex")}`}},G9={from:e=>{if(e==null)return{nullValue:At.NULL_VALUE};let t=(e.c||[]).map((r,i)=>i==0?r.toString():r.toString().padStart(14,"0")).join(""),n=-(t.length-(e.e??0)-1);return{bigdecimalValue:{value:sh(BigInt(t)*BigInt(e.s??1)),exp:n}}},to(e){let t=e.bigdecimalValue;if(t){let n=_k(t.value.data),r=new Ut(n.toString());return t.exp<0?r=r.dividedBy(new Ut(10).pow(-t.exp)):r=r.multipliedBy(new Ut(10).pow(t.exp)),r.multipliedBy(t.value?.negative?-1:1)}}},W9={from:e=>e==null?{nullValue:At.NULL_VALUE}:{bigintValue:sh(e)},to(e){if(e.bigintValue){let t=_k(e.bigintValue?.data);return e.bigintValue.negative&&(t=-t),t}}};function _k(e){let t=BigInt(0);for(let n=0;n<e.length;n++)t=t*BigInt(256)+BigInt(e[n]);return t}function sh(e){let t=e<0;t&&(e=-e);let n=e.toString(16);n.length%2===1&&(n="0"+n);let r=Buffer.from(n,"hex");return{negative:t,data:new Uint8Array(r)}}var oce={BigDecimal:G9,BigInt:W9,String:Q9,Boolean:J9,Uint8Array:gk,ID:V9,Bytes:gk,Int:U9,Float:q9,Timestamp:z9};import{PluginManager as H9}from"@sentio/runtime";var oh=class{cache=new Map;getKey(t,n){return`${t}-${n}`}has(t,n){return this.cache.has(this.getKey(t,n))}get(t,n){return this.cache.get(this.getKey(t,n))}set(t){let n=t.data?.fields.id.stringValue;if(n){let r=this.getKey(t.entity,n),i=t.data?.fields||{};if(this.cache.has(r)){let a=this.cache.get(r)?.data?.fields||{};i=Object.assign(a,i)}this.cache.set(r,{...t,data:{fields:i}})}}delete(t,n){n&&this.cache.delete(this.getKey(t,n))}};function ch(e){if(e==null)throw new Error("can't figure out entityName from undefined");if(typeof e=="string")return e;if(typeof e=="function")return e.entityName;if(typeof e=="object")return e.constructor.entityName;throw new Error(`can't figure out entityName from ${typeof e}`)}var Ml=class{constructor(t){this.context=t}cache=new oh;async get(t,n){let r=ch(t),i=this.cache.get(r,n);if(i)return Promise.resolve(this.newEntity(t,i));let s=await this.context.sendRequest({get:{entity:r,id:n.toString()}});if(s.entityList?.entities[0]){let o=s.entityList?.entities[0];return this.newEntity(t,o)}}async delete(t,n){let r={entity:[],id:[]},i=ch(t);if(n)if(Array.isArray(n))for(let a of n)r.entity.push(i),r.id.push(a.toString()),this.cache.delete(i,a.toString());else r.entity.push(i),r.id.push(n),this.cache.delete(i,n);else{let a=Array.isArray(t)?t:[t];for(let s of a)r.entity.push(i),r.id.push(s.id.toString()),this.cache.delete(i,n)}await this.context.sendRequest({delete:r})}async upsert(t){let n=Array.isArray(t)?t:[t],r={upsert:{entity:n.map(a=>ch(a)),id:n.map(a=>a.id.toString()),entityData:n.map(a=>a._data)}};return this.context.sendRequest(r).then(a=>{r.upsert?.entity.forEach((s,o)=>{this.cache.set({entity:s,data:r.upsert?.entityData[o],genBlockChain:"",genBlockTime:void 0,genBlockNumber:0n})})})}async*listIterator(t,n){let r;for(;;){let i=await this.listRequest(t,n||[],r);for(let a of i.entityList?.entities||[])yield this.newEntity(t,a);if(!i.nextCursor)break;r=i.nextCursor}}async*listBatched(t,n,r=100){let i;for(;;){let a=await this.listRequest(t,n||[],i,r);if(yield(a.entityList?.entities||[]).map(o=>this.newEntity(t,o)),!a.nextCursor)break;i=a.nextCursor}}async listRequest(t,n,r,i){let a=await this.context.sendRequest({list:{entity:ch(t),cursor:r,pageSize:i,filters:n?.map(s=>({field:s.field,op:Z9[s.op],value:{values:Array.isArray(s.value)?s.value.map(o=>Mw(o)):[Mw(s.value)]}}))||[]}},3600);return a.entityList?.entities?.forEach(s=>{this.cache.set(s)}),a}async list(t,n,r){if(r){let i=await this.listRequest(t,n||[],r.cursor,r.pageSize);return r.cursor=i.nextCursor,i.entityList?.entities.map(a=>this.newEntity(t,a))||[]}return this.fromAsync(this.listIterator(t,n??[]))}async fromAsync(t){let n=[];for await(let r of t)n.push(r);return n}newEntity(t,n){if(typeof t=="string"){let i=Xi.findEntity(t);if(!i&&(i=Xi.findEntity(n.entity),!i))throw new Error(`Entity ${t} not found`);t=i}let r=new t({});return r._data=n.data,r}},Z9={"=":ye.EQ,"!=":ye.NE,"<":ye.LT,"<=":ye.LE,">":ye.GT,">=":ye.GE,in:ye.IN,"not in":ye.NOT_IN,like:ye.LIKE,"not like":ye.NOT_LIKE,"has all":ye.HAS_ALL,"has any":ye.HAS_ANY};function Mw(e){return e==null?{nullValue:0}:typeof e=="boolean"?{boolValue:e}:typeof e=="string"?{stringValue:e}:typeof e=="number"?{floatValue:e}:typeof e=="bigint"?{bigintValue:sh(e)}:e instanceof Ut?X9(e):e instanceof Date?{timestampValue:e}:e instanceof Uint8Array?{bytesValue:e}:Array.isArray(e)?{listValue:{values:e.map(t=>Mw(t))}}:{nullValue:0}}function X9(e){return{bigdecimalValue:void 0}}function _ce(){let e=H9.INSTANCE.dbContextLocalStorage.getStore();if(e)return new Ml(e)}var Fw=class{meter;eventLogger;_store;baseLabels;active;_res={counters:[],events:[],exports:[],gauges:[],states:{configUpdated:!1}};update(t){if(this.active)this._res=Y9([this._res,vn.fromPartial(t)]);else throw new gu.ServerError(gu.Status.INTERNAL,"context not active, possible async function invoke without await")}constructor(t){this.meter=new Vu(this),this.eventLogger=new Jd(this),this.baseLabels=t||{},this.active=!0,this.initStore()}stopAndGetResult(){if(this.active)return this.active=!1,this._res;throw new gu.ServerError(gu.Status.INTERNAL,"Can't get result from same context twice")}metadataCache=new Map;getMetaData(t,n){if(Object.keys(n).length===0){let r=this.metadataCache.get(t);return r||(r={...this.baseLabels,...this.getMetaDataInternal(t,n)},this.metadataCache.set(t,r)),r}return{...this.baseLabels,...this.getMetaDataInternal(t,n)}}get store(){return this._store==null&&console.warn("Store is not set, please initialize the processor with your database schema first."),this._store}initStore(){let t=$9.INSTANCE.dbContextLocalStorage.getStore();t&&(this._store=new Ml(t))}};import{MapStateStorage as K9}from"@sentio/runtime";var Lw=class extends K9{},_u=Lw;en(_u,"INSTANCE",new Lw);var Fl=class extends Yi{static register(t,n){let r=new Fl(t,n);return _u.INSTANCE.getOrSetValue(t,r)}channel;constructor(t,n){super(t),this.channel=n}emit(t,n){let r={metadata:t.getMetaData(this.name,{}),payload:JSON.stringify(n),runtimeInfo:void 0};t.update({exports:[r]})}};import{MapStateStorage as j9}from"@sentio/runtime";var Uw=class extends j9{},ps=Uw;en(ps,"INSTANCE",new Uw);var lh=class extends Yi{static register(t,n){let r=new lh(t,{...lh.DEFAULT_OPTIONS,...n});return ps.INSTANCE.getOrSetValue(t,r)}options;constructor(t,n){super(t),this.options=n}trackEvent(t,n){let{distinctId:r,message:i,severity:a,...s}=n,o={message:i||"",severity:a||xt.INFO,metadata:t.getMetaData(this.name,{}),distinctEntityId:r||"",attributes:qd(s),runtimeInfo:void 0,noMetric:!1};t.update({events:[o]})}},uh=lh;en(uh,"DEFAULT_OPTIONS",{totalByDay:!0,unique:!0});var dh=class extends uh{static register(t,n){t?t=["user",t].join("_"):t="user";let r=new dh(t,{...dh.DEFAULT_OPTIONS,...n});return ps.INSTANCE.getOrSetValue(t,r)}},Qw=dh;en(Qw,"DEFAULT_OPTIONS",{totalByDay:!0,unique:!0,distinctByDays:[1,7,30]});import{Plugin as tZ,PluginManager as nZ}from"@sentio/runtime";import{ListStateStorage as eZ}from"@sentio/runtime";var qw=class extends eZ{},Ll=qw;en(Ll,"INSTANCE",new qw);var fh=class extends tZ{name="CorePlugin";async configure(t){t.templateInstances=[...Ll.INSTANCE.getValues()];for(let n of Wa.INSTANCE.getValues())t.metricConfigs.push({...n.config});for(let n of Ac.INSTANCE.getValues())t.eventLogConfigs.push({...n.config});for(let n of ps.INSTANCE.getValues())t.eventTrackingConfigs.push({distinctAggregationByDays:n.options.distinctByDays||[],eventName:n.name,retentionConfig:void 0,totalByDay:n.options.totalByDay||!1,totalPerEntity:void 0,unique:n.options.unique||!1});for(let n of _u.INSTANCE.getValues())t.exportConfigs.push({name:n.name,channel:n.channel});Zi.INSTANCE.getValues().length>0&&(t.dbSchema={gqlSchema:Zi.INSTANCE.getValues().map(n=>n.source).join(`
|
|
919
919
|
|
|
920
920
|
`)})}};nZ.INSTANCE.register(new fh);export{gi as a,no as b,zu as c,Va as d,X6 as e,Y6 as f,M as g,dA as h,_i as i,Jr as j,Me as k,At as l,Vi as m,Xt as n,tt as o,Gi as p,It as q,Tt as r,rq as s,iq as t,yt as u,aq as v,sq as w,Vr as x,oq as y,cq as z,Gr as A,uq as B,lq as C,Ce as D,VT as E,GT as F,xt as G,dq as H,fq as I,Hi as J,oie as K,cie as L,St as M,pq as N,hq as O,ye as P,mq as Q,gq as R,so as S,oo as T,WT as U,HT as V,co as W,uo as X,lo as Y,fo as Z,po as _,ho as $,zr as aa,Ai as ba,Wi as ca,pr as da,mo as ea,go as fa,fr as ga,ct as ha,_q as ia,_o as ja,hr as ka,mr as la,ZT as ma,Aq as na,ut as oa,Ao as pa,yo as qa,gr as ra,vo as sa,wo as ta,bo as ua,Eo as va,Co as wa,Io as xa,So as ya,_r as za,xo as Aa,To as Ba,No as Ca,Ar as Da,Ro as Ea,Bo as Fa,ko as Ga,Oo as Ha,Po as Ia,Do as Ja,Mo as Ka,Fo as La,Lo as Ma,Qo as Na,XT as Oa,YT as Pa,$T as Qa,KT as Ra,jT as Sa,Uo as Ta,eN as Ua,yr as Va,qo as Wa,Jo as Xa,vr as Ya,zo as Za,Vo as _a,Go as $a,Wo as ab,Ho as bb,Zo as cb,Xo as db,Yo as eb,$o as fb,Ko as gb,jo as hb,ec as ib,tc as jb,nc as kb,rc as lb,ic as mb,ac as nb,sc as ob,oc as pb,cc as qb,uc as rb,lc as sb,Vt as tb,dc as ub,vn as vb,fc as wb,pc as xb,yq as yb,vq as zb,pA as Ab,lt as Bb,hA as Cb,Nt as Db,dt as Eb,hc as Fb,mc as Gb,gc as Hb,_c as Ib,uie as Jb,H as Kb,Bn as Lb,ve as Mb,Ae as Nb,le as Ob,mn as Pb,Ra as Qb,id as Rb,ad as Sb,gn as Tb,Ns as Ub,Pi as Vb,Rs as Wb,fE as Xb,xu as Yb,Dt as Zb,_n as _b,j$ as $b,W0 as ac,vd as bc,X0 as cc,c_ as dc,Y0 as ec,di as fc,aC as gc,Zs as hc,NU as ic,E_ as jc,Sd as kc,k6 as lc,z_ as mc,gA as nc,Xi as oc,Ac as pc,Jd as qc,Bie as rc,rN as sc,zd as tc,Gd as uc,yA as vc,vA as wc,Ha as xc,Hd as yc,Za as zc,Zd as Ac,Vu as Bc,Un as Cc,Ea as Dc,Ca as Ec,hk as Fc,mk as Gc,rce as Hc,ice as Ic,ace as Jc,sce as Kc,Q9 as Lc,U9 as Mc,q9 as Nc,J9 as Oc,z9 as Pc,gk as Qc,V9 as Rc,G9 as Sc,W9 as Tc,_k as Uc,sh as Vc,oce as Wc,ch as Xc,Ml as Yc,_ce as Zc,Fw as _c,Fl as $c,ps as ad,uh as bd,Qw as cd,Ll as dd,fh as ed};
|
|
921
921
|
/*! Bundled license information:
|
|
@@ -1034,4 +1034,4 @@ long/index.js:
|
|
|
1034
1034
|
* SPDX-License-Identifier: Apache-2.0
|
|
1035
1035
|
*)
|
|
1036
1036
|
*/
|
|
1037
|
-
//# sourceMappingURL=chunk-
|
|
1037
|
+
//# sourceMappingURL=chunk-URRJSGRQ.js.map
|