Skip to content

Commit

Permalink
feature: add an indexer service framework
Browse files Browse the repository at this point in the history
  • Loading branch information
Jannis committed Oct 23, 2023
1 parent eac5926 commit 0d8bbb7
Show file tree
Hide file tree
Showing 9 changed files with 555 additions and 22 deletions.
125 changes: 103 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ toolshed = { git = "https://github.com/edgeandnode/toolshed", branch = "main", f
] }
graphql = { git = "https://github.com/edgeandnode/toolshed", branch = "main" }
tap_core = "0.6.0"
axum = { version = "0.6.20", default_features = true, features = ["headers"] }
thiserror = "1.0.49"
async-trait = "0.1.74"
headers-derive = "0.1.1"
headers = "0.3.9"

[dev-dependencies]
env_logger = "0.9.0"
Expand Down
49 changes: 49 additions & 0 deletions common/src/indexer_service/http/config.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
use std::net::SocketAddr;

use alloy_primitives::Address;
use serde::{Deserialize, Serialize};

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct DatabaseConfig {
pub postgres_url: String,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct NetworkSubgraphConfig {
pub query_url: String,
pub syncing_interval: u64,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct EscrowSubgraphConfig {
pub query_url: String,
pub syncing_interval: u64,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ServerConfig {
pub host_and_port: SocketAddr,
pub url_prefix: String,
pub free_query_auth_token: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct IndexerServiceConfig {
pub indexer: IndexerConfig,
pub server: ServerConfig,
pub database: DatabaseConfig,
pub network_subgraph: NetworkSubgraphConfig,
pub escrow_subgraph: EscrowSubgraphConfig,
pub graph_network: GraphNetworkConfig,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct GraphNetworkConfig {
pub id: u64,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct IndexerConfig {
pub indexer_address: Address,
pub operator_mnemonic: String,
}
Loading

0 comments on commit 0d8bbb7

Please sign in to comment.