brk-client 0.2.5 → 0.3.0-alpha.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 +597 -82
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -60,6 +60,8 @@
60
60
  * @property {?boolean=} iswitness - Whether this is a witness address
61
61
  * @property {?number=} witnessVersion - Witness version (0 for P2WPKH/P2WSH, 1 for P2TR)
62
62
  * @property {?string=} witnessProgram - Witness program in hex
63
+ * @property {?number[]=} errorLocations - Error locations (empty array for most errors)
64
+ * @property {?string=} error - Error message for invalid addresses
63
65
  */
64
66
  /**
65
67
  * Unified index for any address type (funded or empty)
@@ -107,13 +109,45 @@
107
109
  * @typedef {Object} BlockCountParam
108
110
  * @property {number} blockCount - Number of recent blocks to include
109
111
  */
112
+ /**
113
+ * Extended block data matching mempool.space /api/v1/blocks extras
114
+ *
115
+ * @typedef {Object} BlockExtras
116
+ * @property {Sats} totalFees - Total fees in satoshis
117
+ * @property {FeeRate} medianFee - Median fee rate in sat/vB
118
+ * @property {FeeRate[]} feeRange - Fee rate range: [min, 10%, 25%, 50%, 75%, 90%, max]
119
+ * @property {Sats} reward - Total block reward (subsidy + fees) in satoshis
120
+ * @property {BlockPool} pool - Mining pool that mined this block
121
+ * @property {Sats} avgFee - Average fee per transaction in satoshis
122
+ * @property {FeeRate} avgFeeRate - Average fee rate in sat/vB
123
+ * @property {string} coinbaseRaw - Raw coinbase transaction scriptsig as hex
124
+ * @property {?string=} coinbaseAddress - Primary coinbase output address
125
+ * @property {string[]} coinbaseAddresses - All coinbase output addresses
126
+ * @property {string} coinbaseSignature - Coinbase output script in ASM format
127
+ * @property {string} coinbaseSignatureAscii - Coinbase scriptsig decoded as ASCII
128
+ * @property {number} avgTxSize - Average transaction size in bytes
129
+ * @property {number} totalInputs - Total number of inputs (excluding coinbase)
130
+ * @property {number} totalOutputs - Total number of outputs
131
+ * @property {Sats} totalOutputAmt - Total output amount in satoshis
132
+ * @property {Sats} medianFeeAmt - Median fee amount in satoshis
133
+ * @property {Sats[]} feePercentiles - Fee amount percentiles in satoshis: [min, 10%, 25%, 50%, 75%, 90%, max]
134
+ * @property {number} segwitTotalTxs - Number of segwit transactions
135
+ * @property {number} segwitTotalSize - Total size of segwit transactions in bytes
136
+ * @property {Weight} segwitTotalWeight - Total weight of segwit transactions
137
+ * @property {string} header - Raw 80-byte block header as hex
138
+ * @property {number} utxoSetChange - UTXO set change (outputs created minus inputs spent)
139
+ * @property {number} utxoSetSize - Total UTXO set size at this height
140
+ * @property {Sats} totalInputAmt - Total input amount in satoshis
141
+ * @property {number} virtualSize - Virtual size in vbytes
142
+ */
110
143
  /**
111
144
  * A single block fees data point.
112
145
  *
113
146
  * @typedef {Object} BlockFeesEntry
114
- * @property {Height} avgHeight
115
- * @property {Timestamp} timestamp
116
- * @property {Sats} avgFees
147
+ * @property {Height} avgHeight - Average block height in this window
148
+ * @property {Timestamp} timestamp - Unix timestamp at the window midpoint
149
+ * @property {Sats} avgFees - Average fees per block in this window (sats)
150
+ * @property {Dollars} uSD - BTC/USD price at this height
117
151
  */
118
152
  /**
119
153
  * Block hash
@@ -135,39 +169,74 @@
135
169
  * @property {TxIndex} index - Transaction index within the block (0-based)
136
170
  */
137
171
  /**
138
- * Block information returned by the API
172
+ * Block information matching mempool.space /api/block/{hash}
139
173
  *
140
174
  * @typedef {Object} BlockInfo
141
175
  * @property {BlockHash} id - Block hash
142
176
  * @property {Height} height - Block height
143
- * @property {number} txCount - Number of transactions in the block
177
+ * @property {number} version - Block version
178
+ * @property {Timestamp} timestamp - Block timestamp (Unix time)
179
+ * @property {number} txCount - Number of transactions
144
180
  * @property {number} size - Block size in bytes
145
181
  * @property {Weight} weight - Block weight in weight units
182
+ * @property {string} merkleRoot - Merkle root of the transaction tree
183
+ * @property {BlockHash} previousblockhash - Previous block hash
184
+ * @property {Timestamp} mediantime - Median time of the last 11 blocks
185
+ * @property {number} nonce - Nonce
186
+ * @property {number} bits - Compact target (bits)
187
+ * @property {number} difficulty - Block difficulty
188
+ */
189
+ /**
190
+ * Block information with extras, matching mempool.space /api/v1/blocks
191
+ *
192
+ * @typedef {Object} BlockInfoV1
193
+ * @property {BlockHash} id - Block hash
194
+ * @property {Height} height - Block height
195
+ * @property {number} version - Block version
146
196
  * @property {Timestamp} timestamp - Block timestamp (Unix time)
147
- * @property {number} difficulty - Block difficulty as a floating point number
197
+ * @property {number} txCount - Number of transactions
198
+ * @property {number} size - Block size in bytes
199
+ * @property {Weight} weight - Block weight in weight units
200
+ * @property {string} merkleRoot - Merkle root of the transaction tree
201
+ * @property {BlockHash} previousblockhash - Previous block hash
202
+ * @property {Timestamp} mediantime - Median time of the last 11 blocks
203
+ * @property {number} nonce - Nonce
204
+ * @property {number} bits - Compact target (bits)
205
+ * @property {number} difficulty - Block difficulty
206
+ * @property {BlockExtras} extras - Extended block data
207
+ */
208
+ /**
209
+ * Mining pool identification for a block
210
+ *
211
+ * @typedef {Object} BlockPool
212
+ * @property {number} id - Unique pool identifier
213
+ * @property {string} name - Pool name
214
+ * @property {PoolSlug} slug - URL-friendly pool identifier
215
+ * @property {?string=} minerNames - Alternative miner names (if identified)
148
216
  */
149
217
  /**
150
218
  * A single block rewards data point.
151
219
  *
152
220
  * @typedef {Object} BlockRewardsEntry
153
- * @property {number} avgHeight
154
- * @property {number} timestamp
155
- * @property {number} avgRewards
221
+ * @property {Height} avgHeight - Average block height in this window
222
+ * @property {Timestamp} timestamp - Unix timestamp at the window midpoint
223
+ * @property {Sats} avgRewards - Average coinbase reward per block (subsidy + fees, sats)
224
+ * @property {Dollars} uSD - BTC/USD price at this height
156
225
  */
