#![allow(dead_code)]
use lazy_static::lazy_static;
use mpl_token_metadata::types::Creator;
use serde::{Deserialize, Serialize};
use solana_sdk::pubkey::Pubkey;
use std::collections::HashMap;
#[derive(serde::Serialize, serde::Deserialize)]
pub struct NFTMetadata {
pub(crate) name: String,
pub(crate) uri: String,
pub(crate) basis_points: Option<u16>, pub(crate) creators: Option<Vec<Creator>>, }
impl NFTMetadata {
pub fn new(name: &str, uri: &str, basis_points: Option<u16>, creators: Option<Vec<(Pubkey, u8)>>) -> Self {
let creators = creators.map(|creator_tuples| {
creator_tuples
.into_iter()
.map(|(pubkey, share)| Creator { address: pubkey, verified: true, share })
.collect::<Vec<Creator>>()
});
NFTMetadata { name: name.to_string(), uri: uri.to_string(), basis_points, creators }
}
}
#[derive(Serialize, Deserialize, Debug)]
pub struct DeployedData {
pub mint: String, pub signature: String, }
impl DeployedData {
pub fn new(mint: String, signature: String) -> Self {
DeployedData { mint, signature }
}
}
pub const USDC: &str = "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v";
lazy_static! {
pub static ref TOKENS: HashMap<&'static str, Pubkey> = {
let mut m = HashMap::new();
m.insert("USDC", Pubkey::from_str_const(USDC));
m.insert("USDT", Pubkey::from_str_const("Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"));
m.insert("USDS", Pubkey::from_str_const("USDSwr9ApdHk5bvJKMjzff41FfuX8bSxdKcR81vTwcA"));
m.insert("SOL", Pubkey::from_str_const("So11111111111111111111111111111111111111112"));
m.insert("jitoSOL", Pubkey::from_str_const("J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn"));
m.insert("bSOL", Pubkey::from_str_const("bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1"));
m.insert("mSOL", Pubkey::from_str_const("mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So"));
m.insert("BONK", Pubkey::from_str_const("DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263"));
m
};
}
pub const DEFAULT_OPTIONS: Options = Options { slippage_bps: 300, token_decimals: 9, referral_fee: 200 };
#[derive(Debug)]
pub struct Options {
pub slippage_bps: u32, pub token_decimals: u32, pub referral_fee: u32, }
pub const JUP_API: &str = "https://quote-api.jup.ag/v6";
pub const JUP_REFERRAL_ADDRESS: &str = "REFER4ZgmyYx9c6He5XfaTMiGfdLwRnkV4RPp9t9iF3";
pub const JUP_PRICE_V2: &str = "https://api.jup.ag/price/v2?ids=";
pub const PYTH_API: &str = "https://hermes.pyth.network/v2";
pub const RUGCHECK_URL: &str = "https://api.rugcheck.xyz/v1";