import { type Address, type Hash } from "viem";
import { type ApiBookMarketResponse, type ApiPriceLevelResponse, type ApiRequestParams, type ApiTakeableOfferResponse, type MempoolPayloadValidationResult, type MidnightApiBookMarket, type MidnightApiBookSide, type MidnightApiPriceLevel, type MidnightApiTake } from "./types.js";
/** @internal Sends one Midnight API request and maps non-2xx responses to SDK errors. */
export declare function requestMidnightApi<Response = unknown>(params: ApiRequestParams): Promise<Response>;
/** @internal Builds a book endpoint path with encoded path segments. */
export declare function buildBookPath(params: {
    readonly marketId: Hash;
    readonly side?: MidnightApiBookSide;
    readonly suffix?: "quote" | "takeable-offers";
}): string;
/** @internal Maps a book market, binding its verified id to the requested market. */
export declare function mapBoundBookMarket(book: ApiBookMarketResponse, requestedMarketId: Hash): MidnightApiBookMarket;
/** @internal Requested `fetchBooks` filters that every returned book must satisfy. */
export interface BookFilterContext {
    readonly marketIds?: readonly Hash[];
    readonly chainIds?: readonly number[];
    readonly loanTokens?: readonly Address[];
    readonly collateralTokens?: readonly Address[];
    readonly maturities?: readonly number[];
}
/** @internal Maps listed book markets, binding each verified id to requested filters when present. */
export declare function mapBoundBooks(books: readonly ApiBookMarketResponse[], context?: BookFilterContext): MidnightApiBookMarket[];
/** @internal Maps API price levels and sorts them best first: asks by ascending tick, bids by descending tick. */
export declare function mapPriceLevels(levels: readonly ApiPriceLevelResponse[], side: MidnightApiBookSide): MidnightApiPriceLevel[];
/** @internal API response context required for a takeable offer to be executable for the caller's request. */
export interface TakeableOfferContext {
    readonly marketId?: Hash;
    readonly side?: MidnightApiBookSide;
    readonly maker?: Address;
    /** Taker address whose own offers must not appear in the response. */
    readonly taker?: Address;
    readonly marketIds?: readonly Hash[];
    readonly groups?: readonly Hash[];
}
/** @internal Maps, validates offer caps and units, and best-price-sorts API takeable offers. */
export declare function mapBoundTakeableOffers(takeableOffers: readonly ApiTakeableOfferResponse[], context: TakeableOfferContext): MidnightApiTake[];
/** @internal Parses the mempool validation response envelope. */
export declare function parseValidationResponse(response: unknown): MempoolPayloadValidationResult;
/** @internal Returns `value` when it is a non-null, non-array object. */
export declare function requireObject<T extends object>(value: T, context: string): T;
/** @internal Returns a Midnight API response envelope after checking it carries `data`. */
export declare function requireResponseEnvelope<T extends {
    readonly data: object;
}>(response: T, context: string): T;
/** @internal Parses a paginated response cursor, treating a missing cursor as the last page. */
export declare function parseResponseCursor(cursor: string | null | undefined, context: string): string | null;
/** @internal Returns `value` when it is a decimal string of a uint256. */
export declare function requireBigIntString(value: string, context: string): string;
