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 SendNexusError {
	/// 6000 - Insufficient stake balance
	#[error("Insufficient stake balance")]
	InsufficientStake = 0x1770,
	/// 6001 - Invalid reward mint
	#[error("Invalid reward mint")]
	InvalidRewardMint = 0x1771,
	/// 6002 - Invalid vault
	#[error("Invalid vault")]
	InvalidVault = 0x1772,
	/// 6005 - Staking already enabled
	#[error("Staking already enabled")]
	StakingAlreadyEnabled = 0x1775,
	/// 6006 - Staking not enabled
	#[error("Staking not enabled")]
	StakingNotEnabled = 0x1776,
	/// 6007 - Invalid staking mint
	#[error("Invalid staking mint")]
	InvalidStakingMint = 0x1777,
	/// 6008 - Invalid reward state
	#[error("Invalid reward state")]
	InvalidRewardState = 0x1778,
	/// 6009 - Invalid mint
	#[error("Invalid mint")]
	InvalidMint = 0x1779,
	/// 6010 - Invalid destination account
	#[error("Invalid destination account")]
	InvalidDestination = 0x177A,
	/// 6011 - Staking mint already bound
	#[error("Staking mint already bound")]
	StakingMintAlreadyBound = 0x177B,
	/// 6012 - Invalid fee configuration
	#[error("Invalid fee configuration")]
	InvalidFeePreset = 0x177C,
	/// 6013 - Invalid preset index
	#[error("Invalid preset index")]
	InvalidPresetIndex = 0x177D,
	/// 6014 - Must provide either fee_preset or custom fees
	#[error("Must provide either fee_preset or custom fees")]
	MissingFeeSource = 0x177E,
	/// 6015 - Cannot specify both fee_preset and custom_fees
	#[error("Cannot specify both fee_preset and custom_fees")]
	AmbiguousFeeSource = 0x177F,
	/// 6016 - Partner name cannot be empty
	#[error("Partner name cannot be empty")]
	InvalidPartnerName = 0x1780,
	/// 6017 - Partner account does not use this preset
	#[error("Partner account does not use this preset")]
	PartnerNotOnPreset = 0x1781,
	/// 6018 - Invalid partner note
	#[error("Invalid partner note")]
	InvalidPartnerNote = 0x1782,
	/// 6019 - Invalid preset name
	#[error("Invalid preset name")]
	InvalidPresetName = 0x1783,
	/// 6020 - Too many auth platforms (max 255)
	#[error("Too many auth platforms (max 255)")]
	TooManyAuthPlatforms = 0x1784,
	/// 6021 - Invalid auth platform index
	#[error("Invalid auth platform index")]
	InvalidAuthPlatformIndex = 0x1785,
	/// 6022 - Invalid auth platform name
	#[error("Invalid auth platform name")]
	InvalidAuthPlatformName = 0x1786,
	/// 6023 - Duplicate auth platform name
	#[error("Duplicate auth platform name")]
	DuplicateAuthPlatformName = 0x1787,
	/// 6024 - Invalid authority
	#[error("Invalid authority")]
	InvalidAuthority = 0x1788,
	/// 6025 - Cannot add the default partner
	#[error("Cannot add the default partner")]
	ReservedPartner = 0x1789,
	/// 6026 - Invalid reward accrual
	#[error("Invalid reward accrual")]
	InvalidRewardAccrual = 0x178A,
	/// 6027 - Settle every reward mint before staking or unstaking - call settle for each registered mint
	#[error(
		"Settle every reward mint before staking or unstaking - call settle for each registered mint"
	)]
	RewardsNotSettled = 0x178B,
	/// 6028 - USDC price must be non-zero - 0 means no price
	#[error("USDC price must be non-zero - 0 means no price")]
	InvalidUsdcPrice = 0x178C,
	/// 6029 - Platform config cannot be the default address
	#[error("Platform config cannot be the default address")]
	InvalidPlatformConfig = 0x178D,
	/// 6030 - Partner config address does not match its stored seeds
	#[error("Partner config address does not match its stored seeds")]
	InvalidPartnerConfig = 0x178E,
	/// 6031 - Fee preset belongs to a different platform
	#[error("Fee preset belongs to a different platform")]
	PresetPlatformMismatch = 0x178F,
	/// 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<SendNexusError> for solana_program::program_error::ProgramError {
	fn from(e: SendNexusError) -> Self {
		solana_program::program_error::ProgramError::Custom(e as u32)
	}
}