import { PoolOverview, TrancheData } from '../services/DataService/types'; /** * Minimum remaining capacity (in stable-asset units) for a tranche to be * selectable. Mirrors `MIN_CAPACITY = toBigNumber('1')` in kasu-fe-next's * lending modal after its `formatEther`. Anything below this is rounding * noise — the SDK's own capacity arithmetic routinely leaves sub-cent dust * behind. */ export declare const MIN_TRANCHE_CAPACITY = 1; /** * Remaining capacity as it reaches this layer. `TrancheData` (raw, from the * data service) calls it `poolCapacity`; the facade's `StrategyTranche` calls * the same number `availableCapacity`. Accepting both keeps ONE capacity gate * for the whole SDK rather than a duplicate per shape. */ export type TrancheCapacitySignal = { poolCapacity: string; } | { availableCapacity: string; }; export declare function trancheHasCapacity(tranche: TrancheCapacitySignal): boolean; /** * Whole-strategy capacity gate: true when the pool has tranches but none of * them has remaining capacity. Drives a lend form's full-capacity message and * its step-counter suppression. */ export declare function poolAllTranchesFull(pool: PoolOverview): boolean; export type PoolStatus = 'Live' | 'Full' | 'Coming soon'; /** * The status CODE for a pool. A code, not copy: consumers map it to their own * wording and locale. */ export declare function derivePoolStatus(pool: PoolOverview): PoolStatus; export declare function trancheRiskRank(tranche: TrancheData): number; /** * Comparator that orders tranches SAFEST-FIRST (Senior → Mezzanine → Junior) * by the same name-based risk rank the default-pick uses. Ranks by the RAW * subgraph name, so the Apxium "Upper Mezzanine" display rename never reaches * here. Ties (incl. unrecognised names, which both rank last) keep their input * order under a stable sort. Used by a lend dropdown to list the least-risky * option first. */ export declare function compareTrancheSeniority(a: TrancheData, b: TrancheData): number; /** * Capacity-aware default tranche pick: the LOWEST-risk tranche that still has * capacity, so a new lender lands on the safest available option. Riskier * tranches remain a deliberate opt-in — we must never pre-select the * highest-risk Junior (audit 3.2). When every tranche is full we fall back to * the lowest-risk one regardless, so a form still mounts in a known state * (the dropdown marks it full and the submit gate blocks progress). */ export declare function pickDefaultTrancheId(pool: PoolOverview): string; /** A closed APY range, both bounds as 0..1 fractions. */ export interface ApyBounds { min: number; max: number; } /** * GROSS APY range across a pool's tranches — the numeric core of kasu-ui's * `formatTrancheApyRange`. Each `TrancheData` carries `minApy`/`maxApy` * derived from the base rate plus any fixed-term configs (`data-service.ts`). * * Zero and negative values are skipped — an unset/missing rate (e.g. a tranche * with no fixed-term config) must not drag the range down to `0–10.5%`. * `null` when nothing usable remains, which is the caller's cue to render its * "no rate" state rather than a confident zero. * * The min is taken over `minApy` and the max over `maxApy`, so a single * unusable side collapses the whole range to `null` rather than half a range. * * Formatting is NOT here. The rule that two bounds printing the same figure * collapse to one is decided on the rendered digits, so it belongs with the * formatter that produces them (kasu-ui `format-tranche-apy.ts`). */ export declare function trancheApyBounds(tranches: TrancheData[]): ApyBounds | null; /** * The same range as NET Effective Interest Rates — each bound through * `netEffectiveApy`. * * FAIL CLOSED: `null` when either bound comes back non-finite or ≤ 0, so an * out-of-domain fee or a rate-less pool can never be rendered as a confident * figure. A caller that does not yet know the fee must not substitute `0` — * a fee-less rate overstates the figure by up to 3.4pp with nothing on screen * saying so; it should skip the call and render its unavailable state. * * @param feePercent the chain's performance fee, 0..100 — never a fraction. * See `netEffectiveApy` for why the units matter. */ export declare function netTrancheApyBounds(tranches: TrancheData[], feePercent: number): ApyBounds | null;