Skip to content

Commit

Permalink
Let Avatar props be Address type
Browse files Browse the repository at this point in the history
  • Loading branch information
adamgall committed Jun 18, 2024
1 parent ddea81d commit 4f6555f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/components/Activity/ActivityDescriptionGovernance.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Box, Flex, Text } from '@chakra-ui/react';
import { useTranslation } from 'react-i18next';
import { getAddress } from 'viem';
import { useGetMetadata } from '../../hooks/DAO/proposal/useGetMetadata';
import useAvatar from '../../hooks/utils/useAvatar';
import useDisplayName from '../../hooks/utils/useDisplayName';
Expand Down Expand Up @@ -64,7 +65,7 @@ function ProposalAuthor({ activity }: { activity: Activity }) {
>
<Avatar
size="sm"
address={proposer}
address={getAddress(proposer)}
url={avatarURL}
/>
<Box>{author}</Box>
Expand Down
4 changes: 2 additions & 2 deletions src/components/ui/modals/DelegateModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function DelegateModal({ close }: { close: Function }) {

const submitDelegation = async (values: { address: string }) => {
if (!votesTokenAddress || !walletClient) return;
let validAddress = getAddress(values.address);
let validAddress = values.address;
if (validateENSName(validAddress) && publicClient) {
const maybeEnsAddress = await publicClient.getEnsAddress({ name: values.address });
if (maybeEnsAddress) {
Expand All @@ -54,7 +54,7 @@ export function DelegateModal({ close }: { close: Function }) {
});

contractCall({
contractFn: () => votingTokenContract.write.delegate([validAddress]),
contractFn: () => votingTokenContract.write.delegate([getAddress(validAddress)]),
pendingMessage: t('pendingDelegateVote'),
failedMessage: t('failedDelegateVote'),
successMessage: t('successDelegateVote'),
Expand Down
8 changes: 4 additions & 4 deletions src/components/ui/page/Header/Avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Box, Image } from '@chakra-ui/react';
import { blo } from 'blo';
import { Suspense } from 'react';
import { useImage } from 'react-image';
import { getAddress } from 'viem';
import { Address } from 'viem';

export type AvatarSize = 'icon' | 'lg' | 'sm';
const avatarSizes: { [size: string]: string } = {
Expand All @@ -11,15 +11,15 @@ const avatarSizes: { [size: string]: string } = {
lg: '2rem',
};

function BlockieAvatar({ address, size }: { size: AvatarSize; address: string }) {
function BlockieAvatar({ address, size }: { size: AvatarSize; address: Address }) {
return (
<Box
h={avatarSizes[size]}
w={avatarSizes[size]}
>
<Image
borderRadius="full"
src={blo(getAddress(address))}
src={blo(address)}
alt={address}
/>
</Box>
Expand Down Expand Up @@ -48,7 +48,7 @@ function Avatar({
url,
}: {
size?: AvatarSize;
address: string;
address: Address;
url?: string | null;
}) {
if (!url) {
Expand Down

0 comments on commit 4f6555f

Please sign in to comment.