Skip to content

Commit

Permalink
added super identity search
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 #107
  • Loading branch information
Bullrich committed Jan 3, 2024
1 parent 514cb79 commit c7f6c12
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/polkadot/fellows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,23 @@ export class PolkadotFellows implements TeamApi {
| Record<string, unknown>
| undefined;

// If the identity is null, we ignore it.
// If the identity is null, we check if there is a super identity.
if (!fellowData) {
this.logger.debug("Identity is null. Skipping");
this.logger.debug("Identity is null. Checking for super identity");
const superIdentity = (await api.query.identity.superOf(fellow.address)).toHuman() as
| [string, { Raw: string }]
| undefined;
if (superIdentity && superIdentity[0]) {
this.logger.debug(`${fellow.address} has a super identity: ${superIdentity[0]}. Adding it to the array`);
fellows.push({ address: superIdentity[0], rank: fellow.rank });
} else {
this.logger.debug("No super identity found. Skipping");
}
continue;
}

// @ts-ignore
const additional = fellowData.info.additional as [{ Raw: string }, { Raw: string }][] | undefined;
const additional = fellowData.info?.additional as [{ Raw: string }, { Raw: string }][] | undefined;

// If it does not have additional data (GitHub handle goes here) we ignore it
if (!additional || additional.length < 1) {
Expand Down

0 comments on commit c7f6c12

Please sign in to comment.