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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) 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.mjs +1 -1
  6. package/dist/{core-BjQwlpoI.d.cts → core-D_jx805U.d.cts} +32 -4
  7. package/dist/{core-BQ0mFnLc.d.ts → core-p_5BLdbE.d.ts} +32 -4
  8. package/dist/core.cjs +69 -32
  9. package/dist/core.cjs.map +1 -1
  10. package/dist/core.d.cts +4 -4
  11. package/dist/core.d.ts +4 -4
  12. package/dist/core.mjs +69 -32
  13. package/dist/core.mjs.map +1 -1
  14. package/dist/{detect-DlbgTrkm.d.cts → detect--pmNlAHv.d.cts} +1 -1
  15. package/dist/{detect-MWKHLhn9.d.ts → detect-qAX6I4JI.d.ts} +1 -1
  16. package/dist/index.cjs +108 -66
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +8 -8
  19. package/dist/index.d.ts +8 -8
  20. package/dist/index.mjs +108 -66
  21. package/dist/index.mjs.map +1 -1
  22. package/dist/{manager-aOd3vkF9.d.ts → manager-DFQkemW0.d.ts} +1 -3
  23. package/dist/{manager-DKVW7zeh.d.cts → manager-aMi4_Ss6.d.cts} +1 -3
  24. package/dist/smart-account.cjs +1 -2
  25. package/dist/smart-account.cjs.map +1 -1
  26. package/dist/smart-account.mjs +1 -2
  27. package/dist/smart-account.mjs.map +1 -1
  28. package/dist/{types-MtdjJgwT.d.ts → types-BJY9r-mz.d.ts} +1 -1
  29. package/dist/{types-B3nKHW6H.d.cts → types-DX3HtFcn.d.cts} +1 -1
  30. package/dist/wallet.cjs +22 -7
  31. package/dist/wallet.cjs.map +1 -1
  32. package/dist/wallet.d.cts +4 -4
  33. package/dist/wallet.d.ts +4 -4
  34. package/dist/wallet.mjs +22 -7
  35. package/dist/wallet.mjs.map +1 -1
  36. package/dist/widget.cjs +81 -39
  37. package/dist/widget.cjs.map +1 -1
  38. package/dist/widget.d.cts +2 -2
  39. package/dist/widget.d.ts +2 -2
  40. package/dist/widget.mjs +81 -39
  41. package/dist/widget.mjs.map +1 -1
  42. package/package.json +1 -1
