@trustware/sdk-staging 1.1.9-staging.1 → 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 (39) hide show
  1. package/dist/constants.cjs +1 -1
  2. package/dist/constants.cjs.map +1 -1
  3. package/dist/constants.mjs +1 -1
  4. package/dist/constants.mjs.map +1 -1
  5. package/dist/{core-p_5BLdbE.d.ts → core-CwT8Wd1x.d.ts} +1 -1
  6. package/dist/{core-D_jx805U.d.cts → core-Dy_rZl5y.d.cts} +1 -1
  7. package/dist/core.cjs +1 -1
  8. package/dist/core.cjs.map +1 -1
  9. package/dist/core.d.cts +2 -2
  10. package/dist/core.d.ts +2 -2
  11. package/dist/core.mjs +1 -1
  12. package/dist/core.mjs.map +1 -1
  13. package/dist/{detect--pmNlAHv.d.cts → detect-DVpECOTa.d.cts} +2 -2
  14. package/dist/{detect-qAX6I4JI.d.ts → detect-d2PUaxE_.d.ts} +2 -2
  15. package/dist/index.cjs +592 -268
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +6 -7
  18. package/dist/index.d.ts +6 -7
  19. package/dist/index.mjs +546 -222
  20. package/dist/index.mjs.map +1 -1
  21. package/dist/{manager-aMi4_Ss6.d.cts → manager-B5aklGtm.d.cts} +1 -1
  22. package/dist/{manager-DFQkemW0.d.ts → manager-xFiq0SHr.d.ts} +1 -1
  23. package/dist/smart-account.cjs +1 -1
  24. package/dist/smart-account.cjs.map +1 -1
  25. package/dist/smart-account.d.cts +31 -3
  26. package/dist/smart-account.d.ts +31 -3
  27. package/dist/smart-account.mjs +1 -1
  28. package/dist/smart-account.mjs.map +1 -1
  29. package/dist/wallet.cjs +103 -47
  30. package/dist/wallet.cjs.map +1 -1
  31. package/dist/wallet.d.cts +3 -3
  32. package/dist/wallet.d.ts +3 -3
  33. package/dist/wallet.mjs +103 -47
  34. package/dist/wallet.mjs.map +1 -1
  35. package/dist/widget.cjs +592 -268
  36. package/dist/widget.cjs.map +1 -1
  37. package/dist/widget.mjs +546 -222
  38. package/dist/widget.mjs.map +1 -1
  39. package/package.json +1 -1
