@secondlayer/sdk 6.25.0 → 6.26.0

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
@@ -2304,8 +2319,13 @@ type WebhookHeaderInput = HeaderLookup | StandardWebhooksHeaders | Record<string
2304
2319
  *
2305
2320
  * The signed content is `${id}.${timestamp}.${rawBody}` HMAC-SHA256 with the
2306
2321
  * signing secret. Secrets returned by `sl subscriptions create` (or
2307
- * `rotate-secret`) carry a `whsec_` prefix and are base64-decoded after the
2308
- * prefix is stripped, matching the Svix / Standard Webhooks convention.
2322
+ * `rotate-secret`) are a bare 64-character hex string used directly as the
2323
+ * HMAC key (its UTF-8 bytes) this helper handles that. A `whsec_`-prefixed
2324
+ * base64 secret (the Svix convention) is also accepted and base64-decoded after
2325
+ * the prefix is stripped. Note: because the issued secret is bare hex (no
2326
+ * `whsec_` prefix), a generic Svix / Standard Webhooks library will base64-
2327
+ * decode it and derive the wrong key — verify with this helper (or with
2328
+ * {@link verifySecondlayerSignature}, the format-agnostic ed25519 path).
2309
2329
  *
2310
2330
  * @param rawBody The raw request body as a string. NEVER pass
2311
2331
  * `JSON.stringify(req.body)` — re-stringifying drops
@@ -2319,9 +2339,10 @@ type WebhookHeaderInput = HeaderLookup | StandardWebhooksHeaders | Record<string
2319
2339
  * a header value by name. Header name matching is
2320
2340
  * case-insensitive.
2321
2341
  * @param secret The signing secret returned by
2322
- * `sl subscriptions create` / `rotateSecret`. Pass it
2323
- * through verbatim — the helper handles the `whsec_`
2324
- * prefix.
2342
+ * `sl subscriptions create` / `rotateSecret` (a bare
2343
+ * 64-char hex string). Pass it through verbatim — the
2344
+ * helper accepts both bare hex and `whsec_`-prefixed
2345
+ * base64 secrets.
2325
2346
  * @param toleranceSeconds Max age of `webhook-timestamp` in seconds. Default
2326
2347
  * 300 (5 min) per the Standard Webhooks spec.
2327
2348
  * @returns true if every header is present, the timestamp is within
package/dist/index.js CHANGED
@@ -768,6 +768,7 @@ class Index extends BaseClient {
768
768
  recipient: params.recipient,
769
769
  trait: params.trait,
770
770
  toHeight: params.toHeight,
771
+ txContext: params.txContext,
771
772
  cursor,
772
773
  fromHeight,
773
774
  limit
@@ -904,7 +905,8 @@ class Index extends BaseClient {
904
905
  recipient: params.recipient,
905
906
  from_height: params.fromHeight,
906
907
  to_height: params.toHeight,
907
- trait: params.trait
908
+ trait: params.trait,
909
+ tx_context: params.txContext ? "true" : undefined
908
910
  })}`);
909
911
  }
910
912
  async* walkEvents(params) {
@@ -2515,5 +2517,5 @@ export {
2515
2517
  ApiError
2516
2518
  };
2517
2519
 
2518
- //# debugId=9B0B41D8F5C2671064756E2164756E21
2520
+ //# debugId=997EE849532E462E64756E2164756E21
2519
2521
  //# sourceMappingURL=index.js.map