Skip to content

Commit

Permalink
Make chains required & remove 0 chain config
Browse files Browse the repository at this point in the history
  • Loading branch information
glitch-txs committed Dec 8, 2023
1 parent 7a02d74 commit ff1b202
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 @@ -40,7 +40,7 @@ import type { CombinedProvider } from '@web3modal/scaffold-utils/ethers'
// -- Types ---------------------------------------------------------------------
export interface Web3ModalClientOptions extends Omit<LibraryOptions, 'defaultChain' | 'tokens'> {
ethersConfig: ProviderType
chains?: Chain[]
chains: Chain[]
defaultChain?: Chain
chainImages?: Record<number, string>
connectorImages?: Record<string, string>
Expand Down Expand Up @@ -93,7 +93,7 @@ export class Web3Modal extends Web3ModalScaffold {

private projectId: string

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

private metadata?: Metadata

Expand Down Expand Up @@ -370,7 +370,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 @@ -36,7 +36,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 @@ -89,7 +89,7 @@ export class Web3Modal extends Web3ModalScaffold {

private projectId: string

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

private metadata?: Metadata

Expand Down Expand Up @@ -375,7 +375,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

0 comments on commit ff1b202

Please sign in to comment.