import type { Address } from "viem";
import type { MempoolPayloadValidationIssue } from "./api/types.js";
/**
 * Thrown when a Midnight offer group violates protocol-level group mechanics.
 *
 * @example
 * ```ts
 * import { InvalidOfferGroupError } from "@morpho-org/midnight-sdk";
 *
 * throw new InvalidOfferGroupError("All offers in a group must use the same maker.");
 * ```
 */
export declare class InvalidOfferGroupError extends Error {
    constructor(reason: string);
}
/**
 * Thrown when a tick exceeds the deployed TickLib range.
 *
 * @example
 * ```ts
 * import { TickOutOfRangeError } from "@morpho-org/midnight-sdk";
 *
 * const error = new TickOutOfRangeError(7000n, 6744n);
 * console.log(error.message);
 * ```
 */
export declare class TickOutOfRangeError extends Error {
    constructor(tick: bigint, maxTick: bigint);
}
/**
 * Thrown when a price is above the maximum WAD price accepted by TickLib.
 *
 * @example
 * ```ts
 * import { PriceGreaterThanOneError } from "@morpho-org/midnight-sdk";
 *
 * throw new PriceGreaterThanOneError(2n * 10n ** 18n);
 * ```
 */
export declare class PriceGreaterThanOneError extends Error {
    constructor(price: bigint);
}
/**
 * Thrown when tick spacing is invalid or a tick is not aligned to it.
 *
 * @example
 * ```ts
 * import { InvalidTickSpacingError } from "@morpho-org/midnight-sdk";
 *
 * throw new InvalidTickSpacingError(5n, 4n);
 * ```
 */
export declare class InvalidTickSpacingError extends Error {
    constructor(spacing: bigint);
    constructor(tick: bigint, spacing: bigint);
}
/**
 * Thrown when a buy offer's settlement fee exceeds its tick price.
 *
 * @example
 * ```ts
 * import { SettlementFeeExceedsPriceError } from "@morpho-org/midnight-sdk";
 *
 * throw new SettlementFeeExceedsPriceError(10n, 9n);
 * ```
 */
export declare class SettlementFeeExceedsPriceError extends Error {
    constructor(settlementFee: bigint, price: bigint);
}
/**
 * Thrown when a local position accrual is requested for an impossible timestamp.
 *
 * @example
 * ```ts
 * import { InvalidPositionAccrualTimestampError } from "@morpho-org/midnight-sdk";
 *
 * throw new InvalidPositionAccrualTimestampError(1n, 2n);
 * ```
 */
export declare class InvalidPositionAccrualTimestampError extends Error {
    constructor(timestamp: bigint, lastAccrual: bigint);
}
/**
 * Thrown when a local position accrual sees a market loss factor older than the position.
 *
 * @example
 * ```ts
 * import { InvalidPositionLossFactorError } from "@morpho-org/midnight-sdk";
 *
 * throw new InvalidPositionLossFactorError(1n, 2n);
 * ```
 */
export declare class InvalidPositionLossFactorError extends Error {
    constructor(marketLossFactor: bigint, positionLossFactor: bigint);
}
/**
 * Thrown when local position accrual inputs violate Midnight accounting invariants.
 *
 * @example
 * ```ts
 * import { InvalidPositionAccrualStateError } from "@morpho-org/midnight-sdk";
 *
 * throw new InvalidPositionAccrualStateError("Pending fee exceeds credit.");
 * ```
 */
export declare class InvalidPositionAccrualStateError extends Error {
    constructor(reason: string);
}
/**
 * Thrown when a market parameter cannot satisfy Midnight protocol rules.
 *
 * @example
 * ```ts
 * import { InvalidMarketParameterError } from "@morpho-org/midnight-sdk";
 *
 * throw new InvalidMarketParameterError({
 *   parameter: "collateralParams",
 *   value: 0,
 *   instruction: "Provide at least one collateral.",
 * });
 * ```
 * @param params.parameter - Invalid market parameter name.
 * @param params.value - Invalid market parameter value.
 * @param params.instruction - Optional instruction appended to the error message.
 * @param params.cause - Optional wrapped cause.
 */
