/**
 * SDK Configuration Interfaces
 */
import type { Wallet, Signer, Provider } from "ethers";
import { LitNetwork } from "@gvnrdao/dh-lit-ops";
export type SDKMode = "standalone" | "service";
/**
 * Contract Addresses Configuration
 */
export interface ContractAddresses {
    positionManager: string;
    positionManagerCore?: string;
    positionManagerViews?: string;
    simplePsmV2?: string;
    loanOperationsManager?: string;
    termManager?: string;
    collateralManager?: string;
    ucdController?: string;
    circuitBreaker?: string;
    liquidationManager?: string;
    ucdToken: string;
    /** Optional when priceProviders is used (LIT actions fetch prices) */
    priceFeedConsumer?: string;
    operationAuthorizationRegistry?: string;
    btcProofValidator?: string;
    litActionValidator?: string;
    /** BTCSpendAuthorizer proxy; required in dev for lit-actions `BtcSpendAuth` when passed via `contractAddresses`. */
    btcSpendAuthorizer?: string;
    /** BitcoinProviderRegistry proxy; required on non-hardhat chains when chain policy disallows arbitrary providers. */
    bitcoinProviderRegistry?: string;
    /** ContractVersionRegistry proxy; used for cross-contract version pinning. */
    contractVersionRegistry?: string;
    /** FeeRecipientRegistry proxy; M-8 fix — allowlist consulted by LoanOperationsManager.transferFee and SimplePSMV2.transferFee. */
    feeRecipientRegistry?: string;
    /** PositionDelegateRegistry proxy; consumed by LIT Action authorization verifier as the third recovery arm for Safe-as-borrower flows. */
    positionDelegateRegistry?: string;
    mockUsdcToken?: string;
    mockUsdcOwner?: string;
    mockUsdtToken?: string;
    mockUsdtOwner?: string;
}
/**
 * Base configuration shared by all SDK modes
 */
interface BaseSDKConfig {
    litNetwork?: LitNetwork;
    contractSigner?: Wallet | Signer;
    /**
     * Optional signer used exclusively for EIP-712 server-session login.
     * When provided, `ServerSession` uses this instead of `contractSigner` so
     * the two concerns (auth identity vs on-chain msg.sender) can differ. In
     * Safe mode the CLI passes the raw agent EOA here while `contractSigner`
     * is a SafeModuleSignerAdapter that routes transactions through the module.
     */
    authSigner?: Wallet | Signer;
    ethRpcUrl?: string;
    chainId?: number;
    networkOverride?: {
        chainId: number;
        name: string;
    };
    provider?: Provider;
    chain?: string;
    bitcoinNetwork?: "mainnet" | "testnet" | "regtest";
    litActionCid?: string;
    litNodeConnectTimeoutMs?: number;
    subgraphUrl?: string;
    priceProviders?: PriceProviderConfig[];
    /** PKP Ethereum address for signed price oracle (Lit jsParams pkpId); optional */
    priceOraclePkpId?: string;
    bitcoinFaucetUrl?: string;
    contractAddresses?: ContractAddresses;
    subgraphs?: {
        tokenGvnrUrl?: string;
        diamondHandsUrl?: string;
    };
    graphApiKey?: string;
    graphOptions?: {
        requestTimeoutMs?: number;
        maxRetries?: number;
        pageSize?: number;
    };
    mockUsdcTokenAddress?: string;
    mockUsdcOwnerAddress?: string;
    mockUsdcDecimals?: number;
    mockUsdtTokenAddress?: string;
    mockUsdtOwnerAddress?: string;
    mockUsdtDecimals?: number;
    ucdTokenAddress?: string;
    sessionExpirationMinutes?: number;
    transactionTimeoutMs?: number;
    retryAttempts?: number;
    debug?: boolean;
    /** Notification label for server Telegram notifications. Default: "DH SDK". Set "DH APP" in the web app. */
    callerLabel?: string;
    /**
     * Optional: Override quantum timing buffer (in seconds)
     * Default: Auto-detected based on network (10s for local, 50s for Sepolia, 35s for mainnet)
     *
     * Network-specific defaults:
     * - Local networks (1337, 31337): 10s
     * - Testnets (Sepolia 11155111, Goerli 5): 45-50s
     * - Mainnet (1): 35s
     *
     * Only override if you have specific latency requirements.
     * Recommended: Leave undefined to use automatic network detection.
     */
    quantumBufferSeconds?: number;
    /**
     * @deprecated No longer read. On Sepolia (11155111), when `eth_estimateGas` fails for
     * `mintUCD` but a static `eth_call` succeeds, the SDK always broadcasts with a fixed
     * gas ceiling (EIP-1559). Retained for backward-compatible configs.
     */
    skipGasEstimation?: boolean;
    pkpServiceTimeoutMs?: number;
    pkpServiceRetryCount?: number;
    pkpServiceRetryDelayMs?: number;
    balanceCacheOptions?: {
        enabled?: boolean;
        ttlMs?: number;
        maxSize?: number;
    };
    addressCacheOptions?: {
        enabled?: boolean;
        ttlMs?: number;
        maxSize?: number;
        debug?: boolean;
    };
    concurrencyOptions?: {
        enabled?: boolean;
        concurrency?: number;
        timeout?: number;
        debug?: boolean;
    };
    loggingOptions?: {
        enabled?: boolean;
        level?: "debug" | "info" | "warn" | "error";
        includeTimestamp?: boolean;
        includeContext?: boolean;
        maxContextKeys?: number;
        verboseInProduction?: boolean;
    };
    validators?: {
        /** Validator version for position creation (createPosition) - usually v1 for PKP security validation */
        loanCreation: number;
        /** Validator version for UCD minting (mintUCD) - usually v4 for business rules validation */
        minting: number;
        /** Validator version for partial payments (makePayment) - usually v1 for payment validation */
        payment: number;
        /** Validator version for loan extension/renewal (extendPosition) - usually v4 for extension validation */
        extension: number;
    };
    defaultSelectedTermMonths?: number;
    temperSignaturesTest?: boolean;
    /**
     * Optional in-process notification sink invoked alongside the existing service-mode
     * HTTP relay. Fires in BOTH `standalone` and `service` mode so consumers can observe
     * lifecycle events (e.g. loan renewal, mint, payment, withdrawal) without depending
     * on `lit-ops-server`. The SDK already emits messages via `formatLoan*Message` helpers
     * — this hook just exposes them locally. Errors thrown by the handler are swallowed
     * so notification failures cannot break business operations.
     *
     * @example
     *   const notifications: string[] = [];
     *   sdkConfig.notificationHandler = (msg) => { notifications.push(msg); };
     */
    notificationHandler?: (message: string) => void | Promise<void>;
}
/**
 * Service Mode Configuration
 * Uses lit-ops-server for PKP operations
 */
export interface ServiceModeConfig extends BaseSDKConfig {
    mode: "service";
    serviceEndpoint: string;
    litOpsSigner?: never;
}
/**
 * Standalone Mode Configuration
 * User provides signer for direct LIT operations
 */
export interface StandaloneModeConfig extends BaseSDKConfig {
    mode: "standalone";
    litOpsSigner: Wallet;
    serviceEndpoint?: never;
}
/**
 * Main SDK Configuration - Discriminated Union
 *
 * Use ServiceModeConfig for production deployments with lit-ops-server
 * Use StandaloneModeConfig for development/testing with direct LIT access
 *
 * @example Service Mode
 * ```typescript
 * const config: DiamondHandsSDKConfig = {
 *   mode: 'service',
 *   serviceEndpoint: 'https://lit-ops.example.com',
 *   contractSigner: wallet
 * };
 * ```
 *
 * @example Standalone Mode
 * ```typescript
 * const config: DiamondHandsSDKConfig = {
 *   mode: 'standalone',
 *   litOpsSigner: wallet,
 *   contractSigner: wallet
 * };
 * ```
 */
export type DiamondHandsSDKConfig = ServiceModeConfig | StandaloneModeConfig;
/**
 * Type guard to check if config is ServiceModeConfig
 */
export declare function isServiceModeConfig(config: DiamondHandsSDKConfig): config is ServiceModeConfig;
/**
 * Type guard to check if config is StandaloneModeConfig
 */
export declare function isStandaloneModeConfig(config: DiamondHandsSDKConfig): config is StandaloneModeConfig;
export declare function validateServiceModeConfig(config: ServiceModeConfig): string | null;
/**
 * Validates that StandaloneModeConfig has required fields
 */
export declare function validateStandaloneModeConfig(config: StandaloneModeConfig): string | null;
/**
 * Validates SDK configuration based on mode
 */
export declare function validateSDKConfig(config: DiamondHandsSDKConfig): string | null;
/**
 * SDK Initialization Options
 */
export interface SDKInitOptions {
    overrideDefaults?: boolean;
    customProvider?: Provider;
    skipNetworkCheck?: boolean;
}
/**
 * Network Configuration (basic)
 */
export interface BasicNetworkConfig {
    name: string;
    chainId: number;
    rpcUrl: string;
    blockExplorerUrl?: string;
}
/**
 * Bitcoin Provider Configuration
 */
export interface BitcoinProviderConfig {
    url: string;
    network: "mainnet" | "regtest";
    auth?: {
        username: string;
        password: string;
    };
    name?: string;
    priority?: number;
}
/**
 * Price Provider Configuration
 */
export interface PriceProviderConfig {
    name: string;
    pkpId?: string;
    apiKey?: string;
    apiSecret?: string;
}
export {};