157
226
  /**
158
227
  * A single block size data point.
159
228
  *
160
229
  * @typedef {Object} BlockSizeEntry
161
- * @property {number} avgHeight
162
- * @property {number} timestamp
163
- * @property {number} avgSize
230
+ * @property {Height} avgHeight - Average block height in this window
231
+ * @property {Timestamp} timestamp - Unix timestamp at the window midpoint
232
+ * @property {number} avgSize - Rolling 24h median block size (bytes)
164
233
  */
165
234
  /**
166
235
  * Combined block sizes and weights response.
167
236
  *
168
237
  * @typedef {Object} BlockSizesWeights
169
- * @property {BlockSizeEntry[]} sizes
170
- * @property {BlockWeightEntry[]} weights
238
+ * @property {BlockSizeEntry[]} sizes - Block size data points
239
+ * @property {BlockWeightEntry[]} weights - Block weight data points
171
240
  */
172
241
  /**
173
242
  * Block status indicating whether block is in the best chain
@@ -175,7 +244,7 @@
175
244
  * @typedef {Object} BlockStatus
176
245
  * @property {boolean} inBestChain - Whether this block is in the best chain
177
246
  * @property {(Height|null)=} height - Block height (only if in best chain)
178
- * @property {(BlockHash|null)=} nextBest - Hash of the next block in the best chain (only if in best chain and not tip)
247
+ * @property {(BlockHash|null)=} nextBest - Hash of the next block in the best chain (null if tip)
179
248
  */
180
249
  /**
181
250
  * Block information returned for timestamp queries
@@ -189,9 +258,9 @@
189
258
  * A single block weight data point.
190
259
  *
191
260
  * @typedef {Object} BlockWeightEntry
192
- * @property {number} avgHeight
193
- * @property {number} timestamp
194
- * @property {number} avgWeight
261
+ * @property {Height} avgHeight - Average block height in this window
262
+ * @property {Timestamp} timestamp - Unix timestamp at the window midpoint
263
+ * @property {Weight} avgWeight - Rolling 24h median block weight (weight units)
195
264
  */
196
265
  /**
197
266
  * Unsigned cents (u64) - for values that should never be negative.
@@ -228,6 +297,17 @@
228
297
  *
229
298
  * @typedef {string} Cohort
230
299
  */
300
+ /**
301
+ * Coinbase scriptSig tag for pool identification.
302
+ *
303
+ * Stored as a fixed 101-byte record (1 byte length + 100 bytes data).
304
+ * Uses `[u8; 101]` internally so that `size_of::<CoinbaseTag>()` matches
305
+ * the serialized `Bytes::Array` size (vecdb requires this for alignment).
306
+ *
307
+ * Bitcoin consensus limits coinbase scriptSig to 2-100 bytes.
308
+ *
309
+ * @typedef {string} CoinbaseTag
310
+ */
231
311
  /**
232
312
  * Bucket type for cost basis aggregation.
233
313
  * Options: raw (no aggregation), lin200/lin500/lin1000 (linear $200/$500/$1000),
@@ -261,6 +341,25 @@
261
341
  *
262
342
  * @typedef {("supply"|"realized"|"unrealized")} CostBasisValue
263
343
  */
344
+ /**
345
+ * A transaction in a CPFP relationship
346
+ *
347
+ * @typedef {Object} CpfpEntry
348
+ * @property {Txid} txid - Transaction ID
349
+ * @property {Weight} weight - Transaction weight
350
+ * @property {Sats} fee - Transaction fee (sats)
351
+ */
352
+ /**
353
+ * CPFP (Child Pays For Parent) information for a transaction
354
+ *
355
+ * @typedef {Object} CpfpInfo
356
+ * @property {CpfpEntry[]} ancestors - Ancestor transactions in the CPFP chain
357
+ * @property {(CpfpEntry|null)=} bestDescendant - Best (highest fee rate) descendant, if any
358
+ * @property {CpfpEntry[]} descendants - Descendant transactions in the CPFP chain
359
+ * @property {FeeRate} effectiveFeePerVsize - Effective fee rate considering CPFP relationships (sat/vB)
360
+ * @property {Sats} fee - Transaction fee (sats)
361
+ * @property {VSize} adjustedVsize - Adjusted virtual size (accounting for sigops)
362
+ */
264
363
  /**
265
364
  * Data range with output format for API query parameters
266
365
  *
@@ -293,32 +392,35 @@
293
392
  * @typedef {Object} DifficultyAdjustment
294
393
  * @property {number} progressPercent - Progress through current difficulty epoch (0-100%)
295
394
  * @property {number} difficultyChange - Estimated difficulty change at next retarget (%)
296
- * @property {number} estimatedRetargetDate - Estimated Unix timestamp of next retarget
395
+ * @property {number} estimatedRetargetDate - Estimated timestamp of next retarget (milliseconds)
297
396
  * @property {number} remainingBlocks - Blocks remaining until retarget
298
- * @property {number} remainingTime - Estimated seconds until retarget
397
+ * @property {number} remainingTime - Estimated time until retarget (milliseconds)
299
398
  * @property {number} previousRetarget - Previous difficulty adjustment (%)
399
+ * @property {Timestamp} previousTime - Timestamp of most recent retarget (seconds)
300
400
  * @property {Height} nextRetargetHeight - Height of next retarget
301
- * @property {number} timeAvg - Average block time in current epoch (seconds)
302
- * @property {number} adjustedTimeAvg - Time-adjusted average (accounting for timestamp manipulation)
401
+ * @property {number} timeAvg - Average block time in current epoch (milliseconds)
402
+ * @property {number} adjustedTimeAvg - Time-adjusted average (milliseconds)
303
403
  * @property {number} timeOffset - Time offset from expected schedule (seconds)
404
+ * @property {number} expectedBlocks - Expected blocks based on wall clock time since epoch start
304
405
  */
305
406
  /**
306
407
  * A single difficulty adjustment entry.
307
408
  * Serializes as array: [timestamp, height, difficulty, change_percent]
308
409
  *
309
410
  * @typedef {Object} DifficultyAdjustmentEntry
310
- * @property {Timestamp} timestamp
311
- * @property {Height} height
312
- * @property {number} difficulty
313
- * @property {number} changePercent
411
+ * @property {Timestamp} timestamp - Unix timestamp of the adjustment
412
+ * @property {Height} height - Block height of the adjustment
413
+ * @property {number} difficulty - Difficulty value
414
+ * @property {number} changePercent - Adjustment ratio (new/previous, e.g. 1.068 = +6.8%)
314
415
  */
315
416
  /**
316
- * A single difficulty data point.
417
+ * A single difficulty data point in the hashrate summary.
317
418
  *
318
419
  * @typedef {Object} DifficultyEntry
319
- * @property {Timestamp} timestamp - Unix timestamp of the difficulty adjustment.
320
- * @property {number} difficulty - Difficulty value.
321
- * @property {Height} height - Block height of the adjustment.
420
+ * @property {Timestamp} time - Unix timestamp of the difficulty adjustment
421
+ * @property {Height} height - Block height of the adjustment
422
+ * @property {number} difficulty - Difficulty value
423
+ * @property {number} adjustment - Adjustment ratio (new/previous, e.g. 1.068 = +6.8%)
322
424
  */
