Skip to content

Commit

Permalink
Merge pull request WalletConnect#1209 from WalletConnect/feat/namespaces
Browse files Browse the repository at this point in the history
Feat/namespaces
  • Loading branch information
glitch-txs authored Nov 29, 2023
2 parents 8d9aa98 + ab64c71 commit f5b2b0e
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
47 changes: 47 additions & 0 deletions docs/advanced/migration-from-v1.x/namespaces.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Namespaces

## What are Namespaces?

The WalletConnect protocol v2.0 was designed with a better web3 end-user experience in mind, with the goal of being chain-, event-, method-, and even wallet-agnostic. To achieve this, WalletConnect v2.0 exposes a developer-friendly abstraction called [“namespaces”](https://docs.walletconnect.com/advanced/glossary#namespaces), designed in accordance with [CAIP-25](https://github.com/ChainAgnostic/CAIPs/blob/main/CAIPs/caip-25.md).

During the WalletConnect v2.0 migration, many apps opted to require all of the most critical chains, methods, and events at first connection (i.e. required namespaces), leaving others as optional for end user flexibility (i.e. optional namespaces). While this implementation works well for many wallets, it creates challenges for others. This includes smart contract wallets like Safe as well as non-smart contract wallets that also run on only one chain at a time as a matter of design.

## Technical Implementation Guide

Please follow the instructions according to your setup.

### Ethereum Provider package
If you’re an app developer that uses the Ethereum provider package, we recommend the following:

Move all chains to optionalChains and leave the chains property as undefined/unset.
Set Events and Methods to undefined/unset.

optionalMethods and optionalEvents are populated by default by the library, so you don’t need to add them unless you’d like to be selective on which methods and events are proposed for sessions.
Implementation example:

```ts
const provider = await EthereumProvider.init({
projectId: 'YOUR_PROJECT_ID',
optionalChains:[1, 5, 56, 42161, 137],
showQrModal: true,
metadata: {
name: "My Dapp",
description: "My Dapp description",
url: "<https://my-dapp.com>",
icons: ["<https://my-dapp.com/logo.png>"],
},
})
```

### Web3Modal SDK

Update wagmi to version 1.4.8 or higher. Please note that this version will be released on December 7.

```bash npm2yarn
npm install wagmi@latest
```

### Wagmi - WalletConnectConnector

Update wagmi to version 1.4.8 or higher. Please note that this version will be released on December 7.

5 changes: 5 additions & 0 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,11 @@ module.exports = {
id: 'advanced/migration-from-v1.x/overview',
label: 'Overview'
},
{
type: 'doc',
id: 'advanced/migration-from-v1.x/namespaces',
label: 'Namespaces'
},
{
type: 'category',
label: 'Dapps',
Expand Down

0 comments on commit f5b2b0e

Please sign in to comment.