@secondlayer/subgraphs 4.1.2 → 4.1.4
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/dist/src/index.d.ts +14 -2
- package/dist/src/index.js +28 -19
- package/dist/src/index.js.map +6 -6
- package/dist/src/runtime/block-processor.js.map +2 -2
- package/dist/src/runtime/catchup.js +25 -19
- package/dist/src/runtime/catchup.js.map +5 -5
- package/dist/src/runtime/context.d.ts +13 -1
- package/dist/src/runtime/context.js.map +2 -2
- package/dist/src/runtime/processor.js +28 -19
- package/dist/src/runtime/processor.js.map +6 -6
- package/dist/src/runtime/reindex.js +28 -19
- package/dist/src/runtime/reindex.js.map +6 -6
- package/dist/src/runtime/reorg.js +25 -19
- package/dist/src/runtime/reorg.js.map +5 -5
- package/dist/src/runtime/replay.js +4 -1
- package/dist/src/runtime/replay.js.map +3 -3
- package/dist/src/runtime/runner.d.ts +13 -1
- package/dist/src/service.js +28 -19
- package/dist/src/service.js.map +6 -6
- package/dist/src/testing/index.js.map +2 -2
- package/package.json +2 -2
package/dist/src/index.d.ts
CHANGED
|
@@ -53,12 +53,24 @@ interface ChainReadClient {
|
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
/**
|
|
56
|
+
* True for a structural empty mapped type (`{}`) and for codegen's
|
|
57
|
+
* `Record<string, never>`. `keyof Record<string, never>` is `string`, so the
|
|
58
|
+
* first check alone is not enough. Local copy of the `getContract` helper —
|
|
59
|
+
* importing `ContractInstance<C>["read"]` would re-enter the codegen-brand
|
|
60
|
+
* conditional this type exists to avoid.
|
|
61
|
+
*/
|
|
62
|
+
type IsEmptyArgs<A> = [keyof A & string] extends [never] ? true : Record<string, never> extends A ? true : false;
|
|
63
|
+
type ChainReadMethod<
|
|
64
|
+
A,
|
|
65
|
+
R
|
|
66
|
+
> = IsEmptyArgs<A> extends true ? (args?: A) => R : (args: A) => R;
|
|
67
|
+
/**
|
|
56
68
|
* The camelCased read methods of an ABI. Spelled out rather than reused from
|
|
57
69
|
* `ContractInstance<C>["read"]`: that type is a conditional over the codegen
|
|
58
70
|
* brand, and evaluating it wherever a subgraph definition is structurally
|
|
59
71
|
* compared pushes TS past its instantiation depth.
|
|
60
72
|
*/
|
|
61
|
-
type ChainReadMethods<C extends AbiContract> = { [N in ExtractReadOnlyFunctions<C> as ToCamelCase<N>] :
|
|
73
|
+
type ChainReadMethods<C extends AbiContract> = { [N in ExtractReadOnlyFunctions<C> as ToCamelCase<N>] : ChainReadMethod<ExtractFunctionArgs<C, N>, Promise<UnwrapResponse<ExtractFunctionOutput<C, N>>>> };
|
|
62
74
|
/**
|
|
63
75
|
* `ChainReadClient` with the ABI generic erased. Structurally cheap, so the
|
|
64
76
|
* base `SubgraphContext` can carry it; `TypedSubgraphContext` uses the real
|
|
@@ -76,7 +88,7 @@ interface ErasedChainReadClient {
|
|
|
76
88
|
* const token = readContractAt(ctx, contractId, SIP010_ABI, {
|
|
77
89
|
* cache: "contract-constant",
|
|
78
90
|
* });
|
|
79
|
-
* const decimals = await token.read.getDecimals(
|
|
91
|
+
* const decimals = await token.read.getDecimals(); // bigint
|
|
80
92
|
* ```
|
|
81
93
|
*/
|
|
82
94
|
declare function readContractAt<const C extends AbiContract>(ctx: {
|
package/dist/src/index.js
CHANGED
|
@@ -3421,6 +3421,9 @@ function decoderNamesForIndexEventTypes(eventTypes) {
|
|
|
3421
3421
|
function decoderNamesForSubgraph(subgraph) {
|
|
3422
3422
|
return decoderNamesForIndexEventTypes(referencedIndexEventTypes(subgraph));
|
|
3423
3423
|
}
|
|
3424
|
+
function usesDecodedIndexPlane(subgraph) {
|
|
3425
|
+
return process.env.SUBGRAPH_SOURCE === "streams-index" && isStreamsIndexEligible(subgraph);
|
|
3426
|
+
}
|
|
3424
3427
|
function committedHeight(cursor) {
|
|
3425
3428
|
if (!cursor)
|
|
3426
3429
|
return null;
|
|
@@ -3579,25 +3582,28 @@ async function catchUpSubgraph(subgraph, subgraphName) {
|
|
|
3579
3582
|
const rawTip = await source.getTip();
|
|
3580
3583
|
if (rawTip <= 0)
|
|
3581
3584
|
return 0;
|
|
3582
|
-
|
|
3583
|
-
if (
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
|
|
3597
|
-
|
|
3598
|
-
|
|
3585
|
+
let chainTip = rawTip;
|
|
3586
|
+
if (usesDecodedIndexPlane(subgraph)) {
|
|
3587
|
+
const bound = await boundSourceTip(rawTip, decoderNamesForSubgraph(subgraph));
|
|
3588
|
+
if (!bound.ok) {
|
|
3589
|
+
logger8.warn("Subgraph catch-up stalled: missing decoder checkpoint", {
|
|
3590
|
+
event: "subgraph_catchup_decoder_stall",
|
|
3591
|
+
subgraph: subgraphName,
|
|
3592
|
+
missing: bound.missing
|
|
3593
|
+
});
|
|
3594
|
+
return 0;
|
|
3595
|
+
}
|
|
3596
|
+
if (bound.floor !== null && bound.floor < rawTip) {
|
|
3597
|
+
logger8.debug("Subgraph catch-up tip bounded by decoder progress", {
|
|
3598
|
+
event: "subgraph_catchup_decoder_floor",
|
|
3599
|
+
subgraph: subgraphName,
|
|
3600
|
+
rawTip,
|
|
3601
|
+
floor: bound.floor,
|
|
3602
|
+
tip: bound.tip
|
|
3603
|
+
});
|
|
3604
|
+
}
|
|
3605
|
+
chainTip = bound.tip;
|
|
3599
3606
|
}
|
|
3600
|
-
const chainTip = bound.tip;
|
|
3601
3607
|
if (chainTip <= 0 || lastProcessedBlock >= chainTip)
|
|
3602
3608
|
return 0;
|
|
3603
3609
|
const subgraphStart = Number(subgraphRow.start_block) || 1;
|
|
@@ -4061,6 +4067,9 @@ async function resolveBlockRange(source, def, opts) {
|
|
|
4061
4067
|
const definitionStart = def.startBlock ?? 1;
|
|
4062
4068
|
const fromBlock = opts?.startBlockFloor != null ? Math.max(definitionStart, opts.startBlockFloor) : definitionStart;
|
|
4063
4069
|
const rawTip = await source.getTip();
|
|
4070
|
+
if (!usesDecodedIndexPlane(def)) {
|
|
4071
|
+
return { fromBlock, toBlock: rawTip };
|
|
4072
|
+
}
|
|
4064
4073
|
const bound = await boundSourceTip(rawTip, decoderNamesForSubgraph(def));
|
|
4065
4074
|
if (!bound.ok) {
|
|
4066
4075
|
logger10.warn("Reindex stalled: missing decoder checkpoint", {
|
|
@@ -5537,5 +5546,5 @@ export {
|
|
|
5537
5546
|
ChainReadError
|
|
5538
5547
|
};
|
|
5539
5548
|
|
|
5540
|
-
//# debugId=
|
|
5549
|
+
//# debugId=5A8D4A3C8F2C6DFE64756E2164756E21
|
|
5541
5550
|
//# sourceMappingURL=index.js.map
|