323
425
  /**
324
426
  * Disk usage of the indexed data
@@ -357,6 +459,11 @@
357
459
  * @property {string} message - Human-readable description
358
460
  * @property {string} docUrl - Link to API documentation
359
461
  */
462
+ /**
463
+ * Exchange rates (USD base, on-chain only — no fiat pairs available)
464
+ *
465
+ * @typedef {Object} ExchangeRates
466
+ */
360
467
  /**
361
468
  * Fee rate in sats/vB
362
469
  *
@@ -401,10 +508,10 @@
401
508
  * Server health status
402
509
  *
403
510
  * @typedef {Object} Health
404
- * @property {string} status
405
- * @property {string} service
406
- * @property {string} version
407
- * @property {string} timestamp
511
+ * @property {string} status - Health status ("healthy")
512
+ * @property {string} service - Service name
513
+ * @property {string} version - Server version
514
+ * @property {string} timestamp - Current server time (ISO 8601)
408
515
  * @property {string} startedAt - Server start time (ISO 8601)
409
516
  * @property {number} uptimeSeconds - Uptime in seconds
410
517
  * @property {Height} indexedHeight - Height of the last indexed block
@@ -424,14 +531,23 @@
424
531
  * @property {Height} height
425
532
  */
426
533
  /**
427
- * Hex-encoded string
534
+ * Highest price value for a time period
428
535
  *
429
- * @typedef {string} Hex
536
+ * @typedef {Dollars} High
430
537
  */
431
538
  /**
432
- * Highest price value for a time period
539
+ * Historical price response
433
540
  *
434
- * @typedef {Dollars} High
541
+ * @typedef {Object} HistoricalPrice
542
+ * @property {HistoricalPriceEntry[]} prices - Price data points
543
+ * @property {ExchangeRates} exchangeRates - Exchange rates (currently empty)
544
+ */
545
+ /**
546
+ * A single price data point
547
+ *
548
+ * @typedef {Object} HistoricalPriceEntry
549
+ * @property {number} time - Unix timestamp
550
+ * @property {Dollars} uSD - BTC/USD price
435
551
  */
436
552
  /** @typedef {number} Hour1 */
437
553
  /** @typedef {number} Hour12 */
@@ -484,12 +600,30 @@
484
600
  * @property {FeeRate[]} feeRange - Fee rate range: [min, 10%, 25%, 50%, 75%, 90%, max]
485
601
  */
486
602
  /**
487
- * Mempool statistics
603
+ * Mempool statistics with incrementally maintained fee histogram.
488
604
  *
489
605
  * @typedef {Object} MempoolInfo
490
606
  * @property {number} count - Number of transactions in the mempool
491
607
  * @property {VSize} vsize - Total virtual size of all transactions in the mempool (vbytes)
492
608
  * @property {Sats} totalFee - Total fees of all transactions in the mempool (satoshis)
609
+ * @property {{ [key: string]: VSize }} feeHistogram - Fee histogram: `[[fee_rate, vsize], ...]` sorted by descending fee rate
610
+ */
611
+ /**
612
+ * Simplified mempool transaction for the `/api/mempool/recent` endpoint.
613
+ *
614
+ * @typedef {Object} MempoolRecentTx
615
+ * @property {Txid} txid - Transaction ID
616
+ * @property {Sats} fee - Transaction fee (sats)
617
+ * @property {VSize} vsize - Virtual size (vbytes)
618
+ * @property {Sats} value - Total output value (sats)
619
+ */
620
+ /**
621
+ * Merkle inclusion proof for a transaction
622
+ *
623
+ * @typedef {Object} MerkleProof
624
+ * @property {Height} blockHeight - Block height containing the transaction
625
+ * @property {string[]} merkle - Merkle proof path (hex-encoded hashes)
626
+ * @property {number} pos - Transaction position in the block
493
627
  */
494
628
  /** @typedef {number} Minute10 */
495
629
  /** @typedef {number} Minute30 */
@@ -529,6 +663,10 @@
529
663
  *
530
664
  * @typedef {Dollars} Open
531
665
  */
666
+ /**
667
+ * @typedef {Object} OptionalTimestampParam
668
+ * @property {(Timestamp|null)=} timestamp
669
+ */
532
670
  /** @typedef {number} OutPoint */
533
671
  /**
534
672
  * Type (P2PKH, P2WPKH, P2SH, P2TR, etc.)
@@ -600,12 +738,22 @@
600
738
  * Pool information for detail view
601
739
  *
602
740
  * @typedef {Object} PoolDetailInfo
603
- * @property {number} id - Unique pool identifier
741
+ * @property {number} id - Pool identifier
604
742
  * @property {string} name - Pool name
605
743
  * @property {string} link - Pool website URL
606
- * @property {string[]} addrs - Known payout addresses
744
+ * @property {string[]} addresses - Known payout addresses
607
745
  * @property {string[]} regexes - Coinbase tag patterns (regexes)
608
746
  * @property {PoolSlug} slug - URL-friendly pool identifier
747
+ * @property {number} uniqueId - Unique pool identifier
748
+ */
749
+ /**
750
+ * A single pool hashrate data point.
751
+ *
752
+ * @typedef {Object} PoolHashrateEntry
753
+ * @property {Timestamp} timestamp - Unix timestamp.
754
+ * @property {number} avgHashrate - Average hashrate (H/s).
755
+ * @property {number} share - Pool's share of total network hashrate.
756
+ * @property {string} poolName - Pool name.
609
757
  */
610
758
  /**
611
759
  * Basic pool information for listing all pools
@@ -615,7 +763,12 @@
615
763
  * @property {PoolSlug} slug - URL-friendly pool identifier
616
764
  * @property {number} uniqueId - Unique numeric pool identifier
617
765
  */
618
- /** @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")} PoolSlug */
766
+ /** @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 */
767
+ /**
768
+ * @typedef {Object} PoolSlugAndHeightParam
769
+ * @property {PoolSlug} slug
770
+ * @property {Height} height
771
+ */
619
772
  /**
620
773
  * @typedef {Object} PoolSlugParam
621
774
  * @property {PoolSlug} slug
@@ -632,6 +785,7 @@
632
785
  * @property {number} emptyBlocks - Number of empty blocks mined
633
786
  * @property {PoolSlug} slug - URL-friendly pool identifier
634
787
  * @property {number} share - Pool's share of total blocks (0.0 - 1.0)
788
+ * @property {number} poolUniqueId - Unique pool identifier
635
789
  */
