brk-client 0.3.0-alpha.5 → 0.3.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +358 -222
- 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
|
*/
|
|
@@ -135,14 +141,30 @@
|
|
|
135
141
|
* @property {number} segwitTotalSize - Total size of segwit transactions in bytes
|
|
136
142
|
* @property {Weight} segwitTotalWeight - Total weight of segwit transactions
|
|
137
143
|
* @property {string} header - Raw 80-byte block header as hex
|
|
138
|
-
* @property {number} utxoSetChange - UTXO set change (outputs
|
|
139
|
-
|
|
144
|
+
* @property {number} utxoSetChange - UTXO set change (total outputs - total inputs, includes unspendable like OP_RETURN).
|
|
145
|
+
Note: intentionally differs from utxo_set_size diff which excludes unspendable outputs.
|
|
146
|
+
Matches mempool.space/bitcoin-cli behavior.
|
|
147
|
+
* @property {number} utxoSetSize - Total spendable UTXO set size at this height (excludes OP_RETURN and other unspendable outputs)
|
|
140
148
|
* @property {Sats} totalInputAmt - Total input amount in satoshis
|
|
141
149
|
* @property {number} virtualSize - Virtual size in vbytes
|
|
142
150
|
* @property {?number=} firstSeen - Timestamp when the block was first seen (always null, not yet supported)
|
|
143
151
|
* @property {string[]} orphans - Orphaned blocks (always empty)
|
|
144
152
|
* @property {Dollars} price - USD price at block height
|
|
145
153
|
*/
|
|
154
|
+
/**
|
|
155
|
+
* A single block fee rates data point with percentiles.
|
|
156
|
+
*
|
|
157
|
+
* @typedef {Object} BlockFeeRatesEntry
|
|
158
|
+
* @property {Height} avgHeight - Average block height in this window
|
|
159
|
+
* @property {Timestamp} timestamp - Unix timestamp at the window midpoint
|
|
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)
|
|
167
|
+
*/
|
|
146
168
|
/**
|
|
147
169
|
* A single block fees data point.
|
|
148
170
|
*
|
|
@@ -158,15 +180,21 @@
|
|
|
158
180
|
* @typedef {string} BlockHash
|
|
159
181
|
*/
|
|
160
182
|
/**
|
|
183
|
+
* Block hash path parameter
|
|
184
|
+
*
|
|
161
185
|
* @typedef {Object} BlockHashParam
|
|
162
186
|
* @property {BlockHash} hash
|
|
163
187
|
*/
|
|
164
188
|
/**
|
|
189
|
+
* Block hash + starting transaction index path parameters
|
|
190
|
+
*
|
|
165
191
|
* @typedef {Object} BlockHashStartIndex
|
|
166
192
|
* @property {BlockHash} hash - Bitcoin block hash
|
|
167
193
|
* @property {TxIndex} startIndex - Starting transaction index within the block (0-based)
|
|
168
194
|
*/
|
|
169
195
|
/**
|
|
196
|
+
* Block hash + transaction index path parameters
|
|
197
|
+
*
|
|
170
198
|
* @typedef {Object} BlockHashTxIndex
|
|
171
199
|
* @property {BlockHash} hash - Bitcoin block hash
|
|
172
200
|
* @property {TxIndex} index - Transaction index within the block (0-based)
|
|
@@ -359,9 +387,9 @@
|
|
|
359
387
|
* @property {CpfpEntry[]} ancestors - Ancestor transactions in the CPFP chain
|
|
360
388
|
* @property {(CpfpEntry|null)=} bestDescendant - Best (highest fee rate) descendant, if any
|
|
361
389
|
* @property {CpfpEntry[]} descendants - Descendant transactions in the CPFP chain
|
|
362
|
-
* @property {FeeRate} effectiveFeePerVsize - Effective fee rate considering CPFP relationships (sat/vB)
|
|
363
|
-
* @property {Sats} fee - Transaction fee (sats)
|
|
364
|
-
* @property {VSize} adjustedVsize - Adjusted virtual size (accounting for sigops)
|
|
390
|
+
* @property {(FeeRate|null)=} effectiveFeePerVsize - Effective fee rate considering CPFP relationships (sat/vB)
|
|
391
|
+
* @property {(Sats|null)=} fee - Transaction fee (sats)
|
|
392
|
+
* @property {(VSize|null)=} adjustedVsize - Adjusted virtual size (accounting for sigops)
|
|
365
393
|
*/
|
|
366
394
|
/**
|
|
367
395
|
* Data range with output format for API query parameters
|
|
@@ -436,7 +464,7 @@
|
|
|
436
464
|
* @property {number} ratio - brk as percentage of Bitcoin data
|
|
437
465
|
*/
|
|
438
466
|
/**
|
|
439
|
-
* US Dollar amount
|
|
467
|
+
* US Dollar amount
|
|
440
468
|
*
|
|
441
469
|
* @typedef {number} Dollars
|
|
442
470
|
*/
|
|
@@ -468,7 +496,7 @@
|
|
|
468
496
|
* @typedef {Object} ExchangeRates
|
|
469
497
|
*/
|
|
470
498
|
/**
|
|
471
|
-
* Fee rate in
|
|
499
|
+
* Fee rate in sat/vB
|
|
472
500
|
*
|
|
473
501
|
* @typedef {number} FeeRate
|
|
474
502
|
*/
|
|
@@ -495,17 +523,17 @@
|
|
|
495
523
|
* A single hashrate data point.
|
|
496
524
|
*
|
|
497
525
|
* @typedef {Object} HashrateEntry
|
|
498
|
-
* @property {Timestamp} timestamp - Unix timestamp
|
|
499
|
-
* @property {number} avgHashrate - Average hashrate (H/s)
|
|
526
|
+
* @property {Timestamp} timestamp - Unix timestamp
|
|
527
|
+
* @property {number} avgHashrate - Average hashrate (H/s)
|
|
500
528
|
*/
|
|
501
529
|
/**
|
|
502
530
|
* Summary of network hashrate and difficulty data.
|
|
503
531
|
*
|
|
504
532
|
* @typedef {Object} HashrateSummary
|
|
505
|
-
* @property {HashrateEntry[]} hashrates - Historical hashrate data points
|
|
506
|
-
* @property {DifficultyEntry[]} difficulty - Historical difficulty adjustments
|
|
507
|
-
* @property {number} currentHashrate - Current network hashrate (H/s)
|
|
508
|
-
* @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
|
|
509
537
|
*/
|
|
510
538
|
/**
|
|
511
539
|
* Server health status
|
|
@@ -530,6 +558,8 @@
|
|
|
530
558
|
* @typedef {number} Height
|
|
531
559
|
*/
|
|
532
560
|
/**
|
|
561
|
+
* Block height path parameter
|
|
562
|
+
*
|
|
533
563
|
* @typedef {Object} HeightParam
|
|
534
564
|
* @property {Height} height
|
|
535
565
|
*/
|
|
@@ -549,7 +579,7 @@
|
|
|
549
579
|
* A single price data point
|
|
550
580
|
*
|
|
551
581
|
* @typedef {Object} HistoricalPriceEntry
|
|
552
|
-
* @property {
|
|
582
|
+
* @property {Timestamp} time - Unix timestamp
|
|
553
583
|
* @property {Dollars} uSD - BTC/USD price
|
|
554
584
|
*/
|
|
555
585
|
/** @typedef {number} Hour1 */
|
|
@@ -626,7 +656,7 @@
|
|
|
626
656
|
* @typedef {Object} MerkleProof
|
|
627
657
|
* @property {Height} blockHeight - Block height containing the transaction
|
|
628
658
|
* @property {string[]} merkle - Merkle proof path (hex-encoded hashes)
|
|
629
|
-
* @property {number} pos - Transaction position in the block
|
|
659
|
+
* @property {number} pos - Transaction position in the block (0-indexed)
|
|
630
660
|
*/
|
|
631
661
|
/** @typedef {number} Minute10 */
|
|
632
662
|
/** @typedef {number} Minute30 */
|
|
@@ -667,6 +697,8 @@
|
|
|
667
697
|
* @typedef {Dollars} Open
|
|
668
698
|
*/
|
|
669
699
|
/**
|
|
700
|
+
* Optional UNIX timestamp query parameter
|
|
701
|
+
*
|
|
670
702
|
* @typedef {Object} OptionalTimestampParam
|
|
671
703
|
* @property {(Timestamp|null)=} timestamp
|
|
672
704
|
*/
|
|
@@ -724,8 +756,8 @@
|
|
|
724
756
|
*
|
|
725
757
|
* @typedef {Object} PoolBlockShares
|
|
726
758
|
* @property {number} all - Share of all blocks (0.0 - 1.0)
|
|
727
|
-
* @property {number} _24h - Share of blocks in last 24 hours
|
|
728
|
-
* @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)
|
|
729
761
|
*/
|
|
730
762
|
/**
|
|
731
763
|
* Detailed pool information with statistics across time periods
|
|
@@ -734,8 +766,9 @@
|
|
|
734
766
|
* @property {PoolDetailInfo} pool - Pool information
|
|
735
767
|
* @property {PoolBlockCounts} blockCount - Block counts for different time periods
|
|
736
768
|
* @property {PoolBlockShares} blockShare - Pool's share of total blocks for different time periods
|
|
737
|
-
* @property {number} estimatedHashrate - Estimated hashrate based on blocks mined
|
|
738
|
-
* @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)
|
|
771
|
+
* @property {(Sats|null)=} totalReward - Total reward earned by this pool (sats, all time; None for minor pools)
|
|
739
772
|
*/
|
|
740
773
|
/**
|
|
741
774
|
* Pool information for detail view
|
|
@@ -753,10 +786,10 @@
|
|
|
753
786
|
* A single pool hashrate data point.
|
|
754
787
|
*
|
|
755
788
|
* @typedef {Object} PoolHashrateEntry
|
|
756
|
-
* @property {Timestamp} timestamp - Unix timestamp
|
|
757
|
-
* @property {number} avgHashrate - Average hashrate (H/s)
|
|
758
|
-
* @property {number} share - Pool's share of total network hashrate.
|
|
759
|
-
* @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
|
|
760
793
|
*/
|
|
761
794
|
/**
|
|
762
795
|
* Basic pool information for listing all pools
|
|
@@ -766,13 +799,21 @@
|
|
|
766
799
|
* @property {PoolSlug} slug - URL-friendly pool identifier
|
|
767
800
|
* @property {number} uniqueId - Unique numeric pool identifier
|
|
768
801
|
*/
|
|
769
|
-
/** @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 */
|
|
770
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
|
+
*
|
|
771
810
|
* @typedef {Object} PoolSlugAndHeightParam
|
|
772
811
|
* @property {PoolSlug} slug
|
|
773
812
|
* @property {Height} height
|
|
774
813
|
*/
|
|
775
814
|
/**
|
|
815
|
+
* Mining pool slug path parameter
|
|
816
|
+
*
|
|
776
817
|
* @typedef {Object} PoolSlugParam
|
|
777
818
|
* @property {PoolSlug} slug
|
|
778
819
|
*/
|
|
@@ -796,9 +837,9 @@
|
|
|
796
837
|
* @typedef {Object} PoolsSummary
|
|
797
838
|
* @property {PoolStats[]} pools - List of pools sorted by block count descending
|
|
798
839
|
* @property {number} blockCount - Total blocks in the time period
|
|
799
|
-
* @property {number} lastEstimatedHashrate - Estimated network hashrate (
|
|
800
|
-
* @property {number} lastEstimatedHashrate3d - Estimated network hashrate over last 3 days
|
|
801
|
-
* @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)
|
|
802
843
|
*/
|
|
803
844
|
/**
|
|
804
845
|
* Current price response matching mempool.space /api/v1/prices format
|
|
@@ -813,7 +854,7 @@
|
|
|
813
854
|
* @typedef {(number|Date|Timestamp)} RangeIndex
|
|
814
855
|
*/
|
|
815
856
|
/**
|
|
816
|
-
* Transaction locktime
|
|
857
|
+
* Transaction locktime. Values below 500,000,000 are interpreted as block heights; values at or above are Unix timestamps.
|
|
817
858
|
*
|
|
818
859
|
* @typedef {number} RawLockTime
|
|
819
860
|
*/
|
|
@@ -838,7 +879,7 @@
|
|
|
838
879
|
* @property {number} totalTx - Total number of transactions
|
|
839
880
|
*/
|
|
840
881
|
/**
|
|
841
|
-
*
|
|
882
|
+
* Amount in satoshis (1 BTC = 100,000,000 sats)
|
|
842
883
|
*
|
|
843
884
|
* @typedef {number} Sats
|
|
844
885
|
*/
|
|
@@ -983,9 +1024,11 @@
|
|
|
983
1024
|
* Used to specify the lookback window for pool statistics, hashrate calculations,
|
|
984
1025
|
* and other time-based mining series.
|
|
985
1026
|
*
|
|
986
|
-
* @typedef {("24h"|"3d"|"1w"|"1m"|"3m"|"6m"|"1y"|"2y"|"3y")} TimePeriod
|
|
1027
|
+
* @typedef {("24h"|"3d"|"1w"|"1m"|"3m"|"6m"|"1y"|"2y"|"3y"|"all")} TimePeriod
|
|
987
1028
|
*/
|
|
988
1029
|
/**
|
|
1030
|
+
* Time period path parameter (24h, 3d, 1w, 1m, 3m, 6m, 1y, 2y, 3y)
|
|
1031
|
+
*
|
|
989
1032
|
* @typedef {Object} TimePeriodParam
|
|
990
1033
|
* @property {TimePeriod} timePeriod
|
|
991
1034
|
*/
|
|
@@ -995,6 +1038,8 @@
|
|
|
995
1038
|
* @typedef {number} Timestamp
|
|
996
1039
|
*/
|
|
997
1040
|
/**
|
|
1041
|
+
* UNIX timestamp path parameter
|
|
1042
|
+
*
|
|
998
1043
|
* @typedef {Object} TimestampParam
|
|
999
1044
|
* @property {Timestamp} timestamp
|
|
1000
1045
|
*/
|
|
@@ -1035,7 +1080,11 @@
|
|
|
1035
1080
|
* @property {string} innerWitnessscriptAsm - Inner witnessscript in assembly (for P2WSH: last witness item decoded as script)
|
|
1036
1081
|
*/
|
|
1037
1082
|
/** @typedef {number} TxInIndex */
|
|
1038
|
-
/**
|
|
1083
|
+
/**
|
|
1084
|
+
* Transaction index within a block (0 = coinbase)
|
|
1085
|
+
*
|
|
1086
|
+
* @typedef {number} TxIndex
|
|
1087
|
+
*/
|
|
1039
1088
|
/**
|
|
1040
1089
|
* Transaction output
|
|
1041
1090
|
*
|
|
@@ -1080,6 +1129,8 @@
|
|
|
1080
1129
|
* @typedef {string} Txid
|
|
1081
1130
|
*/
|
|
1082
1131
|
/**
|
|
1132
|
+
* Transaction ID path parameter
|
|
1133
|
+
*
|
|
1083
1134
|
* @typedef {Object} TxidParam
|
|
1084
1135
|
* @property {Txid} txid
|
|
1085
1136
|
*/
|
|
@@ -1111,7 +1162,7 @@
|
|
|
1111
1162
|
* @property {Sats} value - Output value in satoshis
|
|
1112
1163
|
*/
|
|
1113
1164
|
/**
|
|
1114
|
-
* 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.
|
|
1115
1166
|
*
|
|
1116
1167
|
* @typedef {number} VSize
|
|
1117
1168
|
*/
|
|
@@ -1140,7 +1191,7 @@
|
|
|
1140
1191
|
*/
|
|
1141
1192
|
/** @typedef {number} Week1 */
|
|
1142
1193
|
/**
|
|
1143
|
-
*
|
|
1194
|
+
* Weight in weight units (WU). Max block weight is 4,000,000 WU.
|
|
1144
1195
|
*
|
|
1145
1196
|
* @typedef {number} Weight
|
|
1146
1197
|
*/
|
|
@@ -1539,11 +1590,14 @@ class BrkClientBase {
|
|
|
1539
1590
|
|
|
1540
1591
|
/**
|
|
1541
1592
|
* @param {string} path
|
|
1593
|
+
* @param {{ signal?: AbortSignal }} [options]
|
|
1542
1594
|
* @returns {Promise<Response>}
|
|
1543
1595
|
*/
|
|
1544
|
-
async get(path) {
|
|
1596
|
+
async get(path, { signal } = {}) {
|
|
1545
1597
|
const url = `${this.baseUrl}${path}`;
|
|
1546
|
-
const
|
|
1598
|
+
const signals = [AbortSignal.timeout(this.timeout)];
|
|
1599
|
+
if (signal) signals.push(signal);
|
|
1600
|
+
const res = await fetch(url, { signal: AbortSignal.any(signals) });
|
|
1547
1601
|
if (!res.ok) throw new BrkError(`HTTP ${res.status}: ${url}`, res.status);
|
|
1548
1602
|
return res;
|
|
1549
1603
|
}
|
|
@@ -1552,10 +1606,10 @@ class BrkClientBase {
|
|
|
1552
1606
|
* Make a GET request - races cache vs network, first to resolve calls onUpdate
|
|
1553
1607
|
* @template T
|
|
1554
1608
|
* @param {string} path
|
|
1555
|
-
* @param {(value: T) => void} [
|
|
1609
|
+
* @param {{ onUpdate?: (value: T) => void, signal?: AbortSignal }} [options]
|
|
1556
1610
|
* @returns {Promise<T>}
|
|
1557
1611
|
*/
|
|
1558
|
-
async getJson(path, onUpdate) {
|
|
1612
|
+
async getJson(path, { onUpdate, signal } = {}) {
|
|
1559
1613
|
const url = `${this.baseUrl}${path}`;
|
|
1560
1614
|
const cache = this._cache ?? await this._cachePromise;
|
|
1561
1615
|
|
|
@@ -1575,7 +1629,7 @@ class BrkClientBase {
|
|
|
1575
1629
|
return json;
|
|
1576
1630
|
});
|
|
1577
1631
|
|
|
1578
|
-
const networkPromise = this.get(path).then(async (res) => {
|
|
1632
|
+
const networkPromise = this.get(path, { signal }).then(async (res) => {
|
|
1579
1633
|
const cloned = res.clone();
|
|
1580
1634
|
const json = _addCamelGetters(await res.json());
|
|
1581
1635
|
// Skip update if ETag matches and cache already delivered
|
|
@@ -1607,10 +1661,11 @@ class BrkClientBase {
|
|
|
1607
1661
|
/**
|
|
1608
1662
|
* Make a GET request and return raw text (for CSV responses)
|
|
1609
1663
|
* @param {string} path
|
|
1664
|
+
* @param {{ signal?: AbortSignal }} [options]
|
|
1610
1665
|
* @returns {Promise<string>}
|
|
1611
1666
|
*/
|
|
1612
|
-
async getText(path) {
|
|
1613
|
-
const res = await this.get(path);
|
|
1667
|
+
async getText(path, { signal } = {}) {
|
|
1668
|
+
const res = await this.get(path, { signal });
|
|
1614
1669
|
return res.text();
|
|
1615
1670
|
}
|
|
1616
1671
|
|
|
@@ -1623,7 +1678,7 @@ class BrkClientBase {
|
|
|
1623
1678
|
*/
|
|
1624
1679
|
async _fetchSeriesData(path, onUpdate) {
|
|
1625
1680
|
const wrappedOnUpdate = onUpdate ? (/** @type {SeriesData<T>} */ raw) => onUpdate(_wrapSeriesData(raw)) : undefined;
|
|
1626
|
-
const raw = await this.getJson(path, wrappedOnUpdate);
|
|
1681
|
+
const raw = await this.getJson(path, { onUpdate: wrappedOnUpdate });
|
|
1627
1682
|
return _wrapSeriesData(raw);
|
|
1628
1683
|
}
|
|
1629
1684
|
}
|
|
@@ -6573,7 +6628,7 @@ function createTransferPattern(client, acc) {
|
|
|
6573
6628
|
* @extends BrkClientBase
|
|
6574
6629
|
*/
|
|
6575
6630
|
class BrkClient extends BrkClientBase {
|
|
6576
|
-
VERSION = "v0.3.0-
|
|
6631
|
+
VERSION = "v0.3.0-beta.0";
|
|
6577
6632
|
|
|
6578
6633
|
INDEXES = /** @type {const} */ ([
|
|
6579
6634
|
"minute10",
|
|
@@ -9441,10 +9496,11 @@ class BrkClient extends BrkClientBase {
|
|
|
9441
9496
|
* Compact OpenAPI specification optimized for LLM consumption. Removes redundant fields while preserving essential API information. Full spec available at `/openapi.json`.
|
|
9442
9497
|
*
|
|
9443
9498
|
* Endpoint: `GET /api.json`
|
|
9499
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: *) => void }} [options]
|
|
9444
9500
|
* @returns {Promise<*>}
|
|
9445
9501
|
*/
|
|
9446
|
-
async getApi() {
|
|
9447
|
-
return this.getJson(`/api.json
|
|
9502
|
+
async getApi({ signal, onUpdate } = {}) {
|
|
9503
|
+
return this.getJson(`/api.json`, { signal, onUpdate });
|
|
9448
9504
|
}
|
|
9449
9505
|
|
|
9450
9506
|
/**
|
|
@@ -9457,10 +9513,11 @@ class BrkClient extends BrkClientBase {
|
|
|
9457
9513
|
* Endpoint: `GET /api/address/{address}`
|
|
9458
9514
|
*
|
|
9459
9515
|
* @param {Addr} address
|
|
9516
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: AddrStats) => void }} [options]
|
|
9460
9517
|
* @returns {Promise<AddrStats>}
|
|
9461
9518
|
*/
|
|
9462
|
-
async getAddress(address) {
|
|
9463
|
-
return this.getJson(`/api/address/${address}
|
|
9519
|
+
async getAddress(address, { signal, onUpdate } = {}) {
|
|
9520
|
+
return this.getJson(`/api/address/${address}`, { signal, onUpdate });
|
|
9464
9521
|
}
|
|
9465
9522
|
|
|
9466
9523
|
/**
|
|
@@ -9474,14 +9531,15 @@ class BrkClient extends BrkClientBase {
|
|
|
9474
9531
|
*
|
|
9475
9532
|
* @param {Addr} address
|
|
9476
9533
|
* @param {Txid=} [after_txid] - Txid to paginate from (return transactions before this one)
|
|
9534
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: Transaction[]) => void }} [options]
|
|
9477
9535
|
* @returns {Promise<Transaction[]>}
|
|
9478
9536
|
*/
|
|
9479
|
-
async getAddressTxs(address, after_txid) {
|
|
9537
|
+
async getAddressTxs(address, after_txid, { signal, onUpdate } = {}) {
|
|
9480
9538
|
const params = new URLSearchParams();
|
|
9481
9539
|
if (after_txid !== undefined) params.set('after_txid', String(after_txid));
|
|
9482
9540
|
const query = params.toString();
|
|
9483
9541
|
const path = `/api/address/${address}/txs${query ? '?' + query : ''}`;
|
|
9484
|
-
return this.getJson(path);
|
|
9542
|
+
return this.getJson(path, { signal, onUpdate });
|
|
9485
9543
|
}
|
|
9486
9544
|
|
|
9487
9545
|
/**
|
|
@@ -9495,14 +9553,15 @@ class BrkClient extends BrkClientBase {
|
|
|
9495
9553
|
*
|
|
9496
9554
|
* @param {Addr} address
|
|
9497
9555
|
* @param {Txid=} [after_txid] - Txid to paginate from (return transactions before this one)
|
|
9556
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: Transaction[]) => void }} [options]
|
|
9498
9557
|
* @returns {Promise<Transaction[]>}
|
|
9499
9558
|
*/
|
|
9500
|
-
async getAddressConfirmedTxs(address, after_txid) {
|
|
9559
|
+
async getAddressConfirmedTxs(address, after_txid, { signal, onUpdate } = {}) {
|
|
9501
9560
|
const params = new URLSearchParams();
|
|
9502
9561
|
if (after_txid !== undefined) params.set('after_txid', String(after_txid));
|
|
9503
9562
|
const query = params.toString();
|
|
9504
9563
|
const path = `/api/address/${address}/txs/chain${query ? '?' + query : ''}`;
|
|
9505
|
-
return this.getJson(path);
|
|
9564
|
+
return this.getJson(path, { signal, onUpdate });
|
|
9506
9565
|
}
|
|
9507
9566
|
|
|
9508
9567
|
/**
|
|
@@ -9515,10 +9574,11 @@ class BrkClient extends BrkClientBase {
|
|
|
9515
9574
|
* Endpoint: `GET /api/address/{address}/txs/mempool`
|
|
9516
9575
|
*
|
|
9517
9576
|
* @param {Addr} address
|
|
9577
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: Txid[]) => void }} [options]
|
|
9518
9578
|
* @returns {Promise<Txid[]>}
|
|
9519
9579
|
*/
|
|
9520
|
-
async getAddressMempoolTxs(address) {
|
|
9521
|
-
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 });
|
|
9522
9582
|
}
|
|
9523
9583
|
|
|
9524
9584
|
/**
|
|
@@ -9531,10 +9591,11 @@ class BrkClient extends BrkClientBase {
|
|
|
9531
9591
|
* Endpoint: `GET /api/address/{address}/utxo`
|
|
9532
9592
|
*
|
|
9533
9593
|
* @param {Addr} address
|
|
9594
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: Utxo[]) => void }} [options]
|
|
9534
9595
|
* @returns {Promise<Utxo[]>}
|
|
9535
9596
|
*/
|
|
9536
|
-
async getAddressUtxos(address) {
|
|
9537
|
-
return this.getJson(`/api/address/${address}/utxo
|
|
9597
|
+
async getAddressUtxos(address, { signal, onUpdate } = {}) {
|
|
9598
|
+
return this.getJson(`/api/address/${address}/utxo`, { signal, onUpdate });
|
|
9538
9599
|
}
|
|
9539
9600
|
|
|
9540
9601
|
/**
|
|
@@ -9547,10 +9608,11 @@ class BrkClient extends BrkClientBase {
|
|
|
9547
9608
|
* Endpoint: `GET /api/block-height/{height}`
|
|
9548
9609
|
*
|
|
9549
9610
|
* @param {Height} height
|
|
9611
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: *) => void }} [options]
|
|
9550
9612
|
* @returns {Promise<*>}
|
|
9551
9613
|
*/
|
|
9552
|
-
async getBlockByHeight(height) {
|
|
9553
|
-
return this.getJson(`/api/block-height/${height}
|
|
9614
|
+
async getBlockByHeight(height, { signal, onUpdate } = {}) {
|
|
9615
|
+
return this.getJson(`/api/block-height/${height}`, { signal, onUpdate });
|
|
9554
9616
|
}
|
|
9555
9617
|
|
|
9556
9618
|
/**
|
|
@@ -9563,26 +9625,28 @@ class BrkClient extends BrkClientBase {
|
|
|
9563
9625
|
* Endpoint: `GET /api/block/{hash}`
|
|
9564
9626
|
*
|
|
9565
9627
|
* @param {BlockHash} hash
|
|
9628
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: BlockInfo) => void }} [options]
|
|
9566
9629
|
* @returns {Promise<BlockInfo>}
|
|
9567
9630
|
*/
|
|
9568
|
-
async getBlock(hash) {
|
|
9569
|
-
return this.getJson(`/api/block/${hash}
|
|
9631
|
+
async getBlock(hash, { signal, onUpdate } = {}) {
|
|
9632
|
+
return this.getJson(`/api/block/${hash}`, { signal, onUpdate });
|
|
9570
9633
|
}
|
|
9571
9634
|
|
|
9572
9635
|
/**
|
|
9573
9636
|
* Block header
|
|
9574
9637
|
*
|
|
9575
|
-
* Returns the hex-encoded block header.
|
|
9638
|
+
* Returns the hex-encoded 80-byte block header.
|
|
9576
9639
|
*
|
|
9577
9640
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-header)*
|
|
9578
9641
|
*
|
|
9579
9642
|
* Endpoint: `GET /api/block/{hash}/header`
|
|
9580
9643
|
*
|
|
9581
9644
|
* @param {BlockHash} hash
|
|
9645
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: *) => void }} [options]
|
|
9582
9646
|
* @returns {Promise<*>}
|
|
9583
9647
|
*/
|
|
9584
|
-
async getBlockHeader(hash) {
|
|
9585
|
-
return this.getJson(`/api/block/${hash}/header
|
|
9648
|
+
async getBlockHeader(hash, { signal, onUpdate } = {}) {
|
|
9649
|
+
return this.getJson(`/api/block/${hash}/header`, { signal, onUpdate });
|
|
9586
9650
|
}
|
|
9587
9651
|
|
|
9588
9652
|
/**
|
|
@@ -9595,10 +9659,11 @@ class BrkClient extends BrkClientBase {
|
|
|
9595
9659
|
* Endpoint: `GET /api/block/{hash}/raw`
|
|
9596
9660
|
*
|
|
9597
9661
|
* @param {BlockHash} hash
|
|
9598
|
-
* @
|
|
9662
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: *) => void }} [options]
|
|
9663
|
+
* @returns {Promise<*>}
|
|
9599
9664
|
*/
|
|
9600
|
-
async getBlockRaw(hash) {
|
|
9601
|
-
return this.getJson(`/api/block/${hash}/raw
|
|
9665
|
+
async getBlockRaw(hash, { signal, onUpdate } = {}) {
|
|
9666
|
+
return this.getJson(`/api/block/${hash}/raw`, { signal, onUpdate });
|
|
9602
9667
|
}
|
|
9603
9668
|
|
|
9604
9669
|
/**
|
|
@@ -9611,10 +9676,11 @@ class BrkClient extends BrkClientBase {
|
|
|
9611
9676
|
* Endpoint: `GET /api/block/{hash}/status`
|
|
9612
9677
|
*
|
|
9613
9678
|
* @param {BlockHash} hash
|
|
9679
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: BlockStatus) => void }} [options]
|
|
9614
9680
|
* @returns {Promise<BlockStatus>}
|
|
9615
9681
|
*/
|
|
9616
|
-
async getBlockStatus(hash) {
|
|
9617
|
-
return this.getJson(`/api/block/${hash}/status
|
|
9682
|
+
async getBlockStatus(hash, { signal, onUpdate } = {}) {
|
|
9683
|
+
return this.getJson(`/api/block/${hash}/status`, { signal, onUpdate });
|
|
9618
9684
|
}
|
|
9619
9685
|
|
|
9620
9686
|
/**
|
|
@@ -9628,10 +9694,11 @@ class BrkClient extends BrkClientBase {
|
|
|
9628
9694
|
*
|
|
9629
9695
|
* @param {BlockHash} hash - Bitcoin block hash
|
|
9630
9696
|
* @param {TxIndex} index - Transaction index within the block (0-based)
|
|
9697
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: *) => void }} [options]
|
|
9631
9698
|
* @returns {Promise<*>}
|
|
9632
9699
|
*/
|
|
9633
|
-
async getBlockTxid(hash, index) {
|
|
9634
|
-
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 });
|
|
9635
9702
|
}
|
|
9636
9703
|
|
|
9637
9704
|
/**
|
|
@@ -9644,10 +9711,11 @@ class BrkClient extends BrkClientBase {
|
|
|
9644
9711
|
* Endpoint: `GET /api/block/{hash}/txids`
|
|
9645
9712
|
*
|
|
9646
9713
|
* @param {BlockHash} hash
|
|
9714
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: Txid[]) => void }} [options]
|
|
9647
9715
|
* @returns {Promise<Txid[]>}
|
|
9648
9716
|
*/
|
|
9649
|
-
async getBlockTxids(hash) {
|
|
9650
|
-
return this.getJson(`/api/block/${hash}/txids
|
|
9717
|
+
async getBlockTxids(hash, { signal, onUpdate } = {}) {
|
|
9718
|
+
return this.getJson(`/api/block/${hash}/txids`, { signal, onUpdate });
|
|
9651
9719
|
}
|
|
9652
9720
|
|
|
9653
9721
|
/**
|
|
@@ -9660,10 +9728,11 @@ class BrkClient extends BrkClientBase {
|
|
|
9660
9728
|
* Endpoint: `GET /api/block/{hash}/txs`
|
|
9661
9729
|
*
|
|
9662
9730
|
* @param {BlockHash} hash
|
|
9731
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: Transaction[]) => void }} [options]
|
|
9663
9732
|
* @returns {Promise<Transaction[]>}
|
|
9664
9733
|
*/
|
|
9665
|
-
async getBlockTxs(hash) {
|
|
9666
|
-
return this.getJson(`/api/block/${hash}/txs
|
|
9734
|
+
async getBlockTxs(hash, { signal, onUpdate } = {}) {
|
|
9735
|
+
return this.getJson(`/api/block/${hash}/txs`, { signal, onUpdate });
|
|
9667
9736
|
}
|
|
9668
9737
|
|
|
9669
9738
|
/**
|
|
@@ -9677,10 +9746,11 @@ class BrkClient extends BrkClientBase {
|
|
|
9677
9746
|
*
|
|
9678
9747
|
* @param {BlockHash} hash - Bitcoin block hash
|
|
9679
9748
|
* @param {TxIndex} start_index - Starting transaction index within the block (0-based)
|
|
9749
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: Transaction[]) => void }} [options]
|
|
9680
9750
|
* @returns {Promise<Transaction[]>}
|
|
9681
9751
|
*/
|
|
9682
|
-
async getBlockTxsFromIndex(hash, start_index) {
|
|
9683
|
-
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 });
|
|
9684
9754
|
}
|
|
9685
9755
|
|
|
9686
9756
|
/**
|
|
@@ -9691,10 +9761,11 @@ class BrkClient extends BrkClientBase {
|
|
|
9691
9761
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-blocks)*
|
|
9692
9762
|
*
|
|
9693
9763
|
* Endpoint: `GET /api/blocks`
|
|
9764
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: BlockInfo[]) => void }} [options]
|
|
9694
9765
|
* @returns {Promise<BlockInfo[]>}
|
|
9695
9766
|
*/
|
|
9696
|
-
async getBlocks() {
|
|
9697
|
-
return this.getJson(`/api/blocks
|
|
9767
|
+
async getBlocks({ signal, onUpdate } = {}) {
|
|
9768
|
+
return this.getJson(`/api/blocks`, { signal, onUpdate });
|
|
9698
9769
|
}
|
|
9699
9770
|
|
|
9700
9771
|
/**
|
|
@@ -9705,10 +9776,11 @@ class BrkClient extends BrkClientBase {
|
|
|
9705
9776
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-tip-hash)*
|
|
9706
9777
|
*
|
|
9707
9778
|
* Endpoint: `GET /api/blocks/tip/hash`
|
|
9779
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: *) => void }} [options]
|
|
9708
9780
|
* @returns {Promise<*>}
|
|
9709
9781
|
*/
|
|
9710
|
-
async getBlockTipHash() {
|
|
9711
|
-
return this.getJson(`/api/blocks/tip/hash
|
|
9782
|
+
async getBlockTipHash({ signal, onUpdate } = {}) {
|
|
9783
|
+
return this.getJson(`/api/blocks/tip/hash`, { signal, onUpdate });
|
|
9712
9784
|
}
|
|
9713
9785
|
|
|
9714
9786
|
/**
|
|
@@ -9719,10 +9791,11 @@ class BrkClient extends BrkClientBase {
|
|
|
9719
9791
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-tip-height)*
|
|
9720
9792
|
*
|
|
9721
9793
|
* Endpoint: `GET /api/blocks/tip/height`
|
|
9794
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: *) => void }} [options]
|
|
9722
9795
|
* @returns {Promise<*>}
|
|
9723
9796
|
*/
|
|
9724
|
-
async getBlockTipHeight() {
|
|
9725
|
-
return this.getJson(`/api/blocks/tip/height
|
|
9797
|
+
async getBlockTipHeight({ signal, onUpdate } = {}) {
|
|
9798
|
+
return this.getJson(`/api/blocks/tip/height`, { signal, onUpdate });
|
|
9726
9799
|
}
|
|
9727
9800
|
|
|
9728
9801
|
/**
|
|
@@ -9735,10 +9808,11 @@ class BrkClient extends BrkClientBase {
|
|
|
9735
9808
|
* Endpoint: `GET /api/blocks/{height}`
|
|
9736
9809
|
*
|
|
9737
9810
|
* @param {Height} height
|
|
9811
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: BlockInfo[]) => void }} [options]
|
|
9738
9812
|
* @returns {Promise<BlockInfo[]>}
|
|
9739
9813
|
*/
|
|
9740
|
-
async getBlocksFromHeight(height) {
|
|
9741
|
-
return this.getJson(`/api/blocks/${height}
|
|
9814
|
+
async getBlocksFromHeight(height, { signal, onUpdate } = {}) {
|
|
9815
|
+
return this.getJson(`/api/blocks/${height}`, { signal, onUpdate });
|
|
9742
9816
|
}
|
|
9743
9817
|
|
|
9744
9818
|
/**
|
|
@@ -9749,10 +9823,11 @@ class BrkClient extends BrkClientBase {
|
|
|
9749
9823
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mempool)*
|
|
9750
9824
|
*
|
|
9751
9825
|
* Endpoint: `GET /api/mempool`
|
|
9826
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: MempoolInfo) => void }} [options]
|
|
9752
9827
|
* @returns {Promise<MempoolInfo>}
|
|
9753
9828
|
*/
|
|
9754
|
-
async getMempool() {
|
|
9755
|
-
return this.getJson(`/api/mempool
|
|
9829
|
+
async getMempool({ signal, onUpdate } = {}) {
|
|
9830
|
+
return this.getJson(`/api/mempool`, { signal, onUpdate });
|
|
9756
9831
|
}
|
|
9757
9832
|
|
|
9758
9833
|
/**
|
|
@@ -9761,10 +9836,11 @@ class BrkClient extends BrkClientBase {
|
|
|
9761
9836
|
* Returns the current BTC/USD price in dollars, derived from on-chain round-dollar output patterns in the last 12 blocks plus mempool.
|
|
9762
9837
|
*
|
|
9763
9838
|
* Endpoint: `GET /api/mempool/price`
|
|
9839
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: Dollars) => void }} [options]
|
|
9764
9840
|
* @returns {Promise<Dollars>}
|
|
9765
9841
|
*/
|
|
9766
|
-
async getLivePrice() {
|
|
9767
|
-
return this.getJson(`/api/mempool/price
|
|
9842
|
+
async getLivePrice({ signal, onUpdate } = {}) {
|
|
9843
|
+
return this.getJson(`/api/mempool/price`, { signal, onUpdate });
|
|
9768
9844
|
}
|
|
9769
9845
|
|
|
9770
9846
|
/**
|
|
@@ -9775,10 +9851,11 @@ class BrkClient extends BrkClientBase {
|
|
|
9775
9851
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mempool-recent)*
|
|
9776
9852
|
*
|
|
9777
9853
|
* Endpoint: `GET /api/mempool/recent`
|
|
9854
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: MempoolRecentTx[]) => void }} [options]
|
|
9778
9855
|
* @returns {Promise<MempoolRecentTx[]>}
|
|
9779
9856
|
*/
|
|
9780
|
-
async getMempoolRecent() {
|
|
9781
|
-
return this.getJson(`/api/mempool/recent
|
|
9857
|
+
async getMempoolRecent({ signal, onUpdate } = {}) {
|
|
9858
|
+
return this.getJson(`/api/mempool/recent`, { signal, onUpdate });
|
|
9782
9859
|
}
|
|
9783
9860
|
|
|
9784
9861
|
/**
|
|
@@ -9789,10 +9866,11 @@ class BrkClient extends BrkClientBase {
|
|
|
9789
9866
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mempool-transaction-ids)*
|
|
9790
9867
|
*
|
|
9791
9868
|
* Endpoint: `GET /api/mempool/txids`
|
|
9869
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: Txid[]) => void }} [options]
|
|
9792
9870
|
* @returns {Promise<Txid[]>}
|
|
9793
9871
|
*/
|
|
9794
|
-
async getMempoolTxids() {
|
|
9795
|
-
return this.getJson(`/api/mempool/txids
|
|
9872
|
+
async getMempoolTxids({ signal, onUpdate } = {}) {
|
|
9873
|
+
return this.getJson(`/api/mempool/txids`, { signal, onUpdate });
|
|
9796
9874
|
}
|
|
9797
9875
|
|
|
9798
9876
|
/**
|
|
@@ -9801,10 +9879,11 @@ class BrkClient extends BrkClientBase {
|
|
|
9801
9879
|
* Returns the complete hierarchical catalog of available series organized as a tree structure. Series are grouped by categories and subcategories.
|
|
9802
9880
|
*
|
|
9803
9881
|
* Endpoint: `GET /api/series`
|
|
9882
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: TreeNode) => void }} [options]
|
|
9804
9883
|
* @returns {Promise<TreeNode>}
|
|
9805
9884
|
*/
|
|
9806
|
-
async getSeriesTree() {
|
|
9807
|
-
return this.getJson(`/api/series
|
|
9885
|
+
async getSeriesTree({ signal, onUpdate } = {}) {
|
|
9886
|
+
return this.getJson(`/api/series`, { signal, onUpdate });
|
|
9808
9887
|
}
|
|
9809
9888
|
|
|
9810
9889
|
/**
|
|
@@ -9820,9 +9899,10 @@ class BrkClient extends BrkClientBase {
|
|
|
9820
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`
|
|
9821
9900
|
* @param {Limit=} [limit] - Maximum number of values to return (ignored if `end` is set). Aliases: `count`, `c`, `l`
|
|
9822
9901
|
* @param {Format=} [format] - Format of the output
|
|
9902
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: AnySeriesData[] | string) => void }} [options]
|
|
9823
9903
|
* @returns {Promise<AnySeriesData[] | string>}
|
|
9824
9904
|
*/
|
|
9825
|
-
async getSeriesBulk(series, index, start, end, limit, format) {
|
|
9905
|
+
async getSeriesBulk(series, index, start, end, limit, format, { signal, onUpdate } = {}) {
|
|
9826
9906
|
const params = new URLSearchParams();
|
|
9827
9907
|
params.set('series', String(series));
|
|
9828
9908
|
params.set('index', String(index));
|
|
@@ -9833,9 +9913,9 @@ class BrkClient extends BrkClientBase {
|
|
|
9833
9913
|
const query = params.toString();
|
|
9834
9914
|
const path = `/api/series/bulk${query ? '?' + query : ''}`;
|
|
9835
9915
|
if (format === 'csv') {
|
|
9836
|
-
return this.getText(path);
|
|
9916
|
+
return this.getText(path, { signal });
|
|
9837
9917
|
}
|
|
9838
|
-
return this.getJson(path);
|
|
9918
|
+
return this.getJson(path, { signal, onUpdate });
|
|
9839
9919
|
}
|
|
9840
9920
|
|
|
9841
9921
|
/**
|
|
@@ -9844,10 +9924,11 @@ class BrkClient extends BrkClientBase {
|
|
|
9844
9924
|
* List available cohorts for cost basis distribution.
|
|
9845
9925
|
*
|
|
9846
9926
|
* Endpoint: `GET /api/series/cost-basis`
|
|
9927
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: string[]) => void }} [options]
|
|
9847
9928
|
* @returns {Promise<string[]>}
|
|
9848
9929
|
*/
|
|
9849
|
-
async getCostBasisCohorts() {
|
|
9850
|
-
return this.getJson(`/api/series/cost-basis
|
|
9930
|
+
async getCostBasisCohorts({ signal, onUpdate } = {}) {
|
|
9931
|
+
return this.getJson(`/api/series/cost-basis`, { signal, onUpdate });
|
|
9851
9932
|
}
|
|
9852
9933
|
|
|
9853
9934
|
/**
|
|
@@ -9858,10 +9939,11 @@ class BrkClient extends BrkClientBase {
|
|
|
9858
9939
|
* Endpoint: `GET /api/series/cost-basis/{cohort}/dates`
|
|
9859
9940
|
*
|
|
9860
9941
|
* @param {Cohort} cohort
|
|
9942
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: Date[]) => void }} [options]
|
|
9861
9943
|
* @returns {Promise<Date[]>}
|
|
9862
9944
|
*/
|
|
9863
|
-
async getCostBasisDates(cohort) {
|
|
9864
|
-
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 });
|
|
9865
9947
|
}
|
|
9866
9948
|
|
|
9867
9949
|
/**
|
|
@@ -9879,15 +9961,16 @@ class BrkClient extends BrkClientBase {
|
|
|
9879
9961
|
* @param {string} date
|
|
9880
9962
|
* @param {CostBasisBucket=} [bucket] - Bucket type for aggregation. Default: raw (no aggregation).
|
|
9881
9963
|
* @param {CostBasisValue=} [value] - Value type to return. Default: supply.
|
|
9964
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: Object) => void }} [options]
|
|
9882
9965
|
* @returns {Promise<Object>}
|
|
9883
9966
|
*/
|
|
9884
|
-
async getCostBasis(cohort, date, bucket, value) {
|
|
9967
|
+
async getCostBasis(cohort, date, bucket, value, { signal, onUpdate } = {}) {
|
|
9885
9968
|
const params = new URLSearchParams();
|
|
9886
9969
|
if (bucket !== undefined) params.set('bucket', String(bucket));
|
|
9887
9970
|
if (value !== undefined) params.set('value', String(value));
|
|
9888
9971
|
const query = params.toString();
|
|
9889
9972
|
const path = `/api/series/cost-basis/${cohort}/${date}${query ? '?' + query : ''}`;
|
|
9890
|
-
return this.getJson(path);
|
|
9973
|
+
return this.getJson(path, { signal, onUpdate });
|
|
9891
9974
|
}
|
|
9892
9975
|
|
|
9893
9976
|
/**
|
|
@@ -9896,10 +9979,11 @@ class BrkClient extends BrkClientBase {
|
|
|
9896
9979
|
* Returns the number of series available per index type.
|
|
9897
9980
|
*
|
|
9898
9981
|
* Endpoint: `GET /api/series/count`
|
|
9982
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: SeriesCount[]) => void }} [options]
|
|
9899
9983
|
* @returns {Promise<SeriesCount[]>}
|
|
9900
9984
|
*/
|
|
9901
|
-
async getSeriesCount() {
|
|
9902
|
-
return this.getJson(`/api/series/count
|
|
9985
|
+
async getSeriesCount({ signal, onUpdate } = {}) {
|
|
9986
|
+
return this.getJson(`/api/series/count`, { signal, onUpdate });
|
|
9903
9987
|
}
|
|
9904
9988
|
|
|
9905
9989
|
/**
|
|
@@ -9908,10 +9992,11 @@ class BrkClient extends BrkClientBase {
|
|
|
9908
9992
|
* Returns all available indexes with their accepted query aliases. Use any alias when querying series.
|
|
9909
9993
|
*
|
|
9910
9994
|
* Endpoint: `GET /api/series/indexes`
|
|
9995
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: IndexInfo[]) => void }} [options]
|
|
9911
9996
|
* @returns {Promise<IndexInfo[]>}
|
|
9912
9997
|
*/
|
|
9913
|
-
async getIndexes() {
|
|
9914
|
-
return this.getJson(`/api/series/indexes
|
|
9998
|
+
async getIndexes({ signal, onUpdate } = {}) {
|
|
9999
|
+
return this.getJson(`/api/series/indexes`, { signal, onUpdate });
|
|
9915
10000
|
}
|
|
9916
10001
|
|
|
9917
10002
|
/**
|
|
@@ -9923,15 +10008,16 @@ class BrkClient extends BrkClientBase {
|
|
|
9923
10008
|
*
|
|
9924
10009
|
* @param {number=} [page] - Pagination index
|
|
9925
10010
|
* @param {number=} [per_page] - Results per page (default: 1000, max: 1000)
|
|
10011
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: PaginatedSeries) => void }} [options]
|
|
9926
10012
|
* @returns {Promise<PaginatedSeries>}
|
|
9927
10013
|
*/
|
|
9928
|
-
async listSeries(page, per_page) {
|
|
10014
|
+
async listSeries(page, per_page, { signal, onUpdate } = {}) {
|
|
9929
10015
|
const params = new URLSearchParams();
|
|
9930
10016
|
if (page !== undefined) params.set('page', String(page));
|
|
9931
10017
|
if (per_page !== undefined) params.set('per_page', String(per_page));
|
|
9932
10018
|
const query = params.toString();
|
|
9933
10019
|
const path = `/api/series/list${query ? '?' + query : ''}`;
|
|
9934
|
-
return this.getJson(path);
|
|
10020
|
+
return this.getJson(path, { signal, onUpdate });
|
|
9935
10021
|
}
|
|
9936
10022
|
|
|
9937
10023
|
/**
|
|
@@ -9943,15 +10029,16 @@ class BrkClient extends BrkClientBase {
|
|
|
9943
10029
|
*
|
|
9944
10030
|
* @param {SeriesName} [q] - Search query string
|
|
9945
10031
|
* @param {Limit=} [limit] - Maximum number of results
|
|
10032
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: string[]) => void }} [options]
|
|
9946
10033
|
* @returns {Promise<string[]>}
|
|
9947
10034
|
*/
|
|
9948
|
-
async searchSeries(q, limit) {
|
|
10035
|
+
async searchSeries(q, limit, { signal, onUpdate } = {}) {
|
|
9949
10036
|
const params = new URLSearchParams();
|
|
9950
10037
|
params.set('q', String(q));
|
|
9951
10038
|
if (limit !== undefined) params.set('limit', String(limit));
|
|
9952
10039
|
const query = params.toString();
|
|
9953
10040
|
const path = `/api/series/search${query ? '?' + query : ''}`;
|
|
9954
|
-
return this.getJson(path);
|
|
10041
|
+
return this.getJson(path, { signal, onUpdate });
|
|
9955
10042
|
}
|
|
9956
10043
|
|
|
9957
10044
|
/**
|
|
@@ -9962,10 +10049,11 @@ class BrkClient extends BrkClientBase {
|
|
|
9962
10049
|
* Endpoint: `GET /api/series/{series}`
|
|
9963
10050
|
*
|
|
9964
10051
|
* @param {SeriesName} series
|
|
10052
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: SeriesInfo) => void }} [options]
|
|
9965
10053
|
* @returns {Promise<SeriesInfo>}
|
|
9966
10054
|
*/
|
|
9967
|
-
async getSeriesInfo(series) {
|
|
9968
|
-
return this.getJson(`/api/series/${series}
|
|
10055
|
+
async getSeriesInfo(series, { signal, onUpdate } = {}) {
|
|
10056
|
+
return this.getJson(`/api/series/${series}`, { signal, onUpdate });
|
|
9969
10057
|
}
|
|
9970
10058
|
|
|
9971
10059
|
/**
|
|
@@ -9981,9 +10069,10 @@ class BrkClient extends BrkClientBase {
|
|
|
9981
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`
|
|
9982
10070
|
* @param {Limit=} [limit] - Maximum number of values to return (ignored if `end` is set). Aliases: `count`, `c`, `l`
|
|
9983
10071
|
* @param {Format=} [format] - Format of the output
|
|
10072
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: AnySeriesData | string) => void }} [options]
|
|
9984
10073
|
* @returns {Promise<AnySeriesData | string>}
|
|
9985
10074
|
*/
|
|
9986
|
-
async getSeries(series, index, start, end, limit, format) {
|
|
10075
|
+
async getSeries(series, index, start, end, limit, format, { signal, onUpdate } = {}) {
|
|
9987
10076
|
const params = new URLSearchParams();
|
|
9988
10077
|
if (start !== undefined) params.set('start', String(start));
|
|
9989
10078
|
if (end !== undefined) params.set('end', String(end));
|
|
@@ -9992,9 +10081,9 @@ class BrkClient extends BrkClientBase {
|
|
|
9992
10081
|
const query = params.toString();
|
|
9993
10082
|
const path = `/api/series/${series}/${index}${query ? '?' + query : ''}`;
|
|
9994
10083
|
if (format === 'csv') {
|
|
9995
|
-
return this.getText(path);
|
|
10084
|
+
return this.getText(path, { signal });
|
|
9996
10085
|
}
|
|
9997
|
-
return this.getJson(path);
|
|
10086
|
+
return this.getJson(path, { signal, onUpdate });
|
|
9998
10087
|
}
|
|
9999
10088
|
|
|
10000
10089
|
/**
|
|
@@ -10010,9 +10099,10 @@ class BrkClient extends BrkClientBase {
|
|
|
10010
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`
|
|
10011
10100
|
* @param {Limit=} [limit] - Maximum number of values to return (ignored if `end` is set). Aliases: `count`, `c`, `l`
|
|
10012
10101
|
* @param {Format=} [format] - Format of the output
|
|
10102
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: boolean[] | string) => void }} [options]
|
|
10013
10103
|
* @returns {Promise<boolean[] | string>}
|
|
10014
10104
|
*/
|
|
10015
|
-
async getSeriesData(series, index, start, end, limit, format) {
|
|
10105
|
+
async getSeriesData(series, index, start, end, limit, format, { signal, onUpdate } = {}) {
|
|
10016
10106
|
const params = new URLSearchParams();
|
|
10017
10107
|
if (start !== undefined) params.set('start', String(start));
|
|
10018
10108
|
if (end !== undefined) params.set('end', String(end));
|
|
@@ -10021,9 +10111,9 @@ class BrkClient extends BrkClientBase {
|
|
|
10021
10111
|
const query = params.toString();
|
|
10022
10112
|
const path = `/api/series/${series}/${index}/data${query ? '?' + query : ''}`;
|
|
10023
10113
|
if (format === 'csv') {
|
|
10024
|
-
return this.getText(path);
|
|
10114
|
+
return this.getText(path, { signal });
|
|
10025
10115
|
}
|
|
10026
|
-
return this.getJson(path);
|
|
10116
|
+
return this.getJson(path, { signal, onUpdate });
|
|
10027
10117
|
}
|
|
10028
10118
|
|
|
10029
10119
|
/**
|
|
@@ -10035,10 +10125,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10035
10125
|
*
|
|
10036
10126
|
* @param {SeriesName} series - Series name
|
|
10037
10127
|
* @param {Index} index - Aggregation index
|
|
10128
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: *) => void }} [options]
|
|
10038
10129
|
* @returns {Promise<*>}
|
|
10039
10130
|
*/
|
|
10040
|
-
async getSeriesLatest(series, index) {
|
|
10041
|
-
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 });
|
|
10042
10133
|
}
|
|
10043
10134
|
|
|
10044
10135
|
/**
|
|
@@ -10050,10 +10141,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10050
10141
|
*
|
|
10051
10142
|
* @param {SeriesName} series - Series name
|
|
10052
10143
|
* @param {Index} index - Aggregation index
|
|
10144
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: number) => void }} [options]
|
|
10053
10145
|
* @returns {Promise<number>}
|
|
10054
10146
|
*/
|
|
10055
|
-
async getSeriesLen(series, index) {
|
|
10056
|
-
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 });
|
|
10057
10149
|
}
|
|
10058
10150
|
|
|
10059
10151
|
/**
|
|
@@ -10065,10 +10157,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10065
10157
|
*
|
|
10066
10158
|
* @param {SeriesName} series - Series name
|
|
10067
10159
|
* @param {Index} index - Aggregation index
|
|
10160
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: Version) => void }} [options]
|
|
10068
10161
|
* @returns {Promise<Version>}
|
|
10069
10162
|
*/
|
|
10070
|
-
async getSeriesVersion(series, index) {
|
|
10071
|
-
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 });
|
|
10072
10165
|
}
|
|
10073
10166
|
|
|
10074
10167
|
/**
|
|
@@ -10077,10 +10170,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10077
10170
|
* Returns the disk space used by BRK and Bitcoin data.
|
|
10078
10171
|
*
|
|
10079
10172
|
* Endpoint: `GET /api/server/disk`
|
|
10173
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: DiskUsage) => void }} [options]
|
|
10080
10174
|
* @returns {Promise<DiskUsage>}
|
|
10081
10175
|
*/
|
|
10082
|
-
async getDiskUsage() {
|
|
10083
|
-
return this.getJson(`/api/server/disk
|
|
10176
|
+
async getDiskUsage({ signal, onUpdate } = {}) {
|
|
10177
|
+
return this.getJson(`/api/server/disk`, { signal, onUpdate });
|
|
10084
10178
|
}
|
|
10085
10179
|
|
|
10086
10180
|
/**
|
|
@@ -10089,10 +10183,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10089
10183
|
* Returns the sync status of the indexer, including indexed height, tip height, blocks behind, and last indexed timestamp.
|
|
10090
10184
|
*
|
|
10091
10185
|
* Endpoint: `GET /api/server/sync`
|
|
10186
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: SyncStatus) => void }} [options]
|
|
10092
10187
|
* @returns {Promise<SyncStatus>}
|
|
10093
10188
|
*/
|
|
10094
|
-
async getSyncStatus() {
|
|
10095
|
-
return this.getJson(`/api/server/sync
|
|
10189
|
+
async getSyncStatus({ signal, onUpdate } = {}) {
|
|
10190
|
+
return this.getJson(`/api/server/sync`, { signal, onUpdate });
|
|
10096
10191
|
}
|
|
10097
10192
|
|
|
10098
10193
|
/**
|
|
@@ -10105,10 +10200,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10105
10200
|
* Endpoint: `GET /api/tx/{txid}`
|
|
10106
10201
|
*
|
|
10107
10202
|
* @param {Txid} txid
|
|
10203
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: Transaction) => void }} [options]
|
|
10108
10204
|
* @returns {Promise<Transaction>}
|
|
10109
10205
|
*/
|
|
10110
|
-
async getTx(txid) {
|
|
10111
|
-
return this.getJson(`/api/tx/${txid}
|
|
10206
|
+
async getTx(txid, { signal, onUpdate } = {}) {
|
|
10207
|
+
return this.getJson(`/api/tx/${txid}`, { signal, onUpdate });
|
|
10112
10208
|
}
|
|
10113
10209
|
|
|
10114
10210
|
/**
|
|
@@ -10121,10 +10217,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10121
10217
|
* Endpoint: `GET /api/tx/{txid}/hex`
|
|
10122
10218
|
*
|
|
10123
10219
|
* @param {Txid} txid
|
|
10220
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: *) => void }} [options]
|
|
10124
10221
|
* @returns {Promise<*>}
|
|
10125
10222
|
*/
|
|
10126
|
-
async getTxHex(txid) {
|
|
10127
|
-
return this.getJson(`/api/tx/${txid}/hex
|
|
10223
|
+
async getTxHex(txid, { signal, onUpdate } = {}) {
|
|
10224
|
+
return this.getJson(`/api/tx/${txid}/hex`, { signal, onUpdate });
|
|
10128
10225
|
}
|
|
10129
10226
|
|
|
10130
10227
|
/**
|
|
@@ -10137,10 +10234,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10137
10234
|
* Endpoint: `GET /api/tx/{txid}/merkle-proof`
|
|
10138
10235
|
*
|
|
10139
10236
|
* @param {Txid} txid
|
|
10237
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: MerkleProof) => void }} [options]
|
|
10140
10238
|
* @returns {Promise<MerkleProof>}
|
|
10141
10239
|
*/
|
|
10142
|
-
async getTxMerkleProof(txid) {
|
|
10143
|
-
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 });
|
|
10144
10242
|
}
|
|
10145
10243
|
|
|
10146
10244
|
/**
|
|
@@ -10153,10 +10251,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10153
10251
|
* Endpoint: `GET /api/tx/{txid}/merkleblock-proof`
|
|
10154
10252
|
*
|
|
10155
10253
|
* @param {Txid} txid
|
|
10254
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: *) => void }} [options]
|
|
10156
10255
|
* @returns {Promise<*>}
|
|
10157
10256
|
*/
|
|
10158
|
-
async getTxMerkleblockProof(txid) {
|
|
10159
|
-
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 });
|
|
10160
10259
|
}
|
|
10161
10260
|
|
|
10162
10261
|
/**
|
|
@@ -10170,10 +10269,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10170
10269
|
*
|
|
10171
10270
|
* @param {Txid} txid - Transaction ID
|
|
10172
10271
|
* @param {Vout} vout - Output index
|
|
10272
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: TxOutspend) => void }} [options]
|
|
10173
10273
|
* @returns {Promise<TxOutspend>}
|
|
10174
10274
|
*/
|
|
10175
|
-
async getTxOutspend(txid, vout) {
|
|
10176
|
-
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 });
|
|
10177
10277
|
}
|
|
10178
10278
|
|
|
10179
10279
|
/**
|
|
@@ -10186,10 +10286,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10186
10286
|
* Endpoint: `GET /api/tx/{txid}/outspends`
|
|
10187
10287
|
*
|
|
10188
10288
|
* @param {Txid} txid
|
|
10289
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: TxOutspend[]) => void }} [options]
|
|
10189
10290
|
* @returns {Promise<TxOutspend[]>}
|
|
10190
10291
|
*/
|
|
10191
|
-
async getTxOutspends(txid) {
|
|
10192
|
-
return this.getJson(`/api/tx/${txid}/outspends
|
|
10292
|
+
async getTxOutspends(txid, { signal, onUpdate } = {}) {
|
|
10293
|
+
return this.getJson(`/api/tx/${txid}/outspends`, { signal, onUpdate });
|
|
10193
10294
|
}
|
|
10194
10295
|
|
|
10195
10296
|
/**
|
|
@@ -10202,10 +10303,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10202
10303
|
* Endpoint: `GET /api/tx/{txid}/raw`
|
|
10203
10304
|
*
|
|
10204
10305
|
* @param {Txid} txid
|
|
10205
|
-
* @
|
|
10306
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: *) => void }} [options]
|
|
10307
|
+
* @returns {Promise<*>}
|
|
10206
10308
|
*/
|
|
10207
|
-
async getTxRaw(txid) {
|
|
10208
|
-
return this.getJson(`/api/tx/${txid}/raw
|
|
10309
|
+
async getTxRaw(txid, { signal, onUpdate } = {}) {
|
|
10310
|
+
return this.getJson(`/api/tx/${txid}/raw`, { signal, onUpdate });
|
|
10209
10311
|
}
|
|
10210
10312
|
|
|
10211
10313
|
/**
|
|
@@ -10218,10 +10320,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10218
10320
|
* Endpoint: `GET /api/tx/{txid}/status`
|
|
10219
10321
|
*
|
|
10220
10322
|
* @param {Txid} txid
|
|
10323
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: TxStatus) => void }} [options]
|
|
10221
10324
|
* @returns {Promise<TxStatus>}
|
|
10222
10325
|
*/
|
|
10223
|
-
async getTxStatus(txid) {
|
|
10224
|
-
return this.getJson(`/api/tx/${txid}/status
|
|
10326
|
+
async getTxStatus(txid, { signal, onUpdate } = {}) {
|
|
10327
|
+
return this.getJson(`/api/tx/${txid}/status`, { signal, onUpdate });
|
|
10225
10328
|
}
|
|
10226
10329
|
|
|
10227
10330
|
/**
|
|
@@ -10234,10 +10337,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10234
10337
|
* Endpoint: `GET /api/v1/block/{hash}`
|
|
10235
10338
|
*
|
|
10236
10339
|
* @param {BlockHash} hash
|
|
10340
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: BlockInfoV1) => void }} [options]
|
|
10237
10341
|
* @returns {Promise<BlockInfoV1>}
|
|
10238
10342
|
*/
|
|
10239
|
-
async getBlockV1(hash) {
|
|
10240
|
-
return this.getJson(`/api/v1/block/${hash}
|
|
10343
|
+
async getBlockV1(hash, { signal, onUpdate } = {}) {
|
|
10344
|
+
return this.getJson(`/api/v1/block/${hash}`, { signal, onUpdate });
|
|
10241
10345
|
}
|
|
10242
10346
|
|
|
10243
10347
|
/**
|
|
@@ -10248,10 +10352,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10248
10352
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-blocks-v1)*
|
|
10249
10353
|
*
|
|
10250
10354
|
* Endpoint: `GET /api/v1/blocks`
|
|
10355
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: BlockInfoV1[]) => void }} [options]
|
|
10251
10356
|
* @returns {Promise<BlockInfoV1[]>}
|
|
10252
10357
|
*/
|
|
10253
|
-
async getBlocksV1() {
|
|
10254
|
-
return this.getJson(`/api/v1/blocks
|
|
10358
|
+
async getBlocksV1({ signal, onUpdate } = {}) {
|
|
10359
|
+
return this.getJson(`/api/v1/blocks`, { signal, onUpdate });
|
|
10255
10360
|
}
|
|
10256
10361
|
|
|
10257
10362
|
/**
|
|
@@ -10264,26 +10369,28 @@ class BrkClient extends BrkClientBase {
|
|
|
10264
10369
|
* Endpoint: `GET /api/v1/blocks/{height}`
|
|
10265
10370
|
*
|
|
10266
10371
|
* @param {Height} height
|
|
10372
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: BlockInfoV1[]) => void }} [options]
|
|
10267
10373
|
* @returns {Promise<BlockInfoV1[]>}
|
|
10268
10374
|
*/
|
|
10269
|
-
async getBlocksV1FromHeight(height) {
|
|
10270
|
-
return this.getJson(`/api/v1/blocks/${height}
|
|
10375
|
+
async getBlocksV1FromHeight(height, { signal, onUpdate } = {}) {
|
|
10376
|
+
return this.getJson(`/api/v1/blocks/${height}`, { signal, onUpdate });
|
|
10271
10377
|
}
|
|
10272
10378
|
|
|
10273
10379
|
/**
|
|
10274
10380
|
* CPFP info
|
|
10275
10381
|
*
|
|
10276
|
-
* 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.
|
|
10277
10383
|
*
|
|
10278
10384
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-children-pay-for-parent)*
|
|
10279
10385
|
*
|
|
10280
10386
|
* Endpoint: `GET /api/v1/cpfp/{txid}`
|
|
10281
10387
|
*
|
|
10282
10388
|
* @param {Txid} txid
|
|
10389
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: CpfpInfo) => void }} [options]
|
|
10283
10390
|
* @returns {Promise<CpfpInfo>}
|
|
10284
10391
|
*/
|
|
10285
|
-
async getCpfp(txid) {
|
|
10286
|
-
return this.getJson(`/api/v1/cpfp/${txid}
|
|
10392
|
+
async getCpfp(txid, { signal, onUpdate } = {}) {
|
|
10393
|
+
return this.getJson(`/api/v1/cpfp/${txid}`, { signal, onUpdate });
|
|
10287
10394
|
}
|
|
10288
10395
|
|
|
10289
10396
|
/**
|
|
@@ -10294,10 +10401,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10294
10401
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-difficulty-adjustment)*
|
|
10295
10402
|
*
|
|
10296
10403
|
* Endpoint: `GET /api/v1/difficulty-adjustment`
|
|
10404
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: DifficultyAdjustment) => void }} [options]
|
|
10297
10405
|
* @returns {Promise<DifficultyAdjustment>}
|
|
10298
10406
|
*/
|
|
10299
|
-
async getDifficultyAdjustment() {
|
|
10300
|
-
return this.getJson(`/api/v1/difficulty-adjustment
|
|
10407
|
+
async getDifficultyAdjustment({ signal, onUpdate } = {}) {
|
|
10408
|
+
return this.getJson(`/api/v1/difficulty-adjustment`, { signal, onUpdate });
|
|
10301
10409
|
}
|
|
10302
10410
|
|
|
10303
10411
|
/**
|
|
@@ -10308,10 +10416,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10308
10416
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mempool-blocks-fees)*
|
|
10309
10417
|
*
|
|
10310
10418
|
* Endpoint: `GET /api/v1/fees/mempool-blocks`
|
|
10419
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: MempoolBlock[]) => void }} [options]
|
|
10311
10420
|
* @returns {Promise<MempoolBlock[]>}
|
|
10312
10421
|
*/
|
|
10313
|
-
async getMempoolBlocks() {
|
|
10314
|
-
return this.getJson(`/api/v1/fees/mempool-blocks
|
|
10422
|
+
async getMempoolBlocks({ signal, onUpdate } = {}) {
|
|
10423
|
+
return this.getJson(`/api/v1/fees/mempool-blocks`, { signal, onUpdate });
|
|
10315
10424
|
}
|
|
10316
10425
|
|
|
10317
10426
|
/**
|
|
@@ -10322,10 +10431,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10322
10431
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-recommended-fees-precise)*
|
|
10323
10432
|
*
|
|
10324
10433
|
* Endpoint: `GET /api/v1/fees/precise`
|
|
10434
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: RecommendedFees) => void }} [options]
|
|
10325
10435
|
* @returns {Promise<RecommendedFees>}
|
|
10326
10436
|
*/
|
|
10327
|
-
async getPreciseFees() {
|
|
10328
|
-
return this.getJson(`/api/v1/fees/precise
|
|
10437
|
+
async getPreciseFees({ signal, onUpdate } = {}) {
|
|
10438
|
+
return this.getJson(`/api/v1/fees/precise`, { signal, onUpdate });
|
|
10329
10439
|
}
|
|
10330
10440
|
|
|
10331
10441
|
/**
|
|
@@ -10336,10 +10446,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10336
10446
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-recommended-fees)*
|
|
10337
10447
|
*
|
|
10338
10448
|
* Endpoint: `GET /api/v1/fees/recommended`
|
|
10449
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: RecommendedFees) => void }} [options]
|
|
10339
10450
|
* @returns {Promise<RecommendedFees>}
|
|
10340
10451
|
*/
|
|
10341
|
-
async getRecommendedFees() {
|
|
10342
|
-
return this.getJson(`/api/v1/fees/recommended
|
|
10452
|
+
async getRecommendedFees({ signal, onUpdate } = {}) {
|
|
10453
|
+
return this.getJson(`/api/v1/fees/recommended`, { signal, onUpdate });
|
|
10343
10454
|
}
|
|
10344
10455
|
|
|
10345
10456
|
/**
|
|
@@ -10352,78 +10463,83 @@ class BrkClient extends BrkClientBase {
|
|
|
10352
10463
|
* Endpoint: `GET /api/v1/historical-price`
|
|
10353
10464
|
*
|
|
10354
10465
|
* @param {Timestamp=} [timestamp]
|
|
10466
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: HistoricalPrice) => void }} [options]
|
|
10355
10467
|
* @returns {Promise<HistoricalPrice>}
|
|
10356
10468
|
*/
|
|
10357
|
-
async getHistoricalPrice(timestamp) {
|
|
10469
|
+
async getHistoricalPrice(timestamp, { signal, onUpdate } = {}) {
|
|
10358
10470
|
const params = new URLSearchParams();
|
|
10359
10471
|
if (timestamp !== undefined) params.set('timestamp', String(timestamp));
|
|
10360
10472
|
const query = params.toString();
|
|
10361
10473
|
const path = `/api/v1/historical-price${query ? '?' + query : ''}`;
|
|
10362
|
-
return this.getJson(path);
|
|
10474
|
+
return this.getJson(path, { signal, onUpdate });
|
|
10363
10475
|
}
|
|
10364
10476
|
|
|
10365
10477
|
/**
|
|
10366
|
-
* Block fee rates
|
|
10478
|
+
* Block fee rates
|
|
10367
10479
|
*
|
|
10368
|
-
*
|
|
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`.
|
|
10369
10481
|
*
|
|
10370
10482
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-feerates)*
|
|
10371
10483
|
*
|
|
10372
10484
|
* Endpoint: `GET /api/v1/mining/blocks/fee-rates/{time_period}`
|
|
10373
10485
|
*
|
|
10374
10486
|
* @param {TimePeriod} time_period
|
|
10375
|
-
* @
|
|
10487
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: BlockFeeRatesEntry[]) => void }} [options]
|
|
10488
|
+
* @returns {Promise<BlockFeeRatesEntry[]>}
|
|
10376
10489
|
*/
|
|
10377
|
-
async getBlockFeeRates(time_period) {
|
|
10378
|
-
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 });
|
|
10379
10492
|
}
|
|
10380
10493
|
|
|
10381
10494
|
/**
|
|
10382
10495
|
* Block fees
|
|
10383
10496
|
*
|
|
10384
|
-
* Get average
|
|
10497
|
+
* Get average total fees per block for a time period. Valid periods: `24h`, `3d`, `1w`, `1m`, `3m`, `6m`, `1y`, `2y`, `3y`.
|
|
10385
10498
|
*
|
|
10386
10499
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-fees)*
|
|
10387
10500
|
*
|
|
10388
10501
|
* Endpoint: `GET /api/v1/mining/blocks/fees/{time_period}`
|
|
10389
10502
|
*
|
|
10390
10503
|
* @param {TimePeriod} time_period
|
|
10504
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: BlockFeesEntry[]) => void }} [options]
|
|
10391
10505
|
* @returns {Promise<BlockFeesEntry[]>}
|
|
10392
10506
|
*/
|
|
10393
|
-
async getBlockFees(time_period) {
|
|
10394
|
-
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 });
|
|
10395
10509
|
}
|
|
10396
10510
|
|
|
10397
10511
|
/**
|
|
10398
10512
|
* Block rewards
|
|
10399
10513
|
*
|
|
10400
|
-
* Get average
|
|
10514
|
+
* Get average coinbase reward (subsidy + fees) per block for a time period. Valid periods: `24h`, `3d`, `1w`, `1m`, `3m`, `6m`, `1y`, `2y`, `3y`.
|
|
10401
10515
|
*
|
|
10402
10516
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-block-rewards)*
|
|
10403
10517
|
*
|
|
10404
10518
|
* Endpoint: `GET /api/v1/mining/blocks/rewards/{time_period}`
|
|
10405
10519
|
*
|
|
10406
10520
|
* @param {TimePeriod} time_period
|
|
10521
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: BlockRewardsEntry[]) => void }} [options]
|
|
10407
10522
|
* @returns {Promise<BlockRewardsEntry[]>}
|
|
10408
10523
|
*/
|
|
10409
|
-
async getBlockRewards(time_period) {
|
|
10410
|
-
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 });
|
|
10411
10526
|
}
|
|
10412
10527
|
|
|
10413
10528
|
/**
|
|
10414
10529
|
* Block sizes and weights
|
|
10415
10530
|
*
|
|
10416
|
-
* Get average block sizes and weights for a time period. Valid periods: 24h
|
|
10531
|
+
* Get average block sizes and weights for a time period. Valid periods: `24h`, `3d`, `1w`, `1m`, `3m`, `6m`, `1y`, `2y`, `3y`.
|
|
10417
10532
|
*
|
|
10418
10533
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-sizes-weights)*
|
|
10419
10534
|
*
|
|
10420
10535
|
* Endpoint: `GET /api/v1/mining/blocks/sizes-weights/{time_period}`
|
|
10421
10536
|
*
|
|
10422
10537
|
* @param {TimePeriod} time_period
|
|
10538
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: BlockSizesWeights) => void }} [options]
|
|
10423
10539
|
* @returns {Promise<BlockSizesWeights>}
|
|
10424
10540
|
*/
|
|
10425
|
-
async getBlockSizesWeights(time_period) {
|
|
10426
|
-
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 });
|
|
10427
10543
|
}
|
|
10428
10544
|
|
|
10429
10545
|
/**
|
|
@@ -10436,10 +10552,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10436
10552
|
* Endpoint: `GET /api/v1/mining/blocks/timestamp/{timestamp}`
|
|
10437
10553
|
*
|
|
10438
10554
|
* @param {Timestamp} timestamp
|
|
10555
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: BlockTimestamp) => void }} [options]
|
|
10439
10556
|
* @returns {Promise<BlockTimestamp>}
|
|
10440
10557
|
*/
|
|
10441
|
-
async getBlockByTimestamp(timestamp) {
|
|
10442
|
-
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 });
|
|
10443
10560
|
}
|
|
10444
10561
|
|
|
10445
10562
|
/**
|
|
@@ -10450,26 +10567,28 @@ class BrkClient extends BrkClientBase {
|
|
|
10450
10567
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-difficulty-adjustments)*
|
|
10451
10568
|
*
|
|
10452
10569
|
* Endpoint: `GET /api/v1/mining/difficulty-adjustments`
|
|
10570
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: DifficultyAdjustmentEntry[]) => void }} [options]
|
|
10453
10571
|
* @returns {Promise<DifficultyAdjustmentEntry[]>}
|
|
10454
10572
|
*/
|
|
10455
|
-
async getDifficultyAdjustments() {
|
|
10456
|
-
return this.getJson(`/api/v1/mining/difficulty-adjustments
|
|
10573
|
+
async getDifficultyAdjustments({ signal, onUpdate } = {}) {
|
|
10574
|
+
return this.getJson(`/api/v1/mining/difficulty-adjustments`, { signal, onUpdate });
|
|
10457
10575
|
}
|
|
10458
10576
|
|
|
10459
10577
|
/**
|
|
10460
10578
|
* Difficulty adjustments
|
|
10461
10579
|
*
|
|
10462
|
-
* Get historical difficulty adjustments for a time period. Valid periods: 24h
|
|
10580
|
+
* Get historical difficulty adjustments for a time period. Valid periods: `24h`, `3d`, `1w`, `1m`, `3m`, `6m`, `1y`, `2y`, `3y`.
|
|
10463
10581
|
*
|
|
10464
10582
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-difficulty-adjustments)*
|
|
10465
10583
|
*
|
|
10466
10584
|
* Endpoint: `GET /api/v1/mining/difficulty-adjustments/{time_period}`
|
|
10467
10585
|
*
|
|
10468
10586
|
* @param {TimePeriod} time_period
|
|
10587
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: DifficultyAdjustmentEntry[]) => void }} [options]
|
|
10469
10588
|
* @returns {Promise<DifficultyAdjustmentEntry[]>}
|
|
10470
10589
|
*/
|
|
10471
|
-
async getDifficultyAdjustmentsByPeriod(time_period) {
|
|
10472
|
-
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 });
|
|
10473
10592
|
}
|
|
10474
10593
|
|
|
10475
10594
|
/**
|
|
@@ -10480,10 +10599,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10480
10599
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-hashrate)*
|
|
10481
10600
|
*
|
|
10482
10601
|
* Endpoint: `GET /api/v1/mining/hashrate`
|
|
10602
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: HashrateSummary) => void }} [options]
|
|
10483
10603
|
* @returns {Promise<HashrateSummary>}
|
|
10484
10604
|
*/
|
|
10485
|
-
async getHashrate() {
|
|
10486
|
-
return this.getJson(`/api/v1/mining/hashrate
|
|
10605
|
+
async getHashrate({ signal, onUpdate } = {}) {
|
|
10606
|
+
return this.getJson(`/api/v1/mining/hashrate`, { signal, onUpdate });
|
|
10487
10607
|
}
|
|
10488
10608
|
|
|
10489
10609
|
/**
|
|
@@ -10494,42 +10614,45 @@ class BrkClient extends BrkClientBase {
|
|
|
10494
10614
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pool-hashrates)*
|
|
10495
10615
|
*
|
|
10496
10616
|
* Endpoint: `GET /api/v1/mining/hashrate/pools`
|
|
10617
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: PoolHashrateEntry[]) => void }} [options]
|
|
10497
10618
|
* @returns {Promise<PoolHashrateEntry[]>}
|
|
10498
10619
|
*/
|
|
10499
|
-
async getPoolsHashrate() {
|
|
10500
|
-
return this.getJson(`/api/v1/mining/hashrate/pools
|
|
10620
|
+
async getPoolsHashrate({ signal, onUpdate } = {}) {
|
|
10621
|
+
return this.getJson(`/api/v1/mining/hashrate/pools`, { signal, onUpdate });
|
|
10501
10622
|
}
|
|
10502
10623
|
|
|
10503
10624
|
/**
|
|
10504
10625
|
* All pools hashrate
|
|
10505
10626
|
*
|
|
10506
|
-
* Get hashrate data for all mining pools for a time period. Valid periods: 1m
|
|
10627
|
+
* Get hashrate data for all mining pools for a time period. Valid periods: `1m`, `3m`, `6m`, `1y`, `2y`, `3y`.
|
|
10507
10628
|
*
|
|
10508
10629
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pool-hashrates)*
|
|
10509
10630
|
*
|
|
10510
10631
|
* Endpoint: `GET /api/v1/mining/hashrate/pools/{time_period}`
|
|
10511
10632
|
*
|
|
10512
10633
|
* @param {TimePeriod} time_period
|
|
10634
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: PoolHashrateEntry[]) => void }} [options]
|
|
10513
10635
|
* @returns {Promise<PoolHashrateEntry[]>}
|
|
10514
10636
|
*/
|
|
10515
|
-
async getPoolsHashrateByPeriod(time_period) {
|
|
10516
|
-
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 });
|
|
10517
10639
|
}
|
|
10518
10640
|
|
|
10519
10641
|
/**
|
|
10520
10642
|
* Network hashrate
|
|
10521
10643
|
*
|
|
10522
|
-
* Get network hashrate and difficulty data for a time period. Valid periods: 24h
|
|
10644
|
+
* Get network hashrate and difficulty data for a time period. Valid periods: `24h`, `3d`, `1w`, `1m`, `3m`, `6m`, `1y`, `2y`, `3y`.
|
|
10523
10645
|
*
|
|
10524
10646
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-hashrate)*
|
|
10525
10647
|
*
|
|
10526
10648
|
* Endpoint: `GET /api/v1/mining/hashrate/{time_period}`
|
|
10527
10649
|
*
|
|
10528
10650
|
* @param {TimePeriod} time_period
|
|
10651
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: HashrateSummary) => void }} [options]
|
|
10529
10652
|
* @returns {Promise<HashrateSummary>}
|
|
10530
10653
|
*/
|
|
10531
|
-
async getHashrateByPeriod(time_period) {
|
|
10532
|
-
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 });
|
|
10533
10656
|
}
|
|
10534
10657
|
|
|
10535
10658
|
/**
|
|
@@ -10542,10 +10665,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10542
10665
|
* Endpoint: `GET /api/v1/mining/pool/{slug}`
|
|
10543
10666
|
*
|
|
10544
10667
|
* @param {PoolSlug} slug
|
|
10668
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: PoolDetail) => void }} [options]
|
|
10545
10669
|
* @returns {Promise<PoolDetail>}
|
|
10546
10670
|
*/
|
|
10547
|
-
async getPool(slug) {
|
|
10548
|
-
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 });
|
|
10549
10673
|
}
|
|
10550
10674
|
|
|
10551
10675
|
/**
|
|
@@ -10558,10 +10682,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10558
10682
|
* Endpoint: `GET /api/v1/mining/pool/{slug}/blocks`
|
|
10559
10683
|
*
|
|
10560
10684
|
* @param {PoolSlug} slug
|
|
10685
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: BlockInfoV1[]) => void }} [options]
|
|
10561
10686
|
* @returns {Promise<BlockInfoV1[]>}
|
|
10562
10687
|
*/
|
|
10563
|
-
async getPoolBlocks(slug) {
|
|
10564
|
-
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 });
|
|
10565
10690
|
}
|
|
10566
10691
|
|
|
10567
10692
|
/**
|
|
@@ -10575,10 +10700,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10575
10700
|
*
|
|
10576
10701
|
* @param {PoolSlug} slug
|
|
10577
10702
|
* @param {Height} height
|
|
10703
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: BlockInfoV1[]) => void }} [options]
|
|
10578
10704
|
* @returns {Promise<BlockInfoV1[]>}
|
|
10579
10705
|
*/
|
|
10580
|
-
async getPoolBlocksFrom(slug, height) {
|
|
10581
|
-
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 });
|
|
10582
10708
|
}
|
|
10583
10709
|
|
|
10584
10710
|
/**
|
|
@@ -10591,10 +10717,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10591
10717
|
* Endpoint: `GET /api/v1/mining/pool/{slug}/hashrate`
|
|
10592
10718
|
*
|
|
10593
10719
|
* @param {PoolSlug} slug
|
|
10720
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: PoolHashrateEntry[]) => void }} [options]
|
|
10594
10721
|
* @returns {Promise<PoolHashrateEntry[]>}
|
|
10595
10722
|
*/
|
|
10596
|
-
async getPoolHashrate(slug) {
|
|
10597
|
-
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 });
|
|
10598
10725
|
}
|
|
10599
10726
|
|
|
10600
10727
|
/**
|
|
@@ -10605,26 +10732,28 @@ class BrkClient extends BrkClientBase {
|
|
|
10605
10732
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pools)*
|
|
10606
10733
|
*
|
|
10607
10734
|
* Endpoint: `GET /api/v1/mining/pools`
|
|
10735
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: PoolInfo[]) => void }} [options]
|
|
10608
10736
|
* @returns {Promise<PoolInfo[]>}
|
|
10609
10737
|
*/
|
|
10610
|
-
async getPools() {
|
|
10611
|
-
return this.getJson(`/api/v1/mining/pools
|
|
10738
|
+
async getPools({ signal, onUpdate } = {}) {
|
|
10739
|
+
return this.getJson(`/api/v1/mining/pools`, { signal, onUpdate });
|
|
10612
10740
|
}
|
|
10613
10741
|
|
|
10614
10742
|
/**
|
|
10615
10743
|
* Mining pool statistics
|
|
10616
10744
|
*
|
|
10617
|
-
* Get mining pool statistics for a time period. Valid periods: 24h
|
|
10745
|
+
* Get mining pool statistics for a time period. Valid periods: `24h`, `3d`, `1w`, `1m`, `3m`, `6m`, `1y`, `2y`, `3y`.
|
|
10618
10746
|
*
|
|
10619
10747
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-mining-pools)*
|
|
10620
10748
|
*
|
|
10621
10749
|
* Endpoint: `GET /api/v1/mining/pools/{time_period}`
|
|
10622
10750
|
*
|
|
10623
10751
|
* @param {TimePeriod} time_period
|
|
10752
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: PoolsSummary) => void }} [options]
|
|
10624
10753
|
* @returns {Promise<PoolsSummary>}
|
|
10625
10754
|
*/
|
|
10626
|
-
async getPoolStats(time_period) {
|
|
10627
|
-
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 });
|
|
10628
10757
|
}
|
|
10629
10758
|
|
|
10630
10759
|
/**
|
|
@@ -10637,10 +10766,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10637
10766
|
* Endpoint: `GET /api/v1/mining/reward-stats/{block_count}`
|
|
10638
10767
|
*
|
|
10639
10768
|
* @param {number} block_count - Number of recent blocks to include
|
|
10769
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: RewardStats) => void }} [options]
|
|
10640
10770
|
* @returns {Promise<RewardStats>}
|
|
10641
10771
|
*/
|
|
10642
|
-
async getRewardStats(block_count) {
|
|
10643
|
-
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 });
|
|
10644
10774
|
}
|
|
10645
10775
|
|
|
10646
10776
|
/**
|
|
@@ -10651,10 +10781,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10651
10781
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-price)*
|
|
10652
10782
|
*
|
|
10653
10783
|
* Endpoint: `GET /api/v1/prices`
|
|
10784
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: Prices) => void }} [options]
|
|
10654
10785
|
* @returns {Promise<Prices>}
|
|
10655
10786
|
*/
|
|
10656
|
-
async getPrices() {
|
|
10657
|
-
return this.getJson(`/api/v1/prices
|
|
10787
|
+
async getPrices({ signal, onUpdate } = {}) {
|
|
10788
|
+
return this.getJson(`/api/v1/prices`, { signal, onUpdate });
|
|
10658
10789
|
}
|
|
10659
10790
|
|
|
10660
10791
|
/**
|
|
@@ -10665,26 +10796,28 @@ class BrkClient extends BrkClientBase {
|
|
|
10665
10796
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-transaction-times)*
|
|
10666
10797
|
*
|
|
10667
10798
|
* Endpoint: `GET /api/v1/transaction-times`
|
|
10799
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: number[]) => void }} [options]
|
|
10668
10800
|
* @returns {Promise<number[]>}
|
|
10669
10801
|
*/
|
|
10670
|
-
async getTransactionTimes() {
|
|
10671
|
-
return this.getJson(`/api/v1/transaction-times
|
|
10802
|
+
async getTransactionTimes({ signal, onUpdate } = {}) {
|
|
10803
|
+
return this.getJson(`/api/v1/transaction-times`, { signal, onUpdate });
|
|
10672
10804
|
}
|
|
10673
10805
|
|
|
10674
10806
|
/**
|
|
10675
10807
|
* Validate address
|
|
10676
10808
|
*
|
|
10677
|
-
* 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.
|
|
10678
10810
|
*
|
|
10679
10811
|
* *[Mempool.space docs](https://mempool.space/docs/api/rest#get-address-validate)*
|
|
10680
10812
|
*
|
|
10681
10813
|
* Endpoint: `GET /api/v1/validate-address/{address}`
|
|
10682
10814
|
*
|
|
10683
10815
|
* @param {string} address - Bitcoin address to validate (can be any string)
|
|
10816
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: AddrValidation) => void }} [options]
|
|
10684
10817
|
* @returns {Promise<AddrValidation>}
|
|
10685
10818
|
*/
|
|
10686
|
-
async validateAddress(address) {
|
|
10687
|
-
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 });
|
|
10688
10821
|
}
|
|
10689
10822
|
|
|
10690
10823
|
/**
|
|
@@ -10693,10 +10826,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10693
10826
|
* Returns the health status of the API server, including uptime information.
|
|
10694
10827
|
*
|
|
10695
10828
|
* Endpoint: `GET /health`
|
|
10829
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: Health) => void }} [options]
|
|
10696
10830
|
* @returns {Promise<Health>}
|
|
10697
10831
|
*/
|
|
10698
|
-
async getHealth() {
|
|
10699
|
-
return this.getJson(`/health
|
|
10832
|
+
async getHealth({ signal, onUpdate } = {}) {
|
|
10833
|
+
return this.getJson(`/health`, { signal, onUpdate });
|
|
10700
10834
|
}
|
|
10701
10835
|
|
|
10702
10836
|
/**
|
|
@@ -10705,10 +10839,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10705
10839
|
* Full OpenAPI 3.1 specification for this API.
|
|
10706
10840
|
*
|
|
10707
10841
|
* Endpoint: `GET /openapi.json`
|
|
10842
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: *) => void }} [options]
|
|
10708
10843
|
* @returns {Promise<*>}
|
|
10709
10844
|
*/
|
|
10710
|
-
async getOpenapi() {
|
|
10711
|
-
return this.getJson(`/openapi.json
|
|
10845
|
+
async getOpenapi({ signal, onUpdate } = {}) {
|
|
10846
|
+
return this.getJson(`/openapi.json`, { signal, onUpdate });
|
|
10712
10847
|
}
|
|
10713
10848
|
|
|
10714
10849
|
/**
|
|
@@ -10717,10 +10852,11 @@ class BrkClient extends BrkClientBase {
|
|
|
10717
10852
|
* Returns the current version of the API server
|
|
10718
10853
|
*
|
|
10719
10854
|
* Endpoint: `GET /version`
|
|
10855
|
+
* @param {{ signal?: AbortSignal, onUpdate?: (value: string) => void }} [options]
|
|
10720
10856
|
* @returns {Promise<string>}
|
|
10721
10857
|
*/
|
|
10722
|
-
async getVersion() {
|
|
10723
|
-
return this.getJson(`/version
|
|
10858
|
+
async getVersion({ signal, onUpdate } = {}) {
|
|
10859
|
+
return this.getJson(`/version`, { signal, onUpdate });
|
|
10724
10860
|
}
|
|
10725
10861
|
|
|
10726
10862
|
}
|