
Security News
PEP 810 Proposes Explicit Lazy Imports for Python 3.15
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
@meshconnect/uwc-react
Advanced tools
React hooks and providers for Universal Wallet Connector.
npm install @meshconnect/uwc-react @meshconnect/uwc-core @meshconnect/uwc-types @meshconnect/uwc-constants
import { ConnectionProvider } from '@meshconnect/uwc-react'
import { mainnetNetwork, baseNetwork } from '@meshconnect/uwc-constants'
import type { WalletMetadata } from '@meshconnect/uwc-types'
// Define your wallets
const wallets: WalletMetadata[] = [
{
id: 'metamask',
name: 'MetaMask',
metadata: {
icon: 'https://...',
description: 'Connect with MetaMask'
},
extensionInjectedProvider: {
supportedNetworkIds: ['eip155:1', 'eip155:8453'],
// ... other config
},
walletConnectProvider: {
supportedNetworkIds: ['eip155:1', 'eip155:8453']
}
}
]
function App() {
return (
<ConnectionProvider
networks={[mainnetNetwork, baseNetwork]}
wallets={wallets}
usingIntegratedBrowser={false}
>
{/* Your app */}
</ConnectionProvider>
)
}
Connect to a specific wallet with different connection modes:
import { useConnection } from '@meshconnect/uwc-react'
function WalletButton({ walletId }: { walletId: string }) {
const { walletConnect, injected } = useConnection(walletId)
return (
<div>
{/* Injected connection */}
<button
onClick={() => injected.connect()}
disabled={injected.isLoading}
>
{injected.isLoading ? 'Connecting...' : 'Connect with Browser'}
</button>
{/* WalletConnect connection */}
<button
onClick={() => walletConnect.connect()}
disabled={walletConnect.isLoading}
>
{walletConnect.isLoading ? 'Connecting...' : 'Connect with WalletConnect'}
</button>
{/* Show QR code URI when available */}
{walletConnect.connectionURI && (
<div>Connection URI: {walletConnect.connectionURI}</div>
)}
</div>
)
}
Switch between available networks:
import { useSwitchNetwork, useSession } from '@meshconnect/uwc-react'
function NetworkSwitcher() {
const { switchNetwork, isLoading, isWaitingForUserApproval } = useSwitchNetwork()
const session = useSession()
return (
<div>
<p>Current network: {session.activeNetwork?.name}</p>
<button
onClick={() => switchNetwork('eip155:1')}
disabled={isLoading}
>
{isWaitingForUserApproval
? 'Waiting for approval...'
: isLoading
? 'Switching...'
: 'Switch to Mainnet'}
</button>
</div>
)
}
Disconnect from the current wallet:
import { useDisconnect } from '@meshconnect/uwc-react'
function DisconnectButton() {
const { disconnect, isLoading } = useDisconnect()
return (
<button onClick={disconnect} disabled={isLoading}>
{isLoading ? 'Disconnecting...' : 'Disconnect'}
</button>
)
}
Access the current session state:
import { useSession } from '@meshconnect/uwc-react'
function SessionInfo() {
const session = useSession()
return (
<div>
<p>Connected: {session.activeAddress ? 'Yes' : 'No'}</p>
<p>Address: {session.activeAddress}</p>
<p>Network: {session.activeNetwork?.name}</p>
<p>Wallet: {session.activeWallet?.name}</p>
<p>Mode: {session.connectionMode}</p>
</div>
)
}
Access available wallets and networks:
import { useWallets, useNetworks } from '@meshconnect/uwc-react'
function WalletList() {
const wallets = useWallets()
const networks = useNetworks()
return (
<div>
<h3>Available Wallets:</h3>
{wallets.map(wallet => (
<div key={wallet.id}>
{wallet.name}
</div>
))}
<h3>Available Networks:</h3>
{networks.map(network => (
<div key={network.id}>
{network.name}
</div>
))}
</div>
)
}
Provider component that initializes the UniversalWalletConnector and provides it to child components.
Props:
networks: Network[]
- Array of supported networkswallets: WalletMetadata[]
- Array of supported walletsusingIntegratedBrowser?: boolean
- Whether using integrated browser (default: false)walletConnectConfig?: WalletConnectConfig
- Optional WalletConnect configurationReturns an object with connection methods for both injected and WalletConnect modes.
Returns methods and state for switching networks.
Returns disconnect method and loading state.
Returns the current session state.
Returns the list of available wallets.
Returns the list of available networks.
FAQs
React hooks and components for Universal Wallet Connector
The npm package @meshconnect/uwc-react receives a total of 459 weekly downloads. As such, @meshconnect/uwc-react popularity was classified as not popular.
We found that @meshconnect/uwc-react demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 13 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
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.