1.4.4 • Published 2 years ago

react-open-wallet v1.4.4

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

react-open-wallet

NPM JavaScript Style Guide

Install

npm install --save react-open-wallet

Normal usage

ReactOpenWallet generate a styled button at the top of your component within a provider (at this time just works with MetaMask)

import React, { Component } from 'react'

import WalletProvider, { OpenWallet } from 'react-open-wallet'

class App extends Component {
  render() {
    return (
      <WalletProvider>
        <OpenWallet />
      </WalletProvider>
    )
  }
}

Advanced usage

If you want to control the flow of the wallet just set hideButton to true and use the context hook

app.tsx
import React, { Component } from 'react'

import ReactOpenWallet from 'react-open-wallet'

class App extends Component {
  render() {
    return (
      <WalletProvider>
        <Home />
      </WalletProvider>
    )
  }
}
home.tsx
import React, { Component } from 'react'

import { useWallet } from 'react-open-wallet'

class Home extends Component {
  const { requestAccount } = useWallet()

  render() {
    return (
      <button onClick={requestAccount}>Connect wallet</button>
    )
  }
}

Context props

NameTypeDefaultDescription
accountstring''Your current wallet address
checkWallet() => booleanvoidCheck if you have MetaMask installed
requestAccount() => voidvoidOpen MetaMask connect button

License

MIT © CryptopediaWeb3

1.4.4

2 years ago

1.4.3

2 years ago

1.4.2

2 years ago

1.4.1

2 years ago

1.3.1

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago