Skip to content

Commit

Permalink
internal networks filtering (#1715)
Browse files Browse the repository at this point in the history
Co-authored-by: brdy <[email protected]>
  • Loading branch information
DanielSinclair and BrodyHughes authored Sep 25, 2024
1 parent ae5df21 commit 6516a21
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions scripts/networks.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ async function fetchData() {
badgeURL
}
testnet
internal
opStack
defaultExplorer {
url
Expand Down
1 change: 1 addition & 0 deletions src/core/types/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ export interface BackendNetwork {
badgeURL: string;
};
testnet: boolean;
internal: boolean;
opStack: boolean;
defaultExplorer: {
url: string;
Expand Down
8 changes: 7 additions & 1 deletion src/core/utils/backendNetworks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import { mainnet } from 'viem/chains';

import { BackendNetwork } from '../types/chains';

const INTERNAL_BUILD = process.env.INTERNAL_BUILD === 'true';
const IS_DEV = process.env.IS_DEV === 'true';

const proxyBackendNetworkRpcEndpoint = (endpoint: string) => {
return `${endpoint}${process.env.RPC_PROXY_API_KEY}`;
};
Expand Down Expand Up @@ -47,5 +50,8 @@ export function transformBackendNetworksToChains(
if (!networks) {
return [];
}
return networks.map((network) => transformBackendNetworkToChain(network));
// include all networks for internal builds, otherwise filter out flagged as internal
return networks
.filter((network) => !network.internal || INTERNAL_BUILD || IS_DEV)
.map((network) => transformBackendNetworkToChain(network));
}

0 comments on commit 6516a21

Please sign in to comment.