@tokenflight/fiat
v0.0.1
Published
Self-hostable fiat on-ramp toolkit: quote fan-out, orders, webhooks and settlement over pluggable providers
Downloads
99
Readme
@tokenflight/fiat
Self-hostable fiat on-ramp toolkit. One createFiat() call gives you a fetch handler that serves the standard fiat HTTP contract — provider quote fan-out (plain or NDJSON streaming), order creation, the hosted widget wrapper page, provider webhooks, and cron-driven settlement — over pluggable payment providers and a pluggable state store.
import { createFiat } from "@tokenflight/fiat";
import { transakProvider } from "@tokenflight/fiat/providers/transak";
import { createD1FiatState } from "@tokenflight/fiat-storage-d1";
const fiat = createFiat({
providers: [transakProvider({ apiKey: env.TRANSAK_API_KEY, apiSecret: env.TRANSAK_API_SECRET })],
state: createD1FiatState(env.DB),
cors: { origins: ["https://app.example.com"] },
quoteSecret: env.QUOTE_SECRET,
basePath: "/v1/fiat",
});
export default { fetch: (request: Request) => fiat.fetch(request) };- Frontend client:
@tokenflight/fiat-client - D1 storage:
@tokenflight/fiat-storage-d1 - Custom providers / stores: verify them with
@tokenflight/fiat-testkit
Wire-contract evolution: responses only gain fields, requests only gain optional fields, and breaking changes bump CONTRACT_VERSION under a new base path. See the FiatConfigResponse.contractVersion field.
© Khalani Labs, Ltd. All rights reserved. This package is distributed for use with TokenFlight services; the source is not open source.
