@funkit/connect 12.16.0 → 12.18.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 (97) hide show
  1. package/CHANGELOG.md +86 -0
  2. package/dist/clients/axiom.d.ts +1 -5
  3. package/dist/clients/{chunk-BKK2BFIP.js → chunk-AELXD5XA.js} +1 -1
  4. package/dist/clients/{chunk-6IH7AWFA.js → chunk-FOXMRDKD.js} +1 -1
  5. package/dist/clients/{chunk-UZ3NA7HN.js → chunk-G6A62MZO.js} +3 -3
  6. package/dist/clients/{chunk-OB5GKTP2.js → chunk-L6JL2XJY.js} +1 -1
  7. package/dist/clients/{chunk-I5VRAFH6.js → chunk-LCYJLY4X.js} +1 -1
  8. package/dist/clients/chunk-R25GIAD5.js +59 -0
  9. package/dist/clients/{chunk-7JYLS7IF.js → chunk-YSAAJSWT.js} +272 -48
  10. package/dist/clients/fanatics.js +2 -2
  11. package/dist/clients/internal/nado/withdrawalCallback.js +4 -4
  12. package/dist/clients/internal/nado/withdrawalConfig.js +2 -2
  13. package/dist/clients/internal/nado/withdrawalErrors.js +2 -2
  14. package/dist/clients/internal/nado/withdrawalForm.js +6 -6
  15. package/dist/clients/internal/nado/withdrawalStatus.js +3 -3
  16. package/dist/clients/lighter.css +8 -8
  17. package/dist/clients/lighter.d.ts +29 -16
  18. package/dist/clients/lighter.js +149 -68
  19. package/dist/clients/mallard.js +2 -2
  20. package/dist/clients/nado.js +4 -4
  21. package/dist/components/LargeAmountInput/LargeAmountInput.d.ts +3 -1
  22. package/dist/components/TokenSwapWidget/TokenSelectButton/TokenSelectButton.d.ts +5 -2
  23. package/dist/components/TokenSwapWidget/TokenSwapCard/TokenSwapCard.d.ts +7 -3
  24. package/dist/components/TokenSwapWidget/TokenSwapWidget.d.ts +7 -2
  25. package/dist/consts/customers.d.ts +12 -1
  26. package/dist/domains/convert/assets.d.ts +30 -0
  27. package/dist/domains/convert/balances.d.ts +44 -24
  28. package/dist/domains/convert/errors.d.ts +38 -0
  29. package/dist/domains/convert/execution.d.ts +39 -0
  30. package/dist/domains/convert/hostTimeout.d.ts +8 -0
  31. package/dist/domains/convert/inputAmount.d.ts +53 -0
  32. package/dist/domains/convert/quote.d.ts +33 -0
  33. package/dist/domains/convert/recipient.d.ts +2 -1
  34. package/dist/domains/convert/reducer.d.ts +112 -0
  35. package/dist/domains/convert/screen.d.ts +169 -0
  36. package/dist/domains/convert/settlement.d.ts +52 -0
  37. package/dist/domains/convert/sourceWallet.d.ts +5 -4
  38. package/dist/domains/convert/submit.d.ts +67 -0
  39. package/dist/domains/convert/types.d.ts +52 -27
  40. package/dist/domains/convert/view.d.ts +111 -0
  41. package/dist/domains/nativeFeeReserve.d.ts +29 -0
  42. package/dist/domains/quote.d.ts +14 -1
  43. package/dist/hooks/queries/useWithdrawFops.d.ts +6 -0
  44. package/dist/hooks/queries/useWithdrawalQuote.d.ts +4 -1
  45. package/dist/hooks/track/CheckoutModalEvent.d.ts +2 -0
  46. package/dist/hooks/track/WithdrawModalEvent.d.ts +1 -0
  47. package/dist/hooks/track/analytics/events.d.ts +59 -1
  48. package/dist/hooks/track/analytics/mappers.d.ts +5 -4
  49. package/dist/hooks/track/analytics/resolveIframeStepNavigation.d.ts +18 -0
  50. package/dist/hooks/track/analytics/useDepositAnalytics.d.ts +2 -2
  51. package/dist/hooks/track/analytics/useTrackSwappedIframeEvents.d.ts +5 -0
  52. package/dist/hooks/track/analytics/useWithdrawalAnalytics.d.ts +2 -2
  53. package/dist/hooks/track/useQuoteAttemptCounter.d.ts +2 -0
  54. package/dist/hooks/useConvertAssetList.d.ts +23 -0
  55. package/dist/hooks/useConvertAssets.d.ts +11 -0
  56. package/dist/hooks/useConvertBalances.d.ts +50 -0
  57. package/dist/hooks/useConvertExecute.d.ts +33 -0
  58. package/dist/hooks/useConvertQuote.d.ts +53 -0
  59. package/dist/hooks/useConvertSelectionWallets.d.ts +34 -0
  60. package/dist/hooks/useConvertTransactionStatus.d.ts +17 -0
  61. package/dist/hooks/useMaxSpendableAmount.d.ts +19 -0
  62. package/dist/hooks/useStepQueryReadiness.d.ts +45 -15
  63. package/dist/index.css +8 -8
  64. package/dist/index.d.ts +3 -2
  65. package/dist/index.js +8169 -3491
  66. package/dist/modals/CheckoutModal/Convert/ConvertAssetList.d.ts +16 -0
  67. package/dist/modals/CheckoutModal/Convert/ConvertAssetRow.d.ts +21 -0
  68. package/dist/modals/CheckoutModal/Convert/ConvertChainPills.d.ts +14 -0
  69. package/dist/modals/CheckoutModal/Convert/ConvertSelectDestinationStep.d.ts +30 -0
  70. package/dist/modals/CheckoutModal/Convert/ConvertSelectSourceStep.d.ts +18 -0
  71. package/dist/modals/CheckoutModal/Convert/ConvertStep.d.ts +4 -2
  72. package/dist/modals/CheckoutModal/FunCheckoutStep.d.ts +2 -0
  73. package/dist/modals/CheckoutModal/SourceChange/SourceChange.d.ts +5 -3
  74. package/dist/modals/CheckoutModal/SwappedIframe/swappedIframeReady.track.d.ts +8 -0
  75. package/dist/modals/CheckoutModal/Withdrawal/WithdrawalComplete.d.ts +5 -2
  76. package/dist/modals/CheckoutModal/Withdrawal/WithdrawalEnterAmount.d.ts +4 -2
  77. package/dist/modals/CheckoutModal/stepTransition.d.ts +7 -2
  78. package/dist/modals/CheckoutModal/stepTransition.shared.d.ts +0 -1
  79. package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +48 -15
  80. package/dist/modals/WithdrawalModal/WithdrawAmountInput.d.ts +17 -4
  81. package/dist/modals/WithdrawalModal/WithdrawalContent.d.ts +10 -7
  82. package/dist/modals/WithdrawalModal/useMaxWithdrawableAmount.d.ts +10 -0
  83. package/dist/modals/WithdrawalModal/useMultiSourceWithdrawal.d.ts +41 -0
  84. package/dist/modals/WithdrawalModal/withdrawalFormHelpers.d.ts +28 -8
  85. package/dist/providers/ConvertProvider.d.ts +40 -0
  86. package/dist/providers/FunkitCheckoutContext/index.d.ts +2 -2
  87. package/dist/providers/FunkitCheckoutContext/types.d.ts +36 -2
  88. package/dist/providers/FunkitQuoteContext.track.d.ts +23 -3
  89. package/dist/providers/SwappedProvider.d.ts +7 -0
  90. package/dist/shadow-css.js +1 -1
  91. package/dist/utils/customer.d.ts +34 -4
  92. package/dist/utils/withdrawal.d.ts +28 -1
  93. package/dist/wallets/multiSourceWithdrawal.d.ts +36 -0
  94. package/dist/wallets/walletConnectors/index.js +42 -42
  95. package/package.json +6 -6
  96. package/dist/clients/chunk-6EU6CXNH.js +0 -20
  97. /package/dist/clients/{chunk-4DBUYTEE.js → chunk-LICTGZXW.js} +0 -0
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import type { ConvertAssetListStatus } from '../../../domains/convert/assets';
3
+ import { type ConvertAssetOption } from './ConvertAssetRow';
4
+ interface ConvertAssetListProps {
5
+ status: ConvertAssetListStatus;
6
+ options: ConvertAssetOption[];
7
+ selectedKey: string | undefined;
8
+ emptyText: string;
9
+ onSelect: (key: string) => void;
10
+ onRetry: () => void;
11
+ /** Heading above the rows; left off the loading, failed and empty states. */
12
+ label?: string;
13
+ }
14
+ /** A Convert token screen's list, with its loading, failed and empty states. */
15
+ export declare function ConvertAssetList({ status, options, selectedKey, emptyText, onSelect, onRetry, label, }: ConvertAssetListProps): React.JSX.Element;
16
+ export {};
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { type ConvertBalanceState } from '../../../domains/convert/balances';
3
+ import type { ConvertResolvedAsset } from '../../../domains/convert/types';
4
+ /** One row on a Convert token screen. */
5
+ export interface ConvertAssetOption {
6
+ asset: ConvertResolvedAsset;
7
+ key: string;
8
+ /** `undefined` until the first balance read lands. */
9
+ balance: ConvertBalanceState | undefined;
10
+ /** The balance in USD; `undefined` when the balance is unknown. */
11
+ usdAmount: number | undefined;
12
+ isDisabled: boolean;
13
+ /** Worth less than the minimum Convert quotes, so it can't be a source. */
14
+ isBelowMinimum?: boolean;
15
+ }
16
+ /** A Convert asset, drawn as a row of the checkout's wallet asset list. */
17
+ export declare function ConvertAssetRow({ option, isSelected, onSelect, }: {
18
+ option: ConvertAssetOption;
19
+ isSelected: boolean;
20
+ onSelect: (key: string) => void;
21
+ }): React.JSX.Element;
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ interface ConvertChainPillsProps {
3
+ chainIds: string[];
4
+ activeChainId: string | undefined;
5
+ onChange: (chainId: string) => void;
6
+ }
7
+ /**
8
+ * The destination screen's chain picker: one pill per chain, icon only, with
9
+ * the active one widened to show its name. The highlight slides to the picked
10
+ * pill and the widths ease, like the modal's header tabs. Scrolls sideways
11
+ * when the chains don't fit, e.g. eight on a phone.
12
+ */
13
+ export declare function ConvertChainPills({ chainIds, activeChainId, onChange, }: ConvertChainPillsProps): React.JSX.Element;
14
+ export {};
@@ -0,0 +1,30 @@
1
+ import { type ConvertBalances } from '../../../domains/convert/balances';
2
+ import type { ConvertRecipientAddresses, ConvertResolvedAsset } from '../../../domains/convert/types';
3
+ import { FunCheckoutStep } from '../FunCheckoutStep';
4
+ import type { ModalStepInfo } from '../stepTransition';
5
+ import { type CheckoutModalCommonState } from '../stepTransition.shared';
6
+ import type { ConvertAssetOption } from './ConvertAssetRow';
7
+ export type ConvertSelectDestinationState = CheckoutModalCommonState;
8
+ export type ConvertSelectDestinationNext = Record<never, never>;
9
+ /** Destination chains in the host's order, without a chain whose only token is the source. */
10
+ export declare function getConvertDestinationChainIds({ assets, sourceKey, }: {
11
+ assets: ConvertResolvedAsset[];
12
+ sourceKey: string | undefined;
13
+ }): string[];
14
+ /**
15
+ * The chain whose tokens the destination screen opens on: the picked
16
+ * destination's, otherwise the first one listed.
17
+ */
18
+ export declare function getInitialDestinationChainId({ chainIds, destinationAsset, }: {
19
+ chainIds: string[];
20
+ destinationAsset: ConvertResolvedAsset | undefined;
21
+ }): string | undefined;
22
+ /** One chain's destination rows, in the host's order, without the source. */
23
+ export declare function getConvertDestinationOptions({ assets, balances, chainId, sourceKey, recipientAddresses, }: {
24
+ assets: ConvertResolvedAsset[];
25
+ balances: ConvertBalances | undefined;
26
+ chainId: string;
27
+ sourceKey: string | undefined;
28
+ recipientAddresses: ConvertRecipientAddresses;
29
+ }): ConvertAssetOption[];
30
+ export declare const ConvertSelectDestinationStepInfo: ModalStepInfo<FunCheckoutStep.CONVERT_SELECT_DESTINATION>;
@@ -0,0 +1,18 @@
1
+ import { type ConvertBalances } from '../../../domains/convert/balances';
2
+ import type { ConvertResolvedAsset } from '../../../domains/convert/types';
3
+ import { FunCheckoutStep } from '../FunCheckoutStep';
4
+ import type { ModalStepInfo } from '../stepTransition';
5
+ import { type CheckoutModalCommonState } from '../stepTransition.shared';
6
+ import type { ConvertAssetOption } from './ConvertAssetRow';
7
+ export type ConvertSelectSourceState = CheckoutModalCommonState;
8
+ export type ConvertSelectSourceNext = Record<never, never>;
9
+ /**
10
+ * The source screen's rows: held tokens by USD value, disabled ones last.
11
+ * - Under the $1 minimum is disabled ("Low Balance"): Relay won't quote it.
12
+ * - An unreadable balance stays listed but disabled, so funds never look gone.
13
+ */
14
+ export declare function getConvertSourceOptions({ assets, balances, }: {
15
+ assets: ConvertResolvedAsset[];
16
+ balances: ConvertBalances;
17
+ }): ConvertAssetOption[];
18
+ export declare const ConvertSelectSourceStepInfo: ModalStepInfo<FunCheckoutStep.CONVERT_SELECT_SOURCE>;
@@ -1,6 +1,8 @@
1
1
  import { FunCheckoutStep } from '../FunCheckoutStep';
