/**
 * Contract Manager Module
 *
 * Responsible for:
 * - Managing contract instances and their lifecycle
 * - Providing typed contract interfaces
 * - Handling contract address resolution
 * - Managing provider/signer connections
 *
 * This module centralizes all contract interaction setup and provides
 * a clean interface for other modules to access contracts.
 */
import { type Provider, type Signer } from "ethers";
import type { ContractAddresses } from "../../interfaces/chunks/config.i";
import { type DeploymentContracts } from "../../constants/chunks/deployment-addresses";
import { Result } from "../../types/result";
import { SDKError } from "../../utils/error-handler";
import type { PositionManager, ILoanOperationsManager, IUCDController, IPriceFeedConsumer, ITermManager, CircuitBreakerModule, ILiquidationManager } from "../../interfaces/chunks/contract-types.i";
/**
 * Type alias for ethers v6 provider (used throughout SDK)
 */
export type { Provider };
/**
 * Type alias for ethers v6 signer
 */
export type { Signer };
/**
 * Type alias for contract runner (provider or signer)
 */
export type ContractRunner = Provider | Signer;
/**
 * Configuration for Contract Manager
 */
export interface ContractManagerConfig {
    /** Ethers v5 provider for reading blockchain data */
    provider: Provider;
    /** Ethers v5 signer for writing transactions (optional) */
    signer?: Signer;
    /** Contract addresses for the target network */
    contractAddresses: ContractAddresses;
    /** SDK mode: 'service' or 'standalone' */
    mode?: "service" | "standalone";
    /** Enable debug logging */
    debug?: boolean;
    /** Network name (e.g. "sepolia", "localhost") for deployment address lookup */
    networkName?: string;
}
/**
 * Managed contract instances with proper typing
 */
export interface ManagedContracts {
    positionManager: PositionManager;
    loanOperationsManager: ILoanOperationsManager;
    ucdController: IUCDController;
    priceFeed: IPriceFeedConsumer;
    termManager: ITermManager;
    circuitBreaker: CircuitBreakerModule;
    liquidationManager: ILiquidationManager;
}
/**
 * Contract Manager Module
 *
 * Centralized contract instance management with proper typing
 */
export declare class ContractManager {
    private readonly config;
    private contracts;
    constructor(config: ContractManagerConfig);
    /**
     * Initialize all contract instances
     *
     * This is called lazily on first access to any contract
     */
    private initializeContracts;
    /**
     * Validate that all required contract addresses are present and valid
     */
    private validateContractAddresses;
    /**
     * Get all managed contract instances
     */
    getContracts(): Result<ManagedContracts, SDKError>;
    /**
     * Get Position Manager contract
     */
    getPositionManager(): Result<PositionManager, SDKError>;
    /**
     * Get Loan Operations Manager contract
     */
    getLoanOperationsManager(): Result<ILoanOperationsManager, SDKError>;
    /**
     * Get UCD Controller contract
     */
    getUCDController(): Result<IUCDController, SDKError>;
    /**
     * Get Price Feed contract
     */
    getPriceFeed(): Result<IPriceFeedConsumer, SDKError>;
    /**
     * Get Term Manager contract
     */
    getTermManager(): Result<ITermManager, SDKError>;
    /**
     * Get Circuit Breaker contract
     */
    getCircuitBreaker(): Result<CircuitBreakerModule, SDKError>;
    /**
     * Get Liquidation Manager contract
     */
    getLiquidationManager(): Result<ILiquidationManager, SDKError>;
    /**
     * Get the provider instance
     */
    getProvider(): Provider;
    /**
     * Get the signer instance (if available)
     */
    getSigner(): Result<Signer, SDKError>;
    /**
     * Check if a signer is available for write operations
     */
    hasSigner(): boolean;
    /**
     * Get contract addresses
     */
    getContractAddresses(): ContractAddresses;
    /**
     * Get the full deployment map for the configured network.
     * Returns all deployed contracts (including admin-surface ones not needed at runtime),
     * keyed by PascalCase contract name matching the deployment JSON.
     * Returns null if the network name is unknown.
     */
    getDeploymentAddresses(): DeploymentContracts | null;
    /**
     * Get the network chain ID from the provider
     */
    getChainId(): Promise<Result<number, SDKError>>;
    /**
     * Verify that the provider is connected and responsive
     */
    verifyConnection(): Promise<Result<boolean, SDKError>>;
}
/**
 * Factory function to create a ContractManager instance
 */
export declare function createContractManager(config: ContractManagerConfig): Result<ContractManager, SDKError>;
