diff --git a/.changeset/selfish-jeans-teach.md b/.changeset/selfish-jeans-teach.md new file mode 100644 index 0000000000..5cf070c896 --- /dev/null +++ b/.changeset/selfish-jeans-teach.md @@ -0,0 +1,7 @@ +--- +"@wagmi/connectors": patch +"@wagmi/core": patch +"wagmi": patch +--- + +Removed required namespaces from WalletConnect connector diff --git a/packages/connectors/src/walletConnect.ts b/packages/connectors/src/walletConnect.ts index 4362adf35c..e86be991ec 100644 --- a/packages/connectors/src/walletConnect.ts +++ b/packages/connectors/src/walletConnect.ts @@ -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)) @@ -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, @@ -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,