Skip to content

Commit

Permalink
chore: remove unnecessary function
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkuSchick committed Mar 18, 2023
1 parent 48ff526 commit 39b7462
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 67 deletions.
35 changes: 2 additions & 33 deletions group-generators/helpers/data-providers/gitpoap/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import axios from "axios";
import { GitPoap, GitPoapAddresses } from "./types";
import { GitPoapAddresses } from "./types";
import { FetchedData } from "topics/group";


Expand All @@ -14,7 +14,7 @@ export class GitPoapProvider {
this.url = "https://public-api.gitpoap.io/";
}

async getGitPoap(endpoint: string): Promise<any> {
private async getGitPoap(endpoint: string): Promise<any> {
const { data: res } = await axios({
url: this.url + endpoint,
method: "get",
Expand Down Expand Up @@ -50,35 +50,4 @@ export class GitPoapProvider {
return Object(holders).keys().length;
}

public async getGitPoapEventsIDByAddress(address: string ): Promise<FetchedData> {
const dataProfiles: FetchedData = {};
const gitPoapEventsID: number[] = [];
try {
const req: GitPoap[]= await this.getGitPoap("/v1/address/" + address + "/gitpoaps");
for (let index = 0; index < req.length; index++) {
gitPoapEventsID.push(req[index].gitPoapEventId);
}

} catch (error) {
throw new Error("Error fetching total number of users: " + error);
}

await Promise.all(gitPoapEventsID)
.then((events) => {
events.forEach((event) => {
if (event != 0) {
gitPoapEventsID[event] = 1;
}
});
});

return dataProfiles;
}


public async getGitPoapEventsIDByAddressCount(address: string): Promise<number> {
const gitPoaps = this.getGitPoapEventsIDByAddress(address);
return Object(gitPoaps).keys().length;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,6 @@
"description": "Event id of the GitPOAP token"
}
]
},
{
"name": "Get GitPOAPEventIds given an Ethereum Address or ENS name",
"functionName": "getGitPoapEventsIDByAddress",
"countFunctionName": "getGitPoapEventsIDByAddressCount",
"description": "Returns all the Event Ids of all POAPs owned by an Ethereum Address or ENS name",
"args": [
{
"name": "ethereum wallet address",
"argName": "address",
"type": "string",
"example": "0x02738d122e0970aAf8DEADf0c6A217a1923E1e99, gitpoap.eth",
"description": "Ethereum wallet address of the holders of the GitPOAP tokens"
}
]
}
]
}
17 changes: 0 additions & 17 deletions group-generators/helpers/data-providers/gitpoap/types.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,3 @@

export type GitPoap = {
gitPoapId: number,
gitPoapEventId: number,
poapTokenId: number,
poapEventId: number,
poapEventFancyId: string,
name: string,
year: number,
description: string,
imageUrl: string,
repositories: string,
earnedAt: Date,
mintedAt: Date
};


export type GitPoapAddresses = {
addresses: string[],
}
2 changes: 0 additions & 2 deletions group-generators/helpers/data-providers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ export const dataProvidersAPIEndpoints = {
GitPoapProvider: {
getGitPoapHoldersByEventIdCount: async (_: any) =>
new GitPoapProvider().getGitPoapHoldersByEventIdCount(_),
getGitPoapEventsIDByAddressCount: async (_: any) =>
new GitPoapProvider().getGitPoapEventsIDByAddressCount(_),
},
LensProvider: {
getFollowersCount: async (_: any) =>
Expand Down

0 comments on commit 39b7462

Please sign in to comment.