sendfun-sdk 3.0.0

Rust SDK for send.fun programs
Documentation
#![allow(
	clippy::all,
	clippy::pedantic,
	clippy::nursery,
	clippy::expect_used,
	clippy::unwrap_used,
	clippy::indexing_slicing,
	clippy::allow_attributes,
	clippy::allow_attributes_without_reason,
	clippy::mem_forget,
	unfulfilled_lint_expectations,
	unexpected_cfgs,
	unused_imports
)]

//! 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 SendDexError {
	/// 6000 - Pool is paused
	#[error("Pool is paused")]
	PoolPaused = 0x1770,
	/// 6001 - Slippage tolerance exceeded
	#[error("Slippage tolerance exceeded")]
	SlippageExceeded = 0x1771,
	/// 6002 - Insufficient balance in source account
	#[error("Insufficient balance in source account")]
	InsufficientBalance = 0x1772,
	/// 6003 - Invalid base mint
	#[error("Invalid base mint")]
	InvalidBaseMint = 0x1773,
	/// 6004 - Invalid quote mint
	#[error("Invalid quote mint")]
	InvalidQuoteMint = 0x1774,
	/// 6005 - Pool creation is disabled
	#[error("Pool creation is disabled")]
	PoolCreationDisabled = 0x1775,
	/// 6006 - Invalid pool state
	#[error("Invalid pool state")]
	InvalidPoolState = 0x1776,
	/// 6007 - Invalid deposit
	#[error("Invalid deposit")]
	InvalidDeposit = 0x1777,
	/// 6008 - Invalid pool balance
	#[error("Invalid pool balance")]
	InvalidPoolBalance = 0x1778,
	/// 6009 - Insufficient pool balance
	#[error("Insufficient pool balance")]
	InsufficientPoolBalance = 0x1779,
	/// 6010 - Invalid authority
	#[error("Invalid authority")]
	InvalidAuthority = 0x177A,
	/// 6011 - Invalid coin creator
	#[error("Invalid coin creator")]
	InvalidCoinCreator = 0x177B,
	/// 6012 - Platform config cannot be the default address
	#[error("Platform config cannot be the default address")]
	InvalidPlatformConfig = 0x177C,
	/// 7000 - Program is paused
	#[error("Program is paused")]
	ProgramPaused = 0x1B58,
	/// 7001 - Unauthorized
	#[error("Unauthorized")]
	Unauthorized = 0x1B59,
	/// 7002 - Arithmetic overflow
	#[error("Arithmetic overflow")]
	ArithmeticOverflow = 0x1B5A,
	/// 7003 - Invalid Pyth price account
	#[error("Invalid Pyth price account")]
	InvalidPythAccount = 0x1B5B,
	/// 7004 - Invalid Pyth feed ID
	#[error("Invalid Pyth feed ID")]
	InvalidPythFeed = 0x1B5C,
	/// 7005 - Invalid slug: must be non-empty, <= max_len bytes, lowercase alphanumeric or underscore
	#[error(
		"Invalid slug: must be non-empty, <= max_len bytes, lowercase alphanumeric or underscore"
	)]
	InvalidSlug = 0x1B5D,
	/// 7006 - Text too long
	#[error("Text too long")]
	TextTooLong = 0x1B5E,
	/// 7007 - User token account owned by the wrong token program
	#[error("User token account owned by the wrong token program")]
	UserTokenAccountWrongProgram = 0x1B5F,
	/// 7008 - User token account is not an initialized token account
	#[error("User token account is not an initialized token account")]
	UserTokenAccountInvalid = 0x1B60,
	/// 7009 - User token account mint does not match the trade
	#[error("User token account mint does not match the trade")]
	UserTokenAccountWrongMint = 0x1B61,
	/// 7010 - User token account is not owned by the trading user
	#[error("User token account is not owned by the trading user")]
	UserTokenAccountWrongAuthority = 0x1B62,
	/// 7011 - Nothing to claim
	#[error("Nothing to claim")]
	NothingToClaim = 0x1B63,
	/// 7012 - Unused
	#[error("Unused")]
	Unused7012 = 0x1B64,
	/// 7013 - Quote mint has no USDC price on its nexus reward state
	#[error("Quote mint has no USDC price on its nexus reward state")]
	QuoteMintPriceUnset = 0x1B65,
	/// 7014 - Token-2022 transfer fee schedule cannot settle the exact amount
	#[error("Token-2022 transfer fee schedule cannot settle the exact amount")]
	TransferFeeNotSettleable = 0x1B66,
	/// 7015 - Creator fee exceeds the partner's maximum
	#[error("Creator fee exceeds the partner's maximum")]
	CreatorFeeTooHigh = 0x1B67,
	/// 7016 - Creator fee mode is not allowed by the partner config
	#[error("Creator fee mode is not allowed by the partner config")]
	CreatorFeeModeNotAllowed = 0x1B68,
	/// 7100 - Insufficient liquidity
	#[error("Insufficient liquidity")]
	InsufficientLiquidity = 0x1BBC,
	/// 7101 - Invalid amount
	#[error("Invalid amount")]
	InvalidAmount = 0x1BBD,
}

impl From<SendDexError> for solana_program::program_error::ProgramError {
	fn from(e: SendDexError) -> Self {
		solana_program::program_error::ProgramError::Custom(e as u32)
	}
}