@lifi/compose-spec
v0.0.1-alpha
Published
Public wire-format types and schemas for Compose flows
Readme
@lifi/compose-spec
Wire-format types and validation schemas for LI.FI Compose flows.
Install
npm install @lifi/compose-spec@lifi/compose-spec is published independently and is also a peer dependency of @lifi/composer-sdk. The two packages are versioned in lockstep — always install matching versions.
What's included
- Flow schema types —
Flow,Call,Continuation,Ref,BindValue, and related types that define the structure of a Compose flow document - Resource types —
Resource,Availability,OutputAmount,SimulatedAmounts, plus helpers likeerc20Token,foldResource,resourceKey - Manifest types —
ComposeManifest,ManifestOperation,ManifestGuard,ManifestMaterialiser,ManifestPrecondition - Port types —
ResourcePort,HandlePort,OpInputPort,OpOutputPort, and type guards - Ref utilities —
parseRef,foldRef,refKeyfor working with flow references - Constructors —
linear,copy,handle,native,erc20,resource,readResource,opHandle,resourceOutput - Zod schemas — Runtime validation for manifests, ports, guards, and operations
- Effect schemas —
FlowSchema,ResourceSchema,CallSchema, etc. for flow document validation
Usage
Import types for your Compose tooling:
import type { Flow, Call, Resource, ComposeManifest } from '@lifi/compose-spec';Validate a manifest at runtime with Zod:
import { ComposeManifestZod } from '@lifi/compose-spec';
const result = ComposeManifestZod.safeParse(rawManifest);
if (!result.success) {
console.error(result.error);
}When to use this package
Use @lifi/compose-spec directly if you're building tooling around Compose flows — validators, visualizers, alternative SDKs, or server-side processors.
For building and submitting flows, use @lifi/composer-sdk instead.
License
Apache-2.0
