pub enum SwapError {
Show 29 variants
AlreadyInUse,
InvalidProgramAddress,
InvalidOwner,
InvalidOutputOwner,
ExpectedMint,
ExpectedAccount,
EmptySupply,
InvalidSupply,
InvalidDelegate,
InvalidInput,
IncorrectSwapAccount,
IncorrectPoolMint,
InvalidOutput,
CalculationFailure,
InvalidInstruction,
RepeatedMint,
ExceededSlippage,
InvalidCloseAuthority,
InvalidFreezeAuthority,
IncorrectFeeAccount,
ZeroTradingTokens,
FeeCalculationFailure,
ConversionFailure,
InvalidFee,
IncorrectTokenProgramId,
UnsupportedCurveType,
InvalidCurve,
UnsupportedCurveOperation,
InvalidFeeAccount,
}Expand description
Errors that may be returned by the TokenSwap program.
Variants§
AlreadyInUse
The account cannot be initialized because it is already being used.
InvalidProgramAddress
The program address provided doesn’t match the value generated by the program.
InvalidOwner
The owner of the input isn’t set to the program address generated by the program.
InvalidOutputOwner
The owner of the pool token output is set to the program address generated by the program.
ExpectedMint
The deserialization of the account returned something besides State::Mint.
ExpectedAccount
The deserialization of the account returned something besides State::Account.
EmptySupply
The input token account is empty.
InvalidSupply
The pool token mint has a non-zero supply.
InvalidDelegate
The provided token account has a delegate.
InvalidInput
The input token is invalid for swap.
IncorrectSwapAccount
Address of the provided swap token account is incorrect.
IncorrectPoolMint
Address of the provided pool token mint is incorrect
InvalidOutput
The output token is invalid for swap.
CalculationFailure
General calculation failure due to overflow or underflow
InvalidInstruction
Invalid instruction number passed in.
RepeatedMint
Swap input token accounts have the same mint
ExceededSlippage
Swap instruction exceeds desired slippage limit
InvalidCloseAuthority
The provided token account has a close authority.
InvalidFreezeAuthority
The pool token mint has a freeze authority.
IncorrectFeeAccount
The pool fee token account is incorrect
ZeroTradingTokens
Given pool token amount results in zero trading tokens
FeeCalculationFailure
The fee calculation failed due to overflow, underflow, or unexpected 0
ConversionFailure
ConversionFailure
InvalidFee
The provided fee does not match the program owner’s constraints
IncorrectTokenProgramId
The provided token program does not match the token program expected by the swap
UnsupportedCurveType
The provided curve type is not supported by the program owner
InvalidCurve
The provided curve parameters are invalid
UnsupportedCurveOperation
The operation cannot be performed on the given curve
InvalidFeeAccount
The pool fee account is invalid.
Trait Implementations§
Source§impl<T> DecodeError<T> for SwapError
impl<T> DecodeError<T> for SwapError
fn type_of() -> &'static str
fn decode_custom_error_to_enum(custom: u32) -> Option<E>where
E: FromPrimitive,
Source§impl Error for SwapError
impl Error for SwapError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
Source§impl From<SwapError> for ProgramError
impl From<SwapError> for ProgramError
Source§impl FromPrimitive for SwapError
impl FromPrimitive for SwapError
Source§fn from_i64(n: i64) -> Option<Self>
fn from_i64(n: i64) -> Option<Self>
i64 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_u64(n: u64) -> Option<Self>
fn from_u64(n: u64) -> Option<Self>
u64 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_isize(n: isize) -> Option<Self>
fn from_isize(n: isize) -> Option<Self>
isize to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_i8(n: i8) -> Option<Self>
fn from_i8(n: i8) -> Option<Self>
i8 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_i16(n: i16) -> Option<Self>
fn from_i16(n: i16) -> Option<Self>
i16 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_i32(n: i32) -> Option<Self>
fn from_i32(n: i32) -> Option<Self>
i32 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_i128(n: i128) -> Option<Self>
fn from_i128(n: i128) -> Option<Self>
i128 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned. Read moreSource§fn from_usize(n: usize) -> Option<Self>
fn from_usize(n: usize) -> Option<Self>
usize to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_u8(n: u8) -> Option<Self>
fn from_u8(n: u8) -> Option<Self>
u8 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_u16(n: u16) -> Option<Self>
fn from_u16(n: u16) -> Option<Self>
u16 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_u32(n: u32) -> Option<Self>
fn from_u32(n: u32) -> Option<Self>
u32 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned.Source§fn from_u128(n: u128) -> Option<Self>
fn from_u128(n: u128) -> Option<Self>
u128 to return an optional value of this type. If the
value cannot be represented by this type, then None is returned. Read moreimpl Eq for SwapError
impl StructuralPartialEq for SwapError
Auto Trait Implementations§
impl Freeze for SwapError
impl RefUnwindSafe for SwapError
impl Send for SwapError
impl Sync for SwapError
impl Unpin for SwapError
impl UnwindSafe for SwapError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more