NewWallets, tokens, NFTs, and vaults are live. RPC nodes coming soon.

See the stack →

TypeScript SDK

Typed end-to-end. Ships across Node, Bun, Deno, and edge runtimes. Primary integration path for the platform.

The TypeScript SDK is the canonical client for server-side and full-stack apps — the primary integration path for the platform. Every wallet, token, vault, and agent capability is typed end-to-end.

Install

npm i @fabricbloc/sdk

Also published on Bun, Deno, and JSR.

Requirements

  • Node 20+, Bun 1+, Deno 1.40+
  • TypeScript 5+ recommended
  • ESM and CJS builds

Highlights

Typed end-to-end

Every request and response is fully typed. Workspace, environment, and scoped-key shape are inferred from the API key.

Streaming and idempotency

Async iterators for streamable endpoints. Automatic retries with idempotency keys for mutating calls.

Edge-runtime ready

Runs on Vercel, Cloudflare Workers, Bun, and Deno Deploy without polyfills.

Examples

Initialize

// fabricbloc.ts
import { FabricBloc } from '@fabricbloc/sdk';

const apiKey = process.env.FB_KEY;
if (!apiKey) throw new Error('FB_KEY environment variable is required');

const fb = new FabricBloc(apiKey);

// All API calls are typed from this point forward.

Create a wallet

// wallet.ts
const wallet = await fb.wallets.create({
  userId: 'user_123',
  chains: ['base', 'polygon'],
  gasSponsor: true,
});

// wallet.address is fully typed.
await fb.wallets.fund(wallet.id, { asset: 'USDC', amount: '5' });

Scoped agent key

// agent.ts
const key = await fb.keys.createScoped({
  permissions: ['wallets:read', 'tokens:transfer'],
  maxSpend: { asset: 'USDC', amount: '100' },
  expiresIn: '24h',
});

// Hand the scoped token to an agent host.
return key.token;

FAQ

Does it work on the edge?

Yes. The SDK uses fetch internally and ships ESM + CJS builds. It runs on Cloudflare Workers, Vercel Edge, Bun, and Deno Deploy without polyfills.

How do I configure retries?

Mutating endpoints use idempotency keys by default with exponential backoff. Override via the second constructor argument: new FabricBloc(key, { maxRetries: 5, retryStrategy: 'jitter' }).

Is there a separate browser SDK?

For browser code that talks to your own backend, keep the API key server-side and proxy through your own routes. For agent-facing browser code, mint a scoped key in your backend and hand the short-lived token to the browser.