use thiserror::Error;
#[derive(Debug, Error)]
pub enum Error {
#[error("invalid Solana instruction: {0}")]
InvalidSolanaInstruction(&'static str),
#[error("legacy Bulk withdrawal actions are unsupported; use solana::request_withdraw to build a Solana withdrawal intent")]
LegacyWithdrawal,
#[error("invalid base58: {0}")]
InvalidBase58(String),
#[error("invalid key length: expected {expected}, got {got}")]
InvalidKeyLength { expected: usize, got: usize },
#[error("keypair public key does not match its secret key")]
InvalidKeypair,
#[error("invalid hash length: expected 32 bytes, got {0}")]
InvalidHashLength(usize),
#[error("invalid signature length: expected 64 bytes, got {0}")]
InvalidSignatureLength(usize),
#[error("invalid signature domain '{0}'; expected mainnet, testnet, or devnet")]
InvalidSignatureDomain(String),
#[error("invalid nonce '{0}'; expected an unsigned 64-bit decimal string")]
InvalidNonce(String),
#[error("signing failed: {0}")]
SigningFailed(String),
#[error("orders array cannot be empty")]
EmptyOrders,
#[error("signature count mismatch: expected {expected}, got {got}")]
SignatureMismatch { expected: usize, got: usize },
#[error("invalid order: {0}")]
InvalidOrder(String),
#[error("serialization error: {0}")]
SerializationError(String),
#[error("json error: {0}")]
JsonError(#[from] serde_json::Error),
}
pub type Result<T> = std::result::Result<T, Error>;