2.2.2 • Published 3 years ago

react-wallet v2.2.2

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

@sovryn/react-wallet

NPM JavaScript Style Guide

Install

npm install --save @sovryn/react-wallet

Usage

Wrap your app with the WalletProvider and use React.useContext(WalletContext) to get the current wallet connection state and useful functions. Then either you use the WalletButton component to connect, call the connect function or the unlock functions from the WalletContext.

import React, { Component, useContext } from 'react';

import { WalletProvider, WalletButton, WalletContext } from '@sovryn/react-wallet';
import '@sovryn/react-wallet/index.css'

class App extends Component {
  render() {
    return <WalletProvider options={chainId:30, remember: true}><Home /></WalletProvider>
  }
}

class Home extends Component {
  const { address } = useContext(WalletContext);
  render() {
    return <>{!address ? <WalletButton /> : <p>Connected with {address}</p>)}</>
  }
}

License

MIT © grinry