@unifold/ui-web 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.
Files changed (3) hide show
  1. package/dist/index.js +375 -113
  2. package/dist/index.mjs +375 -113
  3. package/package.json +5 -5
package/dist/index.js CHANGED
@@ -43986,6 +43986,29 @@ async function getDepositQuote(request, publishableKey) {
43986
43986
  const json = await response.json();
43987
43987
  return json.data;
43988
43988
  }
43989
+ async function buildHypercoreTransaction(request, publishableKey) {
43990
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
43991
+ validatePublishableKey(pk);
43992
+ const response = await fetch(
43993
+ `${API_BASE_URL}/v1/public/transactions/hypercore/build`,
43994
+ {
43995
+ method: "POST",
43996
+ headers: {
43997
+ accept: "application/json",
43998
+ "x-publishable-key": pk,
43999
+ "Content-Type": "application/json"
44000
+ },
44001
+ body: JSON.stringify(request)
44002
+ }
44003
+ );
44004
+ if (!response.ok) {
44005
+ const error = await response.json().catch(() => ({ message: response.statusText }));
44006
+ throw new Error(
44007
+ `Failed to build HyperCore transaction: ${error.message || response.statusText}`
44008
+ );
44009
+ }
44010
+ return response.json();
44011
+ }
43989
44012
  async function getCashAppLimits(currency = "usd", publishableKey) {
43990
44013
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
43991
44014
  validatePublishableKey(pk);
@@ -44051,6 +44074,29 @@ async function getCashAppSessionStatus(externalId, publishableKey) {
44051
44074
  }
44052
44075
  return response.json();
44053
44076
  }
44077
+ async function sendHypercoreTransaction(request, publishableKey) {
44078
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
44079
+ validatePublishableKey(pk);
44080
+ const response = await fetch(
44081
+ `${API_BASE_URL}/v1/public/transactions/hypercore/send`,
44082
+ {
44083
+ method: "POST",
44084
+ headers: {
44085
+ accept: "application/json",
44086
+ "x-publishable-key": pk,
44087
+ "Content-Type": "application/json"
44088
+ },
44089
+ body: JSON.stringify(request)
44090
+ }
44091
+ );
44092
+ if (!response.ok) {
44093
+ const error = await response.json().catch(() => ({ message: response.statusText }));
44094
+ throw new Error(
44095
+ `Failed to send HyperCore transaction: ${error.message || response.statusText}`
44096
+ );
44097
+ }
44098
+ return response.json();
44099
+ }
44054
44100
  var DepositEventType = /* @__PURE__ */ ((DepositEventType2) => {
44055
44101
  DepositEventType2["ONRAMP_SESSION_CREATED"] = "onramp_session.created";
44056
44102
  return DepositEventType2;
@@ -50227,6 +50273,22 @@ function clearStoredWalletState() {
50227
50273
  } catch {
50228
50274
  }
50229
50275
  }
50276
+ var LAST_OPENED_WALLET_KEY = "unifold_last_opened_wallet";
50277
+ function getLastOpenedWallet() {
50278
+ if (typeof window === "undefined") return void 0;
50279
+ try {
50280
+ return localStorage.getItem(LAST_OPENED_WALLET_KEY) ?? void 0;
50281
+ } catch {
50282
+ return void 0;
50283
+ }
50284
+ }
50285
+ function setLastOpenedWallet(walletId) {
50286
+ if (typeof window === "undefined") return;
50287
+ try {
50288
+ localStorage.setItem(LAST_OPENED_WALLET_KEY, walletId);
50289
+ } catch {
50290
+ }
50291
+ }
50230
50292
  var MOBILE_VIEWPORT_MEDIA_QUERY = "(max-width: 768px)";
50231
50293
  function isMobileViewport() {
50232
50294
  if (typeof window === "undefined") return false;
@@ -51032,7 +51094,7 @@ function DepositHeader({
51032
51094
  setShowBalanceSkeleton(false);
51033
51095
  return;
51034
51096
  }
51035
- const supportedChainTypes = ["ethereum", "solana", "bitcoin"];
51097
+ const supportedChainTypes = ["ethereum", "solana", "bitcoin", "n1"];
51036
51098
  if (!supportedChainTypes.includes(
51037
51099
  balanceChainType
51038
51100
  )) {
@@ -61050,7 +61112,7 @@ function useHypercoreActivation(params) {
61050
61112
  publishableKey,
61051
61113
  enabled = true
61052
61114
  } = params;
61053
- const isHypercore2 = destinationChainId === HYPERCORE_CHAIN_ID;
61115
+ const isHypercore2 = String(destinationChainId) === HYPERCORE_CHAIN_ID;
61054
61116
  const recipient = recipientAddress?.trim() ?? "";
61055
61117
  const source = sourceAddress?.trim() ?? "";
61056
61118
  const hasAddresses = !!recipient && !!source;
@@ -62196,6 +62258,46 @@ function TransferCryptoDoubleInput({
62196
62258
  }
62197
62259
  ) });
62198
62260
  }
62261
+ function isHypercoreChain(chainId) {
62262
+ return chainId === HYPERCORE_CHAIN_ID;
62263
+ }
62264
+ async function sendHypercoreEvmTransfer(params) {
62265
+ const {
62266
+ provider,
62267
+ fromAddress,
62268
+ recipientAddress,
62269
+ sourceTokenAddress,
62270
+ amount,
62271
+ publishableKey
62272
+ } = params;
62273
+ const currentChainHex = await provider.request({
62274
+ method: "eth_chainId",
62275
+ params: []
62276
+ });
62277
+ const activeChainId = String(parseInt(currentChainHex, 16));
62278
+ const buildResult = await buildHypercoreTransaction(
62279
+ {
62280
+ signature_chain_id: activeChainId,
62281
+ recipient_address: recipientAddress,
62282
+ token_address: sourceTokenAddress,
62283
+ amount
62284
+ },
62285
+ publishableKey
62286
+ );
62287
+ const signature = await provider.request({
62288
+ method: "eth_signTypedData_v4",
62289
+ params: [fromAddress, JSON.stringify(buildResult.typed_data)]
62290
+ });
62291
+ await sendHypercoreTransaction(
62292
+ {
62293
+ action_payload: buildResult.action_payload,
62294
+ signature,
62295
+ nonce: buildResult.nonce
62296
+ },
62297
+ publishableKey
62298
+ );
62299
+ return { signature };
62300
+ }
62199
62301
  function useDepositQuote(params) {
62200
62302
  const {
62201
62303
  publishableKey,
@@ -62603,7 +62705,8 @@ function EnterAmountView({
62603
62705
  onClose,
62604
62706
  quickSelectMode,
62605
62707
  checkoutAmountUsd,
62606
- checkoutReceivedUsd
62708
+ checkoutReceivedUsd,
62709
+ footer
62607
62710
  }) {
62608
62711
  const { colors: colors2, fonts, components } = useTheme();
62609
62712
  const isCheckout = !!checkoutAmountUsd;
@@ -62859,6 +62962,7 @@ function EnterAmountView({
62859
62962
  )
62860
62963
  ] })
62861
62964
  ] }),
