From 324eec24dfb307908ce68d3bd145a85b0aa0e126 Mon Sep 17 00:00:00 2001 From: Pravdyvy Date: Fri, 9 Jan 2026 15:10:38 +0200 Subject: [PATCH] fix: indexer crate --- Cargo.lock | 31 +++++++++++++++++++++++++++++++ Cargo.toml | 5 ++++- indexer/Cargo.toml | 32 ++++++++++++++++++++++++++++++++ indexer/src/lib.rs | 14 ++++++++++++++ 4 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 indexer/Cargo.toml create mode 100644 indexer/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index df1c9ca6..ce029fb0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2864,6 +2864,37 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ee796ad498c8d9a1d68e477df8f754ed784ef875de1414ebdaf169f70a6a784" +[[package]] +name = "indexer" +version = "0.1.0" +dependencies = [ + "anyhow", + "async-stream", + "base58", + "base64", + "bedrock_client", + "borsh", + "bytemuck", + "clap", + "common", + "env_logger", + "futures", + "hex", + "indicatif", + "itertools 0.14.0", + "key_protocol", + "log", + "nssa", + "nssa_core", + "rand 0.8.5", + "risc0-zkvm", + "serde", + "serde_json", + "sha2", + "tokio", + "url", +] + [[package]] name = "indexmap" version = "1.9.3" diff --git a/Cargo.toml b/Cargo.toml index 35d0a408..83fdb493 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,8 @@ members = [ "examples/program_deployment", "examples/program_deployment/methods", "examples/program_deployment/methods/guest", - "bedrock_client", + "bedrock_client", + "indexer", ] [workspace.dependencies] @@ -35,6 +36,8 @@ sequencer_rpc = { path = "sequencer_rpc" } sequencer_runner = { path = "sequencer_runner" } wallet = { path = "wallet" } test_program_methods = { path = "test_program_methods" } +bedrock_client = { path = "bedrock_client" } +indexer = { path = "indexer" } tokio = { version = "1.28.2", features = [ "net", diff --git a/indexer/Cargo.toml b/indexer/Cargo.toml new file mode 100644 index 00000000..7984c944 --- /dev/null +++ b/indexer/Cargo.toml @@ -0,0 +1,32 @@ +[package] +name = "indexer" +version = "0.1.0" +edition = "2024" + +[dependencies] +nssa_core.workspace = true +nssa.workspace = true +common.workspace = true +bedrock_client.workspace = true +key_protocol.workspace = true + +anyhow.workspace = true +serde_json.workspace = true +env_logger.workspace = true +log.workspace = true +serde.workspace = true +tokio.workspace = true +clap.workspace = true +base64.workspace = true +bytemuck.workspace = true +borsh.workspace = true +base58.workspace = true +hex.workspace = true +rand.workspace = true +itertools.workspace = true +sha2.workspace = true +futures.workspace = true +async-stream = "0.3.6" +indicatif = { version = "0.18.3", features = ["improved_unicode"] } +risc0-zkvm.workspace = true +url.workspace = true \ No newline at end of file diff --git a/indexer/src/lib.rs b/indexer/src/lib.rs new file mode 100644 index 00000000..904ab816 --- /dev/null +++ b/indexer/src/lib.rs @@ -0,0 +1,14 @@ +use bedrock_client::BedrockClient; +use futures::Stream; +use url::Url; + +pub struct IndexerCore { + pub bedrock_client: BedrockClient, + pub bedrock_url: Url, +} + +impl IndexerCore { + pub async fn subscribe_block_stream(&self) -> Result, bedrock_client::Error> { + self.bedrock_client.0.get_lib_stream(self.bedrock_url).await + } +} \ No newline at end of file