use anyhow::Result;
use privy_rs::{
PrivyClient,
generated::types::{CreateWalletBody, WalletChainType},
};
use tracing_subscriber::EnvFilter;
#[tokio::main]
async fn main() -> Result<()> {
tracing_subscriber::fmt()
.with_env_filter(
EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::new("info")),
)
.init();
let client = PrivyClient::new_from_env()?;
tracing::info!("initialized privy client from environment");
let wallet = client
.wallets()
.create(
None,
&CreateWalletBody {
chain_type: WalletChainType::Solana,
additional_signers: None,
owner: None,
owner_id: None,
policy_ids: vec![],
},
)
.await?;
tracing::info!("got new wallet: {:?}", wallet);
Ok(())
}