/**
 * Client-side reachability over the zap-pack catalog.
 *
 * `GET /compose/zap-packs` lists single routing edges. `POST /compose/route`
 * chains up to the server's hop budget of them, so the set of routable pairs
 * is the closure of the catalog, not the catalog itself. This module computes
 * that closure locally with the planner's admissibility rule, so an integrator
 * can offer every pair `route` connects without a request per pair.
 *
 * The rule, mirrored from the server's route search:
 *
 * - every edge except the last must leave its output in the proxy for the
 *   next edge to consume: no `availability`, no `recipient: 'required'`
 * - the last edge must be synchronous, or `availability: 'future'` when the
 *   caller opts into `allowAsyncRoutes`
 * - a route never visits the same token twice
 *
 * Amount bounds (`inAmountMin` / `inAmountMax`) on an intermediate edge
 * cannot be checked without an amount, so a pair reported here is routable
 * structurally, exactly as a listed edge is. Routes that open with a
 * `lifi.swap` are not enumerable and are not reported. The server also
 * drops blacklisted tokens as intermediates, which is server-side config
 * this module cannot see, so a reported pair may still answer
 * `no_route_error`.
 */
import { ZapPackOverview } from "./discovery.js";
/** A token identified by address and chain. */
export interface TokenRef {
  readonly address: string;
  readonly chainId: number;
}
/** A from/to pair `POST /compose/route` can connect through the catalog. */
export interface RoutablePair {
  readonly in: TokenRef;
  readonly out: TokenRef;
  /** Catalog edges on the shortest admissible route; `1` is a listed edge. */
  readonly hops: number;
}
export interface ReachabilityOptions {
  /**
   * Hop budget. The server's `no_route_error` reports its effective value in
   * `details.maxHops`; the deployment default is 2.
   */
  readonly maxHops?: number;
  /**
   * Admit a route whose last edge has `availability: 'future'`. Mirrors the
   * `allowAsyncRoutes` request option; such a pair is a `no_route_error`
   * without it.
   */
  readonly allowAsyncRoutes?: boolean;
}
export interface Reachability {
  readonly maxHops: number;
  /** Whether `route` can connect `from` to `to` through the catalog. */
  readonly canRoute: (from: TokenRef, to: TokenRef) => boolean;
  /** Every pair starting at `from`, shortest routes first. */
  readonly routableFrom: (from: TokenRef) => readonly RoutablePair[];
  /** Every routable pair in the catalog. */
  readonly pairs: () => readonly RoutablePair[];
}
/**
 * Builds a reachability index over the packs returned by
 * {@link ComposeClient.getZapPacks}. Per-source closures are computed on
 * first use and memoised, so `canRoute` on a handful of pairs stays cheap
 * while `pairs()` enumerates everything.
 */
export declare const buildReachability: (packs: readonly ZapPackOverview[], options?: ReachabilityOptions) => Reachability;