package/dist/index.d.cts CHANGED
@@ -1,13 +1,13 @@
1
- import { T as Trustware } from './core-BjQwlpoI.cjs';
2
- export { a as TrustwareCore, v as validateAddressForChain, b as validateBtcAddress, c as validateEvmAddress, d as validateRouteAddresses, e as validateSeiAddress, f as validateSolanaAddress } from './core-BjQwlpoI.cjs';
3
- import { R as RateLimitInfo, v as TrustwareConfigOptions, P as WalletInterFaceAPI, w as TrustwareError, T as Transaction, x as TrustwareEvent } from './manager-DKVW7zeh.cjs';
4
- export { B as BuildRouteResult, D as DEFAULT_AUTO_DETECT_PROVIDER, a as DEFAULT_FEATURE_FLAGS, b as DEFAULT_MESSAGES, c as DEFAULT_RETRY_CONFIG, d as DEFAULT_SLIPPAGE, e as DetectedWallet, E as EIP1193, f as EIP6963ProviderDetail, g as EvmWalletInterface, F as FeatureFlags, I as IdentityStore, h as ResolvedFeatureFlags, i as ResolvedRetryConfig, j as ResolvedTrustwareConfig, k as ResolvedWalletConnectConfig, l as RetryConfig, m as RouteEstimate, n as RouteIntent, o as RouteParams, p as RoutePlan, q as RouteSponsorship, S as SimpleWalletInterface, r as SolanaProviderLike, s as SolanaWalletInterface, t as SponsorshipApproval, u as SwapTokenRef, y as TrustwareTheme, z as TrustwareWidgetMessages, W as WagmiBridge, A as WagmiConnector, C as WalletAddressResolution, G as WalletAddressSource, H as WalletCategory, J as WalletConnectConfig, K as WalletEcosystem, L as WalletId, M as WalletIdentity, N as WalletIdentityAddress, O as WalletIdentityChainLike, Q as WalletMeta, Y as buildWalletIdentityAddress, Z as createWalletIdentity, a0 as resolveWalletAddressForChain, a2 as upsertWalletIdentityAddress, a4 as useWalletExternalDisconnect, a5 as useWalletInfo, a6 as useWireDetectionIntoManager, a7 as walletManager } from './manager-DKVW7zeh.cjs';
1
+ import { T as Trustware } from './core-D_jx805U.cjs';
2
+ export { a as TrustwareCore, v as validateAddressForChain, b as validateBtcAddress, c as validateEvmAddress, d as validateRouteAddresses, e as validateSeiAddress, f as validateSolanaAddress } from './core-D_jx805U.cjs';
3
+ import { R as RateLimitInfo, v as TrustwareConfigOptions, P as WalletInterFaceAPI, w as TrustwareError, T as Transaction, x as TrustwareEvent } from './manager-aMi4_Ss6.cjs';
4
+ export { B as BuildRouteResult, D as DEFAULT_AUTO_DETECT_PROVIDER, a as DEFAULT_FEATURE_FLAGS, b as DEFAULT_MESSAGES, c as DEFAULT_RETRY_CONFIG, d as DEFAULT_SLIPPAGE, e as DetectedWallet, E as EIP1193, f as EIP6963ProviderDetail, g as EvmWalletInterface, F as FeatureFlags, I as IdentityStore, h as ResolvedFeatureFlags, i as ResolvedRetryConfig, j as ResolvedTrustwareConfig, k as ResolvedWalletConnectConfig, l as RetryConfig, m as RouteEstimate, n as RouteIntent, o as RouteParams, p as RoutePlan, q as RouteSponsorship, S as SimpleWalletInterface, r as SolanaProviderLike, s as SolanaWalletInterface, t as SponsorshipApproval, u as SwapTokenRef, y as TrustwareTheme, z as TrustwareWidgetMessages, W as WagmiBridge, A as WagmiConnector, C as WalletAddressResolution, G as WalletAddressSource, H as WalletCategory, J as WalletConnectConfig, K as WalletEcosystem, L as WalletId, M as WalletIdentity, N as WalletIdentityAddress, O as WalletIdentityChainLike, Q as WalletMeta, Y as buildWalletIdentityAddress, Z as createWalletIdentity, a0 as resolveWalletAddressForChain, a2 as upsertWalletIdentityAddress, a4 as useWalletExternalDisconnect, a5 as useWalletInfo, a6 as useWireDetectionIntoManager, a7 as walletManager } from './manager-aMi4_Ss6.cjs';
5
5
  import * as React from 'react';
6
6
  import React__default from 'react';
7
- import { C as ChainDef } from './blockchain-BONedEsU.cjs';
8
- export { B as BalanceRow, a as BalanceStreamOptions, b as ChainMeta, c as ChainType, N as NativeCurrency, T as TokenDef, d as TokenMeta, e as TokenPageInfo, f as TokenPageOptions, g as TokenPageResult, h as TokenType, i as TokenWithBalance, W as WalletAddressBalanceWrapper } from './blockchain-BONedEsU.cjs';
9
- import { T as Token, Y as YourTokenData } from './types-B3nKHW6H.cjs';
10
- export { c as connectDetectedWallet, t as toWalletInterfaceFromDetected, u as useEIP1193, f as useWagmi, g as useWalletDetection } from './detect-DlbgTrkm.cjs';
7
+ import { C as ChainDef } from './blockchain-BxAFzp0s.cjs';
8
+ export { B as BalanceRow, a as BalanceStreamOptions, b as ChainMeta, c as ChainType, G as GetBalancesOptions, N as NativeCurrency, T as TokenDef, d as TokenMeta, e as TokenPageInfo, f as TokenPageOptions, g as TokenPageResult, h as TokenType, i as TokenWithBalance, W as WalletAddressBalanceWrapper } from './blockchain-BxAFzp0s.cjs';
9
+ import { T as Token, Y as YourTokenData } from './types-DX3HtFcn.cjs';
10
+ export { c as connectDetectedWallet, t as toWalletInterfaceFromDetected, u as useEIP1193, f as useWagmi, g as useWalletDetection } from './detect--pmNlAHv.cjs';
11
11
  export { TrustwareWidget } from './widget.cjs';
12
12
  import * as react_jsx_runtime from 'react/jsx-runtime';
