From 64b6ed00ec52b6c338e706c5df751ad84b9c00e9 Mon Sep 17 00:00:00 2001 From: eshark9312 Date: Sun, 24 Dec 2023 12:23:19 -0500 Subject: [PATCH] Count the membership's root/controller account into the validator membership --- .../ui/src/validators/providers/provider.tsx | 30 +++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/packages/ui/src/validators/providers/provider.tsx b/packages/ui/src/validators/providers/provider.tsx index 3365f4f6fe..877bbcb7c7 100644 --- a/packages/ui/src/validators/providers/provider.tsx +++ b/packages/ui/src/validators/providers/provider.tsx @@ -54,14 +54,30 @@ export const ValidatorContextProvider = (props: Props) => { const variables = { where: { - boundAccounts_containsAny: - (allValidatorsWithCtrlAcc - ?.concat(allValidators?.map(({ address }) => address)) - .filter((element) => !!element) as string[]) ?? [], + OR: [ + { + rootAccount_in: + (allValidatorsWithCtrlAcc + ?.concat(allValidators?.map(({ address }) => address)) + .filter((element) => !!element) as string[]) ?? [], + }, + { + controllerAccount_in: + (allValidatorsWithCtrlAcc + ?.concat(allValidators?.map(({ address }) => address)) + .filter((element) => !!element) as string[]) ?? [], + }, + { + boundAccounts_containsAny: + (allValidatorsWithCtrlAcc + ?.concat(allValidators?.map(({ address }) => address)) + .filter((element) => !!element) as string[]) ?? [], + }, + ], }, } - const { data } = useGetMembersWithDetailsQuery({ variables, skip: !!allValidatorsWithCtrlAcc }) + const { data } = useGetMembersWithDetailsQuery({ variables, skip: !allValidatorsWithCtrlAcc }) const memberships = data?.memberships?.map((rawMembership) => ({ membership: asMemberWithDetails(rawMembership), @@ -81,6 +97,10 @@ export const ValidatorContextProvider = (props: Props) => { commission, ...memberships.find( ({ membership }) => + membership.rootAccount === address || + membership.rootAccount === controllerAccount || + membership.controllerAccount === address || + membership.controllerAccount === controllerAccount || membership.boundAccounts.includes(address) || (controllerAccount && membership.boundAccounts.includes(controllerAccount)) ),