@secondlayer/sdk 6.27.2 → 6.28.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 +16 -0
- package/dist/index.js +33 -270
- package/dist/index.js.map +3 -3
- package/dist/subgraphs/index.d.ts +16 -0
- package/dist/subgraphs/index.js +33 -270
- package/dist/subgraphs/index.js.map +3 -3
- 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
|
};
|
|
@@ -1791,6 +1801,12 @@ declare class Index extends BaseClient {
|
|
|
1791
1801
|
readonly pox: PoxResource;
|
|
1792
1802
|
private listFtTransfers;
|
|
1793
1803
|
private listNftTransfers;
|
|
1804
|
+
/** Shared keyset-pagination loop for every `walk*` feed: seed the cursor from
|
|
1805
|
+
* `cursor`/`fromCursor` (and `fromHeight` 0 on the first page), then page until
|
|
1806
|
+
* the cursor stops advancing or a short page signals the tail. `list` merges the
|
|
1807
|
+
* resource's filter params; `itemsOf` selects the envelope's item array. PoX
|
|
1808
|
+
* cycles use a numeric cursor and are walked separately. */
|
|
1809
|
+
private keysetWalk;
|
|
1794
1810
|
private walkFtTransfers;
|
|
1795
1811
|
private walkNftTransfers;
|
|
1796
1812
|
private listEvents;
|
package/dist/index.js
CHANGED
|
@@ -835,55 +835,36 @@ class Index extends BaseClient {
|
|
|
835
835
|
to_height: params.toHeight
|
|
836
836
|
})}`);
|
|
837
837
|
}
|
|
838
|
-
async*
|
|
838
|
+
async* keysetWalk(params, list, itemsOf) {
|
|
839
839
|
const batchSize = params.batchSize ?? 200;
|
|
840
840
|
let cursor = params.cursor ?? params.fromCursor ?? null;
|
|
841
841
|
let firstPage = true;
|
|
842
842
|
while (!params.signal?.aborted) {
|
|
843
|
-
const envelope = await
|
|
844
|
-
...params,
|
|
843
|
+
const envelope = await list({
|
|
845
844
|
limit: batchSize,
|
|
846
845
|
cursor: firstPage ? params.cursor : cursor,
|
|
847
846
|
fromCursor: firstPage ? params.fromCursor : undefined,
|
|
848
847
|
fromHeight: firstPage ? firstWalkFromHeight(params) : undefined
|
|
849
848
|
});
|
|
850
|
-
|
|
849
|
+
const items = itemsOf(envelope);
|
|
850
|
+
for (const item of items) {
|
|
851
851
|
if (params.signal?.aborted)
|
|
852
852
|
return;
|
|
853
|
-
yield
|
|
853
|
+
yield item;
|
|
854
854
|
}
|
|
855
855
|
const nextCursor = envelope.next_cursor;
|
|
856
|
-
if (!nextCursor || nextCursor === cursor ||
|
|
856
|
+
if (!nextCursor || nextCursor === cursor || items.length < batchSize) {
|
|
857
857
|
return;
|
|
858
858
|
}
|
|
859
859
|
cursor = nextCursor;
|
|
860
860
|
firstPage = false;
|
|
861
861
|
}
|
|
862
862
|
}
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
const envelope = await this.listNftTransfers({
|
|
869
|
-
...params,
|
|
870
|
-
limit: batchSize,
|
|
871
|
-
cursor: firstPage ? params.cursor : cursor,
|
|
872
|
-
fromCursor: firstPage ? params.fromCursor : undefined,
|
|
873
|
-
fromHeight: firstPage ? firstWalkFromHeight(params) : undefined
|
|
874
|
-
});
|
|
875
|
-
for (const event of envelope.events) {
|
|
876
|
-
if (params.signal?.aborted)
|
|
877
|
-
return;
|
|
878
|
-
yield event;
|
|
879
|
-
}
|
|
880
|
-
const nextCursor = envelope.next_cursor;
|
|
881
|
-
if (!nextCursor || nextCursor === cursor || envelope.events.length < batchSize) {
|
|
882
|
-
return;
|
|
883
|
-
}
|
|
884
|
-
cursor = nextCursor;
|
|
885
|
-
firstPage = false;
|
|
886
|
-
}
|
|
863
|
+
walkFtTransfers(params = {}) {
|
|
864
|
+
return this.keysetWalk(params, (page) => this.listFtTransfers({ ...params, ...page }), (e) => e.events);
|
|
865
|
+
}
|
|
866
|
+
walkNftTransfers(params = {}) {
|
|
867
|
+
return this.keysetWalk(params, (page) => this.listNftTransfers({ ...params, ...page }), (e) => e.events);
|
|
887
868
|
}
|
|
888
869
|
async listEvents(params) {
|
|
889
870
|
return this.request("GET", `/v1/index/events${buildQuery({
|
|
@@ -901,30 +882,8 @@ class Index extends BaseClient {
|
|
|
901
882
|
tx_context: params.txContext ? "true" : undefined
|
|
902
883
|
})}`);
|
|
903
884
|
}
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
let cursor = params.cursor ?? params.fromCursor ?? null;
|
|
907
|
-
let firstPage = true;
|
|
908
|
-
while (!params.signal?.aborted) {
|
|
909
|
-
const envelope = await this.listEvents({
|
|
910
|
-
...params,
|
|
911
|
-
limit: batchSize,
|
|
912
|
-
cursor: firstPage ? params.cursor : cursor,
|
|
913
|
-
fromCursor: firstPage ? params.fromCursor : undefined,
|
|
914
|
-
fromHeight: firstPage ? firstWalkFromHeight(params) : undefined
|
|
915
|
-
});
|
|
916
|
-
for (const event of envelope.events) {
|
|
917
|
-
if (params.signal?.aborted)
|
|
918
|
-
return;
|
|
919
|
-
yield event;
|
|
920
|
-
}
|
|
921
|
-
const nextCursor = envelope.next_cursor;
|
|
922
|
-
if (!nextCursor || nextCursor === cursor || envelope.events.length < batchSize) {
|
|
923
|
-
return;
|
|
924
|
-
}
|
|
925
|
-
cursor = nextCursor;
|
|
926
|
-
firstPage = false;
|
|
927
|
-
}
|
|
885
|
+
walkEvents(params) {
|
|
886
|
+
return this.keysetWalk(params, (page) => this.listEvents({ ...params, ...page }), (e) => e.events);
|
|
928
887
|
}
|
|
929
888
|
async listContractCalls(params = {}) {
|
|
930
889
|
return this.request("GET", `/v1/index/contract-calls${buildQuery({
|
|
@@ -939,30 +898,8 @@ class Index extends BaseClient {
|
|
|
939
898
|
trait: params.trait
|
|
940
899
|
})}`);
|
|
941
900
|
}
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
let cursor = params.cursor ?? params.fromCursor ?? null;
|
|
945
|
-
let firstPage = true;
|
|
946
|
-
while (!params.signal?.aborted) {
|
|
947
|
-
const envelope = await this.listContractCalls({
|
|
948
|
-
...params,
|
|
949
|
-
limit: batchSize,
|
|
950
|
-
cursor: firstPage ? params.cursor : cursor,
|
|
951
|
-
fromCursor: firstPage ? params.fromCursor : undefined,
|
|
952
|
-
fromHeight: firstPage ? firstWalkFromHeight(params) : undefined
|
|
953
|
-
});
|
|
954
|
-
for (const call of envelope.contract_calls) {
|
|
955
|
-
if (params.signal?.aborted)
|
|
956
|
-
return;
|
|
957
|
-
yield call;
|
|
958
|
-
}
|
|
959
|
-
const nextCursor = envelope.next_cursor;
|
|
960
|
-
if (!nextCursor || nextCursor === cursor || envelope.contract_calls.length < batchSize) {
|
|
961
|
-
return;
|
|
962
|
-
}
|
|
963
|
-
cursor = nextCursor;
|
|
964
|
-
firstPage = false;
|
|
965
|
-
}
|
|
901
|
+
walkContractCalls(params = {}) {
|
|
902
|
+
return this.keysetWalk(params, (page) => this.listContractCalls({ ...params, ...page }), (e) => e.contract_calls);
|
|
966
903
|
}
|
|
967
904
|
async listCanonical(params = {}) {
|
|
968
905
|
return this.request("GET", `/v1/index/canonical${buildQuery({
|
|
@@ -973,30 +910,8 @@ class Index extends BaseClient {
|
|
|
973
910
|
to_height: params.toHeight
|
|
974
911
|
})}`);
|
|
975
912
|
}
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
let cursor = params.cursor ?? params.fromCursor ?? null;
|
|
979
|
-
let firstPage = true;
|
|
980
|
-
while (!params.signal?.aborted) {
|
|
981
|
-
const envelope = await this.listCanonical({
|
|
982
|
-
...params,
|
|
983
|
-
limit: batchSize,
|
|
984
|
-
cursor: firstPage ? params.cursor : cursor,
|
|
985
|
-
fromCursor: firstPage ? params.fromCursor : undefined,
|
|
986
|
-
fromHeight: firstPage ? firstWalkFromHeight(params) : undefined
|
|
987
|
-
});
|
|
988
|
-
for (const block of envelope.canonical) {
|
|
989
|
-
if (params.signal?.aborted)
|
|
990
|
-
return;
|
|
991
|
-
yield block;
|
|
992
|
-
}
|
|
993
|
-
const nextCursor = envelope.next_cursor;
|
|
994
|
-
if (!nextCursor || nextCursor === cursor || envelope.canonical.length < batchSize) {
|
|
995
|
-
return;
|
|
996
|
-
}
|
|
997
|
-
cursor = nextCursor;
|
|
998
|
-
firstPage = false;
|
|
999
|
-
}
|
|
913
|
+
walkCanonical(params = {}) {
|
|
914
|
+
return this.keysetWalk(params, (page) => this.listCanonical({ ...params, ...page }), (e) => e.canonical);
|
|
1000
915
|
}
|
|
1001
916
|
async listBlocks(params = {}) {
|
|
1002
917
|
return this.request("GET", `/v1/index/blocks${buildQuery({
|
|
@@ -1010,30 +925,8 @@ class Index extends BaseClient {
|
|
|
1010
925
|
async getBlock(ref) {
|
|
1011
926
|
return this.requestOrNull("GET", `/v1/index/blocks/${encodeURIComponent(String(ref))}`);
|
|
1012
927
|
}
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
let cursor = params.cursor ?? params.fromCursor ?? null;
|
|
1016
|
-
let firstPage = true;
|
|
1017
|
-
while (!params.signal?.aborted) {
|
|
1018
|
-
const envelope = await this.listBlocks({
|
|
1019
|
-
...params,
|
|
1020
|
-
limit: batchSize,
|
|
1021
|
-
cursor: firstPage ? params.cursor : cursor,
|
|
1022
|
-
fromCursor: firstPage ? params.fromCursor : undefined,
|
|
1023
|
-
fromHeight: firstPage ? firstWalkFromHeight(params) : undefined
|
|
1024
|
-
});
|
|
1025
|
-
for (const block of envelope.blocks) {
|
|
1026
|
-
if (params.signal?.aborted)
|
|
1027
|
-
return;
|
|
1028
|
-
yield block;
|
|
1029
|
-
}
|
|
1030
|
-
const nextCursor = envelope.next_cursor;
|
|
1031
|
-
if (!nextCursor || nextCursor === cursor || envelope.blocks.length < batchSize) {
|
|
1032
|
-
return;
|
|
1033
|
-
}
|
|
1034
|
-
cursor = nextCursor;
|
|
1035
|
-
firstPage = false;
|
|
1036
|
-
}
|
|
928
|
+
walkBlocks(params = {}) {
|
|
929
|
+
return this.keysetWalk(params, (page) => this.listBlocks({ ...params, ...page }), (e) => e.blocks);
|
|
1037
930
|
}
|
|
1038
931
|
async listTransactions(params = {}) {
|
|
1039
932
|
return this.request("GET", `/v1/index/transactions${buildQuery({
|
|
@@ -1053,30 +946,8 @@ class Index extends BaseClient {
|
|
|
1053
946
|
async getTransactionProof(txId) {
|
|
1054
947
|
return this.requestOrNull("GET", `/v1/index/transactions/${encodeURIComponent(txId)}/proof`);
|
|
1055
948
|
}
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
let cursor = params.cursor ?? params.fromCursor ?? null;
|
|
1059
|
-
let firstPage = true;
|
|
1060
|
-
while (!params.signal?.aborted) {
|
|
1061
|
-
const envelope = await this.listTransactions({
|
|
1062
|
-
...params,
|
|
1063
|
-
limit: batchSize,
|
|
1064
|
-
cursor: firstPage ? params.cursor : cursor,
|
|
1065
|
-
fromCursor: firstPage ? params.fromCursor : undefined,
|
|
1066
|
-
fromHeight: firstPage ? firstWalkFromHeight(params) : undefined
|
|
1067
|
-
});
|
|
1068
|
-
for (const tx of envelope.transactions) {
|
|
1069
|
-
if (params.signal?.aborted)
|
|
1070
|
-
return;
|
|
1071
|
-
yield tx;
|
|
1072
|
-
}
|
|
1073
|
-
const nextCursor = envelope.next_cursor;
|
|
1074
|
-
if (!nextCursor || nextCursor === cursor || envelope.transactions.length < batchSize) {
|
|
1075
|
-
return;
|
|
1076
|
-
}
|
|
1077
|
-
cursor = nextCursor;
|
|
1078
|
-
firstPage = false;
|
|
1079
|
-
}
|
|
949
|
+
walkTransactions(params = {}) {
|
|
950
|
+
return this.keysetWalk(params, (page) => this.listTransactions({ ...params, ...page }), (e) => e.transactions);
|
|
1080
951
|
}
|
|
1081
952
|
async listStacking(params = {}) {
|
|
1082
953
|
return this.request("GET", `/v1/index/stacking${buildQuery({
|
|
@@ -1090,30 +961,8 @@ class Index extends BaseClient {
|
|
|
1090
961
|
to_height: params.toHeight
|
|
1091
962
|
})}`);
|
|
1092
963
|
}
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
let cursor = params.cursor ?? params.fromCursor ?? null;
|
|
1096
|
-
let firstPage = true;
|
|
1097
|
-
while (!params.signal?.aborted) {
|
|
1098
|
-
const envelope = await this.listStacking({
|
|
1099
|
-
...params,
|
|
1100
|
-
limit: batchSize,
|
|
1101
|
-
cursor: firstPage ? params.cursor : cursor,
|
|
1102
|
-
fromCursor: firstPage ? params.fromCursor : undefined,
|
|
1103
|
-
fromHeight: firstPage ? firstWalkFromHeight(params) : undefined
|
|
1104
|
-
});
|
|
1105
|
-
for (const action of envelope.stacking) {
|
|
1106
|
-
if (params.signal?.aborted)
|
|
1107
|
-
return;
|
|
1108
|
-
yield action;
|
|
1109
|
-
}
|
|
1110
|
-
const nextCursor = envelope.next_cursor;
|
|
1111
|
-
if (!nextCursor || nextCursor === cursor || envelope.stacking.length < batchSize) {
|
|
1112
|
-
return;
|
|
1113
|
-
}
|
|
1114
|
-
cursor = nextCursor;
|
|
1115
|
-
firstPage = false;
|
|
1116
|
-
}
|
|
964
|
+
walkStacking(params = {}) {
|
|
965
|
+
return this.keysetWalk(params, (page) => this.listStacking({ ...params, ...page }), (e) => e.stacking);
|
|
1117
966
|
}
|
|
1118
967
|
async listMempool(params = {}) {
|
|
1119
968
|
return this.request("GET", `/v1/index/mempool${buildQuery({
|
|
@@ -1128,29 +977,8 @@ class Index extends BaseClient {
|
|
|
1128
977
|
async getMempoolTx(txId) {
|
|
1129
978
|
return this.requestOrNull("GET", `/v1/index/mempool/${encodeURIComponent(txId)}`);
|
|
1130
979
|
}
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
let cursor = params.cursor ?? params.fromCursor ?? null;
|
|
1134
|
-
let firstPage = true;
|
|
1135
|
-
while (!params.signal?.aborted) {
|
|
1136
|
-
const envelope = await this.listMempool({
|
|
1137
|
-
...params,
|
|
1138
|
-
limit: batchSize,
|
|
1139
|
-
cursor: firstPage ? params.cursor : cursor,
|
|
1140
|
-
fromCursor: firstPage ? params.fromCursor : undefined
|
|
1141
|
-
});
|
|
1142
|
-
for (const tx of envelope.mempool) {
|
|
1143
|
-
if (params.signal?.aborted)
|
|
1144
|
-
return;
|
|
1145
|
-
yield tx;
|
|
1146
|
-
}
|
|
1147
|
-
const nextCursor = envelope.next_cursor;
|
|
1148
|
-
if (!nextCursor || nextCursor === cursor || envelope.mempool.length < batchSize) {
|
|
1149
|
-
return;
|
|
1150
|
-
}
|
|
1151
|
-
cursor = nextCursor;
|
|
1152
|
-
firstPage = false;
|
|
1153
|
-
}
|
|
980
|
+
walkMempool(params = {}) {
|
|
981
|
+
return this.keysetWalk(params, (page) => this.listMempool({ ...params, ...page }), (e) => e.mempool);
|
|
1154
982
|
}
|
|
1155
983
|
async listSbtcDeposits(params = {}) {
|
|
1156
984
|
return this.request("GET", `/v1/index/sbtc/deposits${buildQuery({
|
|
@@ -1164,30 +992,8 @@ class Index extends BaseClient {
|
|
|
1164
992
|
to_height: params.toHeight
|
|
1165
993
|
})}`);
|
|
1166
994
|
}
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
let cursor = params.cursor ?? params.fromCursor ?? null;
|
|
1170
|
-
let firstPage = true;
|
|
1171
|
-
while (!params.signal?.aborted) {
|
|
1172
|
-
const envelope = await this.listSbtcDeposits({
|
|
1173
|
-
...params,
|
|
1174
|
-
limit: batchSize,
|
|
1175
|
-
cursor: firstPage ? params.cursor : cursor,
|
|
1176
|
-
fromCursor: firstPage ? params.fromCursor : undefined,
|
|
1177
|
-
fromHeight: firstPage ? firstWalkFromHeight(params) : undefined
|
|
1178
|
-
});
|
|
1179
|
-
for (const deposit of envelope.deposits) {
|
|
1180
|
-
if (params.signal?.aborted)
|
|
1181
|
-
return;
|
|
1182
|
-
yield deposit;
|
|
1183
|
-
}
|
|
1184
|
-
const nextCursor = envelope.next_cursor;
|
|
1185
|
-
if (!nextCursor || nextCursor === cursor || envelope.deposits.length < batchSize) {
|
|
1186
|
-
return;
|
|
1187
|
-
}
|
|
1188
|
-
cursor = nextCursor;
|
|
1189
|
-
firstPage = false;
|
|
1190
|
-
}
|
|
995
|
+
walkSbtcDeposits(params = {}) {
|
|
996
|
+
return this.keysetWalk(params, (page) => this.listSbtcDeposits({ ...params, ...page }), (e) => e.deposits);
|
|
1191
997
|
}
|
|
1192
998
|
async getSbtcDeposit(bitcoinTxid) {
|
|
1193
999
|
return this.requestOrNull("GET", `/v1/index/sbtc/deposits/${encodeURIComponent(bitcoinTxid)}`);
|
|
@@ -1201,34 +1007,13 @@ class Index extends BaseClient {
|
|
|
1201
1007
|
status: params.status,
|
|
1202
1008
|
sender: params.sender,
|
|
1203
1009
|
request_id: params.requestId,
|
|
1010
|
+
settlement_confirmed: params.settlementConfirmed,
|
|
1204
1011
|
from_height: params.fromHeight,
|
|
1205
1012
|
to_height: params.toHeight
|
|
1206
1013
|
})}`);
|
|
1207
1014
|
}
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
let cursor = params.cursor ?? params.fromCursor ?? null;
|
|
1211
|
-
let firstPage = true;
|
|
1212
|
-
while (!params.signal?.aborted) {
|
|
1213
|
-
const envelope = await this.listSbtcWithdrawals({
|
|
1214
|
-
...params,
|
|
1215
|
-
limit: batchSize,
|
|
1216
|
-
cursor: firstPage ? params.cursor : cursor,
|
|
1217
|
-
fromCursor: firstPage ? params.fromCursor : undefined,
|
|
1218
|
-
fromHeight: firstPage ? firstWalkFromHeight(params) : undefined
|
|
1219
|
-
});
|
|
1220
|
-
for (const withdrawal of envelope.withdrawals) {
|
|
1221
|
-
if (params.signal?.aborted)
|
|
1222
|
-
return;
|
|
1223
|
-
yield withdrawal;
|
|
1224
|
-
}
|
|
1225
|
-
const nextCursor = envelope.next_cursor;
|
|
1226
|
-
if (!nextCursor || nextCursor === cursor || envelope.withdrawals.length < batchSize) {
|
|
1227
|
-
return;
|
|
1228
|
-
}
|
|
1229
|
-
cursor = nextCursor;
|
|
1230
|
-
firstPage = false;
|
|
1231
|
-
}
|
|
1015
|
+
walkSbtcWithdrawals(params = {}) {
|
|
1016
|
+
return this.keysetWalk(params, (page) => this.listSbtcWithdrawals({ ...params, ...page }), (e) => e.withdrawals);
|
|
1232
1017
|
}
|
|
1233
1018
|
async getSbtcWithdrawal(requestId) {
|
|
1234
1019
|
return this.requestOrNull("GET", `/v1/index/sbtc/withdrawals/${requestId}`);
|
|
@@ -1247,30 +1032,8 @@ class Index extends BaseClient {
|
|
|
1247
1032
|
to_height: params.toHeight
|
|
1248
1033
|
})}`);
|
|
1249
1034
|
}
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
let cursor = params.cursor ?? params.fromCursor ?? null;
|
|
1253
|
-
let firstPage = true;
|
|
1254
|
-
while (!params.signal?.aborted) {
|
|
1255
|
-
const envelope = await this.listSbtcEvents({
|
|
1256
|
-
...params,
|
|
1257
|
-
limit: batchSize,
|
|
1258
|
-
cursor: firstPage ? params.cursor : cursor,
|
|
1259
|
-
fromCursor: firstPage ? params.fromCursor : undefined,
|
|
1260
|
-
fromHeight: firstPage ? firstWalkFromHeight(params) : undefined
|
|
1261
|
-
});
|
|
1262
|
-
for (const event of envelope.events) {
|
|
1263
|
-
if (params.signal?.aborted)
|
|
1264
|
-
return;
|
|
1265
|
-
yield event;
|
|
1266
|
-
}
|
|
1267
|
-
const nextCursor = envelope.next_cursor;
|
|
1268
|
-
if (!nextCursor || nextCursor === cursor || envelope.events.length < batchSize) {
|
|
1269
|
-
return;
|
|
1270
|
-
}
|
|
1271
|
-
cursor = nextCursor;
|
|
1272
|
-
firstPage = false;
|
|
1273
|
-
}
|
|
1035
|
+
walkSbtcEvents(params = {}) {
|
|
1036
|
+
return this.keysetWalk(params, (page) => this.listSbtcEvents({ ...params, ...page }), (e) => e.events);
|
|
1274
1037
|
}
|
|
1275
1038
|
async getSbtcSummary() {
|
|
1276
1039
|
return this.request("GET", "/v1/index/sbtc/summary");
|
|
@@ -2634,5 +2397,5 @@ export {
|
|
|
2634
2397
|
ApiError
|
|
2635
2398
|
};
|
|
2636
2399
|
|
|
2637
|
-
//# debugId=
|
|
2400
|
+
//# debugId=A8092EB602106E7964756E2164756E21
|
|
2638
2401
|
//# sourceMappingURL=index.js.map
|