From e658ee1773b8813bd9fa1e4ccb4c29788b6f6635 Mon Sep 17 00:00:00 2001 From: iamoskvin Date: Tue, 21 May 2024 15:09:39 +0300 Subject: [PATCH] case-insensitive search --- src/pages/Pool/index.tsx | 9 +++++---- src/pages/Rewards/index.tsx | 7 ++++--- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/pages/Pool/index.tsx b/src/pages/Pool/index.tsx index 002752df..ef302c42 100644 --- a/src/pages/Pool/index.tsx +++ b/src/pages/Pool/index.tsx @@ -115,10 +115,11 @@ export default function Pool() { } const poolsData: any = {} poolsDataRaw?.forEach((data: any) => { - const rewardName = data?.token0?.symbol + '/' + data?.token1?.symbol - const rewardsData = jediRewards?.[rewardName] - - if (rewardsData) { + const rewardName = (data?.token0?.symbol + '/' + data?.token1?.symbol).toLowerCase() + const pairKey = jediRewards ? Object.keys(jediRewards).find(key => key.toLowerCase() === rewardName) : null + + if (pairKey) { + const rewardsData = jediRewards?.[pairKey] data.aprStarknet = rewardsData.apr } diff --git a/src/pages/Rewards/index.tsx b/src/pages/Rewards/index.tsx index 4445dc97..c45cd58a 100644 --- a/src/pages/Rewards/index.tsx +++ b/src/pages/Rewards/index.tsx @@ -456,9 +456,10 @@ export default function Rewards() { const eligiblePools = [] try { for (const pool of pools?.data?.poolsData) { - const pair = `${pool?.pool?.token0.symbol}/${pool?.pool?.token1.symbol}` - if (jediRewards[pair]) { - const rewardsData = jediRewards[pair] + const pair = (`${pool?.pool?.token0.symbol}/${pool?.pool?.token1.symbol}`).toLowerCase() + const pairKey = jediRewards ? Object.keys(jediRewards).find(key => key.toLowerCase() === pair) : null + if (pairKey && jediRewards[pairKey]) { + const rewardsData = jediRewards[pairKey] const aprStarknet = rewardsData.apr * 100 // const closestAPRPeriod = findClosestAPRPeriod(pool?.period) const closestAPRPeriod = pool?.period?.[apiTimeframeOptions.oneDay]