#[derive(thiserror::Error, Debug)]
#[non_exhaustive]
pub enum AddressError {
#[error("invalid prefix byte: expected 0x41, got 0x{0:02x}")]
BadPrefix(u8),
#[error("bad length: expected {expected} bytes, got {got}")]
BadLength {
expected: usize,
got: usize,
},
#[error("base58 decode failed: {0}")]
Base58(#[from] bs58::decode::Error),
#[error("hex decode failed: {0}")]
Hex(#[from] hex::FromHexError),
}
#[derive(thiserror::Error, Debug)]
#[non_exhaustive]
pub enum AmountError {
#[error("negative amount is invalid: {0} sun")]
Negative(i64),
#[error("amount out of range: {0} TRX cannot be represented in sun")]
OutOfRange(f64),
}
#[derive(thiserror::Error, Debug)]
#[non_exhaustive]
pub enum SignatureError {
#[error("bad signature length: expected 65 bytes, got {0}")]
BadLength(usize),
#[error("invalid recovery id: {0}")]
BadRecoveryId(u8),
#[error("ecdsa error: {0}")]
Ecdsa(#[from] k256::ecdsa::Error),
}