envio 3.15.0 → 3.16.0-subgraph
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 +40 -34
- package/evm.schema.json +11 -2
- package/fuel.schema.json +10 -1
- package/index.d.ts +6 -0
- package/licenses/README.md +1 -1
- package/package.json +10 -9
- package/src/Batch.res.mjs +5 -5
- package/src/BatchProcessing.res +1 -0
- package/src/BatchProcessing.res.mjs +1 -0
- package/src/Bin.res +7 -0
- package/src/Bin.res.mjs +8 -0
- package/src/ChainFetching.res +450 -16
- package/src/ChainFetching.res.mjs +403 -32
- package/src/ChainState.res +124 -7
- package/src/ChainState.res.mjs +128 -67
- package/src/ChainState.resi +26 -0
- package/src/Clock.res +57 -0
- package/src/Clock.res.mjs +72 -0
- package/src/Config.res +31 -3
- package/src/Config.res.mjs +15 -4
- package/src/ContractRegisterContext.res +3 -6
- package/src/ContractRegisterContext.res.mjs +4 -2
- package/src/Core.res +95 -36
- package/src/Core.res.mjs +90 -1
- package/src/CrossChainState.res +12 -2
- package/src/CrossChainState.res.mjs +3 -3
- package/src/Ecosystem.res +7 -4
- package/src/Ecosystem.res.mjs +8 -8
- package/src/EffectCacheLookup.res +98 -0
- package/src/EffectCacheLookup.res.mjs +116 -0
- package/src/EffectState.res +10 -2
- package/src/EffectState.res.mjs +8 -4
- package/src/EffectState.resi +3 -1
- package/src/EntityId.res +2 -7
- package/src/EntityId.res.mjs +1 -8
- package/src/EntityTables.res +4 -1
- package/src/EntityTables.res.mjs +1 -1
- package/src/Env.res +20 -0
- package/src/Env.res.mjs +16 -0
- package/src/EventProcessing.res +38 -1
- package/src/EventProcessing.res.mjs +28 -1
- package/src/FetchState.res +408 -73
- package/src/FetchState.res.mjs +361 -91
- package/src/FinalizeBackfill.res +2 -4
- package/src/FinalizeBackfill.res.mjs +3 -4
- package/src/HandlerLoader.res +39 -15
- package/src/HandlerLoader.res.mjs +27 -8
- package/src/HandlerRegister.res +4 -0
- package/src/HandlerRegister.res.mjs +5 -2
- package/src/HandlerRegister.resi +2 -0
- package/src/InMemoryTable.res +17 -16
- package/src/InMemoryTable.res.mjs +14 -15
- package/src/IndexerState.res +28 -4
- package/src/IndexerState.res.mjs +19 -6
- package/src/IndexerState.resi +4 -0
- package/src/Internal.res +61 -49
- package/src/Internal.res.mjs +36 -80
- package/src/LoadLayer.res +54 -15
- package/src/LoadLayer.res.mjs +75 -45
- package/src/LoadLayer.resi +26 -0
- package/src/Main.res +14 -1
- package/src/Main.res.mjs +4 -3
- package/src/Persistence.res +3 -23
- package/src/Persistence.res.mjs +3 -3
- package/src/PreloadLookahead.res +202 -0
- package/src/PreloadLookahead.res.mjs +218 -0
- package/src/Rollback.res +0 -1
- package/src/Rollback.res.mjs +1 -1
- package/src/RunScope.res +3 -0
- package/src/SafeCheckpointTracking.res +4 -4
- package/src/SafeCheckpointTracking.res.mjs +1 -1
- package/src/SimulateItems.res +42 -26
- package/src/SimulateItems.res.mjs +40 -16
- package/src/StagedRows.res +106 -0
- package/src/StagedRows.res.mjs +102 -0
- package/src/Staging.res +32 -14
- package/src/Staging.res.mjs +17 -20
- package/src/Storage.res +303 -948
- package/src/Storage.res.mjs +229 -708
- package/src/SubgraphLog.res +19 -0
- package/src/SubgraphLog.res.mjs +26 -0
- package/src/Supervisor.res +75 -56
- package/src/Supervisor.res.mjs +55 -26
- package/src/SyncWrites.res +107 -0
- package/src/SyncWrites.res.mjs +98 -0
- package/src/TestIndexer.res +22 -27
- package/src/TestIndexer.res.mjs +20 -17
- package/src/Throttler.res +15 -8
- package/src/Throttler.res.mjs +9 -6
- package/src/Throttler.resi +1 -1
- package/src/UserContext.res +419 -46
- package/src/UserContext.res.mjs +318 -30
- package/src/Utils.res +17 -6
- package/src/Utils.res.mjs +12 -6
- package/src/Writing.res +0 -1
- package/src/Writing.res.mjs +1 -1
- package/src/bindings/ClickHouse.res +0 -322
- package/src/bindings/ClickHouse.res.mjs +0 -338
- package/src/bindings/StorageClient.res +108 -174
- package/src/bindings/StorageClient.res.mjs +19 -8
- package/src/bindings/Vitest.res +0 -26
- package/src/bindings/Vitest.res.mjs +0 -3
- package/src/db/Table.res +24 -150
- package/src/db/Table.res.mjs +38 -272
- package/src/sources/AddressSet.res +2 -0
- package/src/sources/AddressStore.res +3 -0
- package/src/sources/CallSource.res +274 -0
- package/src/sources/CallSource.res.mjs +196 -0
- package/src/sources/ChainSources.res +2 -0
- package/src/sources/ChainSources.res.mjs +2 -2
- package/src/sources/EvmChain.res +10 -1
- package/src/sources/EvmChain.res.mjs +6 -3
- package/src/sources/EvmHyperSyncSource.res +2 -2
- package/src/sources/EvmHyperSyncSource.res.mjs +1 -1
- package/src/sources/EvmRpcClient.res +13 -3
- package/src/sources/EvmRpcClient.res.mjs +4 -3
- package/src/sources/EvmRpcWs.res +4 -3
- package/src/sources/EvmRpcWs.res.mjs +2 -2
- package/src/sources/HeightFeed.res +31 -10
- package/src/sources/HeightFeed.res.mjs +10 -6
- package/src/sources/HeightStream.res +32 -17
- package/src/sources/HeightStream.res.mjs +10 -10
- package/src/sources/HyperSync.res +2 -1
- package/src/sources/HyperSync.res.mjs +2 -1
- package/src/sources/HyperSyncSSE.res +4 -6
- package/src/sources/HyperSyncSSE.res.mjs +2 -2
- package/src/sources/RpcSource.res +10 -1
- package/src/sources/RpcSource.res.mjs +4 -3
- package/src/sources/Source.res +3 -0
- package/src/sources/SourceManager.res +84 -77
- package/src/sources/SourceManager.res.mjs +17 -20
- package/src/sources/SourceManager.resi +3 -4
- package/src/sources/StartBlockResolver.res +1 -0
- package/src/sources/StartBlockResolver.res.mjs +3 -2
- package/src/sources/SvmHyperSyncSource.res +2 -2
- package/src/sources/SvmHyperSyncSource.res.mjs +1 -1
- package/src/subgraph/abi-types.ts +84 -0
- package/src/subgraph/aggregations.ts +745 -0
- package/src/subgraph/as-package.ts +143 -0
- package/src/subgraph/assemblyscript-regex.ts +67 -0
- package/src/subgraph/assemblyscript.ts +731 -0
- package/src/subgraph/blocks.ts +398 -0
- package/src/subgraph/calls-source.ts +702 -0
- package/src/subgraph/calls.ts +258 -0
- package/src/subgraph/conformance.ts +106 -0
- package/src/subgraph/errors.ts +85 -0
- package/src/subgraph/graft.ts +73 -0
- package/src/subgraph/graph-cli-worker.mjs +35 -0
- package/src/subgraph/graph-cli.ts +900 -0
- package/src/subgraph/graph-node-decimal.ts +199 -0
- package/src/subgraph/graph-ts-enums.ts +28 -0
- package/src/subgraph/graph-ts-types/VERSION +2 -0
- package/src/subgraph/graph-ts-types/chain/arweave.d.ts +70 -0
- package/src/subgraph/graph-ts-types/chain/cosmos.d.ts +327 -0
- package/src/subgraph/graph-ts-types/chain/ethereum.d.ts +233 -0
- package/src/subgraph/graph-ts-types/chain/near.d.ts +253 -0
- package/src/subgraph/graph-ts-types/chain/starknet.d.ts +32 -0
- package/src/subgraph/graph-ts-types/common/collections.d.ts +136 -0
- package/src/subgraph/graph-ts-types/common/conversion.d.ts +11 -0
- package/src/subgraph/graph-ts-types/common/datasource.d.ts +30 -0
- package/src/subgraph/graph-ts-types/common/eager-offset.d.ts +0 -0
- package/src/subgraph/graph-ts-types/common/json.d.ts +17 -0
- package/src/subgraph/graph-ts-types/common/numbers.d.ts +120 -0
- package/src/subgraph/graph-ts-types/common/value.d.ts +120 -0
- package/src/subgraph/graph-ts-types/common/yaml.d.ts +90 -0
- package/src/subgraph/graph-ts-types/global/global.d.ts +194 -0
- package/src/subgraph/graph-ts-types/helper-functions.d.ts +22 -0
- package/src/subgraph/graph-ts-types/index.d.ts +102 -0
- package/src/subgraph/graph-ts.ts +4339 -0
- package/src/subgraph/hosts.ts +554 -0
- package/src/subgraph/log.ts +28 -0
- package/src/subgraph/receipts.ts +184 -0
- package/src/subgraph/register-slots.ts +93 -0
- package/src/subgraph/rollup.ts +109 -0
- package/src/subgraph/rpc.ts +337 -0
- package/src/subgraph/runtime.ts +2059 -0
- package/src/subgraph/scope.ts +176 -0
- package/src/subgraph/stats.ts +42 -0
- package/src/subgraph/template-instances.ts +66 -0
- package/src/subgraph/toolchain.ts +327 -0
- package/src/subgraph/transient.ts +176 -0
- package/svm.schema.json +11 -2
- package/src/PgWriting.res +0 -36
- package/src/PgWriting.res.mjs +0 -34
- package/src/db/IndexDefinition.res +0 -47
- package/src/db/IndexDefinition.res.mjs +0 -67
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<h1>HyperIndex
|
|
3
|
-
<p><strong>
|
|
2
|
+
<h1>HyperIndex</h1>
|
|
3
|
+
<p><strong>Build custom blockchain APIs and analytics. Real-time, with enterprise SLAs.</strong></p>
|
|
4
4
|
<p>
|
|
5
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
6
|
<a href="https://github.com/enviodev/hyperindex/issues"><img src="https://img.shields.io/github/issues/enviodev/hyperindex.svg" alt="GitHub issues" /></a>
|
|
@@ -10,18 +10,20 @@
|
|
|
10
10
|
</p>
|
|
11
11
|
<p>
|
|
12
12
|
<a href="https://docs.envio.dev">Documentation</a> ·
|
|
13
|
-
<a href="https://envio.dev">
|
|
13
|
+
<a href="https://envio.dev">Envio Cloud</a> ·
|
|
14
|
+
<a href="https://github.com/enviodev/open-indexer-benchmark">Benchmark</a> ·
|
|
15
|
+
<a href="https://docs.envio.dev/docs/HyperIndex/quickstart-with-ai">Build with AI</a> ·
|
|
14
16
|
<a href="https://discord.gg/DhfFhzuJQh">Discord</a> ·
|
|
15
|
-
<a href="https://
|
|
17
|
+
<a href="https://envio.dev/pricing">Contact sales</a>
|
|
16
18
|
</p>
|
|
17
19
|
</div>
|
|
18
20
|
|
|
19
21
|
---
|
|
20
22
|
## What is HyperIndex?
|
|
21
23
|
|
|
22
|
-
HyperIndex is Envio's
|
|
24
|
+
HyperIndex is Envio's blockchain indexing framework. Choose the contracts and events to track, write TypeScript handlers that shape the data, and HyperIndex keeps it up to date across EVM chains, Solana and Fuel, handles chain reorgs, and serves the result as a GraphQL API or direct Postgres/ClickHouse SQL.
|
|
23
25
|
|
|
24
|
-
|
|
26
|
+
It reads chain data through [HyperSync](https://docs.envio.dev/docs/HyperSync/overview), Envio's blockchain data API, which is up to 2,000x faster than JSON-RPC. Run it yourself with Docker, or deploy to [Envio Cloud](https://docs.envio.dev/docs/HyperIndex/hosted-service). Cloud starts with a free development plan and scales with your project up to Dedicated infrastructure with a 99.99% uptime SLA.
|
|
25
27
|
|
|
26
28
|

|
|
27
29
|
|
|
@@ -31,12 +33,9 @@ Powered by [HyperSync](https://docs.envio.dev/docs/HyperSync/overview), Envio's
|
|
|
31
33
|
|
|
32
34
|
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
35
|
|
|
34
|
-
|
|
36
|
+
The [open indexer benchmark](https://github.com/enviodev/open-indexer-benchmark) tracks current speed results across scenarios, and HyperIndex passes every reliability check. Every number there comes from code in the repository, so you can run it yourself.
|
|
35
37
|
|
|
36
|
-
|
|
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)
|
|
38
|
+
[How the benchmarks work →](https://docs.envio.dev/docs/HyperIndex/benchmarks)
|
|
40
39
|
|
|
41
40
|
---
|
|
42
41
|
|
|
@@ -44,15 +43,14 @@ Independent benchmarks run by Sentio confirm it:
|
|
|
44
43
|
|
|
45
44
|
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
45
|
|
|
47
|
-
A few
|
|
46
|
+
A few apps built with them, from the showcase:
|
|
48
47
|
|
|
49
|
-
- [v4.xyz](https://v4.xyz): the hub for Uniswap V4 data and analytics,
|
|
50
|
-
- [Stable Volume](https://www.stablevolume.com/): real-time stablecoin transaction monitoring across
|
|
48
|
+
- [v4.xyz](https://v4.xyz): the hub for Uniswap V4 data and analytics, indexed in real time across chains
|
|
49
|
+
- [Stable Volume](https://www.stablevolume.com/): real-time stablecoin transaction monitoring across chains
|
|
51
50
|
- [Stable Radar](https://stable-radar.com): real-time USDC transaction dashboard across multiple chains
|
|
52
51
|
- [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
52
|
- [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
|
|
53
|
+
- [Chain Density](https://chaindensity.xyz/): transaction and event density analysis for any address across chains
|
|
56
54
|
- [LogTUI](https://www.npmjs.com/package/logtui): terminal UI for monitoring blockchain events in real-time
|
|
57
55
|
|
|
58
56
|
[See the full showcase →](https://docs.envio.dev/showcase)
|
|
@@ -62,34 +60,33 @@ A few things already running in production:
|
|
|
62
60
|
## Key Features
|
|
63
61
|
|
|
64
62
|
**Performance**
|
|
65
|
-
- Historical backfills at
|
|
66
|
-
- Up to
|
|
67
|
-
- Sync times reduced from days to minutes
|
|
63
|
+
- Historical backfills at 100,000+ events per second ([benchmarking](https://docs.envio.dev/docs/HyperIndex/benchmarking))
|
|
64
|
+
- Up to 2,000x faster than JSON-RPC via HyperSync (on by default, no config required)
|
|
68
65
|
- Fallback RPC support for reliability without touching your indexer code
|
|
69
66
|
|
|
70
67
|
**Multichain indexing**
|
|
71
68
|
- Index EVM, SVM, and Fuel blockchains from a single indexer
|
|
72
|
-
-
|
|
69
|
+
- Every chain on the [HyperSync network list](https://docs.envio.dev/docs/HyperSync/hypersync-supported-networks), plus any EVM chain via RPC
|
|
73
70
|
- Real-time indexing with reorg handling built in
|
|
74
71
|
|
|
75
72
|
**Developer experience**
|
|
76
73
|
- Auto-generate an indexer directly from a smart contract address or ABI, no manual setup required
|
|
77
|
-
- Write handlers in TypeScript, JavaScript
|
|
74
|
+
- Write handlers in TypeScript or ReScript, and plain JavaScript handler files load too
|
|
78
75
|
- Full local development environment with Docker
|
|
79
76
|
- GraphQL API generated automatically from your schema
|
|
80
77
|
- Wildcard topic indexing: index by event signatures across any contract, not just specified addresses
|
|
81
|
-
- Factory contract support for
|
|
78
|
+
- Factory contract support for dynamically registered contracts
|
|
82
79
|
- Onchain and off-chain data integration
|
|
83
80
|
- External API actions triggered by blockchain events
|
|
84
81
|
- Detailed logging and error reporting
|
|
85
82
|
|
|
86
83
|
**Deployment**
|
|
87
|
-
-
|
|
84
|
+
- [Envio Cloud](https://docs.envio.dev/docs/HyperIndex/hosted-service), managed hosting with static endpoints and built-in alerts, from a free development plan up to Dedicated deployments with an SLA of up to 99.99% uptime
|
|
88
85
|
- Self-hosted via Docker
|
|
89
86
|
- No vendor lock-in. Switch between HyperSync and RPC at any time
|
|
90
87
|
|
|
91
88
|
**Agentic development**
|
|
92
|
-
-
|
|
89
|
+
- Build and deploy with an AI agent using the Envio Cloud CLI (`envio-cloud`) and the [HyperIndex skills](https://github.com/enviodev/hyperindex/tree/main/packages/cli/templates/static/shared/.claude/skills) that `envio init` adds to every project
|
|
93
90
|
- 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)
|
|
94
91
|
- Powerful built-in testing framework purpose-built for AI-driven development. Agents can write, run, and iterate on handler tests in a tight feedback loop, catching regressions before deploy
|
|
95
92
|
|
|
@@ -97,7 +94,7 @@ A few things already running in production:
|
|
|
97
94
|
|
|
98
95
|
## Getting started
|
|
99
96
|
|
|
100
|
-
**Requirements**: Node.js, Docker
|
|
97
|
+
**Requirements**: Node.js 22.15 or newer, and Docker for local development. pnpm is recommended.
|
|
101
98
|
|
|
102
99
|
```bash
|
|
103
100
|
pnpx envio init
|
|
@@ -119,7 +116,7 @@ From there, three files define your indexer:
|
|
|
119
116
|
|
|
120
117
|
HyperSync is the data engine that makes HyperIndex fast. It's active by default for all supported networks, no configuration needed.
|
|
121
118
|
|
|
122
|
-
Instead of making individual RPC calls per block, HyperSync retrieves multiple data points per round trip with advanced filtering. The result
|
|
119
|
+
Instead of making individual RPC calls per block, HyperSync retrieves multiple data points per round trip with advanced filtering. The result is sync speeds up to 2,000x faster than JSON-RPC, lower infrastructure costs, and no rate limits to work around on supported networks.
|
|
123
120
|
|
|
124
121
|
HyperSync can also be used directly for custom data pipelines in Python, Rust, Node.js, and Go, independent of HyperIndex.
|
|
125
122
|
|
|
@@ -129,19 +126,17 @@ HyperSync can also be used directly for custom data pipelines in Python, Rust, N
|
|
|
129
126
|
|
|
130
127
|
## Supported networks
|
|
131
128
|
|
|
132
|
-
HyperIndex supports any EVM-compatible L1, L2, or L3, plus Fuel and Solana (
|
|
129
|
+
HyperIndex supports any EVM-compatible L1, L2, or L3, plus Fuel and Solana. Chains on the [HyperSync network list](https://docs.envio.dev/docs/HyperSync/hypersync-supported-networks) get first-class HyperSync support. For any EVM chain not on the HyperSync list, RPC-based indexing works out of the box. Solana indexing runs on HyperSync for Solana, with instruction-level handlers and IDL-aware decoding.
|
|
133
130
|
|
|
134
131
|
[Full network list →](https://docs.envio.dev/docs/HyperIndex/supported-networks)
|
|
135
132
|
|
|
136
133
|
---
|
|
137
134
|
|
|
138
|
-
## Migrating
|
|
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.
|
|
135
|
+
## Migrating an existing indexer
|
|
141
136
|
|
|
142
|
-
|
|
137
|
+
The migration guides cover config conversion, schema mapping and query differences, and you can [migrate with an AI agent](https://docs.envio.dev/docs/HyperIndex/migrate-with-ai). If you run subgraphs, Envio can also migrate and host them for you with Subgraph Hosting, while your applications keep querying a subgraph-compatible endpoint. For hands-on help, see [services](https://envio.dev/pricing/services) or ask on Discord.
|
|
143
138
|
|
|
144
|
-
[Migration
|
|
139
|
+
[Migration guides →](https://docs.envio.dev/docs/HyperIndex/migration-guide)
|
|
145
140
|
|
|
146
141
|
---
|
|
147
142
|
|
|
@@ -155,16 +150,27 @@ Key sections:
|
|
|
155
150
|
- [Multichain Indexing](https://docs.envio.dev/docs/HyperIndex/multichain-indexing)
|
|
156
151
|
- [Wildcard Indexing](https://docs.envio.dev/docs/HyperIndex/wildcard-indexing)
|
|
157
152
|
- [Reorg Support](https://docs.envio.dev/docs/HyperIndex/reorgs-support)
|
|
158
|
-
- [
|
|
153
|
+
- [Envio Cloud](https://docs.envio.dev/docs/HyperIndex/hosted-service)
|
|
159
154
|
- [HyperSync as Data Source](https://docs.envio.dev/docs/HyperIndex/hypersync)
|
|
160
155
|
- [Migration Guide](https://docs.envio.dev/docs/HyperIndex/migration-guide)
|
|
161
156
|
|
|
162
157
|
---
|
|
163
158
|
|
|
159
|
+
## Build with an AI agent
|
|
160
|
+
|
|
161
|
+
HyperIndex works with Claude Code, Cursor, Codex and other coding agents.
|
|
162
|
+
|
|
163
|
+
- **Docs for agents.** Point your agent at [llms.txt](https://docs.envio.dev/llms.txt), or the full text at [llms-full.txt](https://docs.envio.dev/llms-full.txt).
|
|
164
|
+
- **Docs MCP server.** Add `https://docs.envio.dev/mcp` to your agent for `docs_search` and `docs_fetch`. See the [MCP server guide](https://docs.envio.dev/docs/HyperIndex/mcp-server).
|
|
165
|
+
- **Skills.** `pnpx envio init` adds the [HyperIndex skills](https://github.com/enviodev/hyperindex/tree/main/packages/cli/templates/static/shared/.claude/skills) to every new project. After upgrading `envio`, run `pnpm envio skills update` to refresh them.
|
|
166
|
+
- **Quickstart.** Follow [Quickstart with AI](https://docs.envio.dev/docs/HyperIndex/quickstart-with-ai) to go from a contract address to a deployed GraphQL API.
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
164
170
|
## Community and support
|
|
165
171
|
|
|
166
172
|
- Follow us on [X](https://twitter.com/envio_indexer)
|
|
167
|
-
- Join the [Discord](https://discord.gg/DhfFhzuJQh), fastest
|
|
173
|
+
- Join the [Discord](https://discord.gg/DhfFhzuJQh) or [Telegram](https://t.me/+BeS5ihVUFONjNGFk), the fastest ways to get help
|
|
168
174
|
- Open an issue on [GitHub](https://github.com/enviodev/hyperindex/issues/new/choose)
|
|
169
175
|
- Browse [common issues](https://docs.envio.dev/docs/common-issues) for quick troubleshooting
|
|
170
176
|
|
package/evm.schema.json
CHANGED
|
@@ -289,7 +289,7 @@
|
|
|
289
289
|
"type": "string"
|
|
290
290
|
},
|
|
291
291
|
"name": {
|
|
292
|
-
"description": "Name of the event in the
|
|
292
|
+
"description": "Name of the event in the generated types. When ommitted, the event field will be used. Should be unique per contract",
|
|
293
293
|
"type": [
|
|
294
294
|
"string",
|
|
295
295
|
"null"
|
|
@@ -421,7 +421,7 @@
|
|
|
421
421
|
]
|
|
422
422
|
},
|
|
423
423
|
"rpc": {
|
|
424
|
-
"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
|
|
424
|
+
"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 2000x faster than traditional RPC.",
|
|
425
425
|
"anyOf": [
|
|
426
426
|
{
|
|
427
427
|
"$ref": "#/$defs/RpcSelection"
|
|
@@ -460,6 +460,15 @@
|
|
|
460
460
|
"format": "uint32",
|
|
461
461
|
"minimum": 0
|
|
462
462
|
},
|
|
463
|
+
"block_throttle": {
|
|
464
|
+
"description": "Once caught up, wait for this many new blocks before fetching them. Delays new events by up to as many blocks.",
|
|
465
|
+
"type": [
|
|
466
|
+
"integer",
|
|
467
|
+
"null"
|
|
468
|
+
],
|
|
469
|
+
"format": "uint32",
|
|
470
|
+
"minimum": 0
|
|
471
|
+
},
|
|
463
472
|
"start_block": {
|
|
464
473
|
"description": "The block at which the indexer should start ingesting data, or \"latest\" to start from the chain's current head block when the indexer is first deployed. Once resolved, the concrete block is persisted and reused every time the indexer resumes normally (for example recovering from a crash), so downtime is backfilled instead of skipped. Running `envio start`/`dev` with -r (--restart) resets this like any other config change: \"latest\" resolves again, against the head at that time.",
|
|
465
474
|
"$ref": "#/$defs/StartBlock"
|
package/fuel.schema.json
CHANGED
|
@@ -241,7 +241,7 @@
|
|
|
241
241
|
"type": "object",
|
|
242
242
|
"properties": {
|
|
243
243
|
"name": {
|
|
244
|
-
"description": "Name of the event in the
|
|
244
|
+
"description": "Name of the event in the generated types",
|
|
245
245
|
"type": "string"
|
|
246
246
|
},
|
|
247
247
|
"type": {
|
|
@@ -336,6 +336,15 @@
|
|
|
336
336
|
"format": "uint32",
|
|
337
337
|
"minimum": 0
|
|
338
338
|
},
|
|
339
|
+
"block_throttle": {
|
|
340
|
+
"description": "Once caught up, wait for this many new blocks before fetching them. Delays new events by up to as many blocks.",
|
|
341
|
+
"type": [
|
|
342
|
+
"integer",
|
|
343
|
+
"null"
|
|
344
|
+
],
|
|
345
|
+
"format": "uint32",
|
|
346
|
+
"minimum": 0
|
|
347
|
+
},
|
|
339
348
|
"contracts": {
|
|
340
349
|
"description": "All the contracts that should be indexed on the given chain",
|
|
341
350
|
"type": [
|
package/index.d.ts
CHANGED
|
@@ -398,6 +398,8 @@ type EvmChainConfig<Id extends number = number> = {
|
|
|
398
398
|
readonly maxReorgDepth?: number;
|
|
399
399
|
/** Number of blocks behind the chain head to lag (default: 0). */
|
|
400
400
|
readonly blockLag?: number;
|
|
401
|
+
/** Once caught up, wait for this many new blocks before fetching them. Delays new events (default: 0). */
|
|
402
|
+
readonly blockThrottle?: number;
|
|
401
403
|
};
|
|
402
404
|
|
|
403
405
|
/** EVM chain value (for runtime Indexer). */
|
|
@@ -454,6 +456,8 @@ type FuelChainConfig<Id extends number = number> = {
|
|
|
454
456
|
readonly maxReorgDepth?: number;
|
|
455
457
|
/** Number of blocks behind the chain head to lag (default: 0). */
|
|
456
458
|
readonly blockLag?: number;
|
|
459
|
+
/** Once caught up, wait for this many new blocks before fetching them. Delays new events (default: 0). */
|
|
460
|
+
readonly blockThrottle?: number;
|
|
457
461
|
};
|
|
458
462
|
|
|
459
463
|
/** Fuel chain value (for runtime Indexer). */
|
|
@@ -490,6 +494,8 @@ type SvmChainConfig<Id extends number = number> = {
|
|
|
490
494
|
readonly maxReorgDepth?: number;
|
|
491
495
|
/** Number of blocks behind the chain head to lag (default: 0). */
|
|
492
496
|
readonly blockLag?: number;
|
|
497
|
+
/** Once caught up, wait for this many new slots before fetching them. Delays new instructions (default: 0). */
|
|
498
|
+
readonly blockThrottle?: number;
|
|
493
499
|
};
|
|
494
500
|
|
|
495
501
|
/** SVM chain value (for runtime Indexer). */
|
package/licenses/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Overview
|
|
4
4
|
|
|
5
|
-
Envio's licensing reflects open source ethos but is not OSI recognized. Developers can use Envio's services without vendor lock-in, either by self-hosting or specifying an RPC URL. The
|
|
5
|
+
Envio's licensing reflects open source ethos but is not OSI recognized. Developers can use Envio's services without vendor lock-in, either by self-hosting or specifying an RPC URL. The code in this repository is public.
|
|
6
6
|
|
|
7
7
|
Our licenses allows self-hosting but restricts third-party hosting with Envio's hosted service. Envio may consider open-sourcing in the future but prioritizes stakeholder interests and market traction. Please reach out to us on discord if you would like to explore hosting indexers as a third-party.
|
|
8
8
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "envio",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.16.0-subgraph",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A latency and sync speed optimized, developer friendly blockchain data indexer.",
|
|
6
6
|
"bin": "./bin.mjs",
|
|
@@ -43,16 +43,17 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"bignumber.js": "9.3.1",
|
|
45
45
|
"eventsource": "4.1.0",
|
|
46
|
-
"express": "4.
|
|
47
|
-
"@rescript/runtime": "12.
|
|
46
|
+
"express": "4.22.3",
|
|
47
|
+
"@rescript/runtime": "12.3.1",
|
|
48
48
|
"rescript-schema": "9.5.1",
|
|
49
|
-
"dotenv": "16.4.5"
|
|
49
|
+
"dotenv": "16.4.5",
|
|
50
|
+
"yaml": "2.8.1"
|
|
50
51
|
},
|
|
51
52
|
"optionalDependencies": {
|
|
52
|
-
"envio-linux-x64": "3.
|
|
53
|
-
"envio-linux-x64-musl": "3.
|
|
54
|
-
"envio-linux-arm64": "3.
|
|
55
|
-
"envio-darwin-x64": "3.
|
|
56
|
-
"envio-darwin-arm64": "3.
|
|
53
|
+
"envio-linux-x64": "3.16.0-subgraph",
|
|
54
|
+
"envio-linux-x64-musl": "3.16.0-subgraph",
|
|
55
|
+
"envio-linux-arm64": "3.16.0-subgraph",
|
|
56
|
+
"envio-darwin-x64": "3.16.0-subgraph",
|
|
57
|
+
"envio-darwin-arm64": "3.16.0-subgraph"
|
|
57
58
|
}
|
|
58
59
|
}
|
package/src/Batch.res.mjs
CHANGED
|
@@ -109,9 +109,9 @@ function make(sequence, frontier, chainsBeforeBatch, batchSizeTarget, history) {
|
|
|
109
109
|
chainEventsProcessed = chainEventsProcessed + 1;
|
|
110
110
|
}
|
|
111
111
|
if (blockNumber !== prevBlockNumber) {
|
|
112
|
-
let chainId = fetchState.chainId;
|
|
113
|
-
let fromBlockExclusive = prevBlockNumber;
|
|
114
112
|
let scannedHashes = chainBeforeBatch.scannedHashes;
|
|
113
|
+
let fromBlockExclusive = prevBlockNumber;
|
|
114
|
+
let chainId = fetchState.chainId;
|
|
115
115
|
if (chainBeforeBatch.shouldRollbackOnReorg) {
|
|
116
116
|
let blockNumbers = scannedHashes.blockNumbers;
|
|
117
117
|
let length = blockNumbers.length;
|
|
@@ -154,10 +154,10 @@ function make(sequence, frontier, chainsBeforeBatch, batchSizeTarget, history) {
|
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
156
|
let progressBlockNumberAfterBatch = FetchState.getProgressBlockNumberAt(fetchState, chainBatchSize);
|
|
157
|
-
let chainId$1 = fetchState.chainId;
|
|
158
|
-
let toBlockExclusive = progressBlockNumberAfterBatch + 1;
|
|
159
|
-
let fromBlockExclusive$1 = prevBlockNumber;
|
|
160
157
|
let scannedHashes$1 = chainBeforeBatch.scannedHashes;
|
|
158
|
+
let fromBlockExclusive$1 = prevBlockNumber;
|
|
159
|
+
let toBlockExclusive = progressBlockNumberAfterBatch + 1;
|
|
160
|
+
let chainId$1 = fetchState.chainId;
|
|
161
161
|
if (chainBeforeBatch.shouldRollbackOnReorg) {
|
|
162
162
|
let blockNumbers$1 = scannedHashes$1.blockNumbers;
|
|
163
163
|
let length$1 = blockNumbers$1.length;
|
package/src/BatchProcessing.res
CHANGED
|
@@ -108,6 +108,7 @@ async function startProcessing(state, runtime, scheduleFetch, scheduleRollback)
|
|
|
108
108
|
}
|
|
109
109
|
};
|
|
110
110
|
IndexerState.endProcessing(state);
|
|
111
|
+
IndexerState.reportArrivalAtHead(state);
|
|
111
112
|
if (IndexerState.isResolvingReorg(state)) {
|
|
112
113
|
return scheduleRollback();
|
|
113
114
|
} else if (!IndexerState.isStopped(state) && !Object.values(IndexerState.chainStates(state)).every(ChainState.isFetchingAtHead)) {
|
package/src/Bin.res
CHANGED
|
@@ -25,11 +25,16 @@ type startCmd = {
|
|
|
25
25
|
}
|
|
26
26
|
type migrateCmd = {reset: bool, config: JSON.t}
|
|
27
27
|
type dropSchemaCmd = {config: JSON.t}
|
|
28
|
+
type exitCmd = {code: int}
|
|
28
29
|
|
|
29
30
|
type command =
|
|
30
31
|
| Start(startCmd)
|
|
31
32
|
| Migrate(migrateCmd)
|
|
32
33
|
| DropSchema(dropSchemaCmd)
|
|
34
|
+
| Exit(exitCmd)
|
|
35
|
+
|
|
36
|
+
// `NodeJs.exitCode` only spells 0 and 1; `envio subgraph diff` also exits 2.
|
|
37
|
+
@send external exitWithStatus: (NodeJs.t, int) => unit = "exit"
|
|
33
38
|
|
|
34
39
|
let decodeCommand = (json: JSON.t): command => {
|
|
35
40
|
let obj = switch json->JSON.Decode.object {
|
|
@@ -44,6 +49,7 @@ let decodeCommand = (json: JSON.t): command => {
|
|
|
44
49
|
| "start" => Start(json->(Utils.magic: JSON.t => startCmd))
|
|
45
50
|
| "migrate" => Migrate(json->(Utils.magic: JSON.t => migrateCmd))
|
|
46
51
|
| "drop-schema" => DropSchema(json->(Utils.magic: JSON.t => dropSchemaCmd))
|
|
52
|
+
| "exit" => Exit(json->(Utils.magic: JSON.t => exitCmd))
|
|
47
53
|
| other => JsError.throwWithMessage(`Unknown command kind: ${other}`)
|
|
48
54
|
}
|
|
49
55
|
}
|
|
@@ -81,6 +87,7 @@ let run = async args => {
|
|
|
81
87
|
| DropSchema({config}) =>
|
|
82
88
|
Config.prime(config)
|
|
83
89
|
await Main.dropSchema(~logger)
|
|
90
|
+
| Exit({code}) => NodeJs.process->exitWithStatus(code)
|
|
84
91
|
}
|
|
85
92
|
}
|
|
86
93
|
}
|
package/src/Bin.res.mjs
CHANGED
|
@@ -39,6 +39,11 @@ function decodeCommand(json) {
|
|
|
39
39
|
TAG: "DropSchema",
|
|
40
40
|
_0: json
|
|
41
41
|
};
|
|
42
|
+
case "exit" :
|
|
43
|
+
return {
|
|
44
|
+
TAG: "Exit",
|
|
45
|
+
_0: json
|
|
46
|
+
};
|
|
42
47
|
case "migrate" :
|
|
43
48
|
return {
|
|
44
49
|
TAG: "Migrate",
|
|
@@ -88,6 +93,9 @@ async function run(args) {
|
|
|
88
93
|
case "DropSchema" :
|
|
89
94
|
Config.prime(match._0.config);
|
|
90
95
|
return await Main.dropSchema(logger);
|
|
96
|
+
case "Exit" :
|
|
97
|
+
Process.exit(match._0.code);
|
|
98
|
+
return;
|
|
91
99
|
}
|
|
92
100
|
} catch (raw_exn) {
|
|
93
101
|
let exn = Primitive_exceptions.internalToException(raw_exn);
|