From 5a3980e4fd9bf90e9837b5a3fab25401729b98c4 Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Mon, 21 Oct 2024 11:59:41 -0400 Subject: [PATCH] removed price feed id page --- components/PriceFeedTable.tsx | 119 ------------------ pages/price-feeds/price-feeds.mdx | 2 +- pages/price-feeds/price-feeds/_meta.json | 3 +- .../price-feeds/price-feed-ids.mdx | 37 ------ 4 files changed, 2 insertions(+), 159 deletions(-) delete mode 100644 components/PriceFeedTable.tsx delete mode 100644 pages/price-feeds/price-feeds/price-feed-ids.mdx diff --git a/components/PriceFeedTable.tsx b/components/PriceFeedTable.tsx deleted file mode 100644 index 9a6ca948..00000000 --- a/components/PriceFeedTable.tsx +++ /dev/null @@ -1,119 +0,0 @@ -import { useState, useCallback } from "react"; -import { StyledTd } from "./Table"; - -interface PriceFeed { - ids: string; - assetType: string; - name: string; -} - -interface TableColumnWidths { - assetType: string; - name: string; - ids: any; -} - -const columnWidths: TableColumnWidths = { - assetType: "w-3/10", - name: "w-1/5", - ids: "w-1/2", -}; - -const PriceFeedTable = ({ priceFeeds }: { priceFeeds: PriceFeed[] }) => { - const [selectedAssetType, setSelectedAssetType] = useState("All"); - const [copiedId, setCopiedId] = useState(null); - - const assetTypes = [ - "All", - ...Array.from(new Set(priceFeeds.map((feed) => feed.assetType))), - ]; - - const filteredFeeds = - selectedAssetType === "All" - ? priceFeeds - : priceFeeds.filter((feed) => feed.assetType === selectedAssetType); - - const copyToClipboard = useCallback((text: string) => { - navigator.clipboard - .writeText(text) - .then(() => { - setCopiedId(text); - setTimeout(() => setCopiedId(null), 2000); // Hide the popup after 2 seconds - }) - .catch((err) => { - console.error("Failed to copy: ", err); - }); - }, []); - - return ( -
-
- - -
- - - - - - - - - - {filteredFeeds.map((feed, index) => ( - - {feed.assetType} - {feed.name} - -
- - {copiedId === feed.ids && ( -
- Copied to clipboard -
- )} -
-
- - ))} - -
Asset TypeNameFeed ID
-
- ); -}; - -export default PriceFeedTable; diff --git a/pages/price-feeds/price-feeds.mdx b/pages/price-feeds/price-feeds.mdx index c6abe873..9041d27d 100644 --- a/pages/price-feeds/price-feeds.mdx +++ b/pages/price-feeds/price-feeds.mdx @@ -22,7 +22,7 @@ Applications need to store the IDs of the feeds they wish to read. However, the IDs may be represented in different formats (e.g. hex or base58) depending on the blockchain. Price feeds also have different IDs in the Stable and Beta channels. -Refer to the [Price Feed ID reference catalog](./price-feeds/price-feed-ids.md) to identify a feed's ID in your chosen ecosystem. +Refer to the [Price Feed ID reference catalog](https://www.pyth.network/developers/price-feed-ids) to identify a feed's ID in your chosen ecosystem. ### Solana Price Feed Accounts diff --git a/pages/price-feeds/price-feeds/_meta.json b/pages/price-feeds/price-feeds/_meta.json index 2a0b40e3..4310675f 100644 --- a/pages/price-feeds/price-feeds/_meta.json +++ b/pages/price-feeds/price-feeds/_meta.json @@ -1,4 +1,3 @@ { - "asset-classes": "Asset Classes", - "price-feed-ids": "Price Feed IDs" + "asset-classes": "Asset Classes" } diff --git a/pages/price-feeds/price-feeds/price-feed-ids.mdx b/pages/price-feeds/price-feeds/price-feed-ids.mdx deleted file mode 100644 index 6f89ff9a..00000000 --- a/pages/price-feeds/price-feeds/price-feed-ids.mdx +++ /dev/null @@ -1,37 +0,0 @@ -import PriceFeedTable from "../../../components/PriceFeedTable"; -import { useState, useEffect } from 'react'; - -export const PriceFeedData = () => { - const [priceFeeds, setPriceFeeds] = useState([]); - -useEffect(() => { -const fetchPriceFeeds = async () => { -try { -const response = await fetch('https://hermes.pyth.network/v2/price_feeds'); -const data = await response.json(); - - // Transform the data to match our PriceFeed interface - const transformedData = data.map(feed => ({ - assetType: feed.attributes.asset_type, - name: feed.attributes.display_symbol, - ids: feed.id - })); - - setPriceFeeds(transformedData); - } catch (error) { - console.error('Error fetching price feeds:', error); - } - }; - - fetchPriceFeeds(); - -}, []); - -return ; -}; - -# Price Feed IDs - -Below is a table of all available price feed IDs: - -