brk-client 0.3.0-alpha.6 → 0.3.0-beta.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.
Files changed (2) hide show
  1. package/index.js +340 -221
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -20,6 +20,7 @@
20
20
  * @property {Sats} spentTxoSum - Total amount in satoshis spent from this address
21
21
  * @property {number} txCount - Total number of confirmed transactions involving this address
22
22
  * @property {TypeIndex} typeIndex - Index of this address within its type on the blockchain
23
+ * @property {Dollars} realizedPrice - Realized price (average cost basis) in USD
23
24
  */
24
25
  /**
25
26
  * Address statistics in the mempool (unconfirmed transactions only)
@@ -34,6 +35,8 @@
34
35
  * @property {number} txCount - Number of unconfirmed transactions involving this address
35
36
  */
36
37
  /**
38
+ * Bitcoin address path parameter
39
+ *
37
40
  * @typedef {Object} AddrParam
38
41
  * @property {Addr} address
39
42
  */
@@ -42,6 +45,7 @@
42
45
  *
43
46
  * @typedef {Object} AddrStats
44
47
  * @property {Addr} address - Bitcoin address string
48
+ * @property {OutputType} addrType - Address type (p2pkh, p2sh, v0_p2wpkh, v0_p2wsh, v1_p2tr, etc.)
45
49
  * @property {AddrChainStats} chainStats - Statistics for confirmed transactions on the blockchain
46
50
  * @property {(AddrMempoolStats|null)=} mempoolStats - Statistics for unconfirmed transactions in the mempool
47
51
  */
@@ -106,6 +110,8 @@
106
110
  * @typedef {number} Bitcoin
107
111
  */
108
112
  /**
113
+ * Block count path parameter
114
+ *
109
115
  * @typedef {Object} BlockCountParam
110
116
  * @property {number} blockCount - Number of recent blocks to include
111
117
  */
@@ -151,13 +157,13 @@ Matches mempool.space/bitcoin-cli behavior.
151
157
  * @typedef {Object} BlockFeeRatesEntry
152
158
  * @property {Height} avgHeight - Average block height in this window
153
159
  * @property {Timestamp} timestamp - Unix timestamp at the window midpoint
154
- * @property {FeeRate} avgFee0
155
- * @property {FeeRate} avgFee10
156
- * @property {FeeRate} avgFee25
157
- * @property {FeeRate} avgFee50
158
- * @property {FeeRate} avgFee75
159
- * @property {FeeRate} avgFee90
160
- * @property {FeeRate} avgFee100
160
+ * @property {FeeRate} avgFee0 - Minimum fee rate (sat/vB)
161
+ * @property {FeeRate} avgFee10 - 10th percentile fee rate (sat/vB)
162
+ * @property {FeeRate} avgFee25 - 25th percentile fee rate (sat/vB)
163
+ * @property {FeeRate} avgFee50 - Median fee rate (sat/vB)
164
+ * @property {FeeRate} avgFee75 - 75th percentile fee rate (sat/vB)
165
+ * @property {FeeRate} avgFee90 - 90th percentile fee rate (sat/vB)
166
+ * @property {FeeRate} avgFee100 - Maximum fee rate (sat/vB)
161
167
  */
162
168
  /**
163
169
  * A single block fees data point.
@@ -174,15 +180,21 @@ Matches mempool.space/bitcoin-cli behavior.
174
180
  * @typedef {string} BlockHash
175
181
  */
176
182
  /**
183
+ * Block hash path parameter
184
+ *
177
185
  * @typedef {Object} BlockHashParam
178
186
  * @property {BlockHash} hash
179
187
  */
180
188
  /**
189
+ * Block hash + starting transaction index path parameters
190
+ *
181
191
  * @typedef {Object} BlockHashStartIndex
182
192
  * @property {BlockHash} hash - Bitcoin block hash
183
193
  * @property {TxIndex} startIndex - Starting transaction index within the block (0-based)
184
194
  */
185
195
  /**
196
+ * Block hash + transaction index path parameters
197
+ *
186
198
  * @typedef {Object} BlockHashTxIndex
187
199
  * @property {BlockHash} hash - Bitcoin block hash
188
200
  * @property {TxIndex} index - Transaction index within the block (0-based)
@@ -452,7 +464,7 @@ Matches mempool.space/bitcoin-cli behavior.
452
464
  * @property {number} ratio - brk as percentage of Bitcoin data
453
465
  */
454
466
  /**
455
- * US Dollar amount as floating point
467
+ * US Dollar amount
456
468
  *
457
469
  * @typedef {number} Dollars
458
470
  */
@@ -484,7 +496,7 @@ Matches mempool.space/bitcoin-cli behavior.
484
496
  * @typedef {Object} ExchangeRates
485
497
  */
486
498
  /**
487
- * Fee rate in sats/vB
499
+ * Fee rate in sat/vB
488
500
  *
489
501
  * @typedef {number} FeeRate
490
502
  */
@@ -511,17 +523,17 @@ Matches mempool.space/bitcoin-cli behavior.
511
523
  * A single hashrate data point.
512
524
  *
513
525
  * @typedef {Object} HashrateEntry
514
- * @property {Timestamp} timestamp - Unix timestamp.
515
- * @property {number} avgHashrate - Average hashrate (H/s).
526
+ * @property {Timestamp} timestamp - Unix timestamp
527
+ * @property {number} avgHashrate - Average hashrate (H/s)
516
528
  */
517
529
  /**
518
530
  * Summary of network hashrate and difficulty data.
519
531
  *
520
532
  * @typedef {Object} HashrateSummary
521
- * @property {HashrateEntry[]} hashrates - Historical hashrate data points.
522
- * @property {DifficultyEntry[]} difficulty - Historical difficulty adjustments.
523
- * @property {number} currentHashrate - Current network hashrate (H/s).
524
- * @property {number} currentDifficulty - Current network difficulty.
533
+ * @property {HashrateEntry[]} hashrates - Historical hashrate data points
534
+ * @property {DifficultyEntry[]} difficulty - Historical difficulty adjustments
535
+ * @property {number} currentHashrate - Current network hashrate (H/s)
536
+ * @property {number} currentDifficulty - Current network difficulty
525
537
  */
526
538
  /**
527
539
  * Server health status
@@ -546,6 +558,8 @@ Matches mempool.space/bitcoin-cli behavior.
546
558
  * @typedef {number} Height
547
559
  */
548
560
  /**
561
+ * Block height path parameter
562
+ *
549
563
  * @typedef {Object} HeightParam
550
564
  * @property {Height} height
551
565
  */
@@ -565,7 +579,7 @@ Matches mempool.space/bitcoin-cli behavior.
565
579
  * A single price data point
566
580
  *
567
581
  * @typedef {Object} HistoricalPriceEntry
568
- * @property {number} time - Unix timestamp
582
+ * @property {Timestamp} time - Unix timestamp
569
583
  * @property {Dollars} uSD - BTC/USD price
570
584
  */
571
585
  /** @typedef {number} Hour1 */
@@ -642,7 +656,7 @@ Matches mempool.space/bitcoin-cli behavior.
642
656
  * @typedef {Object} MerkleProof
643
657
  * @property {Height} blockHeight - Block height containing the transaction
644
658
  * @property {string[]} merkle - Merkle proof path (hex-encoded hashes)
645
- * @property {number} pos - Transaction position in the block
659
+ * @property {number} pos - Transaction position in the block (0-indexed)
646
660
  */
647
661
  /** @typedef {number} Minute10 */
648
662
  /** @typedef {number} Minute30 */
@@ -683,6 +697,8 @@ Matches mempool.space/bitcoin-cli behavior.
683
697
  * @typedef {Dollars} Open
684
698
  */
685
699
  /**
700
+ * Optional UNIX timestamp query parameter
701
+ *
686
702
  * @typedef {Object} OptionalTimestampParam
687
703
  * @property {(Timestamp|null)=} timestamp
688
704
  */
@@ -740,8 +756,8 @@ Matches mempool.space/bitcoin-cli behavior.
740
756
  *
741
757
  * @typedef {Object} PoolBlockShares
742
758
  * @property {number} all - Share of all blocks (0.0 - 1.0)
743
- * @property {number} _24h - Share of blocks in last 24 hours
744
- * @property {number} _1w - Share of blocks in last week
759
+ * @property {number} _24h - Share of blocks in last 24 hours (0.0 - 1.0)
760
+ * @property {number} _1w - Share of blocks in last week (0.0 - 1.0)
745
761
  */
746
762
  /**
747
763
  * Detailed pool information with statistics across time periods
@@ -750,8 +766,8 @@ Matches mempool.space/bitcoin-cli behavior.
750
766
  * @property {PoolDetailInfo} pool - Pool information
751
767
  * @property {PoolBlockCounts} blockCount - Block counts for different time periods
752
768
  * @property {PoolBlockShares} blockShare - Pool's share of total blocks for different time periods
753
- * @property {number} estimatedHashrate - Estimated hashrate based on blocks mined
754
- * @property {?number=} reportedHashrate - Self-reported hashrate (if available)
769
+ * @property {number} estimatedHashrate - Estimated hashrate based on blocks mined (H/s)
770
+ * @property {?number=} reportedHashrate - Self-reported hashrate (if available, H/s)
755
771
  * @property {(Sats|null)=} totalReward - Total reward earned by this pool (sats, all time; None for minor pools)
756
772
  */
757
773
  /**
@@ -770,10 +786,10 @@ Matches mempool.space/bitcoin-cli behavior.
770
786
  * A single pool hashrate data point.
771
787
  *
772
788
  * @typedef {Object} PoolHashrateEntry
773
- * @property {Timestamp} timestamp - Unix timestamp.
774
- * @property {number} avgHashrate - Average hashrate (H/s).
775
- * @property {number} share - Pool's share of total network hashrate.
776
- * @property {string} poolName - Pool name.
789
+ * @property {Timestamp} timestamp - Unix timestamp
790
+ * @property {number} avgHashrate - Average hashrate (H/s)
791
+ * @property {number} share - Pool's share of total network hashrate (0.0 - 1.0)
792
+ * @property {string} poolName - Pool name
777
793
  */
778
794
  /**
779
795
  * Basic pool information for listing all pools
@@ -783,13 +799,21 @@ Matches mempool.space/bitcoin-cli behavior.
783
799
  * @property {PoolSlug} slug - URL-friendly pool identifier
784
800
  * @property {number} uniqueId - Unique numeric pool identifier
785
801
  */
