UNPKG

@lifi/composer-sdk

Version:

Public Composer SDK for building and submitting flows

45 lines • 1.78 kB
import { ZapPackOverview } from "./discovery.cjs"; //#region src/reachability.d.ts /** 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; //#endregion //# sourceMappingURL=reachability.d.cts.map