MCPcopy Index your code
hub / github.com/Uniswap/web3-react

github.com/Uniswap/web3-react @8.2.12

Chat with this repo
repository ↗ · DeepWiki ↗ · release 8.2.12 ↗ · + Follow
234 symbols 571 edges 59 files 31 documented · 13% updated 22mo ago★ 5,692150 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

web3-react (beta)

CI

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

Example

This is a hosted version of 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/gnosis-safe npm minzip Gnosis Safe
@web3-react/metamask npm minzip MetaMask
@web3-react/network npm minzip
@web3-react/url npm minzip
@web3-react/walletconnect-v2 npm minzip WalletConnect
@web3-react/coinbase-wallet npm minzip Coinbase Wallet
@web3-react-trust-wallet npm minzip Trust Wallet
@avalabs/web3-react-core-connector npm minzip Core Wallet
@venly/web3-react-venly npm minzip Venly

Get Started

  • yarn
  • yarn start

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

Run Tests

  • yarn build
  • yarn test --watch

Publish

  • yarn lerna publish [--dist-tag]

Documentation

This version of web3-react is still in beta, so unfortunately documentation is pretty sparse at the moment. /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).

Third-Party Connectors

The decision to publish a connector under the @web3-react namespace is fully up to the discretion of the team. However, third-party connectors are always welcome! 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 connector can live inside your codebase, or even be published as a standalone package. A selection of third-party connectors that have widespread usage may be featured below, PRs modifying this list are welcome.

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!

Extension points exported contracts — how you extend this code

ProviderRpcError (Interface)
(no doc) [1 implementers]
packages/types/src/index.ts
BasicChainInformation (Interface)
(no doc)
example/chains.ts
Props (Interface)
(no doc)
example/components/Card.tsx
GnosisSafeConstructorArgs (Interface)
(no doc)
packages/gnosis-safe/src/index.ts
NetworkConstructorArgs (Interface)
(no doc)
packages/network/src/index.ts
Web3ReactProviderProps (Interface)
(no doc)
packages/core/src/provider.tsx
UrlConstructorArgs (Interface)
(no doc)
packages/url/src/index.ts
WalletConnectConstructorArgs (Interface)
(no doc)
packages/walletconnect/src/index.ts

Core symbols most depended-on inside this repo

request
called by 23
packages/types/src/index.ts
createWeb3ReactStoreAndActions
called by 23
packages/store/src/index.ts
on
called by 22
packages/types/src/index.ts
activate
called by 16
packages/walletconnect-v2/src/index.ts
initializeConnector
called by 14
packages/core/src/hooks.ts
usePriorityConnector
called by 10
packages/core/src/hooks.ts
useAccounts
called by 10
packages/core/src/hooks.ts
getIndex
called by 9
packages/core/src/hooks.ts

Shape

Function 86
Method 72
Class 55
Interface 21

Languages

TypeScript100%

Modules by API surface

packages/core/src/hooks.ts41 symbols
packages/types/src/index.ts14 symbols
packages/metamask/src/index.ts12 symbols
packages/gnosis-safe/src/index.ts12 symbols
packages/coinbase-wallet/src/index.ts11 symbols
packages/walletconnect/src/index.ts10 symbols
packages/walletconnect-v2/src/index.ts10 symbols
packages/walletconnect-v2/src/index.spec.ts10 symbols
packages/core/src/hooks.spec.ts9 symbols
packages/eip1193/src/index.ts8 symbols
packages/walletconnect/src/utils.spec.ts7 symbols
packages/walletconnect-v2/src/utils.spec.ts7 symbols

Dependencies from manifests, versioned

@coinbase/wallet-sdk3.3.0 · 1×
@ethersproject/address5 · 1×
@ethersproject/bignumber5.6.0 · 1×
@ethersproject/experimental5.6.0 · 1×
@ethersproject/providers5.6.0 · 1×
@ethersproject/units5.6.0 · 1×
@metamask/detect-provider1.2.0 · 1×
@safe-global/safe-apps-provider0.17.1 · 1×
@safe-global/safe-apps-sdk8.0.0 · 1×
@tsconfig/recommended1.0.1 · 1×
@types/jest27.4.1 · 1×

For agents

$ claude mcp add web3-react \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact