@secondlayer/subgraphs 4.1.3 → 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.map +2 -2
- package/dist/src/runtime/block-processor.js.map +2 -2
- package/dist/src/runtime/catchup.js.map +2 -2
- package/dist/src/runtime/context.d.ts +13 -1
- package/dist/src/runtime/context.js.map +2 -2
- package/dist/src/runtime/processor.js.map +2 -2
- package/dist/src/runtime/reindex.js.map +2 -2
- package/dist/src/runtime/reorg.js.map +2 -2
- package/dist/src/runtime/runner.d.ts +13 -1
- package/dist/src/service.js.map +2 -2
- 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: {
|