786
- /** @typedef {("unknown"|"blockfills"|"ultimuspool"|"terrapool"|"luxor"|"onethash"|"btccom"|"bitfarms"|"huobipool"|"wayicn"|"canoepool"|"btctop"|"bitcoincom"|"pool175btc"|"gbminers"|"axbt"|"asicminer"|"bitminter"|"bitcoinrussia"|"btcserv"|"simplecoinus"|"btcguild"|"eligius"|"ozcoin"|"eclipsemc"|"maxbtc"|"triplemining"|"coinlab"|"pool50btc"|"ghashio"|"stminingcorp"|"bitparking"|"mmpool"|"polmine"|"kncminer"|"bitalo"|"f2pool"|"hhtt"|"megabigpower"|"mtred"|"nmcbit"|"yourbtcnet"|"givemecoins"|"braiinspool"|"antpool"|"multicoinco"|"bcpoolio"|"cointerra"|"kanopool"|"solock"|"ckpool"|"nicehash"|"bitclub"|"bitcoinaffiliatenetwork"|"btcc"|"bwpool"|"exxbw"|"bitsolo"|"bitfury"|"twentyoneinc"|"digitalbtc"|"eightbaochi"|"mybtccoinpool"|"tbdice"|"hashpool"|"nexious"|"bravomining"|"hotpool"|"okexpool"|"bcmonster"|"onehash"|"bixin"|"tatmaspool"|"viabtc"|"connectbtc"|"batpool"|"waterhole"|"dcexploration"|"dcex"|"btpool"|"fiftyeightcoin"|"bitcoinindia"|"shawnp0wers"|"phashio"|"rigpool"|"haozhuzhu"|"sevenpool"|"miningkings"|"hashbx"|"dpool"|"rawpool"|"haominer"|"helix"|"bitcoinukraine"|"poolin"|"secretsuperstar"|"tigerpoolnet"|"sigmapoolcom"|"okpooltop"|"hummerpool"|"tangpool"|"bytepool"|"spiderpool"|"novablock"|"miningcity"|"binancepool"|"minerium"|"lubiancom"|"okkong"|"aaopool"|"emcdpool"|"foundryusa"|"sbicrypto"|"arkpool"|"purebtccom"|"marapool"|"kucoinpool"|"entrustcharitypool"|"okminer"|"titan"|"pegapool"|"btcnuggets"|"cloudhashing"|"digitalxmintsy"|"telco214"|"btcpoolparty"|"multipool"|"transactioncoinmining"|"btcdig"|"trickysbtcpool"|"btcmp"|"eobot"|"unomp"|"patels"|"gogreenlight"|"bitcoinindiapool"|"ekanembtc"|"canoe"|"tiger"|"onem1x"|"zulupool"|"secpool"|"ocean"|"whitepool"|"wiz"|"wk057"|"futurebitapollosolo"|"carbonnegative"|"portlandhodl"|"phoenix"|"neopool"|"maxipool"|"bitfufupool"|"gdpool"|"miningdutch"|"publicpool"|"miningsquared"|"innopolistech"|"btclab"|"parasite"|"redrockpool"|"est3lar"|"braiinssolo"|"solopool")} PoolSlug */
787
802
  /**
803
+ * URL-friendly mining pool identifier
804
+ *
805
+ * @typedef {("unknown"|"blockfills"|"ultimuspool"|"terrapool"|"luxor"|"onethash"|"btccom"|"bitfarms"|"huobipool"|"wayicn"|"canoepool"|"btctop"|"bitcoincom"|"pool175btc"|"gbminers"|"axbt"|"asicminer"|"bitminter"|"bitcoinrussia"|"btcserv"|"simplecoinus"|"btcguild"|"eligius"|"ozcoin"|"eclipsemc"|"maxbtc"|"triplemining"|"coinlab"|"pool50btc"|"ghashio"|"stminingcorp"|"bitparking"|"mmpool"|"polmine"|"kncminer"|"bitalo"|"f2pool"|"hhtt"|"megabigpower"|"mtred"|"nmcbit"|"yourbtcnet"|"givemecoins"|"braiinspool"|"antpool"|"multicoinco"|"bcpoolio"|"cointerra"|"kanopool"|"solock"|"ckpool"|"nicehash"|"bitclub"|"bitcoinaffiliatenetwork"|"btcc"|"bwpool"|"exxbw"|"bitsolo"|"bitfury"|"twentyoneinc"|"digitalbtc"|"eightbaochi"|"mybtccoinpool"|"tbdice"|"hashpool"|"nexious"|"bravomining"|"hotpool"|"okexpool"|"bcmonster"|"onehash"|"bixin"|"tatmaspool"|"viabtc"|"connectbtc"|"batpool"|"waterhole"|"dcexploration"|"dcex"|"btpool"|"fiftyeightcoin"|"bitcoinindia"|"shawnp0wers"|"phashio"|"rigpool"|"haozhuzhu"|"sevenpool"|"miningkings"|"hashbx"|"dpool"|"rawpool"|"haominer"|"helix"|"bitcoinukraine"|"poolin"|"secretsuperstar"|"tigerpoolnet"|"sigmapoolcom"|"okpooltop"|"hummerpool"|"tangpool"|"bytepool"|"spiderpool"|"novablock"|"miningcity"|"binancepool"|"minerium"|"lubiancom"|"okkong"|"aaopool"|"emcdpool"|"foundryusa"|"sbicrypto"|"arkpool"|"purebtccom"|"marapool"|"kucoinpool"|"entrustcharitypool"|"okminer"|"titan"|"pegapool"|"btcnuggets"|"cloudhashing"|"digitalxmintsy"|"telco214"|"btcpoolparty"|"multipool"|"transactioncoinmining"|"btcdig"|"trickysbtcpool"|"btcmp"|"eobot"|"unomp"|"patels"|"gogreenlight"|"bitcoinindiapool"|"ekanembtc"|"canoe"|"tiger"|"onem1x"|"zulupool"|"secpool"|"ocean"|"whitepool"|"wiz"|"wk057"|"futurebitapollosolo"|"carbonnegative"|"portlandhodl"|"phoenix"|"neopool"|"maxipool"|"bitfufupool"|"gdpool"|"miningdutch"|"publicpool"|"miningsquared"|"innopolistech"|"btclab"|"parasite"|"redrockpool"|"est3lar"|"braiinssolo"|"solopool")} PoolSlug
806
+ */
807
+ /**
808
+ * Mining pool slug + block height path parameters
809
+ *
788
810
  * @typedef {Object} PoolSlugAndHeightParam
789
811
  * @property {PoolSlug} slug
790
812
  * @property {Height} height
791
813
  */
792
814
  /**
815
+ * Mining pool slug path parameter
816
+ *
793
817
  * @typedef {Object} PoolSlugParam
794
818
  * @property {PoolSlug} slug
795
819
  */
@@ -813,9 +837,9 @@ Matches mempool.space/bitcoin-cli behavior.
813
837
  * @typedef {Object} PoolsSummary
814
838
  * @property {PoolStats[]} pools - List of pools sorted by block count descending
815
839
  * @property {number} blockCount - Total blocks in the time period
816
- * @property {number} lastEstimatedHashrate - Estimated network hashrate (hashes per second)
817
- * @property {number} lastEstimatedHashrate3d - Estimated network hashrate over last 3 days
818
- * @property {number} lastEstimatedHashrate1w - Estimated network hashrate over last 1 week
840
+ * @property {number} lastEstimatedHashrate - Estimated network hashrate (H/s)
841
+ * @property {number} lastEstimatedHashrate3d - Estimated network hashrate over last 3 days (H/s)
842
+ * @property {number} lastEstimatedHashrate1w - Estimated network hashrate over last 1 week (H/s)
819
843
  */
820
844
  /**
821
845
  * Current price response matching mempool.space /api/v1/prices format
@@ -830,7 +854,7 @@ Matches mempool.space/bitcoin-cli behavior.
830
854
  * @typedef {(number|Date|Timestamp)} RangeIndex
831
855
  */
832
856
  /**
833
- * Transaction locktime
857
+ * Transaction locktime. Values below 500,000,000 are interpreted as block heights; values at or above are Unix timestamps.
834
858
  *
835
859
  * @typedef {number} RawLockTime
836
860
  */
@@ -855,7 +879,7 @@ Matches mempool.space/bitcoin-cli behavior.
855
879
  * @property {number} totalTx - Total number of transactions
856
880
  */
857
881
  /**
858
- * Satoshis
882
+ * Amount in satoshis (1 BTC = 100,000,000 sats)
859
883
  *
860
884
  * @typedef {number} Sats
861
885
  */
@@ -1003,6 +1027,8 @@ Matches mempool.space/bitcoin-cli behavior.
1003
1027
  * @typedef {("24h"|"3d"|"1w"|"1m"|"3m"|"6m"|"1y"|"2y"|"3y"|"all")} TimePeriod
1004
1028
  */
1005
1029
  /**
1030
+ * Time period path parameter (24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y)
1031
+ *
1006
1032
  * @typedef {Object} TimePeriodParam
1007
1033
  * @property {TimePeriod} timePeriod
1008
1034
  */
@@ -1012,6 +1038,8 @@ Matches mempool.space/bitcoin-cli behavior.
1012
1038
  * @typedef {number} Timestamp
1013
1039
  */
1014
1040
  /**
1041
+ * UNIX timestamp path parameter
1042
+ *
1015
1043
  * @typedef {Object} TimestampParam
1016
1044
  * @property {Timestamp} timestamp
1017
1045
  */
@@ -1052,7 +1080,11 @@ Matches mempool.space/bitcoin-cli behavior.
1052
1080
  * @property {string} innerWitnessscriptAsm - Inner witnessscript in assembly (for P2WSH: last witness item decoded as script)
1053
1081
  */
1054
1082
  /** @typedef {number} TxInIndex */
1055
- /** @typedef {number} TxIndex */
1083
+ /**
1084
+ * Transaction index within a block (0 = coinbase)
1085
+ *
1086
+ * @typedef {number} TxIndex
1087
+ */
1056
1088
  /**
1057
1089
  * Transaction output
1058
1090
  *
@@ -1097,6 +1129,8 @@ Matches mempool.space/bitcoin-cli behavior.
1097
1129
  * @typedef {string} Txid
1098
1130
  */
1099
1131
  /**
1132
+ * Transaction ID path parameter
1133
+ *
1100
1134
  * @typedef {Object} TxidParam
1101
1135
  * @property {Txid} txid
1102
1136
  */
@@ -1128,7 +1162,7 @@ Matches mempool.space/bitcoin-cli behavior.
1128
1162
  * @property {Sats} value - Output value in satoshis
1129
1163
  */
1130
1164
  /**
1131
- * Virtual size in vbytes (weight / 4, rounded up)
1165
+ * Virtual size in vbytes (weight / 4, rounded up). Max block vsize is ~1,000,000 vB.
1132
1166
  *
1133
1167
  * @typedef {number} VSize
1134
1168
  */
@@ -1157,7 +1191,7 @@ Matches mempool.space/bitcoin-cli behavior.
1157
1191
  */
1158
1192
  /** @typedef {number} Week1 */
1159
1193
  /**
1160
- * Transaction or block weight in weight units (WU)
1194
+ * Weight in weight units (WU). Max block weight is 4,000,000 WU.
1161
1195
  *
1162
1196
  * @typedef {number} Weight
1163
1197
  */
