@openzeppelin/ui-builder-adapter-evm 0.16.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/README.md +1 -1
  2. package/dist/index.cjs +415 -351
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +9 -1
  5. package/dist/index.d.ts +9 -1
  6. package/dist/index.js +123 -69
  7. package/dist/index.js.map +1 -1
  8. package/package.json +6 -6
  9. package/src/__tests__/adapter-parsing.test.ts +67 -1
  10. package/src/__tests__/mocks/mock-network-configs.ts +3 -2
  11. package/src/__tests__/providerSelection.test.ts +1 -1
  12. package/src/abi/__tests__/etherscan-v2.test.ts +1 -1
  13. package/src/abi/__tests__/transformer.test.ts +1 -1
  14. package/src/abi/comparison.ts +1 -1
  15. package/src/abi/etherscan-v2.ts +2 -2
  16. package/src/abi/etherscan.ts +2 -2
  17. package/src/abi/loader.ts +2 -2
  18. package/src/abi/sourcify.ts +2 -2
  19. package/src/abi/transformer.ts +2 -6
  20. package/src/adapter.ts +19 -2
  21. package/src/config.ts +1 -1
  22. package/src/configuration/__tests__/explorer.test.ts +1 -1
  23. package/src/configuration/__tests__/rpc.test.ts +4 -4
  24. package/src/configuration/execution.ts +2 -2
  25. package/src/configuration/explorer.ts +2 -6
  26. package/src/configuration/network-services.ts +3 -3
  27. package/src/configuration/rpc.ts +50 -2
  28. package/src/mapping/__tests__/field-generator.test.ts +1 -1
  29. package/src/mapping/constants.ts +26 -1
  30. package/src/mapping/field-generator.ts +2 -2
  31. package/src/mapping/type-mapper.ts +1 -1
  32. package/src/proxy/detection.ts +1 -1
  33. package/src/query/handler.ts +2 -2
  34. package/src/query/view-checker.ts +1 -1
  35. package/src/transaction/components/AdvancedInfo.tsx +1 -1
  36. package/src/transaction/components/CustomGasParameters.tsx +2 -2
  37. package/src/transaction/components/EvmRelayerOptions.tsx +1 -1
  38. package/src/transaction/components/SpeedSelection.tsx +1 -1
  39. package/src/transaction/eoa.ts +2 -2
  40. package/src/transaction/execution-strategy.ts +1 -1
  41. package/src/transaction/formatter.ts +2 -2
  42. package/src/transaction/relayer.ts +2 -2
  43. package/src/transaction/sender.ts +2 -2
  44. package/src/transform/input-parser.ts +2 -2
  45. package/src/transform/output-formatter.ts +2 -2
  46. package/src/types.ts +1 -1
  47. package/src/validation/eoa.ts +2 -2
  48. package/src/validation/relayer.ts +1 -1
  49. package/src/wallet/README.md +4 -4
  50. package/src/wallet/__tests__/utils.test.ts +2 -2
  51. package/src/wallet/components/EvmWalletUiRoot.tsx +2 -2
  52. package/src/wallet/components/account/AccountDisplay.tsx +4 -4
  53. package/src/wallet/components/connect/ConnectButton.tsx +4 -7
  54. package/src/wallet/components/connect/ConnectorDialog.tsx +3 -6
  55. package/src/wallet/components/network/NetworkSwitcher.tsx +8 -8
  56. package/src/wallet/evmUiKitManager.ts +2 -2
  57. package/src/wallet/hooks/facade-hooks.ts +1 -1
  58. package/src/wallet/hooks/useUiKitConfig.ts +2 -2
  59. package/src/wallet/implementation/wagmi-implementation.ts +3 -3
  60. package/src/wallet/rainbowkit/__tests__/export-service.test.ts +1 -1
  61. package/src/wallet/rainbowkit/componentFactory.ts +1 -1
  62. package/src/wallet/rainbowkit/components.tsx +3 -3
  63. package/src/wallet/rainbowkit/config-generator.ts +1 -1
  64. package/src/wallet/rainbowkit/config-service.ts +2 -2
  65. package/src/wallet/rainbowkit/export-service.ts +1 -1
  66. package/src/wallet/rainbowkit/rainbowkitAssetManager.ts +1 -1
  67. package/src/wallet/rainbowkit/utils.ts +2 -2
  68. package/src/wallet/services/configResolutionService.ts +2 -2
  69. package/src/wallet/types.ts +1 -1
  70. package/src/wallet/utils/SafeWagmiComponent.tsx +1 -1
  71. package/src/wallet/utils/__tests__/uiKitService.test.ts +3 -3
  72. package/src/wallet/utils/connection.ts +2 -2
  73. package/src/wallet/utils/filterWalletComponents.ts +3 -3
  74. package/src/wallet/utils/uiKitService.ts +2 -2
  75. package/src/wallet/utils/walletImplementationManager.ts +2 -2
  76. package/src/wallet/utils.ts +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openzeppelin/ui-builder-adapter-evm",
