@unifold/connect-react 0.1.64 → 0.1.65

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
@@ -7004,6 +7004,29 @@ async function getDepositQuote(request, publishableKey) {
7004
7004
  const json = await response.json();
7005
7005
  return json.data;
7006
7006
  }
7007
+ async function buildHypercoreTransaction(request, publishableKey) {
7008
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
7009
+ validatePublishableKey(pk);
7010
+ const response = await fetch(
7011
+ `${API_BASE_URL}/v1/public/transactions/hypercore/build`,
7012
+ {
7013
+ method: "POST",
7014
+ headers: {
7015
+ accept: "application/json",
7016
+ "x-publishable-key": pk,
7017
+ "Content-Type": "application/json"
7018
+ },
7019
+ body: JSON.stringify(request)
7020
+ }
7021
+ );
7022
+ if (!response.ok) {
7023
+ const error = await response.json().catch(() => ({ message: response.statusText }));
7024
+ throw new Error(
7025
+ `Failed to build HyperCore transaction: ${error.message || response.statusText}`
7026
+ );
7027
+ }
7028
+ return response.json();
7029
+ }
7007
7030
  async function getCashAppLimits(currency = "usd", publishableKey) {
7008
7031
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
7009
7032
  validatePublishableKey(pk);
@@ -7069,6 +7092,29 @@ async function getCashAppSessionStatus(externalId, publishableKey) {
7069
7092
  }
7070
7093
  return response.json();
7071
7094
  }
7095
+ async function sendHypercoreTransaction(request, publishableKey) {
7096
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
7097
+ validatePublishableKey(pk);
7098
+ const response = await fetch(
7099
+ `${API_BASE_URL}/v1/public/transactions/hypercore/send`,
7100
+ {
7101
+ method: "POST",
7102
+ headers: {
7103
+ accept: "application/json",
7104
+ "x-publishable-key": pk,
7105
+ "Content-Type": "application/json"
7106
+ },
7107
+ body: JSON.stringify(request)
7108
+ }
7109
+ );
7110
+ if (!response.ok) {
7111
+ const error = await response.json().catch(() => ({ message: response.statusText }));
7112
+ throw new Error(
7113
+ `Failed to send HyperCore transaction: ${error.message || response.statusText}`
7114
+ );
7115
+ }
7116
+ return response.json();
7117
+ }
7072
7118
  var DepositEventType = /* @__PURE__ */ ((DepositEventType2) => {
7073
7119
  DepositEventType2["ONRAMP_SESSION_CREATED"] = "onramp_session.created";
7074
7120
  return DepositEventType2;
@@ -13596,6 +13642,22 @@ function clearStoredWalletState() {
13596
13642
  } catch {
13597
13643
  }
13598
13644
  }
13645
+ var LAST_OPENED_WALLET_KEY = "unifold_last_opened_wallet";
13646
+ function getLastOpenedWallet() {
13647
+ if (typeof window === "undefined") return void 0;
13648
+ try {
13649
+ return localStorage.getItem(LAST_OPENED_WALLET_KEY) ?? void 0;
13650
+ } catch {
13651
+ return void 0;
13652
+ }
13653
+ }
13654
+ function setLastOpenedWallet(walletId) {
13655
+ if (typeof window === "undefined") return;
13656
+ try {
13657
+ localStorage.setItem(LAST_OPENED_WALLET_KEY, walletId);
13658
+ } catch {
13659
+ }
13660
+ }
13599
13661
  var MOBILE_VIEWPORT_MEDIA_QUERY = "(max-width: 768px)";
13600
13662
  function isMobileViewport() {
13601
13663
  if (typeof window === "undefined") return false;
@@ -14401,7 +14463,7 @@ function DepositHeader({
14401
14463
  setShowBalanceSkeleton(false);
14402
14464
  return;
14403
14465
  }
14404
- const supportedChainTypes = ["ethereum", "solana", "bitcoin"];
14466
+ const supportedChainTypes = ["ethereum", "solana", "bitcoin", "n1"];
14405
14467
  if (!supportedChainTypes.includes(
14406
14468
  balanceChainType
14407
14469
  )) {
@@ -24419,7 +24481,7 @@ function useHypercoreActivation(params) {
24419
24481
  publishableKey,
24420
24482
  enabled = true
24421
24483
  } = params;
24422
- const isHypercore2 = destinationChainId === HYPERCORE_CHAIN_ID;
24484
+ const isHypercore2 = String(destinationChainId) === HYPERCORE_CHAIN_ID;
24423
24485
  const recipient = recipientAddress?.trim() ?? "";
24424
24486
  const source = sourceAddress?.trim() ?? "";
24425
24487
  const hasAddresses = !!recipient && !!source;
@@ -25565,6 +25627,46 @@ function TransferCryptoDoubleInput({
25565
25627
  }
25566
25628
  ) });
25567
25629
  }
25630
+ function isHypercoreChain(chainId) {
25631
+ return chainId === HYPERCORE_CHAIN_ID;
25632
+ }
25633
+ async function sendHypercoreEvmTransfer(params) {
25634
+ const {
25635
+ provider,
25636
+ fromAddress,
25637
+ recipientAddress,
25638
+ sourceTokenAddress,
25639
+ amount,
25640
+ publishableKey
25641
+ } = params;
25642
+ const currentChainHex = await provider.request({
25643
+ method: "eth_chainId",
25644
+ params: []
25645
+ });
25646
+ const activeChainId = String(parseInt(currentChainHex, 16));
25647
+ const buildResult = await buildHypercoreTransaction(
25648
+ {
25649
+ signature_chain_id: activeChainId,
25650
+ recipient_address: recipientAddress,
25651
+ token_address: sourceTokenAddress,
25652
+ amount
25653
+ },
25654
+ publishableKey
25655
+ );
25656
+ const signature = await provider.request({
25657
+ method: "eth_signTypedData_v4",
25658
+ params: [fromAddress, JSON.stringify(buildResult.typed_data)]
25659
+ });
25660
+ await sendHypercoreTransaction(
25661
+ {
25662
+ action_payload: buildResult.action_payload,
25663
+ signature,
25664
+ nonce: buildResult.nonce
25665
+ },
25666
+ publishableKey
25667
+ );
25668
+ return { signature };
25669
+ }
25568
25670
  function useDepositQuote(params) {
25569
25671
  const {
25570
25672
  publishableKey,
@@ -25972,7 +26074,8 @@ function EnterAmountView({
25972
26074
  onClose,
25973
26075
  quickSelectMode,
25974
26076
  checkoutAmountUsd,
25975
- checkoutReceivedUsd
26077
+ checkoutReceivedUsd,
26078
+ footer
25976
26079
  }) {
25977
26080
  const { colors: colors2, fonts, components } = useTheme();
25978
26081
  const isCheckout = !!checkoutAmountUsd;
@@ -26228,6 +26331,7 @@ function EnterAmountView({
26228
26331
  )
26229
26332
  ] })
26230
26333
  ] }),
