diff --git a/apps/insights/src/components/LivePrices/index.tsx b/apps/insights/src/components/LivePrices/index.tsx index afca9f2d41..f2a3cdd5cd 100644 --- a/apps/insights/src/components/LivePrices/index.tsx +++ b/apps/insights/src/components/LivePrices/index.tsx @@ -11,24 +11,37 @@ import { useLivePriceComponent, useLivePriceData, } from "../../hooks/use-live-price-data"; +import { Cluster } from "../../services/pyth"; export const SKELETON_WIDTH = 20; export const LivePrice = ({ feedKey, publisherKey, + cluster = Cluster.Pythnet, }: { feedKey: string; publisherKey?: string | undefined; + cluster?: Cluster; }) => publisherKey ? ( - + ) : ( - + ); -const LiveAggregatePrice = ({ feedKey }: { feedKey: string }) => { - const { prev, current } = useLivePriceData(feedKey); +const LiveAggregatePrice = ({ + feedKey, + cluster, +}: { + feedKey: string; + cluster: Cluster; +}) => { + const { prev, current } = useLivePriceData(feedKey, cluster); return ( ); @@ -37,11 +50,17 @@ const LiveAggregatePrice = ({ feedKey }: { feedKey: string }) => { const LiveComponentPrice = ({ feedKey, publisherKey, + cluster, }: { feedKey: string; publisherKey: string; + cluster: Cluster; }) => { - const { prev, current } = useLivePriceComponent(feedKey, publisherKey); + const { prev, current } = useLivePriceComponent( + feedKey, + publisherKey, + cluster, + ); return ; }; @@ -69,29 +88,43 @@ const Price = ({ export const LiveConfidence = ({ feedKey, publisherKey, + cluster = Cluster.Pythnet, }: { feedKey: string; publisherKey?: string | undefined; + cluster?: Cluster; }) => publisherKey === undefined ? ( - + ) : ( - + ); -const LiveAggregateConfidence = ({ feedKey }: { feedKey: string }) => { - const { current } = useLivePriceData(feedKey); +const LiveAggregateConfidence = ({ + feedKey, + cluster, +}: { + feedKey: string; + cluster: Cluster; +}) => { + const { current } = useLivePriceData(feedKey, cluster); return ; }; const LiveComponentConfidence = ({ feedKey, publisherKey, + cluster, }: { feedKey: string; publisherKey: string; + cluster: Cluster; }) => { - const { current } = useLivePriceComponent(feedKey, publisherKey); + const { current } = useLivePriceComponent(feedKey, publisherKey, cluster); return ; }; @@ -110,8 +143,14 @@ const Confidence = ({ confidence }: { confidence?: number | undefined }) => { ); }; -export const LiveLastUpdated = ({ feedKey }: { feedKey: string }) => { - const { current } = useLivePriceData(feedKey); +export const LiveLastUpdated = ({ + feedKey, + cluster = Cluster.Pythnet, +}: { + feedKey: string; + cluster?: Cluster; +}) => { + const { current } = useLivePriceData(feedKey, cluster); const formatterWithDate = useDateFormatter({ dateStyle: "short", timeStyle: "medium", @@ -143,8 +182,9 @@ export const LiveValue = ({ feedKey, field, defaultValue, -}: LiveValueProps) => { - const { current } = useLivePriceData(feedKey); + cluster = Cluster.Pythnet, +}: LiveValueProps & { cluster?: Cluster }) => { + const { current } = useLivePriceData(feedKey, cluster); return current !== undefined || defaultValue !== undefined ? ( (current?.[field]?.toString() ?? defaultValue) @@ -165,8 +205,9 @@ export const LiveComponentValue = ({ field, publisherKey, defaultValue, -}: LiveComponentValueProps) => { - const { current } = useLivePriceComponent(feedKey, publisherKey); + cluster = Cluster.Pythnet, +}: LiveComponentValueProps & { cluster?: Cluster }) => { + const { current } = useLivePriceComponent(feedKey, publisherKey, cluster); return current !== undefined || defaultValue !== undefined ? ( (current?.latest[field].toString() ?? defaultValue) diff --git a/apps/insights/src/components/PriceComponentDrawer/index.tsx b/apps/insights/src/components/PriceComponentDrawer/index.tsx index dfb9de4df5..713aec9555 100644 --- a/apps/insights/src/components/PriceComponentDrawer/index.tsx +++ b/apps/insights/src/components/PriceComponentDrawer/index.tsx @@ -121,21 +121,31 @@ export const PriceComponentDrawer = ({ nonInteractive header="Aggregate Price" small - stat={} + stat={} /> } + stat={ + + } /> + } /> } /> diff --git a/apps/insights/src/components/PriceComponentsCard/index.tsx b/apps/insights/src/components/PriceComponentsCard/index.tsx index c286a75e62..1e5bf07ccf 100644 --- a/apps/insights/src/components/PriceComponentsCard/index.tsx +++ b/apps/insights/src/components/PriceComponentsCard/index.tsx @@ -212,18 +212,21 @@ export const ResolvedPriceComponentsCard = ({ feedKey={component.feedKey} publisherKey={component.publisherKey} field="publishSlot" + cluster={Cluster.Pythnet} /> ), price: ( ), confidence: ( ), }), diff --git a/apps/insights/src/components/PriceFeed/layout.tsx b/apps/insights/src/components/PriceFeed/layout.tsx index 1a6d17be48..b302afce82 100644 --- a/apps/insights/src/components/PriceFeed/layout.tsx +++ b/apps/insights/src/components/PriceFeed/layout.tsx @@ -111,11 +111,21 @@ export const PriceFeedLayout = async ({ children, params }: Props) => { } + stat={ + + } /> } + stat={ + + } corner={