Skip to content

Commit

Permalink
Remove required namespaces from WalletConnect Connector Wagmi v1 (#3276)
Browse files Browse the repository at this point in the history
* remove required namespaces from WalletConnect Connector

* add changeset

* wagmi patch
  • Loading branch information
glitch-txs authored Dec 7, 2023
1 parent 84074ab commit 83223a0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
7 changes: 7 additions & 0 deletions .changeset/selfish-jeans-teach.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@wagmi/connectors": patch
"@wagmi/core": patch
"wagmi": patch
---

Removed required namespaces from WalletConnect connector
14 changes: 5 additions & 9 deletions packages/connectors/src/walletConnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ export class WalletConnectConnector extends Connector<

await provider.connect({
pairingTopic,
chains: [targetChainId],
optionalChains: optionalChains.length ? optionalChains : undefined,
optionalChains: [targetChainId, ...optionalChains],
})

this.#setRequestedChainsIds(this.chains.map(({ id }) => id))
Expand Down Expand Up @@ -284,10 +283,10 @@ export class WalletConnectConnector extends Connector<
}

async #initProvider() {
const { EthereumProvider, OPTIONAL_EVENTS, OPTIONAL_METHODS } =
const { EthereumProvider } =
await import('@walletconnect/ethereum-provider')
const [defaultChain, ...optionalChains] = this.chains.map(({ id }) => id)
if (defaultChain) {
const optionalChains = this.chains.map(({ id }) => id) as [number]
if (optionalChains.length) {
const {
projectId,
showQrModal = true,
Expand All @@ -299,10 +298,7 @@ export class WalletConnectConnector extends Connector<
showQrModal,
qrModalOptions,
projectId,
optionalMethods: OPTIONAL_METHODS,
optionalEvents: OPTIONAL_EVENTS,
chains: [defaultChain],
optionalChains: optionalChains.length ? optionalChains : undefined,
optionalChains,
rpcMap: Object.fromEntries(
this.chains.map((chain) => [
chain.id,
Expand Down

2 comments on commit 83223a0

@vercel
Copy link

@vercel vercel bot commented on 83223a0 Dec 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@EkoiosChungLeduc
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain why you removed the required namespaces from WalletConnect Connector?

Please sign in to comment.