Installation
@stridge/gateway-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/gateway-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. In a React app, @stridge/gateway-kit gives you the UI on top. |
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's projectKey is your gateway key: the ID of a live API key that carries the Gateway scope. The Kit's gatewayKey, the SDK's projectKey, and the HTTP API's X-Gateway-Key header are three names for the same value.
Sign in at dashboard.stridge.com (opens in a new tab), switch to live, and choose Developer → Gateway Kit → Create gateway kit. Enter a Brand name and, optionally, an Allowed origin, then choose Create key. Any live key you give the Gateway scope under Developer → API Keys works too.
Copy the Gateway key from the dialog, or later from the kit's Overview. It is the key's ID, not its secret, so it is safe to expose and you can copy it again at any time.
In the kit's Settings:
- Referrer whitelist: the origins allowed to call the gateway with this key.
- Require same owner: funds settle only to the depositor's own address. It is on for a new kit.
- Destination control addresses: with Require same owner off, the only addresses funds may settle to.
See Gateway Kit security for the full model.
Load the key from your environment or config loader:
STRIDGE_PROJECT_KEY=<your-gateway-key>A key with a Referrer whitelist is refused on any request whose Origin or Referer is not on the list, including a server request that sends neither. For calls from a backend or worker, use a kit with an empty referrer whitelist, or send an Origin header that is on the list through defaultHeaders.
Configure the client
The bare minimum to instantiate the client is a project key and an environment.
import { createApiClient } from "@stridge/gateway-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 | Every integration. Real funds, mainnet chains. |
"dev" | Stridge's pre-release host | Stridge's own testing only. It does not accept your workspace's keys. |
The gateway works with live keys only — a sandbox key (sk_sbx_…) gets 403 — so the SDK has no sandbox mode. Keep env at "prod".
Both base URLs are exported as the constants API_HTTP_PROD and API_HTTP_DEV from @stridge/gateway-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/gateway-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.