@trustware/sdk-staging 0.0.0

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,201 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to the Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by the Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding any notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. Please also get an
186
+ "Alarm" or "alarm" trademark registered for your company name
187
+ before using the template below.
188
+
189
+ Copyright 2026 TrustWare.io (socials@trustware.io)
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,364 @@
1
+ # Trustware SDK
2
+
3
+ The Trustware SDK provides a React provider, prebuilt UI widget, and typed core API for bridging and top-up routes. It powers seamless fund transfers across chains, reusing resolved configurations for quoting, route selection, and transaction execution. Whether you embed the widget for a quick integration or use the imperative core for custom UIs, the SDK handles wallet detection, approvals, submission, and asset settlement under the hood.
4
+
5
+ This guide covers installation, configuration, integration patterns (widget-based and headless), and advanced usage.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install @trustware/sdk
11
+ # or
12
+ pnpm add @trustware/sdk
13
+ ```
14
+
15
+ The package exposes ESM modules and ships full TypeScript types.
16
+
17
+ ## Core Concepts
18
+
19
+ - **`TrustwareProvider`** – Wraps your app to provide configuration (API key, routes, theme) via React context, making it available to the widget and core API.
20
+ - **`TrustwareWidget`** – A prebuilt React component that renders a UI for quoting, wallet selection, top-up submission, and asset settlement.
21
+ - **`Trustware core`** – An imperative singleton with helpers like `Trustware.runTopUp`, `Trustware.buildRoute`, and wallet utilities. Import once the provider is mounted.
22
+ - **Config** – `TrustwareConfigOptions` defines your API key, default routes (e.g., toChain, toToken), slippage, theme, messages, and wallet detection behavior.
23
+
24
+ ## Configuration
25
+
26
+ Create a config object at the root of your app. It merges defaults for routes, slippage, and fallbacks (e.g., `toAddress` defaults to `fromAddress` if unset). By default the widget will route funds to original address that initiated the transaction, if that address can support the new funds.
27
+
28
+ ```ts
29
+ const trustwareConfig = {
30
+ apiKey: process.env.NEXT_PUBLIC_TRUSTWARE_API_KEY!,
31
+ routes: {
32
+ toChain: "8453", // Base chain ID
33
+ toToken: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", // Native ETH on Base
34
+ defaultSlippage: 1,
35
+ // Optional defaults:
36
+ // fromAddress: "0x...", // User's wallet address
37
+ // toAddress: "0x...", // Destination; can be set later via Trustware.setDestinationAddress
38
+ options: {
39
+ // fixedFromAmount: "5.00", // USD amount (locks input)
40
+ // minAmountOut: "1.00", // USD minimum
41
+ // maxAmountOut: "100.00", // USD maximum
42
+ // routeRefreshMs: 15000, // auto-refresh route quotes
43
+ },
44
+ },
45
+ autoDetectProvider: true, // Enable EIP-6963/EIP-1193 wallet discovery
46
+ theme: {
47
+ primaryColor: "#FCB514",
48
+ secondaryColor: "#FFFFFF",
49
+ backgroundColor: "#000000",
50
+ borderColor: "#FCB514",
51
+ textColor: "#FFFFFF",
52
+ radius: 16,
53
+ },
54
+ messages: {
55
+ title: "Top up BasePass",
56
+ description: "Bridge and add funds directly to your BasePass wallet.",
57
+ },
58
+ onError: (error) => {
59
+ console.error("Trustware error:", error);
60
+ },
61
+ onSuccess: (tx) => {
62
+ console.log("Trustware success:", tx);
63
+ },
64
+ onEvent: (event) => {
65
+ // Optional: listen to all SDK events
66
+ console.log("Trustware event:", event);
67
+ },
68
+ } satisfies TrustwareConfigOptions;
69
+ ```
70
+
71
+ Retrieve the resolved config anytime via `Trustware.getConfig()` (after provider mount).
72
+
73
+ ```ts
74
+ const cfg = Trustware.getConfig();
75
+ console.log(cfg.routes.toChain); // "8453"
76
+ ```
77
+
78
+ ## Integration Modes
79
+
80
+ ### 1. Widget with Trustware-managed Wallet Detection
81
+
82
+ Ideal for apps without existing wallet connections. The SDK auto-discovers wallets (if `autoDetectProvider: true`) and prompts during the flow.
83
+
84
+ ```tsx
85
+ import { TrustwareProvider, TrustwareWidget } from "@trustware/sdk";
86
+
87
+ export function App() {
88
+ return (
89
+ <TrustwareProvider config={trustwareConfig}>
90
+ <TrustwareWidget />
91
+ </TrustwareProvider>
92
+ );
93
+ }
94
+ ```
95
+
96
+ - No external wallet libs (e.g., Wagmi) needed.
97
+ - Call `Trustware.setDestinationAddress(address)` dynamically if the `toAddress` is determined at runtime (e.g., after smart wallet generation).
98
+
99
+ ### 2. Widget or Headless with Host-managed Wallet
100
+
101
+ Reuse your app's wallet (e.g., via Wagmi/RainbowKit). Adapt clients to the `WalletInterfaceAPI` and inject via prop or `Trustware.useWallet`.
102
+
103
+ ```tsx
104
+ import { useEffect, useMemo } from "react";
105
+ import { useWalletClient } from "wagmi";
106
+ import { TrustwareProvider, TrustwareWidget, Trustware } from "@trustware/sdk";
107
+ import { useWagmi } from "@trustware/sdk/wallet"; // Adapter helper
108
+
109
+ export function App() {
110
+ const { data: wagmiClient } = useWalletClient();
111
+ const wallet = useMemo(
112
+ () => (wagmiClient ? useWagmi(wagmiClient) : undefined),
113
+ [wagmiClient],
114
+ );
115
+
116
+ useEffect(() => {
117
+ if (!wallet) return;
118
+ Trustware.setDestinationAddress("0xDestination...");
119
+ }, [wallet]);
120
+
121
+ return (
122
+ <TrustwareProvider
123
+ config={trustwareConfig}
124
+ wallet={wallet}
125
+ autoDetect={false} // Skip detection; use injected wallet
126
+ >
127
+ <TrustwareWidget /> {/* Or omit for headless */}
128
+ </TrustwareProvider>
129
+ );
130
+ }
131
+ ```
132
+
133
+ - Adapters: `useWagmi(client)` for Viem/Wagmi, `useEIP1193(provider)` for raw EIP-1193.
134
+ - Attach imperatively post-mount: `Trustware.useWallet(wallet)`.
135
+ - Bridge example for Wagmi:
136
+
137
+ ```ts
138
+ import { useEffect } from "react";
139
+ import { useWalletClient } from "wagmi";
140
+ import { useWagmi } from "@trustware/sdk/wallet";
141
+ import { Trustware } from "@trustware/sdk";
142
+
143
+ export function useTrustwareWalletBridge() {
144
+ const { data } = useWalletClient();
145
+
146
+ useEffect(() => {
147
+ if (!data) return;
148
+ const wallet = useWagmi(data);
149
+ Trustware.useWallet(wallet);
150
+ }, [data]);
151
+ }
152
+ ```
153
+
154
+ ## Using the Widget
155
+
156
+ The `<TrustwareWidget />` handles the full flow: quoting, wallet prompts, approvals, submission, and final asset settlement. It mirrors the core's lifecycle and uses the provider's config/wallet, without disrupting user flows in your application.
157
+
158
+ - Customize via `theme` and `messages` in config.
159
+ - For dynamic `toAddress`: Call `Trustware.setDestinationAddress` before render.
160
+
161
+ ## Imperative API (Headless / Without Widget)
162
+
163
+ Import the core after mounting `TrustwareProvider`:
164
+
165
+ ```ts
166
+ import { Trustware } from "@trustware/sdk";
167
+ ```
168
+
169
+ Build custom UIs with these helpers, reusing the provider's config and wallet.
170
+
171
+ ### Wallet Detection and Management
172
+
173
+ - `Trustware.autoDetect()` – Starts provider discovery (if enabled); returns unsubscribe.
174
+ - `Trustware.useWallet(wallet)` – Inject a connected wallet.
175
+ - `Trustware.getWallet()` / `Trustware.getAddress()` – Get active wallet/address.
176
+
177
+ ### Building and Quoting Routes
178
+
179
+ Create routes and fetch quotes before user interaction.
180
+
181
+ ```ts
182
+ const cfg = Trustware.getConfig();
183
+ const fromAddress = await Trustware.getAddress();
184
+
185
+ const route = await Trustware.buildRoute({
186
+ amount: "0.1", // In fromToken currency (e.g., ETH)
187
+ fromAddress,
188
+ toAddress: cfg.routes.toAddress ?? fromAddress, // Fallbacks applied
189
+ });
190
+
191
+ const quote = await Trustware.getQuote(route);
192
+ console.log(quote.expectedAmountOut);
193
+ ```
194
+
195
+ - `amount`: Denominated in `fromToken` (defaults to native).
196
+ - Fallbacks: `fromAddress` → connected wallet; `toAddress` → config → `fromAddress`.
197
+
198
+ ### Running a Top-up
199
+
200
+ Orchestrates quoting, approvals, and submission. Wrap with your UI (e.g., loading states).
201
+
202
+ ```ts
203
+ try {
204
+ const result = await Trustware.runTopUp({
205
+ amount: "0.25",
206
+ fromAddress: await Trustware.getAddress(),
207
+ toAddress: "0xDestination...", // Optional; uses config fallbacks
208
+ });
209
+
210
+ console.log("Top-up confirmed", result.txHash);
211
+ } catch (err) {
212
+ console.error("Top-up failed", err);
213
+ }
214
+ ```
215
+
216
+ Returns: `{ txHash, receipt?, approvals? }`.
217
+
218
+ ### Lifecycle Events
219
+
220
+ Listen for updates mirroring the widget:
221
+
222
+ ```ts
223
+ const unsub = Trustware.on("status", (status) => {
224
+ console.log("Status:", status); // e.g., "idle", "quoting", "submitting"
225
+ });
226
+
227
+ // Later:
228
+ unsub();
229
+ ```
230
+
231
+ Events:
232
+ - `status`: High-level updates.
233
+ - `quote`: Latest quote.
234
+ - `error`: Thrown errors (e.g., approval/bridge failures).
235
+
236
+ ## Additional Utilities
237
+
238
+ - `Trustware.setDestinationAddress(address)`: Updates runtime `toAddress`.
239
+ - `Trustware.getConfig()`: Resolved config.
240
+ - Hooks: `useTrustware()`, `useTrustwareRoute()` for advanced React flows.
241
+ - Explore `src/core` for types on balances, tokens, chain metadata.
242
+
243
+ ## Error Handling Tips
244
+
245
+ - Surface actionable errors from `runTopUp` or `error` events (e.g., network/approval issues).
246
+ - Add retry logic for transients.
247
+ - Guard calls: Ensure provider mounted and wallet connected.
248
+
249
+ ## Rate Limiting
250
+
251
+ The SDK automatically handles API rate limits with retry logic. The backend enforces per-API-key limits and returns standard rate limit headers.
252
+
253
+ ### Default Behavior
254
+
255
+ Rate limiting is **enabled by default**. When a 429 (Too Many Requests) response is received:
256
+ 1. The SDK waits for the time specified in the `Retry-After` header
257
+ 2. Automatically retries the request (up to 3 times by default)
258
+ 3. Uses exponential backoff if `Retry-After` is not provided
259
+
260
+ ### Configuration
261
+
262
+ Customize rate limit handling in your config:
263
+
264
+ ```ts
265
+ const config = {
266
+ apiKey: "...",
267
+ routes: { toChain: "8453", toToken: "0x..." },
268
+ retry: {
269
+ autoRetry: true, // Enable/disable auto-retry on 429 (default: true)
270
+ // Note: This does NOT disable backend rate limits,
271
+ // only client-side retry behavior
272
+ maxRetries: 3, // Max retry attempts (default: 3)
273
+ baseDelayMs: 1000, // Base delay for exponential backoff (default: 1000)
274
+ approachingThreshold: 5, // Trigger warning when remaining < threshold (default: 5)
275
+
276
+ // Callbacks for monitoring
277
+ onRateLimitInfo: (info) => {
278
+ console.log(`${info.remaining}/${info.limit} requests remaining`);
279
+ },
280
+ onRateLimited: (info, retryCount) => {
281
+ console.warn(`Rate limited! Retry ${retryCount}, waiting ${info.retryAfter}s`);
282
+ },
283
+ onRateLimitApproaching: (info, threshold) => {
284
+ console.warn(`Approaching limit: ${info.remaining} remaining`);
285
+ },
286
+ },
287
+ };
288
+ ```
289
+
290
+ ### Rate Limit Info
291
+
292
+ The `RateLimitInfo` object contains:
293
+
294
+ | Field | Type | Description |
295
+ |-------|------|-------------|
296
+ | `limit` | number | Maximum requests allowed in the window |
297
+ | `remaining` | number | Requests remaining in current window |
298
+ | `reset` | number | Unix timestamp when window resets |
299
+ | `retryAfter` | number? | Seconds to wait (only on 429) |
300
+
301
+ ### Handling RateLimitError
302
+
303
+ If retries are exhausted, a `RateLimitError` is thrown:
304
+
305
+ ```ts
306
+ import { Trustware, RateLimitError } from "@trustware/sdk";
307
+
308
+ try {
309
+ await Trustware.buildRoute({ ... });
310
+ } catch (err) {
311
+ if (err instanceof RateLimitError) {
312
+ console.error(`Rate limited: ${err.message}`);
313
+ console.log(`Try again in ${err.rateLimitInfo.retryAfter}s`);
314
+ }
315
+ }
316
+ ```
317
+
318
+ ### Disabling Auto-Retry
319
+
320
+ To handle rate limits manually (disable client-side retry):
321
+
322
+ ```ts
323
+ const config = {
324
+ // ...
325
+ retry: {
326
+ autoRetry: false, // Disable auto-retry; 429s will throw immediately
327
+ // Note: Backend rate limits still apply
328
+ },
329
+ };
330
+ ```
331
+
332
+ ## Bundle Size
333
+
334
+ The SDK is optimized for minimal bundle impact:
335
+
336
+ | Bundle | Gzipped Size |
337
+ |--------|--------------|
338
+ | Full SDK (ESM) | ~49 KB |
339
+ | CSS Styles | ~5 KB |
340
+ | **Total** | **~54 KB** |
341
+
342
+ *Sizes exclude React peer dependency*
343
+
344
+ Key optimizations:
345
+ - Tree-shaking enabled via ES modules
346
+ - ConfettiEffect lazy-loaded (only imported on success page)
347
+ - Minimal Radix UI usage (only react-dialog)
348
+ - CSS scoped with `tw-` prefix to avoid conflicts
349
+
350
+ Run `npm run size` to check current bundle sizes.
351
+
352
+ ## Troubleshooting
353
+
354
+ - Mount `TrustwareProvider` once at app root.
355
+ - For host wallets: Inject only after connection.
356
+ - SSR/Next.js: Use `"use client";` for SDK-touching components.
357
+ - No wallet? Enable `autoDetectProvider` or inject manually.
358
+
359
+ ## Further Reading
360
+
361
+ - TypeScript defs in `src/core` for full API.
362
+ - Source: Explore `sdk/src` for implementation details.
363
+ - [Core Guide](docs/coreGuide.md)
364
+ - [Integrations](docs/integrationGuide.md)
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/constants.ts
21
+ var constants_exports = {};
22
+ __export(constants_exports, {
23
+ API_PREFIX: () => API_PREFIX,
24
+ API_ROOT: () => API_ROOT,
25
+ ASSETS_BASE_URL: () => ASSETS_BASE_URL,
26
+ SDK_NAME: () => SDK_NAME,
27
+ SDK_VERSION: () => SDK_VERSION,
28
+ WALLETCONNECT_PROJECT_ID: () => WALLETCONNECT_PROJECT_ID
29
+ });
30
+ module.exports = __toCommonJS(constants_exports);
31
+ var SDK_NAME = "@trustware/sdk";
32
+ var SDK_VERSION = "0.0.0";
33
+ var API_ROOT = "https://api.trustware.io";
34
+ var API_PREFIX = "/api";
35
+ var ASSETS_BASE_URL = "https://app.trustware.io";
36
+ var WALLETCONNECT_PROJECT_ID = "4ead125c-63be-4b1a-a835-cef2dce67b84";
37
+ // Annotate the CommonJS export names for ESM import in node:
38
+ 0 && (module.exports = {
39
+ API_PREFIX,
40
+ API_ROOT,
41
+ ASSETS_BASE_URL,
42
+ SDK_NAME,
43
+ SDK_VERSION,
44
+ WALLETCONNECT_PROJECT_ID
45
+ });
46
+ //# sourceMappingURL=constants.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/constants.ts"],"sourcesContent":["// constants.ts\ndeclare const __SDK_VERSION__: string;\ndeclare const __API_ROOT__: string;\n\nexport const SDK_NAME = \"@trustware/sdk\";\nexport const SDK_VERSION: string = __SDK_VERSION__;\nexport const API_ROOT: string = __API_ROOT__;\nexport const API_PREFIX = \"/api\";\n\n// Assets base URL for wallet logos and other static assets\nexport const ASSETS_BASE_URL = \"https://app.trustware.io\";\n\n// WalletConnect Cloud project ID - built into the SDK for seamless wallet connections\n// This is a public identifier (not a secret) registered with WalletConnect Cloud\nexport const WALLETCONNECT_PROJECT_ID = \"4ead125c-63be-4b1a-a835-cef2dce67b84\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,IAAM,WAAW;AACjB,IAAM,cAAsB;AAC5B,IAAM,WAAmB;AACzB,IAAM,aAAa;AAGnB,IAAM,kBAAkB;AAIxB,IAAM,2BAA2B;","names":[]}
@@ -0,0 +1,8 @@
1
+ declare const SDK_NAME = "@trustware/sdk";
2
+ declare const SDK_VERSION: string;
3
+ declare const API_ROOT: string;
4
+ declare const API_PREFIX = "/api";
5
+ declare const ASSETS_BASE_URL = "https://app.trustware.io";
6
+ declare const WALLETCONNECT_PROJECT_ID = "4ead125c-63be-4b1a-a835-cef2dce67b84";
7
+
8
+ export { API_PREFIX, API_ROOT, ASSETS_BASE_URL, SDK_NAME, SDK_VERSION, WALLETCONNECT_PROJECT_ID };
@@ -0,0 +1,8 @@
1
+ declare const SDK_NAME = "@trustware/sdk";
2
+ declare const SDK_VERSION: string;
3
+ declare const API_ROOT: string;
4
+ declare const API_PREFIX = "/api";
5
+ declare const ASSETS_BASE_URL = "https://app.trustware.io";
6
+ declare const WALLETCONNECT_PROJECT_ID = "4ead125c-63be-4b1a-a835-cef2dce67b84";
7
+
8
+ export { API_PREFIX, API_ROOT, ASSETS_BASE_URL, SDK_NAME, SDK_VERSION, WALLETCONNECT_PROJECT_ID };
@@ -0,0 +1,16 @@
1
+ // src/constants.ts
2
+ var SDK_NAME = "@trustware/sdk";
3
+ var SDK_VERSION = "0.0.0";
4
+ var API_ROOT = "https://api.trustware.io";
5
+ var API_PREFIX = "/api";
6
+ var ASSETS_BASE_URL = "https://app.trustware.io";
7
+ var WALLETCONNECT_PROJECT_ID = "4ead125c-63be-4b1a-a835-cef2dce67b84";
8
+ export {
9
+ API_PREFIX,
10
+ API_ROOT,
11
+ ASSETS_BASE_URL,
12
+ SDK_NAME,
13
+ SDK_VERSION,
14
+ WALLETCONNECT_PROJECT_ID
15
+ };
16
+ //# sourceMappingURL=constants.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/constants.ts"],"sourcesContent":["// constants.ts\ndeclare const __SDK_VERSION__: string;\ndeclare const __API_ROOT__: string;\n\nexport const SDK_NAME = \"@trustware/sdk\";\nexport const SDK_VERSION: string = __SDK_VERSION__;\nexport const API_ROOT: string = __API_ROOT__;\nexport const API_PREFIX = \"/api\";\n\n// Assets base URL for wallet logos and other static assets\nexport const ASSETS_BASE_URL = \"https://app.trustware.io\";\n\n// WalletConnect Cloud project ID - built into the SDK for seamless wallet connections\n// This is a public identifier (not a secret) registered with WalletConnect Cloud\nexport const WALLETCONNECT_PROJECT_ID = \"4ead125c-63be-4b1a-a835-cef2dce67b84\";\n"],"mappings":";AAIO,IAAM,WAAW;AACjB,IAAM,cAAsB;AAC5B,IAAM,WAAmB;AACzB,IAAM,aAAa;AAGnB,IAAM,kBAAkB;AAIxB,IAAM,2BAA2B;","names":[]}