wp-solana-core 0.1.2

Cross-protocol shared core for waterpump-solana: token planning compatibility, error types, system constants.
Documentation
//! Protocol-agnostic Solana system program constants.
//!
//! Only constants that are relevant to ALL protocols belong here.
//! Protocol-specific constants (e.g. Raydium AMM_V3_ID, tick bounds) live
//! in their respective crates.

use std::str::FromStr;

use solana_pubkey::Pubkey;

/// Metaplex Metadata Program ID (string literal).
pub const METADATA_PROGRAM_ID: &str = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s";

/// Metaplex Metadata Program Pubkey.
pub fn metadata_program_id() -> Pubkey {
    Pubkey::from_str(METADATA_PROGRAM_ID).expect("Invalid metadata program ID")
}

/// Rent Sysvar address.
pub const RENT_SYSVAR: &str = "SysvarRent111111111111111111111111111111111";

/// Rent Sysvar Pubkey.
pub fn rent_sysvar() -> Pubkey {
    Pubkey::from_str(RENT_SYSVAR).expect("Invalid rent sysvar address")
}

/// System Program address.
pub const SYSTEM_PROGRAM: &str = "11111111111111111111111111111111";

/// System Program Pubkey.
pub fn system_program() -> Pubkey {
    Pubkey::from_str(SYSTEM_PROGRAM).expect("Invalid system program address")
}

/// Associated Token Program address.
pub const ASSOCIATED_TOKEN_PROGRAM: &str = "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL";

/// Associated Token Program Pubkey.
pub fn associated_token_program() -> Pubkey {
    Pubkey::from_str(ASSOCIATED_TOKEN_PROGRAM).expect("Invalid associated token program address")
}

/// Memo Program address.
pub const MEMO_PROGRAM: &str = "MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr";

/// Memo Program Pubkey.
pub fn memo_program() -> Pubkey {
    Pubkey::from_str(MEMO_PROGRAM).expect("Invalid memo program address")
}