636
790
  /**
637
791
  * Mining pools response for a time period
@@ -640,6 +794,15 @@
640
794
  * @property {PoolStats[]} pools - List of pools sorted by block count descending
641
795
  * @property {number} blockCount - Total blocks in the time period
642
796
  * @property {number} lastEstimatedHashrate - Estimated network hashrate (hashes per second)
797
+ * @property {number} lastEstimatedHashrate3d - Estimated network hashrate over last 3 days
798
+ * @property {number} lastEstimatedHashrate1w - Estimated network hashrate over last 1 week
799
+ */
800
+ /**
801
+ * Current price response matching mempool.space /api/v1/prices format
802
+ *
803
+ * @typedef {Object} Prices
804
+ * @property {Timestamp} time - Unix timestamp
805
+ * @property {Dollars} uSD - BTC/USD price
643
806
  */
644
807
  /**
645
808
  * A range boundary: integer index, date, or timestamp.
@@ -667,9 +830,9 @@
667
830
  * @typedef {Object} RewardStats
668
831
  * @property {Height} startBlock - First block in the range
669
832
  * @property {Height} endBlock - Last block in the range
670
- * @property {Sats} totalReward
671
- * @property {Sats} totalFee
672
- * @property {number} totalTx
833
+ * @property {Sats} totalReward - Total coinbase rewards (subsidy + fees) in sats
834
+ * @property {Sats} totalFee - Total transaction fees in sats
835
+ * @property {number} totalTx - Total number of transactions
673
836
  */
674
837
  /**
675
838
  * Satoshis
@@ -836,17 +999,17 @@
836
999
  * Transaction information compatible with mempool.space API format
837
1000
  *
838
1001
  * @typedef {Object} Transaction
839
- * @property {(TxIndex|null)=} index
840
- * @property {Txid} txid
841
- * @property {TxVersion} version
842
- * @property {RawLockTime} locktime
1002
+ * @property {(TxIndex|null)=} index - Internal transaction index (brk-specific, not in mempool.space)
1003
+ * @property {Txid} txid - Transaction ID
1004
+ * @property {TxVersion} version - Transaction version
1005
+ * @property {RawLockTime} locktime - Transaction lock time
1006
+ * @property {TxIn[]} vin - Transaction inputs
1007
+ * @property {TxOut[]} vout - Transaction outputs
843
1008
  * @property {number} size - Transaction size in bytes
844
1009
  * @property {Weight} weight - Transaction weight
845
1010
  * @property {number} sigops - Number of signature operations
846
1011
  * @property {Sats} fee - Transaction fee in satoshis
847
- * @property {TxIn[]} vin - Transaction inputs
848
- * @property {TxOut[]} vout - Transaction outputs
849
- * @property {TxStatus} status
1012
+ * @property {TxStatus} status - Confirmation status (confirmed, block height/hash/time)
850
1013
  */
851
1014
  /**
852
1015
  * Hierarchical tree node for organizing series into categories
@@ -858,13 +1021,15 @@
858
1021
  *
859
1022
  * @typedef {Object} TxIn
860
1023
  * @property {Txid} txid - Transaction ID of the output being spent
861
- * @property {Vout} vout
1024
+ * @property {Vout} vout - Output index being spent
862
1025
  * @property {(TxOut|null)=} prevout - Information about the previous output being spent
863
- * @property {string} scriptsig - Signature script (for non-SegWit inputs)
1026
+ * @property {string} scriptsig - Signature script (hex, for non-SegWit inputs)
864
1027
  * @property {string} scriptsigAsm - Signature script in assembly format
1028
+ * @property {string[]} witness - Witness data (hex-encoded stack items, present for SegWit inputs)
865
1029
  * @property {boolean} isCoinbase - Whether this input is a coinbase (block reward) input
866
1030
  * @property {number} sequence - Input sequence number
867
- * @property {?string=} innerRedeemscriptAsm - Inner redeemscript in assembly format (for P2SH-wrapped SegWit)
1031
+ * @property {string} innerRedeemscriptAsm - Inner redeemscript in assembly (for P2SH-wrapped SegWit: scriptsig + witness both present)
1032
+ * @property {string} innerWitnessscriptAsm - Inner witnessscript in assembly (for P2WSH: last witness item decoded as script)
868
1033
  */
869
1034
  /** @typedef {number} TxInIndex */
870
1035
  /** @typedef {number} TxIndex */
@@ -930,10 +1095,10 @@
930
1095
  * Unspent transaction output
931
1096
  *
932
1097
  * @typedef {Object} Utxo
933
- * @property {Txid} txid
934
- * @property {Vout} vout
935
- * @property {TxStatus} status
936
- * @property {Sats} value
1098
+ * @property {Txid} txid - Transaction ID of the UTXO
1099
+ * @property {Vout} vout - Output index
1100
+ * @property {TxStatus} status - Confirmation status
1101
+ * @property {Sats} value - Output value in satoshis
937
1102
  */
938
1103
  /**
939
1104
  * Virtual size in vbytes (weight / 4, rounded up)
@@ -982,6 +1147,20 @@
982
1147
  const _isBrowser = typeof window !== 'undefined' && 'caches' in window;
983
1148
  const _runIdle = (/** @type {VoidFunction} */ fn) => (globalThis.requestIdleCallback ?? setTimeout)(fn);
984
1149
  const _defaultCacheName = '__BRK_CLIENT__';
1150
+ /** @param {*} v */
1151
+ const _addCamelGetters = (v) => {
1152
+ if (Array.isArray(v)) { v.forEach(_addCamelGetters); return v; }
1153
+ if (v && typeof v === 'object' && v.constructor === Object) {
1154
+ for (const k in v) {
1155
+ if (k.includes('_')) {
1156
+ const c = k.replace(/_([a-z])/g, (_, l) => l.toUpperCase());
1157
+ if (!(c in v)) Object.defineProperty(v, c, { get() { return this[k]; } });
1158
+ }
1159
+ _addCamelGetters(v[k]);
1160
+ }
1161
+ }
1162
+ return v;
1163
+ };
985
1164
 
