chore: cleanup type gen (#2362)
* chore: remove apollo type gen and clean up types lib * fix: format * fix: tests * fix: format * fix: hammer token types til sh*t turns green * fix: format * fix: apparently format again * fix: lint * fix: build-specs * fix: format * chore: regen types * chore: regenerate types again * fix: format
This commit is contained in:
parent
e5fe6a3106
commit
2211abbd72
@ -1,5 +1,5 @@
|
|||||||
import type { Market } from '@vegaprotocol/market-list';
|
import type { Market } from '@vegaprotocol/market-list';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import type { SingleMarketFieldsFragment } from '@vegaprotocol/market-list';
|
import type { SingleMarketFieldsFragment } from '@vegaprotocol/market-list';
|
||||||
|
|
||||||
export const protoCandles = [
|
export const protoCandles = [
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import merge from 'lodash/merge';
|
import merge from 'lodash/merge';
|
||||||
import type { AccountsQuery } from '@vegaprotocol/accounts';
|
import type { AccountsQuery } from '@vegaprotocol/accounts';
|
||||||
import { Schema as Types } from '@vegaprotocol/types';
|
import * as Types from '@vegaprotocol/types';
|
||||||
import type { PartialDeep } from 'type-fest';
|
import type { PartialDeep } from 'type-fest';
|
||||||
|
|
||||||
export const generateAccounts = (
|
export const generateAccounts = (
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import merge from 'lodash/merge';
|
import merge from 'lodash/merge';
|
||||||
import type { AssetsQuery } from '@vegaprotocol/assets';
|
import type { AssetsQuery } from '@vegaprotocol/assets';
|
||||||
import { Schema as Types } from '@vegaprotocol/types';
|
import * as Types from '@vegaprotocol/types';
|
||||||
import type { PartialDeep } from 'type-fest';
|
import type { PartialDeep } from 'type-fest';
|
||||||
|
|
||||||
export const generateAssets = (override?: PartialDeep<AssetsQuery>) => {
|
export const generateAssets = (override?: PartialDeep<AssetsQuery>) => {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import type { FillsQuery, FillFieldsFragment } from '@vegaprotocol/fills';
|
import type { FillsQuery, FillFieldsFragment } from '@vegaprotocol/fills';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import merge from 'lodash/merge';
|
import merge from 'lodash/merge';
|
||||||
import type { PartialDeep } from 'type-fest';
|
import type { PartialDeep } from 'type-fest';
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import merge from 'lodash/merge';
|
import merge from 'lodash/merge';
|
||||||
import type { PartialDeep } from 'type-fest';
|
import type { PartialDeep } from 'type-fest';
|
||||||
// eslint-disable-next-line @nrwl/nx/enforce-module-boundaries
|
// eslint-disable-next-line @nrwl/nx/enforce-module-boundaries
|
||||||
import type { MarketDepthQuery } from '../../../../../libs/market-depth/src/lib/__generated___/MarketDepth';
|
import type { MarketDepthQuery } from '../../../../../libs/market-depth/src/lib/__generated__/MarketDepth';
|
||||||
|
|
||||||
export const generateMarketDepth = (
|
export const generateMarketDepth = (
|
||||||
override?: PartialDeep<MarketDepthQuery>
|
override?: PartialDeep<MarketDepthQuery>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import type { MarketPositionsQuery } from '@vegaprotocol/deal-ticket';
|
import type { MarketPositionsQuery } from '@vegaprotocol/deal-ticket';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
|
|
||||||
export const generateMarketPositions = (): MarketPositionsQuery => {
|
export const generateMarketPositions = (): MarketPositionsQuery => {
|
||||||
return {
|
return {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import merge from 'lodash/merge';
|
import merge from 'lodash/merge';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import type {
|
import type {
|
||||||
MarketsQuery,
|
MarketsQuery,
|
||||||
Market,
|
Market,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import merge from 'lodash/merge';
|
import merge from 'lodash/merge';
|
||||||
import type { PartialDeep } from 'type-fest';
|
import type { PartialDeep } from 'type-fest';
|
||||||
import type { OrdersQuery, OrderFieldsFragment } from '@vegaprotocol/orders';
|
import type { OrdersQuery, OrderFieldsFragment } from '@vegaprotocol/orders';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
|
|
||||||
export const generateOrders = (
|
export const generateOrders = (
|
||||||
override?: PartialDeep<OrdersQuery>
|
override?: PartialDeep<OrdersQuery>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import merge from 'lodash/merge';
|
import merge from 'lodash/merge';
|
||||||
import type { PartyBalanceQuery } from '@vegaprotocol/deal-ticket';
|
import type { PartyBalanceQuery } from '@vegaprotocol/deal-ticket';
|
||||||
import type { PartialDeep } from 'type-fest';
|
import type { PartialDeep } from 'type-fest';
|
||||||
import { Schema as Types } from '@vegaprotocol/types';
|
import * as Types from '@vegaprotocol/types';
|
||||||
|
|
||||||
export const generatePartyBalance = (
|
export const generatePartyBalance = (
|
||||||
override?: PartialDeep<PartyBalanceQuery>
|
override?: PartialDeep<PartyBalanceQuery>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import type { PartyMarketDataQuery } from '@vegaprotocol/deal-ticket';
|
import type { PartyMarketDataQuery } from '@vegaprotocol/deal-ticket';
|
||||||
import { Schema as Types } from '@vegaprotocol/types';
|
import * as Types from '@vegaprotocol/types';
|
||||||
|
|
||||||
export const generatePartyMarketData = (): PartyMarketDataQuery => {
|
export const generatePartyMarketData = (): PartyMarketDataQuery => {
|
||||||
return {
|
return {
|
||||||
|
@ -1,51 +1,54 @@
|
|||||||
/* tslint:disable */
|
import * as Types from '@vegaprotocol/types';
|
||||||
/* eslint-disable */
|
|
||||||
// @generated
|
|
||||||
// This file was automatically generated and should not be edited.
|
|
||||||
|
|
||||||
// ====================================================
|
import { gql } from '@apollo/client';
|
||||||
// GraphQL query operation: MarketTags
|
import * as Apollo from '@apollo/client';
|
||||||
// ====================================================
|
const defaultOptions = {} as const;
|
||||||
|
export type MarketTagsQueryVariables = Types.Exact<{
|
||||||
|
marketId: Types.Scalars['ID'];
|
||||||
|
}>;
|
||||||
|
|
||||||
export interface MarketTags_market_tradableInstrument_instrument_metadata {
|
|
||||||
__typename: "InstrumentMetadata";
|
export type MarketTagsQuery = { __typename?: 'Query', market?: { __typename?: 'Market', tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', metadata: { __typename?: 'InstrumentMetadata', tags?: Array<string> | null } } } } | null };
|
||||||
/**
|
|
||||||
* An arbitrary list of tags to associated to associate to the Instrument (string list)
|
|
||||||
*/
|
export const MarketTagsDocument = gql`
|
||||||
tags: string[] | null;
|
query MarketTags($marketId: ID!) {
|
||||||
|
market(id: $marketId) {
|
||||||
|
tradableInstrument {
|
||||||
|
instrument {
|
||||||
|
metadata {
|
||||||
|
tags
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
export interface MarketTags_market_tradableInstrument_instrument {
|
/**
|
||||||
__typename: "Instrument";
|
* __useMarketTagsQuery__
|
||||||
/**
|
*
|
||||||
* Metadata for this instrument
|
* To run a query within a React component, call `useMarketTagsQuery` and pass it any options that fit your needs.
|
||||||
*/
|
* When your component renders, `useMarketTagsQuery` returns an object from Apollo Client that contains loading, error, and data properties
|
||||||
metadata: MarketTags_market_tradableInstrument_instrument_metadata;
|
* 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;
|
||||||
export interface MarketTags_market_tradableInstrument {
|
*
|
||||||
__typename: "TradableInstrument";
|
* @example
|
||||||
/**
|
* const { data, loading, error } = useMarketTagsQuery({
|
||||||
* An instance of, or reference to, a fully specified instrument.
|
* variables: {
|
||||||
*/
|
* marketId: // value for 'marketId'
|
||||||
instrument: MarketTags_market_tradableInstrument_instrument;
|
* },
|
||||||
}
|
* });
|
||||||
|
*/
|
||||||
export interface MarketTags_market {
|
export function useMarketTagsQuery(baseOptions: Apollo.QueryHookOptions<MarketTagsQuery, MarketTagsQueryVariables>) {
|
||||||
__typename: "Market";
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
/**
|
return Apollo.useQuery<MarketTagsQuery, MarketTagsQueryVariables>(MarketTagsDocument, options);
|
||||||
* An instance of, or reference to, a tradable instrument.
|
}
|
||||||
*/
|
export function useMarketTagsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<MarketTagsQuery, MarketTagsQueryVariables>) {
|
||||||
tradableInstrument: MarketTags_market_tradableInstrument;
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
}
|
return Apollo.useLazyQuery<MarketTagsQuery, MarketTagsQueryVariables>(MarketTagsDocument, options);
|
||||||
|
}
|
||||||
export interface MarketTags {
|
export type MarketTagsQueryHookResult = ReturnType<typeof useMarketTagsQuery>;
|
||||||
/**
|
export type MarketTagsLazyQueryHookResult = ReturnType<typeof useMarketTagsLazyQuery>;
|
||||||
* An instrument that is trading on the Vega network
|
export type MarketTagsQueryResult = Apollo.QueryResult<MarketTagsQuery, MarketTagsQueryVariables>;
|
||||||
*/
|
|
||||||
market: MarketTags_market | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface MarketTagsVariables {
|
|
||||||
marketId: string;
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
import { Schema as Types } from '@vegaprotocol/types';
|
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';
|
@ -1,54 +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 MarketTagsQueryVariables = Types.Exact<{
|
|
||||||
marketId: Types.Scalars['ID'];
|
|
||||||
}>;
|
|
||||||
|
|
||||||
|
|
||||||
export type MarketTagsQuery = { __typename?: 'Query', market?: { __typename?: 'Market', tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', metadata: { __typename?: 'InstrumentMetadata', tags?: Array<string> | null } } } } | null };
|
|
||||||
|
|
||||||
|
|
||||||
export const MarketTagsDocument = gql`
|
|
||||||
query MarketTags($marketId: ID!) {
|
|
||||||
market(id: $marketId) {
|
|
||||||
tradableInstrument {
|
|
||||||
instrument {
|
|
||||||
metadata {
|
|
||||||
tags
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* __useMarketTagsQuery__
|
|
||||||
*
|
|
||||||
* To run a query within a React component, call `useMarketTagsQuery` and pass it any options that fit your needs.
|
|
||||||
* When your component renders, `useMarketTagsQuery` 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 } = useMarketTagsQuery({
|
|
||||||
* variables: {
|
|
||||||
* marketId: // value for 'marketId'
|
|
||||||
* },
|
|
||||||
* });
|
|
||||||
*/
|
|
||||||
export function useMarketTagsQuery(baseOptions: Apollo.QueryHookOptions<MarketTagsQuery, MarketTagsQueryVariables>) {
|
|
||||||
const options = {...defaultOptions, ...baseOptions}
|
|
||||||
return Apollo.useQuery<MarketTagsQuery, MarketTagsQueryVariables>(MarketTagsDocument, options);
|
|
||||||
}
|
|
||||||
export function useMarketTagsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<MarketTagsQuery, MarketTagsQueryVariables>) {
|
|
||||||
const options = {...defaultOptions, ...baseOptions}
|
|
||||||
return Apollo.useLazyQuery<MarketTagsQuery, MarketTagsQueryVariables>(MarketTagsDocument, options);
|
|
||||||
}
|
|
||||||
export type MarketTagsQueryHookResult = ReturnType<typeof useMarketTagsQuery>;
|
|
||||||
export type MarketTagsLazyQueryHookResult = ReturnType<typeof useMarketTagsLazyQuery>;
|
|
||||||
export type MarketTagsQueryResult = Apollo.QueryResult<MarketTagsQuery, MarketTagsQueryVariables>;
|
|
@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
import { render } from '@testing-library/react';
|
import { render } from '@testing-library/react';
|
||||||
import type { AccountFragment } from '@vegaprotocol/deal-ticket';
|
import type { AccountFragment } from '@vegaprotocol/deal-ticket';
|
||||||
import { DealTicketBalance } from './deal-ticket-balance';
|
import { DealTicketBalance } from './deal-ticket-balance';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import type { MarketDealTicketAsset } from '@vegaprotocol/market-list';
|
import type { MarketDealTicketAsset } from '@vegaprotocol/market-list';
|
||||||
|
|
||||||
const tDAI: MarketDealTicketAsset = {
|
const tDAI: MarketDealTicketAsset = {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { addDecimalsFormatNumber, t } from '@vegaprotocol/react-helpers';
|
import { addDecimalsFormatNumber, t } from '@vegaprotocol/react-helpers';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import type { AccountFragment } from '@vegaprotocol/deal-ticket';
|
import type { AccountFragment } from '@vegaprotocol/deal-ticket';
|
||||||
import type { MarketDealTicket } from '@vegaprotocol/market-list';
|
import type { MarketDealTicket } from '@vegaprotocol/market-list';
|
||||||
import { useSettlementAccount } from '@vegaprotocol/deal-ticket';
|
import { useSettlementAccount } from '@vegaprotocol/deal-ticket';
|
||||||
|
@ -37,7 +37,7 @@ import { DealTicketSize } from './deal-ticket-size';
|
|||||||
import MarketNameRenderer from '../simple-market-list/simple-market-renderer';
|
import MarketNameRenderer from '../simple-market-list/simple-market-renderer';
|
||||||
import SideSelector, { SIDE_NAMES } from './side-selector';
|
import SideSelector, { SIDE_NAMES } from './side-selector';
|
||||||
import ReviewTrade from './review-trade';
|
import ReviewTrade from './review-trade';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import { DealTicketSlippage } from './deal-ticket-slippage';
|
import { DealTicketSlippage } from './deal-ticket-slippage';
|
||||||
import { useOrderValidation } from './use-order-validation';
|
import { useOrderValidation } from './use-order-validation';
|
||||||
import type { MarketDealTicket } from '@vegaprotocol/market-list';
|
import type { MarketDealTicket } from '@vegaprotocol/market-list';
|
||||||
|
@ -8,28 +8,10 @@ import classNames from 'classnames';
|
|||||||
import { DealTicketEstimates } from '@vegaprotocol/deal-ticket';
|
import { DealTicketEstimates } from '@vegaprotocol/deal-ticket';
|
||||||
import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
|
import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
|
||||||
import { SIDE_NAMES } from './side-selector';
|
import { SIDE_NAMES } from './side-selector';
|
||||||
import { gql, useQuery } from '@apollo/client';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
|
||||||
import { MarketExpires } from '@vegaprotocol/market-info';
|
import { MarketExpires } from '@vegaprotocol/market-info';
|
||||||
import type { MarketDealTicket } from '@vegaprotocol/market-list';
|
import type { MarketDealTicket } from '@vegaprotocol/market-list';
|
||||||
import type {
|
import { useMarketTagsQuery } from './__generated__/MarketTags';
|
||||||
MarketTags,
|
|
||||||
MarketTagsVariables,
|
|
||||||
} from './__generated__/MarketTags';
|
|
||||||
|
|
||||||
export const MARKET_TAGS_QUERY = gql`
|
|
||||||
query MarketTags($marketId: ID!) {
|
|
||||||
market(id: $marketId) {
|
|
||||||
tradableInstrument {
|
|
||||||
instrument {
|
|
||||||
metadata {
|
|
||||||
tags
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
market: MarketDealTicket;
|
market: MarketDealTicket;
|
||||||
@ -57,12 +39,9 @@ export default ({
|
|||||||
notionalSize,
|
notionalSize,
|
||||||
slippage,
|
slippage,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const { data: tagsData } = useQuery<MarketTags, MarketTagsVariables>(
|
const { data: tagsData } = useMarketTagsQuery({
|
||||||
MARKET_TAGS_QUERY,
|
variables: { marketId: market.id },
|
||||||
{
|
});
|
||||||
variables: { marketId: market.id },
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mb-8 text-black dark:text-white" data-testid="review-trade">
|
<div className="mb-8 text-black dark:text-white" data-testid="review-trade">
|
||||||
|
@ -2,7 +2,7 @@ import React from 'react';
|
|||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { FormGroup } from '@vegaprotocol/ui-toolkit';
|
import { FormGroup } from '@vegaprotocol/ui-toolkit';
|
||||||
import { t } from '@vegaprotocol/react-helpers';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
|
|
||||||
interface SideSelectorProps {
|
interface SideSelectorProps {
|
||||||
value: Schema.Side;
|
value: Schema.Side;
|
||||||
|
@ -3,11 +3,7 @@ import { renderHook } from '@testing-library/react';
|
|||||||
import { useVegaWallet } from '@vegaprotocol/wallet';
|
import { useVegaWallet } from '@vegaprotocol/wallet';
|
||||||
import { MockedProvider } from '@apollo/client/testing';
|
import { MockedProvider } from '@apollo/client/testing';
|
||||||
import type { VegaWalletContextShape } from '@vegaprotocol/wallet';
|
import type { VegaWalletContextShape } from '@vegaprotocol/wallet';
|
||||||
import {
|
import * as Schema from '@vegaprotocol/types';
|
||||||
MarketStateMapping,
|
|
||||||
Schema as Types,
|
|
||||||
Schema,
|
|
||||||
} from '@vegaprotocol/types';
|
|
||||||
import type { ValidationProps } from './use-order-validation';
|
import type { ValidationProps } from './use-order-validation';
|
||||||
import { marketTranslations, useOrderValidation } from './use-order-validation';
|
import { marketTranslations, useOrderValidation } from './use-order-validation';
|
||||||
import type { MarketDealTicket } from '@vegaprotocol/market-list';
|
import type { MarketDealTicket } from '@vegaprotocol/market-list';
|
||||||
@ -78,7 +74,7 @@ const market: MarketDealTicket = {
|
|||||||
bestBidPrice: '1605489971',
|
bestBidPrice: '1605489971',
|
||||||
bestOfferPrice: '1606823730',
|
bestOfferPrice: '1606823730',
|
||||||
markPrice: '1606823730',
|
markPrice: '1606823730',
|
||||||
trigger: Types.AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED,
|
trigger: Schema.AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED,
|
||||||
staticMidPrice: '1606156850',
|
staticMidPrice: '1606156850',
|
||||||
marketTradingMode: Schema.MarketTradingMode.TRADING_MODE_CONTINUOUS,
|
marketTradingMode: Schema.MarketTradingMode.TRADING_MODE_CONTINUOUS,
|
||||||
marketState: Schema.MarketState.STATE_ACTIVE,
|
marketState: Schema.MarketState.STATE_ACTIVE,
|
||||||
@ -245,7 +241,7 @@ describe('useOrderValidation', () => {
|
|||||||
});
|
});
|
||||||
expect(result.current).toStrictEqual({
|
expect(result.current).toStrictEqual({
|
||||||
isDisabled: false,
|
isDisabled: false,
|
||||||
message: `This market is ${MarketStateMapping[
|
message: `This market is ${Schema.MarketStateMapping[
|
||||||
state as Schema.MarketState
|
state as Schema.MarketState
|
||||||
].toLowerCase()} and only accepting liquidity commitment orders`,
|
].toLowerCase()} and only accepting liquidity commitment orders`,
|
||||||
section: 'sec-summary',
|
section: 'sec-summary',
|
||||||
|
@ -3,7 +3,7 @@ import type { FieldErrors } from 'react-hook-form';
|
|||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { t, toDecimal } from '@vegaprotocol/react-helpers';
|
import { t, toDecimal } from '@vegaprotocol/react-helpers';
|
||||||
import { useVegaWallet } from '@vegaprotocol/wallet';
|
import { useVegaWallet } from '@vegaprotocol/wallet';
|
||||||
import { MarketStateMapping, Schema } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
|
import type { OrderSubmissionBody } from '@vegaprotocol/wallet';
|
||||||
import { Tooltip } from '@vegaprotocol/ui-toolkit';
|
import { Tooltip } from '@vegaprotocol/ui-toolkit';
|
||||||
import {
|
import {
|
||||||
@ -39,7 +39,7 @@ export const marketTranslations = (marketState: Schema.MarketState) => {
|
|||||||
case Schema.MarketState.STATE_TRADING_TERMINATED:
|
case Schema.MarketState.STATE_TRADING_TERMINATED:
|
||||||
return t('terminated');
|
return t('terminated');
|
||||||
default:
|
default:
|
||||||
return t(MarketStateMapping[marketState]).toLowerCase();
|
return t(Schema.MarketStateMapping[marketState]).toLowerCase();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import {
|
|||||||
t,
|
t,
|
||||||
} from '@vegaprotocol/react-helpers';
|
} from '@vegaprotocol/react-helpers';
|
||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
partyId: string;
|
partyId: string;
|
||||||
|
@ -14,20 +14,14 @@ import {
|
|||||||
import type { OrderFieldsFragment, Order } from '@vegaprotocol/orders';
|
import type { OrderFieldsFragment, Order } from '@vegaprotocol/orders';
|
||||||
import type { OrderCancellationBody } from '@vegaprotocol/wallet';
|
import type { OrderCancellationBody } from '@vegaprotocol/wallet';
|
||||||
import { isOrderActive } from '@vegaprotocol/orders';
|
import { isOrderActive } from '@vegaprotocol/orders';
|
||||||
import {
|
import * as Schema from '@vegaprotocol/types';
|
||||||
OrderRejectionReasonMapping,
|
|
||||||
OrderStatusMapping,
|
|
||||||
OrderTypeMapping,
|
|
||||||
Schema,
|
|
||||||
OrderTimeInForceMapping,
|
|
||||||
} from '@vegaprotocol/types';
|
|
||||||
|
|
||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
import { Button } from '@vegaprotocol/ui-toolkit';
|
import { Button } from '@vegaprotocol/ui-toolkit';
|
||||||
|
|
||||||
type StatusKey = keyof typeof OrderStatusMapping;
|
type StatusKey = keyof typeof Schema.OrderStatusMapping;
|
||||||
type RejectReasonKey = keyof typeof OrderRejectionReasonMapping;
|
type RejectReasonKey = keyof typeof Schema.OrderRejectionReasonMapping;
|
||||||
type OrderTimeKey = keyof typeof OrderTimeInForceMapping;
|
type OrderTimeKey = keyof typeof Schema.OrderTimeInForceMapping;
|
||||||
interface Props {
|
interface Props {
|
||||||
setEditOrder: (order: Order) => void;
|
setEditOrder: (order: Order) => void;
|
||||||
orderCancel: {
|
orderCancel: {
|
||||||
@ -81,7 +75,7 @@ const useColumnDefinitions = ({ setEditOrder, orderCancel }: Props) => {
|
|||||||
value,
|
value,
|
||||||
}: ValueFormatterParams & {
|
}: ValueFormatterParams & {
|
||||||
value?: OrderFieldsFragment['type'];
|
value?: OrderFieldsFragment['type'];
|
||||||
}) => OrderTypeMapping[value as Schema.OrderType],
|
}) => Schema.OrderTypeMapping[value as Schema.OrderType],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
colId: 'status',
|
colId: 'status',
|
||||||
@ -95,14 +89,14 @@ const useColumnDefinitions = ({ setEditOrder, orderCancel }: Props) => {
|
|||||||
}) => {
|
}) => {
|
||||||
if (value && data && data.market) {
|
if (value && data && data.market) {
|
||||||
if (value === Schema.OrderStatus.STATUS_REJECTED) {
|
if (value === Schema.OrderStatus.STATUS_REJECTED) {
|
||||||
return `${OrderStatusMapping[value as StatusKey]}: ${
|
return `${Schema.OrderStatusMapping[value as StatusKey]}: ${
|
||||||
data.rejectionReason &&
|
data.rejectionReason &&
|
||||||
OrderRejectionReasonMapping[
|
Schema.OrderRejectionReasonMapping[
|
||||||
data.rejectionReason as RejectReasonKey
|
data.rejectionReason as RejectReasonKey
|
||||||
]
|
]
|
||||||
}`;
|
}`;
|
||||||
}
|
}
|
||||||
return OrderStatusMapping[value as StatusKey] as string;
|
return Schema.OrderStatusMapping[value as StatusKey] as string;
|
||||||
}
|
}
|
||||||
return '-';
|
return '-';
|
||||||
},
|
},
|
||||||
@ -176,11 +170,11 @@ const useColumnDefinitions = ({ setEditOrder, orderCancel }: Props) => {
|
|||||||
new Date(data.expiresAt)
|
new Date(data.expiresAt)
|
||||||
);
|
);
|
||||||
return `${
|
return `${
|
||||||
OrderTimeInForceMapping[value as OrderTimeKey]
|
Schema.OrderTimeInForceMapping[value as OrderTimeKey]
|
||||||
}: ${expiry}`;
|
}: ${expiry}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
return OrderTimeInForceMapping[value as OrderTimeKey];
|
return Schema.OrderTimeInForceMapping[value as OrderTimeKey];
|
||||||
}
|
}
|
||||||
return '-';
|
return '-';
|
||||||
},
|
},
|
||||||
|
@ -16,7 +16,7 @@ import type {
|
|||||||
GroupCellRendererParams,
|
GroupCellRendererParams,
|
||||||
ColDef,
|
ColDef,
|
||||||
} from 'ag-grid-community';
|
} from 'ag-grid-community';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import type { VegaValueFormatterParams } from '@vegaprotocol/ui-toolkit';
|
import type { VegaValueFormatterParams } from '@vegaprotocol/ui-toolkit';
|
||||||
import { Intent, ProgressBarCell } from '@vegaprotocol/ui-toolkit';
|
import { Intent, ProgressBarCell } from '@vegaprotocol/ui-toolkit';
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Schema as Types } from '@vegaprotocol/types';
|
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';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { t } from '@vegaprotocol/react-helpers';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { themelite as theme } from '@vegaprotocol/tailwindcss-config';
|
import { themelite as theme } from '@vegaprotocol/tailwindcss-config';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import colors from 'tailwindcss/colors';
|
import colors from 'tailwindcss/colors';
|
||||||
import type { Market } from '@vegaprotocol/market-list';
|
import type { Market } from '@vegaprotocol/market-list';
|
||||||
import { IS_MARKET_TRADABLE } from '../../constants';
|
import { IS_MARKET_TRADABLE } from '../../constants';
|
||||||
|
@ -9,7 +9,7 @@ import {
|
|||||||
} from '@testing-library/react';
|
} from '@testing-library/react';
|
||||||
import { MockedProvider } from '@apollo/client/testing';
|
import { MockedProvider } from '@apollo/client/testing';
|
||||||
import { BrowserRouter } from 'react-router-dom';
|
import { BrowserRouter } from 'react-router-dom';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import type { Market } from '@vegaprotocol/market-list';
|
import type { Market } from '@vegaprotocol/market-list';
|
||||||
import SimpleMarketList from './simple-market-list';
|
import SimpleMarketList from './simple-market-list';
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ import SimpleMarketToolbar from './simple-market-toolbar';
|
|||||||
import { IS_MARKET_TRADABLE } from '../../constants';
|
import { IS_MARKET_TRADABLE } from '../../constants';
|
||||||
import { ConsoleLiteGrid } from '../console-lite-grid';
|
import { ConsoleLiteGrid } from '../console-lite-grid';
|
||||||
import type { Market } from '@vegaprotocol/market-list';
|
import type { Market } from '@vegaprotocol/market-list';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import { marketsWithCandlesProvider } from '@vegaprotocol/market-list';
|
import { marketsWithCandlesProvider } from '@vegaprotocol/market-list';
|
||||||
|
|
||||||
export type MarketWithPercentChange = Market & {
|
export type MarketWithPercentChange = Market & {
|
||||||
|
@ -4,7 +4,7 @@ import { InView } from 'react-intersection-observer';
|
|||||||
import { useDataProvider, useYesterday } from '@vegaprotocol/react-helpers';
|
import { useDataProvider, useYesterday } from '@vegaprotocol/react-helpers';
|
||||||
import type { Candle } from '@vegaprotocol/market-list';
|
import type { Candle } from '@vegaprotocol/market-list';
|
||||||
import { marketCandlesProvider } from '@vegaprotocol/market-list';
|
import { marketCandlesProvider } from '@vegaprotocol/market-list';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
candles: (Candle | null)[] | null;
|
candles: (Candle | null)[] | null;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { render, screen } from '@testing-library/react';
|
import { render, screen } from '@testing-library/react';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import MarketNameRenderer from './simple-market-renderer';
|
import MarketNameRenderer from './simple-market-renderer';
|
||||||
import type { Market } from '@vegaprotocol/market-list';
|
import type { Market } from '@vegaprotocol/market-list';
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import {
|
|||||||
getAllByText,
|
getAllByText,
|
||||||
} from '@testing-library/react';
|
} from '@testing-library/react';
|
||||||
import { MockedProvider } from '@apollo/react-testing';
|
import { MockedProvider } from '@apollo/react-testing';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import type { Market } from '@vegaprotocol/market-list';
|
import type { Market } from '@vegaprotocol/market-list';
|
||||||
import SimpleMarketToolbar from './simple-market-toolbar';
|
import SimpleMarketToolbar from './simple-market-toolbar';
|
||||||
import { markets as filterData } from './mocks/market-filters.json';
|
import { markets as filterData } from './mocks/market-filters.json';
|
||||||
|
@ -13,7 +13,7 @@ import {
|
|||||||
DropdownMenuItemIndicator,
|
DropdownMenuItemIndicator,
|
||||||
Icon,
|
Icon,
|
||||||
} from '@vegaprotocol/ui-toolkit';
|
} from '@vegaprotocol/ui-toolkit';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import type { Market } from '@vegaprotocol/market-list';
|
import type { Market } from '@vegaprotocol/market-list';
|
||||||
import { HorizontalMenu } from '../horizontal-menu';
|
import { HorizontalMenu } from '../horizontal-menu';
|
||||||
import type { HorizontalMenuItem } from '../horizontal-menu';
|
import type { HorizontalMenuItem } from '../horizontal-menu';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import type { MarketWithCandles } from '@vegaprotocol/market-list';
|
import type { MarketWithCandles } from '@vegaprotocol/market-list';
|
||||||
import type { RouterParams } from './simple-market-list';
|
import type { RouterParams } from './simple-market-list';
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Schema } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import { t } from '@vegaprotocol/react-helpers';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import type { Market } from '@vegaprotocol/market-list';
|
import type { Market } from '@vegaprotocol/market-list';
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Schema as Types } from '@vegaprotocol/types';
|
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';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Schema as Types } from '@vegaprotocol/types';
|
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';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Schema as Types } from '@vegaprotocol/types';
|
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';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Schema as Types } from '@vegaprotocol/types';
|
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';
|
||||||
|
@ -5,7 +5,7 @@ import { MemoryRouter } from 'react-router-dom';
|
|||||||
import AmendOrderDetails from './amend-order-details';
|
import AmendOrderDetails from './amend-order-details';
|
||||||
import { ExplorerDeterministicOrderDocument } from './__generated__/Order';
|
import { ExplorerDeterministicOrderDocument } from './__generated__/Order';
|
||||||
import { render } from '@testing-library/react';
|
import { render } from '@testing-library/react';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import { ExplorerMarketDocument } from '../links/market-link/__generated__/Market';
|
import { ExplorerMarketDocument } from '../links/market-link/__generated__/Market';
|
||||||
|
|
||||||
type Amend = components['schemas']['v1OrderAmendment'];
|
type Amend = components['schemas']['v1OrderAmendment'];
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { t } from '@vegaprotocol/react-helpers';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import type { Schema } from '@vegaprotocol/types';
|
import type * as Schema from '@vegaprotocol/types';
|
||||||
|
|
||||||
export interface DeterministicOrderDetailsProps {
|
export interface DeterministicOrderDetailsProps {
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Schema as Types } from '@vegaprotocol/types';
|
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';
|
||||||
|
75
apps/explorer/src/app/components/txs/details/__generated__/node-vote.ts
generated
Normal file
75
apps/explorer/src/app/components/txs/details/__generated__/node-vote.ts
generated
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
import * as Types from '@vegaprotocol/types';
|
||||||
|
|
||||||
|
import { gql } from '@apollo/client';
|
||||||
|
import * as Apollo from '@apollo/client';
|
||||||
|
const defaultOptions = {} as const;
|
||||||
|
export type ExplorerNodeVoteQueryVariables = Types.Exact<{
|
||||||
|
id: Types.Scalars['ID'];
|
||||||
|
}>;
|
||||||
|
|
||||||
|
|
||||||
|
export type ExplorerNodeVoteQuery = { __typename?: 'Query', withdrawal?: { __typename?: 'Withdrawal', id: string, status: Types.WithdrawalStatus, createdTimestamp: any, withdrawnTimestamp?: any | null, txHash?: string | null, asset: { __typename?: 'Asset', id: string, name: string, decimals: number }, party: { __typename?: 'Party', id: string } } | null, deposit?: { __typename?: 'Deposit', id: string, status: Types.DepositStatus, createdTimestamp: any, creditedTimestamp?: any | null, txHash?: string | null, asset: { __typename?: 'Asset', id: string, name: string, decimals: number }, party: { __typename?: 'Party', id: string } } | null };
|
||||||
|
|
||||||
|
|
||||||
|
export const ExplorerNodeVoteDocument = gql`
|
||||||
|
query ExplorerNodeVote($id: ID!) {
|
||||||
|
withdrawal(id: $id) {
|
||||||
|
id
|
||||||
|
status
|
||||||
|
createdTimestamp
|
||||||
|
withdrawnTimestamp
|
||||||
|
txHash
|
||||||
|
asset {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
decimals
|
||||||
|
}
|
||||||
|
party {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
deposit(id: $id) {
|
||||||
|
id
|
||||||
|
status
|
||||||
|
createdTimestamp
|
||||||
|
creditedTimestamp
|
||||||
|
txHash
|
||||||
|
asset {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
decimals
|
||||||
|
}
|
||||||
|
party {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* __useExplorerNodeVoteQuery__
|
||||||
|
*
|
||||||
|
* To run a query within a React component, call `useExplorerNodeVoteQuery` and pass it any options that fit your needs.
|
||||||
|
* When your component renders, `useExplorerNodeVoteQuery` 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 } = useExplorerNodeVoteQuery({
|
||||||
|
* variables: {
|
||||||
|
* id: // value for 'id'
|
||||||
|
* },
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
export function useExplorerNodeVoteQuery(baseOptions: Apollo.QueryHookOptions<ExplorerNodeVoteQuery, ExplorerNodeVoteQueryVariables>) {
|
||||||
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
|
return Apollo.useQuery<ExplorerNodeVoteQuery, ExplorerNodeVoteQueryVariables>(ExplorerNodeVoteDocument, options);
|
||||||
|
}
|
||||||
|
export function useExplorerNodeVoteLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<ExplorerNodeVoteQuery, ExplorerNodeVoteQueryVariables>) {
|
||||||
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
|
return Apollo.useLazyQuery<ExplorerNodeVoteQuery, ExplorerNodeVoteQueryVariables>(ExplorerNodeVoteDocument, options);
|
||||||
|
}
|
||||||
|
export type ExplorerNodeVoteQueryHookResult = ReturnType<typeof useExplorerNodeVoteQuery>;
|
||||||
|
export type ExplorerNodeVoteLazyQueryHookResult = ReturnType<typeof useExplorerNodeVoteLazyQuery>;
|
||||||
|
export type ExplorerNodeVoteQueryResult = Apollo.QueryResult<ExplorerNodeVoteQuery, ExplorerNodeVoteQueryVariables>;
|
@ -1,4 +1,4 @@
|
|||||||
import { Schema as Types } from '@vegaprotocol/types';
|
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';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Schema as Types } from '@vegaprotocol/types';
|
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';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Schema as Types } from '@vegaprotocol/types';
|
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';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Schema as Types } from '@vegaprotocol/types';
|
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';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Schema as Types } from '@vegaprotocol/types';
|
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';
|
||||||
|
@ -13,7 +13,7 @@ import { useTxsData } from '../../../hooks/use-txs-data';
|
|||||||
import { TxsInfiniteList } from '../../../components/txs';
|
import { TxsInfiniteList } from '../../../components/txs';
|
||||||
import { PageHeader } from '../../../components/page-header';
|
import { PageHeader } from '../../../components/page-header';
|
||||||
import { useExplorerPartyAssetsQuery } from './__generated__/party-assets';
|
import { useExplorerPartyAssetsQuery } from './__generated__/party-assets';
|
||||||
import type { Schema } from '@vegaprotocol/types';
|
import type * as Schema from '@vegaprotocol/types';
|
||||||
import get from 'lodash/get';
|
import get from 'lodash/get';
|
||||||
|
|
||||||
const accountTypeString: Record<Schema.AccountType, string> = {
|
const accountTypeString: Record<Schema.AccountType, string> = {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Schema as Types } from '@vegaprotocol/types';
|
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';
|
||||||
|
@ -11,7 +11,7 @@ import {
|
|||||||
t,
|
t,
|
||||||
toBigNum,
|
toBigNum,
|
||||||
} from '@vegaprotocol/react-helpers';
|
} from '@vegaprotocol/react-helpers';
|
||||||
import type { Schema } from '@vegaprotocol/types';
|
import type * as Schema from '@vegaprotocol/types';
|
||||||
import {
|
import {
|
||||||
AsyncRenderer,
|
AsyncRenderer,
|
||||||
Icon,
|
Icon,
|
||||||
|
@ -5,7 +5,7 @@ import {
|
|||||||
useDataProvider,
|
useDataProvider,
|
||||||
addDecimalsFormatNumber,
|
addDecimalsFormatNumber,
|
||||||
} from '@vegaprotocol/react-helpers';
|
} from '@vegaprotocol/react-helpers';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import {
|
import {
|
||||||
calcDayVolume,
|
calcDayVolume,
|
||||||
getChange,
|
getChange,
|
||||||
|
@ -3,7 +3,7 @@ import { t } from '@vegaprotocol/react-helpers';
|
|||||||
import { Icon } from '@vegaprotocol/ui-toolkit';
|
import { Icon } from '@vegaprotocol/ui-toolkit';
|
||||||
import { formatWithAsset } from '@vegaprotocol/liquidity';
|
import { formatWithAsset } from '@vegaprotocol/liquidity';
|
||||||
|
|
||||||
import type { Schema } from '@vegaprotocol/types';
|
import type * as Schema from '@vegaprotocol/types';
|
||||||
import { HealthBar } from '../../health-bar';
|
import { HealthBar } from '../../health-bar';
|
||||||
import { HealthDialog } from '../../health-dialog';
|
import { HealthDialog } from '../../health-dialog';
|
||||||
import { Last24hVolume } from '../last-24h-volume';
|
import { Last24hVolume } from '../last-24h-volume';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import type { Schema } from '@vegaprotocol/types';
|
import type * as Schema from '@vegaprotocol/types';
|
||||||
import { t, addDecimalsFormatNumber } from '@vegaprotocol/react-helpers';
|
import { t, addDecimalsFormatNumber } from '@vegaprotocol/react-helpers';
|
||||||
import { BigNumber } from 'bignumber.js';
|
import { BigNumber } from 'bignumber.js';
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { t } from '@vegaprotocol/react-helpers';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { Dialog } from '@vegaprotocol/ui-toolkit';
|
import { Dialog } from '@vegaprotocol/ui-toolkit';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
import { HealthBar } from '../health-bar';
|
import { HealthBar } from '../health-bar';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import type { Schema } from '@vegaprotocol/types';
|
import type * as Schema from '@vegaprotocol/types';
|
||||||
|
|
||||||
import { getColorForStatus } from '../../lib/utils';
|
import { getColorForStatus } from '../../lib/utils';
|
||||||
|
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
import { Lozenge, Tooltip } from '@vegaprotocol/ui-toolkit';
|
import { Lozenge, Tooltip } from '@vegaprotocol/ui-toolkit';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
import {
|
import * as Schema from '@vegaprotocol/types';
|
||||||
MarketTradingModeMapping,
|
|
||||||
AuctionTriggerMapping,
|
|
||||||
Schema,
|
|
||||||
} from '@vegaprotocol/types';
|
|
||||||
import { t } from '@vegaprotocol/react-helpers';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
|
|
||||||
import { Indicator } from '../indicator';
|
import { Indicator } from '../indicator';
|
||||||
@ -28,10 +24,10 @@ export const Status = ({
|
|||||||
trigger &&
|
trigger &&
|
||||||
trigger !== Schema.AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED
|
trigger !== Schema.AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED
|
||||||
) {
|
) {
|
||||||
return `${MarketTradingModeMapping[tradingMode]} - ${AuctionTriggerMapping[trigger]}`;
|
return `${Schema.MarketTradingModeMapping[tradingMode]} - ${Schema.AuctionTriggerMapping[trigger]}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return MarketTradingModeMapping[tradingMode];
|
return Schema.MarketTradingModeMapping[tradingMode];
|
||||||
};
|
};
|
||||||
|
|
||||||
const status = getStatus();
|
const status = getStatus();
|
||||||
@ -59,15 +55,15 @@ export const Status = ({
|
|||||||
const getTooltipDescription = (status: string) => {
|
const getTooltipDescription = (status: string) => {
|
||||||
let tooltipDescription = '';
|
let tooltipDescription = '';
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case MarketTradingModeMapping.TRADING_MODE_CONTINUOUS:
|
case Schema.MarketTradingModeMapping.TRADING_MODE_CONTINUOUS:
|
||||||
tooltipDescription =
|
tooltipDescription =
|
||||||
'This is the standard trading mode where trades are executed whenever orders are received';
|
'This is the standard trading mode where trades are executed whenever orders are received';
|
||||||
break;
|
break;
|
||||||
case `${MarketTradingModeMapping.TRADING_MODE_MONITORING_AUCTION} - ${AuctionTriggerMapping.AUCTION_TRIGGER_LIQUIDITY}`:
|
case `${Schema.MarketTradingModeMapping.TRADING_MODE_MONITORING_AUCTION} - ${Schema.AuctionTriggerMapping.AUCTION_TRIGGER_LIQUIDITY}`:
|
||||||
tooltipDescription =
|
tooltipDescription =
|
||||||
'This market is in auction until it reaches sufficient liquidity';
|
'This market is in auction until it reaches sufficient liquidity';
|
||||||
break;
|
break;
|
||||||
case MarketTradingModeMapping.TRADING_MODE_OPENING_AUCTION:
|
case Schema.MarketTradingModeMapping.TRADING_MODE_OPENING_AUCTION:
|
||||||
tooltipDescription =
|
tooltipDescription =
|
||||||
'This is a new market in an opening auction to determine a fair mid-price before starting continuous trading.';
|
'This is a new market in an opening auction to determine a fair mid-price before starting continuous trading.';
|
||||||
break;
|
break;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Schema } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
|
|
||||||
const marketTradingModeStyle = {
|
const marketTradingModeStyle = {
|
||||||
[Schema.MarketTradingMode.TRADING_MODE_CONTINUOUS]: '#00D46E',
|
[Schema.MarketTradingMode.TRADING_MODE_CONTINUOUS]: '#00D46E',
|
||||||
|
92
apps/token/src/components/vega-wallet/__generated__/Delegations.ts
generated
Normal file
92
apps/token/src/components/vega-wallet/__generated__/Delegations.ts
generated
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
import * as Types from '@vegaprotocol/types';
|
||||||
|
|
||||||
|
import { gql } from '@apollo/client';
|
||||||
|
import * as Apollo from '@apollo/client';
|
||||||
|
const defaultOptions = {} as const;
|
||||||
|
export type WalletDelegationFieldsFragment = { __typename?: 'Delegation', amount: string, epoch: number, node: { __typename?: 'Node', id: string, name: string } };
|
||||||
|
|
||||||
|
export type DelegationsQueryVariables = Types.Exact<{
|
||||||
|
partyId: Types.Scalars['ID'];
|
||||||
|
}>;
|
||||||
|
|
||||||
|
|
||||||
|
export type DelegationsQuery = { __typename?: 'Query', epoch: { __typename?: 'Epoch', id: string }, party?: { __typename?: 'Party', id: string, delegationsConnection?: { __typename?: 'DelegationsConnection', edges?: Array<{ __typename?: 'DelegationEdge', node: { __typename?: 'Delegation', amount: string, epoch: number, node: { __typename?: 'Node', id: string, name: string } } } | null> | null } | null, stakingSummary: { __typename?: 'StakingSummary', currentStakeAvailable: string }, accountsConnection?: { __typename?: 'AccountsConnection', edges?: Array<{ __typename?: 'AccountEdge', node: { __typename?: 'AccountBalance', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', name: string, id: string, decimals: number, symbol: string, source: { __typename: 'BuiltinAsset' } | { __typename: 'ERC20', contractAddress: string } } } } | null> | null } | null } | null };
|
||||||
|
|
||||||
|
export const WalletDelegationFieldsFragmentDoc = gql`
|
||||||
|
fragment WalletDelegationFields on Delegation {
|
||||||
|
amount
|
||||||
|
node {
|
||||||
|
id
|
||||||
|
name
|
||||||
|
}
|
||||||
|
epoch
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
export const DelegationsDocument = gql`
|
||||||
|
query Delegations($partyId: ID!) {
|
||||||
|
epoch {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
party(id: $partyId) {
|
||||||
|
id
|
||||||
|
delegationsConnection {
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
...WalletDelegationFields
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stakingSummary {
|
||||||
|
currentStakeAvailable
|
||||||
|
}
|
||||||
|
accountsConnection {
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
asset {
|
||||||
|
name
|
||||||
|
id
|
||||||
|
decimals
|
||||||
|
symbol
|
||||||
|
source {
|
||||||
|
__typename
|
||||||
|
... on ERC20 {
|
||||||
|
contractAddress
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
type
|
||||||
|
balance
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
${WalletDelegationFieldsFragmentDoc}`;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* __useDelegationsQuery__
|
||||||
|
*
|
||||||
|
* To run a query within a React component, call `useDelegationsQuery` and pass it any options that fit your needs.
|
||||||
|
* When your component renders, `useDelegationsQuery` 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 } = useDelegationsQuery({
|
||||||
|
* variables: {
|
||||||
|
* partyId: // value for 'partyId'
|
||||||
|
* },
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
export function useDelegationsQuery(baseOptions: Apollo.QueryHookOptions<DelegationsQuery, DelegationsQueryVariables>) {
|
||||||
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
|
return Apollo.useQuery<DelegationsQuery, DelegationsQueryVariables>(DelegationsDocument, options);
|
||||||
|
}
|
||||||
|
export function useDelegationsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<DelegationsQuery, DelegationsQueryVariables>) {
|
||||||
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
|
return Apollo.useLazyQuery<DelegationsQuery, DelegationsQueryVariables>(DelegationsDocument, options);
|
||||||
|
}
|
||||||
|
export type DelegationsQueryHookResult = ReturnType<typeof useDelegationsQuery>;
|
||||||
|
export type DelegationsLazyQueryHookResult = ReturnType<typeof useDelegationsLazyQuery>;
|
||||||
|
export type DelegationsQueryResult = Apollo.QueryResult<DelegationsQuery, DelegationsQueryVariables>;
|
@ -1,4 +1,4 @@
|
|||||||
import { Schema as Types } from '@vegaprotocol/types';
|
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';
|
||||||
|
@ -13,7 +13,7 @@ import { useVegaWallet } from '@vegaprotocol/wallet';
|
|||||||
import { useContracts } from '../../contexts/contracts/contracts-context';
|
import { useContracts } from '../../contexts/contracts/contracts-context';
|
||||||
import type { ERC20Asset } from '@vegaprotocol/assets';
|
import type { ERC20Asset } from '@vegaprotocol/assets';
|
||||||
import { isAssetTypeERC20 } from '@vegaprotocol/assets';
|
import { isAssetTypeERC20 } from '@vegaprotocol/assets';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import { removePaginationWrapper, toBigNum } from '@vegaprotocol/react-helpers';
|
import { removePaginationWrapper, toBigNum } from '@vegaprotocol/react-helpers';
|
||||||
import { useAppState } from '../../contexts/app-state/app-state-context';
|
import { useAppState } from '../../contexts/app-state/app-state-context';
|
||||||
import { addDecimal } from '@vegaprotocol/react-helpers';
|
import { addDecimal } from '@vegaprotocol/react-helpers';
|
||||||
|
@ -1,25 +1,25 @@
|
|||||||
import { ProposalState } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import type { Proposal_proposal } from '../../proposal/__generated__/Proposal';
|
import type { ProposalFieldsFragment } from '../../proposals/__generated__/Proposals';
|
||||||
|
import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
|
||||||
|
|
||||||
export const CurrentProposalState = ({
|
export const CurrentProposalState = ({
|
||||||
proposal,
|
proposal,
|
||||||
}: {
|
}: {
|
||||||
proposal: Proposal_proposal;
|
proposal: ProposalFieldsFragment | ProposalQuery['proposal'];
|
||||||
}) => {
|
}) => {
|
||||||
const { state } = proposal;
|
|
||||||
let className = 'text-white';
|
let className = 'text-white';
|
||||||
|
|
||||||
if (
|
if (
|
||||||
state === ProposalState.STATE_DECLINED ||
|
proposal?.state === Schema.ProposalState.STATE_DECLINED ||
|
||||||
state === ProposalState.STATE_FAILED ||
|
proposal?.state === Schema.ProposalState.STATE_FAILED ||
|
||||||
state === ProposalState.STATE_REJECTED
|
proposal?.state === Schema.ProposalState.STATE_REJECTED
|
||||||
) {
|
) {
|
||||||
className = 'text-danger';
|
className = 'text-danger';
|
||||||
} else if (
|
} else if (
|
||||||
state === ProposalState.STATE_ENACTED ||
|
proposal?.state === Schema.ProposalState.STATE_ENACTED ||
|
||||||
state === ProposalState.STATE_PASSED
|
proposal?.state === Schema.ProposalState.STATE_PASSED
|
||||||
) {
|
) {
|
||||||
className = 'text-white';
|
className = 'text-white';
|
||||||
}
|
}
|
||||||
return <span className={className}>{state}</span>;
|
return <span className={className}>{proposal?.state}</span>;
|
||||||
};
|
};
|
||||||
|
@ -7,7 +7,7 @@ import { NetworkParamsDocument } from '@vegaprotocol/react-helpers';
|
|||||||
import { AppStateProvider } from '../../../../contexts/app-state/app-state-provider';
|
import { AppStateProvider } from '../../../../contexts/app-state/app-state-provider';
|
||||||
import { generateProposal } from '../../test-helpers/generate-proposals';
|
import { generateProposal } from '../../test-helpers/generate-proposals';
|
||||||
import { CurrentProposalStatus } from './current-proposal-status';
|
import { CurrentProposalStatus } from './current-proposal-status';
|
||||||
import type { Proposal_proposal } from '../../proposal/__generated__/Proposal';
|
import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
|
||||||
|
|
||||||
const networkParamsQueryMock: MockedResponse<NetworkParamsQuery> = {
|
const networkParamsQueryMock: MockedResponse<NetworkParamsQuery> = {
|
||||||
request: {
|
request: {
|
||||||
@ -37,7 +37,11 @@ const networkParamsQueryMock: MockedResponse<NetworkParamsQuery> = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderComponent = ({ proposal }: { proposal: Proposal_proposal }) => {
|
const renderComponent = ({
|
||||||
|
proposal,
|
||||||
|
}: {
|
||||||
|
proposal: ProposalQuery['proposal'];
|
||||||
|
}) => {
|
||||||
render(
|
render(
|
||||||
<AppStateProvider>
|
<AppStateProvider>
|
||||||
<MockedProvider mocks={[networkParamsQueryMock]}>
|
<MockedProvider mocks={[networkParamsQueryMock]}>
|
||||||
@ -57,9 +61,7 @@ afterEach(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Proposal open - renders will fail state if the proposal will fail', async () => {
|
it('Proposal open - renders will fail state if the proposal will fail', async () => {
|
||||||
const proposal = generateProposal();
|
const failedProposal = generateProposal({
|
||||||
const failedProposal: Proposal_proposal = {
|
|
||||||
...proposal,
|
|
||||||
votes: {
|
votes: {
|
||||||
__typename: 'ProposalVotes',
|
__typename: 'ProposalVotes',
|
||||||
yes: {
|
yes: {
|
||||||
@ -77,7 +79,7 @@ it('Proposal open - renders will fail state if the proposal will fail', async ()
|
|||||||
totalEquityLikeShareWeight: '0',
|
totalEquityLikeShareWeight: '0',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
renderComponent({ proposal: failedProposal });
|
renderComponent({ proposal: failedProposal });
|
||||||
expect(await screen.findByText('Currently expected to')).toBeInTheDocument();
|
expect(await screen.findByText('Currently expected to')).toBeInTheDocument();
|
||||||
expect(await screen.findByText('fail.')).toBeInTheDocument();
|
expect(await screen.findByText('fail.')).toBeInTheDocument();
|
||||||
@ -92,43 +94,33 @@ it('Proposal open - renders will pass state if the proposal will pass', async ()
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Proposal enacted - renders vote passed and time since enactment', async () => {
|
it('Proposal enacted - renders vote passed and time since enactment', async () => {
|
||||||
const proposal = generateProposal();
|
const proposal = generateProposal({
|
||||||
|
state: ProposalState.STATE_ENACTED,
|
||||||
renderComponent({
|
terms: {
|
||||||
proposal: {
|
enactmentDatetime: new Date(0).toISOString(),
|
||||||
...proposal,
|
|
||||||
state: ProposalState.STATE_ENACTED,
|
|
||||||
terms: {
|
|
||||||
...proposal.terms,
|
|
||||||
enactmentDatetime: new Date(0).toISOString(),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
renderComponent({ proposal });
|
||||||
expect(await screen.findByText('Vote passed.')).toBeInTheDocument();
|
expect(await screen.findByText('Vote passed.')).toBeInTheDocument();
|
||||||
expect(await screen.findByText('about 1 hour ago')).toBeInTheDocument();
|
expect(await screen.findByText('about 1 hour ago')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Proposal passed - renders vote passed and time since vote closed', async () => {
|
it('Proposal passed - renders vote passed and time since vote closed', async () => {
|
||||||
const proposal = generateProposal();
|
const proposal = generateProposal({
|
||||||
|
state: ProposalState.STATE_PASSED,
|
||||||
renderComponent({
|
terms: {
|
||||||
proposal: {
|
closingDatetime: new Date(0).toISOString(),
|
||||||
...proposal,
|
|
||||||
state: ProposalState.STATE_PASSED,
|
|
||||||
terms: {
|
|
||||||
...proposal.terms,
|
|
||||||
closingDatetime: new Date(0).toISOString(),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
renderComponent({ proposal });
|
||||||
expect(await screen.findByText('Vote passed.')).toBeInTheDocument();
|
expect(await screen.findByText('Vote passed.')).toBeInTheDocument();
|
||||||
expect(await screen.findByText('about 1 hour ago')).toBeInTheDocument();
|
expect(await screen.findByText('about 1 hour ago')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Proposal waiting for node vote - will pass - renders if the vote will pass and status', async () => {
|
it('Proposal waiting for node vote - will pass - renders if the vote will pass and status', async () => {
|
||||||
const proposal = generateProposal();
|
const failedProposal = generateProposal({
|
||||||
const failedProposal: Proposal_proposal = {
|
|
||||||
...proposal,
|
|
||||||
state: ProposalState.STATE_WAITING_FOR_NODE_VOTE,
|
state: ProposalState.STATE_WAITING_FOR_NODE_VOTE,
|
||||||
votes: {
|
votes: {
|
||||||
__typename: 'ProposalVotes',
|
__typename: 'ProposalVotes',
|
||||||
@ -147,7 +139,7 @@ it('Proposal waiting for node vote - will pass - renders if the vote will pass
|
|||||||
totalEquityLikeShareWeight: '0',
|
totalEquityLikeShareWeight: '0',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
renderComponent({ proposal: failedProposal });
|
renderComponent({ proposal: failedProposal });
|
||||||
expect(
|
expect(
|
||||||
await screen.findByText('Waiting for nodes to validate asset.')
|
await screen.findByText('Waiting for nodes to validate asset.')
|
||||||
@ -157,14 +149,11 @@ it('Proposal waiting for node vote - will pass - renders if the vote will pass
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Proposal waiting for node vote - will fail - renders if the vote will pass and status', async () => {
|
it('Proposal waiting for node vote - will fail - renders if the vote will pass and status', async () => {
|
||||||
const proposal = generateProposal();
|
const proposal = generateProposal({
|
||||||
|
state: ProposalState.STATE_WAITING_FOR_NODE_VOTE,
|
||||||
renderComponent({
|
|
||||||
proposal: {
|
|
||||||
...proposal,
|
|
||||||
state: ProposalState.STATE_WAITING_FOR_NODE_VOTE,
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
renderComponent({ proposal });
|
||||||
expect(
|
expect(
|
||||||
await screen.findByText('Waiting for nodes to validate asset.')
|
await screen.findByText('Waiting for nodes to validate asset.')
|
||||||
).toBeInTheDocument();
|
).toBeInTheDocument();
|
||||||
@ -173,19 +162,15 @@ it('Proposal waiting for node vote - will fail - renders if the vote will pass a
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Proposal failed - renders vote failed reason and vote closed ago', async () => {
|
it('Proposal failed - renders vote failed reason and vote closed ago', async () => {
|
||||||
const proposal = generateProposal();
|
const proposal = generateProposal({
|
||||||
|
state: ProposalState.STATE_FAILED,
|
||||||
renderComponent({
|
errorDetails: 'foo',
|
||||||
proposal: {
|
terms: {
|
||||||
...proposal,
|
closingDatetime: new Date(0).toISOString(),
|
||||||
state: ProposalState.STATE_FAILED,
|
|
||||||
errorDetails: 'foo',
|
|
||||||
terms: {
|
|
||||||
...proposal.terms,
|
|
||||||
closingDatetime: new Date(0).toISOString(),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
renderComponent({ proposal });
|
||||||
expect(
|
expect(
|
||||||
await screen.findByText('Vote closed. Failed due to:')
|
await screen.findByText('Vote closed. Failed due to:')
|
||||||
).toBeInTheDocument();
|
).toBeInTheDocument();
|
||||||
@ -194,20 +179,15 @@ it('Proposal failed - renders vote failed reason and vote closed ago', async ()
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Proposal failed - renders rejection reason there are no error details', async () => {
|
it('Proposal failed - renders rejection reason there are no error details', async () => {
|
||||||
const proposal = generateProposal();
|
const proposal = generateProposal({
|
||||||
|
state: ProposalState.STATE_FAILED,
|
||||||
renderComponent({
|
rejectionReason: ProposalRejectionReason.PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE,
|
||||||
proposal: {
|
terms: {
|
||||||
...proposal,
|
closingDatetime: new Date(0).toISOString(),
|
||||||
state: ProposalState.STATE_FAILED,
|
|
||||||
rejectionReason:
|
|
||||||
ProposalRejectionReason.PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE,
|
|
||||||
terms: {
|
|
||||||
...proposal.terms,
|
|
||||||
closingDatetime: new Date(0).toISOString(),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
renderComponent({ proposal });
|
||||||
expect(
|
expect(
|
||||||
await screen.findByText('Vote closed. Failed due to:')
|
await screen.findByText('Vote closed. Failed due to:')
|
||||||
).toBeInTheDocument();
|
).toBeInTheDocument();
|
||||||
@ -218,18 +198,14 @@ it('Proposal failed - renders rejection reason there are no error details', asyn
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Proposal failed - renders unknown reason if there are no error details or rejection reason', async () => {
|
it('Proposal failed - renders unknown reason if there are no error details or rejection reason', async () => {
|
||||||
const proposal = generateProposal();
|
const proposal = generateProposal({
|
||||||
|
state: ProposalState.STATE_FAILED,
|
||||||
renderComponent({
|
terms: {
|
||||||
proposal: {
|
closingDatetime: new Date(0).toISOString(),
|
||||||
...proposal,
|
|
||||||
state: ProposalState.STATE_FAILED,
|
|
||||||
terms: {
|
|
||||||
...proposal.terms,
|
|
||||||
closingDatetime: new Date(0).toISOString(),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
renderComponent({ proposal });
|
||||||
expect(
|
expect(
|
||||||
await screen.findByText('Vote closed. Failed due to:')
|
await screen.findByText('Vote closed. Failed due to:')
|
||||||
).toBeInTheDocument();
|
).toBeInTheDocument();
|
||||||
@ -238,35 +214,31 @@ it('Proposal failed - renders unknown reason if there are no error details or re
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Proposal failed - renders participation not met if participation is not met', async () => {
|
it('Proposal failed - renders participation not met if participation is not met', async () => {
|
||||||
const proposal = generateProposal();
|
const proposal = generateProposal({
|
||||||
|
state: ProposalState.STATE_FAILED,
|
||||||
renderComponent({
|
terms: {
|
||||||
proposal: {
|
closingDatetime: new Date(0).toISOString(),
|
||||||
...proposal,
|
},
|
||||||
state: ProposalState.STATE_FAILED,
|
votes: {
|
||||||
terms: {
|
__typename: 'ProposalVotes',
|
||||||
...proposal.terms,
|
yes: {
|
||||||
closingDatetime: new Date(0).toISOString(),
|
__typename: 'ProposalVoteSide',
|
||||||
|
totalNumber: '0',
|
||||||
|
totalTokens: '0',
|
||||||
|
votes: null,
|
||||||
|
totalEquityLikeShareWeight: '0',
|
||||||
},
|
},
|
||||||
votes: {
|
no: {
|
||||||
__typename: 'ProposalVotes',
|
__typename: 'ProposalVoteSide',
|
||||||
yes: {
|
totalNumber: '0',
|
||||||
__typename: 'ProposalVoteSide',
|
totalTokens: '0',
|
||||||
totalNumber: '0',
|
votes: null,
|
||||||
totalTokens: '0',
|
totalEquityLikeShareWeight: '0',
|
||||||
votes: null,
|
|
||||||
totalEquityLikeShareWeight: '0',
|
|
||||||
},
|
|
||||||
no: {
|
|
||||||
__typename: 'ProposalVoteSide',
|
|
||||||
totalNumber: '0',
|
|
||||||
totalTokens: '0',
|
|
||||||
votes: null,
|
|
||||||
totalEquityLikeShareWeight: '0',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
renderComponent({ proposal });
|
||||||
expect(
|
expect(
|
||||||
await screen.findByText('Vote closed. Failed due to:')
|
await screen.findByText('Vote closed. Failed due to:')
|
||||||
).toBeInTheDocument();
|
).toBeInTheDocument();
|
||||||
@ -275,35 +247,31 @@ it('Proposal failed - renders participation not met if participation is not met'
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('Proposal failed - renders majority not met if majority is not met', async () => {
|
it('Proposal failed - renders majority not met if majority is not met', async () => {
|
||||||
const proposal = generateProposal();
|
const proposal = generateProposal({
|
||||||
|
state: ProposalState.STATE_FAILED,
|
||||||
renderComponent({
|
terms: {
|
||||||
proposal: {
|
closingDatetime: new Date(0).toISOString(),
|
||||||
...proposal,
|
},
|
||||||
state: ProposalState.STATE_FAILED,
|
votes: {
|
||||||
terms: {
|
__typename: 'ProposalVotes',
|
||||||
...proposal.terms,
|
yes: {
|
||||||
closingDatetime: new Date(0).toISOString(),
|
__typename: 'ProposalVoteSide',
|
||||||
|
totalNumber: '0',
|
||||||
|
totalTokens: '0',
|
||||||
|
votes: null,
|
||||||
|
totalEquityLikeShareWeight: '0',
|
||||||
},
|
},
|
||||||
votes: {
|
no: {
|
||||||
__typename: 'ProposalVotes',
|
__typename: 'ProposalVoteSide',
|
||||||
yes: {
|
totalNumber: '1',
|
||||||
__typename: 'ProposalVoteSide',
|
totalTokens: '25242474195500835440000',
|
||||||
totalNumber: '0',
|
votes: null,
|
||||||
totalTokens: '0',
|
totalEquityLikeShareWeight: '0',
|
||||||
votes: null,
|
|
||||||
totalEquityLikeShareWeight: '0',
|
|
||||||
},
|
|
||||||
no: {
|
|
||||||
__typename: 'ProposalVoteSide',
|
|
||||||
totalNumber: '1',
|
|
||||||
totalTokens: '25242474195500835440000',
|
|
||||||
votes: null,
|
|
||||||
totalEquityLikeShareWeight: '0',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
renderComponent({ proposal });
|
||||||
expect(
|
expect(
|
||||||
await screen.findByText('Vote closed. Failed due to:')
|
await screen.findByText('Vote closed. Failed due to:')
|
||||||
).toBeInTheDocument();
|
).toBeInTheDocument();
|
||||||
|
@ -4,7 +4,8 @@ import { useTranslation } from 'react-i18next';
|
|||||||
|
|
||||||
import { ProposalState } from '@vegaprotocol/types';
|
import { ProposalState } from '@vegaprotocol/types';
|
||||||
import { useVoteInformation } from '../../hooks';
|
import { useVoteInformation } from '../../hooks';
|
||||||
import type { Proposal_proposal } from '../../proposal/__generated__/Proposal';
|
import type { ProposalFieldsFragment } from '../../proposals/__generated__/Proposals';
|
||||||
|
import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
|
||||||
|
|
||||||
export const StatusPass = ({ children }: { children: ReactNode }) => (
|
export const StatusPass = ({ children }: { children: ReactNode }) => (
|
||||||
<span className="text-vega-green">{children}</span>
|
<span className="text-vega-green">{children}</span>
|
||||||
@ -44,7 +45,7 @@ const WillPass = ({
|
|||||||
export const CurrentProposalStatus = ({
|
export const CurrentProposalStatus = ({
|
||||||
proposal,
|
proposal,
|
||||||
}: {
|
}: {
|
||||||
proposal: Proposal_proposal;
|
proposal: ProposalFieldsFragment | ProposalQuery['proposal'];
|
||||||
}) => {
|
}) => {
|
||||||
const { willPassByTokenVote, majorityMet, participationMet } =
|
const { willPassByTokenVote, majorityMet, participationMet } =
|
||||||
useVoteInformation({
|
useVoteInformation({
|
||||||
@ -53,26 +54,26 @@ export const CurrentProposalStatus = ({
|
|||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const daysClosedAgo = formatDistanceToNow(
|
const daysClosedAgo = formatDistanceToNow(
|
||||||
new Date(proposal.terms.closingDatetime),
|
new Date(proposal?.terms.closingDatetime),
|
||||||
{ addSuffix: true }
|
{ addSuffix: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
const daysEnactedAgo =
|
const daysEnactedAgo =
|
||||||
proposal.terms.enactmentDatetime &&
|
proposal?.terms.enactmentDatetime &&
|
||||||
formatDistanceToNow(new Date(proposal.terms.enactmentDatetime), {
|
formatDistanceToNow(new Date(proposal.terms.enactmentDatetime), {
|
||||||
addSuffix: true,
|
addSuffix: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (proposal.state === ProposalState.STATE_OPEN) {
|
if (proposal?.state === ProposalState.STATE_OPEN) {
|
||||||
return (
|
return (
|
||||||
<WillPass willPass={willPassByTokenVote}>{t('currentlySetTo')}</WillPass>
|
<WillPass willPass={willPassByTokenVote}>{t('currentlySetTo')}</WillPass>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
proposal.state === ProposalState.STATE_FAILED ||
|
proposal?.state === ProposalState.STATE_FAILED ||
|
||||||
proposal.state === ProposalState.STATE_DECLINED ||
|
proposal?.state === ProposalState.STATE_DECLINED ||
|
||||||
proposal.state === ProposalState.STATE_REJECTED
|
proposal?.state === ProposalState.STATE_REJECTED
|
||||||
) {
|
) {
|
||||||
if (!participationMet) {
|
if (!participationMet) {
|
||||||
return (
|
return (
|
||||||
@ -98,8 +99,8 @@ export const CurrentProposalStatus = ({
|
|||||||
<>
|
<>
|
||||||
<span>{t('voteFailedReason')}</span>
|
<span>{t('voteFailedReason')}</span>
|
||||||
<StatusFail>
|
<StatusFail>
|
||||||
{proposal.errorDetails ||
|
{proposal?.errorDetails ||
|
||||||
proposal.rejectionReason ||
|
proposal?.rejectionReason ||
|
||||||
t('unknownReason')}
|
t('unknownReason')}
|
||||||
</StatusFail>
|
</StatusFail>
|
||||||
<span> {daysClosedAgo}</span>
|
<span> {daysClosedAgo}</span>
|
||||||
@ -107,21 +108,21 @@ export const CurrentProposalStatus = ({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
proposal.state === ProposalState.STATE_ENACTED ||
|
proposal?.state === ProposalState.STATE_ENACTED ||
|
||||||
proposal.state === ProposalState.STATE_PASSED
|
proposal?.state === ProposalState.STATE_PASSED
|
||||||
) {
|
) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<span>{t('votePassed')}</span>
|
<span>{t('votePassed')}</span>
|
||||||
<StatusPass>
|
<StatusPass>
|
||||||
|
|
||||||
{proposal.state === ProposalState.STATE_ENACTED
|
{proposal?.state === ProposalState.STATE_ENACTED
|
||||||
? t('Enacted')
|
? t('Enacted')
|
||||||
: t('Passed')}
|
: t('Passed')}
|
||||||
</StatusPass>
|
</StatusPass>
|
||||||
<span>
|
<span>
|
||||||
|
|
||||||
{proposal.state === ProposalState.STATE_ENACTED
|
{proposal?.state === ProposalState.STATE_ENACTED
|
||||||
? daysEnactedAgo
|
? daysEnactedAgo
|
||||||
: daysClosedAgo}
|
: daysClosedAgo}
|
||||||
</span>
|
</span>
|
||||||
@ -129,7 +130,7 @@ export const CurrentProposalStatus = ({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (proposal.state === ProposalState.STATE_WAITING_FOR_NODE_VOTE) {
|
if (proposal?.state === ProposalState.STATE_WAITING_FOR_NODE_VOTE) {
|
||||||
return (
|
return (
|
||||||
<WillPass willPass={willPassByTokenVote}>
|
<WillPass willPass={willPassByTokenVote}>
|
||||||
<span>{t('WaitingForNodeVote')}</span>{' '}
|
<span>{t('WaitingForNodeVote')}</span>{' '}
|
||||||
|
98
apps/token/src/routes/governance/components/list-asset/__generated__/Asset.ts
generated
Normal file
98
apps/token/src/routes/governance/components/list-asset/__generated__/Asset.ts
generated
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
import * as Types from '@vegaprotocol/types';
|
||||||
|
|
||||||
|
import { gql } from '@apollo/client';
|
||||||
|
import * as Apollo from '@apollo/client';
|
||||||
|
const defaultOptions = {} as const;
|
||||||
|
export type ProposalAssetQueryVariables = Types.Exact<{
|
||||||
|
assetId: Types.Scalars['ID'];
|
||||||
|
}>;
|
||||||
|
|
||||||
|
|
||||||
|
export type ProposalAssetQuery = { __typename?: 'Query', asset?: { __typename?: 'Asset', status: Types.AssetStatus, source: { __typename?: 'BuiltinAsset' } | { __typename?: 'ERC20', contractAddress: string } } | null };
|
||||||
|
|
||||||
|
export type AssetListBundleQueryVariables = Types.Exact<{
|
||||||
|
assetId: Types.Scalars['ID'];
|
||||||
|
}>;
|
||||||
|
|
||||||
|
|
||||||
|
export type AssetListBundleQuery = { __typename?: 'Query', erc20ListAssetBundle?: { __typename?: 'Erc20ListAssetBundle', assetSource: string, vegaAssetId: string, nonce: string, signatures: string } | null };
|
||||||
|
|
||||||
|
|
||||||
|
export const ProposalAssetDocument = gql`
|
||||||
|
query ProposalAsset($assetId: ID!) {
|
||||||
|
asset(id: $assetId) {
|
||||||
|
status
|
||||||
|
source {
|
||||||
|
... on ERC20 {
|
||||||
|
contractAddress
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* __useProposalAssetQuery__
|
||||||
|
*
|
||||||
|
* To run a query within a React component, call `useProposalAssetQuery` and pass it any options that fit your needs.
|
||||||
|
* When your component renders, `useProposalAssetQuery` 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 } = useProposalAssetQuery({
|
||||||
|
* variables: {
|
||||||
|
* assetId: // value for 'assetId'
|
||||||
|
* },
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
export function useProposalAssetQuery(baseOptions: Apollo.QueryHookOptions<ProposalAssetQuery, ProposalAssetQueryVariables>) {
|
||||||
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
|
return Apollo.useQuery<ProposalAssetQuery, ProposalAssetQueryVariables>(ProposalAssetDocument, options);
|
||||||
|
}
|
||||||
|
export function useProposalAssetLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<ProposalAssetQuery, ProposalAssetQueryVariables>) {
|
||||||
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
|
return Apollo.useLazyQuery<ProposalAssetQuery, ProposalAssetQueryVariables>(ProposalAssetDocument, options);
|
||||||
|
}
|
||||||
|
export type ProposalAssetQueryHookResult = ReturnType<typeof useProposalAssetQuery>;
|
||||||
|
export type ProposalAssetLazyQueryHookResult = ReturnType<typeof useProposalAssetLazyQuery>;
|
||||||
|
export type ProposalAssetQueryResult = Apollo.QueryResult<ProposalAssetQuery, ProposalAssetQueryVariables>;
|
||||||
|
export const AssetListBundleDocument = gql`
|
||||||
|
query AssetListBundle($assetId: ID!) {
|
||||||
|
erc20ListAssetBundle(assetId: $assetId) {
|
||||||
|
assetSource
|
||||||
|
vegaAssetId
|
||||||
|
nonce
|
||||||
|
signatures
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* __useAssetListBundleQuery__
|
||||||
|
*
|
||||||
|
* To run a query within a React component, call `useAssetListBundleQuery` and pass it any options that fit your needs.
|
||||||
|
* When your component renders, `useAssetListBundleQuery` 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 } = useAssetListBundleQuery({
|
||||||
|
* variables: {
|
||||||
|
* assetId: // value for 'assetId'
|
||||||
|
* },
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
export function useAssetListBundleQuery(baseOptions: Apollo.QueryHookOptions<AssetListBundleQuery, AssetListBundleQueryVariables>) {
|
||||||
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
|
return Apollo.useQuery<AssetListBundleQuery, AssetListBundleQueryVariables>(AssetListBundleDocument, options);
|
||||||
|
}
|
||||||
|
export function useAssetListBundleLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<AssetListBundleQuery, AssetListBundleQueryVariables>) {
|
||||||
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
|
return Apollo.useLazyQuery<AssetListBundleQuery, AssetListBundleQueryVariables>(AssetListBundleDocument, options);
|
||||||
|
}
|
||||||
|
export type AssetListBundleQueryHookResult = ReturnType<typeof useAssetListBundleQuery>;
|
||||||
|
export type AssetListBundleLazyQueryHookResult = ReturnType<typeof useAssetListBundleLazyQuery>;
|
||||||
|
export type AssetListBundleQueryResult = Apollo.QueryResult<AssetListBundleQuery, AssetListBundleQueryVariables>;
|
@ -1,4 +1,4 @@
|
|||||||
import { Schema as Types } from '@vegaprotocol/types';
|
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';
|
||||||
|
@ -8,7 +8,7 @@ import type {
|
|||||||
} from './__generated___/Asset';
|
} from './__generated___/Asset';
|
||||||
import { AssetListBundleDocument } from './__generated___/Asset';
|
import { AssetListBundleDocument } from './__generated___/Asset';
|
||||||
import { ProposalAssetDocument } from './__generated___/Asset';
|
import { ProposalAssetDocument } from './__generated___/Asset';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import type { useWeb3React } from '@web3-react/core';
|
import type { useWeb3React } from '@web3-react/core';
|
||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
import type { AppState } from '../../../../contexts/app-state/app-state-context';
|
import type { AppState } from '../../../../contexts/app-state/app-state-context';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import type { CollateralBridge } from '@vegaprotocol/smart-contracts';
|
import type { CollateralBridge } from '@vegaprotocol/smart-contracts';
|
||||||
import { Schema } from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import { Button } from '@vegaprotocol/ui-toolkit';
|
import { Button } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useBridgeContract, useEthereumTransaction } from '@vegaprotocol/web3';
|
import { useBridgeContract, useEthereumTransaction } from '@vegaprotocol/web3';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
@ -16,7 +16,7 @@ it('Renders all data for table', () => {
|
|||||||
const proposal = generateProposal();
|
const proposal = generateProposal();
|
||||||
render(<ProposalChangeTable proposal={proposal} />);
|
render(<ProposalChangeTable proposal={proposal} />);
|
||||||
expect(screen.getByText('ID')).toBeInTheDocument();
|
expect(screen.getByText('ID')).toBeInTheDocument();
|
||||||
expect(screen.getByText(proposal.id as string)).toBeInTheDocument();
|
expect(screen.getByText(proposal?.id as string)).toBeInTheDocument();
|
||||||
|
|
||||||
expect(screen.getByText('State')).toBeInTheDocument();
|
expect(screen.getByText('State')).toBeInTheDocument();
|
||||||
expect(screen.getByText('STATE_OPEN')).toBeInTheDocument();
|
expect(screen.getByText('STATE_OPEN')).toBeInTheDocument();
|
||||||
@ -24,7 +24,7 @@ it('Renders all data for table', () => {
|
|||||||
expect(screen.getByText('Closes on')).toBeInTheDocument();
|
expect(screen.getByText('Closes on')).toBeInTheDocument();
|
||||||
expect(
|
expect(
|
||||||
screen.getByText(
|
screen.getByText(
|
||||||
format(new Date(proposal.terms.closingDatetime), DATE_FORMAT_DETAILED)
|
format(new Date(proposal?.terms.closingDatetime), DATE_FORMAT_DETAILED)
|
||||||
)
|
)
|
||||||
).toBeInTheDocument();
|
).toBeInTheDocument();
|
||||||
|
|
||||||
@ -32,23 +32,23 @@ it('Renders all data for table', () => {
|
|||||||
expect(
|
expect(
|
||||||
screen.getByText(
|
screen.getByText(
|
||||||
format(
|
format(
|
||||||
new Date(proposal.terms.enactmentDatetime || 0),
|
new Date(proposal?.terms.enactmentDatetime || 0),
|
||||||
DATE_FORMAT_DETAILED
|
DATE_FORMAT_DETAILED
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
).toBeInTheDocument();
|
).toBeInTheDocument();
|
||||||
|
|
||||||
expect(screen.getByText('Proposed by')).toBeInTheDocument();
|
expect(screen.getByText('Proposed by')).toBeInTheDocument();
|
||||||
expect(screen.getByText(proposal.party.id)).toBeInTheDocument();
|
expect(screen.getByText(proposal?.party.id ?? '')).toBeInTheDocument();
|
||||||
|
|
||||||
expect(screen.getByText('Proposed on')).toBeInTheDocument();
|
expect(screen.getByText('Proposed on')).toBeInTheDocument();
|
||||||
expect(
|
expect(
|
||||||
screen.getByText(format(new Date(proposal.datetime), DATE_FORMAT_DETAILED))
|
screen.getByText(format(new Date(proposal?.datetime), DATE_FORMAT_DETAILED))
|
||||||
).toBeInTheDocument();
|
).toBeInTheDocument();
|
||||||
|
|
||||||
expect(screen.getByText('Type')).toBeInTheDocument();
|
expect(screen.getByText('Type')).toBeInTheDocument();
|
||||||
expect(
|
expect(
|
||||||
screen.getByText(proposal.terms.change.__typename)
|
screen.getByText(proposal?.terms.change.__typename ?? '')
|
||||||
).toBeInTheDocument();
|
).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ it('Changes data based on if data is in future or past', () => {
|
|||||||
expect(screen.getByText('Closed on')).toBeInTheDocument();
|
expect(screen.getByText('Closed on')).toBeInTheDocument();
|
||||||
expect(
|
expect(
|
||||||
screen.getByText(
|
screen.getByText(
|
||||||
format(new Date(proposal.terms.closingDatetime), DATE_FORMAT_DETAILED)
|
format(new Date(proposal?.terms.closingDatetime), DATE_FORMAT_DETAILED)
|
||||||
)
|
)
|
||||||
).toBeInTheDocument();
|
).toBeInTheDocument();
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ it('Changes data based on if data is in future or past', () => {
|
|||||||
expect(
|
expect(
|
||||||
screen.getByText(
|
screen.getByText(
|
||||||
format(
|
format(
|
||||||
new Date(proposal.terms.enactmentDatetime || 0),
|
new Date(proposal?.terms.enactmentDatetime || 0),
|
||||||
DATE_FORMAT_DETAILED
|
DATE_FORMAT_DETAILED
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -94,7 +94,7 @@ it('Does not render enactment time for freeform proposal', () => {
|
|||||||
expect(
|
expect(
|
||||||
screen.queryByText(
|
screen.queryByText(
|
||||||
format(
|
format(
|
||||||
new Date(proposal.terms.enactmentDatetime || 0),
|
new Date(proposal?.terms.enactmentDatetime || 0),
|
||||||
DATE_FORMAT_DETAILED
|
DATE_FORMAT_DETAILED
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -4,56 +4,60 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { KeyValueTable, KeyValueTableRow } from '@vegaprotocol/ui-toolkit';
|
import { KeyValueTable, KeyValueTableRow } from '@vegaprotocol/ui-toolkit';
|
||||||
import { DATE_FORMAT_DETAILED } from '../../../../lib/date-formats';
|
import { DATE_FORMAT_DETAILED } from '../../../../lib/date-formats';
|
||||||
import { CurrentProposalState } from '../current-proposal-state';
|
import { CurrentProposalState } from '../current-proposal-state';
|
||||||
import type { Proposal_proposal } from '../../proposal/__generated__/Proposal';
|
import type { ProposalFieldsFragment } from '../../proposals/__generated__/Proposals';
|
||||||
|
import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
|
||||||
|
|
||||||
interface ProposalChangeTableProps {
|
interface ProposalChangeTableProps {
|
||||||
proposal: Proposal_proposal;
|
proposal: ProposalFieldsFragment | ProposalQuery['proposal'];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ProposalChangeTable = ({ proposal }: ProposalChangeTableProps) => {
|
export const ProposalChangeTable = ({ proposal }: ProposalChangeTableProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const terms = proposal.terms;
|
const terms = proposal?.terms;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<KeyValueTable data-testid="proposal-change-table">
|
<KeyValueTable data-testid="proposal-change-table">
|
||||||
<KeyValueTableRow>
|
<KeyValueTableRow>
|
||||||
{t('id')}
|
{t('id')}
|
||||||
{proposal.id}
|
{proposal?.id}
|
||||||
</KeyValueTableRow>
|
</KeyValueTableRow>
|
||||||
<KeyValueTableRow>
|
<KeyValueTableRow>
|
||||||
{t('state')}
|
{t('state')}
|
||||||
<CurrentProposalState proposal={proposal} />
|
<CurrentProposalState proposal={proposal} />
|
||||||
</KeyValueTableRow>
|
</KeyValueTableRow>
|
||||||
<KeyValueTableRow>
|
<KeyValueTableRow>
|
||||||
{isFuture(new Date(terms.closingDatetime))
|
{isFuture(new Date(terms?.closingDatetime))
|
||||||
? t('closesOn')
|
? t('closesOn')
|
||||||
: t('closedOn')}
|
: t('closedOn')}
|
||||||
{format(new Date(terms.closingDatetime), DATE_FORMAT_DETAILED)}
|
{format(new Date(terms?.closingDatetime), DATE_FORMAT_DETAILED)}
|
||||||
</KeyValueTableRow>
|
</KeyValueTableRow>
|
||||||
{terms.change.__typename !== 'NewFreeform' ? (
|
{terms?.change.__typename !== 'NewFreeform' ? (
|
||||||
<KeyValueTableRow>
|
<KeyValueTableRow>
|
||||||
{isFuture(new Date(terms.enactmentDatetime || 0))
|
{isFuture(new Date(terms?.enactmentDatetime || 0))
|
||||||
? t('proposedEnactment')
|
? t('proposedEnactment')
|
||||||
: t('enactedOn')}
|
: t('enactedOn')}
|
||||||
{format(new Date(terms.enactmentDatetime || 0), DATE_FORMAT_DETAILED)}
|
{format(
|
||||||
|
new Date(terms?.enactmentDatetime || 0),
|
||||||
|
DATE_FORMAT_DETAILED
|
||||||
|
)}
|
||||||
</KeyValueTableRow>
|
</KeyValueTableRow>
|
||||||
) : null}
|
) : null}
|
||||||
<KeyValueTableRow>
|
<KeyValueTableRow>
|
||||||
{t('proposedBy')}
|
{t('proposedBy')}
|
||||||
<span style={{ wordBreak: 'break-word' }}>{proposal.party.id}</span>
|
<span style={{ wordBreak: 'break-word' }}>{proposal?.party.id}</span>
|
||||||
</KeyValueTableRow>
|
</KeyValueTableRow>
|
||||||
<KeyValueTableRow>
|
<KeyValueTableRow>
|
||||||
{t('proposedOn')}
|
{t('proposedOn')}
|
||||||
{format(new Date(proposal.datetime), DATE_FORMAT_DETAILED)}
|
{format(new Date(proposal?.datetime), DATE_FORMAT_DETAILED)}
|
||||||
</KeyValueTableRow>
|
</KeyValueTableRow>
|
||||||
{proposal.rejectionReason ? (
|
{proposal?.rejectionReason ? (
|
||||||
<KeyValueTableRow>
|
<KeyValueTableRow>
|
||||||
{t('rejectionReason')}
|
{t('rejectionReason')}
|
||||||
{proposal.rejectionReason}
|
{proposal.rejectionReason}
|
||||||
</KeyValueTableRow>
|
</KeyValueTableRow>
|
||||||
) : null}
|
) : null}
|
||||||
{proposal.errorDetails ? (
|
{proposal?.errorDetails ? (
|
||||||
<KeyValueTableRow>
|
<KeyValueTableRow>
|
||||||
{t('errorDetails')}
|
{t('errorDetails')}
|
||||||
{proposal.errorDetails}
|
{proposal.errorDetails}
|
||||||
@ -61,7 +65,7 @@ export const ProposalChangeTable = ({ proposal }: ProposalChangeTableProps) => {
|
|||||||
) : null}
|
) : null}
|
||||||
<KeyValueTableRow>
|
<KeyValueTableRow>
|
||||||
{t('type')}
|
{t('type')}
|
||||||
{proposal.terms.change.__typename}
|
{proposal?.terms.change.__typename}
|
||||||
</KeyValueTableRow>
|
</KeyValueTableRow>
|
||||||
</KeyValueTable>
|
</KeyValueTable>
|
||||||
);
|
);
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { render, screen } from '@testing-library/react';
|
import { render, screen } from '@testing-library/react';
|
||||||
import { generateProposal } from '../../test-helpers/generate-proposals';
|
import { generateProposal } from '../../test-helpers/generate-proposals';
|
||||||
import { ProposalHeader } from './proposal-header';
|
import { ProposalHeader } from './proposal-header';
|
||||||
import type { Proposal_proposal } from '../../proposal/__generated__/Proposal';
|
import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
|
||||||
|
|
||||||
const renderComponent = (proposal: Proposal_proposal) => (
|
const renderComponent = (proposal: ProposalQuery['proposal']) => (
|
||||||
<ProposalHeader proposal={proposal} />
|
<ProposalHeader proposal={proposal} />
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -2,28 +2,29 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { Lozenge } from '@vegaprotocol/ui-toolkit';
|
import { Lozenge } from '@vegaprotocol/ui-toolkit';
|
||||||
import type { ReactNode } from 'react';
|
import type { ReactNode } from 'react';
|
||||||
import { shorten } from '@vegaprotocol/react-helpers';
|
import { shorten } from '@vegaprotocol/react-helpers';
|
||||||
import type { Proposal_proposal } from '../../proposal/__generated__/Proposal';
|
import type { ProposalFieldsFragment } from '../../proposals/__generated__/Proposals';
|
||||||
|
import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
|
||||||
|
|
||||||
export const ProposalHeader = ({
|
export const ProposalHeader = ({
|
||||||
proposal,
|
proposal,
|
||||||
}: {
|
}: {
|
||||||
proposal: Proposal_proposal;
|
proposal: ProposalFieldsFragment | ProposalQuery['proposal'];
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { change } = proposal.terms;
|
const change = proposal?.terms.change;
|
||||||
|
|
||||||
let details: ReactNode;
|
let details: ReactNode;
|
||||||
|
|
||||||
let title = proposal.rationale.title.trim();
|
let title = proposal?.rationale.title.trim();
|
||||||
let description = proposal.rationale.description.trim();
|
let description = proposal?.rationale.description.trim();
|
||||||
if (title.length === 0 && description.length > 0) {
|
if (title?.length === 0 && description && description.length > 0) {
|
||||||
title = description;
|
title = description;
|
||||||
description = '';
|
description = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
const titleContent = shorten(title, 100);
|
const titleContent = shorten(title ?? '', 100);
|
||||||
|
|
||||||
switch (change.__typename) {
|
switch (change?.__typename) {
|
||||||
case 'NewMarket': {
|
case 'NewMarket': {
|
||||||
details = (
|
details = (
|
||||||
<>
|
<>
|
||||||
@ -51,11 +52,12 @@ export const ProposalHeader = ({
|
|||||||
<>
|
<>
|
||||||
{t('Symbol')}: {change.symbol}.{' '}
|
{t('Symbol')}: {change.symbol}.{' '}
|
||||||
<Lozenge>
|
<Lozenge>
|
||||||
{change.source.__typename === 'ERC20'
|
{change.source.__typename === 'ERC20' &&
|
||||||
? `ERC20 ${change.source.contractAddress}`
|
`ERC20 ${change.source.contractAddress}`}
|
||||||
: `${t('Max faucet amount mint')}: ${
|
{change.source.__typename === 'BuiltinAsset' &&
|
||||||
change.source.maxFaucetAmountMint
|
`${t('Max faucet amount mint')}: ${
|
||||||
}`}
|
change.source.maxFaucetAmountMint
|
||||||
|
}`}
|
||||||
</Lozenge>
|
</Lozenge>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@ -77,7 +79,7 @@ export const ProposalHeader = ({
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'NewFreeform': {
|
case 'NewFreeform': {
|
||||||
details = `${t('FreeformProposal')}: ${proposal.id}`;
|
details = `${t('FreeformProposal')}: ${proposal?.id}`;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'UpdateAsset': {
|
case 'UpdateAsset': {
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { SyntaxHighlighter } from '@vegaprotocol/ui-toolkit';
|
import { SyntaxHighlighter } from '@vegaprotocol/ui-toolkit';
|
||||||
import type { Proposal_proposal_terms } from '../../proposal/__generated__/Proposal';
|
import type { PartialDeep } from 'type-fest';
|
||||||
|
import type * as Schema from '@vegaprotocol/types';
|
||||||
|
|
||||||
export const ProposalTermsJson = ({
|
export const ProposalTermsJson = ({
|
||||||
terms,
|
terms,
|
||||||
}: {
|
}: {
|
||||||
terms: Proposal_proposal_terms;
|
terms: PartialDeep<Schema.ProposalTerms>;
|
||||||
}) => {
|
}) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
return (
|
return (
|
||||||
|
@ -10,11 +10,12 @@ import {
|
|||||||
} from '@vegaprotocol/react-helpers';
|
} from '@vegaprotocol/react-helpers';
|
||||||
import { useVoteInformation } from '../../hooks';
|
import { useVoteInformation } from '../../hooks';
|
||||||
import { useAppState } from '../../../../contexts/app-state/app-state-context';
|
import { useAppState } from '../../../../contexts/app-state/app-state-context';
|
||||||
import type { Proposal_proposal } from '../../proposal/__generated__/Proposal';
|
import type { ProposalFieldsFragment } from '../../proposals/__generated__/Proposals';
|
||||||
|
import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
|
||||||
import { ProposalType } from '../proposal/proposal';
|
import { ProposalType } from '../proposal/proposal';
|
||||||
|
|
||||||
interface ProposalVotesTableProps {
|
interface ProposalVotesTableProps {
|
||||||
proposal: Proposal_proposal;
|
proposal: ProposalFieldsFragment | ProposalQuery['proposal'];
|
||||||
proposalType: ProposalType | null;
|
proposalType: ProposalType | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { render, screen } from '@testing-library/react';
|
import { render, screen } from '@testing-library/react';
|
||||||
import { generateProposal } from '../../test-helpers/generate-proposals';
|
import { generateProposal } from '../../test-helpers/generate-proposals';
|
||||||
import { Proposal } from './proposal';
|
import { Proposal } from './proposal';
|
||||||
import type { Proposal_proposal } from '../../proposal/__generated__/Proposal';
|
import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
|
||||||
|
|
||||||
jest.mock('@vegaprotocol/react-helpers', () => ({
|
jest.mock('@vegaprotocol/react-helpers', () => ({
|
||||||
...jest.requireActual('@vegaprotocol/react-helpers'),
|
...jest.requireActual('@vegaprotocol/react-helpers'),
|
||||||
@ -40,13 +40,13 @@ jest.mock('../list-asset', () => ({
|
|||||||
|
|
||||||
it('Renders with data-testid', async () => {
|
it('Renders with data-testid', async () => {
|
||||||
const proposal = generateProposal();
|
const proposal = generateProposal();
|
||||||
render(<Proposal proposal={proposal as Proposal_proposal} />);
|
render(<Proposal proposal={proposal as ProposalQuery['proposal']} />);
|
||||||
expect(await screen.findByTestId('proposal')).toBeInTheDocument();
|
expect(await screen.findByTestId('proposal')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('renders each section', async () => {
|
it('renders each section', async () => {
|
||||||
const proposal = generateProposal();
|
const proposal = generateProposal();
|
||||||
render(<Proposal proposal={proposal as Proposal_proposal} />);
|
render(<Proposal proposal={proposal as ProposalQuery['proposal']} />);
|
||||||
expect(await screen.findByTestId('proposal-header')).toBeInTheDocument();
|
expect(await screen.findByTestId('proposal-header')).toBeInTheDocument();
|
||||||
expect(screen.getByTestId('proposal-change-table')).toBeInTheDocument();
|
expect(screen.getByTestId('proposal-change-table')).toBeInTheDocument();
|
||||||
expect(screen.getByTestId('proposal-terms-json')).toBeInTheDocument();
|
expect(screen.getByTestId('proposal-terms-json')).toBeInTheDocument();
|
||||||
@ -72,6 +72,6 @@ it('renders whitelist section if proposal is new asset and source is erc20', asy
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
render(<Proposal proposal={proposal as Proposal_proposal} />);
|
render(<Proposal proposal={proposal as ProposalQuery['proposal']} />);
|
||||||
expect(screen.getByTestId('proposal-list-asset')).toBeInTheDocument();
|
expect(screen.getByTestId('proposal-list-asset')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { NetworkParams, useNetworkParams } from '@vegaprotocol/react-helpers';
|
import { NetworkParams, useNetworkParams } from '@vegaprotocol/react-helpers';
|
||||||
import { AsyncRenderer } from '@vegaprotocol/ui-toolkit';
|
import { AsyncRenderer } from '@vegaprotocol/ui-toolkit';
|
||||||
import { ProposalHeader } from '../proposal-detail-header/proposal-header';
|
import { ProposalHeader } from '../proposal-detail-header/proposal-header';
|
||||||
import type { Proposal_proposal } from '../../proposal/__generated__/Proposal';
|
import type { ProposalFieldsFragment } from '../../proposals/__generated__/Proposals';
|
||||||
|
import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
|
||||||
import { ProposalChangeTable } from '../proposal-change-table';
|
import { ProposalChangeTable } from '../proposal-change-table';
|
||||||
import { ProposalTermsJson } from '../proposal-terms-json';
|
import { ProposalTermsJson } from '../proposal-terms-json';
|
||||||
import { ProposalVotesTable } from '../proposal-votes-table';
|
import { ProposalVotesTable } from '../proposal-votes-table';
|
||||||
@ -17,7 +18,7 @@ export enum ProposalType {
|
|||||||
PROPOSAL_FREEFORM = 'PROPOSAL_FREEFORM',
|
PROPOSAL_FREEFORM = 'PROPOSAL_FREEFORM',
|
||||||
}
|
}
|
||||||
interface ProposalProps {
|
interface ProposalProps {
|
||||||
proposal: Proposal_proposal;
|
proposal: ProposalFieldsFragment | ProposalQuery['proposal'];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Proposal = ({ proposal }: ProposalProps) => {
|
export const Proposal = ({ proposal }: ProposalProps) => {
|
||||||
|
@ -26,10 +26,10 @@ import {
|
|||||||
lastWeek,
|
lastWeek,
|
||||||
nextWeek,
|
nextWeek,
|
||||||
} from '../../test-helpers/mocks';
|
} from '../../test-helpers/mocks';
|
||||||
import type { Proposal_proposal } from '../../proposal/__generated__/Proposal';
|
import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
|
||||||
|
|
||||||
const renderComponent = (
|
const renderComponent = (
|
||||||
proposal: Proposal_proposal,
|
proposal: ProposalQuery['proposal'],
|
||||||
mock = networkParamsQueryMock
|
mock = networkParamsQueryMock
|
||||||
) =>
|
) =>
|
||||||
render(
|
render(
|
||||||
|
@ -15,7 +15,8 @@ import {
|
|||||||
ProposalState,
|
ProposalState,
|
||||||
} from '@vegaprotocol/types';
|
} from '@vegaprotocol/types';
|
||||||
import Routes from '../../../routes';
|
import Routes from '../../../routes';
|
||||||
import type { Proposal_proposal } from '../../proposal/__generated__/Proposal';
|
import type { ProposalFieldsFragment } from '../../proposals/__generated__/Proposals';
|
||||||
|
import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
|
||||||
|
|
||||||
const MajorityNotReached = () => {
|
const MajorityNotReached = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@ -37,18 +38,18 @@ const ParticipationNotReached = () => {
|
|||||||
export const ProposalsListItemDetails = ({
|
export const ProposalsListItemDetails = ({
|
||||||
proposal,
|
proposal,
|
||||||
}: {
|
}: {
|
||||||
proposal: Proposal_proposal;
|
proposal: ProposalFieldsFragment | ProposalQuery['proposal'];
|
||||||
}) => {
|
}) => {
|
||||||
const { state } = proposal;
|
const state = proposal?.state;
|
||||||
const { willPassByTokenVote, majorityMet, participationMet } =
|
const { willPassByTokenVote, majorityMet, participationMet } =
|
||||||
useVoteInformation({
|
useVoteInformation({
|
||||||
proposal,
|
proposal,
|
||||||
});
|
});
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { voteState } = useUserVote(
|
const { voteState } = useUserVote(
|
||||||
proposal.id,
|
proposal?.id ?? '',
|
||||||
proposal.votes.yes.votes,
|
proposal?.votes.yes.votes ?? null,
|
||||||
proposal.votes.no.votes
|
proposal?.votes.no.votes ?? null
|
||||||
);
|
);
|
||||||
|
|
||||||
let proposalStatus: ReactNode;
|
let proposalStatus: ReactNode;
|
||||||
@ -62,10 +63,10 @@ export const ProposalsListItemDetails = ({
|
|||||||
{t('voteState_Enacted')} <Icon name={'tick'} />
|
{t('voteState_Enacted')} <Icon name={'tick'} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
voteDetails = proposal.terms.enactmentDatetime && (
|
voteDetails = proposal?.terms.enactmentDatetime && (
|
||||||
<>
|
<>
|
||||||
{format(
|
{format(
|
||||||
new Date(proposal.terms.enactmentDatetime),
|
new Date(proposal?.terms.enactmentDatetime),
|
||||||
DATE_FORMAT_DETAILED
|
DATE_FORMAT_DETAILED
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
@ -78,10 +79,10 @@ export const ProposalsListItemDetails = ({
|
|||||||
{t('voteState_Passed')} <Icon name={'tick'} />
|
{t('voteState_Passed')} <Icon name={'tick'} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
voteDetails = proposal.terms.change.__typename !== 'NewFreeform' && (
|
voteDetails = proposal?.terms.change.__typename !== 'NewFreeform' && (
|
||||||
<>
|
<>
|
||||||
{t('toEnactOn')}{' '}
|
{t('toEnactOn')}{' '}
|
||||||
{proposal.terms.enactmentDatetime &&
|
{proposal?.terms.enactmentDatetime &&
|
||||||
format(
|
format(
|
||||||
new Date(proposal.terms.enactmentDatetime),
|
new Date(proposal.terms.enactmentDatetime),
|
||||||
DATE_FORMAT_DETAILED
|
DATE_FORMAT_DETAILED
|
||||||
@ -96,10 +97,10 @@ export const ProposalsListItemDetails = ({
|
|||||||
{t('voteState_WaitingForNodeVote')} <Icon name={'time'} />
|
{t('voteState_WaitingForNodeVote')} <Icon name={'time'} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
voteDetails = proposal.terms.change.__typename !== 'NewFreeform' && (
|
voteDetails = proposal?.terms.change.__typename !== 'NewFreeform' && (
|
||||||
<>
|
<>
|
||||||
{t('toEnactOn')}{' '}
|
{t('toEnactOn')}{' '}
|
||||||
{proposal.terms.enactmentDatetime &&
|
{proposal?.terms.enactmentDatetime &&
|
||||||
format(
|
format(
|
||||||
new Date(proposal.terms.enactmentDatetime),
|
new Date(proposal.terms.enactmentDatetime),
|
||||||
DATE_FORMAT_DETAILED
|
DATE_FORMAT_DETAILED
|
||||||
@ -126,7 +127,7 @@ export const ProposalsListItemDetails = ({
|
|||||||
)) || (
|
)) || (
|
||||||
<>
|
<>
|
||||||
{formatDistanceToNowStrict(
|
{formatDistanceToNowStrict(
|
||||||
new Date(proposal.terms.closingDatetime)
|
new Date(proposal?.terms.closingDatetime)
|
||||||
)}{' '}
|
)}{' '}
|
||||||
{t('left to vote')}
|
{t('left to vote')}
|
||||||
</>
|
</>
|
||||||
@ -163,7 +164,7 @@ export const ProposalsListItemDetails = ({
|
|||||||
<Icon name={'warning-sign'} />
|
<Icon name={'warning-sign'} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
voteStatus = proposal.rejectionReason && (
|
voteStatus = proposal?.rejectionReason && (
|
||||||
<>{t(ProposalRejectionReasonMapping[proposal.rejectionReason])}</>
|
<>{t(ProposalRejectionReasonMapping[proposal.rejectionReason])}</>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@ -194,7 +195,7 @@ export const ProposalsListItemDetails = ({
|
|||||||
{voteStatus}
|
{voteStatus}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
{proposal.id && (
|
{proposal?.id && (
|
||||||
<div className="col-start-2 row-start-2 justify-self-end">
|
<div className="col-start-2 row-start-2 justify-self-end">
|
||||||
<Link to={`${Routes.PROPOSALS}/${proposal.id}`}>
|
<Link to={`${Routes.PROPOSALS}/${proposal.id}`}>
|
||||||
<Button data-testid="view-proposal-btn" size="sm">
|
<Button data-testid="view-proposal-btn" size="sm">
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
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 type { Proposal_proposal } from '../../proposal/__generated__/Proposal';
|
import type { ProposalFieldsFragment } from '../../proposals/__generated__/Proposals';
|
||||||
|
import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
|
||||||
|
|
||||||
interface ProposalsListItemProps {
|
interface ProposalsListItemProps {
|
||||||
proposal: Proposal_proposal;
|
proposal?: ProposalFieldsFragment | ProposalQuery['proposal'] | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ProposalsListItem = ({ proposal }: ProposalsListItemProps) => {
|
export const ProposalsListItem = ({ proposal }: ProposalsListItemProps) => {
|
||||||
|
@ -14,7 +14,7 @@ import {
|
|||||||
lastMonth,
|
lastMonth,
|
||||||
nextMonth,
|
nextMonth,
|
||||||
} from '../../test-helpers/mocks';
|
} from '../../test-helpers/mocks';
|
||||||
import type { Proposal_proposal } from '../../proposal/__generated__/Proposal';
|
import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
|
||||||
|
|
||||||
const openProposalClosesNextMonth = generateProposal({
|
const openProposalClosesNextMonth = generateProposal({
|
||||||
id: 'proposal1',
|
id: 'proposal1',
|
||||||
@ -58,7 +58,7 @@ const failedProposalClosedLastMonth = generateProposal({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const renderComponent = (proposals: Proposal_proposal[]) => (
|
const renderComponent = (proposals: ProposalQuery['proposal'][]) => (
|
||||||
<Router>
|
<Router>
|
||||||
<MockedProvider mocks={[networkParamsQueryMock]}>
|
<MockedProvider mocks={[networkParamsQueryMock]}>
|
||||||
<AppStateProvider>
|
<AppStateProvider>
|
||||||
|
@ -7,17 +7,18 @@ import { ProposalsListFilter } from '../proposals-list-filter';
|
|||||||
import Routes from '../../../routes';
|
import Routes from '../../../routes';
|
||||||
import { Button } from '@vegaprotocol/ui-toolkit';
|
import { Button } from '@vegaprotocol/ui-toolkit';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import type { Proposal_proposal } from '../../proposal/__generated__/Proposal';
|
import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
|
||||||
|
import type { ProposalFieldsFragment } from '../../proposals/__generated__/Proposals';
|
||||||
import { ExternalLinks } from '@vegaprotocol/react-helpers';
|
import { ExternalLinks } from '@vegaprotocol/react-helpers';
|
||||||
import { ExternalLink } from '@vegaprotocol/ui-toolkit';
|
import { ExternalLink } from '@vegaprotocol/ui-toolkit';
|
||||||
|
|
||||||
interface ProposalsListProps {
|
interface ProposalsListProps {
|
||||||
proposals: Proposal_proposal[];
|
proposals: Array<ProposalFieldsFragment | ProposalQuery['proposal']>;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface SortedProposalsProps {
|
interface SortedProposalsProps {
|
||||||
open: Proposal_proposal[];
|
open: Array<ProposalFieldsFragment | ProposalQuery['proposal']>;
|
||||||
closed: Proposal_proposal[];
|
closed: Array<ProposalFieldsFragment | ProposalQuery['proposal']>;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ProposalsList = ({ proposals }: ProposalsListProps) => {
|
export const ProposalsList = ({ proposals }: ProposalsListProps) => {
|
||||||
@ -26,7 +27,7 @@ export const ProposalsList = ({ proposals }: ProposalsListProps) => {
|
|||||||
|
|
||||||
const sortedProposals = proposals.reduce(
|
const sortedProposals = proposals.reduce(
|
||||||
(acc: SortedProposalsProps, proposal) => {
|
(acc: SortedProposalsProps, proposal) => {
|
||||||
if (isFuture(new Date(proposal.terms.closingDatetime))) {
|
if (isFuture(new Date(proposal?.terms.closingDatetime))) {
|
||||||
acc.open.push(proposal);
|
acc.open.push(proposal);
|
||||||
} else {
|
} else {
|
||||||
acc.closed.push(proposal);
|
acc.closed.push(proposal);
|
||||||
@ -39,9 +40,11 @@ export const ProposalsList = ({ proposals }: ProposalsListProps) => {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
const filterPredicate = (p: Proposal_proposal) =>
|
const filterPredicate = (
|
||||||
p.id?.includes(filterString) ||
|
p: ProposalFieldsFragment | ProposalQuery['proposal']
|
||||||
p.party?.id?.toString().includes(filterString);
|
) =>
|
||||||
|
p?.id?.includes(filterString) ||
|
||||||
|
p?.party?.id?.toString().includes(filterString);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -83,7 +86,7 @@ export const ProposalsList = ({ proposals }: ProposalsListProps) => {
|
|||||||
{sortedProposals.open.length > 0 ? (
|
{sortedProposals.open.length > 0 ? (
|
||||||
<ul data-testid="open-proposals">
|
<ul data-testid="open-proposals">
|
||||||
{sortedProposals.open.filter(filterPredicate).map((proposal) => (
|
{sortedProposals.open.filter(filterPredicate).map((proposal) => (
|
||||||
<ProposalsListItem key={proposal.id} proposal={proposal} />
|
<ProposalsListItem key={proposal?.id} proposal={proposal} />
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
) : (
|
) : (
|
||||||
@ -97,7 +100,7 @@ export const ProposalsList = ({ proposals }: ProposalsListProps) => {
|
|||||||
{sortedProposals.closed.length > 0 ? (
|
{sortedProposals.closed.length > 0 ? (
|
||||||
<ul data-testid="closed-proposals">
|
<ul data-testid="closed-proposals">
|
||||||
{sortedProposals.closed.filter(filterPredicate).map((proposal) => (
|
{sortedProposals.closed.filter(filterPredicate).map((proposal) => (
|
||||||
<ProposalsListItem key={proposal.id} proposal={proposal} />
|
<ProposalsListItem key={proposal?.id} proposal={proposal} />
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
) : (
|
) : (
|
||||||
|
@ -12,7 +12,7 @@ import {
|
|||||||
nextWeek,
|
nextWeek,
|
||||||
lastMonth,
|
lastMonth,
|
||||||
} from '../../test-helpers/mocks';
|
} from '../../test-helpers/mocks';
|
||||||
import type { Proposal_proposal } from '../../proposal/__generated__/Proposal';
|
import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
|
||||||
|
|
||||||
const rejectedProposalClosesNextWeek = generateProposal({
|
const rejectedProposalClosesNextWeek = generateProposal({
|
||||||
id: 'rejected1',
|
id: 'rejected1',
|
||||||
@ -35,7 +35,7 @@ const rejectedProposalClosedLastMonth = generateProposal({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const renderComponent = (proposals: Proposal_proposal[]) => (
|
const renderComponent = (proposals: ProposalQuery['proposal'][]) => (
|
||||||
<Router>
|
<Router>
|
||||||
<MockedProvider mocks={[networkParamsQueryMock]}>
|
<MockedProvider mocks={[networkParamsQueryMock]}>
|
||||||
<AppStateProvider>
|
<AppStateProvider>
|
||||||
|
@ -3,19 +3,22 @@ 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 { Proposal_proposal } from '../../proposal/__generated__/Proposal';
|
import type { ProposalFieldsFragment } from '../../proposals/__generated__/Proposals';
|
||||||
|
import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
|
||||||
|
|
||||||
interface ProposalsListProps {
|
interface ProposalsListProps {
|
||||||
proposals: Proposal_proposal[];
|
proposals: Array<ProposalQuery['proposal'] | ProposalFieldsFragment>;
|
||||||
}
|
}
|
||||||
|
|
||||||
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 = (p: Proposal_proposal) =>
|
const filterPredicate = (
|
||||||
p.id?.includes(filterString) ||
|
p: ProposalFieldsFragment | ProposalQuery['proposal']
|
||||||
p.party?.id?.toString().includes(filterString);
|
) =>
|
||||||
|
p?.id?.includes(filterString) ||
|
||||||
|
p?.party?.id?.toString().includes(filterString);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
@ -25,7 +28,7 @@ export const RejectedProposalsList = ({ proposals }: ProposalsListProps) => {
|
|||||||
{proposals.length > 0 ? (
|
{proposals.length > 0 ? (
|
||||||
<ul data-testid="rejected-proposals">
|
<ul data-testid="rejected-proposals">
|
||||||
{proposals.filter(filterPredicate).map((proposal) => (
|
{proposals.filter(filterPredicate).map((proposal) => (
|
||||||
<ProposalsListItem key={proposal.id} proposal={proposal} />
|
<ProposalsListItem key={proposal?.id} proposal={proposal} />
|
||||||
))}
|
))}
|
||||||
</ul>
|
</ul>
|
||||||
) : (
|
) : (
|
||||||
|
51
apps/token/src/routes/governance/components/vote-details/__generated__/Stake.ts
generated
Normal file
51
apps/token/src/routes/governance/components/vote-details/__generated__/Stake.ts
generated
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
import * as Types from '@vegaprotocol/types';
|
||||||
|
|
||||||
|
import { gql } from '@apollo/client';
|
||||||
|
import * as Apollo from '@apollo/client';
|
||||||
|
const defaultOptions = {} as const;
|
||||||
|
export type VoteButtonsQueryVariables = Types.Exact<{
|
||||||
|
partyId: Types.Scalars['ID'];
|
||||||
|
}>;
|
||||||
|
|
||||||
|
|
||||||
|
export type VoteButtonsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, stakingSummary: { __typename?: 'StakingSummary', currentStakeAvailable: string } } | null };
|
||||||
|
|
||||||
|
|
||||||
|
export const VoteButtonsDocument = gql`
|
||||||
|
query VoteButtons($partyId: ID!) {
|
||||||
|
party(id: $partyId) {
|
||||||
|
id
|
||||||
|
stakingSummary {
|
||||||
|
currentStakeAvailable
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* __useVoteButtonsQuery__
|
||||||
|
*
|
||||||
|
* To run a query within a React component, call `useVoteButtonsQuery` and pass it any options that fit your needs.
|
||||||
|
* When your component renders, `useVoteButtonsQuery` 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 } = useVoteButtonsQuery({
|
||||||
|
* variables: {
|
||||||
|
* partyId: // value for 'partyId'
|
||||||
|
* },
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
export function useVoteButtonsQuery(baseOptions: Apollo.QueryHookOptions<VoteButtonsQuery, VoteButtonsQueryVariables>) {
|
||||||
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
|
return Apollo.useQuery<VoteButtonsQuery, VoteButtonsQueryVariables>(VoteButtonsDocument, options);
|
||||||
|
}
|
||||||
|
export function useVoteButtonsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<VoteButtonsQuery, VoteButtonsQueryVariables>) {
|
||||||
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
|
return Apollo.useLazyQuery<VoteButtonsQuery, VoteButtonsQueryVariables>(VoteButtonsDocument, options);
|
||||||
|
}
|
||||||
|
export type VoteButtonsQueryHookResult = ReturnType<typeof useVoteButtonsQuery>;
|
||||||
|
export type VoteButtonsLazyQueryHookResult = ReturnType<typeof useVoteButtonsLazyQuery>;
|
||||||
|
export type VoteButtonsQueryResult = Apollo.QueryResult<VoteButtonsQuery, VoteButtonsQueryVariables>;
|
@ -1,4 +1,4 @@
|
|||||||
import { Schema as Types } from '@vegaprotocol/types';
|
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';
|
||||||
|
@ -10,10 +10,11 @@ import { useUserVote } from './use-user-vote';
|
|||||||
import { CurrentProposalStatus } from '../current-proposal-status';
|
import { CurrentProposalStatus } from '../current-proposal-status';
|
||||||
import { VoteButtonsContainer } from './vote-buttons';
|
import { VoteButtonsContainer } from './vote-buttons';
|
||||||
import { ProposalType } from '../proposal/proposal';
|
import { ProposalType } from '../proposal/proposal';
|
||||||
import type { Proposal_proposal } from '../../proposal/__generated__/Proposal';
|
import type { ProposalFieldsFragment } from '../../proposals/__generated__/Proposals';
|
||||||
|
import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
|
||||||
|
|
||||||
interface VoteDetailsProps {
|
interface VoteDetailsProps {
|
||||||
proposal: Proposal_proposal;
|
proposal: ProposalFieldsFragment | ProposalQuery['proposal'];
|
||||||
minVoterBalance: string | null;
|
minVoterBalance: string | null;
|
||||||
spamProtectionMinTokens: string | null;
|
spamProtectionMinTokens: string | null;
|
||||||
proposalType: ProposalType | null;
|
proposalType: ProposalType | null;
|
||||||
@ -43,13 +44,13 @@ export const VoteDetails = ({
|
|||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { voteState, voteDatetime } = useUserVote(
|
const { voteState, voteDatetime } = useUserVote(
|
||||||
proposal.id,
|
proposal?.id ?? '',
|
||||||
proposal.votes.yes.votes,
|
proposal?.votes.yes.votes ?? null,
|
||||||
proposal.votes.no.votes
|
proposal?.votes.no.votes ?? null
|
||||||
);
|
);
|
||||||
const defaultDecimals = 2;
|
const defaultDecimals = 2;
|
||||||
const daysLeft = t('daysLeft', {
|
const daysLeft = t('daysLeft', {
|
||||||
daysLeft: formatDistanceToNow(new Date(proposal.terms.closingDatetime)),
|
daysLeft: formatDistanceToNow(new Date(proposal?.terms.closingDatetime)),
|
||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -62,7 +63,7 @@ export const VoteDetails = ({
|
|||||||
<CurrentProposalStatus proposal={proposal} />
|
<CurrentProposalStatus proposal={proposal} />
|
||||||
</span>
|
</span>
|
||||||
{'. '}
|
{'. '}
|
||||||
{proposal.state === ProposalState.STATE_OPEN ? daysLeft : null}
|
{proposal?.state === ProposalState.STATE_OPEN ? daysLeft : null}
|
||||||
</p>
|
</p>
|
||||||
<table className="w-full mb-8">
|
<table className="w-full mb-8">
|
||||||
<thead>
|
<thead>
|
||||||
@ -111,7 +112,7 @@ export const VoteDetails = ({
|
|||||||
<CurrentProposalStatus proposal={proposal} />
|
<CurrentProposalStatus proposal={proposal} />
|
||||||
</span>
|
</span>
|
||||||
{'. '}
|
{'. '}
|
||||||
{proposal.state === ProposalState.STATE_OPEN ? daysLeft : null}
|
{proposal?.state === ProposalState.STATE_OPEN ? daysLeft : null}
|
||||||
</p>
|
</p>
|
||||||
<table className="w-full mb-4">
|
<table className="w-full mb-4">
|
||||||
<thead>
|
<thead>
|
||||||
@ -181,15 +182,17 @@ export const VoteDetails = ({
|
|||||||
{pubKey ? (
|
{pubKey ? (
|
||||||
<>
|
<>
|
||||||
<h3 className="text-xl mb-2">{t('yourVote')}</h3>
|
<h3 className="text-xl mb-2">{t('yourVote')}</h3>
|
||||||
<VoteButtonsContainer
|
{proposal && (
|
||||||
voteState={voteState}
|
<VoteButtonsContainer
|
||||||
voteDatetime={voteDatetime}
|
voteState={voteState}
|
||||||
proposalState={proposal.state}
|
voteDatetime={voteDatetime}
|
||||||
proposalId={proposal.id}
|
proposalState={proposal.state}
|
||||||
minVoterBalance={minVoterBalance}
|
proposalId={proposal.id ?? ''}
|
||||||
spamProtectionMinTokens={spamProtectionMinTokens}
|
minVoterBalance={minVoterBalance}
|
||||||
className="flex"
|
spamProtectionMinTokens={spamProtectionMinTokens}
|
||||||
/>
|
className="flex"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<ConnectToVega />
|
<ConnectToVega />
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
import { NetworkParams, useNetworkParams } from '@vegaprotocol/react-helpers';
|
import { NetworkParams, useNetworkParams } from '@vegaprotocol/react-helpers';
|
||||||
import { BigNumber } from '../../../lib/bignumber';
|
import { BigNumber } from '../../../lib/bignumber';
|
||||||
import type { Proposal_proposal } from '../proposal/__generated__/Proposal';
|
import type { ProposalFieldsFragment } from '../proposals/__generated__/Proposals';
|
||||||
|
import type { ProposalQuery } from '../proposal/__generated__/Proposal';
|
||||||
|
|
||||||
export const useProposalNetworkParams = ({
|
export const useProposalNetworkParams = ({
|
||||||
proposal,
|
proposal,
|
||||||
}: {
|
}: {
|
||||||
proposal: Proposal_proposal;
|
proposal: ProposalFieldsFragment | ProposalQuery['proposal'];
|
||||||
}) => {
|
}) => {
|
||||||
const { params } = useNetworkParams([
|
const { params } = useNetworkParams([
|
||||||
NetworkParams.governance_proposal_updateMarket_requiredMajority,
|
NetworkParams.governance_proposal_updateMarket_requiredMajority,
|
||||||
@ -33,7 +34,7 @@ export const useProposalNetworkParams = ({
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (proposal.terms.change.__typename) {
|
switch (proposal?.terms.change.__typename) {
|
||||||
case 'UpdateMarket':
|
case 'UpdateMarket':
|
||||||
return {
|
return {
|
||||||
requiredMajority:
|
requiredMajority:
|
||||||
|
@ -2,13 +2,14 @@ import { useMemo } from 'react';
|
|||||||
import { useAppState } from '../../../contexts/app-state/app-state-context';
|
import { useAppState } from '../../../contexts/app-state/app-state-context';
|
||||||
import { BigNumber } from '../../../lib/bignumber';
|
import { BigNumber } from '../../../lib/bignumber';
|
||||||
import { useProposalNetworkParams } from './use-proposal-network-params';
|
import { useProposalNetworkParams } from './use-proposal-network-params';
|
||||||
import type { Proposal_proposal } from '../proposal/__generated__/Proposal';
|
import type { ProposalFieldsFragment } from '../proposals/__generated__/Proposals';
|
||||||
|
import type { ProposalQuery } from '../proposal/__generated__/Proposal';
|
||||||
import { addDecimal } from '@vegaprotocol/react-helpers';
|
import { addDecimal } from '@vegaprotocol/react-helpers';
|
||||||
|
|
||||||
export const useVoteInformation = ({
|
export const useVoteInformation = ({
|
||||||
proposal,
|
proposal,
|
||||||
}: {
|
}: {
|
||||||
proposal: Proposal_proposal;
|
proposal: ProposalFieldsFragment | ProposalQuery['proposal'];
|
||||||
}) => {
|
}) => {
|
||||||
const {
|
const {
|
||||||
appState: { totalSupply, decimals },
|
appState: { totalSupply, decimals },
|
||||||
@ -54,19 +55,19 @@ export const useVoteInformation = ({
|
|||||||
: new BigNumber(100);
|
: new BigNumber(100);
|
||||||
|
|
||||||
const noTokens = new BigNumber(
|
const noTokens = new BigNumber(
|
||||||
addDecimal(proposal.votes.no.totalTokens, decimals)
|
addDecimal(proposal?.votes.no.totalTokens ?? 0, decimals)
|
||||||
);
|
);
|
||||||
|
|
||||||
const noEquityLikeShareWeight = !proposal.votes.no
|
const noEquityLikeShareWeight = !proposal?.votes.no
|
||||||
.totalEquityLikeShareWeight
|
.totalEquityLikeShareWeight
|
||||||
? new BigNumber(0)
|
? new BigNumber(0)
|
||||||
: new BigNumber(proposal.votes.no.totalEquityLikeShareWeight);
|
: new BigNumber(proposal.votes.no.totalEquityLikeShareWeight);
|
||||||
|
|
||||||
const yesTokens = new BigNumber(
|
const yesTokens = new BigNumber(
|
||||||
addDecimal(proposal.votes.yes.totalTokens, decimals)
|
addDecimal(proposal?.votes.yes.totalTokens ?? 0, decimals)
|
||||||
);
|
);
|
||||||
|
|
||||||
const yesEquityLikeShareWeight = !proposal.votes.yes
|
const yesEquityLikeShareWeight = !proposal?.votes.yes
|
||||||
.totalEquityLikeShareWeight
|
.totalEquityLikeShareWeight
|
||||||
? new BigNumber(0)
|
? new BigNumber(0)
|
||||||
: new BigNumber(proposal.votes.yes.totalEquityLikeShareWeight);
|
: new BigNumber(proposal.votes.yes.totalEquityLikeShareWeight);
|
||||||
@ -159,10 +160,10 @@ export const useVoteInformation = ({
|
|||||||
};
|
};
|
||||||
}, [
|
}, [
|
||||||
decimals,
|
decimals,
|
||||||
proposal.votes.no.totalEquityLikeShareWeight,
|
proposal?.votes.no.totalEquityLikeShareWeight,
|
||||||
proposal.votes.no.totalTokens,
|
proposal?.votes.no.totalTokens,
|
||||||
proposal.votes.yes.totalEquityLikeShareWeight,
|
proposal?.votes.yes.totalEquityLikeShareWeight,
|
||||||
proposal.votes.yes.totalTokens,
|
proposal?.votes.yes.totalTokens,
|
||||||
requiredMajority,
|
requiredMajority,
|
||||||
requiredMajorityLP,
|
requiredMajorityLP,
|
||||||
requiredParticipation,
|
requiredParticipation,
|
||||||
@ -187,10 +188,10 @@ export const useVoteInformation = ({
|
|||||||
noEquityLikeShareWeight,
|
noEquityLikeShareWeight,
|
||||||
yesTokens,
|
yesTokens,
|
||||||
yesEquityLikeShareWeight,
|
yesEquityLikeShareWeight,
|
||||||
yesVotes: new BigNumber(proposal.votes.yes.totalNumber),
|
yesVotes: new BigNumber(proposal?.votes.yes.totalNumber ?? 0),
|
||||||
noVotes: new BigNumber(proposal.votes.no.totalNumber),
|
noVotes: new BigNumber(proposal?.votes.no.totalNumber ?? 0),
|
||||||
totalVotes: new BigNumber(proposal.votes.yes.totalNumber).plus(
|
totalVotes: new BigNumber(proposal?.votes.yes.totalNumber ?? 0).plus(
|
||||||
proposal.votes.no.totalNumber
|
proposal?.votes.no.totalNumber ?? 0
|
||||||
),
|
),
|
||||||
requiredMajorityPercentage,
|
requiredMajorityPercentage,
|
||||||
requiredMajorityLPPercentage,
|
requiredMajorityLPPercentage,
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,9 +1,10 @@
|
|||||||
import { render, screen, waitFor } from '@testing-library/react';
|
import { render, screen, waitFor } from '@testing-library/react';
|
||||||
import { generateProposal } from '../test-helpers/generate-proposals';
|
import { generateProposal } from '../test-helpers/generate-proposals';
|
||||||
import type { Proposal_proposal } from './__generated__/Proposal';
|
import type { ProposalQuery } from './__generated__/Proposal';
|
||||||
import { ProposalContainer, PROPOSAL_QUERY } from './proposal-container';
|
import { ProposalContainer } from './proposal-container';
|
||||||
import { MockedProvider } from '@apollo/client/testing';
|
import { MockedProvider } from '@apollo/client/testing';
|
||||||
import { MemoryRouter, Route, Routes } from 'react-router-dom';
|
import { MemoryRouter, Route, Routes } from 'react-router-dom';
|
||||||
|
import { ProposalDocument } from './__generated__/Proposal';
|
||||||
|
|
||||||
jest.mock('../components/proposal', () => ({
|
jest.mock('../components/proposal', () => ({
|
||||||
Proposal: () => <div data-testid="proposal" />,
|
Proposal: () => <div data-testid="proposal" />,
|
||||||
@ -13,14 +14,17 @@ jest.mock('../components/proposal-not-found', () => ({
|
|||||||
ProposalNotFound: () => <div data-testid="proposal-not-found" />,
|
ProposalNotFound: () => <div data-testid="proposal-not-found" />,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const renderComponent = (proposal: Proposal_proposal | null, id: string) => {
|
const renderComponent = (
|
||||||
|
proposal: ProposalQuery['proposal'] | null,
|
||||||
|
id: string
|
||||||
|
) => {
|
||||||
return (
|
return (
|
||||||
<MemoryRouter initialEntries={[`/governance/${id}`]}>
|
<MemoryRouter initialEntries={[`/governance/${id}`]}>
|
||||||
<MockedProvider
|
<MockedProvider
|
||||||
mocks={[
|
mocks={[
|
||||||
{
|
{
|
||||||
request: {
|
request: {
|
||||||
query: PROPOSAL_QUERY,
|
query: ProposalDocument,
|
||||||
variables: {
|
variables: {
|
||||||
proposalId: id,
|
proposalId: id,
|
||||||
},
|
},
|
||||||
@ -50,7 +54,7 @@ describe('Proposal container', () => {
|
|||||||
|
|
||||||
it('Renders proposal details if proposal is found', async () => {
|
it('Renders proposal details if proposal is found', async () => {
|
||||||
const proposal = generateProposal({ id: 'foo' });
|
const proposal = generateProposal({ id: 'foo' });
|
||||||
render(renderComponent(proposal as Proposal_proposal, 'foo'));
|
render(renderComponent(proposal as ProposalQuery['proposal'], 'foo'));
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(screen.getByTestId('proposal')).toBeInTheDocument();
|
expect(screen.getByTestId('proposal')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
@ -1,343 +1,14 @@
|
|||||||
import { gql, useQuery } from '@apollo/client';
|
|
||||||
import { AsyncRenderer } from '@vegaprotocol/ui-toolkit';
|
import { AsyncRenderer } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { useParams } from 'react-router-dom';
|
import { useParams } from 'react-router-dom';
|
||||||
|
|
||||||
import { Proposal } from '../components/proposal';
|
import { Proposal } from '../components/proposal';
|
||||||
import { ProposalNotFound } from '../components/proposal-not-found';
|
import { ProposalNotFound } from '../components/proposal-not-found';
|
||||||
import type {
|
import { useProposalQuery } from './__generated__/Proposal';
|
||||||
Proposal as ProposalQueryResult,
|
|
||||||
ProposalVariables,
|
|
||||||
} from './__generated__/Proposal';
|
|
||||||
|
|
||||||
export const PROPOSAL_QUERY = gql`
|
|
||||||
query Proposal($proposalId: ID!) {
|
|
||||||
proposal(id: $proposalId) {
|
|
||||||
id
|
|
||||||
rationale {
|
|
||||||
title
|
|
||||||
description
|
|
||||||
}
|
|
||||||
reference
|
|
||||||
state
|
|
||||||
datetime
|
|
||||||
rejectionReason
|
|
||||||
party {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
errorDetails
|
|
||||||
terms {
|
|
||||||
closingDatetime
|
|
||||||
enactmentDatetime
|
|
||||||
change {
|
|
||||||
... on NewMarket {
|
|
||||||
decimalPlaces
|
|
||||||
metadata
|
|
||||||
instrument {
|
|
||||||
name
|
|
||||||
code
|
|
||||||
futureProduct {
|
|
||||||
settlementAsset {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
symbol
|
|
||||||
decimals
|
|
||||||
quantum
|
|
||||||
}
|
|
||||||
quoteName
|
|
||||||
settlementDataDecimals
|
|
||||||
dataSourceSpecForSettlementData {
|
|
||||||
sourceType {
|
|
||||||
... on DataSourceDefinitionInternal {
|
|
||||||
sourceType {
|
|
||||||
... on DataSourceSpecConfigurationTime {
|
|
||||||
conditions {
|
|
||||||
operator
|
|
||||||
value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
... on DataSourceDefinitionExternal {
|
|
||||||
sourceType {
|
|
||||||
... on DataSourceSpecConfiguration {
|
|
||||||
signers {
|
|
||||||
signer {
|
|
||||||
... on PubKey {
|
|
||||||
key
|
|
||||||
}
|
|
||||||
... on ETHAddress {
|
|
||||||
address
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
filters {
|
|
||||||
key {
|
|
||||||
name
|
|
||||||
type
|
|
||||||
}
|
|
||||||
conditions {
|
|
||||||
operator
|
|
||||||
value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dataSourceSpecForTradingTermination {
|
|
||||||
sourceType {
|
|
||||||
... on DataSourceDefinitionInternal {
|
|
||||||
sourceType {
|
|
||||||
... on DataSourceSpecConfigurationTime {
|
|
||||||
conditions {
|
|
||||||
operator
|
|
||||||
value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
... on DataSourceDefinitionExternal {
|
|
||||||
sourceType {
|
|
||||||
... on DataSourceSpecConfiguration {
|
|
||||||
signers {
|
|
||||||
signer {
|
|
||||||
... on PubKey {
|
|
||||||
key
|
|
||||||
}
|
|
||||||
... on ETHAddress {
|
|
||||||
address
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
filters {
|
|
||||||
key {
|
|
||||||
name
|
|
||||||
type
|
|
||||||
}
|
|
||||||
conditions {
|
|
||||||
operator
|
|
||||||
value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dataSourceSpecBinding {
|
|
||||||
settlementDataProperty
|
|
||||||
tradingTerminationProperty
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
... on UpdateMarket {
|
|
||||||
marketId
|
|
||||||
updateMarketConfiguration {
|
|
||||||
instrument {
|
|
||||||
code
|
|
||||||
product {
|
|
||||||
quoteName
|
|
||||||
dataSourceSpecForSettlementData {
|
|
||||||
sourceType {
|
|
||||||
... on DataSourceDefinitionInternal {
|
|
||||||
sourceType {
|
|
||||||
... on DataSourceSpecConfigurationTime {
|
|
||||||
conditions {
|
|
||||||
operator
|
|
||||||
value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
... on DataSourceDefinitionExternal {
|
|
||||||
sourceType {
|
|
||||||
... on DataSourceSpecConfiguration {
|
|
||||||
signers {
|
|
||||||
signer {
|
|
||||||
... on PubKey {
|
|
||||||
key
|
|
||||||
}
|
|
||||||
... on ETHAddress {
|
|
||||||
address
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
filters {
|
|
||||||
key {
|
|
||||||
name
|
|
||||||
type
|
|
||||||
}
|
|
||||||
conditions {
|
|
||||||
operator
|
|
||||||
value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dataSourceSpecForTradingTermination {
|
|
||||||
sourceType {
|
|
||||||
... on DataSourceDefinitionInternal {
|
|
||||||
sourceType {
|
|
||||||
... on DataSourceSpecConfigurationTime {
|
|
||||||
conditions {
|
|
||||||
operator
|
|
||||||
value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
... on DataSourceDefinitionExternal {
|
|
||||||
sourceType {
|
|
||||||
... on DataSourceSpecConfiguration {
|
|
||||||
signers {
|
|
||||||
signer {
|
|
||||||
... on PubKey {
|
|
||||||
key
|
|
||||||
}
|
|
||||||
... on ETHAddress {
|
|
||||||
address
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
filters {
|
|
||||||
key {
|
|
||||||
name
|
|
||||||
type
|
|
||||||
}
|
|
||||||
conditions {
|
|
||||||
operator
|
|
||||||
value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
dataSourceSpecBinding {
|
|
||||||
settlementDataProperty
|
|
||||||
tradingTerminationProperty
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
metadata
|
|
||||||
priceMonitoringParameters {
|
|
||||||
triggers {
|
|
||||||
horizonSecs
|
|
||||||
probability
|
|
||||||
auctionExtensionSecs
|
|
||||||
}
|
|
||||||
}
|
|
||||||
liquidityMonitoringParameters {
|
|
||||||
triggeringRatio
|
|
||||||
targetStakeParameters {
|
|
||||||
timeWindow
|
|
||||||
scalingFactor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
riskParameters {
|
|
||||||
... on UpdateMarketSimpleRiskModel {
|
|
||||||
simple {
|
|
||||||
factorLong
|
|
||||||
factorShort
|
|
||||||
}
|
|
||||||
}
|
|
||||||
... on UpdateMarketLogNormalRiskModel {
|
|
||||||
logNormal {
|
|
||||||
riskAversionParameter
|
|
||||||
tau
|
|
||||||
params {
|
|
||||||
r
|
|
||||||
sigma
|
|
||||||
mu
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
... on NewAsset {
|
|
||||||
name
|
|
||||||
symbol
|
|
||||||
decimals
|
|
||||||
quantum
|
|
||||||
source {
|
|
||||||
... on BuiltinAsset {
|
|
||||||
maxFaucetAmountMint
|
|
||||||
}
|
|
||||||
... on ERC20 {
|
|
||||||
contractAddress
|
|
||||||
lifetimeLimit
|
|
||||||
withdrawThreshold
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
... on UpdateNetworkParameter {
|
|
||||||
networkParameter {
|
|
||||||
key
|
|
||||||
value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
... on UpdateAsset {
|
|
||||||
quantum
|
|
||||||
assetId
|
|
||||||
source {
|
|
||||||
... on UpdateERC20 {
|
|
||||||
lifetimeLimit
|
|
||||||
withdrawThreshold
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
votes {
|
|
||||||
yes {
|
|
||||||
totalTokens
|
|
||||||
totalNumber
|
|
||||||
totalEquityLikeShareWeight
|
|
||||||
votes {
|
|
||||||
value
|
|
||||||
party {
|
|
||||||
id
|
|
||||||
stakingSummary {
|
|
||||||
currentStakeAvailable
|
|
||||||
}
|
|
||||||
}
|
|
||||||
datetime
|
|
||||||
}
|
|
||||||
}
|
|
||||||
no {
|
|
||||||
totalTokens
|
|
||||||
totalNumber
|
|
||||||
totalEquityLikeShareWeight
|
|
||||||
votes {
|
|
||||||
value
|
|
||||||
party {
|
|
||||||
id
|
|
||||||
stakingSummary {
|
|
||||||
currentStakeAvailable
|
|
||||||
}
|
|
||||||
}
|
|
||||||
datetime
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
export const ProposalContainer = () => {
|
export const ProposalContainer = () => {
|
||||||
const params = useParams<{ proposalId: string }>();
|
const params = useParams<{ proposalId: string }>();
|
||||||
const { data, loading, error, refetch } = useQuery<
|
const { data, loading, error, refetch } = useProposalQuery({
|
||||||
ProposalQueryResult,
|
|
||||||
ProposalVariables
|
|
||||||
>(PROPOSAL_QUERY, {
|
|
||||||
fetchPolicy: 'network-only',
|
fetchPolicy: 'network-only',
|
||||||
errorPolicy: 'ignore',
|
errorPolicy: 'ignore',
|
||||||
variables: { proposalId: params.proposalId || '' },
|
variables: { proposalId: params.proposalId || '' },
|
||||||
|
@ -34,12 +34,16 @@ fragment ProposalFields on Proposal {
|
|||||||
__typename
|
__typename
|
||||||
name
|
name
|
||||||
symbol
|
symbol
|
||||||
|
decimals
|
||||||
|
quantum
|
||||||
source {
|
source {
|
||||||
... on BuiltinAsset {
|
... on BuiltinAsset {
|
||||||
maxFaucetAmountMint
|
maxFaucetAmountMint
|
||||||
}
|
}
|
||||||
... on ERC20 {
|
... on ERC20 {
|
||||||
contractAddress
|
contractAddress
|
||||||
|
withdrawThreshold
|
||||||
|
lifetimeLimit
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,354 +0,0 @@
|
|||||||
/* tslint:disable */
|
|
||||||
/* eslint-disable */
|
|
||||||
// @generated
|
|
||||||
// This file was automatically generated and should not be edited.
|
|
||||||
|
|
||||||
import { ProposalState, ProposalRejectionReason, VoteValue } from "@vegaprotocol/types";
|
|
||||||
|
|
||||||
// ====================================================
|
|
||||||
// GraphQL fragment: ProposalFields
|
|
||||||
// ====================================================
|
|
||||||
|
|
||||||
export interface ProposalFields_rationale {
|
|
||||||
__typename: "ProposalRationale";
|
|
||||||
/**
|
|
||||||
* Title to be used to give a short description of the proposal in lists.
|
|
||||||
* This is to be between 0 and 100 unicode characters.
|
|
||||||
* This is mandatory for all proposals.
|
|
||||||
*/
|
|
||||||
title: string;
|
|
||||||
/**
|
|
||||||
* Description to show a short title / something in case the link goes offline.
|
|
||||||
* This is to be between 0 and 20k unicode characters.
|
|
||||||
* This is mandatory for all proposals.
|
|
||||||
*/
|
|
||||||
description: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProposalFields_party {
|
|
||||||
__typename: "Party";
|
|
||||||
/**
|
|
||||||
* Party identifier
|
|
||||||
*/
|
|
||||||
id: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProposalFields_terms_change_NewFreeform {
|
|
||||||
__typename: "NewFreeform";
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProposalFields_terms_change_NewMarket_instrument_futureProduct_settlementAsset {
|
|
||||||
__typename: "Asset";
|
|
||||||
/**
|
|
||||||
* The symbol of the asset (e.g: GBP)
|
|
||||||
*/
|
|
||||||
symbol: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProposalFields_terms_change_NewMarket_instrument_futureProduct {
|
|
||||||
__typename: "FutureProduct";
|
|
||||||
/**
|
|
||||||
* Product asset
|
|
||||||
*/
|
|
||||||
settlementAsset: ProposalFields_terms_change_NewMarket_instrument_futureProduct_settlementAsset;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProposalFields_terms_change_NewMarket_instrument {
|
|
||||||
__typename: "InstrumentConfiguration";
|
|
||||||
/**
|
|
||||||
* Full and fairly descriptive name for the instrument
|
|
||||||
*/
|
|
||||||
name: string;
|
|
||||||
/**
|
|
||||||
* A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18)
|
|
||||||
*/
|
|
||||||
code: string;
|
|
||||||
/**
|
|
||||||
* Future product specification
|
|
||||||
*/
|
|
||||||
futureProduct: ProposalFields_terms_change_NewMarket_instrument_futureProduct | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProposalFields_terms_change_NewMarket {
|
|
||||||
__typename: "NewMarket";
|
|
||||||
/**
|
|
||||||
* New market instrument configuration
|
|
||||||
*/
|
|
||||||
instrument: ProposalFields_terms_change_NewMarket_instrument;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProposalFields_terms_change_UpdateMarket {
|
|
||||||
__typename: "UpdateMarket";
|
|
||||||
marketId: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProposalFields_terms_change_NewAsset_source_BuiltinAsset {
|
|
||||||
__typename: "BuiltinAsset";
|
|
||||||
/**
|
|
||||||
* Maximum amount that can be requested by a party through the built-in asset faucet at a time
|
|
||||||
*/
|
|
||||||
maxFaucetAmountMint: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProposalFields_terms_change_NewAsset_source_ERC20 {
|
|
||||||
__typename: "ERC20";
|
|
||||||
/**
|
|
||||||
* The address of the ERC20 contract
|
|
||||||
*/
|
|
||||||
contractAddress: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type ProposalFields_terms_change_NewAsset_source = ProposalFields_terms_change_NewAsset_source_BuiltinAsset | ProposalFields_terms_change_NewAsset_source_ERC20;
|
|
||||||
|
|
||||||
export interface ProposalFields_terms_change_NewAsset {
|
|
||||||
__typename: "NewAsset";
|
|
||||||
/**
|
|
||||||
* The full name of the asset (e.g: Great British Pound)
|
|
||||||
*/
|
|
||||||
name: string;
|
|
||||||
/**
|
|
||||||
* The symbol of the asset (e.g: GBP)
|
|
||||||
*/
|
|
||||||
symbol: string;
|
|
||||||
/**
|
|
||||||
* The source of the new asset
|
|
||||||
*/
|
|
||||||
source: ProposalFields_terms_change_NewAsset_source;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProposalFields_terms_change_UpdateNetworkParameter_networkParameter {
|
|
||||||
__typename: "NetworkParameter";
|
|
||||||
/**
|
|
||||||
* The name of the network parameter
|
|
||||||
*/
|
|
||||||
key: string;
|
|
||||||
/**
|
|
||||||
* The value of the network parameter
|
|
||||||
*/
|
|
||||||
value: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProposalFields_terms_change_UpdateNetworkParameter {
|
|
||||||
__typename: "UpdateNetworkParameter";
|
|
||||||
networkParameter: ProposalFields_terms_change_UpdateNetworkParameter_networkParameter;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProposalFields_terms_change_UpdateAsset_source {
|
|
||||||
__typename: "UpdateERC20";
|
|
||||||
/**
|
|
||||||
* The lifetime limits deposit per address
|
|
||||||
* Note: this is a temporary measure that can be changed by governance
|
|
||||||
*/
|
|
||||||
lifetimeLimit: string;
|
|
||||||
/**
|
|
||||||
* The maximum you can withdraw instantly. All withdrawals over the threshold will be delayed by the withdrawal delay.
|
|
||||||
* There is no limit on the size of a withdrawal
|
|
||||||
* Note: this is a temporary measure that can be changed by governance
|
|
||||||
*/
|
|
||||||
withdrawThreshold: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProposalFields_terms_change_UpdateAsset {
|
|
||||||
__typename: "UpdateAsset";
|
|
||||||
/**
|
|
||||||
* The minimum economically meaningful amount of this specific asset
|
|
||||||
*/
|
|
||||||
quantum: string;
|
|
||||||
/**
|
|
||||||
* The asset to update
|
|
||||||
*/
|
|
||||||
assetId: string;
|
|
||||||
/**
|
|
||||||
* The source of the updated asset
|
|
||||||
*/
|
|
||||||
source: ProposalFields_terms_change_UpdateAsset_source;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type ProposalFields_terms_change = ProposalFields_terms_change_NewFreeform | ProposalFields_terms_change_NewMarket | ProposalFields_terms_change_UpdateMarket | ProposalFields_terms_change_NewAsset | ProposalFields_terms_change_UpdateNetworkParameter | ProposalFields_terms_change_UpdateAsset;
|
|
||||||
|
|
||||||
export interface ProposalFields_terms {
|
|
||||||
__typename: "ProposalTerms";
|
|
||||||
/**
|
|
||||||
* RFC3339Nano time and date when voting closes for this proposal.
|
|
||||||
* Constrained by "minClose" and "maxClose" network parameters.
|
|
||||||
*/
|
|
||||||
closingDatetime: any;
|
|
||||||
/**
|
|
||||||
* RFC3339Nano time and date when this proposal is executed (if passed). Note that it has to be after closing date time.
|
|
||||||
* Constrained by "minEnactInSeconds" and "maxEnactInSeconds" network parameters.
|
|
||||||
* Note: Optional as free form proposals do not require it.
|
|
||||||
*/
|
|
||||||
enactmentDatetime: any | null;
|
|
||||||
/**
|
|
||||||
* Actual change being introduced by the proposal - action the proposal triggers if passed and enacted.
|
|
||||||
*/
|
|
||||||
change: ProposalFields_terms_change;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProposalFields_votes_yes_votes_party_stakingSummary {
|
|
||||||
__typename: "StakingSummary";
|
|
||||||
/**
|
|
||||||
* The stake currently available for the party
|
|
||||||
*/
|
|
||||||
currentStakeAvailable: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProposalFields_votes_yes_votes_party {
|
|
||||||
__typename: "Party";
|
|
||||||
/**
|
|
||||||
* Party identifier
|
|
||||||
*/
|
|
||||||
id: string;
|
|
||||||
/**
|
|
||||||
* The staking information for this Party
|
|
||||||
*/
|
|
||||||
stakingSummary: ProposalFields_votes_yes_votes_party_stakingSummary;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProposalFields_votes_yes_votes {
|
|
||||||
__typename: "Vote";
|
|
||||||
/**
|
|
||||||
* The vote value cast
|
|
||||||
*/
|
|
||||||
value: VoteValue;
|
|
||||||
/**
|
|
||||||
* The party casting the vote
|
|
||||||
*/
|
|
||||||
party: ProposalFields_votes_yes_votes_party;
|
|
||||||
/**
|
|
||||||
* RFC3339Nano time and date when the vote reached Vega network
|
|
||||||
*/
|
|
||||||
datetime: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProposalFields_votes_yes {
|
|
||||||
__typename: "ProposalVoteSide";
|
|
||||||
/**
|
|
||||||
* Total number of governance tokens from the votes cast for this side
|
|
||||||
*/
|
|
||||||
totalTokens: string;
|
|
||||||
/**
|
|
||||||
* Total number of votes cast for this side
|
|
||||||
*/
|
|
||||||
totalNumber: string;
|
|
||||||
/**
|
|
||||||
* Total equity like share weight for this side (only for UpdateMarket Proposals)
|
|
||||||
*/
|
|
||||||
totalEquityLikeShareWeight: string;
|
|
||||||
/**
|
|
||||||
* All votes cast for this side
|
|
||||||
*/
|
|
||||||
votes: ProposalFields_votes_yes_votes[] | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProposalFields_votes_no_votes_party_stakingSummary {
|
|
||||||
__typename: "StakingSummary";
|
|
||||||
/**
|
|
||||||
* The stake currently available for the party
|
|
||||||
*/
|
|
||||||
currentStakeAvailable: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProposalFields_votes_no_votes_party {
|
|
||||||
__typename: "Party";
|
|
||||||
/**
|
|
||||||
* Party identifier
|
|
||||||
*/
|
|
||||||
id: string;
|
|
||||||
/**
|
|
||||||
* The staking information for this Party
|
|
||||||
*/
|
|
||||||
stakingSummary: ProposalFields_votes_no_votes_party_stakingSummary;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProposalFields_votes_no_votes {
|
|
||||||
__typename: "Vote";
|
|
||||||
/**
|
|
||||||
* The vote value cast
|
|
||||||
*/
|
|
||||||
value: VoteValue;
|
|
||||||
/**
|
|
||||||
* The party casting the vote
|
|
||||||
*/
|
|
||||||
party: ProposalFields_votes_no_votes_party;
|
|
||||||
/**
|
|
||||||
* RFC3339Nano time and date when the vote reached Vega network
|
|
||||||
*/
|
|
||||||
datetime: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProposalFields_votes_no {
|
|
||||||
__typename: "ProposalVoteSide";
|
|
||||||
/**
|
|
||||||
* Total number of governance tokens from the votes cast for this side
|
|
||||||
*/
|
|
||||||
totalTokens: string;
|
|
||||||
/**
|
|
||||||
* Total number of votes cast for this side
|
|
||||||
*/
|
|
||||||
totalNumber: string;
|
|
||||||
/**
|
|
||||||
* Total equity like share weight for this side (only for UpdateMarket Proposals)
|
|
||||||
*/
|
|
||||||
totalEquityLikeShareWeight: string;
|
|
||||||
/**
|
|
||||||
* All votes cast for this side
|
|
||||||
*/
|
|
||||||
votes: ProposalFields_votes_no_votes[] | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProposalFields_votes {
|
|
||||||
__typename: "ProposalVotes";
|
|
||||||
/**
|
|
||||||
* Yes votes cast for this proposal
|
|
||||||
*/
|
|
||||||
yes: ProposalFields_votes_yes;
|
|
||||||
/**
|
|
||||||
* No votes cast for this proposal
|
|
||||||
*/
|
|
||||||
no: ProposalFields_votes_no;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ProposalFields {
|
|
||||||
__typename: "Proposal";
|
|
||||||
/**
|
|
||||||
* Proposal ID that is filled by Vega once proposal reaches the network
|
|
||||||
*/
|
|
||||||
id: string | null;
|
|
||||||
/**
|
|
||||||
* Rationale behind the proposal
|
|
||||||
*/
|
|
||||||
rationale: ProposalFields_rationale;
|
|
||||||
/**
|
|
||||||
* A UUID reference to aid tracking proposals on Vega
|
|
||||||
*/
|
|
||||||
reference: string;
|
|
||||||
/**
|
|
||||||
* State of the proposal
|
|
||||||
*/
|
|
||||||
state: ProposalState;
|
|
||||||
/**
|
|
||||||
* RFC3339Nano time and date when the proposal reached Vega network
|
|
||||||
*/
|
|
||||||
datetime: any;
|
|
||||||
/**
|
|
||||||
* Why the proposal was rejected by the core
|
|
||||||
*/
|
|
||||||
rejectionReason: ProposalRejectionReason | null;
|
|
||||||
/**
|
|
||||||
* Party that prepared the proposal
|
|
||||||
*/
|
|
||||||
party: ProposalFields_party;
|
|
||||||
/**
|
|
||||||
* Error details of the rejectionReason
|
|
||||||
*/
|
|
||||||
errorDetails: string | null;
|
|
||||||
/**
|
|
||||||
* Terms of the proposal
|
|
||||||
*/
|
|
||||||
terms: ProposalFields_terms;
|
|
||||||
/**
|
|
||||||
* Votes cast for this proposal
|
|
||||||
*/
|
|
||||||
votes: ProposalFields_votes;
|
|
||||||
}
|
|
@ -1,377 +1,152 @@
|
|||||||
/* tslint:disable */
|
import * as Types from '@vegaprotocol/types';
|
||||||
/* eslint-disable */
|
|
||||||
// @generated
|
|
||||||
// This file was automatically generated and should not be edited.
|
|
||||||
|
|
||||||
import { ProposalState, ProposalRejectionReason, VoteValue } from "@vegaprotocol/types";
|
import { gql } from '@apollo/client';
|
||||||
|
import * as Apollo from '@apollo/client';
|
||||||
|
const defaultOptions = {} as const;
|
||||||
|
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: '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?: 'UpdateAsset', quantum: string, assetId: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'UpdateMarket', marketId: string } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string, votes?: Array<{ __typename?: 'Vote', value: Types.VoteValue, datetime: any, party: { __typename?: 'Party', id: string, stakingSummary: { __typename?: 'StakingSummary', currentStakeAvailable: string } } }> | null }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string, votes?: Array<{ __typename?: 'Vote', value: Types.VoteValue, datetime: any, party: { __typename?: 'Party', id: string, stakingSummary: { __typename?: 'StakingSummary', currentStakeAvailable: string } } }> | null } } };
|
||||||
|
|
||||||
// ====================================================
|
export type ProposalsQueryVariables = Types.Exact<{ [key: string]: never; }>;
|
||||||
// GraphQL query operation: Proposals
|
|
||||||
// ====================================================
|
|
||||||
|
|
||||||
export interface Proposals_proposalsConnection_edges_node_rationale {
|
|
||||||
__typename: "ProposalRationale";
|
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: '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?: 'UpdateAsset', quantum: string, assetId: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'UpdateMarket', marketId: string } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string, votes?: Array<{ __typename?: 'Vote', value: Types.VoteValue, datetime: any, party: { __typename?: 'Party', id: string, stakingSummary: { __typename?: 'StakingSummary', currentStakeAvailable: string } } }> | null }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string, votes?: Array<{ __typename?: 'Vote', value: Types.VoteValue, datetime: any, party: { __typename?: 'Party', id: string, stakingSummary: { __typename?: 'StakingSummary', currentStakeAvailable: string } } }> | null } } } } | null> | null } | null };
|
||||||
/**
|
|
||||||
* Title to be used to give a short description of the proposal in lists.
|
export const ProposalFieldsFragmentDoc = gql`
|
||||||
* This is to be between 0 and 100 unicode characters.
|
fragment ProposalFields on Proposal {
|
||||||
* This is mandatory for all proposals.
|
id
|
||||||
*/
|
rationale {
|
||||||
title: string;
|
title
|
||||||
/**
|
description
|
||||||
* Description to show a short title / something in case the link goes offline.
|
}
|
||||||
* This is to be between 0 and 20k unicode characters.
|
reference
|
||||||
* This is mandatory for all proposals.
|
state
|
||||||
*/
|
datetime
|
||||||
description: string;
|
rejectionReason
|
||||||
|
party {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
errorDetails
|
||||||
|
terms {
|
||||||
|
closingDatetime
|
||||||
|
enactmentDatetime
|
||||||
|
change {
|
||||||
|
... on NewMarket {
|
||||||
|
instrument {
|
||||||
|
name
|
||||||
|
code
|
||||||
|
futureProduct {
|
||||||
|
settlementAsset {
|
||||||
|
symbol
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
... on UpdateMarket {
|
||||||
|
marketId
|
||||||
|
}
|
||||||
|
... on NewAsset {
|
||||||
|
__typename
|
||||||
|
name
|
||||||
|
symbol
|
||||||
|
decimals
|
||||||
|
quantum
|
||||||
|
source {
|
||||||
|
... on BuiltinAsset {
|
||||||
|
maxFaucetAmountMint
|
||||||
|
}
|
||||||
|
... on ERC20 {
|
||||||
|
contractAddress
|
||||||
|
withdrawThreshold
|
||||||
|
lifetimeLimit
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
... on UpdateNetworkParameter {
|
||||||
|
networkParameter {
|
||||||
|
key
|
||||||
|
value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
... on UpdateAsset {
|
||||||
|
quantum
|
||||||
|
assetId
|
||||||
|
source {
|
||||||
|
... on UpdateERC20 {
|
||||||
|
lifetimeLimit
|
||||||
|
withdrawThreshold
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
votes {
|
||||||
|
yes {
|
||||||
|
totalTokens
|
||||||
|
totalNumber
|
||||||
|
totalEquityLikeShareWeight
|
||||||
|
votes {
|
||||||
|
value
|
||||||
|
party {
|
||||||
|
id
|
||||||
|
stakingSummary {
|
||||||
|
currentStakeAvailable
|
||||||
|
}
|
||||||
|
}
|
||||||
|
datetime
|
||||||
|
}
|
||||||
|
}
|
||||||
|
no {
|
||||||
|
totalTokens
|
||||||
|
totalNumber
|
||||||
|
totalEquityLikeShareWeight
|
||||||
|
votes {
|
||||||
|
value
|
||||||
|
party {
|
||||||
|
id
|
||||||
|
stakingSummary {
|
||||||
|
currentStakeAvailable
|
||||||
|
}
|
||||||
|
}
|
||||||
|
datetime
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
`;
|
||||||
export interface Proposals_proposalsConnection_edges_node_party {
|
export const ProposalsDocument = gql`
|
||||||
__typename: "Party";
|
query Proposals {
|
||||||
/**
|
proposalsConnection {
|
||||||
* Party identifier
|
edges {
|
||||||
*/
|
node {
|
||||||
id: string;
|
...ProposalFields
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
${ProposalFieldsFragmentDoc}`;
|
||||||
|
|
||||||
export interface Proposals_proposalsConnection_edges_node_terms_change_NewFreeform {
|
/**
|
||||||
__typename: "NewFreeform";
|
* __useProposalsQuery__
|
||||||
}
|
*
|
||||||
|
* To run a query within a React component, call `useProposalsQuery` and pass it any options that fit your needs.
|
||||||
export interface Proposals_proposalsConnection_edges_node_terms_change_NewMarket_instrument_futureProduct_settlementAsset {
|
* When your component renders, `useProposalsQuery` returns an object from Apollo Client that contains loading, error, and data properties
|
||||||
__typename: "Asset";
|
* you can use to render your UI.
|
||||||
/**
|
*
|
||||||
* The symbol of the asset (e.g: GBP)
|
* @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;
|
||||||
*/
|
*
|
||||||
symbol: string;
|
* @example
|
||||||
}
|
* const { data, loading, error } = useProposalsQuery({
|
||||||
|
* variables: {
|
||||||
export interface Proposals_proposalsConnection_edges_node_terms_change_NewMarket_instrument_futureProduct {
|
* },
|
||||||
__typename: "FutureProduct";
|
* });
|
||||||
/**
|
*/
|
||||||
* Product asset
|
export function useProposalsQuery(baseOptions?: Apollo.QueryHookOptions<ProposalsQuery, ProposalsQueryVariables>) {
|
||||||
*/
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
settlementAsset: Proposals_proposalsConnection_edges_node_terms_change_NewMarket_instrument_futureProduct_settlementAsset;
|
return Apollo.useQuery<ProposalsQuery, ProposalsQueryVariables>(ProposalsDocument, options);
|
||||||
}
|
}
|
||||||
|
export function useProposalsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<ProposalsQuery, ProposalsQueryVariables>) {
|
||||||
export interface Proposals_proposalsConnection_edges_node_terms_change_NewMarket_instrument {
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
__typename: "InstrumentConfiguration";
|
return Apollo.useLazyQuery<ProposalsQuery, ProposalsQueryVariables>(ProposalsDocument, options);
|
||||||
/**
|
}
|
||||||
* Full and fairly descriptive name for the instrument
|
export type ProposalsQueryHookResult = ReturnType<typeof useProposalsQuery>;
|
||||||
*/
|
export type ProposalsLazyQueryHookResult = ReturnType<typeof useProposalsLazyQuery>;
|
||||||
name: string;
|
export type ProposalsQueryResult = Apollo.QueryResult<ProposalsQuery, ProposalsQueryVariables>;
|
||||||
/**
|
|
||||||
* A short non necessarily unique code used to easily describe the instrument (e.g: FX:BTCUSD/DEC18)
|
|
||||||
*/
|
|
||||||
code: string;
|
|
||||||
/**
|
|
||||||
* Future product specification
|
|
||||||
*/
|
|
||||||
futureProduct: Proposals_proposalsConnection_edges_node_terms_change_NewMarket_instrument_futureProduct | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Proposals_proposalsConnection_edges_node_terms_change_NewMarket {
|
|
||||||
__typename: "NewMarket";
|
|
||||||
/**
|
|
||||||
* New market instrument configuration
|
|
||||||
*/
|
|
||||||
instrument: Proposals_proposalsConnection_edges_node_terms_change_NewMarket_instrument;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Proposals_proposalsConnection_edges_node_terms_change_UpdateMarket {
|
|
||||||
__typename: "UpdateMarket";
|
|
||||||
marketId: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Proposals_proposalsConnection_edges_node_terms_change_NewAsset_source_BuiltinAsset {
|
|
||||||
__typename: "BuiltinAsset";
|
|
||||||
/**
|
|
||||||
* Maximum amount that can be requested by a party through the built-in asset faucet at a time
|
|
||||||
*/
|
|
||||||
maxFaucetAmountMint: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Proposals_proposalsConnection_edges_node_terms_change_NewAsset_source_ERC20 {
|
|
||||||
__typename: "ERC20";
|
|
||||||
/**
|
|
||||||
* The address of the ERC20 contract
|
|
||||||
*/
|
|
||||||
contractAddress: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type Proposals_proposalsConnection_edges_node_terms_change_NewAsset_source = Proposals_proposalsConnection_edges_node_terms_change_NewAsset_source_BuiltinAsset | Proposals_proposalsConnection_edges_node_terms_change_NewAsset_source_ERC20;
|
|
||||||
|
|
||||||
export interface Proposals_proposalsConnection_edges_node_terms_change_NewAsset {
|
|
||||||
__typename: "NewAsset";
|
|
||||||
/**
|
|
||||||
* The full name of the asset (e.g: Great British Pound)
|
|
||||||
*/
|
|
||||||
name: string;
|
|
||||||
/**
|
|
||||||
* The symbol of the asset (e.g: GBP)
|
|
||||||
*/
|
|
||||||
symbol: string;
|
|
||||||
/**
|
|
||||||
* The source of the new asset
|
|
||||||
*/
|
|
||||||
source: Proposals_proposalsConnection_edges_node_terms_change_NewAsset_source;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Proposals_proposalsConnection_edges_node_terms_change_UpdateNetworkParameter_networkParameter {
|
|
||||||
__typename: "NetworkParameter";
|
|
||||||
/**
|
|
||||||
* The name of the network parameter
|
|
||||||
*/
|
|
||||||
key: string;
|
|
||||||
/**
|
|
||||||
* The value of the network parameter
|
|
||||||
*/
|
|
||||||
value: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Proposals_proposalsConnection_edges_node_terms_change_UpdateNetworkParameter {
|
|
||||||
__typename: "UpdateNetworkParameter";
|
|
||||||
networkParameter: Proposals_proposalsConnection_edges_node_terms_change_UpdateNetworkParameter_networkParameter;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Proposals_proposalsConnection_edges_node_terms_change_UpdateAsset_source {
|
|
||||||
__typename: "UpdateERC20";
|
|
||||||
/**
|
|
||||||
* The lifetime limits deposit per address
|
|
||||||
* Note: this is a temporary measure that can be changed by governance
|
|
||||||
*/
|
|
||||||
lifetimeLimit: string;
|
|
||||||
/**
|
|
||||||
* The maximum you can withdraw instantly. All withdrawals over the threshold will be delayed by the withdrawal delay.
|
|
||||||
* There is no limit on the size of a withdrawal
|
|
||||||
* Note: this is a temporary measure that can be changed by governance
|
|
||||||
*/
|
|
||||||
withdrawThreshold: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Proposals_proposalsConnection_edges_node_terms_change_UpdateAsset {
|
|
||||||
__typename: "UpdateAsset";
|
|
||||||
/**
|
|
||||||
* The minimum economically meaningful amount of this specific asset
|
|
||||||
*/
|
|
||||||
quantum: string;
|
|
||||||
/**
|
|
||||||
* The asset to update
|
|
||||||
*/
|
|
||||||
assetId: string;
|
|
||||||
/**
|
|
||||||
* The source of the updated asset
|
|
||||||
*/
|
|
||||||
source: Proposals_proposalsConnection_edges_node_terms_change_UpdateAsset_source;
|
|
||||||
}
|
|
||||||
|
|
||||||
export type Proposals_proposalsConnection_edges_node_terms_change = Proposals_proposalsConnection_edges_node_terms_change_NewFreeform | Proposals_proposalsConnection_edges_node_terms_change_NewMarket | Proposals_proposalsConnection_edges_node_terms_change_UpdateMarket | Proposals_proposalsConnection_edges_node_terms_change_NewAsset | Proposals_proposalsConnection_edges_node_terms_change_UpdateNetworkParameter | Proposals_proposalsConnection_edges_node_terms_change_UpdateAsset;
|
|
||||||
|
|
||||||
export interface Proposals_proposalsConnection_edges_node_terms {
|
|
||||||
__typename: "ProposalTerms";
|
|
||||||
/**
|
|
||||||
* RFC3339Nano time and date when voting closes for this proposal.
|
|
||||||
* Constrained by "minClose" and "maxClose" network parameters.
|
|
||||||
*/
|
|
||||||
closingDatetime: any;
|
|
||||||
/**
|
|
||||||
* RFC3339Nano time and date when this proposal is executed (if passed). Note that it has to be after closing date time.
|
|
||||||
* Constrained by "minEnactInSeconds" and "maxEnactInSeconds" network parameters.
|
|
||||||
* Note: Optional as free form proposals do not require it.
|
|
||||||
*/
|
|
||||||
enactmentDatetime: any | null;
|
|
||||||
/**
|
|
||||||
* Actual change being introduced by the proposal - action the proposal triggers if passed and enacted.
|
|
||||||
*/
|
|
||||||
change: Proposals_proposalsConnection_edges_node_terms_change;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Proposals_proposalsConnection_edges_node_votes_yes_votes_party_stakingSummary {
|
|
||||||
__typename: "StakingSummary";
|
|
||||||
/**
|
|
||||||
* The stake currently available for the party
|
|
||||||
*/
|
|
||||||
currentStakeAvailable: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Proposals_proposalsConnection_edges_node_votes_yes_votes_party {
|
|
||||||
__typename: "Party";
|
|
||||||
/**
|
|
||||||
* Party identifier
|
|
||||||
*/
|
|
||||||
id: string;
|
|
||||||
/**
|
|
||||||
* The staking information for this Party
|
|
||||||
*/
|
|
||||||
stakingSummary: Proposals_proposalsConnection_edges_node_votes_yes_votes_party_stakingSummary;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Proposals_proposalsConnection_edges_node_votes_yes_votes {
|
|
||||||
__typename: "Vote";
|
|
||||||
/**
|
|
||||||
* The vote value cast
|
|
||||||
*/
|
|
||||||
value: VoteValue;
|
|
||||||
/**
|
|
||||||
* The party casting the vote
|
|
||||||
*/
|
|
||||||
party: Proposals_proposalsConnection_edges_node_votes_yes_votes_party;
|
|
||||||
/**
|
|
||||||
* RFC3339Nano time and date when the vote reached Vega network
|
|
||||||
*/
|
|
||||||
datetime: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Proposals_proposalsConnection_edges_node_votes_yes {
|
|
||||||
__typename: "ProposalVoteSide";
|
|
||||||
/**
|
|
||||||
* Total number of governance tokens from the votes cast for this side
|
|
||||||
*/
|
|
||||||
totalTokens: string;
|
|
||||||
/**
|
|
||||||
* Total number of votes cast for this side
|
|
||||||
*/
|
|
||||||
totalNumber: string;
|
|
||||||
/**
|
|
||||||
* Total equity like share weight for this side (only for UpdateMarket Proposals)
|
|
||||||
*/
|
|
||||||
totalEquityLikeShareWeight: string;
|
|
||||||
/**
|
|
||||||
* All votes cast for this side
|
|
||||||
*/
|
|
||||||
votes: Proposals_proposalsConnection_edges_node_votes_yes_votes[] | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Proposals_proposalsConnection_edges_node_votes_no_votes_party_stakingSummary {
|
|
||||||
__typename: "StakingSummary";
|
|
||||||
/**
|
|
||||||
* The stake currently available for the party
|
|
||||||
*/
|
|
||||||
currentStakeAvailable: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Proposals_proposalsConnection_edges_node_votes_no_votes_party {
|
|
||||||
__typename: "Party";
|
|
||||||
/**
|
|
||||||
* Party identifier
|
|
||||||
*/
|
|
||||||
id: string;
|
|
||||||
/**
|
|
||||||
* The staking information for this Party
|
|
||||||
*/
|
|
||||||
stakingSummary: Proposals_proposalsConnection_edges_node_votes_no_votes_party_stakingSummary;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Proposals_proposalsConnection_edges_node_votes_no_votes {
|
|
||||||
__typename: "Vote";
|
|
||||||
/**
|
|
||||||
* The vote value cast
|
|
||||||
*/
|
|
||||||
value: VoteValue;
|
|
||||||
/**
|
|
||||||
* The party casting the vote
|
|
||||||
*/
|
|
||||||
party: Proposals_proposalsConnection_edges_node_votes_no_votes_party;
|
|
||||||
/**
|
|
||||||
* RFC3339Nano time and date when the vote reached Vega network
|
|
||||||
*/
|
|
||||||
datetime: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Proposals_proposalsConnection_edges_node_votes_no {
|
|
||||||
__typename: "ProposalVoteSide";
|
|
||||||
/**
|
|
||||||
* Total number of governance tokens from the votes cast for this side
|
|
||||||
*/
|
|
||||||
totalTokens: string;
|
|
||||||
/**
|
|
||||||
* Total number of votes cast for this side
|
|
||||||
*/
|
|
||||||
totalNumber: string;
|
|
||||||
/**
|
|
||||||
* Total equity like share weight for this side (only for UpdateMarket Proposals)
|
|
||||||
*/
|
|
||||||
totalEquityLikeShareWeight: string;
|
|
||||||
/**
|
|
||||||
* All votes cast for this side
|
|
||||||
*/
|
|
||||||
votes: Proposals_proposalsConnection_edges_node_votes_no_votes[] | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Proposals_proposalsConnection_edges_node_votes {
|
|
||||||
__typename: "ProposalVotes";
|
|
||||||
/**
|
|
||||||
* Yes votes cast for this proposal
|
|
||||||
*/
|
|
||||||
yes: Proposals_proposalsConnection_edges_node_votes_yes;
|
|
||||||
/**
|
|
||||||
* No votes cast for this proposal
|
|
||||||
*/
|
|
||||||
no: Proposals_proposalsConnection_edges_node_votes_no;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Proposals_proposalsConnection_edges_node {
|
|
||||||
__typename: "Proposal";
|
|
||||||
/**
|
|
||||||
* Proposal ID that is filled by Vega once proposal reaches the network
|
|
||||||
*/
|
|
||||||
id: string | null;
|
|
||||||
/**
|
|
||||||
* Rationale behind the proposal
|
|
||||||
*/
|
|
||||||
rationale: Proposals_proposalsConnection_edges_node_rationale;
|
|
||||||
/**
|
|
||||||
* A UUID reference to aid tracking proposals on Vega
|
|
||||||
*/
|
|
||||||
reference: string;
|
|
||||||
/**
|
|
||||||
* State of the proposal
|
|
||||||
*/
|
|
||||||
state: ProposalState;
|
|
||||||
/**
|
|
||||||
* RFC3339Nano time and date when the proposal reached Vega network
|
|
||||||
*/
|
|
||||||
datetime: any;
|
|
||||||
/**
|
|
||||||
* Why the proposal was rejected by the core
|
|
||||||
*/
|
|
||||||
rejectionReason: ProposalRejectionReason | null;
|
|
||||||
/**
|
|
||||||
* Party that prepared the proposal
|
|
||||||
*/
|
|
||||||
party: Proposals_proposalsConnection_edges_node_party;
|
|
||||||
/**
|
|
||||||
* Error details of the rejectionReason
|
|
||||||
*/
|
|
||||||
errorDetails: string | null;
|
|
||||||
/**
|
|
||||||
* Terms of the proposal
|
|
||||||
*/
|
|
||||||
terms: Proposals_proposalsConnection_edges_node_terms;
|
|
||||||
/**
|
|
||||||
* Votes cast for this proposal
|
|
||||||
*/
|
|
||||||
votes: Proposals_proposalsConnection_edges_node_votes;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Proposals_proposalsConnection_edges {
|
|
||||||
__typename: "ProposalEdge";
|
|
||||||
/**
|
|
||||||
* The proposal data
|
|
||||||
*/
|
|
||||||
node: Proposals_proposalsConnection_edges_node;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Proposals_proposalsConnection {
|
|
||||||
__typename: "ProposalsConnection";
|
|
||||||
/**
|
|
||||||
* List of proposals available for the connection
|
|
||||||
*/
|
|
||||||
edges: (Proposals_proposalsConnection_edges | null)[] | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Proposals {
|
|
||||||
/**
|
|
||||||
* All governance proposals in the Vega network
|
|
||||||
*/
|
|
||||||
proposalsConnection: Proposals_proposalsConnection | null;
|
|
||||||
}
|
|
@ -1,148 +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 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: 'NewAsset', name: string, symbol: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', settlementAsset: { __typename?: 'Asset', symbol: string } } | null } } | { __typename?: 'UpdateAsset', quantum: string, assetId: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'UpdateMarket', marketId: string } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string, votes?: Array<{ __typename?: 'Vote', value: Types.VoteValue, datetime: any, party: { __typename?: 'Party', id: string, stakingSummary: { __typename?: 'StakingSummary', currentStakeAvailable: string } } }> | null }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string, votes?: Array<{ __typename?: 'Vote', value: Types.VoteValue, datetime: any, party: { __typename?: 'Party', id: string, stakingSummary: { __typename?: 'StakingSummary', currentStakeAvailable: string } } }> | null } } };
|
|
||||||
|
|
||||||
export type ProposalsQueryVariables = Types.Exact<{ [key: string]: never; }>;
|
|
||||||
|
|
||||||
|
|
||||||
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: 'NewAsset', name: string, symbol: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', settlementAsset: { __typename?: 'Asset', symbol: string } } | null } } | { __typename?: 'UpdateAsset', quantum: string, assetId: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'UpdateMarket', marketId: string } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string, votes?: Array<{ __typename?: 'Vote', value: Types.VoteValue, datetime: any, party: { __typename?: 'Party', id: string, stakingSummary: { __typename?: 'StakingSummary', currentStakeAvailable: string } } }> | null }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string, votes?: Array<{ __typename?: 'Vote', value: Types.VoteValue, datetime: any, party: { __typename?: 'Party', id: string, stakingSummary: { __typename?: 'StakingSummary', currentStakeAvailable: string } } }> | null } } } } | null> | null } | null };
|
|
||||||
|
|
||||||
export const ProposalFieldsFragmentDoc = gql`
|
|
||||||
fragment ProposalFields on Proposal {
|
|
||||||
id
|
|
||||||
rationale {
|
|
||||||
title
|
|
||||||
description
|
|
||||||
}
|
|
||||||
reference
|
|
||||||
state
|
|
||||||
datetime
|
|
||||||
rejectionReason
|
|
||||||
party {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
errorDetails
|
|
||||||
terms {
|
|
||||||
closingDatetime
|
|
||||||
enactmentDatetime
|
|
||||||
change {
|
|
||||||
... on NewMarket {
|
|
||||||
instrument {
|
|
||||||
name
|
|
||||||
code
|
|
||||||
futureProduct {
|
|
||||||
settlementAsset {
|
|
||||||
symbol
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
... on UpdateMarket {
|
|
||||||
marketId
|
|
||||||
}
|
|
||||||
... on NewAsset {
|
|
||||||
__typename
|
|
||||||
name
|
|
||||||
symbol
|
|
||||||
source {
|
|
||||||
... on BuiltinAsset {
|
|
||||||
maxFaucetAmountMint
|
|
||||||
}
|
|
||||||
... on ERC20 {
|
|
||||||
contractAddress
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
... on UpdateNetworkParameter {
|
|
||||||
networkParameter {
|
|
||||||
key
|
|
||||||
value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
... on UpdateAsset {
|
|
||||||
quantum
|
|
||||||
assetId
|
|
||||||
source {
|
|
||||||
... on UpdateERC20 {
|
|
||||||
lifetimeLimit
|
|
||||||
withdrawThreshold
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
votes {
|
|
||||||
yes {
|
|
||||||
totalTokens
|
|
||||||
totalNumber
|
|
||||||
totalEquityLikeShareWeight
|
|
||||||
votes {
|
|
||||||
value
|
|
||||||
party {
|
|
||||||
id
|
|
||||||
stakingSummary {
|
|
||||||
currentStakeAvailable
|
|
||||||
}
|
|
||||||
}
|
|
||||||
datetime
|
|
||||||
}
|
|
||||||
}
|
|
||||||
no {
|
|
||||||
totalTokens
|
|
||||||
totalNumber
|
|
||||||
totalEquityLikeShareWeight
|
|
||||||
votes {
|
|
||||||
value
|
|
||||||
party {
|
|
||||||
id
|
|
||||||
stakingSummary {
|
|
||||||
currentStakeAvailable
|
|
||||||
}
|
|
||||||
}
|
|
||||||
datetime
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
export const ProposalsDocument = gql`
|
|
||||||
query Proposals {
|
|
||||||
proposalsConnection {
|
|
||||||
edges {
|
|
||||||
node {
|
|
||||||
...ProposalFields
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
${ProposalFieldsFragmentDoc}`;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* __useProposalsQuery__
|
|
||||||
*
|
|
||||||
* To run a query within a React component, call `useProposalsQuery` and pass it any options that fit your needs.
|
|
||||||
* When your component renders, `useProposalsQuery` 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 } = useProposalsQuery({
|
|
||||||
* variables: {
|
|
||||||
* },
|
|
||||||
* });
|
|
||||||
*/
|
|
||||||
export function useProposalsQuery(baseOptions?: Apollo.QueryHookOptions<ProposalsQuery, ProposalsQueryVariables>) {
|
|
||||||
const options = {...defaultOptions, ...baseOptions}
|
|
||||||
return Apollo.useQuery<ProposalsQuery, ProposalsQueryVariables>(ProposalsDocument, options);
|
|
||||||
}
|
|
||||||
export function useProposalsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<ProposalsQuery, ProposalsQueryVariables>) {
|
|
||||||
const options = {...defaultOptions, ...baseOptions}
|
|
||||||
return Apollo.useLazyQuery<ProposalsQuery, ProposalsQueryVariables>(ProposalsDocument, options);
|
|
||||||
}
|
|
||||||
export type ProposalsQueryHookResult = ReturnType<typeof useProposalsQuery>;
|
|
||||||
export type ProposalsLazyQueryHookResult = ReturnType<typeof useProposalsLazyQuery>;
|
|
||||||
export type ProposalsQueryResult = Apollo.QueryResult<ProposalsQuery, ProposalsQueryVariables>;
|
|
@ -1,5 +1,4 @@
|
|||||||
export {
|
export {
|
||||||
ProposalsContainer,
|
ProposalsContainer,
|
||||||
ProposalsContainer as default,
|
ProposalsContainer as default,
|
||||||
PROPOSALS_QUERY,
|
|
||||||
} from './proposals-container';
|
} from './proposals-container';
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { gql, useQuery } from '@apollo/client';
|
|
||||||
import { getNotRejectedProposals } from '@vegaprotocol/governance';
|
import { getNotRejectedProposals } from '@vegaprotocol/governance';
|
||||||
import { Callout, Intent, Splash } from '@vegaprotocol/ui-toolkit';
|
import { Callout, Intent, Splash } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
@ -6,129 +5,24 @@ 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 type { Proposals } from './__generated__/Proposals';
|
import { useProposalsQuery } from './__generated__/Proposals';
|
||||||
|
import type { ProposalFieldsFragment } from './__generated__/Proposals';
|
||||||
export const PROPOSAL_FRAGMENT = gql`
|
|
||||||
fragment ProposalFields on Proposal {
|
|
||||||
id
|
|
||||||
rationale {
|
|
||||||
title
|
|
||||||
description
|
|
||||||
}
|
|
||||||
reference
|
|
||||||
state
|
|
||||||
datetime
|
|
||||||
rejectionReason
|
|
||||||
party {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
errorDetails
|
|
||||||
terms {
|
|
||||||
closingDatetime
|
|
||||||
enactmentDatetime
|
|
||||||
change {
|
|
||||||
... on NewMarket {
|
|
||||||
instrument {
|
|
||||||
name
|
|
||||||
code
|
|
||||||
futureProduct {
|
|
||||||
settlementAsset {
|
|
||||||
symbol
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
... on UpdateMarket {
|
|
||||||
marketId
|
|
||||||
}
|
|
||||||
... on NewAsset {
|
|
||||||
__typename
|
|
||||||
name
|
|
||||||
symbol
|
|
||||||
source {
|
|
||||||
... on BuiltinAsset {
|
|
||||||
maxFaucetAmountMint
|
|
||||||
}
|
|
||||||
... on ERC20 {
|
|
||||||
contractAddress
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
... on UpdateNetworkParameter {
|
|
||||||
networkParameter {
|
|
||||||
key
|
|
||||||
value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
... on UpdateAsset {
|
|
||||||
quantum
|
|
||||||
assetId
|
|
||||||
source {
|
|
||||||
... on UpdateERC20 {
|
|
||||||
lifetimeLimit
|
|
||||||
withdrawThreshold
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
votes {
|
|
||||||
yes {
|
|
||||||
totalTokens
|
|
||||||
totalNumber
|
|
||||||
totalEquityLikeShareWeight
|
|
||||||
votes {
|
|
||||||
value
|
|
||||||
party {
|
|
||||||
id
|
|
||||||
stakingSummary {
|
|
||||||
currentStakeAvailable
|
|
||||||
}
|
|
||||||
}
|
|
||||||
datetime
|
|
||||||
}
|
|
||||||
}
|
|
||||||
no {
|
|
||||||
totalTokens
|
|
||||||
totalNumber
|
|
||||||
totalEquityLikeShareWeight
|
|
||||||
votes {
|
|
||||||
value
|
|
||||||
party {
|
|
||||||
id
|
|
||||||
stakingSummary {
|
|
||||||
currentStakeAvailable
|
|
||||||
}
|
|
||||||
}
|
|
||||||
datetime
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
export const PROPOSALS_QUERY = gql`
|
|
||||||
${PROPOSAL_FRAGMENT}
|
|
||||||
query Proposals {
|
|
||||||
proposalsConnection {
|
|
||||||
edges {
|
|
||||||
node {
|
|
||||||
...ProposalFields
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
export const ProposalsContainer = () => {
|
export const ProposalsContainer = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { data, loading, error } = useQuery<Proposals>(PROPOSALS_QUERY, {
|
const { data, loading, error } = useProposalsQuery({
|
||||||
pollInterval: 5000,
|
pollInterval: 5000,
|
||||||
fetchPolicy: 'network-only',
|
fetchPolicy: 'network-only',
|
||||||
errorPolicy: 'ignore',
|
errorPolicy: 'ignore',
|
||||||
});
|
});
|
||||||
|
|
||||||
const proposals = useMemo(() => getNotRejectedProposals(data), [data]);
|
const proposals = useMemo(
|
||||||
|
() =>
|
||||||
|
getNotRejectedProposals<ProposalFieldsFragment>(
|
||||||
|
data?.proposalsConnection
|
||||||
|
),
|
||||||
|
[data]
|
||||||
|
);
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
return (
|
return (
|
||||||
|
@ -5,11 +5,7 @@ import { AppStateProvider } from '../../../../contexts/app-state/app-state-provi
|
|||||||
import { MockedProvider } from '@apollo/client/testing';
|
import { MockedProvider } from '@apollo/client/testing';
|
||||||
import type { VegaWalletContextShape } from '@vegaprotocol/wallet';
|
import type { VegaWalletContextShape } from '@vegaprotocol/wallet';
|
||||||
import { VegaWalletContext } from '@vegaprotocol/wallet';
|
import { VegaWalletContext } from '@vegaprotocol/wallet';
|
||||||
import {
|
import * as Schema from '@vegaprotocol/types';
|
||||||
Schema,
|
|
||||||
ProposalRejectionReason,
|
|
||||||
ProposalState,
|
|
||||||
} from '@vegaprotocol/types';
|
|
||||||
import { ProposeRaw } from './propose-raw';
|
import { ProposeRaw } from './propose-raw';
|
||||||
import { ProposalEventDocument } from '@vegaprotocol/governance';
|
import { ProposalEventDocument } from '@vegaprotocol/governance';
|
||||||
import type { ProposalEventSubscription } from '@vegaprotocol/governance';
|
import type { ProposalEventSubscription } from '@vegaprotocol/governance';
|
||||||
@ -102,9 +98,10 @@ describe('Raw proposal form', () => {
|
|||||||
__typename: 'Proposal',
|
__typename: 'Proposal',
|
||||||
id: '2fca514cebf9f465ae31ecb4c5721e3a6f5f260425ded887ca50ba15b81a5d50',
|
id: '2fca514cebf9f465ae31ecb4c5721e3a6f5f260425ded887ca50ba15b81a5d50',
|
||||||
reference: 'proposal-reference',
|
reference: 'proposal-reference',
|
||||||
state: ProposalState.STATE_OPEN,
|
state: Schema.ProposalState.STATE_OPEN,
|
||||||
rejectionReason:
|
rejectionReason:
|
||||||
ProposalRejectionReason.PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE,
|
Schema.ProposalRejectionReason
|
||||||
|
.PROPOSAL_ERROR_CLOSE_TIME_TOO_LATE,
|
||||||
errorDetails: 'error-details',
|
errorDetails: 'error-details',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
55
apps/token/src/routes/governance/propose/update-market/__generated__/UpdateMarket.ts
generated
Normal file
55
apps/token/src/routes/governance/propose/update-market/__generated__/UpdateMarket.ts
generated
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
import * as Types from '@vegaprotocol/types';
|
||||||
|
|
||||||
|
import { gql } from '@apollo/client';
|
||||||
|
import * as Apollo from '@apollo/client';
|
||||||
|
const defaultOptions = {} as const;
|
||||||
|
export type ProposalMarketsQueryQueryVariables = Types.Exact<{ [key: string]: never; }>;
|
||||||
|
|
||||||
|
|
||||||
|
export type ProposalMarketsQueryQuery = { __typename?: 'Query', marketsConnection?: { __typename?: 'MarketConnection', edges: Array<{ __typename?: 'MarketEdge', node: { __typename?: 'Market', id: string, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string, code: string } } } }> } | null };
|
||||||
|
|
||||||
|
|
||||||
|
export const ProposalMarketsQueryDocument = gql`
|
||||||
|
query ProposalMarketsQuery {
|
||||||
|
marketsConnection {
|
||||||
|
edges {
|
||||||
|
node {
|
||||||
|
id
|
||||||
|
tradableInstrument {
|
||||||
|
instrument {
|
||||||
|
name
|
||||||
|
code
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* __useProposalMarketsQueryQuery__
|
||||||
|
*
|
||||||
|
* To run a query within a React component, call `useProposalMarketsQueryQuery` and pass it any options that fit your needs.
|
||||||
|
* When your component renders, `useProposalMarketsQueryQuery` 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 } = useProposalMarketsQueryQuery({
|
||||||
|
* variables: {
|
||||||
|
* },
|
||||||
|
* });
|
||||||
|
*/
|
||||||
|
export function useProposalMarketsQueryQuery(baseOptions?: Apollo.QueryHookOptions<ProposalMarketsQueryQuery, ProposalMarketsQueryQueryVariables>) {
|
||||||
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
|
return Apollo.useQuery<ProposalMarketsQueryQuery, ProposalMarketsQueryQueryVariables>(ProposalMarketsQueryDocument, options);
|
||||||
|
}
|
||||||
|
export function useProposalMarketsQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<ProposalMarketsQueryQuery, ProposalMarketsQueryQueryVariables>) {
|
||||||
|
const options = {...defaultOptions, ...baseOptions}
|
||||||
|
return Apollo.useLazyQuery<ProposalMarketsQueryQuery, ProposalMarketsQueryQueryVariables>(ProposalMarketsQueryDocument, options);
|
||||||
|
}
|
||||||
|
export type ProposalMarketsQueryQueryHookResult = ReturnType<typeof useProposalMarketsQueryQuery>;
|
||||||
|
export type ProposalMarketsQueryLazyQueryHookResult = ReturnType<typeof useProposalMarketsQueryLazyQuery>;
|
||||||
|
export type ProposalMarketsQueryQueryResult = Apollo.QueryResult<ProposalMarketsQueryQuery, ProposalMarketsQueryQueryVariables>;
|
@ -1,4 +1,4 @@
|
|||||||
import { Schema as Types } from '@vegaprotocol/types';
|
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';
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { useQuery } from '@apollo/client';
|
|
||||||
import { Callout, Intent, Splash } from '@vegaprotocol/ui-toolkit';
|
import { Callout, Intent, Splash } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
@ -6,14 +5,18 @@ import { useTranslation } from 'react-i18next';
|
|||||||
import { SplashLoader } from '../../../components/splash-loader';
|
import { SplashLoader } from '../../../components/splash-loader';
|
||||||
import { RejectedProposalsList } from '../components/proposals-list';
|
import { RejectedProposalsList } from '../components/proposals-list';
|
||||||
import { getRejectedProposals } from '@vegaprotocol/governance';
|
import { getRejectedProposals } from '@vegaprotocol/governance';
|
||||||
import { PROPOSALS_QUERY } from '../proposals';
|
import type { ProposalFieldsFragment } from '../proposals/__generated__/Proposals';
|
||||||
import type { Proposals } from '../proposals/__generated__/Proposals';
|
import { useProposalsQuery } from '../proposals/__generated__/Proposals';
|
||||||
|
|
||||||
export const RejectedProposalsContainer = () => {
|
export const RejectedProposalsContainer = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { data, loading, error } = useQuery<Proposals>(PROPOSALS_QUERY);
|
const { data, loading, error } = useProposalsQuery();
|
||||||
|
|
||||||
const proposals = useMemo(() => getRejectedProposals(data), [data]);
|
const proposals = useMemo(
|
||||||
|
() =>
|
||||||
|
getRejectedProposals<ProposalFieldsFragment>(data?.proposalsConnection),
|
||||||
|
[data]
|
||||||
|
);
|
||||||
|
|
||||||
if (error) {
|
if (error) {
|
||||||
return (
|
return (
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user