diff --git a/apps/token/src/routes/staking/home/Nodes.graphql b/apps/token/src/routes/staking/home/Nodes.graphql
index 7c00c9bab..1fc91a2ca 100644
--- a/apps/token/src/routes/staking/home/Nodes.graphql
+++ b/apps/token/src/routes/staking/home/Nodes.graphql
@@ -1,19 +1,35 @@
+fragment NodesFragment on Node {
+ avatarUrl
+ id
+ name
+ pubkey
+ stakedTotal
+ stakedTotalFormatted @client
+ pendingStake
+ pendingStakeFormatted @client
+ rankingScore {
+ rankingScore
+ stakeScore
+ performanceScore
+ votingPower
+ status
+ }
+}
+
query Nodes {
- nodes {
- avatarUrl
+ epoch {
id
- name
- pubkey
- stakedTotal
- stakedTotalFormatted @client
- pendingStake
- pendingStakeFormatted @client
- rankingScore {
- rankingScore
- stakeScore
- performanceScore
- votingPower
- status
+ timestamps {
+ start
+ end
+ expiry
+ }
+ }
+ nodesConnection {
+ edges {
+ node {
+ ...NodesFragment
+ }
}
}
nodeData {
diff --git a/apps/token/src/routes/staking/home/__generated__/Nodes.ts b/apps/token/src/routes/staking/home/__generated__/Nodes.ts
deleted file mode 100644
index c4cf8c43f..000000000
--- a/apps/token/src/routes/staking/home/__generated__/Nodes.ts
+++ /dev/null
@@ -1,123 +0,0 @@
-/* tslint:disable */
-/* eslint-disable */
-// @generated
-// This file was automatically generated and should not be edited.
-
-import { ValidatorStatus } from "@vegaprotocol/types";
-
-// ====================================================
-// GraphQL query operation: Nodes
-// ====================================================
-
-export interface Nodes_epoch_timestamps {
- __typename: "EpochTimestamps";
- /**
- * RFC3339 timestamp - Vega time of epoch start, null if not started
- */
- start: string | null;
- /**
- * RFC3339 timestamp - Vega time of epoch end, null if not ended
- */
- end: string | null;
- /**
- * RFC3339 timestamp - Vega time of epoch expiry
- */
- expiry: string | null;
-}
-
-export interface Nodes_epoch {
- __typename: "Epoch";
- /**
- * Numeric sequence number used to identify the epoch
- */
- id: string;
- /**
- * Timestamps for start and end of epochs
- */
- timestamps: Nodes_epoch_timestamps;
-}
-
-export interface Nodes_nodes_rankingScore {
- __typename: "RankingScore";
- /**
- * The ranking score of the validator
- */
- rankingScore: string;
- /**
- * The stake based score of the validator (no anti-whaling)
- */
- stakeScore: string;
- /**
- * The performance score of the validator
- */
- performanceScore: string;
- /**
- * The Tendermint voting power of the validator (uint32)
- */
- votingPower: string;
- /**
- * The current validation status of the validator
- */
- status: ValidatorStatus;
-}
-
-export interface Nodes_nodes {
- __typename: "Node";
- avatarUrl: string | null;
- /**
- * The node URL eg n01.vega.xyz
- */
- id: string;
- name: string;
- /**
- * Public key of the node operator
- */
- pubkey: string;
- /**
- * Total amount staked on node
- */
- stakedTotal: string;
- /**
- * The total staked field formatted by the client
- */
- stakedTotalFormatted: string;
- /**
- * Amount of stake on the next epoch
- */
- pendingStake: string;
- /**
- * The pending staked field formatted by the client
- */
- pendingStakeFormatted: string;
- /**
- * Ranking scores and status for the validator for the current epoch
- */
- rankingScore: Nodes_nodes_rankingScore;
-}
-
-export interface Nodes_nodeData {
- __typename: "NodeData";
- /**
- * Total staked amount across all nodes
- */
- stakedTotal: string;
- /**
- * The total staked field formatted by the client
- */
- stakedTotalFormatted: string;
-}
-
-export interface Nodes {
- /**
- * Get data for a specific epoch, if ID omitted it gets the current epoch. If the string is 'next', fetch the next epoch
- */
- epoch: Nodes_epoch;
- /**
- * All known network nodes
- */
- nodes: Nodes_nodes[] | null;
- /**
- * Returns information about nodes
- */
- nodeData: Nodes_nodeData | null;
-}
diff --git a/apps/token/src/routes/staking/home/__generated___/Nodes.ts b/apps/token/src/routes/staking/home/__generated___/Nodes.ts
index 94f58eb5a..cf40abf42 100644
--- a/apps/token/src/routes/staking/home/__generated___/Nodes.ts
+++ b/apps/token/src/routes/staking/home/__generated___/Nodes.ts
@@ -3,29 +3,47 @@ import { Schema as Types } from '@vegaprotocol/types';
import { gql } from '@apollo/client';
import * as Apollo from '@apollo/client';
const defaultOptions = {} as const;
+export type NodesFragmentFragment = { __typename?: 'Node', avatarUrl?: string | null, id: string, name: string, pubkey: string, stakedTotal: string, stakedTotalFormatted: string, pendingStake: string, pendingStakeFormatted: string, rankingScore: { __typename?: 'RankingScore', rankingScore: string, stakeScore: string, performanceScore: string, votingPower: string, status: Types.ValidatorStatus } };
+
export type NodesQueryVariables = Types.Exact<{ [key: string]: never; }>;
-export type NodesQuery = { __typename?: 'Query', nodes?: Array<{ __typename?: 'Node', avatarUrl?: string | null, id: string, name: string, pubkey: string, stakedTotal: string, stakedTotalFormatted: string, pendingStake: string, pendingStakeFormatted: string, rankingScore: { __typename?: 'RankingScore', rankingScore: string, stakeScore: string, performanceScore: string, votingPower: string, status: Types.ValidatorStatus } }> | null, nodeData?: { __typename?: 'NodeData', stakedTotal: string, stakedTotalFormatted: string } | null };
-
+export type NodesQuery = { __typename?: 'Query', epoch: { __typename?: 'Epoch', id: string, timestamps: { __typename?: 'EpochTimestamps', start?: string | null, end?: string | null, expiry?: string | null } }, nodesConnection: { __typename?: 'NodesConnection', edges?: Array<{ __typename?: 'NodeEdge', node: { __typename?: 'Node', avatarUrl?: string | null, id: string, name: string, pubkey: string, stakedTotal: string, stakedTotalFormatted: string, pendingStake: string, pendingStakeFormatted: string, rankingScore: { __typename?: 'RankingScore', rankingScore: string, stakeScore: string, performanceScore: string, votingPower: string, status: Types.ValidatorStatus } } } | null> | null }, nodeData?: { __typename?: 'NodeData', stakedTotal: string, stakedTotalFormatted: string } | null };
+export const NodesFragmentFragmentDoc = gql`
+ fragment NodesFragment on Node {
+ avatarUrl
+ id
+ name
+ pubkey
+ stakedTotal
+ stakedTotalFormatted @client
+ pendingStake
+ pendingStakeFormatted @client
+ rankingScore {
+ rankingScore
+ stakeScore
+ performanceScore
+ votingPower
+ status
+ }
+}
+ `;
export const NodesDocument = gql`
query Nodes {
- nodes {
- avatarUrl
+ epoch {
id
- name
- pubkey
- stakedTotal
- stakedTotalFormatted @client
- pendingStake
- pendingStakeFormatted @client
- rankingScore {
- rankingScore
- stakeScore
- performanceScore
- votingPower
- status
+ timestamps {
+ start
+ end
+ expiry
+ }
+ }
+ nodesConnection {
+ edges {
+ node {
+ ...NodesFragment
+ }
}
}
nodeData {
@@ -33,7 +51,7 @@ export const NodesDocument = gql`
stakedTotalFormatted @client
}
}
- `;
+ ${NodesFragmentFragmentDoc}`;
/**
* __useNodesQuery__
diff --git a/apps/token/src/routes/staking/home/node-list.spec.tsx b/apps/token/src/routes/staking/home/node-list.spec.tsx
index 2235aa36c..b3bab1b74 100644
--- a/apps/token/src/routes/staking/home/node-list.spec.tsx
+++ b/apps/token/src/routes/staking/home/node-list.spec.tsx
@@ -1,33 +1,28 @@
import { act, fireEvent, render, screen } from '@testing-library/react';
import merge from 'lodash/merge';
-import { NodeList, NODES_QUERY } from './node-list';
+import { NodeList } from './node-list';
import { MockedProvider } from '@apollo/client/testing';
import { MemoryRouter } from 'react-router-dom';
import { addDecimal } from '@vegaprotocol/react-helpers';
-import type { Nodes_nodes } from './__generated__/Nodes';
import type { PartialDeep } from 'type-fest';
-import { ValidatorStatus } from '@vegaprotocol/types';
+import type { NodesFragmentFragment } from './__generated___/Nodes';
+import { NodesDocument } from './__generated___/Nodes';
+import { Schema } from '@vegaprotocol/types';
jest.mock('../../../components/epoch-countdown', () => ({
EpochCountdown: () =>
,
}));
-const nodeFactory = (overrides?: PartialDeep) => {
+const nodeFactory = (overrides?: PartialDeep) => {
const defaultNode = {
id: 'ccc022b7e63a4d0a6d3a193c3940c88574060e58a184964c994998d86835a1b4',
name: 'high',
avatarUrl: 'https://upload.wikimedia.org/wikipedia/en/2/25/Marvin-TV-3.jpg',
pubkey: '6abc23391a9f888ab240415bf63d6844b03fc360be822f4a1d2cd832d87b2917',
- infoUrl: 'https://en.wikipedia.org/wiki/Skynet_(Terminator)',
- location: '',
- stakedByOperator: '3000000000000000000000',
- stakedByDelegates: '11182454495731682635157',
stakedTotal: '14182454495731682635157',
stakedTotalFormatted: addDecimal('14182454495731682635157', 18),
pendingStake: '0',
pendingStakeFormatted: addDecimal('0', 18),
- epochData: null,
- status: 'Validator',
rankingScore: {
rankingScore: '0.67845061012234727427532760837568',
stakeScore: '0.3392701644525644',
@@ -38,46 +33,50 @@ const nodeFactory = (overrides?: PartialDeep) => {
},
__typename: 'Node',
};
- return merge(defaultNode, overrides);
+ return {
+ node: merge(defaultNode, overrides),
+ };
};
const MOCK_NODES = {
- nodes: [
- nodeFactory(),
- nodeFactory({
- id: '966438c6bffac737cfb08173ffcb3f393c4692b099ad80cb45a82e2dc0a8cf99',
- name: 'medium',
- pubkey:
- 'ccc3b8362c25b09d20df8ea407b0a476d6b24a0e72bc063d0033c8841652ddd4',
- stakedTotal: '9618711883996159534058',
- stakedTotalFormatted: addDecimal('9618711883996159534058', 18),
- rankingScore: {
- rankingScore: '0.4601942440481428',
- stakeScore: '0.2300971220240714',
- performanceScore: '1',
- votingPower: '2408',
- status: ValidatorStatus.VALIDATOR_NODE_STATUS_TENDERMINT,
- __typename: 'RankingScore',
- },
- }),
- nodeFactory({
- id: '12c81b738e8051152e1afe44376ec37bca9216466e6d44cdd772194bad0ada81',
- name: 'low',
- pubkey:
- '0931a8fd8cc935458f470e435a05414387cea6f329d648be894fcd44bd517a2b',
- stakedTotal: '4041343338923442976709',
- stakedTotalFormatted: addDecimal('4041343338923442976709', 18),
- pendingStake: '0',
- rankingScore: {
- rankingScore: '0.1932810100133910357676209647912',
- stakeScore: '0.0966762995515676',
- performanceScore: '0.999629748500531',
- votingPower: '1163',
- status: ValidatorStatus.VALIDATOR_NODE_STATUS_TENDERMINT,
- __typename: 'RankingScore',
- },
- }),
- ],
+ nodesConnection: {
+ edges: [
+ nodeFactory(),
+ nodeFactory({
+ id: '966438c6bffac737cfb08173ffcb3f393c4692b099ad80cb45a82e2dc0a8cf99',
+ name: 'medium',
+ pubkey:
+ 'ccc3b8362c25b09d20df8ea407b0a476d6b24a0e72bc063d0033c8841652ddd4',
+ stakedTotal: '9618711883996159534058',
+ stakedTotalFormatted: addDecimal('9618711883996159534058', 18),
+ rankingScore: {
+ rankingScore: '0.4601942440481428',
+ stakeScore: '0.2300971220240714',
+ performanceScore: '1',
+ votingPower: '2408',
+ status: Schema.ValidatorStatus.VALIDATOR_NODE_STATUS_TENDERMINT,
+ __typename: 'RankingScore',
+ },
+ }),
+ nodeFactory({
+ id: '12c81b738e8051152e1afe44376ec37bca9216466e6d44cdd772194bad0ada81',
+ name: 'low',
+ pubkey:
+ '0931a8fd8cc935458f470e435a05414387cea6f329d648be894fcd44bd517a2b',
+ stakedTotal: '4041343338923442976709',
+ stakedTotalFormatted: addDecimal('4041343338923442976709', 18),
+ pendingStake: '0',
+ rankingScore: {
+ rankingScore: '0.1932810100133910357676209647912',
+ stakeScore: '0.0966762995515676',
+ performanceScore: '0.999629748500531',
+ votingPower: '1163',
+ status: Schema.ValidatorStatus.VALIDATOR_NODE_STATUS_TENDERMINT,
+ __typename: 'RankingScore',
+ },
+ }),
+ ],
+ },
nodeData: {
stakedTotal: '27842509718651285145924',
stakedTotalFormatted: addDecimal('27842509718651285145924', 18),
@@ -105,7 +104,7 @@ const renderNodeList = (data = MOCK_NODES) => {
{
it('should display the correctly formatted fields in the correct columns', async () => {
const MOCK_NODE = {
- nodes: [
- nodeFactory({
- id: '966438c6bffac737cfb08173ffcb3f393c4692b099ad80cb45a82e2dc0a8cf99',
- name: 'T-800 Terminator',
- avatarUrl:
- 'https://upload.wikimedia.org/wikipedia/en/9/94/T-800_%28Model_101%29.png',
- pubkey:
- 'ccc3b8362c25b09d20df8ea407b0a476d6b24a0e72bc063d0033c8841652ddd4',
- stakedTotal: '9618711883996159534058',
- stakedTotalFormatted: addDecimal('9618711883996159534058', 18),
- rankingScore: {
- rankingScore: '0.4601942440481428',
- stakeScore: '0.2300971220240714',
- performanceScore: '1',
- votingPower: '2408',
- status: ValidatorStatus.VALIDATOR_NODE_STATUS_TENDERMINT,
- __typename: 'RankingScore',
- },
- }),
- ],
+ nodesConnection: {
+ edges: [
+ nodeFactory({
+ id: '966438c6bffac737cfb08173ffcb3f393c4692b099ad80cb45a82e2dc0a8cf99',
+ name: 'T-800 Terminator',
+ avatarUrl:
+ 'https://upload.wikimedia.org/wikipedia/en/9/94/T-800_%28Model_101%29.png',
+ pubkey:
+ 'ccc3b8362c25b09d20df8ea407b0a476d6b24a0e72bc063d0033c8841652ddd4',
+ stakedTotal: '9618711883996159534058',
+ stakedTotalFormatted: addDecimal('9618711883996159534058', 18),
+ rankingScore: {
+ rankingScore: '0.4601942440481428',
+ stakeScore: '0.2300971220240714',
+ performanceScore: '1',
+ votingPower: '2408',
+ status: Schema.ValidatorStatus.VALIDATOR_NODE_STATUS_TENDERMINT,
+ __typename: 'RankingScore',
+ },
+ }),
+ ],
+ },
nodeData: {
stakedTotal: '9618711883996159534058',
stakedTotalFormatted: addDecimal('9618711883996159534058', 18),
diff --git a/apps/token/src/routes/staking/home/node-list.tsx b/apps/token/src/routes/staking/home/node-list.tsx
index c55e08bfd..0e8d5fa16 100644
--- a/apps/token/src/routes/staking/home/node-list.tsx
+++ b/apps/token/src/routes/staking/home/node-list.tsx
@@ -1,4 +1,3 @@
-import { gql, useQuery } from '@apollo/client';
import { forwardRef, useEffect, useMemo, useRef, useState } from 'react';
import {
AgGridDynamic as AgGrid,
@@ -11,9 +10,10 @@ import { useTranslation } from 'react-i18next';
import { EpochCountdown } from '../../../components/epoch-countdown';
import { BigNumber } from '../../../lib/bignumber';
import { formatNumber } from '@vegaprotocol/react-helpers';
-import { ValidatorStatus } from '@vegaprotocol/types';
-import type { Nodes } from './__generated__/Nodes';
+import { Schema } from '@vegaprotocol/types';
import type { ColDef } from 'ag-grid-community';
+import compact from 'lodash/compact';
+import { useNodesQuery } from './__generated___/Nodes';
const VALIDATOR = 'validator';
const STATUS = 'status';
@@ -26,40 +26,6 @@ const STAKE_SCORE = 'stakeScore';
const PERFORMANCE_SCORE = 'performanceScore';
const VOTING_POWER = 'votingPower';
-export const NODES_QUERY = gql`
- query Nodes {
- epoch {
- id
- timestamps {
- start
- end
- expiry
- }
- }
- nodes {
- avatarUrl
- id
- name
- pubkey
- stakedTotal
- stakedTotalFormatted @client
- pendingStake
- pendingStakeFormatted @client
- rankingScore {
- rankingScore
- stakeScore
- performanceScore
- votingPower
- status
- }
- }
- nodeData {
- stakedTotal
- stakedTotalFormatted @client
- }
- }
-`;
-
interface ValidatorRendererProps {
data: { validator: { avatarUrl: string; name: string } };
}
@@ -67,7 +33,7 @@ interface ValidatorRendererProps {
interface CanonisedNodeProps {
id: string;
[VALIDATOR]: {
- avatarUrl: string | null;
+ avatarUrl: string | null | undefined;
name: string;
};
[STATUS]: string;
@@ -109,9 +75,7 @@ const nodeListGridStyles = `
export const NodeList = () => {
const { t } = useTranslation();
// errorPolicy due to vegaprotocol/vega issue 5898
- const { data, error, loading, refetch } = useQuery(NODES_QUERY, {
- errorPolicy: 'ignore',
- });
+ const { data, error, loading, refetch } = useNodesQuery();
const navigate = useNavigate();
const [hideTopThird, setHideTopThird] = useState(true);
@@ -133,22 +97,24 @@ export const NodeList = () => {
}, [data?.epoch.timestamps.expiry, refetch]);
const nodes = useMemo(() => {
- if (!data?.nodes) return [];
+ if (!data?.nodesConnection.edges) return [];
- const canonisedNodes = data.nodes.map(
+ const canonisedNodes = compact(data.nodesConnection.edges).map(
({
- id,
- name,
- avatarUrl,
- stakedTotalFormatted,
- rankingScore: {
- rankingScore,
- stakeScore,
- status,
- performanceScore,
- votingPower,
+ node: {
+ id,
+ name,
+ avatarUrl,
+ stakedTotalFormatted,
+ rankingScore: {
+ rankingScore,
+ stakeScore,
+ status,
+ performanceScore,
+ votingPower,
+ },
+ pendingStakeFormatted,
},
- pendingStakeFormatted,
}) => {
const stakedTotal = new BigNumber(
data?.nodeData?.stakedTotalFormatted || 0
@@ -161,11 +127,12 @@ export const NodeList = () => {
'%';
const statusTranslated = t(
`${
- (status === ValidatorStatus.VALIDATOR_NODE_STATUS_ERSATZ &&
+ (status === Schema.ValidatorStatus.VALIDATOR_NODE_STATUS_ERSATZ &&
'Ersatz') ||
- (status === ValidatorStatus.VALIDATOR_NODE_STATUS_PENDING &&
+ (status === Schema.ValidatorStatus.VALIDATOR_NODE_STATUS_PENDING &&
'Pending') ||
- (status === ValidatorStatus.VALIDATOR_NODE_STATUS_TENDERMINT &&
+ (status ===
+ Schema.ValidatorStatus.VALIDATOR_NODE_STATUS_TENDERMINT &&
'Consensus')
}`
);
diff --git a/apps/token/src/routes/staking/node/Staking.graphql b/apps/token/src/routes/staking/node/Staking.graphql
index 2ad247492..f64179085 100644
--- a/apps/token/src/routes/staking/node/Staking.graphql
+++ b/apps/token/src/routes/staking/node/Staking.graphql
@@ -21,33 +21,37 @@ query Staking($partyId: ID!) {
expiry
}
}
- nodes {
- id
- name
- pubkey
- infoUrl
- location
- ethereumAddress
- stakedByOperator
- stakedByDelegates
- stakedTotal
- pendingStake
- stakedByOperatorFormatted @client
- stakedByDelegatesFormatted @client
- stakedTotalFormatted @client
- pendingStakeFormatted @client
- epochData {
- total
- offline
- online
- }
- status
- rankingScore {
- rankingScore
- stakeScore
- performanceScore
- votingPower
- stakeScore
+ nodesConnection {
+ edges {
+ node {
+ id
+ name
+ pubkey
+ infoUrl
+ location
+ ethereumAddress
+ stakedByOperator
+ stakedByDelegates
+ stakedTotal
+ pendingStake
+ stakedByOperatorFormatted @client
+ stakedByDelegatesFormatted @client
+ stakedTotalFormatted @client
+ pendingStakeFormatted @client
+ epochData {
+ total
+ offline
+ online
+ }
+ status
+ rankingScore {
+ rankingScore
+ stakeScore
+ performanceScore
+ votingPower
+ stakeScore
+ }
+ }
}
}
nodeData {
diff --git a/apps/token/src/routes/staking/node/__generated__/Staking.ts b/apps/token/src/routes/staking/node/__generated__/Staking.ts
index 08c6d4f17..8cbcace6e 100644
--- a/apps/token/src/routes/staking/node/__generated__/Staking.ts
+++ b/apps/token/src/routes/staking/node/__generated__/Staking.ts
@@ -86,7 +86,7 @@ export interface Staking_epoch {
timestamps: Staking_epoch_timestamps;
}
-export interface Staking_nodes_epochData {
+export interface Staking_nodesConnection_edges_node_epochData {
__typename: "EpochData";
/**
* Total number of epochs since node was created
@@ -102,7 +102,7 @@ export interface Staking_nodes_epochData {
online: number;
}
-export interface Staking_nodes_rankingScore {
+export interface Staking_nodesConnection_edges_node_rankingScore {
__typename: "RankingScore";
/**
* The ranking score of the validator
@@ -122,7 +122,7 @@ export interface Staking_nodes_rankingScore {
votingPower: string;
}
-export interface Staking_nodes {
+export interface Staking_nodesConnection_edges_node {
__typename: "Node";
/**
* The node URL eg n01.vega.xyz
@@ -180,7 +180,7 @@ export interface Staking_nodes {
/**
* Summary of epoch data across all nodes
*/
- epochData: Staking_nodes_epochData | null;
+ epochData: Staking_nodesConnection_edges_node_epochData | null;
/**
* Validator status of the node
*/
@@ -188,7 +188,23 @@ export interface Staking_nodes {
/**
* Ranking scores and status for the validator for the current epoch
*/
- rankingScore: Staking_nodes_rankingScore;
+ rankingScore: Staking_nodesConnection_edges_node_rankingScore;
+}
+
+export interface Staking_nodesConnection_edges {
+ __typename: "NodeEdge";
+ /**
+ * The node
+ */
+ node: Staking_nodesConnection_edges_node;
+}
+
+export interface Staking_nodesConnection {
+ __typename: "NodesConnection";
+ /**
+ * List of nodes available for the connection
+ */
+ edges: (Staking_nodesConnection_edges | null)[] | null;
}
export interface Staking_nodeData {
@@ -231,7 +247,7 @@ export interface Staking {
/**
* All known network nodes
*/
- nodes: Staking_nodes[] | null;
+ nodesConnection: Staking_nodesConnection;
/**
* Returns information about nodes
*/
diff --git a/apps/token/src/routes/staking/node/__generated___/Staking.ts b/apps/token/src/routes/staking/node/__generated___/Staking.ts
index 779576a60..e36010dea 100644
--- a/apps/token/src/routes/staking/node/__generated___/Staking.ts
+++ b/apps/token/src/routes/staking/node/__generated___/Staking.ts
@@ -8,7 +8,7 @@ export type StakingQueryVariables = Types.Exact<{
}>;
-export type StakingQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, stakingSummary: { __typename?: 'StakingSummary', currentStakeAvailable: string }, delegations?: Array<{ __typename?: 'Delegation', amount: string, amountFormatted: string, epoch: number, node: { __typename?: 'Node', id: string } }> | null } | null, epoch: { __typename?: 'Epoch', id: string, timestamps: { __typename?: 'EpochTimestamps', start?: string | null, end?: string | null, expiry?: string | null } }, nodes?: Array<{ __typename?: 'Node', id: string, name: string, pubkey: string, infoUrl: string, location: string, ethereumAddress: string, stakedByOperator: string, stakedByDelegates: string, stakedTotal: string, pendingStake: string, stakedByOperatorFormatted: string, stakedByDelegatesFormatted: string, stakedTotalFormatted: string, pendingStakeFormatted: string, status: Types.NodeStatus, epochData?: { __typename?: 'EpochData', total: number, offline: number, online: number } | null, rankingScore: { __typename?: 'RankingScore', rankingScore: string, stakeScore: string, performanceScore: string, votingPower: string } }> | null, nodeData?: { __typename?: 'NodeData', stakedTotal: string, stakedTotalFormatted: string, totalNodes: number, inactiveNodes: number, validatingNodes: number, uptime: number } | null };
+export type StakingQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, stakingSummary: { __typename?: 'StakingSummary', currentStakeAvailable: string }, delegations?: Array<{ __typename?: 'Delegation', amount: string, amountFormatted: string, epoch: number, node: { __typename?: 'Node', id: string } }> | null } | null, epoch: { __typename?: 'Epoch', id: string, timestamps: { __typename?: 'EpochTimestamps', start?: string | null, end?: string | null, expiry?: string | null } }, nodesConnection: { __typename?: 'NodesConnection', edges?: Array<{ __typename?: 'NodeEdge', node: { __typename?: 'Node', id: string, name: string, pubkey: string, infoUrl: string, location: string, ethereumAddress: string, stakedByOperator: string, stakedByDelegates: string, stakedTotal: string, pendingStake: string, stakedByOperatorFormatted: string, stakedByDelegatesFormatted: string, stakedTotalFormatted: string, pendingStakeFormatted: string, status: Types.NodeStatus, epochData?: { __typename?: 'EpochData', total: number, offline: number, online: number } | null, rankingScore: { __typename?: 'RankingScore', rankingScore: string, stakeScore: string, performanceScore: string, votingPower: string } } } | null> | null }, nodeData?: { __typename?: 'NodeData', stakedTotal: string, stakedTotalFormatted: string, totalNodes: number, inactiveNodes: number, validatingNodes: number, uptime: number } | null };
export const StakingDocument = gql`
@@ -35,33 +35,37 @@ export const StakingDocument = gql`
expiry
}
}
- nodes {
- id
- name
- pubkey
- infoUrl
- location
- ethereumAddress
- stakedByOperator
- stakedByDelegates
- stakedTotal
- pendingStake
- stakedByOperatorFormatted @client
- stakedByDelegatesFormatted @client
- stakedTotalFormatted @client
- pendingStakeFormatted @client
- epochData {
- total
- offline
- online
- }
- status
- rankingScore {
- rankingScore
- stakeScore
- performanceScore
- votingPower
- stakeScore
+ nodesConnection {
+ edges {
+ node {
+ id
+ name
+ pubkey
+ infoUrl
+ location
+ ethereumAddress
+ stakedByOperator
+ stakedByDelegates
+ stakedTotal
+ pendingStake
+ stakedByOperatorFormatted @client
+ stakedByDelegatesFormatted @client
+ stakedTotalFormatted @client
+ pendingStakeFormatted @client
+ epochData {
+ total
+ offline
+ online
+ }
+ status
+ rankingScore {
+ rankingScore
+ stakeScore
+ performanceScore
+ votingPower
+ stakeScore
+ }
+ }
}
}
nodeData {
diff --git a/apps/token/src/routes/staking/node/node.tsx b/apps/token/src/routes/staking/node/node.tsx
index 390a81f07..4d922f35e 100644
--- a/apps/token/src/routes/staking/node/node.tsx
+++ b/apps/token/src/routes/staking/node/node.tsx
@@ -13,6 +13,7 @@ import NodeContainer from './nodes-container';
import { useVegaWallet } from '@vegaprotocol/wallet';
import { useAppState } from '../../../contexts/app-state/app-state-context';
import { toBigNum } from '@vegaprotocol/react-helpers';
+import compact from 'lodash/compact';
interface StakingNodeProps {
data?: StakingQueryResult;
@@ -26,7 +27,9 @@ export const StakingNode = ({ data }: StakingNodeProps) => {
const { node } = useParams<{ node: string }>();
const { t } = useTranslation();
const nodeInfo = React.useMemo(() => {
- return data?.nodes?.find(({ id }) => id === node);
+ return compact(data?.nodesConnection?.edges).find(
+ ({ node: { id } }) => id === node
+ )?.node;
}, [node, data]);
const currentEpoch = React.useMemo(() => {
diff --git a/apps/token/src/routes/staking/node/nodes-container.tsx b/apps/token/src/routes/staking/node/nodes-container.tsx
index 4230cb603..4e0c29395 100644
--- a/apps/token/src/routes/staking/node/nodes-container.tsx
+++ b/apps/token/src/routes/staking/node/nodes-container.tsx
@@ -32,33 +32,37 @@ export const STAKING_QUERY = gql`
expiry
}
}
- nodes {
- id
- name
- pubkey
- infoUrl
- location
- ethereumAddress
- stakedByOperator
- stakedByDelegates
- stakedTotal
- pendingStake
- stakedByOperatorFormatted @client
- stakedByDelegatesFormatted @client
- stakedTotalFormatted @client
- pendingStakeFormatted @client
- epochData {
- total
- offline
- online
- }
- status
- rankingScore {
- rankingScore
- stakeScore
- performanceScore
- votingPower
- stakeScore
+ nodesConnection {
+ edges {
+ node {
+ id
+ name
+ pubkey
+ infoUrl
+ location
+ ethereumAddress
+ stakedByOperator
+ stakedByDelegates
+ stakedTotal
+ pendingStake
+ stakedByOperatorFormatted @client
+ stakedByDelegatesFormatted @client
+ stakedTotalFormatted @client
+ pendingStakeFormatted @client
+ epochData {
+ total
+ offline
+ online
+ }
+ status
+ rankingScore {
+ rankingScore
+ stakeScore
+ performanceScore
+ votingPower
+ stakeScore
+ }
+ }
}
}
nodeData {
diff --git a/apps/token/src/routes/staking/node/validator-table.tsx b/apps/token/src/routes/staking/node/validator-table.tsx
index c4af5ccba..bf81d4064 100644
--- a/apps/token/src/routes/staking/node/validator-table.tsx
+++ b/apps/token/src/routes/staking/node/validator-table.tsx
@@ -6,7 +6,7 @@ import { useEnvironment } from '@vegaprotocol/environment';
import { KeyValueTable, KeyValueTableRow } from '@vegaprotocol/ui-toolkit';
import { BigNumber } from '../../../lib/bignumber';
import { formatNumber } from '../../../lib/format-number';
-import type { Staking_nodes } from './__generated__/Staking';
+import type { Staking_nodesConnection_edges_node } from './__generated__/Staking';
const ValidatorTableCell = ({
children,
@@ -21,7 +21,7 @@ const ValidatorTableCell = ({
);
export interface ValidatorTableProps {
- node: Staking_nodes;
+ node: Staking_nodesConnection_edges_node;
stakedTotal: string;
stakeThisEpoch: BigNumber;
}
diff --git a/libs/types/src/__generated__/globalTypes.ts b/libs/types/src/__generated__/globalTypes.ts
index c8eb23eba..8884daf14 100644
--- a/libs/types/src/__generated__/globalTypes.ts
+++ b/libs/types/src/__generated__/globalTypes.ts
@@ -181,12 +181,6 @@ export enum StakeLinkingStatus {
STATUS_REJECTED = "STATUS_REJECTED",
}
-export enum ValidatorStatus {
- VALIDATOR_NODE_STATUS_ERSATZ = "VALIDATOR_NODE_STATUS_ERSATZ",
- VALIDATOR_NODE_STATUS_PENDING = "VALIDATOR_NODE_STATUS_PENDING",
- VALIDATOR_NODE_STATUS_TENDERMINT = "VALIDATOR_NODE_STATUS_TENDERMINT",
-}
-
export enum VoteValue {
VALUE_NO = "VALUE_NO",
VALUE_YES = "VALUE_YES",