13
13
  export { API_PREFIX, API_ROOT, ASSETS_BASE_URL, GTM_ID, SDK_NAME, SDK_VERSION, WALLETCONNECT_PROJECT_ID } from './constants.cjs';
package/dist/index.d.ts CHANGED
@@ -1,13 +1,13 @@
1
- import { T as Trustware } from './core-BQ0mFnLc.js';
2
- export { a as TrustwareCore, v as validateAddressForChain, b as validateBtcAddress, c as validateEvmAddress, d as validateRouteAddresses, e as validateSeiAddress, f as validateSolanaAddress } from './core-BQ0mFnLc.js';
3
- import { R as RateLimitInfo, v as TrustwareConfigOptions, P as WalletInterFaceAPI, w as TrustwareError, T as Transaction, x as TrustwareEvent } from './manager-aOd3vkF9.js';
4
- export { B as BuildRouteResult, D as DEFAULT_AUTO_DETECT_PROVIDER, a as DEFAULT_FEATURE_FLAGS, b as DEFAULT_MESSAGES, c as DEFAULT_RETRY_CONFIG, d as DEFAULT_SLIPPAGE, e as DetectedWallet, E as EIP1193, f as EIP6963ProviderDetail, g as EvmWalletInterface, F as FeatureFlags, I as IdentityStore, h as ResolvedFeatureFlags, i as ResolvedRetryConfig, j as ResolvedTrustwareConfig, k as ResolvedWalletConnectConfig, l as RetryConfig, m as RouteEstimate, n as RouteIntent, o as RouteParams, p as RoutePlan, q as RouteSponsorship, S as SimpleWalletInterface, r as SolanaProviderLike, s as SolanaWalletInterface, t as SponsorshipApproval, u as SwapTokenRef, y as TrustwareTheme, z as TrustwareWidgetMessages, W as WagmiBridge, A as WagmiConnector, C as WalletAddressResolution, G as WalletAddressSource, H as WalletCategory, J as WalletConnectConfig, K as WalletEcosystem, L as WalletId, M as WalletIdentity, N as WalletIdentityAddress, O as WalletIdentityChainLike, Q as WalletMeta, Y as buildWalletIdentityAddress, Z as createWalletIdentity, a0 as resolveWalletAddressForChain, a2 as upsertWalletIdentityAddress, a4 as useWalletExternalDisconnect, a5 as useWalletInfo, a6 as useWireDetectionIntoManager, a7 as walletManager } from './manager-aOd3vkF9.js';
1
+ import { T as Trustware } from './core-p_5BLdbE.js';
2
+ export { a as TrustwareCore, v as validateAddressForChain, b as validateBtcAddress, c as validateEvmAddress, d as validateRouteAddresses, e as validateSeiAddress, f as validateSolanaAddress } from './core-p_5BLdbE.js';
3
+ import { R as RateLimitInfo, v as TrustwareConfigOptions, P as WalletInterFaceAPI, w as TrustwareError, T as Transaction, x as TrustwareEvent } from './manager-DFQkemW0.js';
4
+ export { B as BuildRouteResult, D as DEFAULT_AUTO_DETECT_PROVIDER, a as DEFAULT_FEATURE_FLAGS, b as DEFAULT_MESSAGES, c as DEFAULT_RETRY_CONFIG, d as DEFAULT_SLIPPAGE, e as DetectedWallet, E as EIP1193, f as EIP6963ProviderDetail, g as EvmWalletInterface, F as FeatureFlags, I as IdentityStore, h as ResolvedFeatureFlags, i as ResolvedRetryConfig, j as ResolvedTrustwareConfig, k as ResolvedWalletConnectConfig, l as RetryConfig, m as RouteEstimate, n as RouteIntent, o as RouteParams, p as RoutePlan, q as RouteSponsorship, S as SimpleWalletInterface, r as SolanaProviderLike, s as SolanaWalletInterface, t as SponsorshipApproval, u as SwapTokenRef, y as TrustwareTheme, z as TrustwareWidgetMessages, W as WagmiBridge, A as WagmiConnector, C as WalletAddressResolution, G as WalletAddressSource, H as WalletCategory, J as WalletConnectConfig, K as WalletEcosystem, L as WalletId, M as WalletIdentity, N as WalletIdentityAddress, O as WalletIdentityChainLike, Q as WalletMeta, Y as buildWalletIdentityAddress, Z as createWalletIdentity, a0 as resolveWalletAddressForChain, a2 as upsertWalletIdentityAddress, a4 as useWalletExternalDisconnect, a5 as useWalletInfo, a6 as useWireDetectionIntoManager, a7 as walletManager } from './manager-DFQkemW0.js';
5
5
  import * as React from 'react';
