@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.cjs CHANGED
@@ -585,7 +585,7 @@ var init_constants = __esm({
585
585
  "src/constants.ts"() {
586
586
  "use strict";
587
587
  SDK_NAME = "@trustware/sdk";
588
- SDK_VERSION = "1.1.9-staging.1";
588
+ SDK_VERSION = "1.1.9-staging.3";
589
589
  API_ROOT = "https://bv-staging-api.trustware.io";
590
590
  GTM_ID = "GTM-TZDGNCXB";
591
591
  API_PREFIX = "/api";
@@ -6239,12 +6239,25 @@ var init_connect = __esm({
6239
6239
  function formatDeepLink(id, currentUrl) {
6240
6240
  const enc = encodeURIComponent(currentUrl);
6241
6241
  switch (id) {
6242
+ // EVM
6242
6243
  case "metamask":
6243
6244
  return `metamask://dapp/${currentUrl}`;
6244
6245
  case "coinbase":
6245
6246
  return `coinbase://wallet/dapp?url=${enc}`;
6246
6247
  case "rainbow":
6247
6248
  return `rainbow://connect?uri=${enc}`;
6249
+ case "trust":
6250
+ return `https://link.trustwallet.com/open_url?coin_id=60&url=${enc}`;
6251
+ case "okx":
6252
+ return `okx://wallet/dapp/url?dappUrl=${enc}`;
6253
+ // Solana
6254
+ case "phantom-solana":
6255
+ return `phantom://browse/${enc}`;
6256
+ case "solflare":
6257
+ return `solflare://ul/v1/browse/${enc}`;
6258
+ case "backpack":
6259
+ return `https://backpack.app/ul/v1/browse/${enc}?ref=${enc}`;
6260
+ // No confirmed deep link scheme
6248
6261
  default:
6249
6262
  return void 0;
6250
6263
  }
@@ -6272,6 +6285,8 @@ var init_metadata = __esm({
6272
6285
  emoji: "\u{1F98A}",
6273
6286
  homepage: "https://metamask.io/",
6274
6287
  chromeWebStore: "https://chromewebstore.google.com/detail/metamask/nkbihfbeogaeaoehlefnkodbefgpgknn",
6288
+ ios: "https://apps.apple.com/app/metamask/id1438144202",
6289
+ android: "https://play.google.com/store/apps/details?id=io.metamask",
6275
6290
  detectFlags: ["isMetaMask"],
6276
6291
  deepLink: (url) => formatDeepLink("metamask", url) ?? ""
6277
6292
  },
@@ -6283,6 +6298,8 @@ var init_metadata = __esm({
6283
6298
  logo: `${ASSETS_BASE_URL}/assets/wallets/coinbase.svg`,
6284
6299
  emoji: "\u{1F7E6}",
6285
6300
  homepage: "https://www.coinbase.com/wallet",
6301
+ ios: "https://apps.apple.com/app/coinbase-wallet/id1278383455",
6302
+ android: "https://play.google.com/store/apps/details?id=org.toshi",
6286
6303
  detectFlags: ["isCoinbaseWallet"],
6287
6304
  deepLink: (url) => formatDeepLink("coinbase", url) ?? ""
6288
6305
  },
@@ -6294,6 +6311,7 @@ var init_metadata = __esm({
6294
6311
  logo: `${ASSETS_BASE_URL}/assets/wallets/walletconnect.svg`,
6295
6312
  emoji: "\u{1FA9D}",
6296
6313
  homepage: "https://walletconnect.com/"
6314
+ // No deep link — opens its own modal
6297
6315
  },
6298
6316
  {
6299
6317
  id: "rainbow",
@@ -6303,8 +6321,38 @@ var init_metadata = __esm({
6303
6321
  logo: `${ASSETS_BASE_URL}/assets/wallets/rainbow.svg`,
6304
6322
  emoji: "\u{1F308}",
6305
6323
  homepage: "https://rainbow.me/",
6306
- deepLink: (url) => formatDeepLink("rainbow", url) ?? "",
6307
- detectFlags: ["isRainbow"]
6324
+ ios: "https://apps.apple.com/app/rainbow-ethereum-wallet/id1457119021",
6325
+ android: "https://play.google.com/store/apps/details?id=me.rainbow",
6326
+ detectFlags: ["isRainbow"],
6327
+ deepLink: (url) => formatDeepLink("rainbow", url) ?? ""
6328
+ },
6329
+ {
6330
+ id: "trust",
6331
+ name: "Trust Wallet",
6332
+ category: "app",
6333
+ ecosystem: "multi",
6334
+ logo: `${ASSETS_BASE_URL}/assets/wallets/trust.svg`,
6335
+ emoji: "\u{1F6E1}\uFE0F",
6336
+ homepage: "https://trustwallet.com/",
6337
+ ios: "https://apps.apple.com/app/trust-crypto-bitcoin-wallet/id1288339409",
6338
+ android: "https://play.google.com/store/apps/details?id=com.wallet.crypto.trustapp",
6339
+ detectFlags: ["isTrustWallet"],
6340
+ deepLink: (url) => formatDeepLink("trust", url) ?? ""
6341
+ // ✅ Added
6342
+ },
6343
+ {
6344
+ id: "okx",
6345
+ name: "OKX",
6346
+ category: "injected",
6347
+ ecosystem: "evm",
6348
+ logo: `${ASSETS_BASE_URL}/assets/wallets/okx.svg`,
6349
+ emoji: "\u2B1B",
6350
+ homepage: "https://www.okx.com/web3",
6351
+ ios: "https://apps.apple.com/app/okx-buy-bitcoin-eth-crypto/id1327268470",
6352
+ android: "https://play.google.com/store/apps/details?id=com.okinc.okex.gp",
6353
+ detectFlags: ["isOkxWallet"],
6354
+ deepLink: (url) => formatDeepLink("okx", url) ?? ""
6355
+ // ✅ Added
6308
6356
  },
6309
6357
  {
6310
6358
  id: "phantom-evm",
@@ -6314,7 +6362,10 @@ var init_metadata = __esm({
6314
6362
  logo: `${ASSETS_BASE_URL}/assets/wallets/phantom.svg`,
6315
6363
  emoji: "\u{1F47B}",
6316
6364
  homepage: "https://phantom.app/",
6365
+ ios: "https://apps.apple.com/app/phantom-crypto-wallet/id1598432977",
6366
+ android: "https://play.google.com/store/apps/details?id=app.phantom",
6317
6367
  detectFlags: ["isPhantom"]
6368
+ // No EVM dapp browser deep link — falls back to app store
6318
6369
  },
6319
6370
  {
6320
6371
  id: "phantom-solana",
@@ -6324,18 +6375,9 @@ var init_metadata = __esm({
6324
6375
  logo: `${ASSETS_BASE_URL}/assets/wallets/phantom.svg`,
6325
6376
  emoji: "\u{1F47B}",
6326
6377
  homepage: "https://phantom.app/",
6327
- android: "https://play.google.com/store/apps/details?id=app.phantom",
6328
6378
  ios: "https://apps.apple.com/app/phantom-crypto-wallet/id1598432977",
6329
- deepLink: (url) => `phantom://browse/${encodeURIComponent(url)}`
6330
- },
6331
- {
6332
- id: "metamask-solana",
6333
- name: "MetaMask (Solana)",
6334
- category: "injected",
6335
- ecosystem: "solana",
6336
- logo: `${ASSETS_BASE_URL}/assets/wallets/metamask.svg`,
6337
- emoji: "\u{1F98A}",
6338
- homepage: "https://metamask.io/"
6379
+ android: "https://play.google.com/store/apps/details?id=app.phantom",
6380
+ deepLink: (url) => formatDeepLink("phantom-solana", url) ?? ""
6339
6381
  },
6340
6382
  {
6341
6383
  id: "solflare",
@@ -6345,7 +6387,9 @@ var init_metadata = __esm({
6345
6387
  logo: `${ASSETS_BASE_URL}/assets/wallets/solflare-logo.svg`,
6346
6388
  emoji: "\u2600\uFE0F",
6347
6389
  homepage: "https://solflare.com/",
6348
- deepLink: (url) => `solflare://ul/v1/browse/${encodeURIComponent(url)}`
6390
+ ios: "https://apps.apple.com/app/solflare-solana-wallet/id1580902717",
6391
+ android: "https://play.google.com/store/apps/details?id=com.solflare.mobile",
6392
+ deepLink: (url) => formatDeepLink("solflare", url) ?? ""
6349
6393
  },
6350
6394
  {
6351
6395
  id: "backpack",
@@ -6354,8 +6398,25 @@ var init_metadata = __esm({
6354
6398
  ecosystem: "solana",
6355
6399
  logo: `${ASSETS_BASE_URL}/assets/wallets/backpack-logo.svg`,
6356
6400
  emoji: "\u{1F392}",
6357
- homepage: "https://backpack.app/"
6401
+ homepage: "https://backpack.app/",
6402
+ ios: "https://apps.apple.com/app/backpack-crypto-wallet/id6445964121",
6403
+ android: "https://play.google.com/store/apps/details?id=app.backpack.mobile",
6404
+ deepLink: (url) => formatDeepLink("backpack", url) ?? ""
6405
+ // ✅ Added
6406
+ },
6407
+ {
6408
+ id: "metamask-solana",
6409
+ name: "MetaMask (Solana)",
6410
+ category: "injected",
6411
+ ecosystem: "solana",
6412
+ logo: `${ASSETS_BASE_URL}/assets/wallets/metamask.svg`,
6413
+ emoji: "\u{1F98A}",
6414
+ homepage: "https://metamask.io/",
6415
+ ios: "https://apps.apple.com/app/metamask/id1438144202",
6416
+ android: "https://play.google.com/store/apps/details?id=io.metamask"
6417
+ // No Solana-specific deep link for MetaMask
6358
6418
  },
6419
+ // ── Extension/desktop only — hidden on mobile ─────────────────────────────
6359
6420
  {
6360
6421
  id: "rabby",
6361
6422
  name: "Rabby",
@@ -6366,6 +6427,7 @@ var init_metadata = __esm({
6366
6427
  homepage: "https://rabby.io/",
6367
6428
  chromeWebStore: "https://chromewebstore.google.com/detail/rabby/acmacodkjbdgmoleebolmdjonilkdbch",
6368
6429
  detectFlags: ["isRabby"]
6430
+ // Extension only — no mobile app or deep link
6369
6431
  },
6370
6432
  {
6371
6433
  id: "brave",
@@ -6376,25 +6438,7 @@ var init_metadata = __esm({
6376
6438
  emoji: "\u{1F981}",
6377
6439
  homepage: "https://brave.com/wallet/",
6378
6440
  detectFlags: ["isBraveWallet"]
6379
- },
6380
- {
6381
- id: "okx",
6382
- name: "OKX",
6383
- category: "injected",
6384
- ecosystem: "evm",
6385
- logo: `${ASSETS_BASE_URL}/assets/wallets/okx.svg`,
6386
- emoji: "\u2B1B",
6387
- homepage: "https://www.okx.com/web3",
6388
- detectFlags: ["isOkxWallet"]
6389
- },
6390
- {
6391
- id: "zerion",
6392
- name: "Zerion",
6393
- category: "app",
6394
- ecosystem: "evm",
6395
- logo: `${ASSETS_BASE_URL}/assets/wallets/zerion.png`,
6396
- emoji: "\u{1F9FF}",
6397
- homepage: "https://zerion.io/wallet/"
6441
+ // Built into Brave browser — no standalone deep link
6398
6442
  },
6399
6443
  {
6400
6444
  id: "taho",
@@ -6405,16 +6449,7 @@ var init_metadata = __esm({
6405
6449
  emoji: "\u{1F7EA}",
6406
6450
  homepage: "https://taho.xyz/",
6407
6451
  detectFlags: ["isTally", "isTallyWallet", "isTahoWallet"]
6408
- },
6409
- {
6410
- id: "trust",
6411
- name: "Trust Wallet",
6412
- category: "app",
6413
- ecosystem: "multi",
6414
- logo: `${ASSETS_BASE_URL}/assets/wallets/trust.svg`,
6415
- emoji: "\u{1F6E1}\uFE0F",
6416
- homepage: "https://trustwallet.com/",
6417
- detectFlags: ["isTrustWallet"]
6452
+ // Extension only — no mobile app
6418
6453
  },
6419
6454
  {
6420
6455
  id: "bitget",
@@ -6424,7 +6459,22 @@ var init_metadata = __esm({
6424
6459
  logo: `${ASSETS_BASE_URL}/assets/wallets/bitget.svg`,
6425
6460
  emoji: "\u{1F7E9}",
6426
6461
  homepage: "https://web3.bitget.com/",
6462
+ ios: "https://apps.apple.com/app/bitget-wallet-ex-bitkeep/id1395301115",
6463
+ android: "https://play.google.com/store/apps/details?id=com.bitkeep.wallet",
6427
6464
  detectFlags: ["isBitGetWallet"]
6465
+ // No public deep link scheme documented
6466
+ },
6467
+ {
6468
+ id: "zerion",
6469
+ name: "Zerion",
6470
+ category: "app",
6471
+ ecosystem: "evm",
6472
+ logo: `${ASSETS_BASE_URL}/assets/wallets/zerion.png`,
6473
+ emoji: "\u{1F9FF}",
6474
+ homepage: "https://zerion.io/wallet/",
6475
+ ios: "https://apps.apple.com/app/zerion-crypto-defi-wallet/id1456732565",
6476
+ android: "https://play.google.com/store/apps/details?id=io.zerion.android"
6477
+ // Uses WalletConnect URI — not a simple page URL deep link
6428
6478
  },
6429
6479
  {
6430
6480
  id: "safe",
@@ -6433,7 +6483,10 @@ var init_metadata = __esm({
6433
6483
  ecosystem: "evm",
6434
6484
  logo: `${ASSETS_BASE_URL}/assets/wallets/safe.svg`,
6435
6485
  emoji: "\u{1F7E9}",
6436
- homepage: "https://safe.global/"
6486
+ homepage: "https://safe.global/",
6487
+ ios: "https://apps.apple.com/app/safe-gnosis-safe/id1515759131",
6488
+ android: "https://play.google.com/store/apps/details?id=io.gnosis.safe"
6489
+ // Uses WalletConnect — no dapp browser deep link
6437
6490
  },
6438
6491
  {
6439
6492
  id: "kucoin",
@@ -6442,7 +6495,10 @@ var init_metadata = __esm({
6442
6495
  ecosystem: "evm",
6443
6496
  logo: `${ASSETS_BASE_URL}/assets/wallets/kucoin.svg`,
6444
6497
  emoji: "\u{1F7E6}",
6445
- homepage: "https://www.kucoin.com/"
6498
+ homepage: "https://www.kucoin.com/",
6499
+ ios: "https://apps.apple.com/app/kucoin-buy-bitcoin-crypto/id1378956601",
6500
+ android: "https://play.google.com/store/apps/details?id=com.kubi.kucoin"
6501
+ // No public deep link scheme documented
6446
6502
  }
6447
6503
  ];
6448
6504
  }
@@ -6620,6 +6676,14 @@ function useWalletDetection(timeoutMs = 400) {
6620
6676
  );
6621
6677
  return { detected, detectedIds };
6622
6678
  }
6679
+ function useIsMobile() {
6680
+ const [isMobile, set] = (0, import_react9.useState)(false);
6681
+ (0, import_react9.useEffect)(() => {
6682
+ const ua = navigator.userAgent || "";
6683
+ set(/Android|iPhone|iPad|iPod/i.test(ua));
6684
+ }, []);
6685
+ return isMobile;
6686
+ }
6623
6687
  var import_react9, WALLET_BY_ID, DETECT_PRIORITY, GENERIC_FLAGS, RDNS_WALLET_MAP, NAME_WALLET_MAP;
6624
6688
  var init_detect = __esm({
6625
6689
  "src/wallets/detect.ts"() {
@@ -8173,6 +8237,7 @@ var init_wallets = __esm({
8173
8237
  init_adapters();
8174
8238
  init_solana();
8175
8239
  init_detect();
8240
+ init_metadata();
8176
8241
  }
8177
8242
  });
8178
8243
 
@@ -16024,7 +16089,7 @@ var init_WalletNamespaceTabs = __esm({
16024
16089
  });
16025
16090
 
16026
16091
  // src/widget/features/wallet/components/CryptoWalletDropdownContent.tsx
16027
- function CryptoWalletDropdownContent({
16092
+ function DesktopWalletDropdownContent({
16028
16093
  browserWallets,
16029
16094
  handleWalletConnect,
16030
16095
  handleWalletSelect
@@ -16088,7 +16153,263 @@ function CryptoWalletDropdownContent({
16088
16153
  }
16089
16154
  );
16090
16155
  }
16091
- var import_jsx_runtime36;
16156
+ function MobileWalletDropdownContent({
16157
+ handleWalletConnect
16158
+ }) {
16159
+ const { setCurrentStep } = useDepositNavigation();
16160
+ const { selectedNamespace } = useDepositWallet();
16161
+ const { walletMetaId, isConnected, status } = useWalletInfo();
16162
+ const [hoveredId, setHoveredId] = (0, import_react34.useState)(null);
16163
+ const storeFallbackTimeoutRef = (0, import_react34.useRef)(
16164
+ null
16165
+ );
16166
+ (0, import_react34.useEffect)(() => {
16167
+ return () => {
16168
+ if (storeFallbackTimeoutRef.current !== null) {
16169
+ clearTimeout(storeFallbackTimeoutRef.current);
16170
+ }
16171
+ };
16172
+ }, []);
16173
+ const connectedWalletId = isConnected ? walletMetaId : null;
16174
+ const currentUrl = window.location.href;
16175
+ const mobileWallets = (0, import_react34.useMemo)(
16176
+ () => WALLETS.filter((w) => {
16177
+ if (w.id === "walletconnect") return true;
16178
+ const hasMobileLink = Boolean(w.deepLink || w.ios || w.android);
16179
+ if (!hasMobileLink) return false;
16180
+ return w.ecosystem.trim().toLowerCase() === "multi" || w.ecosystem.trim().toLowerCase() === selectedNamespace.trim().toLowerCase();
16181
+ }),
16182
+ [selectedNamespace]
16183
+ );
16184
+ const handleWalletSelect = (wallet) => {
16185
+ if (wallet.id === "walletconnect") {
16186
+ handleWalletConnect();
16187
+ return;
16188
+ }
16189
+ if (wallet.deepLink) {
16190
+ const deepLinkUrl = wallet.deepLink(currentUrl);
16191
+ if (deepLinkUrl) {
16192
+ window.location.assign(deepLinkUrl);
16193
+ if (storeFallbackTimeoutRef.current !== null) {
16194
+ clearTimeout(storeFallbackTimeoutRef.current);
16195
+ }
16196
+ storeFallbackTimeoutRef.current = setTimeout(() => {
16197
+ storeFallbackTimeoutRef.current = null;
16198
+ const isIos2 = /iPhone|iPad/i.test(navigator.userAgent);
16199
+ const storeUrl2 = isIos2 ? wallet.ios : wallet.android;
16200
+ if (storeUrl2) window.location.assign(storeUrl2);
16201
+ }, 1500);
16202
+ return;
16203
+ }
16204
+ }
16205
+ const isIos = /iPhone|iPad/i.test(navigator.userAgent);
16206
+ const storeUrl = isIos ? wallet.ios : wallet.android;
16207
+ if (storeUrl) window.location.assign(storeUrl);
16208
+ };
16209
+ const handleContinue = () => {
16210
+ if (isConnected && status === "connected") {
16211
+ setCurrentStep("crypto-pay");
16212
+ } else {
16213
+ alert("Please connect your wallet first.");
16214
+ }
16215
+ };
16216
+ const showContinueButton = (0, import_react34.useMemo)(
16217
+ () => isConnected && status === "connected",
16218
+ [isConnected, status]
16219
+ );
16220
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
16221
+ "div",
16222
+ {
16223
+ style: {
16224
+ ...dropdownSurfaceStyle,
16225
+ maxHeight: "16rem",
16226
+ backgroundColor: colors.card,
16227
+ borderRadius: borderRadius.xl,
16228
+ boxShadow: shadows.large,
16229
+ border: `1px solid rgba(63, 63, 70, 0.5)`,
16230
+ zIndex: 100,
16231
+ overflow: "hidden",
16232
+ // changed from auto
16233
+ animation: "tw-fade-in 0.2s ease-out",
16234
+ display: "flex",
16235
+ flexDirection: "column"
16236
+ },
16237
+ children: [
16238
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
16239
+ "div",
16240
+ {
16241
+ style: {
16242
+ width: "100%",
16243
+ padding: spacing[2]
16244
+ },
16245
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { style: { display: "flex", gap: spacing[2] }, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(WalletNamespaceTabs, { showBitcoin: false }) })
16246
+ }
16247
+ ),
16248
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
16249
+ "div",
16250
+ {
16251
+ style: {
16252
+ padding: spacing[3],
16253
+ overflowY: "auto",
16254
+ flex: 1,
16255
+ scrollbarWidth: "thin",
16256
+ scrollbarColor: `${colors.muted} transparent`
16257
+ },
16258
+ children: mobileWallets.map((wallet) => {
16259
+ const isConnectedWallet = wallet.id === connectedWalletId;
16260
+ const isDisabled = isConnected && !isConnectedWallet;
16261
+ const isHovered = hoveredId === wallet.id;
16262
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
16263
+ "button",
16264
+ {
16265
+ type: "button",
16266
+ onClick: () => !isDisabled && handleWalletSelect(wallet),
16267
+ onMouseEnter: () => !isDisabled && setHoveredId(wallet.id),
16268
+ onMouseLeave: () => setHoveredId(null),
16269
+ style: {
16270
+ width: "100%",
16271
+ display: "flex",
16272
+ alignItems: "center",
16273
+ justifyContent: "space-between",
16274
+ padding: spacing[2],
16275
+ borderRadius: borderRadius.lg,
16276
+ transition: "background-color 0.2s",
16277
+ border: "none",
16278
+ backgroundColor: isHovered ? "rgba(255,255,255,0.06)" : "transparent",
16279
+ cursor: isDisabled ? "not-allowed" : "pointer",
16280
+ opacity: isDisabled ? 0.4 : 1,
16281
+ fontFamily: "inherit",
16282
+ fontSize: fontSize.sm,
16283
+ outline: "none"
16284
+ },
16285
+ children: [
16286
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
16287
+ "div",
16288
+ {
16289
+ style: {
16290
+ display: "flex",
16291
+ alignItems: "center",
16292
+ gap: spacing[2]
16293
+ },
16294
+ children: [
16295
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
16296
+ "img",
16297
+ {
16298
+ src: wallet.logo ?? wallet.emoji,
16299
+ alt: wallet.name,
16300
+ style: {
16301
+ width: "2rem",
16302
+ height: "2rem",
16303
+ borderRadius: borderRadius.lg,
16304
+ objectFit: "cover"
16305
+ }
16306
+ }
16307
+ ),
16308
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
16309
+ "span",
16310
+ {
16311
+ style: {
16312
+ fontWeight: fontWeight.medium,
16313
+ fontSize: fontSize.sm,
16314
+ color: colors.foreground
16315
+ },
16316
+ children: wallet.name
16317
+ }
16318
+ )
16319
+ ]
16320
+ }
16321
+ ),
16322
+ isConnectedWallet && /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
16323
+ "div",
16324
+ {
16325
+ style: {
16326
+ display: "flex",
16327
+ alignItems: "center",
16328
+ gap: spacing[1]
16329
+ },
16330
+ children: [
16331
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
16332
+ "div",
16333
+ {
16334
+ style: {
16335
+ width: "0.5rem",
16336
+ height: "0.5rem",
16337
+ borderRadius: "50%",
16338
+ backgroundColor: "#22c55e"
16339
+ }
16340
+ }
16341
+ ),
16342
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { style: { fontSize: fontSize.xs, color: "#22c55e" }, children: "Connected" })
16343
+ ]
16344
+ }
16345
+ )
16346
+ ]
16347
+ },
16348
+ wallet.id
16349
+ );
16350
+ })
16351
+ }
16352
+ ),
16353
+ showContinueButton && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
16354
+ "div",
16355
+ {
16356
+ style: {
16357
+ padding: spacing[3],
16358
+ borderTop: `1px solid rgba(63, 63, 70, 0.5)`,
16359
+ backgroundColor: colors.card
16360
+ },
16361
+ children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
16362
+ "button",
16363
+ {
16364
+ onClick: handleContinue,
16365
+ style: {
16366
+ width: "100%",
16367
+ padding: `${spacing[2]} ${spacing[3]}`,
16368
+ borderRadius: borderRadius.lg,
16369
+ border: "none",
16370
+ backgroundColor: colors.primary,
16371
+ color: "#fff",
16372
+ fontFamily: "inherit",
16373
+ fontSize: fontSize.sm,
16374
+ fontWeight: fontWeight.medium,
16375
+ cursor: "pointer",
16376
+ transition: "opacity 0.2s"
16377
+ },
16378
+ onMouseEnter: (e2) => e2.currentTarget.style.opacity = "0.85",
16379
+ onMouseLeave: (e2) => e2.currentTarget.style.opacity = "1",
16380
+ children: "Continue \u2192"
16381
+ }
16382
+ )
16383
+ }
16384
+ )
16385
+ ]
16386
+ }
16387
+ );
16388
+ }
16389
+ function CryptoWalletDropdownContent({
16390
+ browserWallets,
16391
+ handleWalletConnect,
16392
+ handleWalletSelect
16393
+ }) {
16394
+ const isMobile = useIsMobile();
16395
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
16396
+ !isMobile && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
16397
+ DesktopWalletDropdownContent,
16398
+ {
16399
+ browserWallets,
16400
+ handleWalletConnect,
16401
+ handleWalletSelect
16402
+ }
16403
+ ),
16404
+ isMobile && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
16405
+ MobileWalletDropdownContent,
16406
+ {
16407
+ handleWalletConnect
16408
+ }
16409
+ )
16410
+ ] });
16411
+ }
16412
+ var import_react34, import_jsx_runtime36;
16092
16413
  var init_CryptoWalletDropdownContent = __esm({
16093
16414
  "src/widget/features/wallet/components/CryptoWalletDropdownContent.tsx"() {
16094
16415
  "use strict";
@@ -16099,6 +16420,8 @@ var init_CryptoWalletDropdownContent = __esm({
16099
16420
  init_paymentOptionStyles();
16100
16421
  init_WalletNamespaceTabs();
16101
16422
  init_DepositContext();
16423
+ init_wallets();
16424
+ import_react34 = require("react");
16102
16425
  import_jsx_runtime36 = require("react/jsx-runtime");
16103
16426
  }
16104
16427
  });
@@ -16568,12 +16891,12 @@ function useHomeWalletActions({
16568
16891
  WalletConnect
16569
16892
  // setCurrentStepInternal,
16570
16893
  }) {
16571
- const [isCryptoDropdownOpen, setIsCryptoDropdownOpen] = (0, import_react34.useState)(false);
16572
- const [isFiatDropdownOpen, setIsFiatDropdownOpen] = (0, import_react34.useState)(false);
16573
- const cryptoDropdownRef = (0, import_react34.useRef)(null);
16574
- const fiatDropdownRef = (0, import_react34.useRef)(null);
16894
+ const [isCryptoDropdownOpen, setIsCryptoDropdownOpen] = (0, import_react35.useState)(false);
16895
+ const [isFiatDropdownOpen, setIsFiatDropdownOpen] = (0, import_react35.useState)(false);
16896
+ const cryptoDropdownRef = (0, import_react35.useRef)(null);
16897
+ const fiatDropdownRef = (0, import_react35.useRef)(null);
16575
16898
  const { disconnect } = useWalletInfo();
16576
- (0, import_react34.useEffect)(() => {
16899
+ (0, import_react35.useEffect)(() => {
16577
16900
  const handleClickOutside = (event) => {
16578
16901
  if (cryptoDropdownRef.current && !cryptoDropdownRef.current.contains(event.target)) {
16579
16902
  setIsCryptoDropdownOpen(false);
@@ -16588,7 +16911,7 @@ function useHomeWalletActions({
16588
16911
  const { resetNavigation } = useDepositNavigationState("home");
16589
16912
  const { setYourWalletTokens } = useDepositWallet();
16590
16913
  const { isConnected, walletMetaId, connectedVia } = useWalletInfo();
16591
- const handleWalletSelect = (0, import_react34.useCallback)(
16914
+ const handleWalletSelect = (0, import_react35.useCallback)(
16592
16915
  async (wallet) => {
16593
16916
  setIsCryptoDropdownOpen(false);
16594
16917
  try {
@@ -16599,6 +16922,7 @@ function useHomeWalletActions({
16599
16922
  setWalletType("other");
16600
16923
  const { error } = await connectWallet(wallet);
16601
16924
  if (error) {
16925
+ console.error("Wallet connection error:", error);
16602
16926
  resetNavigation();
16603
16927
  return;
16604
16928
  }
@@ -16612,7 +16936,7 @@ function useHomeWalletActions({
16612
16936
  const handleFiatSelect = () => {
16613
16937
  setIsFiatDropdownOpen(false);
16614
16938
  };
16615
- const handleWalletConnect = (0, import_react34.useCallback)(async () => {
16939
+ const handleWalletConnect = (0, import_react35.useCallback)(async () => {
16616
16940
  if (connectedVia !== "walletconnect" && isConnected) {
16617
16941
  disconnect();
16618
16942
  setYourWalletTokens([]);
@@ -16620,7 +16944,7 @@ function useHomeWalletActions({
16620
16944
  WalletConnect().catch(() => resetNavigation());
16621
16945
  }, [setYourWalletTokens, disconnect]);
16622
16946
  const { selectedNamespace } = useDepositWallet();
16623
- const browserWallets = (0, import_react34.useMemo)(() => {
16947
+ const browserWallets = (0, import_react35.useMemo)(() => {
16624
16948
  if (!detectedWallets?.length) return [];
16625
16949
  return detectedWallets.filter(
16626
16950
  (wallet) => wallet?.meta?.id !== "walletconnect" && wallet?.meta?.ecosystem.trim().toLowerCase() === selectedNamespace.trim().toLowerCase()
@@ -16639,11 +16963,11 @@ function useHomeWalletActions({
16639
16963
  setIsFiatDropdownOpen
16640
16964
  };
16641
16965
  }
16642
- var import_react34;
16966
+ var import_react35;
16643
16967
  var init_useHomeWalletActions = __esm({
16644
16968
  "src/widget/features/wallet/hooks/useHomeWalletActions.ts"() {
16645
16969
  "use strict";
16646
- import_react34 = require("react");
16970
+ import_react35 = require("react");
16647
16971
  init_useDepositNavigationState();
16648
16972
  init_DepositContext();
16649
16973
  init_wallets();
@@ -17048,7 +17372,7 @@ function useRoutePreviewModel({
17048
17372
  walletAddress
17049
17373
  }) {
17050
17374
  const { chains } = useChains();
17051
- const destinationConfig = (0, import_react35.useMemo)(
17375
+ const destinationConfig = (0, import_react36.useMemo)(
17052
17376
  () => ({
17053
17377
  dappName: config.messages?.title || "DApp",
17054
17378
  toChain: config.routes.toChain,
@@ -17062,7 +17386,7 @@ function useRoutePreviewModel({
17062
17386
  config.routes.toToken
17063
17387
  ]
17064
17388
  );
17065
- const routeConfig = (0, import_react35.useMemo)(() => {
17389
+ const routeConfig = (0, import_react36.useMemo)(() => {
17066
17390
  const toChainId = config.routes.toChain;
17067
17391
  const toChainKey = normalizeChainKey2(toChainId);
17068
17392
  const toChain = toChainKey ? chains.find(
@@ -17099,7 +17423,7 @@ function useRoutePreviewModel({
17099
17423
  ...routeConfig,
17100
17424
  enabled: !!isReady
17101
17425
  });
17102
- const routePrerequisiteError = (0, import_react35.useMemo)(() => {
17426
+ const routePrerequisiteError = (0, import_react36.useMemo)(() => {
17103
17427
  if (!isReady) return;
17104
17428
  if (!selectedChain) {
17105
17429
  return "Select a source chain to fetch a route.";
@@ -17140,11 +17464,11 @@ function useRoutePreviewModel({
17140
17464
  ...routeBuilderState
17141
17465
  };
17142
17466
  }
17143
- var import_react35;
17467
+ var import_react36;
17144
17468
  var init_useRoutePreviewModel = __esm({
17145
17469
  "src/widget/features/route-preview/hooks/useRoutePreviewModel.ts"() {
17146
17470
  "use strict";
17147
- import_react35 = require("react");
17471
+ import_react36 = require("react");
17148
17472
  init_hooks2();
17149
17473
  init_chainHelpers();
17150
17474
  }
@@ -30705,7 +31029,7 @@ function useTransactionActionModel({
30705
31029
  walletAddress,
30706
31030
  walletStatus
30707
31031
  }) {
30708
- const feeDataCacheRef = (0, import_react36.useRef)({});
31032
+ const feeDataCacheRef = (0, import_react37.useRef)({});
30709
31033
  const { isSubmitting, submitTransaction } = useTransactionSubmit();
30710
31034
  const { trackEvent } = useGTM(GTM_ID);
30711
31035
  const destinationConfig = (() => {
@@ -30718,7 +31042,7 @@ function useTransactionActionModel({
30718
31042
  const chainType = selectedChain?.type ?? selectedChain?.chainType;
30719
31043
  const chainTypeNormalized = (chainType ?? "").toLowerCase();
30720
31044
  const isEvm = chainTypeNormalized === "evm";
30721
- const backendChainId2 = (0, import_react36.useMemo)(() => {
31045
+ const backendChainId2 = (0, import_react37.useMemo)(() => {
30722
31046
  const chainRef = routeResult?.txReq?.chainId ?? selectedChain?.networkIdentifier ?? selectedChain?.chainId ?? selectedChain?.id;
30723
31047
  if (chainRef == null) return null;
30724
31048
  return String(chainRef);
@@ -30728,7 +31052,7 @@ function useTransactionActionModel({
30728
31052
  selectedChain?.id,
30729
31053
  selectedChain?.networkIdentifier
30730
31054
  ]);
30731
- const selectedTokenOnBackendChain = (0, import_react36.useMemo)(() => {
31055
+ const selectedTokenOnBackendChain = (0, import_react37.useMemo)(() => {
30732
31056
  if (!backendChainId2) return false;
30733
31057
  const target = normalizeChainKey2(backendChainId2);
30734
31058
  return [
@@ -30745,23 +31069,23 @@ function useTransactionActionModel({
30745
31069
  selectedChain?.id,
30746
31070
  selectedChain?.networkIdentifier
30747
31071
  ]);
30748
- const isNativeSelected = (0, import_react36.useMemo)(() => {
31072
+ const isNativeSelected = (0, import_react37.useMemo)(() => {
30749
31073
  const address = selectedToken?.address;
30750
31074
  return isNativeTokenAddress(address, chainType) || isZeroAddrLike(address, chainType) || normalizeTokenAddressForCompare(selectedChain, address) === normalizeTokenAddressForCompare(
30751
31075
  selectedChain,
30752
31076
  getNativeTokenAddress2(chainType)
30753
31077
  );
30754
31078
  }, [chainType, selectedChain, selectedToken?.address]);
30755
- const spender = (0, import_react36.useMemo)(() => {
31079
+ const spender = (0, import_react37.useMemo)(() => {
30756
31080
  const txReq = routeResult?.txReq;
30757
31081
  const addr = txReq?.to ?? txReq?.target;
30758
31082
  return addr ?? null;
30759
31083
  }, [routeResult?.txReq]);
30760
- const [allowanceWei, setAllowanceWei] = (0, import_react36.useState)(0n);
30761
- const [isReadingAllowance, setIsReadingAllowance] = (0, import_react36.useState)(false);
30762
- const [isApproving, setIsApproving] = (0, import_react36.useState)(false);
30763
- const [gasReservationWei, setGasReservationWei] = (0, import_react36.useState)(0n);
30764
- const readAllowance = (0, import_react36.useCallback)(async () => {
31084
+ const [allowanceWei, setAllowanceWei] = (0, import_react37.useState)(0n);
31085
+ const [isReadingAllowance, setIsReadingAllowance] = (0, import_react37.useState)(false);
31086
+ const [isApproving, setIsApproving] = (0, import_react37.useState)(false);
31087
+ const [gasReservationWei, setGasReservationWei] = (0, import_react37.useState)(0n);
31088
+ const readAllowance = (0, import_react37.useCallback)(async () => {
30765
31089
  if (!isEvm || isNativeSelected || !!routeResult?.sponsorship || // sponsored routes: SA approves bridge inside the UO batch
30766
31090
  !backendChainId2 || !selectedTokenOnBackendChain || !walletAddress || !spender || !selectedToken?.address) {
30767
31091
  setAllowanceWei(0n);
@@ -30791,12 +31115,12 @@ function useTransactionActionModel({
30791
31115
  spender,
30792
31116
  walletAddress
30793
31117
  ]);
30794
- (0, import_react36.useEffect)(() => {
31118
+ (0, import_react37.useEffect)(() => {
30795
31119
  void readAllowance();
30796
31120
  }, [readAllowance]);
30797
31121
  const needsApproval = isEvm && !isNativeSelected && !routeResult?.sponsorship && // sponsored routes use Permit2 + SA internal batch — no EOA bridge approval
30798
31122
  !!walletAddress && !!spender && amountWei > 0n && allowanceWei < amountWei;
30799
- const waitForApprovalConfirmation2 = (0, import_react36.useCallback)(
31123
+ const waitForApprovalConfirmation2 = (0, import_react37.useCallback)(
30800
31124
  async (chainId, txHash) => {
30801
31125
  const timeoutMs = 12e4;
30802
31126
  const intervalMs = 2e3;
@@ -30815,7 +31139,7 @@ function useTransactionActionModel({
30815
31139
  },
30816
31140
  []
30817
31141
  );
30818
- const handleApproveExact = (0, import_react36.useCallback)(async () => {
31142
+ const handleApproveExact = (0, import_react37.useCallback)(async () => {
30819
31143
  if (isApproving || amountWei <= 0n || !walletAddress || !spender || !selectedToken?.address) {
30820
31144
  return;
30821
31145
  }
@@ -30908,7 +31232,7 @@ function useTransactionActionModel({
30908
31232
  waitForApprovalConfirmation2,
30909
31233
  walletAddress
30910
31234
  ]);
30911
- const getCachedFeeData = (0, import_react36.useCallback)(async () => {
31235
+ const getCachedFeeData = (0, import_react37.useCallback)(async () => {
30912
31236
  if (!backendChainId2) return {};
30913
31237
  const now = Date.now();
30914
31238
  const cache = feeDataCacheRef.current;
@@ -30931,7 +31255,7 @@ function useTransactionActionModel({
30931
31255
  }
30932
31256
  return cache.inflight;
30933
31257
  }, [backendChainId2]);
30934
- const estimateGasReservationWei = (0, import_react36.useCallback)(async () => {
31258
+ const estimateGasReservationWei = (0, import_react37.useCallback)(async () => {
30935
31259
  if (!isNativeSelected) {
30936
31260
  setGasReservationWei(0n);
30937
31261
  return 0n;
@@ -30995,16 +31319,16 @@ function useTransactionActionModel({
30995
31319
  routeResult?.txReq,
30996
31320
  walletAddress
30997
31321
  ]);
30998
- (0, import_react36.useEffect)(() => {
31322
+ (0, import_react37.useEffect)(() => {
30999
31323
  if (routeResult) {
31000
31324
  void estimateGasReservationWei();
31001
31325
  }
31002
31326
  }, [estimateGasReservationWei, routeResult]);
31003
- const [smartAccountFailed, setSmartAccountFailed] = (0, import_react36.useState)(false);
31004
- (0, import_react36.useEffect)(() => {
31327
+ const [smartAccountFailed, setSmartAccountFailed] = (0, import_react37.useState)(false);
31328
+ (0, import_react37.useEffect)(() => {
31005
31329
  setSmartAccountFailed(false);
31006
31330
  }, [routeResult?.intentId]);
31007
- const handleConfirm = (0, import_react36.useCallback)(async () => {
31331
+ const handleConfirm = (0, import_react37.useCallback)(async () => {
31008
31332
  if (!routeResult) {
31009
31333
  return;
31010
31334
  }
@@ -31074,7 +31398,7 @@ function useTransactionActionModel({
31074
31398
  trackEvent,
31075
31399
  walletAddress
31076
31400
  ]);
31077
- const handleSwipeConfirm = (0, import_react36.useCallback)(async () => {
31401
+ const handleSwipeConfirm = (0, import_react37.useCallback)(async () => {
31078
31402
  if (needsApproval) {
31079
31403
  await handleApproveExact();
31080
31404
  if (!backendChainId2 || !selectedTokenOnBackendChain || !selectedToken?.address || !walletAddress || !spender) {
@@ -31105,7 +31429,7 @@ function useTransactionActionModel({
31105
31429
  ]);
31106
31430
  const isWalletConnected = walletStatus === "connected";
31107
31431
  const canSwipe = parsedAmount > 0 && !!selectedToken && isWalletConnected && !isLoadingRoute && !isSubmitting && !!routeResult && !actionErrorMessage && !isApproving && !isReadingAllowance;
31108
- const swipeResetKey = (0, import_react36.useMemo)(() => {
31432
+ const swipeResetKey = (0, import_react37.useMemo)(() => {
31109
31433
  const tokenAddress = selectedToken ? normalizeAddress2(
31110
31434
  selectedToken.address,
31111
31435
  selectedToken?.chainData?.type ?? selectedToken?.chainData?.chainType
@@ -31131,11 +31455,11 @@ function useTransactionActionModel({
31131
31455
  swipeResetKey
31132
31456
  };
31133
31457
  }
31134
- var import_react36, import_viem42;
31458
+ var import_react37, import_viem42;
31135
31459
  var init_useTransactionActionModel = __esm({
31136
31460
  "src/widget/features/transaction/hooks/useTransactionActionModel.ts"() {
31137
31461
  "use strict";
31138
- import_react36 = require("react");
31462
+ import_react37 = require("react");
31139
31463
  import_viem42 = require("viem");
31140
31464
  init_core2();
31141
31465
  init_sdkRpc();
@@ -31339,9 +31663,9 @@ var init_DefaultCryptoPay = __esm({
31339
31663
 
31340
31664
  // src/widget/pages/CryptoPay/RouteQuoteLoader.tsx
31341
31665
  function RouteQuoteLoader({ selectedToken }) {
31342
- const [messageIndex, setMessageIndex] = (0, import_react37.useState)(0);
31343
- const [visible, setVisible] = (0, import_react37.useState)(true);
31344
- (0, import_react37.useEffect)(() => {
31666
+ const [messageIndex, setMessageIndex] = (0, import_react38.useState)(0);
31667
+ const [visible, setVisible] = (0, import_react38.useState)(true);
31668
+ (0, import_react38.useEffect)(() => {
31345
31669
  let t = null;
31346
31670
  const interval = setInterval(() => {
31347
31671
  setVisible(false);
@@ -31497,11 +31821,11 @@ function RouteQuoteLoader({ selectedToken }) {
31497
31821
  }
31498
31822
  );
31499
31823
  }
31500
- var import_react37, import_jsx_runtime49, QUOTE_MESSAGES;
31824
+ var import_react38, import_jsx_runtime49, QUOTE_MESSAGES;
31501
31825
  var init_RouteQuoteLoader = __esm({
31502
31826
  "src/widget/pages/CryptoPay/RouteQuoteLoader.tsx"() {
31503
31827
  "use strict";
31504
- import_react37 = require("react");
31828
+ import_react38 = require("react");
31505
31829
  init_styles();
31506
31830
  import_jsx_runtime49 = require("react/jsx-runtime");
31507
31831
  QUOTE_MESSAGES = [
@@ -31541,17 +31865,17 @@ function CryptoPay({ style: _style }) {
31541
31865
  const { goBack, setCurrentStep, currentStep } = useDepositNavigation();
31542
31866
  const config = useTrustwareConfig();
31543
31867
  const { fixedFromAmountString, isFixedAmount, minAmountUsd, maxAmountUsd } = useAmountConstraints();
31544
- const routeRefreshMs = (0, import_react38.useMemo)(() => {
31868
+ const routeRefreshMs = (0, import_react39.useMemo)(() => {
31545
31869
  const raw = config.routes?.options?.routeRefreshMs;
31546
31870
  const n = Number(raw);
31547
31871
  return Number.isFinite(n) && n > 0 ? n : void 0;
31548
31872
  }, [config.routes?.options?.routeRefreshMs]);
31549
31873
  const IsPos = (x) => x !== null && x !== void 0 && x.balance !== "0";
31550
- const showDefaultCryptoPay = (0, import_react38.useMemo)(() => {
31874
+ const showDefaultCryptoPay = (0, import_react39.useMemo)(() => {
31551
31875
  const nonZer0Tks = (yourWalletTokens ?? []).filter(IsPos);
31552
31876
  return !yourWalletTokensLoading && nonZer0Tks.length === 0 && yourWalletTokens.length > 0;
31553
31877
  }, [yourWalletTokens, yourWalletTokensLoading]);
31554
- const showSkeleton = (0, import_react38.useMemo)(() => {
31878
+ const showSkeleton = (0, import_react39.useMemo)(() => {
31555
31879
  return (yourWalletTokens ?? []).length === 0;
31556
31880
  }, [yourWalletTokens]);
31557
31881
  const isReady = selectedToken != null && selectedToken?.chainData !== void 0 && !showDefaultCryptoPay && !showSkeleton;
@@ -31627,7 +31951,7 @@ function CryptoPay({ style: _style }) {
31627
31951
  });
31628
31952
  const { emitError } = useTrustware();
31629
31953
  const readySelectedToken = isReady ? selectedToken : null;
31630
- (0, import_react38.useEffect)(() => {
31954
+ (0, import_react39.useEffect)(() => {
31631
31955
  if (currentStep !== "crypto-pay" || !actionErrorMessage) return;
31632
31956
  emitError?.(
31633
31957
  new TrustwareError({
@@ -31656,7 +31980,7 @@ function CryptoPay({ style: _style }) {
31656
31980
  if (isFixedAmount) return;
31657
31981
  setAmount(value.toString());
31658
31982
  };
31659
- const relayFeeUsd = (0, import_react38.useMemo)(
31983
+ const relayFeeUsd = (0, import_react39.useMemo)(
31660
31984
  () => computeRelayFeeUsd(routeResult, isNativeSelected),
31661
31985
  [isNativeSelected, routeResult]
31662
31986
  );
@@ -31826,11 +32150,11 @@ function CryptoPay({ style: _style }) {
31826
32150
  }
31827
32151
  );
31828
32152
  }
31829
- var import_react38, import_jsx_runtime50, SHOW_FEE_SUMMARY;
32153
+ var import_react39, import_jsx_runtime50, SHOW_FEE_SUMMARY;
31830
32154
  var init_CryptoPay = __esm({
31831
32155
  "src/widget/pages/CryptoPay/index.tsx"() {
31832
32156
  "use strict";
31833
- import_react38 = require("react");
32157
+ import_react39 = require("react");
31834
32158
  init_relayFeeUtils();
31835
32159
  init_TrustwareError();
31836
32160
  init_useTrustwareConfig();
@@ -31887,27 +32211,27 @@ function Processing({ style }) {
31887
32211
  const { resetState, setCurrentStep } = useDepositNavigation();
31888
32212
  const { transactionStatus, transactionHash, intentId } = useDepositTransaction();
31889
32213
  const { transaction, startPolling, isPolling } = useTransactionPolling();
31890
- const hasStartedPolling = (0, import_react39.useRef)(false);
31891
- (0, import_react39.useEffect)(() => {
32214
+ const hasStartedPolling = (0, import_react40.useRef)(false);
32215
+ (0, import_react40.useEffect)(() => {
31892
32216
  return () => {
31893
32217
  hasStartedPolling.current = false;
31894
32218
  };
31895
32219
  }, []);
31896
- (0, import_react39.useEffect)(() => {
32220
+ (0, import_react40.useEffect)(() => {
31897
32221
  if (intentId && transactionHash && !isPolling && !hasStartedPolling.current && transactionStatus !== "success" && transactionStatus !== "error") {
31898
32222
  hasStartedPolling.current = true;
31899
32223
  startPolling(intentId, transactionHash);
31900
32224
  }
31901
32225
  }, [intentId, transactionHash, isPolling, transactionStatus, startPolling]);
31902
- const progress = (0, import_react39.useMemo)(
32226
+ const progress = (0, import_react40.useMemo)(
31903
32227
  () => getProgressFromStatus(transactionStatus),
31904
32228
  [transactionStatus]
31905
32229
  );
31906
- const stepText = (0, import_react39.useMemo)(
32230
+ const stepText = (0, import_react40.useMemo)(
31907
32231
  () => getStepText(transactionStatus),
31908
32232
  [transactionStatus]
31909
32233
  );
31910
- const explorerUrl = (0, import_react39.useMemo)(() => {
32234
+ const explorerUrl = (0, import_react40.useMemo)(() => {
31911
32235
  if (transaction?.fromChainTxUrl) {
31912
32236
  return transaction.fromChainTxUrl;
31913
32237
  }
@@ -32042,11 +32366,11 @@ function Processing({ style }) {
32042
32366
  }
32043
32367
  );
32044
32368
  }
32045
- var import_react39, import_jsx_runtime51;
32369
+ var import_react40, import_jsx_runtime51;
32046
32370
  var init_Processing = __esm({
32047
32371
  "src/widget/pages/Processing.tsx"() {
32048
32372
  "use strict";
32049
- import_react39 = require("react");
32373
+ import_react40 = require("react");
32050
32374
  init_styles();
32051
32375
  init_DepositContext();
32052
32376
  init_components();
@@ -32061,8 +32385,8 @@ function Success({ style }) {
32061
32385
  const { resetState } = useDepositNavigation();
32062
32386
  const { transactionHash } = useDepositTransaction();
32063
32387
  const { transaction } = useTransactionPolling();
32064
- const parsedAmount = (0, import_react40.useMemo)(() => parseFloat(amount) || 0, [amount]);
32065
- const explorerUrl = (0, import_react40.useMemo)(() => {
32388
+ const parsedAmount = (0, import_react41.useMemo)(() => parseFloat(amount) || 0, [amount]);
32389
+ const explorerUrl = (0, import_react41.useMemo)(() => {
32066
32390
  if (transaction?.toChainTxUrl) {
32067
32391
  return transaction.toChainTxUrl;
32068
32392
  }
@@ -32090,7 +32414,7 @@ function Success({ style }) {
32090
32414
  ...style
32091
32415
  },
32092
32416
  children: [
32093
- /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react40.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ConfettiEffect2, { isActive: true, pieceCount: 60, clearDelay: 4e3 }) }),
32417
+ /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(import_react41.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(ConfettiEffect2, { isActive: true, pieceCount: 60, clearDelay: 4e3 }) }),
32094
32418
  /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(WidgetPageHeader, { title: "Deposit Complete" }),
32095
32419
  /* @__PURE__ */ (0, import_jsx_runtime52.jsx)(
32096
32420
  "div",
@@ -32123,16 +32447,16 @@ function Success({ style }) {
32123
32447
  }
32124
32448
  );
32125
32449
  }
32126
- var import_react40, import_jsx_runtime52, ConfettiEffect2;
32450
+ var import_react41, import_jsx_runtime52, ConfettiEffect2;
32127
32451
  var init_Success = __esm({
32128
32452
  "src/widget/pages/Success.tsx"() {
32129
32453
  "use strict";
32130
- import_react40 = require("react");
32454
+ import_react41 = require("react");
32131
32455
  init_DepositContext();
32132
32456
  init_components();
32133
32457
  init_transaction2();
32134
32458
  import_jsx_runtime52 = require("react/jsx-runtime");
32135
- ConfettiEffect2 = (0, import_react40.lazy)(() => Promise.resolve().then(() => (init_ConfettiEffect(), ConfettiEffect_exports)));
32459
+ ConfettiEffect2 = (0, import_react41.lazy)(() => Promise.resolve().then(() => (init_ConfettiEffect(), ConfettiEffect_exports)));
32136
32460
  }
32137
32461
  });
32138
32462
 
@@ -32294,8 +32618,8 @@ function Error2({ style: _style }) {
32294
32618
  setErrorMessage,
32295
32619
  transactionHash
32296
32620
  } = useDepositTransaction();
32297
- const mapped = (0, import_react41.useMemo)(() => mapError(errorMessage), [errorMessage]);
32298
- const explorerUrl = (0, import_react41.useMemo)(() => {
32621
+ const mapped = (0, import_react42.useMemo)(() => mapError(errorMessage), [errorMessage]);
32622
+ const explorerUrl = (0, import_react42.useMemo)(() => {
32299
32623
  if (transactionHash && selectedChain?.blockExplorerUrls?.length) {
32300
32624
  return `${selectedChain.blockExplorerUrls[0].replace(/\/+$/, "")}/tx/${transactionHash}`;
32301
32625
  }
@@ -32318,11 +32642,11 @@ function Error2({ style: _style }) {
32318
32642
  }
32319
32643
  );
32320
32644
  }
32321
- var import_react41, import_jsx_runtime53;
32645
+ var import_react42, import_jsx_runtime53;
32322
32646
  var init_Error = __esm({
32323
32647
  "src/widget/pages/Error.tsx"() {
32324
32648
  "use strict";
32325
- import_react41 = require("react");
32649
+ import_react42 = require("react");
32326
32650
  init_DepositContext();
32327
32651
  init_components();
32328
32652
  init_mapError();
@@ -32363,11 +32687,11 @@ function WidgetRouter({
32363
32687
  navigationDirection,
32364
32688
  stepHistory
32365
32689
  }) {
32366
- const PageComponent = (0, import_react42.useMemo)(
32690
+ const PageComponent = (0, import_react43.useMemo)(
32367
32691
  () => PAGE_COMPONENTS[currentStep],
32368
32692
  [currentStep]
32369
32693
  );
32370
- const animationClass = (0, import_react42.useMemo)(() => {
32694
+ const animationClass = (0, import_react43.useMemo)(() => {
32371
32695
  return navigationDirection === "forward" ? "tw-animate-slide-in-right" : "tw-animate-slide-in-left";
32372
32696
  }, [navigationDirection]);
32373
32697
  return /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
@@ -32380,11 +32704,11 @@ function WidgetRouter({
32380
32704
  `${currentStep}-${stepHistory.length}`
32381
32705
  );
32382
32706
  }
32383
- var import_react42, import_jsx_runtime54, pageContainerBaseStyle;
32707
+ var import_react43, import_jsx_runtime54, pageContainerBaseStyle;
32384
32708
  var init_WidgetRouter = __esm({
32385
32709
  "src/widget/app/WidgetRouter.tsx"() {
32386
32710
  "use strict";
32387
- import_react42 = require("react");
32711
+ import_react43 = require("react");
32388
32712
  init_utils();
32389
32713
  init_widgetSteps();
32390
32714
  import_jsx_runtime54 = require("react/jsx-runtime");
@@ -32398,13 +32722,13 @@ var init_WidgetRouter = __esm({
32398
32722
 
32399
32723
  // src/modes/swap/hooks/useSwapRoute.ts
32400
32724
  function useSwapRoute() {
32401
- const [state, setState] = (0, import_react43.useState)({
32725
+ const [state, setState] = (0, import_react44.useState)({
32402
32726
  data: null,
32403
32727
  loading: false,
32404
32728
  error: null
32405
32729
  });
32406
- const abortRef = (0, import_react43.useRef)(false);
32407
- const fetch2 = (0, import_react43.useCallback)(
32730
+ const abortRef = (0, import_react44.useRef)(false);
32731
+ const fetch2 = (0, import_react44.useCallback)(
32408
32732
  async (params) => {
32409
32733
  const { fromToken, fromChain, toToken, toChain, amount, walletAddress } = params;
32410
32734
  const decimals = fromToken.decimals ?? 18;
@@ -32445,18 +32769,18 @@ function useSwapRoute() {
32445
32769
  },
32446
32770
  []
32447
32771
  );
32448
- const clear = (0, import_react43.useCallback)(() => {
32772
+ const clear = (0, import_react44.useCallback)(() => {
32449
32773
  abortRef.current = true;
32450
32774
  setState({ data: null, loading: false, error: null });
32451
32775
  }, []);
32452
32776
  return { ...state, fetch: fetch2, clear };
32453
32777
  }
32454
- var import_react43;
32778
+ var import_react44;
32455
32779
  var init_useSwapRoute = __esm({
32456
32780
  "src/modes/swap/hooks/useSwapRoute.ts"() {
32457
32781
  "use strict";
32458
32782
  "use client";
32459
- import_react43 = require("react");
32783
+ import_react44 = require("react");
32460
32784
  init_routes();
32461
32785
  init_chainHelpers();
32462
32786
  init_store();
@@ -32497,7 +32821,7 @@ async function waitForApprovalConfirmation(chainId, txHash) {
32497
32821
  throw new Error("Timed out waiting for approval confirmation");
32498
32822
  }
32499
32823
  function useSwapExecution(fromChain) {
32500
- const [state, setState] = (0, import_react44.useState)({
32824
+ const [state, setState] = (0, import_react45.useState)({
32501
32825
  txStatus: "idle",
32502
32826
  txHash: null,
32503
32827
  intentId: null,
@@ -32506,19 +32830,19 @@ function useSwapExecution(fromChain) {
32506
32830
  isSubmitting: false,
32507
32831
  allowanceStatus: "unknown"
32508
32832
  });
32509
- const saFailedUntilRef = (0, import_react44.useRef)(0);
32510
- const pollingRef = (0, import_react44.useRef)(null);
32511
- const timeoutRef = (0, import_react44.useRef)(null);
32512
- const abortRef = (0, import_react44.useRef)(false);
32513
- const pollCountRef = (0, import_react44.useRef)(0);
32514
- const clearPolling = (0, import_react44.useCallback)(() => {
32833
+ const saFailedUntilRef = (0, import_react45.useRef)(0);
32834
+ const pollingRef = (0, import_react45.useRef)(null);
32835
+ const timeoutRef = (0, import_react45.useRef)(null);
32836
+ const abortRef = (0, import_react45.useRef)(false);
32837
+ const pollCountRef = (0, import_react45.useRef)(0);
32838
+ const clearPolling = (0, import_react45.useCallback)(() => {
32515
32839
  abortRef.current = true;
32516
32840
  if (pollingRef.current) clearTimeout(pollingRef.current);
32517
32841
  if (timeoutRef.current) clearTimeout(timeoutRef.current);
32518
32842
  pollingRef.current = null;
32519
32843
  timeoutRef.current = null;
32520
32844
  }, []);
32521
- const startPolling = (0, import_react44.useCallback)(
32845
+ const startPolling = (0, import_react45.useCallback)(
32522
32846
  (intentIdVal, onSuccess, onError) => {
32523
32847
  clearPolling();
32524
32848
  abortRef.current = false;
@@ -32563,7 +32887,7 @@ function useSwapExecution(fromChain) {
32563
32887
  },
32564
32888
  [clearPolling]
32565
32889
  );
32566
- const checkAllowance = (0, import_react44.useCallback)(
32890
+ const checkAllowance = (0, import_react45.useCallback)(
32567
32891
  async (params) => {
32568
32892
  const { fromTokenAddress, walletAddress, routeResult } = params;
32569
32893
  if (routeResult.sponsorship) {
@@ -32603,7 +32927,7 @@ function useSwapExecution(fromChain) {
32603
32927
  },
32604
32928
  [fromChain]
32605
32929
  );
32606
- const execute = (0, import_react44.useCallback)(
32930
+ const execute = (0, import_react45.useCallback)(
32607
32931
  async (routeResult, fromTokenAddress, fromTokenDecimals, walletAddress, maxApproval, onSuccess, onError) => {
32608
32932
  if (!routeResult?.txReq) {
32609
32933
  const msg = "Invalid route data. Please try again.";
@@ -32799,10 +33123,10 @@ function useSwapExecution(fromChain) {
32799
33123
  },
32800
33124
  [fromChain, startPolling]
32801
33125
  );
32802
- const resetSmartAccountFailure = (0, import_react44.useCallback)(() => {
33126
+ const resetSmartAccountFailure = (0, import_react45.useCallback)(() => {
32803
33127
  saFailedUntilRef.current = 0;
32804
33128
  }, []);
32805
- const reset = (0, import_react44.useCallback)(() => {
33129
+ const reset = (0, import_react45.useCallback)(() => {
32806
33130
  clearPolling();
32807
33131
  saFailedUntilRef.current = 0;
32808
33132
  setState({
@@ -32833,12 +33157,12 @@ function mapTxError(err) {
32833
33157
  return "Transaction would fail. Try a different amount.";
32834
33158
  return msg.length > 150 ? msg.slice(0, 147) + "..." : msg || "Transaction failed.";
32835
33159
  }
32836
- var import_react44, import_viem43, FAST_POLL_MS, SLOW_POLL_MS, TIMEOUT_MS, SA_COOLDOWN_MS;
33160
+ var import_react45, import_viem43, FAST_POLL_MS, SLOW_POLL_MS, TIMEOUT_MS, SA_COOLDOWN_MS;
32837
33161
  var init_useSwapExecution = __esm({
32838
33162
  "src/modes/swap/hooks/useSwapExecution.ts"() {
32839
33163
  "use strict";
32840
33164
  "use client";
32841
- import_react44 = require("react");
33165
+ import_react45 = require("react");
32842
33166
  import_viem43 = require("viem");
32843
33167
  init_core2();
32844
33168
  init_routes();
@@ -32876,11 +33200,11 @@ var init_forex = __esm({
32876
33200
 
32877
33201
  // src/modes/swap/hooks/useForex.ts
32878
33202
  function useForex() {
32879
- const [rates, setRates] = (0, import_react45.useState)({ USD: 1 });
32880
- const [error, setError] = (0, import_react45.useState)(null);
32881
- const [lastUpdated, setLastUpdated] = (0, import_react45.useState)(null);
32882
- const timerRef = (0, import_react45.useRef)(null);
32883
- (0, import_react45.useEffect)(() => {
33203
+ const [rates, setRates] = (0, import_react46.useState)({ USD: 1 });
33204
+ const [error, setError] = (0, import_react46.useState)(null);
33205
+ const [lastUpdated, setLastUpdated] = (0, import_react46.useState)(null);
33206
+ const timerRef = (0, import_react46.useRef)(null);
33207
+ (0, import_react46.useEffect)(() => {
32884
33208
  let cancelled = false;
32885
33209
  const load = () => {
32886
33210
  fetchForexRates("USD").then((r) => {
@@ -32907,11 +33231,11 @@ function useForex() {
32907
33231
  }, []);
32908
33232
  return { rates, error, lastUpdated };
32909
33233
  }
32910
- var import_react45, REFRESH_MS;
33234
+ var import_react46, REFRESH_MS;
32911
33235
  var init_useForex = __esm({
32912
33236
  "src/modes/swap/hooks/useForex.ts"() {
32913
33237
  "use strict";
32914
- import_react45 = require("react");
33238
+ import_react46 = require("react");
32915
33239
  init_forex();
32916
33240
  REFRESH_MS = 5 * 60 * 1e3;
32917
33241
  }
@@ -32932,10 +33256,10 @@ function SwapTokenSelect({
32932
33256
  allowedTokens,
32933
33257
  excludeToken
32934
33258
  }) {
32935
- const [localChain, setLocalChain] = (0, import_react46.useState)(initialChain);
32936
- const [pinnedTokens, setPinnedTokens] = (0, import_react46.useState)([]);
32937
- const [pinnedLoading, setPinnedLoading] = (0, import_react46.useState)(false);
32938
- (0, import_react46.useEffect)(() => {
33259
+ const [localChain, setLocalChain] = (0, import_react47.useState)(initialChain);
33260
+ const [pinnedTokens, setPinnedTokens] = (0, import_react47.useState)([]);
33261
+ const [pinnedLoading, setPinnedLoading] = (0, import_react47.useState)(false);
33262
+ (0, import_react47.useEffect)(() => {
32939
33263
  if (!allowedTokens || allowedTokens.length === 0 || !localChain) {
32940
33264
  setPinnedTokens([]);
32941
33265
  return;
@@ -33016,26 +33340,26 @@ function SwapTokenSelect({
33016
33340
  walletAddress,
33017
33341
  yourWalletTokens
33018
33342
  });
33019
- const allowedSet = (0, import_react46.useMemo)(() => {
33343
+ const allowedSet = (0, import_react47.useMemo)(() => {
33020
33344
  if (!allowedTokens || allowedTokens.length === 0) return null;
33021
33345
  return new Set(
33022
33346
  allowedTokens.map((t) => `${t.chainId}:${t.address.toLowerCase()}`)
33023
33347
  );
33024
33348
  }, [allowedTokens]);
33025
- const filteredWalletTokens = (0, import_react46.useMemo)(() => {
33349
+ const filteredWalletTokens = (0, import_react47.useMemo)(() => {
33026
33350
  if (!allowedSet) return rawWalletTokens;
33027
33351
  return rawWalletTokens.filter(
33028
33352
  (t) => allowedSet.has(`${Number(t.chainId)}:${t.address.toLowerCase()}`)
33029
33353
  );
33030
33354
  }, [rawWalletTokens, allowedSet]);
33031
33355
  const excludeKey = excludeToken ? `${Number(excludeToken.chainId)}:${excludeToken.address.toLowerCase()}` : null;
33032
- const visibleTokens = (0, import_react46.useMemo)(() => {
33356
+ const visibleTokens = (0, import_react47.useMemo)(() => {
33033
33357
  if (!excludeKey) return filteredTokens;
33034
33358
  return filteredTokens.filter(
33035
33359
  (t) => `${Number(t.chainId)}:${t.address.toLowerCase()}` !== excludeKey
33036
33360
  );
33037
33361
  }, [filteredTokens, excludeKey]);
33038
- const visibleWalletTokens = (0, import_react46.useMemo)(() => {
33362
+ const visibleWalletTokens = (0, import_react47.useMemo)(() => {
33039
33363
  if (!excludeKey) return filteredWalletTokens;
33040
33364
  return filteredWalletTokens.filter(
33041
33365
  (t) => `${Number(t.chainId)}:${t.address.toLowerCase()}` !== excludeKey
@@ -33152,11 +33476,11 @@ function SwapTokenSelect({
33152
33476
  }
33153
33477
  );
33154
33478
  }
33155
- var import_react46, import_jsx_runtime55;
33479
+ var import_react47, import_jsx_runtime55;
33156
33480
  var init_SwapTokenSelect = __esm({
33157
33481
  "src/modes/swap/components/SwapTokenSelect.tsx"() {
33158
33482
  "use strict";
33159
- import_react46 = require("react");
33483
+ import_react47 = require("react");
33160
33484
  init_styles();
33161
33485
  init_registryClient();
33162
33486
  init_hooks2();
@@ -33182,16 +33506,16 @@ function SwapWalletSelector({
33182
33506
  } = useWalletInfo();
33183
33507
  const walletConnectCfg = TrustwareConfigStore.peek()?.walletConnect;
33184
33508
  const connectWC = useWalletConnectConnect(walletConnectCfg);
33185
- const [wcConnecting, setWcConnecting] = (0, import_react47.useState)(false);
33186
- const [connectingId, setConnectingId] = (0, import_react47.useState)(null);
33187
- const [timerExpired, setTimerExpired] = (0, import_react47.useState)(false);
33188
- const [selectedNamespace, setSelectedNamespace] = (0, import_react47.useState)("evm");
33189
- const prevStatusRef = (0, import_react47.useRef)(walletStatus);
33190
- (0, import_react47.useEffect)(() => {
33509
+ const [wcConnecting, setWcConnecting] = (0, import_react48.useState)(false);
33510
+ const [connectingId, setConnectingId] = (0, import_react48.useState)(null);
33511
+ const [timerExpired, setTimerExpired] = (0, import_react48.useState)(false);
33512
+ const [selectedNamespace, setSelectedNamespace] = (0, import_react48.useState)("evm");
33513
+ const prevStatusRef = (0, import_react48.useRef)(walletStatus);
33514
+ (0, import_react48.useEffect)(() => {
33191
33515
  const t = setTimeout(() => setTimerExpired(true), 450);
33192
33516
  return () => clearTimeout(t);
33193
33517
  }, []);
33194
- (0, import_react47.useEffect)(() => {
33518
+ (0, import_react48.useEffect)(() => {
33195
33519
  const prev = prevStatusRef.current;
33196
33520
  if (prev !== walletStatus) {
33197
33521
  if (prev === "connecting" && (walletStatus === "connected" || walletStatus === "error")) {
@@ -33200,7 +33524,7 @@ function SwapWalletSelector({
33200
33524
  prevStatusRef.current = walletStatus;
33201
33525
  }
33202
33526
  }, [walletStatus]);
33203
- const filteredWallets = (0, import_react47.useMemo)(
33527
+ const filteredWallets = (0, import_react48.useMemo)(
33204
33528
  () => detected.filter(
33205
33529
  (w) => (w.meta?.ecosystem ?? "").toLowerCase() === selectedNamespace
33206
33530
  ),
@@ -33776,11 +34100,11 @@ function SwapWalletSelector({
33776
34100
  ] })
33777
34101
  ] });
33778
34102
  }
33779
- var import_react47, import_jsx_runtime56;
34103
+ var import_react48, import_jsx_runtime56;
33780
34104
  var init_SwapWalletSelector = __esm({
33781
34105
  "src/modes/swap/components/SwapWalletSelector.tsx"() {
33782
34106
  "use strict";
33783
- import_react47 = require("react");
34107
+ import_react48 = require("react");
33784
34108
  init_styles();
33785
34109
  init_utils();
33786
34110
  init_wallets();
@@ -33955,41 +34279,41 @@ function SwapMode({
33955
34279
  theme: themeProp,
33956
34280
  style
33957
34281
  }) {
33958
- const [stage, setStage] = (0, import_react48.useState)("home");
33959
- const [fromToken, setFromToken] = (0, import_react48.useState)(
34282
+ const [stage, setStage] = (0, import_react49.useState)("home");
34283
+ const [fromToken, setFromToken] = (0, import_react49.useState)(
33960
34284
  null
33961
34285
  );
33962
- const [fromChain, setFromChain] = (0, import_react48.useState)(null);
33963
- const [toToken, setToToken] = (0, import_react48.useState)(null);
33964
- const [toChain, setToChain] = (0, import_react48.useState)(null);
33965
- const [amount, setAmount] = (0, import_react48.useState)("");
33966
- const [amountInputMode, setAmountInputMode] = (0, import_react48.useState)(
34286
+ const [fromChain, setFromChain] = (0, import_react49.useState)(null);
34287
+ const [toToken, setToToken] = (0, import_react49.useState)(null);
34288
+ const [toChain, setToChain] = (0, import_react49.useState)(null);
34289
+ const [amount, setAmount] = (0, import_react49.useState)("");
34290
+ const [amountInputMode, setAmountInputMode] = (0, import_react49.useState)(
33967
34291
  "usd"
33968
34292
  );
33969
- const [hoverSell, setHoverSell] = (0, import_react48.useState)(false);
33970
- const [showRateDetails, setShowRateDetails] = (0, import_react48.useState)(false);
33971
- const [showReviewDetails, setShowReviewDetails] = (0, import_react48.useState)(false);
33972
- const [showSettings, setShowSettings] = (0, import_react48.useState)(false);
33973
- const [maxApproval, setMaxApproval] = (0, import_react48.useState)(false);
33974
- const [slippage, setSlippage] = (0, import_react48.useState)(0.5);
33975
- const [slippageInput, setSlippageInput] = (0, import_react48.useState)("");
33976
- const [selectedCurrency, setSelectedCurrency] = (0, import_react48.useState)("USD");
33977
- const [showCurrencyDropdown, setShowCurrencyDropdown] = (0, import_react48.useState)(false);
33978
- const [completedAt, setCompletedAt] = (0, import_react48.useState)(null);
33979
- const [copiedHash, setCopiedHash] = (0, import_react48.useState)(null);
33980
- const [rateUpdated, setRateUpdated] = (0, import_react48.useState)(false);
33981
- const prevToAmountRef = (0, import_react48.useRef)(null);
33982
- const [destAddress, setDestAddress] = (0, import_react48.useState)("");
33983
- const [quoteAge, setQuoteAge] = (0, import_react48.useState)(0);
33984
- const quoteTimestampRef = (0, import_react48.useRef)(null);
33985
- const [quoteLoadingMsgIdx, setQuoteLoadingMsgIdx] = (0, import_react48.useState)(0);
33986
- const [quoteLoadingMsgVisible, setQuoteLoadingMsgVisible] = (0, import_react48.useState)(true);
33987
- const latestFetchParamsRef = (0, import_react48.useRef)(null);
34293
+ const [hoverSell, setHoverSell] = (0, import_react49.useState)(false);
34294
+ const [showRateDetails, setShowRateDetails] = (0, import_react49.useState)(false);
34295
+ const [showReviewDetails, setShowReviewDetails] = (0, import_react49.useState)(false);
34296
+ const [showSettings, setShowSettings] = (0, import_react49.useState)(false);
34297
+ const [maxApproval, setMaxApproval] = (0, import_react49.useState)(false);
34298
+ const [slippage, setSlippage] = (0, import_react49.useState)(0.5);
34299
+ const [slippageInput, setSlippageInput] = (0, import_react49.useState)("");
34300
+ const [selectedCurrency, setSelectedCurrency] = (0, import_react49.useState)("USD");
34301
+ const [showCurrencyDropdown, setShowCurrencyDropdown] = (0, import_react49.useState)(false);
34302
+ const [completedAt, setCompletedAt] = (0, import_react49.useState)(null);
34303
+ const [copiedHash, setCopiedHash] = (0, import_react49.useState)(null);
34304
+ const [rateUpdated, setRateUpdated] = (0, import_react49.useState)(false);
34305
+ const prevToAmountRef = (0, import_react49.useRef)(null);
34306
+ const [destAddress, setDestAddress] = (0, import_react49.useState)("");
34307
+ const [quoteAge, setQuoteAge] = (0, import_react49.useState)(0);
34308
+ const quoteTimestampRef = (0, import_react49.useRef)(null);
34309
+ const [quoteLoadingMsgIdx, setQuoteLoadingMsgIdx] = (0, import_react49.useState)(0);
34310
+ const [quoteLoadingMsgVisible, setQuoteLoadingMsgVisible] = (0, import_react49.useState)(true);
34311
+ const latestFetchParamsRef = (0, import_react49.useRef)(null);
33988
34312
  const { rates: forexRates } = useForex();
33989
34313
  const currencyMeta = getCurrencyMeta(selectedCurrency);
33990
34314
  const currencyRate = forexRates[selectedCurrency] ?? 1;
33991
34315
  const currencySymbol = currencyMeta.symbol;
33992
- const fmtLocal = (0, import_react48.useCallback)(
34316
+ const fmtLocal = (0, import_react49.useCallback)(
33993
34317
  (usdAmount) => {
33994
34318
  const sym = getCurrencyMeta(selectedCurrency).symbol;
33995
34319
  if (usdAmount === null || !isFinite(usdAmount) || usdAmount <= 0)
@@ -34000,8 +34324,8 @@ function SwapMode({
34000
34324
  },
34001
34325
  [currencyRate, selectedCurrency]
34002
34326
  );
34003
- const settingsRef = (0, import_react48.useRef)(null);
34004
- const currencyDropdownRef = (0, import_react48.useRef)(null);
34327
+ const settingsRef = (0, import_react49.useRef)(null);
34328
+ const currencyDropdownRef = (0, import_react49.useRef)(null);
34005
34329
  const { emitEvent } = useTrustware();
34006
34330
  const { features, theme: configTheme } = useTrustwareConfig();
34007
34331
  const effectiveThemeSetting = themeProp ?? configTheme ?? "system";
@@ -34017,26 +34341,26 @@ function SwapMode({
34017
34341
  isLoading: chainsLoading,
34018
34342
  error: chainsError
34019
34343
  } = useChains();
34020
- const allowedDestChainIds = (0, import_react48.useMemo)(() => {
34344
+ const allowedDestChainIds = (0, import_react49.useMemo)(() => {
34021
34345
  if (!allowedDestTokens || allowedDestTokens.length === 0) return null;
34022
34346
  return new Set(allowedDestTokens.map((t) => t.chainId));
34023
34347
  }, [allowedDestTokens]);
34024
- const toPopularChains = (0, import_react48.useMemo)(
34348
+ const toPopularChains = (0, import_react49.useMemo)(
34025
34349
  () => allowedDestChainIds ? popularChains.filter(
34026
34350
  (c) => allowedDestChainIds.has(Number(c.chainId))
34027
34351
  ) : popularChains,
34028
34352
  [popularChains, allowedDestChainIds]
34029
34353
  );
34030
- const toOtherChains = (0, import_react48.useMemo)(
34354
+ const toOtherChains = (0, import_react49.useMemo)(
34031
34355
  () => allowedDestChainIds ? otherChains.filter((c) => allowedDestChainIds.has(Number(c.chainId))) : otherChains,
34032
34356
  [otherChains, allowedDestChainIds]
34033
34357
  );
34034
- const allChains = (0, import_react48.useMemo)(
34358
+ const allChains = (0, import_react49.useMemo)(
34035
34359
  () => [...popularChains, ...otherChains],
34036
34360
  [popularChains, otherChains]
34037
34361
  );
34038
- const destInitialized = (0, import_react48.useRef)(false);
34039
- (0, import_react48.useEffect)(() => {
34362
+ const destInitialized = (0, import_react49.useRef)(false);
34363
+ (0, import_react49.useEffect)(() => {
34040
34364
  if (!defaultDestRef || destInitialized.current || allChains.length === 0)
34041
34365
  return;
34042
34366
  const chain = allChains.find(
@@ -34067,11 +34391,11 @@ function SwapMode({
34067
34391
  });
34068
34392
  }, [defaultDestRef, allChains]);
34069
34393
  const { walletAddress, walletStatus, connectWallet, disconnectWallet } = useWalletSessionState();
34070
- const setFromTokenStable = (0, import_react48.useCallback)(
34394
+ const setFromTokenStable = (0, import_react49.useCallback)(
34071
34395
  (t) => setFromToken(t),
34072
34396
  []
34073
34397
  );
34074
- const setFromChainStable = (0, import_react48.useCallback)(
34398
+ const setFromChainStable = (0, import_react49.useCallback)(
34075
34399
  (c) => setFromChain(c),
34076
34400
  []
34077
34401
  );
@@ -34084,18 +34408,18 @@ function SwapMode({
34084
34408
  });
34085
34409
  const route = useSwapRoute();
34086
34410
  const execution = useSwapExecution(fromChain);
34087
- const fromTokenPriceUSD = (0, import_react48.useMemo)(() => {
34411
+ const fromTokenPriceUSD = (0, import_react49.useMemo)(() => {
34088
34412
  const p = fromToken?.usdPrice;
34089
34413
  return typeof p === "number" && Number.isFinite(p) && p > 0 ? p : 0;
34090
34414
  }, [fromToken]);
34091
34415
  const hasFromUsdPrice = fromTokenPriceUSD > 0;
34092
- const toTokenPriceUSD = (0, import_react48.useMemo)(() => {
34416
+ const toTokenPriceUSD = (0, import_react49.useMemo)(() => {
34093
34417
  const p = toToken?.usdPrice;
34094
34418
  return typeof p === "number" && Number.isFinite(p) && p > 0 ? p : 0;
34095
34419
  }, [toToken]);
34096
34420
  const hasToUsdPrice = toTokenPriceUSD > 0;
34097
34421
  const rawSellNum = parseFloat(amount) || 0;
34098
- const usdSellNum = (0, import_react48.useMemo)(() => {
34422
+ const usdSellNum = (0, import_react49.useMemo)(() => {
34099
34423
  if (amountInputMode === "usd") return rawSellNum / currencyRate;
34100
34424
  return hasFromUsdPrice ? rawSellNum * fromTokenPriceUSD : 0;
34101
34425
  }, [
@@ -34105,7 +34429,7 @@ function SwapMode({
34105
34429
  hasFromUsdPrice,
34106
34430
  fromTokenPriceUSD
34107
34431
  ]);
34108
- const tokenSellNum = (0, import_react48.useMemo)(() => {
34432
+ const tokenSellNum = (0, import_react49.useMemo)(() => {
34109
34433
  if (amountInputMode === "usd") {
34110
34434
  return hasFromUsdPrice && fromTokenPriceUSD > 0 ? usdSellNum / fromTokenPriceUSD : 0;
34111
34435
  }
@@ -34117,12 +34441,12 @@ function SwapMode({
34117
34441
  hasFromUsdPrice,
34118
34442
  fromTokenPriceUSD
34119
34443
  ]);
34120
- const tokenAmountStr = (0, import_react48.useMemo)(() => {
34444
+ const tokenAmountStr = (0, import_react49.useMemo)(() => {
34121
34445
  if (tokenSellNum <= 0) return "";
34122
34446
  const decimals = fromToken?.decimals ?? 18;
34123
34447
  return truncateDecimal(tokenSellNum, Math.min(decimals, 18));
34124
34448
  }, [tokenSellNum, fromToken?.decimals]);
34125
- const handleCurrencyChange = (0, import_react48.useCallback)(
34449
+ const handleCurrencyChange = (0, import_react49.useCallback)(
34126
34450
  (newCode) => {
34127
34451
  if (amountInputMode === "usd" && amount) {
34128
34452
  const oldRate = currencyRate;
@@ -34137,7 +34461,7 @@ function SwapMode({
34137
34461
  },
34138
34462
  [amountInputMode, amount, currencyRate, forexRates, route]
34139
34463
  );
34140
- const handleSelectFromToken = (0, import_react48.useCallback)(
34464
+ const handleSelectFromToken = (0, import_react49.useCallback)(
34141
34465
  (token, chain) => {
34142
34466
  setFromToken(token);
34143
34467
  setFromChain(chain);
@@ -34158,7 +34482,7 @@ function SwapMode({
34158
34482
  },
34159
34483
  [route, emitEvent, toToken, toChain, amount]
34160
34484
  );
34161
- const handleSelectToToken = (0, import_react48.useCallback)(
34485
+ const handleSelectToToken = (0, import_react49.useCallback)(
34162
34486
  (token, chain) => {
34163
34487
  setToToken(token);
34164
34488
  setToChain(chain);
@@ -34175,7 +34499,7 @@ function SwapMode({
34175
34499
  },
34176
34500
  [route, emitEvent, fromToken, fromChain, amount]
34177
34501
  );
34178
- const handleFlip = (0, import_react48.useCallback)(() => {
34502
+ const handleFlip = (0, import_react49.useCallback)(() => {
34179
34503
  if (lockDestToken) return;
34180
34504
  const newFrom = toToken ?? fromToken;
34181
34505
  const newFromChain = toChain ?? fromChain;
@@ -34197,7 +34521,7 @@ function SwapMode({
34197
34521
  const toChainType = normalizeChainType2(toChain);
34198
34522
  const needsDestAddress = !!fromChainType && !!toChainType && fromChainType !== toChainType;
34199
34523
  const isValidDestAddress = !needsDestAddress || validateDestAddress(destAddress, toChainType ?? "");
34200
- const handleReview = (0, import_react48.useCallback)(async () => {
34524
+ const handleReview = (0, import_react49.useCallback)(async () => {
34201
34525
  if (!fromToken || !fromChain || !toToken || !toChain || !tokenAmountStr || !walletAddress) {
34202
34526
  if (!walletAddress) setStage("connect-wallet");
34203
34527
  return;
@@ -34232,13 +34556,13 @@ function SwapMode({
34232
34556
  route,
34233
34557
  slippage
34234
34558
  ]);
34235
- const handleConnectAndReview = (0, import_react48.useCallback)(() => {
34559
+ const handleConnectAndReview = (0, import_react49.useCallback)(() => {
34236
34560
  setStage("connect-wallet");
34237
34561
  }, []);
34238
- const handleWalletConnected = (0, import_react48.useCallback)(() => {
34562
+ const handleWalletConnected = (0, import_react49.useCallback)(() => {
34239
34563
  setStage("home");
34240
34564
  }, []);
34241
- const handleExecute = (0, import_react48.useCallback)(async () => {
34565
+ const handleExecute = (0, import_react49.useCallback)(async () => {
34242
34566
  if (!route.data) return;
34243
34567
  setStage("processing");
34244
34568
  const fromTokenAddress = fromToken?.address ?? fromToken?.address;
@@ -34261,7 +34585,7 @@ function SwapMode({
34261
34585
  () => setStage("error")
34262
34586
  );
34263
34587
  }, [route, execution, fromToken, walletAddress, maxApproval]);
34264
- const handleReset = (0, import_react48.useCallback)(() => {
34588
+ const handleReset = (0, import_react49.useCallback)(() => {
34265
34589
  execution.reset();
34266
34590
  route.clear();
34267
34591
  setAmount("");
@@ -34271,7 +34595,7 @@ function SwapMode({
34271
34595
  setStage("home");
34272
34596
  reloadWalletTokens();
34273
34597
  }, [execution, route, reloadWalletTokens]);
34274
- const handleSwapBack = (0, import_react48.useCallback)(() => {
34598
+ const handleSwapBack = (0, import_react49.useCallback)(() => {
34275
34599
  const prevFrom = fromToken;
34276
34600
  const prevFromChain = fromChain;
34277
34601
  setFromToken(toToken);
@@ -34295,14 +34619,14 @@ function SwapMode({
34295
34619
  route,
34296
34620
  reloadWalletTokens
34297
34621
  ]);
34298
- const handleCopyHash = (0, import_react48.useCallback)((hash) => {
34622
+ const handleCopyHash = (0, import_react49.useCallback)((hash) => {
34299
34623
  if (!navigator?.clipboard?.writeText) return;
34300
34624
  void navigator.clipboard.writeText(hash).then(() => {
34301
34625
  setCopiedHash(hash);
34302
34626
  setTimeout(() => setCopiedHash((v) => v === hash ? null : v), 1500);
34303
34627
  });
34304
34628
  }, []);
34305
- const handleToggleDenom = (0, import_react48.useCallback)(() => {
34629
+ const handleToggleDenom = (0, import_react49.useCallback)(() => {
34306
34630
  if (!hasFromUsdPrice) return;
34307
34631
  const parsed = parseFloat(amount) || 0;
34308
34632
  if (amountInputMode === "usd") {
@@ -34328,7 +34652,7 @@ function SwapMode({
34328
34652
  fromToken?.decimals,
34329
34653
  route
34330
34654
  ]);
34331
- const fromBalance = (0, import_react48.useMemo)(() => {
34655
+ const fromBalance = (0, import_react49.useMemo)(() => {
34332
34656
  const walletToken = fromToken;
34333
34657
  if (!walletToken || !("balance" in walletToken)) return null;
34334
34658
  const raw = walletToken.balance;
@@ -34338,7 +34662,7 @@ function SwapMode({
34338
34662
  return Number.isFinite(n) ? n : null;
34339
34663
  }, [fromToken]);
34340
34664
  const balanceUsd = fromBalance !== null && hasFromUsdPrice ? fromBalance * fromTokenPriceUSD : null;
34341
- const estimatedToAmount = (0, import_react48.useMemo)(() => {
34665
+ const estimatedToAmount = (0, import_react49.useMemo)(() => {
34342
34666
  if (tokenSellNum <= 0 || !hasFromUsdPrice || !hasToUsdPrice) return null;
34343
34667
  return tokenSellNum * (fromTokenPriceUSD / toTokenPriceUSD);
34344
34668
  }, [
@@ -34348,10 +34672,10 @@ function SwapMode({
34348
34672
  hasFromUsdPrice,
34349
34673
  hasToUsdPrice
34350
34674
  ]);
34351
- const backendToUsdStr = (0, import_react48.useMemo)(() => {
34675
+ const backendToUsdStr = (0, import_react49.useMemo)(() => {
34352
34676
  return route.data?.finalExchangeRate?.toAmountMinUSD ?? route.data?.route?.estimate?.toAmountMinUsd ?? route.data?.route?.estimate?.toAmountUsd ?? null;
34353
34677
  }, [route.data]);
34354
- const toAmount = (0, import_react48.useMemo)(() => {
34678
+ const toAmount = (0, import_react49.useMemo)(() => {
34355
34679
  if (backendToUsdStr && toTokenPriceUSD > 0) {
34356
34680
  const usd = parseFloat(backendToUsdStr);
34357
34681
  if (Number.isFinite(usd) && usd > 0) return usd / toTokenPriceUSD;
@@ -34377,7 +34701,7 @@ function SwapMode({
34377
34701
  estimatedToAmount
34378
34702
  ]);
34379
34703
  const fromUsd = usdSellNum;
34380
- const toUsd = (0, import_react48.useMemo)(() => {
34704
+ const toUsd = (0, import_react49.useMemo)(() => {
34381
34705
  if (backendToUsdStr) {
34382
34706
  const n = parseFloat(backendToUsdStr);
34383
34707
  if (Number.isFinite(n) && n > 0) return n;
@@ -34388,12 +34712,12 @@ function SwapMode({
34388
34712
  const isEstimate = !route.data;
34389
34713
  const USD_EPSILON = 1e-3;
34390
34714
  const displayToUsd = toUsd > USD_EPSILON ? toUsd : estimatedToAmount !== null && hasToUsdPrice ? estimatedToAmount * toTokenPriceUSD : 0;
34391
- const priceImpact = (0, import_react48.useMemo)(() => {
34715
+ const priceImpact = (0, import_react49.useMemo)(() => {
34392
34716
  if (!route.data || fromUsd < 0.01 || displayToUsd < 0.01) return null;
34393
34717
  const impact = 1 - displayToUsd / fromUsd;
34394
34718
  return impact > 1e-3 ? impact : null;
34395
34719
  }, [route.data, fromUsd, displayToUsd]);
34396
- const routePath = (0, import_react48.useMemo)(() => {
34720
+ const routePath = (0, import_react49.useMemo)(() => {
34397
34721
  if (!route.data) return null;
34398
34722
  const provider = route.data.route?.provider;
34399
34723
  const steps = route.data.route?.steps;
@@ -34420,19 +34744,19 @@ function SwapMode({
34420
34744
  return null;
34421
34745
  }, [route.data, fromToken?.symbol, toToken?.symbol]);
34422
34746
  const isGasSponsored = !!route.data?.sponsorship;
34423
- const networkCostUsd = (0, import_react48.useMemo)(() => {
34747
+ const networkCostUsd = (0, import_react49.useMemo)(() => {
34424
34748
  const fees = route.data?.route?.estimate?.fees;
34425
34749
  if (!fees?.length) return null;
34426
34750
  const gasTotal = fees.filter((f) => f.type?.toLowerCase().includes("gas")).reduce((sum, f) => sum + (Number(f.amountUsd) || 0), 0);
34427
34751
  return gasTotal > 0 ? gasTotal : null;
34428
34752
  }, [route.data]);
34429
- const protocolFeeUsd = (0, import_react48.useMemo)(() => {
34753
+ const protocolFeeUsd = (0, import_react49.useMemo)(() => {
34430
34754
  const fees = route.data?.route?.estimate?.fees;
34431
34755
  if (!fees?.length) return null;
34432
34756
  const total = fees.filter((f) => !f.type?.toLowerCase().includes("gas")).reduce((sum, f) => sum + (Number(f.amountUsd) || 0), 0);
34433
34757
  return total > 0 ? total : null;
34434
34758
  }, [route.data]);
34435
- const exchangeRate = (0, import_react48.useMemo)(() => {
34759
+ const exchangeRate = (0, import_react49.useMemo)(() => {
34436
34760
  if (!hasFromUsdPrice || !hasToUsdPrice) return null;
34437
34761
  return toTokenPriceUSD / fromTokenPriceUSD;
34438
34762
  }, [fromTokenPriceUSD, toTokenPriceUSD, hasFromUsdPrice, hasToUsdPrice]);
@@ -34441,13 +34765,13 @@ function SwapMode({
34441
34765
  const hasAmount = rawSellNum > 0 && (amountInputMode === "token" || hasFromUsdPrice);
34442
34766
  const isConnected = walletStatus === "connected" && !!walletAddress;
34443
34767
  const canGetQuote = hasTokens && hasAmount && !insufficient && isConnected && (!needsDestAddress || isValidDestAddress);
34444
- (0, import_react48.useEffect)(() => {
34768
+ (0, import_react49.useEffect)(() => {
34445
34769
  if (!fromToken) return;
34446
34770
  if (!hasFromUsdPrice && amountInputMode === "usd") {
34447
34771
  setAmountInputMode("token");
34448
34772
  }
34449
34773
  }, [fromToken, hasFromUsdPrice, amountInputMode]);
34450
- (0, import_react48.useEffect)(() => {
34774
+ (0, import_react49.useEffect)(() => {
34451
34775
  if (displayToAmount === null) {
34452
34776
  prevToAmountRef.current = null;
34453
34777
  return;
@@ -34461,14 +34785,14 @@ function SwapMode({
34461
34785
  const t = setTimeout(() => setRateUpdated(false), 700);
34462
34786
  return () => clearTimeout(t);
34463
34787
  }, [displayToAmount]);
34464
- (0, import_react48.useEffect)(() => {
34788
+ (0, import_react49.useEffect)(() => {
34465
34789
  setDestAddress("");
34466
34790
  }, [toChainType]);
34467
- const fetchRef = (0, import_react48.useRef)(route.fetch);
34468
- (0, import_react48.useEffect)(() => {
34791
+ const fetchRef = (0, import_react49.useRef)(route.fetch);
34792
+ (0, import_react49.useEffect)(() => {
34469
34793
  fetchRef.current = route.fetch;
34470
34794
  });
34471
- (0, import_react48.useEffect)(() => {
34795
+ (0, import_react49.useEffect)(() => {
34472
34796
  if (!canGetQuote || stage !== "home") return;
34473
34797
  if (!fromToken || !fromChain || !toToken || !toChain || !walletAddress)
34474
34798
  return;
@@ -34497,7 +34821,7 @@ function SwapMode({
34497
34821
  destAddress,
34498
34822
  slippage
34499
34823
  ]);
34500
- (0, import_react48.useEffect)(() => {
34824
+ (0, import_react49.useEffect)(() => {
34501
34825
  if (!canGetQuote || !fromToken || !fromChain || !toToken || !toChain || !walletAddress) {
34502
34826
  latestFetchParamsRef.current = null;
34503
34827
  return;
@@ -34524,12 +34848,12 @@ function SwapMode({
34524
34848
  destAddress,
34525
34849
  slippage
34526
34850
  ]);
34527
- (0, import_react48.useEffect)(() => {
34851
+ (0, import_react49.useEffect)(() => {
34528
34852
  quoteTimestampRef.current = route.data ? Date.now() : null;
34529
34853
  setQuoteAge(0);
34530
34854
  }, [route.data]);
34531
- const msgTimeoutRef = (0, import_react48.useRef)(null);
34532
- (0, import_react48.useEffect)(() => {
34855
+ const msgTimeoutRef = (0, import_react49.useRef)(null);
34856
+ (0, import_react49.useEffect)(() => {
34533
34857
  if (!route.loading) {
34534
34858
  setQuoteLoadingMsgIdx(0);
34535
34859
  setQuoteLoadingMsgVisible(true);
@@ -34547,7 +34871,7 @@ function SwapMode({
34547
34871
  if (msgTimeoutRef.current !== null) clearTimeout(msgTimeoutRef.current);
34548
34872
  };
34549
34873
  }, [route.loading]);
34550
- (0, import_react48.useEffect)(() => {
34874
+ (0, import_react49.useEffect)(() => {
34551
34875
  if (!route.data) return;
34552
34876
  const id = setInterval(() => {
34553
34877
  const ts = quoteTimestampRef.current;
@@ -34561,7 +34885,7 @@ function SwapMode({
34561
34885
  }, 1e3);
34562
34886
  return () => clearInterval(id);
34563
34887
  }, [route.data]);
34564
- (0, import_react48.useEffect)(() => {
34888
+ (0, import_react49.useEffect)(() => {
34565
34889
  if (stage !== "review") return;
34566
34890
  if (!route.data || !walletAddress) return;
34567
34891
  const fromTokenAddress = fromToken?.address;
@@ -34572,7 +34896,7 @@ function SwapMode({
34572
34896
  routeResult: route.data
34573
34897
  });
34574
34898
  }, [stage, route.data, walletAddress, fromToken]);
34575
- (0, import_react48.useEffect)(() => {
34899
+ (0, import_react49.useEffect)(() => {
34576
34900
  if (!showSettings) {
34577
34901
  setShowCurrencyDropdown(false);
34578
34902
  return;
@@ -34585,7 +34909,7 @@ function SwapMode({
34585
34909
  document.addEventListener("mousedown", handler);
34586
34910
  return () => document.removeEventListener("mousedown", handler);
34587
34911
  }, [showSettings]);
34588
- (0, import_react48.useEffect)(() => {
34912
+ (0, import_react49.useEffect)(() => {
34589
34913
  if (!showCurrencyDropdown) return;
34590
34914
  const handler = (e2) => {
34591
34915
  if (currencyDropdownRef.current && !currencyDropdownRef.current.contains(e2.target)) {
@@ -35127,7 +35451,7 @@ function SwapMode({
35127
35451
  timeStyle: "short"
35128
35452
  }) ?? null;
35129
35453
  return /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(WidgetContainer, { theme: resolvedTheme, style, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { style: { position: "relative", overflow: "hidden" }, children: [
35130
- /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_react48.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ConfettiEffect3, { isActive: true, pieceCount: 60, clearDelay: 4e3 }) }),
35454
+ /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(import_react49.Suspense, { fallback: null, children: /* @__PURE__ */ (0, import_jsx_runtime57.jsx)(ConfettiEffect3, { isActive: true, pieceCount: 60, clearDelay: 4e3 }) }),
35131
35455
  /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)("div", { style: { padding: `${spacing[6]} ${spacing[6]} 0` }, children: [
35132
35456
  /* @__PURE__ */ (0, import_jsx_runtime57.jsxs)(
35133
35457
  "div",
@@ -37735,8 +38059,8 @@ function ReviewDetailRow({
37735
38059
  value,
37736
38060
  tooltip
37737
38061
  }) {
37738
- const iconRef = (0, import_react48.useRef)(null);
37739
- const [tipPos, setTipPos] = (0, import_react48.useState)(null);
38062
+ const iconRef = (0, import_react49.useRef)(null);
38063
+ const [tipPos, setTipPos] = (0, import_react49.useState)(null);
37740
38064
  const handleMouseEnter = () => {
37741
38065
  if (!tooltip || !iconRef.current) return;
37742
38066
  const r = iconRef.current.getBoundingClientRect();
@@ -38015,11 +38339,11 @@ function ProcessingStepLine({ done }) {
38015
38339
  }
38016
38340
  );
38017
38341
  }
38018
- var import_react48, import_react_dom, import_jsx_runtime57, ConfettiEffect3, QUOTE_TTL, QUOTE_LOADING_MESSAGES, PERCENT_OPTIONS;
38342
+ var import_react49, import_react_dom, import_jsx_runtime57, ConfettiEffect3, QUOTE_TTL, QUOTE_LOADING_MESSAGES, PERCENT_OPTIONS;
38019
38343
  var init_SwapMode = __esm({
38020
38344
  "src/modes/swap/SwapMode.tsx"() {
38021
38345
  "use strict";
38022
- import_react48 = require("react");
38346
+ import_react49 = require("react");
38023
38347
  import_react_dom = __toESM(require("react-dom"), 1);
38024
38348
  init_styles();
38025
38349
  init_utils();
@@ -38042,7 +38366,7 @@ var init_SwapMode = __esm({
38042
38366
  init_SwapWalletSelector();
38043
38367
  init_currency();
38044
38368
  import_jsx_runtime57 = require("react/jsx-runtime");
38045
- ConfettiEffect3 = (0, import_react48.lazy)(
38369
+ ConfettiEffect3 = (0, import_react49.lazy)(
38046
38370
  () => Promise.resolve().then(() => (init_ConfettiEffect(), ConfettiEffect_exports))
38047
38371
  );
38048
38372
  QUOTE_TTL = 60;
@@ -38083,7 +38407,7 @@ function WidgetContent({
38083
38407
  const { transactionHash, transactionStatus } = useDepositTransaction();
38084
38408
  const { resolvedTheme, toggleTheme } = useDepositUi();
38085
38409
  useWalletExternalDisconnect(() => setCurrentStep("home"));
38086
- (0, import_react49.useEffect)(() => {
38410
+ (0, import_react50.useEffect)(() => {
38087
38411
  const state = {
38088
38412
  currentStep,
38089
38413
  amount,
@@ -38126,8 +38450,8 @@ function WidgetInner({
38126
38450
  const { transactionStatus } = useDepositTransaction();
38127
38451
  const { resolvedTheme } = useDepositUi();
38128
38452
  const { status, revalidate, errors } = useTrustware();
38129
- const [showConfirmDialog, setShowConfirmDialog] = (0, import_react49.useState)(false);
38130
- const handleCloseRequest = (0, import_react49.useCallback)(() => {
38453
+ const [showConfirmDialog, setShowConfirmDialog] = (0, import_react50.useState)(false);
38454
+ const handleCloseRequest = (0, import_react50.useCallback)(() => {
38131
38455
  if (ACTIVE_TRANSACTION_STATUSES.includes(transactionStatus)) {
38132
38456
  setShowConfirmDialog(true);
38133
38457
  } else {
@@ -38138,20 +38462,20 @@ function WidgetInner({
38138
38462
  onClose?.();
38139
38463
  }
38140
38464
  }, [transactionStatus, onClose, resetState]);
38141
- (0, import_react49.useEffect)(() => {
38465
+ (0, import_react50.useEffect)(() => {
38142
38466
  closeRequestRef.current = handleCloseRequest;
38143
38467
  }, [handleCloseRequest, closeRequestRef]);
38144
- const handleConfirmClose = (0, import_react49.useCallback)(() => {
38468
+ const handleConfirmClose = (0, import_react50.useCallback)(() => {
38145
38469
  setShowConfirmDialog(false);
38146
38470
  onClose?.();
38147
38471
  }, [onClose]);
38148
- const handleCancelClose = (0, import_react49.useCallback)(() => {
38472
+ const handleCancelClose = (0, import_react50.useCallback)(() => {
38149
38473
  setShowConfirmDialog(false);
38150
38474
  }, []);
38151
38475
  const effectiveTheme = resolvedTheme;
38152
38476
  const isRefreshing = status === "initializing";
38153
38477
  const initBlocked = status === "error";
38154
- const handleRefresh = (0, import_react49.useCallback)(() => {
38478
+ const handleRefresh = (0, import_react50.useCallback)(() => {
38155
38479
  revalidate?.();
38156
38480
  }, [revalidate]);
38157
38481
  return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)(import_jsx_runtime58.Fragment, { children: [
@@ -38185,11 +38509,11 @@ function WidgetInner({
38185
38509
  )
38186
38510
  ] });
38187
38511
  }
38188
- var import_react49, import_jsx_runtime58, widgetContentContainerStyle, themeToggleContainerStyle, TrustwareWidgetV2;
38512
+ var import_react50, import_jsx_runtime58, widgetContentContainerStyle, themeToggleContainerStyle, TrustwareWidgetV2;
38189
38513
  var init_TrustwareWidgetV2 = __esm({
38190
38514
  "src/widget/TrustwareWidgetV2.tsx"() {
38191
38515
  "use strict";
38192
- import_react49 = require("react");
38516
+ import_react50 = require("react");
38193
38517
  init_utils();
38194
38518
  init_styles();
38195
38519
  init_DepositContext();
@@ -38215,7 +38539,7 @@ var init_TrustwareWidgetV2 = __esm({
38215
38539
  right: spacing[3],
38216
38540
  zIndex: 12
38217
38541
  };
38218
- TrustwareWidgetV2 = (0, import_react49.forwardRef)(function TrustwareWidgetV22({
38542
+ TrustwareWidgetV2 = (0, import_react50.forwardRef)(function TrustwareWidgetV22({
38219
38543
  theme,
38220
38544
  style,
38221
38545
  initialStep = "home",
@@ -38224,15 +38548,15 @@ var init_TrustwareWidgetV2 = __esm({
38224
38548
  onOpen,
38225
38549
  showThemeToggle = true
38226
38550
  }, ref) {
38227
- const [isOpen, setIsOpen] = (0, import_react49.useState)(defaultOpen);
38228
- const closeRequestRef = (0, import_react49.useRef)(null);
38551
+ const [isOpen, setIsOpen] = (0, import_react50.useState)(defaultOpen);
38552
+ const closeRequestRef = (0, import_react50.useRef)(null);
38229
38553
  const config = useTrustwareConfig();
38230
38554
  const effectiveInitialStep = initialStep;
38231
- const open = (0, import_react49.useCallback)(() => {
38555
+ const open = (0, import_react50.useCallback)(() => {
38232
38556
  setIsOpen(true);
38233
38557
  onOpen?.();
38234
38558
  }, [onOpen]);
38235
- const close = (0, import_react49.useCallback)(() => {
38559
+ const close = (0, import_react50.useCallback)(() => {
38236
38560
  if (closeRequestRef.current) {
38237
38561
  closeRequestRef.current();
38238
38562
  } else {
@@ -38240,11 +38564,11 @@ var init_TrustwareWidgetV2 = __esm({
38240
38564
  onClose?.();
38241
38565
  }
38242
38566
  }, [onClose]);
38243
- const handleClose = (0, import_react49.useCallback)(() => {
38567
+ const handleClose = (0, import_react50.useCallback)(() => {
38244
38568
  setIsOpen(false);
38245
38569
  onClose?.();
38246
38570
  }, [onClose]);
38247
- (0, import_react49.useImperativeHandle)(
38571
+ (0, import_react50.useImperativeHandle)(
38248
38572
  ref,
38249
38573
  () => ({
38250
38574
  open,