Skip to content

Commit

Permalink
using zero address from utils
Browse files Browse the repository at this point in the history
  • Loading branch information
dan13ram committed Mar 14, 2023
1 parent dc29b8e commit 75a3c56
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions components/UserAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ import { Box } from '@chakra-ui/react';

import { useENSAvatar } from '@/hooks/useENS';
import { MongoUser } from '@/lib/mongodb/types';
import { ZERO_ADDRESS } from '@/utils/constants';
import { ipfsUriToHttp } from '@/utils/uriHelpers';
import { useWallet } from '@/web3';

import { Jazzicon } from './Jazzicon';

const ADDRESS_ZERO = '0x0000000000000000000000000000000000000000';

export const UserAvatar: React.FC<{
address: string | null | undefined;
profile: MongoUser | null | undefined;
Expand Down Expand Up @@ -43,5 +42,5 @@ export const UserAvatar: React.FC<{
);

// fallback to jazzicon
return <Jazzicon address={address ?? ADDRESS_ZERO} size={size} />;
return <Jazzicon address={address ?? ZERO_ADDRESS} size={size} />;
};
5 changes: 2 additions & 3 deletions hooks/useENS.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { isAddress } from '@ethersproject/address';
import { useCallback, useEffect, useState } from 'react';

import { ZERO_ADDRESS } from '@/utils/constants';
import { getEthersProvider } from '@/web3/providers';

const ADDRESS_ZERO = '0x0000000000000000000000000000000000000000';

export const fetchENSFromAddress = async (
address: string | null | undefined,
): Promise<string | null> => {
Expand Down Expand Up @@ -56,7 +55,7 @@ export const fetchAddressFromENS = async (
if (!ethProvider) return null;

const addr = await ethProvider.resolveName(name);
return ADDRESS_ZERO === addr ? null : addr;
return ZERO_ADDRESS === addr ? null : addr;
};

export const useAddressFromENS = (
Expand Down

0 comments on commit 75a3c56

Please sign in to comment.