export declare class InvalidMarketParameterError extends Error {
    /** Invalid market parameter name. */
    readonly parameter: string;
    /** Invalid market parameter value. */
    readonly value: unknown;
    constructor(params: {
        readonly parameter: string;
        readonly value: unknown;
        readonly instruction?: string;
        readonly cause?: unknown;
    });
}
/**
 * Thrown when a Midnight market collateral index is not configured.
 *
 * @example
 * ```ts
 * import { UnknownCollateralIndexError } from "@morpho-org/midnight-sdk";
 *
 * throw new UnknownCollateralIndexError({
 *   market: "0x1111111111111111111111111111111111111111111111111111111111111111",
 *   collateralIndex: 2n,
 * });
 * ```
 * @param params.market - Market id whose collateral list was queried.
 * @param params.collateralIndex - Missing collateral index.
 */
export declare class UnknownCollateralIndexError extends Error {
    /** Market id whose collateral list was queried. */
    readonly market: string;
    /** Missing collateral index. */
    readonly collateralIndex: bigint;
    constructor(params: {
        readonly market: string;
        readonly collateralIndex: bigint;
    });
}
/**
 * Thrown when an offer builder receives a parameter that cannot satisfy Midnight protocol rules.
 *
 * @example
 * ```ts
 * import { InvalidOfferParameterError } from "@morpho-org/midnight-sdk";
 *
 * throw new InvalidOfferParameterError({ parameter: "tick", value: 5821n });
 * ```
 * @param params.parameter - Invalid offer parameter name.
 * @param params.value - Invalid offer parameter value.
 * @param params.instruction - Optional instruction appended to the error message.
 * @param params.cause - Optional wrapped cause.
 */
export declare class InvalidOfferParameterError extends Error {
    /** Invalid offer parameter name. */
    readonly parameter: string;
    /** Invalid offer parameter value. */
    readonly value: unknown;
    constructor(params: {
        readonly parameter: string;
        readonly value: unknown;
        readonly instruction?: string;
        readonly cause?: unknown;
    });
}
/**
 * Thrown when Midnight mempool payload bytes cannot be encoded or decoded.
 *
 * @example
 * ```ts
 * import { PayloadDecodeError } from "@morpho-org/midnight-sdk";
 *
 * throw new PayloadDecodeError("payload too short for header");
 * ```
 */
export declare class PayloadDecodeError extends Error {
    /** Machine-readable decode failure reason without the class message prefix. */
    readonly reason: string;
    constructor(reason: string, cause?: Error);
}
/**
 * Thrown when a tree height exceeds the ratifier typehash table.
 *
 * @example
 * ```ts
 * import { InvalidTreeHeightError } from "@morpho-org/midnight-sdk";
 *
 * throw new InvalidTreeHeightError(21);
 * ```
 */
export declare class InvalidTreeHeightError extends Error {
    constructor(height: number);
}
/**
 * Thrown when a tree cannot be represented by the ratifiers.
 *
 * @example
 * ```ts
 * import { InvalidTreeError } from "@morpho-org/midnight-sdk";
 *
 * throw new InvalidTreeError("Tree must not be empty.");
 * ```
 */
export declare class InvalidTreeError extends Error {
    constructor(message: string);
}
/**
 * Thrown when a RateRatifierV1 leaf receives a negative rate.
 *
 * @example
 * ```ts
 * import { InvalidRateRatifierV1RateError } from "@morpho-org/midnight-sdk";
 *
 * throw new InvalidRateRatifierV1RateError(-1n);
 * ```
 */
export declare class InvalidRateRatifierV1RateError extends Error {
    /** Negative rate that was rejected. */
    readonly rate: bigint;
    constructor(rate: bigint);
}
/**
 * Thrown when RateRatifierV1 price-bound arithmetic overflows uint256.
 *
 * @example
 * ```ts
 * import { RateRatifierV1BoundOverflowError } from "@morpho-org/midnight-sdk";
 *
 * throw new RateRatifierV1BoundOverflowError(2n ** 255n, 10n);
 * ```
 */
export declare class RateRatifierV1BoundOverflowError extends Error {
    /** Rate whose bound arithmetic overflowed. */
    readonly rate: bigint;
    /** Time to maturity used in the overflowing bound. */
    readonly timeToMaturity: bigint;
    constructor(rate: bigint, timeToMaturity: bigint);
}
/**
 * Thrown when a RateRatifierV1 leaf offer commits a nominal tick below the
 * router's minimum takeable tick.
 *
 * @example
 * ```ts
 * import { InvalidRateRatifierV1TickError } from "@morpho-org/midnight-sdk";
 *
 * throw new InvalidRateRatifierV1TickError(0n, 3372n);
 * ```
 */
export declare class InvalidRateRatifierV1TickError extends Error {
    /** Nominal tick that was rejected. */
    readonly tick: bigint;
    /** Minimum accepted tick. */
    readonly minTick: bigint;
    constructor(tick: bigint, minTick: bigint);
}
/**
 * Thrown when a RateRatifierV1 time parameter is negative.
 *
 * @example
 * ```ts
 * import { InvalidRateRatifierV1TimeError } from "@morpho-org/midnight-sdk";
 *
 * throw new InvalidRateRatifierV1TimeError(-1n, "timestamp");
 * ```
 */
export declare class InvalidRateRatifierV1TimeError extends Error {
    /** Negative time value that was rejected. */
    readonly value: bigint;
    /** Parameter that carried the negative value. */
    readonly field: "timeToMaturity" | "timestamp";
    constructor(value: bigint, field: "timeToMaturity" | "timestamp");
}
/**
 * Thrown when a V1 ratifier address is the zero address.
 *
 * @example
 * ```ts
 * import { InvalidRatifierV1AddressError } from "@morpho-org/midnight-sdk";
 *
 * throw new InvalidRatifierV1AddressError(
 *   "0x0000000000000000000000000000000000000000",
 * );
 * ```
 */
export declare class InvalidRatifierV1AddressError extends Error {
    /** Zero ratifier address that was rejected. */
    readonly ratifier: Address;
    constructor(ratifier: Address);
}
/**
 * Thrown when a taker is not the allowed taker of a V1 ratifier leaf.
 *
 * @example
 * ```ts
 * import { RatifierV1TakerNotAllowedError } from "@morpho-org/midnight-sdk";
 *
 * throw new RatifierV1TakerNotAllowedError({
 *   taker: "0x0000000000000000000000000000000000000001",
 *   allowedTaker: "0x0000000000000000000000000000000000000002",
 * });
 * ```
 */
export declare class RatifierV1TakerNotAllowedError extends Error {
    /** Taker that attempted to take the offer. */
    readonly taker: Address;
    /** Taker allowed by the ratified leaf. */
    readonly allowedTaker: Address;
    constructor(params: {
        readonly taker: Address;
        readonly allowedTaker: Address;
    });
}
/**
 * Thrown when a viem client's chain id does not match the chain id required by a signing flow.
 *
 * @example
 * ```ts
 * import { ChainIdMismatchError } from "@morpho-org/midnight-sdk";
 *
 * throw new ChainIdMismatchError(1, 8453n);
 * ```
 */
export declare class ChainIdMismatchError extends Error {
    /** Chain id reported by the viem client, when configured. */
    readonly clientChainId: number | undefined;
    /** Chain id required by the data being signed. */
    readonly expectedChainId: bigint;
    constructor(clientChainId: number | undefined, expectedChainId: bigint);
}
/**
 * Thrown when the Midnight API rejects a tree during mempool policy validation.
 *
 * @example
 * ```ts
 * import { MidnightMempoolValidationError } from "@morpho-org/midnight-sdk";
 *
 * throw new MidnightMempoolValidationError([{ rule: "tick_spacing" }]);
 * ```
 */
