feat(governance): show perp or future pills (#4863)
This commit is contained in:
parent
9d6b34963a
commit
1f507facba
@ -4,3 +4,4 @@ NX_VEGA_URL=https://api.n04.d.vega.xyz/graphql
|
|||||||
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
||||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||||
NX_ORACLE_PROOFS_URL=https://raw.githubusercontent.com/vegaprotocol/well-known/main/__generated__/oracle-proofs.json
|
NX_ORACLE_PROOFS_URL=https://raw.githubusercontent.com/vegaprotocol/well-known/main/__generated__/oracle-proofs.json
|
||||||
|
NX_PRODUCT_PERPETUALS=true
|
||||||
|
@ -4,3 +4,4 @@ NX_VEGA_URL=https://api.vega.community/graphql
|
|||||||
NX_ETHEREUM_PROVIDER_URL=https://mainnet.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
NX_ETHEREUM_PROVIDER_URL=https://mainnet.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
||||||
NX_ETHERSCAN_URL=https://etherscan.io
|
NX_ETHERSCAN_URL=https://etherscan.io
|
||||||
NX_ORACLE_PROOFS_URL=https://raw.githubusercontent.com/vegaprotocol/well-known/main/__generated__/oracle-proofs.json
|
NX_ORACLE_PROOFS_URL=https://raw.githubusercontent.com/vegaprotocol/well-known/main/__generated__/oracle-proofs.json
|
||||||
|
NX_PRODUCT_PERPETUALS=false
|
||||||
|
@ -4,3 +4,4 @@ NX_VEGA_URL=https://api.n07.testnet.vega.xyz/graphql
|
|||||||
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
||||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||||
NX_ORACLE_PROOFS_URL=https://raw.githubusercontent.com/vegaprotocol/well-known/main/__generated__/oracle-proofs.json
|
NX_ORACLE_PROOFS_URL=https://raw.githubusercontent.com/vegaprotocol/well-known/main/__generated__/oracle-proofs.json
|
||||||
|
NX_PRODUCT_PERPETUALS=true
|
||||||
|
@ -32,3 +32,4 @@ LC_ALL="en_US.UTF-8"
|
|||||||
# Cosmic elevator flags
|
# Cosmic elevator flags
|
||||||
NX_SUCCESSOR_MARKETS=true
|
NX_SUCCESSOR_MARKETS=true
|
||||||
NX_METAMASK_SNAPS=true
|
NX_METAMASK_SNAPS=true
|
||||||
|
NX_PRODUCT_PERPETUALS=false
|
||||||
|
@ -33,3 +33,4 @@ CYPRESS_FAIRGROUND=false
|
|||||||
# Cosmic elevator flags
|
# Cosmic elevator flags
|
||||||
NX_SUCCESSOR_MARKETS=false
|
NX_SUCCESSOR_MARKETS=false
|
||||||
NX_METAMASK_SNAPS=false
|
NX_METAMASK_SNAPS=false
|
||||||
|
NX_PRODUCT_PERPETUALS=true
|
||||||
|
@ -25,3 +25,4 @@ NX_ORACLE_PROOFS_URL=https://raw.githubusercontent.com/vegaprotocol/well-known/m
|
|||||||
# Cosmic elevator flags
|
# Cosmic elevator flags
|
||||||
NX_SUCCESSOR_MARKETS=true
|
NX_SUCCESSOR_MARKETS=true
|
||||||
NX_METAMASK_SNAPS=true
|
NX_METAMASK_SNAPS=true
|
||||||
|
NX_PRODUCT_PERPETUALS=true
|
||||||
|
@ -24,3 +24,4 @@ NX_TENDERMINT_WEBSOCKET_URL=wss://be.vega.community/websocket
|
|||||||
# Cosmic elevator flags
|
# Cosmic elevator flags
|
||||||
NX_SUCCESSOR_MARKETS=false
|
NX_SUCCESSOR_MARKETS=false
|
||||||
NX_METAMASK_SNAPS=false
|
NX_METAMASK_SNAPS=false
|
||||||
|
NX_PRODUCT_PERPETUALS=false
|
||||||
|
@ -20,3 +20,4 @@ NX_TENDERMINT_WEBSOCKET_URL=wss://tm.n01.stagnet1.vega.xyz/websocket
|
|||||||
# Cosmic elevator flags
|
# Cosmic elevator flags
|
||||||
NX_SUCCESSOR_MARKETS=true
|
NX_SUCCESSOR_MARKETS=true
|
||||||
NX_METAMASK_SNAPS=true
|
NX_METAMASK_SNAPS=true
|
||||||
|
NX_PRODUCT_PERPETUALS=true
|
||||||
|
@ -25,3 +25,4 @@ NX_TENDERMINT_WEBSOCKET_URL=wss://be.testnet.vega.xyz/websocket
|
|||||||
# Cosmic elevator flags
|
# Cosmic elevator flags
|
||||||
NX_SUCCESSOR_MARKETS=true
|
NX_SUCCESSOR_MARKETS=true
|
||||||
NX_METAMASK_SNAPS=true
|
NX_METAMASK_SNAPS=true
|
||||||
|
NX_PRODUCT_PERPETUALS=true
|
||||||
|
@ -22,3 +22,4 @@ NX_TENDERMINT_WEBSOCKET_URL=wss://be.validators-testnet.vega.
|
|||||||
# Cosmic elevator flags
|
# Cosmic elevator flags
|
||||||
NX_SUCCESSOR_MARKETS=false
|
NX_SUCCESSOR_MARKETS=false
|
||||||
NX_METAMASK_SNAPS=false
|
NX_METAMASK_SNAPS=false
|
||||||
|
NX_PRODUCT_PERPETUALS=false
|
||||||
|
@ -717,6 +717,9 @@
|
|||||||
"ProposalDocsPrefix": "For guidance on how to make proposals, see",
|
"ProposalDocsPrefix": "For guidance on how to make proposals, see",
|
||||||
"NetworkParameter": "Network parameter",
|
"NetworkParameter": "Network parameter",
|
||||||
"NewMarket": "New market",
|
"NewMarket": "New market",
|
||||||
|
"NewMarketPerpetualProduct": "New market - perpetual",
|
||||||
|
"NewMarketFutureProduct": "New market - future",
|
||||||
|
"NewMarketSpotProduct": "New market - spot",
|
||||||
"UpdateMarket": "Update market",
|
"UpdateMarket": "Update market",
|
||||||
"NewAsset": "New asset",
|
"NewAsset": "New asset",
|
||||||
"UpdateAsset": "Update asset",
|
"UpdateAsset": "Update asset",
|
||||||
|
@ -12,7 +12,7 @@ import { useRefreshAfterEpoch } from '../../hooks/use-refresh-after-epoch';
|
|||||||
import { ProposalsListItem } from '../proposals/components/proposals-list-item';
|
import { ProposalsListItem } from '../proposals/components/proposals-list-item';
|
||||||
import { ProtocolUpgradeProposalsListItem } from '../proposals/components/protocol-upgrade-proposals-list-item/protocol-upgrade-proposals-list-item';
|
import { ProtocolUpgradeProposalsListItem } from '../proposals/components/protocol-upgrade-proposals-list-item/protocol-upgrade-proposals-list-item';
|
||||||
import Routes from '../routes';
|
import Routes from '../routes';
|
||||||
import { ExternalLinks } from '@vegaprotocol/environment';
|
import { ExternalLinks, FLAGS } from '@vegaprotocol/environment';
|
||||||
import { removePaginationWrapper } from '@vegaprotocol/utils';
|
import { removePaginationWrapper } from '@vegaprotocol/utils';
|
||||||
import { useNodesQuery } from '../staking/home/__generated__/Nodes';
|
import { useNodesQuery } from '../staking/home/__generated__/Nodes';
|
||||||
import { useProposalsQuery } from '../proposals/proposals/__generated__/Proposals';
|
import { useProposalsQuery } from '../proposals/proposals/__generated__/Proposals';
|
||||||
@ -23,7 +23,6 @@ import {
|
|||||||
import { Heading, SubHeading } from '../../components/heading';
|
import { Heading, SubHeading } from '../../components/heading';
|
||||||
import * as Schema from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import type { RouteChildProps } from '..';
|
import type { RouteChildProps } from '..';
|
||||||
import type { ProposalFieldsFragment } from '../proposals/proposals/__generated__/Proposals';
|
|
||||||
import type { NodesFragmentFragment } from '../staking/home/__generated__/Nodes';
|
import type { NodesFragmentFragment } from '../staking/home/__generated__/Nodes';
|
||||||
import type { ProtocolUpgradeProposalFieldsFragment } from '@vegaprotocol/proposals';
|
import type { ProtocolUpgradeProposalFieldsFragment } from '@vegaprotocol/proposals';
|
||||||
import { useProtocolUpgradeProposalsQuery } from '@vegaprotocol/proposals';
|
import { useProtocolUpgradeProposalsQuery } from '@vegaprotocol/proposals';
|
||||||
@ -32,6 +31,7 @@ import {
|
|||||||
orderByUpgradeBlockHeight,
|
orderByUpgradeBlockHeight,
|
||||||
} from '../proposals/components/proposals-list/proposals-list';
|
} from '../proposals/components/proposals-list/proposals-list';
|
||||||
import { BigNumber } from '../../lib/bignumber';
|
import { BigNumber } from '../../lib/bignumber';
|
||||||
|
import type { ProposalQuery } from '../proposals/proposal/__generated__/Proposal';
|
||||||
|
|
||||||
const nodesToShow = 6;
|
const nodesToShow = 6;
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ const HomeProposals = ({
|
|||||||
proposals,
|
proposals,
|
||||||
protocolUpgradeProposals,
|
protocolUpgradeProposals,
|
||||||
}: {
|
}: {
|
||||||
proposals: ProposalFieldsFragment[];
|
proposals: ProposalQuery['proposal'][];
|
||||||
protocolUpgradeProposals: ProtocolUpgradeProposalFieldsFragment[];
|
protocolUpgradeProposals: ProtocolUpgradeProposalFieldsFragment[];
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@ -60,9 +60,12 @@ const HomeProposals = ({
|
|||||||
<ProtocolUpgradeProposalsListItem key={index} proposal={proposal} />
|
<ProtocolUpgradeProposalsListItem key={index} proposal={proposal} />
|
||||||
))}
|
))}
|
||||||
|
|
||||||
{proposals.map((proposal) => (
|
{proposals.map(
|
||||||
<ProposalsListItem key={proposal.id} proposal={proposal} />
|
(proposal) =>
|
||||||
))}
|
proposal?.id && (
|
||||||
|
<ProposalsListItem key={proposal.id} proposal={proposal} />
|
||||||
|
)
|
||||||
|
)}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<div className="mt-6">
|
<div className="mt-6">
|
||||||
@ -182,6 +185,9 @@ const GovernanceHome = ({ name }: RouteChildProps) => {
|
|||||||
pollInterval: 5000,
|
pollInterval: 5000,
|
||||||
fetchPolicy: 'network-only',
|
fetchPolicy: 'network-only',
|
||||||
errorPolicy: 'ignore',
|
errorPolicy: 'ignore',
|
||||||
|
variables: {
|
||||||
|
includeNewMarketProductFields: !!FLAGS.PRODUCT_PERPETUALS,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@ -206,7 +212,9 @@ const GovernanceHome = ({ name }: RouteChildProps) => {
|
|||||||
const proposals = useMemo(
|
const proposals = useMemo(
|
||||||
() =>
|
() =>
|
||||||
proposalsData
|
proposalsData
|
||||||
? getNotRejectedProposals(proposalsData.proposalsConnection)
|
? getNotRejectedProposals(
|
||||||
|
removePaginationWrapper(proposalsData.proposalsConnection?.edges)
|
||||||
|
)
|
||||||
: [],
|
: [],
|
||||||
[proposalsData]
|
[proposalsData]
|
||||||
);
|
);
|
||||||
|
@ -3,7 +3,6 @@ import { Lozenge, VegaIcon, VegaIconNames } from '@vegaprotocol/ui-toolkit';
|
|||||||
import { shorten } from '@vegaprotocol/utils';
|
import { shorten } from '@vegaprotocol/utils';
|
||||||
import { Heading, SubHeading } from '../../../../components/heading';
|
import { Heading, SubHeading } from '../../../../components/heading';
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
import type { ProposalFieldsFragment } from '../../proposals/__generated__/Proposals';
|
|
||||||
import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
|
import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
|
||||||
import { truncateMiddle } from '../../../../lib/truncate-middle';
|
import { truncateMiddle } from '../../../../lib/truncate-middle';
|
||||||
import { CurrentProposalState } from '../current-proposal-state';
|
import { CurrentProposalState } from '../current-proposal-state';
|
||||||
@ -20,7 +19,7 @@ export const ProposalHeader = ({
|
|||||||
isListItem = true,
|
isListItem = true,
|
||||||
voteState,
|
voteState,
|
||||||
}: {
|
}: {
|
||||||
proposal: ProposalFieldsFragment | ProposalQuery['proposal'];
|
proposal: ProposalQuery['proposal'];
|
||||||
isListItem?: boolean;
|
isListItem?: boolean;
|
||||||
voteState?: VoteState | null;
|
voteState?: VoteState | null;
|
||||||
}) => {
|
}) => {
|
||||||
@ -37,7 +36,10 @@ export const ProposalHeader = ({
|
|||||||
|
|
||||||
switch (change?.__typename) {
|
switch (change?.__typename) {
|
||||||
case 'NewMarket': {
|
case 'NewMarket': {
|
||||||
proposalType = 'NewMarket';
|
proposalType =
|
||||||
|
FLAGS.PRODUCT_PERPETUALS && change?.instrument?.product?.__typename
|
||||||
|
? `NewMarket${change?.instrument?.product?.__typename}`
|
||||||
|
: 'NewMarket';
|
||||||
fallbackTitle = t('NewMarketProposal');
|
fallbackTitle = t('NewMarketProposal');
|
||||||
details = (
|
details = (
|
||||||
<>
|
<>
|
||||||
|
@ -10,7 +10,6 @@ import { UserVote } from '../vote-details';
|
|||||||
import { ListAsset } from '../list-asset';
|
import { ListAsset } from '../list-asset';
|
||||||
import Routes from '../../../routes';
|
import Routes from '../../../routes';
|
||||||
import { ProposalMarketData } from '../proposal-market-data';
|
import { ProposalMarketData } from '../proposal-market-data';
|
||||||
import type { ProposalFieldsFragment } from '../../proposals/__generated__/Proposals';
|
|
||||||
import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
|
import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
|
||||||
import type { MarketInfo } from '@vegaprotocol/markets';
|
import type { MarketInfo } from '@vegaprotocol/markets';
|
||||||
import type { AssetQuery } from '@vegaprotocol/assets';
|
import type { AssetQuery } from '@vegaprotocol/assets';
|
||||||
@ -22,7 +21,7 @@ import { useVoteSubmit } from '@vegaprotocol/proposals';
|
|||||||
import { useUserVote } from '../vote-details/use-user-vote';
|
import { useUserVote } from '../vote-details/use-user-vote';
|
||||||
|
|
||||||
export interface ProposalProps {
|
export interface ProposalProps {
|
||||||
proposal: ProposalFieldsFragment | ProposalQuery['proposal'];
|
proposal: ProposalQuery['proposal'];
|
||||||
networkParams: Partial<NetworkParamsResult>;
|
networkParams: Partial<NetworkParamsResult>;
|
||||||
newMarketData?: MarketInfo | null;
|
newMarketData?: MarketInfo | null;
|
||||||
parentMarketData?: MarketInfo | null;
|
parentMarketData?: MarketInfo | null;
|
||||||
|
@ -2,11 +2,10 @@ import { RoundedWrapper } from '@vegaprotocol/ui-toolkit';
|
|||||||
import { ProposalHeader } from '../proposal-detail-header/proposal-header';
|
import { ProposalHeader } from '../proposal-detail-header/proposal-header';
|
||||||
import { ProposalsListItemDetails } from './proposals-list-item-details';
|
import { ProposalsListItemDetails } from './proposals-list-item-details';
|
||||||
import { useUserVote } from '../vote-details/use-user-vote';
|
import { useUserVote } from '../vote-details/use-user-vote';
|
||||||
import type { ProposalFieldsFragment } from '../../proposals/__generated__/Proposals';
|
|
||||||
import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
|
import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
|
||||||
|
|
||||||
interface ProposalsListItemProps {
|
interface ProposalsListItemProps {
|
||||||
proposal?: ProposalFieldsFragment | ProposalQuery['proposal'] | null;
|
proposal?: ProposalQuery['proposal'] | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ProposalsListItem = ({ proposal }: ProposalsListItemProps) => {
|
export const ProposalsListItem = ({ proposal }: ProposalsListItemProps) => {
|
||||||
|
@ -16,14 +16,14 @@ import type { ProtocolUpgradeProposalFieldsFragment } from '@vegaprotocol/propos
|
|||||||
import { ExternalLinks } from '@vegaprotocol/environment';
|
import { ExternalLinks } from '@vegaprotocol/environment';
|
||||||
|
|
||||||
interface ProposalsListProps {
|
interface ProposalsListProps {
|
||||||
proposals: Array<ProposalFieldsFragment | ProposalQuery['proposal']>;
|
proposals: Array<ProposalQuery['proposal']>;
|
||||||
protocolUpgradeProposals: ProtocolUpgradeProposalFieldsFragment[];
|
protocolUpgradeProposals: ProtocolUpgradeProposalFieldsFragment[];
|
||||||
lastBlockHeight?: string;
|
lastBlockHeight?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SortedProposalsProps {
|
interface SortedProposalsProps {
|
||||||
open: Array<ProposalFieldsFragment | ProposalQuery['proposal']>;
|
open: ProposalQuery['proposal'][];
|
||||||
closed: Array<ProposalFieldsFragment | ProposalQuery['proposal']>;
|
closed: ProposalQuery['proposal'][];
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SortedProtocolUpgradeProposalsProps {
|
interface SortedProtocolUpgradeProposalsProps {
|
||||||
@ -31,7 +31,7 @@ interface SortedProtocolUpgradeProposalsProps {
|
|||||||
closed: ProtocolUpgradeProposalFieldsFragment[];
|
closed: ProtocolUpgradeProposalFieldsFragment[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const orderByDate = (arr: ProposalFieldsFragment[]) =>
|
export const orderByDate = (arr: ProposalQuery['proposal'][]) =>
|
||||||
orderBy(
|
orderBy(
|
||||||
arr,
|
arr,
|
||||||
[
|
[
|
||||||
@ -92,12 +92,12 @@ export const ProposalsList = ({
|
|||||||
return {
|
return {
|
||||||
open:
|
open:
|
||||||
initialSorting.open.length > 0
|
initialSorting.open.length > 0
|
||||||
? orderByDate(initialSorting.open as ProposalFieldsFragment[])
|
? orderByDate(initialSorting.open as ProposalQuery['proposal'][])
|
||||||
: [],
|
: [],
|
||||||
closed:
|
closed:
|
||||||
initialSorting.closed.length > 0
|
initialSorting.closed.length > 0
|
||||||
? orderByDate(
|
? orderByDate(
|
||||||
initialSorting.closed as ProposalFieldsFragment[]
|
initialSorting.closed as ProposalQuery['proposal'][]
|
||||||
).reverse()
|
).reverse()
|
||||||
: [],
|
: [],
|
||||||
};
|
};
|
||||||
|
@ -3,20 +3,17 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { Heading } from '../../../../components/heading';
|
import { Heading } from '../../../../components/heading';
|
||||||
import { ProposalsListItem } from '../proposals-list-item';
|
import { ProposalsListItem } from '../proposals-list-item';
|
||||||
import { ProposalsListFilter } from '../proposals-list-filter';
|
import { ProposalsListFilter } from '../proposals-list-filter';
|
||||||
import type { ProposalFieldsFragment } from '../../proposals/__generated__/Proposals';
|
|
||||||
import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
|
import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
|
||||||
|
|
||||||
interface ProposalsListProps {
|
interface ProposalsListProps {
|
||||||
proposals: Array<ProposalQuery['proposal'] | ProposalFieldsFragment>;
|
proposals: ProposalQuery['proposal'][];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const RejectedProposalsList = ({ proposals }: ProposalsListProps) => {
|
export const RejectedProposalsList = ({ proposals }: ProposalsListProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const [filterString, setFilterString] = useState('');
|
const [filterString, setFilterString] = useState('');
|
||||||
|
|
||||||
const filterPredicate = (
|
const filterPredicate = (p: ProposalQuery['proposal']) =>
|
||||||
p: ProposalFieldsFragment | ProposalQuery['proposal']
|
|
||||||
) =>
|
|
||||||
p?.id?.includes(filterString) ||
|
p?.id?.includes(filterString) ||
|
||||||
p?.party?.id?.toString().includes(filterString);
|
p?.party?.id?.toString().includes(filterString);
|
||||||
|
|
||||||
|
@ -1,4 +1,18 @@
|
|||||||
query Proposal($proposalId: ID!) {
|
fragment NewMarketProductField on Proposal {
|
||||||
|
terms {
|
||||||
|
change {
|
||||||
|
... on NewMarket {
|
||||||
|
instrument {
|
||||||
|
product {
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
query Proposal($proposalId: ID!, $includeNewMarketProductField: Boolean!) {
|
||||||
proposal(id: $proposalId) {
|
proposal(id: $proposalId) {
|
||||||
id
|
id
|
||||||
rationale {
|
rationale {
|
||||||
@ -13,6 +27,7 @@ query Proposal($proposalId: ID!) {
|
|||||||
id
|
id
|
||||||
}
|
}
|
||||||
errorDetails
|
errorDetails
|
||||||
|
...NewMarketProductField @include(if: $includeNewMarketProductField)
|
||||||
terms {
|
terms {
|
||||||
closingDatetime
|
closingDatetime
|
||||||
enactmentDatetime
|
enactmentDatetime
|
||||||
|
File diff suppressed because one or more lines are too long
@ -53,7 +53,10 @@ export const ProposalContainer = () => {
|
|||||||
const { data, loading, error, refetch } = useProposalQuery({
|
const { data, loading, error, refetch } = useProposalQuery({
|
||||||
fetchPolicy: 'network-only',
|
fetchPolicy: 'network-only',
|
||||||
errorPolicy: 'ignore',
|
errorPolicy: 'ignore',
|
||||||
variables: { proposalId: params.proposalId || '' },
|
variables: {
|
||||||
|
proposalId: params.proposalId || '',
|
||||||
|
includeNewMarketProductField: !!FLAGS.PRODUCT_PERPETUALS,
|
||||||
|
},
|
||||||
skip: !params.proposalId,
|
skip: !params.proposalId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,3 +1,17 @@
|
|||||||
|
fragment NewMarketProductFields on Proposal {
|
||||||
|
terms {
|
||||||
|
change {
|
||||||
|
... on NewMarket {
|
||||||
|
instrument {
|
||||||
|
product {
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fragment ProposalFields on Proposal {
|
fragment ProposalFields on Proposal {
|
||||||
id
|
id
|
||||||
rationale {
|
rationale {
|
||||||
@ -79,11 +93,12 @@ fragment ProposalFields on Proposal {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
query Proposals {
|
query Proposals($includeNewMarketProductFields: Boolean!) {
|
||||||
proposalsConnection {
|
proposalsConnection {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
...ProposalFields
|
...ProposalFields
|
||||||
|
...NewMarketProductFields @include(if: $includeNewMarketProductFields)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,13 +3,32 @@ import * as Types from '@vegaprotocol/types';
|
|||||||
import { gql } from '@apollo/client';
|
import { gql } from '@apollo/client';
|
||||||
import * as Apollo from '@apollo/client';
|
import * as Apollo from '@apollo/client';
|
||||||
const defaultOptions = {} as const;
|
const defaultOptions = {} as const;
|
||||||
|
export type NewMarketProductFieldsFragment = { __typename?: 'Proposal', terms: { __typename?: 'ProposalTerms', change: { __typename?: 'CancelTransfer' } | { __typename?: 'NewAsset' } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', instrument: { __typename?: 'InstrumentConfiguration', product?: { __typename: 'FutureProduct' } | { __typename: 'PerpetualProduct' } | { __typename: 'SpotProduct' } | null } } | { __typename?: 'NewSpotMarket' } | { __typename?: 'NewTransfer' } | { __typename?: 'UpdateAsset' } | { __typename?: 'UpdateMarket' } | { __typename?: 'UpdateMarketState' } | { __typename?: 'UpdateNetworkParameter' } | { __typename?: 'UpdateReferralProgram' } | { __typename?: 'UpdateSpotMarket' } | { __typename?: 'UpdateVolumeDiscountProgram' } } };
|
||||||
|
|
||||||
export type ProposalFieldsFragment = { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: any, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, terms: { __typename?: 'ProposalTerms', closingDatetime: any, enactmentDatetime?: any | null, change: { __typename?: 'CancelTransfer' } | { __typename: 'NewAsset', name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string, withdrawThreshold: string, lifetimeLimit: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', settlementAsset: { __typename?: 'Asset', symbol: string } } | null } } | { __typename?: 'NewSpotMarket' } | { __typename?: 'NewTransfer' } | { __typename?: 'UpdateAsset', quantum: string, assetId: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'UpdateMarket', marketId: string } | { __typename?: 'UpdateMarketState' } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } | { __typename?: 'UpdateReferralProgram' } | { __typename?: 'UpdateSpotMarket' } | { __typename?: 'UpdateVolumeDiscountProgram' } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string } } };
|
export type ProposalFieldsFragment = { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: any, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, terms: { __typename?: 'ProposalTerms', closingDatetime: any, enactmentDatetime?: any | null, change: { __typename?: 'CancelTransfer' } | { __typename: 'NewAsset', name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string, withdrawThreshold: string, lifetimeLimit: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', settlementAsset: { __typename?: 'Asset', symbol: string } } | null } } | { __typename?: 'NewSpotMarket' } | { __typename?: 'NewTransfer' } | { __typename?: 'UpdateAsset', quantum: string, assetId: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'UpdateMarket', marketId: string } | { __typename?: 'UpdateMarketState' } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } | { __typename?: 'UpdateReferralProgram' } | { __typename?: 'UpdateSpotMarket' } | { __typename?: 'UpdateVolumeDiscountProgram' } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string } } };
|
||||||
|
|
||||||
export type ProposalsQueryVariables = Types.Exact<{ [key: string]: never; }>;
|
export type ProposalsQueryVariables = Types.Exact<{
|
||||||
|
includeNewMarketProductFields: Types.Scalars['Boolean'];
|
||||||
|
}>;
|
||||||
|
|
||||||
|
|
||||||
export type ProposalsQuery = { __typename?: 'Query', proposalsConnection?: { __typename?: 'ProposalsConnection', edges?: Array<{ __typename?: 'ProposalEdge', node: { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: any, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, terms: { __typename?: 'ProposalTerms', closingDatetime: any, enactmentDatetime?: any | null, change: { __typename?: 'CancelTransfer' } | { __typename: 'NewAsset', name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string, withdrawThreshold: string, lifetimeLimit: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', settlementAsset: { __typename?: 'Asset', symbol: string } } | null } } | { __typename?: 'NewSpotMarket' } | { __typename?: 'NewTransfer' } | { __typename?: 'UpdateAsset', quantum: string, assetId: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'UpdateMarket', marketId: string } | { __typename?: 'UpdateMarketState' } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } | { __typename?: 'UpdateReferralProgram' } | { __typename?: 'UpdateSpotMarket' } | { __typename?: 'UpdateVolumeDiscountProgram' } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string } } } } | null> | null } | null };
|
export type ProposalsQuery = { __typename?: 'Query', proposalsConnection?: { __typename?: 'ProposalsConnection', edges?: Array<{ __typename?: 'ProposalEdge', node: { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: any, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, terms: { __typename?: 'ProposalTerms', closingDatetime: any, enactmentDatetime?: any | null, change: { __typename?: 'CancelTransfer' } | { __typename: 'NewAsset', name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string, withdrawThreshold: string, lifetimeLimit: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', settlementAsset: { __typename?: 'Asset', symbol: string } } | null, product?: { __typename: 'FutureProduct' } | { __typename: 'PerpetualProduct' } | { __typename: 'SpotProduct' } | null } } | { __typename?: 'NewSpotMarket' } | { __typename?: 'NewTransfer' } | { __typename?: 'UpdateAsset', quantum: string, assetId: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'UpdateMarket', marketId: string } | { __typename?: 'UpdateMarketState' } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } | { __typename?: 'UpdateReferralProgram' } | { __typename?: 'UpdateSpotMarket' } | { __typename?: 'UpdateVolumeDiscountProgram' } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string } } } } | null> | null } | null };
|
||||||
|
|
||||||
|
export const NewMarketProductFieldsFragmentDoc = gql`
|
||||||
|
fragment NewMarketProductFields on Proposal {
|
||||||
|
terms {
|
||||||
|
change {
|
||||||
|
... on NewMarket {
|
||||||
|
instrument {
|
||||||
|
product {
|
||||||
|
__typename
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
export const ProposalFieldsFragmentDoc = gql`
|
export const ProposalFieldsFragmentDoc = gql`
|
||||||
fragment ProposalFields on Proposal {
|
fragment ProposalFields on Proposal {
|
||||||
id
|
id
|
||||||
@ -93,16 +112,18 @@ export const ProposalFieldsFragmentDoc = gql`
|
|||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
export const ProposalsDocument = gql`
|
export const ProposalsDocument = gql`
|
||||||
query Proposals {
|
query Proposals($includeNewMarketProductFields: Boolean!) {
|
||||||
proposalsConnection {
|
proposalsConnection {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
...ProposalFields
|
...ProposalFields
|
||||||
|
...NewMarketProductFields @include(if: $includeNewMarketProductFields)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
${ProposalFieldsFragmentDoc}`;
|
${ProposalFieldsFragmentDoc}
|
||||||
|
${NewMarketProductFieldsFragmentDoc}`;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __useProposalsQuery__
|
* __useProposalsQuery__
|
||||||
@ -116,10 +137,11 @@ export const ProposalsDocument = gql`
|
|||||||
* @example
|
* @example
|
||||||
* const { data, loading, error } = useProposalsQuery({
|
* const { data, loading, error } = useProposalsQuery({
|
||||||
* variables: {
|
* variables: {
|
||||||
|
* includeNewMarketProductFields: // value for 'includeNewMarketProductFields'
|
||||||
* },
|
* },
|
||||||
* });
|
* });
|
||||||
*/
|
*/
|
||||||
export function useProposalsQuery(baseOptions?: Apollo.QueryHookOptions<ProposalsQuery, ProposalsQueryVariables>) {
|
export function useProposalsQuery(baseOptions: Apollo.QueryHookOptions<ProposalsQuery, ProposalsQueryVariables>) {
|
||||||
const options = {...defaultOptions, ...baseOptions}
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
return Apollo.useQuery<ProposalsQuery, ProposalsQueryVariables>(ProposalsDocument, options);
|
return Apollo.useQuery<ProposalsQuery, ProposalsQueryVariables>(ProposalsDocument, options);
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { SplashLoader } from '../../../components/splash-loader';
|
import { SplashLoader } from '../../../components/splash-loader';
|
||||||
import { ProposalsList } from '../components/proposals-list';
|
import { ProposalsList } from '../components/proposals-list';
|
||||||
import { useProposalsQuery } from './__generated__/Proposals';
|
import { useProposalsQuery } from './__generated__/Proposals';
|
||||||
import { getNodes } from '@vegaprotocol/utils';
|
import { getNodes, removePaginationWrapper } from '@vegaprotocol/utils';
|
||||||
import {
|
import {
|
||||||
ProposalState,
|
ProposalState,
|
||||||
ProtocolUpgradeProposalStatus,
|
ProtocolUpgradeProposalStatus,
|
||||||
@ -15,14 +15,13 @@ import type { NodeConnection, NodeEdge } from '@vegaprotocol/utils';
|
|||||||
import type { ProposalFieldsFragment } from './__generated__/Proposals';
|
import type { ProposalFieldsFragment } from './__generated__/Proposals';
|
||||||
import type { ProtocolUpgradeProposalFieldsFragment } from '@vegaprotocol/proposals';
|
import type { ProtocolUpgradeProposalFieldsFragment } from '@vegaprotocol/proposals';
|
||||||
import { useProtocolUpgradeProposalsQuery } from '@vegaprotocol/proposals';
|
import { useProtocolUpgradeProposalsQuery } from '@vegaprotocol/proposals';
|
||||||
|
import { FLAGS } from '@vegaprotocol/environment';
|
||||||
|
|
||||||
export function getNotRejectedProposals<T extends ProposalFieldsFragment>(
|
export function getNotRejectedProposals(data?: ProposalFieldsFragment[]) {
|
||||||
data?: NodeConnection<NodeEdge<T>> | null
|
|
||||||
): T[] {
|
|
||||||
return flow([
|
return flow([
|
||||||
(data) =>
|
(data) =>
|
||||||
getNodes<ProposalFieldsFragment>(data, (p) =>
|
data.filter(
|
||||||
p ? p.state !== ProposalState.STATE_REJECTED : false
|
(p: ProposalFieldsFragment) => p?.state !== ProposalState.STATE_REJECTED
|
||||||
),
|
),
|
||||||
])(data);
|
])(data);
|
||||||
}
|
}
|
||||||
@ -47,6 +46,9 @@ export const ProposalsContainer = () => {
|
|||||||
pollInterval: 5000,
|
pollInterval: 5000,
|
||||||
fetchPolicy: 'network-only',
|
fetchPolicy: 'network-only',
|
||||||
errorPolicy: 'ignore',
|
errorPolicy: 'ignore',
|
||||||
|
variables: {
|
||||||
|
includeNewMarketProductFields: !!FLAGS.PRODUCT_PERPETUALS,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@ -60,7 +62,10 @@ export const ProposalsContainer = () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const proposals = useMemo(
|
const proposals = useMemo(
|
||||||
() => getNotRejectedProposals(data?.proposalsConnection),
|
() =>
|
||||||
|
getNotRejectedProposals(
|
||||||
|
removePaginationWrapper(data?.proposalsConnection?.edges)
|
||||||
|
),
|
||||||
[data]
|
[data]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -6,11 +6,11 @@ import { SplashLoader } from '../../../components/splash-loader';
|
|||||||
import { RejectedProposalsList } from '../components/proposals-list';
|
import { RejectedProposalsList } from '../components/proposals-list';
|
||||||
import type { ProposalFieldsFragment } from '../proposals/__generated__/Proposals';
|
import type { ProposalFieldsFragment } from '../proposals/__generated__/Proposals';
|
||||||
import { useProposalsQuery } from '../proposals/__generated__/Proposals';
|
import { useProposalsQuery } from '../proposals/__generated__/Proposals';
|
||||||
import type { NodeConnection, NodeEdge } from '@vegaprotocol/utils';
|
import { removePaginationWrapper } from '@vegaprotocol/utils';
|
||||||
import { getNodes } from '@vegaprotocol/utils';
|
|
||||||
import flow from 'lodash/flow';
|
import flow from 'lodash/flow';
|
||||||
import orderBy from 'lodash/orderBy';
|
import orderBy from 'lodash/orderBy';
|
||||||
import { ProposalState } from '@vegaprotocol/types';
|
import { ProposalState } from '@vegaprotocol/types';
|
||||||
|
import { FLAGS } from '@vegaprotocol/environment';
|
||||||
|
|
||||||
const orderByDate = (arr: ProposalFieldsFragment[]) =>
|
const orderByDate = (arr: ProposalFieldsFragment[]) =>
|
||||||
orderBy(
|
orderBy(
|
||||||
@ -22,13 +22,11 @@ const orderByDate = (arr: ProposalFieldsFragment[]) =>
|
|||||||
['desc', 'desc']
|
['desc', 'desc']
|
||||||
);
|
);
|
||||||
|
|
||||||
export function getRejectedProposals<T extends ProposalFieldsFragment>(
|
export function getRejectedProposals(data?: ProposalFieldsFragment[] | null) {
|
||||||
data?: NodeConnection<NodeEdge<ProposalFieldsFragment>> | null
|
|
||||||
): T[] {
|
|
||||||
return flow([
|
return flow([
|
||||||
(data) =>
|
(data) =>
|
||||||
getNodes<ProposalFieldsFragment>(data, (p) =>
|
data.filter(
|
||||||
p ? p?.state === ProposalState.STATE_REJECTED : false
|
(p: ProposalFieldsFragment) => p?.state === ProposalState.STATE_REJECTED
|
||||||
),
|
),
|
||||||
orderByDate,
|
orderByDate,
|
||||||
])(data);
|
])(data);
|
||||||
@ -36,11 +34,20 @@ export function getRejectedProposals<T extends ProposalFieldsFragment>(
|
|||||||
|
|
||||||
export const RejectedProposalsContainer = () => {
|
export const RejectedProposalsContainer = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { data, loading, error } = useProposalsQuery();
|
const { data, loading, error } = useProposalsQuery({
|
||||||
|
pollInterval: 5000,
|
||||||
|
fetchPolicy: 'network-only',
|
||||||
|
errorPolicy: 'ignore',
|
||||||
|
variables: {
|
||||||
|
includeNewMarketProductFields: !!FLAGS.PRODUCT_PERPETUALS,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
const proposals = useMemo(
|
const proposals = useMemo(
|
||||||
() =>
|
() =>
|
||||||
getRejectedProposals<ProposalFieldsFragment>(data?.proposalsConnection),
|
getRejectedProposals(
|
||||||
|
removePaginationWrapper(data?.proposalsConnection?.edges)
|
||||||
|
),
|
||||||
[data]
|
[data]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
2
libs/types/src/__generated__/types.ts
generated
2
libs/types/src/__generated__/types.ts
generated
@ -4637,7 +4637,7 @@ export type ReferralSet = {
|
|||||||
* Referral set statistics for the latest or specific epoch.
|
* Referral set statistics for the latest or specific epoch.
|
||||||
* If provided the results can be filtered for a specific referee
|
* If provided the results can be filtered for a specific referee
|
||||||
*/
|
*/
|
||||||
stats: ReferralSetStats;
|
stats?: Maybe<ReferralSetStats>;
|
||||||
/** Timestamp as RFC3339Nano when the referral set was updated. */
|
/** Timestamp as RFC3339Nano when the referral set was updated. */
|
||||||
updatedAt: Scalars['Timestamp'];
|
updatedAt: Scalars['Timestamp'];
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user