Developers

Models & types

@stridge/sdk ships from a single subpath (.), so every public type and value is reachable through one import. The barrel is small and intentional — if a type appears in this list it's part of the contract; nothing else is.

import {
  // builder
  createApiClient,
  type CreateApiClientOptions,
  type ApiClient,

  // errors
  BackendError,

  // low-level HTTP
  HttpClient,
  type HttpClientOptions,
  type RequestOptions,

  // environments
  API_HTTP_PROD,
  API_HTTP_DEV,
  getBaseUrl,

  // shared helpers
  routing,
  type EndpointCallOptions,
  type AbsoluteUrl,
  type Env,

  // models — pick the import style that fits
  models,            // namespaced — models.Gateway.GatewayUdaDto
  endpoints,         // namespaced — endpoints.Gateway.Client (type only)
  type GatewayUdaDto, // also re-exported bare via `export *`
} from "@stridge/sdk"

The package is published with "sideEffects": false, so unused imports are tree-shaken — there's no cost to importing whatever you need.

Import patterns

Models can be reached two ways:

// 1) Namespaced — useful when you handle multiple domains and want a clear prefix.
import { models } from "@stridge/sdk"
type Uda = models.Gateway.GatewayUdaDto
type Quote = models.Uda.QuoteResponse
type Balance = models.Balance.OnchainBalanceResponse

// 2) Bare — useful when you need just one or two types.
import type { GatewayUdaDto, QuoteResponse, OnchainBalanceResponse } from "@stridge/sdk"

Both styles resolve to the same types — the namespaced form just groups them. Pick the style that matches your call site; mixing in one file is fine.

For exhaustive narrowing, every DTO ships with full JSDoc on every field, so jumping to the .d.ts in your editor (or node_modules/@stridge/sdk/dist/esm/index.d.ts) is the fastest way to see the entire surface.

Builder & client

ExportKindNotes
createApiClientfunctionThe single entry point. See API client.
CreateApiClientOptionsinterfaceprojectKey, env, baseUrl, defaultHeaders.
ApiClientinterfaceThe returned shape: two HttpClients + three namespaced endpoint clients + the resolved baseUrl.

Errors

ExportKindNotes
BackendErrorclassCanonical error type. statusCode, optional cause, static BackendError.from(unknown, fallbackMessage?). See Errors & retries.

HTTP plumbing

ExportKindNotes
HttpClientclassThe transport the namespaced clients use. Exposed so callers can hit arbitrary paths.
HttpClientOptionsinterfaceprojectKey, baseUrl, defaultHeaders.
RequestOptionsinterfacePer-call: headers, query (null/undefined-dropping), plus standard fetch RequestInit fields.
EndpointCallOptionsinterfacesignal?: AbortSignal — accepted by every namespaced endpoint method.

Environment helpers

ExportKindNotes
API_HTTP_PRODconst"https://api.stridge.com/v1"
API_HTTP_DEVconst"https://api.stridge.dev/v1"
getBaseUrlfunction(env: Env) => AbsoluteUrl — same resolution createApiClient uses internally.
Envtype"prod" | "dev".
AbsoluteUrltype`https://${string}` | `http://${string}`.

Routing table

ExportKindNotes
routingconstThe full route map. Mirrors every gateway path the SDK calls; the namespaced clients are 1:1 with this object.
import { routing } from "@stridge/sdk"

routing.uda.supportedAssets       // "/uda/supported-assets"
routing.uda.quote                  // "/uda/quote"

routing.gateway.start              // "/gateway/start"
routing.gateway.assets             // "/gateway/assets"
routing.gateway.poll.template      // "/gateway/[owner]"
routing.gateway.poll.generate({ owner: walletAddress })
// → "/gateway/0x..."

routing.gateway.rateBySymbol.generate({ asset_symbol: "USDC" })
routing.gateway.rateByErc20.generate({ chain: "9001", contract_address: "0xaf88..." })

routing.balance.onchain.generate({ wallet_address: walletAddress })

Parameterized routes (gateway.poll, gateway.rateBySymbol, gateway.rateByErc20, balance.onchain) expose both a template string and a generate(params) builder; non-parameterized routes are bare strings. The builder URL-encodes every value — pass the raw wallet address or symbol, don't pre-encode.

Gateway

Everything under models.Gateway (also re-exported bare). Used by gateway.start, gateway.poll, gateway.assets, and the rate endpoints.

Requests

TypeUsed by
StartGatewayRequestgateway.start(payload)
StartDestinationRequestnested in StartGatewayRequest.destination

Responses

TypeUsed by
GatewayStartResponsegateway.start return — UDA id, destination, deposit addresses, status, metadata.
GatewayPollResponsegateway.poll return — owner, filter echo, udas[], optional pagination.
RateResponsegateway.rateBySymbol, gateway.rateByErc20 returns — amount / unit_price / total.

