@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.mjs CHANGED
@@ -43973,6 +43973,29 @@ async function getDepositQuote(request, publishableKey) {
43973
43973
  const json = await response.json();
43974
43974
  return json.data;
43975
43975
  }
43976
+ async function buildHypercoreTransaction(request, publishableKey) {
43977
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
43978
+ validatePublishableKey(pk);
43979
+ const response = await fetch(
43980
+ `${API_BASE_URL}/v1/public/transactions/hypercore/build`,
43981
+ {
43982
+ method: "POST",
43983
+ headers: {
43984
+ accept: "application/json",
43985
+ "x-publishable-key": pk,
43986
+ "Content-Type": "application/json"
43987
+ },
43988
+ body: JSON.stringify(request)
43989
+ }
43990
+ );
43991
+ if (!response.ok) {
43992
+ const error = await response.json().catch(() => ({ message: response.statusText }));
43993
+ throw new Error(
43994
+ `Failed to build HyperCore transaction: ${error.message || response.statusText}`
43995
+ );
43996
+ }
43997
+ return response.json();
43998
+ }
43976
43999
  async function getCashAppLimits(currency = "usd", publishableKey) {
43977
44000
  const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
43978
44001
  validatePublishableKey(pk);
@@ -44038,6 +44061,29 @@ async function getCashAppSessionStatus(externalId, publishableKey) {
44038
44061
  }
44039
44062
  return response.json();
44040
44063
  }
44064
+ async function sendHypercoreTransaction(request, publishableKey) {
44065
+ const pk = publishableKey || DEFAULT_PUBLISHABLE_KEY;
44066
+ validatePublishableKey(pk);
44067
+ const response = await fetch(
44068
+ `${API_BASE_URL}/v1/public/transactions/hypercore/send`,
44069
+ {
44070
+ method: "POST",
44071
+ headers: {
44072
+ accept: "application/json",
44073
+ "x-publishable-key": pk,
44074
+ "Content-Type": "application/json"
44075
+ },
44076
+ body: JSON.stringify(request)
44077
+ }
44078
+ );
44079
+ if (!response.ok) {
44080
+ const error = await response.json().catch(() => ({ message: response.statusText }));
44081
+ throw new Error(
44082
+ `Failed to send HyperCore transaction: ${error.message || response.statusText}`
44083
+ );
44084
+ }
44085
+ return response.json();
44086
+ }
44041
44087
  var DepositEventType = /* @__PURE__ */ ((DepositEventType2) => {
44042
44088
  DepositEventType2["ONRAMP_SESSION_CREATED"] = "onramp_session.created";
44043
44089
  return DepositEventType2;
@@ -50214,6 +50260,22 @@ function clearStoredWalletState() {
50214
50260
  } catch {
50215
50261
  }
50216
50262
  }
50263
+ var LAST_OPENED_WALLET_KEY = "unifold_last_opened_wallet";
50264
+ function getLastOpenedWallet() {
50265
+ if (typeof window === "undefined") return void 0;
50266
+ try {
50267
+ return localStorage.getItem(LAST_OPENED_WALLET_KEY) ?? void 0;
50268
+ } catch {
50269
+ return void 0;
50270
+ }
50271
+ }
50272
+ function setLastOpenedWallet(walletId) {
50273
+ if (typeof window === "undefined") return;
50274
+ try {
50275
+ localStorage.setItem(LAST_OPENED_WALLET_KEY, walletId);
50276
+ } catch {
50277
+ }
50278
+ }
50217
50279
  var MOBILE_VIEWPORT_MEDIA_QUERY = "(max-width: 768px)";
50218
50280
  function isMobileViewport() {
50219
50281
  if (typeof window === "undefined") return false;
@@ -51019,7 +51081,7 @@ function DepositHeader({
51019
51081
  setShowBalanceSkeleton(false);
51020
51082
  return;
51021
51083
  }
51022
- const supportedChainTypes = ["ethereum", "solana", "bitcoin"];
51084
+ const supportedChainTypes = ["ethereum", "solana", "bitcoin", "n1"];
51023
51085
  if (!supportedChainTypes.includes(
51024
51086
  balanceChainType
51025
51087
  )) {
@@ -61037,7 +61099,7 @@ function useHypercoreActivation(params) {
61037
61099
  publishableKey,
61038
61100
  enabled = true
61039
61101
  } = params;
61040
- const isHypercore2 = destinationChainId === HYPERCORE_CHAIN_ID;
61102
+ const isHypercore2 = String(destinationChainId) === HYPERCORE_CHAIN_ID;
61041
61103
  const recipient = recipientAddress?.trim() ?? "";
61042
61104
  const source = sourceAddress?.trim() ?? "";
61043
61105
  const hasAddresses = !!recipient && !!source;
@@ -62183,6 +62245,46 @@ function TransferCryptoDoubleInput({
62183
62245
  }
62184
62246
  ) });
62185
62247
  }
62248
+ function isHypercoreChain(chainId) {
62249
+ return chainId === HYPERCORE_CHAIN_ID;
62250
+ }
62251
+ async function sendHypercoreEvmTransfer(params) {
62252
+ const {
62253
+ provider,
62254
+ fromAddress,
62255
+ recipientAddress,
62256
+ sourceTokenAddress,
62257
+ amount,
62258
+ publishableKey
62259
+ } = params;
62260
+ const currentChainHex = await provider.request({
62261
+ method: "eth_chainId",
62262
+ params: []
62263
+ });
62264
+ const activeChainId = String(parseInt(currentChainHex, 16));
62265
+ const buildResult = await buildHypercoreTransaction(
62266
+ {
62267
+ signature_chain_id: activeChainId,
62268
+ recipient_address: recipientAddress,
62269
+ token_address: sourceTokenAddress,
62270
+ amount
62271
+ },
62272
+ publishableKey
62273
+ );
62274
+ const signature = await provider.request({
62275
+ method: "eth_signTypedData_v4",
62276
+ params: [fromAddress, JSON.stringify(buildResult.typed_data)]
62277
+ });
62278
+ await sendHypercoreTransaction(
62279
+ {
62280
+ action_payload: buildResult.action_payload,
62281
+ signature,
62282
+ nonce: buildResult.nonce
62283
+ },
62284
+ publishableKey
62285
+ );
62286
+ return { signature };
62287
+ }
62186
62288
  function useDepositQuote(params) {
62187
62289
  const {
62188
62290
  publishableKey,
@@ -62590,7 +62692,8 @@ function EnterAmountView({
62590
62692
  onClose,
62591
62693
  quickSelectMode,
62592
62694
  checkoutAmountUsd,
62593
- checkoutReceivedUsd
62695
+ checkoutReceivedUsd,
62696
+ footer
62594
62697
  }) {
62595
62698
  const { colors: colors2, fonts, components } = useTheme();
62596
62699
  const isCheckout = !!checkoutAmountUsd;
@@ -62846,6 +62949,7 @@ function EnterAmountView({
62846
62949
  )
62847
62950
  ] })
62848
62951
  ] }),
