@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @funkit/connect
2
2
 
3
+ ## 8.3.1-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - addf363: feat(connect): add AZTEC token support for Lighter exchange
8
+ - fdefe58: feat(connect): update lighter utils to use dynamic target id for dynamic target assets
9
+ - Updated dependencies [addf363]
10
+ - @funkit/fun-relay@2.4.1-next.0
11
+
3
12
  ## 8.3.0
4
13
 
5
14
  ### Minor Changes
@@ -242,6 +242,23 @@ declare const _default: {
242
242
  readonly path: "FUN_MAINNET_DEPOSIT";
243
243
  };
244
244
  }];
245
+ }, {
246
+ readonly routeId: "LIGHTER_AZTEC_SPOT_NEW_USER";
247
+ readonly rules: readonly [{
248
+ readonly when: {
249
+ readonly chainId: "1";
250
+ readonly tokenAddress: "0xA27EC0006e59f245217Ff08CD52A7E8b169E62D2";
251
+ };
252
+ readonly use: {
253
+ readonly path: "FUN_MAINNET_DEPOSIT";
254
+ readonly badge: "NATIVE";
255
+ };
256
+ }, {
257
+ readonly when: "*";
258
+ readonly use: {
259
+ readonly path: "FUN_MAINNET_DEPOSIT";
260
+ };
261
+ }];
245
262
  }];
246
263
  };
247
264
  readonly enablebitcoin: {
@@ -331,6 +348,41 @@ declare const _default: {
331
348
  readonly nonMainnet: 2.5;
332
349
  };
333
350
  };
