Skip to content

Commit d4f0a77

Browse files
thelostone-mc0xkenj1nijoe1
authoredMar 18, 2025··
feat: indexer integration (#36) (#50)
* feat: indexer integration (#36) * feat: indexer integration * Fix/indexer integration (#1) * fix: added required query param * fix: unsupported canonical project query * fix: mocks --------- Co-authored-by: Nick Lionis <nikolaos@gitcoin.co> * tweak * add changeset --------- Co-authored-by: 0xkenj1 <165053496+0xkenj1@users.noreply.github.com> Co-authored-by: Nick Lionis <nikolaos@gitcoin.co>
1 parent f632404 commit d4f0a77

File tree

17 files changed

+139
-135
lines changed

17 files changed

+139
-135
lines changed
 

‎.changeset/few-files-sip.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@gitcoin/ui": patch
3+
---
4+
5+
migrate checker to use new indexer

‎packages/ui/.storybook/preview.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { withThemeByDataAttribute } from "@storybook/addon-themes";
2-
import { mockDateDecorator } from "storybook-mock-date-decorator";
3-
42
import type { Preview } from "@storybook/react";
53
import { initialize, mswLoader } from "msw-storybook-addon";
4+
import { mockDateDecorator } from "storybook-mock-date-decorator";
65

76
import "../src/index.css";
87
import { handlers } from "../src/mocks/handlers";

‎packages/ui/src/features/application/components/ApplicationSummary/mocks.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ export const application: CheckerApplication = {
6464
updatedAt: "2023-01-01T00:00:00Z",
6565
},
6666
],
67-
canonicalProject: {
68-
roles: [{ address: "0xroleaddress1234567890abcdef12345678" }],
67+
project: {
68+
projectRoles: [{ address: "0xroleaddress1234567890abcdef12345678" }],
6969
},
7070
alloApplicationId: "",
7171
evaluations: [],

‎packages/ui/src/features/checker/apps/Checker.stories.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ const meta = {
1010
component: Checker,
1111
args: {
1212
address: "0x0D1781F0b693b35939A49831A6C799B938Bd2F80",
13-
poolId: "597",
14-
chainId: 11155111,
13+
poolId: "7",
14+
chainId: 10,
1515
},
1616
} satisfies Meta;
1717

‎packages/ui/src/features/checker/hooks/useApplicationEvaluations.ts

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export const useApplicationEvaluations = (
2020
roundId,
2121
applicationId,
2222
);
23+
if (!application || !applicationEvaluations) return undefined;
2324
const data = {
2425
application,
2526
applicationEvaluations: applicationEvaluations,

‎packages/ui/src/features/checker/hooks/usePoolData.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,9 @@ export const usePoolData = (): { poolData: CheckerPoolData | null; refetch: () =
7272

7373
useEffect(() => {
7474
if (data && poolId && chainId && address) {
75-
const managers = data.roundData.roles.map((role) => role.address.toLowerCase());
75+
const managers = data.roundData.project.projectRoles.map((role) =>
76+
role.address.toLowerCase(),
77+
);
7678
dispatch(
7779
setPoolDataAction({
7880
poolId,

‎packages/ui/src/features/checker/pages/ApplicationEvaluationOverviewPage/ApplicationEvaluationOverviewPage.stories.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ export const Default: Story = {
4040
},
4141
},
4242
args: {
43-
chainId: 11155111,
44-
poolId: "605",
43+
chainId: 10,
44+
poolId: "7",
4545
applicationId: "1",
4646
address: "0x0D1781F0b693b35939A49831A6C799B938Bd2F80",
4747
},

‎packages/ui/src/features/checker/pages/SubmitApplicationEvaluationPage/SubmitApplicationEvaluationPage.stories.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ export const Default: Story = {
4343
},
4444
},
4545
args: {
46-
chainId: 11155111,
47-
poolId: "605",
46+
chainId: 10,
47+
poolId: "7",
4848
applicationId: "1",
4949
address: "0x0D1781F0b693b35939A49831A6C799B938Bd2F80",
5050
},

‎packages/ui/src/features/checker/pages/ViewApplicationEvaluationsPage/ViewApplicationEvaluationsPage.stories.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ export const Default: Story = {
4040
},
4141
},
4242
args: {
43-
chainId: 42161,
44-
poolId: "609",
45-
applicationId: "0",
43+
chainId: 10,
44+
poolId: "7",
45+
applicationId: "1",
4646
},
4747
};

‎packages/ui/src/features/checker/services/allo/alloClient.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { GraphQLClient } from "graphql-request";
33

44
// Base URL for the GraphQL API
5-
const GS_INDEXER_ENDPOINT = "https://grants-stack-indexer-v2.gitcoin.co/graphql";
5+
const GS_INDEXER_ENDPOINT = "https://yc7lia2566.execute-api.us-east-2.amazonaws.com/api/v1/graphql";
66

77
// Create a new instance of GraphQLClient
88
export const graphqlClient = new GraphQLClient(GS_INDEXER_ENDPOINT, {

‎packages/ui/src/features/checker/services/allo/dataLayer.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export async function getApplicationsFromIndexer(
1919
});
2020
return {
2121
applications: response.applications as ProjectApplicationForManager[],
22-
roundData: response.round as PoolInfo,
22+
roundData: response.rounds[0] as PoolInfo,
2323
};
2424
} catch (e) {
2525
throw new Error(`Failed to fetch applications data. with error: ${e}`);
@@ -37,7 +37,7 @@ export async function getApplicationByIdFromIndexer(
3737
roundId,
3838
applicationId,
3939
});
40-
return response.application as ProjectApplication;
40+
return response.applications[0] as ProjectApplication;
4141
} catch (e) {
4242
throw new Error(`Failed to fetch application data. with error: ${e}`);
4343
}
@@ -55,7 +55,7 @@ export async function getPastApplicationsByApplicationIdFromIndexer(
5555
applicationId,
5656
});
5757

58-
return response.applications[0].project.applications as PastApplication[];
58+
return response.applications[0].project[0].applications as PastApplication[];
5959
} catch (e) {
6060
throw new Error(`Failed to fetch past applications data. with error: ${e}`);
6161
}

‎packages/ui/src/features/checker/services/allo/queries.ts

+13-18
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ import { gql } from "graphql-request";
22

33
export const applicationsForManagerQuery = gql`
44
query getApplicationsForManager($chainId: Int!, $roundId: String!) {
5-
applications(
6-
first: 1000
7-
filter: { roundId: { equalTo: $roundId }, chainId: { equalTo: $chainId } }
8-
) {
5+
applications(limit: 1000, where: { roundId: { _eq: $roundId }, chainId: { _eq: $chainId } }) {
96
id
107
projectId
118
chainId
@@ -16,33 +13,35 @@ export const applicationsForManagerQuery = gql`
1613
distributionTransaction
1714
statusSnapshots
1815
anchorAddress
19-
canonicalProject {
20-
roles {
16+
project {
17+
projectRoles {
2118
address
2219
}
2320
}
2421
}
25-
round(chainId: $chainId, id: $roundId) {
22+
rounds(where: { chainId: { _eq: $chainId }, id: { _eq: $roundId } }) {
2623
roundMetadata
2724
strategyName
2825
strategyAddress
2926
applicationsStartTime
3027
applicationsEndTime
3128
donationsEndTime
3229
donationsStartTime
33-
roles {
34-
address
35-
}
3630
project {
3731
id
32+
projectRoles {
33+
address
34+
}
3835
}
3936
}
4037
}
4138
`;
4239

4340
export const getApplicationByIdQuery = gql`
4441
query getApplicationById($chainId: Int!, $roundId: String!, $applicationId: String!) {
45-
application(chainId: $chainId, roundId: $roundId, id: $applicationId) {
42+
applications(
43+
where: { chainId: { _eq: $chainId }, roundId: { _eq: $roundId }, id: { _eq: $applicationId } }
44+
) {
4645
id
4746
projectId
4847
chainId
@@ -53,8 +52,8 @@ export const getApplicationByIdQuery = gql`
5352
distributionTransaction
5453
statusSnapshots
5554
anchorAddress
56-
canonicalProject {
57-
roles {
55+
project {
56+
projectRoles {
5857
address
5958
}
6059
}
@@ -69,11 +68,7 @@ export const getPastApplicationsQueryByApplicationId = gql`
6968
$applicationId: String!
7069
) {
7170
applications(
72-
filter: {
73-
chainId: { equalTo: $chainId }
74-
roundId: { equalTo: $roundId }
75-
id: { equalTo: $applicationId }
76-
}
71+
where: { chainId: { _eq: $chainId }, roundId: { _eq: $roundId }, id: { _eq: $applicationId } }
7772
) {
7873
project {
7974
applications {

‎packages/ui/src/features/checker/services/allo/types.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ interface StatusSnapshot {
9595
export interface ProjectApplicationForManager extends ProjectApplication {
9696
anchorAddress: Address;
9797
statusSnapshots: StatusSnapshot[];
98-
canonicalProject: {
99-
roles: { address: Address }[];
98+
project: {
99+
projectRoles: { address: Address }[];
100100
};
101101
}
102102

‎packages/ui/src/features/checker/store/types.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ export interface PoolInfo {
1414
};
1515
project: {
1616
id: string;
17+
projectRoles: {
18+
address: string;
19+
}[];
1720
};
18-
roles: {
19-
address: string;
20-
}[];
2121
strategyAddress: string;
2222
strategyName: string;
2323
applicationsStartTime: string;

‎packages/ui/src/mocks/handlers.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const checkerPoolDataHandler = graphql.query("getCheckerPoolData", () =>
3131
});
3232

3333
export const indexerGetApplicationByIdHandler = graphql.query("getApplicationByIdQuery", () => {
34-
return HttpResponse.json({ data: { application: getApplicationById } });
34+
return HttpResponse.json({ data: { applications: [getApplicationById] } });
3535
});
3636

3737
export const checkerApplicationEvaluationsHandler = graphql.query(

‎packages/ui/src/mocks/mockData/applicationsForManager.ts

+93-91
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ export const applicationsForManagers = {
4444
},
4545
],
4646
anchorAddress: "0xb543d56ee04f516602057429ec4f1c85c19b1319",
47-
canonicalProject: {
48-
roles: [
47+
project: {
48+
projectRoles: [
4949
{
5050
address: "0x0d1781f0b693b35939a49831a6c799b938bd2f80",
5151
},
@@ -97,8 +97,8 @@ export const applicationsForManagers = {
9797
},
9898
],
9999
anchorAddress: "0x3bbb6cd15ff7d268640409aef5b2d407d4891276",
100-
canonicalProject: {
101-
roles: [
100+
project: {
101+
projectRoles: [
102102
{
103103
address: "0x5645bf145c3f1e974d0d7fb91bf3c68592ab5012",
104104
},
@@ -146,8 +146,8 @@ export const applicationsForManagers = {
146146
},
147147
],
148148
anchorAddress: "0x3cdcb6611703a053751d2e82accd4daeb913aaa6",
149-
canonicalProject: {
150-
roles: [
149+
project: {
150+
projectRoles: [
151151
{
152152
address: "0xe7eb5d2b5b188777df902e89c54570e7ef4f59ce",
153153
},
@@ -195,8 +195,8 @@ export const applicationsForManagers = {
195195
},
196196
],
197197
anchorAddress: "0x2c7296a5ec0539f0a018c7176c97c92a9c44e2b4",
198-
canonicalProject: {
199-
roles: [
198+
project: {
199+
projectRoles: [
200200
{
201201
address: "0xe7eb5d2b5b188777df902e89c54570e7ef4f59ce",
202202
},
@@ -244,8 +244,8 @@ export const applicationsForManagers = {
244244
},
245245
],
246246
anchorAddress: "0x739dba380a2e448d66492a19f1efbec4228834ce",
247-
canonicalProject: {
248-
roles: [
247+
project: {
248+
projectRoles: [
249249
{
250250
address: "0xe7eb5d2b5b188777df902e89c54570e7ef4f59ce",
251251
},
@@ -293,8 +293,8 @@ export const applicationsForManagers = {
293293
},
294294
],
295295
anchorAddress: "0x0193b4e5d895292ee332fe6b624dd5091d43cf75",
296-
canonicalProject: {
297-
roles: [
296+
project: {
297+
projectRoles: [
298298
{
299299
address: "0xe7eb5d2b5b188777df902e89c54570e7ef4f59ce",
300300
},
@@ -342,8 +342,8 @@ export const applicationsForManagers = {
342342
},
343343
],
344344
anchorAddress: "0xf490040fc45b7405dd695be07f09125a2e75c7a3",
345-
canonicalProject: {
346-
roles: [
345+
project: {
346+
projectRoles: [
347347
{
348348
address: "0xe7eb5d2b5b188777df902e89c54570e7ef4f59ce",
349349
},
@@ -391,8 +391,8 @@ export const applicationsForManagers = {
391391
},
392392
],
393393
anchorAddress: "0x656f2087b0c88370f74d3ed481694c99b7dcc035",
394-
canonicalProject: {
395-
roles: [
394+
project: {
395+
projectRoles: [
396396
{
397397
address: "0xe7eb5d2b5b188777df902e89c54570e7ef4f59ce",
398398
},
@@ -444,8 +444,8 @@ export const applicationsForManagers = {
444444
},
445445
],
446446
anchorAddress: "0x98df600f5676cb7b06d4ecd2c7c9df9a866d45a0",
447-
canonicalProject: {
448-
roles: [
447+
project: {
448+
projectRoles: [
449449
{
450450
address: "0x5645bf145c3f1e974d0d7fb91bf3c68592ab5012",
451451
},
@@ -554,8 +554,8 @@ export const applicationsForManagers = {
554554
},
555555
],
556556
anchorAddress: "0xe5023547991f22274f171f0cf0a88f69b178bb6d",
557-
canonicalProject: {
558-
roles: [
557+
project: {
558+
projectRoles: [
559559
{
560560
address: "0x5645bf145c3f1e974d0d7fb91bf3c68592ab5012",
561561
},
@@ -605,8 +605,8 @@ export const applicationsForManagers = {
605605
},
606606
],
607607
anchorAddress: "0x741bba71ab5f667b1f1abc5c64f24289aac26cf2",
608-
canonicalProject: {
609-
roles: [
608+
project: {
609+
projectRoles: [
610610
{
611611
address: "0x0d1781f0b693b35939a49831a6c799b938bd2f80",
612612
},
@@ -656,8 +656,8 @@ export const applicationsForManagers = {
656656
},
657657
],
658658
anchorAddress: "0x9af6aad853b1f1f2908551c3e28c49ccc79cc765",
659-
canonicalProject: {
660-
roles: [
659+
project: {
660+
projectRoles: [
661661
{
662662
address: "0x0d1781f0b693b35939a49831a6c799b938bd2f80",
663663
},
@@ -709,8 +709,8 @@ export const applicationsForManagers = {
709709
},
710710
],
711711
anchorAddress: "0x697a6cdd40b0bf7ce3ec818225f584ae5c48a573",
712-
canonicalProject: {
713-
roles: [
712+
project: {
713+
projectRoles: [
714714
{
715715
address: "0x5645bf145c3f1e974d0d7fb91bf3c68592ab5012",
716716
},
@@ -760,8 +760,8 @@ export const applicationsForManagers = {
760760
},
761761
],
762762
anchorAddress: "0x3b6a76df677df5489499ae8f67b07ed33a491dbb",
763-
canonicalProject: {
764-
roles: [
763+
project: {
764+
projectRoles: [
765765
{
766766
address: "0xb8cef765721a6da910f14be93e7684e9a3714123",
767767
},
@@ -808,8 +808,8 @@ export const applicationsForManagers = {
808808
},
809809
],
810810
anchorAddress: "0xfc024a01c5f837d7ff5164d541e6ec350a7eeff2",
811-
canonicalProject: {
812-
roles: [
811+
project: {
812+
projectRoles: [
813813
{
814814
address: "0x5645bf145c3f1e974d0d7fb91bf3c68592ab5012",
815815
},
@@ -854,84 +854,86 @@ export const applicationsForManagers = {
854854
},
855855
],
856856
anchorAddress: "0xc482ead44a5ba21b419eaa352bfdaee04592c0f1",
857-
canonicalProject: {
858-
roles: [
857+
project: {
858+
projectRoles: [
859859
{
860860
address: "0x5645bf145c3f1e974d0d7fb91bf3c68592ab5012",
861861
},
862862
],
863863
},
864864
},
865865
],
866-
round: {
867-
roundMetadata: {
868-
name: "Checker Test Round",
869-
support: {
870-
info: "yy@yy.yy",
871-
type: "Email",
872-
},
873-
roundType: "private",
874-
eligibility: {
875-
description:
876-
"This grant round is created purely for testing purposes. The project description is intentionally left empty, and the project itself is not intended to provide any meaningful service or product. This round is a placeholder for testing grant application processes.",
877-
requirements: [
866+
rounds: [
867+
{
868+
roundMetadata: {
869+
name: "Checker Test Round",
870+
support: {
871+
info: "yy@yy.yy",
872+
type: "Email",
873+
},
874+
roundType: "private",
875+
eligibility: {
876+
description:
877+
"This grant round is created purely for testing purposes. The project description is intentionally left empty, and the project itself is not intended to provide any meaningful service or product. This round is a placeholder for testing grant application processes.",
878+
requirements: [
879+
{
880+
requirement:
881+
"You must provide a link to something (anything). It could be a website, a GitHub repo, or even just a link to your social media.",
882+
},
883+
{
884+
requirement:
885+
"Your project must have a title. It can be a random word or phrase. Bonus points for creativity, but it's not required.",
886+
},
887+
{
888+
requirement:
889+
'Briefly describe your "project" in one sentence. It can be completely unrelated to the title and should not matter at all.',
890+
},
891+
{
892+
requirement: "Be awesome :)",
893+
},
894+
],
895+
},
896+
feesAddress: "",
897+
feesPercentage: 0,
898+
programContractAddress:
899+
"0x107879486cfb4f5e6284033fbe11a3cfd6bb447a119f15729cd8e3fc8ca8aff5",
900+
quadraticFundingConfig: {
901+
matchingCap: false,
902+
sybilDefense: "passport-mbds",
903+
minDonationThreshold: false,
904+
matchingFundsAvailable: 0.1,
905+
},
906+
},
907+
strategyName: "allov2.DonationVotingMerkleDistributionDirectTransferStrategy",
908+
strategyAddress: "0xc5a0a4d4b0c46fc430362377d3d11a23bad4a645",
909+
applicationsStartTime: "2024-11-26T13:50:00+00:00",
910+
applicationsEndTime: "2024-12-27T23:00:00+00:00",
911+
donationsEndTime: "2024-12-30T23:00:00+00:00",
912+
donationsStartTime: "2024-11-29T23:00:00+00:00",
913+
project: {
914+
id: "0x107879486cfb4f5e6284033fbe11a3cfd6bb447a119f15729cd8e3fc8ca8aff5",
915+
projectRoles: [
916+
{
917+
address: "0x0d1781f0b693b35939a49831a6c799b938bd2f80",
918+
},
878919
{
879-
requirement:
880-
"You must provide a link to something (anything). It could be a website, a GitHub repo, or even just a link to your social media.",
920+
address: "0x5645bf145c3f1e974d0d7fb91bf3c68592ab5012",
921+
},
922+
{
923+
address: "0x5645bf145c3f1e974d0d7fb91bf3c68592ab5012",
881924
},
882925
{
883-
requirement:
884-
"Your project must have a title. It can be a random word or phrase. Bonus points for creativity, but it's not required.",
926+
address: "0x5933fb4969b322220ed8c24f2088633115ecbcc0",
885927
},
886928
{
887-
requirement:
888-
'Briefly describe your "project" in one sentence. It can be completely unrelated to the title and should not matter at all.',
929+
address: "0x7b0e91c75ad9ec537083f61356c532bb882ea2fb",
889930
},
890931
{
891-
requirement: "Be awesome :)",
932+
address: "0xb8cef765721a6da910f14be93e7684e9a3714123",
892933
},
893934
],
894935
},
895-
feesAddress: "",
896-
feesPercentage: 0,
897-
programContractAddress:
898-
"0x107879486cfb4f5e6284033fbe11a3cfd6bb447a119f15729cd8e3fc8ca8aff5",
899-
quadraticFundingConfig: {
900-
matchingCap: false,
901-
sybilDefense: "passport-mbds",
902-
minDonationThreshold: false,
903-
matchingFundsAvailable: 0.1,
904-
},
905936
},
906-
strategyName: "allov2.DonationVotingMerkleDistributionDirectTransferStrategy",
907-
strategyAddress: "0xc5a0a4d4b0c46fc430362377d3d11a23bad4a645",
908-
applicationsStartTime: "2024-11-26T13:50:00+00:00",
909-
applicationsEndTime: "2024-12-27T23:00:00+00:00",
910-
donationsEndTime: "2024-12-30T23:00:00+00:00",
911-
donationsStartTime: "2024-11-29T23:00:00+00:00",
912-
roles: [
913-
{
914-
address: "0x0d1781f0b693b35939a49831a6c799b938bd2f80",
915-
},
916-
{
917-
address: "0x5645bf145c3f1e974d0d7fb91bf3c68592ab5012",
918-
},
919-
{
920-
address: "0x5645bf145c3f1e974d0d7fb91bf3c68592ab5012",
921-
},
922-
{
923-
address: "0x5933fb4969b322220ed8c24f2088633115ecbcc0",
924-
},
925-
{
926-
address: "0x7b0e91c75ad9ec537083f61356c532bb882ea2fb",
927-
},
928-
{
929-
address: "0xb8cef765721a6da910f14be93e7684e9a3714123",
930-
},
931-
],
932-
project: {
933-
id: "0x107879486cfb4f5e6284033fbe11a3cfd6bb447a119f15729cd8e3fc8ca8aff5",
934-
},
935-
},
937+
],
936938
},
937939
};

‎packages/ui/src/mocks/mockData/indexerGetApplicationById.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ export const getApplicationById = {
189189
strategyName: "allov2.DonationVotingMerkleDistributionDirectTransferStrategy",
190190
strategyAddress: "0xd2d99614321becd7cd0636715bbb4c94968e6271",
191191
},
192-
canonicalProject: {
193-
roles: [
192+
project: {
193+
projectRoles: [
194194
{
195195
address: "0xd35e119782059a27fead4edda8b555f393650bc8",
196196
},

0 commit comments

Comments
 (0)
Please sign in to comment.