@openzeppelin/ui-builder-adapter-evm 1.3.0 → 1.4.1

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 (105) hide show
  1. package/README.md +33 -18
  2. package/dist/index.cjs +4650 -4522
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +12 -226
  5. package/dist/index.d.ts +12 -226
  6. package/dist/index.js +4742 -4619
  7. package/dist/index.js.map +1 -1
  8. package/package.json +6 -5
  9. package/src/__tests__/adapter-parsing.test.ts +4 -3
  10. package/src/__tests__/getDefaultServiceConfig.test.ts +185 -0
  11. package/src/__tests__/mocks/mock-network-configs.ts +1 -1
  12. package/src/__tests__/provenanceLinks.test.ts +6 -4
  13. package/src/__tests__/providerSelection.test.ts +5 -4
  14. package/src/__tests__/timeouts.test.ts +5 -3
  15. package/src/__tests__/wallet-connect.test.ts +2 -2
  16. package/src/adapter.ts +61 -107
  17. package/src/configuration/execution.ts +1 -52
  18. package/src/configuration/index.ts +2 -3
  19. package/src/configuration/network-services.ts +47 -60
  20. package/src/index.ts +22 -13
  21. package/src/networks/index.ts +2 -1
  22. package/src/networks/mainnet.ts +1 -1
  23. package/src/networks/testnet.ts +1 -1
  24. package/src/query/adapter-query.ts +72 -0
  25. package/src/query/index.ts +2 -2
  26. package/src/transaction/components/useEvmRelayerOptions.ts +5 -3
  27. package/src/transaction/index.ts +1 -5
  28. package/src/types/artifacts.ts +5 -30
  29. package/src/types/providers.ts +7 -18
  30. package/src/wallet/components/EvmWalletUiRoot.tsx +1 -1
  31. package/src/wallet/evmUiKitManager.ts +26 -129
  32. package/src/wallet/hooks/index.ts +0 -1
  33. package/src/wallet/implementation/wagmi-implementation.ts +45 -577
  34. package/src/wallet/index.ts +2 -3
  35. package/src/wallet/rainbowkit/__tests__/export-service.test.ts +1 -2
  36. package/src/wallet/rainbowkit/componentFactory.ts +10 -8
  37. package/src/wallet/rainbowkit/components.tsx +16 -135
  38. package/src/wallet/rainbowkit/index.ts +27 -5
  39. package/src/wallet/utils/__tests__/uiKitService.test.ts +5 -1
  40. package/src/wallet/utils/connection.ts +8 -52
  41. package/src/wallet/utils/index.ts +0 -2
  42. package/src/wallet/utils/uiKitService.ts +7 -3
  43. package/src/wallet/utils/walletImplementationManager.ts +5 -4
  44. package/src/wallet/utils.ts +1 -65
  45. package/src/abi/__tests__/etherscan-v2.test.ts +0 -117
  46. package/src/abi/__tests__/transformer.test.ts +0 -342
  47. package/src/abi/comparison.ts +0 -389
  48. package/src/abi/etherscan-v2.ts +0 -243
  49. package/src/abi/etherscan.ts +0 -158
  50. package/src/abi/index.ts +0 -7
  51. package/src/abi/loader.ts +0 -415
  52. package/src/abi/sourcify.ts +0 -75
  53. package/src/abi/transformer.ts +0 -163
  54. package/src/abi/types.ts +0 -101
  55. package/src/configuration/__tests__/explorer.test.ts +0 -174
  56. package/src/configuration/__tests__/rpc.test.ts +0 -176
  57. package/src/configuration/explorer.ts +0 -243
  58. package/src/configuration/rpc.ts +0 -257
  59. package/src/mapping/__tests__/field-generator.test.ts +0 -137
  60. package/src/mapping/__tests__/type-mapper.test.ts +0 -139
  61. package/src/mapping/constants.ts +0 -57
  62. package/src/mapping/field-generator.ts +0 -115
  63. package/src/mapping/index.ts +0 -4
  64. package/src/mapping/type-mapper.ts +0 -80
  65. package/src/proxy/detection.ts +0 -465
  66. package/src/query/handler.ts +0 -227
  67. package/src/query/view-checker.ts +0 -10
  68. package/src/transaction/eoa.ts +0 -98
  69. package/src/transaction/execution-strategy.ts +0 -33
  70. package/src/transaction/formatter.ts +0 -101
  71. package/src/transaction/relayer.ts +0 -380
  72. package/src/transaction/sender.ts +0 -185
  73. package/src/transform/index.ts +0 -3
  74. package/src/transform/input-parser.ts +0 -177
  75. package/src/transform/output-formatter.ts +0 -64
  76. package/src/types/__tests__/artifacts.test.ts +0 -105
  77. package/src/types.ts +0 -92
  78. package/src/utils/__tests__/artifacts.test.ts +0 -81
  79. package/src/utils/artifacts.ts +0 -30
  80. package/src/utils/formatting.ts +0 -25
  81. package/src/utils/gas.ts +0 -17
  82. package/src/utils/index.ts +0 -6
  83. package/src/utils/json.ts +0 -19
  84. package/src/utils/validation.ts +0 -10
  85. package/src/validation/eoa.ts +0 -33
  86. package/src/validation/index.ts +0 -2
  87. package/src/validation/relayer.ts +0 -13
  88. package/src/wallet/__tests__/utils.test.ts +0 -149
  89. package/src/wallet/components/account/AccountDisplay.tsx +0 -71
  90. package/src/wallet/components/connect/ConnectButton.tsx +0 -142
  91. package/src/wallet/components/connect/ConnectorDialog.tsx +0 -140
  92. package/src/wallet/components/index.ts +0 -4
  93. package/src/wallet/components/network/NetworkSwitcher.tsx +0 -122
  94. package/src/wallet/context/index.ts +0 -1
  95. package/src/wallet/context/wagmi-context.tsx +0 -7
  96. package/src/wallet/hooks/useIsWagmiProviderInitialized.ts +0 -11
  97. package/src/wallet/rainbowkit/config-generator.ts +0 -56
  98. package/src/wallet/rainbowkit/config-service.ts +0 -169
  99. package/src/wallet/rainbowkit/export-service.ts +0 -18
  100. package/src/wallet/rainbowkit/rainbowkitAssetManager.ts +0 -74
  101. package/src/wallet/rainbowkit/types.ts +0 -74
  102. package/src/wallet/rainbowkit/utils.ts +0 -96
  103. package/src/wallet/services/configResolutionService.ts +0 -65
  104. package/src/wallet/utils/SafeWagmiComponent.tsx +0 -72
  105. package/src/wallet/utils/filterWalletComponents.ts +0 -89