986
1165
  /**
987
1166
  * @param {string|boolean|undefined} cache
@@ -1378,7 +1557,7 @@ class BrkClientBase {
1378
1557
  const cachePromise = cache?.match(url).then(async (res) => {
1379
1558
  cachedRes = res ?? null;
1380
1559
  if (!res) return null;
1381
- const json = await res.json();
1560
+ const json = _addCamelGetters(await res.json());
1382
1561
  if (!resolved && onUpdate) {
1383
1562
  resolved = true;
1384
1563
  onUpdate(json);
@@ -1388,7 +1567,7 @@ class BrkClientBase {
1388
1567
 
1389
1568
  const networkPromise = this.get(path).then(async (res) => {
1390
1569
  const cloned = res.clone();
1391
- const json = await res.json();
1570
+ const json = _addCamelGetters(await res.json());
1392
1571
  // Skip update if ETag matches and cache already delivered
1393
1572
  if (cachedRes?.headers.get('ETag') === res.headers.get('ETag')) {
1394
1573
  if (!resolved && onUpdate) {
@@ -4145,7 +4324,6 @@ function createTransferPattern(client, acc) {
4145
4324
  * @property {SeriesTree_Addrs} addrs
4146
4325
  * @property {SeriesTree_Scripts} scripts
4147
4326
  * @property {SeriesTree_Mining} mining
4148
- * @property {SeriesTree_Positions} positions
4149
4327
  * @property {SeriesTree_Cointime} cointime
4150
4328
  * @property {SeriesTree_Constants} constants
4151
4329
  * @property {SeriesTree_Indexes} indexes
@@ -4161,10 +4339,14 @@ function createTransferPattern(client, acc) {
4161
4339
  /**
4162
4340
  * @typedef {Object} SeriesTree_Blocks
4163
4341
  * @property {SeriesPattern18<BlockHash>} blockhash
4342
+ * @property {SeriesPattern18<CoinbaseTag>} coinbaseTag
4164
4343
  * @property {SeriesTree_Blocks_Difficulty} difficulty
4165
4344
  * @property {SeriesTree_Blocks_Time} time
4166
4345
  * @property {SeriesTree_Blocks_Size} size
4167
4346
  * @property {AverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern<Weight>} weight
4347
+ * @property {SeriesPattern18<StoredU32>} segwitTxs
4348
+ * @property {SeriesPattern18<StoredU64>} segwitSize
4349
+ * @property {SeriesPattern18<Weight>} segwitWeight
4168
4350
  * @property {SeriesTree_Blocks_Count} count
4169
4351
  * @property {SeriesTree_Blocks_Lookback} lookback
4170
4352
  * @property {SeriesTree_Blocks_Interval} interval
@@ -4328,6 +4510,7 @@ function createTransferPattern(client, acc) {
4328
4510
  * @property {SeriesPattern19<Sats>} outputValue
4329
4511
  * @property {_6bBlockTxPattern<Sats>} fee
4330
4512
  * @property {_6bBlockTxPattern<FeeRate>} feeRate
4513
+ * @property {_6bBlockTxPattern<FeeRate>} effectiveFeeRate
4331
4514
  */
4332
4515
 
4333
4516
  /**
@@ -4597,6 +4780,7 @@ function createTransferPattern(client, acc) {
4597
4780
  * @property {AverageBlockCumulativeSumPattern3} coinbase
4598
4781
  * @property {SeriesTree_Mining_Rewards_Subsidy} subsidy
4599
4782
  * @property {SeriesTree_Mining_Rewards_Fees} fees
4783
+ * @property {SeriesPattern18<Sats>} outputVolume
4600
4784
  * @property {BlockCumulativePattern} unclaimed
4601
4785
  */
4602
4786
 