2
2
  import type { ModalStepInfo } from '../stepTransition';
3
- import type { CheckoutModalCommonState } from '../stepTransition.shared';
3
+ import { type CheckoutModalCommonState } from '../stepTransition.shared';
4
4
  export type ConvertState = CheckoutModalCommonState;
5
- export type ConvertNext = null;
5
+ export interface ConvertNext {
6
+ assetScreen: 'source' | 'destination';
7
+ }
6
8
  export declare const ConvertStepInfo: ModalStepInfo<FunCheckoutStep.CONVERT>;
@@ -23,6 +23,8 @@ export declare enum FunCheckoutStep {
23
23
  SWAPPED_IFRAME = "swapped_iframe",
24
24
  PERPS_TRANSFER = "perps_transfer",
25
25
  CONVERT = "convert",
26
+ CONVERT_SELECT_SOURCE = "convert_select_source",
27
+ CONVERT_SELECT_DESTINATION = "convert_select_destination",
26
28
  WITHDRAWAL_ENTER_AMOUNT = "withdrawal_enter_amount",
27
29
  WITHDRAWAL_COMPLETE = "withdrawal_complete"
28
30
  }
@@ -4,7 +4,7 @@ import type { Hex } from 'viem';
4
4
  import { type ConnectablePaymentMethodInfo, PaymentMethod, type PaymentMethodBitcoinLightningInfo, type PaymentMethodCardInfo, type PaymentMethodCashAppLightningInfo, type PaymentMethodVirtualBankIncompleteInfo } from '../../../domains/paymentMethods';
