@unifold/ui-react 0.1.6 → 0.1.7

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.
package/dist/index.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  // src/components/deposits/DepositModal.tsx
2
2
  import { useState as useState5, useEffect as useEffect5 } from "react";
3
+ import { ChevronRight as ChevronRight6 } from "lucide-react";
3
4
 
4
5
  // src/components/shared/dialog.tsx
5
6
  import * as React2 from "react";
@@ -444,6 +445,20 @@ async function getFiatCurrencies(publishableKey) {
444
445
  }
445
446
  return response.json();
446
447
  }
448
+ async function getProjectConfig(publishableKey) {
449
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
450
+ const response = await fetch(`${API_BASE_URL}/v1/public/projects/config`, {
451
+ method: "GET",
452
+ headers: {
453
+ accept: "application/json",
454
+ "x-publishable-key": pk
455
+ }
456
+ });
457
+ if (!response.ok) {
458
+ throw new Error(`Failed to fetch project config: ${response.statusText}`);
459
+ }
460
+ return response.json();
461
+ }
447
462
 
448
463
  // src/components/deposits/DepositExecutionItem.tsx
449
464
  import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
@@ -918,15 +933,17 @@ function TransferCryptoBase({
918
933
  showDetailedDropdowns = false,
919
934
  onExecutionsChange,
920
935
  onDepositSuccess,
921
- onDepositError
936
+ onDepositError,
937
+ wallets: externalWallets
922
938
  }) {
923
939
  const { themeClass } = useTheme();
924
940
  const isDarkMode = themeClass.includes("uf-dark");
925
941
  const [token, setToken] = useState2("USDC");
926
942
  const [chain, setChain] = useState2("solana:mainnet");
927
943
  const [copied, setCopied] = useState2(false);
928
- const [wallets, setWallets] = useState2([]);
929
- const [loading, setLoading] = useState2(true);
944
+ const [internalWallets, setInternalWallets] = useState2([]);
945
+ const [loading, setLoading] = useState2(!externalWallets?.length);
946
+ const wallets = externalWallets?.length ? externalWallets : internalWallets;
930
947
  const [error, setError] = useState2(null);
931
948
  const [depositExecutions, setDepositExecutions] = useState2([]);
932
949
  const [trackedExecutions, setTrackedExecutions] = useState2(/* @__PURE__ */ new Map());
@@ -990,9 +1007,16 @@ function TransferCryptoBase({
990
1007
  }
991
1008
  }, [depositExecutions, onExecutionsChange]);
