feat: hl-node ingestion

Ported from https://github.com/hl-archive-node/nanoreth/pull/7 ; since this repo is experimental, will be merged with nanoreth repo in future.
This commit is contained in:
sprites0
2025-07-01 03:09:03 +00:00
parent 39ae8ae9f8
commit 1633b3d2e1
5 changed files with 254 additions and 8 deletions

View File

@ -12,6 +12,9 @@ pub struct BlockSourceArgs {
#[arg(long)]
block_source: Option<String>,
#[arg(long)]
block_source_from_node: Option<String>,
/// Shorthand of --block-source=s3://hl-mainnet-evm-blocks
#[arg(long = "s3", default_value_t = false)]
s3: bool,
@ -29,12 +32,16 @@ impl BlockSourceArgs {
));
};
let config = if let Some(bucket) = value.strip_prefix("s3://") {
let mut config = if let Some(bucket) = value.strip_prefix("s3://") {
BlockSourceConfig::s3(bucket.to_string()).await
} else {
BlockSourceConfig::local(value.to_string())
};
if let Some(block_source_from_node) = self.block_source_from_node.as_ref() {
config = config.with_block_source_from_node(block_source_from_node.to_string());
}
Ok(config)
}
}