@sentio/sdk-bundle 2.49.2 → 2.49.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/testing/index.js +1 -1
- package/package.json +2 -2
package/lib/testing/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as createRequireSdkShim } from 'module'; const require = createRequireSdkShim(import.meta.url);
|
|
2
|
-
import{t as x}from"../chunk-24EQKYEL.js";import{f as p}from"../chunk-3OS5XSGT.js";import{a as C}from"../chunk-MYR3NRWN.js";import"../chunk-YJXEXFFA.js";import"../chunk-TSEQGMTN.js";import"../chunk-J7Z2TKQE.js";import{b as _}from"../chunk-ZVWAZYZA.js";import"../chunk-VVLKTQXI.js";import"../chunk-FKQAFH4F.js";import"../chunk-RZH6P3BV.js";import"../chunk-3ZECQKG5.js";import{b as F}from"../chunk-Q5GEU4JH.js";import{a as M,d as g,n as I}from"../chunk-MCICASJD.js";import"../chunk-BKL3I6N3.js";import"../chunk-RQ5L7SUN.js";import"../chunk-SUCYR7EB.js";import{a as T}from"../chunk-KMBS637G.js";import{D as c}from"../chunk-BBD4HNM4.js";import{a as D}from"../chunk-RA75ESSD.js";import{a,f as m}from"../chunk-G5BIPHMS.js";var V=m(T(),1);import{Endpoints as G,ProcessorServiceImpl as j,State as K}from"@sentio/runtime";var v=class{static{a(this,"AptosFacet")}server;constructor(t){this.server=t}testEntryFunctionCall(t,e=C.MAIN_NET){return this.testEntryFunctionCalls([t],e)}testEntryFunctionCalls(t,e=C.MAIN_NET){let n=[];for(let r of t){let o=this.buildEntryFunctionCallBinding(r,e);if(!o)throw Error("Invalid test transaction: "+JSON.stringify(r));n.push(o)}return this.server.processBindings({bindings:n})}buildEntryFunctionCallBinding(t,e=C.MAIN_NET){let n=t.payload;for(let r of this.server.contractConfigs)if(r.contract?.chainId===e){for(let o of r.moveCallConfigs)for(let i of o.filters)if(g(r.contract.address)+"::"+i.function===n.function)return{data:{aptCall:{rawTransaction:"",transaction:t}},handlerIds:[o.handlerId],handlerType:c.APT_CALL}}}testEvent(t,e=C.MAIN_NET){let n=this.buildEventBinding(t,e);if(!n)throw Error("Invalid test event: "+JSON.stringify(t));return this.server.processBinding(n)}buildEventBinding(t,e=C.MAIN_NET){for(let n of this.server.contractConfigs)if(n.contract?.chainId===e){for(let r of n.moveEventConfigs)for(let o of r.filters)for(let i of t.events)if(g(n.contract.address)+"::"+o.type===I(i.type).qname)return{data:{aptEvent:{rawTransaction:"",transaction:t}},handlerIds:[r.handlerId],handlerType:c.APT_EVENT}}}};import("node:process").then(s=>s.stdout.write(""));var B=class{static{a(this,"SolanaFacet")}server;constructor(t){this.server=t}testInstructions(t){return this.server.processBindings({bindings:t.map(e=>({data:{raw:new Uint8Array,solInstruction:e},handlerIds:[],handlerType:c.SOL_INSTRUCTION}))})}};import("node:process").then(s=>s.stdout.write(""));var l=m(T(),1);var S=class{static{a(this,"EthFacet")}server;constructor(t){this.server=t}testTrace(t,e=l.EthChainId.ETHEREUM){return this.testTraces([t],e)}testTraces(t,e=l.EthChainId.ETHEREUM){let n=[];for(let r of t){let o=this.buildTraceBinding(r,e);if(!o)throw Error("Invalid test trace: "+JSON.stringify(r));n.push(o)}return this.server.processBindings({bindings:n})}buildTraceBinding(t,e=l.EthChainId.ETHEREUM){if(t.type!=="call"||!t.action.input)throw Error("Invalid test trace: "+JSON.stringify(t));let n=t.action.input.slice(0,10);for(let r of this.server.contractConfigs)if(r.contract?.chainId===e&&!(t.action.to?.toLowerCase()!==r.contract?.address.toLowerCase()&&r.contract?.address!=="*")){for(let o of r.traceConfigs)if(o.signature==n)return{data:{ethTrace:{trace:t,timestamp:new Date}},handlerIds:[o.handlerId],handlerType:c.ETH_TRACE}}}testLog(t,e=l.EthChainId.ETHEREUM){return this.testLogs([t],e)}testLogs(t,e=l.EthChainId.ETHEREUM){let n=[];for(let r of t){let o=this.buildLogBinding(r,e);if(!o)throw Error("Invalid test log: "+JSON.stringify(r));n.push(o)}return this.server.processBindings({bindings:n})}buildLogBinding(t,e=l.EthChainId.ETHEREUM){for(let n of this.server.contractConfigs)if(n.contract?.chainId===e&&!(t.address.toLowerCase()!==n.contract?.address.toLowerCase()&&n.contract?.address!=="*"))for(let r of n.logConfigs)for(let o of r.filters){let i=!0;for(let d in o.topics){let f=t.topics[d],u=o.topics[d].hashes;if(u.length!==0&&!u.find(h=>h.toLowerCase()===f.toLowerCase())){i=!1;break}}if(i)return{data:{ethLog:{log:t,timestamp:new Date}},handlerIds:[r.handlerId],handlerType:c.ETH_LOG}}}testAccountLog(t,e,n=l.EthChainId.ETHEREUM){return this.testAccountLogs(t,[e],n)}testAccountLogs(t,e,n=l.EthChainId.ETHEREUM){let r=[];for(let o of e){let i=this.buildAccountLogBinding(t,o,n);if(!i)throw Error("Invalid test log: "+JSON.stringify(o));r.push(i)}return this.server.processBindings({bindings:r})}buildAccountLogBinding(t,e,n=l.EthChainId.ETHEREUM){for(let r of this.server.accountConfigs)if(r.chainId===n&&t.toLowerCase()===r.address.toLowerCase())for(let o of r.logConfigs)for(let i of o.filters){let d=!0;for(let f in i.topics){let u=e.topics[f],h=i.topics[f].hashes;if(h.length!==0&&!h.find(R=>R.toLowerCase()===u.toLowerCase())){d=!1;break}}if(d)return{data:{ethLog:{log:e,timestamp:new Date}},handlerIds:[o.handlerId],handlerType:c.ETH_LOG}}}testBlock(t,e=l.EthChainId.ETHEREUM){return this.testBlocks([t],e)}testBlocks(t,e=l.EthChainId.ETHEREUM){let n=[];for(let r of t){let o=this.buildBlockBinding(r,e);if(!o)throw Error("Invalid test block: "+JSON.stringify(r));n.push(o)}return this.server.processBindings({bindings:n})}buildBlockBinding(t,e=l.EthChainId.ETHEREUM){let n={data:{ethBlock:{block:t}},handlerType:c.ETH_BLOCK,handlerIds:[]};for(let r of this.server.contractConfigs){if(r.contract?.chainId!==e)continue;let o=t.number;if(!(o<r.startBlock)&&!(r.endBlock!==0n&&o>=r.endBlock))for(let i of r.intervalConfigs)n.handlerIds.push(i.handlerId)}return n}};import("node:process").then(s=>s.stdout.write(""));var N=class{static{a(this,"SuiFacet")}server;constructor(t){this.server=t}testEntryFunctionCall(t,e=p.MAIN_NET){return this.testEntryFunctionCalls([t],e)}testEntryFunctionCalls(t,e=p.MAIN_NET){let n=[];for(let r of t){let o=this.buildEntryFunctionCallBinding(r,e);if(!o)throw Error("Invalid test transaction: "+JSON.stringify(r));n.push(o)}return this.server.processBindings({bindings:n})}buildEntryFunctionCallBinding(t,e=p.MAIN_NET){let n=x(t);for(let r of n){let o=[g(r.package),r.module,r.function].join(M);for(let i of this.server.contractConfigs)if(i.contract?.chainId===e){for(let d of i.moveCallConfigs)for(let f of d.filters)if(g(i.contract.address)+"::"+f.function===o)return{data:{suiCall:{transaction:t,timestamp:new Date,slot:10000n}},handlerIds:[d.handlerId],handlerType:c.SUI_CALL}}}}testEvent(t,e=p.MAIN_NET){let n=this.buildEventBinding(t,e);if(!n)throw Error("Invalid test event: "+JSON.stringify(t));return this.server.processBinding(n)}testGlobalTransaction(t,e=p.MAIN_NET){let n=[];for(let o of this.server.contractConfigs)if(o.contract?.address==="*")for(let i of o.moveCallConfigs)i.filters.length===1&&i.filters[0].function===""&&n.push(i.handlerId);if(n.length===0)throw Error("Invalid test global transaction: "+JSON.stringify(t));let r={handlerIds:n,handlerType:c.SUI_CALL,data:{suiCall:{transaction:t,timestamp:t.timestampMs?new Date(t.timestampMs):new Date,slot:BigInt(t.checkpoint||0)}}};return this.server.processBinding(r)}buildEventBinding(t,e=p.MAIN_NET){for(let n of this.server.contractConfigs)if(n.contract?.chainId===e){for(let r of n.moveEventConfigs)for(let o of r.filters)for(let i of t.events||[])if(g(n.contract.address)+"::"+o.type===I(i.type).qname)return{data:{suiEvent:{transaction:t,timestamp:new Date(t.timestampMs||0),slot:10000n}},handlerIds:[r.handlerId],handlerType:c.SUI_EVENT}}}};import("node:process").then(s=>s.stdout.write(""));var P=class{static{a(this,"FuelFacet")}server;constructor(t){this.server=t}testOnTransaction(t,e=F.TEST_NET){let n=this.buildBinding(t,e);if(!n)throw Error("Invalid test transaction: "+JSON.stringify(t));return this.server.processBindings({bindings:n})}buildBinding(t,e){let n=[];for(let r of this.server.contractConfigs)if(r.contract?.chainId===e){for(let o of r.fuelCallConfigs){let i={data:{fuelCall:{transaction:t,timestamp:new Date}},handlerIds:[o.handlerId],handlerType:c.FUEL_CALL},d=o.filters[0]?.function;if(d)for(let f of t.status.receipts||[])f.receiptType=="CALL"&&f.param1==d&&n.push(i);else n.push(i)}for(let o of r.fuelLogConfigs){let i={data:{fuelCall:{transaction:t,timestamp:new Date}},handlerIds:[o.handlerId],handlerType:c.FUEL_CALL},d=o.logIds;for(let f of t.status.receipts||[])if((f.receiptType=="LOG"||f.receiptType=="LOG_DATA")&&d.includes(f.rb)){n.push(i);break}}for(let o of r.assetConfigs){let i={data:{fuelCall:{transaction:t,timestamp:new Date}},handlerIds:[o.handlerId],handlerType:c.FUEL_CALL};n.push(i)}}return n}};import("node:process").then(s=>s.stdout.write(""));var k=m(T(),1);var O={INJECTIVE_MAINNET:k.CosmosChainId.INJECTIVE_MAINNET,INJECTIVE_TESTNET:k.CosmosChainId.INJECTIVE_TESTNET};import("node:process").then(s=>s.stdout.write(""));var y=class{static{a(this,"CosmosFacet")}server;constructor(t){this.server=t}testOnTransaction(t,e=O.INJECTIVE_TESTNET){let n=this.buildBinding(t,e);if(!n)throw Error("Invalid test transaction: "+JSON.stringify(t));return this.server.processBindings({bindings:n})}buildBinding(t,e){let n=[];for(let r of this.server.contractConfigs)if(r.contract?.chainId===e)for(let o of r.cosmosLogConfigs){let i={data:{cosmosCall:{transaction:t,timestamp:new Date}},handlerIds:[o.handlerId],handlerType:c.COSMOS_CALL},d=o.logFilters;for(let f of t.logs||[])if(f.events.find(u=>d.includes(u.type))){n.push(i);break}}return n}};import("node:process").then(s=>s.stdout.write(""));var H=m(T(),1);var b=class{static{a(this,"StarknetFacet")}server;constructor(t){this.server=t}testOnEvents(t,e=H.StarknetChainId.STARKNET_SEPOLIA){let n=this.buildBinding(t,e);if(!n)throw Error("Invalid test : "+JSON.stringify(t));return this.server.processBindings({bindings:n})}buildBinding(t,e){let n=[],r=Array.isArray(t)?t:[t];for(let o of r)for(let i of this.server.contractConfigs)if(i.contract?.chainId===e)for(let d of i.starknetEventConfigs){let f={data:{starknetEvents:{result:o,timestamp:new Date}},handlerIds:[d.handlerId],handlerType:c.STARKNET_EVENT},u=d.filters,h=o.keys;for(let R of h)for(let q of u)if(q.keys.includes(R))return n.push(f),n}return n}};import("node:process").then(s=>s.stdout.write(""));var U=m(T(),1);var w=class{static{a(this,"BTCFacet")}server;constructor(t){this.server=t}testOnTransactions(t,e=U.BTCChainId.BTC_TESTNET){let n=this.buildBinding(t,e);if(!n)throw Error("Invalid test : "+JSON.stringify(t));return this.server.processBindings({bindings:n})}buildBinding(t,e){let n=[];for(let r of this.server.contractConfigs)if(r.contract?.chainId===e)for(let o of r.btcTransactionConfigs){let i={data:{btcTransaction:t},handlerIds:[o.handlerId],handlerType:c.BTC_TRANSACTION};n.push(i)}return n}};import("node:process").then(s=>s.stdout.write(""));var E={};function X(){K.reset()}a(X,"cleanTest");var A=class{static{a(this,"TestProcessorServer")}service;contractConfigs;accountConfigs;aptos;eth;solana;sui;fuel;cosmos;starknet;btc;constructor(t,e={}){X(),this.service=new j(t),this.aptos=new v(this),this.solana=new B(this),this.eth=new S(this),this.sui=new N(this),this.fuel=new P(this),this.cosmos=new y(this),this.starknet=new b(this),this.btc=new w(this);for(let n in V.CHAIN_MAP){let r=e[n]||"";G.INSTANCE.chainServer.set(n,r)}}async start(t={templateInstances:[]},e=E){let n=await this.service.start(t,e),r=await this.getConfig({});return this.contractConfigs=r.contractConfigs,this.accountConfigs=r.accountConfigs,n}stop(t,e=E){return this.service.stop(t,e)}getConfig(t,e=E){return this.service.getConfig(t,e)}processBindings(t,e=E){return this.service.processBindings(t,e)}processBinding(t,e=E){return this.service.processBindings({bindings:[t]},e)}processBindingsStream(t,e){throw new Error("Method not implemented.")}preprocessBindingsStream(t,e){throw new Error("Method not implemented.")}};import("node:process").then(s=>s.stdout.write(""));function L(s){if(s!==void 0){if(s.doubleValue!==void 0)return s.doubleValue;if(s.bigInteger!==void 0){let t=_(s.bigInteger.data);return s.bigInteger.negative&&(t=-t),t}if(s.bigDecimal!==void 0)return new D(s.bigDecimal)}}a(L,"MetricValueToNumber");function z(s,t){if(s){for(let e of s.counters)if(e.metadata?.name===t)return L(e.metricValue)}}a(z,"firstCounterValue");function Q(s,t){if(s){for(let e of s.gauges)if(e.metadata?.name===t)return L(e.metricValue)}}a(Q,"firstGaugeValue");import("node:process").then(s=>s.stdout.write(""));var J=m(T(),1);import{Endpoints as W}from"@sentio/runtime";function Y(s){let t=[];Array.isArray(s)||(s=[s]);for(let e of Object.keys(J.CHAIN_MAP)){let n="TEST_ENDPOINT_"+e,r=process.env[n];r&&(t.push(e),W.INSTANCE.chainServer.set(e,r))}for(let e of s)if(!t.includes(e))return!1;return!0}a(Y,"loadTestProvidersFromEnv");import("node:process").then(s=>s.stdout.write(""));import("node:process").then(s=>s.stdout.write(""));export{L as MetricValueToNumber,A as TestProcessorServer,z as firstCounterValue,Q as firstGaugeValue,Y as loadTestProvidersFromEnv};
|
|
2
|
+
import{t as x}from"../chunk-24EQKYEL.js";import{f as p}from"../chunk-3OS5XSGT.js";import{a as C}from"../chunk-MYR3NRWN.js";import"../chunk-YJXEXFFA.js";import"../chunk-TSEQGMTN.js";import"../chunk-J7Z2TKQE.js";import{b as _}from"../chunk-ZVWAZYZA.js";import"../chunk-VVLKTQXI.js";import"../chunk-FKQAFH4F.js";import"../chunk-RZH6P3BV.js";import{b as F}from"../chunk-Q5GEU4JH.js";import"../chunk-3ZECQKG5.js";import{a as M,d as g,n as I}from"../chunk-MCICASJD.js";import"../chunk-BKL3I6N3.js";import"../chunk-RQ5L7SUN.js";import"../chunk-SUCYR7EB.js";import{a as T}from"../chunk-KMBS637G.js";import{D as c}from"../chunk-BBD4HNM4.js";import{a as D}from"../chunk-RA75ESSD.js";import{a,f as m}from"../chunk-G5BIPHMS.js";var V=m(T(),1);import{Endpoints as G,ProcessorServiceImpl as j,State as K}from"@sentio/runtime";var v=class{static{a(this,"AptosFacet")}server;constructor(t){this.server=t}testEntryFunctionCall(t,e=C.MAIN_NET){return this.testEntryFunctionCalls([t],e)}testEntryFunctionCalls(t,e=C.MAIN_NET){let n=[];for(let r of t){let o=this.buildEntryFunctionCallBinding(r,e);if(!o)throw Error("Invalid test transaction: "+JSON.stringify(r));n.push(o)}return this.server.processBindings({bindings:n})}buildEntryFunctionCallBinding(t,e=C.MAIN_NET){let n=t.payload;for(let r of this.server.contractConfigs)if(r.contract?.chainId===e){for(let o of r.moveCallConfigs)for(let i of o.filters)if(g(r.contract.address)+"::"+i.function===n.function)return{data:{aptCall:{rawTransaction:"",transaction:t}},handlerIds:[o.handlerId],handlerType:c.APT_CALL}}}testEvent(t,e=C.MAIN_NET){let n=this.buildEventBinding(t,e);if(!n)throw Error("Invalid test event: "+JSON.stringify(t));return this.server.processBinding(n)}buildEventBinding(t,e=C.MAIN_NET){for(let n of this.server.contractConfigs)if(n.contract?.chainId===e){for(let r of n.moveEventConfigs)for(let o of r.filters)for(let i of t.events)if(g(n.contract.address)+"::"+o.type===I(i.type).qname)return{data:{aptEvent:{rawTransaction:"",transaction:t}},handlerIds:[r.handlerId],handlerType:c.APT_EVENT}}}};import("node:process").then(s=>s.stdout.write(""));var B=class{static{a(this,"SolanaFacet")}server;constructor(t){this.server=t}testInstructions(t){return this.server.processBindings({bindings:t.map(e=>({data:{raw:new Uint8Array,solInstruction:e},handlerIds:[],handlerType:c.SOL_INSTRUCTION}))})}};import("node:process").then(s=>s.stdout.write(""));var l=m(T(),1);var S=class{static{a(this,"EthFacet")}server;constructor(t){this.server=t}testTrace(t,e=l.EthChainId.ETHEREUM){return this.testTraces([t],e)}testTraces(t,e=l.EthChainId.ETHEREUM){let n=[];for(let r of t){let o=this.buildTraceBinding(r,e);if(!o)throw Error("Invalid test trace: "+JSON.stringify(r));n.push(o)}return this.server.processBindings({bindings:n})}buildTraceBinding(t,e=l.EthChainId.ETHEREUM){if(t.type!=="call"||!t.action.input)throw Error("Invalid test trace: "+JSON.stringify(t));let n=t.action.input.slice(0,10);for(let r of this.server.contractConfigs)if(r.contract?.chainId===e&&!(t.action.to?.toLowerCase()!==r.contract?.address.toLowerCase()&&r.contract?.address!=="*")){for(let o of r.traceConfigs)if(o.signature==n)return{data:{ethTrace:{trace:t,timestamp:new Date}},handlerIds:[o.handlerId],handlerType:c.ETH_TRACE}}}testLog(t,e=l.EthChainId.ETHEREUM){return this.testLogs([t],e)}testLogs(t,e=l.EthChainId.ETHEREUM){let n=[];for(let r of t){let o=this.buildLogBinding(r,e);if(!o)throw Error("Invalid test log: "+JSON.stringify(r));n.push(o)}return this.server.processBindings({bindings:n})}buildLogBinding(t,e=l.EthChainId.ETHEREUM){for(let n of this.server.contractConfigs)if(n.contract?.chainId===e&&!(t.address.toLowerCase()!==n.contract?.address.toLowerCase()&&n.contract?.address!=="*"))for(let r of n.logConfigs)for(let o of r.filters){let i=!0;for(let d in o.topics){let f=t.topics[d],u=o.topics[d].hashes;if(u.length!==0&&!u.find(h=>h.toLowerCase()===f.toLowerCase())){i=!1;break}}if(i)return{data:{ethLog:{log:t,timestamp:new Date}},handlerIds:[r.handlerId],handlerType:c.ETH_LOG}}}testAccountLog(t,e,n=l.EthChainId.ETHEREUM){return this.testAccountLogs(t,[e],n)}testAccountLogs(t,e,n=l.EthChainId.ETHEREUM){let r=[];for(let o of e){let i=this.buildAccountLogBinding(t,o,n);if(!i)throw Error("Invalid test log: "+JSON.stringify(o));r.push(i)}return this.server.processBindings({bindings:r})}buildAccountLogBinding(t,e,n=l.EthChainId.ETHEREUM){for(let r of this.server.accountConfigs)if(r.chainId===n&&t.toLowerCase()===r.address.toLowerCase())for(let o of r.logConfigs)for(let i of o.filters){let d=!0;for(let f in i.topics){let u=e.topics[f],h=i.topics[f].hashes;if(h.length!==0&&!h.find(R=>R.toLowerCase()===u.toLowerCase())){d=!1;break}}if(d)return{data:{ethLog:{log:e,timestamp:new Date}},handlerIds:[o.handlerId],handlerType:c.ETH_LOG}}}testBlock(t,e=l.EthChainId.ETHEREUM){return this.testBlocks([t],e)}testBlocks(t,e=l.EthChainId.ETHEREUM){let n=[];for(let r of t){let o=this.buildBlockBinding(r,e);if(!o)throw Error("Invalid test block: "+JSON.stringify(r));n.push(o)}return this.server.processBindings({bindings:n})}buildBlockBinding(t,e=l.EthChainId.ETHEREUM){let n={data:{ethBlock:{block:t}},handlerType:c.ETH_BLOCK,handlerIds:[]};for(let r of this.server.contractConfigs){if(r.contract?.chainId!==e)continue;let o=t.number;if(!(o<r.startBlock)&&!(r.endBlock!==0n&&o>=r.endBlock))for(let i of r.intervalConfigs)n.handlerIds.push(i.handlerId)}return n}};import("node:process").then(s=>s.stdout.write(""));var N=class{static{a(this,"SuiFacet")}server;constructor(t){this.server=t}testEntryFunctionCall(t,e=p.MAIN_NET){return this.testEntryFunctionCalls([t],e)}testEntryFunctionCalls(t,e=p.MAIN_NET){let n=[];for(let r of t){let o=this.buildEntryFunctionCallBinding(r,e);if(!o)throw Error("Invalid test transaction: "+JSON.stringify(r));n.push(o)}return this.server.processBindings({bindings:n})}buildEntryFunctionCallBinding(t,e=p.MAIN_NET){let n=x(t);for(let r of n){let o=[g(r.package),r.module,r.function].join(M);for(let i of this.server.contractConfigs)if(i.contract?.chainId===e){for(let d of i.moveCallConfigs)for(let f of d.filters)if(g(i.contract.address)+"::"+f.function===o)return{data:{suiCall:{transaction:t,timestamp:new Date,slot:10000n}},handlerIds:[d.handlerId],handlerType:c.SUI_CALL}}}}testEvent(t,e=p.MAIN_NET){let n=this.buildEventBinding(t,e);if(!n)throw Error("Invalid test event: "+JSON.stringify(t));return this.server.processBinding(n)}testGlobalTransaction(t,e=p.MAIN_NET){let n=[];for(let o of this.server.contractConfigs)if(o.contract?.address==="*")for(let i of o.moveCallConfigs)i.filters.length===1&&i.filters[0].function===""&&n.push(i.handlerId);if(n.length===0)throw Error("Invalid test global transaction: "+JSON.stringify(t));let r={handlerIds:n,handlerType:c.SUI_CALL,data:{suiCall:{transaction:t,timestamp:t.timestampMs?new Date(t.timestampMs):new Date,slot:BigInt(t.checkpoint||0)}}};return this.server.processBinding(r)}buildEventBinding(t,e=p.MAIN_NET){for(let n of this.server.contractConfigs)if(n.contract?.chainId===e){for(let r of n.moveEventConfigs)for(let o of r.filters)for(let i of t.events||[])if(g(n.contract.address)+"::"+o.type===I(i.type).qname)return{data:{suiEvent:{transaction:t,timestamp:new Date(t.timestampMs||0),slot:10000n}},handlerIds:[r.handlerId],handlerType:c.SUI_EVENT}}}};import("node:process").then(s=>s.stdout.write(""));var P=class{static{a(this,"FuelFacet")}server;constructor(t){this.server=t}testOnTransaction(t,e=F.TEST_NET){let n=this.buildBinding(t,e);if(!n)throw Error("Invalid test transaction: "+JSON.stringify(t));return this.server.processBindings({bindings:n})}buildBinding(t,e){let n=[];for(let r of this.server.contractConfigs)if(r.contract?.chainId===e){for(let o of r.fuelCallConfigs){let i={data:{fuelCall:{transaction:t,timestamp:new Date}},handlerIds:[o.handlerId],handlerType:c.FUEL_CALL},d=o.filters[0]?.function;if(d)for(let f of t.status.receipts||[])f.receiptType=="CALL"&&f.param1==d&&n.push(i);else n.push(i)}for(let o of r.fuelLogConfigs){let i={data:{fuelCall:{transaction:t,timestamp:new Date}},handlerIds:[o.handlerId],handlerType:c.FUEL_CALL},d=o.logIds;for(let f of t.status.receipts||[])if((f.receiptType=="LOG"||f.receiptType=="LOG_DATA")&&d.includes(f.rb)){n.push(i);break}}for(let o of r.assetConfigs){let i={data:{fuelCall:{transaction:t,timestamp:new Date}},handlerIds:[o.handlerId],handlerType:c.FUEL_CALL};n.push(i)}}return n}};import("node:process").then(s=>s.stdout.write(""));var k=m(T(),1);var O={INJECTIVE_MAINNET:k.CosmosChainId.INJECTIVE_MAINNET,INJECTIVE_TESTNET:k.CosmosChainId.INJECTIVE_TESTNET};import("node:process").then(s=>s.stdout.write(""));var y=class{static{a(this,"CosmosFacet")}server;constructor(t){this.server=t}testOnTransaction(t,e=O.INJECTIVE_TESTNET){let n=this.buildBinding(t,e);if(!n)throw Error("Invalid test transaction: "+JSON.stringify(t));return this.server.processBindings({bindings:n})}buildBinding(t,e){let n=[];for(let r of this.server.contractConfigs)if(r.contract?.chainId===e)for(let o of r.cosmosLogConfigs){let i={data:{cosmosCall:{transaction:t,timestamp:new Date}},handlerIds:[o.handlerId],handlerType:c.COSMOS_CALL},d=o.logFilters;for(let f of t.logs||[])if(f.events.find(u=>d.includes(u.type))){n.push(i);break}}return n}};import("node:process").then(s=>s.stdout.write(""));var H=m(T(),1);var b=class{static{a(this,"StarknetFacet")}server;constructor(t){this.server=t}testOnEvents(t,e=H.StarknetChainId.STARKNET_SEPOLIA){let n=this.buildBinding(t,e);if(!n)throw Error("Invalid test : "+JSON.stringify(t));return this.server.processBindings({bindings:n})}buildBinding(t,e){let n=[],r=Array.isArray(t)?t:[t];for(let o of r)for(let i of this.server.contractConfigs)if(i.contract?.chainId===e)for(let d of i.starknetEventConfigs){let f={data:{starknetEvents:{result:o,timestamp:new Date}},handlerIds:[d.handlerId],handlerType:c.STARKNET_EVENT},u=d.filters,h=o.keys;for(let R of h)for(let q of u)if(q.keys.includes(R))return n.push(f),n}return n}};import("node:process").then(s=>s.stdout.write(""));var U=m(T(),1);var w=class{static{a(this,"BTCFacet")}server;constructor(t){this.server=t}testOnTransactions(t,e=U.BTCChainId.BTC_TESTNET){let n=this.buildBinding(t,e);if(!n)throw Error("Invalid test : "+JSON.stringify(t));return this.server.processBindings({bindings:n})}buildBinding(t,e){let n=[];for(let r of this.server.contractConfigs)if(r.contract?.chainId===e)for(let o of r.btcTransactionConfigs){let i={data:{btcTransaction:t},handlerIds:[o.handlerId],handlerType:c.BTC_TRANSACTION};n.push(i)}return n}};import("node:process").then(s=>s.stdout.write(""));var E={};function X(){K.reset()}a(X,"cleanTest");var A=class{static{a(this,"TestProcessorServer")}service;contractConfigs;accountConfigs;aptos;eth;solana;sui;fuel;cosmos;starknet;btc;constructor(t,e={}){X(),this.service=new j(t),this.aptos=new v(this),this.solana=new B(this),this.eth=new S(this),this.sui=new N(this),this.fuel=new P(this),this.cosmos=new y(this),this.starknet=new b(this),this.btc=new w(this);for(let n in V.CHAIN_MAP){let r=e[n]||"";G.INSTANCE.chainServer.set(n,r)}}async start(t={templateInstances:[]},e=E){let n=await this.service.start(t,e),r=await this.getConfig({});return this.contractConfigs=r.contractConfigs,this.accountConfigs=r.accountConfigs,n}stop(t,e=E){return this.service.stop(t,e)}getConfig(t,e=E){return this.service.getConfig(t,e)}processBindings(t,e=E){return this.service.processBindings(t,e)}processBinding(t,e=E){return this.service.processBindings({bindings:[t]},e)}processBindingsStream(t,e){throw new Error("Method not implemented.")}preprocessBindingsStream(t,e){throw new Error("Method not implemented.")}};import("node:process").then(s=>s.stdout.write(""));function L(s){if(s!==void 0){if(s.doubleValue!==void 0)return s.doubleValue;if(s.bigInteger!==void 0){let t=_(s.bigInteger.data);return s.bigInteger.negative&&(t=-t),t}if(s.bigDecimal!==void 0)return new D(s.bigDecimal)}}a(L,"MetricValueToNumber");function z(s,t){if(s){for(let e of s.counters)if(e.metadata?.name===t)return L(e.metricValue)}}a(z,"firstCounterValue");function Q(s,t){if(s){for(let e of s.gauges)if(e.metadata?.name===t)return L(e.metricValue)}}a(Q,"firstGaugeValue");import("node:process").then(s=>s.stdout.write(""));var J=m(T(),1);import{Endpoints as W}from"@sentio/runtime";function Y(s){let t=[];Array.isArray(s)||(s=[s]);for(let e of Object.keys(J.CHAIN_MAP)){let n="TEST_ENDPOINT_"+e,r=process.env[n];r&&(t.push(e),W.INSTANCE.chainServer.set(e,r))}for(let e of s)if(!t.includes(e))return!1;return!0}a(Y,"loadTestProvidersFromEnv");import("node:process").then(s=>s.stdout.write(""));import("node:process").then(s=>s.stdout.write(""));export{L as MetricValueToNumber,A as TestProcessorServer,z as firstCounterValue,Q as firstGaugeValue,Y as loadTestProvidersFromEnv};
|
|
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.49.
|
|
3
|
+
"version": "2.49.3-rc.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"{lib,assets}"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@sentio/runtime": "^2.49.
|
|
49
|
+
"@sentio/runtime": "^2.49.3-rc.1"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {},
|
|
52
52
|
"devDependencies": {},
|