Skip to content

Commit

Permalink
feat: add subgraph query auth support
Browse files Browse the repository at this point in the history
  • Loading branch information
Theodus committed May 30, 2024
1 parent e8384a7 commit 1443cce
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ pub struct Config {
pub kafka: Kafka,
#[serde_as(as = "DisplayFromStr")]
pub network_subgraph: Url,
#[serde(default)]
pub query_auth: Option<String>,
#[serde_as(as = "DisplayFromStr")]
pub rpc_url: Hidden<Url>,
pub secret_key: Hidden<B256>,
Expand Down
9 changes: 7 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1443cce

Please sign in to comment.