use crate::chain::SolClient;
use anyhow::Result;
use serde::Serialize;
#[derive(Debug, Clone, Serialize)]
pub struct Launch {
pub mint: String,
pub symbol: Option<String>,
pub name: Option<String>,
pub launchpad: Option<String>,
pub dev: Option<String>,
#[serde(rename = "holderCount")]
pub holder_count: Option<u64>,
#[serde(rename = "mcapUsd")]
pub mcap_usd: Option<f64>,
#[serde(rename = "liquidityUsd")]
pub liquidity_usd: Option<f64>,
#[serde(rename = "createdAt")]
pub created_at: Option<String>,
}
pub async fn scan_new_launches(client: &SolClient) -> Result<Vec<Launch>> {
let recent = client.jupiter_recent().await?;
Ok(recent
.into_iter()
.map(|t| Launch {
mint: t.id,
symbol: t.symbol,
name: t.name,
launchpad: t.launchpad,
dev: t.dev,
holder_count: t.holder_count,
mcap_usd: t.mcap,
liquidity_usd: t.liquidity,
created_at: t.created_at,
})
.collect())
}