jupiter-solana-client 1.0.2

Rust client to interact with Jupiter on-chain program.
Documentation
//! This code was AUTOGENERATED using the codama library.
//! Please DO NOT EDIT THIS FILE, instead use visitors
//! to add features, then rerun codama to update it.
//!
//! <https://github.com/codama-idl/codama>
//!

use num_derive::FromPrimitive;
use thiserror::Error;

#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
pub enum JupiterError {
    /// 6000 - Empty route
    #[error("Empty route")]
    EmptyRoute = 0x1770,
    /// 6001 - Slippage tolerance exceeded
    #[error("Slippage tolerance exceeded")]
    SlippageToleranceExceeded = 0x1771,
    /// 6002 - Invalid calculation
    #[error("Invalid calculation")]
    InvalidCalculation = 0x1772,
    /// 6003 - Missing platform fee account
    #[error("Missing platform fee account")]
    MissingPlatformFeeAccount = 0x1773,
    /// 6004 - Invalid slippage
    #[error("Invalid slippage")]
    InvalidSlippage = 0x1774,
    /// 6005 - Not enough percent to 100
    #[error("Not enough percent to 100")]
    NotEnoughPercent = 0x1775,
    /// 6006 - Token input index is invalid
    #[error("Token input index is invalid")]
    InvalidInputIndex = 0x1776,
    /// 6007 - Token output index is invalid
    #[error("Token output index is invalid")]
    InvalidOutputIndex = 0x1777,
    /// 6008 - Not Enough Account keys
    #[error("Not Enough Account keys")]
    NotEnoughAccountKeys = 0x1778,
    /// 6009 - Non zero minimum out amount not supported
    #[error("Non zero minimum out amount not supported")]
    NonZeroMinimumOutAmountNotSupported = 0x1779,
    /// 6010 - Invalid route plan
    #[error("Invalid route plan")]
    InvalidRoutePlan = 0x177A,
    /// 6011 - Invalid referral authority
    #[error("Invalid referral authority")]
    InvalidReferralAuthority = 0x177B,
    /// 6012 - Token account doesn't match the ledger
    #[error("Token account doesn't match the ledger")]
    LedgerTokenAccountDoesNotMatch = 0x177C,
    /// 6013 - Invalid token ledger
    #[error("Invalid token ledger")]
    InvalidTokenLedger = 0x177D,
    /// 6014 - Token program ID is invalid
    #[error("Token program ID is invalid")]
    IncorrectTokenProgramID = 0x177E,
    /// 6015 - Token program not provided
    #[error("Token program not provided")]
    TokenProgramNotProvided = 0x177F,
    /// 6016 - Swap not supported
    #[error("Swap not supported")]
    SwapNotSupported = 0x1780,
    /// 6017 - Exact out amount doesn't match
    #[error("Exact out amount doesn't match")]
    ExactOutAmountNotMatched = 0x1781,
    /// 6018 - Source mint and destination mint cannot the same
    #[error("Source mint and destination mint cannot the same")]
    SourceAndDestinationMintCannotBeTheSame = 0x1782,
    /// 6019 - Invalid mint
    #[error("Invalid mint")]
    InvalidMint = 0x1783,
    /// 6020 - Invalid program authority
    #[error("Invalid program authority")]
    InvalidProgramAuthority = 0x1784,
    /// 6021 - Invalid output token account
    #[error("Invalid output token account")]
    InvalidOutputTokenAccount = 0x1785,
    /// 6022 - Invalid fee wallet
    #[error("Invalid fee wallet")]
    InvalidFeeWallet = 0x1786,
    /// 6023 - Invalid authority
    #[error("Invalid authority")]
    InvalidAuthority = 0x1787,
    /// 6024 - Insufficient funds
    #[error("Insufficient funds")]
    InsufficientFunds = 0x1788,
    /// 6025 - Invalid token account
    #[error("Invalid token account")]
    InvalidTokenAccount = 0x1789,
    /// 6026 - Bonding curve already completed
    #[error("Bonding curve already completed")]
    BondingCurveAlreadyCompleted = 0x178A,
}

impl From<JupiterError> for solana_program_error::ProgramError {
    fn from(e: JupiterError) -> Self {
        solana_program_error::ProgramError::Custom(e as u32)
    }
}