@sentio/sdk-bundle 2.44.7-rc.6 → 2.44.7
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/codegen/index.js +2 -2
- package/lib/aptos/codegen/index.js.map +1 -1
- package/lib/aptos/ext/index.js +1 -1
- package/lib/aptos/ext/index.js.map +1 -1
- package/lib/aptos/ext/token-list.d.ts +444 -0
- package/lib/aptos/ext/token-list.d.ts.map +1 -0
- package/lib/aptos/index.js +1 -1
- package/lib/{chunk-5WK73P5V.js → chunk-ABLESLV7.js} +2 -2
- package/lib/{chunk-5ZYA435U.js → chunk-CPSB2UZQ.js} +2 -2
- package/lib/{chunk-PBVLDBCZ.js → chunk-G3ZGY3OS.js} +2 -2
- package/lib/{chunk-4D6ZDNWQ.js → chunk-IOV7WAT6.js} +2 -2
- package/lib/{chunk-A7MFS2PQ.js → chunk-M7BSUAPO.js} +87 -132
- package/lib/chunk-M7BSUAPO.js.map +1 -0
- package/lib/{chunk-CVQ72H2U.js → chunk-MAXAKVBP.js} +2 -2
- package/lib/{chunk-CVQ72H2U.js.map → chunk-MAXAKVBP.js.map} +1 -1
- package/lib/{chunk-KRL7DRXT.js → chunk-MOVK3WB7.js} +2 -2
- package/lib/{chunk-KRL7DRXT.js.map → chunk-MOVK3WB7.js.map} +1 -1
- package/lib/{chunk-VSUZQA42.js → chunk-QUNXEV6Z.js} +2 -2
- package/lib/{chunk-VSUZQA42.js.map → chunk-QUNXEV6Z.js.map} +1 -1
- package/lib/chunk-WP7CMYLZ.js +48 -0
- package/lib/chunk-WP7CMYLZ.js.map +1 -0
- package/lib/{chunk-Y5P74Z5H.js → chunk-WQV3TSRA.js} +2 -2
- package/lib/{chunk-ZA6TPCBF.js → chunk-ZI5N3H3K.js} +2 -2
- package/lib/{chunk-ZA6TPCBF.js.map → chunk-ZI5N3H3K.js.map} +1 -1
- package/lib/eth/codegen/index.js +1 -1
- package/lib/move/index.js +1 -1
- package/lib/move/shared-network-codegen.d.ts +2 -2
- package/lib/move/shared-network-codegen.d.ts.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/codegen/index.js +2 -2
- package/lib/sui/codegen/index.js.map +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/tsup.config.ts +1 -1
- package/package.json +2 -2
- package/src/aptos/codegen/codegen.ts +1 -2
- package/src/aptos/ext/{token-list.json → token-list.ts} +1 -1
- package/src/aptos/ext/token.ts +1 -1
- package/src/move/shared-network-codegen.ts +5 -2
- package/src/sui/codegen/codegen.ts +1 -2
- package/src/tsup.config.ts +1 -1
- package/lib/chunk-A7MFS2PQ.js.map +0 -1
- package/lib/chunk-RVK3H6V4.js +0 -3
- package/lib/chunk-RVK3H6V4.js.map +0 -1
- /package/lib/{chunk-5WK73P5V.js.map → chunk-ABLESLV7.js.map} +0 -0
- /package/lib/{chunk-5ZYA435U.js.map → chunk-CPSB2UZQ.js.map} +0 -0
- /package/lib/{chunk-PBVLDBCZ.js.map → chunk-G3ZGY3OS.js.map} +0 -0
- /package/lib/{chunk-4D6ZDNWQ.js.map → chunk-IOV7WAT6.js.map} +0 -0
- /package/lib/{chunk-Y5P74Z5H.js.map → chunk-WQV3TSRA.js.map} +0 -0
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{b as F}from"../chunk-HDNVG6V3.js";import"../chunk-E2QT6K2E.js";import{g as _}from"../chunk-VSUZQA42.js";import"../chunk-5WK73P5V.js";import"../chunk-KRL7DRXT.js";import{e as g}from"../chunk-B7YDBLBV.js";import"../chunk-ZA6TPCBF.js";import{c as T}from"../chunk-CVQ72H2U.js";import"../chunk-7K2CQ73Y.js";import"../chunk-KUHMQRSY.js";import"../chunk-JLRCAHLL.js";import"../chunk-44SAPBRK.js";import"../chunk-P73GOPCF.js";import"../chunk-6GMS6XU7.js";import{b as M}from"../chunk-RVQBDYQ2.js";import"../chunk-WQ7UQGQE.js";import"../chunk-W4OBSPHA.js";import{a as D,d as u,n as E}from"../chunk-RVK3H6V4.js";import"../chunk-6VELGYNR.js";import"../chunk-YX4LDK5Y.js";import"../chunk-F7Q5QB6Q.js";import"../chunk-OUOSDGWD.js";import{a as m}from"../chunk-QW2MPHP5.js";import{D as a}from"../chunk-24SCJPBI.js";import"../chunk-GU4UN43Q.js";import"../chunk-CA6DKOT2.js";import"../chunk-NDC6HDQD.js";import"../chunk-WZLM66YL.js";import"../chunk-2BO4GGPL.js";import{a as L}from"../chunk-FC546GTB.js";import{e as h}from"../chunk-6GD6B22G.js";var U=h(m(),1);import{Endpoints as q,ProcessorServiceImpl as G,State as j}from"@sentio/runtime";var I=class{server;constructor(t){this.server=t}testEntryFunctionCall(t,e=T.MAIN_NET){return this.testEntryFunctionCalls([t],e)}testEntryFunctionCalls(t,e=T.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=T.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(u(r.contract.address)+"::"+i.function===n.function)return{data:{aptCall:{transaction:t}},handlerIds:[o.handlerId],handlerType:a.APT_CALL}}}testEvent(t,e=T.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=T.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(u(n.contract.address)+"::"+o.type===E(i.type).qname)return{data:{aptEvent:{transaction:t}},handlerIds:[r.handlerId],handlerType:a.APT_EVENT}}}};import("process").then(s=>s.stdout.write(""));var v=class{server;constructor(t){this.server=t}testInstructions(t){return this.server.processBindings({bindings:t.map(e=>({data:{raw:new Uint8Array,solInstruction:e},handlerIds:[],handlerType:a.SOL_INSTRUCTION}))})}};import("process").then(s=>s.stdout.write(""));var f=h(m(),1),B=class{server;constructor(t){this.server=t}testTrace(t,e=f.EthChainId.ETHEREUM){return this.testTraces([t],e)}testTraces(t,e=f.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=f.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:a.ETH_TRACE}}}testLog(t,e=f.EthChainId.ETHEREUM){return this.testLogs([t],e)}testLogs(t,e=f.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=f.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 c in o.topics){let d=t.topics[c],l=o.topics[c].hashes;if(l.length!==0&&!l.find(p=>p.toLowerCase()===d.toLowerCase())){i=!1;break}}if(i)return{data:{ethLog:{log:t,timestamp:new Date}},handlerIds:[r.handlerId],handlerType:a.ETH_LOG}}}testAccountLog(t,e,n=f.EthChainId.ETHEREUM){return this.testAccountLogs(t,[e],n)}testAccountLogs(t,e,n=f.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=f.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 c=!0;for(let d in i.topics){let l=e.topics[d],p=i.topics[d].hashes;if(p.length!==0&&!p.find(w=>w.toLowerCase()===l.toLowerCase())){c=!1;break}}if(c)return{data:{ethLog:{log:e,timestamp:new Date}},handlerIds:[o.handlerId],handlerType:a.ETH_LOG}}}testBlock(t,e=f.EthChainId.ETHEREUM){return this.testBlocks([t],e)}testBlocks(t,e=f.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=f.EthChainId.ETHEREUM){let n={data:{ethBlock:{block:t}},handlerType:a.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("process").then(s=>s.stdout.write(""));var S=class{server;constructor(t){this.server=t}testEntryFunctionCall(t,e=g.MAIN_NET){return this.testEntryFunctionCalls([t],e)}testEntryFunctionCalls(t,e=g.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=g.MAIN_NET){let n=_(t);for(let r of n){let o=[u(r.package),r.module,r.function].join(D);for(let i of this.server.contractConfigs)if(i.contract?.chainId===e){for(let c of i.moveCallConfigs)for(let d of c.filters)if(u(i.contract.address)+"::"+d.function===o)return{data:{suiCall:{transaction:t,timestamp:new Date,slot:10000n}},handlerIds:[c.handlerId],handlerType:a.SUI_CALL}}}}testEvent(t,e=g.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=g.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:a.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=g.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(u(n.contract.address)+"::"+o.type===E(i.type).qname)return{data:{suiEvent:{transaction:t,timestamp:new Date(t.timestampMs||0),slot:10000n}},handlerIds:[r.handlerId],handlerType:a.SUI_EVENT}}}};import("process").then(s=>s.stdout.write(""));var N=class{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:a.FUEL_CALL},c=o.filters[0]?.function;if(c)for(let d of t.status.receipts||[])d.receiptType=="CALL"&&d.param1==c&&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:a.FUEL_CALL},c=o.logIds;for(let d of t.status.receipts||[])if((d.receiptType=="LOG"||d.receiptType=="LOG_DATA")&&c.includes(d.rb)){n.push(i);break}}for(let o of r.assetConfigs){let i={data:{fuelCall:{transaction:t,timestamp:new Date}},handlerIds:[o.handlerId],handlerType:a.FUEL_CALL};n.push(i)}}return n}};import("process").then(s=>s.stdout.write(""));var R=h(m(),1),x={INJECTIVE_MAINNET:R.CosmosChainId.INJECTIVE_MAINNET,INJECTIVE_TESTNET:R.CosmosChainId.INJECTIVE_TESTNET};import("process").then(s=>s.stdout.write(""));var P=class{server;constructor(t){this.server=t}testOnTransaction(t,e=x.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:a.COSMOS_CALL},c=o.logFilters;for(let d of t.logs||[])if(d.events.find(l=>c.includes(l.type))){n.push(i);break}}return n}};import("process").then(s=>s.stdout.write(""));var O=h(m(),1),y=class{server;constructor(t){this.server=t}testOnEvents(t,e=O.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 c of i.starknetEventConfigs){let d={data:{starknetEvents:{result:o,timestamp:new Date}},handlerIds:[c.handlerId],handlerType:a.STARKNET_EVENT},l=c.filters,p=o.keys;for(let w of p)for(let J of l)if(J.keys.includes(w))return n.push(d),n}return n}};import("process").then(s=>s.stdout.write(""));var H=h(m(),1);var b=class{server;constructor(t){this.server=t}testOnTransactions(t,e=H.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:a.BTC_TRANSACTION};n.push(i)}return n}};import("process").then(s=>s.stdout.write(""));var C={};function K(){j.reset()}var k=class{service;contractConfigs;accountConfigs;aptos;eth;solana;sui;fuel;cosmos;starknet;btc;constructor(t,e={}){K(),this.service=new G(t),this.aptos=new I(this),this.solana=new v(this),this.eth=new B(this),this.sui=new S(this),this.fuel=new N(this),this.cosmos=new P(this),this.starknet=new y(this),this.btc=new b(this);for(let n in U.CHAIN_MAP){let r=e[n]||"";q.INSTANCE.chainServer.set(n,r)}}async start(t={templateInstances:[]},e=C){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=C){return this.service.stop(t,e)}getConfig(t,e=C){return this.service.getConfig(t,e)}processBindings(t,e=C){return this.service.processBindings(t,e)}processBinding(t,e=C){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("process").then(s=>s.stdout.write(""));function A(s){if(s!==void 0){if(s.doubleValue!==void 0)return s.doubleValue;if(s.bigInteger!==void 0){let t=M(s.bigInteger.data);return s.bigInteger.negative&&(t=-t),t}if(s.bigDecimal!==void 0)return new L(s.bigDecimal)}}function X(s,t){if(s){for(let e of s.counters)if(e.metadata?.name===t)return A(e.metricValue)}}function z(s,t){if(s){for(let e of s.gauges)if(e.metadata?.name===t)return A(e.metricValue)}}import("process").then(s=>s.stdout.write(""));var V=h(m(),1);import{Endpoints as Q}from"@sentio/runtime";function W(s){let t=[];Array.isArray(s)||(s=[s]);for(let e of Object.keys(V.CHAIN_MAP)){let n="TEST_ENDPOINT_"+e,r=process.env[n];r&&(t.push(e),Q.INSTANCE.chainServer.set(e,r))}for(let e of s)if(!t.includes(e))return!1;return!0}import("process").then(s=>s.stdout.write(""));import("process").then(s=>s.stdout.write(""));export{A as MetricValueToNumber,k as TestProcessorServer,X as firstCounterValue,z as firstGaugeValue,W as loadTestProvidersFromEnv};
|
|
2
|
+
import{b as F}from"../chunk-HDNVG6V3.js";import"../chunk-E2QT6K2E.js";import{g as _}from"../chunk-QUNXEV6Z.js";import"../chunk-ABLESLV7.js";import"../chunk-MOVK3WB7.js";import{e as g}from"../chunk-B7YDBLBV.js";import"../chunk-ZI5N3H3K.js";import{c as T}from"../chunk-MAXAKVBP.js";import"../chunk-7K2CQ73Y.js";import"../chunk-KUHMQRSY.js";import"../chunk-JLRCAHLL.js";import"../chunk-44SAPBRK.js";import"../chunk-P73GOPCF.js";import"../chunk-6GMS6XU7.js";import{b as M}from"../chunk-RVQBDYQ2.js";import"../chunk-WQ7UQGQE.js";import"../chunk-W4OBSPHA.js";import{a as D,d as u,n as E}from"../chunk-M7BSUAPO.js";import"../chunk-6VELGYNR.js";import"../chunk-YX4LDK5Y.js";import"../chunk-F7Q5QB6Q.js";import"../chunk-OUOSDGWD.js";import{a as m}from"../chunk-QW2MPHP5.js";import{D as a}from"../chunk-24SCJPBI.js";import"../chunk-GU4UN43Q.js";import"../chunk-CA6DKOT2.js";import"../chunk-NDC6HDQD.js";import"../chunk-WZLM66YL.js";import"../chunk-2BO4GGPL.js";import{a as L}from"../chunk-FC546GTB.js";import{e as h}from"../chunk-6GD6B22G.js";var U=h(m(),1);import{Endpoints as q,ProcessorServiceImpl as G,State as j}from"@sentio/runtime";var I=class{server;constructor(t){this.server=t}testEntryFunctionCall(t,e=T.MAIN_NET){return this.testEntryFunctionCalls([t],e)}testEntryFunctionCalls(t,e=T.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=T.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(u(r.contract.address)+"::"+i.function===n.function)return{data:{aptCall:{transaction:t}},handlerIds:[o.handlerId],handlerType:a.APT_CALL}}}testEvent(t,e=T.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=T.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(u(n.contract.address)+"::"+o.type===E(i.type).qname)return{data:{aptEvent:{transaction:t}},handlerIds:[r.handlerId],handlerType:a.APT_EVENT}}}};import("process").then(s=>s.stdout.write(""));var v=class{server;constructor(t){this.server=t}testInstructions(t){return this.server.processBindings({bindings:t.map(e=>({data:{raw:new Uint8Array,solInstruction:e},handlerIds:[],handlerType:a.SOL_INSTRUCTION}))})}};import("process").then(s=>s.stdout.write(""));var f=h(m(),1),B=class{server;constructor(t){this.server=t}testTrace(t,e=f.EthChainId.ETHEREUM){return this.testTraces([t],e)}testTraces(t,e=f.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=f.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:a.ETH_TRACE}}}testLog(t,e=f.EthChainId.ETHEREUM){return this.testLogs([t],e)}testLogs(t,e=f.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=f.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 c in o.topics){let d=t.topics[c],l=o.topics[c].hashes;if(l.length!==0&&!l.find(p=>p.toLowerCase()===d.toLowerCase())){i=!1;break}}if(i)return{data:{ethLog:{log:t,timestamp:new Date}},handlerIds:[r.handlerId],handlerType:a.ETH_LOG}}}testAccountLog(t,e,n=f.EthChainId.ETHEREUM){return this.testAccountLogs(t,[e],n)}testAccountLogs(t,e,n=f.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=f.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 c=!0;for(let d in i.topics){let l=e.topics[d],p=i.topics[d].hashes;if(p.length!==0&&!p.find(w=>w.toLowerCase()===l.toLowerCase())){c=!1;break}}if(c)return{data:{ethLog:{log:e,timestamp:new Date}},handlerIds:[o.handlerId],handlerType:a.ETH_LOG}}}testBlock(t,e=f.EthChainId.ETHEREUM){return this.testBlocks([t],e)}testBlocks(t,e=f.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=f.EthChainId.ETHEREUM){let n={data:{ethBlock:{block:t}},handlerType:a.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("process").then(s=>s.stdout.write(""));var S=class{server;constructor(t){this.server=t}testEntryFunctionCall(t,e=g.MAIN_NET){return this.testEntryFunctionCalls([t],e)}testEntryFunctionCalls(t,e=g.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=g.MAIN_NET){let n=_(t);for(let r of n){let o=[u(r.package),r.module,r.function].join(D);for(let i of this.server.contractConfigs)if(i.contract?.chainId===e){for(let c of i.moveCallConfigs)for(let d of c.filters)if(u(i.contract.address)+"::"+d.function===o)return{data:{suiCall:{transaction:t,timestamp:new Date,slot:10000n}},handlerIds:[c.handlerId],handlerType:a.SUI_CALL}}}}testEvent(t,e=g.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=g.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:a.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=g.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(u(n.contract.address)+"::"+o.type===E(i.type).qname)return{data:{suiEvent:{transaction:t,timestamp:new Date(t.timestampMs||0),slot:10000n}},handlerIds:[r.handlerId],handlerType:a.SUI_EVENT}}}};import("process").then(s=>s.stdout.write(""));var N=class{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:a.FUEL_CALL},c=o.filters[0]?.function;if(c)for(let d of t.status.receipts||[])d.receiptType=="CALL"&&d.param1==c&&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:a.FUEL_CALL},c=o.logIds;for(let d of t.status.receipts||[])if((d.receiptType=="LOG"||d.receiptType=="LOG_DATA")&&c.includes(d.rb)){n.push(i);break}}for(let o of r.assetConfigs){let i={data:{fuelCall:{transaction:t,timestamp:new Date}},handlerIds:[o.handlerId],handlerType:a.FUEL_CALL};n.push(i)}}return n}};import("process").then(s=>s.stdout.write(""));var R=h(m(),1),x={INJECTIVE_MAINNET:R.CosmosChainId.INJECTIVE_MAINNET,INJECTIVE_TESTNET:R.CosmosChainId.INJECTIVE_TESTNET};import("process").then(s=>s.stdout.write(""));var P=class{server;constructor(t){this.server=t}testOnTransaction(t,e=x.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:a.COSMOS_CALL},c=o.logFilters;for(let d of t.logs||[])if(d.events.find(l=>c.includes(l.type))){n.push(i);break}}return n}};import("process").then(s=>s.stdout.write(""));var O=h(m(),1),y=class{server;constructor(t){this.server=t}testOnEvents(t,e=O.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 c of i.starknetEventConfigs){let d={data:{starknetEvents:{result:o,timestamp:new Date}},handlerIds:[c.handlerId],handlerType:a.STARKNET_EVENT},l=c.filters,p=o.keys;for(let w of p)for(let J of l)if(J.keys.includes(w))return n.push(d),n}return n}};import("process").then(s=>s.stdout.write(""));var H=h(m(),1);var b=class{server;constructor(t){this.server=t}testOnTransactions(t,e=H.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:a.BTC_TRANSACTION};n.push(i)}return n}};import("process").then(s=>s.stdout.write(""));var C={};function K(){j.reset()}var k=class{service;contractConfigs;accountConfigs;aptos;eth;solana;sui;fuel;cosmos;starknet;btc;constructor(t,e={}){K(),this.service=new G(t),this.aptos=new I(this),this.solana=new v(this),this.eth=new B(this),this.sui=new S(this),this.fuel=new N(this),this.cosmos=new P(this),this.starknet=new y(this),this.btc=new b(this);for(let n in U.CHAIN_MAP){let r=e[n]||"";q.INSTANCE.chainServer.set(n,r)}}async start(t={templateInstances:[]},e=C){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=C){return this.service.stop(t,e)}getConfig(t,e=C){return this.service.getConfig(t,e)}processBindings(t,e=C){return this.service.processBindings(t,e)}processBinding(t,e=C){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("process").then(s=>s.stdout.write(""));function A(s){if(s!==void 0){if(s.doubleValue!==void 0)return s.doubleValue;if(s.bigInteger!==void 0){let t=M(s.bigInteger.data);return s.bigInteger.negative&&(t=-t),t}if(s.bigDecimal!==void 0)return new L(s.bigDecimal)}}function X(s,t){if(s){for(let e of s.counters)if(e.metadata?.name===t)return A(e.metricValue)}}function z(s,t){if(s){for(let e of s.gauges)if(e.metadata?.name===t)return A(e.metricValue)}}import("process").then(s=>s.stdout.write(""));var V=h(m(),1);import{Endpoints as Q}from"@sentio/runtime";function W(s){let t=[];Array.isArray(s)||(s=[s]);for(let e of Object.keys(V.CHAIN_MAP)){let n="TEST_ENDPOINT_"+e,r=process.env[n];r&&(t.push(e),Q.INSTANCE.chainServer.set(e,r))}for(let e of s)if(!t.includes(e))return!1;return!0}import("process").then(s=>s.stdout.write(""));import("process").then(s=>s.stdout.write(""));export{A as MetricValueToNumber,k as TestProcessorServer,X as firstCounterValue,z as firstGaugeValue,W as loadTestProvidersFromEnv};
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/lib/tsup.config.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentio/sdk-bundle",
|
|
3
|
-
"version": "2.44.7
|
|
3
|
+
"version": "2.44.7",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"!{lib,src}/*/tests"
|
|
49
49
|
],
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@sentio/runtime": "^2.44.7
|
|
51
|
+
"@sentio/runtime": "^2.44.7"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {},
|
|
54
54
|
"devDependencies": {},
|
|
@@ -23,7 +23,6 @@ export async function codegen(
|
|
|
23
23
|
|
|
24
24
|
class AptosNetworkCodegen extends BaseAptosCodegen {
|
|
25
25
|
moduleGenerator: SharedNetworkCodegen<AptosNetwork, MoveModuleBytecode, Event | MoveResource>
|
|
26
|
-
SYSTEM_PACKAGE = '@sentio/sdk/aptos'
|
|
27
26
|
|
|
28
27
|
constructor(network: AptosNetwork) {
|
|
29
28
|
const endpoint = getRpcEndpoint(network)
|
|
@@ -34,8 +33,8 @@ class AptosNetworkCodegen extends BaseAptosCodegen {
|
|
|
34
33
|
Event | MoveResource
|
|
35
34
|
> {
|
|
36
35
|
ADDRESS_TYPE = 'MoveAddressType'
|
|
37
|
-
SYSTEM_PACKAGE = '@sentio/sdk/aptos'
|
|
38
36
|
PREFIX = 'Aptos'
|
|
37
|
+
SYSTEM_PACKAGE = '@typemove/aptos'
|
|
39
38
|
NETWORK = AptosNetwork
|
|
40
39
|
})(network, this.chainAdapter)
|
|
41
40
|
}
|
package/src/aptos/ext/token.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { AptosNetwork, getClient } from '../network.js'
|
|
|
5
5
|
import { coin } from '../builtin/0x1.js'
|
|
6
6
|
import { MoveStructId } from '@aptos-labs/ts-sdk'
|
|
7
7
|
import { AptosChainId } from '@sentio/chain'
|
|
8
|
-
import DEFAULT_TOKEN_LIST from
|
|
8
|
+
import { DEFAULT_TOKEN_LIST } from "./token-list.js";
|
|
9
9
|
|
|
10
10
|
type TokenInfo = {
|
|
11
11
|
chainId: number
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
AbstractCodegen,
|
|
2
3
|
ChainAdapter,
|
|
3
4
|
InternalMoveFunction,
|
|
4
5
|
InternalMoveModule,
|
|
@@ -10,8 +11,6 @@ import {
|
|
|
10
11
|
upperFirst
|
|
11
12
|
} from '@typemove/move'
|
|
12
13
|
|
|
13
|
-
import { AbstractCodegen } from '@typemove/move/codegen'
|
|
14
|
-
|
|
15
14
|
export abstract class SharedNetworkCodegen<NetworkType, ModuleTypes, StructType> extends AbstractCodegen<
|
|
16
15
|
ModuleTypes,
|
|
17
16
|
StructType
|
|
@@ -133,6 +132,10 @@ onEvent${struct.name}(func: (event: ${moduleName}.${normalizeToJSName(struct.nam
|
|
|
133
132
|
)
|
|
134
133
|
}
|
|
135
134
|
|
|
135
|
+
protected defaultCoderPackage(): string {
|
|
136
|
+
return `@sentio/sdk/${this.PREFIX.toLowerCase()}`
|
|
137
|
+
}
|
|
138
|
+
|
|
136
139
|
generateLoadAll(isSystem: boolean): string {
|
|
137
140
|
let source = `loadAllTypes(defaultMoveCoder(${this.PREFIX}Network.${this.generateNetworkOption(this.network)}))`
|
|
138
141
|
if (isSystem) {
|
|
@@ -24,7 +24,6 @@ export async function codegen(
|
|
|
24
24
|
|
|
25
25
|
class SuiNetworkCodegen extends BaseSuiCodegen {
|
|
26
26
|
moduleGenerator: SharedNetworkCodegen<SuiNetwork, SuiMoveNormalizedModule, SuiEvent | SuiMoveObject>
|
|
27
|
-
SYSTEM_PACKAGE = '@sentio/sdk/sui'
|
|
28
27
|
|
|
29
28
|
constructor(network: SuiNetwork) {
|
|
30
29
|
const endpoint = getRpcEndpoint(network)
|
|
@@ -36,7 +35,7 @@ class SuiNetworkCodegen extends BaseSuiCodegen {
|
|
|
36
35
|
> {
|
|
37
36
|
ADDRESS_TYPE = 'string'
|
|
38
37
|
PREFIX = 'Sui'
|
|
39
|
-
SYSTEM_PACKAGE = '@
|
|
38
|
+
SYSTEM_PACKAGE = '@typemove/sui'
|
|
40
39
|
NETWORK = SuiNetwork
|
|
41
40
|
|
|
42
41
|
generateStructs(module: InternalMoveModule, struct: InternalMoveStruct, events: Set<string>): string {
|
package/src/tsup.config.ts
CHANGED