@settlemint/dalp-sdk 3.1.33-release.42636987002 → 3.2.0-rc.1

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 (133) hide show
  1. package/LICENSE +3 -157
  2. package/README.md +276 -169
  3. package/dist/auth/client.d.ts +114 -0
  4. package/dist/auth/invite-step-up.d.ts +2 -0
  5. package/dist/auth/live.d.ts +47 -0
  6. package/dist/auth/native-passkey.d.ts +8 -0
  7. package/dist/{auth-permissions.d.ts → auth/permissions.d.ts} +0 -8
  8. package/dist/auth/wallet-plugins.d.ts +196 -0
  9. package/dist/auth-surface.d.ts +2 -0
  10. package/dist/auth.d.ts +8 -115
  11. package/dist/auth.js +540 -0
  12. package/dist/chunk-6hckdbwt.js +600 -0
  13. package/dist/chunk-7mvx7xq8.js +4 -0
  14. package/dist/chunk-b03ycwb7.js +68 -0
  15. package/dist/chunk-crtb9edj.js +29 -0
  16. package/dist/chunk-g5j1xky8.js +99 -0
  17. package/dist/chunk-grdfnbwd.js +1529 -0
  18. package/dist/chunk-j43gfc9p.js +5 -0
  19. package/dist/chunk-k3ntysxx.js +57 -0
  20. package/dist/chunk-ptwkww6j.js +38 -0
  21. package/dist/chunk-qncpzave.js +185 -0
  22. package/dist/chunk-t8v94nvb.js +5 -0
  23. package/dist/chunk-xnarraj7.js +339 -0
  24. package/dist/client/conditional-request.d.ts +8 -0
  25. package/dist/client/factory.d.ts +4 -0
  26. package/dist/client/query-serializer.d.ts +1 -0
  27. package/dist/client/request-compression.d.ts +12 -0
  28. package/dist/client/ssr-fetch.d.ts +10 -0
  29. package/dist/client/step-up-challenge.d.ts +10 -0
  30. package/dist/effect.d.ts +39 -0
  31. package/dist/effect.js +110 -0
  32. package/dist/errors/api-error.d.ts +35 -0
  33. package/dist/errors/error-codes.d.ts +18 -0
  34. package/dist/errors/find-current-error.d.ts +2 -0
  35. package/dist/errors/public-error.d.ts +3 -0
  36. package/dist/errors/public-error.js +9 -0
  37. package/dist/errors/sdk-error.d.ts +52 -0
  38. package/dist/errors/sdk-error.js +8 -0
  39. package/dist/generated/api-types.d.ts +104535 -0
  40. package/dist/generated/api-types.ts +111921 -0
  41. package/dist/generated/console-routes.d.ts +12 -0
  42. package/dist/generated/error-catalog.d.ts +9 -0
  43. package/dist/generated/error-codes.d.ts +9 -0
  44. package/dist/generated/response-scalars.d.ts +9 -0
  45. package/dist/generated/response-schemas.d.ts +9 -0
  46. package/dist/generated/route-error-codes.d.ts +9 -0
  47. package/dist/generated/routes.d.ts +12 -0
  48. package/dist/index.d.ts +28 -45
  49. package/dist/index.js +159 -94522
  50. package/dist/proxy/builder.d.ts +17 -0
  51. package/dist/proxy/client-core.d.ts +36 -0
  52. package/dist/proxy/client.d.ts +5 -0
  53. package/dist/proxy/fetch-executor.d.ts +7 -0
  54. package/dist/proxy/flat-args.d.ts +24 -0
  55. package/dist/proxy/response-decode.d.ts +38 -0
  56. package/dist/proxy/sse.d.ts +11 -0
  57. package/dist/proxy/step-up-challenge.d.ts +4 -0
  58. package/dist/proxy/tanstack.d.ts +6 -0
  59. package/dist/proxy/transport.d.ts +76 -0
  60. package/dist/react-query.d.ts +2 -0
  61. package/dist/react-query.js +14 -0
  62. package/dist/routes/cli-command.d.ts +17 -0
  63. package/dist/routes/console.d.ts +14 -0
  64. package/dist/routes/console.js +27 -0
  65. package/dist/routes/index.d.ts +6 -0
  66. package/dist/routes/index.js +122 -0
  67. package/dist/routes/types.d.ts +73 -0
  68. package/dist/runtime-exports.d.ts +4 -0
  69. package/dist/runtime-exports.js +38 -0
  70. package/dist/runtime.d.ts +8 -0
  71. package/dist/scalars/big-decimal.d.ts +22 -0
  72. package/dist/scalars/big-int.d.ts +3 -0
  73. package/dist/scalars/dalp-scalars.d.ts +28 -0
  74. package/dist/scalars/ethereum-address.d.ts +3 -0
  75. package/dist/scalars/exchange-rates.d.ts +13 -0
  76. package/dist/scalars/index.d.ts +14 -0
  77. package/dist/scalars/index.js +236 -0
  78. package/dist/scalars/organization-id.d.ts +5 -0
  79. package/dist/scalars/token-decimals.d.ts +4 -0
  80. package/dist/secret.d.ts +12 -0
  81. package/dist/server-proxy.d.ts +39 -0
  82. package/dist/server-proxy.js +186 -0
  83. package/dist/sign-webhook-receipt.d.ts +16 -0
  84. package/dist/sign-webhook-receipt.js +26 -0
  85. package/dist/transport/cookie-store.d.ts +9 -0
  86. package/dist/transport/sse-lifecycle.d.ts +24 -0
  87. package/dist/types.d.ts +38 -114
  88. package/dist/url.d.ts +0 -1
  89. package/dist/verify-webhook.d.ts +18 -28
  90. package/dist/verify-webhook.js +8 -0
  91. package/dist/version.d.ts +0 -3
  92. package/dist/wait-for-transaction.d.ts +46 -86
  93. package/dist/wait-for-transaction.js +154 -0
  94. package/dist/webhook-events.d.ts +1360 -35
  95. package/package.json +176 -36
  96. package/dist/api-types.generated.d.ts +0 -14160
  97. package/dist/api-types.generated.d.ts.map +0 -1
  98. package/dist/auth-permissions.d.ts.map +0 -1
  99. package/dist/auth-wallet-plugins.d.ts +0 -86
  100. package/dist/auth-wallet-plugins.d.ts.map +0 -1
  101. package/dist/auth.d.ts.map +0 -1
  102. package/dist/bundler.d.ts +0 -217
  103. package/dist/bundler.d.ts.map +0 -1
  104. package/dist/client.d.ts +0 -19
  105. package/dist/client.d.ts.map +0 -1
  106. package/dist/contract-errors.d.ts +0 -4156
  107. package/dist/contract-errors.d.ts.map +0 -1
  108. package/dist/contract.d.ts +0 -22
  109. package/dist/contract.d.ts.map +0 -1
  110. package/dist/cookie-store.d.ts +0 -10
  111. package/dist/cookie-store.d.ts.map +0 -1
  112. package/dist/dapi-errors.d.ts +0 -656
  113. package/dist/dapi-errors.d.ts.map +0 -1
  114. package/dist/errors.d.ts +0 -639
  115. package/dist/errors.d.ts.map +0 -1
  116. package/dist/index.d.ts.map +0 -1
  117. package/dist/platform.d.ts +0 -41
  118. package/dist/platform.d.ts.map +0 -1
  119. package/dist/plugins/index.d.ts +0 -13
  120. package/dist/plugins/index.d.ts.map +0 -1
  121. package/dist/plugins/index.js +0 -8
  122. package/dist/sdk-error.d.ts +0 -74
  123. package/dist/sdk-error.d.ts.map +0 -1
  124. package/dist/serializers.d.ts +0 -41
  125. package/dist/serializers.d.ts.map +0 -1
  126. package/dist/types.d.ts.map +0 -1
  127. package/dist/url.d.ts.map +0 -1
  128. package/dist/verify-webhook.d.ts.map +0 -1
  129. package/dist/version.d.ts.map +0 -1
  130. package/dist/version.generated.d.ts +0 -8
  131. package/dist/version.generated.d.ts.map +0 -1
  132. package/dist/wait-for-transaction.d.ts.map +0 -1
  133. package/dist/webhook-events.d.ts.map +0 -1
package/LICENSE CHANGED
@@ -1,162 +1,8 @@
1
- # SETTLEMINT COMMERCIAL CUSTOMER SOURCE LICENSE
2
-
3
- **("License")**
4
-
5
- ---
6
-
7
- ## TL;DR (NON-BINDING SUMMARY)
8
-
9
- - You may view, fork, modify, and run this code ONLY while you have an active, paid contract with SettleMint.
10
- - You may use it internally (cloud, on-prem, or hybrid) only as agreed in your contract.
11
- - You may NOT resell it, offer it as a service, publish it, or use it to build or operate a competing product.
12
- - When your contract ends, your right to use the software ends immediately. You must stop all deployments and delete active copies.
13
- - This is NOT open source.
14
-
15
- *This summary is informational only. The legal terms below control.*
16
-
17
- ---
1
+ # SettleMint Commercial License
18
2
 
19
3
  Copyright © 2025 SettleMint NV
20
4
  All rights reserved.
21
5
 
22
- This License governs the use of the Software (as defined below) and is a proprietary, source-available license. It is not an open-source license.
23
-
24
- By accessing, copying, modifying, or using the Software, You agree to be bound by this License and confirm that You are a Customer with an Active Contract.
25
-
26
- ---
27
-
28
- ## 1. DEFINITIONS
29
-
30
- **1.1 "Licensor"**
31
- SettleMint NV, a company incorporated under Belgian law, or any affiliated entity explicitly identified in the applicable Commercial Agreement.
32
-
33
- **1.2 "Customer" or "You"**
34
- The legal entity that has entered into an Active Contract with Licensor and whose employees or contractors access or use the Software.
35
-
36
- **1.3 "Commercial Agreement"**
37
- Any master services agreement, subscription agreement, order form, statement of work, or similar contract executed between Licensor and Customer governing commercial terms.
38
-
39
- **1.4 "Active Contract"**
40
- A Commercial Agreement that is in force, not terminated, and for which all undisputed fees due are paid.
41
-
42
- **1.5 "Software"**
43
- The source code, object code, build scripts, configuration files, documentation, and any other materials made available by Licensor in this repository, including all updates and modifications thereto.
44
-
45
- **1.6 "Derivative Works"**
46
- Any modification, adaptation, translation, or other work based on or incorporating the Software, as defined under Book XI of the Belgian Code of Economic Law.
47
-
48
- **1.7 "Authorized Use"**
49
- Use of the Software solely for Customer's internal business purposes and strictly within the scope permitted by the Active Contract.
50
-
51
- **1.8 "Authorized Deployment"**
52
- Any installation, environment, system, blockchain network, cluster, or runtime explicitly permitted under the Active Contract, whether cloud-based, on-premises, or hybrid.
53
-
54
- **1.9 "Competitive Use"**
55
- Any use of the Software or Derivative Works to develop, operate, market, or support a product or service that competes with Licensor's products or services, or that could reasonably substitute for them.
56
-
57
- ---
58
-
59
- ## 2. LICENSE GRANT
60
-
61
- **2.1 Conditional License Grant**
62
- Subject to continuous compliance with this License and the existence of an Active Contract, Licensor grants Customer a limited, non-exclusive, non-transferable, non-sublicensable, revocable license to:
63
-
64
- (a) access and review the Software;
65
- (b) copy the Software for internal use;
66
- (c) modify the Software and create Derivative Works;
67
- (d) deploy and run the Software and Derivative Works solely for Authorized Use and only in Authorized Deployments.
68
-
69
- **2.2 Forking**
70
- Customer may create private forks of the Software solely for Authorized Use. All such forks remain subject to this License.
71
-
72
- **2.3 No Implied Rights**
73
- No rights are granted except as expressly stated. All rights not expressly granted are reserved by Licensor.
74
-
75
- ---
76
-
77
- ## 3. RESTRICTIONS
78
-
79
- Customer shall not, directly or indirectly:
80
-
81
- (a) use the Software without an Active Contract;
82
- (b) deploy the Software outside Authorized Deployments;
83
- (c) provide the Software or any Derivative Work as a service, platform, or product to third parties, unless explicitly permitted in writing;
84
- (d) sublicense, distribute, sell, lease, or transfer the Software or any Derivative Work to any third party;
85
- (e) engage in any Competitive Use;
86
- (f) use the Software to benchmark, reverse-engineer, or analyze Licensor's products for competitive purposes;
87
- (g) publish, disclose, or make publicly available the Software or any fork thereof;
88
- (h) remove or obscure copyright, trademark, or proprietary notices.
89
-
90
- ---
91
-
92
- ## 4. OWNERSHIP
93
-
94
- **4.1 Licensor IP**
95
- Licensor retains all right, title, and interest in and to the Software.
96
-
97
- **4.2 Customer Modifications**
98
- Customer retains ownership of original modifications it creates; however, Customer may not use, execute, deploy, or distribute any Derivative Work that includes or depends on the Software except as permitted under an Active Contract.
99
-
100
- **4.3 Feedback and Contributions**
101
- Any feedback, suggestions, or contributions provided by Customer may be used by Licensor without restriction. To the extent such contributions constitute copyrightable works, Customer grants Licensor a perpetual, worldwide, royalty-free, irrevocable license to use, modify, and distribute them.
102
-
103
- ---
104
-
105
- ## 5. TERMINATION
106
-
107
- **5.1 Automatic Termination**
108
- This License automatically terminates upon termination or expiration of the Active Contract.
109
-
110
- **5.2 Effect of Termination**
111
- Upon termination, Customer must immediately:
112
-
113
- (a) cease all use and deployment of the Software and Derivative Works;
114
- (b) delete all running instances, binaries, containers, and deployments;
115
- (c) destroy or delete all copies of the Software, except that one archival copy of source code may be retained solely for legal or compliance purposes.
116
-
117
- No right to resume use or deployment survives termination.
118
-
119
- **5.3 Survival**
120
- Sections relating to ownership, restrictions, liability, governing law, and jurisdiction survive termination.
121
-
122
- ---
123
-
124
- ## 6. WARRANTY DISCLAIMER
125
-
126
- THE SOFTWARE IS PROVIDED "AS IS". TO THE MAXIMUM EXTENT PERMITTED BY BELGIAN LAW, LICENSOR DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
127
-
128
- ---
129
-
130
- ## 7. LIMITATION OF LIABILITY
131
-
132
- To the maximum extent permitted by Belgian law, Licensor shall not be liable for any indirect, incidental, consequential, or special damages, including loss of profits, data, or business interruption, even if advised of the possibility.
133
-
134
- Nothing in this License limits liability that cannot be limited under mandatory Belgian law.
135
-
136
- ---
137
-
138
- ## 8. GOVERNING LAW AND JURISDICTION
139
-
140
- This License is governed by and construed in accordance with the laws of Belgium, excluding conflict-of-law rules.
141
-
142
- Any dispute arising out of or in connection with this License shall be subject to the exclusive jurisdiction of the courts of Brussels.
143
-
144
- ---
145
-
146
- ## 9. MISCELLANEOUS
147
-
148
- **9.1 Entire Agreement**
149
- This License, together with the applicable Commercial Agreement, constitutes the entire agreement regarding the Software.
150
-
151
- **9.2 Conflict**
152
- In case of conflict, the Commercial Agreement prevails.
153
-
154
- **9.3 Severability**
155
- If any provision is held invalid, the remaining provisions remain in full force.
156
-
157
- **9.4 No Waiver**
158
- Failure to enforce any provision does not constitute a waiver.
159
-
160
- ---
6
+ SettleMint distributes DALP as container images and Helm charts under SettleMint's commercial license. DALP is distributed without its source code.
161
7
 
