brk-client 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +36 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -4550,6 +4550,7 @@ function createRatioPattern2(client, acc) {
4550
4550
  * @property {MetricsTree_Price_Cents} cents
4551
4551
  * @property {MetricsTree_Price_Usd} usd
4552
4552
  * @property {OhlcSplitPattern2<OHLCSats>} sats
4553
+ * @property {MetricsTree_Price_Oracle} oracle
4553
4554
  */
4554
4555
 
4555
4556
  /**
@@ -4572,6 +4573,15 @@ function createRatioPattern2(client, acc) {
4572
4573
  * @property {MetricPattern1<OHLCDollars>} ohlc
4573
4574
  */
4574
4575
 
4576
+ /**
4577
+ * @typedef {Object} MetricsTree_Price_Oracle
4578
+ * @property {MetricPattern11<CentsUnsigned>} priceCents
4579
+ * @property {MetricPattern6<OHLCCentsUnsigned>} ohlcCents
4580
+ * @property {CloseHighLowOpenPattern2<CentsUnsigned>} split
4581
+ * @property {MetricPattern1<OHLCCentsUnsigned>} ohlc
4582
+ * @property {MetricPattern1<OHLCDollars>} ohlcDollars
4583
+ */
4584
+
4575
4585
  /**
4576
4586
  * @typedef {Object} MetricsTree_Distribution
4577
4587
  * @property {MetricPattern11<SupplyState>} supplyState
@@ -4966,6 +4976,9 @@ function createRatioPattern2(client, acc) {
4966
4976
  * @property {MetricPattern4<StoredF32>} inflation
4967
4977
  * @property {MetricsTree_Supply_Velocity} velocity
4968
4978
  * @property {MetricPattern1<Dollars>} marketCap
4979
+ * @property {MetricPattern4<StoredF32>} marketCapGrowthRate
4980
+ * @property {MetricPattern4<StoredF32>} realizedCapGrowthRate
4981
+ * @property {MetricPattern6<StoredF32>} capGrowthRateDiff
4969
4982
  */
4970
4983
 
4971
4984
  /**
@@ -4992,7 +5005,7 @@ function createRatioPattern2(client, acc) {
4992
5005
  * @extends BrkClientBase
4993
5006
  */
4994
5007
  class BrkClient extends BrkClientBase {
4995
- VERSION = "v0.1.7";
5008
+ VERSION = "v0.1.9";
4996
5009
 
4997
5010
  INDEXES = /** @type {const} */ ([
4998
5011
  "dateindex",
@@ -6730,6 +6743,13 @@ class BrkClient extends BrkClientBase {
6730
6743
  ohlc: createMetricPattern1(this, 'price_ohlc'),
6731
6744
  },
6732
6745
  sats: createOhlcSplitPattern2(this, 'price'),
6746
+ oracle: {
6747
+ priceCents: createMetricPattern11(this, 'oracle_price_cents'),
6748
+ ohlcCents: createMetricPattern6(this, 'oracle_ohlc_cents'),
6749
+ split: createCloseHighLowOpenPattern2(this, 'oracle_price'),
6750
+ ohlc: createMetricPattern1(this, 'oracle_price_ohlc'),
6751
+ ohlcDollars: createMetricPattern1(this, 'oracle_ohlc_dollars'),
6752
+ },
6733
6753
  },
6734
6754
  distribution: {
6735
6755
  supplyState: createMetricPattern11(this, 'supply_state'),
@@ -7057,6 +7077,9 @@ class BrkClient extends BrkClientBase {
7057
7077
  usd: createMetricPattern4(this, 'usd_velocity'),
7058
7078
  },
7059
7079
  marketCap: createMetricPattern1(this, 'market_cap'),
7080
+ marketCapGrowthRate: createMetricPattern4(this, 'market_cap_growth_rate'),
7081
+ realizedCapGrowthRate: createMetricPattern4(this, 'realized_cap_growth_rate'),
7082
+ capGrowthRateDiff: createMetricPattern6(this, 'cap_growth_rate_diff'),
7060
7083
  },
7061
7084
  };
7062
7085
  }
@@ -7339,6 +7362,18 @@ class BrkClient extends BrkClientBase {
7339
7362
  return this.getJson(`/api/mempool/info`);
7340
7363
  }
7341
7364
 
7365
+ /**
7366
+ * Live BTC/USD price
7367
+ *
7368
+ * Returns the current BTC/USD price in dollars, derived from on-chain round-dollar output patterns in the last 12 blocks plus mempool.
7369
+ *
7370
+ * Endpoint: `GET /api/mempool/price`
7371
+ * @returns {Promise<Dollars>}
7372
+ */
7373
+ async getLivePrice() {
7374
+ return this.getJson(`/api/mempool/price`);
7375
+ }
7376
+
7342
7377
  /**
7343
7378
  * Mempool transaction IDs
7344
7379
  *
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.7"
37
+ "version": "0.1.9"
38
38
  }