6
6
  import React__default from 'react';
7
- import { C as ChainDef } from './blockchain-BONedEsU.js';
8
- export { B as BalanceRow, a as BalanceStreamOptions, b as ChainMeta, c as ChainType, N as NativeCurrency, T as TokenDef, d as TokenMeta, e as TokenPageInfo, f as TokenPageOptions, g as TokenPageResult, h as TokenType, i as TokenWithBalance, W as WalletAddressBalanceWrapper } from './blockchain-BONedEsU.js';
9
- import { T as Token, Y as YourTokenData } from './types-MtdjJgwT.js';
10
- export { c as connectDetectedWallet, t as toWalletInterfaceFromDetected, u as useEIP1193, f as useWagmi, g as useWalletDetection } from './detect-MWKHLhn9.js';
7
+ import { C as ChainDef } from './blockchain-BxAFzp0s.js';
8
+ export { B as BalanceRow, a as BalanceStreamOptions, b as ChainMeta, c as ChainType, G as GetBalancesOptions, N as NativeCurrency, T as TokenDef, d as TokenMeta, e as TokenPageInfo, f as TokenPageOptions, g as TokenPageResult, h as TokenType, i as TokenWithBalance, W as WalletAddressBalanceWrapper } from './blockchain-BxAFzp0s.js';
9
+ import { T as Token, Y as YourTokenData } from './types-BJY9r-mz.js';
10
+ export { c as connectDetectedWallet, t as toWalletInterfaceFromDetected, u as useEIP1193, f as useWagmi, g as useWalletDetection } from './detect-qAX6I4JI.js';
11
11
  export { TrustwareWidget } from './widget.js';
12
12
  import * as react_jsx_runtime from 'react/jsx-runtime';
13
13
  export { API_PREFIX, API_ROOT, ASSETS_BASE_URL, GTM_ID, SDK_NAME, SDK_VERSION, WALLETCONNECT_PROJECT_ID } from './constants.js';
