@funkit/connect 11.1.0 → 11.3.0

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 +118 -0
  2. package/dist/clients/{chunk-YZSO4EMO.js → chunk-2576N7PQ.js} +1 -1
  3. package/dist/clients/{chunk-II5CZTBC.js → chunk-3P2C436B.js} +3 -1
  4. package/dist/clients/{chunk-YMGRBJAS.js → chunk-46L2KJJ4.js} +14 -16
  5. package/dist/clients/chunk-6EU6CXNH.js +20 -0
  6. package/dist/clients/{chunk-2QYQNTOI.js → chunk-C45VNQXY.js} +24 -16
  7. package/dist/clients/{chunk-SO756ELD.js → chunk-DGBIV3ZS.js} +1 -0
  8. package/dist/clients/{chunk-SYFHMTUO.js → chunk-FM7SFGAV.js} +2 -2
  9. package/dist/clients/{chunk-EJKHMZW3.js → chunk-IYCZWLAF.js} +2 -1
  10. package/dist/clients/{chunk-OJZNF6EM.js → chunk-JFDRLSYM.js} +1 -1
  11. package/dist/clients/{chunk-QIMCURVA.js → chunk-L2XMI4EX.js} +9 -9
  12. package/dist/clients/{chunk-A6OXZWCN.js → chunk-QQEGNLGD.js} +1 -1
  13. package/dist/clients/{chunk-A44M6EAG.js → chunk-TZGKB6WY.js} +1 -1
  14. package/dist/clients/{chunk-C53FRCUM.js → chunk-UK64SY6N.js} +1 -1
  15. package/dist/clients/{chunk-WVM4ZJD2.js → chunk-VIAEAD75.js} +1 -1
  16. package/dist/clients/{chunk-SH3MHRHX.js → chunk-Y7WLUPTX.js} +1 -1
  17. package/dist/clients/{chunk-FAYBQQNB.js → chunk-YUZ3B2Q3.js} +1 -1
  18. package/dist/clients/fanatics.js +2 -2
  19. package/dist/clients/internal/nado/consts.d.ts +6 -0
  20. package/dist/clients/internal/nado/consts.js +5 -3
  21. package/dist/clients/internal/nado/gateway.js +2 -2
  22. package/dist/clients/internal/nado/hooks.js +4 -4
  23. package/dist/clients/internal/nado/indexer.js +2 -2
  24. package/dist/clients/internal/nado/typedData.js +2 -2
  25. package/dist/clients/internal/nado/withdrawalCallback.js +7 -7
  26. package/dist/clients/internal/nado/withdrawalConfig.d.ts +4 -4
  27. package/dist/clients/internal/nado/withdrawalConfig.js +2 -2
  28. package/dist/clients/internal/nado/withdrawalErrors.js +2 -2
  29. package/dist/clients/internal/nado/withdrawalForm.css +43 -35
  30. package/dist/clients/internal/nado/withdrawalForm.d.ts +3 -0
  31. package/dist/clients/internal/nado/withdrawalForm.js +15 -11
  32. package/dist/clients/internal/nado/withdrawalStatus.js +3 -3
  33. package/dist/clients/lighter.css +43 -35
  34. package/dist/clients/lighter.d.ts +4 -30
  35. package/dist/clients/lighter.js +74 -260
  36. package/dist/clients/mallard.js +2 -2
  37. package/dist/clients/nado.js +9 -9
  38. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.css +43 -35
  39. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +8 -8
  40. package/dist/clients/polymarket/createPolymarketDepositConfig.d.ts +6 -0
  41. package/dist/clients/polymarket/createPolymarketDepositConfig.js +2 -2
  42. package/dist/clients/polymarket/index.css +43 -35
  43. package/dist/clients/polymarket/index.js +11 -11
  44. package/dist/clients/polymarket/polymarket.js +1 -1
  45. package/dist/components/Dialog/Dialog.d.ts +3 -1
  46. package/dist/components/Dialog/DialogContent.css.d.ts +6 -0
  47. package/dist/components/FunCheckbox/FunCheckbox.d.ts +3 -1
  48. package/dist/components/FunCheckoutHistory/FunCheckoutHistoryContent.d.ts +3 -1
  49. package/dist/components/FunCheckoutHistory/PendingSuccessScreen.d.ts +3 -1
  50. package/dist/components/FunTransactionSummary/PaymentFeesSummary.d.ts +2 -1
  51. package/dist/domains/checkout.d.ts +2 -1
  52. package/dist/domains/nado.d.ts +11 -2
  53. package/dist/domains/quoteMode/types.d.ts +16 -0
  54. package/dist/domains/relay.d.ts +0 -3
  55. package/dist/hooks/track/analytics/claimAnalyticsEvent.d.ts +5 -0
  56. package/dist/hooks/track/analytics/events.d.ts +203 -7
  57. package/dist/hooks/track/analytics/mappers.d.ts +17 -0
  58. package/dist/hooks/track/analytics/quote.d.ts +12 -0
  59. package/dist/hooks/track/analytics/resolveExecutionProgressContext.d.ts +40 -0
  60. package/dist/hooks/track/analytics/useDepositAnalytics.d.ts +87 -2
  61. package/dist/hooks/track/analytics/useTrackExecutionProgressEvents.d.ts +48 -0
  62. package/dist/hooks/track/analytics/useWithdrawalAnalytics.d.ts +18 -0
  63. package/dist/hooks/track/useTrack.d.ts +1 -1
  64. package/dist/hooks/useFunkitTranslation.d.ts +5 -0
  65. package/dist/hooks/useIsBlacklistedWithdrawalAddress.d.ts +4 -1
  66. package/dist/hooks/useTokenAndChainDropdown.d.ts +4 -1
  67. package/dist/index.css +43 -35
  68. package/dist/index.js +5301 -3619
  69. package/dist/modals/CheckoutModal/ConfirmationStep/useCheckoutConfirmation.d.ts +2 -1
  70. package/dist/modals/CheckoutModal/ConfirmationStep/useQuoteRefresh.d.ts +5 -1
  71. package/dist/modals/CheckoutModal/ConfirmationStep/useTrackDepositQuoteEvents.d.ts +20 -0
  72. package/dist/modals/CheckoutModal/InputAmount/InputAmount.d.ts +5 -1
  73. package/dist/modals/CheckoutModal/InputAmount/state.d.ts +13 -0
  74. package/dist/modals/CheckoutModal/InputAmount/useMeld.d.ts +4 -3
  75. package/dist/modals/CheckoutModal/InputAmount/utils.d.ts +9 -1
  76. package/dist/modals/CheckoutModal/MeldQuotes/MeldQuotes.d.ts +3 -1
  77. package/dist/modals/CheckoutModal/MeldQuotes/useMeldQuotes.d.ts +1 -1
  78. package/dist/modals/CheckoutModal/MeldRedirect/MeldRedirect.d.ts +4 -1
  79. package/dist/modals/CheckoutModal/SourceChange/useBottomBarCloseLabel.d.ts +7 -0
  80. package/dist/modals/CheckoutModal/SourceChange/useTrackSourceChangeEvents.d.ts +10 -0
  81. package/dist/modals/CheckoutModal/TransferToken/useTrackDepositNotificationEvents.d.ts +6 -0
  82. package/dist/modals/CheckoutModal/TransferToken/useTransferTokenTracking.d.ts +9 -3
  83. package/dist/modals/PolymarketPerpsTransfer/recordPerpsTransfer.d.ts +40 -0
  84. package/dist/modals/PolymarketPerpsTransfer/useRecordPerpsTransfer.d.ts +24 -0
  85. package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +14 -92
  86. package/dist/modals/WithdrawalModal/LockedReceiveDisplay.d.ts +22 -0
  87. package/dist/modals/WithdrawalModal/WithdrawAmountInput.d.ts +3 -1
  88. package/dist/modals/WithdrawalModal/useTrackWithdrawalEvents.d.ts +1 -0
  89. package/dist/modals/WithdrawalModal/withdrawalFormHelpers.d.ts +18 -1
  90. package/dist/modals/WithdrawalModal/withdrawalHooks.d.ts +1 -1
  91. package/dist/providers/FunkitCheckoutContext/index.d.ts +10 -2
  92. package/dist/providers/FunkitCheckoutContext/types.d.ts +21 -4
  93. package/dist/providers/FunkitStatsigProvider.d.ts +7 -0
  94. package/dist/utils/customer.d.ts +45 -504
  95. package/dist/utils/lighter.d.ts +1 -83
  96. package/dist/utils/signature.d.ts +1 -2
  97. package/dist/utils/withdrawal.d.ts +11 -1
  98. package/dist/wallets/walletConnectors/index.js +49 -49
  99. package/package.json +4 -5
  100. package/dist/clients/chunk-NAVU6W7V.js +0 -89
