@@ -13,6 +13,7 @@ import { FEED_CATEGORY_CONFIG } from "../../../db/feedCategories.js"
1313import { useBatchedFeedCategories , getFeedCategoryFromBatch , getNetworkIdentifier } from "./useBatchedFeedCategories.ts"
1414import { isSharedSVR , isAaveSVR } from "~/features/feeds/utils/svrDetection.ts"
1515import { ExpandableTableWrapper } from "./ExpandableTableWrapper.tsx"
16+ import { isFeedVisible } from "~/features/feeds/utils/feedVisibility.ts"
1617
1718const feedItems = monitoredFeeds . mainnet
1819
@@ -1145,87 +1146,13 @@ export const MainnetTable = ({
11451146
11461147 if ( isDeprecating ) return ! ! metadata . docs . shutdownDate
11471148
1148- if ( dataFeedType === "streamsCrypto" ) {
1149- const isValidStreamsFeed =
1150- metadata . contractType === "verifier" &&
1151- ( metadata . docs . feedType === "Crypto" || metadata . docs . feedType === "Crypto-DEX" )
1152-
1153- if ( showOnlyDEXFeeds ) {
1154- return isValidStreamsFeed && metadata . docs . feedType === "Crypto-DEX"
1155- }
1156-
1157- return isValidStreamsFeed
1158- }
1159- if ( dataFeedType === "streamsRwa" ) {
1160- const isRwaFeed =
1161- metadata . contractType === "verifier" &&
1162- ( metadata . docs . feedType === "Equities" ||
1163- metadata . docs . feedType === "Forex" ||
1164- metadata . docs . feedType === "Datalink" )
1165-
1166- if ( ! isRwaFeed ) return false
1167-
1168- // Apply feed type filter
1169- if ( streamCategoryFilter === "datalink" ) {
1170- if ( metadata . docs . feedType !== "Datalink" ) return false
1171- } else if ( streamCategoryFilter === "equities" ) {
1172- if ( metadata . docs . feedType !== "Equities" ) return false
1173- } else if ( streamCategoryFilter === "forex" ) {
1174- if ( metadata . docs . feedType !== "Forex" ) return false
1175- }
1176-
1177- // Apply schema filter
1178- if ( rwaSchemaFilter === "v8" ) {
1179- return metadata . docs ?. schema === "v8" || ! metadata . docs ?. schema
1180- }
1181- if ( rwaSchemaFilter === "v11" ) {
1182- return metadata . docs ?. schema === "v11"
1183- }
1184-
1185- return true
1186- }
1187-
1188- if ( dataFeedType === "streamsNav" ) {
1189- return metadata . contractType === "verifier" && metadata . docs . feedType === "Net Asset Value"
1190- }
1191-
1192- if ( dataFeedType === "streamsExRate" ) {
1193- return metadata . contractType === "verifier" && metadata . docs ?. productTypeCode === "ExRate"
1194- }
1195-
1196- if ( dataFeedType === "streamsBacked" ) {
1197- return metadata . contractType === "verifier" && metadata . docs . feedType === "Tokenized Equities"
1198- }
1199-
1200- if ( isSmartData ) {
1201- if ( showOnlyMVRFeeds ) {
1202- return ! metadata . docs ?. hidden && metadata . docs ?. isMVR === true && metadata . docs ?. deliveryChannelCode !== "DS"
1203- }
1204-
1205- return (
1206- ! metadata . docs ?. hidden &&
1207- metadata . docs ?. deliveryChannelCode !== "DS" &&
1208- ( metadata . docs ?. productType === "Proof of Reserve" ||
1209- metadata . docs ?. productType === "NAVLink" ||
1210- metadata . docs ?. productType === "SmartAUM" ||
1211- metadata . docs ?. isMVR === true )
1212- )
1213- }
1214-
1215- if ( isUSGovernmentMacroeconomicData ) {
1216- const isMacro = metadata . docs ?. productTypeCode === "RefMacro"
1217- return isMacro
1218- }
1219-
1220- // Exclude MVR feeds from default view
1221- return (
1222- ! metadata . docs . porType &&
1223- metadata . contractType !== "verifier" &&
1224- metadata . docs . productType !== "Proof of Reserve" &&
1225- metadata . docs . productType !== "NAVLink" &&
1226- metadata . docs . productType !== "SmartAUM" &&
1227- metadata . docs ?. productTypeCode !== "RefMacro"
1228- )
1149+ // Use shared visibility logic with filters
1150+ return isFeedVisible ( metadata , dataFeedType as any , ecosystem , {
1151+ showOnlyDEXFeeds,
1152+ streamCategoryFilter,
1153+ rwaSchemaFilter,
1154+ showOnlyMVRFeeds,
1155+ } )
12291156 } )
12301157 . filter ( ( metadata ) => {
12311158 if ( isSmartData ) {
@@ -1428,98 +1355,13 @@ export const TestnetTable = ({
14281355 }
14291356
14301357 if ( batchCategory === "hidden" ) return false
1431- if ( isStreams ) {
1432- if ( dataFeedType === "streamsCrypto" ) {
1433- const isValidStreamsFeed =
1434- metadata . contractType === "verifier" &&
1435- ( metadata . feedType === "Crypto" || metadata . feedType === "Crypto-DEX" )
1436-
1437- if ( showOnlyDEXFeeds ) {
1438- return isValidStreamsFeed && metadata . feedType === "Crypto-DEX"
1439- }
1440-
1441- return isValidStreamsFeed
1442- }
1443-
1444- if ( dataFeedType === "streamsRwa" ) {
1445- const isRwaFeed =
1446- metadata . contractType === "verifier" &&
1447- ( metadata . docs . feedType === "Equities" ||
1448- metadata . docs . feedType === "Forex" ||
1449- metadata . docs . feedType === "Datalink" )
1450-
1451- if ( ! isRwaFeed ) return false
1452-
1453- // Apply feed type filter
1454- if ( streamCategoryFilter === "datalink" ) {
1455- if ( metadata . docs . feedType !== "Datalink" ) return false
1456- } else if ( streamCategoryFilter === "equities" ) {
1457- if ( metadata . docs . feedType !== "Equities" ) return false
1458- } else if ( streamCategoryFilter === "forex" ) {
1459- if ( metadata . docs . feedType !== "Forex" ) return false
1460- }
1461-
1462- // Apply schema filter
1463- if ( rwaSchemaFilter === "v8" ) {
1464- return metadata . docs ?. schema === "v8" || ! metadata . docs ?. schema
1465- }
1466- if ( rwaSchemaFilter === "v11" ) {
1467- return metadata . docs ?. schema === "v11"
1468- }
1469-
1470- return true
1471- }
1472-
1473- if ( dataFeedType === "streamsExRate" ) {
1474- return metadata . contractType === "verifier" && metadata . docs ?. productTypeCode === "ExRate"
1475- }
1476-
1477- if ( dataFeedType === "streamsNav" ) {
1478- return metadata . contractType === "verifier" && metadata . docs . feedType === "Net Asset Value"
1479- }
1480-
1481- if ( dataFeedType === "streamsBacked" ) {
1482- return metadata . contractType === "verifier" && metadata . docs . feedType === "Tokenized Equities"
1483- }
1484-
1485- // If we're in streams mode but didn't match any specific stream type, exclude this feed
1486- return false
1487- }
1488-
1489- if ( isSmartData ) {
1490- if ( showOnlyMVRFeeds ) {
1491- return ! metadata . docs ?. hidden && metadata . docs ?. isMVR === true && metadata . docs ?. deliveryChannelCode !== "DS"
1492- }
1493-
1494- // Otherwise, include all SmartData feeds (MVR, PoR, NAVLink, SmartAUM)
1495- return (
1496- ! metadata . docs ?. hidden &&
1497- metadata . docs ?. deliveryChannelCode !== "DS" &&
1498- ( metadata . docs ?. productType === "Proof of Reserve" ||
1499- metadata . docs ?. productType === "NAVLink" ||
1500- metadata . docs ?. productType === "SmartAUM" ||
1501- metadata . docs ?. isMVR === true )
1502- )
1503- }
1504-
1505- if ( isRates )
1506- return ! ! ( metadata . docs . productType === "Rates" || metadata . docs . productSubType === "Realized Volatility" )
1507-
1508- if ( isUSGovernmentMacroeconomicData ) {
1509- return metadata . docs ?. productTypeCode === "RefMacro"
1510- }
1511-
1512- // Exclude MVR feeds from default view
1513- return (
1514- ! metadata . feedId &&
1515- ! metadata . docs . porType &&
1516- metadata . docs . productType !== "Rates" &&
1517- metadata . docs . productSubType !== "Realized Volatility" &&
1518- metadata . docs . productType !== "Proof of Reserve" &&
1519- metadata . docs . productType !== "NAVLink" &&
1520- metadata . docs . productType !== "SmartAUM" &&
1521- metadata . docs ?. productTypeCode !== "RefMacro"
1522- )
1358+ // Use shared visibility logic with filters
1359+ return isFeedVisible ( metadata , dataFeedType as any , undefined , {
1360+ showOnlyDEXFeeds,
1361+ streamCategoryFilter,
1362+ rwaSchemaFilter,
1363+ showOnlyMVRFeeds,
1364+ } )
15231365 } )
15241366 . filter ( ( metadata ) => {
15251367 if ( isSmartData ) {
0 commit comments