import { Hex, GetEventArgs } from 'viem';
import { EcoProtocolAddresses, EcoChainIdsEnv, IntentType, IntentSourceAbi } from '@eco-foundation/routes-ts';

declare const chainIds: readonly [1, 10, 56, 130, 137, 146, 169, 360, 466, 478, 480, 1996, 2525, 5330, 8333, 8453, 33139, 42161, 42220, 57073, 10241024, 1380012617];
type RoutesSupportedChainId = typeof chainIds[number];
declare const stables: readonly ["USDC", "USDbC", "USDCe", "USDT", "oUSDT", "USDT0", "ApeUSD", "sUSDe"];
type RoutesSupportedStable = typeof stables[number];
declare const stableAddresses: Record<RoutesSupportedChainId, Partial<Record<RoutesSupportedStable, Hex | undefined>>>;

type SolverQuote = {
    quoteData: QuoteData;
};
type QuoteData = {
    tokens: {
        token: Hex;
        amount: string;
    }[];
    nativeValue: string;
    expiryTime: string;
    estimatedFulfillTimeSec: number;
};

type CreateSimpleIntentParams = {
    creator: Hex;
    originChainID: number;
    destinationChainID: number;
    receivingToken: Hex;
    spendingToken: Hex;
    spendingTokenLimit: bigint;
    amount: bigint;
    prover?: "HyperProver" | "MetaProver" | Hex;
    recipient?: Hex;
    expiryTime?: Date;
};
type CreateIntentParams = {
    creator: Hex;
    originChainID: number;
    destinationChainID: number;
    calls: IntentCall[];
    callTokens: IntentToken[];
    tokens: IntentToken[];
    prover?: "HyperProver" | "MetaProver" | Hex;
    expiryTime?: Date;
    nativeValue?: bigint;
};
type CreateNativeSendIntentParams = {
    creator: Hex;
    originChainID: number;
    destinationChainID: number;
    amount: bigint;
    limit: bigint;
    recipient?: Hex;
    prover?: "HyperProver" | "MetaProver" | Hex;
    expiryTime?: Date;
};
type ApplyQuoteToIntentParams = {
    intent: IntentType;
    quote: SolverQuote;
};
type EcoProtocolContract = keyof typeof EcoProtocolAddresses[EcoChainIdsEnv];
type ProtocolAddresses = Record<string, Partial<Record<EcoProtocolContract, Hex>>>;
type IntentCall = {
    target: Hex;
    data: Hex;
    value: bigint;
};
type IntentToken = {
    token: Hex;
    amount: bigint;
};

