valiant_vortex_client 0.2.1

Rust client to interact with Valiant's on-chain Vortex program.
Documentation
use crate::generated::programs::VORTEX_ID;
use solana_program::program_error::ProgramError;
use solana_program::pubkey::Pubkey;

pub fn get_vortex_config_extension_address(
    vortex_config: &Pubkey,
) -> Result<(Pubkey, u8), ProgramError> {
    let seeds = &[b"config_extension", vortex_config.as_ref()];

    Pubkey::try_find_program_address(seeds, &VORTEX_ID).ok_or(ProgramError::InvalidSeeds)
}

#[cfg(test)]
mod tests {
    use super::*;
    use std::str::FromStr;

    // FIXME: update the addresses
    #[test]
    fn test_get_vortex_config_extension_address() {
        let vortex_config =
            Pubkey::from_str("7BRUr84e48Zh6PoFLQxfd8bvMdYQ2CgHXWczDsTqLhy6").unwrap();
        let vortex_config_extension =
            Pubkey::from_str("AdGHjTA4sbwNcaKamDhMmE4RN6sRXPstZZQCgs9tgEB3").unwrap();
        let (address, _) = get_vortex_config_extension_address(&vortex_config).unwrap();
        assert_eq!(address, vortex_config_extension);
    }
}