Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make chains required & remove 0 chain config #1553

Merged
merged 3 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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