@sentio/sdk-bundle 2.55.2 → 2.55.3-rc.1
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/0x4.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-SQBMMGFT.js → chunk-2DUCSDO7.js} +2 -2
- package/lib/{chunk-HWODJFVJ.js → chunk-2MCVWLTK.js} +2 -2
- package/lib/chunk-4JMWEEOU.js +5 -0
- package/lib/{chunk-YQ346IMF.js.map → chunk-4JMWEEOU.js.map} +1 -1
- package/lib/{chunk-6P4HU4KH.js → chunk-53XVZIOS.js} +2 -2
- package/lib/{chunk-SXK7O76Y.js → chunk-CKB2GZGQ.js} +2 -2
- package/lib/{chunk-VLD3QNSH.js → chunk-EAH3OHUK.js} +10 -10
- package/lib/{chunk-5NXOOGVA.js → chunk-GIBCL6SV.js} +2 -2
- package/lib/{chunk-VA46M7OL.js → chunk-GT457NDF.js} +2 -2
- package/lib/{chunk-RIHABKWB.js → chunk-JXKWIGCW.js} +2 -2
- package/lib/{chunk-CQUL5GH2.js → chunk-LVMSXTFA.js} +2 -2
- package/lib/{chunk-A3BBP3JY.js → chunk-N5A5ZN6G.js} +2 -2
- package/lib/{chunk-RZTTP64K.js → chunk-N6O7KQC2.js} +2 -2
- package/lib/{chunk-NEZRMKYM.js → chunk-OVMVTYVQ.js} +2 -2
- package/lib/{chunk-4ZKROMHQ.js → chunk-OY4EVOT7.js} +2 -2
- package/lib/{chunk-26VKFV5Y.js → chunk-PMLM5WX5.js} +2 -2
- package/lib/chunk-RKVVI3AU.js +6 -0
- package/lib/{chunk-ZSDI5U4B.js.map → chunk-RKVVI3AU.js.map} +1 -1
- package/lib/{chunk-JUDV27KS.js → chunk-RSCFPRTF.js} +2 -2
- package/lib/{chunk-24TKIKAC.js → chunk-V7OZPIM4.js} +2 -2
- package/lib/{chunk-QR7CH6SO.js → chunk-XBPUKROJ.js} +3 -3
- package/lib/{chunk-QR7CH6SO.js.map → chunk-XBPUKROJ.js.map} +1 -1
- package/lib/{chunk-EJ3LB3BV.js → chunk-ZRTQM4DN.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/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/index.js +1 -1
- package/lib/store/index.js.map +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 +15 -15
- package/lib/testing/index.js.map +1 -1
- package/lib/utils/index.js +1 -1
- package/package.json +2 -2
- package/lib/chunk-YQ346IMF.js +0 -5
- package/lib/chunk-ZSDI5U4B.js +0 -6
- /package/lib/{chunk-SQBMMGFT.js.map → chunk-2DUCSDO7.js.map} +0 -0
- /package/lib/{chunk-HWODJFVJ.js.map → chunk-2MCVWLTK.js.map} +0 -0
- /package/lib/{chunk-6P4HU4KH.js.map → chunk-53XVZIOS.js.map} +0 -0
- /package/lib/{chunk-SXK7O76Y.js.map → chunk-CKB2GZGQ.js.map} +0 -0
- /package/lib/{chunk-VLD3QNSH.js.map → chunk-EAH3OHUK.js.map} +0 -0
- /package/lib/{chunk-5NXOOGVA.js.map → chunk-GIBCL6SV.js.map} +0 -0
- /package/lib/{chunk-VA46M7OL.js.map → chunk-GT457NDF.js.map} +0 -0
- /package/lib/{chunk-RIHABKWB.js.map → chunk-JXKWIGCW.js.map} +0 -0
- /package/lib/{chunk-CQUL5GH2.js.map → chunk-LVMSXTFA.js.map} +0 -0
- /package/lib/{chunk-A3BBP3JY.js.map → chunk-N5A5ZN6G.js.map} +0 -0
- /package/lib/{chunk-RZTTP64K.js.map → chunk-N6O7KQC2.js.map} +0 -0
- /package/lib/{chunk-NEZRMKYM.js.map → chunk-OVMVTYVQ.js.map} +0 -0
- /package/lib/{chunk-4ZKROMHQ.js.map → chunk-OY4EVOT7.js.map} +0 -0
- /package/lib/{chunk-26VKFV5Y.js.map → chunk-PMLM5WX5.js.map} +0 -0
- /package/lib/{chunk-JUDV27KS.js.map → chunk-RSCFPRTF.js.map} +0 -0
- /package/lib/{chunk-24TKIKAC.js.map → chunk-V7OZPIM4.js.map} +0 -0
- /package/lib/{chunk-EJ3LB3BV.js.map → chunk-ZRTQM4DN.js.map} +0 -0
package/lib/utils/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
|
|
2
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l}from"../chunk-
|
|
2
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l}from"../chunk-XBPUKROJ.js";import"../chunk-N6O7KQC2.js";import"../chunk-OY4EVOT7.js";import"../chunk-2DUCSDO7.js";import"../chunk-4WNGQ3EZ.js";import"../chunk-IVMOWPFA.js";import"../chunk-EAH3OHUK.js";import"../chunk-RA75ESSD.js";import"../chunk-G5BIPHMS.js";export{f as EthereumDexPrice,d as PriceUnit,g as SepoliaDexPrice,b as bytesToBigInt,a as estimateBlockNumberAtDate,k as getCoinsThatHasPrice,e as getPackageRoot,j as getPriceBySymbol,i as getPriceByType,h as getPriceClient,l as ignoreEthCallException,c as token};
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentio/sdk-bundle",
|
|
3
|
-
"version": "2.55.
|
|
3
|
+
"version": "2.55.3-rc.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"{lib,assets}"
|
|
48
48
|
],
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@sentio/runtime": "^2.55.
|
|
50
|
+
"@sentio/runtime": "^2.55.3-rc.1"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {},
|
|
53
53
|
"devDependencies": {},
|
package/lib/chunk-YQ346IMF.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
|
|
2
|
-
import{a as I,b as R}from"./chunk-4WNGQ3EZ.js";import{B as f,Dd as B,Ia as P,Ja as N,La as b,Ma as _,Na as O,Td as A,U as V,je as l,ne as F,se as H}from"./chunk-VLD3QNSH.js";import{a as v}from"./chunk-RA75ESSD.js";import{a as o,f as x}from"./chunk-G5BIPHMS.js";var h=class extends F{constructor(e,n,a,s){super({});this.chainId=e;this.name=n;this.tx=a;this.address=s}static{o(this,"BTCContext")}getMetaDataInternal(e,n){return{address:this.address,contractName:this.name,blockNumber:BigInt(this.tx.blockheight??0),transactionIndex:0,transactionHash:this.tx.txid,chainId:this.getChainId(),name:e,logIndex:0,labels:B(n)}}getChainId(){return this.chainId}},m=class extends F{constructor(e,n,a,s){super({});this.chainId=e;this.name=n;this.block=a;this.address=s}static{o(this,"BTCBlockContext")}getMetaDataInternal(e,n){return{address:this.address??"",contractName:this.name,blockNumber:BigInt(this.block.height??0),transactionIndex:0,transactionHash:"",chainId:this.getChainId(),name:e,logIndex:0,labels:B(n)}}getChainId(){return this.chainId}};import("node:process").then(r=>r.stdout.write(""));import{ListStateStorage as M}from"@sentio/runtime";var g=x(A(),1);var u=class r extends M{static{o(this,"BTCProcessorState")}static INSTANCE=new r},w=class r{constructor(t){this.config=t;return R(this)}static{o(this,"BTCProcessor")}callHandlers=[];blockHandlers=[];static bind(t){let e=new r(t);return u.INSTANCE.addValue(e),e}onTransaction(t,e){let n={handlerName:I(),handler:o(async a=>{let s=a.transaction,i=new h(this.config.chainId,this.config.name??this.config.address??"",s,this.config.address??s.vout?.[0]?.scriptPubKey?.address);return await t(s,i),i.stopAndGetResult()},"handler"),filter:e};return this.callHandlers.push(n),this}onInterval(t,e,n,a){e&&e.backfillInterval<e.recentInterval&&(e.backfillInterval=e.recentInterval);let s=this;return this.blockHandlers.push({blockInterval:n,timeIntervalInMinutes:e,handlerName:I(),handler:o(async function(i){let d=i.block;if(!d)throw new g.ServerError(g.Status.INVALID_ARGUMENT,"Block is empty");let p={...d};a?.getTransactions&&(p.tx=d.rawtx?.map(L=>L));let y=new m(s.config.chainId,s.config.name??s.config.address??"",p,s.config.address);return await t(p,y),y.stopAndGetResult()},"handler"),fetchConfig:a}),this}onBlockInterval(t,e=250,n=1e3,a){return this.onInterval(t,void 0,{recentInterval:e,backfillInterval:n},a)}onTimeInterval(t,e=60,n=240,a){return this.onInterval(t,{recentInterval:e,backfillInterval:n},void 0,a)}};import("node:process").then(r=>r.stdout.write(""));function q(r){if(r){let t=_.create(),e=[],n=[],a=[];for(let s of Array.isArray(r)?r:[r]){let{preVOut:i,preTransaction:d,...p}=s;e.push(p),i&&n.push(i),d&&a.push(d)}if(t.filters=b.create({filters:T(e)}),n.length>0){let s=T(n);s&&s.length>0&&(t.preVOut=s[0])}return a.length>0&&(t.preTransaction=C(a)?.[0]),t}}o(q,"toVinFilter");function G(r){if(r){let t=O.create(),e=Array.isArray(r)?r:[r];return t.filters=b.create({filters:T(e)}),t}}o(G,"toVOutFilter");function C(r){return(Array.isArray(r)?r:[r]).map(e=>({filter:T(e.filter),inputFilter:q(e.inputFilter),outputFilter:G(e.outputFilter)}))}o(C,"filters2Proto");function z(r){let t=P.create();r instanceof Date&&(t.eq=l(r)),typeof r=="number"&&(t.eq=l(r)),typeof r=="string"&&(t.eq=l(r)),r instanceof v&&(t.eq=l(r)),typeof r=="bigint"&&(t.eq=l(r)),typeof r=="boolean"&&(t.eq=l(r)),Array.isArray(r)&&(t.in={values:r.map(e=>l(e))});for(let[e,n]of Object.entries(r))switch(e){case"prefix":case"contains":case"notContains":t[e]=n.toString();break;case"length":t.lengthEq=n;break;case"lengthGt":case"lengthLt":t[e]=n;break;case"hasAny":case"hasAll":case"in":t[e]={values:n.map(a=>l(a))};break;case"eq":case"gt":case"gte":case"lt":case"lte":case"ne":t[e]=l(n);break;default:throw new Error("Unknown condition op: "+e)}return t}o(z,"toCondition");function T(r){if(r&&r.length>0){let t=[];for(let e of r){let n=N.create();for(let[a,s]of Object.entries(e))n.conditions[a]=z(s);t.push(n)}return t}return[]}o(T,"convertFilters");import("node:process").then(r=>r.stdout.write(""));import{errorString as D,GLOBAL_CONFIG as S,mergeProcessResults as E,Plugin as K,PluginManager as U,USER_PROCESSOR as j}from"@sentio/runtime";var c=x(A(),1);var k=class extends K{static{o(this,"BTCPlugin")}name="BTCPlugin";handlers={txHandlers:[],blockHandlers:[]};async configure(t){let e={txHandlers:[],blockHandlers:[]};for(let n of u.INSTANCE.getValues()){let a=V.fromPartial({processorType:j,contract:{name:n.config.name,chainId:n.config.chainId.toString(),address:n.config.address||"*",abi:""},startBlock:n.config.startBlock,endBlock:n.config.endBlock});for(let s of n.callHandlers){let i=e.txHandlers.push(s.handler)-1,d=s.handlerName;s.filter?a.btcTransactionConfigs.push({filters:C(s.filter),handlerId:i,handlerName:d}):a.contract?.address!="*"&&a.btcTransactionConfigs.push({filters:C({outputFilter:{script_address:n.config.address}}),handlerId:i,handlerName:d})}for(let s of n.blockHandlers){let i=e.blockHandlers.push(s.handler)-1;a.intervalConfigs.push({slot:0,slotInterval:s.blockInterval,minutes:0,minutesInterval:s.timeIntervalInMinutes,handlerId:i,handlerName:s.handlerName,fetchConfig:{transaction:s.fetchConfig?.getTransactions??!1,trace:!1,block:!0,transactionReceipt:!1,transactionReceiptLogs:!1}})}t.contractConfigs.push(a)}this.handlers=e}supportedHandlers=[f.BTC_TRANSACTION,f.BTC_BLOCK];processBinding(t){switch(t.handlerType){case f.BTC_TRANSACTION:return this.processTransaction(t);case f.BTC_BLOCK:return this.processBlock(t);default:throw new c.ServerError(c.Status.INVALID_ARGUMENT,"No handle type registered "+t.handlerType)}}async start(t){}stateDiff(t){return H.INSTANCE.getValues().length!==t.templateInstances.length}async processTransaction(t){if(!t.data?.btcTransaction)throw new c.ServerError(c.Status.INVALID_ARGUMENT,"BTCEvents can't be null");let e=[],n=t.data?.btcTransaction;for(let a of t.handlerIds){let s=this.handlers.txHandlers[a](t.data?.btcTransaction).catch(i=>{throw new c.ServerError(c.Status.INTERNAL,"error processing transaction: "+JSON.stringify(n)+`
|
|
3
|
-
`+D(i))});S.execution.sequential&&await s,e.push(s)}return E(await Promise.all(e))}async processBlock(t){if(!t.data?.btcBlock)throw new c.ServerError(c.Status.INVALID_ARGUMENT,"Block can't be empty");let e=t.data.btcBlock,n=[];for(let a of t.handlerIds){let s=this.handlers.blockHandlers[a](e).catch(i=>{throw new c.ServerError(c.Status.INTERNAL,"error processing block: "+JSON.stringify(e)+`
|
|
4
|
-
`+D(i))});S.execution.sequential&&await s,n.push(s)}return E(await Promise.all(n))}};U.INSTANCE.register(new k);import("node:process").then(r=>r.stdout.write(""));export{h as a,m as b,u as c,w as d,C as e,k as f};
|
|
5
|
-
//# sourceMappingURL=chunk-YQ346IMF.js.map
|
package/lib/chunk-ZSDI5U4B.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
|
|
2
|
-
import{a as C,b}from"./chunk-4WNGQ3EZ.js";import{a as dt}from"./chunk-IVMOWPFA.js";import{Ad as st,B as T,Bd as at,Db as tt,Dd as it,Tb as F,Td as ct,U as q,Ub as M,ne as lt,se as R,uc as et,ue as K,vc as A,wc as B,xc as ot,xd as j,yc as L,yd as rt,zc as J,zd as nt}from"./chunk-VLD3QNSH.js";import{a as i,f as H}from"./chunk-G5BIPHMS.js";import{errorString as O,GLOBAL_CONFIG as Y,mergeProcessResults as Z,Plugin as yt,PluginManager as kt,USER_PROCESSOR as vt}from"@sentio/runtime";var f=H(ct(),1);import{MapStateStorage as It}from"@sentio/runtime";var h=class o extends It{static{i(this,"FuelProcessorState")}static INSTANCE=new o};import("node:process").then(o=>o.stdout.write(""));var W=H(dt(),1);import{Endpoints as Pt}from"@sentio/runtime";var Tt={MAIN_NET:W.FuelChainId.FUEL_MAINNET,TEST_NET:W.FuelChainId.FUEL_TESTNET};function bt(o){switch(o){case Tt.TEST_NET:return"https://testnet.fuel.network/v1/graphql"}return"https://mainnet.fuel.network/v1/graphql"}i(bt,"getRpcEndpoint");function v(o){let t=Pt.INSTANCE.chainServer.get(o);return t||(t=bt(o)),st.create(t)}i(v,"getProvider");import("node:process").then(o=>o.stdout.write(""));var S=class{constructor(t,e,r,a,s){this.args=a;this.logs=s}static{i(this,"FuelCall")}},I=class extends lt{constructor(e,r,a,s,n,l){super({});this.chainId=e;this.contractAddress=r;this.contractName=a;this.timestamp=s;this.transaction=n;this.block=l}static{i(this,"FuelContext")}logIndex=-1;getChainId(){return this.chainId}setLogIndex(e){this.logIndex=e}getMetaDataInternal(e,r){return{address:this.contractAddress,contractName:this.contractName,blockNumber:BigInt(this.block?.height?.toString()??(this.transaction?.blockNumber||0)),transactionIndex:0,transactionHash:this.transaction?.id||"",chainId:this.getChainId(),name:e,logIndex:this.logIndex,labels:it(r)}}},N=class extends I{constructor(e,r,a,s,n,l,c){super(e,a,s,n,l,c);this.chainId=e;this.contract=r;this.contractAddress=a;this.contractName=s;this.timestamp=n;this.transaction=l;this.block=c}static{i(this,"FuelContractContext")}get provider(){return this.contract.provider}};import("node:process").then(o=>o.stdout.write(""));var y={includeFailed:!1};function ut(o,t){for(let e of o||[])if(e.type==B.Coin&&e.assetId==t)return e.owner}i(ut,"findSenderFromInputs");function w(o,t){let e=M(o.rawPayload),r=o?.status.receipts?.map(j)||[],[a]=new J().decode(e,0),{gasCosts:s,feeParameters:n,txParameters:l,baseAssetId:c}=t.getChain().consensusParameters,g=o.status?.block?.header?.height,{gasPriceFactor:d,gasPerByte:m}=n,{maxInputs:p,maxGasPerTx:P}=l,u={type:o.status?.__typename,...o.status};return{...rt({id:o.id,receipts:r,transaction:a,transactionBytes:e,gqlTransactionStatus:u,gasPerByte:F(m),gasPriceFactor:F(d),maxInputs:p,gasCosts:s,gasPrice:F(o.gasPrice),maxGasPerTx:P,baseAssetId:c}),blockNumber:g,sender:ut(a.inputs,c)}}i(w,"decodeFuelTransaction");function $(o,t){if(o&&(o.type===L.LogData||o.type===L.Log)){let e=new A(t),r=o.type===L.Log?new et("u64").encode(o.val0):o.data,a=o.val1.toString(),[s]=e.decodeLog(r,a);return{logId:a,data:s}}return null}i($,"decodeLog");async function z(o,t,e){let r=M(o.rawPayload),[a]=new J().decode(r,0),s=o?.status.receipts?.map(j)||[],n={type:o.status?.__typename,...o.status},l=n?.block?.header?.height,c=Object.values(t)[0],g=[];s.forEach((p,P)=>{try{let u=$(p,c);u&&g.push({...u,receiptIndex:P})}catch(u){console.warn("Failed to decode log",u)}});let d=new nt(o.status.transactionId,e,{main:Object.values(t)[0],otherContractsAbis:{}});return d.gqlTransaction={...o,status:n},{...await d.getTransactionSummary(),blockNumber:l,logs:g,sender:ut(a.inputs,e.getChain().consensusParameters.baseAssetId)}}i(z,"decodeFuelTransactionWithAbi");import("node:process").then(o=>o.stdout.write(""));var E=H(ct(),1);var k=class o{constructor(t){this.config=t;return b(this)}static{i(this,"FuelProcessor")}txHandlers=[];blockHandlers=[];logHandlers=[];provider;contract;static bind(t){let e=new o(t);return Q(t,e),e}latestGasPrice;async configure(){this.provider=await v(this.config.chainId),this.provider.getLatestGasPrice=async()=>{if(this.latestGasPrice)return F(this.latestGasPrice);let{latestGasPrice:t}=await this.provider.operations.getLatestGasPrice();return this.latestGasPrice=t?.gasPrice,F(t.gasPrice)},this.contract=new at(this.config.address,this.config.abi,this.provider)}onTransaction(t,e=y){let r={handlerName:C(),handler:i(async a=>{let s=this.config.abi?{[this.config.address]:this.config.abi}:{},n=await z(a.transaction,s,this.provider),l=new N(this.config.chainId,this.contract,this.config.address,this.config.name??this.config.address,a.timestamp||new Date(0),n,null);return await t(n,l),l.stopAndGetResult()},"handler"),fetchConfig:{filters:[],...e}};return this.txHandlers.push(r),this}onCall(t,e,r=y){let a=new Set(Array.isArray(t)?t:[t]);if(!this.config.abi)throw new Error("ABI must be provided to use onCall");let s=this.config.abi,n={},l=new A(s);for(let g of a)try{let d=l.functions[g],m=F(d.selector,"hex").toString();n[d.name]={function:m,includeFailed:!!r.includeFailed}}catch(d){console.error(d)}let c={handlerName:C(),handler:i(async g=>{try{let d=g.transaction,m=await z(d,{[this.config.address]:s},this.provider),p=new I(this.config.chainId,this.config.address,this.config.name??this.config.address,g.timestamp||new Date(0),m,null);for(let P of m.operations)for(let u of P.calls||[])if(a.has(u.functionName)){let U=this.contract.functions[u.functionName],ht=Object.values(u.argumentsProvided||{}),Ft=U(...ht),Ct=new S(Ft,m,!1,u.argumentsProvided,m.logs);await e(Ct,p)}return p.stopAndGetResult()}catch(d){return console.error(d),{gauges:[],counters:[],events:[],exports:[],states:{configUpdated:!1}}}},"handler"),fetchConfig:{filters:Object.values(n)}};return this.txHandlers.push(c),this}onLog(t,e){let r=new Set(Array.isArray(t)?t:[t]),a={handlerName:C(),handler:i(async({transaction:s,receiptIndex:n,timestamp:l})=>{try{let c=w(s,this.provider),g=Number(n),d=c.receipts[g],m=$(d,this.config.abi);if(m){let p=new N(this.config.chainId,this.contract,this.config.address,this.config.name??this.config.address,l||new Date(0),c,null);return p.setLogIndex(g),await e({receiptIndex:g,...m},p),p.stopAndGetResult()}else console.error(`Log with receipt index ${n} not found in tx`)}catch(c){console.error(c)}return tt.fromPartial({})},"handler"),logConfig:{logIds:Array.from(r)}};return this.logHandlers.push(a),this}onInterval(t,e,r){e&&e.backfillInterval<e.recentInterval&&(e.backfillInterval=e.recentInterval);let a=this;return this.blockHandlers.push({blockInterval:r,timeIntervalInMinutes:e,handlerName:C(),handler:i(async function(s){let n=s.block;if(!n)throw new E.ServerError(E.Status.INVALID_ARGUMENT,"Block is empty");let l={id:n.id,height:F(n.height),time:n.time,header:{applicationHash:n.applicationHash,daHeight:F(n.daHeight),eventInboxRoot:n.eventInboxRoot,messageOutboxRoot:n.messageOutboxRoot,prevRoot:n.prevRoot,stateTransitionBytecodeVersion:n.stateTransitionBytecodeVersion,transactionsCount:n.transactionsCount,transactionsRoot:n.transactionsRoot}},c=new N(a.config.chainId,a.contract,a.config.address,a.config.name??a.config.address,s.timestamp||new Date(0),null,l);return await t(l,c),c.stopAndGetResult()},"handler")}),this}onBlockInterval(t,e=250,r=1e3){return this.onInterval(t,void 0,{recentInterval:e,backfillInterval:r})}onTimeInterval(t,e=60,r=240){return this.onInterval(t,{recentInterval:e,backfillInterval:r},void 0)}};function x(o){let t=[o.address];return o.chainId&&t.push(o.chainId),o.name&&t.push(o.name),o.startBlock&&t.push(o.startBlock.toString()),o.endBlock&&t.push(o.endBlock.toString()),t.join("_")}i(x,"getOptionsSignature");function pe(o){let t=x(o);return h.INSTANCE.getValue(t)}i(pe,"getFuelProcessor");function Q(o,t){let e=x(o);h.INSTANCE.getOrSetValue(e,t)}i(Q,"addFuelProcessor");import("node:process").then(o=>o.stdout.write(""));var _=class o{constructor(t){this.config=t;return b(this)}static{i(this,"FuelAssetProcessor")}txHandlers=[];blockHandlers=[];provider;static bind(t){let e=new o(t),r="assets_"+x({...t,address:"*"});return h.INSTANCE.getOrSetValue(r,e),e}async configure(){this.provider=await v(this.config.chainId)}onTransfer(t,e){let r=[],a=X(t.assetId),s=X(t.from),n=X(t.to);for(let c of a)for(let g of s)for(let d of n)r.push({assetId:c,fromAddress:g,toAddress:d});let l={handlerName:C(),handler:i(async c=>{let g=c.transaction,d=w(g,this.provider),m={from:[],to:[]};for(let u of d.transaction.inputs||[])u.type==B.Coin&&m.from.push({address:u.owner,assetId:u.assetId,amount:BigInt(u.amount.toString(10))});for(let u of d.transaction.outputs||[])if(u.type==ot.Coin){let U=u.amount.toString(10);m.to.push({address:u.to,amount:BigInt(U),assetId:u.assetId})}let p=m.from[0].assetId||"",P=new I(this.config.chainId,p,this.config.name??"",c.timestamp||new Date(0),d,null);return await e(m,P),P.stopAndGetResult()},"handler"),assetConfig:{filters:r}};return this.txHandlers.push(l),this}};function X(o){return o?Array.isArray(o)?o.length>0?o:[void 0]:[o]:[void 0]}i(X,"arrayify");import("node:process").then(o=>o.stdout.write(""));import{mergeProcessResults as xt}from"@sentio/runtime";var D=class o{constructor(t){this.config=t;return b(this)}static{i(this,"FuelGlobalProcessor")}txHandlers=[];blockHandlers=[];provider;static bind(t){let e=new o(t),r="global_"+x({...t,address:K});return h.INSTANCE.getOrSetValue(r,e),e}async configure(){this.provider=await v(this.config.chainId)}onTransaction(t,e=y){let r={handlerName:C(),handler:i(async a=>{let s;try{s=w(a.transaction,this.provider)}catch(l){return console.error("error decoding transaction",l),xt([])}let n=new I(this.config.chainId,K,this.config.name??"*",a.timestamp||new Date(0),s,null);return await t(s,n),n.stopAndGetResult()},"handler"),fetchConfig:{filters:[],...e}};return this.txHandlers.push(r),this}};import("node:process").then(o=>o.stdout.write(""));var V=class extends yt{static{i(this,"FuelPlugin")}name="FuelPlugin";handlers={transactionHandlers:[],blockHandlers:[],logHandlers:[]};async configure(t){let e={transactionHandlers:[],blockHandlers:[],logHandlers:[]};for(let r of h.INSTANCE.getValues()){let a=q.fromPartial({processorType:vt,contract:{name:r.config.name,chainId:r.config.chainId.toString(),address:r.config.address||"*",abi:""},startBlock:r.config.startBlock,endBlock:r.config.endBlock});for(let s of r.txHandlers){let n=e.transactionHandlers.push(s.handler)-1,l=s.handlerName;if(r instanceof k){let c={handlerId:n,handlerName:l};a.fuelTransactionConfigs.push(c)}else if(r instanceof _){let c=s.assetConfig;a.assetConfigs.push({filters:c?.filters||[],handlerId:n,handlerName:l})}else if(r instanceof D){let c={handlerId:n,handlerName:l,filters:[]};a.fuelTransactionConfigs.push(c),a.contract.address="*"}}for(let s of r.logHandlers??[]){let n=e.logHandlers.push(s.handler)-1,l=s.handlerName;r instanceof k&&a.fuelLogConfigs.push({logIds:s.logConfig?.logIds||[],handlerId:n,handlerName:l})}for(let s of r.blockHandlers){let n=e.blockHandlers.push(s.handler)-1;a.intervalConfigs.push({slot:0,slotInterval:s.blockInterval,minutes:0,minutesInterval:s.timeIntervalInMinutes,handlerId:n,handlerName:s.handlerName,fetchConfig:void 0})}t.contractConfigs.push(a)}this.handlers=e}supportedHandlers=[T.FUEL_TRANSACTION,T.FUEL_RECEIPT,T.FUEL_CALL,T.FUEL_BLOCK];processBinding(t){switch(t.handlerType){case T.FUEL_TRANSACTION:return this.processTransaction(t);case T.FUEL_RECEIPT:return this.processLog(t);case T.FUEL_BLOCK:return this.processBlock(t);default:throw new f.ServerError(f.Status.INVALID_ARGUMENT,"No handle type registered "+t.handlerType)}}async start(t){try{for(let e of h.INSTANCE.getValues())await e.configure()}catch(e){throw new f.ServerError(f.Status.INTERNAL,"error starting FuelPlugin: "+O(e))}}stateDiff(t){return R.INSTANCE.getValues().length!==t.templateInstances.length}async processLog(t){if(!t.data?.fuelLog?.transaction)throw new f.ServerError(f.Status.INVALID_ARGUMENT,"transaction can't be null");let e=t.data.fuelLog,r=[];for(let a of t.handlerIds){let s=this.handlers.logHandlers[a](e).catch(n=>{throw new f.ServerError(f.Status.INTERNAL,"error processing transaction: "+JSON.stringify(e)+`
|
|
3
|
-
`+O(n))});Y.execution.sequential&&await s,r.push(s)}return Z(await Promise.all(r))}async processTransaction(t){if(!t.data?.fuelTransaction?.transaction)throw new f.ServerError(f.Status.INVALID_ARGUMENT,"transaction can't be null");let e=t.data.fuelTransaction,r=[];for(let a of t.handlerIds){let s=this.handlers.transactionHandlers[a](e).catch(n=>{throw new f.ServerError(f.Status.INTERNAL,"error processing transaction: "+JSON.stringify(e.transaction)+`
|
|
4
|
-
`+O(n))});Y.execution.sequential&&await s,r.push(s)}return Z(await Promise.all(r))}async processBlock(t){if(!t.data?.fuelBlock?.block)throw new f.ServerError(f.Status.INVALID_ARGUMENT,"Block can't be empty");let e=t.data.fuelBlock,r=[];for(let a of t.handlerIds){let s=this.handlers.blockHandlers[a](e).catch(n=>{throw console.error("error processing block: ",n),new f.ServerError(f.Status.INTERNAL,"error processing block: "+e.block?.height+`
|
|
5
|
-
`+O(n))});Y.execution.sequential&&await s,r.push(s)}return Z(await Promise.all(r))}};kt.INSTANCE.register(new V);import("node:process").then(o=>o.stdout.write(""));import{ListStateStorage as Nt}from"@sentio/runtime";var G=class o extends Nt{static{i(this,"FuelProcessorTemplateProcessorState")}static INSTANCE=new o},ft=class{static{i(this,"FuelBaseProcessorTemplate")}id;binds=new Set;blockHandlers=[];logHandlers=[];transactionHandlers=[];constructor(){this.id=G.INSTANCE.getValues().length,G.INSTANCE.addValue(this)}bind(t,e){let r=x({address:t.address,chainId:e.chainId});if(this.binds.has(r)){console.log(`Same address can be bind to one template only once, ignore duplicate bind: ${r}`);return}this.binds.add(r);let a=this.bindInternal({...t,chainId:e.chainId});for(let n of this.logHandlers)a.onLog(n.logIdFilter,n.handler);for(let n of this.blockHandlers)a.onInterval(n.handler,n.timeIntervalInMinutes,n.blockInterval);for(let n of this.transactionHandlers)a.onTransaction(n.handler);let s={templateId:this.id,contract:{address:t.address,name:t.name||"",chainId:e.chainId,abi:""},startBlock:BigInt(t.startBlock||0),endBlock:BigInt(t.endBlock||0),baseLabels:{}};R.INSTANCE.addValue(s),e.update({states:{configUpdated:!0}})}onLog(t,e){return this.logHandlers.push({logIdFilter:t,handler:e}),this}onBlockInterval(t,e=1e3,r=4e3){return this.onInterval(t,void 0,{recentInterval:e,backfillInterval:r})}onTimeInterval(t,e=60,r=240){return this.onInterval(t,{recentInterval:e,backfillInterval:r},void 0)}onInterval(t,e,r){return this.blockHandlers.push({handler:t,timeIntervalInMinutes:e,blockInterval:r}),this}onTransaction(t,e=y){return this.transactionHandlers.push({handler:t,fetchConfig:e}),this}};import("node:process").then(o=>o.stdout.write(""));var pt=H(dt(),1);var gt=class extends k{static{i(this,"FuelAbstractProcessor")}constructor(t,e){return e||(e={chainId:pt.FuelChainId.FUEL_MAINNET,address:"*"}),super({...e,abi:t}),Q(e,this),b(this)}},mt=class{static{i(this,"TypedCall")}args;returnValue;argsObject;logs};import("node:process").then(o=>o.stdout.write(""));import("node:process").then(o=>o.stdout.write(""));export{h as a,Tt as b,bt as c,v as d,S as e,I as f,N as g,y as h,w as i,$ as j,z as k,k as l,x as m,pe as n,Q as o,_ as p,D as q,V as r,G as s,ft as t,gt as u,mt as v};
|
|
6
|
-
//# sourceMappingURL=chunk-ZSDI5U4B.js.map
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|