
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
@openzeppelin/contracts-ui-builder-adapter-evm
Advanced tools
EVM Adapter for Contracts UI Builder
@openzeppelin/contracts-ui-builder-adapter-evm
)This package provides the ContractAdapter
implementation for EVM-compatible blockchains (Ethereum, Polygon, BSC, etc.) for the Contracts UI Builder.
It is responsible for:
ContractAdapter
interface from @openzeppelin/contracts-ui-builder-types
.EvmNetworkConfig
objects. These are located in src/networks/
and include details like RPC URLs, Chain IDs, explorer URLs, and native currency information.apiUrl
from the provided EvmNetworkConfig
).EvmNetworkConfig
.wallet
module.The EVM adapter uses an Execution Strategy pattern to handle transaction submissions. This decouples the core signAndBroadcast
logic from the specific implementation of each execution method.
@openzeppelin/relayer-sdk
.The adapter selects the appropriate strategy at runtime based on the ExecutionConfig
provided by the user.
In the Contracts UI Builder, the execution method is configured in the "Customize" step. The UI provides options to select between EOA
and Relayer
and configure their specific parameters (e.g., Relayer API credentials, EOA address restrictions).
This configuration is then passed to the EvmAdapter
's signAndBroadcast
method, which uses a factory to instantiate the correct execution strategy.
All wallet integration logic, UI components, facade hooks, and the UI context provider (e.g., EvmBasicUiContextProvider
for Wagmi) for EVM-compatible chains are located in the src/wallet/
module of this adapter.
The EvmAdapter
implements the optional UI facilitation methods from the ContractAdapter
interface (getEcosystemReactUiContextProvider
, getEcosystemReactHooks
, getEcosystemWalletComponents
). These capabilities are consumed by the builder
application's WalletStateProvider
, which manages the global wallet state and makes these hooks and components accessible to the rest of the application via the useWalletState()
hook.
For full documentation on the src/wallet/
module, its exports, configuration, and usage examples, see src/wallet/README.md
.
This adapter generally follows the standard module structure outlined in the main project Adapter Architecture Guide.
adapter-evm/
├── src/
│ ├── abi/ # ABI fetching and parsing utilities
│ ├── config/ # Adapter-specific configuration
│ ├── mapping/ # Type mapping utilities
│ ├── networks/ # EVM network configurations
│ ├── query/ # View function execution
│ ├── transaction/ # Transaction execution system
│ │ ├── components/ # React components for configuration
│ │ ├── strategies/ # Execution strategy implementations
│ ├── validation/ # Validation utilities
│ ├── wallet/ # Wallet integration (see wallet/README.md)
│ │ ├── providers/ # Wallet context providers
│ │ ├── hooks/ # Wallet interaction hooks
│ │ ├── components/ # Wallet UI components
│ │ ├── implementation/ # Wagmi implementation details
│ │ ├── types/ # Wallet-specific types
│ │ ├── utils/ # Wallet utilities
│ │ ├── README.md # Detailed wallet documentation
│ ├── adapter.ts # Main EvmAdapter class implementation
│ └── index.ts # Public package exports
├── package.json
├── tsconfig.json
├── tsup.config.ts
├── vitest.config.ts
└── README.md
The EvmAdapter
class is instantiated with a specific EvmNetworkConfig
object, making it aware of the target network from its creation:
import { ethereumSepolia, EvmAdapter } from '@openzeppelin/contracts-ui-builder-adapter-evm';
// Or any other exported EvmNetworkConfig
const networkConfig = ethereumSepolia;
const evmAdapter = new EvmAdapter(networkConfig);
// Now use evmAdapter for operations on the Ethereum Sepolia testnet
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
). The full list of available networks is exported as evmNetworks
.
The EvmNetworkConfig
objects defined in src/networks/
(e.g., ethereumMainnet
) each specify a default public rpcUrl
.
This default RPC URL can be overridden at runtime by the consuming application (either the main Contracts UI Builder app or an exported app) through the central AppConfigService
. This service loads configurations from environment variables (for the builder app) or a public/app.config.json
file (for exported apps).
To override an RPC URL, the application's configuration should define an entry in the rpcEndpoints
section, keyed by the network's string ID (e.g., "ethereum-mainnet"
). For example:
In .env
for the builder app:
VITE_APP_CFG_RPC_ENDPOINT_ETHEREUM_MAINNET="https://your-custom-mainnet-rpc.io/key"
In public/app.config.json
for an exported app:
{
// ... other configs ...
"rpcEndpoints": {
"ethereum-mainnet": "https://your-custom-mainnet-rpc.io/key"
}
}
The EvmAdapter
, when performing operations like view function queries (specifically its fallback public client) or when initializing its underlying Wagmi configuration for wallet interactions, will prioritize these runtime-configured RPC URLs.
defaultSupportedChains
and RPC OverridesThe src/wallet/implementation/wagmi-implementation.ts
file configures Wagmi with a defaultSupportedChains
array (e.g., Mainnet, Sepolia, Polygon). For RPC overrides from AppConfigService
to apply to these chains within Wagmi's transports, a mapping is maintained in viemChainIdToAppNetworkId
within wagmi-implementation.ts
. If new chains are added to defaultSupportedChains
and their RPCs need to be overridable, this internal map must also be updated to link the Viem chain ID to your application's string-based network ID (e.g., [polygon.id]: 'polygon-mainnet'
).
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:
id
: A unique string identifier for the network (e.g., "ethereum-mainnet").primaryExplorerApiIdentifier
: A string key (e.g., "etherscan-mainnet") used by AppConfigService
to fetch a specific API key for this network's explorer from networkServiceConfigs
.rpcUrl
, Chain ID, apiUrl
for explorers, explorerUrl
, and native currency information.FAQs
EVM Adapter for Contracts UI Builder
The npm package @openzeppelin/contracts-ui-builder-adapter-evm receives a total of 234 weekly downloads. As such, @openzeppelin/contracts-ui-builder-adapter-evm popularity was classified as not popular.
We found that @openzeppelin/contracts-ui-builder-adapter-evm demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 9 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.