@secondlayer/subgraphs 3.23.0 → 3.23.2

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.
@@ -1,4 +1,5 @@
1
1
  import { AbiContract as AbiContract2 } from "@secondlayer/stacks/clarity";
2
+ import { AssetIdentifier } from "@secondlayer/stacks/filters";
2
3
  import { UnwrapResponse } from "@secondlayer/stacks/actions";
3
4
  import { AbiContract, ExtractFunctionArgs, ExtractFunctionOutput, ExtractReadOnlyFunctions, ToCamelCase } from "@secondlayer/stacks/clarity";
4
5
  /**
@@ -188,38 +189,38 @@ interface FactoryScope {
188
189
  /** FT event filters */
189
190
  interface FtTransferFilter extends TraitScope {
190
191
  type: "ft_transfer";
191
- assetIdentifier?: string;
192
+ assetIdentifier?: AssetIdentifier;
192
193
  sender?: string;
193
194
  recipient?: string;
194
195
  minAmount?: bigint;
195
196
  }
196
197
  interface FtMintFilter extends TraitScope {
197
198
  type: "ft_mint";
198
- assetIdentifier?: string;
199
+ assetIdentifier?: AssetIdentifier;
199
200
  recipient?: string;
200
201
  minAmount?: bigint;
201
202
  }
202
203
  interface FtBurnFilter extends TraitScope {
203
204
  type: "ft_burn";
204
- assetIdentifier?: string;
205
+ assetIdentifier?: AssetIdentifier;
205
206
  sender?: string;
206
207
  minAmount?: bigint;
207
208
  }
208
209
  /** NFT event filters */
209
210
  interface NftTransferFilter extends TraitScope {
210
211
  type: "nft_transfer";
211
- assetIdentifier?: string;
212
+ assetIdentifier?: AssetIdentifier;
212
213
  sender?: string;
213
214
  recipient?: string;
214
215
  }
215
216
  interface NftMintFilter extends TraitScope {
216
217
  type: "nft_mint";
217
- assetIdentifier?: string;
218
+ assetIdentifier?: AssetIdentifier;
218
219
  recipient?: string;
219
220
  }
220
221
  interface NftBurnFilter extends TraitScope {
221
222
  type: "nft_burn";
222
- assetIdentifier?: string;
223
+ assetIdentifier?: AssetIdentifier;
223
224
  sender?: string;
224
225
  }
225
226
  /** Contract event filters */
@@ -276,7 +277,10 @@ type PrintField = ColumnType | {
276
277
  interface PrintEventFilter extends TraitScope, FactoryScope {
277
278
  type: "print_event";
278
279
  /** One contract id, or a set of them (max 20). Supports `*` wildcards.
279
- * Mutually exclusive with `trait`. */
280
+ * COMPOSES with `trait` — the matcher ANDs them, so the pair means
281
+ * "contracts conforming to this trait, narrowed to these ids". (The Index
282
+ * read API refuses the combination, but that is its query planner's
283
+ * constraint, not a semantic one.) */
280
284
  contractId?: string | readonly string[];
281
285
  topic?: string;
282
286
  /**
@@ -382,6 +386,31 @@ interface SubgraphDefinition {
382
386
  /** Handler functions — keys must match source names (or "*" for catch-all) */
383
387
  handlers: Record<string, SubgraphHandler>;
384
388
  }
389
+ interface MatchedTx {
390
+ tx: TxRecord;
391
+ events: EventRecord[];
392
+ /** Source object key — used for handler dispatch */
393
+ sourceName: string;
394
+ }
395
+ type TxRecord = {
396
+ tx_id: string
397
+ type: string
398
+ sender: string
399
+ status: string
400
+ /** Position within the block — the runner sorts dispatch into chain order. */
401
+ tx_index?: number
402
+ contract_id?: string | null
403
+ function_name?: string | null
404
+ function_args?: unknown | null
405
+ raw_result?: string | null
406
+ };
407
+ type EventRecord = {
408
+ id: string
409
+ tx_id: string
410
+ type: string
411
+ event_index: number
412
+ data: unknown
413
+ };
385
414
  import { Database as Database2 } from "@secondlayer/shared/db";
386
415
  import { Kysely as Kysely2, Transaction } from "kysely";
387
416
  type AnyDb = Kysely2<Database2> | Transaction<Database2>;
@@ -569,31 +598,6 @@ declare class SubgraphContext2 {
569
598
  private buildStatements;
570
599
  private validateTable;
571
600
  }
572
- interface MatchedTx {
573
- tx: TxRecord;
574
- events: EventRecord[];
575
- /** Source object key — used for handler dispatch */
576
- sourceName: string;
577
- }
578
- type TxRecord = {
579
- tx_id: string
580
- type: string
581
- sender: string
582
- status: string
583
- /** Position within the block — the runner sorts dispatch into chain order. */
584
- tx_index?: number
585
- contract_id?: string | null
586
- function_name?: string | null
587
- function_args?: unknown | null
588
- raw_result?: string | null
589
- };
590
- type EventRecord = {
591
- id: string
592
- tx_id: string
593
- type: string
594
- event_index: number
595
- data: unknown
596
- };
597
601
  interface RunResult {
598
602
  processed: number;
599
603
  errors: number;
@@ -1,4 +1,5 @@
1
1
  import { AbiContract as AbiContract2 } from "@secondlayer/stacks/clarity";
2
+ import { AssetIdentifier } from "@secondlayer/stacks/filters";
2
3
  /** Supported column types for subgraph schemas */
3
4
  type ColumnType = "text" | "uint" | "int" | "principal" | "boolean" | "timestamp" | "jsonb";
4
5
  /** STX event filters */
@@ -74,38 +75,38 @@ interface FactoryScope {
74
75
  /** FT event filters */
75
76
  interface FtTransferFilter extends TraitScope {
76
77
  type: "ft_transfer";
77
- assetIdentifier?: string;
78
+ assetIdentifier?: AssetIdentifier;
78
79
  sender?: string;
79
80
  recipient?: string;
80
81
  minAmount?: bigint;
81
82
  }
82
83
  interface FtMintFilter extends TraitScope {
83
84
  type: "ft_mint";
84
- assetIdentifier?: string;
85
+ assetIdentifier?: AssetIdentifier;
85
86
  recipient?: string;
86
87
  minAmount?: bigint;
87
88
  }
88
89
  interface FtBurnFilter extends TraitScope {
89
90
  type: "ft_burn";
90
- assetIdentifier?: string;
91
+ assetIdentifier?: AssetIdentifier;
91
92
  sender?: string;
92
93
  minAmount?: bigint;
93
94
  }
94
95
  /** NFT event filters */
95
96
  interface NftTransferFilter extends TraitScope {
96
97
  type: "nft_transfer";
97
- assetIdentifier?: string;
98
+ assetIdentifier?: AssetIdentifier;
98
99
  sender?: string;
99
100
  recipient?: string;
100
101
  }
101
102
  interface NftMintFilter extends TraitScope {
102
103
  type: "nft_mint";
103
- assetIdentifier?: string;
104
+ assetIdentifier?: AssetIdentifier;
104
105
  recipient?: string;
105
106
  }
106
107
  interface NftBurnFilter extends TraitScope {
107
108
  type: "nft_burn";
108
- assetIdentifier?: string;
109
+ assetIdentifier?: AssetIdentifier;
109
110
  sender?: string;
110
111
  }
111
112
  /** Contract event filters */
@@ -162,7 +163,10 @@ type PrintField = ColumnType | {
162
163
  interface PrintEventFilter extends TraitScope, FactoryScope {
163
164
  type: "print_event";
164
165
  /** One contract id, or a set of them (max 20). Supports `*` wildcards.
165
- * Mutually exclusive with `trait`. */
166
+ * COMPOSES with `trait` — the matcher ANDs them, so the pair means
167
+ * "contracts conforming to this trait, narrowed to these ids". (The Index
168
+ * read API refuses the combination, but that is its query planner's
169
+ * constraint, not a semantic one.) */
166
170
  contractId?: string | readonly string[];
167
171
  topic?: string;
168
172
  /**
@@ -3,8 +3,8 @@ interface ProcessBlockTiming {
3
3
  handlerMs: number;
4
4
  flushMs: number;
5
5
  }
6
- import { Database as Database2 } from "@secondlayer/shared/db";
7
- import { Kysely as Kysely2 } from "kysely";
6
+ import { Database as Database3 } from "@secondlayer/shared/db";
7
+ import { Kysely as Kysely3 } from "kysely";
8
8
  /**
9
9
  * Accumulates per-block timing stats and flushes to DB periodically.
10
10
  * One instance per subgraph during catchup/reindex/live processing.
@@ -17,7 +17,7 @@ declare class StatsAccumulator {
17
17
  constructor(subgraphName: string, isCatchup: boolean);
18
18
  record(timing: ProcessBlockTiming, opsCount: number): void;
19
19
  shouldFlush(): boolean;
20
- flush(db: Kysely2<Database2>): Promise<void>;
20
+ flush(db: Kysely3<Database3>): Promise<void>;
21
21
  private newEntry;
22
22
  }
23
23
  export { StatsAccumulator };
@@ -1,4 +1,5 @@
1
1
  import { AbiContract as AbiContract2 } from "@secondlayer/stacks/clarity";
2
+ import { AssetIdentifier } from "@secondlayer/stacks/filters";
2
3
  /**
3
4
  * How long a read stays valid.
4
5
  *
@@ -147,38 +148,38 @@ interface FactoryScope {
147
148
  /** FT event filters */
148
149
  interface FtTransferFilter extends TraitScope {
149
150
  type: "ft_transfer";
150
- assetIdentifier?: string;
151
+ assetIdentifier?: AssetIdentifier;
151
152
  sender?: string;
152
153
  recipient?: string;
153
154
  minAmount?: bigint;
154
155
  }
155
156
  interface FtMintFilter extends TraitScope {
156
157
  type: "ft_mint";
157
- assetIdentifier?: string;
158
+ assetIdentifier?: AssetIdentifier;
158
159
  recipient?: string;
159
160
  minAmount?: bigint;
160
161
  }
161
162
  interface FtBurnFilter extends TraitScope {
162
163
  type: "ft_burn";
163
- assetIdentifier?: string;
164
+ assetIdentifier?: AssetIdentifier;
164
165
  sender?: string;
165
166
  minAmount?: bigint;
166
167
  }
167
168
  /** NFT event filters */
168
169
  interface NftTransferFilter extends TraitScope {
169
170
  type: "nft_transfer";
170
- assetIdentifier?: string;
171
+ assetIdentifier?: AssetIdentifier;
171
172
  sender?: string;
172
173
  recipient?: string;
173
174
  }
174
175
  interface NftMintFilter extends TraitScope {
175
176
  type: "nft_mint";
176
- assetIdentifier?: string;
177
+ assetIdentifier?: AssetIdentifier;
177
178
  recipient?: string;
178
179
  }
179
180
  interface NftBurnFilter extends TraitScope {
180
181
  type: "nft_burn";
181
- assetIdentifier?: string;
182
+ assetIdentifier?: AssetIdentifier;
182
183
  sender?: string;
183
184
  }
184
185
  /** Contract event filters */
@@ -235,7 +236,10 @@ type PrintField = ColumnType | {
235
236
  interface PrintEventFilter extends TraitScope, FactoryScope {
236
237
  type: "print_event";
237
238
  /** One contract id, or a set of them (max 20). Supports `*` wildcards.
238
- * Mutually exclusive with `trait`. */
239
+ * COMPOSES with `trait` — the matcher ANDs them, so the pair means
240
+ * "contracts conforming to this trait, narrowed to these ids". (The Index
241
+ * read API refuses the combination, but that is its query planner's
242
+ * constraint, not a semantic one.) */
239
243
  contractId?: string | readonly string[];
240
244
  topic?: string;
241
245
  /**