162
- **END OF LICENSE**
8
+ Access to the DALP source code, or escrow of it, can be agreed in a contract with SettleMint as a paid option.
package/README.md CHANGED
@@ -1,206 +1,313 @@
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
- ```
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: Promise and Effect. The package root
10
+ returns promises. The `./effect` subpath returns Effect values with a typed
11
+ failure channel. Neither pulls the other in, and a build gate keeps the root
12
+ free of Effect.
38
13
 
39
- ## Quick Start
14
+ ## Client
40
15
 
41
- ```typescript
16
+ ```ts
42
17
  import { createDalpClient } from "@settlemint/dalp-sdk";
43
18
 
44
19
  const dalp = createDalpClient({
45
- url: "https://dalp.example.com",
20
+ baseUrl: "https://dalp.example.com",
46
21
  apiKey: "sm_dalp_...",
47
- organizationId: "org_...", // optional, for multi-org setups
48
22
  });
49
23
 
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
+ const tokens = await dalp.api.token.list({ page: { limit: 25 } }, { signal });
53
25
  ```
54
26
 
55
- ## Auth Client
27
+ A call takes one flat object. The route table says which of its keys are path
28
+ parameters and which are query or body fields, so a call site names what it
29
+ means and never restates the transport. The build refuses any route whose path
30
+ parameter would collide with a body or query key, which is what makes the
31
+ merge safe.
32
+
33
+ `createDalpClient` owns the shared transport policy once: the credential
34
+ mechanism, the acting-context headers (`organizationId`, `participant`,
35
+ `executor`, `chainId`, `selectedSigners`, `idempotencyKey`), conditional
36
+ `If-None-Match` reuse, custom fetch injection, the settlement bound, and abort
37
+ propagation.
38
+
39
+ **An API key cannot reach a browser or an app.** `createDalpClient` and
40
+ `createDalpAuthClient` throw at construction when a key is passed with
41
+ `runtime: "browser"` or `runtime: "react-native"`, rather than at the first
42
+ request. A key carries the
43
+ full authority of the identity it belongs to, and anything bundled into a web
44
+ page or an app ships to every user. There the client authenticates with the
45
+ session cookie instead.
46
+
47
+ ### Dispatch by route id
48
+
49
+ ```ts
50
+ const token = await dalp.execute("token/read", { assetId });
51
+ ```
56
52
 
57
- Use `createDalpAuthClient` for Better Auth operations such as sign-up, session listing, organization management, API
58
- keys, device authorization, and wallet verification setup.
53
+ `execute` is typed against the id through the `DalpRouteTypes` registry, so a
54
+ command surface built from route ids keeps the same request and response types
55
+ the namespaced tree gives a call site. The CLI, the end-to-end harness, and the
56
+ demo scripts are all built on it.
57
+
58
+ ### Settlement
59
+
60
+ A queue-backed write carries a `Prefer` header derived from
61
+ `settlementTimeoutMs`: undefined asks for `wait=15`, zero or less asks for
62
+ `respond-async`, anything else asks for `wait=<seconds>`, clamped to the
63
+ platform's 5 to 99 second range. `settlementTimeoutMs` sets that bound per
64
+ client, and a call may override it.
65
+
66
+ The platform does the waiting, not the client. When the write settles inside
67
+ the wait, the call returns the route's HTTP 200 resource. When it does not, the
68
+ call returns the declared HTTP 202 handle unchanged: a transaction write's
69
+ `{ transactionId, status, statusUrl }`, or a custody write's `{ requestId,
70
+ state, statusUrl }`. The client never polls a status URL on your behalf.
71
+
72
+ User creation can return `{ requestId, state: "running", statusUrl }` when it
73
+ exceeds the synchronous wait. Poll `statusUrl` with the same organization and
74
+ chain headers. The read returns 202 while creation is running, 200 with the
75
+ created user when it completes, or a named error when it fails. It can also
76
+ return a custody handle to follow until the custody account settles. Do not
77
+ submit another create while the original request is pending.
78
+
79
+ Pass a transaction id to `waitForTransaction` to follow it to a terminal
80
+ state. A write the funding gate parks on an operator payment reads as still
81
+ queued for as long as the ask is open: the status row carries it as
82
+ `activeRequirement`, and `waitForTransaction` restarts its own timeout on every
83
+ status that reports one, so the wait it runs outlasts the pause. A caller that
84
+ cannot wait that long ends the wait through `signal`, or passes
85
+ `holdWhilePaused: false` to end on the first parked status instead. A custody
86
+ handle has no equivalent helper: follow `statusUrl` yourself. A `DEAD_LETTER`
87
+ status with `mayStillLand: true` is not terminal: the call can still reach the
88
+ chain, so `waitForTransaction` keeps polling it and ends with reason `timeout`,
89
+ not `terminal-failure`. Do not resend while `mayStillLand` is `true`.
90
+
91
+ ### Conditional requests and ETags
92
+
93
+ The client reuses a held body when the server answers a matching ETag with 304.
94
+ Server ETags must be **strong content digests** computed **after
95
+ authorization** inside the requester's partition. Version-stamp ETags
96
+ (generation counters, watermarks, table versions) are forbidden for conditional
97
+ request adopters: a stamp can collide across tenants or lag a body change.
98
+
99
+ Identity changes that do not ride this client (browser sign-out, organization
100
+ switch) must clear the held bodies, so a later GET cannot send another
101
+ session's `If-None-Match`.
102
+
103
+ ```ts
104
+ dalp.conditionalRequests.clear();
105
+ ```
59
106
 
60
- ```typescript
61
- import { createDalpAuthClient } from "@settlemint/dalp-sdk";
107
+ ## Effect
62
108
 
63
- const auth = createDalpAuthClient({
64
- url: "https://dalp.example.com",
65
- apiKey: "sm_dalp_...",
66
- organizationId: "org_...",
67
- });
109
+ ```ts
110
+ import { createDalpEffectClient } from "@settlemint/dalp-sdk/effect";
68
111
 
69
- const apiKeys = await auth.apiKey.list();
112
+ const dalp = createDalpEffectClient({ baseUrl, apiKey });
113
+ const tokens = yield * dalp.api.token.list({ page: { limit: 25 } });
70
114
  ```
71
115
 
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.
116
+ The same routes, returning `Effect` values that fail with `DalpRequestError<Code>`,
117
+ where `Code` is the operation's own error codes,
118
+ rather than throwing. `execute` is typed by route id here too.
74
119
 
75
- ```typescript
76
- import { createDalpPlatformClient } from "@settlemint/dalp-sdk";
120
+ ## The route table
77
121
 
78
- const platform = createDalpPlatformClient({
79
- url: "https://dalp.example.com",
80
- });
122
+ ```ts
123
+ import { routeIds, routeTable } from "@settlemint/dalp-sdk/routes";
124
+ ```
81
125
 
82
- await platform.auth.signUp.email({
83
- email: "user@example.com",
84
- password: "Password123!",
85
- name: "Example User",
86
- });
126
+ `./routes` publishes the generated table both interpreters dispatch through:
127
+ every v2 route's id, method, path template, statuses, and traits. It carries no
128
+ client and no Effect, so a tool that only needs to know what the platform
129
+ serves loads this rather than a client.
87
130
 
88
- const sessionCookie = platform.cookieStore.header;
89
- ```
131
+ ## TanStack Query
90
132
 
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" });
133
+ ```ts
134
+ const options = dalp.api.token.list.queryOptions({ page: { limit: 25 } });
135
+ const transfer = dalp.api.token.transfer.mutationOptions();
117
136
  ```
