@funkit/connect 11.4.0 → 11.4.1

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 (100) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/clients/{chunk-XJTRLB7W.js → chunk-BB5FHA47.js} +5 -4
  3. package/dist/clients/chunk-MSLPLXR2.js +30 -0
  4. package/dist/clients/{chunk-EQFVPSR2.js → chunk-TYG42JRZ.js} +3 -3
  5. package/dist/clients/{chunk-3Y5EIONT.js → chunk-UMU5S2WF.js} +30 -39
  6. package/dist/clients/internal/nado/withdrawalCallback.js +2 -9
  7. package/dist/clients/internal/nado/withdrawalConfig.d.ts +1 -1
  8. package/dist/clients/internal/nado/withdrawalConfig.js +1 -2
  9. package/dist/clients/internal/nado/withdrawalErrors.d.ts +6 -10
  10. package/dist/clients/internal/nado/withdrawalErrors.js +1 -2
  11. package/dist/clients/internal/nado/withdrawalForm.css +44 -36
  12. package/dist/clients/internal/nado/withdrawalForm.d.ts +1 -1
  13. package/dist/clients/internal/nado/withdrawalForm.js +11 -19
  14. package/dist/clients/internal/nado/withdrawalStatus.js +4 -8
  15. package/dist/clients/lighter.css +44 -36
  16. package/dist/clients/lighter.js +5 -9
  17. package/dist/clients/nado.d.ts +1 -1
  18. package/dist/clients/nado.js +4 -12
  19. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.css +47 -39
  20. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +1 -1
  21. package/dist/clients/polymarket/index.css +47 -39
  22. package/dist/clients/polymarket/index.js +1 -1
  23. package/dist/components/Dropdown/BaseDropdown.css.d.ts +1 -0
  24. package/dist/components/Dropdown/BaseDropdown.d.ts +0 -1
  25. package/dist/hooks/track/analytics/events.d.ts +14 -3
  26. package/dist/hooks/track/analytics/resolveExecutionProgressContext.d.ts +1 -0
  27. package/dist/hooks/track/analytics/useDepositAnalytics.d.ts +11 -3
  28. package/dist/hooks/track/analytics/useTrackExecutionProgressEvents.d.ts +1 -0
  29. package/dist/hooks/useBluvo.d.ts +7 -2
  30. package/dist/index.css +44 -36
  31. package/dist/index.js +715 -838
  32. package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +5 -11
  33. package/dist/providers/FunkitCheckoutContext/types.d.ts +1 -1
  34. package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
  35. package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
  36. package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
  37. package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
  38. package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
  39. package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
  40. package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
  41. package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
  42. package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
  43. package/dist/wallets/walletConnectors/index.js +38 -38
  44. package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
  45. package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
  46. package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
  47. package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
  48. package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
  49. package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
  50. package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
  51. package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
  52. package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
  53. package/package.json +6 -6
  54. package/dist/clients/chunk-2576N7PQ.js +0 -44
  55. package/dist/clients/chunk-3P2C436B.js +0 -20
  56. package/dist/clients/chunk-63XTVHO3.js +0 -19
  57. package/dist/clients/chunk-6T6URLBM.js +0 -33
  58. package/dist/clients/chunk-FM7SFGAV.js +0 -106
  59. package/dist/clients/chunk-JFDRLSYM.js +0 -42
  60. package/dist/clients/chunk-TZGKB6WY.js +0 -160
  61. package/dist/clients/chunk-VIAEAD75.js +0 -61
  62. package/dist/clients/chunk-WZRW6WUM.js +0 -112
  63. package/dist/clients/chunk-Z7HTQFEO.js +0 -69
  64. package/dist/clients/internal/nado/consts.d.ts +0 -22
  65. package/dist/clients/internal/nado/consts.js +0 -15
  66. package/dist/clients/internal/nado/encoding.d.ts +0 -25
  67. package/dist/clients/internal/nado/encoding.js +0 -11
  68. package/dist/clients/internal/nado/errors.d.ts +0 -68
  69. package/dist/clients/internal/nado/errors.js +0 -19
  70. package/dist/clients/internal/nado/fetch.d.ts +0 -15
  71. package/dist/clients/internal/nado/fetch.js +0 -9
  72. package/dist/clients/internal/nado/gateway.d.ts +0 -61
  73. package/dist/clients/internal/nado/gateway.js +0 -17
  74. package/dist/clients/internal/nado/hooks.d.ts +0 -208
  75. package/dist/clients/internal/nado/hooks.js +0 -21
  76. package/dist/clients/internal/nado/indexer.d.ts +0 -43
  77. package/dist/clients/internal/nado/indexer.js +0 -13
  78. package/dist/clients/internal/nado/typedData.d.ts +0 -80
  79. package/dist/clients/internal/nado/typedData.js +0 -10
  80. package/dist/clients/internal/nado/withdrawalTypes.d.ts +0 -49
  81. package/dist/clients/internal/nado/withdrawalTypes.js +0 -1
  82. package/dist/utils/safeBigInt.d.ts +0 -5
  83. package/dist/wallets/walletConnectors/{chunk-RB3HR4R2.js → chunk-4NV5BYRP.js} +3 -3
  84. package/dist/wallets/walletConnectors/{chunk-YEZM4CK4.js → chunk-AVDUNQUW.js} +3 -3
  85. package/dist/wallets/walletConnectors/{chunk-MIQTHJ6X.js → chunk-GUQM4QSL.js} +3 -3
  86. package/dist/wallets/walletConnectors/{chunk-4T6ZSRJF.js → chunk-IULPZP2Q.js} +3 -3
  87. package/dist/wallets/walletConnectors/{chunk-HNRB7KJU.js → chunk-JPN6TWIT.js} +3 -3
  88. package/dist/wallets/walletConnectors/{chunk-ZNX4EMPB.js → chunk-KCRO2AGO.js} +3 -3
  89. package/dist/wallets/walletConnectors/{chunk-STVVP43G.js → chunk-KI5Y2BBF.js} +3 -3
  90. package/dist/wallets/walletConnectors/{chunk-X6CGV36L.js → chunk-NR2OGDHQ.js} +3 -3
  91. package/dist/wallets/walletConnectors/{chunk-UK7C2JXW.js → chunk-OEEGYENV.js} +3 -3
  92. package/dist/wallets/walletConnectors/{chunk-F5XEEVG6.js → chunk-OX37G4YT.js} +3 -3
  93. package/dist/wallets/walletConnectors/{chunk-RVOY537T.js → chunk-SWFF3TWJ.js} +3 -3
  94. package/dist/wallets/walletConnectors/{chunk-CPI4TD43.js → chunk-TKB2OY6G.js} +3 -3
  95. package/dist/wallets/walletConnectors/{chunk-2VP2F6EK.js → chunk-W2LCLDPX.js} +3 -3
  96. package/dist/wallets/walletConnectors/{chunk-6BW3HLBG.js → chunk-WAHGI5L7.js} +3 -3
  97. package/dist/wallets/walletConnectors/{chunk-HTHAK6XB.js → chunk-WKNQMP4A.js} +3 -3
  98. package/dist/wallets/walletConnectors/{chunk-VTM6EECM.js → chunk-XCNHV3HS.js} +3 -3
  99. package/dist/wallets/walletConnectors/{chunk-CCQV2ZET.js → chunk-YO2K4MBH.js} +3 -3
  100. package/dist/wallets/walletConnectors/{chunk-VAPGUPHO.js → chunk-YQFGVZGR.js} +3 -3
package/dist/index.js CHANGED
@@ -449,7 +449,7 @@ function Avatar({ address, imageUrl, loading, size }) {
449
449
  }
450
450
 
451
451
  // src/components/ConnectButton/ConnectButton.tsx
452
- import React308, { useEffect as useEffect92, useState as useState93 } from "react";
452
+ import React308, { useEffect as useEffect91, useState as useState93 } from "react";
453
453
 
454
454
  // src/css/touchableStyles.css.ts
455
455
  var active = { shrink: "_7rkubb8", shrinkSm: "_7rkubb9" };
