Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove web3-react dependency #409

Closed
tt-marek opened this issue Nov 20, 2021 · 3 comments
Closed

Remove web3-react dependency #409

tt-marek opened this issue Nov 20, 2021 · 3 comments

Comments

@tt-marek
Copy link
Contributor

tt-marek commented Nov 20, 2021

It feels like it is time to remove web3-react and create own state machine to manage connection state.

Motivation

  1. Unwanted warnings (see eip-1193 - Invalid contract call: address=.... "MetaMask: 'ethereum.send(...)' is deprecated and may be removed in the future. Please use 'ethereum.sendAsync(...)' or 'ethereum.request(...)' instead." #342)
  2. web3-react connectors add complexity are mostly unused, make it difficult to integrate with web3modal
    (related An "official" example of using useDapp with "Web3Modal" in the useDapp docs would increase adoption a lot #345, Improve Docs of useEthers hook #332, Provide useRPC hook to allow dynamic change of RPC provider #282, WalletConnect integration - any idea guys? #292)
  3. Lack of support for multiple networks connections (related Advanced config: Multichain support, useContracts and hooks overrides #132)
  4. Poor error management (see doc, [question] how to catch metamask errors correctly #337)
  5. Challenges in getting issues resolved/PRs merged

Implementation proposal

Only one (or zero) network can be active for writing while multiple networks can be active for reading.
Use activate(provider) to switch active networks.

Configuration

New configuration format:

const config: Config = {
    writeNetworks: [Mainnet],
    readNetworks: [{
      network: Mainnet,
      url: 'https://mainnet.infura.io/v3/62687d1a985d4508b2b7a24827551934',
      provider: [],
      default: true
    }]
}

Error handling

const {errors} = useEthers();

Returns an array of typed errors ConnectionError[], related to connection.

Errors will disappear once the reason is not valid anymore (e.g. activation failed is cleared by the next successful activations)

@jhirn
Copy link

jhirn commented Nov 23, 2021

I'd be all for this as web3-react seems to not be updated very frequently and troubleshooting issues with useDapp is quite an exercise on determining if the problem is here, there, or all the way in ethers.

useDapp has been an amazing library. I thank you for your efforts on it.

@gsteenkamp89
Copy link
Contributor

Yeah web3-react seems to not be actively maintained. The Ledger connector is using deprecated U2F browser API, so direct Ledger support is currently not possible with useDapp while web3-react is a dependency. This kind of issue is likely to get worse and worse very quickly as that repo becomes stale..

@JayWelsh
Copy link
Contributor

JayWelsh commented Feb 1, 2022

I think this issue can be closed now 🌈

@tt-marek tt-marek closed this as completed Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants