import Dec from 'decimal.js'; import { MorphoMidnightBookSide, MorphoMidnightMarketData, MorphoMidnightParsedBook, NetworkNumber } from '../../types'; import type { MorphoMidnightBorrowQuote, MorphoMidnightPaybackQuote, MorphoMidnightPaybackUnitsQuote } from './index'; type TenorBookKey = 'asks' | 'bids'; export declare const tenorBookKeyFor: (side: MorphoMidnightBookSide) => TenorBookKey; export declare const tenorBookRateToApyPercent: (rate: Dec.Value) => string; interface TenorOfferCollateral { token: string; lltv: string | number; liquidation_cursor: string | number; oracle: string; } interface TenorOffer { start: string | number; group?: string; callback?: string; tick: string | number; chain_id: string | number; maturity: string | number; buy: boolean; maker: string; loan_token_address: string; callback_data?: string; expiry: string | number; ratifier?: string; collaterals: TenorOfferCollateral[]; continuous_fee_cap: string | number; enter_gate: string; liquidator_gate: string; max_assets: string | number; max_units: string | number; ratifier_data?: string; rcf_threshold: string | number; receiver_if_maker_is_seller?: string; reduce_only: boolean; } interface TenorOfferFill { units: string | number; offer: TenorOffer; } /** * Tenor's offer JSON is flat (market fields live on the offer). Morpho's is nested, and that nested * shape is what the app encodes for `Midnight.take`. Map Tenor into that shape so recipes stay on one encoder. * * The core address is the one field Tenor's offer does not carry, so it is derived from the offer's own * `chain_id` rather than the caller's network — an offer names the chain it was made on, and taking it * against another chain's core would address a market that does not exist. */ export declare const tenorOfferToApiOffer: (offer: TenorOffer) => { market: { chain_id: string | number; midnight: "0xAdedD8ab6dE832766Fedf0FaC4992E5C4D3EA18A" | "0x471686c42792F93528B000beF54bC10E3aa2045f"; loan_token: string; collaterals: TenorOfferCollateral[]; maturity: string | number; rcf_threshold: string | number; enter_gate: string; liquidator_gate: string; }; buy: boolean; maker: string; start: string | number; expiry: string | number; tick: string | number; group: string; callback: string; callback_data: string; receiver_if_maker_is_seller: string; ratifier: string; reduce_only: boolean; max_units: string | number; max_assets: string | number; continuous_fee_cap: string | number; }; export declare const tenorOfferFillToApiFill: (fill: TenorOfferFill) => { units: string | number; offer: { market: { chain_id: string | number; midnight: "0xAdedD8ab6dE832766Fedf0FaC4992E5C4D3EA18A" | "0x471686c42792F93528B000beF54bC10E3aa2045f"; loan_token: string; collaterals: TenorOfferCollateral[]; maturity: string | number; rcf_threshold: string | number; enter_gate: string; liquidator_gate: string; }; buy: boolean; maker: string; start: string | number; expiry: string | number; tick: string | number; group: string; callback: string; callback_data: string; receiver_if_maker_is_seller: string; ratifier: string; reduce_only: boolean; max_units: string | number; max_assets: string | number; continuous_fee_cap: string | number; }; ratifier_data: string; market_id: string; }; interface TenorBookBucket { rate: number | string; liquidity: number | string; cumulative_liquidity?: number | string; } interface TenorBookSidePayload { buckets?: TenorBookBucket[]; } interface TenorBookResponse { asks?: TenorBookSidePayload | TenorBookBucket[]; bids?: TenorBookSidePayload | TenorBookBucket[]; } /** The levels resting on the Tenor side a taker of `side` fills, in raw loan-token base units. */ export declare const parseTenorBookSide: (json: TenorBookResponse, side: MorphoMidnightBookSide) => { rate: string; liquidityRaw: string; }[]; export declare const parseTenorOrderBook: (json: TenorBookResponse, side: MorphoMidnightBookSide, loanSymbol: string) => MorphoMidnightParsedBook | null; export declare const getTenorMarketBook: (market: MorphoMidnightMarketData, network: NetworkNumber, side?: MorphoMidnightBookSide) => Promise; /** * Tenor's router takes no slippage of its own — it prices the fill and hands back the offers. `slippagePercent` * is therefore accepted only to keep the signature aligned with the Morpho-hosted quote that `index.ts` * forwards to positionally; the guard comes from `rateSlippagePercent` via `midnightBoundPrice`. */ export declare const getTenorBorrowQuote: (marketId: string, assetsRaw: string, slippagePercent: Dec.Value, maturity: number, maxBorrowRate?: Dec.Value, taker?: string, rateSlippagePercent?: Dec.Value, network?: NetworkNumber) => Promise; export declare const getTenorPaybackQuote: (marketId: string, assetsRaw: string, slippagePercent: Dec.Value, maturity: number, minPaybackRate?: Dec.Value, taker?: string, rateSlippagePercent?: Dec.Value, network?: NetworkNumber) => Promise; export declare const getTenorPaybackUnitsQuote: (marketId: string, unitsRaw: string, slippagePercent: Dec.Value, maturity: number, minPaybackRate?: Dec.Value, taker?: string, rateSlippagePercent?: Dec.Value, network?: NetworkNumber) => Promise; export {};