@0xobelisk/react 1.2.0-pre.64

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.
@@ -0,0 +1,353 @@
1
+ import { SuiMoveNormalizedModules, Dubhe } from '@0xobelisk/sui-client';
2
+ import { DubheGraphqlClient } from '@0xobelisk/graphql-client';
3
+ import { DubheECSWorld } from '@0xobelisk/ecs';
4
+ import * as react_jsx_runtime from 'react/jsx-runtime';
5
+ import { ReactNode } from 'react';
6
+
7
+ /**
8
+ * Network type
9
+ */
10
+ type NetworkType = 'mainnet' | 'testnet' | 'devnet' | 'localnet';
11
+ /**
12
+ * Modern Dubhe client configuration for auto-initialization
13
+ */
14
+ interface DubheConfig {
15
+ /** Network type */
16
+ network: NetworkType;
17
+ /** Contract package ID */
18
+ packageId: string;
19
+ /** Dubhe Schema ID (optional, for enhanced features) */
20
+ dubheSchemaId: string;
21
+ /** Contract metadata (required for contract instantiation) */
22
+ metadata: SuiMoveNormalizedModules;
23
+ /** Dubhe metadata (enables GraphQL/ECS features) */
24
+ dubheMetadata?: any;
25
+ /** Authentication credentials */
26
+ credentials?: {
27
+ secretKey?: string;
28
+ mnemonics?: string;
29
+ };
30
+ /** Service endpoints configuration */
31
+ endpoints?: {
32
+ graphql?: string;
33
+ websocket?: string;
34
+ };
35
+ /** Performance and behavior options */
36
+ options?: {
37
+ /** Enable batch query optimization */
38
+ enableBatchOptimization?: boolean;
39
+ /** Default cache timeout (milliseconds) */
40
+ cacheTimeout?: number;
41
+ /** Request debounce delay (milliseconds) */
42
+ debounceMs?: number;
43
+ /** Auto-reconnect on WebSocket errors */
44
+ reconnectOnError?: boolean;
45
+ };
46
+ }
47
+ /**
48
+ * Return type for the main useDubhe hook
49
+ */
50
+ interface DubheReturn {
51
+ /** Dubhe contract instance with enhanced methods */
52
+ contract: Dubhe & {
53
+ /** Enhanced transaction methods with options */
54
+ txWithOptions?: (system: string, method: string, options?: any) => (params: any) => Promise<any>;
55
+ /** Enhanced query methods with options */
56
+ queryWithOptions?: (system: string, method: string, options?: any) => (params: any) => Promise<any>;
57
+ };
58
+ /** GraphQL client (null if dubheMetadata not provided) */
59
+ graphqlClient: DubheGraphqlClient | null;
60
+ /** ECS World instance (null if GraphQL not available) */
61
+ ecsWorld: DubheECSWorld | null;
62
+ /** Contract metadata */
63
+ metadata: SuiMoveNormalizedModules;
64
+ /** Network type */
65
+ network: NetworkType;
66
+ /** Package ID */
67
+ packageId: string;
68
+ /** Dubhe Schema ID (if provided) */
69
+ dubheSchemaId?: string;
70
+ /** User address */
71
+ address: string;
72
+ /** Configuration options used */
73
+ options?: {
74
+ enableBatchOptimization?: boolean;
75
+ cacheTimeout?: number;
76
+ debounceMs?: number;
77
+ reconnectOnError?: boolean;
78
+ };
79
+ /** Performance metrics */
80
+ metrics?: {
81
+ initTime?: number;
82
+ requestCount?: number;
83
+ lastActivity?: number;
84
+ };
85
+ }
86
+ /**
87
+ * Compatibility alias for DubheReturn
88
+ * @deprecated Use DubheReturn instead for better consistency
89
+ */
90
+ type ContractReturn = DubheReturn;
91
+
92
+ /**
93
+ * Configuration Management for Dubhe React Integration
94
+ *
95
+ * Features:
96
+ * - Type-safe configuration interface
97
+ * - Configuration validation and error handling
98
+ * - Smart merging of defaults and explicit config
99
+ * - No environment variable handling (developers should handle environment variables themselves)
100
+ */
101
+
102
+ /**
103
+ * Default configuration object with sensible defaults
104
+ */
105
+ declare const DEFAULT_CONFIG: Partial<DubheConfig>;
106
+ /**
107
+ * Configuration Hook: useDubheConfig
108
+ *
109
+ * Merges defaults with explicit configuration provided by the developer
110
+ *
111
+ * Note: Environment variables should be handled by the developer before passing to this hook
112
+ *
113
+ * @param config - Complete or partial configuration object
114
+ * @returns Complete, validated DubheConfig
115
+ *
116
+ * @example
117
+ * ```typescript
118
+ * // Basic usage with explicit config
119
+ * const config = useDubheConfig({
120
+ * network: 'testnet',
121
+ * packageId: '0x123...',
122
+ * metadata: contractMetadata,
123
+ * credentials: {
124
+ * secretKey: process.env.NEXT_PUBLIC_PRIVATE_KEY // Handle env vars yourself
125
+ * }
126
+ * });
127
+ *
128
+ * // With helper function to handle environment variables
129
+ * const getConfigFromEnv = () => ({
130
+ * network: process.env.NEXT_PUBLIC_NETWORK as NetworkType,
131
+ * packageId: process.env.NEXT_PUBLIC_PACKAGE_ID,
132
+ * credentials: {
133
+ * secretKey: process.env.NEXT_PUBLIC_PRIVATE_KEY
134
+ * }
135
+ * });
136
+ *
137
+ * const config = useDubheConfig({
138
+ * ...getConfigFromEnv(),
139
+ * metadata: contractMetadata
140
+ * });
141
+ * ```
142
+ */
143
+ declare function useDubheConfig(config: Partial<DubheConfig>): DubheConfig;
144
+
145
+ /**
146
+ * Utility Functions for Dubhe Configuration Management
147
+ *
148
+ * Features:
149
+ * - Configuration validation and error handling
150
+ * - Smart configuration merging with proper type safety
151
+ * - Type-safe configuration validation
152
+ */
153
+
154
+ /**
155
+ * Merge multiple configuration objects with proper deep merging
156
+ * Later configurations override earlier ones
157
+ *
158
+ * @param baseConfig - Base configuration (usually defaults)
159
+ * @param overrideConfig - Override configuration (user provided)
160
+ * @returns Merged configuration
161
+ */
162
+ declare function mergeConfigurations(baseConfig: Partial<DubheConfig>, overrideConfig?: Partial<DubheConfig>): Partial<DubheConfig>;
163
+ /**
164
+ * Validate configuration and ensure required fields are present
165
+ * Throws descriptive errors for missing required fields
166
+ *
167
+ * @param config - Configuration to validate
168
+ * @returns Validated and typed configuration
169
+ * @throws Error if required fields are missing or invalid
170
+ */
171
+ declare function validateConfig(config: Partial<DubheConfig>): DubheConfig;
172
+ /**
173
+ * Generate a configuration summary for debugging
174
+ * Hides sensitive information like private keys
175
+ *
176
+ * @param config - Configuration to summarize
177
+ * @returns Safe configuration summary
178
+ */
179
+ declare function getConfigSummary(config: DubheConfig): object;
180
+
181
+ /**
182
+ * Props interface for DubheProvider component
183
+ */
184
+ interface DubheProviderProps {
185
+ /** Configuration for Dubhe initialization */
186
+ config: Partial<DubheConfig>;
187
+ /** Child components that will have access to Dubhe clients */
188
+ children: ReactNode;
189
+ }
190
+ /**
191
+ * DubheProvider Component - useRef Pattern Implementation
192
+ *
193
+ * This Provider uses useRef to store client instances, ensuring they are:
194
+ * 1. Created only once during component lifecycle
195
+ * 2. Persisted across re-renders without re-initialization
196
+ * 3. Shared efficiently via React Context
197
+ *
198
+ * Key advantages over useMemo:
199
+ * - useRef guarantees single initialization (useMemo can re-run on dependency changes)
200
+ * - No dependency array needed (eliminates potential re-initialization bugs)
201
+ * - Better performance for heavy client objects
202
+ * - Clearer separation of concerns via Provider pattern
203
+ *
204
+ * @param props - Provider props containing config and children
205
+ * @returns Provider component wrapping children with Dubhe context
206
+ *
207
+ * @example
208
+ * ```typescript
209
+ * // App root setup
210
+ * function App() {
211
+ * const dubheConfig = {
212
+ * network: 'devnet',
213
+ * packageId: '0x123...',
214
+ * metadata: contractMetadata,
215
+ * credentials: {
216
+ * secretKey: process.env.NEXT_PUBLIC_PRIVATE_KEY
217
+ * }
218
+ * };
219
+ *
220
+ * return (
221
+ * <DubheProvider config={dubheConfig}>
222
+ * <MyApplication />
223
+ * </DubheProvider>
224
+ * );
225
+ * }
226
+ * ```
227
+ */
228
+ declare function DubheProvider({ config, children }: DubheProviderProps): react_jsx_runtime.JSX.Element;
229
+
230
+ /**
231
+ * Modern Dubhe React Hooks - Provider Pattern
232
+ *
233
+ * Features:
234
+ * - 🎯 Simple API design with Provider pattern
235
+ * - ⚡ Single client initialization with useRef
236
+ * - 🔧 Configuration-driven setup (developers handle environment variables themselves)
237
+ * - 🛡️ Complete type safety with strict TypeScript
238
+ * - 📦 Context-based client sharing across components
239
+ */
240
+
241
+ /**
242
+ * Primary Hook: useDubhe
243
+ *
244
+ * Uses Provider pattern to access shared Dubhe clients with guaranteed single initialization.
245
+ * Must be used within a DubheProvider.
246
+ *
247
+ * @returns Complete Dubhe ecosystem with contract, GraphQL, ECS, and metadata
248
+ *
249
+ * @example
250
+ * ```typescript
251
+ * // App setup with Provider
252
+ * function App() {
253
+ * const config = {
254
+ * network: 'devnet',
255
+ * packageId: '0x123...',
256
+ * metadata: contractMetadata,
257
+ * credentials: {
258
+ * secretKey: process.env.NEXT_PUBLIC_PRIVATE_KEY
259
+ * }
260
+ * };
261
+ *
262
+ * return (
263
+ * <DubheProvider config={config}>
264
+ * <MyDApp />
265
+ * </DubheProvider>
266
+ * );
267
+ * }
268
+ *
269
+ * // Component usage
270
+ * function MyDApp() {
271
+ * const { contract, address } = useDubhe();
272
+ * return <div>Connected as {address}</div>;
273
+ * }
274
+ * ```
275
+ */
276
+ declare function useDubhe(): DubheReturn;
277
+ /**
278
+ * Individual Instance Hook: useDubheContract
279
+ *
280
+ * Returns only the Dubhe contract instance from Provider context.
281
+ * More efficient than useDubhe() when only contract access is needed.
282
+ *
283
+ * @returns Dubhe contract instance
284
+ *
285
+ * @example
286
+ * ```typescript
287
+ * function TransactionComponent() {
288
+ * const contract = useDubheContract();
289
+ *
290
+ * const handleTransaction = async () => {
291
+ * const tx = new Transaction();
292
+ * await contract.tx.my_system.my_method({ tx });
293
+ * };
294
+ *
295
+ * return <button onClick={handleTransaction}>Execute</button>;
296
+ * }
297
+ * ```
298
+ */
299
+ declare function useDubheContract(): Dubhe;
300
+ /**
301
+ * Individual Instance Hook: useDubheGraphQL
302
+ *
303
+ * Returns only the GraphQL client from Provider context.
304
+ * More efficient than useDubhe() when only GraphQL access is needed.
305
+ *
306
+ * @returns GraphQL client instance (null if dubheMetadata not provided)
307
+ *
308
+ * @example
309
+ * ```typescript
310
+ * function DataComponent() {
311
+ * const graphqlClient = useDubheGraphQL();
312
+ *
313
+ * useEffect(() => {
314
+ * if (graphqlClient) {
315
+ * graphqlClient.query({ ... }).then(setData);
316
+ * }
317
+ * }, [graphqlClient]);
318
+ *
319
+ * return <div>{data && JSON.stringify(data)}</div>;
320
+ * }
321
+ * ```
322
+ */
323
+ declare function useDubheGraphQL(): any | null;
324
+ /**
325
+ * Individual Instance Hook: useDubheECS
326
+ *
327
+ * Returns only the ECS World instance from Provider context.
328
+ * More efficient than useDubhe() when only ECS access is needed.
329
+ *
330
+ * @returns ECS World instance (null if GraphQL client not available)
331
+ *
332
+ * @example
333
+ * ```typescript
334
+ * function ECSComponent() {
335
+ * const ecsWorld = useDubheECS();
336
+ *
337
+ * useEffect(() => {
338
+ * if (ecsWorld) {
339
+ * ecsWorld.getComponent('MyComponent').then(setComponent);
340
+ * }
341
+ * }, [ecsWorld]);
342
+ *
343
+ * return <div>ECS Component Data</div>;
344
+ * }
345
+ * ```
346
+ */
347
+ declare function useDubheECS(): any | null;
348
+ /**
349
+ * Compatibility alias for useDubhe
350
+ */
351
+ declare const useContract: typeof useDubhe;
352
+
353
+ export { type ContractReturn, DEFAULT_CONFIG, type DubheConfig, DubheProvider, type DubheReturn, type NetworkType, getConfigSummary, mergeConfigurations, useContract, useDubhe, useDubheConfig, useDubheContract, useDubheECS, useDubheGraphQL, validateConfig };
@@ -0,0 +1,353 @@
1
+ import { SuiMoveNormalizedModules, Dubhe } from '@0xobelisk/sui-client';
2
+ import { DubheGraphqlClient } from '@0xobelisk/graphql-client';
3
+ import { DubheECSWorld } from '@0xobelisk/ecs';
4
+ import * as react_jsx_runtime from 'react/jsx-runtime';
5
+ import { ReactNode } from 'react';
6
+
7
+ /**
8
+ * Network type
9
+ */
10
+ type NetworkType = 'mainnet' | 'testnet' | 'devnet' | 'localnet';
11
+ /**
12
+ * Modern Dubhe client configuration for auto-initialization
13
+ */
14
+ interface DubheConfig {
15
+ /** Network type */
16
+ network: NetworkType;
17
+ /** Contract package ID */
18
+ packageId: string;
19
+ /** Dubhe Schema ID (optional, for enhanced features) */
20
+ dubheSchemaId: string;
21
+ /** Contract metadata (required for contract instantiation) */
22
+ metadata: SuiMoveNormalizedModules;
23
+ /** Dubhe metadata (enables GraphQL/ECS features) */
24
+ dubheMetadata?: any;
25
+ /** Authentication credentials */
26
+ credentials?: {
27
+ secretKey?: string;
28
+ mnemonics?: string;
29
+ };
30
+ /** Service endpoints configuration */
31
+ endpoints?: {
32
+ graphql?: string;
33
+ websocket?: string;
34
+ };
35
+ /** Performance and behavior options */
36
+ options?: {
37
+ /** Enable batch query optimization */
38
+ enableBatchOptimization?: boolean;
39
+ /** Default cache timeout (milliseconds) */
40
+ cacheTimeout?: number;
41
+ /** Request debounce delay (milliseconds) */
42
+ debounceMs?: number;
43
+ /** Auto-reconnect on WebSocket errors */
44
+ reconnectOnError?: boolean;
45
+ };
46
+ }
47
+ /**
48
+ * Return type for the main useDubhe hook
49
+ */
50
+ interface DubheReturn {
51
+ /** Dubhe contract instance with enhanced methods */
52
+ contract: Dubhe & {
53
+ /** Enhanced transaction methods with options */
54
+ txWithOptions?: (system: string, method: string, options?: any) => (params: any) => Promise<any>;
55
+ /** Enhanced query methods with options */
56
+ queryWithOptions?: (system: string, method: string, options?: any) => (params: any) => Promise<any>;
57
+ };
58
+ /** GraphQL client (null if dubheMetadata not provided) */
59
+ graphqlClient: DubheGraphqlClient | null;
60
+ /** ECS World instance (null if GraphQL not available) */
61
+ ecsWorld: DubheECSWorld | null;
62
+ /** Contract metadata */
63
+ metadata: SuiMoveNormalizedModules;
64
+ /** Network type */
65
+ network: NetworkType;
66
+ /** Package ID */
67
+ packageId: string;
68
+ /** Dubhe Schema ID (if provided) */
69
+ dubheSchemaId?: string;
70
+ /** User address */
71
+ address: string;
72
+ /** Configuration options used */
73
+ options?: {
74
+ enableBatchOptimization?: boolean;
75
+ cacheTimeout?: number;
76
+ debounceMs?: number;
77
+ reconnectOnError?: boolean;
78
+ };
79
+ /** Performance metrics */
80
+ metrics?: {
81
+ initTime?: number;
82
+ requestCount?: number;
83
+ lastActivity?: number;
84
+ };
85
+ }
86
+ /**
87
+ * Compatibility alias for DubheReturn
88
+ * @deprecated Use DubheReturn instead for better consistency
89
+ */
90
+ type ContractReturn = DubheReturn;
91
+
92
+ /**
93
+ * Configuration Management for Dubhe React Integration
94
+ *
95
+ * Features:
96
+ * - Type-safe configuration interface
97
+ * - Configuration validation and error handling
98
+ * - Smart merging of defaults and explicit config
99
+ * - No environment variable handling (developers should handle environment variables themselves)
100
+ */
101
+
102
+ /**
103
+ * Default configuration object with sensible defaults
104
+ */
105
+ declare const DEFAULT_CONFIG: Partial<DubheConfig>;
106
+ /**
107
+ * Configuration Hook: useDubheConfig
108
+ *
109
+ * Merges defaults with explicit configuration provided by the developer
110
+ *
111
+ * Note: Environment variables should be handled by the developer before passing to this hook
112
+ *
113
+ * @param config - Complete or partial configuration object
114
+ * @returns Complete, validated DubheConfig
115
+ *
116
+ * @example
117
+ * ```typescript
118
+ * // Basic usage with explicit config
119
+ * const config = useDubheConfig({
120
+ * network: 'testnet',
121
+ * packageId: '0x123...',
122
+ * metadata: contractMetadata,
123
+ * credentials: {
124
+ * secretKey: process.env.NEXT_PUBLIC_PRIVATE_KEY // Handle env vars yourself
125
+ * }
126
+ * });
127
+ *
128
+ * // With helper function to handle environment variables
129
+ * const getConfigFromEnv = () => ({
130
+ * network: process.env.NEXT_PUBLIC_NETWORK as NetworkType,
131
+ * packageId: process.env.NEXT_PUBLIC_PACKAGE_ID,
132
+ * credentials: {
133
+ * secretKey: process.env.NEXT_PUBLIC_PRIVATE_KEY
134
+ * }
135
+ * });
136
+ *
137
+ * const config = useDubheConfig({
138
+ * ...getConfigFromEnv(),
139
+ * metadata: contractMetadata
140
+ * });
141
+ * ```
142
+ */
143
+ declare function useDubheConfig(config: Partial<DubheConfig>): DubheConfig;
144
+
145
+ /**
146
+ * Utility Functions for Dubhe Configuration Management
147
+ *
148
+ * Features:
149
+ * - Configuration validation and error handling
150
+ * - Smart configuration merging with proper type safety
151
+ * - Type-safe configuration validation
152
+ */
153
+
154
+ /**
155
+ * Merge multiple configuration objects with proper deep merging
156
+ * Later configurations override earlier ones
157
+ *
158
+ * @param baseConfig - Base configuration (usually defaults)
159
+ * @param overrideConfig - Override configuration (user provided)
160
+ * @returns Merged configuration
161
+ */
162
+ declare function mergeConfigurations(baseConfig: Partial<DubheConfig>, overrideConfig?: Partial<DubheConfig>): Partial<DubheConfig>;
163
+ /**
164
+ * Validate configuration and ensure required fields are present
165
+ * Throws descriptive errors for missing required fields
166
+ *
167
+ * @param config - Configuration to validate
168
+ * @returns Validated and typed configuration
169
+ * @throws Error if required fields are missing or invalid
170
+ */
171
+ declare function validateConfig(config: Partial<DubheConfig>): DubheConfig;
172
+ /**
173
+ * Generate a configuration summary for debugging
174
+ * Hides sensitive information like private keys
175
+ *
176
+ * @param config - Configuration to summarize
177
+ * @returns Safe configuration summary
178
+ */
179
+ declare function getConfigSummary(config: DubheConfig): object;
180
+
181
+ /**
182
+ * Props interface for DubheProvider component
183
+ */
184
+ interface DubheProviderProps {
185
+ /** Configuration for Dubhe initialization */
186
+ config: Partial<DubheConfig>;
187
+ /** Child components that will have access to Dubhe clients */
188
+ children: ReactNode;
189
+ }
190
+ /**
191
+ * DubheProvider Component - useRef Pattern Implementation
192
+ *
193
+ * This Provider uses useRef to store client instances, ensuring they are:
194
+ * 1. Created only once during component lifecycle
195
+ * 2. Persisted across re-renders without re-initialization
196
+ * 3. Shared efficiently via React Context
197
+ *
198
+ * Key advantages over useMemo:
199
+ * - useRef guarantees single initialization (useMemo can re-run on dependency changes)
200
+ * - No dependency array needed (eliminates potential re-initialization bugs)
201
+ * - Better performance for heavy client objects
202
+ * - Clearer separation of concerns via Provider pattern
203
+ *
204
+ * @param props - Provider props containing config and children
205
+ * @returns Provider component wrapping children with Dubhe context
206
+ *
207
+ * @example
208
+ * ```typescript
209
+ * // App root setup
210
+ * function App() {
211
+ * const dubheConfig = {
212
+ * network: 'devnet',
213
+ * packageId: '0x123...',
214
+ * metadata: contractMetadata,
215
+ * credentials: {
216
+ * secretKey: process.env.NEXT_PUBLIC_PRIVATE_KEY
217
+ * }
218
+ * };
219
+ *
220
+ * return (
221
+ * <DubheProvider config={dubheConfig}>
222
+ * <MyApplication />
223
+ * </DubheProvider>
224
+ * );
225
+ * }
226
+ * ```
227
+ */
228
+ declare function DubheProvider({ config, children }: DubheProviderProps): react_jsx_runtime.JSX.Element;
229
+
230
+ /**
231
+ * Modern Dubhe React Hooks - Provider Pattern
232
+ *
233
+ * Features:
234
+ * - 🎯 Simple API design with Provider pattern
235
+ * - ⚡ Single client initialization with useRef
236
+ * - 🔧 Configuration-driven setup (developers handle environment variables themselves)
237
+ * - 🛡️ Complete type safety with strict TypeScript
238
+ * - 📦 Context-based client sharing across components
239
+ */
240
+
241
+ /**
242
+ * Primary Hook: useDubhe
243
+ *
244
+ * Uses Provider pattern to access shared Dubhe clients with guaranteed single initialization.
245
+ * Must be used within a DubheProvider.
246
+ *
247
+ * @returns Complete Dubhe ecosystem with contract, GraphQL, ECS, and metadata
248
+ *
249
+ * @example
250
+ * ```typescript
251
+ * // App setup with Provider
252
+ * function App() {
253
+ * const config = {
254
+ * network: 'devnet',
255
+ * packageId: '0x123...',
256
+ * metadata: contractMetadata,
257
+ * credentials: {
258
+ * secretKey: process.env.NEXT_PUBLIC_PRIVATE_KEY
259
+ * }
260
+ * };
261
+ *
262
+ * return (
263
+ * <DubheProvider config={config}>
264
+ * <MyDApp />
265
+ * </DubheProvider>
266
+ * );
267
+ * }
268
+ *
269
+ * // Component usage
270
+ * function MyDApp() {
271
+ * const { contract, address } = useDubhe();
272
+ * return <div>Connected as {address}</div>;
273
+ * }
274
+ * ```
275
+ */
276
+ declare function useDubhe(): DubheReturn;
277
+ /**
278
+ * Individual Instance Hook: useDubheContract
279
+ *
280
+ * Returns only the Dubhe contract instance from Provider context.
281
+ * More efficient than useDubhe() when only contract access is needed.
282
+ *
283
+ * @returns Dubhe contract instance
284
+ *
285
+ * @example
286
+ * ```typescript
287
+ * function TransactionComponent() {
288
+ * const contract = useDubheContract();
289
+ *
290
+ * const handleTransaction = async () => {
291
+ * const tx = new Transaction();
292
+ * await contract.tx.my_system.my_method({ tx });
293
+ * };
294
+ *
295
+ * return <button onClick={handleTransaction}>Execute</button>;
296
+ * }
297
+ * ```
298
+ */
299
+ declare function useDubheContract(): Dubhe;
300
+ /**
301
+ * Individual Instance Hook: useDubheGraphQL
302
+ *
303
+ * Returns only the GraphQL client from Provider context.
304
+ * More efficient than useDubhe() when only GraphQL access is needed.
305
+ *
306
+ * @returns GraphQL client instance (null if dubheMetadata not provided)
307
+ *
308
+ * @example
309
+ * ```typescript
310
+ * function DataComponent() {
311
+ * const graphqlClient = useDubheGraphQL();
312
+ *
313
+ * useEffect(() => {
314
+ * if (graphqlClient) {
315
+ * graphqlClient.query({ ... }).then(setData);
316
+ * }
317
+ * }, [graphqlClient]);
318
+ *
319
+ * return <div>{data && JSON.stringify(data)}</div>;
320
+ * }
321
+ * ```
322
+ */
323
+ declare function useDubheGraphQL(): any | null;
324
+ /**
325
+ * Individual Instance Hook: useDubheECS
326
+ *
327
+ * Returns only the ECS World instance from Provider context.
328
+ * More efficient than useDubhe() when only ECS access is needed.
329
+ *
330
+ * @returns ECS World instance (null if GraphQL client not available)
331
+ *
332
+ * @example
333
+ * ```typescript
334
+ * function ECSComponent() {
335
+ * const ecsWorld = useDubheECS();
336
+ *
337
+ * useEffect(() => {
338
+ * if (ecsWorld) {
339
+ * ecsWorld.getComponent('MyComponent').then(setComponent);
340
+ * }
341
+ * }, [ecsWorld]);
342
+ *
343
+ * return <div>ECS Component Data</div>;
344
+ * }
345
+ * ```
346
+ */
347
+ declare function useDubheECS(): any | null;
348
+ /**
349
+ * Compatibility alias for useDubhe
350
+ */
351
+ declare const useContract: typeof useDubhe;
352
+
353
+ export { type ContractReturn, DEFAULT_CONFIG, type DubheConfig, DubheProvider, type DubheReturn, type NetworkType, getConfigSummary, mergeConfigurations, useContract, useDubhe, useDubheConfig, useDubheContract, useDubheECS, useDubheGraphQL, validateConfig };