Skip to content

Commit

Permalink
Fixed some logs
Browse files Browse the repository at this point in the history
  • Loading branch information
fakepixels committed Oct 6, 2024
1 parent d36572d commit 7359952
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/components/IdentityWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ export default function IdentityWrapper() {
const [isOpen, setIsOpen] = useState(false); // State to manage dropdown visibility

useEffect(() => {
console.log('Address:', address); // Debug log

const fetchEnsText = async () => {

if (address) {
const cachedData = localStorage.getItem(address);
if (cachedData) {
Expand All @@ -32,38 +33,38 @@ export default function IdentityWrapper() {
}

try {
const name = await getName({ chain: base, address: address }); // Get the name of the address
console.log('Name:', name);
const normalizedAddress = normalize(name as string); // Normalize the fetched name
const truncatedAddress = normalizedAddress.split('.base.eth')[0]; // Truncate before ".base.eth"
console.log('Truncated Address:', truncatedAddress);

const name = await getName({ chain: base, address: address });
const normalizedAddress = normalize(name as string);

const twitterText = await publicClient.getEnsText({
name: normalizedAddress,
key: 'com.twitter',
});

const githubText = await publicClient.getEnsText({
name: normalizedAddress,
key: 'com.github',
});

const farcasterText = await publicClient.getEnsText({
name: normalizedAddress,
key: 'xyz.farcaster',
});

const urlText = await publicClient.getEnsText({
name: normalizedAddress,
key: 'url',
});
console.log('ENS Text Responses:', {
twitterText,
githubText,
urlText,
});


const fetchedData = {
twitter: twitterText,
github: githubText,
farcaster: farcasterText,
url: urlText,
};

setEnsText(fetchedData);
localStorage.setItem(address, JSON.stringify(fetchedData));
} catch (error) {
Expand Down

0 comments on commit 7359952

Please sign in to comment.