Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ export const SelectChainSection = ({
}: IProps) => {
const context = useContext(WalletsContext)

const visibleChainOptions = useMemo(() => {
const hiddenChains = context?.hiddenChains || []
return CHAIN_OPTIONS.filter((chain) => !hiddenChains.includes(chain.value))
}, [context?.hiddenChains])

const preSelectedChains = useMemo(() => {
const injectedChains = context?.getInjectedChains()
const connectedChains = injectedChains?.xdefi || injectedChains?.ctrl || []
Expand Down Expand Up @@ -160,7 +165,7 @@ export const SelectChainSection = ({
return (
<Container>
<ChainContainer className='walletconnect__select-chain--container'>
{CHAIN_OPTIONS.map((chain) => (
{visibleChainOptions.map((chain) => (
<ChainCard
key={chain.value}
icon={chain.icon}
Expand Down
1 change: 1 addition & 0 deletions src/helpers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export interface IWeb3Providers {

export interface IConnectorOptions {
connectorDefaultChains: 'all' | IChainType[]
hiddenChains?: IChainType[]
}

export interface IProviderInfo {
Expand Down
7 changes: 6 additions & 1 deletion src/wallets/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import { WalletConnect } from '../core'
import { providers } from 'src/providers'

const defaultConnectorOptions: IConnectorOptions = {
connectorDefaultChains: 'all'
connectorDefaultChains: 'all',
hiddenChains: []
}

export class WalletsConnector {
Expand Down Expand Up @@ -120,6 +121,10 @@ export class WalletsConnector {
return this.connectorOptions.connectorDefaultChains
}

get hiddenChains() {
return this.connectorOptions.hiddenChains || []
}

private getSavedEthereumProvider = (providerId: string) => {
return this.currentProviders[providerId]
}
Expand Down