@funkit/connect 8.3.0 → 8.3.1-next.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 +9 -0
  2. package/dist/__generated__/default_configs.d.ts +63 -0
  3. package/dist/atoms/activeCheckout.d.ts +183 -0
  4. package/dist/atoms/activeWithdrawal.d.ts +21 -0
  5. package/dist/atoms/bridgeProviders/acrossAdapter.d.ts +109 -0
  6. package/dist/atoms/bridgeProviders/index.d.ts +25 -0
  7. package/dist/atoms/bridgeProviders/registry.d.ts +12 -0
  8. package/dist/atoms/bridgeProviders/relayAdapter.d.ts +60 -0
  9. package/dist/atoms/bridgeProviders/types.d.ts +182 -0
  10. package/dist/atoms/checkoutProgress.d.ts +22 -0
  11. package/dist/atoms/directExecution.d.ts +70 -0
  12. package/dist/atoms/funkitCheckout.d.ts +18 -0
  13. package/dist/atoms/funkitProvider/index.d.ts +24 -0
  14. package/dist/atoms/generalWallet.d.ts +45 -0
  15. package/dist/atoms/i18n.d.ts +6 -0
  16. package/dist/atoms/modalState.d.ts +30 -0
  17. package/dist/atoms/quote.d.ts +98 -0
  18. package/dist/atoms/stepTransition.d.ts +6 -0
  19. package/dist/atoms/store.d.ts +1 -0
  20. package/dist/atoms/track/index.d.ts +10 -0
  21. package/dist/atoms/utils.d.ts +2 -0
  22. package/dist/atoms/wagmi.d.ts +4 -0
  23. package/dist/atoms/walletClient.d.ts +15391 -0
  24. package/dist/chunk-5JRQC2VM.js +300 -0
  25. package/dist/chunk-CUWQELX3.js +209 -0
  26. package/dist/chunk-FBCU3TQA.js +204 -0
  27. package/dist/chunk-MGQZMUZ2.js +288 -0
  28. package/dist/chunk-OTMBU2BL.js +204 -0
  29. package/dist/chunk-VWSYBHAK.js +209 -0
  30. package/dist/clients/fanatics.css +1 -1
  31. package/dist/components/FunPaymentMethodItem/FunPaymentMethodItemSkeleton.d.ts +2 -0
  32. package/dist/components/Icons/AcrossIcon.d.ts +4 -0
  33. package/dist/domains/across.d.ts +29 -0
  34. package/dist/domains/track.d.ts +14 -0
  35. package/dist/hooks/queries/useFops.d.ts +15 -0
  36. package/dist/hooks/useUsableWalletAssetsForCheckout.d.ts +2 -0
  37. package/dist/index.css +7 -7
  38. package/dist/index.js +78 -56
  39. package/dist/modals/CheckoutModal/SelectAsset.d.ts +14 -0
  40. package/dist/modals/CheckoutModal/SourceChange/ConnectedSource.d.ts +11 -0
  41. package/dist/modals/CheckoutModal/SwappedIframe/SwappedIframe.d.ts +16 -0
  42. package/dist/modals/CheckoutModal/SwappedIframe/index.d.ts +1 -0
  43. package/dist/providers/FunkitCheckoutContext/types.d.ts +1 -0
  44. package/dist/utils/lighter.d.ts +0 -2
  45. package/dist/wallets/walletConnectors/chunk-3ZWIUCOI.js +96 -0
  46. package/dist/wallets/walletConnectors/chunk-4SC3PZVM.js +70 -0
  47. package/dist/wallets/walletConnectors/chunk-5AV2NSL3.js +98 -0
  48. package/dist/wallets/walletConnectors/chunk-5FWURLPF.js +218 -0
  49. package/dist/wallets/walletConnectors/chunk-6677RKVT.js +69 -0
  50. package/dist/wallets/walletConnectors/chunk-75A4Q5E5.js +92 -0
  51. package/dist/wallets/walletConnectors/chunk-ENLR4LXN.js +94 -0
  52. package/dist/wallets/walletConnectors/chunk-FT5BX7TL.js +103 -0
  53. package/dist/wallets/walletConnectors/chunk-GEMN6DM5.js +106 -0
  54. package/dist/wallets/walletConnectors/chunk-GXTI2PZD.js +100 -0
  55. package/dist/wallets/walletConnectors/chunk-LGT6IAXI.js +93 -0
  56. package/dist/wallets/walletConnectors/chunk-N7475PGA.js +110 -0
  57. package/dist/wallets/walletConnectors/chunk-O6YFVGVQ.js +99 -0
  58. package/dist/wallets/walletConnectors/chunk-OCM5YHT5.js +92 -0
  59. package/dist/wallets/walletConnectors/chunk-PRGCIJ7Y.js +87 -0
  60. package/dist/wallets/walletConnectors/chunk-RNIMZDHW.js +95 -0
  61. package/dist/wallets/walletConnectors/chunk-TLOROKED.js +96 -0
  62. package/dist/wallets/walletConnectors/chunk-WNQ3NPHX.js +66 -0
  63. package/dist/wallets/walletConnectors/index.js +6 -6
  64. package/package.json +3 -3
