Coder Social home page Coder Social logo

rollquaye / web3-react Goto Github PK

View Code? Open in Web Editor NEW

This project forked from symbiosis-finance/web3-react

0.0 0.0 0.0 3.24 MB

A simple, maximally extensible, dependency minimized framework for building modern Ethereum dApps

Home Page: https://web3-react-mu.vercel.app/

License: GNU General Public License v3.0

JavaScript 0.83% TypeScript 99.17%

web3-react's Introduction

web3-react (beta)

CI

Looking for the prior version of this library? It's available on the v6 branch.

This is a hosted version of packages/example.

Packages

Package Version Size Link
@web3-react/types npm minzip
@web3-react/store npm minzip
@web3-react/core npm minzip
Connectors
@web3-react/eip1193 npm minzip EIP-1193
@web3-react/empty npm minzip
@web3-react/metamask npm minzip MetaMask
@web3-react/network npm minzip
@web3-react/url npm minzip
@web3-react/walletconnect npm minzip WalletConnect
@web3-react/walletlink npm minzip WalletLink
Experimental Connectors Not stable
@web3-react/frame npm minzip Frame
@web3-react/magic npm minzip Magic

Getting Started

  • yarn
  • yarn bootstrap
  • yarn start

In addition to compiling each package in watch mode, this will also spin up packages/example on localhost:3000.

Running Tests

  • yarn test --watch

Documentation

This version of web3-react is still in beta, so unfortunately documentation is pretty sparse at the moment. packages/example, TSDoc comments, and the source code itself are the best ways to get an idea of what's going on. More thorough documentation is a priority as development continues!

Upgrading Connector Dependencies

Some connectors have one or more dependencies that are specific to the connection method in question. For example, the walletconnect connector relies on @walletconnect/ethereum-provider package to handle a lot of the connection logic. Often, you may wish to upgrade to the latest version of a client package, to take advantage of the latest features. web3-react makes the process of upgrading client packages fairly painless by specifying them as peerDependencies. This means that you have to explicitly install client packages, and therefore may transparently switch between any version that agrees with the semver specified in the connector (usually any matching major).

Adding Connectors

If you're interested in using web3-react with a wallet that doesn't have an "official" connector package, you're in luck! This library was designed to be highly modular, and you should be able to draw inspiration from the existing connectors to write your own! That code can live inside your codebase, or even be published as a standalone package. From time to time, if there's sufficient interest and desire, PRs adding new connectors may be accepted, but this should be brought up in an issue or discussion beforehand.

Upgrading from v6

While the internals of web3-react have changed fairly dramatically between v6 and v8, the hope is that usage don't have to change too much when upgrading. Once you've migrated to the new connectors and state management patterns, you should be able to use the hooks defined in @web3-react/core, in particular useWeb3React (or usePriorityWeb3React), as more or less drop-in replacements for the v6 hooks. The big benefit in v8 is that hooks are now per-connector, as opposed to global, so no more juggling between connectors/multiple roots!

Useful Commands

Add a dependency

  • yarn lerna add <DEPENDENCY> --scope <PACKAGE>

Remove a dependency

  • Delete the relevant package.json entry

Because of a lerna bug, it's not possible to prune yarn.lock programmatically, so regenerate it manually:

  • yarn lerna exec "rm -f yarn.lock" --scope <SUBPACKAGE>
  • yarn clean --scope <SUBPACKAGE>
  • yarn bootstrap

web3-react's People

Contributors

noahzinsmeister avatar chaitanyapotti avatar dependabot[bot] avatar brendanww avatar bpierre avatar adrianleb avatar alex-miller-0 avatar cwhinfrey avatar miguelmota avatar pedrouid avatar rollquaye avatar kyzia551 avatar anxolin avatar conlan avatar denhampreen avatar horodnicdragos avatar jasoons avatar jeffhuys avatar kimpers avatar makoto avatar moodysalem avatar petejkim avatar sammdec avatar samajammin avatar skylarbarrera avatar tarrencev avatar vishnumad avatar jgerulskis avatar mrq1911 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.