Skip to content

Commit

Permalink
Merge pull request #2 from graphops/sahra/change-user-address
Browse files Browse the repository at this point in the history
Sahra/change user address
  • Loading branch information
i0n authored Oct 9, 2024
2 parents 4b33f81 + d366c5f commit aa32024
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ use anyhow::{anyhow, bail, ensure};
use ordered_float::NotNan;
use serde::Deserialize;
use serde_with::serde_as;
use thegraph_core::{Address, SubgraphId};
use thegraph_core::SubgraphId;
use tokio::sync::watch;

#[derive(Clone, Debug, Default)]
pub struct AuthSettings {
pub key: String,
pub user: Address,
pub user: String,
pub authorized_subgraphs: Vec<SubgraphId>,
pub budget_usd: Option<NotNan<f64>>,
}
Expand All @@ -36,7 +36,7 @@ impl AuthSettings {
#[derive(Clone, Debug, Default, Deserialize)]
pub struct APIKey {
pub key: String,
pub user_address: Address,
pub user_address: String,
pub query_status: QueryStatus,
#[serde_as(as = "Option<serde_with::TryFromInto<f64>>")]
#[serde(rename = "max_budget")]
Expand Down Expand Up @@ -75,7 +75,7 @@ impl AuthContext {
if self.special_api_keys.contains(token) {
return Ok(AuthSettings {
key: token.to_string(),
user: Address::default(),
user: String::new(),
authorized_subgraphs: vec![],
budget_usd: None,
});
Expand Down Expand Up @@ -105,7 +105,7 @@ impl AuthContext {

Ok(AuthSettings {
key: api_key.key.clone(),
user: api_key.user_address,
user: api_key.user_address.clone(),
authorized_subgraphs: api_key.subgraphs.clone(),
budget_usd: api_key.max_budget_usd,
})
Expand Down
4 changes: 2 additions & 2 deletions src/reports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use anyhow::{anyhow, Context};
use ordered_float::NotNan;
use prost::Message;
use serde_json::json;
use thegraph_core::{Address, AllocationId, DeploymentId, IndexerId};
use thegraph_core::{AllocationId, DeploymentId, IndexerId};
use tokio::sync::mpsc;
use toolshed::concat_bytes;

Expand All @@ -13,7 +13,7 @@ pub struct ClientRequest {
pub response_time_ms: u16,
pub result: Result<(), errors::Error>,
pub api_key: String,
pub user_address: Address,
pub user_address: String,
pub grt_per_usd: NotNan<f64>,
pub indexer_requests: Vec<IndexerRequest>,
pub request_bytes: u32,
Expand Down
3 changes: 1 addition & 2 deletions src/subgraph_studio.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use std::collections::HashMap;

use serde::Deserialize;
use thegraph_core::Address;
use tokio::{
sync::watch,
time::{interval, Duration, MissedTickBehavior},
Expand Down Expand Up @@ -53,7 +52,7 @@ impl Client {
#[derive(Deserialize, Debug)]
struct _ApiKey {
key: String,
user_address: Address,
user_address: String,
query_status: QueryStatus,
max_budget: Option<f64>,
#[serde(default)]
Expand Down

0 comments on commit aa32024

Please sign in to comment.