brk-client 0.3.0 → 0.3.2

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.
Files changed (2) hide show
  1. package/index.js +390 -298
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -646,6 +646,14 @@ ancestors and no descendants (matches mempool.space).
646
646
  *
647
647
  * @typedef {number} Height
648
648
  */
649
+ /**
650
+ * Path parameter accepting either a block height (`840000`) or a calendar date
651
+ * (`YYYY-MM-DD`). The handler resolves it and dispatches to the per-height or
652
+ * per-day variant, choosing the matching cache strategy.
653
+ *
654
+ * @typedef {Object} HeightOrDateParam
655
+ * @property {string} point
656
+ */
649
657
  /**
650
658
  * Block height path parameter
651
659
  *
@@ -1349,9 +1357,9 @@ on serialization otherwise.
1349
1357
  /**
1350
1358
  * Aggregation strategy for URPD buckets.
1351
1359
  * Options: raw (no aggregation), lin200/lin500/lin1000 (linear $200/$500/$1000),
1352
- * log10/log50/log100/log200 (logarithmic with 10/50/100/200 buckets per decade).
1360
+ * log10/log50/log100/log200/log500/log1000/log2000 (logarithmic with 10/50/100/200/500/1000/2000 buckets per decade).
1353
1361
  *
1354
- * @typedef {("raw"|"lin200"|"lin500"|"lin1000"|"log10"|"log50"|"log100"|"log200")} UrpdAggregation
1362
+ * @typedef {("raw"|"lin200"|"lin500"|"lin1000"|"log10"|"log50"|"log100"|"log200"|"log500"|"log1000"|"log2000")} UrpdAggregation
1355
1363
  */
1356
1364
  /**
1357
1365
  * A single bucket in a URPD snapshot.
@@ -1874,14 +1882,17 @@ class BrkClientBase {
1874
1882
 
1875
1883
  /**
1876
1884
  * @param {string} path
1877
- * @param {{ signal?: AbortSignal }} [options]
1885
+ * @param {{ signal?: AbortSignal, cache?: boolean }} [options]
1878
1886
  * @returns {Promise<Response>}
1879
1887
  */
