TypeScript SDK
Install and use the @settlemint/dalp-sdk package for fully typed, auto-completed access to the DALP API from any TypeScript project.
The @settlemint/dalp-sdk package is the recommended way to interact with the DALP API from TypeScript. It provides a fully typed client with auto-complete for every API namespace — tokens, identities, compliance, transactions, and more — without code generation or OpenAPI tooling.
Why use the SDK over the OpenAPI client?
- Zero code generation — install the package and start calling methods immediately
- Contract-first types — auto-complete for every route, input, and output derived from the API contract
- Custom serializers —
BigInt,BigDecimal, andTimestampvalues serialize correctly out of the box - Client-side validation — requests are validated against the API schema before sending, catching mistakes early
- Tree-shakeable — import only what you need; unused namespaces are removed at build time
Installation
# npm
npm install @settlemint/dalp-sdk
# bun
bun add @settlemint/dalp-sdkPeer dependency: the SDK requires zod >= 4.0.0. Most projects already have it — if not, install it alongside the SDK.
Create a client
import { createDalpClient } from "@settlemint/dalp-sdk";
const dalp = createDalpClient({
url: "https://your-platform.example.com",
apiKey: "sm_dalp_xxxxxxxxxxxxxxxx",
});That's it. dalp is now a fully typed client with auto-complete for every API namespace.
Configuration options
| Option | Type | Default | Description |
|---|---|---|---|
url | string | — | Base URL of your DALP deployment (e.g., "https://dalp.example.com") |
apiKey | string | — | API key from the DALP dashboard (Settings → API Keys) or dalp login |
organizationId | string | — | Organization ID for multi-org setups. Required when the key spans multiple organizations. |
headers | Record<string, string> or () => ... | — | Additional headers merged into every request. Can override User-Agent but not security headers. |
idempotencyKey | string | — | Sent as Idempotency-Key header on every request. Only use for single-mutation clients (see warning below). |
requestValidation | boolean | true | Validate outgoing requests against the API contract before sending. |
responseValidation | boolean | false | Validate incoming responses against the API contract. Useful during development. |
fetch | typeof globalThis.fetch | — | Custom fetch implementation for proxies, logging, or test doubles. |
Usage examples
List tokens
const tokens = await dalp.token.list({ query: {} });
for (const token of tokens.items) {
console.log(token.name, token.symbol, token.tokenAddress);
}Get system info
const system = await dalp.system.read({});
console.log("Platform:", system.name);
console.log("Version:", system.version);Create a token
const token = await dalp.token.create({
body: {
name: "Acme Bond",
symbol: "ABOND",
assetType: "bond",
decimals: 18,
},
});
console.log("Created:", token.tokenAddress);Mint tokens
import { from as dnumFrom } from "dnum";
await dalp.token.mint({
body: {
tokenAddress: "0xABCD...",
recipients: ["0x1234..."],
amounts: [dnumFrom("1000", 18)],
},
});Search
const results = await dalp.search.query({
query: { q: "Acme" },
});
for (const hit of results.items) {
console.log(hit.type, hit.name);
}Type-only imports
When you only need types for function signatures (not runtime code), import from the /types subpath to keep your bundle lean:
import type { DalpClient, DalpClientConfig } from "@settlemint/dalp-sdk/types";
function createMyClient(config: DalpClientConfig): DalpClient {
// ...
}Plugins
The SDK ships optional oRPC link plugins for advanced use cases:
import { BatchLinkPlugin, RequestValidationPlugin } from "@settlemint/dalp-sdk/plugins";These are re-exports from @orpc/client and @orpc/contract — use them if you need to customize the link pipeline beyond the defaults.
Error handling
The SDK uses oRPC's error model. All errors are instances of ORPCError with a code property:
import { ORPCError } from "@orpc/client";
import { CUSTOM_ERROR_CODES } from "@settlemint/dalp-sdk";
try {
await dalp.token.read({ query: { address: "0x0000..." } });
} catch (error) {
if (error instanceof ORPCError) {
if (error.code === "NOT_FOUND") {
console.log("Token does not exist");
} else if (error.code === CUSTOM_ERROR_CODES.USER_NOT_AUTHORIZED) {
console.log("This operation requires elevated permissions");
} else {
throw error;
}
} else {
throw error;
}
}For the complete list of error codes and handling strategies, see Error handling.
Using with the DALP CLI
The DALP CLI uses the SDK internally. If you already have the CLI installed, you can reuse its authentication:
# Authenticate and get an API key
dalp login
# Show your credentials
dalp whoami --format jsonThen use the API key from dalp login in your SDK client configuration.
Next steps
- API reference — explore all available endpoints and schemas
- Error handling — handle errors gracefully in production
- Token lifecycle — understand the full token operation flow
- Asset decimals — work correctly with token precision and BigDecimal values