@secondlayer/sdk 6.27.1 → 6.28.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.
@@ -1374,6 +1374,9 @@ type IndexSbtcWithdrawal = {
1374
1374
  recipient_btc_version: number | null
1375
1375
  recipient_btc_hashbytes: string | null
1376
1376
  sweep_txid: string | null
1377
+ /** BTC L1 settlement of the committed sweep: true once confirmed, false while
1378
+ * pending, null when there is no sweep yet (REQUESTED). */
1379
+ settlement_confirmed: boolean | null
1377
1380
  requested_at?: string | null
1378
1381
  resolved_at?: string | null
1379
1382
  };
@@ -1402,6 +1405,10 @@ type IndexSbtcWithdrawalDetail = {
1402
1405
  sweep_txid: string | null
1403
1406
  btc_confirmations: number | null
1404
1407
  settlement_confirmed: boolean | null
1408
+ /** Confirming Bitcoin block height; null until the sweep confirms. */
1409
+ btc_block_height: number | null
1410
+ /** ISO timestamp the sweep first crossed the confirmation threshold. */
1411
+ confirmed_at: string | null
1405
1412
  }
1406
1413
  finalized: boolean
1407
1414
  };
@@ -1503,6 +1510,9 @@ type SbtcWithdrawalsListParams = {
1503
1510
  status?: SbtcWithdrawalStatus
1504
1511
  sender?: string
1505
1512
  requestId?: number
1513
+ /** Filter by BTC L1 settlement: true → only confirmed sweeps; false → not
1514
+ * yet confirmed (pending or no sweep). */
1515
+ settlementConfirmed?: boolean
1506
1516
  fromHeight?: number
1507
1517
  toHeight?: number
1508
1518
  };
@@ -203,44 +203,24 @@ function resolveOrderByColumn(col) {
203
203
 
204
204
  // src/subgraphs/client.ts
205
205
  function buildSubgraphQueryString(params) {
206
- const qs = new URLSearchParams;
207
- if (params.sort)
208
- qs.set("_sort", params.sort);
209
- if (params.order)
210
- qs.set("_order", params.order);
211
- if (params.limit !== undefined)
212
- qs.set("_limit", String(params.limit));
213
- if (params.offset !== undefined)
214
- qs.set("_offset", String(params.offset));
215
- if (params.fields)
216
- qs.set("_fields", params.fields);
217
- if (params.filters) {
218
- for (const [key, value] of Object.entries(params.filters)) {
219
- qs.set(key, String(value));
220
- }
221
- }
222
- const str = qs.toString();
223
- return str ? `?${str}` : "";
206
+ return buildQuery({
207
+ _sort: params.sort,
208
+ _order: params.order,
209
+ _limit: params.limit,
210
+ _offset: params.offset,
211
+ _fields: params.fields,
212
+ ...params.filters
213
+ });
224
214
  }
225
215
  function buildAggregateQueryString(params) {
226
- const qs = new URLSearchParams;
227
- if (params.filters) {
228
- for (const [key, value] of Object.entries(params.filters)) {
229
- qs.set(key, String(value));
230
- }
231
- }
232
- if (params.count)
233
- qs.set("_count", "true");
234
- if (params.countDistinct?.length)
235
- qs.set("_countDistinct", params.countDistinct.join(","));
236
- if (params.sum?.length)
237
- qs.set("_sum", params.sum.join(","));
238
- if (params.min?.length)
239
- qs.set("_min", params.min.join(","));
240
- if (params.max?.length)
241
- qs.set("_max", params.max.join(","));
242
- const str = qs.toString();
243
- return str ? `?${str}` : "";
216
+ return buildQuery({
217
+ ...params.filters,
218
+ _count: params.count ? "true" : undefined,
219
+ _countDistinct: params.countDistinct,
220
+ _sum: params.sum,
221
+ _min: params.min,
222
+ _max: params.max
223
+ });
244
224
  }
245
225
  function buildSpecQueryString(options) {
246
226
  return buildQuery({ server: options?.serverUrl });
@@ -373,13 +353,11 @@ class Subgraphs extends BaseClient {
373
353
  },
374
354
  subscribe(onRow, options = {}) {
375
355
  const filters = options.where ? serializeWhere(options.where) : {};
376
- const qs = new URLSearchParams;
377
- for (const [k, v] of Object.entries(filters))
378
- qs.set(k, String(v));
379
- if (options.since != null)
380
- qs.set("since", String(options.since));
381
- const query = qs.toString();
382
- const url = `${self.baseUrl}/api/subgraphs/${subgraphName}/${tableName}/stream${query ? `?${query}` : ""}`;
356
+ const qs = buildQuery({
357
+ ...filters,
358
+ since: options.since ?? undefined
359
+ });
360
+ const url = `${self.baseUrl}/api/subgraphs/${subgraphName}/${tableName}/stream${qs}`;
383
361
  const ES = globalThis.EventSource;
384
362
  if (!ES) {
385
363
  throw new Error("subscribe() needs a global EventSource (available in browsers and Node >= 22).");
@@ -1223,6 +1201,7 @@ class Index extends BaseClient {
1223
1201
  status: params.status,
1224
1202
  sender: params.sender,
1225
1203
  request_id: params.requestId,
1204
+ settlement_confirmed: params.settlementConfirmed,
1226
1205
  from_height: params.fromHeight,
1227
1206
  to_height: params.toHeight
1228
1207
  })}`);
@@ -1979,5 +1958,5 @@ export {
1979
1958
  Subgraphs
1980
1959
  };
1981
1960
 
1982
- //# debugId=31BD90E12F7B1B3B64756E2164756E21
1961
+ //# debugId=C6E77062B0832DE064756E2164756E21
1983
1962
  //# sourceMappingURL=index.js.map