@nevermined-io/providers
v1.12.2
Published
--- sidebar_position: 1 title: Getting started description: Nevermined Providers Component API Reference ---
Downloads
74
Readme
sidebar_position: 1 title: Getting started description: Nevermined Providers Component API Reference
This library was generated with Nx.
Getting started
The providers
component exposes a package facilitating the interaction with Web3 providers like Metamask. You can see more about in the documentation
Providers supported
- Metamask
- WalletConnect
- Coinbase Wallet
Pre-requisites
The Nevermined providers is a package built with React and Typescript. It requires Node JS v14 or higher. You can find online instructions about How to install Node JS.
How to install ?
yarn add @nevermined-io/providers
or
npm install --save @nevermined-io/providers
How to integrate ?
import { WalletProvider, getClient, useWallet } from "@nevermined-io/providers";
import App from "app";
ReactDOM.render(
<div>
<WalletProvider
client={getClient()}
correctNetworkId={80001}
connectKitProps={
{
theme: 'auto',
mode: 'dark',
}
}
>
<App />
</WalletProvider>
</div>,
document.getElementById("root") as HTMLElement
);
How to use ?
const ConnectToMetaMask = () => {
const { login, walletAddress, getConnectors } = useWallet();
return (
<>
<div> {walletAddress}</div>
{!walletAddress && (
<button onClick={() => login(getConnectors()[0])}>Connect To MM</button>
)}
</>
);
};
You can find here a example
Running unit tests
Run nx test:unit provider