export declare class MidnightMempoolValidationError extends Error {
    /** Validation issues returned by the Midnight API. */
    readonly issues: readonly MempoolPayloadValidationIssue[];
    constructor(issues: readonly MempoolPayloadValidationIssue[]);
}
/**
 * Thrown when a typed-data signature does not recover to the expected signer.
 *
 * @example
 * ```ts
 * import { InvalidTypedDataSignatureError } from "@morpho-org/midnight-sdk";
 *
 * throw new InvalidTypedDataSignatureError(
 *   "0x0000000000000000000000000000000000000001",
 * );
 * ```
 */
export declare class InvalidTypedDataSignatureError extends Error {
    /** Signer address the signature was expected to recover. */
    readonly signer: Address;
    constructor(signer: Address, cause?: unknown);
}
/**
 * Thrown when an Ecrecover signature cannot be parsed or recovered.
 *
 * @example
 * ```ts
 * import { InvalidEcrecoverSignatureError } from "@morpho-org/midnight-sdk";
 *
 * const error = new InvalidEcrecoverSignatureError(new TypeError("Invalid recovery input"));
 * console.log(error.cause);
 * ```
 */
export declare class InvalidEcrecoverSignatureError extends Error {
    constructor(cause: unknown);
}
/**
 * Thrown when decoded Ecrecover ratifier data contains a non-canonical signature `v` value.
 *
 * @example
 * ```ts
 * import { InvalidEcrecoverSignatureVError } from "@morpho-org/midnight-sdk";
 *
 * throw new InvalidEcrecoverSignatureVError(29);
 * ```
 */
export declare class InvalidEcrecoverSignatureVError extends Error {
    /** Invalid ECDSA recovery id. */
    readonly v: number;
    constructor(v: number);
}
/**
 * Thrown when the Midnight API returns a non-2xx response.
 *
 * @example
 * ```ts
 * import { MidnightApiError } from "@morpho-org/midnight-sdk/api";
 *
 * throw new MidnightApiError({
 *   status: 400,
 *   code: "BAD_REQUEST",
 *   message: "Limit must be greater than 0.",
 *   details: [{ field: "limit", issue: "Limit must be greater than 0." }],
 *   requestId: "req-123",
 * });
 * ```
 */
export declare class MidnightApiError extends Error {
    /** HTTP response status from the API. */
    readonly status: number;
    /** API error code, when the response body includes one. */
    readonly code?: string;
    /** API error details, when the response body includes them. */
    readonly details?: unknown;
    /** API request id, when the response body includes one. */
    readonly requestId?: string;
    constructor(params: {
        readonly status: number;
        readonly code?: string;
        readonly message?: string;
        readonly details?: unknown;
        readonly requestId?: string;
        readonly cause?: unknown;
    });
}
/**
 * Thrown when the Midnight API returns a malformed successful response.
 *
 * @example
 * ```ts
 * import { InvalidMidnightApiResponseError } from "@morpho-org/midnight-sdk/api";
 *
 * throw new InvalidMidnightApiResponseError("API response is missing data.");
 * ```
 */
export declare class InvalidMidnightApiResponseError extends Error {
    constructor(message: string, options?: ErrorOptions);
}
/**
 * Thrown when a Midnight API quote request does not target exactly one positive amount in `units` or `assets`.
 *
 * @example
 * ```ts
 * import { InvalidMidnightApiQuoteTargetError } from "@morpho-org/midnight-sdk/api";
 *
 * throw new InvalidMidnightApiQuoteTargetError();
 * ```
 */
export declare class InvalidMidnightApiQuoteTargetError extends Error {
    constructor(options?: ErrorOptions);
}