package/README.md CHANGED
@@ -52,23 +52,16 @@ This adapter generally follows the standard module structure outlined in the mai
52
52
  ```text
53
53
  adapter-evm/
54
54
  ├── src/
55
- │ ├── abi/ # ABI fetching and parsing utilities
56
- │ ├── config/ # Adapter-specific configuration
57
- │ ├── mapping/ # Type mapping utilities
58
- │ ├── networks/ # EVM network configurations
59
- ├── query/ # View function execution
60
- │ ├── transaction/ # Transaction execution system
61
- │ │ ├── components/ # React components for configuration
62
- │ │ ├── strategies/ # Execution strategy implementations
63
- │ ├── validation/ # Validation utilities
55
+ │ ├── configuration/ # Adapter-specific configuration wrappers
56
+ │ ├── networks/ # EVM network configurations (mainnet, testnet)
57
+ │ ├── query/ # View function query wrappers
58
+ │ ├── transaction/ # Transaction UI components
59
+ │ └── components/ # React components (EvmRelayerOptions)
64
60
  │ ├── wallet/ # Wallet integration (see wallet/README.md)
65
- │ │ ├── providers/ # Wallet context providers
66
- │ │ ├── hooks/ # Wallet interaction hooks
67
- │ │ ├── components/ # Wallet UI components
68
- │ │ ├── implementation/ # Wagmi implementation details
69
- │ │ ├── types/ # Wallet-specific types
70
- │ │ ├── utils/ # Wallet utilities
71
- │ │ ├── README.md # Detailed wallet documentation
61
+ │ │ ├── hooks/ # Wagmi hook facades
62
+ │ │ ├── implementation/ # Wagmi wallet implementation
63
+ │ │ ├── rainbowkit/ # RainbowKit component factories
64
+ │ │ └── utils/ # Wallet utilities
72
65
  │ ├── adapter.ts # Main EvmAdapter class implementation
73
66
  │ └── index.ts # Public package exports
74
67
  ├── package.json
@@ -78,6 +71,26 @@ adapter-evm/
78
71
  └── README.md
79
72
  ```
80
73
 
74
+ ## Relationship with adapter-evm-core
75
+
76
+ Core EVM functionality has been extracted to `@openzeppelin/ui-builder-adapter-evm-core`. This adapter imports and delegates to core modules for:
77
+
78
+ - **ABI loading**: `loadEvmContract`, `loadAbiFromEtherscan`, `loadAbiFromSourcify`
79
+ - **Type mapping**: `mapEvmParamTypeToFieldType`, `generateEvmDefaultField`
80
+ - **Transaction execution**: `EoaExecutionStrategy`, `RelayerExecutionStrategy`
81
+ - **Query handling**: `queryEvmViewFunction`, `isEvmViewFunction`
82
+ - **Input/output transformation**: `parseEvmInput`, `formatEvmFunctionResult`
83
+ - **Wallet infrastructure**: `WagmiWalletImplementation`, UI kit management
84
+
85
+ The core package is bundled internally (not a runtime dependency) via `tsup` with `noExternal: ['@openzeppelin/ui-builder-adapter-evm-core']`.
86
+
87
+ **What remains in this adapter:**
88
+
89
+ - Ethereum/EVM network configurations (mainnet, Sepolia, Polygon, etc.)
90
+ - Adapter-specific wrapper functions
91
+ - React UI components for transaction options
92
+ - RainbowKit integration and configuration
93
+
81
94
  ---
82
95
 
83
96
  ## Usage (Adapter Instantiation)
@@ -130,5 +143,7 @@ The `src/wallet/implementation/wagmi-implementation.ts` file configures Wagmi wi
130
143
  Network configurations for various EVM chains (mainnets and testnets) are exported from `src/networks/index.ts` within this package (e.g., `ethereumMainnet`, `polygonMainnet`, `ethereumSepolia`, `polygonAmoy`). Each `EvmNetworkConfig` includes:
131
144
 
132
145
  - `id`: A unique string identifier for the network (e.g., "ethereum-mainnet").
133
- - `primaryExplorerApiIdentifier`: A string key (e.g., "etherscan-mainnet") used by `AppConfigService` to fetch a specific API key for this network's explorer from `networkServiceConfigs`.
134
- - It also includes a default public `rpcUrl`, Chain ID, `apiUrl` for explorers, `explorerUrl`, and native currency information.
146
+ - `primaryExplorerApiIdentifier`: A string key (e.g., "etherscan-v2", "routescan") used to resolve explorer API keys.
147
+ - Default `rpcUrl`, Chain ID, `apiUrl` for explorers, `explorerUrl`, and native currency information.
148
+
149
+ For details on how explorer API keys and RPC URLs are resolved, see the [adapter-evm-core Configuration Module](../adapter-evm-core/README.md#configuration-module).