@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.
@@ -31353,25 +31353,28 @@ ${prettyStateOverride(stateOverride)}`;
31353
31353
  var EFP_API = "https://api.ethfollow.xyz/api/v1";
31354
31354
  async function fetchEFPGraph(address) {
31355
31355
  try {
31356
- const listsResp = await fetch(`${EFP_API}/users/${address}/lists`);
31357
- if (!listsResp.ok) return null;
31358
- const listsData = await listsResp.json();
31359
- const listId = listsData.primary_list;
31360
- if (!listId) return null;
31361
- const [followingResp, statsResp, top8Resp] = await Promise.all([
31362
- fetch(`${EFP_API}/lists/${listId}/following?limit=100`),
31356
+ const [statsResp, listsResp] = await Promise.all([
31363
31357
  fetch(`${EFP_API}/users/${address}/stats`),
31364
- fetch(`${EFP_API}/lists/${listId}/following?limit=8&tags=top8`)
31358
+ fetch(`${EFP_API}/users/${address}/lists`)
31365
31359
  ]);
31366
- const followingData = followingResp.ok ? await followingResp.json() : { following: [] };
31360
+ if (!statsResp.ok && !listsResp.ok) return null;
31367
31361
  const statsData = statsResp.ok ? await statsResp.json() : {};
31368
- const top8Data = top8Resp.ok ? await top8Resp.json() : { following: [] };
31369
- return {
31370
- followers: parseInt(statsData.followers_count) || 0,
31371
- following: (followingData.following || []).length,
31372
- top8: (top8Data.following || []).map((f2) => f2.data),
31373
- hasEfp: true
31374
- };
31362
+ const listsData = listsResp.ok ? await listsResp.json() : {};
31363
+ const followers = parseInt(statsData.followers_count) || 0;
31364
+ const listId = listsData.primary_list;
31365
+ let following = 0;
31366
+ let top8 = [];
31367
+ if (listId) {
31368
+ const [followingResp, top8Resp] = await Promise.all([
31369
+ fetch(`${EFP_API}/lists/${listId}/following?limit=100`),
31370
+ fetch(`${EFP_API}/lists/${listId}/following?limit=8&tags=top8`)
31371
+ ]);
31372
+ const followingData = followingResp.ok ? await followingResp.json() : { following: [] };
31373
+ const top8Data = top8Resp.ok ? await top8Resp.json() : { following: [] };
31374
+ following = (followingData.following || []).length;
31375
+ top8 = (top8Data.following || []).map((f2) => f2.data);
31376
+ }
31377
+ return { followers, following, top8, hasEfp: !!listId || followers > 0 };
31375
31378
  } catch {
31376
31379
  return null;
31377
31380
  }