@settlemint/dalp-sdk 3.1.26-main.37116470199 → 3.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/README.md +172 -239
  2. package/dist/api-types.generated.d.ts +14160 -0
  3. package/dist/api-types.generated.d.ts.map +1 -0
  4. package/dist/{auth/permissions.d.ts → auth-permissions.d.ts} +8 -0
  5. package/dist/auth-permissions.d.ts.map +1 -0
  6. package/dist/{auth/wallet-plugins.d.ts → auth-wallet-plugins.d.ts} +6 -68
  7. package/dist/auth-wallet-plugins.d.ts.map +1 -0
  8. package/dist/auth.d.ts +115 -8
  9. package/dist/auth.d.ts.map +1 -0
  10. package/dist/bundler.d.ts +217 -0
  11. package/dist/bundler.d.ts.map +1 -0
  12. package/dist/chunk-xm8h1dzh.js +33 -0
  13. package/dist/client.d.ts +19 -0
  14. package/dist/client.d.ts.map +1 -0
  15. package/dist/contract-errors.d.ts +4156 -0
  16. package/dist/contract-errors.d.ts.map +1 -0
  17. package/dist/contract.d.ts +22 -0
  18. package/dist/contract.d.ts.map +1 -0
  19. package/dist/cookie-store.d.ts +10 -0
  20. package/dist/cookie-store.d.ts.map +1 -0
  21. package/dist/dapi-errors.d.ts +654 -0
  22. package/dist/dapi-errors.d.ts.map +1 -0
  23. package/dist/errors.d.ts +637 -0
  24. package/dist/errors.d.ts.map +1 -0
  25. package/dist/index.d.ts +45 -28
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +96216 -150
  28. package/dist/platform.d.ts +41 -0
  29. package/dist/platform.d.ts.map +1 -0
  30. package/dist/plugins/index.d.ts +13 -0
  31. package/dist/plugins/index.d.ts.map +1 -0
  32. package/dist/plugins/index.js +10 -0
  33. package/dist/sdk-error.d.ts +74 -0
  34. package/dist/sdk-error.d.ts.map +1 -0
  35. package/dist/serializers.d.ts +41 -0
  36. package/dist/serializers.d.ts.map +1 -0
  37. package/dist/types.d.ts +114 -37
  38. package/dist/types.d.ts.map +1 -0
  39. package/dist/url.d.ts +1 -0
  40. package/dist/url.d.ts.map +1 -0
  41. package/dist/verify-webhook.d.ts +28 -17
  42. package/dist/verify-webhook.d.ts.map +1 -0
  43. package/dist/version.d.ts +3 -0
  44. package/dist/version.d.ts.map +1 -0
  45. package/dist/version.generated.d.ts +8 -0
  46. package/dist/version.generated.d.ts.map +1 -0
  47. package/dist/wait-for-transaction.d.ts +86 -44
  48. package/dist/wait-for-transaction.d.ts.map +1 -0
  49. package/dist/webhook-events.d.ts +33 -543
  50. package/dist/webhook-events.d.ts.map +1 -0
  51. package/package.json +34 -110
  52. package/dist/auth/client.d.ts +0 -103
  53. package/dist/auth/invite-step-up.d.ts +0 -2
  54. package/dist/auth/live.d.ts +0 -47
  55. package/dist/auth/native-passkey.d.ts +0 -9
  56. package/dist/auth-surface.d.ts +0 -2
  57. package/dist/auth.js +0 -525
  58. package/dist/chunk-4f4kjtt0.js +0 -149
  59. package/dist/chunk-b03ycwb7.js +0 -68
  60. package/dist/chunk-ghgcmyhk.js +0 -5
  61. package/dist/chunk-h241xecg.js +0 -1625
  62. package/dist/chunk-hqz56e6q.js +0 -4
  63. package/dist/chunk-k3ntysxx.js +0 -57
  64. package/dist/chunk-pjjrxre1.js +0 -36
  65. package/dist/chunk-qvtjb3dz.js +0 -102
  66. package/dist/chunk-v54k7mgr.js +0 -271
  67. package/dist/chunk-w361dpdk.js +0 -5
  68. package/dist/client/conditional-request.d.ts +0 -8
  69. package/dist/client/factory.d.ts +0 -4
  70. package/dist/client/query-serializer.d.ts +0 -1
  71. package/dist/client/request-compression.d.ts +0 -12
  72. package/dist/client/ssr-fetch.d.ts +0 -10
  73. package/dist/client/step-up-challenge.d.ts +0 -10
  74. package/dist/effect.d.ts +0 -38
  75. package/dist/effect.js +0 -87
  76. package/dist/errors/api-error.d.ts +0 -35
  77. package/dist/errors/error-codes.d.ts +0 -21
  78. package/dist/errors/find-current-error.d.ts +0 -2
  79. package/dist/errors/sdk-error.d.ts +0 -52
  80. package/dist/errors/sdk-error.js +0 -8
  81. package/dist/generated/api-types.d.ts +0 -69961
  82. package/dist/generated/console-routes.d.ts +0 -12
  83. package/dist/generated/error-catalog.d.ts +0 -9
  84. package/dist/generated/error-codes.d.ts +0 -9
  85. package/dist/generated/response-scalars.d.ts +0 -9
  86. package/dist/generated/response-schemas.d.ts +0 -9
  87. package/dist/generated/route-error-codes.d.ts +0 -9
  88. package/dist/generated/routes.d.ts +0 -12
  89. package/dist/proxy/builder.d.ts +0 -17
  90. package/dist/proxy/client-core.d.ts +0 -28
  91. package/dist/proxy/client.d.ts +0 -5
  92. package/dist/proxy/fetch-executor.d.ts +0 -6
  93. package/dist/proxy/flat-args.d.ts +0 -24
  94. package/dist/proxy/response-decode.d.ts +0 -37
  95. package/dist/proxy/sse.d.ts +0 -11
  96. package/dist/proxy/step-up-challenge.d.ts +0 -4
  97. package/dist/proxy/tanstack.d.ts +0 -6
  98. package/dist/proxy/transport.d.ts +0 -63
  99. package/dist/react-query.d.ts +0 -2
  100. package/dist/react-query.js +0 -12
  101. package/dist/readonly-deep.d.ts +0 -3
  102. package/dist/routes/console.d.ts +0 -14
  103. package/dist/routes/console.js +0 -25
  104. package/dist/routes/index.d.ts +0 -4
  105. package/dist/routes/index.js +0 -10
  106. package/dist/routes/types.d.ts +0 -72
  107. package/dist/runtime-exports.d.ts +0 -4
  108. package/dist/runtime-exports.js +0 -16
  109. package/dist/runtime.d.ts +0 -11
  110. package/dist/scalars/big-decimal.d.ts +0 -4
  111. package/dist/scalars/ethereum-address.d.ts +0 -5
  112. package/dist/scalars/exchange-rates.d.ts +0 -13
  113. package/dist/scalars/index.d.ts +0 -10
  114. package/dist/scalars/index.js +0 -102
  115. package/dist/scalars/organization-id.d.ts +0 -5
  116. package/dist/scalars/token-decimals.d.ts +0 -4
  117. package/dist/secret.d.ts +0 -12
  118. package/dist/sign-webhook-receipt.d.ts +0 -16
  119. package/dist/sign-webhook-receipt.js +0 -26
  120. package/dist/transport/cookie-store.d.ts +0 -9
  121. package/dist/transport/sse-lifecycle.d.ts +0 -24
  122. package/dist/verify-webhook.js +0 -8
  123. package/dist/wait-for-transaction.js +0 -151
