sendfun-sdk 2.0.1

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 SendLaunchpadError {
	/// 6000 - Token creation is disabled
	#[error("Token creation is disabled")]
	TokenCreationDisabled = 0x1770,
	/// 6001 - Slippage tolerance exceeded
	#[error("Slippage tolerance exceeded")]
	SlippageExceeded = 0x1771,
	/// 6002 - Already migrated
	#[error("Already migrated")]
	AlreadyMigrated = 0x1772,
	/// 6003 - Migration threshold not reached
	#[error("Migration threshold not reached")]
	ThresholdNotReached = 0x1773,
	/// 6004 - Migration threshold reached - trading disabled until migration completes
	#[error(
		"Migration threshold reached - trading disabled until migration completes"
	)]
	ThresholdReached = 0x1774,
	/// 6005 - Invalid base mint
	#[error("Invalid base mint")]
	InvalidBaseMint = 0x1775,
	/// 6006 - Invalid quote mint
	#[error("Invalid quote mint")]
	InvalidQuoteMint = 0x1776,
	/// 6007 - Bonding curve is not tradeable
	#[error("Bonding curve is not tradeable")]
	NotTradeable = 0x1777,
	/// 6008 - Invalid status transition
	#[error("Invalid status transition")]
	InvalidStatusTransition = 0x1778,
	/// 6009 - Curve is live
	#[error("Curve is live")]
	CurveIsLive = 0x1779,
	/// 6010 - Base mint not found
	#[error("Base mint not found")]
	BaseMintNotFound = 0x177A,
	/// 6011 - Blocked by held supply
	#[error("Blocked by held supply")]
	BlockedByHeldSupply = 0x177B,
	/// 6012 - Invalid coin creator
	#[error("Invalid coin creator")]
	InvalidCoinCreator = 0x177C,
	/// 6013 - Invalid authority
	#[error("Invalid authority")]
	InvalidAuthority = 0x177D,
	/// 6014 - Insufficient balance in source account
	#[error("Insufficient balance in source account")]
	InsufficientBalance = 0x177E,
	/// 6015 - Pool has unclaimed protocol or creator fees
	#[error("Pool has unclaimed protocol or creator fees")]
	PoolFeesOutstanding = 0x177F,
	/// 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 - Creator identity is not a decodable wallet address
	#[error("Creator identity is not a decodable wallet address")]
	InvalidCreatorId = 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,
	/// 7100 - Insufficient liquidity
	#[error("Insufficient liquidity")]
	InsufficientLiquidity = 0x1BBC,
	/// 7101 - Invalid amount
	#[error("Invalid amount")]
	InvalidAmount = 0x1BBD,
}

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