
Security News
New React Server Components Vulnerabilities: DoS and Source Code Exposure
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.
@openzeppelin/contracts-ui-builder-react-core
Advanced tools
Core React context providers and hooks for the OpenZeppelin Contracts UI Builder.
This package provides core React Context providers and hooks for the OpenZeppelin Contracts UI Builder ecosystem. It centralizes the management of global wallet state, active network selection, active adapter instances, and the consumption of adapter-specific UI capabilities (like facade hooks and UI context providers).
It is a foundational package intended to be used by the main @openzeppelin/contracts-ui-builder-app application and can also be leveraged by exported standalone applications to ensure consistent wallet and adapter integration patterns.
AdapterProvider which maintains a registry of ContractAdapter instances, ensuring only one instance exists per network configuration (singleton pattern).WalletStateProvider which builds upon AdapterProvider to manage:
NetworkConfig.ContractAdapter instance for this global network and its loading state.EcosystemSpecificReactHooks (facade hooks) provided by the active adapter.WagmiProvider for EVM adapters), which is crucial for the functionality of facade hooks.useAdapterContext() and useWalletState() for components to access this managed state and functionality.AdapterProvider: Manages adapter instances. Requires a resolveAdapter prop to fetch/create adapters.WalletStateProvider: Manages global active network/adapter/wallet state. Requires a getNetworkConfigById prop and is typically nested within an AdapterProvider.AdapterContextWalletStateContextuseAdapterContext(): To access AdapterProvider's getAdapterForNetwork function.useWalletState(): To access global state like activeNetworkId, activeAdapter, walletFacadeHooks, and the setActiveNetworkId dispatcher.AdapterProviderPropsWalletStateProviderPropsAdapterContextValue, AdapterRegistryWalletStateContextValueThis package is typically used as a workspace dependency (e.g., "@openzeppelin/contracts-ui-builder-react-core": "workspace:^") within the Contracts UI Builder monorepo.
It has peer dependencies on react and react-dom, and direct dependencies on @openzeppelin/contracts-ui-builder-types and @openzeppelin/contracts-ui-builder-utils.
// In your main application setup (e.g., App.tsx)
import {
AdapterProvider,
WalletStateProvider,
} from '@openzeppelin/contracts-ui-builder-react-core';
import { getAdapter, getNetworkById } from './core/ecosystemManager';
// App-specific adapter/network resolvers
function AppRoot() {
return (
<AdapterProvider resolveAdapter={getAdapter}>
<WalletStateProvider
initialNetworkId="ethereum-mainnet" // Optional: Set a default active network
getNetworkConfigById={getNetworkById}
>
{/* Your application components that can now use useWalletState() */}
</WalletStateProvider>
</AdapterProvider>
);
}
import { useWalletState } from '@openzeppelin/contracts-ui-builder-react-core';
function MyWalletComponent() {
const {
activeNetworkId,
activeNetworkConfig,
activeAdapter,
isAdapterLoading,
walletFacadeHooks,
setActiveNetworkId,
} = useWalletState();
if (isAdapterLoading || !activeAdapter) {
return <p>Loading wallet information...</p>;
}
// Example: Using a facade hook if available
const accountInfo = walletFacadeHooks?.useAccount ? walletFacadeHooks.useAccount() : null;
const isConnected = accountInfo?.isConnected;
return (
<div>
<p>Current Network: {activeNetworkConfig?.name || 'None'}</p>
<p>Wallet Connected: {isConnected ? 'Yes' : 'No'}</p>
{/* Further UI using adapter or facade hooks */}
</div>
);
}
This package aims to decouple the builder application logic from the direct management of adapter instances and their UI contexts, promoting a cleaner and more maintainable architecture.
react-core/
├── src/
│ ├── providers/ # React context providers
│ ├── contexts/ # React contexts
│ ├── hooks/ # Consumer hooks
│ ├── types/ # Package-specific types
│ ├── utils/ # Internal utilities
│ └── index.ts # Main package exports
├── package.json # Package configuration
├── tsconfig.json # TypeScript configuration
├── tsup.config.ts # Build configuration
├── vitest.config.ts # Test configuration
└── README.md # This documentation
This package has minimal dependencies to maintain a lightweight footprint:
FAQs
Core React context providers and hooks for the OpenZeppelin Contracts UI Builder.
We found that @openzeppelin/contracts-ui-builder-react-core 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.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.