mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-05-29 19:59:27 -07:00
clients: snapshot
This commit is contained in:
@@ -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 }),
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user