diff --git a/crates/brk_client/src/lib.rs b/crates/brk_client/src/lib.rs index e626c8dd5..741fe8a46 100644 --- a/crates/brk_client/src/lib.rs +++ b/crates/brk_client/src/lib.rs @@ -701,7 +701,7 @@ impl MetricPattern for MetricPattern18 { fn get(&self pub struct MetricPattern19By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern19By { - pub fn txindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::TxIndex) } + pub fn tx_index(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::TxIndex) } } pub struct MetricPattern19 { name: Arc, pub by: MetricPattern19By } @@ -715,7 +715,7 @@ impl MetricPattern for MetricPattern19 { fn get(&self pub struct MetricPattern20By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern20By { - pub fn txinindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::TxInIndex) } + pub fn txin_index(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::TxInIndex) } } pub struct MetricPattern20 { name: Arc, pub by: MetricPattern20By } @@ -729,7 +729,7 @@ impl MetricPattern for MetricPattern20 { fn get(&self pub struct MetricPattern21By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern21By { - pub fn txoutindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::TxOutIndex) } + pub fn txout_index(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::TxOutIndex) } } pub struct MetricPattern21 { name: Arc, pub by: MetricPattern21By } @@ -743,7 +743,7 @@ impl MetricPattern for MetricPattern21 { fn get(&self pub struct MetricPattern22By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern22By { - pub fn emptyoutputindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::EmptyOutputIndex) } + pub fn empty_output_index(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::EmptyOutputIndex) } } pub struct MetricPattern22 { name: Arc, pub by: MetricPattern22By } @@ -757,7 +757,7 @@ impl MetricPattern for MetricPattern22 { fn get(&self pub struct MetricPattern23By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern23By { - pub fn opreturnindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::OpReturnIndex) } + pub fn op_return_index(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::OpReturnIndex) } } pub struct MetricPattern23 { name: Arc, pub by: MetricPattern23By } @@ -771,7 +771,7 @@ impl MetricPattern for MetricPattern23 { fn get(&self pub struct MetricPattern24By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern24By { - pub fn p2aaddressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2AAddressIndex) } + pub fn p2a_address_index(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2AAddressIndex) } } pub struct MetricPattern24 { name: Arc, pub by: MetricPattern24By } @@ -785,7 +785,7 @@ impl MetricPattern for MetricPattern24 { fn get(&self pub struct MetricPattern25By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern25By { - pub fn p2msoutputindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2MSOutputIndex) } + pub fn p2ms_output_index(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2MSOutputIndex) } } pub struct MetricPattern25 { name: Arc, pub by: MetricPattern25By } @@ -799,7 +799,7 @@ impl MetricPattern for MetricPattern25 { fn get(&self pub struct MetricPattern26By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern26By { - pub fn p2pk33addressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2PK33AddressIndex) } + pub fn p2pk33_address_index(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2PK33AddressIndex) } } pub struct MetricPattern26 { name: Arc, pub by: MetricPattern26By } @@ -813,7 +813,7 @@ impl MetricPattern for MetricPattern26 { fn get(&self pub struct MetricPattern27By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern27By { - pub fn p2pk65addressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2PK65AddressIndex) } + pub fn p2pk65_address_index(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2PK65AddressIndex) } } pub struct MetricPattern27 { name: Arc, pub by: MetricPattern27By } @@ -827,7 +827,7 @@ impl MetricPattern for MetricPattern27 { fn get(&self pub struct MetricPattern28By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern28By { - pub fn p2pkhaddressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2PKHAddressIndex) } + pub fn p2pkh_address_index(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2PKHAddressIndex) } } pub struct MetricPattern28 { name: Arc, pub by: MetricPattern28By } @@ -841,7 +841,7 @@ impl MetricPattern for MetricPattern28 { fn get(&self pub struct MetricPattern29By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern29By { - pub fn p2shaddressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2SHAddressIndex) } + pub fn p2sh_address_index(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2SHAddressIndex) } } pub struct MetricPattern29 { name: Arc, pub by: MetricPattern29By } @@ -855,7 +855,7 @@ impl MetricPattern for MetricPattern29 { fn get(&self pub struct MetricPattern30By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern30By { - pub fn p2traddressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2TRAddressIndex) } + pub fn p2tr_address_index(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2TRAddressIndex) } } pub struct MetricPattern30 { name: Arc, pub by: MetricPattern30By } @@ -869,7 +869,7 @@ impl MetricPattern for MetricPattern30 { fn get(&self pub struct MetricPattern31By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern31By { - pub fn p2wpkhaddressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2WPKHAddressIndex) } + pub fn p2wpkh_address_index(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2WPKHAddressIndex) } } pub struct MetricPattern31 { name: Arc, pub by: MetricPattern31By } @@ -883,7 +883,7 @@ impl MetricPattern for MetricPattern31 { fn get(&self pub struct MetricPattern32By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern32By { - pub fn p2wshaddressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2WSHAddressIndex) } + pub fn p2wsh_address_index(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::P2WSHAddressIndex) } } pub struct MetricPattern32 { name: Arc, pub by: MetricPattern32By } @@ -897,7 +897,7 @@ impl MetricPattern for MetricPattern32 { fn get(&self pub struct MetricPattern33By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern33By { - pub fn unknownoutputindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::UnknownOutputIndex) } + pub fn unknown_output_index(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::UnknownOutputIndex) } } pub struct MetricPattern33 { name: Arc, pub by: MetricPattern33By } @@ -911,7 +911,7 @@ impl MetricPattern for MetricPattern33 { fn get(&self pub struct MetricPattern34By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern34By { - pub fn fundedaddressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::FundedAddressIndex) } + pub fn funded_address_index(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::FundedAddressIndex) } } pub struct MetricPattern34 { name: Arc, pub by: MetricPattern34By } @@ -925,7 +925,7 @@ impl MetricPattern for MetricPattern34 { fn get(&self pub struct MetricPattern35By { client: Arc, name: Arc, _marker: std::marker::PhantomData } impl MetricPattern35By { - pub fn emptyaddressindex(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::EmptyAddressIndex) } + pub fn empty_address_index(&self) -> MetricEndpointBuilder { _ep(&self.client, &self.name, Index::EmptyAddressIndex) } } pub struct MetricPattern35 { name: Arc, pub by: MetricPattern35By } @@ -1033,36 +1033,36 @@ impl _0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern { /// Pattern struct for repeated tree structure. pub struct _10y1m1w1y2y3m3y4y5y6m6y8yPattern2 { - pub _10y: BpsPercentRatioPattern2, - pub _1m: BpsPercentRatioPattern2, - pub _1w: BpsPercentRatioPattern2, - pub _1y: BpsPercentRatioPattern2, - pub _2y: BpsPercentRatioPattern2, - pub _3m: BpsPercentRatioPattern2, - pub _3y: BpsPercentRatioPattern2, - pub _4y: BpsPercentRatioPattern2, - pub _5y: BpsPercentRatioPattern2, - pub _6m: BpsPercentRatioPattern2, - pub _6y: BpsPercentRatioPattern2, - pub _8y: BpsPercentRatioPattern2, + pub _10y: BpsPercentRatioPattern, + pub _1m: BpsPercentRatioPattern, + pub _1w: BpsPercentRatioPattern, + pub _1y: BpsPercentRatioPattern, + pub _2y: BpsPercentRatioPattern, + pub _3m: BpsPercentRatioPattern, + pub _3y: BpsPercentRatioPattern, + pub _4y: BpsPercentRatioPattern, + pub _5y: BpsPercentRatioPattern, + pub _6m: BpsPercentRatioPattern, + pub _6y: BpsPercentRatioPattern, + pub _8y: BpsPercentRatioPattern, } impl _10y1m1w1y2y3m3y4y5y6m6y8yPattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - _10y: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "10y")), - _1m: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "1m")), - _1w: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "1w")), - _1y: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "1y")), - _2y: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "2y")), - _3m: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "3m")), - _3y: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "3y")), - _4y: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "4y")), - _5y: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "5y")), - _6m: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "6m")), - _6y: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "6y")), - _8y: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "8y")), + _10y: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "10y")), + _1m: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "1m")), + _1w: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "1w")), + _1y: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "1y")), + _2y: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "2y")), + _3m: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "3m")), + _3y: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "3y")), + _4y: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "4y")), + _5y: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "5y")), + _6m: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "6m")), + _6y: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "6y")), + _8y: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "8y")), } } } @@ -1115,7 +1115,7 @@ pub struct CapGrossInvestorLossMvrvNetPeakPriceProfitSellSoprPattern { pub price: BpsCentsPercentilesRatioSatsSmaStdUsdPattern, pub profit: BaseCumulativeDistributionRelSumValuePattern, pub profit_to_loss_ratio: _1m1w1y24hPattern, - pub sell_side_risk_ratio: _1m1w1y24hPattern2, + pub sell_side_risk_ratio: _1m1w1y24hPattern6, pub sopr: AdjustedRatioValuePattern, } @@ -1133,7 +1133,7 @@ impl CapGrossInvestorLossMvrvNetPeakPriceProfitSellSoprPattern { price: BpsCentsPercentilesRatioSatsSmaStdUsdPattern::new(client.clone(), _m(&acc, "realized_price")), profit: BaseCumulativeDistributionRelSumValuePattern::new(client.clone(), acc.clone()), profit_to_loss_ratio: _1m1w1y24hPattern::new(client.clone(), _m(&acc, "realized_profit_to_loss_ratio")), - sell_side_risk_ratio: _1m1w1y24hPattern2::new(client.clone(), _m(&acc, "sell_side_risk_ratio")), + sell_side_risk_ratio: _1m1w1y24hPattern6::new(client.clone(), _m(&acc, "sell_side_risk_ratio")), sopr: AdjustedRatioValuePattern::new(client.clone(), acc.clone()), } } @@ -1213,12 +1213,12 @@ pub struct AverageGainsLossesRsiStochPattern { pub average_loss: MetricPattern1, pub gains: MetricPattern1, pub losses: MetricPattern1, - pub rsi: BpsPercentRatioPattern4, - pub rsi_max: BpsPercentRatioPattern4, - pub rsi_min: BpsPercentRatioPattern4, - pub stoch_rsi: BpsPercentRatioPattern4, - pub stoch_rsi_d: BpsPercentRatioPattern4, - pub stoch_rsi_k: BpsPercentRatioPattern4, + pub rsi: BpsPercentRatioPattern3, + pub rsi_max: BpsPercentRatioPattern3, + pub rsi_min: BpsPercentRatioPattern3, + pub stoch_rsi: BpsPercentRatioPattern3, + pub stoch_rsi_d: BpsPercentRatioPattern3, + pub stoch_rsi_k: BpsPercentRatioPattern3, } impl AverageGainsLossesRsiStochPattern { @@ -1229,12 +1229,12 @@ impl AverageGainsLossesRsiStochPattern { average_loss: MetricPattern1::new(client.clone(), _m(&acc, "average_loss_24h")), gains: MetricPattern1::new(client.clone(), _m(&acc, "gains_24h")), losses: MetricPattern1::new(client.clone(), _m(&acc, "losses_24h")), - rsi: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "24h")), - rsi_max: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "max_24h")), - rsi_min: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "min_24h")), - stoch_rsi: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "stoch_24h")), - stoch_rsi_d: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "stoch_d_24h")), - stoch_rsi_k: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "stoch_k_24h")), + rsi: BpsPercentRatioPattern3::new(client.clone(), _m(&acc, "24h")), + rsi_max: BpsPercentRatioPattern3::new(client.clone(), _m(&acc, "max_24h")), + rsi_min: BpsPercentRatioPattern3::new(client.clone(), _m(&acc, "min_24h")), + stoch_rsi: BpsPercentRatioPattern3::new(client.clone(), _m(&acc, "stoch_24h")), + stoch_rsi_d: BpsPercentRatioPattern3::new(client.clone(), _m(&acc, "stoch_d_24h")), + stoch_rsi_k: BpsPercentRatioPattern3::new(client.clone(), _m(&acc, "stoch_k_24h")), } } } @@ -1333,8 +1333,8 @@ pub struct BaseCapitulationCumulativeNegativeRelSumValuePattern { pub capitulation_flow: MetricPattern1, pub cumulative: CentsUsdPattern2, pub negative: MetricPattern1, - pub rel_to_rcap: BpsPercentRatioPattern, - pub sum: _1m1w1y24hPattern5, + pub rel_to_rcap: BpsPercentRatioPattern4, + pub sum: _1m1w1y24hPattern4, pub value_created: BaseCumulativeSumPattern, pub value_destroyed: BaseCumulativeSumPattern, } @@ -1347,8 +1347,8 @@ impl BaseCapitulationCumulativeNegativeRelSumValuePattern { capitulation_flow: MetricPattern1::new(client.clone(), _m(&acc, "capitulation_flow")), cumulative: CentsUsdPattern2::new(client.clone(), _m(&acc, "realized_loss_cumulative")), negative: MetricPattern1::new(client.clone(), _m(&acc, "neg_realized_loss")), - rel_to_rcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_loss_rel_to_rcap")), - sum: _1m1w1y24hPattern5::new(client.clone(), _m(&acc, "realized_loss_sum")), + rel_to_rcap: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "realized_loss_rel_to_rcap")), + sum: _1m1w1y24hPattern4::new(client.clone(), _m(&acc, "realized_loss_sum")), value_created: BaseCumulativeSumPattern::new(client.clone(), _m(&acc, "loss_value_created")), value_destroyed: BaseCumulativeSumPattern::new(client.clone(), _m(&acc, "loss_value_destroyed")), } @@ -1413,36 +1413,36 @@ impl AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2 { /// Pattern struct for repeated tree structure. pub struct _10y2y3y4y5y6y8yPattern { - pub _10y: BpsPercentRatioPattern2, - pub _2y: BpsPercentRatioPattern2, - pub _3y: BpsPercentRatioPattern2, - pub _4y: BpsPercentRatioPattern2, - pub _5y: BpsPercentRatioPattern2, - pub _6y: BpsPercentRatioPattern2, - pub _8y: BpsPercentRatioPattern2, + pub _10y: BpsPercentRatioPattern, + pub _2y: BpsPercentRatioPattern, + pub _3y: BpsPercentRatioPattern, + pub _4y: BpsPercentRatioPattern, + pub _5y: BpsPercentRatioPattern, + pub _6y: BpsPercentRatioPattern, + pub _8y: BpsPercentRatioPattern, } impl _10y2y3y4y5y6y8yPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - _10y: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "10y")), - _2y: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "2y")), - _3y: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "3y")), - _4y: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "4y")), - _5y: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "5y")), - _6y: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "6y")), - _8y: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "8y")), + _10y: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "10y")), + _2y: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "2y")), + _3y: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "3y")), + _4y: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "4y")), + _5y: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "5y")), + _6y: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "6y")), + _8y: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "8y")), } } } /// Pattern struct for repeated tree structure. pub struct _1m1w1y24hBpsPercentRatioPattern { - pub _1m: BpsPercentRatioPattern4, - pub _1w: BpsPercentRatioPattern4, - pub _1y: BpsPercentRatioPattern4, - pub _24h: BpsPercentRatioPattern4, + pub _1m: BpsPercentRatioPattern3, + pub _1w: BpsPercentRatioPattern3, + pub _1y: BpsPercentRatioPattern3, + pub _24h: BpsPercentRatioPattern3, pub bps: MetricPattern1, pub percent: MetricPattern1, pub ratio: MetricPattern1, @@ -1452,10 +1452,10 @@ impl _1m1w1y24hBpsPercentRatioPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - _1m: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "1m")), - _1w: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "1w")), - _1y: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "1y")), - _24h: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "24h")), + _1m: BpsPercentRatioPattern3::new(client.clone(), _m(&acc, "1m")), + _1w: BpsPercentRatioPattern3::new(client.clone(), _m(&acc, "1w")), + _1y: BpsPercentRatioPattern3::new(client.clone(), _m(&acc, "1y")), + _24h: BpsPercentRatioPattern3::new(client.clone(), _m(&acc, "24h")), bps: MetricPattern1::new(client.clone(), _m(&acc, "bps")), percent: MetricPattern1::new(client.clone(), acc.clone()), ratio: MetricPattern1::new(client.clone(), _m(&acc, "ratio")), @@ -1468,8 +1468,8 @@ pub struct BaseCumulativeDistributionRelSumValuePattern { pub base: CentsUsdPattern2, pub cumulative: CentsUsdPattern2, pub distribution_flow: MetricPattern1, - pub rel_to_rcap: BpsPercentRatioPattern, - pub sum: _1m1w1y24hPattern5, + pub rel_to_rcap: BpsPercentRatioPattern4, + pub sum: _1m1w1y24hPattern4, pub value_created: BaseCumulativeSumPattern, pub value_destroyed: BaseCumulativeSumPattern, } @@ -1481,8 +1481,8 @@ impl BaseCumulativeDistributionRelSumValuePattern { base: CentsUsdPattern2::new(client.clone(), _m(&acc, "realized_profit")), cumulative: CentsUsdPattern2::new(client.clone(), _m(&acc, "realized_profit_cumulative")), distribution_flow: MetricPattern1::new(client.clone(), _m(&acc, "distribution_flow")), - rel_to_rcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_profit_rel_to_rcap")), - sum: _1m1w1y24hPattern5::new(client.clone(), _m(&acc, "realized_profit_sum")), + rel_to_rcap: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "realized_profit_rel_to_rcap")), + sum: _1m1w1y24hPattern4::new(client.clone(), _m(&acc, "realized_profit_sum")), value_created: BaseCumulativeSumPattern::new(client.clone(), _m(&acc, "profit_value_created")), value_destroyed: BaseCumulativeSumPattern::new(client.clone(), _m(&acc, "profit_value_destroyed")), } @@ -1494,10 +1494,10 @@ pub struct BaseCumulativeNegativeRelSumPattern2 { pub base: CentsUsdPattern2, pub cumulative: CentsUsdPattern2, pub negative: MetricPattern1, - pub rel_to_mcap: BpsPercentRatioPattern4, - pub rel_to_own_gross: BpsPercentRatioPattern4, - pub rel_to_own_mcap: BpsPercentRatioPattern, - pub sum: _1m1w1y24hPattern5, + pub rel_to_mcap: BpsPercentRatioPattern3, + pub rel_to_own_gross: BpsPercentRatioPattern3, + pub rel_to_own_mcap: BpsPercentRatioPattern4, + pub sum: _1m1w1y24hPattern4, } impl BaseCumulativeNegativeRelSumPattern2 { @@ -1507,10 +1507,10 @@ impl BaseCumulativeNegativeRelSumPattern2 { base: CentsUsdPattern2::new(client.clone(), _m(&acc, "unrealized_loss")), cumulative: CentsUsdPattern2::new(client.clone(), _m(&acc, "unrealized_loss_cumulative")), negative: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss")), - rel_to_mcap: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_mcap")), - rel_to_own_gross: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_own_gross_pnl")), - rel_to_own_mcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_own_mcap")), - sum: _1m1w1y24hPattern5::new(client.clone(), _m(&acc, "unrealized_loss_sum")), + rel_to_mcap: BpsPercentRatioPattern3::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_mcap")), + rel_to_own_gross: BpsPercentRatioPattern3::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_own_gross_pnl")), + rel_to_own_mcap: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "unrealized_loss_rel_to_own_mcap")), + sum: _1m1w1y24hPattern4::new(client.clone(), _m(&acc, "unrealized_loss_sum")), } } } @@ -1596,9 +1596,9 @@ pub struct BaseChangeCumulativeDeltaRelSumPattern { pub base: CentsUsdPattern, pub change_1m: RelPattern, pub cumulative: CentsUsdPattern, - pub delta: ChangeRatePattern3, - pub rel_to_rcap: BpsPercentRatioPattern2, - pub sum: _1m1w1y24hPattern4, + pub delta: ChangeRatePattern2, + pub rel_to_rcap: BpsPercentRatioPattern, + pub sum: _1m1w1y24hPattern3, } impl BaseChangeCumulativeDeltaRelSumPattern { @@ -1608,9 +1608,9 @@ impl BaseChangeCumulativeDeltaRelSumPattern { base: CentsUsdPattern::new(client.clone(), _m(&acc, "realized_pnl")), change_1m: RelPattern::new(client.clone(), _m(&acc, "pnl_change_1m_rel_to")), cumulative: CentsUsdPattern::new(client.clone(), _m(&acc, "realized_pnl_cumulative")), - delta: ChangeRatePattern3::new(client.clone(), _m(&acc, "realized_pnl_delta")), - rel_to_rcap: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "realized_pnl_rel_to_rcap")), - sum: _1m1w1y24hPattern4::new(client.clone(), _m(&acc, "realized_pnl_sum")), + delta: ChangeRatePattern2::new(client.clone(), _m(&acc, "realized_pnl_delta")), + rel_to_rcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "realized_pnl_rel_to_rcap")), + sum: _1m1w1y24hPattern3::new(client.clone(), _m(&acc, "realized_pnl_sum")), } } } @@ -1619,10 +1619,10 @@ impl BaseChangeCumulativeDeltaRelSumPattern { pub struct BaseCumulativeRelSumPattern2 { pub base: CentsUsdPattern2, pub cumulative: CentsUsdPattern2, - pub rel_to_mcap: BpsPercentRatioPattern4, - pub rel_to_own_gross: BpsPercentRatioPattern4, - pub rel_to_own_mcap: BpsPercentRatioPattern4, - pub sum: _1m1w1y24hPattern5, + pub rel_to_mcap: BpsPercentRatioPattern3, + pub rel_to_own_gross: BpsPercentRatioPattern3, + pub rel_to_own_mcap: BpsPercentRatioPattern3, + pub sum: _1m1w1y24hPattern4, } impl BaseCumulativeRelSumPattern2 { @@ -1631,10 +1631,10 @@ impl BaseCumulativeRelSumPattern2 { Self { base: CentsUsdPattern2::new(client.clone(), acc.clone()), cumulative: CentsUsdPattern2::new(client.clone(), _m(&acc, "cumulative")), - rel_to_mcap: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "rel_to_mcap")), - rel_to_own_gross: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "rel_to_own_gross_pnl")), - rel_to_own_mcap: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "rel_to_own_mcap")), - sum: _1m1w1y24hPattern5::new(client.clone(), _m(&acc, "sum")), + rel_to_mcap: BpsPercentRatioPattern3::new(client.clone(), _m(&acc, "rel_to_mcap")), + rel_to_own_gross: BpsPercentRatioPattern3::new(client.clone(), _m(&acc, "rel_to_own_gross_pnl")), + rel_to_own_mcap: BpsPercentRatioPattern3::new(client.clone(), _m(&acc, "rel_to_own_mcap")), + sum: _1m1w1y24hPattern4::new(client.clone(), _m(&acc, "sum")), } } } @@ -1667,8 +1667,8 @@ impl BpsCentsPercentilesRatioSatsUsdPattern { pub struct BtcCentsRelSatsUsdPattern3 { pub btc: MetricPattern1, pub cents: MetricPattern1, - pub rel_to_circulating: BpsPercentRatioPattern4, - pub rel_to_own: BpsPercentRatioPattern4, + pub rel_to_circulating: BpsPercentRatioPattern3, + pub rel_to_own: BpsPercentRatioPattern3, pub sats: MetricPattern1, pub usd: MetricPattern1, } @@ -1679,8 +1679,8 @@ impl BtcCentsRelSatsUsdPattern3 { Self { btc: MetricPattern1::new(client.clone(), acc.clone()), cents: MetricPattern1::new(client.clone(), _m(&acc, "cents")), - rel_to_circulating: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "rel_to_circulating")), - rel_to_own: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "rel_to_own")), + rel_to_circulating: BpsPercentRatioPattern3::new(client.clone(), _m(&acc, "rel_to_circulating")), + rel_to_own: BpsPercentRatioPattern3::new(client.clone(), _m(&acc, "rel_to_own")), sats: MetricPattern1::new(client.clone(), _m(&acc, "sats")), usd: MetricPattern1::new(client.clone(), _m(&acc, "usd")), } @@ -1713,11 +1713,11 @@ impl CapLossMvrvPriceProfitSoprPattern { /// Pattern struct for repeated tree structure. pub struct DeltaHalfInRelTotalPattern { - pub delta: ChangeRatePattern2, + pub delta: ChangeRatePattern, pub half: BtcCentsSatsUsdPattern, pub in_loss: BtcCentsRelSatsUsdPattern, pub in_profit: BtcCentsRelSatsUsdPattern, - pub rel_to_circulating: BpsPercentRatioPattern4, + pub rel_to_circulating: BpsPercentRatioPattern3, pub total: BtcCentsSatsUsdPattern, } @@ -1725,11 +1725,11 @@ impl DeltaHalfInRelTotalPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - delta: ChangeRatePattern2::new(client.clone(), _m(&acc, "delta")), + delta: ChangeRatePattern::new(client.clone(), _m(&acc, "delta")), half: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "half")), in_loss: BtcCentsRelSatsUsdPattern::new(client.clone(), _m(&acc, "in_loss")), in_profit: BtcCentsRelSatsUsdPattern::new(client.clone(), _m(&acc, "in_profit")), - rel_to_circulating: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "rel_to_circulating")), + rel_to_circulating: BpsPercentRatioPattern3::new(client.clone(), _m(&acc, "rel_to_circulating")), total: BtcCentsSatsUsdPattern::new(client.clone(), acc.clone()), } } @@ -1737,11 +1737,11 @@ impl DeltaHalfInRelTotalPattern { /// Pattern struct for repeated tree structure. pub struct DeltaHalfInRelTotalPattern2 { - pub delta: ChangeRatePattern2, + pub delta: ChangeRatePattern, pub half: BtcCentsSatsUsdPattern, pub in_loss: BtcCentsRelSatsUsdPattern3, pub in_profit: BtcCentsRelSatsUsdPattern3, - pub rel_to_circulating: BpsPercentRatioPattern4, + pub rel_to_circulating: BpsPercentRatioPattern3, pub total: BtcCentsSatsUsdPattern, } @@ -1749,11 +1749,11 @@ impl DeltaHalfInRelTotalPattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - delta: ChangeRatePattern2::new(client.clone(), _m(&acc, "delta")), + delta: ChangeRatePattern::new(client.clone(), _m(&acc, "delta")), half: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "half")), in_loss: BtcCentsRelSatsUsdPattern3::new(client.clone(), _m(&acc, "in_loss")), in_profit: BtcCentsRelSatsUsdPattern3::new(client.clone(), _m(&acc, "in_profit")), - rel_to_circulating: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "rel_to_circulating")), + rel_to_circulating: BpsPercentRatioPattern3::new(client.clone(), _m(&acc, "rel_to_circulating")), total: BtcCentsSatsUsdPattern::new(client.clone(), acc.clone()), } } @@ -1875,7 +1875,7 @@ impl BpsCentsRatioSatsUsdPattern { pub struct BtcCentsRelSatsUsdPattern { pub btc: MetricPattern1, pub cents: MetricPattern1, - pub rel_to_circulating: BpsPercentRatioPattern4, + pub rel_to_circulating: BpsPercentRatioPattern3, pub sats: MetricPattern1, pub usd: MetricPattern1, } @@ -1886,7 +1886,7 @@ impl BtcCentsRelSatsUsdPattern { Self { btc: MetricPattern1::new(client.clone(), acc.clone()), cents: MetricPattern1::new(client.clone(), _m(&acc, "cents")), - rel_to_circulating: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "rel_to_circulating")), + rel_to_circulating: BpsPercentRatioPattern3::new(client.clone(), _m(&acc, "rel_to_circulating")), sats: MetricPattern1::new(client.clone(), _m(&acc, "sats")), usd: MetricPattern1::new(client.clone(), _m(&acc, "usd")), } @@ -1897,7 +1897,7 @@ impl BtcCentsRelSatsUsdPattern { pub struct BtcCentsRelSatsUsdPattern2 { pub btc: MetricPattern1, pub cents: MetricPattern1, - pub rel_to_own: BpsPercentRatioPattern4, + pub rel_to_own: BpsPercentRatioPattern3, pub sats: MetricPattern1, pub usd: MetricPattern1, } @@ -1908,7 +1908,7 @@ impl BtcCentsRelSatsUsdPattern2 { Self { btc: MetricPattern1::new(client.clone(), acc.clone()), cents: MetricPattern1::new(client.clone(), _m(&acc, "cents")), - rel_to_own: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "rel_to_own")), + rel_to_own: BpsPercentRatioPattern3::new(client.clone(), _m(&acc, "rel_to_own")), sats: MetricPattern1::new(client.clone(), _m(&acc, "sats")), usd: MetricPattern1::new(client.clone(), _m(&acc, "usd")), } @@ -1939,7 +1939,7 @@ impl CoindaysCoinyearsDormancySentVelocityPattern { /// Pattern struct for repeated tree structure. pub struct DeltaHalfInTotalPattern2 { - pub delta: ChangeRatePattern2, + pub delta: ChangeRatePattern, pub half: BtcCentsSatsUsdPattern, pub in_loss: BtcCentsSatsUsdPattern, pub in_profit: BtcCentsSatsUsdPattern, @@ -1950,7 +1950,7 @@ impl DeltaHalfInTotalPattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - delta: ChangeRatePattern2::new(client.clone(), _m(&acc, "delta")), + delta: ChangeRatePattern::new(client.clone(), _m(&acc, "delta")), half: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "half")), in_loss: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "in_loss")), in_profit: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "in_profit")), @@ -1987,7 +1987,7 @@ pub struct InvestedMaxMinPercentilesSupplyPattern { pub max: CentsSatsUsdPattern, pub min: CentsSatsUsdPattern, pub percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern, - pub supply_density: BpsPercentRatioPattern4, + pub supply_density: BpsPercentRatioPattern3, } impl InvestedMaxMinPercentilesSupplyPattern { @@ -1998,7 +1998,7 @@ impl InvestedMaxMinPercentilesSupplyPattern { max: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "cost_basis_max")), min: CentsSatsUsdPattern::new(client.clone(), _m(&acc, "cost_basis_min")), percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern::new(client.clone(), _m(&acc, "cost_basis")), - supply_density: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "supply_density")), + supply_density: BpsPercentRatioPattern3::new(client.clone(), _m(&acc, "supply_density")), } } } @@ -2007,7 +2007,7 @@ impl InvestedMaxMinPercentilesSupplyPattern { pub struct PhsReboundThsPattern { pub phs: MetricPattern1, pub phs_min: MetricPattern1, - pub rebound: BpsPercentRatioPattern2, + pub rebound: BpsPercentRatioPattern, pub ths: MetricPattern1, pub ths_min: MetricPattern1, } @@ -2018,7 +2018,7 @@ impl PhsReboundThsPattern { Self { phs: MetricPattern1::new(client.clone(), _m(&acc, "phs")), phs_min: MetricPattern1::new(client.clone(), _m(&acc, "phs_min")), - rebound: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "rebound")), + rebound: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rebound")), ths: MetricPattern1::new(client.clone(), _m(&acc, "ths")), ths_min: MetricPattern1::new(client.clone(), _m(&acc, "ths_min")), } @@ -2068,34 +2068,34 @@ impl _1m1w1y24hPattern2 { } /// Pattern struct for repeated tree structure. -pub struct _1m1w1y24hPattern3 { - pub _1m: BpsPercentRatioPattern2, - pub _1w: BpsPercentRatioPattern2, - pub _1y: BpsPercentRatioPattern2, - pub _24h: BpsPercentRatioPattern2, +pub struct _1m1w1y24hPattern6 { + pub _1m: BpsPercentRatioPattern4, + pub _1w: BpsPercentRatioPattern4, + pub _1y: BpsPercentRatioPattern4, + pub _24h: BpsPercentRatioPattern4, } -impl _1m1w1y24hPattern3 { +impl _1m1w1y24hPattern6 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - _1m: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "1m_rate")), - _1w: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "1w_rate")), - _1y: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "1y_rate")), - _24h: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "24h_rate")), + _1m: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "1m")), + _1w: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "1w")), + _1y: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "1y")), + _24h: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "24h")), } } } /// Pattern struct for repeated tree structure. -pub struct _1m1w1y24hPattern6 { +pub struct _1m1w1y24hPattern5 { pub _1m: BtcCentsSatsUsdPattern, pub _1w: BtcCentsSatsUsdPattern, pub _1y: BtcCentsSatsUsdPattern, pub _24h: BtcCentsSatsUsdPattern, } -impl _1m1w1y24hPattern6 { +impl _1m1w1y24hPattern5 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2128,14 +2128,14 @@ impl _1m1w1y2wPattern { } /// Pattern struct for repeated tree structure. -pub struct _1m1w1y24hPattern4 { +pub struct _1m1w1y24hPattern3 { pub _1m: CentsUsdPattern, pub _1w: CentsUsdPattern, pub _1y: CentsUsdPattern, pub _24h: CentsUsdPattern, } -impl _1m1w1y24hPattern4 { +impl _1m1w1y24hPattern3 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2148,14 +2148,14 @@ impl _1m1w1y24hPattern4 { } /// Pattern struct for repeated tree structure. -pub struct _1m1w1y24hPattern5 { +pub struct _1m1w1y24hPattern4 { pub _1m: CentsUsdPattern2, pub _1w: CentsUsdPattern2, pub _1y: CentsUsdPattern2, pub _24h: CentsUsdPattern2, } -impl _1m1w1y24hPattern5 { +impl _1m1w1y24hPattern4 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2211,8 +2211,8 @@ impl AdjustedRatioValuePattern { pub struct BaseCumulativeDeltaSumPattern { pub base: CentsUsdPattern, pub cumulative: CentsUsdPattern, - pub delta: ChangeRatePattern3, - pub sum: _1m1w1y24hPattern4, + pub delta: ChangeRatePattern2, + pub sum: _1m1w1y24hPattern3, } impl BaseCumulativeDeltaSumPattern { @@ -2221,8 +2221,8 @@ impl BaseCumulativeDeltaSumPattern { Self { base: CentsUsdPattern::new(client.clone(), acc.clone()), cumulative: CentsUsdPattern::new(client.clone(), _m(&acc, "cumulative")), - delta: ChangeRatePattern3::new(client.clone(), _m(&acc, "delta")), - sum: _1m1w1y24hPattern4::new(client.clone(), _m(&acc, "sum")), + delta: ChangeRatePattern2::new(client.clone(), _m(&acc, "delta")), + sum: _1m1w1y24hPattern3::new(client.clone(), _m(&acc, "sum")), } } } @@ -2232,7 +2232,7 @@ pub struct BaseCumulativeNegativeSumPattern { pub base: CentsUsdPattern2, pub cumulative: CentsUsdPattern2, pub negative: MetricPattern1, - pub sum: _1m1w1y24hPattern5, + pub sum: _1m1w1y24hPattern4, } impl BaseCumulativeNegativeSumPattern { @@ -2242,7 +2242,7 @@ impl BaseCumulativeNegativeSumPattern { base: CentsUsdPattern2::new(client.clone(), _m(&acc, "unrealized_loss")), cumulative: CentsUsdPattern2::new(client.clone(), _m(&acc, "unrealized_loss_cumulative")), negative: MetricPattern1::new(client.clone(), _m(&acc, "neg_unrealized_loss")), - sum: _1m1w1y24hPattern5::new(client.clone(), _m(&acc, "unrealized_loss_sum")), + sum: _1m1w1y24hPattern4::new(client.clone(), _m(&acc, "unrealized_loss_sum")), } } } @@ -2290,8 +2290,8 @@ impl BtcCentsSatsUsdPattern { /// Pattern struct for repeated tree structure. pub struct CentsDeltaRelUsdPattern { pub cents: MetricPattern1, - pub delta: ChangeRatePattern3, - pub rel_to_own_mcap: BpsPercentRatioPattern, + pub delta: ChangeRatePattern2, + pub rel_to_own_mcap: BpsPercentRatioPattern4, pub usd: MetricPattern1, } @@ -2300,8 +2300,8 @@ impl CentsDeltaRelUsdPattern { pub fn new(client: Arc, acc: String) -> Self { Self { cents: MetricPattern1::new(client.clone(), _m(&acc, "cents")), - delta: ChangeRatePattern3::new(client.clone(), _m(&acc, "delta")), - rel_to_own_mcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_own_mcap")), + delta: ChangeRatePattern2::new(client.clone(), _m(&acc, "delta")), + rel_to_own_mcap: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "rel_to_own_mcap")), usd: MetricPattern1::new(client.clone(), acc.clone()), } } @@ -2310,8 +2310,8 @@ impl CentsDeltaRelUsdPattern { /// Pattern struct for repeated tree structure. pub struct CentsRelUsdPattern2 { pub cents: MetricPattern1, - pub rel_to_own_gross: BpsPercentRatioPattern2, - pub rel_to_own_mcap: BpsPercentRatioPattern2, + pub rel_to_own_gross: BpsPercentRatioPattern, + pub rel_to_own_mcap: BpsPercentRatioPattern, pub usd: MetricPattern1, } @@ -2320,8 +2320,8 @@ impl CentsRelUsdPattern2 { pub fn new(client: Arc, acc: String) -> Self { Self { cents: MetricPattern1::new(client.clone(), _m(&acc, "cents")), - rel_to_own_gross: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "rel_to_own_gross_pnl")), - rel_to_own_mcap: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "rel_to_own_mcap")), + rel_to_own_gross: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_own_gross_pnl")), + rel_to_own_mcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_own_mcap")), usd: MetricPattern1::new(client.clone(), acc.clone()), } } @@ -2411,7 +2411,7 @@ impl _1m1w1y24hPattern { pub struct BaseCumulativeSumPattern4 { pub base: BtcCentsSatsUsdPattern, pub cumulative: BtcCentsSatsUsdPattern, - pub sum: _1m1w1y24hPattern6, + pub sum: _1m1w1y24hPattern5, } impl BaseCumulativeSumPattern4 { @@ -2420,7 +2420,7 @@ impl BaseCumulativeSumPattern4 { Self { base: BtcCentsSatsUsdPattern::new(client.clone(), acc.clone()), cumulative: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "cumulative")), - sum: _1m1w1y24hPattern6::new(client.clone(), _m(&acc, "sum")), + sum: _1m1w1y24hPattern5::new(client.clone(), _m(&acc, "sum")), } } } @@ -2429,7 +2429,7 @@ impl BaseCumulativeSumPattern4 { pub struct BaseCumulativeRelPattern { pub base: MetricPattern1, pub cumulative: MetricPattern1, - pub rel_to_rcap: BpsPercentRatioPattern, + pub rel_to_rcap: BpsPercentRatioPattern4, } impl BaseCumulativeRelPattern { @@ -2438,7 +2438,7 @@ impl BaseCumulativeRelPattern { Self { base: MetricPattern1::new(client.clone(), acc.clone()), cumulative: MetricPattern1::new(client.clone(), _m(&acc, "cumulative")), - rel_to_rcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rel_to_rcap")), + rel_to_rcap: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "rel_to_rcap")), } } } @@ -2447,7 +2447,7 @@ impl BaseCumulativeRelPattern { pub struct BaseCumulativeSumPattern3 { pub base: CentsUsdPattern2, pub cumulative: CentsUsdPattern2, - pub sum: _1m1w1y24hPattern5, + pub sum: _1m1w1y24hPattern4, } impl BaseCumulativeSumPattern3 { @@ -2456,7 +2456,7 @@ impl BaseCumulativeSumPattern3 { Self { base: CentsUsdPattern2::new(client.clone(), acc.clone()), cumulative: CentsUsdPattern2::new(client.clone(), _m(&acc, "cumulative")), - sum: _1m1w1y24hPattern5::new(client.clone(), _m(&acc, "sum")), + sum: _1m1w1y24hPattern4::new(client.clone(), _m(&acc, "sum")), } } } @@ -2498,13 +2498,13 @@ impl BlocksDominanceRewardsPattern { } /// Pattern struct for repeated tree structure. -pub struct BpsPercentRatioPattern4 { +pub struct BpsPercentRatioPattern3 { pub bps: MetricPattern1, pub percent: MetricPattern1, pub ratio: MetricPattern1, } -impl BpsPercentRatioPattern4 { +impl BpsPercentRatioPattern3 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2516,13 +2516,13 @@ impl BpsPercentRatioPattern4 { } /// Pattern struct for repeated tree structure. -pub struct BpsPercentRatioPattern { +pub struct BpsPercentRatioPattern4 { pub bps: MetricPattern1, pub percent: MetricPattern1, pub ratio: MetricPattern1, } -impl BpsPercentRatioPattern { +impl BpsPercentRatioPattern4 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2570,13 +2570,13 @@ impl BpsPercentRatioPattern5 { } /// Pattern struct for repeated tree structure. -pub struct BpsPercentRatioPattern2 { +pub struct BpsPercentRatioPattern { pub bps: MetricPattern1, pub percent: MetricPattern1, pub ratio: MetricPattern1, } -impl BpsPercentRatioPattern2 { +impl BpsPercentRatioPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { @@ -2608,7 +2608,7 @@ impl CentsSatsUsdPattern3 { /// Pattern struct for repeated tree structure. pub struct CentsDeltaUsdPattern { pub cents: MetricPattern1, - pub delta: ChangeRatePattern3, + pub delta: ChangeRatePattern2, pub usd: MetricPattern1, } @@ -2617,7 +2617,7 @@ impl CentsDeltaUsdPattern { pub fn new(client: Arc, acc: String) -> Self { Self { cents: MetricPattern1::new(client.clone(), _m(&acc, "cents")), - delta: ChangeRatePattern3::new(client.clone(), _m(&acc, "delta")), + delta: ChangeRatePattern2::new(client.clone(), _m(&acc, "delta")), usd: MetricPattern1::new(client.clone(), acc.clone()), } } @@ -2643,7 +2643,7 @@ impl CentsSatsUsdPattern { /// Pattern struct for repeated tree structure. pub struct DeltaHalfTotalPattern { - pub delta: ChangeRatePattern2, + pub delta: ChangeRatePattern, pub half: BtcCentsSatsUsdPattern, pub total: BtcCentsSatsUsdPattern, } @@ -2652,7 +2652,7 @@ impl DeltaHalfTotalPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - delta: ChangeRatePattern2::new(client.clone(), _m(&acc, "delta")), + delta: ChangeRatePattern::new(client.clone(), _m(&acc, "delta")), half: BtcCentsSatsUsdPattern::new(client.clone(), _m(&acc, "half")), total: BtcCentsSatsUsdPattern::new(client.clone(), acc.clone()), } @@ -2750,19 +2750,19 @@ impl RatioValuePattern { } /// Pattern struct for repeated tree structure. -pub struct _6bBlockTxindexPattern { +pub struct _6bBlockTxPattern { pub _6b: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2, pub block: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2, - pub txindex: MetricPattern19, + pub tx_index: MetricPattern19, } -impl _6bBlockTxindexPattern { +impl _6bBlockTxPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { _6b: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2::new(client.clone(), _m(&acc, "6b")), block: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2::new(client.clone(), acc.clone()), - txindex: MetricPattern19::new(client.clone(), acc.clone()), + tx_index: MetricPattern19::new(client.clone(), acc.clone()), } } } @@ -2788,7 +2788,7 @@ impl BaseCumulativeSumPattern { /// Pattern struct for repeated tree structure. pub struct BlocksDominancePattern { pub blocks_mined: BaseCumulativeSumPattern2, - pub dominance: BpsPercentRatioPattern4, + pub dominance: BpsPercentRatioPattern3, } impl BlocksDominancePattern { @@ -2796,7 +2796,7 @@ impl BlocksDominancePattern { pub fn new(client: Arc, acc: String) -> Self { Self { blocks_mined: BaseCumulativeSumPattern2::new(client.clone(), _m(&acc, "blocks_mined")), - dominance: BpsPercentRatioPattern4::new(client.clone(), _m(&acc, "dominance")), + dominance: BpsPercentRatioPattern3::new(client.clone(), _m(&acc, "dominance")), } } } @@ -2883,32 +2883,16 @@ impl ChangeRatePattern { /// Pattern struct for repeated tree structure. pub struct ChangeRatePattern2 { - pub change: _1m1w1y24hPattern, - pub rate: _1m1w1y24hPattern3, + pub change: _1m1w1y24hPattern3, + pub rate: _1m1w1y24hPattern2, } impl ChangeRatePattern2 { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - change: _1m1w1y24hPattern::new(client.clone(), acc.clone()), - rate: _1m1w1y24hPattern3::new(client.clone(), acc.clone()), - } - } -} - -/// Pattern struct for repeated tree structure. -pub struct ChangeRatePattern3 { - pub change: _1m1w1y24hPattern4, - pub rate: _1m1w1y24hPattern3, -} - -impl ChangeRatePattern3 { - /// Create a new pattern node with accumulated metric name. - pub fn new(client: Arc, acc: String) -> Self { - Self { - change: _1m1w1y24hPattern4::new(client.clone(), acc.clone()), - rate: _1m1w1y24hPattern3::new(client.clone(), acc.clone()), + change: _1m1w1y24hPattern3::new(client.clone(), acc.clone()), + rate: _1m1w1y24hPattern2::new(client.clone(), acc.clone()), } } } @@ -2931,7 +2915,7 @@ impl CoindaysSentPattern { /// Pattern struct for repeated tree structure. pub struct DeltaInnerPattern { - pub delta: ChangeRatePattern2, + pub delta: ChangeRatePattern, pub inner: MetricPattern1, } @@ -2939,7 +2923,7 @@ impl DeltaInnerPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - delta: ChangeRatePattern2::new(client.clone(), _m(&acc, "delta")), + delta: ChangeRatePattern::new(client.clone(), _m(&acc, "delta")), inner: MetricPattern1::new(client.clone(), acc.clone()), } } @@ -2995,16 +2979,16 @@ impl RealizedSupplyPattern { /// Pattern struct for repeated tree structure. pub struct RelPattern { - pub rel_to_mcap: BpsPercentRatioPattern2, - pub rel_to_rcap: BpsPercentRatioPattern2, + pub rel_to_mcap: BpsPercentRatioPattern, + pub rel_to_rcap: BpsPercentRatioPattern, } impl RelPattern { /// Create a new pattern node with accumulated metric name. pub fn new(client: Arc, acc: String) -> Self { Self { - rel_to_mcap: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "mcap")), - rel_to_rcap: BpsPercentRatioPattern2::new(client.clone(), _m(&acc, "rcap")), + rel_to_mcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "mcap")), + rel_to_rcap: BpsPercentRatioPattern::new(client.clone(), _m(&acc, "rcap")), } } } @@ -3166,7 +3150,7 @@ pub struct MetricsTree_Blocks_Difficulty { pub raw: MetricPattern18, pub base: MetricPattern2, pub as_hash: MetricPattern1, - pub adjustment: BpsPercentRatioPattern2, + pub adjustment: BpsPercentRatioPattern, pub epoch: MetricPattern1, pub blocks_before_next: MetricPattern1, pub days_before_next: MetricPattern1, @@ -3178,7 +3162,7 @@ impl MetricsTree_Blocks_Difficulty { raw: MetricPattern18::new(client.clone(), "difficulty".to_string()), base: MetricPattern2::new(client.clone(), "difficulty".to_string()), as_hash: MetricPattern1::new(client.clone(), "difficulty_as_hash".to_string()), - adjustment: BpsPercentRatioPattern2::new(client.clone(), "difficulty_adjustment".to_string()), + adjustment: BpsPercentRatioPattern::new(client.clone(), "difficulty_adjustment".to_string()), epoch: MetricPattern1::new(client.clone(), "difficulty_epoch".to_string()), blocks_before_next: MetricPattern1::new(client.clone(), "blocks_before_next_difficulty_adjustment".to_string()), days_before_next: MetricPattern1::new(client.clone(), "days_before_next_difficulty_adjustment".to_string()), @@ -3440,31 +3424,31 @@ impl MetricsTree_Transactions { /// Metrics tree node. pub struct MetricsTree_Transactions_Raw { - pub first_txindex: MetricPattern18, + pub first_tx_index: MetricPattern18, pub height: MetricPattern19, pub txid: MetricPattern19, - pub txversion: MetricPattern19, - pub rawlocktime: MetricPattern19, + pub tx_version: MetricPattern19, + pub raw_locktime: MetricPattern19, pub base_size: MetricPattern19, pub total_size: MetricPattern19, pub is_explicitly_rbf: MetricPattern19, - pub first_txinindex: MetricPattern19, - pub first_txoutindex: MetricPattern19, + pub first_txin_index: MetricPattern19, + pub first_txout_index: MetricPattern19, } impl MetricsTree_Transactions_Raw { pub fn new(client: Arc, base_path: String) -> Self { Self { - first_txindex: MetricPattern18::new(client.clone(), "first_txindex".to_string()), + first_tx_index: MetricPattern18::new(client.clone(), "first_tx_index".to_string()), height: MetricPattern19::new(client.clone(), "height".to_string()), txid: MetricPattern19::new(client.clone(), "txid".to_string()), - txversion: MetricPattern19::new(client.clone(), "txversion".to_string()), - rawlocktime: MetricPattern19::new(client.clone(), "rawlocktime".to_string()), + tx_version: MetricPattern19::new(client.clone(), "tx_version".to_string()), + raw_locktime: MetricPattern19::new(client.clone(), "raw_locktime".to_string()), base_size: MetricPattern19::new(client.clone(), "base_size".to_string()), total_size: MetricPattern19::new(client.clone(), "total_size".to_string()), is_explicitly_rbf: MetricPattern19::new(client.clone(), "is_explicitly_rbf".to_string()), - first_txinindex: MetricPattern19::new(client.clone(), "first_txinindex".to_string()), - first_txoutindex: MetricPattern19::new(client.clone(), "first_txoutindex".to_string()), + first_txin_index: MetricPattern19::new(client.clone(), "first_txin_index".to_string()), + first_txout_index: MetricPattern19::new(client.clone(), "first_txout_index".to_string()), } } } @@ -3486,15 +3470,15 @@ impl MetricsTree_Transactions_Count { /// Metrics tree node. pub struct MetricsTree_Transactions_Size { - pub vsize: _6bBlockTxindexPattern, - pub weight: _6bBlockTxindexPattern, + pub vsize: _6bBlockTxPattern, + pub weight: _6bBlockTxPattern, } impl MetricsTree_Transactions_Size { pub fn new(client: Arc, base_path: String) -> Self { Self { - vsize: _6bBlockTxindexPattern::new(client.clone(), "tx_vsize".to_string()), - weight: _6bBlockTxindexPattern::new(client.clone(), "tx_weight".to_string()), + vsize: _6bBlockTxPattern::new(client.clone(), "tx_vsize".to_string()), + weight: _6bBlockTxPattern::new(client.clone(), "tx_weight".to_string()), } } } @@ -3503,8 +3487,8 @@ impl MetricsTree_Transactions_Size { pub struct MetricsTree_Transactions_Fees { pub input_value: MetricPattern19, pub output_value: MetricPattern19, - pub fee: _6bBlockTxindexPattern, - pub fee_rate: _6bBlockTxindexPattern, + pub fee: _6bBlockTxPattern, + pub fee_rate: _6bBlockTxPattern, } impl MetricsTree_Transactions_Fees { @@ -3512,8 +3496,8 @@ impl MetricsTree_Transactions_Fees { Self { input_value: MetricPattern19::new(client.clone(), "input_value".to_string()), output_value: MetricPattern19::new(client.clone(), "output_value".to_string()), - fee: _6bBlockTxindexPattern::new(client.clone(), "fee".to_string()), - fee_rate: _6bBlockTxindexPattern::new(client.clone(), "fee_rate".to_string()), + fee: _6bBlockTxPattern::new(client.clone(), "fee".to_string()), + fee_rate: _6bBlockTxPattern::new(client.clone(), "fee_rate".to_string()), } } } @@ -3575,35 +3559,35 @@ impl MetricsTree_Inputs { /// Metrics tree node. pub struct MetricsTree_Inputs_Raw { - pub first_txinindex: MetricPattern18, + pub first_txin_index: MetricPattern18, pub outpoint: MetricPattern20, - pub txindex: MetricPattern20, - pub outputtype: MetricPattern20, - pub typeindex: MetricPattern20, + pub tx_index: MetricPattern20, + pub output_type: MetricPattern20, + pub type_index: MetricPattern20, } impl MetricsTree_Inputs_Raw { pub fn new(client: Arc, base_path: String) -> Self { Self { - first_txinindex: MetricPattern18::new(client.clone(), "first_txinindex".to_string()), + first_txin_index: MetricPattern18::new(client.clone(), "first_txin_index".to_string()), outpoint: MetricPattern20::new(client.clone(), "outpoint".to_string()), - txindex: MetricPattern20::new(client.clone(), "txindex".to_string()), - outputtype: MetricPattern20::new(client.clone(), "outputtype".to_string()), - typeindex: MetricPattern20::new(client.clone(), "typeindex".to_string()), + tx_index: MetricPattern20::new(client.clone(), "tx_index".to_string()), + output_type: MetricPattern20::new(client.clone(), "output_type".to_string()), + type_index: MetricPattern20::new(client.clone(), "type_index".to_string()), } } } /// Metrics tree node. pub struct MetricsTree_Inputs_Spent { - pub txoutindex: MetricPattern20, + pub txout_index: MetricPattern20, pub value: MetricPattern20, } impl MetricsTree_Inputs_Spent { pub fn new(client: Arc, base_path: String) -> Self { Self { - txoutindex: MetricPattern20::new(client.clone(), "txoutindex".to_string()), + txout_index: MetricPattern20::new(client.clone(), "txout_index".to_string()), value: MetricPattern20::new(client.clone(), "value".to_string()), } } @@ -3628,34 +3612,34 @@ impl MetricsTree_Outputs { /// Metrics tree node. pub struct MetricsTree_Outputs_Raw { - pub first_txoutindex: MetricPattern18, + pub first_txout_index: MetricPattern18, pub value: MetricPattern21, - pub outputtype: MetricPattern21, - pub typeindex: MetricPattern21, - pub txindex: MetricPattern21, + pub output_type: MetricPattern21, + pub type_index: MetricPattern21, + pub tx_index: MetricPattern21, } impl MetricsTree_Outputs_Raw { pub fn new(client: Arc, base_path: String) -> Self { Self { - first_txoutindex: MetricPattern18::new(client.clone(), "first_txoutindex".to_string()), + first_txout_index: MetricPattern18::new(client.clone(), "first_txout_index".to_string()), value: MetricPattern21::new(client.clone(), "value".to_string()), - outputtype: MetricPattern21::new(client.clone(), "outputtype".to_string()), - typeindex: MetricPattern21::new(client.clone(), "typeindex".to_string()), - txindex: MetricPattern21::new(client.clone(), "txindex".to_string()), + output_type: MetricPattern21::new(client.clone(), "output_type".to_string()), + type_index: MetricPattern21::new(client.clone(), "type_index".to_string()), + tx_index: MetricPattern21::new(client.clone(), "tx_index".to_string()), } } } /// Metrics tree node. pub struct MetricsTree_Outputs_Spent { - pub txinindex: MetricPattern21, + pub txin_index: MetricPattern21, } impl MetricsTree_Outputs_Spent { pub fn new(client: Arc, base_path: String) -> Self { Self { - txinindex: MetricPattern21::new(client.clone(), "txinindex".to_string()), + txin_index: MetricPattern21::new(client.clone(), "txin_index".to_string()), } } } @@ -3740,8 +3724,8 @@ pub struct MetricsTree_Addresses_Raw_P2pk65 { impl MetricsTree_Addresses_Raw_P2pk65 { pub fn new(client: Arc, base_path: String) -> Self { Self { - first_index: MetricPattern18::new(client.clone(), "first_p2pk65addressindex".to_string()), - bytes: MetricPattern27::new(client.clone(), "p2pk65bytes".to_string()), + first_index: MetricPattern18::new(client.clone(), "first_p2pk65_address_index".to_string()), + bytes: MetricPattern27::new(client.clone(), "p2pk65_bytes".to_string()), } } } @@ -3755,8 +3739,8 @@ pub struct MetricsTree_Addresses_Raw_P2pk33 { impl MetricsTree_Addresses_Raw_P2pk33 { pub fn new(client: Arc, base_path: String) -> Self { Self { - first_index: MetricPattern18::new(client.clone(), "first_p2pk33addressindex".to_string()), - bytes: MetricPattern26::new(client.clone(), "p2pk33bytes".to_string()), + first_index: MetricPattern18::new(client.clone(), "first_p2pk33_address_index".to_string()), + bytes: MetricPattern26::new(client.clone(), "p2pk33_bytes".to_string()), } } } @@ -3770,8 +3754,8 @@ pub struct MetricsTree_Addresses_Raw_P2pkh { impl MetricsTree_Addresses_Raw_P2pkh { pub fn new(client: Arc, base_path: String) -> Self { Self { - first_index: MetricPattern18::new(client.clone(), "first_p2pkhaddressindex".to_string()), - bytes: MetricPattern28::new(client.clone(), "p2pkhbytes".to_string()), + first_index: MetricPattern18::new(client.clone(), "first_p2pkh_address_index".to_string()), + bytes: MetricPattern28::new(client.clone(), "p2pkh_bytes".to_string()), } } } @@ -3785,8 +3769,8 @@ pub struct MetricsTree_Addresses_Raw_P2sh { impl MetricsTree_Addresses_Raw_P2sh { pub fn new(client: Arc, base_path: String) -> Self { Self { - first_index: MetricPattern18::new(client.clone(), "first_p2shaddressindex".to_string()), - bytes: MetricPattern29::new(client.clone(), "p2shbytes".to_string()), + first_index: MetricPattern18::new(client.clone(), "first_p2sh_address_index".to_string()), + bytes: MetricPattern29::new(client.clone(), "p2sh_bytes".to_string()), } } } @@ -3800,8 +3784,8 @@ pub struct MetricsTree_Addresses_Raw_P2wpkh { impl MetricsTree_Addresses_Raw_P2wpkh { pub fn new(client: Arc, base_path: String) -> Self { Self { - first_index: MetricPattern18::new(client.clone(), "first_p2wpkhaddressindex".to_string()), - bytes: MetricPattern31::new(client.clone(), "p2wpkhbytes".to_string()), + first_index: MetricPattern18::new(client.clone(), "first_p2wpkh_address_index".to_string()), + bytes: MetricPattern31::new(client.clone(), "p2wpkh_bytes".to_string()), } } } @@ -3815,8 +3799,8 @@ pub struct MetricsTree_Addresses_Raw_P2wsh { impl MetricsTree_Addresses_Raw_P2wsh { pub fn new(client: Arc, base_path: String) -> Self { Self { - first_index: MetricPattern18::new(client.clone(), "first_p2wshaddressindex".to_string()), - bytes: MetricPattern32::new(client.clone(), "p2wshbytes".to_string()), + first_index: MetricPattern18::new(client.clone(), "first_p2wsh_address_index".to_string()), + bytes: MetricPattern32::new(client.clone(), "p2wsh_bytes".to_string()), } } } @@ -3830,8 +3814,8 @@ pub struct MetricsTree_Addresses_Raw_P2tr { impl MetricsTree_Addresses_Raw_P2tr { pub fn new(client: Arc, base_path: String) -> Self { Self { - first_index: MetricPattern18::new(client.clone(), "first_p2traddressindex".to_string()), - bytes: MetricPattern30::new(client.clone(), "p2trbytes".to_string()), + first_index: MetricPattern18::new(client.clone(), "first_p2tr_address_index".to_string()), + bytes: MetricPattern30::new(client.clone(), "p2tr_bytes".to_string()), } } } @@ -3845,8 +3829,8 @@ pub struct MetricsTree_Addresses_Raw_P2a { impl MetricsTree_Addresses_Raw_P2a { pub fn new(client: Arc, base_path: String) -> Self { Self { - first_index: MetricPattern18::new(client.clone(), "first_p2aaddressindex".to_string()), - bytes: MetricPattern24::new(client.clone(), "p2abytes".to_string()), + first_index: MetricPattern18::new(client.clone(), "first_p2a_address_index".to_string()), + bytes: MetricPattern24::new(client.clone(), "p2a_bytes".to_string()), } } } @@ -3868,14 +3852,14 @@ pub struct MetricsTree_Addresses_Indexes { impl MetricsTree_Addresses_Indexes { pub fn new(client: Arc, base_path: String) -> Self { Self { - p2a: MetricPattern24::new(client.clone(), "anyaddressindex".to_string()), - p2pk33: MetricPattern26::new(client.clone(), "anyaddressindex".to_string()), - p2pk65: MetricPattern27::new(client.clone(), "anyaddressindex".to_string()), - p2pkh: MetricPattern28::new(client.clone(), "anyaddressindex".to_string()), - p2sh: MetricPattern29::new(client.clone(), "anyaddressindex".to_string()), - p2tr: MetricPattern30::new(client.clone(), "anyaddressindex".to_string()), - p2wpkh: MetricPattern31::new(client.clone(), "anyaddressindex".to_string()), - p2wsh: MetricPattern32::new(client.clone(), "anyaddressindex".to_string()), + p2a: MetricPattern24::new(client.clone(), "any_address_index".to_string()), + p2pk33: MetricPattern26::new(client.clone(), "any_address_index".to_string()), + p2pk65: MetricPattern27::new(client.clone(), "any_address_index".to_string()), + p2pkh: MetricPattern28::new(client.clone(), "any_address_index".to_string()), + p2sh: MetricPattern29::new(client.clone(), "any_address_index".to_string()), + p2tr: MetricPattern30::new(client.clone(), "any_address_index".to_string()), + p2wpkh: MetricPattern31::new(client.clone(), "any_address_index".to_string()), + p2wsh: MetricPattern32::new(client.clone(), "any_address_index".to_string()), funded: MetricPattern34::new(client.clone(), "funded_address_index".to_string()), empty: MetricPattern35::new(client.clone(), "empty_address_index".to_string()), } @@ -3891,8 +3875,8 @@ pub struct MetricsTree_Addresses_Data { impl MetricsTree_Addresses_Data { pub fn new(client: Arc, base_path: String) -> Self { Self { - funded: MetricPattern34::new(client.clone(), "fundedaddressdata".to_string()), - empty: MetricPattern35::new(client.clone(), "emptyaddressdata".to_string()), + funded: MetricPattern34::new(client.clone(), "funded_address_data".to_string()), + empty: MetricPattern35::new(client.clone(), "empty_address_data".to_string()), } } } @@ -4025,14 +4009,14 @@ impl MetricsTree_Scripts_Raw { /// Metrics tree node. pub struct MetricsTree_Scripts_Raw_Empty { pub first_index: MetricPattern18, - pub to_txindex: MetricPattern22, + pub to_tx_index: MetricPattern22, } impl MetricsTree_Scripts_Raw_Empty { pub fn new(client: Arc, base_path: String) -> Self { Self { - first_index: MetricPattern18::new(client.clone(), "first_emptyoutputindex".to_string()), - to_txindex: MetricPattern22::new(client.clone(), "txindex".to_string()), + first_index: MetricPattern18::new(client.clone(), "first_empty_output_index".to_string()), + to_tx_index: MetricPattern22::new(client.clone(), "tx_index".to_string()), } } } @@ -4040,14 +4024,14 @@ impl MetricsTree_Scripts_Raw_Empty { /// Metrics tree node. pub struct MetricsTree_Scripts_Raw_Opreturn { pub first_index: MetricPattern18, - pub to_txindex: MetricPattern23, + pub to_tx_index: MetricPattern23, } impl MetricsTree_Scripts_Raw_Opreturn { pub fn new(client: Arc, base_path: String) -> Self { Self { - first_index: MetricPattern18::new(client.clone(), "first_opreturnindex".to_string()), - to_txindex: MetricPattern23::new(client.clone(), "txindex".to_string()), + first_index: MetricPattern18::new(client.clone(), "first_op_return_index".to_string()), + to_tx_index: MetricPattern23::new(client.clone(), "tx_index".to_string()), } } } @@ -4055,14 +4039,14 @@ impl MetricsTree_Scripts_Raw_Opreturn { /// Metrics tree node. pub struct MetricsTree_Scripts_Raw_P2ms { pub first_index: MetricPattern18, - pub to_txindex: MetricPattern25, + pub to_tx_index: MetricPattern25, } impl MetricsTree_Scripts_Raw_P2ms { pub fn new(client: Arc, base_path: String) -> Self { Self { - first_index: MetricPattern18::new(client.clone(), "first_p2msoutputindex".to_string()), - to_txindex: MetricPattern25::new(client.clone(), "txindex".to_string()), + first_index: MetricPattern18::new(client.clone(), "first_p2ms_output_index".to_string()), + to_tx_index: MetricPattern25::new(client.clone(), "tx_index".to_string()), } } } @@ -4070,14 +4054,14 @@ impl MetricsTree_Scripts_Raw_P2ms { /// Metrics tree node. pub struct MetricsTree_Scripts_Raw_Unknown { pub first_index: MetricPattern18, - pub to_txindex: MetricPattern33, + pub to_tx_index: MetricPattern33, } impl MetricsTree_Scripts_Raw_Unknown { pub fn new(client: Arc, base_path: String) -> Self { Self { - first_index: MetricPattern18::new(client.clone(), "first_unknownoutputindex".to_string()), - to_txindex: MetricPattern33::new(client.clone(), "txindex".to_string()), + first_index: MetricPattern18::new(client.clone(), "first_unknown_output_index".to_string()), + to_tx_index: MetricPattern33::new(client.clone(), "tx_index".to_string()), } } } @@ -4094,8 +4078,8 @@ pub struct MetricsTree_Scripts_Count { pub p2wpkh: BaseCumulativeSumPattern, pub p2wsh: BaseCumulativeSumPattern, pub opreturn: BaseCumulativeSumPattern, - pub emptyoutput: BaseCumulativeSumPattern, - pub unknownoutput: BaseCumulativeSumPattern, + pub empty_output: BaseCumulativeSumPattern, + pub unknown_output: BaseCumulativeSumPattern, pub segwit: BaseCumulativeSumPattern, } @@ -4112,8 +4096,8 @@ impl MetricsTree_Scripts_Count { p2wpkh: BaseCumulativeSumPattern::new(client.clone(), "p2wpkh_count".to_string()), p2wsh: BaseCumulativeSumPattern::new(client.clone(), "p2wsh_count".to_string()), opreturn: BaseCumulativeSumPattern::new(client.clone(), "opreturn_count".to_string()), - emptyoutput: BaseCumulativeSumPattern::new(client.clone(), "emptyoutput_count".to_string()), - unknownoutput: BaseCumulativeSumPattern::new(client.clone(), "unknownoutput_count".to_string()), + empty_output: BaseCumulativeSumPattern::new(client.clone(), "empty_output_count".to_string()), + unknown_output: BaseCumulativeSumPattern::new(client.clone(), "unknown_output_count".to_string()), segwit: BaseCumulativeSumPattern::new(client.clone(), "segwit_count".to_string()), } } @@ -4149,15 +4133,15 @@ impl MetricsTree_Scripts_Value_Opreturn { /// Metrics tree node. pub struct MetricsTree_Scripts_Adoption { - pub taproot: BpsPercentRatioPattern4, - pub segwit: BpsPercentRatioPattern4, + pub taproot: BpsPercentRatioPattern3, + pub segwit: BpsPercentRatioPattern3, } impl MetricsTree_Scripts_Adoption { pub fn new(client: Arc, base_path: String) -> Self { Self { - taproot: BpsPercentRatioPattern4::new(client.clone(), "taproot_adoption".to_string()), - segwit: BpsPercentRatioPattern4::new(client.clone(), "segwit_adoption".to_string()), + taproot: BpsPercentRatioPattern3::new(client.clone(), "taproot_adoption".to_string()), + segwit: BpsPercentRatioPattern3::new(client.clone(), "segwit_adoption".to_string()), } } } @@ -4219,7 +4203,7 @@ impl MetricsTree_Mining_Rewards_Subsidy { pub struct MetricsTree_Mining_Rewards_Fees { pub base: BtcCentsSatsUsdPattern, pub cumulative: BtcCentsSatsUsdPattern, - pub sum: _1m1w1y24hPattern6, + pub sum: _1m1w1y24hPattern5, pub _24h: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern, pub _1w: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern, pub _1m: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern, @@ -4233,7 +4217,7 @@ impl MetricsTree_Mining_Rewards_Fees { Self { base: BtcCentsSatsUsdPattern::new(client.clone(), "fees".to_string()), cumulative: BtcCentsSatsUsdPattern::new(client.clone(), "fees_cumulative".to_string()), - sum: _1m1w1y24hPattern6::new(client.clone(), "fees_sum".to_string()), + sum: _1m1w1y24hPattern5::new(client.clone(), "fees_sum".to_string()), _24h: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), "fees_24h".to_string()), _1w: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), "fees_1w".to_string()), _1m: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern::new(client.clone(), "fees_1m".to_string()), @@ -4327,7 +4311,7 @@ pub struct MetricsTree_Cointime { pub prices: MetricsTree_Cointime_Prices, pub adjusted: MetricsTree_Cointime_Adjusted, pub reserve_risk: MetricsTree_Cointime_ReserveRisk, - pub coinblocks_destroyed: MetricsTree_Cointime_CoinblocksDestroyed, + pub coinblocks_destroyed: BaseCumulativeSumPattern, } impl MetricsTree_Cointime { @@ -4340,7 +4324,7 @@ impl MetricsTree_Cointime { prices: MetricsTree_Cointime_Prices::new(client.clone(), format!("{base_path}_prices")), adjusted: MetricsTree_Cointime_Adjusted::new(client.clone(), format!("{base_path}_adjusted")), reserve_risk: MetricsTree_Cointime_ReserveRisk::new(client.clone(), format!("{base_path}_reserve_risk")), - coinblocks_destroyed: MetricsTree_Cointime_CoinblocksDestroyed::new(client.clone(), format!("{base_path}_coinblocks_destroyed")), + coinblocks_destroyed: BaseCumulativeSumPattern::new(client.clone(), "coinblocks_destroyed".to_string()), } } } @@ -4454,7 +4438,7 @@ impl MetricsTree_Cointime_Prices { /// Metrics tree node. pub struct MetricsTree_Cointime_Adjusted { - pub inflation_rate: BpsPercentRatioPattern2, + pub inflation_rate: BpsPercentRatioPattern, pub tx_velocity_btc: MetricPattern1, pub tx_velocity_usd: MetricPattern1, } @@ -4462,7 +4446,7 @@ pub struct MetricsTree_Cointime_Adjusted { impl MetricsTree_Cointime_Adjusted { pub fn new(client: Arc, base_path: String) -> Self { Self { - inflation_rate: BpsPercentRatioPattern2::new(client.clone(), "cointime_adj_inflation_rate".to_string()), + inflation_rate: BpsPercentRatioPattern::new(client.clone(), "cointime_adj_inflation_rate".to_string()), tx_velocity_btc: MetricPattern1::new(client.clone(), "cointime_adj_tx_velocity_btc".to_string()), tx_velocity_usd: MetricPattern1::new(client.clone(), "cointime_adj_tx_velocity_usd".to_string()), } @@ -4486,21 +4470,6 @@ impl MetricsTree_Cointime_ReserveRisk { } } -/// Metrics tree node. -pub struct MetricsTree_Cointime_CoinblocksDestroyed { - pub base: MetricPattern1, - pub cumulative: MetricPattern1, -} - -impl MetricsTree_Cointime_CoinblocksDestroyed { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - base: MetricPattern1::new(client.clone(), "coinblocks_destroyed".to_string()), - cumulative: MetricPattern1::new(client.clone(), "coinblocks_destroyed_cumulative".to_string()), - } - } -} - /// Metrics tree node. pub struct MetricsTree_Constants { pub _0: MetricPattern1, @@ -4567,9 +4536,9 @@ pub struct MetricsTree_Indexes { pub month6: MetricsTree_Indexes_Month6, pub year1: MetricsTree_Indexes_Year1, pub year10: MetricsTree_Indexes_Year10, - pub txindex: MetricsTree_Indexes_Txindex, - pub txinindex: MetricsTree_Indexes_Txinindex, - pub txoutindex: MetricsTree_Indexes_Txoutindex, + pub tx_index: MetricsTree_Indexes_TxIndex, + pub txin_index: MetricsTree_Indexes_TxinIndex, + pub txout_index: MetricsTree_Indexes_TxoutIndex, } impl MetricsTree_Indexes { @@ -4592,9 +4561,9 @@ impl MetricsTree_Indexes { month6: MetricsTree_Indexes_Month6::new(client.clone(), format!("{base_path}_month6")), year1: MetricsTree_Indexes_Year1::new(client.clone(), format!("{base_path}_year1")), year10: MetricsTree_Indexes_Year10::new(client.clone(), format!("{base_path}_year10")), - txindex: MetricsTree_Indexes_Txindex::new(client.clone(), format!("{base_path}_txindex")), - txinindex: MetricsTree_Indexes_Txinindex::new(client.clone(), format!("{base_path}_txinindex")), - txoutindex: MetricsTree_Indexes_Txoutindex::new(client.clone(), format!("{base_path}_txoutindex")), + tx_index: MetricsTree_Indexes_TxIndex::new(client.clone(), format!("{base_path}_tx_index")), + txin_index: MetricsTree_Indexes_TxinIndex::new(client.clone(), format!("{base_path}_txin_index")), + txout_index: MetricsTree_Indexes_TxoutIndex::new(client.clone(), format!("{base_path}_txout_index")), } } } @@ -4642,7 +4611,7 @@ pub struct MetricsTree_Indexes_Address_P2pk33 { impl MetricsTree_Indexes_Address_P2pk33 { pub fn new(client: Arc, base_path: String) -> Self { Self { - identity: MetricPattern26::new(client.clone(), "p2pk33addressindex".to_string()), + identity: MetricPattern26::new(client.clone(), "p2pk33_address_index".to_string()), } } } @@ -4655,7 +4624,7 @@ pub struct MetricsTree_Indexes_Address_P2pk65 { impl MetricsTree_Indexes_Address_P2pk65 { pub fn new(client: Arc, base_path: String) -> Self { Self { - identity: MetricPattern27::new(client.clone(), "p2pk65addressindex".to_string()), + identity: MetricPattern27::new(client.clone(), "p2pk65_address_index".to_string()), } } } @@ -4668,7 +4637,7 @@ pub struct MetricsTree_Indexes_Address_P2pkh { impl MetricsTree_Indexes_Address_P2pkh { pub fn new(client: Arc, base_path: String) -> Self { Self { - identity: MetricPattern28::new(client.clone(), "p2pkhaddressindex".to_string()), + identity: MetricPattern28::new(client.clone(), "p2pkh_address_index".to_string()), } } } @@ -4681,7 +4650,7 @@ pub struct MetricsTree_Indexes_Address_P2sh { impl MetricsTree_Indexes_Address_P2sh { pub fn new(client: Arc, base_path: String) -> Self { Self { - identity: MetricPattern29::new(client.clone(), "p2shaddressindex".to_string()), + identity: MetricPattern29::new(client.clone(), "p2sh_address_index".to_string()), } } } @@ -4694,7 +4663,7 @@ pub struct MetricsTree_Indexes_Address_P2tr { impl MetricsTree_Indexes_Address_P2tr { pub fn new(client: Arc, base_path: String) -> Self { Self { - identity: MetricPattern30::new(client.clone(), "p2traddressindex".to_string()), + identity: MetricPattern30::new(client.clone(), "p2tr_address_index".to_string()), } } } @@ -4707,7 +4676,7 @@ pub struct MetricsTree_Indexes_Address_P2wpkh { impl MetricsTree_Indexes_Address_P2wpkh { pub fn new(client: Arc, base_path: String) -> Self { Self { - identity: MetricPattern31::new(client.clone(), "p2wpkhaddressindex".to_string()), + identity: MetricPattern31::new(client.clone(), "p2wpkh_address_index".to_string()), } } } @@ -4720,7 +4689,7 @@ pub struct MetricsTree_Indexes_Address_P2wsh { impl MetricsTree_Indexes_Address_P2wsh { pub fn new(client: Arc, base_path: String) -> Self { Self { - identity: MetricPattern32::new(client.clone(), "p2wshaddressindex".to_string()), + identity: MetricPattern32::new(client.clone(), "p2wsh_address_index".to_string()), } } } @@ -4733,7 +4702,7 @@ pub struct MetricsTree_Indexes_Address_P2a { impl MetricsTree_Indexes_Address_P2a { pub fn new(client: Arc, base_path: String) -> Self { Self { - identity: MetricPattern24::new(client.clone(), "p2aaddressindex".to_string()), + identity: MetricPattern24::new(client.clone(), "p2a_address_index".to_string()), } } } @@ -4746,7 +4715,7 @@ pub struct MetricsTree_Indexes_Address_P2ms { impl MetricsTree_Indexes_Address_P2ms { pub fn new(client: Arc, base_path: String) -> Self { Self { - identity: MetricPattern25::new(client.clone(), "p2msoutputindex".to_string()), + identity: MetricPattern25::new(client.clone(), "p2ms_output_index".to_string()), } } } @@ -4759,7 +4728,7 @@ pub struct MetricsTree_Indexes_Address_Empty { impl MetricsTree_Indexes_Address_Empty { pub fn new(client: Arc, base_path: String) -> Self { Self { - identity: MetricPattern22::new(client.clone(), "emptyoutputindex".to_string()), + identity: MetricPattern22::new(client.clone(), "empty_output_index".to_string()), } } } @@ -4772,7 +4741,7 @@ pub struct MetricsTree_Indexes_Address_Unknown { impl MetricsTree_Indexes_Address_Unknown { pub fn new(client: Arc, base_path: String) -> Self { Self { - identity: MetricPattern33::new(client.clone(), "unknownoutputindex".to_string()), + identity: MetricPattern33::new(client.clone(), "unknown_output_index".to_string()), } } } @@ -4785,7 +4754,7 @@ pub struct MetricsTree_Indexes_Address_Opreturn { impl MetricsTree_Indexes_Address_Opreturn { pub fn new(client: Arc, base_path: String) -> Self { Self { - identity: MetricPattern23::new(client.clone(), "opreturnindex".to_string()), + identity: MetricPattern23::new(client.clone(), "op_return_index".to_string()), } } } @@ -4808,7 +4777,7 @@ pub struct MetricsTree_Indexes_Height { pub month6: MetricPattern18, pub year1: MetricPattern18, pub year10: MetricPattern18, - pub txindex_count: MetricPattern18, + pub tx_index_count: MetricPattern18, } impl MetricsTree_Indexes_Height { @@ -4830,7 +4799,7 @@ impl MetricsTree_Indexes_Height { month6: MetricPattern18::new(client.clone(), "month6".to_string()), year1: MetricPattern18::new(client.clone(), "year1".to_string()), year10: MetricPattern18::new(client.clone(), "year10".to_string()), - txindex_count: MetricPattern18::new(client.clone(), "txindex_count".to_string()), + tx_index_count: MetricPattern18::new(client.clone(), "tx_index_count".to_string()), } } } @@ -5079,16 +5048,16 @@ impl MetricsTree_Indexes_Year10 { } /// Metrics tree node. -pub struct MetricsTree_Indexes_Txindex { +pub struct MetricsTree_Indexes_TxIndex { pub identity: MetricPattern19, pub input_count: MetricPattern19, pub output_count: MetricPattern19, } -impl MetricsTree_Indexes_Txindex { +impl MetricsTree_Indexes_TxIndex { pub fn new(client: Arc, base_path: String) -> Self { Self { - identity: MetricPattern19::new(client.clone(), "txindex".to_string()), + identity: MetricPattern19::new(client.clone(), "tx_index".to_string()), input_count: MetricPattern19::new(client.clone(), "input_count".to_string()), output_count: MetricPattern19::new(client.clone(), "output_count".to_string()), } @@ -5096,27 +5065,27 @@ impl MetricsTree_Indexes_Txindex { } /// Metrics tree node. -pub struct MetricsTree_Indexes_Txinindex { +pub struct MetricsTree_Indexes_TxinIndex { pub identity: MetricPattern20, } -impl MetricsTree_Indexes_Txinindex { +impl MetricsTree_Indexes_TxinIndex { pub fn new(client: Arc, base_path: String) -> Self { Self { - identity: MetricPattern20::new(client.clone(), "txinindex".to_string()), + identity: MetricPattern20::new(client.clone(), "txin_index".to_string()), } } } /// Metrics tree node. -pub struct MetricsTree_Indexes_Txoutindex { +pub struct MetricsTree_Indexes_TxoutIndex { pub identity: MetricPattern21, } -impl MetricsTree_Indexes_Txoutindex { +impl MetricsTree_Indexes_TxoutIndex { pub fn new(client: Arc, base_path: String) -> Self { Self { - identity: MetricPattern21::new(client.clone(), "txoutindex".to_string()), + identity: MetricPattern21::new(client.clone(), "txout_index".to_string()), } } } @@ -5125,7 +5094,7 @@ impl MetricsTree_Indexes_Txoutindex { pub struct MetricsTree_Indicators { pub puell_multiple: BpsRatioPattern2, pub nvt: BpsRatioPattern2, - pub gini: BpsPercentRatioPattern4, + pub gini: BpsPercentRatioPattern3, pub rhodl_ratio: BpsRatioPattern2, pub thermocap_multiple: BpsRatioPattern2, pub coindays_destroyed_supply_adjusted: MetricPattern1, @@ -5140,7 +5109,7 @@ impl MetricsTree_Indicators { Self { puell_multiple: BpsRatioPattern2::new(client.clone(), "puell_multiple".to_string()), nvt: BpsRatioPattern2::new(client.clone(), "nvt".to_string()), - gini: BpsPercentRatioPattern4::new(client.clone(), "gini".to_string()), + gini: BpsPercentRatioPattern3::new(client.clone(), "gini".to_string()), rhodl_ratio: BpsRatioPattern2::new(client.clone(), "rhodl_ratio".to_string()), thermocap_multiple: BpsRatioPattern2::new(client.clone(), "thermocap_multiple".to_string()), coindays_destroyed_supply_adjusted: MetricPattern1::new(client.clone(), "coindays_destroyed_supply_adjusted".to_string()), @@ -5273,37 +5242,37 @@ impl MetricsTree_Market_Returns { /// Metrics tree node. pub struct MetricsTree_Market_Returns_Periods { - pub _24h: BpsPercentRatioPattern2, - pub _1w: BpsPercentRatioPattern2, - pub _1m: BpsPercentRatioPattern2, - pub _3m: BpsPercentRatioPattern2, - pub _6m: BpsPercentRatioPattern2, - pub _1y: BpsPercentRatioPattern2, - pub _2y: BpsPercentRatioPattern2, - pub _3y: BpsPercentRatioPattern2, - pub _4y: BpsPercentRatioPattern2, - pub _5y: BpsPercentRatioPattern2, - pub _6y: BpsPercentRatioPattern2, - pub _8y: BpsPercentRatioPattern2, - pub _10y: BpsPercentRatioPattern2, + pub _24h: BpsPercentRatioPattern, + pub _1w: BpsPercentRatioPattern, + pub _1m: BpsPercentRatioPattern, + pub _3m: BpsPercentRatioPattern, + pub _6m: BpsPercentRatioPattern, + pub _1y: BpsPercentRatioPattern, + pub _2y: BpsPercentRatioPattern, + pub _3y: BpsPercentRatioPattern, + pub _4y: BpsPercentRatioPattern, + pub _5y: BpsPercentRatioPattern, + pub _6y: BpsPercentRatioPattern, + pub _8y: BpsPercentRatioPattern, + pub _10y: BpsPercentRatioPattern, } impl MetricsTree_Market_Returns_Periods { pub fn new(client: Arc, base_path: String) -> Self { Self { - _24h: BpsPercentRatioPattern2::new(client.clone(), "price_return_24h".to_string()), - _1w: BpsPercentRatioPattern2::new(client.clone(), "price_return_1w".to_string()), - _1m: BpsPercentRatioPattern2::new(client.clone(), "price_return_1m".to_string()), - _3m: BpsPercentRatioPattern2::new(client.clone(), "price_return_3m".to_string()), - _6m: BpsPercentRatioPattern2::new(client.clone(), "price_return_6m".to_string()), - _1y: BpsPercentRatioPattern2::new(client.clone(), "price_return_1y".to_string()), - _2y: BpsPercentRatioPattern2::new(client.clone(), "price_return_2y".to_string()), - _3y: BpsPercentRatioPattern2::new(client.clone(), "price_return_3y".to_string()), - _4y: BpsPercentRatioPattern2::new(client.clone(), "price_return_4y".to_string()), - _5y: BpsPercentRatioPattern2::new(client.clone(), "price_return_5y".to_string()), - _6y: BpsPercentRatioPattern2::new(client.clone(), "price_return_6y".to_string()), - _8y: BpsPercentRatioPattern2::new(client.clone(), "price_return_8y".to_string()), - _10y: BpsPercentRatioPattern2::new(client.clone(), "price_return_10y".to_string()), + _24h: BpsPercentRatioPattern::new(client.clone(), "price_return_24h".to_string()), + _1w: BpsPercentRatioPattern::new(client.clone(), "price_return_1w".to_string()), + _1m: BpsPercentRatioPattern::new(client.clone(), "price_return_1m".to_string()), + _3m: BpsPercentRatioPattern::new(client.clone(), "price_return_3m".to_string()), + _6m: BpsPercentRatioPattern::new(client.clone(), "price_return_6m".to_string()), + _1y: BpsPercentRatioPattern::new(client.clone(), "price_return_1y".to_string()), + _2y: BpsPercentRatioPattern::new(client.clone(), "price_return_2y".to_string()), + _3y: BpsPercentRatioPattern::new(client.clone(), "price_return_3y".to_string()), + _4y: BpsPercentRatioPattern::new(client.clone(), "price_return_4y".to_string()), + _5y: BpsPercentRatioPattern::new(client.clone(), "price_return_5y".to_string()), + _6y: BpsPercentRatioPattern::new(client.clone(), "price_return_6y".to_string()), + _8y: BpsPercentRatioPattern::new(client.clone(), "price_return_8y".to_string()), + _10y: BpsPercentRatioPattern::new(client.clone(), "price_return_10y".to_string()), } } } @@ -5378,7 +5347,7 @@ pub struct MetricsTree_Market_Range { pub max: _1m1w1y2wPattern, pub true_range: MetricPattern1, pub true_range_sum_2w: MetricPattern1, - pub choppiness_index_2w: BpsPercentRatioPattern4, + pub choppiness_index_2w: BpsPercentRatioPattern3, } impl MetricsTree_Market_Range { @@ -5388,7 +5357,7 @@ impl MetricsTree_Market_Range { max: _1m1w1y2wPattern::new(client.clone(), "price_max".to_string()), true_range: MetricPattern1::new(client.clone(), "price_true_range".to_string()), true_range_sum_2w: MetricPattern1::new(client.clone(), "price_true_range_sum_2w".to_string()), - choppiness_index_2w: BpsPercentRatioPattern4::new(client.clone(), "price_choppiness_index_2w".to_string()), + choppiness_index_2w: BpsPercentRatioPattern3::new(client.clone(), "price_choppiness_index_2w".to_string()), } } } @@ -5757,35 +5726,35 @@ impl MetricsTree_Market_Dca_Class_CostBasis { /// Metrics tree node. pub struct MetricsTree_Market_Dca_Class_Return { - pub from_2015: BpsPercentRatioPattern2, - pub from_2016: BpsPercentRatioPattern2, - pub from_2017: BpsPercentRatioPattern2, - pub from_2018: BpsPercentRatioPattern2, - pub from_2019: BpsPercentRatioPattern2, - pub from_2020: BpsPercentRatioPattern2, - pub from_2021: BpsPercentRatioPattern2, - pub from_2022: BpsPercentRatioPattern2, - pub from_2023: BpsPercentRatioPattern2, - pub from_2024: BpsPercentRatioPattern2, - pub from_2025: BpsPercentRatioPattern2, - pub from_2026: BpsPercentRatioPattern2, + pub from_2015: BpsPercentRatioPattern, + pub from_2016: BpsPercentRatioPattern, + pub from_2017: BpsPercentRatioPattern, + pub from_2018: BpsPercentRatioPattern, + pub from_2019: BpsPercentRatioPattern, + pub from_2020: BpsPercentRatioPattern, + pub from_2021: BpsPercentRatioPattern, + pub from_2022: BpsPercentRatioPattern, + pub from_2023: BpsPercentRatioPattern, + pub from_2024: BpsPercentRatioPattern, + pub from_2025: BpsPercentRatioPattern, + pub from_2026: BpsPercentRatioPattern, } impl MetricsTree_Market_Dca_Class_Return { pub fn new(client: Arc, base_path: String) -> Self { Self { - from_2015: BpsPercentRatioPattern2::new(client.clone(), "dca_return_from_2015".to_string()), - from_2016: BpsPercentRatioPattern2::new(client.clone(), "dca_return_from_2016".to_string()), - from_2017: BpsPercentRatioPattern2::new(client.clone(), "dca_return_from_2017".to_string()), - from_2018: BpsPercentRatioPattern2::new(client.clone(), "dca_return_from_2018".to_string()), - from_2019: BpsPercentRatioPattern2::new(client.clone(), "dca_return_from_2019".to_string()), - from_2020: BpsPercentRatioPattern2::new(client.clone(), "dca_return_from_2020".to_string()), - from_2021: BpsPercentRatioPattern2::new(client.clone(), "dca_return_from_2021".to_string()), - from_2022: BpsPercentRatioPattern2::new(client.clone(), "dca_return_from_2022".to_string()), - from_2023: BpsPercentRatioPattern2::new(client.clone(), "dca_return_from_2023".to_string()), - from_2024: BpsPercentRatioPattern2::new(client.clone(), "dca_return_from_2024".to_string()), - from_2025: BpsPercentRatioPattern2::new(client.clone(), "dca_return_from_2025".to_string()), - from_2026: BpsPercentRatioPattern2::new(client.clone(), "dca_return_from_2026".to_string()), + from_2015: BpsPercentRatioPattern::new(client.clone(), "dca_return_from_2015".to_string()), + from_2016: BpsPercentRatioPattern::new(client.clone(), "dca_return_from_2016".to_string()), + from_2017: BpsPercentRatioPattern::new(client.clone(), "dca_return_from_2017".to_string()), + from_2018: BpsPercentRatioPattern::new(client.clone(), "dca_return_from_2018".to_string()), + from_2019: BpsPercentRatioPattern::new(client.clone(), "dca_return_from_2019".to_string()), + from_2020: BpsPercentRatioPattern::new(client.clone(), "dca_return_from_2020".to_string()), + from_2021: BpsPercentRatioPattern::new(client.clone(), "dca_return_from_2021".to_string()), + from_2022: BpsPercentRatioPattern::new(client.clone(), "dca_return_from_2022".to_string()), + from_2023: BpsPercentRatioPattern::new(client.clone(), "dca_return_from_2023".to_string()), + from_2024: BpsPercentRatioPattern::new(client.clone(), "dca_return_from_2024".to_string()), + from_2025: BpsPercentRatioPattern::new(client.clone(), "dca_return_from_2025".to_string()), + from_2026: BpsPercentRatioPattern::new(client.clone(), "dca_return_from_2026".to_string()), } } } @@ -5793,8 +5762,8 @@ impl MetricsTree_Market_Dca_Class_Return { /// Metrics tree node. pub struct MetricsTree_Market_Technical { pub rsi: MetricsTree_Market_Technical_Rsi, - pub stoch_k: BpsPercentRatioPattern4, - pub stoch_d: BpsPercentRatioPattern4, + pub stoch_k: BpsPercentRatioPattern3, + pub stoch_d: BpsPercentRatioPattern3, pub pi_cycle: BpsRatioPattern2, pub macd: MetricsTree_Market_Technical_Macd, } @@ -5803,8 +5772,8 @@ impl MetricsTree_Market_Technical { pub fn new(client: Arc, base_path: String) -> Self { Self { rsi: MetricsTree_Market_Technical_Rsi::new(client.clone(), format!("{base_path}_rsi")), - stoch_k: BpsPercentRatioPattern4::new(client.clone(), "stoch_k".to_string()), - stoch_d: BpsPercentRatioPattern4::new(client.clone(), "stoch_d".to_string()), + stoch_k: BpsPercentRatioPattern3::new(client.clone(), "stoch_k".to_string()), + stoch_d: BpsPercentRatioPattern3::new(client.clone(), "stoch_d".to_string()), pi_cycle: BpsRatioPattern2::new(client.clone(), "pi_cycle".to_string()), macd: MetricsTree_Market_Technical_Macd::new(client.clone(), format!("{base_path}_macd")), } @@ -5836,12 +5805,12 @@ pub struct MetricsTree_Market_Technical_Rsi_1w { pub losses: MetricPattern1, pub average_gain: MetricPattern1, pub average_loss: MetricPattern1, - pub rsi: BpsPercentRatioPattern4, - pub rsi_min: BpsPercentRatioPattern4, - pub rsi_max: BpsPercentRatioPattern4, - pub stoch_rsi: BpsPercentRatioPattern4, - pub stoch_rsi_k: BpsPercentRatioPattern4, - pub stoch_rsi_d: BpsPercentRatioPattern4, + pub rsi: BpsPercentRatioPattern3, + pub rsi_min: BpsPercentRatioPattern3, + pub rsi_max: BpsPercentRatioPattern3, + pub stoch_rsi: BpsPercentRatioPattern3, + pub stoch_rsi_k: BpsPercentRatioPattern3, + pub stoch_rsi_d: BpsPercentRatioPattern3, } impl MetricsTree_Market_Technical_Rsi_1w { @@ -5851,12 +5820,12 @@ impl MetricsTree_Market_Technical_Rsi_1w { losses: MetricPattern1::new(client.clone(), "rsi_losses_1w".to_string()), average_gain: MetricPattern1::new(client.clone(), "rsi_average_gain_1w".to_string()), average_loss: MetricPattern1::new(client.clone(), "rsi_average_loss_1w".to_string()), - rsi: BpsPercentRatioPattern4::new(client.clone(), "rsi_1w".to_string()), - rsi_min: BpsPercentRatioPattern4::new(client.clone(), "rsi_min_1w".to_string()), - rsi_max: BpsPercentRatioPattern4::new(client.clone(), "rsi_max_1w".to_string()), - stoch_rsi: BpsPercentRatioPattern4::new(client.clone(), "rsi_stoch_1w".to_string()), - stoch_rsi_k: BpsPercentRatioPattern4::new(client.clone(), "rsi_stoch_k_1w".to_string()), - stoch_rsi_d: BpsPercentRatioPattern4::new(client.clone(), "rsi_stoch_d_1w".to_string()), + rsi: BpsPercentRatioPattern3::new(client.clone(), "rsi_1w".to_string()), + rsi_min: BpsPercentRatioPattern3::new(client.clone(), "rsi_min_1w".to_string()), + rsi_max: BpsPercentRatioPattern3::new(client.clone(), "rsi_max_1w".to_string()), + stoch_rsi: BpsPercentRatioPattern3::new(client.clone(), "rsi_stoch_1w".to_string()), + stoch_rsi_k: BpsPercentRatioPattern3::new(client.clone(), "rsi_stoch_k_1w".to_string()), + stoch_rsi_d: BpsPercentRatioPattern3::new(client.clone(), "rsi_stoch_d_1w".to_string()), } } } @@ -5867,12 +5836,12 @@ pub struct MetricsTree_Market_Technical_Rsi_1m { pub losses: MetricPattern1, pub average_gain: MetricPattern1, pub average_loss: MetricPattern1, - pub rsi: BpsPercentRatioPattern4, - pub rsi_min: BpsPercentRatioPattern4, - pub rsi_max: BpsPercentRatioPattern4, - pub stoch_rsi: BpsPercentRatioPattern4, - pub stoch_rsi_k: BpsPercentRatioPattern4, - pub stoch_rsi_d: BpsPercentRatioPattern4, + pub rsi: BpsPercentRatioPattern3, + pub rsi_min: BpsPercentRatioPattern3, + pub rsi_max: BpsPercentRatioPattern3, + pub stoch_rsi: BpsPercentRatioPattern3, + pub stoch_rsi_k: BpsPercentRatioPattern3, + pub stoch_rsi_d: BpsPercentRatioPattern3, } impl MetricsTree_Market_Technical_Rsi_1m { @@ -5882,12 +5851,12 @@ impl MetricsTree_Market_Technical_Rsi_1m { losses: MetricPattern1::new(client.clone(), "rsi_losses_1m".to_string()), average_gain: MetricPattern1::new(client.clone(), "rsi_average_gain_1m".to_string()), average_loss: MetricPattern1::new(client.clone(), "rsi_average_loss_1m".to_string()), - rsi: BpsPercentRatioPattern4::new(client.clone(), "rsi_1m".to_string()), - rsi_min: BpsPercentRatioPattern4::new(client.clone(), "rsi_min_1m".to_string()), - rsi_max: BpsPercentRatioPattern4::new(client.clone(), "rsi_max_1m".to_string()), - stoch_rsi: BpsPercentRatioPattern4::new(client.clone(), "rsi_stoch_1m".to_string()), - stoch_rsi_k: BpsPercentRatioPattern4::new(client.clone(), "rsi_stoch_k_1m".to_string()), - stoch_rsi_d: BpsPercentRatioPattern4::new(client.clone(), "rsi_stoch_d_1m".to_string()), + rsi: BpsPercentRatioPattern3::new(client.clone(), "rsi_1m".to_string()), + rsi_min: BpsPercentRatioPattern3::new(client.clone(), "rsi_min_1m".to_string()), + rsi_max: BpsPercentRatioPattern3::new(client.clone(), "rsi_max_1m".to_string()), + stoch_rsi: BpsPercentRatioPattern3::new(client.clone(), "rsi_stoch_1m".to_string()), + stoch_rsi_k: BpsPercentRatioPattern3::new(client.clone(), "rsi_stoch_k_1m".to_string()), + stoch_rsi_d: BpsPercentRatioPattern3::new(client.clone(), "rsi_stoch_d_1m".to_string()), } } } @@ -5898,12 +5867,12 @@ pub struct MetricsTree_Market_Technical_Rsi_1y { pub losses: MetricPattern1, pub average_gain: MetricPattern1, pub average_loss: MetricPattern1, - pub rsi: BpsPercentRatioPattern4, - pub rsi_min: BpsPercentRatioPattern4, - pub rsi_max: BpsPercentRatioPattern4, - pub stoch_rsi: BpsPercentRatioPattern4, - pub stoch_rsi_k: BpsPercentRatioPattern4, - pub stoch_rsi_d: BpsPercentRatioPattern4, + pub rsi: BpsPercentRatioPattern3, + pub rsi_min: BpsPercentRatioPattern3, + pub rsi_max: BpsPercentRatioPattern3, + pub stoch_rsi: BpsPercentRatioPattern3, + pub stoch_rsi_k: BpsPercentRatioPattern3, + pub stoch_rsi_d: BpsPercentRatioPattern3, } impl MetricsTree_Market_Technical_Rsi_1y { @@ -5913,12 +5882,12 @@ impl MetricsTree_Market_Technical_Rsi_1y { losses: MetricPattern1::new(client.clone(), "rsi_losses_1y".to_string()), average_gain: MetricPattern1::new(client.clone(), "rsi_average_gain_1y".to_string()), average_loss: MetricPattern1::new(client.clone(), "rsi_average_loss_1y".to_string()), - rsi: BpsPercentRatioPattern4::new(client.clone(), "rsi_1y".to_string()), - rsi_min: BpsPercentRatioPattern4::new(client.clone(), "rsi_min_1y".to_string()), - rsi_max: BpsPercentRatioPattern4::new(client.clone(), "rsi_max_1y".to_string()), - stoch_rsi: BpsPercentRatioPattern4::new(client.clone(), "rsi_stoch_1y".to_string()), - stoch_rsi_k: BpsPercentRatioPattern4::new(client.clone(), "rsi_stoch_k_1y".to_string()), - stoch_rsi_d: BpsPercentRatioPattern4::new(client.clone(), "rsi_stoch_d_1y".to_string()), + rsi: BpsPercentRatioPattern3::new(client.clone(), "rsi_1y".to_string()), + rsi_min: BpsPercentRatioPattern3::new(client.clone(), "rsi_min_1y".to_string()), + rsi_max: BpsPercentRatioPattern3::new(client.clone(), "rsi_max_1y".to_string()), + stoch_rsi: BpsPercentRatioPattern3::new(client.clone(), "rsi_stoch_1y".to_string()), + stoch_rsi_k: BpsPercentRatioPattern3::new(client.clone(), "rsi_stoch_k_1y".to_string()), + stoch_rsi_d: BpsPercentRatioPattern3::new(client.clone(), "rsi_stoch_d_1y".to_string()), } } } @@ -6442,7 +6411,7 @@ impl MetricsTree_Prices_Spot { pub struct MetricsTree_Supply { pub circulating: BtcCentsSatsUsdPattern, pub burned: MetricsTree_Supply_Burned, - pub inflation_rate: BpsPercentRatioPattern2, + pub inflation_rate: BpsPercentRatioPattern, pub velocity: MetricsTree_Supply_Velocity, pub market_cap: CentsDeltaUsdPattern, pub market_minus_realized_cap_growth_rate: _1m1w1y24hPattern, @@ -6455,7 +6424,7 @@ impl MetricsTree_Supply { Self { circulating: BtcCentsSatsUsdPattern::new(client.clone(), "circulating_supply".to_string()), burned: MetricsTree_Supply_Burned::new(client.clone(), format!("{base_path}_burned")), - inflation_rate: BpsPercentRatioPattern2::new(client.clone(), "inflation_rate".to_string()), + inflation_rate: BpsPercentRatioPattern::new(client.clone(), "inflation_rate".to_string()), velocity: MetricsTree_Supply_Velocity::new(client.clone(), format!("{base_path}_velocity")), market_cap: CentsDeltaUsdPattern::new(client.clone(), "market_cap".to_string()), market_minus_realized_cap_growth_rate: _1m1w1y24hPattern::new(client.clone(), "market_minus_realized_cap_growth_rate".to_string()), @@ -6578,7 +6547,7 @@ pub struct MetricsTree_Cohorts_Utxo_All_Supply { pub in_loss: BtcCentsRelSatsUsdPattern2, pub total: BtcCentsSatsUsdPattern, pub half: BtcCentsSatsUsdPattern, - pub delta: ChangeRatePattern2, + pub delta: ChangeRatePattern, } impl MetricsTree_Cohorts_Utxo_All_Supply { @@ -6588,7 +6557,7 @@ impl MetricsTree_Cohorts_Utxo_All_Supply { in_loss: BtcCentsRelSatsUsdPattern2::new(client.clone(), "supply_in_loss".to_string()), total: BtcCentsSatsUsdPattern::new(client.clone(), "supply".to_string()), half: BtcCentsSatsUsdPattern::new(client.clone(), "supply_half".to_string()), - delta: ChangeRatePattern2::new(client.clone(), "supply_delta".to_string()), + delta: ChangeRatePattern::new(client.clone(), "supply_delta".to_string()), } } } @@ -6623,9 +6592,9 @@ pub struct MetricsTree_Cohorts_Utxo_All_Unrealized_Loss { pub negative: MetricPattern1, pub base: CentsUsdPattern2, pub cumulative: CentsUsdPattern2, - pub sum: _1m1w1y24hPattern5, - pub rel_to_mcap: BpsPercentRatioPattern4, - pub rel_to_own_gross: BpsPercentRatioPattern4, + pub sum: _1m1w1y24hPattern4, + pub rel_to_mcap: BpsPercentRatioPattern3, + pub rel_to_own_gross: BpsPercentRatioPattern3, } impl MetricsTree_Cohorts_Utxo_All_Unrealized_Loss { @@ -6634,9 +6603,9 @@ impl MetricsTree_Cohorts_Utxo_All_Unrealized_Loss { negative: MetricPattern1::new(client.clone(), "neg_unrealized_loss".to_string()), base: CentsUsdPattern2::new(client.clone(), "unrealized_loss".to_string()), cumulative: CentsUsdPattern2::new(client.clone(), "unrealized_loss_cumulative".to_string()), - sum: _1m1w1y24hPattern5::new(client.clone(), "unrealized_loss_sum".to_string()), - rel_to_mcap: BpsPercentRatioPattern4::new(client.clone(), "unrealized_loss_rel_to_mcap".to_string()), - rel_to_own_gross: BpsPercentRatioPattern4::new(client.clone(), "unrealized_loss_rel_to_own_gross_pnl".to_string()), + sum: _1m1w1y24hPattern4::new(client.clone(), "unrealized_loss_sum".to_string()), + rel_to_mcap: BpsPercentRatioPattern3::new(client.clone(), "unrealized_loss_rel_to_mcap".to_string()), + rel_to_own_gross: BpsPercentRatioPattern3::new(client.clone(), "unrealized_loss_rel_to_own_gross_pnl".to_string()), } } } @@ -6645,7 +6614,7 @@ impl MetricsTree_Cohorts_Utxo_All_Unrealized_Loss { pub struct MetricsTree_Cohorts_Utxo_All_Unrealized_NetPnl { pub cents: MetricPattern1, pub usd: MetricPattern1, - pub rel_to_own_gross: BpsPercentRatioPattern2, + pub rel_to_own_gross: BpsPercentRatioPattern, } impl MetricsTree_Cohorts_Utxo_All_Unrealized_NetPnl { @@ -6653,7 +6622,7 @@ impl MetricsTree_Cohorts_Utxo_All_Unrealized_NetPnl { Self { cents: MetricPattern1::new(client.clone(), "net_unrealized_pnl_cents".to_string()), usd: MetricPattern1::new(client.clone(), "net_unrealized_pnl".to_string()), - rel_to_own_gross: BpsPercentRatioPattern2::new(client.clone(), "net_unrealized_pnl_rel_to_own_gross_pnl".to_string()), + rel_to_own_gross: BpsPercentRatioPattern::new(client.clone(), "net_unrealized_pnl_rel_to_own_gross_pnl".to_string()), } } } @@ -6662,9 +6631,9 @@ impl MetricsTree_Cohorts_Utxo_All_Unrealized_NetPnl { pub struct MetricsTree_Cohorts_Utxo_All_Unrealized_Profit { pub base: CentsUsdPattern2, pub cumulative: CentsUsdPattern2, - pub sum: _1m1w1y24hPattern5, - pub rel_to_mcap: BpsPercentRatioPattern4, - pub rel_to_own_gross: BpsPercentRatioPattern4, + pub sum: _1m1w1y24hPattern4, + pub rel_to_mcap: BpsPercentRatioPattern3, + pub rel_to_own_gross: BpsPercentRatioPattern3, } impl MetricsTree_Cohorts_Utxo_All_Unrealized_Profit { @@ -6672,9 +6641,9 @@ impl MetricsTree_Cohorts_Utxo_All_Unrealized_Profit { Self { base: CentsUsdPattern2::new(client.clone(), "unrealized_profit".to_string()), cumulative: CentsUsdPattern2::new(client.clone(), "unrealized_profit_cumulative".to_string()), - sum: _1m1w1y24hPattern5::new(client.clone(), "unrealized_profit_sum".to_string()), - rel_to_mcap: BpsPercentRatioPattern4::new(client.clone(), "unrealized_profit_rel_to_mcap".to_string()), - rel_to_own_gross: BpsPercentRatioPattern4::new(client.clone(), "unrealized_profit_rel_to_own_gross_pnl".to_string()), + sum: _1m1w1y24hPattern4::new(client.clone(), "unrealized_profit_sum".to_string()), + rel_to_mcap: BpsPercentRatioPattern3::new(client.clone(), "unrealized_profit_rel_to_mcap".to_string()), + rel_to_own_gross: BpsPercentRatioPattern3::new(client.clone(), "unrealized_profit_rel_to_own_gross_pnl".to_string()), } } } @@ -6730,7 +6699,7 @@ pub struct MetricsTree_Cohorts_Utxo_Lth_Realized { pub profit: BaseCumulativeDistributionRelSumValuePattern, pub loss: BaseCapitulationCumulativeNegativeRelSumValuePattern, pub gross_pnl: BaseCumulativeSumPattern3, - pub sell_side_risk_ratio: MetricsTree_Cohorts_Utxo_Lth_Realized_SellSideRiskRatio, + pub sell_side_risk_ratio: _1m1w1y24hPattern6, pub net_pnl: BaseChangeCumulativeDeltaRelSumPattern, pub sopr: MetricsTree_Cohorts_Utxo_Lth_Realized_Sopr, pub peak_regret: BaseCumulativeRelPattern, @@ -6747,7 +6716,7 @@ impl MetricsTree_Cohorts_Utxo_Lth_Realized { profit: BaseCumulativeDistributionRelSumValuePattern::new(client.clone(), "lth".to_string()), loss: BaseCapitulationCumulativeNegativeRelSumValuePattern::new(client.clone(), "lth".to_string()), gross_pnl: BaseCumulativeSumPattern3::new(client.clone(), "lth_realized_gross_pnl".to_string()), - sell_side_risk_ratio: MetricsTree_Cohorts_Utxo_Lth_Realized_SellSideRiskRatio::new(client.clone(), format!("{base_path}_sell_side_risk_ratio")), + sell_side_risk_ratio: _1m1w1y24hPattern6::new(client.clone(), "lth_sell_side_risk_ratio".to_string()), net_pnl: BaseChangeCumulativeDeltaRelSumPattern::new(client.clone(), "lth_net".to_string()), sopr: MetricsTree_Cohorts_Utxo_Lth_Realized_Sopr::new(client.clone(), format!("{base_path}_sopr")), peak_regret: BaseCumulativeRelPattern::new(client.clone(), "lth_realized_peak_regret".to_string()), @@ -6760,25 +6729,6 @@ impl MetricsTree_Cohorts_Utxo_Lth_Realized { } } -/// Metrics tree node. -pub struct MetricsTree_Cohorts_Utxo_Lth_Realized_SellSideRiskRatio { - pub _24h: BpsPercentRatioPattern, - pub _1w: BpsPercentRatioPattern, - pub _1m: BpsPercentRatioPattern, - pub _1y: BpsPercentRatioPattern, -} - -impl MetricsTree_Cohorts_Utxo_Lth_Realized_SellSideRiskRatio { - pub fn new(client: Arc, base_path: String) -> Self { - Self { - _24h: BpsPercentRatioPattern::new(client.clone(), "lth_sell_side_risk_ratio_24h".to_string()), - _1w: BpsPercentRatioPattern::new(client.clone(), "lth_sell_side_risk_ratio_1w".to_string()), - _1m: BpsPercentRatioPattern::new(client.clone(), "lth_sell_side_risk_ratio_1m".to_string()), - _1y: BpsPercentRatioPattern::new(client.clone(), "lth_sell_side_risk_ratio_1y".to_string()), - } - } -} - /// Metrics tree node. pub struct MetricsTree_Cohorts_Utxo_Lth_Realized_Sopr { pub ratio: _1m1w1y24hPattern, diff --git a/crates/brk_computer/examples/computer_read.rs b/crates/brk_computer/examples/computer_read.rs index 294da338a..2c3e4331b 100644 --- a/crates/brk_computer/examples/computer_read.rs +++ b/crates/brk_computer/examples/computer_read.rs @@ -14,23 +14,23 @@ pub fn main() -> Result<()> { let computer = Computer::forced_import(&outputs_dir, &indexer)?; - // Test emptyaddressdata (underlying BytesVec) - direct access + // Test empty_address_data (underlying BytesVec) - direct access let empty_data = &computer.distribution.addresses_data.empty; - println!("emptyaddressdata (BytesVec) len: {}", empty_data.len()); + println!("empty_address_data (BytesVec) len: {}", empty_data.len()); let start = Instant::now(); let mut buf = Vec::new(); empty_data.write_json(Some(empty_data.len() - 1), Some(empty_data.len()), &mut buf)?; println!( - "emptyaddressdata last item JSON: {}", + "empty_address_data last item JSON: {}", String::from_utf8_lossy(&buf) ); println!("Time for BytesVec write_json: {:?}", start.elapsed()); - // Test emptyaddressindex (LazyVecFrom1 wrapper) - computed access + // Test empty_address_index (LazyVecFrom1 wrapper) - computed access let empty_index = &computer.distribution.addresses.empty_index; println!( - "\nemptyaddressindex (LazyVecFrom1) len: {}", + "\nempty_address_index (LazyVecFrom1) len: {}", empty_index.len() ); @@ -42,14 +42,14 @@ pub fn main() -> Result<()> { &mut buf, )?; println!( - "emptyaddressindex last item JSON: {}", + "empty_address_index last item JSON: {}", String::from_utf8_lossy(&buf) ); println!("Time for LazyVecFrom1 write_json: {:?}", start.elapsed()); // Compare with funded versions let funded_data = &computer.distribution.addresses_data.funded; - println!("\nfundedaddressdata (BytesVec) len: {}", funded_data.len()); + println!("\nfunded_address_data (BytesVec) len: {}", funded_data.len()); let start = Instant::now(); let mut buf = Vec::new(); @@ -59,7 +59,7 @@ pub fn main() -> Result<()> { &mut buf, )?; println!( - "fundedaddressdata last item JSON: {}", + "funded_address_data last item JSON: {}", String::from_utf8_lossy(&buf) ); println!("Time for BytesVec write_json: {:?}", start.elapsed()); diff --git a/crates/brk_computer/src/distribution/address/activity.rs b/crates/brk_computer/src/distribution/address/activity.rs index a0576be7c..bd17a770d 100644 --- a/crates/brk_computer/src/distribution/address/activity.rs +++ b/crates/brk_computer/src/distribution/address/activity.rs @@ -259,7 +259,7 @@ impl AddressTypeToActivityCountVecs { pub struct AddressActivityVecs { pub all: ActivityCountVecs, #[traversable(flatten)] - pub by_addresstype: AddressTypeToActivityCountVecs, + pub by_address_type: AddressTypeToActivityCountVecs, } impl AddressActivityVecs { @@ -272,7 +272,7 @@ impl AddressActivityVecs { ) -> Result { Ok(Self { all: ActivityCountVecs::forced_import(db, name, version, indexes, cached_starts)?, - by_addresstype: AddressTypeToActivityCountVecs::forced_import( + by_address_type: AddressTypeToActivityCountVecs::forced_import( db, name, version, indexes, cached_starts, )?, }) @@ -281,7 +281,7 @@ impl AddressActivityVecs { pub(crate) fn min_stateful_len(&self) -> usize { self.all .min_stateful_len() - .min(self.by_addresstype.min_stateful_len()) + .min(self.by_address_type.min_stateful_len()) } pub(crate) fn par_iter_height_mut( @@ -289,12 +289,12 @@ impl AddressActivityVecs { ) -> impl ParallelIterator { self.all .par_iter_height_mut() - .chain(self.by_addresstype.par_iter_height_mut()) + .chain(self.by_address_type.par_iter_height_mut()) } pub(crate) fn reset_height(&mut self) -> Result<()> { self.all.reset_height()?; - self.by_addresstype.reset_height()?; + self.by_address_type.reset_height()?; Ok(()) } @@ -304,7 +304,7 @@ impl AddressActivityVecs { exit: &Exit, ) -> Result<()> { self.all.compute_rest(max_from, exit)?; - self.by_addresstype.compute_rest(max_from, exit)?; + self.by_address_type.compute_rest(max_from, exit)?; Ok(()) } @@ -315,7 +315,7 @@ impl AddressActivityVecs { ) -> Result<()> { let totals = counts.totals(); self.all.truncate_push_height(height, &totals)?; - self.by_addresstype.truncate_push_height(height, counts)?; + self.by_address_type.truncate_push_height(height, counts)?; Ok(()) } } diff --git a/crates/brk_computer/src/distribution/address/address_count.rs b/crates/brk_computer/src/distribution/address/address_count.rs index 1641ee90d..3f93ad0a0 100644 --- a/crates/brk_computer/src/distribution/address/address_count.rs +++ b/crates/brk_computer/src/distribution/address/address_count.rs @@ -165,7 +165,7 @@ impl AddressTypeToAddressCountVecs { pub struct AddressCountsVecs { pub all: AddressCountVecs, #[traversable(flatten)] - pub by_addresstype: AddressTypeToAddressCountVecs, + pub by_address_type: AddressTypeToAddressCountVecs, } impl AddressCountsVecs { @@ -177,24 +177,24 @@ impl AddressCountsVecs { ) -> Result { Ok(Self { all: AddressCountVecs::forced_import(db, name, version, indexes)?, - by_addresstype: AddressTypeToAddressCountVecs::forced_import(db, name, version, indexes)?, + by_address_type: AddressTypeToAddressCountVecs::forced_import(db, name, version, indexes)?, }) } pub(crate) fn min_stateful_len(&self) -> usize { - self.all.height.len().min(self.by_addresstype.min_stateful_len()) + self.all.height.len().min(self.by_address_type.min_stateful_len()) } pub(crate) fn par_iter_height_mut( &mut self, ) -> impl ParallelIterator { rayon::iter::once(&mut self.all.height as &mut dyn AnyStoredVec) - .chain(self.by_addresstype.par_iter_height_mut()) + .chain(self.by_address_type.par_iter_height_mut()) } pub(crate) fn reset_height(&mut self) -> Result<()> { self.all.height.reset()?; - self.by_addresstype.reset_height()?; + self.by_address_type.reset_height()?; Ok(()) } @@ -205,7 +205,7 @@ impl AddressCountsVecs { address_counts: &AddressTypeToAddressCount, ) -> Result<()> { self.all.height.truncate_push(height, total.into())?; - self.by_addresstype + self.by_address_type .truncate_push_height(height, address_counts)?; Ok(()) } @@ -215,7 +215,7 @@ impl AddressCountsVecs { starting_indexes: &Indexes, exit: &Exit, ) -> Result<()> { - let sources = self.by_addresstype.by_height(); + let sources = self.by_address_type.by_height(); self.all .height .compute_sum_of_others(starting_indexes.height, &sources, exit)?; diff --git a/crates/brk_computer/src/distribution/address/delta.rs b/crates/brk_computer/src/distribution/address/delta.rs index 25eb2f965..fd9670567 100644 --- a/crates/brk_computer/src/distribution/address/delta.rs +++ b/crates/brk_computer/src/distribution/address/delta.rs @@ -1,6 +1,6 @@ use brk_cohort::ByAddressType; use brk_traversable::Traversable; -use brk_types::{BasisPoints32, StoredI64, StoredU64, Version}; +use brk_types::{BasisPointsSigned32, StoredI64, StoredU64, Version}; use crate::{ indexes, @@ -9,13 +9,13 @@ use crate::{ use super::AddressCountsVecs; -type AddrDelta = LazyRollingDeltasFromHeight; +type AddrDelta = LazyRollingDeltasFromHeight; #[derive(Clone, Traversable)] pub struct DeltaVecs { pub all: AddrDelta, #[traversable(flatten)] - pub by_addresstype: ByAddressType, + pub by_address_type: ByAddressType, } impl DeltaVecs { @@ -35,7 +35,7 @@ impl DeltaVecs { indexes, ); - let by_addresstype = address_count.by_addresstype.map_with_name(|name, addr| { + let by_address_type = address_count.by_address_type.map_with_name(|name, addr| { LazyRollingDeltasFromHeight::new( &format!("{name}_address_count"), version, @@ -47,7 +47,7 @@ impl DeltaVecs { Self { all, - by_addresstype, + by_address_type, } } } diff --git a/crates/brk_computer/src/distribution/address/indexes/any.rs b/crates/brk_computer/src/distribution/address/indexes/any.rs index fa6eb6b64..2a0a08a22 100644 --- a/crates/brk_computer/src/distribution/address/indexes/any.rs +++ b/crates/brk_computer/src/distribution/address/indexes/any.rs @@ -32,7 +32,7 @@ macro_rules! define_any_address_indexes_vecs { pub(crate) fn forced_import(db: &Database, version: Version) -> Result { Ok(Self { $($field: BytesVec::forced_import_with( - ImportOptions::new(db, "anyaddressindex", version) + ImportOptions::new(db, "any_address_index", version) .with_saved_stamped_changes(SAVED_STAMPED_CHANGES), )?,)* }) @@ -57,11 +57,11 @@ macro_rules! define_any_address_indexes_vecs { Ok(()) } - /// Get address index for a given type and typeindex. + /// Get address index for a given type and type_index. /// Uses get_any_or_read_at to check updated layer (needed after rollback). - pub(crate) fn get(&self, address_type: OutputType, typeindex: TypeIndex, reader: &Reader) -> Result { + pub(crate) fn get(&self, address_type: OutputType, type_index: TypeIndex, reader: &Reader) -> Result { match address_type { - $(OutputType::$variant => Ok(self.$field.get_any_or_read_at(typeindex.into(), reader)?.unwrap()),)* + $(OutputType::$variant => Ok(self.$field.get_any_or_read_at(type_index.into(), reader)?.unwrap()),)* _ => unreachable!("Invalid address type: {:?}", address_type), } } @@ -74,10 +74,10 @@ macro_rules! define_any_address_indexes_vecs { impl AnyAddressIndexesVecs { /// Get address index with single read (no caching). - pub fn get_once(&self, address_type: OutputType, typeindex: TypeIndex) -> Result { + pub fn get_once(&self, address_type: OutputType, type_index: TypeIndex) -> Result { match address_type { $(OutputType::$variant => self.$field - .collect_one(<$index>::from(usize::from(typeindex))) + .collect_one(<$index>::from(usize::from(type_index))) .ok_or_else(|| Error::UnsupportedType(address_type.to_string())),)* _ => Err(Error::UnsupportedType(address_type.to_string())), } @@ -177,18 +177,18 @@ fn process_single_type_merged( let mut pushes = Vec::with_capacity(map1.len() + map2.len()); let mut update_count = 0usize; - for (typeindex, any_index) in map1.into_iter().chain(map2) { - if usize::from(typeindex) < current_len { - vec.update(I::from(usize::from(typeindex)), any_index)?; + for (type_index, any_index) in map1.into_iter().chain(map2) { + if usize::from(type_index) < current_len { + vec.update(I::from(usize::from(type_index)), any_index)?; update_count += 1; } else { - pushes.push((typeindex, any_index)); + pushes.push((type_index, any_index)); } } let push_count = pushes.len(); if !pushes.is_empty() { - pushes.sort_unstable_by_key(|(typeindex, _)| *typeindex); + pushes.sort_unstable_by_key(|(type_index, _)| *type_index); for (_, any_index) in pushes { vec.push(any_index); } diff --git a/crates/brk_computer/src/distribution/address/new_address_count.rs b/crates/brk_computer/src/distribution/address/new_address_count.rs index 4608577e3..bd89489dc 100644 --- a/crates/brk_computer/src/distribution/address/new_address_count.rs +++ b/crates/brk_computer/src/distribution/address/new_address_count.rs @@ -16,7 +16,7 @@ use super::TotalAddressCountVecs; pub struct NewAddressCountVecs { pub all: PerBlockCumulativeWithSums, #[traversable(flatten)] - pub by_addresstype: ByAddressType>, + pub by_address_type: ByAddressType>, } impl NewAddressCountVecs { @@ -34,7 +34,7 @@ impl NewAddressCountVecs { cached_starts, )?; - let by_addresstype = ByAddressType::new_with_name(|name| { + let by_address_type = ByAddressType::new_with_name(|name| { PerBlockCumulativeWithSums::forced_import( db, &format!("{name}_new_address_count"), @@ -46,7 +46,7 @@ impl NewAddressCountVecs { Ok(Self { all, - by_addresstype, + by_address_type, }) } @@ -61,9 +61,9 @@ impl NewAddressCountVecs { })?; for ((_, new), (_, total)) in self - .by_addresstype + .by_address_type .iter_mut() - .zip(total_address_count.by_addresstype.iter()) + .zip(total_address_count.by_address_type.iter()) { new.compute(max_from, exit, |height_vec| { Ok(height_vec.compute_change(max_from, &total.height, 1, exit)?) diff --git a/crates/brk_computer/src/distribution/address/total_address_count.rs b/crates/brk_computer/src/distribution/address/total_address_count.rs index cd140db5a..97c168e9e 100644 --- a/crates/brk_computer/src/distribution/address/total_address_count.rs +++ b/crates/brk_computer/src/distribution/address/total_address_count.rs @@ -13,7 +13,7 @@ use super::AddressCountsVecs; pub struct TotalAddressCountVecs { pub all: PerBlock, #[traversable(flatten)] - pub by_addresstype: ByAddressType>, + pub by_address_type: ByAddressType>, } impl TotalAddressCountVecs { @@ -24,7 +24,7 @@ impl TotalAddressCountVecs { ) -> Result { let all = PerBlock::forced_import(db, "total_address_count", version, indexes)?; - let by_addresstype: ByAddressType> = + let by_address_type: ByAddressType> = ByAddressType::new_with_name(|name| { PerBlock::forced_import( db, @@ -36,7 +36,7 @@ impl TotalAddressCountVecs { Ok(Self { all, - by_addresstype, + by_address_type, }) } @@ -55,11 +55,11 @@ impl TotalAddressCountVecs { exit, )?; - for ((_, total), ((_, addr), (_, empty))) in self.by_addresstype.iter_mut().zip( + for ((_, total), ((_, addr), (_, empty))) in self.by_address_type.iter_mut().zip( address_count - .by_addresstype + .by_address_type .iter() - .zip(empty_address_count.by_addresstype.iter()), + .zip(empty_address_count.by_address_type.iter()), ) { total .height diff --git a/crates/brk_computer/src/distribution/address/type_map/index_map.rs b/crates/brk_computer/src/distribution/address/type_map/index_map.rs index 61e3234e6..17aa1569a 100644 --- a/crates/brk_computer/src/distribution/address/type_map/index_map.rs +++ b/crates/brk_computer/src/distribution/address/type_map/index_map.rs @@ -59,14 +59,14 @@ impl AddressTypeToTypeIndexMap { Self::merge_single(&mut self.p2wsh, &mut other.p2wsh); } - /// Insert a value for a specific address type and typeindex. + /// Insert a value for a specific address type and type_index. pub(crate) fn insert_for_type( &mut self, address_type: OutputType, - typeindex: TypeIndex, + type_index: TypeIndex, value: T, ) { - self.get_mut(address_type).unwrap().insert(typeindex, value); + self.get_mut(address_type).unwrap().insert(type_index, value); } /// Consume and iterate over entries by address type. @@ -96,8 +96,8 @@ where pub(crate) fn merge_vec(mut self, other: Self) -> Self { for (address_type, other_map) in other.0.into_iter() { let self_map = self.0.get_mut_unwrap(address_type); - for (typeindex, mut other_vec) in other_map { - match self_map.entry(typeindex) { + for (type_index, mut other_vec) in other_map { + match self_map.entry(type_index) { Entry::Occupied(mut entry) => { let self_vec = entry.get_mut(); if other_vec.len() > self_vec.len() { diff --git a/crates/brk_computer/src/distribution/block/cache/address.rs b/crates/brk_computer/src/distribution/block/cache/address.rs index 3a61fa42e..9f941ab49 100644 --- a/crates/brk_computer/src/distribution/block/cache/address.rs +++ b/crates/brk_computer/src/distribution/block/cache/address.rs @@ -37,14 +37,14 @@ impl AddressCache { /// Check if address is in cache (either funded or empty). #[inline] - pub(crate) fn contains(&self, address_type: OutputType, typeindex: TypeIndex) -> bool { + pub(crate) fn contains(&self, address_type: OutputType, type_index: TypeIndex) -> bool { self.funded .get(address_type) - .is_some_and(|m| m.contains_key(&typeindex)) + .is_some_and(|m| m.contains_key(&type_index)) || self .empty .get(address_type) - .is_some_and(|m| m.contains_key(&typeindex)) + .is_some_and(|m| m.contains_key(&type_index)) } /// Merge address data into funded cache. @@ -68,9 +68,9 @@ impl AddressCache { /// Update transaction counts for addresses. pub(crate) fn update_tx_counts( &mut self, - txindex_vecs: AddressTypeToTypeIndexMap>, + tx_index_vecs: AddressTypeToTypeIndexMap>, ) { - update_tx_counts(&mut self.funded, &mut self.empty, txindex_vecs); + update_tx_counts(&mut self.funded, &mut self.empty, tx_index_vecs); } /// Take the cache contents for flushing, leaving empty caches. @@ -93,33 +93,33 @@ impl AddressCache { #[allow(clippy::too_many_arguments)] pub(crate) fn load_uncached_address_data( address_type: OutputType, - typeindex: TypeIndex, - first_addressindexes: &ByAddressType, + type_index: TypeIndex, + first_address_indexes: &ByAddressType, cache: &AddressCache, vr: &VecsReaders, any_address_indexes: &AnyAddressIndexesVecs, addresses_data: &AddressesDataVecs, ) -> Result>> { - // Check if this is a new address (typeindex >= first for this height) - let first = *first_addressindexes.get(address_type).unwrap(); - if first <= typeindex { + // Check if this is a new address (type_index >= first for this height) + let first = *first_address_indexes.get(address_type).unwrap(); + if first <= type_index { return Ok(Some(WithAddressDataSource::New( FundedAddressData::default(), ))); } // Skip if already in cache - if cache.contains(address_type, typeindex) { + if cache.contains(address_type, type_index) { return Ok(None); } // Read from storage let reader = vr.address_reader(address_type); - let anyaddressindex = any_address_indexes.get(address_type, typeindex, reader)?; + let any_address_index = any_address_indexes.get(address_type, type_index, reader)?; - Ok(Some(match anyaddressindex.to_enum() { + Ok(Some(match any_address_index.to_enum() { AnyAddressDataIndexEnum::Funded(funded_index) => { - let reader = &vr.anyaddressindex_to_anyaddressdata.funded; + let reader = &vr.any_address_index_to_any_address_data.funded; let funded_data = addresses_data .funded .get_any_or_read_at(funded_index.into(), reader)? @@ -127,7 +127,7 @@ pub(crate) fn load_uncached_address_data( WithAddressDataSource::FromFunded(funded_index, funded_data) } AnyAddressDataIndexEnum::Empty(empty_index) => { - let reader = &vr.anyaddressindex_to_anyaddressdata.empty; + let reader = &vr.any_address_index_to_any_address_data.empty; let empty_data = addresses_data .empty .get_any_or_read_at(empty_index.into(), reader)? diff --git a/crates/brk_computer/src/distribution/block/cohort/address_updates.rs b/crates/brk_computer/src/distribution/block/cohort/address_updates.rs index 02847c69e..480715a1a 100644 --- a/crates/brk_computer/src/distribution/block/cohort/address_updates.rs +++ b/crates/brk_computer/src/distribution/block/cohort/address_updates.rs @@ -26,17 +26,17 @@ pub(crate) fn process_funded_addresses( let mut pushes: Vec<(OutputType, TypeIndex, FundedAddressData)> = Vec::with_capacity(total); for (address_type, items) in funded_updates.into_iter() { - for (typeindex, source) in items { + for (type_index, source) in items { match source { WithAddressDataSource::New(data) => { - pushes.push((address_type, typeindex, data)); + pushes.push((address_type, type_index, data)); } WithAddressDataSource::FromFunded(index, data) => { updates.push((index, data)); } WithAddressDataSource::FromEmpty(empty_index, data) => { deletes.push(empty_index); - pushes.push((address_type, typeindex, data)); + pushes.push((address_type, type_index, data)); } } } @@ -57,21 +57,21 @@ pub(crate) fn process_funded_addresses( let holes_count = addresses_data.funded.holes().len(); let mut pushes_iter = pushes.into_iter(); - for (address_type, typeindex, data) in pushes_iter.by_ref().take(holes_count) { + for (address_type, type_index, data) in pushes_iter.by_ref().take(holes_count) { let index = addresses_data.funded.fill_first_hole_or_push(data)?; result .get_mut(address_type) .unwrap() - .insert(typeindex, AnyAddressIndex::from(index)); + .insert(type_index, AnyAddressIndex::from(index)); } // Pure pushes - no holes remain addresses_data.funded.reserve_pushed(pushes_iter.len()); let mut next_index = addresses_data.funded.len(); - for (address_type, typeindex, data) in pushes_iter { + for (address_type, type_index, data) in pushes_iter { addresses_data.funded.push(data); result.get_mut(address_type).unwrap().insert( - typeindex, + type_index, AnyAddressIndex::from(FundedAddressIndex::from(next_index)), ); next_index += 1; @@ -97,17 +97,17 @@ pub(crate) fn process_empty_addresses( let mut pushes: Vec<(OutputType, TypeIndex, EmptyAddressData)> = Vec::with_capacity(total); for (address_type, items) in empty_updates.into_iter() { - for (typeindex, source) in items { + for (type_index, source) in items { match source { WithAddressDataSource::New(data) => { - pushes.push((address_type, typeindex, data)); + pushes.push((address_type, type_index, data)); } WithAddressDataSource::FromEmpty(index, data) => { updates.push((index, data)); } WithAddressDataSource::FromFunded(funded_index, data) => { deletes.push(funded_index); - pushes.push((address_type, typeindex, data)); + pushes.push((address_type, type_index, data)); } } } @@ -128,21 +128,21 @@ pub(crate) fn process_empty_addresses( let holes_count = addresses_data.empty.holes().len(); let mut pushes_iter = pushes.into_iter(); - for (address_type, typeindex, data) in pushes_iter.by_ref().take(holes_count) { + for (address_type, type_index, data) in pushes_iter.by_ref().take(holes_count) { let index = addresses_data.empty.fill_first_hole_or_push(data)?; result .get_mut(address_type) .unwrap() - .insert(typeindex, AnyAddressIndex::from(index)); + .insert(type_index, AnyAddressIndex::from(index)); } // Pure pushes - no holes remain addresses_data.empty.reserve_pushed(pushes_iter.len()); let mut next_index = addresses_data.empty.len(); - for (address_type, typeindex, data) in pushes_iter { + for (address_type, type_index, data) in pushes_iter { addresses_data.empty.push(data); result.get_mut(address_type).unwrap().insert( - typeindex, + type_index, AnyAddressIndex::from(EmptyAddressIndex::from(next_index)), ); next_index += 1; diff --git a/crates/brk_computer/src/distribution/block/cohort/tx_counts.rs b/crates/brk_computer/src/distribution/block/cohort/tx_counts.rs index 0ed5f261d..313211c79 100644 --- a/crates/brk_computer/src/distribution/block/cohort/tx_counts.rs +++ b/crates/brk_computer/src/distribution/block/cohort/tx_counts.rs @@ -16,35 +16,35 @@ use super::with_source::WithAddressDataSource; pub(crate) fn update_tx_counts( funded_cache: &mut AddressTypeToTypeIndexMap>, empty_cache: &mut AddressTypeToTypeIndexMap>, - mut txindex_vecs: AddressTypeToTypeIndexMap>, + mut tx_index_vecs: AddressTypeToTypeIndexMap>, ) { - // First, deduplicate txindex_vecs for addresses that appear multiple times in a block - for (_, map) in txindex_vecs.iter_mut() { - for (_, txindex_vec) in map.iter_mut() { - if txindex_vec.len() > 1 { - txindex_vec.sort_unstable(); - txindex_vec.dedup(); + // First, deduplicate tx_index_vecs for addresses that appear multiple times in a block + for (_, map) in tx_index_vecs.iter_mut() { + for (_, tx_index_vec) in map.iter_mut() { + if tx_index_vec.len() > 1 { + tx_index_vec.sort_unstable(); + tx_index_vec.dedup(); } } } // Update tx_count on address data - for (address_type, typeindex, txindex_vec) in txindex_vecs + for (address_type, type_index, tx_index_vec) in tx_index_vecs .into_iter() .flat_map(|(t, m)| m.into_iter().map(move |(i, v)| (t, i, v))) { - let tx_count = txindex_vec.len() as u32; + let tx_count = tx_index_vec.len() as u32; if let Some(addr_data) = funded_cache .get_mut(address_type) .unwrap() - .get_mut(&typeindex) + .get_mut(&type_index) { addr_data.tx_count += tx_count; } else if let Some(addr_data) = empty_cache .get_mut(address_type) .unwrap() - .get_mut(&typeindex) + .get_mut(&type_index) { addr_data.tx_count += tx_count; } diff --git a/crates/brk_computer/src/distribution/block/utxo/inputs.rs b/crates/brk_computer/src/distribution/block/utxo/inputs.rs index a236f70ad..a61ebe72b 100644 --- a/crates/brk_computer/src/distribution/block/utxo/inputs.rs +++ b/crates/brk_computer/src/distribution/block/utxo/inputs.rs @@ -22,20 +22,20 @@ use super::super::{ pub struct InputsResult { /// Map from UTXO creation height -> aggregated sent supply. pub height_to_sent: FxHashMap, - /// Per-height, per-address-type sent data: (typeindex, value) for each address. + /// Per-height, per-address-type sent data: (type_index, value) for each address. pub sent_data: HeightToAddressTypeToVec<(TypeIndex, Sats)>, - /// Address data looked up during processing, keyed by (address_type, typeindex). + /// Address data looked up during processing, keyed by (address_type, type_index). pub address_data: AddressTypeToTypeIndexMap>, /// Transaction indexes per address for tx_count tracking. - pub txindex_vecs: AddressTypeToTypeIndexMap>, + pub tx_index_vecs: AddressTypeToTypeIndexMap>, } /// Process inputs (spent UTXOs) for a block. /// /// For each input: /// 1. Use pre-collected outpoint (from reusable iterator, avoids PcoVec re-decompression) -/// 2. Resolve outpoint to txoutindex -/// 3. Get the creation height from txoutindex_to_height map +/// 2. Resolve outpoint to txout_index +/// 3. Get the creation height from txout_index_to_height map /// 4. Read value and type from the referenced output (random access via mmap) /// 5. Look up address data if input references an address type /// 6. Accumulate into height_to_sent map @@ -46,35 +46,35 @@ pub struct InputsResult { #[allow(clippy::too_many_arguments)] pub(crate) fn process_inputs( input_count: usize, - txinindex_to_txindex: &[TxIndex], - txinindex_to_value: &[Sats], - txinindex_to_outputtype: &[OutputType], - txinindex_to_typeindex: &[TypeIndex], - txinindex_to_prev_height: &[Height], - first_addressindexes: &ByAddressType, + txin_index_to_tx_index: &[TxIndex], + txin_index_to_value: &[Sats], + txin_index_to_output_type: &[OutputType], + txin_index_to_type_index: &[TypeIndex], + txin_index_to_prev_height: &[Height], + first_address_indexes: &ByAddressType, cache: &AddressCache, vr: &VecsReaders, any_address_indexes: &AnyAddressIndexesVecs, addresses_data: &AddressesDataVecs, ) -> Result { let map_fn = |local_idx: usize| -> Result<_> { - let txindex = txinindex_to_txindex[local_idx]; + let tx_index = txin_index_to_tx_index[local_idx]; - let prev_height = txinindex_to_prev_height[local_idx]; - let value = txinindex_to_value[local_idx]; - let input_type = txinindex_to_outputtype[local_idx]; + let prev_height = txin_index_to_prev_height[local_idx]; + let value = txin_index_to_value[local_idx]; + let input_type = txin_index_to_output_type[local_idx]; if input_type.is_not_address() { return Ok((prev_height, value, input_type, None)); } - let typeindex = txinindex_to_typeindex[local_idx]; + let type_index = txin_index_to_type_index[local_idx]; // Look up address data let addr_data_opt = load_uncached_address_data( input_type, - typeindex, - first_addressindexes, + type_index, + first_address_indexes, cache, vr, any_address_indexes, @@ -85,7 +85,7 @@ pub(crate) fn process_inputs( prev_height, value, input_type, - Some((typeindex, txindex, value, addr_data_opt)), + Some((type_index, tx_index, value, addr_data_opt)), )) }; @@ -113,7 +113,7 @@ pub(crate) fn process_inputs( AddressTypeToTypeIndexMap::>::with_capacity( estimated_per_type, ); - let mut txindex_vecs = + let mut tx_index_vecs = AddressTypeToTypeIndexMap::>::with_capacity(estimated_per_type); for (prev_height, value, output_type, addr_info) in items { @@ -122,24 +122,24 @@ pub(crate) fn process_inputs( .or_default() .iterate(value, output_type); - if let Some((typeindex, txindex, value, addr_data_opt)) = addr_info { + if let Some((type_index, tx_index, value, addr_data_opt)) = addr_info { sent_data .entry(prev_height) .or_default() .get_mut(output_type) .unwrap() - .push((typeindex, value)); + .push((type_index, value)); if let Some(addr_data) = addr_data_opt { - address_data.insert_for_type(output_type, typeindex, addr_data); + address_data.insert_for_type(output_type, type_index, addr_data); } - txindex_vecs + tx_index_vecs .get_mut(output_type) .unwrap() - .entry(typeindex) + .entry(type_index) .or_default() - .push(txindex); + .push(tx_index); } } @@ -147,6 +147,6 @@ pub(crate) fn process_inputs( height_to_sent, sent_data, address_data, - txindex_vecs, + tx_index_vecs, }) } diff --git a/crates/brk_computer/src/distribution/block/utxo/outputs.rs b/crates/brk_computer/src/distribution/block/utxo/outputs.rs index e8b83c239..d8221a6be 100644 --- a/crates/brk_computer/src/distribution/block/utxo/outputs.rs +++ b/crates/brk_computer/src/distribution/block/utxo/outputs.rs @@ -21,50 +21,50 @@ use super::super::{ pub struct OutputsResult { /// Aggregated supply transacted in this block. pub transacted: Transacted, - /// Per-address-type received data: (typeindex, value) for each address. + /// Per-address-type received data: (type_index, value) for each address. pub received_data: AddressTypeToVec<(TypeIndex, Sats)>, - /// Address data looked up during processing, keyed by (address_type, typeindex). + /// Address data looked up during processing, keyed by (address_type, type_index). pub address_data: AddressTypeToTypeIndexMap>, /// Transaction indexes per address for tx_count tracking. - pub txindex_vecs: AddressTypeToTypeIndexMap>, + pub tx_index_vecs: AddressTypeToTypeIndexMap>, } /// Process outputs (new UTXOs) for a block. /// /// For each output: -/// 1. Read pre-collected value, output type, and typeindex +/// 1. Read pre-collected value, output type, and type_index /// 2. Accumulate into Transacted by type and amount /// 3. Look up address data if output is an address type /// 4. Track address-specific data for address cohort processing #[allow(clippy::too_many_arguments)] pub(crate) fn process_outputs( - txoutindex_to_txindex: &[TxIndex], - txoutdata_vec: &[TxOutData], - first_addressindexes: &ByAddressType, + txout_index_to_tx_index: &[TxIndex], + txout_data_vec: &[TxOutData], + first_address_indexes: &ByAddressType, cache: &AddressCache, vr: &VecsReaders, any_address_indexes: &AnyAddressIndexesVecs, addresses_data: &AddressesDataVecs, ) -> Result { - let output_count = txoutdata_vec.len(); + let output_count = txout_data_vec.len(); // Phase 1: Address lookups (mmap reads) — parallel for large blocks, sequential for small let map_fn = |local_idx: usize| -> Result<_> { - let txoutdata = &txoutdata_vec[local_idx]; - let value = txoutdata.value; - let output_type = txoutdata.outputtype; + let txout_data = &txout_data_vec[local_idx]; + let value = txout_data.value; + let output_type = txout_data.output_type; if output_type.is_not_address() { return Ok((value, output_type, None)); } - let typeindex = txoutdata.typeindex; - let txindex = txoutindex_to_txindex[local_idx]; + let type_index = txout_data.type_index; + let tx_index = txout_index_to_tx_index[local_idx]; let addr_data_opt = load_uncached_address_data( output_type, - typeindex, - first_addressindexes, + type_index, + first_address_indexes, cache, vr, any_address_indexes, @@ -74,7 +74,7 @@ pub(crate) fn process_outputs( Ok(( value, output_type, - Some((typeindex, txindex, value, addr_data_opt)), + Some((type_index, tx_index, value, addr_data_opt)), )) }; @@ -97,28 +97,28 @@ pub(crate) fn process_outputs( AddressTypeToTypeIndexMap::>::with_capacity( estimated_per_type, ); - let mut txindex_vecs = + let mut tx_index_vecs = AddressTypeToTypeIndexMap::>::with_capacity(estimated_per_type); for (value, output_type, addr_info) in items { transacted.iterate(value, output_type); - if let Some((typeindex, txindex, value, addr_data_opt)) = addr_info { + if let Some((type_index, tx_index, value, addr_data_opt)) = addr_info { received_data .get_mut(output_type) .unwrap() - .push((typeindex, value)); + .push((type_index, value)); if let Some(addr_data) = addr_data_opt { - address_data.insert_for_type(output_type, typeindex, addr_data); + address_data.insert_for_type(output_type, type_index, addr_data); } - txindex_vecs + tx_index_vecs .get_mut(output_type) .unwrap() - .entry(typeindex) + .entry(type_index) .or_default() - .push(txindex); + .push(tx_index); } } @@ -126,6 +126,6 @@ pub(crate) fn process_outputs( transacted, received_data, address_data, - txindex_vecs, + tx_index_vecs, }) } diff --git a/crates/brk_computer/src/distribution/compute/block_loop.rs b/crates/brk_computer/src/distribution/compute/block_loop.rs index 89911fec2..db2def5a6 100644 --- a/crates/brk_computer/src/distribution/compute/block_loop.rs +++ b/crates/brk_computer/src/distribution/compute/block_loop.rs @@ -45,7 +45,7 @@ pub(crate) fn process_blocks( starting_height: Height, last_height: Height, chain_state: &mut Vec, - txindex_to_height: &mut RangeMap, + tx_index_to_height: &mut RangeMap, cached_prices: &[Cents], cached_timestamps: &[Timestamp], cached_price_range_max: &PriceRangeMax, @@ -63,14 +63,14 @@ pub(crate) fn process_blocks( return Ok(()); } - let height_to_first_txindex = &indexer.vecs.transactions.first_txindex; - let height_to_first_txoutindex = &indexer.vecs.outputs.first_txoutindex; - let height_to_first_txinindex = &indexer.vecs.inputs.first_txinindex; + let height_to_first_tx_index = &indexer.vecs.transactions.first_tx_index; + let height_to_first_txout_index = &indexer.vecs.outputs.first_txout_index; + let height_to_first_txin_index = &indexer.vecs.inputs.first_txin_index; let height_to_tx_count = &transactions.count.total.base.height; let height_to_output_count = &outputs.count.total.full.sum; let height_to_input_count = &inputs.count.full.sum; - let txindex_to_output_count = &indexes.txindex.output_count; - let txindex_to_input_count = &indexes.txindex.input_count; + let tx_index_to_output_count = &indexes.tx_index.output_count; + let tx_index_to_input_count = &indexes.tx_index.input_count; let height_to_price_vec = cached_prices; let height_to_timestamp_vec = cached_timestamps; @@ -78,12 +78,12 @@ pub(crate) fn process_blocks( let start_usize = starting_height.to_usize(); let end_usize = last_height.to_usize() + 1; - let height_to_first_txindex_vec: Vec = - height_to_first_txindex.collect_range_at(start_usize, end_usize); - let height_to_first_txoutindex_vec: Vec<_> = - height_to_first_txoutindex.collect_range_at(start_usize, end_usize); - let height_to_first_txinindex_vec: Vec<_> = - height_to_first_txinindex.collect_range_at(start_usize, end_usize); + let height_to_first_tx_index_vec: Vec = + height_to_first_tx_index.collect_range_at(start_usize, end_usize); + let height_to_first_txout_index_vec: Vec<_> = + height_to_first_txout_index.collect_range_at(start_usize, end_usize); + let height_to_first_txin_index_vec: Vec<_> = + height_to_first_txin_index.collect_range_at(start_usize, end_usize); let height_to_tx_count_vec: Vec<_> = height_to_tx_count.collect_range_at(start_usize, end_usize); let height_to_output_count_vec: Vec<_> = @@ -106,39 +106,39 @@ pub(crate) fn process_blocks( let mut vr = VecsReaders::new(&vecs.any_address_indexes, &vecs.addresses_data); debug!("VecsReaders created"); - // Extend txindex_to_height RangeMap with new entries (incremental, O(new_blocks)) - let target_len = indexer.vecs.transactions.first_txindex.len(); - let current_len = txindex_to_height.len(); + // Extend tx_index_to_height RangeMap with new entries (incremental, O(new_blocks)) + let target_len = indexer.vecs.transactions.first_tx_index.len(); + let current_len = tx_index_to_height.len(); if current_len < target_len { debug!( - "extending txindex_to_height RangeMap from {} to {}", + "extending tx_index_to_height RangeMap from {} to {}", current_len, target_len ); let new_entries: Vec = indexer .vecs .transactions - .first_txindex + .first_tx_index .collect_range_at(current_len, target_len); - for first_txindex in new_entries { - txindex_to_height.push(first_txindex); + for first_tx_index in new_entries { + tx_index_to_height.push(first_tx_index); } } else if current_len > target_len { debug!( - "truncating txindex_to_height RangeMap from {} to {}", + "truncating tx_index_to_height RangeMap from {} to {}", current_len, target_len ); - txindex_to_height.truncate(target_len); + tx_index_to_height.truncate(target_len); } debug!( - "txindex_to_height RangeMap ready ({} entries)", - txindex_to_height.len() + "tx_index_to_height RangeMap ready ({} entries)", + tx_index_to_height.len() ); // Create reusable iterators and buffers for per-block reads let mut txout_iters = TxOutReaders::new(indexer); - let mut txin_iters = TxInReaders::new(indexer, inputs, txindex_to_height); - let mut txout_to_txindex_buf = IndexToTxIndexBuf::new(); - let mut txin_to_txindex_buf = IndexToTxIndexBuf::new(); + let mut txin_iters = TxInReaders::new(indexer, inputs, tx_index_to_height); + let mut txout_to_tx_index_buf = IndexToTxIndexBuf::new(); + let mut txin_to_tx_index_buf = IndexToTxIndexBuf::new(); // Pre-collect first address indexes per type for the block range let first_p2a_vec = indexer @@ -186,9 +186,9 @@ pub(crate) fn process_blocks( debug!("recovering address_counts from height {}", starting_height); let (mut address_counts, mut empty_address_counts) = if starting_height > Height::ZERO { let address_counts = - AddressTypeToAddressCount::from((&vecs.addresses.funded.by_addresstype, starting_height)); + AddressTypeToAddressCount::from((&vecs.addresses.funded.by_address_type, starting_height)); let empty_address_counts = AddressTypeToAddressCount::from(( - &vecs.addresses.empty.by_addresstype, + &vecs.addresses.empty.by_address_type, starting_height, )); (address_counts, empty_address_counts) @@ -225,11 +225,11 @@ pub(crate) fn process_blocks( // Get block metadata from pre-collected vecs let offset = height.to_usize() - start_usize; - let first_txindex = height_to_first_txindex_vec[offset]; + let first_tx_index = height_to_first_tx_index_vec[offset]; let tx_count = u64::from(height_to_tx_count_vec[offset]); - let first_txoutindex = height_to_first_txoutindex_vec[offset].to_usize(); + let first_txout_index = height_to_first_txout_index_vec[offset].to_usize(); let output_count = u64::from(height_to_output_count_vec[offset]) as usize; - let first_txinindex = height_to_first_txinindex_vec[offset].to_usize(); + let first_txin_index = height_to_first_txin_index_vec[offset].to_usize(); let input_count = u64::from(height_to_input_count_vec[offset]) as usize; let timestamp = height_to_timestamp_collected[offset]; let block_price = height_to_price_collected[offset]; @@ -239,7 +239,7 @@ pub(crate) fn process_blocks( debug_assert_eq!(ctx.price_at(height), block_price); // Get first address indexes for this height from pre-collected vecs - let first_addressindexes = ByAddressType { + let first_address_indexes = ByAddressType { p2a: TypeIndex::from(first_p2a_vec[offset].to_usize()), p2pk33: TypeIndex::from(first_p2pk33_vec[offset].to_usize()), p2pk65: TypeIndex::from(first_p2pk65_vec[offset].to_usize()), @@ -254,7 +254,7 @@ pub(crate) fn process_blocks( activity_counts.reset(); // Process outputs, inputs, and tick-tock in parallel via rayon::join. - // Collection (build txindex mappings + bulk mmap reads) is merged into the + // Collection (build tx_index mappings + bulk mmap reads) is merged into the // processing closures so outputs and inputs collection overlap each other // and tick-tock, instead of running sequentially before the join. let (matured, oi_result) = rayon::join( @@ -262,14 +262,14 @@ pub(crate) fn process_blocks( || -> Result<_> { let (outputs_result, inputs_result) = rayon::join( || { - let txoutindex_to_txindex = txout_to_txindex_buf - .build(first_txindex, tx_count, txindex_to_output_count); - let txoutdata_vec = - txout_iters.collect_block_outputs(first_txoutindex, output_count); + let txout_index_to_tx_index = txout_to_tx_index_buf + .build(first_tx_index, tx_count, tx_index_to_output_count); + let txout_data_vec = + txout_iters.collect_block_outputs(first_txout_index, output_count); process_outputs( - txoutindex_to_txindex, - txoutdata_vec, - &first_addressindexes, + txout_index_to_tx_index, + txout_data_vec, + &first_address_indexes, &cache, &vr, &vecs.any_address_indexes, @@ -278,22 +278,22 @@ pub(crate) fn process_blocks( }, || -> Result<_> { if input_count > 1 { - let txinindex_to_txindex = txin_to_txindex_buf - .build(first_txindex, tx_count, txindex_to_input_count); - let (input_values, input_prev_heights, input_outputtypes, input_typeindexes) = + let txin_index_to_tx_index = txin_to_tx_index_buf + .build(first_tx_index, tx_count, tx_index_to_input_count); + let (input_values, input_prev_heights, input_output_types, input_type_indexes) = txin_iters.collect_block_inputs( - first_txinindex + 1, + first_txin_index + 1, input_count - 1, height, ); process_inputs( input_count - 1, - &txinindex_to_txindex[1..], + &txin_index_to_tx_index[1..], input_values, - input_outputtypes, - input_typeindexes, + input_output_types, + input_type_indexes, input_prev_heights, - &first_addressindexes, + &first_address_indexes, &cache, &vr, &vecs.any_address_indexes, @@ -304,7 +304,7 @@ pub(crate) fn process_blocks( height_to_sent: Default::default(), sent_data: Default::default(), address_data: Default::default(), - txindex_vecs: Default::default(), + tx_index_vecs: Default::default(), }) } }, @@ -318,11 +318,11 @@ pub(crate) fn process_blocks( cache.merge_funded(outputs_result.address_data); cache.merge_funded(inputs_result.address_data); - // Combine txindex_vecs from outputs and inputs, then update tx_count - let combined_txindex_vecs = outputs_result - .txindex_vecs - .merge_vec(inputs_result.txindex_vecs); - cache.update_tx_counts(combined_txindex_vecs); + // Combine tx_index_vecs from outputs and inputs, then update tx_count + let combined_tx_index_vecs = outputs_result + .tx_index_vecs + .merge_vec(inputs_result.tx_index_vecs); + cache.update_tx_counts(combined_tx_index_vecs); let mut transacted = outputs_result.transacted; let mut height_to_sent = inputs_result.height_to_sent; diff --git a/crates/brk_computer/src/distribution/compute/readers.rs b/crates/brk_computer/src/distribution/compute/readers.rs index c0c48db85..3a75bd2fc 100644 --- a/crates/brk_computer/src/distribution/compute/readers.rs +++ b/crates/brk_computer/src/distribution/compute/readers.rs @@ -15,17 +15,17 @@ use crate::{ #[derive(Debug, Clone, Copy)] pub struct TxOutData { pub value: Sats, - pub outputtype: OutputType, - pub typeindex: TypeIndex, + pub output_type: OutputType, + pub type_index: TypeIndex, } /// Readers for txout vectors. Reuses internal buffers across blocks. pub struct TxOutReaders<'a> { indexer: &'a Indexer, values_buf: Vec, - outputtypes_buf: Vec, - typeindexes_buf: Vec, - txoutdata_buf: Vec, + output_types_buf: Vec, + type_indexes_buf: Vec, + txout_data_buf: Vec, } impl<'a> TxOutReaders<'a> { @@ -33,48 +33,48 @@ impl<'a> TxOutReaders<'a> { Self { indexer, values_buf: Vec::new(), - outputtypes_buf: Vec::new(), - typeindexes_buf: Vec::new(), - txoutdata_buf: Vec::new(), + output_types_buf: Vec::new(), + type_indexes_buf: Vec::new(), + txout_data_buf: Vec::new(), } } /// Collect output data for a block range using bulk reads with buffer reuse. pub(crate) fn collect_block_outputs( &mut self, - first_txoutindex: usize, + first_txout_index: usize, output_count: usize, ) -> &[TxOutData] { - let end = first_txoutindex + output_count; + let end = first_txout_index + output_count; self.indexer.vecs.outputs.value.collect_range_into_at( - first_txoutindex, + first_txout_index, end, &mut self.values_buf, ); - self.indexer.vecs.outputs.outputtype.collect_range_into_at( - first_txoutindex, + self.indexer.vecs.outputs.output_type.collect_range_into_at( + first_txout_index, end, - &mut self.outputtypes_buf, + &mut self.output_types_buf, ); - self.indexer.vecs.outputs.typeindex.collect_range_into_at( - first_txoutindex, + self.indexer.vecs.outputs.type_index.collect_range_into_at( + first_txout_index, end, - &mut self.typeindexes_buf, + &mut self.type_indexes_buf, ); - self.txoutdata_buf.clear(); - self.txoutdata_buf.extend( + self.txout_data_buf.clear(); + self.txout_data_buf.extend( self.values_buf .iter() - .zip(&self.outputtypes_buf) - .zip(&self.typeindexes_buf) - .map(|((&value, &outputtype), &typeindex)| TxOutData { + .zip(&self.output_types_buf) + .zip(&self.type_indexes_buf) + .map(|((&value, &output_type), &type_index)| TxOutData { value, - outputtype, - typeindex, + output_type, + type_index, }), ); - &self.txoutdata_buf + &self.txout_data_buf } } @@ -82,59 +82,59 @@ impl<'a> TxOutReaders<'a> { pub struct TxInReaders<'a> { indexer: &'a Indexer, txins: &'a inputs::Vecs, - txindex_to_height: &'a mut RangeMap, + tx_index_to_height: &'a mut RangeMap, outpoints_buf: Vec, values_buf: Vec, prev_heights_buf: Vec, - outputtypes_buf: Vec, - typeindexes_buf: Vec, + output_types_buf: Vec, + type_indexes_buf: Vec, } impl<'a> TxInReaders<'a> { pub(crate) fn new( indexer: &'a Indexer, txins: &'a inputs::Vecs, - txindex_to_height: &'a mut RangeMap, + tx_index_to_height: &'a mut RangeMap, ) -> Self { Self { indexer, txins, - txindex_to_height, + tx_index_to_height, outpoints_buf: Vec::new(), values_buf: Vec::new(), prev_heights_buf: Vec::new(), - outputtypes_buf: Vec::new(), - typeindexes_buf: Vec::new(), + output_types_buf: Vec::new(), + type_indexes_buf: Vec::new(), } } /// Collect input data for a block range using bulk reads with buffer reuse. pub(crate) fn collect_block_inputs( &mut self, - first_txinindex: usize, + first_txin_index: usize, input_count: usize, current_height: Height, ) -> (&[Sats], &[Height], &[OutputType], &[TypeIndex]) { - let end = first_txinindex + input_count; + let end = first_txin_index + input_count; self.txins.spent.value.collect_range_into_at( - first_txinindex, + first_txin_index, end, &mut self.values_buf, ); self.indexer.vecs.inputs.outpoint.collect_range_into_at( - first_txinindex, + first_txin_index, end, &mut self.outpoints_buf, ); - self.indexer.vecs.inputs.outputtype.collect_range_into_at( - first_txinindex, + self.indexer.vecs.inputs.output_type.collect_range_into_at( + first_txin_index, end, - &mut self.outputtypes_buf, + &mut self.output_types_buf, ); - self.indexer.vecs.inputs.typeindex.collect_range_into_at( - first_txinindex, + self.indexer.vecs.inputs.type_index.collect_range_into_at( + first_txin_index, end, - &mut self.typeindexes_buf, + &mut self.type_indexes_buf, ); self.prev_heights_buf.clear(); @@ -143,8 +143,8 @@ impl<'a> TxInReaders<'a> { if outpoint.is_coinbase() { current_height } else { - self.txindex_to_height - .get(outpoint.txindex()) + self.tx_index_to_height + .get(outpoint.tx_index()) .unwrap_or(current_height) } }), @@ -153,16 +153,16 @@ impl<'a> TxInReaders<'a> { ( &self.values_buf, &self.prev_heights_buf, - &self.outputtypes_buf, - &self.typeindexes_buf, + &self.output_types_buf, + &self.type_indexes_buf, ) } } /// Cached readers for stateful vectors. pub struct VecsReaders { - pub addresstypeindex_to_anyaddressindex: ByAddressType, - pub anyaddressindex_to_anyaddressdata: ByAnyAddress, + pub address_type_index_to_any_address_index: ByAddressType, + pub any_address_index_to_any_address_data: ByAnyAddress, } impl VecsReaders { @@ -171,7 +171,7 @@ impl VecsReaders { addresses_data: &AddressesDataVecs, ) -> Self { Self { - addresstypeindex_to_anyaddressindex: ByAddressType { + address_type_index_to_any_address_index: ByAddressType { p2a: any_address_indexes.p2a.create_reader(), p2pk33: any_address_indexes.p2pk33.create_reader(), p2pk65: any_address_indexes.p2pk65.create_reader(), @@ -181,7 +181,7 @@ impl VecsReaders { p2wpkh: any_address_indexes.p2wpkh.create_reader(), p2wsh: any_address_indexes.p2wsh.create_reader(), }, - anyaddressindex_to_anyaddressdata: ByAnyAddress { + any_address_index_to_any_address_data: ByAnyAddress { funded: addresses_data.funded.create_reader(), empty: addresses_data.empty.create_reader(), }, @@ -190,13 +190,13 @@ impl VecsReaders { /// Get reader for specific address type. pub(crate) fn address_reader(&self, address_type: OutputType) -> &Reader { - self.addresstypeindex_to_anyaddressindex + self.address_type_index_to_any_address_index .get(address_type) .unwrap() } } -/// Reusable buffers for per-block txindex mapping construction. +/// Reusable buffers for per-block tx_index mapping construction. pub(crate) struct IndexToTxIndexBuf { counts: Vec, result: Vec, @@ -210,15 +210,15 @@ impl IndexToTxIndexBuf { } } - /// Build index -> txindex mapping for a block, reusing internal buffers. + /// Build index -> tx_index mapping for a block, reusing internal buffers. pub(crate) fn build( &mut self, - block_first_txindex: TxIndex, + block_first_tx_index: TxIndex, block_tx_count: u64, - txindex_to_count: &impl ReadableVec, + tx_index_to_count: &impl ReadableVec, ) -> &[TxIndex] { - let first = block_first_txindex.to_usize(); - txindex_to_count.collect_range_into_at( + let first = block_first_tx_index.to_usize(); + tx_index_to_count.collect_range_into_at( first, first + block_tx_count as usize, &mut self.counts, @@ -229,9 +229,9 @@ impl IndexToTxIndexBuf { self.result.reserve(total as usize); for (offset, count) in self.counts.iter().enumerate() { - let txindex = TxIndex::from(first + offset); + let tx_index = TxIndex::from(first + offset); self.result - .extend(std::iter::repeat_n(txindex, u64::from(*count) as usize)); + .extend(std::iter::repeat_n(tx_index, u64::from(*count) as usize)); } &self.result diff --git a/crates/brk_computer/src/distribution/state/cohort/address.rs b/crates/brk_computer/src/distribution/state/cohort/address.rs index 2df90b2e9..28c7728c2 100644 --- a/crates/brk_computer/src/distribution/state/cohort/address.rs +++ b/crates/brk_computer/src/distribution/state/cohort/address.rs @@ -34,16 +34,16 @@ impl AddressCohortState { pub(crate) fn send( &mut self, - addressdata: &mut FundedAddressData, + address_data: &mut FundedAddressData, value: Sats, current_price: Cents, prev_price: Cents, ath: Cents, age: Age, ) -> Result<()> { - let prev = addressdata.cost_basis_snapshot(); - addressdata.send(value, prev_price)?; - let current = addressdata.cost_basis_snapshot(); + let prev = address_data.cost_basis_snapshot(); + address_data.send(value, prev_price)?; + let current = address_data.cost_basis_snapshot(); self.inner.send_address( &SupplyState { @@ -83,14 +83,14 @@ impl AddressCohortState { ); } - pub(crate) fn add(&mut self, addressdata: &FundedAddressData) { + pub(crate) fn add(&mut self, address_data: &FundedAddressData) { self.address_count += 1; self.inner - .increment_snapshot(&addressdata.cost_basis_snapshot()); + .increment_snapshot(&address_data.cost_basis_snapshot()); } - pub(crate) fn subtract(&mut self, addressdata: &FundedAddressData) { - let snapshot = addressdata.cost_basis_snapshot(); + pub(crate) fn subtract(&mut self, address_data: &FundedAddressData) { + let snapshot = address_data.cost_basis_snapshot(); // Check for potential underflow before it happens if unlikely(self.inner.supply.utxo_count < snapshot.supply_state.utxo_count) { @@ -103,7 +103,7 @@ impl AddressCohortState { This means the address is not properly tracked in this cohort.", self.address_count, self.inner.supply, - addressdata, + address_data, snapshot.supply_state, snapshot.realized_price ); @@ -118,7 +118,7 @@ impl AddressCohortState { This means the address is not properly tracked in this cohort.", self.address_count, self.inner.supply, - addressdata, + address_data, snapshot.supply_state, snapshot.realized_price ); @@ -129,7 +129,7 @@ impl AddressCohortState { "AddressCohortState::subtract address_count underflow! address_count=0\n\ Address being subtracted: {}\n\ Realized price: {}", - addressdata, snapshot.realized_price + address_data, snapshot.realized_price ) }); diff --git a/crates/brk_computer/src/distribution/vecs.rs b/crates/brk_computer/src/distribution/vecs.rs index 40c465471..2e931a345 100644 --- a/crates/brk_computer/src/distribution/vecs.rs +++ b/crates/brk_computer/src/distribution/vecs.rs @@ -23,7 +23,7 @@ use crate::{ state::BlockState, }, indexes, inputs, - internal::{CachedWindowStarts, PerBlockCumulative, db_utils::{finalize_db, open_db}}, + internal::{CachedWindowStarts, PerBlockCumulativeWithSums, db_utils::{finalize_db, open_db}}, outputs, prices, transactions, }; @@ -70,16 +70,16 @@ pub struct Vecs { #[traversable(wrap = "cohorts", rename = "address")] pub address_cohorts: AddressCohorts, #[traversable(wrap = "cointime")] - pub coinblocks_destroyed: PerBlockCumulative, + pub coinblocks_destroyed: PerBlockCumulativeWithSums, pub addresses: AddressMetricsVecs, /// In-memory block state for UTXO processing. Persisted via supply_state. /// Kept across compute() calls to avoid O(n) rebuild on resume. #[traversable(skip)] chain_state: Vec, - /// In-memory txindex→height reverse lookup. Kept across compute() calls. + /// In-memory tx_index→height reverse lookup. Kept across compute() calls. #[traversable(skip)] - txindex_to_height: RangeMap, + tx_index_to_height: RangeMap, /// Cached height→price mapping. Incrementally extended, O(new_blocks) on resume. #[traversable(skip)] @@ -114,12 +114,12 @@ impl Vecs { let address_cohorts = AddressCohorts::forced_import(&db, version, indexes, &states_path, cached_starts)?; // Create address data BytesVecs first so we can also use them for identity mappings - let fundedaddressindex_to_fundedaddressdata = BytesVec::forced_import_with( - vecdb::ImportOptions::new(&db, "fundedaddressdata", version) + let funded_address_index_to_funded_address_data = BytesVec::forced_import_with( + vecdb::ImportOptions::new(&db, "funded_address_data", version) .with_saved_stamped_changes(SAVED_STAMPED_CHANGES), )?; - let emptyaddressindex_to_emptyaddressdata = BytesVec::forced_import_with( - vecdb::ImportOptions::new(&db, "emptyaddressdata", version) + let empty_address_index_to_empty_address_data = BytesVec::forced_import_with( + vecdb::ImportOptions::new(&db, "empty_address_data", version) .with_saved_stamped_changes(SAVED_STAMPED_CHANGES), )?; @@ -127,13 +127,13 @@ impl Vecs { let funded_address_index = LazyVecFrom1::init( "funded_address_index", version, - fundedaddressindex_to_fundedaddressdata.read_only_boxed_clone(), + funded_address_index_to_funded_address_data.read_only_boxed_clone(), |index, _| index, ); let empty_address_index = LazyVecFrom1::init( "empty_address_index", version, - emptyaddressindex_to_emptyaddressdata.read_only_boxed_clone(), + empty_address_index_to_empty_address_data.read_only_boxed_clone(), |index, _| index, ); @@ -173,20 +173,21 @@ impl Vecs { utxo_cohorts, address_cohorts, - coinblocks_destroyed: PerBlockCumulative::forced_import( + coinblocks_destroyed: PerBlockCumulativeWithSums::forced_import( &db, "coinblocks_destroyed", version + Version::TWO, indexes, + cached_starts, )?, any_address_indexes: AnyAddressIndexesVecs::forced_import(&db, version)?, addresses_data: AddressesDataVecs { - funded: fundedaddressindex_to_fundedaddressdata, - empty: emptyaddressindex_to_emptyaddressdata, + funded: funded_address_index_to_funded_address_data, + empty: empty_address_index_to_empty_address_data, }, chain_state: Vec::new(), - txindex_to_height: RangeMap::default(), + tx_index_to_height: RangeMap::default(), cached_prices: Vec::new(), cached_timestamps: Vec::new(), @@ -294,9 +295,9 @@ impl Vecs { debug!("recovered_height={}", recovered_height); - // Take chain_state and txindex_to_height out of self to avoid borrow conflicts + // Take chain_state and tx_index_to_height out of self to avoid borrow conflicts let mut chain_state = std::mem::take(&mut self.chain_state); - let mut txindex_to_height = std::mem::take(&mut self.txindex_to_height); + let mut tx_index_to_height = std::mem::take(&mut self.tx_index_to_height); // Recover or reuse chain_state let starting_height = if recovered_height.is_zero() { @@ -312,7 +313,7 @@ impl Vecs { )?; chain_state.clear(); - txindex_to_height.truncate(0); + tx_index_to_height.truncate(0); info!("State recovery: fresh start"); Height::ZERO @@ -341,7 +342,7 @@ impl Vecs { debug!("chain_state rebuilt"); // Truncate RangeMap to match (entries are immutable, safe to keep) - txindex_to_height.truncate(end); + tx_index_to_height.truncate(end); recovered_height }; @@ -384,7 +385,7 @@ impl Vecs { starting_height, last_height, &mut chain_state, - &mut txindex_to_height, + &mut tx_index_to_height, &cached_prices, &cached_timestamps, &cached_price_range_max, @@ -396,9 +397,9 @@ impl Vecs { self.cached_price_range_max = cached_price_range_max; } - // Put chain_state and txindex_to_height back + // Put chain_state and tx_index_to_height back self.chain_state = chain_state; - self.txindex_to_height = txindex_to_height; + self.tx_index_to_height = tx_index_to_height; // 5. Compute aggregates (overlapping cohorts from separate cohorts) info!("Computing overlapping cohorts..."); @@ -426,7 +427,7 @@ impl Vecs { r2?; } - // 6b. Compute address count sum (by addresstype → all) + // 6b. Compute address count sum (by address_type → all) self.addresses.funded.compute_rest(starting_indexes, exit)?; self.addresses.empty.compute_rest(starting_indexes, exit)?; diff --git a/crates/brk_computer/src/indexes/address.rs b/crates/brk_computer/src/indexes/address.rs index 280d36b93..5c620543c 100644 --- a/crates/brk_computer/src/indexes/address.rs +++ b/crates/brk_computer/src/indexes/address.rs @@ -92,7 +92,7 @@ impl Vecs { Self { p2pk33: P2PK33Vecs { identity: LazyVecFrom1::init( - "p2pk33addressindex", + "p2pk33_address_index", version, indexer.vecs.addresses.p2pk33.bytes.read_only_boxed_clone(), |index, _| index, @@ -100,7 +100,7 @@ impl Vecs { }, p2pk65: P2PK65Vecs { identity: LazyVecFrom1::init( - "p2pk65addressindex", + "p2pk65_address_index", version, indexer.vecs.addresses.p2pk65.bytes.read_only_boxed_clone(), |index, _| index, @@ -108,7 +108,7 @@ impl Vecs { }, p2pkh: P2PKHVecs { identity: LazyVecFrom1::init( - "p2pkhaddressindex", + "p2pkh_address_index", version, indexer.vecs.addresses.p2pkh.bytes.read_only_boxed_clone(), |index, _| index, @@ -116,7 +116,7 @@ impl Vecs { }, p2sh: P2SHVecs { identity: LazyVecFrom1::init( - "p2shaddressindex", + "p2sh_address_index", version, indexer.vecs.addresses.p2sh.bytes.read_only_boxed_clone(), |index, _| index, @@ -124,7 +124,7 @@ impl Vecs { }, p2tr: P2TRVecs { identity: LazyVecFrom1::init( - "p2traddressindex", + "p2tr_address_index", version, indexer.vecs.addresses.p2tr.bytes.read_only_boxed_clone(), |index, _| index, @@ -132,7 +132,7 @@ impl Vecs { }, p2wpkh: P2WPKHVecs { identity: LazyVecFrom1::init( - "p2wpkhaddressindex", + "p2wpkh_address_index", version, indexer.vecs.addresses.p2wpkh.bytes.read_only_boxed_clone(), |index, _| index, @@ -140,7 +140,7 @@ impl Vecs { }, p2wsh: P2WSHVecs { identity: LazyVecFrom1::init( - "p2wshaddressindex", + "p2wsh_address_index", version, indexer.vecs.addresses.p2wsh.bytes.read_only_boxed_clone(), |index, _| index, @@ -148,7 +148,7 @@ impl Vecs { }, p2a: P2AVecs { identity: LazyVecFrom1::init( - "p2aaddressindex", + "p2a_address_index", version, indexer.vecs.addresses.p2a.bytes.read_only_boxed_clone(), |index, _| index, @@ -156,44 +156,44 @@ impl Vecs { }, p2ms: P2MSVecs { identity: LazyVecFrom1::init( - "p2msoutputindex", + "p2ms_output_index", version, - indexer.vecs.scripts.p2ms.to_txindex.read_only_boxed_clone(), + indexer.vecs.scripts.p2ms.to_tx_index.read_only_boxed_clone(), |index, _| index, ), }, empty: EmptyVecs { identity: LazyVecFrom1::init( - "emptyoutputindex", + "empty_output_index", version, indexer .vecs .scripts - .empty.to_txindex + .empty.to_tx_index .read_only_boxed_clone(), |index, _| index, ), }, unknown: UnknownVecs { identity: LazyVecFrom1::init( - "unknownoutputindex", + "unknown_output_index", version, indexer .vecs .scripts - .unknown.to_txindex + .unknown.to_tx_index .read_only_boxed_clone(), |index, _| index, ), }, opreturn: OpReturnVecs { identity: LazyVecFrom1::init( - "opreturnindex", + "op_return_index", version, indexer .vecs .scripts - .opreturn.to_txindex + .opreturn.to_tx_index .read_only_boxed_clone(), |index, _| index, ), diff --git a/crates/brk_computer/src/indexes/height.rs b/crates/brk_computer/src/indexes/height.rs index 55d07f438..3e30d9be9 100644 --- a/crates/brk_computer/src/indexes/height.rs +++ b/crates/brk_computer/src/indexes/height.rs @@ -25,7 +25,7 @@ pub struct Vecs { pub month6: M::Stored>>, pub year1: M::Stored>>, pub year10: M::Stored>>, - pub txindex_count: M::Stored>>, + pub tx_index_count: M::Stored>>, } impl Vecs { @@ -47,7 +47,7 @@ impl Vecs { month6: EagerVec::forced_import(db, "month6", version)?, year1: EagerVec::forced_import(db, "year1", version)?, year10: EagerVec::forced_import(db, "year10", version)?, - txindex_count: EagerVec::forced_import(db, "txindex_count", version)?, + tx_index_count: EagerVec::forced_import(db, "tx_index_count", version)?, }) } } diff --git a/crates/brk_computer/src/indexes/mod.rs b/crates/brk_computer/src/indexes/mod.rs index fc4a3ada8..9037b342b 100644 --- a/crates/brk_computer/src/indexes/mod.rs +++ b/crates/brk_computer/src/indexes/mod.rs @@ -13,9 +13,9 @@ mod minute30; mod month1; mod month3; mod month6; -mod txindex; -mod txinindex; -mod txoutindex; +mod tx_index; +mod txin_index; +mod txout_index; mod week1; mod year1; mod year10; @@ -51,9 +51,9 @@ pub use minute30::Vecs as Minute30Vecs; pub use month1::Vecs as Month1Vecs; pub use month3::Vecs as Month3Vecs; pub use month6::Vecs as Month6Vecs; -pub use txindex::Vecs as TxIndexVecs; -pub use txinindex::Vecs as TxInIndexVecs; -pub use txoutindex::Vecs as TxOutIndexVecs; +pub use tx_index::Vecs as TxIndexVecs; +pub use txin_index::Vecs as TxInIndexVecs; +pub use txout_index::Vecs as TxOutIndexVecs; pub use week1::Vecs as Week1Vecs; pub use year1::Vecs as Year1Vecs; pub use year10::Vecs as Year10Vecs; @@ -82,9 +82,9 @@ pub struct Vecs { pub month6: Month6Vecs, pub year1: Year1Vecs, pub year10: Year10Vecs, - pub txindex: TxIndexVecs, - pub txinindex: TxInIndexVecs, - pub txoutindex: TxOutIndexVecs, + pub tx_index: TxIndexVecs, + pub txin_index: TxInIndexVecs, + pub txout_index: TxOutIndexVecs, } impl Vecs { @@ -114,9 +114,9 @@ impl Vecs { let month6 = Month6Vecs::forced_import(&db, version)?; let year1 = Year1Vecs::forced_import(&db, version)?; let year10 = Year10Vecs::forced_import(&db, version)?; - let txindex = TxIndexVecs::forced_import(&db, version, indexer)?; - let txinindex = TxInIndexVecs::forced_import(version, indexer); - let txoutindex = TxOutIndexVecs::forced_import(version, indexer); + let tx_index = TxIndexVecs::forced_import(&db, version, indexer)?; + let txin_index = TxInIndexVecs::forced_import(version, indexer); + let txout_index = TxOutIndexVecs::forced_import(version, indexer); let cached_mappings = CachedMappings { minute10_first_height: CachedVec::new(&minute10.first_height), @@ -155,9 +155,9 @@ impl Vecs { month6, year1, year10, - txindex, - txinindex, - txoutindex, + tx_index, + txin_index, + txout_index, db, }; @@ -221,15 +221,15 @@ impl Vecs { starting_indexes: &Indexes, exit: &Exit, ) -> Result<()> { - self.txindex.input_count.compute_count_from_indexes( - starting_indexes.txindex, - &indexer.vecs.transactions.first_txinindex, + self.tx_index.input_count.compute_count_from_indexes( + starting_indexes.tx_index, + &indexer.vecs.transactions.first_txin_index, &indexer.vecs.inputs.outpoint, exit, )?; - self.txindex.output_count.compute_count_from_indexes( - starting_indexes.txindex, - &indexer.vecs.transactions.first_txoutindex, + self.tx_index.output_count.compute_count_from_indexes( + starting_indexes.tx_index, + &indexer.vecs.transactions.first_txout_index, &indexer.vecs.outputs.value, exit, )?; @@ -242,9 +242,9 @@ impl Vecs { starting_indexes: &Indexes, exit: &Exit, ) -> Result<()> { - self.height.txindex_count.compute_count_from_indexes( + self.height.tx_index_count.compute_count_from_indexes( starting_indexes.height, - &indexer.vecs.transactions.first_txindex, + &indexer.vecs.transactions.first_tx_index, &indexer.vecs.transactions.txid, exit, )?; diff --git a/crates/brk_computer/src/indexes/tx_index.rs b/crates/brk_computer/src/indexes/tx_index.rs index be9253516..6d3b9184a 100644 --- a/crates/brk_computer/src/indexes/tx_index.rs +++ b/crates/brk_computer/src/indexes/tx_index.rs @@ -22,7 +22,7 @@ impl Vecs { ) -> Result { Ok(Self { identity: LazyVecFrom1::init( - "txindex", + "tx_index", version, indexer.vecs.transactions.txid.read_only_boxed_clone(), |index, _| index, diff --git a/crates/brk_computer/src/indexes/txin_index.rs b/crates/brk_computer/src/indexes/txin_index.rs index dd5c9528b..ddf6e0f94 100644 --- a/crates/brk_computer/src/indexes/txin_index.rs +++ b/crates/brk_computer/src/indexes/txin_index.rs @@ -12,7 +12,7 @@ impl Vecs { pub(crate) fn forced_import(version: Version, indexer: &Indexer) -> Self { Self { identity: LazyVecFrom1::init( - "txinindex", + "txin_index", version, indexer.vecs.inputs.outpoint.read_only_boxed_clone(), |index, _| index, diff --git a/crates/brk_computer/src/indexes/txout_index.rs b/crates/brk_computer/src/indexes/txout_index.rs index 59a24dcfd..f4d33ba5c 100644 --- a/crates/brk_computer/src/indexes/txout_index.rs +++ b/crates/brk_computer/src/indexes/txout_index.rs @@ -12,7 +12,7 @@ impl Vecs { pub(crate) fn forced_import(version: Version, indexer: &Indexer) -> Self { Self { identity: LazyVecFrom1::init( - "txoutindex", + "txout_index", version, indexer.vecs.outputs.value.read_only_boxed_clone(), |index, _| index, diff --git a/crates/brk_computer/src/inputs/count/compute.rs b/crates/brk_computer/src/inputs/count/compute.rs index c0cce6046..94d3db789 100644 --- a/crates/brk_computer/src/inputs/count/compute.rs +++ b/crates/brk_computer/src/inputs/count/compute.rs @@ -20,9 +20,9 @@ impl Vecs { .compute(starting_indexes.height, &window_starts, exit, |full| { full.compute_with_skip( starting_indexes.height, - &indexes.txindex.input_count, - &indexer.vecs.transactions.first_txindex, - &indexes.height.txindex_count, + &indexes.tx_index.input_count, + &indexer.vecs.transactions.first_tx_index, + &indexes.height.tx_index_count, exit, 0, ) diff --git a/crates/brk_computer/src/inputs/spent/compute.rs b/crates/brk_computer/src/inputs/spent/compute.rs index 2b1bb7ff8..8a1a11241 100644 --- a/crates/brk_computer/src/inputs/spent/compute.rs +++ b/crates/brk_computer/src/inputs/spent/compute.rs @@ -18,9 +18,9 @@ impl Vecs { ) -> Result<()> { // Validate computed versions against dependencies let dep_version = indexer.vecs.inputs.outpoint.version() - + indexer.vecs.transactions.first_txoutindex.version() + + indexer.vecs.transactions.first_txout_index.version() + indexer.vecs.outputs.value.version(); - self.txoutindex + self.txout_index .validate_computed_version_or_reset(dep_version)?; self.value.validate_computed_version_or_reset(dep_version)?; @@ -29,21 +29,21 @@ impl Vecs { return Ok(()); } - let len1 = self.txoutindex.len(); + let len1 = self.txout_index.len(); let len2 = self.value.len(); - let starting = starting_indexes.txinindex.to_usize(); + let starting = starting_indexes.txin_index.to_usize(); let min = len1.min(len2).min(starting); if min >= target { return Ok(()); } - let first_txoutindex_reader = indexer.vecs.transactions.first_txoutindex.reader(); + let first_txout_index_reader = indexer.vecs.transactions.first_txout_index.reader(); let value_reader = indexer.vecs.outputs.value.reader(); let actual_total = target - min; let mut entries: Vec = Vec::with_capacity(actual_total.min(BATCH_SIZE)); // Pre-allocate output buffers for scatter-write pattern - let mut out_txoutindex: Vec = Vec::new(); + let mut out_txout_index: Vec = Vec::new(); let mut out_value: Vec = Vec::new(); let mut batch_start = min; @@ -60,49 +60,49 @@ impl Vecs { .for_each_range_at(batch_start, batch_end, |outpoint| { entries.push(Entry { original_idx: j, - txindex: outpoint.txindex(), + tx_index: outpoint.tx_index(), vout: outpoint.vout(), - txoutindex: TxOutIndex::COINBASE, + txout_index: TxOutIndex::COINBASE, value: Sats::MAX, }); j += 1; }); - // Sort 1: by txindex (group by transaction for sequential first_txoutindex reads) - entries.sort_unstable_by_key(|e| e.txindex); + // Sort 1: by tx_index (group by transaction for sequential first_txout_index reads) + entries.sort_unstable_by_key(|e| e.tx_index); for entry in &mut entries { - if entry.txindex.is_coinbase() { + if entry.tx_index.is_coinbase() { break; } - entry.txoutindex = - first_txoutindex_reader.get(entry.txindex.to_usize()) + entry.vout; + entry.txout_index = + first_txout_index_reader.get(entry.tx_index.to_usize()) + entry.vout; } - // Sort 2: by txoutindex (sequential value reads) - entries.sort_unstable_by_key(|e| e.txoutindex); + // Sort 2: by txout_index (sequential value reads) + entries.sort_unstable_by_key(|e| e.txout_index); for entry in &mut entries { - if entry.txoutindex.is_coinbase() { + if entry.txout_index.is_coinbase() { break; } - entry.value = value_reader.get(entry.txoutindex.to_usize()); + entry.value = value_reader.get(entry.txout_index.to_usize()); } // Scatter-write to output buffers using original_idx (avoids Sort 3) - out_txoutindex.clear(); - out_txoutindex.resize(batch_len, TxOutIndex::COINBASE); + out_txout_index.clear(); + out_txout_index.resize(batch_len, TxOutIndex::COINBASE); out_value.clear(); out_value.resize(batch_len, Sats::MAX); for entry in &entries { - out_txoutindex[entry.original_idx] = entry.txoutindex; + out_txout_index[entry.original_idx] = entry.txout_index; out_value[entry.original_idx] = entry.value; } for i in 0..batch_len { - let txinindex = TxInIndex::from(batch_start + i); - self.txoutindex - .truncate_push(txinindex, out_txoutindex[i])?; - self.value.truncate_push(txinindex, out_value[i])?; + let txin_index = TxInIndex::from(batch_start + i); + self.txout_index + .truncate_push(txin_index, out_txout_index[i])?; + self.value.truncate_push(txin_index, out_value[i])?; } if batch_end < target { @@ -110,7 +110,7 @@ impl Vecs { } let _lock = exit.lock(); - self.txoutindex.write()?; + self.txout_index.write()?; self.value.write()?; db.flush()?; @@ -123,8 +123,8 @@ impl Vecs { struct Entry { original_idx: usize, - txindex: TxIndex, + tx_index: TxIndex, vout: Vout, - txoutindex: TxOutIndex, + txout_index: TxOutIndex, value: Sats, } diff --git a/crates/brk_computer/src/inputs/spent/import.rs b/crates/brk_computer/src/inputs/spent/import.rs index 535033db2..ef2c0d061 100644 --- a/crates/brk_computer/src/inputs/spent/import.rs +++ b/crates/brk_computer/src/inputs/spent/import.rs @@ -7,7 +7,7 @@ use super::Vecs; impl Vecs { pub(crate) fn forced_import(db: &Database, version: Version) -> Result { Ok(Self { - txoutindex: PcoVec::forced_import(db, "txoutindex", version)?, + txout_index: PcoVec::forced_import(db, "txout_index", version)?, value: PcoVec::forced_import(db, "value", version)?, }) } diff --git a/crates/brk_computer/src/inputs/spent/vecs.rs b/crates/brk_computer/src/inputs/spent/vecs.rs index a362fef0f..8a7636bb3 100644 --- a/crates/brk_computer/src/inputs/spent/vecs.rs +++ b/crates/brk_computer/src/inputs/spent/vecs.rs @@ -4,6 +4,6 @@ use vecdb::{PcoVec, Rw, StorageMode}; #[derive(Traversable)] pub struct Vecs { - pub txoutindex: M::Stored>, + pub txout_index: M::Stored>, pub value: M::Stored>, } diff --git a/crates/brk_computer/src/internal/per_tx/derived.rs b/crates/brk_computer/src/internal/per_tx/derived.rs index 194339bf4..a3484bfb5 100644 --- a/crates/brk_computer/src/internal/per_tx/derived.rs +++ b/crates/brk_computer/src/internal/per_tx/derived.rs @@ -62,14 +62,14 @@ where indexer: &Indexer, indexes: &indexes::Vecs, starting_indexes: &Indexes, - txindex_source: &impl ReadableVec, + tx_index_source: &impl ReadableVec, exit: &Exit, ) -> Result<()> where T: Copy + Ord + From + Default, f64: From, { - self.derive_from_with_skip(indexer, indexes, starting_indexes, txindex_source, exit, 0) + self.derive_from_with_skip(indexer, indexes, starting_indexes, tx_index_source, exit, 0) } /// Derive from source, skipping first N transactions per block from per-block stats. @@ -82,7 +82,7 @@ where indexer: &Indexer, indexes: &indexes::Vecs, starting_indexes: &Indexes, - txindex_source: &impl ReadableVec, + tx_index_source: &impl ReadableVec, exit: &Exit, skip_count: usize, ) -> Result<()> @@ -93,9 +93,9 @@ where // Per-block distribution (supports skip for coinbase exclusion) self.block.compute_with_skip( starting_indexes.height, - txindex_source, - &indexer.vecs.transactions.first_txindex, - &indexes.height.txindex_count, + tx_index_source, + &indexer.vecs.transactions.first_tx_index, + &indexes.height.tx_index_count, exit, skip_count, )?; @@ -103,9 +103,9 @@ where // 6-block rolling: true distribution from all txs in last 6 blocks self.rolling._6b.compute_from_nblocks( starting_indexes.height, - txindex_source, - &indexer.vecs.transactions.first_txindex, - &indexes.height.txindex_count, + tx_index_source, + &indexer.vecs.transactions.first_tx_index, + &indexes.height.tx_index_count, 6, exit, )?; diff --git a/crates/brk_computer/src/internal/per_tx/distribution.rs b/crates/brk_computer/src/internal/per_tx/distribution.rs index 7bfda01d0..0ed3fc791 100644 --- a/crates/brk_computer/src/internal/per_tx/distribution.rs +++ b/crates/brk_computer/src/internal/per_tx/distribution.rs @@ -20,7 +20,7 @@ pub struct PerTxDistribution where T: ComputedVecValue + PartialOrd + JsonSchema, { - pub txindex: M::Stored>>, + pub tx_index: M::Stored>>, #[traversable(flatten)] pub distribution: TxDerivedDistribution, } @@ -30,10 +30,10 @@ where T: NumericValue + JsonSchema, { pub(crate) fn forced_import(db: &Database, name: &str, version: Version) -> Result { - let txindex = EagerVec::forced_import(db, name, version)?; + let tx_index = EagerVec::forced_import(db, name, version)?; let distribution = TxDerivedDistribution::forced_import(db, name, version)?; Ok(Self { - txindex, + tx_index, distribution, }) } @@ -55,7 +55,7 @@ where indexer, indexes, starting_indexes, - &self.txindex, + &self.tx_index, exit, skip_count, ) diff --git a/crates/brk_computer/src/internal/per_tx/lazy_distribution.rs b/crates/brk_computer/src/internal/per_tx/lazy_distribution.rs index f01f3f516..8214a89ac 100644 --- a/crates/brk_computer/src/internal/per_tx/lazy_distribution.rs +++ b/crates/brk_computer/src/internal/per_tx/lazy_distribution.rs @@ -17,7 +17,7 @@ where S1: ComputedVecValue, S2: ComputedVecValue, { - pub txindex: LazyVecFrom2, + pub tx_index: LazyVecFrom2, #[traversable(flatten)] pub distribution: TxDerivedDistribution, } @@ -32,11 +32,11 @@ where db: &Database, name: &str, version: Version, - txindex: LazyVecFrom2, + tx_index: LazyVecFrom2, ) -> Result { let distribution = TxDerivedDistribution::forced_import(db, name, version)?; Ok(Self { - txindex, + tx_index, distribution, }) } @@ -54,6 +54,6 @@ where LazyVecFrom2: ReadableVec, { self.distribution - .derive_from(indexer, indexes, starting_indexes, &self.txindex, exit) + .derive_from(indexer, indexes, starting_indexes, &self.tx_index, exit) } } diff --git a/crates/brk_computer/src/internal/per_tx/lazy_distribution_transformed.rs b/crates/brk_computer/src/internal/per_tx/lazy_distribution_transformed.rs index 516310ef4..aa175813c 100644 --- a/crates/brk_computer/src/internal/per_tx/lazy_distribution_transformed.rs +++ b/crates/brk_computer/src/internal/per_tx/lazy_distribution_transformed.rs @@ -15,7 +15,7 @@ where S2: ComputedVecValue, DSource: ComputedVecValue, { - pub txindex: LazyVecFrom2, + pub tx_index: LazyVecFrom2, #[traversable(flatten)] pub distribution: LazyTxDerivedDistribution, } @@ -30,13 +30,13 @@ where pub(crate) fn new>( name: &str, version: Version, - txindex: LazyVecFrom2, + tx_index: LazyVecFrom2, source_distribution: &TxDerivedDistribution, ) -> Self { let distribution = LazyTxDerivedDistribution::from_tx_derived::(name, version, source_distribution); Self { - txindex, + tx_index, distribution, } } diff --git a/crates/brk_computer/src/mining/rewards/compute.rs b/crates/brk_computer/src/mining/rewards/compute.rs index 091caee1f..5f4d07845 100644 --- a/crates/brk_computer/src/mining/rewards/compute.rs +++ b/crates/brk_computer/src/mining/rewards/compute.rs @@ -24,26 +24,26 @@ impl Vecs { exit, |vec| { // Cursors avoid per-height PcoVec page decompression for the - // tx-indexed lookups. Coinbase txindex values are strictly + // tx-indexed lookups. Coinbase tx_index values are strictly // increasing, so the cursors only advance forward. - let mut txout_cursor = indexer.vecs.transactions.first_txoutindex.cursor(); - let mut count_cursor = indexes.txindex.output_count.cursor(); + let mut txout_cursor = indexer.vecs.transactions.first_txout_index.cursor(); + let mut count_cursor = indexes.tx_index.output_count.cursor(); vec.compute_transform( starting_indexes.height, - &indexer.vecs.transactions.first_txindex, - |(height, txindex, ..)| { - let ti = txindex.to_usize(); + &indexer.vecs.transactions.first_tx_index, + |(height, tx_index, ..)| { + let ti = tx_index.to_usize(); txout_cursor.advance(ti - txout_cursor.position()); - let first_txoutindex = txout_cursor.next().unwrap().to_usize(); + let first_txout_index = txout_cursor.next().unwrap().to_usize(); count_cursor.advance(ti - count_cursor.position()); let output_count: usize = count_cursor.next().unwrap().into(); let sats = indexer.vecs.outputs.value.fold_range_at( - first_txoutindex, - first_txoutindex + output_count, + first_txout_index, + first_txout_index + output_count, Sats::ZERO, |acc, v| acc + v, ); @@ -66,9 +66,9 @@ impl Vecs { |vec| { vec.compute_sum_from_indexes( starting_indexes.height, - &indexer.vecs.transactions.first_txindex, - &indexes.height.txindex_count, - &transactions_fees.fee.txindex, + &indexer.vecs.transactions.first_tx_index, + &indexes.height.tx_index_count, + &transactions_fees.fee.tx_index, exit, )?; Ok(()) diff --git a/crates/brk_computer/src/outputs/count/compute.rs b/crates/brk_computer/src/outputs/count/compute.rs index a0f9c5cf7..abbbd5d72 100644 --- a/crates/brk_computer/src/outputs/count/compute.rs +++ b/crates/brk_computer/src/outputs/count/compute.rs @@ -23,9 +23,9 @@ impl Vecs { .compute(starting_indexes.height, &window_starts, exit, |full| { full.compute_with_skip( starting_indexes.height, - &indexes.txindex.output_count, - &indexer.vecs.transactions.first_txindex, - &indexes.height.txindex_count, + &indexes.tx_index.output_count, + &indexer.vecs.transactions.first_tx_index, + &indexes.height.tx_index_count, exit, 0, ) diff --git a/crates/brk_computer/src/outputs/spent/compute.rs b/crates/brk_computer/src/outputs/spent/compute.rs index 8a1c0cb5e..44470b919 100644 --- a/crates/brk_computer/src/outputs/spent/compute.rs +++ b/crates/brk_computer/src/outputs/spent/compute.rs @@ -25,29 +25,29 @@ impl Vecs { let target_height = Height::from(target_height - 1); // Find min_height from current vec length - let current_txoutindex = self.txinindex.len(); - let min_txoutindex = current_txoutindex.min(starting_indexes.txoutindex.to_usize()); + let current_txout_index = self.txin_index.len(); + let min_txout_index = current_txout_index.min(starting_indexes.txout_index.to_usize()); let starting_stamp = Stamp::from(starting_indexes.height); - let _ = self.txinindex.rollback_before(starting_stamp); + let _ = self.txin_index.rollback_before(starting_stamp); - self.txinindex - .truncate_if_needed(TxOutIndex::from(min_txoutindex))?; + self.txin_index + .truncate_if_needed(TxOutIndex::from(min_txout_index))?; - let txinindex_to_txoutindex = &inputs.spent.txoutindex; + let txin_index_to_txout_index = &inputs.spent.txout_index; - // Find min_height via binary search (first_txoutindex is monotonically non-decreasing) - let first_txoutindex_vec = &indexer.vecs.outputs.first_txoutindex; - let min_height = if min_txoutindex == 0 { + // Find min_height via binary search (first_txout_index is monotonically non-decreasing) + let first_txout_index_vec = &indexer.vecs.outputs.first_txout_index; + let min_height = if min_txout_index == 0 { Height::ZERO - } else if min_txoutindex >= starting_indexes.txoutindex.to_usize() { + } else if min_txout_index >= starting_indexes.txout_index.to_usize() { starting_indexes.height } else { let mut lo = 0usize; let mut hi = starting_indexes.height.to_usize() + 1; while lo < hi { let mid = lo + (hi - lo) / 2; - if first_txoutindex_vec.collect_one_at(mid).unwrap().to_usize() <= min_txoutindex { + if first_txout_index_vec.collect_one_at(mid).unwrap().to_usize() <= min_txout_index { lo = mid + 1; } else { hi = mid; @@ -58,12 +58,12 @@ impl Vecs { // Only collect from min_height onward (not from 0) let offset = min_height.to_usize(); - let first_txoutindex_data = - first_txoutindex_vec.collect_range_at(offset, target_height.to_usize() + 1); - let first_txinindex_data = indexer + let first_txout_index_data = + first_txout_index_vec.collect_range_at(offset, target_height.to_usize() + 1); + let first_txin_index_data = indexer .vecs .inputs - .first_txinindex + .first_txin_index .collect_range_at(offset, target_height.to_usize() + 2); // Validate: computed height must not exceed starting height @@ -80,47 +80,47 @@ impl Vecs { while batch_start_height <= target_height { let batch_end_height = (batch_start_height + HEIGHT_BATCH).min(target_height); - // Fill txoutindex up to batch_end_height + 1 - let batch_txoutindex = if batch_end_height >= target_height { + // Fill txout_index up to batch_end_height + 1 + let batch_txout_index = if batch_end_height >= target_height { indexer.vecs.outputs.value.len() } else { - first_txoutindex_data[batch_end_height.to_usize() + 1 - offset].to_usize() + first_txout_index_data[batch_end_height.to_usize() + 1 - offset].to_usize() }; - self.txinindex - .fill_to(batch_txoutindex, TxInIndex::UNSPENT)?; + self.txin_index + .fill_to(batch_txout_index, TxInIndex::UNSPENT)?; // Get txin range for this height batch let txin_start = - first_txinindex_data[batch_start_height.to_usize() - offset].to_usize(); + first_txin_index_data[batch_start_height.to_usize() - offset].to_usize(); let txin_end = if batch_end_height >= target_height { - inputs.spent.txoutindex.len() + inputs.spent.txout_index.len() } else { - first_txinindex_data[batch_end_height.to_usize() + 1 - offset].to_usize() + first_txin_index_data[batch_end_height.to_usize() + 1 - offset].to_usize() }; // Stream txins directly into pairs — avoids intermediate Vec allocation pairs.clear(); let mut j = txin_start; - txinindex_to_txoutindex.for_each_range_at( + txin_index_to_txout_index.for_each_range_at( txin_start, txin_end, - |txoutindex: TxOutIndex| { - if !txoutindex.is_coinbase() { - pairs.push((txoutindex, TxInIndex::from(j))); + |txout_index: TxOutIndex| { + if !txout_index.is_coinbase() { + pairs.push((txout_index, TxInIndex::from(j))); } j += 1; }, ); - pairs.sort_unstable_by_key(|(txoutindex, _)| *txoutindex); + pairs.sort_unstable_by_key(|(txout_index, _)| *txout_index); - for &(txoutindex, txinindex) in &pairs { - self.txinindex.update(txoutindex, txinindex)?; + for &(txout_index, txin_index) in &pairs { + self.txin_index.update(txout_index, txin_index)?; } if batch_end_height < target_height { let _lock = exit.lock(); - self.txinindex.write()?; + self.txin_index.write()?; info!( "TxOuts: {:.2}%", batch_end_height.to_usize() as f64 / target_height.to_usize() as f64 * 100.0 @@ -132,7 +132,7 @@ impl Vecs { } let _lock = exit.lock(); - self.txinindex + self.txin_index .stamped_write_with_changes(Stamp::from(target_height))?; db.flush()?; diff --git a/crates/brk_computer/src/outputs/spent/import.rs b/crates/brk_computer/src/outputs/spent/import.rs index 88c517d84..008e5500c 100644 --- a/crates/brk_computer/src/outputs/spent/import.rs +++ b/crates/brk_computer/src/outputs/spent/import.rs @@ -7,7 +7,7 @@ use super::Vecs; impl Vecs { pub(crate) fn forced_import(db: &Database, version: Version) -> Result { Ok(Self { - txinindex: BytesVec::forced_import(db, "txinindex", version)?, + txin_index: BytesVec::forced_import(db, "txin_index", version)?, }) } } diff --git a/crates/brk_computer/src/outputs/spent/vecs.rs b/crates/brk_computer/src/outputs/spent/vecs.rs index 35a5f0731..393e7e132 100644 --- a/crates/brk_computer/src/outputs/spent/vecs.rs +++ b/crates/brk_computer/src/outputs/spent/vecs.rs @@ -4,5 +4,5 @@ use vecdb::{BytesVec, Rw, StorageMode}; #[derive(Traversable)] pub struct Vecs { - pub txinindex: M::Stored>, + pub txin_index: M::Stored>, } diff --git a/crates/brk_computer/src/pools/mod.rs b/crates/brk_computer/src/pools/mod.rs index bf36eb117..bea06cc6a 100644 --- a/crates/brk_computer/src/pools/mod.rs +++ b/crates/brk_computer/src/pools/mod.rs @@ -118,9 +118,9 @@ impl Vecs { self.height_to_pool .validate_computed_version_or_reset(indexer.stores.height_to_coinbase_tag.version())?; - let first_txoutindex = indexer.vecs.transactions.first_txoutindex.reader(); - let outputtype = indexer.vecs.outputs.outputtype.reader(); - let typeindex = indexer.vecs.outputs.typeindex.reader(); + let first_txout_index = indexer.vecs.transactions.first_txout_index.reader(); + let output_type = indexer.vecs.outputs.output_type.reader(); + let type_index = indexer.vecs.outputs.type_index.reader(); let p2pk65 = indexer.vecs.addresses.p2pk65.bytes.reader(); let p2pk33 = indexer.vecs.addresses.p2pk33.bytes.reader(); let p2pkh = indexer.vecs.addresses.p2pkh.bytes.reader(); @@ -138,11 +138,11 @@ impl Vecs { .min(self.height_to_pool.len()); // Cursors avoid per-height PcoVec page decompression. - // Heights are sequential, txindex values derived from them are monotonically + // Heights are sequential, tx_index values derived from them are monotonically // increasing, so both cursors only advance forward. - let mut first_txindex_cursor = indexer.vecs.transactions.first_txindex.cursor(); - first_txindex_cursor.advance(min); - let mut output_count_cursor = indexes.txindex.output_count.cursor(); + let mut first_tx_index_cursor = indexer.vecs.transactions.first_tx_index.cursor(); + first_tx_index_cursor.advance(min); + let mut output_count_cursor = indexes.tx_index.output_count.cursor(); indexer .stores @@ -150,18 +150,18 @@ impl Vecs { .iter() .skip(min) .try_for_each(|(height, coinbase_tag)| -> Result<()> { - let txindex = first_txindex_cursor.next().unwrap(); - let out_start = first_txoutindex.get(txindex.to_usize()); + let tx_index = first_tx_index_cursor.next().unwrap(); + let out_start = first_txout_index.get(tx_index.to_usize()); - let ti = txindex.to_usize(); + let ti = tx_index.to_usize(); output_count_cursor.advance(ti - output_count_cursor.position()); - let outputcount = output_count_cursor.next().unwrap(); + let output_count_val = output_count_cursor.next().unwrap(); - let pool = (*out_start..(*out_start + *outputcount)) + let pool = (*out_start..(*out_start + *output_count_val)) .map(TxOutIndex::from) - .find_map(|txoutindex| { - let ot = outputtype.get(txoutindex.to_usize()); - let ti = usize::from(typeindex.get(txoutindex.to_usize())); + .find_map(|txout_index| { + let ot = output_type.get(txout_index.to_usize()); + let ti = usize::from(type_index.get(txout_index.to_usize())); match ot { OutputType::P2PK65 => Some(AddressBytes::from(p2pk65.get(ti))), OutputType::P2PK33 => Some(AddressBytes::from(p2pk33.get(ti))), diff --git a/crates/brk_computer/src/positions.rs b/crates/brk_computer/src/positions.rs index 16a40e7c3..858af70be 100644 --- a/crates/brk_computer/src/positions.rs +++ b/crates/brk_computer/src/positions.rs @@ -83,20 +83,20 @@ impl Vecs { self.check_xor_bytes(parser)?; // Validate computed versions against dependencies - let dep_version = indexer.vecs.transactions.first_txindex.version() + let dep_version = indexer.vecs.transactions.first_tx_index.version() + indexer.vecs.transactions.height.version(); self.block .validate_computed_version_or_reset(dep_version)?; self.tx .validate_computed_version_or_reset(dep_version)?; - let min_txindex = TxIndex::from(self.tx.len()).min(starting_indexes.txindex); + let min_tx_index = TxIndex::from(self.tx.len()).min(starting_indexes.tx_index); let Some(min_height) = indexer .vecs .transactions .height - .collect_one(min_txindex) + .collect_one(min_tx_index) .map(|h: Height| h.min(starting_indexes.height)) else { return Ok(()); @@ -104,13 +104,13 @@ impl Vecs { // Cursor avoids per-height PcoVec page decompression. // Heights are sequential, so the cursor only advances forward. - let mut first_txindex_cursor = indexer.vecs.transactions.first_txindex.cursor(); - first_txindex_cursor.advance(min_height.to_usize()); + let mut first_tx_index_cursor = indexer.vecs.transactions.first_tx_index.cursor(); + first_tx_index_cursor.advance(min_height.to_usize()); parser .read( Some(min_height), - Some((indexer.vecs.transactions.first_txindex.len() - 1).into()), + Some((indexer.vecs.transactions.first_tx_index.len() - 1).into()), ) .iter() .try_for_each(|block| -> Result<()> { @@ -119,13 +119,13 @@ impl Vecs { self.block .truncate_push(height, block.metadata().position())?; - let txindex = first_txindex_cursor.next().unwrap(); + let tx_index = first_tx_index_cursor.next().unwrap(); block.tx_metadata().iter().enumerate().try_for_each( |(index, metadata)| -> Result<()> { - let txindex = txindex + index; + let tx_index = tx_index + index; self.tx - .truncate_push(txindex, metadata.position())?; + .truncate_push(tx_index, metadata.position())?; Ok(()) }, )?; diff --git a/crates/brk_computer/src/prices/compute.rs b/crates/brk_computer/src/prices/compute.rs index 018e05b3e..6594e7cc3 100644 --- a/crates/brk_computer/src/prices/compute.rs +++ b/crates/brk_computer/src/prices/compute.rs @@ -59,7 +59,7 @@ impl Vecs { exit: &Exit, ) -> Result<()> { let source_version = - indexer.vecs.outputs.value.version() + indexer.vecs.outputs.outputtype.version(); + indexer.vecs.outputs.value.version() + indexer.vecs.outputs.output_type.version(); self.spot .cents .height @@ -156,34 +156,34 @@ impl Vecs { let total_outputs = indexer.vecs.outputs.value.len(); // Pre-collect height-indexed data for the range (plus one extra for next-block lookups) - let collect_end = (range.end + 1).min(indexer.vecs.transactions.first_txindex.len()); - let first_txindexes: Vec = indexer + let collect_end = (range.end + 1).min(indexer.vecs.transactions.first_tx_index.len()); + let first_tx_indexes: Vec = indexer .vecs .transactions - .first_txindex + .first_tx_index .collect_range_at(range.start, collect_end); let out_firsts: Vec = indexer .vecs .outputs - .first_txoutindex + .first_txout_index .collect_range_at(range.start, collect_end); let mut ref_bins = Vec::with_capacity(range.len()); // Cursor avoids per-block PcoVec page decompression for - // the tx-indexed first_txoutindex lookup. The accessed - // txindex values (first_txindex + 1) are strictly increasing + // the tx-indexed first_txout_index lookup. The accessed + // tx_index values (first_tx_index + 1) are strictly increasing // across blocks, so the cursor only advances forward. - let mut txout_cursor = indexer.vecs.transactions.first_txoutindex.cursor(); + let mut txout_cursor = indexer.vecs.transactions.first_txout_index.cursor(); // Reusable buffers — avoid per-block allocation let mut values: Vec = Vec::new(); let mut output_types: Vec = Vec::new(); for (idx, _h) in range.enumerate() { - let first_txindex = first_txindexes[idx]; - let next_first_txindex = first_txindexes + let first_tx_index = first_tx_indexes[idx]; + let next_first_tx_index = first_tx_indexes .get(idx + 1) .copied() .unwrap_or(TxIndex::from(total_txs)); @@ -193,8 +193,8 @@ impl Vecs { .copied() .unwrap_or(TxOutIndex::from(total_outputs)) .to_usize(); - let out_start = if first_txindex.to_usize() + 1 < next_first_txindex.to_usize() { - let target = first_txindex.to_usize() + 1; + let out_start = if first_tx_index.to_usize() + 1 < next_first_tx_index.to_usize() { + let target = first_tx_index.to_usize() + 1; txout_cursor.advance(target - txout_cursor.position()); txout_cursor.next().unwrap().to_usize() } else { @@ -207,7 +207,7 @@ impl Vecs { .outputs .value .collect_range_into_at(out_start, out_end, &mut values); - indexer.vecs.outputs.outputtype.collect_range_into_at( + indexer.vecs.outputs.output_type.collect_range_into_at( out_start, out_end, &mut output_types, diff --git a/crates/brk_computer/src/scripts/count/compute.rs b/crates/brk_computer/src/scripts/count/compute.rs index 511d3eccd..86cad3e78 100644 --- a/crates/brk_computer/src/scripts/count/compute.rs +++ b/crates/brk_computer/src/scripts/count/compute.rs @@ -27,7 +27,7 @@ impl Vecs { Ok(v.compute_count_from_indexes( starting_indexes.height, &indexer.vecs.scripts.p2ms.first_index, - &indexer.vecs.scripts.p2ms.to_txindex, + &indexer.vecs.scripts.p2ms.to_tx_index, exit, )?) })?; @@ -107,27 +107,27 @@ impl Vecs { Ok(v.compute_count_from_indexes( starting_indexes.height, &indexer.vecs.scripts.opreturn.first_index, - &indexer.vecs.scripts.opreturn.to_txindex, + &indexer.vecs.scripts.opreturn.to_tx_index, exit, )?) })?; - self.unknownoutput + self.unknown_output .compute(starting_indexes.height, exit, |v| { Ok(v.compute_count_from_indexes( starting_indexes.height, &indexer.vecs.scripts.unknown.first_index, - &indexer.vecs.scripts.unknown.to_txindex, + &indexer.vecs.scripts.unknown.to_tx_index, exit, )?) })?; - self.emptyoutput + self.empty_output .compute(starting_indexes.height, exit, |v| { Ok(v.compute_count_from_indexes( starting_indexes.height, &indexer.vecs.scripts.empty.first_index, - &indexer.vecs.scripts.empty.to_txindex, + &indexer.vecs.scripts.empty.to_tx_index, exit, )?) })?; diff --git a/crates/brk_computer/src/scripts/count/import.rs b/crates/brk_computer/src/scripts/count/import.rs index 85613a94c..c2d79ce45 100644 --- a/crates/brk_computer/src/scripts/count/import.rs +++ b/crates/brk_computer/src/scripts/count/import.rs @@ -53,16 +53,16 @@ impl Vecs { indexes, cached_starts, )?, - emptyoutput: PerBlockCumulativeWithSums::forced_import( + empty_output: PerBlockCumulativeWithSums::forced_import( db, - "emptyoutput_count", + "empty_output_count", version, indexes, cached_starts, )?, - unknownoutput: PerBlockCumulativeWithSums::forced_import( + unknown_output: PerBlockCumulativeWithSums::forced_import( db, - "unknownoutput_count", + "unknown_output_count", version, indexes, cached_starts, diff --git a/crates/brk_computer/src/scripts/count/vecs.rs b/crates/brk_computer/src/scripts/count/vecs.rs index 9c05b6361..5102d9ce1 100644 --- a/crates/brk_computer/src/scripts/count/vecs.rs +++ b/crates/brk_computer/src/scripts/count/vecs.rs @@ -16,8 +16,8 @@ pub struct Vecs { pub p2wpkh: PerBlockCumulativeWithSums, pub p2wsh: PerBlockCumulativeWithSums, pub opreturn: PerBlockCumulativeWithSums, - pub emptyoutput: PerBlockCumulativeWithSums, - pub unknownoutput: PerBlockCumulativeWithSums, + pub empty_output: PerBlockCumulativeWithSums, + pub unknown_output: PerBlockCumulativeWithSums, pub segwit: PerBlockCumulativeWithSums, } diff --git a/crates/brk_computer/src/scripts/value/compute.rs b/crates/brk_computer/src/scripts/value/compute.rs index af83cf9b4..f343fd97c 100644 --- a/crates/brk_computer/src/scripts/value/compute.rs +++ b/crates/brk_computer/src/scripts/value/compute.rs @@ -20,13 +20,13 @@ impl Vecs { exit, |height_vec| { // Validate computed versions against dependencies - let dep_version = indexer.vecs.outputs.first_txoutindex.version() - + indexer.vecs.outputs.outputtype.version() + let dep_version = indexer.vecs.outputs.first_txout_index.version() + + indexer.vecs.outputs.output_type.version() + indexer.vecs.outputs.value.version(); height_vec.validate_computed_version_or_reset(dep_version)?; // Get target height - let target_len = indexer.vecs.outputs.first_txoutindex.len(); + let target_len = indexer.vecs.outputs.first_txout_index.len(); if target_len == 0 { return Ok(()); } @@ -42,14 +42,14 @@ impl Vecs { } // Pre-collect height-indexed data - let first_txoutindexes: Vec = - indexer.vecs.outputs.first_txoutindex.collect_range_at( + let first_txout_indexes: Vec = + indexer.vecs.outputs.first_txout_index.collect_range_at( starting_height.to_usize(), target_height.to_usize() - + 2.min(indexer.vecs.outputs.first_txoutindex.len()), + + 2.min(indexer.vecs.outputs.first_txout_index.len()), ); - let mut outputtypes_buf: Vec = Vec::new(); + let mut output_types_buf: Vec = Vec::new(); let mut values_buf: Vec = Vec::new(); // Iterate blocks @@ -58,23 +58,23 @@ impl Vecs { let local_idx = h - starting_height.to_usize(); // Get output range for this block - let first_txoutindex = first_txoutindexes[local_idx]; - let next_first_txoutindex = - if let Some(&next) = first_txoutindexes.get(local_idx + 1) { + let first_txout_index = first_txout_indexes[local_idx]; + let next_first_txout_index = + if let Some(&next) = first_txout_indexes.get(local_idx + 1) { next } else { TxOutIndex::from(indexer.vecs.outputs.value.len()) }; - let out_start = first_txoutindex.to_usize(); - let out_end = next_first_txoutindex.to_usize(); + let out_start = first_txout_index.to_usize(); + let out_end = next_first_txout_index.to_usize(); // Pre-collect both vecs into reusable buffers indexer .vecs .outputs - .outputtype - .collect_range_into_at(out_start, out_end, &mut outputtypes_buf); + .output_type + .collect_range_into_at(out_start, out_end, &mut output_types_buf); indexer .vecs .outputs @@ -82,7 +82,7 @@ impl Vecs { .collect_range_into_at(out_start, out_end, &mut values_buf); let mut opreturn_value = Sats::ZERO; - for (ot, val) in outputtypes_buf.iter().zip(values_buf.iter()) { + for (ot, val) in output_types_buf.iter().zip(values_buf.iter()) { if *ot == OutputType::OpReturn { opreturn_value += *val; } diff --git a/crates/brk_computer/src/transactions/count/compute.rs b/crates/brk_computer/src/transactions/count/compute.rs index 1c05e2e97..79d706252 100644 --- a/crates/brk_computer/src/transactions/count/compute.rs +++ b/crates/brk_computer/src/transactions/count/compute.rs @@ -19,7 +19,7 @@ impl Vecs { .compute(starting_indexes.height, &window_starts, exit, |height| { Ok(height.compute_count_from_indexes( starting_indexes.height, - &indexer.vecs.transactions.first_txindex, + &indexer.vecs.transactions.first_tx_index, &indexer.vecs.transactions.txid, exit, )?) diff --git a/crates/brk_computer/src/transactions/count/import.rs b/crates/brk_computer/src/transactions/count/import.rs index f0f54e43f..37474827f 100644 --- a/crates/brk_computer/src/transactions/count/import.rs +++ b/crates/brk_computer/src/transactions/count/import.rs @@ -14,16 +14,16 @@ impl Vecs { indexes: &indexes::Vecs, cached_starts: &CachedWindowStarts, ) -> Result { - let txindex_to_is_coinbase = LazyVecFrom2::init( + let tx_index_to_is_coinbase = LazyVecFrom2::init( "is_coinbase", version, indexer.vecs.transactions.height.read_only_boxed_clone(), indexer .vecs .transactions - .first_txindex + .first_tx_index .read_only_boxed_clone(), - |index: TxIndex, _height, first_txindex| StoredBool::from(index == first_txindex), + |index: TxIndex, _height, first_tx_index| StoredBool::from(index == first_tx_index), ); Ok(Self { @@ -34,7 +34,7 @@ impl Vecs { indexes, cached_starts, )?, - is_coinbase: txindex_to_is_coinbase, + is_coinbase: tx_index_to_is_coinbase, }) } } diff --git a/crates/brk_computer/src/transactions/fees/compute.rs b/crates/brk_computer/src/transactions/fees/compute.rs index 4fd962b31..d35a05bba 100644 --- a/crates/brk_computer/src/transactions/fees/compute.rs +++ b/crates/brk_computer/src/transactions/fees/compute.rs @@ -19,23 +19,23 @@ impl Vecs { exit: &Exit, ) -> Result<()> { self.input_value.compute_sum_from_indexes( - starting_indexes.txindex, - &indexer.vecs.transactions.first_txinindex, - &indexes.txindex.input_count, + starting_indexes.tx_index, + &indexer.vecs.transactions.first_txin_index, + &indexes.tx_index.input_count, &txins.spent.value, exit, )?; self.output_value.compute_sum_from_indexes( - starting_indexes.txindex, - &indexer.vecs.transactions.first_txoutindex, - &indexes.txindex.output_count, + starting_indexes.tx_index, + &indexer.vecs.transactions.first_txout_index, + &indexes.tx_index.output_count, &indexer.vecs.outputs.value, exit, )?; - self.fee.txindex.compute_transform2( - starting_indexes.txindex, + self.fee.tx_index.compute_transform2( + starting_indexes.tx_index, &self.input_value, &self.output_value, |(i, input, output, ..)| { @@ -49,11 +49,11 @@ impl Vecs { exit, )?; - self.fee_rate.txindex.compute_transform2( - starting_indexes.txindex, - &self.fee.txindex, - &size_vecs.vsize.txindex, - |(txindex, fee, vsize, ..)| (txindex, FeeRate::from((fee, vsize))), + self.fee_rate.tx_index.compute_transform2( + starting_indexes.tx_index, + &self.fee.tx_index, + &size_vecs.vsize.tx_index, + |(tx_index, fee, vsize, ..)| (tx_index, FeeRate::from((fee, vsize))), exit, )?; diff --git a/crates/brk_computer/src/transactions/size/import.rs b/crates/brk_computer/src/transactions/size/import.rs index 85895d3a2..cf13bda7d 100644 --- a/crates/brk_computer/src/transactions/size/import.rs +++ b/crates/brk_computer/src/transactions/size/import.rs @@ -12,7 +12,7 @@ impl Vecs { version: Version, indexer: &Indexer, ) -> Result { - let txindex_to_vsize = LazyVecFrom2::init( + let tx_index_to_vsize = LazyVecFrom2::init( "tx_vsize", version, indexer.vecs.transactions.base_size.read_only_boxed_clone(), @@ -23,9 +23,9 @@ impl Vecs { ); let vsize = - LazyPerTxDistribution::forced_import(db, "tx_vsize", version, txindex_to_vsize)?; + LazyPerTxDistribution::forced_import(db, "tx_vsize", version, tx_index_to_vsize)?; - let txindex_to_weight = LazyVecFrom2::init( + let tx_index_to_weight = LazyVecFrom2::init( "tx_weight", version, indexer.vecs.transactions.base_size.read_only_boxed_clone(), @@ -36,7 +36,7 @@ impl Vecs { let weight = LazyPerTxDistributionTransformed::new::( "tx_weight", version, - txindex_to_weight, + tx_index_to_weight, &vsize.distribution, ); diff --git a/crates/brk_computer/src/transactions/versions/compute.rs b/crates/brk_computer/src/transactions/versions/compute.rs index 1b23fad46..6028fd013 100644 --- a/crates/brk_computer/src/transactions/versions/compute.rs +++ b/crates/brk_computer/src/transactions/versions/compute.rs @@ -14,20 +14,20 @@ impl Vecs { exit: &Exit, ) -> Result<()> { let tx_vany = |tx_vany: &mut PerBlockCumulativeWithSums, - txversion: TxVersion| { - let txversion_vec = &indexer.vecs.transactions.txversion; + tx_version: TxVersion| { + let tx_version_vec = &indexer.vecs.transactions.tx_version; // Cursor avoids per-transaction PcoVec page decompression. // Txindex values are sequential, so the cursor only advances forward. - let mut cursor = txversion_vec.cursor(); + let mut cursor = tx_version_vec.cursor(); tx_vany.compute(starting_indexes.height, exit, |vec| { vec.compute_filtered_count_from_indexes( starting_indexes.height, - &indexer.vecs.transactions.first_txindex, + &indexer.vecs.transactions.first_tx_index, &indexer.vecs.transactions.txid, - |txindex| { - let ti = txindex.to_usize(); + |tx_index| { + let ti = tx_index.to_usize(); cursor.advance(ti - cursor.position()); - cursor.next().unwrap() == txversion + cursor.next().unwrap() == tx_version }, exit, )?; diff --git a/crates/brk_computer/src/transactions/volume/compute.rs b/crates/brk_computer/src/transactions/volume/compute.rs index bcb723e72..7b6c81fac 100644 --- a/crates/brk_computer/src/transactions/volume/compute.rs +++ b/crates/brk_computer/src/transactions/volume/compute.rs @@ -29,8 +29,8 @@ impl Vecs { |sats_vec| { Ok(sats_vec.compute_filtered_sum_from_indexes( starting_indexes.height, - &indexer.vecs.transactions.first_txindex, - &indexes.height.txindex_count, + &indexer.vecs.transactions.first_tx_index, + &indexes.height.tx_index_count, &fees_vecs.input_value, |sats| !sats.is_max(), exit, @@ -45,8 +45,8 @@ impl Vecs { |sats_vec| { Ok(sats_vec.compute_sum_from_indexes( starting_indexes.height, - &indexer.vecs.transactions.first_txindex, - &indexes.height.txindex_count, + &indexer.vecs.transactions.first_tx_index, + &indexes.height.tx_index_count, &fees_vecs.output_value, exit, )?) diff --git a/crates/brk_indexer/src/constants.rs b/crates/brk_indexer/src/constants.rs index 2293ee6ab..07d4f0d02 100644 --- a/crates/brk_indexer/src/constants.rs +++ b/crates/brk_indexer/src/constants.rs @@ -9,7 +9,7 @@ pub const SNAPSHOT_BLOCK_RANGE: usize = 1_000; /// Known duplicate Bitcoin transactions (BIP30) /// https://github.com/bitcoin/bips/blob/master/bip-0030.mediawiki -/// Each entry is (txid_str, txindex) - these are coinbase txs that were duplicated. +/// Each entry is (txid_str, tx_index) - these are coinbase txs that were duplicated. pub const DUPLICATE_TXID_STRS: [(&str, u32); 2] = [ ( "d5d27987d2a3dfc724e359870c6644b40e497bdc0589a033220fe15429d88599", @@ -34,10 +34,10 @@ pub static DUPLICATE_TXIDS: std::sync::LazyLock<[Txid; 2]> = std::sync::LazyLock pub static DUPLICATE_TXID_PREFIXES: std::sync::LazyLock<[(TxidPrefix, TxIndex); 2]> = std::sync::LazyLock::new(|| { - DUPLICATE_TXID_STRS.map(|(s, txindex)| { + DUPLICATE_TXID_STRS.map(|(s, tx_index)| { ( TxidPrefix::from(&Txid::from(bitcoin::Txid::from_str(s).unwrap())), - TxIndex::new(txindex), + TxIndex::new(tx_index), ) }) }); diff --git a/crates/brk_indexer/src/indexes.rs b/crates/brk_indexer/src/indexes.rs index e673a69cf..8995f1497 100644 --- a/crates/brk_indexer/src/indexes.rs +++ b/crates/brk_indexer/src/indexes.rs @@ -21,50 +21,50 @@ impl IndexesExt for Indexes { fn checked_push(&self, vecs: &mut Vecs) -> Result<()> { let height = self.height; vecs.transactions - .first_txindex - .checked_push(height, self.txindex)?; + .first_tx_index + .checked_push(height, self.tx_index)?; vecs.inputs - .first_txinindex - .checked_push(height, self.txinindex)?; + .first_txin_index + .checked_push(height, self.txin_index)?; vecs.outputs - .first_txoutindex - .checked_push(height, self.txoutindex)?; + .first_txout_index + .checked_push(height, self.txout_index)?; vecs.scripts .empty.first_index - .checked_push(height, self.emptyoutputindex)?; + .checked_push(height, self.empty_output_index)?; vecs.scripts .p2ms.first_index - .checked_push(height, self.p2msoutputindex)?; + .checked_push(height, self.p2ms_output_index)?; vecs.scripts .opreturn.first_index - .checked_push(height, self.opreturnindex)?; + .checked_push(height, self.op_return_index)?; vecs.addresses .p2a.first_index - .checked_push(height, self.p2aaddressindex)?; + .checked_push(height, self.p2a_address_index)?; vecs.scripts .unknown.first_index - .checked_push(height, self.unknownoutputindex)?; + .checked_push(height, self.unknown_output_index)?; vecs.addresses .p2pk33.first_index - .checked_push(height, self.p2pk33addressindex)?; + .checked_push(height, self.p2pk33_address_index)?; vecs.addresses .p2pk65.first_index - .checked_push(height, self.p2pk65addressindex)?; + .checked_push(height, self.p2pk65_address_index)?; vecs.addresses .p2pkh.first_index - .checked_push(height, self.p2pkhaddressindex)?; + .checked_push(height, self.p2pkh_address_index)?; vecs.addresses .p2sh.first_index - .checked_push(height, self.p2shaddressindex)?; + .checked_push(height, self.p2sh_address_index)?; vecs.addresses .p2tr.first_index - .checked_push(height, self.p2traddressindex)?; + .checked_push(height, self.p2tr_address_index)?; vecs.addresses .p2wpkh.first_index - .checked_push(height, self.p2wpkhaddressindex)?; + .checked_push(height, self.p2wpkh_address_index)?; vecs.addresses .p2wsh.first_index - .checked_push(height, self.p2wshaddressindex)?; + .checked_push(height, self.p2wsh_address_index)?; Ok(()) } @@ -97,113 +97,113 @@ impl IndexesExt for Indexes { local_height }; - let emptyoutputindex = starting_index( + let empty_output_index = starting_index( &vecs.scripts.empty.first_index, - &vecs.scripts.empty.to_txindex, + &vecs.scripts.empty.to_tx_index, starting_height, )?; - let p2msoutputindex = starting_index( + let p2ms_output_index = starting_index( &vecs.scripts.p2ms.first_index, - &vecs.scripts.p2ms.to_txindex, + &vecs.scripts.p2ms.to_tx_index, starting_height, )?; - let opreturnindex = starting_index( + let op_return_index = starting_index( &vecs.scripts.opreturn.first_index, - &vecs.scripts.opreturn.to_txindex, + &vecs.scripts.opreturn.to_tx_index, starting_height, )?; - let p2pk33addressindex = starting_index( + let p2pk33_address_index = starting_index( &vecs.addresses.p2pk33.first_index, &vecs.addresses.p2pk33.bytes, starting_height, )?; - let p2pk65addressindex = starting_index( + let p2pk65_address_index = starting_index( &vecs.addresses.p2pk65.first_index, &vecs.addresses.p2pk65.bytes, starting_height, )?; - let p2pkhaddressindex = starting_index( + let p2pkh_address_index = starting_index( &vecs.addresses.p2pkh.first_index, &vecs.addresses.p2pkh.bytes, starting_height, )?; - let p2shaddressindex = starting_index( + let p2sh_address_index = starting_index( &vecs.addresses.p2sh.first_index, &vecs.addresses.p2sh.bytes, starting_height, )?; - let p2traddressindex = starting_index( + let p2tr_address_index = starting_index( &vecs.addresses.p2tr.first_index, &vecs.addresses.p2tr.bytes, starting_height, )?; - let p2wpkhaddressindex = starting_index( + let p2wpkh_address_index = starting_index( &vecs.addresses.p2wpkh.first_index, &vecs.addresses.p2wpkh.bytes, starting_height, )?; - let p2wshaddressindex = starting_index( + let p2wsh_address_index = starting_index( &vecs.addresses.p2wsh.first_index, &vecs.addresses.p2wsh.bytes, starting_height, )?; - let p2aaddressindex = starting_index( + let p2a_address_index = starting_index( &vecs.addresses.p2a.first_index, &vecs.addresses.p2a.bytes, starting_height, )?; - let txindex = starting_index( - &vecs.transactions.first_txindex, + let tx_index = starting_index( + &vecs.transactions.first_tx_index, &vecs.transactions.txid, starting_height, )?; - let txinindex = starting_index( - &vecs.inputs.first_txinindex, + let txin_index = starting_index( + &vecs.inputs.first_txin_index, &vecs.inputs.outpoint, starting_height, )?; - let txoutindex = starting_index( - &vecs.outputs.first_txoutindex, + let txout_index = starting_index( + &vecs.outputs.first_txout_index, &vecs.outputs.value, starting_height, )?; - let unknownoutputindex = starting_index( + let unknown_output_index = starting_index( &vecs.scripts.unknown.first_index, - &vecs.scripts.unknown.to_txindex, + &vecs.scripts.unknown.to_tx_index, starting_height, )?; Some(Indexes { - emptyoutputindex, + empty_output_index, height: starting_height, - p2msoutputindex, - opreturnindex, - p2pk33addressindex, - p2pk65addressindex, - p2pkhaddressindex, - p2shaddressindex, - p2traddressindex, - p2wpkhaddressindex, - p2wshaddressindex, - p2aaddressindex, - txindex, - txinindex, - txoutindex, - unknownoutputindex, + p2ms_output_index, + op_return_index, + p2pk33_address_index, + p2pk65_address_index, + p2pkh_address_index, + p2sh_address_index, + p2tr_address_index, + p2wpkh_address_index, + p2wsh_address_index, + p2a_address_index, + tx_index, + txin_index, + txout_index, + unknown_output_index, }) } } diff --git a/crates/brk_indexer/src/processor/metadata.rs b/crates/brk_indexer/src/processor/metadata.rs index 88198b28a..091269d48 100644 --- a/crates/brk_indexer/src/processor/metadata.rs +++ b/crates/brk_indexer/src/processor/metadata.rs @@ -14,7 +14,7 @@ impl BlockProcessor<'_> { if self .stores - .blockhashprefix_to_height + .blockhash_prefix_to_height .get(&blockhash_prefix)? .is_some_and(|prev_height| *prev_height != height) { @@ -25,7 +25,7 @@ impl BlockProcessor<'_> { self.indexes.checked_push(self.vecs)?; self.stores - .blockhashprefix_to_height + .blockhash_prefix_to_height .insert(blockhash_prefix, height); self.stores diff --git a/crates/brk_indexer/src/processor/mod.rs b/crates/brk_indexer/src/processor/mod.rs index 7edfe5a41..299ccc270 100644 --- a/crates/brk_indexer/src/processor/mod.rs +++ b/crates/brk_indexer/src/processor/mod.rs @@ -27,9 +27,9 @@ pub struct BlockProcessor<'a> { impl BlockProcessor<'_> { /// Update global indexes after processing a block. pub fn update_indexes(&mut self, tx_count: usize, input_count: usize, output_count: usize) { - self.indexes.txindex += TxIndex::from(tx_count); - self.indexes.txinindex += TxInIndex::from(input_count); - self.indexes.txoutindex += TxOutIndex::from(output_count); + self.indexes.tx_index += TxIndex::from(tx_count); + self.indexes.txin_index += TxInIndex::from(input_count); + self.indexes.txout_index += TxOutIndex::from(output_count); } /// Finalizes outputs/inputs in parallel with storing tx metadata. @@ -46,8 +46,8 @@ impl BlockProcessor<'_> { let height = self.height; let indexes = &mut *self.indexes; - // Split transactions vecs: finalize needs first_txoutindex/first_txinindex, metadata needs the rest - let (first_txoutindex, first_txinindex, mut tx_metadata) = + // Split transactions vecs: finalize needs first_txout_index/first_txin_index, metadata needs the rest + let (first_txout_index, first_txin_index, mut tx_metadata) = self.vecs.transactions.split_for_finalize(); let outputs = &mut self.vecs.outputs; @@ -55,21 +55,21 @@ impl BlockProcessor<'_> { let addresses = &mut self.vecs.addresses; let scripts = &mut self.vecs.scripts; - let addr_hash_stores = &mut self.stores.addresstype_to_addresshash_to_addressindex; - let addr_txindex_stores = &mut self.stores.addresstype_to_addressindex_and_txindex; - let addr_outpoint_stores = &mut self.stores.addresstype_to_addressindex_and_unspentoutpoint; - let txidprefix_store = &mut self.stores.txidprefix_to_txindex; + let addr_hash_stores = &mut self.stores.address_type_to_address_hash_to_address_index; + let addr_tx_index_stores = &mut self.stores.address_type_to_address_index_and_tx_index; + let addr_outpoint_stores = &mut self.stores.address_type_to_address_index_and_unspent_outpoint; + let txid_prefix_store = &mut self.stores.txid_prefix_to_tx_index; let (finalize_result, metadata_result) = rayon::join( || -> Result<()> { txout::finalize_outputs( indexes, - first_txoutindex, + first_txout_index, outputs, addresses, scripts, addr_hash_stores, - addr_txindex_stores, + addr_tx_index_stores, addr_outpoint_stores, txouts, same_block_spent_outpoints, @@ -77,15 +77,15 @@ impl BlockProcessor<'_> { same_block_info, )?; txin::finalize_inputs( - first_txinindex, + first_txin_index, inputs, - addr_txindex_stores, + addr_tx_index_stores, addr_outpoint_stores, txins, same_block_info, ) }, - || tx::store_tx_metadata(height, txs, txidprefix_store, &mut tx_metadata), + || tx::store_tx_metadata(height, txs, txid_prefix_store, &mut tx_metadata), ); finalize_result?; diff --git a/crates/brk_indexer/src/processor/tx.rs b/crates/brk_indexer/src/processor/tx.rs index 7233b2291..8a1adc8b7 100644 --- a/crates/brk_indexer/src/processor/tx.rs +++ b/crates/brk_indexer/src/processor/tx.rs @@ -13,7 +13,7 @@ use super::{BlockProcessor, ComputedTx}; impl<'a> BlockProcessor<'a> { pub fn compute_txids(&self) -> Result>> { let will_check_collisions = self.check_collisions; - let base_txindex = self.indexes.txindex; + let base_tx_index = self.indexes.tx_index; self.block .txdata @@ -24,9 +24,9 @@ impl<'a> BlockProcessor<'a> { let txid = Txid::from(btc_txid); let txid_prefix = TxidPrefix::from(&txid); - let prev_txindex_opt = if will_check_collisions { + let prev_tx_index_opt = if will_check_collisions { self.stores - .txidprefix_to_txindex + .txid_prefix_to_tx_index .get(&txid_prefix)? .map(|v| *v) } else { @@ -34,11 +34,11 @@ impl<'a> BlockProcessor<'a> { }; Ok(ComputedTx { - txindex: base_txindex + TxIndex::from(index), + tx_index: base_tx_index + TxIndex::from(index), tx, txid, txid_prefix, - prev_txindex_opt, + prev_tx_index_opt, base_size, total_size, }) @@ -53,11 +53,11 @@ impl<'a> BlockProcessor<'a> { } for ct in txs.iter() { - let Some(prev_txindex) = ct.prev_txindex_opt else { + let Some(prev_tx_index) = ct.prev_tx_index_opt else { continue; }; - if ct.txindex == prev_txindex { + if ct.tx_index == prev_tx_index { continue; } @@ -66,18 +66,18 @@ impl<'a> BlockProcessor<'a> { .vecs .transactions .txid - .get_pushed_or_read(prev_txindex, &self.readers.txid) - .ok_or(Error::Internal("Missing txid for txindex")) + .get_pushed_or_read(prev_tx_index, &self.readers.txid) + .ok_or(Error::Internal("Missing txid for tx_index")) .inspect_err(|_| { - error!(txindex = ?ct.txindex, len, "Missing txid for txindex"); + error!(tx_index = ?ct.tx_index, len, "Missing txid for tx_index"); })?; let is_dup = DUPLICATE_TXIDS.contains(&prev_txid); if !is_dup { error!( - height = ?self.height, txindex = ?ct.txindex, - ?prev_txid, ?prev_txindex, + height = ?self.height, tx_index = ?ct.tx_index, + ?prev_txid, ?prev_tx_index, "Unexpected TXID collision" ); return Err(Error::Internal("Unexpected TXID collision")); @@ -95,20 +95,20 @@ pub(super) fn store_tx_metadata( md: &mut TxMetadataVecs<'_>, ) -> Result<()> { for ct in txs { - if ct.prev_txindex_opt.is_none() { - store.insert(ct.txid_prefix, ct.txindex); + if ct.prev_tx_index_opt.is_none() { + store.insert(ct.txid_prefix, ct.tx_index); } - md.height.checked_push(ct.txindex, height)?; - md.txversion - .checked_push(ct.txindex, ct.tx.version.into())?; - md.txid.checked_push(ct.txindex, ct.txid)?; - md.rawlocktime - .checked_push(ct.txindex, ct.tx.lock_time.into())?; - md.base_size.checked_push(ct.txindex, ct.base_size.into())?; + md.height.checked_push(ct.tx_index, height)?; + md.tx_version + .checked_push(ct.tx_index, ct.tx.version.into())?; + md.txid.checked_push(ct.tx_index, ct.txid)?; + md.raw_locktime + .checked_push(ct.tx_index, ct.tx.lock_time.into())?; + md.base_size.checked_push(ct.tx_index, ct.base_size.into())?; md.total_size - .checked_push(ct.txindex, ct.total_size.into())?; + .checked_push(ct.tx_index, ct.total_size.into())?; md.is_explicitly_rbf - .checked_push(ct.txindex, StoredBool::from(ct.tx.is_explicitly_rbf()))?; + .checked_push(ct.tx_index, StoredBool::from(ct.tx.is_explicitly_rbf()))?; } Ok(()) } diff --git a/crates/brk_indexer/src/processor/txin.rs b/crates/brk_indexer/src/processor/txin.rs index faca8acc3..712b32e9a 100644 --- a/crates/brk_indexer/src/processor/txin.rs +++ b/crates/brk_indexer/src/processor/txin.rs @@ -17,13 +17,13 @@ impl<'a> BlockProcessor<'a> { pub fn process_inputs( &self, txs: &[ComputedTx], - txid_prefix_to_txindex: &mut FxHashMap, + txid_prefix_to_tx_index: &mut FxHashMap, ) -> Result> { - txid_prefix_to_txindex.clear(); - txid_prefix_to_txindex.extend(txs.iter().map(|ct| (ct.txid_prefix, ct.txindex))); + txid_prefix_to_tx_index.clear(); + txid_prefix_to_tx_index.extend(txs.iter().map(|ct| (ct.txid_prefix, ct.tx_index))); - let base_txindex = self.indexes.txindex; - let base_txinindex = self.indexes.txinindex; + let base_tx_index = self.indexes.tx_index; + let base_txin_index = self.indexes.txin_index; let total_inputs: usize = self.block.txdata.iter().map(|tx| tx.input.len()).sum(); let mut items = Vec::with_capacity(total_inputs); @@ -33,21 +33,21 @@ impl<'a> BlockProcessor<'a> { } } - let txid_prefix_to_txindex = &*txid_prefix_to_txindex; + let txid_prefix_to_tx_index = &*txid_prefix_to_tx_index; let txins = items .into_par_iter() .enumerate() .map( - |(block_txinindex, (block_txindex, vin, txin, tx))| -> Result<(TxInIndex, InputSource)> { - let txindex = base_txindex + block_txindex; - let txinindex = base_txinindex + TxInIndex::from(block_txinindex); + |(block_txin_index, (block_tx_index, vin, txin, tx))| -> Result<(TxInIndex, InputSource)> { + let tx_index = base_tx_index + block_tx_index; + let txin_index = base_txin_index + TxInIndex::from(block_txin_index); if tx.is_coinbase() { return Ok(( - txinindex, + txin_index, InputSource::SameBlock { - txindex, + tx_index, vin, outpoint: OutPoint::COINBASE, }, @@ -59,13 +59,13 @@ impl<'a> BlockProcessor<'a> { let txid_prefix = TxidPrefix::from(&txid); let vout = Vout::from(outpoint.vout); - if let Some(&same_block_txindex) = txid_prefix_to_txindex + if let Some(&same_block_tx_index) = txid_prefix_to_tx_index .get(&txid_prefix) { - let outpoint = OutPoint::new(same_block_txindex, vout); + let outpoint = OutPoint::new(same_block_tx_index, vout); return Ok(( - txinindex, + txin_index, InputSource::SameBlock { - txindex, + tx_index, vin, outpoint, }, @@ -74,53 +74,53 @@ impl<'a> BlockProcessor<'a> { let store_result = self .stores - .txidprefix_to_txindex + .txid_prefix_to_tx_index .get(&txid_prefix)? .map(|v| *v); - let prev_txindex = match store_result { - Some(txindex) if txindex < self.indexes.txindex => txindex, + let prev_tx_index = match store_result { + Some(tx_index) if tx_index < self.indexes.tx_index => tx_index, _ => { error!( - "UnknownTxid: txid={}, prefix={:?}, store_result={:?}, current_txindex={:?}", - txid, txid_prefix, store_result, self.indexes.txindex + "UnknownTxid: txid={}, prefix={:?}, store_result={:?}, current_tx_index={:?}", + txid, txid_prefix, store_result, self.indexes.tx_index ); return Err(Error::UnknownTxid); } }; - let txoutindex = self + let txout_index = self .vecs .transactions - .first_txoutindex - .get_pushed_or_read(prev_txindex, &self.readers.txindex_to_first_txoutindex) - .ok_or(Error::Internal("Missing txoutindex"))? + .first_txout_index + .get_pushed_or_read(prev_tx_index, &self.readers.tx_index_to_first_txout_index) + .ok_or(Error::Internal("Missing txout_index"))? + vout; - let outpoint = OutPoint::new(prev_txindex, vout); + let outpoint = OutPoint::new(prev_tx_index, vout); - let outputtype = self + let output_type = self .vecs .outputs - .outputtype - .get_pushed_or_read(txoutindex, &self.readers.txoutindex_to_outputtype) - .ok_or(Error::Internal("Missing outputtype"))?; + .output_type + .get_pushed_or_read(txout_index, &self.readers.txout_index_to_output_type) + .ok_or(Error::Internal("Missing output_type"))?; - let typeindex = self + let type_index = self .vecs .outputs - .typeindex - .get_pushed_or_read(txoutindex, &self.readers.txoutindex_to_typeindex) - .ok_or(Error::Internal("Missing typeindex"))?; + .type_index + .get_pushed_or_read(txout_index, &self.readers.txout_index_to_type_index) + .ok_or(Error::Internal("Missing type_index"))?; Ok(( - txinindex, + txin_index, InputSource::PreviousBlock { vin, - txindex, + tx_index, outpoint, - outputtype, - typeindex, + output_type, + type_index, }, )) }, @@ -149,31 +149,31 @@ impl<'a> BlockProcessor<'a> { } pub(super) fn finalize_inputs( - first_txinindex: &mut PcoVec, + first_txin_index: &mut PcoVec, inputs: &mut InputsVecs, - addr_txindex_stores: &mut ByAddressType>, + addr_tx_index_stores: &mut ByAddressType>, addr_outpoint_stores: &mut ByAddressType>, txins: Vec<(TxInIndex, InputSource)>, same_block_output_info: &mut FxHashMap, ) -> Result<()> { - for (txinindex, input_source) in txins { - let (vin, txindex, outpoint, outputtype, typeindex) = match input_source { + for (txin_index, input_source) in txins { + let (vin, tx_index, outpoint, output_type, type_index) = match input_source { InputSource::PreviousBlock { vin, - txindex, + tx_index, outpoint, - outputtype, - typeindex, - } => (vin, txindex, outpoint, outputtype, typeindex), + output_type, + type_index, + } => (vin, tx_index, outpoint, output_type, type_index), InputSource::SameBlock { - txindex, + tx_index, vin, outpoint, } => { if outpoint.is_coinbase() { ( vin, - txindex, + tx_index, outpoint, OutputType::Unknown, TypeIndex::COINBASE, @@ -189,33 +189,33 @@ pub(super) fn finalize_inputs( "Same-block output not found" ); })?; - (vin, txindex, outpoint, info.outputtype, info.typeindex) + (vin, tx_index, outpoint, info.output_type, info.type_index) } } }; if vin.is_zero() { - first_txinindex.checked_push(txindex, txinindex)?; + first_txin_index.checked_push(tx_index, txin_index)?; } - inputs.txindex.checked_push(txinindex, txindex)?; - inputs.outpoint.checked_push(txinindex, outpoint)?; - inputs.outputtype.checked_push(txinindex, outputtype)?; - inputs.typeindex.checked_push(txinindex, typeindex)?; + inputs.tx_index.checked_push(txin_index, tx_index)?; + inputs.outpoint.checked_push(txin_index, outpoint)?; + inputs.output_type.checked_push(txin_index, output_type)?; + inputs.type_index.checked_push(txin_index, type_index)?; - if !outputtype.is_address() { + if !output_type.is_address() { continue; } - let addresstype = outputtype; - let addressindex = typeindex; + let address_type = output_type; + let address_index = type_index; - addr_txindex_stores - .get_mut_unwrap(addresstype) - .insert(AddressIndexTxIndex::from((addressindex, txindex)), Unit); + addr_tx_index_stores + .get_mut_unwrap(address_type) + .insert(AddressIndexTxIndex::from((address_index, tx_index)), Unit); addr_outpoint_stores - .get_mut_unwrap(addresstype) - .remove(AddressIndexOutPoint::from((addressindex, outpoint))); + .get_mut_unwrap(address_type) + .remove(AddressIndexOutPoint::from((address_index, outpoint))); } Ok(()) diff --git a/crates/brk_indexer/src/processor/txout.rs b/crates/brk_indexer/src/processor/txout.rs index 59a76a997..fd65163db 100644 --- a/crates/brk_indexer/src/processor/txout.rs +++ b/crates/brk_indexer/src/processor/txout.rs @@ -18,8 +18,8 @@ impl<'a> BlockProcessor<'a> { let height = self.height; let check_collisions = self.check_collisions; - let base_txindex = self.indexes.txindex; - let base_txoutindex = self.indexes.txoutindex; + let base_tx_index = self.indexes.tx_index; + let base_txout_index = self.indexes.txout_index; let total_outputs: usize = self.block.txdata.iter().map(|tx| tx.output.len()).sum(); let mut items = Vec::with_capacity(total_outputs); @@ -33,56 +33,56 @@ impl<'a> BlockProcessor<'a> { .into_par_iter() .enumerate() .map( - |(block_txoutindex, (block_txindex, vout, txout))| -> Result { - let txindex = base_txindex + block_txindex; - let txoutindex = base_txoutindex + TxOutIndex::from(block_txoutindex); + |(block_txout_index, (block_tx_index, vout, txout))| -> Result { + let tx_index = base_tx_index + block_tx_index; + let txout_index = base_txout_index + TxOutIndex::from(block_txout_index); let script = &txout.script_pubkey; - let outputtype = OutputType::from(script); + let output_type = OutputType::from(script); - if outputtype.is_not_address() { + if output_type.is_not_address() { return Ok(ProcessedOutput { - txoutindex, + txout_index, txout, - txindex, + tx_index, vout, - outputtype, + output_type, address_info: None, - existing_typeindex: None, + existing_type_index: None, }); } - let addresstype = outputtype; - let address_bytes = AddressBytes::try_from((script, addresstype)).unwrap(); + let address_type = output_type; + let address_bytes = AddressBytes::try_from((script, address_type)).unwrap(); let address_hash = AddressHash::from(&address_bytes); - let existing_typeindex = self + let existing_type_index = self .stores - .addresstype_to_addresshash_to_addressindex - .get_unwrap(addresstype) + .address_type_to_address_hash_to_address_index + .get_unwrap(address_type) .get(&address_hash)? .map(|v| *v) - .and_then(|typeindex_local| { - (typeindex_local < self.indexes.to_typeindex(addresstype)) - .then_some(typeindex_local) + .and_then(|type_index_local| { + (type_index_local < self.indexes.to_type_index(address_type)) + .then_some(type_index_local) }); - if check_collisions && let Some(typeindex) = existing_typeindex { + if check_collisions && let Some(type_index) = existing_type_index { let prev_addressbytes = self .vecs .addresses - .get_bytes_by_type(addresstype, typeindex, &self.readers.addressbytes) + .get_bytes_by_type(address_type, type_index, &self.readers.addressbytes) .ok_or(Error::Internal("Missing addressbytes"))?; if prev_addressbytes != address_bytes { error!( ?height, ?vout, - ?block_txindex, - ?addresstype, + ?block_tx_index, + ?address_type, ?prev_addressbytes, ?address_bytes, - ?typeindex, + ?type_index, "Address hash collision" ); return Err(Error::Internal("Address hash collision")); @@ -90,13 +90,13 @@ impl<'a> BlockProcessor<'a> { } Ok(ProcessedOutput { - txoutindex, + txout_index, txout, - txindex, + tx_index, vout, - outputtype, + output_type, address_info: Some((address_bytes, address_hash)), - existing_typeindex, + existing_type_index, }) }, ) @@ -107,125 +107,125 @@ impl<'a> BlockProcessor<'a> { #[allow(clippy::too_many_arguments)] pub(super) fn finalize_outputs( indexes: &mut Indexes, - first_txoutindex: &mut BytesVec, + first_txout_index: &mut BytesVec, outputs: &mut OutputsVecs, addresses: &mut AddressesVecs, scripts: &mut ScriptsVecs, addr_hash_stores: &mut ByAddressType>, - addr_txindex_stores: &mut ByAddressType>, + addr_tx_index_stores: &mut ByAddressType>, addr_outpoint_stores: &mut ByAddressType>, txouts: Vec, same_block_spent_outpoints: &FxHashSet, - already_added_addresshash: &mut ByAddressType>, + already_added_address_hash: &mut ByAddressType>, same_block_output_info: &mut FxHashMap, ) -> Result<()> { - already_added_addresshash + already_added_address_hash .values_mut() .for_each(|m| m.clear()); same_block_output_info.clear(); for ProcessedOutput { - txoutindex, + txout_index, txout, - txindex, + tx_index, vout, - outputtype, + output_type, address_info, - existing_typeindex, + existing_type_index, } in txouts { let sats = Sats::from(txout.value); if vout.is_zero() { - first_txoutindex.checked_push(txindex, txoutindex)?; + first_txout_index.checked_push(tx_index, txout_index)?; } - outputs.txindex.checked_push(txoutindex, txindex)?; + outputs.tx_index.checked_push(txout_index, tx_index)?; - let typeindex = if let Some(ti) = existing_typeindex { + let type_index = if let Some(ti) = existing_type_index { ti } else if let Some((address_bytes, address_hash)) = address_info { - let addresstype = outputtype; - if let Some(&ti) = already_added_addresshash - .get_unwrap(addresstype) + let address_type = output_type; + if let Some(&ti) = already_added_address_hash + .get_unwrap(address_type) .get(&address_hash) { ti } else { - let ti = indexes.increment_address_index(addresstype); + let ti = indexes.increment_address_index(address_type); - already_added_addresshash - .get_mut_unwrap(addresstype) + already_added_address_hash + .get_mut_unwrap(address_type) .insert(address_hash, ti); addr_hash_stores - .get_mut_unwrap(addresstype) + .get_mut_unwrap(address_type) .insert(address_hash, ti); addresses.push_bytes_if_needed(ti, address_bytes)?; ti } } else { - match outputtype { + match output_type { OutputType::P2MS => { scripts - .p2ms.to_txindex - .checked_push(indexes.p2msoutputindex, txindex)?; - indexes.p2msoutputindex.copy_then_increment() + .p2ms.to_tx_index + .checked_push(indexes.p2ms_output_index, tx_index)?; + indexes.p2ms_output_index.copy_then_increment() } OutputType::OpReturn => { scripts - .opreturn.to_txindex - .checked_push(indexes.opreturnindex, txindex)?; - indexes.opreturnindex.copy_then_increment() + .opreturn.to_tx_index + .checked_push(indexes.op_return_index, tx_index)?; + indexes.op_return_index.copy_then_increment() } OutputType::Empty => { scripts - .empty.to_txindex - .checked_push(indexes.emptyoutputindex, txindex)?; - indexes.emptyoutputindex.copy_then_increment() + .empty.to_tx_index + .checked_push(indexes.empty_output_index, tx_index)?; + indexes.empty_output_index.copy_then_increment() } OutputType::Unknown => { scripts - .unknown.to_txindex - .checked_push(indexes.unknownoutputindex, txindex)?; - indexes.unknownoutputindex.copy_then_increment() + .unknown.to_tx_index + .checked_push(indexes.unknown_output_index, tx_index)?; + indexes.unknown_output_index.copy_then_increment() } _ => unreachable!(), } }; - outputs.value.checked_push(txoutindex, sats)?; - outputs.outputtype.checked_push(txoutindex, outputtype)?; - outputs.typeindex.checked_push(txoutindex, typeindex)?; + outputs.value.checked_push(txout_index, sats)?; + outputs.output_type.checked_push(txout_index, output_type)?; + outputs.type_index.checked_push(txout_index, type_index)?; - if outputtype.is_unspendable() { + if output_type.is_unspendable() { continue; - } else if outputtype.is_address() { - let addresstype = outputtype; - let addressindex = typeindex; + } else if output_type.is_address() { + let address_type = output_type; + let address_index = type_index; - addr_txindex_stores - .get_mut_unwrap(addresstype) - .insert(AddressIndexTxIndex::from((addressindex, txindex)), Unit); + addr_tx_index_stores + .get_mut_unwrap(address_type) + .insert(AddressIndexTxIndex::from((address_index, tx_index)), Unit); } - let outpoint = OutPoint::new(txindex, vout); + let outpoint = OutPoint::new(tx_index, vout); if same_block_spent_outpoints.contains(&outpoint) { same_block_output_info.insert( outpoint, SameBlockOutputInfo { - outputtype, - typeindex, + output_type, + type_index, }, ); - } else if outputtype.is_address() { - let addresstype = outputtype; - let addressindex = typeindex; + } else if output_type.is_address() { + let address_type = output_type; + let address_index = type_index; addr_outpoint_stores - .get_mut_unwrap(addresstype) - .insert(AddressIndexOutPoint::from((addressindex, outpoint)), Unit); + .get_mut_unwrap(address_type) + .insert(AddressIndexOutPoint::from((address_index, outpoint)), Unit); } } diff --git a/crates/brk_indexer/src/processor/types.rs b/crates/brk_indexer/src/processor/types.rs index 4d5da9aed..2eed2c1b4 100644 --- a/crates/brk_indexer/src/processor/types.rs +++ b/crates/brk_indexer/src/processor/types.rs @@ -10,13 +10,13 @@ use rustc_hash::{FxHashMap, FxHashSet}; pub enum InputSource { PreviousBlock { vin: Vin, - txindex: TxIndex, + tx_index: TxIndex, outpoint: OutPoint, - outputtype: OutputType, - typeindex: TypeIndex, + output_type: OutputType, + type_index: TypeIndex, }, SameBlock { - txindex: TxIndex, + tx_index: TxIndex, vin: Vin, outpoint: OutPoint, }, @@ -24,26 +24,26 @@ pub enum InputSource { #[derive(Debug, Clone, Copy)] pub struct SameBlockOutputInfo { - pub outputtype: OutputType, - pub typeindex: TypeIndex, + pub output_type: OutputType, + pub type_index: TypeIndex, } pub struct ProcessedOutput<'a> { - pub txoutindex: TxOutIndex, + pub txout_index: TxOutIndex, pub txout: &'a TxOut, - pub txindex: TxIndex, + pub tx_index: TxIndex, pub vout: Vout, - pub outputtype: OutputType, + pub output_type: OutputType, pub address_info: Option<(AddressBytes, AddressHash)>, - pub existing_typeindex: Option, + pub existing_type_index: Option, } pub struct ComputedTx<'a> { - pub txindex: TxIndex, + pub tx_index: TxIndex, pub tx: &'a Transaction, pub txid: Txid, pub txid_prefix: TxidPrefix, - pub prev_txindex_opt: Option, + pub prev_tx_index_opt: Option, pub base_size: u32, pub total_size: u32, } diff --git a/crates/brk_indexer/src/readers.rs b/crates/brk_indexer/src/readers.rs index e015ba29b..d5e9a782c 100644 --- a/crates/brk_indexer/src/readers.rs +++ b/crates/brk_indexer/src/readers.rs @@ -21,9 +21,9 @@ pub struct AddressReaders { } impl AddressReaders { - pub fn script_pubkey(&self, outputtype: OutputType, typeindex: TypeIndex) -> ScriptBuf { - let idx = usize::from(typeindex); - let bytes: Option = match outputtype { + pub fn script_pubkey(&self, output_type: OutputType, type_index: TypeIndex) -> ScriptBuf { + let idx = usize::from(type_index); + let bytes: Option = match output_type { OutputType::P2PK65 => self.p2pk65.try_get(idx).map(Into::into), OutputType::P2PK33 => self.p2pk33.try_get(idx).map(Into::into), OutputType::P2PKH => self.p2pkh.try_get(idx).map(Into::into), @@ -44,9 +44,9 @@ impl AddressReaders { /// random access without recomputing `region.start() + HEADER_OFFSET` per read. pub struct Readers { pub txid: VecReader>, - pub txindex_to_first_txoutindex: VecReader>, - pub txoutindex_to_outputtype: VecReader>, - pub txoutindex_to_typeindex: VecReader>, + pub tx_index_to_first_txout_index: VecReader>, + pub txout_index_to_output_type: VecReader>, + pub txout_index_to_type_index: VecReader>, pub addressbytes: AddressReaders, } @@ -54,9 +54,9 @@ impl Readers { pub fn new(vecs: &Vecs) -> Self { Self { txid: vecs.transactions.txid.reader(), - txindex_to_first_txoutindex: vecs.transactions.first_txoutindex.reader(), - txoutindex_to_outputtype: vecs.outputs.outputtype.reader(), - txoutindex_to_typeindex: vecs.outputs.typeindex.reader(), + tx_index_to_first_txout_index: vecs.transactions.first_txout_index.reader(), + txout_index_to_output_type: vecs.outputs.output_type.reader(), + txout_index_to_type_index: vecs.outputs.type_index.reader(), addressbytes: vecs.addresses.address_readers(), } } diff --git a/crates/brk_indexer/src/stores.rs b/crates/brk_indexer/src/stores.rs index c16fdc0dd..8e27ff085 100644 --- a/crates/brk_indexer/src/stores.rs +++ b/crates/brk_indexer/src/stores.rs @@ -22,13 +22,13 @@ use super::Vecs; pub struct Stores { pub db: Database, - pub addresstype_to_addresshash_to_addressindex: ByAddressType>, - pub addresstype_to_addressindex_and_txindex: ByAddressType>, - pub addresstype_to_addressindex_and_unspentoutpoint: + pub address_type_to_address_hash_to_address_index: ByAddressType>, + pub address_type_to_address_index_and_tx_index: ByAddressType>, + pub address_type_to_address_index_and_unspent_outpoint: ByAddressType>, - pub blockhashprefix_to_height: Store, + pub blockhash_prefix_to_height: Store, pub height_to_coinbase_tag: Store, - pub txidprefix_to_txindex: Store, + pub txid_prefix_to_tx_index: Store, } impl Stores { @@ -53,7 +53,7 @@ impl Stores { let database_ref = &database; - let create_addresshash_to_addressindex_store = |index| { + let create_address_hash_to_address_index_store = |index| { Store::import( database_ref, path, @@ -64,7 +64,7 @@ impl Stores { ) }; - let create_addressindex_to_txindex_store = |index| { + let create_address_index_to_tx_index_store = |index| { Store::import( database_ref, path, @@ -75,7 +75,7 @@ impl Stores { ) }; - let create_addressindex_to_unspentoutpoint_store = |index| { + let create_address_index_to_unspent_outpoint_store = |index| { Store::import( database_ref, path, @@ -97,27 +97,27 @@ impl Stores { Mode::PushOnly, Kind::Sequential, )?, - addresstype_to_addresshash_to_addressindex: ByAddressType::new_with_index( - create_addresshash_to_addressindex_store, + address_type_to_address_hash_to_address_index: ByAddressType::new_with_index( + create_address_hash_to_address_index_store, )?, - addresstype_to_addressindex_and_txindex: ByAddressType::new_with_index( - create_addressindex_to_txindex_store, + address_type_to_address_index_and_tx_index: ByAddressType::new_with_index( + create_address_index_to_tx_index_store, )?, - addresstype_to_addressindex_and_unspentoutpoint: ByAddressType::new_with_index( - create_addressindex_to_unspentoutpoint_store, + address_type_to_address_index_and_unspent_outpoint: ByAddressType::new_with_index( + create_address_index_to_unspent_outpoint_store, )?, - blockhashprefix_to_height: Store::import( + blockhash_prefix_to_height: Store::import( database_ref, path, - "blockhashprefix_to_height", + "blockhash_prefix_to_height", version, Mode::PushOnly, Kind::Random, )?, - txidprefix_to_txindex: Store::import_cached( + txid_prefix_to_tx_index: Store::import_cached( database_ref, path, - "txidprefix_to_txindex", + "txid_prefix_to_tx_index", version, Mode::PushOnly, Kind::Recent, @@ -135,23 +135,23 @@ impl Stores { fn iter_any(&self) -> impl Iterator { [ - &self.blockhashprefix_to_height as &dyn AnyStore, + &self.blockhash_prefix_to_height as &dyn AnyStore, &self.height_to_coinbase_tag, - &self.txidprefix_to_txindex, + &self.txid_prefix_to_tx_index, ] .into_iter() .chain( - self.addresstype_to_addresshash_to_addressindex + self.address_type_to_address_hash_to_address_index .values() .map(|s| s as &dyn AnyStore), ) .chain( - self.addresstype_to_addressindex_and_txindex + self.address_type_to_address_index_and_tx_index .values() .map(|s| s as &dyn AnyStore), ) .chain( - self.addresstype_to_addressindex_and_unspentoutpoint + self.address_type_to_address_index_and_unspent_outpoint .values() .map(|s| s as &dyn AnyStore), ) @@ -159,23 +159,23 @@ impl Stores { fn par_iter_any_mut(&mut self) -> impl ParallelIterator { [ - &mut self.blockhashprefix_to_height as &mut dyn AnyStore, + &mut self.blockhash_prefix_to_height as &mut dyn AnyStore, &mut self.height_to_coinbase_tag, - &mut self.txidprefix_to_txindex, + &mut self.txid_prefix_to_tx_index, ] .into_par_iter() .chain( - self.addresstype_to_addresshash_to_addressindex + self.address_type_to_address_hash_to_address_index .par_values_mut() .map(|s| s as &mut dyn AnyStore), ) .chain( - self.addresstype_to_addressindex_and_txindex + self.address_type_to_address_index_and_tx_index .par_values_mut() .map(|s| s as &mut dyn AnyStore), ) .chain( - self.addresstype_to_addressindex_and_unspentoutpoint + self.address_type_to_address_index_and_unspent_outpoint .par_values_mut() .map(|s| s as &mut dyn AnyStore), ) @@ -204,8 +204,8 @@ impl Stores { } debug_assert!(starting_indexes.height != Height::ZERO); - debug_assert!(starting_indexes.txindex != TxIndex::ZERO); - debug_assert!(starting_indexes.txoutindex != TxOutIndex::ZERO); + debug_assert!(starting_indexes.tx_index != TxIndex::ZERO); + debug_assert!(starting_indexes.txout_index != TxOutIndex::ZERO); self.rollback_block_metadata(vecs, starting_indexes)?; self.rollback_txids(vecs, starting_indexes); @@ -220,19 +220,19 @@ impl Stores { } fn is_empty(&self) -> Result { - Ok(self.blockhashprefix_to_height.is_empty()? - && self.txidprefix_to_txindex.is_empty()? + Ok(self.blockhash_prefix_to_height.is_empty()? + && self.txid_prefix_to_tx_index.is_empty()? && self.height_to_coinbase_tag.is_empty()? && self - .addresstype_to_addresshash_to_addressindex + .address_type_to_address_hash_to_address_index .values() .try_fold(true, |acc, s| s.is_empty().map(|empty| acc && empty))? && self - .addresstype_to_addressindex_and_txindex + .address_type_to_address_index_and_tx_index .values() .try_fold(true, |acc, s| s.is_empty().map(|empty| acc && empty))? && self - .addresstype_to_addressindex_and_unspentoutpoint + .address_type_to_address_index_and_unspent_outpoint .values() .try_fold(true, |acc, s| s.is_empty().map(|empty| acc && empty))?) } @@ -246,7 +246,7 @@ impl Stores { starting_indexes.height.to_usize(), vecs.blocks.blockhash.len(), |blockhash| { - self.blockhashprefix_to_height + self.blockhash_prefix_to_height .remove(BlockHashPrefix::from(blockhash)); }, ); @@ -259,7 +259,7 @@ impl Stores { for address_type in OutputType::ADDRESS_TYPES { for hash in vecs.iter_address_hashes_from(address_type, starting_indexes.height)? { - self.addresstype_to_addresshash_to_addressindex + self.address_type_to_address_hash_to_address_index .get_mut_unwrap(address_type) .remove(hash); } @@ -269,121 +269,121 @@ impl Stores { } fn rollback_txids(&mut self, vecs: &mut Vecs, starting_indexes: &Indexes) { - let start = starting_indexes.txindex.to_usize(); + let start = starting_indexes.tx_index.to_usize(); let end = vecs.transactions.txid.len(); let mut current_index = start; vecs.transactions .txid .for_each_range_at(start, end, |txid| { - let txindex = TxIndex::from(current_index); - let txidprefix = TxidPrefix::from(&txid); + let tx_index = TxIndex::from(current_index); + let txid_prefix = TxidPrefix::from(&txid); let is_known_dup = DUPLICATE_TXID_PREFIXES .iter() - .any(|(dup_prefix, dup_txindex)| { - txindex == *dup_txindex && txidprefix == *dup_prefix + .any(|(dup_prefix, dup_tx_index)| { + tx_index == *dup_tx_index && txid_prefix == *dup_prefix }); if !is_known_dup { - self.txidprefix_to_txindex.remove(txidprefix); + self.txid_prefix_to_tx_index.remove(txid_prefix); } current_index += 1; }); - self.txidprefix_to_txindex.clear_caches(); + self.txid_prefix_to_tx_index.clear_caches(); } fn rollback_outputs_and_inputs(&mut self, vecs: &mut Vecs, starting_indexes: &Indexes) { - let txindex_to_first_txoutindex_reader = vecs.transactions.first_txoutindex.reader(); - let txoutindex_to_outputtype_reader = vecs.outputs.outputtype.reader(); - let txoutindex_to_typeindex_reader = vecs.outputs.typeindex.reader(); + let tx_index_to_first_txout_index_reader = vecs.transactions.first_txout_index.reader(); + let txout_index_to_output_type_reader = vecs.outputs.output_type.reader(); + let txout_index_to_type_index_reader = vecs.outputs.type_index.reader(); - let mut addressindex_txindex_to_remove: FxHashSet<(OutputType, TypeIndex, TxIndex)> = + let mut address_index_tx_index_to_remove: FxHashSet<(OutputType, TypeIndex, TxIndex)> = FxHashSet::default(); - let rollback_start = starting_indexes.txoutindex.to_usize(); - let rollback_end = vecs.outputs.outputtype.len(); + let rollback_start = starting_indexes.txout_index.to_usize(); + let rollback_end = vecs.outputs.output_type.len(); - let txindexes: Vec = vecs + let tx_indexes: Vec = vecs .outputs - .txindex + .tx_index .collect_range_at(rollback_start, rollback_end); - for (i, txoutindex) in (rollback_start..rollback_end).enumerate() { - let outputtype = txoutindex_to_outputtype_reader.get(txoutindex); - if !outputtype.is_address() { + for (i, txout_index) in (rollback_start..rollback_end).enumerate() { + let output_type = txout_index_to_output_type_reader.get(txout_index); + if !output_type.is_address() { continue; } - let addresstype = outputtype; - let addressindex = txoutindex_to_typeindex_reader.get(txoutindex); - let txindex = txindexes[i]; + let address_type = output_type; + let address_index = txout_index_to_type_index_reader.get(txout_index); + let tx_index = tx_indexes[i]; - addressindex_txindex_to_remove.insert((addresstype, addressindex, txindex)); + address_index_tx_index_to_remove.insert((address_type, address_index, tx_index)); let vout = Vout::from( - txoutindex - - txindex_to_first_txoutindex_reader - .get(txindex.to_usize()) + txout_index + - tx_index_to_first_txout_index_reader + .get(tx_index.to_usize()) .to_usize(), ); - let outpoint = OutPoint::new(txindex, vout); + let outpoint = OutPoint::new(tx_index, vout); - self.addresstype_to_addressindex_and_unspentoutpoint - .get_mut_unwrap(addresstype) - .remove(AddressIndexOutPoint::from((addressindex, outpoint))); + self.address_type_to_address_index_and_unspent_outpoint + .get_mut_unwrap(address_type) + .remove(AddressIndexOutPoint::from((address_index, outpoint))); } - let start = starting_indexes.txinindex.to_usize(); + let start = starting_indexes.txin_index.to_usize(); let end = vecs.inputs.outpoint.len(); let outpoints: Vec = vecs.inputs.outpoint.collect_range_at(start, end); - let spending_txindexes: Vec = vecs.inputs.txindex.collect_range_at(start, end); + let spending_tx_indexes: Vec = vecs.inputs.tx_index.collect_range_at(start, end); let outputs_to_unspend: Vec<_> = outpoints .into_iter() - .zip(spending_txindexes) - .filter_map(|(outpoint, spending_txindex)| { + .zip(spending_tx_indexes) + .filter_map(|(outpoint, spending_tx_index)| { if outpoint.is_coinbase() { return None; } - let output_txindex = outpoint.txindex(); + let output_tx_index = outpoint.tx_index(); let vout = outpoint.vout(); - let txoutindex = - txindex_to_first_txoutindex_reader.get(output_txindex.to_usize()) + vout; + let txout_index = + tx_index_to_first_txout_index_reader.get(output_tx_index.to_usize()) + vout; - if txoutindex < starting_indexes.txoutindex { - let outputtype = txoutindex_to_outputtype_reader.get(txoutindex.to_usize()); - let typeindex = txoutindex_to_typeindex_reader.get(txoutindex.to_usize()); - Some((outpoint, outputtype, typeindex, spending_txindex)) + if txout_index < starting_indexes.txout_index { + let output_type = txout_index_to_output_type_reader.get(txout_index.to_usize()); + let type_index = txout_index_to_type_index_reader.get(txout_index.to_usize()); + Some((outpoint, output_type, type_index, spending_tx_index)) } else { None } }) .collect(); - for (outpoint, outputtype, typeindex, spending_txindex) in outputs_to_unspend { - if outputtype.is_address() { - let addresstype = outputtype; - let addressindex = typeindex; + for (outpoint, output_type, type_index, spending_tx_index) in outputs_to_unspend { + if output_type.is_address() { + let address_type = output_type; + let address_index = type_index; - addressindex_txindex_to_remove.insert(( - addresstype, - addressindex, - spending_txindex, + address_index_tx_index_to_remove.insert(( + address_type, + address_index, + spending_tx_index, )); - self.addresstype_to_addressindex_and_unspentoutpoint - .get_mut_unwrap(addresstype) - .insert(AddressIndexOutPoint::from((addressindex, outpoint)), Unit); + self.address_type_to_address_index_and_unspent_outpoint + .get_mut_unwrap(address_type) + .insert(AddressIndexOutPoint::from((address_index, outpoint)), Unit); } } - for (addresstype, addressindex, txindex) in addressindex_txindex_to_remove { - self.addresstype_to_addressindex_and_txindex - .get_mut_unwrap(addresstype) - .remove(AddressIndexTxIndex::from((addressindex, txindex))); + for (address_type, address_index, tx_index) in address_index_tx_index_to_remove { + self.address_type_to_address_index_and_tx_index + .get_mut_unwrap(address_type) + .remove(AddressIndexTxIndex::from((address_index, tx_index))); } } diff --git a/crates/brk_indexer/src/vecs/addresses.rs b/crates/brk_indexer/src/vecs/addresses.rs index 12c0d0c8c..e42b9b246 100644 --- a/crates/brk_indexer/src/vecs/addresses.rs +++ b/crates/brk_indexer/src/vecs/addresses.rs @@ -38,49 +38,49 @@ pub struct AddressesVecs { impl AddressesVecs { pub fn forced_import(db: &Database, version: Version) -> Result { let ( - first_p2pk65addressindex, - first_p2pk33addressindex, - first_p2pkhaddressindex, - first_p2shaddressindex, - first_p2wpkhaddressindex, - first_p2wshaddressindex, - first_p2traddressindex, - first_p2aaddressindex, - p2pk65bytes, - p2pk33bytes, - p2pkhbytes, - p2shbytes, - p2wpkhbytes, - p2wshbytes, - p2trbytes, - p2abytes, + first_p2pk65_address_index, + first_p2pk33_address_index, + first_p2pkh_address_index, + first_p2sh_address_index, + first_p2wpkh_address_index, + first_p2wsh_address_index, + first_p2tr_address_index, + first_p2a_address_index, + p2pk65_bytes, + p2pk33_bytes, + p2pkh_bytes, + p2sh_bytes, + p2wpkh_bytes, + p2wsh_bytes, + p2tr_bytes, + p2a_bytes, ) = parallel_import! { - first_p2pk65addressindex = PcoVec::forced_import(db, "first_p2pk65addressindex", version), - first_p2pk33addressindex = PcoVec::forced_import(db, "first_p2pk33addressindex", version), - first_p2pkhaddressindex = PcoVec::forced_import(db, "first_p2pkhaddressindex", version), - first_p2shaddressindex = PcoVec::forced_import(db, "first_p2shaddressindex", version), - first_p2wpkhaddressindex = PcoVec::forced_import(db, "first_p2wpkhaddressindex", version), - first_p2wshaddressindex = PcoVec::forced_import(db, "first_p2wshaddressindex", version), - first_p2traddressindex = PcoVec::forced_import(db, "first_p2traddressindex", version), - first_p2aaddressindex = PcoVec::forced_import(db, "first_p2aaddressindex", version), - p2pk65bytes = BytesVec::forced_import(db, "p2pk65bytes", version), - p2pk33bytes = BytesVec::forced_import(db, "p2pk33bytes", version), - p2pkhbytes = BytesVec::forced_import(db, "p2pkhbytes", version), - p2shbytes = BytesVec::forced_import(db, "p2shbytes", version), - p2wpkhbytes = BytesVec::forced_import(db, "p2wpkhbytes", version), - p2wshbytes = BytesVec::forced_import(db, "p2wshbytes", version), - p2trbytes = BytesVec::forced_import(db, "p2trbytes", version), - p2abytes = BytesVec::forced_import(db, "p2abytes", version), + first_p2pk65_address_index = PcoVec::forced_import(db, "first_p2pk65_address_index", version), + first_p2pk33_address_index = PcoVec::forced_import(db, "first_p2pk33_address_index", version), + first_p2pkh_address_index = PcoVec::forced_import(db, "first_p2pkh_address_index", version), + first_p2sh_address_index = PcoVec::forced_import(db, "first_p2sh_address_index", version), + first_p2wpkh_address_index = PcoVec::forced_import(db, "first_p2wpkh_address_index", version), + first_p2wsh_address_index = PcoVec::forced_import(db, "first_p2wsh_address_index", version), + first_p2tr_address_index = PcoVec::forced_import(db, "first_p2tr_address_index", version), + first_p2a_address_index = PcoVec::forced_import(db, "first_p2a_address_index", version), + p2pk65_bytes = BytesVec::forced_import(db, "p2pk65_bytes", version), + p2pk33_bytes = BytesVec::forced_import(db, "p2pk33_bytes", version), + p2pkh_bytes = BytesVec::forced_import(db, "p2pkh_bytes", version), + p2sh_bytes = BytesVec::forced_import(db, "p2sh_bytes", version), + p2wpkh_bytes = BytesVec::forced_import(db, "p2wpkh_bytes", version), + p2wsh_bytes = BytesVec::forced_import(db, "p2wsh_bytes", version), + p2tr_bytes = BytesVec::forced_import(db, "p2tr_bytes", version), + p2a_bytes = BytesVec::forced_import(db, "p2a_bytes", version), }; Ok(Self { - p2pk65: AddressTypeVecs { first_index: first_p2pk65addressindex, bytes: p2pk65bytes }, - p2pk33: AddressTypeVecs { first_index: first_p2pk33addressindex, bytes: p2pk33bytes }, - p2pkh: AddressTypeVecs { first_index: first_p2pkhaddressindex, bytes: p2pkhbytes }, - p2sh: AddressTypeVecs { first_index: first_p2shaddressindex, bytes: p2shbytes }, - p2wpkh: AddressTypeVecs { first_index: first_p2wpkhaddressindex, bytes: p2wpkhbytes }, - p2wsh: AddressTypeVecs { first_index: first_p2wshaddressindex, bytes: p2wshbytes }, - p2tr: AddressTypeVecs { first_index: first_p2traddressindex, bytes: p2trbytes }, - p2a: AddressTypeVecs { first_index: first_p2aaddressindex, bytes: p2abytes }, + p2pk65: AddressTypeVecs { first_index: first_p2pk65_address_index, bytes: p2pk65_bytes }, + p2pk33: AddressTypeVecs { first_index: first_p2pk33_address_index, bytes: p2pk33_bytes }, + p2pkh: AddressTypeVecs { first_index: first_p2pkh_address_index, bytes: p2pkh_bytes }, + p2sh: AddressTypeVecs { first_index: first_p2sh_address_index, bytes: p2sh_bytes }, + p2wpkh: AddressTypeVecs { first_index: first_p2wpkh_address_index, bytes: p2wpkh_bytes }, + p2wsh: AddressTypeVecs { first_index: first_p2wsh_address_index, bytes: p2wsh_bytes }, + p2tr: AddressTypeVecs { first_index: first_p2tr_address_index, bytes: p2tr_bytes }, + p2a: AddressTypeVecs { first_index: first_p2a_address_index, bytes: p2a_bytes }, }) } @@ -88,14 +88,14 @@ impl AddressesVecs { pub fn truncate( &mut self, height: Height, - p2pk65addressindex: P2PK65AddressIndex, - p2pk33addressindex: P2PK33AddressIndex, - p2pkhaddressindex: P2PKHAddressIndex, - p2shaddressindex: P2SHAddressIndex, - p2wpkhaddressindex: P2WPKHAddressIndex, - p2wshaddressindex: P2WSHAddressIndex, - p2traddressindex: P2TRAddressIndex, - p2aaddressindex: P2AAddressIndex, + p2pk65_address_index: P2PK65AddressIndex, + p2pk33_address_index: P2PK33AddressIndex, + p2pkh_address_index: P2PKHAddressIndex, + p2sh_address_index: P2SHAddressIndex, + p2wpkh_address_index: P2WPKHAddressIndex, + p2wsh_address_index: P2WSHAddressIndex, + p2tr_address_index: P2TRAddressIndex, + p2a_address_index: P2AAddressIndex, stamp: Stamp, ) -> Result<()> { self.p2pk65.first_index @@ -115,21 +115,21 @@ impl AddressesVecs { self.p2a.first_index .truncate_if_needed_with_stamp(height, stamp)?; self.p2pk65.bytes - .truncate_if_needed_with_stamp(p2pk65addressindex, stamp)?; + .truncate_if_needed_with_stamp(p2pk65_address_index, stamp)?; self.p2pk33.bytes - .truncate_if_needed_with_stamp(p2pk33addressindex, stamp)?; + .truncate_if_needed_with_stamp(p2pk33_address_index, stamp)?; self.p2pkh.bytes - .truncate_if_needed_with_stamp(p2pkhaddressindex, stamp)?; + .truncate_if_needed_with_stamp(p2pkh_address_index, stamp)?; self.p2sh.bytes - .truncate_if_needed_with_stamp(p2shaddressindex, stamp)?; + .truncate_if_needed_with_stamp(p2sh_address_index, stamp)?; self.p2wpkh.bytes - .truncate_if_needed_with_stamp(p2wpkhaddressindex, stamp)?; + .truncate_if_needed_with_stamp(p2wpkh_address_index, stamp)?; self.p2wsh.bytes - .truncate_if_needed_with_stamp(p2wshaddressindex, stamp)?; + .truncate_if_needed_with_stamp(p2wsh_address_index, stamp)?; self.p2tr.bytes - .truncate_if_needed_with_stamp(p2traddressindex, stamp)?; + .truncate_if_needed_with_stamp(p2tr_address_index, stamp)?; self.p2a.bytes - .truncate_if_needed_with_stamp(p2aaddressindex, stamp)?; + .truncate_if_needed_with_stamp(p2a_address_index, stamp)?; Ok(()) } @@ -159,42 +159,42 @@ impl AddressesVecs { /// Returns None if the index doesn't exist yet. pub fn get_bytes_by_type( &self, - addresstype: OutputType, - typeindex: TypeIndex, + address_type: OutputType, + type_index: TypeIndex, readers: &AddressReaders, ) -> Option { - match addresstype { + match address_type { OutputType::P2PK65 => self .p2pk65.bytes - .get_pushed_or_read(typeindex.into(), &readers.p2pk65) + .get_pushed_or_read(type_index.into(), &readers.p2pk65) .map(AddressBytes::from), OutputType::P2PK33 => self .p2pk33.bytes - .get_pushed_or_read(typeindex.into(), &readers.p2pk33) + .get_pushed_or_read(type_index.into(), &readers.p2pk33) .map(AddressBytes::from), OutputType::P2PKH => self .p2pkh.bytes - .get_pushed_or_read(typeindex.into(), &readers.p2pkh) + .get_pushed_or_read(type_index.into(), &readers.p2pkh) .map(AddressBytes::from), OutputType::P2SH => self .p2sh.bytes - .get_pushed_or_read(typeindex.into(), &readers.p2sh) + .get_pushed_or_read(type_index.into(), &readers.p2sh) .map(AddressBytes::from), OutputType::P2WPKH => self .p2wpkh.bytes - .get_pushed_or_read(typeindex.into(), &readers.p2wpkh) + .get_pushed_or_read(type_index.into(), &readers.p2wpkh) .map(AddressBytes::from), OutputType::P2WSH => self .p2wsh.bytes - .get_pushed_or_read(typeindex.into(), &readers.p2wsh) + .get_pushed_or_read(type_index.into(), &readers.p2wsh) .map(AddressBytes::from), OutputType::P2TR => self .p2tr.bytes - .get_pushed_or_read(typeindex.into(), &readers.p2tr) + .get_pushed_or_read(type_index.into(), &readers.p2tr) .map(AddressBytes::from), OutputType::P2A => self .p2a.bytes - .get_pushed_or_read(typeindex.into(), &readers.p2a) + .get_pushed_or_read(type_index.into(), &readers.p2a) .map(AddressBytes::from), _ => unreachable!("get_bytes_by_type called with non-address type"), } diff --git a/crates/brk_indexer/src/vecs/inputs.rs b/crates/brk_indexer/src/vecs/inputs.rs index a525de94a..8058f3da5 100644 --- a/crates/brk_indexer/src/vecs/inputs.rs +++ b/crates/brk_indexer/src/vecs/inputs.rs @@ -8,52 +8,52 @@ use crate::parallel_import; #[derive(Traversable)] pub struct InputsVecs { - pub first_txinindex: M::Stored>, + pub first_txin_index: M::Stored>, pub outpoint: M::Stored>, - pub txindex: M::Stored>, - pub outputtype: M::Stored>, - pub typeindex: M::Stored>, + pub tx_index: M::Stored>, + pub output_type: M::Stored>, + pub type_index: M::Stored>, } impl InputsVecs { pub fn forced_import(db: &Database, version: Version) -> Result { - let (first_txinindex, outpoint, txindex, outputtype, typeindex) = parallel_import! { - first_txinindex = PcoVec::forced_import(db, "first_txinindex", version), + let (first_txin_index, outpoint, tx_index, output_type, type_index) = parallel_import! { + first_txin_index = PcoVec::forced_import(db, "first_txin_index", version), outpoint = PcoVec::forced_import(db, "outpoint", version), - txindex = PcoVec::forced_import(db, "txindex", version), - outputtype = PcoVec::forced_import(db, "outputtype", version), - typeindex = PcoVec::forced_import(db, "typeindex", version), + tx_index = PcoVec::forced_import(db, "tx_index", version), + output_type = PcoVec::forced_import(db, "output_type", version), + type_index = PcoVec::forced_import(db, "type_index", version), }; Ok(Self { - first_txinindex, + first_txin_index, outpoint, - txindex, - outputtype, - typeindex, + tx_index, + output_type, + type_index, }) } - pub fn truncate(&mut self, height: Height, txinindex: TxInIndex, stamp: Stamp) -> Result<()> { - self.first_txinindex + pub fn truncate(&mut self, height: Height, txin_index: TxInIndex, stamp: Stamp) -> Result<()> { + self.first_txin_index .truncate_if_needed_with_stamp(height, stamp)?; self.outpoint - .truncate_if_needed_with_stamp(txinindex, stamp)?; - self.txindex - .truncate_if_needed_with_stamp(txinindex, stamp)?; - self.outputtype - .truncate_if_needed_with_stamp(txinindex, stamp)?; - self.typeindex - .truncate_if_needed_with_stamp(txinindex, stamp)?; + .truncate_if_needed_with_stamp(txin_index, stamp)?; + self.tx_index + .truncate_if_needed_with_stamp(txin_index, stamp)?; + self.output_type + .truncate_if_needed_with_stamp(txin_index, stamp)?; + self.type_index + .truncate_if_needed_with_stamp(txin_index, stamp)?; Ok(()) } pub fn par_iter_mut_any(&mut self) -> impl ParallelIterator { [ - &mut self.first_txinindex as &mut dyn AnyStoredVec, + &mut self.first_txin_index as &mut dyn AnyStoredVec, &mut self.outpoint, - &mut self.txindex, - &mut self.outputtype, - &mut self.typeindex, + &mut self.tx_index, + &mut self.output_type, + &mut self.type_index, ] .into_par_iter() } diff --git a/crates/brk_indexer/src/vecs/mod.rs b/crates/brk_indexer/src/vecs/mod.rs index 2abf8f997..a7f3a88bb 100644 --- a/crates/brk_indexer/src/vecs/mod.rs +++ b/crates/brk_indexer/src/vecs/mod.rs @@ -87,33 +87,33 @@ impl Vecs { self.blocks.truncate(starting_indexes.height, stamp)?; self.transactions - .truncate(starting_indexes.height, starting_indexes.txindex, stamp)?; + .truncate(starting_indexes.height, starting_indexes.tx_index, stamp)?; self.inputs - .truncate(starting_indexes.height, starting_indexes.txinindex, stamp)?; + .truncate(starting_indexes.height, starting_indexes.txin_index, stamp)?; self.outputs - .truncate(starting_indexes.height, starting_indexes.txoutindex, stamp)?; + .truncate(starting_indexes.height, starting_indexes.txout_index, stamp)?; self.addresses.truncate( starting_indexes.height, - starting_indexes.p2pk65addressindex, - starting_indexes.p2pk33addressindex, - starting_indexes.p2pkhaddressindex, - starting_indexes.p2shaddressindex, - starting_indexes.p2wpkhaddressindex, - starting_indexes.p2wshaddressindex, - starting_indexes.p2traddressindex, - starting_indexes.p2aaddressindex, + starting_indexes.p2pk65_address_index, + starting_indexes.p2pk33_address_index, + starting_indexes.p2pkh_address_index, + starting_indexes.p2sh_address_index, + starting_indexes.p2wpkh_address_index, + starting_indexes.p2wsh_address_index, + starting_indexes.p2tr_address_index, + starting_indexes.p2a_address_index, stamp, )?; self.scripts.truncate( starting_indexes.height, - starting_indexes.emptyoutputindex, - starting_indexes.opreturnindex, - starting_indexes.p2msoutputindex, - starting_indexes.unknownoutputindex, + starting_indexes.empty_output_index, + starting_indexes.op_return_index, + starting_indexes.p2ms_output_index, + starting_indexes.unknown_output_index, stamp, )?; diff --git a/crates/brk_indexer/src/vecs/outputs.rs b/crates/brk_indexer/src/vecs/outputs.rs index 57b983f4e..fcc2d93e2 100644 --- a/crates/brk_indexer/src/vecs/outputs.rs +++ b/crates/brk_indexer/src/vecs/outputs.rs @@ -10,52 +10,52 @@ use crate::parallel_import; #[derive(Traversable)] pub struct OutputsVecs { - pub first_txoutindex: M::Stored>, + pub first_txout_index: M::Stored>, pub value: M::Stored>, - pub outputtype: M::Stored>, - pub typeindex: M::Stored>, - pub txindex: M::Stored>, + pub output_type: M::Stored>, + pub type_index: M::Stored>, + pub tx_index: M::Stored>, } impl OutputsVecs { pub fn forced_import(db: &Database, version: Version) -> Result { - let (first_txoutindex, value, outputtype, typeindex, txindex) = parallel_import! { - first_txoutindex = PcoVec::forced_import(db, "first_txoutindex", version), + let (first_txout_index, value, output_type, type_index, tx_index) = parallel_import! { + first_txout_index = PcoVec::forced_import(db, "first_txout_index", version), value = BytesVec::forced_import(db, "value", version), - outputtype = BytesVec::forced_import(db, "outputtype", version), - typeindex = BytesVec::forced_import(db, "typeindex", version), - txindex = PcoVec::forced_import(db, "txindex", version), + output_type = BytesVec::forced_import(db, "output_type", version), + type_index = BytesVec::forced_import(db, "type_index", version), + tx_index = PcoVec::forced_import(db, "tx_index", version), }; Ok(Self { - first_txoutindex, + first_txout_index, value, - outputtype, - typeindex, - txindex, + output_type, + type_index, + tx_index, }) } - pub fn truncate(&mut self, height: Height, txoutindex: TxOutIndex, stamp: Stamp) -> Result<()> { - self.first_txoutindex + pub fn truncate(&mut self, height: Height, txout_index: TxOutIndex, stamp: Stamp) -> Result<()> { + self.first_txout_index .truncate_if_needed_with_stamp(height, stamp)?; self.value - .truncate_if_needed_with_stamp(txoutindex, stamp)?; - self.outputtype - .truncate_if_needed_with_stamp(txoutindex, stamp)?; - self.typeindex - .truncate_if_needed_with_stamp(txoutindex, stamp)?; - self.txindex - .truncate_if_needed_with_stamp(txoutindex, stamp)?; + .truncate_if_needed_with_stamp(txout_index, stamp)?; + self.output_type + .truncate_if_needed_with_stamp(txout_index, stamp)?; + self.type_index + .truncate_if_needed_with_stamp(txout_index, stamp)?; + self.tx_index + .truncate_if_needed_with_stamp(txout_index, stamp)?; Ok(()) } pub fn par_iter_mut_any(&mut self) -> impl ParallelIterator { [ - &mut self.first_txoutindex as &mut dyn AnyStoredVec, + &mut self.first_txout_index as &mut dyn AnyStoredVec, &mut self.value, - &mut self.outputtype, - &mut self.typeindex, - &mut self.txindex, + &mut self.output_type, + &mut self.type_index, + &mut self.tx_index, ] .into_par_iter() } diff --git a/crates/brk_indexer/src/vecs/scripts.rs b/crates/brk_indexer/src/vecs/scripts.rs index e74140070..b7c7042b9 100644 --- a/crates/brk_indexer/src/vecs/scripts.rs +++ b/crates/brk_indexer/src/vecs/scripts.rs @@ -16,7 +16,7 @@ use crate::parallel_import; #[derive(Traversable)] pub struct ScriptTypeVecs { pub first_index: M::Stored>, - pub to_txindex: M::Stored>, + pub to_tx_index: M::Stored>, } #[derive(Traversable)] @@ -30,39 +30,39 @@ pub struct ScriptsVecs { impl ScriptsVecs { pub fn forced_import(db: &Database, version: Version) -> Result { let ( - first_emptyoutputindex, - first_opreturnindex, - first_p2msoutputindex, - first_unknownoutputindex, - emptyoutputindex_to_txindex, - opreturnindex_to_txindex, - p2msoutputindex_to_txindex, - unknownoutputindex_to_txindex, + first_empty_output_index, + first_op_return_index, + first_p2ms_output_index, + first_unknown_output_index, + empty_output_index_to_tx_index, + op_return_index_to_tx_index, + p2ms_output_index_to_tx_index, + unknown_output_index_to_tx_index, ) = parallel_import! { - first_emptyoutputindex = PcoVec::forced_import(db, "first_emptyoutputindex", version), - first_opreturnindex = PcoVec::forced_import(db, "first_opreturnindex", version), - first_p2msoutputindex = PcoVec::forced_import(db, "first_p2msoutputindex", version), - first_unknownoutputindex = PcoVec::forced_import(db, "first_unknownoutputindex", version), - emptyoutputindex_to_txindex = PcoVec::forced_import(db, "txindex", version), - opreturnindex_to_txindex = PcoVec::forced_import(db, "txindex", version), - p2msoutputindex_to_txindex = PcoVec::forced_import(db, "txindex", version), - unknownoutputindex_to_txindex = PcoVec::forced_import(db, "txindex", version), + first_empty_output_index = PcoVec::forced_import(db, "first_empty_output_index", version), + first_op_return_index = PcoVec::forced_import(db, "first_op_return_index", version), + first_p2ms_output_index = PcoVec::forced_import(db, "first_p2ms_output_index", version), + first_unknown_output_index = PcoVec::forced_import(db, "first_unknown_output_index", version), + empty_output_index_to_tx_index = PcoVec::forced_import(db, "tx_index", version), + op_return_index_to_tx_index = PcoVec::forced_import(db, "tx_index", version), + p2ms_output_index_to_tx_index = PcoVec::forced_import(db, "tx_index", version), + unknown_output_index_to_tx_index = PcoVec::forced_import(db, "tx_index", version), }; Ok(Self { - empty: ScriptTypeVecs { first_index: first_emptyoutputindex, to_txindex: emptyoutputindex_to_txindex }, - opreturn: ScriptTypeVecs { first_index: first_opreturnindex, to_txindex: opreturnindex_to_txindex }, - p2ms: ScriptTypeVecs { first_index: first_p2msoutputindex, to_txindex: p2msoutputindex_to_txindex }, - unknown: ScriptTypeVecs { first_index: first_unknownoutputindex, to_txindex: unknownoutputindex_to_txindex }, + empty: ScriptTypeVecs { first_index: first_empty_output_index, to_tx_index: empty_output_index_to_tx_index }, + opreturn: ScriptTypeVecs { first_index: first_op_return_index, to_tx_index: op_return_index_to_tx_index }, + p2ms: ScriptTypeVecs { first_index: first_p2ms_output_index, to_tx_index: p2ms_output_index_to_tx_index }, + unknown: ScriptTypeVecs { first_index: first_unknown_output_index, to_tx_index: unknown_output_index_to_tx_index }, }) } pub fn truncate( &mut self, height: Height, - emptyoutputindex: EmptyOutputIndex, - opreturnindex: OpReturnIndex, - p2msoutputindex: P2MSOutputIndex, - unknownoutputindex: UnknownOutputIndex, + empty_output_index: EmptyOutputIndex, + op_return_index: OpReturnIndex, + p2ms_output_index: P2MSOutputIndex, + unknown_output_index: UnknownOutputIndex, stamp: Stamp, ) -> Result<()> { self.empty.first_index @@ -73,14 +73,14 @@ impl ScriptsVecs { .truncate_if_needed_with_stamp(height, stamp)?; self.unknown.first_index .truncate_if_needed_with_stamp(height, stamp)?; - self.empty.to_txindex - .truncate_if_needed_with_stamp(emptyoutputindex, stamp)?; - self.opreturn.to_txindex - .truncate_if_needed_with_stamp(opreturnindex, stamp)?; - self.p2ms.to_txindex - .truncate_if_needed_with_stamp(p2msoutputindex, stamp)?; - self.unknown.to_txindex - .truncate_if_needed_with_stamp(unknownoutputindex, stamp)?; + self.empty.to_tx_index + .truncate_if_needed_with_stamp(empty_output_index, stamp)?; + self.opreturn.to_tx_index + .truncate_if_needed_with_stamp(op_return_index, stamp)?; + self.p2ms.to_tx_index + .truncate_if_needed_with_stamp(p2ms_output_index, stamp)?; + self.unknown.to_tx_index + .truncate_if_needed_with_stamp(unknown_output_index, stamp)?; Ok(()) } @@ -90,10 +90,10 @@ impl ScriptsVecs { &mut self.opreturn.first_index, &mut self.p2ms.first_index, &mut self.unknown.first_index, - &mut self.empty.to_txindex, - &mut self.opreturn.to_txindex, - &mut self.p2ms.to_txindex, - &mut self.unknown.to_txindex, + &mut self.empty.to_tx_index, + &mut self.opreturn.to_tx_index, + &mut self.p2ms.to_tx_index, + &mut self.unknown.to_tx_index, ] .into_par_iter() } diff --git a/crates/brk_indexer/src/vecs/transactions.rs b/crates/brk_indexer/src/vecs/transactions.rs index c65ebc56c..60755f325 100644 --- a/crates/brk_indexer/src/vecs/transactions.rs +++ b/crates/brk_indexer/src/vecs/transactions.rs @@ -13,23 +13,23 @@ use crate::parallel_import; #[derive(Traversable)] pub struct TransactionsVecs { - pub first_txindex: M::Stored>, + pub first_tx_index: M::Stored>, pub height: M::Stored>, pub txid: M::Stored>, - pub txversion: M::Stored>, - pub rawlocktime: M::Stored>, + pub tx_version: M::Stored>, + pub raw_locktime: M::Stored>, pub base_size: M::Stored>, pub total_size: M::Stored>, pub is_explicitly_rbf: M::Stored>, - pub first_txinindex: M::Stored>, - pub first_txoutindex: M::Stored>, + pub first_txin_index: M::Stored>, + pub first_txout_index: M::Stored>, } pub struct TxMetadataVecs<'a> { pub height: &'a mut PcoVec, - pub txversion: &'a mut PcoVec, + pub tx_version: &'a mut PcoVec, pub txid: &'a mut BytesVec, - pub rawlocktime: &'a mut PcoVec, + pub raw_locktime: &'a mut PcoVec, pub base_size: &'a mut PcoVec, pub total_size: &'a mut PcoVec, pub is_explicitly_rbf: &'a mut PcoVec, @@ -44,13 +44,13 @@ impl TransactionsVecs { TxMetadataVecs<'_>, ) { ( - &mut self.first_txoutindex, - &mut self.first_txinindex, + &mut self.first_txout_index, + &mut self.first_txin_index, TxMetadataVecs { height: &mut self.height, - txversion: &mut self.txversion, + tx_version: &mut self.tx_version, txid: &mut self.txid, - rawlocktime: &mut self.rawlocktime, + raw_locktime: &mut self.raw_locktime, base_size: &mut self.base_size, total_size: &mut self.total_size, is_explicitly_rbf: &mut self.is_explicitly_rbf, @@ -60,76 +60,76 @@ impl TransactionsVecs { pub fn forced_import(db: &Database, version: Version) -> Result { let ( - first_txindex, + first_tx_index, height, txid, - txversion, - rawlocktime, + tx_version, + raw_locktime, base_size, total_size, is_explicitly_rbf, - first_txinindex, - first_txoutindex, + first_txin_index, + first_txout_index, ) = parallel_import! { - first_txindex = PcoVec::forced_import(db, "first_txindex", version), + first_tx_index = PcoVec::forced_import(db, "first_tx_index", version), height = PcoVec::forced_import(db, "height", version), txid = BytesVec::forced_import(db, "txid", version), - txversion = PcoVec::forced_import(db, "txversion", version), - rawlocktime = PcoVec::forced_import(db, "rawlocktime", version), + tx_version = PcoVec::forced_import(db, "tx_version", version), + raw_locktime = PcoVec::forced_import(db, "raw_locktime", version), base_size = PcoVec::forced_import(db, "base_size", version), total_size = PcoVec::forced_import(db, "total_size", version), is_explicitly_rbf = PcoVec::forced_import(db, "is_explicitly_rbf", version), - first_txinindex = PcoVec::forced_import(db, "first_txinindex", version), - first_txoutindex = BytesVec::forced_import(db, "first_txoutindex", version), + first_txin_index = PcoVec::forced_import(db, "first_txin_index", version), + first_txout_index = BytesVec::forced_import(db, "first_txout_index", version), }; Ok(Self { - first_txindex, + first_tx_index, height, txid, - txversion, - rawlocktime, + tx_version, + raw_locktime, base_size, total_size, is_explicitly_rbf, - first_txinindex, - first_txoutindex, + first_txin_index, + first_txout_index, }) } - pub fn truncate(&mut self, height: Height, txindex: TxIndex, stamp: Stamp) -> Result<()> { - self.first_txindex + pub fn truncate(&mut self, height: Height, tx_index: TxIndex, stamp: Stamp) -> Result<()> { + self.first_tx_index .truncate_if_needed_with_stamp(height, stamp)?; - self.height.truncate_if_needed_with_stamp(txindex, stamp)?; - self.txid.truncate_if_needed_with_stamp(txindex, stamp)?; - self.txversion - .truncate_if_needed_with_stamp(txindex, stamp)?; - self.rawlocktime - .truncate_if_needed_with_stamp(txindex, stamp)?; + self.height.truncate_if_needed_with_stamp(tx_index, stamp)?; + self.txid.truncate_if_needed_with_stamp(tx_index, stamp)?; + self.tx_version + .truncate_if_needed_with_stamp(tx_index, stamp)?; + self.raw_locktime + .truncate_if_needed_with_stamp(tx_index, stamp)?; self.base_size - .truncate_if_needed_with_stamp(txindex, stamp)?; + .truncate_if_needed_with_stamp(tx_index, stamp)?; self.total_size - .truncate_if_needed_with_stamp(txindex, stamp)?; + .truncate_if_needed_with_stamp(tx_index, stamp)?; self.is_explicitly_rbf - .truncate_if_needed_with_stamp(txindex, stamp)?; - self.first_txinindex - .truncate_if_needed_with_stamp(txindex, stamp)?; - self.first_txoutindex - .truncate_if_needed_with_stamp(txindex, stamp)?; + .truncate_if_needed_with_stamp(tx_index, stamp)?; + self.first_txin_index + .truncate_if_needed_with_stamp(tx_index, stamp)?; + self.first_txout_index + .truncate_if_needed_with_stamp(tx_index, stamp)?; Ok(()) } pub fn par_iter_mut_any(&mut self) -> impl ParallelIterator { [ - &mut self.first_txindex as &mut dyn AnyStoredVec, + &mut self.first_tx_index as &mut dyn AnyStoredVec, &mut self.height, &mut self.txid, - &mut self.txversion, - &mut self.rawlocktime, + &mut self.tx_version, + &mut self.raw_locktime, &mut self.base_size, &mut self.total_size, &mut self.is_explicitly_rbf, - &mut self.first_txinindex, - &mut self.first_txoutindex, + &mut self.first_txin_index, + &mut self.first_txout_index, ] .into_par_iter() } diff --git a/crates/brk_oracle/examples/compare_digits.rs b/crates/brk_oracle/examples/compare_digits.rs index db5d05476..6d3431ff2 100644 --- a/crates/brk_oracle/examples/compare_digits.rs +++ b/crates/brk_oracle/examples/compare_digits.rs @@ -153,15 +153,15 @@ fn main() { let total_txs = indexer.vecs.transactions.height.len(); let total_outputs = indexer.vecs.outputs.value.len(); - let first_txindex: Vec = indexer.vecs.transactions.first_txindex.collect(); - let out_first: Vec = indexer.vecs.outputs.first_txoutindex.collect(); + let first_tx_index: Vec = indexer.vecs.transactions.first_tx_index.collect(); + let out_first: Vec = indexer.vecs.outputs.first_txout_index.collect(); let ref_config = Config::default(); let earliest_start = *start_heights.iter().min().unwrap(); for h in START_HEIGHT..total_heights { - let ft = first_txindex[h]; - let next_ft = first_txindex + let ft = first_tx_index[h]; + let next_ft = first_tx_index .get(h + 1) .copied() .unwrap_or(TxIndex::from(total_txs)); @@ -170,7 +170,7 @@ fn main() { indexer .vecs .transactions - .first_txoutindex + .first_txout_index .collect_one(ft + 1) .unwrap() .to_usize() @@ -199,7 +199,7 @@ fn main() { let output_types: Vec = indexer .vecs .outputs - .outputtype + .output_type .collect_range_at(out_start, out_end); // Build full histogram and per-digit histograms. diff --git a/crates/brk_oracle/examples/determinism.rs b/crates/brk_oracle/examples/determinism.rs index e76026521..0a6a1f0fa 100644 --- a/crates/brk_oracle/examples/determinism.rs +++ b/crates/brk_oracle/examples/determinism.rs @@ -49,8 +49,8 @@ fn main() { let total_txs = indexer.vecs.transactions.height.len(); let total_outputs = indexer.vecs.outputs.value.len(); - let first_txindex: Vec = indexer.vecs.transactions.first_txindex.collect(); - let out_first: Vec = indexer.vecs.outputs.first_txoutindex.collect(); + let first_tx_index: Vec = indexer.vecs.transactions.first_tx_index.collect(); + let out_first: Vec = indexer.vecs.outputs.first_txout_index.collect(); let ref_config = Config::default(); @@ -74,8 +74,8 @@ fn main() { let end_height = (last_start + window_size + 100).min(total_heights); for h in START_HEIGHT..end_height { - let ft = first_txindex[h]; - let next_ft = first_txindex + let ft = first_tx_index[h]; + let next_ft = first_tx_index .get(h + 1) .copied() .unwrap_or(TxIndex::from(total_txs)); @@ -84,7 +84,7 @@ fn main() { indexer .vecs .transactions - .first_txoutindex + .first_txout_index .collect_one(ft + 1) .unwrap() .to_usize() @@ -109,7 +109,7 @@ fn main() { let output_types: Vec = indexer .vecs .outputs - .outputtype + .output_type .collect_range_at(out_start, out_end); let mut hist = [0u32; NUM_BINS]; diff --git a/crates/brk_oracle/examples/noise.rs b/crates/brk_oracle/examples/noise.rs index 77279d43d..0ca9e7dff 100644 --- a/crates/brk_oracle/examples/noise.rs +++ b/crates/brk_oracle/examples/noise.rs @@ -94,9 +94,9 @@ fn main() { let total_txs = indexer.vecs.transactions.height.len(); let total_outputs = indexer.vecs.outputs.value.len(); - let first_txoutindex_reader = indexer.vecs.transactions.first_txoutindex.reader(); + let first_txout_index_reader = indexer.vecs.transactions.first_txout_index.reader(); let value_reader = indexer.vecs.outputs.value.reader(); - let outputtype_reader = indexer.vecs.outputs.outputtype.reader(); + let output_type_reader = indexer.vecs.outputs.output_type.reader(); let config = Config::default(); let total_blocks = total_heights - lowest; @@ -110,28 +110,28 @@ fn main() { let mut blocks: Vec = Vec::with_capacity(total_blocks); for h in lowest..total_heights { - let first_txindex: TxIndex = indexer + let first_tx_index: TxIndex = indexer .vecs .transactions - .first_txindex + .first_tx_index .collect_one_at(h) .unwrap(); - let next_first_txindex: TxIndex = indexer + let next_first_tx_index: TxIndex = indexer .vecs .transactions - .first_txindex + .first_tx_index .collect_one_at(h + 1) .unwrap_or(TxIndex::from(total_txs)); - let out_start = if first_txindex.to_usize() + 1 < next_first_txindex.to_usize() { - first_txoutindex_reader - .get(first_txindex.to_usize() + 1) + let out_start = if first_tx_index.to_usize() + 1 < next_first_tx_index.to_usize() { + first_txout_index_reader + .get(first_tx_index.to_usize() + 1) .to_usize() } else { indexer .vecs .outputs - .first_txoutindex + .first_txout_index .collect_one_at(h + 1) .unwrap_or(TxOutIndex::from(total_outputs)) .to_usize() @@ -139,7 +139,7 @@ fn main() { let out_end: usize = indexer .vecs .outputs - .first_txoutindex + .first_txout_index .collect_one_at(h + 1) .unwrap_or(TxOutIndex::from(total_outputs)) .to_usize(); @@ -147,7 +147,7 @@ fn main() { let mut hist = Box::new([0u32; NUM_BINS]); for i in out_start..out_end { let sats: Sats = value_reader.get(i); - let output_type = outputtype_reader.get(i); + let output_type = output_type_reader.get(i); if config.excluded_output_types.contains(&output_type) { continue; } diff --git a/crates/brk_oracle/examples/report.rs b/crates/brk_oracle/examples/report.rs index f4562a0fd..227435a74 100644 --- a/crates/brk_oracle/examples/report.rs +++ b/crates/brk_oracle/examples/report.rs @@ -185,8 +185,8 @@ fn main() { let total_outputs = indexer.vecs.outputs.value.len(); // Pre-collect height-indexed vecs (small). Transaction-indexed vecs are too large. - let first_txindex: Vec = indexer.vecs.transactions.first_txindex.collect(); - let out_first: Vec = indexer.vecs.outputs.first_txoutindex.collect(); + let first_tx_index: Vec = indexer.vecs.transactions.first_tx_index.collect(); + let out_first: Vec = indexer.vecs.outputs.first_txout_index.collect(); let ref_config = Config::default(); @@ -200,8 +200,8 @@ fn main() { let mut current_di: Option = None; for h in START_HEIGHT..total_heights { - let ft = first_txindex[h]; - let next_ft = first_txindex + let ft = first_tx_index[h]; + let next_ft = first_tx_index .get(h + 1) .copied() .unwrap_or(TxIndex::from(total_txs)); @@ -210,7 +210,7 @@ fn main() { indexer .vecs .transactions - .first_txoutindex + .first_txout_index .collect_one(ft + 1) .unwrap() .to_usize() @@ -235,7 +235,7 @@ fn main() { let output_types: Vec = indexer .vecs .outputs - .outputtype + .output_type .collect_range_at(out_start, out_end); let mut hist = [0u32; NUM_BINS]; diff --git a/crates/brk_oracle/examples/sweep_digits.rs b/crates/brk_oracle/examples/sweep_digits.rs index 2ce9c48fc..81ac05602 100644 --- a/crates/brk_oracle/examples/sweep_digits.rs +++ b/crates/brk_oracle/examples/sweep_digits.rs @@ -166,16 +166,16 @@ fn main() { let total_txs = indexer.vecs.transactions.height.len(); let total_outputs = indexer.vecs.outputs.value.len(); - let first_txindex: Vec = indexer.vecs.transactions.first_txindex.collect(); - let out_first: Vec = indexer.vecs.outputs.first_txoutindex.collect(); + let first_tx_index: Vec = indexer.vecs.transactions.first_tx_index.collect(); + let out_first: Vec = indexer.vecs.outputs.first_txout_index.collect(); let ref_config = Config::default(); let total_blocks = total_heights - sweep_start; let mut blocks: Vec = Vec::with_capacity(total_blocks); for h in START_HEIGHT..total_heights { - let ft = first_txindex[h]; - let next_ft = first_txindex + let ft = first_tx_index[h]; + let next_ft = first_tx_index .get(h + 1) .copied() .unwrap_or(TxIndex::from(total_txs)); @@ -184,7 +184,7 @@ fn main() { indexer .vecs .transactions - .first_txoutindex + .first_txout_index .collect_one(ft + 1) .unwrap() .to_usize() @@ -213,7 +213,7 @@ fn main() { let output_types: Vec = indexer .vecs .outputs - .outputtype + .output_type .collect_range_at(out_start, out_end); let mut full_hist = Box::new([0u32; NUM_BINS]); diff --git a/crates/brk_oracle/examples/sweep_tolerance.rs b/crates/brk_oracle/examples/sweep_tolerance.rs index 3d65c452b..71059b0f0 100644 --- a/crates/brk_oracle/examples/sweep_tolerance.rs +++ b/crates/brk_oracle/examples/sweep_tolerance.rs @@ -164,8 +164,8 @@ fn main() { let total_txs = indexer.vecs.transactions.height.len(); let total_outputs = indexer.vecs.outputs.value.len(); - let first_txindex: Vec = indexer.vecs.transactions.first_txindex.collect(); - let out_first: Vec = indexer.vecs.outputs.first_txoutindex.collect(); + let first_tx_index: Vec = indexer.vecs.transactions.first_tx_index.collect(); + let out_first: Vec = indexer.vecs.outputs.first_txout_index.collect(); let ref_config = Config::default(); let total_blocks = total_heights - sweep_start; @@ -176,8 +176,8 @@ fn main() { let max_tolerance: f64 = 0.05; for h in START_HEIGHT..total_heights { - let ft = first_txindex[h]; - let next_ft = first_txindex + let ft = first_tx_index[h]; + let next_ft = first_tx_index .get(h + 1) .copied() .unwrap_or(TxIndex::from(total_txs)); @@ -186,7 +186,7 @@ fn main() { indexer .vecs .transactions - .first_txoutindex + .first_txout_index .collect_one(ft + 1) .unwrap() .to_usize() @@ -215,7 +215,7 @@ fn main() { let output_types: Vec = indexer .vecs .outputs - .outputtype + .output_type .collect_range_at(out_start, out_end); let mut full_hist = Box::new([0u32; NUM_BINS]); diff --git a/crates/brk_oracle/examples/validate.rs b/crates/brk_oracle/examples/validate.rs index e4224d671..ae9bfad51 100644 --- a/crates/brk_oracle/examples/validate.rs +++ b/crates/brk_oracle/examples/validate.rs @@ -152,14 +152,14 @@ fn main() { let total_outputs = indexer.vecs.outputs.value.len(); // Pre-collect height-indexed vecs (small). Transaction-indexed vecs are too large. - let first_txindex: Vec = indexer.vecs.transactions.first_txindex.collect(); - let out_first: Vec = indexer.vecs.outputs.first_txoutindex.collect(); + let first_tx_index: Vec = indexer.vecs.transactions.first_tx_index.collect(); + let out_first: Vec = indexer.vecs.outputs.first_txout_index.collect(); let ref_config = Config::default(); for h in START_HEIGHT..total_heights { - let ft = first_txindex[h]; - let next_ft = first_txindex + let ft = first_tx_index[h]; + let next_ft = first_tx_index .get(h + 1) .copied() .unwrap_or(TxIndex::from(total_txs)); @@ -168,7 +168,7 @@ fn main() { indexer .vecs .transactions - .first_txoutindex + .first_txout_index .collect_one(ft + 1) .unwrap() .to_usize() @@ -194,7 +194,7 @@ fn main() { let output_types: Vec = indexer .vecs .outputs - .outputtype + .output_type .collect_range_at(out_start, out_end); let mut hist = [0u32; NUM_BINS]; diff --git a/crates/brk_query/examples/query.rs b/crates/brk_query/examples/query.rs index 852e6725a..108ecff5c 100644 --- a/crates/brk_query/examples/query.rs +++ b/crates/brk_query/examples/query.rs @@ -48,7 +48,7 @@ pub fn main() -> Result<()> { dbg!( indexer .stores - .addresstype_to_addresshash_to_addressindex + .address_type_to_address_hash_to_address_index .get_unwrap(OutputType::P2WSH) .approximate_len() ); diff --git a/crates/brk_query/src/impl/address.rs b/crates/brk_query/src/impl/address.rs index 765d9c1b8..6edb21d99 100644 --- a/crates/brk_query/src/impl/address.rs +++ b/crates/brk_query/src/impl/address.rs @@ -32,16 +32,16 @@ impl Query { return Err(Error::InvalidAddress); }; - let outputtype = OutputType::from(&script); - let Ok(bytes) = AddressBytes::try_from((&script, outputtype)) else { + let output_type = OutputType::from(&script); + let Ok(bytes) = AddressBytes::try_from((&script, output_type)) else { return Err(Error::InvalidAddress); }; - let addresstype = outputtype; + let address_type = output_type; let hash = AddressHash::from(&bytes); let Ok(Some(type_index)) = stores - .addresstype_to_addresshash_to_addressindex - .get_unwrap(addresstype) + .address_type_to_address_hash_to_address_index + .get_unwrap(address_type) .get(&hash) .map(|opt| opt.map(|cow| cow.into_owned())) else { @@ -51,7 +51,7 @@ impl Query { let any_address_index = computer .distribution .any_address_indexes - .get_once(outputtype, type_index)?; + .get_once(output_type, type_index)?; let address_data = match any_address_index.to_enum() { AnyAddressDataIndexEnum::Funded(index) => computer @@ -99,7 +99,7 @@ impl Query { let txindices = self.address_txindices(&address, after_txid, limit)?; txindices .into_iter() - .map(|txindex| self.transaction_by_index(txindex)) + .map(|tx_index| self.transaction_by_index(tx_index)) .collect() } @@ -113,7 +113,7 @@ impl Query { let txid_reader = self.indexer().vecs.transactions.txid.reader(); let txids = txindices .into_iter() - .map(|txindex| txid_reader.get(txindex.to_usize())) + .map(|tx_index| txid_reader.get(tx_index.to_usize())) .collect(); Ok(txids) } @@ -127,23 +127,23 @@ impl Query { let indexer = self.indexer(); let stores = &indexer.stores; - let (outputtype, type_index) = self.resolve_address(address)?; + let (output_type, type_index) = self.resolve_address(address)?; let store = stores - .addresstype_to_addressindex_and_txindex - .get(outputtype) + .address_type_to_address_index_and_tx_index + .get(output_type) .unwrap(); let prefix = u32::from(type_index).to_be_bytes(); - let after_txindex = if let Some(after_txid) = after_txid { - let txindex = stores - .txidprefix_to_txindex + let after_tx_index = if let Some(after_txid) = after_txid { + let tx_index = stores + .txid_prefix_to_tx_index .get(&after_txid.into()) .map_err(|_| Error::UnknownTxid)? .ok_or(Error::UnknownTxid)? .into_owned(); - Some(txindex) + Some(tx_index) } else { None }; @@ -152,14 +152,14 @@ impl Query { .prefix(prefix) .rev() .filter(|(key, _): &(AddressIndexTxIndex, Unit)| { - if let Some(after) = after_txindex { - key.txindex() < after + if let Some(after) = after_tx_index { + key.tx_index() < after } else { true } }) .take(limit) - .map(|(key, _)| key.txindex()) + .map(|(key, _)| key.tx_index()) .collect()) } @@ -168,37 +168,37 @@ impl Query { let stores = &indexer.stores; let vecs = &indexer.vecs; - let (outputtype, type_index) = self.resolve_address(&address)?; + let (output_type, type_index) = self.resolve_address(&address)?; let store = stores - .addresstype_to_addressindex_and_unspentoutpoint - .get(outputtype) + .address_type_to_address_index_and_unspent_outpoint + .get(output_type) .unwrap(); let prefix = u32::from(type_index).to_be_bytes(); let outpoints: Vec<(TxIndex, Vout)> = store .prefix(prefix) - .map(|(key, _): (AddressIndexOutPoint, Unit)| (key.txindex(), key.vout())) + .map(|(key, _): (AddressIndexOutPoint, Unit)| (key.tx_index(), key.vout())) .collect(); let txid_reader = vecs.transactions.txid.reader(); - let first_txoutindex_reader = vecs.transactions.first_txoutindex.reader(); + let first_txout_index_reader = vecs.transactions.first_txout_index.reader(); let value_reader = vecs.outputs.value.reader(); let blockhash_reader = vecs.blocks.blockhash.reader(); let utxos: Vec = outpoints .into_iter() - .map(|(txindex, vout)| { - let txid: Txid = txid_reader.get(txindex.to_usize()); + .map(|(tx_index, vout)| { + let txid: Txid = txid_reader.get(tx_index.to_usize()); let height = vecs .transactions .height - .collect_one_at(txindex.to_usize()) + .collect_one_at(tx_index.to_usize()) .unwrap(); - let first_txoutindex = first_txoutindex_reader.get(txindex.to_usize()); - let txoutindex = first_txoutindex + vout; - let value: Sats = value_reader.get(usize::from(txoutindex)); + let first_txout_index = first_txout_index_reader.get(tx_index.to_usize()); + let txout_index = first_txout_index + vout; + let value: Sats = value_reader.get(usize::from(txout_index)); let block_hash = blockhash_reader.get(usize::from(height)); let block_time = vecs .blocks @@ -252,12 +252,12 @@ impl Query { let stores = &self.indexer().stores; let bytes = AddressBytes::from_str(address)?; - let outputtype = OutputType::from(&bytes); + let output_type = OutputType::from(&bytes); let hash = AddressHash::from(&bytes); let Ok(Some(type_index)) = stores - .addresstype_to_addresshash_to_addressindex - .get(outputtype) + .address_type_to_address_hash_to_address_index + .get(output_type) .unwrap() .get(&hash) .map(|opt| opt.map(|cow| cow.into_owned())) @@ -265,6 +265,6 @@ impl Query { return Err(Error::UnknownAddress); }; - Ok((outputtype, type_index)) + Ok((output_type, type_index)) } } diff --git a/crates/brk_query/src/impl/block/info.rs b/crates/brk_query/src/impl/block/info.rs index 52b3c1aed..b46900e95 100644 --- a/crates/brk_query/src/impl/block/info.rs +++ b/crates/brk_query/src/impl/block/info.rs @@ -64,28 +64,28 @@ impl Query { let sizes = indexer.vecs.blocks.total.collect_range_at(begin, end); let weights = indexer.vecs.blocks.weight.collect_range_at(begin, end); - // Batch-read first_txindex for tx_count computation (need one extra for next boundary) - let txindex_end = if end <= max_height.to_usize() { + // Batch-read first_tx_index for tx_count computation (need one extra for next boundary) + let tx_index_end = if end <= max_height.to_usize() { end + 1 } else { end }; - let first_txindexes: Vec = indexer + let first_tx_indexes: Vec = indexer .vecs .transactions - .first_txindex - .collect_range_at(begin, txindex_end); - let total_txs = computer.indexes.txindex.identity.len(); + .first_tx_index + .collect_range_at(begin, tx_index_end); + let total_txs = computer.indexes.tx_index.identity.len(); let mut blocks = Vec::with_capacity(count); for i in (0..count).rev() { let height = Height::from(begin + i); let blockhash = indexer.vecs.blocks.blockhash.read_once(height)?; - let tx_count = if i + 1 < first_txindexes.len() { - first_txindexes[i + 1].to_usize() - first_txindexes[i].to_usize() + let tx_count = if i + 1 < first_tx_indexes.len() { + first_tx_indexes[i + 1].to_usize() - first_tx_indexes[i].to_usize() } else { - total_txs - first_txindexes[i].to_usize() + total_txs - first_tx_indexes[i].to_usize() }; blocks.push(BlockInfo { @@ -111,7 +111,7 @@ impl Query { indexer .stores - .blockhashprefix_to_height + .blockhash_prefix_to_height .get(&prefix)? .map(|h| *h) .ok_or(Error::NotFound("Block not found".into())) @@ -125,23 +125,23 @@ impl Query { let indexer = self.indexer(); let computer = self.computer(); - let first_txindex = indexer + let first_tx_index = indexer .vecs .transactions - .first_txindex + .first_tx_index .collect_one(height) .unwrap(); - let next_first_txindex = if height < max_height { + let next_first_tx_index = if height < max_height { indexer .vecs .transactions - .first_txindex + .first_tx_index .collect_one(height.incremented()) .unwrap() } else { - TxIndex::from(computer.indexes.txindex.identity.len()) + TxIndex::from(computer.indexes.tx_index.identity.len()) }; - Ok((next_first_txindex.to_usize() - first_txindex.to_usize()) as u32) + Ok((next_first_tx_index.to_usize() - first_tx_index.to_usize()) as u32) } } diff --git a/crates/brk_query/src/impl/block/txs.rs b/crates/brk_query/src/impl/block/txs.rs index ec99e4704..a4c34246f 100644 --- a/crates/brk_query/src/impl/block/txs.rs +++ b/crates/brk_query/src/impl/block/txs.rs @@ -31,21 +31,21 @@ impl Query { return Err(Error::OutOfRange("Block height out of range".into())); } - let first_txindex = indexer + let first_tx_index = indexer .vecs .transactions - .first_txindex + .first_tx_index .collect_one(height) .unwrap(); - let next_first_txindex = indexer + let next_first_tx_index = indexer .vecs .transactions - .first_txindex + .first_tx_index .collect_one(height.incremented()) .unwrap_or_else(|| TxIndex::from(indexer.vecs.transactions.txid.len())); - let first: usize = first_txindex.into(); - let next: usize = next_first_txindex.into(); + let first: usize = first_tx_index.into(); + let next: usize = next_first_tx_index.into(); let txids: Vec = indexer.vecs.transactions.txid.collect_range_at(first, next); @@ -60,21 +60,21 @@ impl Query { return Err(Error::OutOfRange("Block height out of range".into())); } - let first_txindex = indexer + let first_tx_index = indexer .vecs .transactions - .first_txindex + .first_tx_index .collect_one(height) .unwrap(); - let next_first_txindex = indexer + let next_first_tx_index = indexer .vecs .transactions - .first_txindex + .first_tx_index .collect_one(height.incremented()) .unwrap_or_else(|| TxIndex::from(indexer.vecs.transactions.txid.len())); - let first: usize = first_txindex.into(); - let next: usize = next_first_txindex.into(); + let first: usize = first_tx_index.into(); + let next: usize = next_first_tx_index.into(); let tx_count = next - first; if start_index >= tx_count { @@ -86,8 +86,8 @@ impl Query { let mut txs = Vec::with_capacity(count); for i in start_index..end_index { - let txindex = TxIndex::from(first + i); - let tx = self.transaction_by_index(txindex)?; + let tx_index = TxIndex::from(first + i); + let tx = self.transaction_by_index(tx_index)?; txs.push(tx); } @@ -102,29 +102,29 @@ impl Query { return Err(Error::OutOfRange("Block height out of range".into())); } - let first_txindex = indexer + let first_tx_index = indexer .vecs .transactions - .first_txindex + .first_tx_index .collect_one(height) .unwrap(); - let next_first_txindex = indexer + let next_first_tx_index = indexer .vecs .transactions - .first_txindex + .first_tx_index .collect_one(height.incremented()) .unwrap_or_else(|| TxIndex::from(indexer.vecs.transactions.txid.len())); - let first: usize = first_txindex.into(); - let next: usize = next_first_txindex.into(); + let first: usize = first_tx_index.into(); + let next: usize = next_first_tx_index.into(); let tx_count = next - first; if index >= tx_count { return Err(Error::OutOfRange("Transaction index out of range".into())); } - let txindex = first + index; - let txid = indexer.vecs.transactions.txid.reader().get(txindex); + let tx_index = first + index; + let txid = indexer.vecs.transactions.txid.reader().get(tx_index); Ok(txid) } diff --git a/crates/brk_query/src/impl/mining/block_fee_rates.rs b/crates/brk_query/src/impl/mining/block_fee_rates.rs index cbd735abb..cd1d25a30 100644 --- a/crates/brk_query/src/impl/mining/block_fee_rates.rs +++ b/crates/brk_query/src/impl/mining/block_fee_rates.rs @@ -1,8 +1,8 @@ // TODO: INCOMPLETE - indexes_to_fee_rate.day1 doesn't have percentile fields -// because from_txindex.rs calls remove_percentiles() before creating day1. +// because from_tx_index.rs calls remove_percentiles() before creating day1. // Need to either: // 1. Use .height instead and convert height to day1 for iteration -// 2. Fix from_txindex.rs to preserve percentiles for day1 +// 2. Fix from_tx_index.rs to preserve percentiles for day1 // 3. Create a separate day1 computation path with percentiles #![allow(dead_code)] diff --git a/crates/brk_query/src/impl/transaction.rs b/crates/brk_query/src/impl/transaction.rs index 35b8d0b9e..75334f095 100644 --- a/crates/brk_query/src/impl/transaction.rs +++ b/crates/brk_query/src/impl/transaction.rs @@ -22,16 +22,16 @@ impl Query { // Look up confirmed transaction by txid prefix let prefix = TxidPrefix::from(&txid); let indexer = self.indexer(); - let Ok(Some(txindex)) = indexer + let Ok(Some(tx_index)) = indexer .stores - .txidprefix_to_txindex + .txid_prefix_to_tx_index .get(&prefix) .map(|opt| opt.map(|cow| cow.into_owned())) else { return Err(Error::UnknownTxid); }; - self.transaction_by_index(txindex) + self.transaction_by_index(tx_index) } pub fn transaction_status(&self, TxidParam { txid }: TxidParam) -> Result { @@ -45,9 +45,9 @@ impl Query { // Look up confirmed transaction by txid prefix let prefix = TxidPrefix::from(&txid); let indexer = self.indexer(); - let Ok(Some(txindex)) = indexer + let Ok(Some(tx_index)) = indexer .stores - .txidprefix_to_txindex + .txid_prefix_to_tx_index .get(&prefix) .map(|opt| opt.map(|cow| cow.into_owned())) else { @@ -59,7 +59,7 @@ impl Query { .vecs .transactions .height - .collect_one(txindex) + .collect_one(tx_index) .unwrap(); let block_hash = indexer.vecs.blocks.blockhash.read_once(height)?; let block_time = indexer.vecs.blocks.timestamp.collect_one(height).unwrap(); @@ -83,16 +83,16 @@ impl Query { // Look up confirmed transaction by txid prefix let prefix = TxidPrefix::from(&txid); let indexer = self.indexer(); - let Ok(Some(txindex)) = indexer + let Ok(Some(tx_index)) = indexer .stores - .txidprefix_to_txindex + .txid_prefix_to_tx_index .get(&prefix) .map(|opt| opt.map(|cow| cow.into_owned())) else { return Err(Error::UnknownTxid); }; - self.transaction_hex_by_index(txindex) + self.transaction_hex_by_index(tx_index) } pub fn outspend(&self, TxidParam { txid }: TxidParam, vout: Vout) -> Result { @@ -106,32 +106,32 @@ impl Query { // Look up confirmed transaction let prefix = TxidPrefix::from(&txid); let indexer = self.indexer(); - let Ok(Some(txindex)) = indexer + let Ok(Some(tx_index)) = indexer .stores - .txidprefix_to_txindex + .txid_prefix_to_tx_index .get(&prefix) .map(|opt| opt.map(|cow| cow.into_owned())) else { return Err(Error::UnknownTxid); }; - // Calculate txoutindex - let first_txoutindex = indexer + // Calculate txout_index + let first_txout_index = indexer .vecs .transactions - .first_txoutindex - .read_once(txindex)?; - let txoutindex = first_txoutindex + vout; + .first_txout_index + .read_once(tx_index)?; + let txout_index = first_txout_index + vout; // Look up spend status let computer = self.computer(); - let txinindex = computer.outputs.spent.txinindex.read_once(txoutindex)?; + let txin_index = computer.outputs.spent.txin_index.read_once(txout_index)?; - if txinindex == TxInIndex::UNSPENT { + if txin_index == TxInIndex::UNSPENT { return Ok(TxOutspend::UNSPENT); } - self.outspend_details(txinindex) + self.outspend_details(txin_index) } pub fn outspends(&self, TxidParam { txid }: TxidParam) -> Result> { @@ -146,9 +146,9 @@ impl Query { // Look up confirmed transaction let prefix = TxidPrefix::from(&txid); let indexer = self.indexer(); - let Ok(Some(txindex)) = indexer + let Ok(Some(tx_index)) = indexer .stores - .txidprefix_to_txindex + .txid_prefix_to_tx_index .get(&prefix) .map(|opt| opt.map(|cow| cow.into_owned())) else { @@ -156,31 +156,31 @@ impl Query { }; // Get output range - let first_txoutindex = indexer + let first_txout_index = indexer .vecs .transactions - .first_txoutindex - .read_once(txindex)?; - let next_first_txoutindex = indexer + .first_txout_index + .read_once(tx_index)?; + let next_first_txout_index = indexer .vecs .transactions - .first_txoutindex - .read_once(txindex.incremented())?; - let output_count = usize::from(next_first_txoutindex) - usize::from(first_txoutindex); + .first_txout_index + .read_once(tx_index.incremented())?; + let output_count = usize::from(next_first_txout_index) - usize::from(first_txout_index); // Get spend status for each output let computer = self.computer(); - let txinindex_reader = computer.outputs.spent.txinindex.reader(); + let txin_index_reader = computer.outputs.spent.txin_index.reader(); let mut outspends = Vec::with_capacity(output_count); for i in 0..output_count { - let txoutindex = first_txoutindex + Vout::from(i); - let txinindex = txinindex_reader.get(usize::from(txoutindex)); + let txout_index = first_txout_index + Vout::from(i); + let txin_index = txin_index_reader.get(usize::from(txout_index)); - if txinindex == TxInIndex::UNSPENT { + if txin_index == TxInIndex::UNSPENT { outspends.push(TxOutspend::UNSPENT); } else { - outspends.push(self.outspend_details(txinindex)?); + outspends.push(self.outspend_details(txin_index)?); } } @@ -189,44 +189,44 @@ impl Query { // === Helper methods === - pub fn transaction_by_index(&self, txindex: TxIndex) -> Result { + pub fn transaction_by_index(&self, tx_index: TxIndex) -> Result { let indexer = self.indexer(); let reader = self.reader(); let computer = self.computer(); // Get tx metadata using collect_one for PcoVec, read_once for BytesVec - let txid = indexer.vecs.transactions.txid.read_once(txindex)?; + let txid = indexer.vecs.transactions.txid.read_once(tx_index)?; let height = indexer .vecs .transactions .height - .collect_one(txindex) + .collect_one(tx_index) .unwrap(); let version = indexer .vecs .transactions - .txversion - .collect_one(txindex) + .tx_version + .collect_one(tx_index) .unwrap(); let lock_time = indexer .vecs .transactions - .rawlocktime - .collect_one(txindex) + .raw_locktime + .collect_one(tx_index) .unwrap(); let total_size = indexer .vecs .transactions .total_size - .collect_one(txindex) + .collect_one(tx_index) .unwrap(); - let first_txinindex = indexer + let first_txin_index = indexer .vecs .transactions - .first_txinindex - .collect_one(txindex) + .first_txin_index + .collect_one(tx_index) .unwrap(); - let position = computer.positions.tx.collect_one(txindex).unwrap(); + let position = computer.positions.tx.collect_one(tx_index).unwrap(); // Get block info for status let block_hash = indexer.vecs.blocks.blockhash.read_once(height)?; @@ -240,16 +240,16 @@ impl Query { // Create readers for random access lookups let txid_reader = indexer.vecs.transactions.txid.reader(); - let first_txoutindex_reader = indexer.vecs.transactions.first_txoutindex.reader(); + let first_txout_index_reader = indexer.vecs.transactions.first_txout_index.reader(); let value_reader = indexer.vecs.outputs.value.reader(); - let outputtype_reader = indexer.vecs.outputs.outputtype.reader(); - let typeindex_reader = indexer.vecs.outputs.typeindex.reader(); + let output_type_reader = indexer.vecs.outputs.output_type.reader(); + let type_index_reader = indexer.vecs.outputs.type_index.reader(); let address_readers = indexer.vecs.addresses.address_readers(); // Batch-read outpoints for all inputs (avoids per-input PcoVec page decompression) let outpoints: Vec<_> = indexer.vecs.inputs.outpoint.collect_range_at( - usize::from(first_txinindex), - usize::from(first_txinindex) + tx.input.len(), + usize::from(first_txin_index), + usize::from(first_txin_index) + tx.input.len(), ); // Build inputs with prevout information @@ -266,21 +266,21 @@ impl Query { let (prev_txid, prev_vout, prevout) = if is_coinbase { (Txid::COINBASE, Vout::MAX, None) } else { - let prev_txindex = outpoint.txindex(); + let prev_tx_index = outpoint.tx_index(); let prev_vout = outpoint.vout(); - let prev_txid = txid_reader.get(prev_txindex.to_usize()); + let prev_txid = txid_reader.get(prev_tx_index.to_usize()); - // Calculate the txoutindex for the prevout - let prev_first_txoutindex = - first_txoutindex_reader.get(prev_txindex.to_usize()); - let prev_txoutindex = prev_first_txoutindex + prev_vout; + // Calculate the txout_index for the prevout + let prev_first_txout_index = + first_txout_index_reader.get(prev_tx_index.to_usize()); + let prev_txout_index = prev_first_txout_index + prev_vout; - let prev_value = value_reader.get(usize::from(prev_txoutindex)); - let prev_outputtype: OutputType = - outputtype_reader.get(usize::from(prev_txoutindex)); - let prev_typeindex = typeindex_reader.get(usize::from(prev_txoutindex)); + let prev_value = value_reader.get(usize::from(prev_txout_index)); + let prev_output_type: OutputType = + output_type_reader.get(usize::from(prev_txout_index)); + let prev_type_index = type_index_reader.get(usize::from(prev_txout_index)); let script_pubkey = - address_readers.script_pubkey(prev_outputtype, prev_typeindex); + address_readers.script_pubkey(prev_output_type, prev_type_index); let prevout = Some(TxOut::from((script_pubkey, prev_value))); @@ -318,7 +318,7 @@ impl Query { }; let mut transaction = Transaction { - index: Some(txindex), + index: Some(tx_index), txid, version, lock_time, @@ -337,7 +337,7 @@ impl Query { Ok(transaction) } - fn transaction_hex_by_index(&self, txindex: TxIndex) -> Result { + fn transaction_hex_by_index(&self, tx_index: TxIndex) -> Result { let indexer = self.indexer(); let reader = self.reader(); let computer = self.computer(); @@ -346,37 +346,37 @@ impl Query { .vecs .transactions .total_size - .collect_one(txindex) + .collect_one(tx_index) .unwrap(); - let position = computer.positions.tx.collect_one(txindex).unwrap(); + let position = computer.positions.tx.collect_one(tx_index).unwrap(); let buffer = reader.read_raw_bytes(position, *total_size as usize)?; Ok(buffer.to_lower_hex_string()) } - fn outspend_details(&self, txinindex: TxInIndex) -> Result { + fn outspend_details(&self, txin_index: TxInIndex) -> Result { let indexer = self.indexer(); - // Look up spending txindex directly - let spending_txindex = indexer.vecs.inputs.txindex.collect_one(txinindex).unwrap(); + // Look up spending tx_index directly + let spending_tx_index = indexer.vecs.inputs.tx_index.collect_one(txin_index).unwrap(); // Calculate vin - let spending_first_txinindex = indexer + let spending_first_txin_index = indexer .vecs .transactions - .first_txinindex - .collect_one(spending_txindex) + .first_txin_index + .collect_one(spending_tx_index) .unwrap(); - let vin = Vin::from(usize::from(txinindex) - usize::from(spending_first_txinindex)); + let vin = Vin::from(usize::from(txin_index) - usize::from(spending_first_txin_index)); // Get spending tx details - let spending_txid = indexer.vecs.transactions.txid.read_once(spending_txindex)?; + let spending_txid = indexer.vecs.transactions.txid.read_once(spending_tx_index)?; let spending_height = indexer .vecs .transactions .height - .collect_one(spending_txindex) + .collect_one(spending_tx_index) .unwrap(); let block_hash = indexer.vecs.blocks.blockhash.read_once(spending_height)?; let block_time = indexer diff --git a/crates/brk_types/src/address.rs b/crates/brk_types/src/address.rs index c0d53893b..b458afda2 100644 --- a/crates/brk_types/src/address.rs +++ b/crates/brk_types/src/address.rs @@ -42,14 +42,14 @@ impl TryFrom<&ScriptBuf> for Address { impl TryFrom<(&ScriptBuf, OutputType)> for Address { type Error = Error; - fn try_from((script, outputtype): (&ScriptBuf, OutputType)) -> Result { - match outputtype { + fn try_from((script, output_type): (&ScriptBuf, OutputType)) -> Result { + match output_type { OutputType::P2PK65 | OutputType::P2PK33 => { // P2PK has no standard address encoding, use raw pubkey hex - let bytes = AddressBytes::try_from((script, outputtype))?; + let bytes = AddressBytes::try_from((script, output_type))?; Ok(Self(bytes_to_hex(bytes.as_slice()))) } - _ if outputtype.is_address() => { + _ if output_type.is_address() => { let addr = bitcoin::Address::from_script(script, bitcoin::Network::Bitcoin) .map_err(|_| Error::InvalidAddress)?; Ok(Self(addr.to_string())) diff --git a/crates/brk_types/src/address_bytes.rs b/crates/brk_types/src/address_bytes.rs index c87672dfd..162355266 100644 --- a/crates/brk_types/src/address_bytes.rs +++ b/crates/brk_types/src/address_bytes.rs @@ -79,9 +79,9 @@ impl TryFrom<&ScriptBuf> for AddressBytes { impl TryFrom<(&ScriptBuf, OutputType)> for AddressBytes { type Error = Error; fn try_from(tuple: (&ScriptBuf, OutputType)) -> Result { - let (script, outputtype) = tuple; + let (script, output_type) = tuple; - match outputtype { + match output_type { OutputType::P2PK65 => { let bytes = script.as_bytes(); let bytes = match bytes.len() { @@ -219,7 +219,7 @@ impl FromStr for AddressBytes { fn from_str(s: &str) -> Result { let script = Self::address_to_script(s)?; - let outputtype = OutputType::from(&script); - Self::try_from((&script, outputtype)) + let output_type = OutputType::from(&script); + Self::try_from((&script, output_type)) } } diff --git a/crates/brk_types/src/address_index_outpoint.rs b/crates/brk_types/src/address_index_outpoint.rs index c6d439cc4..01a7e80e2 100644 --- a/crates/brk_types/src/address_index_outpoint.rs +++ b/crates/brk_types/src/address_index_outpoint.rs @@ -11,14 +11,14 @@ use super::{OutPoint, TxIndex, TypeIndex}; #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Serialize)] #[repr(C)] pub struct AddressIndexOutPoint { - addressindextxindex: AddressIndexTxIndex, // u64 + address_index_tx_index: AddressIndexTxIndex, // u64 vout: Vout, // u16 } impl AddressIndexOutPoint { #[inline] - pub fn txindex(&self) -> TxIndex { - self.addressindextxindex.txindex() + pub fn tx_index(&self) -> TxIndex { + self.address_index_tx_index.tx_index() } #[inline] @@ -30,7 +30,7 @@ impl AddressIndexOutPoint { impl Hash for AddressIndexOutPoint { fn hash(&self, state: &mut H) { let mut buf = [0u8; 10]; - buf[0..8].copy_from_slice(&self.addressindextxindex.to_bytes()); + buf[0..8].copy_from_slice(&self.address_index_tx_index.to_bytes()); buf[8..].copy_from_slice(&self.vout.to_bytes()); state.write(&buf); } @@ -38,9 +38,9 @@ impl Hash for AddressIndexOutPoint { impl From<(TypeIndex, OutPoint)> for AddressIndexOutPoint { #[inline] - fn from((addressindex, outpoint): (TypeIndex, OutPoint)) -> Self { + fn from((address_index, outpoint): (TypeIndex, OutPoint)) -> Self { Self { - addressindextxindex: AddressIndexTxIndex::from((addressindex, outpoint.txindex())), + address_index_tx_index: AddressIndexTxIndex::from((address_index, outpoint.tx_index())), vout: outpoint.vout(), } } @@ -50,7 +50,7 @@ impl From for AddressIndexOutPoint { #[inline] fn from(value: ByteView) -> Self { Self { - addressindextxindex: AddressIndexTxIndex::from(ByteView::new(&value[..8])), + address_index_tx_index: AddressIndexTxIndex::from(ByteView::new(&value[..8])), vout: Vout::from(u16::from_be_bytes([value[8], value[9]])), } } @@ -67,7 +67,7 @@ impl From<&AddressIndexOutPoint> for ByteView { fn from(value: &AddressIndexOutPoint) -> Self { ByteView::from( [ - &ByteView::from(value.addressindextxindex), + &ByteView::from(value.address_index_tx_index), value.vout.to_be_bytes().as_slice(), ] .concat(), diff --git a/crates/brk_types/src/address_index_tx_index.rs b/crates/brk_types/src/address_index_tx_index.rs index 069550250..0cbfb1044 100644 --- a/crates/brk_types/src/address_index_tx_index.rs +++ b/crates/brk_types/src/address_index_tx_index.rs @@ -10,27 +10,27 @@ use super::{TxIndex, TypeIndex}; pub struct AddressIndexTxIndex(u64); impl AddressIndexTxIndex { - pub fn addressindex(&self) -> u32 { + pub fn address_index(&self) -> u32 { (self.0 >> 32) as u32 } - pub fn txindex(&self) -> TxIndex { + pub fn tx_index(&self) -> TxIndex { TxIndex::from(self.0 as u32) } - pub fn min_for_address(addressindex: TypeIndex) -> Self { - Self(u64::from(addressindex) << 32) + pub fn min_for_address(address_index: TypeIndex) -> Self { + Self(u64::from(address_index) << 32) } - pub fn max_for_address(addressindex: TypeIndex) -> Self { - Self((u64::from(addressindex) << 32) | u64::MAX >> 32) + pub fn max_for_address(address_index: TypeIndex) -> Self { + Self((u64::from(address_index) << 32) | u64::MAX >> 32) } } impl From<(TypeIndex, TxIndex)> for AddressIndexTxIndex { #[inline] - fn from((addressindex, txindex): (TypeIndex, TxIndex)) -> Self { - Self((u64::from(addressindex) << 32) | u64::from(txindex)) + fn from((address_index, tx_index): (TypeIndex, TxIndex)) -> Self { + Self((u64::from(address_index) << 32) | u64::from(tx_index)) } } diff --git a/crates/brk_types/src/empty_address_index.rs b/crates/brk_types/src/empty_address_index.rs index 18de6922b..3d194baab 100644 --- a/crates/brk_types/src/empty_address_index.rs +++ b/crates/brk_types/src/empty_address_index.rs @@ -66,11 +66,11 @@ impl CheckedSub for EmptyAddressIndex { impl PrintableIndex for EmptyAddressIndex { fn to_string() -> &'static str { - "emptyaddressindex" + "empty_address_index" } fn to_possible_strings() -> &'static [&'static str] { - &["emptyaddr", "emptyaddressindex"] + &["emptyaddr", "empty_address_index"] } } diff --git a/crates/brk_types/src/empty_output_index.rs b/crates/brk_types/src/empty_output_index.rs index 75b88efa2..af64a0d50 100644 --- a/crates/brk_types/src/empty_output_index.rs +++ b/crates/brk_types/src/empty_output_index.rs @@ -63,11 +63,11 @@ impl CheckedSub for EmptyOutputIndex { impl PrintableIndex for EmptyOutputIndex { fn to_string() -> &'static str { - "emptyoutputindex" + "empty_output_index" } fn to_possible_strings() -> &'static [&'static str] { - &["emptyout", "emptyoutputindex"] + &["emptyout", "empty_output_index"] } } diff --git a/crates/brk_types/src/funded_address_index.rs b/crates/brk_types/src/funded_address_index.rs index b3f1107ff..b9d0e6c7b 100644 --- a/crates/brk_types/src/funded_address_index.rs +++ b/crates/brk_types/src/funded_address_index.rs @@ -62,11 +62,11 @@ impl CheckedSub for FundedAddressIndex { } impl PrintableIndex for FundedAddressIndex { fn to_string() -> &'static str { - "fundedaddressindex" + "funded_address_index" } fn to_possible_strings() -> &'static [&'static str] { - &["fundedaddr", "fundedaddressindex"] + &["fundedaddr", "funded_address_index"] } } diff --git a/crates/brk_types/src/index.rs b/crates/brk_types/src/index.rs index e2aea1af8..bde68c71e 100644 --- a/crates/brk_types/src/index.rs +++ b/crates/brk_types/src/index.rs @@ -18,7 +18,7 @@ use super::{ }; /// Aggregation dimension for querying metrics. Includes time-based (date, week, month, year), -/// block-based (height, txindex), and address/output type indexes. +/// block-based (height, tx_index), and address/output type indexes. #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, JsonSchema)] #[serde(rename_all = "lowercase")] #[schemars(example = Index::Day1)] @@ -347,7 +347,7 @@ mod tests { } #[test] - fn test_is_not_date_based_txindex() { + fn test_is_not_date_based_tx_index() { assert!(!Index::TxIndex.is_date_based()); } @@ -405,7 +405,7 @@ mod tests { } #[test] - fn test_index_to_date_txindex_returns_none() { + fn test_index_to_date_tx_index_returns_none() { assert!(Index::TxIndex.index_to_date(100).is_none()); } diff --git a/crates/brk_types/src/indexes.rs b/crates/brk_types/src/indexes.rs index e17223840..fa517672e 100644 --- a/crates/brk_types/src/indexes.rs +++ b/crates/brk_types/src/indexes.rs @@ -9,55 +9,55 @@ use crate::{ /// Used by brk_indexer during block processing. #[derive(Debug, Default, Clone)] pub struct Indexes { - pub emptyoutputindex: EmptyOutputIndex, + pub empty_output_index: EmptyOutputIndex, pub height: Height, - pub opreturnindex: OpReturnIndex, - pub p2msoutputindex: P2MSOutputIndex, - pub p2pk33addressindex: P2PK33AddressIndex, - pub p2pk65addressindex: P2PK65AddressIndex, - pub p2pkhaddressindex: P2PKHAddressIndex, - pub p2shaddressindex: P2SHAddressIndex, - pub p2traddressindex: P2TRAddressIndex, - pub p2wpkhaddressindex: P2WPKHAddressIndex, - pub p2wshaddressindex: P2WSHAddressIndex, - pub p2aaddressindex: P2AAddressIndex, - pub txindex: TxIndex, - pub txinindex: TxInIndex, - pub txoutindex: TxOutIndex, - pub unknownoutputindex: UnknownOutputIndex, + pub op_return_index: OpReturnIndex, + pub p2ms_output_index: P2MSOutputIndex, + pub p2pk33_address_index: P2PK33AddressIndex, + pub p2pk65_address_index: P2PK65AddressIndex, + pub p2pkh_address_index: P2PKHAddressIndex, + pub p2sh_address_index: P2SHAddressIndex, + pub p2tr_address_index: P2TRAddressIndex, + pub p2wpkh_address_index: P2WPKHAddressIndex, + pub p2wsh_address_index: P2WSHAddressIndex, + pub p2a_address_index: P2AAddressIndex, + pub tx_index: TxIndex, + pub txin_index: TxInIndex, + pub txout_index: TxOutIndex, + pub unknown_output_index: UnknownOutputIndex, } impl Indexes { - pub fn to_typeindex(&self, outputtype: OutputType) -> TypeIndex { - match outputtype { - OutputType::Empty => *self.emptyoutputindex, - OutputType::OpReturn => *self.opreturnindex, - OutputType::P2A => *self.p2aaddressindex, - OutputType::P2MS => *self.p2msoutputindex, - OutputType::P2PK33 => *self.p2pk33addressindex, - OutputType::P2PK65 => *self.p2pk65addressindex, - OutputType::P2PKH => *self.p2pkhaddressindex, - OutputType::P2SH => *self.p2shaddressindex, - OutputType::P2TR => *self.p2traddressindex, - OutputType::P2WPKH => *self.p2wpkhaddressindex, - OutputType::P2WSH => *self.p2wshaddressindex, - OutputType::Unknown => *self.unknownoutputindex, + pub fn to_type_index(&self, output_type: OutputType) -> TypeIndex { + match output_type { + OutputType::Empty => *self.empty_output_index, + OutputType::OpReturn => *self.op_return_index, + OutputType::P2A => *self.p2a_address_index, + OutputType::P2MS => *self.p2ms_output_index, + OutputType::P2PK33 => *self.p2pk33_address_index, + OutputType::P2PK65 => *self.p2pk65_address_index, + OutputType::P2PKH => *self.p2pkh_address_index, + OutputType::P2SH => *self.p2sh_address_index, + OutputType::P2TR => *self.p2tr_address_index, + OutputType::P2WPKH => *self.p2wpkh_address_index, + OutputType::P2WSH => *self.p2wsh_address_index, + OutputType::Unknown => *self.unknown_output_index, } } /// Increments the address index for the given address type and returns the previous value. /// Only call this for address types (P2PK65, P2PK33, P2PKH, P2SH, P2WPKH, P2WSH, P2TR, P2A). #[inline] - pub fn increment_address_index(&mut self, addresstype: OutputType) -> TypeIndex { - match addresstype { - OutputType::P2PK65 => self.p2pk65addressindex.copy_then_increment(), - OutputType::P2PK33 => self.p2pk33addressindex.copy_then_increment(), - OutputType::P2PKH => self.p2pkhaddressindex.copy_then_increment(), - OutputType::P2SH => self.p2shaddressindex.copy_then_increment(), - OutputType::P2WPKH => self.p2wpkhaddressindex.copy_then_increment(), - OutputType::P2WSH => self.p2wshaddressindex.copy_then_increment(), - OutputType::P2TR => self.p2traddressindex.copy_then_increment(), - OutputType::P2A => self.p2aaddressindex.copy_then_increment(), + pub fn increment_address_index(&mut self, address_type: OutputType) -> TypeIndex { + match address_type { + OutputType::P2PK65 => self.p2pk65_address_index.copy_then_increment(), + OutputType::P2PK33 => self.p2pk33_address_index.copy_then_increment(), + OutputType::P2PKH => self.p2pkh_address_index.copy_then_increment(), + OutputType::P2SH => self.p2sh_address_index.copy_then_increment(), + OutputType::P2WPKH => self.p2wpkh_address_index.copy_then_increment(), + OutputType::P2WSH => self.p2wsh_address_index.copy_then_increment(), + OutputType::P2TR => self.p2tr_address_index.copy_then_increment(), + OutputType::P2A => self.p2a_address_index.copy_then_increment(), _ => unreachable!(), } } diff --git a/crates/brk_types/src/lib.rs b/crates/brk_types/src/lib.rs index 0388d86c8..2caee43fb 100644 --- a/crates/brk_types/src/lib.rs +++ b/crates/brk_types/src/lib.rs @@ -3,41 +3,41 @@ pub use vecdb::{CheckedSub, Exit, PrintableIndex, Version}; mod address; -mod addressbytes; -mod addresschainstats; -mod addresshash; -mod addressindexoutpoint; -mod addressindextxindex; -mod addressmempoolstats; -mod addressparam; -mod addressstats; -mod addresstxidsparam; -mod addressvalidation; +mod address_bytes; +mod address_chain_stats; +mod address_hash; +mod address_index_outpoint; +mod address_index_tx_index; +mod address_mempool_stats; +mod address_param; +mod address_stats; +mod address_txids_param; +mod address_validation; mod age; -mod anyaddressindex; +mod any_address_index; mod basis_points_16; mod basis_points_32; mod basis_points_signed_16; mod basis_points_signed_32; mod bitcoin; -mod blkmetadata; -mod blkposition; +mod blk_metadata; +mod blk_position; mod block; -mod blockcountparam; -mod blockfeesentry; -mod blockferatesentry; +mod block_count_param; +mod block_fees_entry; +mod block_fee_rates_entry; mod blockhash; -mod blockhashparam; -mod blockhashprefix; -mod blockhashstartindex; -mod blockhashtxindex; -mod blockinfo; -mod blockrewardsentry; -mod blocksizeentry; -mod blocksizesweights; -mod blockstatus; -mod blocktimestamp; -mod blockweightentry; +mod blockhash_param; +mod blockhash_prefix; +mod blockhash_start_index; +mod blockhash_tx_index; +mod block_info; +mod block_rewards_entry; +mod block_size_entry; +mod block_sizes_weights; +mod block_status; +mod block_timestamp; +mod block_weight_entry; mod bytes; mod cents; mod cents_compact; @@ -48,109 +48,109 @@ mod cost_basis_bucket; mod cost_basis_distribution; mod cost_basis_params; mod cost_basis_value; -mod datarange; -mod datarangeformat; +mod data_range; +mod data_range_format; mod date; mod day1; mod day3; mod deser; -mod difficultyadjustment; -mod difficultyadjustmententry; -mod difficultyentry; -mod diskusage; +mod difficulty_adjustment; +mod difficulty_adjustment_entry; +mod difficulty_entry; +mod disk_usage; mod dollars; -mod emptyaddressdata; -mod emptyaddressindex; -mod emptyoutputindex; +mod empty_address_data; +mod empty_address_index; +mod empty_output_index; mod epoch; mod etag; mod feerate; -mod feeratepercentiles; +mod feerate_percentiles; mod format; -mod formatresponse; +mod format_response; mod from_coarser; -mod fundedaddressdata; -mod fundedaddressindex; +mod funded_address_data; +mod funded_address_index; mod halving; -mod hashrateentry; -mod hashratesummary; +mod hashrate_entry; +mod hashrate_summary; mod health; mod height; -mod heightparam; +mod height_param; mod hex; mod hour1; mod hour12; mod hour4; mod index; mod indexes; -mod indexinfo; +mod index_info; mod limit; -mod limitparam; -mod mempoolblock; -mod mempoolentryinfo; -mod mempoolinfo; +mod limit_param; +mod mempool_block; +mod mempool_entry_info; +mod mempool_info; mod metric; -mod metriccount; -mod metricdata; -mod metricinfo; -mod metricoutput; -mod metricparam; +mod metric_count; +mod metric_data; +mod metric_info; +mod metric_output; +mod metric_param; mod metrics; -mod metricselection; -mod metricselectionlegacy; -mod metricspaginated; -mod metricwithindex; +mod metric_selection; +mod metric_selection_legacy; +mod metrics_paginated; +mod metric_with_index; mod minute10; mod minute30; mod month1; mod month3; mod month6; mod ohlc; -mod opreturnindex; +mod op_return_index; mod option_ext; mod oracle_bins; mod outpoint; mod output; -mod outputtype; -mod p2aaddressindex; -mod p2abytes; -mod p2msoutputindex; -mod p2pk33addressindex; -mod p2pk33bytes; -mod p2pk65addressindex; -mod p2pk65bytes; -mod p2pkhaddressindex; -mod p2pkhbytes; -mod p2shaddressindex; -mod p2shbytes; -mod p2traddressindex; -mod p2trbytes; -mod p2wpkhaddressindex; -mod p2wpkhbytes; -mod p2wshaddressindex; -mod p2wshbytes; +mod output_type; +mod p2a_address_index; +mod p2a_bytes; +mod p2ms_output_index; +mod p2pk33_address_index; +mod p2pk33_bytes; +mod p2pk65_address_index; +mod p2pk65_bytes; +mod p2pkh_address_index; +mod p2pkh_bytes; +mod p2sh_address_index; +mod p2sh_bytes; +mod p2tr_address_index; +mod p2tr_bytes; +mod p2wpkh_address_index; +mod p2wpkh_bytes; +mod p2wsh_address_index; +mod p2wsh_bytes; mod pagination; -mod paginationindex; -mod pairoutputindex; +mod pagination_index; +mod pair_output_index; mod percentile; mod pool; -mod pooldetail; -mod poolinfo; +mod pool_detail; +mod pool_info; mod pools; -mod poolslug; -mod poolslugparam; -mod poolssummary; -mod poolstats; +mod pool_slug; +mod pool_slug_param; +mod pools_summary; +mod pool_stats; mod port; mod range_map; -mod rangeindex; -mod rawlocktime; -mod recommendedfees; -mod rewardstats; +mod range_index; +mod raw_locktime; +mod recommended_fees; +mod reward_stats; mod sats; mod sats_signed; -mod satsfract; -mod searchquery; +mod sats_fract; +mod search_query; mod stored_bool; mod stored_f32; mod stored_f64; @@ -163,32 +163,32 @@ mod stored_u32; mod stored_u64; mod stored_u8; mod supply_state; -mod syncstatus; +mod sync_status; mod term; -mod timeperiod; -mod timeperiodparam; +mod time_period; +mod time_period_param; mod timestamp; -mod timestampparam; -mod treenode; +mod timestamp_param; +mod tree_node; mod tx; mod txid; -mod txidparam; -mod txidprefix; -mod txidvout; +mod txid_param; +mod txid_prefix; +mod txid_vout; mod txin; -mod txindex; -mod txinindex; +mod tx_index; +mod txin_index; mod txout; -mod txoutindex; -mod txoutspend; -mod txstatus; -mod txversion; -mod txwithhex; -mod typeindex; +mod txout_index; +mod txout_spend; +mod tx_status; +mod tx_version; +mod tx_with_hex; +mod type_index; mod unit; -mod unknownoutputindex; +mod unknown_output_index; mod utxo; -mod validateaddressparam; +mod validate_address_param; mod vin; mod vout; mod vsize; @@ -199,41 +199,41 @@ mod year1; mod year10; pub use address::*; -pub use addressbytes::*; -pub use addresschainstats::*; -pub use addresshash::*; -pub use addressindexoutpoint::*; -pub use addressindextxindex::*; -pub use addressmempoolstats::*; -pub use addressparam::*; -pub use addressstats::*; -pub use addresstxidsparam::*; -pub use addressvalidation::*; +pub use address_bytes::*; +pub use address_chain_stats::*; +pub use address_hash::*; +pub use address_index_outpoint::*; +pub use address_index_tx_index::*; +pub use address_mempool_stats::*; +pub use address_param::*; +pub use address_stats::*; +pub use address_txids_param::*; +pub use address_validation::*; pub use age::*; -pub use anyaddressindex::*; +pub use any_address_index::*; pub use basis_points_16::*; pub use basis_points_32::*; pub use basis_points_signed_16::*; pub use basis_points_signed_32::*; pub use bitcoin::*; -pub use blkmetadata::*; -pub use blkposition::*; +pub use blk_metadata::*; +pub use blk_position::*; pub use block::*; -pub use blockcountparam::*; -pub use blockfeesentry::*; -pub use blockferatesentry::*; +pub use block_count_param::*; +pub use block_fees_entry::*; +pub use block_fee_rates_entry::*; pub use blockhash::*; -pub use blockhashparam::*; -pub use blockhashprefix::*; -pub use blockhashstartindex::*; -pub use blockhashtxindex::*; -pub use blockinfo::*; -pub use blockrewardsentry::*; -pub use blocksizeentry::*; -pub use blocksizesweights::*; -pub use blockstatus::*; -pub use blocktimestamp::*; -pub use blockweightentry::*; +pub use blockhash_param::*; +pub use blockhash_prefix::*; +pub use blockhash_start_index::*; +pub use blockhash_tx_index::*; +pub use block_info::*; +pub use block_rewards_entry::*; +pub use block_size_entry::*; +pub use block_sizes_weights::*; +pub use block_status::*; +pub use block_timestamp::*; +pub use block_weight_entry::*; pub use bytes::*; pub use cents::*; pub use cents_compact::*; @@ -244,109 +244,109 @@ pub use cost_basis_bucket::*; pub use cost_basis_distribution::*; pub use cost_basis_params::*; pub use cost_basis_value::*; -pub use datarange::*; -pub use datarangeformat::*; +pub use data_range::*; +pub use data_range_format::*; pub use date::*; pub use day1::*; pub use day3::*; pub use deser::*; -pub use difficultyadjustment::*; -pub use difficultyadjustmententry::*; -pub use difficultyentry::*; -pub use diskusage::*; +pub use difficulty_adjustment::*; +pub use difficulty_adjustment_entry::*; +pub use difficulty_entry::*; +pub use disk_usage::*; pub use dollars::*; -pub use emptyaddressdata::*; -pub use emptyaddressindex::*; -pub use emptyoutputindex::*; +pub use empty_address_data::*; +pub use empty_address_index::*; +pub use empty_output_index::*; pub use epoch::*; pub use etag::*; pub use feerate::*; -pub use feeratepercentiles::*; +pub use feerate_percentiles::*; pub use format::*; -pub use formatresponse::*; +pub use format_response::*; pub use from_coarser::*; -pub use fundedaddressdata::*; -pub use fundedaddressindex::*; +pub use funded_address_data::*; +pub use funded_address_index::*; pub use halving::*; -pub use hashrateentry::*; -pub use hashratesummary::*; +pub use hashrate_entry::*; +pub use hashrate_summary::*; pub use health::*; pub use height::*; -pub use heightparam::*; +pub use height_param::*; pub use hex::*; pub use hour1::*; pub use hour4::*; pub use hour12::*; pub use index::*; pub use indexes::*; -pub use indexinfo::*; +pub use index_info::*; pub use limit::*; -pub use limitparam::*; -pub use mempoolblock::*; -pub use mempoolentryinfo::*; -pub use mempoolinfo::*; +pub use limit_param::*; +pub use mempool_block::*; +pub use mempool_entry_info::*; +pub use mempool_info::*; pub use metric::*; -pub use metriccount::*; -pub use metricdata::*; -pub use metricinfo::*; -pub use metricoutput::*; -pub use metricparam::*; +pub use metric_count::*; +pub use metric_data::*; +pub use metric_info::*; +pub use metric_output::*; +pub use metric_param::*; pub use metrics::*; -pub use metricselection::*; -pub use metricselectionlegacy::*; -pub use metricspaginated::*; -pub use metricwithindex::*; +pub use metric_selection::*; +pub use metric_selection_legacy::*; +pub use metrics_paginated::*; +pub use metric_with_index::*; pub use minute10::*; pub use minute30::*; pub use month1::*; pub use month3::*; pub use month6::*; pub use ohlc::*; -pub use opreturnindex::*; +pub use op_return_index::*; pub use option_ext::*; pub use oracle_bins::*; pub use outpoint::*; pub use output::*; -pub use outputtype::*; -pub use p2aaddressindex::*; -pub use p2abytes::*; -pub use p2msoutputindex::*; -pub use p2pk33addressindex::*; -pub use p2pk33bytes::*; -pub use p2pk65addressindex::*; -pub use p2pk65bytes::*; -pub use p2pkhaddressindex::*; -pub use p2pkhbytes::*; -pub use p2shaddressindex::*; -pub use p2shbytes::*; -pub use p2traddressindex::*; -pub use p2trbytes::*; -pub use p2wpkhaddressindex::*; -pub use p2wpkhbytes::*; -pub use p2wshaddressindex::*; -pub use p2wshbytes::*; +pub use output_type::*; +pub use p2a_address_index::*; +pub use p2a_bytes::*; +pub use p2ms_output_index::*; +pub use p2pk33_address_index::*; +pub use p2pk33_bytes::*; +pub use p2pk65_address_index::*; +pub use p2pk65_bytes::*; +pub use p2pkh_address_index::*; +pub use p2pkh_bytes::*; +pub use p2sh_address_index::*; +pub use p2sh_bytes::*; +pub use p2tr_address_index::*; +pub use p2tr_bytes::*; +pub use p2wpkh_address_index::*; +pub use p2wpkh_bytes::*; +pub use p2wsh_address_index::*; +pub use p2wsh_bytes::*; pub use pagination::*; -pub use paginationindex::*; -pub use pairoutputindex::*; +pub use pagination_index::*; +pub use pair_output_index::*; pub use percentile::*; pub use pool::*; -pub use pooldetail::*; -pub use poolinfo::*; +pub use pool_detail::*; +pub use pool_info::*; pub use pools::*; -pub use poolslug::*; -pub use poolslugparam::*; -pub use poolssummary::*; -pub use poolstats::*; +pub use pool_slug::*; +pub use pool_slug_param::*; +pub use pools_summary::*; +pub use pool_stats::*; pub use port::*; pub use range_map::*; -pub use rangeindex::*; -pub use rawlocktime::*; -pub use recommendedfees::*; -pub use rewardstats::*; +pub use range_index::*; +pub use raw_locktime::*; +pub use recommended_fees::*; +pub use reward_stats::*; pub use sats::*; pub use sats_signed::*; -pub use satsfract::*; -pub use searchquery::*; +pub use sats_fract::*; +pub use search_query::*; pub use stored_bool::*; pub use stored_f32::*; pub use stored_f64::*; @@ -359,32 +359,32 @@ pub use stored_u16::*; pub use stored_u32::*; pub use stored_u64::*; pub use supply_state::*; -pub use syncstatus::*; +pub use sync_status::*; pub use term::*; -pub use timeperiod::*; -pub use timeperiodparam::*; +pub use time_period::*; +pub use time_period_param::*; pub use timestamp::*; -pub use timestampparam::*; -pub use treenode::*; +pub use timestamp_param::*; +pub use tree_node::*; pub use tx::*; pub use txid::*; -pub use txidparam::*; -pub use txidprefix::*; -pub use txidvout::*; +pub use txid_param::*; +pub use txid_prefix::*; +pub use txid_vout::*; pub use txin::*; -pub use txindex::*; -pub use txinindex::*; +pub use tx_index::*; +pub use txin_index::*; pub use txout::*; -pub use txoutindex::*; -pub use txoutspend::*; -pub use txstatus::*; -pub use txversion::*; -pub use txwithhex::*; -pub use typeindex::*; +pub use txout_index::*; +pub use txout_spend::*; +pub use tx_status::*; +pub use tx_version::*; +pub use tx_with_hex::*; +pub use type_index::*; pub use unit::*; -pub use unknownoutputindex::*; +pub use unknown_output_index::*; pub use utxo::*; -pub use validateaddressparam::*; +pub use validate_address_param::*; pub use vin::*; pub use vout::*; pub use vsize::*; diff --git a/crates/brk_types/src/op_return_index.rs b/crates/brk_types/src/op_return_index.rs index ab632036f..d4e1c5bcb 100644 --- a/crates/brk_types/src/op_return_index.rs +++ b/crates/brk_types/src/op_return_index.rs @@ -68,11 +68,11 @@ impl CheckedSub for OpReturnIndex { impl PrintableIndex for OpReturnIndex { fn to_string() -> &'static str { - "opreturnindex" + "op_return_index" } fn to_possible_strings() -> &'static [&'static str] { - &["op", "opreturn", "opreturnindex"] + &["op", "opreturn", "op_return_index"] } } diff --git a/crates/brk_types/src/outpoint.rs b/crates/brk_types/src/outpoint.rs index 7393c8c3b..18dc3544f 100644 --- a/crates/brk_types/src/outpoint.rs +++ b/crates/brk_types/src/outpoint.rs @@ -10,14 +10,14 @@ pub struct OutPoint(u64); impl OutPoint { pub const COINBASE: Self = Self(u64::MAX); - pub fn new(txindex: TxIndex, vout: Vout) -> Self { - let txindex_bits = u64::from(txindex) << 32; + pub fn new(tx_index: TxIndex, vout: Vout) -> Self { + let tx_index_bits = u64::from(tx_index) << 32; let vout_bits = u64::from(vout); - Self(txindex_bits | vout_bits) + Self(tx_index_bits | vout_bits) } #[inline(always)] - pub fn txindex(self) -> TxIndex { + pub fn tx_index(self) -> TxIndex { TxIndex::from((self.0 >> 32) as u32) } @@ -42,7 +42,7 @@ impl OutPoint { impl std::fmt::Display for OutPoint { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "txindex: {}, vout: {}", self.txindex(), self.vout()) + write!(f, "tx_index: {}, vout: {}", self.tx_index(), self.vout()) } } @@ -78,7 +78,7 @@ impl Serialize for OutPoint { { use serde::ser::SerializeStruct; let mut state = serializer.serialize_struct("OutPoint", 2)?; - state.serialize_field("txindex", &self.txindex())?; + state.serialize_field("tx_index", &self.tx_index())?; state.serialize_field("vout", &self.vout())?; state.end() } @@ -91,10 +91,10 @@ impl<'de> Deserialize<'de> for OutPoint { { #[derive(Deserialize)] struct Helper { - txindex: TxIndex, + tx_index: TxIndex, vout: Vout, } let h = Helper::deserialize(deserializer)?; - Ok(Self::new(h.txindex, h.vout)) + Ok(Self::new(h.tx_index, h.vout)) } } diff --git a/crates/brk_types/src/p2a_address_index.rs b/crates/brk_types/src/p2a_address_index.rs index 0a89fa8c2..968dbed24 100644 --- a/crates/brk_types/src/p2a_address_index.rs +++ b/crates/brk_types/src/p2a_address_index.rs @@ -89,11 +89,11 @@ impl CheckedSub for P2AAddressIndex { impl PrintableIndex for P2AAddressIndex { fn to_string() -> &'static str { - "p2aaddressindex" + "p2a_address_index" } fn to_possible_strings() -> &'static [&'static str] { - &["aaddr", "p2aaddr", "p2aaddressindex"] + &["aaddr", "p2aaddr", "p2a_address_index"] } } diff --git a/crates/brk_types/src/p2ms_output_index.rs b/crates/brk_types/src/p2ms_output_index.rs index 5b228ad83..d08254dac 100644 --- a/crates/brk_types/src/p2ms_output_index.rs +++ b/crates/brk_types/src/p2ms_output_index.rs @@ -68,11 +68,11 @@ impl CheckedSub for P2MSOutputIndex { impl PrintableIndex for P2MSOutputIndex { fn to_string() -> &'static str { - "p2msoutputindex" + "p2ms_output_index" } fn to_possible_strings() -> &'static [&'static str] { - &["msout", "p2msout", "p2msoutputindex"] + &["msout", "p2msout", "p2ms_output_index"] } } diff --git a/crates/brk_types/src/p2pk33_address_index.rs b/crates/brk_types/src/p2pk33_address_index.rs index 9eba5f2de..e13e3045e 100644 --- a/crates/brk_types/src/p2pk33_address_index.rs +++ b/crates/brk_types/src/p2pk33_address_index.rs @@ -89,11 +89,11 @@ impl CheckedSub for P2PK33AddressIndex { impl PrintableIndex for P2PK33AddressIndex { fn to_string() -> &'static str { - "p2pk33addressindex" + "p2pk33_address_index" } fn to_possible_strings() -> &'static [&'static str] { - &["pk33addr", "p2pk33addr", "p2pk33addressindex"] + &["pk33addr", "p2pk33addr", "p2pk33_address_index"] } } diff --git a/crates/brk_types/src/p2pk65_address_index.rs b/crates/brk_types/src/p2pk65_address_index.rs index 515d93c87..bcf74c49d 100644 --- a/crates/brk_types/src/p2pk65_address_index.rs +++ b/crates/brk_types/src/p2pk65_address_index.rs @@ -89,10 +89,10 @@ impl CheckedSub for P2PK65AddressIndex { impl PrintableIndex for P2PK65AddressIndex { fn to_string() -> &'static str { - "p2pk65addressindex" + "p2pk65_address_index" } fn to_possible_strings() -> &'static [&'static str] { - &["pk65addr", "p2pk65addr", "p2pk65addressindex"] + &["pk65addr", "p2pk65addr", "p2pk65_address_index"] } } diff --git a/crates/brk_types/src/p2pkh_address_index.rs b/crates/brk_types/src/p2pkh_address_index.rs index 65508aec8..3ad300ac9 100644 --- a/crates/brk_types/src/p2pkh_address_index.rs +++ b/crates/brk_types/src/p2pkh_address_index.rs @@ -89,11 +89,11 @@ impl CheckedSub for P2PKHAddressIndex { impl PrintableIndex for P2PKHAddressIndex { fn to_string() -> &'static str { - "p2pkhaddressindex" + "p2pkh_address_index" } fn to_possible_strings() -> &'static [&'static str] { - &["pkhaddr", "p2pkhaddr", "p2pkhaddressindex"] + &["pkhaddr", "p2pkhaddr", "p2pkh_address_index"] } } diff --git a/crates/brk_types/src/p2sh_address_index.rs b/crates/brk_types/src/p2sh_address_index.rs index 08aa0e788..41730d526 100644 --- a/crates/brk_types/src/p2sh_address_index.rs +++ b/crates/brk_types/src/p2sh_address_index.rs @@ -96,11 +96,11 @@ impl CheckedSub for P2SHAddressIndex { impl PrintableIndex for P2SHAddressIndex { fn to_string() -> &'static str { - "p2shaddressindex" + "p2sh_address_index" } fn to_possible_strings() -> &'static [&'static str] { - &["shaddr", "p2shaddr", "p2shaddressindex"] + &["shaddr", "p2shaddr", "p2sh_address_index"] } } diff --git a/crates/brk_types/src/p2tr_address_index.rs b/crates/brk_types/src/p2tr_address_index.rs index ff9df5fc5..a29788189 100644 --- a/crates/brk_types/src/p2tr_address_index.rs +++ b/crates/brk_types/src/p2tr_address_index.rs @@ -89,11 +89,11 @@ impl CheckedSub for P2TRAddressIndex { impl PrintableIndex for P2TRAddressIndex { fn to_string() -> &'static str { - "p2traddressindex" + "p2tr_address_index" } fn to_possible_strings() -> &'static [&'static str] { - &["traddr", "p2traddr", "p2traddressindex"] + &["traddr", "p2traddr", "p2tr_address_index"] } } diff --git a/crates/brk_types/src/p2wpkh_address_index.rs b/crates/brk_types/src/p2wpkh_address_index.rs index 7c58e7e49..7a2fde7e6 100644 --- a/crates/brk_types/src/p2wpkh_address_index.rs +++ b/crates/brk_types/src/p2wpkh_address_index.rs @@ -89,11 +89,11 @@ impl CheckedSub for P2WPKHAddressIndex { impl PrintableIndex for P2WPKHAddressIndex { fn to_string() -> &'static str { - "p2wpkhaddressindex" + "p2wpkh_address_index" } fn to_possible_strings() -> &'static [&'static str] { - &["wpkhaddr", "p2wpkhaddr", "p2wpkhaddressindex"] + &["wpkhaddr", "p2wpkhaddr", "p2wpkh_address_index"] } } diff --git a/crates/brk_types/src/p2wsh_address_index.rs b/crates/brk_types/src/p2wsh_address_index.rs index 4b116d04e..3ec026b09 100644 --- a/crates/brk_types/src/p2wsh_address_index.rs +++ b/crates/brk_types/src/p2wsh_address_index.rs @@ -89,11 +89,11 @@ impl CheckedSub for P2WSHAddressIndex { impl PrintableIndex for P2WSHAddressIndex { fn to_string() -> &'static str { - "p2wshaddressindex" + "p2wsh_address_index" } fn to_possible_strings() -> &'static [&'static str] { - &["wshaddr", "p2wshaddr", "p2wshaddressindex"] + &["wshaddr", "p2wshaddr", "p2wsh_address_index"] } } diff --git a/crates/brk_types/src/pair_output_index.rs b/crates/brk_types/src/pair_output_index.rs index 54442eb94..0cfcea24b 100644 --- a/crates/brk_types/src/pair_output_index.rs +++ b/crates/brk_types/src/pair_output_index.rs @@ -97,11 +97,11 @@ impl From for usize { impl PrintableIndex for PairOutputIndex { fn to_string() -> &'static str { - "pairoutputindex" + "pair_output_index" } fn to_possible_strings() -> &'static [&'static str] { - &["pairoutput", "pairoutputindex"] + &["pairoutput", "pair_output_index"] } } diff --git a/crates/brk_types/src/tx_index.rs b/crates/brk_types/src/tx_index.rs index 28832cad5..a00dda948 100644 --- a/crates/brk_types/src/tx_index.rs +++ b/crates/brk_types/src/tx_index.rs @@ -31,8 +31,8 @@ impl TxIndex { pub const ZERO: Self = Self(0); pub const COINBASE: Self = Self(u32::MAX); - pub fn new(txindex: u32) -> Self { - Self(txindex) + pub fn new(tx_index: u32) -> Self { + Self(tx_index) } pub fn incremented(self) -> Self { @@ -152,11 +152,11 @@ impl From for StoredU32 { impl PrintableIndex for TxIndex { fn to_string() -> &'static str { - "txindex" + "tx_index" } fn to_possible_strings() -> &'static [&'static str] { - &["tx", "txindex"] + &["tx", "tx_index"] } } diff --git a/crates/brk_types/src/txin_index.rs b/crates/brk_types/src/txin_index.rs index 24a0c5ffe..cf70318c3 100644 --- a/crates/brk_types/src/txin_index.rs +++ b/crates/brk_types/src/txin_index.rs @@ -113,11 +113,11 @@ impl From for usize { impl PrintableIndex for TxInIndex { fn to_string() -> &'static str { - "txinindex" + "txin_index" } fn to_possible_strings() -> &'static [&'static str] { - &["txi", "txin", "txinindex"] + &["txi", "txin", "txin_index"] } } diff --git a/crates/brk_types/src/txout_index.rs b/crates/brk_types/src/txout_index.rs index 2c40855ba..d09c397d1 100644 --- a/crates/brk_types/src/txout_index.rs +++ b/crates/brk_types/src/txout_index.rs @@ -114,11 +114,11 @@ impl From for usize { impl PrintableIndex for TxOutIndex { fn to_string() -> &'static str { - "txoutindex" + "txout_index" } fn to_possible_strings() -> &'static [&'static str] { - &["txo", "txout", "txoutindex"] + &["txo", "txout", "txout_index"] } } diff --git a/crates/brk_types/src/unknown_output_index.rs b/crates/brk_types/src/unknown_output_index.rs index dbef942f0..24ca4bcc7 100644 --- a/crates/brk_types/src/unknown_output_index.rs +++ b/crates/brk_types/src/unknown_output_index.rs @@ -63,11 +63,11 @@ impl CheckedSub for UnknownOutputIndex { impl PrintableIndex for UnknownOutputIndex { fn to_string() -> &'static str { - "unknownoutputindex" + "unknown_output_index" } fn to_possible_strings() -> &'static [&'static str] { - &["unknownout", "unknownoutputindex"] + &["unknownout", "unknown_output_index"] } } diff --git a/modules/brk-client/index.js b/modules/brk-client/index.js index 551f1a4cf..aa2717c79 100644 --- a/modules/brk-client/index.js +++ b/modules/brk-client/index.js @@ -424,7 +424,7 @@ /** @typedef {number} Hour4 */ /** * Aggregation dimension for querying metrics. Includes time-based (date, week, month, year), - * block-based (height, txindex), and address/output type indexes. + * block-based (height, tx_index), and address/output type indexes. * * @typedef {("minute10"|"minute30"|"hour1"|"hour4"|"hour12"|"day1"|"day3"|"week1"|"month1"|"month3"|"month6"|"year1"|"year10"|"halving"|"epoch"|"height"|"txindex"|"txinindex"|"txoutindex"|"emptyoutputindex"|"opreturnindex"|"p2aaddressindex"|"p2msoutputindex"|"p2pk33addressindex"|"p2pk65addressindex"|"p2pkhaddressindex"|"p2shaddressindex"|"p2traddressindex"|"p2wpkhaddressindex"|"p2wshaddressindex"|"unknownoutputindex"|"fundedaddressindex"|"emptyaddressindex"|"pairoutputindex")} Index */ @@ -1452,23 +1452,23 @@ const _i15 = /** @type {const} */ (["year10"]); const _i16 = /** @type {const} */ (["halving"]); const _i17 = /** @type {const} */ (["epoch"]); const _i18 = /** @type {const} */ (["height"]); -const _i19 = /** @type {const} */ (["txindex"]); -const _i20 = /** @type {const} */ (["txinindex"]); -const _i21 = /** @type {const} */ (["txoutindex"]); -const _i22 = /** @type {const} */ (["emptyoutputindex"]); -const _i23 = /** @type {const} */ (["opreturnindex"]); -const _i24 = /** @type {const} */ (["p2aaddressindex"]); -const _i25 = /** @type {const} */ (["p2msoutputindex"]); -const _i26 = /** @type {const} */ (["p2pk33addressindex"]); -const _i27 = /** @type {const} */ (["p2pk65addressindex"]); -const _i28 = /** @type {const} */ (["p2pkhaddressindex"]); -const _i29 = /** @type {const} */ (["p2shaddressindex"]); -const _i30 = /** @type {const} */ (["p2traddressindex"]); -const _i31 = /** @type {const} */ (["p2wpkhaddressindex"]); -const _i32 = /** @type {const} */ (["p2wshaddressindex"]); -const _i33 = /** @type {const} */ (["unknownoutputindex"]); -const _i34 = /** @type {const} */ (["fundedaddressindex"]); -const _i35 = /** @type {const} */ (["emptyaddressindex"]); +const _i19 = /** @type {const} */ (["tx_index"]); +const _i20 = /** @type {const} */ (["txin_index"]); +const _i21 = /** @type {const} */ (["txout_index"]); +const _i22 = /** @type {const} */ (["empty_output_index"]); +const _i23 = /** @type {const} */ (["op_return_index"]); +const _i24 = /** @type {const} */ (["p2a_address_index"]); +const _i25 = /** @type {const} */ (["p2ms_output_index"]); +const _i26 = /** @type {const} */ (["p2pk33_address_index"]); +const _i27 = /** @type {const} */ (["p2pk65_address_index"]); +const _i28 = /** @type {const} */ (["p2pkh_address_index"]); +const _i29 = /** @type {const} */ (["p2sh_address_index"]); +const _i30 = /** @type {const} */ (["p2tr_address_index"]); +const _i31 = /** @type {const} */ (["p2wpkh_address_index"]); +const _i32 = /** @type {const} */ (["p2wsh_address_index"]); +const _i33 = /** @type {const} */ (["unknown_output_index"]); +const _i34 = /** @type {const} */ (["funded_address_index"]); +const _i35 = /** @type {const} */ (["empty_address_index"]); /** * Generic metric pattern factory. @@ -1550,55 +1550,55 @@ function createMetricPattern17(client, name) { return /** @type {MetricPattern17 /** @template T @typedef {{ name: string, by: { readonly height: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern18 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern18} */ function createMetricPattern18(client, name) { return /** @type {MetricPattern18} */ (_mp(client, name, _i18)); } -/** @template T @typedef {{ name: string, by: { readonly txindex: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern19 */ +/** @template T @typedef {{ name: string, by: { readonly tx_index: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern19 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern19} */ function createMetricPattern19(client, name) { return /** @type {MetricPattern19} */ (_mp(client, name, _i19)); } -/** @template T @typedef {{ name: string, by: { readonly txinindex: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern20 */ +/** @template T @typedef {{ name: string, by: { readonly txin_index: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern20 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern20} */ function createMetricPattern20(client, name) { return /** @type {MetricPattern20} */ (_mp(client, name, _i20)); } -/** @template T @typedef {{ name: string, by: { readonly txoutindex: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern21 */ +/** @template T @typedef {{ name: string, by: { readonly txout_index: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern21 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern21} */ function createMetricPattern21(client, name) { return /** @type {MetricPattern21} */ (_mp(client, name, _i21)); } -/** @template T @typedef {{ name: string, by: { readonly emptyoutputindex: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern22 */ +/** @template T @typedef {{ name: string, by: { readonly empty_output_index: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern22 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern22} */ function createMetricPattern22(client, name) { return /** @type {MetricPattern22} */ (_mp(client, name, _i22)); } -/** @template T @typedef {{ name: string, by: { readonly opreturnindex: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern23 */ +/** @template T @typedef {{ name: string, by: { readonly op_return_index: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern23 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern23} */ function createMetricPattern23(client, name) { return /** @type {MetricPattern23} */ (_mp(client, name, _i23)); } -/** @template T @typedef {{ name: string, by: { readonly p2aaddressindex: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern24 */ +/** @template T @typedef {{ name: string, by: { readonly p2a_address_index: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern24 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern24} */ function createMetricPattern24(client, name) { return /** @type {MetricPattern24} */ (_mp(client, name, _i24)); } -/** @template T @typedef {{ name: string, by: { readonly p2msoutputindex: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern25 */ +/** @template T @typedef {{ name: string, by: { readonly p2ms_output_index: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern25 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern25} */ function createMetricPattern25(client, name) { return /** @type {MetricPattern25} */ (_mp(client, name, _i25)); } -/** @template T @typedef {{ name: string, by: { readonly p2pk33addressindex: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern26 */ +/** @template T @typedef {{ name: string, by: { readonly p2pk33_address_index: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern26 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern26} */ function createMetricPattern26(client, name) { return /** @type {MetricPattern26} */ (_mp(client, name, _i26)); } -/** @template T @typedef {{ name: string, by: { readonly p2pk65addressindex: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern27 */ +/** @template T @typedef {{ name: string, by: { readonly p2pk65_address_index: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern27 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern27} */ function createMetricPattern27(client, name) { return /** @type {MetricPattern27} */ (_mp(client, name, _i27)); } -/** @template T @typedef {{ name: string, by: { readonly p2pkhaddressindex: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern28 */ +/** @template T @typedef {{ name: string, by: { readonly p2pkh_address_index: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern28 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern28} */ function createMetricPattern28(client, name) { return /** @type {MetricPattern28} */ (_mp(client, name, _i28)); } -/** @template T @typedef {{ name: string, by: { readonly p2shaddressindex: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern29 */ +/** @template T @typedef {{ name: string, by: { readonly p2sh_address_index: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern29 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern29} */ function createMetricPattern29(client, name) { return /** @type {MetricPattern29} */ (_mp(client, name, _i29)); } -/** @template T @typedef {{ name: string, by: { readonly p2traddressindex: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern30 */ +/** @template T @typedef {{ name: string, by: { readonly p2tr_address_index: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern30 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern30} */ function createMetricPattern30(client, name) { return /** @type {MetricPattern30} */ (_mp(client, name, _i30)); } -/** @template T @typedef {{ name: string, by: { readonly p2wpkhaddressindex: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern31 */ +/** @template T @typedef {{ name: string, by: { readonly p2wpkh_address_index: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern31 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern31} */ function createMetricPattern31(client, name) { return /** @type {MetricPattern31} */ (_mp(client, name, _i31)); } -/** @template T @typedef {{ name: string, by: { readonly p2wshaddressindex: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern32 */ +/** @template T @typedef {{ name: string, by: { readonly p2wsh_address_index: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern32 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern32} */ function createMetricPattern32(client, name) { return /** @type {MetricPattern32} */ (_mp(client, name, _i32)); } -/** @template T @typedef {{ name: string, by: { readonly unknownoutputindex: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern33 */ +/** @template T @typedef {{ name: string, by: { readonly unknown_output_index: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern33 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern33} */ function createMetricPattern33(client, name) { return /** @type {MetricPattern33} */ (_mp(client, name, _i33)); } -/** @template T @typedef {{ name: string, by: { readonly fundedaddressindex: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern34 */ +/** @template T @typedef {{ name: string, by: { readonly funded_address_index: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern34 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern34} */ function createMetricPattern34(client, name) { return /** @type {MetricPattern34} */ (_mp(client, name, _i34)); } -/** @template T @typedef {{ name: string, by: { readonly emptyaddressindex: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern35 */ +/** @template T @typedef {{ name: string, by: { readonly empty_address_index: MetricEndpointBuilder }, indexes: () => readonly Index[], get: (index: Index) => MetricEndpointBuilder|undefined }} MetricPattern35 */ /** @template T @param {BrkClientBase} client @param {string} name @returns {MetricPattern35} */ function createMetricPattern35(client, name) { return /** @type {MetricPattern35} */ (_mp(client, name, _i35)); } @@ -1704,18 +1704,18 @@ function create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern(client, a /** * @typedef {Object} _10y1m1w1y2y3m3y4y5y6m6y8yPattern2 - * @property {BpsPercentRatioPattern2} _10y - * @property {BpsPercentRatioPattern2} _1m - * @property {BpsPercentRatioPattern2} _1w - * @property {BpsPercentRatioPattern2} _1y - * @property {BpsPercentRatioPattern2} _2y - * @property {BpsPercentRatioPattern2} _3m - * @property {BpsPercentRatioPattern2} _3y - * @property {BpsPercentRatioPattern2} _4y - * @property {BpsPercentRatioPattern2} _5y - * @property {BpsPercentRatioPattern2} _6m - * @property {BpsPercentRatioPattern2} _6y - * @property {BpsPercentRatioPattern2} _8y + * @property {BpsPercentRatioPattern} _10y + * @property {BpsPercentRatioPattern} _1m + * @property {BpsPercentRatioPattern} _1w + * @property {BpsPercentRatioPattern} _1y + * @property {BpsPercentRatioPattern} _2y + * @property {BpsPercentRatioPattern} _3m + * @property {BpsPercentRatioPattern} _3y + * @property {BpsPercentRatioPattern} _4y + * @property {BpsPercentRatioPattern} _5y + * @property {BpsPercentRatioPattern} _6m + * @property {BpsPercentRatioPattern} _6y + * @property {BpsPercentRatioPattern} _8y */ /** @@ -1726,18 +1726,18 @@ function create_0sdM0M1M1sdM2M2sdM3sdP0P1P1sdP2P2sdP3sdSdZscorePattern(client, a */ function create_10y1m1w1y2y3m3y4y5y6m6y8yPattern2(client, acc) { return { - _10y: createBpsPercentRatioPattern2(client, _m(acc, '10y')), - _1m: createBpsPercentRatioPattern2(client, _m(acc, '1m')), - _1w: createBpsPercentRatioPattern2(client, _m(acc, '1w')), - _1y: createBpsPercentRatioPattern2(client, _m(acc, '1y')), - _2y: createBpsPercentRatioPattern2(client, _m(acc, '2y')), - _3m: createBpsPercentRatioPattern2(client, _m(acc, '3m')), - _3y: createBpsPercentRatioPattern2(client, _m(acc, '3y')), - _4y: createBpsPercentRatioPattern2(client, _m(acc, '4y')), - _5y: createBpsPercentRatioPattern2(client, _m(acc, '5y')), - _6m: createBpsPercentRatioPattern2(client, _m(acc, '6m')), - _6y: createBpsPercentRatioPattern2(client, _m(acc, '6y')), - _8y: createBpsPercentRatioPattern2(client, _m(acc, '8y')), + _10y: createBpsPercentRatioPattern(client, _m(acc, '10y')), + _1m: createBpsPercentRatioPattern(client, _m(acc, '1m')), + _1w: createBpsPercentRatioPattern(client, _m(acc, '1w')), + _1y: createBpsPercentRatioPattern(client, _m(acc, '1y')), + _2y: createBpsPercentRatioPattern(client, _m(acc, '2y')), + _3m: createBpsPercentRatioPattern(client, _m(acc, '3m')), + _3y: createBpsPercentRatioPattern(client, _m(acc, '3y')), + _4y: createBpsPercentRatioPattern(client, _m(acc, '4y')), + _5y: createBpsPercentRatioPattern(client, _m(acc, '5y')), + _6m: createBpsPercentRatioPattern(client, _m(acc, '6m')), + _6y: createBpsPercentRatioPattern(client, _m(acc, '6y')), + _8y: createBpsPercentRatioPattern(client, _m(acc, '8y')), }; } @@ -1792,7 +1792,7 @@ function create_10y1m1w1y2y3m3y4y5y6m6y8yPattern3(client, acc) { * @property {BpsCentsPercentilesRatioSatsSmaStdUsdPattern} price * @property {BaseCumulativeDistributionRelSumValuePattern} profit * @property {_1m1w1y24hPattern} profitToLossRatio - * @property {_1m1w1y24hPattern2} sellSideRiskRatio + * @property {_1m1w1y24hPattern6} sellSideRiskRatio * @property {AdjustedRatioValuePattern} sopr */ @@ -1814,7 +1814,7 @@ function createCapGrossInvestorLossMvrvNetPeakPriceProfitSellSoprPattern(client, price: createBpsCentsPercentilesRatioSatsSmaStdUsdPattern(client, _m(acc, 'realized_price')), profit: createBaseCumulativeDistributionRelSumValuePattern(client, acc), profitToLossRatio: create_1m1w1y24hPattern(client, _m(acc, 'realized_profit_to_loss_ratio')), - sellSideRiskRatio: create_1m1w1y24hPattern2(client, _m(acc, 'sell_side_risk_ratio')), + sellSideRiskRatio: create_1m1w1y24hPattern6(client, _m(acc, 'sell_side_risk_ratio')), sopr: createAdjustedRatioValuePattern(client, acc), }; } @@ -1899,12 +1899,12 @@ function createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern(c * @property {MetricPattern1} averageLoss * @property {MetricPattern1} gains * @property {MetricPattern1} losses - * @property {BpsPercentRatioPattern4} rsi - * @property {BpsPercentRatioPattern4} rsiMax - * @property {BpsPercentRatioPattern4} rsiMin - * @property {BpsPercentRatioPattern4} stochRsi - * @property {BpsPercentRatioPattern4} stochRsiD - * @property {BpsPercentRatioPattern4} stochRsiK + * @property {BpsPercentRatioPattern3} rsi + * @property {BpsPercentRatioPattern3} rsiMax + * @property {BpsPercentRatioPattern3} rsiMin + * @property {BpsPercentRatioPattern3} stochRsi + * @property {BpsPercentRatioPattern3} stochRsiD + * @property {BpsPercentRatioPattern3} stochRsiK */ /** @@ -1919,12 +1919,12 @@ function createAverageGainsLossesRsiStochPattern(client, acc) { averageLoss: createMetricPattern1(client, _m(acc, 'average_loss_24h')), gains: createMetricPattern1(client, _m(acc, 'gains_24h')), losses: createMetricPattern1(client, _m(acc, 'losses_24h')), - rsi: createBpsPercentRatioPattern4(client, _m(acc, '24h')), - rsiMax: createBpsPercentRatioPattern4(client, _m(acc, 'max_24h')), - rsiMin: createBpsPercentRatioPattern4(client, _m(acc, 'min_24h')), - stochRsi: createBpsPercentRatioPattern4(client, _m(acc, 'stoch_24h')), - stochRsiD: createBpsPercentRatioPattern4(client, _m(acc, 'stoch_d_24h')), - stochRsiK: createBpsPercentRatioPattern4(client, _m(acc, 'stoch_k_24h')), + rsi: createBpsPercentRatioPattern3(client, _m(acc, '24h')), + rsiMax: createBpsPercentRatioPattern3(client, _m(acc, 'max_24h')), + rsiMin: createBpsPercentRatioPattern3(client, _m(acc, 'min_24h')), + stochRsi: createBpsPercentRatioPattern3(client, _m(acc, 'stoch_24h')), + stochRsiD: createBpsPercentRatioPattern3(client, _m(acc, 'stoch_d_24h')), + stochRsiK: createBpsPercentRatioPattern3(client, _m(acc, 'stoch_k_24h')), }; } @@ -2031,8 +2031,8 @@ function createAverageMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, acc) { * @property {MetricPattern1} capitulationFlow * @property {CentsUsdPattern2} cumulative * @property {MetricPattern1} negative - * @property {BpsPercentRatioPattern} relToRcap - * @property {_1m1w1y24hPattern5} sum + * @property {BpsPercentRatioPattern4} relToRcap + * @property {_1m1w1y24hPattern4} sum * @property {BaseCumulativeSumPattern} valueCreated * @property {BaseCumulativeSumPattern} valueDestroyed */ @@ -2049,8 +2049,8 @@ function createBaseCapitulationCumulativeNegativeRelSumValuePattern(client, acc) capitulationFlow: createMetricPattern1(client, _m(acc, 'capitulation_flow')), cumulative: createCentsUsdPattern2(client, _m(acc, 'realized_loss_cumulative')), negative: createMetricPattern1(client, _m(acc, 'neg_realized_loss')), - relToRcap: createBpsPercentRatioPattern(client, _m(acc, 'realized_loss_rel_to_rcap')), - sum: create_1m1w1y24hPattern5(client, _m(acc, 'realized_loss_sum')), + relToRcap: createBpsPercentRatioPattern4(client, _m(acc, 'realized_loss_rel_to_rcap')), + sum: create_1m1w1y24hPattern4(client, _m(acc, 'realized_loss_sum')), valueCreated: createBaseCumulativeSumPattern(client, _m(acc, 'loss_value_created')), valueDestroyed: createBaseCumulativeSumPattern(client, _m(acc, 'loss_value_destroyed')), }; @@ -2122,13 +2122,13 @@ function createAverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2(client, acc) { /** * @typedef {Object} _10y2y3y4y5y6y8yPattern - * @property {BpsPercentRatioPattern2} _10y - * @property {BpsPercentRatioPattern2} _2y - * @property {BpsPercentRatioPattern2} _3y - * @property {BpsPercentRatioPattern2} _4y - * @property {BpsPercentRatioPattern2} _5y - * @property {BpsPercentRatioPattern2} _6y - * @property {BpsPercentRatioPattern2} _8y + * @property {BpsPercentRatioPattern} _10y + * @property {BpsPercentRatioPattern} _2y + * @property {BpsPercentRatioPattern} _3y + * @property {BpsPercentRatioPattern} _4y + * @property {BpsPercentRatioPattern} _5y + * @property {BpsPercentRatioPattern} _6y + * @property {BpsPercentRatioPattern} _8y */ /** @@ -2139,22 +2139,22 @@ function createAverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2(client, acc) { */ function create_10y2y3y4y5y6y8yPattern(client, acc) { return { - _10y: createBpsPercentRatioPattern2(client, _m(acc, '10y')), - _2y: createBpsPercentRatioPattern2(client, _m(acc, '2y')), - _3y: createBpsPercentRatioPattern2(client, _m(acc, '3y')), - _4y: createBpsPercentRatioPattern2(client, _m(acc, '4y')), - _5y: createBpsPercentRatioPattern2(client, _m(acc, '5y')), - _6y: createBpsPercentRatioPattern2(client, _m(acc, '6y')), - _8y: createBpsPercentRatioPattern2(client, _m(acc, '8y')), + _10y: createBpsPercentRatioPattern(client, _m(acc, '10y')), + _2y: createBpsPercentRatioPattern(client, _m(acc, '2y')), + _3y: createBpsPercentRatioPattern(client, _m(acc, '3y')), + _4y: createBpsPercentRatioPattern(client, _m(acc, '4y')), + _5y: createBpsPercentRatioPattern(client, _m(acc, '5y')), + _6y: createBpsPercentRatioPattern(client, _m(acc, '6y')), + _8y: createBpsPercentRatioPattern(client, _m(acc, '8y')), }; } /** * @typedef {Object} _1m1w1y24hBpsPercentRatioPattern - * @property {BpsPercentRatioPattern4} _1m - * @property {BpsPercentRatioPattern4} _1w - * @property {BpsPercentRatioPattern4} _1y - * @property {BpsPercentRatioPattern4} _24h + * @property {BpsPercentRatioPattern3} _1m + * @property {BpsPercentRatioPattern3} _1w + * @property {BpsPercentRatioPattern3} _1y + * @property {BpsPercentRatioPattern3} _24h * @property {MetricPattern1} bps * @property {MetricPattern1} percent * @property {MetricPattern1} ratio @@ -2168,10 +2168,10 @@ function create_10y2y3y4y5y6y8yPattern(client, acc) { */ function create_1m1w1y24hBpsPercentRatioPattern(client, acc) { return { - _1m: createBpsPercentRatioPattern4(client, _m(acc, '1m')), - _1w: createBpsPercentRatioPattern4(client, _m(acc, '1w')), - _1y: createBpsPercentRatioPattern4(client, _m(acc, '1y')), - _24h: createBpsPercentRatioPattern4(client, _m(acc, '24h')), + _1m: createBpsPercentRatioPattern3(client, _m(acc, '1m')), + _1w: createBpsPercentRatioPattern3(client, _m(acc, '1w')), + _1y: createBpsPercentRatioPattern3(client, _m(acc, '1y')), + _24h: createBpsPercentRatioPattern3(client, _m(acc, '24h')), bps: createMetricPattern1(client, _m(acc, 'bps')), percent: createMetricPattern1(client, acc), ratio: createMetricPattern1(client, _m(acc, 'ratio')), @@ -2183,8 +2183,8 @@ function create_1m1w1y24hBpsPercentRatioPattern(client, acc) { * @property {CentsUsdPattern2} base * @property {CentsUsdPattern2} cumulative * @property {MetricPattern1} distributionFlow - * @property {BpsPercentRatioPattern} relToRcap - * @property {_1m1w1y24hPattern5} sum + * @property {BpsPercentRatioPattern4} relToRcap + * @property {_1m1w1y24hPattern4} sum * @property {BaseCumulativeSumPattern} valueCreated * @property {BaseCumulativeSumPattern} valueDestroyed */ @@ -2200,8 +2200,8 @@ function createBaseCumulativeDistributionRelSumValuePattern(client, acc) { base: createCentsUsdPattern2(client, _m(acc, 'realized_profit')), cumulative: createCentsUsdPattern2(client, _m(acc, 'realized_profit_cumulative')), distributionFlow: createMetricPattern1(client, _m(acc, 'distribution_flow')), - relToRcap: createBpsPercentRatioPattern(client, _m(acc, 'realized_profit_rel_to_rcap')), - sum: create_1m1w1y24hPattern5(client, _m(acc, 'realized_profit_sum')), + relToRcap: createBpsPercentRatioPattern4(client, _m(acc, 'realized_profit_rel_to_rcap')), + sum: create_1m1w1y24hPattern4(client, _m(acc, 'realized_profit_sum')), valueCreated: createBaseCumulativeSumPattern(client, _m(acc, 'profit_value_created')), valueDestroyed: createBaseCumulativeSumPattern(client, _m(acc, 'profit_value_destroyed')), }; @@ -2212,10 +2212,10 @@ function createBaseCumulativeDistributionRelSumValuePattern(client, acc) { * @property {CentsUsdPattern2} base * @property {CentsUsdPattern2} cumulative * @property {MetricPattern1} negative - * @property {BpsPercentRatioPattern4} relToMcap - * @property {BpsPercentRatioPattern4} relToOwnGross - * @property {BpsPercentRatioPattern} relToOwnMcap - * @property {_1m1w1y24hPattern5} sum + * @property {BpsPercentRatioPattern3} relToMcap + * @property {BpsPercentRatioPattern3} relToOwnGross + * @property {BpsPercentRatioPattern4} relToOwnMcap + * @property {_1m1w1y24hPattern4} sum */ /** @@ -2229,10 +2229,10 @@ function createBaseCumulativeNegativeRelSumPattern2(client, acc) { base: createCentsUsdPattern2(client, _m(acc, 'unrealized_loss')), cumulative: createCentsUsdPattern2(client, _m(acc, 'unrealized_loss_cumulative')), negative: createMetricPattern1(client, _m(acc, 'neg_unrealized_loss')), - relToMcap: createBpsPercentRatioPattern4(client, _m(acc, 'unrealized_loss_rel_to_mcap')), - relToOwnGross: createBpsPercentRatioPattern4(client, _m(acc, 'unrealized_loss_rel_to_own_gross_pnl')), - relToOwnMcap: createBpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_own_mcap')), - sum: create_1m1w1y24hPattern5(client, _m(acc, 'unrealized_loss_sum')), + relToMcap: createBpsPercentRatioPattern3(client, _m(acc, 'unrealized_loss_rel_to_mcap')), + relToOwnGross: createBpsPercentRatioPattern3(client, _m(acc, 'unrealized_loss_rel_to_own_gross_pnl')), + relToOwnMcap: createBpsPercentRatioPattern4(client, _m(acc, 'unrealized_loss_rel_to_own_mcap')), + sum: create_1m1w1y24hPattern4(client, _m(acc, 'unrealized_loss_sum')), }; } @@ -2326,9 +2326,9 @@ function create_1m1w1y2y4yAllPattern(client, acc) { * @property {CentsUsdPattern} base * @property {RelPattern} change1m * @property {CentsUsdPattern} cumulative - * @property {ChangeRatePattern3} delta - * @property {BpsPercentRatioPattern2} relToRcap - * @property {_1m1w1y24hPattern4} sum + * @property {ChangeRatePattern2} delta + * @property {BpsPercentRatioPattern} relToRcap + * @property {_1m1w1y24hPattern3} sum */ /** @@ -2342,9 +2342,9 @@ function createBaseChangeCumulativeDeltaRelSumPattern(client, acc) { base: createCentsUsdPattern(client, _m(acc, 'realized_pnl')), change1m: createRelPattern(client, _m(acc, 'pnl_change_1m_rel_to')), cumulative: createCentsUsdPattern(client, _m(acc, 'realized_pnl_cumulative')), - delta: createChangeRatePattern3(client, _m(acc, 'realized_pnl_delta')), - relToRcap: createBpsPercentRatioPattern2(client, _m(acc, 'realized_pnl_rel_to_rcap')), - sum: create_1m1w1y24hPattern4(client, _m(acc, 'realized_pnl_sum')), + delta: createChangeRatePattern2(client, _m(acc, 'realized_pnl_delta')), + relToRcap: createBpsPercentRatioPattern(client, _m(acc, 'realized_pnl_rel_to_rcap')), + sum: create_1m1w1y24hPattern3(client, _m(acc, 'realized_pnl_sum')), }; } @@ -2352,10 +2352,10 @@ function createBaseChangeCumulativeDeltaRelSumPattern(client, acc) { * @typedef {Object} BaseCumulativeRelSumPattern2 * @property {CentsUsdPattern2} base * @property {CentsUsdPattern2} cumulative - * @property {BpsPercentRatioPattern4} relToMcap - * @property {BpsPercentRatioPattern4} relToOwnGross - * @property {BpsPercentRatioPattern4} relToOwnMcap - * @property {_1m1w1y24hPattern5} sum + * @property {BpsPercentRatioPattern3} relToMcap + * @property {BpsPercentRatioPattern3} relToOwnGross + * @property {BpsPercentRatioPattern3} relToOwnMcap + * @property {_1m1w1y24hPattern4} sum */ /** @@ -2368,10 +2368,10 @@ function createBaseCumulativeRelSumPattern2(client, acc) { return { base: createCentsUsdPattern2(client, acc), cumulative: createCentsUsdPattern2(client, _m(acc, 'cumulative')), - relToMcap: createBpsPercentRatioPattern4(client, _m(acc, 'rel_to_mcap')), - relToOwnGross: createBpsPercentRatioPattern4(client, _m(acc, 'rel_to_own_gross_pnl')), - relToOwnMcap: createBpsPercentRatioPattern4(client, _m(acc, 'rel_to_own_mcap')), - sum: create_1m1w1y24hPattern5(client, _m(acc, 'sum')), + relToMcap: createBpsPercentRatioPattern3(client, _m(acc, 'rel_to_mcap')), + relToOwnGross: createBpsPercentRatioPattern3(client, _m(acc, 'rel_to_own_gross_pnl')), + relToOwnMcap: createBpsPercentRatioPattern3(client, _m(acc, 'rel_to_own_mcap')), + sum: create_1m1w1y24hPattern4(client, _m(acc, 'sum')), }; } @@ -2406,8 +2406,8 @@ function createBpsCentsPercentilesRatioSatsUsdPattern(client, acc) { * @typedef {Object} BtcCentsRelSatsUsdPattern3 * @property {MetricPattern1} btc * @property {MetricPattern1} cents - * @property {BpsPercentRatioPattern4} relToCirculating - * @property {BpsPercentRatioPattern4} relToOwn + * @property {BpsPercentRatioPattern3} relToCirculating + * @property {BpsPercentRatioPattern3} relToOwn * @property {MetricPattern1} sats * @property {MetricPattern1} usd */ @@ -2422,8 +2422,8 @@ function createBtcCentsRelSatsUsdPattern3(client, acc) { return { btc: createMetricPattern1(client, acc), cents: createMetricPattern1(client, _m(acc, 'cents')), - relToCirculating: createBpsPercentRatioPattern4(client, _m(acc, 'rel_to_circulating')), - relToOwn: createBpsPercentRatioPattern4(client, _m(acc, 'rel_to_own')), + relToCirculating: createBpsPercentRatioPattern3(client, _m(acc, 'rel_to_circulating')), + relToOwn: createBpsPercentRatioPattern3(client, _m(acc, 'rel_to_own')), sats: createMetricPattern1(client, _m(acc, 'sats')), usd: createMetricPattern1(client, _m(acc, 'usd')), }; @@ -2458,11 +2458,11 @@ function createCapLossMvrvPriceProfitSoprPattern(client, acc) { /** * @typedef {Object} DeltaHalfInRelTotalPattern - * @property {ChangeRatePattern2} delta + * @property {ChangeRatePattern} delta * @property {BtcCentsSatsUsdPattern} half * @property {BtcCentsRelSatsUsdPattern} inLoss * @property {BtcCentsRelSatsUsdPattern} inProfit - * @property {BpsPercentRatioPattern4} relToCirculating + * @property {BpsPercentRatioPattern3} relToCirculating * @property {BtcCentsSatsUsdPattern} total */ @@ -2474,22 +2474,22 @@ function createCapLossMvrvPriceProfitSoprPattern(client, acc) { */ function createDeltaHalfInRelTotalPattern(client, acc) { return { - delta: createChangeRatePattern2(client, _m(acc, 'delta')), + delta: createChangeRatePattern(client, _m(acc, 'delta')), half: createBtcCentsSatsUsdPattern(client, _m(acc, 'half')), inLoss: createBtcCentsRelSatsUsdPattern(client, _m(acc, 'in_loss')), inProfit: createBtcCentsRelSatsUsdPattern(client, _m(acc, 'in_profit')), - relToCirculating: createBpsPercentRatioPattern4(client, _m(acc, 'rel_to_circulating')), + relToCirculating: createBpsPercentRatioPattern3(client, _m(acc, 'rel_to_circulating')), total: createBtcCentsSatsUsdPattern(client, acc), }; } /** * @typedef {Object} DeltaHalfInRelTotalPattern2 - * @property {ChangeRatePattern2} delta + * @property {ChangeRatePattern} delta * @property {BtcCentsSatsUsdPattern} half * @property {BtcCentsRelSatsUsdPattern3} inLoss * @property {BtcCentsRelSatsUsdPattern3} inProfit - * @property {BpsPercentRatioPattern4} relToCirculating + * @property {BpsPercentRatioPattern3} relToCirculating * @property {BtcCentsSatsUsdPattern} total */ @@ -2501,11 +2501,11 @@ function createDeltaHalfInRelTotalPattern(client, acc) { */ function createDeltaHalfInRelTotalPattern2(client, acc) { return { - delta: createChangeRatePattern2(client, _m(acc, 'delta')), + delta: createChangeRatePattern(client, _m(acc, 'delta')), half: createBtcCentsSatsUsdPattern(client, _m(acc, 'half')), inLoss: createBtcCentsRelSatsUsdPattern3(client, _m(acc, 'in_loss')), inProfit: createBtcCentsRelSatsUsdPattern3(client, _m(acc, 'in_profit')), - relToCirculating: createBpsPercentRatioPattern4(client, _m(acc, 'rel_to_circulating')), + relToCirculating: createBpsPercentRatioPattern3(client, _m(acc, 'rel_to_circulating')), total: createBtcCentsSatsUsdPattern(client, acc), }; } @@ -2641,7 +2641,7 @@ function createBpsCentsRatioSatsUsdPattern(client, acc) { * @typedef {Object} BtcCentsRelSatsUsdPattern * @property {MetricPattern1} btc * @property {MetricPattern1} cents - * @property {BpsPercentRatioPattern4} relToCirculating + * @property {BpsPercentRatioPattern3} relToCirculating * @property {MetricPattern1} sats * @property {MetricPattern1} usd */ @@ -2656,7 +2656,7 @@ function createBtcCentsRelSatsUsdPattern(client, acc) { return { btc: createMetricPattern1(client, acc), cents: createMetricPattern1(client, _m(acc, 'cents')), - relToCirculating: createBpsPercentRatioPattern4(client, _m(acc, 'rel_to_circulating')), + relToCirculating: createBpsPercentRatioPattern3(client, _m(acc, 'rel_to_circulating')), sats: createMetricPattern1(client, _m(acc, 'sats')), usd: createMetricPattern1(client, _m(acc, 'usd')), }; @@ -2666,7 +2666,7 @@ function createBtcCentsRelSatsUsdPattern(client, acc) { * @typedef {Object} BtcCentsRelSatsUsdPattern2 * @property {MetricPattern1} btc * @property {MetricPattern1} cents - * @property {BpsPercentRatioPattern4} relToOwn + * @property {BpsPercentRatioPattern3} relToOwn * @property {MetricPattern1} sats * @property {MetricPattern1} usd */ @@ -2681,7 +2681,7 @@ function createBtcCentsRelSatsUsdPattern2(client, acc) { return { btc: createMetricPattern1(client, acc), cents: createMetricPattern1(client, _m(acc, 'cents')), - relToOwn: createBpsPercentRatioPattern4(client, _m(acc, 'rel_to_own')), + relToOwn: createBpsPercentRatioPattern3(client, _m(acc, 'rel_to_own')), sats: createMetricPattern1(client, _m(acc, 'sats')), usd: createMetricPattern1(client, _m(acc, 'usd')), }; @@ -2714,7 +2714,7 @@ function createCoindaysCoinyearsDormancySentVelocityPattern(client, acc) { /** * @typedef {Object} DeltaHalfInTotalPattern2 - * @property {ChangeRatePattern2} delta + * @property {ChangeRatePattern} delta * @property {BtcCentsSatsUsdPattern} half * @property {BtcCentsSatsUsdPattern} inLoss * @property {BtcCentsSatsUsdPattern} inProfit @@ -2729,7 +2729,7 @@ function createCoindaysCoinyearsDormancySentVelocityPattern(client, acc) { */ function createDeltaHalfInTotalPattern2(client, acc) { return { - delta: createChangeRatePattern2(client, _m(acc, 'delta')), + delta: createChangeRatePattern(client, _m(acc, 'delta')), half: createBtcCentsSatsUsdPattern(client, _m(acc, 'half')), inLoss: createBtcCentsSatsUsdPattern(client, _m(acc, 'in_loss')), inProfit: createBtcCentsSatsUsdPattern(client, _m(acc, 'in_profit')), @@ -2768,7 +2768,7 @@ function createEmaHistogramLineSignalPattern(client, acc) { * @property {CentsSatsUsdPattern} max * @property {CentsSatsUsdPattern} min * @property {Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern} percentiles - * @property {BpsPercentRatioPattern4} supplyDensity + * @property {BpsPercentRatioPattern3} supplyDensity */ /** @@ -2783,7 +2783,7 @@ function createInvestedMaxMinPercentilesSupplyPattern(client, acc) { max: createCentsSatsUsdPattern(client, _m(acc, 'cost_basis_max')), min: createCentsSatsUsdPattern(client, _m(acc, 'cost_basis_min')), percentiles: createPct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, _m(acc, 'cost_basis')), - supplyDensity: createBpsPercentRatioPattern4(client, _m(acc, 'supply_density')), + supplyDensity: createBpsPercentRatioPattern3(client, _m(acc, 'supply_density')), }; } @@ -2791,7 +2791,7 @@ function createInvestedMaxMinPercentilesSupplyPattern(client, acc) { * @typedef {Object} PhsReboundThsPattern * @property {MetricPattern1} phs * @property {MetricPattern1} phsMin - * @property {BpsPercentRatioPattern2} rebound + * @property {BpsPercentRatioPattern} rebound * @property {MetricPattern1} ths * @property {MetricPattern1} thsMin */ @@ -2806,7 +2806,7 @@ function createPhsReboundThsPattern(client, acc) { return { phs: createMetricPattern1(client, _m(acc, 'phs')), phsMin: createMetricPattern1(client, _m(acc, 'phs_min')), - rebound: createBpsPercentRatioPattern2(client, _m(acc, 'rebound')), + rebound: createBpsPercentRatioPattern(client, _m(acc, 'rebound')), ths: createMetricPattern1(client, _m(acc, 'ths')), thsMin: createMetricPattern1(client, _m(acc, 'ths_min')), }; @@ -2862,35 +2862,12 @@ function create_1m1w1y24hPattern2(client, acc) { }; } -/** - * @typedef {Object} _1m1w1y24hPattern3 - * @property {BpsPercentRatioPattern2} _1m - * @property {BpsPercentRatioPattern2} _1w - * @property {BpsPercentRatioPattern2} _1y - * @property {BpsPercentRatioPattern2} _24h - */ - -/** - * Create a _1m1w1y24hPattern3 pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {_1m1w1y24hPattern3} - */ -function create_1m1w1y24hPattern3(client, acc) { - return { - _1m: createBpsPercentRatioPattern2(client, _m(acc, '1m_rate')), - _1w: createBpsPercentRatioPattern2(client, _m(acc, '1w_rate')), - _1y: createBpsPercentRatioPattern2(client, _m(acc, '1y_rate')), - _24h: createBpsPercentRatioPattern2(client, _m(acc, '24h_rate')), - }; -} - /** * @typedef {Object} _1m1w1y24hPattern6 - * @property {BtcCentsSatsUsdPattern} _1m - * @property {BtcCentsSatsUsdPattern} _1w - * @property {BtcCentsSatsUsdPattern} _1y - * @property {BtcCentsSatsUsdPattern} _24h + * @property {BpsPercentRatioPattern4} _1m + * @property {BpsPercentRatioPattern4} _1w + * @property {BpsPercentRatioPattern4} _1y + * @property {BpsPercentRatioPattern4} _24h */ /** @@ -2900,6 +2877,29 @@ function create_1m1w1y24hPattern3(client, acc) { * @returns {_1m1w1y24hPattern6} */ function create_1m1w1y24hPattern6(client, acc) { + return { + _1m: createBpsPercentRatioPattern4(client, _m(acc, '1m')), + _1w: createBpsPercentRatioPattern4(client, _m(acc, '1w')), + _1y: createBpsPercentRatioPattern4(client, _m(acc, '1y')), + _24h: createBpsPercentRatioPattern4(client, _m(acc, '24h')), + }; +} + +/** + * @typedef {Object} _1m1w1y24hPattern5 + * @property {BtcCentsSatsUsdPattern} _1m + * @property {BtcCentsSatsUsdPattern} _1w + * @property {BtcCentsSatsUsdPattern} _1y + * @property {BtcCentsSatsUsdPattern} _24h + */ + +/** + * Create a _1m1w1y24hPattern5 pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {_1m1w1y24hPattern5} + */ +function create_1m1w1y24hPattern5(client, acc) { return { _1m: createBtcCentsSatsUsdPattern(client, _m(acc, '1m')), _1w: createBtcCentsSatsUsdPattern(client, _m(acc, '1w')), @@ -2932,7 +2932,7 @@ function create_1m1w1y2wPattern(client, acc) { } /** - * @typedef {Object} _1m1w1y24hPattern4 + * @typedef {Object} _1m1w1y24hPattern3 * @property {CentsUsdPattern} _1m * @property {CentsUsdPattern} _1w * @property {CentsUsdPattern} _1y @@ -2940,12 +2940,12 @@ function create_1m1w1y2wPattern(client, acc) { */ /** - * Create a _1m1w1y24hPattern4 pattern node + * Create a _1m1w1y24hPattern3 pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {_1m1w1y24hPattern4} + * @returns {_1m1w1y24hPattern3} */ -function create_1m1w1y24hPattern4(client, acc) { +function create_1m1w1y24hPattern3(client, acc) { return { _1m: createCentsUsdPattern(client, _m(acc, '1m_change')), _1w: createCentsUsdPattern(client, _m(acc, '1w_change')), @@ -2955,7 +2955,7 @@ function create_1m1w1y24hPattern4(client, acc) { } /** - * @typedef {Object} _1m1w1y24hPattern5 + * @typedef {Object} _1m1w1y24hPattern4 * @property {CentsUsdPattern2} _1m * @property {CentsUsdPattern2} _1w * @property {CentsUsdPattern2} _1y @@ -2963,12 +2963,12 @@ function create_1m1w1y24hPattern4(client, acc) { */ /** - * Create a _1m1w1y24hPattern5 pattern node + * Create a _1m1w1y24hPattern4 pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {_1m1w1y24hPattern5} + * @returns {_1m1w1y24hPattern4} */ -function create_1m1w1y24hPattern5(client, acc) { +function create_1m1w1y24hPattern4(client, acc) { return { _1m: createCentsUsdPattern2(client, _m(acc, '1m')), _1w: createCentsUsdPattern2(client, _m(acc, '1w')), @@ -3027,8 +3027,8 @@ function createAdjustedRatioValuePattern(client, acc) { * @typedef {Object} BaseCumulativeDeltaSumPattern * @property {CentsUsdPattern} base * @property {CentsUsdPattern} cumulative - * @property {ChangeRatePattern3} delta - * @property {_1m1w1y24hPattern4} sum + * @property {ChangeRatePattern2} delta + * @property {_1m1w1y24hPattern3} sum */ /** @@ -3041,8 +3041,8 @@ function createBaseCumulativeDeltaSumPattern(client, acc) { return { base: createCentsUsdPattern(client, acc), cumulative: createCentsUsdPattern(client, _m(acc, 'cumulative')), - delta: createChangeRatePattern3(client, _m(acc, 'delta')), - sum: create_1m1w1y24hPattern4(client, _m(acc, 'sum')), + delta: createChangeRatePattern2(client, _m(acc, 'delta')), + sum: create_1m1w1y24hPattern3(client, _m(acc, 'sum')), }; } @@ -3051,7 +3051,7 @@ function createBaseCumulativeDeltaSumPattern(client, acc) { * @property {CentsUsdPattern2} base * @property {CentsUsdPattern2} cumulative * @property {MetricPattern1} negative - * @property {_1m1w1y24hPattern5} sum + * @property {_1m1w1y24hPattern4} sum */ /** @@ -3065,7 +3065,7 @@ function createBaseCumulativeNegativeSumPattern(client, acc) { base: createCentsUsdPattern2(client, _m(acc, 'unrealized_loss')), cumulative: createCentsUsdPattern2(client, _m(acc, 'unrealized_loss_cumulative')), negative: createMetricPattern1(client, _m(acc, 'neg_unrealized_loss')), - sum: create_1m1w1y24hPattern5(client, _m(acc, 'unrealized_loss_sum')), + sum: create_1m1w1y24hPattern4(client, _m(acc, 'unrealized_loss_sum')), }; } @@ -3118,8 +3118,8 @@ function createBtcCentsSatsUsdPattern(client, acc) { /** * @typedef {Object} CentsDeltaRelUsdPattern * @property {MetricPattern1} cents - * @property {ChangeRatePattern3} delta - * @property {BpsPercentRatioPattern} relToOwnMcap + * @property {ChangeRatePattern2} delta + * @property {BpsPercentRatioPattern4} relToOwnMcap * @property {MetricPattern1} usd */ @@ -3132,8 +3132,8 @@ function createBtcCentsSatsUsdPattern(client, acc) { function createCentsDeltaRelUsdPattern(client, acc) { return { cents: createMetricPattern1(client, _m(acc, 'cents')), - delta: createChangeRatePattern3(client, _m(acc, 'delta')), - relToOwnMcap: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_own_mcap')), + delta: createChangeRatePattern2(client, _m(acc, 'delta')), + relToOwnMcap: createBpsPercentRatioPattern4(client, _m(acc, 'rel_to_own_mcap')), usd: createMetricPattern1(client, acc), }; } @@ -3141,8 +3141,8 @@ function createCentsDeltaRelUsdPattern(client, acc) { /** * @typedef {Object} CentsRelUsdPattern2 * @property {MetricPattern1} cents - * @property {BpsPercentRatioPattern2} relToOwnGross - * @property {BpsPercentRatioPattern2} relToOwnMcap + * @property {BpsPercentRatioPattern} relToOwnGross + * @property {BpsPercentRatioPattern} relToOwnMcap * @property {MetricPattern1} usd */ @@ -3155,8 +3155,8 @@ function createCentsDeltaRelUsdPattern(client, acc) { function createCentsRelUsdPattern2(client, acc) { return { cents: createMetricPattern1(client, _m(acc, 'cents')), - relToOwnGross: createBpsPercentRatioPattern2(client, _m(acc, 'rel_to_own_gross_pnl')), - relToOwnMcap: createBpsPercentRatioPattern2(client, _m(acc, 'rel_to_own_mcap')), + relToOwnGross: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_own_gross_pnl')), + relToOwnMcap: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_own_mcap')), usd: createMetricPattern1(client, acc), }; } @@ -3259,7 +3259,7 @@ function create_1m1w1y24hPattern(client, acc) { * @typedef {Object} BaseCumulativeSumPattern4 * @property {BtcCentsSatsUsdPattern} base * @property {BtcCentsSatsUsdPattern} cumulative - * @property {_1m1w1y24hPattern6} sum + * @property {_1m1w1y24hPattern5} sum */ /** @@ -3272,7 +3272,7 @@ function createBaseCumulativeSumPattern4(client, acc) { return { base: createBtcCentsSatsUsdPattern(client, acc), cumulative: createBtcCentsSatsUsdPattern(client, _m(acc, 'cumulative')), - sum: create_1m1w1y24hPattern6(client, _m(acc, 'sum')), + sum: create_1m1w1y24hPattern5(client, _m(acc, 'sum')), }; } @@ -3280,7 +3280,7 @@ function createBaseCumulativeSumPattern4(client, acc) { * @typedef {Object} BaseCumulativeRelPattern * @property {MetricPattern1} base * @property {MetricPattern1} cumulative - * @property {BpsPercentRatioPattern} relToRcap + * @property {BpsPercentRatioPattern4} relToRcap */ /** @@ -3293,7 +3293,7 @@ function createBaseCumulativeRelPattern(client, acc) { return { base: createMetricPattern1(client, acc), cumulative: createMetricPattern1(client, _m(acc, 'cumulative')), - relToRcap: createBpsPercentRatioPattern(client, _m(acc, 'rel_to_rcap')), + relToRcap: createBpsPercentRatioPattern4(client, _m(acc, 'rel_to_rcap')), }; } @@ -3301,7 +3301,7 @@ function createBaseCumulativeRelPattern(client, acc) { * @typedef {Object} BaseCumulativeSumPattern3 * @property {CentsUsdPattern2} base * @property {CentsUsdPattern2} cumulative - * @property {_1m1w1y24hPattern5} sum + * @property {_1m1w1y24hPattern4} sum */ /** @@ -3314,7 +3314,7 @@ function createBaseCumulativeSumPattern3(client, acc) { return { base: createCentsUsdPattern2(client, acc), cumulative: createCentsUsdPattern2(client, _m(acc, 'cumulative')), - sum: create_1m1w1y24hPattern5(client, _m(acc, 'sum')), + sum: create_1m1w1y24hPattern4(client, _m(acc, 'sum')), }; } @@ -3361,12 +3361,33 @@ function createBlocksDominanceRewardsPattern(client, acc) { } /** - * @typedef {Object} BpsPercentRatioPattern4 + * @typedef {Object} BpsPercentRatioPattern3 * @property {MetricPattern1} bps * @property {MetricPattern1} percent * @property {MetricPattern1} ratio */ +/** + * Create a BpsPercentRatioPattern3 pattern node + * @param {BrkClientBase} client + * @param {string} acc - Accumulated metric name + * @returns {BpsPercentRatioPattern3} + */ +function createBpsPercentRatioPattern3(client, acc) { + return { + bps: createMetricPattern1(client, _m(acc, 'bps')), + percent: createMetricPattern1(client, acc), + ratio: createMetricPattern1(client, _m(acc, 'ratio')), + }; +} + +/** + * @typedef {Object} BpsPercentRatioPattern4 + * @property {MetricPattern1} bps + * @property {MetricPattern1} percent + * @property {MetricPattern1} ratio + */ + /** * Create a BpsPercentRatioPattern4 pattern node * @param {BrkClientBase} client @@ -3381,27 +3402,6 @@ function createBpsPercentRatioPattern4(client, acc) { }; } -/** - * @typedef {Object} BpsPercentRatioPattern - * @property {MetricPattern1} bps - * @property {MetricPattern1} percent - * @property {MetricPattern1} ratio - */ - -/** - * Create a BpsPercentRatioPattern pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {BpsPercentRatioPattern} - */ -function createBpsPercentRatioPattern(client, acc) { - return { - bps: createMetricPattern1(client, _m(acc, 'bps')), - percent: createMetricPattern1(client, acc), - ratio: createMetricPattern1(client, _m(acc, 'ratio')), - }; -} - /** * @typedef {Object} BpsPriceRatioPattern * @property {MetricPattern1} bps @@ -3445,19 +3445,19 @@ function createBpsPercentRatioPattern5(client, acc) { } /** - * @typedef {Object} BpsPercentRatioPattern2 + * @typedef {Object} BpsPercentRatioPattern * @property {MetricPattern1} bps * @property {MetricPattern1} percent * @property {MetricPattern1} ratio */ /** - * Create a BpsPercentRatioPattern2 pattern node + * Create a BpsPercentRatioPattern pattern node * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {BpsPercentRatioPattern2} + * @returns {BpsPercentRatioPattern} */ -function createBpsPercentRatioPattern2(client, acc) { +function createBpsPercentRatioPattern(client, acc) { return { bps: createMetricPattern1(client, _m(acc, 'bps')), percent: createMetricPattern1(client, acc), @@ -3489,7 +3489,7 @@ function createCentsSatsUsdPattern3(client, acc) { /** * @typedef {Object} CentsDeltaUsdPattern * @property {MetricPattern1} cents - * @property {ChangeRatePattern3} delta + * @property {ChangeRatePattern2} delta * @property {MetricPattern1} usd */ @@ -3502,7 +3502,7 @@ function createCentsSatsUsdPattern3(client, acc) { function createCentsDeltaUsdPattern(client, acc) { return { cents: createMetricPattern1(client, _m(acc, 'cents')), - delta: createChangeRatePattern3(client, _m(acc, 'delta')), + delta: createChangeRatePattern2(client, _m(acc, 'delta')), usd: createMetricPattern1(client, acc), }; } @@ -3530,7 +3530,7 @@ function createCentsSatsUsdPattern(client, acc) { /** * @typedef {Object} DeltaHalfTotalPattern - * @property {ChangeRatePattern2} delta + * @property {ChangeRatePattern} delta * @property {BtcCentsSatsUsdPattern} half * @property {BtcCentsSatsUsdPattern} total */ @@ -3543,7 +3543,7 @@ function createCentsSatsUsdPattern(client, acc) { */ function createDeltaHalfTotalPattern(client, acc) { return { - delta: createChangeRatePattern2(client, _m(acc, 'delta')), + delta: createChangeRatePattern(client, _m(acc, 'delta')), half: createBtcCentsSatsUsdPattern(client, _m(acc, 'half')), total: createBtcCentsSatsUsdPattern(client, acc), }; @@ -3656,24 +3656,24 @@ function createRatioValuePattern(client, acc) { /** * @template T - * @typedef {Object} _6bBlockTxindexPattern + * @typedef {Object} _6bBlockTxPattern * @property {AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2} _6b * @property {AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2} block - * @property {MetricPattern19} txindex + * @property {MetricPattern19} txIndex */ /** - * Create a _6bBlockTxindexPattern pattern node + * Create a _6bBlockTxPattern pattern node * @template T * @param {BrkClientBase} client * @param {string} acc - Accumulated metric name - * @returns {_6bBlockTxindexPattern} + * @returns {_6bBlockTxPattern} */ -function create_6bBlockTxindexPattern(client, acc) { +function create_6bBlockTxPattern(client, acc) { return { _6b: createAverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2(client, _m(acc, '6b')), block: createAverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2(client, acc), - txindex: createMetricPattern19(client, acc), + txIndex: createMetricPattern19(client, acc), }; } @@ -3703,7 +3703,7 @@ function createBaseCumulativeSumPattern(client, acc) { /** * @typedef {Object} BlocksDominancePattern * @property {BaseCumulativeSumPattern2} blocksMined - * @property {BpsPercentRatioPattern4} dominance + * @property {BpsPercentRatioPattern3} dominance */ /** @@ -3715,7 +3715,7 @@ function createBaseCumulativeSumPattern(client, acc) { function createBlocksDominancePattern(client, acc) { return { blocksMined: createBaseCumulativeSumPattern2(client, _m(acc, 'blocks_mined')), - dominance: createBpsPercentRatioPattern4(client, _m(acc, 'dominance')), + dominance: createBpsPercentRatioPattern3(client, _m(acc, 'dominance')), }; } @@ -3816,8 +3816,8 @@ function createChangeRatePattern(client, acc) { /** * @typedef {Object} ChangeRatePattern2 - * @property {_1m1w1y24hPattern} change - * @property {_1m1w1y24hPattern3} rate + * @property {_1m1w1y24hPattern3} change + * @property {_1m1w1y24hPattern2} rate */ /** @@ -3828,27 +3828,8 @@ function createChangeRatePattern(client, acc) { */ function createChangeRatePattern2(client, acc) { return { - change: create_1m1w1y24hPattern(client, acc), - rate: create_1m1w1y24hPattern3(client, acc), - }; -} - -/** - * @typedef {Object} ChangeRatePattern3 - * @property {_1m1w1y24hPattern4} change - * @property {_1m1w1y24hPattern3} rate - */ - -/** - * Create a ChangeRatePattern3 pattern node - * @param {BrkClientBase} client - * @param {string} acc - Accumulated metric name - * @returns {ChangeRatePattern3} - */ -function createChangeRatePattern3(client, acc) { - return { - change: create_1m1w1y24hPattern4(client, acc), - rate: create_1m1w1y24hPattern3(client, acc), + change: create_1m1w1y24hPattern3(client, acc), + rate: create_1m1w1y24hPattern2(client, acc), }; } @@ -3873,7 +3854,7 @@ function createCoindaysSentPattern(client, acc) { /** * @typedef {Object} DeltaInnerPattern - * @property {ChangeRatePattern2} delta + * @property {ChangeRatePattern} delta * @property {MetricPattern1} inner */ @@ -3885,7 +3866,7 @@ function createCoindaysSentPattern(client, acc) { */ function createDeltaInnerPattern(client, acc) { return { - delta: createChangeRatePattern2(client, _m(acc, 'delta')), + delta: createChangeRatePattern(client, _m(acc, 'delta')), inner: createMetricPattern1(client, acc), }; } @@ -3949,8 +3930,8 @@ function createRealizedSupplyPattern(client, acc) { /** * @typedef {Object} RelPattern - * @property {BpsPercentRatioPattern2} relToMcap - * @property {BpsPercentRatioPattern2} relToRcap + * @property {BpsPercentRatioPattern} relToMcap + * @property {BpsPercentRatioPattern} relToRcap */ /** @@ -3961,8 +3942,8 @@ function createRealizedSupplyPattern(client, acc) { */ function createRelPattern(client, acc) { return { - relToMcap: createBpsPercentRatioPattern2(client, _m(acc, 'mcap')), - relToRcap: createBpsPercentRatioPattern2(client, _m(acc, 'rcap')), + relToMcap: createBpsPercentRatioPattern(client, _m(acc, 'mcap')), + relToRcap: createBpsPercentRatioPattern(client, _m(acc, 'rcap')), }; } @@ -4097,7 +4078,7 @@ function createUnspentPattern(client, acc) { * @property {MetricPattern18} raw * @property {MetricPattern2} base * @property {MetricPattern1} asHash - * @property {BpsPercentRatioPattern2} adjustment + * @property {BpsPercentRatioPattern} adjustment * @property {MetricPattern1} epoch * @property {MetricPattern1} blocksBeforeNext * @property {MetricPattern1} daysBeforeNext @@ -4219,16 +4200,16 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} MetricsTree_Transactions_Raw - * @property {MetricPattern18} firstTxindex + * @property {MetricPattern18} firstTxIndex * @property {MetricPattern19} height * @property {MetricPattern19} txid - * @property {MetricPattern19} txversion - * @property {MetricPattern19} rawlocktime + * @property {MetricPattern19} txVersion + * @property {MetricPattern19} rawLocktime * @property {MetricPattern19} baseSize * @property {MetricPattern19} totalSize * @property {MetricPattern19} isExplicitlyRbf - * @property {MetricPattern19} firstTxinindex - * @property {MetricPattern19} firstTxoutindex + * @property {MetricPattern19} firstTxinIndex + * @property {MetricPattern19} firstTxoutIndex */ /** @@ -4239,16 +4220,16 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} MetricsTree_Transactions_Size - * @property {_6bBlockTxindexPattern} vsize - * @property {_6bBlockTxindexPattern} weight + * @property {_6bBlockTxPattern} vsize + * @property {_6bBlockTxPattern} weight */ /** * @typedef {Object} MetricsTree_Transactions_Fees * @property {MetricPattern19} inputValue * @property {MetricPattern19} outputValue - * @property {_6bBlockTxindexPattern} fee - * @property {_6bBlockTxindexPattern} feeRate + * @property {_6bBlockTxPattern} fee + * @property {_6bBlockTxPattern} feeRate */ /** @@ -4276,16 +4257,16 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} MetricsTree_Inputs_Raw - * @property {MetricPattern18} firstTxinindex + * @property {MetricPattern18} firstTxinIndex * @property {MetricPattern20} outpoint - * @property {MetricPattern20} txindex - * @property {MetricPattern20} outputtype - * @property {MetricPattern20} typeindex + * @property {MetricPattern20} txIndex + * @property {MetricPattern20} outputType + * @property {MetricPattern20} typeIndex */ /** * @typedef {Object} MetricsTree_Inputs_Spent - * @property {MetricPattern20} txoutindex + * @property {MetricPattern20} txoutIndex * @property {MetricPattern20} value */ @@ -4298,16 +4279,16 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} MetricsTree_Outputs_Raw - * @property {MetricPattern18} firstTxoutindex + * @property {MetricPattern18} firstTxoutIndex * @property {MetricPattern21} value - * @property {MetricPattern21} outputtype - * @property {MetricPattern21} typeindex - * @property {MetricPattern21} txindex + * @property {MetricPattern21} outputType + * @property {MetricPattern21} typeIndex + * @property {MetricPattern21} txIndex */ /** * @typedef {Object} MetricsTree_Outputs_Spent - * @property {MetricPattern21} txinindex + * @property {MetricPattern21} txinIndex */ /** @@ -4467,25 +4448,25 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} MetricsTree_Scripts_Raw_Empty * @property {MetricPattern18} firstIndex - * @property {MetricPattern22} toTxindex + * @property {MetricPattern22} toTxIndex */ /** * @typedef {Object} MetricsTree_Scripts_Raw_Opreturn * @property {MetricPattern18} firstIndex - * @property {MetricPattern23} toTxindex + * @property {MetricPattern23} toTxIndex */ /** * @typedef {Object} MetricsTree_Scripts_Raw_P2ms * @property {MetricPattern18} firstIndex - * @property {MetricPattern25} toTxindex + * @property {MetricPattern25} toTxIndex */ /** * @typedef {Object} MetricsTree_Scripts_Raw_Unknown * @property {MetricPattern18} firstIndex - * @property {MetricPattern33} toTxindex + * @property {MetricPattern33} toTxIndex */ /** @@ -4500,8 +4481,8 @@ function createUnspentPattern(client, acc) { * @property {BaseCumulativeSumPattern} p2wpkh * @property {BaseCumulativeSumPattern} p2wsh * @property {BaseCumulativeSumPattern} opreturn - * @property {BaseCumulativeSumPattern} emptyoutput - * @property {BaseCumulativeSumPattern} unknownoutput + * @property {BaseCumulativeSumPattern} emptyOutput + * @property {BaseCumulativeSumPattern} unknownOutput * @property {BaseCumulativeSumPattern} segwit */ @@ -4518,8 +4499,8 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} MetricsTree_Scripts_Adoption - * @property {BpsPercentRatioPattern4} taproot - * @property {BpsPercentRatioPattern4} segwit + * @property {BpsPercentRatioPattern3} taproot + * @property {BpsPercentRatioPattern3} segwit */ /** @@ -4548,7 +4529,7 @@ function createUnspentPattern(client, acc) { * @typedef {Object} MetricsTree_Mining_Rewards_Fees * @property {BtcCentsSatsUsdPattern} base * @property {BtcCentsSatsUsdPattern} cumulative - * @property {_1m1w1y24hPattern6} sum + * @property {_1m1w1y24hPattern5} sum * @property {AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern} _24h * @property {AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern} _1w * @property {AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern} _1m @@ -4597,7 +4578,7 @@ function createUnspentPattern(client, acc) { * @property {MetricsTree_Cointime_Prices} prices * @property {MetricsTree_Cointime_Adjusted} adjusted * @property {MetricsTree_Cointime_ReserveRisk} reserveRisk - * @property {MetricsTree_Cointime_CoinblocksDestroyed} coinblocksDestroyed + * @property {BaseCumulativeSumPattern} coinblocksDestroyed */ /** @@ -4648,7 +4629,7 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} MetricsTree_Cointime_Adjusted - * @property {BpsPercentRatioPattern2} inflationRate + * @property {BpsPercentRatioPattern} inflationRate * @property {MetricPattern1} txVelocityBtc * @property {MetricPattern1} txVelocityUsd */ @@ -4660,12 +4641,6 @@ function createUnspentPattern(client, acc) { * @property {MetricPattern18} hodlBank */ -/** - * @typedef {Object} MetricsTree_Cointime_CoinblocksDestroyed - * @property {MetricPattern1} base - * @property {MetricPattern1} cumulative - */ - /** * @typedef {Object} MetricsTree_Constants * @property {MetricPattern1} _0 @@ -4707,9 +4682,9 @@ function createUnspentPattern(client, acc) { * @property {MetricsTree_Indexes_Month6} month6 * @property {MetricsTree_Indexes_Year1} year1 * @property {MetricsTree_Indexes_Year10} year10 - * @property {MetricsTree_Indexes_Txindex} txindex - * @property {MetricsTree_Indexes_Txinindex} txinindex - * @property {MetricsTree_Indexes_Txoutindex} txoutindex + * @property {MetricsTree_Indexes_TxIndex} txIndex + * @property {MetricsTree_Indexes_TxinIndex} txinIndex + * @property {MetricsTree_Indexes_TxoutIndex} txoutIndex */ /** @@ -4806,7 +4781,7 @@ function createUnspentPattern(client, acc) { * @property {MetricPattern18} month6 * @property {MetricPattern18} year1 * @property {MetricPattern18} year10 - * @property {MetricPattern18} txindexCount + * @property {MetricPattern18} txIndexCount */ /** @@ -4909,19 +4884,19 @@ function createUnspentPattern(client, acc) { */ /** - * @typedef {Object} MetricsTree_Indexes_Txindex + * @typedef {Object} MetricsTree_Indexes_TxIndex * @property {MetricPattern19} identity * @property {MetricPattern19} inputCount * @property {MetricPattern19} outputCount */ /** - * @typedef {Object} MetricsTree_Indexes_Txinindex + * @typedef {Object} MetricsTree_Indexes_TxinIndex * @property {MetricPattern20} identity */ /** - * @typedef {Object} MetricsTree_Indexes_Txoutindex + * @typedef {Object} MetricsTree_Indexes_TxoutIndex * @property {MetricPattern21} identity */ @@ -4929,7 +4904,7 @@ function createUnspentPattern(client, acc) { * @typedef {Object} MetricsTree_Indicators * @property {BpsRatioPattern2} puellMultiple * @property {BpsRatioPattern2} nvt - * @property {BpsPercentRatioPattern4} gini + * @property {BpsPercentRatioPattern3} gini * @property {BpsRatioPattern2} rhodlRatio * @property {BpsRatioPattern2} thermocapMultiple * @property {MetricPattern1} coindaysDestroyedSupplyAdjusted @@ -4993,19 +4968,19 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} MetricsTree_Market_Returns_Periods - * @property {BpsPercentRatioPattern2} _24h - * @property {BpsPercentRatioPattern2} _1w - * @property {BpsPercentRatioPattern2} _1m - * @property {BpsPercentRatioPattern2} _3m - * @property {BpsPercentRatioPattern2} _6m - * @property {BpsPercentRatioPattern2} _1y - * @property {BpsPercentRatioPattern2} _2y - * @property {BpsPercentRatioPattern2} _3y - * @property {BpsPercentRatioPattern2} _4y - * @property {BpsPercentRatioPattern2} _5y - * @property {BpsPercentRatioPattern2} _6y - * @property {BpsPercentRatioPattern2} _8y - * @property {BpsPercentRatioPattern2} _10y + * @property {BpsPercentRatioPattern} _24h + * @property {BpsPercentRatioPattern} _1w + * @property {BpsPercentRatioPattern} _1m + * @property {BpsPercentRatioPattern} _3m + * @property {BpsPercentRatioPattern} _6m + * @property {BpsPercentRatioPattern} _1y + * @property {BpsPercentRatioPattern} _2y + * @property {BpsPercentRatioPattern} _3y + * @property {BpsPercentRatioPattern} _4y + * @property {BpsPercentRatioPattern} _5y + * @property {BpsPercentRatioPattern} _6y + * @property {BpsPercentRatioPattern} _8y + * @property {BpsPercentRatioPattern} _10y */ /** @@ -5040,7 +5015,7 @@ function createUnspentPattern(client, acc) { * @property {_1m1w1y2wPattern} max * @property {MetricPattern1} trueRange * @property {MetricPattern1} trueRangeSum2w - * @property {BpsPercentRatioPattern4} choppinessIndex2w + * @property {BpsPercentRatioPattern3} choppinessIndex2w */ /** @@ -5205,25 +5180,25 @@ function createUnspentPattern(client, acc) { /** * @typedef {Object} MetricsTree_Market_Dca_Class_Return - * @property {BpsPercentRatioPattern2} from2015 - * @property {BpsPercentRatioPattern2} from2016 - * @property {BpsPercentRatioPattern2} from2017 - * @property {BpsPercentRatioPattern2} from2018 - * @property {BpsPercentRatioPattern2} from2019 - * @property {BpsPercentRatioPattern2} from2020 - * @property {BpsPercentRatioPattern2} from2021 - * @property {BpsPercentRatioPattern2} from2022 - * @property {BpsPercentRatioPattern2} from2023 - * @property {BpsPercentRatioPattern2} from2024 - * @property {BpsPercentRatioPattern2} from2025 - * @property {BpsPercentRatioPattern2} from2026 + * @property {BpsPercentRatioPattern} from2015 + * @property {BpsPercentRatioPattern} from2016 + * @property {BpsPercentRatioPattern} from2017 + * @property {BpsPercentRatioPattern} from2018 + * @property {BpsPercentRatioPattern} from2019 + * @property {BpsPercentRatioPattern} from2020 + * @property {BpsPercentRatioPattern} from2021 + * @property {BpsPercentRatioPattern} from2022 + * @property {BpsPercentRatioPattern} from2023 + * @property {BpsPercentRatioPattern} from2024 + * @property {BpsPercentRatioPattern} from2025 + * @property {BpsPercentRatioPattern} from2026 */ /** * @typedef {Object} MetricsTree_Market_Technical * @property {MetricsTree_Market_Technical_Rsi} rsi - * @property {BpsPercentRatioPattern4} stochK - * @property {BpsPercentRatioPattern4} stochD + * @property {BpsPercentRatioPattern3} stochK + * @property {BpsPercentRatioPattern3} stochD * @property {BpsRatioPattern2} piCycle * @property {MetricsTree_Market_Technical_Macd} macd */ @@ -5242,12 +5217,12 @@ function createUnspentPattern(client, acc) { * @property {MetricPattern1} losses * @property {MetricPattern1} averageGain * @property {MetricPattern1} averageLoss - * @property {BpsPercentRatioPattern4} rsi - * @property {BpsPercentRatioPattern4} rsiMin - * @property {BpsPercentRatioPattern4} rsiMax - * @property {BpsPercentRatioPattern4} stochRsi - * @property {BpsPercentRatioPattern4} stochRsiK - * @property {BpsPercentRatioPattern4} stochRsiD + * @property {BpsPercentRatioPattern3} rsi + * @property {BpsPercentRatioPattern3} rsiMin + * @property {BpsPercentRatioPattern3} rsiMax + * @property {BpsPercentRatioPattern3} stochRsi + * @property {BpsPercentRatioPattern3} stochRsiK + * @property {BpsPercentRatioPattern3} stochRsiD */ /** @@ -5256,12 +5231,12 @@ function createUnspentPattern(client, acc) { * @property {MetricPattern1} losses * @property {MetricPattern1} averageGain * @property {MetricPattern1} averageLoss - * @property {BpsPercentRatioPattern4} rsi - * @property {BpsPercentRatioPattern4} rsiMin - * @property {BpsPercentRatioPattern4} rsiMax - * @property {BpsPercentRatioPattern4} stochRsi - * @property {BpsPercentRatioPattern4} stochRsiK - * @property {BpsPercentRatioPattern4} stochRsiD + * @property {BpsPercentRatioPattern3} rsi + * @property {BpsPercentRatioPattern3} rsiMin + * @property {BpsPercentRatioPattern3} rsiMax + * @property {BpsPercentRatioPattern3} stochRsi + * @property {BpsPercentRatioPattern3} stochRsiK + * @property {BpsPercentRatioPattern3} stochRsiD */ /** @@ -5270,12 +5245,12 @@ function createUnspentPattern(client, acc) { * @property {MetricPattern1} losses * @property {MetricPattern1} averageGain * @property {MetricPattern1} averageLoss - * @property {BpsPercentRatioPattern4} rsi - * @property {BpsPercentRatioPattern4} rsiMin - * @property {BpsPercentRatioPattern4} rsiMax - * @property {BpsPercentRatioPattern4} stochRsi - * @property {BpsPercentRatioPattern4} stochRsiK - * @property {BpsPercentRatioPattern4} stochRsiD + * @property {BpsPercentRatioPattern3} rsi + * @property {BpsPercentRatioPattern3} rsiMin + * @property {BpsPercentRatioPattern3} rsiMax + * @property {BpsPercentRatioPattern3} stochRsi + * @property {BpsPercentRatioPattern3} stochRsiK + * @property {BpsPercentRatioPattern3} stochRsiD */ /** @@ -5523,7 +5498,7 @@ function createUnspentPattern(client, acc) { * @typedef {Object} MetricsTree_Supply * @property {BtcCentsSatsUsdPattern} circulating * @property {MetricsTree_Supply_Burned} burned - * @property {BpsPercentRatioPattern2} inflationRate + * @property {BpsPercentRatioPattern} inflationRate * @property {MetricsTree_Supply_Velocity} velocity * @property {CentsDeltaUsdPattern} marketCap * @property {_1m1w1y24hPattern} marketMinusRealizedCapGrowthRate @@ -5583,7 +5558,7 @@ function createUnspentPattern(client, acc) { * @property {BtcCentsRelSatsUsdPattern2} inLoss * @property {BtcCentsSatsUsdPattern} total * @property {BtcCentsSatsUsdPattern} half - * @property {ChangeRatePattern2} delta + * @property {ChangeRatePattern} delta */ /** @@ -5602,25 +5577,25 @@ function createUnspentPattern(client, acc) { * @property {MetricPattern1} negative * @property {CentsUsdPattern2} base * @property {CentsUsdPattern2} cumulative - * @property {_1m1w1y24hPattern5} sum - * @property {BpsPercentRatioPattern4} relToMcap - * @property {BpsPercentRatioPattern4} relToOwnGross + * @property {_1m1w1y24hPattern4} sum + * @property {BpsPercentRatioPattern3} relToMcap + * @property {BpsPercentRatioPattern3} relToOwnGross */ /** * @typedef {Object} MetricsTree_Cohorts_Utxo_All_Unrealized_NetPnl * @property {MetricPattern1} cents * @property {MetricPattern1} usd - * @property {BpsPercentRatioPattern2} relToOwnGross + * @property {BpsPercentRatioPattern} relToOwnGross */ /** * @typedef {Object} MetricsTree_Cohorts_Utxo_All_Unrealized_Profit * @property {CentsUsdPattern2} base * @property {CentsUsdPattern2} cumulative - * @property {_1m1w1y24hPattern5} sum - * @property {BpsPercentRatioPattern4} relToMcap - * @property {BpsPercentRatioPattern4} relToOwnGross + * @property {_1m1w1y24hPattern4} sum + * @property {BpsPercentRatioPattern3} relToMcap + * @property {BpsPercentRatioPattern3} relToOwnGross */ /** @@ -5648,7 +5623,7 @@ function createUnspentPattern(client, acc) { * @property {BaseCumulativeDistributionRelSumValuePattern} profit * @property {BaseCapitulationCumulativeNegativeRelSumValuePattern} loss * @property {BaseCumulativeSumPattern3} grossPnl - * @property {MetricsTree_Cohorts_Utxo_Lth_Realized_SellSideRiskRatio} sellSideRiskRatio + * @property {_1m1w1y24hPattern6} sellSideRiskRatio * @property {BaseChangeCumulativeDeltaRelSumPattern} netPnl * @property {MetricsTree_Cohorts_Utxo_Lth_Realized_Sopr} sopr * @property {BaseCumulativeRelPattern} peakRegret @@ -5659,14 +5634,6 @@ function createUnspentPattern(client, acc) { * @property {MetricPattern1} mvrv */ -/** - * @typedef {Object} MetricsTree_Cohorts_Utxo_Lth_Realized_SellSideRiskRatio - * @property {BpsPercentRatioPattern} _24h - * @property {BpsPercentRatioPattern} _1w - * @property {BpsPercentRatioPattern} _1m - * @property {BpsPercentRatioPattern} _1y - */ - /** * @typedef {Object} MetricsTree_Cohorts_Utxo_Lth_Realized_Sopr * @property {_1m1w1y24hPattern} ratio @@ -6018,24 +5985,24 @@ class BrkClient extends BrkClientBase { "halving", "epoch", "height", - "txindex", - "txinindex", - "txoutindex", - "emptyoutputindex", - "opreturnindex", - "p2aaddressindex", - "p2msoutputindex", - "p2pk33addressindex", - "p2pk65addressindex", - "p2pkhaddressindex", - "p2shaddressindex", - "p2traddressindex", - "p2wpkhaddressindex", - "p2wshaddressindex", - "unknownoutputindex", - "fundedaddressindex", - "emptyaddressindex", - "pairoutputindex" + "tx_index", + "txin_index", + "txout_index", + "empty_output_index", + "op_return_index", + "p2a_address_index", + "p2ms_output_index", + "p2pk33_address_index", + "p2pk65_address_index", + "p2pkh_address_index", + "p2sh_address_index", + "p2tr_address_index", + "p2wpkh_address_index", + "p2wsh_address_index", + "unknown_output_index", + "funded_address_index", + "empty_address_index", + "pair_output_index" ]); POOL_ID_TO_POOL_NAME = /** @type {const} */ ({ @@ -6946,7 +6913,7 @@ class BrkClient extends BrkClientBase { raw: createMetricPattern18(this, 'difficulty'), base: createMetricPattern2(this, 'difficulty'), asHash: createMetricPattern1(this, 'difficulty_as_hash'), - adjustment: createBpsPercentRatioPattern2(this, 'difficulty_adjustment'), + adjustment: createBpsPercentRatioPattern(this, 'difficulty_adjustment'), epoch: createMetricPattern1(this, 'difficulty_epoch'), blocksBeforeNext: createMetricPattern1(this, 'blocks_before_next_difficulty_adjustment'), daysBeforeNext: createMetricPattern1(this, 'days_before_next_difficulty_adjustment'), @@ -7046,30 +7013,30 @@ class BrkClient extends BrkClientBase { }, transactions: { raw: { - firstTxindex: createMetricPattern18(this, 'first_txindex'), + firstTxIndex: createMetricPattern18(this, 'first_tx_index'), height: createMetricPattern19(this, 'height'), txid: createMetricPattern19(this, 'txid'), - txversion: createMetricPattern19(this, 'txversion'), - rawlocktime: createMetricPattern19(this, 'rawlocktime'), + txVersion: createMetricPattern19(this, 'tx_version'), + rawLocktime: createMetricPattern19(this, 'raw_locktime'), baseSize: createMetricPattern19(this, 'base_size'), totalSize: createMetricPattern19(this, 'total_size'), isExplicitlyRbf: createMetricPattern19(this, 'is_explicitly_rbf'), - firstTxinindex: createMetricPattern19(this, 'first_txinindex'), - firstTxoutindex: createMetricPattern19(this, 'first_txoutindex'), + firstTxinIndex: createMetricPattern19(this, 'first_txin_index'), + firstTxoutIndex: createMetricPattern19(this, 'first_txout_index'), }, count: { total: createAverageBaseCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern(this, 'tx_count'), isCoinbase: createMetricPattern19(this, 'is_coinbase'), }, size: { - vsize: create_6bBlockTxindexPattern(this, 'tx_vsize'), - weight: create_6bBlockTxindexPattern(this, 'tx_weight'), + vsize: create_6bBlockTxPattern(this, 'tx_vsize'), + weight: create_6bBlockTxPattern(this, 'tx_weight'), }, fees: { inputValue: createMetricPattern19(this, 'input_value'), outputValue: createMetricPattern19(this, 'output_value'), - fee: create_6bBlockTxindexPattern(this, 'fee'), - feeRate: create_6bBlockTxindexPattern(this, 'fee_rate'), + fee: create_6bBlockTxPattern(this, 'fee'), + feeRate: create_6bBlockTxPattern(this, 'fee_rate'), }, versions: { v1: createBaseCumulativeSumPattern(this, 'tx_v1'), @@ -7086,28 +7053,28 @@ class BrkClient extends BrkClientBase { }, inputs: { raw: { - firstTxinindex: createMetricPattern18(this, 'first_txinindex'), + firstTxinIndex: createMetricPattern18(this, 'first_txin_index'), outpoint: createMetricPattern20(this, 'outpoint'), - txindex: createMetricPattern20(this, 'txindex'), - outputtype: createMetricPattern20(this, 'outputtype'), - typeindex: createMetricPattern20(this, 'typeindex'), + txIndex: createMetricPattern20(this, 'tx_index'), + outputType: createMetricPattern20(this, 'output_type'), + typeIndex: createMetricPattern20(this, 'type_index'), }, spent: { - txoutindex: createMetricPattern20(this, 'txoutindex'), + txoutIndex: createMetricPattern20(this, 'txout_index'), value: createMetricPattern20(this, 'value'), }, count: createAverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RollingSumPattern(this, 'input_count'), }, outputs: { raw: { - firstTxoutindex: createMetricPattern18(this, 'first_txoutindex'), + firstTxoutIndex: createMetricPattern18(this, 'first_txout_index'), value: createMetricPattern21(this, 'value'), - outputtype: createMetricPattern21(this, 'outputtype'), - typeindex: createMetricPattern21(this, 'typeindex'), - txindex: createMetricPattern21(this, 'txindex'), + outputType: createMetricPattern21(this, 'output_type'), + typeIndex: createMetricPattern21(this, 'type_index'), + txIndex: createMetricPattern21(this, 'tx_index'), }, spent: { - txinindex: createMetricPattern21(this, 'txinindex'), + txinIndex: createMetricPattern21(this, 'txin_index'), }, count: { total: createAverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RollingSumPattern(this, 'output_count'), @@ -7117,53 +7084,53 @@ class BrkClient extends BrkClientBase { addresses: { raw: { p2pk65: { - firstIndex: createMetricPattern18(this, 'first_p2pk65addressindex'), - bytes: createMetricPattern27(this, 'p2pk65bytes'), + firstIndex: createMetricPattern18(this, 'first_p2pk65_address_index'), + bytes: createMetricPattern27(this, 'p2pk65_bytes'), }, p2pk33: { - firstIndex: createMetricPattern18(this, 'first_p2pk33addressindex'), - bytes: createMetricPattern26(this, 'p2pk33bytes'), + firstIndex: createMetricPattern18(this, 'first_p2pk33_address_index'), + bytes: createMetricPattern26(this, 'p2pk33_bytes'), }, p2pkh: { - firstIndex: createMetricPattern18(this, 'first_p2pkhaddressindex'), - bytes: createMetricPattern28(this, 'p2pkhbytes'), + firstIndex: createMetricPattern18(this, 'first_p2pkh_address_index'), + bytes: createMetricPattern28(this, 'p2pkh_bytes'), }, p2sh: { - firstIndex: createMetricPattern18(this, 'first_p2shaddressindex'), - bytes: createMetricPattern29(this, 'p2shbytes'), + firstIndex: createMetricPattern18(this, 'first_p2sh_address_index'), + bytes: createMetricPattern29(this, 'p2sh_bytes'), }, p2wpkh: { - firstIndex: createMetricPattern18(this, 'first_p2wpkhaddressindex'), - bytes: createMetricPattern31(this, 'p2wpkhbytes'), + firstIndex: createMetricPattern18(this, 'first_p2wpkh_address_index'), + bytes: createMetricPattern31(this, 'p2wpkh_bytes'), }, p2wsh: { - firstIndex: createMetricPattern18(this, 'first_p2wshaddressindex'), - bytes: createMetricPattern32(this, 'p2wshbytes'), + firstIndex: createMetricPattern18(this, 'first_p2wsh_address_index'), + bytes: createMetricPattern32(this, 'p2wsh_bytes'), }, p2tr: { - firstIndex: createMetricPattern18(this, 'first_p2traddressindex'), - bytes: createMetricPattern30(this, 'p2trbytes'), + firstIndex: createMetricPattern18(this, 'first_p2tr_address_index'), + bytes: createMetricPattern30(this, 'p2tr_bytes'), }, p2a: { - firstIndex: createMetricPattern18(this, 'first_p2aaddressindex'), - bytes: createMetricPattern24(this, 'p2abytes'), + firstIndex: createMetricPattern18(this, 'first_p2a_address_index'), + bytes: createMetricPattern24(this, 'p2a_bytes'), }, }, indexes: { - p2a: createMetricPattern24(this, 'anyaddressindex'), - p2pk33: createMetricPattern26(this, 'anyaddressindex'), - p2pk65: createMetricPattern27(this, 'anyaddressindex'), - p2pkh: createMetricPattern28(this, 'anyaddressindex'), - p2sh: createMetricPattern29(this, 'anyaddressindex'), - p2tr: createMetricPattern30(this, 'anyaddressindex'), - p2wpkh: createMetricPattern31(this, 'anyaddressindex'), - p2wsh: createMetricPattern32(this, 'anyaddressindex'), + p2a: createMetricPattern24(this, 'any_address_index'), + p2pk33: createMetricPattern26(this, 'any_address_index'), + p2pk65: createMetricPattern27(this, 'any_address_index'), + p2pkh: createMetricPattern28(this, 'any_address_index'), + p2sh: createMetricPattern29(this, 'any_address_index'), + p2tr: createMetricPattern30(this, 'any_address_index'), + p2wpkh: createMetricPattern31(this, 'any_address_index'), + p2wsh: createMetricPattern32(this, 'any_address_index'), funded: createMetricPattern34(this, 'funded_address_index'), empty: createMetricPattern35(this, 'empty_address_index'), }, data: { - funded: createMetricPattern34(this, 'fundedaddressdata'), - empty: createMetricPattern35(this, 'emptyaddressdata'), + funded: createMetricPattern34(this, 'funded_address_data'), + empty: createMetricPattern35(this, 'empty_address_data'), }, funded: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3(this, 'address_count'), empty: createAllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3(this, 'empty_address_count'), @@ -7205,20 +7172,20 @@ class BrkClient extends BrkClientBase { scripts: { raw: { empty: { - firstIndex: createMetricPattern18(this, 'first_emptyoutputindex'), - toTxindex: createMetricPattern22(this, 'txindex'), + firstIndex: createMetricPattern18(this, 'first_empty_output_index'), + toTxIndex: createMetricPattern22(this, 'tx_index'), }, opreturn: { - firstIndex: createMetricPattern18(this, 'first_opreturnindex'), - toTxindex: createMetricPattern23(this, 'txindex'), + firstIndex: createMetricPattern18(this, 'first_op_return_index'), + toTxIndex: createMetricPattern23(this, 'tx_index'), }, p2ms: { - firstIndex: createMetricPattern18(this, 'first_p2msoutputindex'), - toTxindex: createMetricPattern25(this, 'txindex'), + firstIndex: createMetricPattern18(this, 'first_p2ms_output_index'), + toTxIndex: createMetricPattern25(this, 'tx_index'), }, unknown: { - firstIndex: createMetricPattern18(this, 'first_unknownoutputindex'), - toTxindex: createMetricPattern33(this, 'txindex'), + firstIndex: createMetricPattern18(this, 'first_unknown_output_index'), + toTxIndex: createMetricPattern33(this, 'tx_index'), }, }, count: { @@ -7232,8 +7199,8 @@ class BrkClient extends BrkClientBase { p2wpkh: createBaseCumulativeSumPattern(this, 'p2wpkh_count'), p2wsh: createBaseCumulativeSumPattern(this, 'p2wsh_count'), opreturn: createBaseCumulativeSumPattern(this, 'opreturn_count'), - emptyoutput: createBaseCumulativeSumPattern(this, 'emptyoutput_count'), - unknownoutput: createBaseCumulativeSumPattern(this, 'unknownoutput_count'), + emptyOutput: createBaseCumulativeSumPattern(this, 'empty_output_count'), + unknownOutput: createBaseCumulativeSumPattern(this, 'unknown_output_count'), segwit: createBaseCumulativeSumPattern(this, 'segwit_count'), }, value: { @@ -7243,8 +7210,8 @@ class BrkClient extends BrkClientBase { }, }, adoption: { - taproot: createBpsPercentRatioPattern4(this, 'taproot_adoption'), - segwit: createBpsPercentRatioPattern4(this, 'segwit_adoption'), + taproot: createBpsPercentRatioPattern3(this, 'taproot_adoption'), + segwit: createBpsPercentRatioPattern3(this, 'segwit_adoption'), }, }, mining: { @@ -7259,7 +7226,7 @@ class BrkClient extends BrkClientBase { fees: { base: createBtcCentsSatsUsdPattern(this, 'fees'), cumulative: createBtcCentsSatsUsdPattern(this, 'fees_cumulative'), - sum: create_1m1w1y24hPattern6(this, 'fees_sum'), + sum: create_1m1w1y24hPattern5(this, 'fees_sum'), _24h: createAverageMaxMedianMinPct10Pct25Pct75Pct90Pattern(this, 'fees_24h'), _1w: createAverageMaxMedianMinPct10Pct25Pct75Pct90Pattern(this, 'fees_1w'), _1m: createAverageMaxMedianMinPct10Pct25Pct75Pct90Pattern(this, 'fees_1m'), @@ -7328,7 +7295,7 @@ class BrkClient extends BrkClientBase { cumulativeMarketCap: createMetricPattern1(this, 'cumulative_market_cap'), }, adjusted: { - inflationRate: createBpsPercentRatioPattern2(this, 'cointime_adj_inflation_rate'), + inflationRate: createBpsPercentRatioPattern(this, 'cointime_adj_inflation_rate'), txVelocityBtc: createMetricPattern1(this, 'cointime_adj_tx_velocity_btc'), txVelocityUsd: createMetricPattern1(this, 'cointime_adj_tx_velocity_usd'), }, @@ -7337,10 +7304,7 @@ class BrkClient extends BrkClientBase { vocddMedian1y: createMetricPattern18(this, 'vocdd_median_1y'), hodlBank: createMetricPattern18(this, 'hodl_bank'), }, - coinblocksDestroyed: { - base: createMetricPattern1(this, 'coinblocks_destroyed'), - cumulative: createMetricPattern1(this, 'coinblocks_destroyed_cumulative'), - }, + coinblocksDestroyed: createBaseCumulativeSumPattern(this, 'coinblocks_destroyed'), }, constants: { _0: createMetricPattern1(this, 'constant_0'), @@ -7365,40 +7329,40 @@ class BrkClient extends BrkClientBase { indexes: { address: { p2pk33: { - identity: createMetricPattern26(this, 'p2pk33addressindex'), + identity: createMetricPattern26(this, 'p2pk33_address_index'), }, p2pk65: { - identity: createMetricPattern27(this, 'p2pk65addressindex'), + identity: createMetricPattern27(this, 'p2pk65_address_index'), }, p2pkh: { - identity: createMetricPattern28(this, 'p2pkhaddressindex'), + identity: createMetricPattern28(this, 'p2pkh_address_index'), }, p2sh: { - identity: createMetricPattern29(this, 'p2shaddressindex'), + identity: createMetricPattern29(this, 'p2sh_address_index'), }, p2tr: { - identity: createMetricPattern30(this, 'p2traddressindex'), + identity: createMetricPattern30(this, 'p2tr_address_index'), }, p2wpkh: { - identity: createMetricPattern31(this, 'p2wpkhaddressindex'), + identity: createMetricPattern31(this, 'p2wpkh_address_index'), }, p2wsh: { - identity: createMetricPattern32(this, 'p2wshaddressindex'), + identity: createMetricPattern32(this, 'p2wsh_address_index'), }, p2a: { - identity: createMetricPattern24(this, 'p2aaddressindex'), + identity: createMetricPattern24(this, 'p2a_address_index'), }, p2ms: { - identity: createMetricPattern25(this, 'p2msoutputindex'), + identity: createMetricPattern25(this, 'p2ms_output_index'), }, empty: { - identity: createMetricPattern22(this, 'emptyoutputindex'), + identity: createMetricPattern22(this, 'empty_output_index'), }, unknown: { - identity: createMetricPattern33(this, 'unknownoutputindex'), + identity: createMetricPattern33(this, 'unknown_output_index'), }, opreturn: { - identity: createMetricPattern23(this, 'opreturnindex'), + identity: createMetricPattern23(this, 'op_return_index'), }, }, height: { @@ -7418,7 +7382,7 @@ class BrkClient extends BrkClientBase { month6: createMetricPattern18(this, 'month6'), year1: createMetricPattern18(this, 'year1'), year10: createMetricPattern18(this, 'year10'), - txindexCount: createMetricPattern18(this, 'txindex_count'), + txIndexCount: createMetricPattern18(this, 'tx_index_count'), }, epoch: { identity: createMetricPattern17(this, 'epoch'), @@ -7489,22 +7453,22 @@ class BrkClient extends BrkClientBase { date: createMetricPattern15(this, 'date'), firstHeight: createMetricPattern15(this, 'year10_first_height'), }, - txindex: { - identity: createMetricPattern19(this, 'txindex'), + txIndex: { + identity: createMetricPattern19(this, 'tx_index'), inputCount: createMetricPattern19(this, 'input_count'), outputCount: createMetricPattern19(this, 'output_count'), }, - txinindex: { - identity: createMetricPattern20(this, 'txinindex'), + txinIndex: { + identity: createMetricPattern20(this, 'txin_index'), }, - txoutindex: { - identity: createMetricPattern21(this, 'txoutindex'), + txoutIndex: { + identity: createMetricPattern21(this, 'txout_index'), }, }, indicators: { puellMultiple: createBpsRatioPattern2(this, 'puell_multiple'), nvt: createBpsRatioPattern2(this, 'nvt'), - gini: createBpsPercentRatioPattern4(this, 'gini'), + gini: createBpsPercentRatioPattern3(this, 'gini'), rhodlRatio: createBpsRatioPattern2(this, 'rhodl_ratio'), thermocapMultiple: createBpsRatioPattern2(this, 'thermocap_multiple'), coindaysDestroyedSupplyAdjusted: createMetricPattern1(this, 'coindays_destroyed_supply_adjusted'), @@ -7542,19 +7506,19 @@ class BrkClient extends BrkClientBase { }, returns: { periods: { - _24h: createBpsPercentRatioPattern2(this, 'price_return_24h'), - _1w: createBpsPercentRatioPattern2(this, 'price_return_1w'), - _1m: createBpsPercentRatioPattern2(this, 'price_return_1m'), - _3m: createBpsPercentRatioPattern2(this, 'price_return_3m'), - _6m: createBpsPercentRatioPattern2(this, 'price_return_6m'), - _1y: createBpsPercentRatioPattern2(this, 'price_return_1y'), - _2y: createBpsPercentRatioPattern2(this, 'price_return_2y'), - _3y: createBpsPercentRatioPattern2(this, 'price_return_3y'), - _4y: createBpsPercentRatioPattern2(this, 'price_return_4y'), - _5y: createBpsPercentRatioPattern2(this, 'price_return_5y'), - _6y: createBpsPercentRatioPattern2(this, 'price_return_6y'), - _8y: createBpsPercentRatioPattern2(this, 'price_return_8y'), - _10y: createBpsPercentRatioPattern2(this, 'price_return_10y'), + _24h: createBpsPercentRatioPattern(this, 'price_return_24h'), + _1w: createBpsPercentRatioPattern(this, 'price_return_1w'), + _1m: createBpsPercentRatioPattern(this, 'price_return_1m'), + _3m: createBpsPercentRatioPattern(this, 'price_return_3m'), + _6m: createBpsPercentRatioPattern(this, 'price_return_6m'), + _1y: createBpsPercentRatioPattern(this, 'price_return_1y'), + _2y: createBpsPercentRatioPattern(this, 'price_return_2y'), + _3y: createBpsPercentRatioPattern(this, 'price_return_3y'), + _4y: createBpsPercentRatioPattern(this, 'price_return_4y'), + _5y: createBpsPercentRatioPattern(this, 'price_return_5y'), + _6y: createBpsPercentRatioPattern(this, 'price_return_6y'), + _8y: createBpsPercentRatioPattern(this, 'price_return_8y'), + _10y: createBpsPercentRatioPattern(this, 'price_return_10y'), }, cagr: create_10y2y3y4y5y6y8yPattern(this, 'price_cagr'), sd24h: { @@ -7579,7 +7543,7 @@ class BrkClient extends BrkClientBase { max: create_1m1w1y2wPattern(this, 'price_max'), trueRange: createMetricPattern1(this, 'price_true_range'), trueRangeSum2w: createMetricPattern1(this, 'price_true_range_sum_2w'), - choppinessIndex2w: createBpsPercentRatioPattern4(this, 'price_choppiness_index_2w'), + choppinessIndex2w: createBpsPercentRatioPattern3(this, 'price_choppiness_index_2w'), }, movingAverage: { sma: { @@ -7699,18 +7663,18 @@ class BrkClient extends BrkClientBase { from2026: createCentsSatsUsdPattern(this, 'dca_cost_basis_from_2026'), }, return: { - from2015: createBpsPercentRatioPattern2(this, 'dca_return_from_2015'), - from2016: createBpsPercentRatioPattern2(this, 'dca_return_from_2016'), - from2017: createBpsPercentRatioPattern2(this, 'dca_return_from_2017'), - from2018: createBpsPercentRatioPattern2(this, 'dca_return_from_2018'), - from2019: createBpsPercentRatioPattern2(this, 'dca_return_from_2019'), - from2020: createBpsPercentRatioPattern2(this, 'dca_return_from_2020'), - from2021: createBpsPercentRatioPattern2(this, 'dca_return_from_2021'), - from2022: createBpsPercentRatioPattern2(this, 'dca_return_from_2022'), - from2023: createBpsPercentRatioPattern2(this, 'dca_return_from_2023'), - from2024: createBpsPercentRatioPattern2(this, 'dca_return_from_2024'), - from2025: createBpsPercentRatioPattern2(this, 'dca_return_from_2025'), - from2026: createBpsPercentRatioPattern2(this, 'dca_return_from_2026'), + from2015: createBpsPercentRatioPattern(this, 'dca_return_from_2015'), + from2016: createBpsPercentRatioPattern(this, 'dca_return_from_2016'), + from2017: createBpsPercentRatioPattern(this, 'dca_return_from_2017'), + from2018: createBpsPercentRatioPattern(this, 'dca_return_from_2018'), + from2019: createBpsPercentRatioPattern(this, 'dca_return_from_2019'), + from2020: createBpsPercentRatioPattern(this, 'dca_return_from_2020'), + from2021: createBpsPercentRatioPattern(this, 'dca_return_from_2021'), + from2022: createBpsPercentRatioPattern(this, 'dca_return_from_2022'), + from2023: createBpsPercentRatioPattern(this, 'dca_return_from_2023'), + from2024: createBpsPercentRatioPattern(this, 'dca_return_from_2024'), + from2025: createBpsPercentRatioPattern(this, 'dca_return_from_2025'), + from2026: createBpsPercentRatioPattern(this, 'dca_return_from_2026'), }, }, }, @@ -7722,40 +7686,40 @@ class BrkClient extends BrkClientBase { losses: createMetricPattern1(this, 'rsi_losses_1w'), averageGain: createMetricPattern1(this, 'rsi_average_gain_1w'), averageLoss: createMetricPattern1(this, 'rsi_average_loss_1w'), - rsi: createBpsPercentRatioPattern4(this, 'rsi_1w'), - rsiMin: createBpsPercentRatioPattern4(this, 'rsi_min_1w'), - rsiMax: createBpsPercentRatioPattern4(this, 'rsi_max_1w'), - stochRsi: createBpsPercentRatioPattern4(this, 'rsi_stoch_1w'), - stochRsiK: createBpsPercentRatioPattern4(this, 'rsi_stoch_k_1w'), - stochRsiD: createBpsPercentRatioPattern4(this, 'rsi_stoch_d_1w'), + rsi: createBpsPercentRatioPattern3(this, 'rsi_1w'), + rsiMin: createBpsPercentRatioPattern3(this, 'rsi_min_1w'), + rsiMax: createBpsPercentRatioPattern3(this, 'rsi_max_1w'), + stochRsi: createBpsPercentRatioPattern3(this, 'rsi_stoch_1w'), + stochRsiK: createBpsPercentRatioPattern3(this, 'rsi_stoch_k_1w'), + stochRsiD: createBpsPercentRatioPattern3(this, 'rsi_stoch_d_1w'), }, _1m: { gains: createMetricPattern1(this, 'rsi_gains_1m'), losses: createMetricPattern1(this, 'rsi_losses_1m'), averageGain: createMetricPattern1(this, 'rsi_average_gain_1m'), averageLoss: createMetricPattern1(this, 'rsi_average_loss_1m'), - rsi: createBpsPercentRatioPattern4(this, 'rsi_1m'), - rsiMin: createBpsPercentRatioPattern4(this, 'rsi_min_1m'), - rsiMax: createBpsPercentRatioPattern4(this, 'rsi_max_1m'), - stochRsi: createBpsPercentRatioPattern4(this, 'rsi_stoch_1m'), - stochRsiK: createBpsPercentRatioPattern4(this, 'rsi_stoch_k_1m'), - stochRsiD: createBpsPercentRatioPattern4(this, 'rsi_stoch_d_1m'), + rsi: createBpsPercentRatioPattern3(this, 'rsi_1m'), + rsiMin: createBpsPercentRatioPattern3(this, 'rsi_min_1m'), + rsiMax: createBpsPercentRatioPattern3(this, 'rsi_max_1m'), + stochRsi: createBpsPercentRatioPattern3(this, 'rsi_stoch_1m'), + stochRsiK: createBpsPercentRatioPattern3(this, 'rsi_stoch_k_1m'), + stochRsiD: createBpsPercentRatioPattern3(this, 'rsi_stoch_d_1m'), }, _1y: { gains: createMetricPattern1(this, 'rsi_gains_1y'), losses: createMetricPattern1(this, 'rsi_losses_1y'), averageGain: createMetricPattern1(this, 'rsi_average_gain_1y'), averageLoss: createMetricPattern1(this, 'rsi_average_loss_1y'), - rsi: createBpsPercentRatioPattern4(this, 'rsi_1y'), - rsiMin: createBpsPercentRatioPattern4(this, 'rsi_min_1y'), - rsiMax: createBpsPercentRatioPattern4(this, 'rsi_max_1y'), - stochRsi: createBpsPercentRatioPattern4(this, 'rsi_stoch_1y'), - stochRsiK: createBpsPercentRatioPattern4(this, 'rsi_stoch_k_1y'), - stochRsiD: createBpsPercentRatioPattern4(this, 'rsi_stoch_d_1y'), + rsi: createBpsPercentRatioPattern3(this, 'rsi_1y'), + rsiMin: createBpsPercentRatioPattern3(this, 'rsi_min_1y'), + rsiMax: createBpsPercentRatioPattern3(this, 'rsi_max_1y'), + stochRsi: createBpsPercentRatioPattern3(this, 'rsi_stoch_1y'), + stochRsiK: createBpsPercentRatioPattern3(this, 'rsi_stoch_k_1y'), + stochRsiD: createBpsPercentRatioPattern3(this, 'rsi_stoch_d_1y'), }, }, - stochK: createBpsPercentRatioPattern4(this, 'stoch_k'), - stochD: createBpsPercentRatioPattern4(this, 'stoch_d'), + stochK: createBpsPercentRatioPattern3(this, 'stoch_k'), + stochD: createBpsPercentRatioPattern3(this, 'stoch_d'), piCycle: createBpsRatioPattern2(this, 'pi_cycle'), macd: { _24h: createEmaHistogramLineSignalPattern(this, 'macd'), @@ -7976,7 +7940,7 @@ class BrkClient extends BrkClientBase { opreturn: createBaseCumulativeSumPattern4(this, 'opreturn_supply'), unspendable: createBaseCumulativeSumPattern4(this, 'unspendable_supply'), }, - inflationRate: createBpsPercentRatioPattern2(this, 'inflation_rate'), + inflationRate: createBpsPercentRatioPattern(this, 'inflation_rate'), velocity: { btc: createMetricPattern1(this, 'velocity_btc'), usd: createMetricPattern1(this, 'velocity_usd'), @@ -7994,7 +7958,7 @@ class BrkClient extends BrkClientBase { inLoss: createBtcCentsRelSatsUsdPattern2(this, 'supply_in_loss'), total: createBtcCentsSatsUsdPattern(this, 'supply'), half: createBtcCentsSatsUsdPattern(this, 'supply_half'), - delta: createChangeRatePattern2(this, 'supply_delta'), + delta: createChangeRatePattern(this, 'supply_delta'), }, outputs: createUnspentPattern(this, 'utxo_count'), activity: createCoindaysCoinyearsDormancySentVelocityPattern(this, ''), @@ -8008,21 +7972,21 @@ class BrkClient extends BrkClientBase { negative: createMetricPattern1(this, 'neg_unrealized_loss'), base: createCentsUsdPattern2(this, 'unrealized_loss'), cumulative: createCentsUsdPattern2(this, 'unrealized_loss_cumulative'), - sum: create_1m1w1y24hPattern5(this, 'unrealized_loss_sum'), - relToMcap: createBpsPercentRatioPattern4(this, 'unrealized_loss_rel_to_mcap'), - relToOwnGross: createBpsPercentRatioPattern4(this, 'unrealized_loss_rel_to_own_gross_pnl'), + sum: create_1m1w1y24hPattern4(this, 'unrealized_loss_sum'), + relToMcap: createBpsPercentRatioPattern3(this, 'unrealized_loss_rel_to_mcap'), + relToOwnGross: createBpsPercentRatioPattern3(this, 'unrealized_loss_rel_to_own_gross_pnl'), }, netPnl: { cents: createMetricPattern1(this, 'net_unrealized_pnl_cents'), usd: createMetricPattern1(this, 'net_unrealized_pnl'), - relToOwnGross: createBpsPercentRatioPattern2(this, 'net_unrealized_pnl_rel_to_own_gross_pnl'), + relToOwnGross: createBpsPercentRatioPattern(this, 'net_unrealized_pnl_rel_to_own_gross_pnl'), }, profit: { base: createCentsUsdPattern2(this, 'unrealized_profit'), cumulative: createCentsUsdPattern2(this, 'unrealized_profit_cumulative'), - sum: create_1m1w1y24hPattern5(this, 'unrealized_profit_sum'), - relToMcap: createBpsPercentRatioPattern4(this, 'unrealized_profit_rel_to_mcap'), - relToOwnGross: createBpsPercentRatioPattern4(this, 'unrealized_profit_rel_to_own_gross_pnl'), + sum: create_1m1w1y24hPattern4(this, 'unrealized_profit_sum'), + relToMcap: createBpsPercentRatioPattern3(this, 'unrealized_profit_rel_to_mcap'), + relToOwnGross: createBpsPercentRatioPattern3(this, 'unrealized_profit_rel_to_own_gross_pnl'), }, nupl: createBpsRatioPattern(this, 'nupl'), }, @@ -8043,12 +8007,7 @@ class BrkClient extends BrkClientBase { profit: createBaseCumulativeDistributionRelSumValuePattern(this, 'lth'), loss: createBaseCapitulationCumulativeNegativeRelSumValuePattern(this, 'lth'), grossPnl: createBaseCumulativeSumPattern3(this, 'lth_realized_gross_pnl'), - sellSideRiskRatio: { - _24h: createBpsPercentRatioPattern(this, 'lth_sell_side_risk_ratio_24h'), - _1w: createBpsPercentRatioPattern(this, 'lth_sell_side_risk_ratio_1w'), - _1m: createBpsPercentRatioPattern(this, 'lth_sell_side_risk_ratio_1m'), - _1y: createBpsPercentRatioPattern(this, 'lth_sell_side_risk_ratio_1y'), - }, + sellSideRiskRatio: create_1m1w1y24hPattern6(this, 'lth_sell_side_risk_ratio'), netPnl: createBaseChangeCumulativeDeltaRelSumPattern(this, 'lth_net'), sopr: { ratio: create_1m1w1y24hPattern(this, 'lth_sopr'), diff --git a/packages/brk_client/brk_client/__init__.py b/packages/brk_client/brk_client/__init__.py index cc106045e..635a6c050 100644 --- a/packages/brk_client/brk_client/__init__.py +++ b/packages/brk_client/brk_client/__init__.py @@ -198,7 +198,7 @@ Week1 = int Year1 = int Year10 = int # Aggregation dimension for querying metrics. Includes time-based (date, week, month, year), -# block-based (height, txindex), and address/output type indexes. +# block-based (height, tx_index), and address/output type indexes. Index = Literal["minute10", "minute30", "hour1", "hour4", "hour12", "day1", "day3", "week1", "month1", "month3", "month6", "year1", "year10", "halving", "epoch", "height", "txindex", "txinindex", "txoutindex", "emptyoutputindex", "opreturnindex", "p2aaddressindex", "p2msoutputindex", "p2pk33addressindex", "p2pk65addressindex", "p2pkhaddressindex", "p2shaddressindex", "p2traddressindex", "p2wpkhaddressindex", "p2wshaddressindex", "unknownoutputindex", "fundedaddressindex", "emptyaddressindex", "pairoutputindex"] # Hierarchical tree node for organizing metrics into categories TreeNode = Union[dict[str, "TreeNode"], "MetricLeafWithSchema"] @@ -1643,23 +1643,23 @@ _i15 = ('year10',) _i16 = ('halving',) _i17 = ('epoch',) _i18 = ('height',) -_i19 = ('txindex',) -_i20 = ('txinindex',) -_i21 = ('txoutindex',) -_i22 = ('emptyoutputindex',) -_i23 = ('opreturnindex',) -_i24 = ('p2aaddressindex',) -_i25 = ('p2msoutputindex',) -_i26 = ('p2pk33addressindex',) -_i27 = ('p2pk65addressindex',) -_i28 = ('p2pkhaddressindex',) -_i29 = ('p2shaddressindex',) -_i30 = ('p2traddressindex',) -_i31 = ('p2wpkhaddressindex',) -_i32 = ('p2wshaddressindex',) -_i33 = ('unknownoutputindex',) -_i34 = ('fundedaddressindex',) -_i35 = ('emptyaddressindex',) +_i19 = ('tx_index',) +_i20 = ('txin_index',) +_i21 = ('txout_index',) +_i22 = ('empty_output_index',) +_i23 = ('op_return_index',) +_i24 = ('p2a_address_index',) +_i25 = ('p2ms_output_index',) +_i26 = ('p2pk33_address_index',) +_i27 = ('p2pk65_address_index',) +_i28 = ('p2pkh_address_index',) +_i29 = ('p2sh_address_index',) +_i30 = ('p2tr_address_index',) +_i31 = ('p2wpkh_address_index',) +_i32 = ('p2wsh_address_index',) +_i33 = ('unknown_output_index',) +_i34 = ('funded_address_index',) +_i35 = ('empty_address_index',) def _ep(c: BrkClientBase, n: str, i: Index) -> MetricEndpointBuilder[Any]: return MetricEndpointBuilder(c, n, i) @@ -1916,7 +1916,7 @@ class MetricPattern18(Generic[T]): class _MetricPattern19By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def txindex(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'txindex') + def tx_index(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'tx_index') class MetricPattern19(Generic[T]): by: _MetricPattern19By[T] @@ -1928,7 +1928,7 @@ class MetricPattern19(Generic[T]): class _MetricPattern20By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def txinindex(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'txinindex') + def txin_index(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'txin_index') class MetricPattern20(Generic[T]): by: _MetricPattern20By[T] @@ -1940,7 +1940,7 @@ class MetricPattern20(Generic[T]): class _MetricPattern21By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def txoutindex(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'txoutindex') + def txout_index(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'txout_index') class MetricPattern21(Generic[T]): by: _MetricPattern21By[T] @@ -1952,7 +1952,7 @@ class MetricPattern21(Generic[T]): class _MetricPattern22By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def emptyoutputindex(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'emptyoutputindex') + def empty_output_index(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'empty_output_index') class MetricPattern22(Generic[T]): by: _MetricPattern22By[T] @@ -1964,7 +1964,7 @@ class MetricPattern22(Generic[T]): class _MetricPattern23By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def opreturnindex(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'opreturnindex') + def op_return_index(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'op_return_index') class MetricPattern23(Generic[T]): by: _MetricPattern23By[T] @@ -1976,7 +1976,7 @@ class MetricPattern23(Generic[T]): class _MetricPattern24By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def p2aaddressindex(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'p2aaddressindex') + def p2a_address_index(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'p2a_address_index') class MetricPattern24(Generic[T]): by: _MetricPattern24By[T] @@ -1988,7 +1988,7 @@ class MetricPattern24(Generic[T]): class _MetricPattern25By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def p2msoutputindex(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'p2msoutputindex') + def p2ms_output_index(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'p2ms_output_index') class MetricPattern25(Generic[T]): by: _MetricPattern25By[T] @@ -2000,7 +2000,7 @@ class MetricPattern25(Generic[T]): class _MetricPattern26By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def p2pk33addressindex(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'p2pk33addressindex') + def p2pk33_address_index(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'p2pk33_address_index') class MetricPattern26(Generic[T]): by: _MetricPattern26By[T] @@ -2012,7 +2012,7 @@ class MetricPattern26(Generic[T]): class _MetricPattern27By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def p2pk65addressindex(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'p2pk65addressindex') + def p2pk65_address_index(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'p2pk65_address_index') class MetricPattern27(Generic[T]): by: _MetricPattern27By[T] @@ -2024,7 +2024,7 @@ class MetricPattern27(Generic[T]): class _MetricPattern28By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def p2pkhaddressindex(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'p2pkhaddressindex') + def p2pkh_address_index(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'p2pkh_address_index') class MetricPattern28(Generic[T]): by: _MetricPattern28By[T] @@ -2036,7 +2036,7 @@ class MetricPattern28(Generic[T]): class _MetricPattern29By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def p2shaddressindex(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'p2shaddressindex') + def p2sh_address_index(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'p2sh_address_index') class MetricPattern29(Generic[T]): by: _MetricPattern29By[T] @@ -2048,7 +2048,7 @@ class MetricPattern29(Generic[T]): class _MetricPattern30By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def p2traddressindex(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'p2traddressindex') + def p2tr_address_index(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'p2tr_address_index') class MetricPattern30(Generic[T]): by: _MetricPattern30By[T] @@ -2060,7 +2060,7 @@ class MetricPattern30(Generic[T]): class _MetricPattern31By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def p2wpkhaddressindex(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'p2wpkhaddressindex') + def p2wpkh_address_index(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'p2wpkh_address_index') class MetricPattern31(Generic[T]): by: _MetricPattern31By[T] @@ -2072,7 +2072,7 @@ class MetricPattern31(Generic[T]): class _MetricPattern32By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def p2wshaddressindex(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'p2wshaddressindex') + def p2wsh_address_index(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'p2wsh_address_index') class MetricPattern32(Generic[T]): by: _MetricPattern32By[T] @@ -2084,7 +2084,7 @@ class MetricPattern32(Generic[T]): class _MetricPattern33By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def unknownoutputindex(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'unknownoutputindex') + def unknown_output_index(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'unknown_output_index') class MetricPattern33(Generic[T]): by: _MetricPattern33By[T] @@ -2096,7 +2096,7 @@ class MetricPattern33(Generic[T]): class _MetricPattern34By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def fundedaddressindex(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'fundedaddressindex') + def funded_address_index(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'funded_address_index') class MetricPattern34(Generic[T]): by: _MetricPattern34By[T] @@ -2108,7 +2108,7 @@ class MetricPattern34(Generic[T]): class _MetricPattern35By(Generic[T]): def __init__(self, c: BrkClientBase, n: str): self._c, self._n = c, n - def emptyaddressindex(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'emptyaddressindex') + def empty_address_index(self) -> MetricEndpointBuilder[T]: return _ep(self._c, self._n, 'empty_address_index') class MetricPattern35(Generic[T]): by: _MetricPattern35By[T] @@ -2171,18 +2171,18 @@ class _10y1m1w1y2y3m3y4y5y6m6y8yPattern2: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self._10y: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, '10y')) - self._1m: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, '1m')) - self._1w: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, '1w')) - self._1y: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, '1y')) - self._2y: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, '2y')) - self._3m: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, '3m')) - self._3y: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, '3y')) - self._4y: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, '4y')) - self._5y: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, '5y')) - self._6m: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, '6m')) - self._6y: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, '6y')) - self._8y: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, '8y')) + self._10y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '10y')) + self._1m: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '1m')) + self._1w: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '1w')) + self._1y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '1y')) + self._2y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '2y')) + self._3m: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '3m')) + self._3y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '3y')) + self._4y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '4y')) + self._5y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '5y')) + self._6m: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '6m')) + self._6y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '6y')) + self._8y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '8y')) class _10y1m1w1y2y3m3y4y5y6m6y8yPattern3: """Pattern struct for repeated tree structure.""" @@ -2217,7 +2217,7 @@ class CapGrossInvestorLossMvrvNetPeakPriceProfitSellSoprPattern: self.price: BpsCentsPercentilesRatioSatsSmaStdUsdPattern = BpsCentsPercentilesRatioSatsSmaStdUsdPattern(client, _m(acc, 'realized_price')) self.profit: BaseCumulativeDistributionRelSumValuePattern = BaseCumulativeDistributionRelSumValuePattern(client, acc) self.profit_to_loss_ratio: _1m1w1y24hPattern[StoredF64] = _1m1w1y24hPattern(client, _m(acc, 'realized_profit_to_loss_ratio')) - self.sell_side_risk_ratio: _1m1w1y24hPattern2 = _1m1w1y24hPattern2(client, _m(acc, 'sell_side_risk_ratio')) + self.sell_side_risk_ratio: _1m1w1y24hPattern6 = _1m1w1y24hPattern6(client, _m(acc, 'sell_side_risk_ratio')) self.sopr: AdjustedRatioValuePattern = AdjustedRatioValuePattern(client, acc) class AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90RollingSumPattern: @@ -2263,12 +2263,12 @@ class AverageGainsLossesRsiStochPattern: self.average_loss: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'average_loss_24h')) self.gains: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'gains_24h')) self.losses: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'losses_24h')) - self.rsi: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, '24h')) - self.rsi_max: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'max_24h')) - self.rsi_min: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'min_24h')) - self.stoch_rsi: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'stoch_24h')) - self.stoch_rsi_d: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'stoch_d_24h')) - self.stoch_rsi_k: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'stoch_k_24h')) + self.rsi: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, '24h')) + self.rsi_max: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'max_24h')) + self.rsi_min: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'min_24h')) + self.stoch_rsi: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'stoch_24h')) + self.stoch_rsi_d: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'stoch_d_24h')) + self.stoch_rsi_k: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'stoch_k_24h')) class AllP2aP2pk33P2pk65P2pkhP2shP2trP2wpkhP2wshPattern3: """Pattern struct for repeated tree structure.""" @@ -2323,8 +2323,8 @@ class BaseCapitulationCumulativeNegativeRelSumValuePattern: self.capitulation_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'capitulation_flow')) self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, _m(acc, 'realized_loss_cumulative')) self.negative: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_realized_loss')) - self.rel_to_rcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_loss_rel_to_rcap')) - self.sum: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, _m(acc, 'realized_loss_sum')) + self.rel_to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'realized_loss_rel_to_rcap')) + self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, _m(acc, 'realized_loss_sum')) self.value_created: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, _m(acc, 'loss_value_created')) self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, _m(acc, 'loss_value_destroyed')) @@ -2361,23 +2361,23 @@ class _10y2y3y4y5y6y8yPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self._10y: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, '10y')) - self._2y: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, '2y')) - self._3y: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, '3y')) - self._4y: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, '4y')) - self._5y: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, '5y')) - self._6y: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, '6y')) - self._8y: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, '8y')) + self._10y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '10y')) + self._2y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '2y')) + self._3y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '3y')) + self._4y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '4y')) + self._5y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '5y')) + self._6y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '6y')) + self._8y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '8y')) class _1m1w1y24hBpsPercentRatioPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self._1m: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, '1m')) - self._1w: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, '1w')) - self._1y: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, '1y')) - self._24h: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, '24h')) + self._1m: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, '1m')) + self._1w: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, '1w')) + self._1y: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, '1y')) + self._24h: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, '24h')) self.bps: MetricPattern1[BasisPoints16] = MetricPattern1(client, _m(acc, 'bps')) self.percent: MetricPattern1[StoredF32] = MetricPattern1(client, acc) self.ratio: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'ratio')) @@ -2390,8 +2390,8 @@ class BaseCumulativeDistributionRelSumValuePattern: self.base: CentsUsdPattern2 = CentsUsdPattern2(client, _m(acc, 'realized_profit')) self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, _m(acc, 'realized_profit_cumulative')) self.distribution_flow: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'distribution_flow')) - self.rel_to_rcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_profit_rel_to_rcap')) - self.sum: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, _m(acc, 'realized_profit_sum')) + self.rel_to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'realized_profit_rel_to_rcap')) + self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, _m(acc, 'realized_profit_sum')) self.value_created: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, _m(acc, 'profit_value_created')) self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, _m(acc, 'profit_value_destroyed')) @@ -2403,10 +2403,10 @@ class BaseCumulativeNegativeRelSumPattern2: self.base: CentsUsdPattern2 = CentsUsdPattern2(client, _m(acc, 'unrealized_loss')) self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, _m(acc, 'unrealized_loss_cumulative')) self.negative: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_unrealized_loss')) - self.rel_to_mcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'unrealized_loss_rel_to_mcap')) - self.rel_to_own_gross: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'unrealized_loss_rel_to_own_gross_pnl')) - self.rel_to_own_mcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'unrealized_loss_rel_to_own_mcap')) - self.sum: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, _m(acc, 'unrealized_loss_sum')) + self.rel_to_mcap: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'unrealized_loss_rel_to_mcap')) + self.rel_to_own_gross: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'unrealized_loss_rel_to_own_gross_pnl')) + self.rel_to_own_mcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'unrealized_loss_rel_to_own_mcap')) + self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, _m(acc, 'unrealized_loss_sum')) class CapLossMvrvNetPriceProfitSoprPattern: """Pattern struct for repeated tree structure.""" @@ -2454,9 +2454,9 @@ class BaseChangeCumulativeDeltaRelSumPattern: self.base: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'realized_pnl')) self.change_1m: RelPattern = RelPattern(client, _m(acc, 'pnl_change_1m_rel_to')) self.cumulative: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'realized_pnl_cumulative')) - self.delta: ChangeRatePattern3 = ChangeRatePattern3(client, _m(acc, 'realized_pnl_delta')) - self.rel_to_rcap: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, 'realized_pnl_rel_to_rcap')) - self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, _m(acc, 'realized_pnl_sum')) + self.delta: ChangeRatePattern2 = ChangeRatePattern2(client, _m(acc, 'realized_pnl_delta')) + self.rel_to_rcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'realized_pnl_rel_to_rcap')) + self.sum: _1m1w1y24hPattern3 = _1m1w1y24hPattern3(client, _m(acc, 'realized_pnl_sum')) class BaseCumulativeRelSumPattern2: """Pattern struct for repeated tree structure.""" @@ -2465,10 +2465,10 @@ class BaseCumulativeRelSumPattern2: """Create pattern node with accumulated metric name.""" self.base: CentsUsdPattern2 = CentsUsdPattern2(client, acc) self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, _m(acc, 'cumulative')) - self.rel_to_mcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'rel_to_mcap')) - self.rel_to_own_gross: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'rel_to_own_gross_pnl')) - self.rel_to_own_mcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'rel_to_own_mcap')) - self.sum: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, _m(acc, 'sum')) + self.rel_to_mcap: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'rel_to_mcap')) + self.rel_to_own_gross: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'rel_to_own_gross_pnl')) + self.rel_to_own_mcap: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'rel_to_own_mcap')) + self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, _m(acc, 'sum')) class BpsCentsPercentilesRatioSatsUsdPattern: """Pattern struct for repeated tree structure.""" @@ -2489,8 +2489,8 @@ class BtcCentsRelSatsUsdPattern3: """Create pattern node with accumulated metric name.""" self.btc: MetricPattern1[Bitcoin] = MetricPattern1(client, acc) self.cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'cents')) - self.rel_to_circulating: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'rel_to_circulating')) - self.rel_to_own: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'rel_to_own')) + self.rel_to_circulating: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'rel_to_circulating')) + self.rel_to_own: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'rel_to_own')) self.sats: MetricPattern1[Sats] = MetricPattern1(client, _m(acc, 'sats')) self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'usd')) @@ -2511,11 +2511,11 @@ class DeltaHalfInRelTotalPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.delta: ChangeRatePattern2 = ChangeRatePattern2(client, _m(acc, 'delta')) + self.delta: ChangeRatePattern = ChangeRatePattern(client, _m(acc, 'delta')) self.half: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'half')) self.in_loss: BtcCentsRelSatsUsdPattern = BtcCentsRelSatsUsdPattern(client, _m(acc, 'in_loss')) self.in_profit: BtcCentsRelSatsUsdPattern = BtcCentsRelSatsUsdPattern(client, _m(acc, 'in_profit')) - self.rel_to_circulating: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'rel_to_circulating')) + self.rel_to_circulating: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'rel_to_circulating')) self.total: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc) class DeltaHalfInRelTotalPattern2: @@ -2523,11 +2523,11 @@ class DeltaHalfInRelTotalPattern2: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.delta: ChangeRatePattern2 = ChangeRatePattern2(client, _m(acc, 'delta')) + self.delta: ChangeRatePattern = ChangeRatePattern(client, _m(acc, 'delta')) self.half: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'half')) self.in_loss: BtcCentsRelSatsUsdPattern3 = BtcCentsRelSatsUsdPattern3(client, _m(acc, 'in_loss')) self.in_profit: BtcCentsRelSatsUsdPattern3 = BtcCentsRelSatsUsdPattern3(client, _m(acc, 'in_profit')) - self.rel_to_circulating: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'rel_to_circulating')) + self.rel_to_circulating: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'rel_to_circulating')) self.total: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc) class Pct1Pct2Pct5Pct95Pct98Pct99Pattern: @@ -2593,7 +2593,7 @@ class BtcCentsRelSatsUsdPattern: """Create pattern node with accumulated metric name.""" self.btc: MetricPattern1[Bitcoin] = MetricPattern1(client, acc) self.cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'cents')) - self.rel_to_circulating: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'rel_to_circulating')) + self.rel_to_circulating: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'rel_to_circulating')) self.sats: MetricPattern1[Sats] = MetricPattern1(client, _m(acc, 'sats')) self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'usd')) @@ -2604,7 +2604,7 @@ class BtcCentsRelSatsUsdPattern2: """Create pattern node with accumulated metric name.""" self.btc: MetricPattern1[Bitcoin] = MetricPattern1(client, acc) self.cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'cents')) - self.rel_to_own: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'rel_to_own')) + self.rel_to_own: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'rel_to_own')) self.sats: MetricPattern1[Sats] = MetricPattern1(client, _m(acc, 'sats')) self.usd: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'usd')) @@ -2624,7 +2624,7 @@ class DeltaHalfInTotalPattern2: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.delta: ChangeRatePattern2 = ChangeRatePattern2(client, _m(acc, 'delta')) + self.delta: ChangeRatePattern = ChangeRatePattern(client, _m(acc, 'delta')) self.half: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'half')) self.in_loss: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'in_loss')) self.in_profit: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'in_profit')) @@ -2650,7 +2650,7 @@ class InvestedMaxMinPercentilesSupplyPattern: self.max: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'cost_basis_max')) self.min: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, 'cost_basis_min')) self.percentiles: Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern = Pct05Pct10Pct15Pct20Pct25Pct30Pct35Pct40Pct45Pct50Pct55Pct60Pct65Pct70Pct75Pct80Pct85Pct90Pct95Pattern(client, _m(acc, 'cost_basis')) - self.supply_density: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'supply_density')) + self.supply_density: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'supply_density')) class PhsReboundThsPattern: """Pattern struct for repeated tree structure.""" @@ -2659,7 +2659,7 @@ class PhsReboundThsPattern: """Create pattern node with accumulated metric name.""" self.phs: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'phs')) self.phs_min: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'phs_min')) - self.rebound: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, 'rebound')) + self.rebound: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rebound')) self.ths: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'ths')) self.ths_min: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'ths_min')) @@ -2684,17 +2684,17 @@ class _1m1w1y24hPattern2: self._1y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '1y_rate')) self._24h: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, '24h_rate')) -class _1m1w1y24hPattern3: +class _1m1w1y24hPattern6: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self._1m: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, '1m_rate')) - self._1w: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, '1w_rate')) - self._1y: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, '1y_rate')) - self._24h: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, '24h_rate')) + self._1m: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, '1m')) + self._1w: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, '1w')) + self._1y: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, '1y')) + self._24h: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, '24h')) -class _1m1w1y24hPattern6: +class _1m1w1y24hPattern5: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2714,7 +2714,7 @@ class _1m1w1y2wPattern: self._1y: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, '1y')) self._2w: CentsSatsUsdPattern = CentsSatsUsdPattern(client, _m(acc, '2w')) -class _1m1w1y24hPattern4: +class _1m1w1y24hPattern3: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2724,7 +2724,7 @@ class _1m1w1y24hPattern4: self._1y: CentsUsdPattern = CentsUsdPattern(client, _m(acc, '1y_change')) self._24h: CentsUsdPattern = CentsUsdPattern(client, _m(acc, '24h_change')) -class _1m1w1y24hPattern5: +class _1m1w1y24hPattern4: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2761,8 +2761,8 @@ class BaseCumulativeDeltaSumPattern: """Create pattern node with accumulated metric name.""" self.base: CentsUsdPattern = CentsUsdPattern(client, acc) self.cumulative: CentsUsdPattern = CentsUsdPattern(client, _m(acc, 'cumulative')) - self.delta: ChangeRatePattern3 = ChangeRatePattern3(client, _m(acc, 'delta')) - self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, _m(acc, 'sum')) + self.delta: ChangeRatePattern2 = ChangeRatePattern2(client, _m(acc, 'delta')) + self.sum: _1m1w1y24hPattern3 = _1m1w1y24hPattern3(client, _m(acc, 'sum')) class BaseCumulativeNegativeSumPattern: """Pattern struct for repeated tree structure.""" @@ -2772,7 +2772,7 @@ class BaseCumulativeNegativeSumPattern: self.base: CentsUsdPattern2 = CentsUsdPattern2(client, _m(acc, 'unrealized_loss')) self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, _m(acc, 'unrealized_loss_cumulative')) self.negative: MetricPattern1[Dollars] = MetricPattern1(client, _m(acc, 'neg_unrealized_loss')) - self.sum: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, _m(acc, 'unrealized_loss_sum')) + self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, _m(acc, 'unrealized_loss_sum')) class BothReactivatedReceivingSendingPattern: """Pattern struct for repeated tree structure.""" @@ -2800,8 +2800,8 @@ class CentsDeltaRelUsdPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" self.cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'cents')) - self.delta: ChangeRatePattern3 = ChangeRatePattern3(client, _m(acc, 'delta')) - self.rel_to_own_mcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_own_mcap')) + self.delta: ChangeRatePattern2 = ChangeRatePattern2(client, _m(acc, 'delta')) + self.rel_to_own_mcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'rel_to_own_mcap')) self.usd: MetricPattern1[Dollars] = MetricPattern1(client, acc) class CentsRelUsdPattern2: @@ -2810,8 +2810,8 @@ class CentsRelUsdPattern2: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" self.cents: MetricPattern1[CentsSigned] = MetricPattern1(client, _m(acc, 'cents')) - self.rel_to_own_gross: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, 'rel_to_own_gross_pnl')) - self.rel_to_own_mcap: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, 'rel_to_own_mcap')) + self.rel_to_own_gross: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_own_gross_pnl')) + self.rel_to_own_mcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_own_mcap')) self.usd: MetricPattern1[Dollars] = MetricPattern1(client, acc) class LossNetNuplProfitPattern: @@ -2861,7 +2861,7 @@ class BaseCumulativeSumPattern4: """Create pattern node with accumulated metric name.""" self.base: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc) self.cumulative: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'cumulative')) - self.sum: _1m1w1y24hPattern6 = _1m1w1y24hPattern6(client, _m(acc, 'sum')) + self.sum: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, _m(acc, 'sum')) class BaseCumulativeRelPattern: """Pattern struct for repeated tree structure.""" @@ -2870,7 +2870,7 @@ class BaseCumulativeRelPattern: """Create pattern node with accumulated metric name.""" self.base: MetricPattern1[Cents] = MetricPattern1(client, acc) self.cumulative: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'cumulative')) - self.rel_to_rcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rel_to_rcap')) + self.rel_to_rcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'rel_to_rcap')) class BaseCumulativeSumPattern3: """Pattern struct for repeated tree structure.""" @@ -2879,7 +2879,7 @@ class BaseCumulativeSumPattern3: """Create pattern node with accumulated metric name.""" self.base: CentsUsdPattern2 = CentsUsdPattern2(client, acc) self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, _m(acc, 'cumulative')) - self.sum: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, _m(acc, 'sum')) + self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, _m(acc, 'sum')) class BaseCumulativeSumPattern2: """Pattern struct for repeated tree structure.""" @@ -2899,7 +2899,7 @@ class BlocksDominanceRewardsPattern: self.dominance: _1m1w1y24hBpsPercentRatioPattern = _1m1w1y24hBpsPercentRatioPattern(client, _m(acc, 'dominance')) self.rewards: BaseCumulativeSumPattern4 = BaseCumulativeSumPattern4(client, _m(acc, 'rewards')) -class BpsPercentRatioPattern4: +class BpsPercentRatioPattern3: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2908,7 +2908,7 @@ class BpsPercentRatioPattern4: self.percent: MetricPattern1[StoredF32] = MetricPattern1(client, acc) self.ratio: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'ratio')) -class BpsPercentRatioPattern: +class BpsPercentRatioPattern4: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2935,7 +2935,7 @@ class BpsPercentRatioPattern5: self.percent: MetricPattern1[StoredF32] = MetricPattern1(client, acc) self.ratio: MetricPattern1[StoredF32] = MetricPattern1(client, _m(acc, 'ratio')) -class BpsPercentRatioPattern2: +class BpsPercentRatioPattern: """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): @@ -2959,7 +2959,7 @@ class CentsDeltaUsdPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" self.cents: MetricPattern1[Cents] = MetricPattern1(client, _m(acc, 'cents')) - self.delta: ChangeRatePattern3 = ChangeRatePattern3(client, _m(acc, 'delta')) + self.delta: ChangeRatePattern2 = ChangeRatePattern2(client, _m(acc, 'delta')) self.usd: MetricPattern1[Dollars] = MetricPattern1(client, acc) class CentsSatsUsdPattern: @@ -2976,7 +2976,7 @@ class DeltaHalfTotalPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.delta: ChangeRatePattern2 = ChangeRatePattern2(client, _m(acc, 'delta')) + self.delta: ChangeRatePattern = ChangeRatePattern(client, _m(acc, 'delta')) self.half: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, _m(acc, 'half')) self.total: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, acc) @@ -3025,14 +3025,14 @@ class RatioValuePattern: self.value_created: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, _m(acc, 'value_created')) self.value_destroyed: BaseCumulativeSumPattern[Cents] = BaseCumulativeSumPattern(client, _m(acc, 'value_destroyed')) -class _6bBlockTxindexPattern(Generic[T]): +class _6bBlockTxPattern(Generic[T]): """Pattern struct for repeated tree structure.""" def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" self._6b: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2[T] = AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2(client, _m(acc, '6b')) self.block: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2[T] = AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern2(client, acc) - self.txindex: MetricPattern19[T] = MetricPattern19(client, acc) + self.tx_index: MetricPattern19[T] = MetricPattern19(client, acc) class BaseCumulativeSumPattern(Generic[T]): """Pattern struct for repeated tree structure.""" @@ -3049,7 +3049,7 @@ class BlocksDominancePattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" self.blocks_mined: BaseCumulativeSumPattern2 = BaseCumulativeSumPattern2(client, _m(acc, 'blocks_mined')) - self.dominance: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, _m(acc, 'dominance')) + self.dominance: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, _m(acc, 'dominance')) class BpsRatioPattern2: """Pattern struct for repeated tree structure.""" @@ -3096,16 +3096,8 @@ class ChangeRatePattern2: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.change: _1m1w1y24hPattern[StoredI64] = _1m1w1y24hPattern(client, acc) - self.rate: _1m1w1y24hPattern3 = _1m1w1y24hPattern3(client, acc) - -class ChangeRatePattern3: - """Pattern struct for repeated tree structure.""" - - def __init__(self, client: BrkClientBase, acc: str): - """Create pattern node with accumulated metric name.""" - self.change: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, acc) - self.rate: _1m1w1y24hPattern3 = _1m1w1y24hPattern3(client, acc) + self.change: _1m1w1y24hPattern3 = _1m1w1y24hPattern3(client, acc) + self.rate: _1m1w1y24hPattern2 = _1m1w1y24hPattern2(client, acc) class CoindaysSentPattern: """Pattern struct for repeated tree structure.""" @@ -3120,7 +3112,7 @@ class DeltaInnerPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.delta: ChangeRatePattern2 = ChangeRatePattern2(client, _m(acc, 'delta')) + self.delta: ChangeRatePattern = ChangeRatePattern(client, _m(acc, 'delta')) self.inner: MetricPattern1[StoredU64] = MetricPattern1(client, acc) class InPattern: @@ -3152,8 +3144,8 @@ class RelPattern: def __init__(self, client: BrkClientBase, acc: str): """Create pattern node with accumulated metric name.""" - self.rel_to_mcap: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, 'mcap')) - self.rel_to_rcap: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, _m(acc, 'rcap')) + self.rel_to_mcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'mcap')) + self.rel_to_rcap: BpsPercentRatioPattern = BpsPercentRatioPattern(client, _m(acc, 'rcap')) class SdSmaPattern: """Pattern struct for repeated tree structure.""" @@ -3201,7 +3193,7 @@ class MetricsTree_Blocks_Difficulty: self.raw: MetricPattern18[StoredF64] = MetricPattern18(client, 'difficulty') self.base: MetricPattern2[StoredF64] = MetricPattern2(client, 'difficulty') self.as_hash: MetricPattern1[StoredF64] = MetricPattern1(client, 'difficulty_as_hash') - self.adjustment: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'difficulty_adjustment') + self.adjustment: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'difficulty_adjustment') self.epoch: MetricPattern1[Epoch] = MetricPattern1(client, 'difficulty_epoch') self.blocks_before_next: MetricPattern1[StoredU32] = MetricPattern1(client, 'blocks_before_next_difficulty_adjustment') self.days_before_next: MetricPattern1[StoredF32] = MetricPattern1(client, 'days_before_next_difficulty_adjustment') @@ -3337,16 +3329,16 @@ class MetricsTree_Transactions_Raw: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.first_txindex: MetricPattern18[TxIndex] = MetricPattern18(client, 'first_txindex') + self.first_tx_index: MetricPattern18[TxIndex] = MetricPattern18(client, 'first_tx_index') self.height: MetricPattern19[Height] = MetricPattern19(client, 'height') self.txid: MetricPattern19[Txid] = MetricPattern19(client, 'txid') - self.txversion: MetricPattern19[TxVersion] = MetricPattern19(client, 'txversion') - self.rawlocktime: MetricPattern19[RawLockTime] = MetricPattern19(client, 'rawlocktime') + self.tx_version: MetricPattern19[TxVersion] = MetricPattern19(client, 'tx_version') + self.raw_locktime: MetricPattern19[RawLockTime] = MetricPattern19(client, 'raw_locktime') self.base_size: MetricPattern19[StoredU32] = MetricPattern19(client, 'base_size') self.total_size: MetricPattern19[StoredU32] = MetricPattern19(client, 'total_size') self.is_explicitly_rbf: MetricPattern19[StoredBool] = MetricPattern19(client, 'is_explicitly_rbf') - self.first_txinindex: MetricPattern19[TxInIndex] = MetricPattern19(client, 'first_txinindex') - self.first_txoutindex: MetricPattern19[TxOutIndex] = MetricPattern19(client, 'first_txoutindex') + self.first_txin_index: MetricPattern19[TxInIndex] = MetricPattern19(client, 'first_txin_index') + self.first_txout_index: MetricPattern19[TxOutIndex] = MetricPattern19(client, 'first_txout_index') class MetricsTree_Transactions_Count: """Metrics tree node.""" @@ -3359,8 +3351,8 @@ class MetricsTree_Transactions_Size: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.vsize: _6bBlockTxindexPattern[VSize] = _6bBlockTxindexPattern(client, 'tx_vsize') - self.weight: _6bBlockTxindexPattern[Weight] = _6bBlockTxindexPattern(client, 'tx_weight') + self.vsize: _6bBlockTxPattern[VSize] = _6bBlockTxPattern(client, 'tx_vsize') + self.weight: _6bBlockTxPattern[Weight] = _6bBlockTxPattern(client, 'tx_weight') class MetricsTree_Transactions_Fees: """Metrics tree node.""" @@ -3368,8 +3360,8 @@ class MetricsTree_Transactions_Fees: def __init__(self, client: BrkClientBase, base_path: str = ''): self.input_value: MetricPattern19[Sats] = MetricPattern19(client, 'input_value') self.output_value: MetricPattern19[Sats] = MetricPattern19(client, 'output_value') - self.fee: _6bBlockTxindexPattern[Sats] = _6bBlockTxindexPattern(client, 'fee') - self.fee_rate: _6bBlockTxindexPattern[FeeRate] = _6bBlockTxindexPattern(client, 'fee_rate') + self.fee: _6bBlockTxPattern[Sats] = _6bBlockTxPattern(client, 'fee') + self.fee_rate: _6bBlockTxPattern[FeeRate] = _6bBlockTxPattern(client, 'fee_rate') class MetricsTree_Transactions_Versions: """Metrics tree node.""" @@ -3404,17 +3396,17 @@ class MetricsTree_Inputs_Raw: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.first_txinindex: MetricPattern18[TxInIndex] = MetricPattern18(client, 'first_txinindex') + self.first_txin_index: MetricPattern18[TxInIndex] = MetricPattern18(client, 'first_txin_index') self.outpoint: MetricPattern20[OutPoint] = MetricPattern20(client, 'outpoint') - self.txindex: MetricPattern20[TxIndex] = MetricPattern20(client, 'txindex') - self.outputtype: MetricPattern20[OutputType] = MetricPattern20(client, 'outputtype') - self.typeindex: MetricPattern20[TypeIndex] = MetricPattern20(client, 'typeindex') + self.tx_index: MetricPattern20[TxIndex] = MetricPattern20(client, 'tx_index') + self.output_type: MetricPattern20[OutputType] = MetricPattern20(client, 'output_type') + self.type_index: MetricPattern20[TypeIndex] = MetricPattern20(client, 'type_index') class MetricsTree_Inputs_Spent: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.txoutindex: MetricPattern20[TxOutIndex] = MetricPattern20(client, 'txoutindex') + self.txout_index: MetricPattern20[TxOutIndex] = MetricPattern20(client, 'txout_index') self.value: MetricPattern20[Sats] = MetricPattern20(client, 'value') class MetricsTree_Inputs: @@ -3429,17 +3421,17 @@ class MetricsTree_Outputs_Raw: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.first_txoutindex: MetricPattern18[TxOutIndex] = MetricPattern18(client, 'first_txoutindex') + self.first_txout_index: MetricPattern18[TxOutIndex] = MetricPattern18(client, 'first_txout_index') self.value: MetricPattern21[Sats] = MetricPattern21(client, 'value') - self.outputtype: MetricPattern21[OutputType] = MetricPattern21(client, 'outputtype') - self.typeindex: MetricPattern21[TypeIndex] = MetricPattern21(client, 'typeindex') - self.txindex: MetricPattern21[TxIndex] = MetricPattern21(client, 'txindex') + self.output_type: MetricPattern21[OutputType] = MetricPattern21(client, 'output_type') + self.type_index: MetricPattern21[TypeIndex] = MetricPattern21(client, 'type_index') + self.tx_index: MetricPattern21[TxIndex] = MetricPattern21(client, 'tx_index') class MetricsTree_Outputs_Spent: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.txinindex: MetricPattern21[TxInIndex] = MetricPattern21(client, 'txinindex') + self.txin_index: MetricPattern21[TxInIndex] = MetricPattern21(client, 'txin_index') class MetricsTree_Outputs_Count: """Metrics tree node.""" @@ -3460,57 +3452,57 @@ class MetricsTree_Addresses_Raw_P2pk65: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.first_index: MetricPattern18[P2PK65AddressIndex] = MetricPattern18(client, 'first_p2pk65addressindex') - self.bytes: MetricPattern27[P2PK65Bytes] = MetricPattern27(client, 'p2pk65bytes') + self.first_index: MetricPattern18[P2PK65AddressIndex] = MetricPattern18(client, 'first_p2pk65_address_index') + self.bytes: MetricPattern27[P2PK65Bytes] = MetricPattern27(client, 'p2pk65_bytes') class MetricsTree_Addresses_Raw_P2pk33: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.first_index: MetricPattern18[P2PK33AddressIndex] = MetricPattern18(client, 'first_p2pk33addressindex') - self.bytes: MetricPattern26[P2PK33Bytes] = MetricPattern26(client, 'p2pk33bytes') + self.first_index: MetricPattern18[P2PK33AddressIndex] = MetricPattern18(client, 'first_p2pk33_address_index') + self.bytes: MetricPattern26[P2PK33Bytes] = MetricPattern26(client, 'p2pk33_bytes') class MetricsTree_Addresses_Raw_P2pkh: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.first_index: MetricPattern18[P2PKHAddressIndex] = MetricPattern18(client, 'first_p2pkhaddressindex') - self.bytes: MetricPattern28[P2PKHBytes] = MetricPattern28(client, 'p2pkhbytes') + self.first_index: MetricPattern18[P2PKHAddressIndex] = MetricPattern18(client, 'first_p2pkh_address_index') + self.bytes: MetricPattern28[P2PKHBytes] = MetricPattern28(client, 'p2pkh_bytes') class MetricsTree_Addresses_Raw_P2sh: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.first_index: MetricPattern18[P2SHAddressIndex] = MetricPattern18(client, 'first_p2shaddressindex') - self.bytes: MetricPattern29[P2SHBytes] = MetricPattern29(client, 'p2shbytes') + self.first_index: MetricPattern18[P2SHAddressIndex] = MetricPattern18(client, 'first_p2sh_address_index') + self.bytes: MetricPattern29[P2SHBytes] = MetricPattern29(client, 'p2sh_bytes') class MetricsTree_Addresses_Raw_P2wpkh: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.first_index: MetricPattern18[P2WPKHAddressIndex] = MetricPattern18(client, 'first_p2wpkhaddressindex') - self.bytes: MetricPattern31[P2WPKHBytes] = MetricPattern31(client, 'p2wpkhbytes') + self.first_index: MetricPattern18[P2WPKHAddressIndex] = MetricPattern18(client, 'first_p2wpkh_address_index') + self.bytes: MetricPattern31[P2WPKHBytes] = MetricPattern31(client, 'p2wpkh_bytes') class MetricsTree_Addresses_Raw_P2wsh: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.first_index: MetricPattern18[P2WSHAddressIndex] = MetricPattern18(client, 'first_p2wshaddressindex') - self.bytes: MetricPattern32[P2WSHBytes] = MetricPattern32(client, 'p2wshbytes') + self.first_index: MetricPattern18[P2WSHAddressIndex] = MetricPattern18(client, 'first_p2wsh_address_index') + self.bytes: MetricPattern32[P2WSHBytes] = MetricPattern32(client, 'p2wsh_bytes') class MetricsTree_Addresses_Raw_P2tr: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.first_index: MetricPattern18[P2TRAddressIndex] = MetricPattern18(client, 'first_p2traddressindex') - self.bytes: MetricPattern30[P2TRBytes] = MetricPattern30(client, 'p2trbytes') + self.first_index: MetricPattern18[P2TRAddressIndex] = MetricPattern18(client, 'first_p2tr_address_index') + self.bytes: MetricPattern30[P2TRBytes] = MetricPattern30(client, 'p2tr_bytes') class MetricsTree_Addresses_Raw_P2a: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.first_index: MetricPattern18[P2AAddressIndex] = MetricPattern18(client, 'first_p2aaddressindex') - self.bytes: MetricPattern24[P2ABytes] = MetricPattern24(client, 'p2abytes') + self.first_index: MetricPattern18[P2AAddressIndex] = MetricPattern18(client, 'first_p2a_address_index') + self.bytes: MetricPattern24[P2ABytes] = MetricPattern24(client, 'p2a_bytes') class MetricsTree_Addresses_Raw: """Metrics tree node.""" @@ -3529,14 +3521,14 @@ class MetricsTree_Addresses_Indexes: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.p2a: MetricPattern24[AnyAddressIndex] = MetricPattern24(client, 'anyaddressindex') - self.p2pk33: MetricPattern26[AnyAddressIndex] = MetricPattern26(client, 'anyaddressindex') - self.p2pk65: MetricPattern27[AnyAddressIndex] = MetricPattern27(client, 'anyaddressindex') - self.p2pkh: MetricPattern28[AnyAddressIndex] = MetricPattern28(client, 'anyaddressindex') - self.p2sh: MetricPattern29[AnyAddressIndex] = MetricPattern29(client, 'anyaddressindex') - self.p2tr: MetricPattern30[AnyAddressIndex] = MetricPattern30(client, 'anyaddressindex') - self.p2wpkh: MetricPattern31[AnyAddressIndex] = MetricPattern31(client, 'anyaddressindex') - self.p2wsh: MetricPattern32[AnyAddressIndex] = MetricPattern32(client, 'anyaddressindex') + self.p2a: MetricPattern24[AnyAddressIndex] = MetricPattern24(client, 'any_address_index') + self.p2pk33: MetricPattern26[AnyAddressIndex] = MetricPattern26(client, 'any_address_index') + self.p2pk65: MetricPattern27[AnyAddressIndex] = MetricPattern27(client, 'any_address_index') + self.p2pkh: MetricPattern28[AnyAddressIndex] = MetricPattern28(client, 'any_address_index') + self.p2sh: MetricPattern29[AnyAddressIndex] = MetricPattern29(client, 'any_address_index') + self.p2tr: MetricPattern30[AnyAddressIndex] = MetricPattern30(client, 'any_address_index') + self.p2wpkh: MetricPattern31[AnyAddressIndex] = MetricPattern31(client, 'any_address_index') + self.p2wsh: MetricPattern32[AnyAddressIndex] = MetricPattern32(client, 'any_address_index') self.funded: MetricPattern34[FundedAddressIndex] = MetricPattern34(client, 'funded_address_index') self.empty: MetricPattern35[EmptyAddressIndex] = MetricPattern35(client, 'empty_address_index') @@ -3544,8 +3536,8 @@ class MetricsTree_Addresses_Data: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.funded: MetricPattern34[FundedAddressData] = MetricPattern34(client, 'fundedaddressdata') - self.empty: MetricPattern35[EmptyAddressData] = MetricPattern35(client, 'emptyaddressdata') + self.funded: MetricPattern34[FundedAddressData] = MetricPattern34(client, 'funded_address_data') + self.empty: MetricPattern35[EmptyAddressData] = MetricPattern35(client, 'empty_address_data') class MetricsTree_Addresses_Activity: """Metrics tree node.""" @@ -3607,29 +3599,29 @@ class MetricsTree_Scripts_Raw_Empty: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.first_index: MetricPattern18[EmptyOutputIndex] = MetricPattern18(client, 'first_emptyoutputindex') - self.to_txindex: MetricPattern22[TxIndex] = MetricPattern22(client, 'txindex') + self.first_index: MetricPattern18[EmptyOutputIndex] = MetricPattern18(client, 'first_empty_output_index') + self.to_tx_index: MetricPattern22[TxIndex] = MetricPattern22(client, 'tx_index') class MetricsTree_Scripts_Raw_Opreturn: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.first_index: MetricPattern18[OpReturnIndex] = MetricPattern18(client, 'first_opreturnindex') - self.to_txindex: MetricPattern23[TxIndex] = MetricPattern23(client, 'txindex') + self.first_index: MetricPattern18[OpReturnIndex] = MetricPattern18(client, 'first_op_return_index') + self.to_tx_index: MetricPattern23[TxIndex] = MetricPattern23(client, 'tx_index') class MetricsTree_Scripts_Raw_P2ms: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.first_index: MetricPattern18[P2MSOutputIndex] = MetricPattern18(client, 'first_p2msoutputindex') - self.to_txindex: MetricPattern25[TxIndex] = MetricPattern25(client, 'txindex') + self.first_index: MetricPattern18[P2MSOutputIndex] = MetricPattern18(client, 'first_p2ms_output_index') + self.to_tx_index: MetricPattern25[TxIndex] = MetricPattern25(client, 'tx_index') class MetricsTree_Scripts_Raw_Unknown: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.first_index: MetricPattern18[UnknownOutputIndex] = MetricPattern18(client, 'first_unknownoutputindex') - self.to_txindex: MetricPattern33[TxIndex] = MetricPattern33(client, 'txindex') + self.first_index: MetricPattern18[UnknownOutputIndex] = MetricPattern18(client, 'first_unknown_output_index') + self.to_tx_index: MetricPattern33[TxIndex] = MetricPattern33(client, 'tx_index') class MetricsTree_Scripts_Raw: """Metrics tree node.""" @@ -3654,8 +3646,8 @@ class MetricsTree_Scripts_Count: self.p2wpkh: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'p2wpkh_count') self.p2wsh: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'p2wsh_count') self.opreturn: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'opreturn_count') - self.emptyoutput: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'emptyoutput_count') - self.unknownoutput: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'unknownoutput_count') + self.empty_output: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'empty_output_count') + self.unknown_output: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'unknown_output_count') self.segwit: BaseCumulativeSumPattern[StoredU64] = BaseCumulativeSumPattern(client, 'segwit_count') class MetricsTree_Scripts_Value_Opreturn: @@ -3675,8 +3667,8 @@ class MetricsTree_Scripts_Adoption: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.taproot: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'taproot_adoption') - self.segwit: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'segwit_adoption') + self.taproot: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'taproot_adoption') + self.segwit: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'segwit_adoption') class MetricsTree_Scripts: """Metrics tree node.""" @@ -3711,7 +3703,7 @@ class MetricsTree_Mining_Rewards_Fees: def __init__(self, client: BrkClientBase, base_path: str = ''): self.base: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'fees') self.cumulative: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'fees_cumulative') - self.sum: _1m1w1y24hPattern6 = _1m1w1y24hPattern6(client, 'fees_sum') + self.sum: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, 'fees_sum') self._24h: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern = AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, 'fees_24h') self._1w: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern = AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, 'fees_1w') self._1m: AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern = AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern(client, 'fees_1m') @@ -3816,7 +3808,7 @@ class MetricsTree_Cointime_Adjusted: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.inflation_rate: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'cointime_adj_inflation_rate') + self.inflation_rate: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'cointime_adj_inflation_rate') self.tx_velocity_btc: MetricPattern1[StoredF64] = MetricPattern1(client, 'cointime_adj_tx_velocity_btc') self.tx_velocity_usd: MetricPattern1[StoredF64] = MetricPattern1(client, 'cointime_adj_tx_velocity_usd') @@ -3828,13 +3820,6 @@ class MetricsTree_Cointime_ReserveRisk: self.vocdd_median_1y: MetricPattern18[StoredF64] = MetricPattern18(client, 'vocdd_median_1y') self.hodl_bank: MetricPattern18[StoredF64] = MetricPattern18(client, 'hodl_bank') -class MetricsTree_Cointime_CoinblocksDestroyed: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self.base: MetricPattern1[StoredF64] = MetricPattern1(client, 'coinblocks_destroyed') - self.cumulative: MetricPattern1[StoredF64] = MetricPattern1(client, 'coinblocks_destroyed_cumulative') - class MetricsTree_Cointime: """Metrics tree node.""" @@ -3846,7 +3831,7 @@ class MetricsTree_Cointime: self.prices: MetricsTree_Cointime_Prices = MetricsTree_Cointime_Prices(client) self.adjusted: MetricsTree_Cointime_Adjusted = MetricsTree_Cointime_Adjusted(client) self.reserve_risk: MetricsTree_Cointime_ReserveRisk = MetricsTree_Cointime_ReserveRisk(client) - self.coinblocks_destroyed: MetricsTree_Cointime_CoinblocksDestroyed = MetricsTree_Cointime_CoinblocksDestroyed(client) + self.coinblocks_destroyed: BaseCumulativeSumPattern[StoredF64] = BaseCumulativeSumPattern(client, 'coinblocks_destroyed') class MetricsTree_Constants: """Metrics tree node.""" @@ -3875,73 +3860,73 @@ class MetricsTree_Indexes_Address_P2pk33: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.identity: MetricPattern26[P2PK33AddressIndex] = MetricPattern26(client, 'p2pk33addressindex') + self.identity: MetricPattern26[P2PK33AddressIndex] = MetricPattern26(client, 'p2pk33_address_index') class MetricsTree_Indexes_Address_P2pk65: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.identity: MetricPattern27[P2PK65AddressIndex] = MetricPattern27(client, 'p2pk65addressindex') + self.identity: MetricPattern27[P2PK65AddressIndex] = MetricPattern27(client, 'p2pk65_address_index') class MetricsTree_Indexes_Address_P2pkh: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.identity: MetricPattern28[P2PKHAddressIndex] = MetricPattern28(client, 'p2pkhaddressindex') + self.identity: MetricPattern28[P2PKHAddressIndex] = MetricPattern28(client, 'p2pkh_address_index') class MetricsTree_Indexes_Address_P2sh: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.identity: MetricPattern29[P2SHAddressIndex] = MetricPattern29(client, 'p2shaddressindex') + self.identity: MetricPattern29[P2SHAddressIndex] = MetricPattern29(client, 'p2sh_address_index') class MetricsTree_Indexes_Address_P2tr: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.identity: MetricPattern30[P2TRAddressIndex] = MetricPattern30(client, 'p2traddressindex') + self.identity: MetricPattern30[P2TRAddressIndex] = MetricPattern30(client, 'p2tr_address_index') class MetricsTree_Indexes_Address_P2wpkh: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.identity: MetricPattern31[P2WPKHAddressIndex] = MetricPattern31(client, 'p2wpkhaddressindex') + self.identity: MetricPattern31[P2WPKHAddressIndex] = MetricPattern31(client, 'p2wpkh_address_index') class MetricsTree_Indexes_Address_P2wsh: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.identity: MetricPattern32[P2WSHAddressIndex] = MetricPattern32(client, 'p2wshaddressindex') + self.identity: MetricPattern32[P2WSHAddressIndex] = MetricPattern32(client, 'p2wsh_address_index') class MetricsTree_Indexes_Address_P2a: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.identity: MetricPattern24[P2AAddressIndex] = MetricPattern24(client, 'p2aaddressindex') + self.identity: MetricPattern24[P2AAddressIndex] = MetricPattern24(client, 'p2a_address_index') class MetricsTree_Indexes_Address_P2ms: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.identity: MetricPattern25[P2MSOutputIndex] = MetricPattern25(client, 'p2msoutputindex') + self.identity: MetricPattern25[P2MSOutputIndex] = MetricPattern25(client, 'p2ms_output_index') class MetricsTree_Indexes_Address_Empty: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.identity: MetricPattern22[EmptyOutputIndex] = MetricPattern22(client, 'emptyoutputindex') + self.identity: MetricPattern22[EmptyOutputIndex] = MetricPattern22(client, 'empty_output_index') class MetricsTree_Indexes_Address_Unknown: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.identity: MetricPattern33[UnknownOutputIndex] = MetricPattern33(client, 'unknownoutputindex') + self.identity: MetricPattern33[UnknownOutputIndex] = MetricPattern33(client, 'unknown_output_index') class MetricsTree_Indexes_Address_Opreturn: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.identity: MetricPattern23[OpReturnIndex] = MetricPattern23(client, 'opreturnindex') + self.identity: MetricPattern23[OpReturnIndex] = MetricPattern23(client, 'op_return_index') class MetricsTree_Indexes_Address: """Metrics tree node.""" @@ -3980,7 +3965,7 @@ class MetricsTree_Indexes_Height: self.month6: MetricPattern18[Month6] = MetricPattern18(client, 'month6') self.year1: MetricPattern18[Year1] = MetricPattern18(client, 'year1') self.year10: MetricPattern18[Year10] = MetricPattern18(client, 'year10') - self.txindex_count: MetricPattern18[StoredU64] = MetricPattern18(client, 'txindex_count') + self.tx_index_count: MetricPattern18[StoredU64] = MetricPattern18(client, 'tx_index_count') class MetricsTree_Indexes_Epoch: """Metrics tree node.""" @@ -4096,25 +4081,25 @@ class MetricsTree_Indexes_Year10: self.date: MetricPattern15[Date] = MetricPattern15(client, 'date') self.first_height: MetricPattern15[Height] = MetricPattern15(client, 'year10_first_height') -class MetricsTree_Indexes_Txindex: +class MetricsTree_Indexes_TxIndex: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.identity: MetricPattern19[TxIndex] = MetricPattern19(client, 'txindex') + self.identity: MetricPattern19[TxIndex] = MetricPattern19(client, 'tx_index') self.input_count: MetricPattern19[StoredU64] = MetricPattern19(client, 'input_count') self.output_count: MetricPattern19[StoredU64] = MetricPattern19(client, 'output_count') -class MetricsTree_Indexes_Txinindex: +class MetricsTree_Indexes_TxinIndex: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.identity: MetricPattern20[TxInIndex] = MetricPattern20(client, 'txinindex') + self.identity: MetricPattern20[TxInIndex] = MetricPattern20(client, 'txin_index') -class MetricsTree_Indexes_Txoutindex: +class MetricsTree_Indexes_TxoutIndex: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.identity: MetricPattern21[TxOutIndex] = MetricPattern21(client, 'txoutindex') + self.identity: MetricPattern21[TxOutIndex] = MetricPattern21(client, 'txout_index') class MetricsTree_Indexes: """Metrics tree node.""" @@ -4137,9 +4122,9 @@ class MetricsTree_Indexes: self.month6: MetricsTree_Indexes_Month6 = MetricsTree_Indexes_Month6(client) self.year1: MetricsTree_Indexes_Year1 = MetricsTree_Indexes_Year1(client) self.year10: MetricsTree_Indexes_Year10 = MetricsTree_Indexes_Year10(client) - self.txindex: MetricsTree_Indexes_Txindex = MetricsTree_Indexes_Txindex(client) - self.txinindex: MetricsTree_Indexes_Txinindex = MetricsTree_Indexes_Txinindex(client) - self.txoutindex: MetricsTree_Indexes_Txoutindex = MetricsTree_Indexes_Txoutindex(client) + self.tx_index: MetricsTree_Indexes_TxIndex = MetricsTree_Indexes_TxIndex(client) + self.txin_index: MetricsTree_Indexes_TxinIndex = MetricsTree_Indexes_TxinIndex(client) + self.txout_index: MetricsTree_Indexes_TxoutIndex = MetricsTree_Indexes_TxoutIndex(client) class MetricsTree_Indicators_Dormancy: """Metrics tree node.""" @@ -4154,7 +4139,7 @@ class MetricsTree_Indicators: def __init__(self, client: BrkClientBase, base_path: str = ''): self.puell_multiple: BpsRatioPattern2 = BpsRatioPattern2(client, 'puell_multiple') self.nvt: BpsRatioPattern2 = BpsRatioPattern2(client, 'nvt') - self.gini: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'gini') + self.gini: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'gini') self.rhodl_ratio: BpsRatioPattern2 = BpsRatioPattern2(client, 'rhodl_ratio') self.thermocap_multiple: BpsRatioPattern2 = BpsRatioPattern2(client, 'thermocap_multiple') self.coindays_destroyed_supply_adjusted: MetricPattern1[StoredF32] = MetricPattern1(client, 'coindays_destroyed_supply_adjusted') @@ -4196,19 +4181,19 @@ class MetricsTree_Market_Returns_Periods: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self._24h: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'price_return_24h') - self._1w: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'price_return_1w') - self._1m: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'price_return_1m') - self._3m: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'price_return_3m') - self._6m: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'price_return_6m') - self._1y: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'price_return_1y') - self._2y: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'price_return_2y') - self._3y: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'price_return_3y') - self._4y: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'price_return_4y') - self._5y: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'price_return_5y') - self._6y: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'price_return_6y') - self._8y: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'price_return_8y') - self._10y: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'price_return_10y') + self._24h: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'price_return_24h') + self._1w: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'price_return_1w') + self._1m: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'price_return_1m') + self._3m: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'price_return_3m') + self._6m: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'price_return_6m') + self._1y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'price_return_1y') + self._2y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'price_return_2y') + self._3y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'price_return_3y') + self._4y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'price_return_4y') + self._5y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'price_return_5y') + self._6y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'price_return_6y') + self._8y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'price_return_8y') + self._10y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'price_return_10y') class MetricsTree_Market_Returns_Sd24h_1w: """Metrics tree node.""" @@ -4256,7 +4241,7 @@ class MetricsTree_Market_Range: self.max: _1m1w1y2wPattern = _1m1w1y2wPattern(client, 'price_max') self.true_range: MetricPattern1[StoredF32] = MetricPattern1(client, 'price_true_range') self.true_range_sum_2w: MetricPattern1[StoredF32] = MetricPattern1(client, 'price_true_range_sum_2w') - self.choppiness_index_2w: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'price_choppiness_index_2w') + self.choppiness_index_2w: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'price_choppiness_index_2w') class MetricsTree_Market_MovingAverage_Sma_200d_X24: """Metrics tree node.""" @@ -4420,18 +4405,18 @@ class MetricsTree_Market_Dca_Class_Return: """Metrics tree node.""" def __init__(self, client: BrkClientBase, base_path: str = ''): - self.from_2015: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'dca_return_from_2015') - self.from_2016: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'dca_return_from_2016') - self.from_2017: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'dca_return_from_2017') - self.from_2018: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'dca_return_from_2018') - self.from_2019: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'dca_return_from_2019') - self.from_2020: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'dca_return_from_2020') - self.from_2021: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'dca_return_from_2021') - self.from_2022: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'dca_return_from_2022') - self.from_2023: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'dca_return_from_2023') - self.from_2024: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'dca_return_from_2024') - self.from_2025: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'dca_return_from_2025') - self.from_2026: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'dca_return_from_2026') + self.from_2015: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'dca_return_from_2015') + self.from_2016: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'dca_return_from_2016') + self.from_2017: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'dca_return_from_2017') + self.from_2018: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'dca_return_from_2018') + self.from_2019: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'dca_return_from_2019') + self.from_2020: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'dca_return_from_2020') + self.from_2021: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'dca_return_from_2021') + self.from_2022: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'dca_return_from_2022') + self.from_2023: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'dca_return_from_2023') + self.from_2024: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'dca_return_from_2024') + self.from_2025: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'dca_return_from_2025') + self.from_2026: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'dca_return_from_2026') class MetricsTree_Market_Dca_Class: """Metrics tree node.""" @@ -4457,12 +4442,12 @@ class MetricsTree_Market_Technical_Rsi_1w: self.losses: MetricPattern1[StoredF32] = MetricPattern1(client, 'rsi_losses_1w') self.average_gain: MetricPattern1[StoredF32] = MetricPattern1(client, 'rsi_average_gain_1w') self.average_loss: MetricPattern1[StoredF32] = MetricPattern1(client, 'rsi_average_loss_1w') - self.rsi: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'rsi_1w') - self.rsi_min: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'rsi_min_1w') - self.rsi_max: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'rsi_max_1w') - self.stoch_rsi: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'rsi_stoch_1w') - self.stoch_rsi_k: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'rsi_stoch_k_1w') - self.stoch_rsi_d: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'rsi_stoch_d_1w') + self.rsi: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'rsi_1w') + self.rsi_min: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'rsi_min_1w') + self.rsi_max: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'rsi_max_1w') + self.stoch_rsi: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'rsi_stoch_1w') + self.stoch_rsi_k: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'rsi_stoch_k_1w') + self.stoch_rsi_d: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'rsi_stoch_d_1w') class MetricsTree_Market_Technical_Rsi_1m: """Metrics tree node.""" @@ -4472,12 +4457,12 @@ class MetricsTree_Market_Technical_Rsi_1m: self.losses: MetricPattern1[StoredF32] = MetricPattern1(client, 'rsi_losses_1m') self.average_gain: MetricPattern1[StoredF32] = MetricPattern1(client, 'rsi_average_gain_1m') self.average_loss: MetricPattern1[StoredF32] = MetricPattern1(client, 'rsi_average_loss_1m') - self.rsi: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'rsi_1m') - self.rsi_min: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'rsi_min_1m') - self.rsi_max: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'rsi_max_1m') - self.stoch_rsi: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'rsi_stoch_1m') - self.stoch_rsi_k: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'rsi_stoch_k_1m') - self.stoch_rsi_d: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'rsi_stoch_d_1m') + self.rsi: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'rsi_1m') + self.rsi_min: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'rsi_min_1m') + self.rsi_max: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'rsi_max_1m') + self.stoch_rsi: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'rsi_stoch_1m') + self.stoch_rsi_k: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'rsi_stoch_k_1m') + self.stoch_rsi_d: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'rsi_stoch_d_1m') class MetricsTree_Market_Technical_Rsi_1y: """Metrics tree node.""" @@ -4487,12 +4472,12 @@ class MetricsTree_Market_Technical_Rsi_1y: self.losses: MetricPattern1[StoredF32] = MetricPattern1(client, 'rsi_losses_1y') self.average_gain: MetricPattern1[StoredF32] = MetricPattern1(client, 'rsi_average_gain_1y') self.average_loss: MetricPattern1[StoredF32] = MetricPattern1(client, 'rsi_average_loss_1y') - self.rsi: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'rsi_1y') - self.rsi_min: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'rsi_min_1y') - self.rsi_max: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'rsi_max_1y') - self.stoch_rsi: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'rsi_stoch_1y') - self.stoch_rsi_k: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'rsi_stoch_k_1y') - self.stoch_rsi_d: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'rsi_stoch_d_1y') + self.rsi: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'rsi_1y') + self.rsi_min: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'rsi_min_1y') + self.rsi_max: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'rsi_max_1y') + self.stoch_rsi: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'rsi_stoch_1y') + self.stoch_rsi_k: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'rsi_stoch_k_1y') + self.stoch_rsi_d: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'rsi_stoch_d_1y') class MetricsTree_Market_Technical_Rsi: """Metrics tree node.""" @@ -4547,8 +4532,8 @@ class MetricsTree_Market_Technical: def __init__(self, client: BrkClientBase, base_path: str = ''): self.rsi: MetricsTree_Market_Technical_Rsi = MetricsTree_Market_Technical_Rsi(client) - self.stoch_k: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'stoch_k') - self.stoch_d: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'stoch_d') + self.stoch_k: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'stoch_k') + self.stoch_d: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'stoch_d') self.pi_cycle: BpsRatioPattern2 = BpsRatioPattern2(client, 'pi_cycle') self.macd: MetricsTree_Market_Technical_Macd = MetricsTree_Market_Technical_Macd(client) @@ -4798,7 +4783,7 @@ class MetricsTree_Supply: def __init__(self, client: BrkClientBase, base_path: str = ''): self.circulating: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'circulating_supply') self.burned: MetricsTree_Supply_Burned = MetricsTree_Supply_Burned(client) - self.inflation_rate: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'inflation_rate') + self.inflation_rate: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'inflation_rate') self.velocity: MetricsTree_Supply_Velocity = MetricsTree_Supply_Velocity(client) self.market_cap: CentsDeltaUsdPattern = CentsDeltaUsdPattern(client, 'market_cap') self.market_minus_realized_cap_growth_rate: _1m1w1y24hPattern[BasisPointsSigned32] = _1m1w1y24hPattern(client, 'market_minus_realized_cap_growth_rate') @@ -4813,7 +4798,7 @@ class MetricsTree_Cohorts_Utxo_All_Supply: self.in_loss: BtcCentsRelSatsUsdPattern2 = BtcCentsRelSatsUsdPattern2(client, 'supply_in_loss') self.total: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'supply') self.half: BtcCentsSatsUsdPattern = BtcCentsSatsUsdPattern(client, 'supply_half') - self.delta: ChangeRatePattern2 = ChangeRatePattern2(client, 'supply_delta') + self.delta: ChangeRatePattern = ChangeRatePattern(client, 'supply_delta') class MetricsTree_Cohorts_Utxo_All_Unrealized_Loss: """Metrics tree node.""" @@ -4822,9 +4807,9 @@ class MetricsTree_Cohorts_Utxo_All_Unrealized_Loss: self.negative: MetricPattern1[Dollars] = MetricPattern1(client, 'neg_unrealized_loss') self.base: CentsUsdPattern2 = CentsUsdPattern2(client, 'unrealized_loss') self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, 'unrealized_loss_cumulative') - self.sum: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, 'unrealized_loss_sum') - self.rel_to_mcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'unrealized_loss_rel_to_mcap') - self.rel_to_own_gross: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'unrealized_loss_rel_to_own_gross_pnl') + self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, 'unrealized_loss_sum') + self.rel_to_mcap: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'unrealized_loss_rel_to_mcap') + self.rel_to_own_gross: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'unrealized_loss_rel_to_own_gross_pnl') class MetricsTree_Cohorts_Utxo_All_Unrealized_NetPnl: """Metrics tree node.""" @@ -4832,7 +4817,7 @@ class MetricsTree_Cohorts_Utxo_All_Unrealized_NetPnl: def __init__(self, client: BrkClientBase, base_path: str = ''): self.cents: MetricPattern1[CentsSigned] = MetricPattern1(client, 'net_unrealized_pnl_cents') self.usd: MetricPattern1[Dollars] = MetricPattern1(client, 'net_unrealized_pnl') - self.rel_to_own_gross: BpsPercentRatioPattern2 = BpsPercentRatioPattern2(client, 'net_unrealized_pnl_rel_to_own_gross_pnl') + self.rel_to_own_gross: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'net_unrealized_pnl_rel_to_own_gross_pnl') class MetricsTree_Cohorts_Utxo_All_Unrealized_Profit: """Metrics tree node.""" @@ -4840,9 +4825,9 @@ class MetricsTree_Cohorts_Utxo_All_Unrealized_Profit: def __init__(self, client: BrkClientBase, base_path: str = ''): self.base: CentsUsdPattern2 = CentsUsdPattern2(client, 'unrealized_profit') self.cumulative: CentsUsdPattern2 = CentsUsdPattern2(client, 'unrealized_profit_cumulative') - self.sum: _1m1w1y24hPattern5 = _1m1w1y24hPattern5(client, 'unrealized_profit_sum') - self.rel_to_mcap: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'unrealized_profit_rel_to_mcap') - self.rel_to_own_gross: BpsPercentRatioPattern4 = BpsPercentRatioPattern4(client, 'unrealized_profit_rel_to_own_gross_pnl') + self.sum: _1m1w1y24hPattern4 = _1m1w1y24hPattern4(client, 'unrealized_profit_sum') + self.rel_to_mcap: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'unrealized_profit_rel_to_mcap') + self.rel_to_own_gross: BpsPercentRatioPattern3 = BpsPercentRatioPattern3(client, 'unrealized_profit_rel_to_own_gross_pnl') class MetricsTree_Cohorts_Utxo_All_Unrealized: """Metrics tree node.""" @@ -4878,15 +4863,6 @@ class MetricsTree_Cohorts_Utxo_Sth: self.cost_basis: InvestedMaxMinPercentilesSupplyPattern = InvestedMaxMinPercentilesSupplyPattern(client, 'sth') self.unrealized: GrossInvestedLossNetNuplProfitSentimentPattern2 = GrossInvestedLossNetNuplProfitSentimentPattern2(client, 'sth') -class MetricsTree_Cohorts_Utxo_Lth_Realized_SellSideRiskRatio: - """Metrics tree node.""" - - def __init__(self, client: BrkClientBase, base_path: str = ''): - self._24h: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'lth_sell_side_risk_ratio_24h') - self._1w: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'lth_sell_side_risk_ratio_1w') - self._1m: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'lth_sell_side_risk_ratio_1m') - self._1y: BpsPercentRatioPattern = BpsPercentRatioPattern(client, 'lth_sell_side_risk_ratio_1y') - class MetricsTree_Cohorts_Utxo_Lth_Realized_Sopr: """Metrics tree node.""" @@ -4902,7 +4878,7 @@ class MetricsTree_Cohorts_Utxo_Lth_Realized: self.profit: BaseCumulativeDistributionRelSumValuePattern = BaseCumulativeDistributionRelSumValuePattern(client, 'lth') self.loss: BaseCapitulationCumulativeNegativeRelSumValuePattern = BaseCapitulationCumulativeNegativeRelSumValuePattern(client, 'lth') self.gross_pnl: BaseCumulativeSumPattern3 = BaseCumulativeSumPattern3(client, 'lth_realized_gross_pnl') - self.sell_side_risk_ratio: MetricsTree_Cohorts_Utxo_Lth_Realized_SellSideRiskRatio = MetricsTree_Cohorts_Utxo_Lth_Realized_SellSideRiskRatio(client) + self.sell_side_risk_ratio: _1m1w1y24hPattern6 = _1m1w1y24hPattern6(client, 'lth_sell_side_risk_ratio') self.net_pnl: BaseChangeCumulativeDeltaRelSumPattern = BaseChangeCumulativeDeltaRelSumPattern(client, 'lth_net') self.sopr: MetricsTree_Cohorts_Utxo_Lth_Realized_Sopr = MetricsTree_Cohorts_Utxo_Lth_Realized_Sopr(client) self.peak_regret: BaseCumulativeRelPattern = BaseCumulativeRelPattern(client, 'lth_realized_peak_regret') @@ -5330,24 +5306,24 @@ class BrkClient(BrkClientBase): "halving", "epoch", "height", - "txindex", - "txinindex", - "txoutindex", - "emptyoutputindex", - "opreturnindex", - "p2aaddressindex", - "p2msoutputindex", - "p2pk33addressindex", - "p2pk65addressindex", - "p2pkhaddressindex", - "p2shaddressindex", - "p2traddressindex", - "p2wpkhaddressindex", - "p2wshaddressindex", - "unknownoutputindex", - "fundedaddressindex", - "emptyaddressindex", - "pairoutputindex" + "tx_index", + "txin_index", + "txout_index", + "empty_output_index", + "op_return_index", + "p2a_address_index", + "p2ms_output_index", + "p2pk33_address_index", + "p2pk65_address_index", + "p2pkh_address_index", + "p2sh_address_index", + "p2tr_address_index", + "p2wpkh_address_index", + "p2wsh_address_index", + "unknown_output_index", + "funded_address_index", + "empty_address_index", + "pair_output_index" ] POOL_ID_TO_POOL_NAME = { diff --git a/website/scripts/chart/index.js b/website/scripts/chart/index.js index da1d84ab3..e4cf16a9c 100644 --- a/website/scripts/chart/index.js +++ b/website/scripts/chart/index.js @@ -326,8 +326,8 @@ export function createChart({ parent, brk, fitContent }) { timeScale: { timeVisible: index === "height" || - index === "difficultyepoch" || - index === "halvingepoch" || + index === "epoch" || + index === "halving" || index.startsWith("minute") || index.startsWith("hour"), ...(!fitContent diff --git a/website/scripts/options/cointime.js b/website/scripts/options/cointime.js index b52e1cf6c..68b8d74ff 100644 --- a/website/scripts/options/cointime.js +++ b/website/scripts/options/cointime.js @@ -9,23 +9,24 @@ import { satsBtcUsd, createPriceRatioCharts } from "./shared.js"; * @returns {PartialOptionsGroup} */ export function createCointimeSection() { - const { cointime, distribution, supply } = brk.metrics; + const { cointime, cohorts, supply } = brk.metrics; const { - pricing, + prices: cointimePrices, cap, activity, supply: cointimeSupply, adjusted, reserveRisk, value, + coinblocksDestroyed, } = cointime; - const { all } = distribution.utxoCohorts; + const { all } = cohorts.utxo; // Reference lines for cap comparisons const capReferenceLines = /** @type {const} */ ([ { metric: supply.marketCap, name: "Market", color: colors.default }, { - metric: all.realized.realizedCap, + metric: all.realized.cap.usd, name: "Realized", color: colors.realized, }, @@ -33,48 +34,44 @@ export function createCointimeSection() { const prices = /** @type {const} */ ([ { - pricePattern: pricing.trueMarketMean, - ratio: pricing.trueMarketMeanRatio, + pattern: cointimePrices.trueMarketMean, name: "True Market Mean", color: colors.trueMarketMean, }, { - pricePattern: pricing.vaultedPrice, - ratio: pricing.vaultedPriceRatio, + pattern: cointimePrices.vaulted, name: "Vaulted", color: colors.vaulted, }, { - pricePattern: pricing.activePrice, - ratio: pricing.activePriceRatio, + pattern: cointimePrices.active, name: "Active", color: colors.active, }, { - pricePattern: pricing.cointimePrice, - ratio: pricing.cointimePriceRatio, + pattern: cointimePrices.cointime, name: "Cointime", color: colors.cointime, }, ]); const caps = /** @type {const} */ ([ - { metric: cap.vaultedCap, name: "Vaulted", color: colors.vaulted }, - { metric: cap.activeCap, name: "Active", color: colors.active }, - { metric: cap.cointimeCap, name: "Cointime", color: colors.cointime }, - { metric: cap.investorCap, name: "Investor", color: colors.investor }, - { metric: cap.thermoCap, name: "Thermo", color: colors.thermo }, + { metric: cap.vaulted.usd, name: "Vaulted", color: colors.vaulted }, + { metric: cap.active.usd, name: "Active", color: colors.active }, + { metric: cap.cointime.usd, name: "Cointime", color: colors.cointime }, + { metric: cap.investor.usd, name: "Investor", color: colors.investor }, + { metric: cap.thermo.usd, name: "Thermo", color: colors.thermo }, ]); const supplyBreakdown = /** @type {const} */ ([ { pattern: all.supply.total, name: "Total", color: colors.bitcoin }, { - pattern: cointimeSupply.vaultedSupply, + pattern: cointimeSupply.vaulted, name: "Vaulted", color: colors.vaulted, }, { - pattern: cointimeSupply.activeSupply, + pattern: cointimeSupply.active, name: "Active", color: colors.active, }, @@ -82,7 +79,7 @@ export function createCointimeSection() { const coinblocks = /** @type {const} */ ([ { - pattern: all.activity.coinblocksDestroyed, + pattern: coinblocksDestroyed, name: "Destroyed", title: "Coinblocks Destroyed", color: colors.destroyed, @@ -104,19 +101,19 @@ export function createCointimeSection() { // Colors aligned with coinblocks: Destroyed=red, Created=orange, Stored=green const cointimeValues = /** @type {const} */ ([ { - pattern: value.cointimeValueCreated, + pattern: value.created, name: "Created", title: "Cointime Value Created", color: colors.created, }, { - pattern: value.cointimeValueDestroyed, + pattern: value.destroyed, name: "Destroyed", title: "Cointime Value Destroyed", color: colors.destroyed, }, { - pattern: value.cointimeValueStored, + pattern: value.stored, name: "Stored", title: "Cointime Value Stored", color: colors.stored, @@ -142,31 +139,31 @@ export function createCointimeSection() { title: "Cointime Prices", top: [ price({ - metric: all.realized.realizedPrice, + metric: all.realized.price, name: "Realized", color: colors.realized, }), price({ - metric: all.realized.investorPrice, + metric: all.realized.investor.price, name: "Investor", color: colors.investor, }), - ...prices.map(({ pricePattern, name, color }) => - price({ metric: pricePattern, name, color }), + ...prices.map(({ pattern, name, color }) => + price({ metric: pattern, name, color }), ), ], }, - ...prices.map(({ pricePattern, ratio, name, color }) => ({ + ...prices.map(({ pattern, name, color }) => ({ name, tree: createPriceRatioCharts({ context: `${name} Price`, legend: name, - pricePattern, - ratio, + pricePattern: pattern, + ratio: pattern, color, priceReferences: [ price({ - metric: all.realized.realizedPrice, + metric: all.realized.price, name: "Realized", color: colors.realized, defaultActive: false, @@ -238,7 +235,7 @@ export function createCointimeSection() { unit: Unit.ratio, }), line({ - metric: activity.activityToVaultednessRatio, + metric: activity.ratio, name: "L/V Ratio", color: colors.activity, unit: Unit.ratio, @@ -259,7 +256,7 @@ export function createCointimeSection() { title: "Coinblocks", bottom: coinblocks.map(({ pattern, name, color }) => line({ - metric: pattern.height, + metric: pattern.base, name, color, unit: Unit.coinblocks, @@ -288,7 +285,7 @@ export function createCointimeSection() { title, bottom: [ line({ - metric: pattern.height, + metric: pattern.base, name, color, unit: Unit.coinblocks, @@ -325,10 +322,10 @@ export function createCointimeSection() { title: "Cointime Value", bottom: [ ...cointimeValues.map(({ pattern, name, color }) => - line({ metric: pattern.height, name, color, unit: Unit.usd }), + line({ metric: pattern.base, name, color, unit: Unit.usd }), ), line({ - metric: vocdd.pattern.height, + metric: vocdd.pattern.base, name: vocdd.name, color: vocdd.color, unit: Unit.usd, @@ -364,7 +361,7 @@ export function createCointimeSection() { name: "Base", title, bottom: [ - line({ metric: pattern.height, name, color, unit: Unit.usd }), + line({ metric: pattern.base, name, color, unit: Unit.usd }), ], }, rollingWindowsTree({ windows: pattern.sum, title, unit: Unit.usd }), @@ -390,13 +387,13 @@ export function createCointimeSection() { title: vocdd.title, bottom: [ line({ - metric: vocdd.pattern.height, + metric: vocdd.pattern.base, name: vocdd.name, color: vocdd.color, unit: Unit.usd, }), line({ - metric: reserveRisk.vocdd365dMedian, + metric: reserveRisk.vocddMedian1y, name: "365d Median", color: colors.time._1y, unit: Unit.usd, @@ -430,7 +427,7 @@ export function createCointimeSection() { title: "Reserve Risk", bottom: [ line({ - metric: reserveRisk.reserveRisk, + metric: reserveRisk.value, name: "Ratio", color: colors.reserveRisk, unit: Unit.ratio, @@ -461,13 +458,13 @@ export function createCointimeSection() { title: "Cointime-Adjusted Inflation", bottom: [ dots({ - metric: supply.inflation, + metric: supply.inflationRate.percent, name: "Base", color: colors.base, unit: Unit.percentage, }), dots({ - metric: adjusted.cointimeAdjInflationRate, + metric: adjusted.inflationRate.percent, name: "Cointime-Adjusted", color: colors.adjusted, unit: Unit.percentage, @@ -488,7 +485,7 @@ export function createCointimeSection() { unit: Unit.ratio, }), line({ - metric: adjusted.cointimeAdjTxBtcVelocity, + metric: adjusted.txVelocityBtc, name: "Cointime-Adjusted", color: colors.adjusted, unit: Unit.ratio, @@ -506,7 +503,7 @@ export function createCointimeSection() { unit: Unit.ratio, }), line({ - metric: adjusted.cointimeAdjTxUsdVelocity, + metric: adjusted.txVelocityUsd, name: "Cointime-Adjusted", color: colors.vaulted, unit: Unit.ratio, diff --git a/website/scripts/options/distribution/data.js b/website/scripts/options/distribution/data.js index 829ae1eeb..541ee4340 100644 --- a/website/scripts/options/distribution/data.js +++ b/website/scripts/options/distribution/data.js @@ -1,5 +1,3 @@ -/** Build cohort data arrays from brk.metrics */ - import { colors } from "../../utils/colors.js"; import { entries } from "../../utils/array.js"; import { brk } from "../../client.js"; @@ -20,36 +18,34 @@ const ADDRESSABLE_TYPES = [ const isAddressable = (key) => ADDRESSABLE_TYPES.includes(/** @type {any} */ (key)); -/** - * Build all cohort data from brk tree - */ export function buildCohortData() { - const utxoCohorts = brk.metrics.distribution.utxoCohorts; - const addressCohorts = brk.metrics.distribution.addressCohorts; - const { addrCount } = brk.metrics.distribution; + const utxoCohorts = brk.metrics.cohorts.utxo; + const addressCohorts = brk.metrics.cohorts.address; + const { addresses } = brk.metrics; const { TERM_NAMES, EPOCH_NAMES, - MAX_AGE_NAMES, - MIN_AGE_NAMES, + UNDER_AGE_NAMES, + OVER_AGE_NAMES, AGE_RANGE_NAMES, - GE_AMOUNT_NAMES, - LT_AMOUNT_NAMES, + OVER_AMOUNT_NAMES, + UNDER_AMOUNT_NAMES, AMOUNT_RANGE_NAMES, SPENDABLE_TYPE_NAMES, CLASS_NAMES, } = brk; - // Base cohort representing "all" const cohortAll = { name: "", title: "", color: colors.bitcoin, tree: utxoCohorts.all, - addrCount: addrCount.all, + addressCount: { + inner: addresses.funded.all, + delta: addresses.delta.all, + }, }; - // Term cohorts const shortNames = TERM_NAMES.short; const termShort = { name: shortNames.short, @@ -66,141 +62,102 @@ export function buildCohortData() { tree: utxoCohorts.lth, }; - // Max age cohorts (up to X time) - const upToDate = entries(utxoCohorts.maxAge).map(([key, tree], i, arr) => { - const names = MAX_AGE_NAMES[key]; - return { + // Under age cohorts + const underAge = entries(UNDER_AGE_NAMES).map(([key, names], i, arr) => ({ + name: names.short, + title: `UTXOs ${names.long}`, + color: colors.at(i, arr.length), + tree: utxoCohorts.underAge[key], + })); + + // Over age cohorts + const overAge = entries(OVER_AGE_NAMES).map(([key, names], i, arr) => ({ + name: names.short, + title: `UTXOs ${names.long}`, + color: colors.at(i, arr.length), + tree: utxoCohorts.overAge[key], + })); + + const ageRange = entries(AGE_RANGE_NAMES).map(([key, names], i, arr) => ({ + name: names.short, + title: `UTXOs ${names.long}`, + color: colors.at(i, arr.length), + tree: utxoCohorts.ageRange[key], + })); + + const epoch = entries(EPOCH_NAMES).map(([key, names], i, arr) => ({ + name: names.short, + title: names.long, + color: colors.at(i, arr.length), + tree: utxoCohorts.epoch[key], + })); + + const utxosOverAmount = entries(OVER_AMOUNT_NAMES).map( + ([key, names], i, arr) => ({ name: names.short, title: `UTXOs ${names.long}`, color: colors.at(i, arr.length), - tree, - }; - }); - - // Min age cohorts (from X time) - const fromDate = entries(utxoCohorts.minAge).map(([key, tree], i, arr) => { - const names = MIN_AGE_NAMES[key]; - return { - name: names.short, - title: `UTXOs ${names.long}`, - color: colors.at(i, arr.length), - tree, - }; - }); - - // Age range cohorts - const dateRange = entries(utxoCohorts.ageRange).map(([key, tree], i, arr) => { - const names = AGE_RANGE_NAMES[key]; - return { - name: names.short, - title: `UTXOs ${names.long}`, - color: colors.at(i, arr.length), - tree, - }; - }); - - // Epoch cohorts - const epoch = entries(utxoCohorts.epoch).map(([key, tree], i, arr) => { - const names = EPOCH_NAMES[key]; - return { - name: names.short, - title: names.long, - color: colors.at(i, arr.length), - tree, - }; - }); - - // UTXOs above amount - const utxosAboveAmount = entries(utxoCohorts.geAmount).map( - ([key, tree], i, arr) => { - const names = GE_AMOUNT_NAMES[key]; - return { - name: names.short, - title: `UTXOs ${names.long}`, - color: colors.at(i, arr.length), - tree, - }; - }, + tree: utxoCohorts.overAmount[key], + }), ); - // Addresses above amount - const addressesAboveAmount = entries(addressCohorts.geAmount).map( - ([key, cohort], i, arr) => { - const names = GE_AMOUNT_NAMES[key]; + const addressesOverAmount = entries(OVER_AMOUNT_NAMES).map( + ([key, names], i, arr) => { + const cohort = addressCohorts.overAmount[key]; return { name: names.short, title: `Addresses ${names.long}`, color: colors.at(i, arr.length), tree: cohort, - addrCount: { - count: cohort.addrCount, - _30dChange: cohort.addrCount30dChange, - }, + addressCount: cohort.addressCount, }; }, ); - // UTXOs under amount - const utxosUnderAmount = entries(utxoCohorts.ltAmount).map( - ([key, tree], i, arr) => { - const names = LT_AMOUNT_NAMES[key]; - return { - name: names.short, - title: `UTXOs ${names.long}`, - color: colors.at(i, arr.length), - tree, - }; - }, + const utxosUnderAmount = entries(UNDER_AMOUNT_NAMES).map( + ([key, names], i, arr) => ({ + name: names.short, + title: `UTXOs ${names.long}`, + color: colors.at(i, arr.length), + tree: utxoCohorts.underAmount[key], + }), ); - // Addresses under amount - const addressesUnderAmount = entries(addressCohorts.ltAmount).map( - ([key, cohort], i, arr) => { - const names = LT_AMOUNT_NAMES[key]; + const addressesUnderAmount = entries(UNDER_AMOUNT_NAMES).map( + ([key, names], i, arr) => { + const cohort = addressCohorts.underAmount[key]; return { name: names.short, title: `Addresses ${names.long}`, color: colors.at(i, arr.length), tree: cohort, - addrCount: { - count: cohort.addrCount, - _30dChange: cohort.addrCount30dChange, - }, + addressCount: cohort.addressCount, }; }, ); - // UTXOs amount ranges - const utxosAmountRanges = entries(utxoCohorts.amountRange).map( - ([key, tree], i, arr) => { - const names = AMOUNT_RANGE_NAMES[key]; - return { - name: names.short, - title: `UTXOs ${names.long}`, - color: colors.at(i, arr.length), - tree, - }; - }, + const utxosAmountRange = entries(AMOUNT_RANGE_NAMES).map( + ([key, names], i, arr) => ({ + name: names.short, + title: `UTXOs ${names.long}`, + color: colors.at(i, arr.length), + tree: utxoCohorts.amountRange[key], + }), ); - // Addresses amount ranges - const addressesAmountRanges = entries(addressCohorts.amountRange).map( - ([key, cohort], i, arr) => { - const names = AMOUNT_RANGE_NAMES[key]; + const addressesAmountRange = entries(AMOUNT_RANGE_NAMES).map( + ([key, names], i, arr) => { + const cohort = addressCohorts.amountRange[key]; return { name: names.short, title: `Addresses ${names.long}`, color: colors.at(i, arr.length), tree: cohort, - addrCount: { - count: cohort.addrCount, - _30dChange: cohort.addrCount30dChange, - }, + addressCount: cohort.addressCount, }; }, ); - // Spendable type cohorts - split by addressability const typeAddressable = ADDRESSABLE_TYPES.map((key, i, arr) => { const names = SPENDABLE_TYPE_NAMES[key]; return { @@ -208,49 +165,45 @@ export function buildCohortData() { title: names.short, color: colors.at(i, arr.length), tree: utxoCohorts.type[key], - addrCount: addrCount[key], + addressCount: { + inner: addresses.funded[key], + delta: addresses.delta[key], + }, }; }); - const typeOther = entries(utxoCohorts.type) + const typeOther = entries(SPENDABLE_TYPE_NAMES) .filter(([key]) => !isAddressable(key)) - .map(([key, tree], i, arr) => { - const names = SPENDABLE_TYPE_NAMES[key]; - return { - name: names.short, - title: names.short, - color: colors.at(i, arr.length), - tree, - }; - }); + .map(([key, names], i, arr) => ({ + name: names.short, + title: names.short, + color: colors.at(i, arr.length), + tree: utxoCohorts.type[key], + })); - // Class cohorts - const class_ = entries(utxoCohorts.class) + const class_ = entries(CLASS_NAMES) .reverse() - .map(([key, tree], i, arr) => { - const names = CLASS_NAMES[key]; - return { - name: names.short, - title: names.long, - color: colors.at(i, arr.length), - tree, - }; - }); + .map(([key, names], i, arr) => ({ + name: names.short, + title: names.long, + color: colors.at(i, arr.length), + tree: utxoCohorts.class[key], + })); return { cohortAll, termShort, termLong, - upToDate, - fromDate, - dateRange, + underAge, + overAge, + ageRange, epoch, - utxosAboveAmount, - addressesAboveAmount, + utxosOverAmount, + addressesOverAmount, utxosUnderAmount, addressesUnderAmount, - utxosAmountRanges, - addressesAmountRanges, + utxosAmountRange, + addressesAmountRange, typeAddressable, typeOther, class: class_, diff --git a/website/scripts/options/distribution/holdings.js b/website/scripts/options/distribution/holdings.js index 099107d53..050a32dd9 100644 --- a/website/scripts/options/distribution/holdings.js +++ b/website/scripts/options/distribution/holdings.js @@ -211,7 +211,7 @@ function singleAddressCountChart(cohort, title) { title: title("Address Count"), bottom: [ line({ - metric: cohort.addrCount.count, + metric: cohort.addressCount.inner, name: "Address Count", color: cohort.color, unit: Unit.count, @@ -299,7 +299,7 @@ function createSingleUtxoCount30dChangeSeries(cohort) { function createSingleAddrCount30dChangeSeries(cohort) { return [ baseline({ - metric: cohort.addrCount._30dChange, + metric: cohort.addressCount.delta.change._1m, name: "30d Change", unit: Unit.count, }), @@ -580,8 +580,8 @@ export function createGroupedHoldingsSectionAddress({ list, all, title }) { { name: "Address Count", title: title("Address Count"), - bottom: mapCohortsWithAll(list, all, ({ name, color, addrCount }) => - line({ metric: addrCount.count, name, color, unit: Unit.count }), + bottom: mapCohortsWithAll(list, all, ({ name, color, addressCount }) => + line({ metric: addressCount.inner, name, color, unit: Unit.count }), ), }, { @@ -592,9 +592,9 @@ export function createGroupedHoldingsSectionAddress({ list, all, title }) { { name: "Address Count", title: title("Address Count 30d Change"), - bottom: mapCohortsWithAll(list, all, ({ name, color, addrCount }) => + bottom: mapCohortsWithAll(list, all, ({ name, color, addressCount }) => baseline({ - metric: addrCount._30dChange, + metric: addressCount.delta.change._1m, name, unit: Unit.count, color, @@ -706,8 +706,8 @@ export function createGroupedHoldingsSectionAddressAmount({ { name: "Address Count", title: title("Address Count"), - bottom: mapCohortsWithAll(list, all, ({ name, color, addrCount }) => - line({ metric: addrCount.count, name, color, unit: Unit.count }), + bottom: mapCohortsWithAll(list, all, ({ name, color, addressCount }) => + line({ metric: addressCount.inner, name, color, unit: Unit.count }), ), }, { @@ -718,9 +718,9 @@ export function createGroupedHoldingsSectionAddressAmount({ { name: "Address Count", title: title("Address Count 30d Change"), - bottom: mapCohortsWithAll(list, all, ({ name, color, addrCount }) => + bottom: mapCohortsWithAll(list, all, ({ name, color, addressCount }) => baseline({ - metric: addrCount._30dChange, + metric: addressCount.delta.change._1m, name, unit: Unit.count, color, diff --git a/website/scripts/options/partial.js b/website/scripts/options/partial.js index 2b7d02df7..af6e8ab21 100644 --- a/website/scripts/options/partial.js +++ b/website/scripts/options/partial.js @@ -39,16 +39,16 @@ export function createPartialOptions() { cohortAll, termShort, termLong, - upToDate, - fromDate, - dateRange, + underAge, + overAge, + ageRange, epoch, - utxosAboveAmount, - addressesAboveAmount, + utxosOverAmount, + addressesOverAmount, utxosUnderAmount, addressesUnderAmount, - utxosAmountRanges, - addressesAmountRanges, + utxosAmountRange, + addressesAmountRange, typeAddressable, typeOther, class: class_, @@ -99,11 +99,11 @@ export function createPartialOptions() { tree: [ createGroupedCohortFolderWithAdjusted({ name: "Compare", - title: "Max Age", - list: upToDate, + title: "Under Age", + list: underAge, all: cohortAll, }), - ...upToDate.map(createCohortFolderWithAdjusted), + ...underAge.map(createCohortFolderWithAdjusted), ], }, // Older Than (≥ X old) @@ -112,11 +112,11 @@ export function createPartialOptions() { tree: [ createGroupedCohortFolderBasicWithMarketCap({ name: "Compare", - title: "Min Age", - list: fromDate, + title: "Over Age", + list: overAge, all: cohortAll, }), - ...fromDate.map(createCohortFolderBasicWithMarketCap), + ...overAge.map(createCohortFolderBasicWithMarketCap), ], }, // Range @@ -126,10 +126,10 @@ export function createPartialOptions() { createGroupedCohortFolderAgeRange({ name: "Compare", title: "Age Ranges", - list: dateRange, + list: ageRange, all: cohortAll, }), - ...dateRange.map(createCohortFolderAgeRange), + ...ageRange.map(createCohortFolderAgeRange), ], }, ], @@ -145,7 +145,7 @@ export function createPartialOptions() { tree: [ createGroupedCohortFolderBasicWithMarketCap({ name: "Compare", - title: "Max Size", + title: "Over Amount", list: utxosUnderAmount, all: cohortAll, }), @@ -158,11 +158,11 @@ export function createPartialOptions() { tree: [ createGroupedCohortFolderBasicWithMarketCap({ name: "Compare", - title: "Min Size", - list: utxosAboveAmount, + title: "Under Amount", + list: utxosOverAmount, all: cohortAll, }), - ...utxosAboveAmount.map(createCohortFolderBasicWithMarketCap), + ...utxosOverAmount.map(createCohortFolderBasicWithMarketCap), ], }, // Range @@ -171,11 +171,11 @@ export function createPartialOptions() { tree: [ createGroupedCohortFolderBasicWithoutMarketCap({ name: "Compare", - title: "Size Ranges", - list: utxosAmountRanges, + title: "Amount Ranges", + list: utxosAmountRange, all: cohortAll, }), - ...utxosAmountRanges.map(createCohortFolderBasicWithoutMarketCap), + ...utxosAmountRange.map(createCohortFolderBasicWithoutMarketCap), ], }, ], @@ -191,7 +191,7 @@ export function createPartialOptions() { tree: [ createGroupedAddressCohortFolder({ name: "Compare", - title: "Max Balance", + title: "Over Balance", list: addressesUnderAmount, all: cohortAll, }), @@ -204,11 +204,11 @@ export function createPartialOptions() { tree: [ createGroupedAddressCohortFolder({ name: "Compare", - title: "Min Balance", - list: addressesAboveAmount, + title: "Under Balance", + list: addressesOverAmount, all: cohortAll, }), - ...addressesAboveAmount.map(createAddressCohortFolder), + ...addressesOverAmount.map(createAddressCohortFolder), ], }, // Range @@ -218,10 +218,10 @@ export function createPartialOptions() { createGroupedAddressCohortFolder({ name: "Compare", title: "Balance Ranges", - list: addressesAmountRanges, + list: addressesAmountRange, all: cohortAll, }), - ...addressesAmountRanges.map(createAddressCohortFolder), + ...addressesAmountRange.map(createAddressCohortFolder), ], }, ], diff --git a/website/scripts/options/series.js b/website/scripts/options/series.js index c29e13bd2..42a5f1716 100644 --- a/website/scripts/options/series.js +++ b/website/scripts/options/series.js @@ -434,9 +434,9 @@ export function statsAtWindow(pattern, window) { } /** - * Create a Rolling folder tree from a _1y24h30d7dPattern (4 rolling windows) + * Create a Rolling folder tree from a _1m1w1y24hPattern (4 rolling windows) * @param {Object} args - * @param {{ _24h: AnyMetricPattern, _7d: AnyMetricPattern, _30d: AnyMetricPattern, _1y: AnyMetricPattern }} args.windows + * @param {{ _24h: AnyMetricPattern, _1w: AnyMetricPattern, _1m: AnyMetricPattern, _1y: AnyMetricPattern }} args.windows * @param {string} args.title * @param {Unit} args.unit * @returns {PartialOptionsGroup} @@ -450,8 +450,8 @@ export function rollingWindowsTree({ windows, title, unit }) { title: `${title} Rolling`, bottom: [ line({ metric: windows._24h, name: "24h", color: colors.time._24h, unit }), - line({ metric: windows._7d, name: "7d", color: colors.time._1w, unit }), - line({ metric: windows._30d, name: "30d", color: colors.time._1m, unit }), + line({ metric: windows._1w, name: "7d", color: colors.time._1w, unit }), + line({ metric: windows._1m, name: "30d", color: colors.time._1m, unit }), line({ metric: windows._1y, name: "1y", color: colors.time._1y, unit }), ], }, @@ -463,12 +463,12 @@ export function rollingWindowsTree({ windows, title, unit }) { { name: "7d", title: `${title} 7d`, - bottom: [line({ metric: windows._7d, name: "7d", color: colors.time._1w, unit })], + bottom: [line({ metric: windows._1w, name: "7d", color: colors.time._1w, unit })], }, { name: "30d", title: `${title} 30d`, - bottom: [line({ metric: windows._30d, name: "30d", color: colors.time._1m, unit })], + bottom: [line({ metric: windows._1m, name: "30d", color: colors.time._1m, unit })], }, { name: "1y", diff --git a/website/scripts/options/types.js b/website/scripts/options/types.js index aca55f1f5..bb3af339c 100644 --- a/website/scripts/options/types.js +++ b/website/scripts/options/types.js @@ -194,7 +194,7 @@ * @property {string} title * @property {Color} color * @property {PatternAll} tree - * @property {Brk._30dCountPattern} addrCount + * @property {Brk.DeltaInnerPattern} addressCount * * Full cohort: adjustedSopr + percentiles + RelToMarketCap (term.short) * @typedef {Object} CohortFull @@ -260,7 +260,7 @@ * ============================================================================ * * Addressable cohort with address count (for "type" cohorts - no RelToMarketCap) - * @typedef {CohortBasicWithoutMarketCap & { addrCount: Brk._30dCountPattern }} CohortAddress + * @typedef {CohortBasicWithoutMarketCap & { addressCount: Brk.DeltaInnerPattern }} CohortAddress * * ============================================================================ * Cohort Group Types (by capability) @@ -328,7 +328,7 @@ * @property {string} title * @property {Color} color * @property {AddressCohortPattern} tree - * @property {Brk._30dCountPattern} addrCount + * @property {Brk.DeltaInnerPattern} addressCount * * @typedef {UtxoCohortObject | AddressCohortObject | CohortWithoutRelative} CohortObject * diff --git a/website/scripts/panes/chart.js b/website/scripts/panes/chart.js index 59ca1b933..12827fb6f 100644 --- a/website/scripts/panes/chart.js +++ b/website/scripts/panes/chart.js @@ -40,13 +40,13 @@ export function init() { /** @type {Map} */ const result = new Map(); - const { ohlc, price } = brk.metrics.prices; + const { ohlc, spot } = brk.metrics.prices; result.set(Unit.usd, [ /** @type {AnyFetchedSeriesBlueprint} */ ({ type: "Price", title: "Price", - metric: price.usd, + metric: spot.usd, ohlcMetric: ohlc.usd, }), ...(optionTop.get(Unit.usd) ?? []), @@ -56,7 +56,7 @@ export function init() { /** @type {AnyFetchedSeriesBlueprint} */ ({ type: "Price", title: "Price", - metric: price.sats, + metric: spot.sats, ohlcMetric: ohlc.sats, colors: /** @type {const} */ ([colors.bi.p1[1], colors.bi.p1[0]]), }), diff --git a/website/scripts/types.js b/website/scripts/types.js index 33f2bc6f1..ba30bf667 100644 --- a/website/scripts/types.js +++ b/website/scripts/types.js @@ -39,8 +39,8 @@ * @typedef {keyof Brk.BtcSatsUsdPattern} BtcSatsUsdKey * @typedef {Brk.BtcSatsUsdPattern} SupplyPattern * @typedef {Brk.AverageCumulativeMaxMedianMinPct10Pct25Pct75Pct90SumPattern} BlockSizePattern - * @typedef {keyof Brk.MetricsTree_Distribution_UtxoCohorts_Type} SpendableType - * @typedef {keyof Brk.MetricsTree_Distribution_AnyAddressIndexes} AddressableType + * @typedef {keyof Brk.MetricsTree_Cohorts_Utxo_Type} SpendableType + * @typedef {keyof Brk.MetricsTree_Addresses_Raw} AddressableType * * Brk pattern types (using new pattern names) * @typedef {Brk.ActivityCostOutputsRealizedRelativeSupplyUnrealizedPattern4} MaxAgePattern @@ -59,13 +59,13 @@ * AnyRatioPattern: full ratio patterns (with or without price) - has ratio, percentiles, z-scores * @typedef {Brk.RatioPattern | Brk.PriceRatioPattern} AnyRatioPattern * ValuePattern: patterns with base + cumulative (no rolling) - * @typedef {Brk.BaseCumulativeSumPattern | Brk.BaseCumulativePattern} ValuePattern + * @typedef {Brk.BaseCumulativeSumPattern | Brk.BaseCumulativePattern} ValuePattern * FullValuePattern: base + cumulative + rolling windows (flattened) * @typedef {Brk._1y24h30d7dBaseCumulativePattern} FullValuePattern * RollingWindowSlot: a single rolling window with stats (average, pct10, pct25, median, pct75, pct90, max, min, sum) per unit * @typedef {Brk.AverageMaxMedianMinPct10Pct25Pct75Pct90SumPattern2} RollingWindowSlot * AnyValuePatternType: union of all value pattern types - * @typedef {Brk._1y24h30d7dBaseCumulativePattern | Brk.BaseCumulativeSumPattern | Brk.BaseCumulativePattern} AnyValuePatternType + * @typedef {Brk._1y24h30d7dBaseCumulativePattern | Brk.BaseCumulativeSumPattern | Brk.BaseCumulativePattern} AnyValuePatternType * @typedef {Brk.AnyMetricPattern} AnyMetricPattern * @typedef {Brk.SatsUsdPattern} ActivePricePattern * @typedef {Brk.AnyMetricEndpointBuilder} AnyMetricEndpoint @@ -95,8 +95,7 @@ */ /** * Stats pattern: average, min, max, percentiles (height-only indexes, NO base) - * @template T - * @typedef {Brk.AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern} StatsPattern + * @typedef {Brk.AverageMaxMedianMinPct10Pct25Pct75Pct90Pattern} StatsPattern */ /** * Base stats pattern: height, average, min, max, percentiles (windowed, NO sum/cumulative) diff --git a/website/scripts/utils/serde.js b/website/scripts/utils/serde.js index 96972a88c..114db44a3 100644 --- a/website/scripts/utils/serde.js +++ b/website/scripts/utils/serde.js @@ -26,7 +26,7 @@ export const INDEX_LABEL = /** @type {const} */ ({ day1: "1d", day3: "3d", week1: "1w", month1: "1m", month3: "3m", month6: "6m", year1: "1y", year10: "10y", - halvingepoch: "halv", difficultyepoch: "diff", + halving: "halv", epoch: "diff", }); /** @typedef {typeof INDEX_LABEL} IndexLabelMap */