5
5
  import type { FunkitCheckoutQuoteResult } from '../../../domains/quote';
6
6
  import { type PaymentMethodType } from '../../../hooks/usePaymentSources';
7
- import { type CustomWithdrawalConfig, type WalletWithdrawalConfig } from '../../../providers/FunkitCheckoutContext';
7
+ import { type MultiSourceWithdrawalConfig, type SingleWithdrawalConfig } from '../../../providers/FunkitCheckoutContext';
8
8
  import { type CheckoutModalCommonState, FunCheckoutStep } from '../stepTransition.shared';
9
9
  import { type ModalStepComponentProps, type ModalStepInfo } from '../stepTransition';
10
10
  import type { SwappedMode } from '../../../providers/SwappedProvider';
@@ -19,7 +19,7 @@ export type SourceChangeState = CheckoutModalCommonState & {
19
19
  * UI while still on SourceChange. Cleared when leaving the tab so the effect
20
20
  * reverts back to deposit mode. Read only by that effect.
21
21
  */
22
- withdrawalConfig?: WalletWithdrawalConfig | CustomWithdrawalConfig;
22
+ withdrawalConfig?: SingleWithdrawalConfig | MultiSourceWithdrawalConfig;
23
23
  };
24
24
  export type SourceChangeNext = {
25
25
  connectNew: false;
@@ -71,7 +71,7 @@ export type SourceChangeNext = {
71
71
  } | {
72
72
  /** Enter the cashier withdrawal flow with a resolved single-method config. */
73
73
  withdraw: true;
74
- withdrawalConfig: WalletWithdrawalConfig | CustomWithdrawalConfig;
74
+ withdrawalConfig: SingleWithdrawalConfig | MultiSourceWithdrawalConfig;
75
75
  } | {
76
76
  /**
77
77
  * Inline withdrawal (swapped-withdrawal flag off): the amount form is
@@ -79,6 +79,8 @@ export type SourceChangeNext = {
79
79
  * to the completion screen rather than through WITHDRAWAL_ENTER_AMOUNT.
80
80
  */
81
81
  withdrawComplete: true;
82
+ /** The source that ran — the picked one on a multi-source config. */
83
+ executedConfig: SingleWithdrawalConfig;
82
84
  hash: Hex;
83
85
  withdrawnAmount: string;
84
86
  tokenSymbol: string;
@@ -0,0 +1,8 @@
1
+ import type { FormOfPaymentType } from '@funkit/api-base';
2
+ import type { PerfIframeReadyProperties } from '../../../hooks/track/analytics/events';
3
+ /** Shared by the checkout and withdrawal Swapped iframe controllers. */
4
+ export declare function buildPerfIframeReadyProperties(args: {
5
+ fopType: FormOfPaymentType;
6
+ isFirst: boolean;
7
+ totalMs: number;
8
+ }): PerfIframeReadyProperties;
@@ -1,11 +1,14 @@
1
1
  import React from 'react';
2
2
  import type { Hex } from 'viem';
3
3
  import type { FunkitCheckoutQuoteResult } from '../../../domains/quote';
4
- import type { CustomWithdrawalConfig, WalletWithdrawalConfig } from '../../../providers/FunkitCheckoutContext';
4
+ import type { MultiSourceWithdrawalConfig, SingleWithdrawalConfig } from '../../../providers/FunkitCheckoutContext';
5
5
  import { type CheckoutModalCommonState, FunCheckoutStep } from '../stepTransition.shared';
6
6
  import { type ModalStepComponentProps, type ModalStepInfo } from '../stepTransition';
7
7
  export type WithdrawalCompleteState = CheckoutModalCommonState & {
8
- withdrawalConfig: WalletWithdrawalConfig | CustomWithdrawalConfig;
8
+ /** The config to reopen on "New withdrawal". */
9
+ withdrawalConfig: SingleWithdrawalConfig | MultiSourceWithdrawalConfig;
10
+ /** The source that ran; what the success screen describes. */
11
+ executedConfig: SingleWithdrawalConfig;
9
12
  hash: Hex;
10
13
  withdrawnAmount: string;
11
14
  tokenSymbol: string;
@@ -1,13 +1,15 @@
1
1
  import React from 'react';
2
2
  import type { Hex } from 'viem';
3
3
  import type { FunkitCheckoutQuoteResult } from '../../../domains/quote';
4
- import type { CustomWithdrawalConfig, WalletWithdrawalConfig } from '../../../providers/FunkitCheckoutContext';
4
+ import type { MultiSourceWithdrawalConfig, SingleWithdrawalConfig } from '../../../providers/FunkitCheckoutContext';
5
5
  import { type CheckoutModalCommonState, FunCheckoutStep } from '../stepTransition.shared';
6
6
  import { type ModalStepComponentProps, type ModalStepInfo } from '../stepTransition';
7
7
  export type WithdrawalEnterAmountState = CheckoutModalCommonState & {
8
- withdrawalConfig: WalletWithdrawalConfig | CustomWithdrawalConfig;
8
+ withdrawalConfig: SingleWithdrawalConfig | MultiSourceWithdrawalConfig;
9
9
  };
10
10
  export type WithdrawalEnterAmountNext = {
11
+ /** The source that ran — the picked one on a multi-source config. */
12
+ executedConfig: SingleWithdrawalConfig;
11
13
  hash: Hex;
12
14
  withdrawnAmount: string;
13
15
  tokenSymbol: string;
@@ -6,6 +6,8 @@ import { type VirtualFiatAccountNext, type VirtualFiatAccountState } from '../..
6
6
  import { type DynamicTargetAssetCandidate, FunCheckoutStartingStep, type FunkitActiveCheckoutItem } from '../../providers/FunkitCheckoutContext';
7
7
  import { type FunkitTextCustomizationsConfig } from '../../providers/FunkitConfigContext';
8
8
  import { type PerpsTransferNext, type PerpsTransferState } from '../PolymarketPerpsTransfer/PerpsTransferStep';
9
+ import { type ConvertSelectDestinationNext, type ConvertSelectDestinationState } from './Convert/ConvertSelectDestinationStep';
10
+ import { type ConvertSelectSourceNext, type ConvertSelectSourceState } from './Convert/ConvertSelectSourceStep';
9
11
  import { type ConvertNext, type ConvertState } from './Convert/ConvertStep';
10
12
  import { type BrokerageSuccessState } from './Brokerage/BrokerageSuccessModal';
11
13
  import { type BrokerageTwoFANext, type BrokerageTwoFAState } from './Brokerage/BrokerageTwoFA';
@@ -113,6 +115,8 @@ export type CheckoutModalState<S extends FunCheckoutStep = FunCheckoutStep> = {
113
115
  [FunCheckoutStep.SWAPPED_IFRAME]: SwappedIframeState;
114
116
  [FunCheckoutStep.PERPS_TRANSFER]: PerpsTransferState;
115
117
  [FunCheckoutStep.CONVERT]: ConvertState;
118
+ [FunCheckoutStep.CONVERT_SELECT_SOURCE]: ConvertSelectSourceState;
119
+ [FunCheckoutStep.CONVERT_SELECT_DESTINATION]: ConvertSelectDestinationState;
116
120
  [FunCheckoutStep.WITHDRAWAL_ENTER_AMOUNT]: WithdrawalEnterAmountState;
117
121
  [FunCheckoutStep.WITHDRAWAL_COMPLETE]: WithdrawalCompleteState;
118
122
  }[T] & {
@@ -145,6 +149,8 @@ export type NextPayload<S extends FunCheckoutStep = FunCheckoutStep> = {
145
149
  [FunCheckoutStep.SWAPPED_IFRAME]: SwappedIframeNext;
146
150
  [FunCheckoutStep.PERPS_TRANSFER]: PerpsTransferNext;
147
151
  [FunCheckoutStep.CONVERT]: ConvertNext;
152
+ [FunCheckoutStep.CONVERT_SELECT_SOURCE]: ConvertSelectSourceNext;
153
+ [FunCheckoutStep.CONVERT_SELECT_DESTINATION]: ConvertSelectDestinationNext;
148
154
  [FunCheckoutStep.WITHDRAWAL_ENTER_AMOUNT]: WithdrawalEnterAmountNext;
149
155
  [FunCheckoutStep.WITHDRAWAL_COMPLETE]: WithdrawalCompleteNext;
150
156
  }[S] & {
@@ -157,7 +163,7 @@ export type NextPayload<S extends FunCheckoutStep = FunCheckoutStep> = {
157
163
  /** Whether the current step should be popped from the history stack, so it's skipped when going back */
158
164
  popCurrentStep?: boolean;
159
165
  };
160
- export declare function useCheckoutModalTransition(checkoutItem: FunkitActiveCheckoutItem, onClose: () => void): {
166
+ export declare function useCheckoutModalTransition(checkoutItem: FunkitActiveCheckoutItem, onClose: () => void, isModalOpen: boolean): {
161
167
  animation: import("../../hooks/useAnimatedNavigation").AnimationState;
162
168
  modalState: CheckoutModalState<FunCheckoutStep>;
163
169
  onBack: () => void;
@@ -169,7 +175,6 @@ export declare function useCheckoutModalTransition(checkoutItem: FunkitActiveChe
169
175
  onStepChange: (nextState: CheckoutModalState) => void;
170
176
  setModalState: import("react").Dispatch<SetStateAction<CheckoutModalState<FunCheckoutStep>>>;
171
177
  hasHistoryEntry: boolean;
172
- isStepReady: boolean;
173
178
  };
174
179
  export declare function useTitleConfig<S extends FunCheckoutStep>(checkoutItem: FunkitActiveCheckoutItem, state: CheckoutModalState<S>): {
175
180
  disableBack: boolean;
@@ -9,7 +9,6 @@ export interface CheckoutModalCommonState {
9
9
  /** Whether checkout should not be allowed to continue due to security reasons*/
10
10
  isBlocked?: boolean;
11
11
  startingStep: FunCheckoutStartingStep;
12
- targetChainId: string;
13
12
  showWalletOptions?: boolean;
14
13
  hideBottomDivider: boolean;
15
14
  }
@@ -4,6 +4,8 @@
4
4
  * Extracted from WithdrawalContent.tsx to keep Lighter-specific logic isolated.
5
5
  */
6
6
  import { type LighterAccountIndex } from '@funkit/api-base';
7
+ import { type LighterChainId } from '@funkit/chains';
8
+ import type { TFunction } from 'i18next';
7
9
  import React from 'react';
8
10
  import { type Address, type Hex } from 'viem';
9
11
  import { type CheckoutConfirmationError } from '../../domains/checkoutErrors';
@@ -11,7 +13,7 @@ import type { CustomWithdrawalConfig, LighterRouteType, TokenInfo, WalletWithdra
11
13
  /** Stable method ids for the Fast / Secure options (used for tracking + switching). */
12
14
  export declare const LIGHTER_FAST_METHOD_ID = "lighter-fast";
13
15
  export declare const LIGHTER_SECURE_METHOD_ID = "lighter-secure";
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, } from '@funkit/connect-core/clients/lighter';
16
+ 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, getLighterSecureL1Address, resolveLighterAssetIndex, resolveLighterSecureRouteType, } from '@funkit/connect-core/clients/lighter';
15
17
  /**
16
18
  * The selected source token as identified on Lighter's own L2, rather than by
17
19
  * its mainnet bridge address — two Secure selections can share one mainnet
@@ -23,15 +25,19 @@ export { LIGHTER_DEFAULT_SECURE_MIN_WITHDRAWAL_AMOUNTS, LIGHTER_FAST_MAX_WITHDRA
23
25
  * hasn't resolved yet, so callers keep their existing value rather than pointing
24
26
  * at asset 0.
25
27
  */
26
- export declare function resolveLighterSourceAsset({ assetIndex, routeType, }: {
28
+ export declare function resolveLighterSourceAsset({ assetIndex, routeType, chainId, }: {
27
29
  assetIndex: number | undefined;
28
30
  routeType: LighterRouteType;
31
+ /** Lighter instance the withdrawal draws from. */
32
+ chainId: LighterChainId;
29
33
  }): TokenInfo | undefined;
30
- export declare function resolveLighterConfirmedTarget({ isLighterSecure, mainnetTokenAddress, selectedSourceToken, withdrawalInputAmount, }: {
34
+ export declare function resolveLighterConfirmedTarget({ isLighterSecure, l1TokenAddress, selectedSourceToken, withdrawalInputAmount, l1ChainId, }: {
31
35
  isLighterSecure: boolean;
32
- mainnetTokenAddress: Address | undefined;
36
+ /** The L1 token the withdrawal lands as. */
37
+ l1TokenAddress: Address | undefined;
33
38
  selectedSourceToken: string;
34
39
  withdrawalInputAmount: string;
40
+ l1ChainId: number;
35
41
  }): {
36
42
  asset: TokenInfo;
37
43
  ticker: string;
@@ -59,22 +65,46 @@ export declare function useLighterWithdrawalBalances({ accountIndex, }: {
59
65
  };
60
66
  type FunkitWithdrawalConfig = WalletWithdrawalConfig | CustomWithdrawalConfig;
61
67
  /**
62
- * Lighter Fast withdrawal: USDC Perps source, routed through Fun + Relay (the
63
- * source chain is Lighter's relay chain; Secure uses mainnet). See
64
- * buildLighterFastWalletWithdrawalConfig.
68
+ * Lighter Fast withdrawal: perps collateral, routed through Fun + Relay. Its
69
+ * source chain is the key's Lighter instance (`chainId`); Secure's is the L1.
70
+ * See buildLighterFastWalletWithdrawalConfig.
65
71
  */
66
- export declare function isLighterFastWithdrawal(apiKey: string, config: Pick<FunkitWithdrawalConfig, 'sourceChainId'>): boolean;
72
+ export declare function isLighterFastWithdrawal(chainId: LighterChainId | undefined, config: Pick<FunkitWithdrawalConfig, 'sourceChainId'>): boolean;
73
+ /** The fixed Fast source chip for the key's instance; `undefined` off Fast. */
74
+ export declare function getLighterFastSourceChip(apiKey: string, config: Pick<FunkitWithdrawalConfig, 'sourceChainId'>, t: TFunction): {
75
+ label: string;
76
+ tooltip: string;
77
+ } | undefined;
78
+ /**
79
+ * Lighter Secure withdrawal: an L1 withdrawal from the key's Lighter instance
80
+ * (`chainId`), for instances that offer Secure.
81
+ */
82
+ export declare function isLighterSecureWithdrawal(chainId: LighterChainId | undefined, config: Pick<FunkitWithdrawalConfig, 'sourceChainId'> | null | undefined): boolean;
83
+ /** The key's Lighter instance when `config` is its Secure withdrawal. */
84
+ export declare function getLighterSecureWithdrawalChainId(apiKey: string, config: Pick<FunkitWithdrawalConfig, 'sourceChainId'> | null | undefined): LighterChainId | undefined;
85
+ /** A Fast source names the instance; a Secure source names its L1. */
86
+ export declare function resolveLighterWithdrawalInstance(sourceChainId: string): LighterChainId | undefined;
67
87
  /**
68
- * Detects Lighter Secure withdrawal (mainnet source chain), auto-fills the
88
+ * Detects Lighter Secure withdrawal on the instance's L1, auto-fills the
69
89
  * recipient address with the connected wallet, and fetches the Lighter account
70
90
  * so per-asset balances are available to the withdrawal form.
71
91
  */
72
- export declare function useLighterWithdrawal(config: FunkitWithdrawalConfig, setRecipientAddress: (addr: string) => void): {
92
+ export declare function useLighterWithdrawal(config: FunkitWithdrawalConfig, setRecipientAddress: (addr: string) => void, selectedSourceToken: string): {
93
+ lighterChainId: 3586256 | 548123634 | undefined;
73
94
  isLighterSecure: boolean;
74
95
  isLighterFast: boolean;
75
96
  isUnifiedTradingMode: boolean;
76
97
  connectedAddress: `0x${string}` | undefined;
77
- lighterAssets: import("@funkit/connect-core").LighterAsset[];
98
+ lighterSecureL1Address: `0x${string}` | undefined;
99
+ lighterSecureAsset: {
100
+ assetIndex: number;
101
+ routeType: LighterRouteType;
102
+ } | undefined;
103
+ lighterSourceCustomData: {
104
+ type: "lighter";
105
+ routeType: LighterRouteType;
106
+ } | undefined;
107
+ lighterSourceAsset: TokenInfo | undefined;
78
108
  lighterFastUnstakedFee: number;
79
109
  isLighterFastUnstakedFeeFetched: boolean;
80
110
  invalidateLighterAccount: () => void;
@@ -90,8 +120,9 @@ export declare function useLighterWithdrawal(config: FunkitWithdrawalConfig, set
90
120
  * `withdrawalError` auto-clears after ~10s) and resets when the user edits the
91
121
  * amount or source token, so a fresh attempt can retry the L2 path.
92
122
  */
93
- export declare function useLighterL1Fallback({ isLighterSecure, withdrawalError, connectedAddress, resetKey, }: {
123
+ export declare function useLighterL1Fallback({ isLighterSecure, chainId, withdrawalError, connectedAddress, resetKey, }: {
94
124
  isLighterSecure: boolean;
125
+ chainId: LighterChainId | undefined;
95
126
  withdrawalError: CheckoutConfirmationError | null;
96
127
  connectedAddress: Address | undefined;
97
128
  /** Changes when the user edits amount/token — resets the latched offer. */
@@ -126,10 +157,11 @@ export declare function LighterSecureAddressDisplay({ address }: {
126
157
  /**
127
158
  * Lighter Secure: display-only receive token + chain. Both are locked — the
128
159
  * token always matches the source asset, and the destination chain is always
129
- * Ethereum mainnet. Each field surfaces a hover tooltip explaining the lock.
160
+ * the instance's L1. Each field surfaces a hover tooltip explaining the lock.
130
161
  */
131
- export declare function LighterSecureReceiveDisplay({ sourceTokenSymbol: rawSourceTokenSymbol, }: {
162
+ export declare function LighterSecureReceiveDisplay({ sourceTokenSymbol: rawSourceTokenSymbol, chainId, }: {
132
163
  sourceTokenSymbol: string;
164
+ chainId: LighterChainId;
133
165
  }): React.JSX.Element;
134
166
  /**
135
167
  * Lighter Secure: receive amount value (1:1 — same token, no swap).
@@ -145,10 +177,11 @@ export declare function LighterSecureReceiveAmountValue({ amount, tokenSymbol: r
145
177
  * Lighter Secure calls Lighter's API directly and runs outside of the
146
178
  * FunKit relay system. This component shows an immediate success state.
147
179
  */
148
- export declare function LighterSecureWithdrawalSuccess({ onClose, onNewWithdrawal, amount, tokenSymbol: rawTokenSymbol, txHash, }: {
180
+ export declare function LighterSecureWithdrawalSuccess({ onClose, onNewWithdrawal, amount, tokenSymbol: rawTokenSymbol, txHash, chainId, }: {
149
181
  onClose: () => void;
150
182
  onNewWithdrawal: () => void;
151
183
  amount: string;
152
184
  tokenSymbol: string;
153
185
  txHash: string;
186
+ chainId: LighterChainId;
154
187
  }): React.JSX.Element;
@@ -1,11 +1,20 @@
1
1
  import React from 'react';
2
2
  import type { WithdrawalAmountSelectionType } from '../../hooks/track/analytics/events';
3
- import type { FunkitWithdrawalConfig, MultiMethodWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
3
+ import type { SingleWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
4
4
  import type { SourceTokenOption } from '../../providers/FunkitCheckoutContext';
5
5
  export type { SourceTokenOption };
6
- export declare function WithdrawAmountInput({ withdrawalInputAmount, setWithdrawalInputAmount, sourceTokenBalance, isWithdrawAmountTooLow, isWithdrawAmountTooHigh, isWithdrawAmountAboveBalance, isWithdrawAmountValid, minWithdrawalDisplayValue, config, sourceTokenOptions, onSourceTokenChange, selectedSourceToken, sourceTokenUsdPrice, onAmountSelectionChange, onAmountChanged, onMaxButtonClicked, }: {
7
- config: Exclude<FunkitWithdrawalConfig, MultiMethodWithdrawalConfig>;
6
+ /**
7
+ * A dropdown row. `ticker` denominates the amount when the selection key
8
+ * isn't a token symbol (a multi-source id such as `ETH_BASE`).
9
+ */
10
+ export type SourceDropdownOption = SourceTokenOption & {
11
+ ticker?: string;
12
+ };
13
+ export declare function WithdrawAmountInput({ withdrawalInputAmount, setWithdrawalInputAmount, sourceTokenBalance, maxWithdrawableAmount, isWithdrawAmountTooLow, isWithdrawAmountTooHigh, isWithdrawAmountAboveBalance, isWithdrawAmountValid, minWithdrawalDisplayValue, config, sourceTokenOptions, onSourceTokenChange, selectedSourceToken, showChainBadges, isSourceTokenChangeDisabled, sourceTokenUsdPrice, onAmountSelectionChange, onAmountChanged, onMaxButtonClicked, }: {
14
+ config: SingleWithdrawalConfig;
8
15
  sourceTokenBalance: string;
16
+ /** What Max fills in — the balance less any reserve for network fees. */
17
+ maxWithdrawableAmount?: string;
9
18
  /** User-entered amount in source-token units (e.g. "0.5" for 0.5 ETH). */
10
19
  withdrawalInputAmount: string;
11
20
  setWithdrawalInputAmount: (s: string) => void;
@@ -26,10 +35,14 @@ export declare function WithdrawAmountInput({ withdrawalInputAmount, setWithdraw
26
35
  * the component re-derives which one it got (see `isMinInTokenUnits`).
27
36
  */
28
37
  minWithdrawalDisplayValue: number;
29
- sourceTokenOptions?: SourceTokenOption[];
38
+ sourceTokenOptions?: SourceDropdownOption[];
30
39
  onSourceTokenChange?: (opt: SourceTokenOption) => void;
31
40
  /** Currently selected source token symbol (drives chip label + icon). */
32
41
  selectedSourceToken?: string;
42
+ /** Options sit on different chains (ETH on Base and on Ink); badge each icon. */
43
+ showChainBadges?: boolean;
44
+ /** Locks the dropdown, e.g. while a withdrawal is signing. */
45
+ isSourceTokenChangeDisabled?: boolean;
33
46
  /**
34
47
  * USD price per unit of the source token (e.g. ~1620 for ETH).
35
48
  * When omitted, the USD equivalent is rendered as "-" rather than
@@ -1,16 +1,19 @@
1
1
  import React from 'react';
2
2
  import type { Hex } from 'viem';
3
3
  import { type ModalBottomBarIdType } from '../../components/Dialog/Dialog';
4
- import type { CustomWithdrawalConfig, FunkitActiveWithdrawalItem, WalletWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
4
+ import type { FunCheckoutStep } from '../../modals/CheckoutModal/FunCheckoutStep';
5
+ import type { FunkitActiveWithdrawalItem, MultiSourceWithdrawalConfig, SingleWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
5
6
  import { type WithdrawalFormData } from './useWithdrawal';
7
+ import { WithdrawalModalStep } from './types';
6
8
  /**
7
- * WithdrawalContent only operates on concrete single-method withdrawal configs.
8
- * Multi-method configs are resolved in WithdrawalModal before reaching here.
9
+ * Multi-method configs are resolved in WithdrawalModal before reaching here; a
10
+ * multi-source config is resolved by {@link MultiSourceWithdrawContent}.
9
11
  */
10
- type FunkitWithdrawalConfig = WalletWithdrawalConfig | CustomWithdrawalConfig;
11
12
  interface WithdrawContentProps {
12
- onContinue: (withdrawal: WithdrawalFormData, txHash: Hex) => void;
13
- config: FunkitWithdrawalConfig;
13
+ analyticsStep: FunCheckoutStep | WithdrawalModalStep;
14
+ /** `executedConfig` is the source that ran — the picked one on a multi-source config. */
15
+ onContinue: (withdrawal: WithdrawalFormData, txHash: Hex, executedConfig: SingleWithdrawalConfig) => void;
16
+ config: SingleWithdrawalConfig | MultiSourceWithdrawalConfig;
14
17
  withdrawalItem: FunkitActiveWithdrawalItem | null;
15
18
  /**
16
19
  * Switch a Lighter Fast withdrawal to the Lighter Secure method. Wired by
@@ -31,5 +34,5 @@ interface WithdrawContentProps {
31
34
  */
32
35
  disableSubmit?: boolean;
33
36
  }
34
- export declare const WithdrawContent: ({ onContinue, config, withdrawalItem, onSwitchToSecure, bottomBarId, disableSubmit, }: WithdrawContentProps) => React.JSX.Element;
37
+ export declare const WithdrawContent: (props: WithdrawContentProps) => React.JSX.Element;
35
38
  export {};
@@ -0,0 +1,10 @@
1
+ import type { TokenInfo } from '../../providers/FunkitCheckoutContext';
2
+ /**
3
+ * What Max may fill in for a withdrawal's `sourceAsset`, or `null` while an EVM
4
+ * native source's gas price is still loading. Adapts the withdrawal flow's
5
+ * decimal strings to the shared {@link useMaxSpendableAmount}.
6
+ */
7
+ export declare function useMaxWithdrawableAmount({ balance, sourceAsset, }: {
8
+ balance: string;
9
+ sourceAsset: TokenInfo;
10
+ }): string | null;
@@ -0,0 +1,41 @@
1
+ import type { Hex } from 'viem';
2
+ import type { TransferTokenDefault } from '../../hooks/useTokenAndChainDropdown';
3
+ import type { FunkitActiveWithdrawalItem, MultiSourceWithdrawalConfig, SingleWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
4
+ import type { SourceDropdownOption } from './WithdrawAmountInput';
5
+ import type { WithdrawalFormData } from './useWithdrawal';
6
+ /** The multi-source dropdown, as seen by the single-source form. */
7
+ export interface SourceSwitcher {
8
+ options: SourceDropdownOption[];
9
+ selectedId: string;
10
+ /** `receiveSelection` is what the current form shows, carried to the next. */
11
+ onSelect: (id: string, receiveSelection: ReceiveSelection) => void;
12
+ }
13
+ /** What the user picked on the receive side: where funds go and as what. */
14
+ export interface ReceiveSelection {
15
+ recipientAddress: string;
16
+ destination?: TransferTokenDefault;
17
+ }
18
+ /**
19
+ * Resolves the picked source and everything the single-source form needs to
20
+ * run it. `null` only for an empty container.
21
+ */
22
+ export declare function useMultiSourceWithdrawal({ config, withdrawalItem, onContinue, }: {
23
+ config: MultiSourceWithdrawalConfig;
24
+ withdrawalItem: FunkitActiveWithdrawalItem | null;
25
+ onContinue: (withdrawal: WithdrawalFormData, txHash: Hex, executedConfig: SingleWithdrawalConfig) => void;
26
+ }): {
27
+ sourceId: string;
28
+ config: SingleWithdrawalConfig;
29
+ withdrawalItem: {
30
+ withdrawalSourceTokenBalance: ((params: import("../../providers/FunkitCheckoutContext").WithdrawalSourceTokenBalanceParams) => string | number) | undefined;
31
+ id: string;
32
+ initSettings: Partial<import("../../providers/FunkitCheckoutContext").UseFunkitCheckoutPropsWithFullConfig>;
33
+ } | null;
34
+ sourceSwitcher: {
35
+ options: SourceDropdownOption[];
36
+ selectedId: string;
37
+ onSelect: (id: string, receiveSelection: ReceiveSelection) => void;
38
+ };
39
+ initialReceiveSelection: ReceiveSelection | undefined;
40
+ onContinue: (withdrawal: WithdrawalFormData, txHash: Hex, executedConfig: SingleWithdrawalConfig) => void;
41
+ } | null;
@@ -1,7 +1,7 @@
1
1
  import type { TFunction } from 'i18next';
2
2
  import type { Address } from 'viem';
3
3
  import type { FunkitCheckoutQuoteResult } from '../../domains/quote';
4
- import type { CustomWithdrawalConfig, FunkitCheckoutConfig, SourceTokenOption, WalletWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
4
+ import type { CustomWithdrawalConfig, SourceTokenOption, TokenInfo, WalletWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
5
5
  type FunkitWithdrawalConfig = WalletWithdrawalConfig | CustomWithdrawalConfig;
6
6
  /** Where a withdrawal is sending funds: the token, its chain, and its address. */
7
7
  export interface SelectedTargetAsset {
@@ -33,18 +33,37 @@ export declare function getWithdrawButtonText({ isWithdrawing, isValidAddress, i
33
33
  selectedChainName: string | undefined;
34
34
  t: TFunction;
35
35
  }): string;
36
- export declare function isValidWithdrawal({ config, checkoutConfig, withdrawalInputAmount, sourceTokenUsdPrice, recipientAddress, selectedChainId, sourceTokenBalance, selectedSourceToken, }: {
36
+ /**
37
+ * The asset being withdrawn: the selected option's own asset, else the asset a
38
+ * client resolves for the selection, else the config's default source token.
39
+ */
40
+ export declare function resolveWithdrawalSourceAsset({ selectedOption, clientSourceAsset, config, }: {
41
+ selectedOption: SourceTokenOption | undefined;
42
+ clientSourceAsset: TokenInfo | undefined;
43
+ config: Pick<FunkitWithdrawalConfig, 'sourceTokenAddress' | 'sourceChainId'>;
44
+ }): TokenInfo;
45
+ /**
46
+ * The asset whose live price values the withdrawal. An option without its own
47
+ * asset is only the config's token when it names it; any other option stays
48
+ * unpriced rather than borrowing the config token's price.
49
+ */
50
+ export declare function resolvePricedSourceAsset({ selectedOption, selectedSourceToken, config, }: {
51
+ selectedOption: SourceTokenOption | undefined;
52
+ selectedSourceToken: string;
53
+ config: Pick<FunkitWithdrawalConfig, 'sourceTokenAddress' | 'sourceChainId' | 'sourceTokenSymbol'>;
54
+ }): TokenInfo | undefined;
55
+ export declare function isValidWithdrawal({ config, sourceAsset, withdrawalInputAmount, sourceTokenUsdPrice, recipientAddress, selectedChainId, sourceTokenBalance, selectedSourceToken, }: {
37
56
  config: FunkitWithdrawalConfig;
38
- checkoutConfig: FunkitCheckoutConfig | undefined;
57
+ /** Passed to the config's USD limit callbacks. */
58
+ sourceAsset: TokenInfo;
39
59
  /** User-entered amount in source-token units (e.g. "0.5" for 0.5 ETH). */
40
60
  withdrawalInputAmount: string;
41
61
  /**
42
- * USD price per unit of the source token. Hardcoded to 1 for stablecoin
43
- * sources; only Lighter Secure resolves a live spot price, and that path
44
- * uses `getMinWithdrawalAmount` (per-token) which takes priority over the
45
- * USD-min branch — so this field is only meaningfully consumed when it's 1.
62
+ * USD price per unit of the source token. `undefined` while a live price
63
+ * loads: the USD limits are then skipped rather than failed, and
64
+ * `isSourcePricePending` tells the caller not to proceed.
46
65
  */
47
- sourceTokenUsdPrice: number;
66
+ sourceTokenUsdPrice: number | undefined;
48
67
  sourceTokenBalance: string;
49
68
  recipientAddress: string;
50
69
  selectedChainId: number | undefined;
@@ -57,6 +76,7 @@ export declare function isValidWithdrawal({ config, checkoutConfig, withdrawalIn
57
76
  minWithdrawalDisplayValue: number;
58
77
  isValidAddress: boolean;
59
78
  isValidAddressAndChain: boolean;
79
+ isSourcePricePending: boolean;
60
80
  };
61
81
  /**
62
82
  * Converts a source-token amount string to its USD value using the given unit
@@ -0,0 +1,40 @@
1
+ import React, { type ReactNode } from 'react';
2
+ import { type ConvertView } from '../domains/convert/view';
3
+ import { FunCheckoutStep } from '../modals/CheckoutModal/FunCheckoutStep';
4
+ import type { FunkitActiveCheckoutItem } from './FunkitCheckoutContext';
5
+ export declare const CONVERT_QUOTE_INPUT_DEBOUNCE_MS = 300;
6
+ /** How long the success label shows before the screen returns to Convert. */
7
+ export declare const CONVERT_SUCCESS_RESET_MS = 2000;
8
+ /** How long the success label shows before the modal closes, when the host asks for that. */
9
+ export declare const CONVERT_SUCCESS_CLOSE_MS = 3000;
10
+ export interface ConvertContextValue {
11
+ /** Everything the Convert screens render. */
12
+ view: ConvertView;
13
+ editAmount: (inputValue: string) => void;
14
+ /** Flips USD and token entry at the live price. */
15
+ toggleUnit: () => void;
16
+ setMax: (maxBaseUnits: bigint) => void;
17
+ /** Keys are `convertAssetKey`s. A different source drops the amount. */
18
+ pickSource: (sourceKey: string) => void;
19
+ pickDestination: (destinationKey: string) => void;
20
+ swapDirection: () => void;
21
+ /** Converts the quote on screen; the host's callbacks hear the outcome. */
22
+ convert: () => void;
23
+ /** Asks again for whatever failed: a host lookup, else the quote. */
24
+ retry: () => void;
25
+ }
26
+ export declare function useConvert(): ConvertContextValue;
27
+ interface ConvertProviderProps {
28
+ checkoutItem: FunkitActiveCheckoutItem;
29
+ /** The modal's step: live reads run only on a Convert screen or mid-conversion. */
30
+ step: FunCheckoutStep;
31
+ onClose: () => void;
32
+ children: ReactNode;
33
+ }
34
+ /**
35
+ * Convert's draft, live reads and submission for the whole checkout modal, so
36
+ * they outlive the screens: the token screens and a tab switch unmount them.
37
+ * Without a Convert config it renders its children only.
38
+ */
39
+ export declare function ConvertProvider({ checkoutItem, step, onClose, children, }: ConvertProviderProps): React.JSX.Element;
40
+ export {};