118
137
 
119
- ```typescript
120
- // Enable wallet pincode protection
121
- await auth.wallet.pincode.enable({ pincode: "1234", password: "..." });
122
- ```
138
+ Every read node carries `queryOptions`; every write node carries
139
+ `mutationOptions`. They are plain objects in the shapes TanStack
140
+ Query expects, so nothing forces you into that library and nothing stops you
141
+ using something else.
142
+
143
+ Cache keys are derived from route identity plus canonicalized input, so two
144
+ callers passing the same parameters in a different key order share one entry.
145
+ `./react-query` exports `queryKeyFor` and `canonicalize` for building a
146
+ matching invalidation filter, and `UI_SETTLEMENT_TIMEOUT_MS`, the bound the
147
+ mutation factories default to.
148
+
149
+ ## Scalars
150
+
151
+ Custom wire formats (BigDecimal amounts, EVM addresses, and the
152
+ `OrganizationId` entity brand) are not expressed structurally in the generated
153
+ OpenAPI document, so `./scalars` carries a decoder for each:
154
+ `decodeBigDecimal`, `decodeEthereumAddress`, `decodeOrganizationId`, and the
155
+ exchange-rate response transformer. The route table names which fields carry a
156
+ scalar, keyed by dotted path, so a consumer applies a decoder where the
157
+ declaration says one lives rather than guessing from a field name.
158
+ `OrganizationId` is the only entity id branded end to end across the platform;
159
+ every other identifier crossing this boundary is a plain string.
160
+
161
+ Request and response types brand the wire scalars the API validates, so a raw
162
+ string does not compile where the API wants an address, hash or amount. Build the
163
+ brand with a constructor, which throws a `DalpSdkError` (code
164
+ `sdk.scalar.EVM_ADDRESS_INVALID` for an address, `sdk.scalar.VALUE_INVALID` for
165
+ the rest) when the value is not valid, or narrow with the matching guard:
166
+
167
+ ```ts
168
+ import { evmAddress, integerString, isEvmAddress } from "@settlemint/dalp-sdk/scalars";
169
+
170
+ await dalp.api.token.mint({
171
+ assetId: evmAddress("0x52908400098527886e0f7030069857d2e4169ee7"),
172
+ recipients: evmAddress("0x5A0b54D5dc17e0AadC383d2db43B0a0D3E029c4c"),
173
+ amounts: integerString(1000n),
174
+ });
123
175
 
124
- ## Configuration
176
+ const value: unknown = await readFromSomewhere();
177
+ if (isEvmAddress(value)) {
178
+ await dalp.api.token.mint({ assetId: value, recipients: value, amounts: "100" });
179
+ }
180
+ ```
125
181
 
