mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-04-30 09:30:00 -07:00
global: adding semester + making coarser intervals computed instead of eager
This commit is contained in:
@@ -4,7 +4,8 @@ use brk_core::{
|
||||
DateIndex, DecadeIndex, DifficultyEpoch, EmptyOutputIndex, HalvingEpoch, Height, InputIndex,
|
||||
MonthIndex, OpReturnIndex, OutputIndex, P2AAddressIndex, P2MSOutputIndex, P2PK33AddressIndex,
|
||||
P2PK65AddressIndex, P2PKHAddressIndex, P2SHAddressIndex, P2TRAddressIndex, P2WPKHAddressIndex,
|
||||
P2WSHAddressIndex, Printable, QuarterIndex, TxIndex, UnknownOutputIndex, WeekIndex, YearIndex,
|
||||
P2WSHAddressIndex, Printable, QuarterIndex, SemesterIndex, TxIndex, UnknownOutputIndex,
|
||||
WeekIndex, YearIndex,
|
||||
};
|
||||
use color_eyre::eyre::eyre;
|
||||
use schemars::JsonSchema;
|
||||
@@ -52,6 +53,8 @@ pub enum Index {
|
||||
P2WSHAddressIndex,
|
||||
#[schemars(description = "Quarter index")]
|
||||
QuarterIndex,
|
||||
#[schemars(description = "Semester index")]
|
||||
SemesterIndex,
|
||||
#[schemars(description = "Transaction index")]
|
||||
TxIndex,
|
||||
#[schemars(description = "Unknown output index")]
|
||||
@@ -63,7 +66,7 @@ pub enum Index {
|
||||
}
|
||||
|
||||
impl Index {
|
||||
pub fn all() -> [Self; 24] {
|
||||
pub fn all() -> [Self; 25] {
|
||||
[
|
||||
Self::DateIndex,
|
||||
Self::DecadeIndex,
|
||||
@@ -85,6 +88,7 @@ impl Index {
|
||||
Self::P2WPKHAddressIndex,
|
||||
Self::P2WSHAddressIndex,
|
||||
Self::QuarterIndex,
|
||||
Self::SemesterIndex,
|
||||
Self::TxIndex,
|
||||
Self::UnknownOutputIndex,
|
||||
Self::WeekIndex,
|
||||
@@ -114,6 +118,7 @@ impl Index {
|
||||
Self::P2WPKHAddressIndex => P2WPKHAddressIndex::to_possible_strings(),
|
||||
Self::P2WSHAddressIndex => P2WSHAddressIndex::to_possible_strings(),
|
||||
Self::QuarterIndex => QuarterIndex::to_possible_strings(),
|
||||
Self::SemesterIndex => SemesterIndex::to_possible_strings(),
|
||||
Self::TxIndex => TxIndex::to_possible_strings(),
|
||||
Self::UnknownOutputIndex => UnknownOutputIndex::to_possible_strings(),
|
||||
Self::WeekIndex => WeekIndex::to_possible_strings(),
|
||||
@@ -174,7 +179,7 @@ impl TryFrom<&str> for Index {
|
||||
Self::P2WSHAddressIndex
|
||||
}
|
||||
v if (Self::QuarterIndex).possible_values().contains(&v) => Self::QuarterIndex,
|
||||
v if (Self::QuarterIndex).possible_values().contains(&v) => Self::QuarterIndex,
|
||||
v if (Self::SemesterIndex).possible_values().contains(&v) => Self::SemesterIndex,
|
||||
v if (Self::TxIndex).possible_values().contains(&v) => Self::TxIndex,
|
||||
v if (Self::WeekIndex).possible_values().contains(&v) => Self::WeekIndex,
|
||||
v if (Self::YearIndex).possible_values().contains(&v) => Self::YearIndex,
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use brk_computer::Computer;
|
||||
use brk_core::Result;
|
||||
use brk_core::{Height, Result};
|
||||
use brk_indexer::Indexer;
|
||||
use brk_vec::AnyCollectableVec;
|
||||
use brk_vec::{AnyCollectableVec, AnyIndexedVec};
|
||||
use tabled::settings::Style;
|
||||
|
||||
mod deser;
|
||||
@@ -46,6 +46,10 @@ impl<'a> Interface<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_height(&self) -> Height {
|
||||
self._indexer.vecs.height_to_blockhash.height()
|
||||
}
|
||||
|
||||
pub fn search(&self, params: &Params) -> Vec<(String, &&dyn AnyCollectableVec)> {
|
||||
let tuples = params
|
||||
.ids
|
||||
|
||||
Reference in New Issue
Block a user