import type { Address, Hex } from "viem";
import type { RatifierTreeInput, TreeLike } from "./TreeUtils.js";
/**
 * Parameters for {@link Ratifier.getRatifierInfo}.
 *
 * Pass the maker account bytecode read at the same block context used to build
 * the offer. The bytecode is used only to choose the ratifier address to put on
 * the offer.
 *
 * @example
 * ```ts
 * import type { GetRatifierInfoParams } from "@morpho-org/midnight-sdk";
 *
 * const params: GetRatifierInfoParams = {
 *   bytecode: "0x",
 *   ecrecoverRatifier: "0x0000000000000000000000000000000000000001",
 *   setterRatifier: "0x0000000000000000000000000000000000000002",
 * };
 * console.log(params.bytecode);
 * ```
 */
export interface GetRatifierInfoParams {
    /** Maker account bytecode returned by viem `getBytecode`; `undefined`, `null`, and `0x` mean no deployed code. */
    readonly bytecode?: Hex | null;
    /** Ecrecover ratifier address. */
    readonly ecrecoverRatifier: Address;
    /** Setter ratifier address. */
    readonly setterRatifier: Address;
}
/**
 * Classification of the ratifier route for a maker account.
 *
 * Put `ratifier` on each new `Offer.create` call for this maker. Use `type` to
 * decide whether the tree later needs an Ecrecover signature or a Setter root
 * approval before payload encoding.
 *
 * @example
 * ```ts
 * import type { RatifierInfo } from "@morpho-org/midnight-sdk";
 *
 * const info: RatifierInfo = {
 *   type: "ecrecover",
 *   ratifier: "0x0000000000000000000000000000000000000001",
 * };
 * ```
 */
export interface RatifierInfo {
    /** Ratifier family selected for the maker account. */
    readonly type: "ecrecover" | "setter";
    /** Ratifier contract address to put on the offer. */
    readonly ratifier: Address;
}
/**
 * Utilities for selecting Midnight ratifier routes.
 *
 * Call these during make-side preparation, before `Offer.create`, when an app
 * must decide whether a maker can sign an Ecrecover root or must approve a
 * Setter root onchain. Fetch helpers read bytecode for you; this namespace is
 * the pure classification logic.
 *
 * @example
 * ```ts
 * import { Ratifier } from "@morpho-org/midnight-sdk";
 *
 * console.log(Ratifier.isEip7702Designator("0xef0100"));
 * ```
 */
export declare namespace Ratifier {
    /**
     * Normalizes a ratifier tree input and asserts it uses one ratifier address.
     *
     * Pass an existing `Tree` or `TreeLike` object to reuse cached offers,
     * leaves, root, and height. Pass raw offer/group input when the caller has
     * not materialized a tree yet.
     *
     * @param params.tree - Tree-like object or raw offer/group input.
     * @param params.label - Ratifier label used in validation errors.
     * @returns Normalized tree-like data and its shared ratifier.
     * @throws {InvalidOfferParameterError} when raw tree input contains a sell offer with a zero receiver.
     * @throws {InvalidTreeError} when the tree fields disagree, the tree is empty, or it contains multiple ratifiers.
     * @throws {InvalidTreeHeightError} when the tree height is unsupported.
     * @throws {InvalidOfferGroupError} when standalone offers from one maker repeat an explicit group id.
     * @example
     * ```ts
     * import { Offer, Ratifier } from "@morpho-org/midnight-sdk";
     * import { zeroAddress } from "viem";
     *
     * const offer = Offer.create({
     *   market: {
     *     chainId: 8453,
     *     midnight: "0x0000000000000000000000000000000000001000",
     *     loanToken: "0x0000000000000000000000000000000000006000",
     *     collateralParams: [
     *       {
     *         token: "0x0000000000000000000000000000000000007000",
     *         lltv: 770000000000000000n,
     *         liquidationCursor: 250000000000000000n,
     *         oracle: "0x0000000000000000000000000000000000008000",
     *       },
     *     ],
     *     maturity: 54_000n,
     *     rcfThreshold: 0n,
     *     enterGate: zeroAddress,
     *     liquidatorGate: zeroAddress,
     *   },
     *   buy: true,
     *   maker: "0x0000000000000000000000000000000000009000",
     *   tick: 5_000n,
     *   expiry: 3_600n,
     *   ratifier: "0x0000000000000000000000000000000000004000",
     *   maxUnits: 100n,
     * });
     * const { tree, ratifier } = Ratifier.normalizeRatifierTree({
     *   tree: [offer],
     *   label: "Ecrecover",
     * });
     * console.log(tree.root, ratifier);
     * ```
     */
    function normalizeRatifierTree(params: {
        readonly tree: RatifierTreeInput;
        readonly label: "Ecrecover" | "Setter";
    }): {
        readonly tree: TreeLike;
        readonly ratifier: Address;
    };
    /**
     * Checks whether bytecode is an EIP-7702 designator.
     *
     * EIP-7702 accounts have code-like bytecode but still sign as the owning EOA,
     * so they use the Ecrecover ratifier route instead of the Setter route.
     *
     * @param bytecode - Account bytecode.
     * @returns Whether the bytecode starts with `0xef0100`.
     * @example
     * ```ts
     * import { Ratifier } from "@morpho-org/midnight-sdk";
     *
     * console.log(Ratifier.isEip7702Designator("0xef0100"));
     * ```
     */
    function isEip7702Designator(bytecode: Hex): boolean;
    /**
     * Selects Ecrecover for EOAs/EIP-7702 accounts and Setter for deployed-code
     * accounts.
     *
     * Use the returned `ratifier` address in `Offer.create`. Later, use
     * `EcrecoverRatifier.ratify` when `type` is `ecrecover`, or approve the
     * root and call `SetterRatifier.ratify` when `type` is `setter`.
     *
     * @param params.bytecode - Maker bytecode returned by `eth_getCode`.
     * @param params.ecrecoverRatifier - Ratifier address used for EOAs and EIP-7702 accounts.
     * @param params.setterRatifier - Ratifier address used for deployed-code accounts.
     * @returns Ratifier information for the maker.
     * @example
     * ```ts
     * import { Ratifier } from "@morpho-org/midnight-sdk";
     *
     * const info = Ratifier.getRatifierInfo({
     *   bytecode: "0x",
     *   ecrecoverRatifier: "0x0000000000000000000000000000000000000001",
     *   setterRatifier: "0x0000000000000000000000000000000000000002",
     * });
     * console.log(info.type);
     * ```
     */
    function getRatifierInfo(params: GetRatifierInfoParams): RatifierInfo;
}
/** @deprecated Use {@link Ratifier}. Retained for compatibility. */
export { Ratifier as RatifierUtils };
