From 6e2e3f67d3e2ae9377b12f32bb9cefc2d1e23525 Mon Sep 17 00:00:00 2001 From: solimander Date: Tue, 12 Mar 2024 09:36:21 -0600 Subject: [PATCH] Checksum address before comparison --- .../src/components/TimedRoundProposalCard/index.tsx | 3 ++- packages/prop-house-webapp/src/utils/getChecksumAddress.ts | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 packages/prop-house-webapp/src/utils/getChecksumAddress.ts diff --git a/packages/prop-house-webapp/src/components/TimedRoundProposalCard/index.tsx b/packages/prop-house-webapp/src/components/TimedRoundProposalCard/index.tsx index 0a4a3663f..a463d0d15 100644 --- a/packages/prop-house-webapp/src/components/TimedRoundProposalCard/index.tsx +++ b/packages/prop-house-webapp/src/components/TimedRoundProposalCard/index.tsx @@ -17,6 +17,7 @@ import { Proposal, Round, Timed } from '@prophouse/sdk-react'; import { useAppSelector } from '../../hooks'; import ProposalCardClaimAwardBar from '../ProposalCardClaimAwardBar'; import { getBlockExplorerURL } from '../../utils/getBlockExplorerUrl'; +import { getChecksumAddress } from '../../utils/getChecksumAddress'; import { useAccount, useChainId } from 'wagmi'; import Button, { ButtonColor } from '../Button'; import { cmdPlusClicked } from '../../utils/cmdPlusClicked'; @@ -162,7 +163,7 @@ const TimedRoundProposalCard: React.FC<{ {roundEndedAndNotCancelled && - account.address === proposal.proposer && + account.address === getChecksumAddress(proposal.proposer) && proposal.isWinner && } diff --git a/packages/prop-house-webapp/src/utils/getChecksumAddress.ts b/packages/prop-house-webapp/src/utils/getChecksumAddress.ts new file mode 100644 index 000000000..3103c6b32 --- /dev/null +++ b/packages/prop-house-webapp/src/utils/getChecksumAddress.ts @@ -0,0 +1,3 @@ +import { utils } from 'ethers'; + +export const getChecksumAddress = (address: string) => utils.getAddress(address.replace('0x', '').padStart(40, '0'))