react-wallet

2.2.2 • Public • Published

@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

Readme

Keywords

none

Package Sidebar

Install

npm i react-wallet

Weekly Downloads

0

Version

2.2.2

License

MIT

Unpacked Size

1.69 MB

Total Files

121

Last publish

Collaborators

  • 6uzmen