@funkit/connect 13.1.0 → 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.
Files changed (46) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/clients/internal/nado/withdrawalForm.js +1 -1
  3. package/dist/hooks/track/analytics/events.d.ts +8 -20
  4. package/dist/hooks/track/analytics/swappedWithdrawalOrder.d.ts +10 -0
  5. package/dist/hooks/track/analytics/useTrackExecutionProgressEvents.d.ts +2 -2
  6. package/dist/index.js +122 -32
  7. package/dist/modals/WithdrawalModal/useFiatWithdrawal.d.ts +5 -2
  8. package/dist/modals/WithdrawalModal/useWithdrawal.d.ts +3 -2
  9. package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
  10. package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
  11. package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
  12. package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
  13. package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
  14. package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
  15. package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
  16. package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
  17. package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
  18. package/dist/wallets/walletConnectors/index.js +50 -50
  19. package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
  20. package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
  21. package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
  22. package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
  23. package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
  24. package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
  25. package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
  26. package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
  27. package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
  28. package/package.json +7 -7
  29. package/dist/wallets/walletConnectors/{chunk-OVDCDVFX.js → chunk-34B7OJNT.js} +3 -3
  30. package/dist/wallets/walletConnectors/{chunk-JJBLW4IU.js → chunk-4FHNLTR3.js} +3 -3
  31. package/dist/wallets/walletConnectors/{chunk-TM7UBV3Q.js → chunk-ALGPGI6V.js} +3 -3
  32. package/dist/wallets/walletConnectors/{chunk-MWB6LFSG.js → chunk-BBB2J3US.js} +3 -3
  33. package/dist/wallets/walletConnectors/{chunk-IWPW26AL.js → chunk-BBDNB5TQ.js} +3 -3
  34. package/dist/wallets/walletConnectors/{chunk-53MYTA42.js → chunk-CU5J53XR.js} +3 -3
  35. package/dist/wallets/walletConnectors/{chunk-USLZMUJ3.js → chunk-HOCKAU5H.js} +3 -3
  36. package/dist/wallets/walletConnectors/{chunk-RJF2YEZ5.js → chunk-IA5432IR.js} +3 -3
  37. package/dist/wallets/walletConnectors/{chunk-ASTCNVJC.js → chunk-IWOMSW64.js} +3 -3
  38. package/dist/wallets/walletConnectors/{chunk-KE4CWI3A.js → chunk-NXWG6FG2.js} +3 -3
  39. package/dist/wallets/walletConnectors/{chunk-RQYEGJKL.js → chunk-RFCZYLNR.js} +3 -3
  40. package/dist/wallets/walletConnectors/{chunk-ANODOMIN.js → chunk-RXRYHMRI.js} +3 -3
  41. package/dist/wallets/walletConnectors/{chunk-PPQ6L4K2.js → chunk-SR5CZR3L.js} +3 -3
  42. package/dist/wallets/walletConnectors/{chunk-TIHTQ3OB.js → chunk-TRZDAXCQ.js} +3 -3
  43. package/dist/wallets/walletConnectors/{chunk-F45CUFRR.js → chunk-U52QO5HF.js} +3 -3
  44. package/dist/wallets/walletConnectors/{chunk-A5POD5SV.js → chunk-XODA5ESL.js} +3 -3
  45. package/dist/wallets/walletConnectors/{chunk-FYPQ3HP4.js → chunk-YRMBR6NA.js} +3 -3
  46. package/dist/wallets/walletConnectors/{chunk-65ULY6OC.js → chunk-ZSSSLFQF.js} +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @funkit/connect
2
2
 
3
+ ## 13.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - c421418: Forms-of-payment requests send the active checkout ID, so hosted MoonPay orders are attributed to the checkout that opened them.
8
+ - 19cfb48: Share screen analytics names and metadata across SDKs while preserving existing web events.
9
+ - 486b8f7: Upgrade storybook to 10.6.2 to patch CVE-2026-114125 (CVSS 9.4)
10
+ - 78f8b72: Emit withdrawal submission analytics with order details for Swapped withdrawals.
11
+ - Updated dependencies [f2797f6]
12
+ - Updated dependencies [77e23f1]
13
+ - Updated dependencies [2dbf107]
14
+ - Updated dependencies [643efb7]
15
+ - Updated dependencies [f2797f6]
16
+ - Updated dependencies [1822d7e]
17
+ - Updated dependencies [f2797f6]
18
+ - Updated dependencies [c421418]
19
+ - Updated dependencies [cfe6b5a]
20
+ - Updated dependencies [19cfb48]
21
+ - Updated dependencies [351e0a9]
22
+ - Updated dependencies [072ec92]
23
+ - @funkit/connect-core@17.0.0
24
+ - @funkit/api-base@10.4.0
25
+
3
26
  ## 13.1.0
