Skip to content

Commit

Permalink
Add simple searcher schema
Browse files Browse the repository at this point in the history
  • Loading branch information
danimhr committed Dec 6, 2024
1 parent 7b76083 commit de939a9
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 8 deletions.
9 changes: 9 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ resolver = "2"
members = [
"auction-server",
"gas-oracle",
"sdk/rust/simple-searcher",
"sdk/rust",
]
exclude = ["vault-simulator", "contracts/svm"]
Expand All @@ -23,6 +24,7 @@ solana-rpc-client = "2.0.13"
solana-transaction-status = "2.0.13"
solana-client = "2.0.13"
email_address = "0.2.4"
anyhow = "1.0.75"

# The curve25519-dalek crate is a dependency of solana-sdk.
# This crate relies on a specific version of zeroize that is incompatible with many other packages.
Expand Down
2 changes: 1 addition & 1 deletion auction-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ axum = { version = "0.7.5", features = ["ws", "tracing"] }
axum-streams = { version = "0.10.0", features = ["json", "text"] }
clap = { version = "4.4.4", features = ["derive", "env", "cargo"] }
tracing = { version = "0.1.40", features = ["log"] }
anyhow = "1.0.75"
anyhow = { workspace = true }
tracing-subscriber = { version = "0.3.18", features = ["env-filter", "json"] }
async-stream = "0.3.5"
utoipa = { workspace = true, features = ["axum_extras"] }
Expand Down
1 change: 1 addition & 0 deletions sdk/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ license = "Apache-2.0"

[dependencies]
express-relay-api-types = { version = "0.0.0", path = "../../auction-server/api-types" }
url = "2.5.4"
8 changes: 8 additions & 0 deletions sdk/rust/simple-searcher/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
name = "express-relay-simple-searcher"
version = "0.1.0"
edition = "2021"

[dependencies]
express-relay-client = { path = ".." }
anyhow = { workspace = true }
16 changes: 16 additions & 0 deletions sdk/rust/simple-searcher/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
use {
anyhow::{
anyhow,
Result,
},
express_relay_client::Client,
};

fn main() -> Result<()> {
let client = Client::try_new("http://127.0.0.1:9000", Some("test")).map_err(|e| {
eprintln!("Failed to create client: {:?}", e);
anyhow!("Failed to create client")
})?;
client.test();
Ok(())
}
23 changes: 16 additions & 7 deletions sdk/rust/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
use url::Url;

pub struct Client {
pub host: String,
pub host: Url,
pub api_key: Option<String>,
}

#[derive(Debug)]
pub enum ClientError {
InvalidHost(String),
}

impl Client {
pub fn new(host: &str) -> Self {
Self {
host: host.to_string(),
}
pub fn try_new(host: &str, api_key: Option<&str>) -> Result<Self, ClientError> {
Ok(Self {
host: Url::parse(host).map_err(|e| ClientError::InvalidHost(e.to_string()))?,
api_key: api_key.map(|s| s.to_string()),
})
}

pub fn test() {
println!("test");
pub fn test(&self) {
println!("Testing client with host: {:?}", self.host);
}
}

0 comments on commit de939a9

Please sign in to comment.