Skip to content

Commit

Permalink
Added search of super identity (#16)
Browse files Browse the repository at this point in the history
Added logic to search for a super identity in case that the user does
not have an identity.

If a super identity is found, this will be added to the array of address
to fetch an identity from.

This fixes #14
  • Loading branch information
Bullrich authored Mar 15, 2024
1 parent 619e534 commit 90c4e11
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/fellows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,23 @@ export const fetchAllFellows = async (

let data: FellowObject = { address: fellow.address, rank: fellow.rank };

// If the identity is null, we ignore it.
// If the identity is null, we check if there is a super identity.
if (!fellowData) {
logger.debug("Identity is null. Skipping");
logger.debug("Identity is null. Checking for super identity");
const superIdentity = await relayApi.query.Identity.SuperOf.getValue(
fellow.address,
);
if (superIdentity) {
const [address] = superIdentity;
logger.debug(
`${fellow.address} has a super identity: ${address}. Adding it to the array`,
);

fellows.push({ address, rank: fellow.rank });
} else {
logger.debug("No super identity found. Skipping");
}

continue;
}

Expand Down

0 comments on commit 90c4e11

Please sign in to comment.