ai-agent-bitcoin-escrow 0.1.0

A Rust library for AI agents to create, manage, and execute Bitcoin escrow contracts using multisig
Documentation
//! Error types for the AI Agent Bitcoin Escrow Library.

use thiserror::Error;

/// Main error type for the escrow library.
#[derive(Error, Debug)]
pub enum EscrowError {
    /// Error related to Bitcoin operations.
    #[error("Bitcoin error: {0}")]
    Bitcoin(#[from] bitcoin::consensus::encode::Error),

    /// Error related to key operations.
    #[error("Key error: {0}")]
    Key(String),

    /// Error related to multisig operations.
    #[error("Multisig error: {0}")]
    Multisig(String),

    /// Error related to escrow contract operations.
    #[error("Escrow contract error: {0}")]
    Contract(String),

    /// Error related to condition evaluation.
    #[error("Condition error: {0}")]
    Condition(String),

    /// Error related to oracle operations.
    #[error("Oracle error: {0}")]
    Oracle(String),

    /// Error related to audit logging.
    #[error("Audit error: {0}")]
    Audit(String),

    /// Error related to transaction operations.
    #[error("Transaction error: {0}")]
    Transaction(String),

    /// Error related to signing operations.
    #[error("Signing error: {0}")]
    Signing(String),

    /// Error related to descriptor operations.
    #[error("Descriptor error: {0}")]
    Descriptor(String),

    /// Invalid state for the requested operation.
    #[error("Invalid state: {0}")]
    InvalidState(String),

    /// Missing required data.
    #[error("Missing data: {0}")]
    MissingData(String),

    /// Serialization/deserialization error.
    #[error("Serialization error: {0}")]
    Serialization(#[from] serde_json::Error),

    /// IO error.
    #[error("IO error: {0}")]
    Io(#[from] std::io::Error),

    /// BDK wallet error.
    #[error("Wallet error: {0}")]
    Wallet(String),

    /// Generic error with message.
    #[error("{0}")]
    Other(String),
}

/// Result type alias for escrow operations.
pub type Result<T> = std::result::Result<T, EscrowError>;