Skip to content

Commit

Permalink
Hide evm chains on keplr mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
delivan committed Sep 12, 2024
1 parent 87ce089 commit 04c3348
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/chain-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ async function init() {
return !chainInfo.hideInUI;
});

const isOnKeplrMobile = /KeplrWalletMobile/g.test(navigator.userAgent);

let registeredChainIds = [];
if (keplr) {
const registeredResponse = await keplr.getChainInfosWithoutEndpoints();
Expand All @@ -77,13 +79,21 @@ async function init() {

const filteredChainInfos = chainInfos.filter(
(chainInfo) =>
!registeredChainIds.includes(parse(chainInfo.chainId).identifier),
!registeredChainIds
.includes(parse(chainInfo.chainId).identifier)
.filter(
(chainInfo) =>
isOnKeplrMobile && chainInfo.chainId.startsWith("eip155:"),
),
);

const registeredChainInfos = chainInfos
.filter((chainInfo) => chainInfo.nodeProvider)
.filter((chainInfo) =>
registeredChainIds.includes(parse(chainInfo.chainId).identifier),
)
.filter(
(chainInfo) => isOnKeplrMobile && chainInfo.chainId.startsWith("eip155:"),
);

if (filteredChainInfos.length > 0) {
Expand Down

0 comments on commit 04c3348

Please sign in to comment.