@funkit/connect 12.16.0 → 12.17.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 (64) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/dist/clients/axiom.d.ts +1 -1
  3. package/dist/clients/{chunk-7JYLS7IF.js → chunk-2L6IKKNH.js} +48 -32
  4. package/dist/clients/{chunk-6IH7AWFA.js → chunk-HANOVGPH.js} +1 -1
  5. package/dist/clients/{chunk-OB5GKTP2.js → chunk-LVR6RQMO.js} +1 -1
  6. package/dist/clients/chunk-R25GIAD5.js +59 -0
  7. package/dist/clients/{chunk-UZ3NA7HN.js → chunk-TWP5LFPX.js} +5 -5
  8. package/dist/clients/{chunk-BKK2BFIP.js → chunk-V4RIF2NR.js} +1 -1
  9. package/dist/clients/fanatics.js +2 -2
  10. package/dist/clients/internal/nado/withdrawalCallback.js +3 -3
  11. package/dist/clients/internal/nado/withdrawalErrors.js +2 -2
  12. package/dist/clients/internal/nado/withdrawalForm.js +4 -4
  13. package/dist/clients/internal/nado/withdrawalStatus.js +3 -3
  14. package/dist/clients/lighter.d.ts +29 -16
  15. package/dist/clients/lighter.js +149 -68
  16. package/dist/clients/mallard.js +2 -2
  17. package/dist/clients/nado.js +3 -3
  18. package/dist/consts/customers.d.ts +12 -1
  19. package/dist/domains/convert/assets.d.ts +22 -0
  20. package/dist/domains/convert/balances.d.ts +21 -24
  21. package/dist/domains/convert/errors.d.ts +38 -0
  22. package/dist/domains/convert/execution.d.ts +39 -0
  23. package/dist/domains/convert/inputAmount.d.ts +24 -0
  24. package/dist/domains/convert/quote.d.ts +24 -0
  25. package/dist/domains/convert/settlement.d.ts +47 -0
  26. package/dist/domains/convert/submit.d.ts +46 -0
  27. package/dist/domains/convert/types.d.ts +39 -23
  28. package/dist/domains/nativeFeeReserve.d.ts +29 -0
  29. package/dist/domains/quote.d.ts +14 -1
  30. package/dist/hooks/queries/useWithdrawFops.d.ts +6 -0
  31. package/dist/hooks/queries/useWithdrawalQuote.d.ts +4 -1
  32. package/dist/hooks/track/WithdrawModalEvent.d.ts +1 -0
  33. package/dist/hooks/track/analytics/events.d.ts +59 -1
  34. package/dist/hooks/track/analytics/mappers.d.ts +5 -4
  35. package/dist/hooks/track/analytics/resolveIframeStepNavigation.d.ts +18 -0
  36. package/dist/hooks/track/analytics/useDepositAnalytics.d.ts +2 -2
  37. package/dist/hooks/track/analytics/useTrackSwappedIframeEvents.d.ts +5 -0
  38. package/dist/hooks/track/analytics/useWithdrawalAnalytics.d.ts +2 -2
  39. package/dist/hooks/track/useQuoteAttemptCounter.d.ts +2 -0
  40. package/dist/hooks/useConvertAssets.d.ts +9 -0
  41. package/dist/hooks/useConvertBalances.d.ts +44 -0
  42. package/dist/hooks/useConvertExecute.d.ts +77 -0
  43. package/dist/hooks/useConvertInputAmount.d.ts +26 -0
  44. package/dist/hooks/useConvertMaxAmount.d.ts +11 -0
  45. package/dist/hooks/useConvertQuote.d.ts +33 -0
  46. package/dist/hooks/useConvertTransactionStatus.d.ts +23 -0
  47. package/dist/hooks/useMaxSpendableAmount.d.ts +19 -0
  48. package/dist/hooks/usePrepareConvertSubmit.d.ts +22 -0
  49. package/dist/hooks/useStepQueryReadiness.d.ts +45 -15
  50. package/dist/index.d.ts +1 -1
  51. package/dist/index.js +2396 -1598
  52. package/dist/modals/CheckoutModal/SwappedIframe/swappedIframeReady.track.d.ts +8 -0
  53. package/dist/modals/CheckoutModal/stepTransition.d.ts +1 -2
  54. package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +48 -15
  55. package/dist/modals/WithdrawalModal/WithdrawAmountInput.d.ts +3 -1
  56. package/dist/modals/WithdrawalModal/WithdrawalContent.d.ts +4 -1
  57. package/dist/modals/WithdrawalModal/useMaxWithdrawableAmount.d.ts +10 -0
  58. package/dist/modals/WithdrawalModal/withdrawalFormHelpers.d.ts +28 -8
  59. package/dist/providers/FunkitQuoteContext.track.d.ts +23 -3
  60. package/dist/providers/SwappedProvider.d.ts +7 -0
  61. package/dist/utils/customer.d.ts +34 -4
  62. package/dist/wallets/walletConnectors/index.js +44 -44
  63. package/package.json +6 -6
  64. package/dist/clients/chunk-6EU6CXNH.js +0 -20
