@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.
- package/dist/index.d.ts +10 -0
- package/dist/index.js +23 -44
- package/dist/index.js.map +4 -4
- package/dist/subgraphs/index.d.ts +10 -0
- package/dist/subgraphs/index.js +23 -44
- package/dist/subgraphs/index.js.map +4 -4
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1450,6 +1450,9 @@ type IndexSbtcWithdrawal = {
|
|
|
1450
1450
|
recipient_btc_version: number | null
|
|
1451
1451
|
recipient_btc_hashbytes: string | null
|
|
1452
1452
|
sweep_txid: string | null
|
|
1453
|
+
/** BTC L1 settlement of the committed sweep: true once confirmed, false while
|
|
1454
|
+
* pending, null when there is no sweep yet (REQUESTED). */
|
|
1455
|
+
settlement_confirmed: boolean | null
|
|
1453
1456
|
requested_at?: string | null
|
|
1454
1457
|
resolved_at?: string | null
|
|
1455
1458
|
};
|
|
@@ -1478,6 +1481,10 @@ type IndexSbtcWithdrawalDetail = {
|
|
|
1478
1481
|
sweep_txid: string | null
|
|
1479
1482
|
btc_confirmations: number | null
|
|
1480
1483
|
settlement_confirmed: boolean | null
|
|
1484
|
+
/** Confirming Bitcoin block height; null until the sweep confirms. */
|
|
1485
|
+
btc_block_height: number | null
|
|
1486
|
+
/** ISO timestamp the sweep first crossed the confirmation threshold. */
|
|
1487
|
+
confirmed_at: string | null
|
|
1481
1488
|
}
|
|
1482
1489
|
finalized: boolean
|
|
1483
1490
|
};
|
|
@@ -1579,6 +1586,9 @@ type SbtcWithdrawalsListParams = {
|
|
|
1579
1586
|
status?: SbtcWithdrawalStatus
|
|
1580
1587
|
sender?: string
|
|
1581
1588
|
requestId?: number
|
|
1589
|
+
/** Filter by BTC L1 settlement: true → only confirmed sweeps; false → not
|
|
1590
|
+
* yet confirmed (pending or no sweep). */
|
|
1591
|
+
settlementConfirmed?: boolean
|
|
1582
1592
|
fromHeight?: number
|
|
1583
1593
|
toHeight?: number
|
|
1584
1594
|
};
|
package/dist/index.js
CHANGED
|
@@ -203,44 +203,24 @@ function resolveOrderByColumn(col) {
|
|
|
203
203
|
|
|
204
204
|
// src/subgraphs/client.ts
|
|
205
205
|
function buildSubgraphQueryString(params) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
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
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
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 =
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
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
|
})}`);
|
|
@@ -2656,5 +2635,5 @@ export {
|
|
|
2656
2635
|
ApiError
|
|
2657
2636
|
};
|
|
2658
2637
|
|
|
2659
|
-
//# debugId=
|
|
2638
|
+
//# debugId=560ACB6602920BFB64756E2164756E21
|
|
2660
2639
|
//# sourceMappingURL=index.js.map
|