@openzeppelin/ui-react 1.1.0 → 2.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/dist/index.d.cts CHANGED
@@ -1,65 +1,71 @@
1
1
  import * as react0 from "react";
2
2
  import React, { ReactNode } from "react";
3
- import { BaseComponentProps, Connector, ContractAdapter, EcosystemSpecificReactHooks, EcosystemWalletComponents, NativeConfigLoader, NetworkConfig, UiKitConfiguration } from "@openzeppelin/ui-types";
3
+ import { BaseComponentProps, Connector, EcosystemRuntime, EcosystemSpecificReactHooks, EcosystemWalletComponents, NativeConfigLoader, NetworkCatalogCapability, NetworkConfig, RuntimeCapability, UiKitConfiguration, WalletCapability } from "@openzeppelin/ui-types";
4
4
  import * as react_jsx_runtime0 from "react/jsx-runtime";
5
5
 
6
+ //#region src/version.d.ts
7
+ declare const VERSION: string;
8
+ //#endregion
6
9
  //#region src/hooks/AdapterContext.d.ts
7
10
  /**
8
- * Registry type that maps network IDs to their corresponding adapter instances
9
- * This is the core data structure for the singleton pattern
11
+ * Registry type that maps network IDs to their corresponding runtime instances.
10
12
  */
