Installation
@stridge/sdk is a single npm package shipped as CJS + ESM from one subpath (.) with zero runtime dependencies and zero peers. The whole library imports through one barrel — there are no compound, dialog, or theme subpaths to learn.
Install the package
pnpm add @stridge/sdkThat's the entire install. The package has no peers — no React, no viem, no node-fetch (the runtime's built-in fetch is used directly), no schema validator. The bundle is small and tree-shakeable: import only what you use and the rest is dropped.
Runtime support
The SDK builds against a neutral runtime target — every imported value resolves in platform: "neutral". That means no Node-only or DOM-only globals at module scope; the only runtime requirement is a global fetch (and the surrounding Request / Response / Headers shapes).
| Runtime | Status | Notes |
|---|---|---|
| Node.js | 18 + | Built-in fetch available since v18. v20 / 22 LTS are the recommended baselines. |
| Bun | 1.x + | Native fetch. |
| Deno | 1.30 + | Native fetch. Install via the npm specifier — see the deno tab on the install snippet above. |
| Edge runtimes | All | Cloudflare Workers, Vercel Functions (Fluid Compute), Deno Deploy. |
| Browser | Modern evergreens | Works, but consider @stridge/kit (or a server proxy) so the project key never ships in a bundle. |
The SDK never reads process.env, window, or document itself — anything environmental flows in through createApiClient(options). Bring your own config loader.
Get a project key
The SDK authenticates with a project key generated from the Stridge Dashboard.
Sign in at staging.dashboard.stridge.com (or dashboard.stridge.com in production).
Navigate to Developer → Gateway Kit → Connection. The page lists every key your workspace has and lets you mint new ones. The same key powers the Kit's gatewayKey, the SDK's projectKey, and the HTTP API's X-Gateway-Key header — they're three names for the same secret.
Configure the security controls on the same page:
- Origin allowlist — for any key that might leak into a browser, register the domains permitted to call the gateway with it.
- Destination address whitelist — restrict settlement to a fixed set of addresses you approved.
- Owner-pegged destination — force every deposit to settle back to the depositor's own wallet.
See Gateway Kit security for the full model.
The SDK is typically deployed on a backend or worker. Treat the project key the way you'd treat any other API secret — load it from a secret manager (Vault, AWS Secrets Manager, Vercel project envs, Doppler, …) or a server-only env var.
STRIDGE_PROJECT_KEY=<your-key>For Next.js, Nuxt, Astro, or any framework that ships env vars to the bundle based on a prefix: do not name this variable NEXT_PUBLIC_*, VITE_*, PUBLIC_*, or any other client-exposed prefix. The SDK only needs the key in code paths that run server-side (route handlers, server actions, edge functions, cron jobs).
Configure the client
The bare minimum to instantiate the client is a project key and an environment.
import { createApiClient } from "@stridge/sdk"
const stridge = createApiClient({
projectKey: process.env.STRIDGE_PROJECT_KEY!,
env: "prod",
})Environments
env picks the base URL the client talks to.
env | Base URL | Use for |
|---|---|---|
"prod" (default) | https://api.stridge.com/v1 | Production traffic. Real funds, mainnet chains. |
"dev" | https://api.stridge.dev/v1 | Sandbox / staging. Tied to its own project keys; rotate independently. |
Both base URLs are exported as the constants API_HTTP_PROD and API_HTTP_DEV from @stridge/sdk if you need to reference them directly (e.g., when prepending an absolute URL to a Dashboard link).
Custom base URLs
If you need to point the client at something other than the two managed hosts — a local mock, a regional fronting proxy, a self-hosted preview environment — pass baseUrl and the env field is ignored.
const stridge = createApiClient({
projectKey: process.env.STRIDGE_PROJECT_KEY!,
baseUrl: "https://gateway.internal.example.com/v1",
})The supplied URL is normalized once: trailing slashes are tolerated, relative request paths (/gateway/start) resolve against it, and absolute request paths bypass it. See API client for the full options reference.
Verify the install
A 5-second sanity check that doesn't touch authenticated endpoints:
import { createApiClient } from "@stridge/sdk"
const stridge = createApiClient({ env: "prod" })
const { assets } = await stridge.uda.supportedAssets()
console.log(`Catalogue lists ${assets.length} chain(s).`)uda.supportedAssets() is unauthenticated, so it works without projectKey — if the request resolves and prints a non-zero count, the SDK is wired up correctly. Swap the snippet for stridge.gateway.assets() (which requires projectKey) to verify the project key works too.
Next
- API client — every
createApiClientoption, the two underlying HTTP clients, and the namespaced endpoint clients. - Gateway endpoints — provision UDAs and poll settlements.
- Errors & retries —
BackendError, transport vs backend, retry guidance.