3
- "version": "0.16.0",
3
+ "version": "1.2.0",
4
4
  "private": false,
5
5
  "description": "EVM Adapter for UI Builder",
6
6
  "keywords": [
@@ -37,16 +37,16 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@openzeppelin/relayer-sdk": "1.4.0",
40
+ "@openzeppelin/ui-components": "^1.0.2",
41
+ "@openzeppelin/ui-react": "^1.0.0",
42
+ "@openzeppelin/ui-types": "^1.1.0",
43
+ "@openzeppelin/ui-utils": "^1.0.0",
40
44
  "@wagmi/connectors": "5.7.13",
41
45
  "@wagmi/core": "^2.20.3",
42
46
  "@web3icons/react": "^4.0.19",
43
47
  "lodash": "^4.17.21",
44
48
  "lucide-react": "^0.510.0",
45
- "react-hook-form": "^7.62.0",
46
- "@openzeppelin/ui-builder-react-core": "^0.16.0",
47
- "@openzeppelin/ui-builder-types": "^0.16.0",
48
- "@openzeppelin/ui-builder-ui": "^0.16.0",
49
- "@openzeppelin/ui-builder-utils": "^0.16.0"
49
+ "react-hook-form": "^7.62.0"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@rainbow-me/rainbowkit": "^2.2.8",
@@ -1,11 +1,12 @@
1
1
  import { beforeEach, describe, expect, it } from 'vitest';
2
2
 
3
3
  // Adjust path as needed
4
- import type { ContractFunction, FunctionParameter } from '@openzeppelin/ui-builder-types';
4
+ import type { ContractFunction, FunctionParameter } from '@openzeppelin/ui-types';
5
5
 
6
6
  import { mockEvmNetworkConfig } from './mocks/mock-network-configs';
7
7
 
8
8
  import { EvmAdapter } from '../adapter';
9
+ import { EVM_TYPE_TO_FIELD_TYPE } from '../mapping';
9
10
  import { parseEvmInput as parseEvmInputFunction } from '../transform';
10
11
 
11
12
  // Mock FunctionParameter type helper
@@ -464,3 +465,68 @@ describe('EvmAdapter Output Formatting', () => {
464
465
 
465
466
  // Potential TODO: Add test for error during stringifyWithBigInt if possible (e.g., circular refs, though unlikely here)
466
467
  });
468
+
469
+ // --- getTypeMappingInfo Tests ---
470
+ describe('EvmAdapter getTypeMappingInfo', () => {
471
+ let adapter: EvmAdapter;
472
+
473
+ beforeEach(() => {
474
+ adapter = new EvmAdapter(mockEvmNetworkConfig);
475
+ });
476
+
477
+ it('should return TypeMappingInfo with primitives and dynamicPatterns', () => {
478
+ const info = adapter.getTypeMappingInfo();
479
+ expect(info).toHaveProperty('primitives');
480
+ expect(info).toHaveProperty('dynamicPatterns');
481
+ expect(typeof info.primitives).toBe('object');
482
+ expect(Array.isArray(info.dynamicPatterns)).toBe(true);
483
+ });
484
+
485
+ it('should return primitives matching EVM_TYPE_TO_FIELD_TYPE constant', () => {
486
+ const info = adapter.getTypeMappingInfo();
487
+ const expectedTypes = Object.keys(EVM_TYPE_TO_FIELD_TYPE);
488
+ expect(Object.keys(info.primitives)).toEqual(expectedTypes);
489
+ });
490
+
491
+ it('should include expected EVM primitive types in primitives', () => {
492
+ const { primitives } = adapter.getTypeMappingInfo();
493
+ // Core EVM primitive types
494
+ expect(primitives).toHaveProperty('address');
495
+ expect(primitives).toHaveProperty('bool');
496
+ expect(primitives).toHaveProperty('string');
497
+ expect(primitives).toHaveProperty('bytes');
498
+ expect(primitives).toHaveProperty('bytes32');
499
+ // Integer types
500
+ expect(primitives).toHaveProperty('uint256');
501
+ expect(primitives).toHaveProperty('int256');
502
+ });
503
+
504
+ it('should NOT include dynamic types in primitives', () => {
505
+ const { primitives } = adapter.getTypeMappingInfo();
506
+ Object.keys(primitives).forEach((type) => {
507
+ expect(type).not.toMatch(/\[\]$/); // No array types
508
+ expect(type).not.toMatch(/^tuple/); // No tuple types
509
+ });
510
+ });
511
+
512
+ it('should include dynamic patterns for arrays and tuples', () => {
513
+ const { dynamicPatterns } = adapter.getTypeMappingInfo();
514
+ const patternNames = dynamicPatterns.map((p) => p.name);
515
+ expect(patternNames).toContain('array');
516
+ expect(patternNames).toContain('tuple');
517
+ expect(patternNames).toContain('tuple-array');
518
+ });
519
+
520
+ it('should have properly structured dynamic patterns', () => {
521
+ const { dynamicPatterns } = adapter.getTypeMappingInfo();
522
+ dynamicPatterns.forEach((pattern) => {
523
+ expect(pattern).toHaveProperty('name');
524
+ expect(pattern).toHaveProperty('syntax');
525
+ expect(pattern).toHaveProperty('mapsTo');
526
+ expect(pattern).toHaveProperty('description');
527
+ expect(typeof pattern.name).toBe('string');
528
+ expect(typeof pattern.syntax).toBe('string');
529
+ expect(typeof pattern.description).toBe('string');
530
+ });
531
+ });
532
+ });
@@ -1,9 +1,9 @@
1
- import type { EvmNetworkConfig } from '@openzeppelin/ui-builder-types';
1
+ import type { TypedEvmNetworkConfig } from '../../types';
2
2
 
3
3
  /**
4
4
  * Mock EVM Network Configuration for testing purposes.
5
5
  */
6
- export const mockEvmNetworkConfig: EvmNetworkConfig = {
6
+ export const mockEvmNetworkConfig: TypedEvmNetworkConfig = {
7
7
  id: 'test-evm-mocknet',
8
8
  exportConstName: 'mockEvmNetworkConfig',
9
9
  name: 'Test EVM Mocknet',
@@ -15,6 +15,7 @@ export const mockEvmNetworkConfig: EvmNetworkConfig = {
15
15
  rpcUrl: 'http://localhost:8545', // Mock RPC URL
16
16
  nativeCurrency: { name: 'TestETH', symbol: 'TETH', decimals: 18 },
17
17
  apiUrl: 'https://api.etherscan.io/api', // Mock API URL
18
+ viemChain: undefined, // Optional viem Chain object
18
19
  };
19
20
 
20
21
  // Add mocks for other ecosystems here if needed later
@@ -1,6 +1,6 @@
1
1
  import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
2
2
 
3
- import { appConfigService, userNetworkServiceConfigService } from '@openzeppelin/ui-builder-utils';
3
+ import { appConfigService, userNetworkServiceConfigService } from '@openzeppelin/ui-utils';
4
4
 
5
5
  import { loadEvmContract } from '../abi/loader';
6
6
  import type { TypedEvmNetworkConfig } from '../types';
@@ -8,7 +8,7 @@ vi.mock('../../configuration/explorer', () => ({
8
8
  resolveExplorerConfig: vi.fn(),
9
9
  }));
10
10
 
11
- vi.mock('@openzeppelin/ui-builder-utils', () => ({
11
+ vi.mock('@openzeppelin/ui-utils', () => ({
12
12
  logger: {
13
13
  info: vi.fn(),
14
14
  error: vi.fn(),
@@ -4,7 +4,7 @@
4
4
  import type { AbiFunction } from 'viem';
5
5
  import { describe, expect, it, vi } from 'vitest';
6
6
 
7
- import type { ContractFunction, ContractSchema } from '@openzeppelin/ui-builder-types';
7
+ import type { ContractFunction, ContractSchema } from '@openzeppelin/ui-types';
8
8
 
9
9
  import type { AbiItem } from '../../types';
10
10
  // Adjust path as necessary
@@ -5,7 +5,7 @@
5
5
 
6
6
  import type { Abi } from 'viem';
7
7
 
8
- import { logger, simpleHash } from '@openzeppelin/ui-builder-utils';
8
+ import { logger, simpleHash } from '@openzeppelin/ui-utils';
9
9
 
10
10
  import type { AbiComparisonResult, AbiDifference, AbiValidationResult } from './types';
11
11
  import { isValidAbiArray } from './types';
@@ -1,5 +1,5 @@
1
- import type { ContractSchema } from '@openzeppelin/ui-builder-types';
2
- import { logger } from '@openzeppelin/ui-builder-utils';
1
+ import type { ContractSchema } from '@openzeppelin/ui-types';
2
+ import { logger } from '@openzeppelin/ui-utils';
3
3
 
4
4
  import { resolveExplorerConfig } from '../configuration/explorer';
5
5
  import type { AbiItem, TypedEvmNetworkConfig } from '../types';
@@ -1,5 +1,5 @@
1
- import type { ContractSchema } from '@openzeppelin/ui-builder-types';
2
- import { logger } from '@openzeppelin/ui-builder-utils';
1
+ import type { ContractSchema } from '@openzeppelin/ui-types';
2
+ import { logger } from '@openzeppelin/ui-utils';
3
3
 
4
4
  import { resolveExplorerConfig } from '../configuration/explorer';
5
5
  import type { AbiItem, TypedEvmNetworkConfig } from '../types';
package/src/abi/loader.ts CHANGED
@@ -5,14 +5,14 @@ import type {
5
5
  ContractSchema,
6
6
  EvmNetworkConfig,
7
7
  ProxyInfo,
8
- } from '@openzeppelin/ui-builder-types';
8
+ } from '@openzeppelin/ui-types';
9
9
  import {
10
10
  appConfigService,
11
11
  logger,
12
12
  simpleHash,
13
13
  userNetworkServiceConfigService,
14
14
  withTimeout,
15
- } from '@openzeppelin/ui-builder-utils';
15
+ } from '@openzeppelin/ui-utils';
16
16
 
17
17
  import { getEvmExplorerAddressUrl } from '../configuration/explorer';
18
18
  import { detectProxyFromAbi, getAdminAddress, getImplementationAddress } from '../proxy/detection';
@@ -1,5 +1,5 @@
1
- import type { ContractSchema } from '@openzeppelin/ui-builder-types';
2
- import { logger } from '@openzeppelin/ui-builder-utils';
1
+ import type { ContractSchema } from '@openzeppelin/ui-types';
2
+ import { logger } from '@openzeppelin/ui-utils';
3
3
 
4
4
  import type { AbiItem, TypedEvmNetworkConfig } from '../types';
5
5
  import { transformAbiToSchema } from './transformer';
@@ -1,11 +1,7 @@
1
1
  import type { AbiFunction, AbiParameter, AbiStateMutability } from 'viem';
2
2
 
3
- import type {
4
- ContractFunction,
5
- ContractSchema,
6
- FunctionParameter,
7
- } from '@openzeppelin/ui-builder-types';
8
- import { logger } from '@openzeppelin/ui-builder-utils';
3
+ import type { ContractFunction, ContractSchema, FunctionParameter } from '@openzeppelin/ui-types';
4
+ import { logger } from '@openzeppelin/ui-utils';
9
5
 
10
6
  import type { AbiItem } from '../types';
11
7
  import { formatInputName, formatMethodName } from '../utils';
package/src/adapter.ts CHANGED
@@ -23,12 +23,13 @@ import type {
23
23
  RelayerDetailsRich,
24
24
  TransactionStatusUpdate,
25
25
  TxStatus,
26
+ TypeMappingInfo,
26
27
  UiKitConfiguration,
27
28
  UserExplorerConfig,
28
29
  UserRpcProviderConfig,
29
30
  WalletConnectionStatus,
30
- } from '@openzeppelin/ui-builder-types';
31
- import { logger } from '@openzeppelin/ui-builder-utils';
31
+ } from '@openzeppelin/ui-types';
32
+ import { logger } from '@openzeppelin/ui-utils';
32
33
 
33
34
  import { abiComparisonService } from './abi/comparison';
34
35
  import {
@@ -47,6 +48,7 @@ import { resolveFullUiKitConfiguration } from './wallet/services/configResolutio
47
48
 
48
49
  import { loadEvmContract } from './abi';
49
50
  import {
51
+ getEvmCurrentBlock,
50
52
  getEvmExplorerAddressUrl,
51
53
  getEvmExplorerTxUrl,
52
54
  getEvmSupportedExecutionMethods,
@@ -59,6 +61,7 @@ import {
59
61
  import {
60
62
  generateEvmDefaultField,
61
63
  getEvmCompatibleFieldTypes,
64
+ getEvmTypeMappingInfo,
62
65
  mapEvmParamTypeToFieldType,
63
66
  } from './mapping';
64
67
  import { isEvmViewFunction, queryEvmViewFunction } from './query';
@@ -489,6 +492,13 @@ export class EvmAdapter implements ContractAdapter {
489
492
  return null;
490
493
  }
491
494
 
495
+ /**
496
+ * @inheritdoc
497
+ */
498
+ async getCurrentBlock(): Promise<number> {
499
+ return getEvmCurrentBlock(this.networkConfig);
500
+ }
501
+
492
502
  /**
493
503
  * @inheritdoc
494
504
  */
@@ -775,6 +785,13 @@ Get your WalletConnect projectId from <a href="https://cloud.walletconnect.com"
775
785
  public hashContractDefinition(definition: string): string {
776
786
  return abiComparisonService.hashAbi(definition);
777
787
  }
788
+
789
+ /**
790
+ * @inheritdoc
791
+ */
792
+ public getTypeMappingInfo(): TypeMappingInfo {
793
+ return getEvmTypeMappingInfo();
794
+ }
778
795
  }
779
796
 
780
797
  // Also export as default to ensure compatibility with various import styles
package/src/config.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * when generating exported projects. It follows the AdapterConfig
6
6
  * interface to provide a structured approach to dependency management.
7
7
  */
8
- import type { AdapterConfig } from '@openzeppelin/ui-builder-types';
8
+ import type { AdapterConfig } from '@openzeppelin/ui-types';
9
9
 
10
10
  export const evmAdapterConfig: AdapterConfig = {
11
11
  /**
@@ -1,6 +1,6 @@
1
1
  import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
2
2
 
3
- import { EvmNetworkConfig, UserExplorerConfig } from '@openzeppelin/ui-builder-types';
3
+ import { EvmNetworkConfig, UserExplorerConfig } from '@openzeppelin/ui-types';
4
4
 
5
5
  import { testEvmExplorerConnection, validateEvmExplorerConfig } from '../../configuration/explorer';
6
6
 
@@ -1,7 +1,7 @@
1
1
  import { beforeEach, describe, expect, it, vi } from 'vitest';
2
2
 
3
- import type { EvmNetworkConfig } from '@openzeppelin/ui-builder-types';
4
- import { appConfigService } from '@openzeppelin/ui-builder-utils';
3
+ import type { EvmNetworkConfig } from '@openzeppelin/ui-types';
4
+ import { appConfigService } from '@openzeppelin/ui-utils';
5
5
 
6
6
  import { resolveRpcUrl } from '../rpc';
7
7
 
@@ -24,8 +24,8 @@ const createMockConfig = (id: string, rpcUrl?: string, name?: string): EvmNetwor
24
24
  });
25
25
 
26
26
  // Mock the appConfigService from the correct package
27
- vi.mock('@openzeppelin/ui-builder-utils', async (importOriginal) => {
28
- const original = await importOriginal<typeof import('@openzeppelin/ui-builder-utils')>(); // Ensure correct type for original
27
+ vi.mock('@openzeppelin/ui-utils', async (importOriginal) => {
28
+ const original = await importOriginal<typeof import('@openzeppelin/ui-utils')>(); // Ensure correct type for original
29
29
  return {
30
30
  ...original,
31
31
  logger: {
@@ -4,8 +4,8 @@ import type {
4
4
  ExecutionMethodDetail,
5
5
  MultisigExecutionConfig,
6
6
  RelayerExecutionConfig,
7
- } from '@openzeppelin/ui-builder-types';
8
- import { logger } from '@openzeppelin/ui-builder-utils';
7
+ } from '@openzeppelin/ui-types';
8
+ import { logger } from '@openzeppelin/ui-utils';
9
9
 
10
10
  import { validateEoaConfig, validateRelayerConfig } from '../validation';
11
11
  import { EvmWalletConnectionStatus } from '../wallet/types';
@@ -1,9 +1,5 @@
1
- import { NetworkConfig, UserExplorerConfig } from '@openzeppelin/ui-builder-types';
2
- import {
3
- appConfigService,
4
- logger,
5
- userNetworkServiceConfigService,
6
- } from '@openzeppelin/ui-builder-utils';
1
+ import { NetworkConfig, UserExplorerConfig } from '@openzeppelin/ui-types';
2
+ import { appConfigService, logger, userNetworkServiceConfigService } from '@openzeppelin/ui-utils';
7
3
 
8
4
  import { shouldUseV2Api, testEtherscanV2Connection } from '../abi/etherscan-v2';
9
5
  import { TypedEvmNetworkConfig } from '../types';
@@ -1,6 +1,6 @@
1
- import type { NetworkServiceForm } from '@openzeppelin/ui-builder-types';
2
- import { UserExplorerConfig, UserRpcProviderConfig } from '@openzeppelin/ui-builder-types';
3
- import { appConfigService, userNetworkServiceConfigService } from '@openzeppelin/ui-builder-utils';
1
+ import type { NetworkServiceForm } from '@openzeppelin/ui-types';
2
+ import { UserExplorerConfig, UserRpcProviderConfig } from '@openzeppelin/ui-types';
3
+ import { appConfigService, userNetworkServiceConfigService } from '@openzeppelin/ui-utils';
4
4
 
5
5
  import { TypedEvmNetworkConfig } from '../types';
6
6
  import { EvmProviderKeys, isEvmProviderKey } from '../types/providers';
@@ -1,10 +1,10 @@
1
- import type { EvmNetworkConfig, UserRpcProviderConfig } from '@openzeppelin/ui-builder-types';
1
+ import type { EvmNetworkConfig, UserRpcProviderConfig } from '@openzeppelin/ui-types';
2
2
  import {
3
3
  appConfigService,
4
4
  isValidUrl,
5
5
  logger,
6
6
  userNetworkServiceConfigService,
7
- } from '@openzeppelin/ui-builder-utils';
7
+ } from '@openzeppelin/ui-utils';
8
8
 
9
9
  /**
10
10
  * Builds a complete RPC URL from a user RPC provider configuration.
@@ -207,3 +207,51 @@ export async function testEvmRpcConnection(
207
207
  clearTimeout(timeoutId);
208
208
  }
209
209
  }
210
+
211
+ /**
212
+ * Gets the current block number from an EVM network.
213
+ *
214
+ * @param networkConfig - The EVM network configuration
215
+ * @returns Promise resolving to the current block number
216
+ * @throws Error if the RPC call fails
217
+ */
218
+ export async function getEvmCurrentBlock(networkConfig: EvmNetworkConfig): Promise<number> {
219
+ const rpcUrl = resolveRpcUrl(networkConfig);
220
+
221
+ try {
222
+ const response = await fetch(rpcUrl, {
223
+ method: 'POST',
224
+ headers: { 'Content-Type': 'application/json' },
225
+ body: JSON.stringify({
226
+ jsonrpc: '2.0',
227
+ method: 'eth_blockNumber',
228
+ params: [],
229
+ id: 1,
230
+ }),
231
+ });
232
+
233
+ if (!response.ok) {
234
+ throw new Error(`RPC request failed with status ${response.status}`);
235
+ }
236
+
237
+ const data = await response.json();
238
+ if (data.error) {
239
+ throw new Error(data.error.message || 'RPC error');
240
+ }
241
+
242
+ // eth_blockNumber returns a hex string
243
+ if (data.result === undefined || data.result === null) {
244
+ throw new Error('RPC response missing result field');
245
+ }
246
+ const blockNumber = parseInt(data.result, 16);
247
+ if (isNaN(blockNumber)) {
248
+ throw new Error(`Invalid block number returned: ${data.result}`);
249
+ }
250
+ return blockNumber;
251
+ } catch (error) {
252
+ logger.error('getEvmCurrentBlock', 'Failed to get current block:', error);
253
+ throw new Error(
254
+ `Failed to get current block: ${error instanceof Error ? error.message : String(error)}`
255
+ );
256
+ }
257
+ }
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, it } from 'vitest';
2
2
 
3
- import type { FunctionParameter } from '@openzeppelin/ui-builder-types';
3
+ import type { FunctionParameter } from '@openzeppelin/ui-types';
4
4
 
5
5
  import { generateEvmDefaultField } from '../field-generator';
6
6
 
@@ -1,4 +1,4 @@
1
- import type { FieldType } from '@openzeppelin/ui-builder-types';
1
+ import type { FieldType, TypeMappingInfo } from '@openzeppelin/ui-types';
2
2
 
3
3
  /**
4
4
  * EVM-specific type mapping to default form field types.
@@ -30,3 +30,28 @@ export const EVM_TYPE_TO_FIELD_TYPE: Record<string, FieldType> = {
30
30
  bytes: 'textarea',
31
31
  bytes32: 'text',
32
32
  };
33
+
34
+ /**
35
+ * EVM dynamic type patterns handled through pattern matching.
36
+ */
37
+ const EVM_DYNAMIC_PATTERNS: TypeMappingInfo['dynamicPatterns'] = [
38
+ { name: 'array', syntax: 'T[]', mapsTo: 'array', description: 'Dynamic array of primitives' },
39
+ { name: 'fixed-array', syntax: 'T[N]', mapsTo: 'array', description: 'Fixed-size array' },
40
+ {
41
+ name: 'tuple-array',
42
+ syntax: 'tuple[]',
43
+ mapsTo: 'array-object',
44
+ description: 'Array of structs',
45
+ },
46
+ { name: 'tuple', syntax: 'tuple', mapsTo: 'object', description: 'Struct/tuple type' },
47
+ ];
48
+
49
+ /**
50
+ * Returns complete type mapping information for EVM.
51
+ */
52
+ export function getEvmTypeMappingInfo(): TypeMappingInfo {
53
+ return {
54
+ primitives: { ...EVM_TYPE_TO_FIELD_TYPE },
55
+ dynamicPatterns: EVM_DYNAMIC_PATTERNS,
56
+ };
57
+ }
@@ -6,12 +6,12 @@ import type {
6
6
  FieldValue,
7
7
  FormFieldType,
8
8
  FunctionParameter,
9
- } from '@openzeppelin/ui-builder-types';
9
+ } from '@openzeppelin/ui-types';
10
10
  import {
11
11
  enhanceNumericValidation,
12
12
  getDefaultValueForType,
13
13
  type NumericBoundsMap,
14
- } from '@openzeppelin/ui-builder-utils';
14
+ } from '@openzeppelin/ui-utils';
15
15
 
16
16
  import { mapEvmParamTypeToFieldType } from './type-mapper';
17
17
 
@@ -1,4 +1,4 @@
1
- import type { FieldType } from '@openzeppelin/ui-builder-types';
1
+ import type { FieldType } from '@openzeppelin/ui-types';
2
2
 
3
3
  import { EVM_TYPE_TO_FIELD_TYPE } from './constants';
4
4
 
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import { createPublicClient, http, keccak256, parseAbi, toHex } from 'viem';
8
8
 
9
- import { logger } from '@openzeppelin/ui-builder-utils';
9
+ import { logger } from '@openzeppelin/ui-utils';
10
10
 
11
11
  import { resolveRpcUrl } from '../configuration';
12
12
  import { AbiItem, TypedEvmNetworkConfig } from '../types';
@@ -1,7 +1,7 @@
1
1
  import { createPublicClient, http, isAddress, type Chain, type PublicClient } from 'viem';
2
2
 
3
- import type { ContractSchema, FunctionParameter } from '@openzeppelin/ui-builder-types';
4
- import { logger } from '@openzeppelin/ui-builder-utils';
3
+ import type { ContractSchema, FunctionParameter } from '@openzeppelin/ui-types';
4
+ import { logger } from '@openzeppelin/ui-utils';
5
5
 
6
6
  import { createAbiFunctionItem } from '../abi';
7
7
  import { getUserRpcUrl, resolveRpcUrl } from '../configuration';
@@ -1,4 +1,4 @@
1
- import type { ContractFunction } from '@openzeppelin/ui-builder-types';
1
+ import type { ContractFunction } from '@openzeppelin/ui-types';
2
2
 
3
3
  /**
4
4
  * Determines if a function is a view/pure function (read-only).
@@ -1,7 +1,7 @@
1
1
  import { Info } from 'lucide-react';
2
2
  import React from 'react';
3
3
 
4
- import { Button } from '@openzeppelin/ui-builder-ui';
4
+ import { Button } from '@openzeppelin/ui-components';
5
5
 
6
6
  interface AdvancedInfoProps {
7
7
  showAdvancedInfo: boolean;
@@ -9,8 +9,8 @@ import {
9
9
  AccordionTrigger,
10
10
  BooleanField,
11
11
  NumberField,
12
- } from '@openzeppelin/ui-builder-ui';
13
- import { cn } from '@openzeppelin/ui-builder-utils';
12
+ } from '@openzeppelin/ui-components';
13
+ import { cn } from '@openzeppelin/ui-utils';
14
14
 
15
15
  import { EvmRelayerFormData } from './useEvmRelayerOptions';
16
16
 
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
 
3
- import { Tabs, TabsContent, TabsList, TabsTrigger } from '@openzeppelin/ui-builder-ui';
3
+ import { Tabs, TabsContent, TabsList, TabsTrigger } from '@openzeppelin/ui-components';
4
4
 
5
5
  import { AdvancedInfo } from './AdvancedInfo';
6
6
  import { CustomGasParameters } from './CustomGasParameters';
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
 
3
3
  import { Speed } from '@openzeppelin/relayer-sdk';
4
- import { RadioGroup, RadioGroupItem } from '@openzeppelin/ui-builder-ui';
4
+ import { RadioGroup, RadioGroupItem } from '@openzeppelin/ui-components';
5
5
 
6
6
  interface SpeedSelectionProps {
7
7
  selectedSpeed: Speed | undefined;
@@ -6,8 +6,8 @@ import {
6
6
  ExecutionConfig,
7
7
  TransactionStatusUpdate,
8
8
  TxStatus,
9
- } from '@openzeppelin/ui-builder-types';
10
- import { logger } from '@openzeppelin/ui-builder-utils';
9
+ } from '@openzeppelin/ui-types';
10
+ import { logger } from '@openzeppelin/ui-utils';
11
11
 
12
12
  import { WriteContractParameters } from '../types';
13
13
  import { validateEoaConfig } from '../validation';
@@ -1,4 +1,4 @@
1
- import { ExecutionConfig, TransactionStatusUpdate, TxStatus } from '@openzeppelin/ui-builder-types';
1
+ import { ExecutionConfig, TransactionStatusUpdate, TxStatus } from '@openzeppelin/ui-types';
2
2
 
3
3
  import { WriteContractParameters } from '../types';
4
4
  import { WagmiWalletImplementation } from '../wallet/implementation/wagmi-implementation';
@@ -1,7 +1,7 @@
1
1
  import { isAddress } from 'viem';
2
2
 
3
- import type { ContractSchema, FormFieldType } from '@openzeppelin/ui-builder-types';
4
- import { logger } from '@openzeppelin/ui-builder-utils';
3
+ import type { ContractSchema, FormFieldType } from '@openzeppelin/ui-types';
4
+ import { logger } from '@openzeppelin/ui-utils';
5
5
 
6
6
  import { createAbiFunctionItem } from '../abi';
7
7
  import { parseEvmInput } from '../transform';
@@ -16,8 +16,8 @@ import {
16
16
  RelayerExecutionConfig,
17
17
  TransactionStatusUpdate,
18
18
  TxStatus,
19
- } from '@openzeppelin/ui-builder-types';
20
- import { logger } from '@openzeppelin/ui-builder-utils';
19
+ } from '@openzeppelin/ui-types';
20
+ import { logger } from '@openzeppelin/ui-utils';
21
21
 
22
22
  import { TypedEvmNetworkConfig, WriteContractParameters } from '../types';
23
23
  import { WagmiWalletImplementation } from '../wallet/implementation/wagmi-implementation';
@@ -1,8 +1,8 @@
1
1
  import type { GetAccountReturnType } from '@wagmi/core';
2
2
  import type { TransactionReceipt, WalletClient } from 'viem';
3
3
 
4
- import type { ExecutionConfig } from '@openzeppelin/ui-builder-types';
5
- import { logger } from '@openzeppelin/ui-builder-utils';
4
+ import type { ExecutionConfig } from '@openzeppelin/ui-types';
5
+ import { logger } from '@openzeppelin/ui-utils';
6
6
 
7
7
  import type { WriteContractParameters } from '../types';
8
8
  import type { WagmiWalletImplementation } from '../wallet/implementation/wagmi-implementation';
@@ -1,7 +1,7 @@
1
1
  import { getAddress, isAddress } from 'viem';
2
2
 
3
- import type { FunctionParameter } from '@openzeppelin/ui-builder-types';
4
- import { logger } from '@openzeppelin/ui-builder-utils';
3
+ import type { FunctionParameter } from '@openzeppelin/ui-types';
4
+ import { logger } from '@openzeppelin/ui-utils';
5
5
 
6
6
  /**
7
7
  * Recursively parses a raw input value based on its expected ABI type definition.
@@ -1,5 +1,5 @@
1
- import type { ContractFunction } from '@openzeppelin/ui-builder-types';
2
- import { logger } from '@openzeppelin/ui-builder-utils';
1
+ import type { ContractFunction } from '@openzeppelin/ui-types';
2
+ import { logger } from '@openzeppelin/ui-utils';
3
3
 
4
4
  import { stringifyWithBigInt } from '../utils';
5
5