clients: snapshot

This commit is contained in:
nym21
2026-01-12 08:48:12 +01:00
parent 5826d78e35
commit 8fe0af349d
19 changed files with 5280 additions and 3272 deletions
+2 -2
View File
@@ -1563,7 +1563,7 @@
<link rel="modulepreload" href="/scripts/entry.fe229b42.js">
<link rel="modulepreload" href="/scripts/lazy.1ae52534.js">
<link rel="modulepreload" href="/scripts/main.22a5bd79.js">
<link rel="modulepreload" href="/scripts/modules/brk-client/index.22379f83.js">
<link rel="modulepreload" href="/scripts/modules/brk-client/index.f69b33ed.js">
<link rel="modulepreload" href="/scripts/modules/brk-client/tests/basic.b92ff866.js">
<link rel="modulepreload" href="/scripts/modules/brk-client/tests/tree.ba9474f7.js">
<link rel="modulepreload" href="/scripts/modules/lean-qr/2.6.1/index.09195c13.mjs">
@@ -1634,7 +1634,7 @@
"/scripts/entry.js": "/scripts/entry.fe229b42.js",
"/scripts/lazy.js": "/scripts/lazy.1ae52534.js",
"/scripts/main.js": "/scripts/main.22a5bd79.js",
"/scripts/modules/brk-client/index.js": "/scripts/modules/brk-client/index.22379f83.js",
"/scripts/modules/brk-client/index.js": "/scripts/modules/brk-client/index.f69b33ed.js",
"/scripts/modules/brk-client/tests/basic.js": "/scripts/modules/brk-client/tests/basic.b92ff866.js",
"/scripts/modules/brk-client/tests/tree.js": "/scripts/modules/brk-client/tests/tree.ba9474f7.js",
"/scripts/modules/lean-qr/2.6.1/index.mjs": "/scripts/modules/lean-qr/2.6.1/index.09195c13.mjs",
+2 -2
View File
@@ -384,8 +384,8 @@ function createChartElement({
/** @type {AnyMetricPattern} */
const timeMetric =
index === "height"
? brk.tree.blocks.time.timestampFixed
: brk.tree.blocks.time.timestamp;
? brk.metrics.blocks.time.timestampFixed
: brk.metrics.blocks.time.timestamp;
/** @type {AnyMetricPattern} */
const valuesMetric = metric;
const timeNode = timeMetric.by[index];
+1 -1
View File
@@ -5,7 +5,7 @@
*
* @import { Signal, Signals, Accessor } from "./signals.js";
*
* @import { BrkClient, CatalogTree_Distribution_UtxoCohorts as UtxoCohortTree, CatalogTree_Distribution_AddressCohorts as AddressCohortTree, CatalogTree_Distribution_UtxoCohorts_All as AllUtxoPattern, CatalogTree_Distribution_UtxoCohorts_Term_Short as ShortTermPattern, CatalogTree_Distribution_UtxoCohorts_Term_Long as LongTermPattern, _10yPattern as MaxAgePattern, _10yTo12yPattern as AgeRangePattern, _0satsPattern2 as UtxoAmountPattern, _0satsPattern as AddressAmountPattern, _100btcPattern as BasicUtxoPattern, _0satsPattern2 as EpochPattern, Ratio1ySdPattern, Dollars, Price111dSmaPattern as EmaRatioPattern, Index, BlockCountPattern, SizePattern, FullnessPattern, FeeRatePattern, CoinbasePattern, ActivePriceRatioPattern, _0satsPattern, UnclaimedRewardsPattern as ValuePattern, Metric, MetricPattern, AnyMetricPattern, MetricEndpoint, MetricData, AnyMetricEndpoint, AnyMetricData, AddrCountPattern, CatalogTree_Blocks_Interval as IntervalPattern, _24hCoinbaseSumPattern as SupplyPattern, RelativePattern, RelativePattern2, RelativePattern5, CatalogTree_Distribution_UtxoCohorts_All_Relative as AllRelativePattern } from "./modules/brk-client/index.js"
* @import { BrkClient, MetricsTree_Distribution_UtxoCohorts as UtxoCohortTree, MetricsTree_Distribution_AddressCohorts as AddressCohortTree, MetricsTree_Distribution_UtxoCohorts_All as AllUtxoPattern, MetricsTree_Distribution_UtxoCohorts_Term_Short as ShortTermPattern, MetricsTree_Distribution_UtxoCohorts_Term_Long as LongTermPattern, _10yPattern as MaxAgePattern, _10yTo12yPattern as AgeRangePattern, _0satsPattern2 as UtxoAmountPattern, _0satsPattern as AddressAmountPattern, _100btcPattern as BasicUtxoPattern, _0satsPattern2 as EpochPattern, Ratio1ySdPattern, Dollars, Price111dSmaPattern as EmaRatioPattern, Index, BlockCountPattern, SizePattern, FullnessPattern, FeeRatePattern, CoinbasePattern, ActivePriceRatioPattern, _0satsPattern, UnclaimedRewardsPattern as ValuePattern, Metric, MetricPattern, AnyMetricPattern, MetricEndpoint, MetricData, AnyMetricEndpoint, AnyMetricData, AddrCountPattern, MetricsTree_Blocks_Interval as IntervalPattern, _24hCoinbaseSumPattern as SupplyPattern, RelativePattern, RelativePattern2, RelativePattern5, MetricsTree_Distribution_UtxoCohorts_All_Relative as AllRelativePattern } from "./modules/brk-client/index.js"
*
* @import { Resources, MetricResource } from './resources.js'
*
+1 -1
View File
@@ -31,7 +31,7 @@ export function createChainSection(ctx) {
market,
scripts,
supply,
} = brk.tree;
} = brk.metrics;
// Build pools tree dynamically
const poolEntries = Object.entries(pools.vecs);
@@ -1,4 +1,4 @@
/** Build cohort data arrays from brk.tree */
/** Build cohort data arrays from brk.metrics */
import {
termColors,
@@ -28,8 +28,8 @@ const entries = (obj) =>
* @param {BrkClient} brk
*/
export function buildCohortData(colors, brk) {
const utxoCohorts = brk.tree.distribution.utxoCohorts;
const addressCohorts = brk.tree.distribution.addressCohorts;
const utxoCohorts = brk.metrics.distribution.utxoCohorts;
const addressCohorts = brk.metrics.distribution.addressCohorts;
const {
TERM_NAMES,
EPOCH_NAMES,
@@ -144,7 +144,7 @@ export function createSingleSupplySeries(ctx, cohort) {
*/
export function createGroupedSupplyTotalSeries(ctx, list) {
const { line, brk } = ctx;
const constant100 = brk.tree.constants.constant100;
const constant100 = brk.metrics.constants.constant100;
return list.flatMap(({ color, name, tree }) => [
line({ metric: tree.supply.total.sats, name, color, unit: Unit.sats }),
+1 -1
View File
@@ -172,7 +172,7 @@ function createCointimePriceWithRatioOptions(
*/
export function createCointimeSection(ctx) {
const { colors, brk, line } = ctx;
const { cointime, distribution, supply } = brk.tree;
const { cointime, distribution, supply } = brk.metrics;
const { pricing, cap, activity, supply: cointimeSupply, adjusted } = cointime;
const { all } = distribution.utxoCohorts;
@@ -5,7 +5,7 @@ import { line } from "./series.js";
/**
* Get constant pattern by number dynamically from tree
* Examples: 0 → constant0, 38.2 → constant382, -1 → constantMinus1
* @param {BrkClient["tree"]["constants"]} constants
* @param {BrkClient["metrics"]["constants"]} constants
* @param {number} num
* @returns {AnyMetricPattern}
*/
@@ -24,7 +24,7 @@ export function getConstant(constants, num) {
/**
* Create a price line series (horizontal reference line)
* @param {Object} args
* @param {BrkClient["tree"]["constants"]} args.constants
* @param {BrkClient["metrics"]["constants"]} args.constants
* @param {Colors} args.colors
* @param {number} [args.number]
* @param {string} [args.name]
@@ -61,7 +61,7 @@ export function createPriceLine({
/**
* Create multiple price lines from an array of numbers
* @param {Object} args
* @param {BrkClient["tree"]["constants"]} args.constants
* @param {BrkClient["metrics"]["constants"]} args.constants
* @param {Colors} args.colors
* @param {number[]} args.numbers
* @param {Unit} args.unit
+6 -2
View File
@@ -15,7 +15,11 @@ import {
fromIntervalPattern,
fromSupplyPattern,
} from "./series.js";
import { createPriceLine, createPriceLines, constantLine } from "./constants.js";
import {
createPriceLine,
createPriceLines,
constantLine,
} from "./constants.js";
/**
* Create a context object with all dependencies for building partial options
@@ -25,7 +29,7 @@ import { createPriceLine, createPriceLines, constantLine } from "./constants.js"
* @returns {PartialContext}
*/
export function createContext({ colors, brk }) {
const constants = brk.tree.constants;
const constants = brk.metrics.constants;
return {
colors,
+2 -4
View File
@@ -17,7 +17,7 @@ import { collect, markUsed, logUnused } from "./unused.js";
* @param {Signal<string | null>} args.qrcode
*/
export function initOptions({ colors, signals, brk, qrcode }) {
collect(brk.tree);
collect(brk.metrics);
const LS_SELECTED_KEY = `selected_path`;
@@ -56,9 +56,7 @@ export function initOptions({ colors, signals, brk, qrcode }) {
);
}
if (!blueprint.unit) {
throw new Error(
`Blueprint missing unit: ${blueprint.title}`,
);
throw new Error(`Blueprint missing unit: ${blueprint.title}`);
}
markUsed(blueprint.metric);
const unit = blueprint.unit;
@@ -13,7 +13,7 @@ import { createInvestingSection } from "./investing.js";
*/
export function createMarketSection(ctx) {
const { colors, brk, line } = ctx;
const { market, supply } = brk.tree;
const { market, supply } = brk.metrics;
const {
movingAverage,
ath,
@@ -331,7 +331,7 @@ export function init({
case null:
case CANDLE: {
series = chart.addCandlestickSeries({
metric: brk.tree.price.usd.ohlc,
metric: brk.metrics.price.usd.ohlc,
name: "Price",
unit: topUnit,
setDataCallback: printLatest,
@@ -341,7 +341,7 @@ export function init({
}
case LINE: {
series = chart.addLineSeries({
metric: brk.tree.price.usd.split.close,
metric: brk.metrics.price.usd.split.close,
name: "Price",
unit: topUnit,
color: colors.default,
@@ -361,7 +361,7 @@ export function init({
case null:
case CANDLE: {
series = chart.addCandlestickSeries({
metric: brk.tree.price.sats.ohlc,
metric: brk.metrics.price.sats.ohlc,
name: "Price",
unit: topUnit,
inverse: true,
@@ -372,7 +372,7 @@ export function init({
}
case LINE: {
series = chart.addLineSeries({
metric: brk.tree.price.sats.split.close,
metric: brk.metrics.price.sats.split.close,
name: "Price",
unit: topUnit,
color: colors.default,