# @walletconnect/web3wallet

> Web3Wallet for WalletConnect Protocol

Latest version **1.16.1** (published 2024-10-09) · Apache-2.0 license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @walletconnect/web3wallet
pnpm add @walletconnect/web3wallet
yarn add @walletconnect/web3wallet
bun add @walletconnect/web3wallet
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.16.1 |
| Published | 2024-10-09 |
| First published | 2022-12-19 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 8 |
| Unpacked size | 3.3 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | WalletConnect, Inc. |
| Maintainers | zoruka, magiziz, enesozturk, lukaisailovic, cyberdrk, nachosan, huxwell, chris13524, devceline, gancho_walletconnect, bkrem, pedrouid |
| Keywords | wallet, walletconnect |

## Links

- npm: https://www.npmjs.com/package/@walletconnect/web3wallet
- Homepage: https://github.com/walletconnect/walletconnect-monorepo/
- npm.io page: https://npm.io/package/@walletconnect/web3wallet

## Dependencies (8)

- [@walletconnect/core](https://npm.io/package/@walletconnect/core.md) 2.17.1
- [@walletconnect/types](https://npm.io/package/@walletconnect/types.md) 2.17.1
- [@walletconnect/utils](https://npm.io/package/@walletconnect/utils.md) 2.17.1
- [@walletconnect/logger](https://npm.io/package/@walletconnect/logger.md) 2.1.2
- [@walletconnect/auth-client](https://npm.io/package/@walletconnect/auth-client.md) 2.1.2
- [@walletconnect/sign-client](https://npm.io/package/@walletconnect/sign-client.md) 2.17.1
- [@walletconnect/jsonrpc-utils](https://npm.io/package/@walletconnect/jsonrpc-utils.md) 1.0.8
- [@walletconnect/jsonrpc-provider](https://npm.io/package/@walletconnect/jsonrpc-provider.md) 1.0.14

## Recent versions

- 1.16.1 (latest) — 2024-10-09
- 1.16.1-canary-0 (canary) — 2024-10-09
- 1.16.1-rc-0 — 2024-10-09
- 1.16.0-canary-0 — 2024-10-07
- 1.16.0 — 2024-10-01
- 1.16.0-rc-1 — 2024-10-01
- 1.16.0-rc-0 — 2024-10-01
- 1.15.3-rc-tma-1 — 2024-09-30
- 1.15.3-rc-tma-0 — 2024-09-30
- 1.15.3 — 2024-09-30
- 1.15.3-canary-d3b9bd78 — 2024-09-27
- 1.15.2-canary-tma-3 — 2024-09-25
- 1.15.2-canary-tma-2 — 2024-09-25
- 1.15.2-canary-tma-1 — 2024-09-19
- 1.15.2 — 2024-09-18
- … 134 more at https://npm.io/package/@walletconnect/web3wallet/versions

## README

# @walletconnect/web3wallet

## Description

The Web3Wallet SDK streamlines the integration process, making it easier for wallet developers to include the authentication and transaction signing features necessary for their users to connect and interact with all sorts of apps — now and in the future.

## Getting Started

### Install

```
npm install @walletconnect/web3wallet
```

### Wallet Usage

1. Initialization

```javascript
import { Core } from "@walletconnect/core";
import { Web3Wallet } from "@walletconnect/web3wallet";

const core = new Core({
  projectId: process.env.PROJECT_ID,
});

const web3wallet = await Web3Wallet.init({
  core, // <- pass the shared `core` instance
  metadata: {
    name: "Demo app",
    description: "Demo Client as Wallet/Peer",
    url: "www.walletconnect.com",
    icons: [],
  },
});
```

2. Sign Session Approval

```javascript
web3wallet.on("session_proposal", async (proposal) => {
  const session = await web3wallet.approveSession({
    id: proposal.id,
    namespaces,
  });
});
await web3wallet.core.pairing.pair({ uri });
```

3. Sign Session Rejection

```javascript
web3wallet.on("session_proposal", async (proposal) => {
  const session = await web3wallet.rejectSession({
    id: proposal.id,
    reason: getSdkError("USER_REJECTED_METHODS"),
  });
});
```

4. Sign Session Disconnect

```javascript
await web3wallet.disconnectSession({
  topic,
  reason: getSdkError("USER_DISCONNECTED"),
});
```

5. Responding to Sign Session Requests

```javascript
web3wallet.on("session_request", async (event) => {
  const { id, method, params } = event.request;
  await web3wallet.respondSessionRequest({ id, result: response });
});
```

6. Updating a Sign Session

```javascript
await web3wallet.updateSession({ topic, namespaces: newNs });
```

7. Updating a Sign Session

```javascript
await web3wallet.extendSession({ topic });
```

8. Emit Sign Session Events

```javascript
await web3wallet.emitSessionEvent({
  topic,
  event: {
    name: "accountsChanged",
    data: ["0xab16a96D359eC26a11e2C2b3d8f8B8942d5Bfcdb"],
  },
  chainId: "eip155:1",
});
```

9. Handle Sign Events

```javascript
web3wallet.on("session_proposal", handler);
web3wallet.on("session_request", handler);
web3wallet.on("session_delete", handler);
```

10. SIWE with a dapp

```javascript
const iss = `did:pkh:eip155:1:${address}`;
web3wallet.on("auth_request", async (event) => {
  // format the payload
  const message = web3wallet.formatMessage(event.params.cacaoPayload, iss);
  // prompt the user to sign the message
  const signature = await wallet.signMessage(message);
  // respond
  await web3wallet.respondAuthRequest(
    {
      id: args.id,
      signature: {
        s: signature,
        t: "eip191",
      },
    },
    iss,
  );
});

await web3wallet.core.pairing.pair({ uri: request.uri, activatePairing: true });
```

11. Handle Auth Events

```javascript
web3wallet.on("auth_request", handler);
```

## Already using Sign or Auth? Check our [migration guide](https://github.com/WalletConnect/web-examples/tree/main/wallets/react-web3wallet#migrate-from-sign-client-to-web3wallet)

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