package/dist/index.mjs CHANGED
@@ -107,7 +107,6 @@ function resolveConfig(input) {
107
107
  defaultSlippage: normalizeSlippage(
108
108
  input.routes.defaultSlippage ?? DEFAULT_SLIPPAGE
109
109
  ),
110
- routeType: input.routes.routeType ?? "swap",
111
110
  options: {
112
111
  ...input.routes.options
113
112
  }
@@ -409,7 +408,7 @@ var init_constants = __esm({
409
408
  "src/constants.ts"() {
410
409
  "use strict";
411
410
  SDK_NAME = "@trustware/sdk";
412
- SDK_VERSION = "1.1.8-staging.8";
411
+ SDK_VERSION = "1.1.9-staging.1";
413
412
  API_ROOT = "https://bv-staging-api.trustware.io";
414
413
  GTM_ID = "GTM-TZDGNCXB";
415
414
  API_PREFIX = "/api";
@@ -429,16 +428,6 @@ var init_config2 = __esm({
429
428
  });
430
429
 
431
430
  // src/core/http.ts
432
- var http_exports = {};
433
- __export(http_exports, {
434
- RateLimitError: () => RateLimitError,
435
- apiBase: () => apiBase,
436
- assertOK: () => assertOK,
437
- jsonHeaders: () => jsonHeaders,
438
- parseRateLimitHeaders: () => parseRateLimitHeaders,
439
- rateLimitedFetch: () => rateLimitedFetch,
440
- validateSdkAccess: () => validateSdkAccess
441
- });
442
431
  function apiBase() {
443
432
  return `${API_ROOT}${API_PREFIX}`;
444
433
  }
@@ -890,11 +879,27 @@ function toSolanaWalletInterface(provider) {
890
879
  serializedTransactionBase64
891
880
  );
892
881
  if (provider.signAndSendTransaction) {
893
- const result = await provider.signAndSendTransaction(transaction, {
894
- preflightCommitment: "confirmed"
895
- });
896
- if (typeof result === "string") return result;
897
- if (result?.signature) return result.signature;
882
+ const MAX_INTERNAL_ERROR_ATTEMPTS = 3;
883
+ const INTERNAL_ERROR_RETRY_DELAY_MS = 500;
884
+ for (let attempt = 1; attempt <= MAX_INTERNAL_ERROR_ATTEMPTS; attempt++) {
885
+ try {
886
+ const result = await provider.signAndSendTransaction(transaction, {
887
+ skipPreflight: true
888
+ });
889
+ if (typeof result === "string") return result;
890
+ if (result?.signature) return result.signature;
891
+ break;
892
+ } catch (err) {
893
+ const code = err?.code;
894
+ if (code === -32603 && attempt < MAX_INTERNAL_ERROR_ATTEMPTS) {
895
+ await new Promise(
896
+ (resolve) => setTimeout(resolve, INTERNAL_ERROR_RETRY_DELAY_MS * attempt)
897
+ );
898
+ continue;
899
+ }
900
+ throw err;
901
+ }
902
+ }
898
903
  }
899
904
  if (!provider.signTransaction) {
900
905
  throw new Error("Connected Solana wallet cannot sign transactions");
@@ -4173,11 +4178,6 @@ var init_routes = __esm({
4173
4178
  });
4174
4179
 
4175
4180
  // src/registry.ts
4176
- var registry_exports = {};
4177
- __export(registry_exports, {
4178
- NATIVE: () => NATIVE,
4179
- Registry: () => Registry
4180
- });
4181
4181
  function getChainAliases(chain) {
4182
4182
  const values = [
4183
4183
  chain.chainId,
@@ -4702,7 +4702,7 @@ async function parseStreamingBalances(response, address, options = {}) {
4702
4702
  }
4703
4703
  return stream();
4704
4704
  }
4705
- async function getBalances(chainRef, address) {
4705
+ async function getBalances(chainRef, address, opts) {
4706
4706
  const reg = await ensureRegistry();
4707
4707
  const chain = reg.chain(chainRef);
4708
4708
  if (!chain) return [];
@@ -4717,8 +4717,10 @@ async function getBalances(chainRef, address) {
4717
4717
  chain.nativeCurrency?.decimals ?? "",
4718
4718
  normalizeChainType(chain) ?? ""
4719
4719
  ].join(":");
4720
- const cached = balanceCache.get(cacheKey);
4721
- if (cached) return cached;
4720
+ if (!opts?.forceRefresh) {
4721
+ const cached = balanceCache.get(cacheKey);
4722
+ if (cached) return cached;
4723
+ }
4722
4724
  const url = `${apiBase()}/v1/data/wallets/${encodeURIComponent(chainKey)}/${trimmedAddress}/balances`;
4723
4725
  const response = await fetch(url, {
4724
4726
  method: "GET",
@@ -4804,6 +4806,37 @@ var init_balances = __esm({
4804
4806
  }
4805
4807
  });
4806
4808
 
4809
+ // src/core/registryClient.ts
4810
+ var registryClient_exports = {};
4811
+ __export(registryClient_exports, {
4812
+ getSharedRegistry: () => getSharedRegistry
4813
+ });
4814
+ function registryCacheKey() {
4815
+ const base2 = apiBase();
4816
+ const apiKey = TrustwareConfigStore.peek()?.apiKey ?? "__uninitialized__";
4817
+ return `${base2}::${apiKey}`;
4818
+ }
4819
+ function getSharedRegistry() {
4820
+ const key = registryCacheKey();
4821
+ const existing = registryCache.get(key);
4822
+ if (existing) {
4823
+ return existing;
4824
+ }
4825
+ const registry = new Registry(apiBase());
4826
+ registryCache.set(key, registry);
4827
+ return registry;
4828
+ }
4829
+ var registryCache;
4830
+ var init_registryClient = __esm({
4831
+ "src/core/registryClient.ts"() {
4832
+ "use strict";
4833
+ init_config2();
4834
+ init_registry();
4835
+ init_http();
4836
+ registryCache = /* @__PURE__ */ new Map();
4837
+ }
4838
+ });
4839
+
4807
4840
  // src/core/tx.ts
4808
4841
  import { keccak256 } from "viem";
4809
4842
  function backendChainId(chain, fallback) {
@@ -4876,10 +4909,9 @@ async function sendRouteTransaction(b, fallbackChainId) {
4876
4909
  if (w.ecosystem !== "solana") {
4877
4910
  throw new Error("A Solana wallet is required for this route");
4878
4911
  }
4879
- const { Registry: Registry2 } = await Promise.resolve().then(() => (init_registry(), registry_exports));
4880
- const { apiBase: apiBase2 } = await Promise.resolve().then(() => (init_http(), http_exports));
4881
- const registry = new Registry2(apiBase2());
4882
- await registry.ensureLoaded();
4912
+ const { getSharedRegistry: getSharedRegistry2 } = await Promise.resolve().then(() => (init_registryClient(), registryClient_exports));
4913
+ const registry = getSharedRegistry2();
4914
+ await registry.ensureChainsLoaded();
4883
4915
  const chain = registry.chain(
4884
4916
  String(fallbackChainId ?? txReq.chainId ?? "")
4885
4917
  );
@@ -4893,9 +4925,8 @@ async function sendRouteTransaction(b, fallbackChainId) {
4893
4925
  async function runTopUp(params) {
4894
4926
  const w = walletManager.wallet;
4895
4927
  if (!w) throw new Error("Trustware.wallet not configured");
4896
- const { Registry: Registry2 } = await Promise.resolve().then(() => (init_registry(), registry_exports));
4897
- const { apiBase: apiBase2 } = await Promise.resolve().then(() => (init_http(), http_exports));
4898
- const reg = new Registry2(apiBase2());
4928
+ const { getSharedRegistry: getSharedRegistry2 } = await Promise.resolve().then(() => (init_registryClient(), registryClient_exports));
4929
+ const reg = getSharedRegistry2();
4899
4930
  await reg.ensureLoaded();
4900
4931
  const fromAddress = await w.getAddress();
4901
4932
  const currentChainRef = w.ecosystem === "evm" ? String(await w.getChainId()) : await w.getChainKey?.() ?? "solana-mainnet-beta";
@@ -4949,33 +4980,6 @@ var init_tx = __esm({
4949
4980
  }
4950
4981
  });
4951
4982
 
4952
- // src/core/registryClient.ts
4953
- function registryCacheKey() {
4954
- const base2 = apiBase();
4955
- const apiKey = TrustwareConfigStore.peek()?.apiKey ?? "__uninitialized__";
4956
- return `${base2}::${apiKey}`;
4957
- }
4958
- function getSharedRegistry() {
4959
- const key = registryCacheKey();
4960
- const existing = registryCache.get(key);
4961
- if (existing) {
4962
- return existing;
4963
- }
4964
- const registry = new Registry(apiBase());
4965
- registryCache.set(key, registry);
4966
- return registry;
4967
- }
4968
- var registryCache;
4969
- var init_registryClient = __esm({
4970
- "src/core/registryClient.ts"() {
4971
- "use strict";
4972
- init_config2();
4973
- init_registry();
4974
- init_http();
4975
- registryCache = /* @__PURE__ */ new Map();
4976
- }
4977
- });
4978
-
4979
4983
  // src/widget/helpers/chainHelpers.ts
4980
4984
  function normalizeChainKey2(id) {
4981
4985
  if (id === void 0 || id === null) return "";
@@ -7180,6 +7184,39 @@ var init_core = __esm({
7180
7184
  getConfig() {
7181
7185
  return TrustwareConfigStore.get();
7182
7186
  },
7187
+ /**
7188
+ * Read the SDK's currently configured theme mode.
7189
+ *
7190
+ * Returns the raw setting — `"light" | "dark" | "system"` — i.e. whatever
7191
+ * was last passed to `init()` or `setTheme()`. When the mode is `"system"`,
7192
+ * the widget resolves the actual light/dark appearance itself (from the OS
7193
+ * `prefers-color-scheme`, or a saved preference if the user has used the
7194
+ * widget's built-in theme toggle), so this getter still reports `"system"`
7195
+ * rather than the resolved value.
7196
+ */
7197
+ getTheme() {
7198
+ return TrustwareConfigStore.get().theme;
7199
+ },
7200
+ /**
7201
+ * Set the widget's theme at runtime.
7202
+ *
7203
+ * Call this from your own app's theme toggle to keep an embedded
7204
+ * `TrustwareWidget` in sync with your UI — no remount required, any
7205
+ * mounted widget picks up the change immediately.
7206
+ *
7207
+ * Passing `"light"` or `"dark"` pins the widget to that mode. Passing
7208
+ * `"system"` makes it follow the OS preference again — unless the user
7209
+ * previously used the widget's own in-widget theme toggle, in which case
7210
+ * their saved choice takes precedence until they toggle it again.
7211
+ *
7212
+ * @example
7213
+ * // In your app's own dark-mode toggle handler:
7214
+ * Trustware.setTheme(isDark ? "dark" : "light");
7215
+ */
7216
+ setTheme(theme) {
7217
+ TrustwareConfigStore.update({ theme });
7218
+ return Trustware;
7219
+ },
7183
7220
  setDestinationAddress(address) {
7184
7221
  const prev = TrustwareConfigStore.get();
7185
7222
  TrustwareConfigStore.update({
@@ -7613,7 +7650,6 @@ function useTrustwareConfig() {
7613
7650
  toToken: "",
7614
7651
  toAddress: void 0,
7615
7652
  defaultSlippage: 1,
7616
- routeType: "swap",
7617
7653
  options: {}
7618
7654
  },
7619
7655
  autoDetectProvider: false,
@@ -9298,8 +9334,8 @@ var init_theme = __esm({
9298
9334
  --tw-accent-foreground: 0 0% 100%;
9299
9335
  --tw-destructive: 0 84% 60%;
9300
9336
  --tw-destructive-foreground: 0 0% 100%;
9301
- --tw-border: 220 13% 91%;
9302
- --tw-input: 220 13% 91%;
9337
+ --tw-border: 220 13% 94%;
9338
+ --tw-input: 220 13% 94%;
9303
9339
  --tw-ring: 217 91% 60%;
9304
9340
  --tw-radius: 1rem;
9305
9341
 
@@ -13731,7 +13767,7 @@ function ChainSelectorPanel({
13731
13767
  paddingTop: spacing[2],
13732
13768
  paddingBottom: spacing[2],
13733
13769
  fontSize: fontSize.sm,
13734
- backgroundColor: colors.muted,
13770
+ backgroundColor: colors.background,
13735
13771
  border: `1px solid ${colors.border}`,
13736
13772
  borderRadius: borderRadius.lg,
13737
13773
  color: colors.foreground,
@@ -13943,7 +13979,7 @@ function TokenSearchInput({
13943
13979
  paddingTop: spacing[2],
13944
13980
  paddingBottom: spacing[2],
13945
13981
  fontSize: fontSize.sm,
13946
- backgroundColor: colors.muted,
13982
+ backgroundColor: colors.background,
13947
13983
  border: `1px solid ${colors.border}`,
13948
13984
  borderRadius: borderRadius.lg,
13949
13985
  color: colors.foreground,
@@ -34282,8 +34318,13 @@ function SwapMode({
34282
34318
  setStage("processing");
34283
34319
  const fromTokenAddress = fromToken?.address ?? fromToken?.address;
34284
34320
  const fromTokenDecimals = fromToken?.decimals ?? void 0;
34321
+ let routeToSend = route.data;
34322
+ if (isSerializedSolanaTxRequest(routeToSend.txReq) && latestFetchParamsRef.current) {
34323
+ const fresh = await route.fetch(latestFetchParamsRef.current);
34324
+ if (fresh) routeToSend = fresh;
34325
+ }
34285
34326
  await execution.execute(
34286
- route.data,
34327
+ routeToSend,
34287
34328
  fromTokenAddress,
34288
34329
  fromTokenDecimals,
34289
34330
  walletAddress ?? void 0,
@@ -34294,7 +34335,7 @@ function SwapMode({
34294
34335
  },
34295
34336
  () => setStage("error")
34296
34337
  );
34297
- }, [route.data, execution, fromToken, walletAddress, maxApproval]);
34338
+ }, [route, execution, fromToken, walletAddress, maxApproval]);
34298
34339
  const handleReset = useCallback22(() => {
34299
34340
  execution.reset();
34300
34341
  route.clear();
@@ -38058,6 +38099,7 @@ var init_SwapMode = __esm({
38058
38099
  init_mapError();
38059
38100
  init_components();
38060
38101
  init_registryClient();
38102
+ init_routes();
38061
38103
  init_useThemePreference();
38062
38104
  init_useWalletSessionState();
38063
38105
  init_useWalletTokenState();