@@ -0,0 +1,182 @@
1
+ import type { DirectExecutionType } from '@funkit/api-base';
2
+ import type { CheckoutQuoteResponse } from '@funkit/utils';
3
+ import type { ReactNode } from 'react';
4
+ import type { Address, Hex, WalletClient } from 'viem';
5
+ import type { PaymentMethod } from '../../domains/paymentMethods';
6
+ import type { FunkitCheckoutActionParams } from '../../providers/FunkitCheckoutContext';
7
+ import type { WithdrawalClient } from '../../wallets/Wallet';
8
+ /**
9
+ * Identifies a chain + asset pair for routing decisions.
10
+ */
11
+ export interface ChainAsset {
12
+ chainId: string;
13
+ tokenAddress: Address;
14
+ }
15
+ /**
16
+ * Standardized quote request parameters across all bridge providers.
17
+ */
18
+ export interface BridgeQuoteParams {
19
+ actionParams: FunkitCheckoutActionParams[];
20
+ fromChainId: string;
21
+ fromTokenAddress: Address;
22
+ toChainId: string;
23
+ toTokenAddress: Address;
24
+ recipientAddress: Address;
25
+ /** Sender address - defaults to connected wallet if not provided */
26
+ senderAddress?: Address;
27
+ }
28
+ /**
29
+ * Quote request for exact output (target amount specified).
30
+ */
31
+ export interface BridgeQuoteExactOutParams extends BridgeQuoteParams {
32
+ toTokenAmount: number;
33
+ toTokenDecimals: number;
34
+ isExactIn?: false;
35
+ }
36
+ /**
37
+ * Quote request for exact input (source amount specified).
38
+ */
39
+ export interface BridgeQuoteExactInParams extends BridgeQuoteParams {
40
+ fromTokenAmount: number;
41
+ fromTokenDecimals: number;
42
+ isExactIn: true;
43
+ }
44
+ export type BridgeQuoteRequestParams = BridgeQuoteExactOutParams | BridgeQuoteExactInParams;
45
+ /**
46
+ * Standardized quote result from any bridge provider.
47
+ * Extends the existing CheckoutQuoteResponse for compatibility.
48
+ */
49
+ export interface BridgeQuoteResult extends CheckoutQuoteResponse {
50
+ /** Provider-specific metadata */
51
+ providerMetadata?: unknown;
52
+ }
53
+ /**
54
+ * Execution parameters for initiating a bridge transaction.
55
+ */
56
+ export interface BridgeExecutionParams {
57
+ quote: BridgeQuoteResult;
58
+ stepMessageSetter: (message: string) => void;
59
+ onTransactionConfirmed: (txHash: Hex) => void;
60
+ walletClient?: WalletClient;
61
+ withdrawalClient?: WithdrawalClient;
62
+ }
63
+ /**
64
+ * Result of a bridge execution.
65
+ */
66
+ export interface BridgeExecutionResult {
67
+ txHash: Hex;
68
+ }
69
+ /**
70
+ * Selected route display information.
71
+ * Used to show which bridge/protocol is being used in the UI.
72
+ */
73
+ export interface SelectedRouteInfo {
74
+ /** Route label (e.g., "Relay", "Native Bridge", "Across") */
75
+ label: string;
76
+ /** Icon component to display */
77
+ icon: ReactNode;
78
+ /** Whether this is a passthrough/native bridge (no solver fees) */
79
+ isPassthrough: boolean;
80
+ }
81
+ /**
82
+ * Route eligibility check parameters.
83
+ */
84
+ export interface RouteEligibilityParams {
85
+ fromChainId: string;
86
+ fromTokenAddress: string;
87
+ toChainId: string;
88
+ toTokenAddress: string;
89
+ paymentMethod: PaymentMethod | undefined;
90
+ isAdditionalActionsRequired: boolean;
91
+ }
92
+ /**
93
+ * Bridge Provider Adapter Interface
94
+ *
95
+ * Defines a standardized contract for bridge providers (Relay, Across, etc.).
96
+ * Each adapter encapsulates provider-specific quoting and execution logic
97
+ * behind a common interface.
98
+ *
99
+ * @example
100
+ * ```ts
101
+ * const relayAdapter: BridgeProviderAdapter = {
102
+ * name: 'Relay',
103
+ * directExecutionType: DirectExecutionType.RELAY,
104
+ * getQuote: async (params) => { ... },
105
+ * execute: async (params) => { ... },
106
+ * supportsRoute: (params) => { ... },
107
+ * }
108
+ * ```
109
+ */
110
+ export interface BridgeProviderAdapter {
111
+ /** Human-readable provider name */
112
+ readonly name: string;
113
+ /** Provider identifier for backend tracking */
114
+ readonly directExecutionType: DirectExecutionType;
115
+ /**
116
+ * Fetches a quote for the given route.
117
+ *
118
+ * @param params - Quote request parameters
119
+ * @returns Quote result or null if unable to quote
120
+ */
121
+ getQuote(params: BridgeQuoteRequestParams): Promise<BridgeQuoteResult | null>;
122
+ /**
123
+ * Executes a bridge transaction using the provided quote.
124
+ *
125
+ * @param params - Execution parameters including quote and wallet
126
+ * @returns Transaction hash on success, null on failure
127
+ */
128
+ execute(params: BridgeExecutionParams): Promise<Hex | null>;
129
+ /**
130
+ * Determines if this provider supports the given route.
131
+ *
132
+ * @param params - Route eligibility parameters
133
+ * @returns true if the provider can handle this route
134
+ */
135
+ supportsRoute(params: RouteEligibilityParams): boolean;
136
+ /**
137
+ * Returns display information for the selected route.
138
+ * Used to show which bridge/protocol is being used in the UI.
139
+ * Retrieves quote, translation, and config from atoms internally.
140
+ *
141
+ * @returns Route display info (label, icon, isPassthrough), or null if no quote
142
+ */
143
+ getSelectedRoute(): SelectedRouteInfo | null;
144
+ /**
145
+ * Estimates time for a given quote.
146
+ *
147
+ * @param quote - The quote to estimate time for
148
+ * @returns Estimated time in milliseconds
149
+ */
150
+ estimatedTime?(quote: BridgeQuoteResult): number;
151
+ }
152
+ /**
153
+ * Provider selection criteria for runtime switching.
154
+ */
155
+ export interface ProviderSelectionCriteria {
156
+ amount?: bigint;
157
+ fromChainId?: string;
158
+ toChainId?: string;
159
+ preferredProvider?: string;
160
+ }
161
+ /**
162
+ * Registry for managing multiple bridge providers.
163
+ */
164
+ export interface BridgeProviderRegistry {
165
+ /** All registered providers */
166
+ readonly providers: readonly BridgeProviderAdapter[];
167
+ /**
168
+ * Gets the provider for the given route based on selection criteria.
169
+ *
170
+ * @param route - Route eligibility parameters
171
+ * @param criteria - Optional selection preferences
172
+ * @returns The selected provider, or undefined if none available
173
+ */
174
+ getProvider(route: RouteEligibilityParams, criteria?: ProviderSelectionCriteria): BridgeProviderAdapter | undefined;
175
+ /**
176
+ * Gets all providers that support a given route.
177
+ *
178
+ * @param route - Route eligibility parameters
179
+ * @returns Array of supporting providers
180
+ */
181
+ getSupportingProviders(route: RouteEligibilityParams): readonly BridgeProviderAdapter[];
182
+ }
@@ -0,0 +1,22 @@
1
+ import type { CheckoutProgress } from '../providers/FunkitCheckoutContext';
2
+ /**
3
+ * Stores checkout progress by checkoutId.
4
+ * Tracks which step each checkout is at.
5
+ */
6
+ export declare const checkoutsProgressAtom: import("jotai").PrimitiveAtom<{
7
+ [x: string]: CheckoutProgress | undefined;
8
+ }> & {
9
+ init: {
10
+ [x: string]: CheckoutProgress | undefined;
11
+ };
12
+ };
13
+ /**
14
+ * Sets the progress for a specific checkout.
15
+ */
16
+ export declare const setCheckoutProgressAtom: import("jotai").WritableAtom<null, [checkoutId: string, progress: CheckoutProgress], void> & {
17
+ init: null;
18
+ };
19
+ /**
20
+ * Gets the progress for a specific checkout by ID.
21
+ */
22
+ export declare const getCheckoutProgressAtom: import("jotai").Atom<(checkoutId: string) => CheckoutProgress | undefined>;
@@ -0,0 +1,70 @@
1
+ import { DirectExecutionType } from '@funkit/api-base';
2
+ import type { RelayTxHash, RelayVmType } from '@funkit/fun-relay';
3
+ import type { CheckoutQuoteResponse } from '@funkit/utils';
4
+ import type { Address, Hex } from 'viem';
5
+ import type { PaymentMethod } from '../domains/paymentMethods';
6
+ import type { FunkitCheckoutQuoteResult } from '../domains/quote';
7
+ import type { FunkitActiveCheckoutItem, FunkitCheckoutActionParams } from '../providers/FunkitCheckoutContext';
8
+ import type { WithdrawalClient } from '../wallets/Wallet';
9
+ export interface DirectExecutionQuoteRequestParamsBase {
10
+ actionParams: FunkitCheckoutActionParams[];
11
+ fromChainId: string;
12
+ fromTokenAddress: Address;
13
+ isExactIn?: boolean;
14
+ toChainId: string;
15
+ toTokenAddress: Address;
16
+ recipientAddress: Address;
17
+ senderAddress?: Address;
18
+ }
19
+ export interface RegularDEQuoteRequest extends DirectExecutionQuoteRequestParamsBase {
20
+ toTokenAmount: number;
21
+ toTokenDecimals: number;
22
+ isExactIn?: false;
23
+ }
24
+ export interface WithdrawalDEQuoteRequest extends DirectExecutionQuoteRequestParamsBase {
25
+ fromTokenAmount: number;
26
+ isExactIn: true;
27
+ fromTokenDecimals: number;
28
+ }
29
+ export type DirectExecutionQuoteRequestParams = RegularDEQuoteRequest | WithdrawalDEQuoteRequest;
30
+ export interface DirectExecutionStartParams {
31
+ checkoutItem: FunkitActiveCheckoutItem;
32
+ stepMessageSetter: (m: string) => void;
33
+ actionsParams: FunkitCheckoutActionParams[];
34
+ latestQuote: FunkitCheckoutQuoteResult;
35
+ onTransactionConfirmed: (txHash: RelayTxHash<RelayVmType>) => void;
36
+ withdrawalClient?: WithdrawalClient;
37
+ }
38
+ export interface FunkitDirectExecutionInfo {
39
+ isDirectExecution: boolean;
40
+ directExecutionType: DirectExecutionType | null;
41
+ getDirectExecutionQuote: (params: DirectExecutionQuoteRequestParams) => Promise<CheckoutQuoteResponse | null>;
42
+ executeDirectExecution: (params: DirectExecutionStartParams) => Promise<Hex | null>;
43
+ }
44
+ export interface StartRelayExecutionParams extends DirectExecutionStartParams {
45
+ }
46
+ /**
47
+ * Mutation atom to get a relay direct execution quote.
48
+ * Uses apiKey from config atom and defaults senderAddress to wallet client address.
49
+ */
50
+ export declare const getRelayDirectExecutionQuoteAtom: import("jotai").Atom<import("jotai-tanstack-query").AtomWithMutationResult<CheckoutQuoteResponse | null, unknown, DirectExecutionQuoteRequestParams, unknown>>;
51
+ /**
52
+ * Determines if a checkout item should use direct execution.
53
+ */
54
+ export declare function getDirectExecutionInfoFromCheckout(checkoutItem: FunkitActiveCheckoutItem | null, getIsRelayEnabled: (params: {
55
+ fromChainId: string;
56
+ fromTokenAddress: string;
57
+ toChainId: string;
58
+ toTokenAddress: string;
59
+ paymentMethod: PaymentMethod | undefined;
60
+ isAdditionalActionsRequired: boolean;
61
+ }) => boolean, getDirectExecutionQuote: (params: DirectExecutionQuoteRequestParams) => Promise<CheckoutQuoteResponse | null>, executeDirectExecution: (params: DirectExecutionStartParams) => Promise<Hex | null>): FunkitDirectExecutionInfo;
62
+ /**
63
+ * Returns withdrawal direct execution info.
64
+ */
65
+ export declare function getWithdrawalDirectExecutionInfo(getDirectExecutionQuote: (params: DirectExecutionQuoteRequestParams) => Promise<CheckoutQuoteResponse | null>, executeDirectExecution: (params: DirectExecutionStartParams) => Promise<Hex | null>): FunkitDirectExecutionInfo;
66
+ /**
67
+ * Mutation atom to execute a relay direct execution.
68
+ * This handles the entire relay execution flow including chain switching and approval resets.
69
+ */
70
+ export declare const startRelayDirectExecutionAtom: import("jotai").Atom<import("jotai-tanstack-query").AtomWithMutationResult<`0x${string}`, unknown, StartRelayExecutionParams, unknown>>;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Main entry point for Funkit checkout atoms.
3
+ * Re-exports all checkout-related atoms from their respective modules.
4
+ *
5
+ * API mirrors FunkitCheckoutContext interface:
6
+ * - Active checkout management
7
+ * - Checkout progress tracking
8
+ * - Withdrawal management
9
+ * - Quote management
10
+ */
11
+ export { activeCheckoutAtom, applyDynamicRoutingAtom, assertCheckoutItem, cancelCheckoutAtom, confirmCheckoutAtom, initNewCheckoutAtom, resetCheckoutAtom, setCheckoutAtom, setCompletedTimestampAtom, startDirectExecutionCheckoutAtom, startRegularCheckoutAtom, updateCheckoutAtom, updateCustomRecipientAtom, updateDynamicRoutingIdAtom, updateModalTitleMetaAtom, updateSelectedPaymentMethodInfoAtom, updateSourceAssetAtom, updateTargetAssetAmountAtom, updateTargetAssetAtom, updateWithdrawalSourceAssetAmountAtom, } from './activeCheckout';
12
+ export type { ConfirmCheckoutParams, StartDirectExecutionCheckoutParams, StartRegularCheckoutParams, UDAParams, } from './activeCheckout';
13
+ export { checkoutsProgressAtom, getCheckoutProgressAtom, setCheckoutProgressAtom, } from './checkoutProgress';
14
+ export { initNewWithdrawalAtom, setWithdrawalStateAtom, withdrawalStateAtom, } from './activeWithdrawal';
15
+ export { clearQuoteMessagesAtom, getCheckoutQuoteAtom, isQuotingAtom, latestQuoteAtom, quoteErrorMessageAtom, quoteStepMessageAtom, resetQuoteOnLogoutAtom, setQuoteProgressAtom, } from './quote';
16
+ export type { CheckoutQuoteError, CheckoutQuoteResult, CheckoutQuoteState, GetCheckoutQuoteParams, GetCheckoutQuoteResponse, } from './quote';
17
+ export { connectorAtom, ensAvatarAtom, ensNameAtom, isUserLoggedInAtom, l2AddressAtom, loginTypeAtom, logoutSymbolAtom, syncWalletStateAtom, triggerLogoutAtom, userInfoAtom, walletAddressAtom, } from './generalWallet';
18
+ export { LoginType } from './generalWallet';
@@ -0,0 +1,24 @@
1
+ import type { Locale } from '../../locales';
2
+ import { type AvatarComponent } from '../../providers/AvatarContext';
3
+ import { type FunkitConfig } from '../../providers/FunkitConfigContext';
4
+ import { type ModalSizes } from '../../providers/ModalSizeContext';
5
+ export declare const avatarAtom: import("jotai").WritableAtom<AvatarComponent, [AvatarComponent | ((prev: AvatarComponent | undefined) => AvatarComponent | undefined) | undefined], void>;
6
+ export declare const modalSizeAtom: import("jotai").WritableAtom<NonNullable<ModalSizes | undefined>, [ModalSizes | ((prev: ModalSizes | undefined) => ModalSizes | undefined) | undefined], void>;
7
+ export declare const funkitConfigAtom: import("jotai").WritableAtom<FunkitConfig, [FunkitConfig | ((prev: FunkitConfig | undefined) => FunkitConfig | undefined) | undefined], void>;
8
+ export declare const sandboxAtom: import("jotai").WritableAtom<NonNullable<boolean | undefined>, [boolean | ((prev: boolean | undefined) => boolean | undefined) | undefined], void>;
9
+ export declare const idAtom: import("jotai").PrimitiveAtom<string | undefined> & {
10
+ init: string | undefined;
11
+ };
12
+ export declare const initialChainAtom: import("jotai").PrimitiveAtom<number | undefined> & {
13
+ init: number | undefined;
14
+ };
15
+ export declare const debugAtom: import("jotai").PrimitiveAtom<boolean | undefined> & {
16
+ init: boolean | undefined;
17
+ };
18
+ export declare const localeAtom: import("jotai").PrimitiveAtom<Locale | undefined> & {
19
+ init: Locale | undefined;
20
+ };
21
+ export declare const funkitProviderThemeSelectorAtom: import("jotai").Atom<string>;
22
+ export declare const funkitProviderThemeRootPropsAtom: import("jotai").Atom<{
23
+ "data-rk": string;
24
+ }>;
@@ -0,0 +1,45 @@
1
+ import type { Address } from 'viem';
2
+ import type { Connector } from 'wagmi';
3
+ import { type FunkitUserInfo } from '../consts/funkit';
4
+ export declare enum LoginType {
5
+ Web3 = "web3",
6
+ Guest = "guest"
7
+ }
8
+ export declare const walletAddressAtom: import("jotai").WritableAtom<"" | `0x${string}`, [value: `0x${string}` | undefined], void>;
9
+ export declare const connectorAtom: import("jotai").WritableAtom<Connector | undefined, [value: Connector | undefined], void>;
10
+ export declare const ensNameAtom: import("jotai").WritableAtom<string | null | undefined, [value: string | null | undefined], void>;
11
+ export declare const ensAvatarAtom: import("jotai").WritableAtom<string | null | undefined, [value: string | null | undefined], void>;
12
+ export declare const l2AddressAtom: import("jotai").WritableAtom<string | undefined, [value: string | undefined], void>;
13
+ /**
14
+ * Derived atom for login type based on connector presence.
15
+ */
16
+ export declare const loginTypeAtom: import("jotai").Atom<LoginType>;
17
+ /**
18
+ * Derived atom for whether the user is logged in.
19
+ */
20
+ export declare const isUserLoggedInAtom: import("jotai").Atom<boolean>;
21
+ /**
22
+ * Derived atom for user info computed from wallet state.
23
+ */
24
+ export declare const userInfoAtom: import("jotai").Atom<FunkitUserInfo>;
25
+ export declare const logoutSymbolAtom: import("jotai").WritableAtom<symbol | undefined, [value: symbol | undefined], void>;
26
+ /**
27
+ * Write-only atom to trigger a new logout symbol.
28
+ * Used to signal logout across the app.
29
+ */
30
+ export declare const triggerLogoutAtom: import("jotai").WritableAtom<null, [], void> & {
31
+ init: null;
32
+ };
33
+ /**
34
+ * Write-only atom to sync all wallet state from wagmi hooks.
35
+ * Called by GeneralWalletProvider to keep atoms in sync.
36
+ */
37
+ export declare const syncWalletStateAtom: import("jotai").WritableAtom<null, [state: {
38
+ address: Address | undefined;
39
+ connector: Connector | undefined;
40
+ ensName: string | null | undefined;
41
+ ensAvatar: string | null | undefined;
42
+ l2Address: string | undefined;
43
+ }], void> & {
44
+ init: null;
45
+ };
@@ -0,0 +1,6 @@
1
+ declare const i18nextAtom: import("jotai").PrimitiveAtom<import("i18next").i18n> & {
2
+ init: import("i18next").i18n;
3
+ } & {
4
+ effect: import("jotai-effect").Effect;
5
+ };
6
+ export { i18nextAtom };
@@ -0,0 +1,30 @@
1
+ import type { SelectedHomeTab } from '../modals/ProfileDetails/FunProfileViews/Home';
2
+ import type { FunkitWithdrawalConfig } from '../providers/FunkitCheckoutContext';
3
+ export declare const connectModalStateAtom: import("jotai").WritableAtom<boolean, [open: boolean], void>;
4
+ export declare const accountModalStateAtom: import("jotai").WritableAtom<{
5
+ isOpen: boolean;
6
+ tab: SelectedHomeTab | null;
7
+ }, [update: {
8
+ isOpen: boolean;
9
+ tab?: SelectedHomeTab | null;
10
+ }], void>;
11
+ export declare const chainModalStateAtom: import("jotai").WritableAtom<boolean, [open: boolean], void>;
12
+ export declare const walletConnectModalStateAtom: import("jotai").WritableAtom<boolean, [open: boolean], void>;
13
+ export declare const checkoutModalStateAtom: import("jotai").WritableAtom<{
14
+ isOpen: boolean;
15
+ checkoutId: string | null;
16
+ }, [update: {
17
+ isOpen: boolean;
18
+ checkoutId?: string | null;
19
+ }], void>;
20
+ export declare const softHiddenCheckoutStateAtom: import("jotai").WritableAtom<string | null, [checkoutId: string | null], void>;
21
+ export type WithdrawalModalConfig = FunkitWithdrawalConfig & {
22
+ withdrawalId: string;
23
+ };
24
+ export declare const withdrawalModalStateAtom: import("jotai").WritableAtom<{
25
+ isOpen: boolean;
26
+ config: WithdrawalModalConfig | null;
27
+ }, [update: {
28
+ isOpen: boolean;
29
+ config?: WithdrawalModalConfig | null;
30
+ }], void>;
@@ -0,0 +1,98 @@
1
+ import type { BluvoBrokerageQuote } from '../hooks/useBluvo';
2
+ import type { FunkitActiveCheckoutItem } from '../providers/FunkitCheckoutContext';
3
+ import type { FunkitCheckoutQuoteResult } from '../domains/quote';
4
+ import type { FunkitDirectExecutionInfo } from './directExecution';
5
+ export type CheckoutQuoteError = {
6
+ maxTargetAssetAmount?: number;
7
+ minTargetAssetAmount?: number;
8
+ reason: 'insufficientBalance';
9
+ } | {
10
+ maxTargetAssetAmount?: number;
11
+ minTargetAssetAmount?: number;
12
+ minTargetUsdAmount?: number;
13
+ reason: 'insufficientAmount';
14
+ } | {
15
+ originalError: Error;
16
+ reason: 'internal';
17
+ };
18
+ export type CheckoutQuoteResult = {
19
+ success: true;
20
+ } | {
21
+ error: CheckoutQuoteError;
22
+ success: false;
23
+ };
24
+ export interface CheckoutQuoteState {
25
+ /** Whether the checkout quote is being fetched **/
26
+ isQuoting: boolean;
27
+ /** Latest checkout estimated fees and time **/
28
+ latestQuote: null | FunkitCheckoutQuoteResult;
29
+ /** The quotation step message **/
30
+ quoteStepMessage: string;
31
+ /** Error messages associated with checkout quote **/
32
+ quoteErrorMessage: string;
33
+ }
34
+ export type GetCheckoutQuoteResponse = CheckoutQuoteResult & {
35
+ shellCheckoutItemWithNextQuote: FunkitActiveCheckoutItem;
36
+ quoteState: CheckoutQuoteState;
37
+ };
38
+ export interface GetCheckoutQuoteParams {
39
+ getDirectExecutionInfo: (checkoutItem: FunkitActiveCheckoutItem) => FunkitDirectExecutionInfo;
40
+ getBluvoCheckoutQuote: (params: {
41
+ amount: string;
42
+ chainId: string;
43
+ symbol: string | null;
44
+ }) => Promise<BluvoBrokerageQuote | undefined>;
45
+ selectedBrokerageAsset?: {
46
+ amount?: number;
47
+ };
48
+ disableInformationStreaming?: boolean;
49
+ }
50
+ /**
51
+ * Read/write atom for the latest checkout quote.
52
+ */
53
+ export declare const latestQuoteAtom: import("jotai").WritableAtom<FunkitCheckoutQuoteResult | null, [value: FunkitCheckoutQuoteResult | null], void>;
54
+ /**
55
+ * Atom indicating whether a quote is being fetched.
56
+ */
57
+ export declare const isQuotingAtom: import("jotai").PrimitiveAtom<boolean> & {
58
+ init: boolean;
59
+ };
60
+ /**
61
+ * Atom holding the current quote step message.
62
+ */
63
+ export declare const quoteStepMessageAtom: import("jotai").PrimitiveAtom<string> & {
64
+ init: string;
65
+ };
66
+ /**
67
+ * Atom holding the current quote error message.
68
+ */
69
+ export declare const quoteErrorMessageAtom: import("jotai").PrimitiveAtom<string> & {
70
+ init: string;
71
+ };
72
+ /**
73
+ * Write-only atom to set the quote progress state.
74
+ */
75
+ export declare const setQuoteProgressAtom: import("jotai").WritableAtom<null, [state: {
76
+ isQuoting: boolean;
77
+ quoteStepMessage: string;
78
+ quoteErrorMessage: string;
79
+ }], void> & {
80
+ init: null;
81
+ };
82
+ /**
83
+ * Write-only atom to clear quote messages.
84
+ */
85
+ export declare const clearQuoteMessagesAtom: import("jotai").WritableAtom<null, [], void> & {
86
+ init: null;
87
+ };
88
+ /**
89
+ * Write-only atom to reset quote state on logout.
90
+ */
91
+ export declare const resetQuoteOnLogoutAtom: import("jotai").WritableAtom<null, [logoutSymbol: symbol | null | undefined], void> & {
92
+ init: null;
93
+ };
94
+ /**
95
+ * Mutation atom to get a checkout quote.
96
+ * This is the main entry point for fetching quotes.
97
+ */
98
+ export declare const getCheckoutQuoteAtom: import("jotai").Atom<import("jotai-tanstack-query").AtomWithMutationResult<GetCheckoutQuoteResponse, unknown, GetCheckoutQuoteParams, unknown>>;
@@ -0,0 +1,6 @@
1
+ import { type SetStateAction } from 'jotai';
2
+ import { type CheckoutModalState } from '../modals/CheckoutModal/stepTransition';
3
+ export declare const stateHistoryAtom: import("jotai").PrimitiveAtom<CheckoutModalState[]> & {
4
+ init: CheckoutModalState[];
5
+ };
6
+ export declare const modalStateAtom: import("jotai").WritableAtom<CheckoutModalState, [update: SetStateAction<CheckoutModalState>], void>;
@@ -0,0 +1 @@
1
+ export declare const funkitStore: import("jotai/vanilla/internals").INTERNAL_Store;
@@ -0,0 +1,10 @@
1
+ import { StatsigClient } from '@statsig/react-bindings';
2
+ import type { CheckoutModalEvent } from '../../hooks/track/CheckoutModalEvent';
3
+ import type { WithdrawModalEvent } from '../../hooks/track/WithdrawModalEvent';
4
+ export declare const eventCountsAtom: import("jotai").PrimitiveAtom<Partial<Record<CheckoutModalEvent | WithdrawModalEvent, number>>> & {
5
+ init: Partial<Record<CheckoutModalEvent | WithdrawModalEvent, number>>;
6
+ };
7
+ export declare const eventStartTimesAtom: import("jotai").PrimitiveAtom<Partial<Record<CheckoutModalEvent | WithdrawModalEvent, number>>> & {
8
+ init: Partial<Record<CheckoutModalEvent | WithdrawModalEvent, number>>;
9
+ };
10
+ export declare const statsigClientAtom: import("jotai").Atom<StatsigClient>;
@@ -0,0 +1,2 @@
1
+ import type { WritableAtom } from 'jotai';
2
+ export declare const atomWithFallback: <T, Args extends unknown[], Result>(atom: WritableAtom<T, Args, Result>, fallback: NonNullable<T>) => WritableAtom<NonNullable<T>, Args, Result>;
@@ -0,0 +1,4 @@
1
+ import type { Config } from 'wagmi';
2
+ export declare const wagmiConfigAtom: import("jotai").PrimitiveAtom<Config | undefined> & {
3
+ init: Config | undefined;
4
+ };