Skip to content

Commit

Permalink
refactor: add chain check for including announced and injected wallet…
Browse files Browse the repository at this point in the history
…s listing
  • Loading branch information
enesozturk committed Jun 28, 2024
1 parent 9d08ffe commit d3a0123
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions packages/scaffold-ui/src/partials/w3m-connector-list/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ import { customElement } from '@web3modal/ui'
import { LitElement, html } from 'lit'

import styles from './styles.js'
import { ApiController, ConnectorController, OptionsController, StorageUtil } from '@web3modal/core'
import {
ApiController,
ChainController,
ConnectorController,
OptionsController,
StorageUtil
} from '@web3modal/core'
import { ConstantsUtil as CommonConstantsUtil } from '@web3modal/common'
import { state } from 'lit/decorators.js'
import { ConstantsUtil } from '@web3modal/scaffold-utils'
import { WalletUtil } from '../../utils/WalletUtil.js'
Expand Down Expand Up @@ -71,14 +78,16 @@ export class W3mConnectorList extends LitElement {
const coinbase = this.connectors.find(
connector => connector.id === ConstantsUtil.COINBASE_SDK_CONNECTOR_ID
)
const isEVM = ChainController.state.activeChain === CommonConstantsUtil.CHAIN.EVM
const includeAnnouncedAndInjected = isEVM ? OptionsController.state.enableEIP6963 : true

return {
custom,
recent,
coinbase,
external,
announced: OptionsController.state.enableEIP6963 ? announced : [],
injected: OptionsController.state.enableEIP6963 ? injected : [],
announced: includeAnnouncedAndInjected ? announced : [],
injected: includeAnnouncedAndInjected ? injected : [],
recommended: filteredRecommended,
featured: filteredFeatured
}
Expand Down

0 comments on commit d3a0123

Please sign in to comment.