Skip to content

Commit

Permalink
fix incorrect token name on Donation History page (#2447)
Browse files Browse the repository at this point in the history
* fix: incorrect token name bug in donations page

* fix: other token name issues

* fix: token name issues
  • Loading branch information
bhargavaparoksham authored and vacekj committed Oct 18, 2023
1 parent c1b524a commit 75333c3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 75333c3

Please sign in to comment.