@trustware/sdk-staging 1.1.8-staging.8 → 1.1.9-staging.3

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 (46) hide show
  1. package/README.md +0 -2
  2. package/dist/{blockchain-BONedEsU.d.cts → blockchain-BxAFzp0s.d.cts} +5 -1
  3. package/dist/{blockchain-BONedEsU.d.ts → blockchain-BxAFzp0s.d.ts} +5 -1
  4. package/dist/constants.cjs +1 -1
  5. package/dist/constants.cjs.map +1 -1
  6. package/dist/constants.mjs +1 -1
  7. package/dist/constants.mjs.map +1 -1
  8. package/dist/{core-BQ0mFnLc.d.ts → core-CwT8Wd1x.d.ts} +32 -4
  9. package/dist/{core-BjQwlpoI.d.cts → core-Dy_rZl5y.d.cts} +32 -4
  10. package/dist/core.cjs +69 -32
  11. package/dist/core.cjs.map +1 -1
  12. package/dist/core.d.cts +4 -4
  13. package/dist/core.d.ts +4 -4
  14. package/dist/core.mjs +69 -32
  15. package/dist/core.mjs.map +1 -1
  16. package/dist/{detect-DlbgTrkm.d.cts → detect-DVpECOTa.d.cts} +2 -2
  17. package/dist/{detect-MWKHLhn9.d.ts → detect-d2PUaxE_.d.ts} +2 -2
  18. package/dist/index.cjs +699 -333
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +9 -10
  21. package/dist/index.d.ts +9 -10
  22. package/dist/index.mjs +653 -287
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/{manager-aOd3vkF9.d.ts → manager-B5aklGtm.d.cts} +2 -4
  25. package/dist/{manager-DKVW7zeh.d.cts → manager-xFiq0SHr.d.ts} +2 -4
  26. package/dist/smart-account.cjs +1 -2
  27. package/dist/smart-account.cjs.map +1 -1
  28. package/dist/smart-account.d.cts +31 -3
  29. package/dist/smart-account.d.ts +31 -3
  30. package/dist/smart-account.mjs +1 -2
  31. package/dist/smart-account.mjs.map +1 -1
  32. package/dist/{types-MtdjJgwT.d.ts → types-BJY9r-mz.d.ts} +1 -1
  33. package/dist/{types-B3nKHW6H.d.cts → types-DX3HtFcn.d.cts} +1 -1
  34. package/dist/wallet.cjs +124 -53
  35. package/dist/wallet.cjs.map +1 -1
  36. package/dist/wallet.d.cts +4 -4
  37. package/dist/wallet.d.ts +4 -4
  38. package/dist/wallet.mjs +124 -53
  39. package/dist/wallet.mjs.map +1 -1
  40. package/dist/widget.cjs +672 -306
  41. package/dist/widget.cjs.map +1 -1
  42. package/dist/widget.d.cts +2 -2
  43. package/dist/widget.d.ts +2 -2
  44. package/dist/widget.mjs +626 -260
  45. package/dist/widget.mjs.map +1 -1
  46. package/package.json +1 -1