@@ -1,5 +1,6 @@
1
1
  import type { Address } from 'viem';
2
2
  import { type CheckoutConfirmationError } from '../../../domains/checkoutErrors';
3
+ import { type CheckoutConfirmationResult } from '../../../providers/FunkitCheckoutContext';
3
4
  interface UseCheckoutConfirmationOptions {
4
5
  onError(error: CheckoutConfirmationError): void;
5
6
  onSuccess(depositAddress: Address): void;
@@ -7,7 +8,7 @@ interface UseCheckoutConfirmationOptions {
7
8
  interface UseCheckoutConfirmationResult {
8
9
  confirmationError: CheckoutConfirmationError | null;
9
10
  confirmationStepMessage: string | null;
10
- handleCheckoutConfirmation(): Promise<void>;
11
+ handleCheckoutConfirmation(): Promise<CheckoutConfirmationResult | undefined>;
11
12
  isConfirming: boolean;
12
13
  }
13
14
  export declare function useCheckoutConfirmation({ onError, onSuccess, }: UseCheckoutConfirmationOptions): UseCheckoutConfirmationResult;
@@ -1,5 +1,7 @@
1
1
  import type { ErrorNotification } from '../../../components/FunNotification/FunNotification';
2
2
  interface UseQuoteRefreshOptions {
3
+ /** Resets refresh state when the active checkout changes. */
4
+ checkoutId: string | null;
3
5
  /**
4
6
  * Freeze the latest quote state, e.g. so we do not change the quote mid-confirmation
5
7
  */
@@ -16,8 +18,10 @@ interface UseQuoteRefreshResult {
16
18
  countdown: React.ReactNode;
17
19
  quoteError: ErrorNotification | null;
18
20
  quoteStepMessage: string | null;
21
+ /** Number of refreshed quotes that have successfully become active. */
22
+ numQuoteRefreshes: number;
19
23
  /** Safe to call asynchronously */
20
24
  refreshQuote(ignorePreloaded?: boolean): Promise<void>;
21
25
  }
22
- export declare function useQuoteRefresh({ isOnHold, refreshIntervalSeconds, }: UseQuoteRefreshOptions): UseQuoteRefreshResult;
26
+ export declare function useQuoteRefresh({ checkoutId, isOnHold, refreshIntervalSeconds, }: UseQuoteRefreshOptions): UseQuoteRefreshResult;
23
27
  export {};
@@ -0,0 +1,20 @@
1
+ import { type PaymentMethodInfo } from '../../../domains/paymentMethods';
2
+ import type { TrackDepositQuoteSnapshotArgs } from '../../../hooks/track/analytics/useDepositAnalytics';
3
+ interface UseTrackDepositQuoteEventsArgs {
4
+ paymentMethodInfo: PaymentMethodInfo;
5
+ /** Only the local quote-fetching state matters here — everything else
6
+ * (checkout item, quote, wallet, execution info) is read from shared
7
+ * context so ConfirmationStep doesn't have to thread it through. */
8
+ isQuoteLoading: boolean;
9
+ numQuoteRefreshes: number;
10
+ }
11
+ /**
12
+ * Fires `fc_deposit_quote_displayed` once per distinct quote id.
13
+ * `trackQuoteConfirmed` fires `fc_deposit_quote_confirmed` for the CTA path
14
+ * that calls it, and returns the confirmed snapshot so the caller can pair it
15
+ * with the transaction that results from the confirmation.
16
+ */
17
+ export declare function useTrackDepositQuoteEvents({ paymentMethodInfo, isQuoteLoading, numQuoteRefreshes, }: UseTrackDepositQuoteEventsArgs): {
18
+ trackQuoteConfirmed: () => TrackDepositQuoteSnapshotArgs | null;
19
+ };
20
+ export {};
@@ -3,21 +3,25 @@ import React from 'react';
3
3
  import type { Hex } from 'viem';
4
4
  import { type PaymentMethodInfo } from '../../../domains/paymentMethods';
5
5
  import { type CheckoutModalCommonState, FunCheckoutStep, type ModalStepComponentProps, type ModalStepInfo } from '../stepTransition';
6
+ import type { AmountSelection } from './state';
6
7
  export type InputAmountState = CheckoutModalCommonState & {
7
8
  paymentMethodInfo: PaymentMethodInfo;
8
9
  fiatAmount?: number;
9
10
  fiatCurrency?: string;
10
11
  quote?: MeldQuote;
12
+ serviceProvider?: MeldServiceProvider;
11
13
  isInputInFiat?: boolean;
12
14
  /** Preserved token amount from a previous visit (source of truth in EXACT_IN) */
13
15
  assetAmount?: number;
14
16
  /** Source token identifier — used to detect asset changes and discard stale values */
15
17
  sourceTokenKey?: string;
18
+ /** How the current amount was selected for analytics attribution */
19
+ amountSelection?: AmountSelection;
16
20
  };
17
21
  export type InputAmountNext = Record<string, never> | {
18
22
  fiatAmount: number | undefined;
19
23
  fiatCurrency?: string;
20
- provider?: MeldServiceProvider;
24
+ serviceProvider?: MeldServiceProvider;
21
25
  quote?: MeldQuote;
22
26
  nextStep?: FunCheckoutStep.SOURCE_CHANGE | FunCheckoutStep.MELD_CURRENCY_SELECT | FunCheckoutStep.MELD_QUOTES | FunCheckoutStep.MELD_REDIRECT;
23
27
  } | {
@@ -4,6 +4,19 @@ import { type PaymentMethodInfo } from '../../../domains/paymentMethods';
4
4
  import type { QuoteBuilder } from '../../../domains/quoteMode/types';
5
5
  import type { AssetHoldingsItem } from '../../../utils/assets';
6
6
  import type { FunkitCheckoutConfig } from '../../../providers/FunkitCheckoutContext';
7
+ /**
8
+ * How the current input amount was chosen.
9
+ * - `default` — the auto-computed initial amount, left untouched
10
+ * - `manual` — the user typed a value
11
+ * - `preset` — a quick option whose label is carried in `presetAmount`
12
+ * - `max` — a 100% balance option or max recovery action
13
+ * - `min` — a minimum-amount recovery action
14
+ */
15
+ export type AmountSelectionType = 'default' | 'manual' | 'preset' | 'max' | 'min';
16
+ export type AmountSelection = {
17
+ selectType: AmountSelectionType;
18
+ presetAmount: string | null;
19
+ };
7
20
  export interface AmountInputInitOptions {
8
21
  checkoutConfig: FunkitCheckoutConfig;
9
22
  paymentMethodInfo: PaymentMethodInfo;
@@ -1,4 +1,4 @@
1
- import type { MeldQuote } from '@funkit/api-base';
1
+ import type { MeldQuote, MeldServiceProvider } from '@funkit/api-base';
2
2
  import React from 'react';
3
3
  import type { ErrorNotification } from '../../../components/FunNotification/FunNotification';
4
4
  import { FunCheckoutStep, type NextPayload } from '../stepTransition';
@@ -10,16 +10,17 @@ export declare function useMeldUI({ meldEnabled, manuallySelectedQuote, fiatAmou
10
10
  onNext: (data: NextPayload<FunCheckoutStep.INPUT_AMOUNT>) => void;
11
11
  }): {
12
12
  getMeldFooter: () => React.JSX.Element;
13
- handleMeldContinue: () => Promise<void>;
13
+ handleMeldContinue: (quote: MeldQuote) => Promise<void>;
14
14
  isMeldContinueDisabled: boolean | undefined;
15
15
  isMeldLinkPending: boolean;
16
16
  getMeldError: () => ErrorNotification | undefined;
17
+ selectedQuote: MeldQuote | undefined;
17
18
  };
18
19
  export declare function useMeld(meldEnabled: boolean, manuallySelectedQuote: MeldQuote | undefined, usdAmount: number | undefined, fiatCurrency: string | undefined): {
19
20
  meldQuotesQuery: import("@tanstack/react-query").UseQueryResult<MeldQuote[]> & {
20
21
  isOutdated: boolean;
21
22
  };
22
- mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("@funkit/api-base").MeldCreateCryptoWidgetResponse, Error, import("@funkit/api-base").MeldServiceProvider, unknown>;
23
+ mutateAsync: import("@tanstack/react-query").UseMutateAsyncFunction<import("@funkit/api-base").MeldCreateCryptoWidgetResponse, Error, MeldServiceProvider, unknown>;
23
24
  isMeldLinkPending: boolean;
24
25
  meldLimitError: {
25
26
  issue: string;
@@ -1,6 +1,6 @@
1
1
  import type { ErrorNotification } from '../../../components/FunNotification/FunNotification';
2
2
  import type { useFunkitTranslation } from '../../../hooks/useFunkitTranslation';
3
- import type { AmountInputError } from './state';
3
+ import type { AmountInputError, AmountSelectionType } from './state';
4
4
  type TFunction = ReturnType<typeof useFunkitTranslation>['t'];
5
5
  export declare const ASSET_DECIMALS = 5;
6
6
  export declare const USD_DECIMALS = 2;
@@ -8,9 +8,17 @@ export declare const USD_INITIAL_AMOUNT = 100;
8
8
  export declare function getDefaultAmountFromQuickOptions(quickOptions: number[] | undefined): number | undefined;
9
9
  export declare function getUsdMaxAmount(maxUsd: number): number | null;
10
10
  export declare function getUsdMinAmount(minUsd?: number): number;
11
+ /**
12
+ * Format numeric percentage and fixed-fiat quick-option labels consistently
13
+ * for display and analytics. The 100% balance option is rendered separately
14
+ * as the localized Max label.
15
+ */
16
+ export declare function formatQuickOptionPresetAmount(option: number, percentMode: boolean, fiatCurrency: string, t: TFunction): string;
11
17
  export interface InputAmountSuggestion {
12
18
  autoConfirm: boolean;
13
19
  buttonLabel: string;
20
+ /** select_type to report for this recovery action; preset_amount is always null alongside it. */
21
+ selectType: Extract<AmountSelectionType, 'max' | 'min'>;
14
22
  usdAmount: number;
15
23
  }
16
24
  /**
@@ -2,12 +2,14 @@ import type { MeldQuote, MeldServiceProvider } from '@funkit/api-base';
2
2
  import React from 'react';
3
3
  import type { PaymentMethodCardInfo } from '../../../domains/paymentMethods';
4
4
  import { type CheckoutModalCommonState, FunCheckoutStep, type ModalStepComponentProps, type ModalStepInfo } from '../stepTransition';
5
+ import type { AmountSelection } from '../InputAmount/state';
5
6
  export type MeldQuotesState = CheckoutModalCommonState & {
6
7
  paymentMethodInfo: PaymentMethodCardInfo;
7
8
  /** Checkout amount in fiat */
8
9
  fiatAmount: number | undefined;
9
10
  fiatCurrency: string | undefined;
10
- provider?: MeldServiceProvider;
11
+ serviceProvider?: MeldServiceProvider;
12
+ amountSelection?: AmountSelection;
11
13
  };
12
14
  export type MeldQuotesNext = Record<string, never> | {
13
15
  quote: MeldQuote;
@@ -1,6 +1,6 @@
1
1
  import { type MeldQuote } from '@funkit/api-base';
2
2
  import { type UseQueryResult } from '@tanstack/react-query';
3
- import type { ReactNode } from 'react';
3
+ import { type ReactNode } from 'react';
4
4
  /**
5
5
  * Triggered only when fiatCurrency is provided.
6
6
  *
@@ -1,13 +1,16 @@
1
- import type { MeldQuote } from '@funkit/api-base';
1
+ import type { MeldQuote, MeldServiceProvider } from '@funkit/api-base';
2
2
  import React from 'react';
3
3
  import type { PaymentMethodCardInfo } from '../../../domains/paymentMethods';
4
+ import type { AmountSelection } from '../InputAmount/state';
4
5
  import { type CheckoutModalCommonState, FunCheckoutStep, type ModalStepComponentProps, type ModalStepInfo } from '../stepTransition';
5
6
  export type MeldRedirectState = CheckoutModalCommonState & {
7
+ amountSelection?: AmountSelection;
6
8
  paymentMethodInfo: PaymentMethodCardInfo;
7
9
  /** Checkout amount in fiat */
8
10
  fiatAmount: number | undefined;
9
11
  fiatCurrency: string | undefined;
10
12
  quote: MeldQuote;
13
+ serviceProvider?: MeldServiceProvider;
11
14
  };
12
15
  export type MeldRedirectNext = Record<string, never>;
13
16
  export declare const MeldRedirectInfo: ModalStepInfo<FunCheckoutStep.MELD_REDIRECT>;
@@ -0,0 +1,7 @@
1
+ type BottomBarCloseLabelKey = 'sourceChange.exploreMarketsFirst' | 'common.close';
2
+ /**
3
+ * Customers select the source-change bottom-bar label by key, so resolving it
4
+ * in one place keeps both screens on literal `t()` keys.
5
+ */
6
+ export declare function useBottomBarCloseLabel(labelKey: BottomBarCloseLabelKey): string;
7
+ export {};
@@ -0,0 +1,10 @@
1
+ import type { PaymentMethodType } from '../../../hooks/usePaymentSources';
2
+ /** Source Change step events (modal opened, tab switched, etc.) */
3
+ export declare function useTrackSourceChangeEvents({ tab, }: {
4
+ tab: PaymentMethodType;
5
+ }): {
6
+ trackTabSwitched: (input: {
7
+ fromTab: PaymentMethodType;
8
+ tab: PaymentMethodType;
9
+ }) => void;
10
+ };
@@ -0,0 +1,6 @@
1
+ import type { NotificationItem } from './types';
2
+ /**
3
+ * Tracks transfer-crypto deposit lifecycle events while their notifications
4
+ * remain eligible for display.
5
+ */
6
+ export declare function useTrackDepositNotificationEvents(items: NotificationItem[]): void;
@@ -5,18 +5,24 @@ export declare const addressDisplayedAtMsByCheckoutKey: {
5
5
  };
6
6
  interface UseTransferTokenTrackingProps {
7
7
  depositAddress: string | undefined;
8
+ estPriceImpact: number | null;
8
9
  fromChainId: string | undefined;
10
+ fromTokenAddress: string | undefined;
9
11
  fromTokenSymbol: string | undefined;
12
+ minAmountUsd: number;
13
+ targetChainId: string | undefined;
14
+ targetTokenAddress: string | undefined;
15
+ targetTokenSymbol: string | null;
10
16
  toChainId: string | undefined;
11
17
  toTokenAddress: string | undefined;
12
18
  }
13
19
  type UseTransferTokenTrackingResult = {
14
20
  trackAddressCopied: () => void;
15
21
  trackImpactExpanded: (estPriceImpactPct: number | undefined) => void;
16
- trackSourceChainChange: (newChainId: string) => void;
17
- trackSourceTokenChange: (newTokenSymbol: string) => void;
22
+ trackSourceChainChange: (newChainId: string, newTokenSymbol: string, queueInteraction?: boolean) => void;
23
+ trackSourceTokenChange: (newTokenSymbol: string, newChainId: number | undefined, queueInteraction?: boolean) => void;
18
24
  };
19
- export declare function useTransferTokenTracking({ depositAddress, fromChainId, fromTokenSymbol, toChainId, toTokenAddress, }: UseTransferTokenTrackingProps): UseTransferTokenTrackingResult;
25
+ export declare function useTransferTokenTracking({ depositAddress, estPriceImpact, fromChainId, fromTokenAddress, fromTokenSymbol, minAmountUsd, targetChainId, targetTokenAddress, targetTokenSymbol, toChainId, toTokenAddress, }: UseTransferTokenTrackingProps): UseTransferTokenTrackingResult;
20
26
  interface UseNotificationTrackingProps {
21
27
  item: NotificationItem | null;
22
28
  status: NotificationStatus;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Records a perps ⇄ predictions transfer as a tracking-only direct execution, so
3
+ * transfer volume outlives the Datadog logs it currently lives in (ENG-4867).
4
+ *
5
+ * `EXTERNALLY_FULFILLED` because Fun only initiates the move and Polymarket's own
6
+ * contracts settle it — the same shape Lighter's fills use, which the backend
7
+ * closes out as a terminal SUCCESS without polling for settlement.
8
+ */
9
+ import type { Address } from 'viem';
10
+ import type { FunkitActiveCheckoutItem } from '../../providers/FunkitCheckoutContext';
11
+ import type { PerpsTransferDirection } from './PolymarketPerpsTransferScreen';
12
+ /**
13
+ * `sourceOfFund` is a persisted, GSI-indexed column, making this prefix the
14
+ * stable key transfer volume is reported on — do not reformat it.
15
+ */
16
+ export declare const PERPS_TRANSFER_SOURCE_OF_FUND_PREFIX = "polymarket_perps_transfer";
17
+ export declare function buildPerpsTransferSourceOfFund(direction: PerpsTransferDirection, sourceAddress: Address): string;
18
+ export interface RecordPerpsTransferParams {
19
+ direction: PerpsTransferDirection;
20
+ sourceAddress: Address;
21
+ /** Becomes the row's `recipientAddr`. */
22
+ destinationAddress: Address;
23
+ /** Exact string the user entered (validated numeric, ≤6 decimals). */
24
+ amountUsd: string;
25
+ /**
26
+ * The rail's own id, when the integrator returns one. Absent for integrators
27
+ * still on the void-returning `transfer()`, which falls back to a local uuid
28
+ * and leaves the record with no join key to the venue's side.
29
+ */
30
+ railId?: string;
31
+ userId: string | undefined;
32
+ apiKey: string;
33
+ checkoutItem: FunkitActiveCheckoutItem;
34
+ }
35
+ /**
36
+ * Best-effort by design: the transfer already succeeded when this runs, so a
37
+ * bookkeeping failure must never surface to the user or be retried. Callers do
38
+ * not need to catch — every failure path is swallowed at WARN here.
39
+ */
40
+ export declare function recordPerpsTransfer({ direction, sourceAddress, destinationAddress, amountUsd, railId, userId, apiKey, checkoutItem, }: RecordPerpsTransferParams): Promise<void>;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Supplies the inputs for recording a perps ⇄ predictions transfer, so the step
3
+ * passes only what the user did and knows nothing about the API key, the user id
4
+ * or the checkout snapshot.
5
+ *
6
+ * Lives beside the step rather than in `~/hooks/` because it is Polymarket-specific
7
+ * and those directories must stay customer-agnostic.
8
+ */
9
+ import type { Address } from 'viem';
10
+ import type { PerpsTransferDirection } from './PolymarketPerpsTransferScreen';
11
+ export interface RecordPerpsTransferInput {
12
+ direction: PerpsTransferDirection;
13
+ sourceAddress: Address;
14
+ destinationAddress: Address;
15
+ /** Exact string the user entered (validated numeric, ≤6 decimals). */
16
+ amountUsd: string;
17
+ /** The rail's own id, when the integrator's `transfer()` returns one. */
18
+ railId?: string;
19
+ }
20
+ /**
21
+ * Never rejects: the underlying record swallows its own failures. No-ops when
22
+ * there is no active checkout to attribute the transfer to.
23
+ */
24
+ export declare function useRecordPerpsTransfer(): (input: RecordPerpsTransferInput) => Promise<void>;
@@ -8,36 +8,10 @@ import React from 'react';
8
8
  import { type Address, type Hex } from 'viem';
9
9
  import { type CheckoutConfirmationError } from '../../domains/checkoutErrors';
10
10
  import type { CustomWithdrawalConfig, LighterRouteType, TokenInfo, WalletWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
11
- import type { LighterAsset, LighterPoolInfo, LighterShare } from '../../utils/customer';
12
11
  /** Stable method ids for the Fast / Secure options (used for tracking + switching). */
13
12
  export declare const LIGHTER_FAST_METHOD_ID = "lighter-fast";
14
13
  export declare const LIGHTER_SECURE_METHOD_ID = "lighter-secure";
15
- /**
16
- * USDC exists twice on a Lighter account: as perps collateral
17
- * (`total_asset_value`, withdrawn via route 0) and as a spot asset balance
18
- * (asset entry 3, withdrawn via route 1). The Secure dropdown keys selection
19
- * by `symbol`, so the spot variant gets a pseudo-symbol to stay selectable
20
- * alongside the plain `USDC` (perps) entry.
21
- */
22
- export declare const LIGHTER_USDC_SPOT_SYMBOL = "USDC (Spot)";
23
- /** Lighter L2 route types (`RouteType` in the withdraw/transfer tx payload). */
24
- export declare const LIGHTER_ROUTE_TYPE: {
25
- readonly PERPS: 0;
26
- readonly SPOT: 1;
27
- };
28
- /**
29
- * Strips the ` (Spot)` / ` (Perps)` variant suffix off a Lighter source-token
30
- * selection, returning the real token symbol (e.g. `USDC (Spot)` → `USDC`).
31
- * Symbol-keyed lookups (icons, prices, asset indices, min amounts) operate on
32
- * the base symbol; only selection identity and route resolution keep the suffix.
33
- */
34
- export declare function getLighterBaseSymbol(symbol: string): string;
35
- /**
36
- * Resolves the Lighter L2 route type for a Secure source-token selection.
37
- * Plain `USDC` withdraws perps collateral (route 0); everything else —
38
- * including the `USDC (Spot)` pseudo-symbol — is a spot asset (route 1).
39
- */
40
- export declare function resolveLighterSecureRouteType(selectedSourceToken: string): LighterRouteType;
14
+ export { LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS, LIGHTER_FAST_MAX_WITHDRAWAL_USD, LIGHTER_ROUTE_TYPE, LIGHTER_SECURE_ASSETS_BY_INDEX, LIGHTER_STAKING_POOL_INDEX, LIGHTER_STAKING_THRESHOLD_LIT, LIGHTER_UNSTAKED_FEE_TOKENS, LIGHTER_USDC_SPOT_SYMBOL, getLighterBaseSymbol, getLighterSecureMainnetAddress, resolveLighterAssetIndex, resolveLighterSecureRouteType, resolveLighterSharePrice, resolveLighterUnstakedFeeTokens, } from '@funkit/connect-core/clients/lighter';
41
15
  /**
42
16
  * The selected source token as identified on Lighter's own L2, rather than by
43
17
  * its mainnet bridge address — two Secure selections can share one mainnet
@@ -53,18 +27,16 @@ export declare function resolveLighterSourceAsset({ assetIndex, routeType, }: {
53
27
  assetIndex: number | undefined;
54
28
  routeType: LighterRouteType;
55
29
  }): TokenInfo | undefined;
56
- /**
57
- * Mainnet ERC-20 address for a Lighter Secure source token symbol, or undefined
58
- * if the symbol isn't a known Secure asset.
59
- */
60
- export declare function getLighterSecureMainnetAddress(symbol: string): Address | undefined;
61
- /**
62
- * Upper bound on a single Lighter Fast withdrawal, in USD. Amounts above this
63
- * block the CTA and surface the "submit a Secure withdrawal" footer. Fast is
64
- * USDC Perps only (price = 1), so this is also the token-unit cap.
65
- * {@link LIGHTER_FAST_MAX_WITHDRAWAL_LABEL} must stay in sync with this value.
66
- */
67
- export declare const LIGHTER_FAST_MAX_WITHDRAWAL_USD = 3000000;
30
+ export declare function resolveLighterConfirmedTarget({ isLighterSecure, mainnetTokenAddress, selectedSourceToken, withdrawalInputAmount, }: {
31
+ isLighterSecure: boolean;
32
+ mainnetTokenAddress: Address | undefined;
33
+ selectedSourceToken: string;
34
+ withdrawalInputAmount: string;
35
+ }): {
36
+ asset: TokenInfo;
37
+ ticker: string;
38
+ amount: number;
39
+ } | undefined;
68
40
  /**
69
41
  * Footer shown beneath the CTA when a Lighter Fast amount exceeds the $3M cap.
70
42
  * Renders as the `description` of a FunNotification, which supplies the shared
@@ -73,44 +45,6 @@ export declare const LIGHTER_FAST_MAX_WITHDRAWAL_USD = 3000000;
73
45
  export declare function LighterFastMaxExceededMessage({ onSwitchToSecure, }: {
74
46
  onSwitchToSecure: () => void;
75
47
  }): React.JSX.Element;
76
- /**
77
- * Lighter Fast charges an "unstaked" fee — a flat deduction taken off the
78
- * withdrawal amount before quoting — for users who aren't sufficiently staked
79
- * in Lighter's staking pool. Sufficiently-staked users pay nothing.
80
- *
81
- * "Sufficiently staked" = the *current* LIT value of the user's staking-pool
82
- * share is at or above the threshold. The pool is LIT-denominated and
83
- * identified by its index, hardcoded here (previously read from
84
- * `systemConfig.staking_pool_index`) since it's currently the only public pool
85
- * a withdrawing user holds a share in. Non-stakers report `shares: []`.
86
- */
87
- export declare const LIGHTER_STAKING_POOL_INDEX = 281474976624800;
88
- export declare const LIGHTER_UNSTAKED_FEE_TOKENS = 3;
89
- export declare const LIGHTER_STAKING_THRESHOLD_LIT = 100;
90
- /**
91
- * LIT per share unit for the staking pool: its LIT balance over total shares.
92
- *
93
- * `undefined` when the pool account is unavailable or reports no shares — the
94
- * fee gate then degrades to the entry principal rather than guessing.
95
- */
96
- export declare function resolveLighterSharePrice(poolAccount: {
97
- assets?: LighterAsset[];
98
- pool_info?: LighterPoolInfo;
99
- } | undefined): number | undefined;
100
- /**
101
- * Resolves the Lighter Fast unstaked fee (in source tokens, i.e. USDC) for a
102
- * user. A non-staker (`shares: []`, or no staking-pool share) pays the fee.
103
- *
104
- * Gated on the share's *current* LIT value (`shares_amount × sharePrice` — the
105
- * "Your Stake" figure in Lighter's UI), not `principal_amount`, which is the
106
- * entry deposit and never grows with accrued yield. Gating on the principal
107
- * charged stakers whose position had appreciated past the minimum from below.
108
- *
109
- * Falls back to the principal when `sharePrice` is unavailable — never worse
110
- * than the previous behaviour, and avoids waiving the fee for everyone when
111
- * the pool account fails to load.
112
- */
113
- export declare function resolveLighterUnstakedFeeTokens(shares: LighterShare[], sharePrice?: number): number;
114
48
  /**
115
49
  * Share price for the staking pool, read off the pool's own account. Kept a
116
50
  * separate query from the user's account: a user's `shares[]` carries entry
@@ -126,22 +60,11 @@ export declare function useLighterStakingSharePrice(enabled: boolean): number |
126
60
  export declare function useLighterWithdrawalBalances({ accountIndex, }: {
127
61
  accountIndex: LighterAccountIndex | undefined;
128
62
  }): {
129
- assets: LighterAsset[];
130
- shares: LighterShare[];
63
+ assets: import("@funkit/connect-core").LighterAsset[];
64
+ shares: import("@funkit/connect-core").LighterShare[];
131
65
  isLoading: boolean;
132
66
  };
133
67
  type FunkitWithdrawalConfig = WalletWithdrawalConfig | CustomWithdrawalConfig;
134
- /**
135
- * Resolves the Lighter `asset_id` for a selected source token symbol. Returns
136
- * `undefined` when the token isn't in the fetched assets list (e.g. timing
137
- * race before balances load, or an invalid selection) — callers should treat
138
- * that as "not ready to submit" rather than falling back to `0`, which would
139
- * silently target the wrong Lighter asset.
140
- */
141
- export declare function resolveLighterAssetIndex(lighterAssets: {
142
- symbol: string;
143
- asset_id: number;
144
- }[], selectedSourceToken: string): number | undefined;
145
68
  /**
146
69
  * Detects Lighter Secure withdrawal (mainnet source chain), auto-fills the
147
70
  * recipient address with the connected wallet, and fetches the Lighter account
@@ -152,7 +75,7 @@ export declare function useLighterWithdrawal(config: FunkitWithdrawalConfig, set
152
75
  isLighterFast: boolean;
153
76
  isUnifiedTradingMode: boolean;
154
77
  connectedAddress: `0x${string}` | undefined;
155
- lighterAssets: LighterAsset[];
78
+ lighterAssets: import("@funkit/connect-core").LighterAsset[];
156
79
  lighterFastUnstakedFee: number;
157
80
  invalidateLighterAccount: () => void;
158
81
  };
@@ -229,4 +152,3 @@ export declare function LighterSecureWithdrawalSuccess({ onClose, onNewWithdrawa
229
152
  tokenSymbol: string;
230
153
  txHash: string;
231
154
  }): React.JSX.Element;
232
- export {};
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ type LockedReceiveDisplayProps = {
3
+ tokenSymbol: string;
4
+ iconSrc?: string;
5
+ chainId: number;
6
+ /** Overrides the standard locked-receive copy (e.g. Lighter Secure's). */
7
+ tokenTooltip?: string;
8
+ chainTooltip?: string;
9
+ };
10
+ /**
11
+ * The "Receive token" / "Receive chain" pair, rendered read-only. Drops in where
12
+ * `TokenAndChainDropdown` would go when the flow fixes both. Tooltips default
13
+ * to the standard locked-receive message; a caller with its own wording (Lighter
14
+ * Secure) overrides per field.
15
+ *
16
+ * Chain name and icon come from `chainMetadataById` rather than `ChainIcon`:
17
+ * `useChainMetadata` reads that same map first anyway, and going direct keeps this
18
+ * a pure display with no query dependency — and consistent with callers that
19
+ * validate a chain against the same map before locking to it.
20
+ */
21
+ export declare const LockedReceiveDisplay: ({ tokenSymbol, iconSrc, chainId, tokenTooltip, chainTooltip, }: LockedReceiveDisplayProps) => React.JSX.Element;
22
+ export {};
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
+ import type { WithdrawalAmountSelectionType } from '../../hooks/track/analytics/events';
2
3
  import type { FunkitWithdrawalConfig, MultiMethodWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
3
4
  import type { SourceTokenOption } from '../../providers/FunkitCheckoutContext';
4
5
  export type { SourceTokenOption };
5
- export declare function WithdrawAmountInput({ withdrawalInputAmount, setWithdrawalInputAmount, sourceTokenBalance, isWithdrawAmountTooLow, isWithdrawAmountTooHigh, isWithdrawAmountAboveBalance, isWithdrawAmountValid, minWithdrawalDisplayValue, config, sourceTokenOptions, onSourceTokenChange, selectedSourceToken, sourceTokenUsdPrice, }: {
6
+ export declare function WithdrawAmountInput({ withdrawalInputAmount, setWithdrawalInputAmount, sourceTokenBalance, isWithdrawAmountTooLow, isWithdrawAmountTooHigh, isWithdrawAmountAboveBalance, isWithdrawAmountValid, minWithdrawalDisplayValue, config, sourceTokenOptions, onSourceTokenChange, selectedSourceToken, sourceTokenUsdPrice, onAmountSelectionChange, }: {
6
7
  config: Exclude<FunkitWithdrawalConfig, MultiMethodWithdrawalConfig>;
7
8
  sourceTokenBalance: string;
8
9
  /** User-entered amount in source-token units (e.g. "0.5" for 0.5 ETH). */
@@ -35,4 +36,5 @@ export declare function WithdrawAmountInput({ withdrawalInputAmount, setWithdraw
35
36
  * assuming a 1:1 stablecoin rate.
36
37
  */
37
38
  sourceTokenUsdPrice?: number;
39
+ onAmountSelectionChange?: (selectionType: WithdrawalAmountSelectionType) => void;
38
40
  }): React.JSX.Element;
@@ -0,0 +1 @@
1
+ export declare function useTrackWithdrawalEvents(): void;
@@ -1,7 +1,24 @@
1
1
  import type { TFunction } from 'i18next';
2
+ import type { Address } from 'viem';
2
3
  import type { FunkitCheckoutQuoteResult } from '../../domains/quote';
3
- import type { CustomWithdrawalConfig, FunkitCheckoutConfig, WalletWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
4
+ import type { CustomWithdrawalConfig, FunkitCheckoutConfig, SourceTokenOption, WalletWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
4
5
  type FunkitWithdrawalConfig = WalletWithdrawalConfig | CustomWithdrawalConfig;
6
+ /** Where a withdrawal is sending funds: the token, its chain, and its address. */
7
+ export interface SelectedTargetAsset {
8
+ selectedToken: string | undefined;
9
+ selectedChainId: number | undefined;
10
+ selectedChainName: string | undefined;
11
+ targetAssetAddress: Address | undefined;
12
+ }
13
+ /**
14
+ * The receive target, resolved once for every consumer below it. These switch as
15
+ * one unit — a direct-transfer-only source pins all four to the option itself,
16
+ * otherwise all four are the dropdown's live selection. `isLocked` saves callers
17
+ * from re-deciding, so this is the only place the lock is evaluated.
18
+ */
19
+ export declare function resolveTargetAsset(sourceTokenOption: SourceTokenOption | undefined, selectedTargetAsset: SelectedTargetAsset): SelectedTargetAsset & {
20
+ isLocked: boolean;
21
+ };
5
22
  export declare function getWithdrawButtonText({ isWithdrawing, isValidAddress, isRecipientBlacklisted, isRecipientSameAsSource, withdrawalInputAmount, isWithdrawAmountValid, isWithdrawAmountTooHigh, isValidAddressAndChain, selectedToken, selectedChainId, selectedChainName, t, }: {
6
23
  isWithdrawing: boolean;
7
24
  isValidAddress: boolean;
@@ -3,7 +3,7 @@ type FunkitWithdrawalConfig = WalletWithdrawalConfig | CustomWithdrawalConfig;
3
3
  export declare function useWithdrawalAssets(config: FunkitWithdrawalConfig): {
4
4
  assets: import("../CheckoutModal/TransferToken/TransferToken").TokenTransferSourceChainsAndAssets;
5
5
  selectedChainId: number | undefined;
6
- handleChainChange: (chainId?: number, autoUpdate?: boolean) => void;
6
+ handleChainChange: (chainId?: number, autoUpdate?: boolean) => string | undefined;
7
7
  selectedToken: string | undefined;
8
8
  selectedChainName: string | undefined;
9
9
  handleTokenChange: (token: string, chainId?: number, autoUpdate?: boolean) => void;
@@ -1,5 +1,6 @@
1
+ import { DirectExecutionType } from '@funkit/api-base';
1
2
  import React, { type ReactNode } from 'react';
2
- import type { Address } from 'viem';
3
+ import type { Address, Hex } from 'viem';
3
4
  import { type ApplyDynamicRoutingPath } from '../../domains/dynamicRouting';
4
5
  import { type PaymentMethodInfo } from '../../domains/paymentMethods';
5
6
  import type { AssetHoldingsItem } from '../../utils/assets';
@@ -25,7 +26,7 @@ interface FunkitCheckoutContextInterface {
25
26
  }): void;
26
27
  updateSelectedPaymentMethodInfo(newPaymentMethodInfo: PaymentMethodInfo): void;
27
28
  updateCustomRecipient: (recipient: Address) => void;
28
- confirmCheckout(quote: FunkitCheckoutQuoteResult, stepMessageSetter: (m: string) => void, withdrawalClient?: WithdrawalClient, preWithdrawalTxs?: WithdrawalTransaction[]): Promise<Address>;
29
+ confirmCheckout(quote: FunkitCheckoutQuoteResult, stepMessageSetter: (m: string) => void, withdrawalClient?: WithdrawalClient, preWithdrawalTxs?: WithdrawalTransaction[]): Promise<CheckoutConfirmationResult>;
29
30
  cancelCheckout(depositAddress: Address): Promise<boolean>;
30
31
  /**
31
32
  * Partial-update the active checkout item. Exposed for direct-execution
@@ -73,6 +74,13 @@ export type CheckoutProgressStep = 1 | 2;
73
74
  export type CheckoutProgress = {
74
75
  step: CheckoutProgressStep;
75
76
  };
77
+ export type CheckoutConfirmationResult = {
78
+ depositAddress: Address;
79
+ transactionSubmitted?: {
80
+ txHash: Hex;
81
+ executionType: DirectExecutionType | null;
82
+ };
83
+ };
76
84
  export declare function FunkitCheckoutProvider({ children }: {
77
85
  children: ReactNode;
78
86
  }): React.JSX.Element;