package/dist/widget.mjs CHANGED
@@ -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.9-staging.1";
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";
@@ -6212,12 +6212,25 @@ var init_connect = __esm({
6212
6212
  function formatDeepLink(id, currentUrl) {
6213
6213
  const enc = encodeURIComponent(currentUrl);
6214
6214
  switch (id) {
6215
+ // EVM
6215
6216
  case "metamask":
6216
6217
  return `metamask://dapp/${currentUrl}`;
6217
6218
  case "coinbase":
6218
6219
  return `coinbase://wallet/dapp?url=${enc}`;
6219
6220
  case "rainbow":
6220
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
6221
6234
  default:
6222
6235
  return void 0;
6223
6236
  }
@@ -6245,6 +6258,8 @@ var init_metadata = __esm({
6245
6258
  emoji: "\u{1F98A}",
6246
6259
  homepage: "https://metamask.io/",
6247
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",
6248
6263
  detectFlags: ["isMetaMask"],
6249
6264
  deepLink: (url) => formatDeepLink("metamask", url) ?? ""
6250
6265
  },
@@ -6256,6 +6271,8 @@ var init_metadata = __esm({
6256
6271
  logo: `${ASSETS_BASE_URL}/assets/wallets/coinbase.svg`,
6257
6272
  emoji: "\u{1F7E6}",
6258
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",
6259
6276
  detectFlags: ["isCoinbaseWallet"],
6260
6277
  deepLink: (url) => formatDeepLink("coinbase", url) ?? ""
6261
6278
  },
@@ -6267,6 +6284,7 @@ var init_metadata = __esm({
6267
6284
  logo: `${ASSETS_BASE_URL}/assets/wallets/walletconnect.svg`,
6268
6285
  emoji: "\u{1FA9D}",
6269
6286
  homepage: "https://walletconnect.com/"
6287
+ // No deep link — opens its own modal
6270
6288
  },
6271
6289
  {
6272
6290
  id: "rainbow",
@@ -6276,8 +6294,38 @@ var init_metadata = __esm({
6276
6294
  logo: `${ASSETS_BASE_URL}/assets/wallets/rainbow.svg`,
6277
6295
  emoji: "\u{1F308}",
6278
6296
  homepage: "https://rainbow.me/",
6279
- deepLink: (url) => formatDeepLink("rainbow", url) ?? "",
6280
- 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
6281
6329
  },
6282
6330
  {
6283
6331
  id: "phantom-evm",
@@ -6287,7 +6335,10 @@ var init_metadata = __esm({
6287
6335
  logo: `${ASSETS_BASE_URL}/assets/wallets/phantom.svg`,
6288
6336
  emoji: "\u{1F47B}",
6289
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",
6290
6340
  detectFlags: ["isPhantom"]
6341
+ // No EVM dapp browser deep link — falls back to app store
6291
6342
  },
6292
6343
  {
6293
6344
  id: "phantom-solana",
@@ -6297,18 +6348,9 @@ var init_metadata = __esm({
6297
6348
  logo: `${ASSETS_BASE_URL}/assets/wallets/phantom.svg`,
6298
6349
  emoji: "\u{1F47B}",
6299
6350
  homepage: "https://phantom.app/",
6300
- android: "https://play.google.com/store/apps/details?id=app.phantom",
6301
6351
  ios: "https://apps.apple.com/app/phantom-crypto-wallet/id1598432977",
6302
- deepLink: (url) => `phantom://browse/${encodeURIComponent(url)}`
6303
- },
6304
- {
6305
- id: "metamask-solana",
6306
- name: "MetaMask (Solana)",
6307
- category: "injected",
6308
- ecosystem: "solana",
6309
- logo: `${ASSETS_BASE_URL}/assets/wallets/metamask.svg`,
6310
- emoji: "\u{1F98A}",
6311
- homepage: "https://metamask.io/"
6352
+ android: "https://play.google.com/store/apps/details?id=app.phantom",
6353
+ deepLink: (url) => formatDeepLink("phantom-solana", url) ?? ""
6312
6354
  },
6313
6355
  {
6314
6356
  id: "solflare",
@@ -6318,7 +6360,9 @@ var init_metadata = __esm({
6318
6360
  logo: `${ASSETS_BASE_URL}/assets/wallets/solflare-logo.svg`,
6319
6361
  emoji: "\u2600\uFE0F",
6320
6362
  homepage: "https://solflare.com/",
6321
- 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) ?? ""
6322
6366
  },
6323
6367
  {
6324
6368
  id: "backpack",
@@ -6327,8 +6371,25 @@ var init_metadata = __esm({
6327
6371
  ecosystem: "solana",
6328
6372
  logo: `${ASSETS_BASE_URL}/assets/wallets/backpack-logo.svg`,
6329
6373
  emoji: "\u{1F392}",
6330
- 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
6331
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
6391
+ },
6392
+ // ── Extension/desktop only — hidden on mobile ─────────────────────────────
6332
6393
  {
6333
6394
  id: "rabby",
6334
6395
  name: "Rabby",
@@ -6339,6 +6400,7 @@ var init_metadata = __esm({
6339
6400
  homepage: "https://rabby.io/",
6340
6401
  chromeWebStore: "https://chromewebstore.google.com/detail/rabby/acmacodkjbdgmoleebolmdjonilkdbch",
6341
6402
  detectFlags: ["isRabby"]
6403
+ // Extension only — no mobile app or deep link
6342
6404
  },
6343
6405
  {
6344
6406
  id: "brave",
@@ -6349,25 +6411,7 @@ var init_metadata = __esm({
6349
6411
  emoji: "\u{1F981}",
6350
6412
  homepage: "https://brave.com/wallet/",
6351
6413
  detectFlags: ["isBraveWallet"]
6352
- },
6353
- {
6354
- id: "okx",
6355
- name: "OKX",
6356
- category: "injected",
6357
- ecosystem: "evm",
6358
- logo: `${ASSETS_BASE_URL}/assets/wallets/okx.svg`,
6359
- emoji: "\u2B1B",
6360
- homepage: "https://www.okx.com/web3",
6361
- detectFlags: ["isOkxWallet"]
6362
- },
6363
- {
6364
- id: "zerion",
6365
- name: "Zerion",
6366
- category: "app",
6367
- ecosystem: "evm",
6368
- logo: `${ASSETS_BASE_URL}/assets/wallets/zerion.png`,
6369
- emoji: "\u{1F9FF}",
6370
- homepage: "https://zerion.io/wallet/"
6414
+ // Built into Brave browser — no standalone deep link
6371
6415
  },
6372
6416
  {
6373
6417
  id: "taho",
@@ -6378,16 +6422,7 @@ var init_metadata = __esm({
6378
6422
  emoji: "\u{1F7EA}",
6379
6423
  homepage: "https://taho.xyz/",
6380
6424
  detectFlags: ["isTally", "isTallyWallet", "isTahoWallet"]
6381
- },
6382
- {
6383
- id: "trust",
6384
- name: "Trust Wallet",
6385
- category: "app",
6386
- ecosystem: "multi",
6387
- logo: `${ASSETS_BASE_URL}/assets/wallets/trust.svg`,
6388
- emoji: "\u{1F6E1}\uFE0F",
6389
- homepage: "https://trustwallet.com/",
6390
- detectFlags: ["isTrustWallet"]
6425
+ // Extension only — no mobile app
6391
6426
  },
6392
6427
  {
6393
6428
  id: "bitget",
@@ -6397,7 +6432,22 @@ var init_metadata = __esm({
6397
6432
  logo: `${ASSETS_BASE_URL}/assets/wallets/bitget.svg`,
6398
6433
  emoji: "\u{1F7E9}",
6399
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",
6400
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
6401
6451
  },
6402
6452
  {
6403
6453
  id: "safe",
@@ -6406,7 +6456,10 @@ var init_metadata = __esm({
6406
6456
  ecosystem: "evm",
6407
6457
  logo: `${ASSETS_BASE_URL}/assets/wallets/safe.svg`,
6408
6458
  emoji: "\u{1F7E9}",
6409
- 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
6410
6463
  },
6411
6464
  {
6412
6465
  id: "kucoin",
@@ -6415,7 +6468,10 @@ var init_metadata = __esm({
6415
6468
  ecosystem: "evm",
6416
6469
  logo: `${ASSETS_BASE_URL}/assets/wallets/kucoin.svg`,
6417
6470
  emoji: "\u{1F7E6}",
6418
- 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
6419
6475
  }
6420
6476
  ];
6421
6477
  }
@@ -6594,6 +6650,14 @@ function useWalletDetection(timeoutMs = 400) {
6594
6650
  );
6595
6651
  return { detected, detectedIds };
6596
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
+ }
6597
6661
  var WALLET_BY_ID, DETECT_PRIORITY, GENERIC_FLAGS, RDNS_WALLET_MAP, NAME_WALLET_MAP;
6598
6662
  var init_detect = __esm({
6599
6663
  "src/wallets/detect.ts"() {
@@ -8146,6 +8210,7 @@ var init_wallets = __esm({
8146
8210
  init_adapters();
8147
8211
  init_solana();
8148
8212
  init_detect();
8213
+ init_metadata();
8149
8214
  }
8150
8215
  });
8151
8216
 
@@ -15978,8 +16043,9 @@ var init_WalletNamespaceTabs = __esm({
15978
16043
  });
15979
16044
 
15980
16045
  // src/widget/features/wallet/components/CryptoWalletDropdownContent.tsx
15981
- import { jsx as jsx36, jsxs as jsxs30 } from "react/jsx-runtime";
15982
- 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({
15983
16049
  browserWallets,
15984
16050
  handleWalletConnect,
15985
16051
  handleWalletSelect
@@ -16043,6 +16109,262 @@ function CryptoWalletDropdownContent({
16043
16109
  }
16044
16110
  );
16045
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
+ }
16046
16368
  var init_CryptoWalletDropdownContent = __esm({
16047
16369
  "src/widget/features/wallet/components/CryptoWalletDropdownContent.tsx"() {
16048
16370
  "use strict";
@@ -16053,6 +16375,7 @@ var init_CryptoWalletDropdownContent = __esm({
16053
16375
  init_paymentOptionStyles();
16054
16376
  init_WalletNamespaceTabs();
16055
16377
  init_DepositContext();
16378
+ init_wallets();
16056
16379
  }
16057
16380
  });
16058
16381
 
@@ -16507,7 +16830,7 @@ var init_HomePaymentOptions = __esm({
16507
16830
  });
16508
16831
 
16509
16832
  // src/widget/features/wallet/hooks/useHomeWalletActions.ts
16510
- 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";
16511
16834
  function useHomeWalletActions({
16512
16835
  connectWallet,
16513
16836
  detectedWallets,
@@ -16516,12 +16839,12 @@ function useHomeWalletActions({
16516
16839
  WalletConnect
16517
16840
  // setCurrentStepInternal,
16518
16841
  }) {
16519
- const [isCryptoDropdownOpen, setIsCryptoDropdownOpen] = useState23(false);
16520
- const [isFiatDropdownOpen, setIsFiatDropdownOpen] = useState23(false);
16521
- const cryptoDropdownRef = useRef10(null);
16522
- 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);
16523
16846
  const { disconnect } = useWalletInfo();
16524
- useEffect23(() => {
16847
+ useEffect24(() => {
16525
16848
  const handleClickOutside = (event) => {
16526
16849
  if (cryptoDropdownRef.current && !cryptoDropdownRef.current.contains(event.target)) {
16527
16850
  setIsCryptoDropdownOpen(false);
@@ -16547,6 +16870,7 @@ function useHomeWalletActions({
16547
16870
  setWalletType("other");
16548
16871
  const { error } = await connectWallet(wallet);
16549
16872
  if (error) {
16873
+ console.error("Wallet connection error:", error);
16550
16874
  resetNavigation();
16551
16875
  return;
16552
16876
  }
@@ -16568,7 +16892,7 @@ function useHomeWalletActions({
16568
16892
  WalletConnect().catch(() => resetNavigation());
16569
16893
  }, [setYourWalletTokens, disconnect]);
16570
16894
  const { selectedNamespace } = useDepositWallet();
16571
- const browserWallets = useMemo17(() => {
16895
+ const browserWallets = useMemo18(() => {
16572
16896
  if (!detectedWallets?.length) return [];
16573
16897
  return detectedWallets.filter(
16574
16898
  (wallet) => wallet?.meta?.id !== "walletconnect" && wallet?.meta?.ecosystem.trim().toLowerCase() === selectedNamespace.trim().toLowerCase()
@@ -16980,7 +17304,7 @@ var init_relayFeeUtils = __esm({
16980
17304
  });
16981
17305
 
16982
17306
  // src/widget/features/route-preview/hooks/useRoutePreviewModel.ts
16983
- import { useMemo as useMemo18 } from "react";
17307
+ import { useMemo as useMemo19 } from "react";
16984
17308
  function useRoutePreviewModel({
16985
17309
  amountUsd,
16986
17310
  amountValidationError,
@@ -16993,7 +17317,7 @@ function useRoutePreviewModel({
16993
17317
  walletAddress
16994
17318
  }) {
16995
17319
  const { chains } = useChains();
16996
- const destinationConfig = useMemo18(
17320
+ const destinationConfig = useMemo19(
16997
17321
  () => ({
16998
17322
  dappName: config.messages?.title || "DApp",
16999
17323
  toChain: config.routes.toChain,
@@ -17007,7 +17331,7 @@ function useRoutePreviewModel({
17007
17331
  config.routes.toToken
17008
17332
  ]
17009
17333
  );
17010
- const routeConfig = useMemo18(() => {
17334
+ const routeConfig = useMemo19(() => {
17011
17335
  const toChainId = config.routes.toChain;
17012
17336
  const toChainKey = normalizeChainKey2(toChainId);
17013
17337
  const toChain = toChainKey ? chains.find(
@@ -17044,7 +17368,7 @@ function useRoutePreviewModel({
17044
17368
  ...routeConfig,
17045
17369
  enabled: !!isReady
17046
17370
  });
17047
- const routePrerequisiteError = useMemo18(() => {
17371
+ const routePrerequisiteError = useMemo19(() => {
17048
17372
  if (!isReady) return;
17049
17373
  if (!selectedChain) {
17050
17374
  return "Select a source chain to fetch a route.";
@@ -30626,7 +30950,7 @@ var init_smart_account2 = __esm({
30626
30950
  });
30627
30951
 
30628
30952
  // src/widget/features/transaction/hooks/useTransactionActionModel.ts
30629
- 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";
30630
30954
  import { encodeFunctionData as encodeFunctionData8, erc20Abi } from "viem";
30631
30955
  function normalizeTokenAddressForCompare(chain, addr) {
30632
30956
  const chainType = (chain.type ?? chain.chainType ?? "").toLowerCase();
@@ -30648,7 +30972,7 @@ function useTransactionActionModel({
30648
30972
  walletAddress,
30649
30973
  walletStatus
30650
30974
  }) {
30651
- const feeDataCacheRef = useRef11({});
30975
+ const feeDataCacheRef = useRef12({});
30652
30976
  const { isSubmitting, submitTransaction } = useTransactionSubmit();
30653
30977
  const { trackEvent } = useGTM(GTM_ID);
30654
30978
  const destinationConfig = (() => {
@@ -30661,7 +30985,7 @@ function useTransactionActionModel({
30661
30985
  const chainType = selectedChain?.type ?? selectedChain?.chainType;
30662
30986
  const chainTypeNormalized = (chainType ?? "").toLowerCase();
30663
30987
  const isEvm = chainTypeNormalized === "evm";
30664
- const backendChainId2 = useMemo19(() => {
30988
+ const backendChainId2 = useMemo20(() => {
30665
30989
  const chainRef = routeResult?.txReq?.chainId ?? selectedChain?.networkIdentifier ?? selectedChain?.chainId ?? selectedChain?.id;
30666
30990
  if (chainRef == null) return null;
30667
30991
  return String(chainRef);
@@ -30671,7 +30995,7 @@ function useTransactionActionModel({
30671
30995
  selectedChain?.id,
30672
30996
  selectedChain?.networkIdentifier
30673
30997
  ]);
30674
- const selectedTokenOnBackendChain = useMemo19(() => {
30998
+ const selectedTokenOnBackendChain = useMemo20(() => {
30675
30999
  if (!backendChainId2) return false;
30676
31000
  const target = normalizeChainKey2(backendChainId2);
30677
31001
  return [
@@ -30688,22 +31012,22 @@ function useTransactionActionModel({
30688
31012
  selectedChain?.id,
30689
31013
  selectedChain?.networkIdentifier
30690
31014
  ]);
30691
- const isNativeSelected = useMemo19(() => {
31015
+ const isNativeSelected = useMemo20(() => {
30692
31016
  const address = selectedToken?.address;
30693
31017
  return isNativeTokenAddress(address, chainType) || isZeroAddrLike(address, chainType) || normalizeTokenAddressForCompare(selectedChain, address) === normalizeTokenAddressForCompare(
30694
31018
  selectedChain,
30695
31019
  getNativeTokenAddress2(chainType)
30696
31020
  );
30697
31021
  }, [chainType, selectedChain, selectedToken?.address]);
30698
- const spender = useMemo19(() => {
31022
+ const spender = useMemo20(() => {
30699
31023
  const txReq = routeResult?.txReq;
30700
31024
  const addr = txReq?.to ?? txReq?.target;
30701
31025
  return addr ?? null;
30702
31026
  }, [routeResult?.txReq]);
30703
- const [allowanceWei, setAllowanceWei] = useState24(0n);
30704
- const [isReadingAllowance, setIsReadingAllowance] = useState24(false);
30705
- const [isApproving, setIsApproving] = useState24(false);
30706
- 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);
30707
31031
  const readAllowance = useCallback19(async () => {
30708
31032
  if (!isEvm || isNativeSelected || !!routeResult?.sponsorship || // sponsored routes: SA approves bridge inside the UO batch
30709
31033
  !backendChainId2 || !selectedTokenOnBackendChain || !walletAddress || !spender || !selectedToken?.address) {
@@ -30734,7 +31058,7 @@ function useTransactionActionModel({
30734
31058
  spender,
30735
31059
  walletAddress
30736
31060
  ]);
30737
- useEffect24(() => {
31061
+ useEffect25(() => {
30738
31062
  void readAllowance();
30739
31063
  }, [readAllowance]);
30740
31064
  const needsApproval = isEvm && !isNativeSelected && !routeResult?.sponsorship && // sponsored routes use Permit2 + SA internal batch — no EOA bridge approval
@@ -30938,13 +31262,13 @@ function useTransactionActionModel({
30938
31262
  routeResult?.txReq,
30939
31263
  walletAddress
30940
31264
  ]);
30941
- useEffect24(() => {
31265
+ useEffect25(() => {
30942
31266
  if (routeResult) {
30943
31267
  void estimateGasReservationWei();
30944
31268
  }
30945
31269
  }, [estimateGasReservationWei, routeResult]);
30946
- const [smartAccountFailed, setSmartAccountFailed] = useState24(false);
30947
- useEffect24(() => {
31270
+ const [smartAccountFailed, setSmartAccountFailed] = useState25(false);
31271
+ useEffect25(() => {
30948
31272
  setSmartAccountFailed(false);
30949
31273
  }, [routeResult?.intentId]);
30950
31274
  const handleConfirm = useCallback19(async () => {
@@ -31048,7 +31372,7 @@ function useTransactionActionModel({
31048
31372
  ]);
31049
31373
  const isWalletConnected = walletStatus === "connected";
31050
31374
  const canSwipe = parsedAmount > 0 && !!selectedToken && isWalletConnected && !isLoadingRoute && !isSubmitting && !!routeResult && !actionErrorMessage && !isApproving && !isReadingAllowance;
31051
- const swipeResetKey = useMemo19(() => {
31375
+ const swipeResetKey = useMemo20(() => {
31052
31376
  const tokenAddress = selectedToken ? normalizeAddress2(
31053
31377
  selectedToken.address,
31054
31378
  selectedToken?.chainData?.type ?? selectedToken?.chainData?.chainType
@@ -31278,12 +31602,12 @@ var init_DefaultCryptoPay = __esm({
31278
31602
  });
31279
31603
 
31280
31604
  // src/widget/pages/CryptoPay/RouteQuoteLoader.tsx
31281
- import { useState as useState25, useEffect as useEffect25 } from "react";
31605
+ import { useState as useState26, useEffect as useEffect26 } from "react";
31282
31606
  import { jsx as jsx49, jsxs as jsxs39 } from "react/jsx-runtime";
31283
31607
  function RouteQuoteLoader({ selectedToken }) {
31284
- const [messageIndex, setMessageIndex] = useState25(0);
31285
- const [visible, setVisible] = useState25(true);
31286
- useEffect25(() => {
31608
+ const [messageIndex, setMessageIndex] = useState26(0);
31609
+ const [visible, setVisible] = useState26(true);
31610
+ useEffect26(() => {
31287
31611
  let t = null;
31288
31612
  const interval = setInterval(() => {
31289
31613
  setVisible(false);
@@ -31459,8 +31783,8 @@ var init_RouteQuoteLoader = __esm({
31459
31783
  });
31460
31784
 
31461
31785
  // src/widget/pages/CryptoPay/index.tsx
31462
- import { useEffect as useEffect26, useMemo as useMemo20 } from "react";
31463
- 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";
31464
31788
  function CryptoPay({ style: _style }) {
31465
31789
  const {
31466
31790
  amount,
@@ -31483,17 +31807,17 @@ function CryptoPay({ style: _style }) {
31483
31807
  const { goBack, setCurrentStep, currentStep } = useDepositNavigation();
31484
31808
  const config = useTrustwareConfig();
31485
31809
  const { fixedFromAmountString, isFixedAmount, minAmountUsd, maxAmountUsd } = useAmountConstraints();
31486
- const routeRefreshMs = useMemo20(() => {
31810
+ const routeRefreshMs = useMemo21(() => {
31487
31811
  const raw = config.routes?.options?.routeRefreshMs;
31488
31812
  const n = Number(raw);
31489
31813
  return Number.isFinite(n) && n > 0 ? n : void 0;
31490
31814
  }, [config.routes?.options?.routeRefreshMs]);
31491
31815
  const IsPos = (x) => x !== null && x !== void 0 && x.balance !== "0";
31492
- const showDefaultCryptoPay = useMemo20(() => {
31816
+ const showDefaultCryptoPay = useMemo21(() => {
31493
31817
  const nonZer0Tks = (yourWalletTokens ?? []).filter(IsPos);
31494
31818
  return !yourWalletTokensLoading && nonZer0Tks.length === 0 && yourWalletTokens.length > 0;
31495
31819
  }, [yourWalletTokens, yourWalletTokensLoading]);
31496
- const showSkeleton = useMemo20(() => {
31820
+ const showSkeleton = useMemo21(() => {
31497
31821
  return (yourWalletTokens ?? []).length === 0;
31498
31822
  }, [yourWalletTokens]);
31499
31823
  const isReady = selectedToken != null && selectedToken?.chainData !== void 0 && !showDefaultCryptoPay && !showSkeleton;
@@ -31569,7 +31893,7 @@ function CryptoPay({ style: _style }) {
31569
31893
  });
31570
31894
  const { emitError } = useTrustware();
31571
31895
  const readySelectedToken = isReady ? selectedToken : null;
31572
- useEffect26(() => {
31896
+ useEffect27(() => {
31573
31897
  if (currentStep !== "crypto-pay" || !actionErrorMessage) return;
31574
31898
  emitError?.(
31575
31899
  new TrustwareError({
@@ -31598,7 +31922,7 @@ function CryptoPay({ style: _style }) {
31598
31922
  if (isFixedAmount) return;
31599
31923
  setAmount(value.toString());
31600
31924
  };
31601
- const relayFeeUsd = useMemo20(
31925
+ const relayFeeUsd = useMemo21(
31602
31926
  () => computeRelayFeeUsd(routeResult, isNativeSelected),
31603
31927
  [isNativeSelected, routeResult]
31604
31928
  );
@@ -31699,7 +32023,7 @@ function CryptoPay({ style: _style }) {
31699
32023
  ]
31700
32024
  }
31701
32025
  ),
31702
- showSkeleton ? /* @__PURE__ */ jsx50(Fragment7, { children: /* @__PURE__ */ jsx50(
32026
+ showSkeleton ? /* @__PURE__ */ jsx50(Fragment8, { children: /* @__PURE__ */ jsx50(
31703
32027
  "div",
31704
32028
  {
31705
32029
  style: {
@@ -31710,8 +32034,8 @@ function CryptoPay({ style: _style }) {
31710
32034
  },
31711
32035
  children: /* @__PURE__ */ jsx50(LoadingSkeleton, {})
31712
32036
  }
31713
- ) }) : /* @__PURE__ */ jsxs40(Fragment7, { children: [
31714
- 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: [
31715
32039
  /* @__PURE__ */ jsx50(
31716
32040
  CryptoPayAmountSection,
31717
32041
  {
@@ -31790,7 +32114,7 @@ var init_CryptoPay = __esm({
31790
32114
  });
31791
32115
 
31792
32116
  // src/widget/pages/Processing.tsx
31793
- 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";
31794
32118
  import { jsx as jsx51, jsxs as jsxs41 } from "react/jsx-runtime";
31795
32119
  function getProgressFromStatus(status) {
31796
32120
  switch (status) {
@@ -31829,27 +32153,27 @@ function Processing({ style }) {
31829
32153
  const { resetState, setCurrentStep } = useDepositNavigation();
31830
32154
  const { transactionStatus, transactionHash, intentId } = useDepositTransaction();
31831
32155
  const { transaction, startPolling, isPolling } = useTransactionPolling();
31832
- const hasStartedPolling = useRef12(false);
31833
- useEffect27(() => {
32156
+ const hasStartedPolling = useRef13(false);
32157
+ useEffect28(() => {
31834
32158
  return () => {
31835
32159
  hasStartedPolling.current = false;
31836
32160
  };
31837
32161
  }, []);
31838
- useEffect27(() => {
32162
+ useEffect28(() => {
31839
32163
  if (intentId && transactionHash && !isPolling && !hasStartedPolling.current && transactionStatus !== "success" && transactionStatus !== "error") {
31840
32164
  hasStartedPolling.current = true;
31841
32165
  startPolling(intentId, transactionHash);
31842
32166
  }
31843
32167
  }, [intentId, transactionHash, isPolling, transactionStatus, startPolling]);
31844
- const progress = useMemo21(
32168
+ const progress = useMemo22(
31845
32169
  () => getProgressFromStatus(transactionStatus),
31846
32170
  [transactionStatus]
31847
32171
  );
31848
- const stepText = useMemo21(
32172
+ const stepText = useMemo22(
31849
32173
  () => getStepText(transactionStatus),
31850
32174
  [transactionStatus]
31851
32175
  );
31852
- const explorerUrl = useMemo21(() => {
32176
+ const explorerUrl = useMemo22(() => {
31853
32177
  if (transaction?.fromChainTxUrl) {
31854
32178
  return transaction.fromChainTxUrl;
31855
32179
  }
@@ -31995,15 +32319,15 @@ var init_Processing = __esm({
31995
32319
  });
31996
32320
 
31997
32321
  // src/widget/pages/Success.tsx
31998
- import { lazy, Suspense, useMemo as useMemo22 } from "react";
32322
+ import { lazy, Suspense, useMemo as useMemo23 } from "react";
31999
32323
  import { jsx as jsx52, jsxs as jsxs42 } from "react/jsx-runtime";
32000
32324
  function Success({ style }) {
32001
32325
  const { selectedToken, selectedChain, amount } = useDepositForm();
32002
32326
  const { resetState } = useDepositNavigation();
32003
32327
  const { transactionHash } = useDepositTransaction();
32004
32328
  const { transaction } = useTransactionPolling();
32005
- const parsedAmount = useMemo22(() => parseFloat(amount) || 0, [amount]);
32006
- const explorerUrl = useMemo22(() => {
32329
+ const parsedAmount = useMemo23(() => parseFloat(amount) || 0, [amount]);
32330
+ const explorerUrl = useMemo23(() => {
32007
32331
  if (transaction?.toChainTxUrl) {
32008
32332
  return transaction.toChainTxUrl;
32009
32333
  }
@@ -32224,7 +32548,7 @@ var init_mapError = __esm({
32224
32548
  });
32225
32549
 
32226
32550
  // src/widget/pages/Error.tsx
32227
- import { useMemo as useMemo23 } from "react";
32551
+ import { useMemo as useMemo24 } from "react";
32228
32552
  import { jsx as jsx53 } from "react/jsx-runtime";
32229
32553
  function Error2({ style: _style }) {
32230
32554
  const { selectedChain } = useDepositForm();
@@ -32235,8 +32559,8 @@ function Error2({ style: _style }) {
32235
32559
  setErrorMessage,
32236
32560
  transactionHash
32237
32561
  } = useDepositTransaction();
32238
- const mapped = useMemo23(() => mapError(errorMessage), [errorMessage]);
32239
- const explorerUrl = useMemo23(() => {
32562
+ const mapped = useMemo24(() => mapError(errorMessage), [errorMessage]);
32563
+ const explorerUrl = useMemo24(() => {
32240
32564
  if (transactionHash && selectedChain?.blockExplorerUrls?.length) {
32241
32565
  return `${selectedChain.blockExplorerUrls[0].replace(/\/+$/, "")}/tx/${transactionHash}`;
32242
32566
  }
@@ -32296,18 +32620,18 @@ var init_widgetSteps = __esm({
32296
32620
  });
32297
32621
 
32298
32622
  // src/widget/app/WidgetRouter.tsx
32299
- import { useMemo as useMemo24 } from "react";
32623
+ import { useMemo as useMemo25 } from "react";
32300
32624
  import { jsx as jsx54 } from "react/jsx-runtime";
32301
32625
  function WidgetRouter({
32302
32626
  currentStep,
32303
32627
  navigationDirection,
32304
32628
  stepHistory
32305
32629
  }) {
32306
- const PageComponent = useMemo24(
32630
+ const PageComponent = useMemo25(
32307
32631
  () => PAGE_COMPONENTS[currentStep],
32308
32632
  [currentStep]
32309
32633
  );
32310
- const animationClass = useMemo24(() => {
32634
+ const animationClass = useMemo25(() => {
32311
32635
  return navigationDirection === "forward" ? "tw-animate-slide-in-right" : "tw-animate-slide-in-left";
32312
32636
  }, [navigationDirection]);
32313
32637
  return /* @__PURE__ */ jsx54(
@@ -32335,14 +32659,14 @@ var init_WidgetRouter = __esm({
32335
32659
  });
32336
32660
 
32337
32661
  // src/modes/swap/hooks/useSwapRoute.ts
32338
- 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";
32339
32663
  function useSwapRoute() {
32340
- const [state, setState] = useState26({
32664
+ const [state, setState] = useState27({
32341
32665
  data: null,
32342
32666
  loading: false,
32343
32667
  error: null
32344
32668
  });
32345
- const abortRef = useRef13(false);
32669
+ const abortRef = useRef14(false);
32346
32670
  const fetch2 = useCallback20(
32347
32671
  async (params) => {
32348
32672
  const { fromToken, fromChain, toToken, toChain, amount, walletAddress } = params;
@@ -32401,7 +32725,7 @@ var init_useSwapRoute = __esm({
32401
32725
  });
32402
32726
 
32403
32727
  // src/modes/swap/hooks/useSwapExecution.ts
32404
- 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";
32405
32729
  import { encodeFunctionData as encodeFunctionData9, erc20Abi as erc20Abi2 } from "viem";
32406
32730
  function normalizeTx(raw) {
32407
32731
  const r = raw;
@@ -32436,7 +32760,7 @@ async function waitForApprovalConfirmation(chainId, txHash) {
32436
32760
  throw new Error("Timed out waiting for approval confirmation");
32437
32761
  }
32438
32762
  function useSwapExecution(fromChain) {
32439
- const [state, setState] = useState27({
32763
+ const [state, setState] = useState28({
32440
32764
  txStatus: "idle",
32441
32765
  txHash: null,
32442
32766
  intentId: null,
@@ -32445,11 +32769,11 @@ function useSwapExecution(fromChain) {
32445
32769
  isSubmitting: false,
32446
32770
  allowanceStatus: "unknown"
32447
32771
  });
32448
- const saFailedUntilRef = useRef14(0);
32449
- const pollingRef = useRef14(null);
32450
- const timeoutRef = useRef14(null);
32451
- const abortRef = useRef14(false);
32452
- 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);
32453
32777
  const clearPolling = useCallback21(() => {
32454
32778
  abortRef.current = true;
32455
32779
  if (pollingRef.current) clearTimeout(pollingRef.current);
@@ -32812,13 +33136,13 @@ var init_forex = __esm({
32812
33136
  });
32813
33137
 
32814
33138
  // src/modes/swap/hooks/useForex.ts
32815
- 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";
32816
33140
  function useForex() {
32817
- const [rates, setRates] = useState28({ USD: 1 });
32818
- const [error, setError] = useState28(null);
32819
- const [lastUpdated, setLastUpdated] = useState28(null);
32820
- const timerRef = useRef15(null);
32821
- 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(() => {
32822
33146
  let cancelled = false;
32823
33147
  const load = () => {
32824
33148
  fetchForexRates("USD").then((r) => {
@@ -32855,7 +33179,7 @@ var init_useForex = __esm({
32855
33179
  });
32856
33180
 
32857
33181
  // src/modes/swap/components/SwapTokenSelect.tsx
32858
- 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";
32859
33183
  import { jsx as jsx55, jsxs as jsxs43 } from "react/jsx-runtime";
32860
33184
  function SwapTokenSelect({
32861
33185
  side,
@@ -32871,10 +33195,10 @@ function SwapTokenSelect({
32871
33195
  allowedTokens,
32872
33196
  excludeToken
32873
33197
  }) {
32874
- const [localChain, setLocalChain] = useState29(initialChain);
32875
- const [pinnedTokens, setPinnedTokens] = useState29([]);
32876
- const [pinnedLoading, setPinnedLoading] = useState29(false);
32877
- useEffect29(() => {
33198
+ const [localChain, setLocalChain] = useState30(initialChain);
33199
+ const [pinnedTokens, setPinnedTokens] = useState30([]);
33200
+ const [pinnedLoading, setPinnedLoading] = useState30(false);
33201
+ useEffect30(() => {
32878
33202
  if (!allowedTokens || allowedTokens.length === 0 || !localChain) {
32879
33203
  setPinnedTokens([]);
32880
33204
  return;
@@ -32955,26 +33279,26 @@ function SwapTokenSelect({
32955
33279
  walletAddress,
32956
33280
  yourWalletTokens
32957
33281
  });
32958
- const allowedSet = useMemo25(() => {
33282
+ const allowedSet = useMemo26(() => {
32959
33283
  if (!allowedTokens || allowedTokens.length === 0) return null;
32960
33284
  return new Set(
32961
33285
  allowedTokens.map((t) => `${t.chainId}:${t.address.toLowerCase()}`)
32962
33286
  );
32963
33287
  }, [allowedTokens]);
32964
- const filteredWalletTokens = useMemo25(() => {
33288
+ const filteredWalletTokens = useMemo26(() => {
32965
33289
  if (!allowedSet) return rawWalletTokens;
32966
33290
  return rawWalletTokens.filter(
32967
33291
  (t) => allowedSet.has(`${Number(t.chainId)}:${t.address.toLowerCase()}`)
32968
33292
  );
32969
33293
  }, [rawWalletTokens, allowedSet]);
32970
33294
  const excludeKey = excludeToken ? `${Number(excludeToken.chainId)}:${excludeToken.address.toLowerCase()}` : null;
32971
- const visibleTokens = useMemo25(() => {
33295
+ const visibleTokens = useMemo26(() => {
32972
33296
  if (!excludeKey) return filteredTokens;
32973
33297
  return filteredTokens.filter(
32974
33298
  (t) => `${Number(t.chainId)}:${t.address.toLowerCase()}` !== excludeKey
32975
33299
  );
32976
33300
  }, [filteredTokens, excludeKey]);
32977
- const visibleWalletTokens = useMemo25(() => {
33301
+ const visibleWalletTokens = useMemo26(() => {
32978
33302
  if (!excludeKey) return filteredWalletTokens;
32979
33303
  return filteredWalletTokens.filter(
32980
33304
  (t) => `${Number(t.chainId)}:${t.address.toLowerCase()}` !== excludeKey
@@ -33103,8 +33427,8 @@ var init_SwapTokenSelect = __esm({
33103
33427
  });
33104
33428
 
33105
33429
  // src/modes/swap/components/SwapWalletSelector.tsx
33106
- import { useEffect as useEffect30, useMemo as useMemo26, useRef as useRef16, useState as useState30 } from "react";
33107
- 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";
33108
33432
  function SwapWalletSelector({
33109
33433
  walletStatus,
33110
33434
  walletAddress,
@@ -33120,16 +33444,16 @@ function SwapWalletSelector({
33120
33444
  } = useWalletInfo();
33121
33445
  const walletConnectCfg = TrustwareConfigStore.peek()?.walletConnect;
33122
33446
  const connectWC = useWalletConnectConnect(walletConnectCfg);
33123
- const [wcConnecting, setWcConnecting] = useState30(false);
33124
- const [connectingId, setConnectingId] = useState30(null);
33125
- const [timerExpired, setTimerExpired] = useState30(false);
33126
- const [selectedNamespace, setSelectedNamespace] = useState30("evm");
33127
- const prevStatusRef = useRef16(walletStatus);
33128
- 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(() => {
33129
33453
  const t = setTimeout(() => setTimerExpired(true), 450);
33130
33454
  return () => clearTimeout(t);
33131
33455
  }, []);
33132
- useEffect30(() => {
33456
+ useEffect31(() => {
33133
33457
  const prev = prevStatusRef.current;
33134
33458
  if (prev !== walletStatus) {
33135
33459
  if (prev === "connecting" && (walletStatus === "connected" || walletStatus === "error")) {
@@ -33138,7 +33462,7 @@ function SwapWalletSelector({
33138
33462
  prevStatusRef.current = walletStatus;
33139
33463
  }
33140
33464
  }, [walletStatus]);
33141
- const filteredWallets = useMemo26(
33465
+ const filteredWallets = useMemo27(
33142
33466
  () => detected.filter(
33143
33467
  (w) => (w.meta?.ecosystem ?? "").toLowerCase() === selectedNamespace
33144
33468
  ),
@@ -33562,7 +33886,7 @@ function SwapWalletSelector({
33562
33886
  })
33563
33887
  }
33564
33888
  ),
33565
- selectedNamespace === "evm" && /* @__PURE__ */ jsxs44(Fragment8, { children: [
33889
+ selectedNamespace === "evm" && /* @__PURE__ */ jsxs44(Fragment9, { children: [
33566
33890
  /* @__PURE__ */ jsx56(
33567
33891
  "div",
33568
33892
  {
@@ -33803,13 +34127,13 @@ import {
33803
34127
  lazy as lazy2,
33804
34128
  Suspense as Suspense2,
33805
34129
  useCallback as useCallback22,
33806
- useEffect as useEffect31,
33807
- useMemo as useMemo27,
33808
- useRef as useRef17,
33809
- useState as useState31
34130
+ useEffect as useEffect32,
34131
+ useMemo as useMemo28,
34132
+ useRef as useRef18,
34133
+ useState as useState32
33810
34134
  } from "react";
33811
34135
  import ReactDOM from "react-dom";
33812
- 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";
33813
34137
  function fmtAmount(n, max = 6) {
33814
34138
  if (!isFinite(n) || n === 0) return "0";
33815
34139
  return n.toLocaleString(void 0, { maximumFractionDigits: max });
@@ -33901,36 +34225,36 @@ function SwapMode({
33901
34225
  theme: themeProp,
33902
34226
  style
33903
34227
  }) {
33904
- const [stage, setStage] = useState31("home");
33905
- const [fromToken, setFromToken] = useState31(
34228
+ const [stage, setStage] = useState32("home");
34229
+ const [fromToken, setFromToken] = useState32(
33906
34230
  null
33907
34231
  );
33908
- const [fromChain, setFromChain] = useState31(null);
33909
- const [toToken, setToToken] = useState31(null);
33910
- const [toChain, setToChain] = useState31(null);
33911
- const [amount, setAmount] = useState31("");
33912
- 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(
33913
34237
  "usd"
33914
34238
  );
33915
- const [hoverSell, setHoverSell] = useState31(false);
33916
- const [showRateDetails, setShowRateDetails] = useState31(false);
33917
- const [showReviewDetails, setShowReviewDetails] = useState31(false);
33918
- const [showSettings, setShowSettings] = useState31(false);
33919
- const [maxApproval, setMaxApproval] = useState31(false);
33920
- const [slippage, setSlippage] = useState31(0.5);
33921
- const [slippageInput, setSlippageInput] = useState31("");
33922
- const [selectedCurrency, setSelectedCurrency] = useState31("USD");
33923
- const [showCurrencyDropdown, setShowCurrencyDropdown] = useState31(false);
33924
- const [completedAt, setCompletedAt] = useState31(null);
33925
- const [copiedHash, setCopiedHash] = useState31(null);
33926
- const [rateUpdated, setRateUpdated] = useState31(false);
33927
- const prevToAmountRef = useRef17(null);
33928
- const [destAddress, setDestAddress] = useState31("");
33929
- const [quoteAge, setQuoteAge] = useState31(0);
33930
- const quoteTimestampRef = useRef17(null);
33931
- const [quoteLoadingMsgIdx, setQuoteLoadingMsgIdx] = useState31(0);
33932
- const [quoteLoadingMsgVisible, setQuoteLoadingMsgVisible] = useState31(true);
33933
- 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);
33934
34258
  const { rates: forexRates } = useForex();
33935
34259
  const currencyMeta = getCurrencyMeta(selectedCurrency);
33936
34260
  const currencyRate = forexRates[selectedCurrency] ?? 1;
@@ -33946,8 +34270,8 @@ function SwapMode({
33946
34270
  },
33947
34271
  [currencyRate, selectedCurrency]
33948
34272
  );
33949
- const settingsRef = useRef17(null);
33950
- const currencyDropdownRef = useRef17(null);
34273
+ const settingsRef = useRef18(null);
34274
+ const currencyDropdownRef = useRef18(null);
33951
34275
  const { emitEvent } = useTrustware();
33952
34276
  const { features, theme: configTheme } = useTrustwareConfig();
33953
34277
  const effectiveThemeSetting = themeProp ?? configTheme ?? "system";
@@ -33963,26 +34287,26 @@ function SwapMode({
33963
34287
  isLoading: chainsLoading,
33964
34288
  error: chainsError
33965
34289
  } = useChains();
33966
- const allowedDestChainIds = useMemo27(() => {
34290
+ const allowedDestChainIds = useMemo28(() => {
33967
34291
  if (!allowedDestTokens || allowedDestTokens.length === 0) return null;
33968
34292
  return new Set(allowedDestTokens.map((t) => t.chainId));
33969
34293
  }, [allowedDestTokens]);
33970
- const toPopularChains = useMemo27(
34294
+ const toPopularChains = useMemo28(
33971
34295
  () => allowedDestChainIds ? popularChains.filter(
33972
34296
  (c) => allowedDestChainIds.has(Number(c.chainId))
33973
34297
  ) : popularChains,
33974
34298
  [popularChains, allowedDestChainIds]
33975
34299
  );
33976
- const toOtherChains = useMemo27(
34300
+ const toOtherChains = useMemo28(
33977
34301
  () => allowedDestChainIds ? otherChains.filter((c) => allowedDestChainIds.has(Number(c.chainId))) : otherChains,
33978
34302
  [otherChains, allowedDestChainIds]
33979
34303
  );
33980
- const allChains = useMemo27(
34304
+ const allChains = useMemo28(
33981
34305
  () => [...popularChains, ...otherChains],
33982
34306
  [popularChains, otherChains]
33983
34307
  );
33984
- const destInitialized = useRef17(false);
33985
- useEffect31(() => {
34308
+ const destInitialized = useRef18(false);
34309
+ useEffect32(() => {
33986
34310
  if (!defaultDestRef || destInitialized.current || allChains.length === 0)
33987
34311
  return;
33988
34312
  const chain = allChains.find(
@@ -34030,18 +34354,18 @@ function SwapMode({
34030
34354
  });
34031
34355
  const route = useSwapRoute();
34032
34356
  const execution = useSwapExecution(fromChain);
34033
- const fromTokenPriceUSD = useMemo27(() => {
34357
+ const fromTokenPriceUSD = useMemo28(() => {
34034
34358
  const p = fromToken?.usdPrice;
34035
34359
  return typeof p === "number" && Number.isFinite(p) && p > 0 ? p : 0;
34036
34360
  }, [fromToken]);
34037
34361
  const hasFromUsdPrice = fromTokenPriceUSD > 0;
34038
- const toTokenPriceUSD = useMemo27(() => {
34362
+ const toTokenPriceUSD = useMemo28(() => {
34039
34363
  const p = toToken?.usdPrice;
34040
34364
  return typeof p === "number" && Number.isFinite(p) && p > 0 ? p : 0;
34041
34365
  }, [toToken]);
34042
34366
  const hasToUsdPrice = toTokenPriceUSD > 0;
34043
34367
  const rawSellNum = parseFloat(amount) || 0;
34044
- const usdSellNum = useMemo27(() => {
34368
+ const usdSellNum = useMemo28(() => {
34045
34369
  if (amountInputMode === "usd") return rawSellNum / currencyRate;
34046
34370
  return hasFromUsdPrice ? rawSellNum * fromTokenPriceUSD : 0;
34047
34371
  }, [
@@ -34051,7 +34375,7 @@ function SwapMode({
34051
34375
  hasFromUsdPrice,
34052
34376
  fromTokenPriceUSD
34053
34377
  ]);
34054
- const tokenSellNum = useMemo27(() => {
34378
+ const tokenSellNum = useMemo28(() => {
34055
34379
  if (amountInputMode === "usd") {
34056
34380
  return hasFromUsdPrice && fromTokenPriceUSD > 0 ? usdSellNum / fromTokenPriceUSD : 0;
34057
34381
  }
@@ -34063,7 +34387,7 @@ function SwapMode({
34063
34387
  hasFromUsdPrice,
34064
34388
  fromTokenPriceUSD
34065
34389
  ]);
34066
- const tokenAmountStr = useMemo27(() => {
34390
+ const tokenAmountStr = useMemo28(() => {
34067
34391
  if (tokenSellNum <= 0) return "";
34068
34392
  const decimals = fromToken?.decimals ?? 18;
34069
34393
  return truncateDecimal(tokenSellNum, Math.min(decimals, 18));
@@ -34274,7 +34598,7 @@ function SwapMode({
34274
34598
  fromToken?.decimals,
34275
34599
  route
34276
34600
  ]);
34277
- const fromBalance = useMemo27(() => {
34601
+ const fromBalance = useMemo28(() => {
34278
34602
  const walletToken = fromToken;
34279
34603
  if (!walletToken || !("balance" in walletToken)) return null;
34280
34604
  const raw = walletToken.balance;
@@ -34284,7 +34608,7 @@ function SwapMode({
34284
34608
  return Number.isFinite(n) ? n : null;
34285
34609
  }, [fromToken]);
34286
34610
  const balanceUsd = fromBalance !== null && hasFromUsdPrice ? fromBalance * fromTokenPriceUSD : null;
34287
- const estimatedToAmount = useMemo27(() => {
34611
+ const estimatedToAmount = useMemo28(() => {
34288
34612
  if (tokenSellNum <= 0 || !hasFromUsdPrice || !hasToUsdPrice) return null;
34289
34613
  return tokenSellNum * (fromTokenPriceUSD / toTokenPriceUSD);
34290
34614
  }, [
@@ -34294,10 +34618,10 @@ function SwapMode({
34294
34618
  hasFromUsdPrice,
34295
34619
  hasToUsdPrice
34296
34620
  ]);
34297
- const backendToUsdStr = useMemo27(() => {
34621
+ const backendToUsdStr = useMemo28(() => {
34298
34622
  return route.data?.finalExchangeRate?.toAmountMinUSD ?? route.data?.route?.estimate?.toAmountMinUsd ?? route.data?.route?.estimate?.toAmountUsd ?? null;
34299
34623
  }, [route.data]);
34300
- const toAmount = useMemo27(() => {
34624
+ const toAmount = useMemo28(() => {
34301
34625
  if (backendToUsdStr && toTokenPriceUSD > 0) {
34302
34626
  const usd = parseFloat(backendToUsdStr);
34303
34627
  if (Number.isFinite(usd) && usd > 0) return usd / toTokenPriceUSD;
@@ -34323,7 +34647,7 @@ function SwapMode({
34323
34647
  estimatedToAmount
34324
34648
  ]);
34325
34649
  const fromUsd = usdSellNum;
34326
- const toUsd = useMemo27(() => {
34650
+ const toUsd = useMemo28(() => {
34327
34651
  if (backendToUsdStr) {
34328
34652
  const n = parseFloat(backendToUsdStr);
34329
34653
  if (Number.isFinite(n) && n > 0) return n;
@@ -34334,12 +34658,12 @@ function SwapMode({
34334
34658
  const isEstimate = !route.data;
34335
34659
  const USD_EPSILON = 1e-3;
34336
34660
  const displayToUsd = toUsd > USD_EPSILON ? toUsd : estimatedToAmount !== null && hasToUsdPrice ? estimatedToAmount * toTokenPriceUSD : 0;
34337
- const priceImpact = useMemo27(() => {
34661
+ const priceImpact = useMemo28(() => {
34338
34662
  if (!route.data || fromUsd < 0.01 || displayToUsd < 0.01) return null;
34339
34663
  const impact = 1 - displayToUsd / fromUsd;
34340
34664
  return impact > 1e-3 ? impact : null;
34341
34665
  }, [route.data, fromUsd, displayToUsd]);
34342
- const routePath = useMemo27(() => {
34666
+ const routePath = useMemo28(() => {
34343
34667
  if (!route.data) return null;
34344
34668
  const provider = route.data.route?.provider;
34345
34669
  const steps = route.data.route?.steps;
@@ -34366,19 +34690,19 @@ function SwapMode({
34366
34690
  return null;
34367
34691
  }, [route.data, fromToken?.symbol, toToken?.symbol]);
34368
34692
  const isGasSponsored = !!route.data?.sponsorship;
34369
- const networkCostUsd = useMemo27(() => {
34693
+ const networkCostUsd = useMemo28(() => {
34370
34694
  const fees = route.data?.route?.estimate?.fees;
34371
34695
  if (!fees?.length) return null;
34372
34696
  const gasTotal = fees.filter((f) => f.type?.toLowerCase().includes("gas")).reduce((sum, f) => sum + (Number(f.amountUsd) || 0), 0);
34373
34697
  return gasTotal > 0 ? gasTotal : null;
34374
34698
  }, [route.data]);
34375
- const protocolFeeUsd = useMemo27(() => {
34699
+ const protocolFeeUsd = useMemo28(() => {
34376
34700
  const fees = route.data?.route?.estimate?.fees;
34377
34701
  if (!fees?.length) return null;
34378
34702
  const total = fees.filter((f) => !f.type?.toLowerCase().includes("gas")).reduce((sum, f) => sum + (Number(f.amountUsd) || 0), 0);
34379
34703
  return total > 0 ? total : null;
34380
34704
  }, [route.data]);
34381
- const exchangeRate = useMemo27(() => {
34705
+ const exchangeRate = useMemo28(() => {
34382
34706
  if (!hasFromUsdPrice || !hasToUsdPrice) return null;
34383
34707
  return toTokenPriceUSD / fromTokenPriceUSD;
34384
34708
  }, [fromTokenPriceUSD, toTokenPriceUSD, hasFromUsdPrice, hasToUsdPrice]);
@@ -34387,13 +34711,13 @@ function SwapMode({
34387
34711
  const hasAmount = rawSellNum > 0 && (amountInputMode === "token" || hasFromUsdPrice);
34388
34712
  const isConnected = walletStatus === "connected" && !!walletAddress;
34389
34713
  const canGetQuote = hasTokens && hasAmount && !insufficient && isConnected && (!needsDestAddress || isValidDestAddress);
34390
- useEffect31(() => {
34714
+ useEffect32(() => {
34391
34715
  if (!fromToken) return;
34392
34716
  if (!hasFromUsdPrice && amountInputMode === "usd") {
34393
34717
  setAmountInputMode("token");
34394
34718
  }
34395
34719
  }, [fromToken, hasFromUsdPrice, amountInputMode]);
34396
- useEffect31(() => {
34720
+ useEffect32(() => {
34397
34721
  if (displayToAmount === null) {
34398
34722
  prevToAmountRef.current = null;
34399
34723
  return;
@@ -34407,14 +34731,14 @@ function SwapMode({
34407
34731
  const t = setTimeout(() => setRateUpdated(false), 700);
34408
34732
  return () => clearTimeout(t);
34409
34733
  }, [displayToAmount]);
34410
- useEffect31(() => {
34734
+ useEffect32(() => {
34411
34735
  setDestAddress("");
34412
34736
  }, [toChainType]);
34413
- const fetchRef = useRef17(route.fetch);
34414
- useEffect31(() => {
34737
+ const fetchRef = useRef18(route.fetch);
34738
+ useEffect32(() => {
34415
34739
  fetchRef.current = route.fetch;
34416
34740
  });
34417
- useEffect31(() => {
34741
+ useEffect32(() => {
34418
34742
  if (!canGetQuote || stage !== "home") return;
34419
34743
  if (!fromToken || !fromChain || !toToken || !toChain || !walletAddress)
34420
34744
  return;
@@ -34443,7 +34767,7 @@ function SwapMode({
34443
34767
  destAddress,
34444
34768
  slippage
34445
34769
  ]);
34446
- useEffect31(() => {
34770
+ useEffect32(() => {
34447
34771
  if (!canGetQuote || !fromToken || !fromChain || !toToken || !toChain || !walletAddress) {
34448
34772
  latestFetchParamsRef.current = null;
34449
34773
  return;
@@ -34470,12 +34794,12 @@ function SwapMode({
34470
34794
  destAddress,
34471
34795
  slippage
34472
34796
  ]);
34473
- useEffect31(() => {
34797
+ useEffect32(() => {
34474
34798
  quoteTimestampRef.current = route.data ? Date.now() : null;
34475
34799
  setQuoteAge(0);
34476
34800
  }, [route.data]);
34477
- const msgTimeoutRef = useRef17(null);
34478
- useEffect31(() => {
34801
+ const msgTimeoutRef = useRef18(null);
34802
+ useEffect32(() => {
34479
34803
  if (!route.loading) {
34480
34804
  setQuoteLoadingMsgIdx(0);
34481
34805
  setQuoteLoadingMsgVisible(true);
@@ -34493,7 +34817,7 @@ function SwapMode({
34493
34817
  if (msgTimeoutRef.current !== null) clearTimeout(msgTimeoutRef.current);
34494
34818
  };
34495
34819
  }, [route.loading]);
34496
- useEffect31(() => {
34820
+ useEffect32(() => {
34497
34821
  if (!route.data) return;
34498
34822
  const id = setInterval(() => {
34499
34823
  const ts = quoteTimestampRef.current;
@@ -34507,7 +34831,7 @@ function SwapMode({
34507
34831
  }, 1e3);
34508
34832
  return () => clearInterval(id);
34509
34833
  }, [route.data]);
34510
- useEffect31(() => {
34834
+ useEffect32(() => {
34511
34835
  if (stage !== "review") return;
34512
34836
  if (!route.data || !walletAddress) return;
34513
34837
  const fromTokenAddress = fromToken?.address;
@@ -34518,7 +34842,7 @@ function SwapMode({
34518
34842
  routeResult: route.data
34519
34843
  });
34520
34844
  }, [stage, route.data, walletAddress, fromToken]);
34521
- useEffect31(() => {
34845
+ useEffect32(() => {
34522
34846
  if (!showSettings) {
34523
34847
  setShowCurrencyDropdown(false);
34524
34848
  return;
@@ -34531,7 +34855,7 @@ function SwapMode({
34531
34855
  document.addEventListener("mousedown", handler);
34532
34856
  return () => document.removeEventListener("mousedown", handler);
34533
34857
  }, [showSettings]);
34534
- useEffect31(() => {
34858
+ useEffect32(() => {
34535
34859
  if (!showCurrencyDropdown) return;
34536
34860
  const handler = (e2) => {
34537
34861
  if (currencyDropdownRef.current && !currencyDropdownRef.current.contains(e2.target)) {
@@ -35018,7 +35342,7 @@ function SwapMode({
35018
35342
  padding: 0,
35019
35343
  transition: "color 0.15s"
35020
35344
  },
35021
- children: isCopied ? "Copied!" : /* @__PURE__ */ jsxs45(Fragment9, { children: [
35345
+ children: isCopied ? "Copied!" : /* @__PURE__ */ jsxs45(Fragment10, { children: [
35022
35346
  txHash.slice(0, 6),
35023
35347
  "\u2026",
35024
35348
  txHash.slice(-4),
@@ -37681,8 +38005,8 @@ function ReviewDetailRow({
37681
38005
  value,
37682
38006
  tooltip
37683
38007
  }) {
37684
- const iconRef = useRef17(null);
37685
- const [tipPos, setTipPos] = useState31(null);
38008
+ const iconRef = useRef18(null);
38009
+ const [tipPos, setTipPos] = useState32(null);
37686
38010
  const handleMouseEnter = () => {
37687
38011
  if (!tooltip || !iconRef.current) return;
37688
38012
  const r = iconRef.current.getBoundingClientRect();
@@ -38017,14 +38341,14 @@ var init_swap = __esm({
38017
38341
 
38018
38342
  // src/widget/TrustwareWidgetV2.tsx
38019
38343
  import {
38020
- useState as useState32,
38021
- useEffect as useEffect32,
38022
- useRef as useRef18,
38344
+ useState as useState33,
38345
+ useEffect as useEffect33,
38346
+ useRef as useRef19,
38023
38347
  useCallback as useCallback23,
38024
38348
  useImperativeHandle,
38025
38349
  forwardRef
38026
38350
  } from "react";
38027
- 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";
38028
38352
  function WidgetContent({
38029
38353
  style,
38030
38354
  onStateChange,
@@ -38035,7 +38359,7 @@ function WidgetContent({
38035
38359
  const { transactionHash, transactionStatus } = useDepositTransaction();
38036
38360
  const { resolvedTheme, toggleTheme } = useDepositUi();
38037
38361
  useWalletExternalDisconnect(() => setCurrentStep("home"));
38038
- useEffect32(() => {
38362
+ useEffect33(() => {
38039
38363
  const state = {
38040
38364
  currentStep,
38041
38365
  amount,
@@ -38078,7 +38402,7 @@ function WidgetInner({
38078
38402
  const { transactionStatus } = useDepositTransaction();
38079
38403
  const { resolvedTheme } = useDepositUi();
38080
38404
  const { status, revalidate, errors } = useTrustware();
38081
- const [showConfirmDialog, setShowConfirmDialog] = useState32(false);
38405
+ const [showConfirmDialog, setShowConfirmDialog] = useState33(false);
38082
38406
  const handleCloseRequest = useCallback23(() => {
38083
38407
  if (ACTIVE_TRANSACTION_STATUSES.includes(transactionStatus)) {
38084
38408
  setShowConfirmDialog(true);
@@ -38090,7 +38414,7 @@ function WidgetInner({
38090
38414
  onClose?.();
38091
38415
  }
38092
38416
  }, [transactionStatus, onClose, resetState]);
38093
- useEffect32(() => {
38417
+ useEffect33(() => {
38094
38418
  closeRequestRef.current = handleCloseRequest;
38095
38419
  }, [handleCloseRequest, closeRequestRef]);
38096
38420
  const handleConfirmClose = useCallback23(() => {
@@ -38106,7 +38430,7 @@ function WidgetInner({
38106
38430
  const handleRefresh = useCallback23(() => {
38107
38431
  revalidate?.();
38108
38432
  }, [revalidate]);
38109
- return /* @__PURE__ */ jsxs46(Fragment10, { children: [
38433
+ return /* @__PURE__ */ jsxs46(Fragment11, { children: [
38110
38434
  /* @__PURE__ */ jsxs46(WidgetContainer, { theme: effectiveTheme, style, children: [
38111
38435
  /* @__PURE__ */ jsx58(
38112
38436
  WidgetContent,
@@ -38174,8 +38498,8 @@ var init_TrustwareWidgetV2 = __esm({
38174
38498
  onOpen,
38175
38499
  showThemeToggle = true
38176
38500
  }, ref) {
38177
- const [isOpen, setIsOpen] = useState32(defaultOpen);
38178
- const closeRequestRef = useRef18(null);
38501
+ const [isOpen, setIsOpen] = useState33(defaultOpen);
38502
+ const closeRequestRef = useRef19(null);
38179
38503
  const config = useTrustwareConfig();
38180
38504
  const effectiveInitialStep = initialStep;
38181
38505
  const open = useCallback23(() => {