@nevermined-io/providers
TypeScript icon, indicating that this package has built-in type declarations

1.12.2 • Public • Published

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

/@nevermined-io/providers/

    Package Sidebar

    Install

    npm i @nevermined-io/providers

    Weekly Downloads

    7

    Version

    1.12.2

    License

    none

    Unpacked Size

    18.5 kB

    Total Files

    20

    Last publish

    Collaborators

    • aitorargomaniz