brk-client 0.3.0-beta.9 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +474 -290
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -281,6 +281,54 @@ Matches mempool.space/bitcoin-cli behavior.
|
|
|
281
281
|
* @property {(Height|null)=} height - Block height (only if in best chain)
|
|
282
282
|
* @property {(BlockHash|null)=} nextBest - Hash of the next block in the best chain (null if tip)
|
|
283
283
|
*/
|
|
284
|
+
/**
|
|
285
|
+
* Projected next-block contents from Bitcoin Core's `getblocktemplate`
|
|
286
|
+
* (block 0 of the snapshot). Returned by
|
|
287
|
+
* `GET /api/v1/mempool/block-template`.
|
|
288
|
+
*
|
|
289
|
+
* @typedef {Object} BlockTemplate
|
|
290
|
+
* @property {NextBlockHash} hash - Pass back as `<hash>` on
|
|
291
|
+
`/api/v1/mempool/block-template/diff/{hash}` to fetch deltas.
|
|
292
|
+
* @property {MempoolBlock} stats - Aggregate stats for this block (size, vsize, fee range, ...).
|
|
293
|
+
* @property {Transaction[]} transactions - Full transaction bodies in `getblocktemplate` order.
|
|
294
|
+
*/
|
|
295
|
+
/**
|
|
296
|
+
* Delta between the current `getblocktemplate` projection and a prior
|
|
297
|
+
* one identified by `since`. Returned by
|
|
298
|
+
* `GET /api/v1/mempool/block-template/diff/{hash}`.
|
|
299
|
+
*
|
|
300
|
+
* `order` carries the full new template in template order: each entry
|
|
301
|
+
* is either a `Retained(idx)` pointing into the prior template (which
|
|
302
|
+
* the client cached at `since`) or a `New(tx)` inline body. Walk it
|
|
303
|
+
* once to rebuild the new template; no separate `added` array to
|
|
304
|
+
* cross-reference.
|
|
305
|
+
*
|
|
306
|
+
* `removed` is redundant (computable from `order` by collecting prior
|
|
307
|
+
* indices that don't appear) but shipped for cache-eviction ergonomics.
|
|
308
|
+
*
|
|
309
|
+
* @typedef {Object} BlockTemplateDiff
|
|
310
|
+
* @property {NextBlockHash} hash - Current next-block hash. Use as `since` on the next diff call.
|
|
311
|
+
* @property {NextBlockHash} since - Echoed prior hash the diff was computed against.
|
|
312
|
+
* @property {BlockTemplateDiffEntry[]} order - New template in order. Each entry is either an index into the
|
|
313
|
+
prior template's transactions or a full transaction body.
|
|
314
|
+
* @property {Txid[]} removed - Txids that left the projected next block since `since`
|
|
315
|
+
(confirmed, evicted, replaced, or pushed past block 0).
|
|
316
|
+
*/
|
|
317
|
+
/**
|
|
318
|
+
* One slot of the new template in a `BlockTemplateDiff`.
|
|
319
|
+
*
|
|
320
|
+
* Untagged on the wire so JSON type disambiguates the variants:
|
|
321
|
+
* - `Retained(idx)` serializes as a bare integer - index into the
|
|
322
|
+
* transactions of the prior template (which the client cached at
|
|
323
|
+
* `since`).
|
|
324
|
+
* - `New(tx)` serializes as a transaction object - a body that was
|
|
325
|
+
* not in the prior template and must be added at this position.
|
|
326
|
+
*
|
|
327
|
+
* Reconstruction is a single pass: for each entry, either copy
|
|
328
|
+
* `prior[idx]` or append the inline body.
|
|
329
|
+
*
|
|
330
|
+
* @typedef {(number|Transaction)} BlockTemplateDiffEntry
|
|
331
|
+
*/
|
|
284
332
|
/**
|
|
285
333
|
* Block information returned for timestamp queries
|
|
286
334
|
*
|
|
@@ -598,6 +646,14 @@ ancestors and no descendants (matches mempool.space).
|
|
|
598
646
|
*
|
|
599
647
|
* @typedef {number} Height
|
|
600
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
|
+
*/
|
|
601
657
|
/**
|
|
602
658
|
* Block height path parameter
|
|
603
659
|
*
|
|
@@ -711,6 +767,20 @@ ancestors and no descendants (matches mempool.space).
|
|
|
711
767
|
/** @typedef {number} Month1 */
|
|
712
768
|
/** @typedef {number} Month3 */
|
|
713
769
|
/** @typedef {number} Month6 */
|
|
770
|
+
/**
|
|
771
|
+
* Content hash of the projected next block (block 0 of the mempool
|
|
772
|
+
* snapshot). Same value as the mempool ETag. Opaque token: pass back
|
|
773
|
+
* as `since` on `/api/v1/mempool/block-template/diff/{hash}` to fetch
|
|
774
|
+
* deltas.
|
|
775
|
+
*
|
|
776
|
+
* @typedef {number} NextBlockHash
|
|
777
|
+
*/
|
|
778
|
+
/**
|
|
779
|
+
* `since` hash for `/api/v1/mempool/block-template/diff/{hash}`.
|
|
780
|
+
*
|
|
781
|
+
* @typedef {Object} NextBlockHashParam
|
|
782
|
+
* @property {NextBlockHash} hash
|
|
783
|
+
*/
|
|
714
784
|
/**
|
|
715
785
|
* OHLC (Open, High, Low, Close) data in cents
|
|
716
786
|
*
|
|
@@ -1287,9 +1357,9 @@ on serialization otherwise.
|
|
|
1287
1357
|
/**
|
|
1288
1358
|
* Aggregation strategy for URPD buckets.
|
|
1289
1359
|
* Options: raw (no aggregation), lin200/lin500/lin1000 (linear $200/$500/$1000),
|
|
1290
|
-
* 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).
|
|
1291
1361
|
*
|
|
1292
|
-
* @typedef {("raw"|"lin200"|"lin500"|"lin1000"|"log10"|"log50"|"log100"|"log200")} UrpdAggregation
|
|
1362
|
+
* @typedef {("raw"|"lin200"|"lin500"|"lin1000"|"log10"|"log50"|"log100"|"log200"|"log500"|"log1000"|"log2000")} UrpdAggregation
|
|
1293
1363
|
*/
|
|
1294
1364
|
/**
|
|
1295
1365
|
* A single bucket in a URPD snapshot.
|
|
@@ -1812,14 +1882,17 @@ class BrkClientBase {
|
|
|
1812
1882
|
|
|
1813
1883
|
/**
|
|
1814
1884
|
* @param {string} path
|
|
1815
|
-
* @param {{ signal?: AbortSignal }} [options]
|
|
1885
|
+
* @param {{ signal?: AbortSignal, cache?: boolean }} [options]
|
|
1816
1886
|
* @returns {Promise<Response>}
|
|
1817
1887
|
*/
|
|
1818
|
-
async get(path, { signal } = {}) {
|
|
1888
|
+
async get(path, { signal, cache = true } = {}) {
|
|
1819
1889
|
const url = `${this.baseUrl}${path}`;
|
|
1820
1890
|
const signals = [AbortSignal.timeout(this.timeout)];
|
|
1821
1891
|
if (signal) signals.push(signal);
|
|
1822
|
-
|
|
1892
|
+
/** @type {RequestInit} */
|
|
1893
|
+
const init = { signal: AbortSignal.any(signals) };
|
|
1894
|
+
if (!cache) init.cache = 'no-store';
|
|
1895
|
+
const res = await fetch(url, init);
|
|
1823
1896
|
if (!res.ok) throw new BrkError(`HTTP ${res.status}: ${url}`, res.status);
|
|
1824
1897
|
return res;
|
|
1825
1898
|
}
|
|
@@ -1839,14 +1912,21 @@ class BrkClientBase {
|
|
|
1839
1912
|
* @template T
|
|
1840
1913
|
* @param {string} path
|
|
1841
1914
|
* @param {(res: Response) => Promise<T>} parse - Response body reader
|
|
1842
|
-
* @param {{ onValue?: (value: T) => void, signal?: AbortSignal }} [options]
|
|
1915
|
+
* @param {{ onValue?: (value: T) => void, signal?: AbortSignal, cache?: boolean }} [options]
|
|
1843
1916
|
* @returns {Promise<T>}
|
|
1844
1917
|
*/
|
|
1845
|
-
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
|
+
|
|
1846
1926
|
const url = `${this.baseUrl}${path}`;
|
|
1847
1927
|
/** @type {_MemEntry<T> | undefined} */
|
|
1848
1928
|
const memHit = this._memGet(url);
|
|
1849
|
-
const browserCache = this._browserCache
|
|
1929
|
+
const browserCache = this._browserCache;
|
|
1850
1930
|
|
|
1851
1931
|
// L1 fast path: deliver from memCache, revalidate via network.
|
|
1852
1932
|
// ETag match → zero parse, zero clone, zero cache write, no second onValue fire.
|
|
@@ -1861,8 +1941,8 @@ class BrkClientBase {
|
|
|
1861
1941
|
this._memSet(url, netEtag, value);
|
|
1862
1942
|
if (onValue) onValue(value);
|
|
1863
1943
|
if (cloned && browserCache) {
|
|
1864
|
-
const
|
|
1865
|
-
_runIdle(() =>
|
|
1944
|
+
const cacheStore = browserCache;
|
|
1945
|
+
_runIdle(() => cacheStore.put(url, cloned));
|
|
1866
1946
|
}
|
|
1867
1947
|
return value;
|
|
1868
1948
|
} catch {
|
|
@@ -1895,8 +1975,8 @@ class BrkClientBase {
|
|
|
1895
1975
|
this._memSet(url, netEtag, value);
|
|
1896
1976
|
if (onValue) onValue(value);
|
|
1897
1977
|
if (cloned && browserCache) {
|
|
1898
|
-
const
|
|
1899
|
-
_runIdle(() =>
|
|
1978
|
+
const cacheStore = browserCache;
|
|
1979
|
+
_runIdle(() => cacheStore.put(url, cloned));
|
|
1900
1980
|
}
|
|
1901
1981
|
return value;
|
|
1902
1982
|
} catch (e) {
|
|
@@ -1910,7 +1990,7 @@ class BrkClientBase {
|
|
|
1910
1990
|
* Make a GET request expecting a JSON response. Cached and supports `onValue`.
|
|
1911
1991
|
* @template T
|
|
1912
1992
|
* @param {string} path
|
|
1913
|
-
* @param {{ onValue?: (value: T) => void, signal?: AbortSignal }} [options]
|
|
1993
|
+
* @param {{ onValue?: (value: T) => void, signal?: AbortSignal, cache?: boolean }} [options]
|
|
1914
1994
|
* @returns {Promise<T>}
|
|
1915
1995
|
*/
|
|
1916
1996
|
getJson(path, options) {
|
|
@@ -1921,7 +2001,7 @@ class BrkClientBase {
|
|
|
1921
2001
|
* Make a GET request expecting a text response (text/plain, text/csv, ...).
|
|
1922
2002
|
* Cached and supports `onValue`, same as `getJson`.
|
|
1923
2003
|
* @param {string} path
|
|
1924
|
-
* @param {{ onValue?: (value: string) => void, signal?: AbortSignal }} [options]
|
|
2004
|
+
* @param {{ onValue?: (value: string) => void, signal?: AbortSignal, cache?: boolean }} [options]
|
|
1925
2005
|
* @returns {Promise<string>}
|
|
1926
2006
|
*/
|
|
1927
2007
|
getText(path, options) {
|
|
@@ -1932,7 +2012,7 @@ class BrkClientBase {
|
|
|
1932
2012
|
* Make a GET request expecting binary data (application/octet-stream).
|
|
1933
2013
|
* Cached and supports `onValue`, same as `getJson`.
|
|
1934
2014
|
* @param {string} path
|
|
1935
|
-
* @param {{ onValue?: (value: Uint8Array) => void, signal?: AbortSignal }} [options]
|
|
2015
|
+
* @param {{ onValue?: (value: Uint8Array) => void, signal?: AbortSignal, cache?: boolean }} [options]
|
|
1936
2016
|
* @returns {Promise<Uint8Array>}
|
|
1937
2017
|
*/
|
|
1938
2018
|
getBytes(path, options) {
|
|
@@ -7499,7 +7579,7 @@ function createTransferPattern(client, acc) {
|
|
|
7499
7579
|
* @extends BrkClientBase
|
|
7500
7580
|
*/
|
|
7501
7581
|
class BrkClient extends BrkClientBase {
|
|
7502
|
-
VERSION = "v0.3.
|
|
7582
|
+
VERSION = "v0.3.1";
|
|
7503
7583
|
|
|
7504
7584
|
INDEXES = /** @type {const} */ ([
|
|
7505
7585
|
"minute10",
|
|
@@ -10473,15 +10553,15 @@ class BrkClient extends BrkClientBase {
|
|
|
10473
10553
|
/**
|
|
10474
10554
|
* Health check
|
|
10475
10555
|
*
|
|
10476
|
-
* Returns
|
|
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`.
|
|
10477
10557
|
*
|
|
10478
10558
|
* Endpoint: `GET /health`
|
|
10479
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: Health) => void }} [options]
|
|
10559
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: Health) => void, cache?: boolean }} [options]
|
|
10480
10560
|
* @returns {Promise<Health>}
|
|
10481
10561
|
*/
|
|
10482
|
-
async getHealth({ signal, onValue } = {}) {
|
|
10562
|
+
async getHealth({ signal, onValue, cache } = {}) {
|
|
10483
10563
|
const path = `/health`;
|
|
10484
|
-
return this.getJson(path, { signal, onValue });
|
|
10564
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
10485
10565
|
}
|
|
10486
10566
|
|
|
10487
10567
|
/**
|
|
@@ -10490,12 +10570,12 @@ class BrkClient extends BrkClientBase {
|
|
|
10490
10570
|
* Returns the current version of the API server
|
|
10491
10571
|
*
|
|
10492
10572
|
* Endpoint: `GET /version`
|
|
10493
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: string) => void }} [options]
|
|
10573
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: string) => void, cache?: boolean }} [options]
|
|
10494
10574
|
* @returns {Promise<string>}
|
|
10495
10575
|
*/
|
|
10496
|
-
async getVersion({ signal, onValue } = {}) {
|
|
10576
|
+
async getVersion({ signal, onValue, cache } = {}) {
|
|
10497
10577
|
const path = `/version`;
|
|
10498
|
-
return this.getJson(path, { signal, onValue });
|
|
10578
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
10499
10579
|
}
|
|
10500
10580
|
|
|
10501
10581
|
/**
|
|
@@ -10504,12 +10584,12 @@ class BrkClient extends BrkClientBase {
|
|
|
10504
10584
|
* Returns the sync status of the indexer, including indexed height, tip height, blocks behind, and last indexed timestamp.
|
|
10505
10585
|
*
|
|
10506
10586
|
* Endpoint: `GET /api/server/sync`
|
|
10507
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: SyncStatus) => void }} [options]
|
|
10587
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: SyncStatus) => void, cache?: boolean }} [options]
|
|
10508
10588
|
* @returns {Promise<SyncStatus>}
|
|
10509
10589
|
*/
|
|
10510
|
-
async getSyncStatus({ signal, onValue } = {}) {
|
|
10590
|
+
async getSyncStatus({ signal, onValue, cache } = {}) {
|
|
10511
10591
|
const path = `/api/server/sync`;
|
|
10512
|
-
return this.getJson(path, { signal, onValue });
|
|
10592
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
10513
10593
|
}
|
|
10514
10594
|
|
|
10515
10595
|
/**
|
|
@@ -10518,12 +10598,12 @@ class BrkClient extends BrkClientBase {
|
|
|
10518
10598
|
* Returns the disk space used by BRK and Bitcoin data.
|
|
10519
10599
|
*
|
|
10520
10600
|
* Endpoint: `GET /api/server/disk`
|
|
10521
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: DiskUsage) => void }} [options]
|
|
10601
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: DiskUsage) => void, cache?: boolean }} [options]
|
|
10522
10602
|
* @returns {Promise<DiskUsage>}
|
|
10523
10603
|
*/
|
|
10524
|
-
async getDiskUsage({ signal, onValue } = {}) {
|
|
10604
|
+
async getDiskUsage({ signal, onValue, cache } = {}) {
|
|
10525
10605
|
const path = `/api/server/disk`;
|
|
10526
|
-
return this.getJson(path, { signal, onValue });
|
|
10606
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
10527
10607
|
}
|
|
10528
10608
|
|
|
10529
10609
|
/**
|
|
@@ -10532,12 +10612,12 @@ class BrkClient extends BrkClientBase {
|
|
|
10532
10612
|
* Returns the complete hierarchical catalog of available series organized as a tree structure. Series are grouped by categories and subcategories.
|
|
10533
10613
|
*
|
|
10534
10614
|
* Endpoint: `GET /api/series`
|
|
10535
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: TreeNode) => void }} [options]
|
|
10615
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: TreeNode) => void, cache?: boolean }} [options]
|
|
10536
10616
|
* @returns {Promise<TreeNode>}
|
|
10537
10617
|
*/
|
|
10538
|
-
async getSeriesTree({ signal, onValue } = {}) {
|
|
10618
|
+
async getSeriesTree({ signal, onValue, cache } = {}) {
|
|
10539
10619
|
const path = `/api/series`;
|
|
10540
|
-
return this.getJson(path, { signal, onValue });
|
|
10620
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
10541
10621
|
}
|
|
10542
10622
|
|
|
10543
10623
|
/**
|
|
@@ -10546,12 +10626,12 @@ class BrkClient extends BrkClientBase {
|
|
|
10546
10626
|
* Returns the number of series available per index type.
|
|
10547
10627
|
*
|
|
10548
10628
|
* Endpoint: `GET /api/series/count`
|
|
10549
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: SeriesCount[]) => void }} [options]
|
|
10629
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: SeriesCount[]) => void, cache?: boolean }} [options]
|
|
10550
10630
|
* @returns {Promise<SeriesCount[]>}
|
|
10551
10631
|
*/
|
|
10552
|
-
async getSeriesCount({ signal, onValue } = {}) {
|
|
10632
|
+
async getSeriesCount({ signal, onValue, cache } = {}) {
|
|
10553
10633
|
const path = `/api/series/count`;
|
|
10554
|
-
return this.getJson(path, { signal, onValue });
|
|
10634
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
10555
10635
|
}
|
|
10556
10636
|
|
|
10557
10637
|
/**
|
|
@@ -10560,12 +10640,12 @@ class BrkClient extends BrkClientBase {
|
|
|
10560
10640
|
* Returns all available indexes with their accepted query aliases. Use any alias when querying series.
|
|
10561
10641
|
*
|
|
10562
10642
|
* Endpoint: `GET /api/series/indexes`
|
|
10563
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: IndexInfo[]) => void }} [options]
|
|
10643
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: IndexInfo[]) => void, cache?: boolean }} [options]
|
|
10564
10644
|
* @returns {Promise<IndexInfo[]>}
|
|
10565
10645
|
*/
|
|
10566
|
-
async getIndexes({ signal, onValue } = {}) {
|
|
10646
|
+
async getIndexes({ signal, onValue, cache } = {}) {
|
|
10567
10647
|
const path = `/api/series/indexes`;
|
|
10568
|
-
return this.getJson(path, { signal, onValue });
|
|
10648
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
10569
10649
|
}
|
|
10570
10650
|
|
|
10571
10651
|
/**
|
|
@@ -10577,16 +10657,16 @@ class BrkClient extends BrkClientBase {
|
|
|
10577
10657
|
*
|
|
10578
10658
|
* @param {number=} [page] - Pagination index
|
|
10579
10659
|
* @param {number=} [per_page] - Results per page (default: 1000, max: 1000)
|
|
10580
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: PaginatedSeries) => void }} [options]
|
|
10660
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: PaginatedSeries) => void, cache?: boolean }} [options]
|
|
10581
10661
|
* @returns {Promise<PaginatedSeries>}
|
|
10582
10662
|
*/
|
|
10583
|
-
async listSeries(page, per_page, { signal, onValue } = {}) {
|
|
10663
|
+
async listSeries(page, per_page, { signal, onValue, cache } = {}) {
|
|
10584
10664
|
const params = new URLSearchParams();
|
|
10585
10665
|
if (page !== undefined) params.set('page', String(page));
|
|
10586
10666
|
if (per_page !== undefined) params.set('per_page', String(per_page));
|
|
10587
10667
|
const query = params.toString();
|
|
10588
10668
|
const path = `/api/series/list${query ? '?' + query : ''}`;
|
|
10589
|
-
return this.getJson(path, { signal, onValue });
|
|
10669
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
10590
10670
|
}
|
|
10591
10671
|
|
|
10592
10672
|
/**
|
|
@@ -10598,16 +10678,16 @@ class BrkClient extends BrkClientBase {
|
|
|
10598
10678
|
*
|
|
10599
10679
|
* @param {SeriesName} q - Search query string
|
|
10600
10680
|
* @param {Limit=} [limit] - Maximum number of results
|
|
10601
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: string[]) => void }} [options]
|
|
10681
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: string[]) => void, cache?: boolean }} [options]
|
|
10602
10682
|
* @returns {Promise<string[]>}
|
|
10603
10683
|
*/
|
|
10604
|
-
async searchSeries(q, limit, { signal, onValue } = {}) {
|
|
10684
|
+
async searchSeries(q, limit, { signal, onValue, cache } = {}) {
|
|
10605
10685
|
const params = new URLSearchParams();
|
|
10606
10686
|
params.set('q', String(q));
|
|
10607
10687
|
if (limit !== undefined) params.set('limit', String(limit));
|
|
10608
10688
|
const query = params.toString();
|
|
10609
10689
|
const path = `/api/series/search${query ? '?' + query : ''}`;
|
|
10610
|
-
return this.getJson(path, { signal, onValue });
|
|
10690
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
10611
10691
|
}
|
|
10612
10692
|
|
|
10613
10693
|
/**
|
|
@@ -10618,12 +10698,12 @@ class BrkClient extends BrkClientBase {
|
|
|
10618
10698
|
* Endpoint: `GET /api/series/{series}`
|
|
10619
10699
|
*
|
|
10620
10700
|
* @param {SeriesName} series
|
|
10621
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: SeriesInfo) => void }} [options]
|
|
10701
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: SeriesInfo) => void, cache?: boolean }} [options]
|
|
10622
10702
|
* @returns {Promise<SeriesInfo>}
|
|
10623
10703
|
*/
|
|
10624
|
-
async getSeriesInfo(series, { signal, onValue } = {}) {
|
|
10704
|
+
async getSeriesInfo(series, { signal, onValue, cache } = {}) {
|
|
10625
10705
|
const path = `/api/series/${series}`;
|
|
10626
|
-
return this.getJson(path, { signal, onValue });
|
|
10706
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
10627
10707
|
}
|
|
10628
10708
|
|
|
10629
10709
|
/**
|
|
@@ -10639,10 +10719,10 @@ class BrkClient extends BrkClientBase {
|
|
|
10639
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`
|
|
10640
10720
|
* @param {Limit=} [limit] - Maximum number of values to return (ignored if `end` is set). Aliases: `count`, `c`, `l`
|
|
10641
10721
|
* @param {Format=} [format] - Format of the output
|
|
10642
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: AnySeriesData | string) => void }} [options]
|
|
10722
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: AnySeriesData | string) => void, cache?: boolean }} [options]
|
|
10643
10723
|
* @returns {Promise<AnySeriesData | string>}
|
|
10644
10724
|
*/
|
|
10645
|
-
async getSeries(series, index, start, end, limit, format, { signal, onValue } = {}) {
|
|
10725
|
+
async getSeries(series, index, start, end, limit, format, { signal, onValue, cache } = {}) {
|
|
10646
10726
|
const params = new URLSearchParams();
|
|
10647
10727
|
if (start !== undefined) params.set('start', String(start));
|
|
10648
10728
|
if (end !== undefined) params.set('end', String(end));
|
|
@@ -10650,8 +10730,8 @@ class BrkClient extends BrkClientBase {
|
|
|
10650
10730
|
if (format !== undefined) params.set('format', String(format));
|
|
10651
10731
|
const query = params.toString();
|
|
10652
10732
|
const path = `/api/series/${series}/${index}${query ? '?' + query : ''}`;
|
|
10653
|
-
if (format === 'csv') return this.getText(path, { signal, onValue });
|
|
10654
|
-
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 });
|
|
10655
10735
|
}
|
|
10656
10736
|
|
|
10657
10737
|
/**
|
|
@@ -10667,10 +10747,10 @@ class BrkClient extends BrkClientBase {
|
|
|
10667
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`
|
|
10668
10748
|
* @param {Limit=} [limit] - Maximum number of values to return (ignored if `end` is set). Aliases: `count`, `c`, `l`
|
|
10669
10749
|
* @param {Format=} [format] - Format of the output
|
|
10670
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: boolean[] | string) => void }} [options]
|
|
10750
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: boolean[] | string) => void, cache?: boolean }} [options]
|
|
10671
10751
|
* @returns {Promise<boolean[] | string>}
|
|
10672
10752
|
*/
|
|
10673
|
-
async getSeriesData(series, index, start, end, limit, format, { signal, onValue } = {}) {
|
|
10753
|
+
async getSeriesData(series, index, start, end, limit, format, { signal, onValue, cache } = {}) {
|
|
10674
10754
|
const params = new URLSearchParams();
|
|
10675
10755
|
if (start !== undefined) params.set('start', String(start));
|
|
10676
10756
|
if (end !== undefined) params.set('end', String(end));
|
|
@@ -10678,8 +10758,8 @@ class BrkClient extends BrkClientBase {
|
|
|
10678
10758
|
if (format !== undefined) params.set('format', String(format));
|
|
10679
10759
|
const query = params.toString();
|
|
10680
10760
|
const path = `/api/series/${series}/${index}/data${query ? '?' + query : ''}`;
|
|
10681
|
-
if (format === 'csv') return this.getText(path, { signal, onValue });
|
|
10682
|
-
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 });
|
|
10683
10763
|
}
|
|
10684
10764
|
|
|
10685
10765
|
/**
|
|
@@ -10691,12 +10771,12 @@ class BrkClient extends BrkClientBase {
|
|
|
10691
10771
|
*
|
|
10692
10772
|
* @param {SeriesName} series - Series name
|
|
10693
10773
|
* @param {Index} index - Aggregation index
|
|
10694
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: *) => void }} [options]
|
|
10774
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: *) => void, cache?: boolean }} [options]
|
|
10695
10775
|
* @returns {Promise<*>}
|
|
10696
10776
|
*/
|
|
10697
|
-
async getSeriesLatest(series, index, { signal, onValue } = {}) {
|
|
10777
|
+
async getSeriesLatest(series, index, { signal, onValue, cache } = {}) {
|
|
10698
10778
|
const path = `/api/series/${series}/${index}/latest`;
|
|
10699
|
-
return this.getJson(path, { signal, onValue });
|
|
10779
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
10700
10780
|
}
|
|
10701
10781
|
|
|
10702
10782
|
/**
|
|
@@ -10708,12 +10788,12 @@ class BrkClient extends BrkClientBase {
|
|
|
10708
10788
|
*
|
|
10709
10789
|
* @param {SeriesName} series - Series name
|
|
10710
10790
|
* @param {Index} index - Aggregation index
|
|
10711
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: number) => void }} [options]
|
|
10791
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: number) => void, cache?: boolean }} [options]
|
|
10712
10792
|
* @returns {Promise<number>}
|
|
10713
10793
|
*/
|
|
10714
|
-
async getSeriesLen(series, index, { signal, onValue } = {}) {
|
|
10794
|
+
async getSeriesLen(series, index, { signal, onValue, cache } = {}) {
|
|
10715
10795
|
const path = `/api/series/${series}/${index}/len`;
|
|
10716
|
-
return this.getJson(path, { signal, onValue });
|
|
10796
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
10717
10797
|
}
|
|
10718
10798
|
|
|
10719
10799
|
/**
|
|
@@ -10725,12 +10805,12 @@ class BrkClient extends BrkClientBase {
|
|
|
10725
10805
|
*
|
|
10726
10806
|
* @param {SeriesName} series - Series name
|
|
10727
10807
|
* @param {Index} index - Aggregation index
|
|
10728
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: Version) => void }} [options]
|
|
10808
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: Version) => void, cache?: boolean }} [options]
|
|
10729
10809
|
* @returns {Promise<Version>}
|
|
10730
10810
|
*/
|
|
10731
|
-
async getSeriesVersion(series, index, { signal, onValue } = {}) {
|
|
10811
|
+
async getSeriesVersion(series, index, { signal, onValue, cache } = {}) {
|
|
10732
10812
|
const path = `/api/series/${series}/${index}/version`;
|
|
10733
|
-
return this.getJson(path, { signal, onValue });
|
|
10813
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
10734
10814
|
}
|
|
10735
10815
|
|
|
10736
10816
|
/**
|
|
@@ -10746,10 +10826,10 @@ class BrkClient extends BrkClientBase {
|
|
|
10746
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`
|
|
10747
10827
|
* @param {Limit=} [limit] - Maximum number of values to return (ignored if `end` is set). Aliases: `count`, `c`, `l`
|
|
10748
10828
|
* @param {Format=} [format] - Format of the output
|
|
10749
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: AnySeriesData[] | string) => void }} [options]
|
|
10829
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: AnySeriesData[] | string) => void, cache?: boolean }} [options]
|
|
10750
10830
|
* @returns {Promise<AnySeriesData[] | string>}
|
|
10751
10831
|
*/
|
|
10752
|
-
async getSeriesBulk(series, index, start, end, limit, format, { signal, onValue } = {}) {
|
|
10832
|
+
async getSeriesBulk(series, index, start, end, limit, format, { signal, onValue, cache } = {}) {
|
|
10753
10833
|
const params = new URLSearchParams();
|
|
10754
10834
|
params.set('series', String(series));
|
|
10755
10835
|
params.set('index', String(index));
|
|
@@ -10759,8 +10839,8 @@ class BrkClient extends BrkClientBase {
|
|
|
10759
10839
|
if (format !== undefined) params.set('format', String(format));
|
|
10760
10840
|
const query = params.toString();
|
|
10761
10841
|
const path = `/api/series/bulk${query ? '?' + query : ''}`;
|
|
10762
|
-
if (format === 'csv') return this.getText(path, { signal, onValue });
|
|
10763
|
-
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 });
|
|
10764
10844
|
}
|
|
10765
10845
|
|
|
10766
10846
|
/**
|
|
@@ -10769,12 +10849,12 @@ class BrkClient extends BrkClientBase {
|
|
|
10769
10849
|
* Cohorts for which URPD data is available. Returns names like `all`, `sth`, `lth`, `utxos_under_1h_old`.
|
|
10770
10850
|
*
|
|
10771
10851
|
* Endpoint: `GET /api/urpd`
|
|
10772
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: Cohort[]) => void }} [options]
|
|
10852
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: Cohort[]) => void, cache?: boolean }} [options]
|
|
10773
10853
|
* @returns {Promise<Cohort[]>}
|
|
10774
10854
|
*/
|
|
10775
|
-
async listUrpdCohorts({ signal, onValue } = {}) {
|
|
10855
|
+
async listUrpdCohorts({ signal, onValue, cache } = {}) {
|
|
10776
10856
|
const path = `/api/urpd`;
|
|
10777
|
-
return this.getJson(path, { signal, onValue });
|
|
10857
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
10778
10858
|
}
|
|
10779
10859
|
|
|
10780
10860
|
/**
|
|
@@ -10785,12 +10865,12 @@ class BrkClient extends BrkClientBase {
|
|
|
10785
10865
|
* Endpoint: `GET /api/urpd/{cohort}/dates`
|
|
10786
10866
|
*
|
|
10787
10867
|
* @param {Cohort} cohort
|
|
10788
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: Date[]) => void }} [options]
|
|
10868
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: Date[]) => void, cache?: boolean }} [options]
|
|
10789
10869
|
* @returns {Promise<Date[]>}
|
|
10790
10870
|
*/
|
|
10791
|
-
async listUrpdDates(cohort, { signal, onValue } = {}) {
|
|
10871
|
+
async listUrpdDates(cohort, { signal, onValue, cache } = {}) {
|
|
10792
10872
|
const path = `/api/urpd/${cohort}/dates`;
|
|
10793
|
-
return this.getJson(path, { signal, onValue });
|
|
10873
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
10794
10874
|
}
|
|
10795
10875
|
|
|
10796
10876
|
/**
|
|
@@ -10804,15 +10884,15 @@ class BrkClient extends BrkClientBase {
|
|
|
10804
10884
|
*
|
|
10805
10885
|
* @param {Cohort} cohort
|
|
10806
10886
|
* @param {UrpdAggregation=} [agg] - Aggregation strategy. Default: raw (no aggregation). Accepts `bucket` as alias.
|
|
10807
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: Urpd) => void }} [options]
|
|
10887
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: Urpd) => void, cache?: boolean }} [options]
|
|
10808
10888
|
* @returns {Promise<Urpd>}
|
|
10809
10889
|
*/
|
|
10810
|
-
async getUrpd(cohort, agg, { signal, onValue } = {}) {
|
|
10890
|
+
async getUrpd(cohort, agg, { signal, onValue, cache } = {}) {
|
|
10811
10891
|
const params = new URLSearchParams();
|
|
10812
10892
|
if (agg !== undefined) params.set('agg', String(agg));
|
|
10813
10893
|
const query = params.toString();
|
|
10814
10894
|
const path = `/api/urpd/${cohort}${query ? '?' + query : ''}`;
|
|
10815
|
-
return this.getJson(path, { signal, onValue });
|
|
10895
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
10816
10896
|
}
|
|
10817
10897
|
|
|
10818
10898
|
/**
|
|
@@ -10827,15 +10907,15 @@ class BrkClient extends BrkClientBase {
|
|
|
10827
10907
|
* @param {Cohort} cohort
|
|
10828
10908
|
* @param {string} date
|
|
10829
10909
|
* @param {UrpdAggregation=} [agg] - Aggregation strategy. Default: raw (no aggregation). Accepts `bucket` as alias.
|
|
10830
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: Urpd) => void }} [options]
|
|
10910
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: Urpd) => void, cache?: boolean }} [options]
|
|
10831
10911
|
* @returns {Promise<Urpd>}
|
|
10832
10912
|
*/
|
|
10833
|
-
async getUrpdAt(cohort, date, agg, { signal, onValue } = {}) {
|
|
10913
|
+
async getUrpdAt(cohort, date, agg, { signal, onValue, cache } = {}) {
|
|
10834
10914
|
const params = new URLSearchParams();
|
|
10835
10915
|
if (agg !== undefined) params.set('agg', String(agg));
|
|
10836
10916
|
const query = params.toString();
|
|
10837
10917
|
const path = `/api/urpd/${cohort}/${date}${query ? '?' + query : ''}`;
|
|
10838
|
-
return this.getJson(path, { signal, onValue });
|
|
10918
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
10839
10919
|
}
|
|
10840
10920
|
|
|
10841
10921
|
/**
|
|
@@ -10846,12 +10926,12 @@ class BrkClient extends BrkClientBase {
|
|
|
10846
10926
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-difficulty-adjustment)*
|
|
10847
10927
|
*
|
|
10848
10928
|
* Endpoint: `GET /api/v1/difficulty-adjustment`
|
|
10849
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: DifficultyAdjustment) => void }} [options]
|
|
10929
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: DifficultyAdjustment) => void, cache?: boolean }} [options]
|
|
10850
10930
|
* @returns {Promise<DifficultyAdjustment>}
|
|
10851
10931
|
*/
|
|
10852
|
-
async getDifficultyAdjustment({ signal, onValue } = {}) {
|
|
10932
|
+
async getDifficultyAdjustment({ signal, onValue, cache } = {}) {
|
|
10853
10933
|
const path = `/api/v1/difficulty-adjustment`;
|
|
10854
|
-
return this.getJson(path, { signal, onValue });
|
|
10934
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
10855
10935
|
}
|
|
10856
10936
|
|
|
10857
10937
|
/**
|
|
@@ -10862,12 +10942,12 @@ class BrkClient extends BrkClientBase {
|
|
|
10862
10942
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-price)*
|
|
10863
10943
|
*
|
|
10864
10944
|
* Endpoint: `GET /api/v1/prices`
|
|
10865
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: Prices) => void }} [options]
|
|
10945
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: Prices) => void, cache?: boolean }} [options]
|
|
10866
10946
|
* @returns {Promise<Prices>}
|
|
10867
10947
|
*/
|
|
10868
|
-
async getPrices({ signal, onValue } = {}) {
|
|
10948
|
+
async getPrices({ signal, onValue, cache } = {}) {
|
|
10869
10949
|
const path = `/api/v1/prices`;
|
|
10870
|
-
return this.getJson(path, { signal, onValue });
|
|
10950
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
10871
10951
|
}
|
|
10872
10952
|
|
|
10873
10953
|
/**
|
|
@@ -10880,15 +10960,15 @@ class BrkClient extends BrkClientBase {
|
|
|
10880
10960
|
* Endpoint: `GET /api/v1/historical-price`
|
|
10881
10961
|
*
|
|
10882
10962
|
* @param {Timestamp=} [timestamp]
|
|
10883
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: HistoricalPrice) => void }} [options]
|
|
10963
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: HistoricalPrice) => void, cache?: boolean }} [options]
|
|
10884
10964
|
* @returns {Promise<HistoricalPrice>}
|
|
10885
10965
|
*/
|
|
10886
|
-
async getHistoricalPrice(timestamp, { signal, onValue } = {}) {
|
|
10966
|
+
async getHistoricalPrice(timestamp, { signal, onValue, cache } = {}) {
|
|
10887
10967
|
const params = new URLSearchParams();
|
|
10888
10968
|
if (timestamp !== undefined) params.set('timestamp', String(timestamp));
|
|
10889
10969
|
const query = params.toString();
|
|
10890
10970
|
const path = `/api/v1/historical-price${query ? '?' + query : ''}`;
|
|
10891
|
-
return this.getJson(path, { signal, onValue });
|
|
10971
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
10892
10972
|
}
|
|
10893
10973
|
|
|
10894
10974
|
/**
|
|
@@ -10901,30 +10981,30 @@ class BrkClient extends BrkClientBase {
|
|
|
10901
10981
|
* Endpoint: `GET /api/address/{address}`
|
|
10902
10982
|
*
|
|
10903
10983
|
* @param {Addr} address
|
|
10904
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: AddrStats) => void }} [options]
|
|
10984
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: AddrStats) => void, cache?: boolean }} [options]
|
|
10905
10985
|
* @returns {Promise<AddrStats>}
|
|
10906
10986
|
*/
|
|
10907
|
-
async getAddress(address, { signal, onValue } = {}) {
|
|
10987
|
+
async getAddress(address, { signal, onValue, cache } = {}) {
|
|
10908
10988
|
const path = `/api/address/${address}`;
|
|
10909
|
-
return this.getJson(path, { signal, onValue });
|
|
10989
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
10910
10990
|
}
|
|
10911
10991
|
|
|
10912
10992
|
/**
|
|
10913
10993
|
* Address transactions
|
|
10914
10994
|
*
|
|
10915
|
-
* Get transaction history for an address,
|
|
10995
|
+
* Get transaction history for an address, newest first. Returns up to 50 mempool transactions plus a confirmed page sized to fill the response to 50 total (chain floor of 25, so 25-50 confirmed depending on mempool weight). To paginate further confirmed history, use `/address/{address}/txs/chain/{last_seen_txid}`.
|
|
10916
10996
|
*
|
|
10917
10997
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-address-transactions)*
|
|
10918
10998
|
*
|
|
10919
10999
|
* Endpoint: `GET /api/address/{address}/txs`
|
|
10920
11000
|
*
|
|
10921
11001
|
* @param {Addr} address
|
|
10922
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void }} [options]
|
|
11002
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void, cache?: boolean }} [options]
|
|
10923
11003
|
* @returns {Promise<Transaction[]>}
|
|
10924
11004
|
*/
|
|
10925
|
-
async getAddressTxs(address, { signal, onValue } = {}) {
|
|
11005
|
+
async getAddressTxs(address, { signal, onValue, cache } = {}) {
|
|
10926
11006
|
const path = `/api/address/${address}/txs`;
|
|
10927
|
-
return this.getJson(path, { signal, onValue });
|
|
11007
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
10928
11008
|
}
|
|
10929
11009
|
|
|
10930
11010
|
/**
|
|
@@ -10937,12 +11017,12 @@ class BrkClient extends BrkClientBase {
|
|
|
10937
11017
|
* Endpoint: `GET /api/address/{address}/txs/chain`
|
|
10938
11018
|
*
|
|
10939
11019
|
* @param {Addr} address
|
|
10940
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void }} [options]
|
|
11020
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void, cache?: boolean }} [options]
|
|
10941
11021
|
* @returns {Promise<Transaction[]>}
|
|
10942
11022
|
*/
|
|
10943
|
-
async getAddressConfirmedTxs(address, { signal, onValue } = {}) {
|
|
11023
|
+
async getAddressConfirmedTxs(address, { signal, onValue, cache } = {}) {
|
|
10944
11024
|
const path = `/api/address/${address}/txs/chain`;
|
|
10945
|
-
return this.getJson(path, { signal, onValue });
|
|
11025
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
10946
11026
|
}
|
|
10947
11027
|
|
|
10948
11028
|
/**
|
|
@@ -10956,12 +11036,12 @@ class BrkClient extends BrkClientBase {
|
|
|
10956
11036
|
*
|
|
10957
11037
|
* @param {Addr} address
|
|
10958
11038
|
* @param {Txid} after_txid - Last txid from the previous page (return transactions strictly older than this)
|
|
10959
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void }} [options]
|
|
11039
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void, cache?: boolean }} [options]
|
|
10960
11040
|
* @returns {Promise<Transaction[]>}
|
|
10961
11041
|
*/
|
|
10962
|
-
async getAddressConfirmedTxsAfter(address, after_txid, { signal, onValue } = {}) {
|
|
11042
|
+
async getAddressConfirmedTxsAfter(address, after_txid, { signal, onValue, cache } = {}) {
|
|
10963
11043
|
const path = `/api/address/${address}/txs/chain/${after_txid}`;
|
|
10964
|
-
return this.getJson(path, { signal, onValue });
|
|
11044
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
10965
11045
|
}
|
|
10966
11046
|
|
|
10967
11047
|
/**
|
|
@@ -10974,12 +11054,12 @@ class BrkClient extends BrkClientBase {
|
|
|
10974
11054
|
* Endpoint: `GET /api/address/{address}/txs/mempool`
|
|
10975
11055
|
*
|
|
10976
11056
|
* @param {Addr} address
|
|
10977
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void }} [options]
|
|
11057
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void, cache?: boolean }} [options]
|
|
10978
11058
|
* @returns {Promise<Transaction[]>}
|
|
10979
11059
|
*/
|
|
10980
|
-
async getAddressMempoolTxs(address, { signal, onValue } = {}) {
|
|
11060
|
+
async getAddressMempoolTxs(address, { signal, onValue, cache } = {}) {
|
|
10981
11061
|
const path = `/api/address/${address}/txs/mempool`;
|
|
10982
|
-
return this.getJson(path, { signal, onValue });
|
|
11062
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
10983
11063
|
}
|
|
10984
11064
|
|
|
10985
11065
|
/**
|
|
@@ -10992,12 +11072,12 @@ class BrkClient extends BrkClientBase {
|
|
|
10992
11072
|
* Endpoint: `GET /api/address/{address}/utxo`
|
|
10993
11073
|
*
|
|
10994
11074
|
* @param {Addr} address
|
|
10995
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: Utxo[]) => void }} [options]
|
|
11075
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: Utxo[]) => void, cache?: boolean }} [options]
|
|
10996
11076
|
* @returns {Promise<Utxo[]>}
|
|
10997
11077
|
*/
|
|
10998
|
-
async getAddressUtxos(address, { signal, onValue } = {}) {
|
|
11078
|
+
async getAddressUtxos(address, { signal, onValue, cache } = {}) {
|
|
10999
11079
|
const path = `/api/address/${address}/utxo`;
|
|
11000
|
-
return this.getJson(path, { signal, onValue });
|
|
11080
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11001
11081
|
}
|
|
11002
11082
|
|
|
11003
11083
|
/**
|
|
@@ -11010,12 +11090,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11010
11090
|
* Endpoint: `GET /api/v1/validate-address/{address}`
|
|
11011
11091
|
*
|
|
11012
11092
|
* @param {string} address - Bitcoin address to validate (can be any string)
|
|
11013
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: AddrValidation) => void }} [options]
|
|
11093
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: AddrValidation) => void, cache?: boolean }} [options]
|
|
11014
11094
|
* @returns {Promise<AddrValidation>}
|
|
11015
11095
|
*/
|
|
11016
|
-
async validateAddress(address, { signal, onValue } = {}) {
|
|
11096
|
+
async validateAddress(address, { signal, onValue, cache } = {}) {
|
|
11017
11097
|
const path = `/api/v1/validate-address/${address}`;
|
|
11018
|
-
return this.getJson(path, { signal, onValue });
|
|
11098
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11019
11099
|
}
|
|
11020
11100
|
|
|
11021
11101
|
/**
|
|
@@ -11028,12 +11108,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11028
11108
|
* Endpoint: `GET /api/block/{hash}`
|
|
11029
11109
|
*
|
|
11030
11110
|
* @param {BlockHash} hash
|
|
11031
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: BlockInfo) => void }} [options]
|
|
11111
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: BlockInfo) => void, cache?: boolean }} [options]
|
|
11032
11112
|
* @returns {Promise<BlockInfo>}
|
|
11033
11113
|
*/
|
|
11034
|
-
async getBlock(hash, { signal, onValue } = {}) {
|
|
11114
|
+
async getBlock(hash, { signal, onValue, cache } = {}) {
|
|
11035
11115
|
const path = `/api/block/${hash}`;
|
|
11036
|
-
return this.getJson(path, { signal, onValue });
|
|
11116
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11037
11117
|
}
|
|
11038
11118
|
|
|
11039
11119
|
/**
|
|
@@ -11046,12 +11126,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11046
11126
|
* Endpoint: `GET /api/v1/block/{hash}`
|
|
11047
11127
|
*
|
|
11048
11128
|
* @param {BlockHash} hash
|
|
11049
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: BlockInfoV1) => void }} [options]
|
|
11129
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: BlockInfoV1) => void, cache?: boolean }} [options]
|
|
11050
11130
|
* @returns {Promise<BlockInfoV1>}
|
|
11051
11131
|
*/
|
|
11052
|
-
async getBlockV1(hash, { signal, onValue } = {}) {
|
|
11132
|
+
async getBlockV1(hash, { signal, onValue, cache } = {}) {
|
|
11053
11133
|
const path = `/api/v1/block/${hash}`;
|
|
11054
|
-
return this.getJson(path, { signal, onValue });
|
|
11134
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11055
11135
|
}
|
|
11056
11136
|
|
|
11057
11137
|
/**
|
|
@@ -11064,12 +11144,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11064
11144
|
* Endpoint: `GET /api/block/{hash}/header`
|
|
11065
11145
|
*
|
|
11066
11146
|
* @param {BlockHash} hash
|
|
11067
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: Hex) => void }} [options]
|
|
11147
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: Hex) => void, cache?: boolean }} [options]
|
|
11068
11148
|
* @returns {Promise<Hex>}
|
|
11069
11149
|
*/
|
|
11070
|
-
async getBlockHeader(hash, { signal, onValue } = {}) {
|
|
11150
|
+
async getBlockHeader(hash, { signal, onValue, cache } = {}) {
|
|
11071
11151
|
const path = `/api/block/${hash}/header`;
|
|
11072
|
-
return this.getText(path, { signal, onValue });
|
|
11152
|
+
return this.getText(path, { signal, onValue, cache });
|
|
11073
11153
|
}
|
|
11074
11154
|
|
|
11075
11155
|
/**
|
|
@@ -11082,12 +11162,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11082
11162
|
* Endpoint: `GET /api/block-height/{height}`
|
|
11083
11163
|
*
|
|
11084
11164
|
* @param {Height} height
|
|
11085
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: BlockHash) => void }} [options]
|
|
11165
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: BlockHash) => void, cache?: boolean }} [options]
|
|
11086
11166
|
* @returns {Promise<BlockHash>}
|
|
11087
11167
|
*/
|
|
11088
|
-
async getBlockByHeight(height, { signal, onValue } = {}) {
|
|
11168
|
+
async getBlockByHeight(height, { signal, onValue, cache } = {}) {
|
|
11089
11169
|
const path = `/api/block-height/${height}`;
|
|
11090
|
-
return this.getText(path, { signal, onValue });
|
|
11170
|
+
return this.getText(path, { signal, onValue, cache });
|
|
11091
11171
|
}
|
|
11092
11172
|
|
|
11093
11173
|
/**
|
|
@@ -11100,12 +11180,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11100
11180
|
* Endpoint: `GET /api/v1/mining/blocks/timestamp/{timestamp}`
|
|
11101
11181
|
*
|
|
11102
11182
|
* @param {Timestamp} timestamp
|
|
11103
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: BlockTimestamp) => void }} [options]
|
|
11183
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: BlockTimestamp) => void, cache?: boolean }} [options]
|
|
11104
11184
|
* @returns {Promise<BlockTimestamp>}
|
|
11105
11185
|
*/
|
|
11106
|
-
async getBlockByTimestamp(timestamp, { signal, onValue } = {}) {
|
|
11186
|
+
async getBlockByTimestamp(timestamp, { signal, onValue, cache } = {}) {
|
|
11107
11187
|
const path = `/api/v1/mining/blocks/timestamp/${timestamp}`;
|
|
11108
|
-
return this.getJson(path, { signal, onValue });
|
|
11188
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11109
11189
|
}
|
|
11110
11190
|
|
|
11111
11191
|
/**
|
|
@@ -11118,12 +11198,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11118
11198
|
* Endpoint: `GET /api/block/{hash}/raw`
|
|
11119
11199
|
*
|
|
11120
11200
|
* @param {BlockHash} hash
|
|
11121
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: Uint8Array) => void }} [options]
|
|
11201
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: Uint8Array) => void, cache?: boolean }} [options]
|
|
11122
11202
|
* @returns {Promise<Uint8Array>}
|
|
11123
11203
|
*/
|
|
11124
|
-
async getBlockRaw(hash, { signal, onValue } = {}) {
|
|
11204
|
+
async getBlockRaw(hash, { signal, onValue, cache } = {}) {
|
|
11125
11205
|
const path = `/api/block/${hash}/raw`;
|
|
11126
|
-
return this.getBytes(path, { signal, onValue });
|
|
11206
|
+
return this.getBytes(path, { signal, onValue, cache });
|
|
11127
11207
|
}
|
|
11128
11208
|
|
|
11129
11209
|
/**
|
|
@@ -11136,12 +11216,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11136
11216
|
* Endpoint: `GET /api/block/{hash}/status`
|
|
11137
11217
|
*
|
|
11138
11218
|
* @param {BlockHash} hash
|
|
11139
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: BlockStatus) => void }} [options]
|
|
11219
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: BlockStatus) => void, cache?: boolean }} [options]
|
|
11140
11220
|
* @returns {Promise<BlockStatus>}
|
|
11141
11221
|
*/
|
|
11142
|
-
async getBlockStatus(hash, { signal, onValue } = {}) {
|
|
11222
|
+
async getBlockStatus(hash, { signal, onValue, cache } = {}) {
|
|
11143
11223
|
const path = `/api/block/${hash}/status`;
|
|
11144
|
-
return this.getJson(path, { signal, onValue });
|
|
11224
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11145
11225
|
}
|
|
11146
11226
|
|
|
11147
11227
|
/**
|
|
@@ -11152,12 +11232,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11152
11232
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-tip-height)*
|
|
11153
11233
|
*
|
|
11154
11234
|
* Endpoint: `GET /api/blocks/tip/height`
|
|
11155
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: Height) => void }} [options]
|
|
11235
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: Height) => void, cache?: boolean }} [options]
|
|
11156
11236
|
* @returns {Promise<Height>}
|
|
11157
11237
|
*/
|
|
11158
|
-
async getBlockTipHeight({ signal, onValue } = {}) {
|
|
11238
|
+
async getBlockTipHeight({ signal, onValue, cache } = {}) {
|
|
11159
11239
|
const path = `/api/blocks/tip/height`;
|
|
11160
|
-
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 }));
|
|
11161
11241
|
}
|
|
11162
11242
|
|
|
11163
11243
|
/**
|
|
@@ -11168,12 +11248,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11168
11248
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-tip-hash)*
|
|
11169
11249
|
*
|
|
11170
11250
|
* Endpoint: `GET /api/blocks/tip/hash`
|
|
11171
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: BlockHash) => void }} [options]
|
|
11251
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: BlockHash) => void, cache?: boolean }} [options]
|
|
11172
11252
|
* @returns {Promise<BlockHash>}
|
|
11173
11253
|
*/
|
|
11174
|
-
async getBlockTipHash({ signal, onValue } = {}) {
|
|
11254
|
+
async getBlockTipHash({ signal, onValue, cache } = {}) {
|
|
11175
11255
|
const path = `/api/blocks/tip/hash`;
|
|
11176
|
-
return this.getText(path, { signal, onValue });
|
|
11256
|
+
return this.getText(path, { signal, onValue, cache });
|
|
11177
11257
|
}
|
|
11178
11258
|
|
|
11179
11259
|
/**
|
|
@@ -11187,12 +11267,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11187
11267
|
*
|
|
11188
11268
|
* @param {BlockHash} hash - Bitcoin block hash
|
|
11189
11269
|
* @param {BlockTxIndex} index - Transaction index within the block (0-based)
|
|
11190
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: Txid) => void }} [options]
|
|
11270
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: Txid) => void, cache?: boolean }} [options]
|
|
11191
11271
|
* @returns {Promise<Txid>}
|
|
11192
11272
|
*/
|
|
11193
|
-
async getBlockTxid(hash, index, { signal, onValue } = {}) {
|
|
11273
|
+
async getBlockTxid(hash, index, { signal, onValue, cache } = {}) {
|
|
11194
11274
|
const path = `/api/block/${hash}/txid/${index}`;
|
|
11195
|
-
return this.getText(path, { signal, onValue });
|
|
11275
|
+
return this.getText(path, { signal, onValue, cache });
|
|
11196
11276
|
}
|
|
11197
11277
|
|
|
11198
11278
|
/**
|
|
@@ -11205,12 +11285,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11205
11285
|
* Endpoint: `GET /api/block/{hash}/txids`
|
|
11206
11286
|
*
|
|
11207
11287
|
* @param {BlockHash} hash
|
|
11208
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: Txid[]) => void }} [options]
|
|
11288
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: Txid[]) => void, cache?: boolean }} [options]
|
|
11209
11289
|
* @returns {Promise<Txid[]>}
|
|
11210
11290
|
*/
|
|
11211
|
-
async getBlockTxids(hash, { signal, onValue } = {}) {
|
|
11291
|
+
async getBlockTxids(hash, { signal, onValue, cache } = {}) {
|
|
11212
11292
|
const path = `/api/block/${hash}/txids`;
|
|
11213
|
-
return this.getJson(path, { signal, onValue });
|
|
11293
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11214
11294
|
}
|
|
11215
11295
|
|
|
11216
11296
|
/**
|
|
@@ -11223,12 +11303,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11223
11303
|
* Endpoint: `GET /api/block/{hash}/txs`
|
|
11224
11304
|
*
|
|
11225
11305
|
* @param {BlockHash} hash
|
|
11226
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void }} [options]
|
|
11306
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void, cache?: boolean }} [options]
|
|
11227
11307
|
* @returns {Promise<Transaction[]>}
|
|
11228
11308
|
*/
|
|
11229
|
-
async getBlockTxs(hash, { signal, onValue } = {}) {
|
|
11309
|
+
async getBlockTxs(hash, { signal, onValue, cache } = {}) {
|
|
11230
11310
|
const path = `/api/block/${hash}/txs`;
|
|
11231
|
-
return this.getJson(path, { signal, onValue });
|
|
11311
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11232
11312
|
}
|
|
11233
11313
|
|
|
11234
11314
|
/**
|
|
@@ -11242,12 +11322,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11242
11322
|
*
|
|
11243
11323
|
* @param {BlockHash} hash - Bitcoin block hash
|
|
11244
11324
|
* @param {BlockTxIndex} start_index - Starting transaction index within the block (0-based)
|
|
11245
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void }} [options]
|
|
11325
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: Transaction[]) => void, cache?: boolean }} [options]
|
|
11246
11326
|
* @returns {Promise<Transaction[]>}
|
|
11247
11327
|
*/
|
|
11248
|
-
async getBlockTxsFromIndex(hash, start_index, { signal, onValue } = {}) {
|
|
11328
|
+
async getBlockTxsFromIndex(hash, start_index, { signal, onValue, cache } = {}) {
|
|
11249
11329
|
const path = `/api/block/${hash}/txs/${start_index}`;
|
|
11250
|
-
return this.getJson(path, { signal, onValue });
|
|
11330
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11251
11331
|
}
|
|
11252
11332
|
|
|
11253
11333
|
/**
|
|
@@ -11258,12 +11338,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11258
11338
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-blocks)*
|
|
11259
11339
|
*
|
|
11260
11340
|
* Endpoint: `GET /api/blocks`
|
|
11261
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: BlockInfo[]) => void }} [options]
|
|
11341
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: BlockInfo[]) => void, cache?: boolean }} [options]
|
|
11262
11342
|
* @returns {Promise<BlockInfo[]>}
|
|
11263
11343
|
*/
|
|
11264
|
-
async getBlocks({ signal, onValue } = {}) {
|
|
11344
|
+
async getBlocks({ signal, onValue, cache } = {}) {
|
|
11265
11345
|
const path = `/api/blocks`;
|
|
11266
|
-
return this.getJson(path, { signal, onValue });
|
|
11346
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11267
11347
|
}
|
|
11268
11348
|
|
|
11269
11349
|
/**
|
|
@@ -11276,12 +11356,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11276
11356
|
* Endpoint: `GET /api/blocks/{height}`
|
|
11277
11357
|
*
|
|
11278
11358
|
* @param {Height} height
|
|
11279
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: BlockInfo[]) => void }} [options]
|
|
11359
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: BlockInfo[]) => void, cache?: boolean }} [options]
|
|
11280
11360
|
* @returns {Promise<BlockInfo[]>}
|
|
11281
11361
|
*/
|
|
11282
|
-
async getBlocksFromHeight(height, { signal, onValue } = {}) {
|
|
11362
|
+
async getBlocksFromHeight(height, { signal, onValue, cache } = {}) {
|
|
11283
11363
|
const path = `/api/blocks/${height}`;
|
|
11284
|
-
return this.getJson(path, { signal, onValue });
|
|
11364
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11285
11365
|
}
|
|
11286
11366
|
|
|
11287
11367
|
/**
|
|
@@ -11292,12 +11372,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11292
11372
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-blocks-v1)*
|
|
11293
11373
|
*
|
|
11294
11374
|
* Endpoint: `GET /api/v1/blocks`
|
|
11295
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: BlockInfoV1[]) => void }} [options]
|
|
11375
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: BlockInfoV1[]) => void, cache?: boolean }} [options]
|
|
11296
11376
|
* @returns {Promise<BlockInfoV1[]>}
|
|
11297
11377
|
*/
|
|
11298
|
-
async getBlocksV1({ signal, onValue } = {}) {
|
|
11378
|
+
async getBlocksV1({ signal, onValue, cache } = {}) {
|
|
11299
11379
|
const path = `/api/v1/blocks`;
|
|
11300
|
-
return this.getJson(path, { signal, onValue });
|
|
11380
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11301
11381
|
}
|
|
11302
11382
|
|
|
11303
11383
|
/**
|
|
@@ -11310,12 +11390,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11310
11390
|
* Endpoint: `GET /api/v1/blocks/{height}`
|
|
11311
11391
|
*
|
|
11312
11392
|
* @param {Height} height
|
|
11313
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: BlockInfoV1[]) => void }} [options]
|
|
11393
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: BlockInfoV1[]) => void, cache?: boolean }} [options]
|
|
11314
11394
|
* @returns {Promise<BlockInfoV1[]>}
|
|
11315
11395
|
*/
|
|
11316
|
-
async getBlocksV1FromHeight(height, { signal, onValue } = {}) {
|
|
11396
|
+
async getBlocksV1FromHeight(height, { signal, onValue, cache } = {}) {
|
|
11317
11397
|
const path = `/api/v1/blocks/${height}`;
|
|
11318
|
-
return this.getJson(path, { signal, onValue });
|
|
11398
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11319
11399
|
}
|
|
11320
11400
|
|
|
11321
11401
|
/**
|
|
@@ -11326,12 +11406,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11326
11406
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pools)*
|
|
11327
11407
|
*
|
|
11328
11408
|
* Endpoint: `GET /api/v1/mining/pools`
|
|
11329
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: PoolInfo[]) => void }} [options]
|
|
11409
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: PoolInfo[]) => void, cache?: boolean }} [options]
|
|
11330
11410
|
* @returns {Promise<PoolInfo[]>}
|
|
11331
11411
|
*/
|
|
11332
|
-
async getPools({ signal, onValue } = {}) {
|
|
11412
|
+
async getPools({ signal, onValue, cache } = {}) {
|
|
11333
11413
|
const path = `/api/v1/mining/pools`;
|
|
11334
|
-
return this.getJson(path, { signal, onValue });
|
|
11414
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11335
11415
|
}
|
|
11336
11416
|
|
|
11337
11417
|
/**
|
|
@@ -11344,12 +11424,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11344
11424
|
* Endpoint: `GET /api/v1/mining/pools/{time_period}`
|
|
11345
11425
|
*
|
|
11346
11426
|
* @param {TimePeriod} time_period
|
|
11347
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: PoolsSummary) => void }} [options]
|
|
11427
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: PoolsSummary) => void, cache?: boolean }} [options]
|
|
11348
11428
|
* @returns {Promise<PoolsSummary>}
|
|
11349
11429
|
*/
|
|
11350
|
-
async getPoolStats(time_period, { signal, onValue } = {}) {
|
|
11430
|
+
async getPoolStats(time_period, { signal, onValue, cache } = {}) {
|
|
11351
11431
|
const path = `/api/v1/mining/pools/${time_period}`;
|
|
11352
|
-
return this.getJson(path, { signal, onValue });
|
|
11432
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11353
11433
|
}
|
|
11354
11434
|
|
|
11355
11435
|
/**
|
|
@@ -11362,12 +11442,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11362
11442
|
* Endpoint: `GET /api/v1/mining/pool/{slug}`
|
|
11363
11443
|
*
|
|
11364
11444
|
* @param {PoolSlug} slug
|
|
11365
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: PoolDetail) => void }} [options]
|
|
11445
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: PoolDetail) => void, cache?: boolean }} [options]
|
|
11366
11446
|
* @returns {Promise<PoolDetail>}
|
|
11367
11447
|
*/
|
|
11368
|
-
async getPool(slug, { signal, onValue } = {}) {
|
|
11448
|
+
async getPool(slug, { signal, onValue, cache } = {}) {
|
|
11369
11449
|
const path = `/api/v1/mining/pool/${slug}`;
|
|
11370
|
-
return this.getJson(path, { signal, onValue });
|
|
11450
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11371
11451
|
}
|
|
11372
11452
|
|
|
11373
11453
|
/**
|
|
@@ -11378,12 +11458,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11378
11458
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pool-hashrates)*
|
|
11379
11459
|
*
|
|
11380
11460
|
* Endpoint: `GET /api/v1/mining/hashrate/pools`
|
|
11381
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: PoolHashrateEntry[]) => void }} [options]
|
|
11461
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: PoolHashrateEntry[]) => void, cache?: boolean }} [options]
|
|
11382
11462
|
* @returns {Promise<PoolHashrateEntry[]>}
|
|
11383
11463
|
*/
|
|
11384
|
-
async getPoolsHashrate({ signal, onValue } = {}) {
|
|
11464
|
+
async getPoolsHashrate({ signal, onValue, cache } = {}) {
|
|
11385
11465
|
const path = `/api/v1/mining/hashrate/pools`;
|
|
11386
|
-
return this.getJson(path, { signal, onValue });
|
|
11466
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11387
11467
|
}
|
|
11388
11468
|
|
|
11389
11469
|
/**
|
|
@@ -11396,12 +11476,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11396
11476
|
* Endpoint: `GET /api/v1/mining/hashrate/pools/{time_period}`
|
|
11397
11477
|
*
|
|
11398
11478
|
* @param {TimePeriod} time_period
|
|
11399
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: PoolHashrateEntry[]) => void }} [options]
|
|
11479
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: PoolHashrateEntry[]) => void, cache?: boolean }} [options]
|
|
11400
11480
|
* @returns {Promise<PoolHashrateEntry[]>}
|
|
11401
11481
|
*/
|
|
11402
|
-
async getPoolsHashrateByPeriod(time_period, { signal, onValue } = {}) {
|
|
11482
|
+
async getPoolsHashrateByPeriod(time_period, { signal, onValue, cache } = {}) {
|
|
11403
11483
|
const path = `/api/v1/mining/hashrate/pools/${time_period}`;
|
|
11404
|
-
return this.getJson(path, { signal, onValue });
|
|
11484
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11405
11485
|
}
|
|
11406
11486
|
|
|
11407
11487
|
/**
|
|
@@ -11414,12 +11494,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11414
11494
|
* Endpoint: `GET /api/v1/mining/pool/{slug}/hashrate`
|
|
11415
11495
|
*
|
|
11416
11496
|
* @param {PoolSlug} slug
|
|
11417
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: PoolHashrateEntry[]) => void }} [options]
|
|
11497
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: PoolHashrateEntry[]) => void, cache?: boolean }} [options]
|
|
11418
11498
|
* @returns {Promise<PoolHashrateEntry[]>}
|
|
11419
11499
|
*/
|
|
11420
|
-
async getPoolHashrate(slug, { signal, onValue } = {}) {
|
|
11500
|
+
async getPoolHashrate(slug, { signal, onValue, cache } = {}) {
|
|
11421
11501
|
const path = `/api/v1/mining/pool/${slug}/hashrate`;
|
|
11422
|
-
return this.getJson(path, { signal, onValue });
|
|
11502
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11423
11503
|
}
|
|
11424
11504
|
|
|
11425
11505
|
/**
|
|
@@ -11432,12 +11512,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11432
11512
|
* Endpoint: `GET /api/v1/mining/pool/{slug}/blocks`
|
|
11433
11513
|
*
|
|
11434
11514
|
* @param {PoolSlug} slug
|
|
11435
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: BlockInfoV1[]) => void }} [options]
|
|
11515
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: BlockInfoV1[]) => void, cache?: boolean }} [options]
|
|
11436
11516
|
* @returns {Promise<BlockInfoV1[]>}
|
|
11437
11517
|
*/
|
|
11438
|
-
async getPoolBlocks(slug, { signal, onValue } = {}) {
|
|
11518
|
+
async getPoolBlocks(slug, { signal, onValue, cache } = {}) {
|
|
11439
11519
|
const path = `/api/v1/mining/pool/${slug}/blocks`;
|
|
11440
|
-
return this.getJson(path, { signal, onValue });
|
|
11520
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11441
11521
|
}
|
|
11442
11522
|
|
|
11443
11523
|
/**
|
|
@@ -11451,12 +11531,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11451
11531
|
*
|
|
11452
11532
|
* @param {PoolSlug} slug
|
|
11453
11533
|
* @param {Height} height
|
|
11454
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: BlockInfoV1[]) => void }} [options]
|
|
11534
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: BlockInfoV1[]) => void, cache?: boolean }} [options]
|
|
11455
11535
|
* @returns {Promise<BlockInfoV1[]>}
|
|
11456
11536
|
*/
|
|
11457
|
-
async getPoolBlocksFrom(slug, height, { signal, onValue } = {}) {
|
|
11537
|
+
async getPoolBlocksFrom(slug, height, { signal, onValue, cache } = {}) {
|
|
11458
11538
|
const path = `/api/v1/mining/pool/${slug}/blocks/${height}`;
|
|
11459
|
-
return this.getJson(path, { signal, onValue });
|
|
11539
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11460
11540
|
}
|
|
11461
11541
|
|
|
11462
11542
|
/**
|
|
@@ -11467,12 +11547,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11467
11547
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-hashrate)*
|
|
11468
11548
|
*
|
|
11469
11549
|
* Endpoint: `GET /api/v1/mining/hashrate`
|
|
11470
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: HashrateSummary) => void }} [options]
|
|
11550
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: HashrateSummary) => void, cache?: boolean }} [options]
|
|
11471
11551
|
* @returns {Promise<HashrateSummary>}
|
|
11472
11552
|
*/
|
|
11473
|
-
async getHashrate({ signal, onValue } = {}) {
|
|
11553
|
+
async getHashrate({ signal, onValue, cache } = {}) {
|
|
11474
11554
|
const path = `/api/v1/mining/hashrate`;
|
|
11475
|
-
return this.getJson(path, { signal, onValue });
|
|
11555
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11476
11556
|
}
|
|
11477
11557
|
|
|
11478
11558
|
/**
|
|
@@ -11485,12 +11565,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11485
11565
|
* Endpoint: `GET /api/v1/mining/hashrate/{time_period}`
|
|
11486
11566
|
*
|
|
11487
11567
|
* @param {TimePeriod} time_period
|
|
11488
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: HashrateSummary) => void }} [options]
|
|
11568
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: HashrateSummary) => void, cache?: boolean }} [options]
|
|
11489
11569
|
* @returns {Promise<HashrateSummary>}
|
|
11490
11570
|
*/
|
|
11491
|
-
async getHashrateByPeriod(time_period, { signal, onValue } = {}) {
|
|
11571
|
+
async getHashrateByPeriod(time_period, { signal, onValue, cache } = {}) {
|
|
11492
11572
|
const path = `/api/v1/mining/hashrate/${time_period}`;
|
|
11493
|
-
return this.getJson(path, { signal, onValue });
|
|
11573
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11494
11574
|
}
|
|
11495
11575
|
|
|
11496
11576
|
/**
|
|
@@ -11501,12 +11581,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11501
11581
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-difficulty-adjustments)*
|
|
11502
11582
|
*
|
|
11503
11583
|
* Endpoint: `GET /api/v1/mining/difficulty-adjustments`
|
|
11504
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: DifficultyAdjustmentEntry[]) => void }} [options]
|
|
11584
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: DifficultyAdjustmentEntry[]) => void, cache?: boolean }} [options]
|
|
11505
11585
|
* @returns {Promise<DifficultyAdjustmentEntry[]>}
|
|
11506
11586
|
*/
|
|
11507
|
-
async getDifficultyAdjustments({ signal, onValue } = {}) {
|
|
11587
|
+
async getDifficultyAdjustments({ signal, onValue, cache } = {}) {
|
|
11508
11588
|
const path = `/api/v1/mining/difficulty-adjustments`;
|
|
11509
|
-
return this.getJson(path, { signal, onValue });
|
|
11589
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11510
11590
|
}
|
|
11511
11591
|
|
|
11512
11592
|
/**
|
|
@@ -11519,12 +11599,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11519
11599
|
* Endpoint: `GET /api/v1/mining/difficulty-adjustments/{time_period}`
|
|
11520
11600
|
*
|
|
11521
11601
|
* @param {TimePeriod} time_period
|
|
11522
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: DifficultyAdjustmentEntry[]) => void }} [options]
|
|
11602
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: DifficultyAdjustmentEntry[]) => void, cache?: boolean }} [options]
|
|
11523
11603
|
* @returns {Promise<DifficultyAdjustmentEntry[]>}
|
|
11524
11604
|
*/
|
|
11525
|
-
async getDifficultyAdjustmentsByPeriod(time_period, { signal, onValue } = {}) {
|
|
11605
|
+
async getDifficultyAdjustmentsByPeriod(time_period, { signal, onValue, cache } = {}) {
|
|
11526
11606
|
const path = `/api/v1/mining/difficulty-adjustments/${time_period}`;
|
|
11527
|
-
return this.getJson(path, { signal, onValue });
|
|
11607
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11528
11608
|
}
|
|
11529
11609
|
|
|
11530
11610
|
/**
|
|
@@ -11537,12 +11617,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11537
11617
|
* Endpoint: `GET /api/v1/mining/reward-stats/{block_count}`
|
|
11538
11618
|
*
|
|
11539
11619
|
* @param {number} block_count - Number of recent blocks to include
|
|
11540
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: RewardStats) => void }} [options]
|
|
11620
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: RewardStats) => void, cache?: boolean }} [options]
|
|
11541
11621
|
* @returns {Promise<RewardStats>}
|
|
11542
11622
|
*/
|
|
11543
|
-
async getRewardStats(block_count, { signal, onValue } = {}) {
|
|
11623
|
+
async getRewardStats(block_count, { signal, onValue, cache } = {}) {
|
|
11544
11624
|
const path = `/api/v1/mining/reward-stats/${block_count}`;
|
|
11545
|
-
return this.getJson(path, { signal, onValue });
|
|
11625
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11546
11626
|
}
|
|
11547
11627
|
|
|
11548
11628
|
/**
|
|
@@ -11555,12 +11635,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11555
11635
|
* Endpoint: `GET /api/v1/mining/blocks/fees/{time_period}`
|
|
11556
11636
|
*
|
|
11557
11637
|
* @param {TimePeriod} time_period
|
|
11558
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: BlockFeesEntry[]) => void }} [options]
|
|
11638
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: BlockFeesEntry[]) => void, cache?: boolean }} [options]
|
|
11559
11639
|
* @returns {Promise<BlockFeesEntry[]>}
|
|
11560
11640
|
*/
|
|
11561
|
-
async getBlockFees(time_period, { signal, onValue } = {}) {
|
|
11641
|
+
async getBlockFees(time_period, { signal, onValue, cache } = {}) {
|
|
11562
11642
|
const path = `/api/v1/mining/blocks/fees/${time_period}`;
|
|
11563
|
-
return this.getJson(path, { signal, onValue });
|
|
11643
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11564
11644
|
}
|
|
11565
11645
|
|
|
11566
11646
|
/**
|
|
@@ -11573,12 +11653,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11573
11653
|
* Endpoint: `GET /api/v1/mining/blocks/rewards/{time_period}`
|
|
11574
11654
|
*
|
|
11575
11655
|
* @param {TimePeriod} time_period
|
|
11576
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: BlockRewardsEntry[]) => void }} [options]
|
|
11656
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: BlockRewardsEntry[]) => void, cache?: boolean }} [options]
|
|
11577
11657
|
* @returns {Promise<BlockRewardsEntry[]>}
|
|
11578
11658
|
*/
|
|
11579
|
-
async getBlockRewards(time_period, { signal, onValue } = {}) {
|
|
11659
|
+
async getBlockRewards(time_period, { signal, onValue, cache } = {}) {
|
|
11580
11660
|
const path = `/api/v1/mining/blocks/rewards/${time_period}`;
|
|
11581
|
-
return this.getJson(path, { signal, onValue });
|
|
11661
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11582
11662
|
}
|
|
11583
11663
|
|
|
11584
11664
|
/**
|
|
@@ -11591,12 +11671,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11591
11671
|
* Endpoint: `GET /api/v1/mining/blocks/fee-rates/{time_period}`
|
|
11592
11672
|
*
|
|
11593
11673
|
* @param {TimePeriod} time_period
|
|
11594
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: BlockFeeRatesEntry[]) => void }} [options]
|
|
11674
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: BlockFeeRatesEntry[]) => void, cache?: boolean }} [options]
|
|
11595
11675
|
* @returns {Promise<BlockFeeRatesEntry[]>}
|
|
11596
11676
|
*/
|
|
11597
|
-
async getBlockFeeRates(time_period, { signal, onValue } = {}) {
|
|
11677
|
+
async getBlockFeeRates(time_period, { signal, onValue, cache } = {}) {
|
|
11598
11678
|
const path = `/api/v1/mining/blocks/fee-rates/${time_period}`;
|
|
11599
|
-
return this.getJson(path, { signal, onValue });
|
|
11679
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11600
11680
|
}
|
|
11601
11681
|
|
|
11602
11682
|
/**
|
|
@@ -11609,60 +11689,60 @@ class BrkClient extends BrkClientBase {
|
|
|
11609
11689
|
* Endpoint: `GET /api/v1/mining/blocks/sizes-weights/{time_period}`
|
|
11610
11690
|
*
|
|
11611
11691
|
* @param {TimePeriod} time_period
|
|
11612
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: BlockSizesWeights) => void }} [options]
|
|
11692
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: BlockSizesWeights) => void, cache?: boolean }} [options]
|
|
11613
11693
|
* @returns {Promise<BlockSizesWeights>}
|
|
11614
11694
|
*/
|
|
11615
|
-
async getBlockSizesWeights(time_period, { signal, onValue } = {}) {
|
|
11695
|
+
async getBlockSizesWeights(time_period, { signal, onValue, cache } = {}) {
|
|
11616
11696
|
const path = `/api/v1/mining/blocks/sizes-weights/${time_period}`;
|
|
11617
|
-
return this.getJson(path, { signal, onValue });
|
|
11697
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11618
11698
|
}
|
|
11619
11699
|
|
|
11620
11700
|
/**
|
|
11621
11701
|
* Projected mempool blocks
|
|
11622
11702
|
*
|
|
11623
|
-
*
|
|
11703
|
+
* Projected blocks for fee estimation. Block 0 reflects Bitcoin Core's actual next-block selection; blocks 1+ are a fee-tier approximation.
|
|
11624
11704
|
*
|
|
11625
11705
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mempool-blocks-fees)*
|
|
11626
11706
|
*
|
|
11627
11707
|
* Endpoint: `GET /api/v1/fees/mempool-blocks`
|
|
11628
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: MempoolBlock[]) => void }} [options]
|
|
11708
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: MempoolBlock[]) => void, cache?: boolean }} [options]
|
|
11629
11709
|
* @returns {Promise<MempoolBlock[]>}
|
|
11630
11710
|
*/
|
|
11631
|
-
async getMempoolBlocks({ signal, onValue } = {}) {
|
|
11711
|
+
async getMempoolBlocks({ signal, onValue, cache } = {}) {
|
|
11632
11712
|
const path = `/api/v1/fees/mempool-blocks`;
|
|
11633
|
-
return this.getJson(path, { signal, onValue });
|
|
11713
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11634
11714
|
}
|
|
11635
11715
|
|
|
11636
11716
|
/**
|
|
11637
11717
|
* Recommended fees
|
|
11638
11718
|
*
|
|
11639
|
-
*
|
|
11719
|
+
* Recommended fee rates by confirmation target.
|
|
11640
11720
|
*
|
|
11641
11721
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-recommended-fees)*
|
|
11642
11722
|
*
|
|
11643
11723
|
* Endpoint: `GET /api/v1/fees/recommended`
|
|
11644
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: RecommendedFees) => void }} [options]
|
|
11724
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: RecommendedFees) => void, cache?: boolean }} [options]
|
|
11645
11725
|
* @returns {Promise<RecommendedFees>}
|
|
11646
11726
|
*/
|
|
11647
|
-
async getRecommendedFees({ signal, onValue } = {}) {
|
|
11727
|
+
async getRecommendedFees({ signal, onValue, cache } = {}) {
|
|
11648
11728
|
const path = `/api/v1/fees/recommended`;
|
|
11649
|
-
return this.getJson(path, { signal, onValue });
|
|
11729
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11650
11730
|
}
|
|
11651
11731
|
|
|
11652
11732
|
/**
|
|
11653
11733
|
* Precise recommended fees
|
|
11654
11734
|
*
|
|
11655
|
-
*
|
|
11735
|
+
* Recommended fee rates with sub-integer precision.
|
|
11656
11736
|
*
|
|
11657
11737
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-recommended-fees-precise)*
|
|
11658
11738
|
*
|
|
11659
11739
|
* Endpoint: `GET /api/v1/fees/precise`
|
|
11660
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: RecommendedFees) => void }} [options]
|
|
11740
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: RecommendedFees) => void, cache?: boolean }} [options]
|
|
11661
11741
|
* @returns {Promise<RecommendedFees>}
|
|
11662
11742
|
*/
|
|
11663
|
-
async getPreciseFees({ signal, onValue } = {}) {
|
|
11743
|
+
async getPreciseFees({ signal, onValue, cache } = {}) {
|
|
11664
11744
|
const path = `/api/v1/fees/precise`;
|
|
11665
|
-
return this.getJson(path, { signal, onValue });
|
|
11745
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11666
11746
|
}
|
|
11667
11747
|
|
|
11668
11748
|
/**
|
|
@@ -11673,26 +11753,26 @@ class BrkClient extends BrkClientBase {
|
|
|
11673
11753
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mempool)*
|
|
11674
11754
|
*
|
|
11675
11755
|
* Endpoint: `GET /api/mempool`
|
|
11676
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: MempoolInfo) => void }} [options]
|
|
11756
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: MempoolInfo) => void, cache?: boolean }} [options]
|
|
11677
11757
|
* @returns {Promise<MempoolInfo>}
|
|
11678
11758
|
*/
|
|
11679
|
-
async getMempool({ signal, onValue } = {}) {
|
|
11759
|
+
async getMempool({ signal, onValue, cache } = {}) {
|
|
11680
11760
|
const path = `/api/mempool`;
|
|
11681
|
-
return this.getJson(path, { signal, onValue });
|
|
11761
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11682
11762
|
}
|
|
11683
11763
|
|
|
11684
11764
|
/**
|
|
11685
11765
|
* Mempool content hash
|
|
11686
11766
|
*
|
|
11687
|
-
* Returns an opaque
|
|
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.
|
|
11688
11768
|
*
|
|
11689
11769
|
* Endpoint: `GET /api/mempool/hash`
|
|
11690
|
-
* @param {{ signal?: AbortSignal, onValue?: (value:
|
|
11691
|
-
* @returns {Promise<
|
|
11770
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: NextBlockHash) => void, cache?: boolean }} [options]
|
|
11771
|
+
* @returns {Promise<NextBlockHash>}
|
|
11692
11772
|
*/
|
|
11693
|
-
async getMempoolHash({ signal, onValue } = {}) {
|
|
11773
|
+
async getMempoolHash({ signal, onValue, cache } = {}) {
|
|
11694
11774
|
const path = `/api/mempool/hash`;
|
|
11695
|
-
return this.getJson(path, { signal, onValue });
|
|
11775
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11696
11776
|
}
|
|
11697
11777
|
|
|
11698
11778
|
/**
|
|
@@ -11703,12 +11783,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11703
11783
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mempool-transaction-ids)*
|
|
11704
11784
|
*
|
|
11705
11785
|
* Endpoint: `GET /api/mempool/txids`
|
|
11706
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: Txid[]) => void }} [options]
|
|
11786
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: Txid[]) => void, cache?: boolean }} [options]
|
|
11707
11787
|
* @returns {Promise<Txid[]>}
|
|
11708
11788
|
*/
|
|
11709
|
-
async getMempoolTxids({ signal, onValue } = {}) {
|
|
11789
|
+
async getMempoolTxids({ signal, onValue, cache } = {}) {
|
|
11710
11790
|
const path = `/api/mempool/txids`;
|
|
11711
|
-
return this.getJson(path, { signal, onValue });
|
|
11791
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11712
11792
|
}
|
|
11713
11793
|
|
|
11714
11794
|
/**
|
|
@@ -11719,12 +11799,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11719
11799
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mempool-recent)*
|
|
11720
11800
|
*
|
|
11721
11801
|
* Endpoint: `GET /api/mempool/recent`
|
|
11722
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: MempoolRecentTx[]) => void }} [options]
|
|
11802
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: MempoolRecentTx[]) => void, cache?: boolean }} [options]
|
|
11723
11803
|
* @returns {Promise<MempoolRecentTx[]>}
|
|
11724
11804
|
*/
|
|
11725
|
-
async getMempoolRecent({ signal, onValue } = {}) {
|
|
11805
|
+
async getMempoolRecent({ signal, onValue, cache } = {}) {
|
|
11726
11806
|
const path = `/api/mempool/recent`;
|
|
11727
|
-
return this.getJson(path, { signal, onValue });
|
|
11807
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11728
11808
|
}
|
|
11729
11809
|
|
|
11730
11810
|
/**
|
|
@@ -11735,12 +11815,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11735
11815
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-replacements)*
|
|
11736
11816
|
*
|
|
11737
11817
|
* Endpoint: `GET /api/v1/replacements`
|
|
11738
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: ReplacementNode[]) => void }} [options]
|
|
11818
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: ReplacementNode[]) => void, cache?: boolean }} [options]
|
|
11739
11819
|
* @returns {Promise<ReplacementNode[]>}
|
|
11740
11820
|
*/
|
|
11741
|
-
async getReplacements({ signal, onValue } = {}) {
|
|
11821
|
+
async getReplacements({ signal, onValue, cache } = {}) {
|
|
11742
11822
|
const path = `/api/v1/replacements`;
|
|
11743
|
-
return this.getJson(path, { signal, onValue });
|
|
11823
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11744
11824
|
}
|
|
11745
11825
|
|
|
11746
11826
|
/**
|
|
@@ -11751,12 +11831,42 @@ class BrkClient extends BrkClientBase {
|
|
|
11751
11831
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-fullrbf-replacements)*
|
|
11752
11832
|
*
|
|
11753
11833
|
* Endpoint: `GET /api/v1/fullrbf/replacements`
|
|
11754
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: ReplacementNode[]) => void }} [options]
|
|
11834
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: ReplacementNode[]) => void, cache?: boolean }} [options]
|
|
11755
11835
|
* @returns {Promise<ReplacementNode[]>}
|
|
11756
11836
|
*/
|
|
11757
|
-
async getFullrbfReplacements({ signal, onValue } = {}) {
|
|
11837
|
+
async getFullrbfReplacements({ signal, onValue, cache } = {}) {
|
|
11758
11838
|
const path = `/api/v1/fullrbf/replacements`;
|
|
11759
|
-
return this.getJson(path, { signal, onValue });
|
|
11839
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11840
|
+
}
|
|
11841
|
+
|
|
11842
|
+
/**
|
|
11843
|
+
* Projected next block template
|
|
11844
|
+
*
|
|
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.
|
|
11846
|
+
*
|
|
11847
|
+
* Endpoint: `GET /api/v1/mempool/block-template`
|
|
11848
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: BlockTemplate) => void, cache?: boolean }} [options]
|
|
11849
|
+
* @returns {Promise<BlockTemplate>}
|
|
11850
|
+
*/
|
|
11851
|
+
async getBlockTemplate({ signal, onValue, cache } = {}) {
|
|
11852
|
+
const path = `/api/v1/mempool/block-template`;
|
|
11853
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11854
|
+
}
|
|
11855
|
+
|
|
11856
|
+
/**
|
|
11857
|
+
* Block template diff since hash
|
|
11858
|
+
*
|
|
11859
|
+
* Delta of the projected next block since `<hash>`. `order` is the full new template in order: each entry is either a number (index into the prior template the client cached at `<hash>`) or a transaction object (new body to insert at this position). Walk `order` once to rebuild; `removed` is a convenience list of txids that left so clients can evict cached bodies. After applying, use the response `hash` as `<hash>` on the next call to keep iterating. Returns `404` when `<hash>` has aged out of server history; clients should fall back to `/api/v1/mempool/block-template`.
|
|
11860
|
+
*
|
|
11861
|
+
* Endpoint: `GET /api/v1/mempool/block-template/diff/{hash}`
|
|
11862
|
+
*
|
|
11863
|
+
* @param {NextBlockHash} hash
|
|
11864
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: BlockTemplateDiff) => void, cache?: boolean }} [options]
|
|
11865
|
+
* @returns {Promise<BlockTemplateDiff>}
|
|
11866
|
+
*/
|
|
11867
|
+
async getBlockTemplateDiff(hash, { signal, onValue, cache } = {}) {
|
|
11868
|
+
const path = `/api/v1/mempool/block-template/diff/${hash}`;
|
|
11869
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11760
11870
|
}
|
|
11761
11871
|
|
|
11762
11872
|
/**
|
|
@@ -11765,12 +11875,86 @@ class BrkClient extends BrkClientBase {
|
|
|
11765
11875
|
* Returns the current BTC/USD price in dollars, derived from on-chain round-dollar output patterns in the last 12 blocks plus mempool.
|
|
11766
11876
|
*
|
|
11767
11877
|
* Endpoint: `GET /api/mempool/price`
|
|
11768
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: Dollars) => void }} [options]
|
|
11878
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: Dollars) => void, cache?: boolean }} [options]
|
|
11769
11879
|
* @returns {Promise<Dollars>}
|
|
11770
11880
|
*/
|
|
11771
|
-
async getLivePrice({ signal, onValue } = {}) {
|
|
11881
|
+
async getLivePrice({ signal, onValue, cache } = {}) {
|
|
11772
11882
|
const path = `/api/mempool/price`;
|
|
11773
|
-
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 });
|
|
11774
11958
|
}
|
|
11775
11959
|
|
|
11776
11960
|
/**
|
|
@@ -11781,12 +11965,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11781
11965
|
* Endpoint: `GET /api/tx-index/{index}`
|
|
11782
11966
|
*
|
|
11783
11967
|
* @param {TxIndex} index
|
|
11784
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: Txid) => void }} [options]
|
|
11968
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: Txid) => void, cache?: boolean }} [options]
|
|
11785
11969
|
* @returns {Promise<Txid>}
|
|
11786
11970
|
*/
|
|
11787
|
-
async getTxByIndex(index, { signal, onValue } = {}) {
|
|
11971
|
+
async getTxByIndex(index, { signal, onValue, cache } = {}) {
|
|
11788
11972
|
const path = `/api/tx-index/${index}`;
|
|
11789
|
-
return this.getText(path, { signal, onValue });
|
|
11973
|
+
return this.getText(path, { signal, onValue, cache });
|
|
11790
11974
|
}
|
|
11791
11975
|
|
|
11792
11976
|
/**
|
|
@@ -11799,12 +11983,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11799
11983
|
* Endpoint: `GET /api/v1/cpfp/{txid}`
|
|
11800
11984
|
*
|
|
11801
11985
|
* @param {Txid} txid
|
|
11802
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: CpfpInfo) => void }} [options]
|
|
11986
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: CpfpInfo) => void, cache?: boolean }} [options]
|
|
11803
11987
|
* @returns {Promise<CpfpInfo>}
|
|
11804
11988
|
*/
|
|
11805
|
-
async getCpfp(txid, { signal, onValue } = {}) {
|
|
11989
|
+
async getCpfp(txid, { signal, onValue, cache } = {}) {
|
|
11806
11990
|
const path = `/api/v1/cpfp/${txid}`;
|
|
11807
|
-
return this.getJson(path, { signal, onValue });
|
|
11991
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11808
11992
|
}
|
|
11809
11993
|
|
|
11810
11994
|
/**
|
|
@@ -11817,12 +12001,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11817
12001
|
* Endpoint: `GET /api/v1/tx/{txid}/rbf`
|
|
11818
12002
|
*
|
|
11819
12003
|
* @param {Txid} txid
|
|
11820
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: RbfResponse) => void }} [options]
|
|
12004
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: RbfResponse) => void, cache?: boolean }} [options]
|
|
11821
12005
|
* @returns {Promise<RbfResponse>}
|
|
11822
12006
|
*/
|
|
11823
|
-
async getTxRbf(txid, { signal, onValue } = {}) {
|
|
12007
|
+
async getTxRbf(txid, { signal, onValue, cache } = {}) {
|
|
11824
12008
|
const path = `/api/v1/tx/${txid}/rbf`;
|
|
11825
|
-
return this.getJson(path, { signal, onValue });
|
|
12009
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11826
12010
|
}
|
|
11827
12011
|
|
|
11828
12012
|
/**
|
|
@@ -11835,12 +12019,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11835
12019
|
* Endpoint: `GET /api/tx/{txid}`
|
|
11836
12020
|
*
|
|
11837
12021
|
* @param {Txid} txid
|
|
11838
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: Transaction) => void }} [options]
|
|
12022
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: Transaction) => void, cache?: boolean }} [options]
|
|
11839
12023
|
* @returns {Promise<Transaction>}
|
|
11840
12024
|
*/
|
|
11841
|
-
async getTx(txid, { signal, onValue } = {}) {
|
|
12025
|
+
async getTx(txid, { signal, onValue, cache } = {}) {
|
|
11842
12026
|
const path = `/api/tx/${txid}`;
|
|
11843
|
-
return this.getJson(path, { signal, onValue });
|
|
12027
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11844
12028
|
}
|
|
11845
12029
|
|
|
11846
12030
|
/**
|
|
@@ -11853,12 +12037,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11853
12037
|
* Endpoint: `GET /api/tx/{txid}/hex`
|
|
11854
12038
|
*
|
|
11855
12039
|
* @param {Txid} txid
|
|
11856
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: Hex) => void }} [options]
|
|
12040
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: Hex) => void, cache?: boolean }} [options]
|
|
11857
12041
|
* @returns {Promise<Hex>}
|
|
11858
12042
|
*/
|
|
11859
|
-
async getTxHex(txid, { signal, onValue } = {}) {
|
|
12043
|
+
async getTxHex(txid, { signal, onValue, cache } = {}) {
|
|
11860
12044
|
const path = `/api/tx/${txid}/hex`;
|
|
11861
|
-
return this.getText(path, { signal, onValue });
|
|
12045
|
+
return this.getText(path, { signal, onValue, cache });
|
|
11862
12046
|
}
|
|
11863
12047
|
|
|
11864
12048
|
/**
|
|
@@ -11871,12 +12055,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11871
12055
|
* Endpoint: `GET /api/tx/{txid}/merkleblock-proof`
|
|
11872
12056
|
*
|
|
11873
12057
|
* @param {Txid} txid
|
|
11874
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: Hex) => void }} [options]
|
|
12058
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: Hex) => void, cache?: boolean }} [options]
|
|
11875
12059
|
* @returns {Promise<Hex>}
|
|
11876
12060
|
*/
|
|
11877
|
-
async getTxMerkleblockProof(txid, { signal, onValue } = {}) {
|
|
12061
|
+
async getTxMerkleblockProof(txid, { signal, onValue, cache } = {}) {
|
|
11878
12062
|
const path = `/api/tx/${txid}/merkleblock-proof`;
|
|
11879
|
-
return this.getText(path, { signal, onValue });
|
|
12063
|
+
return this.getText(path, { signal, onValue, cache });
|
|
11880
12064
|
}
|
|
11881
12065
|
|
|
11882
12066
|
/**
|
|
@@ -11889,12 +12073,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11889
12073
|
* Endpoint: `GET /api/tx/{txid}/merkle-proof`
|
|
11890
12074
|
*
|
|
11891
12075
|
* @param {Txid} txid
|
|
11892
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: MerkleProof) => void }} [options]
|
|
12076
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: MerkleProof) => void, cache?: boolean }} [options]
|
|
11893
12077
|
* @returns {Promise<MerkleProof>}
|
|
11894
12078
|
*/
|
|
11895
|
-
async getTxMerkleProof(txid, { signal, onValue } = {}) {
|
|
12079
|
+
async getTxMerkleProof(txid, { signal, onValue, cache } = {}) {
|
|
11896
12080
|
const path = `/api/tx/${txid}/merkle-proof`;
|
|
11897
|
-
return this.getJson(path, { signal, onValue });
|
|
12081
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11898
12082
|
}
|
|
11899
12083
|
|
|
11900
12084
|
/**
|
|
@@ -11908,12 +12092,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11908
12092
|
*
|
|
11909
12093
|
* @param {Txid} txid - Transaction ID
|
|
11910
12094
|
* @param {Vout} vout - Output index
|
|
11911
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: TxOutspend) => void }} [options]
|
|
12095
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: TxOutspend) => void, cache?: boolean }} [options]
|
|
11912
12096
|
* @returns {Promise<TxOutspend>}
|
|
11913
12097
|
*/
|
|
11914
|
-
async getTxOutspend(txid, vout, { signal, onValue } = {}) {
|
|
12098
|
+
async getTxOutspend(txid, vout, { signal, onValue, cache } = {}) {
|
|
11915
12099
|
const path = `/api/tx/${txid}/outspend/${vout}`;
|
|
11916
|
-
return this.getJson(path, { signal, onValue });
|
|
12100
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11917
12101
|
}
|
|
11918
12102
|
|
|
11919
12103
|
/**
|
|
@@ -11926,12 +12110,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11926
12110
|
* Endpoint: `GET /api/tx/{txid}/outspends`
|
|
11927
12111
|
*
|
|
11928
12112
|
* @param {Txid} txid
|
|
11929
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: TxOutspend[]) => void }} [options]
|
|
12113
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: TxOutspend[]) => void, cache?: boolean }} [options]
|
|
11930
12114
|
* @returns {Promise<TxOutspend[]>}
|
|
11931
12115
|
*/
|
|
11932
|
-
async getTxOutspends(txid, { signal, onValue } = {}) {
|
|
12116
|
+
async getTxOutspends(txid, { signal, onValue, cache } = {}) {
|
|
11933
12117
|
const path = `/api/tx/${txid}/outspends`;
|
|
11934
|
-
return this.getJson(path, { signal, onValue });
|
|
12118
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11935
12119
|
}
|
|
11936
12120
|
|
|
11937
12121
|
/**
|
|
@@ -11944,12 +12128,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11944
12128
|
* Endpoint: `GET /api/tx/{txid}/raw`
|
|
11945
12129
|
*
|
|
11946
12130
|
* @param {Txid} txid
|
|
11947
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: Uint8Array) => void }} [options]
|
|
12131
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: Uint8Array) => void, cache?: boolean }} [options]
|
|
11948
12132
|
* @returns {Promise<Uint8Array>}
|
|
11949
12133
|
*/
|
|
11950
|
-
async getTxRaw(txid, { signal, onValue } = {}) {
|
|
12134
|
+
async getTxRaw(txid, { signal, onValue, cache } = {}) {
|
|
11951
12135
|
const path = `/api/tx/${txid}/raw`;
|
|
11952
|
-
return this.getBytes(path, { signal, onValue });
|
|
12136
|
+
return this.getBytes(path, { signal, onValue, cache });
|
|
11953
12137
|
}
|
|
11954
12138
|
|
|
11955
12139
|
/**
|
|
@@ -11962,12 +12146,12 @@ class BrkClient extends BrkClientBase {
|
|
|
11962
12146
|
* Endpoint: `GET /api/tx/{txid}/status`
|
|
11963
12147
|
*
|
|
11964
12148
|
* @param {Txid} txid
|
|
11965
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: TxStatus) => void }} [options]
|
|
12149
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: TxStatus) => void, cache?: boolean }} [options]
|
|
11966
12150
|
* @returns {Promise<TxStatus>}
|
|
11967
12151
|
*/
|
|
11968
|
-
async getTxStatus(txid, { signal, onValue } = {}) {
|
|
12152
|
+
async getTxStatus(txid, { signal, onValue, cache } = {}) {
|
|
11969
12153
|
const path = `/api/tx/${txid}/status`;
|
|
11970
|
-
return this.getJson(path, { signal, onValue });
|
|
12154
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11971
12155
|
}
|
|
11972
12156
|
|
|
11973
12157
|
/**
|
|
@@ -11980,15 +12164,15 @@ class BrkClient extends BrkClientBase {
|
|
|
11980
12164
|
* Endpoint: `GET /api/v1/transaction-times`
|
|
11981
12165
|
*
|
|
11982
12166
|
* @param {Txid[]} txId - Transaction IDs to look up (max 250 per request).
|
|
11983
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: number[]) => void }} [options]
|
|
12167
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: number[]) => void, cache?: boolean }} [options]
|
|
11984
12168
|
* @returns {Promise<number[]>}
|
|
11985
12169
|
*/
|
|
11986
|
-
async getTransactionTimes(txId, { signal, onValue } = {}) {
|
|
12170
|
+
async getTransactionTimes(txId, { signal, onValue, cache } = {}) {
|
|
11987
12171
|
const params = new URLSearchParams();
|
|
11988
12172
|
for (const _v of txId) params.append('txId[]', String(_v));
|
|
11989
12173
|
const query = params.toString();
|
|
11990
12174
|
const path = `/api/v1/transaction-times${query ? '?' + query : ''}`;
|
|
11991
|
-
return this.getJson(path, { signal, onValue });
|
|
12175
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
11992
12176
|
}
|
|
11993
12177
|
|
|
11994
12178
|
/**
|
|
@@ -12015,12 +12199,12 @@ class BrkClient extends BrkClientBase {
|
|
|
12015
12199
|
* Full OpenAPI 3.1 specification for this API.
|
|
12016
12200
|
*
|
|
12017
12201
|
* Endpoint: `GET /openapi.json`
|
|
12018
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: *) => void }} [options]
|
|
12202
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: *) => void, cache?: boolean }} [options]
|
|
12019
12203
|
* @returns {Promise<*>}
|
|
12020
12204
|
*/
|
|
12021
|
-
async getOpenapi({ signal, onValue } = {}) {
|
|
12205
|
+
async getOpenapi({ signal, onValue, cache } = {}) {
|
|
12022
12206
|
const path = `/openapi.json`;
|
|
12023
|
-
return this.getText(path, { signal, onValue });
|
|
12207
|
+
return this.getText(path, { signal, onValue, cache });
|
|
12024
12208
|
}
|
|
12025
12209
|
|
|
12026
12210
|
/**
|
|
@@ -12029,12 +12213,12 @@ class BrkClient extends BrkClientBase {
|
|
|
12029
12213
|
* Compact OpenAPI specification optimized for LLM consumption. Removes redundant fields while preserving essential API information. Full spec available at `/openapi.json`.
|
|
12030
12214
|
*
|
|
12031
12215
|
* Endpoint: `GET /api.json`
|
|
12032
|
-
* @param {{ signal?: AbortSignal, onValue?: (value: *) => void }} [options]
|
|
12216
|
+
* @param {{ signal?: AbortSignal, onValue?: (value: *) => void, cache?: boolean }} [options]
|
|
12033
12217
|
* @returns {Promise<*>}
|
|
12034
12218
|
*/
|
|
12035
|
-
async getApi({ signal, onValue } = {}) {
|
|
12219
|
+
async getApi({ signal, onValue, cache } = {}) {
|
|
12036
12220
|
const path = `/api.json`;
|
|
12037
|
-
return this.getJson(path, { signal, onValue });
|
|
12221
|
+
return this.getJson(path, { signal, onValue, cache });
|
|
12038
12222
|
}
|
|
12039
12223
|
|
|
12040
12224
|
}
|