diff --git a/apps/multisig-signer/src/app/components/add-signer-form/__generated__/AddSignerBundle.ts b/apps/multisig-signer/src/app/components/add-signer-form/__generated__/AddSignerBundle.ts new file mode 100644 index 000000000..cd1a623a3 --- /dev/null +++ b/apps/multisig-signer/src/app/components/add-signer-form/__generated__/AddSignerBundle.ts @@ -0,0 +1,45 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +// ==================================================== +// GraphQL query operation: AddSignerBundle +// ==================================================== + +export interface AddSignerBundle_erc20MultiSigSignerAddedBundles_edges_node { + __typename: "ERC20MultiSigSignerAddedBundle"; + /** + * The ethereum address of the signer to be added + */ + newSigner: string; + /** + * The nonce used in the signing operation + */ + nonce: string; + /** + * The bundle of signatures from current validators to sign in the new signer + */ + signatures: string; +} + +export interface AddSignerBundle_erc20MultiSigSignerAddedBundles_edges { + __typename: "ERC20MultiSigSignerAddedBundleEdge"; + node: AddSignerBundle_erc20MultiSigSignerAddedBundles_edges_node; +} + +export interface AddSignerBundle_erc20MultiSigSignerAddedBundles { + __typename: "ERC20MultiSigSignerAddedConnection"; + edges: (AddSignerBundle_erc20MultiSigSignerAddedBundles_edges | null)[] | null; +} + +export interface AddSignerBundle { + /** + * Get the signature bundle to add a particular validator to the signer list of the multisig contract + */ + erc20MultiSigSignerAddedBundles: AddSignerBundle_erc20MultiSigSignerAddedBundles; +} + +export interface AddSignerBundleVariables { + nodeId: string; +} diff --git a/apps/multisig-signer/src/app/components/remove-signer-form/__generated__/RemoveSignerBundle.ts b/apps/multisig-signer/src/app/components/remove-signer-form/__generated__/RemoveSignerBundle.ts new file mode 100644 index 000000000..833b8db58 --- /dev/null +++ b/apps/multisig-signer/src/app/components/remove-signer-form/__generated__/RemoveSignerBundle.ts @@ -0,0 +1,48 @@ +/* tslint:disable */ +/* eslint-disable */ +// @generated +// This file was automatically generated and should not be edited. + +// ==================================================== +// GraphQL query operation: RemoveSignerBundle +// ==================================================== + +export interface RemoveSignerBundle_erc20MultiSigSignerRemovedBundles_edges_node { + __typename: "ERC20MultiSigSignerRemovedBundle"; + /** + * The ethereum address of the signer to be removed + */ + oldSigner: string; + /** + * The nonce used in the signing operation + */ + nonce: string; + /** + * The bundle of signatures from current validators to sign in the new signer + */ + signatures: string; +} + +export interface RemoveSignerBundle_erc20MultiSigSignerRemovedBundles_edges { + __typename: "ERC20MultiSigSignerRemovedBundleEdge"; + node: RemoveSignerBundle_erc20MultiSigSignerRemovedBundles_edges_node; +} + +export interface RemoveSignerBundle_erc20MultiSigSignerRemovedBundles { + __typename: "ERC20MultiSigSignerRemovedConnection"; + /** + * The list of signer bundles for that validator + */ + edges: (RemoveSignerBundle_erc20MultiSigSignerRemovedBundles_edges | null)[] | null; +} + +export interface RemoveSignerBundle { + /** + * Get the signatures bundle to remove a particular validator from signer list of the multisig contract + */ + erc20MultiSigSignerRemovedBundles: RemoveSignerBundle_erc20MultiSigSignerRemovedBundles; +} + +export interface RemoveSignerBundleVariables { + nodeId: string; +} diff --git a/apps/token/src/routes/staking/connect-to-vega.tsx b/apps/token/src/components/connect-to-vega/connect-to-vega.tsx similarity index 100% rename from apps/token/src/routes/staking/connect-to-vega.tsx rename to apps/token/src/components/connect-to-vega/connect-to-vega.tsx diff --git a/apps/token/src/components/connect-to-vega/index.ts b/apps/token/src/components/connect-to-vega/index.ts new file mode 100644 index 000000000..a2dcf8421 --- /dev/null +++ b/apps/token/src/components/connect-to-vega/index.ts @@ -0,0 +1 @@ +export { ConnectToVega } from './connect-to-vega'; diff --git a/apps/token/src/components/connected-vega-key/connected-vega-key.tsx.tsx b/apps/token/src/components/connected-vega-key/connected-vega-key.tsx.tsx index 90506a9c8..93e4a92c3 100644 --- a/apps/token/src/components/connected-vega-key/connected-vega-key.tsx.tsx +++ b/apps/token/src/components/connected-vega-key/connected-vega-key.tsx.tsx @@ -1,6 +1,6 @@ import { useTranslation } from 'react-i18next'; -import { ConnectToVega } from '../../routes/staking/connect-to-vega'; +import { ConnectToVega } from '../connect-to-vega/connect-to-vega'; export const ConnectedVegaKey = ({ pubKey }: { pubKey: string | null }) => { const { t } = useTranslation(); diff --git a/apps/token/src/routes/governance/components/vote-details/vote-details.tsx b/apps/token/src/routes/governance/components/vote-details/vote-details.tsx index 9b8c6be19..b017ff990 100644 --- a/apps/token/src/routes/governance/components/vote-details/vote-details.tsx +++ b/apps/token/src/routes/governance/components/vote-details/vote-details.tsx @@ -1,7 +1,7 @@ import { formatDistanceToNow } from 'date-fns'; import { useTranslation } from 'react-i18next'; import { formatNumber } from '../../../../lib/format-number'; -import { ConnectToVega } from '../../../staking/connect-to-vega'; +import { ConnectToVega } from '../../../../components/connect-to-vega/connect-to-vega'; import { useVoteInformation } from '../../hooks'; import { CurrentProposalStatus } from '../current-proposal-status'; import { useUserVote } from './use-user-vote'; diff --git a/apps/token/src/routes/router-config.tsx b/apps/token/src/routes/router-config.tsx index 253b69d58..5c97bd5f7 100644 --- a/apps/token/src/routes/router-config.tsx +++ b/apps/token/src/routes/router-config.tsx @@ -77,21 +77,14 @@ const LazyStakingDisassociate = React.lazy( const LazyStakingIndex = React.lazy( () => import( - /* webpackChunkName: "route-staking-index", webpackPrefetch: true */ './staking/staking' + /* webpackChunkName: "route-staking-index", webpackPrefetch: true */ './staking/home' ) ); const LazyStakingNode = React.lazy( () => import( - /* webpackChunkName: "route-staking-node", webpackPrefetch: true */ './staking/staking-node' - ) -); - -const LazyStakingNodes = React.lazy( - () => - import( - /* webpackChunkName: "route-staking-nodes", webpackPrefetch: true */ './staking/staking-nodes-container' + /* webpackChunkName: "route-staking-node", webpackPrefetch: true */ './staking/node' ) ); @@ -227,11 +220,7 @@ const routerConfig = [ { path: ':node', element: }, { index: true, - element: ( - - {({ data }) => } - - ), + element: , }, ], }, diff --git a/apps/token/src/routes/staking/associate/associate-page-container.tsx b/apps/token/src/routes/staking/associate/associate-page-container.tsx index d8b610504..6d39d0a2d 100644 --- a/apps/token/src/routes/staking/associate/associate-page-container.tsx +++ b/apps/token/src/routes/staking/associate/associate-page-container.tsx @@ -1,5 +1,5 @@ import { useEthereumConfig } from '@vegaprotocol/web3'; -import { StakingWalletsContainer } from '../components/staking-wallets-container/staking-wallets-container'; +import { StakingWalletsContainer } from './components/staking-wallets-container/staking-wallets-container'; import { AssociatePage } from './associate-page'; import { AssociatePageNoVega } from './associate-page-no-vega'; diff --git a/apps/token/src/routes/staking/associate/associate-page-no-vega.tsx b/apps/token/src/routes/staking/associate/associate-page-no-vega.tsx index bd3a6a7d8..cef1337a2 100644 --- a/apps/token/src/routes/staking/associate/associate-page-no-vega.tsx +++ b/apps/token/src/routes/staking/associate/associate-page-no-vega.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; -import { ConnectToVega } from '../connect-to-vega'; +import { ConnectToVega } from '../../../components/connect-to-vega/connect-to-vega'; export const AssociatePageNoVega = () => { const { t } = useTranslation(); diff --git a/apps/token/src/routes/staking/components/staking-wallets-container/index.ts b/apps/token/src/routes/staking/associate/components/staking-wallets-container/index.ts similarity index 100% rename from apps/token/src/routes/staking/components/staking-wallets-container/index.ts rename to apps/token/src/routes/staking/associate/components/staking-wallets-container/index.ts diff --git a/apps/token/src/routes/staking/components/staking-wallets-container/staking-wallets-container.spec.tsx b/apps/token/src/routes/staking/associate/components/staking-wallets-container/staking-wallets-container.spec.tsx similarity index 97% rename from apps/token/src/routes/staking/components/staking-wallets-container/staking-wallets-container.spec.tsx rename to apps/token/src/routes/staking/associate/components/staking-wallets-container/staking-wallets-container.spec.tsx index 1d8545164..d404a91a9 100644 --- a/apps/token/src/routes/staking/components/staking-wallets-container/staking-wallets-container.spec.tsx +++ b/apps/token/src/routes/staking/associate/components/staking-wallets-container/staking-wallets-container.spec.tsx @@ -2,7 +2,7 @@ import { render, screen } from '@testing-library/react'; import type { useWeb3React } from '@web3-react/core'; import { StakingWalletsContainer } from './staking-wallets-container'; -jest.mock('../../connect-to-vega', () => ({ +jest.mock('../../../../../components/connect-to-vega', () => ({ ConnectToVega: () =>
, })); diff --git a/apps/token/src/routes/staking/components/staking-wallets-container/staking-wallets-container.tsx b/apps/token/src/routes/staking/associate/components/staking-wallets-container/staking-wallets-container.tsx similarity index 81% rename from apps/token/src/routes/staking/components/staking-wallets-container/staking-wallets-container.tsx rename to apps/token/src/routes/staking/associate/components/staking-wallets-container/staking-wallets-container.tsx index 66b5fc197..82da4e465 100644 --- a/apps/token/src/routes/staking/components/staking-wallets-container/staking-wallets-container.tsx +++ b/apps/token/src/routes/staking/associate/components/staking-wallets-container/staking-wallets-container.tsx @@ -1,9 +1,9 @@ import { useWeb3React } from '@web3-react/core'; import { useTranslation } from 'react-i18next'; -import { EthConnectPrompt } from '../../../../components/eth-connect-prompt'; +import { EthConnectPrompt } from '../../../../../components/eth-connect-prompt'; import { useVegaWallet } from '@vegaprotocol/wallet'; -import { ConnectToVega } from '../../connect-to-vega'; +import { ConnectToVega } from '../../../../../components/connect-to-vega'; export const StakingWalletsContainer = ({ children, diff --git a/apps/token/src/routes/staking/Nodes.graphql b/apps/token/src/routes/staking/home/Nodes.graphql similarity index 100% rename from apps/token/src/routes/staking/Nodes.graphql rename to apps/token/src/routes/staking/home/Nodes.graphql diff --git a/apps/token/src/routes/staking/__generated__/Nodes.ts b/apps/token/src/routes/staking/home/__generated__/Nodes.ts similarity index 71% rename from apps/token/src/routes/staking/__generated__/Nodes.ts rename to apps/token/src/routes/staking/home/__generated__/Nodes.ts index 2456019d7..c4cf8c43f 100644 --- a/apps/token/src/routes/staking/__generated__/Nodes.ts +++ b/apps/token/src/routes/staking/home/__generated__/Nodes.ts @@ -9,6 +9,34 @@ 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"; /** @@ -80,6 +108,10 @@ export interface Nodes_nodeData { } 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 */ diff --git a/apps/token/src/routes/staking/__generated___/Nodes.ts b/apps/token/src/routes/staking/home/__generated___/Nodes.ts similarity index 100% rename from apps/token/src/routes/staking/__generated___/Nodes.ts rename to apps/token/src/routes/staking/home/__generated___/Nodes.ts diff --git a/apps/token/src/routes/staking/home/index.ts b/apps/token/src/routes/staking/home/index.ts new file mode 100644 index 000000000..a063b2bf8 --- /dev/null +++ b/apps/token/src/routes/staking/home/index.ts @@ -0,0 +1 @@ +export { Staking as default } from './staking'; diff --git a/apps/token/src/routes/staking/node-list.spec.tsx b/apps/token/src/routes/staking/home/node-list.spec.tsx similarity index 92% rename from apps/token/src/routes/staking/node-list.spec.tsx rename to apps/token/src/routes/staking/home/node-list.spec.tsx index 5366b1bdb..2235aa36c 100644 --- a/apps/token/src/routes/staking/node-list.spec.tsx +++ b/apps/token/src/routes/staking/home/node-list.spec.tsx @@ -8,7 +8,7 @@ import type { Nodes_nodes } from './__generated__/Nodes'; import type { PartialDeep } from 'type-fest'; import { ValidatorStatus } from '@vegaprotocol/types'; -jest.mock('../../components/epoch-countdown', () => ({ +jest.mock('../../../components/epoch-countdown', () => ({ EpochCountdown: () =>
, })); @@ -87,6 +87,16 @@ const MOCK_NODES = { uptime: 1560.266845703125, __typename: 'NodeData', }, + epoch: { + __typename: 'Epoch', + id: '1', + timestamps: { + __typename: 'EpochTimestamps', + start: new Date(0).toISOString(), + end: '', + expiry: new Date(1000 * 60 * 60 * 24).toISOString(), + }, + }, }; const renderNodeList = (data = MOCK_NODES) => { @@ -100,18 +110,7 @@ const renderNodeList = (data = MOCK_NODES) => { }, ]} > - + ); @@ -186,6 +185,16 @@ describe('Nodes list', () => { uptime: 1560.266845703125, __typename: 'NodeData', }, + epoch: { + __typename: 'Epoch', + id: '1', + timestamps: { + __typename: 'EpochTimestamps', + start: new Date(0).toISOString(), + end: '', + expiry: new Date(1000 * 60 * 60 * 24).toISOString(), + }, + }, }; renderNodeList(MOCK_NODE); diff --git a/apps/token/src/routes/staking/node-list.tsx b/apps/token/src/routes/staking/home/node-list.tsx similarity index 92% rename from apps/token/src/routes/staking/node-list.tsx rename to apps/token/src/routes/staking/home/node-list.tsx index 2f99aed2c..c55e08bfd 100644 --- a/apps/token/src/routes/staking/node-list.tsx +++ b/apps/token/src/routes/staking/home/node-list.tsx @@ -8,12 +8,11 @@ import { import type { AgGridReact } from 'ag-grid-react'; import { useNavigate } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; -import { EpochCountdown } from '../../components/epoch-countdown'; -import { BigNumber } from '../../lib/bignumber'; +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 type { Staking_epoch } from './__generated__/Staking'; import type { ColDef } from 'ag-grid-community'; const VALIDATOR = 'validator'; @@ -29,6 +28,14 @@ const VOTING_POWER = 'votingPower'; export const NODES_QUERY = gql` query Nodes { + epoch { + id + timestamps { + start + end + expiry + } + } nodes { avatarUrl id @@ -53,10 +60,6 @@ export const NODES_QUERY = gql` } `; -interface NodeListProps { - epoch: Staking_epoch | undefined; -} - interface ValidatorRendererProps { data: { validator: { avatarUrl: string; name: string } }; } @@ -103,7 +106,7 @@ const nodeListGridStyles = ` } `; -export const NodeList = ({ epoch }: NodeListProps) => { +export const NodeList = () => { const { t } = useTranslation(); // errorPolicy due to vegaprotocol/vega issue 5898 const { data, error, loading, refetch } = useQuery(NODES_QUERY, { @@ -114,9 +117,9 @@ export const NodeList = ({ epoch }: NodeListProps) => { useEffect(() => { const epochInterval = setInterval(() => { - if (!epoch?.timestamps.expiry) return; + if (!data?.epoch.timestamps.expiry) return; const now = Date.now(); - const expiry = new Date(epoch.timestamps.expiry).getTime(); + const expiry = new Date(data.epoch.timestamps.expiry).getTime(); if (now > expiry) { refetch(); @@ -127,7 +130,7 @@ export const NodeList = ({ epoch }: NodeListProps) => { return () => { clearInterval(epochInterval); }; - }, [epoch?.timestamps.expiry, refetch]); + }, [data?.epoch.timestamps.expiry, refetch]); const nodes = useMemo(() => { if (!data?.nodes) return []; @@ -344,15 +347,17 @@ export const NodeList = ({ epoch }: NodeListProps) => { return ( - {epoch && epoch.timestamps.start && epoch.timestamps.expiry && ( -
- -
- )} + {data?.epoch && + data.epoch.timestamps.start && + data?.epoch.timestamps.expiry && ( +
+ +
+ )}
); diff --git a/apps/token/src/routes/staking/staking.tsx b/apps/token/src/routes/staking/home/staking.tsx similarity index 81% rename from apps/token/src/routes/staking/staking.tsx rename to apps/token/src/routes/staking/home/staking.tsx index 3c9ce4e09..64275a83d 100644 --- a/apps/token/src/routes/staking/staking.tsx +++ b/apps/token/src/routes/staking/home/staking.tsx @@ -6,11 +6,10 @@ import { } from '@vegaprotocol/ui-toolkit'; import { useTranslation } from 'react-i18next'; import { Link } from 'react-router-dom'; -import { Links } from '../../config'; +import { Links } from '../../../config'; import { NodeList } from './node-list'; -import type { Staking as StakingQueryResult } from './__generated__/Staking'; -export const Staking = ({ data }: { data?: StakingQueryResult }) => { +export const Staking = () => { const { t } = useTranslation(); return ( @@ -44,10 +43,8 @@ export const Staking = ({ data }: { data?: StakingQueryResult }) => {

{t('Validator nodes')}

- +
); }; - -export default Staking; diff --git a/apps/token/src/routes/staking/PartyDelegations.graphql b/apps/token/src/routes/staking/node/PartyDelegations.graphql similarity index 100% rename from apps/token/src/routes/staking/PartyDelegations.graphql rename to apps/token/src/routes/staking/node/PartyDelegations.graphql diff --git a/apps/token/src/routes/staking/Staking.graphql b/apps/token/src/routes/staking/node/Staking.graphql similarity index 100% rename from apps/token/src/routes/staking/Staking.graphql rename to apps/token/src/routes/staking/node/Staking.graphql diff --git a/apps/token/src/routes/staking/__generated__/PartyDelegations.ts b/apps/token/src/routes/staking/node/__generated__/PartyDelegations.ts similarity index 100% rename from apps/token/src/routes/staking/__generated__/PartyDelegations.ts rename to apps/token/src/routes/staking/node/__generated__/PartyDelegations.ts diff --git a/apps/token/src/routes/staking/__generated__/Staking.ts b/apps/token/src/routes/staking/node/__generated__/Staking.ts similarity index 100% rename from apps/token/src/routes/staking/__generated__/Staking.ts rename to apps/token/src/routes/staking/node/__generated__/Staking.ts diff --git a/apps/token/src/routes/staking/__generated___/PartyDelegations.ts b/apps/token/src/routes/staking/node/__generated___/PartyDelegations.ts similarity index 100% rename from apps/token/src/routes/staking/__generated___/PartyDelegations.ts rename to apps/token/src/routes/staking/node/__generated___/PartyDelegations.ts diff --git a/apps/token/src/routes/staking/__generated___/Staking.ts b/apps/token/src/routes/staking/node/__generated___/Staking.ts similarity index 100% rename from apps/token/src/routes/staking/__generated___/Staking.ts rename to apps/token/src/routes/staking/node/__generated___/Staking.ts diff --git a/apps/token/src/routes/staking/node/index.ts b/apps/token/src/routes/staking/node/index.ts new file mode 100644 index 000000000..637e5b11c --- /dev/null +++ b/apps/token/src/routes/staking/node/index.ts @@ -0,0 +1 @@ +export { Node as default } from './node'; diff --git a/apps/token/src/routes/staking/staking-node.tsx b/apps/token/src/routes/staking/node/node.tsx similarity index 90% rename from apps/token/src/routes/staking/staking-node.tsx rename to apps/token/src/routes/staking/node/node.tsx index 9e0bae849..a774dee06 100644 --- a/apps/token/src/routes/staking/staking-node.tsx +++ b/apps/token/src/routes/staking/node/node.tsx @@ -2,24 +2,16 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; import { useParams } from 'react-router-dom'; -import { EpochCountdown } from '../../components/epoch-countdown'; -import { BigNumber } from '../../lib/bignumber'; +import { EpochCountdown } from '../../../components/epoch-countdown'; +import { BigNumber } from '../../../lib/bignumber'; import type { Staking as StakingQueryResult } from './__generated__/Staking'; -import { ConnectToVega } from './connect-to-vega'; +import { ConnectToVega } from '../../../components/connect-to-vega/connect-to-vega'; import { StakingForm } from './staking-form'; import { ValidatorTable } from './validator-table'; import { YourStake } from './your-stake'; -import StakingNodesContainer from './staking-nodes-container'; +import NodeContainer from './nodes-container'; import { useVegaWallet } from '@vegaprotocol/wallet'; -export const StakingNodeContainer = () => { - return ( - - {({ data }) => } - - ); -}; - interface StakingNodeProps { data?: StakingQueryResult; } @@ -28,7 +20,6 @@ export const StakingNode = ({ data }: StakingNodeProps) => { const { pubKey: vegaKey } = useVegaWallet(); const { node } = useParams<{ node: string }>(); const { t } = useTranslation(); - const nodeInfo = React.useMemo(() => { return data?.nodes?.find(({ id }) => id === node); }, [node, data]); @@ -137,4 +128,8 @@ export const StakingNode = ({ data }: StakingNodeProps) => { ); }; -export default StakingNodeContainer; +export const Node = () => { + return ( + {({ data }) => } + ); +}; diff --git a/apps/token/src/routes/staking/staking-nodes-container.tsx b/apps/token/src/routes/staking/node/nodes-container.tsx similarity index 92% rename from apps/token/src/routes/staking/staking-nodes-container.tsx rename to apps/token/src/routes/staking/node/nodes-container.tsx index 6f40c2efa..050ddc893 100644 --- a/apps/token/src/routes/staking/staking-nodes-container.tsx +++ b/apps/token/src/routes/staking/node/nodes-container.tsx @@ -4,9 +4,10 @@ import { useVegaWallet } from '@vegaprotocol/wallet'; import React from 'react'; import { useTranslation } from 'react-i18next'; -import { SplashLoader } from '../../components/splash-loader'; +import { SplashLoader } from '../../../components/splash-loader'; import type { Staking as StakingQueryResult } from './__generated__/Staking'; +// TODO should only request a single node. When migrating from deprecated APIs we should address this. export const STAKING_QUERY = gql` query Staking($partyId: ID!) { party(id: $partyId) { @@ -74,7 +75,7 @@ export const STAKING_QUERY = gql` const RPC_ERROR = 'rpc error: code = NotFound desc = NotFound error'; -export const StakingNodesContainer = ({ +export const NodeContainer = ({ children, }: { children: ({ data }: { data?: StakingQueryResult }) => React.ReactElement; @@ -128,4 +129,4 @@ export const StakingNodesContainer = ({ return children({ data }); }; -export default StakingNodesContainer; +export default NodeContainer; diff --git a/apps/token/src/routes/staking/pending-stake.tsx b/apps/token/src/routes/staking/node/pending-stake.tsx similarity index 91% rename from apps/token/src/routes/staking/pending-stake.tsx rename to apps/token/src/routes/staking/node/pending-stake.tsx index a7003a019..79ec0d542 100644 --- a/apps/token/src/routes/staking/pending-stake.tsx +++ b/apps/token/src/routes/staking/node/pending-stake.tsx @@ -2,9 +2,9 @@ import React from 'react'; import * as Sentry from '@sentry/react'; import { Button, Callout, Intent, Loader } from '@vegaprotocol/ui-toolkit'; import { useTranslation } from 'react-i18next'; -import { useAppState } from '../../contexts/app-state/app-state-context'; -import { BigNumber } from '../../lib/bignumber'; -import { removeDecimal } from '../../lib/decimals'; +import { useAppState } from '../../../contexts/app-state/app-state-context'; +import { BigNumber } from '../../../lib/bignumber'; +import { removeDecimal } from '../../../lib/decimals'; import type { UndelegateSubmissionBody } from '@vegaprotocol/wallet'; import { useVegaWallet } from '@vegaprotocol/wallet'; diff --git a/apps/token/src/routes/staking/stake-failure.tsx b/apps/token/src/routes/staking/node/stake-failure.tsx similarity index 100% rename from apps/token/src/routes/staking/stake-failure.tsx rename to apps/token/src/routes/staking/node/stake-failure.tsx diff --git a/apps/token/src/routes/staking/stake-pending.tsx b/apps/token/src/routes/staking/node/stake-pending.tsx similarity index 100% rename from apps/token/src/routes/staking/stake-pending.tsx rename to apps/token/src/routes/staking/node/stake-pending.tsx diff --git a/apps/token/src/routes/staking/stake-success.tsx b/apps/token/src/routes/staking/node/stake-success.tsx similarity index 97% rename from apps/token/src/routes/staking/stake-success.tsx rename to apps/token/src/routes/staking/node/stake-success.tsx index 1d858e151..3f1b4eb49 100644 --- a/apps/token/src/routes/staking/stake-success.tsx +++ b/apps/token/src/routes/staking/node/stake-success.tsx @@ -1,7 +1,7 @@ import { Callout, Intent } from '@vegaprotocol/ui-toolkit'; import { useTranslation } from 'react-i18next'; import { Link } from 'react-router-dom'; -import Routes from '../routes'; +import Routes from '../../routes'; import type { StakeAction } from './staking-form'; import { Actions, RemoveType } from './staking-form'; diff --git a/apps/token/src/routes/staking/staking-form.tsx b/apps/token/src/routes/staking/node/staking-form.tsx similarity index 96% rename from apps/token/src/routes/staking/staking-form.tsx rename to apps/token/src/routes/staking/node/staking-form.tsx index 66e3ad965..48d355cdd 100644 --- a/apps/token/src/routes/staking/staking-form.tsx +++ b/apps/token/src/routes/staking/node/staking-form.tsx @@ -4,11 +4,11 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; import { useNavigate } from 'react-router-dom'; -import { TokenInput } from '../../components/token-input'; -import { useAppState } from '../../contexts/app-state/app-state-context'; -import { useSearchParams } from '../../hooks/use-search-params'; -import { BigNumber } from '../../lib/bignumber'; -import { addDecimal, removeDecimal } from '../../lib/decimals'; +import { TokenInput } from '../../../components/token-input'; +import { useAppState } from '../../../contexts/app-state/app-state-context'; +import { useSearchParams } from '../../../hooks/use-search-params'; +import { BigNumber } from '../../../lib/bignumber'; +import { addDecimal, removeDecimal } from '../../../lib/decimals'; import type { PartyDelegations, PartyDelegationsVariables, diff --git a/apps/token/src/routes/staking/validator-table.tsx b/apps/token/src/routes/staking/node/validator-table.tsx similarity index 97% rename from apps/token/src/routes/staking/validator-table.tsx rename to apps/token/src/routes/staking/node/validator-table.tsx index 780a884d8..cea78af72 100644 --- a/apps/token/src/routes/staking/validator-table.tsx +++ b/apps/token/src/routes/staking/node/validator-table.tsx @@ -4,8 +4,8 @@ import { useTranslation } from 'react-i18next'; import { Link } from '@vegaprotocol/ui-toolkit'; import { useEnvironment } from '@vegaprotocol/environment'; import { KeyValueTable, KeyValueTableRow } from '@vegaprotocol/ui-toolkit'; -import { BigNumber } from '../../lib/bignumber'; -import { formatNumber } from '../../lib/format-number'; +import { BigNumber } from '../../../lib/bignumber'; +import { formatNumber } from '../../../lib/format-number'; import type { Staking_nodes } from './__generated__/Staking'; const ValidatorTableCell = ({ diff --git a/apps/token/src/routes/staking/your-stake.tsx b/apps/token/src/routes/staking/node/your-stake.tsx similarity index 89% rename from apps/token/src/routes/staking/your-stake.tsx rename to apps/token/src/routes/staking/node/your-stake.tsx index 1bef504c0..67efba967 100644 --- a/apps/token/src/routes/staking/your-stake.tsx +++ b/apps/token/src/routes/staking/node/your-stake.tsx @@ -1,8 +1,8 @@ import React from 'react'; import { useTranslation } from 'react-i18next'; import { KeyValueTable, KeyValueTableRow } from '@vegaprotocol/ui-toolkit'; -import { formatNumber } from '../../lib/format-number'; -import type { BigNumber } from '../../lib/bignumber'; +import { formatNumber } from '../../../lib/format-number'; +import type { BigNumber } from '../../../lib/bignumber'; export interface YourStakeProps { stakeThisEpoch: BigNumber; diff --git a/libs/environment/src/utils/__generated___/Node.ts b/libs/environment/src/utils/__generated___/Node.ts deleted file mode 100644 index 1961baca9..000000000 --- a/libs/environment/src/utils/__generated___/Node.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { Schema as Types } from '@vegaprotocol/types'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type StatisticsQueryVariables = Types.Exact<{ [key: string]: never; }>; - - -export type StatisticsQuery = { __typename?: 'Query', statistics: { __typename?: 'Statistics', chainId: string, blockHeight: string } }; - -export type BlockTimeSubscriptionVariables = Types.Exact<{ [key: string]: never; }>; - - -export type BlockTimeSubscription = { __typename?: 'Subscription', busEvents?: Array<{ __typename?: 'BusEvent', id: string }> | null }; - - -export const StatisticsDocument = gql` - query Statistics { - statistics { - chainId - blockHeight - } -} - `; - -/** - * __useStatisticsQuery__ - * - * To run a query within a React component, call `useStatisticsQuery` and pass it any options that fit your needs. - * When your component renders, `useStatisticsQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useStatisticsQuery({ - * variables: { - * }, - * }); - */ -export function useStatisticsQuery(baseOptions?: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(StatisticsDocument, options); - } -export function useStatisticsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(StatisticsDocument, options); - } -export type StatisticsQueryHookResult = ReturnType; -export type StatisticsLazyQueryHookResult = ReturnType; -export type StatisticsQueryResult = Apollo.QueryResult; -export const BlockTimeDocument = gql` - subscription BlockTime { - busEvents(types: TimeUpdate, batchSize: 1) { - id - } -} - `; - -/** - * __useBlockTimeSubscription__ - * - * To run a query within a React component, call `useBlockTimeSubscription` and pass it any options that fit your needs. - * When your component renders, `useBlockTimeSubscription` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useBlockTimeSubscription({ - * variables: { - * }, - * }); - */ -export function useBlockTimeSubscription(baseOptions?: Apollo.SubscriptionHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useSubscription(BlockTimeDocument, options); - } -export type BlockTimeSubscriptionHookResult = ReturnType; -export type BlockTimeSubscriptionResult = Apollo.SubscriptionResult; \ No newline at end of file