envio 3.0.0-alpha.2 → 3.0.0-alpha.21
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/README.md +164 -30
- package/bin.mjs +49 -0
- package/evm.schema.json +79 -169
- package/fuel.schema.json +50 -21
- package/index.d.ts +578 -1
- package/index.js +4 -0
- package/package.json +47 -31
- package/rescript.json +4 -1
- package/src/Batch.res +11 -8
- package/src/Batch.res.mjs +11 -9
- package/src/ChainFetcher.res +531 -0
- package/src/ChainFetcher.res.mjs +339 -0
- package/src/ChainManager.res +190 -0
- package/src/ChainManager.res.mjs +166 -0
- package/src/Change.res +3 -3
- package/src/Config.gen.ts +19 -0
- package/src/Config.res +725 -25
- package/src/Config.res.mjs +692 -26
- package/src/{Indexer.res → Ctx.res} +1 -1
- package/src/Ecosystem.res +9 -124
- package/src/Ecosystem.res.mjs +19 -160
- package/src/Env.res +33 -73
- package/src/Env.res.mjs +29 -85
- package/src/Envio.gen.ts +3 -1
- package/src/Envio.res +77 -9
- package/src/Envio.res.mjs +39 -1
- package/src/EventConfigBuilder.res +408 -0
- package/src/EventConfigBuilder.res.mjs +376 -0
- package/src/EventProcessing.res +469 -0
- package/src/EventProcessing.res.mjs +337 -0
- package/src/EvmTypes.gen.ts +6 -0
- package/src/EvmTypes.res +1 -0
- package/src/FetchState.res +1256 -639
- package/src/FetchState.res.mjs +1135 -612
- package/src/GlobalState.res +1224 -0
- package/src/GlobalState.res.mjs +1291 -0
- package/src/GlobalStateManager.res +68 -0
- package/src/GlobalStateManager.res.mjs +75 -0
- package/src/GlobalStateManager.resi +7 -0
- package/src/HandlerLoader.res +89 -0
- package/src/HandlerLoader.res.mjs +79 -0
- package/src/HandlerRegister.res +357 -0
- package/src/HandlerRegister.res.mjs +299 -0
- package/src/HandlerRegister.resi +30 -0
- package/src/Hasura.res +111 -175
- package/src/Hasura.res.mjs +88 -150
- package/src/InMemoryStore.res +1 -1
- package/src/InMemoryStore.res.mjs +3 -3
- package/src/InMemoryTable.res +1 -1
- package/src/InMemoryTable.res.mjs +1 -1
- package/src/Internal.gen.ts +6 -0
- package/src/Internal.res +265 -12
- package/src/Internal.res.mjs +115 -1
- package/src/LoadLayer.res +444 -0
- package/src/LoadLayer.res.mjs +296 -0
- package/src/LoadLayer.resi +32 -0
- package/src/LogSelection.res +33 -27
- package/src/LogSelection.res.mjs +6 -0
- package/src/Logging.res +21 -7
- package/src/Logging.res.mjs +16 -8
- package/src/Main.res +390 -0
- package/src/Main.res.mjs +341 -0
- package/src/Persistence.res +7 -21
- package/src/Persistence.res.mjs +3 -3
- package/src/PgStorage.gen.ts +10 -0
- package/src/PgStorage.res +116 -69
- package/src/PgStorage.res.d.mts +5 -0
- package/src/PgStorage.res.mjs +93 -50
- package/src/Prometheus.res +294 -224
- package/src/Prometheus.res.mjs +353 -340
- package/src/ReorgDetection.res +6 -10
- package/src/ReorgDetection.res.mjs +6 -6
- package/src/SafeCheckpointTracking.res +4 -4
- package/src/SafeCheckpointTracking.res.mjs +2 -2
- package/src/SimulateItems.res +353 -0
- package/src/SimulateItems.res.mjs +335 -0
- package/src/Sink.res +4 -2
- package/src/Sink.res.mjs +2 -1
- package/src/TableIndices.res +0 -1
- package/src/TestIndexer.res +913 -0
- package/src/TestIndexer.res.mjs +698 -0
- package/src/TestIndexerProxyStorage.res +205 -0
- package/src/TestIndexerProxyStorage.res.mjs +151 -0
- package/src/TopicFilter.res +1 -1
- package/src/Types.ts +1 -1
- package/src/UserContext.res +424 -0
- package/src/UserContext.res.mjs +279 -0
- package/src/Utils.res +97 -26
- package/src/Utils.res.mjs +91 -44
- package/src/bindings/BigInt.res +10 -0
- package/src/bindings/BigInt.res.mjs +15 -0
- package/src/bindings/ClickHouse.res +120 -23
- package/src/bindings/ClickHouse.res.mjs +118 -28
- package/src/bindings/DateFns.res +74 -0
- package/src/bindings/DateFns.res.mjs +22 -0
- package/src/bindings/EventSource.res +11 -2
- package/src/bindings/EventSource.res.mjs +8 -1
- package/src/bindings/Express.res +1 -0
- package/src/bindings/Hrtime.res +14 -1
- package/src/bindings/Hrtime.res.mjs +22 -2
- package/src/bindings/Hrtime.resi +4 -0
- package/src/bindings/Lodash.res +0 -1
- package/src/bindings/NodeJs.res +49 -3
- package/src/bindings/NodeJs.res.mjs +11 -3
- package/src/bindings/Pino.res +24 -10
- package/src/bindings/Pino.res.mjs +14 -8
- package/src/bindings/Postgres.gen.ts +8 -0
- package/src/bindings/Postgres.res +5 -1
- package/src/bindings/Postgres.res.d.mts +5 -0
- package/src/bindings/PromClient.res +0 -10
- package/src/bindings/PromClient.res.mjs +0 -3
- package/src/bindings/Vitest.res +144 -0
- package/src/bindings/Vitest.res.mjs +9 -0
- package/src/bindings/WebSocket.res +27 -0
- package/src/bindings/WebSocket.res.mjs +2 -0
- package/src/bindings/Yargs.res +8 -0
- package/src/bindings/Yargs.res.mjs +2 -0
- package/src/db/EntityHistory.res +7 -7
- package/src/db/EntityHistory.res.mjs +9 -9
- package/src/db/InternalTable.res +59 -111
- package/src/db/InternalTable.res.mjs +73 -104
- package/src/db/Table.res +27 -8
- package/src/db/Table.res.mjs +25 -14
- package/src/sources/Evm.res +84 -0
- package/src/sources/Evm.res.mjs +105 -0
- package/src/sources/EvmChain.res +94 -0
- package/src/sources/EvmChain.res.mjs +60 -0
- package/src/sources/Fuel.res +19 -34
- package/src/sources/Fuel.res.mjs +34 -16
- package/src/sources/FuelSDK.res +38 -0
- package/src/sources/FuelSDK.res.mjs +29 -0
- package/src/sources/HyperFuel.res +2 -2
- package/src/sources/HyperFuel.resi +1 -1
- package/src/sources/HyperFuelClient.res +2 -2
- package/src/sources/HyperFuelSource.res +35 -13
- package/src/sources/HyperFuelSource.res.mjs +26 -16
- package/src/sources/HyperSync.res +61 -60
- package/src/sources/HyperSync.res.mjs +53 -67
- package/src/sources/HyperSync.resi +6 -4
- package/src/sources/HyperSyncClient.res +29 -2
- package/src/sources/HyperSyncClient.res.mjs +9 -0
- package/src/sources/HyperSyncHeightStream.res +76 -118
- package/src/sources/HyperSyncHeightStream.res.mjs +68 -75
- package/src/sources/HyperSyncSource.res +122 -143
- package/src/sources/HyperSyncSource.res.mjs +106 -121
- package/src/sources/Rpc.res +86 -14
- package/src/sources/Rpc.res.mjs +101 -9
- package/src/sources/RpcSource.res +731 -364
- package/src/sources/RpcSource.res.mjs +845 -410
- package/src/sources/RpcWebSocketHeightStream.res +181 -0
- package/src/sources/RpcWebSocketHeightStream.res.mjs +196 -0
- package/src/sources/SimulateSource.res +59 -0
- package/src/sources/SimulateSource.res.mjs +50 -0
- package/src/sources/Source.res +7 -5
- package/src/sources/SourceManager.res +358 -221
- package/src/sources/SourceManager.res.mjs +346 -171
- package/src/sources/SourceManager.resi +17 -6
- package/src/sources/Svm.res +81 -0
- package/src/sources/Svm.res.mjs +90 -0
- package/src/tui/Tui.res +247 -0
- package/src/tui/Tui.res.mjs +337 -0
- package/src/tui/bindings/Ink.res +371 -0
- package/src/tui/bindings/Ink.res.mjs +72 -0
- package/src/tui/bindings/Style.res +123 -0
- package/src/tui/bindings/Style.res.mjs +2 -0
- package/src/tui/components/BufferedProgressBar.res +40 -0
- package/src/tui/components/BufferedProgressBar.res.mjs +57 -0
- package/src/tui/components/CustomHooks.res +122 -0
- package/src/tui/components/CustomHooks.res.mjs +179 -0
- package/src/tui/components/Messages.res +41 -0
- package/src/tui/components/Messages.res.mjs +75 -0
- package/src/tui/components/SyncETA.res +174 -0
- package/src/tui/components/SyncETA.res.mjs +263 -0
- package/src/tui/components/TuiData.res +47 -0
- package/src/tui/components/TuiData.res.mjs +34 -0
- package/svm.schema.json +112 -0
- package/bin.js +0 -48
- package/src/EventRegister.res +0 -241
- package/src/EventRegister.res.mjs +0 -240
- package/src/EventRegister.resi +0 -30
- package/src/bindings/Ethers.gen.ts +0 -14
- package/src/bindings/Ethers.res +0 -204
- package/src/bindings/Ethers.res.mjs +0 -130
- /package/src/{Indexer.res.mjs → Ctx.res.mjs} +0 -0
package/README.md
CHANGED
|
@@ -1,45 +1,179 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>HyperIndex: Ultra-Fast Multichain Indexer</h1>
|
|
3
|
+
<p><strong>The fastest independently benchmarked multichain blockchain indexer.</strong></p>
|
|
4
|
+
<p>
|
|
5
|
+
<a href="https://github.com/enviodev/hyperindex/releases"><img src="https://img.shields.io/github/release/enviodev/hyperindex.svg" alt="GitHub release" /></a>
|
|
6
|
+
<a href="https://github.com/enviodev/hyperindex/issues"><img src="https://img.shields.io/github/issues/enviodev/hyperindex.svg" alt="GitHub issues" /></a>
|
|
7
|
+
<a href="https://github.com/enviodev/hyperindex/graphs/contributors"><img src="https://img.shields.io/github/contributors/enviodev/hyperindex.svg" alt="GitHub contributors" /></a>
|
|
8
|
+
<a href="https://discord.gg/DhfFhzuJQh"><img src="https://img.shields.io/badge/Discord-Join%20Chat-7289da?logo=discord&logoColor=white" alt="Discord" /></a>
|
|
9
|
+
<a href="https://github.com/enviodev/hyperindex/stargazers"><img src="https://img.shields.io/github/stars/enviodev/hyperindex.svg" alt="GitHub stars" /></a>
|
|
10
|
+
</p>
|
|
11
|
+
<p>
|
|
12
|
+
<a href="https://docs.envio.dev">Documentation</a> ·
|
|
13
|
+
<a href="https://envio.dev">Hosted Service</a> ·
|
|
14
|
+
<a href="https://discord.gg/DhfFhzuJQh">Discord</a> ·
|
|
15
|
+
<a href="https://docs.envio.dev/blog/best-blockchain-indexers-2026">Benchmarks</a>
|
|
16
|
+
</p>
|
|
17
|
+
</div>
|
|
2
18
|
|
|
3
|
-
|
|
19
|
+
---
|
|
20
|
+
## What is HyperIndex?
|
|
4
21
|
|
|
5
|
-
HyperIndex is
|
|
22
|
+
HyperIndex is Envio's full-featured blockchain indexing framework. It transforms onchain events into structured, queryable databases with GraphQL APIs, built for developers who care about performance and a clean local experience.
|
|
6
23
|
|
|
7
|
-
|
|
8
|
-
> For hosted services and other solutions, visit [envio.dev](https://envio.dev).
|
|
24
|
+
Powered by [HyperSync](https://docs.envio.dev/docs/HyperSync/overview), Envio's proprietary data engine, HyperIndex delivers up to 2000x faster data access than traditional RPC endpoints. That's the difference between syncing in minutes instead of days.
|
|
9
25
|
|
|
10
|
-

|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Why HyperIndex?
|
|
31
|
+
|
|
32
|
+
Most blockchain indexers are bottlenecked by RPC. HyperIndex isn't. HyperSync, the data engine underneath, is a purpose-built, Rust-based query layer that retrieves multiple blocks per round trip, cuts out the overhead, and makes historical backfills genuinely fast.
|
|
33
|
+
|
|
34
|
+
Independent benchmarks run by Sentio confirm it:
|
|
35
|
+
|
|
36
|
+
- **Uniswap V2 Factory** (May 2025): HyperIndex completed in 1 minute. 15x faster than the nearest competitor (Subsquid), 143x faster than The Graph, 158x faster than Ponder
|
|
37
|
+
- **LBTC Token with RPC calls** (April 2025): HyperIndex completed in 3 minutes vs 3 hours 9 minutes for The Graph
|
|
38
|
+
|
|
39
|
+
[View full benchmark results →](https://docs.envio.dev/docs/HyperIndex/benchmarks)
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## What you can build?
|
|
44
|
+
|
|
45
|
+
HyperIndex and HyperSync are the data layer for DeFi dashboards, protocol analytics, block explorers, stablecoin monitors, liquidation trackers, oracle comparisons, NFT explorers, and any application that needs fast, structured onchain data.
|
|
46
|
+
|
|
47
|
+
A few things already running in production:
|
|
48
|
+
|
|
49
|
+
- [v4.xyz](https://v4.xyz): the hub for Uniswap V4 data and analytics, indexing across 10 chains in real-time
|
|
50
|
+
- [Stable Volume](https://www.stablevolume.com/): real-time stablecoin transaction monitoring across 10+ chains
|
|
51
|
+
- [Stable Radar](https://stable-radar.com): real-time USDC transaction dashboard across multiple chains
|
|
52
|
+
- [Liqo](https://liqo.xyz): multichain liquidation tracking for DeFi lending protocols
|
|
53
|
+
- [Safe Stats](https://safe-stats.vercel.app/): real-time analytics for Safe multisig activity across all chains
|
|
54
|
+
- [Oracle Wars](https://oraclewars.xyz/): real-time oracle price comparison across multiple oracles
|
|
55
|
+
- [Chain Density](https://chaindensity.xyz/): transaction and event density analysis for any address across 70+ chains
|
|
56
|
+
- [LogTUI](https://www.npmjs.com/package/logtui): terminal UI for monitoring blockchain events in real-time
|
|
57
|
+
|
|
58
|
+
[See the full showcase →](https://docs.envio.dev/showcase)
|
|
59
|
+
|
|
60
|
+
---
|
|
11
61
|
|
|
12
62
|
## Key Features
|
|
13
63
|
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
64
|
+
**Performance**
|
|
65
|
+
- Historical backfills at 10,000+ events per second
|
|
66
|
+
- Up to 2000x faster than traditional RPC via HyperSync (enabled by default, no config required)
|
|
67
|
+
- Sync times reduced from days to minutes
|
|
68
|
+
- Fallback RPC support for reliability without touching your indexer code
|
|
69
|
+
|
|
70
|
+
**Multichain indexing**
|
|
71
|
+
- Index EVM, SVM, and Fuel blockchains from a single indexer
|
|
72
|
+
- 70+ EVM chains with native HyperSync support, plus any EVM chain via RPC
|
|
73
|
+
- Unordered multichain mode for maximum throughput across chains
|
|
74
|
+
- Real-time indexing with reorg handling built in
|
|
75
|
+
|
|
76
|
+
**Developer experience**
|
|
77
|
+
- Auto-generate an indexer directly from a smart contract address or ABI, no manual setup required
|
|
78
|
+
- Write handlers in TypeScript, JavaScript, or ReScript
|
|
79
|
+
- Full local development environment with Docker
|
|
80
|
+
- GraphQL API generated automatically from your schema
|
|
81
|
+
- Wildcard topic indexing: index by event signatures across any contract, not just specified addresses
|
|
82
|
+
- Factory contract support for 1M+ dynamically registered contracts
|
|
83
|
+
- Onchain and off-chain data integration
|
|
84
|
+
- External API actions triggered by blockchain events
|
|
85
|
+
- Detailed logging and error reporting
|
|
86
|
+
|
|
87
|
+
**Deployment**
|
|
88
|
+
- Managed [hosted service](https://docs.envio.dev/docs/HyperIndex/hosted-service) with static endpoints, built-in alerts, and production-ready infrastructure
|
|
89
|
+
- Self-hosted via Docker
|
|
90
|
+
- No vendor lock-in. Switch between HyperSync and RPC at any time
|
|
91
|
+
|
|
92
|
+
**Agentic development**
|
|
93
|
+
- HyperIndex is the default indexing framework for AI-assisted and agentic workflows via Envio's hosted service CLI (`envio-cloud`) and Claude skills
|
|
94
|
+
- An agent can scaffold, configure, and deploy a production-ready indexer without touching a config file. [400,000 events indexed in ~20 seconds](https://docs.envio.dev/blog/agentic-blockchain-indexing-envio-hyperindex)
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Getting started
|
|
99
|
+
|
|
100
|
+
**Requirements**: Node.js, Docker (only needed for local development)
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
npx envio init
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
This scaffolds your entire indexer project, config, schema, and handler functions, in seconds. You can generate from a contract address, choose from templates, or start from an existing example.
|
|
107
|
+
|
|
108
|
+
From there, three files define your indexer:
|
|
109
|
+
|
|
110
|
+
- `config.yaml` — networks, contracts, events, and indexing behaviour
|
|
111
|
+
- `schema.graphql` — the shape of your indexed data
|
|
112
|
+
- `src/EventHandlers.*` — your handler logic in TypeScript, JavaScript, or ReScript
|
|
113
|
+
|
|
114
|
+
[Full getting started guide →](https://docs.envio.dev/docs/HyperIndex/getting-started)
|
|
29
115
|
|
|
30
|
-
|
|
116
|
+
---
|
|
31
117
|
|
|
32
|
-
|
|
118
|
+
## HyperSync
|
|
33
119
|
|
|
34
|
-
|
|
120
|
+
HyperSync is the data engine that makes HyperIndex fast. It's active by default for all supported networks, no configuration needed.
|
|
35
121
|
|
|
36
|
-
|
|
122
|
+
Instead of making individual RPC calls per block, HyperSync retrieves multiple data points per round trip with advanced filtering. The result: sync speeds up to 2000x faster than standard RPC, dramatically lower infrastructure costs, and no rate limit headaches on supported networks.
|
|
37
123
|
|
|
38
|
-
|
|
124
|
+
HyperSync can also be used directly for custom data pipelines in Python, Rust, Node.js, and Go, independent of HyperIndex.
|
|
125
|
+
|
|
126
|
+
[HyperSync docs →](https://docs.envio.dev/docs/HyperSync/overview)
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Supported networks
|
|
131
|
+
|
|
132
|
+
HyperIndex supports any EVM-compatible L1, L2, or L3, plus Fuel and Solana (experimental). 70+ chains have native HyperSync support for maximum speed. For any EVM chain not on the HyperSync list, RPC-based indexing works out of the box.
|
|
133
|
+
|
|
134
|
+
[Full network list →](https://docs.envio.dev/docs/HyperIndex/supported-networks)
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Migrating from The Graph, Ponder, or Subsquid
|
|
139
|
+
|
|
140
|
+
HyperIndex has a dedicated migration guide that covers config conversion, schema mapping, and query differences in 3 steps. Envio also offers white-glove migration support. Reach out on Discord and the team will help you get set up.
|
|
141
|
+
|
|
142
|
+
Teams migrating from The Graph can access 2 months of free hosting and full migration support.
|
|
143
|
+
|
|
144
|
+
[Migration guide →](https://docs.envio.dev/docs/HyperIndex/migration-guide)
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## Documentation
|
|
149
|
+
|
|
150
|
+
Full documentation lives at [docs.envio.dev](https://docs.envio.dev).
|
|
151
|
+
|
|
152
|
+
Key sections:
|
|
153
|
+
- [Getting Started](https://docs.envio.dev/docs/HyperIndex/getting-started)
|
|
154
|
+
- [Contract Import / Auto-generation](https://docs.envio.dev/docs/HyperIndex/contract-import)
|
|
155
|
+
- [Multichain Indexing](https://docs.envio.dev/docs/HyperIndex/multichain-indexing)
|
|
156
|
+
- [Wildcard Indexing](https://docs.envio.dev/docs/HyperIndex/wildcard-indexing)
|
|
157
|
+
- [Reorg Support](https://docs.envio.dev/docs/HyperIndex/reorgs-support)
|
|
158
|
+
- [Hosted Service](https://docs.envio.dev/docs/HyperIndex/hosted-service)
|
|
159
|
+
- [HyperSync as Data Source](https://docs.envio.dev/docs/HyperIndex/hypersync)
|
|
160
|
+
- [Migration Guide](https://docs.envio.dev/docs/HyperIndex/migration-guide)
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
## Community and support
|
|
39
165
|
|
|
40
166
|
- Follow us on [X](https://twitter.com/envio_indexer)
|
|
41
|
-
- Join
|
|
42
|
-
-
|
|
43
|
-
-
|
|
167
|
+
- Join the [Discord](https://discord.gg/DhfFhzuJQh), fastest way to get help
|
|
168
|
+
- Open an issue on [GitHub](https://github.com/enviodev/hyperindex/issues/new/choose)
|
|
169
|
+
- Browse [common issues](https://docs.envio.dev/docs/common-issues) for quick troubleshooting
|
|
170
|
+
|
|
171
|
+
If HyperIndex is useful to you, a ⭐ on this repo goes a long way.
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
<div align="center">
|
|
176
|
+
|
|
177
|
+
Built by [Envio](https://envio.dev) · [Docs](https://docs.envio.dev)
|
|
44
178
|
|
|
45
|
-
|
|
179
|
+
</div>
|
package/bin.mjs
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
//@ts-check
|
|
3
|
+
|
|
4
|
+
import { spawnSync } from "child_process";
|
|
5
|
+
import { createRequire } from "module";
|
|
6
|
+
|
|
7
|
+
const require = createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Returns the executable path for envio located inside node_modules.
|
|
11
|
+
* The naming convention is envio-${os}-${arch}
|
|
12
|
+
* @see https://nodejs.org/api/os.html#osarch
|
|
13
|
+
* @see https://nodejs.org/api/os.html#osplatform
|
|
14
|
+
* @example "x/xx/node_modules/envio-darwin-arm64"
|
|
15
|
+
*/
|
|
16
|
+
function getExePath() {
|
|
17
|
+
const pkg = `envio-${process.platform}-${process.arch}`;
|
|
18
|
+
const bin = "bin/envio";
|
|
19
|
+
|
|
20
|
+
try {
|
|
21
|
+
return require.resolve(`${pkg}/${bin}`);
|
|
22
|
+
} catch {}
|
|
23
|
+
|
|
24
|
+
throw new Error(
|
|
25
|
+
`Couldn't find envio binary package "${pkg}".\n` +
|
|
26
|
+
`Checked: require.resolve("${pkg}/${bin}")\n` +
|
|
27
|
+
`If you're using pnpm, yarn, or npm with --omit=optional, ensure optional ` +
|
|
28
|
+
`dependencies are installed:\n` +
|
|
29
|
+
` npm install ${pkg}\n`
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Runs `envio` with args using nodejs spawn
|
|
35
|
+
*/
|
|
36
|
+
function runEnvio() {
|
|
37
|
+
const args = process.argv.slice(2);
|
|
38
|
+
const exePath = getExePath();
|
|
39
|
+
|
|
40
|
+
const processResult = spawnSync(exePath, args, { stdio: "inherit" });
|
|
41
|
+
|
|
42
|
+
if (processResult.error) {
|
|
43
|
+
console.error(`Failed to run envio binary at ${exePath}: ${processResult.error.message}`);
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
process.exit(processResult.status ?? 1);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
runEnvio();
|
package/evm.schema.json
CHANGED
|
@@ -15,17 +15,6 @@
|
|
|
15
15
|
"description": "Name of the project",
|
|
16
16
|
"type": "string"
|
|
17
17
|
},
|
|
18
|
-
"ecosystem": {
|
|
19
|
-
"description": "Ecosystem of the project.",
|
|
20
|
-
"anyOf": [
|
|
21
|
-
{
|
|
22
|
-
"$ref": "#/$defs/EcosystemTag"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
"type": "null"
|
|
26
|
-
}
|
|
27
|
-
]
|
|
28
|
-
},
|
|
29
18
|
"schema": {
|
|
30
19
|
"description": "Custom path to schema.graphql file",
|
|
31
20
|
"type": [
|
|
@@ -40,6 +29,33 @@
|
|
|
40
29
|
"null"
|
|
41
30
|
]
|
|
42
31
|
},
|
|
32
|
+
"handlers": {
|
|
33
|
+
"description": "Optional relative path to handlers directory for auto-loading. Defaults to 'src/handlers' if not specified.",
|
|
34
|
+
"type": [
|
|
35
|
+
"string",
|
|
36
|
+
"null"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
"full_batch_size": {
|
|
40
|
+
"description": "Target number of events to be processed per batch. Set it to smaller number if you have many Effect API calls which are slow to resolve and can't be batched. (Default: 5000)",
|
|
41
|
+
"type": [
|
|
42
|
+
"integer",
|
|
43
|
+
"null"
|
|
44
|
+
],
|
|
45
|
+
"format": "uint64",
|
|
46
|
+
"minimum": 0
|
|
47
|
+
},
|
|
48
|
+
"ecosystem": {
|
|
49
|
+
"description": "Ecosystem of the project.",
|
|
50
|
+
"anyOf": [
|
|
51
|
+
{
|
|
52
|
+
"$ref": "#/$defs/EcosystemTag"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"type": "null"
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
},
|
|
43
59
|
"contracts": {
|
|
44
60
|
"description": "Global contract definitions that must contain all definitions except addresses. You can share a single handler/abi/event definitions for contracts across multiple chains.",
|
|
45
61
|
"type": [
|
|
@@ -54,31 +70,9 @@
|
|
|
54
70
|
"description": "Configuration of the blockchain chains that the project is deployed on.",
|
|
55
71
|
"type": "array",
|
|
56
72
|
"items": {
|
|
57
|
-
"$ref": "#/$defs/
|
|
73
|
+
"$ref": "#/$defs/Chain"
|
|
58
74
|
}
|
|
59
75
|
},
|
|
60
|
-
"multichain": {
|
|
61
|
-
"description": "Multichain mode: 'ordered' processes events across chains in order, 'unordered' processes chain events in order, but non-deterministically relatively to other chains (default: unordered)",
|
|
62
|
-
"anyOf": [
|
|
63
|
-
{
|
|
64
|
-
"$ref": "#/$defs/Multichain"
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"type": "null"
|
|
68
|
-
}
|
|
69
|
-
]
|
|
70
|
-
},
|
|
71
|
-
"event_decoder": {
|
|
72
|
-
"description": "The event decoder to use for the indexer (default: hypersync-client)",
|
|
73
|
-
"anyOf": [
|
|
74
|
-
{
|
|
75
|
-
"$ref": "#/$defs/EventDecoder"
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
"type": "null"
|
|
79
|
-
}
|
|
80
|
-
]
|
|
81
|
-
},
|
|
82
76
|
"rollback_on_reorg": {
|
|
83
77
|
"description": "A flag to indicate if the indexer should rollback to the last known valid block on a reorg. This currently incurs a performance hit on historical sync and is recommended to turn this off while developing (default: true)",
|
|
84
78
|
"type": [
|
|
@@ -121,13 +115,6 @@
|
|
|
121
115
|
"type": "null"
|
|
122
116
|
}
|
|
123
117
|
]
|
|
124
|
-
},
|
|
125
|
-
"handlers": {
|
|
126
|
-
"description": "Optional relative path to handlers directory for auto-loading. Defaults to 'src/handlers' if not specified.",
|
|
127
|
-
"type": [
|
|
128
|
-
"string",
|
|
129
|
-
"null"
|
|
130
|
-
]
|
|
131
118
|
}
|
|
132
119
|
},
|
|
133
120
|
"additionalProperties": false,
|
|
@@ -259,7 +246,6 @@
|
|
|
259
246
|
"root",
|
|
260
247
|
"status",
|
|
261
248
|
"yParity",
|
|
262
|
-
"chainId",
|
|
263
249
|
"accessList",
|
|
264
250
|
"maxFeePerBlobGas",
|
|
265
251
|
"blobVersionedHashes",
|
|
@@ -301,31 +287,20 @@
|
|
|
301
287
|
"mixHash"
|
|
302
288
|
]
|
|
303
289
|
},
|
|
304
|
-
"
|
|
290
|
+
"Chain": {
|
|
305
291
|
"type": "object",
|
|
306
292
|
"properties": {
|
|
307
293
|
"id": {
|
|
308
|
-
"description": "The public blockchain
|
|
294
|
+
"description": "The public blockchain chain ID.",
|
|
309
295
|
"type": "integer",
|
|
310
296
|
"format": "uint64",
|
|
311
297
|
"minimum": 0
|
|
312
298
|
},
|
|
313
|
-
"rpc_config": {
|
|
314
|
-
"description": "RPC configuration for utilizing as the network's data-source. Typically optional for chains with HyperSync support, which is highly recommended. HyperSync dramatically enhances performance, providing up to a 1000x speed boost over traditional RPC.",
|
|
315
|
-
"anyOf": [
|
|
316
|
-
{
|
|
317
|
-
"$ref": "#/$defs/RpcConfig"
|
|
318
|
-
},
|
|
319
|
-
{
|
|
320
|
-
"type": "null"
|
|
321
|
-
}
|
|
322
|
-
]
|
|
323
|
-
},
|
|
324
299
|
"rpc": {
|
|
325
|
-
"description": "RPC configuration for your indexer. If not specified otherwise, for
|
|
300
|
+
"description": "RPC configuration for your indexer. If not specified otherwise, for chains supported by HyperSync, RPC serves as a fallback for added reliability. For others, it acts as the primary data-source. HyperSync offers significant performance improvements, up to a 1000x faster than traditional RPC.",
|
|
326
301
|
"anyOf": [
|
|
327
302
|
{
|
|
328
|
-
"$ref": "#/$defs/
|
|
303
|
+
"$ref": "#/$defs/RpcSelection"
|
|
329
304
|
},
|
|
330
305
|
{
|
|
331
306
|
"type": "null"
|
|
@@ -343,89 +318,17 @@
|
|
|
343
318
|
}
|
|
344
319
|
]
|
|
345
320
|
},
|
|
346
|
-
"
|
|
321
|
+
"max_reorg_depth": {
|
|
347
322
|
"description": "The number of blocks from the head that the indexer should account for in case of reorgs.",
|
|
348
323
|
"type": [
|
|
349
324
|
"integer",
|
|
350
325
|
"null"
|
|
351
326
|
],
|
|
352
|
-
"format": "int32"
|
|
353
|
-
},
|
|
354
|
-
"start_block": {
|
|
355
|
-
"description": "The block at which the indexer should start ingesting data",
|
|
356
|
-
"type": "integer",
|
|
357
|
-
"format": "uint64",
|
|
358
|
-
"minimum": 0
|
|
359
|
-
},
|
|
360
|
-
"end_block": {
|
|
361
|
-
"description": "The block at which the indexer should terminate.",
|
|
362
|
-
"type": [
|
|
363
|
-
"integer",
|
|
364
|
-
"null"
|
|
365
|
-
],
|
|
366
|
-
"format": "uint64",
|
|
367
|
-
"minimum": 0
|
|
368
|
-
},
|
|
369
|
-
"contracts": {
|
|
370
|
-
"description": "All the contracts that should be indexed on the given network",
|
|
371
|
-
"type": "array",
|
|
372
|
-
"items": {
|
|
373
|
-
"$ref": "#/$defs/NetworkContract_for_ContractConfig"
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
},
|
|
377
|
-
"additionalProperties": false,
|
|
378
|
-
"required": [
|
|
379
|
-
"id",
|
|
380
|
-
"start_block",
|
|
381
|
-
"contracts"
|
|
382
|
-
]
|
|
383
|
-
},
|
|
384
|
-
"RpcConfig": {
|
|
385
|
-
"type": "object",
|
|
386
|
-
"properties": {
|
|
387
|
-
"url": {
|
|
388
|
-
"description": "URL of the RPC endpoint. Can be a single URL or an array of URLs. If multiple URLs are provided, the first one will be used as the primary RPC endpoint and the rest will be used as fallbacks.",
|
|
389
|
-
"anyOf": [
|
|
390
|
-
{
|
|
391
|
-
"type": "string"
|
|
392
|
-
},
|
|
393
|
-
{
|
|
394
|
-
"type": "array",
|
|
395
|
-
"items": {
|
|
396
|
-
"type": "string"
|
|
397
|
-
}
|
|
398
|
-
}
|
|
399
|
-
]
|
|
400
|
-
},
|
|
401
|
-
"initial_block_interval": {
|
|
402
|
-
"description": "The starting interval in range of blocks per query",
|
|
403
|
-
"type": [
|
|
404
|
-
"integer",
|
|
405
|
-
"null"
|
|
406
|
-
],
|
|
407
|
-
"format": "uint32",
|
|
408
|
-
"minimum": 0
|
|
409
|
-
},
|
|
410
|
-
"backoff_multiplicative": {
|
|
411
|
-
"description": "After an RPC error, how much to scale back the number of blocks requested at once",
|
|
412
|
-
"type": [
|
|
413
|
-
"number",
|
|
414
|
-
"null"
|
|
415
|
-
],
|
|
416
|
-
"format": "double"
|
|
417
|
-
},
|
|
418
|
-
"acceleration_additive": {
|
|
419
|
-
"description": "Without RPC errors or timeouts, how much to increase the number of blocks requested by for the next batch",
|
|
420
|
-
"type": [
|
|
421
|
-
"integer",
|
|
422
|
-
"null"
|
|
423
|
-
],
|
|
424
327
|
"format": "uint32",
|
|
425
328
|
"minimum": 0
|
|
426
329
|
},
|
|
427
|
-
"
|
|
428
|
-
"description": "
|
|
330
|
+
"block_lag": {
|
|
331
|
+
"description": "The number of blocks behind the chain head that the indexer should lag. Useful for avoiding reorg issues by indexing slightly behind the tip.",
|
|
429
332
|
"type": [
|
|
430
333
|
"integer",
|
|
431
334
|
"null"
|
|
@@ -433,40 +336,39 @@
|
|
|
433
336
|
"format": "uint32",
|
|
434
337
|
"minimum": 0
|
|
435
338
|
},
|
|
436
|
-
"
|
|
437
|
-
"description": "
|
|
438
|
-
"type":
|
|
439
|
-
|
|
440
|
-
"null"
|
|
441
|
-
],
|
|
442
|
-
"format": "uint32",
|
|
339
|
+
"start_block": {
|
|
340
|
+
"description": "The block at which the indexer should start ingesting data",
|
|
341
|
+
"type": "integer",
|
|
342
|
+
"format": "uint64",
|
|
443
343
|
"minimum": 0
|
|
444
344
|
},
|
|
445
|
-
"
|
|
446
|
-
"description": "
|
|
345
|
+
"end_block": {
|
|
346
|
+
"description": "The block at which the indexer should terminate.",
|
|
447
347
|
"type": [
|
|
448
348
|
"integer",
|
|
449
349
|
"null"
|
|
450
350
|
],
|
|
451
|
-
"format": "
|
|
351
|
+
"format": "uint64",
|
|
452
352
|
"minimum": 0
|
|
453
353
|
},
|
|
454
|
-
"
|
|
455
|
-
"description": "
|
|
354
|
+
"contracts": {
|
|
355
|
+
"description": "All the contracts that should be indexed on the given chain",
|
|
456
356
|
"type": [
|
|
457
|
-
"
|
|
357
|
+
"array",
|
|
458
358
|
"null"
|
|
459
359
|
],
|
|
460
|
-
"
|
|
461
|
-
|
|
360
|
+
"items": {
|
|
361
|
+
"$ref": "#/$defs/ChainContract_for_ContractConfig"
|
|
362
|
+
}
|
|
462
363
|
}
|
|
463
364
|
},
|
|
464
365
|
"additionalProperties": false,
|
|
465
366
|
"required": [
|
|
466
|
-
"
|
|
367
|
+
"id",
|
|
368
|
+
"start_block"
|
|
467
369
|
]
|
|
468
370
|
},
|
|
469
|
-
"
|
|
371
|
+
"RpcSelection": {
|
|
470
372
|
"anyOf": [
|
|
471
373
|
{
|
|
472
374
|
"type": "string"
|
|
@@ -490,8 +392,22 @@
|
|
|
490
392
|
"type": "string"
|
|
491
393
|
},
|
|
492
394
|
"for": {
|
|
493
|
-
"description": "Determines if this RPC is for historical sync, real-time chain indexing, or as a fallback.",
|
|
494
|
-
"
|
|
395
|
+
"description": "Determines if this RPC is for historical sync, real-time chain indexing, or as a fallback. If not specified, defaults to \"fallback\" when HyperSync is available for the chain, or \"sync\" otherwise.",
|
|
396
|
+
"anyOf": [
|
|
397
|
+
{
|
|
398
|
+
"$ref": "#/$defs/For"
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
"type": "null"
|
|
402
|
+
}
|
|
403
|
+
]
|
|
404
|
+
},
|
|
405
|
+
"ws": {
|
|
406
|
+
"description": "Optional WebSocket endpoint URL (wss:// or ws://) for real-time block header notifications via eth_subscribe(\"newHeads\"). Provides lower latency than HTTP polling for detecting new blocks.",
|
|
407
|
+
"type": [
|
|
408
|
+
"string",
|
|
409
|
+
"null"
|
|
410
|
+
]
|
|
495
411
|
},
|
|
496
412
|
"initial_block_interval": {
|
|
497
413
|
"description": "The starting interval in range of blocks per query",
|
|
@@ -554,12 +470,20 @@
|
|
|
554
470
|
],
|
|
555
471
|
"format": "uint32",
|
|
556
472
|
"minimum": 0
|
|
473
|
+
},
|
|
474
|
+
"polling_interval": {
|
|
475
|
+
"description": "How frequently (in milliseconds) to check for new blocks in realtime. Default is 1000ms. Note: Setting this higher than block time does not reduce RPC usage as every block is still fetched to check for reorgs.",
|
|
476
|
+
"type": [
|
|
477
|
+
"integer",
|
|
478
|
+
"null"
|
|
479
|
+
],
|
|
480
|
+
"format": "uint32",
|
|
481
|
+
"minimum": 0
|
|
557
482
|
}
|
|
558
483
|
},
|
|
559
484
|
"additionalProperties": false,
|
|
560
485
|
"required": [
|
|
561
|
-
"url"
|
|
562
|
-
"for"
|
|
486
|
+
"url"
|
|
563
487
|
]
|
|
564
488
|
},
|
|
565
489
|
"For": {
|
|
@@ -594,7 +518,7 @@
|
|
|
594
518
|
"url"
|
|
595
519
|
]
|
|
596
520
|
},
|
|
597
|
-
"
|
|
521
|
+
"ChainContract_for_ContractConfig": {
|
|
598
522
|
"type": "object",
|
|
599
523
|
"properties": {
|
|
600
524
|
"name": {
|
|
@@ -606,7 +530,7 @@
|
|
|
606
530
|
"$ref": "#/$defs/Addresses"
|
|
607
531
|
},
|
|
608
532
|
"start_block": {
|
|
609
|
-
"description": "The block at which the indexer should start ingesting data for this specific contract. If not specified, uses the
|
|
533
|
+
"description": "The block at which the indexer should start ingesting data for this specific contract. If not specified, uses the chain start_block. Can be greater than the chain start_block for more specific indexing.",
|
|
610
534
|
"type": [
|
|
611
535
|
"integer",
|
|
612
536
|
"null"
|
|
@@ -672,20 +596,6 @@
|
|
|
672
596
|
}
|
|
673
597
|
]
|
|
674
598
|
},
|
|
675
|
-
"Multichain": {
|
|
676
|
-
"type": "string",
|
|
677
|
-
"enum": [
|
|
678
|
-
"ordered",
|
|
679
|
-
"unordered"
|
|
680
|
-
]
|
|
681
|
-
},
|
|
682
|
-
"EventDecoder": {
|
|
683
|
-
"type": "string",
|
|
684
|
-
"enum": [
|
|
685
|
-
"viem",
|
|
686
|
-
"hypersync-client"
|
|
687
|
-
]
|
|
688
|
-
},
|
|
689
599
|
"AddressFormat": {
|
|
690
600
|
"type": "string",
|
|
691
601
|
"enum": [
|