4
27
 
5
28
  ### Minor Changes
@@ -2,7 +2,6 @@
2
2
  import {
3
3
  isNadoWithdrawalConfig
4
4
  } from "../../chunk-LCYJLY4X.js";
5
- import "../../chunk-LICTGZXW.js";
6
5
  import "../../chunk-PZSKO3BJ.js";
7
6
  import {
8
7
  useFunkitConfig
@@ -10,6 +9,7 @@ import {
10
9
  import {
11
10
  useFunkitTranslation
12
11
  } from "../../chunk-ZEXIDBIZ.js";
12
+ import "../../chunk-LICTGZXW.js";
13
13
  import "../../chunk-2W2P3OS6.js";
14
14
  import "../../chunk-ZBBYOJWK.js";
15
15
  import {
@@ -2,11 +2,10 @@ import type { QuoteMode } from '../../../domains/quoteMode';
2
2
  import type { DirectExecutionType, FormOfPaymentType } from '@funkit/api-base';
3
3
  import type { CheckoutStatus } from '../../../domains/checkout';
4
4
  import type { PaymentMethodType } from '../../../hooks/usePaymentSources';
5
- import type { FunCheckoutStep } from '../../../modals/CheckoutModal/FunCheckoutStep';
6
5
  import type { AmountSelectionType } from '../../../modals/CheckoutModal/InputAmount/state';
7
- import type { WithdrawalModalStep } from '../../../modals/WithdrawalModal/types';
8
6
  import type { FunNotificationType } from '../../../components/FunNotification/FunNotification';
9
- import type { PaymentMethod } from '@funkit/connect-core';
7
+ import type { AnalyticsStep, PaymentMethod, StepViewedProperties as SharedStepViewedProperties } from '@funkit/connect-core';
8
+ export type { AnalyticsStep } from '@funkit/connect-core';
10
9
  /**
11
10
  * Analytics v2 — the improved, explicit Statsig event scheme that will replace
12
11
  * the `fc::`/`fw::` enums in `../CheckoutModalEvent.ts` / `../WithdrawModalEvent.ts`.
@@ -47,7 +46,6 @@ export declare enum AnalyticsEvent {
47
46
  export type ConnectionStatus = 'new' | 'existing';
48
47
  export type AnalyticsFlow = 'deposit' | 'withdraw' | 'convert';
49
48
  export type AnalyticsPaymentRail = 'swapped' | 'meld' | 'bridge';
50
- export type AnalyticsStep = Lowercase<FunCheckoutStep | WithdrawalModalStep>;
51
49
  export type ModalClosedAction = 'close' | 'new_deposit' | 'new_withdrawal';
52
50
  export type ModalCompletionState = 'completed' | 'not_completed' | 'undetected';
53
51
  /** Envelope carried by every analytics-v2 event. */
@@ -217,6 +215,11 @@ export type TransactionSubmittedProperties = Omit<ExecutionTransactionSnapshotPr
217
215
  quote_id: string | null;
218
216
  payment_rail?: AnalyticsPaymentRail | null;
219
217
  order_id?: string | null;
218
+ /** Original provider order values, distinct from the executed quote amounts. */
219
+ order_amount?: string | null;
220
+ order_asset?: string | null;
221
+ order_network?: string | null;
222
+ order_timestamp?: number | null;
220
223
  };
221
224
  export type ExecutionSucceededProperties = ExecutionTransactionSnapshotProperties & {
222
225
  fulfillment_time_ms: number | null;
@@ -267,23 +270,8 @@ export type TabSwitchedProperties = {
267
270
  switch_count: number;
268
271
  tab: PaymentMethodType;
269
272
  };
270
- export type StepViewedProperties = {
273
+ export type StepViewedProperties = SharedStepViewedProperties & {
271
274
  flow: AnalyticsFlow;
272
- /**
273
- * Whether the user initiated a back navigation gesture. Note that we support
274
- * back navigation by step name, which falls back to pushing the step instead
275
- * if it's not already in history. Thus, `step_index` may still be incremented
276
- * even if `is_back_navigation` is true.
277
- */
278
- is_back_navigation: boolean;
279
- prev_step: AnalyticsStep | null;
280
- step: AnalyticsStep;
281
- /**
282
- * 1-based index of the step being entered. When navigating backward, we attempt
283
- * to preserve the original index of the step when it was first entered. When
284
- * navigating forward, it is incremented by 1.
285
- */
286
- step_index: number;
287
275
  };
288
276
  /** Payload specific to {@link AnalyticsEvent.IFRAME_STEP_VIEWED}. */
289
277
  export type IframeStepViewedProperties = {
@@ -0,0 +1,10 @@
1
+ import type { FiatWithdrawalOrder } from '../../../modals/WithdrawalModal/useFiatWithdrawal';
2
+ /** Preserve provider values without conflating them with the executed route. */
3
+ export declare function buildSwappedWithdrawalOrderProperties(order: FiatWithdrawalOrder): {
4
+ payment_rail: 'swapped';
5
+ order_id: string;
6
+ order_amount: string;
7
+ order_asset: string | null;
8
+ order_network: string | null;
9
+ order_timestamp: number | null;
10
+ };
@@ -1,6 +1,6 @@
1
1
  import type { NotificationItem } from '../../../modals/CheckoutModal/TransferToken/types';
2
2
  import { type ExecutionTransactionSubmittedArgs } from './resolveExecutionProgressContext';
3
- import { AnalyticsEvent, type ExecutionTransactionSnapshotProperties } from './events';
3
+ import { AnalyticsEvent, type ExecutionTransactionSnapshotProperties, type TransactionSubmittedProperties } from './events';
4
4
  export type TrackExecutionSucceededArgs = ExecutionTransactionSubmittedArgs & {
5
5
  fulfillmentTimeMs: number | null;
6
6
  };
@@ -28,6 +28,6 @@ export declare function useTrackExecutionProgressEvents(flow: ExecutionFlow): {
28
28
  trackExecutionFailed: (args: TrackExecutionFailedArgs, claimKey: string) => void;
29
29
  trackExecutionProgressEvents: (historyItem: NotificationItem) => void;
30
30
  trackExecutionSucceeded: (args: TrackExecutionSucceededArgs, claimKey: string) => void;
31
- trackExecutionTransactionSubmitted: (args: ExecutionTransactionSubmittedArgs, claimKey: string) => void;
31
+ trackExecutionTransactionSubmitted: (args: ExecutionTransactionSubmittedArgs, claimKey: string, providerProperties?: Pick<TransactionSubmittedProperties, "order_amount" | "order_asset" | "order_id" | "order_network" | "order_timestamp" | "payment_rail"> | undefined) => void;
32
32
  };
33
33
  export {};
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.1.0";
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";
@@ -23882,6 +23882,7 @@ var useSwappedExchanges = () => {
23882
23882
  const fopPriority = useDynamicConfig("foppriority");
23883
23883
  const targetAsset = checkoutItem?.initSettings.config.targetAsset;
23884
23884
  const targetChain = checkoutItem?.initSettings.config.targetChain;
23885
+ const checkoutId = checkoutItem?.id;
23885
23886
  const defaultMinAmountEur = useMinTransferValueEur(Number(targetChain));
23886
23887
  const recipientTargets = useMemo30(() => {
23887
23888
  if (!transferInit || !targetChain || !targetAsset) {
@@ -23942,8 +23943,11 @@ var useSwappedExchanges = () => {
23942
23943
  const countryCode = userIpInfo?.alpha2;
23943
23944
  const isEnabled = isSwappedExchangesEnabled && !!apiKey && !!userId && !!countryCode && !!transferInit && recipientTargets.length > 0 && !isSwappedCurrencyCodeLoading;
23944
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.
23945
23948
  queryKey: [
23946
23949
  "cryptoToCryptoFops",
23950
+ checkoutId,
23947
23951
  userId,
23948
23952
  countryCode,
23949
23953
  swappedCurrencyCode,
@@ -23960,6 +23964,7 @@ var useSwappedExchanges = () => {
23960
23964
  const response = await getFops({
23961
23965
  apiKey,
23962
23966
  logger,
23967
+ checkoutId,
23963
23968
  params: {
23964
23969
  recipientAddress: primary.recipientAddress,
23965
23970
  userId,
@@ -27973,7 +27978,7 @@ function useTrackExecutionProgressEvents(flow) {
27973
27978
  const { connectorId } = useGeneralWallet();
27974
27979
  const names = eventNames[flow];
27975
27980
  const trackExecutionTransactionSubmitted = useEffectEvent(
27976
- (args, claimKey) => {
27981
+ (args, claimKey, providerProperties) => {
27977
27982
  if (!claimAnalyticsEvent(names.submitted, claimKey)) {
27978
27983
  return;
27979
27984
  }
@@ -27981,7 +27986,8 @@ function useTrackExecutionProgressEvents(flow) {
27981
27986
  flow,
27982
27987
  ...buildExecutionTransactionSnapshotProperties(args, connectorId),
27983
27988
  est_fulfillment_time_ms: args.quote?.finalTimeEstimationMs ?? null,
27984
- quote_id: args.quote?.baseQuote.quoteId ?? null
27989
+ quote_id: args.quote?.baseQuote.quoteId ?? null,
27990
+ ...providerProperties
27985
27991
  }));
27986
27992
  }
27987
27993
  );
@@ -31239,12 +31245,12 @@ function useWithdrawal({
31239
31245
  targetChainId: formData.chainId
31240
31246
  }
31241
31247
  );
31242
- const txHash = confirmation?.transactionSubmitted?.txHash;
31248
+ const submission = confirmation?.transactionSubmitted;
31243
31249
  withdrawalItem?.initSettings.onWithdrawalConfirmation?.(
31244
31250
  formData.destinationAddress,
31245
31251
  formData
31246
31252
  );
31247
- if (!txHash) {
31253
+ if (!submission?.txHash) {
31248
31254
  const invalidTxHashError = new Error(
31249
31255
  "Invalid txHash - unable to proceed with withdrawal"
31250
31256
  );
@@ -31254,7 +31260,7 @@ function useWithdrawal({
31254
31260
  });
31255
31261
  throw invalidTxHashError;
31256
31262
  }
31257
- return txHash;
31263
+ return submission;
31258
31264
  }
31259
31265
  async function callbackWithdrawal(customConfig) {
31260
31266
  const quoteId = formData.quote?.baseQuote.quoteId ?? SYNTHETIC_QUOTELESS_QUOTE_ID;
@@ -31292,11 +31298,14 @@ function useWithdrawal({
31292
31298
  await onBeforeSign();
31293
31299
  customCallbackFailed = false;
31294
31300
  }
31295
- let txHash;
31301
+ let submission;
31296
31302
  if (isWalletWithdrawalConfig(config)) {
31297
- txHash = await walletWithdrawal(config);
31303
+ submission = await walletWithdrawal(config);
31298
31304
  } else if (isCustomWithdrawalConfig(config)) {
31299
- txHash = await callbackWithdrawal(config);
31305
+ submission = {
31306
+ txHash: await callbackWithdrawal(config),
31307
+ executionType: null
31308
+ };
31300
31309
  } else {
31301
31310
  const invalidConfigError = new Error("Invalid withdrawal config");
31302
31311
  logger.error("withdrawal:invalidConfig", invalidConfigError, {
@@ -31311,8 +31320,8 @@ function useWithdrawal({
31311
31320
  stepMessage: step,
31312
31321
  withdrawalAmountUSD: formData.withdrawalUSD
31313
31322
  });
31314
- onSuccess?.(formData, txHash);
31315
- return txHash;
31323
+ onSuccess?.(formData, submission.txHash);
31324
+ return submission;
31316
31325
  } catch (err) {
31317
31326
  const caughtError = err instanceof Error ? err : new Error("Unknown withdrawal error");
31318
31327
  const isNestedError = caughtError.message === "Invalid txHash - unable to proceed with withdrawal" || caughtError.message === "Invalid withdrawal config";
@@ -33222,6 +33231,7 @@ var useWithdrawFops = (params) => {
33222
33231
  const { apiKey } = useFunkitConfig();
33223
33232
  const { userInfo } = useGeneralWallet();
33224
33233
  const { prefillFiatEmail } = useIdentity();
33234
+ const checkoutId = useCheckoutContext().checkoutItem?.id;
33225
33235
  const { userIpInfo, isLoadingGeoCheck } = useFunkitUserIp();
33226
33236
  const {
33227
33237
  data: swappedCurrencyCode = "USD",
@@ -33248,9 +33258,12 @@ var useWithdrawFops = (params) => {
33248
33258
  const isEnablePending = !isEnabled && hasRequiredInputs && (params.enablePending === true || params.enabled !== false) && (params.enablePending === true || isLoadingGeoCheck || isSwappedCurrencyCodeLoading);
33249
33259
  const query = useQuery14({
33250
33260
  // `prefillFiatEmail` is intentionally NOT in the queryKey: it's read inside
33251
- // `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.
33252
33264
  queryKey: [
33253
33265
  "withdrawFops",
33266
+ checkoutId,
33254
33267
  userId,
33255
33268
  countryCode,
33256
33269
  swappedCurrencyCode,
@@ -33308,6 +33321,7 @@ var useWithdrawFops = (params) => {
33308
33321
  const response = await getFops2({
33309
33322
  apiKey,
33310
33323
  logger,
33324
+ checkoutId,
33311
33325
  params: {
33312
33326
  // recipientAddress and destinationToken are required by the backend's
33313
33327
  // Zod schema but ignored for off-ramp — the CRYPTO_TO_FIAT handler
@@ -34147,6 +34161,18 @@ function resolveIframeStepNavigation(history, nextStep) {
34147
34161
  };
34148
34162
  }
34149
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
+
34150
34176
  // src/hooks/track/analytics/swappedIframeSubmission.ts
34151
34177
  function buildSwappedIframeSubmissionProperties(data, fopType, checkoutId, config) {
34152
34178
  const payload = typeof data === "object" && data !== null ? data : {};
@@ -34290,6 +34316,7 @@ function buildPerfIframeReadyProperties(args) {
34290
34316
  // src/modals/WithdrawalModal/useFiatWithdrawal.ts
34291
34317
  import { getCheckoutQuoteV2 as getCheckoutQuoteV22 } from "@funkit/api-base";
34292
34318
  import { useEffect as useEffect56, useRef as useRef39 } from "react";
34319
+ import { formatUnits as formatUnits6 } from "viem";
34293
34320
  import { safeBigInt as safeBigInt2 } from "@funkit/connect-core";
34294
34321
  import {
34295
34322
  findSwappedSourceOverride as findSwappedSourceOverride2,
@@ -34362,7 +34389,7 @@ async function quoteOrderExactOut(ctx) {
34362
34389
  toAmountBaseUnit
34363
34390
  });
34364
34391
  const estimation = await estimateQuote(quote, ctx);
34365
- return { quote, estimation };
34392
+ return { quote, estimation, targetDecimals };
34366
34393
  }
34367
34394
  async function quoteOrderExactIn(ctx, fromAmountBaseUnit) {
34368
34395
  const { apiKey, userAddress, legs, order } = ctx;
@@ -34380,10 +34407,21 @@ async function quoteOrderExactIn(ctx, fromAmountBaseUnit) {
34380
34407
  const estimation = await estimateQuote(quote, ctx);
34381
34408
  return { quote, estimation };
34382
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
+ }
34383
34420
  function useFiatWithdrawal({
34384
34421
  config,
34385
34422
  withdrawalItem,
34386
- onError
34423
+ onError,
34424
+ onSubmitted
34387
34425
  }) {
34388
34426
  const wagmiConfig = useConfig();
34389
34427
  const { apiKey } = useFunkitConfig();
@@ -34496,7 +34534,8 @@ function useFiatWithdrawal({
34496
34534
  legs,
34497
34535
  order
34498
34536
  };
34499
- const { quote, estimation } = await quoteOrderExactOut(quoteContext);
34537
+ const { quote, estimation, targetDecimals } = await quoteOrderExactOut(quoteContext);
34538
+ let tradeType = "EXACT_OUT" /* EXACT_OUT */;
34500
34539
  let finalQuote = quote;
34501
34540
  let finalEstimation = estimation;
34502
34541
  const balance2 = resolveWithdrawalSourceTokenBalance2(
@@ -34530,11 +34569,12 @@ function useFiatWithdrawal({
34530
34569
  balanceBaseUnit: balanceBaseUnit.toString()
34531
34570
  });
34532
34571
  const clamped = await quoteOrderExactIn(quoteContext, balanceBaseUnit);
34572
+ tradeType = "EXACT_IN" /* EXACT_IN */;
34533
34573
  finalQuote = clamped.quote;
34534
34574
  finalEstimation = clamped.estimation;
34535
34575
  }
34536
34576
  }
34537
- const txHash = await handleWithdrawal({
34577
+ const submission = await handleWithdrawal({
34538
34578
  destinationAddress: order.destinationAddress,
34539
34579
  // Fee-exclusive value of the withdrawal, matching the standard form
34540
34580
  // (WithdrawalParam.withdrawalUSD is the amount withdrawn, not cost).
@@ -34549,8 +34589,42 @@ function useFiatWithdrawal({
34549
34589
  // the (possibly clamped) source requirement to deliver the order.
34550
34590
  userInputAmount: finalQuote.estTotalFromAmount
34551
34591
  });
34552
- if (txHash) {
34592
+ if (submission) {
34593
+ const { txHash, executionType } = submission;
34553
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
+ );
34554
34628
  logger.info("fiat-withdrawal:submitted", {
34555
34629
  order_id: order.orderId,
34556
34630
  txHash
@@ -34591,6 +34665,7 @@ function WithdrawalSwappedIframeController({
34591
34665
  const { logEvent } = useTrack();
34592
34666
  const { trackIframeStepViewed } = useTrackSwappedIframeEvents("withdraw");
34593
34667
  const logEventV2 = useTrackV2();
34668
+ const { trackExecutionTransactionSubmitted } = useTrackExecutionProgressEvents("withdraw");
34594
34669
  const { t } = useFunkitTranslation();
34595
34670
  const queryClient = useQueryClient3();
34596
34671
  const hasFiredReadyRef = useRef40(false);
@@ -34607,7 +34682,14 @@ function WithdrawalSwappedIframeController({
34607
34682
  const { processOrder } = useFiatWithdrawal({
34608
34683
  config: activeConfig,
34609
34684
  withdrawalItem,
34610
- onError
34685
+ onError,
34686
+ onSubmitted: (order, execution, txHash) => {
34687
+ trackExecutionTransactionSubmitted(
34688
+ execution,
34689
+ txHash,
34690
+ buildSwappedWithdrawalOrderProperties(order)
34691
+ );
34692
+ }
34611
34693
  });
34612
34694
  const getTrackMetadata = useEffectEvent(
34613
34695
  (extras) => ({
@@ -34737,7 +34819,8 @@ function WithdrawalSwappedIframeController({
34737
34819
  destinationAddress: msg.data.address,
34738
34820
  amount: msg.data.amount,
34739
34821
  providerCrypto: msg.data.crypto,
34740
- providerNetwork: msg.data.network
34822
+ providerNetwork: msg.data.network,
34823
+ providerTimestamp: msg.data.timestamp
34741
34824
  });
34742
34825
  break;
34743
34826
  }
@@ -35199,6 +35282,7 @@ function useTrackWithdrawalEvents({
35199
35282
  logEventV2("fc_step_viewed" /* STEP_VIEWED */, () => ({
35200
35283
  flow: "withdraw",
35201
35284
  is_back_navigation: !isNewWithdrawal && isBackNavigation,
35285
+ resumed: false,
35202
35286
  prev_step: previousStep ? formatAnalyticsStep(previousStep) : null,
35203
35287
  step: formatAnalyticsStep(step),
35204
35288
  step_index: nextStepIndex
@@ -37957,7 +38041,7 @@ import {
37957
38041
 
37958
38042
  // src/domains/convert/balances.ts
37959
38043
  import { isSolanaChainId as isSolanaChainId5 } from "@funkit/chains";
37960
- 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";
37961
38045
 
37962
38046
  // src/domains/convert/hostTimeout.ts
37963
38047
  var HOST_TIMEOUT_MS = 1e4;
@@ -37999,7 +38083,7 @@ function getConvertAssetAmount(balance2, decimals) {
37999
38083
  if (balance2?.status !== "available") {
38000
38084
  return void 0;
38001
38085
  }
38002
- return Number(formatUnits6(BigInt(balance2.baseUnits), decimals));
38086
+ return Number(formatUnits7(BigInt(balance2.baseUnits), decimals));
38003
38087
  }
38004
38088
  function isEmptyConvertBalance(balance2) {
38005
38089
  return balance2?.status === "available" && BigInt(balance2.baseUnits) === 0n;
@@ -38046,7 +38130,7 @@ function getConvertUsdAmount(balance2, decimals) {
38046
38130
  if (balance2?.status !== "available") {
38047
38131
  return void 0;
38048
38132
  }
38049
- return Number(formatUnits6(BigInt(balance2.baseUnits), decimals)) * balance2.unitPriceUsd;
38133
+ return Number(formatUnits7(BigInt(balance2.baseUnits), decimals)) * balance2.unitPriceUsd;
38050
38134
  }
38051
38135
  function getConvertMaxAmount({
38052
38136
  asset,
@@ -38307,7 +38391,7 @@ function getConvertPreselectedSource(options) {
38307
38391
 
38308
38392
  // src/domains/convert/inputAmount.ts
38309
38393
  import * as dnum8 from "dnum";
38310
- import { formatUnits as formatUnits7, parseUnits as parseUnits3 } from "viem";
38394
+ import { formatUnits as formatUnits8, parseUnits as parseUnits3 } from "viem";
38311
38395
 
38312
38396
  // src/components/TokenSwapWidget/AmountUnitToggle/useAmountUnitToggle.ts
38313
38397
  import { round as round3 } from "@funkit/utils";
@@ -38386,7 +38470,7 @@ function formatConvertPresetInput({
38386
38470
  unit,
38387
38471
  unitPriceUsd
38388
38472
  }) {
38389
- const tokenAmount = formatUnits7(baseUnits, decimals);
38473
+ const tokenAmount = formatUnits8(baseUnits, decimals);
38390
38474
  if (unit === "usd" && !unitPriceUsd) {
38391
38475
  return "";
38392
38476
  }
@@ -38417,7 +38501,7 @@ function getConvertPresetDisplay({
38417
38501
  unit,
38418
38502
  unitPriceUsd
38419
38503
  }) {
38420
- const tokenAmount = Number(formatUnits7(presetBaseUnits, decimals));
38504
+ const tokenAmount = Number(formatUnits8(presetBaseUnits, decimals));
38421
38505
  return {
38422
38506
  inputValue: formatConvertPresetInput({
38423
38507
  baseUnits: presetBaseUnits,
@@ -38579,7 +38663,7 @@ import { RelayQuoteError as RelayQuoteError4 } from "@funkit/api-base";
38579
38663
  import { parseBigInt as parseBigInt2 } from "@funkit/connect-core";
38580
38664
  import { formatCurrencyAndStringify as formatCurrencyAndStringify10 } from "@funkit/utils";
38581
38665
  import React200 from "react";
38582
- import { formatUnits as formatUnits8 } from "viem";
38666
+ import { formatUnits as formatUnits9 } from "viem";
38583
38667
 
38584
38668
  // src/domains/convert/quote.ts
38585
38669
  import { fetchExactInQuote, toClientMetadataQuote } from "@funkit/connect-core";
@@ -38980,7 +39064,7 @@ function getConvertReceiveAmounts(quote, decimals) {
38980
39064
  }
38981
39065
  const amountUsd = quote.response.metadata?.relayQuote?.details?.currencyOut?.amountUsd;
38982
39066
  return {
38983
- tokenAmount: Number(formatUnits8(amountOut, decimals)),
39067
+ tokenAmount: Number(formatUnits9(amountOut, decimals)),
38984
39068
  usdAmount: amountUsd === void 0 ? void 0 : Number(amountUsd)
38985
39069
  };
38986
39070
  }
@@ -40816,6 +40900,7 @@ var useFops = ({
40816
40900
  const themeConfig = useSwappedThemeQueryParams();
40817
40901
  const targetAsset = checkoutItem?.initSettings.config.targetAsset;
40818
40902
  const targetChain = checkoutItem?.initSettings.config.targetChain;
40903
+ const checkoutId = checkoutItem?.id;
40819
40904
  const defaultMinAmountEur = useMinTransferValueEur(Number(targetChain));
40820
40905
  const baseCurrencyAmount = getSwappedDefaultInputAmount(
40821
40906
  defaultInputAmountConfig,
@@ -40831,9 +40916,12 @@ var useFops = ({
40831
40916
  const isEnabled = isSwappedEnabled && !comingSoon && !!apiKey && !!targetAsset && !!targetChain && !isSwappedCurrencyCodeLoading && isValidRecipientAddress && !!transferInit && !!countryCode;
40832
40917
  const query = useQuery19({
40833
40918
  // `prefillFiatEmail` is intentionally NOT in the queryKey: it's read inside
40834
- // `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.
40835
40922
  queryKey: [
40836
40923
  "fops",
40924
+ checkoutId,
40837
40925
  userId,
40838
40926
  recipientAddress,
40839
40927
  walletAddress,
@@ -40868,6 +40956,7 @@ var useFops = ({
40868
40956
  const response = await getFops3({
40869
40957
  apiKey,
40870
40958
  logger,
40959
+ checkoutId,
40871
40960
  params: {
40872
40961
  // recipientAddress and destinationToken are required by the backend's
40873
40962
  // Zod schema but ignored when railConfigs is present — the
@@ -56932,7 +57021,7 @@ import React311 from "react";
56932
57021
 
56933
57022
  // src/domains/destinationAssetBalance.ts
56934
57023
  import { formatNumberAndStringify } from "@funkit/utils";
56935
- import { formatUnits as formatUnits9 } from "viem";
57024
+ import { formatUnits as formatUnits10 } from "viem";
56936
57025
  function formatDestinationAssetAmount(tokenAmount) {
56937
57026
  const amount = Number(tokenAmount);
56938
57027
  if (amount > 0 && amount < 0.01) {
@@ -56951,7 +57040,7 @@ function toDestinationAssetBalanceState(balance2, decimals) {
56951
57040
  if (balance2.status === "unavailable") {
56952
57041
  return { status: "unavailable" };
56953
57042
  }
56954
- const tokenAmount = formatUnits9(BigInt(balance2.baseUnits), decimals);
57043
+ const tokenAmount = formatUnits10(BigInt(balance2.baseUnits), decimals);
56955
57044
  return {
56956
57045
  status: "ready",
56957
57046
  tokenAmount,
@@ -60397,6 +60486,7 @@ function useCheckoutModalTransition(checkoutItem, onClose, isModalOpen) {
60397
60486
  logEventV2("fc_step_viewed" /* STEP_VIEWED */, () => ({
60398
60487
  flow: getCheckoutModalAnalyticsFlow(nextState),
60399
60488
  is_back_navigation: metadata.isBackNavigation,
60489
+ resumed: false,
60400
60490
  prev_step: previousVisibleStep ? formatAnalyticsStep(previousVisibleStep) : null,
60401
60491
  step: formatAnalyticsStep(nextState.step),
60402
60492
  step_index: metadata.stepIndex
@@ -61271,7 +61361,7 @@ function ConnectButtonRenderer({
61271
61361
  // TypeError: Do not know how to serialize a BigInt
61272
61362
  query: { structuralSharing: false }
61273
61363
  });
61274
- const balanceFormatted = balanceData ? formatUnits10(balanceData.value, balanceData.decimals) : void 0;
61364
+ const balanceFormatted = balanceData ? formatUnits11(balanceData.value, balanceData.decimals) : void 0;
61275
61365
  const balanceNativeAmount = balanceData && balanceFormatted ? `${abbreviateETHBalance(Number.parseFloat(balanceFormatted))} ${balanceData.symbol}` : void 0;
61276
61366
  const displayBalance = formatCurrencyAndStringify19(
61277
61367
  Number.parseFloat(totalWalletAssetsUsd.toString())
@@ -1,4 +1,5 @@
1
- import type { Address } from 'viem';
1
+ import { type Address } from 'viem';
2
+ import type { ExecutionTransactionSubmittedArgs } from '../../hooks/track/analytics/resolveExecutionProgressContext';
2
3
  import { type CustomWithdrawalConfig, type FunkitActiveWithdrawalItem, type WalletWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
3
4
  /**
4
5
  * Provider-agnostic fiat off-ramp order: deliver `amount` of the accepted
@@ -18,12 +19,14 @@ export interface FiatWithdrawalOrder {
18
19
  */
19
20
  providerCrypto?: string;
20
21
  providerNetwork?: string;
22
+ providerTimestamp?: number;
21
23
  }
22
24
  interface UseFiatWithdrawalParams {
23
25
  config: WalletWithdrawalConfig | CustomWithdrawalConfig;
24
26
  withdrawalItem: FunkitActiveWithdrawalItem | null;
25
27
  /** Invoked for unrecoverable failures (the caller tears down the flow). */
26
28
  onError: () => void;
29
+ onSubmitted: (order: FiatWithdrawalOrder, execution: ExecutionTransactionSubmittedArgs, txHash: string) => void;
27
30
  }
28
31
  /**
29
32
  * Owns the order → quote → execute pipeline for a fiat off-ramp withdrawal,
@@ -34,7 +37,7 @@ interface UseFiatWithdrawalParams {
34
37
  * to {@link useWithdrawal}, which owns preWithdrawalAction + confirmCheckout +
35
38
  * error mapping.
36
39
  */
37
- export declare function useFiatWithdrawal({ config, withdrawalItem, onError, }: UseFiatWithdrawalParams): {
40
+ export declare function useFiatWithdrawal({ config, withdrawalItem, onError, onSubmitted, }: UseFiatWithdrawalParams): {
38
41
  processOrder: (order: FiatWithdrawalOrder) => Promise<void>;
39
42
  };
40
43
  export {};
@@ -1,9 +1,10 @@
1
1
  import type { Hex } from 'viem';
2
2
  import { type CheckoutConfirmationError } from '../../domains/checkoutErrors';
3
3
  import { type AllowedRecipient } from '../../domains/withdrawalAllowlist';
4
- import { type FunkitActiveWithdrawalItem, type FunkitWithdrawalConfig, type WithdrawalFormData } from '../../providers/FunkitCheckoutContext';
4
+ import { type CheckoutConfirmationResult, type FunkitActiveWithdrawalItem, type FunkitWithdrawalConfig, type WithdrawalFormData } from '../../providers/FunkitCheckoutContext';
5
+ type WithdrawalSubmission = NonNullable<CheckoutConfirmationResult['transactionSubmitted']>;
5
6
  interface UseWithdrawalResult {
6
- handleWithdrawal: (withdrawal: WithdrawalFormData) => Promise<Hex | null>;
7
+ handleWithdrawal: (withdrawal: WithdrawalFormData) => Promise<WithdrawalSubmission | null>;
7
8
  isWithdrawing: boolean;
8
9
  withdrawalError: CheckoutConfirmationError | null;
9
10
  stepMessage: string | null;
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  bifrostWallet
4
- } from "../chunk-TM7UBV3Q.js";
5
- import "../chunk-EYWGX5LT.js";
4
+ } from "../chunk-ALGPGI6V.js";
6
5
  import "../chunk-AALSJCUR.js";
6
+ import "../chunk-EYWGX5LT.js";
7
7
  import "../chunk-B454LLKJ.js";
8
8
  export {
9
9
  bifrostWallet
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  bitgetWallet
4
- } from "../chunk-USLZMUJ3.js";
5
- import "../chunk-EYWGX5LT.js";
4
+ } from "../chunk-HOCKAU5H.js";
6
5
  import "../chunk-AALSJCUR.js";
6
+ import "../chunk-EYWGX5LT.js";
7
7
  import "../chunk-B454LLKJ.js";
8
8
  export {
9
9
  bitgetWallet
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  bybitWallet
4
- } from "../chunk-IWPW26AL.js";
5
- import "../chunk-EYWGX5LT.js";
4
+ } from "../chunk-BBDNB5TQ.js";
6
5
  import "../chunk-AALSJCUR.js";
6
+ import "../chunk-EYWGX5LT.js";
7
7
  import "../chunk-B454LLKJ.js";
8
8
  export {
9
9
  bybitWallet