
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@web3-ui/components
Advanced tools
A set of React components made for web3-specific use cases. Fully compatible with and built on top of ChakraUI.
yarn add @web3-ui/components ethers
At the root of your React app, wrap your app in the <Provider>
component:
// _app.tsx (or the root of your app)
import { Provider } from '@web3-ui/components';
// Passing in a theme is optional
function MyApp({ Component, pageProps }) {
return (
<Provider theme={yourChakraTheme}>
<Component {...pageProps} />
</Provider>
);
}
This is the list of components the package currently provides:
The Address component takes in an Ethereum address or ENS name and displays it in a human-readable format.
<Address value='dhaiwat.eth' shortened copiable>
shortened
and copiable
are optional props.
The AddressInput component is an input for Ethereum addresses. It supports ENS names too.
<AddressInput value={value} onChange={setValue} provider={provider} />
You need to pass in a provider
prop if you want to use ENS names.
The NFT component takes in the contract address and the token ID of an NFT and displays it as a card. You can also pass in isTestnet
to fetch the NFT data from the testnet API (only Rinkeby for now).
<NFT contractAddress="0xxxxx0x0x0x0x0x" tokenId={30} size="md" />
The size
prop is optional.
The NFTGallery component renders a grid of all the NFTs owned by an account. It accepts ENS names too. You can also pass in isTestnet
to fetch the NFT data from the testnet API (only Rinkeby for now).
<NFTGallery address="vitalik.eth" web3Provider={provider} gridWidth={4} />
You need to pass in a web3Provider
if you want to support ENS names. We know this is not ideal and are fixing it.
gridWidth
is an optional prop.
The Provider component is the web3-ui
equivalent of ChakraUI's ChakraProvider
component. You need to wrap this component around your entire App. See Getting Started for an example.
EtherInput is an input field that accepts values in wei or ether. It always returns the value to you in wei so that you can easily use it to interact with contracts without any conversions.
const [value, setValue] = useState();
<EtherInput value={value} setValue={setValue} unit="ether" />; // value will always be in wei. eg. if someone enters 1 in the input, value will be 10^18
TokenBalance is a stateless component that displays the name, symbol, balance, and USD value of an ERC20 token.
<TokenBalance
name="Devs 4 Revolution"
symbol="$CODE"
balance={200}
usdValue={100}
imgUrl={D_D_LOGO}
/>
FAQs
React UI components for web3
We found that @web3-ui/components demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.