@@ -2,13 +2,40 @@ import { useEffect, useState } from "preact/hooks"
22import { getFeedRiskTiersBatch } from "~/db/feedCategories.js"
33import { ChainNetwork } from "~/features/data/chains.ts"
44
5- // Prefer the slug, but patch Ethereum until Supabase data is normalized (it still stores "mainnet").
5+ // Patch mismatches
6+ const SUPABASE_NETWORK_SLUG_OVERRIDES : Record < string , string > = {
7+ // Ethereum
8+ "ethereum-mainnet" : "mainnet" ,
9+
10+ // L2s / EVM networks that db stores as ethereum-*-<chain>-1
11+ "arbitrum-mainnet" : "ethereum-mainnet-arbitrum-1" ,
12+ "base-mainnet" : "ethereum-mainnet-base-1" ,
13+ "optimism-mainnet" : "ethereum-mainnet-optimism-1" ,
14+ "scroll-mainnet" : "ethereum-mainnet-scroll-1" ,
15+ "linea-mainnet" : "ethereum-mainnet-linea-1" ,
16+ "mantle-mainnet" : "ethereum-mainnet-mantle-1" ,
17+ "metis-mainnet" : "ethereum-mainnet-andromeda-1" ,
18+ "xlayer-mainnet" : "ethereum-mainnet-xlayer-1" ,
19+ "starknet-mainnet" : "ethereum-mainnet-starknet-1" ,
20+ "zksync-mainnet" : "ethereum-mainnet-zksync-1" ,
21+ "polygon-zkevm-mainnet" : "ethereum-mainnet-polygon-zkevm-1" ,
22+
23+ // Legacy/alt naming in db
24+ "bnb-mainnet" : "bsc-mainnet" ,
25+ "polygon-mainnet" : "matic-mainnet" ,
26+ "moonbeam-mainnet" : "polkadot-mainnet-moonbeam" ,
27+ "moonriver-mainnet" : "kusama-mainnet-moonriver" ,
28+ "bob-mainnet" : "bitcoin-mainnet-bob-1" ,
29+ "botanix-mainnet" : "bitcoin-mainnet-botanix" ,
30+
31+ // typo in chains.ts (queryString is "katara-mainnet")
32+ "katara-mainnet" : "polygon-mainnet-katana" ,
33+ }
34+
635export const getNetworkIdentifier = ( network ?: ChainNetwork | null ) : string => {
736 if ( ! network ) return "unknown"
8- if ( network . queryString === "ethereum-mainnet" ) {
9- return "mainnet"
10- }
11- return network . queryString ?? "unknown"
37+ const slug = network . queryString ?? "unknown"
38+ return SUPABASE_NETWORK_SLUG_OVERRIDES [ slug ] ?? slug
1239}
1340
1441// Final category only
0 commit comments