From d3a0123d8f4aefe6dc906d5107e810c0cc0f32f1 Mon Sep 17 00:00:00 2001 From: enesozturk Date: Fri, 28 Jun 2024 11:58:11 +0300 Subject: [PATCH] refactor: add chain check for including announced and injected wallets listing --- .../src/partials/w3m-connector-list/index.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/scaffold-ui/src/partials/w3m-connector-list/index.ts b/packages/scaffold-ui/src/partials/w3m-connector-list/index.ts index de648bac1c..725a453cbc 100644 --- a/packages/scaffold-ui/src/partials/w3m-connector-list/index.ts +++ b/packages/scaffold-ui/src/partials/w3m-connector-list/index.ts @@ -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' @@ -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 }