envio 3.6.1-subgraph → 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 +13 -9
- package/src/Config.res.mjs +5 -8
- package/src/Core.res +5 -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 +4 -8
- package/src/EventProcessing.res.mjs +4 -4
- package/src/EventUtils.res +3 -47
- package/src/FetchState.res +124 -104
- package/src/FetchState.res.mjs +116 -100
- 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/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/calls.ts +5 -1
- package/src/subgraph/division.ts +10 -0
- package/src/subgraph/graph-ts.ts +180 -4
- package/src/subgraph/runtime.ts +22 -4
- package/svm.schema.json +3 -2
package/src/subgraph/runtime.ts
CHANGED
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
BigInt as GraphBigInt,
|
|
28
28
|
Bytes,
|
|
29
29
|
changetype,
|
|
30
|
+
retagChangetype,
|
|
30
31
|
installCallHook,
|
|
31
32
|
installHosts,
|
|
32
33
|
installRegisterHook,
|
|
@@ -36,7 +37,14 @@ import {
|
|
|
36
37
|
valueToJs,
|
|
37
38
|
} from "./graph-ts.ts";
|
|
38
39
|
import { encodeArg, decodeArg, makeCallEffect, resetClients } from "./calls.ts";
|
|
39
|
-
import {
|
|
40
|
+
import {
|
|
41
|
+
DIVIDE_HELPER,
|
|
42
|
+
RETAG_HELPER,
|
|
43
|
+
integerDivision,
|
|
44
|
+
loadTypeScript,
|
|
45
|
+
rewriteChangetype,
|
|
46
|
+
rewriteDivision,
|
|
47
|
+
} from "./division.ts";
|
|
40
48
|
import { makeHostEffects } from "./hosts.ts";
|
|
41
49
|
import { unsupported } from "./errors.ts";
|
|
42
50
|
|
|
@@ -118,7 +126,7 @@ function installResolveHook(root: string) {
|
|
|
118
126
|
const source = loaded?.source;
|
|
119
127
|
if (typeof source !== "string" && !(source instanceof Uint8Array)) return loaded;
|
|
120
128
|
const text = typeof source === "string" ? source : Buffer.from(source).toString("utf8");
|
|
121
|
-
return { ...loaded, source: rewriteDivision(text) };
|
|
129
|
+
return { ...loaded, source: rewriteChangetype(rewriteDivision(text)) };
|
|
122
130
|
},
|
|
123
131
|
});
|
|
124
132
|
|
|
@@ -126,6 +134,7 @@ function installResolveHook(root: string) {
|
|
|
126
134
|
const globals = globalThis as any;
|
|
127
135
|
globals.changetype ??= changetype;
|
|
128
136
|
globals[DIVIDE_HELPER] ??= integerDivision;
|
|
137
|
+
globals[RETAG_HELPER] ??= retagChangetype;
|
|
129
138
|
globals.assert ??= (value: unknown, message?: string) => {
|
|
130
139
|
if (!value) throw new Error(message ?? "assertion failed");
|
|
131
140
|
return value;
|
|
@@ -291,6 +300,15 @@ function shaped(fields: ShapeField[], raw: Record<string, unknown> | undefined)
|
|
|
291
300
|
return out;
|
|
292
301
|
}
|
|
293
302
|
|
|
303
|
+
/**
|
|
304
|
+
* envio capitalizes a contract name for the config it stores, so a data source
|
|
305
|
+
* whose manifest name starts lowercase — `crvUSD` — is `CrvUSD` by the time the
|
|
306
|
+
* runtime looks it up. Register under the name the config actually holds.
|
|
307
|
+
*/
|
|
308
|
+
function contractName(name: string): string {
|
|
309
|
+
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
310
|
+
}
|
|
311
|
+
|
|
294
312
|
/**
|
|
295
313
|
* The graph-ts `ethereum.Event` a mapping sees, built per event kind so the
|
|
296
314
|
* refusals and conversions live on a prototype rather than being installed on
|
|
@@ -758,7 +776,7 @@ export async function registerSubgraph(config: SubgraphConfig): Promise<void> {
|
|
|
758
776
|
});
|
|
759
777
|
|
|
760
778
|
indexer.onEvent(
|
|
761
|
-
{ contract: source.name, event: handler.name },
|
|
779
|
+
{ contract: contractName(source.name), event: handler.name },
|
|
762
780
|
async ({ event, context }: any) => {
|
|
763
781
|
const graphEvent = new SubgraphEvent(event);
|
|
764
782
|
await (context as any).runSync(() =>
|
|
@@ -772,7 +790,7 @@ export async function registerSubgraph(config: SubgraphConfig): Promise<void> {
|
|
|
772
790
|
// register mode, where writes and logs are no-ops and reads are null.
|
|
773
791
|
if (templateNames.size > 0) {
|
|
774
792
|
indexer.contractRegister(
|
|
775
|
-
{ contract: source.name, event: handler.name },
|
|
793
|
+
{ contract: contractName(source.name), event: handler.name },
|
|
776
794
|
async ({ event, context }: any) => {
|
|
777
795
|
const graphEvent = new SubgraphEvent(event);
|
|
778
796
|
await runRegisterRounds(makeScope(event, context, "register"), () => fn(graphEvent));
|
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": {
|