SDK Installation

Install the TypeScript SDK and set up the client for server-side, browser, or React applications.

Install

npm install @dimes-dot-fi/sdk

Entry points

The SDK ships three entry points. Import only what you need — peer dependencies are optional.

Entry point
What it provides
Peer dependencies

@dimes-dot-fi/sdk

HTTP client, quote engine, error types

None

@dimes-dot-fi/sdk/react

React hooks and context provider

react >=19, @tanstack/react-query >=5

@dimes-dot-fi/sdk/contract

On-chain transaction builders, signature verification

viem >=2

Install peer dependencies for the entry points you use:

# React hooks
npm install react @tanstack/react-query

# On-chain integration
npm install viem

Client setup

Use ApiKeyAuth when your backend holds the API key and generates JWTs for users.

import { DimesClient, ApiKeyAuth } from "@dimes-dot-fi/sdk";

const client = new DimesClient({
  auth: new ApiKeyAuth({
    apiKey: process.env.DIMES_API_KEY,
    walletAddress: "0x1234...abcd",
  }),
});

const markets = await client.getMarkets();

ApiKeyAuth automatically obtains and refreshes JWTs.


Sandbox

Point the client at sandbox by passing baseUrl:

See Sandbox for how to get a sandbox key and fake USDC.


Custom fetch

Pass a custom fetch implementation for environments without a global fetch (older Node.js, test mocks, etc.):


What's next

Last updated