@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/dist/widget.mjs CHANGED
@@ -244,8 +244,8 @@ var init_theme = __esm({
244
244
  --tw-accent-foreground: 0 0% 100%;
245
245
  --tw-destructive: 0 84% 60%;
246
246
  --tw-destructive-foreground: 0 0% 100%;
247
- --tw-border: 220 13% 91%;
248
- --tw-input: 220 13% 91%;
247
+ --tw-border: 220 13% 94%;
248
+ --tw-input: 220 13% 94%;
249
249
  --tw-ring: 217 91% 60%;
250
250
  --tw-radius: 1rem;
251
251
 
@@ -563,7 +563,7 @@ var init_constants = __esm({
563
563
  "src/constants.ts"() {
564
564
  "use strict";
565
565
  SDK_NAME = "@trustware/sdk";
566
- SDK_VERSION = "1.1.8-staging.8";
566
+ SDK_VERSION = "1.1.9-staging.3";
567
567
  API_ROOT = "https://bv-staging-api.trustware.io";
568
568
  GTM_ID = "GTM-TZDGNCXB";
569
569
  API_PREFIX = "/api";
@@ -583,16 +583,6 @@ var init_config2 = __esm({
583
583
  });
584
584
 
585
585
  // src/core/http.ts
586
- var http_exports = {};
587
- __export(http_exports, {
588
- RateLimitError: () => RateLimitError,
589
- apiBase: () => apiBase,
590
- assertOK: () => assertOK,
591
- jsonHeaders: () => jsonHeaders,
592
- parseRateLimitHeaders: () => parseRateLimitHeaders,
593
- rateLimitedFetch: () => rateLimitedFetch,
594
- validateSdkAccess: () => validateSdkAccess
595
- });
596
586
  function apiBase() {
597
587
  return `${API_ROOT}${API_PREFIX}`;
598
588
  }
@@ -790,11 +780,6 @@ var init_chains = __esm({
790
780
  });
791
781
 
792
782
  // src/registry.ts
793
- var registry_exports = {};
794
- __export(registry_exports, {
795
- NATIVE: () => NATIVE,
796
- Registry: () => Registry
797
- });
798
783
  function getChainAliases(chain) {
799
784
  const values = [
800
785
  chain.chainId,
@@ -2328,7 +2313,7 @@ async function parseStreamingBalances(response, address, options = {}) {
2328
2313
  }
2329
2314
  return stream();
2330
2315
  }
2331
- async function getBalances(chainRef, address) {
2316
+ async function getBalances(chainRef, address, opts) {
2332
2317
  const reg = await ensureRegistry();
2333
2318
  const chain = reg.chain(chainRef);
2334
2319
  if (!chain) return [];
@@ -2343,8 +2328,10 @@ async function getBalances(chainRef, address) {
2343
2328
  chain.nativeCurrency?.decimals ?? "",
2344
2329
  normalizeChainType(chain) ?? ""
2345
2330
  ].join(":");
2346
- const cached = balanceCache.get(cacheKey);
2347
- if (cached) return cached;
2331
+ if (!opts?.forceRefresh) {
2332
+ const cached = balanceCache.get(cacheKey);
2333
+ if (cached) return cached;
2334
+ }
2348
2335
  const url = `${apiBase()}/v1/data/wallets/${encodeURIComponent(chainKey)}/${trimmedAddress}/balances`;
2349
2336
  const response = await fetch(url, {
2350
2337
  method: "GET",
@@ -2851,7 +2838,6 @@ function useTrustwareConfig() {
2851
2838
  toToken: "",
2852
2839
  toAddress: void 0,
2853
2840
  defaultSlippage: 1,
2854
- routeType: "swap",
2855
2841
  options: {}
2856
2842
  },
2857
2843
  autoDetectProvider: false,
@@ -2961,6 +2947,10 @@ var init_useAmountConstraints = __esm({
2961
2947
  });
2962
2948
 
2963
2949
  // src/core/registryClient.ts
2950
+ var registryClient_exports = {};
2951
+ __export(registryClient_exports, {
2952
+ getSharedRegistry: () => getSharedRegistry
2953
+ });
2964
2954
  function registryCacheKey() {
2965
2955
  const base2 = apiBase();
2966
2956
  const apiKey = TrustwareConfigStore.peek()?.apiKey ?? "__uninitialized__";
@@ -6089,11 +6079,27 @@ function toSolanaWalletInterface(provider) {
6089
6079
  serializedTransactionBase64
6090
6080
  );
6091
6081
  if (provider.signAndSendTransaction) {
6092
- const result = await provider.signAndSendTransaction(transaction, {
6093
- preflightCommitment: "confirmed"
6094
- });
6095
- if (typeof result === "string") return result;
6096
- if (result?.signature) return result.signature;
6082
+ const MAX_INTERNAL_ERROR_ATTEMPTS = 3;
6083
+ const INTERNAL_ERROR_RETRY_DELAY_MS = 500;
6084
+ for (let attempt = 1; attempt <= MAX_INTERNAL_ERROR_ATTEMPTS; attempt++) {
6085
+ try {
6086
+ const result = await provider.signAndSendTransaction(transaction, {
6087
+ skipPreflight: true
6088
+ });
6089
+ if (typeof result === "string") return result;
6090
+ if (result?.signature) return result.signature;
6091
+ break;
6092
+ } catch (err) {
6093
+ const code = err?.code;
6094
+ if (code === -32603 && attempt < MAX_INTERNAL_ERROR_ATTEMPTS) {
6095
+ await new Promise(
6096
+ (resolve) => setTimeout(resolve, INTERNAL_ERROR_RETRY_DELAY_MS * attempt)
6097
+ );
6098
+ continue;
6099
+ }
6100
+ throw err;
6101
+ }
6102
+ }
6097
6103
  }
6098
6104
  if (!provider.signTransaction) {
6099
6105
  throw new Error("Connected Solana wallet cannot sign transactions");
@@ -6206,12 +6212,25 @@ var init_connect = __esm({
6206
6212
  function formatDeepLink(id, currentUrl) {
6207
6213
  const enc = encodeURIComponent(currentUrl);
6208
6214
  switch (id) {
6215
+ // EVM
6209
6216
  case "metamask":
6210
6217
  return `metamask://dapp/${currentUrl}`;
6211
6218
  case "coinbase":
6212
6219
  return `coinbase://wallet/dapp?url=${enc}`;
6213
6220
  case "rainbow":
6214
6221
  return `rainbow://connect?uri=${enc}`;
6222
+ case "trust":
6223
+ return `https://link.trustwallet.com/open_url?coin_id=60&url=${enc}`;
6224
+ case "okx":
6225
+ return `okx://wallet/dapp/url?dappUrl=${enc}`;
6226
+ // Solana
6227
+ case "phantom-solana":
6228
+ return `phantom://browse/${enc}`;
6229
+ case "solflare":
6230
+ return `solflare://ul/v1/browse/${enc}`;
6231
+ case "backpack":
6232
+ return `https://backpack.app/ul/v1/browse/${enc}?ref=${enc}`;
6233
+ // No confirmed deep link scheme
6215
6234
  default:
6216
6235
  return void 0;
6217
6236
  }
@@ -6239,6 +6258,8 @@ var init_metadata = __esm({
6239
6258
  emoji: "\u{1F98A}",
6240
6259
  homepage: "https://metamask.io/",
6241
6260
  chromeWebStore: "https://chromewebstore.google.com/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",
6261
+ ios: "https://apps.apple.com/app/metamask/id1438144202",
6262
+ android: "https://play.google.com/store/apps/details?id=io.metamask",
6242
6263
  detectFlags: ["isMetaMask"],
6243
6264
  deepLink: (url) => formatDeepLink("metamask", url) ?? ""
6244
6265
  },
@@ -6250,6 +6271,8 @@ var init_metadata = __esm({
6250
6271
  logo: `${ASSETS_BASE_URL}/assets/wallets/coinbase.svg`,
6251
6272
  emoji: "\u{1F7E6}",
6252
6273
  homepage: "https://www.coinbase.com/wallet",
6274
+ ios: "https://apps.apple.com/app/coinbase-wallet/id1278383455",
6275
+ android: "https://play.google.com/store/apps/details?id=org.toshi",
6253
6276
  detectFlags: ["isCoinbaseWallet"],
6254
6277
  deepLink: (url) => formatDeepLink("coinbase", url) ?? ""
6255
6278
  },
@@ -6261,6 +6284,7 @@ var init_metadata = __esm({
6261
6284
  logo: `${ASSETS_BASE_URL}/assets/wallets/walletconnect.svg`,
6262
6285
  emoji: "\u{1FA9D}",
6263
6286
  homepage: "https://walletconnect.com/"
6287
+ // No deep link — opens its own modal
6264
6288
  },
6265
6289
  {
6266
6290
  id: "rainbow",
@@ -6270,8 +6294,38 @@ var init_metadata = __esm({
6270
6294
  logo: `${ASSETS_BASE_URL}/assets/wallets/rainbow.svg`,
6271
6295
  emoji: "\u{1F308}",
6272
6296
  homepage: "https://rainbow.me/",
6273
- deepLink: (url) => formatDeepLink("rainbow", url) ?? "",
6274
- detectFlags: ["isRainbow"]
6297
+ ios: "https://apps.apple.com/app/rainbow-ethereum-wallet/id1457119021",
6298
+ android: "https://play.google.com/store/apps/details?id=me.rainbow",
6299
+ detectFlags: ["isRainbow"],
6300
+ deepLink: (url) => formatDeepLink("rainbow", url) ?? ""
6301
+ },
6302
+ {
6303
+ id: "trust",
6304
+ name: "Trust Wallet",
6305
+ category: "app",
6306
+ ecosystem: "multi",
6307
+ logo: `${ASSETS_BASE_URL}/assets/wallets/trust.svg`,
6308
+ emoji: "\u{1F6E1}\uFE0F",
6309
+ homepage: "https://trustwallet.com/",
6310
+ ios: "https://apps.apple.com/app/trust-crypto-bitcoin-wallet/id1288339409",
6311
+ android: "https://play.google.com/store/apps/details?id=com.wallet.crypto.trustapp",
6312
+ detectFlags: ["isTrustWallet"],
6313
+ deepLink: (url) => formatDeepLink("trust", url) ?? ""
6314
+ // ✅ Added
6315
+ },
6316
+ {
6317
+ id: "okx",
6318
+ name: "OKX",
6319
+ category: "injected",
6320
+ ecosystem: "evm",
6321
+ logo: `${ASSETS_BASE_URL}/assets/wallets/okx.svg`,
6322
+ emoji: "\u2B1B",
6323
+ homepage: "https://www.okx.com/web3",
6324
+ ios: "https://apps.apple.com/app/okx-buy-bitcoin-eth-crypto/id1327268470",
6325
+ android: "https://play.google.com/store/apps/details?id=com.okinc.okex.gp",
6326
+ detectFlags: ["isOkxWallet"],
6327
+ deepLink: (url) => formatDeepLink("okx", url) ?? ""
6328
+ // ✅ Added
6275
6329
  },
6276
6330
  {
6277
6331
  id: "phantom-evm",
@@ -6281,7 +6335,10 @@ var init_metadata = __esm({
6281
6335
  logo: `${ASSETS_BASE_URL}/assets/wallets/phantom.svg`,
6282
6336
  emoji: "\u{1F47B}",
6283
6337
  homepage: "https://phantom.app/",
6338
+ ios: "https://apps.apple.com/app/phantom-crypto-wallet/id1598432977",
6339
+ android: "https://play.google.com/store/apps/details?id=app.phantom",
6284
6340
  detectFlags: ["isPhantom"]
6341
+ // No EVM dapp browser deep link — falls back to app store
6285
6342
  },
6286
6343
  {
6287
6344
  id: "phantom-solana",
@@ -6291,18 +6348,9 @@ var init_metadata = __esm({
6291
6348
  logo: `${ASSETS_BASE_URL}/assets/wallets/phantom.svg`,
6292
6349
  emoji: "\u{1F47B}",
6293
6350
  homepage: "https://phantom.app/",
6294
- android: "https://play.google.com/store/apps/details?id=app.phantom",
6295
6351
  ios: "https://apps.apple.com/app/phantom-crypto-wallet/id1598432977",
6296
- deepLink: (url) => `phantom://browse/${encodeURIComponent(url)}`
6297
- },
6298
- {
6299
- id: "metamask-solana",
6300
- name: "MetaMask (Solana)",
6301
- category: "injected",
6302
- ecosystem: "solana",
6303
- logo: `${ASSETS_BASE_URL}/assets/wallets/metamask.svg`,
6304
- emoji: "\u{1F98A}",
6305
- homepage: "https://metamask.io/"
6352
+ android: "https://play.google.com/store/apps/details?id=app.phantom",
6353
+ deepLink: (url) => formatDeepLink("phantom-solana", url) ?? ""
6306
6354
  },
6307
6355
  {
6308
6356
  id: "solflare",
@@ -6312,7 +6360,9 @@ var init_metadata = __esm({
6312
6360
  logo: `${ASSETS_BASE_URL}/assets/wallets/solflare-logo.svg`,
6313
6361
  emoji: "\u2600\uFE0F",
6314
6362
  homepage: "https://solflare.com/",
6315
- deepLink: (url) => `solflare://ul/v1/browse/${encodeURIComponent(url)}`
6363
+ ios: "https://apps.apple.com/app/solflare-solana-wallet/id1580902717",
6364
+ android: "https://play.google.com/store/apps/details?id=com.solflare.mobile",
6365
+ deepLink: (url) => formatDeepLink("solflare", url) ?? ""
6316
6366
  },
6317
6367
  {
6318
6368
  id: "backpack",
@@ -6321,8 +6371,25 @@ var init_metadata = __esm({
6321
6371
  ecosystem: "solana",
6322
6372
  logo: `${ASSETS_BASE_URL}/assets/wallets/backpack-logo.svg`,
6323
6373
  emoji: "\u{1F392}",
6324
- homepage: "https://backpack.app/"
6374
+ homepage: "https://backpack.app/",
6375
+ ios: "https://apps.apple.com/app/backpack-crypto-wallet/id6445964121",
6376
+ android: "https://play.google.com/store/apps/details?id=app.backpack.mobile",
6377
+ deepLink: (url) => formatDeepLink("backpack", url) ?? ""
6378
+ // ✅ Added
6379
+ },
6380
+ {
6381
+ id: "metamask-solana",
6382
+ name: "MetaMask (Solana)",
6383
+ category: "injected",
6384
+ ecosystem: "solana",
6385
+ logo: `${ASSETS_BASE_URL}/assets/wallets/metamask.svg`,
6386
+ emoji: "\u{1F98A}",
6387
+ homepage: "https://metamask.io/",
6388
+ ios: "https://apps.apple.com/app/metamask/id1438144202",
6389
+ android: "https://play.google.com/store/apps/details?id=io.metamask"
6390
+ // No Solana-specific deep link for MetaMask
6325
6391
  },
6392
+ // ── Extension/desktop only — hidden on mobile ─────────────────────────────
6326
6393
  {
6327
6394
  id: "rabby",
6328
6395
  name: "Rabby",
@@ -6333,6 +6400,7 @@ var init_metadata = __esm({
6333
6400
  homepage: "https://rabby.io/",
6334
6401
  chromeWebStore: "https://chromewebstore.google.com/detail/rabby/acmacodkjbdgmoleebolmdjonilkdbch",
6335
6402
  detectFlags: ["isRabby"]
6403
+ // Extension only — no mobile app or deep link
6336
6404
  },
6337
6405
  {
6338
6406
  id: "brave",
@@ -6343,25 +6411,7 @@ var init_metadata = __esm({
6343
6411
  emoji: "\u{1F981}",
6344
6412
  homepage: "https://brave.com/wallet/",
6345
6413
  detectFlags: ["isBraveWallet"]
6346
- },
6347
- {
6348
- id: "okx",
6349
- name: "OKX",
6350
- category: "injected",
6351
- ecosystem: "evm",
6352
- logo: `${ASSETS_BASE_URL}/assets/wallets/okx.svg`,
6353
- emoji: "\u2B1B",
6354
- homepage: "https://www.okx.com/web3",
6355
- detectFlags: ["isOkxWallet"]
6356
- },
6357
- {
6358
- id: "zerion",
6359
- name: "Zerion",
6360
- category: "app",
6361
- ecosystem: "evm",
6362
- logo: `${ASSETS_BASE_URL}/assets/wallets/zerion.png`,
6363
- emoji: "\u{1F9FF}",
6364
- homepage: "https://zerion.io/wallet/"
6414
+ // Built into Brave browser — no standalone deep link
6365
6415
  },
6366
6416
  {
6367
6417
  id: "taho",
@@ -6372,16 +6422,7 @@ var init_metadata = __esm({
6372
6422
  emoji: "\u{1F7EA}",
6373
6423
  homepage: "https://taho.xyz/",
6374
6424
  detectFlags: ["isTally", "isTallyWallet", "isTahoWallet"]
6375
- },
6376
- {
6377
- id: "trust",
6378
- name: "Trust Wallet",
6379
- category: "app",
6380
- ecosystem: "multi",
6381
- logo: `${ASSETS_BASE_URL}/assets/wallets/trust.svg`,
6382
- emoji: "\u{1F6E1}\uFE0F",
6383
- homepage: "https://trustwallet.com/",
6384
- detectFlags: ["isTrustWallet"]
6425
+ // Extension only — no mobile app
6385
6426
  },
6386
6427
  {
6387
6428
  id: "bitget",
@@ -6391,7 +6432,22 @@ var init_metadata = __esm({
6391
6432
  logo: `${ASSETS_BASE_URL}/assets/wallets/bitget.svg`,
6392
6433
  emoji: "\u{1F7E9}",
6393
6434
  homepage: "https://web3.bitget.com/",
6435
+ ios: "https://apps.apple.com/app/bitget-wallet-ex-bitkeep/id1395301115",
6436
+ android: "https://play.google.com/store/apps/details?id=com.bitkeep.wallet",
6394
6437
  detectFlags: ["isBitGetWallet"]
6438
+ // No public deep link scheme documented
6439
+ },
6440
+ {
6441
+ id: "zerion",
6442
+ name: "Zerion",
6443
+ category: "app",
6444
+ ecosystem: "evm",
6445
+ logo: `${ASSETS_BASE_URL}/assets/wallets/zerion.png`,
6446
+ emoji: "\u{1F9FF}",
6447
+ homepage: "https://zerion.io/wallet/",
6448
+ ios: "https://apps.apple.com/app/zerion-crypto-defi-wallet/id1456732565",
6449
+ android: "https://play.google.com/store/apps/details?id=io.zerion.android"
6450
+ // Uses WalletConnect URI — not a simple page URL deep link
6395
6451
  },
6396
6452
  {
6397
6453
  id: "safe",
@@ -6400,7 +6456,10 @@ var init_metadata = __esm({
6400
6456
  ecosystem: "evm",
6401
6457
  logo: `${ASSETS_BASE_URL}/assets/wallets/safe.svg`,
6402
6458
  emoji: "\u{1F7E9}",
6403
- homepage: "https://safe.global/"
6459
+ homepage: "https://safe.global/",
6460
+ ios: "https://apps.apple.com/app/safe-gnosis-safe/id1515759131",
6461
+ android: "https://play.google.com/store/apps/details?id=io.gnosis.safe"
6462
+ // Uses WalletConnect — no dapp browser deep link
6404
6463
  },
6405
6464
  {
6406
6465
  id: "kucoin",
@@ -6409,7 +6468,10 @@ var init_metadata = __esm({
6409
6468
  ecosystem: "evm",
6410
6469
  logo: `${ASSETS_BASE_URL}/assets/wallets/kucoin.svg`,
6411
6470
  emoji: "\u{1F7E6}",
6412
- homepage: "https://www.kucoin.com/"
6471
+ homepage: "https://www.kucoin.com/",
6472
+ ios: "https://apps.apple.com/app/kucoin-buy-bitcoin-crypto/id1378956601",
6473
+ android: "https://play.google.com/store/apps/details?id=com.kubi.kucoin"
6474
+ // No public deep link scheme documented
6413
6475
  }
6414
6476
  ];
6415
6477
  }
@@ -6588,6 +6650,14 @@ function useWalletDetection(timeoutMs = 400) {
6588
6650
  );
6589
6651
  return { detected, detectedIds };
6590
6652
  }
6653
+ function useIsMobile() {
6654
+ const [isMobile, set] = useState7(false);
6655
+ useEffect7(() => {
6656
+ const ua = navigator.userAgent || "";
6657
+ set(/Android|iPhone|iPad|iPod/i.test(ua));
6658
+ }, []);
6659
+ return isMobile;
6660
+ }
6591
6661
  var WALLET_BY_ID, DETECT_PRIORITY, GENERIC_FLAGS, RDNS_WALLET_MAP, NAME_WALLET_MAP;
6592
6662
  var init_detect = __esm({
6593
6663
  "src/wallets/detect.ts"() {
@@ -8140,6 +8210,7 @@ var init_wallets = __esm({
8140
8210
  init_adapters();
8141
8211
  init_solana();
8142
8212
  init_detect();
8213
+ init_metadata();
8143
8214
  }
8144
8215
  });
8145
8216
 
@@ -8567,7 +8638,6 @@ function resolveConfig(input) {
8567
8638
  defaultSlippage: normalizeSlippage(
8568
8639
  input.routes.defaultSlippage ?? DEFAULT_SLIPPAGE
8569
8640
  ),
8570
- routeType: input.routes.routeType ?? "swap",
8571
8641
  options: {
8572
8642
  ...input.routes.options
8573
8643
  }
@@ -8768,10 +8838,9 @@ async function sendRouteTransaction(b, fallbackChainId) {
8768
8838
  if (w.ecosystem !== "solana") {
8769
8839
  throw new Error("A Solana wallet is required for this route");
8770
8840
  }
8771
- const { Registry: Registry2 } = await Promise.resolve().then(() => (init_registry(), registry_exports));
8772
- const { apiBase: apiBase2 } = await Promise.resolve().then(() => (init_http(), http_exports));
8773
- const registry = new Registry2(apiBase2());
8774
- await registry.ensureLoaded();
8841
+ const { getSharedRegistry: getSharedRegistry2 } = await Promise.resolve().then(() => (init_registryClient(), registryClient_exports));
8842
+ const registry = getSharedRegistry2();
8843
+ await registry.ensureChainsLoaded();
8775
8844
  const chain = registry.chain(
8776
8845
  String(fallbackChainId ?? txReq.chainId ?? "")
8777
8846
  );
@@ -8785,9 +8854,8 @@ async function sendRouteTransaction(b, fallbackChainId) {
8785
8854
  async function runTopUp(params) {
8786
8855
  const w = walletManager.wallet;
8787
8856
  if (!w) throw new Error("Trustware.wallet not configured");
8788
- const { Registry: Registry2 } = await Promise.resolve().then(() => (init_registry(), registry_exports));
8789
- const { apiBase: apiBase2 } = await Promise.resolve().then(() => (init_http(), http_exports));
8790
- const reg = new Registry2(apiBase2());
8857
+ const { getSharedRegistry: getSharedRegistry2 } = await Promise.resolve().then(() => (init_registryClient(), registryClient_exports));
8858
+ const reg = getSharedRegistry2();
8791
8859
  await reg.ensureLoaded();
8792
8860
  const fromAddress = await w.getAddress();
8793
8861
  const currentChainRef = w.ecosystem === "evm" ? String(await w.getChainId()) : await w.getChainKey?.() ?? "solana-mainnet-beta";
@@ -8896,6 +8964,39 @@ var init_core = __esm({
8896
8964
  getConfig() {
8897
8965
  return TrustwareConfigStore.get();
8898
8966
  },
8967
+ /**
8968
+ * Read the SDK's currently configured theme mode.
8969
+ *
8970
+ * Returns the raw setting — `"light" | "dark" | "system"` — i.e. whatever
8971
+ * was last passed to `init()` or `setTheme()`. When the mode is `"system"`,
8972
+ * the widget resolves the actual light/dark appearance itself (from the OS
8973
+ * `prefers-color-scheme`, or a saved preference if the user has used the
8974
+ * widget's built-in theme toggle), so this getter still reports `"system"`
8975
+ * rather than the resolved value.
8976
+ */
8977
+ getTheme() {
8978
+ return TrustwareConfigStore.get().theme;
8979
+ },
8980
+ /**
8981
+ * Set the widget's theme at runtime.
8982
+ *
8983
+ * Call this from your own app's theme toggle to keep an embedded
8984
+ * `TrustwareWidget` in sync with your UI — no remount required, any
8985
+ * mounted widget picks up the change immediately.
8986
+ *
8987
+ * Passing `"light"` or `"dark"` pins the widget to that mode. Passing
8988
+ * `"system"` makes it follow the OS preference again — unless the user
8989
+ * previously used the widget's own in-widget theme toggle, in which case
8990
+ * their saved choice takes precedence until they toggle it again.
8991
+ *
8992
+ * @example
8993
+ * // In your app's own dark-mode toggle handler:
8994
+ * Trustware.setTheme(isDark ? "dark" : "light");
8995
+ */
8996
+ setTheme(theme) {
8997
+ TrustwareConfigStore.update({ theme });
8998
+ return Trustware;
8999
+ },
8899
9000
  setDestinationAddress(address) {
8900
9001
  const prev = TrustwareConfigStore.get();
8901
9002
  TrustwareConfigStore.update({
@@ -13602,7 +13703,7 @@ function ChainSelectorPanel({
13602
13703
  paddingTop: spacing[2],
13603
13704
  paddingBottom: spacing[2],
13604
13705
  fontSize: fontSize.sm,
13605
- backgroundColor: colors.muted,
13706
+ backgroundColor: colors.background,
13606
13707
  border: `1px solid ${colors.border}`,
13607
13708
  borderRadius: borderRadius.lg,
13608
13709
  color: colors.foreground,
@@ -13814,7 +13915,7 @@ function TokenSearchInput({
13814
13915
  paddingTop: spacing[2],
13815
13916
  paddingBottom: spacing[2],
13816
13917
  fontSize: fontSize.sm,
13817
- backgroundColor: colors.muted,
13918
+ backgroundColor: colors.background,
13818
13919
  border: `1px solid ${colors.border}`,
13819
13920
  borderRadius: borderRadius.lg,
13820
13921
  color: colors.foreground,
@@ -15942,8 +16043,9 @@ var init_WalletNamespaceTabs = __esm({
15942
16043
  });
15943
16044
 
15944
16045
  // src/widget/features/wallet/components/CryptoWalletDropdownContent.tsx
15945
- import { jsx as jsx36, jsxs as jsxs30 } from "react/jsx-runtime";
15946
- function CryptoWalletDropdownContent({
16046
+ import { useEffect as useEffect23, useMemo as useMemo17, useRef as useRef10, useState as useState23 } from "react";
16047
+ import { Fragment as Fragment7, jsx as jsx36, jsxs as jsxs30 } from "react/jsx-runtime";
16048
+ function DesktopWalletDropdownContent({
15947
16049
  browserWallets,
15948
16050
  handleWalletConnect,
15949
16051
  handleWalletSelect
@@ -16007,6 +16109,262 @@ function CryptoWalletDropdownContent({
16007
16109
  }
16008
16110
  );
16009
16111
  }
16112
+ function MobileWalletDropdownContent({
16113
+ handleWalletConnect
16114
+ }) {
16115
+ const { setCurrentStep } = useDepositNavigation();
16116
+ const { selectedNamespace } = useDepositWallet();
16117
+ const { walletMetaId, isConnected, status } = useWalletInfo();
16118
+ const [hoveredId, setHoveredId] = useState23(null);
16119
+ const storeFallbackTimeoutRef = useRef10(
16120
+ null
16121
+ );
16122
+ useEffect23(() => {
16123
+ return () => {
16124
+ if (storeFallbackTimeoutRef.current !== null) {
16125
+ clearTimeout(storeFallbackTimeoutRef.current);
16126
+ }
16127
+ };
16128
+ }, []);
16129
+ const connectedWalletId = isConnected ? walletMetaId : null;
16130
+ const currentUrl = window.location.href;
16131
+ const mobileWallets = useMemo17(
16132
+ () => WALLETS.filter((w) => {
16133
+ if (w.id === "walletconnect") return true;
16134
+ const hasMobileLink = Boolean(w.deepLink || w.ios || w.android);
16135
+ if (!hasMobileLink) return false;
16136
+ return w.ecosystem.trim().toLowerCase() === "multi" || w.ecosystem.trim().toLowerCase() === selectedNamespace.trim().toLowerCase();
16137
+ }),
16138
+ [selectedNamespace]
16139
+ );
16140
+ const handleWalletSelect = (wallet) => {
16141
+ if (wallet.id === "walletconnect") {
16142
+ handleWalletConnect();
16143
+ return;
16144
+ }
16145
+ if (wallet.deepLink) {
16146
+ const deepLinkUrl = wallet.deepLink(currentUrl);
16147
+ if (deepLinkUrl) {
16148
+ window.location.assign(deepLinkUrl);
16149
+ if (storeFallbackTimeoutRef.current !== null) {
16150
+ clearTimeout(storeFallbackTimeoutRef.current);
16151
+ }
16152
+ storeFallbackTimeoutRef.current = setTimeout(() => {
16153
+ storeFallbackTimeoutRef.current = null;
16154
+ const isIos2 = /iPhone|iPad/i.test(navigator.userAgent);
16155
+ const storeUrl2 = isIos2 ? wallet.ios : wallet.android;
16156
+ if (storeUrl2) window.location.assign(storeUrl2);
16157
+ }, 1500);
16158
+ return;
16159
+ }
16160
+ }
16161
+ const isIos = /iPhone|iPad/i.test(navigator.userAgent);
16162
+ const storeUrl = isIos ? wallet.ios : wallet.android;
16163
+ if (storeUrl) window.location.assign(storeUrl);
16164
+ };
16165
+ const handleContinue = () => {
16166
+ if (isConnected && status === "connected") {
16167
+ setCurrentStep("crypto-pay");
16168
+ } else {
16169
+ alert("Please connect your wallet first.");
16170
+ }
16171
+ };
16172
+ const showContinueButton = useMemo17(
16173
+ () => isConnected && status === "connected",
16174
+ [isConnected, status]
16175
+ );
16176
+ return /* @__PURE__ */ jsxs30(
16177
+ "div",
16178
+ {
16179
+ style: {
16180
+ ...dropdownSurfaceStyle,
16181
+ maxHeight: "16rem",
16182
+ backgroundColor: colors.card,
16183
+ borderRadius: borderRadius.xl,
16184
+ boxShadow: shadows.large,
16185
+ border: `1px solid rgba(63, 63, 70, 0.5)`,
16186
+ zIndex: 100,
16187
+ overflow: "hidden",
16188
+ // changed from auto
16189
+ animation: "tw-fade-in 0.2s ease-out",
16190
+ display: "flex",
16191
+ flexDirection: "column"
16192
+ },
16193
+ children: [
16194
+ /* @__PURE__ */ jsx36(
16195
+ "div",
16196
+ {
16197
+ style: {
16198
+ width: "100%",
16199
+ padding: spacing[2]
16200
+ },
16201
+ children: /* @__PURE__ */ jsx36("div", { style: { display: "flex", gap: spacing[2] }, children: /* @__PURE__ */ jsx36(WalletNamespaceTabs, { showBitcoin: false }) })
16202
+ }
16203
+ ),
16204
+ /* @__PURE__ */ jsx36(
16205
+ "div",
16206
+ {
16207
+ style: {
16208
+ padding: spacing[3],
16209
+ overflowY: "auto",
16210
+ flex: 1,
16211
+ scrollbarWidth: "thin",
16212
+ scrollbarColor: `${colors.muted} transparent`
16213
+ },
16214
+ children: mobileWallets.map((wallet) => {
16215
+ const isConnectedWallet = wallet.id === connectedWalletId;
16216
+ const isDisabled = isConnected && !isConnectedWallet;
16217
+ const isHovered = hoveredId === wallet.id;
16218
+ return /* @__PURE__ */ jsxs30(
16219
+ "button",
16220
+ {
16221
+ type: "button",
16222
+ onClick: () => !isDisabled && handleWalletSelect(wallet),
16223
+ onMouseEnter: () => !isDisabled && setHoveredId(wallet.id),
16224
+ onMouseLeave: () => setHoveredId(null),
16225
+ style: {
16226
+ width: "100%",
16227
+ display: "flex",
16228
+ alignItems: "center",
16229
+ justifyContent: "space-between",
16230
+ padding: spacing[2],
16231
+ borderRadius: borderRadius.lg,
16232
+ transition: "background-color 0.2s",
16233
+ border: "none",
16234
+ backgroundColor: isHovered ? "rgba(255,255,255,0.06)" : "transparent",
16235
+ cursor: isDisabled ? "not-allowed" : "pointer",
16236
+ opacity: isDisabled ? 0.4 : 1,
16237
+ fontFamily: "inherit",
16238
+ fontSize: fontSize.sm,
16239
+ outline: "none"
16240
+ },
16241
+ children: [
16242
+ /* @__PURE__ */ jsxs30(
16243
+ "div",
16244
+ {
16245
+ style: {
16246
+ display: "flex",
16247
+ alignItems: "center",
16248
+ gap: spacing[2]
16249
+ },
16250
+ children: [
16251
+ /* @__PURE__ */ jsx36(
16252
+ "img",
16253
+ {
16254
+ src: wallet.logo ?? wallet.emoji,
16255
+ alt: wallet.name,
16256
+ style: {
16257
+ width: "2rem",
16258
+ height: "2rem",
16259
+ borderRadius: borderRadius.lg,
16260
+ objectFit: "cover"
16261
+ }
16262
+ }
16263
+ ),
16264
+ /* @__PURE__ */ jsx36(
16265
+ "span",
16266
+ {
16267
+ style: {
16268
+ fontWeight: fontWeight.medium,
16269
+ fontSize: fontSize.sm,
16270
+ color: colors.foreground
16271
+ },
16272
+ children: wallet.name
16273
+ }
16274
+ )
16275
+ ]
16276
+ }
16277
+ ),
16278
+ isConnectedWallet && /* @__PURE__ */ jsxs30(
16279
+ "div",
16280
+ {
16281
+ style: {
16282
+ display: "flex",
16283
+ alignItems: "center",
16284
+ gap: spacing[1]
16285
+ },
16286
+ children: [
16287
+ /* @__PURE__ */ jsx36(
16288
+ "div",
16289
+ {
16290
+ style: {
16291
+ width: "0.5rem",
16292
+ height: "0.5rem",
16293
+ borderRadius: "50%",
16294
+ backgroundColor: "#22c55e"
16295
+ }
16296
+ }
16297
+ ),
16298
+ /* @__PURE__ */ jsx36("span", { style: { fontSize: fontSize.xs, color: "#22c55e" }, children: "Connected" })
16299
+ ]
16300
+ }
16301
+ )
16302
+ ]
16303
+ },
16304
+ wallet.id
16305
+ );
16306
+ })
16307
+ }
16308
+ ),
16309
+ showContinueButton && /* @__PURE__ */ jsx36(
16310
+ "div",
16311
+ {
16312
+ style: {
16313
+ padding: spacing[3],
16314
+ borderTop: `1px solid rgba(63, 63, 70, 0.5)`,
16315
+ backgroundColor: colors.card
16316
+ },
16317
+ children: /* @__PURE__ */ jsx36(
16318
+ "button",
16319
+ {
16320
+ onClick: handleContinue,
16321
+ style: {
16322
+ width: "100%",
16323
+ padding: `${spacing[2]} ${spacing[3]}`,
16324
+ borderRadius: borderRadius.lg,
16325
+ border: "none",
16326
+ backgroundColor: colors.primary,
16327
+ color: "#fff",
16328
+ fontFamily: "inherit",
16329
+ fontSize: fontSize.sm,
16330
+ fontWeight: fontWeight.medium,
16331
+ cursor: "pointer",
16332
+ transition: "opacity 0.2s"
16333
+ },
16334
+ onMouseEnter: (e2) => e2.currentTarget.style.opacity = "0.85",
16335
+ onMouseLeave: (e2) => e2.currentTarget.style.opacity = "1",
16336
+ children: "Continue \u2192"
16337
+ }
16338
+ )
16339
+ }
16340
+ )
16341
+ ]
16342
+ }
16343
+ );
16344
+ }
16345
+ function CryptoWalletDropdownContent({
16346
+ browserWallets,
16347
+ handleWalletConnect,
16348
+ handleWalletSelect
16349
+ }) {
16350
+ const isMobile = useIsMobile();
16351
+ return /* @__PURE__ */ jsxs30(Fragment7, { children: [
16352
+ !isMobile && /* @__PURE__ */ jsx36(
16353
+ DesktopWalletDropdownContent,
16354
+ {
16355
+ browserWallets,
16356
+ handleWalletConnect,
16357
+ handleWalletSelect
16358
+ }
16359
+ ),
16360
+ isMobile && /* @__PURE__ */ jsx36(
16361
+ MobileWalletDropdownContent,
16362
+ {
16363
+ handleWalletConnect
16364
+ }
16365
+ )
16366
+ ] });
16367
+ }
16010
16368
  var init_CryptoWalletDropdownContent = __esm({
16011
16369
  "src/widget/features/wallet/components/CryptoWalletDropdownContent.tsx"() {
16012
16370
  "use strict";
@@ -16017,6 +16375,7 @@ var init_CryptoWalletDropdownContent = __esm({
16017
16375
  init_paymentOptionStyles();
16018
16376
  init_WalletNamespaceTabs();
16019
16377
  init_DepositContext();
16378
+ init_wallets();
16020
16379
  }
16021
16380
  });
16022
16381
 
@@ -16471,7 +16830,7 @@ var init_HomePaymentOptions = __esm({
16471
16830
  });
16472
16831
 
16473
16832
  // src/widget/features/wallet/hooks/useHomeWalletActions.ts
16474
- import { useCallback as useCallback18, useEffect as useEffect23, useMemo as useMemo17, useRef as useRef10, useState as useState23 } from "react";
16833
+ import { useCallback as useCallback18, useEffect as useEffect24, useMemo as useMemo18, useRef as useRef11, useState as useState24 } from "react";
16475
16834
  function useHomeWalletActions({
16476
16835
  connectWallet,
16477
16836
  detectedWallets,
@@ -16480,12 +16839,12 @@ function useHomeWalletActions({
16480
16839
  WalletConnect
16481
16840
  // setCurrentStepInternal,
16482
16841
  }) {
16483
- const [isCryptoDropdownOpen, setIsCryptoDropdownOpen] = useState23(false);
16484
- const [isFiatDropdownOpen, setIsFiatDropdownOpen] = useState23(false);
16485
- const cryptoDropdownRef = useRef10(null);
16486
- const fiatDropdownRef = useRef10(null);
16842
+ const [isCryptoDropdownOpen, setIsCryptoDropdownOpen] = useState24(false);
16843
+ const [isFiatDropdownOpen, setIsFiatDropdownOpen] = useState24(false);
16844
+ const cryptoDropdownRef = useRef11(null);
16845
+ const fiatDropdownRef = useRef11(null);
16487
16846
  const { disconnect } = useWalletInfo();
16488
- useEffect23(() => {
16847
+ useEffect24(() => {
16489
16848
  const handleClickOutside = (event) => {
16490
16849
  if (cryptoDropdownRef.current && !cryptoDropdownRef.current.contains(event.target)) {
16491
16850
  setIsCryptoDropdownOpen(false);
@@ -16511,6 +16870,7 @@ function useHomeWalletActions({
16511
16870
  setWalletType("other");
16512
16871
  const { error } = await connectWallet(wallet);
16513
16872
  if (error) {
16873
+ console.error("Wallet connection error:", error);
16514
16874
  resetNavigation();
16515
16875
  return;
16516
16876
  }
@@ -16532,7 +16892,7 @@ function useHomeWalletActions({
16532
16892
  WalletConnect().catch(() => resetNavigation());
16533
16893
  }, [setYourWalletTokens, disconnect]);
16534
16894
  const { selectedNamespace } = useDepositWallet();
16535
- const browserWallets = useMemo17(() => {
16895
+ const browserWallets = useMemo18(() => {
16536
16896
  if (!detectedWallets?.length) return [];
16537
16897
  return detectedWallets.filter(
16538
16898
  (wallet) => wallet?.meta?.id !== "walletconnect" && wallet?.meta?.ecosystem.trim().toLowerCase() === selectedNamespace.trim().toLowerCase()
@@ -16944,7 +17304,7 @@ var init_relayFeeUtils = __esm({
16944
17304
  });
16945
17305
 
16946
17306
  // src/widget/features/route-preview/hooks/useRoutePreviewModel.ts
16947
- import { useMemo as useMemo18 } from "react";
17307
+ import { useMemo as useMemo19 } from "react";
16948
17308
  function useRoutePreviewModel({
16949
17309
  amountUsd,
16950
17310
  amountValidationError,
@@ -16957,7 +17317,7 @@ function useRoutePreviewModel({
16957
17317
  walletAddress
16958
17318
  }) {
16959
17319
  const { chains } = useChains();
16960
- const destinationConfig = useMemo18(
17320
+ const destinationConfig = useMemo19(
16961
17321
  () => ({
16962
17322
  dappName: config.messages?.title || "DApp",
16963
17323
  toChain: config.routes.toChain,
@@ -16971,7 +17331,7 @@ function useRoutePreviewModel({
16971
17331
  config.routes.toToken
16972
17332
  ]
16973
17333
  );
16974
- const routeConfig = useMemo18(() => {
17334
+ const routeConfig = useMemo19(() => {
16975
17335
  const toChainId = config.routes.toChain;
16976
17336
  const toChainKey = normalizeChainKey2(toChainId);
16977
17337
  const toChain = toChainKey ? chains.find(
@@ -17008,7 +17368,7 @@ function useRoutePreviewModel({
17008
17368
  ...routeConfig,
17009
17369
  enabled: !!isReady
17010
17370
  });
17011
- const routePrerequisiteError = useMemo18(() => {
17371
+ const routePrerequisiteError = useMemo19(() => {
17012
17372
  if (!isReady) return;
17013
17373
  if (!selectedChain) {
17014
17374
  return "Select a source chain to fetch a route.";
@@ -30590,7 +30950,7 @@ var init_smart_account2 = __esm({
30590
30950
  });
30591
30951
 
30592
30952
  // src/widget/features/transaction/hooks/useTransactionActionModel.ts
30593
- import { useCallback as useCallback19, useEffect as useEffect24, useMemo as useMemo19, useRef as useRef11, useState as useState24 } from "react";
30953
+ import { useCallback as useCallback19, useEffect as useEffect25, useMemo as useMemo20, useRef as useRef12, useState as useState25 } from "react";
30594
30954
  import { encodeFunctionData as encodeFunctionData8, erc20Abi } from "viem";
30595
30955
  function normalizeTokenAddressForCompare(chain, addr) {
30596
30956
  const chainType = (chain.type ?? chain.chainType ?? "").toLowerCase();
@@ -30612,7 +30972,7 @@ function useTransactionActionModel({
30612
30972
  walletAddress,
30613
30973
  walletStatus
30614
30974
  }) {
30615
- const feeDataCacheRef = useRef11({});
30975
+ const feeDataCacheRef = useRef12({});
30616
30976
  const { isSubmitting, submitTransaction } = useTransactionSubmit();
30617
30977
  const { trackEvent } = useGTM(GTM_ID);
30618
30978
  const destinationConfig = (() => {
@@ -30625,7 +30985,7 @@ function useTransactionActionModel({
30625
30985
  const chainType = selectedChain?.type ?? selectedChain?.chainType;
30626
30986
  const chainTypeNormalized = (chainType ?? "").toLowerCase();
30627
30987
  const isEvm = chainTypeNormalized === "evm";
30628
- const backendChainId2 = useMemo19(() => {
30988
+ const backendChainId2 = useMemo20(() => {
30629
30989
  const chainRef = routeResult?.txReq?.chainId ?? selectedChain?.networkIdentifier ?? selectedChain?.chainId ?? selectedChain?.id;
30630
30990
  if (chainRef == null) return null;
30631
30991
  return String(chainRef);
@@ -30635,7 +30995,7 @@ function useTransactionActionModel({
30635
30995
  selectedChain?.id,
30636
30996
  selectedChain?.networkIdentifier
30637
30997
  ]);
30638
- const selectedTokenOnBackendChain = useMemo19(() => {
30998
+ const selectedTokenOnBackendChain = useMemo20(() => {
30639
30999
  if (!backendChainId2) return false;
30640
31000
  const target = normalizeChainKey2(backendChainId2);
30641
31001
  return [
@@ -30652,22 +31012,22 @@ function useTransactionActionModel({
30652
31012
  selectedChain?.id,
30653
31013
  selectedChain?.networkIdentifier
30654
31014
  ]);
30655
- const isNativeSelected = useMemo19(() => {
31015
+ const isNativeSelected = useMemo20(() => {
30656
31016
  const address = selectedToken?.address;
30657
31017
  return isNativeTokenAddress(address, chainType) || isZeroAddrLike(address, chainType) || normalizeTokenAddressForCompare(selectedChain, address) === normalizeTokenAddressForCompare(
30658
31018
  selectedChain,
30659
31019
  getNativeTokenAddress2(chainType)
30660
31020
  );
30661
31021
  }, [chainType, selectedChain, selectedToken?.address]);
30662
- const spender = useMemo19(() => {
31022
+ const spender = useMemo20(() => {
30663
31023
  const txReq = routeResult?.txReq;
30664
31024
  const addr = txReq?.to ?? txReq?.target;
30665
31025
  return addr ?? null;
30666
31026
  }, [routeResult?.txReq]);
30667
- const [allowanceWei, setAllowanceWei] = useState24(0n);
30668
- const [isReadingAllowance, setIsReadingAllowance] = useState24(false);
30669
- const [isApproving, setIsApproving] = useState24(false);
30670
- const [gasReservationWei, setGasReservationWei] = useState24(0n);
31027
+ const [allowanceWei, setAllowanceWei] = useState25(0n);
31028
+ const [isReadingAllowance, setIsReadingAllowance] = useState25(false);
31029
+ const [isApproving, setIsApproving] = useState25(false);
31030
+ const [gasReservationWei, setGasReservationWei] = useState25(0n);
30671
31031
  const readAllowance = useCallback19(async () => {
30672
31032
  if (!isEvm || isNativeSelected || !!routeResult?.sponsorship || // sponsored routes: SA approves bridge inside the UO batch
30673
31033
  !backendChainId2 || !selectedTokenOnBackendChain || !walletAddress || !spender || !selectedToken?.address) {
@@ -30698,7 +31058,7 @@ function useTransactionActionModel({
30698
31058
  spender,
30699
31059
  walletAddress
30700
31060
  ]);
30701
- useEffect24(() => {
31061
+ useEffect25(() => {
30702
31062
  void readAllowance();
30703
31063
  }, [readAllowance]);
30704
31064
  const needsApproval = isEvm && !isNativeSelected && !routeResult?.sponsorship && // sponsored routes use Permit2 + SA internal batch — no EOA bridge approval
@@ -30902,13 +31262,13 @@ function useTransactionActionModel({
30902
31262
  routeResult?.txReq,
30903
31263
  walletAddress
30904
31264
  ]);
30905
- useEffect24(() => {
31265
+ useEffect25(() => {
30906
31266
  if (routeResult) {
30907
31267
  void estimateGasReservationWei();
30908
31268
  }
30909
31269
  }, [estimateGasReservationWei, routeResult]);
30910
- const [smartAccountFailed, setSmartAccountFailed] = useState24(false);
30911
- useEffect24(() => {
31270
+ const [smartAccountFailed, setSmartAccountFailed] = useState25(false);
31271
+ useEffect25(() => {
30912
31272
  setSmartAccountFailed(false);
30913
31273
  }, [routeResult?.intentId]);
30914
31274
  const handleConfirm = useCallback19(async () => {
@@ -31012,7 +31372,7 @@ function useTransactionActionModel({
31012
31372
  ]);
31013
31373
  const isWalletConnected = walletStatus === "connected";
31014
31374
  const canSwipe = parsedAmount > 0 && !!selectedToken && isWalletConnected && !isLoadingRoute && !isSubmitting && !!routeResult && !actionErrorMessage && !isApproving && !isReadingAllowance;
31015
- const swipeResetKey = useMemo19(() => {
31375
+ const swipeResetKey = useMemo20(() => {
31016
31376
  const tokenAddress = selectedToken ? normalizeAddress2(
31017
31377
  selectedToken.address,
31018
31378
  selectedToken?.chainData?.type ?? selectedToken?.chainData?.chainType
@@ -31242,12 +31602,12 @@ var init_DefaultCryptoPay = __esm({
31242
31602
  });
31243
31603
 
31244
31604
  // src/widget/pages/CryptoPay/RouteQuoteLoader.tsx
31245
- import { useState as useState25, useEffect as useEffect25 } from "react";
31605
+ import { useState as useState26, useEffect as useEffect26 } from "react";
31246
31606
  import { jsx as jsx49, jsxs as jsxs39 } from "react/jsx-runtime";
31247
31607
  function RouteQuoteLoader({ selectedToken }) {
31248
- const [messageIndex, setMessageIndex] = useState25(0);
31249
- const [visible, setVisible] = useState25(true);
31250
- useEffect25(() => {
31608
+ const [messageIndex, setMessageIndex] = useState26(0);
31609
+ const [visible, setVisible] = useState26(true);
31610
+ useEffect26(() => {
31251
31611
  let t = null;
31252
31612
  const interval = setInterval(() => {
31253
31613
  setVisible(false);
@@ -31423,8 +31783,8 @@ var init_RouteQuoteLoader = __esm({
31423
31783
  });
31424
31784
 
31425
31785
  // src/widget/pages/CryptoPay/index.tsx
31426
- import { useEffect as useEffect26, useMemo as useMemo20 } from "react";
31427
- import { Fragment as Fragment7, jsx as jsx50, jsxs as jsxs40 } from "react/jsx-runtime";
31786
+ import { useEffect as useEffect27, useMemo as useMemo21 } from "react";
31787
+ import { Fragment as Fragment8, jsx as jsx50, jsxs as jsxs40 } from "react/jsx-runtime";
31428
31788
  function CryptoPay({ style: _style }) {
31429
31789
  const {
31430
31790
  amount,
@@ -31447,17 +31807,17 @@ function CryptoPay({ style: _style }) {
31447
31807
  const { goBack, setCurrentStep, currentStep } = useDepositNavigation();
31448
31808
  const config = useTrustwareConfig();
31449
31809
  const { fixedFromAmountString, isFixedAmount, minAmountUsd, maxAmountUsd } = useAmountConstraints();
31450
- const routeRefreshMs = useMemo20(() => {
31810
+ const routeRefreshMs = useMemo21(() => {
31451
31811
  const raw = config.routes?.options?.routeRefreshMs;
31452
31812
  const n = Number(raw);
31453
31813
  return Number.isFinite(n) && n > 0 ? n : void 0;
31454
31814
  }, [config.routes?.options?.routeRefreshMs]);
31455
31815
  const IsPos = (x) => x !== null && x !== void 0 && x.balance !== "0";
31456
- const showDefaultCryptoPay = useMemo20(() => {
31816
+ const showDefaultCryptoPay = useMemo21(() => {
31457
31817
  const nonZer0Tks = (yourWalletTokens ?? []).filter(IsPos);
31458
31818
  return !yourWalletTokensLoading && nonZer0Tks.length === 0 && yourWalletTokens.length > 0;
31459
31819
  }, [yourWalletTokens, yourWalletTokensLoading]);
31460
- const showSkeleton = useMemo20(() => {
31820
+ const showSkeleton = useMemo21(() => {
31461
31821
  return (yourWalletTokens ?? []).length === 0;
31462
31822
  }, [yourWalletTokens]);
31463
31823
  const isReady = selectedToken != null && selectedToken?.chainData !== void 0 && !showDefaultCryptoPay && !showSkeleton;
@@ -31533,7 +31893,7 @@ function CryptoPay({ style: _style }) {
31533
31893
  });
31534
31894
  const { emitError } = useTrustware();
31535
31895
  const readySelectedToken = isReady ? selectedToken : null;
31536
- useEffect26(() => {
31896
+ useEffect27(() => {
31537
31897
  if (currentStep !== "crypto-pay" || !actionErrorMessage) return;
31538
31898
  emitError?.(
31539
31899
  new TrustwareError({
@@ -31562,7 +31922,7 @@ function CryptoPay({ style: _style }) {
31562
31922
  if (isFixedAmount) return;
31563
31923
  setAmount(value.toString());
31564
31924
  };
31565
- const relayFeeUsd = useMemo20(
31925
+ const relayFeeUsd = useMemo21(
31566
31926
  () => computeRelayFeeUsd(routeResult, isNativeSelected),
31567
31927
  [isNativeSelected, routeResult]
31568
31928
  );
@@ -31663,7 +32023,7 @@ function CryptoPay({ style: _style }) {
31663
32023
  ]
31664
32024
  }
31665
32025
  ),
31666
- showSkeleton ? /* @__PURE__ */ jsx50(Fragment7, { children: /* @__PURE__ */ jsx50(
32026
+ showSkeleton ? /* @__PURE__ */ jsx50(Fragment8, { children: /* @__PURE__ */ jsx50(
31667
32027
  "div",
31668
32028
  {
31669
32029
  style: {
@@ -31674,8 +32034,8 @@ function CryptoPay({ style: _style }) {
31674
32034
  },
31675
32035
  children: /* @__PURE__ */ jsx50(LoadingSkeleton, {})
31676
32036
  }
31677
- ) }) : /* @__PURE__ */ jsxs40(Fragment7, { children: [
31678
- isReady && /* @__PURE__ */ jsx50(Fragment7, { children: isLoadingRoute && !routeResult ? /* @__PURE__ */ jsx50(RouteQuoteLoader, { selectedToken: readySelectedToken }) : /* @__PURE__ */ jsxs40(Fragment7, { children: [
32037
+ ) }) : /* @__PURE__ */ jsxs40(Fragment8, { children: [
32038
+ isReady && /* @__PURE__ */ jsx50(Fragment8, { children: isLoadingRoute && !routeResult ? /* @__PURE__ */ jsx50(RouteQuoteLoader, { selectedToken: readySelectedToken }) : /* @__PURE__ */ jsxs40(Fragment8, { children: [
31679
32039
  /* @__PURE__ */ jsx50(
31680
32040
  CryptoPayAmountSection,
31681
32041
  {
@@ -31754,7 +32114,7 @@ var init_CryptoPay = __esm({
31754
32114
  });
31755
32115
 
31756
32116
  // src/widget/pages/Processing.tsx
31757
- import { useEffect as useEffect27, useMemo as useMemo21, useRef as useRef12 } from "react";
32117
+ import { useEffect as useEffect28, useMemo as useMemo22, useRef as useRef13 } from "react";
31758
32118
  import { jsx as jsx51, jsxs as jsxs41 } from "react/jsx-runtime";
31759
32119
  function getProgressFromStatus(status) {
31760
32120
  switch (status) {
@@ -31793,27 +32153,27 @@ function Processing({ style }) {
31793
32153
  const { resetState, setCurrentStep } = useDepositNavigation();
31794
32154
  const { transactionStatus, transactionHash, intentId } = useDepositTransaction();
31795
32155
  const { transaction, startPolling, isPolling } = useTransactionPolling();
31796
- const hasStartedPolling = useRef12(false);
31797
- useEffect27(() => {
32156
+ const hasStartedPolling = useRef13(false);
32157
+ useEffect28(() => {
31798
32158
  return () => {
31799
32159
  hasStartedPolling.current = false;
31800
32160
  };
31801
32161
  }, []);
31802
- useEffect27(() => {
32162
+ useEffect28(() => {
31803
32163
  if (intentId && transactionHash && !isPolling && !hasStartedPolling.current && transactionStatus !== "success" && transactionStatus !== "error") {
31804
32164
  hasStartedPolling.current = true;
31805
32165
  startPolling(intentId, transactionHash);
31806
32166
  }
31807
32167
  }, [intentId, transactionHash, isPolling, transactionStatus, startPolling]);
31808
- const progress = useMemo21(
32168
+ const progress = useMemo22(
31809
32169
  () => getProgressFromStatus(transactionStatus),
31810
32170
  [transactionStatus]
31811
32171
  );
31812
- const stepText = useMemo21(
32172
+ const stepText = useMemo22(
31813
32173
  () => getStepText(transactionStatus),
31814
32174
  [transactionStatus]
31815
32175
  );
31816
- const explorerUrl = useMemo21(() => {
32176
+ const explorerUrl = useMemo22(() => {
31817
32177
  if (transaction?.fromChainTxUrl) {
31818
32178
  return transaction.fromChainTxUrl;
31819
32179
  }
@@ -31959,15 +32319,15 @@ var init_Processing = __esm({
31959
32319
  });
31960
32320
 
31961
32321
  // src/widget/pages/Success.tsx
31962
- import { lazy, Suspense, useMemo as useMemo22 } from "react";
32322
+ import { lazy, Suspense, useMemo as useMemo23 } from "react";
31963
32323
  import { jsx as jsx52, jsxs as jsxs42 } from "react/jsx-runtime";
31964
32324
  function Success({ style }) {
31965
32325
  const { selectedToken, selectedChain, amount } = useDepositForm();
31966
32326
  const { resetState } = useDepositNavigation();
31967
32327
  const { transactionHash } = useDepositTransaction();
31968
32328
  const { transaction } = useTransactionPolling();
31969
- const parsedAmount = useMemo22(() => parseFloat(amount) || 0, [amount]);
31970
- const explorerUrl = useMemo22(() => {
32329
+ const parsedAmount = useMemo23(() => parseFloat(amount) || 0, [amount]);
32330
+ const explorerUrl = useMemo23(() => {
31971
32331
  if (transaction?.toChainTxUrl) {
31972
32332
  return transaction.toChainTxUrl;
31973
32333
  }
@@ -32188,7 +32548,7 @@ var init_mapError = __esm({
32188
32548
  });
32189
32549
 
32190
32550
  // src/widget/pages/Error.tsx
32191
- import { useMemo as useMemo23 } from "react";
32551
+ import { useMemo as useMemo24 } from "react";
32192
32552
  import { jsx as jsx53 } from "react/jsx-runtime";
32193
32553
  function Error2({ style: _style }) {
32194
32554
  const { selectedChain } = useDepositForm();
@@ -32199,8 +32559,8 @@ function Error2({ style: _style }) {
32199
32559
  setErrorMessage,
32200
32560
  transactionHash
32201
32561
  } = useDepositTransaction();
32202
- const mapped = useMemo23(() => mapError(errorMessage), [errorMessage]);
32203
- const explorerUrl = useMemo23(() => {
32562
+ const mapped = useMemo24(() => mapError(errorMessage), [errorMessage]);
32563
+ const explorerUrl = useMemo24(() => {
32204
32564
  if (transactionHash && selectedChain?.blockExplorerUrls?.length) {
32205
32565
  return `${selectedChain.blockExplorerUrls[0].replace(/\/+$/, "")}/tx/${transactionHash}`;
32206
32566
  }
@@ -32260,18 +32620,18 @@ var init_widgetSteps = __esm({
32260
32620
  });
32261
32621
 
32262
32622
  // src/widget/app/WidgetRouter.tsx
32263
- import { useMemo as useMemo24 } from "react";
32623
+ import { useMemo as useMemo25 } from "react";
32264
32624
  import { jsx as jsx54 } from "react/jsx-runtime";
32265
32625
  function WidgetRouter({
32266
32626
  currentStep,
32267
32627
  navigationDirection,
32268
32628
  stepHistory
32269
32629
  }) {
32270
- const PageComponent = useMemo24(
32630
+ const PageComponent = useMemo25(
32271
32631
  () => PAGE_COMPONENTS[currentStep],
32272
32632
  [currentStep]
32273
32633
  );
32274
- const animationClass = useMemo24(() => {
32634
+ const animationClass = useMemo25(() => {
32275
32635
  return navigationDirection === "forward" ? "tw-animate-slide-in-right" : "tw-animate-slide-in-left";
32276
32636
  }, [navigationDirection]);
32277
32637
  return /* @__PURE__ */ jsx54(
@@ -32299,14 +32659,14 @@ var init_WidgetRouter = __esm({
32299
32659
  });
32300
32660
 
32301
32661
  // src/modes/swap/hooks/useSwapRoute.ts
32302
- import { useCallback as useCallback20, useRef as useRef13, useState as useState26 } from "react";
32662
+ import { useCallback as useCallback20, useRef as useRef14, useState as useState27 } from "react";
32303
32663
  function useSwapRoute() {
32304
- const [state, setState] = useState26({
32664
+ const [state, setState] = useState27({
32305
32665
  data: null,
32306
32666
  loading: false,
32307
32667
  error: null
32308
32668
  });
32309
- const abortRef = useRef13(false);
32669
+ const abortRef = useRef14(false);
32310
32670
  const fetch2 = useCallback20(
32311
32671
  async (params) => {
32312
32672
  const { fromToken, fromChain, toToken, toChain, amount, walletAddress } = params;
@@ -32365,7 +32725,7 @@ var init_useSwapRoute = __esm({
32365
32725
  });
32366
32726
 
32367
32727
  // src/modes/swap/hooks/useSwapExecution.ts
32368
- import { useCallback as useCallback21, useRef as useRef14, useState as useState27 } from "react";
32728
+ import { useCallback as useCallback21, useRef as useRef15, useState as useState28 } from "react";
32369
32729
  import { encodeFunctionData as encodeFunctionData9, erc20Abi as erc20Abi2 } from "viem";
32370
32730
  function normalizeTx(raw) {
32371
32731
  const r = raw;
@@ -32400,7 +32760,7 @@ async function waitForApprovalConfirmation(chainId, txHash) {
32400
32760
  throw new Error("Timed out waiting for approval confirmation");
32401
32761
  }
32402
32762
  function useSwapExecution(fromChain) {
32403
- const [state, setState] = useState27({
32763
+ const [state, setState] = useState28({
32404
32764
  txStatus: "idle",
32405
32765
  txHash: null,
32406
32766
  intentId: null,
@@ -32409,11 +32769,11 @@ function useSwapExecution(fromChain) {
32409
32769
  isSubmitting: false,
32410
32770
  allowanceStatus: "unknown"
32411
32771
  });
32412
- const saFailedUntilRef = useRef14(0);
32413
- const pollingRef = useRef14(null);
32414
- const timeoutRef = useRef14(null);
32415
- const abortRef = useRef14(false);
32416
- const pollCountRef = useRef14(0);
32772
+ const saFailedUntilRef = useRef15(0);
32773
+ const pollingRef = useRef15(null);
32774
+ const timeoutRef = useRef15(null);
32775
+ const abortRef = useRef15(false);
32776
+ const pollCountRef = useRef15(0);
32417
32777
  const clearPolling = useCallback21(() => {
32418
32778
  abortRef.current = true;
32419
32779
  if (pollingRef.current) clearTimeout(pollingRef.current);
@@ -32776,13 +33136,13 @@ var init_forex = __esm({
32776
33136
  });
32777
33137
 
32778
33138
  // src/modes/swap/hooks/useForex.ts
32779
- import { useEffect as useEffect28, useRef as useRef15, useState as useState28 } from "react";
33139
+ import { useEffect as useEffect29, useRef as useRef16, useState as useState29 } from "react";
32780
33140
  function useForex() {
32781
- const [rates, setRates] = useState28({ USD: 1 });
32782
- const [error, setError] = useState28(null);
32783
- const [lastUpdated, setLastUpdated] = useState28(null);
32784
- const timerRef = useRef15(null);
32785
- useEffect28(() => {
33141
+ const [rates, setRates] = useState29({ USD: 1 });
33142
+ const [error, setError] = useState29(null);
33143
+ const [lastUpdated, setLastUpdated] = useState29(null);
33144
+ const timerRef = useRef16(null);
33145
+ useEffect29(() => {
32786
33146
  let cancelled = false;
32787
33147
  const load = () => {
32788
33148
  fetchForexRates("USD").then((r) => {
@@ -32819,7 +33179,7 @@ var init_useForex = __esm({
32819
33179
  });
32820
33180
 
32821
33181
  // src/modes/swap/components/SwapTokenSelect.tsx
32822
- import { useState as useState29, useMemo as useMemo25, useEffect as useEffect29 } from "react";
33182
+ import { useState as useState30, useMemo as useMemo26, useEffect as useEffect30 } from "react";
32823
33183
  import { jsx as jsx55, jsxs as jsxs43 } from "react/jsx-runtime";
32824
33184
  function SwapTokenSelect({
32825
33185
  side,
@@ -32835,10 +33195,10 @@ function SwapTokenSelect({
32835
33195
  allowedTokens,
32836
33196
  excludeToken
32837
33197
  }) {
32838
- const [localChain, setLocalChain] = useState29(initialChain);
32839
- const [pinnedTokens, setPinnedTokens] = useState29([]);
32840
- const [pinnedLoading, setPinnedLoading] = useState29(false);
32841
- useEffect29(() => {
33198
+ const [localChain, setLocalChain] = useState30(initialChain);
33199
+ const [pinnedTokens, setPinnedTokens] = useState30([]);
33200
+ const [pinnedLoading, setPinnedLoading] = useState30(false);
33201
+ useEffect30(() => {
32842
33202
  if (!allowedTokens || allowedTokens.length === 0 || !localChain) {
32843
33203
  setPinnedTokens([]);
32844
33204
  return;
@@ -32919,26 +33279,26 @@ function SwapTokenSelect({
32919
33279
  walletAddress,
32920
33280
  yourWalletTokens
32921
33281
  });
32922
- const allowedSet = useMemo25(() => {
33282
+ const allowedSet = useMemo26(() => {
32923
33283
  if (!allowedTokens || allowedTokens.length === 0) return null;
32924
33284
  return new Set(
32925
33285
  allowedTokens.map((t) => `${t.chainId}:${t.address.toLowerCase()}`)
32926
33286
  );
32927
33287
  }, [allowedTokens]);
32928
- const filteredWalletTokens = useMemo25(() => {
33288
+ const filteredWalletTokens = useMemo26(() => {
32929
33289
  if (!allowedSet) return rawWalletTokens;
32930
33290
  return rawWalletTokens.filter(
32931
33291
  (t) => allowedSet.has(`${Number(t.chainId)}:${t.address.toLowerCase()}`)
32932
33292
  );
32933
33293
  }, [rawWalletTokens, allowedSet]);
32934
33294
  const excludeKey = excludeToken ? `${Number(excludeToken.chainId)}:${excludeToken.address.toLowerCase()}` : null;
32935
- const visibleTokens = useMemo25(() => {
33295
+ const visibleTokens = useMemo26(() => {
32936
33296
  if (!excludeKey) return filteredTokens;
32937
33297
  return filteredTokens.filter(
32938
33298
  (t) => `${Number(t.chainId)}:${t.address.toLowerCase()}` !== excludeKey
32939
33299
  );
32940
33300
  }, [filteredTokens, excludeKey]);
32941
- const visibleWalletTokens = useMemo25(() => {
33301
+ const visibleWalletTokens = useMemo26(() => {
32942
33302
  if (!excludeKey) return filteredWalletTokens;
32943
33303
  return filteredWalletTokens.filter(
32944
33304
  (t) => `${Number(t.chainId)}:${t.address.toLowerCase()}` !== excludeKey
@@ -33067,8 +33427,8 @@ var init_SwapTokenSelect = __esm({
33067
33427
  });
33068
33428
 
33069
33429
  // src/modes/swap/components/SwapWalletSelector.tsx
33070
- import { useEffect as useEffect30, useMemo as useMemo26, useRef as useRef16, useState as useState30 } from "react";
33071
- import { Fragment as Fragment8, jsx as jsx56, jsxs as jsxs44 } from "react/jsx-runtime";
33430
+ import { useEffect as useEffect31, useMemo as useMemo27, useRef as useRef17, useState as useState31 } from "react";
33431
+ import { Fragment as Fragment9, jsx as jsx56, jsxs as jsxs44 } from "react/jsx-runtime";
33072
33432
  function SwapWalletSelector({
33073
33433
  walletStatus,
33074
33434
  walletAddress,
@@ -33084,16 +33444,16 @@ function SwapWalletSelector({
33084
33444
  } = useWalletInfo();
33085
33445
  const walletConnectCfg = TrustwareConfigStore.peek()?.walletConnect;
33086
33446
  const connectWC = useWalletConnectConnect(walletConnectCfg);
33087
- const [wcConnecting, setWcConnecting] = useState30(false);
33088
- const [connectingId, setConnectingId] = useState30(null);
33089
- const [timerExpired, setTimerExpired] = useState30(false);
33090
- const [selectedNamespace, setSelectedNamespace] = useState30("evm");
33091
- const prevStatusRef = useRef16(walletStatus);
33092
- useEffect30(() => {
33447
+ const [wcConnecting, setWcConnecting] = useState31(false);
33448
+ const [connectingId, setConnectingId] = useState31(null);
33449
+ const [timerExpired, setTimerExpired] = useState31(false);
33450
+ const [selectedNamespace, setSelectedNamespace] = useState31("evm");
33451
+ const prevStatusRef = useRef17(walletStatus);
33452
+ useEffect31(() => {
33093
33453
  const t = setTimeout(() => setTimerExpired(true), 450);
33094
33454
  return () => clearTimeout(t);
33095
33455
  }, []);
33096
- useEffect30(() => {
33456
+ useEffect31(() => {
33097
33457
  const prev = prevStatusRef.current;
33098
33458
  if (prev !== walletStatus) {
33099
33459
  if (prev === "connecting" && (walletStatus === "connected" || walletStatus === "error")) {
@@ -33102,7 +33462,7 @@ function SwapWalletSelector({
33102
33462
  prevStatusRef.current = walletStatus;
33103
33463
  }
33104
33464
  }, [walletStatus]);
33105
- const filteredWallets = useMemo26(
33465
+ const filteredWallets = useMemo27(
33106
33466
  () => detected.filter(
33107
33467
  (w) => (w.meta?.ecosystem ?? "").toLowerCase() === selectedNamespace
33108
33468
  ),
@@ -33526,7 +33886,7 @@ function SwapWalletSelector({
33526
33886
  })
33527
33887
  }
33528
33888
  ),
33529
- selectedNamespace === "evm" && /* @__PURE__ */ jsxs44(Fragment8, { children: [
33889
+ selectedNamespace === "evm" && /* @__PURE__ */ jsxs44(Fragment9, { children: [
33530
33890
  /* @__PURE__ */ jsx56(
33531
33891
  "div",
33532
33892
  {
@@ -33767,13 +34127,13 @@ import {
33767
34127
  lazy as lazy2,
33768
34128
  Suspense as Suspense2,
33769
34129
  useCallback as useCallback22,
33770
- useEffect as useEffect31,
33771
- useMemo as useMemo27,
33772
- useRef as useRef17,
33773
- useState as useState31
34130
+ useEffect as useEffect32,
34131
+ useMemo as useMemo28,
34132
+ useRef as useRef18,
34133
+ useState as useState32
33774
34134
  } from "react";
33775
34135
  import ReactDOM from "react-dom";
33776
- import { Fragment as Fragment9, jsx as jsx57, jsxs as jsxs45 } from "react/jsx-runtime";
34136
+ import { Fragment as Fragment10, jsx as jsx57, jsxs as jsxs45 } from "react/jsx-runtime";
33777
34137
  function fmtAmount(n, max = 6) {
33778
34138
  if (!isFinite(n) || n === 0) return "0";
33779
34139
  return n.toLocaleString(void 0, { maximumFractionDigits: max });
@@ -33865,36 +34225,36 @@ function SwapMode({
33865
34225
  theme: themeProp,
33866
34226
  style
33867
34227
  }) {
33868
- const [stage, setStage] = useState31("home");
33869
- const [fromToken, setFromToken] = useState31(
34228
+ const [stage, setStage] = useState32("home");
34229
+ const [fromToken, setFromToken] = useState32(
33870
34230
  null
33871
34231
  );
33872
- const [fromChain, setFromChain] = useState31(null);
33873
- const [toToken, setToToken] = useState31(null);
33874
- const [toChain, setToChain] = useState31(null);
33875
- const [amount, setAmount] = useState31("");
33876
- const [amountInputMode, setAmountInputMode] = useState31(
34232
+ const [fromChain, setFromChain] = useState32(null);
34233
+ const [toToken, setToToken] = useState32(null);
34234
+ const [toChain, setToChain] = useState32(null);
34235
+ const [amount, setAmount] = useState32("");
34236
+ const [amountInputMode, setAmountInputMode] = useState32(
33877
34237
  "usd"
33878
34238
  );
33879
- const [hoverSell, setHoverSell] = useState31(false);
33880
- const [showRateDetails, setShowRateDetails] = useState31(false);
33881
- const [showReviewDetails, setShowReviewDetails] = useState31(false);
33882
- const [showSettings, setShowSettings] = useState31(false);
33883
- const [maxApproval, setMaxApproval] = useState31(false);
33884
- const [slippage, setSlippage] = useState31(0.5);
33885
- const [slippageInput, setSlippageInput] = useState31("");
33886
- const [selectedCurrency, setSelectedCurrency] = useState31("USD");
33887
- const [showCurrencyDropdown, setShowCurrencyDropdown] = useState31(false);
33888
- const [completedAt, setCompletedAt] = useState31(null);
33889
- const [copiedHash, setCopiedHash] = useState31(null);
33890
- const [rateUpdated, setRateUpdated] = useState31(false);
33891
- const prevToAmountRef = useRef17(null);
33892
- const [destAddress, setDestAddress] = useState31("");
33893
- const [quoteAge, setQuoteAge] = useState31(0);
33894
- const quoteTimestampRef = useRef17(null);
33895
- const [quoteLoadingMsgIdx, setQuoteLoadingMsgIdx] = useState31(0);
33896
- const [quoteLoadingMsgVisible, setQuoteLoadingMsgVisible] = useState31(true);
33897
- const latestFetchParamsRef = useRef17(null);
34239
+ const [hoverSell, setHoverSell] = useState32(false);
34240
+ const [showRateDetails, setShowRateDetails] = useState32(false);
34241
+ const [showReviewDetails, setShowReviewDetails] = useState32(false);
34242
+ const [showSettings, setShowSettings] = useState32(false);
34243
+ const [maxApproval, setMaxApproval] = useState32(false);
34244
+ const [slippage, setSlippage] = useState32(0.5);
34245
+ const [slippageInput, setSlippageInput] = useState32("");
34246
+ const [selectedCurrency, setSelectedCurrency] = useState32("USD");
34247
+ const [showCurrencyDropdown, setShowCurrencyDropdown] = useState32(false);
34248
+ const [completedAt, setCompletedAt] = useState32(null);
34249
+ const [copiedHash, setCopiedHash] = useState32(null);
34250
+ const [rateUpdated, setRateUpdated] = useState32(false);
34251
+ const prevToAmountRef = useRef18(null);
34252
+ const [destAddress, setDestAddress] = useState32("");
34253
+ const [quoteAge, setQuoteAge] = useState32(0);
34254
+ const quoteTimestampRef = useRef18(null);
34255
+ const [quoteLoadingMsgIdx, setQuoteLoadingMsgIdx] = useState32(0);
34256
+ const [quoteLoadingMsgVisible, setQuoteLoadingMsgVisible] = useState32(true);
34257
+ const latestFetchParamsRef = useRef18(null);
33898
34258
  const { rates: forexRates } = useForex();
33899
34259
  const currencyMeta = getCurrencyMeta(selectedCurrency);
33900
34260
  const currencyRate = forexRates[selectedCurrency] ?? 1;
@@ -33910,8 +34270,8 @@ function SwapMode({
33910
34270
  },
33911
34271
  [currencyRate, selectedCurrency]
33912
34272
  );
33913
- const settingsRef = useRef17(null);
33914
- const currencyDropdownRef = useRef17(null);
34273
+ const settingsRef = useRef18(null);
34274
+ const currencyDropdownRef = useRef18(null);
33915
34275
  const { emitEvent } = useTrustware();
33916
34276
  const { features, theme: configTheme } = useTrustwareConfig();
33917
34277
  const effectiveThemeSetting = themeProp ?? configTheme ?? "system";
@@ -33927,26 +34287,26 @@ function SwapMode({
33927
34287
  isLoading: chainsLoading,
33928
34288
  error: chainsError
33929
34289
  } = useChains();
33930
- const allowedDestChainIds = useMemo27(() => {
34290
+ const allowedDestChainIds = useMemo28(() => {
33931
34291
  if (!allowedDestTokens || allowedDestTokens.length === 0) return null;
33932
34292
  return new Set(allowedDestTokens.map((t) => t.chainId));
33933
34293
  }, [allowedDestTokens]);
33934
- const toPopularChains = useMemo27(
34294
+ const toPopularChains = useMemo28(
33935
34295
  () => allowedDestChainIds ? popularChains.filter(
33936
34296
  (c) => allowedDestChainIds.has(Number(c.chainId))
33937
34297
  ) : popularChains,
33938
34298
  [popularChains, allowedDestChainIds]
33939
34299
  );
33940
- const toOtherChains = useMemo27(
34300
+ const toOtherChains = useMemo28(
33941
34301
  () => allowedDestChainIds ? otherChains.filter((c) => allowedDestChainIds.has(Number(c.chainId))) : otherChains,
33942
34302
  [otherChains, allowedDestChainIds]
33943
34303
  );
33944
- const allChains = useMemo27(
34304
+ const allChains = useMemo28(
33945
34305
  () => [...popularChains, ...otherChains],
33946
34306
  [popularChains, otherChains]
33947
34307
  );
33948
- const destInitialized = useRef17(false);
33949
- useEffect31(() => {
34308
+ const destInitialized = useRef18(false);
34309
+ useEffect32(() => {
33950
34310
  if (!defaultDestRef || destInitialized.current || allChains.length === 0)
33951
34311
  return;
33952
34312
  const chain = allChains.find(
@@ -33994,18 +34354,18 @@ function SwapMode({
33994
34354
  });
33995
34355
  const route = useSwapRoute();
33996
34356
  const execution = useSwapExecution(fromChain);
33997
- const fromTokenPriceUSD = useMemo27(() => {
34357
+ const fromTokenPriceUSD = useMemo28(() => {
33998
34358
  const p = fromToken?.usdPrice;
33999
34359
  return typeof p === "number" && Number.isFinite(p) && p > 0 ? p : 0;
34000
34360
  }, [fromToken]);
34001
34361
  const hasFromUsdPrice = fromTokenPriceUSD > 0;
34002
- const toTokenPriceUSD = useMemo27(() => {
34362
+ const toTokenPriceUSD = useMemo28(() => {
34003
34363
  const p = toToken?.usdPrice;
34004
34364
  return typeof p === "number" && Number.isFinite(p) && p > 0 ? p : 0;
34005
34365
  }, [toToken]);
34006
34366
  const hasToUsdPrice = toTokenPriceUSD > 0;
34007
34367
  const rawSellNum = parseFloat(amount) || 0;
34008
- const usdSellNum = useMemo27(() => {
34368
+ const usdSellNum = useMemo28(() => {
34009
34369
  if (amountInputMode === "usd") return rawSellNum / currencyRate;
34010
34370
  return hasFromUsdPrice ? rawSellNum * fromTokenPriceUSD : 0;
34011
34371
  }, [
@@ -34015,7 +34375,7 @@ function SwapMode({
34015
34375
  hasFromUsdPrice,
34016
34376
  fromTokenPriceUSD
34017
34377
  ]);
34018
- const tokenSellNum = useMemo27(() => {
34378
+ const tokenSellNum = useMemo28(() => {
34019
34379
  if (amountInputMode === "usd") {
34020
34380
  return hasFromUsdPrice && fromTokenPriceUSD > 0 ? usdSellNum / fromTokenPriceUSD : 0;
34021
34381
  }
@@ -34027,7 +34387,7 @@ function SwapMode({
34027
34387
  hasFromUsdPrice,
34028
34388
  fromTokenPriceUSD
34029
34389
  ]);
34030
- const tokenAmountStr = useMemo27(() => {
34390
+ const tokenAmountStr = useMemo28(() => {
34031
34391
  if (tokenSellNum <= 0) return "";
34032
34392
  const decimals = fromToken?.decimals ?? 18;
34033
34393
  return truncateDecimal(tokenSellNum, Math.min(decimals, 18));
@@ -34153,8 +34513,13 @@ function SwapMode({
34153
34513
  setStage("processing");
34154
34514
  const fromTokenAddress = fromToken?.address ?? fromToken?.address;
34155
34515
  const fromTokenDecimals = fromToken?.decimals ?? void 0;
34516
+ let routeToSend = route.data;
34517
+ if (isSerializedSolanaTxRequest(routeToSend.txReq) && latestFetchParamsRef.current) {
34518
+ const fresh = await route.fetch(latestFetchParamsRef.current);
34519
+ if (fresh) routeToSend = fresh;
34520
+ }
34156
34521
  await execution.execute(
34157
- route.data,
34522
+ routeToSend,
34158
34523
  fromTokenAddress,
34159
34524
  fromTokenDecimals,
34160
34525
  walletAddress ?? void 0,
@@ -34165,7 +34530,7 @@ function SwapMode({
34165
34530
  },
34166
34531
  () => setStage("error")
34167
34532
  );
34168
- }, [route.data, execution, fromToken, walletAddress, maxApproval]);
34533
+ }, [route, execution, fromToken, walletAddress, maxApproval]);
34169
34534
  const handleReset = useCallback22(() => {
34170
34535
  execution.reset();
34171
34536
  route.clear();
@@ -34233,7 +34598,7 @@ function SwapMode({
34233
34598
  fromToken?.decimals,
34234
34599
  route
34235
34600
  ]);
34236
- const fromBalance = useMemo27(() => {
34601
+ const fromBalance = useMemo28(() => {
34237
34602
  const walletToken = fromToken;
34238
34603
  if (!walletToken || !("balance" in walletToken)) return null;
34239
34604
  const raw = walletToken.balance;
@@ -34243,7 +34608,7 @@ function SwapMode({
34243
34608
  return Number.isFinite(n) ? n : null;
34244
34609
  }, [fromToken]);
34245
34610
  const balanceUsd = fromBalance !== null && hasFromUsdPrice ? fromBalance * fromTokenPriceUSD : null;
34246
- const estimatedToAmount = useMemo27(() => {
34611
+ const estimatedToAmount = useMemo28(() => {
34247
34612
  if (tokenSellNum <= 0 || !hasFromUsdPrice || !hasToUsdPrice) return null;
34248
34613
  return tokenSellNum * (fromTokenPriceUSD / toTokenPriceUSD);
34249
34614
  }, [
@@ -34253,10 +34618,10 @@ function SwapMode({
34253
34618
  hasFromUsdPrice,
34254
34619
  hasToUsdPrice
34255
34620
  ]);
34256
- const backendToUsdStr = useMemo27(() => {
34621
+ const backendToUsdStr = useMemo28(() => {
34257
34622
  return route.data?.finalExchangeRate?.toAmountMinUSD ?? route.data?.route?.estimate?.toAmountMinUsd ?? route.data?.route?.estimate?.toAmountUsd ?? null;
34258
34623
  }, [route.data]);
34259
- const toAmount = useMemo27(() => {
34624
+ const toAmount = useMemo28(() => {
34260
34625
  if (backendToUsdStr && toTokenPriceUSD > 0) {
34261
34626
  const usd = parseFloat(backendToUsdStr);
34262
34627
  if (Number.isFinite(usd) && usd > 0) return usd / toTokenPriceUSD;
@@ -34282,7 +34647,7 @@ function SwapMode({
34282
34647
  estimatedToAmount
34283
34648
  ]);
34284
34649
  const fromUsd = usdSellNum;
34285
- const toUsd = useMemo27(() => {
34650
+ const toUsd = useMemo28(() => {
34286
34651
  if (backendToUsdStr) {
34287
34652
  const n = parseFloat(backendToUsdStr);
34288
34653
  if (Number.isFinite(n) && n > 0) return n;
@@ -34293,12 +34658,12 @@ function SwapMode({
34293
34658
  const isEstimate = !route.data;
34294
34659
  const USD_EPSILON = 1e-3;
34295
34660
  const displayToUsd = toUsd > USD_EPSILON ? toUsd : estimatedToAmount !== null && hasToUsdPrice ? estimatedToAmount * toTokenPriceUSD : 0;
34296
- const priceImpact = useMemo27(() => {
34661
+ const priceImpact = useMemo28(() => {
34297
34662
  if (!route.data || fromUsd < 0.01 || displayToUsd < 0.01) return null;
34298
34663
  const impact = 1 - displayToUsd / fromUsd;
34299
34664
  return impact > 1e-3 ? impact : null;
34300
34665
  }, [route.data, fromUsd, displayToUsd]);
34301
- const routePath = useMemo27(() => {
34666
+ const routePath = useMemo28(() => {
34302
34667
  if (!route.data) return null;
34303
34668
  const provider = route.data.route?.provider;
34304
34669
  const steps = route.data.route?.steps;
@@ -34325,19 +34690,19 @@ function SwapMode({
34325
34690
  return null;
34326
34691
  }, [route.data, fromToken?.symbol, toToken?.symbol]);
34327
34692
  const isGasSponsored = !!route.data?.sponsorship;
34328
- const networkCostUsd = useMemo27(() => {
34693
+ const networkCostUsd = useMemo28(() => {
34329
34694
  const fees = route.data?.route?.estimate?.fees;
34330
34695
  if (!fees?.length) return null;
34331
34696
  const gasTotal = fees.filter((f) => f.type?.toLowerCase().includes("gas")).reduce((sum, f) => sum + (Number(f.amountUsd) || 0), 0);
34332
34697
  return gasTotal > 0 ? gasTotal : null;
34333
34698
  }, [route.data]);
34334
- const protocolFeeUsd = useMemo27(() => {
34699
+ const protocolFeeUsd = useMemo28(() => {
34335
34700
  const fees = route.data?.route?.estimate?.fees;
34336
34701
  if (!fees?.length) return null;
34337
34702
  const total = fees.filter((f) => !f.type?.toLowerCase().includes("gas")).reduce((sum, f) => sum + (Number(f.amountUsd) || 0), 0);
34338
34703
  return total > 0 ? total : null;
34339
34704
  }, [route.data]);
34340
- const exchangeRate = useMemo27(() => {
34705
+ const exchangeRate = useMemo28(() => {
34341
34706
  if (!hasFromUsdPrice || !hasToUsdPrice) return null;
34342
34707
  return toTokenPriceUSD / fromTokenPriceUSD;
34343
34708
  }, [fromTokenPriceUSD, toTokenPriceUSD, hasFromUsdPrice, hasToUsdPrice]);
@@ -34346,13 +34711,13 @@ function SwapMode({
34346
34711
  const hasAmount = rawSellNum > 0 && (amountInputMode === "token" || hasFromUsdPrice);
34347
34712
  const isConnected = walletStatus === "connected" && !!walletAddress;
34348
34713
  const canGetQuote = hasTokens && hasAmount && !insufficient && isConnected && (!needsDestAddress || isValidDestAddress);
34349
- useEffect31(() => {
34714
+ useEffect32(() => {
34350
34715
  if (!fromToken) return;
34351
34716
  if (!hasFromUsdPrice && amountInputMode === "usd") {
34352
34717
  setAmountInputMode("token");
34353
34718
  }
34354
34719
  }, [fromToken, hasFromUsdPrice, amountInputMode]);
34355
- useEffect31(() => {
34720
+ useEffect32(() => {
34356
34721
  if (displayToAmount === null) {
34357
34722
  prevToAmountRef.current = null;
34358
34723
  return;
@@ -34366,14 +34731,14 @@ function SwapMode({
34366
34731
  const t = setTimeout(() => setRateUpdated(false), 700);
34367
34732
  return () => clearTimeout(t);
34368
34733
  }, [displayToAmount]);
34369
- useEffect31(() => {
34734
+ useEffect32(() => {
34370
34735
  setDestAddress("");
34371
34736
  }, [toChainType]);
34372
- const fetchRef = useRef17(route.fetch);
34373
- useEffect31(() => {
34737
+ const fetchRef = useRef18(route.fetch);
34738
+ useEffect32(() => {
34374
34739
  fetchRef.current = route.fetch;
34375
34740
  });
34376
- useEffect31(() => {
34741
+ useEffect32(() => {
34377
34742
  if (!canGetQuote || stage !== "home") return;
34378
34743
  if (!fromToken || !fromChain || !toToken || !toChain || !walletAddress)
34379
34744
  return;
@@ -34402,7 +34767,7 @@ function SwapMode({
34402
34767
  destAddress,
34403
34768
  slippage
34404
34769
  ]);
34405
- useEffect31(() => {
34770
+ useEffect32(() => {
34406
34771
  if (!canGetQuote || !fromToken || !fromChain || !toToken || !toChain || !walletAddress) {
34407
34772
  latestFetchParamsRef.current = null;
34408
34773
  return;
@@ -34429,12 +34794,12 @@ function SwapMode({
34429
34794
  destAddress,
34430
34795
  slippage
34431
34796
  ]);
34432
- useEffect31(() => {
34797
+ useEffect32(() => {
34433
34798
  quoteTimestampRef.current = route.data ? Date.now() : null;
34434
34799
  setQuoteAge(0);
34435
34800
  }, [route.data]);
34436
- const msgTimeoutRef = useRef17(null);
34437
- useEffect31(() => {
34801
+ const msgTimeoutRef = useRef18(null);
34802
+ useEffect32(() => {
34438
34803
  if (!route.loading) {
34439
34804
  setQuoteLoadingMsgIdx(0);
34440
34805
  setQuoteLoadingMsgVisible(true);
@@ -34452,7 +34817,7 @@ function SwapMode({
34452
34817
  if (msgTimeoutRef.current !== null) clearTimeout(msgTimeoutRef.current);
34453
34818
  };
34454
34819
  }, [route.loading]);
34455
- useEffect31(() => {
34820
+ useEffect32(() => {
34456
34821
  if (!route.data) return;
34457
34822
  const id = setInterval(() => {
34458
34823
  const ts = quoteTimestampRef.current;
@@ -34466,7 +34831,7 @@ function SwapMode({
34466
34831
  }, 1e3);
34467
34832
  return () => clearInterval(id);
34468
34833
  }, [route.data]);
34469
- useEffect31(() => {
34834
+ useEffect32(() => {
34470
34835
  if (stage !== "review") return;
34471
34836
  if (!route.data || !walletAddress) return;
34472
34837
  const fromTokenAddress = fromToken?.address;
@@ -34477,7 +34842,7 @@ function SwapMode({
34477
34842
  routeResult: route.data
34478
34843
  });
34479
34844
  }, [stage, route.data, walletAddress, fromToken]);
34480
- useEffect31(() => {
34845
+ useEffect32(() => {
34481
34846
  if (!showSettings) {
34482
34847
  setShowCurrencyDropdown(false);
34483
34848
  return;
@@ -34490,7 +34855,7 @@ function SwapMode({
34490
34855
  document.addEventListener("mousedown", handler);
34491
34856
  return () => document.removeEventListener("mousedown", handler);
34492
34857
  }, [showSettings]);
34493
- useEffect31(() => {
34858
+ useEffect32(() => {
34494
34859
  if (!showCurrencyDropdown) return;
34495
34860
  const handler = (e2) => {
34496
34861
  if (currencyDropdownRef.current && !currencyDropdownRef.current.contains(e2.target)) {
@@ -34977,7 +35342,7 @@ function SwapMode({
34977
35342
  padding: 0,
34978
35343
  transition: "color 0.15s"
34979
35344
  },
34980
- children: isCopied ? "Copied!" : /* @__PURE__ */ jsxs45(Fragment9, { children: [
35345
+ children: isCopied ? "Copied!" : /* @__PURE__ */ jsxs45(Fragment10, { children: [
34981
35346
  txHash.slice(0, 6),
34982
35347
  "\u2026",
34983
35348
  txHash.slice(-4),
@@ -37640,8 +38005,8 @@ function ReviewDetailRow({
37640
38005
  value,
37641
38006
  tooltip
37642
38007
  }) {
37643
- const iconRef = useRef17(null);
37644
- const [tipPos, setTipPos] = useState31(null);
38008
+ const iconRef = useRef18(null);
38009
+ const [tipPos, setTipPos] = useState32(null);
37645
38010
  const handleMouseEnter = () => {
37646
38011
  if (!tooltip || !iconRef.current) return;
37647
38012
  const r = iconRef.current.getBoundingClientRect();
@@ -37929,6 +38294,7 @@ var init_SwapMode = __esm({
37929
38294
  init_mapError();
37930
38295
  init_components();
37931
38296
  init_registryClient();
38297
+ init_routes();
37932
38298
  init_useThemePreference();
37933
38299
  init_useWalletSessionState();
37934
38300
  init_useWalletTokenState();
@@ -37975,14 +38341,14 @@ var init_swap = __esm({
37975
38341
 
37976
38342
  // src/widget/TrustwareWidgetV2.tsx
37977
38343
  import {
37978
- useState as useState32,
37979
- useEffect as useEffect32,
37980
- useRef as useRef18,
38344
+ useState as useState33,
38345
+ useEffect as useEffect33,
38346
+ useRef as useRef19,
37981
38347
  useCallback as useCallback23,
37982
38348
  useImperativeHandle,
37983
38349
  forwardRef
37984
38350
  } from "react";
37985
- import { Fragment as Fragment10, jsx as jsx58, jsxs as jsxs46 } from "react/jsx-runtime";
38351
+ import { Fragment as Fragment11, jsx as jsx58, jsxs as jsxs46 } from "react/jsx-runtime";
37986
38352
  function WidgetContent({
37987
38353
  style,
37988
38354
  onStateChange,
@@ -37993,7 +38359,7 @@ function WidgetContent({
37993
38359
  const { transactionHash, transactionStatus } = useDepositTransaction();
37994
38360
  const { resolvedTheme, toggleTheme } = useDepositUi();
37995
38361
  useWalletExternalDisconnect(() => setCurrentStep("home"));
37996
- useEffect32(() => {
38362
+ useEffect33(() => {
37997
38363
  const state = {
37998
38364
  currentStep,
37999
38365
  amount,
@@ -38036,7 +38402,7 @@ function WidgetInner({
38036
38402
  const { transactionStatus } = useDepositTransaction();
38037
38403
  const { resolvedTheme } = useDepositUi();
38038
38404
  const { status, revalidate, errors } = useTrustware();
38039
- const [showConfirmDialog, setShowConfirmDialog] = useState32(false);
38405
+ const [showConfirmDialog, setShowConfirmDialog] = useState33(false);
38040
38406
  const handleCloseRequest = useCallback23(() => {
38041
38407
  if (ACTIVE_TRANSACTION_STATUSES.includes(transactionStatus)) {
38042
38408
  setShowConfirmDialog(true);
@@ -38048,7 +38414,7 @@ function WidgetInner({
38048
38414
  onClose?.();
38049
38415
  }
38050
38416
  }, [transactionStatus, onClose, resetState]);
38051
- useEffect32(() => {
38417
+ useEffect33(() => {
38052
38418
  closeRequestRef.current = handleCloseRequest;
38053
38419
  }, [handleCloseRequest, closeRequestRef]);
38054
38420
  const handleConfirmClose = useCallback23(() => {
@@ -38064,7 +38430,7 @@ function WidgetInner({
38064
38430
  const handleRefresh = useCallback23(() => {
38065
38431
  revalidate?.();
38066
38432
  }, [revalidate]);
38067
- return /* @__PURE__ */ jsxs46(Fragment10, { children: [
38433
+ return /* @__PURE__ */ jsxs46(Fragment11, { children: [
38068
38434
  /* @__PURE__ */ jsxs46(WidgetContainer, { theme: effectiveTheme, style, children: [
38069
38435
  /* @__PURE__ */ jsx58(
38070
38436
  WidgetContent,
@@ -38132,8 +38498,8 @@ var init_TrustwareWidgetV2 = __esm({
38132
38498
  onOpen,
38133
38499
  showThemeToggle = true
38134
38500
  }, ref) {
38135
- const [isOpen, setIsOpen] = useState32(defaultOpen);
38136
- const closeRequestRef = useRef18(null);
38501
+ const [isOpen, setIsOpen] = useState33(defaultOpen);
38502
+ const closeRequestRef = useRef19(null);
38137
38503
  const config = useTrustwareConfig();
38138
38504
  const effectiveInitialStep = initialStep;
38139
38505
  const open = useCallback23(() => {