Skip to content

super622/Web3-Simple-App

Repository files navigation

web3-react-simple-app

This is a simple, structured sample of using web3-react.

The app fetches the block number and some basic information about DAI token, demonstrating use of basic functions and contract interactions.

Use-cases

The app demonstrates the following use-cases:

  1. A MetaMask user who has previously authorized the app will be automatically signed in with their current account if their MetaMask is unlocked.
  2. Otherwise:
    • the user will be connected to the Ethereum network using a NetworkConnector to retrieve the block number and basic information about DAI token;
    • the user will be presented with a "Connect with MetaMask" button that allows them to unlock / connect their account.
  3. Should the user unlock their MetaMask while on the website, the app will not change state until the user clicks "Connect with MetaMask".
  4. Should the user lock their MetaMask while on the website, they will be logged out of the app automatically.

Show me the code

See features/web3 for the web3-react setup. Note that Web3Provider wraps App in index.tsx, and a Web3ConnectionManager wraps the rest of the app in App.tsx.

Notes

Other web3-react Projects

Contributing

Feel like you can improve this example? PRs are welcome! Just remember that this is intended as starter code. :)

Contributors & Acknowledgements

Contributors:

Wouldn't be possible without:

License

See UNLICENSE for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published