
Security News
/Research
Popular node-ipc npm Package Infected with Credential Stealer
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.
@openzeppelin/ui-react
Advanced tools
Core React context providers and hooks for the OpenZeppelin UI ecosystem.
Core React context providers and hooks for the OpenZeppelin UI ecosystem.
# Using npm
npm install @openzeppelin/ui-react
# Using yarn
yarn add @openzeppelin/ui-react
# Using pnpm
pnpm add @openzeppelin/ui-react
pnpm add react react-dom @tanstack/react-query
This package provides core React context providers and hooks that centralize the management of global wallet state, active network selection, EcosystemRuntime instances (capability bundles per network), and ecosystem-specific UI kit hooks.
It is a foundational package that can be used to ensure consistent wallet and runtime integration patterns across applications.
RuntimeProvider keeps a registry of EcosystemRuntime instances (one per network id, with disposal on teardown), using a resolveRuntime function you supply (typically delegating to an adapter package’s ecosystemDefinition.createRuntime).WalletStateProvider manages:
NetworkConfigEcosystemRuntime and its loading state (isRuntimeLoading)EcosystemSpecificReactHooks from the active runtime’s UI kitRuntimeProvider: Registry + loading state; requires resolveRuntime: (networkConfig) => Promise<EcosystemRuntime>.WalletStateProvider: Global active network / runtime / wallet facade hooks; requires getNetworkConfigById and optionally loadConfigModule for UI kit config modules.useRuntimeContext(): Low-level access to getRuntimeForNetwork / loading helpers from RuntimeProvider.useWalletState(): activeNetworkId, activeNetworkConfig, activeRuntime, isRuntimeLoading, walletFacadeHooks, setActiveNetworkId, reconfigureActiveUiKit.These abstract wallet interactions across ecosystems:
useDerivedAccountStatus(), useDerivedSwitchChainStatus(), useDerivedChainInfo(), useDerivedConnectStatus(), useDerivedDisconnect(), useWalletReconnectionHandler().WalletConnectionHeader, WalletConnectionUI, WalletConnectionWithSettingsNetworkSwitchManager: Pass wallet and networkCatalog from the active runtime (see below), plus targetNetworkId and optional onNetworkSwitchComplete.import { RuntimeProvider, WalletStateProvider } from '@openzeppelin/ui-react';
import { ecosystemDefinition } from '@openzeppelin/adapter-evm';
import { getNetworkById } from './core/ecosystemManager';
async function resolveRuntime(networkConfig) {
return ecosystemDefinition.createRuntime('composer', networkConfig, {
/* profile-specific options if needed */
});
}
function AppRoot() {
return (
<RuntimeProvider resolveRuntime={resolveRuntime}>
<WalletStateProvider
initialNetworkId="ethereum-mainnet"
getNetworkConfigById={getNetworkById}
>
{/* Your application */}
</WalletStateProvider>
</RuntimeProvider>
);
}
import { useWalletState } from '@openzeppelin/ui-react';
function MyWalletComponent() {
const {
activeNetworkId,
activeNetworkConfig,
activeRuntime,
isRuntimeLoading,
walletFacadeHooks,
setActiveNetworkId,
} = useWalletState();
if (isRuntimeLoading || !activeRuntime) {
return <p>Loading wallet information...</p>;
}
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>
</div>
);
}
Use capabilities from the active runtime — not a monolithic adapter instance:
import { useState } from 'react';
import { NetworkSwitchManager, useWalletState } from '@openzeppelin/ui-react';
function MyApp() {
const [networkToSwitchTo, setNetworkToSwitchTo] = useState<string | null>(null);
const { activeRuntime } = useWalletState();
const handleNetworkSwitchComplete = () => {
setNetworkToSwitchTo(null);
};
const wallet = activeRuntime?.wallet;
const networkCatalog = activeRuntime?.networkCatalog;
return (
<>
{wallet && networkCatalog && networkToSwitchTo && (
<NetworkSwitchManager
wallet={wallet}
networkCatalog={networkCatalog}
targetNetworkId={networkToSwitchTo}
onNetworkSwitchComplete={handleNetworkSwitchComplete}
/>
)}
</>
);
}
react/
├── src/
│ ├── components/ # WalletConnection*, NetworkSwitchManager
│ ├── hooks/ # RuntimeProvider, WalletStateProvider, derived hooks
│ └── index.ts
├── package.json
├── tsconfig.json
├── tsdown.config.ts
└── README.md
pnpm build
pnpm test
pnpm lint
FAQs
Core React context providers and hooks for the OpenZeppelin UI ecosystem.
The npm package @openzeppelin/ui-react receives a total of 265 weekly downloads. As such, @openzeppelin/ui-react popularity was classified as not popular.
We found that @openzeppelin/ui-react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 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
/Research
Socket detected malicious node-ipc versions with obfuscated stealer/backdoor behavior in a developing npm supply chain attack.

Security News
TeamPCP and BreachForums are promoting a Shai-Hulud supply chain attack contest with a $1,000 prize for the biggest package compromise.

Security News
Packagist urges PHP projects to update Composer after a GitHub token format change exposed some GitHub Actions tokens in CI logs.