From 07644d2d6d88436a26408f4ac0a379203421f8f9 Mon Sep 17 00:00:00 2001 From: yuetloo Date: Tue, 4 Jun 2024 09:12:33 -0400 Subject: [PATCH] generate subgraph pubKeyId using maciAddress --- vue-app/src/api/cart.ts | 5 ++--- vue-app/src/api/contributions.ts | 11 +++++------ vue-app/src/graphql/API.ts | 5 ++--- .../graphql/queries/GetContributorMessages.graphql | 2 -- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/vue-app/src/api/cart.ts b/vue-app/src/api/cart.ts index c95993530..fd5c3ca62 100644 --- a/vue-app/src/api/cart.ts +++ b/vue-app/src/api/cart.ts @@ -17,15 +17,14 @@ export async function getCommittedCart( encryptionKey: string, contributorAddress: string, ): Promise { - const { coordinatorPubKey, fundingRoundAddress, voiceCreditFactor, nativeTokenDecimals, recipientRegistryAddress } = - round + const { coordinatorPubKey, maciAddress, voiceCreditFactor, nativeTokenDecimals, recipientRegistryAddress } = round const encKeypair = await Keypair.createFromSeed(encryptionKey) const sharedKey = Keypair.genEcdhSharedKey(encKeypair.privKey, coordinatorPubKey) const messages = await getContributorMessages({ - fundingRoundAddress, + maciAddress, contributorKey: encKeypair, coordinatorPubKey, contributorAddress, diff --git a/vue-app/src/api/contributions.ts b/vue-app/src/api/contributions.ts index d25775dd2..a6aed99ef 100644 --- a/vue-app/src/api/contributions.ts +++ b/vue-app/src/api/contributions.ts @@ -177,29 +177,28 @@ function getMaciMessage(type: any, data: any[] | null): Message { /** * Get the latest set of vote messages submitted by contributor - * @param fundingRoundAddress Funding round contract address + * @param maciAddress MACI contract address * @param contributorKey Contributor key used to encrypt messages * @param coordinatorPubKey Coordinator public key * @returns MACI messages */ export async function getContributorMessages({ - fundingRoundAddress, + maciAddress, contributorKey, coordinatorPubKey, contributorAddress, }: { - fundingRoundAddress: string + maciAddress: string contributorKey: Keypair coordinatorPubKey: PubKey contributorAddress: string }): Promise { - if (!fundingRoundAddress) { + if (!maciAddress) { return [] } - const key = getPubKeyId(fundingRoundAddress, contributorKey.pubKey) + const key = getPubKeyId(maciAddress, contributorKey.pubKey) const result = await sdk.GetContributorMessages({ - fundingRoundAddress: fundingRoundAddress.toLowerCase(), pubKey: key, contributorAddress: contributorAddress.toLowerCase(), }) diff --git a/vue-app/src/graphql/API.ts b/vue-app/src/graphql/API.ts index 121c59320..36ba4ad46 100644 --- a/vue-app/src/graphql/API.ts +++ b/vue-app/src/graphql/API.ts @@ -3147,7 +3147,6 @@ export type GetContributorIndexQueryVariables = Exact<{ export type GetContributorIndexQuery = { __typename?: 'Query', publicKeys: Array<{ __typename?: 'PublicKey', id: string, stateIndex: any | null }> }; export type GetContributorMessagesQueryVariables = Exact<{ - fundingRoundAddress: Scalars['String']; pubKey: Scalars['String']; contributorAddress: Scalars['Bytes']; }>; @@ -3280,9 +3279,9 @@ export const GetContributorIndexDocument = gql` } `; export const GetContributorMessagesDocument = gql` - query GetContributorMessages($fundingRoundAddress: String!, $pubKey: String!, $contributorAddress: Bytes!) { + query GetContributorMessages($pubKey: String!, $contributorAddress: Bytes!) { messages( - where: {fundingRound: $fundingRoundAddress, publicKey: $pubKey, submittedBy: $contributorAddress} + where: {publicKey: $pubKey, submittedBy: $contributorAddress} first: 1000 orderBy: blockNumber orderDirection: desc diff --git a/vue-app/src/graphql/queries/GetContributorMessages.graphql b/vue-app/src/graphql/queries/GetContributorMessages.graphql index d163b923b..5a3acbac4 100644 --- a/vue-app/src/graphql/queries/GetContributorMessages.graphql +++ b/vue-app/src/graphql/queries/GetContributorMessages.graphql @@ -1,11 +1,9 @@ query GetContributorMessages( - $fundingRoundAddress: String! $pubKey: String! $contributorAddress: Bytes! ) { messages( where: { - fundingRound: $fundingRoundAddress, publicKey: $pubKey, submittedBy: $contributorAddress },