@secondlayer/sdk 6.25.1 → 6.26.1

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/index.d.ts CHANGED
@@ -988,6 +988,16 @@ type IndexEventBase = {
988
988
  tx_index: number
989
989
  event_index: number
990
990
  contract_id: string | null
991
+ /** Submitting-transaction context, present only when `txContext: true` was
992
+ * requested. `tx_sender` is the real tx sender — distinct from a transfer's
993
+ * asset `sender`, and the only place a `print` event's sender is available.
994
+ * Lets a consumer build per-event tx context without a `/v1/index/transactions`
995
+ * call per event. */
996
+ tx_sender?: string | null
997
+ tx_type?: string | null
998
+ tx_status?: string | null
999
+ tx_contract_id?: string | null
1000
+ tx_function_name?: string | null
991
1001
  };
992
1002
  type IndexFtTransfer = IndexEventBase & {
993
1003
  event_type: "ft_transfer"
@@ -1084,6 +1094,11 @@ type EventsListParams = {
1084
1094
  /** Restrict to contracts conforming to a trait/standard (e.g. "sip-010").
1085
1095
  * Mutually exclusive with contractId; contract-keyed event types only. */
1086
1096
  trait?: string
1097
+ /** Join the submitting transaction into each event — populates `tx_sender`,
1098
+ * `tx_type`, `tx_status`, `tx_contract_id`, `tx_function_name`. Off by default.
1099
+ * Avoids a `/v1/index/transactions` call per event; for `print` events it's
1100
+ * the only source of the submitting sender. */
1101
+ txContext?: boolean
1087
1102
  };
1088
1103
  type EventsWalkParams = Omit<EventsListParams, "limit"> & {
1089
1104
  batchSize?: number
package/dist/index.js CHANGED
@@ -234,11 +234,7 @@ function buildAggregateQueryString(params) {
234
234
  return str ? `?${str}` : "";
235
235
  }
236
236
  function buildSpecQueryString(options) {
237
- const qs = new URLSearchParams;
238
- if (options?.serverUrl)
239
- qs.set("server", options.serverUrl);
240
- const str = qs.toString();
241
- return str ? `?${str}` : "";
237
+ return buildQuery({ server: options?.serverUrl });
242
238
  }
243
239
 
244
240
  class Subgraphs extends BaseClient {
@@ -267,18 +263,15 @@ class Subgraphs extends BaseClient {
267
263
  return this.request("POST", `/api/subgraphs/${name}/backfill`, options);
268
264
  }
269
265
  async gaps(name, opts) {
270
- const qs = new URLSearchParams;
271
- if (opts?.limit !== undefined)
272
- qs.set("_limit", String(opts.limit));
273
- if (opts?.offset !== undefined)
274
- qs.set("_offset", String(opts.offset));
275
- if (opts?.resolved !== undefined)
276
- qs.set("resolved", String(opts.resolved));
277
- const query = qs.toString();
278
- return this.request("GET", `/api/subgraphs/${name}/gaps${query ? `?${query}` : ""}`);
266
+ const qs = buildQuery({
267
+ _limit: opts?.limit,
268
+ _offset: opts?.offset,
269
+ resolved: opts?.resolved
270
+ });
271
+ return this.request("GET", `/api/subgraphs/${name}/gaps${qs}`);
279
272
  }
280
273
  async delete(name, options) {
281
- const qs = options?.force ? "?force=true" : "";
274
+ const qs = buildQuery({ force: options?.force ? true : undefined });
282
275
  return this.request("DELETE", `/api/subgraphs/${name}${qs}`);
283
276
  }
284
277
  async publish(name) {
@@ -768,6 +761,7 @@ class Index extends BaseClient {
768
761
  recipient: params.recipient,
769
762
  trait: params.trait,
770
763
  toHeight: params.toHeight,
764
+ txContext: params.txContext,
771
765
  cursor,
772
766
  fromHeight,
773
767
  limit
@@ -904,7 +898,8 @@ class Index extends BaseClient {
904
898
  recipient: params.recipient,
905
899
  from_height: params.fromHeight,
906
900
  to_height: params.toHeight,
907
- trait: params.trait
901
+ trait: params.trait,
902
+ tx_context: params.txContext ? "true" : undefined
908
903
  })}`);
909
904
  }
910
905
  async* walkEvents(params) {
@@ -2515,5 +2510,5 @@ export {
2515
2510
  ApiError
2516
2511
  };
2517
2512
 
2518
- //# debugId=9B0B41D8F5C2671064756E2164756E21
2513
+ //# debugId=9CF567397C67375464756E2164756E21
2519
2514
  //# sourceMappingURL=index.js.map