diff --git a/src/config.rs b/src/config.rs index bb362a2..8ba3651 100644 --- a/src/config.rs +++ b/src/config.rs @@ -15,6 +15,8 @@ pub struct Config { pub kafka: Kafka, #[serde_as(as = "DisplayFromStr")] pub network_subgraph: Url, + #[serde(default)] + pub query_auth: Option, #[serde_as(as = "DisplayFromStr")] pub rpc_url: Hidden, pub secret_key: Hidden, diff --git a/src/main.rs b/src/main.rs index 164528f..597c107 100644 --- a/src/main.rs +++ b/src/main.rs @@ -62,8 +62,13 @@ async fn main() -> anyhow::Result<()> { let http_client = reqwest::Client::builder() .timeout(Duration::from_secs(10)) .build()?; - let mut network_subgraph = SubgraphClient::new(http_client.clone(), config.network_subgraph); - let mut escrow_subgraph = SubgraphClient::new(http_client.clone(), config.escrow_subgraph); + let mut network_subgraph = + SubgraphClient::builder(http_client.clone(), config.network_subgraph) + .with_auth_token(config.query_auth.clone()) + .build(); + let mut escrow_subgraph = SubgraphClient::builder(http_client.clone(), config.escrow_subgraph) + .with_auth_token(config.query_auth) + .build(); let authorized_signers = authorized_signers(&mut escrow_subgraph, &sender_address) .await