From 8a71f4664a7095c67ee96cab853a360762264375 Mon Sep 17 00:00:00 2001 From: Linkie Link Date: Tue, 3 Oct 2023 15:54:22 +0200 Subject: [PATCH] fix: fixed the rewards center (#524) --- src/api/incentives/getUnclaimedRewards.ts | 18 +++++++++--------- src/components/RewardsCenter.tsx | 6 +++--- src/hooks/useUnclaimedRewards.tsx | 21 +++++++-------------- 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/src/api/incentives/getUnclaimedRewards.ts b/src/api/incentives/getUnclaimedRewards.ts index c4ae6d03..46df88d4 100644 --- a/src/api/incentives/getUnclaimedRewards.ts +++ b/src/api/incentives/getUnclaimedRewards.ts @@ -1,20 +1,20 @@ import { cacheFn, unclaimedRewardsCache } from 'api/cache' import { getIncentivesQueryClient } from 'api/cosmwasm-client' +import { ENV } from 'constants/env' import { BNCoin } from 'types/classes/BNCoin' +import iterateContractQuery from 'utils/iterateContractQuery' -export default async function getUnclaimedRewards( - user: string, - accountId: string, -): Promise { +export default async function getUnclaimedRewards(accountId: string): Promise { try { const client = await getIncentivesQueryClient() const unclaimedRewards = await cacheFn( () => - client.userUnclaimedRewards({ - user, - accountId, - limit: 100, - }), + iterateContractQuery(() => + client.userUnclaimedRewards({ + user: ENV.ADDRESS_CREDIT_MANAGER, + accountId, + }), + ), unclaimedRewardsCache, `incentives/${accountId}`, 60, diff --git a/src/components/RewardsCenter.tsx b/src/components/RewardsCenter.tsx index 81048349..649a4abb 100644 --- a/src/components/RewardsCenter.tsx +++ b/src/components/RewardsCenter.tsx @@ -31,10 +31,10 @@ const renderIncentives = (unclaimedRewards: BNCoin[]) => { const asset = ASSETS.find(byDenom(reward.denom)) if (!asset) return null return ( - <> +
{index !== 0 && } - +
) }) } @@ -109,7 +109,7 @@ export default function RewardsCenter() { <>