import { Badge } from "@pythnetwork/component-library/Badge"; import type { ComponentProps } from "react"; import { usePriceFeeds } from "../../hooks/use-price-feeds"; type Props = ComponentProps & { symbol: string; }; export const AssetClassTag = ({ symbol }: Props) => { const feed = usePriceFeeds().get(symbol); if (feed) { return ( {feed.assetClass.toUpperCase()} ); } else { throw new NoSuchFeedError(symbol); } }; class NoSuchFeedError extends Error { constructor(symbol: string) { super(`No feed exists named ${symbol}`); this.name = "NoSuchFeedError"; } }