Skip to content

Commit

Permalink
Merge pull request #331 from DioChuks/fix-320
Browse files Browse the repository at this point in the history
Fix 320
  • Loading branch information
Marchand-Nicolas authored Nov 25, 2024
2 parents 87befe5 + 01b65a5 commit 92ebc63
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 141 deletions.
1 change: 0 additions & 1 deletion src/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ pub mod get_achievement;
pub mod has_deployed_time;
pub mod verify_has_nft;
pub mod verify_has_root_domain;
pub mod verify_has_root_or_braavos_domain;
pub mod verify_quiz;
90 changes: 0 additions & 90 deletions src/common/verify_has_root_or_braavos_domain.rs

This file was deleted.

6 changes: 0 additions & 6 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ pub_struct!(Clone, Deserialize; StarknetIdContracts {
identity_contract: FieldElement,
});

pub_struct!(Clone, Deserialize; NamingContract { address: String });

pub_struct!(Clone, Deserialize; StarknetId {
account_id: String,
});

pub_struct!(Clone, Deserialize; Nostra {
utils_contract: FieldElement,
pairs : Vec<FieldElement>,
Expand Down
17 changes: 1 addition & 16 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ use axum::{http::StatusCode, Router};
use axum_auto_routes::route;
use mongodb::{bson::doc, options::ClientOptions, Client};
use reqwest::Url;
use serde_derive::Serialize;
use starknet::providers::{jsonrpc::HttpTransport, JsonRpcClient};
use std::net::SocketAddr;
use std::sync::Mutex;
use std::{borrow::Cow, sync::Arc};
use std::sync::Arc;
use tokio::sync;
use tower_http::cors::{Any, CorsLayer};
use utils::WithState;
Expand All @@ -25,20 +24,6 @@ lazy_static::lazy_static! {
pub static ref ROUTE_REGISTRY: Mutex<Vec<Box<dyn WithState>>> = Mutex::new(Vec::new());
}

#[derive(Serialize)]
struct LogData<'a> {
token: &'a str,
log: LogPayload<'a>,
}

#[derive(Serialize)]
struct LogPayload<'a> {
app_id: &'a str,
r#type: &'a str,
message: Cow<'a, str>,
timestamp: i64,
}

#[tokio::main]
async fn main() {
let conf = config::load();
Expand Down
28 changes: 0 additions & 28 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ use mongodb::{
IndexModel,
};
use rand::distributions::{Distribution, Uniform};
use serde_json::json;
use starknet::signers::Signer;
use starknet::{
core::{
Expand Down Expand Up @@ -794,33 +793,6 @@ pub async fn verify_quest_auth(
None => false,
}
}
pub async fn make_api_request(endpoint: &str, addr: &str, api_key: Option<&str>) -> bool {
let client = reqwest::Client::new();
let request_builder = client.post(endpoint).json(&json!({
"address": addr,
}));
let key = api_key.unwrap_or("");
let request_builder = match key.is_empty() {
true => request_builder,
false => request_builder.header("apiKey", key),
};
match request_builder.send().await {
Ok(response) => match response.json::<serde_json::Value>().await {
Ok(json) => {
//check value of result in json
if let Some(data) = json.get("data") {
if let Some(res) = data.get("result") {
return res.as_bool().unwrap();
}
}
false
}
Err(_) => false,
},
Err(_) => false,
};
false
}

// required for axum_auto_routes
pub trait WithState: Send {
Expand Down

0 comments on commit 92ebc63

Please sign in to comment.