@secondlayer/sdk 6.52.1 → 6.53.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.
@@ -938,6 +938,10 @@ async function consumeIndexFeed(opts) {
938
938
  }
939
939
 
940
940
  // src/index-api/client.ts
941
+ function feedFilters(params) {
942
+ const { fromCursor: _checkpoint, ...filters } = params;
943
+ return filters;
944
+ }
941
945
  function firstWalkFromHeight(params) {
942
946
  if (params.fromHeight !== undefined)
943
947
  return params.fromHeight;
@@ -983,14 +987,7 @@ class Index extends BaseClient {
983
987
  consume: (params) => consumeIndexFeed({
984
988
  ...params,
985
989
  fetchPage: ({ cursor, fromHeight, limit }) => this.listEvents({
986
- eventType: params.eventType,
987
- contractId: params.contractId,
988
- assetIdentifier: params.assetIdentifier,
989
- sender: params.sender,
990
- recipient: params.recipient,
991
- trait: params.trait,
992
- toHeight: params.toHeight,
993
- txContext: params.txContext,
990
+ ...feedFilters(params),
994
991
  cursor,
995
992
  fromHeight,
996
993
  limit
@@ -1004,11 +1001,7 @@ class Index extends BaseClient {
1004
1001
  consume: (params) => consumeIndexFeed({
1005
1002
  ...params,
1006
1003
  fetchPage: ({ cursor, fromHeight, limit }) => this.listContractCalls({
1007
- contractId: params.contractId,
1008
- functionName: params.functionName,
1009
- sender: params.sender,
1010
- trait: params.trait,
1011
- toHeight: params.toHeight,
1004
+ ...feedFilters(params),
1012
1005
  cursor,
1013
1006
  fromHeight,
1014
1007
  limit
@@ -1047,10 +1040,7 @@ class Index extends BaseClient {
1047
1040
  consume: (params) => consumeIndexFeed({
1048
1041
  ...params,
1049
1042
  fetchPage: ({ cursor, fromHeight, limit }) => this.listSbtcDeposits({
1050
- confirmed: params.confirmed,
1051
- sender: params.sender,
1052
- bitcoinTxid: params.bitcoinTxid,
1053
- toHeight: params.toHeight,
1043
+ ...feedFilters(params),
1054
1044
  cursor,
1055
1045
  fromHeight,
1056
1046
  limit
@@ -1070,12 +1060,7 @@ class Index extends BaseClient {
1070
1060
  consume: (params) => consumeIndexFeed({
1071
1061
  ...params,
1072
1062
  fetchPage: ({ cursor, fromHeight, limit }) => this.listSbtcEvents({
1073
- confirmed: params.confirmed,
1074
- topic: params.topic,
1075
- sender: params.sender,
1076
- requestId: params.requestId,
1077
- bitcoinTxid: params.bitcoinTxid,
1078
- toHeight: params.toHeight,
1063
+ ...feedFilters(params),
1079
1064
  cursor,
1080
1065
  fromHeight,
1081
1066
  limit
@@ -1725,6 +1710,17 @@ function maxCursor(a, b) {
1725
1710
  const [bh, bi] = cursorTuple(b);
1726
1711
  return ah > bh || ah === bh && ai >= bi ? a : b;
1727
1712
  }
1713
+ function streamsFilters(params) {
1714
+ return {
1715
+ types: params.types,
1716
+ notTypes: params.notTypes,
1717
+ contractId: params.contractId,
1718
+ sender: params.sender,
1719
+ recipient: params.recipient,
1720
+ assetIdentifier: params.assetIdentifier,
1721
+ filters: params.filters
1722
+ };
1723
+ }
1728
1724
  var DEFAULT_STREAMS_BASE_URL = "https://api.secondlayer.tools";
1729
1725
  function normalizeBaseUrl(baseUrl) {
1730
1726
  return baseUrl.replace(/\/+$/, "");
@@ -1836,29 +1832,7 @@ function createStreamsClient(options) {
1836
1832
  }
1837
1833
  return JSON.parse(text);
1838
1834
  }
1839
- const fetchEvents = async ({
1840
- cursor,
1841
- limit,
1842
- types,
1843
- notTypes,
1844
- contractId,
1845
- sender,
1846
- recipient,
1847
- assetIdentifier,
1848
- filters
1849
- }) => {
1850
- return listEvents({
1851
- cursor,
1852
- limit,
1853
- types,
1854
- notTypes,
1855
- contractId,
1856
- sender,
1857
- recipient,
1858
- assetIdentifier,
1859
- filters
1860
- });
1861
- };
1835
+ const fetchEvents = listEvents;
1862
1836
  function encodeFilters(filters) {
1863
1837
  return filters ? JSON.stringify(filters) : undefined;
1864
1838
  }
@@ -1903,13 +1877,7 @@ function createStreamsClient(options) {
1903
1877
  onProgress: params.onProgress,
1904
1878
  mode: params.mode,
1905
1879
  finalizedOnly: params.finalizedOnly,
1906
- types: params.types,
1907
- notTypes: params.notTypes,
1908
- contractId: params.contractId,
1909
- sender: params.sender,
1910
- recipient: params.recipient,
1911
- assetIdentifier: params.assetIdentifier,
1912
- filters: params.filters,
1880
+ ...streamsFilters(params),
1913
1881
  batchSize: params.batchSize ?? 100,
1914
1882
  fetchEvents,
1915
1883
  onBatch,
@@ -1929,13 +1897,7 @@ function createStreamsClient(options) {
1929
1897
  fromCursor: params.cursor,
1930
1898
  batchSize: params.batchSize ?? 100,
1931
1899
  intervalMs: params.intervalMs ?? 2000,
1932
- types: params.types,
1933
- notTypes: params.notTypes,
1934
- contractId: params.contractId,
1935
- sender: params.sender,
1936
- recipient: params.recipient,
1937
- assetIdentifier: params.assetIdentifier,
1938
- filters: params.filters,
1900
+ ...streamsFilters(params),
1939
1901
  signal: params.signal,
1940
1902
  fetchEvents
1941
1903
  });
@@ -1949,13 +1911,7 @@ function createStreamsClient(options) {
1949
1911
  stream(params = {}) {
1950
1912
  return streamStreamsEvents({
1951
1913
  fromCursor: params.fromCursor,
1952
- types: params.types,
1953
- notTypes: params.notTypes,
1954
- contractId: params.contractId,
1955
- sender: params.sender,
1956
- recipient: params.recipient,
1957
- assetIdentifier: params.assetIdentifier,
1958
- filters: params.filters,
1914
+ ...streamsFilters(params),
1959
1915
  batchSize: params.batchSize ?? 100,
1960
1916
  emptyBackoffMs: params.emptyBackoffMs,
1961
1917
  maxPages: params.maxPages,
@@ -2182,5 +2138,5 @@ export {
2182
2138
  Subgraphs
2183
2139
  };
2184
2140
 
2185
- //# debugId=70E6A73A1EA8EC4B64756E2164756E21
2141
+ //# debugId=15400962101264EB64756E2164756E21
2186
2142
  //# sourceMappingURL=index.js.map