@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.
- package/README.md +172 -239
- package/dist/api-types.generated.d.ts +14160 -0
- package/dist/api-types.generated.d.ts.map +1 -0
- package/dist/{auth/permissions.d.ts → auth-permissions.d.ts} +8 -0
- package/dist/auth-permissions.d.ts.map +1 -0
- package/dist/{auth/wallet-plugins.d.ts → auth-wallet-plugins.d.ts} +6 -68
- package/dist/auth-wallet-plugins.d.ts.map +1 -0
- package/dist/auth.d.ts +115 -8
- package/dist/auth.d.ts.map +1 -0
- package/dist/bundler.d.ts +217 -0
- package/dist/bundler.d.ts.map +1 -0
- package/dist/chunk-xm8h1dzh.js +33 -0
- package/dist/client.d.ts +19 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/contract-errors.d.ts +4156 -0
- package/dist/contract-errors.d.ts.map +1 -0
- package/dist/contract.d.ts +22 -0
- package/dist/contract.d.ts.map +1 -0
- package/dist/cookie-store.d.ts +10 -0
- package/dist/cookie-store.d.ts.map +1 -0
- package/dist/dapi-errors.d.ts +654 -0
- package/dist/dapi-errors.d.ts.map +1 -0
- package/dist/errors.d.ts +637 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/index.d.ts +45 -28
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +96216 -150
- package/dist/platform.d.ts +41 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/plugins/index.d.ts +13 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +10 -0
- package/dist/sdk-error.d.ts +74 -0
- package/dist/sdk-error.d.ts.map +1 -0
- package/dist/serializers.d.ts +41 -0
- package/dist/serializers.d.ts.map +1 -0
- package/dist/types.d.ts +114 -37
- package/dist/types.d.ts.map +1 -0
- package/dist/url.d.ts +1 -0
- package/dist/url.d.ts.map +1 -0
- package/dist/verify-webhook.d.ts +28 -17
- package/dist/verify-webhook.d.ts.map +1 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.generated.d.ts +8 -0
- package/dist/version.generated.d.ts.map +1 -0
- package/dist/wait-for-transaction.d.ts +86 -44
- package/dist/wait-for-transaction.d.ts.map +1 -0
- package/dist/webhook-events.d.ts +33 -543
- package/dist/webhook-events.d.ts.map +1 -0
- package/package.json +34 -110
- package/dist/auth/client.d.ts +0 -103
- package/dist/auth/invite-step-up.d.ts +0 -2
- package/dist/auth/live.d.ts +0 -47
- package/dist/auth/native-passkey.d.ts +0 -9
- package/dist/auth-surface.d.ts +0 -2
- package/dist/auth.js +0 -525
- package/dist/chunk-4f4kjtt0.js +0 -149
- package/dist/chunk-b03ycwb7.js +0 -68
- package/dist/chunk-ghgcmyhk.js +0 -5
- package/dist/chunk-h241xecg.js +0 -1625
- package/dist/chunk-hqz56e6q.js +0 -4
- package/dist/chunk-k3ntysxx.js +0 -57
- package/dist/chunk-pjjrxre1.js +0 -36
- package/dist/chunk-qvtjb3dz.js +0 -102
- package/dist/chunk-v54k7mgr.js +0 -271
- package/dist/chunk-w361dpdk.js +0 -5
- package/dist/client/conditional-request.d.ts +0 -8
- package/dist/client/factory.d.ts +0 -4
- package/dist/client/query-serializer.d.ts +0 -1
- package/dist/client/request-compression.d.ts +0 -12
- package/dist/client/ssr-fetch.d.ts +0 -10
- package/dist/client/step-up-challenge.d.ts +0 -10
- package/dist/effect.d.ts +0 -38
- package/dist/effect.js +0 -87
- package/dist/errors/api-error.d.ts +0 -35
- package/dist/errors/error-codes.d.ts +0 -21
- package/dist/errors/find-current-error.d.ts +0 -2
- package/dist/errors/sdk-error.d.ts +0 -52
- package/dist/errors/sdk-error.js +0 -8
- package/dist/generated/api-types.d.ts +0 -69961
- package/dist/generated/console-routes.d.ts +0 -12
- package/dist/generated/error-catalog.d.ts +0 -9
- package/dist/generated/error-codes.d.ts +0 -9
- package/dist/generated/response-scalars.d.ts +0 -9
- package/dist/generated/response-schemas.d.ts +0 -9
- package/dist/generated/route-error-codes.d.ts +0 -9
- package/dist/generated/routes.d.ts +0 -12
- package/dist/proxy/builder.d.ts +0 -17
- package/dist/proxy/client-core.d.ts +0 -28
- package/dist/proxy/client.d.ts +0 -5
- package/dist/proxy/fetch-executor.d.ts +0 -6
- package/dist/proxy/flat-args.d.ts +0 -24
- package/dist/proxy/response-decode.d.ts +0 -37
- package/dist/proxy/sse.d.ts +0 -11
- package/dist/proxy/step-up-challenge.d.ts +0 -4
- package/dist/proxy/tanstack.d.ts +0 -6
- package/dist/proxy/transport.d.ts +0 -63
- package/dist/react-query.d.ts +0 -2
- package/dist/react-query.js +0 -12
- package/dist/readonly-deep.d.ts +0 -3
- package/dist/routes/console.d.ts +0 -14
- package/dist/routes/console.js +0 -25
- package/dist/routes/index.d.ts +0 -4
- package/dist/routes/index.js +0 -10
- package/dist/routes/types.d.ts +0 -72
- package/dist/runtime-exports.d.ts +0 -4
- package/dist/runtime-exports.js +0 -16
- package/dist/runtime.d.ts +0 -11
- package/dist/scalars/big-decimal.d.ts +0 -4
- package/dist/scalars/ethereum-address.d.ts +0 -5
- package/dist/scalars/exchange-rates.d.ts +0 -13
- package/dist/scalars/index.d.ts +0 -10
- package/dist/scalars/index.js +0 -102
- package/dist/scalars/organization-id.d.ts +0 -5
- package/dist/scalars/token-decimals.d.ts +0 -4
- package/dist/secret.d.ts +0 -12
- package/dist/sign-webhook-receipt.d.ts +0 -16
- package/dist/sign-webhook-receipt.js +0 -26
- package/dist/transport/cookie-store.d.ts +0 -9
- package/dist/transport/sse-lifecycle.d.ts +0 -24
- package/dist/verify-webhook.js +0 -8
- package/dist/wait-for-transaction.js +0 -151
package/README.md
CHANGED
|
@@ -1,273 +1,206 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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> • </span>
|
|
19
|
+
<a href="https://www.npmjs.com/package/@settlemint/dalp-sdk">NPM</a>
|
|
20
|
+
<span> • </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
|
-
##
|
|
39
|
+
## Quick Start
|
|
14
40
|
|
|
15
|
-
```
|
|
41
|
+
```typescript
|
|
16
42
|
import { createDalpClient } from "@settlemint/dalp-sdk";
|
|
17
43
|
|
|
18
44
|
const dalp = createDalpClient({
|
|
19
|
-
|
|
45
|
+
url: "https://dalp.example.com",
|
|
20
46
|
apiKey: "sm_dalp_...",
|
|
47
|
+
organizationId: "org_...", // optional, for multi-org setups
|
|
21
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
53
|
```
|
|
25
54
|
|
|
26
|
-
|
|
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
|
-
`
|
|
53
|
-
|
|
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
|
-
|
|
60
|
+
```typescript
|
|
61
|
+
import { createDalpAuthClient } from "@settlemint/dalp-sdk";
|
|
97
62
|
|
|
98
|
-
|
|
99
|
-
|
|
63
|
+
const auth = createDalpAuthClient({
|
|
64
|
+
url: "https://dalp.example.com",
|
|
65
|
+
apiKey: "sm_dalp_...",
|
|
66
|
+
organizationId: "org_...",
|
|
67
|
+
});
|
|
100
68
|
|
|
101
|
-
const
|
|
102
|
-
const tokens = yield * dalp.api.token.list({ page: { limit: 25 } });
|
|
69
|
+
const apiKeys = await auth.apiKey.list();
|
|
103
70
|
```
|
|
104
71
|
|
|
105
|
-
|
|
106
|
-
|
|
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
|
-
|
|
75
|
+
```typescript
|
|
76
|
+
import { createDalpPlatformClient } from "@settlemint/dalp-sdk";
|
|
109
77
|
|
|
110
|
-
|
|
111
|
-
|
|
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
|
-
|
|
82
|
+
await platform.auth.signUp.email({
|
|
83
|
+
email: "user@example.com",
|
|
84
|
+
password: "Password123!",
|
|
85
|
+
name: "Example User",
|
|
86
|
+
});
|
|
120
87
|
|
|
121
|
-
|
|
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
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
`
|
|
141
|
-
|
|
142
|
-
`
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
`
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
-
|
|
156
|
-
|
|
157
|
-
|
|
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
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
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
|
-
##
|
|
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
|
-
-
|
|
257
|
-
-
|
|
258
|
-
-
|
|
259
|
-
|
|
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
|
-
##
|
|
199
|
+
## Errors
|
|
263
200
|
|
|
264
|
-
|
|
265
|
-
|
|
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
|
-
##
|
|
204
|
+
## License
|
|
269
205
|
|
|
270
|
-
|
|
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.
|