
Security News
Vite+ Joins the Push to Consolidate JavaScript Tooling
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
@voltz-protocol/react-web3-wallet
Advanced tools
Library that takes care of connecting to different web3 wallets.
Powering Voltz UI and beyond!!!
Library that takes care of connecting to different web3 wallets.
Statements | Branches | Functions | Lines |
---|---|---|---|
yarn
yarn storybook
In the UI world you should branch off main
when building a feature.
So just go on main
, pull latest and then branch out of it.
Create your PR against main
.
Branch naming is quite standard, we tried to duplicate what we have done for the committing messages, following standard commit message format: [https://www.conventionalcommits.org/en/v1.0.0/].
Branch names can start with the prefixes found in the regex under '.husky/pre-commit'.
DEVELOPING
main
, follow the naming convention for a branchmain
using Rebase and mergeHelpful tools to install to improve your development life!
Make sure the package and peerDependencies are installed:
yarn add @voltz-protocol/react-web3-wallet viem wagmi
First, we create a new config set up with the Injected (i.e. MetaMask), WalletConnect, and Coinbase Wallet connectors.
import { setup, WalletConfig } from '@voltz-protocol/react-web3-wallet';
// Set up wagmi config
const config = setup({
supportedChains: ['mainnet', 'goerli'],
supportedWallets: [{
type: 'metamask',
}, {
type: 'wallet-connect',
projectId: process.env.WALLET_CONNECT_PROJECT_ID,
}, {
type: 'coinbase',
appName: process.env.COINBASE_APP_NAME,
},],
});
// Pass config to React Context Provider
function App() {
return (
<WalletConfig config={config}>
<Profile />
</WalletConfig>
)
}
Let's create the needed Profile
component. Note this component uses brokoli-ui
components so make sure you have a ThemeProvider
wrapping the brokoli-ui
components
import { Button, ThemeProvider, Typography } from 'brokoli-ui';
import React, { useMemo } from 'react';
import { useWalletAccount, useWalletConnect } from '@voltz-protocol/react-web3-wallet';
// Pass config to React Context Provider
function Profile() {
const { connect, connectors, error } = useWalletConnect();
const { disconnect, ensName, ensAvatar, address, connector, isConnected } = useWalletAccount();
if (isConnected) {
return (
<div>
<img alt="ENS Avatar" src={ensAvatar!} />
<Typography colorToken="white100" typographyToken="primaryBodyMediumRegular">
{ensName ? `${ensName} (${address!})` : address}
</Typography>
<Typography colorToken="white100" typographyToken="primaryBodySmallRegular">
Connected to {connector?.name}{' '}
</Typography>
<Button variant="secondary" onClick={disconnect}>
Disconnect
</Button>
</div>
);
}
return (
<div style={{ display: 'flex', flexDirection: 'column', gap: '8px' }}>
{connectors.map((c) => (
<Button
key={c.id}
bottomLeftText={error ? error.message : ''}
bottomLeftTextColorToken="error100"
disabled={c.disabled}
variant="primary"
onClick={() => connect(c.id)}
>
{c.name}
{c.connecting && ' (connecting)'}
</Button>
))}
</div>
);
}
FAQs
Library that takes care of connecting to different web3 wallets.
We found that @voltz-protocol/react-web3-wallet demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
Security News
Ruby Central’s incident report on the RubyGems.org access dispute sparks backlash from former maintainers and renewed debate over project governance.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.