1880
- async get(path, { signal } = {}) {
1888
+ async get(path, { signal, cache = true } = {}) {
1881
1889
  const url = `${this.baseUrl}${path}`;
1882
1890
  const signals = [AbortSignal.timeout(this.timeout)];
1883
1891
  if (signal) signals.push(signal);
1884
- const res = await fetch(url, { signal: AbortSignal.any(signals) });
1892
+ /** @type {RequestInit} */
1893
+ const init = { signal: AbortSignal.any(signals) };
1894
+ if (!cache) init.cache = 'no-store';
1895
+ const res = await fetch(url, init);
1885
1896
  if (!res.ok) throw new BrkError(`HTTP ${res.status}: ${url}`, res.status);
1886
1897
  return res;
1887
1898
  }
@@ -1901,14 +1912,21 @@ class BrkClientBase {
1901
1912
  * @template T
1902
1913
  * @param {string} path
1903
1914
  * @param {(res: Response) => Promise<T>} parse - Response body reader
1904
- * @param {{ onValue?: (value: T) => void, signal?: AbortSignal }} [options]
1915
+ * @param {{ onValue?: (value: T) => void, signal?: AbortSignal, cache?: boolean }} [options]
1905
1916
  * @returns {Promise<T>}
1906
1917
  */
1907
- async _getCached(path, parse, { onValue, signal } = {}) {
1918
+ async _getCached(path, parse, { onValue, signal, cache = true } = {}) {
1919
+ if (!cache) {
1920
+ const res = await this.get(path, { signal, cache });
1921
+ const value = await parse(res);
1922
+ if (onValue) onValue(value);
1923
+ return value;
1924
+ }
1925
+
1908
1926
  const url = `${this.baseUrl}${path}`;
1909
1927
  /** @type {_MemEntry<T> | undefined} */
1910
1928
  const memHit = this._memGet(url);
1911
- const browserCache = this._browserCache ?? await this._browserCachePromise;
1929
+ const browserCache = this._browserCache;
1912
1930
 
1913
1931
  // L1 fast path: deliver from memCache, revalidate via network.
1914
1932
  // ETag match → zero parse, zero clone, zero cache write, no second onValue fire.
@@ -1923,8 +1941,8 @@ class BrkClientBase {
1923
1941
  this._memSet(url, netEtag, value);
1924
1942
  if (onValue) onValue(value);
1925
1943
  if (cloned && browserCache) {
1926
- const cache = browserCache;
1927
- _runIdle(() => cache.put(url, cloned));
1944
+ const cacheStore = browserCache;
1945
+ _runIdle(() => cacheStore.put(url, cloned));
1928
1946
  }
1929
1947
  return value;
1930
1948
  } catch {
@@ -1957,8 +1975,8 @@ class BrkClientBase {
1957
1975
  this._memSet(url, netEtag, value);
1958
1976
  if (onValue) onValue(value);
1959
1977
  if (cloned && browserCache) {
1960
- const cache = browserCache;
1961
- _runIdle(() => cache.put(url, cloned));
1978
+ const cacheStore = browserCache;
1979
+ _runIdle(() => cacheStore.put(url, cloned));
1962
1980
  }
1963
1981
  return value;
1964
1982
  } catch (e) {
@@ -1972,7 +1990,7 @@ class BrkClientBase {
1972
1990
  * Make a GET request expecting a JSON response. Cached and supports `onValue`.
1973
1991
  * @template T
1974
1992
  * @param {string} path
1975
- * @param {{ onValue?: (value: T) => void, signal?: AbortSignal }} [options]
1993
+ * @param {{ onValue?: (value: T) => void, signal?: AbortSignal, cache?: boolean }} [options]
1976
1994
  * @returns {Promise<T>}
1977
1995
  */
1978
1996
  getJson(path, options) {
@@ -1983,7 +2001,7 @@ class BrkClientBase {
1983
2001
  * Make a GET request expecting a text response (text/plain, text/csv, ...).
1984
2002
  * Cached and supports `onValue`, same as `getJson`.
1985
2003
  * @param {string} path
1986
- * @param {{ onValue?: (value: string) => void, signal?: AbortSignal }} [options]
2004
+ * @param {{ onValue?: (value: string) => void, signal?: AbortSignal, cache?: boolean }} [options]
1987
2005
  * @returns {Promise<string>}
1988
2006
  */
1989
2007
  getText(path, options) {
@@ -1994,7 +2012,7 @@ class BrkClientBase {
1994
2012
  * Make a GET request expecting binary data (application/octet-stream).
1995
2013
  * Cached and supports `onValue`, same as `getJson`.
1996
2014
  * @param {string} path
1997
- * @param {{ onValue?: (value: Uint8Array) => void, signal?: AbortSignal }} [options]
2015
+ * @param {{ onValue?: (value: Uint8Array) => void, signal?: AbortSignal, cache?: boolean }} [options]
1998
2016
  * @returns {Promise<Uint8Array>}
1999
2017
  */
2000
2018
  getBytes(path, options) {
@@ -5175,7 +5193,7 @@ function createTransferPattern(client, acc) {
5175
5193
  * @property {SeriesTree_Investing} investing
5176
5194
  * @property {SeriesTree_Market} market
5177
5195
  * @property {SeriesTree_Pools} pools
5178
- * @property {SeriesTree_Prices} prices
5196
+ * @property {SeriesTree_Price} price
5179
5197
  * @property {SeriesTree_Supply} supply
5180
5198
  * @property {SeriesTree_Cohorts} cohorts
5181
5199
  */
@@ -6707,14 +6725,14 @@ function createTransferPattern(client, acc) {
6707
6725
  */
6708
6726
 
6709
6727
  /**
6710
- * @typedef {Object} SeriesTree_Prices
6711
- * @property {SeriesTree_Prices_Split} split
6712
- * @property {SeriesTree_Prices_Ohlc} ohlc
6713
- * @property {SeriesTree_Prices_Spot} spot
6728
+ * @typedef {Object} SeriesTree_Price
6729
+ * @property {SeriesTree_Price_Split} split
6730
+ * @property {SeriesTree_Price_Ohlc} ohlc
6731
+ * @property {SeriesTree_Price_Spot} spot
6714
6732
  */
6715
6733
 
6716
6734
  /**
6717
- * @typedef {Object} SeriesTree_Prices_Split
6735
+ * @typedef {Object} SeriesTree_Price_Split
6718
6736
  * @property {CentsSatsUsdPattern3} open
6719
6737
  * @property {CentsSatsUsdPattern3} high
6720
6738
  * @property {CentsSatsUsdPattern3} low
@@ -6722,14 +6740,14 @@ function createTransferPattern(client, acc) {
6722
6740
  */
6723
6741
 
6724
6742
  /**
6725
- * @typedef {Object} SeriesTree_Prices_Ohlc
6743
+ * @typedef {Object} SeriesTree_Price_Ohlc
6726
6744
  * @property {SeriesPattern2<OHLCDollars>} usd
6727
6745
  * @property {SeriesPattern2<OHLCCents>} cents
6728
6746
  * @property {SeriesPattern2<OHLCSats>} sats
6729
6747
  */
6730
6748
 
6731
6749
  /**
6732
- * @typedef {Object} SeriesTree_Prices_Spot
6750
+ * @typedef {Object} SeriesTree_Price_Spot
6733
6751
  * @property {SeriesPattern1<Dollars>} usd
6734
6752
  * @property {SeriesPattern1<Cents>} cents
6735
6753
  * @property {SeriesPattern1<Sats>} sats
@@ -7561,7 +7579,7 @@ function createTransferPattern(client, acc) {
7561
7579
  * @extends BrkClientBase
7562
7580
  */
7563
7581
  class BrkClient extends BrkClientBase {
7564
- VERSION = "v0.3.0";
7582
+ VERSION = "v0.3.2";
7565
7583
 
7566
7584
  INDEXES = /** @type {const} */ ([
7567
7585
  "minute10",
@@ -9845,7 +9863,7 @@ class BrkClient extends BrkClientBase {
9845
9863
  noderunners: createBlocksDominancePattern(this, 'noderunners'),
9846
9864
  },
9847
9865
  },
9848
- prices: {
9866
+ price: {
9849
9867
  split: {
9850
9868
  open: createCentsSatsUsdPattern3(this, 'price_open'),
9851
9869
  high: createCentsSatsUsdPattern3(this, 'price_high'),
@@ -10538,12 +10556,12 @@ class BrkClient extends BrkClientBase {
10538
10556
  * Liveness probe. Returns server identity, uptime, and indexed/computed heights from local state only (no bitcoind round-trip). For real chain-tip catch-up, see `/api/server/sync`.
10539
10557
  *
10540
10558
  * Endpoint: `GET /health`
10541
- * @param {{ signal?: AbortSignal, onValue?: (value: Health) => void }} [options]
10559
+ * @param {{ signal?: AbortSignal, onValue?: (value: Health) => void, cache?: boolean }} [options]
10542
10560
  * @returns {Promise<Health>}
10543
10561
  */
10544
- async getHealth({ signal, onValue } = {}) {
10562
+ async getHealth({ signal, onValue, cache } = {}) {
10545
10563
  const path = `/health`;
10546
- return this.getJson(path, { signal, onValue });
10564
+ return this.getJson(path, { signal, onValue, cache });
10547
10565
  }
10548
10566
 
10549
10567
  /**
@@ -10552,12 +10570,12 @@ class BrkClient extends BrkClientBase {
10552
10570
  * Returns the current version of the API server
10553
10571
  *
10554
10572
  * Endpoint: `GET /version`
10555
- * @param {{ signal?: AbortSignal, onValue?: (value: string) => void }} [options]
10573
+ * @param {{ signal?: AbortSignal, onValue?: (value: string) => void, cache?: boolean }} [options]
10556
10574
  * @returns {Promise<string>}
10557
10575
  */
10558
- async getVersion({ signal, onValue } = {}) {
10576
+ async getVersion({ signal, onValue, cache } = {}) {
10559
10577
  const path = `/version`;
10560
- return this.getJson(path, { signal, onValue });
10578
+ return this.getJson(path, { signal, onValue, cache });
10561
10579
  }
10562
10580
 
10563
10581
  /**
@@ -10566,12 +10584,12 @@ class BrkClient extends BrkClientBase {
10566
10584
  * Returns the sync status of the indexer, including indexed height, tip height, blocks behind, and last indexed timestamp.
10567
10585
  *
10568
10586
  * Endpoint: `GET /api/server/sync`
10569
- * @param {{ signal?: AbortSignal, onValue?: (value: SyncStatus) => void }} [options]
10587
+ * @param {{ signal?: AbortSignal, onValue?: (value: SyncStatus) => void, cache?: boolean }} [options]
10570
10588
  * @returns {Promise<SyncStatus>}
10571
10589
  */
10572
- async getSyncStatus({ signal, onValue } = {}) {
10590
+ async getSyncStatus({ signal, onValue, cache } = {}) {
10573
10591
  const path = `/api/server/sync`;
10574
- return this.getJson(path, { signal, onValue });
10592
+ return this.getJson(path, { signal, onValue, cache });
10575
10593
  }
10576
10594
 
10577
10595
  /**
@@ -10580,12 +10598,12 @@ class BrkClient extends BrkClientBase {
10580
10598
  * Returns the disk space used by BRK and Bitcoin data.
10581
10599
  *
10582
10600
  * Endpoint: `GET /api/server/disk`
10583
- * @param {{ signal?: AbortSignal, onValue?: (value: DiskUsage) => void }} [options]
10601
+ * @param {{ signal?: AbortSignal, onValue?: (value: DiskUsage) => void, cache?: boolean }} [options]
10584
10602
  * @returns {Promise<DiskUsage>}
10585
10603
  */
10586
- async getDiskUsage({ signal, onValue } = {}) {
10604
+ async getDiskUsage({ signal, onValue, cache } = {}) {
10587
10605
  const path = `/api/server/disk`;
10588
- return this.getJson(path, { signal, onValue });
10606
+ return this.getJson(path, { signal, onValue, cache });
10589
10607
  }
10590
10608
 
10591
10609
  /**
@@ -10594,12 +10612,12 @@ class BrkClient extends BrkClientBase {
10594
10612
  * Returns the complete hierarchical catalog of available series organized as a tree structure. Series are grouped by categories and subcategories.
10595
10613
  *
10596
10614
  * Endpoint: `GET /api/series`
10597
- * @param {{ signal?: AbortSignal, onValue?: (value: TreeNode) => void }} [options]
10615
+ * @param {{ signal?: AbortSignal, onValue?: (value: TreeNode) => void, cache?: boolean }} [options]
10598
10616
  * @returns {Promise<TreeNode>}
10599
10617
  */
10600
- async getSeriesTree({ signal, onValue } = {}) {
10618
+ async getSeriesTree({ signal, onValue, cache } = {}) {
10601
10619
  const path = `/api/series`;
10602
- return this.getJson(path, { signal, onValue });
10620
+ return this.getJson(path, { signal, onValue, cache });
10603
10621
  }
10604
10622
 
10605
10623
  /**
@@ -10608,12 +10626,12 @@ class BrkClient extends BrkClientBase {
10608
10626
  * Returns the number of series available per index type.
10609
10627
  *
10610
10628
  * Endpoint: `GET /api/series/count`
10611
- * @param {{ signal?: AbortSignal, onValue?: (value: SeriesCount[]) => void }} [options]
10629
+ * @param {{ signal?: AbortSignal, onValue?: (value: SeriesCount[]) => void, cache?: boolean }} [options]
10612
10630
  * @returns {Promise<SeriesCount[]>}
10613
10631
  */
10614
- async getSeriesCount({ signal, onValue } = {}) {
10632
+ async getSeriesCount({ signal, onValue, cache } = {}) {
10615
10633
  const path = `/api/series/count`;
10616
- return this.getJson(path, { signal, onValue });
10634
+ return this.getJson(path, { signal, onValue, cache });
10617
10635
  }
10618
10636
 
10619
10637
  /**
@@ -10622,12 +10640,12 @@ class BrkClient extends BrkClientBase {
10622
10640
  * Returns all available indexes with their accepted query aliases. Use any alias when querying series.
10623
10641
  *
10624
10642
  * Endpoint: `GET /api/series/indexes`
10625
- * @param {{ signal?: AbortSignal, onValue?: (value: IndexInfo[]) => void }} [options]
10643
+ * @param {{ signal?: AbortSignal, onValue?: (value: IndexInfo[]) => void, cache?: boolean }} [options]
10626
10644
  * @returns {Promise<IndexInfo[]>}
10627
10645
  */
10628
- async getIndexes({ signal, onValue } = {}) {
10646
+ async getIndexes({ signal, onValue, cache } = {}) {
10629
10647
  const path = `/api/series/indexes`;
10630
- return this.getJson(path, { signal, onValue });
10648
+ return this.getJson(path, { signal, onValue, cache });
10631
10649
  }
10632
10650
 
10633
10651
  /**
@@ -10639,16 +10657,16 @@ class BrkClient extends BrkClientBase {
10639
10657
  *
10640
10658
  * @param {number=} [page] - Pagination index
10641
10659
  * @param {number=} [per_page] - Results per page (default: 1000, max: 1000)
10642
- * @param {{ signal?: AbortSignal, onValue?: (value: PaginatedSeries) => void }} [options]
10660
+ * @param {{ signal?: AbortSignal, onValue?: (value: PaginatedSeries) => void, cache?: boolean }} [options]
10643
10661
  * @returns {Promise<PaginatedSeries>}
10644
10662
  */
10645
- async listSeries(page, per_page, { signal, onValue } = {}) {
10663
+ async listSeries(page, per_page, { signal, onValue, cache } = {}) {
10646
10664
  const params = new URLSearchParams();
10647
10665
  if (page !== undefined) params.set('page', String(page));
10648
10666
  if (per_page !== undefined) params.set('per_page', String(per_page));
10649
10667
  const query = params.toString();
10650
10668
  const path = `/api/series/list${query ? '?' + query : ''}`;
10651
- return this.getJson(path, { signal, onValue });
10669
+ return this.getJson(path, { signal, onValue, cache });
10652
10670
  }
10653
10671
 
10654
10672
  /**
@@ -10660,16 +10678,16 @@ class BrkClient extends BrkClientBase {
10660
10678
  *
10661
10679
  * @param {SeriesName} q - Search query string
10662
10680
  * @param {Limit=} [limit] - Maximum number of results
10663
- * @param {{ signal?: AbortSignal, onValue?: (value: string[]) => void }} [options]
10681
+ * @param {{ signal?: AbortSignal, onValue?: (value: string[]) => void, cache?: boolean }} [options]
10664
10682
  * @returns {Promise<string[]>}
10665
10683
  */
10666
- async searchSeries(q, limit, { signal, onValue } = {}) {
10684
+ async searchSeries(q, limit, { signal, onValue, cache } = {}) {
10667
10685
  const params = new URLSearchParams();
10668
10686
  params.set('q', String(q));
10669
10687
  if (limit !== undefined) params.set('limit', String(limit));
10670
10688
  const query = params.toString();
10671
10689
  const path = `/api/series/search${query ? '?' + query : ''}`;
10672
- return this.getJson(path, { signal, onValue });
10690
+ return this.getJson(path, { signal, onValue, cache });
10673
10691
  }
10674
10692
 
10675
10693
  /**
@@ -10680,12 +10698,12 @@ class BrkClient extends BrkClientBase {
10680
10698
  * Endpoint: `GET /api/series/{series}`
10681
10699
  *
10682
10700
  * @param {SeriesName} series
10683
- * @param {{ signal?: AbortSignal, onValue?: (value: SeriesInfo) => void }} [options]
10701
+ * @param {{ signal?: AbortSignal, onValue?: (value: SeriesInfo) => void, cache?: boolean }} [options]
10684
10702
  * @returns {Promise<SeriesInfo>}
10685
10703
  */
10686
- async getSeriesInfo(series, { signal, onValue } = {}) {
10704
+ async getSeriesInfo(series, { signal, onValue, cache } = {}) {
10687
10705
  const path = `/api/series/${series}`;
10688
- return this.getJson(path, { signal, onValue });
10706
+ return this.getJson(path, { signal, onValue, cache });
10689
10707
  }
10690
10708
 
10691
10709
  /**
@@ -10701,10 +10719,10 @@ class BrkClient extends BrkClientBase {
10701
10719
  * @param {RangeIndex=} [end] - Exclusive end: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: `to`, `t`, `e`
10702
10720
  * @param {Limit=} [limit] - Maximum number of values to return (ignored if `end` is set). Aliases: `count`, `c`, `l`
10703
10721
  * @param {Format=} [format] - Format of the output
10704
- * @param {{ signal?: AbortSignal, onValue?: (value: AnySeriesData | string) => void }} [options]
10722
+ * @param {{ signal?: AbortSignal, onValue?: (value: AnySeriesData | string) => void, cache?: boolean }} [options]
10705
10723
  * @returns {Promise<AnySeriesData | string>}
10706
10724
  */
10707
- async getSeries(series, index, start, end, limit, format, { signal, onValue } = {}) {
10725
+ async getSeries(series, index, start, end, limit, format, { signal, onValue, cache } = {}) {
10708
10726
  const params = new URLSearchParams();
10709
10727
  if (start !== undefined) params.set('start', String(start));
10710
10728
  if (end !== undefined) params.set('end', String(end));
@@ -10712,8 +10730,8 @@ class BrkClient extends BrkClientBase {
10712
10730
  if (format !== undefined) params.set('format', String(format));
10713
10731
  const query = params.toString();
10714
10732
  const path = `/api/series/${series}/${index}${query ? '?' + query : ''}`;
10715
- if (format === 'csv') return this.getText(path, { signal, onValue });
10716
- return this.getJson(path, { signal, onValue });
10733
+ if (format === 'csv') return this.getText(path, { signal, onValue, cache });
10734
+ return this.getJson(path, { signal, onValue, cache });
10717
10735
  }
10718
10736
 
10719
10737
  /**
@@ -10729,10 +10747,10 @@ class BrkClient extends BrkClientBase {
10729
10747
  * @param {RangeIndex=} [end] - Exclusive end: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: `to`, `t`, `e`
10730
10748
  * @param {Limit=} [limit] - Maximum number of values to return (ignored if `end` is set). Aliases: `count`, `c`, `l`
10731
10749
  * @param {Format=} [format] - Format of the output
10732
- * @param {{ signal?: AbortSignal, onValue?: (value: boolean[] | string) => void }} [options]
10750
+ * @param {{ signal?: AbortSignal, onValue?: (value: boolean[] | string) => void, cache?: boolean }} [options]
10733
10751
  * @returns {Promise<boolean[] | string>}
10734
10752
  */
10735
- async getSeriesData(series, index, start, end, limit, format, { signal, onValue } = {}) {
10753
+ async getSeriesData(series, index, start, end, limit, format, { signal, onValue, cache } = {}) {
10736
10754
  const params = new URLSearchParams();
10737
10755
  if (start !== undefined) params.set('start', String(start));
10738
10756
  if (end !== undefined) params.set('end', String(end));
@@ -10740,8 +10758,8 @@ class BrkClient extends BrkClientBase {
10740
10758
  if (format !== undefined) params.set('format', String(format));
10741
10759
  const query = params.toString();
10742
10760
  const path = `/api/series/${series}/${index}/data${query ? '?' + query : ''}`;
10743
- if (format === 'csv') return this.getText(path, { signal, onValue });
10744
- return this.getJson(path, { signal, onValue });
10761
+ if (format === 'csv') return this.getText(path, { signal, onValue, cache });
10762
+ return this.getJson(path, { signal, onValue, cache });
10745
10763
  }
10746
10764
 
10747
10765
  /**
@@ -10753,12 +10771,12 @@ class BrkClient extends BrkClientBase {
10753
10771
  *
10754
10772
  * @param {SeriesName} series - Series name
10755
10773
  * @param {Index} index - Aggregation index
10756
- * @param {{ signal?: AbortSignal, onValue?: (value: *) => void }} [options]
10774
+ * @param {{ signal?: AbortSignal, onValue?: (value: *) => void, cache?: boolean }} [options]
10757
10775
  * @returns {Promise<*>}
10758
10776
  */
10759
- async getSeriesLatest(series, index, { signal, onValue } = {}) {
10777
+ async getSeriesLatest(series, index, { signal, onValue, cache } = {}) {
10760
10778
  const path = `/api/series/${series}/${index}/latest`;
10761
- return this.getJson(path, { signal, onValue });
10779
+ return this.getJson(path, { signal, onValue, cache });
10762
10780
  }
10763
10781
 
10764
10782
  /**
@@ -10770,12 +10788,12 @@ class BrkClient extends BrkClientBase {
10770
10788
  *
10771
10789
  * @param {SeriesName} series - Series name
10772
10790
  * @param {Index} index - Aggregation index
10773
- * @param {{ signal?: AbortSignal, onValue?: (value: number) => void }} [options]
10791
+ * @param {{ signal?: AbortSignal, onValue?: (value: number) => void, cache?: boolean }} [options]
10774
10792
  * @returns {Promise<number>}
10775
10793
  */
10776
- async getSeriesLen(series, index, { signal, onValue } = {}) {
10794
+ async getSeriesLen(series, index, { signal, onValue, cache } = {}) {
10777
10795
  const path = `/api/series/${series}/${index}/len`;
10778
- return this.getJson(path, { signal, onValue });
10796
+ return this.getJson(path, { signal, onValue, cache });
10779
10797
  }
10780
10798
 
10781
10799
  /**
@@ -10787,12 +10805,12 @@ class BrkClient extends BrkClientBase {
10787
10805
  *
10788
10806
  * @param {SeriesName} series - Series name
10789
10807
  * @param {Index} index - Aggregation index
10790
- * @param {{ signal?: AbortSignal, onValue?: (value: Version) => void }} [options]
10808
+ * @param {{ signal?: AbortSignal, onValue?: (value: Version) => void, cache?: boolean }} [options]
10791
10809
  * @returns {Promise<Version>}
10792
10810
  */
10793
- async getSeriesVersion(series, index, { signal, onValue } = {}) {
10811
+ async getSeriesVersion(series, index, { signal, onValue, cache } = {}) {
10794
10812
  const path = `/api/series/${series}/${index}/version`;
10795
- return this.getJson(path, { signal, onValue });
10813
+ return this.getJson(path, { signal, onValue, cache });
10796
10814
  }
10797
10815
 
10798
10816
  /**
@@ -10808,10 +10826,10 @@ class BrkClient extends BrkClientBase {
10808
10826
  * @param {RangeIndex=} [end] - Exclusive end: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: `to`, `t`, `e`
10809
10827
  * @param {Limit=} [limit] - Maximum number of values to return (ignored if `end` is set). Aliases: `count`, `c`, `l`
10810
10828
  * @param {Format=} [format] - Format of the output
10811
- * @param {{ signal?: AbortSignal, onValue?: (value: AnySeriesData[] | string) => void }} [options]
10829
+ * @param {{ signal?: AbortSignal, onValue?: (value: AnySeriesData[] | string) => void, cache?: boolean }} [options]
10812
10830
  * @returns {Promise<AnySeriesData[] | string>}
10813
10831
  */
10814
- async getSeriesBulk(series, index, start, end, limit, format, { signal, onValue } = {}) {
10832
+ async getSeriesBulk(series, index, start, end, limit, format, { signal, onValue, cache } = {}) {
10815
10833
  const params = new URLSearchParams();
10816
10834
  params.set('series', String(series));
10817
10835
  params.set('index', String(index));
@@ -10821,8 +10839,8 @@ class BrkClient extends BrkClientBase {
10821
10839
  if (format !== undefined) params.set('format', String(format));
10822
10840
  const query = params.toString();
10823
10841
  const path = `/api/series/bulk${query ? '?' + query : ''}`;
10824
- if (format === 'csv') return this.getText(path, { signal, onValue });
10825
- return this.getJson(path, { signal, onValue });
10842
+ if (format === 'csv') return this.getText(path, { signal, onValue, cache });
10843
+ return this.getJson(path, { signal, onValue, cache });
10826
10844
  }
10827
10845
 
10828
10846
  /**
@@ -10831,12 +10849,12 @@ class BrkClient extends BrkClientBase {
10831
10849
  * Cohorts for which URPD data is available. Returns names like `all`, `sth`, `lth`, `utxos_under_1h_old`.
10832
10850
  *
10833
10851
  * Endpoint: `GET /api/urpd`
10834
- * @param {{ signal?: AbortSignal, onValue?: (value: Cohort[]) => void }} [options]
10852
+ * @param {{ signal?: AbortSignal, onValue?: (value: Cohort[]) => void, cache?: boolean }} [options]
10835
10853
  * @returns {Promise<Cohort[]>}
10836
10854
  */
10837
- async listUrpdCohorts({ signal, onValue } = {}) {
10855
+ async listUrpdCohorts({ signal, onValue, cache } = {}) {
10838
10856
  const path = `/api/urpd`;
10839
- return this.getJson(path, { signal, onValue });
10857
+ return this.getJson(path, { signal, onValue, cache });
10840
10858
  }
10841
10859
 
10842
10860
  /**
@@ -10847,12 +10865,12 @@ class BrkClient extends BrkClientBase {
10847
10865
  * Endpoint: `GET /api/urpd/{cohort}/dates`
10848
10866
  *
10849
10867
  * @param {Cohort} cohort
10850
- * @param {{ signal?: AbortSignal, onValue?: (value: Date[]) => void }} [options]
10868
+ * @param {{ signal?: AbortSignal, onValue?: (value: Date[]) => void, cache?: boolean }} [options]
10851
10869
  * @returns {Promise<Date[]>}
10852
10870
  */
10853
- async listUrpdDates(cohort, { signal, onValue } = {}) {
10871
+ async listUrpdDates(cohort, { signal, onValue, cache } = {}) {
10854
10872
  const path = `/api/urpd/${cohort}/dates`;
10855
- return this.getJson(path, { signal, onValue });
10873
+ return this.getJson(path, { signal, onValue, cache });
10856
10874
  }
10857
10875
 
10858
10876
  /**
@@ -10866,15 +10884,15 @@ class BrkClient extends BrkClientBase {
10866
10884
  *
10867
10885
  * @param {Cohort} cohort
10868
10886
  * @param {UrpdAggregation=} [agg] - Aggregation strategy. Default: raw (no aggregation). Accepts `bucket` as alias.
10869
- * @param {{ signal?: AbortSignal, onValue?: (value: Urpd) => void }} [options]
10887
+ * @param {{ signal?: AbortSignal, onValue?: (value: Urpd) => void, cache?: boolean }} [options]
10870
10888
  * @returns {Promise<Urpd>}
10871
10889
  */
10872
- async getUrpd(cohort, agg, { signal, onValue } = {}) {
10890
+ async getUrpd(cohort, agg, { signal, onValue, cache } = {}) {
10873
10891
  const params = new URLSearchParams();
10874
10892
  if (agg !== undefined) params.set('agg', String(agg));
10875
10893
  const query = params.toString();
10876
10894
  const path = `/api/urpd/${cohort}${query ? '?' + query : ''}`;
10877
- return this.getJson(path, { signal, onValue });
10895
+ return this.getJson(path, { signal, onValue, cache });
10878
10896
  }
10879
10897
 
10880
10898
  /**
@@ -10889,15 +10907,15 @@ class BrkClient extends BrkClientBase {
10889
10907
  * @param {Cohort} cohort
10890
10908
  * @param {string} date
10891
10909
  * @param {UrpdAggregation=} [agg] - Aggregation strategy. Default: raw (no aggregation). Accepts `bucket` as alias.
10892
- * @param {{ signal?: AbortSignal, onValue?: (value: Urpd) => void }} [options]
10910
+ * @param {{ signal?: AbortSignal, onValue?: (value: Urpd) => void, cache?: boolean }} [options]
10893
10911
  * @returns {Promise<Urpd>}
10894
10912
  */
10895
- async getUrpdAt(cohort, date, agg, { signal, onValue } = {}) {
10913
+ async getUrpdAt(cohort, date, agg, { signal, onValue, cache } = {}) {
10896
10914
  const params = new URLSearchParams();
10897
10915
  if (agg !== undefined) params.set('agg', String(agg));
10898
10916
  const query = params.toString();
10899
10917
  const path = `/api/urpd/${cohort}/${date}${query ? '?' + query : ''}`;
10900
- return this.getJson(path, { signal, onValue });
10918
+ return this.getJson(path, { signal, onValue, cache });
10901
10919
  }
10902
10920
 
10903
10921
  /**
@@ -10908,12 +10926,12 @@ class BrkClient extends BrkClientBase {
10908
10926
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-difficulty-adjustment)*
10909
10927
  *
10910
10928
  * Endpoint: `GET /api/v1/difficulty-adjustment`
10911
- * @param {{ signal?: AbortSignal, onValue?: (value: DifficultyAdjustment) => void }} [options]
10929
+ * @param {{ signal?: AbortSignal, onValue?: (value: DifficultyAdjustment) => void, cache?: boolean }} [options]
10912
10930
  * @returns {Promise<DifficultyAdjustment>}
10913
10931
  */
10914
- async getDifficultyAdjustment({ signal, onValue } = {}) {
10932
+ async getDifficultyAdjustment({ signal, onValue, cache } = {}) {
10915
10933
  const path = `/api/v1/difficulty-adjustment`;
10916
- return this.getJson(path, { signal, onValue });
10934
+ return this.getJson(path, { signal, onValue, cache });
10917
10935
  }
10918
10936
 
10919
10937
  /**
@@ -10924,12 +10942,12 @@ class BrkClient extends BrkClientBase {
10924
10942
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-price)*
10925
10943
  *
10926
10944
  * Endpoint: `GET /api/v1/prices`
10927
- * @param {{ signal?: AbortSignal, onValue?: (value: Prices) => void }} [options]
10945
+ * @param {{ signal?: AbortSignal, onValue?: (value: Prices) => void, cache?: boolean }} [options]
10928
10946
  * @returns {Promise<Prices>}
10929
10947
  */
10930
- async getPrices({ signal, onValue } = {}) {
10948
+ async getPrices({ signal, onValue, cache } = {}) {
10931
10949
  const path = `/api/v1/prices`;
10932
- return this.getJson(path, { signal, onValue });
10950
+ return this.getJson(path, { signal, onValue, cache });
10933
10951
  }
10934
10952
 
10935
10953
  /**
@@ -10942,15 +10960,15 @@ class BrkClient extends BrkClientBase {
10942
10960
  * Endpoint: `GET /api/v1/historical-price`
10943
10961
  *
10944
10962
  * @param {Timestamp=} [timestamp]
10945
- * @param {{ signal?: AbortSignal, onValue?: (value: HistoricalPrice) => void }} [options]
10963
+ * @param {{ signal?: AbortSignal, onValue?: (value: HistoricalPrice) => void, cache?: boolean }} [options]
10946
10964
  * @returns {Promise<HistoricalPrice>}
10947
10965
  */
10948
- async getHistoricalPrice(timestamp, { signal, onValue } = {}) {
10966
+ async getHistoricalPrice(timestamp, { signal, onValue, cache } = {}) {
10949
10967
  const params = new URLSearchParams();
10950
10968
  if (timestamp !== undefined) params.set('timestamp', String(timestamp));
10951
10969
  const query = params.toString();
10952
10970
  const path = `/api/v1/historical-price${query ? '?' + query : ''}`;
10953
- return this.getJson(path, { signal, onValue });
10971
+ return this.getJson(path, { signal, onValue, cache });
10954
10972
  }
10955
10973
 
10956
10974
  /**
@@ -10963,12 +10981,12 @@ class BrkClient extends BrkClientBase {
10963
10981
  * Endpoint: `GET /api/address/{address}`
10964
10982
  *
10965
10983
  * @param {Addr} address
10966
- * @param {{ signal?: AbortSignal, onValue?: (value: AddrStats) => void }} [options]
10984
+ * @param {{ signal?: AbortSignal, onValue?: (value: AddrStats) => void, cache?: boolean }} [options]
10967
10985
  * @returns {Promise<AddrStats>}
10968
10986
  */
10969
- async getAddress(address, { signal, onValue } = {}) {
10987
+ async getAddress(address, { signal, onValue, cache } = {}) {
10970
10988
  const path = `/api/address/${address}`;
10971
- return this.getJson(path, { signal, onValue });
10989
+ return this.getJson(path, { signal, onValue, cache });
10972
10990
  }
10973
10991
 
10974
10992
  /**
@@ -10981,12 +10999,12 @@ class BrkClient extends BrkClientBase {
10981
10999
  * Endpoint: `GET /api/address/{address}/txs`
10982
11000
  *
10983
11001
  * @param {Addr} address
10984
- * @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void }} [options]
11002
+ * @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void, cache?: boolean }} [options]
10985
11003
  * @returns {Promise<Transaction[]>}
10986
11004
  */
10987
- async getAddressTxs(address, { signal, onValue } = {}) {
11005
+ async getAddressTxs(address, { signal, onValue, cache } = {}) {
10988
11006
  const path = `/api/address/${address}/txs`;
10989
- return this.getJson(path, { signal, onValue });
11007
+ return this.getJson(path, { signal, onValue, cache });
10990
11008
  }
10991
11009
 
10992
11010
  /**
@@ -10999,12 +11017,12 @@ class BrkClient extends BrkClientBase {
10999
11017
  * Endpoint: `GET /api/address/{address}/txs/chain`
11000
11018
  *
11001
11019
  * @param {Addr} address
11002
- * @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void }} [options]
11020
+ * @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void, cache?: boolean }} [options]
11003
11021
  * @returns {Promise<Transaction[]>}
11004
11022
  */
11005
- async getAddressConfirmedTxs(address, { signal, onValue } = {}) {
11023
+ async getAddressConfirmedTxs(address, { signal, onValue, cache } = {}) {
11006
11024
  const path = `/api/address/${address}/txs/chain`;
11007
- return this.getJson(path, { signal, onValue });
11025
+ return this.getJson(path, { signal, onValue, cache });
11008
11026
  }
11009
11027
 
11010
11028
  /**
@@ -11018,12 +11036,12 @@ class BrkClient extends BrkClientBase {
11018
11036
  *
11019
11037
  * @param {Addr} address
11020
11038
  * @param {Txid} after_txid - Last txid from the previous page (return transactions strictly older than this)
11021
- * @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void }} [options]
11039
+ * @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void, cache?: boolean }} [options]
11022
11040
  * @returns {Promise<Transaction[]>}
11023
11041
  */
11024
- async getAddressConfirmedTxsAfter(address, after_txid, { signal, onValue } = {}) {
11042
+ async getAddressConfirmedTxsAfter(address, after_txid, { signal, onValue, cache } = {}) {
11025
11043
  const path = `/api/address/${address}/txs/chain/${after_txid}`;
11026
- return this.getJson(path, { signal, onValue });
11044
+ return this.getJson(path, { signal, onValue, cache });
11027
11045
  }
11028
11046
 
11029
11047
  /**
@@ -11036,12 +11054,12 @@ class BrkClient extends BrkClientBase {
11036
11054
  * Endpoint: `GET /api/address/{address}/txs/mempool`
11037
11055
  *
11038
11056
  * @param {Addr} address
11039
- * @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void }} [options]
11057
+ * @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void, cache?: boolean }} [options]
11040
11058
  * @returns {Promise<Transaction[]>}
11041
11059
  */
11042
- async getAddressMempoolTxs(address, { signal, onValue } = {}) {
11060
+ async getAddressMempoolTxs(address, { signal, onValue, cache } = {}) {
11043
11061
  const path = `/api/address/${address}/txs/mempool`;
11044
- return this.getJson(path, { signal, onValue });
11062
+ return this.getJson(path, { signal, onValue, cache });
11045
11063
  }
11046
11064
 
11047
11065
  /**
@@ -11054,12 +11072,12 @@ class BrkClient extends BrkClientBase {
11054
11072
  * Endpoint: `GET /api/address/{address}/utxo`
11055
11073
  *
11056
11074
  * @param {Addr} address
11057
- * @param {{ signal?: AbortSignal, onValue?: (value: Utxo[]) => void }} [options]
11075
+ * @param {{ signal?: AbortSignal, onValue?: (value: Utxo[]) => void, cache?: boolean }} [options]
11058
11076
  * @returns {Promise<Utxo[]>}
11059
11077
  */
11060
- async getAddressUtxos(address, { signal, onValue } = {}) {
11078
+ async getAddressUtxos(address, { signal, onValue, cache } = {}) {
11061
11079
  const path = `/api/address/${address}/utxo`;
11062
- return this.getJson(path, { signal, onValue });
11080
+ return this.getJson(path, { signal, onValue, cache });
11063
11081
  }
11064
11082
 
11065
11083
  /**
@@ -11072,12 +11090,12 @@ class BrkClient extends BrkClientBase {
11072
11090
  * Endpoint: `GET /api/v1/validate-address/{address}`
11073
11091
  *
11074
11092
  * @param {string} address - Bitcoin address to validate (can be any string)
11075
- * @param {{ signal?: AbortSignal, onValue?: (value: AddrValidation) => void }} [options]
11093
+ * @param {{ signal?: AbortSignal, onValue?: (value: AddrValidation) => void, cache?: boolean }} [options]
11076
11094
  * @returns {Promise<AddrValidation>}
11077
11095
  */
11078
- async validateAddress(address, { signal, onValue } = {}) {
11096
+ async validateAddress(address, { signal, onValue, cache } = {}) {
11079
11097
  const path = `/api/v1/validate-address/${address}`;
11080
- return this.getJson(path, { signal, onValue });
11098
+ return this.getJson(path, { signal, onValue, cache });
11081
11099
  }
11082
11100
 
11083
11101
  /**
@@ -11090,12 +11108,12 @@ class BrkClient extends BrkClientBase {
11090
11108
  * Endpoint: `GET /api/block/{hash}`
11091
11109
  *
11092
11110
  * @param {BlockHash} hash
11093
- * @param {{ signal?: AbortSignal, onValue?: (value: BlockInfo) => void }} [options]
11111
+ * @param {{ signal?: AbortSignal, onValue?: (value: BlockInfo) => void, cache?: boolean }} [options]
11094
11112
  * @returns {Promise<BlockInfo>}
11095
11113
  */
11096
- async getBlock(hash, { signal, onValue } = {}) {
11114
+ async getBlock(hash, { signal, onValue, cache } = {}) {
11097
11115
  const path = `/api/block/${hash}`;
11098
- return this.getJson(path, { signal, onValue });
11116
+ return this.getJson(path, { signal, onValue, cache });
11099
11117
  }
11100
11118
 
11101
11119
  /**
@@ -11108,12 +11126,12 @@ class BrkClient extends BrkClientBase {
11108
11126
  * Endpoint: `GET /api/v1/block/{hash}`
11109
11127
  *
11110
11128
  * @param {BlockHash} hash
11111
- * @param {{ signal?: AbortSignal, onValue?: (value: BlockInfoV1) => void }} [options]
11129
+ * @param {{ signal?: AbortSignal, onValue?: (value: BlockInfoV1) => void, cache?: boolean }} [options]
11112
11130
  * @returns {Promise<BlockInfoV1>}
11113
11131
  */
11114
- async getBlockV1(hash, { signal, onValue } = {}) {
11132
+ async getBlockV1(hash, { signal, onValue, cache } = {}) {
11115
11133
  const path = `/api/v1/block/${hash}`;
11116
- return this.getJson(path, { signal, onValue });
11134
+ return this.getJson(path, { signal, onValue, cache });
11117
11135
  }
11118
11136
 
11119
11137
  /**
@@ -11126,12 +11144,12 @@ class BrkClient extends BrkClientBase {
11126
11144
  * Endpoint: `GET /api/block/{hash}/header`
11127
11145
  *
11128
11146
  * @param {BlockHash} hash
11129
- * @param {{ signal?: AbortSignal, onValue?: (value: Hex) => void }} [options]
11147
+ * @param {{ signal?: AbortSignal, onValue?: (value: Hex) => void, cache?: boolean }} [options]
11130
11148
  * @returns {Promise<Hex>}
11131
11149
  */
11132
- async getBlockHeader(hash, { signal, onValue } = {}) {
11150
+ async getBlockHeader(hash, { signal, onValue, cache } = {}) {
11133
11151
  const path = `/api/block/${hash}/header`;
11134
- return this.getText(path, { signal, onValue });
11152
+ return this.getText(path, { signal, onValue, cache });
11135
11153
  }
11136
11154
 
11137
11155
  /**
@@ -11144,12 +11162,12 @@ class BrkClient extends BrkClientBase {
11144
11162
  * Endpoint: `GET /api/block-height/{height}`
11145
11163
  *
11146
11164
  * @param {Height} height
11147
- * @param {{ signal?: AbortSignal, onValue?: (value: BlockHash) => void }} [options]
11165
+ * @param {{ signal?: AbortSignal, onValue?: (value: BlockHash) => void, cache?: boolean }} [options]
11148
11166
  * @returns {Promise<BlockHash>}
11149
11167
  */
11150
- async getBlockByHeight(height, { signal, onValue } = {}) {
11168
+ async getBlockByHeight(height, { signal, onValue, cache } = {}) {
11151
11169
  const path = `/api/block-height/${height}`;
11152
- return this.getText(path, { signal, onValue });
11170
+ return this.getText(path, { signal, onValue, cache });
11153
11171
  }
11154
11172
 
11155
11173
  /**
@@ -11162,12 +11180,12 @@ class BrkClient extends BrkClientBase {
11162
11180
  * Endpoint: `GET /api/v1/mining/blocks/timestamp/{timestamp}`
11163
11181
  *
11164
11182
  * @param {Timestamp} timestamp
11165
- * @param {{ signal?: AbortSignal, onValue?: (value: BlockTimestamp) => void }} [options]
11183
+ * @param {{ signal?: AbortSignal, onValue?: (value: BlockTimestamp) => void, cache?: boolean }} [options]
11166
11184
  * @returns {Promise<BlockTimestamp>}
11167
11185
  */
11168
- async getBlockByTimestamp(timestamp, { signal, onValue } = {}) {
11186
+ async getBlockByTimestamp(timestamp, { signal, onValue, cache } = {}) {
11169
11187
  const path = `/api/v1/mining/blocks/timestamp/${timestamp}`;
11170
- return this.getJson(path, { signal, onValue });
11188
+ return this.getJson(path, { signal, onValue, cache });
11171
11189
  }
11172
11190
 
11173
11191
  /**
@@ -11180,12 +11198,12 @@ class BrkClient extends BrkClientBase {
11180
11198
  * Endpoint: `GET /api/block/{hash}/raw`
11181
11199
  *
11182
11200
  * @param {BlockHash} hash
11183
- * @param {{ signal?: AbortSignal, onValue?: (value: Uint8Array) => void }} [options]
11201
+ * @param {{ signal?: AbortSignal, onValue?: (value: Uint8Array) => void, cache?: boolean }} [options]
11184
11202
  * @returns {Promise<Uint8Array>}
11185
11203
  */
11186
- async getBlockRaw(hash, { signal, onValue } = {}) {
11204
+ async getBlockRaw(hash, { signal, onValue, cache } = {}) {
11187
11205
  const path = `/api/block/${hash}/raw`;
11188
- return this.getBytes(path, { signal, onValue });
11206
+ return this.getBytes(path, { signal, onValue, cache });
11189
11207
  }
11190
11208
 
11191
11209
  /**
@@ -11198,12 +11216,12 @@ class BrkClient extends BrkClientBase {
11198
11216
  * Endpoint: `GET /api/block/{hash}/status`
11199
11217
  *
11200
11218
  * @param {BlockHash} hash
11201
- * @param {{ signal?: AbortSignal, onValue?: (value: BlockStatus) => void }} [options]
11219
+ * @param {{ signal?: AbortSignal, onValue?: (value: BlockStatus) => void, cache?: boolean }} [options]
11202
11220
  * @returns {Promise<BlockStatus>}
11203
11221
  */
11204
- async getBlockStatus(hash, { signal, onValue } = {}) {
11222
+ async getBlockStatus(hash, { signal, onValue, cache } = {}) {
11205
11223
  const path = `/api/block/${hash}/status`;
11206
- return this.getJson(path, { signal, onValue });
11224
+ return this.getJson(path, { signal, onValue, cache });
11207
11225
  }
11208
11226
 
11209
11227
  /**
@@ -11214,12 +11232,12 @@ class BrkClient extends BrkClientBase {
11214
11232
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-tip-height)*
11215
11233
  *
11216
11234
  * Endpoint: `GET /api/blocks/tip/height`
11217
- * @param {{ signal?: AbortSignal, onValue?: (value: Height) => void }} [options]
11235
+ * @param {{ signal?: AbortSignal, onValue?: (value: Height) => void, cache?: boolean }} [options]
11218
11236
  * @returns {Promise<Height>}
11219
11237
  */
11220
- async getBlockTipHeight({ signal, onValue } = {}) {
11238
+ async getBlockTipHeight({ signal, onValue, cache } = {}) {
11221
11239
  const path = `/api/blocks/tip/height`;
11222
- return Number(await this.getText(path, { signal, onValue: onValue ? (v) => onValue(Number(v)) : undefined }));
11240
+ return Number(await this.getText(path, { signal, cache, onValue: onValue ? (v) => onValue(Number(v)) : undefined }));
11223
11241
  }
11224
11242
 
11225
11243
  /**
@@ -11230,12 +11248,12 @@ class BrkClient extends BrkClientBase {
11230
11248
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-tip-hash)*
11231
11249
  *
11232
11250
  * Endpoint: `GET /api/blocks/tip/hash`
11233
- * @param {{ signal?: AbortSignal, onValue?: (value: BlockHash) => void }} [options]
11251
+ * @param {{ signal?: AbortSignal, onValue?: (value: BlockHash) => void, cache?: boolean }} [options]
11234
11252
  * @returns {Promise<BlockHash>}
11235
11253
  */
11236
- async getBlockTipHash({ signal, onValue } = {}) {
11254
+ async getBlockTipHash({ signal, onValue, cache } = {}) {
11237
11255
  const path = `/api/blocks/tip/hash`;
11238
- return this.getText(path, { signal, onValue });
11256
+ return this.getText(path, { signal, onValue, cache });
11239
11257
  }
11240
11258
 
11241
11259
  /**
@@ -11249,12 +11267,12 @@ class BrkClient extends BrkClientBase {
11249
11267
  *
11250
11268
  * @param {BlockHash} hash - Bitcoin block hash
11251
11269
  * @param {BlockTxIndex} index - Transaction index within the block (0-based)
11252
- * @param {{ signal?: AbortSignal, onValue?: (value: Txid) => void }} [options]
11270
+ * @param {{ signal?: AbortSignal, onValue?: (value: Txid) => void, cache?: boolean }} [options]
11253
11271
  * @returns {Promise<Txid>}
11254
11272
  */
11255
- async getBlockTxid(hash, index, { signal, onValue } = {}) {
11273
+ async getBlockTxid(hash, index, { signal, onValue, cache } = {}) {
11256
11274
  const path = `/api/block/${hash}/txid/${index}`;
11257
- return this.getText(path, { signal, onValue });
11275
+ return this.getText(path, { signal, onValue, cache });
11258
11276
  }
11259
11277
 
11260
11278
  /**
@@ -11267,12 +11285,12 @@ class BrkClient extends BrkClientBase {
11267
11285
  * Endpoint: `GET /api/block/{hash}/txids`
11268
11286
  *
11269
11287
  * @param {BlockHash} hash
11270
- * @param {{ signal?: AbortSignal, onValue?: (value: Txid[]) => void }} [options]
11288
+ * @param {{ signal?: AbortSignal, onValue?: (value: Txid[]) => void, cache?: boolean }} [options]
11271
11289
  * @returns {Promise<Txid[]>}
11272
11290
  */
11273
- async getBlockTxids(hash, { signal, onValue } = {}) {
11291
+ async getBlockTxids(hash, { signal, onValue, cache } = {}) {
11274
11292
  const path = `/api/block/${hash}/txids`;
11275
- return this.getJson(path, { signal, onValue });
11293
+ return this.getJson(path, { signal, onValue, cache });
11276
11294
  }
11277
11295
 
11278
11296
  /**
@@ -11285,12 +11303,12 @@ class BrkClient extends BrkClientBase {
11285
11303
  * Endpoint: `GET /api/block/{hash}/txs`
11286
11304
  *
11287
11305
  * @param {BlockHash} hash
11288
- * @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void }} [options]
11306
+ * @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void, cache?: boolean }} [options]
11289
11307
  * @returns {Promise<Transaction[]>}
11290
11308
  */
11291
- async getBlockTxs(hash, { signal, onValue } = {}) {
11309
+ async getBlockTxs(hash, { signal, onValue, cache } = {}) {
11292
11310
  const path = `/api/block/${hash}/txs`;
11293
- return this.getJson(path, { signal, onValue });
11311
+ return this.getJson(path, { signal, onValue, cache });
11294
11312
  }
11295
11313
 
11296
11314
  /**
@@ -11304,12 +11322,12 @@ class BrkClient extends BrkClientBase {
11304
11322
  *
11305
11323
  * @param {BlockHash} hash - Bitcoin block hash
11306
11324
  * @param {BlockTxIndex} start_index - Starting transaction index within the block (0-based)
11307
- * @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void }} [options]
11325
+ * @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void, cache?: boolean }} [options]
11308
11326
  * @returns {Promise<Transaction[]>}
11309
11327
  */
11310
- async getBlockTxsFromIndex(hash, start_index, { signal, onValue } = {}) {
11328
+ async getBlockTxsFromIndex(hash, start_index, { signal, onValue, cache } = {}) {
11311
11329
  const path = `/api/block/${hash}/txs/${start_index}`;
11312
- return this.getJson(path, { signal, onValue });
11330
+ return this.getJson(path, { signal, onValue, cache });
11313
11331
  }
11314
11332
 
11315
11333
  /**
@@ -11320,12 +11338,12 @@ class BrkClient extends BrkClientBase {
11320
11338
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-blocks)*
11321
11339
  *
11322
11340
  * Endpoint: `GET /api/blocks`
11323
- * @param {{ signal?: AbortSignal, onValue?: (value: BlockInfo[]) => void }} [options]
11341
+ * @param {{ signal?: AbortSignal, onValue?: (value: BlockInfo[]) => void, cache?: boolean }} [options]
11324
11342
  * @returns {Promise<BlockInfo[]>}
11325
11343
  */
11326
- async getBlocks({ signal, onValue } = {}) {
11344
+ async getBlocks({ signal, onValue, cache } = {}) {
11327
11345
  const path = `/api/blocks`;
11328
- return this.getJson(path, { signal, onValue });
11346
+ return this.getJson(path, { signal, onValue, cache });
11329
11347
  }
11330
11348
 
11331
11349
  /**
@@ -11338,12 +11356,12 @@ class BrkClient extends BrkClientBase {
11338
11356
  * Endpoint: `GET /api/blocks/{height}`
11339
11357
  *
11340
11358
  * @param {Height} height
11341
- * @param {{ signal?: AbortSignal, onValue?: (value: BlockInfo[]) => void }} [options]
11359
+ * @param {{ signal?: AbortSignal, onValue?: (value: BlockInfo[]) => void, cache?: boolean }} [options]
11342
11360
  * @returns {Promise<BlockInfo[]>}
11343
11361
  */
11344
- async getBlocksFromHeight(height, { signal, onValue } = {}) {
11362
+ async getBlocksFromHeight(height, { signal, onValue, cache } = {}) {
11345
11363
  const path = `/api/blocks/${height}`;
11346
- return this.getJson(path, { signal, onValue });
11364
+ return this.getJson(path, { signal, onValue, cache });
11347
11365
  }
11348
11366
 
11349
11367
  /**
@@ -11354,12 +11372,12 @@ class BrkClient extends BrkClientBase {
11354
11372
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-blocks-v1)*
11355
11373
  *
11356
11374
  * Endpoint: `GET /api/v1/blocks`
11357
- * @param {{ signal?: AbortSignal, onValue?: (value: BlockInfoV1[]) => void }} [options]
11375
+ * @param {{ signal?: AbortSignal, onValue?: (value: BlockInfoV1[]) => void, cache?: boolean }} [options]
11358
11376
  * @returns {Promise<BlockInfoV1[]>}
11359
11377
  */
11360
- async getBlocksV1({ signal, onValue } = {}) {
11378
+ async getBlocksV1({ signal, onValue, cache } = {}) {
11361
11379
  const path = `/api/v1/blocks`;
11362
- return this.getJson(path, { signal, onValue });
11380
+ return this.getJson(path, { signal, onValue, cache });
11363
11381
  }
11364
11382
 
11365
11383
  /**
@@ -11372,12 +11390,12 @@ class BrkClient extends BrkClientBase {
11372
11390
  * Endpoint: `GET /api/v1/blocks/{height}`
11373
11391
  *
11374
11392
  * @param {Height} height
11375
- * @param {{ signal?: AbortSignal, onValue?: (value: BlockInfoV1[]) => void }} [options]
11393
+ * @param {{ signal?: AbortSignal, onValue?: (value: BlockInfoV1[]) => void, cache?: boolean }} [options]
11376
11394
  * @returns {Promise<BlockInfoV1[]>}
11377
11395
  */
11378
- async getBlocksV1FromHeight(height, { signal, onValue } = {}) {
11396
+ async getBlocksV1FromHeight(height, { signal, onValue, cache } = {}) {
11379
11397
  const path = `/api/v1/blocks/${height}`;
11380
- return this.getJson(path, { signal, onValue });
11398
+ return this.getJson(path, { signal, onValue, cache });
11381
11399
  }
11382
11400
 
11383
11401
  /**
@@ -11388,12 +11406,12 @@ class BrkClient extends BrkClientBase {
11388
11406
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pools)*
11389
11407
  *
11390
11408
  * Endpoint: `GET /api/v1/mining/pools`
11391
- * @param {{ signal?: AbortSignal, onValue?: (value: PoolInfo[]) => void }} [options]
11409
+ * @param {{ signal?: AbortSignal, onValue?: (value: PoolInfo[]) => void, cache?: boolean }} [options]
11392
11410
  * @returns {Promise<PoolInfo[]>}
11393
11411
  */
11394
- async getPools({ signal, onValue } = {}) {
11412
+ async getPools({ signal, onValue, cache } = {}) {
11395
11413
  const path = `/api/v1/mining/pools`;
11396
- return this.getJson(path, { signal, onValue });
11414
+ return this.getJson(path, { signal, onValue, cache });
11397
11415
  }
11398
11416
 
11399
11417
  /**
@@ -11406,12 +11424,12 @@ class BrkClient extends BrkClientBase {
11406
11424
  * Endpoint: `GET /api/v1/mining/pools/{time_period}`
11407
11425
  *
11408
11426
  * @param {TimePeriod} time_period
11409
- * @param {{ signal?: AbortSignal, onValue?: (value: PoolsSummary) => void }} [options]
11427
+ * @param {{ signal?: AbortSignal, onValue?: (value: PoolsSummary) => void, cache?: boolean }} [options]
11410
11428
  * @returns {Promise<PoolsSummary>}
11411
11429
  */
11412
- async getPoolStats(time_period, { signal, onValue } = {}) {
11430
+ async getPoolStats(time_period, { signal, onValue, cache } = {}) {
11413
11431
  const path = `/api/v1/mining/pools/${time_period}`;
11414
- return this.getJson(path, { signal, onValue });
11432
+ return this.getJson(path, { signal, onValue, cache });
11415
11433
  }
11416
11434
 
11417
11435
  /**
@@ -11424,12 +11442,12 @@ class BrkClient extends BrkClientBase {
11424
11442
  * Endpoint: `GET /api/v1/mining/pool/{slug}`
11425
11443
  *
11426
11444
  * @param {PoolSlug} slug
11427
- * @param {{ signal?: AbortSignal, onValue?: (value: PoolDetail) => void }} [options]
11445
+ * @param {{ signal?: AbortSignal, onValue?: (value: PoolDetail) => void, cache?: boolean }} [options]
11428
11446
  * @returns {Promise<PoolDetail>}
11429
11447
  */
11430
- async getPool(slug, { signal, onValue } = {}) {
11448
+ async getPool(slug, { signal, onValue, cache } = {}) {
11431
11449
  const path = `/api/v1/mining/pool/${slug}`;
11432
- return this.getJson(path, { signal, onValue });
11450
+ return this.getJson(path, { signal, onValue, cache });
11433
11451
  }
11434
11452
 
11435
11453
  /**
@@ -11440,12 +11458,12 @@ class BrkClient extends BrkClientBase {
11440
11458
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pool-hashrates)*
11441
11459
  *
11442
11460
  * Endpoint: `GET /api/v1/mining/hashrate/pools`
11443
- * @param {{ signal?: AbortSignal, onValue?: (value: PoolHashrateEntry[]) => void }} [options]
11461
+ * @param {{ signal?: AbortSignal, onValue?: (value: PoolHashrateEntry[]) => void, cache?: boolean }} [options]
11444
11462
  * @returns {Promise<PoolHashrateEntry[]>}
11445
11463
  */
11446
- async getPoolsHashrate({ signal, onValue } = {}) {
11464
+ async getPoolsHashrate({ signal, onValue, cache } = {}) {
11447
11465
  const path = `/api/v1/mining/hashrate/pools`;
11448
- return this.getJson(path, { signal, onValue });
11466
+ return this.getJson(path, { signal, onValue, cache });
11449
11467
  }
11450
11468
 
11451
11469
  /**
@@ -11458,12 +11476,12 @@ class BrkClient extends BrkClientBase {
11458
11476
  * Endpoint: `GET /api/v1/mining/hashrate/pools/{time_period}`
11459
11477
  *
11460
11478
  * @param {TimePeriod} time_period
11461
- * @param {{ signal?: AbortSignal, onValue?: (value: PoolHashrateEntry[]) => void }} [options]
11479
+ * @param {{ signal?: AbortSignal, onValue?: (value: PoolHashrateEntry[]) => void, cache?: boolean }} [options]
11462
11480
  * @returns {Promise<PoolHashrateEntry[]>}
11463
11481
  */
11464
- async getPoolsHashrateByPeriod(time_period, { signal, onValue } = {}) {
11482
+ async getPoolsHashrateByPeriod(time_period, { signal, onValue, cache } = {}) {
11465
11483
  const path = `/api/v1/mining/hashrate/pools/${time_period}`;
11466
- return this.getJson(path, { signal, onValue });
11484
+ return this.getJson(path, { signal, onValue, cache });
11467
11485
  }
11468
11486
 
11469
11487
  /**
@@ -11476,12 +11494,12 @@ class BrkClient extends BrkClientBase {
11476
11494
  * Endpoint: `GET /api/v1/mining/pool/{slug}/hashrate`
11477
11495
  *
11478
11496
  * @param {PoolSlug} slug
11479
- * @param {{ signal?: AbortSignal, onValue?: (value: PoolHashrateEntry[]) => void }} [options]
11497
+ * @param {{ signal?: AbortSignal, onValue?: (value: PoolHashrateEntry[]) => void, cache?: boolean }} [options]
11480
11498
  * @returns {Promise<PoolHashrateEntry[]>}
11481
11499
  */
11482
- async getPoolHashrate(slug, { signal, onValue } = {}) {
11500
+ async getPoolHashrate(slug, { signal, onValue, cache } = {}) {
11483
11501
  const path = `/api/v1/mining/pool/${slug}/hashrate`;
11484
- return this.getJson(path, { signal, onValue });
11502
+ return this.getJson(path, { signal, onValue, cache });
11485
11503
  }
11486
11504
 
11487
11505
  /**
@@ -11494,12 +11512,12 @@ class BrkClient extends BrkClientBase {
11494
11512
  * Endpoint: `GET /api/v1/mining/pool/{slug}/blocks`
11495
11513
  *
11496
11514
  * @param {PoolSlug} slug
11497
- * @param {{ signal?: AbortSignal, onValue?: (value: BlockInfoV1[]) => void }} [options]
11515
+ * @param {{ signal?: AbortSignal, onValue?: (value: BlockInfoV1[]) => void, cache?: boolean }} [options]
11498
11516
  * @returns {Promise<BlockInfoV1[]>}
11499
11517
  */
11500
- async getPoolBlocks(slug, { signal, onValue } = {}) {
11518
+ async getPoolBlocks(slug, { signal, onValue, cache } = {}) {
11501
11519
  const path = `/api/v1/mining/pool/${slug}/blocks`;
11502
- return this.getJson(path, { signal, onValue });
11520
+ return this.getJson(path, { signal, onValue, cache });
11503
11521
  }
11504
11522
 
11505
11523
  /**
@@ -11513,12 +11531,12 @@ class BrkClient extends BrkClientBase {
11513
11531
  *
11514
11532
  * @param {PoolSlug} slug
11515
11533
  * @param {Height} height
11516
- * @param {{ signal?: AbortSignal, onValue?: (value: BlockInfoV1[]) => void }} [options]
11534
+ * @param {{ signal?: AbortSignal, onValue?: (value: BlockInfoV1[]) => void, cache?: boolean }} [options]
11517
11535
  * @returns {Promise<BlockInfoV1[]>}
11518
11536
  */
11519
- async getPoolBlocksFrom(slug, height, { signal, onValue } = {}) {
11537
+ async getPoolBlocksFrom(slug, height, { signal, onValue, cache } = {}) {
11520
11538
  const path = `/api/v1/mining/pool/${slug}/blocks/${height}`;
11521
- return this.getJson(path, { signal, onValue });
11539
+ return this.getJson(path, { signal, onValue, cache });
11522
11540
  }
11523
11541
 
11524
11542
  /**
@@ -11529,12 +11547,12 @@ class BrkClient extends BrkClientBase {
11529
11547
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-hashrate)*
11530
11548
  *
11531
11549
  * Endpoint: `GET /api/v1/mining/hashrate`
11532
- * @param {{ signal?: AbortSignal, onValue?: (value: HashrateSummary) => void }} [options]
11550
+ * @param {{ signal?: AbortSignal, onValue?: (value: HashrateSummary) => void, cache?: boolean }} [options]
11533
11551
  * @returns {Promise<HashrateSummary>}
11534
11552
  */
11535
- async getHashrate({ signal, onValue } = {}) {
11553
+ async getHashrate({ signal, onValue, cache } = {}) {
11536
11554
  const path = `/api/v1/mining/hashrate`;
11537
- return this.getJson(path, { signal, onValue });
11555
+ return this.getJson(path, { signal, onValue, cache });
11538
11556
  }
11539
11557
 
11540
11558
  /**
@@ -11547,12 +11565,12 @@ class BrkClient extends BrkClientBase {
11547
11565
  * Endpoint: `GET /api/v1/mining/hashrate/{time_period}`
11548
11566
  *
11549
11567
  * @param {TimePeriod} time_period
11550
- * @param {{ signal?: AbortSignal, onValue?: (value: HashrateSummary) => void }} [options]
11568
+ * @param {{ signal?: AbortSignal, onValue?: (value: HashrateSummary) => void, cache?: boolean }} [options]
11551
11569
  * @returns {Promise<HashrateSummary>}
11552
11570
  */
11553
- async getHashrateByPeriod(time_period, { signal, onValue } = {}) {
11571
+ async getHashrateByPeriod(time_period, { signal, onValue, cache } = {}) {
11554
11572
  const path = `/api/v1/mining/hashrate/${time_period}`;
11555
- return this.getJson(path, { signal, onValue });
11573
+ return this.getJson(path, { signal, onValue, cache });
11556
11574
  }
11557
11575
 
11558
11576
  /**
@@ -11563,12 +11581,12 @@ class BrkClient extends BrkClientBase {
11563
11581
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-difficulty-adjustments)*
11564
11582
  *
11565
11583
  * Endpoint: `GET /api/v1/mining/difficulty-adjustments`
11566
- * @param {{ signal?: AbortSignal, onValue?: (value: DifficultyAdjustmentEntry[]) => void }} [options]
11584
+ * @param {{ signal?: AbortSignal, onValue?: (value: DifficultyAdjustmentEntry[]) => void, cache?: boolean }} [options]
11567
11585
  * @returns {Promise<DifficultyAdjustmentEntry[]>}
11568
11586
  */
11569
- async getDifficultyAdjustments({ signal, onValue } = {}) {
11587
+ async getDifficultyAdjustments({ signal, onValue, cache } = {}) {
11570
11588
  const path = `/api/v1/mining/difficulty-adjustments`;
11571
- return this.getJson(path, { signal, onValue });
11589
+ return this.getJson(path, { signal, onValue, cache });
11572
11590
  }
11573
11591
 
11574
11592
  /**
@@ -11581,12 +11599,12 @@ class BrkClient extends BrkClientBase {
11581
11599
  * Endpoint: `GET /api/v1/mining/difficulty-adjustments/{time_period}`
11582
11600
  *
11583
11601
  * @param {TimePeriod} time_period
11584
- * @param {{ signal?: AbortSignal, onValue?: (value: DifficultyAdjustmentEntry[]) => void }} [options]
11602
+ * @param {{ signal?: AbortSignal, onValue?: (value: DifficultyAdjustmentEntry[]) => void, cache?: boolean }} [options]
11585
11603
  * @returns {Promise<DifficultyAdjustmentEntry[]>}
11586
11604
  */
11587
- async getDifficultyAdjustmentsByPeriod(time_period, { signal, onValue } = {}) {
11605
+ async getDifficultyAdjustmentsByPeriod(time_period, { signal, onValue, cache } = {}) {
11588
11606
  const path = `/api/v1/mining/difficulty-adjustments/${time_period}`;
11589
- return this.getJson(path, { signal, onValue });
11607
+ return this.getJson(path, { signal, onValue, cache });
11590
11608
  }
11591
11609
 
11592
11610
  /**
@@ -11599,12 +11617,12 @@ class BrkClient extends BrkClientBase {
11599
11617
  * Endpoint: `GET /api/v1/mining/reward-stats/{block_count}`
11600
11618
  *
11601
11619
  * @param {number} block_count - Number of recent blocks to include
11602
- * @param {{ signal?: AbortSignal, onValue?: (value: RewardStats) => void }} [options]
11620
+ * @param {{ signal?: AbortSignal, onValue?: (value: RewardStats) => void, cache?: boolean }} [options]
11603
11621
  * @returns {Promise<RewardStats>}
11604
11622
  */
11605
- async getRewardStats(block_count, { signal, onValue } = {}) {
11623
+ async getRewardStats(block_count, { signal, onValue, cache } = {}) {
11606
11624
  const path = `/api/v1/mining/reward-stats/${block_count}`;
11607
- return this.getJson(path, { signal, onValue });
11625
+ return this.getJson(path, { signal, onValue, cache });
11608
11626
  }
11609
11627
 
11610
11628
  /**
@@ -11617,12 +11635,12 @@ class BrkClient extends BrkClientBase {
11617
11635
  * Endpoint: `GET /api/v1/mining/blocks/fees/{time_period}`
11618
11636
  *
11619
11637
  * @param {TimePeriod} time_period
11620
- * @param {{ signal?: AbortSignal, onValue?: (value: BlockFeesEntry[]) => void }} [options]
11638
+ * @param {{ signal?: AbortSignal, onValue?: (value: BlockFeesEntry[]) => void, cache?: boolean }} [options]
11621
11639
  * @returns {Promise<BlockFeesEntry[]>}
11622
11640
  */
11623
- async getBlockFees(time_period, { signal, onValue } = {}) {
11641
+ async getBlockFees(time_period, { signal, onValue, cache } = {}) {
11624
11642
  const path = `/api/v1/mining/blocks/fees/${time_period}`;
11625
- return this.getJson(path, { signal, onValue });
11643
+ return this.getJson(path, { signal, onValue, cache });
11626
11644
  }
11627
11645
 
11628
11646
  /**
@@ -11635,12 +11653,12 @@ class BrkClient extends BrkClientBase {
11635
11653
  * Endpoint: `GET /api/v1/mining/blocks/rewards/{time_period}`
11636
11654
  *
11637
11655
  * @param {TimePeriod} time_period
11638
- * @param {{ signal?: AbortSignal, onValue?: (value: BlockRewardsEntry[]) => void }} [options]
11656
+ * @param {{ signal?: AbortSignal, onValue?: (value: BlockRewardsEntry[]) => void, cache?: boolean }} [options]
11639
11657
  * @returns {Promise<BlockRewardsEntry[]>}
11640
11658
  */
11641
- async getBlockRewards(time_period, { signal, onValue } = {}) {
11659
+ async getBlockRewards(time_period, { signal, onValue, cache } = {}) {
11642
11660
  const path = `/api/v1/mining/blocks/rewards/${time_period}`;
11643
- return this.getJson(path, { signal, onValue });
11661
+ return this.getJson(path, { signal, onValue, cache });
11644
11662
  }
11645
11663
 
11646
11664
  /**
@@ -11653,12 +11671,12 @@ class BrkClient extends BrkClientBase {
11653
11671
  * Endpoint: `GET /api/v1/mining/blocks/fee-rates/{time_period}`
11654
11672
  *
11655
11673
  * @param {TimePeriod} time_period
11656
- * @param {{ signal?: AbortSignal, onValue?: (value: BlockFeeRatesEntry[]) => void }} [options]
11674
+ * @param {{ signal?: AbortSignal, onValue?: (value: BlockFeeRatesEntry[]) => void, cache?: boolean }} [options]
11657
11675
  * @returns {Promise<BlockFeeRatesEntry[]>}
11658
11676
  */
11659
- async getBlockFeeRates(time_period, { signal, onValue } = {}) {
11677
+ async getBlockFeeRates(time_period, { signal, onValue, cache } = {}) {
11660
11678
  const path = `/api/v1/mining/blocks/fee-rates/${time_period}`;
11661
- return this.getJson(path, { signal, onValue });
11679
+ return this.getJson(path, { signal, onValue, cache });
11662
11680
  }
11663
11681
 
11664
11682
  /**
@@ -11671,12 +11689,12 @@ class BrkClient extends BrkClientBase {
11671
11689
  * Endpoint: `GET /api/v1/mining/blocks/sizes-weights/{time_period}`
11672
11690
  *
11673
11691
  * @param {TimePeriod} time_period
11674
- * @param {{ signal?: AbortSignal, onValue?: (value: BlockSizesWeights) => void }} [options]
11692
+ * @param {{ signal?: AbortSignal, onValue?: (value: BlockSizesWeights) => void, cache?: boolean }} [options]
11675
11693
  * @returns {Promise<BlockSizesWeights>}
11676
11694
  */
11677
- async getBlockSizesWeights(time_period, { signal, onValue } = {}) {
11695
+ async getBlockSizesWeights(time_period, { signal, onValue, cache } = {}) {
11678
11696
  const path = `/api/v1/mining/blocks/sizes-weights/${time_period}`;
11679
- return this.getJson(path, { signal, onValue });
11697
+ return this.getJson(path, { signal, onValue, cache });
11680
11698
  }
11681
11699
 
11682
11700
  /**
@@ -11687,12 +11705,12 @@ class BrkClient extends BrkClientBase {
11687
11705
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mempool-blocks-fees)*
11688
11706
  *
11689
11707
  * Endpoint: `GET /api/v1/fees/mempool-blocks`
11690
- * @param {{ signal?: AbortSignal, onValue?: (value: MempoolBlock[]) => void }} [options]
11708
+ * @param {{ signal?: AbortSignal, onValue?: (value: MempoolBlock[]) => void, cache?: boolean }} [options]
11691
11709
  * @returns {Promise<MempoolBlock[]>}
11692
11710
  */
11693
- async getMempoolBlocks({ signal, onValue } = {}) {
11711
+ async getMempoolBlocks({ signal, onValue, cache } = {}) {
11694
11712
  const path = `/api/v1/fees/mempool-blocks`;
11695
- return this.getJson(path, { signal, onValue });
11713
+ return this.getJson(path, { signal, onValue, cache });
11696
11714
  }
11697
11715
 
11698
11716
  /**
@@ -11703,12 +11721,12 @@ class BrkClient extends BrkClientBase {
11703
11721
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-recommended-fees)*
11704
11722
  *
11705
11723
  * Endpoint: `GET /api/v1/fees/recommended`
11706
- * @param {{ signal?: AbortSignal, onValue?: (value: RecommendedFees) => void }} [options]
11724
+ * @param {{ signal?: AbortSignal, onValue?: (value: RecommendedFees) => void, cache?: boolean }} [options]
11707
11725
  * @returns {Promise<RecommendedFees>}
11708
11726
  */
11709
- async getRecommendedFees({ signal, onValue } = {}) {
11727
+ async getRecommendedFees({ signal, onValue, cache } = {}) {
11710
11728
  const path = `/api/v1/fees/recommended`;
11711
- return this.getJson(path, { signal, onValue });
11729
+ return this.getJson(path, { signal, onValue, cache });
11712
11730
  }
11713
11731
 
11714
11732
  /**
@@ -11719,12 +11737,12 @@ class BrkClient extends BrkClientBase {
11719
11737
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-recommended-fees-precise)*
11720
11738
  *
11721
11739
  * Endpoint: `GET /api/v1/fees/precise`
11722
- * @param {{ signal?: AbortSignal, onValue?: (value: RecommendedFees) => void }} [options]
11740
+ * @param {{ signal?: AbortSignal, onValue?: (value: RecommendedFees) => void, cache?: boolean }} [options]
11723
11741
  * @returns {Promise<RecommendedFees>}
11724
11742
  */
11725
- async getPreciseFees({ signal, onValue } = {}) {
11743
+ async getPreciseFees({ signal, onValue, cache } = {}) {
11726
11744
  const path = `/api/v1/fees/precise`;
11727
- return this.getJson(path, { signal, onValue });
11745
+ return this.getJson(path, { signal, onValue, cache });
11728
11746
  }
11729
11747
 
11730
11748
  /**
@@ -11735,12 +11753,12 @@ class BrkClient extends BrkClientBase {
11735
11753
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mempool)*
11736
11754
  *
11737
11755
  * Endpoint: `GET /api/mempool`
11738
- * @param {{ signal?: AbortSignal, onValue?: (value: MempoolInfo) => void }} [options]
11756
+ * @param {{ signal?: AbortSignal, onValue?: (value: MempoolInfo) => void, cache?: boolean }} [options]
11739
11757
  * @returns {Promise<MempoolInfo>}
11740
11758
  */
11741
- async getMempool({ signal, onValue } = {}) {
11759
+ async getMempool({ signal, onValue, cache } = {}) {
11742
11760
  const path = `/api/mempool`;
11743
- return this.getJson(path, { signal, onValue });
11761
+ return this.getJson(path, { signal, onValue, cache });
11744
11762
  }
11745
11763
 
11746
11764
  /**
@@ -11749,12 +11767,12 @@ class BrkClient extends BrkClientBase {
11749
11767
  * Returns an opaque hash that changes whenever the projected next block changes. Same value as the mempool ETag. Useful as a freshness/liveness signal: if it stays constant for tens of seconds on a live network, the mempool sync loop has stalled.
11750
11768
  *
11751
11769
  * Endpoint: `GET /api/mempool/hash`
11752
- * @param {{ signal?: AbortSignal, onValue?: (value: NextBlockHash) => void }} [options]
11770
+ * @param {{ signal?: AbortSignal, onValue?: (value: NextBlockHash) => void, cache?: boolean }} [options]
11753
11771
  * @returns {Promise<NextBlockHash>}
11754
11772
  */
11755
- async getMempoolHash({ signal, onValue } = {}) {
11773
+ async getMempoolHash({ signal, onValue, cache } = {}) {
11756
11774
  const path = `/api/mempool/hash`;
11757
- return this.getJson(path, { signal, onValue });
11775
+ return this.getJson(path, { signal, onValue, cache });
11758
11776
  }
11759
11777
 
11760
11778
  /**
@@ -11765,12 +11783,12 @@ class BrkClient extends BrkClientBase {
11765
11783
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mempool-transaction-ids)*
11766
11784
  *
11767
11785
  * Endpoint: `GET /api/mempool/txids`
11768
- * @param {{ signal?: AbortSignal, onValue?: (value: Txid[]) => void }} [options]
11786
+ * @param {{ signal?: AbortSignal, onValue?: (value: Txid[]) => void, cache?: boolean }} [options]
11769
11787
  * @returns {Promise<Txid[]>}
11770
11788
  */
11771
- async getMempoolTxids({ signal, onValue } = {}) {
11789
+ async getMempoolTxids({ signal, onValue, cache } = {}) {
11772
11790
  const path = `/api/mempool/txids`;
11773
- return this.getJson(path, { signal, onValue });
11791
+ return this.getJson(path, { signal, onValue, cache });
11774
11792
  }
11775
11793
 
11776
11794
  /**
@@ -11781,12 +11799,12 @@ class BrkClient extends BrkClientBase {
11781
11799
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mempool-recent)*
11782
11800
  *
11783
11801
  * Endpoint: `GET /api/mempool/recent`
11784
- * @param {{ signal?: AbortSignal, onValue?: (value: MempoolRecentTx[]) => void }} [options]
11802
+ * @param {{ signal?: AbortSignal, onValue?: (value: MempoolRecentTx[]) => void, cache?: boolean }} [options]
11785
11803
  * @returns {Promise<MempoolRecentTx[]>}
11786
11804
  */
11787
- async getMempoolRecent({ signal, onValue } = {}) {
11805
+ async getMempoolRecent({ signal, onValue, cache } = {}) {
11788
11806
  const path = `/api/mempool/recent`;
11789
- return this.getJson(path, { signal, onValue });
11807
+ return this.getJson(path, { signal, onValue, cache });
11790
11808
  }
11791
11809
 
11792
11810
  /**
@@ -11797,12 +11815,12 @@ class BrkClient extends BrkClientBase {
11797
11815
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-replacements)*
11798
11816
  *
11799
11817
  * Endpoint: `GET /api/v1/replacements`
11800
- * @param {{ signal?: AbortSignal, onValue?: (value: ReplacementNode[]) => void }} [options]
11818
+ * @param {{ signal?: AbortSignal, onValue?: (value: ReplacementNode[]) => void, cache?: boolean }} [options]
11801
11819
  * @returns {Promise<ReplacementNode[]>}
11802
11820
  */
11803
- async getReplacements({ signal, onValue } = {}) {
11821
+ async getReplacements({ signal, onValue, cache } = {}) {
11804
11822
  const path = `/api/v1/replacements`;
11805
- return this.getJson(path, { signal, onValue });
11823
+ return this.getJson(path, { signal, onValue, cache });
11806
11824
  }
11807
11825
 
11808
11826
  /**
@@ -11813,12 +11831,12 @@ class BrkClient extends BrkClientBase {
11813
11831
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-fullrbf-replacements)*
11814
11832
  *
11815
11833
  * Endpoint: `GET /api/v1/fullrbf/replacements`
11816
- * @param {{ signal?: AbortSignal, onValue?: (value: ReplacementNode[]) => void }} [options]
11834
+ * @param {{ signal?: AbortSignal, onValue?: (value: ReplacementNode[]) => void, cache?: boolean }} [options]
11817
11835
  * @returns {Promise<ReplacementNode[]>}
11818
11836
  */
11819
- async getFullrbfReplacements({ signal, onValue } = {}) {
11837
+ async getFullrbfReplacements({ signal, onValue, cache } = {}) {
11820
11838
  const path = `/api/v1/fullrbf/replacements`;
11821
- return this.getJson(path, { signal, onValue });
11839
+ return this.getJson(path, { signal, onValue, cache });
11822
11840
  }
11823
11841
 
11824
11842
  /**
@@ -11827,12 +11845,12 @@ class BrkClient extends BrkClientBase {
11827
11845
  * Bitcoin Core's `getblocktemplate` selection: full transaction bodies in GBT order with aggregate stats. The returned `hash` is an opaque content token; pass it as `<hash>` on `/api/v1/mempool/block-template/diff/{hash}` to fetch deltas instead of refetching the whole template.
11828
11846
  *
11829
11847
  * Endpoint: `GET /api/v1/mempool/block-template`
11830
- * @param {{ signal?: AbortSignal, onValue?: (value: BlockTemplate) => void }} [options]
11848
+ * @param {{ signal?: AbortSignal, onValue?: (value: BlockTemplate) => void, cache?: boolean }} [options]
11831
11849
  * @returns {Promise<BlockTemplate>}
11832
11850
  */
11833
- async getBlockTemplate({ signal, onValue } = {}) {
11851
+ async getBlockTemplate({ signal, onValue, cache } = {}) {
11834
11852
  const path = `/api/v1/mempool/block-template`;
11835
- return this.getJson(path, { signal, onValue });
11853
+ return this.getJson(path, { signal, onValue, cache });
11836
11854
  }
11837
11855
 
11838
11856
  /**
@@ -11843,12 +11861,12 @@ class BrkClient extends BrkClientBase {
11843
11861
  * Endpoint: `GET /api/v1/mempool/block-template/diff/{hash}`
11844
11862
  *
11845
11863
  * @param {NextBlockHash} hash
11846
- * @param {{ signal?: AbortSignal, onValue?: (value: BlockTemplateDiff) => void }} [options]
11864
+ * @param {{ signal?: AbortSignal, onValue?: (value: BlockTemplateDiff) => void, cache?: boolean }} [options]
11847
11865
  * @returns {Promise<BlockTemplateDiff>}
11848
11866
  */
11849
- async getBlockTemplateDiff(hash, { signal, onValue } = {}) {
11867
+ async getBlockTemplateDiff(hash, { signal, onValue, cache } = {}) {
11850
11868
  const path = `/api/v1/mempool/block-template/diff/${hash}`;
11851
- return this.getJson(path, { signal, onValue });
11869
+ return this.getJson(path, { signal, onValue, cache });
11852
11870
  }
11853
11871
 
11854
11872
  /**
@@ -11857,12 +11875,86 @@ class BrkClient extends BrkClientBase {
11857
11875
  * Returns the current BTC/USD price in dollars, derived from on-chain round-dollar output patterns in the last 12 blocks plus mempool.
11858
11876
  *
11859
11877
  * Endpoint: `GET /api/mempool/price`
11860
- * @param {{ signal?: AbortSignal, onValue?: (value: Dollars) => void }} [options]
11878
+ * @param {{ signal?: AbortSignal, onValue?: (value: Dollars) => void, cache?: boolean }} [options]
11861
11879
  * @returns {Promise<Dollars>}
11862
11880
  */
11863
- async getLivePrice({ signal, onValue } = {}) {
11881
+ async getLivePrice({ signal, onValue, cache } = {}) {
11864
11882
  const path = `/api/mempool/price`;
11865
- return this.getJson(path, { signal, onValue });
11883
+ return this.getJson(path, { signal, onValue, cache });
11884
+ }
11885
+
11886
+ /**
11887
+ * Live BTC/USD price
11888
+ *
11889
+ * Current BTC/USD price in dollars. Same value as `/api/mempool/price`. Confirmed per-height history is available at `/api/vecs/height-to-price`.
11890
+ *
11891
+ * Endpoint: `GET /api/oracle/price`
11892
+ * @param {{ signal?: AbortSignal, onValue?: (value: Dollars) => void, cache?: boolean }} [options]
11893
+ * @returns {Promise<Dollars>}
11894
+ */
11895
+ async getOraclePrice({ signal, onValue, cache } = {}) {
11896
+ const path = `/api/oracle/price`;
11897
+ return this.getJson(path, { signal, onValue, cache });
11898
+ }
11899
+
11900
+ /**
11901
+ * Live payment output histogram
11902
+ *
11903
+ * Live smoothed histogram of oracle-eligible payment outputs, binned by output value on the oracle log scale. It combines the committed oracle window with the forming mempool block. A flat array of log-scale bins.
11904
+ *
11905
+ * Endpoint: `GET /api/oracle/histogram/payments/live`
11906
+ * @param {{ signal?: AbortSignal, onValue?: (value: number[]) => void, cache?: boolean }} [options]
11907
+ * @returns {Promise<number[]>}
11908
+ */
11909
+ async getOracleHistogramPaymentsLive({ signal, onValue, cache } = {}) {
11910
+ const path = `/api/oracle/histogram/payments/live`;
11911
+ return this.getJson(path, { signal, onValue, cache });
11912
+ }
11913
+
11914
+ /**
11915
+ * Payment output histogram at height or day
11916
+ *
11917
+ * Smoothed histogram of oracle-eligible payment outputs for a confirmed point. A block height (`840000`) gives that block's oracle payment histogram; a calendar date (`YYYY-MM-DD`) gives the average of that day's per-block payment histograms. A flat array of log-scale bins.
11918
+ *
11919
+ * Endpoint: `GET /api/oracle/histogram/payments/{point}`
11920
+ *
11921
+ * @param {string} point
11922
+ * @param {{ signal?: AbortSignal, onValue?: (value: number[]) => void, cache?: boolean }} [options]
11923
+ * @returns {Promise<number[]>}
11924
+ */
11925
+ async getOracleHistogramPayments(point, { signal, onValue, cache } = {}) {
11926
+ const path = `/api/oracle/histogram/payments/${point}`;
11927
+ return this.getJson(path, { signal, onValue, cache });
11928
+ }
11929
+
11930
+ /**
11931
+ * Live output value histogram
11932
+ *
11933
+ * Live unfiltered output value histogram for the forming mempool block. Every live output is binned by value on the oracle log scale; no oracle payment filters are applied. A flat array of log-scale bins, all zero when no mempool is configured.
11934
+ *
11935
+ * Endpoint: `GET /api/oracle/histogram/outputs/live`
11936
+ * @param {{ signal?: AbortSignal, onValue?: (value: number[]) => void, cache?: boolean }} [options]
11937
+ * @returns {Promise<number[]>}
11938
+ */
11939
+ async getOracleHistogramOutputsLive({ signal, onValue, cache } = {}) {
11940
+ const path = `/api/oracle/histogram/outputs/live`;
11941
+ return this.getJson(path, { signal, onValue, cache });
11942
+ }
11943
+
11944
+ /**
11945
+ * Output value histogram at height or day
11946
+ *
11947
+ * Unfiltered output value histogram for a confirmed point. A block height (`840000`) gives every output in that block, coinbase included, binned by value on the oracle log scale; a calendar date (`YYYY-MM-DD`) sums every block that day. A flat array of log-scale bins.
11948
+ *
11949
+ * Endpoint: `GET /api/oracle/histogram/outputs/{point}`
11950
+ *
11951
+ * @param {string} point
11952
+ * @param {{ signal?: AbortSignal, onValue?: (value: number[]) => void, cache?: boolean }} [options]
11953
+ * @returns {Promise<number[]>}
11954
+ */
11955
+ async getOracleHistogramOutputs(point, { signal, onValue, cache } = {}) {
11956
+ const path = `/api/oracle/histogram/outputs/${point}`;
11957
+ return this.getJson(path, { signal, onValue, cache });
11866
11958
  }
11867
11959
 
11868
11960
  /**
@@ -11873,12 +11965,12 @@ class BrkClient extends BrkClientBase {
11873
11965
  * Endpoint: `GET /api/tx-index/{index}`
11874
11966
  *
11875
11967
  * @param {TxIndex} index
11876
- * @param {{ signal?: AbortSignal, onValue?: (value: Txid) => void }} [options]
11968
+ * @param {{ signal?: AbortSignal, onValue?: (value: Txid) => void, cache?: boolean }} [options]
11877
11969
  * @returns {Promise<Txid>}
11878
11970
  */
11879
- async getTxByIndex(index, { signal, onValue } = {}) {
11971
+ async getTxByIndex(index, { signal, onValue, cache } = {}) {
11880
11972
  const path = `/api/tx-index/${index}`;
11881
- return this.getText(path, { signal, onValue });
11973
+ return this.getText(path, { signal, onValue, cache });
11882
11974
  }
11883
11975
 
11884
11976
  /**
@@ -11891,12 +11983,12 @@ class BrkClient extends BrkClientBase {
11891
11983
  * Endpoint: `GET /api/v1/cpfp/{txid}`
11892
11984
  *
11893
11985
  * @param {Txid} txid
11894
- * @param {{ signal?: AbortSignal, onValue?: (value: CpfpInfo) => void }} [options]
11986
+ * @param {{ signal?: AbortSignal, onValue?: (value: CpfpInfo) => void, cache?: boolean }} [options]
11895
11987
  * @returns {Promise<CpfpInfo>}
11896
11988
  */
11897
- async getCpfp(txid, { signal, onValue } = {}) {
11989
+ async getCpfp(txid, { signal, onValue, cache } = {}) {
11898
11990
  const path = `/api/v1/cpfp/${txid}`;
11899
- return this.getJson(path, { signal, onValue });
11991
+ return this.getJson(path, { signal, onValue, cache });
11900
11992
  }
11901
11993
 
11902
11994
  /**
@@ -11909,12 +12001,12 @@ class BrkClient extends BrkClientBase {
11909
12001
  * Endpoint: `GET /api/v1/tx/{txid}/rbf`
11910
12002
  *
11911
12003
  * @param {Txid} txid
11912
- * @param {{ signal?: AbortSignal, onValue?: (value: RbfResponse) => void }} [options]
12004
+ * @param {{ signal?: AbortSignal, onValue?: (value: RbfResponse) => void, cache?: boolean }} [options]
11913
12005
  * @returns {Promise<RbfResponse>}
11914
12006
  */
11915
- async getTxRbf(txid, { signal, onValue } = {}) {
12007
+ async getTxRbf(txid, { signal, onValue, cache } = {}) {
11916
12008
  const path = `/api/v1/tx/${txid}/rbf`;
11917
- return this.getJson(path, { signal, onValue });
12009
+ return this.getJson(path, { signal, onValue, cache });
11918
12010
  }
11919
12011
 
11920
12012
  /**
@@ -11927,12 +12019,12 @@ class BrkClient extends BrkClientBase {
11927
12019
  * Endpoint: `GET /api/tx/{txid}`
11928
12020
  *
11929
12021
  * @param {Txid} txid
11930
- * @param {{ signal?: AbortSignal, onValue?: (value: Transaction) => void }} [options]
12022
+ * @param {{ signal?: AbortSignal, onValue?: (value: Transaction) => void, cache?: boolean }} [options]
11931
12023
  * @returns {Promise<Transaction>}
11932
12024
  */
11933
- async getTx(txid, { signal, onValue } = {}) {
12025
+ async getTx(txid, { signal, onValue, cache } = {}) {
11934
12026
  const path = `/api/tx/${txid}`;
11935
- return this.getJson(path, { signal, onValue });
12027
+ return this.getJson(path, { signal, onValue, cache });
11936
12028
  }
11937
12029
 
11938
12030
  /**
@@ -11945,12 +12037,12 @@ class BrkClient extends BrkClientBase {
11945
12037
  * Endpoint: `GET /api/tx/{txid}/hex`
11946
12038
  *
11947
12039
  * @param {Txid} txid
11948
- * @param {{ signal?: AbortSignal, onValue?: (value: Hex) => void }} [options]
12040
+ * @param {{ signal?: AbortSignal, onValue?: (value: Hex) => void, cache?: boolean }} [options]
11949
12041
  * @returns {Promise<Hex>}
11950
12042
  */
11951
- async getTxHex(txid, { signal, onValue } = {}) {
12043
+ async getTxHex(txid, { signal, onValue, cache } = {}) {
11952
12044
  const path = `/api/tx/${txid}/hex`;
11953
- return this.getText(path, { signal, onValue });
12045
+ return this.getText(path, { signal, onValue, cache });
11954
12046
  }
11955
12047
 
11956
12048
  /**
@@ -11963,12 +12055,12 @@ class BrkClient extends BrkClientBase {
11963
12055
  * Endpoint: `GET /api/tx/{txid}/merkleblock-proof`
11964
12056
  *
11965
12057
  * @param {Txid} txid
11966
- * @param {{ signal?: AbortSignal, onValue?: (value: Hex) => void }} [options]
12058
+ * @param {{ signal?: AbortSignal, onValue?: (value: Hex) => void, cache?: boolean }} [options]
11967
12059
  * @returns {Promise<Hex>}
11968
12060
  */
11969
- async getTxMerkleblockProof(txid, { signal, onValue } = {}) {
12061
+ async getTxMerkleblockProof(txid, { signal, onValue, cache } = {}) {
11970
12062
  const path = `/api/tx/${txid}/merkleblock-proof`;
11971
- return this.getText(path, { signal, onValue });
12063
+ return this.getText(path, { signal, onValue, cache });
11972
12064
  }
11973
12065
 
11974
12066
  /**
@@ -11981,12 +12073,12 @@ class BrkClient extends BrkClientBase {
11981
12073
  * Endpoint: `GET /api/tx/{txid}/merkle-proof`
11982
12074
  *
11983
12075
  * @param {Txid} txid
11984
- * @param {{ signal?: AbortSignal, onValue?: (value: MerkleProof) => void }} [options]
12076
+ * @param {{ signal?: AbortSignal, onValue?: (value: MerkleProof) => void, cache?: boolean }} [options]
11985
12077
  * @returns {Promise<MerkleProof>}
11986
12078
  */
11987
- async getTxMerkleProof(txid, { signal, onValue } = {}) {
12079
+ async getTxMerkleProof(txid, { signal, onValue, cache } = {}) {
11988
12080
  const path = `/api/tx/${txid}/merkle-proof`;
11989
- return this.getJson(path, { signal, onValue });
12081
+ return this.getJson(path, { signal, onValue, cache });
11990
12082
  }
11991
12083
 
11992
12084
  /**
@@ -12000,12 +12092,12 @@ class BrkClient extends BrkClientBase {
12000
12092
  *
12001
12093
  * @param {Txid} txid - Transaction ID
12002
12094
  * @param {Vout} vout - Output index
12003
- * @param {{ signal?: AbortSignal, onValue?: (value: TxOutspend) => void }} [options]
12095
+ * @param {{ signal?: AbortSignal, onValue?: (value: TxOutspend) => void, cache?: boolean }} [options]
12004
12096
  * @returns {Promise<TxOutspend>}
12005
12097
  */
12006
- async getTxOutspend(txid, vout, { signal, onValue } = {}) {
12098
+ async getTxOutspend(txid, vout, { signal, onValue, cache } = {}) {
12007
12099
  const path = `/api/tx/${txid}/outspend/${vout}`;
12008
- return this.getJson(path, { signal, onValue });
12100
+ return this.getJson(path, { signal, onValue, cache });
12009
12101
  }
12010
12102
 
12011
12103
  /**
@@ -12018,12 +12110,12 @@ class BrkClient extends BrkClientBase {
12018
12110
  * Endpoint: `GET /api/tx/{txid}/outspends`
12019
12111
  *
12020
12112
  * @param {Txid} txid
12021
- * @param {{ signal?: AbortSignal, onValue?: (value: TxOutspend[]) => void }} [options]
12113
+ * @param {{ signal?: AbortSignal, onValue?: (value: TxOutspend[]) => void, cache?: boolean }} [options]
12022
12114
  * @returns {Promise<TxOutspend[]>}
12023
12115
  */
12024
- async getTxOutspends(txid, { signal, onValue } = {}) {
12116
+ async getTxOutspends(txid, { signal, onValue, cache } = {}) {
12025
12117
  const path = `/api/tx/${txid}/outspends`;
12026
- return this.getJson(path, { signal, onValue });
12118
+ return this.getJson(path, { signal, onValue, cache });
12027
12119
  }
12028
12120
 
12029
12121
  /**
@@ -12036,12 +12128,12 @@ class BrkClient extends BrkClientBase {
12036
12128
  * Endpoint: `GET /api/tx/{txid}/raw`
12037
12129
  *
12038
12130
  * @param {Txid} txid
12039
- * @param {{ signal?: AbortSignal, onValue?: (value: Uint8Array) => void }} [options]
12131
+ * @param {{ signal?: AbortSignal, onValue?: (value: Uint8Array) => void, cache?: boolean }} [options]
12040
12132
  * @returns {Promise<Uint8Array>}
12041
12133
  */
12042
- async getTxRaw(txid, { signal, onValue } = {}) {
12134
+ async getTxRaw(txid, { signal, onValue, cache } = {}) {
12043
12135
  const path = `/api/tx/${txid}/raw`;
12044
- return this.getBytes(path, { signal, onValue });
12136
+ return this.getBytes(path, { signal, onValue, cache });
12045
12137
  }
12046
12138
 
12047
12139
  /**
@@ -12054,12 +12146,12 @@ class BrkClient extends BrkClientBase {
12054
12146
  * Endpoint: `GET /api/tx/{txid}/status`
12055
12147
  *
12056
12148
  * @param {Txid} txid
12057
- * @param {{ signal?: AbortSignal, onValue?: (value: TxStatus) => void }} [options]
12149
+ * @param {{ signal?: AbortSignal, onValue?: (value: TxStatus) => void, cache?: boolean }} [options]
12058
12150
  * @returns {Promise<TxStatus>}
12059
12151
  */
12060
- async getTxStatus(txid, { signal, onValue } = {}) {
12152
+ async getTxStatus(txid, { signal, onValue, cache } = {}) {
12061
12153
  const path = `/api/tx/${txid}/status`;
12062
- return this.getJson(path, { signal, onValue });
12154
+ return this.getJson(path, { signal, onValue, cache });
12063
12155
  }
12064
12156
 
12065
12157
  /**
@@ -12072,15 +12164,15 @@ class BrkClient extends BrkClientBase {
12072
12164
  * Endpoint: `GET /api/v1/transaction-times`
12073
12165
  *
12074
12166
  * @param {Txid[]} txId - Transaction IDs to look up (max 250 per request).
12075
- * @param {{ signal?: AbortSignal, onValue?: (value: number[]) => void }} [options]
12167
+ * @param {{ signal?: AbortSignal, onValue?: (value: number[]) => void, cache?: boolean }} [options]
12076
12168
  * @returns {Promise<number[]>}
12077
12169
  */
12078
- async getTransactionTimes(txId, { signal, onValue } = {}) {
12170
+ async getTransactionTimes(txId, { signal, onValue, cache } = {}) {
12079
12171
  const params = new URLSearchParams();
12080
12172
  for (const _v of txId) params.append('txId[]', String(_v));
12081
12173
  const query = params.toString();
12082
12174
  const path = `/api/v1/transaction-times${query ? '?' + query : ''}`;
12083
- return this.getJson(path, { signal, onValue });
12175
+ return this.getJson(path, { signal, onValue, cache });
12084
12176
  }
12085
12177
 
12086
12178
  /**
@@ -12107,12 +12199,12 @@ class BrkClient extends BrkClientBase {
12107
12199
  * Full OpenAPI 3.1 specification for this API.
12108
12200
  *
12109
12201
  * Endpoint: `GET /openapi.json`
12110
- * @param {{ signal?: AbortSignal, onValue?: (value: *) => void }} [options]
12202
+ * @param {{ signal?: AbortSignal, onValue?: (value: *) => void, cache?: boolean }} [options]
12111
12203
  * @returns {Promise<*>}
12112
12204
  */
12113
- async getOpenapi({ signal, onValue } = {}) {
12205
+ async getOpenapi({ signal, onValue, cache } = {}) {
12114
12206
  const path = `/openapi.json`;
12115
- return this.getText(path, { signal, onValue });
12207
+ return this.getText(path, { signal, onValue, cache });
12116
12208
  }
12117
12209
 
12118
12210
  /**
@@ -12121,12 +12213,12 @@ class BrkClient extends BrkClientBase {
12121
12213
  * Compact OpenAPI specification optimized for LLM consumption. Removes redundant fields while preserving essential API information. Full spec available at `/openapi.json`.
12122
12214
  *
12123
12215
  * Endpoint: `GET /api.json`
12124
- * @param {{ signal?: AbortSignal, onValue?: (value: *) => void }} [options]
12216
+ * @param {{ signal?: AbortSignal, onValue?: (value: *) => void, cache?: boolean }} [options]
12125
12217
  * @returns {Promise<*>}
12126
12218
  */
12127
- async getApi({ signal, onValue } = {}) {
12219
+ async getApi({ signal, onValue, cache } = {}) {
12128
12220
  const path = `/api.json`;
12129
- return this.getJson(path, { signal, onValue });
12221
+ return this.getJson(path, { signal, onValue, cache });
12130
12222
  }
12131
12223
 
12132
12224
  }