//! # Nad.fun SDK
//!
//! A simple and efficient Rust SDK for Nad.fun trading and event monitoring.
//!
//! ## Core Features
//!
//! - **Trading**: Buy/sell tokens with automatic routing (bonding curve ↔ DEX)
//! - **Event Streaming**: Real-time streaming and historical indexing
//! - **Simple API**: Two main modules - `Core` for trading, `stream` for events
//!
//! ## Quick Start
//!
//! ```rust,ignore
//! use nadfun_sdk::{Core, Network};
//! use alloy::primitives::{Address, U256};
//!
//! #[tokio::main]
//! async fn main() -> anyhow::Result<()> {
//!     // Initialize Core - set network once, used everywhere
//!     let core = Core::new(
//!         "https://your-rpc-url".to_string(),
//!         "your-private-key".to_string(),
//!         Network::Mainnet
//!     ).await?;
//!
//!     // Get quote and execute trade
//!     let (router, amount_out) = core.get_amount_out(token, mon_amount, true).await?;
//!
//!     // Execute buy - returns tx_hash immediately (fast!)
//!     let tx_hash = core.buy(buy_params, router).await?;
//!     println!("Transaction submitted: {}", tx_hash);
//!
//!     // Optionally check receipt later
//!     let receipt = core.get_receipt(tx_hash).await?;
//!     println!("Confirmed: {}", receipt.status);
//!
//!     Ok(())
//! }
//! ```

/// Constants and contract addresses for the Nad.fun ecosystem
///
/// Contains all contract addresses, fee tiers, and other system constants.
/// These are automatically used by the SDK but can be accessed directly if needed.
pub mod constants;

/// Core trading functionality including buy/sell operations and slippage calculations
///
/// Provides the main trading interface (`Core`) for buying/selling tokens with
/// automatic routing between bonding curves and DEX pools. Also includes slippage
/// calculation utilities (`SlippageUtils`) for precise trade protection.
pub mod core;

/// Token creation functionality
///
/// Provides complete token creation flow including image upload, metadata creation,
/// salt generation, and on-chain token deployment.
pub mod create;

/// Token interaction utilities for ERC-20 operations
///
/// Contains comprehensive token helper utilities (`TokenHelper`) for metadata
/// retrieval, balance checking, and approval management including EIP-2612 permit
/// signatures for gasless approvals.
pub mod token;

/// Real-time event streaming and historical data indexing
///
/// Provides both WebSocket-based real-time event streaming and HTTP-based historical
/// event indexing for bonding curve and DEX events. Supports advanced filtering by
/// event types, tokens, and custom criteria with optimized batch processing.
pub mod stream;

/// Type definitions for events, trading parameters, and API responses
///
/// Contains all structured data types used throughout the SDK including event
/// definitions (bonding curve events, swap events), trading parameters (buy/sell),
/// and response types (transaction results, token metadata).
pub mod types;

/// Internal contract interface definitions (not directly exposed to users)
///
/// Contains low-level contract bindings and pool discovery logic. These are used
/// internally by the public API but hidden from end users for simplicity.
pub(crate) mod contracts;

// Pool discovery is still useful for advanced users
pub use contracts::{PoolDiscovery, get_pool_addresses_for_tokens};
pub use stream::{
    BondingCurveEvent, CurveIndexer, CurveStream, DexIndexer, DexStream, EventType, PoolMetadata,
    SwapEvent,
};
pub use create::TokenCreationClient;
pub use token::TokenHelper;
pub use constants::{Network, set_network, get_current_network};
pub use core::{SlippageUtils, Core, Router, estimate_gas, GasEstimationParams};
pub use types::*;

/// Convenient prelude module for importing commonly used types and functions
///
/// Import this module to get quick access to all the most frequently used SDK components:
///
/// ```rust
/// use nadfun_sdk::prelude::*;
///
/// // Now you have access to Core, CurveStream, EventType, Address, U256, etc.
/// ```
///
/// This saves you from having to import each type individually and provides
/// a standardized way to get started with the SDK quickly.
pub mod prelude {
    // Core trading functionality
    pub use crate::core::{SlippageUtils, Core, Router, estimate_gas, GasEstimationParams};

    // Token creation
    pub use crate::create::TokenCreationClient;

    // Token operations
    pub use crate::token::TokenHelper;

    // Event streaming and indexing
    pub use crate::stream::{BondingCurveEvent, CurveIndexer, CurveStream, EventType};
    pub use crate::stream::{DexIndexer, DexStream, PoolMetadata, SwapEvent};

    // Pool discovery utilities
    pub use crate::contracts::{PoolDiscovery, get_pool_addresses_for_tokens};

    // Constants and types
    pub use crate::constants::{Network, set_network, get_current_network};
    pub use crate::types::*;

    // Common Alloy primitives
    pub use alloy::primitives::{Address, B256, U256};
}
