-
-
+
);
}
- const blockExplorerLink = getBlockExplorerAddressLink(address);
- let displayName = shortAddress;
+ const ensName = accountData?.ens?.name || null;
+ const ensAvatar = accountData?.ens?.avatar || null;
+ const records = accountData?.ens?.records;
+ const description = records?.description;
+ const headerImage = records?.header;
+ const twitter = records?.["com.twitter"];
+ const github = records?.["com.github"];
+ const telegram = records?.["org.telegram"];
+ const email = records?.email;
+ const website = records?.url;
+ const contenthash = records?.contenthash;
- if (ensName) {
- displayName = ensName;
- }
-
- const size = getSize(displayName);
- const textSizeClass = `text-${size}`;
- const blockieSize = {
- sm: 28,
- base: 32,
- lg: 40,
- xl: 44,
- "2xl": 48,
- "3xl": 64,
- "4xl": 64,
- "5xl": 80,
- }[size];
-
- const copyAddressButton = (sizeClass: string) =>
- addressCopied ? (
-
- ) : (
- // @ts-ignore @todo fix this
-
{
- setAddressCopied(true);
- setTimeout(() => {
- setAddressCopied(false);
- }, 800);
- }}
- >
-
-
- );
+ const shortAddress = `${address.slice(0, 6)}...${address.slice(-4)}`;
+ const displayName = ensName || shortAddress;
+ const blockExplorerLink = getBlockExplorerAddressLink(address);
- const explorerLink = (
-
-
-
+ const copyAddressButton = (
+ <>
+ {addressCopied ? (
+
+ ) : (
+ // @ts-ignore
+
{
+ setAddressCopied(true);
+ setTimeout(() => setAddressCopied(false), 800);
+ }}
+ >
+
+
+ )}
+ >
);
+ const hasSocialLinks = twitter || github || telegram || email || website || contenthash;
+
return (
-
-
-
-
-
-
-
- {displayName} {ensName && explorerLink}
-
- {ensName && (
-
- {shortAddress} {copyAddressButton("w-4 h-4")}
-
- )}
+
+ {/* Background image overlay */}
+ {headerImage && (
+
+ )}
+
+
+ {/* Avatar and name row */}
+
+
+
+
+
+
- {!ensName && (
-
- {copyAddressButton("w-6 h-6")}
- {explorerLink}
+ {ensName && (
+
+ {shortAddress} {copyAddressButton}
)}
+ {!ensName &&
{copyAddressButton}
}
+
+ {/* Bio/Description */}
+ {description &&
{parseDescriptionWithEnsLinks(description)}
}
+
+ {/* Social links */}
+ {hasSocialLinks && (
+
+ {twitter && (
+
+
+
+ )}
+ {github && (
+
+
+
+ )}
+ {telegram && (
+
+
+
+ )}
+ {email && (
+
+
+
+ )}
+ {website && (
+
+
+
+ )}
+ {contenthash && ensName && (
+
+
+
+ )}
+
+ )}
+
+ {/* Follower/Following stats */}
+ {statsData && (
+
+
+ {statsData.followers_count.toLocaleString()}{" "}
+ followers
+
+
+ {statsData.following_count.toLocaleString()}{" "}
+ following
+
+
+ )}
);
diff --git a/packages/nextjs/utils/scaffold-eth/efpFetcher.ts b/packages/nextjs/utils/scaffold-eth/efpFetcher.ts
new file mode 100644
index 0000000..0c2bcb4
--- /dev/null
+++ b/packages/nextjs/utils/scaffold-eth/efpFetcher.ts
@@ -0,0 +1,49 @@
+export interface EfpAccountResponse {
+ address: string;
+ ens: {
+ name: string;
+ avatar: string | null;
+ records: {
+ avatar?: string;
+ "com.github"?: string;
+ "com.twitter"?: string;
+ contenthash?: string;
+ description?: string;
+ email?: string;
+ header?: string;
+ location?: string;
+ "org.telegram"?: string;
+ status?: string;
+ url?: string;
+ } | null;
+ updated_at: string;
+ };
+}
+
+export interface EfpStatsResponse {
+ followers_count: number;
+ following_count: number;
+}
+
+const EFP_API_BASE = "https://data.ethfollow.xyz/api/v1";
+
+export const efpAccountFetcher = async (url: string): Promise
=> {
+ const response = await fetch(url);
+ if (!response.ok) {
+ const error = new Error("Failed to fetch EFP account data");
+ throw error;
+ }
+ return response.json();
+};
+
+export const efpStatsFetcher = async (url: string): Promise => {
+ const response = await fetch(url);
+ if (!response.ok) {
+ const error = new Error("Failed to fetch EFP stats data");
+ throw error;
+ }
+ return response.json();
+};
+
+export const getEfpAccountUrl = (address: string) => `${EFP_API_BASE}/users/${address}/account`;
+export const getEfpStatsUrl = (address: string) => `${EFP_API_BASE}/users/${address}/stats`;
diff --git a/packages/nextjs/utils/scaffold-eth/index.ts b/packages/nextjs/utils/scaffold-eth/index.ts
index 31765b0..d915c48 100644
--- a/packages/nextjs/utils/scaffold-eth/index.ts
+++ b/packages/nextjs/utils/scaffold-eth/index.ts
@@ -1,4 +1,5 @@
export * from "./addressVision";
+export * from "./efpFetcher";
export * from "./moralisFetcher";
export * from "./networks";
export * from "./notification";