@@ -4657,10 +4841,6 @@ function createTransferPattern(client, acc) {
4657
4841
  * @property {SeriesPattern1<StoredF64>} _1y
4658
4842
  */
4659
4843
 
4660
- /**
4661
- * @typedef {Object} SeriesTree_Positions
4662
- */
4663
-
4664
4844
  /**
4665
4845
  * @typedef {Object} SeriesTree_Cointime
4666
4846
  * @property {SeriesTree_Cointime_Activity} activity
@@ -5518,6 +5698,8 @@ function createTransferPattern(client, acc) {
5518
5698
  * @property {BlocksDominancePattern} parasite
5519
5699
  * @property {BlocksDominancePattern} redrockpool
5520
5700
  * @property {BlocksDominancePattern} est3lar
5701
+ * @property {BlocksDominancePattern} braiinssolo
5702
+ * @property {BlocksDominancePattern} solopool
5521
5703
  */
5522
5704
 
5523
5705
  /**
@@ -6381,7 +6563,7 @@ function createTransferPattern(client, acc) {
6381
6563
  * @extends BrkClientBase
6382
6564
  */
6383
6565
  class BrkClient extends BrkClientBase {
6384
- VERSION = "v0.2.5";
6566
+ VERSION = "v0.3.0-alpha.1";
6385
6567
 
6386
6568
  INDEXES = /** @type {const} */ ([
6387
6569
  "minute10",
@@ -6581,7 +6763,9 @@ class BrkClient extends BrkClientBase {
6581
6763
  "btclab": "BTCLab",
6582
6764
  "parasite": "Parasite",
6583
6765
  "redrockpool": "RedRock Pool",
6584
- "est3lar": "Est3lar"
6766
+ "est3lar": "Est3lar",
6767
+ "braiinssolo": "Braiins Solo",
6768
+ "solopool": "SoloPool.com"
6585
6769
  });
6586
6770
 
6587
6771
  TERM_NAMES = /** @type {const} */ ({
@@ -7572,6 +7756,7 @@ class BrkClient extends BrkClientBase {
7572
7756
  return {
7573
7757
  blocks: {
7574
7758
  blockhash: createSeriesPattern18(this, 'blockhash'),
7759
+ coinbaseTag: createSeriesPattern18(this, 'coinbase_tag'),
7575
7760
  difficulty: {
7576
7761
  value: createSeriesPattern1(this, 'difficulty'),
7577
7762
  hashrate: createSeriesPattern1(this, 'difficulty_hashrate'),
@@ -7597,6 +7782,9 @@ class BrkClient extends BrkClientBase {
7597
7782
  pct90: create_1m1w1y24hPattern(this, 'block_size_pct90'),
7598
7783
  },
7599
7784
  weight: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern(this, 'block_weight'),
7785
+ segwitTxs: createSeriesPattern18(this, 'segwit_txs'),
7786
+ segwitSize: createSeriesPattern18(this, 'segwit_size'),
7787
+ segwitWeight: createSeriesPattern18(this, 'segwit_weight'),
7600
7788
  count: {
7601
7789
  target: create_1m1w1y24hPattern(this, 'block_count_target'),
7602
7790
  total: createAverageBlockCumulativeSumPattern2(this, 'block_count'),
@@ -7695,6 +7883,7 @@ class BrkClient extends BrkClientBase {
7695
7883
  outputValue: createSeriesPattern19(this, 'output_value'),
7696
7884
  fee: create_6bBlockTxPattern(this, 'fee'),
7697
7885
  feeRate: create_6bBlockTxPattern(this, 'fee_rate'),
7886
+ effectiveFeeRate: create_6bBlockTxPattern(this, 'effective_fee_rate'),
7698
7887
  },
7699
7888
  versions: {
7700
7889
  v1: createAverageBlockCumulativeSumPattern(this, 'tx_v1'),
@@ -7893,6 +8082,7 @@ class BrkClient extends BrkClientBase {
7893
8082
  _1y: createBpsRatioPattern2(this, 'fee_to_subsidy_ratio_1y'),
7894
8083
  },
7895
8084
  },
8085
+ outputVolume: createSeriesPattern18(this, 'output_volume'),
7896
8086
  unclaimed: createBlockCumulativePattern(this, 'unclaimed_rewards'),
7897
8087
  },
7898
8088
  hashrate: {
@@ -7911,8 +8101,6 @@ class BrkClient extends BrkClientBase {
7911
8101
  value: createPhsReboundThsPattern(this, 'hash_value'),
7912
8102
  },
7913
8103
  },
7914
- positions: {
7915
- },
7916
8104
  cointime: {
7917
8105
  activity: {
7918
8106
  coinblocksCreated: createAverageBlockCumulativeSumPattern(this, 'coinblocks_created'),
@@ -8543,6 +8731,8 @@ class BrkClient extends BrkClientBase {
8543
8731
  parasite: createBlocksDominancePattern(this, 'parasite'),
8544
8732
  redrockpool: createBlocksDominancePattern(this, 'redrockpool'),
8545
8733
  est3lar: createBlocksDominancePattern(this, 'est3lar'),
8734
+ braiinssolo: createBlocksDominancePattern(this, 'braiinssolo'),
8735
+ solopool: createBlocksDominancePattern(this, 'solopool'),
8546
8736
  },
8547
8737
  },
8548
8738
  prices: {
@@ -9338,16 +9528,16 @@ class BrkClient extends BrkClientBase {
9338
9528
  }
9339
9529
 
9340
9530
  /**
9341
- * Block by height
9531
+ * Block hash by height
9342
9532
  *
9343
- * Retrieve block information by block height. Returns block metadata including hash, timestamp, difficulty, size, weight, and transaction count.
9533
+ * Retrieve the block hash at a given height. Returns the hash as plain text.
9344
9534
  *
9345
9535
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-height)*
9346
9536
  *
9347
9537
  * Endpoint: `GET /api/block-height/{height}`
9348
9538
  *
9349
9539
  * @param {Height} height
9350
- * @returns {Promise<BlockInfo>}
9540
+ * @returns {Promise<*>}
9351
9541
  */
9352
9542
  async getBlockByHeight(height) {
9353
9543
  return this.getJson(`/api/block-height/${height}`);
@@ -9369,6 +9559,22 @@ class BrkClient extends BrkClientBase {
9369
9559
  return this.getJson(`/api/block/${hash}`);
9370
9560
  }
9371
9561
 
9562
+ /**
9563
+ * Block header
9564
+ *
9565
+ * Returns the hex-encoded block header.
9566
+ *
9567
+ * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-header)*
9568
+ *
9569
+ * Endpoint: `GET /api/block/{hash}/header`
9570
+ *
9571
+ * @param {BlockHash} hash
9572
+ * @returns {Promise<*>}
9573
+ */
9574
+ async getBlockHeader(hash) {
9575
+ return this.getJson(`/api/block/${hash}/header`);
9576
+ }
9577
+
9372
9578
  /**
9373
9579
  * Raw block
9374
9580
  *
@@ -9412,7 +9618,7 @@ class BrkClient extends BrkClientBase {
9412
9618
  *
9413
9619
  * @param {BlockHash} hash - Bitcoin block hash
9414
9620
  * @param {TxIndex} index - Transaction index within the block (0-based)
9415
- * @returns {Promise<Txid>}
9621
+ * @returns {Promise<*>}
9416
9622
  */
9417
9623
  async getBlockTxid(hash, index) {
9418
9624
  return this.getJson(`/api/block/${hash}/txid/${index}`);
@@ -9434,6 +9640,22 @@ class BrkClient extends BrkClientBase {
9434
9640
  return this.getJson(`/api/block/${hash}/txids`);
9435
9641
  }
9436
9642
 
9643
+ /**
9644
+ * Block transactions
9645
+ *
9646
+ * Retrieve transactions in a block by block hash. Returns up to 25 transactions starting from index 0.
9647
+ *
9648
+ * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-transactions)*
9649
+ *
9650
+ * Endpoint: `GET /api/block/{hash}/txs`
9651
+ *
9652
+ * @param {BlockHash} hash
9653
+ * @returns {Promise<Transaction[]>}
9654
+ */
9655
+ async getBlockTxs(hash) {
9656
+ return this.getJson(`/api/block/${hash}/txs`);
9657
+ }
9658
+
9437
9659
  /**
9438
9660
  * Block transactions (paginated)
9439
9661
  *
@@ -9447,7 +9669,7 @@ class BrkClient extends BrkClientBase {
9447
9669
  * @param {TxIndex} start_index - Starting transaction index within the block (0-based)
9448
9670
  * @returns {Promise<Transaction[]>}
9449
9671
  */
9450
- async getBlockTxs(hash, start_index) {
9672
+ async getBlockTxsFromIndex(hash, start_index) {
9451
9673
  return this.getJson(`/api/block/${hash}/txs/${start_index}`);
9452
9674
  }
9453
9675
 
@@ -9465,6 +9687,34 @@ class BrkClient extends BrkClientBase {
9465
9687
  return this.getJson(`/api/blocks`);
9466
9688
  }
9467
9689
 
9690
+ /**
9691
+ * Block tip hash
9692
+ *
9693
+ * Returns the hash of the last block.
9694
+ *
9695
+ * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-tip-hash)*
9696
+ *
9697
+ * Endpoint: `GET /api/blocks/tip/hash`
9698
+ * @returns {Promise<*>}
9699
+ */
9700
+ async getBlockTipHash() {
9701
+ return this.getJson(`/api/blocks/tip/hash`);
9702
+ }
9703
+
9704
+ /**
9705
+ * Block tip height
9706
+ *
9707
+ * Returns the height of the last block.
9708
+ *
9709
+ * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-tip-height)*
9710
+ *
9711
+ * Endpoint: `GET /api/blocks/tip/height`
9712
+ * @returns {Promise<*>}
9713
+ */
9714
+ async getBlockTipHeight() {
9715
+ return this.getJson(`/api/blocks/tip/height`);
9716
+ }
9717
+
9468
9718
  /**
9469
9719
  * Blocks from height
9470
9720
  *
@@ -9484,15 +9734,15 @@ class BrkClient extends BrkClientBase {
9484
9734
  /**
9485
9735
  * Mempool statistics
9486
9736
  *
9487
- * Get current mempool statistics including transaction count, total vsize, and total fees.
9737
+ * Get current mempool statistics including transaction count, total vsize, total fees, and fee histogram.
9488
9738
  *
9489
9739
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mempool)*
9490
9740
  *
9491
- * Endpoint: `GET /api/mempool/info`
9741
+ * Endpoint: `GET /api/mempool`
9492
9742
  * @returns {Promise<MempoolInfo>}
9493
9743
  */
9494
9744
  async getMempool() {
9495
- return this.getJson(`/api/mempool/info`);
9745
+ return this.getJson(`/api/mempool`);
9496
9746
  }
9497
9747
 
9498
9748
  /**
@@ -9507,6 +9757,20 @@ class BrkClient extends BrkClientBase {
9507
9757
  return this.getJson(`/api/mempool/price`);
9508
9758
  }
9509
9759
 
9760
+ /**
9761
+ * Recent mempool transactions
9762
+ *
9763
+ * Get the last 10 transactions to enter the mempool.
9764
+ *
9765
+ * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mempool-recent)*
9766
+ *
9767
+ * Endpoint: `GET /api/mempool/recent`
9768
+ * @returns {Promise<MempoolRecentTx[]>}
9769
+ */
9770
+ async getMempoolRecent() {
9771
+ return this.getJson(`/api/mempool/recent`);
9772
+ }
9773
+
9510
9774
  /**
9511
9775
  * Mempool transaction IDs
9512
9776
  *
@@ -9847,12 +10111,44 @@ class BrkClient extends BrkClientBase {
9847
10111
  * Endpoint: `GET /api/tx/{txid}/hex`
9848
10112
  *
9849
10113
  * @param {Txid} txid
9850
- * @returns {Promise<Hex>}
10114
+ * @returns {Promise<*>}
9851
10115
  */
9852
10116
  async getTxHex(txid) {
9853
10117
  return this.getJson(`/api/tx/${txid}/hex`);
9854
10118
  }
9855
10119
 
10120
+ /**
10121
+ * Transaction merkle proof
10122
+ *
10123
+ * Get the merkle inclusion proof for a transaction.
10124
+ *
10125
+ * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-transaction-merkle-proof)*
10126
+ *
10127
+ * Endpoint: `GET /api/tx/{txid}/merkle-proof`
10128
+ *
10129
+ * @param {Txid} txid
10130
+ * @returns {Promise<MerkleProof>}
10131
+ */
10132
+ async getTxMerkleProof(txid) {
10133
+ return this.getJson(`/api/tx/${txid}/merkle-proof`);
10134
+ }
10135
+
10136
+ /**
10137
+ * Transaction merkleblock proof
10138
+ *
10139
+ * Get the merkleblock proof for a transaction (BIP37 format, hex encoded).
10140
+ *
10141
+ * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-transaction-merkleblock-proof)*
10142
+ *
10143
+ * Endpoint: `GET /api/tx/{txid}/merkleblock-proof`
10144
+ *
10145
+ * @param {Txid} txid
10146
+ * @returns {Promise<*>}
10147
+ */
10148
+ async getTxMerkleblockProof(txid) {
10149
+ return this.getJson(`/api/tx/${txid}/merkleblock-proof`);
10150
+ }
10151
+
9856
10152
  /**
9857
10153
  * Output spend status
9858
10154
  *
@@ -9886,6 +10182,22 @@ class BrkClient extends BrkClientBase {
9886
10182
  return this.getJson(`/api/tx/${txid}/outspends`);
9887
10183
  }
9888
10184
 
10185
+ /**
10186
+ * Transaction raw
10187
+ *
10188
+ * Returns a transaction as binary data.
10189
+ *
10190
+ * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-transaction-raw)*
10191
+ *
10192
+ * Endpoint: `GET /api/tx/{txid}/raw`
10193
+ *
10194
+ * @param {Txid} txid
10195
+ * @returns {Promise<number[]>}
10196
+ */
10197
+ async getTxRaw(txid) {
10198
+ return this.getJson(`/api/tx/${txid}/raw`);
10199
+ }
10200
+
9889
10201
  /**
9890
10202
  * Transaction status
9891
10203
  *
@@ -9902,10 +10214,72 @@ class BrkClient extends BrkClientBase {
9902
10214
  return this.getJson(`/api/tx/${txid}/status`);
9903
10215
  }
9904
10216
 
10217
+ /**
10218
+ * Block (v1)
10219
+ *
10220
+ * Returns block details with extras by hash.
10221
+ *
10222
+ * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-v1)*
10223
+ *
10224
+ * Endpoint: `GET /api/v1/block/{hash}`
10225
+ *
10226
+ * @param {BlockHash} hash
10227
+ * @returns {Promise<BlockInfoV1>}
10228
+ */
10229
+ async getBlockV1(hash) {
10230
+ return this.getJson(`/api/v1/block/${hash}`);
10231
+ }
10232
+
10233
+ /**
10234
+ * Recent blocks with extras
10235
+ *
10236
+ * Retrieve the last 10 blocks with extended data including pool identification and fee statistics.
10237
+ *
10238
+ * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-blocks-v1)*
10239
+ *
10240
+ * Endpoint: `GET /api/v1/blocks`
10241
+ * @returns {Promise<BlockInfoV1[]>}
10242
+ */
10243
+ async getBlocksV1() {
10244
+ return this.getJson(`/api/v1/blocks`);
10245
+ }
10246
+
10247
+ /**
10248
+ * Blocks from height with extras
10249
+ *
10250
+ * Retrieve up to 10 blocks with extended data going backwards from the given height.
10251
+ *
10252
+ * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-blocks-v1)*
10253
+ *
10254
+ * Endpoint: `GET /api/v1/blocks/{height}`
10255
+ *
10256
+ * @param {Height} height
10257
+ * @returns {Promise<BlockInfoV1[]>}
10258
+ */
10259
+ async getBlocksV1FromHeight(height) {
10260
+ return this.getJson(`/api/v1/blocks/${height}`);
10261
+ }
10262
+
10263
+ /**
10264
+ * CPFP info
10265
+ *
10266
+ * Returns ancestors and descendants for a CPFP transaction.
10267
+ *
10268
+ * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-children-pay-for-parent)*
10269
+ *
10270
+ * Endpoint: `GET /api/v1/cpfp/{txid}`
10271
+ *
10272
+ * @param {Txid} txid
10273
+ * @returns {Promise<CpfpInfo>}
10274
+ */
10275
+ async getCpfp(txid) {
10276
+ return this.getJson(`/api/v1/cpfp/${txid}`);
10277
+ }
10278
+
9905
10279
  /**
9906
10280
  * Difficulty adjustment
9907
10281
  *
9908
- * Get current difficulty adjustment information including progress through the current epoch, estimated retarget date, and difficulty change prediction.
10282
+ * Get current difficulty adjustment progress and estimates.
9909
10283
  *
9910
10284
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-difficulty-adjustment)*
9911
10285
  *
@@ -9919,7 +10293,7 @@ class BrkClient extends BrkClientBase {
9919
10293
  /**
9920
10294
  * Projected mempool blocks
9921
10295
  *
9922
- * Get projected blocks from the mempool for fee estimation. Each block contains statistics about transactions that would be included if a block were mined now.
10296
+ * Get projected blocks from the mempool for fee estimation.
9923
10297
  *
9924
10298
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mempool-blocks-fees)*
9925
10299
  *
@@ -9930,10 +10304,24 @@ class BrkClient extends BrkClientBase {
9930
10304
  return this.getJson(`/api/v1/fees/mempool-blocks`);
9931
10305
  }
9932
10306
 
10307
+ /**
10308
+ * Precise recommended fees
10309
+ *
10310
+ * Get recommended fee rates with up to 3 decimal places.
10311
+ *
10312
+ * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-recommended-fees-precise)*
10313
+ *
10314
+ * Endpoint: `GET /api/v1/fees/precise`
10315
+ * @returns {Promise<RecommendedFees>}
10316
+ */
10317
+ async getPreciseFees() {
10318
+ return this.getJson(`/api/v1/fees/precise`);
10319
+ }
10320
+
9933
10321
  /**
9934
10322
  * Recommended fees
9935
10323
  *
9936
- * Get recommended fee rates for different confirmation targets based on current mempool state.
10324
+ * Get recommended fee rates for different confirmation targets.
9937
10325
  *
9938
10326
  * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-recommended-fees)*
9939
10327
  *
@@ -9944,6 +10332,26 @@ class BrkClient extends BrkClientBase {
9944
10332
  return this.getJson(`/api/v1/fees/recommended`);
9945
10333
  }
9946
10334
 
10335
+ /**
10336
+ * Historical price
10337
+ *
10338
+ * Get historical BTC/USD price. Optionally specify a UNIX timestamp to get the price at that time.
10339
+ *
10340
+ * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-historical-price)*
10341
+ *
10342
+ * Endpoint: `GET /api/v1/historical-price`
10343
+ *
10344
+ * @param {Timestamp=} [timestamp]
10345
+ * @returns {Promise<HistoricalPrice>}
10346
+ */
10347
+ async getHistoricalPrice(timestamp) {
10348
+ const params = new URLSearchParams();
10349
+ if (timestamp !== undefined) params.set('timestamp', String(timestamp));
10350
+ const query = params.toString();
10351
+ const path = `/api/v1/historical-price${query ? '?' + query : ''}`;
10352
+ return this.getJson(path);
10353
+ }
10354
+
9947
10355
  /**
9948
10356
  * Block fee rates (WIP)
9949
10357
  *
@@ -10068,6 +10476,36 @@ class BrkClient extends BrkClientBase {
10068
10476
  return this.getJson(`/api/v1/mining/hashrate`);
10069
10477
  }
10070
10478
 
10479
+ /**
10480
+ * All pools hashrate (all time)
10481
+ *
10482
+ * Get hashrate data for all mining pools.
10483
+ *
10484
+ * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pool-hashrates)*
10485
+ *
10486
+ * Endpoint: `GET /api/v1/mining/hashrate/pools`
10487
+ * @returns {Promise<PoolHashrateEntry[]>}
10488
+ */
10489
+ async getPoolsHashrate() {
10490
+ return this.getJson(`/api/v1/mining/hashrate/pools`);
10491
+ }
10492
+
10493
+ /**
10494
+ * All pools hashrate
10495
+ *
10496
+ * Get hashrate data for all mining pools for a time period. Valid periods: 1m, 3m, 6m, 1y, 2y, 3y
10497
+ *
10498
+ * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pool-hashrates)*
10499
+ *
10500
+ * Endpoint: `GET /api/v1/mining/hashrate/pools/{time_period}`
10501
+ *
10502
+ * @param {TimePeriod} time_period
10503
+ * @returns {Promise<PoolHashrateEntry[]>}
10504
+ */
10505
+ async getPoolsHashrateByPeriod(time_period) {
10506
+ return this.getJson(`/api/v1/mining/hashrate/pools/${time_period}`);
10507
+ }
10508
+
10071
10509
  /**
10072
10510
  * Network hashrate
10073
10511
  *
@@ -10100,6 +10538,55 @@ class BrkClient extends BrkClientBase {
10100
10538
  return this.getJson(`/api/v1/mining/pool/${slug}`);
10101
10539
  }
10102
10540
 
10541
+ /**
10542
+ * Mining pool blocks
10543
+ *
10544
+ * Get the 10 most recent blocks mined by a specific pool.
10545
+ *
10546
+ * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pool-blocks)*
10547
+ *
10548
+ * Endpoint: `GET /api/v1/mining/pool/{slug}/blocks`
10549
+ *
10550
+ * @param {PoolSlug} slug
10551
+ * @returns {Promise<BlockInfoV1[]>}
10552
+ */
10553
+ async getPoolBlocks(slug) {
10554
+ return this.getJson(`/api/v1/mining/pool/${slug}/blocks`);
10555
+ }
10556
+
10557
+ /**
10558
+ * Mining pool blocks from height
10559
+ *
10560
+ * Get 10 blocks mined by a specific pool before (and including) the given height.
10561
+ *
10562
+ * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pool-blocks)*
10563
+ *
10564
+ * Endpoint: `GET /api/v1/mining/pool/{slug}/blocks/{height}`
10565
+ *
10566
+ * @param {PoolSlug} slug
10567
+ * @param {Height} height
10568
+ * @returns {Promise<BlockInfoV1[]>}
10569
+ */
10570
+ async getPoolBlocksFrom(slug, height) {
10571
+ return this.getJson(`/api/v1/mining/pool/${slug}/blocks/${height}`);
10572
+ }
10573
+
10574
+ /**
10575
+ * Mining pool hashrate
10576
+ *
10577
+ * Get hashrate history for a specific mining pool.
10578
+ *
10579
+ * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pool-hashrate)*
10580
+ *
10581
+ * Endpoint: `GET /api/v1/mining/pool/{slug}/hashrate`
10582
+ *
10583
+ * @param {PoolSlug} slug
10584
+ * @returns {Promise<PoolHashrateEntry[]>}
10585
+ */
10586
+ async getPoolHashrate(slug) {
10587
+ return this.getJson(`/api/v1/mining/pool/${slug}/hashrate`);
10588
+ }
10589
+
10103
10590
  /**
10104
10591
  * List all mining pools
10105
10592
  *
@@ -10146,6 +10633,34 @@ class BrkClient extends BrkClientBase {
10146
10633
  return this.getJson(`/api/v1/mining/reward-stats/${block_count}`);
10147
10634
  }
10148
10635
 
10636
+ /**
10637
+ * Current BTC price
10638
+ *
10639
+ * Returns bitcoin latest price (on-chain derived, USD only).
10640
+ *
10641
+ * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-price)*
10642
+ *
10643
+ * Endpoint: `GET /api/v1/prices`
10644
+ * @returns {Promise<Prices>}
10645
+ */
10646
+ async getPrices() {
10647
+ return this.getJson(`/api/v1/prices`);
10648
+ }
10649
+
10650
+ /**
10651
+ * Transaction first-seen times
10652
+ *
10653
+ * Returns timestamps when transactions were first seen in the mempool. Returns 0 for mined or unknown transactions.
10654
+ *
10655
+ * *[Mempool.space docs](https://mempool.space/docs/api/rest#get-transaction-times)*
10656
+ *
10657
+ * Endpoint: `GET /api/v1/transaction-times`
10658
+ * @returns {Promise<number[]>}
10659
+ */
10660
+ async getTransactionTimes() {
10661
+ return this.getJson(`/api/v1/transaction-times`);
10662
+ }
10663
+
10149
10664
  /**
10150
10665
  * Validate address
10151
10666
  *
package/package.json CHANGED
@@ -40,5 +40,5 @@
40
40
  "url": "git+https://github.com/bitcoinresearchkit/brk.git"
41
41
  },
42
42
  "type": "module",
43
- "version": "0.2.5"
43
+ "version": "0.3.0-alpha.1"
44
44
  }