@@ -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;
@@ -157,7 +157,7 @@ export type NextPayload<S extends FunCheckoutStep = FunCheckoutStep> = {
157
157
  /** Whether the current step should be popped from the history stack, so it's skipped when going back */
158
158
  popCurrentStep?: boolean;
159
159
  };
160
- export declare function useCheckoutModalTransition(checkoutItem: FunkitActiveCheckoutItem, onClose: () => void): {
160
+ export declare function useCheckoutModalTransition(checkoutItem: FunkitActiveCheckoutItem, onClose: () => void, isModalOpen: boolean): {
161
161
  animation: import("../../hooks/useAnimatedNavigation").AnimationState;
162
162
  modalState: CheckoutModalState<FunCheckoutStep>;
163
163
  onBack: () => void;
@@ -169,7 +169,6 @@ export declare function useCheckoutModalTransition(checkoutItem: FunkitActiveChe
169
169
  onStepChange: (nextState: CheckoutModalState) => void;
170
170
  setModalState: import("react").Dispatch<SetStateAction<CheckoutModalState<FunCheckoutStep>>>;
171
171
  hasHistoryEntry: boolean;
172
- isStepReady: boolean;
173
172
  };
174
173
  export declare function useTitleConfig<S extends FunCheckoutStep>(checkoutItem: FunkitActiveCheckoutItem, state: CheckoutModalState<S>): {
175
174
  disableBack: boolean;
@@ -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;
@@ -3,9 +3,11 @@ import type { WithdrawalAmountSelectionType } from '../../hooks/track/analytics/
3
3
  import type { FunkitWithdrawalConfig, MultiMethodWithdrawalConfig } 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, }: {
6
+ export declare function WithdrawAmountInput({ withdrawalInputAmount, setWithdrawalInputAmount, sourceTokenBalance, maxWithdrawableAmount, isWithdrawAmountTooLow, isWithdrawAmountTooHigh, isWithdrawAmountAboveBalance, isWithdrawAmountValid, minWithdrawalDisplayValue, config, sourceTokenOptions, onSourceTokenChange, selectedSourceToken, sourceTokenUsdPrice, onAmountSelectionChange, onAmountChanged, onMaxButtonClicked, }: {
7
7
  config: Exclude<FunkitWithdrawalConfig, MultiMethodWithdrawalConfig>;
8
8
  sourceTokenBalance: string;
9
+ /** What Max fills in — the balance less any reserve for network fees. */
10
+ maxWithdrawableAmount?: string;
9
11
  /** User-entered amount in source-token units (e.g. "0.5" for 0.5 ETH). */
10
12
  withdrawalInputAmount: string;
11
13
  setWithdrawalInputAmount: (s: string) => void;
@@ -1,14 +1,17 @@
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 { FunCheckoutStep } from '../../modals/CheckoutModal/FunCheckoutStep';
4
5
  import type { CustomWithdrawalConfig, FunkitActiveWithdrawalItem, WalletWithdrawalConfig } from '../../providers/FunkitCheckoutContext';
5
6
  import { type WithdrawalFormData } from './useWithdrawal';
7
+ import { WithdrawalModalStep } from './types';
6
8
  /**
7
9
  * WithdrawalContent only operates on concrete single-method withdrawal configs.
8
10
  * Multi-method configs are resolved in WithdrawalModal before reaching here.
9
11
  */
10
12
  type FunkitWithdrawalConfig = WalletWithdrawalConfig | CustomWithdrawalConfig;
11
13
  interface WithdrawContentProps {
14
+ analyticsStep: FunCheckoutStep | WithdrawalModalStep;
12
15
  onContinue: (withdrawal: WithdrawalFormData, txHash: Hex) => void;
13
16
  config: FunkitWithdrawalConfig;
14
17
  withdrawalItem: FunkitActiveWithdrawalItem | null;
@@ -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 function WithdrawContent({ analyticsStep, onContinue, config, withdrawalItem, onSwitchToSecure, bottomBarId, disableSubmit, }: 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;
@@ -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
@@ -1,8 +1,28 @@
1
- import type { QuoteMode } from '../domains/quoteMode';
1
+ import type { DirectExecutionType } from '@funkit/api-base';
2
+ import type { PaymentMethodInfo } from '../domains/paymentMethods';
3
+ import type { FunkitCheckoutQuoteResult, QuotePhaseResult } from '../domains/quote';
4
+ import { QuoteMode } from '../domains/quoteMode';
5
+ import type { PerfQuoteProperties } from '../hooks/track/analytics/events';
2
6
  import type { CheckoutModalEvent } from '../hooks/track/CheckoutModalEvent';
3
- import type { WithdrawModalEvent } from '../hooks/track/WithdrawModalEvent';
4
7
  import type { TrackEventData } from '../hooks/track/useTrack';
8
+ import type { WithdrawModalEvent } from '../hooks/track/WithdrawModalEvent';
9
+ import type { FunCheckoutStep } from '../modals/CheckoutModal/FunCheckoutStep';
10
+ import type { WithdrawalModalStep } from '../modals/WithdrawalModal/types';
5
11
  import type { FunkitActiveCheckoutItem } from './FunkitCheckoutContext';
6
- import type { FunkitCheckoutQuoteResult } from './FunkitHistoryContext';
7
12
  export declare const trackEventFromBaseQuote: (checkoutItem: FunkitActiveCheckoutItem, eventName: CheckoutModalEvent | WithdrawModalEvent, quoteMode?: QuoteMode) => TrackEventData;
13
+ type PerfQuotePropertiesContext = {
14
+ analyticsStep: FunCheckoutStep | WithdrawalModalStep;
15
+ checkoutItem: FunkitActiveCheckoutItem;
16
+ connectorId: string | undefined;
17
+ directExecutionType: DirectExecutionType | null;
18
+ paymentMethodInfo: PaymentMethodInfo;
19
+ quoteAttempt: number;
20
+ quoteMode: QuoteMode;
21
+ };
22
+ export declare const buildPerfQuoteProperties: (args: PerfQuotePropertiesContext & {
23
+ quoteResult: QuotePhaseResult;
24
+ resolvedAtMs: number;
25
+ startedAtMs: number;
26
+ }) => PerfQuoteProperties;
8
27
  export declare const trackEventFromFinalQuote: (finalEstimation: FunkitCheckoutQuoteResult, checkoutItem: FunkitActiveCheckoutItem, eventName: CheckoutModalEvent | WithdrawModalEvent, quoteMode?: QuoteMode) => TrackEventData;
28
+ export {};
@@ -15,6 +15,13 @@ interface SwappedSlot {
15
15
  setIframeRef: (el: HTMLIFrameElement | null) => void;
16
16
  focusAmountInput: () => void;
17
17
  swappedTransport: SwappedTransport;
18
+ /**
19
+ * Returns true the first time it's called for a given checkout id, false
20
+ * afterward. Lives on the slot (not the step component) so it survives the
21
+ * iframe step being unmounted/remounted as the user navigates back and
22
+ * forth, while still resetting for a genuinely new checkout id.
23
+ */
24
+ markIframeReadyFirst: (checkoutId: string) => boolean;
18
25
  }
19
26
  export declare function SwappedProvider({ children, buyingCrypto, }: {
20
27
  children: React.ReactNode;
@@ -1,7 +1,30 @@
1
- import type { DynamicTargetAssetCandidate, LighterAccountLookup } from '@funkit/connect-core';
1
+ import type { DynamicTargetAssetCandidate, LighterAccountSelector } from '@funkit/connect-core';
2
+ import { type LighterChainId } from '@funkit/chains';
2
3
  import type { Address } from 'viem';
3
4
  export { LIGHTER_TRADING_MODE, getLighterAccount, getLighterAccountsByL1Address, useInvalidateLighterAccount, useLighterAccountQuery, useLighterAccountsQuery, } from '@funkit/connect-core';
4
- export type { LighterAccount, LighterAccountLookup, LighterAccountResponse, LighterAccountsByL1AddressResponse, LighterAsset, LighterPoolInfo, LighterShare, LighterSubAccount, } from '@funkit/connect-core';
5
+ export type { LighterAccount, LighterAccountLookup, LighterAccountResponse, LighterAccountSelector, LighterAccountsByL1AddressResponse, LighterAsset, LighterPoolInfo, LighterShare, LighterSubAccount, } from '@funkit/connect-core';
6
+ /** RH routes: every `LIGHTER_RH_*` routing id, new-user ones included. */
7
+ export declare function isLighterRhRoutingId(dynamicRoutingId: string | undefined): boolean;
8
+ /**
9
+ * The Lighter instance to look the wallet's account up on: an RH route is
10
+ * always RH, so its recipient index never comes from the config's free-form
11
+ * target chain. Otherwise a Lighter target chain names it; mainnet new-user
12
+ * routes target an L1, so their `LIGHTER_*` routing id names mainnet.
13
+ * Anything else has no instance and no lookup.
14
+ */
15
+ export declare function resolveLighterLookupChainId({ dynamicRoutingId, targetChain, }: {
16
+ dynamicRoutingId: string | undefined;
17
+ targetChain: string | number | undefined;
18
+ }): LighterChainId | undefined;
19
+ /**
20
+ * A wallet checkout on the RH route waits while the RH account lookup is in
21
+ * flight: quoting before it resolves would save no RH recipient. A lookup that
22
+ * never runs (no resolvable wallet) doesn't hold the checkout.
23
+ */
24
+ export declare function isLighterRhAccountPending({ dynamicRoutingId, isLookupLoading, }: {
25
+ dynamicRoutingId: string | undefined;
26
+ isLookupLoading: boolean;
27
+ }): boolean;
5
28
  /**
6
29
  * Strips the ` (Perps)` variant suffix off a Lighter ticker (e.g.
7
30
  * `USDC (Perps)` → `USDC`). Non-perps tickers pass through unchanged.
@@ -15,7 +38,7 @@ export declare function stripLighterPerpsSuffix(symbol: string | undefined): str
15
38
  * routes (`LIGHTER_USDC_PERPS*`), only the presentation differs.
16
39
  */
17
40
  export declare function adaptLighterTargetAssetsForUnifiedAccount(candidates: DynamicTargetAssetCandidate[]): DynamicTargetAssetCandidate[];
18
- export declare function useLighterAccount(lookup: LighterAccountLookup | null, options?: {
41
+ export declare function useLighterAccount(lookup: LighterAccountSelector | null, options?: {
19
42
  activeOnly?: boolean;
20
43
  }): {
21
44
  account: import("@funkit/connect-core").LighterAccount | undefined;
@@ -180,8 +203,15 @@ export declare function useLighterAccount(lookup: LighterAccountLookup | null, o
180
203
  fetchStatus: import("@tanstack/react-query").FetchStatus;
181
204
  promise: Promise<import("@funkit/connect-core").LighterAccountResponse>;
182
205
  };
183
- export declare function useLighterAccounts({ address, }: {
206
+ /**
207
+ * `chainId` names the Lighter instance the caller is about to use; undefined
208
+ * skips the lookup. Only the key's own instance is looked up: a mismatch skips
209
+ * the lookup rather than redirecting it, so no caller can pair one instance's
210
+ * account index with the other's route.
211
+ */
212
+ export declare function useLighterAccounts({ address, chainId, }: {
184
213
  address: Address | '' | undefined;
214
+ chainId: LighterChainId | undefined;
185
215
  }): {
186
216
  mainAccountIndex: string | undefined;
187
217
  isUnifiedTradingMode: boolean;
@@ -1,7 +1,4 @@
1
1
  "use client";
2
- import {
3
- xdefiWallet
4
- } from "./chunk-HXX4PRE2.js";
5
2
  import {
6
3
  zealWallet
7
4
  } from "./chunk-GLX5FULK.js";
@@ -9,74 +6,77 @@ import {
9
6
  zerionWallet
10
7
  } from "./chunk-34B7OJNT.js";
11
8
  import {
12
- tahoWallet
13
- } from "./chunk-U74RFZOL.js";
9
+ walletConnectWallet
10
+ } from "./chunk-DUX4XCDV.js";
14
11
  import {
15
12
  subWallet
16
13
  } from "./chunk-XODA5ESL.js";
14
+ import {
15
+ tahoWallet
16
+ } from "./chunk-U74RFZOL.js";
17
17
  import {
18
18
  talismanWallet
19
19
  } from "./chunk-IAYYWCVB.js";
20
20
  import {
21
21
  tokenPocketWallet
22
22
  } from "./chunk-NXWG6FG2.js";
23
- import {
24
- trustWallet
25
- } from "./chunk-SR5CZR3L.js";
26
23
  import {
27
24
  tokenaryWallet
28
25
  } from "./chunk-TPM5PUJD.js";
26
+ import {
27
+ trustWallet
28
+ } from "./chunk-SR5CZR3L.js";
29
29
  import {
30
30
  uniswapWallet
31
31
  } from "./chunk-UNDWHCDH.js";
32
32
  import {
33
- walletConnectWallet
34
- } from "./chunk-DUX4XCDV.js";
35
- import {
36
- oneInchWallet
37
- } from "./chunk-GFS2AVAH.js";
38
- import {
39
- rabbyWallet
40
- } from "./chunk-RQ2GXOJL.js";
33
+ xdefiWallet
34
+ } from "./chunk-HXX4PRE2.js";
41
35
  import {
42
36
  rainbowWallet
43
37
  } from "./chunk-ZSSSLFQF.js";
44
38
  import {
45
- roninWallet
46
- } from "./chunk-IA5432IR.js";
39
+ oneKeyWallet
40
+ } from "./chunk-KN32ITJ7.js";
47
41
  import {
48
42
  ramperWallet
49
43
  } from "./chunk-GPXIBTWN.js";
44
+ import {
45
+ rabbyWallet
46
+ } from "./chunk-RQ2GXOJL.js";
47
+ import {
48
+ roninWallet
49
+ } from "./chunk-IA5432IR.js";
50
50
  import {
51
51
  safeWallet
52
52
  } from "./chunk-IR3PJMVM.js";
53
- import {
54
- safeheronWallet
55
- } from "./chunk-UN3ONVNC.js";
56
53
  import {
57
54
  safepalWallet
58
55
  } from "./chunk-BBB2J3US.js";
59
56
  import {
60
- metaMaskWallet
61
- } from "./chunk-RXRYHMRI.js";
62
- import {
63
- ledgerWallet
64
- } from "./chunk-BL4OC2EJ.js";
57
+ safeheronWallet
58
+ } from "./chunk-UN3ONVNC.js";
65
59
  import {
66
60
  mewWallet
67
61
  } from "./chunk-DSPQXAB2.js";
68
62
  import {
69
- oktoWallet
70
- } from "./chunk-V4M3SNPS.js";
63
+ ledgerWallet
64
+ } from "./chunk-BL4OC2EJ.js";
65
+ import {
66
+ metaMaskWallet
67
+ } from "./chunk-RXRYHMRI.js";
71
68
  import {
72
69
  okxWallet
73
70
  } from "./chunk-CU5J53XR.js";
71
+ import {
72
+ oktoWallet
73
+ } from "./chunk-V4M3SNPS.js";
74
74
  import {
75
75
  omniWallet
76
76
  } from "./chunk-2TAUCVX7.js";
77
77
  import {
78
- oneKeyWallet
79
- } from "./chunk-KN32ITJ7.js";
78
+ oneInchWallet
79
+ } from "./chunk-GFS2AVAH.js";
80
80
  import {
81
81
  phantomWallet
82
82
  } from "./chunk-Q27YVDDH.js";
@@ -107,42 +107,39 @@ import {
107
107
  import {
108
108
  bybitWallet
109
109
  } from "./chunk-BBDNB5TQ.js";
110
+ import {
111
+ clvWallet
112
+ } from "./chunk-4FHNLTR3.js";
110
113
  import {
111
114
  coin98Wallet
112
115
  } from "./chunk-RFCZYLNR.js";
113
116
  import {
114
117
  coinbaseWallet
115
118
  } from "./chunk-SM2A3OSG.js";
116
- import {
117
- clvWallet
118
- } from "./chunk-4FHNLTR3.js";
119
119
  import {
120
120
  coreWallet
121
121
  } from "./chunk-TRZDAXCQ.js";
122
- import {
123
- customWallet
124
- } from "./chunk-VKM5M5UK.js";
125
122
  import {
126
123
  dawnWallet
127
124
  } from "./chunk-LV6YV3DE.js";
125
+ import {
126
+ customWallet
127
+ } from "./chunk-VKM5M5UK.js";
128
128
  import {
129
129
  desigWallet
130
130
  } from "./chunk-DFHP75HV.js";
131
- import {
132
- bitgetWallet
133
- } from "./chunk-HOCKAU5H.js";
134
131
  import {
135
132
  argentWallet
136
133
  } from "./chunk-XSDTNMQY.js";
137
134
  import {
138
- bitskiWallet
139
- } from "./chunk-NPITCCJE.js";
135
+ bifrostWallet
136
+ } from "./chunk-ALGPGI6V.js";
137
+ import {
138
+ bitgetWallet
139
+ } from "./chunk-HOCKAU5H.js";
140
140
  import {
141
141
  bitverseWallet
142
142
  } from "./chunk-5AEWIKRA.js";
143
- import {
144
- bifrostWallet
145
- } from "./chunk-ALGPGI6V.js";
146
143
  import {
147
144
  bloomWallet
148
145
  } from "./chunk-PNHDOC77.js";
@@ -150,6 +147,9 @@ import "./chunk-AALSJCUR.js";
150
147
  import {
151
148
  braveWallet
152
149
  } from "./chunk-U2XXV45G.js";
150
+ import {
151
+ bitskiWallet
152
+ } from "./chunk-NPITCCJE.js";
153
153
  import "./chunk-EYWGX5LT.js";
154
154
  import "./chunk-B454LLKJ.js";
155
155
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funkit/connect",
3
- "version": "12.16.0",
3
+ "version": "12.17.0",
4
4
  "description": "Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.",
5
5
  "files": [
6
6
  "dist",
@@ -119,11 +119,11 @@
119
119
  "ua-parser-js": "^1.0.37",
120
120
  "use-debounce": "^10.0.5",
121
121
  "uuid": "^11.1.1",
122
- "@funkit/api-base": "9.0.1",
123
- "@funkit/fun-relay": "3.1.3",
124
- "@funkit/connect-core": "9.4.0",
125
- "@funkit/utils": "5.0.2",
126
- "@funkit/chains": "2.5.0"
122
+ "@funkit/api-base": "9.1.0",
123
+ "@funkit/connect-core": "10.0.0",
124
+ "@funkit/utils": "5.1.0",
125
+ "@funkit/fun-relay": "3.2.0",
126
+ "@funkit/chains": "2.6.0"
127
127
  },
128
128
  "repository": {
129
129
  "type": "git",
@@ -1,20 +0,0 @@
1
- "use client";
2
-
3
- // src/utils/customer.ts
4
- import {
5
- useLighterAccountQuery,
6
- useLighterAccountsQuery
7
- } from "@funkit/connect-core";
8
- import {
9
- LIGHTER_TRADING_MODE,
10
- getLighterAccount,
11
- getLighterAccountsByL1Address,
12
- useInvalidateLighterAccount,
13
- useLighterAccountQuery as useLighterAccountQuery2,
14
- useLighterAccountsQuery as useLighterAccountsQuery2
15
- } from "@funkit/connect-core";
16
-
17
- export {
18
- useLighterAccountQuery2 as useLighterAccountQuery,
19
- useLighterAccountsQuery2 as useLighterAccountsQuery
20
- };