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

fix(wallet-connect): allow the first chain id to be optional during connector init #470

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading