@settlemint/dalp-sdk 2.1.7-main.22780180229

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/LICENSE ADDED
@@ -0,0 +1,162 @@
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
+ ---
18
+
19
+ Copyright © 2025 SettleMint NV
20
+ All rights reserved.
21
+
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
+ ---
161
+
162
+ **END OF LICENSE**
package/README.md ADDED
@@ -0,0 +1,116 @@
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
+ ```
38
+
39
+ ## Quick Start
40
+
41
+ ```typescript
42
+ import { createDalpClient } from "@settlemint/dalp-sdk";
43
+
44
+ const dalp = createDalpClient({
45
+ url: "https://dalp.example.com",
46
+ apiKey: "sm_dalp_...",
47
+ organizationId: "org_...", // optional, for multi-org setups
48
+ });
49
+
50
+ // Every method is fully typed with auto-complete
51
+ const tokens = await dalp.token.list({ query: {} });
52
+ const system = await dalp.system.read({});
53
+ ```
54
+
55
+ ## Configuration
56
+
57
+ ```typescript
58
+ import { createDalpClient } from "@settlemint/dalp-sdk";
59
+
60
+ const dalp = createDalpClient({
61
+ // Required
62
+ url: "https://dalp.example.com",
63
+ apiKey: "sm_dalp_...",
64
+
65
+ // Optional
66
+ organizationId: "org_...", // multi-org scoping
67
+ headers: { "User-Agent": "MyApp" }, // override default headers
68
+ idempotencyKey: "req_abc123", // ⚠️ sent on EVERY request — use only for single-mutation clients
69
+ requestValidation: true, // validate requests client-side (default: true)
70
+ responseValidation: false, // validate responses client-side (default: false)
71
+ fetch: customFetch, // custom fetch implementation
72
+ });
73
+ ```
74
+
75
+ ## API Namespaces
76
+
77
+ | Namespace | Description |
78
+ | ------------------ | -------------------------- |
79
+ | `account` | Manage accounts |
80
+ | `actions` | Manage actions |
81
+ | `addons` | Manage addons |
82
+ | `admin` | Administrative operations |
83
+ | `contacts` | Manage contacts |
84
+ | `exchangeRates` | View exchange rates |
85
+ | `externalToken` | Manage external tokens |
86
+ | `identityRecovery` | Recover lost identities |
87
+ | `monitoring` | Platform monitoring |
88
+ | `search` | Search across the platform |
89
+ | `settings` | Platform settings |
90
+ | `system` | System administration |
91
+ | `token` | Manage security tokens |
92
+ | `transaction` | View transactions |
93
+ | `user` | Manage platform users |
94
+
95
+ ## Subpath Exports
96
+
97
+ ```typescript
98
+ // Main entry — client factory, error codes, serializers
99
+ import { createDalpClient } from "@settlemint/dalp-sdk";
100
+
101
+ // Type-only — for function signatures without runtime code
102
+ import type { DalpClient, DalpClientConfig } from "@settlemint/dalp-sdk/types";
103
+
104
+ // Plugins — optional oRPC link plugins for advanced usage
105
+ import { BatchLinkPlugin, RequestValidationPlugin } from "@settlemint/dalp-sdk/plugins";
106
+ ```
107
+
108
+ ## Security
109
+
110
+ - **API key authentication** — issued via the DALP dashboard (Settings → API Keys) or via `dalp login`
111
+ - Security headers (`x-api-key`, `x-organization-id`) cannot be overridden by custom headers
112
+ - Client-side request validation enabled by default to catch schema violations early
113
+
114
+ ## License
115
+
116
+ This project is licensed under the **SettleMint Commercial Customer Source License**. See the LICENSE file included in the package for full terms.
@@ -0,0 +1,18 @@
1
+ import type { DalpClient, DalpClientConfig } from "./types.js";
2
+ /**
3
+ * Create a fully typed DALP API client.
4
+ *
5
+ * @example
6
+ * ```typescript
7
+ * import { createDalpClient } from "@settlemint/dalp-sdk";
8
+ *
9
+ * const dalp = createDalpClient({
10
+ * url: "https://dalp.example.com",
11
+ * apiKey: "sm_dalp_...",
12
+ * organizationId: "org_...",
13
+ * });
14
+ *
15
+ * const tokens = await dalp.token.list({ query: {} });
16
+ * ```
17
+ */
18
+ export declare function createDalpClient(config: DalpClientConfig): DalpClient;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Re-exports the DALP v2 RPC contract.
3
+ *
4
+ * At build time, `bun build` bundles the contract definition (including all
5
+ * Zod schemas from workspace packages) into the SDK's `dist/` output.
6
+ * Consumers never need to install workspace-only packages.
7
+ *
8
+ * Related: packages/dalp/dapi/contract/src/contract.ts
9
+ *
10
+ * @module
11
+ */
12
+ export { rpcContract } from "@dalp/dapi-contract";
@@ -0,0 +1,45 @@
1
+ /**
2
+ * DALP API error codes.
3
+ *
4
+ * Mirrored from the canonical contract definition so the SDK has zero
5
+ * runtime dependency on workspace-only packages.
6
+ *
7
+ * Related: packages/dalp/dapi/contract/src/errors.ts
8
+ *
9
+ * @module
10
+ */
11
+ /** All error codes the DALP API may return. */
12
+ export declare const CUSTOM_ERROR_CODES: {
13
+ /** User lacks the required on-chain role for this token operation. */
14
+ readonly USER_NOT_AUTHORIZED: "USER_NOT_AUTHORIZED";
15
+ /** Authenticated but not authorized for this operation. */
16
+ readonly FORBIDDEN: "FORBIDDEN";
17
+ /** Malformed request. */
18
+ readonly BAD_REQUEST: "BAD_REQUEST";
19
+ /** Request data failed Zod schema validation. */
20
+ readonly INPUT_VALIDATION_FAILED: "INPUT_VALIDATION_FAILED";
21
+ /** Token does not implement a required ERC interface. */
22
+ readonly TOKEN_INTERFACE_NOT_SUPPORTED: "TOKEN_INTERFACE_NOT_SUPPORTED";
23
+ /** Unexpected server-side error. */
24
+ readonly INTERNAL_SERVER_ERROR: "INTERNAL_SERVER_ERROR";
25
+ /** The Graph subgraph query failed. */
26
+ readonly THE_GRAPH_ERROR: "THE_GRAPH_ERROR";
27
+ /** Resource state conflict (e.g., duplicate creation). */
28
+ readonly CONFLICT: "CONFLICT";
29
+ /** DALP system bootstrap has not been completed. */
30
+ readonly SYSTEM_NOT_CREATED: "SYSTEM_NOT_CREATED";
31
+ /** Requested resource does not exist. */
32
+ readonly NOT_FOUND: "NOT_FOUND";
33
+ /** Resource already exists. */
34
+ readonly RESOURCE_ALREADY_EXISTS: "RESOURCE_ALREADY_EXISTS";
35
+ /** User has not completed onboarding. */
36
+ readonly NOT_ONBOARDED: "NOT_ONBOARDED";
37
+ /** Transaction confirmation exceeded timeout. */
38
+ readonly CONFIRMATION_TIMEOUT: "CONFIRMATION_TIMEOUT";
39
+ /** Authentication missing or expired. */
40
+ readonly UNAUTHORIZED: "UNAUTHORIZED";
41
+ /** Required addon is not installed on this deployment. */
42
+ readonly ADDON_NOT_INSTALLED: "ADDON_NOT_INSTALLED";
43
+ };
44
+ /** Union of all DALP API error code strings. */
45
+ export type ErrorCode = keyof typeof CUSTOM_ERROR_CODES;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * DALP SDK — fully typed client for the DALP tokenization platform API.
3
+ *
4
+ * @example
5
+ * ```typescript
6
+ * import { createDalpClient } from "@settlemint/dalp-sdk";
7
+ *
8
+ * const dalp = createDalpClient({
9
+ * url: "https://dalp.example.com",
10
+ * apiKey: "sm_dalp_...",
11
+ * });
12
+ *
13
+ * // All methods are fully typed with auto-complete
14
+ * const tokens = await dalp.token.list({ query: {} });
15
+ * const system = await dalp.system.read({});
16
+ * ```
17
+ *
18
+ * @module
19
+ */
20
+ export { createDalpClient } from "./client.js";
21
+ export type { DalpClient, DalpClientConfig } from "./types.js";
22
+ export { CUSTOM_ERROR_CODES } from "./errors.js";
23
+ export type { ErrorCode } from "./errors.js";
24
+ export { bigDecimalSerializer, bigIntSerializer, dalpSerializers, timestampSerializer } from "./serializers.js";
25
+ export { SDK_USER_AGENT, SDK_VERSION } from "./version.js";