@thurinlabs/identity-kit 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1276,6 +1276,12 @@ declare function hasEmailUserID(armoredKey: string): Promise<boolean>;
1276
1276
  declare function fetchKeyByFingerprint(fingerprint: string): Promise<string | null>;
1277
1277
  declare function fetchKeyByKeyId(keyId: string): Promise<string | null>;
1278
1278
 
1279
+ /**
1280
+ * EFP social graph for an address. Followers are counted by EFP for any address,
1281
+ * whether or not it has published a list of its own; following and top-8 exist
1282
+ * only when it has (its "primary list"). An address with followers but no list
1283
+ * — a project account that has never followed anyone — is still on EFP.
1284
+ */
1279
1285
  declare function fetchEFPGraph(address: string): Promise<EFPGraph | null>;
1280
1286
 
1281
1287
  /** Normalize a fingerprint to lowercase hex with no prefix or spaces. Returns null if malformed. */
package/dist/index.d.ts CHANGED
@@ -1276,6 +1276,12 @@ declare function hasEmailUserID(armoredKey: string): Promise<boolean>;
1276
1276
  declare function fetchKeyByFingerprint(fingerprint: string): Promise<string | null>;
1277
1277
  declare function fetchKeyByKeyId(keyId: string): Promise<string | null>;
1278
1278
 
1279
+ /**
1280
+ * EFP social graph for an address. Followers are counted by EFP for any address,
1281
+ * whether or not it has published a list of its own; following and top-8 exist
1282
+ * only when it has (its "primary list"). An address with followers but no list
1283
+ * — a project account that has never followed anyone — is still on EFP.
1284
+ */
1279
1285
  declare function fetchEFPGraph(address: string): Promise<EFPGraph | null>;
1280
1286
 
1281
1287
  /** Normalize a fingerprint to lowercase hex with no prefix or spaces. Returns null if malformed. */
package/dist/index.js CHANGED
@@ -1599,25 +1599,28 @@ import { useQuery as useQuery2 } from "@tanstack/react-query";
1599
1599
  var EFP_API = "https://api.ethfollow.xyz/api/v1";
1600
1600
  async function fetchEFPGraph(address) {
1601
1601
  try {
1602
- const listsResp = await fetch(`${EFP_API}/users/${address}/lists`);
1603
- if (!listsResp.ok) return null;
1604
- const listsData = await listsResp.json();
1605
- const listId = listsData.primary_list;
1606
- if (!listId) return null;
1607
- const [followingResp, statsResp, top8Resp] = await Promise.all([
1608
- fetch(`${EFP_API}/lists/${listId}/following?limit=100`),
1602
+ const [statsResp, listsResp] = await Promise.all([
1609
1603
  fetch(`${EFP_API}/users/${address}/stats`),
1610
- fetch(`${EFP_API}/lists/${listId}/following?limit=8&tags=top8`)
1604
+ fetch(`${EFP_API}/users/${address}/lists`)
1611
1605
  ]);
1612
- const followingData = followingResp.ok ? await followingResp.json() : { following: [] };
1606
+ if (!statsResp.ok && !listsResp.ok) return null;
1613
1607
  const statsData = statsResp.ok ? await statsResp.json() : {};
1614
- const top8Data = top8Resp.ok ? await top8Resp.json() : { following: [] };
1615
- return {
1616
- followers: parseInt(statsData.followers_count) || 0,
1617
- following: (followingData.following || []).length,
1618
- top8: (top8Data.following || []).map((f) => f.data),
1619
- hasEfp: true
1620
- };
1608
+ const listsData = listsResp.ok ? await listsResp.json() : {};
1609
+ const followers = parseInt(statsData.followers_count) || 0;
1610
+ const listId = listsData.primary_list;
1611
+ let following = 0;
1612
+ let top8 = [];
1613
+ if (listId) {
1614
+ const [followingResp, top8Resp] = await Promise.all([
1615
+ fetch(`${EFP_API}/lists/${listId}/following?limit=100`),
1616
+ fetch(`${EFP_API}/lists/${listId}/following?limit=8&tags=top8`)
1617
+ ]);
1618
+ const followingData = followingResp.ok ? await followingResp.json() : { following: [] };
1619
+ const top8Data = top8Resp.ok ? await top8Resp.json() : { following: [] };
1620
+ following = (followingData.following || []).length;
1621
+ top8 = (top8Data.following || []).map((f) => f.data);
1622
+ }
1623
+ return { followers, following, top8, hasEfp: !!listId || followers > 0 };
1621
1624
  } catch {
1622
1625
  return null;
1623
1626
  }