@@ -5744,7 +5744,7 @@ var getRemoteImageStyles = (isRemoteImage, isRemoteImageLoaded, src) => {
5744
5744
  // src/components/ConnectButton/ConnectButtonRenderer.tsx
5745
5745
  import { formatCurrencyAndStringify as formatCurrencyAndStringify15, isMobile as isMobile16, noop as noop7 } from "@funkit/utils";
5746
5746
  import React307 from "react";
5747
- import { formatUnits as formatUnits8 } from "viem";
5747
+ import { formatUnits as formatUnits7 } from "viem";
5748
5748
 
5749
5749
  // src/hooks/useIsMounted.ts
5750
5750
  import { useCallback as useCallback2, useEffect as useEffect4, useState as useState5 } from "react";
@@ -5805,7 +5805,7 @@ function useMainnetEnsName(address) {
5805
5805
  import {
5806
5806
  getAllWalletTokens
5807
5807
  } from "@funkit/api-base";
5808
- import { keepPreviousData as keepPreviousData4, useQuery as useQuery26 } from "@tanstack/react-query";
5808
+ import { keepPreviousData as keepPreviousData4, useQuery as useQuery25 } from "@tanstack/react-query";
5809
5809
  import { arbitrum as arbitrum6, polygon as polygon8 } from "viem/chains";
5810
5810
 
5811
5811
  // src/domains/asset.ts
@@ -5839,7 +5839,7 @@ import {
5839
5839
  round as round4
5840
5840
  } from "@funkit/utils";
5841
5841
  import * as dnum11 from "dnum";
5842
- import { erc20Abi as erc20Abi8, formatUnits as formatUnits7, isAddress as isAddress2 } from "viem";
5842
+ import { erc20Abi as erc20Abi8, formatUnits as formatUnits6, isAddress as isAddress2 } from "viem";
5843
5843
 
5844
5844
  // src/wagmi/actions.ts
5845
5845
  import { erc20Abi, formatUnits } from "viem";
@@ -5908,9 +5908,9 @@ import {
5908
5908
  import { isEVMAddressEquivalent as isEVMAddressEquivalent5, isNotNullish as isNotNullish7 } from "@funkit/utils";
5909
5909
  import React306, {
5910
5910
  createContext as createContext21,
5911
- useCallback as useCallback66,
5911
+ useCallback as useCallback65,
5912
5912
  useContext as useContext21,
5913
- useEffect as useEffect91,
5913
+ useEffect as useEffect90,
5914
5914
  useRef as useRef46,
5915
5915
  useState as useState92
5916
5916
  } from "react";
@@ -6780,7 +6780,7 @@ function setFunkitConnectVersion({ version }) {
6780
6780
  localStorage.setItem(storageKey, version);
6781
6781
  }
6782
6782
  function getCurrentSdkVersion() {
6783
- return "11.4.0";
6783
+ return "11.4.1";
6784
6784
  }
6785
6785
  function useFingerprint() {
6786
6786
  const fingerprint = useCallback3(() => {
@@ -7709,7 +7709,8 @@ var useTokenTransfer = (selectedChainId, selectedToken, chainIds) => {
7709
7709
  });
7710
7710
  const qrCodeUri = funDepositAddress ? getTransferTokenQrCodeUri({
7711
7711
  depositAddress: funDepositAddress,
7712
- type: blockchainType
7712
+ type: blockchainType,
7713
+ chainId: selectedChainId
7713
7714
  }) : void 0;
7714
7715
  return {
7715
7716
  depositAddress: showOriginalRecipient ? recipientAddr : funDepositAddress,
@@ -7777,8 +7778,12 @@ var USDC_USDT_FAMILY_TICKERS = /* @__PURE__ */ new Set([
7777
7778
  ...USDT_FAMILY_TICKERS
7778
7779
  ]);
7779
7780
  var isSameUsdcOrUsdtFamily = (sourceToken, targetTicker) => {
7780
- if (!sourceToken) return false;
7781
- if (sourceToken === targetTicker) return true;
7781
+ if (!sourceToken) {
7782
+ return false;
7783
+ }
7784
+ if (sourceToken === targetTicker) {
7785
+ return true;
7786
+ }
7782
7787
  if (USDC_FAMILY_TICKERS.has(sourceToken) && USDC_FAMILY_TICKERS.has(targetTicker)) {
7783
7788
  return true;
7784
7789
  }
@@ -11230,9 +11235,9 @@ var useFunkitPostCheckoutInternal = (checkoutId) => {
11230
11235
  // src/providers/ModalContext.tsx
11231
11236
  import React305, {
11232
11237
  createContext as createContext20,
11233
- useCallback as useCallback65,
11238
+ useCallback as useCallback64,
11234
11239
  useContext as useContext20,
11235
- useEffect as useEffect90,
11240
+ useEffect as useEffect89,
11236
11241
  useMemo as useMemo67,
11237
11242
  useState as useState91
11238
11243
  } from "react";
@@ -11252,25 +11257,13 @@ var topbarOverflowContent = "_1r8f576 _1rsrm2fq3 _1rsrm2fs4";
11252
11257
 
11253
11258
  // src/modals/WithdrawalModal/WithdrawalModal.tsx
11254
11259
  import { resolveWithdrawalSourceTokenBalance as resolveWithdrawalSourceTokenBalance3 } from "@funkit/connect-core";
11255
- import React151, { useCallback as useCallback33, useEffect as useEffect53, useState as useState47 } from "react";
11260
+ import React151, { useCallback as useCallback32, useEffect as useEffect52, useState as useState47 } from "react";
11256
11261
  import { mainnet as mainnet8 } from "viem/chains";
11257
11262
 
11258
- // src/clients/internal/nado/encoding.ts
11259
- import {
11260
- concatHex,
11261
- formatUnits as formatUnits4,
11262
- pad,
11263
- stringToHex
11264
- } from "viem";
11265
- var X18_DECIMALS = 18;
11266
- function x18ToRawBaseUnit(x18Amount, decimals) {
11267
- return x18Amount * 10n ** BigInt(decimals) / 10n ** BigInt(X18_DECIMALS);
11268
- }
11269
- function x18ToTokenUnits(x18Amount, decimals) {
11270
- return formatUnits4(x18ToRawBaseUnit(x18Amount, decimals), decimals);
11271
- }
11272
-
11273
11263
  // src/clients/internal/nado/withdrawalConfig.ts
11264
+ import {
11265
+ buildNadoSubaccountId
11266
+ } from "@funkit/connect-core/clients/nado";
11274
11267
  function isNadoWithdrawalConfig(config) {
11275
11268
  return !!config && isCustomWithdrawalConfig(config) && config.customerConfig?.customerName === "nado";
11276
11269
  }
@@ -14621,6 +14614,9 @@ import React54, {
14621
14614
  } from "react";
14622
14615
 
14623
14616
  // src/hooks/useBluvo.ts
14617
+ import {
14618
+ extractErrorTypeInfo
14619
+ } from "@bluvo/sdk-ts";
14624
14620
  import { bluvoGetWithdrawableBalanceById as bluvoGetWithdrawableBalanceById2 } from "@funkit/api-base";
14625
14621
  import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO5 } from "@funkit/chains";
14626
14622
  import { keepPreviousData, useQuery as useQuery11 } from "@tanstack/react-query";
@@ -14802,7 +14798,17 @@ var useBluvo = () => {
14802
14798
  walletId: walletId2
14803
14799
  });
14804
14800
  } catch (err) {
14805
- logger.error("[useBluvo][startWithdrawal]: error", err);
14801
+ const { knownCode, rawType } = extractErrorTypeInfo(err);
14802
+ logger.error("[useBluvo][startWithdrawal]: error", err, {
14803
+ knownCode,
14804
+ rawType
14805
+ });
14806
+ return {
14807
+ error: {
14808
+ code: knownCode ?? "UNKNOWN",
14809
+ message: err.message
14810
+ }
14811
+ };
14806
14812
  }
14807
14813
  },
14808
14814
  [bluvoClient, authorizedConnections]
@@ -15028,13 +15034,17 @@ var getQuoteCustomErrorDisplayInfo = (t) => {
15028
15034
  };
15029
15035
  function getClientErrorDisplayMessage(err, t) {
15030
15036
  const raw = err.rawMessage;
15031
- if (!raw) return null;
15037
+ if (!raw) {
15038
+ return null;
15039
+ }
15032
15040
  const patterns = [
15033
15041
  { check: /too low/i, display: t("quote.checkoutAmountTooLow") },
15034
15042
  { check: /too high/i, display: t("quote.insufficientBalance") }
15035
15043
  ];
15036
15044
  const matched = patterns.find((p) => p.check.test(raw));
15037
- if (matched) return matched.display;
15045
+ if (matched) {
15046
+ return matched.display;
15047
+ }
15038
15048
  return raw;
15039
15049
  }
15040
15050
  function generateQuoteApiErrorForDisplay(err, t) {
@@ -15105,7 +15115,7 @@ function wrapResolveHealthFactor(resolve) {
15105
15115
  import { getCheckoutQuote as getApiCheckoutQuote } from "@funkit/api-base";
15106
15116
  import { RELAY_LIGHTER_CHAIN_ID } from "@funkit/fun-relay";
15107
15117
  import * as dnum3 from "dnum";
15108
- import { formatUnits as formatUnits5 } from "viem";
15118
+ import { formatUnits as formatUnits4 } from "viem";
15109
15119
 
15110
15120
  // src/domains/fees.ts
15111
15121
  import { getAssetPriceInfo as getAssetPriceInfo2 } from "@funkit/api-base";
@@ -15333,7 +15343,7 @@ function resolveFromTokenAmount(checkoutItem, isExactInViaBuilder, userInputAmou
15333
15343
  if (!isExactInViaBuilder) {
15334
15344
  return checkoutItem.sourceAssetAmount ?? "0";
15335
15345
  }
15336
- return checkoutItem.inputTokenAmountBaseUnits != null ? formatUnits5(checkoutItem.inputTokenAmountBaseUnits, fromTokenDecimals) : userInputAmount.toString();
15346
+ return checkoutItem.inputTokenAmountBaseUnits != null ? formatUnits4(checkoutItem.inputTokenAmountBaseUnits, fromTokenDecimals) : userInputAmount.toString();
15337
15347
  }
15338
15348
  function deriveEstSubtotalToAmountIfNeeded(baseQuote, isExactIn, toTokenDecimals) {
15339
15349
  if (!isExactIn) {
@@ -15346,7 +15356,7 @@ function deriveEstSubtotalToAmountIfNeeded(baseQuote, isExactIn, toTokenDecimals
15346
15356
  if (!raw || !/^\d+$/.test(raw)) {
15347
15357
  return null;
15348
15358
  }
15349
- return formatUnits5(BigInt(raw), toTokenDecimals);
15359
+ return formatUnits4(BigInt(raw), toTokenDecimals);
15350
15360
  }
15351
15361
  async function getQuoteFinalEstimation(baseQuote, checkoutItem, newPaymentMethodInfo, wagmiConfig, apiKey, loginType, isWithdrawal, brokerageQuote) {
15352
15362
  const newFinalDollarValue = baseQuote.estSubtotalUsd;
@@ -17454,6 +17464,19 @@ var PaddedScrollableArea = React69.forwardRef(function PaddedScrollableArea2({ p
17454
17464
 
17455
17465
  // src/components/Dialog/FocusTrap.tsx
17456
17466
  import React70, { useCallback as useCallback21, useEffect as useEffect27, useRef as useRef10 } from "react";
17467
+ var MAX_SHADOW_DEPTH = 32;
17468
+ var getActiveElementAcrossShadowRoots = () => {
17469
+ let active2 = document.activeElement;
17470
+ for (let depth = 0; depth < MAX_SHADOW_DEPTH; depth++) {
17471
+ const inner = active2?.shadowRoot?.activeElement;
17472
+ if (!inner || inner === active2) {
17473
+ return active2;
17474
+ }
17475
+ active2 = inner;
17476
+ }
17477
+ logger.warn("focusTrap:shadowDepthExceeded", { maxDepth: MAX_SHADOW_DEPTH });
17478
+ return active2;
17479
+ };
17457
17480
  var moveFocusWithin = (element2, position) => {
17458
17481
  const focusableElements = element2.querySelectorAll(
17459
17482
  "button:not(:disabled), a[href]"
@@ -17466,7 +17489,7 @@ var moveFocusWithin = (element2, position) => {
17466
17489
  function FocusTrap(props) {
17467
17490
  const contentRef = useRef10(null);
17468
17491
  useEffect27(() => {
17469
- const previouslyActiveElement = document.activeElement;
17492
+ const previouslyActiveElement = getActiveElementAcrossShadowRoots();
17470
17493
  return () => {
17471
17494
  ;
17472
17495
  previouslyActiveElement.focus?.();
@@ -18079,7 +18102,7 @@ import React87, {
18079
18102
  useState as useState30
18080
18103
  } from "react";
18081
18104
  import { createPortal as createPortal2 } from "react-dom";
18082
- import { numberToHex, pad as pad2, parseUnits as parseUnits3 } from "viem";
18105
+ import { numberToHex, pad, parseUnits as parseUnits3 } from "viem";
18083
18106
  import { mainnet as mainnet5 } from "viem/chains";
18084
18107
 
18085
18108
  // src/components/FunButton/FunRedirectButton.tsx
@@ -19614,34 +19637,30 @@ async function toCheckoutConfirmationError(t, error, wagmiConfig, options) {
19614
19637
  }
19615
19638
 
19616
19639
  // src/modals/WithdrawalModal/LighterWithdrawal.tsx
19640
+ import { useLogOnce } from "@funkit/connect-core";
19617
19641
  import {
19618
19642
  LIGHTER_ROUTE_TYPE,
19619
- LIGHTER_STAKING_POOL_INDEX,
19620
19643
  buildLighterL1WithdrawTransaction as buildLighterL1WithdrawTransaction2,
19621
- findLighterStakingShare,
19622
19644
  getLighterBaseSymbol,
19623
19645
  isLighterWithdrawalRateLimitError as isLighterWithdrawalRateLimitError2,
19624
19646
  lighterWithdrawBaseUnits as lighterWithdrawBaseUnits2,
19625
- resolveLighterSharePrice,
19626
- resolveLighterUnstakedFeeTokens,
19627
19647
  resolveLighterWithdrawalExplorerUrl as resolveLighterWithdrawalExplorerUrl2,
19628
- truncateToDecimals as truncateToDecimals2
19648
+ truncateToDecimals as truncateToDecimals2,
19649
+ useLighterFastUnstakedFeeTokens
19629
19650
  } from "@funkit/connect-core/clients/lighter";
19630
19651
  import {
19631
19652
  LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS,
19632
19653
  LIGHTER_FAST_MAX_WITHDRAWAL_USD,
19633
19654
  LIGHTER_ROUTE_TYPE as LIGHTER_ROUTE_TYPE2,
19634
19655
  LIGHTER_SECURE_ASSETS_BY_INDEX,
19635
- LIGHTER_STAKING_POOL_INDEX as LIGHTER_STAKING_POOL_INDEX2,
19656
+ LIGHTER_STAKING_POOL_INDEX,
19636
19657
  LIGHTER_STAKING_THRESHOLD_LIT,
19637
19658
  LIGHTER_UNSTAKED_FEE_TOKENS,
19638
19659
  LIGHTER_USDC_SPOT_SYMBOL,
19639
19660
  getLighterBaseSymbol as getLighterBaseSymbol2,
19640
19661
  getLighterSecureMainnetAddress,
19641
19662
  resolveLighterAssetIndex,
19642
- resolveLighterSecureRouteType,
19643
- resolveLighterSharePrice as resolveLighterSharePrice2,
19644
- resolveLighterUnstakedFeeTokens as resolveLighterUnstakedFeeTokens2
19663
+ resolveLighterSecureRouteType
19645
19664
  } from "@funkit/connect-core/clients/lighter";
19646
19665
  var LIGHTER_SECURE_METHOD_ID = "lighter-secure";
19647
19666
  var LIGHTER_PERPS_TOKEN_ADDRESS = "0x0000000000000000000000000000000000000000";
@@ -19659,7 +19678,7 @@ function resolveLighterSourceAsset({
19659
19678
  return void 0;
19660
19679
  }
19661
19680
  return {
19662
- tokenAddress: pad2(numberToHex(assetIndex), { size: 20 }),
19681
+ tokenAddress: pad(numberToHex(assetIndex), { size: 20 }),
19663
19682
  tokenChainId: RELAY_LIGHTER_CHAIN_ID2
19664
19683
  };
19665
19684
  }
@@ -19714,12 +19733,6 @@ function LighterSecureWithdrawalLink({
19714
19733
  }
19715
19734
  );
19716
19735
  }
19717
- function useLighterStakingSharePrice(enabled) {
19718
- const { account } = useLighterAccount(
19719
- enabled ? { by: "index", value: `${LIGHTER_STAKING_POOL_INDEX}` } : null
19720
- );
19721
- return useMemo25(() => resolveLighterSharePrice(account), [account]);
19722
- }
19723
19736
  function useLighterWithdrawalBalances({
19724
19737
  accountIndex
19725
19738
  }) {
@@ -19735,10 +19748,8 @@ function useLighterWithdrawalBalances({
19735
19748
  });
19736
19749
  }, [accountIndex, isLoading, account, error]);
19737
19750
  const assets = useMemo25(() => account?.assets ?? [], [account]);
19738
- const shares = useMemo25(() => account?.shares ?? [], [account]);
19739
19751
  return {
19740
19752
  assets,
19741
- shares,
19742
19753
  isLoading
19743
19754
  };
19744
19755
  }
@@ -19755,44 +19766,33 @@ function useLighterWithdrawal(config, setRecipientAddress) {
19755
19766
  const { mainAccountIndex, isUnifiedTradingMode } = useLighterAccounts({
19756
19767
  address: connectedAddress
19757
19768
  });
19758
- const { assets: lighterAssets, shares: lighterShares } = useLighterWithdrawalBalances({
19769
+ const { assets: lighterAssets } = useLighterWithdrawalBalances({
19759
19770
  accountIndex: mainAccountIndex
19760
19771
  });
19761
- const lighterSharePrice = useLighterStakingSharePrice(isLighterFast);
19762
- const lighterFastUnstakedFee = isLighterFast ? resolveLighterUnstakedFeeTokens(lighterShares, lighterSharePrice) : 0;
19763
- useEffect32(() => {
19764
- if (!isLighterFast) {
19765
- return;
19766
- }
19767
- const stakingShare = findLighterStakingShare(lighterShares);
19768
- logger.info("lighter:fast:unstaked-fee:resolved", {
19769
- accountIndex: mainAccountIndex,
19770
- sharesLength: lighterShares.length,
19771
- sharePrice: lighterSharePrice,
19772
- sharesAmount: stakingShare?.shares_amount,
19773
- unstakedFeeTokens: lighterFastUnstakedFee
19774
- });
19775
- if (stakingShare && lighterSharePrice === void 0) {
19776
- logger.warn("lighter:fast:share-price-unavailable", {
19777
- accountIndex: mainAccountIndex,
19778
- stakingPoolIndex: LIGHTER_STAKING_POOL_INDEX
19779
- });
19780
- }
19781
- if (lighterShares.length > 1 || !stakingShare) {
19782
- logger.warn("lighter:fast:unexpected-shares", {
19772
+ const {
19773
+ feeTokens: lighterFastUnstakedFee,
19774
+ isFetched: isLighterFastUnstakedFeeFetched,
19775
+ isError: isLighterFastUnstakedFeeError
19776
+ } = useLighterFastUnstakedFeeTokens({
19777
+ accountIndex: mainAccountIndex,
19778
+ enabled: isLighterFast
19779
+ });
19780
+ useLogOnce(
19781
+ isLighterFast && isLighterFastUnstakedFeeFetched ? `${mainAccountIndex}|${isLighterFastUnstakedFeeError}|${lighterFastUnstakedFee}` : void 0,
19782
+ () => {
19783
+ if (isLighterFastUnstakedFeeError) {
19784
+ logger.warn("lighter:fast:unstaked-fee:account-unavailable", {
19785
+ accountIndex: mainAccountIndex,
19786
+ unstakedFeeTokens: lighterFastUnstakedFee
19787
+ });
19788
+ return;
19789
+ }
19790
+ logger.info("lighter:fast:unstaked-fee:resolved", {
19783
19791
  accountIndex: mainAccountIndex,
19784
- sharesLength: lighterShares.length,
19785
- publicPoolIndexes: lighterShares.map((s) => s.public_pool_index),
19786
- hasStakingShare: !!stakingShare
19792
+ unstakedFeeTokens: lighterFastUnstakedFee
19787
19793
  });
19788
19794
  }
19789
- }, [
19790
- isLighterFast,
19791
- mainAccountIndex,
19792
- lighterShares,
19793
- lighterSharePrice,
19794
- lighterFastUnstakedFee
19795
- ]);
19795
+ );
19796
19796
  const invalidateLighterAccount = useInvalidateLighterAccount();
19797
19797
  return {
19798
19798
  isLighterSecure,
@@ -19801,6 +19801,9 @@ function useLighterWithdrawal(config, setRecipientAddress) {
19801
19801
  connectedAddress,
19802
19802
  lighterAssets,
19803
19803
  lighterFastUnstakedFee,
19804
+ // Fast: the fee gates quoting (see useLighterFastUnstakedFeeTokens) — true
19805
+ // for every other flow, where there's no fee fetch to wait on.
19806
+ isLighterFastUnstakedFeeFetched: !isLighterFast || isLighterFastUnstakedFeeFetched,
19804
19807
  invalidateLighterAccount
19805
19808
  };
19806
19809
  }
@@ -20151,10 +20154,11 @@ import { createPortal as createPortal3 } from "react-dom";
20151
20154
  import {
20152
20155
  getCompletionTxInfo as getCompletionTxInfo2,
20153
20156
  processRecentDepositsForNotifications,
20157
+ useLogOnce as useLogOnce2,
20154
20158
  useRecentDepositsApiQuery
20155
20159
  } from "@funkit/connect-core";
20156
20160
  import { isEVMAddressEquivalent as isEVMAddressEquivalent2 } from "@funkit/utils";
20157
- import { useEffect as useEffect33, useMemo as useMemo26, useRef as useRef14, useState as useState31 } from "react";
20161
+ import { useEffect as useEffect33, useMemo as useMemo26, useState as useState31 } from "react";
20158
20162
  import { zeroHash } from "viem";
20159
20163
  var RECENT_DIRECT_EXECUTION_SCAN_SIZE = 5;
20160
20164
  function useNadoWithdrawalStatus({
@@ -20204,19 +20208,14 @@ function useNadoWithdrawalStatus({
20204
20208
  setHasSettled(true);
20205
20209
  }
20206
20210
  }, [status]);
20207
- const loggedStatusRef = useRef14(void 0);
20208
- useEffect33(() => {
20209
- if (status === "pending" || loggedStatusRef.current === status) {
20210
- return;
20211
- }
20212
- loggedStatusRef.current = status;
20211
+ useLogOnce2(status === "pending" ? void 0 : status, () => {
20213
20212
  logger.info("nado:withdrawal:settled", {
20214
20213
  depositAddress,
20215
20214
  status,
20216
20215
  txHash: latestStep?.txHash,
20217
20216
  relayStatus: latestStep?.listenerInfo?.status
20218
20217
  });
20219
- }, [status, depositAddress, latestStep]);
20218
+ });
20220
20219
  const completionTx = useMemo26(() => {
20221
20220
  if (status !== "completed" || !latestStep) {
20222
20221
  return void 0;
@@ -20480,7 +20479,7 @@ import {
20480
20479
  formatTimestamp as formatTimestamp2,
20481
20480
  isTokenEquivalent as isTokenEquivalent5
20482
20481
  } from "@funkit/utils";
20483
- import React118, { useCallback as useCallback24, useMemo as useMemo33, useRef as useRef17, useState as useState33 } from "react";
20482
+ import React118, { useCallback as useCallback24, useMemo as useMemo33, useRef as useRef16, useState as useState33 } from "react";
20484
20483
  import { createPortal as createPortal4 } from "react-dom";
20485
20484
 
20486
20485
  // src/hooks/useReceiveAmountLabel.ts
@@ -21090,7 +21089,7 @@ import React93 from "react";
21090
21089
 
21091
21090
  // src/components/FunOptionBox/FunOptionBox.tsx
21092
21091
  import clsx14 from "clsx";
21093
- import React92, { useRef as useRef15 } from "react";
21092
+ import React92, { useRef as useRef14 } from "react";
21094
21093
 
21095
21094
  // src/components/FunOptionBox/FunOptionBox.css.ts
21096
21095
  var funOptionBoxStyle = { baseStyle: "_1rfcluh0", compactListStyle: "_1rfcluh1", defaultBorder: "_1rsrm2f2aa _1rsrm2f2ah _1rsrm2f1rx", defaultModeNotActiveBorder: "_1rsrm2f2am _1rsrm2f2at _1rsrm2f1rx _1rsrm2f1n", activeBorder: "_1rsrm2f1rs", disabledOptionBorder: "_1rsrm2f1ts", defaultBackground: "_1rsrm2f1ia _1rsrm2f11t", borderedBackground: "_1rsrm2f1ig _1rsrm2f11t", activeBackground: "_1rsrm2f1ia _1rsrm2f18n _1rsrm2f18o", uninteractiveBackground: "_1rsrm2f1im" };
@@ -21117,7 +21116,7 @@ function FunOptionBox({
21117
21116
  ...boxProps
21118
21117
  }) {
21119
21118
  const isClickable = !!onClick && !disabled;
21120
- const ref = useRef15(null);
21119
+ const ref = useRef14(null);
21121
21120
  return /* @__PURE__ */ React92.createElement(
21122
21121
  Box,
21123
21122
  {
@@ -22820,7 +22819,7 @@ function AddTokenToWalletButton({
22820
22819
  import { CheckoutState as CheckoutState3 } from "@funkit/api-base";
22821
22820
  import { SOLANA_MAINNET_CHAIN_ID } from "@funkit/chains";
22822
22821
  import { formatAddress as formatAddress6, formatTimestamp } from "@funkit/utils";
22823
- import React117, { useEffect as useEffect35, useRef as useRef16, useState as useState32 } from "react";
22822
+ import React117, { useEffect as useEffect35, useRef as useRef15, useState as useState32 } from "react";
22824
22823
 
22825
22824
  // src/utils/checkoutHistory.ts
22826
22825
  function getCheckoutCompletionTime(checkout) {
@@ -23025,7 +23024,7 @@ function OrderDetail({
23025
23024
  }) {
23026
23025
  const { t } = useFunkitTranslation();
23027
23026
  const [isExpanded, setIsExpanded] = useState32(false);
23028
- const contentRef = useRef16(null);
23027
+ const contentRef = useRef15(null);
23029
23028
  const isCheckoutItemLoaded = checkoutHistoryItem !== void 0;
23030
23029
  return /* @__PURE__ */ React117.createElement(Box, { ref: contentRef, paddingX: "12" }, /* @__PURE__ */ React117.createElement(
23031
23030
  Box,
@@ -23338,7 +23337,7 @@ function DirectExecutionOrderDetail({
23338
23337
  }) {
23339
23338
  const { t } = useFunkitTranslation();
23340
23339
  const [isExpanded, setIsExpanded] = useState33(false);
23341
- const contentRef = useRef17(null);
23340
+ const contentRef = useRef16(null);
23342
23341
  return /* @__PURE__ */ React118.createElement(Box, { ref: contentRef, paddingX: "12" }, /* @__PURE__ */ React118.createElement(
23343
23342
  Box,
23344
23343
  {
@@ -23691,7 +23690,9 @@ function resolveProgressState(historyItem) {
23691
23690
  function getDirectExecutionFulfillmentTimeMs(rootExecution, latestStep) {
23692
23691
  const startedAtMs = getDirectExecutionCreatedTimeMs2(rootExecution);
23693
23692
  const completedAtMs = getDirectExecutionUpdatedTimeMs2(latestStep);
23694
- if (!startedAtMs || !completedAtMs) return null;
23693
+ if (!startedAtMs || !completedAtMs) {
23694
+ return null;
23695
+ }
23695
23696
  return completedAtMs - startedAtMs;
23696
23697
  }
23697
23698
  function resolveExecutionProgressContext(historyItem, flow) {
@@ -23740,6 +23741,7 @@ function resolveExecutionProgressContext(historyItem, flow) {
23740
23741
  ...common,
23741
23742
  claimKey: getDirectExecutionNotificationKey2(historyItem),
23742
23743
  errorCode: isFailed2 ? latestStep.listenerInfo?.status ?? null : null,
23744
+ errorMessage: null,
23743
23745
  executionType: historyItem.type,
23744
23746
  fulfillmentTimeMs: isCompleted ? getDirectExecutionFulfillmentTimeMs(historyItem, latestStep) : null,
23745
23747
  historicalUserId: historyItem.userId,
@@ -23759,6 +23761,7 @@ function resolveExecutionProgressContext(historyItem, flow) {
23759
23761
  ...common,
23760
23762
  claimKey: historyItem.depositAddr,
23761
23763
  errorCode: isFailed ? historyItem.state : null,
23764
+ errorMessage: null,
23762
23765
  executionType: null,
23763
23766
  fulfillmentTimeMs: isCompleted ? getCheckoutCompletionTime(historyItem) * 1e3 : null,
23764
23767
  historicalUserId: null,
@@ -23912,7 +23915,8 @@ function useTrackExecutionProgressEvents(flow) {
23912
23915
  logEventV2(names.failed, () => ({
23913
23916
  flow,
23914
23917
  ...buildExecutionTransactionSnapshotProperties(args, connectorId),
23915
- error_code: args.errorCode
23918
+ error_code: args.errorCode,
23919
+ error_message: args.errorMessage
23916
23920
  }));
23917
23921
  }
23918
23922
  );
@@ -23984,237 +23988,27 @@ import {
23984
23988
  formatCryptoAndStringify as formatCryptoAndStringify4,
23985
23989
  formatCurrencyAndStringify as formatCurrencyAndStringify6
23986
23990
  } from "@funkit/utils";
23987
- import React138, { useEffect as useEffect45, useMemo as useMemo40, useState as useState44 } from "react";
23991
+ import React138, { useEffect as useEffect44, useMemo as useMemo40, useState as useState44 } from "react";
23988
23992
  import { createPortal as createPortal5 } from "react-dom";
23989
23993
  import { useDebounce } from "use-debounce";
23990
23994
  import { isAddress } from "viem";
23991
23995
  import { mainnet as mainnet7 } from "viem/chains";
23992
-
23993
- // src/clients/internal/nado/hooks.ts
23994
- import { skipToken, useQuery as useQuery13, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
23995
- import { useCallback as useCallback27, useEffect as useEffect37, useReducer as useReducer3 } from "react";
23996
-
23997
- // src/clients/internal/nado/errors.ts
23998
- var NadoGatewayError = class extends Error {
23999
- constructor(message, options) {
24000
- super(message);
24001
- this.name = "NadoGatewayError";
24002
- this.kind = options.kind;
24003
- this.errorCode = options.errorCode;
24004
- this.httpStatus = options.httpStatus;
24005
- }
24006
- };
24007
- function createNadoGatewayError(response, fallbackMessage) {
24008
- return new NadoGatewayError(response.error ?? fallbackMessage, {
24009
- kind: "api",
24010
- errorCode: response.error_code
24011
- });
24012
- }
24013
-
24014
- // src/clients/internal/nado/consts.ts
24015
- import { getAddress as getAddress3 } from "viem";
24016
- import { ink } from "viem/chains";
24017
- var INK_CHAIN_ID = ink.id;
24018
- var NADO_GATEWAY_URL = "https://gateway.prod.nado.xyz/v1";
24019
- var NADO_EIP712_VERIFYING_CONTRACT_ADDRESS = getAddress3(
24020
- "0x05ec92D78ED421f3D3Ada77FFdE167106565974E"
24021
- );
24022
-
24023
- // src/clients/internal/nado/fetch.ts
24024
- var DEFAULT_TIMEOUT_MS = 3e4;
24025
- var LOGGED_BODY_MAX_CHARS = 500;
24026
- function isTimeoutError(error) {
24027
- return error instanceof DOMException && error.name === "TimeoutError";
24028
- }
24029
- function createAbortWithTimeout(callerSignal, ms) {
24030
- const controller = new AbortController();
24031
- const id = setTimeout(
24032
- () => controller.abort(
24033
- new DOMException("Nado request timed out", "TimeoutError")
24034
- ),
24035
- ms
24036
- );
24037
- const propagateAbort = () => controller.abort(callerSignal?.reason);
24038
- if (callerSignal?.aborted) {
24039
- propagateAbort();
24040
- } else {
24041
- callerSignal?.addEventListener("abort", propagateAbort);
24042
- }
24043
- return {
24044
- signal: controller.signal,
24045
- cleanup: () => {
24046
- clearTimeout(id);
24047
- callerSignal?.removeEventListener("abort", propagateAbort);
24048
- }
24049
- };
24050
- }
24051
- async function nadoFetch(params) {
24052
- const { uri, method, body, signal } = params;
24053
- const startTimeMs = Date.now();
24054
- const abort = createAbortWithTimeout(signal, DEFAULT_TIMEOUT_MS);
24055
- let response;
24056
- let responseText;
24057
- try {
24058
- response = await fetch(uri, {
24059
- method,
24060
- signal: abort.signal,
24061
- ...body !== void 0 && {
24062
- headers: { "Content-Type": "application/json" },
24063
- body: JSON.stringify(body)
24064
- }
24065
- });
24066
- responseText = await response.text();
24067
- } catch (error) {
24068
- if (!signal?.aborted) {
24069
- logger.warn("nado:fetch_error", {
24070
- uri,
24071
- method,
24072
- durationMs: Date.now() - startTimeMs,
24073
- error
24074
- });
24075
- }
24076
- throw new NadoGatewayError(
24077
- `An error occurred trying to reach Nado: ${error}`,
24078
- { kind: isTimeoutError(error) ? "timeout" : "transport" }
24079
- );
24080
- } finally {
24081
- abort.cleanup();
24082
- }
24083
- if (!response.ok) {
24084
- logger.warn("nado:fetch_failed", {
24085
- uri,
24086
- method,
24087
- status: response.status,
24088
- durationMs: Date.now() - startTimeMs,
24089
- bodyPreview: responseText.slice(0, LOGGED_BODY_MAX_CHARS)
24090
- });
24091
- throw new NadoGatewayError(
24092
- response.status === 429 ? "Nado rate limit exceeded" : `Nado request failed with status ${response.status}`,
24093
- { kind: "http", httpStatus: response.status }
24094
- );
24095
- }
24096
- let json;
24097
- try {
24098
- json = JSON.parse(responseText);
24099
- } catch {
24100
- json = void 0;
24101
- }
24102
- if (json == null) {
24103
- logger.warn("nado:fetch_failed", {
24104
- uri,
24105
- method,
24106
- status: response.status,
24107
- bodyPreview: responseText.slice(0, LOGGED_BODY_MAX_CHARS)
24108
- });
24109
- throw new NadoGatewayError("Nado returned an invalid success response", {
24110
- kind: "transport",
24111
- httpStatus: response.status
24112
- });
24113
- }
24114
- logger.debug("nado:fetch", {
24115
- uri,
24116
- method,
24117
- status: response.status,
24118
- durationMs: Date.now() - startTimeMs,
24119
- bytes: responseText.length
24120
- });
24121
- return json;
24122
- }
24123
-
24124
- // src/clients/internal/nado/gateway.ts
24125
- function parseNadoGatewayResponse(response, uri) {
24126
- if (response.status !== "success") {
24127
- logger.warn("nado:gateway_rejected", {
24128
- uri,
24129
- error: response.error,
24130
- errorCode: response.error_code
24131
- });
24132
- throw createNadoGatewayError(response, "Nado gateway request failed");
24133
- }
24134
- return response.data;
24135
- }
24136
- async function nadoQuery(params, signal) {
24137
- const uri = `${NADO_GATEWAY_URL}/query?${new URLSearchParams(params)}`;
24138
- const response = await nadoFetch({
24139
- uri,
24140
- method: "GET",
24141
- signal
24142
- });
24143
- const data = parseNadoGatewayResponse(response, uri);
24144
- if (data === void 0) {
24145
- throw new NadoGatewayError("Nado returned success without data", {
24146
- kind: "api"
24147
- });
24148
- }
24149
- return data;
24150
- }
24151
- async function getNadoMaxWithdrawable(params, signal) {
24152
- const data = await nadoQuery(
24153
- {
24154
- type: "max_withdrawable",
24155
- product_id: params.productId.toString(),
24156
- sender: params.sender,
24157
- spot_leverage: params.spotLeverage ? "true" : "false"
24158
- },
24159
- signal
24160
- );
24161
- return data.max_withdrawable;
24162
- }
24163
- async function getNadoFeeRates(sender, signal) {
24164
- return nadoQuery({ type: "fee_rates", sender }, signal);
24165
- }
24166
-
24167
- // src/clients/internal/nado/hooks.ts
24168
- var MAX_WITHDRAWABLE_QUERY_KEY = "nadoMaxWithdrawable";
24169
- var MAX_WITHDRAWABLE_REFETCH_MS = 3e4;
24170
- var FEE_RATES_STALE_MS = 5 * 6e4;
24171
- var SETTLEMENT_TIMEOUT_MS = 10 * 6e4;
24172
- function shouldRetryNadoQuery(failureCount, error) {
24173
- if (error instanceof NadoGatewayError && (error.kind === "api" || error.kind === "timeout" || error.httpStatus === 429)) {
24174
- return false;
24175
- }
24176
- return failureCount < 2;
24177
- }
24178
- function useNadoMaxWithdrawable(params) {
24179
- const { productId, sender, spotLeverage } = params;
24180
- return useQuery13({
24181
- queryKey: [MAX_WITHDRAWABLE_QUERY_KEY, sender, productId, spotLeverage],
24182
- queryFn: productId !== void 0 && sender ? ({ signal }) => getNadoMaxWithdrawable({ productId, sender, spotLeverage }, signal) : skipToken,
24183
- refetchInterval: MAX_WITHDRAWABLE_REFETCH_MS,
24184
- retry: shouldRetryNadoQuery,
24185
- // Toggling borrow re-keys the query, and the empty gap would flash the
24186
- // balance to 0 ("insufficient" past any typed amount), so hold the last
24187
- // answer while the next one loads — unless it could read too high.
24188
- placeholderData: (previous, previousQuery) => {
24189
- const [, previousSender, previousProductId, previousSpotLeverage] = previousQuery?.queryKey ?? [];
24190
- const isSameAccountAndProduct = previousSender === sender && previousProductId === productId;
24191
- const borrowTurnedOff = previousSpotLeverage === true && !spotLeverage;
24192
- return isSameAccountAndProduct && !borrowTurnedOff ? previous : void 0;
24193
- }
24194
- });
24195
- }
24196
- function useInvalidateNadoMaxWithdrawable() {
24197
- const queryClient = useQueryClient3();
24198
- return useCallback27(() => {
24199
- queryClient.invalidateQueries({ queryKey: [MAX_WITHDRAWABLE_QUERY_KEY] });
24200
- }, [queryClient]);
24201
- }
24202
- function useNadoFeeRates(sender) {
24203
- return useQuery13({
24204
- queryKey: ["nadoFeeRates", sender],
24205
- queryFn: sender ? ({ signal }) => getNadoFeeRates(sender, signal) : skipToken,
24206
- staleTime: FEE_RATES_STALE_MS,
24207
- retry: shouldRetryNadoQuery
24208
- });
24209
- }
23996
+ import { useInvalidateNadoMaxWithdrawable } from "@funkit/connect-core/clients/nado";
24210
23997
 
24211
23998
  // src/clients/internal/nado/withdrawalForm.ts
24212
- import { useEffect as useEffect38, useMemo as useMemo36, useState as useState35 } from "react";
24213
- import { formatUnits as formatUnits6 } from "viem";
23999
+ import { safeBigInt } from "@funkit/connect-core";
24000
+ import {
24001
+ useNadoFeeRates,
24002
+ useNadoMaxWithdrawable,
24003
+ x18ToRawBaseUnit,
24004
+ x18ToTokenUnits
24005
+ } from "@funkit/connect-core/clients/nado";
24006
+ import { useEffect as useEffect37, useMemo as useMemo36, useState as useState35 } from "react";
24007
+ import { formatUnits as formatUnits5 } from "viem";
24214
24008
 
24215
24009
  // src/hooks/useAssetPrice.ts
24216
24010
  import { getAssetPriceInfoWithFallback } from "@funkit/connect-core";
24217
- import { skipToken as skipToken2, useQuery as useQuery14 } from "@tanstack/react-query";
24011
+ import { skipToken, useQuery as useQuery13 } from "@tanstack/react-query";
24218
24012
  function useAssetAddressPrice({
24219
24013
  chainId: chainId2,
24220
24014
  assetTokenAddress,
@@ -24225,14 +24019,14 @@ function useAssetAddressPrice({
24225
24019
  }) {
24226
24020
  const { apiKey } = useFunkitConfig();
24227
24021
  const isStablecoin = useIsStablecoin();
24228
- const { data, error, isLoading } = useQuery14({
24022
+ const { data, error, isLoading } = useQuery13({
24229
24023
  queryKey: ["getAssetPriceInfo", chainId2, assetTokenAddress],
24230
24024
  queryFn: enabled && chainId2 && assetTokenAddress ? () => getAssetPriceInfoWithFallback({
24231
24025
  apiKey,
24232
24026
  chainId: chainId2,
24233
24027
  assetTokenAddress,
24234
24028
  logger
24235
- }) : skipToken2,
24029
+ }) : skipToken,
24236
24030
  refetchInterval
24237
24031
  });
24238
24032
  const unitPrice = symbol && isStablecoin(symbol) ? 1 : data?.unitPrice;
@@ -24243,20 +24037,6 @@ function useAssetAddressPrice({
24243
24037
  };
24244
24038
  }
24245
24039
 
24246
- // src/utils/safeBigInt.ts
24247
- function safeBigInt(value, fallback2) {
24248
- if (typeof value === "bigint") {
24249
- return value;
24250
- }
24251
- if (typeof value === "number") {
24252
- return Number.isFinite(value) && Number.isInteger(value) ? BigInt(value) : fallback2;
24253
- }
24254
- if (typeof value === "string" && /^-?\d+$/.test(value)) {
24255
- return BigInt(value);
24256
- }
24257
- return fallback2;
24258
- }
24259
-
24260
24040
  // src/clients/internal/nado/withdrawalForm.ts
24261
24041
  var PRICE_REFRESH_MS = 6e4;
24262
24042
  function isNadoSourceToken(option) {
@@ -24274,7 +24054,7 @@ function getMaxEnterableAmount({
24274
24054
  }
24275
24055
  const maxRaw = x18ToRawBaseUnit(max, decimals);
24276
24056
  const feeRaw = x18ToRawBaseUnit(sequencerFee, decimals);
24277
- return formatUnits6(maxRaw + feeRaw, decimals);
24057
+ return formatUnits5(maxRaw + feeRaw, decimals);
24278
24058
  }
24279
24059
  function getSequencerFee(feeRates, option) {
24280
24060
  if (!option) {
@@ -24294,8 +24074,8 @@ function useNadoWithdrawalForm(config, selectedSourceToken) {
24294
24074
  const [spotLeverage, setSpotLeverage] = useState35(
24295
24075
  () => nadoConfig?.defaultSpotLeverage ?? false
24296
24076
  );
24297
- const { data: feeRates } = useNadoFeeRates(subaccount);
24298
- useEffect38(() => {
24077
+ const { data: feeRates } = useNadoFeeRates({ sender: subaccount, logger });
24078
+ useEffect37(() => {
24299
24079
  setSpotLeverage(nadoConfig?.defaultSpotLeverage ?? false);
24300
24080
  }, [subaccount, nadoConfig?.defaultSpotLeverage]);
24301
24081
  const amountToggle = {
@@ -24328,7 +24108,8 @@ function useNadoWithdrawalForm(config, selectedSourceToken) {
24328
24108
  const { data: maxWithdrawableX18 } = useNadoMaxWithdrawable({
24329
24109
  productId: selectedOption?.productId,
24330
24110
  sender: subaccount,
24331
- spotLeverage
24111
+ spotLeverage,
24112
+ logger
24332
24113
  });
24333
24114
  const sequencerFee = getSequencerFee(feeRates, selectedOption);
24334
24115
  const withdrawableBalanceTokenUnits = getMaxEnterableAmount({
@@ -24374,7 +24155,7 @@ import React128, { useMemo as useMemo38 } from "react";
24374
24155
  // src/components/Dropdown/BaseDropdown.tsx
24375
24156
  import { isMobile as isMobile4 } from "@funkit/utils";
24376
24157
  import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
24377
- import React126, { useCallback as useCallback28, useEffect as useEffect39, useMemo as useMemo37, useRef as useRef18, useState as useState36 } from "react";
24158
+ import React126, { useCallback as useCallback27, useEffect as useEffect38, useMemo as useMemo37, useRef as useRef17, useState as useState36 } from "react";
24378
24159
 
24379
24160
  // src/components/FunNoResults/FunNoResults.tsx
24380
24161
  import React123 from "react";
@@ -24617,9 +24398,10 @@ var baseStyles2 = "_1dewiqw0";
24617
24398
 
24618
24399
  // src/components/Dropdown/BaseDropdown.css.ts
24619
24400
  var BORDER_RADIUS = "dropdown";
24620
- var baseDropdownItemWrapperStyles = "_1nns6ys3 _1rsrm2f17";
24621
- var scrollGradientWrapperStyles = "_1nns6ys1";
24622
- var scrollableDropdownStyles = "_1nns6ys0";
24401
+ var baseDropdownItemWrapperStyles = "_1nns6ys6 _1rsrm2f17";
24402
+ var dropdownContentAnimationStyles = "_1nns6ys2";
24403
+ var scrollGradientWrapperStyles = "_1nns6ys4";
24404
+ var scrollableDropdownStyles = "_1nns6ys3";
24623
24405
 
24624
24406
  // src/components/Dropdown/BaseActiveDropdownItem.tsx
24625
24407
  function BaseActiveDropdownItem({
@@ -24846,8 +24628,8 @@ function BaseDropdown({
24846
24628
  [options, allowUnselect, unselectLabel]
24847
24629
  );
24848
24630
  const selectedOption = allOptions.find((option) => option.value === value);
24849
- const prevIsOpenedRef = useRef18(false);
24850
- const portalThemeRef = useRef18(null);
24631
+ const prevIsOpenedRef = useRef17(false);
24632
+ const portalThemeRef = useRef17(null);
24851
24633
  const handleSearch = (event) => {
24852
24634
  setSearchInput(event.target.value);
24853
24635
  };
@@ -24864,7 +24646,7 @@ function BaseDropdown({
24864
24646
  ),
24865
24647
  [additionalGroup, additionalGroupLabel, filteredOptions, groups]
24866
24648
  );
24867
- const handleOpenChange = useCallback28(
24649
+ const handleOpenChange = useCallback27(
24868
24650
  (open) => {
24869
24651
  setIsOpened(open);
24870
24652
  if (open) {
@@ -24875,7 +24657,7 @@ function BaseDropdown({
24875
24657
  },
24876
24658
  [onOpen, resetSearchOnClose]
24877
24659
  );
24878
- useEffect39(() => {
24660
+ useEffect38(() => {
24879
24661
  if (isOpened && !prevIsOpenedRef.current) {
24880
24662
  prevIsOpenedRef.current = true;
24881
24663
  if (selectedOption) {
@@ -24931,7 +24713,7 @@ function BaseDropdown({
24931
24713
  side: dropdownSide,
24932
24714
  sideOffset: dropdownSide === "top" ? 8 : 6,
24933
24715
  align: dropdownAlign,
24934
- className: "funkit-dropdown-content",
24716
+ className: dropdownContentAnimationStyles,
24935
24717
  style: {
24936
24718
  zIndex: `calc(${themeVars.modalZIndex} + 1)`,
24937
24719
  width: dropdownWidth ? `${dropdownWidth}px` : openDropdownFullWidth ? "var(--radix-dropdown-menu-trigger-width)" : void 0,
@@ -25575,13 +25357,13 @@ import React134 from "react";
25575
25357
  import React133, { useState as useState38 } from "react";
25576
25358
 
25577
25359
  // src/hooks/useInterval.ts
25578
- import { useEffect as useEffect40, useRef as useRef19 } from "react";
25360
+ import { useEffect as useEffect39, useRef as useRef18 } from "react";
25579
25361
  function useInterval(callback, delay) {
25580
- const savedCallback = useRef19(callback);
25362
+ const savedCallback = useRef18(callback);
25581
25363
  useIsomorphicLayoutEffect(() => {
25582
25364
  savedCallback.current = callback;
25583
25365
  }, [callback]);
25584
- useEffect40(() => {
25366
+ useEffect39(() => {
25585
25367
  const id = setInterval(() => {
25586
25368
  savedCallback.current();
25587
25369
  }, delay);
@@ -25878,7 +25660,7 @@ function FunNotification({
25878
25660
 
25879
25661
  // src/hooks/queries/useWithdrawalQuote.ts
25880
25662
  import { isTokenEquivalent as isTokenEquivalent6 } from "@funkit/utils";
25881
- import { useQuery as useQuery15 } from "@tanstack/react-query";
25663
+ import { useQuery as useQuery14 } from "@tanstack/react-query";
25882
25664
 
25883
25665
  // src/hooks/useIsBlacklistedWithdrawalAddress.ts
25884
25666
  import { isBlacklistedWithdrawalAddress } from "@funkit/connect-core";
@@ -25928,7 +25710,7 @@ function useWithdrawalQuote({
25928
25710
  secondTokenAddress: selectedTokenAddress
25929
25711
  });
25930
25712
  const { logEvent } = useTrack();
25931
- const query = useQuery15({
25713
+ const query = useQuery14({
25932
25714
  queryKey: [
25933
25715
  "withdrawal",
25934
25716
  "quote",
@@ -25995,9 +25777,9 @@ function useWithdrawalQuote({
25995
25777
 
25996
25778
  // src/hooks/queries/useWithdrawalRisk.ts
25997
25779
  import { isWithdrawalRisky } from "@funkit/connect-core";
25998
- import { useQuery as useQuery16 } from "@tanstack/react-query";
25780
+ import { useQuery as useQuery15 } from "@tanstack/react-query";
25999
25781
  var useWithdrawalRisk = (apiKey, receiveAddress, chainId2) => {
26000
- return useQuery16({
25782
+ return useQuery15({
26001
25783
  queryKey: ["withdrawal", "addressRisk", apiKey, receiveAddress, chainId2],
26002
25784
  queryFn: () => isWithdrawalRisky({
26003
25785
  address: receiveAddress,
@@ -26020,12 +25802,12 @@ var useWithdrawalRisk = (apiKey, receiveAddress, chainId2) => {
26020
25802
  };
26021
25803
 
26022
25804
  // src/hooks/track/analytics/useWithdrawalAnalytics.ts
26023
- import { useCallback as useCallback29 } from "react";
25805
+ import { useCallback as useCallback28 } from "react";
26024
25806
  function useWithdrawalAnalytics() {
26025
25807
  const logEventV2 = useTrackV2();
26026
25808
  const { checkoutItem } = useCheckoutContext();
26027
25809
  const checkoutId = checkoutItem?.id;
26028
- const trackWithdrawalAmountConfirmed = useCallback29(
25810
+ const trackWithdrawalAmountConfirmed = useCallback28(
26029
25811
  (args) => {
26030
25812
  if (!checkoutId) {
26031
25813
  return;
@@ -26054,7 +25836,7 @@ function useWithdrawalAnalytics() {
26054
25836
  // src/utils/polymarket.ts
26055
25837
  import {
26056
25838
  encodeAbiParameters,
26057
- getAddress as getAddress4,
25839
+ getAddress as getAddress3,
26058
25840
  getCreate2Address,
26059
25841
  keccak256,
26060
25842
  parseAbiParameters
@@ -26062,7 +25844,7 @@ import {
26062
25844
  var EOA_PROXY_WALLET_FACTORY_ADDRESS = "0xaacFeEa03eb1561C4e67d661e40682Bd20E3541b";
26063
25845
  var EOA_PROXY_WALLET_INIT_CODE_HASH = "0x2bce2127ff07fb632d16c8347c4ebf501f4841168bed00d9e6ef715ddb6fcecf";
26064
25846
  function derivePolymarketProxyAddress(address) {
26065
- return getAddress4(
25847
+ return getAddress3(
26066
25848
  getCreate2Address({
26067
25849
  from: EOA_PROXY_WALLET_FACTORY_ADDRESS,
26068
25850
  salt: keccak256(
@@ -26109,7 +25891,7 @@ function getErrorNotification({
26109
25891
  }
26110
25892
 
26111
25893
  // src/modals/WithdrawalModal/RecipientAddress.tsx
26112
- import React136, { useEffect as useEffect41, useState as useState39 } from "react";
25894
+ import React136, { useEffect as useEffect40, useState as useState39 } from "react";
26113
25895
  import {
26114
25896
  FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO8,
26115
25897
  solanaChain as solanaChain4,
@@ -26143,7 +25925,7 @@ function useShowConnectWallet({ config }) {
26143
25925
  isConnected,
26144
25926
  connectedWalletAddress
26145
25927
  });
26146
- useEffect41(() => {
25928
+ useEffect40(() => {
26147
25929
  logger.debug("withdrawalContent:showUseConnected", {
26148
25930
  isConnected,
26149
25931
  connectedWalletAddress,
@@ -26539,9 +26321,9 @@ function LighterSourceTokenDropdown({
26539
26321
  side: "bottom",
26540
26322
  sideOffset: 6,
26541
26323
  align: "end",
26542
- className: "funkit-dropdown-content",
26324
+ className: dropdownContentAnimationStyles,
26543
26325
  style: {
26544
- zIndex: "calc(var(--rk-modal-z-index, 2147483646) + 1)",
26326
+ zIndex: `calc(${themeVars.modalZIndex} + 1)`,
26545
26327
  // Track the chip width as a floor only — a short selection (e.g.
26546
26328
  // "LIT") must not squeeze longer labels ("USDC (Perps)") into
26547
26329
  // wrapping; the menu grows to its widest item instead.
@@ -26732,10 +26514,10 @@ function getRelayOutputCurrencyAmount(quote, fallback2) {
26732
26514
  }
26733
26515
 
26734
26516
  // src/modals/WithdrawalModal/withdrawalHooks.tsx
26735
- import { useCallback as useCallback30, useEffect as useEffect43, useRef as useRef20 } from "react";
26517
+ import { useCallback as useCallback29, useEffect as useEffect42, useRef as useRef19 } from "react";
26736
26518
 
26737
26519
  // src/hooks/useTokenAndChainDropdown.ts
26738
- import { useEffect as useEffect42, useState as useState41 } from "react";
26520
+ import { useEffect as useEffect41, useState as useState41 } from "react";
26739
26521
  import { polygon as polygon5 } from "viem/chains";
26740
26522
 
26741
26523
  // src/hooks/useEnabledTokenTransferChainTokens.ts
@@ -26823,12 +26605,12 @@ var useTokenAndChainDropdown = ({
26823
26605
  const [selectedToken, setSelectedToken] = useState41(
26824
26606
  noDefaultSelection ? void 0 : selectedDefaultToken
26825
26607
  );
26826
- useEffect42(() => {
26608
+ useEffect41(() => {
26827
26609
  if (!noDefaultSelection) {
26828
26610
  setSelectedChainId(selectedDefaultChainId);
26829
26611
  }
26830
26612
  }, [selectedDefaultChainId, noDefaultSelection]);
26831
- useEffect42(() => {
26613
+ useEffect41(() => {
26832
26614
  if (!noDefaultSelection) {
26833
26615
  setSelectedToken(selectedDefaultToken);
26834
26616
  }
@@ -26936,12 +26718,12 @@ var useFrozenSourceTokenBalance = ({
26936
26718
  isWithdrawing,
26937
26719
  sourceTokenBalance
26938
26720
  }) => {
26939
- const frozenSourceTokenBalanceRef = useRef20(null);
26721
+ const frozenSourceTokenBalanceRef = useRef19(null);
26940
26722
  if (!isWithdrawing) {
26941
26723
  frozenSourceTokenBalanceRef.current = null;
26942
26724
  }
26943
26725
  const displayedSourceTokenBalance = frozenSourceTokenBalanceRef.current ?? sourceTokenBalance;
26944
- const freezeDisplayedSourceTokenBalance = useCallback30((balance) => {
26726
+ const freezeDisplayedSourceTokenBalance = useCallback29((balance) => {
26945
26727
  frozenSourceTokenBalanceRef.current = balance;
26946
26728
  }, []);
26947
26729
  return {
@@ -26960,11 +26742,11 @@ function useWithdrawalLogging({
26960
26742
  debouncedInputAmount,
26961
26743
  debouncedInputAmountUsd
26962
26744
  }) {
26963
- const lastTargetAssetErrorRef = useRef20(null);
26964
- const lastQuoteErrorRef = useRef20(null);
26965
- const lastRiskyRecipientRef = useRef20(null);
26966
- const lastBlacklistedRecipientRef = useRef20(null);
26967
- useEffect43(() => {
26745
+ const lastTargetAssetErrorRef = useRef19(null);
26746
+ const lastQuoteErrorRef = useRef19(null);
26747
+ const lastRiskyRecipientRef = useRef19(null);
26748
+ const lastBlacklistedRecipientRef = useRef19(null);
26749
+ useEffect42(() => {
26968
26750
  if (!targetAssetFetchError) {
26969
26751
  return;
26970
26752
  }
@@ -26979,7 +26761,7 @@ function useWithdrawalLogging({
26979
26761
  });
26980
26762
  lastTargetAssetErrorRef.current = errorKey;
26981
26763
  }, [targetAssetFetchError, selectedChainId, selectedToken]);
26982
- useEffect43(() => {
26764
+ useEffect42(() => {
26983
26765
  if (!quoteErrorObject) {
26984
26766
  return;
26985
26767
  }
@@ -27007,7 +26789,7 @@ function useWithdrawalLogging({
27007
26789
  debouncedInputAmount,
27008
26790
  debouncedInputAmountUsd
27009
26791
  ]);
27010
- useEffect43(() => {
26792
+ useEffect42(() => {
27011
26793
  if (!isRisky) {
27012
26794
  return;
27013
26795
  }
@@ -27022,7 +26804,7 @@ function useWithdrawalLogging({
27022
26804
  });
27023
26805
  lastRiskyRecipientRef.current = warningKey;
27024
26806
  }, [isRisky, recipientAddress, selectedChainId, selectedToken]);
27025
- useEffect43(() => {
26807
+ useEffect42(() => {
27026
26808
  if (!isRecipientBlacklisted) {
27027
26809
  return;
27028
26810
  }
@@ -27043,11 +26825,11 @@ function useWithdrawalLogging({
27043
26825
  import { useState as useState43 } from "react";
27044
26826
 
27045
26827
  // src/hooks/useAutoClearState.ts
27046
- import { useCallback as useCallback31, useEffect as useEffect44, useRef as useRef21, useState as useState42 } from "react";
26828
+ import { useCallback as useCallback30, useEffect as useEffect43, useRef as useRef20, useState as useState42 } from "react";
27047
26829
  function useAutoClearState(initialValue = null) {
27048
26830
  const [state, setState] = useState42(initialValue);
27049
- const timeoutRef = useRef21(void 0);
27050
- useEffect44(() => {
26831
+ const timeoutRef = useRef20(void 0);
26832
+ useEffect43(() => {
27051
26833
  return () => {
27052
26834
  if (timeoutRef.current !== void 0) {
27053
26835
  clearTimeout(timeoutRef.current);
@@ -27056,7 +26838,7 @@ function useAutoClearState(initialValue = null) {
27056
26838
  }, []);
27057
26839
  return [
27058
26840
  state,
27059
- useCallback31((newState, durationMs) => {
26841
+ useCallback30((newState, durationMs) => {
27060
26842
  if (timeoutRef.current) {
27061
26843
  clearTimeout(timeoutRef.current);
27062
26844
  timeoutRef.current = void 0;
@@ -27387,6 +27169,7 @@ function useClientSpecificWithdrawalFlow({
27387
27169
  connectedAddress,
27388
27170
  lighterAssets,
27389
27171
  lighterFastUnstakedFee,
27172
+ isLighterFastUnstakedFeeFetched,
27390
27173
  invalidateLighterAccount
27391
27174
  } = useLighterWithdrawal(config, setRecipientAddress);
27392
27175
  const lighterSecureMainnetAddress = isLighterSecure ? getLighterSecureMainnetAddress(selectedSourceToken) : void 0;
@@ -27539,6 +27322,10 @@ function useClientSpecificWithdrawalFlow({
27539
27322
  // Both fees are 0 outside their own flow, so summing is safe. Resolved here
27540
27323
  // so the shared flow never has to name a client.
27541
27324
  clientFlatFeeTokens: lighterFastUnstakedFee + nadoSequencerFeeTokenAmount,
27325
+ // Gates quoting: Lighter Fast's fee is 0 (not yet real) until this flips
27326
+ // true, so quoting earlier would show an amount that changes underneath
27327
+ // the user once the real fee arrives.
27328
+ isClientFlatFeeSettled: isLighterFastUnstakedFeeFetched,
27542
27329
  // Only Nado's: Lighter Fast's unstaked fee already lands inside the relay
27543
27330
  // quote's own gas figure, so adding it again would double-count it.
27544
27331
  clientSourceChainGasUsd: nadoSequencerFeeUsd,
@@ -27590,6 +27377,7 @@ function usePostClientCommonWithdrawalFlow({
27590
27377
  clientSourceTokenBalance,
27591
27378
  clientSourceTokenUsdPrice: sourceTokenUsdPrice,
27592
27379
  clientFlatFeeTokens,
27380
+ isClientFlatFeeSettled,
27593
27381
  buildClientSubmitCustomerData,
27594
27382
  isL1FallbackAvailable,
27595
27383
  isSubmittingL1,
@@ -27662,10 +27450,10 @@ function usePostClientCommonWithdrawalFlow({
27662
27450
  targetAmount: confirmedTarget.amount
27663
27451
  });
27664
27452
  }
27665
- useEffect45(() => {
27453
+ useEffect44(() => {
27666
27454
  updateWithdrawalSourceAssetAmount(quoteInputAmount);
27667
27455
  }, [quoteInputAmount, updateWithdrawalSourceAssetAmount]);
27668
- useEffect45(() => {
27456
+ useEffect44(() => {
27669
27457
  if (!targetAssetAddress || !selectedChainId || !selectedToken) {
27670
27458
  return;
27671
27459
  }
@@ -27677,7 +27465,7 @@ function usePostClientCommonWithdrawalFlow({
27677
27465
  iconSrc: getTokenIconUrl(selectedToken)
27678
27466
  });
27679
27467
  }, [targetAssetAddress, updateTargetAsset, selectedChainId, selectedToken]);
27680
- useEffect45(() => {
27468
+ useEffect44(() => {
27681
27469
  setTimeout(() => {
27682
27470
  updateTargetAssetAmount(targetAssetAmount ?? 0);
27683
27471
  }, 0);
@@ -27813,11 +27601,14 @@ function usePostClientCommonWithdrawalFlow({
27813
27601
  if (isLighterSecure) {
27814
27602
  return lighterAssetIndex !== void 0;
27815
27603
  }
27816
- return !!token && !!selectedChainId && !!quote && isValidAddressAndChain && isAmountSettled;
27604
+ return !!token && !!selectedChainId && !!quote && isValidAddressAndChain && isAmountSettled && // ensure the amount is up to date
27605
+ // The flat fee (Lighter Fast's unstaked fee) reads 0 until settled — quoting
27606
+ // on that would show an amount that changes once the real fee arrives.
27607
+ isClientFlatFeeSettled;
27817
27608
  }
27818
27609
  const canContinue = computeCanContinue();
27819
27610
  const isCtaDisabled = isL1FallbackAvailable ? isSubmittingL1 || disableSubmit || !canContinue : disableSubmit || !canContinue || isWithdrawing;
27820
- const feesSummaryLoading = !isLighterSecure && isQuoteLoading;
27611
+ const feesSummaryLoading = !isLighterSecure && (isQuoteLoading || !isClientFlatFeeSettled);
27821
27612
  const feesSummaryQuote = isLighterSecure ? void 0 : quote?.finalEstimation;
27822
27613
  const feesSummaryUnavailable = isLighterSecure || !quoteEnabled;
27823
27614
  const { swapImpactUsd, appFeeUsd, gasUsd } = extractRelayFeeInfo3(
@@ -28217,7 +28008,7 @@ import React144 from "react";
28217
28008
 
28218
28009
  // src/hooks/queries/useWithdrawFops.ts
28219
28010
  import { RailConfigType as RailConfigType3, getFops as getFops3 } from "@funkit/api-base";
28220
- import { useQuery as useQuery17 } from "@tanstack/react-query";
28011
+ import { useQuery as useQuery16 } from "@tanstack/react-query";
28221
28012
  import { useMemo as useMemo41 } from "react";
28222
28013
  import {
28223
28014
  buildSwappedSellLimits,
@@ -28254,7 +28045,7 @@ var useWithdrawFops = (params) => {
28254
28045
  const userId = userInfo.id;
28255
28046
  const countryCode = userIpInfo?.alpha2;
28256
28047
  const isEnabled = (params.enabled ?? true) && !!apiKey && !!userId && !!userInfo.address && !!countryCode && !!params.sourceChainId && !!params.sourceTokenAddress && !isSwappedCurrencyCodeLoading;
28257
- const query = useQuery17({
28048
+ const query = useQuery16({
28258
28049
  // `prefillFiatEmail` is intentionally NOT in the queryKey: it's read inside
28259
28050
  // `queryFn` and captured at fetch time, so post-mount changes don't trigger a refetch
28260
28051
  queryKey: [
@@ -28351,11 +28142,11 @@ var useWithdrawFops = (params) => {
28351
28142
 
28352
28143
  // src/hooks/useSwappedPreload.ts
28353
28144
  import { isSwappedFop } from "@funkit/connect-core";
28354
- import { useEffect as useEffect46 } from "react";
28145
+ import { useEffect as useEffect45 } from "react";
28355
28146
 
28356
28147
  // src/modals/CheckoutModal/SourceChange/FormOfPaymentsList.tsx
28357
28148
  import { getFopKey, isSyntheticFop, sortFops as sortFops2 } from "@funkit/connect-core";
28358
- import React143, { useRef as useRef22, useState as useState45 } from "react";
28149
+ import React143, { useRef as useRef21, useState as useState45 } from "react";
28359
28150
 
28360
28151
  // src/components/Icons/GlobeIcon.tsx
28361
28152
  import React139 from "react";
@@ -28563,7 +28354,7 @@ function FormOfPaymentsContent({
28563
28354
  }) {
28564
28355
  const { t } = useFunkitTranslation();
28565
28356
  const [isExpanded, setIsExpanded] = useState45(false);
28566
- const toggleRef = useRef22(null);
28357
+ const toggleRef = useRef21(null);
28567
28358
  const { primary, secondary } = getFormOfPaymentSections(fopsData, fopPriority);
28568
28359
  const totalItems = primary.items.length + secondary.items.length;
28569
28360
  const showToggle = totalItems > defaultMaxItems;
@@ -28726,7 +28517,7 @@ function FormOfPaymentsList({
28726
28517
  function useSwappedPreload(fopsData, mode) {
28727
28518
  const fopPriority = useDynamicConfig("foppriority");
28728
28519
  const { setIframeUrl } = useSwappedContext(mode);
28729
- useEffect46(() => {
28520
+ useEffect45(() => {
28730
28521
  if (!fopsData) {
28731
28522
  setIframeUrl(null);
28732
28523
  return;
@@ -28866,8 +28657,8 @@ function WithdrawalMethodSelect({
28866
28657
  }
28867
28658
 
28868
28659
  // src/modals/WithdrawalModal/WithdrawalSwappedIframeController.tsx
28869
- import { useQueryClient as useQueryClient4 } from "@tanstack/react-query";
28870
- import React146, { useEffect as useEffect49 } from "react";
28660
+ import { useQueryClient as useQueryClient3 } from "@tanstack/react-query";
28661
+ import React146, { useEffect as useEffect48 } from "react";
28871
28662
 
28872
28663
  // src/components/SwappedIframeSkeleton.tsx
28873
28664
  import React145 from "react";
@@ -28986,7 +28777,7 @@ function SwappedIframeSkeleton({
28986
28777
  }
28987
28778
 
28988
28779
  // src/hooks/useSwappedIframeLifecycle.ts
28989
- import { useEffect as useEffect47, useRef as useRef23 } from "react";
28780
+ import { useEffect as useEffect46, useRef as useRef22 } from "react";
28990
28781
  var SWAPPED_IFRAME_TIMEOUT = 15e3;
28991
28782
  function useSwappedIframeLifecycle({
28992
28783
  fopType,
@@ -28994,13 +28785,13 @@ function useSwappedIframeLifecycle({
28994
28785
  mode
28995
28786
  }) {
28996
28787
  const { activateIframe, deactivateIframe, isSwappedReady } = useSwappedContext(mode);
28997
- const timeoutRef = useRef23(void 0);
28788
+ const timeoutRef = useRef22(void 0);
28998
28789
  const stableOnTimeout = useEffectEvent(onTimeout);
28999
- useEffect47(() => {
28790
+ useEffect46(() => {
29000
28791
  activateIframe(fopType);
29001
28792
  return () => deactivateIframe();
29002
28793
  }, [fopType, activateIframe, deactivateIframe]);
29003
- useEffect47(() => {
28794
+ useEffect46(() => {
29004
28795
  if (isSwappedReady) {
29005
28796
  clearTimeout(timeoutRef.current);
29006
28797
  return;
@@ -29017,7 +28808,8 @@ function useSwappedIframeLifecycle({
29017
28808
 
29018
28809
  // src/modals/WithdrawalModal/useFiatWithdrawal.ts
29019
28810
  import { getCheckoutQuoteV2 as getCheckoutQuoteV22 } from "@funkit/api-base";
29020
- import { useEffect as useEffect48, useRef as useRef24 } from "react";
28811
+ import { useEffect as useEffect47, useRef as useRef23 } from "react";
28812
+ import { safeBigInt as safeBigInt2 } from "@funkit/connect-core";
29021
28813
  import {
29022
28814
  findSwappedSourceOverride as findSwappedSourceOverride2,
29023
28815
  resolveWithdrawalSourceTokenBalance as resolveWithdrawalSourceTokenBalance2
@@ -29036,7 +28828,9 @@ function resolveSwappedWithdrawalLegs(config, override) {
29036
28828
  }
29037
28829
  async function ensureOnSourceChain(wallet, sourceChainId) {
29038
28830
  const currentChainId = await wallet.getChainId();
29039
- if (currentChainId === sourceChainId) return;
28831
+ if (currentChainId === sourceChainId) {
28832
+ return;
28833
+ }
29040
28834
  logger.info("fiat-withdrawal:switching_chain", {
29041
28835
  from: currentChainId,
29042
28836
  to: sourceChainId
@@ -29122,8 +28916,10 @@ function useFiatWithdrawal({
29122
28916
  tokenAddress: config.sourceTokenAddress
29123
28917
  })
29124
28918
  ) : null;
29125
- useEffect48(() => {
29126
- if (!legs || !checkoutItem) return;
28919
+ useEffect47(() => {
28920
+ if (!legs || !checkoutItem) {
28921
+ return;
28922
+ }
29127
28923
  updateTargetAsset({
29128
28924
  targetAsset: legs.targetTokenAddress,
29129
28925
  targetChain: legs.targetChainId,
@@ -29139,8 +28935,8 @@ function useFiatWithdrawal({
29139
28935
  legs?.targetTokenSymbol,
29140
28936
  legs?.iconSrc
29141
28937
  ]);
29142
- const isProcessingOrderRef = useRef24(false);
29143
- const submittedOrderIdsRef = useRef24(/* @__PURE__ */ new Set());
28938
+ const isProcessingOrderRef = useRef23(false);
28939
+ const submittedOrderIdsRef = useRef23(/* @__PURE__ */ new Set());
29144
28940
  const { handleWithdrawal, withdrawalError } = useWithdrawal({
29145
28941
  config,
29146
28942
  withdrawalItem
@@ -29151,7 +28947,7 @@ function useFiatWithdrawal({
29151
28947
  onError();
29152
28948
  }
29153
28949
  });
29154
- useEffect48(() => {
28950
+ useEffect47(() => {
29155
28951
  if (withdrawalError) {
29156
28952
  handleWithdrawalFailure();
29157
28953
  }
@@ -29188,8 +28984,12 @@ function useFiatWithdrawal({
29188
28984
  }
29189
28985
  );
29190
28986
  const processOrder = useEffectEvent(async (order) => {
29191
- if (rejectOrderBeforeStart(order)) return;
29192
- if (!isWalletWithdrawalConfig(config) || !legs || !checkoutItem) return;
28987
+ if (rejectOrderBeforeStart(order)) {
28988
+ return;
28989
+ }
28990
+ if (!isWalletWithdrawalConfig(config) || !legs || !checkoutItem) {
28991
+ return;
28992
+ }
29193
28993
  const { wallet } = config;
29194
28994
  const userAddress = wallet.address();
29195
28995
  isProcessingOrderRef.current = true;
@@ -29234,7 +29034,7 @@ function useFiatWithdrawal({
29234
29034
  String(legs.sourceChainId),
29235
29035
  legs.sourceTokenAddress
29236
29036
  );
29237
- const requiredBaseUnit = safeBigInt(
29037
+ const requiredBaseUnit = safeBigInt2(
29238
29038
  quote.estTotalFromAmountBaseUnit,
29239
29039
  0n
29240
29040
  );
@@ -29293,7 +29093,9 @@ function useFiatWithdrawal({
29293
29093
 
29294
29094
  // src/modals/WithdrawalModal/WithdrawalSwappedIframeController.tsx
29295
29095
  function isValidOrderData(data) {
29296
- if (!data || !data.order_id || !data.address) return false;
29096
+ if (!data || !data.order_id || !data.address) {
29097
+ return false;
29098
+ }
29297
29099
  const amount = Number(data.amount);
29298
29100
  return Number.isFinite(amount) && amount > 0;
29299
29101
  }
@@ -29307,7 +29109,7 @@ function WithdrawalSwappedIframeController({
29307
29109
  }) {
29308
29110
  const { logEvent } = useTrack();
29309
29111
  const { t } = useFunkitTranslation();
29310
- const queryClient = useQueryClient4();
29112
+ const queryClient = useQueryClient3();
29311
29113
  const { withdrawalItem } = useCheckoutContext();
29312
29114
  const { focusAmountInput, isSwappedReady, resetIframe, swappedTransport } = useSwappedContext("withdrawal");
29313
29115
  const { processOrder } = useFiatWithdrawal({
@@ -29325,7 +29127,7 @@ function WithdrawalSwappedIframeController({
29325
29127
  checkoutId: withdrawalItem?.id
29326
29128
  })
29327
29129
  );
29328
- useEffect49(() => {
29130
+ useEffect48(() => {
29329
29131
  if (isSwappedReady) {
29330
29132
  const metadata = getTrackMetadata();
29331
29133
  logger.info("swapped-withdrawal-iframe:ready", metadata);
@@ -29438,7 +29240,7 @@ function WithdrawalSwappedIframeController({
29438
29240
  }
29439
29241
  }
29440
29242
  });
29441
- useEffect49(() => {
29243
+ useEffect48(() => {
29442
29244
  return swappedTransport.onMessage(handleSwappedMessage);
29443
29245
  }, [swappedTransport, handleSwappedMessage]);
29444
29246
  useSwappedIframeLifecycle({
@@ -29480,18 +29282,18 @@ import { noop as noop4 } from "@funkit/utils";
29480
29282
  import React149 from "react";
29481
29283
 
29482
29284
  // src/components/FunCheckoutHistory/FunCheckoutHistoryContent.tsx
29483
- import React148, { useEffect as useEffect51 } from "react";
29285
+ import React148, { useEffect as useEffect50 } from "react";
29484
29286
 
29485
29287
  // src/components/FunCheckoutHistory/FunCheckoutHistoryDetail.tsx
29486
- import React147, { useCallback as useCallback32, useMemo as useMemo42, useState as useState46 } from "react";
29288
+ import React147, { useCallback as useCallback31, useMemo as useMemo42, useState as useState46 } from "react";
29487
29289
  import { createPortal as createPortal6 } from "react-dom";
29488
29290
 
29489
29291
  // src/hooks/useFunListeners.ts
29490
- import { useEffect as useEffect50, useRef as useRef25 } from "react";
29292
+ import { useEffect as useEffect49, useRef as useRef24 } from "react";
29491
29293
  function useCheckoutHistoryListener(activate = true, singleDepositAddr) {
29492
- const activeIntervalRef = useRef25(void 0);
29294
+ const activeIntervalRef = useRef24(void 0);
29493
29295
  const { startCheckoutHistoryListener, stopCheckoutHistoryListener } = useCheckoutHistoryContext();
29494
- useEffect50(() => {
29296
+ useEffect49(() => {
29495
29297
  if (activate) {
29496
29298
  const createdIntervalId = startCheckoutHistoryListener(
29497
29299
  /* singleDepositAddr */
@@ -29528,7 +29330,7 @@ function FunCheckoutHistoryDetail({
29528
29330
  useCheckoutHistoryListener(isProcessing, checkoutHistoryInfo?.depositAddr);
29529
29331
  useWalletAssets({ enableRefetchInterval: isProcessing || isCompleted });
29530
29332
  const { beginCheckout } = useFunkitCheckout({});
29531
- const handleNewCheckout = useCallback32(
29333
+ const handleNewCheckout = useCallback31(
29532
29334
  (fromCheckout) => {
29533
29335
  onClose({ isNewDeposit: true });
29534
29336
  const historicalCheckout = fromCheckout.clientMetadata;
@@ -29644,7 +29446,7 @@ function FunCheckoutHistoryContent({
29644
29446
  initDirectExecution: directExecutionInfo
29645
29447
  });
29646
29448
  const isDirectExecutionRecord = isCheckoutHistoryDirectExecution(depositAddress);
29647
- useEffect51(() => {
29449
+ useEffect50(() => {
29648
29450
  if (isDirectExecutionRecord) {
29649
29451
  if (directExecution) {
29650
29452
  onHistoryItemChange?.({
@@ -29752,7 +29554,7 @@ function WithdrawalTypeSelect({
29752
29554
  }
29753
29555
 
29754
29556
  // src/modals/WithdrawalModal/useTrackWithdrawalEvents.ts
29755
- import { useEffect as useEffect52 } from "react";
29557
+ import { useEffect as useEffect51 } from "react";
29756
29558
  function useTrackWithdrawalEvents() {
29757
29559
  const logEventV2 = useTrackV2();
29758
29560
  const { checkoutItem } = useCheckoutContext();
@@ -29784,7 +29586,7 @@ function useTrackWithdrawalEvents() {
29784
29586
  }));
29785
29587
  });
29786
29588
  const checkoutId = checkoutItem?.id;
29787
- useEffect52(() => {
29589
+ useEffect51(() => {
29788
29590
  if (checkoutId && claimAnalyticsEvent("fc_modal_opened" /* MODAL_OPENED */, checkoutId)) {
29789
29591
  trackModalOpened();
29790
29592
  }
@@ -29829,7 +29631,7 @@ function WithdrawalModal({
29829
29631
  "SELECT_METHOD" /* SELECT_METHOD */,
29830
29632
  "ENTER_AMOUNT" /* ENTER_AMOUNT */
29831
29633
  ].includes(step);
29832
- useEffect53(() => {
29634
+ useEffect52(() => {
29833
29635
  setStep(
29834
29636
  isInitialStepSelectMethod ? "SELECT_METHOD" /* SELECT_METHOD */ : "ENTER_AMOUNT" /* ENTER_AMOUNT */
29835
29637
  );
@@ -29842,7 +29644,7 @@ function WithdrawalModal({
29842
29644
  animate(() => setStep(nextStep), { reverse: opts?.reverseAnimation });
29843
29645
  }
29844
29646
  };
29845
- const onCloseWrapper = useCallback33(() => {
29647
+ const onCloseWrapper = useCallback32(() => {
29846
29648
  logEvent({
29847
29649
  eventName: "fw::modal_closed" /* MODAL_CLOSED */,
29848
29650
  metadata: {
@@ -29875,7 +29677,7 @@ function WithdrawalModal({
29875
29677
  withTopDivider: modalTitleMeta ? "always" : "scroll",
29876
29678
  scrollableContent: WITHDRAWAL_MODAL_CONTENT_ID
29877
29679
  });
29878
- const handleNewWithdrawal = useCallback33(() => {
29680
+ const handleNewWithdrawal = useCallback32(() => {
29879
29681
  resetForNewWithdrawal();
29880
29682
  setSelectedMethodId(null);
29881
29683
  navigateToStep(
@@ -30089,7 +29891,7 @@ import React284 from "react";
30089
29891
  // src/modals/ProfileDetails/ActivityTraversalContext.tsx
30090
29892
  import React152, {
30091
29893
  createContext as createContext19,
30092
- useCallback as useCallback34,
29894
+ useCallback as useCallback33,
30093
29895
  useContext as useContext19,
30094
29896
  useMemo as useMemo43,
30095
29897
  useState as useState48
@@ -30111,7 +29913,7 @@ var ActivityTraversalProvider = ({
30111
29913
  const [returnViewPresets, setReturnViewPresets] = useState48(
30112
29914
  {}
30113
29915
  );
30114
- const onSelectActivity = useCallback34(
29916
+ const onSelectActivity = useCallback33(
30115
29917
  ({
30116
29918
  checkoutId,
30117
29919
  initialPage,
@@ -30129,7 +29931,7 @@ var ActivityTraversalProvider = ({
30129
29931
  },
30130
29932
  []
30131
29933
  );
30132
- const resetActivityTraversal = useCallback34(() => {
29934
+ const resetActivityTraversal = useCallback33(() => {
30133
29935
  setSelectedPurchaseId(void 0);
30134
29936
  setSelectedPurchaseInitView(void 0);
30135
29937
  setReturnView(void 0);
@@ -30159,15 +29961,15 @@ var useActivityTraversal = () => {
30159
29961
  };
30160
29962
 
30161
29963
  // src/modals/ProfileDetails/ProfileDetails.tsx
30162
- import React283, { useCallback as useCallback61, useState as useState85 } from "react";
29964
+ import React283, { useCallback as useCallback60, useState as useState85 } from "react";
30163
29965
 
30164
29966
  // src/components/ModalHeightAnimationLayer/FunCheckoutModalHeightAnimationWrapper.tsx
30165
29967
  import React270 from "react";
30166
29968
 
30167
29969
  // src/modals/CheckoutModal/stepTransition.ts
30168
29970
  import {
30169
- useCallback as useCallback59,
30170
- useEffect as useEffect78,
29971
+ useCallback as useCallback58,
29972
+ useEffect as useEffect77,
30171
29973
  useRef as useRef40,
30172
29974
  useState as useState82
30173
29975
  } from "react";
@@ -30427,7 +30229,7 @@ import {
30427
30229
  BridgeCustomerStatus as BridgeCustomerStatus4
30428
30230
  } from "@funkit/api-base";
30429
30231
  import { exhaustiveCheck as exhaustiveCheck3 } from "@funkit/utils";
30430
- import React162, { useCallback as useCallback35, useState as useState50 } from "react";
30232
+ import React162, { useCallback as useCallback34, useState as useState50 } from "react";
30431
30233
  import { createPortal as createPortal8 } from "react-dom";
30432
30234
 
30433
30235
  // src/components/Icons/HomeIcon.tsx
@@ -31061,7 +30863,7 @@ var VerifyAccountScreen = ({
31061
30863
  const kycUninitialized = !isSoftRejected2 && customerStatus && isKycUninitialized(customerStatus);
31062
30864
  const canStartKyc = kycUninitialized || isSoftRejected2;
31063
30865
  const handleCreateVirtualFiatAccount = useCreateVirtualBankAccount();
31064
- const onClick = useCallback35(async () => {
30866
+ const onClick = useCallback34(async () => {
31065
30867
  if (customerStatus === BridgeCustomerStatus4.ACTIVE) {
31066
30868
  setCreating(true);
31067
30869
  const result = await handleCreateVirtualFiatAccount();
@@ -31577,15 +31379,15 @@ function VirtualFiatAccount({
31577
31379
  }
31578
31380
 
31579
31381
  // src/modals/PolymarketPerpsTransfer/PerpsTransferStep.tsx
31580
- import { useQueryClient as useQueryClient6 } from "@tanstack/react-query";
31581
- import React180, { useEffect as useEffect55, useRef as useRef26, useState as useState52 } from "react";
31382
+ import { useQueryClient as useQueryClient5 } from "@tanstack/react-query";
31383
+ import React180, { useEffect as useEffect54, useRef as useRef25, useState as useState52 } from "react";
31582
31384
  import { createPortal as createPortal10 } from "react-dom";
31583
31385
 
31584
31386
  // src/hooks/usePolymarketAccountBalances.ts
31585
31387
  import {
31586
- skipToken as skipToken3,
31587
- useQuery as useQuery18,
31588
- useQueryClient as useQueryClient5
31388
+ skipToken as skipToken2,
31389
+ useQuery as useQuery17,
31390
+ useQueryClient as useQueryClient4
31589
31391
  } from "@tanstack/react-query";
31590
31392
  import * as dnum6 from "dnum";
31591
31393
  var DEFAULT_BALANCE_REFETCH_MS = 1e3;
@@ -31641,15 +31443,15 @@ async function fetchAccountBalance(queryClient, getBalanceUsd, queryKey) {
31641
31443
  }
31642
31444
  }
31643
31445
  function useAccountBalance(account, refetchIntervalMs) {
31644
- const queryClient = useQueryClient5();
31446
+ const queryClient = useQueryClient4();
31645
31447
  const getBalanceUsd = account?.getBalanceUsd;
31646
31448
  const address = account?.address;
31647
- const query = useQuery18({
31449
+ const query = useQuery17({
31648
31450
  queryKey: polymarketAccountBalanceQueryKey(address),
31649
31451
  // `skipToken` disables the query when the account isn't configured (the
31650
31452
  // perps-transfer config is optional). It is *not* a fallback for a missing
31651
31453
  // balance — the getter is the single source of truth.
31652
- queryFn: getBalanceUsd && address ? ({ queryKey }) => fetchAccountBalance(queryClient, getBalanceUsd, queryKey) : skipToken3,
31454
+ queryFn: getBalanceUsd && address ? ({ queryKey }) => fetchAccountBalance(queryClient, getBalanceUsd, queryKey) : skipToken2,
31653
31455
  refetchInterval: refetchIntervalMs,
31654
31456
  // The poll interval is the freshness contract: a reader mounting within it
31655
31457
  // (e.g. navigating between the deposit picker and the transfer step) reads
@@ -31668,7 +31470,7 @@ function usePolymarketAccountBalances(accounts, options) {
31668
31470
  }
31669
31471
 
31670
31472
  // src/modals/PolymarketPerpsTransfer/useRecordPerpsTransfer.ts
31671
- import { useCallback as useCallback36 } from "react";
31473
+ import { useCallback as useCallback35 } from "react";
31672
31474
 
31673
31475
  // src/modals/PolymarketPerpsTransfer/recordPerpsTransfer.ts
31674
31476
  import { DirectExecutionType as DirectExecutionType4, createDirectExecution as createDirectExecution2 } from "@funkit/api-base";
@@ -31750,7 +31552,7 @@ function useRecordPerpsTransfer() {
31750
31552
  const { checkoutItem } = useCheckoutContext();
31751
31553
  const { apiKey } = useFunkitConfig();
31752
31554
  const userInfo = useFunkitUserInfo();
31753
- return useCallback36(
31555
+ return useCallback35(
31754
31556
  async ({
31755
31557
  direction,
31756
31558
  sourceAddress,
@@ -32234,7 +32036,7 @@ function PerpsTransferRows({ form }) {
32234
32036
  }
32235
32037
 
32236
32038
  // src/modals/PolymarketPerpsTransfer/usePerpsTransferForm.ts
32237
- import { useEffect as useEffect54, useState as useState51 } from "react";
32039
+ import { useEffect as useEffect53, useState as useState51 } from "react";
32238
32040
  function parseAmount(amount) {
32239
32041
  return Number(amount.replace(/,/g, ""));
32240
32042
  }
@@ -32264,7 +32066,7 @@ function usePerpsTransferForm({
32264
32066
  const { t } = useFunkitTranslation();
32265
32067
  const [amount, setAmount] = useState51(initialAmountUsd);
32266
32068
  const [direction, setDirection] = useState51(initialDirection);
32267
- useEffect54(() => {
32069
+ useEffect53(() => {
32268
32070
  if (status === "success") {
32269
32071
  setAmount("");
32270
32072
  }
@@ -32321,18 +32123,18 @@ function usePerpsTransferForm({
32321
32123
  var SUCCESS_RESET_MS = 2e3;
32322
32124
  function PerpsTransferStepComponent() {
32323
32125
  const bottomSectionRef = useBottomSectionRef();
32324
- const queryClient = useQueryClient6();
32126
+ const queryClient = useQueryClient5();
32325
32127
  const { checkoutItem } = useCheckoutContext();
32326
32128
  const recordTransfer = useRecordPerpsTransfer();
32327
32129
  const [status, setStatus] = useState52("idle");
32328
- const successResetTimerRef = useRef26(null);
32130
+ const successResetTimerRef = useRef25(null);
32329
32131
  const clearSuccessResetTimer = () => {
32330
32132
  if (successResetTimerRef.current !== null) {
32331
32133
  window.clearTimeout(successResetTimerRef.current);
32332
32134
  successResetTimerRef.current = null;
32333
32135
  }
32334
32136
  };
32335
- useEffect55(() => clearSuccessResetTimer, []);
32137
+ useEffect54(() => clearSuccessResetTimer, []);
32336
32138
  const perpsTransfer = checkoutItem?.initSettings.config.polymarketPerpsTransfer;
32337
32139
  const balances = usePolymarketAccountBalances({
32338
32140
  predictions: perpsTransfer?.predictions,
@@ -32494,9 +32296,9 @@ import { bluvoExecuteWithdrawal as bluvoExecuteWithdrawal2 } from "@funkit/api-b
32494
32296
 
32495
32297
  // src/components/FunInput/FunTwoFaInput.tsx
32496
32298
  import React183, {
32497
- useCallback as useCallback37,
32498
- useEffect as useEffect56,
32499
- useRef as useRef27,
32299
+ useCallback as useCallback36,
32300
+ useEffect as useEffect55,
32301
+ useRef as useRef26,
32500
32302
  useState as useState53
32501
32303
  } from "react";
32502
32304
  var FunTwoFaInput = ({
@@ -32510,23 +32312,23 @@ var FunTwoFaInput = ({
32510
32312
  hasResent = false,
32511
32313
  onCompleted
32512
32314
  }) => {
32513
- const inputRefs = useRef27(
32315
+ const inputRefs = useRef26(
32514
32316
  Array.from({ length: initialInputLength }, () => null)
32515
32317
  );
32516
32318
  const [currentLength, setCurrentLength] = useState53(initialInputLength);
32517
32319
  const [focusIndex, setFocusIndex] = useState53(0);
32518
32320
  const [isFocused, setIsFocused] = useState53(false);
32519
- useEffect56(() => {
32321
+ useEffect55(() => {
32520
32322
  if (!value) {
32521
32323
  setFocusIndex(0);
32522
32324
  }
32523
32325
  }, [value]);
32524
- const ensureFocus = useCallback37((nextIndex) => {
32326
+ const ensureFocus = useCallback36((nextIndex) => {
32525
32327
  setTimeout(() => {
32526
32328
  inputRefs.current[nextIndex]?.focus();
32527
32329
  }, 10);
32528
32330
  }, []);
32529
- const handleBackspace = useCallback37(
32331
+ const handleBackspace = useCallback36(
32530
32332
  (index) => {
32531
32333
  if (index === maxInputLength - 1 && value.length === maxInputLength) {
32532
32334
  onChange(value.slice(0, index));
@@ -32550,7 +32352,7 @@ var FunTwoFaInput = ({
32550
32352
  },
32551
32353
  [currentLength, initialInputLength, maxInputLength, onChange, value]
32552
32354
  );
32553
- const handleChange = useCallback37(
32355
+ const handleChange = useCallback36(
32554
32356
  (changeEvent) => {
32555
32357
  changeEvent.stopPropagation();
32556
32358
  const nativeEvent = changeEvent.nativeEvent;
@@ -33096,7 +32898,7 @@ var TwoFactorIcon = () => /* @__PURE__ */ React184.createElement(
33096
32898
  );
33097
32899
 
33098
32900
  // src/modals/CheckoutModal/Brokerage/ConnectExchange.tsx
33099
- import React188, { useCallback as useCallback38, useEffect as useEffect57, useState as useState55 } from "react";
32901
+ import React188, { useCallback as useCallback38, useEffect as useEffect56, useRef as useRef27, useState as useState55 } from "react";
33100
32902
  import { createPortal as createPortal12 } from "react-dom";
33101
32903
 
33102
32904
  // src/components/FunMessage/FunMessage.tsx
@@ -33167,6 +32969,211 @@ var TwoFaIcon = () => {
33167
32969
  );
33168
32970
  };
33169
32971
 
32972
+ // src/hooks/track/analytics/useDepositAnalytics.ts
32973
+ import { useCallback as useCallback37 } from "react";
32974
+ function buildDepositQuoteSnapshotProperties(args, connectorId) {
32975
+ return {
32976
+ ...resolvePaymentMethodProperties(args, connectorId),
32977
+ destination_address: args.destinationAddress,
32978
+ est_fulfillment_time_ms: args.quote.finalTimeEstimationMs,
32979
+ execution_type: args.executionType,
32980
+ num_quote_refreshes: args.numQuoteRefreshes,
32981
+ sender_address: args.sourceAddress,
32982
+ source_amount: args.sourceAssetAmount,
32983
+ source_chain: args.source.chainId,
32984
+ source_asset: args.source.tokenAddress,
32985
+ source_asset_ticker: args.source.ticker,
32986
+ target_amount: args.targetAssetAmount,
32987
+ target_chain: args.target.chainId,
32988
+ target_asset: args.target.tokenAddress,
32989
+ target_asset_ticker: args.target.ticker,
32990
+ trade_type: args.tradeType,
32991
+ ...resolveVisibleQuoteFeeProperties(args.quote)
32992
+ };
32993
+ }
32994
+ function useDepositAnalytics() {
32995
+ const logEventV2 = useTrackV2();
32996
+ const { checkoutItem } = useCheckoutContext();
32997
+ const { connectorId, walletAddress } = useGeneralWallet();
32998
+ const checkoutId = checkoutItem?.id;
32999
+ const config = checkoutItem?.initSettings.config;
33000
+ const paymentMethodInfo = checkoutItem?.selectedPaymentMethodInfo;
33001
+ const trackExchangeConnectStarted = useCallback37(
33002
+ (provider) => {
33003
+ logEventV2("fc_account_connect_started" /* ACCOUNT_CONNECT_STARTED */, () => ({
33004
+ payment_method: PaymentMethod.BROKERAGE,
33005
+ provider
33006
+ }));
33007
+ },
33008
+ [logEventV2]
33009
+ );
33010
+ const trackExchangeConnectCompleted = useCallback37(
33011
+ (provider) => {
33012
+ logEventV2("fc_account_connect_completed" /* ACCOUNT_CONNECT_COMPLETED */, () => ({
33013
+ payment_method: PaymentMethod.BROKERAGE,
33014
+ provider
33015
+ }));
33016
+ },
33017
+ [logEventV2]
33018
+ );
33019
+ const trackExchangeConnectFailed = useCallback37(
33020
+ (args) => {
33021
+ logEventV2("fc_account_connect_failed" /* ACCOUNT_CONNECT_FAILED */, () => ({
33022
+ error_code: args.errorCode,
33023
+ error_message: args.errorMessage,
33024
+ payment_method: PaymentMethod.BROKERAGE,
33025
+ provider: args.provider
33026
+ }));
33027
+ },
33028
+ [logEventV2]
33029
+ );
33030
+ const trackDepositAssetSelected = useCallback37(
33031
+ (args) => {
33032
+ logEventV2("fc_deposit_asset_selected" /* DEPOSIT_ASSET_SELECTED */, () => ({
33033
+ ...resolvePaymentMethodProperties(args, connectorId),
33034
+ source_chain: args.source.chainId,
33035
+ source_asset: args.source.tokenAddress,
33036
+ source_asset_ticker: args.source.ticker,
33037
+ target_chain: args.target.chainId,
33038
+ target_asset: args.target.tokenAddress,
33039
+ target_asset_ticker: args.target.ticker,
33040
+ asset_position: args.assetPosition,
33041
+ is_default_token: args.isDefaultToken
33042
+ }));
33043
+ },
33044
+ [connectorId, logEventV2]
33045
+ );
33046
+ const trackDepositTransferInteracted = useCallback37(
33047
+ (args) => {
33048
+ logEventV2("fc_deposit_transfer_interacted" /* DEPOSIT_TRANSFER_INTERACTED */, () => ({
33049
+ action: args.action,
33050
+ deposit_address: args.depositAddress,
33051
+ est_price_impact: args.estPriceImpact,
33052
+ interaction_count: args.interactionCount,
33053
+ min_amount_usd: args.minAmountUsd,
33054
+ payment_method: "transfer_crypto",
33055
+ prev_source_asset: args.previousSource?.tokenAddress ?? null,
33056
+ prev_source_asset_ticker: args.previousSource?.ticker ?? null,
33057
+ prev_source_chain: args.previousSource?.chainId ?? null,
33058
+ source_asset: args.source.tokenAddress,
33059
+ source_asset_ticker: args.source.ticker,
33060
+ source_chain: args.source.chainId,
33061
+ target_asset: args.target.tokenAddress,
33062
+ target_asset_ticker: args.target.ticker,
33063
+ target_chain: args.target.chainId
33064
+ }));
33065
+ },
33066
+ [logEventV2]
33067
+ );
33068
+ const trackDepositAmountConfirmed = useCallback37(
33069
+ (args) => {
33070
+ logEventV2("fc_deposit_amount_confirmed" /* DEPOSIT_AMOUNT_CONFIRMED */, () => ({
33071
+ ...resolvePaymentMethodProperties(args, connectorId),
33072
+ source_chain: args.source?.chainId ?? null,
33073
+ source_asset: args.source?.tokenAddress ?? null,
33074
+ source_asset_ticker: args.source?.ticker ?? null,
33075
+ target_chain: args.target.chainId,
33076
+ target_asset: args.target.tokenAddress,
33077
+ target_asset_ticker: args.target.ticker,
33078
+ select_type: args.selectType,
33079
+ preset_amount: args.presetAmount,
33080
+ trade_type: args.tradeType,
33081
+ source_amount: formatAnalyticsAmount(args.sourceAmount),
33082
+ target_amount: formatAnalyticsAmount(args.targetAmount)
33083
+ }));
33084
+ },
33085
+ [connectorId, logEventV2]
33086
+ );
33087
+ const trackDepositMethodSelected = useCallback37(
33088
+ (args) => {
33089
+ if (!config) {
33090
+ return;
33091
+ }
33092
+ logEventV2("fc_deposit_method_selected" /* DEPOSIT_METHOD_SELECTED */, () => ({
33093
+ checkout_id: checkoutId,
33094
+ payment_method: args.paymentMethod,
33095
+ payment_rail: args.paymentRail || null,
33096
+ provider: args.paymentMethod === PaymentMethod.ACCOUNT_BALANCE ? connectorId || null : args.provider || null,
33097
+ tab: args.tab,
33098
+ connection_status: args.connectionStatus || null,
33099
+ // Source is usually unset here because the method is picked before the
33100
+ // asset. Only use an explicit override so a previous method's selected
33101
+ // source cannot leak into this event.
33102
+ source_chain: args.source?.chainId || null,
33103
+ source_asset: args.source?.tokenAddress || null,
33104
+ source_asset_ticker: args.source?.ticker || null,
33105
+ target_chain: config.targetChain,
33106
+ target_asset: config.targetAsset,
33107
+ target_asset_ticker: config.targetAssetTicker || null
33108
+ }));
33109
+ },
33110
+ [config, connectorId, logEventV2]
33111
+ );
33112
+ const trackDepositQuoteDisplayed = useCallback37(
33113
+ (args) => {
33114
+ logEventV2(
33115
+ "fc_deposit_quote_displayed" /* DEPOSIT_QUOTE_DISPLAYED */,
33116
+ () => buildDepositQuoteSnapshotProperties(args, connectorId)
33117
+ );
33118
+ },
33119
+ [connectorId, logEventV2]
33120
+ );
33121
+ const trackDepositMeldQuoteDisplayed = useCallback37(
33122
+ ({ quote, numQuoteRefreshes }) => {
33123
+ if (!config || paymentMethodInfo?.paymentMethod !== PaymentMethod.CARD) {
33124
+ return;
33125
+ }
33126
+ logEventV2("fc_deposit_quote_displayed" /* DEPOSIT_QUOTE_DISPLAYED */, () => ({
33127
+ checkout_id: checkoutId,
33128
+ ...resolveVisibleQuoteFeeProperties(null),
33129
+ ...resolvePaymentMethodProperties(
33130
+ {
33131
+ paymentMethodInfo,
33132
+ serviceProvider: quote.serviceProvider
33133
+ },
33134
+ connectorId
33135
+ ),
33136
+ destination_address: getCheckoutRecipient({ config, walletAddress }) || null,
33137
+ est_fulfillment_time_ms: null,
33138
+ execution_type: null,
33139
+ num_quote_refreshes: numQuoteRefreshes,
33140
+ sender_address: null,
33141
+ source_amount: String(quote.sourceAmount),
33142
+ source_chain: null,
33143
+ source_asset: null,
33144
+ source_asset_ticker: null,
33145
+ target_amount: String(quote.destinationAmount),
33146
+ target_chain: config.targetChain,
33147
+ target_asset: config.targetAsset,
33148
+ target_asset_ticker: config.targetAssetTicker || null,
33149
+ trade_type: "EXACT_IN" /* EXACT_IN */
33150
+ }));
33151
+ },
33152
+ [config, connectorId, logEventV2, paymentMethodInfo, walletAddress]
33153
+ );
33154
+ const trackDepositQuoteConfirmed = useCallback37(
33155
+ (args) => {
33156
+ logEventV2(
33157
+ "fc_deposit_quote_confirmed" /* DEPOSIT_QUOTE_CONFIRMED */,
33158
+ () => buildDepositQuoteSnapshotProperties(args, connectorId)
33159
+ );
33160
+ },
33161
+ [connectorId, logEventV2]
33162
+ );
33163
+ return {
33164
+ trackDepositAmountConfirmed,
33165
+ trackDepositAssetSelected,
33166
+ trackDepositMeldQuoteDisplayed,
33167
+ trackDepositMethodSelected,
33168
+ trackDepositQuoteConfirmed,
33169
+ trackDepositQuoteDisplayed,
33170
+ trackDepositTransferInteracted,
33171
+ trackExchangeConnectCompleted,
33172
+ trackExchangeConnectFailed,
33173
+ trackExchangeConnectStarted
33174
+ };
33175
+ }
33176
+
33170
33177
  // src/modals/CheckoutModal/Brokerage/ConnectExchange.tsx
33171
33178
  var getGuaranteeList = (brokerType, t) => [
33172
33179
  {
@@ -33203,6 +33210,11 @@ function ConnectExchange({
33203
33210
  const iconSize = Number.parseInt(activeTheme.dimensions.connectExchangeIconSize, 10) || 48;
33204
33211
  const { t } = useFunkitTranslation();
33205
33212
  const { appName, uiCustomizations } = useFunkitConfig();
33213
+ const {
33214
+ trackExchangeConnectCompleted,
33215
+ trackExchangeConnectFailed,
33216
+ trackExchangeConnectStarted
33217
+ } = useDepositAnalytics();
33206
33218
  const { updateSelectedPaymentMethodInfo } = useCheckoutContext();
33207
33219
  const [authError, setAuthError] = useState55("");
33208
33220
  const { exchangeType, walletId, isConnected, handleStartWithdrawal } = useBluvo();
@@ -33210,11 +33222,16 @@ function ConnectExchange({
33210
33222
  const icon = getExchangeIcon(brokerType, iconSize);
33211
33223
  const isLoading = isLoadingBluvoModal;
33212
33224
  const exchangeName = getExchangeName(brokerType);
33225
+ const isConnectingRef = useRef27(false);
33213
33226
  const navigateToBrokerage = useEffectEvent(() => {
33214
33227
  if (exchangeType !== brokerType || !walletId) {
33215
33228
  return;
33216
33229
  }
33217
33230
  setIsLoadingBluvoModal(false);
33231
+ if (isConnectingRef.current) {
33232
+ trackExchangeConnectCompleted(brokerType);
33233
+ isConnectingRef.current = false;
33234
+ }
33218
33235
  const paymentInfo = createPaymentMethodInfo({
33219
33236
  paymentMethod: PaymentMethod.BROKERAGE,
33220
33237
  deviceId: walletId,
@@ -33223,27 +33240,57 @@ function ConnectExchange({
33223
33240
  updateSelectedPaymentMethodInfo(paymentInfo);
33224
33241
  onNext({ paymentMethodInfo: paymentInfo, popCurrentStep: true });
33225
33242
  });
33226
- const handleAuthError = useEffectEvent((errorMessage) => {
33227
- setAuthError(errorMessage);
33228
- setIsLoadingBluvoModal(false);
33229
- });
33230
- useEffect57(() => {
33243
+ const handleAuthError = useEffectEvent(
33244
+ (error) => {
33245
+ setAuthError(error.message);
33246
+ setIsLoadingBluvoModal(false);
33247
+ if (isConnectingRef.current) {
33248
+ trackExchangeConnectFailed({
33249
+ errorCode: error.code,
33250
+ errorMessage: error.messageKey,
33251
+ provider: brokerType
33252
+ });
33253
+ isConnectingRef.current = false;
33254
+ }
33255
+ }
33256
+ );
33257
+ useEffect56(() => {
33231
33258
  if (isConnected) {
33232
33259
  navigateToBrokerage();
33233
33260
  }
33234
33261
  }, [isConnected]);
33235
33262
  const onClickContinue = useCallback38(async () => {
33236
33263
  try {
33264
+ isConnectingRef.current = true;
33237
33265
  setIsLoadingBluvoModal(true);
33238
33266
  setAuthError("");
33239
- await handleStartWithdrawal(brokerType);
33267
+ trackExchangeConnectStarted(brokerType);
33268
+ const result = await handleStartWithdrawal(brokerType);
33269
+ if ("error" in result) {
33270
+ handleAuthError({
33271
+ code: result.error.code,
33272
+ messageKey: "brokerage.bluvoConnectionError",
33273
+ message: t("brokerage.bluvoConnectionError")
33274
+ });
33275
+ }
33240
33276
  } catch (err) {
33241
33277
  logger.error("Unable to connect to bluvo", err);
33242
- handleAuthError(t("brokerage.bluvoConnectionError"));
33278
+ handleAuthError({
33279
+ code: null,
33280
+ messageKey: "brokerage.bluvoConnectionError",
33281
+ message: t("brokerage.bluvoConnectionError")
33282
+ });
33243
33283
  } finally {
33244
33284
  setIsLoadingBluvoModal(false);
33245
33285
  }
33246
- }, [brokerType, handleStartWithdrawal, handleAuthError, t]);
33286
+ }, [
33287
+ brokerType,
33288
+ handleStartWithdrawal,
33289
+ handleAuthError,
33290
+ t,
33291
+ trackExchangeConnectFailed,
33292
+ trackExchangeConnectStarted
33293
+ ]);
33247
33294
  const bottomSectionRef = useBottomSectionRef();
33248
33295
  const { CustomComponent } = uiCustomizations.connectExchangeScreen;
33249
33296
  return /* @__PURE__ */ React188.createElement(Box, { id: "connect-exchange" }, uiCustomizations.connectExchangeScreen.customTopComponent?.(), CustomComponent ? /* @__PURE__ */ React188.createElement(
@@ -33289,7 +33336,7 @@ function ConnectExchange({
33289
33336
  }
33290
33337
 
33291
33338
  // src/modals/CheckoutModal/Brokerage/SelectBrokerage.tsx
33292
- import React191, { useCallback as useCallback40, useState as useState56 } from "react";
33339
+ import React191, { useCallback as useCallback39, useState as useState56 } from "react";
33293
33340
  import { createPortal as createPortal13 } from "react-dom";
33294
33341
 
33295
33342
  // src/components/FunSelectBrokerage/FunSelectBrokerage.tsx
@@ -33403,179 +33450,6 @@ function FunSelectBrokerage({
33403
33450
  );
33404
33451
  }
33405
33452
 
33406
- // src/hooks/track/analytics/useDepositAnalytics.ts
33407
- import { useCallback as useCallback39 } from "react";
33408
- function buildDepositQuoteSnapshotProperties(args, connectorId) {
33409
- return {
33410
- ...resolvePaymentMethodProperties(args, connectorId),
33411
- destination_address: args.destinationAddress,
33412
- est_fulfillment_time_ms: args.quote.finalTimeEstimationMs,
33413
- execution_type: args.executionType,
33414
- num_quote_refreshes: args.numQuoteRefreshes,
33415
- sender_address: args.sourceAddress,
33416
- source_amount: args.sourceAssetAmount,
33417
- source_chain: args.source.chainId,
33418
- source_asset: args.source.tokenAddress,
33419
- source_asset_ticker: args.source.ticker,
33420
- target_amount: args.targetAssetAmount,
33421
- target_chain: args.target.chainId,
33422
- target_asset: args.target.tokenAddress,
33423
- target_asset_ticker: args.target.ticker,
33424
- trade_type: args.tradeType,
33425
- ...resolveVisibleQuoteFeeProperties(args.quote)
33426
- };
33427
- }
33428
- function useDepositAnalytics() {
33429
- const logEventV2 = useTrackV2();
33430
- const { checkoutItem } = useCheckoutContext();
33431
- const { connectorId, walletAddress } = useGeneralWallet();
33432
- const checkoutId = checkoutItem?.id;
33433
- const config = checkoutItem?.initSettings.config;
33434
- const paymentMethodInfo = checkoutItem?.selectedPaymentMethodInfo;
33435
- const trackDepositAssetSelected = useCallback39(
33436
- (args) => {
33437
- logEventV2("fc_deposit_asset_selected" /* DEPOSIT_ASSET_SELECTED */, () => ({
33438
- ...resolvePaymentMethodProperties(args, connectorId),
33439
- source_chain: args.source.chainId,
33440
- source_asset: args.source.tokenAddress,
33441
- source_asset_ticker: args.source.ticker,
33442
- target_chain: args.target.chainId,
33443
- target_asset: args.target.tokenAddress,
33444
- target_asset_ticker: args.target.ticker,
33445
- asset_position: args.assetPosition,
33446
- is_default_token: args.isDefaultToken
33447
- }));
33448
- },
33449
- [connectorId, logEventV2]
33450
- );
33451
- const trackDepositTransferInteracted = useCallback39(
33452
- (args) => {
33453
- logEventV2("fc_deposit_transfer_interacted" /* DEPOSIT_TRANSFER_INTERACTED */, () => ({
33454
- action: args.action,
33455
- deposit_address: args.depositAddress,
33456
- est_price_impact: args.estPriceImpact,
33457
- interaction_count: args.interactionCount,
33458
- min_amount_usd: args.minAmountUsd,
33459
- payment_method: "transfer_crypto",
33460
- prev_source_asset: args.previousSource?.tokenAddress ?? null,
33461
- prev_source_asset_ticker: args.previousSource?.ticker ?? null,
33462
- prev_source_chain: args.previousSource?.chainId ?? null,
33463
- source_asset: args.source.tokenAddress,
33464
- source_asset_ticker: args.source.ticker,
33465
- source_chain: args.source.chainId,
33466
- target_asset: args.target.tokenAddress,
33467
- target_asset_ticker: args.target.ticker,
33468
- target_chain: args.target.chainId
33469
- }));
33470
- },
33471
- [logEventV2]
33472
- );
33473
- const trackDepositAmountConfirmed = useCallback39(
33474
- (args) => {
33475
- logEventV2("fc_deposit_amount_confirmed" /* DEPOSIT_AMOUNT_CONFIRMED */, () => ({
33476
- ...resolvePaymentMethodProperties(args, connectorId),
33477
- source_chain: args.source?.chainId ?? null,
33478
- source_asset: args.source?.tokenAddress ?? null,
33479
- source_asset_ticker: args.source?.ticker ?? null,
33480
- target_chain: args.target.chainId,
33481
- target_asset: args.target.tokenAddress,
33482
- target_asset_ticker: args.target.ticker,
33483
- select_type: args.selectType,
33484
- preset_amount: args.presetAmount,
33485
- trade_type: args.tradeType,
33486
- source_amount: formatAnalyticsAmount(args.sourceAmount),
33487
- target_amount: formatAnalyticsAmount(args.targetAmount)
33488
- }));
33489
- },
33490
- [connectorId, logEventV2]
33491
- );
33492
- const trackDepositMethodSelected = useCallback39(
33493
- (args) => {
33494
- if (!config) {
33495
- return;
33496
- }
33497
- logEventV2("fc_deposit_method_selected" /* DEPOSIT_METHOD_SELECTED */, () => ({
33498
- checkout_id: checkoutId,
33499
- payment_method: args.paymentMethod,
33500
- payment_rail: args.paymentRail || null,
33501
- provider: args.paymentMethod === PaymentMethod.ACCOUNT_BALANCE ? connectorId || null : args.provider || null,
33502
- tab: args.tab,
33503
- connection_status: args.connectionStatus || null,
33504
- // Source is usually unset here because the method is picked before the
33505
- // asset. Only use an explicit override so a previous method's selected
33506
- // source cannot leak into this event.
33507
- source_chain: args.source?.chainId || null,
33508
- source_asset: args.source?.tokenAddress || null,
33509
- source_asset_ticker: args.source?.ticker || null,
33510
- target_chain: config.targetChain,
33511
- target_asset: config.targetAsset,
33512
- target_asset_ticker: config.targetAssetTicker || null
33513
- }));
33514
- },
33515
- [config, connectorId, logEventV2]
33516
- );
33517
- const trackDepositQuoteDisplayed = useCallback39(
33518
- (args) => {
33519
- logEventV2(
33520
- "fc_deposit_quote_displayed" /* DEPOSIT_QUOTE_DISPLAYED */,
33521
- () => buildDepositQuoteSnapshotProperties(args, connectorId)
33522
- );
33523
- },
33524
- [connectorId, logEventV2]
33525
- );
33526
- const trackDepositMeldQuoteDisplayed = useCallback39(
33527
- ({ quote, numQuoteRefreshes }) => {
33528
- if (!config || paymentMethodInfo?.paymentMethod !== PaymentMethod.CARD) {
33529
- return;
33530
- }
33531
- logEventV2("fc_deposit_quote_displayed" /* DEPOSIT_QUOTE_DISPLAYED */, () => ({
33532
- checkout_id: checkoutId,
33533
- ...resolveVisibleQuoteFeeProperties(null),
33534
- ...resolvePaymentMethodProperties(
33535
- {
33536
- paymentMethodInfo,
33537
- serviceProvider: quote.serviceProvider
33538
- },
33539
- connectorId
33540
- ),
33541
- destination_address: getCheckoutRecipient({ config, walletAddress }) || null,
33542
- est_fulfillment_time_ms: null,
33543
- execution_type: null,
33544
- num_quote_refreshes: numQuoteRefreshes,
33545
- sender_address: null,
33546
- source_amount: String(quote.sourceAmount),
33547
- source_chain: null,
33548
- source_asset: null,
33549
- source_asset_ticker: null,
33550
- target_amount: String(quote.destinationAmount),
33551
- target_chain: config.targetChain,
33552
- target_asset: config.targetAsset,
33553
- target_asset_ticker: config.targetAssetTicker || null,
33554
- trade_type: "EXACT_IN" /* EXACT_IN */
33555
- }));
33556
- },
33557
- [config, connectorId, logEventV2, paymentMethodInfo, walletAddress]
33558
- );
33559
- const trackDepositQuoteConfirmed = useCallback39(
33560
- (args) => {
33561
- logEventV2(
33562
- "fc_deposit_quote_confirmed" /* DEPOSIT_QUOTE_CONFIRMED */,
33563
- () => buildDepositQuoteSnapshotProperties(args, connectorId)
33564
- );
33565
- },
33566
- [connectorId, logEventV2]
33567
- );
33568
- return {
33569
- trackDepositAssetSelected,
33570
- trackDepositAmountConfirmed,
33571
- trackDepositMethodSelected,
33572
- trackDepositMeldQuoteDisplayed,
33573
- trackDepositQuoteDisplayed,
33574
- trackDepositQuoteConfirmed,
33575
- trackDepositTransferInteracted
33576
- };
33577
- }
33578
-
33579
33453
  // src/utils/openExternalFlowPopup.ts
33580
33454
  var THEMES = {
33581
33455
  light: {
@@ -33684,7 +33558,7 @@ function SelectBrokerage({
33684
33558
  const { options, isPlaceholderData } = useExchangeOptions({ iconSize });
33685
33559
  const [selectedKey, setSelectedKey] = useState56();
33686
33560
  const bottomSectionRef = useBottomSectionRef();
33687
- const handleSelect = useCallback40(
33561
+ const handleSelect = useCallback39(
33688
33562
  async (option) => {
33689
33563
  if (isPlaceholderData && option.kind === "swapped" /* SWAPPED */) {
33690
33564
  return;
@@ -33772,11 +33646,11 @@ function SelectBrokerage({
33772
33646
  import React192 from "react";
33773
33647
 
33774
33648
  // src/modals/CheckoutModal/CheckoutComplete/useLogCheckoutCompletion.ts
33775
- import { useCallback as useCallback41 } from "react";
33649
+ import { useCallback as useCallback40 } from "react";
33776
33650
  function useLogCheckoutCompletion() {
33777
33651
  const { latestQuote } = useQuoteContext();
33778
33652
  const { checkoutItem } = useCheckoutContext();
33779
- const logCheckoutCompletion = useCallback41(
33653
+ const logCheckoutCompletion = useCallback40(
33780
33654
  (depositAddress) => {
33781
33655
  if (depositAddress) {
33782
33656
  logger.log("checkoutFundingCompleted", {
@@ -33838,7 +33712,7 @@ function CheckoutComplete({
33838
33712
 
33839
33713
  // src/modals/CheckoutModal/ConfirmationStep/ConfirmationStep.tsx
33840
33714
  import * as dnum8 from "dnum";
33841
- import React206, { useEffect as useEffect62, useMemo as useMemo50, useState as useState66 } from "react";
33715
+ import React206, { useEffect as useEffect61, useMemo as useMemo50, useState as useState66 } from "react";
33842
33716
  import { createPortal as createPortal15 } from "react-dom";
33843
33717
  import { DirectExecutionType as DirectExecutionType7 } from "@funkit/api-base";
33844
33718
 
@@ -34276,9 +34150,9 @@ import {
34276
34150
  import { permitTypedData, reserve, supply } from "@aave/client/actions";
34277
34151
  import { sendWith, signERC20PermitWith } from "@aave/client/viem";
34278
34152
  import { DirectExecutionType as DirectExecutionType5, createDirectExecution as createDirectExecution3 } from "@funkit/api-base";
34279
- import { useQuery as useQuery19 } from "@tanstack/react-query";
34153
+ import { useQuery as useQuery18 } from "@tanstack/react-query";
34280
34154
  import * as dnum7 from "dnum";
34281
- import { useCallback as useCallback42, useState as useState57 } from "react";
34155
+ import { useCallback as useCallback41, useState as useState57 } from "react";
34282
34156
  import { erc20Abi as erc20Abi5 } from "viem";
34283
34157
 
34284
34158
  // src/utils/isMainnetUsdt.ts
@@ -34515,7 +34389,7 @@ function useAaveTargetPoolAllowance(checkoutItem, owner) {
34515
34389
  const targetAsset = config?.targetAsset;
34516
34390
  const market = targetChainStr ? AAVE_MARKET_ADDRESS_BY_CHAIN[targetChainStr] : void 0;
34517
34391
  const wagmiConfig = useConfig();
34518
- const { data } = useQuery19({
34392
+ const { data } = useQuery18({
34519
34393
  queryKey: [
34520
34394
  "aaveTargetPoolAllowance",
34521
34395
  targetChainStr,
@@ -34547,7 +34421,7 @@ function useAaveTargetReservePermit(checkoutItem) {
34547
34421
  const targetChainStr = config?.targetChain;
34548
34422
  const targetAsset = config?.targetAsset;
34549
34423
  const market = targetChainStr ? AAVE_MARKET_ADDRESS_BY_CHAIN[targetChainStr] : void 0;
34550
- const { data } = useQuery19({
34424
+ const { data } = useQuery18({
34551
34425
  queryKey: [
34552
34426
  "aaveReservePermitSupported",
34553
34427
  targetChainStr,
@@ -34587,7 +34461,7 @@ function useAaveNativeSupply() {
34587
34461
  const targetChainStr = config?.targetChain;
34588
34462
  const targetAsset = config?.targetAsset;
34589
34463
  const market = targetChainStr ? AAVE_MARKET_ADDRESS_BY_CHAIN[targetChainStr] : void 0;
34590
- const submit = useCallback42(
34464
+ const submit = useCallback41(
34591
34465
  async (amount) => {
34592
34466
  setError(null);
34593
34467
  const fail = async (err) => {
@@ -34738,7 +34612,7 @@ import { DirectExecutionType as DirectExecutionType6, createDirectExecution as c
34738
34612
  import {
34739
34613
  isTokenEquivalent as isTokenEquivalent9
34740
34614
  } from "@funkit/utils";
34741
- import { useCallback as useCallback43, useRef as useRef28, useState as useState58 } from "react";
34615
+ import { useCallback as useCallback42, useRef as useRef28, useState as useState58 } from "react";
34742
34616
  import { erc20Abi as erc20Abi6 } from "viem";
34743
34617
  function getTransferAmountBaseUnit(tokenAmountBaseUnit, fallbackAssetAmount, decimals) {
34744
34618
  if (tokenAmountBaseUnit) {
@@ -34855,7 +34729,7 @@ function useIsNadoDirectTransferSource() {
34855
34729
  const { data: wrappedTokenAddress } = useXstocksWrappedTokenAddress();
34856
34730
  const config = checkoutItem?.initSettings.config;
34857
34731
  const isXstockTarget = isXStockAsset(getActiveDynamicTargetAsset(config));
34858
- return useCallback43(
34732
+ return useCallback42(
34859
34733
  (source) => config != null && isNadoDirectTransferContext({
34860
34734
  apiKey,
34861
34735
  sourceAsset: source,
@@ -34887,7 +34761,7 @@ function useNadoDirectTransfer() {
34887
34761
  chainId: sourceAsset.chainId,
34888
34762
  address: sourceAsset.address
34889
34763
  });
34890
- const submit = useCallback43(async () => {
34764
+ const submit = useCallback42(async () => {
34891
34765
  if (isSubmittingRef.current) {
34892
34766
  return null;
34893
34767
  }
@@ -35365,7 +35239,7 @@ function mapRetryAction(quoteBuilder, params) {
35365
35239
  }
35366
35240
 
35367
35241
  // src/modals/CheckoutModal/ConfirmationStep/useSourceAssetConfirm.tsx
35368
- import { useEffect as useEffect58, useState as useState60 } from "react";
35242
+ import { useEffect as useEffect57, useState as useState60 } from "react";
35369
35243
  function useSourceAssetConfirm(setPreloadedQuoteData) {
35370
35244
  const { setCheckoutQuote, getCheckoutQuote, setQuoteProgress } = useQuoteContext();
35371
35245
  const { checkoutItem, setCheckout } = useCheckoutContext();
@@ -35414,7 +35288,7 @@ function useHackyTriggerWorkaroundReactDevBrainExplode() {
35414
35288
  function useTriggerQuoteAndOtherStuffsWithExtremeCaution(onResult, setPreloadedQuoteData) {
35415
35289
  const [assetRefresh, triggerAssetConfirm] = useHackyTriggerWorkaroundReactDevBrainExplode();
35416
35290
  const { isSourceAssetConfirming, onSourceAssetConfirmed } = useSourceAssetConfirm(setPreloadedQuoteData);
35417
- useEffect58(() => {
35291
+ useEffect57(() => {
35418
35292
  if (assetRefresh === 0) {
35419
35293
  return;
35420
35294
  }
@@ -35506,7 +35380,7 @@ import React203, { useState as useState62 } from "react";
35506
35380
 
35507
35381
  // src/modals/CheckoutModal/ConfirmationStep/useAccountBalanceTransfer.ts
35508
35382
  import { USDT_ABI } from "@funkit/utils";
35509
- import { useCallback as useCallback44 } from "react";
35383
+ import { useCallback as useCallback43 } from "react";
35510
35384
  import { erc20Abi as erc20Abi7 } from "viem";
35511
35385
  function useWeb3AccountBalancePostCheckout(setPostCheckoutStepMessage) {
35512
35386
  const { t } = useFunkitTranslation();
@@ -35516,7 +35390,7 @@ function useWeb3AccountBalancePostCheckout(setPostCheckoutStepMessage) {
35516
35390
  const { sendTransactionAsync } = useSendTransaction();
35517
35391
  const { cancelCheckout, checkoutItem } = useCheckoutContext();
35518
35392
  const { latestQuote } = useQuoteContext();
35519
- const handleWeb3AccountBalancePostCheckout = useCallback44(
35393
+ const handleWeb3AccountBalancePostCheckout = useCallback43(
35520
35394
  async (depositAddress) => {
35521
35395
  const WEB3_ACCOUNT_BALANCE_MESSAGE = getWeb3AccountBalanceMessage(t);
35522
35396
  if (!latestQuote?.baseQuote.estTotalFromAmountBaseUnit) {
@@ -35624,7 +35498,7 @@ function useWeb3AccountBalancePostCheckout(setPostCheckoutStepMessage) {
35624
35498
  function useAccountBalancePostCheckout(setPostCheckoutStepMessage) {
35625
35499
  const { loginType } = useGeneralWallet();
35626
35500
  const handleWeb3AccountBalancePostCheckout = useWeb3AccountBalancePostCheckout(setPostCheckoutStepMessage);
35627
- const handleAccountBalancePostCheckout = useCallback44(
35501
+ const handleAccountBalancePostCheckout = useCallback43(
35628
35502
  async (depositAddress) => {
35629
35503
  if (loginType === "web3" /* Web3 */) {
35630
35504
  await handleWeb3AccountBalancePostCheckout(depositAddress);
@@ -35774,15 +35648,15 @@ function usePostCheckout({
35774
35648
  }
35775
35649
 
35776
35650
  // src/modals/CheckoutModal/ConfirmationStep/useQuoteRefresh.ts
35777
- import { useCallback as useCallback47, useEffect as useEffect60, useMemo as useMemo49, useRef as useRef29, useState as useState65 } from "react";
35651
+ import { useCallback as useCallback46, useEffect as useEffect59, useMemo as useMemo49, useRef as useRef29, useState as useState65 } from "react";
35778
35652
 
35779
35653
  // src/hooks/useCountdown.tsx
35780
35654
  import React205 from "react";
35781
- import { useCallback as useCallback46, useState as useState64 } from "react";
35655
+ import { useCallback as useCallback45, useState as useState64 } from "react";
35782
35656
 
35783
35657
  // src/components/FunCountdown/FunCountdown.tsx
35784
35658
  import { noop as noop5 } from "@funkit/utils";
35785
- import React204, { useCallback as useCallback45, useEffect as useEffect59, useState as useState63 } from "react";
35659
+ import React204, { useCallback as useCallback44, useEffect as useEffect58, useState as useState63 } from "react";
35786
35660
 
35787
35661
  // src/components/FunCountdown/FunCountdown.css.ts
35788
35662
  var backgroundRing = "_1t0bc111 _1rsrm2f2mm";
@@ -35818,14 +35692,14 @@ var FunCountdown = ({
35818
35692
  const onCountdownEndedOnce = useEffectEvent(onCountdownEnded);
35819
35693
  const onBeforeCountdownEndsOnce = useEffectEvent(onBeforeCountdownEnds);
35820
35694
  const onCountdownLastSecondOnce = useEffectEvent(onCountdownLastSecond);
35821
- const handleInterval = useCallback45(() => {
35695
+ const handleInterval = useCallback44(() => {
35822
35696
  if (isPaused) {
35823
35697
  return;
35824
35698
  }
35825
35699
  setRemainingSeconds((prev) => prev > 0 ? prev - 1 : prev);
35826
35700
  }, [isPaused]);
35827
35701
  useInterval(handleInterval, 1e3);
35828
- useEffect59(() => {
35702
+ useEffect58(() => {
35829
35703
  if (remainingSeconds === onBeforeCountdownEndsSeconds) {
35830
35704
  onBeforeCountdownEndsOnce();
35831
35705
  }
@@ -35936,7 +35810,7 @@ function useCountdown({
35936
35810
  }) {
35937
35811
  const [countdownKey, setCountdownKey] = useState64(0);
35938
35812
  const [isLastSecond, setIsLastSecond] = useState64(false);
35939
- const restartCountdown = useCallback46(() => {
35813
+ const restartCountdown = useCallback45(() => {
35940
35814
  setIsLastSecond(false);
35941
35815
  setCountdownKey((key) => key + 1);
35942
35816
  }, []);
@@ -35979,7 +35853,7 @@ function useQuoteRefresh({
35979
35853
  const quoteCallbackRef = useRef29(void 0);
35980
35854
  const [isPendingRefresh, setIsPendingRefresh] = useState65(false);
35981
35855
  const [numQuoteRefreshes, setNumQuoteRefreshes] = useState65(0);
35982
- useEffect60(() => {
35856
+ useEffect59(() => {
35983
35857
  setNumQuoteRefreshes(0);
35984
35858
  }, [checkoutId]);
35985
35859
  const {
@@ -36001,7 +35875,7 @@ function useQuoteRefresh({
36001
35875
  preloadedQuoteRef.current = data;
36002
35876
  }
36003
35877
  );
36004
- const preloadQuote = useCallback47(() => {
35878
+ const preloadQuote = useCallback46(() => {
36005
35879
  if (!isSourceAssetConfirming) {
36006
35880
  logger.log("quote:trigger", {
36007
35881
  quoteReason: "refresh",
@@ -36019,7 +35893,7 @@ function useQuoteRefresh({
36019
35893
  onBeforeCountdownEnds: preloadQuote,
36020
35894
  onCountdownEnded: () => refreshQuote()
36021
35895
  });
36022
- const refreshQuote = useCallback47(
35896
+ const refreshQuote = useCallback46(
36023
35897
  async (forceHardRefresh = false) => {
36024
35898
  if (isOnHold) {
36025
35899
  setIsPendingRefresh(true);
@@ -36065,7 +35939,7 @@ function useQuoteRefresh({
36065
35939
  }
36066
35940
  return null;
36067
35941
  }, [isQuoting, quoteErrorMessage]);
36068
- useEffect60(() => {
35942
+ useEffect59(() => {
36069
35943
  if (isPendingRefresh && !isOnHold) {
36070
35944
  setIsPendingRefresh(false);
36071
35945
  refreshQuote();
@@ -36083,7 +35957,7 @@ function useQuoteRefresh({
36083
35957
  }
36084
35958
 
36085
35959
  // src/modals/CheckoutModal/ConfirmationStep/useTrackDepositQuoteEvents.ts
36086
- import { useCallback as useCallback48, useEffect as useEffect61, useRef as useRef30 } from "react";
35960
+ import { useCallback as useCallback47, useEffect as useEffect60, useRef as useRef30 } from "react";
36087
35961
  function buildQuoteEventArgs({
36088
35962
  checkoutConfig,
36089
35963
  checkoutItem,
@@ -36143,10 +36017,10 @@ function useTrackDepositQuoteEvents({
36143
36017
  const checkoutId = checkoutItem?.id ?? null;
36144
36018
  const checkoutConfig = checkoutItem?.initSettings.config;
36145
36019
  const lastDisplayedQuoteIdRef = useRef30(null);
36146
- useEffect61(() => {
36020
+ useEffect60(() => {
36147
36021
  lastDisplayedQuoteIdRef.current = null;
36148
36022
  }, [checkoutId]);
36149
- useEffect61(() => {
36023
+ useEffect60(() => {
36150
36024
  if (!checkoutItem?.finalDollarValue || !checkoutConfig || !latestQuote || isQuoteLoading) {
36151
36025
  return;
36152
36026
  }
@@ -36181,7 +36055,7 @@ function useTrackDepositQuoteEvents({
36181
36055
  trackDepositQuoteDisplayed,
36182
36056
  walletAddress
36183
36057
  ]);
36184
- const trackQuoteConfirmed = useCallback48(() => {
36058
+ const trackQuoteConfirmed = useCallback47(() => {
36185
36059
  if (!checkoutItem?.finalDollarValue || !checkoutConfig || !latestQuote || isQuoteLoading) {
36186
36060
  return null;
36187
36061
  }
@@ -36334,7 +36208,7 @@ function ConfirmationStep({
36334
36208
  }
36335
36209
  }
36336
36210
  });
36337
- useEffect62(() => {
36211
+ useEffect61(() => {
36338
36212
  if (!isDirectWalletTransfer) {
36339
36213
  triggerNewQuote({ maxRetries: 1 });
36340
36214
  }
@@ -36508,7 +36382,7 @@ function ConfirmationStep({
36508
36382
  const hasStaticPrimaryInfoValue = isExactIn && checkoutItem?.inputFiatAmount != null || !isExactIn && !!checkoutConfig?.targetAssetAmount && isStablecoin(checkoutConfig.targetAssetTicker);
36509
36383
  const checkoutId = checkoutItem?.id;
36510
36384
  const isReady = !!checkoutItem?.finalDollarValue && !isQuoteLoading;
36511
- useEffect62(() => {
36385
+ useEffect61(() => {
36512
36386
  if (checkoutId && isReady) {
36513
36387
  logMeasuredEvent({
36514
36388
  eventName: "fc::ready::confirmation" /* READY_CONFIRMATION */,
@@ -36639,11 +36513,11 @@ function ConfirmationStep({
36639
36513
 
36640
36514
  // src/modals/CheckoutModal/InputAmount/InputAmount.tsx
36641
36515
  import { isMobile as isMobile7 } from "@funkit/utils";
36642
- import React221, { useEffect as useEffect66 } from "react";
36516
+ import React221, { useEffect as useEffect65 } from "react";
36643
36517
 
36644
36518
  // src/hooks/queries/useMeldCurrencies.ts
36645
36519
  import { getMeldSupportedFiat } from "@funkit/api-base";
36646
- import { useQuery as useQuery20 } from "@tanstack/react-query";
36520
+ import { useQuery as useQuery19 } from "@tanstack/react-query";
36647
36521
  var getPriority = (currencyCode) => {
36648
36522
  if (currencyCode === "USD") {
36649
36523
  return 0;
@@ -36655,7 +36529,7 @@ var getPriority = (currencyCode) => {
36655
36529
  };
36656
36530
  var useMeldCurrencies = (isEnabled = true) => {
36657
36531
  const { apiKey } = useFunkitConfig();
36658
- const query = useQuery20({
36532
+ const query = useQuery19({
36659
36533
  queryKey: ["meld", "currencies"],
36660
36534
  queryFn: async () => {
36661
36535
  if (!apiKey) {
@@ -36681,12 +36555,12 @@ var useMeldCurrencies = (isEnabled = true) => {
36681
36555
 
36682
36556
  // src/hooks/queries/useMeldDefaultCurrency.ts
36683
36557
  import { getMeldDefaultFiat } from "@funkit/api-base";
36684
- import { useQuery as useQuery21 } from "@tanstack/react-query";
36558
+ import { useQuery as useQuery20 } from "@tanstack/react-query";
36685
36559
  var useMeldDefaultCurrency = (paymentMethod) => {
36686
36560
  const { apiKey } = useFunkitConfig();
36687
36561
  const { userIpInfo } = useFunkitUserIp();
36688
36562
  const enableMeld = useIsMeldEnabled();
36689
- const query = useQuery21({
36563
+ const query = useQuery20({
36690
36564
  queryKey: ["meld", "defaultCurrency", paymentMethod],
36691
36565
  queryFn: async () => {
36692
36566
  if (!apiKey) {
@@ -36712,7 +36586,7 @@ var useMeldDefaultCurrency = (paymentMethod) => {
36712
36586
  // src/hooks/queries/useMeldLimits.ts
36713
36587
  import { getMeldFiatLimits } from "@funkit/api-base";
36714
36588
  import { formatCurrencyAndStringify as formatCurrencyAndStringify8 } from "@funkit/utils";
36715
- import { useQuery as useQuery22 } from "@tanstack/react-query";
36589
+ import { useQuery as useQuery21 } from "@tanstack/react-query";
36716
36590
 
36717
36591
  // src/hooks/useMinDeposit.ts
36718
36592
  import { getMeldMinDepositInCurrency } from "@funkit/connect-core";
@@ -36749,7 +36623,7 @@ var useMeldLimits = (isEnabled = true) => {
36749
36623
  const { userIpInfo } = useFunkitUserIp();
36750
36624
  const cryptoCurrency = useMeldCryptoCurrencyCode();
36751
36625
  const countryCode = userIpInfo?.alpha2;
36752
- const query = useQuery22({
36626
+ const query = useQuery21({
36753
36627
  queryKey: ["meld", "limits", countryCode, cryptoCurrency],
36754
36628
  queryFn: async () => {
36755
36629
  if (!apiKey || !countryCode) {
@@ -36843,18 +36717,18 @@ import {
36843
36717
  } from "@funkit/utils";
36844
36718
  import * as dnum10 from "dnum";
36845
36719
  import { motion as motion13 } from "motion/react";
36846
- import React219, { useEffect as useEffect65, useMemo as useMemo54, useState as useState70 } from "react";
36720
+ import React219, { useEffect as useEffect64, useMemo as useMemo54, useState as useState70 } from "react";
36847
36721
 
36848
36722
  // src/components/AnimatedWidthWrapper/AnimatedWidthWrapper.tsx
36849
36723
  import { motion as motion12 } from "motion/react";
36850
36724
  import React207 from "react";
36851
- import { useEffect as useEffect63, useRef as useRef31, useState as useState67 } from "react";
36725
+ import { useEffect as useEffect62, useRef as useRef31, useState as useState67 } from "react";
36852
36726
  function AnimatedWidthWrapper({ children }) {
36853
36727
  const containerRef = useRef31(null);
36854
36728
  const animationFrameRef = useRef31(null);
36855
36729
  const resizeObserverRef = useRef31(null);
36856
36730
  const [width, setWidth] = useState67("auto");
36857
- useEffect63(() => {
36731
+ useEffect62(() => {
36858
36732
  if (containerRef.current) {
36859
36733
  resizeObserverRef.current = new ResizeObserver((entries) => {
36860
36734
  animationFrameRef.current = requestAnimationFrame(() => {
@@ -36886,7 +36760,7 @@ function AnimatedWidthWrapper({ children }) {
36886
36760
  }
36887
36761
 
36888
36762
  // src/components/ApprovalMethodToggle/ApprovalMethodToggle.tsx
36889
- import React208, { useCallback as useCallback49, useMemo as useMemo51, useRef as useRef32 } from "react";
36763
+ import React208, { useCallback as useCallback48, useMemo as useMemo51, useRef as useRef32 } from "react";
36890
36764
  function ApprovalMethodToggle({
36891
36765
  value,
36892
36766
  onChange,
@@ -36905,7 +36779,7 @@ function ApprovalMethodToggle({
36905
36779
  ],
36906
36780
  [t]
36907
36781
  );
36908
- const handleSelect = useCallback49(
36782
+ const handleSelect = useCallback48(
36909
36783
  (next) => {
36910
36784
  if (!disabled && next !== value) {
36911
36785
  onChange(next);
@@ -37877,6 +37751,9 @@ var YouPayYouReceiveBottomBarLayoutWrapper = ({
37877
37751
  );
37878
37752
  };
37879
37753
 
37754
+ // src/modals/CheckoutModal/InputAmount/InputAmountLoaded.tsx
37755
+ import { safeBigInt as safeBigInt3 } from "@funkit/connect-core";
37756
+
37880
37757
  // src/components/Icons/SwitchIcon.tsx
37881
37758
  import React213 from "react";
37882
37759
  var SwitchIcon = () => {
@@ -38125,18 +38002,18 @@ var useCheckoutAmountLimits = ({
38125
38002
 
38126
38003
  // src/modals/CheckoutModal/InputAmount/useAmountInput.ts
38127
38004
  import {
38128
- useCallback as useCallback51,
38005
+ useCallback as useCallback50,
38129
38006
  useMemo as useMemo52,
38130
- useReducer as useReducer4,
38007
+ useReducer as useReducer3,
38131
38008
  useRef as useRef33,
38132
38009
  useState as useState69
38133
38010
  } from "react";
38134
38011
 
38135
38012
  // src/hooks/useTextMeasurer.ts
38136
- import { useCallback as useCallback50, useState as useState68 } from "react";
38013
+ import { useCallback as useCallback49, useState as useState68 } from "react";
38137
38014
  function useTextMeasurer(inputRef) {
38138
38015
  const [temp] = useState68(() => document.createElement("span"));
38139
- const measureText = useCallback50(
38016
+ const measureText = useCallback49(
38140
38017
  (text, fontSize) => {
38141
38018
  if (!inputRef.current) {
38142
38019
  return void 0;
@@ -38930,7 +38807,7 @@ var MAX_WIDTH = 310;
38930
38807
  function useAmountInput(options) {
38931
38808
  const { t } = useFunkitTranslation();
38932
38809
  const isMeldEnabled = useIsMeldEnabled();
38933
- const [state, dispatch] = useReducer4(reduceState, options, initializeState);
38810
+ const [state, dispatch] = useReducer3(reduceState, options, initializeState);
38934
38811
  const {
38935
38812
  unitPrice: realUnitPrice,
38936
38813
  checkoutConfig,
@@ -38980,7 +38857,7 @@ function useAmountInput(options) {
38980
38857
  const isCardCheckout = paymentMethodInfo.paymentMethod === PaymentMethod.CARD;
38981
38858
  const isMeldFlow = isCardCheckout && isMeldEnabled;
38982
38859
  const unitPrice = realUnitPrice;
38983
- const dispatchAndGetNewState = useCallback51(
38860
+ const dispatchAndGetNewState = useCallback50(
38984
38861
  (action) => {
38985
38862
  dispatch(action);
38986
38863
  return getDerivedState(
@@ -38996,7 +38873,7 @@ function useAmountInput(options) {
38996
38873
  }
38997
38874
  return attachInputNormalization(inputRef.current, inputDecimals, locale);
38998
38875
  }, [inputDecimals, locale, inputRef.current]);
38999
- const onChange = useCallback51(
38876
+ const onChange = useCallback50(
39000
38877
  (event) => {
39001
38878
  dispatch({
39002
38879
  type: "setInputValue",
@@ -39031,7 +38908,7 @@ function useAmountInput(options) {
39031
38908
  });
39032
38909
  }
39033
38910
  }, [defaultAmount]);
39034
- const setAssetAmount = useCallback51(
38911
+ const setAssetAmount = useCallback50(
39035
38912
  (assetAmount) => {
39036
38913
  const newState = dispatchAndGetNewState({
39037
38914
  type: "setAssetAmount",
@@ -39043,7 +38920,7 @@ function useAmountInput(options) {
39043
38920
  },
39044
38921
  [dispatchAndGetNewState, unitPrice]
39045
38922
  );
39046
- const setFiatAmount = useCallback51(
38923
+ const setFiatAmount = useCallback50(
39047
38924
  (fiatAmount) => {
39048
38925
  const newState = dispatchAndGetNewState({
39049
38926
  type: "setFiatAmount",
@@ -39055,7 +38932,7 @@ function useAmountInput(options) {
39055
38932
  },
39056
38933
  [dispatchAndGetNewState, unitPrice]
39057
38934
  );
39058
- const setTokenAmount = useCallback51(
38935
+ const setTokenAmount = useCallback50(
39059
38936
  (tokenAmountBaseUnit, frozenUnitPrice) => {
39060
38937
  const newState = dispatchAndGetNewState({
39061
38938
  type: "setTokenAmount",
@@ -39067,7 +38944,7 @@ function useAmountInput(options) {
39067
38944
  },
39068
38945
  [dispatchAndGetNewState]
39069
38946
  );
39070
- const toggleInputInFiat = useCallback51(() => {
38947
+ const toggleInputInFiat = useCallback50(() => {
39071
38948
  dispatch({ type: "toggleInputInFiat" });
39072
38949
  inputRef.current?.focus();
39073
38950
  }, []);
@@ -39090,7 +38967,7 @@ function useAmountInput(options) {
39090
38967
  }
39091
38968
 
39092
38969
  // src/modals/CheckoutModal/InputAmount/useMeld.tsx
39093
- import React218, { useCallback as useCallback52 } from "react";
38970
+ import React218, { useCallback as useCallback51 } from "react";
39094
38971
 
39095
38972
  // src/components/SourceMeldQuoteItem/SourceMeldQuoteItem.tsx
39096
38973
  import React217 from "react";
@@ -39361,10 +39238,10 @@ var useMeldLink = (sourceAmount, sourceCurrencyCode = "USD") => {
39361
39238
  // src/modals/CheckoutModal/MeldQuotes/useMeldQuotes.tsx
39362
39239
  import { getMeldQuotes } from "@funkit/api-base";
39363
39240
  import {
39364
- useQuery as useQuery23,
39365
- useQueryClient as useQueryClient7
39241
+ useQuery as useQuery22,
39242
+ useQueryClient as useQueryClient6
39366
39243
  } from "@tanstack/react-query";
39367
- import { useEffect as useEffect64, useMemo as useMemo53 } from "react";
39244
+ import { useEffect as useEffect63, useMemo as useMemo53 } from "react";
39368
39245
  import { useDebounce as useDebounce2 } from "use-debounce";
39369
39246
  var DEBOUNCE_DELAY = 500;
39370
39247
  var COUNTDOWN_INTERVAL_SEC = 60;
@@ -39376,7 +39253,7 @@ var useMeldQuotes = (sourceAmount, fiatCurrency, meldEnabled = true) => {
39376
39253
  const { isAway } = useUserPresence();
39377
39254
  const { checkoutItem } = useCheckoutContext();
39378
39255
  const { trackDepositMeldQuoteDisplayed } = useDepositAnalytics();
39379
- const queryClient = useQueryClient7();
39256
+ const queryClient = useQueryClient6();
39380
39257
  const checkoutId = checkoutItem?.id ?? null;
39381
39258
  const destinationCurrencyCode = useMeldCryptoCurrencyCode();
39382
39259
  const sourceCurrencyCode = fiatCurrency || "USD";
@@ -39400,7 +39277,7 @@ var useMeldQuotes = (sourceAmount, fiatCurrency, meldEnabled = true) => {
39400
39277
  walletAddress
39401
39278
  ]
39402
39279
  );
39403
- const query = useQuery23({
39280
+ const query = useQuery22({
39404
39281
  queryKey,
39405
39282
  queryFn: async () => {
39406
39283
  if (!userIpInfo || !apiKey || !destinationCurrencyCode || debouncedSourceAmount === void 0) {
@@ -39435,7 +39312,7 @@ var useMeldQuotes = (sourceAmount, fiatCurrency, meldEnabled = true) => {
39435
39312
  autoRestart: true
39436
39313
  });
39437
39314
  const isOutdated = sourceAmount !== debouncedSourceAmount;
39438
- useEffect64(() => {
39315
+ useEffect63(() => {
39439
39316
  if (!checkoutId || isOutdated || query.isFetching || !query.isFetchedAfterMount || !query.data) {
39440
39317
  return;
39441
39318
  }
@@ -39553,7 +39430,7 @@ function useMeld(meldEnabled, manuallySelectedQuote, usdAmount, fiatCurrency) {
39553
39430
  (quote) => quote.serviceProvider === selectedQuote?.serviceProvider
39554
39431
  );
39555
39432
  const isMeldContinueDisabled = meldEnabled && (!!meldLimitError || isMeldLinkPending || !!meldQuotesQuery.error || meldQuotesQuery.isFetching || isSelectedQuoteUnavailable);
39556
- const getMeldError = useCallback52(
39433
+ const getMeldError = useCallback51(
39557
39434
  function getMeldError2() {
39558
39435
  if (isSelectedQuoteUnavailable) {
39559
39436
  return {
@@ -39611,7 +39488,7 @@ function InputAmountLoaded({
39611
39488
  }) {
39612
39489
  const { t } = useFunkitTranslation();
39613
39490
  const { apiKey } = useFunkitConfig();
39614
- const gasUnits = safeBigInt(
39491
+ const gasUnits = safeBigInt3(
39615
39492
  useDynamicConfig("checkoutgasbufferunits"),
39616
39493
  BigInt(fallbackDynamicConfigs.checkoutgasbufferunits.value)
39617
39494
  );
@@ -39653,7 +39530,7 @@ function InputAmountLoaded({
39653
39530
  const isExactIn = quoteBuilder.isExactIn();
39654
39531
  const sourceTokenKey = sourceHolding?.chainSymbolKey;
39655
39532
  const sourceTokenChanged = modalState.sourceTokenKey != null && modalState.sourceTokenKey !== sourceTokenKey;
39656
- useEffect65(() => {
39533
+ useEffect64(() => {
39657
39534
  if (sourceTokenChanged) {
39658
39535
  setAmountSelection({ selectType: "default", presetAmount: null });
39659
39536
  }
@@ -39720,7 +39597,7 @@ function InputAmountLoaded({
39720
39597
  }
39721
39598
  return setFiatAmount(selectedFiat);
39722
39599
  }
39723
- useEffect65(() => {
39600
+ useEffect64(() => {
39724
39601
  if (isInputInFiat !== modalState.isInputInFiat || fiatAmount !== modalState.fiatAmount || assetAmount !== modalState.assetAmount || sourceTokenKey !== modalState.sourceTokenKey || amountSelection.selectType !== modalState.amountSelection?.selectType || amountSelection.presetAmount !== modalState.amountSelection?.presetAmount) {
39725
39602
  setModalState((state) => ({
39726
39603
  ...state,
@@ -40540,10 +40417,10 @@ function InputAmount(props) {
40540
40417
  query: { enabled: gasFetchingEnabled }
40541
40418
  });
40542
40419
  const isLoaded = !!(checkoutItem && unitPrice && !sourceHoldingError && !isLoadingSourceHolding && !isMeldDefaultCurrencyLoading && (!gasFetchingEnabled || gasPriceWei !== void 0));
40543
- useEffect66(() => setCheckoutQuote(null), []);
40420
+ useEffect65(() => setCheckoutQuote(null), []);
40544
40421
  const checkoutId = checkoutItem?.id;
40545
40422
  const paymentMethod = paymentMethodInfo.paymentMethod;
40546
- useEffect66(() => {
40423
+ useEffect65(() => {
40547
40424
  if (checkoutId && isLoaded) {
40548
40425
  logMeasuredEvent({
40549
40426
  eventName: "fc::ready::input_amount" /* READY_INPUT_AMOUNT */,
@@ -40576,25 +40453,25 @@ function InputAmount(props) {
40576
40453
  }
40577
40454
 
40578
40455
  // src/modals/CheckoutModal/LightningInvoice/LightningInvoice.tsx
40579
- import React226, { useEffect as useEffect69 } from "react";
40456
+ import React226, { useEffect as useEffect68 } from "react";
40580
40457
  import { createPortal as createPortal17 } from "react-dom";
40581
40458
 
40582
40459
  // src/components/CopyAddress/CopyInputDisplayedAddress.tsx
40583
40460
  import { truncateMiddleOfAddress } from "@funkit/utils";
40584
- import React222, { useCallback as useCallback54, useState as useState72 } from "react";
40461
+ import React222, { useCallback as useCallback53, useState as useState72 } from "react";
40585
40462
 
40586
40463
  // src/hooks/useCopyToClipboard.ts
40587
- import { useCallback as useCallback53, useEffect as useEffect67, useState as useState71 } from "react";
40464
+ import { useCallback as useCallback52, useEffect as useEffect66, useState as useState71 } from "react";
40588
40465
  var useCopyToClipboard = (text, delay = 1500) => {
40589
40466
  const [isCopied, setCopied] = useState71(false);
40590
- const handleCopy = useCallback53(() => {
40467
+ const handleCopy = useCallback52(() => {
40591
40468
  if (!text) {
40592
40469
  return;
40593
40470
  }
40594
40471
  navigator.clipboard.writeText(text);
40595
40472
  setCopied(true);
40596
40473
  }, [text]);
40597
- useEffect67(() => {
40474
+ useEffect66(() => {
40598
40475
  if (!isCopied) {
40599
40476
  return;
40600
40477
  }
@@ -40630,7 +40507,7 @@ function CopyInputDisplayedAddressEN({
40630
40507
  const { handleCopy } = useCopyToClipboard(address);
40631
40508
  const [isActive, setIsActive] = useState72(null);
40632
40509
  const displayAddress = truncateAddress ? truncateMiddleOfAddress(address, 40, 24, 8) : address;
40633
- const handleClick = useCallback54(() => {
40510
+ const handleClick = useCallback53(() => {
40634
40511
  if (isActive) {
40635
40512
  return;
40636
40513
  }
@@ -40687,7 +40564,7 @@ function CopyInputDisplayedAddressI18n({
40687
40564
  const copyLabel = label === "invoice" ? t("common.copyInvoice") : t("common.copyAddress");
40688
40565
  const buttonText = isActive ? t("common.copied") : copyLabel;
40689
40566
  const displayAddress = truncateAddress ? truncateMiddleOfAddress(address, 40, 24, 8) : address;
40690
- const handleClick = useCallback54(() => {
40567
+ const handleClick = useCallback53(() => {
40691
40568
  if (isActive) {
40692
40569
  return;
40693
40570
  }
@@ -40720,8 +40597,8 @@ import {
40720
40597
  } from "@funkit/api-base";
40721
40598
  import { LIGHTNING_MAINNET_CHAIN_ID, bitcoinChain as bitcoinChain4 } from "@funkit/chains";
40722
40599
  import { getAssetPriceInfoWithFallback as getAssetPriceInfoWithFallback2 } from "@funkit/connect-core";
40723
- import { keepPreviousData as keepPreviousData3, useQuery as useQuery24 } from "@tanstack/react-query";
40724
- import { useEffect as useEffect68, useRef as useRef34, useState as useState73 } from "react";
40600
+ import { keepPreviousData as keepPreviousData3, useQuery as useQuery23 } from "@tanstack/react-query";
40601
+ import { useEffect as useEffect67, useRef as useRef34, useState as useState73 } from "react";
40725
40602
  import { parseUnits as parseUnits5 } from "viem";
40726
40603
  var QUOTE_REFRESH_LEAD_MS = 3e3;
40727
40604
  var QUOTE_REFRESH_MIN_MS = 250;
@@ -40739,7 +40616,7 @@ function useDeferredQuote(latestQuote) {
40739
40616
  const [displayedQuote, setDisplayedQuote] = useState73(latestQuote);
40740
40617
  const latestQuoteRef = useRef34(latestQuote);
40741
40618
  latestQuoteRef.current = latestQuote;
40742
- useEffect68(() => {
40619
+ useEffect67(() => {
40743
40620
  if (!displayedQuote) {
40744
40621
  if (latestQuote) {
40745
40622
  setDisplayedQuote(latestQuote);
@@ -40764,7 +40641,7 @@ var useLightningQuote = ({
40764
40641
  }) => {
40765
40642
  const { apiKey } = useFunkitConfig();
40766
40643
  const enabled = !!depositAddr && !!targetChain && !!targetAsset && !!walletAddress && !!fiatAmount;
40767
- const query = useQuery24({
40644
+ const query = useQuery23({
40768
40645
  queryKey: [
40769
40646
  "lightning-quote",
40770
40647
  depositAddr,
@@ -41130,7 +41007,7 @@ function LightningInvoice(props) {
41130
41007
  isHidden: isLoading || !!error,
41131
41008
  isPaused: isLoading || !!error
41132
41009
  });
41133
- useEffect69(() => {
41010
+ useEffect68(() => {
41134
41011
  if (expiresAtMs !== void 0) {
41135
41012
  restartCountdown();
41136
41013
  }
@@ -41185,7 +41062,7 @@ function LightningInvoice(props) {
41185
41062
  }
41186
41063
 
41187
41064
  // src/modals/CheckoutModal/LoadingAccount.tsx
41188
- import React235, { useEffect as useEffect70 } from "react";
41065
+ import React235, { useEffect as useEffect69 } from "react";
41189
41066
 
41190
41067
  // src/components/FunAsset/FunAssetLoading.tsx
41191
41068
  import React228 from "react";
@@ -41934,7 +41811,7 @@ function LoadingAccount({
41934
41811
  const hasCustomStartingStep = !!checkoutConfig?.startingStep;
41935
41812
  const startsOnConfirmationStep = checkoutConfig?.startingStep === "confirmation" /* CONFIRMATION */;
41936
41813
  const startsOnSelectAssetStep = checkoutConfig?.startingStep === "select_asset" /* SELECT_ASSET */;
41937
- useEffect70(() => {
41814
+ useEffect69(() => {
41938
41815
  if (isLoadingFiat || !checkoutConfig) {
41939
41816
  return;
41940
41817
  }
@@ -42268,7 +42145,7 @@ function MeldRedirect({
42268
42145
  import { etherealChain, hyperEvmChain as hyperEvmChain3 } from "@funkit/chains";
42269
42146
  import { isTokenEquivalent as isTokenEquivalent12 } from "@funkit/utils";
42270
42147
  import React242, {
42271
- useEffect as useEffect71,
42148
+ useEffect as useEffect70,
42272
42149
  useLayoutEffect as useLayoutEffect2,
42273
42150
  useMemo as useMemo61,
42274
42151
  useState as useState75
@@ -42661,7 +42538,7 @@ function useAssetOptions({
42661
42538
  return assetOptions;
42662
42539
  }
42663
42540
  function useScrollToSelectedAsset(selectedChainTokenSymbol) {
42664
- useEffect71(() => {
42541
+ useEffect70(() => {
42665
42542
  const optionEl = document.getElementById(
42666
42543
  `option-${selectedChainTokenSymbol}`
42667
42544
  );
@@ -42858,7 +42735,7 @@ function AccountSelectAsset({
42858
42735
  const isDisabled = isAssetsEmpty || !selectedChainTokenSymbol || isLoading;
42859
42736
  const onBalanceTopUpSwitch = checkoutItem?.initSettings.onBalanceTopUpSwitch;
42860
42737
  const checkoutId = checkoutItem?.id;
42861
- useEffect71(() => {
42738
+ useEffect70(() => {
42862
42739
  if (checkoutId && !isLoading) {
42863
42740
  logMeasuredEvent({
42864
42741
  eventName: "fc::ready::select_asset" /* READY_SELECT_ASSET */,
@@ -43023,7 +42900,7 @@ import {
43023
42900
  resolveWithdrawalSourceTokenBalance as resolveWithdrawalSourceTokenBalance4
43024
42901
  } from "@funkit/connect-core";
43025
42902
  import { isTokenEquivalent as isTokenEquivalent13, noop as noop6 } from "@funkit/utils";
43026
- import React251, { useEffect as useEffect74, useMemo as useMemo62, useRef as useRef36, useState as useState76 } from "react";
42903
+ import React251, { useEffect as useEffect73, useMemo as useMemo62, useRef as useRef36, useState as useState76 } from "react";
43027
42904
  import { createPortal as createPortal21 } from "react-dom";
43028
42905
 
43029
42906
  // src/components/Dropdown/ReceiveTokenDropdown.tsx
@@ -43131,13 +43008,13 @@ function useIsUserUnderComplianceReview() {
43131
43008
  }
43132
43009
 
43133
43010
  // src/modals/CheckoutModal/SourceChange/ComplianceReviewBanner.tsx
43134
- import React244, { useEffect as useEffect72 } from "react";
43011
+ import React244, { useEffect as useEffect71 } from "react";
43135
43012
  function ComplianceReviewBanner({
43136
43013
  checkoutId
43137
43014
  }) {
43138
43015
  const { t } = useFunkitTranslation();
43139
43016
  const { logEvent } = useTrack();
43140
- useEffect72(() => {
43017
+ useEffect71(() => {
43141
43018
  logEvent({
43142
43019
  eventName: "fc::compliance_review::banner_shown" /* COMPLIANCE_REVIEW_BANNER_SHOWN */,
43143
43020
  metadata: { checkoutId }
@@ -43300,7 +43177,7 @@ function GroupedList({
43300
43177
 
43301
43178
  // src/modals/CheckoutModal/SourceChange/PayPal.tsx
43302
43179
  import { MeldServiceProvider as MeldServiceProvider2 } from "@funkit/api-base";
43303
- import React248, { useCallback as useCallback55 } from "react";
43180
+ import React248, { useCallback as useCallback54 } from "react";
43304
43181
  function PayPal() {
43305
43182
  const { apiKey } = useFunkitConfig();
43306
43183
  const { data: defaultCurrency } = useMeldDefaultCurrency(PaymentMethod.CARD);
@@ -43312,7 +43189,7 @@ function PayPal() {
43312
43189
  const isMeldEnabled = useIsMeldEnabled();
43313
43190
  const { checkoutItem } = useCheckoutContext();
43314
43191
  const isPaypalReady = false;
43315
- const onClick = useCallback55(() => {
43192
+ const onClick = useCallback54(() => {
43316
43193
  if (isMeldEnabled && isPaypalReady) {
43317
43194
  openMeldPopup(() => mutateAsync(MeldServiceProvider2.PAYPAL));
43318
43195
  } else {
@@ -43456,10 +43333,10 @@ function SourceList({
43456
43333
 
43457
43334
  // src/hooks/useStartBitcoinLightning.ts
43458
43335
  import { lightningChain as lightningChain3 } from "@funkit/chains";
43459
- import { useCallback as useCallback56 } from "react";
43336
+ import { useCallback as useCallback55 } from "react";
43460
43337
  function useStartBitcoinLightning() {
43461
43338
  const { updateSelectedPaymentMethodInfo, updateSourceAsset } = useCheckoutContext();
43462
- return useCallback56(() => {
43339
+ return useCallback55(() => {
43463
43340
  const paymentMethodInfo = createPaymentMethodInfo({
43464
43341
  paymentMethod: PaymentMethod.BITCOIN_LIGHTNING
43465
43342
  });
@@ -43475,7 +43352,7 @@ function useStartBitcoinLightning() {
43475
43352
  }
43476
43353
 
43477
43354
  // src/modals/CheckoutModal/SourceChange/useTrackSourceChangeEvents.ts
43478
- import { useEffect as useEffect73, useRef as useRef35 } from "react";
43355
+ import { useEffect as useEffect72, useRef as useRef35 } from "react";
43479
43356
  function useTrackSourceChangeEvents({
43480
43357
  tab
43481
43358
  }) {
@@ -43508,7 +43385,7 @@ function useTrackSourceChangeEvents({
43508
43385
  }));
43509
43386
  });
43510
43387
  const checkoutId = checkoutItem?.id;
43511
- useEffect73(() => {
43388
+ useEffect72(() => {
43512
43389
  if (checkoutId && claimAnalyticsEvent("fc_modal_opened" /* MODAL_OPENED */, checkoutId)) {
43513
43390
  trackModalOpened();
43514
43391
  }
@@ -43801,7 +43678,7 @@ function SourceChange({
43801
43678
  const showTagline = useDynamicConfig("showpoweredtagline");
43802
43679
  const hasBottomBar = showTagline || !isAutoContinue || bottomBarCloseButtonConfig.enabled;
43803
43680
  useSwappedPreload(fopsData?.data, "deposit");
43804
- useEffect74(() => {
43681
+ useEffect73(() => {
43805
43682
  const nextWithdrawalConfig = shouldSeedSourceChangeWithdrawalConfig ? resolvedWithdrawalConfig : void 0;
43806
43683
  setModalState((state) => {
43807
43684
  if (state.withdrawalConfig === nextWithdrawalConfig) {
@@ -43817,7 +43694,7 @@ function SourceChange({
43817
43694
  setModalState,
43818
43695
  shouldSeedSourceChangeWithdrawalConfig
43819
43696
  ]);
43820
- useEffect74(() => {
43697
+ useEffect73(() => {
43821
43698
  if (!paymentMethodInfo) {
43822
43699
  return;
43823
43700
  }
@@ -43933,7 +43810,7 @@ function SourceChange({
43933
43810
  )
43934
43811
  );
43935
43812
  });
43936
- useEffect74(() => {
43813
+ useEffect73(() => {
43937
43814
  sendPaymentMethodTabEvent(paymentMethodTab);
43938
43815
  }, [paymentMethodTab, sendPaymentMethodTabEvent]);
43939
43816
  const analyticsTab = isSwappedEnabled ? paymentMethodTab : null;
@@ -44368,8 +44245,8 @@ function trackEventForTabChange(checkoutItem, tab) {
44368
44245
  }
44369
44246
 
44370
44247
  // src/modals/CheckoutModal/SwappedIframe/SwappedIframeController.tsx
44371
- import { useQueryClient as useQueryClient8 } from "@tanstack/react-query";
44372
- import React252, { useEffect as useEffect75, useRef as useRef37 } from "react";
44248
+ import { useQueryClient as useQueryClient7 } from "@tanstack/react-query";
44249
+ import React252, { useEffect as useEffect74, useRef as useRef37 } from "react";
44373
44250
  import { createPortal as createPortal22 } from "react-dom";
44374
44251
  var SwappedIframeInfo = {
44375
44252
  Component: SwappedIframeController,
@@ -44402,7 +44279,7 @@ function SwappedIframeController({
44402
44279
  }) {
44403
44280
  const { logEvent, logMeasuredEvent, startMeasuredEvent } = useTrack();
44404
44281
  const { t } = useFunkitTranslation();
44405
- const queryClient = useQueryClient8();
44282
+ const queryClient = useQueryClient7();
44406
44283
  const successCallbackScheduledRef = useRef37(false);
44407
44284
  const { checkoutItem, resetForNewDeposit } = useCheckoutContext();
44408
44285
  const bottomSectionRef = useBottomSectionRef();
@@ -44424,10 +44301,10 @@ function SwappedIframeController({
44424
44301
  metadata: {}
44425
44302
  });
44426
44303
  });
44427
- useEffect75(() => {
44304
+ useEffect74(() => {
44428
44305
  startMeasuredEvent("fc::ready::swapped_iframe" /* READY_SWAPPED_IFRAME */);
44429
44306
  }, [startMeasuredEvent]);
44430
- useEffect75(() => {
44307
+ useEffect74(() => {
44431
44308
  if (isSwappedReady) {
44432
44309
  const event = getTrackEvent("fc::ready::swapped_iframe" /* READY_SWAPPED_IFRAME */);
44433
44310
  logger.info("swapped-iframe:ready", event.metadata);
@@ -44592,7 +44469,7 @@ function SwappedIframeController({
44592
44469
  }
44593
44470
  }
44594
44471
  }
44595
- useEffect75(() => {
44472
+ useEffect74(() => {
44596
44473
  return swappedTransport.onMessage(handleSwappedMessage);
44597
44474
  }, [swappedTransport, handleSwappedMessage]);
44598
44475
  useSwappedIframeLifecycle({
@@ -45130,7 +45007,7 @@ var TransferTokenDetails = ({
45130
45007
  };
45131
45008
 
45132
45009
  // src/modals/CheckoutModal/TransferToken/useTransferTokenTracking.ts
45133
- import { useCallback as useCallback57, useEffect as useEffect76, useRef as useRef38, useState as useState78 } from "react";
45010
+ import { useCallback as useCallback56, useEffect as useEffect75, useRef as useRef38, useState as useState78 } from "react";
45134
45011
 
45135
45012
  // src/modals/CheckoutModal/TransferToken/CheckoutNotifications.track.ts
45136
45013
  function getNotificationId(item) {
@@ -45238,7 +45115,7 @@ function useTransferTokenTracking({
45238
45115
  const nextInteractionIdRef = useRef38(0);
45239
45116
  const lastEmittedInteractionIdRef = useRef38(0);
45240
45117
  const interactionCountRef = useRef38(0);
45241
- const queueTransferInteraction = useCallback57(
45118
+ const queueTransferInteraction = useCallback56(
45242
45119
  (interaction) => {
45243
45120
  const id = nextInteractionIdRef.current + 1;
45244
45121
  nextInteractionIdRef.current = id;
@@ -45246,7 +45123,7 @@ function useTransferTokenTracking({
45246
45123
  },
45247
45124
  []
45248
45125
  );
45249
- useEffect76(() => {
45126
+ useEffect75(() => {
45250
45127
  if (!pendingInteraction || pendingInteraction.expectedSourceChain !== fromChainId || pendingInteraction.expectedSourceTicker !== fromTokenSymbol || !fromTokenAddress || !depositAddress || !targetChainId || !targetTokenAddress || lastEmittedInteractionIdRef.current >= pendingInteraction.id) {
45251
45128
  return;
45252
45129
  }
@@ -45285,7 +45162,7 @@ function useTransferTokenTracking({
45285
45162
  targetTokenSymbol,
45286
45163
  trackDepositTransferInteracted
45287
45164
  ]);
45288
- useEffect76(() => {
45165
+ useEffect75(() => {
45289
45166
  if (depositAddress && fromChainId && toChainId && toTokenAddress) {
45290
45167
  setTokenTransferAddressShownAtMs({
45291
45168
  fromChainId,
@@ -45294,7 +45171,7 @@ function useTransferTokenTracking({
45294
45171
  });
45295
45172
  }
45296
45173
  }, [depositAddress, fromChainId, toChainId, toTokenAddress]);
45297
- const trackAddressCopied = useCallback57(() => {
45174
+ const trackAddressCopied = useCallback56(() => {
45298
45175
  logEvent({
45299
45176
  eventName: "fc::deposit::transfer::address::copied" /* DEPOSIT_TRANSFER_ADDRESS_COPIED */,
45300
45177
  metadata: {
@@ -45311,7 +45188,7 @@ function useTransferTokenTracking({
45311
45188
  });
45312
45189
  }
45313
45190
  }, [fromChainId, fromTokenSymbol, logEvent, queueTransferInteraction]);
45314
- const trackImpactExpanded = useCallback57(
45191
+ const trackImpactExpanded = useCallback56(
45315
45192
  (estPriceImpactPct) => {
45316
45193
  logEvent({
45317
45194
  eventName: "fc::deposit::transfer::impact::viewed" /* DEPOSIT_TRANSFER_IMPACT_VIEWED */,
@@ -45324,7 +45201,7 @@ function useTransferTokenTracking({
45324
45201
  },
45325
45202
  [fromChainId, fromTokenSymbol, logEvent]
45326
45203
  );
45327
- const trackSourceChainChange = useCallback57(
45204
+ const trackSourceChainChange = useCallback56(
45328
45205
  (newChainId, newTokenSymbol, shouldQueueInteraction = true) => {
45329
45206
  if (newChainId === fromChainId) {
45330
45207
  return;
@@ -45358,7 +45235,7 @@ function useTransferTokenTracking({
45358
45235
  queueTransferInteraction
45359
45236
  ]
45360
45237
  );
45361
- const trackSourceTokenChange = useCallback57(
45238
+ const trackSourceTokenChange = useCallback56(
45362
45239
  (newTokenSymbol, newChainId, shouldQueueInteraction = true) => {
45363
45240
  const isSameResolvedSource = newChainId !== void 0 && newTokenSymbol === fromTokenSymbol && String(newChainId) === fromChainId;
45364
45241
  if (newTokenSymbol !== fromTokenSymbol) {
@@ -45443,7 +45320,7 @@ function useNotificationTracking({
45443
45320
  itemRef.current = item;
45444
45321
  statusRef.current = status;
45445
45322
  const id = item ? getNotificationId(item) : null;
45446
- useEffect76(() => {
45323
+ useEffect75(() => {
45447
45324
  if (!id || !itemRef.current) {
45448
45325
  depositNotificationDisplayRef.current = null;
45449
45326
  return;
@@ -45489,7 +45366,7 @@ function useNotificationTracking({
45489
45366
  notificationDisplayedAtRef.current = null;
45490
45367
  };
45491
45368
  }, [id, logEvent, trackDepositNotificationDisplayed]);
45492
- useEffect76(() => {
45369
+ useEffect75(() => {
45493
45370
  if (!itemRef.current || !notificationDisplayedAtRef.current) {
45494
45371
  return;
45495
45372
  }
@@ -45508,7 +45385,7 @@ function useNotificationTracking({
45508
45385
  }
45509
45386
  }
45510
45387
  }, [logEvent, status]);
45511
- const trackDismissal = useCallback57(() => {
45388
+ const trackDismissal = useCallback56(() => {
45512
45389
  if (!itemRef.current || !notificationDisplayedAtRef.current) {
45513
45390
  return;
45514
45391
  }
@@ -45529,7 +45406,7 @@ function useNotificationTracking({
45529
45406
  }
45530
45407
  reasonRef.current = "dismissed";
45531
45408
  }, [logEvent, trackDepositNotificationInteracted]);
45532
- const trackShowMore = useCallback57(() => {
45409
+ const trackShowMore = useCallback56(() => {
45533
45410
  if (!itemRef.current || !notificationDisplayedAtRef.current) {
45534
45411
  return;
45535
45412
  }
@@ -46417,9 +46294,9 @@ var FiatAccountDetail = {
46417
46294
 
46418
46295
  // src/modals/CheckoutModal/VirtualFiatAccount/KycIframe.tsx
46419
46296
  import { BridgeCustomerStatus as BridgeCustomerStatus7 } from "@funkit/api-base";
46420
- import React267, { useCallback as useCallback58, useEffect as useEffect77, useMemo as useMemo63, useState as useState81 } from "react";
46297
+ import React267, { useCallback as useCallback57, useEffect as useEffect76, useMemo as useMemo63, useState as useState81 } from "react";
46421
46298
  function useIframeListener(listeners, expectedOrigin) {
46422
- const handleMessage = useCallback58(
46299
+ const handleMessage = useCallback57(
46423
46300
  (event) => {
46424
46301
  if (!expectedOrigin || event.origin !== expectedOrigin) {
46425
46302
  return;
@@ -46444,7 +46321,7 @@ function useIframeListener(listeners, expectedOrigin) {
46444
46321
  },
46445
46322
  [listeners, expectedOrigin]
46446
46323
  );
46447
- useEffect77(() => {
46324
+ useEffect76(() => {
46448
46325
  window.addEventListener("message", handleMessage);
46449
46326
  return () => {
46450
46327
  window.removeEventListener("message", handleMessage);
@@ -46745,10 +46622,10 @@ function useCheckoutModalTransition(checkoutItem, onClose) {
46745
46622
  ensureStepQueries(modalState.step);
46746
46623
  }
46747
46624
  });
46748
- useEffect78(() => {
46625
+ useEffect77(() => {
46749
46626
  ensureLoadingAccountScreen();
46750
46627
  }, [ensureLoadingAccountScreen]);
46751
- const trackNextState = useCallback59(
46628
+ const trackNextState = useCallback58(
46752
46629
  (nextState) => {
46753
46630
  const trackEvent = trackEventFromNextState(nextState);
46754
46631
  if (trackEvent) {
@@ -46764,7 +46641,7 @@ function useCheckoutModalTransition(checkoutItem, onClose) {
46764
46641
  const { clearCheckoutQuoteMessages } = useCheckoutQuoteNotification();
46765
46642
  const { getCheckoutProgress } = useCheckoutContext();
46766
46643
  const { softHide } = useSoftHiddenCheckout();
46767
- const onCloseWrapper = useCallback59(
46644
+ const onCloseWrapper = useCallback58(
46768
46645
  (options) => {
46769
46646
  const normalizedIsNewDeposit = !!options?.isNewDeposit;
46770
46647
  const metadata = {
@@ -46808,7 +46685,7 @@ function useCheckoutModalTransition(checkoutItem, onClose) {
46808
46685
  const [stateHistory, setHistory] = useState82([]);
46809
46686
  const prevStep = useRef40(null);
46810
46687
  const hasHistoryEntry = stateHistory.length > 1;
46811
- const onNext = useCallback59(
46688
+ const onNext = useCallback58(
46812
46689
  (payload) => {
46813
46690
  if (prevStep.current === modalState.step) {
46814
46691
  return;
@@ -46852,7 +46729,7 @@ function useCheckoutModalTransition(checkoutItem, onClose) {
46852
46729
  ensureStepQueries
46853
46730
  ]
46854
46731
  );
46855
- const onStepChange = useCallback59(
46732
+ const onStepChange = useCallback58(
46856
46733
  (nextState) => {
46857
46734
  if (prevStep.current === modalState.step) {
46858
46735
  return;
@@ -46867,7 +46744,7 @@ function useCheckoutModalTransition(checkoutItem, onClose) {
46867
46744
  },
46868
46745
  [modalState, animate, trackNextState, ensureStepQueries]
46869
46746
  );
46870
- const onBack = useCallback59(() => {
46747
+ const onBack = useCallback58(() => {
46871
46748
  clearCheckoutQuoteMessages();
46872
46749
  const backStepOverride = checkoutBackMap[modalState.step];
46873
46750
  const prevState = [...stateHistory].reverse().find((s) => s.step === backStepOverride) ?? stateHistory[stateHistory.length - 1];
@@ -46982,7 +46859,7 @@ function useCheckoutModalTitle(depositAddress, defaultTitle) {
46982
46859
  import { IN_PROGRESS_CHECKOUT_STATES as IN_PROGRESS_CHECKOUT_STATES2 } from "@funkit/api-base";
46983
46860
  import { formatTimestampToDate, fullMonthNames } from "@funkit/utils";
46984
46861
  import clsx23 from "clsx";
46985
- import React279, { useEffect as useEffect80, useMemo as useMemo64, useRef as useRef42, useState as useState84 } from "react";
46862
+ import React279, { useEffect as useEffect79, useMemo as useMemo64, useRef as useRef42, useState as useState84 } from "react";
46986
46863
  import { Virtuoso } from "react-virtuoso";
46987
46864
 
46988
46865
  // src/consts/layout.ts
@@ -47341,21 +47218,21 @@ var HomeTokenBalanceDisplayRowSkeleton = () => {
47341
47218
 
47342
47219
  // src/modals/ProfileDetails/FunProfileViews/Home/ProfileTitleSection.tsx
47343
47220
  import React278 from "react";
47344
- import { useCallback as useCallback60, useState as useState83 } from "react";
47221
+ import { useCallback as useCallback59, useState as useState83 } from "react";
47345
47222
 
47346
47223
  // src/components/FunSelect/FunClickOutside.tsx
47347
47224
  import React275 from "react";
47348
- import { useEffect as useEffect79, useRef as useRef41 } from "react";
47225
+ import { useEffect as useEffect78, useRef as useRef41 } from "react";
47349
47226
  function FunClickOutside({
47350
47227
  children,
47351
47228
  onClick
47352
47229
  }) {
47353
47230
  const wrapperRef = useRef41(null);
47354
- useEffect79(() => {
47231
+ const isShadowDomEnabled = useFeatureGate("enable-shadow-dom");
47232
+ useEffect78(() => {
47355
47233
  const handleClickListener = (event) => {
47356
- const clickedInside = wrapperRef.current?.contains(
47357
- event.target
47358
- );
47234
+ const wrapper = wrapperRef.current;
47235
+ const clickedInside = isShadowDomEnabled ? !!wrapper && event.composedPath().includes(wrapper) : wrapper?.contains(event.target);
47359
47236
  if (!clickedInside) {
47360
47237
  onClick();
47361
47238
  }
@@ -47364,7 +47241,7 @@ function FunClickOutside({
47364
47241
  return () => {
47365
47242
  document.removeEventListener("mousedown", handleClickListener);
47366
47243
  };
47367
- }, [onClick]);
47244
+ }, [onClick, isShadowDomEnabled]);
47368
47245
  return /* @__PURE__ */ React275.createElement("div", { ref: wrapperRef }, children);
47369
47246
  }
47370
47247
 
@@ -47434,7 +47311,7 @@ var ProfileTitleSection = ({
47434
47311
  }) => {
47435
47312
  const { t } = useFunkitTranslation();
47436
47313
  const [isDisconnectExpanded, setIsDisconnectExpanded] = useState83(false);
47437
- const collapseDisconnect = useCallback60(
47314
+ const collapseDisconnect = useCallback59(
47438
47315
  () => setIsDisconnectExpanded(false),
47439
47316
  []
47440
47317
  );
@@ -47534,7 +47411,7 @@ function Home({
47534
47411
  const { checkoutHistoryList, isCheckoutHistoryInited } = useCheckoutHistoryContext();
47535
47412
  const { returnViewPresets } = useActivityTraversal();
47536
47413
  const { animation: tabAnimation, navigateTo } = useAnimatedNavigation(setSelectedView);
47537
- useEffect80(() => {
47414
+ useEffect79(() => {
47538
47415
  const virtuosoDiv = virtuosoParentRef.current?.firstChild;
47539
47416
  virtuosoDiv?.classList.add(animateVirtuosoInClass);
47540
47417
  }, []);
@@ -47828,13 +47705,13 @@ function ProfileDetails({ onClose, defaultTab }) {
47828
47705
  DEFAULT_CHECKOUT_HISTORY_DETAIL_TITLE
47829
47706
  );
47830
47707
  const singleActivityPage = "detail" /* DETAIL */;
47831
- const resetView = useCallback61(() => {
47708
+ const resetView = useCallback60(() => {
47832
47709
  setView(returnView ?? 0 /* HOME */);
47833
47710
  setSelectedHomeTab("checkouts" /* CHECKOUTS */);
47834
47711
  resetActivityTraversal();
47835
47712
  }, [resetActivityTraversal, returnView]);
47836
47713
  const { animation, animate } = useAnimatedNavigation(void 0);
47837
- const onSelectActivityWrapper = useCallback61(
47714
+ const onSelectActivityWrapper = useCallback60(
47838
47715
  (activity) => {
47839
47716
  onSelectActivity({
47840
47717
  ...activity,
@@ -47864,7 +47741,7 @@ function ProfileDetails({ onClose, defaultTab }) {
47864
47741
  const isSingleActivityView = view === 3 /* SINGLE_ACTIVITY */;
47865
47742
  const isCheckoutDetailView = isSingleActivityView && singleActivityPage === "detail" /* DETAIL */;
47866
47743
  const withDivider = isSingleActivityView ? "always" : void 0;
47867
- const handleHelp = useCallback61(() => {
47744
+ const handleHelp = useCallback60(() => {
47868
47745
  window.open(CONTACT_US_LINK, "_blank", "noopener");
47869
47746
  }, []);
47870
47747
  const { onScroll, topbar, withTopDivider } = useCustomStatusAnimationAboveTopbar({
@@ -48264,13 +48141,13 @@ function ChainModal({ onClose, open }) {
48264
48141
  }
48265
48142
 
48266
48143
  // src/modals/CheckoutModal/FunCheckoutModal.tsx
48267
- import React303, { useEffect as useEffect89, useLayoutEffect as useLayoutEffect3, useRef as useRef45 } from "react";
48144
+ import React303, { useEffect as useEffect88, useLayoutEffect as useLayoutEffect3, useRef as useRef45 } from "react";
48268
48145
 
48269
48146
  // src/components/FunConnectOptions/FunConnectOptions.tsx
48270
- import React295, { useCallback as useCallback62, useMemo as useMemo65, useState as useState88 } from "react";
48147
+ import React295, { useCallback as useCallback61, useMemo as useMemo65, useState as useState88 } from "react";
48271
48148
 
48272
48149
  // src/components/FunConnectOptions/FunConnectResultStep.tsx
48273
- import React290, { useEffect as useEffect81 } from "react";
48150
+ import React290, { useEffect as useEffect80 } from "react";
48274
48151
  var AUTO_CLOSE = 2e3;
48275
48152
  var messageMap = (hasQrCode) => ({
48276
48153
  error: {
@@ -48289,7 +48166,7 @@ var FunConnectResultStep = ({
48289
48166
  qrCodeUri
48290
48167
  }) => {
48291
48168
  const hasAutoclose = type === "success";
48292
- useEffect81(() => {
48169
+ useEffect80(() => {
48293
48170
  if (!hasAutoclose) {
48294
48171
  return;
48295
48172
  }
@@ -48635,7 +48512,7 @@ function FunConnectOptions({
48635
48512
  const [step, setStep] = useState88(INITIAL_STEP);
48636
48513
  const [selectedWallet, setSelectedWallet] = useState88();
48637
48514
  const [qrCodeUri, setQrCodeUri] = useState88("");
48638
- const changeStep = useCallback62((newStep) => {
48515
+ const changeStep = useCallback61((newStep) => {
48639
48516
  setStep(newStep);
48640
48517
  if (isSignIn(newStep)) {
48641
48518
  setSelectedWallet(void 0);
@@ -48646,7 +48523,7 @@ function FunConnectOptions({
48646
48523
  navigateTo(0 /* SIGNIN_PRIMARY */, { reverse: true });
48647
48524
  };
48648
48525
  const walletConnectors = usePreparedWalletConnectors();
48649
- const onRegenerateQrCode = useCallback62(
48526
+ const onRegenerateQrCode = useCallback61(
48650
48527
  async (wallet) => {
48651
48528
  const sWallet = walletConnectors.find((w) => wallet.id === w.id);
48652
48529
  const uri = await sWallet?.getQrCodeUri?.();
@@ -48654,7 +48531,7 @@ function FunConnectOptions({
48654
48531
  },
48655
48532
  [walletConnectors]
48656
48533
  );
48657
- const connectToWallet = useCallback62(
48534
+ const connectToWallet = useCallback61(
48658
48535
  async (wallet) => {
48659
48536
  if (!wallet.ready) {
48660
48537
  return;
@@ -48673,7 +48550,7 @@ function FunConnectOptions({
48673
48550
  },
48674
48551
  [changeStep, onRegenerateQrCode]
48675
48552
  );
48676
- const handleRetry = useCallback62(() => {
48553
+ const handleRetry = useCallback61(() => {
48677
48554
  if (selectedWallet) {
48678
48555
  changeStep(1 /* PENDING_WALLET */);
48679
48556
  connectToWallet(selectedWallet);
@@ -48824,20 +48701,20 @@ var FunCheckoutBlocked = ({ reason }) => {
48824
48701
  };
48825
48702
 
48826
48703
  // src/modals/CheckoutModal/CheckoutModalPrefetchedHooks.tsx
48827
- import { useEffect as useEffect82 } from "react";
48704
+ import { useEffect as useEffect81 } from "react";
48828
48705
  function CheckoutModalPrefetchedHooks() {
48829
48706
  const { checkoutItem } = useCheckoutContext();
48830
48707
  const { address: walletAddress } = useAccount();
48831
48708
  const { setTargetAssetSupportsPermit, setTargetAssetPoolAllowance } = useQuoteContext();
48832
48709
  const aavePermitSupported = useAaveTargetReservePermit(checkoutItem);
48833
- useEffect82(() => {
48710
+ useEffect81(() => {
48834
48711
  setTargetAssetSupportsPermit(aavePermitSupported);
48835
48712
  }, [aavePermitSupported, setTargetAssetSupportsPermit]);
48836
48713
  const aavePoolAllowance = useAaveTargetPoolAllowance(
48837
48714
  checkoutItem,
48838
48715
  walletAddress
48839
48716
  );
48840
- useEffect82(() => {
48717
+ useEffect81(() => {
48841
48718
  setTargetAssetPoolAllowance(aavePoolAllowance);
48842
48719
  }, [aavePoolAllowance, setTargetAssetPoolAllowance]);
48843
48720
  return null;
@@ -48845,7 +48722,7 @@ function CheckoutModalPrefetchedHooks() {
48845
48722
 
48846
48723
  // src/modals/CheckoutModal/TransferToken/CheckoutNotifications.tsx
48847
48724
  import clsx26 from "clsx";
48848
- import React302, { useCallback as useCallback64, useEffect as useEffect87, useMemo as useMemo66, useState as useState90 } from "react";
48725
+ import React302, { useCallback as useCallback63, useEffect as useEffect86, useMemo as useMemo66, useState as useState90 } from "react";
48849
48726
 
48850
48727
  // src/components/FunNotificationBanner/FunNotificationShowMoreButton.tsx
48851
48728
  import React297 from "react";
@@ -48913,10 +48790,10 @@ var useRecentCheckouts = ({
48913
48790
 
48914
48791
  // src/hooks/useOnNewNotification.ts
48915
48792
  import { safeParseJson as safeParseJson2 } from "@funkit/utils";
48916
- import { useEffect as useEffect83 } from "react";
48793
+ import { useEffect as useEffect82 } from "react";
48917
48794
  var storageKey5 = "fkc-processed-notifications";
48918
48795
  var useOnNewNotification = (combinedNotifications, cb) => {
48919
- useEffect83(() => {
48796
+ useEffect82(() => {
48920
48797
  const alreadyProcessed = safeParseJsonObject(
48921
48798
  sessionStorage.getItem(storageKey5)
48922
48799
  );
@@ -48963,7 +48840,7 @@ import React300 from "react";
48963
48840
 
48964
48841
  // src/components/FunNotificationBanner/FunNotificationBanner.tsx
48965
48842
  import { AnimatePresence as AnimatePresence6, motion as motion19 } from "motion/react";
48966
- import React299, { useEffect as useEffect85, useRef as useRef44, useState as useState89 } from "react";
48843
+ import React299, { useEffect as useEffect84, useRef as useRef44, useState as useState89 } from "react";
48967
48844
  import clsx25 from "clsx";
48968
48845
 
48969
48846
  // src/components/FunNotificationBanner/FunNotificationBanner.css.ts
@@ -48973,7 +48850,7 @@ var showMoreButtonStyle = "_4yitd93 _1rsrm2f1r4 _1rsrm2f1i _1rsrm2f1f _1rsrm2f11
48973
48850
  // src/components/FunNotificationBanner/FunNotificationBannerIcon.tsx
48974
48851
  import clsx24 from "clsx";
48975
48852
  import { motion as motion18, useAnimate as useAnimate3 } from "motion/react";
48976
- import React298, { useCallback as useCallback63, useEffect as useEffect84, useRef as useRef43 } from "react";
48853
+ import React298, { useCallback as useCallback62, useEffect as useEffect83, useRef as useRef43 } from "react";
48977
48854
 
48978
48855
  // src/components/FunNotificationBanner/FunNotificationBannerIcon.css.ts
48979
48856
  var STATUS_SPINNER_BOTTOM_POSITION = -5;
@@ -49222,8 +49099,8 @@ var FunNotificationBannerIcon = ({
49222
49099
  fallbackIconUrl = FALLBACK_ASSET
49223
49100
  }) => {
49224
49101
  const [animationScope, animate] = useAnimate3();
49225
- const triggerAnimationProcessingToCompleted = useCallback63(async () => {
49226
- const completedIconPath = document.querySelector(
49102
+ const triggerAnimationProcessingToCompleted = useCallback62(async () => {
49103
+ const completedIconPath = animationScope.current?.querySelector(
49227
49104
  `.${generateAnimationPrefixClassName("icon-wrapper-completed")} path`
49228
49105
  );
49229
49106
  if (completedIconPath instanceof SVGPathElement) {
@@ -49328,8 +49205,8 @@ var FunNotificationBannerIcon = ({
49328
49205
  }
49329
49206
  )
49330
49207
  ]);
49331
- }, [animate]);
49332
- const triggerAnimationDelayedToFailed = useCallback63(async () => {
49208
+ }, [animate, animationScope]);
49209
+ const triggerAnimationDelayedToFailed = useCallback62(async () => {
49333
49210
  await Promise.all([
49334
49211
  animate(
49335
49212
  `.${generateAnimationPrefixClassName("icon-wrapper")}`,
@@ -49423,7 +49300,7 @@ var FunNotificationBannerIcon = ({
49423
49300
  ]);
49424
49301
  }, [animate]);
49425
49302
  const statusRef = useRef43(status);
49426
- useEffect84(() => {
49303
+ useEffect83(() => {
49427
49304
  if (statusRef.current !== status) {
49428
49305
  if (statusRef.current === "processing" && status === "completed") {
49429
49306
  triggerAnimationProcessingToCompleted();
@@ -49523,7 +49400,7 @@ var FunNotificationBanner = ({
49523
49400
  const [isOpen, setIsOpen] = useState89(true);
49524
49401
  const prevStatusRef = useRef44(status);
49525
49402
  const prevStatus = prevStatusRef.current;
49526
- useEffect85(() => {
49403
+ useEffect84(() => {
49527
49404
  prevStatusRef.current = status;
49528
49405
  }, [status]);
49529
49406
  const direction = status && prevStatus && prevStatus !== status && (STATUS_RANK[status] ?? 0) < (STATUS_RANK[prevStatus] ?? 0) ? -1 : 1;
@@ -49711,13 +49588,13 @@ var FunNotificationBanner = ({
49711
49588
  import {
49712
49589
  getCheckoutByDepositAddress as getCheckoutByDepositAddress2
49713
49590
  } from "@funkit/api-base";
49714
- import { useQuery as useQuery25 } from "@tanstack/react-query";
49591
+ import { useQuery as useQuery24 } from "@tanstack/react-query";
49715
49592
  var useCheckout = (depositAddress, initial) => {
49716
49593
  const { apiKey } = useFunkitConfig();
49717
49594
  const { itemRefresh } = useDynamicConfig(
49718
49595
  "checkoutnotificationsrefreshinterval"
49719
49596
  );
49720
- const query = useQuery25({
49597
+ const query = useQuery24({
49721
49598
  queryKey: ["checkouts", "checkout", depositAddress],
49722
49599
  queryFn: () => getCheckoutByDepositAddress2({
49723
49600
  // biome-ignore lint/style/noNonNullAssertion: already checked for null
@@ -50051,10 +49928,10 @@ var parseDisclaimer2 = (t, isRefunded, isDelayed2, isFailed, onHelp) => {
50051
49928
  };
50052
49929
 
50053
49930
  // src/modals/CheckoutModal/TransferToken/useTrackDepositNotificationEvents.ts
50054
- import { useEffect as useEffect86 } from "react";
49931
+ import { useEffect as useEffect85 } from "react";
50055
49932
  function useTrackDepositNotificationEvents(items) {
50056
49933
  const { trackExecutionProgressEvents } = useTrackExecutionProgressEvents("deposit");
50057
- useEffect86(() => {
49934
+ useEffect85(() => {
50058
49935
  for (const item of items) {
50059
49936
  trackExecutionProgressEvents(item);
50060
49937
  }
@@ -50081,13 +49958,13 @@ var CheckoutNotifications = ({
50081
49958
  }),
50082
49959
  [directExecutions, variant]
50083
49960
  );
50084
- useEffect87(() => {
49961
+ useEffect86(() => {
50085
49962
  if (initialCheckouts || !checkouts) {
50086
49963
  return;
50087
49964
  }
50088
49965
  setInitialCheckouts(checkouts);
50089
49966
  }, [initialCheckouts, checkouts]);
50090
- useEffect87(() => {
49967
+ useEffect86(() => {
50091
49968
  if (initialDirectExecutions || !directExecutions) {
50092
49969
  return;
50093
49970
  }
@@ -50127,7 +50004,7 @@ var CheckoutNotifications = ({
50127
50004
  }, [isExpanded, combinedNotifications]);
50128
50005
  const handleNotificationClose = (id) => setClosedNotifications((prev) => [...prev, id]);
50129
50006
  const { logEvent } = useTrack();
50130
- const handleNewNotification = useCallback64(
50007
+ const handleNewNotification = useCallback63(
50131
50008
  (item) => {
50132
50009
  const trackEvent = trackEventFromNotification(item);
50133
50010
  logEvent(trackEvent);
@@ -50203,7 +50080,7 @@ function selectSuccessScreenBackground({
50203
50080
  }
50204
50081
 
50205
50082
  // src/modals/CheckoutModal/useCheckoutBlocked.ts
50206
- import { useEffect as useEffect88 } from "react";
50083
+ import { useEffect as useEffect87 } from "react";
50207
50084
  var geoblockedViewableSteps = /* @__PURE__ */ new Set([
50208
50085
  "loading_account" /* LOADING_ACCOUNT */,
50209
50086
  "source_change" /* SOURCE_CHANGE */
@@ -50241,7 +50118,7 @@ function useCheckoutBlocked(params) {
50241
50118
  params.onCheckoutBlocked?.({ blockedReason: reason });
50242
50119
  }
50243
50120
  );
50244
- useEffect88(() => {
50121
+ useEffect87(() => {
50245
50122
  if (blockedReason) {
50246
50123
  onCheckoutBlockedEvent(blockedReason);
50247
50124
  }
@@ -50347,7 +50224,7 @@ function FunCheckoutModalInner({
50347
50224
  setModalState
50348
50225
  };
50349
50226
  const connectionStatus = useConnectionStatus();
50350
- useEffect89(() => {
50227
+ useEffect88(() => {
50351
50228
  if (!modalState.showWalletOptions) {
50352
50229
  return;
50353
50230
  }
@@ -50537,16 +50414,16 @@ function ConnectModal({ onClose, open }) {
50537
50414
  function useModalStateValue() {
50538
50415
  const [isModalOpen, setModalOpen] = useState91(false);
50539
50416
  return {
50540
- closeModal: useCallback65(() => setModalOpen(false), []),
50417
+ closeModal: useCallback64(() => setModalOpen(false), []),
50541
50418
  isModalOpen,
50542
- openModal: useCallback65(() => setModalOpen(true), [])
50419
+ openModal: useCallback64(() => setModalOpen(true), [])
50543
50420
  };
50544
50421
  }
50545
50422
  function useModalStateValueWithProp() {
50546
50423
  const [isModalOpen, setModalOpen] = useState91(false);
50547
50424
  const [prop, setProp] = useState91(null);
50548
50425
  return {
50549
- closeModal: useCallback65(() => {
50426
+ closeModal: useCallback64(() => {
50550
50427
  setTimeout(
50551
50428
  () => {
50552
50429
  setProp(null);
@@ -50557,7 +50434,7 @@ function useModalStateValueWithProp() {
50557
50434
  }, []),
50558
50435
  isModalOpen,
50559
50436
  prop,
50560
- openModal: useCallback65((prop2) => {
50437
+ openModal: useCallback64((prop2) => {
50561
50438
  if (prop2 != null) {
50562
50439
  setProp(prop2);
50563
50440
  }
@@ -50602,19 +50479,19 @@ function ModalProvider({ children }) {
50602
50479
  prop: funCheckoutModalId
50603
50480
  } = useModalStateValueWithProp();
50604
50481
  const [softHiddenCheckoutId, setSoftHiddenCheckoutId] = useState91(null);
50605
- const softHideFunCheckoutModal = useCallback65(() => {
50482
+ const softHideFunCheckoutModal = useCallback64(() => {
50606
50483
  if (funCheckoutModalId) {
50607
50484
  setSoftHiddenCheckoutId(funCheckoutModalId);
50608
50485
  }
50609
50486
  closeFunCheckoutModal();
50610
50487
  }, [funCheckoutModalId, closeFunCheckoutModal]);
50611
- const resumeSoftHiddenCheckout = useCallback65(() => {
50488
+ const resumeSoftHiddenCheckout = useCallback64(() => {
50612
50489
  if (softHiddenCheckoutId) {
50613
50490
  openFunCheckoutModal(softHiddenCheckoutId);
50614
50491
  setSoftHiddenCheckoutId(null);
50615
50492
  }
50616
50493
  }, [softHiddenCheckoutId, openFunCheckoutModal]);
50617
- const discardSoftHiddenCheckout = useCallback65(() => {
50494
+ const discardSoftHiddenCheckout = useCallback64(() => {
50618
50495
  setSoftHiddenCheckoutId(null);
50619
50496
  }, []);
50620
50497
  const {
@@ -50639,7 +50516,7 @@ function ModalProvider({ children }) {
50639
50516
  onConnect: () => closeModals(isUnauthenticated),
50640
50517
  onDisconnect: closeModals
50641
50518
  });
50642
- useEffect90(() => {
50519
+ useEffect89(() => {
50643
50520
  if (isUnauthenticated) {
50644
50521
  closeModals();
50645
50522
  }
@@ -50744,7 +50621,7 @@ function useConnectModal(onClose) {
50744
50621
  const { connectModalOpen, openConnectModal } = useContext20(ModalContext);
50745
50622
  const { isWalletConnectModalOpen } = useWalletConnectOpenState();
50746
50623
  const effectiveConnectModalOpen = connectModalOpen || isWalletConnectModalOpen;
50747
- useEffect90(() => {
50624
+ useEffect89(() => {
50748
50625
  if (!effectiveConnectModalOpen && onClose) {
50749
50626
  onClose();
50750
50627
  }
@@ -50884,19 +50761,19 @@ function FunkitCheckoutProvider({ children }) {
50884
50761
  activeCheckout?.initSettings.config?.dynamicRoutingId
50885
50762
  );
50886
50763
  const [checkoutsProgress, setCheckoutsProgress] = useState92({});
50887
- const getCheckoutProgress = useCallback66(
50764
+ const getCheckoutProgress = useCallback65(
50888
50765
  (checkoutId) => {
50889
50766
  return checkoutsProgress[checkoutId];
50890
50767
  },
50891
50768
  [checkoutsProgress]
50892
50769
  );
50893
- const setCheckoutProgress = useCallback66(
50770
+ const setCheckoutProgress = useCallback65(
50894
50771
  (checkoutId, progress) => {
50895
50772
  setCheckoutsProgress((data) => ({ ...data, [checkoutId]: progress }));
50896
50773
  },
50897
50774
  []
50898
50775
  );
50899
- useEffect91(() => {
50776
+ useEffect90(() => {
50900
50777
  if (isNotNullish7(logoutSymbol)) {
50901
50778
  setActiveCheckout(null);
50902
50779
  }
@@ -50912,7 +50789,7 @@ function FunkitCheckoutProvider({ children }) {
50912
50789
  });
50913
50790
  }
50914
50791
  );
50915
- const initNewWithdrawal = useCallback66(
50792
+ const initNewWithdrawal = useCallback65(
50916
50793
  (props, checkoutConfig) => {
50917
50794
  const { onWithdrawalConfirmation, onWithdrawalError, config } = props;
50918
50795
  const newWithdrawalId = uuid4();
@@ -50941,7 +50818,7 @@ function FunkitCheckoutProvider({ children }) {
50941
50818
  },
50942
50819
  [logEvent, startMeasuredEvent]
50943
50820
  );
50944
- const initNewCheckout = useCallback66(
50821
+ const initNewCheckout = useCallback65(
50945
50822
  ({ config, ...initSettings }) => {
50946
50823
  const newCheckoutId = uuid4();
50947
50824
  const newActiveCheckoutItem = {
@@ -51031,7 +50908,7 @@ function FunkitCheckoutProvider({ children }) {
51031
50908
  });
51032
50909
  }
51033
50910
  );
51034
- const startDirectExecutionCheckout = useCallback66(
50911
+ const startDirectExecutionCheckout = useCallback65(
51035
50912
  async ({
51036
50913
  stepMessageSetter,
51037
50914
  latestQuote,
@@ -51191,7 +51068,7 @@ function FunkitCheckoutProvider({ children }) {
51191
51068
  udaParams
51192
51069
  ]
51193
51070
  );
51194
- const startRegularCheckout = useCallback66(
51071
+ const startRegularCheckout = useCallback65(
51195
51072
  async ({
51196
51073
  stepMessageSetter,
51197
51074
  latestQuote,
@@ -51558,14 +51435,14 @@ function useFunkitCheckout(props) {
51558
51435
  resume: resumeSoftHiddenCheckout,
51559
51436
  discard: discardSoftHiddenCheckout
51560
51437
  } = useSoftHiddenCheckout();
51561
- const onErrorWrapper = useCallback66(
51438
+ const onErrorWrapper = useCallback65(
51562
51439
  (payload) => {
51563
51440
  logger.warn(payload.message, payload);
51564
51441
  onError?.(payload);
51565
51442
  },
51566
51443
  [onError]
51567
51444
  );
51568
- const onOpenWrapper = useCallback66(
51445
+ const onOpenWrapper = useCallback65(
51569
51446
  (newId) => {
51570
51447
  props?.onOpen?.();
51571
51448
  openFunCheckoutModal?.(newId);
@@ -51702,13 +51579,13 @@ function useFunkitCheckout(props) {
51702
51579
  });
51703
51580
  openWithdrawalModal?.({ withdrawalId, ...config });
51704
51581
  });
51705
- useEffect91(() => {
51582
+ useEffect90(() => {
51706
51583
  if (isUserLoggedIn && pendingCheckoutConfig) {
51707
51584
  setPendingCheckoutConfig(void 0);
51708
51585
  beginCheckout(pendingCheckoutConfig);
51709
51586
  }
51710
51587
  }, [beginCheckout, isUserLoggedIn, pendingCheckoutConfig]);
51711
- useEffect91(() => {
51588
+ useEffect90(() => {
51712
51589
  if (pendingCheckoutConfig && !isUserLoggedIn && !connectModalOpen) {
51713
51590
  setPendingCheckoutConfig(void 0);
51714
51591
  }
@@ -51817,7 +51694,7 @@ var hasSufficientBalance = async (wagmiConfig, walletAddress, tokenAddress, toke
51817
51694
  requiredAssetAmount,
51818
51695
  walletAddress
51819
51696
  });
51820
- const balance = Number.parseFloat(formatUnits7(data.value, data.decimals));
51697
+ const balance = Number.parseFloat(formatUnits6(data.value, data.decimals));
51821
51698
  if (balance >= requiredAssetAmount) {
51822
51699
  return { balance, result: true, tokenTicker: data.symbol };
51823
51700
  }
@@ -52195,7 +52072,7 @@ var useWalletAssets = ({
52195
52072
  } = {}) => {
52196
52073
  const { address, isConnected } = useAccount();
52197
52074
  const { apiKey } = useFunkitConfig();
52198
- const { data, isLoading, isFetching } = useQuery26({
52075
+ const { data, isLoading, isFetching } = useQuery25({
52199
52076
  queryKey: ["getWalletAssets", address, apiKey],
52200
52077
  meta: stepQueryMeta({
52201
52078
  name: "walletAssets",
@@ -52287,7 +52164,7 @@ function ConnectButtonRenderer({
52287
52164
  // TypeError: Do not know how to serialize a BigInt
52288
52165
  query: { structuralSharing: false }
52289
52166
  });
52290
- const balanceFormatted = balanceData ? formatUnits8(balanceData.value, balanceData.decimals) : void 0;
52167
+ const balanceFormatted = balanceData ? formatUnits7(balanceData.value, balanceData.decimals) : void 0;
52291
52168
  const balanceNativeAmount = balanceData && balanceFormatted ? `${abbreviateETHBalance(Number.parseFloat(balanceFormatted))} ${balanceData.symbol}` : void 0;
52292
52169
  const displayBalance = formatCurrencyAndStringify15(
52293
52170
  Number.parseFloat(totalWalletAssetsUsd.toString())
@@ -52496,7 +52373,7 @@ function ConnectButton({
52496
52373
  const connectionStatus = useConnectionStatus();
52497
52374
  const { setShowBalance } = useShowBalance();
52498
52375
  const [ready, setReady] = useState93(false);
52499
- useEffect92(() => {
52376
+ useEffect91(() => {
52500
52377
  setShowBalance(showBalance);
52501
52378
  if (!ready) {
52502
52379
  setReady(true);