walletConnect | Wagmi (2024)

Connector for WalletConnect.

Import

ts

import { walletConnect } from '@wagmi/connectors'

Usage

ts

import { createConfig, http } from '@wagmi/core'import { mainnet, sepolia } from '@wagmi/core/chains'import { walletConnect } from '@wagmi/connectors'export const config = createConfig({ chains: [mainnet, sepolia], connectors: [ walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', }), ], transports: { [mainnet.id]: http(), [sepolia.id]: http(), },})

Parameters

ts

import { type WalletConnectParameters } from '@wagmi/connectors'

Check out the WalletConnect docs for more info. A few options are omitted that Wagmi manages internally.

customStoragePrefix @wagmi/connectors@>=5.1.8

string | undefined

Custom storage prefix for persisting provider state.

ts

import { walletConnect } from '@wagmi/connectors'const connector = walletConnect({ customStoragePrefix: 'wagmi',  projectId: '3fcc6bba6f1de962d911bb5b5c3dba68',})

disableProviderPing

boolean | undefined

ts

import { walletConnect } from '@wagmi/connectors'const connector = walletConnect({ disableProviderPing: false,  projectId: '3fcc6bba6f1de962d911bb5b5c3dba68',})

isNewChainsStale

boolean | undefined

  • If a new chain is added to a previously existing configured connector chains, this flag will determine if that chain should be considered as stale. A stale chain is a chain that WalletConnect has yet to establish a relationship with (e.g. the user has not approved or rejected the chain).
  • Defaults to true.

ts

import { walletConnect } from '@wagmi/connectors'const connector = walletConnect({ isNewChainsStale: true,  projectId: '3fcc6bba6f1de962d911bb5b5c3dba68',})
More info

Preface: Whereas WalletConnect v1 supported dynamic chain switching, WalletConnect v2 requires the user to pre-approve a set of chains up-front. This comes with consequent UX nuances (see below) when a user tries to switch to a chain that they have not approved.

This flag mainly affects the behavior when a wallet does not support dynamic chain authorization with WalletConnect v2.

If true (default), the new chain will be treated as a stale chain. If the user has yet to establish a relationship (approved/rejected) with this chain in their WalletConnect session, the connector will disconnect upon the dapp auto-connecting, and the user will have to reconnect to the dapp (revalidate the chain) in order to approve the newly added chain. This is the default behavior to avoid an unexpected error upon switching chains which may be a confusing user experience (e.g. the user will not know they have to reconnect unless the dapp handles these types of errors).

If false, the new chain will be treated as a validated chain. This means that if the user has yet to establish a relationship with the chain in their WalletConnect session, wagmi will successfully auto-connect the user. This comes with the trade-off that the connector will throw an error when attempting to switch to the unapproved chain. This may be useful in cases where a dapp constantly modifies their configured chains, and they do not want to disconnect the user upon auto-connecting. If the user decides to switch to the unapproved chain, it is important that the dapp handles this error and prompts the user to reconnect to the dapp in order to approve the newly added chain.

metadata

CoreTypes.Metadata | undefined

Metadata related to the app requesting the connection.

ts

import { walletConnect } from '@wagmi/connectors'const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', metadata: {  name: 'Example',  description: 'Example website',  url: 'https://example.com',  }, })

projectId

string

WalletConnect Cloud project identifier. You can find your projectId on your WalletConnect dashboard.

ts

import { walletConnect } from '@wagmi/connectors'const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', })

qrModalOptions

QrModalOptions | undefined

Options for rendering QR modal.

ts

import { walletConnect } from '@wagmi/connectors'const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', qrModalOptions: {  themeMode: 'dark',  }, })

relayUrl

string | undefined

  • WalletConnect relay URL to use.
  • Defaults to 'wss://relay.walletconnect.com'.

ts

import { walletConnect } from '@wagmi/connectors'const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', relayUrl: 'wss://relay.walletconnect.org', })

storageOptions

KeyValueStorageOptions | undefined

ts

import { walletConnect } from '@wagmi/connectors'const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', storageOptions: {}, })

showQrModal

boolean | undefined

  • Whether to show the QR code modal upon calling connector.connect().
  • Defaults to true.

ts

import { walletConnect } from '@wagmi/connectors'const connector = walletConnect({ projectId: '3fcc6bba6f1de962d911bb5b5c3dba68', showQrModal: true, })

TIP

This can be disabled and you can listen for a 'message' event with payload { type: 'display_uri'; data: string } if you want to render your own QR code.

walletConnect | Wagmi (2024)
Top Articles
Best Algo Trading Strategies in 2024 - Findoc
Fundamental Analysis of Stocks | Definition & Explanation
Public Opinion Obituaries Chambersburg Pa
jazmen00 x & jazmen00 mega| Discover
Mr Tire Prince Frederick Md 20678
Flixtor The Meg
Jennette Mccurdy And Joe Tmz Photos
Boggle Brain Busters Bonus Answers
Acts 16 Nkjv
Vocabulario A Level 2 Pp 36 40 Answers Key
Osrs Blessed Axe
General Info for Parents
Trini Sandwich Crossword Clue
How Much Is Tj Maxx Starting Pay
Nebraska Furniture Tables
Top tips for getting around Buenos Aires
Walmart Windshield Wiper Blades
Tygodnik Polityka - Polityka.pl
Wausau Obits Legacy
Welcome to GradeBook
Tinker Repo
Homeaccess.stopandshop
Yog-Sothoth
Soulstone Survivors Igg
John Chiv Words Worth
Directions To Cvs Pharmacy
Roane County Arrests Today
Skycurve Replacement Mat
Fiona Shaw on Ireland: ‘It is one of the most successful countries in the world. It wasn’t when I left it’
Relaxed Sneak Animations
The Collective - Upscale Downtown Milwaukee Hair Salon
4.231 Rounded To The Nearest Hundred
Progressbook Newark
Halsted Bus Tracker
Housing Assistance Rental Assistance Program RAP
Shnvme Com
T&J Agnes Theaters
Family Fare Ad Allendale Mi
Topos De Bolos Engraçados
Qlima© Petroleumofen Elektronischer Laserofen SRE 9046 TC mit 4,7 KW CO2 Wächter • EUR 425,95
Trivago Sf
3 Zodiac Signs Whose Wishes Come True After The Pisces Moon On September 16
Despacito Justin Bieber Lyrics
Tableaux, mobilier et objets d'art
Why Are The French So Google Feud Answers
[Teen Titans] Starfire In Heat - Chapter 1 - Umbrelloid - Teen Titans
Europa Universalis 4: Army Composition Guide
Canvas Elms Umd
Brutus Bites Back Answer Key
Metra Union Pacific West Schedule
Tweedehands camper te koop - camper occasion kopen
Blippi Park Carlsbad
Latest Posts
Article information

Author: Prof. An Powlowski

Last Updated:

Views: 6063

Rating: 4.3 / 5 (64 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Prof. An Powlowski

Birthday: 1992-09-29

Address: Apt. 994 8891 Orval Hill, Brittnyburgh, AZ 41023-0398

Phone: +26417467956738

Job: District Marketing Strategist

Hobby: Embroidery, Bodybuilding, Motor sports, Amateur radio, Wood carving, Whittling, Air sports

Introduction: My name is Prof. An Powlowski, I am a charming, helpful, attractive, good, graceful, thoughtful, vast person who loves writing and wants to share my knowledge and understanding with you.