Skip to content

v0.3.1

Choose a tag to compare

@sambacha sambacha released this 26 Oct 21:03
· 49 commits to master since this release

Full Changelog: v0.3.0...v0.3.1

Features: use-react-wallet

a modern React Web3 Hook

use-react-wallet

React hook for connecting and interacting with Web3 Wallet Providers via OpenMEV RPC or any other RPC

Overview

Examples

Connect / Disconnect button

const ConnectWalletButton = () => {
  const { account, connect, disconnect } = useWallet();
  return <>
      {!account ? (
        <button onClick={() => connect()}>Connect Wallet</button>
      ) : (
        <button onClick={() => disconnect()}>Disconnect Wallet</button>
      )}
    </>;
}
Connecting

The connect function passes along an optional config to a Web3Modal instance for additional customization.

You can use the account information from useWallet anywhere inside your React app, without any extra set up.

const UserAddress = () => {
  const { account } = useWallet();
  if (!account) return null;
  return <>{account}</>;
}
Transaction Signing

To run a transaction or sign a message, use the provider object returned by the hook for connected wallets.

This is a standard Ethers.js Provider.

const SignMessageButton = () => {
  const { account, provider } = useWallet();
    if (!account) return null;
        const signMessage = async () => {
            const signature = await provider.getSigner().signMessage("Hello!");
            console.log(signature);
  }
  return <button onClick={signMessage}>Sign Message</>;
}

Changelog

All notable changes to this project will be documented in this file. Dates are displayed in UTC.

Generated by auto-changelog.

v0.3.1

26 October 2021

  • build(react-wallet): fix npm pkging 57cabec
  • release: use-react-wallet e3d04e6

v0.3.0

26 October 2021

  • npm(deps): bump @ethersproject/transactions from 5.4.0 to 5.5.0 #19
  • npm(deps): bump socket.io-client from 4.2.0 to 4.3.2 #14
  • feat(packages): react-wallet 31b46ea
  • fix(packages): config publish 2c05298

v0.2.2

14 October 2021

  • npm(deps): bump @grpc/grpc-js from 1.3.7 to 1.4.1 #12
  • fix(pkg): web3-connect 2530289
  • package updates 6b27286
  • chore(web3connect): deps fbfc908

v0.1.9

11 October 2021

v0.1.8

11 October 2021

  • chore(format): lint a99b347
  • feat(packages): web3connect providers f56370a

v0.1.7

6 October 2021

  • npm(deps): bump @ethersproject/bignumber from 5.4.1 to 5.4.2 #10
  • feat(utils): init pkg 47e3b24
  • release: v0.1.7 f7a6694
  • feat(openmev): API Collection 9ea2965

v0.1.6

4 October 2021

v0.1.5

27 September 2021

  • ci(actions): fix dependabot #9
  • build(deps): bump @grpc/proto-loader from 0.6.4 to 0.6.5 #8
  • build(sdk): json raw body c1ca27d
  • feat(packages): websocket connector 4d4e376
  • chore(lint): format 4a281b1

v0.1.4

15 September 2021

  • build(ts): generate exports dae6007
  • build(release): v0.1.4 0292847
  • feat(graphql): inital graphql support 12c36ef

v0.1.3

13 September 2021

v0.1.2

12 September 2021

v0.1.1

12 September 2021

v0.1.0

12 September 2021

v0.0.2

11 September 2021

  • feat(rpc): connection configuration d9600f0

v0.0.1

10 September 2021