62952
+ footer && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "uf-shrink-0 uf-pt-2", children: footer }),
62849
62953
  /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: "uf-shrink-0 uf-pt-2", children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
62850
62954
  "button",
62851
62955
  {
@@ -63295,7 +63399,7 @@ var WALLET_ICONS3 = {
63295
63399
  };
63296
63400
  var FALLBACK_WALLET_DEFINITIONS = [
63297
63401
  { id: "phantom", name: "Phantom", networks: ["ethereum", "solana"], installUrl: "https://phantom.app/", supportsMobileBrowse: true },
63298
- { id: "coinbase", name: "Coinbase Wallet", networks: ["ethereum", "solana"], installUrl: "https://www.coinbase.com/wallet", supportsMobileBrowse: true },
63402
+ { id: "coinbase", name: "Coinbase Wallet", networks: ["ethereum"], installUrl: "https://www.coinbase.com/wallet", supportsMobileBrowse: true },
63299
63403
  { id: "trust", name: "Trust Wallet", networks: ["ethereum", "solana"], installUrl: "https://trustwallet.com/", supportsMobileBrowse: true },
63300
63404
  { id: "metamask", name: "MetaMask", networks: ["ethereum"], installUrl: "https://metamask.io/download/", supportsMobileBrowse: true },
63301
63405
  { id: "rainbow", name: "Rainbow", networks: ["ethereum"], installUrl: "https://rainbow.me/", supportsMobileBrowse: true },
@@ -63355,7 +63459,7 @@ function getLegacyEvmProviders() {
63355
63459
  okxEthereum: win.okxwallet
63356
63460
  };
63357
63461
  }
63358
- function detectAvailableWallets(definitions, filterChainType) {
63462
+ function detectAvailableWallets(definitions, recentWalletId, filterChainType) {
63359
63463
  const solProviders = getSolanaProviders();
63360
63464
  const legacyEvm = getLegacyEvmProviders();
63361
63465
  const eip6963List = getEip6963Providers();
@@ -63381,7 +63485,7 @@ function detectAvailableWallets(definitions, filterChainType) {
63381
63485
  return false;
63382
63486
  }
63383
63487
  });
63384
- return definitions.filter((w) => !filterChainType || w.networks.includes(filterChainType)).map((wallet) => {
63488
+ const sorted = definitions.filter((w) => !filterChainType || w.networks.includes(filterChainType)).map((wallet) => {
63385
63489
  let isInstalled = false;
63386
63490
  const detectedNetworks = [];
63387
63491
  switch (wallet.id) {
@@ -63404,8 +63508,6 @@ function detectAvailableWallets(definitions, filterChainType) {
63404
63508
  isInstalled = true;
63405
63509
  detectedNetworks.push("ethereum");
63406
63510
  }
63407
- if (solProviders.coinbaseSolana || win?.coinbaseWalletExtension?.solana) detectedNetworks.push("solana");
63408
- if (isInstalled && wallet.networks.includes("solana") && !detectedNetworks.includes("solana")) detectedNetworks.push("solana");
63409
63511
  break;
63410
63512
  case "trust":
63411
63513
  if (hasEip6963("trust") || legacyEvm.trustEthereum || legacyEvm.ethereum?.isTrust || win?.trustwallet) {
@@ -63442,11 +63544,17 @@ function detectAvailableWallets(definitions, filterChainType) {
63442
63544
  }
63443
63545
  return { ...wallet, isInstalled, detectedNetworks };
63444
63546
  }).sort((a, b) => {
63547
+ if (recentWalletId) {
63548
+ const aRecent = a.id === recentWalletId ? 1 : 0;
63549
+ const bRecent = b.id === recentWalletId ? 1 : 0;
63550
+ if (aRecent !== bRecent) return bRecent - aRecent;
63551
+ }
63445
63552
  if (a.isInstalled && !b.isInstalled) return -1;
63446
63553
  if (!a.isInstalled && b.isInstalled) return 1;
63447
63554
  if (a.isInstalled && b.isInstalled) return b.networks.length - a.networks.length;
63448
63555
  return 0;
63449
63556
  });
63557
+ return sorted;
63450
63558
  }
63451
63559
  function WalletConnect({
63452
63560
  walletInfo: initialWalletInfo,
@@ -63521,9 +63629,15 @@ function WalletConnect({
63521
63629
  })) : FALLBACK_WALLET_DEFINITIONS,
63522
63630
  [backendWallets]
63523
63631
  );
63632
+ const [recentWalletId, setRecentWalletIdState] = React302.useState(getLastOpenedWallet);
63633
+ React302.useEffect(() => {
63634
+ if (view === "select_wallet") {
63635
+ setRecentWalletIdState(getLastOpenedWallet());
63636
+ }
63637
+ }, [view]);
63524
63638
  const availableWallets = React302.useMemo(
63525
- () => detectAvailableWallets(walletDefinitions),
63526
- [walletDefinitions, eip6963ProviderCount]
63639
+ () => detectAvailableWallets(walletDefinitions, recentWalletId),
63640
+ [walletDefinitions, eip6963ProviderCount, recentWalletId]
63527
63641
  );
63528
63642
  const [isMobile, setIsMobile] = React302.useState(false);
63529
63643
  React302.useEffect(() => {
@@ -63583,7 +63697,7 @@ function WalletConnect({
63583
63697
  const chainType = activeDepositWallet?.chain_type ?? "ethereum";
63584
63698
  const recipientAddress = activeDepositWallet?.address ?? "";
63585
63699
  const isCheckoutMode = !!checkoutAmountUsd;
63586
- const supportedChainType = chainType === "algorand" || chainType === "xrpl" ? "ethereum" : chainType;
63700
+ const supportedChainType = chainType === "algorand" || chainType === "xrpl" || chainType === "cardano" || chainType === "n1" ? "ethereum" : chainType;
63587
63701
  const transitionTo = React302.useCallback((nextView) => {
63588
63702
  if (nextView === viewRef.current) return;
63589
63703
  setIsTransitioning(true);
@@ -63607,6 +63721,8 @@ function WalletConnect({
63607
63721
  );
63608
63722
  if (res.deeplink) {
63609
63723
  setMobileRedirect({ walletId: wallet.id, walletName: wallet.name, deeplink: res.deeplink });
63724
+ setLastOpenedWallet(wallet.id);
63725
+ setRecentWalletIdState(wallet.id);
63610
63726
  setAwaitingMobileDeposit(true);
63611
63727
  transitionTo("mobile_redirect");
63612
63728
  window.location.href = res.deeplink;
@@ -63667,6 +63783,8 @@ function WalletConnect({
63667
63783
  const handleConnectWallet = async (wallet, network) => {
63668
63784
  setConnectingNetwork(network);
63669
63785
  transitionTo("connecting");
63786
+ setLastOpenedWallet(wallet.id);
63787
+ setRecentWalletIdState(wallet.id);
63670
63788
  setWalletError(null);
63671
63789
  setIsWalletConnecting(true);
63672
63790
  try {
@@ -63771,6 +63889,13 @@ function WalletConnect({
63771
63889
  }
63772
63890
  };
63773
63891
  const selectedToken = selectedBalance ? getTokenFromBalance(selectedBalance) : null;
63892
+ const { needsActivation: hypercoreNeedsActivation, activationFee: hypercoreActivationFee, sponsored: hypercoreActivationSponsored } = useHypercoreActivation({
63893
+ recipientAddress,
63894
+ sourceAddress: activeWalletInfo?.address,
63895
+ destinationChainId: selectedToken?.chain_id,
63896
+ publishableKey,
63897
+ enabled: !!activeWalletInfo && !!recipientAddress
63898
+ });
63774
63899
  const effectiveDestinationAmount = React302.useMemo(() => {
63775
63900
  if (!checkoutRemainingBaseUnits || checkoutRemainingBaseUnits === "0") return "0";
63776
63901
  if (!checkoutAmountUsd) return checkoutRemainingBaseUnits;
@@ -63875,7 +64000,7 @@ function WalletConnect({
63875
64000
  let cancelled = false;
63876
64001
  setIsLoading(true);
63877
64002
  setError(null);
63878
- const sct = activeDepositWallet.chain_type === "algorand" || activeDepositWallet.chain_type === "xrpl" ? "ethereum" : activeDepositWallet.chain_type;
64003
+ const sct = activeDepositWallet.chain_type === "algorand" || activeDepositWallet.chain_type === "xrpl" || activeDepositWallet.chain_type === "cardano" || activeDepositWallet.chain_type === "n1" ? "ethereum" : activeDepositWallet.chain_type;
63879
64004
  getAddressBalances(activeWalletInfo.address, sct, publishableKey).then((response) => {
63880
64005
  if (cancelled) return;
63881
64006
  const nonZero = response.balances.filter((b) => b.amount !== "0");
@@ -64041,9 +64166,16 @@ function WalletConnect({
64041
64166
  const [integerPart = "0", decimalPart = ""] = amountStr.trim().split(".");
64042
64167
  return (integerPart + decimalPart.padEnd(decimals, "0").slice(0, decimals)).replace(/^0+/, "") || "0";
64043
64168
  };
64044
- const sendEthereumTransaction = async (token, amountStr) => {
64045
- if (!recipientAddress || !/^0x[a-fA-F0-9]{40}$/.test(recipientAddress)) throw new Error(`Invalid recipient address.`);
64046
- const walletIdMap = { "phantom-ethereum": "phantom", coinbase: "coinbase", trust: "trust", okx: "okx", rainbow: "rainbow", rabby: "rabby", metamask: "metamask" };
64169
+ const resolveEvmProvider = () => {
64170
+ const walletIdMap = {
64171
+ "phantom-ethereum": "phantom",
64172
+ coinbase: "coinbase",
64173
+ trust: "trust",
64174
+ okx: "okx",
64175
+ rainbow: "rainbow",
64176
+ rabby: "rabby",
64177
+ metamask: "metamask"
64178
+ };
64047
64179
  const lookupId = walletIdMap[walletInfo.type] || walletInfo.type;
64048
64180
  const eip6963Match = findProviderByWalletId(lookupId);
64049
64181
  let provider = eip6963Match?.provider;
@@ -64052,6 +64184,11 @@ function WalletConnect({
64052
64184
  else if (walletInfo.type === "coinbase") provider = window.coinbaseWalletExtension || window.ethereum;
64053
64185
  else provider = window.ethereum;
64054
64186
  }
64187
+ return provider;
64188
+ };
64189
+ const sendEthereumTransaction = async (token, amountStr) => {
64190
+ if (!recipientAddress || !/^0x[a-fA-F0-9]{40}$/.test(recipientAddress)) throw new Error(`Invalid recipient address.`);
64191
+ const provider = resolveEvmProvider();
64055
64192
  if (!provider) throw new Error("Ethereum wallet not found");
64056
64193
  const currentChainIdHex = await provider.request({ method: "eth_chainId", params: [] });
64057
64194
  if (parseInt(currentChainIdHex, 16).toString() !== token.chain_id) {
@@ -64116,6 +64253,19 @@ function WalletConnect({
64116
64253
  const resp = await sendSolanaTransaction({ chain_id: "mainnet", signed_transaction: btoa(bs) }, publishableKey);
64117
64254
  return resp.signature;
64118
64255
  };
64256
+ const sendHypercoreDeposit = async (token, amountStr) => {
64257
+ const provider = resolveEvmProvider();
64258
+ if (!provider) throw new Error("Ethereum wallet not found");
64259
+ const { signature } = await sendHypercoreEvmTransfer({
64260
+ provider,
64261
+ fromAddress: walletInfo.address,
64262
+ recipientAddress,
64263
+ sourceTokenAddress: token.token_address,
64264
+ amount: amountStr,
64265
+ publishableKey
64266
+ });
64267
+ return signature;
64268
+ };
64119
64269
  const handleConfirm = async () => {
64120
64270
  if (!hasWallet || !selectedBalance || !amountUsd || tokenAmount === 0 || !recipientAddress) return;
64121
64271
  const token = getTokenFromBalance(selectedBalance);
@@ -64135,7 +64285,33 @@ function WalletConnect({
64135
64285
  setIsConfirming(true);
64136
64286
  setError(null);
64137
64287
  try {
64138
- const txHash = token.chain_type === "solana" ? await sendSolanaTransaction2(token, tokenAmount.toString()) : await sendEthereumTransaction(token, tokenAmount.toString());
64288
+ const isHypercoreToken = String(token.chain_id) === HYPERCORE_CHAIN_ID;
64289
+ let txHash;
64290
+ if (token.chain_type === "solana") {
64291
+ txHash = await sendSolanaTransaction2(token, tokenAmount.toString());
64292
+ } else if (isHypercoreToken) {
64293
+ let sendAmount = tokenAmount;
64294
+ try {
64295
+ const activation = await checkHypercoreActivation(
64296
+ { source_address: walletInfo.address, recipient_address: recipientAddress },
64297
+ publishableKey
64298
+ );
64299
+ if (!activation.user_exists) {
64300
+ const fee = activation.activation_fee;
64301
+ if (!Number.isFinite(tokenAmount) || tokenAmount <= fee) {
64302
+ throw new Error(
64303
+ `Insufficient amount. A ${fee} USDC activation fee is required for the first transfer to this address.`
64304
+ );
64305
+ }
64306
+ sendAmount = tokenAmount - fee;
64307
+ }
64308
+ } catch (e) {
64309
+ if (e instanceof Error && e.message.includes("activation fee")) throw e;
64310
+ }
64311
+ txHash = await sendHypercoreDeposit(token, sendAmount.toString());
64312
+ } else {
64313
+ txHash = await sendEthereumTransaction(token, tokenAmount.toString());
64314
+ }
64139
64315
  setReceivedUsdAtSubmission(checkoutReceivedUsd ?? "0");
64140
64316
  setHasSignedTransaction(true);
64141
64317
  handleIveDeposited();
@@ -64353,7 +64529,7 @@ function WalletConnect({
64353
64529
  }
64354
64530
  if (view === "enter_amount" && selectedToken && selectedBalance) {
64355
64531
  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 ?? (() => {
64356
- }), quickSelectMode: amountQuickSelect, checkoutAmountUsd, checkoutReceivedUsd }) }) });
64532
+ }), quickSelectMode: amountQuickSelect, checkoutAmountUsd, checkoutReceivedUsd, footer: hypercoreNeedsActivation && !hypercoreActivationSponsored ? /* @__PURE__ */ (0, import_jsx_runtime73.jsx)(HypercoreActivationWarning, { activationFee: hypercoreActivationFee }) : void 0 }) }) });
64357
64533
  }
64358
64534
  if (view === "review" && selectedToken) {
64359
64535
  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 ?? (() => {
@@ -64389,6 +64565,9 @@ function SkeletonButton({
64389
64565
  ] });
64390
64566
  }
64391
64567
  var t7 = i18n2.depositModal;
64568
+ function depositTabForScreen(screen) {
64569
+ return screen === "card" || screen === "cashapp" ? "cash" : "crypto";
64570
+ }
64392
64571
  function DepositModal({
64393
64572
  open,
64394
64573
  onOpenChange,
@@ -64424,6 +64603,7 @@ function DepositModal({
64424
64603
  theme = "dark",
64425
64604
  hideOverlay = false,
64426
64605
  initialScreen = "main",
64606
+ displayMode = "stacked",
64427
64607
  transferCryptoTitle = t7.transferCrypto.title,
64428
64608
  depositWithCardTitle = t7.depositWithCard.title,
64429
64609
  payWithExchangeTitle = t7.payWithExchange.title,
@@ -64458,6 +64638,9 @@ function DepositModal({
64458
64638
  effectiveInitialScreen
64459
64639
  );
64460
64640
  const [coinbaseSkipToHoldings, setCoinbaseSkipToHoldings] = (0, import_react3.useState)(false);
64641
+ const [depositTab, setDepositTab] = (0, import_react3.useState)(
64642
+ () => depositTabForScreen(effectiveInitialScreen)
64643
+ );
64461
64644
  const resetViewTimeoutRef = (0, import_react3.useRef)(null);
64462
64645
  const [cardView, setCardView] = (0, import_react3.useState)(
64463
64646
  "amount"
@@ -64755,6 +64938,7 @@ function DepositModal({
64755
64938
  resetViewTimeoutRef.current = null;
64756
64939
  }
64757
64940
  setView(effectiveInitialScreen);
64941
+ setDepositTab(depositTabForScreen(effectiveInitialScreen));
64758
64942
  setCardView("amount");
64759
64943
  setExchangeView("providers");
64760
64944
  setBrowserWalletInfo(null);
@@ -64783,6 +64967,7 @@ function DepositModal({
64783
64967
  } else if (view === "cashapp" && cashAppView !== "amount") {
64784
64968
  setCashAppView("amount");
64785
64969
  } else {
64970
+ setDepositTab(depositTabForScreen(view));
64786
64971
  setView("main");
64787
64972
  setCardView("amount");
64788
64973
  setExchangeView("providers");
@@ -64862,6 +65047,174 @@ function DepositModal({
64862
65047
  className: "uf-flex uf-justify-center uf-shrink-0"
64863
65048
  }
64864
65049
  ) });
65050
+ const transferCryptoMenuButton = showTransferCrypto ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65051
+ TransferCryptoButton,
65052
+ {
65053
+ onClick: () => setView("transfer"),
65054
+ title: transferCryptoTitle,
65055
+ subtitle: t7.transferCrypto.subtitle,
65056
+ featuredTokens: projectConfig?.transfer_crypto.networks
65057
+ },
65058
+ "transfer"
65059
+ ) : null;
65060
+ const connectWalletMenuButton = showConnectWallet ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65061
+ BrowserWalletButton,
65062
+ {
65063
+ onClick: handleBrowserWalletClick,
65064
+ onConnectClick: handleWalletConnectClick,
65065
+ onDisconnect: handleWalletDisconnect,
65066
+ chainType: browserWalletChainType,
65067
+ publishableKey,
65068
+ featuredWallets: projectConfig?.connect_wallet?.wallets
65069
+ },
65070
+ "wallet"
65071
+ ) : null;
65072
+ const depositWithCardMenuButton = showFiatOnramp ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65073
+ DepositWithCardButton,
65074
+ {
65075
+ onClick: () => setView("card"),
65076
+ title: depositWithCardTitle,
65077
+ subtitle: t7.depositWithCard.subtitle,
65078
+ paymentNetworks: projectConfig?.payment_networks.networks
65079
+ },
65080
+ "card"
65081
+ ) : null;
65082
+ const payWithExchangeMenuButton = showPayWithExchange ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65083
+ PayWithExchangeButton,
65084
+ {
65085
+ onClick: () => setView("exchange"),
65086
+ title: payWithExchangeTitle,
65087
+ subtitle: t7.payWithExchange.subtitle,
65088
+ exchanges,
65089
+ loading: exchangesLoading
65090
+ },
65091
+ "exchange"
65092
+ ) : null;
65093
+ const connectExchangeMenuButton = showConnectExchange && connectedExchange ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65094
+ ConnectExchangeButton,
65095
+ {
65096
+ onClick: () => {
65097
+ setCoinbaseSkipToHoldings(true);
65098
+ setView("coinbase_connect");
65099
+ },
65100
+ onDisconnect: handleExchangeDisconnect,
65101
+ title: i18n2.connectExchange.title,
65102
+ subtitle: i18n2.connectExchange.subtitle,
65103
+ exchanges: integrationExchanges,
65104
+ connectedExchange
65105
+ },
65106
+ "connect-exchange"
65107
+ ) : showConnectExchange && !connectedExchange ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65108
+ ConnectExchangeButton,
65109
+ {
65110
+ onClick: () => {
65111
+ setCoinbaseSkipToHoldings(false);
65112
+ setView("coinbase_connect");
65113
+ },
65114
+ title: i18n2.connectExchange.title,
65115
+ subtitle: i18n2.connectExchange.subtitle,
65116
+ exchanges: integrationExchanges
65117
+ },
65118
+ "connect-exchange"
65119
+ ) : null;
65120
+ const cashAppMenuButton = showCashApp ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65121
+ CashAppButton,
65122
+ {
65123
+ onClick: () => setView("cashapp"),
65124
+ title: "Pay with Cash App",
65125
+ subtitle: "Deposit via Cash App",
65126
+ iconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0
65127
+ },
65128
+ "cashapp"
65129
+ ) : null;
65130
+ const depositTrackerMenuButton = showDepositTracker ? /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65131
+ DepositTrackerButton,
65132
+ {
65133
+ onClick: () => {
65134
+ setAllExecutions(depositExecutions);
65135
+ setView("tracker");
65136
+ },
65137
+ title: depositTrackerTitle,
65138
+ subtitle: depositTrackerSubTitle,
65139
+ badge: depositExecutions.length > 0 ? depositExecutions.length : void 0
65140
+ },
65141
+ "tracker"
65142
+ ) : null;
65143
+ const cryptoMenuButtons = [
65144
+ transferCryptoMenuButton,
65145
+ connectWalletMenuButton,
65146
+ payWithExchangeMenuButton,
65147
+ connectExchangeMenuButton
65148
+ ].filter(Boolean);
65149
+ const cashMenuButtons = [
65150
+ depositWithCardMenuButton,
65151
+ cashAppMenuButton
65152
+ ].filter(Boolean);
65153
+ const depositTabs = [
65154
+ { id: "crypto", label: "Use Crypto", buttons: cryptoMenuButtons },
65155
+ { id: "cash", label: "Use Cash", buttons: cashMenuButtons }
65156
+ ].filter((tab) => tab.buttons.length > 0);
65157
+ const activeDepositTab = depositTabs.find((tab) => tab.id === depositTab) ?? depositTabs[0];
65158
+ const renderMainMenuBody = () => {
65159
+ if (depositPrerequisiteBody) {
65160
+ return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-space-y-3", children: depositPrerequisiteBody });
65161
+ }
65162
+ if (displayMode === "tabs" && activeDepositTab) {
65163
+ return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { children: [
65164
+ depositTabs.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65165
+ "div",
65166
+ {
65167
+ className: "uf-flex uf-gap-1 uf-p-1 uf-rounded-xl uf-mb-3",
65168
+ style: {
65169
+ // Frosted-glass track: a translucent fill plus a backdrop blur so
65170
+ // the control reads as a soft surface rather than a solid bar.
65171
+ backgroundColor: `color-mix(in srgb, ${colors2.card} 55%, transparent)`,
65172
+ backdropFilter: "blur(12px)",
65173
+ WebkitBackdropFilter: "blur(12px)"
65174
+ },
65175
+ role: "tablist",
65176
+ children: depositTabs.map((tab) => {
65177
+ const active = activeDepositTab.id === tab.id;
65178
+ return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
65179
+ "button",
65180
+ {
65181
+ type: "button",
65182
+ role: "tab",
65183
+ "aria-selected": active,
65184
+ onClick: () => setDepositTab(tab.id),
65185
+ className: "uf-flex-1 uf-py-2 uf-px-3 uf-rounded-lg uf-text-sm uf-transition-all",
65186
+ style: {
65187
+ // Active tab is a soft, blurred glass pill — a faint accent
65188
+ // tint with its own backdrop blur and a subtle border/shadow,
65189
+ // so it looks frosted instead of like a hard solid button.
65190
+ backgroundColor: active ? `color-mix(in srgb, ${colors2.primary} 22%, transparent)` : "transparent",
65191
+ backdropFilter: active ? "blur(8px)" : void 0,
65192
+ WebkitBackdropFilter: active ? "blur(8px)" : void 0,
65193
+ boxShadow: active ? `0 1px 8px color-mix(in srgb, ${colors2.primary} 25%, transparent)` : void 0,
65194
+ color: active ? colors2.foreground : colors2.foregroundMuted,
65195
+ fontFamily: fonts.medium
65196
+ },
65197
+ children: tab.label
65198
+ },
65199
+ tab.id
65200
+ );
65201
+ })
65202
+ }
65203
+ ),
65204
+ /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-space-y-3", children: activeDepositTab.buttons }),
65205
+ depositTrackerMenuButton && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "uf-mt-3", children: depositTrackerMenuButton })
65206
+ ] });
65207
+ }
65208
+ return /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-space-y-3", children: [
65209
+ transferCryptoMenuButton,
65210
+ connectWalletMenuButton,
65211
+ depositWithCardMenuButton,
65212
+ payWithExchangeMenuButton,
65213
+ connectExchangeMenuButton,
65214
+ cashAppMenuButton,
65215
+ depositTrackerMenuButton
65216
+ ] });
65217
+ };
64865
65218
  return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(PortalContainerProvider, { value: hideOverlay ? containerEl : null, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64866
65219
  Dialog2,
64867
65220
  {
@@ -64888,7 +65241,7 @@ function DepositModal({
64888
65241
  onClose: handleClose,
64889
65242
  showBalance: showBalanceHeader,
64890
65243
  balanceAddress: recipientAddress,
64891
- balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" ? destinationChainType : void 0,
65244
+ balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
64892
65245
  balanceChainId: destinationChainId,
64893
65246
  balanceTokenAddress: destinationTokenAddress,
64894
65247
  projectName: projectConfig?.project_name,
@@ -64896,94 +65249,7 @@ function DepositModal({
64896
65249
  }
64897
65250
  ),
64898
65251
  /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: "uf-flex uf-flex-col uf-gap-1.5", children: [
64899
- /* @__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: [
64900
- showTransferCrypto && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64901
- TransferCryptoButton,
64902
- {
64903
- onClick: () => setView("transfer"),
64904
- title: transferCryptoTitle,
64905
- subtitle: t7.transferCrypto.subtitle,
64906
- featuredTokens: projectConfig?.transfer_crypto.networks
64907
- }
64908
- ),
64909
- showConnectWallet && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64910
- BrowserWalletButton,
64911
- {
64912
- onClick: handleBrowserWalletClick,
64913
- onConnectClick: handleWalletConnectClick,
64914
- onDisconnect: handleWalletDisconnect,
64915
- chainType: browserWalletChainType,
64916
- publishableKey,
64917
- featuredWallets: projectConfig?.connect_wallet?.wallets
64918
- }
64919
- ),
64920
- showFiatOnramp && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64921
- DepositWithCardButton,
64922
- {
64923
- onClick: () => setView("card"),
64924
- title: depositWithCardTitle,
64925
- subtitle: t7.depositWithCard.subtitle,
64926
- paymentNetworks: projectConfig?.payment_networks.networks
64927
- }
64928
- ),
64929
- showPayWithExchange && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64930
- PayWithExchangeButton,
64931
- {
64932
- onClick: () => setView("exchange"),
64933
- title: payWithExchangeTitle,
64934
- subtitle: t7.payWithExchange.subtitle,
64935
- exchanges,
64936
- loading: exchangesLoading
64937
- }
64938
- ),
64939
- showConnectExchange && connectedExchange && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64940
- ConnectExchangeButton,
64941
- {
64942
- onClick: () => {
64943
- setCoinbaseSkipToHoldings(true);
64944
- setView("coinbase_connect");
64945
- },
64946
- onDisconnect: handleExchangeDisconnect,
64947
- title: i18n2.connectExchange.title,
64948
- subtitle: i18n2.connectExchange.subtitle,
64949
- exchanges: integrationExchanges,
64950
- connectedExchange
64951
- }
64952
- ),
64953
- showConnectExchange && !connectedExchange && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64954
- ConnectExchangeButton,
64955
- {
64956
- onClick: () => {
64957
- setCoinbaseSkipToHoldings(false);
64958
- setView("coinbase_connect");
64959
- },
64960
- title: i18n2.connectExchange.title,
64961
- subtitle: i18n2.connectExchange.subtitle,
64962
- exchanges: integrationExchanges
64963
- }
64964
- ),
64965
- showCashApp && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64966
- CashAppButton,
64967
- {
64968
- onClick: () => setView("cashapp"),
64969
- title: "Pay with Cash App",
64970
- subtitle: "Deposit via Cash App",
64971
- iconUrl: projectConfig?.asset_cdn_url ? `${projectConfig.asset_cdn_url}/api/public/icons/onramps/svg/cashapp.svg` : void 0
64972
- }
64973
- ),
64974
- showDepositTracker && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
64975
- DepositTrackerButton,
64976
- {
64977
- onClick: () => {
64978
- setAllExecutions(depositExecutions);
64979
- setView("tracker");
64980
- },
64981
- title: depositTrackerTitle,
64982
- subtitle: depositTrackerSubTitle,
64983
- badge: depositExecutions.length > 0 ? depositExecutions.length : void 0
64984
- }
64985
- )
64986
- ] }) }),
65252
+ renderMainMenuBody(),
64987
65253
  depositPoweredByFooter
64988
65254
  ] })
64989
65255
  ] }) : view === "transfer" ? /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)(import_jsx_runtime74.Fragment, { children: [
@@ -64996,7 +65262,7 @@ function DepositModal({
64996
65262
  onClose: handleClose,
64997
65263
  showBalance: showBalanceHeader,
64998
65264
  balanceAddress: recipientAddress,
64999
- balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" ? destinationChainType : void 0,
65265
+ balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
65000
65266
  balanceChainId: destinationChainId,
65001
65267
  balanceTokenAddress: destinationTokenAddress,
65002
65268
  projectName: projectConfig?.project_name,
@@ -65084,7 +65350,7 @@ function DepositModal({
65084
65350
  badge: cardView === "quotes" ? { count: quotesCount } : void 0,
65085
65351
  showBalance: showBalanceHeader,
65086
65352
  balanceAddress: recipientAddress,
65087
- balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" ? destinationChainType : void 0,
65353
+ balanceChainType: destinationChainType === "ethereum" || destinationChainType === "solana" || destinationChainType === "bitcoin" || destinationChainType === "n1" ? destinationChainType : void 0,
65088
65354
  balanceChainId: destinationChainId,
65089
65355
  balanceTokenAddress: destinationTokenAddress,
65090
65356
  projectName: projectConfig?.project_name,
@@ -66380,9 +66646,6 @@ function useVerifyRecipientAddress(params) {
66380
66646
  refetchOnWindowFocus: false
66381
66647
  });
66382
66648
  }
66383
- function isHypercoreChain(chainId) {
66384
- return chainId === HYPERCORE_CHAIN_ID;
66385
- }
66386
66649
  function useGetDepositAddress(params) {
66387
66650
  const {
66388
66651
  userId,
@@ -67309,8 +67572,6 @@ function WithdrawConfirmingView({
67309
67572
  className: "uf-text-sm uf-text-center",
67310
67573
  style: { color: colors2.foregroundMuted, fontFamily: fonts.regular },
67311
67574
  children: [
67312
- txInfo.amount,
67313
- " ",
67314
67575
  txInfo.sourceTokenSymbol,
67315
67576
  " to",
67316
67577
  " ",
@@ -67951,6 +68212,7 @@ function UnifoldProvider2({
67951
68212
  hideDepositTracker: config?.hideDepositTracker,
67952
68213
  showBalanceHeader: config?.showBalanceHeader,
67953
68214
  transferInputVariant: config?.transferInputVariant,
68215
+ displayMode: config?.displayMode,
67954
68216
  enableTransferCrypto: config?.enableTransferCrypto,
67955
68217
  enableConnectWallet: config?.enableConnectWallet,
67956
68218
  enablePayWithExchange: config?.enablePayWithExchange,