Skip to content

Commit 72b774d

Browse files
committed
update query
1 parent f69bc3a commit 72b774d

File tree

8 files changed

+23
-28
lines changed

8 files changed

+23
-28
lines changed

packages/data-layer/src/data-layer.test.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,14 @@ const mockProjects: v2Project[] = [
3232
},
3333
metadataCid: "bafkreie4ra5mdxumvxhsjpvawhvtdovlgjk4v74zsgvpqrs2ehdk5srtl4",
3434
name: "Jax v2 test 4",
35-
nodeId:
36-
"WyJwcm9qZWN0cyIsIjB4OGE3OTI0OWI2MzM5NWMyNWJkMTIxYmE2ZmYyODAxOThjMzk5ZDRmYjNmOTUxZmMzYzQyMTk3YjU0YTZkYjZhNiIsMTExNTUxMTFd",
3735
// note: This is moved to roles also
3836
createdByAddress: "0x0000",
3937
createdAtBlock: "5146499",
4038
updatedAtBlock: "5146499",
4139
projectNumber: null,
4240
registryAddress: "0x4aacca72145e1df2aec137e1f3c5e3d75db8b5f3",
4341
tags: ["allo-v2"],
44-
roles: [
42+
projectRoles: [
4543
{
4644
address: "0xe849b2a694184b8739a04c915518330757cdb18b",
4745
role: "OWNER",
@@ -585,15 +583,14 @@ describe("v2 projects retrieval", () => {
585583
});
586584

587585
expect(project?.project.id).toEqual(mockProject.id);
588-
expect(project?.project.nodeId).toEqual(mockProject.nodeId);
589586
expect(project?.project.chainId).toEqual(mockProject.chainId);
590587
expect(project?.project.registryAddress).toEqual(
591588
mockProject.registryAddress,
592589
);
593590
// Note: projectNumber is depreciated in v2 and should be null
594591
expect(project?.project.projectNumber).toEqual(null);
595592
expect(project?.project.tags).toEqual(mockProject.tags);
596-
expect(project?.project.roles).toEqual(mockProject.roles);
593+
expect(project?.project.projectRoles).toEqual(mockProject.projectRoles);
597594
expect(project?.project.name).toEqual(mockProject.name);
598595
expect(project?.project.metadata.description).toEqual(
599596
mockProject.metadata.description,

packages/data-layer/src/data-layer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ export class DataLayer {
263263
projectId: string;
264264
chainId: number;
265265
}): Promise<Address | undefined> {
266-
const response: { project?: { anchorAddress: Address } } = await request(
266+
const response: { projects: Array<{ anchorAddress: Address }>} = await request(
267267
this.gsIndexerEndpoint,
268268
getProjectAnchorByIdAndChainId,
269269
{
@@ -272,7 +272,7 @@ export class DataLayer {
272272
},
273273
);
274274

275-
return response?.project?.anchorAddress;
275+
return response?.projects[0]?.anchorAddress;
276276
}
277277

278278
/**

packages/data-layer/src/data.types.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ export type v2Project = {
174174
*/
175175
metadataCid: string;
176176
name: string;
177-
nodeId: string;
178177
/**
179178
* The project number from v1
180179
*
@@ -205,7 +204,7 @@ export type v2Project = {
205204
* The block the project was updated at
206205
*/
207206
updatedAtBlock: string;
208-
roles: AddressAndRole[];
207+
projectRoles: AddressAndRole[];
209208
nonce?: bigint;
210209
anchorAddress?: string;
211210
/**
@@ -273,6 +272,7 @@ export type DirectDonationValues = {
273272
amount: number;
274273
donorAddress: string;
275274
amountInUsd: number;
275+
projectId: string;
276276
};
277277

278278
/**
@@ -301,8 +301,8 @@ export type ProjectApplicationForManager = ProjectApplication & {
301301
strategyName: string;
302302
strategyAddress: string;
303303
};
304-
canonicalProject: {
305-
roles: { address: Address }[];
304+
project: {
305+
projectRoles: { address: Address }[];
306306
};
307307
};
308308

@@ -397,7 +397,7 @@ export type ProjectApplicationWithProject = {
397397
};
398398

399399
export type V2RoundWithRoles = V2Round & {
400-
roles: AddressAndRole[];
400+
roundRoles: AddressAndRole[];
401401
createdByAddress: string;
402402
};
403403

@@ -792,6 +792,7 @@ export type Contribution = {
792792
project: {
793793
name: string;
794794
metadata?: ProjectMetadata;
795+
projectType: string;
795796
};
796797
};
797798
timestamp: string;
@@ -812,7 +813,7 @@ export type RoundApplicationPayout = {
812813
applications: [
813814
{
814815
id: string;
815-
applicationsPayoutsByChainIdAndRoundIdAndApplicationId: Payout[];
816+
applicationsPayouts: Payout[];
816817
},
817818
];
818819
};

packages/data-layer/src/queries.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ export const getProjectsById = gql`
103103
metadata
104104
metadataCid
105105
name
106-
nodeId
107106
projectNumber
108107
registryAddress
109108
tags
@@ -561,7 +560,7 @@ export const getProjectsBySearchTerm = gql`
561560
export const getProjectsAndRolesByAddress = gql`
562561
query getProjectsAndRolesByAddressQuery(
563562
$address: String!
564-
$version: String! //TODO: chainge the code in which this query is called
563+
$version: String!
565564
$chainIds: [Int!]!
566565
) {
567566
projects(
@@ -705,7 +704,7 @@ const getRoundForManagerFields = `
705704
fundedAmount
706705
fundedAmountInUsd
707706
matchingDistribution
708-
roles(first: 100) {
707+
roundRoles(first: 100) {
709708
role
710709
address
711710
createdAtBlock

packages/round-manager/src/features/api/program.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export async function listPrograms(
3939
programs.push({
4040
id: program.id,
4141
metadata: program.metadata,
42-
operatorWallets: program.roles.map(
42+
operatorWallets: program.projectRoles.map(
4343
(role: { address: string }) => role.address
4444
),
4545
tags: program.tags,
@@ -49,7 +49,7 @@ export async function listPrograms(
4949
logo: stringToBlobUrl(chain.icon),
5050
},
5151
createdByAddress: program.createdByAddress,
52-
roles: program.roles,
52+
roles: program.projectRoles,
5353
qfRoundsCount: program.qfRounds?.length || 0,
5454
dgRoundsCount: program.dgRounds?.length || 0,
5555
});
@@ -84,7 +84,7 @@ export async function getProgramById(
8484
return {
8585
id: program.id,
8686
metadata: program.metadata,
87-
operatorWallets: program.roles.map(
87+
operatorWallets: program.projectRoles.map(
8888
(role: { address: string }) => role.address
8989
),
9090
tags: program.tags,
@@ -93,6 +93,6 @@ export async function getProgramById(
9393
name: chain.prettyName,
9494
logo: stringToBlobUrl(chain.icon),
9595
},
96-
roles: program.roles,
96+
roles: program.projectRoles,
9797
};
9898
}

packages/round-manager/src/features/api/round.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export async function getRoundById(args: {
8383
}
8484

8585
function indexerV2RoundToRound(round: RoundForManager): Round {
86-
const operatorWallets = round.roles.map(
86+
const operatorWallets = round.roundRoles.map(
8787
(account: { address: string }) => account.address
8888
);
8989

@@ -129,7 +129,7 @@ function indexerV2RoundToRound(round: RoundForManager): Round {
129129
},
130130
ownedBy: round.projectId,
131131
operatorWallets: operatorWallets,
132-
roles: round.roles,
132+
roles: round.roundRoles,
133133
finalized: false,
134134
tags: round.tags,
135135
createdByAddress: round.createdByAddress,

packages/round-manager/src/features/api/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,9 @@ export const convertApplications = (
248248
) => {
249249
const applications: GrantApplication[] = dataLayerApplications.flatMap(
250250
(application) => {
251-
if (application.canonicalProject === null) {
251+
if (application.project === null) {
252252
console.error(
253-
`Canonical project not found for application ${application.id}`
253+
`project not found for application ${application.id}`
254254
);
255255
return [];
256256
}
@@ -268,7 +268,7 @@ export const convertApplications = (
268268
metadata: application.metadata,
269269
project: {
270270
...application.metadata.application.project,
271-
owners: application.canonicalProject.roles,
271+
owners: application.project.projectRoles,
272272
id: application.projectId,
273273
},
274274
projectId: application.projectId,

packages/round-manager/src/features/round/usePayouts.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,7 @@ export function usePayouts(args: {
3232
projectId: args.projectId,
3333
});
3434

35-
const payouts =
36-
result.applications[0]
37-
.applicationsPayoutsByChainIdAndRoundIdAndApplicationId;
35+
const payouts = result.applications[0].applicationsPayouts;
3836

3937
let mappedPayouts = payouts.map((payout) => {
4038
return {

0 commit comments

Comments
 (0)