Skip to content

Commit b9f85f0

Browse files
committed
fix: Mark price feeds fields as optional
1 parent e204c9f commit b9f85f0

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

apps/insights/src/services/pyth/get-feeds.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ import { priceFeedsSchema } from "../../schemas/pyth/price-feeds-schema";
66
const _getFeeds = async (cluster: Cluster) => {
77
const unfilteredData = await getPythMetadata(cluster);
88
const filtered = unfilteredData.symbols
9-
.filter(
10-
(symbol) =>
11-
unfilteredData.productFromSymbol.get(symbol)?.display_symbol !==
12-
undefined,
13-
)
9+
.filter((symbol) => {
10+
const product = unfilteredData.productFromSymbol.get(symbol);
11+
const hasDisplaySymbol = product?.display_symbol !== undefined;
12+
const hasPriceAccount = product?.price_account !== undefined;
13+
14+
return hasDisplaySymbol && hasPriceAccount;
15+
})
1416
.map((symbol) => ({
1517
symbol,
1618
product: unfilteredData.productFromSymbol.get(symbol),

0 commit comments

Comments
 (0)