@sovryn/react-wallet
v2.2.23
Published
Made with create-react-library
Downloads
99
Keywords
Readme
@sovryn/react-wallet
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