Skip to content
Docs
TypeScript SDK

Integrate FloFi

TypeScript SDK

A small, dependency-free server client for the implemented Developer API and signed webhooks.

On this page

Use the workspace SDK

The API guide supports Node 20+ or a runtime with fetch and Web Crypto. Developing this repository uses its separately pinned Node 24.21.0 and pnpm 11.22.0.

Server initialization
import { FloFi, FloFiError, verifyWebhook }
  from "@defi-workflow-engine/developer-sdk";

const flofi = new FloFi({
  apiKey: process.env.FLOFI_API_KEY!,
  baseUrl: "https://<your FloFi deployment>",
});
typescript

Discover the deployment first

Capabilities
const { data } = await flofi.capabilities.list({
  network: "base-sepolia", action: "bridge",
});
const available = data.filter(row => row.operations.approve.available);
typescript

Use an available row’s exampleStrategy and retain the returned canonical strategy and hash. Continue with the Developer API tutorial. FloFi makes capability decisions; the SDK contains no alternate workflow engine.

Verify signed notifications

Raw-body verification
const event = await verifyWebhook({
  payload: rawBody,
  headers: request.headers,
  secret: process.env.FLOFI_WEBHOOK_SECRET!,
});
// Deduplicate event.id before handling.
// Fetch the resource again for its current state.
typescript

Verify the raw request body before parsing or re-serialization. Delivery ordering is not guaranteed. execution.* notifications are emitted only while the user shares status. Notifications do not authorize a workflow or change its financial state.

Handle failures deliberately

FloFiError carries status, code, reason, requestId, issues and retryAfter. The client retries safe GETs and keyed POSTs after network errors, 429, 502, 503 and 504, honoring Retry-After. Creating calls reuse their idempotency key across those retries.

An execution uncertainty is not an API retry opportunity. Follow the financial flow’s recovery boundary.

Primary sources

These guides summarize the repository’s current contracts. Detailed evidence and engineering history stay in their original records.

packages/developer-sdk/README.md packages/developer-sdk/src/client.ts docs/developer/WEBHOOKS.md
Built with FloFi. Designed for decisions you can inspect.
Documentation