@sovryn/react-wallet

2.2.23 • 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 @sovryn/react-wallet

Weekly Downloads

27

Version

2.2.23

License

MIT

Unpacked Size

3.24 MB

Total Files

58

Last publish

Collaborators

  • soulbit
  • victor-creed
  • pietro.maximoff
  • grinry