From 3cb12f8cc553773cf1cb6ce43b4051928fc3b533 Mon Sep 17 00:00:00 2001 From: Glitch <66949816+glitch-txs@users.noreply.github.com> Date: Fri, 15 Dec 2023 08:25:24 -0300 Subject: [PATCH] Make chains required & remove 0 chain config (#1553) Co-authored-by: Sven <38101365+svenvoskamp@users.noreply.github.com> --- packages/ethers/src/client.ts | 6 +++--- packages/ethers5/src/client.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/ethers/src/client.ts b/packages/ethers/src/client.ts index 088c5dcd0f..c5b35597ef 100644 --- a/packages/ethers/src/client.ts +++ b/packages/ethers/src/client.ts @@ -41,8 +41,8 @@ import type { CombinedProvider } from '@web3modal/scaffold-utils/ethers' // -- Types --------------------------------------------------------------------- export interface Web3ModalClientOptions extends Omit { ethersConfig: ProviderType + chains: Chain[] siweConfig?: Web3ModalSIWEClient - chains?: Chain[] defaultChain?: Chain chainImages?: Record connectorImages?: Record @@ -95,7 +95,7 @@ export class Web3Modal extends Web3ModalScaffold { private projectId: string - private chains?: Chain[] + private chains: Chain[] private metadata?: Metadata @@ -423,7 +423,7 @@ export class Web3Modal extends Web3ModalScaffold { return map }, {}) : ({} as Record), - optionalChains: this.chains ? [0, ...this.chains.map(chain => chain.chainId)] : [0], + optionalChains: [...this.chains.map(chain => chain.chainId)] as [number], metadata: { name: this.metadata ? this.metadata.name : '', description: this.metadata ? this.metadata.description : '', diff --git a/packages/ethers5/src/client.ts b/packages/ethers5/src/client.ts index 8e0d5fb757..959b8e88a5 100644 --- a/packages/ethers5/src/client.ts +++ b/packages/ethers5/src/client.ts @@ -34,7 +34,7 @@ import type { EthereumProviderOptions } from '@walletconnect/ethereum-provider' export interface Web3ModalClientOptions extends Omit { ethersConfig: ProviderType siweConfig?: Web3ModalSIWEClient - chains?: Chain[] + chains: Chain[] defaultChain?: Chain chainImages?: Record connectorImages?: Record @@ -87,7 +87,7 @@ export class Web3Modal extends Web3ModalScaffold { private projectId: string - private chains?: Chain[] + private chains: Chain[] private metadata?: Metadata @@ -393,7 +393,7 @@ export class Web3Modal extends Web3ModalScaffold { return map }, {}) : ({} as Record), - optionalChains: this.chains ? [0, ...this.chains.map(chain => chain.chainId)] : [0], + optionalChains: [...this.chains.map(chain => chain.chainId)] as [number], metadata: { name: this.metadata ? this.metadata.name : '', description: this.metadata ? this.metadata.description : '',