package/README.md CHANGED
@@ -1,273 +1,206 @@
1
- # DALP SDK
2
-
3
- One typed client for the Platform API v2, derived from the platform's own route
4
- declaration. Calls are namespaced (`dalp.api.token.transfer(...)`), a queue
5
- backed write resolves once the chain has settled, and TanStack Query factories
6
- sit on the same nodes as the calls. The package ships no runtime schema
7
- library: the types are compile time only.
8
-
9
- Two interpreters over one route table. The package root returns promises. The
10
- `./effect` subpath returns Effect values with a typed failure channel. Neither
11
- pulls the other in, and a build gate keeps the root free of Effect.
1
+ <p align="center">
2
+ <img src="https://github.com/settlemint/sdk/blob/main/logo.svg" width="200px" align="center" alt="SettleMint logo" />
3
+ <h1 align="center">DALP SDK</h1>
4
+ <p align="center">
5
+ <a href="https://settlemint.com">https://settlemint.com</a>
6
+ <br/>
7
+ Fully typed TypeScript SDK for the Digital Asset Lifecycle Platform API.
8
+ </p>
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="https://www.npmjs.com/package/@settlemint/dalp-sdk" rel="nofollow"><img src="https://img.shields.io/npm/v/@settlemint/dalp-sdk" alt="npm version"></a>
13
+ <a href="https://www.npmjs.com/package/@settlemint/dalp-sdk" rel="nofollow"><img src="https://img.shields.io/npm/dw/@settlemint/dalp-sdk" alt="npm downloads"></a>
14
+ </p>
15
+
16
+ <div align="center">
17
+ <a href="https://settlemint.com">Website</a>
18
+ <span>&nbsp;&nbsp;&bull;&nbsp;&nbsp;</span>
19
+ <a href="https://www.npmjs.com/package/@settlemint/dalp-sdk">NPM</a>
20
+ <span>&nbsp;&nbsp;&bull;&nbsp;&nbsp;</span>
21
+ <a href="mailto:support@settlemint.com">Support</a>
22
+ <br />
23
+ </div>
24
+
25
+ ## About
26
+
27
+ The DALP SDK provides a fully typed client for the Digital Asset Lifecycle Platform API. Built on [oRPC](https://orpc.unnoq.com/) with contract-first types, it gives you auto-complete for every API namespace — tokens, identities, compliance, transactions, and more.
28
+
29
+ ## Installation
30
+
31
+ ```bash
32
+ # npm
33
+ npm install @settlemint/dalp-sdk
34
+
35
+ # bun
36
+ bun add @settlemint/dalp-sdk
37
+ ```
12
38
 
13
- ## Client
39
+ ## Quick Start
14
40
 
15
- ```ts
41
+ ```typescript
16
42
  import { createDalpClient } from "@settlemint/dalp-sdk";
17
43
 
18
44
  const dalp = createDalpClient({
19
- baseUrl: "https://dalp.example.com",
45
+ url: "https://dalp.example.com",
20
46
  apiKey: "sm_dalp_...",
47
+ organizationId: "org_...", // optional, for multi-org setups
21
48
  });
22
49
 
23
- const tokens = await dalp.api.token.list({ page: { limit: 25 } }, { signal });
50
+ // Every method is fully typed with auto-complete
51
+ const tokens = await dalp.token.list({ query: {} });
52
+ const system = await dalp.system.read({});
24
53
  ```
25
54
 
26
- A call takes one flat object. The route table says which of its keys are path
27
- parameters and which are query or body fields, so a call site names what it
28
- means and never restates the transport. The build refuses any route whose path
29
- parameter would collide with a body or query key, which is what makes the
30
- merge safe.
31
-
32
- `createDalpClient` owns the shared transport policy once: the credential
33
- mechanism, the acting-context headers (`organizationId`, `participant`,
34
- `executor`, `chainId`, `selectedSigners`, `idempotencyKey`), conditional
35
- `If-None-Match` reuse, custom fetch injection, the settlement bound, and abort
36
- propagation.
37
-
38
- **An API key cannot reach a browser or an app.** `createDalpClient` and
39
- `createDalpAuthClient` throw at construction when a key is passed with
40
- `runtime: "browser"` or `runtime: "react-native"`, rather than at the first
41
- request. A key carries the
42
- full authority of the identity it belongs to, and anything bundled into a web
43
- page or an app ships to every user. There the client authenticates with the
44
- session cookie instead.
45
-
46
- ### Dispatch by route id
47
-
48
- ```ts
49
- const token = await dalp.execute("token/read", { assetId });
50
- ```
55
+ ## Auth Client
51
56
 
52
- `execute` is typed against the id through the `DalpRouteTypes` registry, so a
53
- command surface built from route ids keeps the same request and response types
54
- the namespaced tree gives a call site. The CLI, the end-to-end harness, and the
55
- demo scripts are all built on it.
56
-
57
- ### Settlement
58
-
59
- A queue-backed write carries a `Prefer` header derived from
60
- `settlementTimeoutMs`: undefined asks for `wait=15`, zero or less asks for
61
- `respond-async`, anything else asks for `wait=<seconds>`, clamped to the
62
- platform's 5 to 99 second range. `settlementTimeoutMs` sets that bound per
63
- client, and a call may override it.
64
-
65
- The platform does the waiting, not the client. When the write settles inside
66
- the wait, the call returns the route's HTTP 200 resource. When it does not, the
67
- call returns the declared HTTP 202 handle unchanged: a transaction write's
68
- `{ transactionId, status, statusUrl }`, or a custody write's `{ requestId,
69
- state, statusUrl }`. The client never polls a status URL on your behalf.
70
-
71
- Pass a transaction id to `waitForTransaction` to follow it to a terminal
72
- state. A write the funding gate parks on an operator payment reads as still
73
- queued for as long as the ask is open: the status row carries it as
74
- `activeRequirement`, and `waitForTransaction` restarts its own timeout on every
75
- status that reports one, so the wait it runs outlasts the pause. A caller that
76
- cannot wait that long ends the wait through `signal`, or passes
77
- `holdWhilePaused: false` to end on the first parked status instead. A custody
78
- handle has no equivalent helper: follow `statusUrl` yourself.
79
-
80
- ### Conditional requests and ETags
81
-
82
- The client reuses a held body when the server answers a matching ETag with 304.
83
- Server ETags must be **strong content digests** computed **after
84
- authorization** inside the requester's partition. Version-stamp ETags
85
- (generation counters, watermarks, table versions) are forbidden for conditional
86
- request adopters: a stamp can collide across tenants or lag a body change.
87
-
88
- Identity changes that do not ride this client (browser sign-out, organization
89
- switch) must clear the held bodies, so a later GET cannot send another
90
- session's `If-None-Match`.
91
-
92
- ```ts
93
- dalp.conditionalRequests.clear();
94
- ```
57
+ Use `createDalpAuthClient` for Better Auth operations such as sign-up, session listing, organization management, API
58
+ keys, device authorization, and wallet verification setup.
95
59
 
96
- ## Effect
60
+ ```typescript
61
+ import { createDalpAuthClient } from "@settlemint/dalp-sdk";
97
62
 
98
- ```ts
99
- import { createDalpEffectClient } from "@settlemint/dalp-sdk/effect";
63
+ const auth = createDalpAuthClient({
64
+ url: "https://dalp.example.com",
65
+ apiKey: "sm_dalp_...",
66
+ organizationId: "org_...",
67
+ });
100
68
 
101
- const dalp = createDalpEffectClient({ baseUrl, apiKey });
102
- const tokens = yield * dalp.api.token.list({ page: { limit: 25 } });
69
+ const apiKeys = await auth.apiKey.list();
103
70
  ```
104
71
 
105
- The same routes, returning `Effect` values that fail with `DalpRequestError`
106
- rather than throwing. `execute` is typed by route id here too.
72
+ For Node-side session flows, use the platform client. It keeps Better Auth cookies in an SDK-owned store and exposes the
73
+ DAPI client and auth client together.
107
74
 
108
- ## The route table
75
+ ```typescript
76
+ import { createDalpPlatformClient } from "@settlemint/dalp-sdk";
109
77
 
110
- ```ts
111
- import { routeIds, routeTable } from "@settlemint/dalp-sdk/routes";
112
- ```
113
-
114
- `./routes` publishes the generated table both interpreters dispatch through:
115
- every v2 route's id, method, path template, statuses, and traits. It carries no
116
- client and no Effect, so a tool that only needs to know what the platform
117
- serves loads this rather than a client.
78
+ const platform = createDalpPlatformClient({
79
+ url: "https://dalp.example.com",
80
+ });
118
81
 
119
- ## TanStack Query
82
+ await platform.auth.signUp.email({
83
+ email: "user@example.com",
84
+ password: "Password123!",
85
+ name: "Example User",
86
+ });
120
87
 
121
- ```ts
122
- const options = dalp.api.token.list.queryOptions({ page: { limit: 25 } });
123
- const transfer = dalp.api.token.transfer.mutationOptions();
88
+ const sessionCookie = platform.cookieStore.header;
124
89
  ```
125
90
 
126
- Every read node carries `queryOptions`; every write node carries
127
- `mutationOptions`. They are plain objects in the shapes TanStack
128
- Query expects, so nothing forces you into that library and nothing stops you
129
- using something else.
130
-
131
- Cache keys are derived from route identity plus canonicalized input, so two
132
- callers passing the same parameters in a different key order share one entry.
133
- `./react-query` exports `queryKeyFor` and `canonicalize` for building a
134
- matching invalidation filter, and `UI_SETTLEMENT_TIMEOUT_MS`, the bound the
135
- mutation factories default to.
136
-
137
- ## Scalars
138
-
139
- Custom wire formats (BigDecimal amounts, EVM addresses, and the
140
- `OrganizationId` entity brand) are not expressed structurally in the generated
141
- OpenAPI document, so `./scalars` carries a decoder for each:
142
- `decodeBigDecimal`, `decodeEthereumAddress`, `decodeOrganizationId`, and the
143
- exchange-rate response transformer. The route table names which fields carry a
144
- scalar, keyed by dotted path, so a consumer applies a decoder where the
145
- declaration says one lives rather than guessing from a field name.
146
- `OrganizationId` is the only entity id branded end to end across the platform;
147
- every other identifier crossing this boundary is a plain string.
148
-
149
- ## Auth
150
-
151
- ```ts
152
- import { createDalpAuthClient } from "@settlemint/dalp-sdk/auth";
91
+ ### Auth Namespaces
92
+
93
+ All namespaces below are fully typed on `DalpAuthClient` — every operation has auto-complete and a typed return value.
94
+
95
+ | Namespace | Operations | Description |
96
+ | --------------------- | ------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- |
97
+ | `signIn` | `email` | Sign in with email and password |
98
+ | `signUp` | `email` | Register a new account |
99
+ | `getSession` | — | Fetch the current session |
100
+ | `listSessions` | — | List all active sessions |
101
+ | `revokeSession` | — | Revoke a specific session |
102
+ | `revokeOtherSessions` | — | Revoke all sessions except the current one |
103
+ | `apiKey` | `create`, `list`, `delete` | Manage API keys |
104
+ | `organization` | `create`, `list`, `setActive`, `inviteMember`, `acceptInvitation`, `listMembers`, `addMember`, `removeMember` | Manage organizations and membership |
105
+ | `admin` | `listUsers`, `createUser`, `removeUser`, `setRole` | Administrative user management |
106
+ | `device` | `code`, `token`, `approve`, `deny` | Device authorization flow |
107
+ | `twoFactor` | `enable`, `disable`, `verifyTotp`, `verifyBackupCode`, `generateBackupCodes` | Account-level TOTP two-factor authentication |
108
+ | `wallet.pincode` | `enable`, `disable`, `update`, `reset` | Wallet pincode protection |
109
+ | `wallet.twoFactor` | `enable`, `disable`, `verify` | Wallet two-factor verification |
110
+ | `wallet.secretCodes` | `generate`, `confirm` | Wallet secret (recovery) codes |
111
+ | `passkey` | — | Account-level passkey registration (browser/WebAuthn only) |
112
+
113
+ ```typescript
114
+ // Enable account-level 2FA and verify a TOTP code
115
+ await auth.twoFactor.enable({ password: "..." });
116
+ await auth.twoFactor.verifyTotp({ code: "123456" });
153
117
  ```
154
118
 
155
- The route surface already carries every auth REST route. `./auth` covers what a
156
- REST call cannot express: the session and cookie state machine, plugin actions
157
- that must run on the device (`passkeyClient` drives the WebAuthn ceremony
158
- through `navigator.credentials`, or through the `passkey` ceremony a React
159
- Native app passes), and the access-control model that evaluates a
160
- permission locally instead of round-tripping. It sits off the package root
161
- because it costs roughly 70 KiB of Better Auth that a consumer who only calls
162
- routes should not pay.
163
-
164
- Better Auth's client types reference zod, so `zod` is an optional peer
165
- dependency: install it if you use `./auth`, skip it otherwise. No code in this
166
- package imports zod at runtime.
167
-
168
- An API key works on 8 auth routes only. Each of them is a read:
169
-
170
- - `GET /get-session`
171
- - `GET /organization/list`
172
- - `GET /organization/get-full-organization`
173
- - `GET /organization/list-members`
174
- - `POST /organization/has-permission`
175
- - `GET /api-key/list`
176
- - `GET /api-key/get`
177
- - `GET /passkey/list-user-passkeys`
178
-
179
- Every other auth route answers a request that carries a key with HTTP 403 and
180
- the code `API_KEY_NOT_SUPPORTED_ON_ROUTE`. Use a session cookie for those
181
- routes. The API key guide in the DALP API reference has the details.
182
-
183
- ## React Native
184
-
185
- Supported: Expo SDK 57 (React Native 0.86, React 19.2), with `fetch` from
186
- `expo/fetch` passed to both clients. The SDK detects React Native from
187
- `navigator.product` and then keeps the session in its own cookie store, sends
188
- `credentials: "omit"`, refuses an API key, and sends the platform's origin as
189
- `Origin` on every call.
190
-
191
- ```ts
192
- import { createCookieStoreFetch, createDalpClient, makeCookieStore } from "@settlemint/dalp-sdk";
193
- import { createDalpAuthClient } from "@settlemint/dalp-sdk/auth";
194
- import { fetch } from "expo/fetch";
195
-
196
- const cookieStore = makeCookieStore((await SecureStore.getItemAsync("dalp.session")) ?? "");
197
- const auth = await createDalpAuthClient({ url, cookieStore, fetch, passkey: ceremony });
198
- const dalp = createDalpClient({ baseUrl: url, fetch: createCookieStoreFetch(cookieStore, fetch) });
119
+ ```typescript
120
+ // Enable wallet pincode protection
121
+ await auth.wallet.pincode.enable({ pincode: "1234", password: "..." });
199
122
  ```
200
123
 
201
- - React Native's built-in `fetch` works for calls but cannot read a stream; a
202
- stream on it fails with `sdk.stream.UNREADABLE_BODY` before the request is
203
- sent. Use `expo/fetch`.
204
- - React Native has no WebAuthn. Pass a `passkey` ceremony (`DalpPasskeyCeremony`:
205
- `authenticate` and `register`, each taking the platform's options JSON and
206
- returning the credential JSON) backed by a native passkey module.
207
- - Persist `cookieStore.header()` in secure storage yourself; the SDK holds it in
208
- memory only.
209
-
210
- The SDK's tests run this wiring headless on the fetch and abort polyfills React
211
- Native ships and a model of `expo/fetch`. They do not run on Hermes, a
212
- simulator, or a device.
213
-
214
- ## Bundler and paymaster
215
-
216
- Use JSON-RPC 2.0 over `POST https://dalp.example.com/bundler/{chainId}` for
217
- account-abstraction calls. `{chainId}` is the decimal EVM chain ID; this is
218
- not an `/api/v2` REST route and is not exposed through `dalp.api` or a separate
219
- SDK bundler client. From a server, send a write-capable API key in `x-api-key`;
220
- the key's active organization selects the tenant. Never put the key in browser
221
- code.
222
-
223
- The mount serves these standard methods:
224
-
225
- | Method | Params |
226
- | ------------------------------ | ----------------------------------------------- |
227
- | `eth_chainId` | `[]` |
228
- | `eth_sendUserOperation` | `[userOperation, entryPoint]` |
229
- | `eth_estimateUserOperationGas` | `[userOperation, entryPoint]` |
230
- | `eth_getUserOperationByHash` | `[userOperationHash]` |
231
- | `eth_getUserOperationReceipt` | `[userOperationHash]` |
232
- | `eth_supportedEntryPoints` | `[]` |
233
- | `pm_getPaymasterData` | `[userOperation, entryPoint, chainId, context]` |
234
- | `pm_getPaymasterStubData` | `[userOperation, entryPoint, chainId, context]` |
235
-
236
- The UserOperation must be signed by your account-abstraction stack before
237
- `eth_sendUserOperation`. The mount accepts EntryPoint v0.7 UserOperations and
238
- returns JSON-RPC `result` or `error` envelopes, not REST `{ data, links }`
239
- resources. `eth_chainId` reports the chain selected by the URL. Consult the platform's bundler
240
- method policy before depending on a method being enabled for your credential.
241
-
242
- ```ts
243
- const response = await fetch("https://dalp.example.com/bundler/1", {
244
- method: "POST",
245
- headers: {
246
- "content-type": "application/json",
247
- "x-api-key": apiKey,
248
- },
249
- body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "eth_supportedEntryPoints", params: [] }),
124
+ ## Configuration
125
+
126
+ ```typescript
127
+ import { createDalpClient } from "@settlemint/dalp-sdk";
128
+
129
+ const dalp = createDalpClient({
130
+ // Required
131
+ url: "https://dalp.example.com",
132
+
133
+ // Required for authenticated routes
134
+ apiKey: "sm_dalp_...",
135
+
136
+ // Optional
137
+ organizationId: "org_...", // multi-org scoping
138
+ headers: { "User-Agent": "MyApp" }, // override default headers
139
+ idempotencyKey: "req_abc123", // ⚠️ sent on EVERY request — use only for single-mutation clients
140
+ requestValidation: false, // validate requests client-side (default: false)
141
+ responseValidation: false, // validate responses client-side (default: false)
142
+ fetch: customFetch, // custom fetch implementation
250
143
  });
251
- const answer = await response.json(); // { jsonrpc: "2.0", id: 1, result: [...] } or { error: ... }
252
144
  ```
253
145
 
254
- ## Webhooks and transaction wait
146
+ ## API Namespaces
147
+
148
+ | Namespace | Description |
149
+ | ------------------ | -------------------------- |
150
+ | `account` | Manage accounts |
151
+ | `actions` | Manage actions |
152
+ | `addons` | Manage addons |
153
+ | `admin` | Administrative operations |
154
+ | `contacts` | Manage contacts |
155
+ | `exchangeRates` | View exchange rates |
156
+ | `externalToken` | Manage external tokens |
157
+ | `identityRecovery` | Recover lost identities |
158
+ | `monitoring` | Platform monitoring |
159
+ | `search` | Search across the platform |
160
+ | `settings` | Platform settings |
161
+ | `system` | System administration |
162
+ | `token` | Manage security tokens |
163
+ | `transaction` | View transactions |
164
+ | `user` | Manage platform users |
165
+
166
+ ## Endpoint Coverage
167
+
168
+ The SDK covers 100% of the v2 REST API: it is generated from the same oRPC contract that the server implements, and a
169
+ CI check (`bun run check:sdk-coverage`) diffs every mounted API route against the contract on every change. Endpoints
170
+ intentionally outside the SDK contract are named in a committed allowlist with a reason each, in these categories:
171
+
172
+ - **v1-frozen** — the deliberately frozen v1 REST surface
173
+ - **internal-ops** — health probes, CSP report sink, theme CSS, static manifests
174
+ - **webhook-receiver** — provider webhook receivers (DFNS, Ripple, compliance providers)
175
+ - **better-auth** — auth plumbing, covered by the SDK auth client instead
176
+ - **docs / asset-delivery / bundler / orpc-mount** — API docs pages, binary asset delivery, the ERC-4337 bundler
177
+ JSON-RPC passthrough (covered by the SDK bundler client), and the oRPC transport mounts themselves
178
+
179
+ ## Subpath Exports
180
+
181
+ ```typescript
182
+ // Main entry — client factory, error codes, serializers
183
+ import { createDalpAuthClient, createDalpClient, createDalpPlatformClient } from "@settlemint/dalp-sdk";
184
+
185
+ // Type-only — for function signatures without runtime code
186
+ import type { DalpClient, DalpClientConfig } from "@settlemint/dalp-sdk/types";
187
+
188
+ // Plugins — optional oRPC link plugins for advanced usage
189
+ import { BatchLinkPlugin, RequestValidationPlugin } from "@settlemint/dalp-sdk/plugins";
190
+ ```
191
+
192
+ ## Security
255
193
 
256
- - `./verify-webhook` verifies an inbound webhook signature.
257
- - `./sign-webhook-receipt` signs a webhook delivery receipt (Node only).
258
- - `./wait-for-transaction` is a bounded poll to a terminal state, for a
259
- transaction id from any source, including the 202 handle a client write
260
- returns when the platform's wait runs out.
194
+ - **API key authentication** — issued via the DALP dashboard (Settings → API Keys) or via `dalp login`
195
+ - Public routes can be called without an API key; authenticated routes still require one
196
+ - Security headers (`x-api-key`, `x-organization-id`) cannot be overridden by custom headers
197
+ - Client-side request validation can be enabled to catch schema violations early
261
198
 
262
- ## Package root
199
+ ## Errors
263
200
 
264
- The root stays small: the client factory, its options and errors, cookie-store
265
- transport, and the version constants. A consumer who only
266
- calls routes never pays for auth, TanStack Query, or webhook code.
201
+ DAPI errors thrown by the SDK use `DalpSdkError` and include `message`, `why`, `fix`, `status`, `retryable`, and the
202
+ public DAPI error id when the server returns one.
267
203
 
268
- ## Documentation
204
+ ## License
269
205
 
270
- The integrator guide lives under Developer reference in the platform docs:
271
- install and credentials, calling routes, mutations and settlement, streaming,
272
- TanStack Query, server rendering in TanStack Start and Next.js, React Native,
273
- and the Effect surface.
206
+ This project is licensed under the **SettleMint Commercial Customer Source License**. See the LICENSE file included in the package for full terms.