brk-client 0.1.0-alpha.3 → 0.1.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.
Files changed (3) hide show
  1. package/README.md +5 -20
  2. package/index.js +416 -265
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  JavaScript/TypeScript client for the [Bitcoin Research Kit](https://github.com/bitcoinresearchkit/brk) API.
4
4
 
5
+ Zero dependencies.
6
+
5
7
  [npm](https://www.npmjs.com/package/brk-client) | [API Reference](https://github.com/bitcoinresearchkit/brk/blob/main/modules/brk-client/docs/globals.md)
6
8
 
7
9
  ## Installation
@@ -10,6 +12,8 @@ JavaScript/TypeScript client for the [Bitcoin Research Kit](https://github.com/b
10
12
  npm install brk-client
11
13
  ```
12
14
 
15
+ Or just copy [`index.js`](./index.js) into your project - it's a single file with no dependencies.
16
+
13
17
  ## Quick Start
14
18
 
15
19
  ```javascript
@@ -17,6 +21,7 @@ import { BrkClient } from 'brk-client';
17
21
 
18
22
  // Use the free public API or your own instance
19
23
  const client = new BrkClient('https://bitview.space');
24
+ // or: `const client = new BrkClient({ baseUrl: 'https://bitview.space', timeout: 10000 });`
20
25
 
21
26
  // Blockchain data (mempool.space compatible)
22
27
  const block = await client.getBlockByHeight(800000);
@@ -31,23 +36,3 @@ const prices = await client.metrics.price.usd.split.close
31
36
  // Generic metric fetching
32
37
  const data = await client.getMetric('price_close', 'dateindex', -30);
33
38
  ```
34
-
35
- ## API
36
-
37
- ```javascript
38
- // Range methods
39
- .first(n) // First n items
40
- .last(n) // Last n items
41
- .slice(start, end)
42
- .get(index) // Single item
43
- .skip(n).take(m) // Pagination
44
- ```
45
-
46
- ## Configuration
47
-
48
- ```javascript
49
- const client = new BrkClient({
50
- baseUrl: 'https://bitview.space',
51
- timeout: 10000 // ms
52
- });
53
- ```
package/index.js CHANGED
@@ -308,7 +308,7 @@
308
308
  * Aggregation dimension for querying metrics. Includes time-based (date, week, month, year),
309
309
  * block-based (height, txindex), and address/output type indexes.
310
310
  *
311
- * @typedef {("dateindex"|"decadeindex"|"difficultyepoch"|"emptyoutputindex"|"halvingepoch"|"height"|"txinindex"|"monthindex"|"opreturnindex"|"txoutindex"|"p2aaddressindex"|"p2msoutputindex"|"p2pk33addressindex"|"p2pk65addressindex"|"p2pkhaddressindex"|"p2shaddressindex"|"p2traddressindex"|"p2wpkhaddressindex"|"p2wshaddressindex"|"quarterindex"|"semesterindex"|"txindex"|"unknownoutputindex"|"weekindex"|"yearindex"|"loadedaddressindex"|"emptyaddressindex")} Index
311
+ * @typedef {("dateindex"|"decadeindex"|"difficultyepoch"|"emptyoutputindex"|"halvingepoch"|"height"|"txinindex"|"monthindex"|"opreturnindex"|"txoutindex"|"p2aaddressindex"|"p2msoutputindex"|"p2pk33addressindex"|"p2pk65addressindex"|"p2pkhaddressindex"|"p2shaddressindex"|"p2traddressindex"|"p2wpkhaddressindex"|"p2wshaddressindex"|"quarterindex"|"semesterindex"|"txindex"|"unknownoutputindex"|"weekindex"|"yearindex"|"loadedaddressindex"|"emptyaddressindex"|"pairoutputindex")} Index
312
312
  */
313
313
  /**
314
314
  * Information about an available index and its query aliases
@@ -455,6 +455,8 @@
455
455
  *
456
456
  * @typedef {Cents} Open
457
457
  */
458
+ /** @typedef {number[]} OracleBins */
459
+ /** @typedef {number[]} OracleBinsV2 */
458
460
  /** @typedef {number} OutPoint */
459
461
  /**
460
462
  * Type (P2PKH, P2WPKH, P2SH, P2TR, etc.)
@@ -492,6 +494,14 @@
492
494
  * @typedef {Object} Pagination
493
495
  * @property {?number=} page - Pagination index
494
496
  */
497
+ /**
498
+ * Index for 2-output transactions (oracle pair candidates)
499
+ *
500
+ * This indexes all transactions with exactly 2 outputs, which are
501
+ * candidates for the UTXOracle algorithm (payment + change pattern).
502
+ *
503
+ * @typedef {number} PairOutputIndex
504
+ */
495
505
  /**
496
506
  * Block counts for different time periods
497
507
  *
@@ -596,7 +606,7 @@
596
606
  */
597
607
  /** @typedef {number} SemesterIndex */
598
608
  /**
599
- * Fixed-size boolean value optimized for on-disk storage (stored as u16)
609
+ * Fixed-size boolean value optimized for on-disk storage (stored as u8)
600
610
  *
601
611
  * @typedef {number} StoredBool
602
612
  */
@@ -610,7 +620,7 @@
610
620
  *
611
621
  * @typedef {number} StoredF64
612
622
  */
613
- /** @typedef {number} StoredI16 */
623
+ /** @typedef {number} StoredI8 */
614
624
  /** @typedef {number} StoredU16 */
615
625
  /**
616
626
  * Fixed-size 32-bit unsigned integer optimized for on-disk storage
@@ -829,9 +839,11 @@ class BrkError extends Error {
829
839
  /**
830
840
  * @template T
831
841
  * @typedef {Object} MetricData
842
+ * @property {number} version - Version of the metric data
832
843
  * @property {number} total - Total number of data points
833
844
  * @property {number} start - Start index (inclusive)
834
845
  * @property {number} end - End index (exclusive)
846
+ * @property {string} stamp - ISO 8601 timestamp of when the response was generated
835
847
  * @property {T[]} data - The metric data
836
848
  */
837
849
  /** @typedef {MetricData<any>} AnyMetricData */
@@ -1092,6 +1104,7 @@ const _i29 = /** @type {const} */ (["weekindex"]);
1092
1104
  const _i30 = /** @type {const} */ (["yearindex"]);
1093
1105
  const _i31 = /** @type {const} */ (["loadedaddressindex"]);
1094
1106
  const _i32 = /** @type {const} */ (["emptyaddressindex"]);
1107
+ const _i33 = /** @type {const} */ (["pairoutputindex"]);
1095
1108
 
1096
1109
  /**
1097
1110
  * Generic metric pattern factory.
@@ -1214,6 +1227,9 @@ function createMetricPattern31(client, name) { return _mp(client, name, _i31); }
1214
1227
  /** @template T @typedef {{ name: string, by: { readonly emptyaddressindex: MetricEndpointBuilder<T> }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder<T>|undefined }} MetricPattern32 */
1215
1228
  /** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern32<T>} */
1216
1229
  function createMetricPattern32(client, name) { return _mp(client, name, _i32); }
1230
+ /** @template T @typedef {{ name: string, by: { readonly pairoutputindex: MetricEndpointBuilder<T> }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder<T>|undefined }} MetricPattern33 */
1231
+ /** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern33<T>} */
1232
+ function createMetricPattern33(client, name) { return _mp(client, name, _i33); }
1217
1233
 
1218
1234
  // Reusable structural pattern factories
1219
1235
 
@@ -1799,6 +1815,7 @@ function createRelativePattern5(client, acc) {
1799
1815
  * @property {MetricPattern1<StoredU32>} _24hBlocksMined
1800
1816
  * @property {MetricPattern1<StoredF32>} _24hDominance
1801
1817
  * @property {BlockCountPattern<StoredU32>} blocksMined
1818
+ * @property {MetricPattern1<StoredU32>} blocksSinceBlock
1802
1819
  * @property {CoinbasePattern2} coinbase
1803
1820
  * @property {MetricPattern4<StoredU16>} daysSinceBlock
1804
1821
  * @property {MetricPattern1<StoredF32>} dominance
@@ -1823,6 +1840,7 @@ function createAaopoolPattern(client, acc) {
1823
1840
  _24hBlocksMined: createMetricPattern1(client, _m(acc, '24h_blocks_mined')),
1824
1841
  _24hDominance: createMetricPattern1(client, _m(acc, '24h_dominance')),
1825
1842
  blocksMined: createBlockCountPattern(client, _m(acc, 'blocks_mined')),
1843
+ blocksSinceBlock: createMetricPattern1(client, _m(acc, 'blocks_since_block')),
1826
1844
  coinbase: createCoinbasePattern2(client, _m(acc, 'coinbase')),
1827
1845
  daysSinceBlock: createMetricPattern4(client, _m(acc, 'days_since_block')),
1828
1846
  dominance: createMetricPattern1(client, _m(acc, 'dominance')),
@@ -1954,6 +1972,47 @@ function createPeriodAveragePricePattern(client, acc) {
1954
1972
  };
1955
1973
  }
1956
1974
 
1975
+ /**
1976
+ * @template T
1977
+ * @typedef {Object} ClassAveragePricePattern
1978
+ * @property {MetricPattern4<T>} _2015
1979
+ * @property {MetricPattern4<T>} _2016
1980
+ * @property {MetricPattern4<T>} _2017
1981
+ * @property {MetricPattern4<T>} _2018
1982
+ * @property {MetricPattern4<T>} _2019
1983
+ * @property {MetricPattern4<T>} _2020
1984
+ * @property {MetricPattern4<T>} _2021
1985
+ * @property {MetricPattern4<T>} _2022
1986
+ * @property {MetricPattern4<T>} _2023
1987
+ * @property {MetricPattern4<T>} _2024
1988
+ * @property {MetricPattern4<T>} _2025
1989
+ * @property {MetricPattern4<T>} _2026
1990
+ */
1991
+
1992
+ /**
1993
+ * Create a ClassAveragePricePattern pattern node
1994
+ * @template T
1995
+ * @param {BrkClientBase} client
1996
+ * @param {string} acc - Accumulated metric name
1997
+ * @returns {ClassAveragePricePattern<T>}
1998
+ */
1999
+ function createClassAveragePricePattern(client, acc) {
2000
+ return {
2001
+ _2015: createMetricPattern4(client, _m(acc, '2015_average_price')),
2002
+ _2016: createMetricPattern4(client, _m(acc, '2016_average_price')),
2003
+ _2017: createMetricPattern4(client, _m(acc, '2017_average_price')),
2004
+ _2018: createMetricPattern4(client, _m(acc, '2018_average_price')),
2005
+ _2019: createMetricPattern4(client, _m(acc, '2019_average_price')),
2006
+ _2020: createMetricPattern4(client, _m(acc, '2020_average_price')),
2007
+ _2021: createMetricPattern4(client, _m(acc, '2021_average_price')),
2008
+ _2022: createMetricPattern4(client, _m(acc, '2022_average_price')),
2009
+ _2023: createMetricPattern4(client, _m(acc, '2023_average_price')),
2010
+ _2024: createMetricPattern4(client, _m(acc, '2024_average_price')),
2011
+ _2025: createMetricPattern4(client, _m(acc, '2025_average_price')),
2012
+ _2026: createMetricPattern4(client, _m(acc, '2026_average_price')),
2013
+ };
2014
+ }
2015
+
1957
2016
  /**
1958
2017
  * @typedef {Object} BitcoinPattern
1959
2018
  * @property {MetricPattern2<Bitcoin>} average
@@ -1991,45 +2050,6 @@ function createBitcoinPattern(client, acc) {
1991
2050
  };
1992
2051
  }
1993
2052
 
1994
- /**
1995
- * @template T
1996
- * @typedef {Object} ClassAveragePricePattern
1997
- * @property {MetricPattern4<T>} _2015
1998
- * @property {MetricPattern4<T>} _2016
1999
- * @property {MetricPattern4<T>} _2017
2000
- * @property {MetricPattern4<T>} _2018
2001
- * @property {MetricPattern4<T>} _2019
2002
- * @property {MetricPattern4<T>} _2020
2003
- * @property {MetricPattern4<T>} _2021
2004
- * @property {MetricPattern4<T>} _2022
2005
- * @property {MetricPattern4<T>} _2023
2006
- * @property {MetricPattern4<T>} _2024
2007
- * @property {MetricPattern4<T>} _2025
2008
- */
2009
-
2010
- /**
2011
- * Create a ClassAveragePricePattern pattern node
2012
- * @template T
2013
- * @param {BrkClientBase} client
2014
- * @param {string} acc - Accumulated metric name
2015
- * @returns {ClassAveragePricePattern<T>}
2016
- */
2017
- function createClassAveragePricePattern(client, acc) {
2018
- return {
2019
- _2015: createMetricPattern4(client, _m(acc, '2015_returns')),
2020
- _2016: createMetricPattern4(client, _m(acc, '2016_returns')),
2021
- _2017: createMetricPattern4(client, _m(acc, '2017_returns')),
2022
- _2018: createMetricPattern4(client, _m(acc, '2018_returns')),
2023
- _2019: createMetricPattern4(client, _m(acc, '2019_returns')),
2024
- _2020: createMetricPattern4(client, _m(acc, '2020_returns')),
2025
- _2021: createMetricPattern4(client, _m(acc, '2021_returns')),
2026
- _2022: createMetricPattern4(client, _m(acc, '2022_returns')),
2027
- _2023: createMetricPattern4(client, _m(acc, '2023_returns')),
2028
- _2024: createMetricPattern4(client, _m(acc, '2024_returns')),
2029
- _2025: createMetricPattern4(client, _m(acc, '2025_returns')),
2030
- };
2031
- }
2032
-
2033
2053
  /**
2034
2054
  * @template T
2035
2055
  * @typedef {Object} DollarsPattern
@@ -2209,41 +2229,6 @@ function createAddrCountPattern(client, acc) {
2209
2229
  };
2210
2230
  }
2211
2231
 
2212
- /**
2213
- * @template T
2214
- * @typedef {Object} FullnessPattern
2215
- * @property {MetricPattern2<T>} average
2216
- * @property {MetricPattern11<T>} base
2217
- * @property {MetricPattern2<T>} max
2218
- * @property {MetricPattern6<T>} median
2219
- * @property {MetricPattern2<T>} min
2220
- * @property {MetricPattern6<T>} pct10
2221
- * @property {MetricPattern6<T>} pct25
2222
- * @property {MetricPattern6<T>} pct75
2223
- * @property {MetricPattern6<T>} pct90
2224
- */
2225
-
2226
- /**
2227
- * Create a FullnessPattern pattern node
2228
- * @template T
2229
- * @param {BrkClientBase} client
2230
- * @param {string} acc - Accumulated metric name
2231
- * @returns {FullnessPattern<T>}
2232
- */
2233
- function createFullnessPattern(client, acc) {
2234
- return {
2235
- average: createMetricPattern2(client, _m(acc, 'average')),
2236
- base: createMetricPattern11(client, acc),
2237
- max: createMetricPattern2(client, _m(acc, 'max')),
2238
- median: createMetricPattern6(client, _m(acc, 'median')),
2239
- min: createMetricPattern2(client, _m(acc, 'min')),
2240
- pct10: createMetricPattern6(client, _m(acc, 'pct10')),
2241
- pct25: createMetricPattern6(client, _m(acc, 'pct25')),
2242
- pct75: createMetricPattern6(client, _m(acc, 'pct75')),
2243
- pct90: createMetricPattern6(client, _m(acc, 'pct90')),
2244
- };
2245
- }
2246
-
2247
2232
  /**
2248
2233
  * @template T
2249
2234
  * @typedef {Object} FeeRatePattern
@@ -2279,6 +2264,41 @@ function createFeeRatePattern(client, acc) {
2279
2264
  };
2280
2265
  }
2281
2266
 
2267
+ /**
2268
+ * @template T
2269
+ * @typedef {Object} FullnessPattern
2270
+ * @property {MetricPattern2<T>} average
2271
+ * @property {MetricPattern11<T>} base
2272
+ * @property {MetricPattern2<T>} max
2273
+ * @property {MetricPattern6<T>} median
2274
+ * @property {MetricPattern2<T>} min
2275
+ * @property {MetricPattern6<T>} pct10
2276
+ * @property {MetricPattern6<T>} pct25
2277
+ * @property {MetricPattern6<T>} pct75
2278
+ * @property {MetricPattern6<T>} pct90
2279
+ */
2280
+
2281
+ /**
2282
+ * Create a FullnessPattern pattern node
2283
+ * @template T
2284
+ * @param {BrkClientBase} client
2285
+ * @param {string} acc - Accumulated metric name
2286
+ * @returns {FullnessPattern<T>}
2287
+ */
2288
+ function createFullnessPattern(client, acc) {
2289
+ return {
2290
+ average: createMetricPattern2(client, _m(acc, 'average')),
2291
+ base: createMetricPattern11(client, acc),
2292
+ max: createMetricPattern2(client, _m(acc, 'max')),
2293
+ median: createMetricPattern6(client, _m(acc, 'median')),
2294
+ min: createMetricPattern2(client, _m(acc, 'min')),
2295
+ pct10: createMetricPattern6(client, _m(acc, 'pct10')),
2296
+ pct25: createMetricPattern6(client, _m(acc, 'pct25')),
2297
+ pct75: createMetricPattern6(client, _m(acc, 'pct75')),
2298
+ pct90: createMetricPattern6(client, _m(acc, 'pct90')),
2299
+ };
2300
+ }
2301
+
2282
2302
  /**
2283
2303
  * @typedef {Object} _0satsPattern
2284
2304
  * @property {ActivityPattern2} activity
@@ -2311,60 +2331,64 @@ function create_0satsPattern(client, acc) {
2311
2331
  }
2312
2332
 
2313
2333
  /**
2314
- * @typedef {Object} _100btcPattern
2315
- * @property {ActivityPattern2} activity
2316
- * @property {CostBasisPattern} costBasis
2317
- * @property {OutputsPattern} outputs
2318
- * @property {RealizedPattern} realized
2319
- * @property {RelativePattern} relative
2320
- * @property {SupplyPattern2} supply
2321
- * @property {UnrealizedPattern} unrealized
2334
+ * @template T
2335
+ * @typedef {Object} PhaseDailyCentsPattern
2336
+ * @property {MetricPattern6<T>} average
2337
+ * @property {MetricPattern6<T>} max
2338
+ * @property {MetricPattern6<T>} median
2339
+ * @property {MetricPattern6<T>} min
2340
+ * @property {MetricPattern6<T>} pct10
2341
+ * @property {MetricPattern6<T>} pct25
2342
+ * @property {MetricPattern6<T>} pct75
2343
+ * @property {MetricPattern6<T>} pct90
2322
2344
  */
2323
2345
 
2324
2346
  /**
2325
- * Create a _100btcPattern pattern node
2347
+ * Create a PhaseDailyCentsPattern pattern node
2348
+ * @template T
2326
2349
  * @param {BrkClientBase} client
2327
2350
  * @param {string} acc - Accumulated metric name
2328
- * @returns {_100btcPattern}
2351
+ * @returns {PhaseDailyCentsPattern<T>}
2329
2352
  */
2330
- function create_100btcPattern(client, acc) {
2353
+ function createPhaseDailyCentsPattern(client, acc) {
2331
2354
  return {
2332
- activity: createActivityPattern2(client, acc),
2333
- costBasis: createCostBasisPattern(client, acc),
2334
- outputs: createOutputsPattern(client, _m(acc, 'utxo_count')),
2335
- realized: createRealizedPattern(client, acc),
2336
- relative: createRelativePattern(client, acc),
2337
- supply: createSupplyPattern2(client, _m(acc, 'supply')),
2338
- unrealized: createUnrealizedPattern(client, acc),
2355
+ average: createMetricPattern6(client, _m(acc, 'average')),
2356
+ max: createMetricPattern6(client, _m(acc, 'max')),
2357
+ median: createMetricPattern6(client, _m(acc, 'median')),
2358
+ min: createMetricPattern6(client, _m(acc, 'min')),
2359
+ pct10: createMetricPattern6(client, _m(acc, 'pct10')),
2360
+ pct25: createMetricPattern6(client, _m(acc, 'pct25')),
2361
+ pct75: createMetricPattern6(client, _m(acc, 'pct75')),
2362
+ pct90: createMetricPattern6(client, _m(acc, 'pct90')),
2339
2363
  };
2340
2364
  }
2341
2365
 
2342
2366
  /**
2343
- * @typedef {Object} PeriodCagrPattern
2344
- * @property {MetricPattern4<StoredF32>} _10y
2345
- * @property {MetricPattern4<StoredF32>} _2y
2346
- * @property {MetricPattern4<StoredF32>} _3y
2347
- * @property {MetricPattern4<StoredF32>} _4y
2348
- * @property {MetricPattern4<StoredF32>} _5y
2349
- * @property {MetricPattern4<StoredF32>} _6y
2350
- * @property {MetricPattern4<StoredF32>} _8y
2367
+ * @typedef {Object} _10yTo12yPattern
2368
+ * @property {ActivityPattern2} activity
2369
+ * @property {CostBasisPattern2} costBasis
2370
+ * @property {OutputsPattern} outputs
2371
+ * @property {RealizedPattern2} realized
2372
+ * @property {RelativePattern2} relative
2373
+ * @property {SupplyPattern2} supply
2374
+ * @property {UnrealizedPattern} unrealized
2351
2375
  */
2352
2376
 
2353
2377
  /**
2354
- * Create a PeriodCagrPattern pattern node
2378
+ * Create a _10yTo12yPattern pattern node
2355
2379
  * @param {BrkClientBase} client
2356
2380
  * @param {string} acc - Accumulated metric name
2357
- * @returns {PeriodCagrPattern}
2381
+ * @returns {_10yTo12yPattern}
2358
2382
  */
2359
- function createPeriodCagrPattern(client, acc) {
2383
+ function create_10yTo12yPattern(client, acc) {
2360
2384
  return {
2361
- _10y: createMetricPattern4(client, _p('10y', acc)),
2362
- _2y: createMetricPattern4(client, _p('2y', acc)),
2363
- _3y: createMetricPattern4(client, _p('3y', acc)),
2364
- _4y: createMetricPattern4(client, _p('4y', acc)),
2365
- _5y: createMetricPattern4(client, _p('5y', acc)),
2366
- _6y: createMetricPattern4(client, _p('6y', acc)),
2367
- _8y: createMetricPattern4(client, _p('8y', acc)),
2385
+ activity: createActivityPattern2(client, acc),
2386
+ costBasis: createCostBasisPattern2(client, acc),
2387
+ outputs: createOutputsPattern(client, _m(acc, 'utxo_count')),
2388
+ realized: createRealizedPattern2(client, acc),
2389
+ relative: createRelativePattern2(client, acc),
2390
+ supply: createSupplyPattern2(client, _m(acc, 'supply')),
2391
+ unrealized: createUnrealizedPattern(client, acc),
2368
2392
  };
2369
2393
  }
2370
2394
 
@@ -2398,86 +2422,115 @@ function createUnrealizedPattern(client, acc) {
2398
2422
  }
2399
2423
 
2400
2424
  /**
2401
- * @typedef {Object} _10yTo12yPattern
2425
+ * @typedef {Object} _0satsPattern2
2402
2426
  * @property {ActivityPattern2} activity
2403
- * @property {CostBasisPattern2} costBasis
2427
+ * @property {CostBasisPattern} costBasis
2404
2428
  * @property {OutputsPattern} outputs
2405
- * @property {RealizedPattern2} realized
2406
- * @property {RelativePattern2} relative
2429
+ * @property {RealizedPattern} realized
2430
+ * @property {RelativePattern4} relative
2407
2431
  * @property {SupplyPattern2} supply
2408
2432
  * @property {UnrealizedPattern} unrealized
2409
2433
  */
2410
2434
 
2411
2435
  /**
2412
- * Create a _10yTo12yPattern pattern node
2436
+ * Create a _0satsPattern2 pattern node
2413
2437
  * @param {BrkClientBase} client
2414
2438
  * @param {string} acc - Accumulated metric name
2415
- * @returns {_10yTo12yPattern}
2439
+ * @returns {_0satsPattern2}
2416
2440
  */
2417
- function create_10yTo12yPattern(client, acc) {
2441
+ function create_0satsPattern2(client, acc) {
2418
2442
  return {
2419
2443
  activity: createActivityPattern2(client, acc),
2420
- costBasis: createCostBasisPattern2(client, acc),
2444
+ costBasis: createCostBasisPattern(client, acc),
2421
2445
  outputs: createOutputsPattern(client, _m(acc, 'utxo_count')),
2422
- realized: createRealizedPattern2(client, acc),
2423
- relative: createRelativePattern2(client, acc),
2446
+ realized: createRealizedPattern(client, acc),
2447
+ relative: createRelativePattern4(client, _m(acc, 'supply_in')),
2424
2448
  supply: createSupplyPattern2(client, _m(acc, 'supply')),
2425
2449
  unrealized: createUnrealizedPattern(client, acc),
2426
2450
  };
2427
2451
  }
2428
2452
 
2429
2453
  /**
2430
- * @typedef {Object} _0satsPattern2
2454
+ * @typedef {Object} PeriodCagrPattern
2455
+ * @property {MetricPattern4<StoredF32>} _10y
2456
+ * @property {MetricPattern4<StoredF32>} _2y
2457
+ * @property {MetricPattern4<StoredF32>} _3y
2458
+ * @property {MetricPattern4<StoredF32>} _4y
2459
+ * @property {MetricPattern4<StoredF32>} _5y
2460
+ * @property {MetricPattern4<StoredF32>} _6y
2461
+ * @property {MetricPattern4<StoredF32>} _8y
2462
+ */
2463
+
2464
+ /**
2465
+ * Create a PeriodCagrPattern pattern node
2466
+ * @param {BrkClientBase} client
2467
+ * @param {string} acc - Accumulated metric name
2468
+ * @returns {PeriodCagrPattern}
2469
+ */
2470
+ function createPeriodCagrPattern(client, acc) {
2471
+ return {
2472
+ _10y: createMetricPattern4(client, _p('10y', acc)),
2473
+ _2y: createMetricPattern4(client, _p('2y', acc)),
2474
+ _3y: createMetricPattern4(client, _p('3y', acc)),
2475
+ _4y: createMetricPattern4(client, _p('4y', acc)),
2476
+ _5y: createMetricPattern4(client, _p('5y', acc)),
2477
+ _6y: createMetricPattern4(client, _p('6y', acc)),
2478
+ _8y: createMetricPattern4(client, _p('8y', acc)),
2479
+ };
2480
+ }
2481
+
2482
+ /**
2483
+ * @typedef {Object} _10yPattern
2431
2484
  * @property {ActivityPattern2} activity
2432
2485
  * @property {CostBasisPattern} costBasis
2433
2486
  * @property {OutputsPattern} outputs
2434
- * @property {RealizedPattern} realized
2435
- * @property {RelativePattern4} relative
2487
+ * @property {RealizedPattern4} realized
2488
+ * @property {RelativePattern} relative
2436
2489
  * @property {SupplyPattern2} supply
2437
2490
  * @property {UnrealizedPattern} unrealized
2438
2491
  */
2439
2492
 
2440
2493
  /**
2441
- * Create a _0satsPattern2 pattern node
2494
+ * Create a _10yPattern pattern node
2442
2495
  * @param {BrkClientBase} client
2443
2496
  * @param {string} acc - Accumulated metric name
2444
- * @returns {_0satsPattern2}
2497
+ * @returns {_10yPattern}
2445
2498
  */
2446
- function create_0satsPattern2(client, acc) {
2499
+ function create_10yPattern(client, acc) {
2447
2500
  return {
2448
2501
  activity: createActivityPattern2(client, acc),
2449
2502
  costBasis: createCostBasisPattern(client, acc),
2450
2503
  outputs: createOutputsPattern(client, _m(acc, 'utxo_count')),
2451
- realized: createRealizedPattern(client, acc),
2452
- relative: createRelativePattern4(client, _m(acc, 'supply_in')),
2504
+ realized: createRealizedPattern4(client, acc),
2505
+ relative: createRelativePattern(client, acc),
2453
2506
  supply: createSupplyPattern2(client, _m(acc, 'supply')),
2454
2507
  unrealized: createUnrealizedPattern(client, acc),
2455
2508
  };
2456
2509
  }
2457
2510
 
2458
2511
  /**
2459
- * @typedef {Object} _10yPattern
2512
+ * @typedef {Object} _100btcPattern
2460
2513
  * @property {ActivityPattern2} activity
2461
2514
  * @property {CostBasisPattern} costBasis
2462
2515
  * @property {OutputsPattern} outputs
2463
- * @property {RealizedPattern4} realized
2516
+ * @property {RealizedPattern} realized
2464
2517
  * @property {RelativePattern} relative
2465
2518
  * @property {SupplyPattern2} supply
2466
2519
  * @property {UnrealizedPattern} unrealized
2467
2520
  */
2468
2521
 
2469
2522
  /**
2470
- * Create a _10yPattern pattern node
2523
+ * Create a _100btcPattern pattern node
2471
2524
  * @param {BrkClientBase} client
2472
2525
  * @param {string} acc - Accumulated metric name
2473
- * @returns {_10yPattern}
2526
+ * @returns {_100btcPattern}
2474
2527
  */
2475
- function create_10yPattern(client, acc) {
2528
+ function create_100btcPattern(client, acc) {
2476
2529
  return {
2477
2530
  activity: createActivityPattern2(client, acc),
2478
2531
  costBasis: createCostBasisPattern(client, acc),
2479
2532
  outputs: createOutputsPattern(client, _m(acc, 'utxo_count')),
2480
- realized: createRealizedPattern4(client, acc),
2533
+ realized: createRealizedPattern(client, acc),
2481
2534
  relative: createRelativePattern(client, acc),
2482
2535
  supply: createSupplyPattern2(client, _m(acc, 'supply')),
2483
2536
  unrealized: createUnrealizedPattern(client, acc),
@@ -2535,23 +2588,23 @@ function createSplitPattern2(client, acc) {
2535
2588
  }
2536
2589
 
2537
2590
  /**
2538
- * @typedef {Object} _2015Pattern
2539
- * @property {MetricPattern4<Bitcoin>} bitcoin
2540
- * @property {MetricPattern4<Dollars>} dollars
2541
- * @property {MetricPattern4<Sats>} sats
2591
+ * @typedef {Object} UnclaimedRewardsPattern
2592
+ * @property {BitcoinPattern2<Bitcoin>} bitcoin
2593
+ * @property {BlockCountPattern<Dollars>} dollars
2594
+ * @property {BlockCountPattern<Sats>} sats
2542
2595
  */
2543
2596
 
2544
2597
  /**
2545
- * Create a _2015Pattern pattern node
2598
+ * Create a UnclaimedRewardsPattern pattern node
2546
2599
  * @param {BrkClientBase} client
2547
2600
  * @param {string} acc - Accumulated metric name
2548
- * @returns {_2015Pattern}
2601
+ * @returns {UnclaimedRewardsPattern}
2549
2602
  */
2550
- function create_2015Pattern(client, acc) {
2603
+ function createUnclaimedRewardsPattern(client, acc) {
2551
2604
  return {
2552
- bitcoin: createMetricPattern4(client, _m(acc, 'btc')),
2553
- dollars: createMetricPattern4(client, _m(acc, 'usd')),
2554
- sats: createMetricPattern4(client, acc),
2605
+ bitcoin: createBitcoinPattern2(client, _m(acc, 'btc')),
2606
+ dollars: createBlockCountPattern(client, _m(acc, 'usd')),
2607
+ sats: createBlockCountPattern(client, acc),
2555
2608
  };
2556
2609
  }
2557
2610
 
@@ -2576,27 +2629,6 @@ function createCoinbasePattern(client, acc) {
2576
2629
  };
2577
2630
  }
2578
2631
 
2579
- /**
2580
- * @typedef {Object} CoinbasePattern2
2581
- * @property {BlockCountPattern<Bitcoin>} bitcoin
2582
- * @property {BlockCountPattern<Dollars>} dollars
2583
- * @property {BlockCountPattern<Sats>} sats
2584
- */
2585
-
2586
- /**
2587
- * Create a CoinbasePattern2 pattern node
2588
- * @param {BrkClientBase} client
2589
- * @param {string} acc - Accumulated metric name
2590
- * @returns {CoinbasePattern2}
2591
- */
2592
- function createCoinbasePattern2(client, acc) {
2593
- return {
2594
- bitcoin: createBlockCountPattern(client, _m(acc, 'btc')),
2595
- dollars: createBlockCountPattern(client, _m(acc, 'usd')),
2596
- sats: createBlockCountPattern(client, acc),
2597
- };
2598
- }
2599
-
2600
2632
  /**
2601
2633
  * @typedef {Object} SegwitAdoptionPattern
2602
2634
  * @property {MetricPattern11<StoredF32>} base
@@ -2661,26 +2693,66 @@ function createActiveSupplyPattern(client, acc) {
2661
2693
  }
2662
2694
 
2663
2695
  /**
2664
- * @typedef {Object} UnclaimedRewardsPattern
2665
- * @property {BitcoinPattern2<Bitcoin>} bitcoin
2696
+ * @typedef {Object} _2015Pattern
2697
+ * @property {MetricPattern4<Bitcoin>} bitcoin
2698
+ * @property {MetricPattern4<Dollars>} dollars
2699
+ * @property {MetricPattern4<Sats>} sats
2700
+ */
2701
+
2702
+ /**
2703
+ * Create a _2015Pattern pattern node
2704
+ * @param {BrkClientBase} client
2705
+ * @param {string} acc - Accumulated metric name
2706
+ * @returns {_2015Pattern}
2707
+ */
2708
+ function create_2015Pattern(client, acc) {
2709
+ return {
2710
+ bitcoin: createMetricPattern4(client, _m(acc, 'btc')),
2711
+ dollars: createMetricPattern4(client, _m(acc, 'usd')),
2712
+ sats: createMetricPattern4(client, acc),
2713
+ };
2714
+ }
2715
+
2716
+ /**
2717
+ * @typedef {Object} CoinbasePattern2
2718
+ * @property {BlockCountPattern<Bitcoin>} bitcoin
2666
2719
  * @property {BlockCountPattern<Dollars>} dollars
2667
2720
  * @property {BlockCountPattern<Sats>} sats
2668
2721
  */
2669
2722
 
2670
2723
  /**
2671
- * Create a UnclaimedRewardsPattern pattern node
2724
+ * Create a CoinbasePattern2 pattern node
2672
2725
  * @param {BrkClientBase} client
2673
2726
  * @param {string} acc - Accumulated metric name
2674
- * @returns {UnclaimedRewardsPattern}
2727
+ * @returns {CoinbasePattern2}
2675
2728
  */
2676
- function createUnclaimedRewardsPattern(client, acc) {
2729
+ function createCoinbasePattern2(client, acc) {
2677
2730
  return {
2678
- bitcoin: createBitcoinPattern2(client, _m(acc, 'btc')),
2731
+ bitcoin: createBlockCountPattern(client, _m(acc, 'btc')),
2679
2732
  dollars: createBlockCountPattern(client, _m(acc, 'usd')),
2680
2733
  sats: createBlockCountPattern(client, acc),
2681
2734
  };
2682
2735
  }
2683
2736
 
2737
+ /**
2738
+ * @typedef {Object} _1dReturns1mSdPattern
2739
+ * @property {MetricPattern4<StoredF32>} sd
2740
+ * @property {MetricPattern4<StoredF32>} sma
2741
+ */
2742
+
2743
+ /**
2744
+ * Create a _1dReturns1mSdPattern pattern node
2745
+ * @param {BrkClientBase} client
2746
+ * @param {string} acc - Accumulated metric name
2747
+ * @returns {_1dReturns1mSdPattern}
2748
+ */
2749
+ function create_1dReturns1mSdPattern(client, acc) {
2750
+ return {
2751
+ sd: createMetricPattern4(client, _m(acc, 'sd')),
2752
+ sma: createMetricPattern4(client, _m(acc, 'sma')),
2753
+ };
2754
+ }
2755
+
2684
2756
  /**
2685
2757
  * @typedef {Object} CostBasisPattern
2686
2758
  * @property {MetricPattern1<Dollars>} max
@@ -2738,46 +2810,6 @@ function createRelativePattern4(client, acc) {
2738
2810
  };
2739
2811
  }
2740
2812
 
2741
- /**
2742
- * @typedef {Object} _1dReturns1mSdPattern
2743
- * @property {MetricPattern4<StoredF32>} sd
2744
- * @property {MetricPattern4<StoredF32>} sma
2745
- */
2746
-
2747
- /**
2748
- * Create a _1dReturns1mSdPattern pattern node
2749
- * @param {BrkClientBase} client
2750
- * @param {string} acc - Accumulated metric name
2751
- * @returns {_1dReturns1mSdPattern}
2752
- */
2753
- function create_1dReturns1mSdPattern(client, acc) {
2754
- return {
2755
- sd: createMetricPattern4(client, _m(acc, 'sd')),
2756
- sma: createMetricPattern4(client, _m(acc, 'sma')),
2757
- };
2758
- }
2759
-
2760
- /**
2761
- * @template T
2762
- * @typedef {Object} BlockCountPattern
2763
- * @property {MetricPattern1<T>} cumulative
2764
- * @property {MetricPattern1<T>} sum
2765
- */
2766
-
2767
- /**
2768
- * Create a BlockCountPattern pattern node
2769
- * @template T
2770
- * @param {BrkClientBase} client
2771
- * @param {string} acc - Accumulated metric name
2772
- * @returns {BlockCountPattern<T>}
2773
- */
2774
- function createBlockCountPattern(client, acc) {
2775
- return {
2776
- cumulative: createMetricPattern1(client, _m(acc, 'cumulative')),
2777
- sum: createMetricPattern1(client, acc),
2778
- };
2779
- }
2780
-
2781
2813
  /**
2782
2814
  * @template T
2783
2815
  * @typedef {Object} BitcoinPattern2
@@ -2815,25 +2847,29 @@ function createBitcoinPattern2(client, acc) {
2815
2847
  */
2816
2848
  function createSatsPattern(client, acc) {
2817
2849
  return {
2818
- ohlc: createMetricPattern1(client, _m(acc, 'ohlc_sats')),
2819
- split: createSplitPattern2(client, _m(acc, 'sats')),
2850
+ ohlc: createMetricPattern1(client, _m(acc, 'ohlc')),
2851
+ split: createSplitPattern2(client, acc),
2820
2852
  };
2821
2853
  }
2822
2854
 
2823
2855
  /**
2824
- * @typedef {Object} RealizedPriceExtraPattern
2825
- * @property {MetricPattern4<StoredF32>} ratio
2856
+ * @template T
2857
+ * @typedef {Object} BlockCountPattern
2858
+ * @property {MetricPattern1<T>} cumulative
2859
+ * @property {MetricPattern1<T>} sum
2826
2860
  */
2827
2861
 
2828
2862
  /**
2829
- * Create a RealizedPriceExtraPattern pattern node
2863
+ * Create a BlockCountPattern pattern node
2864
+ * @template T
2830
2865
  * @param {BrkClientBase} client
2831
2866
  * @param {string} acc - Accumulated metric name
2832
- * @returns {RealizedPriceExtraPattern}
2867
+ * @returns {BlockCountPattern<T>}
2833
2868
  */
2834
- function createRealizedPriceExtraPattern(client, acc) {
2869
+ function createBlockCountPattern(client, acc) {
2835
2870
  return {
2836
- ratio: createMetricPattern4(client, acc),
2871
+ cumulative: createMetricPattern1(client, _m(acc, 'cumulative')),
2872
+ sum: createMetricPattern1(client, acc),
2837
2873
  };
2838
2874
  }
2839
2875
 
@@ -2854,6 +2890,23 @@ function createOutputsPattern(client, acc) {
2854
2890
  };
2855
2891
  }
2856
2892
 
2893
+ /**
2894
+ * @typedef {Object} RealizedPriceExtraPattern
2895
+ * @property {MetricPattern4<StoredF32>} ratio
2896
+ */
2897
+
2898
+ /**
2899
+ * Create a RealizedPriceExtraPattern pattern node
2900
+ * @param {BrkClientBase} client
2901
+ * @param {string} acc - Accumulated metric name
2902
+ * @returns {RealizedPriceExtraPattern}
2903
+ */
2904
+ function createRealizedPriceExtraPattern(client, acc) {
2905
+ return {
2906
+ ratio: createMetricPattern4(client, acc),
2907
+ };
2908
+ }
2909
+
2857
2910
  // Catalog tree typedefs
2858
2911
 
2859
2912
  /**
@@ -3007,6 +3060,7 @@ function createOutputsPattern(client, acc) {
3007
3060
  * @property {MetricsTree_Cointime_Adjusted} adjusted
3008
3061
  * @property {MetricsTree_Cointime_Cap} cap
3009
3062
  * @property {MetricsTree_Cointime_Pricing} pricing
3063
+ * @property {MetricsTree_Cointime_ReserveRisk} reserveRisk
3010
3064
  * @property {MetricsTree_Cointime_Supply} supply
3011
3065
  * @property {MetricsTree_Cointime_Value} value
3012
3066
  */
@@ -3048,6 +3102,13 @@ function createOutputsPattern(client, acc) {
3048
3102
  * @property {ActivePriceRatioPattern} vaultedPriceRatio
3049
3103
  */
3050
3104
 
3105
+ /**
3106
+ * @typedef {Object} MetricsTree_Cointime_ReserveRisk
3107
+ * @property {MetricPattern6<StoredF64>} hodlBank
3108
+ * @property {MetricPattern4<StoredF64>} reserveRisk
3109
+ * @property {MetricPattern6<StoredF64>} vocdd365dSma
3110
+ */
3111
+
3051
3112
  /**
3052
3113
  * @typedef {Object} MetricsTree_Cointime_Supply
3053
3114
  * @property {ActiveSupplyPattern} activeSupply
@@ -3059,6 +3120,7 @@ function createOutputsPattern(client, acc) {
3059
3120
  * @property {BlockCountPattern<StoredF64>} cointimeValueCreated
3060
3121
  * @property {BlockCountPattern<StoredF64>} cointimeValueDestroyed
3061
3122
  * @property {BlockCountPattern<StoredF64>} cointimeValueStored
3123
+ * @property {BlockCountPattern<StoredF64>} vocdd
3062
3124
  */
3063
3125
 
3064
3126
  /**
@@ -3077,10 +3139,10 @@ function createOutputsPattern(client, acc) {
3077
3139
  * @property {MetricPattern1<StoredF32>} constant618
3078
3140
  * @property {MetricPattern1<StoredU16>} constant70
3079
3141
  * @property {MetricPattern1<StoredU16>} constant80
3080
- * @property {MetricPattern1<StoredI16>} constantMinus1
3081
- * @property {MetricPattern1<StoredI16>} constantMinus2
3082
- * @property {MetricPattern1<StoredI16>} constantMinus3
3083
- * @property {MetricPattern1<StoredI16>} constantMinus4
3142
+ * @property {MetricPattern1<StoredI8>} constantMinus1
3143
+ * @property {MetricPattern1<StoredI8>} constantMinus2
3144
+ * @property {MetricPattern1<StoredI8>} constantMinus3
3145
+ * @property {MetricPattern1<StoredI8>} constantMinus4
3084
3146
  */
3085
3147
 
3086
3148
  /**
@@ -3649,8 +3711,8 @@ function createOutputsPattern(client, acc) {
3649
3711
 
3650
3712
  /**
3651
3713
  * @typedef {Object} MetricsTree_Market_Dca
3652
- * @property {MetricsTree_Market_Dca_ClassAveragePrice} classAveragePrice
3653
- * @property {ClassAveragePricePattern<StoredF32>} classReturns
3714
+ * @property {ClassAveragePricePattern<Dollars>} classAveragePrice
3715
+ * @property {MetricsTree_Market_Dca_ClassReturns} classReturns
3654
3716
  * @property {MetricsTree_Market_Dca_ClassStack} classStack
3655
3717
  * @property {PeriodAveragePricePattern<Dollars>} periodAveragePrice
3656
3718
  * @property {PeriodCagrPattern} periodCagr
@@ -3660,18 +3722,19 @@ function createOutputsPattern(client, acc) {
3660
3722
  */
3661
3723
 
3662
3724
  /**
3663
- * @typedef {Object} MetricsTree_Market_Dca_ClassAveragePrice
3664
- * @property {MetricPattern4<Dollars>} _2015
3665
- * @property {MetricPattern4<Dollars>} _2016
3666
- * @property {MetricPattern4<Dollars>} _2017
3667
- * @property {MetricPattern4<Dollars>} _2018
3668
- * @property {MetricPattern4<Dollars>} _2019
3669
- * @property {MetricPattern4<Dollars>} _2020
3670
- * @property {MetricPattern4<Dollars>} _2021
3671
- * @property {MetricPattern4<Dollars>} _2022
3672
- * @property {MetricPattern4<Dollars>} _2023
3673
- * @property {MetricPattern4<Dollars>} _2024
3674
- * @property {MetricPattern4<Dollars>} _2025
3725
+ * @typedef {Object} MetricsTree_Market_Dca_ClassReturns
3726
+ * @property {MetricPattern4<StoredF32>} _2015
3727
+ * @property {MetricPattern4<StoredF32>} _2016
3728
+ * @property {MetricPattern4<StoredF32>} _2017
3729
+ * @property {MetricPattern4<StoredF32>} _2018
3730
+ * @property {MetricPattern4<StoredF32>} _2019
3731
+ * @property {MetricPattern4<StoredF32>} _2020
3732
+ * @property {MetricPattern4<StoredF32>} _2021
3733
+ * @property {MetricPattern4<StoredF32>} _2022
3734
+ * @property {MetricPattern4<StoredF32>} _2023
3735
+ * @property {MetricPattern4<StoredF32>} _2024
3736
+ * @property {MetricPattern4<StoredF32>} _2025
3737
+ * @property {MetricPattern4<StoredF32>} _2026
3675
3738
  */
3676
3739
 
3677
3740
  /**
@@ -3687,6 +3750,7 @@ function createOutputsPattern(client, acc) {
3687
3750
  * @property {_2015Pattern} _2023
3688
3751
  * @property {_2015Pattern} _2024
3689
3752
  * @property {_2015Pattern} _2025
3753
+ * @property {_2015Pattern} _2026
3690
3754
  */
3691
3755
 
3692
3756
  /**
@@ -4009,8 +4073,8 @@ function createOutputsPattern(client, acc) {
4009
4073
  * @typedef {Object} MetricsTree_Price
4010
4074
  * @property {MetricsTree_Price_Cents} cents
4011
4075
  * @property {MetricsTree_Price_Oracle} oracle
4012
- * @property {SatsPattern<OHLCSats>} sats
4013
- * @property {MetricsTree_Price_Usd} usd
4076
+ * @property {MetricsTree_Price_Sats} sats
4077
+ * @property {SatsPattern<OHLCDollars>} usd
4014
4078
  */
4015
4079
 
4016
4080
  /**
@@ -4029,16 +4093,42 @@ function createOutputsPattern(client, acc) {
4029
4093
 
4030
4094
  /**
4031
4095
  * @typedef {Object} MetricsTree_Price_Oracle
4096
+ * @property {MetricPattern6<OHLCCents>} closeOhlcCents
4097
+ * @property {MetricPattern6<OHLCDollars>} closeOhlcDollars
4098
+ * @property {MetricPattern11<PairOutputIndex>} heightToFirstPairoutputindex
4099
+ * @property {MetricPattern6<OHLCCents>} midOhlcCents
4100
+ * @property {MetricPattern6<OHLCDollars>} midOhlcDollars
4032
4101
  * @property {MetricPattern6<OHLCCents>} ohlcCents
4033
4102
  * @property {MetricPattern6<OHLCDollars>} ohlcDollars
4103
+ * @property {MetricPattern33<Sats>} output0Value
4104
+ * @property {MetricPattern33<Sats>} output1Value
4105
+ * @property {MetricPattern33<TxIndex>} pairoutputindexToTxindex
4106
+ * @property {PhaseDailyCentsPattern<Cents>} phaseDailyCents
4107
+ * @property {PhaseDailyCentsPattern<Dollars>} phaseDailyDollars
4108
+ * @property {MetricPattern11<OracleBins>} phaseHistogram
4109
+ * @property {MetricPattern11<Cents>} phasePriceCents
4110
+ * @property {PhaseDailyCentsPattern<Cents>} phaseV2DailyCents
4111
+ * @property {PhaseDailyCentsPattern<Dollars>} phaseV2DailyDollars
4112
+ * @property {MetricPattern11<OracleBinsV2>} phaseV2Histogram
4113
+ * @property {PhaseDailyCentsPattern<Cents>} phaseV2PeakDailyCents
4114
+ * @property {PhaseDailyCentsPattern<Dollars>} phaseV2PeakDailyDollars
4115
+ * @property {MetricPattern11<Cents>} phaseV2PeakPriceCents
4116
+ * @property {MetricPattern11<Cents>} phaseV2PriceCents
4117
+ * @property {PhaseDailyCentsPattern<Cents>} phaseV3DailyCents
4118
+ * @property {PhaseDailyCentsPattern<Dollars>} phaseV3DailyDollars
4119
+ * @property {MetricPattern11<OracleBinsV2>} phaseV3Histogram
4120
+ * @property {PhaseDailyCentsPattern<Cents>} phaseV3PeakDailyCents
4121
+ * @property {PhaseDailyCentsPattern<Dollars>} phaseV3PeakDailyDollars
4122
+ * @property {MetricPattern11<Cents>} phaseV3PeakPriceCents
4123
+ * @property {MetricPattern11<Cents>} phaseV3PriceCents
4034
4124
  * @property {MetricPattern11<Cents>} priceCents
4035
4125
  * @property {MetricPattern6<StoredU32>} txCount
4036
4126
  */
4037
4127
 
4038
4128
  /**
4039
- * @typedef {Object} MetricsTree_Price_Usd
4040
- * @property {MetricPattern1<OHLCDollars>} ohlc
4041
- * @property {SplitPattern2<Dollars>} split
4129
+ * @typedef {Object} MetricsTree_Price_Sats
4130
+ * @property {MetricPattern1<OHLCSats>} ohlc
4131
+ * @property {SplitPattern2<Sats>} split
4042
4132
  */
4043
4133
 
4044
4134
  /**
@@ -4181,6 +4271,7 @@ function createOutputsPattern(client, acc) {
4181
4271
  * @property {_2015Pattern} annualizedVolume
4182
4272
  * @property {MetricPattern4<StoredF32>} inputsPerSec
4183
4273
  * @property {MetricPattern4<StoredF32>} outputsPerSec
4274
+ * @property {ActiveSupplyPattern} receivedSum
4184
4275
  * @property {ActiveSupplyPattern} sentSum
4185
4276
  * @property {MetricPattern4<StoredF32>} txPerSec
4186
4277
  */
@@ -4190,7 +4281,7 @@ function createOutputsPattern(client, acc) {
4190
4281
  * @extends BrkClientBase
4191
4282
  */
4192
4283
  class BrkClient extends BrkClientBase {
4193
- VERSION = "v0.1.0-alpha.2";
4284
+ VERSION = "v0.1.0-alpha.6";
4194
4285
 
4195
4286
  INDEXES = /** @type {const} */ ([
4196
4287
  "dateindex",
@@ -4219,7 +4310,8 @@ class BrkClient extends BrkClientBase {
4219
4310
  "weekindex",
4220
4311
  "yearindex",
4221
4312
  "loadedaddressindex",
4222
- "emptyaddressindex"
4313
+ "emptyaddressindex",
4314
+ "pairoutputindex"
4223
4315
  ]);
4224
4316
 
4225
4317
  POOL_ID_TO_POOL_NAME = /** @type {const} */ ({
@@ -5227,6 +5319,11 @@ class BrkClient extends BrkClientBase {
5227
5319
  vaultedPrice: createMetricPattern1(this, 'vaulted_price'),
5228
5320
  vaultedPriceRatio: createActivePriceRatioPattern(this, 'vaulted_price_ratio'),
5229
5321
  },
5322
+ reserveRisk: {
5323
+ hodlBank: createMetricPattern6(this, 'hodl_bank'),
5324
+ reserveRisk: createMetricPattern4(this, 'reserve_risk'),
5325
+ vocdd365dSma: createMetricPattern6(this, 'vocdd_365d_sma'),
5326
+ },
5230
5327
  supply: {
5231
5328
  activeSupply: createActiveSupplyPattern(this, 'active_supply'),
5232
5329
  vaultedSupply: createActiveSupplyPattern(this, 'vaulted_supply'),
@@ -5235,6 +5332,7 @@ class BrkClient extends BrkClientBase {
5235
5332
  cointimeValueCreated: createBlockCountPattern(this, 'cointime_value_created'),
5236
5333
  cointimeValueDestroyed: createBlockCountPattern(this, 'cointime_value_destroyed'),
5237
5334
  cointimeValueStored: createBlockCountPattern(this, 'cointime_value_stored'),
5335
+ vocdd: createBlockCountPattern(this, 'vocdd'),
5238
5336
  },
5239
5337
  },
5240
5338
  constants: {
@@ -5582,7 +5680,7 @@ class BrkClient extends BrkClientBase {
5582
5680
  identity: createMetricPattern10(this, 'halvingepoch'),
5583
5681
  },
5584
5682
  height: {
5585
- dateindex: createMetricPattern11(this, 'height_dateindex'),
5683
+ dateindex: createMetricPattern11(this, 'dateindex'),
5586
5684
  difficultyepoch: createMetricPattern11(this, 'difficultyepoch'),
5587
5685
  halvingepoch: createMetricPattern11(this, 'halvingepoch'),
5588
5686
  identity: createMetricPattern11(this, 'height'),
@@ -5656,20 +5754,21 @@ class BrkClient extends BrkClientBase {
5656
5754
  yearsSincePriceAth: createMetricPattern4(this, 'years_since_price_ath'),
5657
5755
  },
5658
5756
  dca: {
5659
- classAveragePrice: {
5660
- _2015: createMetricPattern4(this, 'dca_class_2015_average_price'),
5661
- _2016: createMetricPattern4(this, 'dca_class_2016_average_price'),
5662
- _2017: createMetricPattern4(this, 'dca_class_2017_average_price'),
5663
- _2018: createMetricPattern4(this, 'dca_class_2018_average_price'),
5664
- _2019: createMetricPattern4(this, 'dca_class_2019_average_price'),
5665
- _2020: createMetricPattern4(this, 'dca_class_2020_average_price'),
5666
- _2021: createMetricPattern4(this, 'dca_class_2021_average_price'),
5667
- _2022: createMetricPattern4(this, 'dca_class_2022_average_price'),
5668
- _2023: createMetricPattern4(this, 'dca_class_2023_average_price'),
5669
- _2024: createMetricPattern4(this, 'dca_class_2024_average_price'),
5670
- _2025: createMetricPattern4(this, 'dca_class_2025_average_price'),
5757
+ classAveragePrice: createClassAveragePricePattern(this, 'dca_class'),
5758
+ classReturns: {
5759
+ _2015: createMetricPattern4(this, 'dca_class_2015_returns'),
5760
+ _2016: createMetricPattern4(this, 'dca_class_2016_returns'),
5761
+ _2017: createMetricPattern4(this, 'dca_class_2017_returns'),
5762
+ _2018: createMetricPattern4(this, 'dca_class_2018_returns'),
5763
+ _2019: createMetricPattern4(this, 'dca_class_2019_returns'),
5764
+ _2020: createMetricPattern4(this, 'dca_class_2020_returns'),
5765
+ _2021: createMetricPattern4(this, 'dca_class_2021_returns'),
5766
+ _2022: createMetricPattern4(this, 'dca_class_2022_returns'),
5767
+ _2023: createMetricPattern4(this, 'dca_class_2023_returns'),
5768
+ _2024: createMetricPattern4(this, 'dca_class_2024_returns'),
5769
+ _2025: createMetricPattern4(this, 'dca_class_2025_returns'),
5770
+ _2026: createMetricPattern4(this, 'dca_class_2026_returns'),
5671
5771
  },
5672
- classReturns: createClassAveragePricePattern(this, 'dca_class'),
5673
5772
  classStack: {
5674
5773
  _2015: create_2015Pattern(this, 'dca_class_2015_stack'),
5675
5774
  _2016: create_2015Pattern(this, 'dca_class_2016_stack'),
@@ -5682,6 +5781,7 @@ class BrkClient extends BrkClientBase {
5682
5781
  _2023: create_2015Pattern(this, 'dca_class_2023_stack'),
5683
5782
  _2024: create_2015Pattern(this, 'dca_class_2024_stack'),
5684
5783
  _2025: create_2015Pattern(this, 'dca_class_2025_stack'),
5784
+ _2026: create_2015Pattern(this, 'dca_class_2026_stack'),
5685
5785
  },
5686
5786
  periodAveragePrice: createPeriodAveragePricePattern(this, 'dca_average_price'),
5687
5787
  periodCagr: createPeriodCagrPattern(this, 'dca_cagr'),
@@ -5990,16 +6090,42 @@ class BrkClient extends BrkClientBase {
5990
6090
  },
5991
6091
  },
5992
6092
  oracle: {
6093
+ closeOhlcCents: createMetricPattern6(this, 'close_ohlc_cents'),
6094
+ closeOhlcDollars: createMetricPattern6(this, 'close_ohlc_dollars'),
6095
+ heightToFirstPairoutputindex: createMetricPattern11(this, 'height_to_first_pairoutputindex'),
6096
+ midOhlcCents: createMetricPattern6(this, 'mid_ohlc_cents'),
6097
+ midOhlcDollars: createMetricPattern6(this, 'mid_ohlc_dollars'),
5993
6098
  ohlcCents: createMetricPattern6(this, 'oracle_ohlc_cents'),
5994
6099
  ohlcDollars: createMetricPattern6(this, 'oracle_ohlc'),
6100
+ output0Value: createMetricPattern33(this, 'pair_output0_value'),
6101
+ output1Value: createMetricPattern33(this, 'pair_output1_value'),
6102
+ pairoutputindexToTxindex: createMetricPattern33(this, 'pairoutputindex_to_txindex'),
6103
+ phaseDailyCents: createPhaseDailyCentsPattern(this, 'phase_daily'),
6104
+ phaseDailyDollars: createPhaseDailyCentsPattern(this, 'phase_daily_dollars'),
6105
+ phaseHistogram: createMetricPattern11(this, 'phase_histogram'),
6106
+ phasePriceCents: createMetricPattern11(this, 'phase_price_cents'),
6107
+ phaseV2DailyCents: createPhaseDailyCentsPattern(this, 'phase_v2_daily'),
6108
+ phaseV2DailyDollars: createPhaseDailyCentsPattern(this, 'phase_v2_daily_dollars'),
6109
+ phaseV2Histogram: createMetricPattern11(this, 'phase_v2_histogram'),
6110
+ phaseV2PeakDailyCents: createPhaseDailyCentsPattern(this, 'phase_v2_peak_daily'),
6111
+ phaseV2PeakDailyDollars: createPhaseDailyCentsPattern(this, 'phase_v2_peak_daily_dollars'),
6112
+ phaseV2PeakPriceCents: createMetricPattern11(this, 'phase_v2_peak_price_cents'),
6113
+ phaseV2PriceCents: createMetricPattern11(this, 'phase_v2_price_cents'),
6114
+ phaseV3DailyCents: createPhaseDailyCentsPattern(this, 'phase_v3_daily'),
6115
+ phaseV3DailyDollars: createPhaseDailyCentsPattern(this, 'phase_v3_daily_dollars'),
6116
+ phaseV3Histogram: createMetricPattern11(this, 'phase_v3_histogram'),
6117
+ phaseV3PeakDailyCents: createPhaseDailyCentsPattern(this, 'phase_v3_peak_daily'),
6118
+ phaseV3PeakDailyDollars: createPhaseDailyCentsPattern(this, 'phase_v3_peak_daily_dollars'),
6119
+ phaseV3PeakPriceCents: createMetricPattern11(this, 'phase_v3_peak_price_cents'),
6120
+ phaseV3PriceCents: createMetricPattern11(this, 'phase_v3_price_cents'),
5995
6121
  priceCents: createMetricPattern11(this, 'oracle_price_cents'),
5996
6122
  txCount: createMetricPattern6(this, 'oracle_tx_count'),
5997
6123
  },
5998
- sats: createSatsPattern(this, 'price'),
5999
- usd: {
6000
- ohlc: createMetricPattern1(this, 'price_ohlc'),
6001
- split: createSplitPattern2(this, 'price'),
6124
+ sats: {
6125
+ ohlc: createMetricPattern1(this, 'price_ohlc_sats'),
6126
+ split: createSplitPattern2(this, 'price_sats'),
6002
6127
  },
6128
+ usd: createSatsPattern(this, 'price'),
6003
6129
  },
6004
6130
  scripts: {
6005
6131
  count: {
@@ -6099,6 +6225,7 @@ class BrkClient extends BrkClientBase {
6099
6225
  annualizedVolume: create_2015Pattern(this, 'annualized_volume'),
6100
6226
  inputsPerSec: createMetricPattern4(this, 'inputs_per_sec'),
6101
6227
  outputsPerSec: createMetricPattern4(this, 'outputs_per_sec'),
6228
+ receivedSum: createActiveSupplyPattern(this, 'received_sum'),
6102
6229
  sentSum: createActiveSupplyPattern(this, 'sent_sum'),
6103
6230
  txPerSec: createMetricPattern4(this, 'tx_per_sec'),
6104
6231
  },
@@ -6120,6 +6247,18 @@ class BrkClient extends BrkClientBase {
6120
6247
  return _endpoint(this, metric, index);
6121
6248
  }
6122
6249
 
6250
+ /**
6251
+ * Compact OpenAPI specification
6252
+ *
6253
+ * Compact OpenAPI specification optimized for LLM consumption. Removes redundant fields while preserving essential API information. Full spec available at `/openapi.json`.
6254
+ *
6255
+ * Endpoint: `GET /api.json`
6256
+ * @returns {Promise<*>}
6257
+ */
6258
+ async getApi() {
6259
+ return this.getJson(`/api.json`);
6260
+ }
6261
+
6123
6262
  /**
6124
6263
  * Address information
6125
6264
  *
@@ -6910,6 +7049,18 @@ class BrkClient extends BrkClientBase {
6910
7049
  return this.getJson(`/health`);
6911
7050
  }
6912
7051
 
7052
+ /**
7053
+ * OpenAPI specification
7054
+ *
7055
+ * Full OpenAPI 3.1 specification for this API.
7056
+ *
7057
+ * Endpoint: `GET /openapi.json`
7058
+ * @returns {Promise<*>}
7059
+ */
7060
+ async getOpenapi() {
7061
+ return this.getJson(`/openapi.json`);
7062
+ }
7063
+
6913
7064
  /**
6914
7065
  * API version
6915
7066
  *
package/package.json CHANGED
@@ -34,5 +34,5 @@
34
34
  "url": "git+https://github.com/bitcoinresearchkit/brk.git"
35
35
  },
36
36
  "type": "module",
37
- "version": "0.1.0-alpha.3"
37
+ "version": "0.1.0-beta.0"
38
38
  }