26334
+ footer && /* @__PURE__ */ jsx51("div", { className: "uf-shrink-0 uf-pt-2", children: footer }),
26231
26335
  /* @__PURE__ */ jsx51("div", { className: "uf-shrink-0 uf-pt-2", children: /* @__PURE__ */ jsx51(
26232
26336
  "button",
26233
26337
  {
@@ -26677,7 +26781,7 @@ var WALLET_ICONS3 = {
26677
26781
  };
26678
26782
  var FALLBACK_WALLET_DEFINITIONS = [
26679
26783
  { id: "phantom", name: "Phantom", networks: ["ethereum", "solana"], installUrl: "https://phantom.app/", supportsMobileBrowse: true },
26680
- { id: "coinbase", name: "Coinbase Wallet", networks: ["ethereum", "solana"], installUrl: "https://www.coinbase.com/wallet", supportsMobileBrowse: true },
26784
+ { id: "coinbase", name: "Coinbase Wallet", networks: ["ethereum"], installUrl: "https://www.coinbase.com/wallet", supportsMobileBrowse: true },
26681
26785
  { id: "trust", name: "Trust Wallet", networks: ["ethereum", "solana"], installUrl: "https://trustwallet.com/", supportsMobileBrowse: true },
26682
26786
  { id: "metamask", name: "MetaMask", networks: ["ethereum"], installUrl: "https://metamask.io/download/", supportsMobileBrowse: true },
26683
26787
  { id: "rainbow", name: "Rainbow", networks: ["ethereum"], installUrl: "https://rainbow.me/", supportsMobileBrowse: true },
@@ -26737,7 +26841,7 @@ function getLegacyEvmProviders() {
26737
26841
  okxEthereum: win.okxwallet
26738
26842
  };
26739
26843
  }
26740
- function detectAvailableWallets(definitions, filterChainType) {
26844
+ function detectAvailableWallets(definitions, recentWalletId, filterChainType) {
26741
26845
  const solProviders = getSolanaProviders();
26742
26846
  const legacyEvm = getLegacyEvmProviders();
26743
26847
  const eip6963List = getEip6963Providers();
@@ -26763,7 +26867,7 @@ function detectAvailableWallets(definitions, filterChainType) {
26763
26867
  return false;
26764
26868
  }
26765
26869
  });
26766
- return definitions.filter((w) => !filterChainType || w.networks.includes(filterChainType)).map((wallet) => {
26870
+ const sorted = definitions.filter((w) => !filterChainType || w.networks.includes(filterChainType)).map((wallet) => {
26767
26871
  let isInstalled = false;
26768
26872
  const detectedNetworks = [];
26769
26873
  switch (wallet.id) {
@@ -26786,8 +26890,6 @@ function detectAvailableWallets(definitions, filterChainType) {
26786
26890
  isInstalled = true;
26787
26891
  detectedNetworks.push("ethereum");
26788
26892
  }
26789
- if (solProviders.coinbaseSolana || win?.coinbaseWalletExtension?.solana) detectedNetworks.push("solana");
26790
- if (isInstalled && wallet.networks.includes("solana") && !detectedNetworks.includes("solana")) detectedNetworks.push("solana");
26791
26893
  break;
26792
26894
  case "trust":
26793
26895
  if (hasEip6963("trust") || legacyEvm.trustEthereum || legacyEvm.ethereum?.isTrust || win?.trustwallet) {
@@ -26824,11 +26926,17 @@ function detectAvailableWallets(definitions, filterChainType) {
26824
26926
  }
26825
26927
  return { ...wallet, isInstalled, detectedNetworks };
26826
26928
  }).sort((a, b) => {
26929
+ if (recentWalletId) {
26930
+ const aRecent = a.id === recentWalletId ? 1 : 0;
26931
+ const bRecent = b.id === recentWalletId ? 1 : 0;
26932
+ if (aRecent !== bRecent) return bRecent - aRecent;
26933
+ }
26827
26934
  if (a.isInstalled && !b.isInstalled) return -1;
26828
26935
  if (!a.isInstalled && b.isInstalled) return 1;
26829
26936
  if (a.isInstalled && b.isInstalled) return b.networks.length - a.networks.length;
26830
26937
  return 0;
26831
26938
  });
26939
+ return sorted;
26832
26940
  }
26833
26941
  function WalletConnect({
26834
26942
  walletInfo: initialWalletInfo,
@@ -26903,9 +27011,15 @@ function WalletConnect({
26903
27011
  })) : FALLBACK_WALLET_DEFINITIONS,
26904
27012
  [backendWallets]
26905
27013
  );
27014
+ const [recentWalletId, setRecentWalletIdState] = React302.useState(getLastOpenedWallet);
27015
+ React302.useEffect(() => {
27016
+ if (view === "select_wallet") {
27017
+ setRecentWalletIdState(getLastOpenedWallet());
27018
+ }
27019
+ }, [view]);
26906
27020
  const availableWallets = React302.useMemo(
26907
- () => detectAvailableWallets(walletDefinitions),
26908
- [walletDefinitions, eip6963ProviderCount]
27021
+ () => detectAvailableWallets(walletDefinitions, recentWalletId),
27022
+ [walletDefinitions, eip6963ProviderCount, recentWalletId]
26909
27023
  );
26910
27024
  const [isMobile, setIsMobile] = React302.useState(false);
26911
27025
  React302.useEffect(() => {
@@ -26965,7 +27079,7 @@ function WalletConnect({
26965
27079
  const chainType = activeDepositWallet?.chain_type ?? "ethereum";
26966
27080
  const recipientAddress = activeDepositWallet?.address ?? "";
26967
27081
  const isCheckoutMode = !!checkoutAmountUsd;
26968
- const supportedChainType = chainType === "algorand" || chainType === "xrpl" ? "ethereum" : chainType;
27082
+ const supportedChainType = chainType === "algorand" || chainType === "xrpl" || chainType === "cardano" || chainType === "n1" ? "ethereum" : chainType;
26969
27083
  const transitionTo = React302.useCallback((nextView) => {
26970
27084
  if (nextView === viewRef.current) return;
26971
27085
  setIsTransitioning(true);
@@ -26989,6 +27103,8 @@ function WalletConnect({
26989
27103
  );
26990
27104
  if (res.deeplink) {
26991
27105
  setMobileRedirect({ walletId: wallet.id, walletName: wallet.name, deeplink: res.deeplink });
27106
+ setLastOpenedWallet(wallet.id);
27107
+ setRecentWalletIdState(wallet.id);
26992
27108
  setAwaitingMobileDeposit(true);
26993
27109
  transitionTo("mobile_redirect");
26994
27110
  window.location.href = res.deeplink;
@@ -27049,6 +27165,8 @@ function WalletConnect({
27049
27165
  const handleConnectWallet = async (wallet, network) => {
27050
27166
  setConnectingNetwork(network);
27051
27167
  transitionTo("connecting");
27168
+ setLastOpenedWallet(wallet.id);
27169
+ setRecentWalletIdState(wallet.id);
27052
27170
  setWalletError(null);
27053
27171
  setIsWalletConnecting(true);
27054
27172
  try {
@@ -27153,6 +27271,13 @@ function WalletConnect({
27153
27271
  }
27154
27272
  };
27155
27273
  const selectedToken = selectedBalance ? getTokenFromBalance(selectedBalance) : null;
27274
+ const { needsActivation: hypercoreNeedsActivation, activationFee: hypercoreActivationFee, sponsored: hypercoreActivationSponsored } = useHypercoreActivation({
27275
+ recipientAddress,
27276
+ sourceAddress: activeWalletInfo?.address,
27277
+ destinationChainId: selectedToken?.chain_id,
27278
+ publishableKey,
27279
+ enabled: !!activeWalletInfo && !!recipientAddress
27280
+ });
27156
27281
  const effectiveDestinationAmount = React302.useMemo(() => {
27157
27282
  if (!checkoutRemainingBaseUnits || checkoutRemainingBaseUnits === "0") return "0";
27158
27283
  if (!checkoutAmountUsd) return checkoutRemainingBaseUnits;
@@ -27257,7 +27382,7 @@ function WalletConnect({
27257
27382
  let cancelled = false;
27258
27383
  setIsLoading(true);
27259
27384
  setError(null);
27260
- const sct = activeDepositWallet.chain_type === "algorand" || activeDepositWallet.chain_type === "xrpl" ? "ethereum" : activeDepositWallet.chain_type;
27385
+ const sct = activeDepositWallet.chain_type === "algorand" || activeDepositWallet.chain_type === "xrpl" || activeDepositWallet.chain_type === "cardano" || activeDepositWallet.chain_type === "n1" ? "ethereum" : activeDepositWallet.chain_type;
27261
27386
  getAddressBalances(activeWalletInfo.address, sct, publishableKey).then((response) => {
27262
27387
  if (cancelled) return;
27263
27388
  const nonZero = response.balances.filter((b) => b.amount !== "0");
@@ -27423,9 +27548,16 @@ function WalletConnect({
27423
27548
  const [integerPart = "0", decimalPart = ""] = amountStr.trim().split(".");
27424
27549
  return (integerPart + decimalPart.padEnd(decimals, "0").slice(0, decimals)).replace(/^0+/, "") || "0";
27425
27550
  };
27426
- const sendEthereumTransaction = async (token, amountStr) => {
27427
- if (!recipientAddress || !/^0x[a-fA-F0-9]{40}$/.test(recipientAddress)) throw new Error(`Invalid recipient address.`);
27428
- const walletIdMap = { "phantom-ethereum": "phantom", coinbase: "coinbase", trust: "trust", okx: "okx", rainbow: "rainbow", rabby: "rabby", metamask: "metamask" };
27551
+ const resolveEvmProvider = () => {
27552
+ const walletIdMap = {
27553
+ "phantom-ethereum": "phantom",
27554
+ coinbase: "coinbase",
27555
+ trust: "trust",
27556
+ okx: "okx",
27557
+ rainbow: "rainbow",
27558
+ rabby: "rabby",
27559
+ metamask: "metamask"
27560
+ };
27429
27561
  const lookupId = walletIdMap[walletInfo.type] || walletInfo.type;
27430
27562
  const eip6963Match = findProviderByWalletId(lookupId);
27431
27563
  let provider = eip6963Match?.provider;
@@ -27434,6 +27566,11 @@ function WalletConnect({
27434
27566
  else if (walletInfo.type === "coinbase") provider = window.coinbaseWalletExtension || window.ethereum;
27435
27567
  else provider = window.ethereum;
27436
27568
  }
27569
+ return provider;
27570
+ };
27571
+ const sendEthereumTransaction = async (token, amountStr) => {
27572
+ if (!recipientAddress || !/^0x[a-fA-F0-9]{40}$/.test(recipientAddress)) throw new Error(`Invalid recipient address.`);
27573
+ const provider = resolveEvmProvider();
27437
27574
  if (!provider) throw new Error("Ethereum wallet not found");
27438
27575
  const currentChainIdHex = await provider.request({ method: "eth_chainId", params: [] });
27439
27576
  if (parseInt(currentChainIdHex, 16).toString() !== token.chain_id) {
@@ -27498,6 +27635,19 @@ function WalletConnect({
27498
27635
  const resp = await sendSolanaTransaction({ chain_id: "mainnet", signed_transaction: btoa(bs) }, publishableKey);
27499
27636
  return resp.signature;
27500
27637
  };
27638
+ const sendHypercoreDeposit = async (token, amountStr) => {
27639
+ const provider = resolveEvmProvider();
27640
+ if (!provider) throw new Error("Ethereum wallet not found");
27641
+ const { signature } = await sendHypercoreEvmTransfer({
27642
+ provider,
27643
+ fromAddress: walletInfo.address,
27644
+ recipientAddress,
27645
+ sourceTokenAddress: token.token_address,
27646
+ amount: amountStr,
27647
+ publishableKey
27648
+ });
27649
+ return signature;
27650
+ };
27501
27651
  const handleConfirm = async () => {
27502
27652
  if (!hasWallet || !selectedBalance || !amountUsd || tokenAmount === 0 || !recipientAddress) return;
27503
27653
  const token = getTokenFromBalance(selectedBalance);
@@ -27517,7 +27667,33 @@ function WalletConnect({
27517
27667
  setIsConfirming(true);
27518
27668
  setError(null);
27519
27669
  try {
27520
- const txHash = token.chain_type === "solana" ? await sendSolanaTransaction2(token, tokenAmount.toString()) : await sendEthereumTransaction(token, tokenAmount.toString());
27670
+ const isHypercoreToken = String(token.chain_id) === HYPERCORE_CHAIN_ID;
27671
+ let txHash;
27672
+ if (token.chain_type === "solana") {
27673
+ txHash = await sendSolanaTransaction2(token, tokenAmount.toString());
27674
+ } else if (isHypercoreToken) {
27675
+ let sendAmount = tokenAmount;
27676
+ try {
27677
+ const activation = await checkHypercoreActivation(
27678
+ { source_address: walletInfo.address, recipient_address: recipientAddress },
27679
+ publishableKey
27680
+ );
27681
+ if (!activation.user_exists) {
27682
+ const fee = activation.activation_fee;
27683
+ if (!Number.isFinite(tokenAmount) || tokenAmount <= fee) {
27684
+ throw new Error(
27685
+ `Insufficient amount. A ${fee} USDC activation fee is required for the first transfer to this address.`
27686
+ );
27687
+ }
27688
+ sendAmount = tokenAmount - fee;
27689
+ }
27690
+ } catch (e) {
27691
+ if (e instanceof Error && e.message.includes("activation fee")) throw e;
27692
+ }
27693
+ txHash = await sendHypercoreDeposit(token, sendAmount.toString());
27694
+ } else {
27695
+ txHash = await sendEthereumTransaction(token, tokenAmount.toString());
27696
+ }
27521
27697
  setReceivedUsdAtSubmission(checkoutReceivedUsd ?? "0");
27522
27698
  setHasSignedTransaction(true);
27523
27699
  handleIveDeposited();
@@ -27735,7 +27911,7 @@ function WalletConnect({
27735
27911
  }
27736
27912
  if (view === "enter_amount" && selectedToken && selectedBalance) {
27737
27913
  return /* @__PURE__ */ jsx54(AccentColorOverride, { accentColor: walletAccent, accentForeground: walletAccentForeground, children: /* @__PURE__ */ jsx54("div", { style: viewTransitionStyle, children: /* @__PURE__ */ jsx54(EnterAmountView, { walletInfo, selectedBalance, selectedToken, amountUsd, formattedTokenAmount, tokenChainDetails, inputUsdNum, maxUsdAmount, isValidAmount, error, onAmountChange: setAmountUsd, onMaxClick: handleMaxClick, onReview: handleReview, onBack: handleBack, onClose: onClose ?? (() => {
27738
- }), quickSelectMode: amountQuickSelect, checkoutAmountUsd, checkoutReceivedUsd }) }) });
27914
+ }), quickSelectMode: amountQuickSelect, checkoutAmountUsd, checkoutReceivedUsd, footer: hypercoreNeedsActivation && !hypercoreActivationSponsored ? /* @__PURE__ */ jsx54(HypercoreActivationWarning, { activationFee: hypercoreActivationFee }) : void 0 }) }) });
27739
27915
  }
27740
27916
  if (view === "review" && selectedToken) {
27741
27917
  return /* @__PURE__ */ jsx54(AccentColorOverride, { accentColor: walletAccent, accentForeground: walletAccentForeground, children: /* @__PURE__ */ jsx54("div", { style: viewTransitionStyle, children: /* @__PURE__ */ jsx54(ReviewView, { walletInfo, recipientAddress, assetCdnUrl, selectedToken, amountUsd, formattedTokenAmount, tokenChainDetails, loadingTokenDetails, showTransactionDetails, isConfirming, error, onToggleDetails: () => setShowTransactionDetails(!showTransactionDetails), onConfirm: handleConfirm, onBack: handleBack, onClose: onClose ?? (() => {
@@ -27771,6 +27947,9 @@ function SkeletonButton({
27771
27947
  ] });
27772
27948
  }
27773
27949
  var t7 = i18n2.depositModal;
27950
+ function depositTabForScreen(screen) {
27951
+ return screen === "card" || screen === "cashapp" ? "cash" : "crypto";
27952
+ }
27774
27953
  function DepositModal({
27775
27954
  open,
27776
27955
  onOpenChange,
@@ -27806,6 +27985,7 @@ function DepositModal({
27806
27985
  theme = "dark",
27807
27986
  hideOverlay = false,
27808
27987
  initialScreen = "main",
27988
+ displayMode = "stacked",
27809
27989
  transferCryptoTitle = t7.transferCrypto.title,
27810
27990
  depositWithCardTitle = t7.depositWithCard.title,
27811
27991
  payWithExchangeTitle = t7.payWithExchange.title,
@@ -27840,6 +28020,9 @@ function DepositModal({
27840
28020
  effectiveInitialScreen
27841
28021
  );
27842
28022
  const [coinbaseSkipToHoldings, setCoinbaseSkipToHoldings] = useState32(false);
28023
+ const [depositTab, setDepositTab] = useState32(
28024
+ () => depositTabForScreen(effectiveInitialScreen)
28025
+ );
27843
28026
  const resetViewTimeoutRef = useRef92(null);
27844
28027
  const [cardView, setCardView] = useState32(
27845
28028
  "amount"
@@ -28137,6 +28320,7 @@ function DepositModal({
28137
28320
  resetViewTimeoutRef.current = null;
28138
28321
  }
28139
28322
  setView(effectiveInitialScreen);
28323
+ setDepositTab(depositTabForScreen(effectiveInitialScreen));
28140
28324
  setCardView("amount");
28141
28325
  setExchangeView("providers");
28142
28326
  setBrowserWalletInfo(null);
@@ -28165,6 +28349,7 @@ function DepositModal({
28165
28349
  } else if (view === "cashapp" && cashAppView !== "amount") {
28166
28350
  setCashAppView("amount");
28167
28351
  } else {
28352
+ setDepositTab(depositTabForScreen(view));
28168
28353
  setView("main");
28169
28354
  setCardView("amount");
28170
28355
  setExchangeView("providers");
@@ -28244,6 +28429,174 @@ function DepositModal({
28244
28429
  className: "uf-flex uf-justify-center uf-shrink-0"
28245
28430
  }
28246
28431
  ) });
28432
+ const transferCryptoMenuButton = showTransferCrypto ? /* @__PURE__ */ jsx55(
28433
+ TransferCryptoButton,
28434
+ {
28435
+ onClick: () => setView("transfer"),
28436
+ title: transferCryptoTitle,
28437
+ subtitle: t7.transferCrypto.subtitle,
28438
+ featuredTokens: projectConfig?.transfer_crypto.networks
28439
+ },
28440
+ "transfer"
28441
+ ) : null;
28442
+ const connectWalletMenuButton = showConnectWallet ? /* @__PURE__ */ jsx55(
28443
+ BrowserWalletButton,
28444
+ {
28445
+ onClick: handleBrowserWalletClick,
28446
+ onConnectClick: handleWalletConnectClick,
28447
+ onDisconnect: handleWalletDisconnect,
28448
+ chainType: browserWalletChainType,
28449
+ publishableKey,
28450
+ featuredWallets: projectConfig?.connect_wallet?.wallets
28451
+ },
28452
+ "wallet"
28453
+ ) : null;
28454
+ const depositWithCardMenuButton = showFiatOnramp ? /* @__PURE__ */ jsx55(
28455
+ DepositWithCardButton,
28456
+ {
28457
+ onClick: () => setView("card"),
28458
+ title: depositWithCardTitle,
28459
+ subtitle: t7.depositWithCard.subtitle,
28460
+ paymentNetworks: projectConfig?.payment_networks.networks
28461
+ },
28462
+ "card"
28463
+ ) : null;
28464
+ const payWithExchangeMenuButton = showPayWithExchange ? /* @__PURE__ */ jsx55(
28465
+ PayWithExchangeButton,
28466
+ {
28467
+ onClick: () => setView("exchange"),
28468
+ title: payWithExchangeTitle,
28469
+ subtitle: t7.payWithExchange.subtitle,
28470
+ exchanges,
28471
+ loading: exchangesLoading
28472
+ },
28473
+ "exchange"
28474
+ ) : null;
28475
+ const connectExchangeMenuButton = showConnectExchange && connectedExchange ? /* @__PURE__ */ jsx55(
28476
+ ConnectExchangeButton,
28477
+ {
28478
+ onClick: () => {
28479
+ setCoinbaseSkipToHoldings(true);
28480
+ setView("coinbase_connect");
28481
+ },
28482
+ onDisconnect: handleExchangeDisconnect,
28483
+ title: i18n2.connectExchange.title,
28484
+ subtitle: i18n2.connectExchange.subtitle,
28485
+ exchanges: integrationExchanges,
28486
+ connectedExchange
28487
+ },
28488
+ "connect-exchange"
28489
+ ) : showConnectExchange && !connectedExchange ? /* @__PURE__ */ jsx55(
28490
+ ConnectExchangeButton,
28491
+ {
28492
+ onClick: () => {
28493
+ setCoinbaseSkipToHoldings(false);
28494
+ setView("coinbase_connect");
28495
+ },
28496
+ title: i18n2.connectExchange.title,
28497
+ subtitle: i18n2.connectExchange.subtitle,
28498
+ exchanges: integrationExchanges
28499
+ },
28500
+ "connect-exchange"
28501
+ ) : null;
28502
+ const cashAppMenuButton = showCashApp ? /* @__PURE__ */ jsx55(
28503
+ CashAppButton,
28504
+ {
28505
+ onClick: () => setView("cashapp"),
28506
+ title: "Pay with Cash App",
28507
+ subtitle: "Deposit via Cash App",
28508
+ iconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0
28509
+ },
28510
+ "cashapp"
28511
+ ) : null;
28512
+ const depositTrackerMenuButton = showDepositTracker ? /* @__PURE__ */ jsx55(
28513
+ DepositTrackerButton,
28514
+ {
28515
+ onClick: () => {
28516
+ setAllExecutions(depositExecutions);
28517
+ setView("tracker");
28518
+ },
28519
+ title: depositTrackerTitle,
28520
+ subtitle: depositTrackerSubTitle,
28521
+ badge: depositExecutions.length > 0 ? depositExecutions.length : void 0
28522
+ },
28523
+ "tracker"
28524
+ ) : null;
28525
+ const cryptoMenuButtons = [
28526
+ transferCryptoMenuButton,
28527
+ connectWalletMenuButton,
28528
+ payWithExchangeMenuButton,
28529
+ connectExchangeMenuButton
28530
+ ].filter(Boolean);
28531
+ const cashMenuButtons = [
28532
+ depositWithCardMenuButton,
28533
+ cashAppMenuButton
28534
+ ].filter(Boolean);
28535
+ const depositTabs = [
28536
+ { id: "crypto", label: "Use Crypto", buttons: cryptoMenuButtons },
28537
+ { id: "cash", label: "Use Cash", buttons: cashMenuButtons }
28538
+ ].filter((tab) => tab.buttons.length > 0);
28539
+ const activeDepositTab = depositTabs.find((tab) => tab.id === depositTab) ?? depositTabs[0];
28540
+ const renderMainMenuBody = () => {
28541
+ if (depositPrerequisiteBody) {
28542
+ return /* @__PURE__ */ jsx55("div", { className: "uf-space-y-3", children: depositPrerequisiteBody });
28543
+ }
28544
+ if (displayMode === "tabs" && activeDepositTab) {
28545
+ return /* @__PURE__ */ jsxs49("div", { children: [
28546
+ depositTabs.length > 1 && /* @__PURE__ */ jsx55(
28547
+ "div",
28548
+ {
28549
+ className: "uf-flex uf-gap-1 uf-p-1 uf-rounded-xl uf-mb-3",
28550
+ style: {
28551
+ // Frosted-glass track: a translucent fill plus a backdrop blur so
28552
+ // the control reads as a soft surface rather than a solid bar.
28553
+ backgroundColor: `color-mix(in srgb, ${colors2.card} 55%, transparent)`,
28554
+ backdropFilter: "blur(12px)",
28555
+ WebkitBackdropFilter: "blur(12px)"
28556
+ },
28557
+ role: "tablist",
28558
+ children: depositTabs.map((tab) => {
28559
+ const active = activeDepositTab.id === tab.id;
28560
+ return /* @__PURE__ */ jsx55(
28561
+ "button",
28562
+ {
28563
+ type: "button",
28564
+ role: "tab",
28565
+ "aria-selected": active,
28566
+ onClick: () => setDepositTab(tab.id),
28567
+ className: "uf-flex-1 uf-py-2 uf-px-3 uf-rounded-lg uf-text-sm uf-transition-all",
28568
+ style: {
28569
+ // Active tab is a soft, blurred glass pill — a faint accent
28570
+ // tint with its own backdrop blur and a subtle border/shadow,
28571
+ // so it looks frosted instead of like a hard solid button.
28572
+ backgroundColor: active ? `color-mix(in srgb, ${colors2.primary} 22%, transparent)` : "transparent",
28573
+ backdropFilter: active ? "blur(8px)" : void 0,
28574
+ WebkitBackdropFilter: active ? "blur(8px)" : void 0,
28575
+ boxShadow: active ? `0 1px 8px color-mix(in srgb, ${colors2.primary} 25%, transparent)` : void 0,
28576
+ color: active ? colors2.foreground : colors2.foregroundMuted,
28577
+ fontFamily: fonts.medium
28578
+ },
28579
+ children: tab.label
28580
+ },
28581
+ tab.id
28582
+ );
28583
+ })
28584
+ }
28585
+ ),
28586
+ /* @__PURE__ */ jsx55("div", { className: "uf-space-y-3", children: activeDepositTab.buttons }),
28587
+ depositTrackerMenuButton && /* @__PURE__ */ jsx55("div", { className: "uf-mt-3", children: depositTrackerMenuButton })
28588
+ ] });
28589
+ }
28590
+ return /* @__PURE__ */ jsxs49("div", { className: "uf-space-y-3", children: [
28591
+ transferCryptoMenuButton,
28592
+ connectWalletMenuButton,
28593
+ depositWithCardMenuButton,
28594
+ payWithExchangeMenuButton,
28595
+ connectExchangeMenuButton,
28596
+ cashAppMenuButton,
28597
+ depositTrackerMenuButton
28598
+ ] });
28599
+ };
28247
28600
  return /* @__PURE__ */ jsx55(PortalContainerProvider, { value: hideOverlay ? containerEl : null, children: /* @__PURE__ */ jsx55(
28248
28601
  Dialog2,
28249
28602
  {
@@ -28270,7 +28623,7 @@ function DepositModal({
28270
28623
  onClose: handleClose,
28271
28624
  showBalance: showBalanceHeader,
28272
28625
  balanceAddress: recipientAddress,
28273
- balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" ? destinationChainType : void 0,
28626
+ balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
28274
28627
  balanceChainId: destinationChainId,
28275
28628
  balanceTokenAddress: destinationTokenAddress,
28276
28629
  projectName: projectConfig?.project_name,
@@ -28278,94 +28631,7 @@ function DepositModal({
28278
28631
  }
28279
28632
  ),
28280
28633
  /* @__PURE__ */ jsxs49("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
28281
- /* @__PURE__ */ jsx55("div", { className: "uf-space-y-3", children: depositPrerequisiteBody ?? /* @__PURE__ */ jsxs49(Fragment11, { children: [
28282
- showTransferCrypto && /* @__PURE__ */ jsx55(
28283
- TransferCryptoButton,
28284
- {
28285
- onClick: () => setView("transfer"),
28286
- title: transferCryptoTitle,
28287
- subtitle: t7.transferCrypto.subtitle,
28288
- featuredTokens: projectConfig?.transfer_crypto.networks
28289
- }
28290
- ),
28291
- showConnectWallet && /* @__PURE__ */ jsx55(
28292
- BrowserWalletButton,
28293
- {
28294
- onClick: handleBrowserWalletClick,
28295
- onConnectClick: handleWalletConnectClick,
28296
- onDisconnect: handleWalletDisconnect,
28297
- chainType: browserWalletChainType,
28298
- publishableKey,
28299
- featuredWallets: projectConfig?.connect_wallet?.wallets
28300
- }
28301
- ),
28302
- showFiatOnramp && /* @__PURE__ */ jsx55(
28303
- DepositWithCardButton,
28304
- {
28305
- onClick: () => setView("card"),
28306
- title: depositWithCardTitle,
28307
- subtitle: t7.depositWithCard.subtitle,
28308
- paymentNetworks: projectConfig?.payment_networks.networks
28309
- }
28310
- ),
28311
- showPayWithExchange && /* @__PURE__ */ jsx55(
28312
- PayWithExchangeButton,
28313
- {
28314
- onClick: () => setView("exchange"),
28315
- title: payWithExchangeTitle,
28316
- subtitle: t7.payWithExchange.subtitle,
28317
- exchanges,
28318
- loading: exchangesLoading
28319
- }
28320
- ),
28321
- showConnectExchange && connectedExchange && /* @__PURE__ */ jsx55(
28322
- ConnectExchangeButton,
28323
- {
28324
- onClick: () => {
28325
- setCoinbaseSkipToHoldings(true);
28326
- setView("coinbase_connect");
28327
- },
28328
- onDisconnect: handleExchangeDisconnect,
28329
- title: i18n2.connectExchange.title,
28330
- subtitle: i18n2.connectExchange.subtitle,
28331
- exchanges: integrationExchanges,
28332
- connectedExchange
28333
- }
28334
- ),
28335
- showConnectExchange && !connectedExchange && /* @__PURE__ */ jsx55(
28336
- ConnectExchangeButton,
28337
- {
28338
- onClick: () => {
28339
- setCoinbaseSkipToHoldings(false);
28340
- setView("coinbase_connect");
28341
- },
28342
- title: i18n2.connectExchange.title,
28343
- subtitle: i18n2.connectExchange.subtitle,
28344
- exchanges: integrationExchanges
28345
- }
28346
- ),
28347
- showCashApp && /* @__PURE__ */ jsx55(
28348
- CashAppButton,
28349
- {
28350
- onClick: () => setView("cashapp"),
28351
- title: "Pay with Cash App",
28352
- subtitle: "Deposit via Cash App",
28353
- iconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0
28354
- }
28355
- ),
28356
- showDepositTracker && /* @__PURE__ */ jsx55(
28357
- DepositTrackerButton,
28358
- {
28359
- onClick: () => {
28360
- setAllExecutions(depositExecutions);
28361
- setView("tracker");
28362
- },
28363
- title: depositTrackerTitle,
28364
- subtitle: depositTrackerSubTitle,
28365
- badge: depositExecutions.length > 0 ? depositExecutions.length : void 0
28366
- }
28367
- )
28368
- ] }) }),
28634
+ renderMainMenuBody(),
28369
28635
  depositPoweredByFooter
28370
28636
  ] })
28371
28637
  ] }) : view === "transfer" ? /* @__PURE__ */ jsxs49(Fragment11, { children: [
@@ -28378,7 +28644,7 @@ function DepositModal({
28378
28644
  onClose: handleClose,
28379
28645
  showBalance: showBalanceHeader,
28380
28646
  balanceAddress: recipientAddress,
28381
- balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" ? destinationChainType : void 0,
28647
+ balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
28382
28648
  balanceChainId: destinationChainId,
28383
28649
  balanceTokenAddress: destinationTokenAddress,
28384
28650
  projectName: projectConfig?.project_name,
@@ -28466,7 +28732,7 @@ function DepositModal({
28466
28732
  badge: cardView === "quotes" ? { count: quotesCount } : void 0,
28467
28733
  showBalance: showBalanceHeader,
28468
28734
  balanceAddress: recipientAddress,
28469
- balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" ? destinationChainType : void 0,
28735
+ balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
28470
28736
  balanceChainId: destinationChainId,
28471
28737
  balanceTokenAddress: destinationTokenAddress,
28472
28738
  projectName: projectConfig?.project_name,
@@ -29762,9 +30028,6 @@ function useVerifyRecipientAddress(params) {
29762
30028
  refetchOnWindowFocus: false
29763
30029
  });
29764
30030
  }
29765
- function isHypercoreChain(chainId) {
29766
- return chainId === HYPERCORE_CHAIN_ID;
29767
- }
29768
30031
  function useGetDepositAddress(params) {
29769
30032
  const {
29770
30033
  userId,
@@ -30691,8 +30954,6 @@ function WithdrawConfirmingView({
30691
30954
  className: "uf-text-sm uf-text-center",
30692
30955
  style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
30693
30956
  children: [
30694
- txInfo.amount,
30695
- " ",
30696
30957
  txInfo.sourceTokenSymbol,
30697
30958
  " to",
30698
30959
  " ",
@@ -31336,6 +31597,7 @@ function UnifoldProvider2({
31336
31597
  hideDepositTracker: config?.hideDepositTracker,
31337
31598
  showBalanceHeader: config?.showBalanceHeader,
31338
31599
  transferInputVariant: config?.transferInputVariant,
31600
+ displayMode: config?.displayMode,
31339
31601
  enableTransferCrypto: config?.enableTransferCrypto,
31340
31602
  enableConnectWallet: config?.enableConnectWallet,
31341
31603
  enablePayWithExchange: config?.enablePayWithExchange,