@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/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.3";
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");
@@ -1007,12 +1012,25 @@ var init_connect = __esm({
1007
1012
  function formatDeepLink(id, currentUrl) {
1008
1013
  const enc = encodeURIComponent(currentUrl);
1009
1014
  switch (id) {
1015
+ // EVM
1010
1016
  case "metamask":
1011
1017
  return `metamask://dapp/${currentUrl}`;
1012
1018
  case "coinbase":
1013
1019
  return `coinbase://wallet/dapp?url=${enc}`;
1014
1020
  case "rainbow":
1015
1021
  return `rainbow://connect?uri=${enc}`;
1022
+ case "trust":
1023
+ return `https://link.trustwallet.com/open_url?coin_id=60&url=${enc}`;
1024
+ case "okx":
1025
+ return `okx://wallet/dapp/url?dappUrl=${enc}`;
1026
+ // Solana
1027
+ case "phantom-solana":
1028
+ return `phantom://browse/${enc}`;
1029
+ case "solflare":
1030
+ return `solflare://ul/v1/browse/${enc}`;
1031
+ case "backpack":
1032
+ return `https://backpack.app/ul/v1/browse/${enc}?ref=${enc}`;
1033
+ // No confirmed deep link scheme
1016
1034
  default:
1017
1035
  return void 0;
1018
1036
  }
@@ -1040,6 +1058,8 @@ var init_metadata = __esm({
1040
1058
  emoji: "\u{1F98A}",
1041
1059
  homepage: "https://metamask.io/",
1042
1060
  chromeWebStore: "https://chromewebstore.google.com/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",
1061
+ ios: "https://apps.apple.com/app/metamask/id1438144202",
1062
+ android: "https://play.google.com/store/apps/details?id=io.metamask",
1043
1063
  detectFlags: ["isMetaMask"],
1044
1064
  deepLink: (url) => formatDeepLink("metamask", url) ?? ""
1045
1065
  },
@@ -1051,6 +1071,8 @@ var init_metadata = __esm({
1051
1071
  logo: `${ASSETS_BASE_URL}/assets/wallets/coinbase.svg`,
1052
1072
  emoji: "\u{1F7E6}",
1053
1073
  homepage: "https://www.coinbase.com/wallet",
1074
+ ios: "https://apps.apple.com/app/coinbase-wallet/id1278383455",
1075
+ android: "https://play.google.com/store/apps/details?id=org.toshi",
1054
1076
  detectFlags: ["isCoinbaseWallet"],
1055
1077
  deepLink: (url) => formatDeepLink("coinbase", url) ?? ""
1056
1078
  },
@@ -1062,6 +1084,7 @@ var init_metadata = __esm({
1062
1084
  logo: `${ASSETS_BASE_URL}/assets/wallets/walletconnect.svg`,
1063
1085
  emoji: "\u{1FA9D}",
1064
1086
  homepage: "https://walletconnect.com/"
1087
+ // No deep link — opens its own modal
1065
1088
  },
1066
1089
  {
1067
1090
  id: "rainbow",
@@ -1071,8 +1094,38 @@ var init_metadata = __esm({
1071
1094
  logo: `${ASSETS_BASE_URL}/assets/wallets/rainbow.svg`,
1072
1095
  emoji: "\u{1F308}",
1073
1096
  homepage: "https://rainbow.me/",
1074
- deepLink: (url) => formatDeepLink("rainbow", url) ?? "",
1075
- detectFlags: ["isRainbow"]
1097
+ ios: "https://apps.apple.com/app/rainbow-ethereum-wallet/id1457119021",
1098
+ android: "https://play.google.com/store/apps/details?id=me.rainbow",
1099
+ detectFlags: ["isRainbow"],
1100
+ deepLink: (url) => formatDeepLink("rainbow", url) ?? ""
1101
+ },
1102
+ {
1103
+ id: "trust",
1104
+ name: "Trust Wallet",
1105
+ category: "app",
1106
+ ecosystem: "multi",
1107
+ logo: `${ASSETS_BASE_URL}/assets/wallets/trust.svg`,
1108
+ emoji: "\u{1F6E1}\uFE0F",
1109
+ homepage: "https://trustwallet.com/",
1110
+ ios: "https://apps.apple.com/app/trust-crypto-bitcoin-wallet/id1288339409",
1111
+ android: "https://play.google.com/store/apps/details?id=com.wallet.crypto.trustapp",
1112
+ detectFlags: ["isTrustWallet"],
1113
+ deepLink: (url) => formatDeepLink("trust", url) ?? ""
1114
+ // ✅ Added
1115
+ },
1116
+ {
1117
+ id: "okx",
1118
+ name: "OKX",
1119
+ category: "injected",
1120
+ ecosystem: "evm",
1121
+ logo: `${ASSETS_BASE_URL}/assets/wallets/okx.svg`,
1122
+ emoji: "\u2B1B",
1123
+ homepage: "https://www.okx.com/web3",
1124
+ ios: "https://apps.apple.com/app/okx-buy-bitcoin-eth-crypto/id1327268470",
1125
+ android: "https://play.google.com/store/apps/details?id=com.okinc.okex.gp",
1126
+ detectFlags: ["isOkxWallet"],
1127
+ deepLink: (url) => formatDeepLink("okx", url) ?? ""
1128
+ // ✅ Added
1076
1129
  },
1077
1130
  {
1078
1131
  id: "phantom-evm",
@@ -1082,7 +1135,10 @@ var init_metadata = __esm({
1082
1135
  logo: `${ASSETS_BASE_URL}/assets/wallets/phantom.svg`,
1083
1136
  emoji: "\u{1F47B}",
1084
1137
  homepage: "https://phantom.app/",
1138
+ ios: "https://apps.apple.com/app/phantom-crypto-wallet/id1598432977",
1139
+ android: "https://play.google.com/store/apps/details?id=app.phantom",
1085
1140
  detectFlags: ["isPhantom"]
1141
+ // No EVM dapp browser deep link — falls back to app store
1086
1142
  },
1087
1143
  {
1088
1144
  id: "phantom-solana",
@@ -1092,18 +1148,9 @@ var init_metadata = __esm({
1092
1148
  logo: `${ASSETS_BASE_URL}/assets/wallets/phantom.svg`,
1093
1149
  emoji: "\u{1F47B}",
1094
1150
  homepage: "https://phantom.app/",
1095
- android: "https://play.google.com/store/apps/details?id=app.phantom",
1096
1151
  ios: "https://apps.apple.com/app/phantom-crypto-wallet/id1598432977",
1097
- deepLink: (url) => `phantom://browse/${encodeURIComponent(url)}`
1098
- },
1099
- {
1100
- id: "metamask-solana",
1101
- name: "MetaMask (Solana)",
1102
- category: "injected",
1103
- ecosystem: "solana",
1104
- logo: `${ASSETS_BASE_URL}/assets/wallets/metamask.svg`,
1105
- emoji: "\u{1F98A}",
1106
- homepage: "https://metamask.io/"
1152
+ android: "https://play.google.com/store/apps/details?id=app.phantom",
1153
+ deepLink: (url) => formatDeepLink("phantom-solana", url) ?? ""
1107
1154
  },
1108
1155
  {
1109
1156
  id: "solflare",
@@ -1113,7 +1160,9 @@ var init_metadata = __esm({
1113
1160
  logo: `${ASSETS_BASE_URL}/assets/wallets/solflare-logo.svg`,
1114
1161
  emoji: "\u2600\uFE0F",
1115
1162
  homepage: "https://solflare.com/",
1116
- deepLink: (url) => `solflare://ul/v1/browse/${encodeURIComponent(url)}`
1163
+ ios: "https://apps.apple.com/app/solflare-solana-wallet/id1580902717",
1164
+ android: "https://play.google.com/store/apps/details?id=com.solflare.mobile",
1165
+ deepLink: (url) => formatDeepLink("solflare", url) ?? ""
1117
1166
  },
1118
1167
  {
1119
1168
  id: "backpack",
@@ -1122,8 +1171,25 @@ var init_metadata = __esm({
1122
1171
  ecosystem: "solana",
1123
1172
  logo: `${ASSETS_BASE_URL}/assets/wallets/backpack-logo.svg`,
1124
1173
  emoji: "\u{1F392}",
1125
- homepage: "https://backpack.app/"
1174
+ homepage: "https://backpack.app/",
1175
+ ios: "https://apps.apple.com/app/backpack-crypto-wallet/id6445964121",
1176
+ android: "https://play.google.com/store/apps/details?id=app.backpack.mobile",
1177
+ deepLink: (url) => formatDeepLink("backpack", url) ?? ""
1178
+ // ✅ Added
1179
+ },
1180
+ {
1181
+ id: "metamask-solana",
1182
+ name: "MetaMask (Solana)",
1183
+ category: "injected",
1184
+ ecosystem: "solana",
1185
+ logo: `${ASSETS_BASE_URL}/assets/wallets/metamask.svg`,
1186
+ emoji: "\u{1F98A}",
1187
+ homepage: "https://metamask.io/",
1188
+ ios: "https://apps.apple.com/app/metamask/id1438144202",
1189
+ android: "https://play.google.com/store/apps/details?id=io.metamask"
1190
+ // No Solana-specific deep link for MetaMask
1126
1191
  },
1192
+ // ── Extension/desktop only — hidden on mobile ─────────────────────────────
1127
1193
  {
1128
1194
  id: "rabby",
1129
1195
  name: "Rabby",
@@ -1134,6 +1200,7 @@ var init_metadata = __esm({
1134
1200
  homepage: "https://rabby.io/",
1135
1201
  chromeWebStore: "https://chromewebstore.google.com/detail/rabby/acmacodkjbdgmoleebolmdjonilkdbch",
1136
1202
  detectFlags: ["isRabby"]
1203
+ // Extension only — no mobile app or deep link
1137
1204
  },
1138
1205
  {
1139
1206
  id: "brave",
@@ -1144,25 +1211,7 @@ var init_metadata = __esm({
1144
1211
  emoji: "\u{1F981}",
1145
1212
  homepage: "https://brave.com/wallet/",
1146
1213
  detectFlags: ["isBraveWallet"]
1147
- },
1148
- {
1149
- id: "okx",
1150
- name: "OKX",
1151
- category: "injected",
1152
- ecosystem: "evm",
1153
- logo: `${ASSETS_BASE_URL}/assets/wallets/okx.svg`,
1154
- emoji: "\u2B1B",
1155
- homepage: "https://www.okx.com/web3",
1156
- detectFlags: ["isOkxWallet"]
1157
- },
1158
- {
1159
- id: "zerion",
1160
- name: "Zerion",
1161
- category: "app",
1162
- ecosystem: "evm",
1163
- logo: `${ASSETS_BASE_URL}/assets/wallets/zerion.png`,
1164
- emoji: "\u{1F9FF}",
1165
- homepage: "https://zerion.io/wallet/"
1214
+ // Built into Brave browser — no standalone deep link
1166
1215
  },
1167
1216
  {
1168
1217
  id: "taho",
@@ -1173,16 +1222,7 @@ var init_metadata = __esm({
1173
1222
  emoji: "\u{1F7EA}",
1174
1223
  homepage: "https://taho.xyz/",
1175
1224
  detectFlags: ["isTally", "isTallyWallet", "isTahoWallet"]
1176
- },
1177
- {
1178
- id: "trust",
1179
- name: "Trust Wallet",
1180
- category: "app",
1181
- ecosystem: "multi",
1182
- logo: `${ASSETS_BASE_URL}/assets/wallets/trust.svg`,
1183
- emoji: "\u{1F6E1}\uFE0F",
1184
- homepage: "https://trustwallet.com/",
1185
- detectFlags: ["isTrustWallet"]
1225
+ // Extension only — no mobile app
1186
1226
  },
1187
1227
  {
1188
1228
  id: "bitget",
@@ -1192,7 +1232,22 @@ var init_metadata = __esm({
1192
1232
  logo: `${ASSETS_BASE_URL}/assets/wallets/bitget.svg`,
1193
1233
  emoji: "\u{1F7E9}",
1194
1234
  homepage: "https://web3.bitget.com/",
1235
+ ios: "https://apps.apple.com/app/bitget-wallet-ex-bitkeep/id1395301115",
1236
+ android: "https://play.google.com/store/apps/details?id=com.bitkeep.wallet",
1195
1237
  detectFlags: ["isBitGetWallet"]
1238
+ // No public deep link scheme documented
1239
+ },
1240
+ {
1241
+ id: "zerion",
1242
+ name: "Zerion",
1243
+ category: "app",
1244
+ ecosystem: "evm",
1245
+ logo: `${ASSETS_BASE_URL}/assets/wallets/zerion.png`,
1246
+ emoji: "\u{1F9FF}",
1247
+ homepage: "https://zerion.io/wallet/",
1248
+ ios: "https://apps.apple.com/app/zerion-crypto-defi-wallet/id1456732565",
1249
+ android: "https://play.google.com/store/apps/details?id=io.zerion.android"
1250
+ // Uses WalletConnect URI — not a simple page URL deep link
1196
1251
  },
1197
1252
  {
1198
1253
  id: "safe",
@@ -1201,7 +1256,10 @@ var init_metadata = __esm({
1201
1256
  ecosystem: "evm",
1202
1257
  logo: `${ASSETS_BASE_URL}/assets/wallets/safe.svg`,
1203
1258
  emoji: "\u{1F7E9}",
1204
- homepage: "https://safe.global/"
1259
+ homepage: "https://safe.global/",
1260
+ ios: "https://apps.apple.com/app/safe-gnosis-safe/id1515759131",
1261
+ android: "https://play.google.com/store/apps/details?id=io.gnosis.safe"
1262
+ // Uses WalletConnect — no dapp browser deep link
1205
1263
  },
1206
1264
  {
1207
1265
  id: "kucoin",
@@ -1210,7 +1268,10 @@ var init_metadata = __esm({
1210
1268
  ecosystem: "evm",
1211
1269
  logo: `${ASSETS_BASE_URL}/assets/wallets/kucoin.svg`,
1212
1270
  emoji: "\u{1F7E6}",
1213
- homepage: "https://www.kucoin.com/"
1271
+ homepage: "https://www.kucoin.com/",
1272
+ ios: "https://apps.apple.com/app/kucoin-buy-bitcoin-crypto/id1378956601",
1273
+ android: "https://play.google.com/store/apps/details?id=com.kubi.kucoin"
1274
+ // No public deep link scheme documented
1214
1275
  }
1215
1276
  ];
1216
1277
  }
@@ -1389,6 +1450,14 @@ function useWalletDetection(timeoutMs = 400) {
1389
1450
  );
1390
1451
  return { detected, detectedIds };
1391
1452
  }
1453
+ function useIsMobile() {
1454
+ const [isMobile, set] = useState(false);
1455
+ useEffect(() => {
1456
+ const ua = navigator.userAgent || "";
1457
+ set(/Android|iPhone|iPad|iPod/i.test(ua));
1458
+ }, []);
1459
+ return isMobile;
1460
+ }
1392
1461
  var WALLET_BY_ID, DETECT_PRIORITY, GENERIC_FLAGS, RDNS_WALLET_MAP, NAME_WALLET_MAP;
1393
1462
  var init_detect = __esm({
1394
1463
  "src/wallets/detect.ts"() {
@@ -4026,6 +4095,7 @@ var init_wallets = __esm({
4026
4095
  init_adapters();
4027
4096
  init_solana();
4028
4097
  init_detect();
4098
+ init_metadata();
4029
4099
  }
4030
4100
  });
4031
4101
 
@@ -4173,11 +4243,6 @@ var init_routes = __esm({
4173
4243
  });
4174
4244
 
4175
4245
  // src/registry.ts
4176
- var registry_exports = {};
4177
- __export(registry_exports, {
4178
- NATIVE: () => NATIVE,
4179
- Registry: () => Registry
4180
- });
4181
4246
  function getChainAliases(chain) {
4182
4247
  const values = [
4183
4248
  chain.chainId,
@@ -4702,7 +4767,7 @@ async function parseStreamingBalances(response, address, options = {}) {
4702
4767
  }
4703
4768
  return stream();
4704
4769
  }
4705
- async function getBalances(chainRef, address) {
4770
+ async function getBalances(chainRef, address, opts) {
4706
4771
  const reg = await ensureRegistry();
4707
4772
  const chain = reg.chain(chainRef);
4708
4773
  if (!chain) return [];
@@ -4717,8 +4782,10 @@ async function getBalances(chainRef, address) {
4717
4782
  chain.nativeCurrency?.decimals ?? "",
4718
4783
  normalizeChainType(chain) ?? ""
4719
4784
  ].join(":");
4720
- const cached = balanceCache.get(cacheKey);
4721
- if (cached) return cached;
4785
+ if (!opts?.forceRefresh) {
4786
+ const cached = balanceCache.get(cacheKey);
4787
+ if (cached) return cached;
4788
+ }
4722
4789
  const url = `${apiBase()}/v1/data/wallets/${encodeURIComponent(chainKey)}/${trimmedAddress}/balances`;
4723
4790
  const response = await fetch(url, {
4724
4791
  method: "GET",
@@ -4804,6 +4871,37 @@ var init_balances = __esm({
4804
4871
  }
4805
4872
  });
4806
4873
 
4874
+ // src/core/registryClient.ts
4875
+ var registryClient_exports = {};
4876
+ __export(registryClient_exports, {
4877
+ getSharedRegistry: () => getSharedRegistry
4878
+ });
4879
+ function registryCacheKey() {
4880
+ const base2 = apiBase();
4881
+ const apiKey = TrustwareConfigStore.peek()?.apiKey ?? "__uninitialized__";
4882
+ return `${base2}::${apiKey}`;
4883
+ }
4884
+ function getSharedRegistry() {
4885
+ const key = registryCacheKey();
4886
+ const existing = registryCache.get(key);
4887
+ if (existing) {
4888
+ return existing;
4889
+ }
4890
+ const registry = new Registry(apiBase());
4891
+ registryCache.set(key, registry);
4892
+ return registry;
4893
+ }
4894
+ var registryCache;
4895
+ var init_registryClient = __esm({
4896
+ "src/core/registryClient.ts"() {
4897
+ "use strict";
4898
+ init_config2();
4899
+ init_registry();
4900
+ init_http();
4901
+ registryCache = /* @__PURE__ */ new Map();
4902
+ }
4903
+ });
4904
+
4807
4905
  // src/core/tx.ts
4808
4906
  import { keccak256 } from "viem";
4809
4907
  function backendChainId(chain, fallback) {
@@ -4876,10 +4974,9 @@ async function sendRouteTransaction(b, fallbackChainId) {
4876
4974
  if (w.ecosystem !== "solana") {
4877
4975
  throw new Error("A Solana wallet is required for this route");
4878
4976
  }
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();
4977
+ const { getSharedRegistry: getSharedRegistry2 } = await Promise.resolve().then(() => (init_registryClient(), registryClient_exports));
4978
+ const registry = getSharedRegistry2();
4979
+ await registry.ensureChainsLoaded();
4883
4980
  const chain = registry.chain(
4884
4981
  String(fallbackChainId ?? txReq.chainId ?? "")
4885
4982
  );
@@ -4893,9 +4990,8 @@ async function sendRouteTransaction(b, fallbackChainId) {
4893
4990
  async function runTopUp(params) {
4894
4991
  const w = walletManager.wallet;
4895
4992
  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());
4993
+ const { getSharedRegistry: getSharedRegistry2 } = await Promise.resolve().then(() => (init_registryClient(), registryClient_exports));
4994
+ const reg = getSharedRegistry2();
4899
4995
  await reg.ensureLoaded();
4900
4996
  const fromAddress = await w.getAddress();
4901
4997
  const currentChainRef = w.ecosystem === "evm" ? String(await w.getChainId()) : await w.getChainKey?.() ?? "solana-mainnet-beta";
@@ -4949,33 +5045,6 @@ var init_tx = __esm({
4949
5045
  }
4950
5046
  });
4951
5047
 
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
5048
  // src/widget/helpers/chainHelpers.ts
4980
5049
  function normalizeChainKey2(id) {
4981
5050
  if (id === void 0 || id === null) return "";
@@ -7180,6 +7249,39 @@ var init_core = __esm({
7180
7249
  getConfig() {
7181
7250
  return TrustwareConfigStore.get();
7182
7251
  },
7252
+ /**
7253
+ * Read the SDK's currently configured theme mode.
7254
+ *
7255
+ * Returns the raw setting — `"light" | "dark" | "system"` — i.e. whatever
7256
+ * was last passed to `init()` or `setTheme()`. When the mode is `"system"`,
7257
+ * the widget resolves the actual light/dark appearance itself (from the OS
7258
+ * `prefers-color-scheme`, or a saved preference if the user has used the
7259
+ * widget's built-in theme toggle), so this getter still reports `"system"`
7260
+ * rather than the resolved value.
7261
+ */
7262
+ getTheme() {
7263
+ return TrustwareConfigStore.get().theme;
7264
+ },
7265
+ /**
7266
+ * Set the widget's theme at runtime.
7267
+ *
7268
+ * Call this from your own app's theme toggle to keep an embedded
7269
+ * `TrustwareWidget` in sync with your UI — no remount required, any
7270
+ * mounted widget picks up the change immediately.
7271
+ *
7272
+ * Passing `"light"` or `"dark"` pins the widget to that mode. Passing
7273
+ * `"system"` makes it follow the OS preference again — unless the user
7274
+ * previously used the widget's own in-widget theme toggle, in which case
7275
+ * their saved choice takes precedence until they toggle it again.
7276
+ *
7277
+ * @example
7278
+ * // In your app's own dark-mode toggle handler:
7279
+ * Trustware.setTheme(isDark ? "dark" : "light");
7280
+ */
7281
+ setTheme(theme) {
7282
+ TrustwareConfigStore.update({ theme });
7283
+ return Trustware;
7284
+ },
7183
7285
  setDestinationAddress(address) {
7184
7286
  const prev = TrustwareConfigStore.get();
7185
7287
  TrustwareConfigStore.update({
@@ -7613,7 +7715,6 @@ function useTrustwareConfig() {
7613
7715
  toToken: "",
7614
7716
  toAddress: void 0,
7615
7717
  defaultSlippage: 1,
7616
- routeType: "swap",
7617
7718
  options: {}
7618
7719
  },
7619
7720
  autoDetectProvider: false,
@@ -9298,8 +9399,8 @@ var init_theme = __esm({
9298
9399
  --tw-accent-foreground: 0 0% 100%;
9299
9400
  --tw-destructive: 0 84% 60%;
9300
9401
  --tw-destructive-foreground: 0 0% 100%;
9301
- --tw-border: 220 13% 91%;
9302
- --tw-input: 220 13% 91%;
9402
+ --tw-border: 220 13% 94%;
9403
+ --tw-input: 220 13% 94%;
9303
9404
  --tw-ring: 217 91% 60%;
9304
9405
  --tw-radius: 1rem;
9305
9406
 
@@ -13731,7 +13832,7 @@ function ChainSelectorPanel({
13731
13832
  paddingTop: spacing[2],
13732
13833
  paddingBottom: spacing[2],
13733
13834
  fontSize: fontSize.sm,
13734
- backgroundColor: colors.muted,
13835
+ backgroundColor: colors.background,
13735
13836
  border: `1px solid ${colors.border}`,
13736
13837
  borderRadius: borderRadius.lg,
13737
13838
  color: colors.foreground,
@@ -13943,7 +14044,7 @@ function TokenSearchInput({
13943
14044
  paddingTop: spacing[2],
13944
14045
  paddingBottom: spacing[2],
13945
14046
  fontSize: fontSize.sm,
13946
- backgroundColor: colors.muted,
14047
+ backgroundColor: colors.background,
13947
14048
  border: `1px solid ${colors.border}`,
13948
14049
  borderRadius: borderRadius.lg,
13949
14050
  color: colors.foreground,
@@ -16071,8 +16172,9 @@ var init_WalletNamespaceTabs = __esm({
16071
16172
  });
16072
16173
 
16073
16174
  // src/widget/features/wallet/components/CryptoWalletDropdownContent.tsx
16074
- import { jsx as jsx36, jsxs as jsxs30 } from "react/jsx-runtime";
16075
- function CryptoWalletDropdownContent({
16175
+ import { useEffect as useEffect23, useMemo as useMemo17, useRef as useRef10, useState as useState23 } from "react";
16176
+ import { Fragment as Fragment7, jsx as jsx36, jsxs as jsxs30 } from "react/jsx-runtime";
16177
+ function DesktopWalletDropdownContent({
16076
16178
  browserWallets,
16077
16179
  handleWalletConnect,
16078
16180
  handleWalletSelect
@@ -16136,6 +16238,262 @@ function CryptoWalletDropdownContent({
16136
16238
  }
16137
16239
  );
16138
16240
  }
16241
+ function MobileWalletDropdownContent({
16242
+ handleWalletConnect
16243
+ }) {
16244
+ const { setCurrentStep } = useDepositNavigation();
16245
+ const { selectedNamespace } = useDepositWallet();
16246
+ const { walletMetaId, isConnected, status } = useWalletInfo();
16247
+ const [hoveredId, setHoveredId] = useState23(null);
16248
+ const storeFallbackTimeoutRef = useRef10(
16249
+ null
16250
+ );
16251
+ useEffect23(() => {
16252
+ return () => {
16253
+ if (storeFallbackTimeoutRef.current !== null) {
16254
+ clearTimeout(storeFallbackTimeoutRef.current);
16255
+ }
16256
+ };
16257
+ }, []);
16258
+ const connectedWalletId = isConnected ? walletMetaId : null;
16259
+ const currentUrl = window.location.href;
16260
+ const mobileWallets = useMemo17(
16261
+ () => WALLETS.filter((w) => {
16262
+ if (w.id === "walletconnect") return true;
16263
+ const hasMobileLink = Boolean(w.deepLink || w.ios || w.android);
16264
+ if (!hasMobileLink) return false;
16265
+ return w.ecosystem.trim().toLowerCase() === "multi" || w.ecosystem.trim().toLowerCase() === selectedNamespace.trim().toLowerCase();
16266
+ }),
16267
+ [selectedNamespace]
16268
+ );
16269
+ const handleWalletSelect = (wallet) => {
16270
+ if (wallet.id === "walletconnect") {
16271
+ handleWalletConnect();
16272
+ return;
16273
+ }
16274
+ if (wallet.deepLink) {
16275
+ const deepLinkUrl = wallet.deepLink(currentUrl);
16276
+ if (deepLinkUrl) {
16277
+ window.location.assign(deepLinkUrl);
16278
+ if (storeFallbackTimeoutRef.current !== null) {
16279
+ clearTimeout(storeFallbackTimeoutRef.current);
16280
+ }
16281
+ storeFallbackTimeoutRef.current = setTimeout(() => {
16282
+ storeFallbackTimeoutRef.current = null;
16283
+ const isIos2 = /iPhone|iPad/i.test(navigator.userAgent);
16284
+ const storeUrl2 = isIos2 ? wallet.ios : wallet.android;
16285
+ if (storeUrl2) window.location.assign(storeUrl2);
16286
+ }, 1500);
16287
+ return;
16288
+ }
16289
+ }
16290
+ const isIos = /iPhone|iPad/i.test(navigator.userAgent);
16291
+ const storeUrl = isIos ? wallet.ios : wallet.android;
16292
+ if (storeUrl) window.location.assign(storeUrl);
16293
+ };
16294
+ const handleContinue = () => {
16295
+ if (isConnected && status === "connected") {
16296
+ setCurrentStep("crypto-pay");
16297
+ } else {
16298
+ alert("Please connect your wallet first.");
16299
+ }
16300
+ };
16301
+ const showContinueButton = useMemo17(
16302
+ () => isConnected && status === "connected",
16303
+ [isConnected, status]
16304
+ );
16305
+ return /* @__PURE__ */ jsxs30(
16306
+ "div",
16307
+ {
16308
+ style: {
16309
+ ...dropdownSurfaceStyle,
16310
+ maxHeight: "16rem",
16311
+ backgroundColor: colors.card,
16312
+ borderRadius: borderRadius.xl,
16313
+ boxShadow: shadows.large,
16314
+ border: `1px solid rgba(63, 63, 70, 0.5)`,
16315
+ zIndex: 100,
16316
+ overflow: "hidden",
16317
+ // changed from auto
16318
+ animation: "tw-fade-in 0.2s ease-out",
16319
+ display: "flex",
16320
+ flexDirection: "column"
16321
+ },
16322
+ children: [
16323
+ /* @__PURE__ */ jsx36(
16324
+ "div",
16325
+ {
16326
+ style: {
16327
+ width: "100%",
16328
+ padding: spacing[2]
16329
+ },
16330
+ children: /* @__PURE__ */ jsx36("div", { style: { display: "flex", gap: spacing[2] }, children: /* @__PURE__ */ jsx36(WalletNamespaceTabs, { showBitcoin: false }) })
16331
+ }
16332
+ ),
16333
+ /* @__PURE__ */ jsx36(
16334
+ "div",
16335
+ {
16336
+ style: {
16337
+ padding: spacing[3],
16338
+ overflowY: "auto",
16339
+ flex: 1,
16340
+ scrollbarWidth: "thin",
16341
+ scrollbarColor: `${colors.muted} transparent`
16342
+ },
16343
+ children: mobileWallets.map((wallet) => {
16344
+ const isConnectedWallet = wallet.id === connectedWalletId;
16345
+ const isDisabled = isConnected && !isConnectedWallet;
16346
+ const isHovered = hoveredId === wallet.id;
16347
+ return /* @__PURE__ */ jsxs30(
16348
+ "button",
16349
+ {
16350
+ type: "button",
16351
+ onClick: () => !isDisabled && handleWalletSelect(wallet),
16352
+ onMouseEnter: () => !isDisabled && setHoveredId(wallet.id),
16353
+ onMouseLeave: () => setHoveredId(null),
16354
+ style: {
16355
+ width: "100%",
16356
+ display: "flex",
16357
+ alignItems: "center",
16358
+ justifyContent: "space-between",
16359
+ padding: spacing[2],
16360
+ borderRadius: borderRadius.lg,
16361
+ transition: "background-color 0.2s",
16362
+ border: "none",
16363
+ backgroundColor: isHovered ? "rgba(255,255,255,0.06)" : "transparent",
16364
+ cursor: isDisabled ? "not-allowed" : "pointer",
16365
+ opacity: isDisabled ? 0.4 : 1,
16366
+ fontFamily: "inherit",
16367
+ fontSize: fontSize.sm,
16368
+ outline: "none"
16369
+ },
16370
+ children: [
16371
+ /* @__PURE__ */ jsxs30(
16372
+ "div",
16373
+ {
16374
+ style: {
16375
+ display: "flex",
16376
+ alignItems: "center",
16377
+ gap: spacing[2]
16378
+ },
16379
+ children: [
16380
+ /* @__PURE__ */ jsx36(
16381
+ "img",
16382
+ {
16383
+ src: wallet.logo ?? wallet.emoji,
16384
+ alt: wallet.name,
16385
+ style: {
16386
+ width: "2rem",
16387
+ height: "2rem",
16388
+ borderRadius: borderRadius.lg,
16389
+ objectFit: "cover"
16390
+ }
16391
+ }
16392
+ ),
16393
+ /* @__PURE__ */ jsx36(
16394
+ "span",
16395
+ {
16396
+ style: {
16397
+ fontWeight: fontWeight.medium,
16398
+ fontSize: fontSize.sm,
16399
+ color: colors.foreground
16400
+ },
16401
+ children: wallet.name
16402
+ }
16403
+ )
16404
+ ]
16405
+ }
16406
+ ),
16407
+ isConnectedWallet && /* @__PURE__ */ jsxs30(
16408
+ "div",
16409
+ {
16410
+ style: {
16411
+ display: "flex",
16412
+ alignItems: "center",
16413
+ gap: spacing[1]
16414
+ },
16415
+ children: [
16416
+ /* @__PURE__ */ jsx36(
16417
+ "div",
16418
+ {
16419
+ style: {
16420
+ width: "0.5rem",
16421
+ height: "0.5rem",
16422
+ borderRadius: "50%",
16423
+ backgroundColor: "#22c55e"
16424
+ }
16425
+ }
16426
+ ),
16427
+ /* @__PURE__ */ jsx36("span", { style: { fontSize: fontSize.xs, color: "#22c55e" }, children: "Connected" })
16428
+ ]
16429
+ }
16430
+ )
16431
+ ]
16432
+ },
16433
+ wallet.id
16434
+ );
16435
+ })
16436
+ }
16437
+ ),
16438
+ showContinueButton && /* @__PURE__ */ jsx36(
16439
+ "div",
16440
+ {
16441
+ style: {
16442
+ padding: spacing[3],
16443
+ borderTop: `1px solid rgba(63, 63, 70, 0.5)`,
16444
+ backgroundColor: colors.card
16445
+ },
16446
+ children: /* @__PURE__ */ jsx36(
16447
+ "button",
16448
+ {
16449
+ onClick: handleContinue,
16450
+ style: {
16451
+ width: "100%",
16452
+ padding: `${spacing[2]} ${spacing[3]}`,
16453
+ borderRadius: borderRadius.lg,
16454
+ border: "none",
16455
+ backgroundColor: colors.primary,
16456
+ color: "#fff",
16457
+ fontFamily: "inherit",
16458
+ fontSize: fontSize.sm,
16459
+ fontWeight: fontWeight.medium,
16460
+ cursor: "pointer",
16461
+ transition: "opacity 0.2s"
16462
+ },
16463
+ onMouseEnter: (e2) => e2.currentTarget.style.opacity = "0.85",
16464
+ onMouseLeave: (e2) => e2.currentTarget.style.opacity = "1",
16465
+ children: "Continue \u2192"
16466
+ }
16467
+ )
16468
+ }
16469
+ )
16470
+ ]
16471
+ }
16472
+ );
16473
+ }
16474
+ function CryptoWalletDropdownContent({
16475
+ browserWallets,
16476
+ handleWalletConnect,
16477
+ handleWalletSelect
16478
+ }) {
16479
+ const isMobile = useIsMobile();
16480
+ return /* @__PURE__ */ jsxs30(Fragment7, { children: [
16481
+ !isMobile && /* @__PURE__ */ jsx36(
16482
+ DesktopWalletDropdownContent,
16483
+ {
16484
+ browserWallets,
16485
+ handleWalletConnect,
16486
+ handleWalletSelect
16487
+ }
16488
+ ),
16489
+ isMobile && /* @__PURE__ */ jsx36(
16490
+ MobileWalletDropdownContent,
16491
+ {
16492
+ handleWalletConnect
16493
+ }
16494
+ )
16495
+ ] });
16496
+ }
16139
16497
  var init_CryptoWalletDropdownContent = __esm({
16140
16498
  "src/widget/features/wallet/components/CryptoWalletDropdownContent.tsx"() {
16141
16499
  "use strict";
@@ -16146,6 +16504,7 @@ var init_CryptoWalletDropdownContent = __esm({
16146
16504
  init_paymentOptionStyles();
16147
16505
  init_WalletNamespaceTabs();
16148
16506
  init_DepositContext();
16507
+ init_wallets();
16149
16508
  }
16150
16509
  });
16151
16510
 
@@ -16600,7 +16959,7 @@ var init_HomePaymentOptions = __esm({
16600
16959
  });
16601
16960
 
16602
16961
  // src/widget/features/wallet/hooks/useHomeWalletActions.ts
16603
- import { useCallback as useCallback18, useEffect as useEffect23, useMemo as useMemo17, useRef as useRef10, useState as useState23 } from "react";
16962
+ import { useCallback as useCallback18, useEffect as useEffect24, useMemo as useMemo18, useRef as useRef11, useState as useState24 } from "react";
16604
16963
  function useHomeWalletActions({
16605
16964
  connectWallet,
16606
16965
  detectedWallets,
@@ -16609,12 +16968,12 @@ function useHomeWalletActions({
16609
16968
  WalletConnect
16610
16969
  // setCurrentStepInternal,
16611
16970
  }) {
16612
- const [isCryptoDropdownOpen, setIsCryptoDropdownOpen] = useState23(false);
16613
- const [isFiatDropdownOpen, setIsFiatDropdownOpen] = useState23(false);
16614
- const cryptoDropdownRef = useRef10(null);
16615
- const fiatDropdownRef = useRef10(null);
16971
+ const [isCryptoDropdownOpen, setIsCryptoDropdownOpen] = useState24(false);
16972
+ const [isFiatDropdownOpen, setIsFiatDropdownOpen] = useState24(false);
16973
+ const cryptoDropdownRef = useRef11(null);
16974
+ const fiatDropdownRef = useRef11(null);
16616
16975
  const { disconnect } = useWalletInfo();
16617
- useEffect23(() => {
16976
+ useEffect24(() => {
16618
16977
  const handleClickOutside = (event) => {
16619
16978
  if (cryptoDropdownRef.current && !cryptoDropdownRef.current.contains(event.target)) {
16620
16979
  setIsCryptoDropdownOpen(false);
@@ -16640,6 +16999,7 @@ function useHomeWalletActions({
16640
16999
  setWalletType("other");
16641
17000
  const { error } = await connectWallet(wallet);
16642
17001
  if (error) {
17002
+ console.error("Wallet connection error:", error);
16643
17003
  resetNavigation();
16644
17004
  return;
16645
17005
  }
@@ -16661,7 +17021,7 @@ function useHomeWalletActions({
16661
17021
  WalletConnect().catch(() => resetNavigation());
16662
17022
  }, [setYourWalletTokens, disconnect]);
16663
17023
  const { selectedNamespace } = useDepositWallet();
16664
- const browserWallets = useMemo17(() => {
17024
+ const browserWallets = useMemo18(() => {
16665
17025
  if (!detectedWallets?.length) return [];
16666
17026
  return detectedWallets.filter(
16667
17027
  (wallet) => wallet?.meta?.id !== "walletconnect" && wallet?.meta?.ecosystem.trim().toLowerCase() === selectedNamespace.trim().toLowerCase()
@@ -17073,7 +17433,7 @@ var init_relayFeeUtils = __esm({
17073
17433
  });
17074
17434
 
17075
17435
  // src/widget/features/route-preview/hooks/useRoutePreviewModel.ts
17076
- import { useMemo as useMemo18 } from "react";
17436
+ import { useMemo as useMemo19 } from "react";
17077
17437
  function useRoutePreviewModel({
17078
17438
  amountUsd,
17079
17439
  amountValidationError,
@@ -17086,7 +17446,7 @@ function useRoutePreviewModel({
17086
17446
  walletAddress
17087
17447
  }) {
17088
17448
  const { chains } = useChains();
17089
- const destinationConfig = useMemo18(
17449
+ const destinationConfig = useMemo19(
17090
17450
  () => ({
17091
17451
  dappName: config.messages?.title || "DApp",
17092
17452
  toChain: config.routes.toChain,
@@ -17100,7 +17460,7 @@ function useRoutePreviewModel({
17100
17460
  config.routes.toToken
17101
17461
  ]
17102
17462
  );
17103
- const routeConfig = useMemo18(() => {
17463
+ const routeConfig = useMemo19(() => {
17104
17464
  const toChainId = config.routes.toChain;
17105
17465
  const toChainKey = normalizeChainKey2(toChainId);
17106
17466
  const toChain = toChainKey ? chains.find(
@@ -17137,7 +17497,7 @@ function useRoutePreviewModel({
17137
17497
  ...routeConfig,
17138
17498
  enabled: !!isReady
17139
17499
  });
17140
- const routePrerequisiteError = useMemo18(() => {
17500
+ const routePrerequisiteError = useMemo19(() => {
17141
17501
  if (!isReady) return;
17142
17502
  if (!selectedChain) {
17143
17503
  return "Select a source chain to fetch a route.";
@@ -30719,7 +31079,7 @@ var init_smart_account2 = __esm({
30719
31079
  });
30720
31080
 
30721
31081
  // src/widget/features/transaction/hooks/useTransactionActionModel.ts
30722
- import { useCallback as useCallback19, useEffect as useEffect24, useMemo as useMemo19, useRef as useRef11, useState as useState24 } from "react";
31082
+ import { useCallback as useCallback19, useEffect as useEffect25, useMemo as useMemo20, useRef as useRef12, useState as useState25 } from "react";
30723
31083
  import { encodeFunctionData as encodeFunctionData8, erc20Abi } from "viem";
30724
31084
  function normalizeTokenAddressForCompare(chain, addr) {
30725
31085
  const chainType = (chain.type ?? chain.chainType ?? "").toLowerCase();
@@ -30741,7 +31101,7 @@ function useTransactionActionModel({
30741
31101
  walletAddress,
30742
31102
  walletStatus
30743
31103
  }) {
30744
- const feeDataCacheRef = useRef11({});
31104
+ const feeDataCacheRef = useRef12({});
30745
31105
  const { isSubmitting, submitTransaction } = useTransactionSubmit();
30746
31106
  const { trackEvent } = useGTM(GTM_ID);
30747
31107
  const destinationConfig = (() => {
@@ -30754,7 +31114,7 @@ function useTransactionActionModel({
30754
31114
  const chainType = selectedChain?.type ?? selectedChain?.chainType;
30755
31115
  const chainTypeNormalized = (chainType ?? "").toLowerCase();
30756
31116
  const isEvm = chainTypeNormalized === "evm";
30757
- const backendChainId2 = useMemo19(() => {
31117
+ const backendChainId2 = useMemo20(() => {
30758
31118
  const chainRef = routeResult?.txReq?.chainId ?? selectedChain?.networkIdentifier ?? selectedChain?.chainId ?? selectedChain?.id;
30759
31119
  if (chainRef == null) return null;
30760
31120
  return String(chainRef);
@@ -30764,7 +31124,7 @@ function useTransactionActionModel({
30764
31124
  selectedChain?.id,
30765
31125
  selectedChain?.networkIdentifier
30766
31126
  ]);
30767
- const selectedTokenOnBackendChain = useMemo19(() => {
31127
+ const selectedTokenOnBackendChain = useMemo20(() => {
30768
31128
  if (!backendChainId2) return false;
30769
31129
  const target = normalizeChainKey2(backendChainId2);
30770
31130
  return [
@@ -30781,22 +31141,22 @@ function useTransactionActionModel({
30781
31141
  selectedChain?.id,
30782
31142
  selectedChain?.networkIdentifier
30783
31143
  ]);
30784
- const isNativeSelected = useMemo19(() => {
31144
+ const isNativeSelected = useMemo20(() => {
30785
31145
  const address = selectedToken?.address;
30786
31146
  return isNativeTokenAddress(address, chainType) || isZeroAddrLike(address, chainType) || normalizeTokenAddressForCompare(selectedChain, address) === normalizeTokenAddressForCompare(
30787
31147
  selectedChain,
30788
31148
  getNativeTokenAddress2(chainType)
30789
31149
  );
30790
31150
  }, [chainType, selectedChain, selectedToken?.address]);
30791
- const spender = useMemo19(() => {
31151
+ const spender = useMemo20(() => {
30792
31152
  const txReq = routeResult?.txReq;
30793
31153
  const addr = txReq?.to ?? txReq?.target;
30794
31154
  return addr ?? null;
30795
31155
  }, [routeResult?.txReq]);
30796
- const [allowanceWei, setAllowanceWei] = useState24(0n);
30797
- const [isReadingAllowance, setIsReadingAllowance] = useState24(false);
30798
- const [isApproving, setIsApproving] = useState24(false);
30799
- const [gasReservationWei, setGasReservationWei] = useState24(0n);
31156
+ const [allowanceWei, setAllowanceWei] = useState25(0n);
31157
+ const [isReadingAllowance, setIsReadingAllowance] = useState25(false);
31158
+ const [isApproving, setIsApproving] = useState25(false);
31159
+ const [gasReservationWei, setGasReservationWei] = useState25(0n);
30800
31160
  const readAllowance = useCallback19(async () => {
30801
31161
  if (!isEvm || isNativeSelected || !!routeResult?.sponsorship || // sponsored routes: SA approves bridge inside the UO batch
30802
31162
  !backendChainId2 || !selectedTokenOnBackendChain || !walletAddress || !spender || !selectedToken?.address) {
@@ -30827,7 +31187,7 @@ function useTransactionActionModel({
30827
31187
  spender,
30828
31188
  walletAddress
30829
31189
  ]);
30830
- useEffect24(() => {
31190
+ useEffect25(() => {
30831
31191
  void readAllowance();
30832
31192
  }, [readAllowance]);
30833
31193
  const needsApproval = isEvm && !isNativeSelected && !routeResult?.sponsorship && // sponsored routes use Permit2 + SA internal batch — no EOA bridge approval
@@ -31031,13 +31391,13 @@ function useTransactionActionModel({
31031
31391
  routeResult?.txReq,
31032
31392
  walletAddress
31033
31393
  ]);
31034
- useEffect24(() => {
31394
+ useEffect25(() => {
31035
31395
  if (routeResult) {
31036
31396
  void estimateGasReservationWei();
31037
31397
  }
31038
31398
  }, [estimateGasReservationWei, routeResult]);
31039
- const [smartAccountFailed, setSmartAccountFailed] = useState24(false);
31040
- useEffect24(() => {
31399
+ const [smartAccountFailed, setSmartAccountFailed] = useState25(false);
31400
+ useEffect25(() => {
31041
31401
  setSmartAccountFailed(false);
31042
31402
  }, [routeResult?.intentId]);
31043
31403
  const handleConfirm = useCallback19(async () => {
@@ -31141,7 +31501,7 @@ function useTransactionActionModel({
31141
31501
  ]);
31142
31502
  const isWalletConnected = walletStatus === "connected";
31143
31503
  const canSwipe = parsedAmount > 0 && !!selectedToken && isWalletConnected && !isLoadingRoute && !isSubmitting && !!routeResult && !actionErrorMessage && !isApproving && !isReadingAllowance;
31144
- const swipeResetKey = useMemo19(() => {
31504
+ const swipeResetKey = useMemo20(() => {
31145
31505
  const tokenAddress = selectedToken ? normalizeAddress2(
31146
31506
  selectedToken.address,
31147
31507
  selectedToken?.chainData?.type ?? selectedToken?.chainData?.chainType
@@ -31371,12 +31731,12 @@ var init_DefaultCryptoPay = __esm({
31371
31731
  });
31372
31732
 
31373
31733
  // src/widget/pages/CryptoPay/RouteQuoteLoader.tsx
31374
- import { useState as useState25, useEffect as useEffect25 } from "react";
31734
+ import { useState as useState26, useEffect as useEffect26 } from "react";
31375
31735
  import { jsx as jsx49, jsxs as jsxs39 } from "react/jsx-runtime";
31376
31736
  function RouteQuoteLoader({ selectedToken }) {
31377
- const [messageIndex, setMessageIndex] = useState25(0);
31378
- const [visible, setVisible] = useState25(true);
31379
- useEffect25(() => {
31737
+ const [messageIndex, setMessageIndex] = useState26(0);
31738
+ const [visible, setVisible] = useState26(true);
31739
+ useEffect26(() => {
31380
31740
  let t = null;
31381
31741
  const interval = setInterval(() => {
31382
31742
  setVisible(false);
@@ -31552,8 +31912,8 @@ var init_RouteQuoteLoader = __esm({
31552
31912
  });
31553
31913
 
31554
31914
  // src/widget/pages/CryptoPay/index.tsx
31555
- import { useEffect as useEffect26, useMemo as useMemo20 } from "react";
31556
- import { Fragment as Fragment7, jsx as jsx50, jsxs as jsxs40 } from "react/jsx-runtime";
31915
+ import { useEffect as useEffect27, useMemo as useMemo21 } from "react";
31916
+ import { Fragment as Fragment8, jsx as jsx50, jsxs as jsxs40 } from "react/jsx-runtime";
31557
31917
  function CryptoPay({ style: _style }) {
31558
31918
  const {
31559
31919
  amount,
@@ -31576,17 +31936,17 @@ function CryptoPay({ style: _style }) {
31576
31936
  const { goBack, setCurrentStep, currentStep } = useDepositNavigation();
31577
31937
  const config = useTrustwareConfig();
31578
31938
  const { fixedFromAmountString, isFixedAmount, minAmountUsd, maxAmountUsd } = useAmountConstraints();
31579
- const routeRefreshMs = useMemo20(() => {
31939
+ const routeRefreshMs = useMemo21(() => {
31580
31940
  const raw = config.routes?.options?.routeRefreshMs;
31581
31941
  const n = Number(raw);
31582
31942
  return Number.isFinite(n) && n > 0 ? n : void 0;
31583
31943
  }, [config.routes?.options?.routeRefreshMs]);
31584
31944
  const IsPos = (x) => x !== null && x !== void 0 && x.balance !== "0";
31585
- const showDefaultCryptoPay = useMemo20(() => {
31945
+ const showDefaultCryptoPay = useMemo21(() => {
31586
31946
  const nonZer0Tks = (yourWalletTokens ?? []).filter(IsPos);
31587
31947
  return !yourWalletTokensLoading && nonZer0Tks.length === 0 && yourWalletTokens.length > 0;
31588
31948
  }, [yourWalletTokens, yourWalletTokensLoading]);
31589
- const showSkeleton = useMemo20(() => {
31949
+ const showSkeleton = useMemo21(() => {
31590
31950
  return (yourWalletTokens ?? []).length === 0;
31591
31951
  }, [yourWalletTokens]);
31592
31952
  const isReady = selectedToken != null && selectedToken?.chainData !== void 0 && !showDefaultCryptoPay && !showSkeleton;
@@ -31662,7 +32022,7 @@ function CryptoPay({ style: _style }) {
31662
32022
  });
31663
32023
  const { emitError } = useTrustware();
31664
32024
  const readySelectedToken = isReady ? selectedToken : null;
31665
- useEffect26(() => {
32025
+ useEffect27(() => {
31666
32026
  if (currentStep !== "crypto-pay" || !actionErrorMessage) return;
31667
32027
  emitError?.(
31668
32028
  new TrustwareError({
@@ -31691,7 +32051,7 @@ function CryptoPay({ style: _style }) {
31691
32051
  if (isFixedAmount) return;
31692
32052
  setAmount(value.toString());
31693
32053
  };
31694
- const relayFeeUsd = useMemo20(
32054
+ const relayFeeUsd = useMemo21(
31695
32055
  () => computeRelayFeeUsd(routeResult, isNativeSelected),
31696
32056
  [isNativeSelected, routeResult]
31697
32057
  );
@@ -31792,7 +32152,7 @@ function CryptoPay({ style: _style }) {
31792
32152
  ]
31793
32153
  }
31794
32154
  ),
31795
- showSkeleton ? /* @__PURE__ */ jsx50(Fragment7, { children: /* @__PURE__ */ jsx50(
32155
+ showSkeleton ? /* @__PURE__ */ jsx50(Fragment8, { children: /* @__PURE__ */ jsx50(
31796
32156
  "div",
31797
32157
  {
31798
32158
  style: {
@@ -31803,8 +32163,8 @@ function CryptoPay({ style: _style }) {
31803
32163
  },
31804
32164
  children: /* @__PURE__ */ jsx50(LoadingSkeleton, {})
31805
32165
  }
31806
- ) }) : /* @__PURE__ */ jsxs40(Fragment7, { children: [
31807
- isReady && /* @__PURE__ */ jsx50(Fragment7, { children: isLoadingRoute && !routeResult ? /* @__PURE__ */ jsx50(RouteQuoteLoader, { selectedToken: readySelectedToken }) : /* @__PURE__ */ jsxs40(Fragment7, { children: [
32166
+ ) }) : /* @__PURE__ */ jsxs40(Fragment8, { children: [
32167
+ isReady && /* @__PURE__ */ jsx50(Fragment8, { children: isLoadingRoute && !routeResult ? /* @__PURE__ */ jsx50(RouteQuoteLoader, { selectedToken: readySelectedToken }) : /* @__PURE__ */ jsxs40(Fragment8, { children: [
31808
32168
  /* @__PURE__ */ jsx50(
31809
32169
  CryptoPayAmountSection,
31810
32170
  {
@@ -31883,7 +32243,7 @@ var init_CryptoPay = __esm({
31883
32243
  });
31884
32244
 
31885
32245
  // src/widget/pages/Processing.tsx
31886
- import { useEffect as useEffect27, useMemo as useMemo21, useRef as useRef12 } from "react";
32246
+ import { useEffect as useEffect28, useMemo as useMemo22, useRef as useRef13 } from "react";
31887
32247
  import { jsx as jsx51, jsxs as jsxs41 } from "react/jsx-runtime";
31888
32248
  function getProgressFromStatus(status) {
31889
32249
  switch (status) {
@@ -31922,27 +32282,27 @@ function Processing({ style }) {
31922
32282
  const { resetState, setCurrentStep } = useDepositNavigation();
31923
32283
  const { transactionStatus, transactionHash, intentId } = useDepositTransaction();
31924
32284
  const { transaction, startPolling, isPolling } = useTransactionPolling();
31925
- const hasStartedPolling = useRef12(false);
31926
- useEffect27(() => {
32285
+ const hasStartedPolling = useRef13(false);
32286
+ useEffect28(() => {
31927
32287
  return () => {
31928
32288
  hasStartedPolling.current = false;
31929
32289
  };
31930
32290
  }, []);
31931
- useEffect27(() => {
32291
+ useEffect28(() => {
31932
32292
  if (intentId && transactionHash && !isPolling && !hasStartedPolling.current && transactionStatus !== "success" && transactionStatus !== "error") {
31933
32293
  hasStartedPolling.current = true;
31934
32294
  startPolling(intentId, transactionHash);
31935
32295
  }
31936
32296
  }, [intentId, transactionHash, isPolling, transactionStatus, startPolling]);
31937
- const progress = useMemo21(
32297
+ const progress = useMemo22(
31938
32298
  () => getProgressFromStatus(transactionStatus),
31939
32299
  [transactionStatus]
31940
32300
  );
31941
- const stepText = useMemo21(
32301
+ const stepText = useMemo22(
31942
32302
  () => getStepText(transactionStatus),
31943
32303
  [transactionStatus]
31944
32304
  );
31945
- const explorerUrl = useMemo21(() => {
32305
+ const explorerUrl = useMemo22(() => {
31946
32306
  if (transaction?.fromChainTxUrl) {
31947
32307
  return transaction.fromChainTxUrl;
31948
32308
  }
@@ -32088,15 +32448,15 @@ var init_Processing = __esm({
32088
32448
  });
32089
32449
 
32090
32450
  // src/widget/pages/Success.tsx
32091
- import { lazy, Suspense, useMemo as useMemo22 } from "react";
32451
+ import { lazy, Suspense, useMemo as useMemo23 } from "react";
32092
32452
  import { jsx as jsx52, jsxs as jsxs42 } from "react/jsx-runtime";
32093
32453
  function Success({ style }) {
32094
32454
  const { selectedToken, selectedChain, amount } = useDepositForm();
32095
32455
  const { resetState } = useDepositNavigation();
32096
32456
  const { transactionHash } = useDepositTransaction();
32097
32457
  const { transaction } = useTransactionPolling();
32098
- const parsedAmount = useMemo22(() => parseFloat(amount) || 0, [amount]);
32099
- const explorerUrl = useMemo22(() => {
32458
+ const parsedAmount = useMemo23(() => parseFloat(amount) || 0, [amount]);
32459
+ const explorerUrl = useMemo23(() => {
32100
32460
  if (transaction?.toChainTxUrl) {
32101
32461
  return transaction.toChainTxUrl;
32102
32462
  }
@@ -32317,7 +32677,7 @@ var init_mapError = __esm({
32317
32677
  });
32318
32678
 
32319
32679
  // src/widget/pages/Error.tsx
32320
- import { useMemo as useMemo23 } from "react";
32680
+ import { useMemo as useMemo24 } from "react";
32321
32681
  import { jsx as jsx53 } from "react/jsx-runtime";
32322
32682
  function Error2({ style: _style }) {
32323
32683
  const { selectedChain } = useDepositForm();
@@ -32328,8 +32688,8 @@ function Error2({ style: _style }) {
32328
32688
  setErrorMessage,
32329
32689
  transactionHash
32330
32690
  } = useDepositTransaction();
32331
- const mapped = useMemo23(() => mapError(errorMessage), [errorMessage]);
32332
- const explorerUrl = useMemo23(() => {
32691
+ const mapped = useMemo24(() => mapError(errorMessage), [errorMessage]);
32692
+ const explorerUrl = useMemo24(() => {
32333
32693
  if (transactionHash && selectedChain?.blockExplorerUrls?.length) {
32334
32694
  return `${selectedChain.blockExplorerUrls[0].replace(/\/+$/, "")}/tx/${transactionHash}`;
32335
32695
  }
@@ -32389,18 +32749,18 @@ var init_widgetSteps = __esm({
32389
32749
  });
32390
32750
 
32391
32751
  // src/widget/app/WidgetRouter.tsx
32392
- import { useMemo as useMemo24 } from "react";
32752
+ import { useMemo as useMemo25 } from "react";
32393
32753
  import { jsx as jsx54 } from "react/jsx-runtime";
32394
32754
  function WidgetRouter({
32395
32755
  currentStep,
32396
32756
  navigationDirection,
32397
32757
  stepHistory
32398
32758
  }) {
32399
- const PageComponent = useMemo24(
32759
+ const PageComponent = useMemo25(
32400
32760
  () => PAGE_COMPONENTS[currentStep],
32401
32761
  [currentStep]
32402
32762
  );
32403
- const animationClass = useMemo24(() => {
32763
+ const animationClass = useMemo25(() => {
32404
32764
  return navigationDirection === "forward" ? "tw-animate-slide-in-right" : "tw-animate-slide-in-left";
32405
32765
  }, [navigationDirection]);
32406
32766
  return /* @__PURE__ */ jsx54(
@@ -32428,14 +32788,14 @@ var init_WidgetRouter = __esm({
32428
32788
  });
32429
32789
 
32430
32790
  // src/modes/swap/hooks/useSwapRoute.ts
32431
- import { useCallback as useCallback20, useRef as useRef13, useState as useState26 } from "react";
32791
+ import { useCallback as useCallback20, useRef as useRef14, useState as useState27 } from "react";
32432
32792
  function useSwapRoute() {
32433
- const [state, setState] = useState26({
32793
+ const [state, setState] = useState27({
32434
32794
  data: null,
32435
32795
  loading: false,
32436
32796
  error: null
32437
32797
  });
32438
- const abortRef = useRef13(false);
32798
+ const abortRef = useRef14(false);
32439
32799
  const fetch2 = useCallback20(
32440
32800
  async (params) => {
32441
32801
  const { fromToken, fromChain, toToken, toChain, amount, walletAddress } = params;
@@ -32494,7 +32854,7 @@ var init_useSwapRoute = __esm({
32494
32854
  });
32495
32855
 
32496
32856
  // src/modes/swap/hooks/useSwapExecution.ts
32497
- import { useCallback as useCallback21, useRef as useRef14, useState as useState27 } from "react";
32857
+ import { useCallback as useCallback21, useRef as useRef15, useState as useState28 } from "react";
32498
32858
  import { encodeFunctionData as encodeFunctionData9, erc20Abi as erc20Abi2 } from "viem";
32499
32859
  function normalizeTx(raw) {
32500
32860
  const r = raw;
@@ -32529,7 +32889,7 @@ async function waitForApprovalConfirmation(chainId, txHash) {
32529
32889
  throw new Error("Timed out waiting for approval confirmation");
32530
32890
  }
32531
32891
  function useSwapExecution(fromChain) {
32532
- const [state, setState] = useState27({
32892
+ const [state, setState] = useState28({
32533
32893
  txStatus: "idle",
32534
32894
  txHash: null,
32535
32895
  intentId: null,
@@ -32538,11 +32898,11 @@ function useSwapExecution(fromChain) {
32538
32898
  isSubmitting: false,
32539
32899
  allowanceStatus: "unknown"
32540
32900
  });
32541
- const saFailedUntilRef = useRef14(0);
32542
- const pollingRef = useRef14(null);
32543
- const timeoutRef = useRef14(null);
32544
- const abortRef = useRef14(false);
32545
- const pollCountRef = useRef14(0);
32901
+ const saFailedUntilRef = useRef15(0);
32902
+ const pollingRef = useRef15(null);
32903
+ const timeoutRef = useRef15(null);
32904
+ const abortRef = useRef15(false);
32905
+ const pollCountRef = useRef15(0);
32546
32906
  const clearPolling = useCallback21(() => {
32547
32907
  abortRef.current = true;
32548
32908
  if (pollingRef.current) clearTimeout(pollingRef.current);
@@ -32905,13 +33265,13 @@ var init_forex = __esm({
32905
33265
  });
32906
33266
 
32907
33267
  // src/modes/swap/hooks/useForex.ts
32908
- import { useEffect as useEffect28, useRef as useRef15, useState as useState28 } from "react";
33268
+ import { useEffect as useEffect29, useRef as useRef16, useState as useState29 } from "react";
32909
33269
  function useForex() {
32910
- const [rates, setRates] = useState28({ USD: 1 });
32911
- const [error, setError] = useState28(null);
32912
- const [lastUpdated, setLastUpdated] = useState28(null);
32913
- const timerRef = useRef15(null);
32914
- useEffect28(() => {
33270
+ const [rates, setRates] = useState29({ USD: 1 });
33271
+ const [error, setError] = useState29(null);
33272
+ const [lastUpdated, setLastUpdated] = useState29(null);
33273
+ const timerRef = useRef16(null);
33274
+ useEffect29(() => {
32915
33275
  let cancelled = false;
32916
33276
  const load = () => {
32917
33277
  fetchForexRates("USD").then((r) => {
@@ -32948,7 +33308,7 @@ var init_useForex = __esm({
32948
33308
  });
32949
33309
 
32950
33310
  // src/modes/swap/components/SwapTokenSelect.tsx
32951
- import { useState as useState29, useMemo as useMemo25, useEffect as useEffect29 } from "react";
33311
+ import { useState as useState30, useMemo as useMemo26, useEffect as useEffect30 } from "react";
32952
33312
  import { jsx as jsx55, jsxs as jsxs43 } from "react/jsx-runtime";
32953
33313
  function SwapTokenSelect({
32954
33314
  side,
@@ -32964,10 +33324,10 @@ function SwapTokenSelect({
32964
33324
  allowedTokens,
32965
33325
  excludeToken
32966
33326
  }) {
32967
- const [localChain, setLocalChain] = useState29(initialChain);
32968
- const [pinnedTokens, setPinnedTokens] = useState29([]);
32969
- const [pinnedLoading, setPinnedLoading] = useState29(false);
32970
- useEffect29(() => {
33327
+ const [localChain, setLocalChain] = useState30(initialChain);
33328
+ const [pinnedTokens, setPinnedTokens] = useState30([]);
33329
+ const [pinnedLoading, setPinnedLoading] = useState30(false);
33330
+ useEffect30(() => {
32971
33331
  if (!allowedTokens || allowedTokens.length === 0 || !localChain) {
32972
33332
  setPinnedTokens([]);
32973
33333
  return;
@@ -33048,26 +33408,26 @@ function SwapTokenSelect({
33048
33408
  walletAddress,
33049
33409
  yourWalletTokens
33050
33410
  });
33051
- const allowedSet = useMemo25(() => {
33411
+ const allowedSet = useMemo26(() => {
33052
33412
  if (!allowedTokens || allowedTokens.length === 0) return null;
33053
33413
  return new Set(
33054
33414
  allowedTokens.map((t) => `${t.chainId}:${t.address.toLowerCase()}`)
33055
33415
  );
33056
33416
  }, [allowedTokens]);
33057
- const filteredWalletTokens = useMemo25(() => {
33417
+ const filteredWalletTokens = useMemo26(() => {
33058
33418
  if (!allowedSet) return rawWalletTokens;
33059
33419
  return rawWalletTokens.filter(
33060
33420
  (t) => allowedSet.has(`${Number(t.chainId)}:${t.address.toLowerCase()}`)
33061
33421
  );
33062
33422
  }, [rawWalletTokens, allowedSet]);
33063
33423
  const excludeKey = excludeToken ? `${Number(excludeToken.chainId)}:${excludeToken.address.toLowerCase()}` : null;
33064
- const visibleTokens = useMemo25(() => {
33424
+ const visibleTokens = useMemo26(() => {
33065
33425
  if (!excludeKey) return filteredTokens;
33066
33426
  return filteredTokens.filter(
33067
33427
  (t) => `${Number(t.chainId)}:${t.address.toLowerCase()}` !== excludeKey
33068
33428
  );
33069
33429
  }, [filteredTokens, excludeKey]);
33070
- const visibleWalletTokens = useMemo25(() => {
33430
+ const visibleWalletTokens = useMemo26(() => {
33071
33431
  if (!excludeKey) return filteredWalletTokens;
33072
33432
  return filteredWalletTokens.filter(
33073
33433
  (t) => `${Number(t.chainId)}:${t.address.toLowerCase()}` !== excludeKey
@@ -33196,8 +33556,8 @@ var init_SwapTokenSelect = __esm({
33196
33556
  });
33197
33557
 
33198
33558
  // src/modes/swap/components/SwapWalletSelector.tsx
33199
- import { useEffect as useEffect30, useMemo as useMemo26, useRef as useRef16, useState as useState30 } from "react";
33200
- import { Fragment as Fragment8, jsx as jsx56, jsxs as jsxs44 } from "react/jsx-runtime";
33559
+ import { useEffect as useEffect31, useMemo as useMemo27, useRef as useRef17, useState as useState31 } from "react";
33560
+ import { Fragment as Fragment9, jsx as jsx56, jsxs as jsxs44 } from "react/jsx-runtime";
33201
33561
  function SwapWalletSelector({
33202
33562
  walletStatus,
33203
33563
  walletAddress,
@@ -33213,16 +33573,16 @@ function SwapWalletSelector({
33213
33573
  } = useWalletInfo();
33214
33574
  const walletConnectCfg = TrustwareConfigStore.peek()?.walletConnect;
33215
33575
  const connectWC = useWalletConnectConnect(walletConnectCfg);
33216
- const [wcConnecting, setWcConnecting] = useState30(false);
33217
- const [connectingId, setConnectingId] = useState30(null);
33218
- const [timerExpired, setTimerExpired] = useState30(false);
33219
- const [selectedNamespace, setSelectedNamespace] = useState30("evm");
33220
- const prevStatusRef = useRef16(walletStatus);
33221
- useEffect30(() => {
33576
+ const [wcConnecting, setWcConnecting] = useState31(false);
33577
+ const [connectingId, setConnectingId] = useState31(null);
33578
+ const [timerExpired, setTimerExpired] = useState31(false);
33579
+ const [selectedNamespace, setSelectedNamespace] = useState31("evm");
33580
+ const prevStatusRef = useRef17(walletStatus);
33581
+ useEffect31(() => {
33222
33582
  const t = setTimeout(() => setTimerExpired(true), 450);
33223
33583
  return () => clearTimeout(t);
33224
33584
  }, []);
33225
- useEffect30(() => {
33585
+ useEffect31(() => {
33226
33586
  const prev = prevStatusRef.current;
33227
33587
  if (prev !== walletStatus) {
33228
33588
  if (prev === "connecting" && (walletStatus === "connected" || walletStatus === "error")) {
@@ -33231,7 +33591,7 @@ function SwapWalletSelector({
33231
33591
  prevStatusRef.current = walletStatus;
33232
33592
  }
33233
33593
  }, [walletStatus]);
33234
- const filteredWallets = useMemo26(
33594
+ const filteredWallets = useMemo27(
33235
33595
  () => detected.filter(
33236
33596
  (w) => (w.meta?.ecosystem ?? "").toLowerCase() === selectedNamespace
33237
33597
  ),
@@ -33655,7 +34015,7 @@ function SwapWalletSelector({
33655
34015
  })
33656
34016
  }
33657
34017
  ),
33658
- selectedNamespace === "evm" && /* @__PURE__ */ jsxs44(Fragment8, { children: [
34018
+ selectedNamespace === "evm" && /* @__PURE__ */ jsxs44(Fragment9, { children: [
33659
34019
  /* @__PURE__ */ jsx56(
33660
34020
  "div",
33661
34021
  {
@@ -33896,13 +34256,13 @@ import {
33896
34256
  lazy as lazy2,
33897
34257
  Suspense as Suspense2,
33898
34258
  useCallback as useCallback22,
33899
- useEffect as useEffect31,
33900
- useMemo as useMemo27,
33901
- useRef as useRef17,
33902
- useState as useState31
34259
+ useEffect as useEffect32,
34260
+ useMemo as useMemo28,
34261
+ useRef as useRef18,
34262
+ useState as useState32
33903
34263
  } from "react";
33904
34264
  import ReactDOM from "react-dom";
33905
- import { Fragment as Fragment9, jsx as jsx57, jsxs as jsxs45 } from "react/jsx-runtime";
34265
+ import { Fragment as Fragment10, jsx as jsx57, jsxs as jsxs45 } from "react/jsx-runtime";
33906
34266
  function fmtAmount(n, max = 6) {
33907
34267
  if (!isFinite(n) || n === 0) return "0";
33908
34268
  return n.toLocaleString(void 0, { maximumFractionDigits: max });
@@ -33994,36 +34354,36 @@ function SwapMode({
33994
34354
  theme: themeProp,
33995
34355
  style
33996
34356
  }) {
33997
- const [stage, setStage] = useState31("home");
33998
- const [fromToken, setFromToken] = useState31(
34357
+ const [stage, setStage] = useState32("home");
34358
+ const [fromToken, setFromToken] = useState32(
33999
34359
  null
34000
34360
  );
34001
- const [fromChain, setFromChain] = useState31(null);
34002
- const [toToken, setToToken] = useState31(null);
34003
- const [toChain, setToChain] = useState31(null);
34004
- const [amount, setAmount] = useState31("");
34005
- const [amountInputMode, setAmountInputMode] = useState31(
34361
+ const [fromChain, setFromChain] = useState32(null);
34362
+ const [toToken, setToToken] = useState32(null);
34363
+ const [toChain, setToChain] = useState32(null);
34364
+ const [amount, setAmount] = useState32("");
34365
+ const [amountInputMode, setAmountInputMode] = useState32(
34006
34366
  "usd"
34007
34367
  );
34008
- const [hoverSell, setHoverSell] = useState31(false);
34009
- const [showRateDetails, setShowRateDetails] = useState31(false);
34010
- const [showReviewDetails, setShowReviewDetails] = useState31(false);
34011
- const [showSettings, setShowSettings] = useState31(false);
34012
- const [maxApproval, setMaxApproval] = useState31(false);
34013
- const [slippage, setSlippage] = useState31(0.5);
34014
- const [slippageInput, setSlippageInput] = useState31("");
34015
- const [selectedCurrency, setSelectedCurrency] = useState31("USD");
34016
- const [showCurrencyDropdown, setShowCurrencyDropdown] = useState31(false);
34017
- const [completedAt, setCompletedAt] = useState31(null);
34018
- const [copiedHash, setCopiedHash] = useState31(null);
34019
- const [rateUpdated, setRateUpdated] = useState31(false);
34020
- const prevToAmountRef = useRef17(null);
34021
- const [destAddress, setDestAddress] = useState31("");
34022
- const [quoteAge, setQuoteAge] = useState31(0);
34023
- const quoteTimestampRef = useRef17(null);
34024
- const [quoteLoadingMsgIdx, setQuoteLoadingMsgIdx] = useState31(0);
34025
- const [quoteLoadingMsgVisible, setQuoteLoadingMsgVisible] = useState31(true);
34026
- const latestFetchParamsRef = useRef17(null);
34368
+ const [hoverSell, setHoverSell] = useState32(false);
34369
+ const [showRateDetails, setShowRateDetails] = useState32(false);
34370
+ const [showReviewDetails, setShowReviewDetails] = useState32(false);
34371
+ const [showSettings, setShowSettings] = useState32(false);
34372
+ const [maxApproval, setMaxApproval] = useState32(false);
34373
+ const [slippage, setSlippage] = useState32(0.5);
34374
+ const [slippageInput, setSlippageInput] = useState32("");
34375
+ const [selectedCurrency, setSelectedCurrency] = useState32("USD");
34376
+ const [showCurrencyDropdown, setShowCurrencyDropdown] = useState32(false);
34377
+ const [completedAt, setCompletedAt] = useState32(null);
34378
+ const [copiedHash, setCopiedHash] = useState32(null);
34379
+ const [rateUpdated, setRateUpdated] = useState32(false);
34380
+ const prevToAmountRef = useRef18(null);
34381
+ const [destAddress, setDestAddress] = useState32("");
34382
+ const [quoteAge, setQuoteAge] = useState32(0);
34383
+ const quoteTimestampRef = useRef18(null);
34384
+ const [quoteLoadingMsgIdx, setQuoteLoadingMsgIdx] = useState32(0);
34385
+ const [quoteLoadingMsgVisible, setQuoteLoadingMsgVisible] = useState32(true);
34386
+ const latestFetchParamsRef = useRef18(null);
34027
34387
  const { rates: forexRates } = useForex();
34028
34388
  const currencyMeta = getCurrencyMeta(selectedCurrency);
34029
34389
  const currencyRate = forexRates[selectedCurrency] ?? 1;
@@ -34039,8 +34399,8 @@ function SwapMode({
34039
34399
  },
34040
34400
  [currencyRate, selectedCurrency]
34041
34401
  );
34042
- const settingsRef = useRef17(null);
34043
- const currencyDropdownRef = useRef17(null);
34402
+ const settingsRef = useRef18(null);
34403
+ const currencyDropdownRef = useRef18(null);
34044
34404
  const { emitEvent } = useTrustware();
34045
34405
  const { features, theme: configTheme } = useTrustwareConfig();
34046
34406
  const effectiveThemeSetting = themeProp ?? configTheme ?? "system";
@@ -34056,26 +34416,26 @@ function SwapMode({
34056
34416
  isLoading: chainsLoading,
34057
34417
  error: chainsError
34058
34418
  } = useChains();
34059
- const allowedDestChainIds = useMemo27(() => {
34419
+ const allowedDestChainIds = useMemo28(() => {
34060
34420
  if (!allowedDestTokens || allowedDestTokens.length === 0) return null;
34061
34421
  return new Set(allowedDestTokens.map((t) => t.chainId));
34062
34422
  }, [allowedDestTokens]);
34063
- const toPopularChains = useMemo27(
34423
+ const toPopularChains = useMemo28(
34064
34424
  () => allowedDestChainIds ? popularChains.filter(
34065
34425
  (c) => allowedDestChainIds.has(Number(c.chainId))
34066
34426
  ) : popularChains,
34067
34427
  [popularChains, allowedDestChainIds]
34068
34428
  );
34069
- const toOtherChains = useMemo27(
34429
+ const toOtherChains = useMemo28(
34070
34430
  () => allowedDestChainIds ? otherChains.filter((c) => allowedDestChainIds.has(Number(c.chainId))) : otherChains,
34071
34431
  [otherChains, allowedDestChainIds]
34072
34432
  );
34073
- const allChains = useMemo27(
34433
+ const allChains = useMemo28(
34074
34434
  () => [...popularChains, ...otherChains],
34075
34435
  [popularChains, otherChains]
34076
34436
  );
34077
- const destInitialized = useRef17(false);
34078
- useEffect31(() => {
34437
+ const destInitialized = useRef18(false);
34438
+ useEffect32(() => {
34079
34439
  if (!defaultDestRef || destInitialized.current || allChains.length === 0)
34080
34440
  return;
34081
34441
  const chain = allChains.find(
@@ -34123,18 +34483,18 @@ function SwapMode({
34123
34483
  });
34124
34484
  const route = useSwapRoute();
34125
34485
  const execution = useSwapExecution(fromChain);
34126
- const fromTokenPriceUSD = useMemo27(() => {
34486
+ const fromTokenPriceUSD = useMemo28(() => {
34127
34487
  const p = fromToken?.usdPrice;
34128
34488
  return typeof p === "number" && Number.isFinite(p) && p > 0 ? p : 0;
34129
34489
  }, [fromToken]);
34130
34490
  const hasFromUsdPrice = fromTokenPriceUSD > 0;
34131
- const toTokenPriceUSD = useMemo27(() => {
34491
+ const toTokenPriceUSD = useMemo28(() => {
34132
34492
  const p = toToken?.usdPrice;
34133
34493
  return typeof p === "number" && Number.isFinite(p) && p > 0 ? p : 0;
34134
34494
  }, [toToken]);
34135
34495
  const hasToUsdPrice = toTokenPriceUSD > 0;
34136
34496
  const rawSellNum = parseFloat(amount) || 0;
34137
- const usdSellNum = useMemo27(() => {
34497
+ const usdSellNum = useMemo28(() => {
34138
34498
  if (amountInputMode === "usd") return rawSellNum / currencyRate;
34139
34499
  return hasFromUsdPrice ? rawSellNum * fromTokenPriceUSD : 0;
34140
34500
  }, [
@@ -34144,7 +34504,7 @@ function SwapMode({
34144
34504
  hasFromUsdPrice,
34145
34505
  fromTokenPriceUSD
34146
34506
  ]);
34147
- const tokenSellNum = useMemo27(() => {
34507
+ const tokenSellNum = useMemo28(() => {
34148
34508
  if (amountInputMode === "usd") {
34149
34509
  return hasFromUsdPrice && fromTokenPriceUSD > 0 ? usdSellNum / fromTokenPriceUSD : 0;
34150
34510
  }
@@ -34156,7 +34516,7 @@ function SwapMode({
34156
34516
  hasFromUsdPrice,
34157
34517
  fromTokenPriceUSD
34158
34518
  ]);
34159
- const tokenAmountStr = useMemo27(() => {
34519
+ const tokenAmountStr = useMemo28(() => {
34160
34520
  if (tokenSellNum <= 0) return "";
34161
34521
  const decimals = fromToken?.decimals ?? 18;
34162
34522
  return truncateDecimal(tokenSellNum, Math.min(decimals, 18));
@@ -34282,8 +34642,13 @@ function SwapMode({
34282
34642
  setStage("processing");
34283
34643
  const fromTokenAddress = fromToken?.address ?? fromToken?.address;
34284
34644
  const fromTokenDecimals = fromToken?.decimals ?? void 0;
34645
+ let routeToSend = route.data;
34646
+ if (isSerializedSolanaTxRequest(routeToSend.txReq) && latestFetchParamsRef.current) {
34647
+ const fresh = await route.fetch(latestFetchParamsRef.current);
34648
+ if (fresh) routeToSend = fresh;
34649
+ }
34285
34650
  await execution.execute(
34286
- route.data,
34651
+ routeToSend,
34287
34652
  fromTokenAddress,
34288
34653
  fromTokenDecimals,
34289
34654
  walletAddress ?? void 0,
@@ -34294,7 +34659,7 @@ function SwapMode({
34294
34659
  },
34295
34660
  () => setStage("error")
34296
34661
  );
34297
- }, [route.data, execution, fromToken, walletAddress, maxApproval]);
34662
+ }, [route, execution, fromToken, walletAddress, maxApproval]);
34298
34663
  const handleReset = useCallback22(() => {
34299
34664
  execution.reset();
34300
34665
  route.clear();
@@ -34362,7 +34727,7 @@ function SwapMode({
34362
34727
  fromToken?.decimals,
34363
34728
  route
34364
34729
  ]);
34365
- const fromBalance = useMemo27(() => {
34730
+ const fromBalance = useMemo28(() => {
34366
34731
  const walletToken = fromToken;
34367
34732
  if (!walletToken || !("balance" in walletToken)) return null;
34368
34733
  const raw = walletToken.balance;
@@ -34372,7 +34737,7 @@ function SwapMode({
34372
34737
  return Number.isFinite(n) ? n : null;
34373
34738
  }, [fromToken]);
34374
34739
  const balanceUsd = fromBalance !== null && hasFromUsdPrice ? fromBalance * fromTokenPriceUSD : null;
34375
- const estimatedToAmount = useMemo27(() => {
34740
+ const estimatedToAmount = useMemo28(() => {
34376
34741
  if (tokenSellNum <= 0 || !hasFromUsdPrice || !hasToUsdPrice) return null;
34377
34742
  return tokenSellNum * (fromTokenPriceUSD / toTokenPriceUSD);
34378
34743
  }, [
@@ -34382,10 +34747,10 @@ function SwapMode({
34382
34747
  hasFromUsdPrice,
34383
34748
  hasToUsdPrice
34384
34749
  ]);
34385
- const backendToUsdStr = useMemo27(() => {
34750
+ const backendToUsdStr = useMemo28(() => {
34386
34751
  return route.data?.finalExchangeRate?.toAmountMinUSD ?? route.data?.route?.estimate?.toAmountMinUsd ?? route.data?.route?.estimate?.toAmountUsd ?? null;
34387
34752
  }, [route.data]);
34388
- const toAmount = useMemo27(() => {
34753
+ const toAmount = useMemo28(() => {
34389
34754
  if (backendToUsdStr && toTokenPriceUSD > 0) {
34390
34755
  const usd = parseFloat(backendToUsdStr);
34391
34756
  if (Number.isFinite(usd) && usd > 0) return usd / toTokenPriceUSD;
@@ -34411,7 +34776,7 @@ function SwapMode({
34411
34776
  estimatedToAmount
34412
34777
  ]);
34413
34778
  const fromUsd = usdSellNum;
34414
- const toUsd = useMemo27(() => {
34779
+ const toUsd = useMemo28(() => {
34415
34780
  if (backendToUsdStr) {
34416
34781
  const n = parseFloat(backendToUsdStr);
34417
34782
  if (Number.isFinite(n) && n > 0) return n;
@@ -34422,12 +34787,12 @@ function SwapMode({
34422
34787
  const isEstimate = !route.data;
34423
34788
  const USD_EPSILON = 1e-3;
34424
34789
  const displayToUsd = toUsd > USD_EPSILON ? toUsd : estimatedToAmount !== null && hasToUsdPrice ? estimatedToAmount * toTokenPriceUSD : 0;
34425
- const priceImpact = useMemo27(() => {
34790
+ const priceImpact = useMemo28(() => {
34426
34791
  if (!route.data || fromUsd < 0.01 || displayToUsd < 0.01) return null;
34427
34792
  const impact = 1 - displayToUsd / fromUsd;
34428
34793
  return impact > 1e-3 ? impact : null;
34429
34794
  }, [route.data, fromUsd, displayToUsd]);
34430
- const routePath = useMemo27(() => {
34795
+ const routePath = useMemo28(() => {
34431
34796
  if (!route.data) return null;
34432
34797
  const provider = route.data.route?.provider;
34433
34798
  const steps = route.data.route?.steps;
@@ -34454,19 +34819,19 @@ function SwapMode({
34454
34819
  return null;
34455
34820
  }, [route.data, fromToken?.symbol, toToken?.symbol]);
34456
34821
  const isGasSponsored = !!route.data?.sponsorship;
34457
- const networkCostUsd = useMemo27(() => {
34822
+ const networkCostUsd = useMemo28(() => {
34458
34823
  const fees = route.data?.route?.estimate?.fees;
34459
34824
  if (!fees?.length) return null;
34460
34825
  const gasTotal = fees.filter((f) => f.type?.toLowerCase().includes("gas")).reduce((sum, f) => sum + (Number(f.amountUsd) || 0), 0);
34461
34826
  return gasTotal > 0 ? gasTotal : null;
34462
34827
  }, [route.data]);
34463
- const protocolFeeUsd = useMemo27(() => {
34828
+ const protocolFeeUsd = useMemo28(() => {
34464
34829
  const fees = route.data?.route?.estimate?.fees;
34465
34830
  if (!fees?.length) return null;
34466
34831
  const total = fees.filter((f) => !f.type?.toLowerCase().includes("gas")).reduce((sum, f) => sum + (Number(f.amountUsd) || 0), 0);
34467
34832
  return total > 0 ? total : null;
34468
34833
  }, [route.data]);
34469
- const exchangeRate = useMemo27(() => {
34834
+ const exchangeRate = useMemo28(() => {
34470
34835
  if (!hasFromUsdPrice || !hasToUsdPrice) return null;
34471
34836
  return toTokenPriceUSD / fromTokenPriceUSD;
34472
34837
  }, [fromTokenPriceUSD, toTokenPriceUSD, hasFromUsdPrice, hasToUsdPrice]);
@@ -34475,13 +34840,13 @@ function SwapMode({
34475
34840
  const hasAmount = rawSellNum > 0 && (amountInputMode === "token" || hasFromUsdPrice);
34476
34841
  const isConnected = walletStatus === "connected" && !!walletAddress;
34477
34842
  const canGetQuote = hasTokens && hasAmount && !insufficient && isConnected && (!needsDestAddress || isValidDestAddress);
34478
- useEffect31(() => {
34843
+ useEffect32(() => {
34479
34844
  if (!fromToken) return;
34480
34845
  if (!hasFromUsdPrice && amountInputMode === "usd") {
34481
34846
  setAmountInputMode("token");
34482
34847
  }
34483
34848
  }, [fromToken, hasFromUsdPrice, amountInputMode]);
34484
- useEffect31(() => {
34849
+ useEffect32(() => {
34485
34850
  if (displayToAmount === null) {
34486
34851
  prevToAmountRef.current = null;
34487
34852
  return;
@@ -34495,14 +34860,14 @@ function SwapMode({
34495
34860
  const t = setTimeout(() => setRateUpdated(false), 700);
34496
34861
  return () => clearTimeout(t);
34497
34862
  }, [displayToAmount]);
34498
- useEffect31(() => {
34863
+ useEffect32(() => {
34499
34864
  setDestAddress("");
34500
34865
  }, [toChainType]);
34501
- const fetchRef = useRef17(route.fetch);
34502
- useEffect31(() => {
34866
+ const fetchRef = useRef18(route.fetch);
34867
+ useEffect32(() => {
34503
34868
  fetchRef.current = route.fetch;
34504
34869
  });
34505
- useEffect31(() => {
34870
+ useEffect32(() => {
34506
34871
  if (!canGetQuote || stage !== "home") return;
34507
34872
  if (!fromToken || !fromChain || !toToken || !toChain || !walletAddress)
34508
34873
  return;
@@ -34531,7 +34896,7 @@ function SwapMode({
34531
34896
  destAddress,
34532
34897
  slippage
34533
34898
  ]);
34534
- useEffect31(() => {
34899
+ useEffect32(() => {
34535
34900
  if (!canGetQuote || !fromToken || !fromChain || !toToken || !toChain || !walletAddress) {
34536
34901
  latestFetchParamsRef.current = null;
34537
34902
  return;
@@ -34558,12 +34923,12 @@ function SwapMode({
34558
34923
  destAddress,
34559
34924
  slippage
34560
34925
  ]);
34561
- useEffect31(() => {
34926
+ useEffect32(() => {
34562
34927
  quoteTimestampRef.current = route.data ? Date.now() : null;
34563
34928
  setQuoteAge(0);
34564
34929
  }, [route.data]);
34565
- const msgTimeoutRef = useRef17(null);
34566
- useEffect31(() => {
34930
+ const msgTimeoutRef = useRef18(null);
34931
+ useEffect32(() => {
34567
34932
  if (!route.loading) {
34568
34933
  setQuoteLoadingMsgIdx(0);
34569
34934
  setQuoteLoadingMsgVisible(true);
@@ -34581,7 +34946,7 @@ function SwapMode({
34581
34946
  if (msgTimeoutRef.current !== null) clearTimeout(msgTimeoutRef.current);
34582
34947
  };
34583
34948
  }, [route.loading]);
34584
- useEffect31(() => {
34949
+ useEffect32(() => {
34585
34950
  if (!route.data) return;
34586
34951
  const id = setInterval(() => {
34587
34952
  const ts = quoteTimestampRef.current;
@@ -34595,7 +34960,7 @@ function SwapMode({
34595
34960
  }, 1e3);
34596
34961
  return () => clearInterval(id);
34597
34962
  }, [route.data]);
34598
- useEffect31(() => {
34963
+ useEffect32(() => {
34599
34964
  if (stage !== "review") return;
34600
34965
  if (!route.data || !walletAddress) return;
34601
34966
  const fromTokenAddress = fromToken?.address;
@@ -34606,7 +34971,7 @@ function SwapMode({
34606
34971
  routeResult: route.data
34607
34972
  });
34608
34973
  }, [stage, route.data, walletAddress, fromToken]);
34609
- useEffect31(() => {
34974
+ useEffect32(() => {
34610
34975
  if (!showSettings) {
34611
34976
  setShowCurrencyDropdown(false);
34612
34977
  return;
@@ -34619,7 +34984,7 @@ function SwapMode({
34619
34984
  document.addEventListener("mousedown", handler);
34620
34985
  return () => document.removeEventListener("mousedown", handler);
34621
34986
  }, [showSettings]);
34622
- useEffect31(() => {
34987
+ useEffect32(() => {
34623
34988
  if (!showCurrencyDropdown) return;
34624
34989
  const handler = (e2) => {
34625
34990
  if (currencyDropdownRef.current && !currencyDropdownRef.current.contains(e2.target)) {
@@ -35106,7 +35471,7 @@ function SwapMode({
35106
35471
  padding: 0,
35107
35472
  transition: "color 0.15s"
35108
35473
  },
35109
- children: isCopied ? "Copied!" : /* @__PURE__ */ jsxs45(Fragment9, { children: [
35474
+ children: isCopied ? "Copied!" : /* @__PURE__ */ jsxs45(Fragment10, { children: [
35110
35475
  txHash.slice(0, 6),
35111
35476
  "\u2026",
35112
35477
  txHash.slice(-4),
@@ -37769,8 +38134,8 @@ function ReviewDetailRow({
37769
38134
  value,
37770
38135
  tooltip
37771
38136
  }) {
37772
- const iconRef = useRef17(null);
37773
- const [tipPos, setTipPos] = useState31(null);
38137
+ const iconRef = useRef18(null);
38138
+ const [tipPos, setTipPos] = useState32(null);
37774
38139
  const handleMouseEnter = () => {
37775
38140
  if (!tooltip || !iconRef.current) return;
37776
38141
  const r = iconRef.current.getBoundingClientRect();
@@ -38058,6 +38423,7 @@ var init_SwapMode = __esm({
38058
38423
  init_mapError();
38059
38424
  init_components();
38060
38425
  init_registryClient();
38426
+ init_routes();
38061
38427
  init_useThemePreference();
38062
38428
  init_useWalletSessionState();
38063
38429
  init_useWalletTokenState();
@@ -38104,14 +38470,14 @@ var init_swap = __esm({
38104
38470
 
38105
38471
  // src/widget/TrustwareWidgetV2.tsx
38106
38472
  import {
38107
- useState as useState32,
38108
- useEffect as useEffect32,
38109
- useRef as useRef18,
38473
+ useState as useState33,
38474
+ useEffect as useEffect33,
38475
+ useRef as useRef19,
38110
38476
  useCallback as useCallback23,
38111
38477
  useImperativeHandle,
38112
38478
  forwardRef
38113
38479
  } from "react";
38114
- import { Fragment as Fragment10, jsx as jsx58, jsxs as jsxs46 } from "react/jsx-runtime";
38480
+ import { Fragment as Fragment11, jsx as jsx58, jsxs as jsxs46 } from "react/jsx-runtime";
38115
38481
  function WidgetContent({
38116
38482
  style,
38117
38483
  onStateChange,
@@ -38122,7 +38488,7 @@ function WidgetContent({
38122
38488
  const { transactionHash, transactionStatus } = useDepositTransaction();
38123
38489
  const { resolvedTheme, toggleTheme } = useDepositUi();
38124
38490
  useWalletExternalDisconnect(() => setCurrentStep("home"));
38125
- useEffect32(() => {
38491
+ useEffect33(() => {
38126
38492
  const state = {
38127
38493
  currentStep,
38128
38494
  amount,
@@ -38165,7 +38531,7 @@ function WidgetInner({
38165
38531
  const { transactionStatus } = useDepositTransaction();
38166
38532
  const { resolvedTheme } = useDepositUi();
38167
38533
  const { status, revalidate, errors } = useTrustware();
38168
- const [showConfirmDialog, setShowConfirmDialog] = useState32(false);
38534
+ const [showConfirmDialog, setShowConfirmDialog] = useState33(false);
38169
38535
  const handleCloseRequest = useCallback23(() => {
38170
38536
  if (ACTIVE_TRANSACTION_STATUSES.includes(transactionStatus)) {
38171
38537
  setShowConfirmDialog(true);
@@ -38177,7 +38543,7 @@ function WidgetInner({
38177
38543
  onClose?.();
38178
38544
  }
38179
38545
  }, [transactionStatus, onClose, resetState]);
38180
- useEffect32(() => {
38546
+ useEffect33(() => {
38181
38547
  closeRequestRef.current = handleCloseRequest;
38182
38548
  }, [handleCloseRequest, closeRequestRef]);
38183
38549
  const handleConfirmClose = useCallback23(() => {
@@ -38193,7 +38559,7 @@ function WidgetInner({
38193
38559
  const handleRefresh = useCallback23(() => {
38194
38560
  revalidate?.();
38195
38561
  }, [revalidate]);
38196
- return /* @__PURE__ */ jsxs46(Fragment10, { children: [
38562
+ return /* @__PURE__ */ jsxs46(Fragment11, { children: [
38197
38563
  /* @__PURE__ */ jsxs46(WidgetContainer, { theme: effectiveTheme, style, children: [
38198
38564
  /* @__PURE__ */ jsx58(
38199
38565
  WidgetContent,
@@ -38261,8 +38627,8 @@ var init_TrustwareWidgetV2 = __esm({
38261
38627
  onOpen,
38262
38628
  showThemeToggle = true
38263
38629
  }, ref) {
38264
- const [isOpen, setIsOpen] = useState32(defaultOpen);
38265
- const closeRequestRef = useRef18(null);
38630
+ const [isOpen, setIsOpen] = useState33(defaultOpen);
38631
+ const closeRequestRef = useRef19(null);
38266
38632
  const config = useTrustwareConfig();
38267
38633
  const effectiveInitialStep = initialStep;
38268
38634
  const open = useCallback23(() => {