992
1009
  useEffect3(() => {
993
- async function fetchWallets() {
1010
+ if (externalWallets?.length) {
1011
+ setLoading(false);
1012
+ return;
1013
+ }
1014
+ let retryTimeout = null;
1015
+ let isCancelled = false;
1016
+ const fetchWallets = async () => {
1017
+ if (isCancelled) return;
1018
+ setLoading(true);
994
1019
  try {
995
- setLoading(true);
996
1020
  const response = await createEOA(
997
1021
  {
998
1022
  user_id: userId,
@@ -1003,23 +1027,35 @@ function TransferCryptoBase({
1003
1027
  },
1004
1028
  publishableKey
1005
1029
  );
1006
- setWallets(response.data);
1007
- setError(null);
1030
+ if (!isCancelled) {
1031
+ setInternalWallets(response.data);
1032
+ setError(null);
1033
+ setLoading(false);
1034
+ }
1008
1035
  } catch (err) {
1009
- setError(err instanceof Error ? err.message : "Failed to load wallets");
1010
- console.error("Error fetching wallets:", err);
1011
- } finally {
1012
- setLoading(false);
1036
+ console.error("Error fetching wallets, retrying in 5s:", err);
1037
+ if (!isCancelled) {
1038
+ setError(err instanceof Error ? err.message : "Failed to load wallets");
1039
+ setLoading(false);
1040
+ retryTimeout = setTimeout(fetchWallets, 5e3);
1041
+ }
1013
1042
  }
1014
- }
1043
+ };
1015
1044
  fetchWallets();
1045
+ return () => {
1046
+ isCancelled = true;
1047
+ if (retryTimeout) {
1048
+ clearTimeout(retryTimeout);
1049
+ }
1050
+ };
1016
1051
  }, [
1017
1052
  userId,
1018
1053
  recipientAddress,
1019
1054
  destinationChainType,
1020
1055
  destinationChainId,
1021
1056
  destinationTokenAddress,
1022
- publishableKey
1057
+ publishableKey,
1058
+ externalWallets
1023
1059
  ]);
1024
1060
  useEffect3(() => {
1025
1061
  if (!supportedTokens.length) return;
@@ -1270,7 +1306,7 @@ function TransferCryptoBase({
1270
1306
  {
1271
1307
  value: depositAddress,
1272
1308
  size: 180,
1273
- imageUrl: currentChainData?.icon_url || currentChainFromBackend?.icon_url || getIconUrl("/icons/networks/ethereum.svg"),
1309
+ imageUrl: currentChainData?.icon_url || currentChainFromBackend?.icon_url,
1274
1310
  imageSize: 45,
1275
1311
  darkMode: isDarkMode
1276
1312
  },
@@ -1487,7 +1523,7 @@ function TransferCryptoBase({
1487
1523
  orderSubmittedAt: depositExecutions[0].created_at || (/* @__PURE__ */ new Date()).toISOString(),
1488
1524
  orderFilledAt: depositExecutions[0].updated_at || (/* @__PURE__ */ new Date()).toISOString(),
1489
1525
  explorerUrl: depositExecutions[0].explorer_url,
1490
- completionExplorerUrl: depositExecutions[0].destination_transaction_hashes?.[0] ? `https://polygonscan.com/tx/${depositExecutions[0].destination_transaction_hashes[0]}` : depositExecutions[0].status === "succeeded" /* SUCCEEDED */ ? depositExecutions[0].explorer_url : void 0,
1526
+ completionExplorerUrl: depositExecutions[0].destination_explorer_url ?? void 0,
1491
1527
  status: depositExecutions[0].status,
1492
1528
  tokenIconUrl: depositExecutions[0].source_token_metadata?.icon_url,
1493
1529
  onClose: () => setDepositExecutions([])
@@ -1537,6 +1573,7 @@ function CurrencyListItem({
1537
1573
  isSelected,
1538
1574
  onSelect
1539
1575
  }) {
1576
+ const iconUrl = currency.icon_url;
1540
1577
  return /* @__PURE__ */ jsxs7(
1541
1578
  "button",
1542
1579
  {
@@ -1544,14 +1581,14 @@ function CurrencyListItem({
1544
1581
  className: "uf-w-full uf-bg-secondary hover:uf-bg-accent uf-transition-colors uf-rounded-xl uf-p-3 uf-flex uf-items-center uf-justify-between uf-group",
1545
1582
  children: [
1546
1583
  /* @__PURE__ */ jsxs7("div", { className: "uf-flex uf-items-center uf-gap-3", children: [
1547
- /* @__PURE__ */ jsx13("div", { className: "uf-w-10 uf-h-10 uf-flex uf-items-center uf-justify-center uf-flex-shrink-0 uf-rounded-full uf-overflow-hidden uf-bg-card", children: /* @__PURE__ */ jsx13(
1584
+ /* @__PURE__ */ jsx13("div", { className: "uf-w-10 uf-h-10 uf-flex-shrink-0 uf-rounded-full uf-overflow-hidden uf-bg-card", children: /* @__PURE__ */ jsx13(
1548
1585
  "img",
1549
1586
  {
1550
- src: currency.icon_url,
1587
+ src: iconUrl,
1551
1588
  alt: currency.name,
1552
1589
  width: 40,
1553
1590
  height: 40,
1554
- className: "uf-w-full uf-h-full uf-object-cover uf-rounded-full"
1591
+ className: "uf-w-full uf-h-full uf-object-cover"
1555
1592
  }
1556
1593
  ) }),
1557
1594
  /* @__PURE__ */ jsxs7("div", { className: "uf-text-left", children: [
@@ -1676,18 +1713,6 @@ function CurrencyModal({
1676
1713
 
1677
1714
  // src/hooks/use-user-ip.ts
1678
1715
  import { useQuery } from "@tanstack/react-query";
1679
- async function getIpViaMoonpay(moonpayApiKey) {
1680
- const url = `https://api.moonpay.com/v3/ip_address?apiKey=${moonpayApiKey}`;
1681
- const response = await fetch(url);
1682
- if (!response.ok) {
1683
- throw new Error(`Moonpay IP API failed: ${response.statusText}`);
1684
- }
1685
- const data = await response.json();
1686
- return {
1687
- alpha2: data.alpha2.toLowerCase(),
1688
- state: data.state?.toLowerCase()
1689
- };
1690
- }
1691
1716
  async function getIpViaIpApi() {
1692
1717
  const url = "https://ipapi.co/json";
1693
1718
  const response = await fetch(url);
@@ -1700,7 +1725,7 @@ async function getIpViaIpApi() {
1700
1725
  state: data.region_code?.toLowerCase()
1701
1726
  };
1702
1727
  }
1703
- function useUserIp(moonpayApiKey) {
1728
+ function useUserIp() {
1704
1729
  const {
1705
1730
  data: userIpInfo,
1706
1731
  isLoading,
@@ -1708,21 +1733,12 @@ function useUserIp(moonpayApiKey) {
1708
1733
  } = useQuery({
1709
1734
  queryKey: ["getUserIpInfo"],
1710
1735
  queryFn: async () => {
1711
- if (moonpayApiKey) {
1712
- try {
1713
- const moonpayIpData = await getIpViaMoonpay(moonpayApiKey);
1714
- console.log("IP detected via Moonpay:", moonpayIpData);
1715
- return moonpayIpData;
1716
- } catch (error2) {
1717
- console.warn("Moonpay IP API failed, trying fallback:", error2);
1718
- }
1719
- }
1720
1736
  try {
1721
1737
  const ipApiData = await getIpViaIpApi();
1722
1738
  console.log("IP detected via ipapi.co:", ipApiData);
1723
1739
  return ipApiData;
1724
1740
  } catch (ipApiError) {
1725
- console.error("All IP detection methods failed:", ipApiError);
1741
+ console.error("IP detection failed:", ipApiError);
1726
1742
  throw ipApiError;
1727
1743
  }
1728
1744
  },
@@ -1771,7 +1787,8 @@ function BuyWithCard({
1771
1787
  destinationChainType,
1772
1788
  destinationChainId,
1773
1789
  destinationTokenAddress,
1774
- themeClass = ""
1790
+ themeClass = "",
1791
+ wallets: externalWallets
1775
1792
  }) {
1776
1793
  const [amount, setAmount] = useState4("500.00");
1777
1794
  const [currency, setCurrency] = useState4("usd");
@@ -1806,8 +1823,9 @@ function BuyWithCard({
1806
1823
  const [isAutoSelected, setIsAutoSelected] = useState4(true);
1807
1824
  const [autoSelectedProvider, setAutoSelectedProvider] = useState4(null);
1808
1825
  const [hasManualSelection, setHasManualSelection] = useState4(false);
1809
- const [wallets, setWallets] = useState4([]);
1810
- const [walletsLoading, setWalletsLoading] = useState4(true);
1826
+ const [internalWallets, setInternalWallets] = useState4([]);
1827
+ const [walletsLoading, setWalletsLoading] = useState4(!externalWallets?.length);
1828
+ const wallets = externalWallets?.length ? externalWallets : internalWallets;
1811
1829
  const [countdown, setCountdown] = useState4(60);
1812
1830
  const [fiatCurrencies, setFiatCurrencies] = useState4([]);
1813
1831
  const [preferredCurrencyCodes, setPreferredCurrencyCodes] = useState4([]);
@@ -1836,7 +1854,15 @@ function BuyWithCard({
1836
1854
  fetchFiatCurrencies();
1837
1855
  }, [publishableKey]);
1838
1856
  useEffect4(() => {
1839
- async function fetchWallets() {
1857
+ if (externalWallets?.length) {
1858
+ setWalletsLoading(false);
1859
+ return;
1860
+ }
1861
+ let retryTimeout = null;
1862
+ let isCancelled = false;
1863
+ const fetchWallets = async () => {
1864
+ if (isCancelled) return;
1865
+ setWalletsLoading(true);
1840
1866
  try {
1841
1867
  const response = await createEOA(
1842
1868
  {
@@ -1848,16 +1874,26 @@ function BuyWithCard({
1848
1874
  },
1849
1875
  publishableKey
1850
1876
  );
1851
- setWallets(response.data);
1877
+ if (!isCancelled) {
1878
+ setInternalWallets(response.data);
1879
+ setWalletsLoading(false);
1880
+ }
1852
1881
  } catch (err) {
1853
- console.error("Error fetching wallets:", err);
1854
- setQuotesError("Failed to load wallet addresses");
1855
- } finally {
1856
- setWalletsLoading(false);
1882
+ console.error("Error fetching wallets, retrying in 5s:", err);
1883
+ if (!isCancelled) {
1884
+ setWalletsLoading(false);
1885
+ retryTimeout = setTimeout(fetchWallets, 5e3);
1886
+ }
1857
1887
  }
1858
- }
1888
+ };
1859
1889
  fetchWallets();
1860
- }, [userId, recipientAddress, destinationChainType, destinationChainId, destinationTokenAddress, publishableKey]);
1890
+ return () => {
1891
+ isCancelled = true;
1892
+ if (retryTimeout) {
1893
+ clearTimeout(retryTimeout);
1894
+ }
1895
+ };
1896
+ }, [userId, recipientAddress, destinationChainType, destinationChainId, destinationTokenAddress, publishableKey, externalWallets]);
1861
1897
  useEffect4(() => {
1862
1898
  async function fetchSupportedTokens() {
1863
1899
  try {
@@ -2351,8 +2387,10 @@ import { jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
2351
2387
  function TransferCryptoButton({
2352
2388
  onClick,
2353
2389
  title,
2354
- subtitle
2390
+ subtitle,
2391
+ featuredTokens
2355
2392
  }) {
2393
+ const sortedTokens = featuredTokens ? [...featuredTokens].sort((a, b) => a.position - b.position) : [];
2356
2394
  return /* @__PURE__ */ jsxs11(
2357
2395
  "button",
2358
2396
  {
@@ -2367,88 +2405,20 @@ function TransferCryptoButton({
2367
2405
  ] })
2368
2406
  ] }),
2369
2407
  /* @__PURE__ */ jsxs11("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
2370
- /* @__PURE__ */ jsxs11("div", { className: "uf-flex uf--space-x-1", children: [
2371
- /* @__PURE__ */ jsx17(
2372
- "img",
2373
- {
2374
- src: getIconUrl("/icons/networks/ethereum.svg"),
2375
- alt: "ETH",
2376
- width: 20,
2377
- height: 20,
2378
- className: "uf-rounded-full uf-border-2 uf-border-secondary"
2379
- }
2380
- ),
2381
- /* @__PURE__ */ jsx17(
2382
- "img",
2383
- {
2384
- src: getIconUrl("/icons/networks/optimism.svg"),
2385
- alt: "OP",
2386
- width: 20,
2387
- height: 20,
2388
- className: "uf-rounded-full uf-border-2 uf-border-secondary"
2389
- }
2390
- ),
2391
- /* @__PURE__ */ jsx17(
2392
- "img",
2393
- {
2394
- src: getIconUrl("/icons/networks/polygon.svg"),
2395
- alt: "MATIC",
2396
- width: 20,
2397
- height: 20,
2398
- className: "uf-rounded-full uf-border-2 uf-border-secondary"
2399
- }
2400
- ),
2401
- /* @__PURE__ */ jsx17(
2402
- "img",
2403
- {
2404
- src: getIconUrl("/icons/networks/arbitrum.svg"),
2405
- alt: "ARB",
2406
- width: 20,
2407
- height: 20,
2408
- className: "uf-rounded-full uf-border-2 uf-border-secondary"
2409
- }
2410
- ),
2411
- /* @__PURE__ */ jsx17(
2408
+ /* @__PURE__ */ jsx17("div", { className: "uf-flex uf--space-x-2", children: sortedTokens.map((token) => {
2409
+ const iconUrl = token.icon_urls.find((u) => u.format === "svg")?.url || token.icon_urls.find((u) => u.format === "png")?.url;
2410
+ return /* @__PURE__ */ jsx17(
2412
2411
  "img",
2413
2412
  {
2414
- src: getIconUrl("/icons/tokens/usdc.svg"),
2415
- alt: "USDC",
2413
+ src: iconUrl,
2414
+ alt: token.name,
2416
2415
  width: 20,
2417
2416
  height: 20,
2418
2417
  className: "uf-rounded-full uf-border-2 uf-border-secondary"
2419
- }
2420
- ),
2421
- /* @__PURE__ */ jsx17(
2422
- "img",
2423
- {
2424
- src: getIconUrl("/icons/networks/solana.svg"),
2425
- alt: "SOL",
2426
- width: 20,
2427
- height: 20,
2428
- className: "uf-rounded-full uf-border-2 uf-border-secondary"
2429
- }
2430
- ),
2431
- /* @__PURE__ */ jsx17(
2432
- "img",
2433
- {
2434
- src: getIconUrl("/icons/tokens/avax.svg"),
2435
- alt: "AVAX",
2436
- width: 20,
2437
- height: 20,
2438
- className: "uf-rounded-full uf-border-2 uf-border-secondary"
2439
- }
2440
- ),
2441
- /* @__PURE__ */ jsx17(
2442
- "img",
2443
- {
2444
- src: getIconUrl("/icons/networks/bitcoin.svg"),
2445
- alt: "BTC",
2446
- width: 20,
2447
- height: 20,
2448
- className: "uf-rounded-full uf-border-2 uf-border-secondary"
2449
- }
2450
- )
2451
- ] }),
2418
+ },
2419
+ token.name
2420
+ );
2421
+ }) }),
2452
2422
  /* @__PURE__ */ jsx17(ChevronRight3, { className: "uf-w-4 uf-h-4 uf-text-muted-foreground group-hover:uf-text-foreground uf-transition-colors" })
2453
2423
  ] })
2454
2424
  ]
@@ -2462,7 +2432,8 @@ import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
2462
2432
  function DepositWithCardButton({
2463
2433
  onClick,
2464
2434
  title,
2465
- subtitle
2435
+ subtitle,
2436
+ paymentNetworks
2466
2437
  }) {
2467
2438
  return /* @__PURE__ */ jsxs12(
2468
2439
  "button",
@@ -2478,28 +2449,20 @@ function DepositWithCardButton({
2478
2449
  ] })
2479
2450
  ] }),
2480
2451
  /* @__PURE__ */ jsxs12("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
2481
- /* @__PURE__ */ jsxs12("div", { className: "uf-flex uf-items-center uf-gap-1.5", children: [
2482
- /* @__PURE__ */ jsx18(
2483
- "img",
2484
- {
2485
- src: getIconUrl("/icons/networks/mastercard.svg"),
2486
- alt: "Mastercard",
2487
- width: 32,
2488
- height: 32,
2489
- className: "uf-rounded"
2490
- }
2491
- ),
2492
- /* @__PURE__ */ jsx18(
2452
+ /* @__PURE__ */ jsx18("div", { className: "uf-flex uf-items-center uf-gap-1.5", children: paymentNetworks?.map((network) => {
2453
+ const iconUrl = network.icon_urls.find((u) => u.format === "svg")?.url || network.icon_urls.find((u) => u.format === "png")?.url;
2454
+ return /* @__PURE__ */ jsx18(
2493
2455
  "img",
2494
2456
  {
2495
- src: getIconUrl("/icons/networks/visa.svg"),
2496
- alt: "Visa",
2457
+ src: iconUrl,
2458
+ alt: network.name,
2497
2459
  width: 32,
2498
2460
  height: 32,
2499
2461
  className: "uf-rounded"
2500
- }
2501
- )
2502
- ] }),
2462
+ },
2463
+ network.name
2464
+ );
2465
+ }) }),
2503
2466
  /* @__PURE__ */ jsx18(ChevronRight4, { className: "uf-w-4 uf-h-4 uf-text-muted-foreground group-hover:uf-text-foreground uf-transition-colors" })
2504
2467
  ] })
2505
2468
  ]
@@ -2540,6 +2503,21 @@ function DepositTrackerButton({
2540
2503
 
2541
2504
  // src/components/deposits/DepositModal.tsx
2542
2505
  import { Fragment as Fragment4, jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
2506
+ function SkeletonButton({ variant = "default" }) {
2507
+ return /* @__PURE__ */ jsxs14("div", { className: "uf-w-full uf-bg-secondary uf-rounded-xl uf-p-3 uf-flex uf-items-center uf-justify-between uf-animate-pulse", children: [
2508
+ /* @__PURE__ */ jsxs14("div", { className: "uf-flex uf-items-center uf-gap-3", children: [
2509
+ /* @__PURE__ */ jsx20("div", { className: "uf-bg-muted uf-rounded-lg uf-w-9 uf-h-9" }),
2510
+ /* @__PURE__ */ jsxs14("div", { className: "uf-space-y-1.5", children: [
2511
+ /* @__PURE__ */ jsx20("div", { className: "uf-h-3.5 uf-w-24 uf-bg-muted uf-rounded" }),
2512
+ /* @__PURE__ */ jsx20("div", { className: "uf-h-3 uf-w-32 uf-bg-muted uf-rounded" })
2513
+ ] })
2514
+ ] }),
2515
+ /* @__PURE__ */ jsxs14("div", { className: "uf-flex uf-items-center uf-gap-2", children: [
2516
+ variant === "with-icons" && /* @__PURE__ */ jsx20("div", { className: "uf-flex uf--space-x-1", children: [1, 2, 3].map((i) => /* @__PURE__ */ jsx20("div", { className: "uf-w-5 uf-h-5 uf-rounded-full uf-bg-muted uf-border-2 uf-border-secondary" }, i)) }),
2517
+ /* @__PURE__ */ jsx20(ChevronRight6, { className: "uf-w-4 uf-h-4 uf-text-muted" })
2518
+ ] })
2519
+ ] });
2520
+ }
2543
2521
  var t3 = i18n.depositModal;
2544
2522
  function DepositModal({
2545
2523
  open,
@@ -2564,6 +2542,15 @@ function DepositModal({
2564
2542
  const [quotesCount, setQuotesCount] = useState5(0);
2565
2543
  const [depositsModalOpen, setDepositsModalOpen] = useState5(false);
2566
2544
  const [depositExecutions, setDepositExecutions] = useState5([]);
2545
+ const [projectConfig, setProjectConfig] = useState5(null);
2546
+ const [wallets, setWallets] = useState5([]);
2547
+ const [walletsLoading, setWalletsLoading] = useState5(false);
2548
+ useEffect5(() => {
2549
+ setProjectConfig(null);
2550
+ }, [publishableKey]);
2551
+ useEffect5(() => {
2552
+ setWallets([]);
2553
+ }, [userId, recipientAddress, destinationChainType, destinationChainId, destinationTokenAddress, publishableKey]);
2567
2554
  const [resolvedTheme, setResolvedTheme] = useState5(theme === "auto" ? "dark" : theme);
2568
2555
  useEffect5(() => {
2569
2556
  if (theme === "auto") {
@@ -2578,6 +2565,49 @@ function DepositModal({
2578
2565
  setResolvedTheme(theme);
2579
2566
  }
2580
2567
  }, [theme]);
2568
+ useEffect5(() => {
2569
+ if (open && !projectConfig) {
2570
+ getProjectConfig(publishableKey).then(setProjectConfig).catch(console.error);
2571
+ }
2572
+ }, [open, publishableKey, projectConfig]);
2573
+ useEffect5(() => {
2574
+ if (!open || wallets.length > 0) return;
2575
+ let retryTimeout = null;
2576
+ let isCancelled = false;
2577
+ const fetchWallets = async () => {
2578
+ if (isCancelled) return;
2579
+ setWalletsLoading(true);
2580
+ try {
2581
+ const response = await createEOA(
2582
+ {
2583
+ user_id: userId,
2584
+ recipient_address: recipientAddress,
2585
+ destination_chain_type: destinationChainType,
2586
+ destination_chain_id: destinationChainId,
2587
+ destination_token_address: destinationTokenAddress
2588
+ },
2589
+ publishableKey
2590
+ );
2591
+ if (!isCancelled) {
2592
+ setWallets(response.data);
2593
+ setWalletsLoading(false);
2594
+ }
2595
+ } catch (error) {
2596
+ console.error("Error fetching wallets, retrying in 5s:", error);
2597
+ if (!isCancelled) {
2598
+ setWalletsLoading(false);
2599
+ retryTimeout = setTimeout(fetchWallets, 5e3);
2600
+ }
2601
+ }
2602
+ };
2603
+ fetchWallets();
2604
+ return () => {
2605
+ isCancelled = true;
2606
+ if (retryTimeout) {
2607
+ clearTimeout(retryTimeout);
2608
+ }
2609
+ };
2610
+ }, [open, userId, recipientAddress, destinationChainType, destinationChainId, destinationTokenAddress, publishableKey, wallets.length]);
2581
2611
  const themeClass = resolvedTheme === "dark" ? "uf-dark" : "";
2582
2612
  const handleClose = () => {
2583
2613
  onOpenChange(false);
@@ -2617,13 +2647,18 @@ function DepositModal({
2617
2647
  onClose: handleClose
2618
2648
  }
2619
2649
  ),
2620
- /* @__PURE__ */ jsxs14("div", { className: "uf-pb-4 uf-space-y-3", children: [
2650
+ /* @__PURE__ */ jsx20("div", { className: "uf-pb-4 uf-space-y-3", children: !projectConfig ? /* @__PURE__ */ jsxs14(Fragment4, { children: [
2651
+ /* @__PURE__ */ jsx20(SkeletonButton, { variant: "with-icons" }),
2652
+ /* @__PURE__ */ jsx20(SkeletonButton, { variant: "with-icons" }),
2653
+ !hideDepositTracker && /* @__PURE__ */ jsx20(SkeletonButton, {})
2654
+ ] }) : /* @__PURE__ */ jsxs14(Fragment4, { children: [
2621
2655
  /* @__PURE__ */ jsx20(
2622
2656
  TransferCryptoButton,
2623
2657
  {
2624
2658
  onClick: () => setView("transfer"),
2625
2659
  title: t3.transferCrypto.title,
2626
- subtitle: t3.transferCrypto.subtitle
2660
+ subtitle: t3.transferCrypto.subtitle,
2661
+ featuredTokens: projectConfig.transfer_crypto.networks
2627
2662
  }
2628
2663
  ),
2629
2664
  /* @__PURE__ */ jsx20(
@@ -2631,7 +2666,8 @@ function DepositModal({
2631
2666
  {
2632
2667
  onClick: () => setView("card"),
2633
2668
  title: t3.depositWithCard.title,
2634
- subtitle: t3.depositWithCard.subtitle
2669
+ subtitle: t3.depositWithCard.subtitle,
2670
+ paymentNetworks: projectConfig.payment_networks.networks
2635
2671
  }
2636
2672
  ),
2637
2673
  !hideDepositTracker && /* @__PURE__ */ jsx20(
@@ -2643,7 +2679,7 @@ function DepositModal({
2643
2679
  badge: depositExecutions.length > 0 ? depositExecutions.length : void 0
2644
2680
  }
2645
2681
  )
2646
- ] })
2682
+ ] }) })
2647
2683
  ] }) : view === "transfer" ? /* @__PURE__ */ jsxs14(Fragment4, { children: [
2648
2684
  /* @__PURE__ */ jsx20(
2649
2685
  DepositHeader,
@@ -2665,7 +2701,8 @@ function DepositModal({
2665
2701
  destinationTokenAddress,
2666
2702
  onExecutionsChange: setDepositExecutions,
2667
2703
  onDepositSuccess,
2668
- onDepositError
2704
+ onDepositError,
2705
+ wallets
2669
2706
  }
2670
2707
  )
2671
2708
  ] }) : /* @__PURE__ */ jsxs14(Fragment4, { children: [
@@ -2693,7 +2730,8 @@ function DepositModal({
2693
2730
  destinationTokenAddress,
2694
2731
  onDepositSuccess,
2695
2732
  onDepositError,
2696
- themeClass
2733
+ themeClass,
2734
+ wallets
2697
2735
  }
2698
2736
  )
2699
2737
  ] })