@sentio/sdk-bundle 2.57.5-rc.1 → 2.57.5
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-MG7ZXQKG.js → chunk-2AL4DHUZ.js} +2 -2
- package/lib/{chunk-TES4PH64.js → chunk-2YQIIWLW.js} +2 -2
- package/lib/{chunk-SXCFLYBR.js → chunk-3RA7MGJZ.js} +2 -2
- package/lib/{chunk-RZGU3HDK.js → chunk-AFT43SGS.js} +2 -2
- package/lib/{chunk-KGMUACX6.js → chunk-AH5F7424.js} +2 -2
- package/lib/{chunk-ZEJVKVIG.js → chunk-DDVYPPD6.js} +2 -2
- package/lib/chunk-FKVU72SD.js +5 -0
- package/lib/{chunk-HDJK2IBU.js.map → chunk-FKVU72SD.js.map} +1 -1
- package/lib/{chunk-5MVEMTGW.js → chunk-GY56IKIO.js} +2 -2
- package/lib/{chunk-ZLLPRHTT.js → chunk-KJEKGUSP.js} +2 -2
- package/lib/{chunk-7CU2Y4GL.js → chunk-LZ2L3BVP.js} +162 -162
- package/lib/{chunk-7CU2Y4GL.js.map → chunk-LZ2L3BVP.js.map} +1 -1
- package/lib/{chunk-2JUQFS3K.js → chunk-MXGFKFWL.js} +2 -2
- package/lib/{chunk-HZEHHGVF.js → chunk-NAIXLTAG.js} +2 -2
- package/lib/{chunk-LOGHBMQ3.js → chunk-OSGWCETR.js} +2 -2
- package/lib/{chunk-YQBJJIOU.js → chunk-QIPKYK5K.js} +2 -2
- package/lib/{chunk-X4PHIEDR.js → chunk-QXO44PWW.js} +2 -2
- package/lib/{chunk-WAW6A3ZN.js → chunk-T5ZWWDR3.js} +2 -2
- package/lib/{chunk-EM7YOUVQ.js → chunk-UUYHTLBU.js} +2 -2
- package/lib/{chunk-5LKDE7TR.js → chunk-WPZZ3ADX.js} +2 -2
- package/lib/chunk-Y2L3VTNW.js +6 -0
- package/lib/{chunk-RVXPSAPC.js.map → chunk-Y2L3VTNW.js.map} +1 -1
- package/lib/chunk-Z42TRMZO.js +3 -0
- package/lib/chunk-Z42TRMZO.js.map +1 -0
- package/lib/{chunk-AC2NWGAS.js → chunk-ZBVXDY4B.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 +3 -3
- package/lib/testing/index.js.map +1 -1
- package/lib/utils/index.js +1 -1
- package/package.json +2 -2
- package/lib/chunk-HDJK2IBU.js +0 -5
- package/lib/chunk-RVXPSAPC.js +0 -6
- /package/lib/{chunk-MG7ZXQKG.js.map → chunk-2AL4DHUZ.js.map} +0 -0
- /package/lib/{chunk-TES4PH64.js.map → chunk-2YQIIWLW.js.map} +0 -0
- /package/lib/{chunk-SXCFLYBR.js.map → chunk-3RA7MGJZ.js.map} +0 -0
- /package/lib/{chunk-RZGU3HDK.js.map → chunk-AFT43SGS.js.map} +0 -0
- /package/lib/{chunk-KGMUACX6.js.map → chunk-AH5F7424.js.map} +0 -0
- /package/lib/{chunk-ZEJVKVIG.js.map → chunk-DDVYPPD6.js.map} +0 -0
- /package/lib/{chunk-5MVEMTGW.js.map → chunk-GY56IKIO.js.map} +0 -0
- /package/lib/{chunk-ZLLPRHTT.js.map → chunk-KJEKGUSP.js.map} +0 -0
- /package/lib/{chunk-2JUQFS3K.js.map → chunk-MXGFKFWL.js.map} +0 -0
- /package/lib/{chunk-HZEHHGVF.js.map → chunk-NAIXLTAG.js.map} +0 -0
- /package/lib/{chunk-LOGHBMQ3.js.map → chunk-OSGWCETR.js.map} +0 -0
- /package/lib/{chunk-YQBJJIOU.js.map → chunk-QIPKYK5K.js.map} +0 -0
- /package/lib/{chunk-X4PHIEDR.js.map → chunk-QXO44PWW.js.map} +0 -0
- /package/lib/{chunk-WAW6A3ZN.js.map → chunk-T5ZWWDR3.js.map} +0 -0
- /package/lib/{chunk-EM7YOUVQ.js.map → chunk-UUYHTLBU.js.map} +0 -0
- /package/lib/{chunk-5LKDE7TR.js.map → chunk-WPZZ3ADX.js.map} +0 -0
- /package/lib/{chunk-AC2NWGAS.js.map → chunk-ZBVXDY4B.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-QXO44PWW.js";import"../chunk-T5ZWWDR3.js";import"../chunk-AH5F7424.js";import"../chunk-UUYHTLBU.js";import"../chunk-4WNGQ3EZ.js";import"../chunk-HRZJHNIM.js";import"../chunk-LZ2L3BVP.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.57.5
|
|
3
|
+
"version": "2.57.5",
|
|
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.57.5
|
|
50
|
+
"@sentio/runtime": "^2.57.5"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {},
|
|
53
53
|
"devDependencies": {},
|
package/lib/chunk-HDJK2IBU.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{C as f,Hd as B,Ma as P,Na as N,Pa as b,Qa as _,Ra as O,V,Xd as A,ne as l,re as F,we as H}from"./chunk-7CU2Y4GL.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-HDJK2IBU.js.map
|
package/lib/chunk-RVXPSAPC.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
|
|
2
|
-
import{a as g,b as T}from"./chunk-4WNGQ3EZ.js";import{a as le}from"./chunk-HRZJHNIM.js";import{Ac as A,Bc as te,Bd as K,C as b,Cc as B,Cd as re,Dc as j,Dd as ne,Ed as oe,Fd as se,Hb as M,Hd as ae,V as q,Xb as I,Xd as ie,Yb as J,re as ce,we as L,yc as ee,ye as W,zc as R}from"./chunk-7CU2Y4GL.js";import{a as c,f as w}from"./chunk-G5BIPHMS.js";import{errorString as O,GLOBAL_CONFIG as Y,mergeProcessResults as Z,Plugin as ye,PluginManager as ke,USER_PROCESSOR as Ne}from"@sentio/runtime";var m=w(ie(),1);import{MapStateStorage as Ce}from"@sentio/runtime";var C=class r extends Ce{static{c(this,"FuelProcessorState")}static INSTANCE=new r};import("node:process").then(r=>r.stdout.write(""));var $=w(le(),1);import{Endpoints as Ie}from"@sentio/runtime";var Te={MAIN_NET:$.FuelChainId.FUEL_MAINNET,TEST_NET:$.FuelChainId.FUEL_TESTNET};function Pe(r){switch(r){case Te.TEST_NET:return"https://testnet.fuel.network/v1/graphql"}return"https://mainnet.fuel.network/v1/graphql"}c(Pe,"getRpcEndpoint");function H(r){let e=Ie.INSTANCE.chainServer.get(r);return e||(e=Pe(r)),oe.create(e)}c(H,"getProvider");import("node:process").then(r=>r.stdout.write(""));var S=class{constructor(e,t,n,a,s){this.args=a;this.logs=s}static{c(this,"FuelCall")}},P=class extends ce{constructor(t,n,a,s,o,i){super({});this.chainId=t;this.contractAddress=n;this.contractName=a;this.timestamp=s;this.transaction=o;this.block=i}static{c(this,"FuelContext")}logIndex=-1;getChainId(){return this.chainId}setLogIndex(t){this.logIndex=t}getMetaDataInternal(t,n){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:t,logIndex:this.logIndex,labels:ae(n)}}},y=class extends P{constructor(t,n,a,s,o,i,l){super(t,a,s,o,i,l);this.chainId=t;this.contract=n;this.contractAddress=a;this.contractName=s;this.timestamp=o;this.transaction=i;this.block=l}static{c(this,"FuelContractContext")}get provider(){return this.contract.provider}};import("node:process").then(r=>r.stdout.write(""));var k={includeFailed:!1};function de(r,e){for(let t of r||[])if(t.type==A.Coin&&t.assetId==e)return t.owner}c(de,"findSenderFromInputs");function N(r,e){let t=J(r.rawPayload),n=r?.status.receipts?.map(K)||[],[a]=new j().decode(t,0),{gasCosts:s,feeParameters:o,txParameters:i,baseAssetId:l}=e.getChain().consensusParameters,d=r.status?.block?.header?.height,{gasPriceFactor:u,gasPerByte:p}=o,{maxInputs:F,maxGasPerTx:h}=i,f={type:r.status?.__typename,...r.status};return{...re({id:r.id,receipts:n,transaction:a,transactionBytes:t,gqlTransactionStatus:f,gasPerByte:I(p),gasPriceFactor:I(u),maxInputs:F,gasCosts:s,gasPrice:I(r.gasPrice),maxGasPerTx:h,baseAssetId:l}),blockNumber:d,sender:de(a.inputs,l)}}c(N,"decodeFuelTransaction");function z(r,e){if(r&&(r.type===B.LogData||r.type===B.Log)){let t=new R(e),n=r.type===B.Log?new ee("u64").encode(r.val0):r.data,a=r.val1.toString(),[s]=t.decodeLog(n,a);return{logId:a,data:s}}return null}c(z,"decodeLog");async function Q(r,e,t){let n=J(r.rawPayload),[a]=new j().decode(n,0),s=r?.status.receipts?.map(K)||[],o={type:r.status?.__typename,...r.status},i=o?.block?.header?.height,l=Object.values(e)[0],d=[];s.forEach((F,h)=>{try{let f=z(F,l);f&&d.push({...f,receiptIndex:h})}catch(f){console.warn("Failed to decode log",f)}});let u=new ne(r.status.transactionId,t,{main:Object.values(e)[0],otherContractsAbis:{}});return u.gqlTransaction={...r,status:o},{...await u.getTransactionSummary(),blockNumber:i,logs:d,sender:de(a.inputs,t.getChain().consensusParameters.baseAssetId)}}c(Q,"decodeFuelTransactionWithAbi");import("node:process").then(r=>r.stdout.write(""));var E=w(ie(),1);var v=class r{constructor(e){this.config=e;return T(this)}static{c(this,"FuelProcessor")}txHandlers=[];blockHandlers=[];receiptHandlers=[];provider;contract;static bind(e){let t=new r(e);return be(e,t),t}latestGasPrice;async configure(){this.provider=await H(this.config.chainId),this.provider.getLatestGasPrice=async()=>{if(this.latestGasPrice)return I(this.latestGasPrice);let{latestGasPrice:e}=await this.provider.operations.getLatestGasPrice();return this.latestGasPrice=e?.gasPrice,I(e.gasPrice)},this.contract=new se(this.config.address,this.config.abi,this.provider)}onTransaction(e,t=k,n=g()){let a={handlerName:n,handler:c(async s=>{let o=this.config.abi?{[this.config.address]:this.config.abi}:{},i=await Q(s.transaction,o,this.provider),l=new y(this.config.chainId,this.contract,this.config.address,this.config.name??this.config.address,s.timestamp||new Date(0),i,null);return await e(i,l),l.stopAndGetResult()},"handler"),fetchConfig:{filters:[],...t}};return this.txHandlers.push(a),this}onCall(e,t,n=k){let a=new Set(Array.isArray(e)?e:[e]);if(!this.config.abi)throw new Error("ABI must be provided to use onCall");let s=this.config.abi,o={},i=new R(s);for(let d of a)try{let u=i.functions[d],p=I(u.selector,"hex").toString();o[u.name]={function:p,includeFailed:!!n.includeFailed}}catch(u){console.error(u)}let l={handlerName:g(),handler:c(async d=>{try{let u=d.transaction,p=await Q(u,{[this.config.address]:s},this.provider),F=new P(this.config.chainId,this.config.address,this.config.name??this.config.address,d.timestamp||new Date(0),p,null);for(let h of p.operations)for(let f of h.calls||[])if(a.has(f.functionName)){let U=this.contract.functions[f.functionName],he=Object.values(f.argumentsProvided||{}),ge=U(...he),Fe=new S(ge,p,!1,f.argumentsProvided,p.logs);await t(Fe,F)}return F.stopAndGetResult()}catch(u){return console.error(u),{gauges:[],counters:[],events:[],exports:[],states:{configUpdated:!1}}}},"handler"),fetchConfig:{filters:Object.values(o)}};return this.txHandlers.push(l),this}onLog(e,t,n=g()){let a=new Set(Array.isArray(e)?e:[e]),s={handlerName:n,handler:c(async({transaction:o,receiptIndex:i,timestamp:l})=>{try{let d=N(o,this.provider),u=Number(i),p=d.receipts[u],F=z(p,this.config.abi);if(F){let h=new y(this.config.chainId,this.contract,this.config.address,this.config.name??this.config.address,l||new Date(0),d,null);return h.setLogIndex(u),await t({receiptIndex:u,...F},h),h.stopAndGetResult()}else console.error(`Log with receipt index ${i} not found in tx`)}catch(d){console.error(d)}return M.fromPartial({})},"handler"),receiptConfig:{log:{logIds:Array.from(a)}}};return this.receiptHandlers.push(s),this}onTransfer(e,t){let{from:n,to:a,assetId:s}=e,o={handlerName:g(),handler:c(async({transaction:i,receiptIndex:l,timestamp:d})=>{try{let u=N(i,this.provider),p=Number(l),F=u.receipts[p],h=new y(this.config.chainId,this.contract,this.config.address,this.config.name??this.config.address,d||new Date(0),u,null);h.setLogIndex(p),await t(F,h)}catch(u){console.error(u)}return M.fromPartial({})},"handler"),receiptConfig:{transfer:{from:n,to:a,assetId:s}}};return this.receiptHandlers.push(o),this}onInterval(e,t,n,a=g()){t&&t.backfillInterval<t.recentInterval&&(t.backfillInterval=t.recentInterval);let s=this;return this.blockHandlers.push({blockInterval:n,timeIntervalInMinutes:t,handlerName:a,handler:c(async function(o){let i=o.block;if(!i)throw new E.ServerError(E.Status.INVALID_ARGUMENT,"Block is empty");let l={id:i.id,height:I(i.height),time:i.time,header:{applicationHash:i.applicationHash,daHeight:I(i.daHeight),eventInboxRoot:i.eventInboxRoot,messageOutboxRoot:i.messageOutboxRoot,prevRoot:i.prevRoot,stateTransitionBytecodeVersion:i.stateTransitionBytecodeVersion,transactionsCount:i.transactionsCount,transactionsRoot:i.transactionsRoot}},d=new y(s.config.chainId,s.contract,s.config.address,s.config.name??s.config.address,o.timestamp||new Date(0),null,l);return await e(l,d),d.stopAndGetResult()},"handler")}),this}onBlockInterval(e,t=250,n=1e3){return this.onInterval(e,void 0,{recentInterval:t,backfillInterval:n})}onTimeInterval(e,t=60,n=240){return this.onInterval(e,{recentInterval:t,backfillInterval:n},void 0)}};function x(r){let e=[r.address];return r.chainId&&e.push(r.chainId),r.name&&e.push(r.name),r.startBlock&&e.push(r.startBlock.toString()),r.endBlock&&e.push(r.endBlock.toString()),e.join("_")}c(x,"getOptionsSignature");function Ct(r){let e=x(r);return C.INSTANCE.getValue(e)}c(Ct,"getFuelProcessor");function be(r,e){let t=x(r);C.INSTANCE.getOrSetValue(t,e)}c(be,"addFuelProcessor");import("node:process").then(r=>r.stdout.write(""));var _=class r{constructor(e){this.config=e;return T(this)}static{c(this,"FuelAssetProcessor")}txHandlers=[];blockHandlers=[];provider;static bind(e){let t=new r(e),n="assets_"+x({...e,address:"*"});return C.INSTANCE.getOrSetValue(n,t),t}async configure(){this.provider=await H(this.config.chainId)}onTransfer(e,t){let n=[],a=X(e.assetId),s=X(e.from),o=X(e.to);for(let l of a)for(let d of s)for(let u of o)n.push({assetId:l,fromAddress:d,toAddress:u});let i={handlerName:g(),handler:c(async l=>{let d=l.transaction,u=N(d,this.provider),p={from:[],to:[]};for(let f of u.transaction.inputs||[])f.type==A.Coin&&p.from.push({address:f.owner,assetId:f.assetId,amount:BigInt(f.amount.toString(10))});for(let f of u.transaction.outputs||[])if(f.type==te.Coin){let U=f.amount.toString(10);p.to.push({address:f.to,amount:BigInt(U),assetId:f.assetId})}let F=p.from[0].assetId||"",h=new P(this.config.chainId,F,this.config.name??"",l.timestamp||new Date(0),u,null);return await t(p,h),h.stopAndGetResult()},"handler"),assetConfig:{filters:n}};return this.txHandlers.push(i),this}};function X(r){return r?Array.isArray(r)?r.length>0?r:[void 0]:[r]:[void 0]}c(X,"arrayify");import("node:process").then(r=>r.stdout.write(""));import{mergeProcessResults as xe}from"@sentio/runtime";var D=class r{constructor(e){this.config=e;return T(this)}static{c(this,"FuelGlobalProcessor")}txHandlers=[];blockHandlers=[];provider;static bind(e){let t=new r(e),n="global_"+x({...e,address:W});return C.INSTANCE.getOrSetValue(n,t),t}async configure(){this.provider=await H(this.config.chainId)}onTransaction(e,t=k){let n={handlerName:g(),handler:c(async a=>{let s;try{s=N(a.transaction,this.provider)}catch(i){return console.error("error decoding transaction",i),xe([])}let o=new P(this.config.chainId,W,this.config.name??"*",a.timestamp||new Date(0),s,null);return await e(s,o),o.stopAndGetResult()},"handler"),fetchConfig:{filters:[],...t}};return this.txHandlers.push(n),this}};import("node:process").then(r=>r.stdout.write(""));var V=class extends ye{static{c(this,"FuelPlugin")}name="FuelPlugin";handlers={transactionHandlers:[],blockHandlers:[],receiptHandlers:[]};async configure(e){let t={transactionHandlers:[],blockHandlers:[],receiptHandlers:[]};for(let n of C.INSTANCE.getValues()){let a=n.config,s=q.fromPartial({processorType:Ne,contract:{name:a.name,chainId:a.chainId.toString(),address:a.address||"*",abi:""},startBlock:a.startBlock,endBlock:a.endBlock});for(let o of n.txHandlers){let i=t.transactionHandlers.push(o.handler)-1,l=o.handlerName;if(n instanceof v){let d={handlerId:i,handlerName:l};s.fuelTransactionConfigs.push(d)}else if(n instanceof _){let d=o.assetConfig;s.assetConfigs.push({filters:d?.filters||[],handlerId:i,handlerName:l})}else if(n instanceof D){let d={handlerId:i,handlerName:l,filters:[]};s.fuelTransactionConfigs.push(d),s.contract.address="*"}}for(let o of n.receiptHandlers??[]){let i=t.receiptHandlers.push(o.handler)-1,l=o.handlerName;n instanceof v&&s.fuelReceiptConfigs.push({...o.receiptConfig,handlerId:i,handlerName:l})}for(let o of n.blockHandlers){let i=t.blockHandlers.push(o.handler)-1;s.intervalConfigs.push({slot:0,slotInterval:o.blockInterval,minutes:0,minutesInterval:o.timeIntervalInMinutes,handlerId:i,handlerName:o.handlerName,fetchConfig:void 0})}e.contractConfigs.push(s)}this.handlers=t}supportedHandlers=[b.FUEL_TRANSACTION,b.FUEL_RECEIPT,b.FUEL_CALL,b.FUEL_BLOCK];processBinding(e){switch(e.handlerType){case b.FUEL_TRANSACTION:return this.processTransaction(e);case b.FUEL_RECEIPT:return this.processReceipt(e);case b.FUEL_BLOCK:return this.processBlock(e);default:throw new m.ServerError(m.Status.INVALID_ARGUMENT,"No handle type registered "+e.handlerType)}}async start(e){try{for(let t of C.INSTANCE.getValues())await t.configure()}catch(t){throw new m.ServerError(m.Status.INTERNAL,"error starting FuelPlugin: "+O(t))}}stateDiff(e){return L.INSTANCE.getValues().length!==e.templateInstances.length}async processReceipt(e){let t=e?.data?.fuelLog;if(!t?.transaction)throw new m.ServerError(m.Status.INVALID_ARGUMENT,"transaction can't be null");let n=[];for(let a of e.handlerIds){let s=this.handlers.receiptHandlers[a](t).catch(o=>{throw new m.ServerError(m.Status.INTERNAL,"error processing transaction: "+JSON.stringify(t)+`
|
|
3
|
-
`+O(o))});Y.execution.sequential&&await s,n.push(s)}return Z(await Promise.all(n))}async processTransaction(e){if(!e.data?.fuelTransaction?.transaction)throw new m.ServerError(m.Status.INVALID_ARGUMENT,"transaction can't be null");let t=e.data.fuelTransaction,n=[];for(let a of e.handlerIds){let s=this.handlers.transactionHandlers[a](t).catch(o=>{throw new m.ServerError(m.Status.INTERNAL,"error processing transaction: "+JSON.stringify(t.transaction)+`
|
|
4
|
-
`+O(o))});Y.execution.sequential&&await s,n.push(s)}return Z(await Promise.all(n))}async processBlock(e){if(!e.data?.fuelBlock?.block)throw new m.ServerError(m.Status.INVALID_ARGUMENT,"Block can't be empty");let t=e.data.fuelBlock,n=[];for(let a of e.handlerIds){let s=this.handlers.blockHandlers[a](t).catch(o=>{throw console.error("error processing block: ",o),new m.ServerError(m.Status.INTERNAL,"error processing block: "+t.block?.height+`
|
|
5
|
-
`+O(o))});Y.execution.sequential&&await s,n.push(s)}return Z(await Promise.all(n))}};ke.INSTANCE.register(new V);import("node:process").then(r=>r.stdout.write(""));import{ListStateStorage as ve}from"@sentio/runtime";var G=class r extends ve{static{c(this,"FuelProcessorTemplateProcessorState")}static INSTANCE=new r},ue=class{static{c(this,"FuelBaseProcessorTemplate")}id;binds=new Set;blockHandlers=[];logHandlers=[];transactionHandlers=[];constructor(){return this.id=G.INSTANCE.getValues().length,G.INSTANCE.addValue(this),T(this)}bind(e,t){let n=x({address:e.address,chainId:t.chainId});if(this.binds.has(n)){console.log(`Same address can be bind to one template only once, ignore duplicate bind: ${n}`);return}this.binds.add(n);let a=this.bindInternal({...e,chainId:t.chainId});for(let o of this.logHandlers)a.onLog(o.logIdFilter,o.handler,o.handlerName);for(let o of this.blockHandlers)a.onInterval(o.handler,o.timeIntervalInMinutes,o.blockInterval,o.handlerName);for(let o of this.transactionHandlers)a.onTransaction(o.handler,void 0,o.handlerName);let s={templateId:this.id,contract:{address:e.address,name:e.name||"",chainId:t.chainId,abi:""},startBlock:BigInt(e.startBlock||0),endBlock:BigInt(e.endBlock||0),baseLabels:{}};L.INSTANCE.addValue(s),t.update({states:{configUpdated:!0}})}onLog(e,t){return this.logHandlers.push({logIdFilter:e,handlerName:g(),handler:t}),this}onBlockInterval(e,t=1e3,n=4e3){return this.onInterval(e,void 0,{recentInterval:t,backfillInterval:n})}onTimeInterval(e,t=60,n=240){return this.onInterval(e,{recentInterval:t,backfillInterval:n},void 0)}onInterval(e,t,n){return this.blockHandlers.push({handlerName:g(),handler:e,timeIntervalInMinutes:t,blockInterval:n}),this}onTransaction(e,t=k){return this.transactionHandlers.push({handlerName:g(),handler:e,fetchConfig:t}),this}};import("node:process").then(r=>r.stdout.write(""));var me=w(le(),1);var fe=class extends v{static{c(this,"FuelAbstractProcessor")}constructor(e,t){return t||(t={chainId:me.FuelChainId.FUEL_MAINNET,address:"*"}),super({...t,abi:e}),T(this)}},pe=class{static{c(this,"TypedCall")}args;returnValue;argsObject;logs};import("node:process").then(r=>r.stdout.write(""));import("node:process").then(r=>r.stdout.write(""));export{C as a,Te as b,Pe as c,H as d,S as e,P as f,y as g,k as h,N as i,z as j,Q as k,v as l,x as m,Ct as n,be as o,_ as p,D as q,V as r,G as s,ue as t,fe as u,pe as v};
|
|
6
|
-
//# sourceMappingURL=chunk-RVXPSAPC.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
|