62965
+ footer && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "uf-shrink-0 uf-pt-2", children: footer }),
62862
62966
  /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "uf-shrink-0 uf-pt-2", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
62863
62967
  "button",
62864
62968
  {
@@ -63308,7 +63412,7 @@ var WALLET_ICONS3 = {
63308
63412
  };
63309
63413
  var FALLBACK_WALLET_DEFINITIONS = [
63310
63414
  { id: "phantom", name: "Phantom", networks: ["ethereum", "solana"], installUrl: "https://phantom.app/", supportsMobileBrowse: true },
63311
- { id: "coinbase", name: "Coinbase Wallet", networks: ["ethereum", "solana"], installUrl: "https://www.coinbase.com/wallet", supportsMobileBrowse: true },
63415
+ { id: "coinbase", name: "Coinbase Wallet", networks: ["ethereum"], installUrl: "https://www.coinbase.com/wallet", supportsMobileBrowse: true },
63312
63416
  { id: "trust", name: "Trust Wallet", networks: ["ethereum", "solana"], installUrl: "https://trustwallet.com/", supportsMobileBrowse: true },
63313
63417
  { id: "metamask", name: "MetaMask", networks: ["ethereum"], installUrl: "https://metamask.io/download/", supportsMobileBrowse: true },
63314
63418
  { id: "rainbow", name: "Rainbow", networks: ["ethereum"], installUrl: "https://rainbow.me/", supportsMobileBrowse: true },
@@ -63368,7 +63472,7 @@ function getLegacyEvmProviders() {
63368
63472
  okxEthereum: win.okxwallet
63369
63473
  };
63370
63474
  }
63371
- function detectAvailableWallets(definitions, filterChainType) {
63475
+ function detectAvailableWallets(definitions, recentWalletId, filterChainType) {
63372
63476
  const solProviders = getSolanaProviders();
63373
63477
  const legacyEvm = getLegacyEvmProviders();
63374
63478
  const eip6963List = getEip6963Providers();
@@ -63394,7 +63498,7 @@ function detectAvailableWallets(definitions, filterChainType) {
63394
63498
  return false;
63395
63499
  }
63396
63500
  });
63397
- return definitions.filter((w) => !filterChainType || w.networks.includes(filterChainType)).map((wallet) => {
63501
+ const sorted = definitions.filter((w) => !filterChainType || w.networks.includes(filterChainType)).map((wallet) => {
63398
63502
  let isInstalled = false;
63399
63503
  const detectedNetworks = [];
63400
63504
  switch (wallet.id) {
@@ -63417,8 +63521,6 @@ function detectAvailableWallets(definitions, filterChainType) {
63417
63521
  isInstalled = true;
63418
63522
  detectedNetworks.push("ethereum");
63419
63523
  }
63420
- if (solProviders.coinbaseSolana || win?.coinbaseWalletExtension?.solana) detectedNetworks.push("solana");
63421
- if (isInstalled && wallet.networks.includes("solana") && !detectedNetworks.includes("solana")) detectedNetworks.push("solana");
63422
63524
  break;
63423
63525
  case "trust":
63424
63526
  if (hasEip6963("trust") || legacyEvm.trustEthereum || legacyEvm.ethereum?.isTrust || win?.trustwallet) {
@@ -63455,11 +63557,17 @@ function detectAvailableWallets(definitions, filterChainType) {
63455
63557
  }
63456
63558
  return { ...wallet, isInstalled, detectedNetworks };
63457
63559
  }).sort((a, b) => {
63560
+ if (recentWalletId) {
63561
+ const aRecent = a.id === recentWalletId ? 1 : 0;
63562
+ const bRecent = b.id === recentWalletId ? 1 : 0;
63563
+ if (aRecent !== bRecent) return bRecent - aRecent;
63564
+ }
63458
63565
  if (a.isInstalled && !b.isInstalled) return -1;
63459
63566
  if (!a.isInstalled && b.isInstalled) return 1;
63460
63567
  if (a.isInstalled && b.isInstalled) return b.networks.length - a.networks.length;
63461
63568
  return 0;
63462
63569
  });
63570
+ return sorted;
63463
63571
  }
63464
63572
  function WalletConnect({
63465
63573
  walletInfo: initialWalletInfo,
@@ -63534,9 +63642,15 @@ function WalletConnect({
63534
63642
  })) : FALLBACK_WALLET_DEFINITIONS,
63535
63643
  [backendWallets]
63536
63644
  );
63645
+ const [recentWalletId, setRecentWalletIdState] = React302.useState(getLastOpenedWallet);
63646
+ React302.useEffect(() => {
63647
+ if (view === "select_wallet") {
63648
+ setRecentWalletIdState(getLastOpenedWallet());
63649
+ }
63650
+ }, [view]);
63537
63651
  const availableWallets = React302.useMemo(
63538
- () => detectAvailableWallets(walletDefinitions),
63539
- [walletDefinitions, eip6963ProviderCount]
63652
+ () => detectAvailableWallets(walletDefinitions, recentWalletId),
63653
+ [walletDefinitions, eip6963ProviderCount, recentWalletId]
63540
63654
  );
63541
63655
  const [isMobile, setIsMobile] = React302.useState(false);
63542
63656
  React302.useEffect(() => {
@@ -63596,7 +63710,7 @@ function WalletConnect({
63596
63710
  const chainType = activeDepositWallet?.chain_type ?? "ethereum";
63597
63711
  const recipientAddress = activeDepositWallet?.address ?? "";
63598
63712
  const isCheckoutMode = !!checkoutAmountUsd;
63599
- const supportedChainType = chainType === "algorand" || chainType === "xrpl" ? "ethereum" : chainType;
63713
+ const supportedChainType = chainType === "algorand" || chainType === "xrpl" || chainType === "cardano" || chainType === "n1" ? "ethereum" : chainType;
63600
63714
  const transitionTo = React302.useCallback((nextView) => {
63601
63715
  if (nextView === viewRef.current) return;
63602
63716
  setIsTransitioning(true);
@@ -63620,6 +63734,8 @@ function WalletConnect({
63620
63734
  );
63621
63735
  if (res.deeplink) {
63622
63736
  setMobileRedirect({ walletId: wallet.id, walletName: wallet.name, deeplink: res.deeplink });
63737
+ setLastOpenedWallet(wallet.id);
63738
+ setRecentWalletIdState(wallet.id);
63623
63739
  setAwaitingMobileDeposit(true);
63624
63740
  transitionTo("mobile_redirect");
63625
63741
  window.location.href = res.deeplink;
@@ -63680,6 +63796,8 @@ function WalletConnect({
63680
63796
  const handleConnectWallet = async (wallet, network) => {
63681
63797
  setConnectingNetwork(network);
63682
63798
  transitionTo("connecting");
63799
+ setLastOpenedWallet(wallet.id);
63800
+ setRecentWalletIdState(wallet.id);
63683
63801
  setWalletError(null);
63684
63802
  setIsWalletConnecting(true);
63685
63803
  try {
@@ -63784,6 +63902,13 @@ function WalletConnect({
63784
63902
  }
63785
63903
  };
63786
63904
  const selectedToken = selectedBalance ? getTokenFromBalance(selectedBalance) : null;
63905
+ const { needsActivation: hypercoreNeedsActivation, activationFee: hypercoreActivationFee, sponsored: hypercoreActivationSponsored } = useHypercoreActivation({
63906
+ recipientAddress,
63907
+ sourceAddress: activeWalletInfo?.address,
63908
+ destinationChainId: selectedToken?.chain_id,
63909
+ publishableKey,
63910
+ enabled: !!activeWalletInfo && !!recipientAddress
63911
+ });
63787
63912
  const effectiveDestinationAmount = React302.useMemo(() => {
63788
63913
  if (!checkoutRemainingBaseUnits || checkoutRemainingBaseUnits === "0") return "0";
63789
63914
  if (!checkoutAmountUsd) return checkoutRemainingBaseUnits;
@@ -63888,7 +64013,7 @@ function WalletConnect({
63888
64013
  let cancelled = false;
63889
64014
  setIsLoading(true);
63890
64015
  setError(null);
63891
- const sct = activeDepositWallet.chain_type === "algorand" || activeDepositWallet.chain_type === "xrpl" ? "ethereum" : activeDepositWallet.chain_type;
64016
+ const sct = activeDepositWallet.chain_type === "algorand" || activeDepositWallet.chain_type === "xrpl" || activeDepositWallet.chain_type === "cardano" || activeDepositWallet.chain_type === "n1" ? "ethereum" : activeDepositWallet.chain_type;
63892
64017
  getAddressBalances(activeWalletInfo.address, sct, publishableKey).then((response) => {
63893
64018
  if (cancelled) return;
63894
64019
  const nonZero = response.balances.filter((b) => b.amount !== "0");
@@ -64054,9 +64179,16 @@ function WalletConnect({
64054
64179
  const [integerPart = "0", decimalPart = ""] = amountStr.trim().split(".");
64055
64180
  return (integerPart + decimalPart.padEnd(decimals, "0").slice(0, decimals)).replace(/^0+/, "") || "0";
64056
64181
  };
64057
- const sendEthereumTransaction = async (token, amountStr) => {
64058
- if (!recipientAddress || !/^0x[a-fA-F0-9]{40}$/.test(recipientAddress)) throw new Error(`Invalid recipient address.`);
64059
- const walletIdMap = { "phantom-ethereum": "phantom", coinbase: "coinbase", trust: "trust", okx: "okx", rainbow: "rainbow", rabby: "rabby", metamask: "metamask" };
64182
+ const resolveEvmProvider = () => {
64183
+ const walletIdMap = {
64184
+ "phantom-ethereum": "phantom",
64185
+ coinbase: "coinbase",
64186
+ trust: "trust",
64187
+ okx: "okx",
64188
+ rainbow: "rainbow",
64189
+ rabby: "rabby",
64190
+ metamask: "metamask"
64191
+ };
64060
64192
  const lookupId = walletIdMap[walletInfo.type] || walletInfo.type;
64061
64193
  const eip6963Match = findProviderByWalletId(lookupId);
64062
64194
  let provider = eip6963Match?.provider;
@@ -64065,6 +64197,11 @@ function WalletConnect({
64065
64197
  else if (walletInfo.type === "coinbase") provider = window.coinbaseWalletExtension || window.ethereum;
64066
64198
  else provider = window.ethereum;
64067
64199
  }
64200
+ return provider;
64201
+ };
64202
+ const sendEthereumTransaction = async (token, amountStr) => {
64203
+ if (!recipientAddress || !/^0x[a-fA-F0-9]{40}$/.test(recipientAddress)) throw new Error(`Invalid recipient address.`);
64204
+ const provider = resolveEvmProvider();
64068
64205
  if (!provider) throw new Error("Ethereum wallet not found");
64069
64206
  const currentChainIdHex = await provider.request({ method: "eth_chainId", params: [] });
64070
64207
  if (parseInt(currentChainIdHex, 16).toString() !== token.chain_id) {
@@ -64129,6 +64266,19 @@ function WalletConnect({
64129
64266
  const resp = await sendSolanaTransaction({ chain_id: "mainnet", signed_transaction: btoa(bs) }, publishableKey);
64130
64267
  return resp.signature;
64131
64268
  };
64269
+ const sendHypercoreDeposit = async (token, amountStr) => {
64270
+ const provider = resolveEvmProvider();
64271
+ if (!provider) throw new Error("Ethereum wallet not found");
64272
+ const { signature } = await sendHypercoreEvmTransfer({
64273
+ provider,
64274
+ fromAddress: walletInfo.address,
64275
+ recipientAddress,
64276
+ sourceTokenAddress: token.token_address,
64277
+ amount: amountStr,
64278
+ publishableKey
64279
+ });
64280
+ return signature;
64281
+ };
64132
64282
  const handleConfirm = async () => {
64133
64283
  if (!hasWallet || !selectedBalance || !amountUsd || tokenAmount === 0 || !recipientAddress) return;
64134
64284
  const token = getTokenFromBalance(selectedBalance);
@@ -64148,7 +64298,33 @@ function WalletConnect({
64148
64298
  setIsConfirming(true);
64149
64299
  setError(null);
64150
64300
  try {
64151
- const txHash = token.chain_type === "solana" ? await sendSolanaTransaction2(token, tokenAmount.toString()) : await sendEthereumTransaction(token, tokenAmount.toString());
64301
+ const isHypercoreToken = String(token.chain_id) === HYPERCORE_CHAIN_ID;
64302
+ let txHash;
64303
+ if (token.chain_type === "solana") {
64304
+ txHash = await sendSolanaTransaction2(token, tokenAmount.toString());
64305
+ } else if (isHypercoreToken) {
64306
+ let sendAmount = tokenAmount;
64307
+ try {
64308
+ const activation = await checkHypercoreActivation(
64309
+ { source_address: walletInfo.address, recipient_address: recipientAddress },
64310
+ publishableKey
64311
+ );
64312
+ if (!activation.user_exists) {
64313
+ const fee = activation.activation_fee;
64314
+ if (!Number.isFinite(tokenAmount) || tokenAmount <= fee) {
64315
+ throw new Error(
64316
+ `Insufficient amount. A ${fee} USDC activation fee is required for the first transfer to this address.`
64317
+ );
64318
+ }
64319
+ sendAmount = tokenAmount - fee;
64320
+ }
64321
+ } catch (e) {
64322
+ if (e instanceof Error && e.message.includes("activation fee")) throw e;
64323
+ }
64324
+ txHash = await sendHypercoreDeposit(token, sendAmount.toString());
64325
+ } else {
64326
+ txHash = await sendEthereumTransaction(token, tokenAmount.toString());
64327
+ }
64152
64328
  setReceivedUsdAtSubmission(checkoutReceivedUsd ?? "0");
64153
64329
  setHasSignedTransaction(true);
64154
64330
  handleIveDeposited();
@@ -64366,7 +64542,7 @@ function WalletConnect({
64366
64542
  }
64367
64543
  if (view === "enter_amount" && selectedToken && selectedBalance) {
64368
64544
  return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(AccentColorOverride, { accentColor: walletAccent, accentForeground: walletAccentForeground, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { style: viewTransitionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(EnterAmountView, { walletInfo, selectedBalance, selectedToken, amountUsd, formattedTokenAmount, tokenChainDetails, inputUsdNum, maxUsdAmount, isValidAmount, error, onAmountChange: setAmountUsd, onMaxClick: handleMaxClick, onReview: handleReview, onBack: handleBack, onClose: onClose ?? (() => {
64369
- }), quickSelectMode: amountQuickSelect, checkoutAmountUsd, checkoutReceivedUsd }) }) });
64545
+ }), quickSelectMode: amountQuickSelect, checkoutAmountUsd, checkoutReceivedUsd, footer: hypercoreNeedsActivation && !hypercoreActivationSponsored ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(HypercoreActivationWarning, { activationFee: hypercoreActivationFee }) : void 0 }) }) });
64370
64546
  }
64371
64547
  if (view === "review" && selectedToken) {
64372
64548
  return /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(AccentColorOverride, { accentColor: walletAccent, accentForeground: walletAccentForeground, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)("div", { style: viewTransitionStyle, children: /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(ReviewView, { walletInfo, recipientAddress, assetCdnUrl, selectedToken, amountUsd, formattedTokenAmount, tokenChainDetails, loadingTokenDetails, showTransactionDetails, isConfirming, error, onToggleDetails: () => setShowTransactionDetails(!showTransactionDetails), onConfirm: handleConfirm, onBack: handleBack, onClose: onClose ?? (() => {
@@ -64402,6 +64578,9 @@ function SkeletonButton({
64402
64578
  ] });
64403
64579
  }
64404
64580
  var t7 = i18n2.depositModal;
64581
+ function depositTabForScreen(screen) {
64582
+ return screen === "card" || screen === "cashapp" ? "cash" : "crypto";
64583
+ }
64405
64584
  function DepositModal({
64406
64585
  open,
64407
64586
  onOpenChange,
@@ -64437,6 +64616,7 @@ function DepositModal({
64437
64616
  theme = "dark",
64438
64617
  hideOverlay = false,
64439
64618
  initialScreen = "main",
64619
+ displayMode = "stacked",
64440
64620
  transferCryptoTitle = t7.transferCrypto.title,
64441
64621
  depositWithCardTitle = t7.depositWithCard.title,
64442
64622
  payWithExchangeTitle = t7.payWithExchange.title,
@@ -64471,6 +64651,9 @@ function DepositModal({
64471
64651
  effectiveInitialScreen
64472
64652
  );
64473
64653
  const [coinbaseSkipToHoldings, setCoinbaseSkipToHoldings] = (0, import_react3.useState)(false);
64654
+ const [depositTab, setDepositTab] = (0, import_react3.useState)(
64655
+ () => depositTabForScreen(effectiveInitialScreen)
64656
+ );
64474
64657
  const resetViewTimeoutRef = (0, import_react3.useRef)(null);
64475
64658
  const [cardView, setCardView] = (0, import_react3.useState)(
64476
64659
  "amount"
@@ -64768,6 +64951,7 @@ function DepositModal({
64768
64951
  resetViewTimeoutRef.current = null;
64769
64952
  }
64770
64953
  setView(effectiveInitialScreen);
64954
+ setDepositTab(depositTabForScreen(effectiveInitialScreen));
64771
64955
  setCardView("amount");
64772
64956
  setExchangeView("providers");
64773
64957
  setBrowserWalletInfo(null);
@@ -64796,6 +64980,7 @@ function DepositModal({
64796
64980
  } else if (view === "cashapp" && cashAppView !== "amount") {
64797
64981
  setCashAppView("amount");
64798
64982
  } else {
64983
+ setDepositTab(depositTabForScreen(view));
64799
64984
  setView("main");
64800
64985
  setCardView("amount");
64801
64986
  setExchangeView("providers");
@@ -64875,6 +65060,174 @@ function DepositModal({
64875
65060
  className: "uf-flex uf-justify-center uf-shrink-0"
64876
65061
  }
64877
65062
  ) });
65063
+ const transferCryptoMenuButton = showTransferCrypto ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65064
+ TransferCryptoButton,
65065
+ {
65066
+ onClick: () => setView("transfer"),
65067
+ title: transferCryptoTitle,
65068
+ subtitle: t7.transferCrypto.subtitle,
65069
+ featuredTokens: projectConfig?.transfer_crypto.networks
65070
+ },
65071
+ "transfer"
65072
+ ) : null;
65073
+ const connectWalletMenuButton = showConnectWallet ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65074
+ BrowserWalletButton,
65075
+ {
65076
+ onClick: handleBrowserWalletClick,
65077
+ onConnectClick: handleWalletConnectClick,
65078
+ onDisconnect: handleWalletDisconnect,
65079
+ chainType: browserWalletChainType,
65080
+ publishableKey,
65081
+ featuredWallets: projectConfig?.connect_wallet?.wallets
65082
+ },
65083
+ "wallet"
65084
+ ) : null;
65085
+ const depositWithCardMenuButton = showFiatOnramp ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65086
+ DepositWithCardButton,
65087
+ {
65088
+ onClick: () => setView("card"),
65089
+ title: depositWithCardTitle,
65090
+ subtitle: t7.depositWithCard.subtitle,
65091
+ paymentNetworks: projectConfig?.payment_networks.networks
65092
+ },
65093
+ "card"
65094
+ ) : null;
65095
+ const payWithExchangeMenuButton = showPayWithExchange ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65096
+ PayWithExchangeButton,
65097
+ {
65098
+ onClick: () => setView("exchange"),
65099
+ title: payWithExchangeTitle,
65100
+ subtitle: t7.payWithExchange.subtitle,
65101
+ exchanges,
65102
+ loading: exchangesLoading
65103
+ },
65104
+ "exchange"
65105
+ ) : null;
65106
+ const connectExchangeMenuButton = showConnectExchange && connectedExchange ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65107
+ ConnectExchangeButton,
65108
+ {
65109
+ onClick: () => {
65110
+ setCoinbaseSkipToHoldings(true);
65111
+ setView("coinbase_connect");
65112
+ },
65113
+ onDisconnect: handleExchangeDisconnect,
65114
+ title: i18n2.connectExchange.title,
65115
+ subtitle: i18n2.connectExchange.subtitle,
65116
+ exchanges: integrationExchanges,
65117
+ connectedExchange
65118
+ },
65119
+ "connect-exchange"
65120
+ ) : showConnectExchange && !connectedExchange ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65121
+ ConnectExchangeButton,
65122
+ {
65123
+ onClick: () => {
65124
+ setCoinbaseSkipToHoldings(false);
65125
+ setView("coinbase_connect");
65126
+ },
65127
+ title: i18n2.connectExchange.title,
65128
+ subtitle: i18n2.connectExchange.subtitle,
65129
+ exchanges: integrationExchanges
65130
+ },
65131
+ "connect-exchange"
65132
+ ) : null;
65133
+ const cashAppMenuButton = showCashApp ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65134
+ CashAppButton,
65135
+ {
65136
+ onClick: () => setView("cashapp"),
65137
+ title: "Pay with Cash App",
65138
+ subtitle: "Deposit via Cash App",
65139
+ iconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0
65140
+ },
65141
+ "cashapp"
65142
+ ) : null;
65143
+ const depositTrackerMenuButton = showDepositTracker ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65144
+ DepositTrackerButton,
65145
+ {
65146
+ onClick: () => {
65147
+ setAllExecutions(depositExecutions);
65148
+ setView("tracker");
65149
+ },
65150
+ title: depositTrackerTitle,
65151
+ subtitle: depositTrackerSubTitle,
65152
+ badge: depositExecutions.length > 0 ? depositExecutions.length : void 0
65153
+ },
65154
+ "tracker"
65155
+ ) : null;
65156
+ const cryptoMenuButtons = [
65157
+ transferCryptoMenuButton,
65158
+ connectWalletMenuButton,
65159
+ payWithExchangeMenuButton,
65160
+ connectExchangeMenuButton
65161
+ ].filter(Boolean);
65162
+ const cashMenuButtons = [
65163
+ depositWithCardMenuButton,
65164
+ cashAppMenuButton
65165
+ ].filter(Boolean);
65166
+ const depositTabs = [
65167
+ { id: "crypto", label: "Use Crypto", buttons: cryptoMenuButtons },
65168
+ { id: "cash", label: "Use Cash", buttons: cashMenuButtons }
65169
+ ].filter((tab) => tab.buttons.length > 0);
65170
+ const activeDepositTab = depositTabs.find((tab) => tab.id === depositTab) ?? depositTabs[0];
65171
+ const renderMainMenuBody = () => {
65172
+ if (depositPrerequisiteBody) {
65173
+ return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-space-y-3", children: depositPrerequisiteBody });
65174
+ }
65175
+ if (displayMode === "tabs" && activeDepositTab) {
65176
+ return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { children: [
65177
+ depositTabs.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65178
+ "div",
65179
+ {
65180
+ className: "uf-flex uf-gap-1 uf-p-1 uf-rounded-xl uf-mb-3",
65181
+ style: {
65182
+ // Frosted-glass track: a translucent fill plus a backdrop blur so
65183
+ // the control reads as a soft surface rather than a solid bar.
65184
+ backgroundColor: `color-mix(in srgb, ${colors2.card} 55%, transparent)`,
65185
+ backdropFilter: "blur(12px)",
65186
+ WebkitBackdropFilter: "blur(12px)"
65187
+ },
65188
+ role: "tablist",
65189
+ children: depositTabs.map((tab) => {
65190
+ const active = activeDepositTab.id === tab.id;
65191
+ return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65192
+ "button",
65193
+ {
65194
+ type: "button",
65195
+ role: "tab",
65196
+ "aria-selected": active,
65197
+ onClick: () => setDepositTab(tab.id),
65198
+ className: "uf-flex-1 uf-py-2 uf-px-3 uf-rounded-lg uf-text-sm uf-transition-all",
65199
+ style: {
65200
+ // Active tab is a soft, blurred glass pill — a faint accent
65201
+ // tint with its own backdrop blur and a subtle border/shadow,
65202
+ // so it looks frosted instead of like a hard solid button.
65203
+ backgroundColor: active ? `color-mix(in srgb, ${colors2.primary} 22%, transparent)` : "transparent",
65204
+ backdropFilter: active ? "blur(8px)" : void 0,
65205
+ WebkitBackdropFilter: active ? "blur(8px)" : void 0,
65206
+ boxShadow: active ? `0 1px 8px color-mix(in srgb, ${colors2.primary} 25%, transparent)` : void 0,
65207
+ color: active ? colors2.foreground : colors2.foregroundMuted,
65208
+ fontFamily: fonts.medium
65209
+ },
65210
+ children: tab.label
65211
+ },
65212
+ tab.id
65213
+ );
65214
+ })
65215
+ }
65216
+ ),
65217
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-space-y-3", children: activeDepositTab.buttons }),
65218
+ depositTrackerMenuButton && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-mt-3", children: depositTrackerMenuButton })
65219
+ ] });
65220
+ }
65221
+ return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-space-y-3", children: [
65222
+ transferCryptoMenuButton,
65223
+ connectWalletMenuButton,
65224
+ depositWithCardMenuButton,
65225
+ payWithExchangeMenuButton,
65226
+ connectExchangeMenuButton,
65227
+ cashAppMenuButton,
65228
+ depositTrackerMenuButton
65229
+ ] });
65230
+ };
64878
65231
  return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(PortalContainerProvider, { value: hideOverlay ? containerEl : null, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64879
65232
  Dialog2,
64880
65233
  {
@@ -64901,7 +65254,7 @@ function DepositModal({
64901
65254
  onClose: handleClose,
64902
65255
  showBalance: showBalanceHeader,
64903
65256
  balanceAddress: recipientAddress,
64904
- balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" ? destinationChainType : void 0,
65257
+ balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
64905
65258
  balanceChainId: destinationChainId,
64906
65259
  balanceTokenAddress: destinationTokenAddress,
64907
65260
  projectName: projectConfig?.project_name,
@@ -64909,94 +65262,7 @@ function DepositModal({
64909
65262
  }
64910
65263
  ),
64911
65264
  /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
64912
- /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-space-y-3", children: depositPrerequisiteBody ?? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
64913
- showTransferCrypto && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64914
- TransferCryptoButton,
64915
- {
64916
- onClick: () => setView("transfer"),
64917
- title: transferCryptoTitle,
64918
- subtitle: t7.transferCrypto.subtitle,
64919
- featuredTokens: projectConfig?.transfer_crypto.networks
64920
- }
64921
- ),
64922
- showConnectWallet && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64923
- BrowserWalletButton,
64924
- {
64925
- onClick: handleBrowserWalletClick,
64926
- onConnectClick: handleWalletConnectClick,
64927
- onDisconnect: handleWalletDisconnect,
64928
- chainType: browserWalletChainType,
64929
- publishableKey,
64930
- featuredWallets: projectConfig?.connect_wallet?.wallets
64931
- }
64932
- ),
64933
- showFiatOnramp && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64934
- DepositWithCardButton,
64935
- {
64936
- onClick: () => setView("card"),
64937
- title: depositWithCardTitle,
64938
- subtitle: t7.depositWithCard.subtitle,
64939
- paymentNetworks: projectConfig?.payment_networks.networks
64940
- }
64941
- ),
64942
- showPayWithExchange && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64943
- PayWithExchangeButton,
64944
- {
64945
- onClick: () => setView("exchange"),
64946
- title: payWithExchangeTitle,
64947
- subtitle: t7.payWithExchange.subtitle,
64948
- exchanges,
64949
- loading: exchangesLoading
64950
- }
64951
- ),
64952
- showConnectExchange && connectedExchange && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64953
- ConnectExchangeButton,
64954
- {
64955
- onClick: () => {
64956
- setCoinbaseSkipToHoldings(true);
64957
- setView("coinbase_connect");
64958
- },
64959
- onDisconnect: handleExchangeDisconnect,
64960
- title: i18n2.connectExchange.title,
64961
- subtitle: i18n2.connectExchange.subtitle,
64962
- exchanges: integrationExchanges,
64963
- connectedExchange
64964
- }
64965
- ),
64966
- showConnectExchange && !connectedExchange && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64967
- ConnectExchangeButton,
64968
- {
64969
- onClick: () => {
64970
- setCoinbaseSkipToHoldings(false);
64971
- setView("coinbase_connect");
64972
- },
64973
- title: i18n2.connectExchange.title,
64974
- subtitle: i18n2.connectExchange.subtitle,
64975
- exchanges: integrationExchanges
64976
- }
64977
- ),
64978
- showCashApp && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64979
- CashAppButton,
64980
- {
64981
- onClick: () => setView("cashapp"),
64982
- title: "Pay with Cash App",
64983
- subtitle: "Deposit via Cash App",
64984
- iconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0
64985
- }
64986
- ),
64987
- showDepositTracker && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64988
- DepositTrackerButton,
64989
- {
64990
- onClick: () => {
64991
- setAllExecutions(depositExecutions);
64992
- setView("tracker");
64993
- },
64994
- title: depositTrackerTitle,
64995
- subtitle: depositTrackerSubTitle,
64996
- badge: depositExecutions.length > 0 ? depositExecutions.length : void 0
64997
- }
64998
- )
64999
- ] }) }),
65265
+ renderMainMenuBody(),
65000
65266
  depositPoweredByFooter
65001
65267
  ] })
65002
65268
  ] }) : view === "transfer" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
@@ -65009,7 +65275,7 @@ function DepositModal({
65009
65275
  onClose: handleClose,
65010
65276
  showBalance: showBalanceHeader,
65011
65277
  balanceAddress: recipientAddress,
65012
- balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" ? destinationChainType : void 0,
65278
+ balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
65013
65279
  balanceChainId: destinationChainId,
65014
65280
  balanceTokenAddress: destinationTokenAddress,
65015
65281
  projectName: projectConfig?.project_name,
@@ -65097,7 +65363,7 @@ function DepositModal({
65097
65363
  badge: cardView === "quotes" ? { count: quotesCount } : void 0,
65098
65364
  showBalance: showBalanceHeader,
65099
65365
  balanceAddress: recipientAddress,
65100
- balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" ? destinationChainType : void 0,
65366
+ balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
65101
65367
  balanceChainId: destinationChainId,
65102
65368
  balanceTokenAddress: destinationTokenAddress,
65103
65369
  projectName: projectConfig?.project_name,
@@ -66393,9 +66659,6 @@ function useVerifyRecipientAddress(params) {
66393
66659
  refetchOnWindowFocus: false
66394
66660
  });
66395
66661
  }
66396
- function isHypercoreChain(chainId) {
66397
- return chainId === HYPERCORE_CHAIN_ID;
66398
- }
66399
66662
  function useGetDepositAddress(params) {
66400
66663
  const {
66401
66664
  userId,
@@ -67322,8 +67585,6 @@ function WithdrawConfirmingView({
67322
67585
  className: "uf-text-sm uf-text-center",
67323
67586
  style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
67324
67587
  children: [
67325
- txInfo.amount,
67326
- " ",
67327
67588
  txInfo.sourceTokenSymbol,
67328
67589
  " to",
67329
67590
  " ",
@@ -67964,6 +68225,7 @@ function UnifoldProvider2({
67964
68225
  hideDepositTracker: config?.hideDepositTracker,
67965
68226
  showBalanceHeader: config?.showBalanceHeader,
67966
68227
  transferInputVariant: config?.transferInputVariant,
68228
+ displayMode: config?.displayMode,
67967
68229
  enableTransferCrypto: config?.enableTransferCrypto,
67968
68230
  enableConnectWallet: config?.enableConnectWallet,
67969
68231
  enablePayWithExchange: config?.enablePayWithExchange,