Skip to content

Commit

Permalink
Make chains required & remove 0 chain config (#1553)
Browse files Browse the repository at this point in the history
Co-authored-by: Sven <[email protected]>
  • Loading branch information
glitch-txs and svenvoskamp authored Dec 15, 2023
1 parent 4959d48 commit 3cb12f8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions packages/ethers/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ import type { CombinedProvider } from '@web3modal/scaffold-utils/ethers'
// -- Types ---------------------------------------------------------------------
export interface Web3ModalClientOptions extends Omit<LibraryOptions, 'defaultChain' | 'tokens'> {
ethersConfig: ProviderType
chains: Chain[]
siweConfig?: Web3ModalSIWEClient
chains?: Chain[]
defaultChain?: Chain
chainImages?: Record<number, string>
connectorImages?: Record<string, string>
Expand Down Expand Up @@ -95,7 +95,7 @@ export class Web3Modal extends Web3ModalScaffold {

private projectId: string

private chains?: Chain[]
private chains: Chain[]

private metadata?: Metadata

Expand Down Expand Up @@ -423,7 +423,7 @@ export class Web3Modal extends Web3ModalScaffold {
return map
}, {})
: ({} as Record<number, string>),
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 : '',
Expand Down
6 changes: 3 additions & 3 deletions packages/ethers5/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import type { EthereumProviderOptions } from '@walletconnect/ethereum-provider'
export interface Web3ModalClientOptions extends Omit<LibraryOptions, 'defaultChain' | 'tokens'> {
ethersConfig: ProviderType
siweConfig?: Web3ModalSIWEClient
chains?: Chain[]
chains: Chain[]
defaultChain?: Chain
chainImages?: Record<number, string>
connectorImages?: Record<string, string>
Expand Down Expand Up @@ -87,7 +87,7 @@ export class Web3Modal extends Web3ModalScaffold {

private projectId: string

private chains?: Chain[]
private chains: Chain[]

private metadata?: Metadata

Expand Down Expand Up @@ -393,7 +393,7 @@ export class Web3Modal extends Web3ModalScaffold {
return map
}, {})
: ({} as Record<number, string>),
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 : '',
Expand Down

3 comments on commit 3cb12f8

@vercel
Copy link

@vercel vercel bot commented on 3cb12f8 Dec 15, 2023

Choose a reason for hiding this comment

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

@vercel
Copy link

@vercel vercel bot commented on 3cb12f8 Dec 15, 2023

Choose a reason for hiding this comment

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

@vercel
Copy link

@vercel vercel bot commented on 3cb12f8 Dec 15, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.