@funkit/connect 10.3.0 → 10.5.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 (107) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/dist/clients/chunk-2YWQL3AO.js +46 -0
  3. package/dist/clients/chunk-A4WQS6QG.js +207 -0
  4. package/dist/clients/chunk-BNMZM23Q.js +42 -0
  5. package/dist/clients/{chunk-HOORQPSY.js → chunk-F6P4CN27.js} +24 -8
  6. package/dist/clients/chunk-FJ6GCMJ4.js +29 -0
  7. package/dist/clients/chunk-II5CZTBC.js +18 -0
  8. package/dist/clients/chunk-L2KSNS7H.js +112 -0
  9. package/dist/clients/chunk-OZ3KD24N.js +107 -0
  10. package/dist/clients/{chunk-3STGJU6Z.js → chunk-QHS5N7GP.js} +2 -2
  11. package/dist/clients/{chunk-RWCJ4XGX.js → chunk-WRS7AFM2.js} +31 -2
  12. package/dist/clients/fanatics.js +1 -1
  13. package/dist/clients/internal/nado/consts.d.ts +16 -0
  14. package/dist/clients/internal/nado/consts.js +13 -0
  15. package/dist/clients/internal/nado/encoding.d.ts +22 -0
  16. package/dist/clients/internal/nado/encoding.js +32 -0
  17. package/dist/clients/internal/nado/errors.d.ts +55 -0
  18. package/dist/clients/internal/nado/errors.js +15 -0
  19. package/dist/clients/internal/nado/fetch.d.ts +15 -0
  20. package/dist/clients/internal/nado/fetch.js +9 -0
  21. package/dist/clients/internal/nado/gateway.d.ts +83 -0
  22. package/dist/clients/internal/nado/gateway.js +23 -0
  23. package/dist/clients/internal/nado/hooks.d.ts +360 -0
  24. package/dist/clients/internal/nado/hooks.js +132 -0
  25. package/dist/clients/internal/nado/indexer.d.ts +43 -0
  26. package/dist/clients/internal/nado/indexer.js +13 -0
  27. package/dist/clients/internal/nado/products.d.ts +36 -0
  28. package/dist/clients/internal/nado/products.js +19 -0
  29. package/dist/clients/internal/nado/typedData.d.ts +80 -0
  30. package/dist/clients/internal/nado/typedData.js +43 -0
  31. package/dist/clients/internal/nado/withdrawalConfig.d.ts +11 -0
  32. package/dist/clients/internal/nado/withdrawalConfig.js +17 -0
  33. package/dist/clients/internal/nado/withdrawalTypes.d.ts +30 -0
  34. package/dist/clients/internal/nado/withdrawalTypes.js +1 -0
  35. package/dist/clients/lighter.d.ts +1 -0
  36. package/dist/clients/lighter.js +202 -57
  37. package/dist/clients/mallard.js +9 -24
  38. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +3 -3
  39. package/dist/clients/polymarket/index.js +3 -3
  40. package/dist/components/ChainIcon/ChainIcon.d.ts +16 -0
  41. package/dist/components/FreeUsdcBanner/FreeUsdcBanner.d.ts +1 -1
  42. package/dist/components/FunAssetAvatar/FunAssetAvatar.d.ts +1 -2
  43. package/dist/hooks/useChainMetadata.d.ts +11 -0
  44. package/dist/hooks/useCheckoutDirectExecutionHistory.d.ts +2 -1
  45. package/dist/hooks/usePaymentMethodTabs.d.ts +8 -2
  46. package/dist/hooks/useSwappedIframeLifecycle.d.ts +5 -2
  47. package/dist/hooks/useSwappedPreload.d.ts +7 -11
  48. package/dist/hooks/useUserIpInfo.d.ts +1 -19
  49. package/dist/index.d.ts +1 -1
  50. package/dist/index.js +3700 -3299
  51. package/dist/modals/CheckoutModal/SourceChange/SourceChange.d.ts +3 -0
  52. package/dist/modals/CheckoutModal/SwappedIframe/SwappedIframe.d.ts +4 -1
  53. package/dist/modals/CheckoutModal/SwappedIframe/SwappedIframeController.d.ts +3 -0
  54. package/dist/modals/CheckoutModal/isWithdrawalStep.d.ts +3 -2
  55. package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +46 -2
  56. package/dist/modals/WithdrawalModal/useFiatWithdrawal.d.ts +1 -1
  57. package/dist/modals/WithdrawalModal/useWithdrawal.d.ts +3 -15
  58. package/dist/providers/FunkitCheckoutContext/types.d.ts +73 -14
  59. package/dist/providers/FunkitConfigContext.d.ts +11 -0
  60. package/dist/providers/GeneralWalletProvider.d.ts +1 -4
  61. package/dist/providers/SwappedProvider.d.ts +5 -3
  62. package/dist/utils/lighter.d.ts +68 -1
  63. package/dist/utils/purifyCheckoutHistoryItem.d.ts +2 -41
  64. package/dist/utils/swapped.d.ts +1 -1
  65. package/dist/utils/tokenIconUrl.d.ts +5 -0
  66. package/dist/utils/userInfo.d.ts +8 -0
  67. package/dist/utils/withdrawal.d.ts +2 -1
  68. package/dist/wagmi/actions.d.ts +1 -1
  69. package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
  70. package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
  71. package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
  72. package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
  73. package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
  74. package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
  75. package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
  76. package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
  77. package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
  78. package/dist/wallets/walletConnectors/index.js +33 -33
  79. package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
  80. package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
  81. package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
  82. package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
  83. package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
  84. package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
  85. package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
  86. package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
  87. package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
  88. package/package.json +3 -2
  89. package/dist/hooks/useSkipSwappedPreload.d.ts +0 -7
  90. package/dist/wallets/walletConnectors/{chunk-W2LCLDPX.js → chunk-2VP2F6EK.js} +3 -3
  91. package/dist/wallets/walletConnectors/{chunk-IULPZP2Q.js → chunk-4T6ZSRJF.js} +3 -3
  92. package/dist/wallets/walletConnectors/{chunk-WAHGI5L7.js → chunk-6BW3HLBG.js} +3 -3
  93. package/dist/wallets/walletConnectors/{chunk-YO2K4MBH.js → chunk-CCQV2ZET.js} +3 -3
  94. package/dist/wallets/walletConnectors/{chunk-TKB2OY6G.js → chunk-CPI4TD43.js} +3 -3
  95. package/dist/wallets/walletConnectors/{chunk-OX37G4YT.js → chunk-F5XEEVG6.js} +3 -3
  96. package/dist/wallets/walletConnectors/{chunk-JPN6TWIT.js → chunk-HNRB7KJU.js} +3 -3
  97. package/dist/wallets/walletConnectors/{chunk-WKNQMP4A.js → chunk-HTHAK6XB.js} +3 -3
  98. package/dist/wallets/walletConnectors/{chunk-GUQM4QSL.js → chunk-MIQTHJ6X.js} +3 -3
  99. package/dist/wallets/walletConnectors/{chunk-4NV5BYRP.js → chunk-RB3HR4R2.js} +3 -3
  100. package/dist/wallets/walletConnectors/{chunk-SWFF3TWJ.js → chunk-RVOY537T.js} +3 -3
  101. package/dist/wallets/walletConnectors/{chunk-KI5Y2BBF.js → chunk-STVVP43G.js} +3 -3
  102. package/dist/wallets/walletConnectors/{chunk-OEEGYENV.js → chunk-UK7C2JXW.js} +3 -3
  103. package/dist/wallets/walletConnectors/{chunk-YQFGVZGR.js → chunk-VAPGUPHO.js} +3 -3
  104. package/dist/wallets/walletConnectors/{chunk-XCNHV3HS.js → chunk-VTM6EECM.js} +3 -3
  105. package/dist/wallets/walletConnectors/{chunk-NR2OGDHQ.js → chunk-X6CGV36L.js} +3 -3
  106. package/dist/wallets/walletConnectors/{chunk-AVDUNQUW.js → chunk-YEZM4CK4.js} +3 -3
  107. package/dist/wallets/walletConnectors/{chunk-KCRO2AGO.js → chunk-ZNX4EMPB.js} +3 -3
