@kashdao/sdk package is a hand-written TypeScript client for the REST API. It’s the recommended way to integrate from any TS/JS runtime — Node 22+, modern browsers, Deno, Bun, or Cloudflare Workers.
Construct the client
kash.markets, kash.trades, kash.portfolio, kash.webhooks, kash.account, kash.traces.
Place a trade
Pagination — async iteration
Every list method returns aPage<T> that’s both the first page and an AsyncIterable<T>:
Get a quote
Verify a webhook
Typed errors
Every error is a typed subclass ofKashError:
Lifecycle hooks
Tap into every request, response, retry, and error for logging or observability:Cloning a client
withConfig returns a new client with overridden fields. Useful for tenant switching or per-request key swaps:
withConfig re-validates — passing an invalid override throws KashConfigurationError.
Mock client for tests
@kashdao/sdk/testing exports a fake client with realistic default fixtures:
Versioning
The SDK follows SemVer. TheKashError shape, public method signatures, and exported types are SemVer-stable. Internals (private fields, pagination tokens, transport details) are not — pin to a major version range in package.json.
The SDK auto-includes a User-Agent header identifying its version, so we can correlate API logs with SDK versions when investigating issues.
Pin against a specific API contract version
Send theX-Kash-Api-Version request header to lock your integration against a specific contract date. The SDK can be configured to send it on every request:
X-API-Version (the canonical version) plus Sunset / Deprecation headers when your pinned version is winding down (12-month deprecation window per RFC 8594). The SDK’s onResponse hook surfaces both — wire it into your monitoring to flag deprecations early. Pinning to an unknown date returns 410 API_VERSION_UNSUPPORTED with the supported list in metadata.supported.
Quality gates
The SDK ships with strict quality gates that are part of the public contract:- Bundle size budgets — main entry ≤ 24 KB gzipped,
/testingsubpath ≤ 8 KB. Enforced at publish time viasize-limit. - Static type tests —
pnpm test:typesruns vitest’s typecheck mode againsttests/types/public-types.test-d.ts. The public TypeScript surface is locked: any change to a public type’s shape fails compilation, forcing a deliberate CHANGELOG + version bump. - Public-barrel snapshot —
tests/unit/barrel-snapshot.test.tspins the exact set of exported names. Accidental removals fail the build. - Wire-shape contract —
tests/contract/wire-shape.test.tsasserts every resource schema matches canonical fixtures. Ships to the public mirror.
Source & changelog
- npm:
@kashdao/sdk - GitHub:
KashDAO/sdk-typescript(public mirror) - Changelog:
CHANGELOG.md - Versioned OpenAPI snapshots: the live spec is served at
api.kash.bot/v1/openapi.json; historical pinned versions are listed atapi.kash.bot/v1/openapi/index.json— pin against a specific date for reproducible code generation. - Issues / discussions: github.com/KashDAO/sdk-typescript/issues
Next
CLI
kash — the command-line interface. Same primitives, scripting-friendly.Endpoint Reference
The full live spec at
/v1/docs.