Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: change user identifier type to a string from address #963

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/auth.rs
Original file line number Diff line number Diff line change
@@ -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>>,
}
@@ -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")]
@@ -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,
});
@@ -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,
})
2 changes: 1 addition & 1 deletion src/reports.rs
Original file line number Diff line number Diff line change
@@ -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,
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},
@@ -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)]