@@ -6,6 +6,7 @@ import type { FunkitCheckoutQuoteResult } from '../../../domains/quote';
6
6
  import { type PaymentMethodType } from '../../../hooks/usePaymentSources';
7
7
  import { type CustomWithdrawalConfig, type WalletWithdrawalConfig } from '../../../providers/FunkitCheckoutContext';
8
8
  import { type CheckoutModalCommonState, FunCheckoutStep, type ModalStepComponentProps, type ModalStepInfo } from '../stepTransition';
9
+ import type { SwappedMode } from '../../../providers/SwappedProvider';
9
10
  export type SourceChangeState = CheckoutModalCommonState & {
10
11
  paymentMethodInfo: ConnectablePaymentMethodInfo | null;
11
12
  /** Persisted payment method type filter (crypto/fiat tab) */
@@ -56,6 +57,8 @@ export type SourceChangeNext = {
56
57
  selectedPaymentOption: SwappedFormOfPayment;
57
58
  /** Payment method type filter to restore when returning */
58
59
  paymentMethodTypeFilter: PaymentMethodType;
60
+ /** Slot/origin for the shared Swapped iframe step */
61
+ swappedMode: SwappedMode;
59
62
  } | {
60
63
  /**
61
64
  * Skip the asset-select screen; land on InputAmount with the
@@ -1,3 +1,6 @@
1
1
  import React from 'react';
2
- declare const _default: React.MemoExoticComponent<() => React.JSX.Element | null>;
2
+ import { type SwappedMode } from '../../../providers/SwappedProvider';
3
+ declare const _default: React.MemoExoticComponent<({ mode }: {
4
+ mode: SwappedMode;
5
+ }) => React.JSX.Element | null>;
3
6
  export default _default;
@@ -2,11 +2,14 @@ import type { SwappedFormOfPayment } from '@funkit/api-base';
2
2
  import React from 'react';
3
3
  import type { PaymentMethodType } from '../../../hooks/usePaymentSources';
4
4
  import { type CheckoutModalCommonState, FunCheckoutStep, type ModalStepComponentProps, type ModalStepInfo } from '../../../modals/CheckoutModal/stepTransition';
5
+ import { type SwappedMode } from '../../../providers/SwappedProvider';
5
6
  export type SwappedIframeState = CheckoutModalCommonState & {
6
7
  /** The selected payment option from the fops API */
7
8
  selectedPaymentOption: SwappedFormOfPayment;
8
9
  /** Payment method type filter to restore when returning to SOURCE_CHANGE */
9
10
  paymentMethodTypeFilter?: PaymentMethodType;
11
+ /** Slot/origin for the shared Swapped iframe step */
12
+ swappedMode: SwappedMode;
10
13
  /** Set to true when an error occurs (iframe error or load timeout) */
11
14
  error?: boolean;
12
15
  };
@@ -8,8 +8,9 @@ type WithdrawalStep = FunCheckoutStep.WITHDRAWAL_ENTER_AMOUNT | FunCheckoutStep.
8
8
  * checkout↔withdrawal lifecycle effect keys off this.
9
9
  *
10
10
  * - Dedicated withdrawal steps (enter-amount, complete) always qualify.
11
- * - The Withdraw tab on SourceChange qualifies while active — it surfaces
12
- * withdrawal-mode UI before advancing to a dedicated step.
11
+ * - The Withdraw tab on SourceChange qualifies only once its `withdrawalConfig`
12
+ * is seeded: the swapped chooser tab leaves it undefined, so a mere tab visit
13
+ * must not hijack deposit query authority into withdrawal mode.
13
14
  *
14
15
  * Narrows to the states that carry `withdrawalConfig`, so callers can read it
15
16
  * without re-checking the step. Adding a new withdrawal screen? Add its step
@@ -3,9 +3,10 @@
3
3
  *
4
4
  * Extracted from WithdrawalContent.tsx to keep Lighter-specific logic isolated.
5
5
  */
6
- import type { LighterAccountIndex } from '@funkit/api-base';
6
+ import { type LighterAccountIndex } from '@funkit/api-base';
7
7
  import React from 'react';
8
- import type { Address } from 'viem';
8
+ import { type Address, type Hex } from 'viem';
9
+ import { type CheckoutConfirmationError } from '../../domains/checkoutErrors';
9
10
  import type { CustomWithdrawalConfig, LighterRouteType, WalletWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
10
11
  import type { LighterShare } from '../../utils/customer';
11
12
  import type { SourceTokenOption } from './WithdrawAmountInput';
@@ -142,6 +143,42 @@ export declare function useLighterWithdrawal(config: FunkitWithdrawalConfig, set
142
143
  lighterFastUnstakedFee: number;
143
144
  invalidateLighterAccount: () => void;
144
145
  };
146
+ /**
147
+ * Lighter Secure L1 on-chain withdrawal fallback.
148
+ *
149
+ * When the gasless L2 withdraw is rate-limited (error 23004), the user can
150
+ * withdraw directly on-chain via `zkLighter.withdraw`. This is a distinct,
151
+ * gas-paying, wallet-signed path — offered explicitly, never automatic.
152
+ *
153
+ * Availability latches on the first rate-limit error (the transient
154
+ * `withdrawalError` auto-clears after ~10s) and resets when the user edits the
155
+ * amount or source token, so a fresh attempt can retry the L2 path.
156
+ */
157
+ export declare function useLighterL1Fallback({ isLighterSecure, withdrawalError, connectedAddress, resetKey, }: {
158
+ isLighterSecure: boolean;
159
+ withdrawalError: CheckoutConfirmationError | null;
160
+ connectedAddress: Address | undefined;
161
+ /** Changes when the user edits amount/token — resets the latched offer. */
162
+ resetKey: string;
163
+ }): {
164
+ isL1FallbackAvailable: boolean;
165
+ submitL1Withdrawal: ({ assetIndex, routeType, amountTokenUnits, recipientAddr, tokenSymbol, mainnetTokenAddress, withdrawalUSD, onConfirmed, }: {
166
+ assetIndex: number;
167
+ routeType: LighterRouteType;
168
+ amountTokenUnits: string;
169
+ /** Connected wallet — L1 owner of the Lighter account (tracking userId). */
170
+ recipientAddr: Address;
171
+ /** Source-token symbol (may carry a ` (Spot)` suffix) — for tracking. */
172
+ tokenSymbol: string;
173
+ /** Mainnet ERC-20 the withdrawal lands as. */
174
+ mainnetTokenAddress: Address;
175
+ /** USD value (token amount × spot) — for tracking attribution. */
176
+ withdrawalUSD: string;
177
+ onConfirmed: (txHash: Hex) => void;
178
+ }) => Promise<void>;
179
+ isSubmittingL1: boolean;
180
+ l1FallbackError: CheckoutConfirmationError | null;
181
+ };
145
182
  /**
146
183
  * Resolves the source-token dropdown options for a Lighter customer.
147
184
  * Returns `undefined` for non-Lighter customers (no dropdown needed).
@@ -172,6 +209,13 @@ export declare function LighterSecureReceiveAmountValue({ amount, tokenSymbol: r
172
209
  amount: string;
173
210
  tokenSymbol: string;
174
211
  }): React.JSX.Element;
212
+ /**
213
+ * Lighter Secure: immediate success screen (no loading spinner).
214
+ *
215
+ * Unlike the standard `PendingSuccessScreen` that polls for relay status,
216
+ * Lighter Secure calls Lighter's API directly and runs outside of the
217
+ * FunKit relay system. This component shows an immediate success state.
218
+ */
175
219
  export declare function LighterSecureWithdrawalSuccess({ onClose, onNewWithdrawal, amount, tokenSymbol: rawTokenSymbol, txHash, }: {
176
220
  onClose: () => void;
177
221
  onNewWithdrawal: () => void;
@@ -1,4 +1,4 @@
1
- import { type Address } from 'viem';
1
+ import type { Address } from 'viem';
2
2
  import { type CustomWithdrawalConfig, type FunkitActiveWithdrawalItem, type WalletWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
3
3
  /**
4
4
  * Provider-agnostic fiat off-ramp order: deliver `amount` of the accepted
@@ -1,27 +1,15 @@
1
- import type { Address, Hex } from 'viem';
1
+ import type { Hex } from 'viem';
2
2
  import { type CheckoutConfirmationError } from '../../domains/checkoutErrors';
3
- import type { FunkitCheckoutQuoteResult } from '../../domains/quote';
4
- import { type FunkitActiveWithdrawalItem, type FunkitWithdrawalConfig, type WithdrawalCustomerData } from '../../providers/FunkitCheckoutContext';
3
+ import { type FunkitActiveWithdrawalItem, type FunkitWithdrawalConfig, type WithdrawalFormData } from '../../providers/FunkitCheckoutContext';
5
4
  interface UseWithdrawalResult {
6
5
  handleWithdrawal: (withdrawal: WithdrawalFormData) => Promise<Hex | null>;
7
6
  isWithdrawing: boolean;
8
7
  withdrawalError: CheckoutConfirmationError | null;
9
8
  stepMessage: string | null;
10
9
  }
11
- export type WithdrawalFormData = {
12
- destinationAddress: Address;
13
- withdrawalUSD: string;
14
- tokenSymbol: string;
15
- tokenAddress: Address;
16
- chainId: number;
17
- quote?: FunkitCheckoutQuoteResult;
18
- /** Customer-specific data for quoteless flows (e.g. Lighter Secure). */
19
- customerData?: WithdrawalCustomerData;
20
- userInputAmount: string;
21
- };
10
+ export type { WithdrawalFormData };
22
11
  export declare function useWithdrawal({ config, withdrawalItem, onSuccess, }: {
23
12
  config: FunkitWithdrawalConfig;
24
13
  withdrawalItem: FunkitActiveWithdrawalItem | null;
25
14
  onSuccess?: (withdrawal: WithdrawalFormData, txHash: Hex) => void;
26
15
  }): UseWithdrawalResult;
27
- export {};
@@ -2,6 +2,7 @@ import type { FunAddress } from '@funkit/api-base';
2
2
  import type { ApiCheckoutClientMetadata, ApiFunkitCheckoutActionParams, ApiFunkitCheckoutConfig } from '@funkit/utils';
3
3
  import type { ReactNode } from 'react';
4
4
  import type { Address } from 'viem';
5
+ import type { NadoWithdrawalCustomerConfig, NadoWithdrawalCustomerData } from '../../clients/internal/nado/withdrawalTypes';
5
6
  import type { PaymentMethodInfo } from '../../domains/paymentMethods';
6
7
  import type { CheckoutBlockedReason } from '../../modals/CheckoutModal/CheckoutBlockedReason';
7
8
  import type { WithdrawalClient, WithdrawalTransaction } from '../../wallets/Wallet';
@@ -280,6 +281,12 @@ export interface CustomWithdrawalConfig extends WithdrawalConfigBase {
280
281
  * success screen can display and link to the transaction.
281
282
  */
282
283
  withdrawCallback: (param: WithdrawalParam) => Promise<undefined | string>;
284
+ /**
285
+ * Config-level customer-specific data, discriminated by `customerName`.
286
+ * Populated by a client hook (e.g. `use{Customer}WithdrawalConfig`), not hand-set —
287
+ * the `customerConfig` counterpart to the per-submission {@link WithdrawalCustomerData}.
288
+ */
289
+ customerConfig?: WithdrawalCustomerConfig;
283
290
  }
284
291
  /** Lighter L2 route type: 0 = perps (USDC collateral), 1 = spot. */
285
292
  export type LighterRouteType = 0 | 1;
@@ -298,7 +305,13 @@ export interface LighterWithdrawalCustomerData {
298
305
  * by `customerName` so future customers extend the union instead of adding
299
306
  * top-level params.
300
307
  */
301
- export type WithdrawalCustomerData = LighterWithdrawalCustomerData;
308
+ export type WithdrawalCustomerData = LighterWithdrawalCustomerData | NadoWithdrawalCustomerData;
309
+ /**
310
+ * Config-level customer-specific data, discriminated by `customerName`. The
311
+ * `customerConfig` counterpart to {@link WithdrawalCustomerData}.
312
+ */
313
+ export type WithdrawalCustomerConfig = NadoWithdrawalCustomerConfig;
314
+ export type { NadoWithdrawalCustomerConfig, NadoWithdrawalCustomerData };
302
315
  export interface WithdrawalParam {
303
316
  quoteId: string;
304
317
  funQuote: unknown;
@@ -316,6 +329,23 @@ export interface WithdrawalParam {
316
329
  */
317
330
  withdrawalUSD?: string;
318
331
  }
332
+ /**
333
+ * Form data for an in-flight withdrawal, passed as the second argument of
334
+ * `onWithdrawalConfirmation` (see {@link UseFunkitCheckoutProps}).
335
+ * `chainId` / `tokenAddress` / `tokenSymbol` describe the destination
336
+ * (receive) side the user selected in the modal.
337
+ */
338
+ export type WithdrawalFormData = {
339
+ destinationAddress: Address;
340
+ withdrawalUSD: string;
341
+ tokenSymbol: string;
342
+ tokenAddress: Address;
343
+ chainId: number;
344
+ quote?: FunkitCheckoutQuoteResult;
345
+ /** Customer-specific data for quoteless flows (e.g. Lighter Secure). */
346
+ customerData?: WithdrawalCustomerData;
347
+ userInputAmount: string;
348
+ };
319
349
  /**
320
350
  * A single entry in a {@link MultiMethodWithdrawalConfig}.
321
351
  *
@@ -381,17 +411,10 @@ export type FunkitCheckoutResult = {
381
411
  message: string;
382
412
  metadata: object | Error;
383
413
  };
384
- export interface UseFunkitCheckoutProps {
414
+ /** Props common to every checkout, regardless of form factor. */
415
+ interface UseFunkitCheckoutBaseProps {
385
416
  /** @optional the checkout config object **/
386
417
  config?: FunkitCheckoutConfig;
387
- /**
388
- * @optional withdrawal config for the unified cashier flow. When provided,
389
- * the checkout modal's withdraw tab can enter the in-modal withdrawal flow.
390
- * TODO(cashier): the final wiring PR formalizes resolution (multi-method,
391
- * per-source); for now a single- or multi-method config is accepted and the
392
- * first method is used as the default.
393
- */
394
- withdrawalConfig?: FunkitWithdrawalConfig;
395
418
  /** @optional fires when the checkout modal is opened **/
396
419
  onOpen?: () => void;
397
420
  /** @optional fires when the checkout modal is closed **/
@@ -415,18 +438,54 @@ export interface UseFunkitCheckoutProps {
415
438
  onLoginRequired?: ({ onLoginFinished, }: {
416
439
  onLoginFinished?: () => void;
417
440
  }) => void;
418
- /** @optional fires when a withdrawal is confirmed with the funkit server. Returns the newly created withdrawalId. **/
419
- onWithdrawalConfirmation?: (withdrawalId: string) => void;
420
441
  /** @optional fires when checkout is blocked (e.g. geo-restriction, security hold, or missing wallet connection). **/
421
442
  onCheckoutBlocked?: (params: {
422
443
  blockedReason: CheckoutBlockedReason;
423
444
  }) => void;
445
+ }
446
+ /**
447
+ * Cashier form factor: the withdraw tab is explicitly requested. The coupling
448
+ * is compile-time — `withdrawalConfig` is required, so cashier intent can never
449
+ * be confused with a dropped config, and withdrawal callbacks are permitted
450
+ * only here.
451
+ */
452
+ interface CashierFormFactorProps {
453
+ formFactor: 'cashier';
454
+ withdrawalConfig: FunkitWithdrawalConfig;
455
+ /**
456
+ * @optional fires once the withdrawal has been submitted — after the wallet
457
+ * transaction is sent or the custom withdrawCallback resolves. `formData`
458
+ * carries the resolved destination chain/token
459
+ * ({@link WithdrawalFormData}) so integrators can track cross-chain
460
+ * withdrawals (e.g. security flows). The first argument is kept for
461
+ * backwards compatibility: the destination address on wallet flows, the
462
+ * quoteId on custom-callback flows.
463
+ */
464
+ onWithdrawalConfirmation?: (withdrawalId: string, formData: WithdrawalFormData) => void;
424
465
  /** @optional fires if the withdrawal fails at any point **/
425
466
  onWithdrawalError?: (result: FunkitCheckoutResult) => void;
426
467
  }
427
- /** Ensures that config is defined */
428
- export interface UseFunkitCheckoutPropsWithFullConfig extends UseFunkitCheckoutProps {
468
+ /** Default checkout form factor: no withdrawal wiring is permitted. */
469
+ interface CheckoutFormFactorProps {
470
+ formFactor?: 'checkout';
471
+ withdrawalConfig?: never;
472
+ onWithdrawalConfirmation?: never;
473
+ onWithdrawalError?: never;
474
+ }
475
+ export type UseFunkitCheckoutProps = UseFunkitCheckoutBaseProps & (CashierFormFactorProps | CheckoutFormFactorProps);
476
+ /**
477
+ * Resolved settings stored on the checkout item (config guaranteed). This is a
478
+ * structural superset of both public-prop union members — the `never`-typed
479
+ * withdrawal fields are relaxed — so internal rebuilds of `initSettings` don't
480
+ * fight the discriminant. The compile-time cashier↔withdrawalConfig coupling
481
+ * lives on the public `UseFunkitCheckoutProps` surface, which flows in here.
482
+ */
483
+ export interface UseFunkitCheckoutPropsWithFullConfig extends UseFunkitCheckoutBaseProps {
429
484
  config: FunkitCheckoutConfig;
485
+ formFactor?: 'cashier' | 'checkout';
486
+ withdrawalConfig?: FunkitWithdrawalConfig;
487
+ onWithdrawalConfirmation?: (withdrawalId: string, formData: WithdrawalFormData) => void;
488
+ onWithdrawalError?: (result: FunkitCheckoutResult) => void;
430
489
  }
431
490
  /**
432
491
  * Checkout Item for frontend use
@@ -106,6 +106,8 @@ export interface FunkitUiCustomizationsConfig {
106
106
  simplifiedUi?: boolean;
107
107
  };
108
108
  confirmationScreen?: {
109
+ /** Whether to auto-expand the transaction breakdown once fees are loaded - defaults to false */
110
+ autoExpandFeesSummary?: boolean;
109
111
  /** Custom destination icon and text used in checkout summary */
110
112
  destinationConfig?: FunkitUiDestinationConfig;
111
113
  /** when source and destination are the same address, show destination as payment method instead of source - defaults to false */
@@ -168,6 +170,8 @@ export interface FunkitUiCustomizationsConfig {
168
170
  customTopComponent?: () => ReactNode;
169
171
  };
170
172
  withdrawalScreen?: {
173
+ /** Whether to auto-expand the transaction breakdown once fees are loaded - defaults to false */
174
+ autoExpandFeesSummary?: boolean;
171
175
  /** Function that returns a custom React component to render before other UIs in the withdrawal amount screen */
172
176
  customTopComponent?: () => ReactNode;
173
177
  };
@@ -269,6 +273,13 @@ export type FunkitConfig = {
269
273
  prefillFiatEmail?: string;
270
274
  /** Disable Datadog logging - defaults to false (logging enabled) */
271
275
  disableLogging?: boolean;
276
+ /**
277
+ * Source used to attribute your onchain activity — should be a domain (e.g.
278
+ * `'yourapp.com'`). Applied once at provider init. When omitted, a source is
279
+ * derived automatically, which may log a console warning; set this to
280
+ * attribute activity explicitly and silence it.
281
+ */
282
+ source?: string;
272
283
  };
273
284
  interface FinalFunkitConfigInternal extends FunkitConfig {
274
285
  textCustomizations: FunkitTextCustomizationsConfig;
@@ -34,10 +34,7 @@ export declare const useGeneralWallet: () => GeneralWalletContextProps;
34
34
  *
35
35
  * `userId` is `userInfo.id` (not `userInfo.address`). `walletAddress` is the
36
36
  * resolved `effectiveAddress` from context, normalized to the contract's `''`
37
- * sentinel when absent — `GeneralWalletProvider` types the field `Address | ''`
38
- * but leaks `undefined` for guests via a `@ts-expect-error`, so we coalesce
39
- * here to keep web aligned with the contract (and with the eventual React
40
- * Native implementation).
37
+ * sentinel when absent.
41
38
  */
42
39
  export declare const useIdentity: IdentityProvider['useIdentity'];
43
40
  /**
@@ -2,7 +2,9 @@ import type { FormOfPaymentType } from '@funkit/api-base';
2
2
  import { type SwappedTransport } from '@funkit/connect-core';
3
3
  import React from 'react';
4
4
  import { type SwappedTheme } from '../utils/swapped';
5
- interface SwappedContextValue {
5
+ /** Deposit and withdrawal each own an independent Swapped iframe slot. */
6
+ export type SwappedMode = 'deposit' | 'withdrawal';
7
+ interface SwappedSlot {
6
8
  iframeUrl: string | null;
7
9
  isSwappedReady: boolean;
8
10
  isActive: boolean;
@@ -12,11 +14,11 @@ interface SwappedContextValue {
12
14
  resetIframe: () => void;
13
15
  setIframeRef: (el: HTMLIFrameElement | null) => void;
14
16
  focusAmountInput: () => void;
15
- swappedTheme: SwappedTheme;
16
17
  swappedTransport: SwappedTransport;
17
18
  }
18
19
  export declare function SwappedProvider({ children }: {
19
20
  children: React.ReactNode;
20
21
  }): React.JSX.Element;
21
- export declare function useSwappedContext(): SwappedContextValue;
22
+ export declare function useSwappedContext(mode: SwappedMode): SwappedSlot;
23
+ export declare function useSwappedTheme(): SwappedTheme;
22
24
  export {};
@@ -1,7 +1,74 @@
1
- import { type Address } from 'viem';
1
+ import { type Address, type Hex } from 'viem';
2
2
  export declare const LIGHTER_DEPOSIT_ADDRESS: Address;
3
3
  export declare const LIGHTER_SLOW_DEPOSIT_TIME_ESTIMATE_SECONDS: number;
4
4
  export declare const LIGHTER_DELAYED_AUTO_TRIGGER_CUTOFF: number;
5
+ /**
6
+ * zkLighter L1 `withdraw` ABI — selector `0xd20191bd`, non-payable, on the same
7
+ * contract as deposits. `amount` is in Lighter base units (see
8
+ * {@link lighterWithdrawBaseUnits}).
9
+ */
10
+ export declare const LIGHTER_WITHDRAW_ABI: readonly [{
11
+ readonly type: "function";
12
+ readonly name: "withdraw";
13
+ readonly stateMutability: "nonpayable";
14
+ readonly inputs: readonly [{
15
+ readonly name: "accountIndex";
16
+ readonly type: "uint48";
17
+ }, {
18
+ readonly name: "assetIndex";
19
+ readonly type: "uint16";
20
+ }, {
21
+ readonly name: "routeType";
22
+ readonly type: "uint8";
23
+ }, {
24
+ readonly name: "amount";
25
+ readonly type: "uint64";
26
+ }];
27
+ readonly outputs: readonly [];
28
+ }];
29
+ /** Strips fractional digits beyond `decimals` (string-based, no float math). */
30
+ export declare function truncateToDecimals(amount: string, decimals: number): string;
31
+ /**
32
+ * Converts a token-unit amount to Lighter L1 `withdraw` base units.
33
+ *
34
+ * Uses the L2 convention — USDC (asset index 3) = 6 decimals, all other assets
35
+ * = 8 — NOT the mainnet ERC-20 decimals (LIT/ETH would be 18). Confirmed on
36
+ * chain: 1 USDC → `1_000_000`, 1 LIT → `100_000_000`.
37
+ */
38
+ export declare function lighterWithdrawBaseUnits(assetIndex: number, amountTokenUnits: string): bigint;
39
+ /**
40
+ * Builds the on-chain `withdraw` transaction for the L1 fallback. `value` is 0
41
+ * (no protocol fee — the user pays gas only).
42
+ */
43
+ export declare function buildLighterL1WithdrawTransaction(params: {
44
+ accountIndex: number;
45
+ assetIndex: number;
46
+ routeType: number;
47
+ amountBaseUnit: bigint;
48
+ }): {
49
+ to: Address;
50
+ data: Hex;
51
+ value: bigint;
52
+ };
53
+ /**
54
+ * Explorer link for a Lighter Secure withdrawal tx. The L1 on-chain fallback
55
+ * produces a canonical 32-byte mainnet tx hash → Etherscan; L2 Secure hashes
56
+ * are Lighter's own (non-EVM) format → Lighter explorer. Detecting the EVM hash
57
+ * keeps L1-vs-L2 routing self-contained (no extra state threaded through the
58
+ * modal step machine).
59
+ */
60
+ export declare function resolveLighterWithdrawalExplorerUrl(txHash: string): string;
61
+ /**
62
+ * True when an error is Lighter's **L2 (Secure) withdrawal** rate limit —
63
+ * codes 23004 / 23005, e.g. "Too Many L2 Withdrawal Requests!: L2 withdrawal
64
+ * rate limit exceeded. Only 3 withdrawals allowed per 2 hours". Used to offer
65
+ * the on-chain L1 fallback (Secure withdrawals only).
66
+ *
67
+ * The L2 SDK usually surfaces this as a plain string (the numeric code isn't
68
+ * always preserved), so we match message content — plus the structured `code`
69
+ * field when the error carries one.
70
+ */
71
+ export declare function isLighterWithdrawalRateLimitError(error: unknown): boolean;
5
72
  export declare const LIGHTER_DYNAMIC_ROUTING_ID: {
6
73
  ETH_SPOT: string;
7
74
  USDC_PERPS: string;
@@ -1,41 +1,2 @@
1
- import { type CheckoutHistoryItem, type CheckoutState } from '@funkit/api-base';
2
- import type { ApiFunkitCheckoutActionParams } from '@funkit/utils';
3
- import type { Address, Hex } from 'viem';
4
- import type { MergedMultiStepDirectExecution } from '../domains/checkoutNotifications';
5
- export type PurifiedCheckoutHistoryItem = {
6
- depositAddr?: Address;
7
- directExecution: boolean;
8
- id: Hex;
9
- fromAmountBaseUnit: string;
10
- fromChainId: string;
11
- fromTokenAddress: Address;
12
- state: CheckoutState;
13
- toAmountBaseUnit: string;
14
- toChainId: string;
15
- toTokenAddress: Address;
16
- createdTimeMs: number;
17
- updatedTimeMs: number;
18
- additionalActions: ApiFunkitCheckoutActionParams[];
19
- isWithdrawal: boolean;
20
- /**
21
- * Customer-specific, presentation-only metadata. Kept in its own bag so
22
- * customer concepts don't leak onto the shared top-level shape. Only present
23
- * when there's something to surface for the item's customer.
24
- */
25
- customerMetadata?: {
26
- /**
27
- * For Lighter withdrawal direct executions: which route was used.
28
- * `'secure'` is Lighter's native bridge to mainnet (recorded as
29
- * `EXTERNALLY_FULFILLED`); `'fast'` routes through Fun + Relay.
30
- */
31
- lighterWithdrawalType?: 'fast' | 'secure';
32
- };
33
- } & ({
34
- depositAddr: Address;
35
- directExecution: false;
36
- } | {
37
- depositAddr?: never;
38
- directExecution: true;
39
- txHashes: Hex[];
40
- });
41
- export declare const purifyCheckoutHistoryItem: (item: CheckoutHistoryItem | MergedMultiStepDirectExecution) => PurifiedCheckoutHistoryItem;
1
+ export { purifyCheckoutHistoryItem } from '@funkit/connect-core';
2
+ export type { PurifiedCheckoutHistoryItem } from '@funkit/connect-core';
@@ -1,6 +1,6 @@
1
1
  import type { SwappedTheme } from '@funkit/connect-core';
2
2
  import type { ThemeVars } from '../css/sprinkles.css';
3
- export { getSavedFormOfPaymentDisplayName, getSavedFormOfPaymentIcon, getSwappedIcon, getSwappedOrigin, isSavedFormOfPaymentType, isSwappedOrigin, SWAPPED_CARD_BRANDS, } from '@funkit/connect-core';
3
+ export { getFormOfPaymentDisplayName, getSavedFormOfPaymentDisplayName, getSavedFormOfPaymentIcon, getSwappedIcon, getSwappedOrigin, isSavedFormOfPaymentType, isSwappedOrigin, SWAPPED_CARD_BRANDS, } from '@funkit/connect-core';
4
4
  export type { SwappedTheme };
5
5
  export declare function resolveCssValue(value: string): string;
6
6
  export declare function resolveObjectCssVars<T extends object>(obj: T): T;
@@ -1,2 +1,7 @@
1
1
  import type { DynamicTargetAssetCandidate } from '../providers/FunkitCheckoutContext';
2
2
  export declare const getTokenIconUrl: (symbol: string, tokens?: DynamicTargetAssetCandidate[]) => string;
3
+ export declare function resolveAssetIconSrc({ assetTicker, assetSrc, prioritizeDefaults, }: {
4
+ assetTicker?: string;
5
+ assetSrc?: string;
6
+ prioritizeDefaults: boolean;
7
+ }): string | undefined;
@@ -16,6 +16,14 @@ export declare function getIsExternalUserIdAddress(apiKey: string, externalUserI
16
16
  * Currently used by Lighter mobile QR flow where the L1 address is passed via externalUserId.
17
17
  */
18
18
  export declare function resolveWalletAddress(address: Address | undefined, externalUserId: string | undefined, isExternalUserIdAddress: boolean): Address | undefined;
19
+ /**
20
+ * Whether the session counts as logged in.
21
+ * Web3 only qualifies once wagmi has resolved an address — `connector` is set
22
+ * as soon as a connection attempt starts (status 'connecting'/'reconnecting'),
23
+ * before `address` exists, so gating on `loginType` alone would flip this true
24
+ * while `effectiveAddress` is still undefined.
25
+ */
26
+ export declare function resolveIsUserLoggedIn(loginType: LoginType, effectiveAddress: Address | undefined, externalUserId: string | undefined): boolean;
19
27
  /**
20
28
  * Resolve the userId for the current session.
21
29
  */
@@ -2,7 +2,8 @@ import type { CustomWithdrawalConfig, FunkitWithdrawalConfig, MultiMethodWithdra
2
2
  /**
3
3
  * Evaluates the integrator's `withdrawalSourceTokenBalance` callback to a safe
4
4
  * numeric string. Returns `'0'` (with a warn) for missing/empty/NaN/negative
5
- * values. Shared by the withdrawal amount screen and the Swapped cash cap.
5
+ * values, or if the callback throws. Shared by the withdrawal amount screen and
6
+ * the Swapped cash cap.
6
7
  */
7
8
  export declare function safeEvaluateWithdrawalSourceTokenBalance(fn: (() => string | number) | undefined): string;
8
9
  /**
@@ -1,6 +1,6 @@
1
1
  import type { Config } from 'wagmi';
2
2
  import { type GetBalanceParameters, type GetBalanceReturnType } from 'wagmi/actions';
3
- export { estimateGas, getAccount, getGasPrice, getTransaction, getWalletClient, multicall, readContract, sendTransaction, switchChain, waitForTransactionReceipt, } from 'wagmi/actions';
3
+ export { estimateGas, getAccount, getGasPrice, getTransaction, getWalletClient, multicall, readContract, sendTransaction, signTypedData, switchChain, waitForTransactionReceipt, } from 'wagmi/actions';
4
4
  export type GetBalanceReturnTypeCompat = GetBalanceReturnType & {
5
5
  formatted: string;
6
6
  };
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  bifrostWallet
4
- } from "../chunk-IULPZP2Q.js";
5
- import "../chunk-N4IJLYFY.js";
4
+ } from "../chunk-4T6ZSRJF.js";
6
5
  import "../chunk-OLZ7626J.js";
6
+ import "../chunk-N4IJLYFY.js";
7
7
  import "../chunk-IGKXZBTA.js";
8
8
  export {
9
9
  bifrostWallet
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  bitgetWallet
4
- } from "../chunk-TKB2OY6G.js";
5
- import "../chunk-N4IJLYFY.js";
4
+ } from "../chunk-CPI4TD43.js";
6
5
  import "../chunk-OLZ7626J.js";
6
+ import "../chunk-N4IJLYFY.js";
7
7
  import "../chunk-IGKXZBTA.js";
8
8
  export {
9
9
  bitgetWallet
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  bybitWallet
4
- } from "../chunk-OX37G4YT.js";
5
- import "../chunk-N4IJLYFY.js";
4
+ } from "../chunk-F5XEEVG6.js";
6
5
  import "../chunk-OLZ7626J.js";
6
+ import "../chunk-N4IJLYFY.js";
7
7
  import "../chunk-IGKXZBTA.js";
8
8
  export {
9
9
  bybitWallet
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  clvWallet
4
- } from "../chunk-OEEGYENV.js";
5
- import "../chunk-N4IJLYFY.js";
4
+ } from "../chunk-UK7C2JXW.js";
6
5
  import "../chunk-OLZ7626J.js";
6
+ import "../chunk-N4IJLYFY.js";
7
7
  import "../chunk-IGKXZBTA.js";
8
8
  export {
9
9
  clvWallet
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  coin98Wallet
4
- } from "../chunk-WAHGI5L7.js";
5
- import "../chunk-N4IJLYFY.js";
4
+ } from "../chunk-6BW3HLBG.js";
6
5
  import "../chunk-OLZ7626J.js";
6
+ import "../chunk-N4IJLYFY.js";
7
7
  import "../chunk-IGKXZBTA.js";
8
8
  export {
9
9
  coin98Wallet
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  coreWallet
4
- } from "../chunk-4NV5BYRP.js";
5
- import "../chunk-N4IJLYFY.js";
4
+ } from "../chunk-RB3HR4R2.js";
6
5
  import "../chunk-OLZ7626J.js";
6
+ import "../chunk-N4IJLYFY.js";
7
7
  import "../chunk-IGKXZBTA.js";
8
8
  export {
9
9
  coreWallet
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  foxWallet
4
- } from "../chunk-GUQM4QSL.js";
5
- import "../chunk-N4IJLYFY.js";
4
+ } from "../chunk-MIQTHJ6X.js";
6
5
  import "../chunk-OLZ7626J.js";
6
+ import "../chunk-N4IJLYFY.js";
7
7
  import "../chunk-IGKXZBTA.js";
8
8
  export {
9
9
  foxWallet
@@ -1,9 +1,9 @@
1
1
  "use client";
2
2
  import {
3
3
  frontierWallet
4
- } from "../chunk-AVDUNQUW.js";
5
- import "../chunk-N4IJLYFY.js";
4
+ } from "../chunk-YEZM4CK4.js";
6
5
  import "../chunk-OLZ7626J.js";
6
+ import "../chunk-N4IJLYFY.js";
7
7
  import "../chunk-IGKXZBTA.js";
8
8
  export {
9
9
  frontierWallet