Entities

TypeNotes
GatewayUdaDtoOne UDA on the owner. Status enum at GatewayUdaDto.Status (idlefrom_detectedfrom_confirmedroutingto_pendingto_fundedcompleted / failed).
GatewaySettlementDtoOne matched deposit + settlement pair. Status enum at GatewaySettlementDto.Status (createdroutingcompleted / failed).
DepositAddressDtoPer-chain deposit address provisioned for the UDA, with accepted_assets[].
DepositAssetDtoOne accepted asset on a deposit address (address, decimals, symbol).
DestinationDtoResolved destination metadata for a UDA.
GatewayFilterDtoEchoed destination-tuple filter on gateway.poll responses.
GatewayLegFromDtoDeposit leg — source tx, sender, raw / human / USD amounts.
GatewayLegToDtoSettlement leg — recipient, destination tx, settled_at.
GatewayFeesDtoSettlement fees with provider / platform / total breakdown.
GatewayRouteDtoProvider + scenario + ETA. Scenario enum at GatewayRouteDto.Scenario.
GatewayEventDtoSettlement lifecycle event. Type enum at GatewayEventDto.Type.
GatewayExecutionMetadataDtoProvider-execution snapshot (LiFi / Relay tx hashes, sub-status).
GatewayExecutionDestinationDtoDestination-leg detail nested in execution metadata.
GatewayOnChainVerificationDtoGateway's own destination-tx verification.

For the full UDA polling flow that uses most of these, see Gateway endpoints — gateway.poll.

UDA

Everything under models.Uda. Used by uda.supportedAssets and uda.quote.

Responses

TypeUsed by
SupportedAssetsResponseuda.supportedAssets and gateway.assets returns.
QuoteResponseuda.quote return — from, to, fees, route, exchange_rate, expires_at.
QuoteErrorResponseTyped narrowing of ErrorResponse for quote failures.
QuoteErrorCodeOpen string union — "upstream_unavailable" | "route_unavailable" | "unsupported_asset" | "amount_too_low" | "amount_too_high" | "quote_expired" | "internal_error" | (string & {}).

isQuoteErrorResponse(value): value is QuoteErrorResponse — type guard for narrowing BackendError.cause on quote calls.

Entities

TypeNotes
SupportedAssetDtoOne chain entry in the catalogue. chain_type is widenable: "EVM" | "TVM" | (string & {}).
AssetDtoOne token contract on a chain. Optional min_deposit_usd, price_impact.
NativeCurrencyDtoOne chain's native currency. Optional min_deposit_usd, price_impact.
QuoteSideDtoSource or destination side of a quote — network_id, asset_address, amount.
QuoteFeesDtoAggregated quote fee with optional gas_fee / protocol_fee split.
QuoteRouteDtoRouting context — provider, scenario, optional estimated_time_seconds.
ChainTypeThe widenable union backing SupportedAssetDto.chain_type.

Balance

Everything under models.Balance. Used by balance.onchain.

TypeNotes
OnchainBalanceResponsebalance.onchain return — wallet_address, fetched_at, total_usd, chains[].
OnchainChainDtoOne chain's slice of the wallet — native + tokens, subtotal_usd.
OnchainTokenDtoOne token entry — symbol, raw_amount, amount, amount_usd, is_native, is_spam.

Common

Cross-cutting envelopes.

TypeNotes
OkResponse<T>Success envelope { success: true, data: T, message?: string }. Discriminated union with ErrorResponse on success. The SDK already unwraps data for you on the typed endpoint methods — OkResponse<T> is only relevant when calling httpClient directly.
ErrorResponseError envelope { success: false, code: number, error: string }. Surfaces inside BackendError.cause on JSON-bodied failures.
Pagination{ count, limit, offset }. Optional on GatewayPollResponse; reserved for future server-side pagination.

Endpoint client classes (type-only)

The endpoint clients themselves are also exported through the endpoints namespace — useful when you want to type a dependency injection seam.

import { endpoints } from "@stridge/sdk"

interface Repo {
  gateway: endpoints.Gateway.Client
  uda: endpoints.Uda.Client
  balance: endpoints.Balance.Client
}

The runtime values are also there (endpoints.Gateway.Client is a class you could new directly with an HttpClient), but the canonical path is to instantiate them through createApiClient — bypassing the builder skips reserved-header sanitization and the shared baseUrl plumbing.

Where field-level docs live

Every interface and field above carries JSDoc on the source. The fastest path to the full reference for any DTO is:

  • In your editor: jump to definition (gd / F12) on the type name.
  • On disk: open node_modules/@stridge/sdk/dist/esm/index.d.ts. The file is one barrel re-export; every interface lands a few clicks away through the IDE.
  • In source (if vendored): kit/packages/sdk/src/models/{Gateway,Uda,Balance,Common}/.
Was this page helpful?