Skip to content
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.

Commit

Permalink
fix(wallet-connect): allow the first chain id to be optional during c…
Browse files Browse the repository at this point in the history
…onnector init
  • Loading branch information
ElvisKrop committed Aug 8, 2023
1 parent f62be25 commit 020fc97
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/connectors/src/walletConnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,8 @@ export class WalletConnectConnector extends Connector<
async #initProvider() {
const { EthereumProvider, OPTIONAL_EVENTS, OPTIONAL_METHODS } =
await import('@walletconnect/ethereum-provider')
const [defaultChain, ...optionalChains] = this.chains.map(({ id }) => id)
if (defaultChain) {
const allChainIds = this.chains.map(({ id }) => id)
if (allChainIds.length > 0) {
const {
projectId,
showQrModal = true,
Expand All @@ -301,8 +301,8 @@ export class WalletConnectConnector extends Connector<
projectId,
optionalMethods: OPTIONAL_METHODS,
optionalEvents: OPTIONAL_EVENTS,
chains: [defaultChain],
optionalChains: optionalChains.length ? optionalChains : undefined,
chains: allChainIds.length === 1 ? allChainIds : undefined,
optionalChains: allChainIds,
rpcMap: Object.fromEntries(
this.chains.map((chain) => [
chain.id,
Expand Down

0 comments on commit 020fc97

Please sign in to comment.