@openzeppelin/ui-renderer 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 +224 -0
- package/dist/index-CrGita0t.d.ts +344 -0
- package/dist/index-CrGita0t.d.ts.map +1 -0
- package/dist/index-DMBaQjZf.d.cts +344 -0
- package/dist/index-DMBaQjZf.d.cts.map +1 -0
- package/dist/index.cjs +2101 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +344 -0
- package/dist/index.d.ts +344 -0
- package/dist/index.js +2052 -0
- package/dist/index.js.map +1 -0
- package/package.json +94 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
import { ContractAdapter, ContractFunction, ContractSchema, ExecutionConfig, FieldTransforms, FieldType, FormFieldType, FormValues, FullContractAdapter, NetworkConfig, TransactionFormProps } from "@openzeppelin/ui-types";
|
|
2
|
+
import React$1, { JSX } from "react";
|
|
3
|
+
import { Control } from "react-hook-form";
|
|
4
|
+
import { ButtonProps } from "@openzeppelin/ui-components";
|
|
5
|
+
|
|
6
|
+
//#region src/types/RendererConfig.d.ts
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Types related to renderer configuration
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Configuration for the renderer package
|
|
13
|
+
* This interface defines dependencies and settings for the renderer
|
|
14
|
+
* that will be used when exporting form projects.
|
|
15
|
+
*/
|
|
16
|
+
interface RendererConfig {
|
|
17
|
+
/**
|
|
18
|
+
* Core dependencies required for all renderer projects
|
|
19
|
+
*/
|
|
20
|
+
coreDependencies: Record<string, string>;
|
|
21
|
+
/**
|
|
22
|
+
* Field-specific dependencies required for different field types
|
|
23
|
+
*/
|
|
24
|
+
fieldDependencies: Record<string, {
|
|
25
|
+
/**
|
|
26
|
+
* Runtime dependencies needed for the field type
|
|
27
|
+
*/
|
|
28
|
+
runtimeDependencies: Record<string, string>;
|
|
29
|
+
/**
|
|
30
|
+
* Development dependencies needed for the field type
|
|
31
|
+
*/
|
|
32
|
+
devDependencies?: Record<string, string>;
|
|
33
|
+
}>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Dependencies for a specific field type
|
|
37
|
+
*/
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/components/TransactionForm.d.ts
|
|
40
|
+
/**
|
|
41
|
+
* Transaction Form Component
|
|
42
|
+
*
|
|
43
|
+
* This is the main entry point for the app rendering system. It represents the top level of
|
|
44
|
+
* the app rendering architecture:
|
|
45
|
+
*
|
|
46
|
+
* 1. TransactionForm receives a schema and adapter from the transaction builder app
|
|
47
|
+
* 2. It sets up React Hook Form for state management and validation
|
|
48
|
+
* 3. It renders fields dynamically using the DynamicFormField component
|
|
49
|
+
* 4. Provides wallet connection UI (demo implementation)
|
|
50
|
+
* 5. On submission, it processes data through the adapter before passing to handlers
|
|
51
|
+
*
|
|
52
|
+
* Note: The previewMode prop is currently used only for demo purposes and does not affect
|
|
53
|
+
* the visibility of wallet connection or transaction execution UI. In the future, it will be used
|
|
54
|
+
* to enable/disable actual blockchain interactions without changing the UI structure.
|
|
55
|
+
*
|
|
56
|
+
* @returns The rendered form component
|
|
57
|
+
*/
|
|
58
|
+
declare function TransactionForm({
|
|
59
|
+
schema,
|
|
60
|
+
contractSchema,
|
|
61
|
+
adapter,
|
|
62
|
+
isWalletConnected,
|
|
63
|
+
executionConfig
|
|
64
|
+
}: TransactionFormProps): React.ReactElement;
|
|
65
|
+
//# sourceMappingURL=TransactionForm.d.ts.map
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/utils/formUtils.d.ts
|
|
68
|
+
/**
|
|
69
|
+
* Parameter constraints for validation and default value generation
|
|
70
|
+
*/
|
|
71
|
+
interface ParameterConstraints {
|
|
72
|
+
required?: boolean;
|
|
73
|
+
min?: number;
|
|
74
|
+
max?: number;
|
|
75
|
+
minLength?: number;
|
|
76
|
+
maxLength?: number;
|
|
77
|
+
pattern?: string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Validate a field value against validation rules
|
|
81
|
+
*/
|
|
82
|
+
declare function validateField(value: unknown, validation?: {
|
|
83
|
+
required?: boolean;
|
|
84
|
+
min?: number;
|
|
85
|
+
max?: number;
|
|
86
|
+
pattern?: string;
|
|
87
|
+
}): string | null;
|
|
88
|
+
/**
|
|
89
|
+
* Creates a transform for address fields
|
|
90
|
+
*
|
|
91
|
+
* @param adapter The blockchain adapter to use for validation
|
|
92
|
+
* @returns Transform functions for address fields
|
|
93
|
+
*/
|
|
94
|
+
declare function createAddressTransform(adapter: ContractAdapter): FieldTransforms<string>;
|
|
95
|
+
/**
|
|
96
|
+
* Creates a transform for number fields
|
|
97
|
+
*
|
|
98
|
+
* @returns Transform functions for number fields
|
|
99
|
+
*/
|
|
100
|
+
declare function createNumberTransform(): FieldTransforms<number>;
|
|
101
|
+
/**
|
|
102
|
+
* Creates a transform for bigint fields (large integers beyond JS Number precision)
|
|
103
|
+
*
|
|
104
|
+
* @returns Transform functions for bigint fields
|
|
105
|
+
*/
|
|
106
|
+
declare function createBigIntTransform(): FieldTransforms<string>;
|
|
107
|
+
/**
|
|
108
|
+
* Creates a transform for boolean fields
|
|
109
|
+
*
|
|
110
|
+
* @returns Transform functions for boolean fields
|
|
111
|
+
*/
|
|
112
|
+
declare function createBooleanTransform(): FieldTransforms<boolean>;
|
|
113
|
+
/**
|
|
114
|
+
* Creates a transform for complex type fields (arrays, objects, etc.)
|
|
115
|
+
*
|
|
116
|
+
* @returns Transform functions for complex fields
|
|
117
|
+
*/
|
|
118
|
+
declare function createComplexTypeTransform(): FieldTransforms<unknown>;
|
|
119
|
+
/**
|
|
120
|
+
* Creates a transform for text fields
|
|
121
|
+
*
|
|
122
|
+
* @returns Transform functions for text-based fields
|
|
123
|
+
*/
|
|
124
|
+
declare function createTextTransform(): FieldTransforms<string>;
|
|
125
|
+
/**
|
|
126
|
+
* Creates a transform function based on field type
|
|
127
|
+
*
|
|
128
|
+
* @param fieldType The type of field to create transforms for
|
|
129
|
+
* @param adapter Optional adapter for address validation
|
|
130
|
+
* @returns Transform functions for the field type
|
|
131
|
+
*/
|
|
132
|
+
declare function createTransformForFieldType(fieldType: FieldType, adapter?: ContractAdapter): FieldTransforms<unknown>;
|
|
133
|
+
/**
|
|
134
|
+
* Generate a default value for a given field type based on parameter constraints
|
|
135
|
+
*/
|
|
136
|
+
declare function generateDefaultValue(parameterType: string, constraints?: Partial<ParameterConstraints>): unknown;
|
|
137
|
+
/**
|
|
138
|
+
* Returns the appropriate default value based on field type
|
|
139
|
+
*/
|
|
140
|
+
declare function getDefaultValueByFieldType(fieldType: FieldType): string | boolean | number;
|
|
141
|
+
/**
|
|
142
|
+
* Creates a complete default values object for form initialization
|
|
143
|
+
* Ensures all fields have appropriate default values to avoid React controlled/uncontrolled input warnings
|
|
144
|
+
*
|
|
145
|
+
* @param fields The form field definitions
|
|
146
|
+
* @param existingDefaults Any existing default values to preserve
|
|
147
|
+
* @returns A complete form values object with no undefined values
|
|
148
|
+
*/
|
|
149
|
+
declare function createDefaultFormValues(fields: FormFieldType[] | undefined, existingDefaults?: Record<string, unknown>): FormValues;
|
|
150
|
+
/**
|
|
151
|
+
* Creates a transform for array fields
|
|
152
|
+
*
|
|
153
|
+
* @returns Transform functions for array fields
|
|
154
|
+
*/
|
|
155
|
+
declare function createArrayTransform(): FieldTransforms<unknown[]>;
|
|
156
|
+
/**
|
|
157
|
+
* Creates a transform for object fields
|
|
158
|
+
*
|
|
159
|
+
* @returns Transform functions for object fields
|
|
160
|
+
*/
|
|
161
|
+
declare function createObjectTransform(): FieldTransforms<Record<string, unknown>>;
|
|
162
|
+
/**
|
|
163
|
+
* Creates a transform for array-object fields
|
|
164
|
+
*
|
|
165
|
+
* @returns Transform functions for array-object fields
|
|
166
|
+
*/
|
|
167
|
+
declare function createArrayObjectTransform(): FieldTransforms<Record<string, unknown>[]>;
|
|
168
|
+
//# sourceMappingURL=formUtils.d.ts.map
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region src/components/DynamicFormField.d.ts
|
|
171
|
+
/**
|
|
172
|
+
* Props for the DynamicFormField component
|
|
173
|
+
*/
|
|
174
|
+
interface DynamicFormFieldProps {
|
|
175
|
+
/**
|
|
176
|
+
* The field configuration to render
|
|
177
|
+
*/
|
|
178
|
+
field: FormFieldType;
|
|
179
|
+
/**
|
|
180
|
+
* The React Hook Form control
|
|
181
|
+
*/
|
|
182
|
+
control: Control<FormValues>;
|
|
183
|
+
/**
|
|
184
|
+
* The adapter for chain-specific validation and formatting
|
|
185
|
+
*/
|
|
186
|
+
adapter: ContractAdapter;
|
|
187
|
+
/**
|
|
188
|
+
* Optional contract schema for nested metadata lookups
|
|
189
|
+
*/
|
|
190
|
+
contractSchema?: ContractSchema;
|
|
191
|
+
/**
|
|
192
|
+
* The field error message, if any (Kept for potential direct use, though RHF handles it)
|
|
193
|
+
*/
|
|
194
|
+
error?: string;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Dynamic Form Field Component
|
|
198
|
+
*
|
|
199
|
+
* Renders the appropriate field component based on the field type defined in the form schema.
|
|
200
|
+
* This component is part of the app rendering system architecture where:
|
|
201
|
+
* 1. Form schemas are generated from contract functions using adapters
|
|
202
|
+
* 2. The schemas are rendered using the TransactionForm component
|
|
203
|
+
* 3. TransactionForm uses DynamicFormField to render appropriate field components based on the schema
|
|
204
|
+
*
|
|
205
|
+
* The field components (TextField, NumberField, AddressField, etc.) are specifically designed
|
|
206
|
+
* for React Hook Form integration and should not be used as standalone components.
|
|
207
|
+
*
|
|
208
|
+
* @returns The rendered form field component or null if the field should not be visible
|
|
209
|
+
*/
|
|
210
|
+
declare function DynamicFormField({
|
|
211
|
+
field,
|
|
212
|
+
control,
|
|
213
|
+
adapter,
|
|
214
|
+
contractSchema
|
|
215
|
+
}: DynamicFormFieldProps): React$1.ReactElement | null;
|
|
216
|
+
//#endregion
|
|
217
|
+
//#region src/components/transaction/TransactionExecuteButton.d.ts
|
|
218
|
+
interface TransactionExecuteButtonProps {
|
|
219
|
+
/**
|
|
220
|
+
* Whether the wallet is connected
|
|
221
|
+
*/
|
|
222
|
+
isWalletConnected: boolean;
|
|
223
|
+
/**
|
|
224
|
+
* Whether a transaction is currently being submitted
|
|
225
|
+
*/
|
|
226
|
+
isSubmitting: boolean;
|
|
227
|
+
/**
|
|
228
|
+
* Whether the form is valid
|
|
229
|
+
*/
|
|
230
|
+
isFormValid: boolean;
|
|
231
|
+
/**
|
|
232
|
+
* Button variant
|
|
233
|
+
*/
|
|
234
|
+
variant?: ButtonProps['variant'];
|
|
235
|
+
/**
|
|
236
|
+
* Optional function details to determine if local execution is possible
|
|
237
|
+
* Functions with stateMutability === 'pure' can execute locally without wallet
|
|
238
|
+
*/
|
|
239
|
+
functionDetails?: ContractFunction;
|
|
240
|
+
/**
|
|
241
|
+
* Whether this function can execute locally without wallet connection
|
|
242
|
+
* If true, the wallet connection check is bypassed
|
|
243
|
+
*/
|
|
244
|
+
canExecuteLocally?: boolean;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* TransactionExecuteButton Component
|
|
248
|
+
*
|
|
249
|
+
* Displays a button for executing a transaction, which is disabled if the wallet is not connected,
|
|
250
|
+
* the form is invalid, or a transaction is currently being submitted.
|
|
251
|
+
*
|
|
252
|
+
* @param props The component props
|
|
253
|
+
* @returns A React component
|
|
254
|
+
*/
|
|
255
|
+
declare function TransactionExecuteButton({
|
|
256
|
+
isWalletConnected,
|
|
257
|
+
isSubmitting,
|
|
258
|
+
isFormValid,
|
|
259
|
+
variant,
|
|
260
|
+
functionDetails,
|
|
261
|
+
canExecuteLocally
|
|
262
|
+
}: TransactionExecuteButtonProps): React.ReactElement;
|
|
263
|
+
//# sourceMappingURL=TransactionExecuteButton.d.ts.map
|
|
264
|
+
//#endregion
|
|
265
|
+
//#region src/components/ContractStateWidget/ContractStateWidget.d.ts
|
|
266
|
+
interface ContractStateWidgetProps {
|
|
267
|
+
contractSchema: ContractSchema | null;
|
|
268
|
+
contractAddress: string | null;
|
|
269
|
+
adapter: FullContractAdapter;
|
|
270
|
+
isVisible?: boolean;
|
|
271
|
+
onToggle?: () => void;
|
|
272
|
+
className?: string;
|
|
273
|
+
error?: Error | null;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* ContractStateWidget - Compact widget for displaying contract state
|
|
277
|
+
* Shows contract state by allowing users to query simple view functions (no parameters)
|
|
278
|
+
*/
|
|
279
|
+
declare function ContractStateWidget({
|
|
280
|
+
contractSchema,
|
|
281
|
+
contractAddress,
|
|
282
|
+
adapter,
|
|
283
|
+
isVisible,
|
|
284
|
+
onToggle,
|
|
285
|
+
className,
|
|
286
|
+
error
|
|
287
|
+
}: ContractStateWidgetProps): JSX.Element | null;
|
|
288
|
+
//#endregion
|
|
289
|
+
//#region src/components/ContractActionBar/ContractActionBar.d.ts
|
|
290
|
+
interface ContractActionBarProps {
|
|
291
|
+
networkConfig: NetworkConfig | null;
|
|
292
|
+
contractAddress?: string | null;
|
|
293
|
+
onToggleContractState?: () => void;
|
|
294
|
+
isWidgetExpanded?: boolean;
|
|
295
|
+
children?: React$1.ReactNode;
|
|
296
|
+
className?: string;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* ContractActionBar - A composable action bar for contract forms
|
|
300
|
+
* Displays network information and contract state toggle button
|
|
301
|
+
* Can be extended with additional actions via children
|
|
302
|
+
*/
|
|
303
|
+
declare function ContractActionBar({
|
|
304
|
+
networkConfig,
|
|
305
|
+
contractAddress,
|
|
306
|
+
onToggleContractState,
|
|
307
|
+
isWidgetExpanded,
|
|
308
|
+
children,
|
|
309
|
+
className
|
|
310
|
+
}: ContractActionBarProps): React$1.ReactElement | null;
|
|
311
|
+
//#endregion
|
|
312
|
+
//#region src/components/ExecutionConfigDisplay/ExecutionConfigDisplay.d.ts
|
|
313
|
+
interface ExecutionConfigDisplayProps {
|
|
314
|
+
executionConfig: ExecutionConfig;
|
|
315
|
+
adapter?: ContractAdapter;
|
|
316
|
+
error?: string | null;
|
|
317
|
+
connectedWalletAddress?: string;
|
|
318
|
+
onRuntimeApiKeyChange?: (apiKey: string) => void;
|
|
319
|
+
}
|
|
320
|
+
declare const ExecutionConfigDisplay: React$1.FC<ExecutionConfigDisplayProps>;
|
|
321
|
+
//#endregion
|
|
322
|
+
//#region src/components/network/NetworkSettingsDialog.d.ts
|
|
323
|
+
interface Props {
|
|
324
|
+
isOpen: boolean;
|
|
325
|
+
onOpenChange: (open: boolean) => void;
|
|
326
|
+
networkConfig: {
|
|
327
|
+
id: string;
|
|
328
|
+
name: string;
|
|
329
|
+
} | null;
|
|
330
|
+
adapter: ContractAdapter | null;
|
|
331
|
+
}
|
|
332
|
+
declare const NetworkSettingsDialog: React$1.FC<Props>;
|
|
333
|
+
//#endregion
|
|
334
|
+
//#region src/components/WalletConnectionWithSettings.d.ts
|
|
335
|
+
/**
|
|
336
|
+
* Enhanced wallet connection header with network settings menu.
|
|
337
|
+
* Used in exported apps to provide access to RPC and Explorer configuration.
|
|
338
|
+
*/
|
|
339
|
+
declare const WalletConnectionWithSettings: React$1.FC;
|
|
340
|
+
//# sourceMappingURL=WalletConnectionWithSettings.d.ts.map
|
|
341
|
+
|
|
342
|
+
//#endregion
|
|
343
|
+
export { ContractActionBar, ContractStateWidget, DynamicFormField, ExecutionConfigDisplay, NetworkSettingsDialog, ParameterConstraints, type RendererConfig, TransactionExecuteButton, TransactionForm, WalletConnectionWithSettings, createAddressTransform, createArrayObjectTransform, createArrayTransform, createBigIntTransform, createBooleanTransform, createComplexTypeTransform, createDefaultFormValues, createNumberTransform, createObjectTransform, createTextTransform, createTransformForFieldType, generateDefaultValue, getDefaultValueByFieldType, validateField };
|
|
344
|
+
//# sourceMappingURL=index-DMBaQjZf.d.cts.map
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
import React$1, { JSX } from "react";
|
|
2
|
+
import { Control } from "react-hook-form";
|
|
3
|
+
import { ButtonProps } from "@openzeppelin/ui-components";
|
|
4
|
+
import { ContractAdapter, ContractFunction, ContractSchema, ExecutionConfig, FieldTransforms, FieldType, FormFieldType, FormValues, FullContractAdapter, NetworkConfig, TransactionFormProps } from "@openzeppelin/ui-types";
|
|
5
|
+
|
|
6
|
+
//#region src/types/RendererConfig.d.ts
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Types related to renderer configuration
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Configuration for the renderer package
|
|
13
|
+
* This interface defines dependencies and settings for the renderer
|
|
14
|
+
* that will be used when exporting form projects.
|
|
15
|
+
*/
|
|
16
|
+
interface RendererConfig {
|
|
17
|
+
/**
|
|
18
|
+
* Core dependencies required for all renderer projects
|
|
19
|
+
*/
|
|
20
|
+
coreDependencies: Record<string, string>;
|
|
21
|
+
/**
|
|
22
|
+
* Field-specific dependencies required for different field types
|
|
23
|
+
*/
|
|
24
|
+
fieldDependencies: Record<string, {
|
|
25
|
+
/**
|
|
26
|
+
* Runtime dependencies needed for the field type
|
|
27
|
+
*/
|
|
28
|
+
runtimeDependencies: Record<string, string>;
|
|
29
|
+
/**
|
|
30
|
+
* Development dependencies needed for the field type
|
|
31
|
+
*/
|
|
32
|
+
devDependencies?: Record<string, string>;
|
|
33
|
+
}>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Dependencies for a specific field type
|
|
37
|
+
*/
|
|
38
|
+
//#endregion
|
|
39
|
+
//#region src/components/TransactionForm.d.ts
|
|
40
|
+
/**
|
|
41
|
+
* Transaction Form Component
|
|
42
|
+
*
|
|
43
|
+
* This is the main entry point for the app rendering system. It represents the top level of
|
|
44
|
+
* the app rendering architecture:
|
|
45
|
+
*
|
|
46
|
+
* 1. TransactionForm receives a schema and adapter from the transaction builder app
|
|
47
|
+
* 2. It sets up React Hook Form for state management and validation
|
|
48
|
+
* 3. It renders fields dynamically using the DynamicFormField component
|
|
49
|
+
* 4. Provides wallet connection UI (demo implementation)
|
|
50
|
+
* 5. On submission, it processes data through the adapter before passing to handlers
|
|
51
|
+
*
|
|
52
|
+
* Note: The previewMode prop is currently used only for demo purposes and does not affect
|
|
53
|
+
* the visibility of wallet connection or transaction execution UI. In the future, it will be used
|
|
54
|
+
* to enable/disable actual blockchain interactions without changing the UI structure.
|
|
55
|
+
*
|
|
56
|
+
* @returns The rendered form component
|
|
57
|
+
*/
|
|
58
|
+
declare function TransactionForm({
|
|
59
|
+
schema,
|
|
60
|
+
contractSchema,
|
|
61
|
+
adapter,
|
|
62
|
+
isWalletConnected,
|
|
63
|
+
executionConfig
|
|
64
|
+
}: TransactionFormProps): React.ReactElement;
|
|
65
|
+
//# sourceMappingURL=TransactionForm.d.ts.map
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region src/utils/formUtils.d.ts
|
|
68
|
+
/**
|
|
69
|
+
* Parameter constraints for validation and default value generation
|
|
70
|
+
*/
|
|
71
|
+
interface ParameterConstraints {
|
|
72
|
+
required?: boolean;
|
|
73
|
+
min?: number;
|
|
74
|
+
max?: number;
|
|
75
|
+
minLength?: number;
|
|
76
|
+
maxLength?: number;
|
|
77
|
+
pattern?: string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Validate a field value against validation rules
|
|
81
|
+
*/
|
|
82
|
+
declare function validateField(value: unknown, validation?: {
|
|
83
|
+
required?: boolean;
|
|
84
|
+
min?: number;
|
|
85
|
+
max?: number;
|
|
86
|
+
pattern?: string;
|
|
87
|
+
}): string | null;
|
|
88
|
+
/**
|
|
89
|
+
* Creates a transform for address fields
|
|
90
|
+
*
|
|
91
|
+
* @param adapter The blockchain adapter to use for validation
|
|
92
|
+
* @returns Transform functions for address fields
|
|
93
|
+
*/
|
|
94
|
+
declare function createAddressTransform(adapter: ContractAdapter): FieldTransforms<string>;
|
|
95
|
+
/**
|
|
96
|
+
* Creates a transform for number fields
|
|
97
|
+
*
|
|
98
|
+
* @returns Transform functions for number fields
|
|
99
|
+
*/
|
|
100
|
+
declare function createNumberTransform(): FieldTransforms<number>;
|
|
101
|
+
/**
|
|
102
|
+
* Creates a transform for bigint fields (large integers beyond JS Number precision)
|
|
103
|
+
*
|
|
104
|
+
* @returns Transform functions for bigint fields
|
|
105
|
+
*/
|
|
106
|
+
declare function createBigIntTransform(): FieldTransforms<string>;
|
|
107
|
+
/**
|
|
108
|
+
* Creates a transform for boolean fields
|
|
109
|
+
*
|
|
110
|
+
* @returns Transform functions for boolean fields
|
|
111
|
+
*/
|
|
112
|
+
declare function createBooleanTransform(): FieldTransforms<boolean>;
|
|
113
|
+
/**
|
|
114
|
+
* Creates a transform for complex type fields (arrays, objects, etc.)
|
|
115
|
+
*
|
|
116
|
+
* @returns Transform functions for complex fields
|
|
117
|
+
*/
|
|
118
|
+
declare function createComplexTypeTransform(): FieldTransforms<unknown>;
|
|
119
|
+
/**
|
|
120
|
+
* Creates a transform for text fields
|
|
121
|
+
*
|
|
122
|
+
* @returns Transform functions for text-based fields
|
|
123
|
+
*/
|
|
124
|
+
declare function createTextTransform(): FieldTransforms<string>;
|
|
125
|
+
/**
|
|
126
|
+
* Creates a transform function based on field type
|
|
127
|
+
*
|
|
128
|
+
* @param fieldType The type of field to create transforms for
|
|
129
|
+
* @param adapter Optional adapter for address validation
|
|
130
|
+
* @returns Transform functions for the field type
|
|
131
|
+
*/
|
|
132
|
+
declare function createTransformForFieldType(fieldType: FieldType, adapter?: ContractAdapter): FieldTransforms<unknown>;
|
|
133
|
+
/**
|
|
134
|
+
* Generate a default value for a given field type based on parameter constraints
|
|
135
|
+
*/
|
|
136
|
+
declare function generateDefaultValue(parameterType: string, constraints?: Partial<ParameterConstraints>): unknown;
|
|
137
|
+
/**
|
|
138
|
+
* Returns the appropriate default value based on field type
|
|
139
|
+
*/
|
|
140
|
+
declare function getDefaultValueByFieldType(fieldType: FieldType): string | boolean | number;
|
|
141
|
+
/**
|
|
142
|
+
* Creates a complete default values object for form initialization
|
|
143
|
+
* Ensures all fields have appropriate default values to avoid React controlled/uncontrolled input warnings
|
|
144
|
+
*
|
|
145
|
+
* @param fields The form field definitions
|
|
146
|
+
* @param existingDefaults Any existing default values to preserve
|
|
147
|
+
* @returns A complete form values object with no undefined values
|
|
148
|
+
*/
|
|
149
|
+
declare function createDefaultFormValues(fields: FormFieldType[] | undefined, existingDefaults?: Record<string, unknown>): FormValues;
|
|
150
|
+
/**
|
|
151
|
+
* Creates a transform for array fields
|
|
152
|
+
*
|
|
153
|
+
* @returns Transform functions for array fields
|
|
154
|
+
*/
|
|
155
|
+
declare function createArrayTransform(): FieldTransforms<unknown[]>;
|
|
156
|
+
/**
|
|
157
|
+
* Creates a transform for object fields
|
|
158
|
+
*
|
|
159
|
+
* @returns Transform functions for object fields
|
|
160
|
+
*/
|
|
161
|
+
declare function createObjectTransform(): FieldTransforms<Record<string, unknown>>;
|
|
162
|
+
/**
|
|
163
|
+
* Creates a transform for array-object fields
|
|
164
|
+
*
|
|
165
|
+
* @returns Transform functions for array-object fields
|
|
166
|
+
*/
|
|
167
|
+
declare function createArrayObjectTransform(): FieldTransforms<Record<string, unknown>[]>;
|
|
168
|
+
//# sourceMappingURL=formUtils.d.ts.map
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region src/components/DynamicFormField.d.ts
|
|
171
|
+
/**
|
|
172
|
+
* Props for the DynamicFormField component
|
|
173
|
+
*/
|
|
174
|
+
interface DynamicFormFieldProps {
|
|
175
|
+
/**
|
|
176
|
+
* The field configuration to render
|
|
177
|
+
*/
|
|
178
|
+
field: FormFieldType;
|
|
179
|
+
/**
|
|
180
|
+
* The React Hook Form control
|
|
181
|
+
*/
|
|
182
|
+
control: Control<FormValues>;
|
|
183
|
+
/**
|
|
184
|
+
* The adapter for chain-specific validation and formatting
|
|
185
|
+
*/
|
|
186
|
+
adapter: ContractAdapter;
|
|
187
|
+
/**
|
|
188
|
+
* Optional contract schema for nested metadata lookups
|
|
189
|
+
*/
|
|
190
|
+
contractSchema?: ContractSchema;
|
|
191
|
+
/**
|
|
192
|
+
* The field error message, if any (Kept for potential direct use, though RHF handles it)
|
|
193
|
+
*/
|
|
194
|
+
error?: string;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Dynamic Form Field Component
|
|
198
|
+
*
|
|
199
|
+
* Renders the appropriate field component based on the field type defined in the form schema.
|
|
200
|
+
* This component is part of the app rendering system architecture where:
|
|
201
|
+
* 1. Form schemas are generated from contract functions using adapters
|
|
202
|
+
* 2. The schemas are rendered using the TransactionForm component
|
|
203
|
+
* 3. TransactionForm uses DynamicFormField to render appropriate field components based on the schema
|
|
204
|
+
*
|
|
205
|
+
* The field components (TextField, NumberField, AddressField, etc.) are specifically designed
|
|
206
|
+
* for React Hook Form integration and should not be used as standalone components.
|
|
207
|
+
*
|
|
208
|
+
* @returns The rendered form field component or null if the field should not be visible
|
|
209
|
+
*/
|
|
210
|
+
declare function DynamicFormField({
|
|
211
|
+
field,
|
|
212
|
+
control,
|
|
213
|
+
adapter,
|
|
214
|
+
contractSchema
|
|
215
|
+
}: DynamicFormFieldProps): React$1.ReactElement | null;
|
|
216
|
+
//#endregion
|
|
217
|
+
//#region src/components/transaction/TransactionExecuteButton.d.ts
|
|
218
|
+
interface TransactionExecuteButtonProps {
|
|
219
|
+
/**
|
|
220
|
+
* Whether the wallet is connected
|
|
221
|
+
*/
|
|
222
|
+
isWalletConnected: boolean;
|
|
223
|
+
/**
|
|
224
|
+
* Whether a transaction is currently being submitted
|
|
225
|
+
*/
|
|
226
|
+
isSubmitting: boolean;
|
|
227
|
+
/**
|
|
228
|
+
* Whether the form is valid
|
|
229
|
+
*/
|
|
230
|
+
isFormValid: boolean;
|
|
231
|
+
/**
|
|
232
|
+
* Button variant
|
|
233
|
+
*/
|
|
234
|
+
variant?: ButtonProps['variant'];
|
|
235
|
+
/**
|
|
236
|
+
* Optional function details to determine if local execution is possible
|
|
237
|
+
* Functions with stateMutability === 'pure' can execute locally without wallet
|
|
238
|
+
*/
|
|
239
|
+
functionDetails?: ContractFunction;
|
|
240
|
+
/**
|
|
241
|
+
* Whether this function can execute locally without wallet connection
|
|
242
|
+
* If true, the wallet connection check is bypassed
|
|
243
|
+
*/
|
|
244
|
+
canExecuteLocally?: boolean;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* TransactionExecuteButton Component
|
|
248
|
+
*
|
|
249
|
+
* Displays a button for executing a transaction, which is disabled if the wallet is not connected,
|
|
250
|
+
* the form is invalid, or a transaction is currently being submitted.
|
|
251
|
+
*
|
|
252
|
+
* @param props The component props
|
|
253
|
+
* @returns A React component
|
|
254
|
+
*/
|
|
255
|
+
declare function TransactionExecuteButton({
|
|
256
|
+
isWalletConnected,
|
|
257
|
+
isSubmitting,
|
|
258
|
+
isFormValid,
|
|
259
|
+
variant,
|
|
260
|
+
functionDetails,
|
|
261
|
+
canExecuteLocally
|
|
262
|
+
}: TransactionExecuteButtonProps): React.ReactElement;
|
|
263
|
+
//# sourceMappingURL=TransactionExecuteButton.d.ts.map
|
|
264
|
+
//#endregion
|
|
265
|
+
//#region src/components/ContractStateWidget/ContractStateWidget.d.ts
|
|
266
|
+
interface ContractStateWidgetProps {
|
|
267
|
+
contractSchema: ContractSchema | null;
|
|
268
|
+
contractAddress: string | null;
|
|
269
|
+
adapter: FullContractAdapter;
|
|
270
|
+
isVisible?: boolean;
|
|
271
|
+
onToggle?: () => void;
|
|
272
|
+
className?: string;
|
|
273
|
+
error?: Error | null;
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* ContractStateWidget - Compact widget for displaying contract state
|
|
277
|
+
* Shows contract state by allowing users to query simple view functions (no parameters)
|
|
278
|
+
*/
|
|
279
|
+
declare function ContractStateWidget({
|
|
280
|
+
contractSchema,
|
|
281
|
+
contractAddress,
|
|
282
|
+
adapter,
|
|
283
|
+
isVisible,
|
|
284
|
+
onToggle,
|
|
285
|
+
className,
|
|
286
|
+
error
|
|
287
|
+
}: ContractStateWidgetProps): JSX.Element | null;
|
|
288
|
+
//#endregion
|
|
289
|
+
//#region src/components/ContractActionBar/ContractActionBar.d.ts
|
|
290
|
+
interface ContractActionBarProps {
|
|
291
|
+
networkConfig: NetworkConfig | null;
|
|
292
|
+
contractAddress?: string | null;
|
|
293
|
+
onToggleContractState?: () => void;
|
|
294
|
+
isWidgetExpanded?: boolean;
|
|
295
|
+
children?: React$1.ReactNode;
|
|
296
|
+
className?: string;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* ContractActionBar - A composable action bar for contract forms
|
|
300
|
+
* Displays network information and contract state toggle button
|
|
301
|
+
* Can be extended with additional actions via children
|
|
302
|
+
*/
|
|
303
|
+
declare function ContractActionBar({
|
|
304
|
+
networkConfig,
|
|
305
|
+
contractAddress,
|
|
306
|
+
onToggleContractState,
|
|
307
|
+
isWidgetExpanded,
|
|
308
|
+
children,
|
|
309
|
+
className
|
|
310
|
+
}: ContractActionBarProps): React$1.ReactElement | null;
|
|
311
|
+
//#endregion
|
|
312
|
+
//#region src/components/ExecutionConfigDisplay/ExecutionConfigDisplay.d.ts
|
|
313
|
+
interface ExecutionConfigDisplayProps {
|
|
314
|
+
executionConfig: ExecutionConfig;
|
|
315
|
+
adapter?: ContractAdapter;
|
|
316
|
+
error?: string | null;
|
|
317
|
+
connectedWalletAddress?: string;
|
|
318
|
+
onRuntimeApiKeyChange?: (apiKey: string) => void;
|
|
319
|
+
}
|
|
320
|
+
declare const ExecutionConfigDisplay: React$1.FC<ExecutionConfigDisplayProps>;
|
|
321
|
+
//#endregion
|
|
322
|
+
//#region src/components/network/NetworkSettingsDialog.d.ts
|
|
323
|
+
interface Props {
|
|
324
|
+
isOpen: boolean;
|
|
325
|
+
onOpenChange: (open: boolean) => void;
|
|
326
|
+
networkConfig: {
|
|
327
|
+
id: string;
|
|
328
|
+
name: string;
|
|
329
|
+
} | null;
|
|
330
|
+
adapter: ContractAdapter | null;
|
|
331
|
+
}
|
|
332
|
+
declare const NetworkSettingsDialog: React$1.FC<Props>;
|
|
333
|
+
//#endregion
|
|
334
|
+
//#region src/components/WalletConnectionWithSettings.d.ts
|
|
335
|
+
/**
|
|
336
|
+
* Enhanced wallet connection header with network settings menu.
|
|
337
|
+
* Used in exported apps to provide access to RPC and Explorer configuration.
|
|
338
|
+
*/
|
|
339
|
+
declare const WalletConnectionWithSettings: React$1.FC;
|
|
340
|
+
//# sourceMappingURL=WalletConnectionWithSettings.d.ts.map
|
|
341
|
+
|
|
342
|
+
//#endregion
|
|
343
|
+
export { ContractActionBar, ContractStateWidget, DynamicFormField, ExecutionConfigDisplay, NetworkSettingsDialog, ParameterConstraints, type RendererConfig, TransactionExecuteButton, TransactionForm, WalletConnectionWithSettings, createAddressTransform, createArrayObjectTransform, createArrayTransform, createBigIntTransform, createBooleanTransform, createComplexTypeTransform, createDefaultFormValues, createNumberTransform, createObjectTransform, createTextTransform, createTransformForFieldType, generateDefaultValue, getDefaultValueByFieldType, validateField };
|
|
344
|
+
//# sourceMappingURL=index-CrGita0t.d.ts.map
|