@@ -1556,11 +1590,14 @@ class BrkClientBase {
1556
1590
 
1557
1591
  /**
1558
1592
  * @param {string} path
1593
+ * @param {{ signal?: AbortSignal }} [options]
1559
1594
  * @returns {Promise<Response>}
1560
1595
  */
1561
- async get(path) {
1596
+ async get(path, { signal } = {}) {
1562
1597
  const url = `${this.baseUrl}${path}`;
1563
- const res = await fetch(url, { signal: AbortSignal.timeout(this.timeout) });
1598
+ const signals = [AbortSignal.timeout(this.timeout)];
1599
+ if (signal) signals.push(signal);
1600
+ const res = await fetch(url, { signal: AbortSignal.any(signals) });
1564
1601
  if (!res.ok) throw new BrkError(`HTTP ${res.status}: ${url}`, res.status);
1565
1602
  return res;
1566
1603
  }
@@ -1569,10 +1606,10 @@ class BrkClientBase {
1569
1606
  * Make a GET request - races cache vs network, first to resolve calls onUpdate
1570
1607
  * @template T
1571
1608
  * @param {string} path
1572
- * @param {(value: T) => void} [onUpdate] - Called when data is available (may be called twice: cache then network)
1609
+ * @param {{ onUpdate?: (value: T) => void, signal?: AbortSignal }} [options]
1573
1610
  * @returns {Promise<T>}
1574
1611
  */
1575
- async getJson(path, onUpdate) {
1612
+ async getJson(path, { onUpdate, signal } = {}) {
1576
1613
  const url = `${this.baseUrl}${path}`;
1577
1614
  const cache = this._cache ?? await this._cachePromise;
1578
1615
 
@@ -1592,7 +1629,7 @@ class BrkClientBase {
1592
1629
  return json;
1593
1630
  });
1594
1631
 
1595
- const networkPromise = this.get(path).then(async (res) => {
1632
+ const networkPromise = this.get(path, { signal }).then(async (res) => {
1596
1633
  const cloned = res.clone();
1597
1634
  const json = _addCamelGetters(await res.json());
1598
1635
  // Skip update if ETag matches and cache already delivered
@@ -1624,10 +1661,11 @@ class BrkClientBase {
1624
1661
  /**
1625
1662
  * Make a GET request and return raw text (for CSV responses)
1626
1663
  * @param {string} path
1664
+ * @param {{ signal?: AbortSignal }} [options]
1627
1665
  * @returns {Promise<string>}
1628
1666
  */
1629
- async getText(path) {
1630
- const res = await this.get(path);
1667
+ async getText(path, { signal } = {}) {
1668
+ const res = await this.get(path, { signal });
1631
1669
  return res.text();
1632
1670
  }
1633
1671
 
@@ -1640,7 +1678,7 @@ class BrkClientBase {
1640
1678
  */
1641
1679
  async _fetchSeriesData(path, onUpdate) {
1642
1680
  const wrappedOnUpdate = onUpdate ? (/** @type {SeriesData<T>} */ raw) => onUpdate(_wrapSeriesData(raw)) : undefined;
1643
- const raw = await this.getJson(path, wrappedOnUpdate);
1681
+ const raw = await this.getJson(path, { onUpdate: wrappedOnUpdate });
1644
1682
  return _wrapSeriesData(raw);
1645
1683
  }
1646
1684
  }
@@ -6590,7 +6628,7 @@ function createTransferPattern(client, acc) {
6590
6628
  * @extends BrkClientBase
6591
6629
  */
6592
6630
  class BrkClient extends BrkClientBase {
6593
- VERSION = "v0.3.0-alpha.6";
6631
+ VERSION = "v0.3.0-beta.1";
6594
6632
 
6595
6633
  INDEXES = /** @type {const} */ ([
6596
6634
  "minute10",
@@ -9458,10 +9496,11 @@ class BrkClient extends BrkClientBase {
9458
9496
  * Compact OpenAPI specification optimized for LLM consumption. Removes redundant fields while preserving essential API information. Full spec available at `/openapi.json`.
9459
9497
  *
9460
9498
  * Endpoint: `GET /api.json`
9499
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: *) => void }} [options]
9461
9500
  * @returns {Promise<*>}
9462
9501
  */
9463
- async getApi() {
9464
- return this.getJson(`/api.json`);
9502
+ async getApi({ signal, onUpdate } = {}) {
9503
+ return this.getJson(`/api.json`, { signal, onUpdate });
9465
9504
  }
9466
9505
 
9467
9506
  /**
@@ -9474,10 +9513,11 @@ class BrkClient extends BrkClientBase {
9474
9513
  * Endpoint: `GET /api/address/{address}`
9475
9514
  *
9476
9515
  * @param {Addr} address
9516
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: AddrStats) => void }} [options]
9477
9517
  * @returns {Promise<AddrStats>}
9478
9518
  */
9479
- async getAddress(address) {
9480
- return this.getJson(`/api/address/${address}`);
9519
+ async getAddress(address, { signal, onUpdate } = {}) {
9520
+ return this.getJson(`/api/address/${address}`, { signal, onUpdate });
9481
9521
  }
9482
9522
 
9483
9523
  /**
@@ -9491,14 +9531,15 @@ class BrkClient extends BrkClientBase {
9491
9531
  *
9492
9532
  * @param {Addr} address
9493
9533
  * @param {Txid=} [after_txid] - Txid to paginate from (return transactions before this one)
9534
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: Transaction[]) => void }} [options]
9494
9535
  * @returns {Promise<Transaction[]>}
9495
9536
  */
9496
- async getAddressTxs(address, after_txid) {
9537
+ async getAddressTxs(address, after_txid, { signal, onUpdate } = {}) {
9497
9538
  const params = new URLSearchParams();
9498
9539
  if (after_txid !== undefined) params.set('after_txid', String(after_txid));
9499
9540
  const query = params.toString();
9500
9541
  const path = `/api/address/${address}/txs${query ? '?' + query : ''}`;
9501
- return this.getJson(path);
9542
+ return this.getJson(path, { signal, onUpdate });
9502
9543
  }
9503
9544
 
9504
9545
  /**
@@ -9512,14 +9553,15 @@ class BrkClient extends BrkClientBase {
9512
9553
  *
9513
9554
  * @param {Addr} address
9514
9555
  * @param {Txid=} [after_txid] - Txid to paginate from (return transactions before this one)
9556
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: Transaction[]) => void }} [options]
9515
9557
  * @returns {Promise<Transaction[]>}
9516
9558
  */
9517
- async getAddressConfirmedTxs(address, after_txid) {
9559
+ async getAddressConfirmedTxs(address, after_txid, { signal, onUpdate } = {}) {
9518
9560
  const params = new URLSearchParams();
9519
9561
  if (after_txid !== undefined) params.set('after_txid', String(after_txid));
9520
9562
  const query = params.toString();
9521
9563
  const path = `/api/address/${address}/txs/chain${query ? '?' + query : ''}`;
9522
- return this.getJson(path);
9564
+ return this.getJson(path, { signal, onUpdate });
9523
9565
  }
9524
9566
 
9525
9567
  /**
@@ -9532,10 +9574,11 @@ class BrkClient extends BrkClientBase {
9532
9574
  * Endpoint: `GET /api/address/{address}/txs/mempool`
9533
9575
  *
9534
9576
  * @param {Addr} address
9577
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: Txid[]) => void }} [options]
9535
9578
  * @returns {Promise<Txid[]>}
9536
9579
  */
9537
- async getAddressMempoolTxs(address) {
9538
- return this.getJson(`/api/address/${address}/txs/mempool`);
9580
+ async getAddressMempoolTxs(address, { signal, onUpdate } = {}) {
9581
+ return this.getJson(`/api/address/${address}/txs/mempool`, { signal, onUpdate });
9539
9582
  }
9540
9583
 
9541
9584
  /**
@@ -9548,10 +9591,11 @@ class BrkClient extends BrkClientBase {
9548
9591
  * Endpoint: `GET /api/address/{address}/utxo`
9549
9592
  *
9550
9593
  * @param {Addr} address
9594
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: Utxo[]) => void }} [options]
9551
9595
  * @returns {Promise<Utxo[]>}
9552
9596
  */
9553
- async getAddressUtxos(address) {
9554
- return this.getJson(`/api/address/${address}/utxo`);
9597
+ async getAddressUtxos(address, { signal, onUpdate } = {}) {
9598
+ return this.getJson(`/api/address/${address}/utxo`, { signal, onUpdate });
9555
9599
  }
9556
9600
 
9557
9601
  /**
@@ -9564,10 +9608,11 @@ class BrkClient extends BrkClientBase {
9564
9608
  * Endpoint: `GET /api/block-height/{height}`
9565
9609
  *
9566
9610
  * @param {Height} height
9611
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: *) => void }} [options]
9567
9612
  * @returns {Promise<*>}
9568
9613
  */
9569
- async getBlockByHeight(height) {
9570
- return this.getJson(`/api/block-height/${height}`);
9614
+ async getBlockByHeight(height, { signal, onUpdate } = {}) {
9615
+ return this.getJson(`/api/block-height/${height}`, { signal, onUpdate });
9571
9616
  }
9572
9617
 
9573
9618
  /**
@@ -9580,26 +9625,28 @@ class BrkClient extends BrkClientBase {
9580
9625
  * Endpoint: `GET /api/block/{hash}`
9581
9626
  *
9582
9627
  * @param {BlockHash} hash
9628
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: BlockInfo) => void }} [options]
9583
9629
  * @returns {Promise<BlockInfo>}
9584
9630
  */
9585
- async getBlock(hash) {
9586
- return this.getJson(`/api/block/${hash}`);
9631
+ async getBlock(hash, { signal, onUpdate } = {}) {
9632
+ return this.getJson(`/api/block/${hash}`, { signal, onUpdate });
9587
9633
  }
9588
9634
 
9589
9635
  /**
9590
9636
  * Block header
9591
9637
  *
9592
- * Returns the hex-encoded block header.
9638
+ * Returns the hex-encoded 80-byte block header.
9593
9639
  *
9594
9640
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-header)*
9595
9641
  *
9596
9642
  * Endpoint: `GET /api/block/{hash}/header`
9597
9643
  *
9598
9644
  * @param {BlockHash} hash
9645
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: *) => void }} [options]
9599
9646
  * @returns {Promise<*>}
9600
9647
  */
9601
- async getBlockHeader(hash) {
9602
- return this.getJson(`/api/block/${hash}/header`);
9648
+ async getBlockHeader(hash, { signal, onUpdate } = {}) {
9649
+ return this.getJson(`/api/block/${hash}/header`, { signal, onUpdate });
9603
9650
  }
9604
9651
 
9605
9652
  /**
@@ -9612,10 +9659,11 @@ class BrkClient extends BrkClientBase {
9612
9659
  * Endpoint: `GET /api/block/{hash}/raw`
9613
9660
  *
9614
9661
  * @param {BlockHash} hash
9615
- * @returns {Promise<number[]>}
9662
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: *) => void }} [options]
9663
+ * @returns {Promise<*>}
9616
9664
  */
9617
- async getBlockRaw(hash) {
9618
- return this.getJson(`/api/block/${hash}/raw`);
9665
+ async getBlockRaw(hash, { signal, onUpdate } = {}) {
9666
+ return this.getJson(`/api/block/${hash}/raw`, { signal, onUpdate });
9619
9667
  }
9620
9668
 
9621
9669
  /**
@@ -9628,10 +9676,11 @@ class BrkClient extends BrkClientBase {
9628
9676
  * Endpoint: `GET /api/block/{hash}/status`
9629
9677
  *
9630
9678
  * @param {BlockHash} hash
9679
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: BlockStatus) => void }} [options]
9631
9680
  * @returns {Promise<BlockStatus>}
9632
9681
  */
9633
- async getBlockStatus(hash) {
9634
- return this.getJson(`/api/block/${hash}/status`);
9682
+ async getBlockStatus(hash, { signal, onUpdate } = {}) {
9683
+ return this.getJson(`/api/block/${hash}/status`, { signal, onUpdate });
9635
9684
  }
9636
9685
 
9637
9686
  /**
@@ -9645,10 +9694,11 @@ class BrkClient extends BrkClientBase {
9645
9694
  *
9646
9695
  * @param {BlockHash} hash - Bitcoin block hash
9647
9696
  * @param {TxIndex} index - Transaction index within the block (0-based)
9697
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: *) => void }} [options]
9648
9698
  * @returns {Promise<*>}
9649
9699
  */
9650
- async getBlockTxid(hash, index) {
9651
- return this.getJson(`/api/block/${hash}/txid/${index}`);
9700
+ async getBlockTxid(hash, index, { signal, onUpdate } = {}) {
9701
+ return this.getJson(`/api/block/${hash}/txid/${index}`, { signal, onUpdate });
9652
9702
  }
9653
9703
 
9654
9704
  /**
@@ -9661,10 +9711,11 @@ class BrkClient extends BrkClientBase {
9661
9711
  * Endpoint: `GET /api/block/{hash}/txids`
9662
9712
  *
9663
9713
  * @param {BlockHash} hash
9714
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: Txid[]) => void }} [options]
9664
9715
  * @returns {Promise<Txid[]>}
9665
9716
  */
9666
- async getBlockTxids(hash) {
9667
- return this.getJson(`/api/block/${hash}/txids`);
9717
+ async getBlockTxids(hash, { signal, onUpdate } = {}) {
9718
+ return this.getJson(`/api/block/${hash}/txids`, { signal, onUpdate });
9668
9719
  }
9669
9720
 
9670
9721
  /**
@@ -9677,10 +9728,11 @@ class BrkClient extends BrkClientBase {
9677
9728
  * Endpoint: `GET /api/block/{hash}/txs`
9678
9729
  *
9679
9730
  * @param {BlockHash} hash
9731
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: Transaction[]) => void }} [options]
9680
9732
  * @returns {Promise<Transaction[]>}
9681
9733
  */
9682
- async getBlockTxs(hash) {
9683
- return this.getJson(`/api/block/${hash}/txs`);
9734
+ async getBlockTxs(hash, { signal, onUpdate } = {}) {
9735
+ return this.getJson(`/api/block/${hash}/txs`, { signal, onUpdate });
9684
9736
  }
9685
9737
 
9686
9738
  /**
@@ -9694,10 +9746,11 @@ class BrkClient extends BrkClientBase {
9694
9746
  *
9695
9747
  * @param {BlockHash} hash - Bitcoin block hash
9696
9748
  * @param {TxIndex} start_index - Starting transaction index within the block (0-based)
9749
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: Transaction[]) => void }} [options]
9697
9750
  * @returns {Promise<Transaction[]>}
9698
9751
  */
9699
- async getBlockTxsFromIndex(hash, start_index) {
9700
- return this.getJson(`/api/block/${hash}/txs/${start_index}`);
9752
+ async getBlockTxsFromIndex(hash, start_index, { signal, onUpdate } = {}) {
9753
+ return this.getJson(`/api/block/${hash}/txs/${start_index}`, { signal, onUpdate });
9701
9754
  }
9702
9755
 
9703
9756
  /**
@@ -9708,10 +9761,11 @@ class BrkClient extends BrkClientBase {
9708
9761
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-blocks)*
9709
9762
  *
9710
9763
  * Endpoint: `GET /api/blocks`
9764
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: BlockInfo[]) => void }} [options]
9711
9765
  * @returns {Promise<BlockInfo[]>}
9712
9766
  */
9713
- async getBlocks() {
9714
- return this.getJson(`/api/blocks`);
9767
+ async getBlocks({ signal, onUpdate } = {}) {
9768
+ return this.getJson(`/api/blocks`, { signal, onUpdate });
9715
9769
  }
9716
9770
 
9717
9771
  /**
@@ -9722,10 +9776,11 @@ class BrkClient extends BrkClientBase {
9722
9776
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-tip-hash)*
9723
9777
  *
9724
9778
  * Endpoint: `GET /api/blocks/tip/hash`
9779
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: *) => void }} [options]
9725
9780
  * @returns {Promise<*>}
9726
9781
  */
9727
- async getBlockTipHash() {
9728
- return this.getJson(`/api/blocks/tip/hash`);
9782
+ async getBlockTipHash({ signal, onUpdate } = {}) {
9783
+ return this.getJson(`/api/blocks/tip/hash`, { signal, onUpdate });
9729
9784
  }
9730
9785
 
9731
9786
  /**
@@ -9736,10 +9791,11 @@ class BrkClient extends BrkClientBase {
9736
9791
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-tip-height)*
9737
9792
  *
9738
9793
  * Endpoint: `GET /api/blocks/tip/height`
9794
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: *) => void }} [options]
9739
9795
  * @returns {Promise<*>}
9740
9796
  */
9741
- async getBlockTipHeight() {
9742
- return this.getJson(`/api/blocks/tip/height`);
9797
+ async getBlockTipHeight({ signal, onUpdate } = {}) {
9798
+ return this.getJson(`/api/blocks/tip/height`, { signal, onUpdate });
9743
9799
  }
9744
9800
 
9745
9801
  /**
@@ -9752,10 +9808,11 @@ class BrkClient extends BrkClientBase {
9752
9808
  * Endpoint: `GET /api/blocks/{height}`
9753
9809
  *
9754
9810
  * @param {Height} height
9811
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: BlockInfo[]) => void }} [options]
9755
9812
  * @returns {Promise<BlockInfo[]>}
9756
9813
  */
9757
- async getBlocksFromHeight(height) {
9758
- return this.getJson(`/api/blocks/${height}`);
9814
+ async getBlocksFromHeight(height, { signal, onUpdate } = {}) {
9815
+ return this.getJson(`/api/blocks/${height}`, { signal, onUpdate });
9759
9816
  }
9760
9817
 
9761
9818
  /**
@@ -9766,10 +9823,11 @@ class BrkClient extends BrkClientBase {
9766
9823
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mempool)*
9767
9824
  *
9768
9825
  * Endpoint: `GET /api/mempool`
9826
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: MempoolInfo) => void }} [options]
9769
9827
  * @returns {Promise<MempoolInfo>}
9770
9828
  */
9771
- async getMempool() {
9772
- return this.getJson(`/api/mempool`);
9829
+ async getMempool({ signal, onUpdate } = {}) {
9830
+ return this.getJson(`/api/mempool`, { signal, onUpdate });
9773
9831
  }
9774
9832
 
9775
9833
  /**
@@ -9778,10 +9836,11 @@ class BrkClient extends BrkClientBase {
9778
9836
  * Returns the current BTC/USD price in dollars, derived from on-chain round-dollar output patterns in the last 12 blocks plus mempool.
9779
9837
  *
9780
9838
  * Endpoint: `GET /api/mempool/price`
9839
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: Dollars) => void }} [options]
9781
9840
  * @returns {Promise<Dollars>}
9782
9841
  */
9783
- async getLivePrice() {
9784
- return this.getJson(`/api/mempool/price`);
9842
+ async getLivePrice({ signal, onUpdate } = {}) {
9843
+ return this.getJson(`/api/mempool/price`, { signal, onUpdate });
9785
9844
  }
9786
9845
 
9787
9846
  /**
@@ -9792,10 +9851,11 @@ class BrkClient extends BrkClientBase {
9792
9851
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mempool-recent)*
9793
9852
  *
9794
9853
  * Endpoint: `GET /api/mempool/recent`
9854
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: MempoolRecentTx[]) => void }} [options]
9795
9855
  * @returns {Promise<MempoolRecentTx[]>}
9796
9856
  */
9797
- async getMempoolRecent() {
9798
- return this.getJson(`/api/mempool/recent`);
9857
+ async getMempoolRecent({ signal, onUpdate } = {}) {
9858
+ return this.getJson(`/api/mempool/recent`, { signal, onUpdate });
9799
9859
  }
9800
9860
 
9801
9861
  /**
@@ -9806,10 +9866,11 @@ class BrkClient extends BrkClientBase {
9806
9866
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mempool-transaction-ids)*
9807
9867
  *
9808
9868
  * Endpoint: `GET /api/mempool/txids`
9869
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: Txid[]) => void }} [options]
9809
9870
  * @returns {Promise<Txid[]>}
9810
9871
  */
9811
- async getMempoolTxids() {
9812
- return this.getJson(`/api/mempool/txids`);
9872
+ async getMempoolTxids({ signal, onUpdate } = {}) {
9873
+ return this.getJson(`/api/mempool/txids`, { signal, onUpdate });
9813
9874
  }
9814
9875
 
9815
9876
  /**
@@ -9818,10 +9879,11 @@ class BrkClient extends BrkClientBase {
9818
9879
  * Returns the complete hierarchical catalog of available series organized as a tree structure. Series are grouped by categories and subcategories.
9819
9880
  *
9820
9881
  * Endpoint: `GET /api/series`
9882
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: TreeNode) => void }} [options]
9821
9883
  * @returns {Promise<TreeNode>}
9822
9884
  */
9823
- async getSeriesTree() {
9824
- return this.getJson(`/api/series`);
9885
+ async getSeriesTree({ signal, onUpdate } = {}) {
9886
+ return this.getJson(`/api/series`, { signal, onUpdate });
9825
9887
  }
9826
9888
 
9827
9889
  /**
@@ -9837,9 +9899,10 @@ class BrkClient extends BrkClientBase {
9837
9899
  * @param {RangeIndex=} [end] - Exclusive end: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: `to`, `t`, `e`
9838
9900
  * @param {Limit=} [limit] - Maximum number of values to return (ignored if `end` is set). Aliases: `count`, `c`, `l`
9839
9901
  * @param {Format=} [format] - Format of the output
9902
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: AnySeriesData[] | string) => void }} [options]
9840
9903
  * @returns {Promise<AnySeriesData[] | string>}
9841
9904
  */
9842
- async getSeriesBulk(series, index, start, end, limit, format) {
9905
+ async getSeriesBulk(series, index, start, end, limit, format, { signal, onUpdate } = {}) {
9843
9906
  const params = new URLSearchParams();
9844
9907
  params.set('series', String(series));
9845
9908
  params.set('index', String(index));
@@ -9850,9 +9913,9 @@ class BrkClient extends BrkClientBase {
9850
9913
  const query = params.toString();
9851
9914
  const path = `/api/series/bulk${query ? '?' + query : ''}`;
9852
9915
  if (format === 'csv') {
9853
- return this.getText(path);
9916
+ return this.getText(path, { signal });
9854
9917
  }
9855
- return this.getJson(path);
9918
+ return this.getJson(path, { signal, onUpdate });
9856
9919
  }
9857
9920
 
9858
9921
  /**
@@ -9861,10 +9924,11 @@ class BrkClient extends BrkClientBase {
9861
9924
  * List available cohorts for cost basis distribution.
9862
9925
  *
9863
9926
  * Endpoint: `GET /api/series/cost-basis`
9927
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: string[]) => void }} [options]
9864
9928
  * @returns {Promise<string[]>}
9865
9929
  */
9866
- async getCostBasisCohorts() {
9867
- return this.getJson(`/api/series/cost-basis`);
9930
+ async getCostBasisCohorts({ signal, onUpdate } = {}) {
9931
+ return this.getJson(`/api/series/cost-basis`, { signal, onUpdate });
9868
9932
  }
9869
9933
 
9870
9934
  /**
@@ -9875,10 +9939,11 @@ class BrkClient extends BrkClientBase {
9875
9939
  * Endpoint: `GET /api/series/cost-basis/{cohort}/dates`
9876
9940
  *
9877
9941
  * @param {Cohort} cohort
9942
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: Date[]) => void }} [options]
9878
9943
  * @returns {Promise<Date[]>}
9879
9944
  */
9880
- async getCostBasisDates(cohort) {
9881
- return this.getJson(`/api/series/cost-basis/${cohort}/dates`);
9945
+ async getCostBasisDates(cohort, { signal, onUpdate } = {}) {
9946
+ return this.getJson(`/api/series/cost-basis/${cohort}/dates`, { signal, onUpdate });
9882
9947
  }
9883
9948
 
9884
9949
  /**
@@ -9896,15 +9961,16 @@ class BrkClient extends BrkClientBase {
9896
9961
  * @param {string} date
9897
9962
  * @param {CostBasisBucket=} [bucket] - Bucket type for aggregation. Default: raw (no aggregation).
9898
9963
  * @param {CostBasisValue=} [value] - Value type to return. Default: supply.
9964
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: Object) => void }} [options]
9899
9965
  * @returns {Promise<Object>}
9900
9966
  */
9901
- async getCostBasis(cohort, date, bucket, value) {
9967
+ async getCostBasis(cohort, date, bucket, value, { signal, onUpdate } = {}) {
9902
9968
  const params = new URLSearchParams();
9903
9969
  if (bucket !== undefined) params.set('bucket', String(bucket));
9904
9970
  if (value !== undefined) params.set('value', String(value));
9905
9971
  const query = params.toString();
9906
9972
  const path = `/api/series/cost-basis/${cohort}/${date}${query ? '?' + query : ''}`;
9907
- return this.getJson(path);
9973
+ return this.getJson(path, { signal, onUpdate });
9908
9974
  }
9909
9975
 
9910
9976
  /**
@@ -9913,10 +9979,11 @@ class BrkClient extends BrkClientBase {
9913
9979
  * Returns the number of series available per index type.
9914
9980
  *
9915
9981
  * Endpoint: `GET /api/series/count`
9982
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: SeriesCount[]) => void }} [options]
9916
9983
  * @returns {Promise<SeriesCount[]>}
9917
9984
  */
9918
- async getSeriesCount() {
9919
- return this.getJson(`/api/series/count`);
9985
+ async getSeriesCount({ signal, onUpdate } = {}) {
9986
+ return this.getJson(`/api/series/count`, { signal, onUpdate });
9920
9987
  }
9921
9988
 
9922
9989
  /**
@@ -9925,10 +9992,11 @@ class BrkClient extends BrkClientBase {
9925
9992
  * Returns all available indexes with their accepted query aliases. Use any alias when querying series.
9926
9993
  *
9927
9994
  * Endpoint: `GET /api/series/indexes`
9995
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: IndexInfo[]) => void }} [options]
9928
9996
  * @returns {Promise<IndexInfo[]>}
9929
9997
  */
9930
- async getIndexes() {
9931
- return this.getJson(`/api/series/indexes`);
9998
+ async getIndexes({ signal, onUpdate } = {}) {
9999
+ return this.getJson(`/api/series/indexes`, { signal, onUpdate });
9932
10000
  }
9933
10001
 
9934
10002
  /**
@@ -9940,15 +10008,16 @@ class BrkClient extends BrkClientBase {
9940
10008
  *
9941
10009
  * @param {number=} [page] - Pagination index
9942
10010
  * @param {number=} [per_page] - Results per page (default: 1000, max: 1000)
10011
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: PaginatedSeries) => void }} [options]
9943
10012
  * @returns {Promise<PaginatedSeries>}
9944
10013
  */
9945
- async listSeries(page, per_page) {
10014
+ async listSeries(page, per_page, { signal, onUpdate } = {}) {
9946
10015
  const params = new URLSearchParams();
9947
10016
  if (page !== undefined) params.set('page', String(page));
9948
10017
  if (per_page !== undefined) params.set('per_page', String(per_page));
9949
10018
  const query = params.toString();
9950
10019
  const path = `/api/series/list${query ? '?' + query : ''}`;
9951
- return this.getJson(path);
10020
+ return this.getJson(path, { signal, onUpdate });
9952
10021
  }
9953
10022
 
9954
10023
  /**
@@ -9960,15 +10029,16 @@ class BrkClient extends BrkClientBase {
9960
10029
  *
9961
10030
  * @param {SeriesName} [q] - Search query string
9962
10031
  * @param {Limit=} [limit] - Maximum number of results
10032
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: string[]) => void }} [options]
9963
10033
  * @returns {Promise<string[]>}
9964
10034
  */
9965
- async searchSeries(q, limit) {
10035
+ async searchSeries(q, limit, { signal, onUpdate } = {}) {
9966
10036
  const params = new URLSearchParams();
9967
10037
  params.set('q', String(q));
9968
10038
  if (limit !== undefined) params.set('limit', String(limit));
9969
10039
  const query = params.toString();
9970
10040
  const path = `/api/series/search${query ? '?' + query : ''}`;
9971
- return this.getJson(path);
10041
+ return this.getJson(path, { signal, onUpdate });
9972
10042
  }
9973
10043
 
9974
10044
  /**
@@ -9979,10 +10049,11 @@ class BrkClient extends BrkClientBase {
9979
10049
  * Endpoint: `GET /api/series/{series}`
9980
10050
  *
9981
10051
  * @param {SeriesName} series
10052
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: SeriesInfo) => void }} [options]
9982
10053
  * @returns {Promise<SeriesInfo>}
9983
10054
  */
9984
- async getSeriesInfo(series) {
9985
- return this.getJson(`/api/series/${series}`);
10055
+ async getSeriesInfo(series, { signal, onUpdate } = {}) {
10056
+ return this.getJson(`/api/series/${series}`, { signal, onUpdate });
9986
10057
  }
9987
10058
 
9988
10059
  /**
@@ -9998,9 +10069,10 @@ class BrkClient extends BrkClientBase {
9998
10069
  * @param {RangeIndex=} [end] - Exclusive end: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: `to`, `t`, `e`
9999
10070
  * @param {Limit=} [limit] - Maximum number of values to return (ignored if `end` is set). Aliases: `count`, `c`, `l`
10000
10071
  * @param {Format=} [format] - Format of the output
10072
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: AnySeriesData | string) => void }} [options]
10001
10073
  * @returns {Promise<AnySeriesData | string>}
10002
10074
  */
10003
- async getSeries(series, index, start, end, limit, format) {
10075
+ async getSeries(series, index, start, end, limit, format, { signal, onUpdate } = {}) {
10004
10076
  const params = new URLSearchParams();
10005
10077
  if (start !== undefined) params.set('start', String(start));
10006
10078
  if (end !== undefined) params.set('end', String(end));
@@ -10009,9 +10081,9 @@ class BrkClient extends BrkClientBase {
10009
10081
  const query = params.toString();
10010
10082
  const path = `/api/series/${series}/${index}${query ? '?' + query : ''}`;
10011
10083
  if (format === 'csv') {
10012
- return this.getText(path);
10084
+ return this.getText(path, { signal });
10013
10085
  }
10014
- return this.getJson(path);
10086
+ return this.getJson(path, { signal, onUpdate });
10015
10087
  }
10016
10088
 
10017
10089
  /**
@@ -10027,9 +10099,10 @@ class BrkClient extends BrkClientBase {
10027
10099
  * @param {RangeIndex=} [end] - Exclusive end: integer index, date (YYYY-MM-DD), or timestamp (ISO 8601). Negative integers count from end. Aliases: `to`, `t`, `e`
10028
10100
  * @param {Limit=} [limit] - Maximum number of values to return (ignored if `end` is set). Aliases: `count`, `c`, `l`
10029
10101
  * @param {Format=} [format] - Format of the output
10102
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: boolean[] | string) => void }} [options]
10030
10103
  * @returns {Promise<boolean[] | string>}
10031
10104
  */
10032
- async getSeriesData(series, index, start, end, limit, format) {
10105
+ async getSeriesData(series, index, start, end, limit, format, { signal, onUpdate } = {}) {
10033
10106
  const params = new URLSearchParams();
10034
10107
  if (start !== undefined) params.set('start', String(start));
10035
10108
  if (end !== undefined) params.set('end', String(end));
@@ -10038,9 +10111,9 @@ class BrkClient extends BrkClientBase {
10038
10111
  const query = params.toString();
10039
10112
  const path = `/api/series/${series}/${index}/data${query ? '?' + query : ''}`;
10040
10113
  if (format === 'csv') {
10041
- return this.getText(path);
10114
+ return this.getText(path, { signal });
10042
10115
  }
10043
- return this.getJson(path);
10116
+ return this.getJson(path, { signal, onUpdate });
10044
10117
  }
10045
10118
 
10046
10119
  /**
@@ -10052,10 +10125,11 @@ class BrkClient extends BrkClientBase {
10052
10125
  *
10053
10126
  * @param {SeriesName} series - Series name
10054
10127
  * @param {Index} index - Aggregation index
10128
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: *) => void }} [options]
10055
10129
  * @returns {Promise<*>}
10056
10130
  */
10057
- async getSeriesLatest(series, index) {
10058
- return this.getJson(`/api/series/${series}/${index}/latest`);
10131
+ async getSeriesLatest(series, index, { signal, onUpdate } = {}) {
10132
+ return this.getJson(`/api/series/${series}/${index}/latest`, { signal, onUpdate });
10059
10133
  }
10060
10134
 
10061
10135
  /**
@@ -10067,10 +10141,11 @@ class BrkClient extends BrkClientBase {
10067
10141
  *
10068
10142
  * @param {SeriesName} series - Series name
10069
10143
  * @param {Index} index - Aggregation index
10144
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: number) => void }} [options]
10070
10145
  * @returns {Promise<number>}
10071
10146
  */
10072
- async getSeriesLen(series, index) {
10073
- return this.getJson(`/api/series/${series}/${index}/len`);
10147
+ async getSeriesLen(series, index, { signal, onUpdate } = {}) {
10148
+ return this.getJson(`/api/series/${series}/${index}/len`, { signal, onUpdate });
10074
10149
  }
10075
10150
 
10076
10151
  /**
@@ -10082,10 +10157,11 @@ class BrkClient extends BrkClientBase {
10082
10157
  *
10083
10158
  * @param {SeriesName} series - Series name
10084
10159
  * @param {Index} index - Aggregation index
10160
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: Version) => void }} [options]
10085
10161
  * @returns {Promise<Version>}
10086
10162
  */
10087
- async getSeriesVersion(series, index) {
10088
- return this.getJson(`/api/series/${series}/${index}/version`);
10163
+ async getSeriesVersion(series, index, { signal, onUpdate } = {}) {
10164
+ return this.getJson(`/api/series/${series}/${index}/version`, { signal, onUpdate });
10089
10165
  }
10090
10166
 
10091
10167
  /**
@@ -10094,10 +10170,11 @@ class BrkClient extends BrkClientBase {
10094
10170
  * Returns the disk space used by BRK and Bitcoin data.
10095
10171
  *
10096
10172
  * Endpoint: `GET /api/server/disk`
10173
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: DiskUsage) => void }} [options]
10097
10174
  * @returns {Promise<DiskUsage>}
10098
10175
  */
10099
- async getDiskUsage() {
10100
- return this.getJson(`/api/server/disk`);
10176
+ async getDiskUsage({ signal, onUpdate } = {}) {
10177
+ return this.getJson(`/api/server/disk`, { signal, onUpdate });
10101
10178
  }
10102
10179
 
10103
10180
  /**
@@ -10106,10 +10183,11 @@ class BrkClient extends BrkClientBase {
10106
10183
  * Returns the sync status of the indexer, including indexed height, tip height, blocks behind, and last indexed timestamp.
10107
10184
  *
10108
10185
  * Endpoint: `GET /api/server/sync`
10186
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: SyncStatus) => void }} [options]
10109
10187
  * @returns {Promise<SyncStatus>}
10110
10188
  */
10111
- async getSyncStatus() {
10112
- return this.getJson(`/api/server/sync`);
10189
+ async getSyncStatus({ signal, onUpdate } = {}) {
10190
+ return this.getJson(`/api/server/sync`, { signal, onUpdate });
10113
10191
  }
10114
10192
 
10115
10193
  /**
@@ -10122,10 +10200,11 @@ class BrkClient extends BrkClientBase {
10122
10200
  * Endpoint: `GET /api/tx/{txid}`
10123
10201
  *
10124
10202
  * @param {Txid} txid
10203
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: Transaction) => void }} [options]
10125
10204
  * @returns {Promise<Transaction>}
10126
10205
  */
10127
- async getTx(txid) {
10128
- return this.getJson(`/api/tx/${txid}`);
10206
+ async getTx(txid, { signal, onUpdate } = {}) {
10207
+ return this.getJson(`/api/tx/${txid}`, { signal, onUpdate });
10129
10208
  }
10130
10209
 
10131
10210
  /**
@@ -10138,10 +10217,11 @@ class BrkClient extends BrkClientBase {
10138
10217
  * Endpoint: `GET /api/tx/{txid}/hex`
10139
10218
  *
10140
10219
  * @param {Txid} txid
10220
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: *) => void }} [options]
10141
10221
  * @returns {Promise<*>}
10142
10222
  */
10143
- async getTxHex(txid) {
10144
- return this.getJson(`/api/tx/${txid}/hex`);
10223
+ async getTxHex(txid, { signal, onUpdate } = {}) {
10224
+ return this.getJson(`/api/tx/${txid}/hex`, { signal, onUpdate });
10145
10225
  }
10146
10226
 
10147
10227
  /**
@@ -10154,10 +10234,11 @@ class BrkClient extends BrkClientBase {
10154
10234
  * Endpoint: `GET /api/tx/{txid}/merkle-proof`
10155
10235
  *
10156
10236
  * @param {Txid} txid
10237
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: MerkleProof) => void }} [options]
10157
10238
  * @returns {Promise<MerkleProof>}
10158
10239
  */
10159
- async getTxMerkleProof(txid) {
10160
- return this.getJson(`/api/tx/${txid}/merkle-proof`);
10240
+ async getTxMerkleProof(txid, { signal, onUpdate } = {}) {
10241
+ return this.getJson(`/api/tx/${txid}/merkle-proof`, { signal, onUpdate });
10161
10242
  }
10162
10243
 
10163
10244
  /**
@@ -10170,10 +10251,11 @@ class BrkClient extends BrkClientBase {
10170
10251
  * Endpoint: `GET /api/tx/{txid}/merkleblock-proof`
10171
10252
  *
10172
10253
  * @param {Txid} txid
10254
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: *) => void }} [options]
10173
10255
  * @returns {Promise<*>}
10174
10256
  */
10175
- async getTxMerkleblockProof(txid) {
10176
- return this.getJson(`/api/tx/${txid}/merkleblock-proof`);
10257
+ async getTxMerkleblockProof(txid, { signal, onUpdate } = {}) {
10258
+ return this.getJson(`/api/tx/${txid}/merkleblock-proof`, { signal, onUpdate });
10177
10259
  }
10178
10260
 
10179
10261
  /**
@@ -10187,10 +10269,11 @@ class BrkClient extends BrkClientBase {
10187
10269
  *
10188
10270
  * @param {Txid} txid - Transaction ID
10189
10271
  * @param {Vout} vout - Output index
10272
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: TxOutspend) => void }} [options]
10190
10273
  * @returns {Promise<TxOutspend>}
10191
10274
  */
10192
- async getTxOutspend(txid, vout) {
10193
- return this.getJson(`/api/tx/${txid}/outspend/${vout}`);
10275
+ async getTxOutspend(txid, vout, { signal, onUpdate } = {}) {
10276
+ return this.getJson(`/api/tx/${txid}/outspend/${vout}`, { signal, onUpdate });
10194
10277
  }
10195
10278
 
10196
10279
  /**
@@ -10203,10 +10286,11 @@ class BrkClient extends BrkClientBase {
10203
10286
  * Endpoint: `GET /api/tx/{txid}/outspends`
10204
10287
  *
10205
10288
  * @param {Txid} txid
10289
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: TxOutspend[]) => void }} [options]
10206
10290
  * @returns {Promise<TxOutspend[]>}
10207
10291
  */
10208
- async getTxOutspends(txid) {
10209
- return this.getJson(`/api/tx/${txid}/outspends`);
10292
+ async getTxOutspends(txid, { signal, onUpdate } = {}) {
10293
+ return this.getJson(`/api/tx/${txid}/outspends`, { signal, onUpdate });
10210
10294
  }
10211
10295
 
10212
10296
  /**
@@ -10219,10 +10303,11 @@ class BrkClient extends BrkClientBase {
10219
10303
  * Endpoint: `GET /api/tx/{txid}/raw`
10220
10304
  *
10221
10305
  * @param {Txid} txid
10222
- * @returns {Promise<number[]>}
10306
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: *) => void }} [options]
10307
+ * @returns {Promise<*>}
10223
10308
  */
10224
- async getTxRaw(txid) {
10225
- return this.getJson(`/api/tx/${txid}/raw`);
10309
+ async getTxRaw(txid, { signal, onUpdate } = {}) {
10310
+ return this.getJson(`/api/tx/${txid}/raw`, { signal, onUpdate });
10226
10311
  }
10227
10312
 
10228
10313
  /**
@@ -10235,10 +10320,11 @@ class BrkClient extends BrkClientBase {
10235
10320
  * Endpoint: `GET /api/tx/{txid}/status`
10236
10321
  *
10237
10322
  * @param {Txid} txid
10323
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: TxStatus) => void }} [options]
10238
10324
  * @returns {Promise<TxStatus>}
10239
10325
  */
10240
- async getTxStatus(txid) {
10241
- return this.getJson(`/api/tx/${txid}/status`);
10326
+ async getTxStatus(txid, { signal, onUpdate } = {}) {
10327
+ return this.getJson(`/api/tx/${txid}/status`, { signal, onUpdate });
10242
10328
  }
10243
10329
 
10244
10330
  /**
@@ -10251,10 +10337,11 @@ class BrkClient extends BrkClientBase {
10251
10337
  * Endpoint: `GET /api/v1/block/{hash}`
10252
10338
  *
10253
10339
  * @param {BlockHash} hash
10340
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: BlockInfoV1) => void }} [options]
10254
10341
  * @returns {Promise<BlockInfoV1>}
10255
10342
  */
10256
- async getBlockV1(hash) {
10257
- return this.getJson(`/api/v1/block/${hash}`);
10343
+ async getBlockV1(hash, { signal, onUpdate } = {}) {
10344
+ return this.getJson(`/api/v1/block/${hash}`, { signal, onUpdate });
10258
10345
  }
10259
10346
 
10260
10347
  /**
@@ -10265,10 +10352,11 @@ class BrkClient extends BrkClientBase {
10265
10352
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-blocks-v1)*
10266
10353
  *
10267
10354
  * Endpoint: `GET /api/v1/blocks`
10355
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: BlockInfoV1[]) => void }} [options]
10268
10356
  * @returns {Promise<BlockInfoV1[]>}
10269
10357
  */
10270
- async getBlocksV1() {
10271
- return this.getJson(`/api/v1/blocks`);
10358
+ async getBlocksV1({ signal, onUpdate } = {}) {
10359
+ return this.getJson(`/api/v1/blocks`, { signal, onUpdate });
10272
10360
  }
10273
10361
 
10274
10362
  /**
@@ -10281,26 +10369,28 @@ class BrkClient extends BrkClientBase {
10281
10369
  * Endpoint: `GET /api/v1/blocks/{height}`
10282
10370
  *
10283
10371
  * @param {Height} height
10372
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: BlockInfoV1[]) => void }} [options]
10284
10373
  * @returns {Promise<BlockInfoV1[]>}
10285
10374
  */
10286
- async getBlocksV1FromHeight(height) {
10287
- return this.getJson(`/api/v1/blocks/${height}`);
10375
+ async getBlocksV1FromHeight(height, { signal, onUpdate } = {}) {
10376
+ return this.getJson(`/api/v1/blocks/${height}`, { signal, onUpdate });
10288
10377
  }
10289
10378
 
10290
10379
  /**
10291
10380
  * CPFP info
10292
10381
  *
10293
- * Returns ancestors and descendants for a CPFP transaction.
10382
+ * Returns ancestors and descendants for a CPFP (Child Pays For Parent) transaction, including the effective fee rate of the package.
10294
10383
  *
10295
10384
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-children-pay-for-parent)*
10296
10385
  *
10297
10386
  * Endpoint: `GET /api/v1/cpfp/{txid}`
10298
10387
  *
10299
10388
  * @param {Txid} txid
10389
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: CpfpInfo) => void }} [options]
10300
10390
  * @returns {Promise<CpfpInfo>}
10301
10391
  */
10302
- async getCpfp(txid) {
10303
- return this.getJson(`/api/v1/cpfp/${txid}`);
10392
+ async getCpfp(txid, { signal, onUpdate } = {}) {
10393
+ return this.getJson(`/api/v1/cpfp/${txid}`, { signal, onUpdate });
10304
10394
  }
10305
10395
 
10306
10396
  /**
@@ -10311,10 +10401,11 @@ class BrkClient extends BrkClientBase {
10311
10401
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-difficulty-adjustment)*
10312
10402
  *
10313
10403
  * Endpoint: `GET /api/v1/difficulty-adjustment`
10404
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: DifficultyAdjustment) => void }} [options]
10314
10405
  * @returns {Promise<DifficultyAdjustment>}
10315
10406
  */
10316
- async getDifficultyAdjustment() {
10317
- return this.getJson(`/api/v1/difficulty-adjustment`);
10407
+ async getDifficultyAdjustment({ signal, onUpdate } = {}) {
10408
+ return this.getJson(`/api/v1/difficulty-adjustment`, { signal, onUpdate });
10318
10409
  }
10319
10410
 
10320
10411
  /**
@@ -10325,10 +10416,11 @@ class BrkClient extends BrkClientBase {
10325
10416
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mempool-blocks-fees)*
10326
10417
  *
10327
10418
  * Endpoint: `GET /api/v1/fees/mempool-blocks`
10419
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: MempoolBlock[]) => void }} [options]
10328
10420
  * @returns {Promise<MempoolBlock[]>}
10329
10421
  */
10330
- async getMempoolBlocks() {
10331
- return this.getJson(`/api/v1/fees/mempool-blocks`);
10422
+ async getMempoolBlocks({ signal, onUpdate } = {}) {
10423
+ return this.getJson(`/api/v1/fees/mempool-blocks`, { signal, onUpdate });
10332
10424
  }
10333
10425
 
10334
10426
  /**
@@ -10339,10 +10431,11 @@ class BrkClient extends BrkClientBase {
10339
10431
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-recommended-fees-precise)*
10340
10432
  *
10341
10433
  * Endpoint: `GET /api/v1/fees/precise`
10434
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: RecommendedFees) => void }} [options]
10342
10435
  * @returns {Promise<RecommendedFees>}
10343
10436
  */
10344
- async getPreciseFees() {
10345
- return this.getJson(`/api/v1/fees/precise`);
10437
+ async getPreciseFees({ signal, onUpdate } = {}) {
10438
+ return this.getJson(`/api/v1/fees/precise`, { signal, onUpdate });
10346
10439
  }
10347
10440
 
10348
10441
  /**
@@ -10353,10 +10446,11 @@ class BrkClient extends BrkClientBase {
10353
10446
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-recommended-fees)*
10354
10447
  *
10355
10448
  * Endpoint: `GET /api/v1/fees/recommended`
10449
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: RecommendedFees) => void }} [options]
10356
10450
  * @returns {Promise<RecommendedFees>}
10357
10451
  */
10358
- async getRecommendedFees() {
10359
- return this.getJson(`/api/v1/fees/recommended`);
10452
+ async getRecommendedFees({ signal, onUpdate } = {}) {
10453
+ return this.getJson(`/api/v1/fees/recommended`, { signal, onUpdate });
10360
10454
  }
10361
10455
 
10362
10456
  /**
@@ -10369,78 +10463,83 @@ class BrkClient extends BrkClientBase {
10369
10463
  * Endpoint: `GET /api/v1/historical-price`
10370
10464
  *
10371
10465
  * @param {Timestamp=} [timestamp]
10466
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: HistoricalPrice) => void }} [options]
10372
10467
  * @returns {Promise<HistoricalPrice>}
10373
10468
  */
10374
- async getHistoricalPrice(timestamp) {
10469
+ async getHistoricalPrice(timestamp, { signal, onUpdate } = {}) {
10375
10470
  const params = new URLSearchParams();
10376
10471
  if (timestamp !== undefined) params.set('timestamp', String(timestamp));
10377
10472
  const query = params.toString();
10378
10473
  const path = `/api/v1/historical-price${query ? '?' + query : ''}`;
10379
- return this.getJson(path);
10474
+ return this.getJson(path, { signal, onUpdate });
10380
10475
  }
10381
10476
 
10382
10477
  /**
10383
10478
  * Block fee rates
10384
10479
  *
10385
- * Get block fee rate percentiles (min, 10th, 25th, median, 75th, 90th, max) for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y
10480
+ * Get block fee rate percentiles (min, 10th, 25th, median, 75th, 90th, max) for a time period. Valid periods: `24h`, `3d`, `1w`, `1m`, `3m`, `6m`, `1y`, `2y`, `3y`.
10386
10481
  *
10387
10482
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-feerates)*
10388
10483
  *
10389
10484
  * Endpoint: `GET /api/v1/mining/blocks/fee-rates/{time_period}`
10390
10485
  *
10391
10486
  * @param {TimePeriod} time_period
10487
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: BlockFeeRatesEntry[]) => void }} [options]
10392
10488
  * @returns {Promise<BlockFeeRatesEntry[]>}
10393
10489
  */
10394
- async getBlockFeeRates(time_period) {
10395
- return this.getJson(`/api/v1/mining/blocks/fee-rates/${time_period}`);
10490
+ async getBlockFeeRates(time_period, { signal, onUpdate } = {}) {
10491
+ return this.getJson(`/api/v1/mining/blocks/fee-rates/${time_period}`, { signal, onUpdate });
10396
10492
  }
10397
10493
 
10398
10494
  /**
10399
10495
  * Block fees
10400
10496
  *
10401
- * Get average block fees for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y
10497
+ * Get average total fees per block for a time period. Valid periods: `24h`, `3d`, `1w`, `1m`, `3m`, `6m`, `1y`, `2y`, `3y`.
10402
10498
  *
10403
10499
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-fees)*
10404
10500
  *
10405
10501
  * Endpoint: `GET /api/v1/mining/blocks/fees/{time_period}`
10406
10502
  *
10407
10503
  * @param {TimePeriod} time_period
10504
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: BlockFeesEntry[]) => void }} [options]
10408
10505
  * @returns {Promise<BlockFeesEntry[]>}
10409
10506
  */
10410
- async getBlockFees(time_period) {
10411
- return this.getJson(`/api/v1/mining/blocks/fees/${time_period}`);
10507
+ async getBlockFees(time_period, { signal, onUpdate } = {}) {
10508
+ return this.getJson(`/api/v1/mining/blocks/fees/${time_period}`, { signal, onUpdate });
10412
10509
  }
10413
10510
 
10414
10511
  /**
10415
10512
  * Block rewards
10416
10513
  *
10417
- * Get average block rewards (coinbase = subsidy + fees) for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y
10514
+ * Get average coinbase reward (subsidy + fees) per block for a time period. Valid periods: `24h`, `3d`, `1w`, `1m`, `3m`, `6m`, `1y`, `2y`, `3y`.
10418
10515
  *
10419
10516
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-rewards)*
10420
10517
  *
10421
10518
  * Endpoint: `GET /api/v1/mining/blocks/rewards/{time_period}`
10422
10519
  *
10423
10520
  * @param {TimePeriod} time_period
10521
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: BlockRewardsEntry[]) => void }} [options]
10424
10522
  * @returns {Promise<BlockRewardsEntry[]>}
10425
10523
  */
10426
- async getBlockRewards(time_period) {
10427
- return this.getJson(`/api/v1/mining/blocks/rewards/${time_period}`);
10524
+ async getBlockRewards(time_period, { signal, onUpdate } = {}) {
10525
+ return this.getJson(`/api/v1/mining/blocks/rewards/${time_period}`, { signal, onUpdate });
10428
10526
  }
10429
10527
 
10430
10528
  /**
10431
10529
  * Block sizes and weights
10432
10530
  *
10433
- * Get average block sizes and weights for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y
10531
+ * Get average block sizes and weights for a time period. Valid periods: `24h`, `3d`, `1w`, `1m`, `3m`, `6m`, `1y`, `2y`, `3y`.
10434
10532
  *
10435
10533
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-sizes-weights)*
10436
10534
  *
10437
10535
  * Endpoint: `GET /api/v1/mining/blocks/sizes-weights/{time_period}`
10438
10536
  *
10439
10537
  * @param {TimePeriod} time_period
10538
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: BlockSizesWeights) => void }} [options]
10440
10539
  * @returns {Promise<BlockSizesWeights>}
10441
10540
  */
10442
- async getBlockSizesWeights(time_period) {
10443
- return this.getJson(`/api/v1/mining/blocks/sizes-weights/${time_period}`);
10541
+ async getBlockSizesWeights(time_period, { signal, onUpdate } = {}) {
10542
+ return this.getJson(`/api/v1/mining/blocks/sizes-weights/${time_period}`, { signal, onUpdate });
10444
10543
  }
10445
10544
 
10446
10545
  /**
@@ -10453,10 +10552,11 @@ class BrkClient extends BrkClientBase {
10453
10552
  * Endpoint: `GET /api/v1/mining/blocks/timestamp/{timestamp}`
10454
10553
  *
10455
10554
  * @param {Timestamp} timestamp
10555
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: BlockTimestamp) => void }} [options]
10456
10556
  * @returns {Promise<BlockTimestamp>}
10457
10557
  */
10458
- async getBlockByTimestamp(timestamp) {
10459
- return this.getJson(`/api/v1/mining/blocks/timestamp/${timestamp}`);
10558
+ async getBlockByTimestamp(timestamp, { signal, onUpdate } = {}) {
10559
+ return this.getJson(`/api/v1/mining/blocks/timestamp/${timestamp}`, { signal, onUpdate });
10460
10560
  }
10461
10561
 
10462
10562
  /**
@@ -10467,26 +10567,28 @@ class BrkClient extends BrkClientBase {
10467
10567
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-difficulty-adjustments)*
10468
10568
  *
10469
10569
  * Endpoint: `GET /api/v1/mining/difficulty-adjustments`
10570
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: DifficultyAdjustmentEntry[]) => void }} [options]
10470
10571
  * @returns {Promise<DifficultyAdjustmentEntry[]>}
10471
10572
  */
10472
- async getDifficultyAdjustments() {
10473
- return this.getJson(`/api/v1/mining/difficulty-adjustments`);
10573
+ async getDifficultyAdjustments({ signal, onUpdate } = {}) {
10574
+ return this.getJson(`/api/v1/mining/difficulty-adjustments`, { signal, onUpdate });
10474
10575
  }
10475
10576
 
10476
10577
  /**
10477
10578
  * Difficulty adjustments
10478
10579
  *
10479
- * Get historical difficulty adjustments for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y.
10580
+ * Get historical difficulty adjustments for a time period. Valid periods: `24h`, `3d`, `1w`, `1m`, `3m`, `6m`, `1y`, `2y`, `3y`.
10480
10581
  *
10481
10582
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-difficulty-adjustments)*
10482
10583
  *
10483
10584
  * Endpoint: `GET /api/v1/mining/difficulty-adjustments/{time_period}`
10484
10585
  *
10485
10586
  * @param {TimePeriod} time_period
10587
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: DifficultyAdjustmentEntry[]) => void }} [options]
10486
10588
  * @returns {Promise<DifficultyAdjustmentEntry[]>}
10487
10589
  */
10488
- async getDifficultyAdjustmentsByPeriod(time_period) {
10489
- return this.getJson(`/api/v1/mining/difficulty-adjustments/${time_period}`);
10590
+ async getDifficultyAdjustmentsByPeriod(time_period, { signal, onUpdate } = {}) {
10591
+ return this.getJson(`/api/v1/mining/difficulty-adjustments/${time_period}`, { signal, onUpdate });
10490
10592
  }
10491
10593
 
10492
10594
  /**
@@ -10497,10 +10599,11 @@ class BrkClient extends BrkClientBase {
10497
10599
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-hashrate)*
10498
10600
  *
10499
10601
  * Endpoint: `GET /api/v1/mining/hashrate`
10602
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: HashrateSummary) => void }} [options]
10500
10603
  * @returns {Promise<HashrateSummary>}
10501
10604
  */
10502
- async getHashrate() {
10503
- return this.getJson(`/api/v1/mining/hashrate`);
10605
+ async getHashrate({ signal, onUpdate } = {}) {
10606
+ return this.getJson(`/api/v1/mining/hashrate`, { signal, onUpdate });
10504
10607
  }
10505
10608
 
10506
10609
  /**
@@ -10511,42 +10614,45 @@ class BrkClient extends BrkClientBase {
10511
10614
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pool-hashrates)*
10512
10615
  *
10513
10616
  * Endpoint: `GET /api/v1/mining/hashrate/pools`
10617
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: PoolHashrateEntry[]) => void }} [options]
10514
10618
  * @returns {Promise<PoolHashrateEntry[]>}
10515
10619
  */
10516
- async getPoolsHashrate() {
10517
- return this.getJson(`/api/v1/mining/hashrate/pools`);
10620
+ async getPoolsHashrate({ signal, onUpdate } = {}) {
10621
+ return this.getJson(`/api/v1/mining/hashrate/pools`, { signal, onUpdate });
10518
10622
  }
10519
10623
 
10520
10624
  /**
10521
10625
  * All pools hashrate
10522
10626
  *
10523
- * Get hashrate data for all mining pools for a time period. Valid periods: 1m, 3m, 6m, 1y, 2y, 3y
10627
+ * Get hashrate data for all mining pools for a time period. Valid periods: `1m`, `3m`, `6m`, `1y`, `2y`, `3y`.
10524
10628
  *
10525
10629
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pool-hashrates)*
10526
10630
  *
10527
10631
  * Endpoint: `GET /api/v1/mining/hashrate/pools/{time_period}`
10528
10632
  *
10529
10633
  * @param {TimePeriod} time_period
10634
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: PoolHashrateEntry[]) => void }} [options]
10530
10635
  * @returns {Promise<PoolHashrateEntry[]>}
10531
10636
  */
10532
- async getPoolsHashrateByPeriod(time_period) {
10533
- return this.getJson(`/api/v1/mining/hashrate/pools/${time_period}`);
10637
+ async getPoolsHashrateByPeriod(time_period, { signal, onUpdate } = {}) {
10638
+ return this.getJson(`/api/v1/mining/hashrate/pools/${time_period}`, { signal, onUpdate });
10534
10639
  }
10535
10640
 
10536
10641
  /**
10537
10642
  * Network hashrate
10538
10643
  *
10539
- * Get network hashrate and difficulty data for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y
10644
+ * Get network hashrate and difficulty data for a time period. Valid periods: `24h`, `3d`, `1w`, `1m`, `3m`, `6m`, `1y`, `2y`, `3y`.
10540
10645
  *
10541
10646
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-hashrate)*
10542
10647
  *
10543
10648
  * Endpoint: `GET /api/v1/mining/hashrate/{time_period}`
10544
10649
  *
10545
10650
  * @param {TimePeriod} time_period
10651
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: HashrateSummary) => void }} [options]
10546
10652
  * @returns {Promise<HashrateSummary>}
10547
10653
  */
10548
- async getHashrateByPeriod(time_period) {
10549
- return this.getJson(`/api/v1/mining/hashrate/${time_period}`);
10654
+ async getHashrateByPeriod(time_period, { signal, onUpdate } = {}) {
10655
+ return this.getJson(`/api/v1/mining/hashrate/${time_period}`, { signal, onUpdate });
10550
10656
  }
10551
10657
 
10552
10658
  /**
@@ -10559,10 +10665,11 @@ class BrkClient extends BrkClientBase {
10559
10665
  * Endpoint: `GET /api/v1/mining/pool/{slug}`
10560
10666
  *
10561
10667
  * @param {PoolSlug} slug
10668
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: PoolDetail) => void }} [options]
10562
10669
  * @returns {Promise<PoolDetail>}
10563
10670
  */
10564
- async getPool(slug) {
10565
- return this.getJson(`/api/v1/mining/pool/${slug}`);
10671
+ async getPool(slug, { signal, onUpdate } = {}) {
10672
+ return this.getJson(`/api/v1/mining/pool/${slug}`, { signal, onUpdate });
10566
10673
  }
10567
10674
 
10568
10675
  /**
@@ -10575,10 +10682,11 @@ class BrkClient extends BrkClientBase {
10575
10682
  * Endpoint: `GET /api/v1/mining/pool/{slug}/blocks`
10576
10683
  *
10577
10684
  * @param {PoolSlug} slug
10685
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: BlockInfoV1[]) => void }} [options]
10578
10686
  * @returns {Promise<BlockInfoV1[]>}
10579
10687
  */
10580
- async getPoolBlocks(slug) {
10581
- return this.getJson(`/api/v1/mining/pool/${slug}/blocks`);
10688
+ async getPoolBlocks(slug, { signal, onUpdate } = {}) {
10689
+ return this.getJson(`/api/v1/mining/pool/${slug}/blocks`, { signal, onUpdate });
10582
10690
  }
10583
10691
 
10584
10692
  /**
@@ -10592,10 +10700,11 @@ class BrkClient extends BrkClientBase {
10592
10700
  *
10593
10701
  * @param {PoolSlug} slug
10594
10702
  * @param {Height} height
10703
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: BlockInfoV1[]) => void }} [options]
10595
10704
  * @returns {Promise<BlockInfoV1[]>}
10596
10705
  */
10597
- async getPoolBlocksFrom(slug, height) {
10598
- return this.getJson(`/api/v1/mining/pool/${slug}/blocks/${height}`);
10706
+ async getPoolBlocksFrom(slug, height, { signal, onUpdate } = {}) {
10707
+ return this.getJson(`/api/v1/mining/pool/${slug}/blocks/${height}`, { signal, onUpdate });
10599
10708
  }
10600
10709
 
10601
10710
  /**
@@ -10608,10 +10717,11 @@ class BrkClient extends BrkClientBase {
10608
10717
  * Endpoint: `GET /api/v1/mining/pool/{slug}/hashrate`
10609
10718
  *
10610
10719
  * @param {PoolSlug} slug
10720
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: PoolHashrateEntry[]) => void }} [options]
10611
10721
  * @returns {Promise<PoolHashrateEntry[]>}
10612
10722
  */
10613
- async getPoolHashrate(slug) {
10614
- return this.getJson(`/api/v1/mining/pool/${slug}/hashrate`);
10723
+ async getPoolHashrate(slug, { signal, onUpdate } = {}) {
10724
+ return this.getJson(`/api/v1/mining/pool/${slug}/hashrate`, { signal, onUpdate });
10615
10725
  }
10616
10726
 
10617
10727
  /**
@@ -10622,26 +10732,28 @@ class BrkClient extends BrkClientBase {
10622
10732
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pools)*
10623
10733
  *
10624
10734
  * Endpoint: `GET /api/v1/mining/pools`
10735
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: PoolInfo[]) => void }} [options]
10625
10736
  * @returns {Promise<PoolInfo[]>}
10626
10737
  */
10627
- async getPools() {
10628
- return this.getJson(`/api/v1/mining/pools`);
10738
+ async getPools({ signal, onUpdate } = {}) {
10739
+ return this.getJson(`/api/v1/mining/pools`, { signal, onUpdate });
10629
10740
  }
10630
10741
 
10631
10742
  /**
10632
10743
  * Mining pool statistics
10633
10744
  *
10634
- * Get mining pool statistics for a time period. Valid periods: 24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y
10745
+ * Get mining pool statistics for a time period. Valid periods: `24h`, `3d`, `1w`, `1m`, `3m`, `6m`, `1y`, `2y`, `3y`.
10635
10746
  *
10636
10747
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pools)*
10637
10748
  *
10638
10749
  * Endpoint: `GET /api/v1/mining/pools/{time_period}`
10639
10750
  *
10640
10751
  * @param {TimePeriod} time_period
10752
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: PoolsSummary) => void }} [options]
10641
10753
  * @returns {Promise<PoolsSummary>}
10642
10754
  */
10643
- async getPoolStats(time_period) {
10644
- return this.getJson(`/api/v1/mining/pools/${time_period}`);
10755
+ async getPoolStats(time_period, { signal, onUpdate } = {}) {
10756
+ return this.getJson(`/api/v1/mining/pools/${time_period}`, { signal, onUpdate });
10645
10757
  }
10646
10758
 
10647
10759
  /**
@@ -10654,10 +10766,11 @@ class BrkClient extends BrkClientBase {
10654
10766
  * Endpoint: `GET /api/v1/mining/reward-stats/{block_count}`
10655
10767
  *
10656
10768
  * @param {number} block_count - Number of recent blocks to include
10769
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: RewardStats) => void }} [options]
10657
10770
  * @returns {Promise<RewardStats>}
10658
10771
  */
10659
- async getRewardStats(block_count) {
10660
- return this.getJson(`/api/v1/mining/reward-stats/${block_count}`);
10772
+ async getRewardStats(block_count, { signal, onUpdate } = {}) {
10773
+ return this.getJson(`/api/v1/mining/reward-stats/${block_count}`, { signal, onUpdate });
10661
10774
  }
10662
10775
 
10663
10776
  /**
@@ -10668,10 +10781,11 @@ class BrkClient extends BrkClientBase {
10668
10781
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-price)*
10669
10782
  *
10670
10783
  * Endpoint: `GET /api/v1/prices`
10784
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: Prices) => void }} [options]
10671
10785
  * @returns {Promise<Prices>}
10672
10786
  */
10673
- async getPrices() {
10674
- return this.getJson(`/api/v1/prices`);
10787
+ async getPrices({ signal, onUpdate } = {}) {
10788
+ return this.getJson(`/api/v1/prices`, { signal, onUpdate });
10675
10789
  }
10676
10790
 
10677
10791
  /**
@@ -10682,26 +10796,28 @@ class BrkClient extends BrkClientBase {
10682
10796
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-transaction-times)*
10683
10797
  *
10684
10798
  * Endpoint: `GET /api/v1/transaction-times`
10799
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: number[]) => void }} [options]
10685
10800
  * @returns {Promise<number[]>}
10686
10801
  */
10687
- async getTransactionTimes() {
10688
- return this.getJson(`/api/v1/transaction-times`);
10802
+ async getTransactionTimes({ signal, onUpdate } = {}) {
10803
+ return this.getJson(`/api/v1/transaction-times`, { signal, onUpdate });
10689
10804
  }
10690
10805
 
10691
10806
  /**
10692
10807
  * Validate address
10693
10808
  *
10694
- * Validate a Bitcoin address and get information about its type and scriptPubKey.
10809
+ * Validate a Bitcoin address and get information about its type and scriptPubKey. Returns `isvalid: false` with an error message for invalid addresses.
10695
10810
  *
10696
10811
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-address-validate)*
10697
10812
  *
10698
10813
  * Endpoint: `GET /api/v1/validate-address/{address}`
10699
10814
  *
10700
10815
  * @param {string} address - Bitcoin address to validate (can be any string)
10816
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: AddrValidation) => void }} [options]
10701
10817
  * @returns {Promise<AddrValidation>}
10702
10818
  */
10703
- async validateAddress(address) {
10704
- return this.getJson(`/api/v1/validate-address/${address}`);
10819
+ async validateAddress(address, { signal, onUpdate } = {}) {
10820
+ return this.getJson(`/api/v1/validate-address/${address}`, { signal, onUpdate });
10705
10821
  }
10706
10822
 
10707
10823
  /**
@@ -10710,10 +10826,11 @@ class BrkClient extends BrkClientBase {
10710
10826
  * Returns the health status of the API server, including uptime information.
10711
10827
  *
10712
10828
  * Endpoint: `GET /health`
10829
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: Health) => void }} [options]
10713
10830
  * @returns {Promise<Health>}
10714
10831
  */
10715
- async getHealth() {
10716
- return this.getJson(`/health`);
10832
+ async getHealth({ signal, onUpdate } = {}) {
10833
+ return this.getJson(`/health`, { signal, onUpdate });
10717
10834
  }
10718
10835
 
10719
10836
  /**
@@ -10722,10 +10839,11 @@ class BrkClient extends BrkClientBase {
10722
10839
  * Full OpenAPI 3.1 specification for this API.
10723
10840
  *
10724
10841
  * Endpoint: `GET /openapi.json`
10842
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: *) => void }} [options]
10725
10843
  * @returns {Promise<*>}
10726
10844
  */
10727
- async getOpenapi() {
10728
- return this.getJson(`/openapi.json`);
10845
+ async getOpenapi({ signal, onUpdate } = {}) {
10846
+ return this.getJson(`/openapi.json`, { signal, onUpdate });
10729
10847
  }
10730
10848
 
10731
10849
  /**
@@ -10734,10 +10852,11 @@ class BrkClient extends BrkClientBase {
10734
10852
  * Returns the current version of the API server
10735
10853
  *
10736
10854
  * Endpoint: `GET /version`
10855
+ * @param {{ signal?: AbortSignal, onUpdate?: (value: string) => void }} [options]
10737
10856
  * @returns {Promise<string>}
10738
10857
  */
10739
- async getVersion() {
10740
- return this.getJson(`/version`);
10858
+ async getVersion({ signal, onUpdate } = {}) {
10859
+ return this.getJson(`/version`, { signal, onUpdate });
10741
10860
  }
10742
10861
 
10743
10862
  }