envio 3.6.1 → 3.7.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/index.d.ts +197 -9
- package/package.json +6 -6
- package/src/Batch.res +64 -25
- package/src/Batch.res.mjs +69 -46
- package/src/ChainFetching.res +13 -17
- package/src/ChainFetching.res.mjs +9 -14
- package/src/ChainState.res +160 -119
- package/src/ChainState.res.mjs +75 -46
- package/src/ChainState.resi +15 -12
- package/src/Config.res +18 -2
- package/src/Config.res.mjs +9 -6
- package/src/Core.res +20 -0
- package/src/Core.res.mjs +11 -0
- package/src/Ecosystem.res +0 -1
- package/src/Envio.res +16 -3
- package/src/EventConfigBuilder.res +155 -40
- package/src/EventConfigBuilder.res.mjs +76 -24
- package/src/EventProcessing.res +10 -14
- package/src/EventProcessing.res.mjs +12 -10
- package/src/EventUtils.res +3 -47
- package/src/FetchState.res +124 -104
- package/src/FetchState.res.mjs +116 -100
- package/src/HandlerLoader.res +20 -8
- package/src/HandlerLoader.res.mjs +11 -2
- package/src/HandlerRegister.res +108 -2
- package/src/HandlerRegister.res.mjs +59 -10
- package/src/HandlerRegister.resi +4 -0
- package/src/InMemoryStore.res +1 -6
- package/src/InMemoryStore.res.mjs +1 -3
- package/src/Internal.res +84 -24
- package/src/Internal.res.mjs +33 -2
- package/src/LazyLoader.res +12 -11
- package/src/LazyLoader.res.mjs +13 -7
- package/src/Main.res +22 -9
- package/src/Main.res.mjs +18 -5
- package/src/MemoryStorage.res +756 -0
- package/src/MemoryStorage.res.mjs +623 -0
- package/src/Persistence.res +4 -2
- package/src/PgStorage.res +24 -8
- package/src/PgStorage.res.mjs +15 -12
- package/src/ReorgDetection.res +0 -222
- package/src/ReorgDetection.res.mjs +0 -163
- package/src/Rollback.res +14 -15
- package/src/Rollback.res.mjs +4 -5
- package/src/SimulateItems.res +2 -2
- package/src/UserContext.res +358 -51
- package/src/UserContext.res.mjs +271 -35
- package/src/Utils.res +3 -0
- package/src/bindings/ClickHouse.res +16 -11
- package/src/bindings/ClickHouse.res.mjs +10 -10
- package/src/bindings/Vitest.res +1 -1
- package/src/sources/BlockStore.res +115 -5
- package/src/sources/BlockStore.res.mjs +25 -0
- package/src/sources/Evm.res +0 -1
- package/src/sources/Evm.res.mjs +0 -1
- package/src/sources/EvmHyperSyncSource.res +19 -84
- package/src/sources/EvmHyperSyncSource.res.mjs +24 -60
- package/src/sources/Fuel.res +24 -4
- package/src/sources/Fuel.res.mjs +23 -3
- package/src/sources/FuelHyperSync.res +8 -3
- package/src/sources/FuelHyperSync.res.mjs +5 -4
- package/src/sources/FuelHyperSync.resi +3 -1
- package/src/sources/FuelHyperSyncClient.res +7 -10
- package/src/sources/FuelHyperSyncSource.res +18 -45
- package/src/sources/FuelHyperSyncSource.res.mjs +18 -35
- package/src/sources/HyperSync.res +49 -229
- package/src/sources/HyperSync.res.mjs +74 -191
- package/src/sources/HyperSync.resi +11 -35
- package/src/sources/HyperSyncClient.res +9 -79
- package/src/sources/HyperSyncClient.res.mjs +2 -6
- package/src/sources/RequestStat.res +5 -0
- package/src/sources/RequestStat.res.mjs +2 -0
- package/src/sources/RpcSource.res +149 -43
- package/src/sources/RpcSource.res.mjs +104 -41
- package/src/sources/SimulateSource.res +8 -5
- package/src/sources/SimulateSource.res.mjs +6 -6
- package/src/sources/Source.res +89 -16
- package/src/sources/Source.res.mjs +50 -1
- package/src/sources/SourceManager.res +255 -50
- package/src/sources/SourceManager.res.mjs +149 -55
- package/src/sources/SourceManager.resi +2 -6
- package/src/sources/Svm.res +0 -7
- package/src/sources/Svm.res.mjs +0 -8
- package/src/sources/SvmHyperSyncClient.res +21 -16
- package/src/sources/SvmHyperSyncClient.res.mjs +3 -4
- package/src/sources/SvmHyperSyncSource.res +25 -117
- package/src/sources/SvmHyperSyncSource.res.mjs +8 -121
- package/src/subgraph/blocks.ts +176 -0
- package/src/subgraph/calls.ts +217 -0
- package/src/subgraph/conformance.ts +99 -0
- package/src/subgraph/division.ts +110 -0
- package/src/subgraph/errors.ts +90 -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 +1871 -0
- package/src/subgraph/hosts.ts +148 -0
- package/src/subgraph/runtime.ts +845 -0
- package/src/subgraph/scope.ts +63 -0
- package/svm.schema.json +3 -2
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
|
|
3
|
+
/** What a wrapper is doing when it runs the mapping. */
|
|
4
|
+
export type Mode = "handler" | "register";
|
|
5
|
+
|
|
6
|
+
export type SubgraphSchema = {
|
|
7
|
+
timestampFields: Record<string, string[]>;
|
|
8
|
+
bytesIdEntities: string[];
|
|
9
|
+
entityListFields: Record<string, string[]>;
|
|
10
|
+
entityFields: Record<string, string[]>;
|
|
11
|
+
entityRefFields: Record<string, string[]>;
|
|
12
|
+
/** Each field as the subgraph schema declares it, which is what a mapping reads. */
|
|
13
|
+
entityFieldTypes: Record<string, Record<string, { kind: string; target?: string; list: boolean }>>;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type Scope = {
|
|
17
|
+
/** envio's handler or contractRegister context. */
|
|
18
|
+
context: any;
|
|
19
|
+
event: any;
|
|
20
|
+
mode: Mode;
|
|
21
|
+
schema: SubgraphSchema;
|
|
22
|
+
dataSource: {
|
|
23
|
+
name: string;
|
|
24
|
+
address: string;
|
|
25
|
+
chainId: number;
|
|
26
|
+
network: string;
|
|
27
|
+
/** The manifest's `context` entries, as `dataSource.context()` serves them. */
|
|
28
|
+
context: Record<string, { type: string; data: string }>;
|
|
29
|
+
};
|
|
30
|
+
/** Addresses already registered this round, so replays stay idempotent. */
|
|
31
|
+
registered: Set<string>;
|
|
32
|
+
/**
|
|
33
|
+
* Host results the register pass has resolved, keyed by effect and input.
|
|
34
|
+
* The register pass has no envio context to run effects through, so it
|
|
35
|
+
* replays the mapping itself and answers from here (§5, register mode).
|
|
36
|
+
*/
|
|
37
|
+
resolved?: Map<string, { value?: unknown; error?: unknown }>;
|
|
38
|
+
/** Lookups the current register round is waiting on. */
|
|
39
|
+
awaiting?: Promise<unknown>[];
|
|
40
|
+
/** The block a contract call is evaluated against, as graph-node does. */
|
|
41
|
+
blockNumber: number;
|
|
42
|
+
/** The mapping module, so `ipfs.map` can reach the callback it names. */
|
|
43
|
+
mappingExports: Record<string, any>;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
const storage = new AsyncLocalStorage<Scope>();
|
|
47
|
+
|
|
48
|
+
export function runInScope<T>(scope: Scope, fn: () => T): T {
|
|
49
|
+
return storage.run(scope, fn);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function currentScope(): Scope {
|
|
53
|
+
const scope = storage.getStore();
|
|
54
|
+
if (!scope) {
|
|
55
|
+
throw new Error(
|
|
56
|
+
"A graph-ts API was called outside of a mapping handler. Envio Subgraph " +
|
|
57
|
+
"runs mappings inside a scope that carries the event and the store; " +
|
|
58
|
+
"calling into graph-ts from module top-level or from a detached " +
|
|
59
|
+
"callback escapes it.",
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
return scope;
|
|
63
|
+
}
|
package/svm.schema.json
CHANGED
|
@@ -511,7 +511,7 @@
|
|
|
511
511
|
"type": "string",
|
|
512
512
|
"enum": [
|
|
513
513
|
"transactionIndex",
|
|
514
|
-
"
|
|
514
|
+
"signature",
|
|
515
515
|
"feePayer",
|
|
516
516
|
"success",
|
|
517
517
|
"err",
|
|
@@ -519,7 +519,8 @@
|
|
|
519
519
|
"computeUnitsConsumed",
|
|
520
520
|
"accountKeys",
|
|
521
521
|
"recentBlockhash",
|
|
522
|
-
"version"
|
|
522
|
+
"version",
|
|
523
|
+
"allSignatures"
|
|
523
524
|
]
|
|
524
525
|
},
|
|
525
526
|
"SvmBlockField": {
|