defituna-staking 1.0.13

Rust client to interact with DefiTuna's Staking 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 TunaStakingError {
    /// 6000 - Invalid instruction arguments
    #[error("Invalid instruction arguments")]
    InvalidInstructionArguments = 0x1770,
    /// 6001 - Insufficient remaining accounts
    #[error("Insufficient remaining accounts")]
    RemainingAccountsInsufficient = 0x1771,
    /// 6002 - Math overflow
    #[error("Math overflow")]
    MathOverflow = 0x1772,
    /// 6003 - Math underflow
    #[error("Math underflow")]
    MathUnderflow = 0x1773,
    /// 6004 - Type cast overflow
    #[error("Type cast overflow")]
    TypeCastOverflow = 0x1774,
    /// 6005 - Transfer fee calculation failed
    #[error("Transfer fee calculation failed")]
    TransferFeeCalculationError = 0x1775,
    /// 6006 - Token mint has unsupported attributes
    #[error("Token mint has unsupported attributes")]
    UnsupportedTokenMint = 0x1776,
    /// 6007 - Withdraw request exceeds user balance
    #[error("Withdraw request exceeds user balance")]
    WithdrawRequestExceedsUserBalance = 0x1777,
    /// 6008 - Tokens can't be unstaked because the cooldown has not expired
    #[error("Tokens can't be unstaked because the cooldown has not expired")]
    CooldownNotExpired = 0x1778,
    /// 6009 - Nothing to stake
    #[error("Nothing to stake")]
    NothingToStake = 0x1779,
    /// 6010 - Nothing to compound
    #[error("Nothing to compound")]
    NothingToCompound = 0x177A,
    /// 6011 - Nothing to deposit
    #[error("Nothing to deposit")]
    NothingToDeposit = 0x177B,
    /// 6012 - Nothing to withdraw
    #[error("Nothing to withdraw")]
    NothingToWithdraw = 0x177C,
    /// 6013 - Nothing to swap
    #[error("Nothing to swap")]
    NothingToSwap = 0x177D,
    /// 6014 - Nothing staked
    #[error("Nothing staked")]
    NothingStaked = 0x177E,
    /// 6015 - Staked token are locked
    #[error("Staked token are locked")]
    StakedTokensLocked = 0x177F,
    /// 6016 - Staking is disabled
    #[error("Staking is disabled")]
    StakingDisabled = 0x1780,
    /// 6017 - Unstaking is disabled
    #[error("Unstaking is disabled")]
    UnstakingDisabled = 0x1781,
    /// 6018 - Withdraw is disabled
    #[error("Withdraw is disabled")]
    WithdrawDisabled = 0x1782,
}

impl solana_program_error::PrintProgramError for TunaStakingError {
    fn print<E>(&self) {
        solana_msg::msg!(&self.to_string());
    }
}

impl<T> solana_decode_error::DecodeError<T> for TunaStakingError {
    fn type_of() -> &'static str {
        "TunaStakingError"
    }
}