diff --git a/subgraph/src/MACIMapping.ts b/subgraph/src/MACIMapping.ts index 211b98a6e..fb9876957 100644 --- a/subgraph/src/MACIMapping.ts +++ b/subgraph/src/MACIMapping.ts @@ -91,24 +91,24 @@ export function handleSignUp(event: SignUp): void { //NOTE: If the public keys aren't being tracked initialize them if (publicKey == null) { - let publicKey = new PublicKey(publicKeyId) - publicKey.x = event.params._userPubKey.x - publicKey.y = event.params._userPubKey.y - publicKey.stateIndex = event.params._stateIndex - - publicKey.voiceCreditBalance = event.params._voiceCreditBalance + publicKey = new PublicKey(publicKeyId) + } + publicKey.x = event.params._userPubKey.x + publicKey.y = event.params._userPubKey.y + publicKey.stateIndex = event.params._stateIndex - let fundingRoundAddress = event.transaction.to! - let fundingRoundId = fundingRoundAddress.toHex() - let fundingRound = FundingRound.load(fundingRoundId) - if (fundingRound == null) { - log.error('Error: handleSignUp failed, fundingRound not registered', []) - return - } + publicKey.voiceCreditBalance = event.params._voiceCreditBalance - publicKey.fundingRound = fundingRoundId - publicKey.save() + let fundingRoundAddress = event.transaction.to! + let fundingRoundId = fundingRoundAddress.toHex() + let fundingRound = FundingRound.load(fundingRoundId) + if (fundingRound == null) { + log.error('Error: handleSignUp failed, fundingRound not registered', []) + return } + publicKey.fundingRound = fundingRoundId + publicKey.save() + log.info('SignUp', []) } diff --git a/vue-app/src/api/contributions.ts b/vue-app/src/api/contributions.ts index d8bd2caf2..51c954012 100644 --- a/vue-app/src/api/contributions.ts +++ b/vue-app/src/api/contributions.ts @@ -162,7 +162,11 @@ export async function getContributorIndex(fundingRoundAddress: string, pubKey: P publicKeyId: id, }) - return data.publicKey?.stateIndex ? Number(data.publicKey.stateIndex) : null + if (data.publicKeys.length === 0) { + return null + } + + return Number(data.publicKeys[0].stateIndex) } /** diff --git a/vue-app/src/components/Cart.vue b/vue-app/src/components/Cart.vue index af66e73a7..e2cf8e7a8 100644 --- a/vue-app/src/components/Cart.vue +++ b/vue-app/src/components/Cart.vue @@ -417,7 +417,7 @@ const contribution = computed(() => appStore.contribution || BigNumber.from(0)) const filteredCart = computed(() => { // Once reallocation phase ends, use committedCart for cart items if (hasReallocationPhaseEnded.value) { - return committedCart.value + return committedCart.value.filter(item => !item.isCleared) } // Hide cleared items return cart.value.filter(item => !item.isCleared) diff --git a/vue-app/src/graphql/API.ts b/vue-app/src/graphql/API.ts index 25c888cad..9c54745a8 100644 --- a/vue-app/src/graphql/API.ts +++ b/vue-app/src/graphql/API.ts @@ -3146,12 +3146,12 @@ export type GetContributionsAmountQueryVariables = Exact<{ export type GetContributionsAmountQuery = { __typename?: 'Query', contributions: Array<{ __typename?: 'Contribution', amount: any | null }> }; export type GetContributorIndexQueryVariables = Exact<{ - fundingRoundAddress: Scalars['ID']; + fundingRoundAddress: Scalars['String']; publicKeyId: Scalars['ID']; }>; -export type GetContributorIndexQuery = { __typename?: 'Query', publicKey: { __typename?: 'PublicKey', id: string, stateIndex: any | null } | null }; +export type GetContributorIndexQuery = { __typename?: 'Query', publicKeys: Array<{ __typename?: 'PublicKey', id: string, stateIndex: any | null }> }; export type GetContributorMessagesQueryVariables = Exact<{ fundingRoundAddress: Scalars['String']; @@ -3196,13 +3196,6 @@ export type GetProjectQueryVariables = Exact<{ export type GetProjectQuery = { __typename?: 'Query', recipients: Array<{ __typename?: 'Recipient', id: string, requestType: string | null, recipientAddress: any | null, recipientMetadata: string | null, recipientIndex: any | null, submissionTime: string | null, rejected: boolean | null, verified: boolean | null }> }; -export type GetPublicKeyQueryVariables = Exact<{ - pubKey: Scalars['ID']; -}>; - - -export type GetPublicKeyQuery = { __typename?: 'Query', publicKey: { __typename?: 'PublicKey', id: string } | null }; - export type GetRecipientQueryVariables = Exact<{ registryAddress: Scalars['ID']; recipientId: Scalars['ID']; @@ -3286,8 +3279,8 @@ export const GetContributionsAmountDocument = gql` } `; export const GetContributorIndexDocument = gql` - query GetContributorIndex($fundingRoundAddress: ID!, $publicKeyId: ID!) { - publicKey(id: $publicKeyId) { + query GetContributorIndex($fundingRoundAddress: String!, $publicKeyId: ID!) { + publicKeys(where: {id: $publicKeyId, fundingRound: $fundingRoundAddress}) { id stateIndex } @@ -3367,13 +3360,6 @@ export const GetProjectDocument = gql` } } `; -export const GetPublicKeyDocument = gql` - query GetPublicKey($pubKey: ID!) { - publicKey(id: $pubKey) { - id - } -} - `; export const GetRecipientDocument = gql` query GetRecipient($registryAddress: ID!, $recipientId: ID!) { recipientRegistry(id: $registryAddress) { @@ -3540,9 +3526,6 @@ export function getSdk(client: GraphQLClient, withWrapper: SdkFunctionWrapper = GetProject(variables: GetProjectQueryVariables, requestHeaders?: Dom.RequestInit["headers"]): Promise { return withWrapper((wrappedRequestHeaders) => client.request(GetProjectDocument, variables, {...requestHeaders, ...wrappedRequestHeaders}), 'GetProject', 'query'); }, - GetPublicKey(variables: GetPublicKeyQueryVariables, requestHeaders?: Dom.RequestInit["headers"]): Promise { - return withWrapper((wrappedRequestHeaders) => client.request(GetPublicKeyDocument, variables, {...requestHeaders, ...wrappedRequestHeaders}), 'GetPublicKey', 'query'); - }, GetRecipient(variables: GetRecipientQueryVariables, requestHeaders?: Dom.RequestInit["headers"]): Promise { return withWrapper((wrappedRequestHeaders) => client.request(GetRecipientDocument, variables, {...requestHeaders, ...wrappedRequestHeaders}), 'GetRecipient', 'query'); }, diff --git a/vue-app/src/graphql/queries/GetContributorIndex.graphql b/vue-app/src/graphql/queries/GetContributorIndex.graphql index 599085f8b..c3954dac6 100644 --- a/vue-app/src/graphql/queries/GetContributorIndex.graphql +++ b/vue-app/src/graphql/queries/GetContributorIndex.graphql @@ -1,8 +1,8 @@ query GetContributorIndex( - $fundingRoundAddress: ID! + $fundingRoundAddress: String! $publicKeyId: ID! ) { - publicKey(id: $publicKeyId) { + publicKeys(where: {id: $publicKeyId, fundingRound: $fundingRoundAddress}) { id stateIndex } diff --git a/vue-app/src/graphql/queries/GetPublicKey.graphql b/vue-app/src/graphql/queries/GetPublicKey.graphql deleted file mode 100644 index 14d9008bf..000000000 --- a/vue-app/src/graphql/queries/GetPublicKey.graphql +++ /dev/null @@ -1,5 +0,0 @@ -query GetPublicKey($pubKey: ID!) { - publicKey(id: $pubKey) { - id - } -}