@lifi/composer-sdk
Version:
Public Composer SDK for building and submitting flows
57 lines (55 loc) • 1.93 kB
TypeScript
/**
* Types for the Compose discovery API (`GET /compose/zap-packs`).
*
* These are SDK-facing presentation types — not part of the core compile
* contract in compose-spec. The backend response is the source of truth;
* the SDK provides typed access.
*
* The `type` field on edges is a plain `string` rather than a strict union
* so the SDK remains forward-compatible when the backend introduces new
* edge types. Known values at time of writing:
* `"enter-position"`, `"exit-position"`, `"wrap"`, `"unwrap"`, `"mint"`, `"burn"`.
*/
/**
* A single routing edge representing a supported token-to-token path
* through a DeFi protocol.
*/
interface ZapPackEdge {
/** Edge type (e.g. `"enter-position"`, `"exit-position"`, `"wrap"`). */
readonly type: string;
/** Input token. */
readonly in: {
readonly address: string;
readonly chainId: number;
};
/** Output token. */
readonly out: {
readonly address: string;
readonly chainId: number;
};
/** Minimum input amount accepted (stringified integer), if constrained. */
readonly inAmountMin?: string;
/** Maximum input amount accepted (stringified integer), if constrained. */
readonly inAmountMax?: string;
}
/**
* All routing edges for a single protocol.
*/
interface ZapPackOverview {
/** Protocol identifier (e.g. `"aave"`, `"morpho"`). */
readonly protocol: string;
/** Available routing edges for this protocol. */
readonly edges: readonly ZapPackEdge[];
}
/**
* Options for {@link ComposeClient.getZapPacks}.
*/
interface GetZapPacksOptions {
/**
* Filter to specific protocols. Pass a single string or an array.
* Only edges belonging to the listed protocols are returned.
* Omit to fetch all available protocols.
*/
readonly protocols?: string | readonly string[];
}
export type { GetZapPacksOptions, ZapPackEdge, ZapPackOverview };