Developers

TypeScript SDK

@stridge/sdk is the framework-agnostic TypeScript client for the Stridge Gateway. It's the same library @stridge/kit uses under the hood to talk to the Gateway HTTP API — published standalone for backends, workers, and non-React frontends that want typed, direct access without React.

It has zero runtime dependencies, zero peer dependencies, ships CJS + ESM from a single subpath, and runs in any JavaScript runtime with a global fetch — Node 18+, Bun, Deno, Cloudflare Workers, Vercel Functions, or the browser.

When to reach for the SDK

The SDK is one of three layers over the same gateway, and they're not interchangeable. Pick the one that matches the surface you own.

You're building…Reach forWhy
A React app with a deposit / withdraw UIGateway Kit (@stridge/kit)Drop-in widgets, FSM, hooks, themable. Built on this SDK.
A backend, worker, or scheduled job that provisions UDAs or reconciles settlements@stridge/sdkTyped createApiClient, no React, no DOM.
A non-React frontend (Vue, Svelte, vanilla JS)@stridge/sdk + your UISame typed client; you own the rendering.
A proxy in front of the Kit (so the project key never ships to the browser)@stridge/sdk on the serverForward authenticated calls; the browser hits your proxy.
Any language other than TypeScriptGateway HTTP APIRaw HTTPS contract; no client required.

The Kit is built on the SDK, and the SDK wraps the HTTP API — drop down one layer when you need more control, never two.

Quick start

pnpm add @stridge/sdk
server.ts
import { createApiClient } from "@stridge/sdk"

const stridge = createApiClient({
  projectKey: process.env.STRIDGE_PROJECT_KEY!,
  env: "prod", // "prod" | "dev"
})

// Provision (or fetch) the user's UDA — idempotent on (owner, destination).
const uda = await stridge.gateway.start({
  owner: walletAddress,
  destination: {
    network_id: "9001", // Arbitrum One — see Supported networks
    to_address: walletAddress,
    asset_symbol: "USDC",
  },
})

// Poll until terminal.
const { udas } = await stridge.gateway.poll(walletAddress)
const mine = udas.find((u) => u.uda_id === uda.uda_id)
if (mine?.is_terminal) {
  // settlement complete — inspect mine.settlements
}

Every endpoint returns a typed model parsed against the Stridge response envelope — autocomplete and .d.ts work out of the box.

What's in the box

Where the SDK sits

@stridge/kit consumes @stridge/sdk directly — never touches fetch. @stridge/sdk talks to the gateway HTTPS API through its own HttpClient. Every namespaced-client method maps 1:1 onto a gateway route.

@stridge/kit consumes @stridge/sdk directly — the React layer never touches fetch. @stridge/sdk consumes api.stridge.com/v1 (or api.stridge.dev/v1 in sandbox) through its own HttpClient. Every method on every namespaced client maps 1:1 to one of the gateway's HTTPS routes; the SDK is the thinnest possible typed surface over the wire — it never caches, never batches, never invents endpoints the gateway doesn't expose.

That means if a feature exists on the SDK, it exists in the HTTP API — you can drop down to a raw curl for any call documented here. See Gateway HTTP API for the wire-level contract.

Authentication at a glance

The SDK authenticates with a project key — the same key the Kit ships as gatewayKey, retrieved from the Stridge Dashboard under Developer → Gateway Kit → Connection.

Warning

Unlike the Kit's gatewayKey (designed to ship in browser bundles, protected by an origin allowlist), the SDK is typically deployed server-side where the key is treated as a secret. Store it in a server-only environment variable (STRIDGE_PROJECT_KEY, never NEXT_PUBLIC_*) and rotate it from the Dashboard if it ever leaks. See Installation for the full pattern.

Public endpoints (uda.supportedAssets, uda.quote) need no key at all — they go through the SDK's unauthenticated httpClient. Project-scoped endpoints (everything on gateway.* and balance.*) go through projectHttpClient, which sends the project key on every request. See API client for the split.

Was this page helpful?