sendfun_sdk/nexus/generated/errors/
send_nexus.rs1#![allow(
2 clippy::all,
3 clippy::pedantic,
4 clippy::nursery,
5 clippy::expect_used,
6 clippy::unwrap_used,
7 clippy::indexing_slicing,
8 clippy::allow_attributes,
9 clippy::allow_attributes_without_reason,
10 clippy::mem_forget,
11 unfulfilled_lint_expectations,
12 unexpected_cfgs,
13 unused_imports
14)]
15
16use num_derive::FromPrimitive;
24use thiserror::Error;
25
26#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
27pub enum SendNexusError {
28 #[error("Insufficient stake balance")]
30 InsufficientStake = 0x1770,
31 #[error("Invalid reward mint")]
33 InvalidRewardMint = 0x1771,
34 #[error("Invalid vault")]
36 InvalidVault = 0x1772,
37 #[error("Staking already enabled")]
39 StakingAlreadyEnabled = 0x1775,
40 #[error("Staking not enabled")]
42 StakingNotEnabled = 0x1776,
43 #[error("Invalid staking mint")]
45 InvalidStakingMint = 0x1777,
46 #[error("Invalid reward state")]
48 InvalidRewardState = 0x1778,
49 #[error("Invalid mint")]
51 InvalidMint = 0x1779,
52 #[error("Invalid destination account")]
54 InvalidDestination = 0x177A,
55 #[error("Staking mint already bound")]
57 StakingMintAlreadyBound = 0x177B,
58 #[error("Invalid fee configuration")]
60 InvalidFeePreset = 0x177C,
61 #[error("Invalid preset index")]
63 InvalidPresetIndex = 0x177D,
64 #[error("Must provide either fee_preset or custom fees")]
66 MissingFeeSource = 0x177E,
67 #[error("Cannot specify both fee_preset and custom_fees")]
69 AmbiguousFeeSource = 0x177F,
70 #[error("Partner name cannot be empty")]
72 InvalidPartnerName = 0x1780,
73 #[error("Partner account does not use this preset")]
75 PartnerNotOnPreset = 0x1781,
76 #[error("Invalid partner note")]
78 InvalidPartnerNote = 0x1782,
79 #[error("Invalid preset name")]
81 InvalidPresetName = 0x1783,
82 #[error("Too many auth platforms (max 255)")]
84 TooManyAuthPlatforms = 0x1784,
85 #[error("Invalid auth platform index")]
87 InvalidAuthPlatformIndex = 0x1785,
88 #[error("Invalid auth platform name")]
90 InvalidAuthPlatformName = 0x1786,
91 #[error("Duplicate auth platform name")]
93 DuplicateAuthPlatformName = 0x1787,
94 #[error("Invalid authority")]
96 InvalidAuthority = 0x1788,
97 #[error("Cannot add the default partner")]
99 ReservedPartner = 0x1789,
100 #[error("Invalid reward accrual")]
102 InvalidRewardAccrual = 0x178A,
103 #[error(
105 "Settle every reward mint before staking or unstaking - call settle for each registered mint"
106 )]
107 RewardsNotSettled = 0x178B,
108 #[error("USDC price must be non-zero - 0 means no price")]
110 InvalidUsdcPrice = 0x178C,
111 #[error("Platform config cannot be the default address")]
113 InvalidPlatformConfig = 0x178D,
114 #[error("Partner config address does not match its stored seeds")]
116 InvalidPartnerConfig = 0x178E,
117 #[error("Fee preset belongs to a different platform")]
119 PresetPlatformMismatch = 0x178F,
120 #[error("Program is paused")]
122 ProgramPaused = 0x1B58,
123 #[error("Unauthorized")]
125 Unauthorized = 0x1B59,
126 #[error("Arithmetic overflow")]
128 ArithmeticOverflow = 0x1B5A,
129 #[error("Invalid Pyth price account")]
131 InvalidPythAccount = 0x1B5B,
132 #[error("Invalid Pyth feed ID")]
134 InvalidPythFeed = 0x1B5C,
135 #[error(
137 "Invalid slug: must be non-empty, <= max_len bytes, lowercase alphanumeric or underscore"
138 )]
139 InvalidSlug = 0x1B5D,
140 #[error("Text too long")]
142 TextTooLong = 0x1B5E,
143 #[error("User token account owned by the wrong token program")]
145 UserTokenAccountWrongProgram = 0x1B5F,
146 #[error("User token account is not an initialized token account")]
148 UserTokenAccountInvalid = 0x1B60,
149 #[error("User token account mint does not match the trade")]
151 UserTokenAccountWrongMint = 0x1B61,
152 #[error("User token account is not owned by the trading user")]
154 UserTokenAccountWrongAuthority = 0x1B62,
155 #[error("Nothing to claim")]
157 NothingToClaim = 0x1B63,
158 #[error("Creator identity is not a decodable wallet address")]
160 InvalidCreatorId = 0x1B64,
161 #[error("Quote mint has no USDC price on its nexus reward state")]
163 QuoteMintPriceUnset = 0x1B65,
164 #[error("Token-2022 transfer fee schedule cannot settle the exact amount")]
166 TransferFeeNotSettleable = 0x1B66,
167 #[error("Insufficient liquidity")]
169 InsufficientLiquidity = 0x1BBC,
170 #[error("Invalid amount")]
172 InvalidAmount = 0x1BBD,
173}
174
175impl From<SendNexusError> for solana_program::program_error::ProgramError {
176 fn from(e: SendNexusError) -> Self {
177 solana_program::program_error::ProgramError::Custom(e as u32)
178 }
179}