From 75333c36128e9966ce67439098e970cae44545e6 Mon Sep 17 00:00:00 2001 From: eagle Date: Fri, 13 Oct 2023 18:43:25 +0530 Subject: [PATCH] fix incorrect token name on Donation History page (#2447) * fix: incorrect token name bug in donations page * fix: other token name issues * fix: token name issues --- .../src/features/contributors/DonationsTable.tsx | 3 ++- .../features/contributors/ViewContributionHistory.tsx | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/grant-explorer/src/features/contributors/DonationsTable.tsx b/packages/grant-explorer/src/features/contributors/DonationsTable.tsx index ffc6089ad8..f8fd7b3bdd 100644 --- a/packages/grant-explorer/src/features/contributors/DonationsTable.tsx +++ b/packages/grant-explorer/src/features/contributors/DonationsTable.tsx @@ -55,7 +55,8 @@ export function DonationsTable(props: { props.contributions.map((chainContribution) => { const { chainId, data } = chainContribution; return data.map((contribution) => { - const token = props.tokens[contribution.token]; + const tokenId = contribution.token.toLowerCase() + "-" + chainId; + const token = props.tokens[tokenId]; let formattedAmount = "N/A"; diff --git a/packages/grant-explorer/src/features/contributors/ViewContributionHistory.tsx b/packages/grant-explorer/src/features/contributors/ViewContributionHistory.tsx index 533d205f5e..e9a2baa228 100644 --- a/packages/grant-explorer/src/features/contributors/ViewContributionHistory.tsx +++ b/packages/grant-explorer/src/features/contributors/ViewContributionHistory.tsx @@ -60,8 +60,12 @@ function ViewContributionHistoryFetcher(props: { return blockies.create({ seed: props.address.toLowerCase() }).toDataURL(); }, [props.address]); + // tokens is a map of token address + chainId to token const tokens = Object.fromEntries( - votingTokens.map((token) => [token.address, token]) + votingTokens.map((token) => [ + token.address.toLowerCase() + "-" + token.chainId, + token, + ]) ); if (contributionHistory.type === "loading") { @@ -105,7 +109,9 @@ export function ViewContributionHistory(props: { props.contributions.forEach((chainContribution) => { const { data } = chainContribution; data.forEach((contribution) => { - const token = props.tokens[contribution.token]; + const tokenId = + contribution.token.toLowerCase() + "-" + chainContribution.chainId; + const token = props.tokens[tokenId]; if (token) { totalDonations += contribution.amountUSD; totalUniqueContributions += 1;