# @walletconnect/universal-provider

> Universal Provider for WalletConnect Protocol

Latest version **2.24.0** (published 2026-08-28) · SEE LICENSE IN LICENSE.md license · 0 weekly downloads

## Install

```sh
npm install @walletconnect/universal-provider
pnpm add @walletconnect/universal-provider
yarn add @walletconnect/universal-provider
bun add @walletconnect/universal-provider
```

## Health

**Score 75/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.24.0 |
| Published | 2026-08-28 |
| First published | 2022-08-30 |
| Weekly downloads | 0 |
| License | SEE LICENSE IN LICENSE.md |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 12 |
| Unpacked size | 2.5 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 1685 |
| Author | WalletConnect, Inc. |
| Maintainers | cyberdrk, reown-npm-org |
| Keywords | wallet, walletconnect |

## Links

- npm: https://www.npmjs.com/package/@walletconnect/universal-provider
- Repository: https://github.com/WalletConnect/walletconnect-monorepo
- Homepage: https://github.com/walletconnect/walletconnect-monorepo/
- Issues: https://github.com/WalletConnect/walletconnect-monorepo/issues
- npm.io page: https://npm.io/package/@walletconnect/universal-provider

## Dependencies (12)

- [events](https://npm.io/package/events.md) 3.3.0
- [es-toolkit](https://npm.io/package/es-toolkit.md) 1.45.1
- [@walletconnect/types](https://npm.io/package/@walletconnect/types.md) 2.24.0
- [@walletconnect/utils](https://npm.io/package/@walletconnect/utils.md) 2.24.0
- [@walletconnect/events](https://npm.io/package/@walletconnect/events.md) 1.0.1
- [@walletconnect/logger](https://npm.io/package/@walletconnect/logger.md) 3.0.2
- [@walletconnect/sign-client](https://npm.io/package/@walletconnect/sign-client.md) 2.24.0
- [@walletconnect/jsonrpc-types](https://npm.io/package/@walletconnect/jsonrpc-types.md) 1.0.4
- [@walletconnect/jsonrpc-utils](https://npm.io/package/@walletconnect/jsonrpc-utils.md) 1.0.8
- [@walletconnect/keyvaluestorage](https://npm.io/package/@walletconnect/keyvaluestorage.md) 1.1.1
- [@walletconnect/jsonrpc-provider](https://npm.io/package/@walletconnect/jsonrpc-provider.md) 1.0.14
- [@walletconnect/jsonrpc-http-connection](https://npm.io/package/@walletconnect/jsonrpc-http-connection.md) 1.0.8

## Recent versions

- 2.24.0 (latest) — 2026-08-28
- 2.23.9-canary-2 (canary) — 2026-06-22
- 2.10.4-184f2234 (experimental) — 2023-10-26
- 2.0.0-rc.2 (rc) — 2022-08-30
- 2.23.10 — 2026-06-24
- 2.23.9-canary-1 — 2026-04-07
- 2.23.9 — 2026-03-27
- 2.23.9-canary-rc-0 — 2026-03-27
- 2.23.8 — 2026-03-10
- 2.23.7 — 2026-02-27
- 2.23.6-canary-exp-1 — 2026-02-23
- 2.23.6 — 2026-02-18
- 2.23.5 — 2026-02-11
- 2.23.4 — 2026-01-21
- 2.23.3 — 2026-01-14
- … 487 more at https://npm.io/package/@walletconnect/universal-provider/versions

## README

# @walletconnect/universal-provider

Universal Provider for WalletConnect Protocol

## Usage

```typescript
import { ethers } from "ethers";
import UniversalProvider from "@walletconnect/universal-provider";

//  Initialize the provider
const provider = await UniversalProvider.init({
  logger: "info",
  relayUrl: "ws://<relay-url>",
  projectId: "12345678",
  metadata: {
    name: "React App",
    description: "React App for WalletConnect",
    url: "https://walletconnect.com/",
    icons: ["https://avatars.githubusercontent.com/u/37784886"],
  },
  client: undefined, // optional instance of @walletconnect/sign-client
});

//  create sub providers for each namespace/chain
await provider.connect({
  namespaces: {
    eip155: {
      methods: [
        "eth_sendTransaction",
        "eth_signTransaction",
        "eth_sign",
        "personal_sign",
        "eth_signTypedData",
      ],
      chains: ["eip155:80001"],
      events: ["chainChanged", "accountsChanged"],
      rpcMap: {
        80001:
          "https://rpc.walletconnect.org?chainId=eip155:80001&projectId=<your walletconnect project id>",
      },
    },
    pairingTopic: "<123...topic>", // optional topic to connect to
    skipPairing: false, // optional to skip pairing ( later it can be resumed by invoking .pair())
  },
});

//  Create Web3 Provider
const web3Provider = new ethers.providers.Web3Provider(provider);
```

## Events

```typescript
// Subscribe for pairing URI
provider.on("display_uri", (uri) => {
  console.log(uri);
});

// Subscribe to session ping
provider.on("session_ping", ({ id, topic }) => {
  console.log(id, topic);
});

// Subscribe to session event
provider.on("session_event", ({ event, chainId }) => {
  console.log(event, chainId);
});

// Subscribe to session update
provider.on("session_update", ({ topic, params }) => {
  console.log(topic, params);
});

// Subscribe to session delete
provider.on("session_delete", ({ id, topic }) => {
  console.log(id, topic);
});
```

## Provider Methods

```typescript
interface RequestArguments {
  method: string;
  params?: any[] | undefined;
}

// Send JSON RPC requests

/**
 * @param payload
 * @param chain - optionally specify which chain should handle this request
 * in the format `<namespace>:<chainId>` e.g. `eip155:1`
 */
const result = await provider.request(payload: RequestArguments, chain: string | undefined);
```

## Multi-chain

```typescript
const web3 = new Web3(provider);

// default chainId is the FIRST chain during setup
const chainId = await web3.eth.getChainId();

// set the default chain to 56
provider.setDefaultChain(`eip155:56`, rpcUrl?: string | undefined);

// get the updated default chainId
const updatedDefaultChainId = await web3.eth.getChainId();

```

## Creating a provider file

- Create a file under `providers/universal-provider/src/providers/<NAMESPACE>.ts`
- Implement the `IProvider` interface
- In the `IProvider.request` method, there should be a check for whether or not
  to run the request against the wallet or the blockchain.
  `this.namespace.methods` should only contain the methods supported by the
  wallet.
- The rest of the methods of the class are very similar, mainly centering around
  httpProvider and for the most part will be 90% similar to other providers
  given similar structure of chainId. For example `eip155:1` or
  `solana:mainnetBeta`.
- Export provider under `providers/universal-provider/src/providers/index.ts`

---
_Source: https://npm.io/package/@walletconnect/universal-provider · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