declare class RoutesService {
    private isPreprod;
    protocolAddresses: ProtocolAddresses;
    supportedChainIds: number[];
    constructor({ isPreprod, customProtocolAddresses }?: {
        isPreprod?: boolean;
        customProtocolAddresses?: ProtocolAddresses;
    });
    private mergeProtocolAddresses;
    /**
     * Creates a simple intent.
     *
     * @param {CreateSimpleIntentParams} params - The parameters for creating the simple intent.
     *
     * @returns {IntentType} The created intent.
     *
     * @throws {Error} If the creator address is invalid, the origin and destination chain are the same, the amount is invalid, or the expiry time is in the past. Or if there is no prover for the specified configuration.
     */
    createSimpleIntent({ creator, originChainID, destinationChainID, receivingToken, spendingToken, spendingTokenLimit, amount, recipient, prover, expiryTime }: CreateSimpleIntentParams): IntentType;
    /**
     * Creates an intent.
     *
     * @param {CreateRouteParams} params - The parameters for creating the intent.
     *
     * @returns {IntentType} The created intent.
     *
     * @throws {Error} If the creator address is invalid, the origin and destination chain are the same, the calls or tokens are invalid, or the expiry time is in the past.
     */
    createIntent({ creator, originChainID, destinationChainID, calls, callTokens, tokens, prover, expiryTime, nativeValue }: CreateIntentParams): IntentType;
    /**
     * Creates a native send intent.
     *
     * @param {CreateNativeSendIntentParams} params - The parameters for creating the native send intent.
     * @returns {IntentType} The created intent.
     * @throws {Error} If the creator address is invalid, the origin and destination chain are the same, the amount is invalid, or the expiry time is in the past.
     */
    createNativeSendIntent({ creator, originChainID, destinationChainID, amount, limit, recipient, prover, expiryTime }: CreateNativeSendIntentParams): IntentType;
    /**
     * Applies a quote to an intent, modifying the reward tokens.
     *
     * @param {ApplyQuoteToIntentParams} params - The parameters for applying the quote to the intent.
     *
     * @returns {IntentType} The intent with the quote applied.
     *
     * @throws {Error} If the quote is invalid.
     */
    applyQuoteToIntent({ intent, quote }: ApplyQuoteToIntentParams): IntentType;
    /**
     * Returns the EcoChainId for a given chainId, appending "-pre" if the environment is pre-production.
     *
     * @param chainId - The chain ID to be converted to an EcoChainId.
     * @returns The EcoChainId, with "-pre" appended if the environment is pre-production.
     */
    getEcoChainId(chainId: RoutesSupportedChainId): EcoChainIdsEnv;
    /**
     * Returns the EcoChainId for a given chainId, appending "-pre" if the environment is pre-production.
     *
     * @param chainId - The chain ID to be converted to an EcoChainId.
     * @returns The EcoChainId, with "-pre" appended if the environment is pre-production.
     */
    getChainIdEnv(chainId: number): `${number}` | `${number}-pre`;
    /**
     * Checks if a protocol contract exists for a given chain ID and protocol contract.
     *
     * @param {number} chainId - The chain ID to check for the protocol contract.
     * @param {EcoProtocolContract} protocolContract - The protocol contract to check for existence.
     * @returns {boolean} True if the protocol contract exists, false otherwise.
     */
    protocolContractExists(chainId: number, protocolContract: EcoProtocolContract): boolean;
    /**
     * Returns the address of a protocol contract for a given chain ID.
     *
     * @param {number} chainId - The chain ID to get the protocol address for.
     * @param {EcoProtocolContract} protocolContract - The protocol contract to get the address for.
     * @returns {Hex} The address of the protocol contract.
     *
     * @throws {Error} If no protocol contract exists on the specified chain ID.
     */
    getProtocolContractAddress(chainId: number, protocolContract: EcoProtocolContract): Hex;
    private getProverContract;
    private getDefaultDeadline;
    static getStableAddress(chainID: RoutesSupportedChainId, stable: RoutesSupportedStable): Hex;
    static getStableFromAddress(chainID: RoutesSupportedChainId, address: Hex): RoutesSupportedStable | undefined;
    static parseIntentFromIntentCreatedEventArgs(args: GetEventArgs<typeof IntentSourceAbi, 'IntentCreated', {
        IndexedOnly: false;
    }>): IntentType;
}

declare class OpenQuotingClient {
    private readonly MAX_RETRIES;
    private dAppID;
    private axiosInstance;
    constructor({ dAppID, customBaseUrl }: {
        dAppID: string;
        customBaseUrl?: string;
    });
    /**
     * Requests quotes for a given intent.
     *
     * @param intent - The intent for which quotes are being requested.
     * @returns A promise that resolves to an `OpenQuotingClient_ApiResponse_Quotes` object containing the quotes.
     * @throws An error if multiple requests fail.
     *
     * @remarks
     * This method sends a POST request to the `/api/v1/quotes` endpoint with the provided intent information.
     */
    requestQuotesForIntent(intent: IntentType): Promise<SolverQuote[]>;
}

declare function selectCheapestQuote(quotes: SolverQuote[]): SolverQuote;
declare function selectCheapestQuoteNativeSend(quotes: SolverQuote[]): SolverQuote;

export { type ApplyQuoteToIntentParams, type CreateIntentParams, type CreateNativeSendIntentParams, type CreateSimpleIntentParams, type EcoProtocolContract, OpenQuotingClient, type ProtocolAddresses, type QuoteData, RoutesService, type RoutesSupportedChainId, type RoutesSupportedStable, type SolverQuote, chainIds, selectCheapestQuote, selectCheapestQuoteNativeSend, stableAddresses, stables };
