use solana_pubkey::Pubkey;
use std::fmt;
use std::str::FromStr;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum LightconeEnv {
Local,
Staging,
Prod,
}
impl LightconeEnv {
pub fn api_url(&self) -> &'static str {
match self {
Self::Local => "https://local-api.lightcone.xyz",
Self::Staging => "https://tapi2.lightcone.xyz",
Self::Prod => "https://tapi.lightcone.xyz",
}
}
pub fn ws_url(&self) -> &'static str {
match self {
Self::Local => "wss://local-ws.lightcone.xyz/ws",
Self::Staging => "wss://tws2.lightcone.xyz/ws",
Self::Prod => "wss://tws.lightcone.xyz/ws",
}
}
pub fn rpc_url(&self) -> &'static str {
match self {
Self::Local => "https://api.devnet.solana.com",
Self::Staging => "https://api.devnet.solana.com",
Self::Prod => "https://api.devnet.solana.com",
}
}
pub fn program_id(&self) -> Pubkey {
match self {
Self::Local | Self::Staging => {
Pubkey::from_str("H3qkHTWUDUUw4ZvGNPdwdU4CYqks69bijo1CzVR12mq")
.expect("valid program id")
}
Self::Prod => Pubkey::from_str("8nzsoyHZFYig3uN3M717Q47MtLqzx2V2UAKaPTqDy5rV")
.expect("valid program id"),
}
}
}
impl Default for LightconeEnv {
fn default() -> Self {
Self::Prod
}
}
impl fmt::Display for LightconeEnv {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Local => write!(formatter, "local"),
Self::Staging => write!(formatter, "staging"),
Self::Prod => write!(formatter, "prod"),
}
}
}