@funkit/connect 13.0.1 → 13.1.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.
package/dist/index.js CHANGED
@@ -113,7 +113,7 @@ function setFunkitConnectVersion({ version }) {
113
113
  localStorage.setItem(storageKey, version);
114
114
  }
115
115
  function getCurrentSdkVersion() {
116
- return "13.0.1";
116
+ return "13.1.1";
117
117
  }
118
118
  function useFingerprint() {
119
119
  const fingerprint = useCallback(() => {
@@ -6228,7 +6228,7 @@ var getRemoteImageStyles = (isRemoteImage, isRemoteImageLoaded, src) => {
6228
6228
  // src/components/ConnectButton/ConnectButtonRenderer.tsx
6229
6229
  import { formatCurrencyAndStringify as formatCurrencyAndStringify19, isMobile as isMobile16, noop as noop8 } from "@funkit/utils";
6230
6230
  import React340 from "react";
6231
- import { formatUnits as formatUnits10 } from "viem";
6231
+ import { formatUnits as formatUnits11 } from "viem";
6232
6232
 
6233
6233
  // src/hooks/useIsMounted.ts
6234
6234
  import { useCallback as useCallback3, useEffect as useEffect5, useState as useState5 } from "react";
@@ -10318,6 +10318,7 @@ import {
10318
10318
  DirectExecutionType,
10319
10319
  getCheckoutQuoteV2
10320
10320
  } from "@funkit/api-base";
10321
+ import { bindWithdrawalIntent } from "@funkit/connect-core";
10321
10322
  import { executeRelayQuote, shouldResetApproval } from "@funkit/fun-relay";
10322
10323
  import { useCallback as useCallback11 } from "react";
10323
10324
  import { decodeFunctionData, erc20Abi as erc20Abi3, getAddress as getAddress2 } from "viem";
@@ -10696,6 +10697,10 @@ function useCheckoutDirectExecution() {
10696
10697
  vmType: adaptedWallet.vmType
10697
10698
  });
10698
10699
  }
10700
+ const relayWallet = adaptedWallet && withdrawalSignContext ? bindWithdrawalIntent(adaptedWallet, {
10701
+ recipient: withdrawalSignContext.destinationAddress,
10702
+ relayOrder: relayQuote.protocol?.v2
10703
+ }) : adaptedWallet;
10699
10704
  const walletClient = rawWalletClient && !adaptedWallet ? await disableAtomicBatchIfSupported(
10700
10705
  rawWalletClient,
10701
10706
  executionChainId
@@ -10750,7 +10755,7 @@ function useCheckoutDirectExecution() {
10750
10755
  },
10751
10756
  logger,
10752
10757
  relayQuote,
10753
- walletClient: adaptedWallet ?? (withdrawalClient ? {
10758
+ walletClient: relayWallet ?? (withdrawalClient ? {
10754
10759
  vmType: "evm",
10755
10760
  getChainId: () => withdrawalClient.getChainId(),
10756
10761
  // Gasless routes (permit / EIP-3009) come back from Relay
@@ -17355,13 +17360,100 @@ import React53, {
17355
17360
  createContext as createContext19,
17356
17361
  useCallback as useCallback22,
17357
17362
  useContext as useContext18,
17358
- useMemo as useMemo21,
17363
+ useMemo as useMemo22,
17359
17364
  useRef as useRef16,
17360
17365
  useState as useState27
17361
17366
  } from "react";
17362
17367
 
17363
- // src/hooks/useSwappedTheme.ts
17368
+ // src/hooks/useSwappedPillAmounts.ts
17369
+ import {
17370
+ getSwappedPillAmounts
17371
+ } from "@funkit/connect-core";
17372
+
17373
+ // src/hooks/queries/useSwappedDefaultCurrency.ts
17374
+ import { useSwappedDefaultCurrencyQuery } from "@funkit/connect-core";
17375
+
17376
+ // src/providers/FunkitMoonpayProvider.tsx
17364
17377
  import { useMemo as useMemo20 } from "react";
17378
+ var BYPASS_COUNTRY_BLOCK_CHECK = false;
17379
+ var ALL_MATCH = "*";
17380
+ var isCountryBlocked = (blockedList, userIpInfo) => {
17381
+ if (BYPASS_COUNTRY_BLOCK_CHECK) {
17382
+ return false;
17383
+ }
17384
+ if (!userIpInfo.alpha2) {
17385
+ logger.log("isUserBlockedForCheckout_NoIpDetected");
17386
+ return true;
17387
+ }
17388
+ const isBlocked = blockedList.includes(ALL_MATCH) || blockedList.includes(userIpInfo.alpha2);
17389
+ logger.log("isUserBlockedForCheckoutResult", {
17390
+ isBlocked,
17391
+ blockedList,
17392
+ userIpInfo
17393
+ });
17394
+ return isBlocked;
17395
+ };
17396
+ function useFunkitUserIp() {
17397
+ const { isUserLoggedIn } = useGeneralWallet();
17398
+ const { userIpInfo, isLoadingGeoCheck } = useUserIpInfo();
17399
+ const blockedCountries = useDynamicConfig("blockedcountries");
17400
+ const isUserGeoblocked = useMemo20(() => {
17401
+ if (isLoadingGeoCheck) {
17402
+ return false;
17403
+ }
17404
+ if (!userIpInfo) {
17405
+ return true;
17406
+ }
17407
+ return isCountryBlocked(blockedCountries, userIpInfo);
17408
+ }, [blockedCountries, isLoadingGeoCheck, userIpInfo]);
17409
+ return {
17410
+ isLoadingGeoCheck,
17411
+ isUserGeoblocked,
17412
+ isUserLoggedIn,
17413
+ userIpInfo
17414
+ };
17415
+ }
17416
+
17417
+ // src/hooks/queries/useSwappedDefaultCurrency.ts
17418
+ var useSwappedDefaultCurrency = () => {
17419
+ const { apiKey } = useFunkitConfig();
17420
+ const { userIpInfo } = useFunkitUserIp();
17421
+ return useSwappedDefaultCurrencyQuery({
17422
+ apiKey,
17423
+ countryCode: userIpInfo?.alpha2,
17424
+ logger
17425
+ });
17426
+ };
17427
+
17428
+ // src/hooks/useFiatExchangeRates.ts
17429
+ import { getFiatExchangeRates } from "@funkit/api-base";
17430
+ import { useQuery as useQuery4 } from "@tanstack/react-query";
17431
+ function useFiatExchangeRates(enabled = true) {
17432
+ const { data, isLoading, error } = useQuery4({
17433
+ queryKey: ["fiatExchangeRates"],
17434
+ queryFn: () => getFiatExchangeRates({ logger }),
17435
+ refetchOnMount: false,
17436
+ refetchOnReconnect: false,
17437
+ refetchOnWindowFocus: false,
17438
+ gcTime: 1e3 * 60 * 60,
17439
+ // 1 hour
17440
+ enabled
17441
+ });
17442
+ return { data, isLoading, error };
17443
+ }
17444
+
17445
+ // src/hooks/useSwappedPillAmounts.ts
17446
+ function useSwappedPillAmounts() {
17447
+ const { data: fiatCurrencyCode } = useSwappedDefaultCurrency();
17448
+ const { data: exchangeRates } = useFiatExchangeRates();
17449
+ if (!fiatCurrencyCode) {
17450
+ return void 0;
17451
+ }
17452
+ return getSwappedPillAmounts(fiatCurrencyCode, exchangeRates);
17453
+ }
17454
+
17455
+ // src/hooks/useSwappedTheme.ts
17456
+ import { useMemo as useMemo21 } from "react";
17365
17457
 
17366
17458
  // src/utils/swapped.ts
17367
17459
  import chroma from "chroma-js";
@@ -17507,7 +17599,7 @@ function buildSwappedThemeQueryParams(resolvedTheme) {
17507
17599
  var useSwappedThemeQueryParams = () => {
17508
17600
  const { activeTheme } = useActiveTheme();
17509
17601
  const themeRootElement = useThemeRootElement();
17510
- return useMemo20(
17602
+ return useMemo21(
17511
17603
  () => buildSwappedThemeQueryParams(
17512
17604
  resolveObjectCssVars(activeTheme, themeRootElement)
17513
17605
  ),
@@ -17519,7 +17611,7 @@ var useSwappedIframeTheme = () => {
17519
17611
  const { uiCustomizations } = useFunkitConfig();
17520
17612
  const themeRootElement = useThemeRootElement();
17521
17613
  const isDarkMode = activeTheme === darkTheme2;
17522
- return useMemo20(() => {
17614
+ return useMemo21(() => {
17523
17615
  const customFontFamily = uiCustomizations.customFontFamily;
17524
17616
  const theme = { ...activeTheme, customFontFamily };
17525
17617
  return buildSwappedTheme(
@@ -17572,12 +17664,12 @@ function createIframeSwappedTransport({
17572
17664
 
17573
17665
  // src/providers/SwappedProvider.tsx
17574
17666
  var SwappedContext = createContext19(null);
17575
- function useSwappedSlot(swappedTheme, buyingCrypto) {
17667
+ function useSwappedSlot(swappedTheme, buyingCrypto, pillAmounts) {
17576
17668
  const [iframeUrl, setIframeUrlState] = useState27(null);
17577
17669
  const iframeRef = useRef16(null);
17578
17670
  const iframeUrlRef = useRef16(iframeUrl);
17579
17671
  iframeUrlRef.current = iframeUrl;
17580
- const transport = useMemo21(
17672
+ const transport = useMemo22(
17581
17673
  () => createIframeSwappedTransport({
17582
17674
  getContentWindow: () => iframeRef.current?.contentWindow ?? null,
17583
17675
  getTargetOrigin: () => getSwappedOrigin(iframeUrlRef.current || "")
@@ -17588,6 +17680,7 @@ function useSwappedSlot(swappedTheme, buyingCrypto) {
17588
17680
  transport,
17589
17681
  swappedTheme,
17590
17682
  buyingCrypto,
17683
+ pillAmounts,
17591
17684
  logger
17592
17685
  });
17593
17686
  const setIframeRef = useCallback22((el) => {
@@ -17615,7 +17708,7 @@ function useSwappedSlot(swappedTheme, buyingCrypto) {
17615
17708
  readyCheckoutIdsRef.current.add(checkoutId);
17616
17709
  return true;
17617
17710
  }, []);
17618
- return useMemo21(
17711
+ return useMemo22(
17619
17712
  () => ({
17620
17713
  iframeUrl,
17621
17714
  isSwappedReady: session.isSwappedReady,
@@ -17649,9 +17742,10 @@ function SwappedProvider({
17649
17742
  buyingCrypto
17650
17743
  }) {
17651
17744
  const swappedTheme = useSwappedIframeTheme();
17652
- const deposit = useSwappedSlot(swappedTheme, buyingCrypto);
17653
- const withdrawal = useSwappedSlot(swappedTheme);
17654
- const value = useMemo21(
17745
+ const pillAmounts = useSwappedPillAmounts();
17746
+ const deposit = useSwappedSlot(swappedTheme, buyingCrypto, pillAmounts);
17747
+ const withdrawal = useSwappedSlot(swappedTheme, void 0, pillAmounts);
17748
+ const value = useMemo22(
17655
17749
  () => ({ deposit, withdrawal, swappedTheme }),
17656
17750
  [deposit, withdrawal, swappedTheme]
17657
17751
  );
@@ -19629,7 +19723,7 @@ import { v4 as uuid2 } from "uuid";
19629
19723
  import React94, {
19630
19724
  useCallback as useCallback27,
19631
19725
  useEffect as useEffect39,
19632
- useMemo as useMemo24,
19726
+ useMemo as useMemo25,
19633
19727
  useRef as useRef21,
19634
19728
  useState as useState35
19635
19729
  } from "react";
@@ -20162,7 +20256,7 @@ import React85 from "react";
20162
20256
  // src/components/Dropdown/BaseDropdown.tsx
20163
20257
  import { isMobile as isMobile4 } from "@funkit/utils";
20164
20258
  import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
20165
- import React84, { useCallback as useCallback26, useEffect as useEffect37, useMemo as useMemo22, useRef as useRef19, useState as useState33 } from "react";
20259
+ import React84, { useCallback as useCallback26, useEffect as useEffect37, useMemo as useMemo23, useRef as useRef19, useState as useState33 } from "react";
20166
20260
 
20167
20261
  // src/components/FunNoResults/FunNoResults.tsx
20168
20262
  import React82 from "react";
@@ -20582,7 +20676,7 @@ function BaseDropdown({
20582
20676
  const [isOpened, setIsOpened] = useState33(false);
20583
20677
  const [searchInput, setSearchInput] = useState33("");
20584
20678
  const { ref: scrollRef, hasTopDivider, isAtBottom } = useScrollDivider();
20585
- const allOptions = useMemo22(
20679
+ const allOptions = useMemo23(
20586
20680
  () => buildAllOptions(options, allowUnselect, unselectLabel),
20587
20681
  [options, allowUnselect, unselectLabel]
20588
20682
  );
@@ -20592,11 +20686,11 @@ function BaseDropdown({
20592
20686
  const handleSearch = (event) => {
20593
20687
  setSearchInput(event.target.value);
20594
20688
  };
20595
- const filteredOptions = useMemo22(
20689
+ const filteredOptions = useMemo23(
20596
20690
  () => filterOptions(allOptions, searchInput),
20597
20691
  [allOptions, searchInput]
20598
20692
  );
20599
- const { organizedGroups, organizedOptions } = useMemo22(
20693
+ const { organizedGroups, organizedOptions } = useMemo23(
20600
20694
  () => organizeDropdownGroups(
20601
20695
  filteredOptions,
20602
20696
  groups,
@@ -20948,7 +21042,7 @@ import {
20948
21042
  } from "@funkit/utils";
20949
21043
  import React90, {
20950
21044
  useEffect as useEffect38,
20951
- useMemo as useMemo23,
21045
+ useMemo as useMemo24,
20952
21046
  useRef as useRef20,
20953
21047
  useState as useState34
20954
21048
  } from "react";
@@ -21495,7 +21589,7 @@ function PaymentFeesSummary({
21495
21589
  setIsExpanded(false);
21496
21590
  }
21497
21591
  }, [valuesNotAvailable, isExpanded, controls]);
21498
- const { collapsed: collapsedItem, expanded: expandedItems } = useMemo23(() => {
21592
+ const { collapsed: collapsedItem, expanded: expandedItems } = useMemo24(() => {
21499
21593
  const fees = quote?.finalFeesBreakdown ?? fallbackFees;
21500
21594
  if (!fees) {
21501
21595
  return NO_DATA;
@@ -22071,7 +22165,7 @@ function useLighterWithdrawalBalances({
22071
22165
  error: error instanceof Error ? error.message : error
22072
22166
  });
22073
22167
  }, [accountIndex, isLoading, account, error]);
22074
- const assets = useMemo24(() => account?.assets ?? [], [account]);
22168
+ const assets = useMemo25(() => account?.assets ?? [], [account]);
22075
22169
  return {
22076
22170
  assets,
22077
22171
  isLoading
@@ -22575,7 +22669,7 @@ import {
22575
22669
  useDirectExecutionForDepositAddress,
22576
22670
  useLogOnce as useLogOnce6
22577
22671
  } from "@funkit/connect-core";
22578
- import { useEffect as useEffect40, useMemo as useMemo25, useState as useState36 } from "react";
22672
+ import { useEffect as useEffect40, useMemo as useMemo26, useState as useState36 } from "react";
22579
22673
  function useNadoWithdrawalStatus({
22580
22674
  depositAddress,
22581
22675
  pollIntervalMs
@@ -22612,7 +22706,7 @@ function useNadoWithdrawalStatus({
22612
22706
  relayStatus: latestStep?.listenerInfo?.status
22613
22707
  });
22614
22708
  });
22615
- const completionTx = useMemo25(() => {
22709
+ const completionTx = useMemo26(() => {
22616
22710
  if (status !== "completed" || !latestStep) {
22617
22711
  return void 0;
22618
22712
  }
@@ -22791,7 +22885,7 @@ import {
22791
22885
  import {
22792
22886
  useRecentDepositsApiQuery
22793
22887
  } from "@funkit/connect-core";
22794
- import { useMemo as useMemo26 } from "react";
22888
+ import { useMemo as useMemo27 } from "react";
22795
22889
  function useRecentDepositsApi(params) {
22796
22890
  return useRecentDepositsApiQuery({
22797
22891
  ...params,
@@ -22831,14 +22925,14 @@ function useFunkitRecentDepositsImpl(query) {
22831
22925
  fetchSize: fetchSize * 2
22832
22926
  // fetch extra to account for merging
22833
22927
  });
22834
- const mergedDirectExecutions = useMemo26(
22928
+ const mergedDirectExecutions = useMemo27(
22835
22929
  () => processRecentDepositsForNotifications(
22836
22930
  query.memoizedFilterFunc ? directExecutions?.filter(query.memoizedFilterFunc) : directExecutions,
22837
22931
  { cutOffTimeMs: query.cutOffTimeMs }
22838
22932
  ),
22839
22933
  [directExecutions, query.cutOffTimeMs, query.memoizedFilterFunc]
22840
22934
  );
22841
- return useMemo26(
22935
+ return useMemo27(
22842
22936
  () => ({
22843
22937
  data: mergedDirectExecutions?.map((de) => purifyCheckoutHistoryItem(de)).slice(0, fetchSize)
22844
22938
  }),
@@ -22867,12 +22961,12 @@ import React132 from "react";
22867
22961
 
22868
22962
  // src/hooks/useConnectedWallets.ts
22869
22963
  import { isAddressEquivalent as isAddressEquivalent6 } from "@funkit/utils";
22870
- import { useMemo as useMemo27 } from "react";
22964
+ import { useMemo as useMemo28 } from "react";
22871
22965
  function useConnectedWallets() {
22872
22966
  const {
22873
22967
  payerWallets: { evmWallet, solanaWallet }
22874
22968
  } = useGeneralWallet();
22875
- return useMemo27(() => {
22969
+ return useMemo28(() => {
22876
22970
  const wallets = [];
22877
22971
  if (evmWallet.address) {
22878
22972
  wallets.push({ ...evmWallet, address: evmWallet.address });
@@ -22897,7 +22991,7 @@ function soleWalletVendor(wallets) {
22897
22991
  }
22898
22992
  function usePayerWallet(address) {
22899
22993
  const wallets = useConnectedWallets();
22900
- return useMemo27(() => {
22994
+ return useMemo28(() => {
22901
22995
  if (!address) {
22902
22996
  return void 0;
22903
22997
  }
@@ -23086,7 +23180,7 @@ function useCheckoutTimeEstimate(latestQuote, originalTimeEstimationMs, paymentM
23086
23180
  // src/hooks/useCheckoutTransferInit.ts
23087
23181
  import { isLighterChainId } from "@funkit/chains";
23088
23182
  import { getCheckoutTokenTransferParams as getCheckoutTokenTransferParams2 } from "@funkit/connect-core";
23089
- import { useQuery as useQuery4 } from "@tanstack/react-query";
23183
+ import { useQuery as useQuery5 } from "@tanstack/react-query";
23090
23184
  import { useEffect as useEffect41 } from "react";
23091
23185
 
23092
23186
  // src/hooks/useIsDynamicRoutingEnabled.ts
@@ -23196,7 +23290,7 @@ var useCheckoutTransferInit = (enabled = true, { trackStepReadiness = true } = {
23196
23290
  const isQRCodeEnabledWithPostAction = !!checkoutConfig && // either no post action required
23197
23291
  (!isCheckoutPostActionRequired(checkoutConfig) || // or action type is set
23198
23292
  !!checkoutConfig?.qrcodeActionType || postActionOverride || !!queryKey?.actionType);
23199
- const { data, isFetching, isLoading } = useQuery4({
23293
+ const { data, isFetching, isLoading } = useQuery5({
23200
23294
  queryKey: ["initializeCheckoutTokenTransferAddress", queryKey],
23201
23295
  meta: trackStepReadiness ? stepQueryMeta({
23202
23296
  name: "udaAddress",
@@ -23576,7 +23670,7 @@ import {
23576
23670
  getMinTransferValueUsd,
23577
23671
  transferChainFamily
23578
23672
  } from "@funkit/connect-core";
23579
- import { useMemo as useMemo28 } from "react";
23673
+ import { useMemo as useMemo29 } from "react";
23580
23674
  import { arbitrum as arbitrum4, polygon as polygon4 } from "viem/chains";
23581
23675
 
23582
23676
  // src/utils/transfer.ts
@@ -23585,23 +23679,6 @@ import {
23585
23679
  getTransferTokenQrCodeUri
23586
23680
  } from "@funkit/connect-core";
23587
23681
 
23588
- // src/hooks/useFiatExchangeRates.ts
23589
- import { getFiatExchangeRates } from "@funkit/api-base";
23590
- import { useQuery as useQuery5 } from "@tanstack/react-query";
23591
- function useFiatExchangeRates(enabled = true) {
23592
- const { data, isLoading, error } = useQuery5({
23593
- queryKey: ["fiatExchangeRates"],
23594
- queryFn: () => getFiatExchangeRates({ logger }),
23595
- refetchOnMount: false,
23596
- refetchOnReconnect: false,
23597
- refetchOnWindowFocus: false,
23598
- gcTime: 1e3 * 60 * 60,
23599
- // 1 hour
23600
- enabled
23601
- });
23602
- return { data, isLoading, error };
23603
- }
23604
-
23605
23682
  // src/hooks/useTokenTransfer.ts
23606
23683
  var useTokenTransfer = (selectedChainId, selectedToken, chainIds) => {
23607
23684
  const { t } = useFunkitTranslation();
@@ -23680,7 +23757,7 @@ var useMinTransferValueEur = (selectedChainId) => {
23680
23757
  };
23681
23758
  var useMinTransferValues = (chainIds) => {
23682
23759
  const limits = useDynamicConfig("mintokentransfervalue");
23683
- return useMemo28(() => {
23760
+ return useMemo29(() => {
23684
23761
  return chainIds.reduce(
23685
23762
  (acc, id) => {
23686
23763
  acc[id] = getMinTransferValueUsd(id, limits);
@@ -23774,59 +23851,6 @@ var useMaxSlippage = ({
23774
23851
  return { label, value: 1 };
23775
23852
  };
23776
23853
 
23777
- // src/providers/FunkitMoonpayProvider.tsx
23778
- import { useMemo as useMemo29 } from "react";
23779
- var BYPASS_COUNTRY_BLOCK_CHECK = false;
23780
- var ALL_MATCH = "*";
23781
- var isCountryBlocked = (blockedList, userIpInfo) => {
23782
- if (BYPASS_COUNTRY_BLOCK_CHECK) {
23783
- return false;
23784
- }
23785
- if (!userIpInfo.alpha2) {
23786
- logger.log("isUserBlockedForCheckout_NoIpDetected");
23787
- return true;
23788
- }
23789
- const isBlocked = blockedList.includes(ALL_MATCH) || blockedList.includes(userIpInfo.alpha2);
23790
- logger.log("isUserBlockedForCheckoutResult", {
23791
- isBlocked,
23792
- blockedList,
23793
- userIpInfo
23794
- });
23795
- return isBlocked;
23796
- };
23797
- function useFunkitUserIp() {
23798
- const { isUserLoggedIn } = useGeneralWallet();
23799
- const { userIpInfo, isLoadingGeoCheck } = useUserIpInfo();
23800
- const blockedCountries = useDynamicConfig("blockedcountries");
23801
- const isUserGeoblocked = useMemo29(() => {
23802
- if (isLoadingGeoCheck) {
23803
- return false;
23804
- }
23805
- if (!userIpInfo) {
23806
- return true;
23807
- }
23808
- return isCountryBlocked(blockedCountries, userIpInfo);
23809
- }, [blockedCountries, isLoadingGeoCheck, userIpInfo]);
23810
- return {
23811
- isLoadingGeoCheck,
23812
- isUserGeoblocked,
23813
- isUserLoggedIn,
23814
- userIpInfo
23815
- };
23816
- }
23817
-
23818
- // src/hooks/queries/useSwappedDefaultCurrency.ts
23819
- import { useSwappedDefaultCurrencyQuery } from "@funkit/connect-core";
23820
- var useSwappedDefaultCurrency = () => {
23821
- const { apiKey } = useFunkitConfig();
23822
- const { userIpInfo } = useFunkitUserIp();
23823
- return useSwappedDefaultCurrencyQuery({
23824
- apiKey,
23825
- countryCode: userIpInfo?.alpha2,
23826
- logger
23827
- });
23828
- };
23829
-
23830
23854
  // src/hooks/queries/useSwappedExchanges.ts
23831
23855
  var EVM_USDC_TARGETS = [
23832
23856
  { chainId: "1", address: "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" },
@@ -23858,6 +23882,7 @@ var useSwappedExchanges = () => {
23858
23882
  const fopPriority = useDynamicConfig("foppriority");
23859
23883
  const targetAsset = checkoutItem?.initSettings.config.targetAsset;
23860
23884
  const targetChain = checkoutItem?.initSettings.config.targetChain;
23885
+ const checkoutId = checkoutItem?.id;
23861
23886
  const defaultMinAmountEur = useMinTransferValueEur(Number(targetChain));
23862
23887
  const recipientTargets = useMemo30(() => {
23863
23888
  if (!transferInit || !targetChain || !targetAsset) {
@@ -23918,8 +23943,11 @@ var useSwappedExchanges = () => {
23918
23943
  const countryCode = userIpInfo?.alpha2;
23919
23944
  const isEnabled = isSwappedExchangesEnabled && !!apiKey && !!userId && !!countryCode && !!transferInit && recipientTargets.length > 0 && !isSwappedCurrencyCodeLoading;
23920
23945
  const query = useQuery6({
23946
+ // `checkoutId` is in the key: the server signs it into provider order
23947
+ // references, so a cached response must not serve a later checkout.
23921
23948
  queryKey: [
23922
23949
  "cryptoToCryptoFops",
23950
+ checkoutId,
23923
23951
  userId,
23924
23952
  countryCode,
23925
23953
  swappedCurrencyCode,
@@ -23936,6 +23964,7 @@ var useSwappedExchanges = () => {
23936
23964
  const response = await getFops({
23937
23965
  apiKey,
23938
23966
  logger,
23967
+ checkoutId,
23939
23968
  params: {
23940
23969
  recipientAddress: primary.recipientAddress,
23941
23970
  userId,
@@ -27949,7 +27978,7 @@ function useTrackExecutionProgressEvents(flow) {
27949
27978
  const { connectorId } = useGeneralWallet();
27950
27979
  const names = eventNames[flow];
27951
27980
  const trackExecutionTransactionSubmitted = useEffectEvent(
27952
- (args, claimKey) => {
27981
+ (args, claimKey, providerProperties) => {
27953
27982
  if (!claimAnalyticsEvent(names.submitted, claimKey)) {
27954
27983
  return;
27955
27984
  }
@@ -27957,7 +27986,8 @@ function useTrackExecutionProgressEvents(flow) {
27957
27986
  flow,
27958
27987
  ...buildExecutionTransactionSnapshotProperties(args, connectorId),
27959
27988
  est_fulfillment_time_ms: args.quote?.finalTimeEstimationMs ?? null,
27960
- quote_id: args.quote?.baseQuote.quoteId ?? null
27989
+ quote_id: args.quote?.baseQuote.quoteId ?? null,
27990
+ ...providerProperties
27961
27991
  }));
27962
27992
  }
27963
27993
  );
@@ -31215,12 +31245,12 @@ function useWithdrawal({
31215
31245
  targetChainId: formData.chainId
31216
31246
  }
31217
31247
  );
31218
- const txHash = confirmation?.transactionSubmitted?.txHash;
31248
+ const submission = confirmation?.transactionSubmitted;
31219
31249
  withdrawalItem?.initSettings.onWithdrawalConfirmation?.(
31220
31250
  formData.destinationAddress,
31221
31251
  formData
31222
31252
  );
31223
- if (!txHash) {
31253
+ if (!submission?.txHash) {
31224
31254
  const invalidTxHashError = new Error(
31225
31255
  "Invalid txHash - unable to proceed with withdrawal"
31226
31256
  );
@@ -31230,7 +31260,7 @@ function useWithdrawal({
31230
31260
  });
31231
31261
  throw invalidTxHashError;
31232
31262
  }
31233
- return txHash;
31263
+ return submission;
31234
31264
  }
31235
31265
  async function callbackWithdrawal(customConfig) {
31236
31266
  const quoteId = formData.quote?.baseQuote.quoteId ?? SYNTHETIC_QUOTELESS_QUOTE_ID;
@@ -31268,11 +31298,14 @@ function useWithdrawal({
31268
31298
  await onBeforeSign();
31269
31299
  customCallbackFailed = false;
31270
31300
  }
31271
- let txHash;
31301
+ let submission;
31272
31302
  if (isWalletWithdrawalConfig(config)) {
31273
- txHash = await walletWithdrawal(config);
31303
+ submission = await walletWithdrawal(config);
31274
31304
  } else if (isCustomWithdrawalConfig(config)) {
31275
- txHash = await callbackWithdrawal(config);
31305
+ submission = {
31306
+ txHash: await callbackWithdrawal(config),
31307
+ executionType: null
31308
+ };
31276
31309
  } else {
31277
31310
  const invalidConfigError = new Error("Invalid withdrawal config");
31278
31311
  logger.error("withdrawal:invalidConfig", invalidConfigError, {
@@ -31287,8 +31320,8 @@ function useWithdrawal({
31287
31320
  stepMessage: step,
31288
31321
  withdrawalAmountUSD: formData.withdrawalUSD
31289
31322
  });
31290
- onSuccess?.(formData, txHash);
31291
- return txHash;
31323
+ onSuccess?.(formData, submission.txHash);
31324
+ return submission;
31292
31325
  } catch (err) {
31293
31326
  const caughtError = err instanceof Error ? err : new Error("Unknown withdrawal error");
31294
31327
  const isNestedError = caughtError.message === "Invalid txHash - unable to proceed with withdrawal" || caughtError.message === "Invalid withdrawal config";
@@ -33198,6 +33231,7 @@ var useWithdrawFops = (params) => {
33198
33231
  const { apiKey } = useFunkitConfig();
33199
33232
  const { userInfo } = useGeneralWallet();
33200
33233
  const { prefillFiatEmail } = useIdentity();
33234
+ const checkoutId = useCheckoutContext().checkoutItem?.id;
33201
33235
  const { userIpInfo, isLoadingGeoCheck } = useFunkitUserIp();
33202
33236
  const {
33203
33237
  data: swappedCurrencyCode = "USD",
@@ -33224,9 +33258,12 @@ var useWithdrawFops = (params) => {
33224
33258
  const isEnablePending = !isEnabled && hasRequiredInputs && (params.enablePending === true || params.enabled !== false) && (params.enablePending === true || isLoadingGeoCheck || isSwappedCurrencyCodeLoading);
33225
33259
  const query = useQuery14({
33226
33260
  // `prefillFiatEmail` is intentionally NOT in the queryKey: it's read inside
33227
- // `queryFn` and captured at fetch time, so post-mount changes don't trigger a refetch
33261
+ // `queryFn` and captured at fetch time, so post-mount changes don't trigger a refetch.
33262
+ // `checkoutId` is in the key: the server signs it into provider order
33263
+ // references, so a cached response must not serve a later checkout.
33228
33264
  queryKey: [
33229
33265
  "withdrawFops",
33266
+ checkoutId,
33230
33267
  userId,
33231
33268
  countryCode,
33232
33269
  swappedCurrencyCode,
@@ -33284,6 +33321,7 @@ var useWithdrawFops = (params) => {
33284
33321
  const response = await getFops2({
33285
33322
  apiKey,
33286
33323
  logger,
33324
+ checkoutId,
33287
33325
  params: {
33288
33326
  // recipientAddress and destinationToken are required by the backend's
33289
33327
  // Zod schema but ignored for off-ramp — the CRYPTO_TO_FIAT handler
@@ -34034,8 +34072,8 @@ function SwappedIframeSkeleton({
34034
34072
  // src/hooks/track/analytics/useTrackSwappedIframeError.ts
34035
34073
  import { useRef as useRef36 } from "react";
34036
34074
 
34037
- // src/hooks/track/analytics/swappedIframeError.ts
34038
- function readIdentifier(value) {
34075
+ // src/hooks/track/analytics/swappedIframePayload.ts
34076
+ function readSwappedIdentifier(value) {
34039
34077
  if (typeof value === "string") {
34040
34078
  return value || null;
34041
34079
  }
@@ -34044,6 +34082,8 @@ function readIdentifier(value) {
34044
34082
  }
34045
34083
  return null;
34046
34084
  }
34085
+
34086
+ // src/hooks/track/analytics/swappedIframeError.ts
34047
34087
  function buildSwappedIframeErrorProperties(data, flow) {
34048
34088
  const payload = typeof data === "object" && data !== null ? data : {};
34049
34089
  return {
@@ -34053,15 +34093,19 @@ function buildSwappedIframeErrorProperties(data, flow) {
34053
34093
  error_code: "SWAPPED_PROVIDER_ERROR",
34054
34094
  // The embed payload is opaque; never forward arbitrary nested error data.
34055
34095
  error_message: null,
34056
- order_id: readIdentifier("order_id" in payload ? payload.order_id : null)
34096
+ order_id: readSwappedIdentifier(
34097
+ "order_id" in payload ? payload.order_id : null
34098
+ )
34057
34099
  };
34058
34100
  }
34059
34101
  function getSwappedIframeErrorKey(data) {
34060
34102
  if (typeof data !== "object" || data === null) {
34061
34103
  return null;
34062
34104
  }
34063
- const orderId = readIdentifier("order_id" in data ? data.order_id : null);
34064
- const error = readIdentifier("error" in data ? data.error : null);
34105
+ const orderId = readSwappedIdentifier(
34106
+ "order_id" in data ? data.order_id : null
34107
+ );
34108
+ const error = readSwappedIdentifier("error" in data ? data.error : null);
34065
34109
  if (!orderId || !error) {
34066
34110
  return null;
34067
34111
  }
@@ -34117,6 +34161,50 @@ function resolveIframeStepNavigation(history, nextStep) {
34117
34161
  };
34118
34162
  }
34119
34163
 
34164
+ // src/hooks/track/analytics/swappedWithdrawalOrder.ts
34165
+ function buildSwappedWithdrawalOrderProperties(order) {
34166
+ return {
34167
+ payment_rail: "swapped",
34168
+ order_id: order.orderId,
34169
+ order_amount: order.amount,
34170
+ order_asset: typeof order.providerCrypto === "string" ? order.providerCrypto : null,
34171
+ order_network: typeof order.providerNetwork === "string" ? order.providerNetwork : null,
34172
+ order_timestamp: typeof order.providerTimestamp === "number" && Number.isFinite(order.providerTimestamp) ? order.providerTimestamp : null
34173
+ };
34174
+ }
34175
+
34176
+ // src/hooks/track/analytics/swappedIframeSubmission.ts
34177
+ function buildSwappedIframeSubmissionProperties(data, fopType, checkoutId, config) {
34178
+ const payload = typeof data === "object" && data !== null ? data : {};
34179
+ return {
34180
+ ...NULL_VISIBLE_QUOTE_FEE_PROPERTIES,
34181
+ checkout_id: checkoutId,
34182
+ // Provider confirmation does not supply an authoritative execution snapshot.
34183
+ provider: null,
34184
+ source_chain: null,
34185
+ source_asset: null,
34186
+ source_asset_ticker: null,
34187
+ // The configured destination is known even before an execution is available.
34188
+ target_chain: config.targetChain,
34189
+ target_asset: config.targetAsset,
34190
+ target_asset_ticker: config.targetAssetTicker || null,
34191
+ destination_address: null,
34192
+ execution_type: null,
34193
+ sender_address: null,
34194
+ source_amount: null,
34195
+ target_amount: null,
34196
+ trade_type: null,
34197
+ tx_hash: null,
34198
+ quote_id: null,
34199
+ est_fulfillment_time_ms: null,
34200
+ payment_rail: "swapped",
34201
+ payment_method: mapSwappedFopTypeToPaymentMethod(fopType),
34202
+ order_id: readSwappedIdentifier(
34203
+ "order_id" in payload ? payload.order_id : null
34204
+ )
34205
+ };
34206
+ }
34207
+
34120
34208
  // src/hooks/track/analytics/useTrackSwappedIframeEvents.ts
34121
34209
  import { useCallback as useCallback40, useRef as useRef37 } from "react";
34122
34210
  function useTrackSwappedIframeEvents(flow) {
@@ -34158,7 +34246,30 @@ function useTrackSwappedIframeEvents(flow) {
34158
34246
  },
34159
34247
  [checkoutId, flow, logEventV2]
34160
34248
  );
34161
- return { trackIframeStepViewed };
34249
+ const trackIframeTransactionSubmitted = useCallback40(
34250
+ (data, fopType) => {
34251
+ if (!checkoutItem || flow !== "deposit") {
34252
+ return;
34253
+ }
34254
+ if (!claimAnalyticsEvent(
34255
+ "fc_deposit_transaction_submitted" /* DEPOSIT_TRANSACTION_SUBMITTED */,
34256
+ `swapped:${checkoutItem.id}`
34257
+ )) {
34258
+ return;
34259
+ }
34260
+ logEventV2("fc_deposit_transaction_submitted" /* DEPOSIT_TRANSACTION_SUBMITTED */, () => ({
34261
+ flow: "deposit",
34262
+ ...buildSwappedIframeSubmissionProperties(
34263
+ data,
34264
+ fopType,
34265
+ checkoutItem.id,
34266
+ checkoutItem.initSettings.config
34267
+ )
34268
+ }));
34269
+ },
34270
+ [checkoutItem, flow, logEventV2]
34271
+ );
34272
+ return { trackIframeStepViewed, trackIframeTransactionSubmitted };
34162
34273
  }
34163
34274
 
34164
34275
  // src/hooks/useSwappedIframeLifecycle.ts
@@ -34205,6 +34316,7 @@ function buildPerfIframeReadyProperties(args) {
34205
34316
  // src/modals/WithdrawalModal/useFiatWithdrawal.ts
34206
34317
  import { getCheckoutQuoteV2 as getCheckoutQuoteV22 } from "@funkit/api-base";
34207
34318
  import { useEffect as useEffect56, useRef as useRef39 } from "react";
34319
+ import { formatUnits as formatUnits6 } from "viem";
34208
34320
  import { safeBigInt as safeBigInt2 } from "@funkit/connect-core";
34209
34321
  import {
34210
34322
  findSwappedSourceOverride as findSwappedSourceOverride2,
@@ -34277,7 +34389,7 @@ async function quoteOrderExactOut(ctx) {
34277
34389
  toAmountBaseUnit
34278
34390
  });
34279
34391
  const estimation = await estimateQuote(quote, ctx);
34280
- return { quote, estimation };
34392
+ return { quote, estimation, targetDecimals };
34281
34393
  }
34282
34394
  async function quoteOrderExactIn(ctx, fromAmountBaseUnit) {
34283
34395
  const { apiKey, userAddress, legs, order } = ctx;
@@ -34295,10 +34407,21 @@ async function quoteOrderExactIn(ctx, fromAmountBaseUnit) {
34295
34407
  const estimation = await estimateQuote(quote, ctx);
34296
34408
  return { quote, estimation };
34297
34409
  }
34410
+ function resolveQuotedTargetAmount(quote, targetDecimals) {
34411
+ if (quote.estSubtotalToAmount != null) {
34412
+ return quote.estSubtotalToAmount;
34413
+ }
34414
+ const raw = quote.metadata?.toAmountBaseUnit;
34415
+ if (typeof raw !== "string" || !/^\d+$/.test(raw)) {
34416
+ return null;
34417
+ }
34418
+ return formatUnits6(BigInt(raw), targetDecimals);
34419
+ }
34298
34420
  function useFiatWithdrawal({
34299
34421
  config,
34300
34422
  withdrawalItem,
34301
- onError
34423
+ onError,
34424
+ onSubmitted
34302
34425
  }) {
34303
34426
  const wagmiConfig = useConfig();
34304
34427
  const { apiKey } = useFunkitConfig();
@@ -34411,7 +34534,8 @@ function useFiatWithdrawal({
34411
34534
  legs,
34412
34535
  order
34413
34536
  };
34414
- const { quote, estimation } = await quoteOrderExactOut(quoteContext);
34537
+ const { quote, estimation, targetDecimals } = await quoteOrderExactOut(quoteContext);
34538
+ let tradeType = "EXACT_OUT" /* EXACT_OUT */;
34415
34539
  let finalQuote = quote;
34416
34540
  let finalEstimation = estimation;
34417
34541
  const balance2 = resolveWithdrawalSourceTokenBalance2(
@@ -34445,11 +34569,12 @@ function useFiatWithdrawal({
34445
34569
  balanceBaseUnit: balanceBaseUnit.toString()
34446
34570
  });
34447
34571
  const clamped = await quoteOrderExactIn(quoteContext, balanceBaseUnit);
34572
+ tradeType = "EXACT_IN" /* EXACT_IN */;
34448
34573
  finalQuote = clamped.quote;
34449
34574
  finalEstimation = clamped.estimation;
34450
34575
  }
34451
34576
  }
34452
- const txHash = await handleWithdrawal({
34577
+ const submission = await handleWithdrawal({
34453
34578
  destinationAddress: order.destinationAddress,
34454
34579
  // Fee-exclusive value of the withdrawal, matching the standard form
34455
34580
  // (WithdrawalParam.withdrawalUSD is the amount withdrawn, not cost).
@@ -34464,8 +34589,42 @@ function useFiatWithdrawal({
34464
34589
  // the (possibly clamped) source requirement to deliver the order.
34465
34590
  userInputAmount: finalQuote.estTotalFromAmount
34466
34591
  });
34467
- if (txHash) {
34592
+ if (submission) {
34593
+ const { txHash, executionType } = submission;
34468
34594
  submittedOrderIdsRef.current.add(order.orderId);
34595
+ onSubmitted(
34596
+ order,
34597
+ {
34598
+ checkout: checkoutItem,
34599
+ destinationAddress: order.destinationAddress,
34600
+ executionType,
34601
+ historicalUserId: null,
34602
+ paymentMethodInfo: createPaymentMethodInfo({
34603
+ paymentMethod: PaymentMethod.ACCOUNT_BALANCE,
34604
+ walletAddress: userAddress
34605
+ }),
34606
+ quote: finalEstimation,
34607
+ source: {
34608
+ chainId: String(legs.sourceChainId),
34609
+ tokenAddress: legs.sourceTokenAddress,
34610
+ ticker: config.sourceTokenSymbol
34611
+ },
34612
+ sourceAddress: userAddress,
34613
+ sourceAssetAmount: finalQuote.estTotalFromAmount,
34614
+ target: {
34615
+ chainId: String(legs.targetChainId),
34616
+ tokenAddress: legs.targetTokenAddress,
34617
+ ticker: legs.targetTokenSymbol
34618
+ },
34619
+ targetAssetAmount: resolveQuotedTargetAmount(
34620
+ finalQuote,
34621
+ targetDecimals
34622
+ ),
34623
+ tradeType,
34624
+ txHash
34625
+ },
34626
+ txHash
34627
+ );
34469
34628
  logger.info("fiat-withdrawal:submitted", {
34470
34629
  order_id: order.orderId,
34471
34630
  txHash
@@ -34506,6 +34665,7 @@ function WithdrawalSwappedIframeController({
34506
34665
  const { logEvent } = useTrack();
34507
34666
  const { trackIframeStepViewed } = useTrackSwappedIframeEvents("withdraw");
34508
34667
  const logEventV2 = useTrackV2();
34668
+ const { trackExecutionTransactionSubmitted } = useTrackExecutionProgressEvents("withdraw");
34509
34669
  const { t } = useFunkitTranslation();
34510
34670
  const queryClient = useQueryClient3();
34511
34671
  const hasFiredReadyRef = useRef40(false);
@@ -34522,7 +34682,14 @@ function WithdrawalSwappedIframeController({
34522
34682
  const { processOrder } = useFiatWithdrawal({
34523
34683
  config: activeConfig,
34524
34684
  withdrawalItem,
34525
- onError
34685
+ onError,
34686
+ onSubmitted: (order, execution, txHash) => {
34687
+ trackExecutionTransactionSubmitted(
34688
+ execution,
34689
+ txHash,
34690
+ buildSwappedWithdrawalOrderProperties(order)
34691
+ );
34692
+ }
34526
34693
  });
34527
34694
  const getTrackMetadata = useEffectEvent(
34528
34695
  (extras) => ({
@@ -34652,7 +34819,8 @@ function WithdrawalSwappedIframeController({
34652
34819
  destinationAddress: msg.data.address,
34653
34820
  amount: msg.data.amount,
34654
34821
  providerCrypto: msg.data.crypto,
34655
- providerNetwork: msg.data.network
34822
+ providerNetwork: msg.data.network,
34823
+ providerTimestamp: msg.data.timestamp
34656
34824
  });
34657
34825
  break;
34658
34826
  }
@@ -35114,6 +35282,7 @@ function useTrackWithdrawalEvents({
35114
35282
  logEventV2("fc_step_viewed" /* STEP_VIEWED */, () => ({
35115
35283
  flow: "withdraw",
35116
35284
  is_back_navigation: !isNewWithdrawal && isBackNavigation,
35285
+ resumed: false,
35117
35286
  prev_step: previousStep ? formatAnalyticsStep(previousStep) : null,
35118
35287
  step: formatAnalyticsStep(step),
35119
35288
  step_index: nextStepIndex
@@ -37872,7 +38041,7 @@ import {
37872
38041
 
37873
38042
  // src/domains/convert/balances.ts
37874
38043
  import { isSolanaChainId as isSolanaChainId5 } from "@funkit/chains";
37875
- import { formatUnits as formatUnits6, getAddress as getAddress4, isAddress as isAddress3 } from "viem";
38044
+ import { formatUnits as formatUnits7, getAddress as getAddress4, isAddress as isAddress3 } from "viem";
37876
38045
 
37877
38046
  // src/domains/convert/hostTimeout.ts
37878
38047
  var HOST_TIMEOUT_MS = 1e4;
@@ -37914,7 +38083,7 @@ function getConvertAssetAmount(balance2, decimals) {
37914
38083
  if (balance2?.status !== "available") {
37915
38084
  return void 0;
37916
38085
  }
37917
- return Number(formatUnits6(BigInt(balance2.baseUnits), decimals));
38086
+ return Number(formatUnits7(BigInt(balance2.baseUnits), decimals));
37918
38087
  }
37919
38088
  function isEmptyConvertBalance(balance2) {
37920
38089
  return balance2?.status === "available" && BigInt(balance2.baseUnits) === 0n;
@@ -37961,7 +38130,7 @@ function getConvertUsdAmount(balance2, decimals) {
37961
38130
  if (balance2?.status !== "available") {
37962
38131
  return void 0;
37963
38132
  }
37964
- return Number(formatUnits6(BigInt(balance2.baseUnits), decimals)) * balance2.unitPriceUsd;
38133
+ return Number(formatUnits7(BigInt(balance2.baseUnits), decimals)) * balance2.unitPriceUsd;
37965
38134
  }
37966
38135
  function getConvertMaxAmount({
37967
38136
  asset,
@@ -38222,7 +38391,7 @@ function getConvertPreselectedSource(options) {
38222
38391
 
38223
38392
  // src/domains/convert/inputAmount.ts
38224
38393
  import * as dnum8 from "dnum";
38225
- import { formatUnits as formatUnits7, parseUnits as parseUnits3 } from "viem";
38394
+ import { formatUnits as formatUnits8, parseUnits as parseUnits3 } from "viem";
38226
38395
 
38227
38396
  // src/components/TokenSwapWidget/AmountUnitToggle/useAmountUnitToggle.ts
38228
38397
  import { round as round3 } from "@funkit/utils";
@@ -38301,7 +38470,7 @@ function formatConvertPresetInput({
38301
38470
  unit,
38302
38471
  unitPriceUsd
38303
38472
  }) {
38304
- const tokenAmount = formatUnits7(baseUnits, decimals);
38473
+ const tokenAmount = formatUnits8(baseUnits, decimals);
38305
38474
  if (unit === "usd" && !unitPriceUsd) {
38306
38475
  return "";
38307
38476
  }
@@ -38332,7 +38501,7 @@ function getConvertPresetDisplay({
38332
38501
  unit,
38333
38502
  unitPriceUsd
38334
38503
  }) {
38335
- const tokenAmount = Number(formatUnits7(presetBaseUnits, decimals));
38504
+ const tokenAmount = Number(formatUnits8(presetBaseUnits, decimals));
38336
38505
  return {
38337
38506
  inputValue: formatConvertPresetInput({
38338
38507
  baseUnits: presetBaseUnits,
@@ -38494,7 +38663,7 @@ import { RelayQuoteError as RelayQuoteError4 } from "@funkit/api-base";
38494
38663
  import { parseBigInt as parseBigInt2 } from "@funkit/connect-core";
38495
38664
  import { formatCurrencyAndStringify as formatCurrencyAndStringify10 } from "@funkit/utils";
38496
38665
  import React200 from "react";
38497
- import { formatUnits as formatUnits8 } from "viem";
38666
+ import { formatUnits as formatUnits9 } from "viem";
38498
38667
 
38499
38668
  // src/domains/convert/quote.ts
38500
38669
  import { fetchExactInQuote, toClientMetadataQuote } from "@funkit/connect-core";
@@ -38895,7 +39064,7 @@ function getConvertReceiveAmounts(quote, decimals) {
38895
39064
  }
38896
39065
  const amountUsd = quote.response.metadata?.relayQuote?.details?.currencyOut?.amountUsd;
38897
39066
  return {
38898
- tokenAmount: Number(formatUnits8(amountOut, decimals)),
39067
+ tokenAmount: Number(formatUnits9(amountOut, decimals)),
38899
39068
  usdAmount: amountUsd === void 0 ? void 0 : Number(amountUsd)
38900
39069
  };
38901
39070
  }
@@ -40731,6 +40900,7 @@ var useFops = ({
40731
40900
  const themeConfig = useSwappedThemeQueryParams();
40732
40901
  const targetAsset = checkoutItem?.initSettings.config.targetAsset;
40733
40902
  const targetChain = checkoutItem?.initSettings.config.targetChain;
40903
+ const checkoutId = checkoutItem?.id;
40734
40904
  const defaultMinAmountEur = useMinTransferValueEur(Number(targetChain));
40735
40905
  const baseCurrencyAmount = getSwappedDefaultInputAmount(
40736
40906
  defaultInputAmountConfig,
@@ -40746,9 +40916,12 @@ var useFops = ({
40746
40916
  const isEnabled = isSwappedEnabled && !comingSoon && !!apiKey && !!targetAsset && !!targetChain && !isSwappedCurrencyCodeLoading && isValidRecipientAddress && !!transferInit && !!countryCode;
40747
40917
  const query = useQuery19({
40748
40918
  // `prefillFiatEmail` is intentionally NOT in the queryKey: it's read inside
40749
- // `queryFn` and captured at fetch time, so post-mount changes don't trigger a refetch
40919
+ // `queryFn` and captured at fetch time, so post-mount changes don't trigger a refetch.
40920
+ // `checkoutId` is in the key: the server signs it into provider order
40921
+ // references, so a cached response must not serve a later checkout.
40750
40922
  queryKey: [
40751
40923
  "fops",
40924
+ checkoutId,
40752
40925
  userId,
40753
40926
  recipientAddress,
40754
40927
  walletAddress,
@@ -40783,6 +40956,7 @@ var useFops = ({
40783
40956
  const response = await getFops3({
40784
40957
  apiKey,
40785
40958
  logger,
40959
+ checkoutId,
40786
40960
  params: {
40787
40961
  // recipientAddress and destinationToken are required by the backend's
40788
40962
  // Zod schema but ignored when railConfigs is present — the
@@ -56847,7 +57021,7 @@ import React311 from "react";
56847
57021
 
56848
57022
  // src/domains/destinationAssetBalance.ts
56849
57023
  import { formatNumberAndStringify } from "@funkit/utils";
56850
- import { formatUnits as formatUnits9 } from "viem";
57024
+ import { formatUnits as formatUnits10 } from "viem";
56851
57025
  function formatDestinationAssetAmount(tokenAmount) {
56852
57026
  const amount = Number(tokenAmount);
56853
57027
  if (amount > 0 && amount < 0.01) {
@@ -56866,7 +57040,7 @@ function toDestinationAssetBalanceState(balance2, decimals) {
56866
57040
  if (balance2.status === "unavailable") {
56867
57041
  return { status: "unavailable" };
56868
57042
  }
56869
- const tokenAmount = formatUnits9(BigInt(balance2.baseUnits), decimals);
57043
+ const tokenAmount = formatUnits10(BigInt(balance2.baseUnits), decimals);
56870
57044
  return {
56871
57045
  status: "ready",
56872
57046
  tokenAmount,
@@ -58527,9 +58701,7 @@ function SwappedIframeController({
58527
58701
  setModalState
58528
58702
  }) {
58529
58703
  const { logEvent, logMeasuredEvent, startMeasuredEvent } = useTrack();
58530
- const { trackIframeStepViewed } = useTrackSwappedIframeEvents(
58531
- getCheckoutModalAnalyticsFlow(modalState)
58532
- );
58704
+ const { trackIframeStepViewed, trackIframeTransactionSubmitted } = useTrackSwappedIframeEvents(getCheckoutModalAnalyticsFlow(modalState));
58533
58705
  const logEventV2 = useTrackV2();
58534
58706
  const { t } = useFunkitTranslation();
58535
58707
  const queryClient = useQueryClient8();
@@ -58674,6 +58846,7 @@ function SwappedIframeController({
58674
58846
  break;
58675
58847
  }
58676
58848
  case "SWAPPED_TRANSACTION_SUCCESSFUL": {
58849
+ trackIframeTransactionSubmitted(msg.data, selectedPaymentOption.fopType);
58677
58850
  const trackEvent = getTrackEvent(
58678
58851
  "fc::swapped_iframe::transaction_successful" /* SWAPPED_IFRAME_TRANSACTION_SUCCESSFUL */,
58679
58852
  { data: JSON.stringify(msg.data ?? {}) }
@@ -60313,6 +60486,7 @@ function useCheckoutModalTransition(checkoutItem, onClose, isModalOpen) {
60313
60486
  logEventV2("fc_step_viewed" /* STEP_VIEWED */, () => ({
60314
60487
  flow: getCheckoutModalAnalyticsFlow(nextState),
60315
60488
  is_back_navigation: metadata.isBackNavigation,
60489
+ resumed: false,
60316
60490
  prev_step: previousVisibleStep ? formatAnalyticsStep(previousVisibleStep) : null,
60317
60491
  step: formatAnalyticsStep(nextState.step),
60318
60492
  step_index: metadata.stepIndex
@@ -61187,7 +61361,7 @@ function ConnectButtonRenderer({
61187
61361
  // TypeError: Do not know how to serialize a BigInt
61188
61362
  query: { structuralSharing: false }
61189
61363
  });
61190
- const balanceFormatted = balanceData ? formatUnits10(balanceData.value, balanceData.decimals) : void 0;
61364
+ const balanceFormatted = balanceData ? formatUnits11(balanceData.value, balanceData.decimals) : void 0;
61191
61365
  const balanceNativeAmount = balanceData && balanceFormatted ? `${abbreviateETHBalance(Number.parseFloat(balanceFormatted))} ${balanceData.symbol}` : void 0;
61192
61366
  const displayBalance = formatCurrencyAndStringify19(
61193
61367
  Number.parseFloat(totalWalletAssetsUsd.toString())