351
+ readonly relaybypasssourcechainsandassets: {
352
+ readonly value: {
353
+ readonly '1': readonly ["*"];
354
+ readonly '10': readonly ["*"];
355
+ readonly '56': readonly ["*"];
356
+ readonly '137': readonly ["*"];
357
+ readonly '143': readonly ["*"];
358
+ readonly '999': readonly ["*"];
359
+ readonly '2741': readonly ["*"];
360
+ readonly '8453': readonly ["*"];
361
+ readonly '42161': readonly ["*"];
362
+ readonly '747474': readonly ["*"];
363
+ readonly '5064014': readonly ["*"];
364
+ readonly '8253038': readonly ["*"];
365
+ };
366
+ };
367
+ readonly relaybypasstargetchainsandassets: {
368
+ readonly value: {
369
+ readonly '1': readonly ["*"];
370
+ readonly '10': readonly ["*"];
371
+ readonly '56': readonly ["*"];
372
+ readonly '137': readonly ["*"];
373
+ readonly '143': readonly ["*"];
374
+ readonly '999': readonly ["*"];
375
+ readonly '1337': readonly ["*"];
376
+ readonly '2741': readonly ["*"];
377
+ readonly '8453': readonly ["*"];
378
+ readonly '42161': readonly ["*"];
379
+ readonly '747474': readonly ["*"];
380
+ readonly '3586256': readonly ["*"];
381
+ readonly '5064014': readonly ["*"];
382
+ readonly '8253038': readonly ["*"];
383
+ readonly '1151111081099710': readonly ["*"];
384
+ };
385
+ };
334
386
  readonly showinfobanner: {
335
387
  readonly value: {
336
388
  readonly message: "";
@@ -344,6 +396,17 @@ declare const _default: {
344
396
  readonly supportedexchangesv2: {
345
397
  readonly value: readonly [];
346
398
  };
399
+ readonly tokentransferchaingroups: {
400
+ readonly value: {
401
+ readonly popular: readonly [1151111081099710, 1, 728126428];
402
+ };
403
+ };
404
+ readonly tokentransfertokengroups: {
405
+ readonly value: {
406
+ readonly popular: readonly [];
407
+ readonly stablecoins: readonly ["BUSD", "DAI", "USDC", "USDC.e", "USDe", "USDT"];
408
+ };
409
+ };
347
410
  readonly uda_params: {
348
411
  readonly value: readonly [{
349
412
  readonly dynamicRoutingId: "LIGHTER_ETH_SPOT";
@@ -0,0 +1,183 @@
1
+ import type { DynamicRoutePath } from '@funkit/fun-relay';
2
+ import type { Address } from 'viem';
3
+ import { type PaymentMethodInfo } from '../domains/paymentMethods';
4
+ import type { FunkitCheckoutQuoteResult } from '../domains/quote';
5
+ import type { AssetHoldingsItem } from '../domains/wallet';
6
+ import type { TrackEventData } from '../hooks/track/useTrack';
7
+ import type { FunkitActiveCheckoutItem, FunkitCheckoutActionParams, FunkitCheckoutConfig, UseFunkitCheckoutPropsWithFullConfig } from '../providers/FunkitCheckoutContext';
8
+ import type { LoginType } from '../providers/GeneralWalletProvider';
9
+ import type { WithdrawalClient } from '../wallets/Wallet';
10
+ import type { FunkitDirectExecutionInfo } from './directExecution';
11
+ /**
12
+ * Write-only atom to set the checkout state.
13
+ */
14
+ export declare const setCheckoutAtom: import("jotai").WritableAtom<null, [value: FunkitActiveCheckoutItem | null], void> & {
15
+ init: null;
16
+ };
17
+ /**
18
+ * Read/write atom for the active checkout.
19
+ */
20
+ export declare const activeCheckoutAtom: import("jotai").WritableAtom<FunkitActiveCheckoutItem | null, [value: FunkitActiveCheckoutItem | null], void>;
21
+ /**
22
+ * Partial update atom for the active checkout.
23
+ * Accepts either partial data or a function that receives current checkout and returns partial data.
24
+ */
25
+ export declare const updateCheckoutAtom: import("jotai").WritableAtom<null, [data: Partial<FunkitActiveCheckoutItem> | ((checkoutItem: FunkitActiveCheckoutItem) => Partial<FunkitActiveCheckoutItem>)], void> & {
26
+ init: null;
27
+ };
28
+ /**
29
+ * Updates the source asset of a given checkout.
30
+ */
31
+ export declare const updateSourceAssetAtom: import("jotai").WritableAtom<null, [selectedSource: Omit<AssetHoldingsItem, "amount" | "usdAmount">], void> & {
32
+ init: null;
33
+ };
34
+ /**
35
+ * Updates the target asset amount of a given checkout.
36
+ * Uses flushSync internally to avoid stale data issues.
37
+ */
38
+ export declare const updateTargetAssetAmountAtom: import("jotai").WritableAtom<null, [newTargetAssetAmount: number], void> & {
39
+ init: null;
40
+ };
41
+ /**
42
+ * Updates the selected payment method info.
43
+ */
44
+ export declare const updateSelectedPaymentMethodInfoAtom: import("jotai").WritableAtom<null, [newInfo: PaymentMethodInfo], void> & {
45
+ init: null;
46
+ };
47
+ /**
48
+ * Resets the checkout state to initial (null).
49
+ */
50
+ export declare const resetCheckoutAtom: import("jotai").WritableAtom<null, [], void> & {
51
+ init: null;
52
+ };
53
+ /**
54
+ * Creates a new checkout object in the frontend. Not yet initialized in backend.
55
+ * @returns The new checkoutId
56
+ */
57
+ export declare const initNewCheckoutAtom: import("jotai").WritableAtom<null, [props: UseFunkitCheckoutPropsWithFullConfig], string> & {
58
+ init: null;
59
+ };
60
+ export declare const setCompletedTimestampAtom: import("jotai").WritableAtom<null, [timestampMs: number], void> & {
61
+ init: null;
62
+ };
63
+ /**
64
+ * Updates the target asset of a checkout.
65
+ */
66
+ export declare const updateTargetAssetAtom: import("jotai").WritableAtom<null, [asset: {
67
+ targetAsset: Address;
68
+ targetChain: string;
69
+ targetAssetTicker: string;
70
+ targetAssetMinAmount?: number;
71
+ iconSrc: string | undefined;
72
+ }], void> & {
73
+ init: null;
74
+ };
75
+ /**
76
+ * Applies dynamic routing configuration to the checkout.
77
+ */
78
+ export declare const applyDynamicRoutingAtom: import("jotai").WritableAtom<null, [path: Omit<DynamicRoutePath, "generateActionsParams" | "getCustomRecipient"> & {
79
+ customRecipient?: FunkitCheckoutConfig["customRecipient"];
80
+ generateActionsParams?: FunkitCheckoutConfig["generateActionsParams"];
81
+ }], void> & {
82
+ init: null;
83
+ };
84
+ /**
85
+ * Updates the dynamic routing ID.
86
+ */
87
+ export declare const updateDynamicRoutingIdAtom: import("jotai").WritableAtom<null, [id: string], void> & {
88
+ init: null;
89
+ };
90
+ /**
91
+ * Updates the modal title meta.
92
+ */
93
+ export declare const updateModalTitleMetaAtom: import("jotai").WritableAtom<null, [newMeta: string], void> & {
94
+ init: null;
95
+ };
96
+ /**
97
+ * Updates the custom recipient address.
98
+ */
99
+ export declare const updateCustomRecipientAtom: import("jotai").WritableAtom<null, [recipient: `0x${string}`], void> & {
100
+ init: null;
101
+ };
102
+ /**
103
+ * Updates the withdrawal source asset amount.
104
+ */
105
+ export declare const updateWithdrawalSourceAssetAmountAtom: import("jotai").WritableAtom<null, [amount: number], void> & {
106
+ init: null;
107
+ };
108
+ /**
109
+ * Asserts that a checkout item exists, throws if null.
110
+ */
111
+ export declare function assertCheckoutItem(checkoutItem: FunkitActiveCheckoutItem | null): FunkitActiveCheckoutItem;
112
+ /**
113
+ * Mutation atom to cancel/deactivate a checkout using jotai-tanstack-query.
114
+ * Use `mutateAsync` to get a promise that resolves to boolean indicating success.
115
+ */
116
+ export declare const cancelCheckoutAtom: import("jotai").Atom<import("jotai-tanstack-query").AtomWithMutationResult<boolean, unknown, `0x${string}`, unknown>>;
117
+ export interface UDAParams {
118
+ targetChain: string;
119
+ targetAsset: Address;
120
+ targetAssetTicker: string;
121
+ iconSrc: string;
122
+ qrcodeActionType?: string;
123
+ defaultTokenSymbol?: string;
124
+ defaultChainId?: string;
125
+ }
126
+ export interface StartDirectExecutionCheckoutParams {
127
+ stepMessageSetter: (m: string) => void;
128
+ latestQuote: FunkitCheckoutQuoteResult;
129
+ sourceOfFund: string;
130
+ clientMetadata: object;
131
+ actionsParams: FunkitCheckoutActionParams[];
132
+ withdrawalClient?: WithdrawalClient;
133
+ isPaymentMethodBalance: boolean;
134
+ directExecutionInfo: FunkitDirectExecutionInfo;
135
+ userId: string;
136
+ walletAddress: Address | '';
137
+ udaParams?: UDAParams;
138
+ logEvent: (event: TrackEventData) => void;
139
+ refreshCheckoutHistory: () => void;
140
+ setCheckoutProgress: (checkoutId: string, progress: {
141
+ step: 1 | 2;
142
+ }) => void;
143
+ updateActiveCheckout: (update: Partial<FunkitActiveCheckoutItem>) => void;
144
+ }
145
+ export interface StartRegularCheckoutParams {
146
+ stepMessageSetter: (m: string) => void;
147
+ latestQuote: FunkitCheckoutQuoteResult;
148
+ sourceOfFund: string;
149
+ clientMetadata: object;
150
+ refreshCheckoutHistory: () => void;
151
+ updateActiveCheckout: (update: Partial<FunkitActiveCheckoutItem>) => void;
152
+ }
153
+ export interface ConfirmCheckoutParams {
154
+ latestQuote: FunkitCheckoutQuoteResult;
155
+ stepMessageSetter: (m: string) => void;
156
+ withdrawalClient?: WithdrawalClient;
157
+ getDirectExecutionInfo: (checkoutItem: FunkitActiveCheckoutItem | null) => FunkitDirectExecutionInfo;
158
+ getWithdrawalDirectExecution: () => FunkitDirectExecutionInfo;
159
+ loginType: LoginType;
160
+ userId: string;
161
+ walletAddress: Address | '';
162
+ udaParams?: UDAParams;
163
+ logEvent: (event: TrackEventData) => void;
164
+ refreshCheckoutHistory: () => void;
165
+ setCheckoutProgress: (checkoutId: string, progress: {
166
+ step: 1 | 2;
167
+ }) => void;
168
+ updateActiveCheckout: (update: Partial<FunkitActiveCheckoutItem>) => void;
169
+ }
170
+ /**
171
+ * Mutation atom to start a direct execution checkout.
172
+ * Handles both account balance and other direct execution flows.
173
+ */
174
+ export declare const startDirectExecutionCheckoutAtom: import("jotai").Atom<import("jotai-tanstack-query").AtomWithMutationResult<`0x${string}`, unknown, StartDirectExecutionCheckoutParams, unknown>>;
175
+ /**
176
+ * Mutation atom to start a regular (non-direct-execution) checkout.
177
+ */
178
+ export declare const startRegularCheckoutAtom: import("jotai").Atom<import("jotai-tanstack-query").AtomWithMutationResult<`0x${string}`, unknown, StartRegularCheckoutParams, unknown>>;
179
+ /**
180
+ * Mutation atom to confirm and initialize a checkout.
181
+ * Main entry point that coordinates checkout confirmation.
182
+ */
183
+ export declare const confirmCheckoutAtom: import("jotai").Atom<import("jotai-tanstack-query").AtomWithMutationResult<`0x${string}`, unknown, ConfirmCheckoutParams, unknown>>;
@@ -0,0 +1,21 @@
1
+ import type { FunkitActiveWithdrawalItem, UseFunkitCheckoutPropsWithFullConfig } from '../providers/FunkitCheckoutContext';
2
+ /**
3
+ * Base atom holding the active withdrawal state.
4
+ */
5
+ export declare const withdrawalStateAtom: import("jotai").PrimitiveAtom<FunkitActiveWithdrawalItem | null> & {
6
+ init: FunkitActiveWithdrawalItem | null;
7
+ };
8
+ /**
9
+ * Write-only atom to set the withdrawal state.
10
+ */
11
+ export declare const setWithdrawalStateAtom: import("jotai").WritableAtom<null, [value: FunkitActiveWithdrawalItem | null], void> & {
12
+ init: null;
13
+ };
14
+ /**
15
+ * Creates a new withdrawal object in the frontend. Not yet initialized in backend.
16
+ * Also creates a corresponding checkout item for the withdrawal flow.
17
+ * @returns The new withdrawalId
18
+ */
19
+ export declare const initNewWithdrawalAtom: import("jotai").WritableAtom<null, [props: UseFunkitCheckoutPropsWithFullConfig, checkoutConfig: UseFunkitCheckoutPropsWithFullConfig], string> & {
20
+ init: null;
21
+ };
@@ -0,0 +1,109 @@
1
+ import { type AcrossClient } from '@across-protocol/app-sdk';
2
+ import { type Getter } from 'jotai';
3
+ import type { Address, Hex } from 'viem';
4
+ import type { BridgeExecutionParams, BridgeProviderAdapter, BridgeQuoteRequestParams, BridgeQuoteResult, SelectedRouteInfo } from './types';
5
+ /**
6
+ * Across quote metadata structure.
7
+ * Contains provider-specific data from Across SDK.
8
+ */
9
+ export interface AcrossQuoteMetadata {
10
+ /** The execution chain ID where the deposit transaction occurs */
11
+ executionChainId?: number;
12
+ /** Across swap quote from the SDK */
13
+ acrossSwapQuote?: AcrossSwapQuote;
14
+ }
15
+ /**
16
+ * Across swap quote data from the SDK.
17
+ */
18
+ export interface AcrossSwapQuote {
19
+ /** Swap transaction details */
20
+ swapTx?: {
21
+ to: Address;
22
+ value?: string;
23
+ data: Hex;
24
+ chainId: number;
25
+ };
26
+ /** Estimated fill time in seconds */
27
+ expectedFillTime?: number;
28
+ /** Input amount */
29
+ inputAmount?: string;
30
+ /** Output amount */
31
+ expectedOutputAmount?: string;
32
+ /** Approval transactions if needed */
33
+ approvalTxns?: Array<{
34
+ to: string;
35
+ data: string;
36
+ chainId: number;
37
+ }>;
38
+ }
39
+ /**
40
+ * Extended quote result with Across-specific metadata.
41
+ */
42
+ export interface AcrossQuote extends BridgeQuoteResult {
43
+ metadata?: {
44
+ acrossSwapQuote?: AcrossSwapQuote;
45
+ };
46
+ }
47
+ /**
48
+ * Atom holding the Across client instance.
49
+ * Lazily created when first accessed.
50
+ */
51
+ export declare const acrossClientAtom: import("jotai").Atom<AcrossClient | null>;
52
+ /**
53
+ * Mutation atom for getting an Across quote using the SDK.
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * const { mutateAsync: getQuote } = useAtomValue(acrossGetQuoteAtom)
58
+ * const quote = await getQuote(params)
59
+ * ```
60
+ */
61
+ export declare const acrossGetQuoteAtom: import("jotai").Atom<import("jotai-tanstack-query").AtomWithMutationResult<BridgeQuoteResult | null, unknown, BridgeQuoteRequestParams, unknown>>;
62
+ /**
63
+ * Mutation atom for executing an Across quote using the SDK.
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * const { mutateAsync: execute } = useAtomValue(acrossExecuteAtom)
68
+ * const txHash = await execute(params)
69
+ * ```
70
+ */
71
+ export declare const acrossExecuteAtom: import("jotai").Atom<import("jotai-tanstack-query").AtomWithMutationResult<`0x${string}` | null, unknown, BridgeExecutionParams, unknown>>;
72
+ /**
73
+ * Derived atom for getting the selected route display info.
74
+ * Reactively updates when quote or config changes.
75
+ *
76
+ * @example
77
+ * ```ts
78
+ * const selectedRoute = useAtomValue(acrossSelectedRouteAtom)
79
+ * if (selectedRoute) {
80
+ * console.log(selectedRoute.label, selectedRoute.isPassthrough)
81
+ * }
82
+ * ```
83
+ */
84
+ export declare const acrossSelectedRouteAtom: import("jotai").Atom<SelectedRouteInfo | null>;
85
+ /**
86
+ * Derived atom for estimated time from the latest quote.
87
+ *
88
+ * @example
89
+ * ```ts
90
+ * const estimatedTime = useAtomValue(acrossEstimatedTimeAtom)
91
+ * ```
92
+ */
93
+ export declare const acrossEstimatedTimeAtom: import("jotai").Atom<number | null>;
94
+ /**
95
+ * Composed Across adapter atom that implements BridgeProviderAdapter.
96
+ * Combines all individual atoms into a unified interface.
97
+ *
98
+ * @example
99
+ * ```ts
100
+ * const adapter = useAtomValue(acrossAdapterAtom)
101
+ * const quote = await adapter.getQuote(params)
102
+ * ```
103
+ */
104
+ export declare const acrossAdapterAtom: import("jotai").Atom<BridgeProviderAdapter>;
105
+ /**
106
+ * @deprecated Use `acrossAdapterAtom` instead.
107
+ * Creates an Across bridge provider adapter.
108
+ */
109
+ export declare function createAcrossAdapter(get: Getter): BridgeProviderAdapter;
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Bridge Provider Adapters
3
+ *
4
+ * This module provides a standardized interface for bridge providers
5
+ * (Relay, Across, etc.) used in the wallet checkout flow.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * import {
10
+ * relayAdapterAtom,
11
+ * relaySelectedRouteAtom,
12
+ * createProviderRegistry,
13
+ * type BridgeProviderAdapter,
14
+ * } from './bridgeProviders'
15
+ *
16
+ * // Use the composed adapter
17
+ * const adapter = useAtomValue(relayAdapterAtom)
18
+ *
19
+ * // Or use individual atoms for reactive updates
20
+ * const selectedRoute = useAtomValue(relaySelectedRouteAtom)
21
+ * ```
22
+ */
23
+ export type { BridgeProviderAdapter, BridgeProviderRegistry, BridgeQuoteParams, BridgeQuoteExactInParams, BridgeQuoteExactOutParams, BridgeQuoteRequestParams, BridgeQuoteResult, BridgeExecutionParams, BridgeExecutionResult, ChainAsset, ProviderSelectionCriteria, RouteEligibilityParams, SelectedRouteInfo, } from './types';
24
+ export { createProviderRegistry } from './registry';
25
+ export { relayAdapterAtom, relayGetQuoteAtom, relayExecuteAtom, relaySelectedRouteAtom, relayEstimatedTimeAtom, createRelayAdapter, } from './relayAdapter';
@@ -0,0 +1,12 @@
1
+ import type { BridgeProviderAdapter, BridgeProviderRegistry } from './types';
2
+ /**
3
+ * Creates a simple provider registry with default selection logic.
4
+ *
5
+ * Selection priority:
6
+ * 1. Preferred provider (if specified and supports route)
7
+ * 2. First provider that supports the route
8
+ *
9
+ * @param providers - Array of bridge provider adapters
10
+ * @returns A provider registry
11
+ */
12
+ export declare function createProviderRegistry(providers: BridgeProviderAdapter[]): BridgeProviderRegistry;
@@ -0,0 +1,60 @@
1
+ import { type Getter } from 'jotai';
2
+ import type { BridgeExecutionParams, BridgeProviderAdapter, BridgeQuoteRequestParams, BridgeQuoteResult, SelectedRouteInfo } from './types';
3
+ /**
4
+ * Mutation atom for getting a Relay quote.
5
+ *
6
+ * @example
7
+ * ```ts
8
+ * const { mutateAsync: getQuote } = useAtomValue(relayGetQuoteAtom)
9
+ * const quote = await getQuote(params)
10
+ * ```
11
+ */
12
+ export declare const relayGetQuoteAtom: import("jotai").Atom<import("jotai-tanstack-query").AtomWithMutationResult<BridgeQuoteResult | null, unknown, BridgeQuoteRequestParams, unknown>>;
13
+ /**
14
+ * Mutation atom for executing a Relay quote.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const { mutateAsync: execute } = useAtomValue(relayExecuteAtom)
19
+ * const txHash = await execute(params)
20
+ * ```
21
+ */
22
+ export declare const relayExecuteAtom: import("jotai").Atom<import("jotai-tanstack-query").AtomWithMutationResult<`0x${string}` | null, unknown, BridgeExecutionParams, unknown>>;
23
+ /**
24
+ * Derived atom for getting the selected route display info.
25
+ * Reactively updates when quote or config changes.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const selectedRoute = useAtomValue(relaySelectedRouteAtom)
30
+ * if (selectedRoute) {
31
+ * console.log(selectedRoute.label, selectedRoute.isPassthrough)
32
+ * }
33
+ * ```
34
+ */
35
+ export declare const relaySelectedRouteAtom: import("jotai").Atom<SelectedRouteInfo | null>;
36
+ /**
37
+ * Derived atom for estimated time from the latest quote.
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const estimatedTime = useAtomValue(relayEstimatedTimeAtom)
42
+ * ```
43
+ */
44
+ export declare const relayEstimatedTimeAtom: import("jotai").Atom<number | null>;
45
+ /**
46
+ * Composed Relay adapter atom that implements BridgeProviderAdapter.
47
+ * Combines all individual atoms into a unified interface.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * const adapter = useAtomValue(relayAdapterAtom)
52
+ * const quote = await adapter.getQuote(params)
53
+ * ```
54
+ */
55
+ export declare const relayAdapterAtom: import("jotai").Atom<BridgeProviderAdapter>;
56
+ /**
57
+ * @deprecated Use `relayAdapterAtom` instead.
58
+ * Creates a Relay bridge provider adapter.
59
+ */
60
+ export declare function createRelayAdapter(get: Getter): BridgeProviderAdapter;