forked from WalletConnect/walletconnect-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request WalletConnect#1209 from WalletConnect/feat/namespaces
Feat/namespaces
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters