1pub mod auth;
2pub mod caip2;
3pub mod config;
4pub mod sign;
5pub mod tx;
6pub mod types;
7pub mod util;
8
9#[derive(Debug)]
10pub struct Privy {
11 pub config: config::PrivyConfig,
12 pub client: reqwest::Client,
13}
14
15#[derive(Debug, thiserror::Error)]
16pub enum PrivyError {
17 #[error("Configuration error: {0}")]
18 Config(config::PrivyConfigError),
19
20 #[error("Transaction error: {0}")]
21 Transaction(tx::PrivyTransactionError),
22
23 #[error("Authentication error: {0}")]
24 Auth(auth::PrivyAuthError),
25
26 #[error("Sign error: {0}")]
27 Sign(sign::PrivySignError),
28}
29
30impl Privy {
31 pub fn new(config: config::PrivyConfig) -> Self {
32 let client = util::create_privy_client(&config);
33 Self { config, client }
34 }
35}