package/README.md CHANGED
@@ -105,7 +105,6 @@ type TrustwareConfigOptions = {
105
105
  fromAddress?: string;
106
106
  toAddress?: string;
107
107
  defaultSlippage?: number;
108
- routeType?: string;
109
108
  options?: {
110
109
  routeRefreshMs?: number;
111
110
  fixedFromAmount?: string | number;
@@ -132,7 +131,6 @@ type TrustwareConfigOptions = {
132
131
  - `routes.fromAddress`: optional source wallet override.
133
132
  - `routes.toAddress`: optional destination address override.
134
133
  - `routes.defaultSlippage`: optional slippage percentage. Defaults to `1`.
135
- - `routes.routeType`: optional route flavor. Defaults to `"swap"`.
136
134
 
137
135
  ### Route Options
138
136
 
@@ -52,6 +52,10 @@ type BalanceStreamOptions = {
52
52
  signal?: AbortSignal;
53
53
  strict?: boolean;
54
54
  };
55
+ type GetBalancesOptions = {
56
+ /** Bypass the in-memory balance cache and re-fetch fresh data from the network. */
57
+ forceRefresh?: boolean;
58
+ };
55
59
  type ChainType = "evm" | "cosmos" | "solana" | "btc" | string;
56
60
  interface NativeCurrency {
57
61
  symbol: string;
@@ -107,4 +111,4 @@ type TokenWithBalance = TokenDef & {
107
111
  balance?: bigint;
108
112
  };
109
113
 
110
- export type { BalanceRow as B, ChainDef as C, NativeCurrency as N, TokenDef as T, WalletAddressBalanceWrapper as W, BalanceStreamOptions as a, ChainMeta as b, ChainType as c, TokenMeta as d, TokenPageInfo as e, TokenPageOptions as f, TokenPageResult as g, TokenType as h, TokenWithBalance as i };
114
+ export type { BalanceRow as B, ChainDef as C, GetBalancesOptions as G, NativeCurrency as N, TokenDef as T, WalletAddressBalanceWrapper as W, BalanceStreamOptions as a, ChainMeta as b, ChainType as c, TokenMeta as d, TokenPageInfo as e, TokenPageOptions as f, TokenPageResult as g, TokenType as h, TokenWithBalance as i };
@@ -52,6 +52,10 @@ type BalanceStreamOptions = {
52
52
  signal?: AbortSignal;
53
53
  strict?: boolean;
54
54
  };
55
+ type GetBalancesOptions = {
56
+ /** Bypass the in-memory balance cache and re-fetch fresh data from the network. */
57
+ forceRefresh?: boolean;
58
+ };
55
59
  type ChainType = "evm" | "cosmos" | "solana" | "btc" | string;
56
60
  interface NativeCurrency {
57
61
  symbol: string;
@@ -107,4 +111,4 @@ type TokenWithBalance = TokenDef & {
107
111
  balance?: bigint;
108
112
  };
109
113
 
110
- export type { BalanceRow as B, ChainDef as C, NativeCurrency as N, TokenDef as T, WalletAddressBalanceWrapper as W, BalanceStreamOptions as a, ChainMeta as b, ChainType as c, TokenMeta as d, TokenPageInfo as e, TokenPageOptions as f, TokenPageResult as g, TokenType as h, TokenWithBalance as i };
114
+ export type { BalanceRow as B, ChainDef as C, GetBalancesOptions as G, NativeCurrency as N, TokenDef as T, WalletAddressBalanceWrapper as W, BalanceStreamOptions as a, ChainMeta as b, ChainType as c, TokenMeta as d, TokenPageInfo as e, TokenPageOptions as f, TokenPageResult as g, TokenType as h, TokenWithBalance as i };
@@ -30,7 +30,7 @@ __export(constants_exports, {
30
30
  });
31
31
  module.exports = __toCommonJS(constants_exports);
32
32
  var SDK_NAME = "@trustware/sdk";
33
- var SDK_VERSION = "1.1.8-staging.8";
33
+ var SDK_VERSION = "1.1.9-staging.3";
34
34
  var API_ROOT = "https://bv-staging-api.trustware.io";
35
35
  var GTM_ID = "GTM-TZDGNCXB";
36
36
  var API_PREFIX = "/api";
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/constants.ts"],"sourcesContent":["// constants.ts\ndeclare const __SDK_VERSION__: string;\ndeclare const __API_ROOT__: string;\ndeclare const __GTM_ID__: string;\ndeclare const __WALLETCONNECT_PROJECT_ID__: string;\n\nexport const SDK_NAME = \"@trustware/sdk\";\nexport const SDK_VERSION: string = __SDK_VERSION__;\nexport const API_ROOT: string = __API_ROOT__;\nexport const GTM_ID: string = __GTM_ID__;\nexport const API_PREFIX = \"/api\";\nexport const WALLETCONNECT_PROJECT_ID = __WALLETCONNECT_PROJECT_ID__;\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\n// export const WALLETCONNECT_PROJECT_ID = \"4ead125c-63be-4b1a-a835-cef2dce67b84\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMO,IAAM,WAAW;AACjB,IAAM,cAAsB;AAC5B,IAAM,WAAmB;AACzB,IAAM,SAAiB;AACvB,IAAM,aAAa;AACnB,IAAM,2BAA2B;AAGjC,IAAM,kBAAkB;","names":[]}
1
+ {"version":3,"sources":["../src/constants.ts"],"sourcesContent":["// constants.ts\ndeclare const __SDK_VERSION__: string;\ndeclare const __API_ROOT__: string;\ndeclare const __GTM_ID__: string;\ndeclare const __WALLETCONNECT_PROJECT_ID__: string;\n\nexport const SDK_NAME = \"@trustware/sdk\";\nexport const SDK_VERSION: string = __SDK_VERSION__;\nexport const API_ROOT: string = __API_ROOT__;\nexport const GTM_ID: string = __GTM_ID__;\nexport const API_PREFIX = \"/api\";\nexport const WALLETCONNECT_PROJECT_ID = __WALLETCONNECT_PROJECT_ID__;\n\n// Assets base URL for wallet logos and other static assets\nexport const ASSETS_BASE_URL = \"https://app.trustware.io\";\n// export const ASSETS_BASE_URL = \"https://bv.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\n// export const WALLETCONNECT_PROJECT_ID = \"4ead125c-63be-4b1a-a835-cef2dce67b84\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMO,IAAM,WAAW;AACjB,IAAM,cAAsB;AAC5B,IAAM,WAAmB;AACzB,IAAM,SAAiB;AACvB,IAAM,aAAa;AACnB,IAAM,2BAA2B;AAGjC,IAAM,kBAAkB;","names":[]}
@@ -1,6 +1,6 @@
1
1
  // src/constants.ts
2
2
  var SDK_NAME = "@trustware/sdk";
3
- var SDK_VERSION = "1.1.8-staging.8";
3
+ var SDK_VERSION = "1.1.9-staging.3";
4
4
  var API_ROOT = "https://bv-staging-api.trustware.io";
5
5
  var GTM_ID = "GTM-TZDGNCXB";
6
6
  var API_PREFIX = "/api";
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/constants.ts"],"sourcesContent":["// constants.ts\ndeclare const __SDK_VERSION__: string;\ndeclare const __API_ROOT__: string;\ndeclare const __GTM_ID__: string;\ndeclare const __WALLETCONNECT_PROJECT_ID__: string;\n\nexport const SDK_NAME = \"@trustware/sdk\";\nexport const SDK_VERSION: string = __SDK_VERSION__;\nexport const API_ROOT: string = __API_ROOT__;\nexport const GTM_ID: string = __GTM_ID__;\nexport const API_PREFIX = \"/api\";\nexport const WALLETCONNECT_PROJECT_ID = __WALLETCONNECT_PROJECT_ID__;\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\n// export const WALLETCONNECT_PROJECT_ID = \"4ead125c-63be-4b1a-a835-cef2dce67b84\";\n"],"mappings":";AAMO,IAAM,WAAW;AACjB,IAAM,cAAsB;AAC5B,IAAM,WAAmB;AACzB,IAAM,SAAiB;AACvB,IAAM,aAAa;AACnB,IAAM,2BAA2B;AAGjC,IAAM,kBAAkB;","names":[]}
1
+ {"version":3,"sources":["../src/constants.ts"],"sourcesContent":["// constants.ts\ndeclare const __SDK_VERSION__: string;\ndeclare const __API_ROOT__: string;\ndeclare const __GTM_ID__: string;\ndeclare const __WALLETCONNECT_PROJECT_ID__: string;\n\nexport const SDK_NAME = \"@trustware/sdk\";\nexport const SDK_VERSION: string = __SDK_VERSION__;\nexport const API_ROOT: string = __API_ROOT__;\nexport const GTM_ID: string = __GTM_ID__;\nexport const API_PREFIX = \"/api\";\nexport const WALLETCONNECT_PROJECT_ID = __WALLETCONNECT_PROJECT_ID__;\n\n// Assets base URL for wallet logos and other static assets\nexport const ASSETS_BASE_URL = \"https://app.trustware.io\";\n// export const ASSETS_BASE_URL = \"https://bv.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\n// export const WALLETCONNECT_PROJECT_ID = \"4ead125c-63be-4b1a-a835-cef2dce67b84\";\n"],"mappings":";AAMO,IAAM,WAAW;AACjB,IAAM,cAAsB;AAC5B,IAAM,WAAmB;AACzB,IAAM,SAAiB;AACvB,IAAM,aAAa;AACnB,IAAM,2BAA2B;AAGjC,IAAM,kBAAkB;","names":[]}
@@ -1,6 +1,6 @@
1
- import { B as BuildRouteResult, T as Transaction, v as TrustwareConfigOptions, P as WalletInterFaceAPI, j as ResolvedTrustwareConfig, M as WalletIdentity, a7 as walletManager, C as WalletAddressResolution, X as buildRoute, V as buildDepositAddress, a1 as submitReceipt, _ as getStatus, $ as pollStatus } from './manager-aOd3vkF9.js';
2
- import { C as ChainDef, c as ChainType, B as BalanceRow, a as BalanceStreamOptions, W as WalletAddressBalanceWrapper } from './blockchain-BONedEsU.js';
3
- import { T as Token } from './types-MtdjJgwT.js';
1
+ import { B as BuildRouteResult, b as Transaction, T as TrustwareConfigOptions, W as WalletInterFaceAPI, m as ResolvedTrustwareConfig, y as TrustwareTheme, N as WalletIdentity, a0 as walletManager, G as WalletAddressResolution, a3 as buildRoute, a4 as buildDepositAddress, a5 as submitReceipt, a6 as getStatus, a7 as pollStatus } from './manager-xFiq0SHr.js';
2
+ import { C as ChainDef, c as ChainType, G as GetBalancesOptions, B as BalanceRow, a as BalanceStreamOptions, W as WalletAddressBalanceWrapper } from './blockchain-BxAFzp0s.js';
3
+ import { T as Token } from './types-BJY9r-mz.js';
4
4
 
5
5
  type AddressValidationResult = {
6
6
  isValid: boolean;
@@ -21,7 +21,7 @@ declare function validateRouteAddresses(params: {
21
21
  }): AddressValidationResult;
22
22
 
23
23
  /** Map chain reference -> backend chain_key and return enriched balances */
24
- declare function getBalances(chainRef: string | number, address: string): Promise<BalanceRow[]>;
24
+ declare function getBalances(chainRef: string | number, address: string, opts?: GetBalancesOptions): Promise<BalanceRow[]>;
25
25
  declare function getBalancesByAddress(address: string, opts?: BalanceStreamOptions): Promise<WalletAddressBalanceWrapper[]>;
26
26
  declare function getBalancesByAddressStream(address: string, opts?: BalanceStreamOptions): AsyncGenerator<WalletAddressBalanceWrapper[], void, void>;
27
27
 
@@ -85,6 +85,34 @@ declare const Trustware: {
85
85
  autoDetect(_timeoutMs?: number): Promise<boolean>;
86
86
  /** Read resolved config */
87
87
  getConfig(): ResolvedTrustwareConfig;
88
+ /**
89
+ * Read the SDK's currently configured theme mode.
90
+ *
91
+ * Returns the raw setting — `"light" | "dark" | "system"` — i.e. whatever
92
+ * was last passed to `init()` or `setTheme()`. When the mode is `"system"`,
93
+ * the widget resolves the actual light/dark appearance itself (from the OS
94
+ * `prefers-color-scheme`, or a saved preference if the user has used the
95
+ * widget's built-in theme toggle), so this getter still reports `"system"`
96
+ * rather than the resolved value.
97
+ */
98
+ getTheme(): TrustwareTheme;
99
+ /**
100
+ * Set the widget's theme at runtime.
101
+ *
102
+ * Call this from your own app's theme toggle to keep an embedded
103
+ * `TrustwareWidget` in sync with your UI — no remount required, any
104
+ * mounted widget picks up the change immediately.
105
+ *
106
+ * Passing `"light"` or `"dark"` pins the widget to that mode. Passing
107
+ * `"system"` makes it follow the OS preference again — unless the user
108
+ * previously used the widget's own in-widget theme toggle, in which case
109
+ * their saved choice takes precedence until they toggle it again.
110
+ *
111
+ * @example
112
+ * // In your app's own dark-mode toggle handler:
113
+ * Trustware.setTheme(isDark ? "dark" : "light");
114
+ */
115
+ setTheme(theme: TrustwareTheme): /*elided*/ any;
88
116
  setDestinationAddress(address?: string | null): /*elided*/ any;
89
117
  setDestinationChain(chain: string): /*elided*/ any;
90
118
  setDestinationToken(token: string): /*elided*/ any;
@@ -1,6 +1,6 @@
1
- import { B as BuildRouteResult, T as Transaction, v as TrustwareConfigOptions, P as WalletInterFaceAPI, j as ResolvedTrustwareConfig, M as WalletIdentity, a7 as walletManager, C as WalletAddressResolution, X as buildRoute, V as buildDepositAddress, a1 as submitReceipt, _ as getStatus, $ as pollStatus } from './manager-DKVW7zeh.cjs';
2
- import { C as ChainDef, c as ChainType, B as BalanceRow, a as BalanceStreamOptions, W as WalletAddressBalanceWrapper } from './blockchain-BONedEsU.cjs';
3
- import { T as Token } from './types-B3nKHW6H.cjs';
1
+ import { B as BuildRouteResult, b as Transaction, T as TrustwareConfigOptions, W as WalletInterFaceAPI, m as ResolvedTrustwareConfig, y as TrustwareTheme, N as WalletIdentity, a0 as walletManager, G as WalletAddressResolution, a3 as buildRoute, a4 as buildDepositAddress, a5 as submitReceipt, a6 as getStatus, a7 as pollStatus } from './manager-B5aklGtm.cjs';
2
+ import { C as ChainDef, c as ChainType, G as GetBalancesOptions, B as BalanceRow, a as BalanceStreamOptions, W as WalletAddressBalanceWrapper } from './blockchain-BxAFzp0s.cjs';
3
+ import { T as Token } from './types-DX3HtFcn.cjs';
4
4
 
5
5
  type AddressValidationResult = {
6
6
  isValid: boolean;
@@ -21,7 +21,7 @@ declare function validateRouteAddresses(params: {
21
21
  }): AddressValidationResult;
22
22
 
23
23
  /** Map chain reference -> backend chain_key and return enriched balances */
24
- declare function getBalances(chainRef: string | number, address: string): Promise<BalanceRow[]>;
24
+ declare function getBalances(chainRef: string | number, address: string, opts?: GetBalancesOptions): Promise<BalanceRow[]>;
25
25
  declare function getBalancesByAddress(address: string, opts?: BalanceStreamOptions): Promise<WalletAddressBalanceWrapper[]>;
26
26
  declare function getBalancesByAddressStream(address: string, opts?: BalanceStreamOptions): AsyncGenerator<WalletAddressBalanceWrapper[], void, void>;
27
27
 
@@ -85,6 +85,34 @@ declare const Trustware: {
85
85
  autoDetect(_timeoutMs?: number): Promise<boolean>;
86
86
  /** Read resolved config */
87
87
  getConfig(): ResolvedTrustwareConfig;
88
+ /**
89
+ * Read the SDK's currently configured theme mode.
90
+ *
91
+ * Returns the raw setting — `"light" | "dark" | "system"` — i.e. whatever
92
+ * was last passed to `init()` or `setTheme()`. When the mode is `"system"`,
93
+ * the widget resolves the actual light/dark appearance itself (from the OS
94
+ * `prefers-color-scheme`, or a saved preference if the user has used the
95
+ * widget's built-in theme toggle), so this getter still reports `"system"`
96
+ * rather than the resolved value.
97
+ */
98
+ getTheme(): TrustwareTheme;
99
+ /**
100
+ * Set the widget's theme at runtime.
101
+ *
102
+ * Call this from your own app's theme toggle to keep an embedded
103
+ * `TrustwareWidget` in sync with your UI — no remount required, any
104
+ * mounted widget picks up the change immediately.
105
+ *
106
+ * Passing `"light"` or `"dark"` pins the widget to that mode. Passing
107
+ * `"system"` makes it follow the OS preference again — unless the user
108
+ * previously used the widget's own in-widget theme toggle, in which case
109
+ * their saved choice takes precedence until they toggle it again.
110
+ *
111
+ * @example
112
+ * // In your app's own dark-mode toggle handler:
113
+ * Trustware.setTheme(isDark ? "dark" : "light");
114
+ */
115
+ setTheme(theme: TrustwareTheme): /*elided*/ any;
88
116
  setDestinationAddress(address?: string | null): /*elided*/ any;
89
117
  setDestinationChain(chain: string): /*elided*/ any;
90
118
  setDestinationToken(token: string): /*elided*/ any;
package/dist/core.cjs CHANGED
@@ -75,7 +75,7 @@ var init_constants = __esm({
75
75
  "src/constants.ts"() {
76
76
  "use strict";
77
77
  SDK_NAME = "@trustware/sdk";
78
- SDK_VERSION = "1.1.8-staging.8";
78
+ SDK_VERSION = "1.1.9-staging.3";
79
79
  API_ROOT = "https://bv-staging-api.trustware.io";
80
80
  API_PREFIX = "/api";
81
81
  WALLETCONNECT_PROJECT_ID = "72ea74c400f5111d43aea638d7d83a24";
@@ -93,16 +93,6 @@ var init_config2 = __esm({
93
93
  });
94
94
 
95
95
  // src/core/http.ts
96
- var http_exports = {};
97
- __export(http_exports, {
98
- RateLimitError: () => RateLimitError,
99
- apiBase: () => apiBase,
100
- assertOK: () => assertOK,
101
- jsonHeaders: () => jsonHeaders,
102
- parseRateLimitHeaders: () => parseRateLimitHeaders,
103
- rateLimitedFetch: () => rateLimitedFetch,
104
- validateSdkAccess: () => validateSdkAccess
105
- });
106
96
  function apiBase() {
107
97
  return `${API_ROOT}${API_PREFIX}`;
108
98
  }
@@ -300,11 +290,6 @@ var init_chains = __esm({
300
290
  });
301
291
 
302
292
  // src/registry.ts
303
- var registry_exports = {};
304
- __export(registry_exports, {
305
- NATIVE: () => NATIVE,
306
- Registry: () => Registry
307
- });
308
293
  function getChainAliases(chain) {
309
294
  const values = [
310
295
  chain.chainId,
@@ -1838,7 +1823,7 @@ async function parseStreamingBalances(response, address, options = {}) {
1838
1823
  }
1839
1824
  return stream();
1840
1825
  }
1841
- async function getBalances(chainRef, address) {
1826
+ async function getBalances(chainRef, address, opts) {
1842
1827
  const reg = await ensureRegistry();
1843
1828
  const chain = reg.chain(chainRef);
1844
1829
  if (!chain) return [];
@@ -1853,8 +1838,10 @@ async function getBalances(chainRef, address) {
1853
1838
  chain.nativeCurrency?.decimals ?? "",
1854
1839
  normalizeChainType(chain) ?? ""
1855
1840
  ].join(":");
1856
- const cached = balanceCache.get(cacheKey);
1857
- if (cached) return cached;
1841
+ if (!opts?.forceRefresh) {
1842
+ const cached = balanceCache.get(cacheKey);
1843
+ if (cached) return cached;
1844
+ }
1858
1845
  const url = `${apiBase()}/v1/data/wallets/${encodeURIComponent(chainKey)}/${trimmedAddress}/balances`;
1859
1846
  const response = await fetch(url, {
1860
1847
  method: "GET",
@@ -2167,11 +2154,27 @@ function toSolanaWalletInterface(provider) {
2167
2154
  serializedTransactionBase64
2168
2155
  );
2169
2156
  if (provider.signAndSendTransaction) {
2170
- const result = await provider.signAndSendTransaction(transaction, {
2171
- preflightCommitment: "confirmed"
2172
- });
2173
- if (typeof result === "string") return result;
2174
- if (result?.signature) return result.signature;
2157
+ const MAX_INTERNAL_ERROR_ATTEMPTS = 3;
2158
+ const INTERNAL_ERROR_RETRY_DELAY_MS = 500;
2159
+ for (let attempt = 1; attempt <= MAX_INTERNAL_ERROR_ATTEMPTS; attempt++) {
2160
+ try {
2161
+ const result = await provider.signAndSendTransaction(transaction, {
2162
+ skipPreflight: true
2163
+ });
2164
+ if (typeof result === "string") return result;
2165
+ if (result?.signature) return result.signature;
2166
+ break;
2167
+ } catch (err) {
2168
+ const code = err?.code;
2169
+ if (code === -32603 && attempt < MAX_INTERNAL_ERROR_ATTEMPTS) {
2170
+ await new Promise(
2171
+ (resolve) => setTimeout(resolve, INTERNAL_ERROR_RETRY_DELAY_MS * attempt)
2172
+ );
2173
+ continue;
2174
+ }
2175
+ throw err;
2176
+ }
2177
+ }
2175
2178
  }
2176
2179
  if (!provider.signTransaction) {
2177
2180
  throw new Error("Connected Solana wallet cannot sign transactions");
@@ -3901,6 +3904,10 @@ var init_routes = __esm({
3901
3904
  });
3902
3905
 
3903
3906
  // src/core/registryClient.ts
3907
+ var registryClient_exports = {};
3908
+ __export(registryClient_exports, {
3909
+ getSharedRegistry: () => getSharedRegistry
3910
+ });
3904
3911
  function registryCacheKey() {
3905
3912
  const base = apiBase();
3906
3913
  const apiKey = TrustwareConfigStore.peek()?.apiKey ?? "__uninitialized__";
@@ -6068,7 +6075,6 @@ function resolveConfig(input) {
6068
6075
  defaultSlippage: normalizeSlippage(
6069
6076
  input.routes.defaultSlippage ?? DEFAULT_SLIPPAGE
6070
6077
  ),
6071
- routeType: input.routes.routeType ?? "swap",
6072
6078
  options: {
6073
6079
  ...input.routes.options
6074
6080
  }
@@ -6268,10 +6274,9 @@ async function sendRouteTransaction(b, fallbackChainId) {
6268
6274
  if (w.ecosystem !== "solana") {
6269
6275
  throw new Error("A Solana wallet is required for this route");
6270
6276
  }
6271
- const { Registry: Registry2 } = await Promise.resolve().then(() => (init_registry(), registry_exports));
6272
- const { apiBase: apiBase2 } = await Promise.resolve().then(() => (init_http(), http_exports));
6273
- const registry = new Registry2(apiBase2());
6274
- await registry.ensureLoaded();
6277
+ const { getSharedRegistry: getSharedRegistry2 } = await Promise.resolve().then(() => (init_registryClient(), registryClient_exports));
6278
+ const registry = getSharedRegistry2();
6279
+ await registry.ensureChainsLoaded();
6275
6280
  const chain = registry.chain(
6276
6281
  String(fallbackChainId ?? txReq.chainId ?? "")
6277
6282
  );
@@ -6285,9 +6290,8 @@ async function sendRouteTransaction(b, fallbackChainId) {
6285
6290
  async function runTopUp(params) {
6286
6291
  const w = walletManager.wallet;
6287
6292
  if (!w) throw new Error("Trustware.wallet not configured");
6288
- const { Registry: Registry2 } = await Promise.resolve().then(() => (init_registry(), registry_exports));
6289
- const { apiBase: apiBase2 } = await Promise.resolve().then(() => (init_http(), http_exports));
6290
- const reg = new Registry2(apiBase2());
6293
+ const { getSharedRegistry: getSharedRegistry2 } = await Promise.resolve().then(() => (init_registryClient(), registryClient_exports));
6294
+ const reg = getSharedRegistry2();
6291
6295
  await reg.ensureLoaded();
6292
6296
  const fromAddress = await w.getAddress();
6293
6297
  const currentChainRef = w.ecosystem === "evm" ? String(await w.getChainId()) : await w.getChainKey?.() ?? "solana-mainnet-beta";
@@ -6398,6 +6402,39 @@ var init_core = __esm({
6398
6402
  getConfig() {
6399
6403
  return TrustwareConfigStore.get();
6400
6404
  },
6405
+ /**
6406
+ * Read the SDK's currently configured theme mode.
6407
+ *
6408
+ * Returns the raw setting — `"light" | "dark" | "system"` — i.e. whatever
6409
+ * was last passed to `init()` or `setTheme()`. When the mode is `"system"`,
6410
+ * the widget resolves the actual light/dark appearance itself (from the OS
6411
+ * `prefers-color-scheme`, or a saved preference if the user has used the
6412
+ * widget's built-in theme toggle), so this getter still reports `"system"`
6413
+ * rather than the resolved value.
6414
+ */
6415
+ getTheme() {
6416
+ return TrustwareConfigStore.get().theme;
6417
+ },
6418
+ /**
6419
+ * Set the widget's theme at runtime.
6420
+ *
6421
+ * Call this from your own app's theme toggle to keep an embedded
6422
+ * `TrustwareWidget` in sync with your UI — no remount required, any
6423
+ * mounted widget picks up the change immediately.
6424
+ *
6425
+ * Passing `"light"` or `"dark"` pins the widget to that mode. Passing
6426
+ * `"system"` makes it follow the OS preference again — unless the user
6427
+ * previously used the widget's own in-widget theme toggle, in which case
6428
+ * their saved choice takes precedence until they toggle it again.
6429
+ *
6430
+ * @example
6431
+ * // In your app's own dark-mode toggle handler:
6432
+ * Trustware.setTheme(isDark ? "dark" : "light");
6433
+ */
6434
+ setTheme(theme) {
6435
+ TrustwareConfigStore.update({ theme });
6436
+ return Trustware;
6437
+ },
6401
6438
  setDestinationAddress(address) {
6402
6439
  const prev = TrustwareConfigStore.get();
6403
6440
  TrustwareConfigStore.update({