From 8d88ba96a47c002e369ab1c060c585fcdadd34da Mon Sep 17 00:00:00 2001 From: Dwight Lyle Date: Thu, 16 May 2024 12:52:15 -0600 Subject: [PATCH] Ripcord display changes --- src/features/data/api/index.ts | 1 + src/features/data/index.ts | 12 --------- src/features/feeds/components/FeedPage.astro | 20 -------------- src/features/feeds/components/Tables.tsx | 27 +++++++------------ .../pause-notice/CheckHeartbeat.tsx | 10 ++++--- .../components/pause-notice/PauseNotice.tsx | 13 ++++----- src/features/feeds/types/index.ts | 1 + 7 files changed, 23 insertions(+), 61 deletions(-) diff --git a/src/features/data/api/index.ts b/src/features/data/api/index.ts index 7804eb504ee..d5738c53ff5 100644 --- a/src/features/data/api/index.ts +++ b/src/features/data/api/index.ts @@ -10,6 +10,7 @@ interface Docs { porType?: string productSubType?: string productType?: string + ripcordApi?: string shutdownDate?: string } export interface ChainMetadata { diff --git a/src/features/data/index.ts b/src/features/data/index.ts index a78da0d032c..acb78d788ba 100644 --- a/src/features/data/index.ts +++ b/src/features/data/index.ts @@ -1,7 +1,3 @@ -export type FeedDataItem = { - [key: string]: string -} - export const priceFeedAddresses = { btc: { usd: { @@ -26,11 +22,3 @@ export const registryAddresses = { }, }, } - -export const monitoredFeeds = { - mainnet: [ - { - "0xBE456fd14720C3aCCc30A2013Bffd782c9Cb75D5": "TrueUSD", - }, - ], -} diff --git a/src/features/feeds/components/FeedPage.astro b/src/features/feeds/components/FeedPage.astro index ec23def0b28..3ebf67be169 100644 --- a/src/features/feeds/components/FeedPage.astro +++ b/src/features/feeds/components/FeedPage.astro @@ -9,32 +9,12 @@ export type Props = { } import { getServerSideChainMetadata } from "~/features/data/api/backend" import { CHAINS, ALL_CHAINS } from "~/features/data/chains" -import { CheckHeartbeat } from "./pause-notice/CheckHeartbeat" -import { FeedDataItem, monitoredFeeds } from "~/features/data" const { initialNetwork, ecosystem, dataFeedType } = Astro.props const initialCache = await getServerSideChainMetadata([...CHAINS, ...ALL_CHAINS]) -const feedItems: FeedDataItem[] = monitoredFeeds.mainnet --- -{ - dataFeedType === "por" - ? feedItems.map((feedItem: FeedDataItem) => { - const [feedAddress] = Object.keys(feedItem) - return ( - - ) - }) - : "" -} - { ecosystem === "deprecating" ? ( <> diff --git a/src/features/feeds/components/Tables.tsx b/src/features/feeds/components/Tables.tsx index 62e5ae4cea0..9c3f93f5973 100644 --- a/src/features/feeds/components/Tables.tsx +++ b/src/features/feeds/components/Tables.tsx @@ -5,14 +5,12 @@ import { ChainNetwork } from "~/features/data/chains" import tableStyles from "./Tables.module.css" import button from "@chainlink/design-system/button.module.css" import { CheckHeartbeat } from "./pause-notice/CheckHeartbeat" -import { monitoredFeeds, FeedDataItem } from "~/features/data" const verifierProxies = new Map([ ["0x534a7FF707Bc862cAB0Dda546F1B817Be5235b66", "0x478Aa2aC9F6D65F84e09D9185d126c3a17c2a93C"], ["0xA403a4a521be034B4A0D54019aF469A207094246", "0x2ff010DEbC1297f19579B4246cad07bd24F2488A"], ]) -const feedItems = monitoredFeeds.mainnet const feedCategories = { low: ( @@ -197,21 +195,16 @@ const ProofOfReserveTHead = ({ showExtraDetails }: { showExtraDetails: boolean } const ProofOfReserveTr = ({ network, proxy, showExtraDetails }) => ( - {feedItems.map((feedItem: FeedDataItem) => { - const [feedAddress] = Object.keys(feedItem) - if (feedAddress === proxy.proxyAddress) { - return ( - - ) - } - return "" - })} + {proxy.docs.ripcordApi && ( + + )}
{feedCategories[proxy.docs.feedCategory] || ""} {proxy.name} diff --git a/src/features/feeds/components/pause-notice/CheckHeartbeat.tsx b/src/features/feeds/components/pause-notice/CheckHeartbeat.tsx index 7aa45c3a43d..bf782aab3b4 100644 --- a/src/features/feeds/components/pause-notice/CheckHeartbeat.tsx +++ b/src/features/feeds/components/pause-notice/CheckHeartbeat.tsx @@ -11,14 +11,16 @@ export const CheckHeartbeat = ({ feedAddress, supportedChain, feedName, + heartbeat, list, - currencyName, + ripcordApi, }: { feedAddress: string supportedChain: SupportedChain feedName: string + heartbeat: number list?: boolean - currencyName: string + ripcordApi: string }) => { const [latestUpdateTimestamp, setLatestUpdateTimestamp] = useState(undefined) const getLatestTimestamp = useCallback(async () => { @@ -58,9 +60,9 @@ export const CheckHeartbeat = ({ type="alert" feedName={feedName} feedAddress={feedAddress} - heartbeat={86400} + heartbeat={heartbeat} buffer={900} - currencyName={currencyName} + ripcordApi={ripcordApi} />
) : null diff --git a/src/features/feeds/components/pause-notice/PauseNotice.tsx b/src/features/feeds/components/pause-notice/PauseNotice.tsx index 71dea8404e8..b7ec51e9422 100644 --- a/src/features/feeds/components/pause-notice/PauseNotice.tsx +++ b/src/features/feeds/components/pause-notice/PauseNotice.tsx @@ -18,7 +18,7 @@ export const PauseNotice = ({ value, heartbeat, buffer, - currencyName, + ripcordApi, }: { value: number list?: boolean @@ -27,7 +27,7 @@ export const PauseNotice = ({ feedAddress: string heartbeat: number buffer: number - currencyName: string + ripcordApi: string }) => { const [ripCord, setRipCord] = useState(false) const date = Math.floor(new Date().getTime() / 1000) @@ -36,12 +36,9 @@ export const PauseNotice = ({ useEffect(() => { const fetchRipCord = async () => { - const res = await fetch( - `https://api.real-time-reserves.verinumus.io/v1/chainlink/proof-of-reserves/${currencyName}`, - { - method: "GET", - } - ) + const res = await fetch(ripcordApi, { + method: "GET", + }) const fecthedProofOfReserveData = await res.json() setRipCord(fecthedProofOfReserveData.ripcord ?? false) } diff --git a/src/features/feeds/types/index.ts b/src/features/feeds/types/index.ts index 85e0a9baadc..7a73690a6c6 100644 --- a/src/features/feeds/types/index.ts +++ b/src/features/feeds/types/index.ts @@ -41,6 +41,7 @@ interface Proxy { feedCategory: FeedCategory feedType: ProxyFeedType shutdownDate?: string + ripcordApi?: string } export interface Network {