126
- ```typescript
127
- import { createDalpClient } from "@settlemint/dalp-sdk";
182
+ The constructors are `evmAddress`, `ethereumHash`, `ethereumHex`,
183
+ `cantonPartyId`, `fiatCurrency`, `networkId`, `timestamp`, `integerString` and
184
+ `decimalString`; each has an `is...` guard, such as `isEthereumHash`. Integer
185
+ text is typed `${bigint}` and decimal text `${number}`.
128
186
 
129
- const dalp = createDalpClient({
130
- // Required
131
- url: "https://dalp.example.com",
187
+ ## Auth
132
188
 
133
- // Required for authenticated routes
134
- apiKey: "sm_dalp_...",
189
+ ```ts
190
+ import { createDalpAuthClient } from "@settlemint/dalp-sdk/auth";
191
+ ```
135
192
 
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
143
- });
193
+ The route surface already carries every auth REST route. `./auth` covers what a
194
+ REST call cannot express: the session and cookie state machine, plugin actions
195
+ that must run on the device (`passkeyClient` drives the WebAuthn ceremony
196
+ through `navigator.credentials`, or through the `passkey` ceremony a React
197
+ Native app passes), and the access-control model that evaluates a
198
+ permission locally instead of round-tripping. It sits off the package root
199
+ because it costs roughly 70 KiB of Better Auth that a consumer who only calls
200
+ routes should not pay.
201
+
202
+ Better Auth's client types reference zod, so `zod` is an optional peer
203
+ dependency: install it if you use `./auth`, skip it otherwise. No code in this
204
+ package imports zod at runtime.
205
+
206
+ An API key works on 9 auth routes only. Eight of them are reads:
207
+
208
+ - `GET /get-session`
209
+ - `GET /organization/list`
210
+ - `GET /organization/get-full-organization`
211
+ - `GET /organization/list-members`
212
+ - `POST /organization/has-permission`
213
+ - `GET /api-key/list`
214
+ - `GET /api-key/get`
215
+ - `GET /passkey/list-user-passkeys`
216
+
217
+ The ninth, `POST /api-key/delete`, deletes only the key that sends the request.
218
+
219
+ Every other auth route answers a request that carries a key with HTTP 403 and
220
+ the code `API_KEY_NOT_SUPPORTED_ON_ROUTE`. Use a session cookie for those
221
+ routes. The API key guide in the DALP API reference has the details.
222
+
223
+ ## React Native
224
+
225
+ Supported: Expo SDK 57 (React Native 0.86, React 19.2), with `fetch` from
226
+ `expo/fetch` passed to both clients. The SDK detects React Native from
227
+ `navigator.product` and then keeps the session in its own cookie store, sends
228
+ `credentials: "omit"`, refuses an API key, and sends the platform's origin as
229
+ `Origin` on every call.
230
+
231
+ ```ts
232
+ import { createCookieStoreFetch, createDalpClient, makeCookieStore } from "@settlemint/dalp-sdk";
233
+ import { createDalpAuthClient } from "@settlemint/dalp-sdk/auth";
234
+ import { fetch } from "expo/fetch";
235
+
236
+ const cookieStore = makeCookieStore((await SecureStore.getItemAsync("dalp.session")) ?? "");
237
+ const auth = await createDalpAuthClient({ url, cookieStore, fetch, passkey: ceremony });
238
+ const dalp = createDalpClient({ baseUrl: url, fetch: createCookieStoreFetch(cookieStore, fetch) });
144
239
  ```
145
240
 
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";
241
+ - React Native's built-in `fetch` works for calls but cannot read a stream; a
242
+ stream on it fails with `sdk.stream.UNREADABLE_BODY` before the request is
243
+ sent. Use `expo/fetch`.
244
+ - React Native has no WebAuthn. Pass a `passkey` ceremony (`DalpPasskeyCeremony`:
245
+ `authenticate` and `register`, each taking the platform's options JSON and
246
+ returning the credential JSON) backed by a native passkey module.
247
+ - Persist `cookieStore.header()` in secure storage yourself; the SDK holds it in
248
+ memory only.
249
+
250
+ The SDK's tests run this wiring headless on the fetch and abort polyfills React
251
+ Native ships and a model of `expo/fetch`. They do not run on Hermes, a
252
+ simulator, or a device.
253
+
254
+ ## Bundler and paymaster
255
+
256
+ Use JSON-RPC 2.0 over `POST https://dalp.example.com/bundler/{chainId}` for
257
+ account-abstraction calls. `{chainId}` is the decimal EVM chain ID; this is
258
+ not an `/api/v2` REST route and is not exposed through `dalp.api` or a separate
259
+ SDK bundler client. From a server, send a write-capable API key in `x-api-key`;
260
+ the key's active organization selects the tenant. Never put the key in browser
261
+ code.
262
+
263
+ The mount serves these standard methods:
264
+
265
+ | Method | Params |
266
+ | ------------------------------ | ----------------------------------------------- |
267
+ | `eth_chainId` | `[]` |
268
+ | `eth_sendUserOperation` | `[userOperation, entryPoint]` |
269
+ | `eth_estimateUserOperationGas` | `[userOperation, entryPoint]` |
270
+ | `eth_getUserOperationByHash` | `[userOperationHash]` |
271
+ | `eth_getUserOperationReceipt` | `[userOperationHash]` |
272
+ | `eth_supportedEntryPoints` | `[]` |
273
+ | `pm_getPaymasterData` | `[userOperation, entryPoint, chainId, context]` |
274
+ | `pm_getPaymasterStubData` | `[userOperation, entryPoint, chainId, context]` |
275
+
276
+ The UserOperation must be signed by your account-abstraction stack before
277
+ `eth_sendUserOperation`. The mount accepts EntryPoint v0.7 UserOperations and
278
+ returns JSON-RPC `result` or `error` envelopes, not REST `{ data, links }`
279
+ resources. `eth_chainId` reports the chain selected by the URL. Consult the platform's bundler
280
+ method policy before depending on a method being enabled for your credential.
281
+
282
+ ```ts
283
+ const response = await fetch("https://dalp.example.com/bundler/1", {
284
+ method: "POST",
285
+ headers: {
286
+ "content-type": "application/json",
287
+ "x-api-key": apiKey,
288
+ },
289
+ body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "eth_supportedEntryPoints", params: [] }),
290
+ });
291
+ const answer = await response.json(); // { jsonrpc: "2.0", id: 1, result: [...] } or { error: ... }
190
292
  ```
191
293
 
192
- ## Security
294
+ ## Webhooks and transaction wait
193
295
 
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
296
+ - `./verify-webhook` verifies an inbound webhook signature.
297
+ - `./sign-webhook-receipt` signs a webhook delivery receipt (Node only).
298
+ - `./wait-for-transaction` is a bounded poll to a terminal state, for a
299
+ transaction id from any source, including the 202 handle a client write
300
+ returns when the platform's wait runs out.
198
301
 
199
- ## Errors
302
+ ## Package root
200
303
 
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.
304
+ The root stays small: the client factory, its options and errors, cookie-store
305
+ transport, and the version constants. A consumer who only
306
+ calls routes never pays for auth, TanStack Query, or webhook code.
203
307
 
204
- ## License
308
+ ## Documentation
205
309
 
206
- This project is licensed under the **SettleMint Commercial Customer Source License**. See the LICENSE file included in the package for full terms.
310
+ The integrator guide lives under Developer reference in the platform docs:
311
+ install and credentials, calling routes, mutations and settlement, streaming,
312
+ TanStack Query, server rendering in TanStack Start and Next.js, React Native,
313
+ and the Effect surface.