@openzeppelin/ui-react 1.0.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.
- package/LICENSE +661 -0
- package/README.md +195 -0
- package/dist/index-B_dOGVNW.d.ts +421 -0
- package/dist/index-B_dOGVNW.d.ts.map +1 -0
- package/dist/index-Cfc5cQFd.d.cts +421 -0
- package/dist/index-Cfc5cQFd.d.cts.map +1 -0
- package/dist/index.cjs +909 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +421 -0
- package/dist/index.d.ts +421 -0
- package/dist/index.js +864 -0
- package/dist/index.js.map +1 -0
- package/package.json +77 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
import * as react0 from "react";
|
|
2
|
+
import React, { ReactNode } from "react";
|
|
3
|
+
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
+
import { Connector, ContractAdapter, EcosystemSpecificReactHooks, NativeConfigLoader, NetworkConfig, UiKitConfiguration } from "@openzeppelin/ui-types";
|
|
5
|
+
|
|
6
|
+
//#region src/hooks/AdapterContext.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Registry type that maps network IDs to their corresponding adapter instances
|
|
9
|
+
* This is the core data structure for the singleton pattern
|
|
10
|
+
*/
|
|
11
|
+
interface AdapterRegistry {
|
|
12
|
+
[networkId: string]: ContractAdapter;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Context value interface defining what's provided through the context
|
|
16
|
+
* The main functionality is getAdapterForNetwork which either returns
|
|
17
|
+
* an existing adapter or initiates loading of a new one
|
|
18
|
+
*/
|
|
19
|
+
interface AdapterContextValue {
|
|
20
|
+
getAdapterForNetwork: (networkConfig: NetworkConfig | null) => {
|
|
21
|
+
adapter: ContractAdapter | null;
|
|
22
|
+
isLoading: boolean;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The React Context that provides adapter registry access throughout the app
|
|
27
|
+
* Components can access this through the useAdapterContext hook
|
|
28
|
+
*/
|
|
29
|
+
declare const AdapterContext: react0.Context<AdapterContextValue | null>;
|
|
30
|
+
//# sourceMappingURL=AdapterContext.d.ts.map
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region src/hooks/AdapterProvider.d.ts
|
|
33
|
+
interface AdapterProviderProps {
|
|
34
|
+
children: ReactNode;
|
|
35
|
+
/** Function to resolve/create an adapter instance for a given NetworkConfig. */
|
|
36
|
+
resolveAdapter: (networkConfig: NetworkConfig) => Promise<ContractAdapter>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Provider component that manages adapter instances centrally
|
|
40
|
+
* to avoid creating multiple instances of the same adapter.
|
|
41
|
+
*
|
|
42
|
+
* This component:
|
|
43
|
+
* 1. Maintains a registry of adapter instances by network ID
|
|
44
|
+
* 2. Tracks loading states for adapters being initialized
|
|
45
|
+
* 3. Provides a function to get or load adapters for specific networks
|
|
46
|
+
* 4. Ensures adapter instances are reused when possible
|
|
47
|
+
*/
|
|
48
|
+
declare function AdapterProvider({
|
|
49
|
+
children,
|
|
50
|
+
resolveAdapter
|
|
51
|
+
}: AdapterProviderProps): react_jsx_runtime0.JSX.Element;
|
|
52
|
+
//# sourceMappingURL=AdapterProvider.d.ts.map
|
|
53
|
+
//#endregion
|
|
54
|
+
//#region src/hooks/WalletStateContext.d.ts
|
|
55
|
+
interface WalletStateContextValue {
|
|
56
|
+
activeNetworkId: string | null;
|
|
57
|
+
setActiveNetworkId: (networkId: string | null) => void;
|
|
58
|
+
activeNetworkConfig: NetworkConfig | null;
|
|
59
|
+
activeAdapter: ContractAdapter | null;
|
|
60
|
+
isAdapterLoading: boolean;
|
|
61
|
+
walletFacadeHooks: EcosystemSpecificReactHooks | null;
|
|
62
|
+
reconfigureActiveAdapterUiKit: (uiKitConfig?: Partial<UiKitConfiguration>) => void;
|
|
63
|
+
}
|
|
64
|
+
declare const WalletStateContext: React.Context<WalletStateContextValue | undefined>;
|
|
65
|
+
/**
|
|
66
|
+
* Hook to access wallet state from WalletStateProvider.
|
|
67
|
+
* @throws Error if used outside of WalletStateProvider
|
|
68
|
+
*/
|
|
69
|
+
declare function useWalletState(): WalletStateContextValue;
|
|
70
|
+
//# sourceMappingURL=WalletStateContext.d.ts.map
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/hooks/WalletStateProvider.d.ts
|
|
73
|
+
interface WalletStateProviderProps {
|
|
74
|
+
children: ReactNode;
|
|
75
|
+
/** Optional initial network ID to set as active when the provider mounts. */
|
|
76
|
+
initialNetworkId?: string | null;
|
|
77
|
+
/** Function to retrieve a NetworkConfig object by its ID. */
|
|
78
|
+
getNetworkConfigById: (networkId: string) => Promise<NetworkConfig | null | undefined> | NetworkConfig | null | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* Optional generic function to load configuration modules by relative path.
|
|
81
|
+
* The adapter is responsible for constructing the conventional path (e.g., './config/wallet/[kitName].config').
|
|
82
|
+
* @param relativePath The conventional relative path to the configuration module.
|
|
83
|
+
* @returns A Promise resolving to the configuration object (expected to have a default export) or null.
|
|
84
|
+
*/
|
|
85
|
+
loadConfigModule?: NativeConfigLoader;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* @name WalletStateProvider
|
|
89
|
+
* @description This provider is a central piece of the application's state management for wallet and network interactions.
|
|
90
|
+
* It is responsible for:
|
|
91
|
+
* 1. Managing the globally selected active network ID (`activeNetworkId`).
|
|
92
|
+
* 2. Deriving the full `NetworkConfig` object (`activeNetworkConfig`) for the active network.
|
|
93
|
+
* 3. Fetching and providing the corresponding `ContractAdapter` instance (`activeAdapter`) for the active network,
|
|
94
|
+
* leveraging the `AdapterProvider` to ensure adapter singletons.
|
|
95
|
+
* 4. Storing and providing the `EcosystemSpecificReactHooks` (`walletFacadeHooks`) from the active adapter.
|
|
96
|
+
* 5. Rendering the adapter-specific UI context provider (e.g., WagmiProvider for EVM) around its children,
|
|
97
|
+
* which is essential for the facade hooks to function correctly.
|
|
98
|
+
* 6. Providing a function (`setActiveNetworkId`) to change the globally active network.
|
|
99
|
+
*
|
|
100
|
+
* Consumers use the `useWalletState()` hook to access this global state.
|
|
101
|
+
* It should be placed high in the component tree, inside an `<AdapterProvider>`.
|
|
102
|
+
*/
|
|
103
|
+
declare function WalletStateProvider({
|
|
104
|
+
children,
|
|
105
|
+
initialNetworkId,
|
|
106
|
+
getNetworkConfigById,
|
|
107
|
+
loadConfigModule
|
|
108
|
+
}: WalletStateProviderProps): react_jsx_runtime0.JSX.Element;
|
|
109
|
+
//# sourceMappingURL=WalletStateProvider.d.ts.map
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region src/hooks/AnalyticsContext.d.ts
|
|
112
|
+
/**
|
|
113
|
+
* Analytics context value interface.
|
|
114
|
+
* Provides access to analytics functionality throughout the React component tree.
|
|
115
|
+
*/
|
|
116
|
+
interface AnalyticsContextValue {
|
|
117
|
+
/** Google Analytics tag ID */
|
|
118
|
+
tagId?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Check if analytics is enabled via feature flag.
|
|
121
|
+
* Returns fresh state on each call to handle dynamic feature flag changes.
|
|
122
|
+
*/
|
|
123
|
+
isEnabled: () => boolean;
|
|
124
|
+
/** Initialize analytics with optional tag ID override */
|
|
125
|
+
initialize: (tagIdOverride?: string) => void;
|
|
126
|
+
/**
|
|
127
|
+
* Track a generic event with custom parameters.
|
|
128
|
+
* Use this for app-specific events.
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```typescript
|
|
132
|
+
* trackEvent('button_clicked', { button_name: 'submit' });
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
trackEvent: (eventName: string, parameters: Record<string, string | number>) => void;
|
|
136
|
+
/**
|
|
137
|
+
* Track page view event.
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```typescript
|
|
141
|
+
* trackPageView('Dashboard', '/dashboard');
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
trackPageView: (pageName: string, pagePath: string) => void;
|
|
145
|
+
/**
|
|
146
|
+
* Track network selection event.
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```typescript
|
|
150
|
+
* trackNetworkSelection('ethereum-mainnet', 'evm');
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
trackNetworkSelection: (networkId: string, ecosystem: string) => void;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Analytics context for providing analytics functionality to React components.
|
|
157
|
+
* Must be used within an AnalyticsProvider.
|
|
158
|
+
*/
|
|
159
|
+
declare const AnalyticsContext: react0.Context<AnalyticsContextValue | null>;
|
|
160
|
+
/**
|
|
161
|
+
* Internal hook to access analytics context.
|
|
162
|
+
* Throws an error if used outside of an AnalyticsProvider.
|
|
163
|
+
*
|
|
164
|
+
* @internal
|
|
165
|
+
* @throws Error if used outside of AnalyticsProvider
|
|
166
|
+
*/
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region src/hooks/AnalyticsProvider.d.ts
|
|
169
|
+
/**
|
|
170
|
+
* Props for the AnalyticsProvider component
|
|
171
|
+
*/
|
|
172
|
+
interface AnalyticsProviderProps {
|
|
173
|
+
/** Google Analytics tag ID (e.g., 'G-XXXXXXXXXX') */
|
|
174
|
+
tagId?: string;
|
|
175
|
+
/** Whether to automatically initialize analytics on mount (default: true) */
|
|
176
|
+
autoInit?: boolean;
|
|
177
|
+
/** Child components */
|
|
178
|
+
children: ReactNode;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Analytics Provider component.
|
|
182
|
+
* Provides analytics functionality throughout the React component tree.
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```tsx
|
|
186
|
+
* function App() {
|
|
187
|
+
* return (
|
|
188
|
+
* <AnalyticsProvider tagId={import.meta.env.VITE_GA_TAG_ID} autoInit={true}>
|
|
189
|
+
* <YourApp />
|
|
190
|
+
* </AnalyticsProvider>
|
|
191
|
+
* );
|
|
192
|
+
* }
|
|
193
|
+
* ```
|
|
194
|
+
*/
|
|
195
|
+
declare const AnalyticsProvider: React.FC<AnalyticsProviderProps>;
|
|
196
|
+
//# sourceMappingURL=AnalyticsProvider.d.ts.map
|
|
197
|
+
|
|
198
|
+
//#endregion
|
|
199
|
+
//#region src/hooks/useAnalytics.d.ts
|
|
200
|
+
/**
|
|
201
|
+
* Custom hook for accessing analytics functionality.
|
|
202
|
+
*
|
|
203
|
+
* This hook provides a convenient interface for tracking user interactions
|
|
204
|
+
* throughout the application. It must be used within an AnalyticsProvider.
|
|
205
|
+
*
|
|
206
|
+
* For app-specific tracking methods, create a wrapper hook that uses this
|
|
207
|
+
* hook and adds your custom tracking functions.
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* ```tsx
|
|
211
|
+
* // Basic usage
|
|
212
|
+
* function MyComponent() {
|
|
213
|
+
* const { trackEvent, trackPageView, isEnabled } = useAnalytics();
|
|
214
|
+
*
|
|
215
|
+
* const handleClick = () => {
|
|
216
|
+
* trackEvent('button_clicked', { button_name: 'submit' });
|
|
217
|
+
* };
|
|
218
|
+
*
|
|
219
|
+
* return (
|
|
220
|
+
* <div>
|
|
221
|
+
* Analytics enabled: {isEnabled().toString()}
|
|
222
|
+
* <button onClick={handleClick}>Submit</button>
|
|
223
|
+
* </div>
|
|
224
|
+
* );
|
|
225
|
+
* }
|
|
226
|
+
* ```
|
|
227
|
+
*
|
|
228
|
+
* @example
|
|
229
|
+
* ```tsx
|
|
230
|
+
* // Creating app-specific wrapper hook
|
|
231
|
+
* function useMyAppAnalytics() {
|
|
232
|
+
* const analytics = useAnalytics();
|
|
233
|
+
*
|
|
234
|
+
* return {
|
|
235
|
+
* ...analytics,
|
|
236
|
+
* trackFormSubmit: (formName: string) => {
|
|
237
|
+
* analytics.trackEvent('form_submitted', { form_name: formName });
|
|
238
|
+
* },
|
|
239
|
+
* };
|
|
240
|
+
* }
|
|
241
|
+
* ```
|
|
242
|
+
*
|
|
243
|
+
* @returns Analytics context with tracking methods and state
|
|
244
|
+
* @throws Error if used outside of AnalyticsProvider
|
|
245
|
+
*/
|
|
246
|
+
declare const useAnalytics: () => AnalyticsContextValue;
|
|
247
|
+
//# sourceMappingURL=useAnalytics.d.ts.map
|
|
248
|
+
//#endregion
|
|
249
|
+
//#region src/hooks/useAdapterContext.d.ts
|
|
250
|
+
/**
|
|
251
|
+
* Hook to access the adapter context
|
|
252
|
+
*
|
|
253
|
+
* This hook provides access to the getAdapterForNetwork function which
|
|
254
|
+
* retrieves or creates adapter instances from the singleton registry.
|
|
255
|
+
*
|
|
256
|
+
* Components should typically use useConfiguredAdapterSingleton instead
|
|
257
|
+
* of this hook directly, as it handles React state update timing properly.
|
|
258
|
+
*
|
|
259
|
+
* @throws Error if used outside of an AdapterProvider context
|
|
260
|
+
* @returns The adapter context value
|
|
261
|
+
*/
|
|
262
|
+
declare function useAdapterContext(): AdapterContextValue;
|
|
263
|
+
//# sourceMappingURL=useAdapterContext.d.ts.map
|
|
264
|
+
//#endregion
|
|
265
|
+
//#region src/hooks/useDerivedAccountStatus.d.ts
|
|
266
|
+
interface DerivedAccountStatus {
|
|
267
|
+
isConnected: boolean;
|
|
268
|
+
address?: string;
|
|
269
|
+
chainId?: number;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* A custom hook that consumes useWalletState to get the walletFacadeHooks,
|
|
273
|
+
* then calls the useAccount facade hook (if available) and returns a structured,
|
|
274
|
+
* safely-accessed account status (isConnected, address, chainId).
|
|
275
|
+
* Provides default values if the hook or its properties are unavailable.
|
|
276
|
+
*/
|
|
277
|
+
declare function useDerivedAccountStatus(): DerivedAccountStatus;
|
|
278
|
+
//# sourceMappingURL=useDerivedAccountStatus.d.ts.map
|
|
279
|
+
//#endregion
|
|
280
|
+
//#region src/hooks/useDerivedSwitchChainStatus.d.ts
|
|
281
|
+
interface DerivedSwitchChainStatus {
|
|
282
|
+
/** Function to initiate a network switch. Undefined if not available. */
|
|
283
|
+
switchChain?: (args: {
|
|
284
|
+
chainId: number;
|
|
285
|
+
}) => void;
|
|
286
|
+
/** True if a network switch is currently in progress. */
|
|
287
|
+
isSwitching: boolean;
|
|
288
|
+
/** Error object if the last switch attempt failed, otherwise null. */
|
|
289
|
+
error: Error | null;
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* A custom hook that consumes `useWalletState` to get `walletFacadeHooks`,
|
|
293
|
+
* then calls the `useSwitchChain` facade hook (if available) and returns a structured,
|
|
294
|
+
* safely-accessed status and control function for network switching.
|
|
295
|
+
* Provides default values if the hook or its properties are unavailable.
|
|
296
|
+
*/
|
|
297
|
+
declare function useDerivedSwitchChainStatus(): DerivedSwitchChainStatus;
|
|
298
|
+
//# sourceMappingURL=useDerivedSwitchChainStatus.d.ts.map
|
|
299
|
+
//#endregion
|
|
300
|
+
//#region src/hooks/useDerivedChainInfo.d.ts
|
|
301
|
+
interface DerivedChainInfo {
|
|
302
|
+
/** The current chain ID reported by the wallet's active connection, if available. */
|
|
303
|
+
currentChainId?: number;
|
|
304
|
+
/** Array of chains configured in the underlying wallet library (e.g., wagmi). Type is any[] for generic compatibility. */
|
|
305
|
+
availableChains: unknown[];
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* A custom hook that consumes `useWalletState` to get `walletFacadeHooks`,
|
|
309
|
+
* then calls the `useChainId` and `useChains` facade hooks (if available)
|
|
310
|
+
* and returns a structured object with this information.
|
|
311
|
+
* Provides default values if the hooks or their properties are unavailable.
|
|
312
|
+
*/
|
|
313
|
+
declare function useDerivedChainInfo(): DerivedChainInfo;
|
|
314
|
+
//# sourceMappingURL=useDerivedChainInfo.d.ts.map
|
|
315
|
+
//#endregion
|
|
316
|
+
//#region src/hooks/useDerivedConnectStatus.d.ts
|
|
317
|
+
interface DerivedConnectStatus {
|
|
318
|
+
/** Function to initiate a connection, usually takes a connector. Undefined if not available. */
|
|
319
|
+
connect?: (args?: {
|
|
320
|
+
connector?: Connector;
|
|
321
|
+
}) => void;
|
|
322
|
+
/** Array of available connectors. Type is any[] for broad compatibility until Connector type is fully generic here. */
|
|
323
|
+
connectors: Connector[];
|
|
324
|
+
/** True if a connection attempt is in progress. */
|
|
325
|
+
isConnecting: boolean;
|
|
326
|
+
/** Error object if the last connection attempt failed, otherwise null. */
|
|
327
|
+
error: Error | null;
|
|
328
|
+
/** The connector a connection is pending for, if any. */
|
|
329
|
+
pendingConnector?: Connector;
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* A custom hook that consumes `useWalletState` to get `walletFacadeHooks`,
|
|
333
|
+
* then calls the `useConnect` facade hook (if available) and returns a structured,
|
|
334
|
+
* safely-accessed status and control functions for wallet connection.
|
|
335
|
+
*/
|
|
336
|
+
declare function useDerivedConnectStatus(): DerivedConnectStatus;
|
|
337
|
+
//# sourceMappingURL=useDerivedConnectStatus.d.ts.map
|
|
338
|
+
//#endregion
|
|
339
|
+
//#region src/hooks/useDerivedDisconnect.d.ts
|
|
340
|
+
interface DerivedDisconnectStatus {
|
|
341
|
+
/** Function to initiate disconnection. Undefined if not available. */
|
|
342
|
+
disconnect?: () => void | Promise<void>;
|
|
343
|
+
/** True if a disconnection attempt is in progress (if hook provides this). */
|
|
344
|
+
isDisconnecting: boolean;
|
|
345
|
+
/** Error object if the last disconnection attempt failed (if hook provides this). */
|
|
346
|
+
error: Error | null;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* A custom hook that consumes `useWalletState` to get `walletFacadeHooks`,
|
|
350
|
+
* then calls the `useDisconnect` facade hook (if available) and returns a structured,
|
|
351
|
+
* safely-accessed status and control function for wallet disconnection.
|
|
352
|
+
*/
|
|
353
|
+
declare function useDerivedDisconnect(): DerivedDisconnectStatus;
|
|
354
|
+
//# sourceMappingURL=useDerivedDisconnect.d.ts.map
|
|
355
|
+
//#endregion
|
|
356
|
+
//#region src/hooks/useWalletReconnectionHandler.d.ts
|
|
357
|
+
/**
|
|
358
|
+
* Hook that detects wallet reconnection and re-queues network switch if needed.
|
|
359
|
+
*
|
|
360
|
+
* When a user disconnects their wallet and then reconnects in the same session,
|
|
361
|
+
* the wallet may connect to a different chain than what's selected in the app.
|
|
362
|
+
* This hook detects that scenario and invokes a callback to re-queue the network switch.
|
|
363
|
+
*
|
|
364
|
+
* @param selectedNetworkConfigId - Currently selected network in the app
|
|
365
|
+
* @param selectedAdapter - Currently active adapter instance
|
|
366
|
+
* @param networkToSwitchTo - Current network switch queue state (null if no switch pending)
|
|
367
|
+
* @param onRequeueSwitch - Callback invoked when a network switch should be re-queued
|
|
368
|
+
*/
|
|
369
|
+
declare function useWalletReconnectionHandler(selectedNetworkConfigId: string | null, selectedAdapter: ContractAdapter | null, networkToSwitchTo: string | null, onRequeueSwitch: (networkId: string) => void): void;
|
|
370
|
+
//# sourceMappingURL=useWalletReconnectionHandler.d.ts.map
|
|
371
|
+
//#endregion
|
|
372
|
+
//#region src/components/WalletConnectionHeader.d.ts
|
|
373
|
+
/**
|
|
374
|
+
* Component that renders the wallet connection UI.
|
|
375
|
+
* Uses useWalletState to get its data.
|
|
376
|
+
*/
|
|
377
|
+
declare const WalletConnectionHeader: React.FC;
|
|
378
|
+
//# sourceMappingURL=WalletConnectionHeader.d.ts.map
|
|
379
|
+
//#endregion
|
|
380
|
+
//#region src/components/WalletConnectionUI.d.ts
|
|
381
|
+
interface WalletConnectionUIProps {
|
|
382
|
+
className?: string;
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Component that displays wallet connection UI components
|
|
386
|
+
* provided by the active adapter.
|
|
387
|
+
*/
|
|
388
|
+
declare const WalletConnectionUI: React.FC<WalletConnectionUIProps>;
|
|
389
|
+
//#endregion
|
|
390
|
+
//#region src/components/NetworkSwitchManager.d.ts
|
|
391
|
+
/**
|
|
392
|
+
* Props for the NetworkSwitchManager component.
|
|
393
|
+
*/
|
|
394
|
+
interface NetworkSwitchManagerProps {
|
|
395
|
+
/** The adapter instance for the target network */
|
|
396
|
+
adapter: ContractAdapter;
|
|
397
|
+
/** The network ID we want to switch to */
|
|
398
|
+
targetNetworkId: string;
|
|
399
|
+
/** Callback when network switch completes (success or error) */
|
|
400
|
+
onNetworkSwitchComplete?: () => void;
|
|
401
|
+
}
|
|
402
|
+
/**
|
|
403
|
+
* Component that handles wallet network switching based on the selected network.
|
|
404
|
+
*
|
|
405
|
+
* This component manages the lifecycle of network switching operations,
|
|
406
|
+
* coordinating between the wallet's current chain state and the target network.
|
|
407
|
+
* It's designed to be used in any application that needs seamless wallet network switching.
|
|
408
|
+
*
|
|
409
|
+
* Features:
|
|
410
|
+
* - Automatically initiates network switch when mounted with a target network
|
|
411
|
+
* - Handles EVM chain switching gracefully
|
|
412
|
+
* - No-ops for non-EVM networks that don't support chain switching
|
|
413
|
+
* - Tracks switch attempts to prevent duplicate operations
|
|
414
|
+
* - Provides completion callback for parent components to handle state cleanup
|
|
415
|
+
*/
|
|
416
|
+
declare const NetworkSwitchManager: React.FC<NetworkSwitchManagerProps>;
|
|
417
|
+
//# sourceMappingURL=NetworkSwitchManager.d.ts.map
|
|
418
|
+
|
|
419
|
+
//#endregion
|
|
420
|
+
export { AdapterContext, type AdapterContextValue, AdapterProvider, type AdapterProviderProps, type AdapterRegistry, AnalyticsContext, type AnalyticsContextValue, AnalyticsProvider, type AnalyticsProviderProps, type DerivedAccountStatus, type DerivedChainInfo, type DerivedConnectStatus, type DerivedDisconnectStatus, type DerivedSwitchChainStatus, NetworkSwitchManager, type NetworkSwitchManagerProps, WalletConnectionHeader, WalletConnectionUI, WalletStateContext, type WalletStateContextValue, WalletStateProvider, type WalletStateProviderProps, useAdapterContext, useAnalytics, useDerivedAccountStatus, useDerivedChainInfo, useDerivedConnectStatus, useDerivedDisconnect, useDerivedSwitchChainStatus, useWalletReconnectionHandler, useWalletState };
|
|
421
|
+
//# sourceMappingURL=index-B_dOGVNW.d.ts.map
|