11
- interface AdapterRegistry {
12
- [networkId: string]: ContractAdapter;
13
+ interface RuntimeRegistry {
14
+ [networkId: string]: EcosystemRuntime;
13
15
  }
14
16
  /**
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
17
+ * Context value interface defining what's provided through the context.
18
+ * The main functionality is `getRuntimeForNetwork`, which either returns an existing
19
+ * runtime or initiates loading of a new one.
18
20
  */
19
- interface AdapterContextValue {
20
- getAdapterForNetwork: (networkConfig: NetworkConfig | null) => {
21
- adapter: ContractAdapter | null;
21
+ interface RuntimeContextValue {
22
+ getRuntimeForNetwork: (networkConfig: NetworkConfig | null) => {
23
+ runtime: EcosystemRuntime | null;
22
24
  isLoading: boolean;
23
25
  };
26
+ /**
27
+ * Evicts a runtime from the registry and calls `dispose()` on it.
28
+ * Used by WalletStateProvider to release superseded runtimes after a safe handoff.
29
+ */
30
+ releaseRuntime: (networkId: string) => void;
24
31
  }
25
32
  /**
26
- * The React Context that provides adapter registry access throughout the app
27
- * Components can access this through the useAdapterContext hook
33
+ * The React Context that provides runtime registry access throughout the app.
34
+ * Components can access this through the `useRuntimeContext` hook.
28
35
  */
29
- declare const AdapterContext: react0.Context<AdapterContextValue | null>;
30
- //# sourceMappingURL=AdapterContext.d.ts.map
36
+ declare const RuntimeContext: react0.Context<RuntimeContextValue | null>;
31
37
  //#endregion
32
38
  //#region src/hooks/AdapterProvider.d.ts
33
- interface AdapterProviderProps {
39
+
40
+ interface RuntimeProviderProps {
34
41
  children: ReactNode;
35
- /** Function to resolve/create an adapter instance for a given NetworkConfig. */
36
- resolveAdapter: (networkConfig: NetworkConfig) => Promise<ContractAdapter>;
42
+ /** Function to resolve/create a runtime instance for a given NetworkConfig. */
43
+ resolveRuntime: (networkConfig: NetworkConfig) => Promise<EcosystemRuntime>;
37
44
  }
38
45
  /**
39
- * Provider component that manages adapter instances centrally
40
- * to avoid creating multiple instances of the same adapter.
46
+ * Provider component that manages runtime instances centrally
47
+ * to avoid creating multiple instances of the same runtime.
41
48
  *
42
49
  * 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
50
+ * 1. Maintains a registry of runtime instances by network ID
51
+ * 2. Tracks loading states for runtimes being initialized
52
+ * 3. Provides a function to get or load runtimes for specific networks
53
+ * 4. Ensures runtime instances are reused when possible
47
54
  */
48
- declare function AdapterProvider({
55
+ declare function RuntimeProvider({
49
56
  children,
50
- resolveAdapter
51
- }: AdapterProviderProps): react_jsx_runtime0.JSX.Element;
52
- //# sourceMappingURL=AdapterProvider.d.ts.map
57
+ resolveRuntime
58
+ }: RuntimeProviderProps): react_jsx_runtime0.JSX.Element;
53
59
  //#endregion
54
60
  //#region src/hooks/WalletStateContext.d.ts
55
61
  interface WalletStateContextValue {
56
62
  activeNetworkId: string | null;
57
63
  setActiveNetworkId: (networkId: string | null) => void;
58
64
  activeNetworkConfig: NetworkConfig | null;
59
- activeAdapter: ContractAdapter | null;
60
- isAdapterLoading: boolean;
65
+ activeRuntime: EcosystemRuntime | null;
66
+ isRuntimeLoading: boolean;
61
67
  walletFacadeHooks: EcosystemSpecificReactHooks | null;
62
- reconfigureActiveAdapterUiKit: (uiKitConfig?: Partial<UiKitConfiguration>) => void;
68
+ reconfigureActiveUiKit: (uiKitConfig?: Partial<UiKitConfiguration>) => void;
63
69
  }
64
70
  declare const WalletStateContext: React.Context<WalletStateContextValue | undefined>;
65
71
  /**
@@ -67,7 +73,6 @@ declare const WalletStateContext: React.Context<WalletStateContextValue | undefi
67
73
  * @throws Error if used outside of WalletStateProvider
68
74
  */
69
75
  declare function useWalletState(): WalletStateContextValue;
70
- //# sourceMappingURL=WalletStateContext.d.ts.map
71
76
  //#endregion
72
77
  //#region src/hooks/WalletStateProvider.d.ts
73
78
  interface WalletStateProviderProps {
@@ -90,15 +95,16 @@ interface WalletStateProviderProps {
90
95
  * It is responsible for:
91
96
  * 1. Managing the globally selected active network ID (`activeNetworkId`).
92
97
  * 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
+ * 3. Fetching and providing the corresponding `EcosystemRuntime` (`activeRuntime`) for the active network,
99
+ * leveraging the `RuntimeProvider` to ensure runtime singletons.
100
+ * 4. Caching ecosystem-scoped wallet session artifacts (provider roots and facade hooks)
101
+ * independently from the network-scoped runtime.
102
+ * 5. Rendering the active ecosystem wallet provider (e.g., WagmiProvider for EVM) around its
103
+ * children, which is essential for the facade hooks to function correctly.
98
104
  * 6. Providing a function (`setActiveNetworkId`) to change the globally active network.
99
105
  *
100
106
  * Consumers use the `useWalletState()` hook to access this global state.
101
- * It should be placed high in the component tree, inside an `<AdapterProvider>`.
107
+ * It should be placed high in the component tree, inside a `<RuntimeProvider>`.
102
108
  */
103
109
  declare function WalletStateProvider({
104
110
  children,
@@ -106,7 +112,6 @@ declare function WalletStateProvider({
106
112
  getNetworkConfigById,
107
113
  loadConfigModule
108
114
  }: WalletStateProviderProps): react_jsx_runtime0.JSX.Element;
109
- //# sourceMappingURL=WalletStateProvider.d.ts.map
110
115
  //#endregion
111
116
  //#region src/hooks/AnalyticsContext.d.ts
112
117
  /**
@@ -157,13 +162,6 @@ interface AnalyticsContextValue {
157
162
  * Must be used within an AnalyticsProvider.
158
163
  */
159
164
  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
165
  //#endregion
168
166
  //#region src/hooks/AnalyticsProvider.d.ts
169
167
  /**
@@ -193,8 +191,6 @@ interface AnalyticsProviderProps {
193
191
  * ```
194
192
  */
195
193
  declare const AnalyticsProvider: React.FC<AnalyticsProviderProps>;
196
- //# sourceMappingURL=AnalyticsProvider.d.ts.map
197
-
198
194
  //#endregion
199
195
  //#region src/hooks/useAnalytics.d.ts
200
196
  /**
@@ -244,35 +240,32 @@ declare const AnalyticsProvider: React.FC<AnalyticsProviderProps>;
244
240
  * @throws Error if used outside of AnalyticsProvider
245
241
  */
246
242
  declare const useAnalytics: () => AnalyticsContextValue;
247
- //# sourceMappingURL=useAnalytics.d.ts.map
248
243
  //#endregion
249
244
  //#region src/hooks/useAdapterContext.d.ts
250
245
  /**
251
- * Hook to access the adapter context
246
+ * Hook to access the runtime context
252
247
  *
253
- * This hook provides access to the getAdapterForNetwork function which
254
- * retrieves or creates adapter instances from the singleton registry.
248
+ * This hook provides access to the `getRuntimeForNetwork` function which
249
+ * retrieves or creates runtime instances from the singleton registry.
255
250
  *
256
- * Components should typically use useConfiguredAdapterSingleton instead
251
+ * Components should typically use the higher-level wallet/runtime hooks instead
257
252
  * of this hook directly, as it handles React state update timing properly.
258
253
  *
259
- * @throws Error if used outside of an AdapterProvider context
260
- * @returns The adapter context value
254
+ * @throws Error if used outside of a RuntimeProvider context
255
+ * @returns The runtime context value
261
256
  */
262
- declare function useAdapterContext(): AdapterContextValue;
263
- //# sourceMappingURL=useAdapterContext.d.ts.map
264
-
257
+ declare function useRuntimeContext(): RuntimeContextValue;
265
258
  //#endregion
266
259
  //#region src/hooks/useWalletComponents.d.ts
267
260
  /**
268
- * Hook that provides direct access to wallet UI components from the active adapter.
261
+ * Hook that provides direct access to wallet UI components from the active runtime.
269
262
  *
270
263
  * Use this hook when you need full control over the layout and composition of
271
264
  * wallet components. For standard layouts, prefer using `WalletConnectionUI`
272
265
  * with its props forwarding capabilities.
273
266
  *
274
- * @returns The wallet components object, or null if no adapter is active or
275
- * the adapter doesn't provide wallet components.
267
+ * @returns The wallet components object, or null if no runtime is active or
268
+ * the runtime doesn't provide wallet components.
276
269
  *
277
270
  * @example
278
271
  * ```tsx
@@ -307,11 +300,14 @@ declare function useAdapterContext(): AdapterContextValue;
307
300
  * ```
308
301
  */
309
302
  declare function useWalletComponents(): EcosystemWalletComponents | null;
310
- //# sourceMappingURL=useWalletComponents.d.ts.map
311
303
  //#endregion
312
304
  //#region src/hooks/useDerivedAccountStatus.d.ts
313
305
  interface DerivedAccountStatus {
314
306
  isConnected: boolean;
307
+ isConnecting: boolean;
308
+ isDisconnected: boolean;
309
+ isReconnecting: boolean;
310
+ status: string;
315
311
  address?: string;
316
312
  chainId?: number;
317
313
  }
@@ -322,7 +318,6 @@ interface DerivedAccountStatus {
322
318
  * Provides default values if the hook or its properties are unavailable.
323
319
  */
324
320
  declare function useDerivedAccountStatus(): DerivedAccountStatus;
325
- //# sourceMappingURL=useDerivedAccountStatus.d.ts.map
326
321
  //#endregion
327
322
  //#region src/hooks/useDerivedSwitchChainStatus.d.ts
328
323
  interface DerivedSwitchChainStatus {
@@ -342,7 +337,6 @@ interface DerivedSwitchChainStatus {
342
337
  * Provides default values if the hook or its properties are unavailable.
343
338
  */
344
339
  declare function useDerivedSwitchChainStatus(): DerivedSwitchChainStatus;
345
- //# sourceMappingURL=useDerivedSwitchChainStatus.d.ts.map
346
340
  //#endregion
347
341
  //#region src/hooks/useDerivedChainInfo.d.ts
348
342
  interface DerivedChainInfo {
@@ -358,7 +352,6 @@ interface DerivedChainInfo {
358
352
  * Provides default values if the hooks or their properties are unavailable.
359
353
  */
360
354
  declare function useDerivedChainInfo(): DerivedChainInfo;
361
- //# sourceMappingURL=useDerivedChainInfo.d.ts.map
362
355
  //#endregion
363
356
  //#region src/hooks/useDerivedConnectStatus.d.ts
364
357
  interface DerivedConnectStatus {
@@ -381,7 +374,6 @@ interface DerivedConnectStatus {
381
374
  * safely-accessed status and control functions for wallet connection.
382
375
  */
383
376
  declare function useDerivedConnectStatus(): DerivedConnectStatus;
384
- //# sourceMappingURL=useDerivedConnectStatus.d.ts.map
385
377
  //#endregion
386
378
  //#region src/hooks/useDerivedDisconnect.d.ts
387
379
  interface DerivedDisconnectStatus {
@@ -398,7 +390,6 @@ interface DerivedDisconnectStatus {
398
390
  * safely-accessed status and control function for wallet disconnection.
399
391
  */
400
392
  declare function useDerivedDisconnect(): DerivedDisconnectStatus;
401
- //# sourceMappingURL=useDerivedDisconnect.d.ts.map
402
393
  //#endregion
403
394
  //#region src/hooks/useWalletReconnectionHandler.d.ts
404
395
  /**
@@ -409,12 +400,11 @@ declare function useDerivedDisconnect(): DerivedDisconnectStatus;
409
400
  * This hook detects that scenario and invokes a callback to re-queue the network switch.
410
401
  *
411
402
  * @param selectedNetworkConfigId - Currently selected network in the app
412
- * @param selectedAdapter - Currently active adapter instance
403
+ * @param selectedCapability - Currently active wallet capability instance
413
404
  * @param networkToSwitchTo - Current network switch queue state (null if no switch pending)
414
405
  * @param onRequeueSwitch - Callback invoked when a network switch should be re-queued
415
406
  */
416
- declare function useWalletReconnectionHandler(selectedNetworkConfigId: string | null, selectedAdapter: ContractAdapter | null, networkToSwitchTo: string | null, onRequeueSwitch: (networkId: string) => void): void;
417
- //# sourceMappingURL=useWalletReconnectionHandler.d.ts.map
407
+ declare function useWalletReconnectionHandler(selectedNetworkConfigId: string | null, selectedCapability: RuntimeCapability | null, networkToSwitchTo: string | null, onRequeueSwitch: (networkId: string) => void): void;
418
408
  //#endregion
419
409
  //#region src/components/WalletConnectionHeader.d.ts
420
410
  /**
@@ -422,7 +412,6 @@ declare function useWalletReconnectionHandler(selectedNetworkConfigId: string |
422
412
  * Uses useWalletState to get its data.
423
413
  */
424
414
  declare const WalletConnectionHeader: React.FC;
425
- //# sourceMappingURL=WalletConnectionHeader.d.ts.map
426
415
  //#endregion
427
416
  //#region src/components/WalletConnectionUI.d.ts
428
417
  /**
@@ -461,15 +450,16 @@ interface WalletConnectionUIProps {
461
450
  * ```
462
451
  */
463
452
  declare const WalletConnectionUI: React.FC<WalletConnectionUIProps>;
464
- //# sourceMappingURL=WalletConnectionUI.d.ts.map
465
453
  //#endregion
466
454
  //#region src/components/NetworkSwitchManager.d.ts
467
455
  /**
468
456
  * Props for the NetworkSwitchManager component.
469
457
  */
470
458
  interface NetworkSwitchManagerProps {
471
- /** The adapter instance for the target network */
472
- adapter: ContractAdapter;
459
+ /** Wallet capability for the target network */
460
+ wallet: WalletCapability;
461
+ /** Network catalog capability used to validate the target network id */
462
+ networkCatalog: NetworkCatalogCapability;
473
463
  /** The network ID we want to switch to */
474
464
  targetNetworkId: string;
475
465
  /** Callback when network switch completes (success or error) */
@@ -490,8 +480,6 @@ interface NetworkSwitchManagerProps {
490
480
  * - Provides completion callback for parent components to handle state cleanup
491
481
  */
492
482
  declare const NetworkSwitchManager: React.FC<NetworkSwitchManagerProps>;
493
- //# sourceMappingURL=NetworkSwitchManager.d.ts.map
494
-
495
483
  //#endregion
496
- 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, type WalletConnectionUIProps, WalletStateContext, type WalletStateContextValue, WalletStateProvider, type WalletStateProviderProps, useAdapterContext, useAnalytics, useDerivedAccountStatus, useDerivedChainInfo, useDerivedConnectStatus, useDerivedDisconnect, useDerivedSwitchChainStatus, useWalletComponents, useWalletReconnectionHandler, useWalletState };
497
- //# sourceMappingURL=index-BlmRKpng.d.cts.map
484
+ export { AnalyticsContext, type AnalyticsContextValue, AnalyticsProvider, type AnalyticsProviderProps, type DerivedAccountStatus, type DerivedChainInfo, type DerivedConnectStatus, type DerivedDisconnectStatus, type DerivedSwitchChainStatus, NetworkSwitchManager, type NetworkSwitchManagerProps, RuntimeContext, type RuntimeContextValue, RuntimeProvider, type RuntimeProviderProps, type RuntimeRegistry, VERSION, WalletConnectionHeader, WalletConnectionUI, type WalletConnectionUIProps, WalletStateContext, type WalletStateContextValue, WalletStateProvider, type WalletStateProviderProps, useAnalytics, useDerivedAccountStatus, useDerivedChainInfo, useDerivedConnectStatus, useDerivedDisconnect, useDerivedSwitchChainStatus, useRuntimeContext, useWalletComponents, useWalletReconnectionHandler, useWalletState };
485
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/version.ts","../src/hooks/AdapterContext.tsx","../src/hooks/AdapterProvider.tsx","../src/hooks/WalletStateContext.ts","../src/hooks/WalletStateProvider.tsx","../src/hooks/AnalyticsContext.tsx","../src/hooks/AnalyticsProvider.tsx","../src/hooks/useAnalytics.ts","../src/hooks/useAdapterContext.ts","../src/hooks/useWalletComponents.ts","../src/hooks/useDerivedAccountStatus.ts","../src/hooks/useDerivedSwitchChainStatus.ts","../src/hooks/useDerivedChainInfo.ts","../src/hooks/useDerivedConnectStatus.ts","../src/hooks/useDerivedDisconnect.ts","../src/hooks/useWalletReconnectionHandler.ts","../src/components/WalletConnectionHeader.tsx","../src/components/WalletConnectionUI.tsx","../src/components/NetworkSwitchManager.tsx"],"sourcesContent":[],"mappings":";;;;;;cACa;;;;;;UCiBI,eAAA;uBACM;ADlBvB;;;;ACiBA;AASA;AAgBa,UAhBI,mBAAA,CAgBU;wCAfa;aAC3B;;ECPI,CAAA;EACL;;;;EAE+C,cAAA,EAAA,CAAA,SAAA,EAAA,MAAA,EAAA,GAAA,IAAA;AAa3D;;;;;AAAkF,cDKrE,cCLqE,EDKvD,MAAA,CAAA,OCLuD,CDKvD,mBCLuD,GAAA,IAAA,CAAA;;;;AAftE,UADK,oBAAA,CACL;EAEsB,QAAA,EAFtB,SAEsB;EAA0B;EAAR,cAAA,EAAA,CAAA,aAAA,EAAlB,aAAkB,EAAA,GAAA,OAAA,CAAQ,gBAAR,CAAA;;AAapD;;;;;;;;;AC7BA;AAIuB,iBDyBP,eAAA,CCzBO;EAAA,QAAA;EAAA;AAAA,CAAA,EDyBuC,oBCzBvC,CAAA,EDyB2D,kBAAA,CAAA,GAAA,CAAA,OCzB3D;;;UAJN,uBAAA;;;uBAIM;EHZV,aAAqC,EGejC,gBHfiC,GAAA,IAAA;;qBGoB7B;yCACoB,QAAQ;AFJjD;AASiB,cEuEJ,kBFtE2B,EEsET,KAAA,CAAA,OFrElB,CEqEkB,uBFrEF,GAAA,SAAA,CAAA;AAc7B;;;;ACrBiB,iBCkFD,cAAA,CAAA,CDlFqB,ECkFH,uBDlFG;;;UEFpB,wBAAA;YACL;;;EJpBC;+CI0BN,QAAQ,oCAAoC;;;AHTnD;AASA;AAgBA;;qBGTqB;;A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0 from "react/jsx-runtime";
4
- import { BaseComponentProps, Connector, ContractAdapter, EcosystemSpecificReactHooks, EcosystemWalletComponents, NativeConfigLoader, NetworkConfig, UiKitConfiguration } from "@openzeppelin/ui-types";
4
+ import { BaseComponentProps, Connector, EcosystemRuntime, EcosystemSpecificReactHooks, EcosystemWalletComponents, NativeConfigLoader, NetworkCatalogCapability, NetworkConfig, RuntimeCapability, UiKitConfiguration, WalletCapability } from "@openzeppelin/ui-types";
5
5
 
6
+ //#region src/version.d.ts
7
+ declare const VERSION: string;
8
+ //#endregion
6
9
  //#region src/hooks/AdapterContext.d.ts
7
10
  /**
8
- * Registry type that maps network IDs to their corresponding adapter instances
9
- * This is the core data structure for the singleton pattern
11
+ * Registry type that maps network IDs to their corresponding runtime instances.
10
12
  */
11
- interface AdapterRegistry {
12
- [networkId: string]: ContractAdapter;
13
+ interface RuntimeRegistry {
14
+ [networkId: string]: EcosystemRuntime;
13
15
  }
14
16
  /**
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
17
+ * Context value interface defining what's provided through the context.
18
+ * The main functionality is `getRuntimeForNetwork`, which either returns an existing
19
+ * runtime or initiates loading of a new one.
18
20
  */
19
- interface AdapterContextValue {
20
- getAdapterForNetwork: (networkConfig: NetworkConfig | null) => {
21
- adapter: ContractAdapter | null;
21
+ interface RuntimeContextValue {
22
+ getRuntimeForNetwork: (networkConfig: NetworkConfig | null) => {
23
+ runtime: EcosystemRuntime | null;
22
24
  isLoading: boolean;
23
25
  };
26
+ /**
27
+ * Evicts a runtime from the registry and calls `dispose()` on it.
28
+ * Used by WalletStateProvider to release superseded runtimes after a safe handoff.
29
+ */
30
+ releaseRuntime: (networkId: string) => void;
24
31
  }
25
32
  /**
26
- * The React Context that provides adapter registry access throughout the app
27
- * Components can access this through the useAdapterContext hook
33
+ * The React Context that provides runtime registry access throughout the app.
34
+ * Components can access this through the `useRuntimeContext` hook.
28
35
  */
29
- declare const AdapterContext: react0.Context<AdapterContextValue | null>;
30
- //# sourceMappingURL=AdapterContext.d.ts.map
36
+ declare const RuntimeContext: react0.Context<RuntimeContextValue | null>;
31
37
  //#endregion
32
38
  //#region src/hooks/AdapterProvider.d.ts
33
- interface AdapterProviderProps {
39
+
40
+ interface RuntimeProviderProps {
34
41
  children: ReactNode;
35
- /** Function to resolve/create an adapter instance for a given NetworkConfig. */
36
- resolveAdapter: (networkConfig: NetworkConfig) => Promise<ContractAdapter>;
42
+ /** Function to resolve/create a runtime instance for a given NetworkConfig. */
43
+ resolveRuntime: (networkConfig: NetworkConfig) => Promise<EcosystemRuntime>;
37
44
  }
38
45
  /**
39
- * Provider component that manages adapter instances centrally
40
- * to avoid creating multiple instances of the same adapter.
46
+ * Provider component that manages runtime instances centrally
47
+ * to avoid creating multiple instances of the same runtime.
41
48
  *
42
49
  * 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
50
+ * 1. Maintains a registry of runtime instances by network ID
51
+ * 2. Tracks loading states for runtimes being initialized
52
+ * 3. Provides a function to get or load runtimes for specific networks
53
+ * 4. Ensures runtime instances are reused when possible
47
54
  */
48
- declare function AdapterProvider({
55
+ declare function RuntimeProvider({
49
56
  children,
50
- resolveAdapter
51
- }: AdapterProviderProps): react_jsx_runtime0.JSX.Element;
52
- //# sourceMappingURL=AdapterProvider.d.ts.map
57
+ resolveRuntime
58
+ }: RuntimeProviderProps): react_jsx_runtime0.JSX.Element;
53
59
  //#endregion
54
60
  //#region src/hooks/WalletStateContext.d.ts
55
61
  interface WalletStateContextValue {
56
62
  activeNetworkId: string | null;
57
63
  setActiveNetworkId: (networkId: string | null) => void;
58
64
  activeNetworkConfig: NetworkConfig | null;
59
- activeAdapter: ContractAdapter | null;
60
- isAdapterLoading: boolean;
65
+ activeRuntime: EcosystemRuntime | null;
66
+ isRuntimeLoading: boolean;
61
67
  walletFacadeHooks: EcosystemSpecificReactHooks | null;
62
- reconfigureActiveAdapterUiKit: (uiKitConfig?: Partial<UiKitConfiguration>) => void;
68
+ reconfigureActiveUiKit: (uiKitConfig?: Partial<UiKitConfiguration>) => void;
63
69
  }
64
70
  declare const WalletStateContext: React.Context<WalletStateContextValue | undefined>;
65
71
  /**
@@ -67,7 +73,6 @@ declare const WalletStateContext: React.Context<WalletStateContextValue | undefi
67
73
  * @throws Error if used outside of WalletStateProvider
68
74
  */
69
75
  declare function useWalletState(): WalletStateContextValue;
70
- //# sourceMappingURL=WalletStateContext.d.ts.map
71
76
  //#endregion
72
77
  //#region src/hooks/WalletStateProvider.d.ts
73
78
  interface WalletStateProviderProps {
@@ -90,15 +95,16 @@ interface WalletStateProviderProps {
90
95
  * It is responsible for:
91
96
  * 1. Managing the globally selected active network ID (`activeNetworkId`).
92
97
  * 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
+ * 3. Fetching and providing the corresponding `EcosystemRuntime` (`activeRuntime`) for the active network,
99
+ * leveraging the `RuntimeProvider` to ensure runtime singletons.
100
+ * 4. Caching ecosystem-scoped wallet session artifacts (provider roots and facade hooks)
101
+ * independently from the network-scoped runtime.
102
+ * 5. Rendering the active ecosystem wallet provider (e.g., WagmiProvider for EVM) around its
103
+ * children, which is essential for the facade hooks to function correctly.
98
104
  * 6. Providing a function (`setActiveNetworkId`) to change the globally active network.
99
105
  *
100
106
  * Consumers use the `useWalletState()` hook to access this global state.
101
- * It should be placed high in the component tree, inside an `<AdapterProvider>`.
107
+ * It should be placed high in the component tree, inside a `<RuntimeProvider>`.
102
108
  */
103
109
  declare function WalletStateProvider({
104
110
  children,
@@ -106,7 +112,6 @@ declare function WalletStateProvider({
106
112
  getNetworkConfigById,
107
113
  loadConfigModule
108
114
  }: WalletStateProviderProps): react_jsx_runtime0.JSX.Element;
109
- //# sourceMappingURL=WalletStateProvider.d.ts.map
110
115
  //#endregion
111
116
  //#region src/hooks/AnalyticsContext.d.ts
112
117
  /**
@@ -157,13 +162,6 @@ interface AnalyticsContextValue {
157
162
  * Must be used within an AnalyticsProvider.
158
163
  */
159
164
  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
165
  //#endregion
168
166
  //#region src/hooks/AnalyticsProvider.d.ts
169
167
  /**
@@ -193,8 +191,6 @@ interface AnalyticsProviderProps {
193
191
  * ```
194
192
  */
195
193
  declare const AnalyticsProvider: React.FC<AnalyticsProviderProps>;
196
- //# sourceMappingURL=AnalyticsProvider.d.ts.map
197
-
198
194
  //#endregion
199
195
  //#region src/hooks/useAnalytics.d.ts
200
196
  /**
@@ -244,35 +240,32 @@ declare const AnalyticsProvider: React.FC<AnalyticsProviderProps>;
244
240
  * @throws Error if used outside of AnalyticsProvider
245
241
  */
246
242
  declare const useAnalytics: () => AnalyticsContextValue;
247
- //# sourceMappingURL=useAnalytics.d.ts.map
248
243
  //#endregion
249
244
  //#region src/hooks/useAdapterContext.d.ts
250
245
  /**
251
- * Hook to access the adapter context
246
+ * Hook to access the runtime context
252
247
  *
253
- * This hook provides access to the getAdapterForNetwork function which
254
- * retrieves or creates adapter instances from the singleton registry.
248
+ * This hook provides access to the `getRuntimeForNetwork` function which
249
+ * retrieves or creates runtime instances from the singleton registry.
255
250
  *
256
- * Components should typically use useConfiguredAdapterSingleton instead
251
+ * Components should typically use the higher-level wallet/runtime hooks instead
257
252
  * of this hook directly, as it handles React state update timing properly.
258
253
  *
259
- * @throws Error if used outside of an AdapterProvider context
260
- * @returns The adapter context value
254
+ * @throws Error if used outside of a RuntimeProvider context
255
+ * @returns The runtime context value
261
256
  */
262
- declare function useAdapterContext(): AdapterContextValue;
263
- //# sourceMappingURL=useAdapterContext.d.ts.map
264
-
257
+ declare function useRuntimeContext(): RuntimeContextValue;
265
258
  //#endregion
266
259
  //#region src/hooks/useWalletComponents.d.ts
267
260
  /**
268
- * Hook that provides direct access to wallet UI components from the active adapter.
261
+ * Hook that provides direct access to wallet UI components from the active runtime.
269
262
  *
270
263
  * Use this hook when you need full control over the layout and composition of
271
264
  * wallet components. For standard layouts, prefer using `WalletConnectionUI`
272
265
  * with its props forwarding capabilities.
273
266
  *
274
- * @returns The wallet components object, or null if no adapter is active or
275
- * the adapter doesn't provide wallet components.
267
+ * @returns The wallet components object, or null if no runtime is active or
268
+ * the runtime doesn't provide wallet components.
276
269
  *
277
270
  * @example
278
271
  * ```tsx
@@ -307,11 +300,14 @@ declare function useAdapterContext(): AdapterContextValue;
307
300
  * ```
308
301
  */
309
302
  declare function useWalletComponents(): EcosystemWalletComponents | null;
310
- //# sourceMappingURL=useWalletComponents.d.ts.map
311
303
  //#endregion
312
304
  //#region src/hooks/useDerivedAccountStatus.d.ts
313
305
  interface DerivedAccountStatus {
314
306
  isConnected: boolean;
307
+ isConnecting: boolean;
308
+ isDisconnected: boolean;
309
+ isReconnecting: boolean;
310
+ status: string;
315
311
  address?: string;
316
312
  chainId?: number;
317
313
  }
@@ -322,7 +318,6 @@ interface DerivedAccountStatus {
322
318
  * Provides default values if the hook or its properties are unavailable.
323
319
  */
324
320
  declare function useDerivedAccountStatus(): DerivedAccountStatus;
325
- //# sourceMappingURL=useDerivedAccountStatus.d.ts.map
326
321
  //#endregion
327
322
  //#region src/hooks/useDerivedSwitchChainStatus.d.ts
328
323
  interface DerivedSwitchChainStatus {
@@ -342,7 +337,6 @@ interface DerivedSwitchChainStatus {
342
337
  * Provides default values if the hook or its properties are unavailable.
343
338
  */
344
339
  declare function useDerivedSwitchChainStatus(): DerivedSwitchChainStatus;
345
- //# sourceMappingURL=useDerivedSwitchChainStatus.d.ts.map
346
340
  //#endregion
347
341
  //#region src/hooks/useDerivedChainInfo.d.ts
348
342
  interface DerivedChainInfo {
@@ -358,7 +352,6 @@ interface DerivedChainInfo {
358
352
  * Provides default values if the hooks or their properties are unavailable.
359
353
  */
360
354
  declare function useDerivedChainInfo(): DerivedChainInfo;
361
- //# sourceMappingURL=useDerivedChainInfo.d.ts.map
362
355
  //#endregion
363
356
  //#region src/hooks/useDerivedConnectStatus.d.ts
364
357
  interface DerivedConnectStatus {
@@ -381,7 +374,6 @@ interface DerivedConnectStatus {
381
374
  * safely-accessed status and control functions for wallet connection.
382
375
  */
383
376
  declare function useDerivedConnectStatus(): DerivedConnectStatus;
384
- //# sourceMappingURL=useDerivedConnectStatus.d.ts.map
385
377
  //#endregion
386
378
  //#region src/hooks/useDerivedDisconnect.d.ts
387
379
  interface DerivedDisconnectStatus {
@@ -398,7 +390,6 @@ interface DerivedDisconnectStatus {
398
390
  * safely-accessed status and control function for wallet disconnection.
399
391
  */
400
392
  declare function useDerivedDisconnect(): DerivedDisconnectStatus;
401
- //# sourceMappingURL=useDerivedDisconnect.d.ts.map
402
393
  //#endregion
403
394
  //#region src/hooks/useWalletReconnectionHandler.d.ts
404
395
  /**
@@ -409,12 +400,11 @@ declare function useDerivedDisconnect(): DerivedDisconnectStatus;
409
400
  * This hook detects that scenario and invokes a callback to re-queue the network switch.
410
401
  *
411
402
  * @param selectedNetworkConfigId - Currently selected network in the app
412
- * @param selectedAdapter - Currently active adapter instance
403
+ * @param selectedCapability - Currently active wallet capability instance
413
404
  * @param networkToSwitchTo - Current network switch queue state (null if no switch pending)
414
405
  * @param onRequeueSwitch - Callback invoked when a network switch should be re-queued
415
406
  */
416
- declare function useWalletReconnectionHandler(selectedNetworkConfigId: string | null, selectedAdapter: ContractAdapter | null, networkToSwitchTo: string | null, onRequeueSwitch: (networkId: string) => void): void;
417
- //# sourceMappingURL=useWalletReconnectionHandler.d.ts.map
407
+ declare function useWalletReconnectionHandler(selectedNetworkConfigId: string | null, selectedCapability: RuntimeCapability | null, networkToSwitchTo: string | null, onRequeueSwitch: (networkId: string) => void): void;
418
408
  //#endregion
419
409
  //#region src/components/WalletConnectionHeader.d.ts
420
410
  /**
@@ -422,7 +412,6 @@ declare function useWalletReconnectionHandler(selectedNetworkConfigId: string |
422
412
  * Uses useWalletState to get its data.
423
413
  */
424
414
  declare const WalletConnectionHeader: React.FC;
425
- //# sourceMappingURL=WalletConnectionHeader.d.ts.map
426
415
  //#endregion
427
416
  //#region src/components/WalletConnectionUI.d.ts
428
417
  /**
@@ -461,15 +450,16 @@ interface WalletConnectionUIProps {
461
450
  * ```
462
451
  */
463
452
  declare const WalletConnectionUI: React.FC<WalletConnectionUIProps>;
464
- //# sourceMappingURL=WalletConnectionUI.d.ts.map
465
453
  //#endregion
466
454
  //#region src/components/NetworkSwitchManager.d.ts
467
455
  /**
468
456
  * Props for the NetworkSwitchManager component.
469
457
  */
470
458
  interface NetworkSwitchManagerProps {
471
- /** The adapter instance for the target network */
472
- adapter: ContractAdapter;
459
+ /** Wallet capability for the target network */
460
+ wallet: WalletCapability;
461
+ /** Network catalog capability used to validate the target network id */
462
+ networkCatalog: NetworkCatalogCapability;
473
463
  /** The network ID we want to switch to */
474
464
  targetNetworkId: string;
475
465
  /** Callback when network switch completes (success or error) */
@@ -490,8 +480,6 @@ interface NetworkSwitchManagerProps {
490
480
  * - Provides completion callback for parent components to handle state cleanup
491
481
  */
492
482
  declare const NetworkSwitchManager: React.FC<NetworkSwitchManagerProps>;
493
- //# sourceMappingURL=NetworkSwitchManager.d.ts.map
494
-
495
483
  //#endregion
496
- 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, type WalletConnectionUIProps, WalletStateContext, type WalletStateContextValue, WalletStateProvider, type WalletStateProviderProps, useAdapterContext, useAnalytics, useDerivedAccountStatus, useDerivedChainInfo, useDerivedConnectStatus, useDerivedDisconnect, useDerivedSwitchChainStatus, useWalletComponents, useWalletReconnectionHandler, useWalletState };
497
- //# sourceMappingURL=index-Deip8V0M.d.ts.map
484
+ export { AnalyticsContext, type AnalyticsContextValue, AnalyticsProvider, type AnalyticsProviderProps, type DerivedAccountStatus, type DerivedChainInfo, type DerivedConnectStatus, type DerivedDisconnectStatus, type DerivedSwitchChainStatus, NetworkSwitchManager, type NetworkSwitchManagerProps, RuntimeContext, type RuntimeContextValue, RuntimeProvider, type RuntimeProviderProps, type RuntimeRegistry, VERSION, WalletConnectionHeader, WalletConnectionUI, type WalletConnectionUIProps, WalletStateContext, type WalletStateContextValue, WalletStateProvider, type WalletStateProviderProps, useAnalytics, useDerivedAccountStatus, useDerivedChainInfo, useDerivedConnectStatus, useDerivedDisconnect, useDerivedSwitchChainStatus, useRuntimeContext, useWalletComponents, useWalletReconnectionHandler, useWalletState };
485
+ //# sourceMappingURL=index.d.mts.map