From 0d69ffb4a85f1783cb5939af6f962c757018c400 Mon Sep 17 00:00:00 2001 From: malinantonsson Date: Tue, 8 Nov 2022 18:43:35 +0100 Subject: [PATCH 01/34] feat(#1355): liquidity provision dashboard details (#1802) * feat: generate new nx application * feat: add env variables & render a headline * feat: add cypress projectId and delete unused files * feat: render LP grid * feat: create liquidity provision lib * feat: liquidity provision calculate volume * feat: add volume change, generate types * feat: add EnvironmentProvider * feat: add LP health bar * feat: liquidity provision health * feat: liquidity provider dashboard healthbars * feat: liquidity provider dashnoard - add auction trigger * feat: liquidity provider dashboard - display multiple fees * feat: liquidity provision provider refactor * feat: liquidity provision provider refactor * feat: liquidity provision dashboard - add router * feat: liquidity provision open details in new window * feat: liquidity provision details page * feat: liquidity provision details volume * feat: liquidity provision formatting * feat: move market candle providers * feat: liquidity provision styles * feat: add liquidity provision status * feat: liquidity provision details * feat: liquidity move colors * feat: liquidty provision details * feat: fix merge * Feat/lp health bar redesign (#1903) * feat: liquidity provision details page * feat: liquidity provision details * feat: liquidity health bar redesign * feat: fix merge * feat: health bar redesign * feat: add vega colors --- .../src/app/app.tsx | 28 ++- .../app/components/dashboard/dashboard.tsx | 25 +++ .../src/app/components/dashboard/index.tsx | 1 + .../{ => dashboard}/intro/index.tsx | 0 .../{ => dashboard}/intro/intro.tsx | 25 ++- .../{ => dashboard}/market-list/index.tsx | 0 .../dashboard/market-list/market-list.tsx | 171 ++++++++++++++++ .../src/app/components/detail/detail.tsx | 107 ++++++++++ .../app/components/detail/header/header.tsx | 26 +++ .../components/{ => detail}/header/index.tsx | 0 .../src/app/components/detail/index.tsx | 1 + .../detail/last-24h-volume/index.tsx | 1 + .../last-24h-volume/last-24h-volume.tsx | 110 ++++++++++ .../app/components/detail/market/index.tsx | 1 + .../app/components/detail/market/market.tsx | 118 +++++++++++ .../app/components/detail/providers/index.tsx | 1 + .../components/detail/providers/providers.tsx | 77 +++++++ .../src/app/components/grid/grid.scss | 50 +++++ .../src/app/components/grid/grid.tsx | 51 +++++ .../src/app/components/grid/index.tsx | 1 + .../src/app/components/header/header.tsx | 12 -- .../health-bar.tsx | 113 ++++++----- .../src/app/components/health-bar/index.tsx | 1 + .../health-dialog.tsx | 37 ++-- .../app/components/health-dialog/index.tsx | 1 + .../src/app/components/indicator/index.tsx | 1 + .../app/components/indicator/indicator.tsx | 24 +++ .../components/market-list/market-list.tsx | 189 ------------------ .../src/app/components/navbar/index.tsx | 1 + .../src/app/components/navbar/navbar.tsx | 15 ++ .../src/app/components/status/index.tsx | 1 + .../src/app/components/status/status.tsx | 45 +++++ .../src/app/lib/utils.tsx | 12 ++ .../src/app/routes/index.ts | 1 + .../src/app/routes/router-config.tsx | 25 +++ .../src/main.tsx | 14 +- .../tailwind.config.js | 15 +- .../liquidity/src/lib/MarketLiquidity.graphql | 2 + .../src/lib/__generated__/MarketLiquidity.ts | 6 +- .../src/lib/markets-liquidity-provider.ts | 2 +- .../src/lib/utils/liquidity-utils.ts | 27 +-- .../src/vega-custom-classes.js | 3 + 42 files changed, 1027 insertions(+), 314 deletions(-) create mode 100644 apps/liquidity-provision-dashboard/src/app/components/dashboard/dashboard.tsx create mode 100644 apps/liquidity-provision-dashboard/src/app/components/dashboard/index.tsx rename apps/liquidity-provision-dashboard/src/app/components/{ => dashboard}/intro/index.tsx (100%) rename apps/liquidity-provision-dashboard/src/app/components/{ => dashboard}/intro/intro.tsx (55%) rename apps/liquidity-provision-dashboard/src/app/components/{ => dashboard}/market-list/index.tsx (100%) create mode 100644 apps/liquidity-provision-dashboard/src/app/components/dashboard/market-list/market-list.tsx create mode 100644 apps/liquidity-provision-dashboard/src/app/components/detail/detail.tsx create mode 100644 apps/liquidity-provision-dashboard/src/app/components/detail/header/header.tsx rename apps/liquidity-provision-dashboard/src/app/components/{ => detail}/header/index.tsx (100%) create mode 100644 apps/liquidity-provision-dashboard/src/app/components/detail/index.tsx create mode 100644 apps/liquidity-provision-dashboard/src/app/components/detail/last-24h-volume/index.tsx create mode 100644 apps/liquidity-provision-dashboard/src/app/components/detail/last-24h-volume/last-24h-volume.tsx create mode 100644 apps/liquidity-provision-dashboard/src/app/components/detail/market/index.tsx create mode 100644 apps/liquidity-provision-dashboard/src/app/components/detail/market/market.tsx create mode 100644 apps/liquidity-provision-dashboard/src/app/components/detail/providers/index.tsx create mode 100644 apps/liquidity-provision-dashboard/src/app/components/detail/providers/providers.tsx create mode 100644 apps/liquidity-provision-dashboard/src/app/components/grid/grid.scss create mode 100644 apps/liquidity-provision-dashboard/src/app/components/grid/grid.tsx create mode 100644 apps/liquidity-provision-dashboard/src/app/components/grid/index.tsx delete mode 100644 apps/liquidity-provision-dashboard/src/app/components/header/header.tsx rename apps/liquidity-provision-dashboard/src/app/components/{market-list => health-bar}/health-bar.tsx (56%) create mode 100644 apps/liquidity-provision-dashboard/src/app/components/health-bar/index.tsx rename apps/liquidity-provision-dashboard/src/app/components/{market-list => health-dialog}/health-dialog.tsx (66%) create mode 100644 apps/liquidity-provision-dashboard/src/app/components/health-dialog/index.tsx create mode 100644 apps/liquidity-provision-dashboard/src/app/components/indicator/index.tsx create mode 100644 apps/liquidity-provision-dashboard/src/app/components/indicator/indicator.tsx delete mode 100644 apps/liquidity-provision-dashboard/src/app/components/market-list/market-list.tsx create mode 100644 apps/liquidity-provision-dashboard/src/app/components/navbar/index.tsx create mode 100644 apps/liquidity-provision-dashboard/src/app/components/navbar/navbar.tsx create mode 100644 apps/liquidity-provision-dashboard/src/app/components/status/index.tsx create mode 100644 apps/liquidity-provision-dashboard/src/app/components/status/status.tsx create mode 100644 apps/liquidity-provision-dashboard/src/app/lib/utils.tsx create mode 100644 apps/liquidity-provision-dashboard/src/app/routes/index.ts create mode 100644 apps/liquidity-provision-dashboard/src/app/routes/router-config.tsx diff --git a/apps/liquidity-provision-dashboard/src/app/app.tsx b/apps/liquidity-provision-dashboard/src/app/app.tsx index ae18a510e..477825040 100644 --- a/apps/liquidity-provision-dashboard/src/app/app.tsx +++ b/apps/liquidity-provision-dashboard/src/app/app.tsx @@ -1,15 +1,27 @@ +import { ThemeContext } from '@vegaprotocol/react-helpers'; +import { useRoutes } from 'react-router-dom'; +import { EnvironmentProvider, NetworkLoader } from '@vegaprotocol/environment'; +import { createClient } from './lib/apollo-client'; + import '../styles.scss'; -import { Header } from './components/header'; -import { Intro } from './components/intro'; -import { MarketList } from './components/market-list'; +import { Navbar } from './components/navbar'; + +import { routerConfig } from './routes/router-config'; + +const AppRouter = () => useRoutes(routerConfig); export function App() { return ( -
-
- - -
+ + + +
+ + +
+
+
+
); } diff --git a/apps/liquidity-provision-dashboard/src/app/components/dashboard/dashboard.tsx b/apps/liquidity-provision-dashboard/src/app/components/dashboard/dashboard.tsx new file mode 100644 index 000000000..0d23dcd8b --- /dev/null +++ b/apps/liquidity-provision-dashboard/src/app/components/dashboard/dashboard.tsx @@ -0,0 +1,25 @@ +import { t } from '@vegaprotocol/react-helpers'; + +import { Intro } from './intro'; +import { MarketList } from './market-list'; + +export function Dashboard() { + return ( + <> +
+
+

+ {t('Top liquidity opportunities')} +

+ + +
+
+
+
+ +
+
+ + ); +} diff --git a/apps/liquidity-provision-dashboard/src/app/components/dashboard/index.tsx b/apps/liquidity-provision-dashboard/src/app/components/dashboard/index.tsx new file mode 100644 index 000000000..b58b6c922 --- /dev/null +++ b/apps/liquidity-provision-dashboard/src/app/components/dashboard/index.tsx @@ -0,0 +1 @@ +export * from './dashboard'; diff --git a/apps/liquidity-provision-dashboard/src/app/components/intro/index.tsx b/apps/liquidity-provision-dashboard/src/app/components/dashboard/intro/index.tsx similarity index 100% rename from apps/liquidity-provision-dashboard/src/app/components/intro/index.tsx rename to apps/liquidity-provision-dashboard/src/app/components/dashboard/intro/index.tsx diff --git a/apps/liquidity-provision-dashboard/src/app/components/intro/intro.tsx b/apps/liquidity-provision-dashboard/src/app/components/dashboard/intro/intro.tsx similarity index 55% rename from apps/liquidity-provision-dashboard/src/app/components/intro/intro.tsx rename to apps/liquidity-provision-dashboard/src/app/components/dashboard/intro/intro.tsx index 4ed115549..8e407330e 100644 --- a/apps/liquidity-provision-dashboard/src/app/components/intro/intro.tsx +++ b/apps/liquidity-provision-dashboard/src/app/components/dashboard/intro/intro.tsx @@ -5,19 +5,19 @@ import { ExternalLink } from '@vegaprotocol/ui-toolkit'; const LINKS = { testnet: [ { - label: 'Understand how liquidity fees are calculated', - url: 'https://docs.vega.xyz/testnet/tutorials/providing-liquidity#resources', + label: 'Learn about liquidity fees', + url: 'https://docs.vega.xyz/docs/testnet/tutorials/providing-liquidity#resources', }, { - label: 'How to provide liquidity', - url: 'https://docs.vega.xyz/testnet/tutorials/providing-liquidity#overview', + label: 'Provide liquidity', + url: 'https://docs.vega.xyz/docs/testnet/tutorials/providing-liquidity#overview', }, { - label: 'How to view existing liquidity provisions', - url: 'https://docs.vega.xyz/testnet/tutorials/providing-liquidity#viewing-existing-liquidity-provisions', + label: 'View your liquidity provisions', + url: 'https://docs.vega.xyz/docs/testnet/tutorials/providing-liquidity#viewing-existing-liquidity-provisions', }, { - label: 'How to amend or remove liquidity', + label: 'Amend or remove liquidity', url: 'https://docs.vega.xyz/testnet/tutorials/providing-liquidity#amending-a-liquidity-commitment', }, ], @@ -29,12 +29,11 @@ type Network = 'testnet' | 'mainnet'; export const Intro = ({ network = 'testnet' }: { network?: Network }) => { return ( -
-

- {t('Become a liquidity provider')} -

-

- {t('Earn a cut of the fees paid by price takers during trading.')} +

+

+ {t( + 'Become a liquidity provider and earn a cut of the fees paid during trading.' + )}

    diff --git a/apps/liquidity-provision-dashboard/src/app/components/market-list/index.tsx b/apps/liquidity-provision-dashboard/src/app/components/dashboard/market-list/index.tsx similarity index 100% rename from apps/liquidity-provision-dashboard/src/app/components/market-list/index.tsx rename to apps/liquidity-provision-dashboard/src/app/components/dashboard/market-list/index.tsx diff --git a/apps/liquidity-provision-dashboard/src/app/components/dashboard/market-list/market-list.tsx b/apps/liquidity-provision-dashboard/src/app/components/dashboard/market-list/market-list.tsx new file mode 100644 index 000000000..46a70647a --- /dev/null +++ b/apps/liquidity-provision-dashboard/src/app/components/dashboard/market-list/market-list.tsx @@ -0,0 +1,171 @@ +import { useCallback, useState } from 'react'; +import { AgGridColumn } from 'ag-grid-react'; +import type { + ValueFormatterParams, + GetRowIdParams, + RowClickedEvent, +} from 'ag-grid-community'; +import 'ag-grid-community/dist/styles/ag-grid.css'; +import 'ag-grid-community/dist/styles/ag-theme-alpine.css'; +import { t, addDecimalsFormatNumber } from '@vegaprotocol/react-helpers'; +import { Icon, AsyncRenderer } from '@vegaprotocol/ui-toolkit'; +import type { Market } from '@vegaprotocol/liquidity'; +import { + useMarketsLiquidity, + formatWithAsset, + displayChange, +} from '@vegaprotocol/liquidity'; +import type { MarketTradingMode } from '@vegaprotocol/types'; + +import { HealthBar } from '../../health-bar'; +import { Grid } from '../../grid'; +import { HealthDialog } from '../../health-dialog'; +import { Status } from '../../status'; + +export const MarketList = () => { + const { data, error, loading } = useMarketsLiquidity(); + const [isHealthDialogOpen, setIsHealthDialogOpen] = useState(false); + + const getRowId = useCallback(({ data }: GetRowIdParams) => data.id, []); + + const localData = data?.markets; + + return ( + +
    + { + window.open( + `/markets/${data.id}`, + '_blank', + 'noopener,noreferrer' + ); + }, + }} + rowData={localData} + defaultColDef={{ + resizable: true, + sortable: true, + unSortIcon: true, + cellClass: ['flex', 'flex-col', 'justify-center'], + }} + getRowId={getRowId} + isRowClickable + > + { + return ( + <> + {value} + + { + data?.tradableInstrument?.instrument?.product + ?.settlementAsset?.symbol + } + + + ); + }} + minWidth={100} + flex="1" + /> + + + `${addDecimalsFormatNumber( + value, + data.tradableInstrument.instrument.product.settlementAsset + .decimals + )} (${displayChange(data.volumeChange)})` + } + /> + + + formatWithAsset( + value, + data.tradableInstrument.instrument.product.settlementAsset + ) + } + /> + + { + return ( + + ); + }} + /> + + { + return ( +
    + {t('Health')}{' '} + +
    + ); + }} + field="tradingMode" + cellRenderer={({ + value, + data, + }: { + value: MarketTradingMode; + data: Market; + }) => ( + + )} + sortable={false} + cellStyle={{ overflow: 'unset' }} + /> + +
    + + { + setIsHealthDialogOpen(!isHealthDialogOpen); + }} + /> +
    +
    + ); +}; diff --git a/apps/liquidity-provision-dashboard/src/app/components/detail/detail.tsx b/apps/liquidity-provision-dashboard/src/app/components/detail/detail.tsx new file mode 100644 index 000000000..ac7297b8c --- /dev/null +++ b/apps/liquidity-provision-dashboard/src/app/components/detail/detail.tsx @@ -0,0 +1,107 @@ +import { useParams } from 'react-router-dom'; +import { useMemo } from 'react'; +import { + t, + useDataProvider, + makeDerivedDataProvider, +} from '@vegaprotocol/react-helpers'; +import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; + +import { + getFeeLevels, + sumLiquidityCommitted, + marketLiquidityDataProvider, + liquidityProvisionsDataProvider, +} from '@vegaprotocol/liquidity'; +import type { MarketLpQuery } from '@vegaprotocol/liquidity'; + +import { Market } from './market'; +import { Header } from './header'; +import { LPProvidersGrid } from './providers'; + +const formatMarket = (data: MarketLpQuery) => { + return { + name: data?.market?.tradableInstrument.instrument.name, + symbol: + data?.market?.tradableInstrument.instrument.product.settlementAsset + .symbol, + settlementAsset: + data?.market?.tradableInstrument.instrument.product.settlementAsset, + targetStake: data?.market?.data?.targetStake, + tradingMode: data?.market?.data?.marketTradingMode, + trigger: data?.market?.data?.trigger, + }; +}; + +export const lpDataProvider = makeDerivedDataProvider( + [marketLiquidityDataProvider, liquidityProvisionsDataProvider], + ([market, providers]) => ({ + market: { ...formatMarket(market) }, + liquidityProviders: providers || [], + }) +); + +const useMarketDetails = (marketId: string | undefined) => { + const { data, loading, error } = useDataProvider({ + dataProvider: lpDataProvider, + noUpdate: true, + variables: useMemo(() => ({ marketId }), [marketId]), + }); + + const liquidityProviders = data?.liquidityProviders || []; + + return { + data: { + name: data?.market?.name, + symbol: data?.market?.symbol, + liquidityProviders: liquidityProviders, + feeLevels: getFeeLevels(liquidityProviders), + comittedLiquidity: sumLiquidityCommitted(liquidityProviders) || 0, + settlementAsset: data?.market?.settlementAsset || {}, + targetStake: data?.market?.targetStake || '0', + tradingMode: data?.market.tradingMode, + }, + error, + loading: loading, + }; +}; + +export const Detail = () => { + const { marketId } = useParams<{ marketId: string }>(); + const { data, loading, error } = useMarketDetails(marketId); + + return ( + +
    +
    +
    +
    +
    +
    +
    +
    + {marketId && ( + + )} +
    +
    +

    + {t('Current Liquidity Provision')} +

    + +
    +
    +
    +
    + ); +}; diff --git a/apps/liquidity-provision-dashboard/src/app/components/detail/header/header.tsx b/apps/liquidity-provision-dashboard/src/app/components/detail/header/header.tsx new file mode 100644 index 000000000..c56ad7929 --- /dev/null +++ b/apps/liquidity-provision-dashboard/src/app/components/detail/header/header.tsx @@ -0,0 +1,26 @@ +import { t } from '@vegaprotocol/react-helpers'; +import { Link } from 'react-router-dom'; +import { Icon } from '@vegaprotocol/ui-toolkit'; + +export const Header = ({ + name, + symbol, +}: { + name?: string; + symbol?: string; +}) => { + return ( +
    +
    + + + + {t('Liquidity opportunities')} + + +
    +

    {name}

    +

    {symbol}

    +
    + ); +}; diff --git a/apps/liquidity-provision-dashboard/src/app/components/header/index.tsx b/apps/liquidity-provision-dashboard/src/app/components/detail/header/index.tsx similarity index 100% rename from apps/liquidity-provision-dashboard/src/app/components/header/index.tsx rename to apps/liquidity-provision-dashboard/src/app/components/detail/header/index.tsx diff --git a/apps/liquidity-provision-dashboard/src/app/components/detail/index.tsx b/apps/liquidity-provision-dashboard/src/app/components/detail/index.tsx new file mode 100644 index 000000000..15e42dcdb --- /dev/null +++ b/apps/liquidity-provision-dashboard/src/app/components/detail/index.tsx @@ -0,0 +1 @@ +export * from './detail'; diff --git a/apps/liquidity-provision-dashboard/src/app/components/detail/last-24h-volume/index.tsx b/apps/liquidity-provision-dashboard/src/app/components/detail/last-24h-volume/index.tsx new file mode 100644 index 000000000..14d12f818 --- /dev/null +++ b/apps/liquidity-provision-dashboard/src/app/components/detail/last-24h-volume/index.tsx @@ -0,0 +1 @@ +export * from './last-24h-volume'; diff --git a/apps/liquidity-provision-dashboard/src/app/components/detail/last-24h-volume/last-24h-volume.tsx b/apps/liquidity-provision-dashboard/src/app/components/detail/last-24h-volume/last-24h-volume.tsx new file mode 100644 index 000000000..f7f8f3f42 --- /dev/null +++ b/apps/liquidity-provision-dashboard/src/app/components/detail/last-24h-volume/last-24h-volume.tsx @@ -0,0 +1,110 @@ +import { useState, useMemo, useRef, useCallback } from 'react'; +import throttle from 'lodash/throttle'; +import { + useYesterday, + useDataProvider, + addDecimalsFormatNumber, +} from '@vegaprotocol/react-helpers'; +import { Interval } from '@vegaprotocol/types'; +import { + calcDayVolume, + getChange, + displayChange, +} from '@vegaprotocol/liquidity'; + +import type { Candle } from '@vegaprotocol/market-list'; +import { marketCandlesProvider } from '@vegaprotocol/market-list'; + +const DEBOUNCE_UPDATE_TIME = 500; + +export const Last24hVolume = ({ + marketId, + decimals, +}: { + marketId: string; + decimals: number; +}) => { + const [candleVolume, setCandleVolume] = useState(); + const [volumeChange, setVolumeChange] = useState(' - '); + + const yesterday = useYesterday(); + + const yTimestamp = useMemo(() => { + return new Date(yesterday).toISOString(); + }, [yesterday]); + + const variables = useMemo( + () => ({ + marketId: marketId, + interval: Interval.INTERVAL_I1H, + since: yTimestamp, + }), + [marketId, yTimestamp] + ); + + const variables24hAgo = useMemo( + () => ({ + marketId: marketId, + interval: Interval.INTERVAL_I1D, + since: yTimestamp, + }), + [marketId, yTimestamp] + ); + + const throttledSetCandles = useRef( + throttle((data: Candle[]) => { + setCandleVolume(calcDayVolume(data)); + }, DEBOUNCE_UPDATE_TIME) + ).current; + + const update = useCallback( + ({ data }: { data: Candle[] }) => { + throttledSetCandles(data); + return true; + }, + [throttledSetCandles] + ); + + const { data, error } = useDataProvider({ + dataProvider: marketCandlesProvider, + variables: variables, + update, + skip: !marketId, + }); + + const throttledSetVolumeChange = useRef( + throttle((candles: Candle[]) => { + const candle24hAgo = candles?.[0]; + setVolumeChange(getChange(data || [], candle24hAgo?.close)); + }, DEBOUNCE_UPDATE_TIME) + ).current; + + const updateCandle24hAgo = useCallback( + ({ data }: { data: Candle[] }) => { + throttledSetVolumeChange(data); + return true; + }, + [throttledSetVolumeChange] + ); + + useDataProvider({ + dataProvider: marketCandlesProvider, + update: updateCandle24hAgo, + variables: variables24hAgo, + skip: !marketId || !data, + updateOnInit: true, + }); + + return ( +
    + + {!error && candleVolume + ? addDecimalsFormatNumber(candleVolume, decimals) + : '0'}{' '} + + + ({displayChange(volumeChange)}) + +
    + ); +}; diff --git a/apps/liquidity-provision-dashboard/src/app/components/detail/market/index.tsx b/apps/liquidity-provision-dashboard/src/app/components/detail/market/index.tsx new file mode 100644 index 000000000..9fc9e360b --- /dev/null +++ b/apps/liquidity-provision-dashboard/src/app/components/detail/market/index.tsx @@ -0,0 +1 @@ +export * from './market'; diff --git a/apps/liquidity-provision-dashboard/src/app/components/detail/market/market.tsx b/apps/liquidity-provision-dashboard/src/app/components/detail/market/market.tsx new file mode 100644 index 000000000..bbd262503 --- /dev/null +++ b/apps/liquidity-provision-dashboard/src/app/components/detail/market/market.tsx @@ -0,0 +1,118 @@ +import { useState } from 'react'; +import { t } from '@vegaprotocol/react-helpers'; +import { Icon } from '@vegaprotocol/ui-toolkit'; +import { formatWithAsset } from '@vegaprotocol/liquidity'; + +import type { MarketTradingMode, AuctionTrigger } from '@vegaprotocol/types'; +import { HealthBar } from '../../health-bar'; +import { HealthDialog } from '../../health-dialog'; +import { Last24hVolume } from '../last-24h-volume'; +import { Status } from '../../status'; + +interface Levels { + fee: string; + commitmentAmount: number; +} + +interface settlementAsset { + symbol?: string; + decimals?: number; +} + +export const Market = ({ + marketId, + feeLevels, + comittedLiquidity, + settlementAsset, + targetStake, + tradingMode, + trigger, +}: { + marketId: string; + feeLevels: Levels[]; + comittedLiquidity: number; + targetStake: string; + settlementAsset?: settlementAsset; + tradingMode?: MarketTradingMode; + trigger?: AuctionTrigger; +}) => { + const [isHealthDialogOpen, setIsHealthDialogOpen] = useState(false); + + return ( +
    +
    + + + + + + + + + + + + + + + + + + + +
    {t('Volume (24h)')}{t('Commited Liquidity')}{t('Status')} + {t('Health')}{' '} + + {t('Est. APY')}
    +
    + {marketId && settlementAsset?.decimals && ( + + )} +
    +
    + + {comittedLiquidity && settlementAsset + ? formatWithAsset(`${comittedLiquidity}`, settlementAsset) + : '0'} + + + + + {tradingMode && settlementAsset?.decimals && feeLevels && ( + + )} + + +
    +
    + + { + setIsHealthDialogOpen(!isHealthDialogOpen); + }} + /> +
    + ); +}; diff --git a/apps/liquidity-provision-dashboard/src/app/components/detail/providers/index.tsx b/apps/liquidity-provision-dashboard/src/app/components/detail/providers/index.tsx new file mode 100644 index 000000000..254ec8d9f --- /dev/null +++ b/apps/liquidity-provision-dashboard/src/app/components/detail/providers/index.tsx @@ -0,0 +1 @@ +export * from './providers'; diff --git a/apps/liquidity-provision-dashboard/src/app/components/detail/providers/providers.tsx b/apps/liquidity-provision-dashboard/src/app/components/detail/providers/providers.tsx new file mode 100644 index 000000000..942862426 --- /dev/null +++ b/apps/liquidity-provision-dashboard/src/app/components/detail/providers/providers.tsx @@ -0,0 +1,77 @@ +import { useCallback } from 'react'; +import { AgGridColumn } from 'ag-grid-react'; + +import type { GetRowIdParams } from 'ag-grid-community'; +import { t } from '@vegaprotocol/react-helpers'; + +import type { LiquidityProvisionFieldsFragment } from '@vegaprotocol/liquidity'; +import { formatWithAsset } from '@vegaprotocol/liquidity'; + +import { Grid } from '../../grid'; + +const formatToHours = ({ value }: { value?: string | null }) => { + if (!value) { + return '-'; + } + + const MS_IN_HOUR = 1000 * 60 * 60; + const created = new Date(value).getTime(); + const now = new Date().getTime(); + return `${Math.round(Math.abs(now - created) / MS_IN_HOUR)}h`; +}; + +export const LPProvidersGrid = ({ + liquidityProviders, + settlementAsset, +}: { + liquidityProviders: LiquidityProvisionFieldsFragment[]; + settlementAsset: { + decimals?: number; + symbol?: string; + }; +}) => { + const getRowId = useCallback(({ data }: GetRowIdParams) => data.party.id, []); + + return ( + + + + + + value ? formatWithAsset(value, settlementAsset) : '0' + } + /> + + + `${value}%`} + field="fee" + /> + + + + ); +}; diff --git a/apps/liquidity-provision-dashboard/src/app/components/grid/grid.scss b/apps/liquidity-provision-dashboard/src/app/components/grid/grid.scss new file mode 100644 index 000000000..2b1ac6601 --- /dev/null +++ b/apps/liquidity-provision-dashboard/src/app/components/grid/grid.scss @@ -0,0 +1,50 @@ +.ag-theme-alpine { + --ag-line-height: 24px; + --ag-row-hover-color: transparent; + --ag-header-background-color: transparent; + --ag-odd-row-background-color: transparent; + --ag-header-foreground-color: #626262; + --ag-secondary-foreground-color: #626262; + --ag-font-size: 16px; + --ag-background-color: transparent; + --ag-range-selection-border-color: transparent; + + font-family: AlphaLyrae, Helvetica Neue, -apple-system, BlinkMacSystemFont, + Segoe UI, Roboto, Arial, Noto Sans, sans-serif, Apple Color Emoji, + Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji; + font-feature-settings: 'liga' off, 'calt' off; +} + +.ag-theme-alpine .ag-cell { + display: flex; +} + +.ag-theme-alpine .ag-header { + border-bottom: 1px solid #a7a7a7; + font-size: 15px; + line-height: 1em; + text-transform: uppercase; +} + +.ag-theme-alpine .ag-root-wrapper { + border: none; +} + +.ag-theme-alpine .ag-header-row { + font-weight: 500; +} + +.ag-theme-alpine .ag-row { + border: none; + border-bottom: 1px solid #bfccd6; + font-size: 12px; +} + +.ag-theme-alpine .ag-root-wrapper-body.ag-layout-normal { + height: auto; +} + +.ag-theme-alpine.row-hover .ag-row:hover { + background: #f0f0f0; + cursor: pointer; +} diff --git a/apps/liquidity-provision-dashboard/src/app/components/grid/grid.tsx b/apps/liquidity-provision-dashboard/src/app/components/grid/grid.tsx new file mode 100644 index 000000000..531b19eb6 --- /dev/null +++ b/apps/liquidity-provision-dashboard/src/app/components/grid/grid.tsx @@ -0,0 +1,51 @@ +import { useRef, useCallback, useEffect } from 'react'; +import type { ReactNode } from 'react'; +import { AgGridReact } from 'ag-grid-react'; +import type { + AgGridReactProps, + AgReactUiProps, + AgGridReact as AgGridReactType, +} from 'ag-grid-react'; +import classNames from 'classnames'; +import 'ag-grid-community/dist/styles/ag-grid.css'; +import 'ag-grid-community/dist/styles/ag-theme-alpine.css'; + +import './grid.scss'; + +type Props = (AgGridReactProps | AgReactUiProps) & { + isRowClickable?: boolean; + style?: React.CSSProperties; + children: ReactNode; +}; + +export const Grid = ({ isRowClickable, children, ...props }: Props) => { + const gridRef = useRef(null); + + const resizeGrid = useCallback(() => { + gridRef.current?.api?.sizeColumnsToFit(); + }, [gridRef]); + + const handleOnGridReady = useCallback(() => { + resizeGrid(); + }, [resizeGrid]); + + useEffect(() => { + window.addEventListener('resize', resizeGrid); + return () => window.removeEventListener('resize', resizeGrid); + }, [resizeGrid]); + + return ( + + {children} + + ); +}; diff --git a/apps/liquidity-provision-dashboard/src/app/components/grid/index.tsx b/apps/liquidity-provision-dashboard/src/app/components/grid/index.tsx new file mode 100644 index 000000000..d24d1bdc0 --- /dev/null +++ b/apps/liquidity-provision-dashboard/src/app/components/grid/index.tsx @@ -0,0 +1 @@ +export * from './grid'; diff --git a/apps/liquidity-provision-dashboard/src/app/components/header/header.tsx b/apps/liquidity-provision-dashboard/src/app/components/header/header.tsx deleted file mode 100644 index 352fd6741..000000000 --- a/apps/liquidity-provision-dashboard/src/app/components/header/header.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { t } from '@vegaprotocol/react-helpers'; - -export const Header = () => { - return ( -
    -

    {t('Top liquidity opportunities')}

    -
    - {t('Network switcher')} -
    -
    - ); -}; diff --git a/apps/liquidity-provision-dashboard/src/app/components/market-list/health-bar.tsx b/apps/liquidity-provision-dashboard/src/app/components/health-bar/health-bar.tsx similarity index 56% rename from apps/liquidity-provision-dashboard/src/app/components/market-list/health-bar.tsx rename to apps/liquidity-provision-dashboard/src/app/components/health-bar/health-bar.tsx index ebf819fc7..3d2e5712f 100644 --- a/apps/liquidity-provision-dashboard/src/app/components/market-list/health-bar.tsx +++ b/apps/liquidity-provision-dashboard/src/app/components/health-bar/health-bar.tsx @@ -1,18 +1,19 @@ import classNames from 'classnames'; -import { MarketTradingMode } from '@vegaprotocol/types'; +import type { MarketTradingMode } from '@vegaprotocol/types'; import { t, addDecimalsFormatNumber } from '@vegaprotocol/react-helpers'; import { BigNumber } from 'bignumber.js'; import type { ReactNode } from 'react'; -const marketTradingModeStyle = { - [MarketTradingMode.TRADING_MODE_CONTINUOUS]: '#00a88a', - [MarketTradingMode.TRADING_MODE_MONITORING_AUCTION]: '#fb8e7f', - [MarketTradingMode.TRADING_MODE_OPENING_AUCTION]: '#68e2e4', - [MarketTradingMode.TRADING_MODE_BATCH_AUCTION]: 'batch', - [MarketTradingMode.TRADING_MODE_NO_TRADING]: 'none', -}; +import { getColorForStatus } from '../../lib/utils'; -const COPY_CLASS = 'text-[8px] leading-[1.2em] font-medium'; +import { Indicator } from '../indicator'; + +const Remainder = () => ( +
    +); + +const COPY_CLASS = + 'text-sm font-medium whitespace-nowrap text-white font-alpha'; const Tooltip = ({ children, @@ -24,27 +25,13 @@ const Tooltip = ({ return (
    -
    -
    {children}
    ); @@ -62,17 +49,20 @@ const Target = ({ return (
    - {children} -
    + className={classNames( + 'health-target w-0.5 bg-black group-hover:scale-x-150 group-hover:scale-y-108', + { + 'h-6': !isLarge, + 'h-12': isLarge, + } + )} + >
    + {children}
); }; @@ -81,14 +71,14 @@ const Level = ({ children, commitmentAmount, total, - index, - status, + backgroundColor, + opacity, }: { children: ReactNode; - index: number; - status: MarketTradingMode; commitmentAmount: number; total: number; + backgroundColor: string; + opacity: number; }) => { const width = new BigNumber(commitmentAmount) .div(total) @@ -97,26 +87,26 @@ const Level = ({ return (
+ {children}
); }; const Full = () => ( -
+
); interface Levels { @@ -126,7 +116,7 @@ interface Levels { export const HealthBar = ({ status, - target, + target = '0', decimals, levels, size = 'small', @@ -151,6 +141,7 @@ export const HealthBar = ({ targetNumber * 2 >= committedNumber ? targetNumber * 2 : committedNumber; const targetPercent = (targetNumber / total) * 100; const isLarge = size === 'large'; + const backgroundColor = getColorForStatus(status); return (
@@ -168,36 +159,50 @@ export const HealthBar = ({ > -
+
{levels.map((p, index) => { const { commitmentAmount, fee } = p; - + const prevLevel = levels[index - 1]?.commitmentAmount; + const opacity = 1 - 0.2 * index; return ( - - {fee}% {t('Fee')} - - - {addDecimalsFormatNumber(commitmentAmount, decimals)} - +
+ +
+
+ + {fee}% {t('Fee')} + + + {prevLevel + ? addDecimalsFormatNumber(prevLevel, decimals) + : '0'}{' '} + - {addDecimalsFormatNumber(commitmentAmount, decimals)} + +
); })} + {(total !== committedNumber || levels.length === 0) && ( + + )}
- {t('Target stake')} +
+ +
- {addDecimalsFormatNumber(target, decimals)} + {t('Target stake')} {addDecimalsFormatNumber(target, decimals)}
diff --git a/apps/liquidity-provision-dashboard/src/app/components/health-bar/index.tsx b/apps/liquidity-provision-dashboard/src/app/components/health-bar/index.tsx new file mode 100644 index 000000000..635dc36e5 --- /dev/null +++ b/apps/liquidity-provision-dashboard/src/app/components/health-bar/index.tsx @@ -0,0 +1 @@ +export * from './health-bar'; diff --git a/apps/liquidity-provision-dashboard/src/app/components/market-list/health-dialog.tsx b/apps/liquidity-provision-dashboard/src/app/components/health-dialog/health-dialog.tsx similarity index 66% rename from apps/liquidity-provision-dashboard/src/app/components/market-list/health-dialog.tsx rename to apps/liquidity-provision-dashboard/src/app/components/health-dialog/health-dialog.tsx index d813fa1f3..7b7e1266a 100644 --- a/apps/liquidity-provision-dashboard/src/app/components/market-list/health-dialog.tsx +++ b/apps/liquidity-provision-dashboard/src/app/components/health-dialog/health-dialog.tsx @@ -1,8 +1,9 @@ import { t } from '@vegaprotocol/react-helpers'; import { Dialog } from '@vegaprotocol/ui-toolkit'; import { MarketTradingMode } from '@vegaprotocol/types'; +import classNames from 'classnames'; -import { HealthBar } from './health-bar'; +import { HealthBar } from '../health-bar'; interface HealthDialogProps { isOpen: boolean; @@ -58,36 +59,48 @@ const ROWS = [ export const HealthDialog = ({ onChange, isOpen }: HealthDialogProps) => { return ( -

+

{t('Health')}

-

+

{t( 'Market health is a representation of market and liquidity status and how close that market is to moving from one fee level to another.' )}

- - - + + + - {ROWS.map((r) => { + {ROWS.map((r, index) => { + const isFirstRow = index === 0; return ( - - diff --git a/apps/liquidity-provision-dashboard/src/app/components/health-dialog/index.tsx b/apps/liquidity-provision-dashboard/src/app/components/health-dialog/index.tsx new file mode 100644 index 000000000..935474263 --- /dev/null +++ b/apps/liquidity-provision-dashboard/src/app/components/health-dialog/index.tsx @@ -0,0 +1 @@ +export * from './health-dialog'; diff --git a/apps/liquidity-provision-dashboard/src/app/components/indicator/index.tsx b/apps/liquidity-provision-dashboard/src/app/components/indicator/index.tsx new file mode 100644 index 000000000..ef086afd6 --- /dev/null +++ b/apps/liquidity-provision-dashboard/src/app/components/indicator/index.tsx @@ -0,0 +1 @@ +export * from './indicator'; diff --git a/apps/liquidity-provision-dashboard/src/app/components/indicator/indicator.tsx b/apps/liquidity-provision-dashboard/src/app/components/indicator/indicator.tsx new file mode 100644 index 000000000..392ce9462 --- /dev/null +++ b/apps/liquidity-provision-dashboard/src/app/components/indicator/indicator.tsx @@ -0,0 +1,24 @@ +import type { MarketTradingMode } from '@vegaprotocol/types'; + +import { getColorForStatus } from '../../lib/utils'; + +export const Indicator = ({ + status, + opacity, +}: { + status?: MarketTradingMode; + opacity?: number; +}) => { + const backgroundColor = status ? getColorForStatus(status) : undefined; + return ( +
+
+
+ ); +}; diff --git a/apps/liquidity-provision-dashboard/src/app/components/market-list/market-list.tsx b/apps/liquidity-provision-dashboard/src/app/components/market-list/market-list.tsx deleted file mode 100644 index 3a5fbe623..000000000 --- a/apps/liquidity-provision-dashboard/src/app/components/market-list/market-list.tsx +++ /dev/null @@ -1,189 +0,0 @@ -import { useCallback, useRef, useEffect, useState } from 'react'; -import { AgGridReact, AgGridColumn } from 'ag-grid-react'; -import type { AgGridReact as AgGridReactType } from 'ag-grid-react'; -import type { - GroupCellRendererParams, - ValueFormatterParams, - GetRowIdParams, -} from 'ag-grid-community'; -import 'ag-grid-community/dist/styles/ag-grid.css'; -import 'ag-grid-community/dist/styles/ag-theme-alpine.css'; -import { formatNumber, t } from '@vegaprotocol/react-helpers'; -import { useMarketsLiquidity } from '@vegaprotocol/liquidity'; -import { Icon } from '@vegaprotocol/ui-toolkit'; -import type { Market } from '@vegaprotocol/liquidity'; -import { formatWithAsset } from '@vegaprotocol/liquidity'; -import { - MarketTradingModeMapping, - MarketTradingMode, - AuctionTrigger, - AuctionTriggerMapping, -} from '@vegaprotocol/types'; - -import { HealthBar } from './health-bar'; -import { HealthDialog } from './health-dialog'; -import './market-list.scss'; - -const displayValue = (value: string) => { - return parseFloat(value) > 0 ? `+${value}` : value; -}; - -const marketNameCellRenderer = ({ - value, - data, -}: { - value: string; - data: Market; -}) => { - return ( - <> - {value} - - {data?.tradableInstrument?.instrument?.product?.settlementAsset?.symbol} - - - ); -}; - -const healthCellRenderer = ({ - value, - data, -}: { - value: MarketTradingMode; - data: Market; -}) => { - return ( -
- -
- ); -}; - -export const MarketList = () => { - const { data, error, loading } = useMarketsLiquidity(); - const [isHealthDialogOpen, setIsHealthDialogOpen] = useState(false); - const gridRef = useRef(null); - - const getRowId = useCallback(({ data }: GetRowIdParams) => data.id, []); - - const handleOnGridReady = useCallback(() => { - gridRef.current?.api?.sizeColumnsToFit(); - }, [gridRef]); - - useEffect(() => { - window.addEventListener('resize', handleOnGridReady); - return () => window.removeEventListener('resize', handleOnGridReady); - }, [handleOnGridReady]); - - if (loading) return

Loading...

; - if (error) return

Error :(

; - - const localData = data?.markets; - - return ( -
- - - - { - return ( -
- {formatNumber(value)} ({displayValue(data.volumeChange)}) -
- ); - }} - /> - - - formatWithAsset( - value, - data.tradableInstrument.instrument.product.settlementAsset - ) - } - /> - - { - return value === - MarketTradingMode.TRADING_MODE_MONITORING_AUCTION && - data.data?.trigger && - data.data.trigger !== AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED - ? `${MarketTradingModeMapping[value]} - - ${AuctionTriggerMapping[data.data.trigger]}` - : MarketTradingModeMapping[value]; - }} - /> - - { - return ( -
- {t('Health')}{' '} - -
- ); - }} - field="tradingMode" - cellRenderer={healthCellRenderer} - sortable={false} - cellStyle={{ overflow: 'unset' }} - /> - -
- - { - setIsHealthDialogOpen(!isHealthDialogOpen); - }} - /> -
- ); -}; diff --git a/apps/liquidity-provision-dashboard/src/app/components/navbar/index.tsx b/apps/liquidity-provision-dashboard/src/app/components/navbar/index.tsx new file mode 100644 index 000000000..f5899d036 --- /dev/null +++ b/apps/liquidity-provision-dashboard/src/app/components/navbar/index.tsx @@ -0,0 +1 @@ +export * from './navbar'; diff --git a/apps/liquidity-provision-dashboard/src/app/components/navbar/navbar.tsx b/apps/liquidity-provision-dashboard/src/app/components/navbar/navbar.tsx new file mode 100644 index 000000000..ed1856f14 --- /dev/null +++ b/apps/liquidity-provision-dashboard/src/app/components/navbar/navbar.tsx @@ -0,0 +1,15 @@ +import { Link } from 'react-router-dom'; +import { VegaLogo } from '@vegaprotocol/ui-toolkit'; + +export const Navbar = () => { + return ( +
+
+ + + +
+
+
+ ); +}; diff --git a/apps/liquidity-provision-dashboard/src/app/components/status/index.tsx b/apps/liquidity-provision-dashboard/src/app/components/status/index.tsx new file mode 100644 index 000000000..420cc02aa --- /dev/null +++ b/apps/liquidity-provision-dashboard/src/app/components/status/index.tsx @@ -0,0 +1 @@ +export * from './status'; diff --git a/apps/liquidity-provision-dashboard/src/app/components/status/status.tsx b/apps/liquidity-provision-dashboard/src/app/components/status/status.tsx new file mode 100644 index 000000000..c41d31844 --- /dev/null +++ b/apps/liquidity-provision-dashboard/src/app/components/status/status.tsx @@ -0,0 +1,45 @@ +import { Lozenge } from '@vegaprotocol/ui-toolkit'; +import classNames from 'classnames'; + +import { + MarketTradingModeMapping, + MarketTradingMode, + AuctionTrigger, + AuctionTriggerMapping, +} from '@vegaprotocol/types'; + +import { Indicator } from '../indicator'; + +export const Status = ({ + tradingMode, + trigger, + size = 'small', +}: { + tradingMode?: MarketTradingMode; + trigger?: AuctionTrigger; + size?: 'small' | 'large'; +}) => { + const getStatus = () => { + if (!tradingMode) return ''; + if (tradingMode === MarketTradingMode.TRADING_MODE_MONITORING_AUCTION) { + if (trigger && trigger !== AuctionTrigger.AUCTION_TRIGGER_UNSPECIFIED) { + return `${MarketTradingModeMapping[tradingMode]} - ${AuctionTriggerMapping[trigger]}`; + } + } + return MarketTradingModeMapping[tradingMode]; + }; + + return ( +
+ + + {getStatus()} + +
+ ); +}; diff --git a/apps/liquidity-provision-dashboard/src/app/lib/utils.tsx b/apps/liquidity-provision-dashboard/src/app/lib/utils.tsx new file mode 100644 index 000000000..ae159374f --- /dev/null +++ b/apps/liquidity-provision-dashboard/src/app/lib/utils.tsx @@ -0,0 +1,12 @@ +import { MarketTradingMode } from '@vegaprotocol/types'; + +const marketTradingModeStyle = { + [MarketTradingMode.TRADING_MODE_CONTINUOUS]: '#00D46E', + [MarketTradingMode.TRADING_MODE_MONITORING_AUCTION]: '#CF0064', + [MarketTradingMode.TRADING_MODE_OPENING_AUCTION]: '#0046CD', + [MarketTradingMode.TRADING_MODE_BATCH_AUCTION]: '#CF0064', + [MarketTradingMode.TRADING_MODE_NO_TRADING]: '#CF0064', +}; + +export const getColorForStatus = (status: MarketTradingMode) => + marketTradingModeStyle[status]; diff --git a/apps/liquidity-provision-dashboard/src/app/routes/index.ts b/apps/liquidity-provision-dashboard/src/app/routes/index.ts new file mode 100644 index 000000000..b41a85505 --- /dev/null +++ b/apps/liquidity-provision-dashboard/src/app/routes/index.ts @@ -0,0 +1 @@ +export * from './router-config'; diff --git a/apps/liquidity-provision-dashboard/src/app/routes/router-config.tsx b/apps/liquidity-provision-dashboard/src/app/routes/router-config.tsx new file mode 100644 index 000000000..239ca061a --- /dev/null +++ b/apps/liquidity-provision-dashboard/src/app/routes/router-config.tsx @@ -0,0 +1,25 @@ +import { t } from '@vegaprotocol/react-helpers'; + +import { Dashboard } from '../components/dashboard'; +import { Detail } from '../components/detail'; + +export const ROUTES = { + MARKETS: 'markets', +}; + +export const routerConfig = [ + { path: '/', element: , icon: '' }, + { + path: ROUTES.MARKETS, + name: 'Markets', + text: t('Markets'), + children: [ + { + path: ':marketId', + element: , + }, + ], + icon: 'trade', + isNavItem: true, + }, +]; diff --git a/apps/liquidity-provision-dashboard/src/main.tsx b/apps/liquidity-provision-dashboard/src/main.tsx index 8d51ef3c2..1eebbe714 100644 --- a/apps/liquidity-provision-dashboard/src/main.tsx +++ b/apps/liquidity-provision-dashboard/src/main.tsx @@ -1,8 +1,6 @@ import { StrictMode } from 'react'; import { createRoot } from 'react-dom/client'; -import { ThemeContext } from '@vegaprotocol/react-helpers'; -import { EnvironmentProvider, NetworkLoader } from '@vegaprotocol/environment'; -import { createClient } from './app/lib/apollo-client'; +import { BrowserRouter } from 'react-router-dom'; import App from './app/app'; @@ -11,12 +9,8 @@ const root = rootElement && createRoot(rootElement); root?.render( - - - - - - - + + + ); diff --git a/apps/liquidity-provision-dashboard/tailwind.config.js b/apps/liquidity-provision-dashboard/tailwind.config.js index e127aabb4..669d93dc2 100644 --- a/apps/liquidity-provision-dashboard/tailwind.config.js +++ b/apps/liquidity-provision-dashboard/tailwind.config.js @@ -11,6 +11,19 @@ module.exports = { ...createGlobPatternsForDependencies(__dirname), ], darkMode: 'class', - theme, + theme: { + ...theme, + colors: { + ...theme.colors, + greys: { + light: { + 100: '#F0F0F0', + 200: '#D2D2D2', + 300: '#A7A7A7', + 400: '#626262', + }, + }, + }, + }, plugins: [vegaCustomClasses, vegaCustomClassesLite], }; diff --git a/libs/liquidity/src/lib/MarketLiquidity.graphql b/libs/liquidity/src/lib/MarketLiquidity.graphql index e0dee7342..8ef435d56 100644 --- a/libs/liquidity/src/lib/MarketLiquidity.graphql +++ b/libs/liquidity/src/lib/MarketLiquidity.graphql @@ -24,9 +24,11 @@ query MarketLp($marketId: ID!) { market { id } + marketTradingMode suppliedStake openInterest targetStake + trigger marketValueProxy } } diff --git a/libs/liquidity/src/lib/__generated__/MarketLiquidity.ts b/libs/liquidity/src/lib/__generated__/MarketLiquidity.ts index 8e38b12cc..8857d7225 100644 --- a/libs/liquidity/src/lib/__generated__/MarketLiquidity.ts +++ b/libs/liquidity/src/lib/__generated__/MarketLiquidity.ts @@ -8,7 +8,7 @@ export type MarketLpQueryVariables = Types.Exact<{ }>; -export type MarketLpQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', code: string, name: string, product: { __typename?: 'Future', settlementAsset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } } } }, data?: { __typename?: 'MarketData', suppliedStake?: string | null, openInterest: string, targetStake?: string | null, marketValueProxy: string, market: { __typename?: 'Market', id: string } } | null } | null }; +export type MarketLpQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', code: string, name: string, product: { __typename?: 'Future', settlementAsset: { __typename?: 'Asset', id: string, symbol: string, decimals: number } } } }, data?: { __typename?: 'MarketData', marketTradingMode: Types.MarketTradingMode, suppliedStake?: string | null, openInterest: string, targetStake?: string | null, trigger: Types.AuctionTrigger, marketValueProxy: string, market: { __typename?: 'Market', id: string } } | null } | null }; export type LiquidityProvisionFieldsFragment = { __typename?: 'LiquidityProvision', createdAt: string, updatedAt?: string | null, commitmentAmount: string, fee: string, status: Types.LiquidityProvisionStatus, party: { __typename?: 'Party', id: string, accountsConnection?: { __typename?: 'AccountsConnection', edges?: Array<{ __typename?: 'AccountEdge', node: { __typename?: 'AccountBalance', type: Types.AccountType, balance: string } } | null> | null } | null } }; @@ -97,9 +97,11 @@ export const MarketLpDocument = gql` market { id } + marketTradingMode suppliedStake openInterest targetStake + trigger marketValueProxy } } @@ -288,4 +290,4 @@ export function useLiquidityProviderFeeShareUpdateSubscription(baseOptions: Apol return Apollo.useSubscription(LiquidityProviderFeeShareUpdateDocument, options); } export type LiquidityProviderFeeShareUpdateSubscriptionHookResult = ReturnType; -export type LiquidityProviderFeeShareUpdateSubscriptionResult = Apollo.SubscriptionResult; \ No newline at end of file +export type LiquidityProviderFeeShareUpdateSubscriptionResult = Apollo.SubscriptionResult; diff --git a/libs/liquidity/src/lib/markets-liquidity-provider.ts b/libs/liquidity/src/lib/markets-liquidity-provider.ts index 851e53e07..12ba29db2 100644 --- a/libs/liquidity/src/lib/markets-liquidity-provider.ts +++ b/libs/liquidity/src/lib/markets-liquidity-provider.ts @@ -32,7 +32,7 @@ import { } from './utils/liquidity-utils'; import type { Provider, LiquidityProvisionMarket } from './utils'; -interface FeeLevels { +export interface FeeLevels { commitmentAmount: number; fee: string; } diff --git a/libs/liquidity/src/lib/utils/liquidity-utils.ts b/libs/liquidity/src/lib/utils/liquidity-utils.ts index 0ca034afb..bbf66b255 100644 --- a/libs/liquidity/src/lib/utils/liquidity-utils.ts +++ b/libs/liquidity/src/lib/utils/liquidity-utils.ts @@ -6,15 +6,15 @@ import type { MarketNodeFragment } from './../__generated__/MarketsLiquidity'; export type LiquidityProvisionMarket = MarketNodeFragment; export interface Provider { - commitmentAmount: string; - fee: string; + commitmentAmount: string | undefined; + fee: string | undefined; } export const sumLiquidityCommitted = ( - providers: Array<{ commitmentAmount: string }> + providers: Array<{ commitmentAmount: string | undefined }> ) => { return providers - ? providers.reduce((total: number, { commitmentAmount }) => { + ? providers.reduce((total: number, { commitmentAmount = '0' }) => { return total + parseInt(commitmentAmount, 10); }, 0) : 0; @@ -23,15 +23,14 @@ export const sumLiquidityCommitted = ( export const formatWithAsset = ( value: string, settlementAsset: { - decimals: number; - symbol: string; + decimals?: number; + symbol?: string; } ) => { - const formattedValue = addDecimalsFormatNumber( - value, - settlementAsset.decimals - ); - const symbol = settlementAsset.symbol; + const { decimals, symbol } = settlementAsset; + const formattedValue = decimals + ? addDecimalsFormatNumber(value, decimals) + : value; return `${formattedValue} ${symbol}`; }; @@ -48,6 +47,10 @@ export const getCandle24hAgo = ( return candles24hAgo.find((c) => c.marketId === marketId)?.candles?.[0]; }; +export const displayChange = (value: string) => { + return parseFloat(value) > 0 ? `+${value}` : value; +}; + export const EMPTY_VALUE = ' - '; export const getChange = (candles: (Candle | null)[], lastClose?: string) => { const firstCandle = candles.find((item) => item?.open); @@ -81,7 +84,7 @@ export const calcDayVolume = (candles: Array<{ volume: string }> = []) => { export const getFeeLevels = (providers: Provider[]) => { const lp = providers.reduce((total: { [x: string]: number }, current) => { - const { fee, commitmentAmount } = current; + const { fee = '0', commitmentAmount = '0' } = current; const ca = parseInt(commitmentAmount, 10); return { diff --git a/libs/tailwindcss-config/src/vega-custom-classes.js b/libs/tailwindcss-config/src/vega-custom-classes.js index 4e1673683..b87d189f2 100644 --- a/libs/tailwindcss-config/src/vega-custom-classes.js +++ b/libs/tailwindcss-config/src/vega-custom-classes.js @@ -7,6 +7,9 @@ const vegaCustomClasses = plugin(function ({ addUtilities }) { '.calt': { fontFeatureSettings: "'calt'", }, + '.liga-0-calt-0': { + fontFeatureSettings: "'liga' 0, 'calt' 0", + }, '.syntax-highlighter-wrapper .hljs': { fontSize: '1rem', fontFamily: "Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace", From 3ff6514cf8731d6975640c4c7a8e6669cf417935 Mon Sep 17 00:00:00 2001 From: Joe Tsang <30622993+jtsang586@users.noreply.github.com> Date: Tue, 8 Nov 2022 17:44:01 +0000 Subject: [PATCH 02/34] chore(token tests): update failing tests (#1995) * chore: update capsule files * chore: fix failing staking tests * chore: move capsule teardown var to cypress config * chore: update teardown in workdflows --- .../capsule-cypress-manual-trigger.yml | 2 ++ .../workflows/capsule-cypress-night-run.yml | 1 + .github/workflows/cypress-explorer-e2e.yml | 6 +++++- .github/workflows/cypress-token-e2e.yml | 6 +++++- .github/workflows/tests-dispatcher.yml | 5 +++++ apps/token-e2e/.env | 1 - apps/token-e2e/cypress.config.js | 1 + .../integration/flow/governance-flow.cy.js | 3 --- .../src/integration/flow/staking-flow.cy.js | 21 +++++++++---------- .../src/support/staking.functions.js | 10 +++++++++ vegacapsule/config.hcl | 15 ++----------- .../data_node_full_external_postgres.tmpl | 8 ++++++- 12 files changed, 48 insertions(+), 31 deletions(-) diff --git a/.github/workflows/capsule-cypress-manual-trigger.yml b/.github/workflows/capsule-cypress-manual-trigger.yml index 7a393748d..e759a20c5 100644 --- a/.github/workflows/capsule-cypress-manual-trigger.yml +++ b/.github/workflows/capsule-cypress-manual-trigger.yml @@ -29,6 +29,7 @@ on: env: GOBIN: /home/runner/go/bin VEGA_VERSION: 'v0.58.0' + capsule-teardown: true jobs: manual: @@ -57,4 +58,5 @@ jobs: vega-version: ${{needs.manual.outputs.vega-version}} gobin: ${{needs.manual.outputs.gobin}} skip-cache: ${{needs.manual.outputs.skip-cache}} + capsule-teardown: ${{needs.manual.capsule-teardown}} tags: ${{needs.manual.outputs.tags}} diff --git a/.github/workflows/capsule-cypress-night-run.yml b/.github/workflows/capsule-cypress-night-run.yml index 30f7f175b..1b9bab5de 100644 --- a/.github/workflows/capsule-cypress-night-run.yml +++ b/.github/workflows/capsule-cypress-night-run.yml @@ -17,3 +17,4 @@ jobs: gobin: /home/runner/go/bin tags: --env.grepTags '[ @smoke, @regression, @slow ]' night-run: true + capsule-teardown: true diff --git a/.github/workflows/cypress-explorer-e2e.yml b/.github/workflows/cypress-explorer-e2e.yml index 8907e3e4b..162c04829 100644 --- a/.github/workflows/cypress-explorer-e2e.yml +++ b/.github/workflows/cypress-explorer-e2e.yml @@ -24,6 +24,10 @@ on: required: false type: boolean default: false + capsule-teardown: + required: false + type: boolean + default: false jobs: explorer-e2e: @@ -99,7 +103,7 @@ jobs: CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }} CYPRESS_SLACK_WEBHOOK: ${{ secrets.CYPRESS_SLACK_WEBHOOK }} CYPRESS_ETH_WALLET_MNEMONIC: ${{ secrets.CYPRESS_ETH_WALLET_MNEMONIC }} - CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS: false + CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS: ${{ inputs.capsule-teardown }} CYPRESS_NIGHTLY_RUN: ${{ inputs.night-run }} ###### diff --git a/.github/workflows/cypress-token-e2e.yml b/.github/workflows/cypress-token-e2e.yml index 832bad61c..8a1e87ad9 100644 --- a/.github/workflows/cypress-token-e2e.yml +++ b/.github/workflows/cypress-token-e2e.yml @@ -20,6 +20,10 @@ on: tags: required: false type: string + capsule-teardown: + required: false + type: boolean + default: false jobs: token-e2e: @@ -95,7 +99,7 @@ jobs: CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE: ${{ secrets.CYPRESS_TRADING_TEST_VEGA_WALLET_PASSPHRASE }} CYPRESS_SLACK_WEBHOOK: ${{ secrets.CYPRESS_SLACK_WEBHOOK }} CYPRESS_ETH_WALLET_MNEMONIC: ${{ secrets.CYPRESS_ETH_WALLET_MNEMONIC }} - CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS: false + CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS: ${{ inputs.capsule-teardown }} ###### ## Upload logs diff --git a/.github/workflows/tests-dispatcher.yml b/.github/workflows/tests-dispatcher.yml index e5dd6cb11..1ddefe7da 100644 --- a/.github/workflows/tests-dispatcher.yml +++ b/.github/workflows/tests-dispatcher.yml @@ -20,6 +20,9 @@ on: night-run: required: false type: boolean + capsule-teardown: + required: false + type: boolean jobs: run-console-lite-e2e: @@ -42,6 +45,7 @@ jobs: skip-cache: ${{ inputs.skip-cache }} tags: ${{ inputs.tags }} night-run: ${{ inputs.night-run }} + capsule-teardown: ${{ inputs.capsule-teardown }} run-liquidity-e2e: uses: ./.github/workflows/cypress-liquidity-provision-dashboard-e2e.yml @@ -64,6 +68,7 @@ jobs: gobin: ${{ inputs.gobin }} skip-cache: ${{ inputs.skip-cache }} tags: ${{ inputs.tags }} + capsule-teardown: ${{ inputs.capsule-teardown }} run-trading-e2e: uses: ./.github/workflows/cypress-trading-e2e.yml diff --git a/apps/token-e2e/.env b/apps/token-e2e/.env index 6d8a0b2cb..39aff172f 100644 --- a/apps/token-e2e/.env +++ b/apps/token-e2e/.env @@ -14,4 +14,3 @@ NX_VEGA_WALLET_URL=http://localhost:1789 #Test configuration variables CYPRESS_FAIRGROUND=false -CYPRESS_TEARDOWN_NETWORK_AFTER_FLOWS=true diff --git a/apps/token-e2e/cypress.config.js b/apps/token-e2e/cypress.config.js index 692d5dbd6..832cc4170 100644 --- a/apps/token-e2e/cypress.config.js +++ b/apps/token-e2e/cypress.config.js @@ -51,5 +51,6 @@ module.exports = defineConfig({ grepTags: '@regression @smoke @slow', grepFilterSpecs: true, grepOmitFiltered: true, + TEARDOWN_NETWORK_AFTER_FLOWS: false, }, }); diff --git a/apps/token-e2e/src/integration/flow/governance-flow.cy.js b/apps/token-e2e/src/integration/flow/governance-flow.cy.js index 631357b79..5614a11ff 100644 --- a/apps/token-e2e/src/integration/flow/governance-flow.cy.js +++ b/apps/token-e2e/src/integration/flow/governance-flow.cy.js @@ -414,8 +414,6 @@ context( .should('be.visible'); } ); - // 3001-VOTE-043 - cy.contains('3 days left to vote').should('be.visible'); }); it('Newly created proposal details - shows default status set to fail', function () { @@ -425,7 +423,6 @@ context( cy.get_submitted_proposal_from_proposal_list().within(() => cy.get(viewProposalButton).click() ); - cy.contains('currently set to fail').should('be.visible'); cy.contains('Participation: Not Met 0.00 0.00%(0.00% Required)').should( 'be.visible' ); diff --git a/apps/token-e2e/src/integration/flow/staking-flow.cy.js b/apps/token-e2e/src/integration/flow/staking-flow.cy.js index 11f329545..2f3b8aa72 100644 --- a/apps/token-e2e/src/integration/flow/staking-flow.cy.js +++ b/apps/token-e2e/src/integration/flow/staking-flow.cy.js @@ -365,7 +365,7 @@ context( .contains(2.0, epochTimeout) .should('be.visible'); - cy.get(totalStake, epochTimeout).should('have.text', '2'); + cy.get(totalStake, epochTimeout).should('contain.text', '2'); cy.get(stakeShare, epochTimeout).should('have.text', '100%'); cy.navigate_to('staking'); @@ -543,6 +543,7 @@ context( txTimeout ); + cy.close_staking_dialog(); cy.staking_page_disassociate_all_tokens('wallet'); cy.get(ethWalletContainer).within(() => { @@ -596,7 +597,7 @@ context( 2.0, txTimeout ); - + cy.close_staking_dialog(); cy.staking_page_disassociate_all_tokens('contract'); cy.get(ethWalletContainer).within(() => { @@ -648,7 +649,7 @@ context( 2.0, txTimeout ); - + cy.close_staking_dialog(); cy.staking_page_disassociate_tokens('1'); cy.get(ethWalletTotalAssociatedBalance, txTimeout) @@ -696,7 +697,7 @@ context( 3.0, txTimeout ); - + cy.close_staking_dialog(); cy.staking_page_associate_tokens('4'); cy.get(vegaWalletUnstakedBalance, txTimeout).should( @@ -732,7 +733,7 @@ context( 3.0, txTimeout ); - + cy.close_staking_dialog(); cy.staking_page_associate_tokens('4', { type: 'contract' }); cy.get(vegaWalletUnstakedBalance, txTimeout).should( @@ -768,7 +769,7 @@ context( 3.0, txTimeout ); - + cy.close_staking_dialog(); cy.staking_page_associate_tokens('4', { type: 'contract' }); cy.get(vegaWalletUnstakedBalance, txTimeout).should( @@ -804,8 +805,7 @@ context( 0.0, txTimeout ); - - cy.navigate_to('staking'); + cy.close_staking_dialog(); cy.click_on_validator_from_list(1); @@ -816,7 +816,7 @@ context( 0.0, txTimeout ); - + cy.close_staking_dialog(); cy.staking_page_associate_tokens('6'); cy.get(vegaWallet).within(() => { @@ -860,8 +860,7 @@ context( 1.0, txTimeout ); - - cy.navigate_to('staking'); + cy.close_staking_dialog(); cy.click_on_validator_from_list(0); diff --git a/apps/token-e2e/src/support/staking.functions.js b/apps/token-e2e/src/support/staking.functions.js index f64abd2f8..e45e7601e 100644 --- a/apps/token-e2e/src/support/staking.functions.js +++ b/apps/token-e2e/src/support/staking.functions.js @@ -216,3 +216,13 @@ Cypress.Commands.add( }); } ); + +Cypress.Commands.add('close_staking_dialog', () => { + cy.getByTestId('dialog-title').should( + 'contain.text', + 'At the beginning of the next epoch' + ); + cy.getByTestId('dialog-content').within(() => { + cy.get('a').should('have.text', 'Back to Staking').click(); + }); +}); diff --git a/vegacapsule/config.hcl b/vegacapsule/config.hcl index 52f28ebca..89c7fa79b 100644 --- a/vegacapsule/config.hcl +++ b/vegacapsule/config.hcl @@ -61,19 +61,6 @@ EOT POSTGRES_DBS="vega0,vega1,vega2,vega3,vega4,vega5,vega6,vega7,vega8" } - volume_mounts = concat( - [ - for ns in generated.node_sets: - "${ns.data_node.service.home_dir}/dehistory/snapshotsCopyTo:/snapshotsCopyTo${ns.index}" - if ns.data_node != null - ], - [ - for ns in generated.node_sets: - "${ns.data_node.service.home_dir}/dehistory/snapshotsCopyFrom:/snapshotsCopyFrom${ns.index}" - if ns.data_node != null - ] - ) - static_port { value = 5232 to = 5432 @@ -83,6 +70,8 @@ EOT memory = 900 } + volume_mounts = ["${network_home_path}:${network_home_path}"] + auth_soft_fail = true } } diff --git a/vegacapsule/node_set_templates/default/data_node_full_external_postgres.tmpl b/vegacapsule/node_set_templates/default/data_node_full_external_postgres.tmpl index 40d5e2e5d..172bee780 100644 --- a/vegacapsule/node_set_templates/default/data_node_full_external_postgres.tmpl +++ b/vegacapsule/node_set_templates/default/data_node_full_external_postgres.tmpl @@ -3,9 +3,12 @@ GatewayEnabled = true [SQLStore] Enabled = true [SQLStore.ConnectionConfig] + Database = "vega{{.NodeNumber}}" + Host = "localhost" + Password = "vega" Port = 5232 UseTransactions = true - Database = "vega{{.NodeNumber}}" + Username = "vega" [API] @@ -38,3 +41,6 @@ GatewayEnabled = true UseEventFile = false [Broker.SocketConfig] Port = 30{{.NodeNumber}}5 + +[DeHistory] + Enabled = true From fbc8cf251111079aefefd582ac49c065ddc4962f Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Tue, 8 Nov 2022 18:04:49 +0000 Subject: [PATCH 03/34] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 113 ++++++++++++++----- 1 file changed, 84 insertions(+), 29 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 71fbb1f3d..c67d0b4e5 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -274,7 +274,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "92872.835269924084875675", + "locked_amount": "92813.59759306567875432", "deposits": [ { "amount": "129999.45", @@ -340,7 +340,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "43016.19026509386238", + "locked_amount": "42980.20456621004816", "deposits": [ { "amount": "2600", @@ -513,7 +513,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "4280.7722919837645", + "locked_amount": "4277.351598173516", "deposits": [ { "amount": "5000", @@ -724,7 +724,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "34321.801526768423093772", + "locked_amount": "34263.6948840095460258972", "deposits": [ { "amount": "97499.58", @@ -757,7 +757,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "46911.977275253228146197269112", + "locked_amount": "46832.55552629520729139727136", "deposits": [ { "amount": "135173.4239508", @@ -790,7 +790,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "14438.589196501979358214", + "locked_amount": "14414.144735341365514056", "deposits": [ { "amount": "32499.86", @@ -823,7 +823,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "4699.6206747082650270343", + "locked_amount": "4691.66423980392135621", "deposits": [ { "amount": "10833.29", @@ -856,7 +856,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "22749.93", "total_removed": "0", - "locked_amount": "17568.231723380234933316", + "locked_amount": "17538.488792670155976225", "deposits": [ { "amount": "6500", @@ -995,7 +995,7 @@ "tranche_end": "2023-05-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "21567.22922421731025", + "locked_amount": "21536.1878453038665", "deposits": [ { "amount": "7500", @@ -1048,7 +1048,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "626880.6921411330574", - "locked_amount": "1092186.99819232165908148", + "locked_amount": "1090859.817991963379080994", "deposits": [ { "amount": "1852091.69", @@ -1345,7 +1345,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "19516.8262819545095", + "locked_amount": "19459.14855072463725", "deposits": [ { "amount": "12500", @@ -25338,8 +25338,8 @@ "tranche_start": "2022-03-05T00:00:00.000Z", "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", - "total_removed": "226454.4904408472047", - "locked_amount": "1702812.48182581737177363478", + "total_removed": "229348.4397135638212", + "locked_amount": "1700772.973406219230874467475", "deposits": [ { "amount": "1998.95815", @@ -25508,6 +25508,11 @@ } ], "withdrawals": [ + { + "amount": "2893.9492727166165", + "user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0", + "tx": "0x645d29df4e2c50f6102245cc728bf0c554a1fc6b87050b3cbeed2ec7c8d3ac7b" + }, { "amount": "1788.901802058876", "user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0", @@ -25722,6 +25727,12 @@ } ], "withdrawals": [ + { + "amount": "2893.9492727166165", + "user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0", + "tranche_id": 1, + "tx": "0x645d29df4e2c50f6102245cc728bf0c554a1fc6b87050b3cbeed2ec7c8d3ac7b" + }, { "amount": "1788.901802058876", "user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0", @@ -25850,8 +25861,8 @@ } ], "total_tokens": "187637.95", - "withdrawn_tokens": "99212.021610780791", - "remaining_tokens": "88425.928389219209" + "withdrawn_tokens": "102105.9708834974075", + "remaining_tokens": "85531.9791165025925" }, { "address": "0x1A71e3ED1996CAbB91bB043f880CE963D601707e", @@ -26332,8 +26343,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", - "total_removed": "302999.2316026066361394", - "locked_amount": "11337751.3151841262003771862944779976547715", + "total_removed": "306624.2052826537006094", + "locked_amount": "11330519.3492771888093423469898643701689646", "deposits": [ { "amount": "16249.93", @@ -26847,6 +26858,21 @@ "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", "tx": "0x885851fab37258350e0fe4735b6cc1d1ff0bb523710fdd1a6bb4d0f8ed6485ef" }, + { + "amount": "2102.78771261784997", + "user": "0xe3eB4CF43C072658401996b71D43eE26E573562D", + "tx": "0xdafb045be53447fbfe2a8db5f4c996bf7350a326d2f9f79bafa697af57e46901" + }, + { + "amount": "1363.189376", + "user": "0xF4c75FdbAe821C6B5DBB9f001bB23cBA58D1bA37", + "tx": "0xa55f1e1e471f79617820ed7ae524d23b1962442bca2e23991433d60b634cb55e" + }, + { + "amount": "158.9965914292145", + "user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0", + "tx": "0x3b625782c9f9cd08f1b2c3988d3c5f5fb5530bb87b90b28611444be2b797ada2" + }, { "amount": "477.9430069466525", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -28758,6 +28784,12 @@ } ], "withdrawals": [ + { + "amount": "2102.78771261784997", + "user": "0xe3eB4CF43C072658401996b71D43eE26E573562D", + "tranche_id": 2, + "tx": "0xdafb045be53447fbfe2a8db5f4c996bf7350a326d2f9f79bafa697af57e46901" + }, { "amount": "1136.00674690441244", "user": "0xe3eB4CF43C072658401996b71D43eE26E573562D", @@ -28826,8 +28858,8 @@ } ], "total_tokens": "150551.801", - "withdrawn_tokens": "40920.46931853489141", - "remaining_tokens": "109631.33168146510859" + "withdrawn_tokens": "43023.25703115274138", + "remaining_tokens": "107528.54396884725862" }, { "address": "0x4d982Ab0823fD2f48e934a7be2bb0a5374a26148", @@ -29017,6 +29049,12 @@ } ], "withdrawals": [ + { + "amount": "1363.189376", + "user": "0xF4c75FdbAe821C6B5DBB9f001bB23cBA58D1bA37", + "tranche_id": 2, + "tx": "0xa55f1e1e471f79617820ed7ae524d23b1962442bca2e23991433d60b634cb55e" + }, { "amount": "52330.338436", "user": "0xF4c75FdbAe821C6B5DBB9f001bB23cBA58D1bA37", @@ -29031,8 +29069,8 @@ } ], "total_tokens": "200000", - "withdrawn_tokens": "55791.611752", - "remaining_tokens": "144208.388248" + "withdrawn_tokens": "57154.801128", + "remaining_tokens": "142845.198872" }, { "address": "0x1b956E6c00E238194B331eddEFF72Cb5f28A8d01", @@ -29474,6 +29512,12 @@ } ], "withdrawals": [ + { + "amount": "158.9965914292145", + "user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0", + "tranche_id": 2, + "tx": "0x3b625782c9f9cd08f1b2c3988d3c5f5fb5530bb87b90b28611444be2b797ada2" + }, { "amount": "98.307999550294", "user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0", @@ -29584,8 +29628,8 @@ } ], "total_tokens": "12362.05", - "withdrawn_tokens": "3375.5512344457205", - "remaining_tokens": "8986.4987655542795" + "withdrawn_tokens": "3534.547825874935", + "remaining_tokens": "8827.502174125065" }, { "address": "0xb091D456d0dFCB94dcba6f355379056C5bb995fC", @@ -30210,7 +30254,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "3220305.754003071035812167", - "locked_amount": "4745494.39566203358336223529784765", + "locked_amount": "4738817.890913285690115716917782324", "deposits": [ { "amount": "129284.449", @@ -35997,7 +36041,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "2147526.429852157556378517", - "locked_amount": "1558070.13269704205809870084381899", + "locked_amount": "1555432.20529164723854562274469593", "deposits": [ { "amount": "552496.6455", @@ -37648,8 +37692,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", - "total_removed": "9045.246212512296", - "locked_amount": "269820.37143641976017681738102484", + "total_removed": "9123.290251072296", + "locked_amount": "269497.19966900728170513156976152", "deposits": [ { "amount": "3000", @@ -44288,6 +44332,11 @@ "user": "0x20cda61dcB20b8B9eC265973F2B558C864d3e183", "tx": "0x191c16303f1499f9d499a570f8b071a774ab5e9c54d38500bc1ac76cb1a8d189" }, + { + "amount": "78.04403856", + "user": "0xb1169C6daAc76bAcaf0D8f87641Fc38fbabe569F", + "tx": "0x7ef6e6a8e3fdf0c1afc447073d761a5944dcf44f848b1942d0f3fd13b1f95210" + }, { "amount": "68.9518436058", "user": "0xED71B9A9b5633e9d31A0986693658CBbf23c3c1B", @@ -63487,6 +63536,12 @@ } ], "withdrawals": [ + { + "amount": "78.04403856", + "user": "0xb1169C6daAc76bAcaf0D8f87641Fc38fbabe569F", + "tranche_id": 5, + "tx": "0x7ef6e6a8e3fdf0c1afc447073d761a5944dcf44f848b1942d0f3fd13b1f95210" + }, { "amount": "93.494913748", "user": "0xb1169C6daAc76bAcaf0D8f87641Fc38fbabe569F", @@ -63495,8 +63550,8 @@ } ], "total_tokens": "400", - "withdrawn_tokens": "93.494913748", - "remaining_tokens": "306.505086252" + "withdrawn_tokens": "171.538952308", + "remaining_tokens": "228.461047692" }, { "address": "0xF53D81D9f3A1465df9AD1b12ddDB5cC585D96877", From d3e79b76d5f8fbb54a99aeab092ca79c1510ef1e Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Wed, 9 Nov 2022 00:10:56 +0000 Subject: [PATCH 04/34] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 66 +++++++++++++------- 1 file changed, 44 insertions(+), 22 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index c67d0b4e5..e44637338 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -274,7 +274,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "92813.59759306567875432", + "locked_amount": "92753.28361635430119921", "deposits": [ { "amount": "129999.45", @@ -340,7 +340,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "42980.20456621004816", + "locked_amount": "42943.56503678335892", "deposits": [ { "amount": "2600", @@ -513,7 +513,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "4277.351598173516", + "locked_amount": "4273.868753170979", "deposits": [ { "amount": "5000", @@ -724,7 +724,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "34263.6948840095460258972", + "locked_amount": "34204.532491356734070777", "deposits": [ { "amount": "97499.58", @@ -757,7 +757,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "46832.55552629520729139727136", + "locked_amount": "46751.69074949979729638360568", "deposits": [ { "amount": "135173.4239508", @@ -790,7 +790,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "14414.144735341365514056", + "locked_amount": "14389.256138432201684011", "deposits": [ { "amount": "32499.86", @@ -823,7 +823,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "4691.66423980392135621", + "locked_amount": "4683.563243023215928832", "deposits": [ { "amount": "10833.29", @@ -856,7 +856,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "22749.93", "total_removed": "0", - "locked_amount": "17538.488792670155976225", + "locked_amount": "17508.205457378926537023", "deposits": [ { "amount": "6500", @@ -995,7 +995,7 @@ "tranche_end": "2023-05-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "21536.1878453038665", + "locked_amount": "21504.58247007366525", "deposits": [ { "amount": "7500", @@ -1048,7 +1048,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "626880.6921411330574", - "locked_amount": "1090859.817991963379080994", + "locked_amount": "1089508.52401925103341382", "deposits": [ { "amount": "1852091.69", @@ -1345,7 +1345,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "19459.14855072463725", + "locked_amount": "19400.4228625704518", "deposits": [ { "amount": "12500", @@ -25339,7 +25339,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "229348.4397135638212", - "locked_amount": "1700772.973406219230874467475", + "locked_amount": "1698696.59956746798586837754", "deposits": [ { "amount": "1998.95815", @@ -26343,8 +26343,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", - "total_removed": "306624.2052826537006094", - "locked_amount": "11330519.3492771888093423469898643701689646", + "total_removed": "307088.7055255201186094", + "locked_amount": "11323156.6609609208548253724193984756596378", "deposits": [ { "amount": "16249.93", @@ -26873,6 +26873,11 @@ "user": "0xE6CacAE56Cca8dFdB7910b5A13578719D4E57DA0", "tx": "0x3b625782c9f9cd08f1b2c3988d3c5f5fb5530bb87b90b28611444be2b797ada2" }, + { + "amount": "464.500242866418", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tx": "0x1afadba80f67e2343f1903ae9d110361091b74f71b21f6be2085c9c4a61900d3" + }, { "amount": "477.9430069466525", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -27798,6 +27803,12 @@ "tranche_id": 2, "tx": "0x885851fab37258350e0fe4735b6cc1d1ff0bb523710fdd1a6bb4d0f8ed6485ef" }, + { + "amount": "464.500242866418", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tranche_id": 2, + "tx": "0x1afadba80f67e2343f1903ae9d110361091b74f71b21f6be2085c9c4a61900d3" + }, { "amount": "477.9430069466525", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -28568,8 +28579,8 @@ } ], "total_tokens": "259998.8875", - "withdrawn_tokens": "73983.173481428171125", - "remaining_tokens": "186015.714018571828875" + "withdrawn_tokens": "74447.673724294589125", + "remaining_tokens": "185551.213775705410875" }, { "address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c", @@ -30253,8 +30264,8 @@ "tranche_start": "2021-11-05T00:00:00.000Z", "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", - "total_removed": "3220305.754003071035812167", - "locked_amount": "4738817.890913285690115716917782324", + "total_removed": "3220949.512421240585683667", + "locked_amount": "4732020.704070914950811369241679716", "deposits": [ { "amount": "129284.449", @@ -30473,6 +30484,11 @@ "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", "tx": "0xf026d1a247e312ffc63fdef08f2298e5a40ea3fe1f763a1869bbc79f96413a52" }, + { + "amount": "643.7584181695498715", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tx": "0x08f245aa9ff7933288360988e2d64c806f12d16394814f99bcf68d07ffa00181" + }, { "amount": "662.4856010075998305", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -32856,6 +32872,12 @@ "tranche_id": 3, "tx": "0xf026d1a247e312ffc63fdef08f2298e5a40ea3fe1f763a1869bbc79f96413a52" }, + { + "amount": "643.7584181695498715", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tranche_id": 3, + "tx": "0x08f245aa9ff7933288360988e2d64c806f12d16394814f99bcf68d07ffa00181" + }, { "amount": "662.4856010075998305", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -34916,8 +34938,8 @@ } ], "total_tokens": "359123.469575", - "withdrawn_tokens": "242002.63956544498952675", - "remaining_tokens": "117120.83000955501047325" + "withdrawn_tokens": "242646.39798361453939825", + "remaining_tokens": "116477.07159138546060175" }, { "address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB", @@ -36041,7 +36063,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "2147526.429852157556378517", - "locked_amount": "1555432.20529164723854562274469593", + "locked_amount": "1552746.595661182786898204921097639", "deposits": [ { "amount": "552496.6455", @@ -37693,7 +37715,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "9123.290251072296", - "locked_amount": "269497.19966900728170513156976152", + "locked_amount": "269168.18636519828897319848604768", "deposits": [ { "amount": "3000", From 71e8235faf23a7fa1c7be42146e75e0a6858d664 Mon Sep 17 00:00:00 2001 From: Matthew Russell Date: Tue, 8 Nov 2022 19:05:48 -0600 Subject: [PATCH 05/34] chore(#1905): updates to accomodate changes to datasource apis (#1919) * chore: updates to accomodate change to datasource apis * chore: update types for proposal submission * chore: update queries to work with latest core changes --- .../src/support/mocks/commons.ts | 2 +- .../app/routes/oracles/OracleSpecs.graphql | 86 +++- .../oracles/__generated__/OracleSpecs.ts | 210 +++++++-- .../oracles/__generated___/OracleSpecs.ts | 88 +++- .../explorer/src/app/routes/oracles/index.tsx | 101 +++- .../src/fixtures/proposals/new-market.json | 24 +- .../src/fixtures/proposals/update-market.json | 24 +- .../proposal/__generated__/Proposal.ts | 436 +++++++++++++----- .../proposal/proposal-container.tsx | 184 ++++++-- .../mocks/generate-market-info-query.ts | 12 +- .../src/support/mocks/generate-market.ts | 4 +- .../client-pages/market/trade-grid.tsx | 2 +- .../src/lib/__generated__/MarketLiquidity.ts | 2 +- .../components/market-info/MarketInfo.graphql | 6 +- .../market-info/__generated___/MarketInfo.ts | 8 +- .../components/market-info/info-market.tsx | 8 +- .../src/lib/__generated___/market.ts | 6 +- libs/market-list/src/lib/market.graphql | 2 +- libs/types/src/__generated__/globalTypes.ts | 18 +- libs/types/src/__generated__/types.ts | 353 +++++++++----- libs/types/src/global-types-mappings.ts | 2 +- libs/wallet/src/connectors/vega-connector.ts | 30 +- 22 files changed, 1189 insertions(+), 419 deletions(-) diff --git a/apps/console-lite-e2e/src/support/mocks/commons.ts b/apps/console-lite-e2e/src/support/mocks/commons.ts index b6a846703..5d1c3a73b 100644 --- a/apps/console-lite-e2e/src/support/mocks/commons.ts +++ b/apps/console-lite-e2e/src/support/mocks/commons.ts @@ -138,7 +138,7 @@ export const singleMarket: SingleMarketFieldsFragment = { id: 'dai-id', name: 'DAI Name', }, - oracleSpecForTradingTermination: { + dataSourceSpecForTradingTermination: { id: 'oid', }, }, diff --git a/apps/explorer/src/app/routes/oracles/OracleSpecs.graphql b/apps/explorer/src/app/routes/oracles/OracleSpecs.graphql index 719a75e81..4deb4346d 100644 --- a/apps/explorer/src/app/routes/oracles/OracleSpecs.graphql +++ b/apps/explorer/src/app/routes/oracles/OracleSpecs.graphql @@ -2,23 +2,79 @@ query OracleSpecs { oracleSpecsConnection { edges { node { - status - id - createdAt - updatedAt - pubKeys - filters { - key { - name - type - } - conditions { - value - operator + dataSourceSpec { + spec { + id + createdAt + updatedAt + status + data { + sourceType { + ... on DataSourceDefinitionInternal { + sourceType { + ... on DataSourceSpecConfigurationTime { + conditions { + value + operator + } + } + } + } + ... on DataSourceDefinitionExternal { + sourceType { + ... on DataSourceSpecConfiguration { + signers { + signer { + ... on ETHAddress { + address + } + ... on PubKey { + key + } + } + } + filters { + key { + name + type + } + conditions { + value + operator + } + } + } + } + } + } + } } } - data { - pubKeys + dataConnection { + edges { + node { + externalData { + data { + signers { + signer { + ... on ETHAddress { + address + } + ... on PubKey { + key + } + } + } + data { + name + value + } + matchedSpecIds + broadcastAt + } + } + } + } } } } diff --git a/apps/explorer/src/app/routes/oracles/__generated__/OracleSpecs.ts b/apps/explorer/src/app/routes/oracles/__generated__/OracleSpecs.ts index 2bfe6a6eb..9f4d435cc 100644 --- a/apps/explorer/src/app/routes/oracles/__generated__/OracleSpecs.ts +++ b/apps/explorer/src/app/routes/oracles/__generated__/OracleSpecs.ts @@ -3,25 +3,13 @@ // @generated // This file was automatically generated and should not be edited. -import { OracleSpecStatus, PropertyKeyType, ConditionOperator } from "@vegaprotocol/types"; +import { DataSourceSpecStatus, ConditionOperator, PropertyKeyType } from "@vegaprotocol/types"; // ==================================================== // GraphQL query operation: OracleSpecs // ==================================================== -export interface OracleSpecs_oracleSpecs_filters_key { - __typename: "PropertyKey"; - /** - * The name of the property. - */ - name: string | null; - /** - * The type of the property. - */ - type: PropertyKeyType; -} - -export interface OracleSpecs_oracleSpecs_filters_conditions { +export interface OracleSpecs_oracleSpecs_dataSourceSpec_spec_data_sourceType_DataSourceDefinitionInternal_sourceType_conditions { __typename: "Condition"; /** * The value to compare against. @@ -33,35 +21,101 @@ export interface OracleSpecs_oracleSpecs_filters_conditions { operator: ConditionOperator; } -export interface OracleSpecs_oracleSpecs_filters { +export interface OracleSpecs_oracleSpecs_dataSourceSpec_spec_data_sourceType_DataSourceDefinitionInternal_sourceType { + __typename: "DataSourceSpecConfigurationTime"; + conditions: (OracleSpecs_oracleSpecs_dataSourceSpec_spec_data_sourceType_DataSourceDefinitionInternal_sourceType_conditions | null)[]; +} + +export interface OracleSpecs_oracleSpecs_dataSourceSpec_spec_data_sourceType_DataSourceDefinitionInternal { + __typename: "DataSourceDefinitionInternal"; + sourceType: OracleSpecs_oracleSpecs_dataSourceSpec_spec_data_sourceType_DataSourceDefinitionInternal_sourceType; +} + +export interface OracleSpecs_oracleSpecs_dataSourceSpec_spec_data_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer_ETHAddress { + __typename: "ETHAddress"; + address: string | null; +} + +export interface OracleSpecs_oracleSpecs_dataSourceSpec_spec_data_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer_PubKey { + __typename: "PubKey"; + key: string | null; +} + +export type OracleSpecs_oracleSpecs_dataSourceSpec_spec_data_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer = OracleSpecs_oracleSpecs_dataSourceSpec_spec_data_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer_ETHAddress | OracleSpecs_oracleSpecs_dataSourceSpec_spec_data_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer_PubKey; + +export interface OracleSpecs_oracleSpecs_dataSourceSpec_spec_data_sourceType_DataSourceDefinitionExternal_sourceType_signers { + __typename: "Signer"; + signer: OracleSpecs_oracleSpecs_dataSourceSpec_spec_data_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer; +} + +export interface OracleSpecs_oracleSpecs_dataSourceSpec_spec_data_sourceType_DataSourceDefinitionExternal_sourceType_filters_key { + __typename: "PropertyKey"; + /** + * The name of the property. + */ + name: string | null; + /** + * The type of the property. + */ + type: PropertyKeyType; +} + +export interface OracleSpecs_oracleSpecs_dataSourceSpec_spec_data_sourceType_DataSourceDefinitionExternal_sourceType_filters_conditions { + __typename: "Condition"; + /** + * The value to compare against. + */ + value: string | null; + /** + * The type of comparison to make on the value. + */ + operator: ConditionOperator; +} + +export interface OracleSpecs_oracleSpecs_dataSourceSpec_spec_data_sourceType_DataSourceDefinitionExternal_sourceType_filters { __typename: "Filter"; /** - * The oracle data property key targeted by the filter. + * key is the data source data property key targeted by the filter. */ - key: OracleSpecs_oracleSpecs_filters_key; + key: OracleSpecs_oracleSpecs_dataSourceSpec_spec_data_sourceType_DataSourceDefinitionExternal_sourceType_filters_key; /** * The conditions that should be matched by the data to be * considered of interest. */ - conditions: OracleSpecs_oracleSpecs_filters_conditions[] | null; + conditions: OracleSpecs_oracleSpecs_dataSourceSpec_spec_data_sourceType_DataSourceDefinitionExternal_sourceType_filters_conditions[] | null; } -export interface OracleSpecs_oracleSpecs_data { - __typename: "OracleData"; +export interface OracleSpecs_oracleSpecs_dataSourceSpec_spec_data_sourceType_DataSourceDefinitionExternal_sourceType { + __typename: "DataSourceSpecConfiguration"; /** - * The list of public keys that signed the data + * signers is the list of authorized signatures that signed the data for this + * data source. All the public keys in the data should be contained in this + * list. */ - pubKeys: string[] | null; + signers: OracleSpecs_oracleSpecs_dataSourceSpec_spec_data_sourceType_DataSourceDefinitionExternal_sourceType_signers[] | null; + /** + * filters describes which source data are considered of interest or not for + * the product (or the risk model). + */ + filters: OracleSpecs_oracleSpecs_dataSourceSpec_spec_data_sourceType_DataSourceDefinitionExternal_sourceType_filters[] | null; } -export interface OracleSpecs_oracleSpecs { - __typename: "OracleSpec"; +export interface OracleSpecs_oracleSpecs_dataSourceSpec_spec_data_sourceType_DataSourceDefinitionExternal { + __typename: "DataSourceDefinitionExternal"; + sourceType: OracleSpecs_oracleSpecs_dataSourceSpec_spec_data_sourceType_DataSourceDefinitionExternal_sourceType; +} + +export type OracleSpecs_oracleSpecs_dataSourceSpec_spec_data_sourceType = OracleSpecs_oracleSpecs_dataSourceSpec_spec_data_sourceType_DataSourceDefinitionInternal | OracleSpecs_oracleSpecs_dataSourceSpec_spec_data_sourceType_DataSourceDefinitionExternal; + +export interface OracleSpecs_oracleSpecs_dataSourceSpec_spec_data { + __typename: "DataSourceDefinition"; + sourceType: OracleSpecs_oracleSpecs_dataSourceSpec_spec_data_sourceType; +} + +export interface OracleSpecs_oracleSpecs_dataSourceSpec_spec { + __typename: "DataSourceSpec"; /** - * Status describes the status of the oracle spec - */ - status: OracleSpecStatus; - /** - * ID is a hash generated from the OracleSpec data. + * ID is a hash generated from the DataSourceSpec data. */ id: string; /** @@ -73,20 +127,102 @@ export interface OracleSpecs_oracleSpecs { */ updatedAt: string | null; /** - * The list of authorized public keys that signed the data for this - * oracle. All the public keys in the oracle data should be contained in these - * public keys. + * Status describes the status of the data source spec */ - pubKeys: string[] | null; + status: DataSourceSpecStatus; + data: OracleSpecs_oracleSpecs_dataSourceSpec_spec_data; +} + +export interface OracleSpecs_oracleSpecs_dataSourceSpec { + __typename: "ExternalDataSourceSpec"; + spec: OracleSpecs_oracleSpecs_dataSourceSpec_spec; +} + +export interface OracleSpecs_oracleSpecs_dataConnection_edges_node_externalData_data_signers_signer_ETHAddress { + __typename: "ETHAddress"; + address: string | null; +} + +export interface OracleSpecs_oracleSpecs_dataConnection_edges_node_externalData_data_signers_signer_PubKey { + __typename: "PubKey"; + key: string | null; +} + +export type OracleSpecs_oracleSpecs_dataConnection_edges_node_externalData_data_signers_signer = OracleSpecs_oracleSpecs_dataConnection_edges_node_externalData_data_signers_signer_ETHAddress | OracleSpecs_oracleSpecs_dataConnection_edges_node_externalData_data_signers_signer_PubKey; + +export interface OracleSpecs_oracleSpecs_dataConnection_edges_node_externalData_data_signers { + __typename: "Signer"; + signer: OracleSpecs_oracleSpecs_dataConnection_edges_node_externalData_data_signers_signer; +} + +export interface OracleSpecs_oracleSpecs_dataConnection_edges_node_externalData_data_data { + __typename: "Property"; /** - * Filters describes which oracle data are considered of interest or not for - * the product (or the risk model). + * Name of the property */ - filters: OracleSpecs_oracleSpecs_filters[] | null; + name: string; + /** + * Value of the property + */ + value: string; +} + +export interface OracleSpecs_oracleSpecs_dataConnection_edges_node_externalData_data { + __typename: "Data"; + /** + * signers is the list of public keys/ETH addresses that signed the data + */ + signers: OracleSpecs_oracleSpecs_dataConnection_edges_node_externalData_data_signers[] | null; + /** + * properties contains all the properties sent by a data source + */ + data: OracleSpecs_oracleSpecs_dataConnection_edges_node_externalData_data_data[] | null; + /** + * List of all the data specs that matched this source data. + * When the array is empty, it means no data spec matched this source data. + */ + matchedSpecIds: string[] | null; + /** + * RFC3339Nano formatted date and time for when the data was broadcast to the markets + * with a matching data spec. + * It has no value when the source data does not match any data spec. + */ + broadcastAt: string; +} + +export interface OracleSpecs_oracleSpecs_dataConnection_edges_node_externalData { + __typename: "ExternalData"; + data: OracleSpecs_oracleSpecs_dataConnection_edges_node_externalData_data; +} + +export interface OracleSpecs_oracleSpecs_dataConnection_edges_node { + __typename: "OracleData"; + externalData: OracleSpecs_oracleSpecs_dataConnection_edges_node_externalData; +} + +export interface OracleSpecs_oracleSpecs_dataConnection_edges { + __typename: "OracleDataEdge"; + /** + * The oracle data source + */ + node: OracleSpecs_oracleSpecs_dataConnection_edges_node; +} + +export interface OracleSpecs_oracleSpecs_dataConnection { + __typename: "OracleDataConnection"; + /** + * The oracle data spec + */ + edges: (OracleSpecs_oracleSpecs_dataConnection_edges | null)[] | null; +} + +export interface OracleSpecs_oracleSpecs { + __typename: "OracleSpec"; + dataSourceSpec: OracleSpecs_oracleSpecs_dataSourceSpec; /** * Data list all the oracle data broadcast to this spec */ - data: OracleSpecs_oracleSpecs_data[]; + dataConnection: OracleSpecs_oracleSpecs_dataConnection; } export interface OracleSpecs { diff --git a/apps/explorer/src/app/routes/oracles/__generated___/OracleSpecs.ts b/apps/explorer/src/app/routes/oracles/__generated___/OracleSpecs.ts index 4822aa019..e5605b110 100644 --- a/apps/explorer/src/app/routes/oracles/__generated___/OracleSpecs.ts +++ b/apps/explorer/src/app/routes/oracles/__generated___/OracleSpecs.ts @@ -6,7 +6,7 @@ const defaultOptions = {} as const; export type OracleSpecsQueryVariables = Types.Exact<{ [key: string]: never; }>; -export type OracleSpecsQuery = { __typename?: 'Query', oracleSpecsConnection?: { __typename?: 'OracleSpecsConnection', edges?: Array<{ __typename?: 'OracleSpecEdge', node: { __typename?: 'OracleSpec', status: Types.OracleSpecStatus, id: string, createdAt: string, updatedAt?: string | null, pubKeys?: Array | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null, data: Array<{ __typename?: 'OracleData', pubKeys?: Array | null }> } } | null> | null } | null }; +export type OracleSpecsQuery = { __typename?: 'Query', oracleSpecsConnection?: { __typename?: 'OracleSpecsConnection', edges?: Array<{ __typename?: 'OracleSpecEdge', node: { __typename?: 'OracleSpec', dataSourceSpec: { __typename?: 'ExternalDataSourceSpec', spec: { __typename?: 'DataSourceSpec', id: string, createdAt: string, updatedAt?: string | null, status: Types.DataSourceSpecStatus, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator } | null> } } } } }, dataConnection: { __typename?: 'OracleDataConnection', edges?: Array<{ __typename?: 'OracleDataEdge', node: { __typename?: 'OracleData', externalData: { __typename?: 'ExternalData', data: { __typename?: 'Data', matchedSpecIds?: Array | null, broadcastAt: string, signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, data?: Array<{ __typename?: 'Property', name: string, value: string }> | null } } } } | null> | null } } } | null> | null } | null }; export const OracleSpecsDocument = gql` @@ -14,23 +14,79 @@ export const OracleSpecsDocument = gql` oracleSpecsConnection { edges { node { - status - id - createdAt - updatedAt - pubKeys - filters { - key { - name - type - } - conditions { - value - operator + dataSourceSpec { + spec { + id + createdAt + updatedAt + status + data { + sourceType { + ... on DataSourceDefinitionInternal { + sourceType { + ... on DataSourceSpecConfigurationTime { + conditions { + value + operator + } + } + } + } + ... on DataSourceDefinitionExternal { + sourceType { + ... on DataSourceSpecConfiguration { + signers { + signer { + ... on ETHAddress { + address + } + ... on PubKey { + key + } + } + } + filters { + key { + name + type + } + conditions { + value + operator + } + } + } + } + } + } + } } } - data { - pubKeys + dataConnection { + edges { + node { + externalData { + data { + signers { + signer { + ... on ETHAddress { + address + } + ... on PubKey { + key + } + } + } + data { + name + value + } + matchedSpecIds + broadcastAt + } + } + } + } } } } diff --git a/apps/explorer/src/app/routes/oracles/index.tsx b/apps/explorer/src/app/routes/oracles/index.tsx index d8e165691..d33d84589 100644 --- a/apps/explorer/src/app/routes/oracles/index.tsx +++ b/apps/explorer/src/app/routes/oracles/index.tsx @@ -11,23 +11,79 @@ import { SubHeading } from '../../components/sub-heading'; const ORACLE_SPECS_QUERY = gql` query OracleSpecs { oracleSpecs { - status - id - createdAt - updatedAt - pubKeys - filters { - key { - name - type - } - conditions { - value - operator + dataSourceSpec { + spec { + id + createdAt + updatedAt + status + data { + sourceType { + ... on DataSourceDefinitionInternal { + sourceType { + ... on DataSourceSpecConfigurationTime { + conditions { + value + operator + } + } + } + } + ... on DataSourceDefinitionExternal { + sourceType { + ... on DataSourceSpecConfiguration { + signers { + signer { + ... on ETHAddress { + address + } + ... on PubKey { + key + } + } + } + filters { + key { + name + type + } + conditions { + value + operator + } + } + } + } + } + } + } } } - data { - pubKeys + dataConnection { + edges { + node { + externalData { + data { + signers { + signer { + ... on ETHAddress { + address + } + ... on PubKey { + key + } + } + } + data { + name + value + } + matchedSpecIds + broadcastAt + } + } + } + } } } } @@ -53,12 +109,15 @@ const Oracles = () => {
{t('Oracles')} {data?.oracleSpecs - ? data.oracleSpecs.map((o) => ( - - {o.id} - - - )) + ? data.oracleSpecs.map((o) => { + const id = o.dataSourceSpec.spec.id; + return ( + + {id} + + + ); + }) : null}
); diff --git a/apps/token-e2e/src/fixtures/proposals/new-market.json b/apps/token-e2e/src/fixtures/proposals/new-market.json index 4e6093343..e95574354 100644 --- a/apps/token-e2e/src/fixtures/proposals/new-market.json +++ b/apps/token-e2e/src/fixtures/proposals/new-market.json @@ -9,8 +9,15 @@ "settlementAsset": "8b52d4a3a4b0ffe733cddbc2b67be273816cfeb6ca4c8b339bac03ffba08e4e4", "quoteName": "tEuro", "settlementDataDecimals": 5, - "oracleSpecForSettlementPrice": { - "pubKeys": ["0xfCEAdAFab14d46e20144F48824d0C09B1a03F2BC"], + "dataSourceSpecForSettlementData": { + "signers": [ + { + "signer": { + "__typename": "ETHAddress", + "address": "0xfCEAdAFab14d46e20144F48824d0C09B1a03F2BC" + } + } + ], "filters": [ { "key": { @@ -26,8 +33,15 @@ } ] }, - "oracleSpecForTradingTermination": { - "pubKeys": ["0xfCEAdAFab14d46e20144F48824d0C09B1a03F2BC"], + "dataSourceSpecForTradingTermination": { + "signers": [ + { + "signer": { + "__typename": "ETHAddress", + "address": "0xfCEAdAFab14d46e20144F48824d0C09B1a03F2BC" + } + } + ], "filters": [ { "key": { @@ -43,7 +57,7 @@ } ] }, - "oracleSpecBinding": { + "dataSourceSpecBinding": { "settlementPriceProperty": "prices.BTC.value", "tradingTerminationProperty": "vegaprotocol.builtin.timestamp" } diff --git a/apps/token-e2e/src/fixtures/proposals/update-market.json b/apps/token-e2e/src/fixtures/proposals/update-market.json index a307255cf..6a410fdd2 100644 --- a/apps/token-e2e/src/fixtures/proposals/update-market.json +++ b/apps/token-e2e/src/fixtures/proposals/update-market.json @@ -6,8 +6,15 @@ "future": { "quoteName": "tEuro", "settlementDataDecimals": 5, - "oracleSpecForSettlementPrice": { - "pubKeys": ["0xfCEAdAFab14d46e20144F48824d0C09B1a03F2BC"], + "dataSourceSpecForSettlementData": { + "signers": [ + { + "signer": { + "__typename": "ETHAddress", + "address": "0xfCEAdAFab14d46e20144F48824d0C09B1a03F2BC" + } + } + ], "filters": [ { "key": { @@ -23,8 +30,15 @@ } ] }, - "oracleSpecForTradingTermination": { - "pubKeys": ["0xfCEAdAFab14d46e20144F48824d0C09B1a03F2BC"], + "dataSourceSpecForTradingTermination": { + "signers": [ + { + "signer": { + "__typename": "ETHAddress", + "address": "0xfCEAdAFab14d46e20144F48824d0C09B1a03F2BC" + } + } + ], "filters": [ { "key": { @@ -40,7 +54,7 @@ } ] }, - "oracleSpecBinding": { + "dataSourceSpecBinding": { "settlementPriceProperty": "prices.BTC.value", "tradingTerminationProperty": "vegaprotocol.builtin.timestamp" } diff --git a/apps/token/src/routes/governance/proposal/__generated__/Proposal.ts b/apps/token/src/routes/governance/proposal/__generated__/Proposal.ts index 9925d436d..fa7a654e6 100644 --- a/apps/token/src/routes/governance/proposal/__generated__/Proposal.ts +++ b/apps/token/src/routes/governance/proposal/__generated__/Proposal.ts @@ -3,7 +3,7 @@ // @generated // This file was automatically generated and should not be edited. -import { ProposalState, ProposalRejectionReason, PropertyKeyType, ConditionOperator, VoteValue } from "@vegaprotocol/types"; +import { ProposalState, ProposalRejectionReason, ConditionOperator, PropertyKeyType, VoteValue } from "@vegaprotocol/types"; // ==================================================== // GraphQL query operation: Proposal @@ -61,19 +61,7 @@ export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProdu quantum: string; } -export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_oracleSpecForSettlementData_filters_key { - __typename: "PropertyKey"; - /** - * The name of the property. - */ - name: string | null; - /** - * The type of the property. - */ - type: PropertyKeyType; -} - -export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_oracleSpecForSettlementData_filters_conditions { +export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionInternal_sourceType_conditions { __typename: "Condition"; /** * The type of comparison to make on the value. @@ -85,35 +73,34 @@ export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProdu value: string | null; } -export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_oracleSpecForSettlementData_filters { - __typename: "Filter"; - /** - * The oracle data property key targeted by the filter. - */ - key: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_oracleSpecForSettlementData_filters_key; - /** - * The conditions that should be matched by the data to be - * considered of interest. - */ - conditions: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_oracleSpecForSettlementData_filters_conditions[] | null; +export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionInternal_sourceType { + __typename: "DataSourceSpecConfigurationTime"; + conditions: (Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionInternal_sourceType_conditions | null)[]; } -export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_oracleSpecForSettlementData { - __typename: "OracleSpecConfiguration"; - /** - * The list of authorised public keys that signed the data for this - * oracle. All the public keys in the oracle data should be contained in these - * public keys. - */ - pubKeys: string[] | null; - /** - * Filters describes which oracle data are considered of interest or not for - * the product (or the risk model). - */ - filters: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_oracleSpecForSettlementData_filters[] | null; +export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionInternal { + __typename: "DataSourceDefinitionInternal"; + sourceType: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionInternal_sourceType; } -export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_oracleSpecForTradingTermination_filters_key { +export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer_PubKey { + __typename: "PubKey"; + key: string | null; +} + +export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer_ETHAddress { + __typename: "ETHAddress"; + address: string | null; +} + +export type Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer = Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer_PubKey | Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer_ETHAddress; + +export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType_signers { + __typename: "Signer"; + signer: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer; +} + +export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType_filters_key { __typename: "PropertyKey"; /** * The name of the property. @@ -125,7 +112,7 @@ export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProdu type: PropertyKeyType; } -export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_oracleSpecForTradingTermination_filters_conditions { +export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType_filters_conditions { __typename: "Condition"; /** * The type of comparison to make on the value. @@ -137,36 +124,151 @@ export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProdu value: string | null; } -export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_oracleSpecForTradingTermination_filters { +export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType_filters { __typename: "Filter"; /** - * The oracle data property key targeted by the filter. + * key is the data source data property key targeted by the filter. */ - key: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_oracleSpecForTradingTermination_filters_key; + key: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType_filters_key; /** * The conditions that should be matched by the data to be * considered of interest. */ - conditions: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_oracleSpecForTradingTermination_filters_conditions[] | null; + conditions: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType_filters_conditions[] | null; } -export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_oracleSpecForTradingTermination { - __typename: "OracleSpecConfiguration"; +export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType { + __typename: "DataSourceSpecConfiguration"; /** - * The list of authorised public keys that signed the data for this - * oracle. All the public keys in the oracle data should be contained in these - * public keys. + * signers is the list of authorized signatures that signed the data for this + * data source. All the public keys in the data should be contained in this + * list. */ - pubKeys: string[] | null; + signers: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType_signers[] | null; /** - * Filters describes which oracle data are considered of interest or not for + * filters describes which source data are considered of interest or not for * the product (or the risk model). */ - filters: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_oracleSpecForTradingTermination_filters[] | null; + filters: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType_filters[] | null; } -export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_oracleSpecBinding { - __typename: "OracleSpecToFutureBinding"; +export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal { + __typename: "DataSourceDefinitionExternal"; + sourceType: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType; +} + +export type Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForSettlementData_sourceType = Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionInternal | Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal; + +export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForSettlementData { + __typename: "DataSourceDefinition"; + sourceType: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForSettlementData_sourceType; +} + +export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionInternal_sourceType_conditions { + __typename: "Condition"; + /** + * The type of comparison to make on the value. + */ + operator: ConditionOperator; + /** + * The value to compare against. + */ + value: string | null; +} + +export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionInternal_sourceType { + __typename: "DataSourceSpecConfigurationTime"; + conditions: (Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionInternal_sourceType_conditions | null)[]; +} + +export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionInternal { + __typename: "DataSourceDefinitionInternal"; + sourceType: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionInternal_sourceType; +} + +export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer_PubKey { + __typename: "PubKey"; + key: string | null; +} + +export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer_ETHAddress { + __typename: "ETHAddress"; + address: string | null; +} + +export type Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer = Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer_PubKey | Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer_ETHAddress; + +export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType_signers { + __typename: "Signer"; + signer: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer; +} + +export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType_filters_key { + __typename: "PropertyKey"; + /** + * The name of the property. + */ + name: string | null; + /** + * The type of the property. + */ + type: PropertyKeyType; +} + +export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType_filters_conditions { + __typename: "Condition"; + /** + * The type of comparison to make on the value. + */ + operator: ConditionOperator; + /** + * The value to compare against. + */ + value: string | null; +} + +export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType_filters { + __typename: "Filter"; + /** + * key is the data source data property key targeted by the filter. + */ + key: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType_filters_key; + /** + * The conditions that should be matched by the data to be + * considered of interest. + */ + conditions: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType_filters_conditions[] | null; +} + +export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType { + __typename: "DataSourceSpecConfiguration"; + /** + * signers is the list of authorized signatures that signed the data for this + * data source. All the public keys in the data should be contained in this + * list. + */ + signers: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType_signers[] | null; + /** + * filters describes which source data are considered of interest or not for + * the product (or the risk model). + */ + filters: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType_filters[] | null; +} + +export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal { + __typename: "DataSourceDefinitionExternal"; + sourceType: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType; +} + +export type Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForTradingTermination_sourceType = Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionInternal | Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal; + +export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForTradingTermination { + __typename: "DataSourceDefinition"; + sourceType: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForTradingTermination_sourceType; +} + +export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecBinding { + __typename: "DataSourceSpecToFutureBinding"; settlementDataProperty: string; tradingTerminationProperty: string; } @@ -186,18 +288,18 @@ export interface Proposal_proposal_terms_change_NewMarket_instrument_futureProdu */ settlementDataDecimals: number; /** - * Describes the oracle data that an instrument wants to get from the oracle engine for settlement data. + * Describes the data source data that an instrument wants to get from the data source engine for settlement data. */ - oracleSpecForSettlementData: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_oracleSpecForSettlementData; + dataSourceSpecForSettlementData: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForSettlementData; /** - * Describes the oracle data that an instrument wants to get from the oracle engine for trading termination. + * Describes the source data that an instrument wants to get from the data source engine for trading termination. */ - oracleSpecForTradingTermination: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_oracleSpecForTradingTermination; + dataSourceSpecForTradingTermination: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecForTradingTermination; /** - * OracleSpecToFutureBinding tells on which property oracle data should be + * DataSourceSpecToFutureBinding tells on which property source data should be * used as settlement data. */ - oracleSpecBinding: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_oracleSpecBinding; + dataSourceSpecBinding: Proposal_proposal_terms_change_NewMarket_instrument_futureProduct_dataSourceSpecBinding; } export interface Proposal_proposal_terms_change_NewMarket_instrument { @@ -232,19 +334,7 @@ export interface Proposal_proposal_terms_change_NewMarket { instrument: Proposal_proposal_terms_change_NewMarket_instrument; } -export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_oracleSpecForSettlementData_filters_key { - __typename: "PropertyKey"; - /** - * The name of the property. - */ - name: string | null; - /** - * The type of the property. - */ - type: PropertyKeyType; -} - -export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_oracleSpecForSettlementData_filters_conditions { +export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionInternal_sourceType_conditions { __typename: "Condition"; /** * The type of comparison to make on the value. @@ -256,35 +346,34 @@ export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfigu value: string | null; } -export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_oracleSpecForSettlementData_filters { - __typename: "Filter"; - /** - * The oracle data property key targeted by the filter. - */ - key: Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_oracleSpecForSettlementData_filters_key; - /** - * The conditions that should be matched by the data to be - * considered of interest. - */ - conditions: Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_oracleSpecForSettlementData_filters_conditions[] | null; +export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionInternal_sourceType { + __typename: "DataSourceSpecConfigurationTime"; + conditions: (Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionInternal_sourceType_conditions | null)[]; } -export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_oracleSpecForSettlementData { - __typename: "OracleSpecConfiguration"; - /** - * The list of authorised public keys that signed the data for this - * oracle. All the public keys in the oracle data should be contained in these - * public keys. - */ - pubKeys: string[] | null; - /** - * Filters describes which oracle data are considered of interest or not for - * the product (or the risk model). - */ - filters: Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_oracleSpecForSettlementData_filters[] | null; +export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionInternal { + __typename: "DataSourceDefinitionInternal"; + sourceType: Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionInternal_sourceType; } -export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_oracleSpecForTradingTermination_filters_key { +export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer_PubKey { + __typename: "PubKey"; + key: string | null; +} + +export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer_ETHAddress { + __typename: "ETHAddress"; + address: string | null; +} + +export type Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer = Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer_PubKey | Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer_ETHAddress; + +export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType_signers { + __typename: "Signer"; + signer: Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer; +} + +export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType_filters_key { __typename: "PropertyKey"; /** * The name of the property. @@ -296,7 +385,7 @@ export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfigu type: PropertyKeyType; } -export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_oracleSpecForTradingTermination_filters_conditions { +export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType_filters_conditions { __typename: "Condition"; /** * The type of comparison to make on the value. @@ -308,36 +397,151 @@ export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfigu value: string | null; } -export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_oracleSpecForTradingTermination_filters { +export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType_filters { __typename: "Filter"; /** - * The oracle data property key targeted by the filter. + * key is the data source data property key targeted by the filter. */ - key: Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_oracleSpecForTradingTermination_filters_key; + key: Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType_filters_key; /** * The conditions that should be matched by the data to be * considered of interest. */ - conditions: Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_oracleSpecForTradingTermination_filters_conditions[] | null; + conditions: Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType_filters_conditions[] | null; } -export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_oracleSpecForTradingTermination { - __typename: "OracleSpecConfiguration"; +export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType { + __typename: "DataSourceSpecConfiguration"; /** - * The list of authorised public keys that signed the data for this - * oracle. All the public keys in the oracle data should be contained in these - * public keys. + * signers is the list of authorized signatures that signed the data for this + * data source. All the public keys in the data should be contained in this + * list. */ - pubKeys: string[] | null; + signers: Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType_signers[] | null; /** - * Filters describes which oracle data are considered of interest or not for + * filters describes which source data are considered of interest or not for * the product (or the risk model). */ - filters: Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_oracleSpecForTradingTermination_filters[] | null; + filters: Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType_filters[] | null; } -export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_oracleSpecBinding { - __typename: "OracleSpecToFutureBinding"; +export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal { + __typename: "DataSourceDefinitionExternal"; + sourceType: Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal_sourceType; +} + +export type Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForSettlementData_sourceType = Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionInternal | Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForSettlementData_sourceType_DataSourceDefinitionExternal; + +export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForSettlementData { + __typename: "DataSourceDefinition"; + sourceType: Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForSettlementData_sourceType; +} + +export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionInternal_sourceType_conditions { + __typename: "Condition"; + /** + * The type of comparison to make on the value. + */ + operator: ConditionOperator; + /** + * The value to compare against. + */ + value: string | null; +} + +export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionInternal_sourceType { + __typename: "DataSourceSpecConfigurationTime"; + conditions: (Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionInternal_sourceType_conditions | null)[]; +} + +export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionInternal { + __typename: "DataSourceDefinitionInternal"; + sourceType: Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionInternal_sourceType; +} + +export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer_PubKey { + __typename: "PubKey"; + key: string | null; +} + +export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer_ETHAddress { + __typename: "ETHAddress"; + address: string | null; +} + +export type Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer = Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer_PubKey | Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer_ETHAddress; + +export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType_signers { + __typename: "Signer"; + signer: Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType_signers_signer; +} + +export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType_filters_key { + __typename: "PropertyKey"; + /** + * The name of the property. + */ + name: string | null; + /** + * The type of the property. + */ + type: PropertyKeyType; +} + +export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType_filters_conditions { + __typename: "Condition"; + /** + * The type of comparison to make on the value. + */ + operator: ConditionOperator; + /** + * The value to compare against. + */ + value: string | null; +} + +export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType_filters { + __typename: "Filter"; + /** + * key is the data source data property key targeted by the filter. + */ + key: Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType_filters_key; + /** + * The conditions that should be matched by the data to be + * considered of interest. + */ + conditions: Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType_filters_conditions[] | null; +} + +export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType { + __typename: "DataSourceSpecConfiguration"; + /** + * signers is the list of authorized signatures that signed the data for this + * data source. All the public keys in the data should be contained in this + * list. + */ + signers: Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType_signers[] | null; + /** + * filters describes which source data are considered of interest or not for + * the product (or the risk model). + */ + filters: Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType_filters[] | null; +} + +export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal { + __typename: "DataSourceDefinitionExternal"; + sourceType: Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal_sourceType; +} + +export type Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForTradingTermination_sourceType = Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionInternal | Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForTradingTermination_sourceType_DataSourceDefinitionExternal; + +export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForTradingTermination { + __typename: "DataSourceDefinition"; + sourceType: Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForTradingTermination_sourceType; +} + +export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecBinding { + __typename: "DataSourceSpecToFutureBinding"; settlementDataProperty: string; tradingTerminationProperty: string; } @@ -345,9 +549,9 @@ export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfigu export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product { __typename: "UpdateFutureProduct"; quoteName: string; - oracleSpecForSettlementData: Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_oracleSpecForSettlementData; - oracleSpecForTradingTermination: Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_oracleSpecForTradingTermination; - oracleSpecBinding: Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_oracleSpecBinding; + dataSourceSpecForSettlementData: Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForSettlementData; + dataSourceSpecForTradingTermination: Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecForTradingTermination; + dataSourceSpecBinding: Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument_product_dataSourceSpecBinding; } export interface Proposal_proposal_terms_change_UpdateMarket_updateMarketConfiguration_instrument { diff --git a/apps/token/src/routes/governance/proposal/proposal-container.tsx b/apps/token/src/routes/governance/proposal/proposal-container.tsx index 08ed09321..07055d773 100644 --- a/apps/token/src/routes/governance/proposal/proposal-container.tsx +++ b/apps/token/src/routes/governance/proposal/proposal-container.tsx @@ -46,33 +46,87 @@ export const PROPOSAL_QUERY = gql` } quoteName settlementDataDecimals - oracleSpecForSettlementData { - pubKeys - filters { - key { - name - type + dataSourceSpecForSettlementData { + sourceType { + ... on DataSourceDefinitionInternal { + sourceType { + ... on DataSourceSpecConfigurationTime { + conditions { + operator + value + } + } + } } - conditions { - operator - value + ... on DataSourceDefinitionExternal { + sourceType { + ... on DataSourceSpecConfiguration { + signers { + signer { + ... on PubKey { + key + } + ... on ETHAddress { + address + } + } + } + filters { + key { + name + type + } + conditions { + operator + value + } + } + } + } } } } - oracleSpecForTradingTermination { - pubKeys - filters { - key { - name - type + dataSourceSpecForTradingTermination { + sourceType { + ... on DataSourceDefinitionInternal { + sourceType { + ... on DataSourceSpecConfigurationTime { + conditions { + operator + value + } + } + } } - conditions { - operator - value + ... on DataSourceDefinitionExternal { + sourceType { + ... on DataSourceSpecConfiguration { + signers { + signer { + ... on PubKey { + key + } + ... on ETHAddress { + address + } + } + } + filters { + key { + name + type + } + conditions { + operator + value + } + } + } + } } } } - oracleSpecBinding { + dataSourceSpecBinding { settlementDataProperty tradingTerminationProperty } @@ -86,33 +140,87 @@ export const PROPOSAL_QUERY = gql` code product { quoteName - oracleSpecForSettlementData { - pubKeys - filters { - key { - name - type + dataSourceSpecForSettlementData { + sourceType { + ... on DataSourceDefinitionInternal { + sourceType { + ... on DataSourceSpecConfigurationTime { + conditions { + operator + value + } + } + } } - conditions { - operator - value + ... on DataSourceDefinitionExternal { + sourceType { + ... on DataSourceSpecConfiguration { + signers { + signer { + ... on PubKey { + key + } + ... on ETHAddress { + address + } + } + } + filters { + key { + name + type + } + conditions { + operator + value + } + } + } + } } } } - oracleSpecForTradingTermination { - pubKeys - filters { - key { - name - type + dataSourceSpecForTradingTermination { + sourceType { + ... on DataSourceDefinitionInternal { + sourceType { + ... on DataSourceSpecConfigurationTime { + conditions { + operator + value + } + } + } } - conditions { - operator - value + ... on DataSourceDefinitionExternal { + sourceType { + ... on DataSourceSpecConfiguration { + signers { + signer { + ... on PubKey { + key + } + ... on ETHAddress { + address + } + } + } + filters { + key { + name + type + } + conditions { + operator + value + } + } + } + } } } } - oracleSpecBinding { + dataSourceSpecBinding { settlementDataProperty tradingTerminationProperty } diff --git a/apps/trading-e2e/src/support/mocks/generate-market-info-query.ts b/apps/trading-e2e/src/support/mocks/generate-market-info-query.ts index b93fa78fe..7e51b564f 100644 --- a/apps/trading-e2e/src/support/mocks/generate-market-info-query.ts +++ b/apps/trading-e2e/src/support/mocks/generate-market-info-query.ts @@ -149,16 +149,16 @@ export const generateMarketInfoQuery = ( name: 'tBTC TEST', decimals: 5, }, - oracleSpecForSettlementData: { - __typename: 'OracleSpec', + dataSourceSpecForSettlementData: { + __typename: 'DataSourceSpec', id: 'f028fe5ea7de3890962a05a7163fdde562629af649ed81b8c8902fafb6eef04f', }, - oracleSpecForTradingTermination: { - __typename: 'OracleSpec', + dataSourceSpecForTradingTermination: { + __typename: 'DataSourceSpec', id: 'f028fe5ea7de3890962a05a7163fdde562629af649ed81b8c8902fafb6eef04f', }, - oracleSpecBinding: { - __typename: 'OracleSpecToFutureBinding', + dataSourceSpecBinding: { + __typename: 'DataSourceSpecToFutureBinding', settlementDataProperty: 'prices.BTC.value', tradingTerminationProperty: 'termination.BTC.value', }, diff --git a/apps/trading-e2e/src/support/mocks/generate-market.ts b/apps/trading-e2e/src/support/mocks/generate-market.ts index bf529c6a3..f5670d98a 100644 --- a/apps/trading-e2e/src/support/mocks/generate-market.ts +++ b/apps/trading-e2e/src/support/mocks/generate-market.ts @@ -38,9 +38,9 @@ export const generateMarket = ( __typename: 'InstrumentMetadata', }, product: { - oracleSpecForTradingTermination: { + dataSourceSpecForTradingTermination: { id: 'd253c16c6a17ab88e098479635c611ab503582a1079752d1a49ac15f656f7e7b', - __typename: 'OracleSpec', + __typename: 'DataSourceSpec', }, quoteName: 'BTCUSD Monthly', settlementAsset: { diff --git a/apps/trading/client-pages/market/trade-grid.tsx b/apps/trading/client-pages/market/trade-grid.tsx index 70d129d42..5362e89af 100644 --- a/apps/trading/client-pages/market/trade-grid.tsx +++ b/apps/trading/client-pages/market/trade-grid.tsx @@ -72,7 +72,7 @@ const ExpiryTooltipContent = ({ if (market.marketTimestamps.close === null) { const oracleId = market.tradableInstrument.instrument.product - .oracleSpecForTradingTermination?.id; + .dataSourceSpecForTradingTermination?.id; return (
diff --git a/libs/liquidity/src/lib/__generated__/MarketLiquidity.ts b/libs/liquidity/src/lib/__generated__/MarketLiquidity.ts index 8857d7225..4717d9fae 100644 --- a/libs/liquidity/src/lib/__generated__/MarketLiquidity.ts +++ b/libs/liquidity/src/lib/__generated__/MarketLiquidity.ts @@ -290,4 +290,4 @@ export function useLiquidityProviderFeeShareUpdateSubscription(baseOptions: Apol return Apollo.useSubscription(LiquidityProviderFeeShareUpdateDocument, options); } export type LiquidityProviderFeeShareUpdateSubscriptionHookResult = ReturnType; -export type LiquidityProviderFeeShareUpdateSubscriptionResult = Apollo.SubscriptionResult; +export type LiquidityProviderFeeShareUpdateSubscriptionResult = Apollo.SubscriptionResult; \ No newline at end of file diff --git a/libs/market-info/src/components/market-info/MarketInfo.graphql b/libs/market-info/src/components/market-info/MarketInfo.graphql index 589844229..967afaee7 100644 --- a/libs/market-info/src/components/market-info/MarketInfo.graphql +++ b/libs/market-info/src/components/market-info/MarketInfo.graphql @@ -108,13 +108,13 @@ query MarketInfo($marketId: ID!, $interval: Interval!, $since: String!) { name decimals } - oracleSpecForSettlementData { + dataSourceSpecForSettlementData { id } - oracleSpecForTradingTermination { + dataSourceSpecForTradingTermination { id } - oracleSpecBinding { + dataSourceSpecBinding { settlementDataProperty tradingTerminationProperty } diff --git a/libs/market-info/src/components/market-info/__generated___/MarketInfo.ts b/libs/market-info/src/components/market-info/__generated___/MarketInfo.ts index f7adbe3eb..041fae329 100644 --- a/libs/market-info/src/components/market-info/__generated___/MarketInfo.ts +++ b/libs/market-info/src/components/market-info/__generated___/MarketInfo.ts @@ -10,7 +10,7 @@ export type MarketInfoQueryVariables = Types.Exact<{ }>; -export type MarketInfoQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, proposal?: { __typename?: 'Proposal', id?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string } } | null, marketTimestamps: { __typename?: 'MarketTimestamps', open?: string | null, close?: string | null }, openingAuction: { __typename?: 'AuctionDuration', durationSecs: number, volume: number }, accounts?: Array<{ __typename?: 'AccountBalance', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string } }> | null, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string } }, priceMonitoringSettings: { __typename?: 'PriceMonitoringSettings', parameters?: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null } | null }, riskFactors?: { __typename?: 'RiskFactor', market: string, short: string, long: string } | null, data?: { __typename?: 'MarketData', markPrice: string, bestBidVolume: string, bestOfferVolume: string, bestStaticBidVolume: string, bestStaticOfferVolume: string, bestBidPrice: string, bestOfferPrice: string, trigger: Types.AuctionTrigger, openInterest: string, suppliedStake?: string | null, targetStake?: string | null, marketValueProxy: string, market: { __typename?: 'Market', id: string }, priceMonitoringBounds?: Array<{ __typename?: 'PriceMonitoringBounds', minValidPrice: string, maxValidPrice: string, referencePrice: string, trigger: { __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number } }> | null } | null, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: number, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, candlesConnection?: { __typename?: 'CandleDataConnection', edges?: Array<{ __typename?: 'CandleEdge', node: { __typename?: 'Candle', volume: string } } | null> | null } | null, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number }, oracleSpecForSettlementData: { __typename?: 'OracleSpec', id: string }, oracleSpecForTradingTermination: { __typename?: 'OracleSpec', id: string }, oracleSpecBinding: { __typename?: 'OracleSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } }, riskModel: { __typename?: 'LogNormalRiskModel', tau: number, riskAversionParameter: number, params: { __typename?: 'LogNormalModelParams', r: number, sigma: number, mu: number } } | { __typename?: 'SimpleRiskModel', params: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } } }, depth: { __typename?: 'MarketDepth', lastTrade?: { __typename?: 'Trade', price: string } | null } } | null }; +export type MarketInfoQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, proposal?: { __typename?: 'Proposal', id?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string } } | null, marketTimestamps: { __typename?: 'MarketTimestamps', open?: string | null, close?: string | null }, openingAuction: { __typename?: 'AuctionDuration', durationSecs: number, volume: number }, accounts?: Array<{ __typename?: 'AccountBalance', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string } }> | null, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string } }, priceMonitoringSettings: { __typename?: 'PriceMonitoringSettings', parameters?: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null } | null }, riskFactors?: { __typename?: 'RiskFactor', market: string, short: string, long: string } | null, data?: { __typename?: 'MarketData', markPrice: string, bestBidVolume: string, bestOfferVolume: string, bestStaticBidVolume: string, bestStaticOfferVolume: string, bestBidPrice: string, bestOfferPrice: string, trigger: Types.AuctionTrigger, openInterest: string, suppliedStake?: string | null, targetStake?: string | null, marketValueProxy: string, market: { __typename?: 'Market', id: string }, priceMonitoringBounds?: Array<{ __typename?: 'PriceMonitoringBounds', minValidPrice: string, maxValidPrice: string, referencePrice: string, trigger: { __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number } }> | null } | null, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: number, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, candlesConnection?: { __typename?: 'CandleDataConnection', edges?: Array<{ __typename?: 'CandleEdge', node: { __typename?: 'Candle', volume: string } } | null> | null } | null, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number }, dataSourceSpecForSettlementData: { __typename?: 'DataSourceSpec', id: string }, dataSourceSpecForTradingTermination: { __typename?: 'DataSourceSpec', id: string }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } }, riskModel: { __typename?: 'LogNormalRiskModel', tau: number, riskAversionParameter: number, params: { __typename?: 'LogNormalModelParams', r: number, sigma: number, mu: number } } | { __typename?: 'SimpleRiskModel', params: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } } }, depth: { __typename?: 'MarketDepth', lastTrade?: { __typename?: 'Trade', price: string } | null } } | null }; export const MarketInfoDocument = gql` @@ -124,13 +124,13 @@ export const MarketInfoDocument = gql` name decimals } - oracleSpecForSettlementData { + dataSourceSpecForSettlementData { id } - oracleSpecForTradingTermination { + dataSourceSpecForTradingTermination { id } - oracleSpecBinding { + dataSourceSpecBinding { settlementDataProperty tradingTerminationProperty } diff --git a/libs/market-info/src/components/market-info/info-market.tsx b/libs/market-info/src/components/market-info/info-market.tsx index 22ddccddf..3825e6699 100644 --- a/libs/market-info/src/components/market-info/info-market.tsx +++ b/libs/market-info/src/components/market-info/info-market.tsx @@ -332,15 +332,17 @@ export const Info = ({ market, onSelect }: InfoProps) => { title: t('Oracle'), content: ( {t('View settlement data oracle specification')} {t('View termination oracle specification')} diff --git a/libs/market-list/src/lib/__generated___/market.ts b/libs/market-list/src/lib/__generated___/market.ts index 47d363f2c..03546331f 100644 --- a/libs/market-list/src/lib/__generated___/market.ts +++ b/libs/market-list/src/lib/__generated___/market.ts @@ -3,14 +3,14 @@ import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; const defaultOptions = {} as const; -export type SingleMarketFieldsFragment = { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string } }, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', quoteName: string, oracleSpecForTradingTermination: { __typename?: 'OracleSpec', id: string }, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number } } } }, marketTimestamps: { __typename?: 'MarketTimestamps', open?: string | null, close?: string | null } }; +export type SingleMarketFieldsFragment = { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string } }, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', quoteName: string, dataSourceSpecForTradingTermination: { __typename?: 'DataSourceSpec', id: string }, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number } } } }, marketTimestamps: { __typename?: 'MarketTimestamps', open?: string | null, close?: string | null } }; export type MarketQueryVariables = Types.Exact<{ marketId: Types.Scalars['ID']; }>; -export type MarketQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string } }, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', quoteName: string, oracleSpecForTradingTermination: { __typename?: 'OracleSpec', id: string }, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number } } } }, marketTimestamps: { __typename?: 'MarketTimestamps', open?: string | null, close?: string | null } } | null }; +export type MarketQuery = { __typename?: 'Query', market?: { __typename?: 'Market', id: string, decimalPlaces: number, positionDecimalPlaces: number, state: Types.MarketState, tradingMode: Types.MarketTradingMode, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string } }, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', id: string, name: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', quoteName: string, dataSourceSpecForTradingTermination: { __typename?: 'DataSourceSpec', id: string }, settlementAsset: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number } } } }, marketTimestamps: { __typename?: 'MarketTimestamps', open?: string | null, close?: string | null } } | null }; export const SingleMarketFieldsFragmentDoc = gql` fragment SingleMarketFields on Market { @@ -36,7 +36,7 @@ export const SingleMarketFieldsFragmentDoc = gql` } product { ... on Future { - oracleSpecForTradingTermination { + dataSourceSpecForTradingTermination { id } settlementAsset { diff --git a/libs/market-list/src/lib/market.graphql b/libs/market-list/src/lib/market.graphql index 49d9ecd6c..316056fe2 100644 --- a/libs/market-list/src/lib/market.graphql +++ b/libs/market-list/src/lib/market.graphql @@ -21,7 +21,7 @@ fragment SingleMarketFields on Market { } product { ... on Future { - oracleSpecForTradingTermination { + dataSourceSpecForTradingTermination { id } settlementAsset { diff --git a/libs/types/src/__generated__/globalTypes.ts b/libs/types/src/__generated__/globalTypes.ts index 8884daf14..510d9baf8 100644 --- a/libs/types/src/__generated__/globalTypes.ts +++ b/libs/types/src/__generated__/globalTypes.ts @@ -55,6 +55,14 @@ export enum ConditionOperator { OPERATOR_LESS_THAN_OR_EQUAL = "OPERATOR_LESS_THAN_OR_EQUAL", } +/** + * Status describe the status of the data spec + */ +export enum DataSourceSpecStatus { + STATUS_ACTIVE = "STATUS_ACTIVE", + STATUS_DEACTIVATED = "STATUS_DEACTIVATED", +} + /** * The current state of a market */ @@ -90,15 +98,7 @@ export enum NodeStatus { } /** - * Status describe the status of the oracle spec - */ -export enum OracleSpecStatus { - STATUS_ACTIVE = "STATUS_ACTIVE", - STATUS_DEACTIVATED = "STATUS_DEACTIVATED", -} - -/** - * Type describes the type of properties that are supported by the oracle + * Type describes the type of properties that are supported by the data source * engine. */ export enum PropertyKeyType { diff --git a/libs/types/src/__generated__/types.ts b/libs/types/src/__generated__/types.ts index 52c30b2c3..d1baa9c4e 100644 --- a/libs/types/src/__generated__/types.ts +++ b/libs/types/src/__generated__/types.ts @@ -430,7 +430,7 @@ export type CandleEdge = { node: Candle; }; -/** Condition describes the condition that must be validated by the oracle engine */ +/** Condition describes the condition that must be validated by the data source engine */ export type Condition = { __typename?: 'Condition'; /** The type of comparison to make on the value. */ @@ -443,14 +443,14 @@ export type Condition = { export enum ConditionOperator { /** Verify if the property values are strictly equal or not. */ OPERATOR_EQUALS = 'OPERATOR_EQUALS', - /** Verify if the oracle data value is greater than the Condition value. */ + /** Verify if the data source data value is greater than the Condition value. */ OPERATOR_GREATER_THAN = 'OPERATOR_GREATER_THAN', /** - * Verify if the oracle data value is greater than or equal to the Condition + * Verify if the data source data value is greater than or equal to the Condition * value. */ OPERATOR_GREATER_THAN_OR_EQUAL = 'OPERATOR_GREATER_THAN_OR_EQUAL', - /** Verify if the oracle data value is less than the Condition value. */ + /** Verify if the data source data value is less than the Condition value. */ OPERATOR_LESS_THAN = 'OPERATOR_LESS_THAN', /** * Verify if the oracle data value is less or equal to than the Condition @@ -466,6 +466,119 @@ export type ContinuousTrading = { tickSize: Scalars['String']; }; +/** A data source contains the data sent by a data source */ +export type Data = { + __typename?: 'Data'; + /** + * RFC3339Nano formatted date and time for when the data was broadcast to the markets + * with a matching data spec. + * It has no value when the source data does not match any data spec. + */ + broadcastAt: Scalars['String']; + /** properties contains all the properties sent by a data source */ + data?: Maybe>; + /** + * List of all the data specs that matched this source data. + * When the array is empty, it means no data spec matched this source data. + */ + matchedSpecIds?: Maybe>; + /** signers is the list of public keys/ETH addresses that signed the data */ + signers?: Maybe>; +}; + +/** + * DataSourceDefinition represents the top level object that deals with data sources. + * DataSourceDefinition can be external or internal, with whatever number of data sources are defined + * for each type in the child objects below. + */ +export type DataSourceDefinition = { + __typename?: 'DataSourceDefinition'; + sourceType: DataSourceKind; +}; + +/** + * DataSourceDefinitionExternal is the top level object used for all external data sources. + * It contains one of any of the defined `SourceType` variants. + */ +export type DataSourceDefinitionExternal = { + __typename?: 'DataSourceDefinitionExternal'; + sourceType: ExternalDataSourceKind; +}; + +/** + * DataSourceDefinitionInternal is the top level object used for all internal data sources. + * It contains one of any of the defined `SourceType` variants. + */ +export type DataSourceDefinitionInternal = { + __typename?: 'DataSourceDefinitionInternal'; + sourceType: InternalDataSourceKind; +}; + +export type DataSourceKind = DataSourceDefinitionExternal | DataSourceDefinitionInternal; + +/** + * An data source specification describes the data source data that a product (or a risk model) + * wants to get from the oracle engine. + */ +export type DataSourceSpec = { + __typename?: 'DataSourceSpec'; + /** RFC3339Nano creation date time */ + createdAt: Scalars['String']; + data: DataSourceDefinition; + /** ID is a hash generated from the DataSourceSpec data. */ + id: Scalars['ID']; + /** Status describes the status of the data source spec */ + status: DataSourceSpecStatus; + /** RFC3339Nano last updated timestamp */ + updatedAt?: Maybe; +}; + +/** + * A data spec describes the source data that an instrument wants to get from the + * sourcing engine. + */ +export type DataSourceSpecConfiguration = { + __typename?: 'DataSourceSpecConfiguration'; + /** + * filters describes which source data are considered of interest or not for + * the product (or the risk model). + */ + filters?: Maybe>; + /** + * signers is the list of authorized signatures that signed the data for this + * data source. All the public keys in the data should be contained in this + * list. + */ + signers?: Maybe>; +}; + +/** DataSourceSpecConfigurationTime is the internal data source used for emitting timestamps. */ +export type DataSourceSpecConfigurationTime = { + __typename?: 'DataSourceSpecConfigurationTime'; + conditions: Array>; +}; + +/** Status describe the status of the data spec */ +export enum DataSourceSpecStatus { + /** describes an active data spec. */ + STATUS_ACTIVE = 'STATUS_ACTIVE', + /** + * describes a data spec that is not listening to data + * anymore. + */ + STATUS_DEACTIVATED = 'STATUS_DEACTIVATED' +} + +/** + * DataSourceSpecToFutureBinding tells on which property data source data should be + * used as settlement data and trading termination. + */ +export type DataSourceSpecToFutureBinding = { + __typename?: 'DataSourceSpecToFutureBinding'; + settlementDataProperty: Scalars['String']; + tradingTerminationProperty: Scalars['String']; +}; + /** * Range of dates to retrieve information for. * If start and end are provided, data will be returned within the specified range (exclusive). @@ -688,6 +801,11 @@ export type ERC20SetAssetLimitsBundle = { vegaAssetId: Scalars['String']; }; +export type ETHAddress = { + __typename?: 'ETHAddress'; + address?: Maybe; +}; + /** Epoch describes a specific period of time in the Vega network */ export type Epoch = { __typename?: 'Epoch'; @@ -814,7 +932,7 @@ export type Erc20WithdrawalDetails = { receiverAddress: Scalars['String']; }; -/** An Ethereum oracle */ +/** An Ethereum data source */ export type EthereumEvent = { __typename?: 'EthereumEvent'; /** The ID of the ethereum contract to use (string) */ @@ -855,6 +973,22 @@ export type EthereumKeyRotationsConnection = { /** Union type for wrapped events in stream PROPOSAL is mapped to governance data, something to keep in mind */ export type Event = AccountEvent | Asset | AuctionEvent | Deposit | LiquidityProvision | LossSocialization | MarginLevels | Market | MarketData | MarketEvent | MarketTick | NodeSignature | OracleSpec | Order | Party | PositionResolution | Proposal | RiskFactor | SettleDistressed | SettlePosition | TimeUpdate | Trade | TransactionResult | TransferResponses | Vote | Withdrawal; +export type ExternalData = { + __typename?: 'ExternalData'; + data: Data; +}; + +export type ExternalDataSourceKind = DataSourceSpecConfiguration; + +/** + * externalDataSourceSpec is the type that wraps the DataSourceSpec type in order to be further used/extended + * by the OracleSpec + */ +export type ExternalDataSourceSpec = { + __typename?: 'ExternalDataSourceSpec'; + spec: DataSourceSpec; +}; + /** The factors applied to calculate the fees */ export type FeeFactors = { __typename?: 'FeeFactors'; @@ -884,38 +1018,38 @@ export type Filter = { * considered of interest. */ conditions?: Maybe>; - /** The oracle data property key targeted by the filter. */ + /** key is the data source data property key targeted by the filter. */ key: PropertyKey; }; /** A Future product */ export type Future = { __typename?: 'Future'; - /** The binding between the oracle spec and the settlement data */ - oracleSpecBinding: OracleSpecToFutureBinding; - /** The oracle spec describing the oracle data of interest for settlement. */ - oracleSpecForSettlementData: OracleSpec; - /** The oracle spec describing the oracle data of interest for trading termination. */ - oracleSpecForTradingTermination: OracleSpec; + /** The binding between the data source specification and the settlement data */ + dataSourceSpecBinding: DataSourceSpecToFutureBinding; + /** The data source specification that describes the data of interest for settlement. */ + dataSourceSpecForSettlementData: DataSourceSpec; + /** The data source specification describing the data source data of interest for trading termination. */ + dataSourceSpecForTradingTermination: DataSourceSpec; /** String representing the quote (e.g. BTCUSD -> USD is quote) */ quoteName: Scalars['String']; /** The name of the asset (string) */ settlementAsset: Asset; - /** The number of decimal places implied by the settlement data (such as price) emitted by the settlement oracle */ + /** The number of decimal places implied by the settlement data (such as price) emitted by the settlement data source */ settlementDataDecimals: Scalars['Int']; }; export type FutureProduct = { __typename?: 'FutureProduct'; /** - * OracleSpecToFutureBinding tells on which property oracle data should be + * DataSourceSpecToFutureBinding tells on which property source data should be * used as settlement data. */ - oracleSpecBinding: OracleSpecToFutureBinding; - /** Describes the oracle data that an instrument wants to get from the oracle engine for settlement data. */ - oracleSpecForSettlementData: OracleSpecConfiguration; - /** Describes the oracle data that an instrument wants to get from the oracle engine for trading termination. */ - oracleSpecForTradingTermination: OracleSpecConfiguration; + dataSourceSpecBinding: DataSourceSpecToFutureBinding; + /** Describes the data source data that an instrument wants to get from the data source engine for settlement data. */ + dataSourceSpecForSettlementData: DataSourceDefinition; + /** Describes the source data that an instrument wants to get from the data source engine for trading termination. */ + dataSourceSpecForTradingTermination: DataSourceDefinition; /** String representing the quote (e.g. BTCUSD -> USD is quote) */ quoteName: Scalars['String']; /** Product asset */ @@ -974,6 +1108,8 @@ export type InstrumentMetadata = { tags?: Maybe>; }; +export type InternalDataSourceKind = DataSourceSpecConfigurationTime; + /** The interval for trade candles when subscribing via Vega GraphQL, default is I15M */ export enum Interval { /** 1 day interval */ @@ -2028,139 +2164,48 @@ export type Oracle = EthereumEvent; /** An oracle data contains the data sent by an oracle */ export type OracleData = { __typename?: 'OracleData'; - /** - * RFC3339Nano formatted date and time for when the data was broadcast to the markets - * with a matching oracle spec. - * It has no value when the oracle date does not match any oracle spec. - */ - broadcastAt: Scalars['String']; - /** All the properties sent by an oracle */ - data?: Maybe>; - /** - * Lists of all the oracle specs that matched this oracle data. - * When the array is empty, it means no oracle spec matched this oracle data. - */ - matchedSpecIds?: Maybe>; - /** The list of public keys that signed the data */ - pubKeys?: Maybe>; + externalData: ExternalData; }; -/** Connection type for retrieving cursor-based paginated oracle data information */ export type OracleDataConnection = { __typename?: 'OracleDataConnection'; - /** The oracle data */ + /** The oracle data spec */ edges?: Maybe>>; /** The pagination information */ pageInfo: PageInfo; }; -/** Edge type containing the oracle data and cursor information returned by a OracleDataConnection */ export type OracleDataEdge = { __typename?: 'OracleDataEdge'; /** The cursor for the data item */ cursor: Scalars['String']; - /** The oracle data */ + /** The oracle data source */ node: OracleData; }; -/** - * An oracle spec describe the oracle data that a product (or a risk model) - * wants to get from the oracle engine. - */ export type OracleSpec = { __typename?: 'OracleSpec'; - /** RFC3339Nano creation date time */ - createdAt: Scalars['String']; - /** - * Data list all the oracle data broadcast to this spec - * @deprecated Use dataConnection instead - */ - data: Array; /** Data list all the oracle data broadcast to this spec */ dataConnection: OracleDataConnection; - /** - * Filters describes which oracle data are considered of interest or not for - * the product (or the risk model). - */ - filters?: Maybe>; - /** ID is a hash generated from the OracleSpec data. */ - id: Scalars['ID']; - /** - * The list of authorized public keys that signed the data for this - * oracle. All the public keys in the oracle data should be contained in these - * public keys. - */ - pubKeys?: Maybe>; - /** Status describes the status of the oracle spec */ - status: OracleSpecStatus; - /** RFC3339Nano last updated timestamp */ - updatedAt?: Maybe; + dataSourceSpec: ExternalDataSourceSpec; }; -/** - * An oracle spec describe the oracle data that a product (or a risk model) - * wants to get from the oracle engine. - */ export type OracleSpecdataConnectionArgs = { pagination?: InputMaybe; }; -/** - * An oracle spec describe the oracle data that an instrument wants to get from the - * oracle engine. - */ -export type OracleSpecConfiguration = { - __typename?: 'OracleSpecConfiguration'; - /** - * Filters describes which oracle data are considered of interest or not for - * the product (or the risk model). - */ - filters?: Maybe>; - /** - * The list of authorised public keys that signed the data for this - * oracle. All the public keys in the oracle data should be contained in these - * public keys. - */ - pubKeys?: Maybe>; -}; - -/** Edge type containing the oracle spec and cursor information returned by a OracleSpecsConnection */ export type OracleSpecEdge = { __typename?: 'OracleSpecEdge'; - /** The cursor for the spec item */ + /** The cursor for the external data */ cursor: Scalars['String']; - /** The oracle spec */ + /** The external data spec */ node: OracleSpec; }; -/** Status describe the status of the oracle spec */ -export enum OracleSpecStatus { - /** Describes an active oracle spec. */ - STATUS_ACTIVE = 'STATUS_ACTIVE', - /** - * Describes an oracle spec that is not listening to data - * anymore. - */ - STATUS_DEACTIVATED = 'STATUS_DEACTIVATED' -} - -/** - * OracleSpecToFutureBinding tells on which property oracle data should be - * used as settlement data and trading termination. - */ -export type OracleSpecToFutureBinding = { - __typename?: 'OracleSpecToFutureBinding'; - settlementDataProperty: Scalars['String']; - tradingTerminationProperty: Scalars['String']; -}; - -/** Connection type for retrieving cursor-based paginated oracle specs information */ export type OracleSpecsConnection = { __typename?: 'OracleSpecsConnection'; - /** The oracle specs */ edges?: Maybe>>; - /** The pagination information */ pageInfo: PageInfo; }; @@ -2935,7 +2980,7 @@ export type Property = { value: Scalars['String']; }; -/** PropertyKey describes the property key contained in an oracle data. */ +/** PropertyKey describes the property key contained in a source data. */ export type PropertyKey = { __typename?: 'PropertyKey'; /** The name of the property. */ @@ -2945,7 +2990,7 @@ export type PropertyKey = { }; /** - * Type describes the type of properties that are supported by the oracle + * Type describes the type of properties that are supported by the data source * engine. */ export enum PropertyKeyType { @@ -3221,12 +3266,60 @@ export type ProposalsConnection = { pageInfo: PageInfo; }; +/** A proposal to upgrade the vega protocol (i.e. which version of the vega software nodes will run) */ +export type ProtocolUpgradeProposal = { + __typename?: 'ProtocolUpgradeProposal'; + /** Tendermint validators that have agreed to the upgrade */ + approvers: Array; + /** the status of the proposal */ + status: ProtocolUpgradeProposalStatus; + /** At which block the upgrade is proposed */ + upgradeBlockHeight: Scalars['String']; + /** To which vega release tag the upgrade is proposed */ + vegaReleaseTag: Scalars['String']; +}; + +/** Connection type for retrieving cursor-based paginated protocol upgrade proposals */ +export type ProtocolUpgradeProposalConnection = { + __typename?: 'ProtocolUpgradeProposalConnection'; + /** The positions in this connection */ + edges?: Maybe>; + /** The pagination information */ + pageInfo?: Maybe; +}; + +/** Edge type containing the protocol upgrade protocol cursor information */ +export type ProtocolUpgradeProposalEdge = { + __typename?: 'ProtocolUpgradeProposalEdge'; + /** Cursor identifying the protocol upgrade proposal */ + cursor: Scalars['String']; + /** The protocol upgrade proposal */ + node: ProtocolUpgradeProposal; +}; + +/** The set of valid statuses for a protocol upgrade proposal */ +export enum ProtocolUpgradeProposalStatus { + /** Proposal to upgrade protocol version accepted */ + PROTOCOL_UPGRADE_PROPOSAL_STATUS_APPROVED = 'PROTOCOL_UPGRADE_PROPOSAL_STATUS_APPROVED', + /** Proposal to upgrade protocol version is awaiting sufficient validator approval */ + PROTOCOL_UPGRADE_PROPOSAL_STATUS_PENDING = 'PROTOCOL_UPGRADE_PROPOSAL_STATUS_PENDING', + /** Proposal to upgrade protocol version has been rejected */ + PROTOCOL_UPGRADE_PROPOSAL_STATUS_REJECTED = 'PROTOCOL_UPGRADE_PROPOSAL_STATUS_REJECTED', + /** Invalid proposal state */ + PROTOCOL_UPGRADE_PROPOSAL_STATUS_UNSPECIFIED = 'PROTOCOL_UPGRADE_PROPOSAL_STATUS_UNSPECIFIED' +} + /** Indicator showing whether the data-node is ready for the protocol upgrade to begin. */ export type ProtocolUpgradeStatus = { __typename?: 'ProtocolUpgradeStatus'; ready: Scalars['Boolean']; }; +export type PubKey = { + __typename?: 'PubKey'; + key?: Maybe; +}; + /** Queries allow a caller to read data and filter data via GraphQL. */ export type Query = { __typename?: 'Query'; @@ -3391,6 +3484,8 @@ export type Query = { proposals?: Maybe>; /** All governance proposals in the Vega network */ proposalsConnection?: Maybe; + /** List protocol upgrade proposals, optionally filtering on status or approver */ + protocolUpgradeProposals?: Maybe; /** Flag indicating whether the data-node is ready to begin the protocol upgrade */ protocolUpgradeStatus?: Maybe; /** Get statistics about the Vega node */ @@ -3744,6 +3839,14 @@ export type QueryproposalsConnectionArgs = { }; +/** Queries allow a caller to read data and filter data via GraphQL. */ +export type QueryprotocolUpgradeProposalsArgs = { + approvedBy?: InputMaybe; + inState?: InputMaybe; + pagination?: InputMaybe; +}; + + /** Queries allow a caller to read data and filter data via GraphQL. */ export type QuerytransfersArgs = { isFrom?: InputMaybe; @@ -3984,6 +4087,14 @@ export enum Side { SIDE_SELL = 'SIDE_SELL' } +/** Signer is the authorized signature used for the data. */ +export type Signer = { + __typename?: 'Signer'; + signer: SignerKind; +}; + +export type SignerKind = ETHAddress | PubKey; + /** A type of simple/dummy risk model where you can specify the risk factor long and short in params */ export type SimpleRiskModel = { __typename?: 'SimpleRiskModel'; @@ -4590,9 +4701,9 @@ export type UpdateERC20 = { export type UpdateFutureProduct = { __typename?: 'UpdateFutureProduct'; - oracleSpecBinding: OracleSpecToFutureBinding; - oracleSpecForSettlementData: OracleSpecConfiguration; - oracleSpecForTradingTermination: OracleSpecConfiguration; + dataSourceSpecBinding: DataSourceSpecToFutureBinding; + dataSourceSpecForSettlementData: DataSourceDefinition; + dataSourceSpecForTradingTermination: DataSourceDefinition; quoteName: Scalars['String']; }; diff --git a/libs/types/src/global-types-mappings.ts b/libs/types/src/global-types-mappings.ts index e8e77f2af..c938c6554 100644 --- a/libs/types/src/global-types-mappings.ts +++ b/libs/types/src/global-types-mappings.ts @@ -92,7 +92,7 @@ export enum NodeStatusMapping { /** * Status describe the status of the oracle spec */ -export enum OracleSpecStatusMapping { +export enum DataSourceSpecStatusMapping { STATUS_ACTIVE = 'Active', STATUS_DEACTIVATED = 'Deactivated', } diff --git a/libs/wallet/src/connectors/vega-connector.ts b/libs/wallet/src/connectors/vega-connector.ts index a5d1242d3..ed01b6c77 100644 --- a/libs/wallet/src/connectors/vega-connector.ts +++ b/libs/wallet/src/connectors/vega-connector.ts @@ -83,9 +83,9 @@ interface ProposalNewMarketTerms { settlementAsset: string; quoteName: string; settlementPriceDecimals: number; - oracleSpecForSettlementPrice: OracleSpecFor; - oracleSpecForTradingTermination: OracleSpecFor; - oracleSpecBinding: OracleSpecBinding; + dataSourceSpecForSettlementData: DataSourceSpec; + dataSourceSpecForTradingTermination: DataSourceSpec; + dataSourceSpecBinding: DataSourceSpecBinding; }; }; metadata?: string[]; @@ -120,9 +120,9 @@ interface ProposalUpdateMarketTerms { future: { quoteName: string; settlementPriceDecimals: number; - oracleSpecForSettlementPrice: OracleSpecFor; - oracleSpecForTradingTermination: OracleSpecFor; - oracleSpecBinding: OracleSpecBinding; + dataSourceSpecForSettlementPrice: DataSourceSpec; + dataSourceSpecForTradingTermination: DataSourceSpec; + dataSourceSpecBinding: DataSourceSpecBinding; }; }; priceMonitoringParameters?: PriceMonitoringParameters; @@ -183,16 +183,26 @@ interface ProposalUpdateAssetTerms { enactmentTimestamp: number; } -interface OracleSpecBinding { +interface DataSourceSpecBinding { settlementPriceProperty: string; tradingTerminationProperty: string; } -interface OracleSpecFor { - pubKeys: string[]; - filters: Filter[]; +interface DataSourceSpec { + config: { + signers: Signer[]; + filters: Filter[]; + }; } +type Signer = + | { + address: string; + } + | { + key: string; + }; + interface Filter { key: { name: string; From 5666b8f8e4d0f53e62b463632d5f64dae6386f52 Mon Sep 17 00:00:00 2001 From: Matthew Russell Date: Tue, 8 Nov 2022 20:59:49 -0600 Subject: [PATCH 06/34] chore: add custom export executor for next app (#1999) * chore: add custom export executor for next app * chore: update tsconfig path for export executor --- apps/trading/project.json | 2 +- tools/executors/next/executor.json | 7 ++++++- tools/executors/next/export/impl.ts | 22 ++++++++++++++++++++++ tools/executors/next/export/schema.json | 18 ++++++++++++++++++ tools/executors/next/tsconfig.json | 2 +- 5 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 tools/executors/next/export/impl.ts create mode 100644 tools/executors/next/export/schema.json diff --git a/apps/trading/project.json b/apps/trading/project.json index d4005c7b4..64e166721 100644 --- a/apps/trading/project.json +++ b/apps/trading/project.json @@ -32,7 +32,7 @@ } }, "export": { - "executor": "@nrwl/next:export", + "executor": "./tools/executors/next:export", "options": { "buildTarget": "trading:build:production" } diff --git a/tools/executors/next/executor.json b/tools/executors/next/executor.json index cd82d63bd..bf071e4b4 100644 --- a/tools/executors/next/executor.json +++ b/tools/executors/next/executor.json @@ -8,7 +8,12 @@ "build": { "implementation": "./build/impl", "schema": "./build/schema.json", - "description": "Starts a next server with an optional explicit environment." + "description": "Builds a next app with an optional explicit environment." + }, + "export": { + "implementation": "./export/impl", + "schema": "./serve/schema.json", + "description": "Exports a next app with an optional explicit environment." } } } diff --git a/tools/executors/next/export/impl.ts b/tools/executors/next/export/impl.ts new file mode 100644 index 000000000..302aa2618 --- /dev/null +++ b/tools/executors/next/export/impl.ts @@ -0,0 +1,22 @@ +import type { ExecutorContext } from '@nrwl/devkit'; +import setup from '../../../utils/setup-environment'; +import nextExportExecutor from '@nrwl/next/src/executors/export/export.impl'; +import { NextExportBuilderOptions } from '@nrwl/next/src/utils/types'; + +type Schema = NextExportBuilderOptions & { + env: string; +}; + +export default async function exportWithEnv( + options: Schema, + context: ExecutorContext +) { + const { env, ...nextOptions } = options; + await setup(env, context, 'tools/executors/next/export'); + + try { + return await nextExportExecutor(nextOptions, context); + } catch (err) { + console.error(err); + } +} diff --git a/tools/executors/next/export/schema.json b/tools/executors/next/export/schema.json new file mode 100644 index 000000000..a91d1ae55 --- /dev/null +++ b/tools/executors/next/export/schema.json @@ -0,0 +1,18 @@ +{ + "cli": "nx", + "id": "export", + "description": "Exports a next app app using @nrwl/next:export with an optional explicit environment", + "type": "object", + "properties": { + "env": { + "type": "string", + "description": "Target environment to run the application in. This assumes an .env file present in the project's root in the following format: .env.{envName}" + }, + "buildLibsFromSource": { + "type": "boolean", + "description": "Read buildable libraries from source instead of building them separately.", + "default": true + } + }, + "required": ["root", "outputPath"] +} diff --git a/tools/executors/next/tsconfig.json b/tools/executors/next/tsconfig.json index 1cfd7884b..badfe46e0 100644 --- a/tools/executors/next/tsconfig.json +++ b/tools/executors/next/tsconfig.json @@ -8,6 +8,6 @@ "sourceMap": false, "inlineSourceMap": true }, - "include": ["build/impl.ts", "serve/impl.ts"], + "include": ["build/impl.ts", "serve/impl.ts", "export/impl.ts"], "exclude": ["node_modules"] } From 2983d5461cef50f49ead6c8be37457756cb2a1f0 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Wed, 9 Nov 2022 06:05:02 +0000 Subject: [PATCH 07/34] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index e44637338..ee19cdea3 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -274,7 +274,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "92753.28361635430119921", + "locked_amount": "92694.94926258681037035", "deposits": [ { "amount": "129999.45", @@ -340,7 +340,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "42943.56503678335892", + "locked_amount": "42908.12808853373746", "deposits": [ { "amount": "2600", @@ -513,7 +513,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "4273.868753170979", + "locked_amount": "4270.500221968544", "deposits": [ { "amount": "5000", @@ -724,7 +724,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "34204.532491356734070777", + "locked_amount": "34147.311924401683111446", "deposits": [ { "amount": "97499.58", @@ -757,7 +757,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "46751.69074949979729638360568", + "locked_amount": "46673.480113191018728142460272", "deposits": [ { "amount": "135173.4239508", @@ -790,7 +790,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "14389.256138432201684011", + "locked_amount": "14365.184434060548245424", "deposits": [ { "amount": "32499.86", @@ -823,7 +823,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "4683.563243023215928832", + "locked_amount": "4675.728136836532787765", "deposits": [ { "amount": "10833.29", @@ -856,7 +856,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "22749.93", "total_removed": "0", - "locked_amount": "17508.205457378926537023", + "locked_amount": "17478.916080513742668933", "deposits": [ { "amount": "6500", @@ -995,7 +995,7 @@ "tranche_end": "2023-05-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "21504.58247007366525", + "locked_amount": "21474.014445211788", "deposits": [ { "amount": "7500", @@ -1048,7 +1048,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "626880.6921411330574", - "locked_amount": "1089508.52401925103341382", + "locked_amount": "1088201.582163547003099922", "deposits": [ { "amount": "1852091.69", @@ -1345,7 +1345,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "19400.4228625704518", + "locked_amount": "19343.6246666163463", "deposits": [ { "amount": "12500", @@ -25339,7 +25339,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "229348.4397135638212", - "locked_amount": "1698696.59956746798586837754", + "locked_amount": "1696688.190437360439041189194", "deposits": [ { "amount": "1998.95815", @@ -26344,7 +26344,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "307088.7055255201186094", - "locked_amount": "11323156.6609609208548253724193984756596378", + "locked_amount": "11316034.9711377505576490248032240968423899", "deposits": [ { "amount": "16249.93", @@ -30265,7 +30265,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "3220949.512421240585683667", - "locked_amount": "4732020.704070914950811369241679716", + "locked_amount": "4725446.00549858308035656761920864", "deposits": [ { "amount": "129284.449", @@ -36063,7 +36063,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "2147526.429852157556378517", - "locked_amount": "1552746.595661182786898204921097639", + "locked_amount": "1550148.89249180889818289302996639", "deposits": [ { "amount": "552496.6455", @@ -37715,7 +37715,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "9123.290251072296", - "locked_amount": "269168.18636519828897319848604768", + "locked_amount": "268849.94245797667578915166615932", "deposits": [ { "amount": "3000", From b4ab94b54b0b4bf8950385f73cf7dfc82785b9b2 Mon Sep 17 00:00:00 2001 From: macqbat Date: Wed, 9 Nov 2022 09:23:23 +0100 Subject: [PATCH 08/34] chore: filter assets to withdraw (#1974) * feat: filter assets to withdraw * feat: filter assets to withdraw - add some test * feat: filter assets to withdraw - add some test * feat: filter assets to withdraw - add logic for filtering out zero balanced accounts * feat: filter assets to withdraw - add logic for filtering out zero balanced accounts Co-authored-by: maciek --- .../src/integration/withdraw.cy.ts | 4 +- .../src/lib/withdraw-form-container.spec.tsx | 234 ++++++++++++++++++ .../src/lib/withdraw-form-container.tsx | 34 ++- 3 files changed, 252 insertions(+), 20 deletions(-) create mode 100644 libs/withdraws/src/lib/withdraw-form-container.spec.tsx diff --git a/apps/trading-e2e/src/integration/withdraw.cy.ts b/apps/trading-e2e/src/integration/withdraw.cy.ts index 202d10a40..a09438e15 100644 --- a/apps/trading-e2e/src/integration/withdraw.cy.ts +++ b/apps/trading-e2e/src/integration/withdraw.cy.ts @@ -10,7 +10,7 @@ describe('withdraw', { tags: '@smoke' }, () => { const submitWithdrawBtn = 'submit-withdrawal'; const ethAddressValue = Cypress.env('ETHEREUM_WALLET_ADDRESS'); const asset1Name = 'Sepolia tBTC'; - const asset2Name = 'Sepolia tUSDC'; + const asset2Name = 'Euro'; beforeEach(() => { cy.mockWeb3Provider(); @@ -52,7 +52,7 @@ describe('withdraw', { tags: '@smoke' }, () => { }); it('max amount', () => { selectAsset(asset2Name); // Will be above maximum because the vega wallet doesnt have any collateral - cy.get(amountField).clear().type('1'); + cy.get(amountField).clear().type('1001', { delay: 100 }); cy.getByTestId(submitWithdrawBtn).click(); cy.get('[data-testid="input-error-text"]').should( 'contain.text', diff --git a/libs/withdraws/src/lib/withdraw-form-container.spec.tsx b/libs/withdraws/src/lib/withdraw-form-container.spec.tsx new file mode 100644 index 000000000..1e2e7cb0e --- /dev/null +++ b/libs/withdraws/src/lib/withdraw-form-container.spec.tsx @@ -0,0 +1,234 @@ +import { render, screen } from '@testing-library/react'; +import { MockedProvider } from '@apollo/client/testing'; +import type { Account } from '@vegaprotocol/accounts'; +import { WithdrawFormContainer } from './withdraw-form-container'; +import { Schema as Types } from '@vegaprotocol/types'; +import { useWeb3React } from '@web3-react/core'; +let mockData: Account[] | null = null; +jest.mock('@vegaprotocol/react-helpers', () => ({ + ...jest.requireActual('@vegaprotocol/react-helpers'), + useDataProvider: () => ({ + data: mockData, + }), +})); +jest.mock('@web3-react/core'); + +describe('WithdrawFormContainer', () => { + const props = { + submit: jest.fn(), + assetId: 'assetId', + partyId: 'partyId', + }; + const MOCK_ETH_ADDRESS = '0xcool'; + + const account1: Account = { + type: Types.AccountType.ACCOUNT_TYPE_GENERAL, + balance: '200099689', + market: null, + asset: { + id: 'assetId-1', + name: 'tBTC TEST', + symbol: 'tBTC', + decimals: 5, + quantum: '1', + source: { + __typename: 'ERC20', + contractAddress: '0x1d525fB145Af5c51766a89706C09fE07E6058D1D', + lifetimeLimit: '0', + withdrawThreshold: '0', + }, + status: Types.AssetStatus.STATUS_ENABLED, + infrastructureFeeAccount: { + balance: '1', + __typename: 'AccountBalance', + }, + globalRewardPoolAccount: { + balance: '1', + __typename: 'AccountBalance', + }, + takerFeeRewardAccount: null, + makerFeeRewardAccount: null, + lpFeeRewardAccount: null, + marketProposerRewardAccount: null, + __typename: 'Asset', + }, + __typename: 'AccountBalance', + }; + + const account2: Account = { + type: Types.AccountType.ACCOUNT_TYPE_GENERAL, + balance: '199994240', + market: null, + asset: { + id: 'assetId-2', + name: 'tUSDC TEST', + symbol: 'tUSDC', + decimals: 5, + quantum: '1', + source: { + __typename: 'ERC20', + contractAddress: '0xdBa6373d0DAAAA44bfAd663Ff93B1bF34cE054E9', + lifetimeLimit: '0', + withdrawThreshold: '0', + }, + status: Types.AssetStatus.STATUS_ENABLED, + infrastructureFeeAccount: { + balance: '2', + __typename: 'AccountBalance', + }, + globalRewardPoolAccount: { + balance: '0', + __typename: 'AccountBalance', + }, + takerFeeRewardAccount: null, + makerFeeRewardAccount: null, + lpFeeRewardAccount: null, + marketProposerRewardAccount: null, + __typename: 'Asset', + }, + __typename: 'AccountBalance', + }; + + beforeEach(() => { + (useWeb3React as jest.Mock).mockReturnValue({ account: MOCK_ETH_ADDRESS }); + }); + afterEach(() => { + jest.resetAllMocks(); + }); + it('should be properly rendered', () => { + mockData = [ + { ...account1 }, + { ...account2 }, + { + type: Types.AccountType.ACCOUNT_TYPE_MARGIN, + balance: '201159', + market: { + __typename: 'Market', + id: 'marketId-1', + decimalPlaces: 5, + positionDecimalPlaces: 0, + state: Types.MarketState.STATE_SUSPENDED, + tradingMode: Types.MarketTradingMode.TRADING_MODE_MONITORING_AUCTION, + fees: { + __typename: 'Fees', + factors: { + __typename: 'FeeFactors', + makerFee: '0.0002', + infrastructureFee: '0.0005', + liquidityFee: '0.001', + }, + }, + tradableInstrument: { + __typename: 'TradableInstrument', + instrument: { + __typename: 'Instrument', + id: '', + name: 'Apple Monthly (Nov 2022)', + code: 'AAPL.MF21', + metadata: { + __typename: 'InstrumentMetadata', + tags: [ + 'formerly:4899E01009F1A721', + 'quote:USD', + 'ticker:AAPL', + 'class:equities/single-stock-futures', + 'sector:tech', + 'listing_venue:NASDAQ', + 'country:US', + 'auto:aapl', + ], + }, + product: { + __typename: 'Future', + settlementAsset: { + __typename: 'Asset', + symbol: 'tUSDC', + decimals: 5, + }, + quoteName: 'USD', + }, + }, + }, + marketTimestamps: { + __typename: 'MarketTimestamps', + open: '2022-10-25T18:17:59.149283671Z', + close: null, + }, + }, + asset: { + id: 'assetId-2', + name: 'tUSDC TEST', + symbol: 'tUSDC', + decimals: 5, + quantum: '1', + source: { + __typename: 'ERC20', + contractAddress: '0xdBa6373d0DAAAA44bfAd663Ff93B1bF34cE054E9', + lifetimeLimit: '0', + withdrawThreshold: '0', + }, + status: Types.AssetStatus.STATUS_ENABLED, + infrastructureFeeAccount: { + balance: '2', + __typename: 'AccountBalance', + }, + globalRewardPoolAccount: { + balance: '0', + __typename: 'AccountBalance', + }, + takerFeeRewardAccount: null, + makerFeeRewardAccount: null, + lpFeeRewardAccount: null, + marketProposerRewardAccount: null, + __typename: 'Asset', + }, + __typename: 'AccountBalance', + }, + ]; + render( + + + + ); + expect(screen.getByTestId('select-asset')).toBeInTheDocument(); + expect(screen.getAllByRole('option')).toHaveLength(3); + }); + + it('should display no data message', () => { + mockData = null; + render( + + + + ); + expect( + screen.getByText('You have no assets to withdraw') + ).toBeInTheDocument(); + }); + + it('should filter out zero balance account assets', () => { + mockData = [{ ...account1 }, { ...account2, balance: '0' }]; + render( + + + + ); + expect(screen.getByTestId('select-asset')).toBeInTheDocument(); + expect(screen.getAllByRole('option')).toHaveLength(2); + }); + + it('when no accounts have a balance should should display no data message', () => { + mockData = [ + { ...account1, balance: '0' }, + { ...account2, balance: '0' }, + ]; + render( + + + + ); + expect( + screen.getByText('You have no assets to withdraw') + ).toBeInTheDocument(); + }); +}); diff --git a/libs/withdraws/src/lib/withdraw-form-container.tsx b/libs/withdraws/src/lib/withdraw-form-container.tsx index 339665076..f7bc7586c 100644 --- a/libs/withdraws/src/lib/withdraw-form-container.tsx +++ b/libs/withdraws/src/lib/withdraw-form-container.tsx @@ -1,11 +1,10 @@ -import { useDataProvider } from '@vegaprotocol/react-helpers'; +import { useMemo } from 'react'; +import { useDataProvider, t, toBigNum } from '@vegaprotocol/react-helpers'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; -import { enabledAssetsProvider } from '@vegaprotocol/assets'; -import { accountsOnlyDataProvider } from '@vegaprotocol/accounts'; +import { accountsDataProvider } from '@vegaprotocol/accounts'; import type { WithdrawalArgs } from './use-create-withdraw'; import { WithdrawManager } from './withdraw-manager'; -import { useMemo } from 'react'; -import { t } from '@vegaprotocol/react-helpers'; +import { Schema as Types } from '@vegaprotocol/types'; interface WithdrawFormContainerProps { partyId?: string; @@ -20,24 +19,23 @@ export const WithdrawFormContainer = ({ }: WithdrawFormContainerProps) => { const variables = useMemo(() => ({ partyId }), [partyId]); const { data, loading, error } = useDataProvider({ - dataProvider: accountsOnlyDataProvider, + dataProvider: accountsDataProvider, variables, - noUpdate: true, - }); - - const { - data: assets, - loading: assetsLoading, - error: assetsError, - } = useDataProvider({ - dataProvider: enabledAssetsProvider, }); + const filteredAsset = data + ?.filter( + (account) => + account.type === Types.AccountType.ACCOUNT_TYPE_GENERAL && + toBigNum(account.balance, account.asset.decimals).isGreaterThan(0) + ) + .map((account) => account.asset); + const assets = filteredAsset?.length ? filteredAsset : null; return ( {assets && data && ( From cb9ceb2f7d82b409d704865a4f15bf557254e9aa Mon Sep 17 00:00:00 2001 From: Elmar <102954831+elmar-vega@users.noreply.github.com> Date: Wed, 9 Nov 2022 09:34:16 +0000 Subject: [PATCH 09/34] fix(explorer): reduce limit of txs from 100 to 20 (#1985) --- apps/explorer/src/app/hooks/use-txs-data.ts | 21 +++++++++++++------ .../src/app/routes/txs/home/index.tsx | 2 +- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/apps/explorer/src/app/hooks/use-txs-data.ts b/apps/explorer/src/app/hooks/use-txs-data.ts index 66ed90674..17ba1c11c 100644 --- a/apps/explorer/src/app/hooks/use-txs-data.ts +++ b/apps/explorer/src/app/hooks/use-txs-data.ts @@ -17,17 +17,26 @@ export interface IUseTxsData { filters?: string; } -export const getTxsDataUrl = ({ limit = 10, filters = '' }) => { - let url = `${DATA_SOURCES.blockExplorerUrl}/transactions?limit=${limit}`; +interface IGetTxsDataUrl { + limit?: string; + filters?: string; +} + +export const getTxsDataUrl = ({ limit, filters }: IGetTxsDataUrl) => { + const url = new URL(`${DATA_SOURCES.blockExplorerUrl}/transactions`); + + if (limit) { + url.searchParams.append('limit', limit); + } if (filters) { - url = `${url}&${filters}`; + url.searchParams.append('filters', filters); } return url; }; -export const useTxsData = ({ limit = 10, filters }: IUseTxsData) => { +export const useTxsData = ({ limit, filters }: IUseTxsData) => { const [{ txsData, hasMoreTxs, lastCursor }, setTxsState] = useState({ txsData: [], @@ -35,12 +44,12 @@ export const useTxsData = ({ limit = 10, filters }: IUseTxsData) => { lastCursor: '', }); - const url = getTxsDataUrl({ limit, filters }); + const url = getTxsDataUrl({ limit: limit?.toString(), filters }); const { state: { data, error, loading }, refetch, - } = useFetch(url, {}, false); + } = useFetch(url.href, {}, false); useEffect(() => { if (data?.transactions?.length) { diff --git a/apps/explorer/src/app/routes/txs/home/index.tsx b/apps/explorer/src/app/routes/txs/home/index.tsx index 57622c602..24ee1d750 100644 --- a/apps/explorer/src/app/routes/txs/home/index.tsx +++ b/apps/explorer/src/app/routes/txs/home/index.tsx @@ -4,7 +4,7 @@ import { BlocksRefetch } from '../../../components/blocks'; import { TxsInfiniteList, TxsStatsInfo } from '../../../components/txs'; import { useTxsData } from '../../../hooks/use-txs-data'; -const BE_TXS_PER_REQUEST = 100; +const BE_TXS_PER_REQUEST = 20; export const TxsList = () => { const { hasMoreTxs, loadTxs, error, txsData, refreshTxs, loading } = From 6bf5b42a796cd26a28e99690342ed767ce4ba01f Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Wed, 9 Nov 2022 12:05:59 +0000 Subject: [PATCH 10/34] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index ee19cdea3..3b78dc9a4 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -274,7 +274,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "92694.94926258681037035", + "locked_amount": "92635.48644137139709707", "deposits": [ { "amount": "129999.45", @@ -340,7 +340,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "42908.12808853373746", + "locked_amount": "42872.00561897514248", "deposits": [ { "amount": "2600", @@ -513,7 +513,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "4270.500221968544", + "locked_amount": "4267.066527143582", "deposits": [ { "amount": "5000", @@ -724,7 +724,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "34147.311924401683111446", + "locked_amount": "34088.98443600172031094", "deposits": [ { "amount": "97499.58", @@ -757,7 +757,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "46673.480113191018728142460272", + "locked_amount": "46593.7565063690567508219078", "deposits": [ { "amount": "135173.4239508", @@ -790,7 +790,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "14365.184434060548245424", + "locked_amount": "14340.647066952531110224", "deposits": [ { "amount": "32499.86", @@ -823,7 +823,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "4675.728136836532787765", + "locked_amount": "4667.7414619478485048115", "deposits": [ { "amount": "10833.29", @@ -856,7 +856,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "22749.93", "total_removed": "0", - "locked_amount": "17478.916080513742668933", + "locked_amount": "17449.060105988218956528", "deposits": [ { "amount": "6500", @@ -995,7 +995,7 @@ "tranche_end": "2023-05-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "21474.014445211788", + "locked_amount": "21442.85508747697875", "deposits": [ { "amount": "7500", @@ -1048,7 +1048,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "626880.6921411330574", - "locked_amount": "1088201.582163547003099922", + "locked_amount": "1086869.35775570641985561", "deposits": [ { "amount": "1852091.69", @@ -1345,7 +1345,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "19343.6246666163463", + "locked_amount": "19285.727719907405125", "deposits": [ { "amount": "12500", @@ -25339,7 +25339,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "229348.4397135638212", - "locked_amount": "1696688.190437360439041189194", + "locked_amount": "1694641.11988050019854498876", "deposits": [ { "amount": "1998.95815", @@ -26344,7 +26344,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "307088.7055255201186094", - "locked_amount": "11316034.9711377505576490248032240968423899", + "locked_amount": "11308776.1903776145492676608539638997107326", "deposits": [ { "amount": "16249.93", @@ -30265,7 +30265,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "3220949.512421240585683667", - "locked_amount": "4725446.00549858308035656761920864", + "locked_amount": "4718744.74544858075331856587210822", "deposits": [ { "amount": "129284.449", @@ -36063,7 +36063,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "2147526.429852157556378517", - "locked_amount": "1550148.89249180889818289302996639", + "locked_amount": "1547501.184117169325173921917006852", "deposits": [ { "amount": "552496.6455", @@ -37715,7 +37715,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "9123.290251072296", - "locked_amount": "268849.94245797667578915166615932", + "locked_amount": "268525.57242668799289758656823948", "deposits": [ { "amount": "3000", From 8d2c3ba4ad6299945b486fed6d59be6272cd8950 Mon Sep 17 00:00:00 2001 From: macqbat Date: Wed, 9 Nov 2022 13:47:01 +0100 Subject: [PATCH 11/34] chore: handle overlapping text in price cell (#1988) * feat: filter assets to withdraw - add logic for filtering out zero balanced accounts * chore: handle overlapping text in price cell - add title with value * chore: handle overlapping text in price cell - add title with value Co-authored-by: maciek --- libs/market-depth/src/lib/orderbook.tsx | 8 +++++--- libs/react-helpers/src/lib/grid/price-cell.spec.tsx | 11 ++++++----- libs/react-helpers/src/lib/grid/price-cell.tsx | 3 ++- libs/tailwindcss-config/src/vega-custom-classes.js | 3 +++ 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/libs/market-depth/src/lib/orderbook.tsx b/libs/market-depth/src/lib/orderbook.tsx index b685a2b05..6b5ce5a7d 100644 --- a/libs/market-depth/src/lib/orderbook.tsx +++ b/libs/market-depth/src/lib/orderbook.tsx @@ -595,7 +595,9 @@ export const Orderbook = ({
{t('Bid vol')}
{t('Ask vol')}
{t('Price')}
-
{t('Cumulative vol')}
+
+ {t('Cumulative vol')} +
-
-
+
diff --git a/apps/trading/pages/client-router.tsx b/apps/trading/pages/client-router.tsx index 0c03298a4..9711dac38 100644 --- a/apps/trading/pages/client-router.tsx +++ b/apps/trading/pages/client-router.tsx @@ -23,15 +23,10 @@ const LazyPortfolio = dynamic(() => import('../client-pages/portfolio'), { ssr: false, }); -const LazyDeposit = dynamic(() => import('../client-pages/deposit'), { - ssr: false, -}); - export enum Routes { HOME = '/', MARKETS = '/markets', PORTFOLIO = '/portfolio', - PORTFOLIO_DEPOSIT = '/portfolio/deposit', } const routerConfig = [ @@ -55,10 +50,6 @@ const routerConfig = [ path: Routes.PORTFOLIO, element: , }, - { - path: Routes.PORTFOLIO_DEPOSIT, - element: , - }, ]; export const ClientRouter = () => { diff --git a/libs/web3/src/lib/web3-wallet-input.tsx b/libs/web3/src/lib/web3-wallet-input.tsx index 5811b5e3d..86d21508b 100644 --- a/libs/web3/src/lib/web3-wallet-input.tsx +++ b/libs/web3/src/lib/web3-wallet-input.tsx @@ -34,7 +34,10 @@ export const Web3WalletInput = ({ inputProps }: Web3WalletInputProps) => { {t('Connected with ')} {account}

- From 9a987f752c44226d0920c5dcbb6110a00bcc45cd Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Thu, 10 Nov 2022 06:04:25 +0000 Subject: [PATCH 15/34] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index f00c76131..bbcbdc579 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -274,7 +274,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "92516.231319393765376815", + "locked_amount": "92457.82283272823005893", "deposits": [ { "amount": "129999.45", @@ -340,7 +340,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "42799.56052765093794", + "locked_amount": "42764.07854515474964", "deposits": [ { "amount": "2600", @@ -513,7 +513,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "4260.180111618468", + "locked_amount": "4256.807299594115", "deposits": [ { "amount": "5000", @@ -724,7 +724,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "33972.006270458762869404", + "locked_amount": "33914.7129860365282834614", "deposits": [ { "amount": "97499.58", @@ -757,7 +757,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "46433.867549509600432460290848", + "locked_amount": "46355.55752097732147268493628", "deposits": [ { "amount": "135173.4239508", @@ -790,7 +790,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "14291.4363728134745772936", + "locked_amount": "14267.334077459141422136", "deposits": [ { "amount": "32499.86", @@ -823,7 +823,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "4651.7238585348587144504", + "locked_amount": "4643.878795280160854756", "deposits": [ { "amount": "10833.29", @@ -856,7 +856,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "22749.93", "total_removed": "0", - "locked_amount": "17389.182726963352601982", + "locked_amount": "17359.856128354057654707", "deposits": [ { "amount": "6500", @@ -995,7 +995,7 @@ "tranche_end": "2023-05-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "21380.36372007366375", + "locked_amount": "21349.756848526704", "deposits": [ { "amount": "7500", @@ -1048,7 +1048,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "626880.6921411330574", - "locked_amount": "1084197.527172978169588546", + "locked_amount": "1082888.924419688642420918", "deposits": [ { "amount": "1852091.69", @@ -1345,7 +1345,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "19169.61302334943695", + "locked_amount": "19112.742646688810025", "deposits": [ { "amount": "12500", @@ -25359,7 +25359,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "284657.8276980546609", - "locked_amount": "1690535.44650745469748270055", + "locked_amount": "1688524.579682737105451017603", "deposits": [ { "amount": "1998.95815", @@ -26386,7 +26386,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "320334.7825462624739094", - "locked_amount": "11294217.7362062235283090035361173187374967", + "locked_amount": "11287087.3315557633630929811010128107853474", "deposits": [ { "amount": "16249.93", @@ -30318,7 +30318,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "3246517.595722321073783507", - "locked_amount": "4705304.47351415748949028212093935", + "locked_amount": "4698721.729468916825926442033310726", "deposits": [ { "amount": "129284.449", @@ -36127,7 +36127,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "2147526.429852157556378517", - "locked_amount": "1542190.851389790696488891820386028", + "locked_amount": "1539589.96940541171108179983863658", "deposits": [ { "amount": "552496.6455", @@ -37779,7 +37779,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "13448.320375372296", - "locked_amount": "267875.00501169947087592581024856", + "locked_amount": "267556.37166871803339185477219688", "deposits": [ { "amount": "3000", From 6a0ec22ee4e4a258a7d01e11e2d72f44a651a7b1 Mon Sep 17 00:00:00 2001 From: Joe Tsang <30622993+jtsang586@users.noreply.github.com> Date: Thu, 10 Nov 2022 09:53:30 +0000 Subject: [PATCH 16/34] chore(test updates): fix withdrawal tests (#2007) * chore: update withdrawal tests * chore: fix teardown for manual flow * chore: add wait * chore: remove waits * chore: update vega to v 0.62 * chore: reload page for first withdrawal * chore: add navigate to withdrawals * chore: add click * fix: lint * chore: turn off teardown and revert tag change --- .../workflows/capsule-cypress-manual-trigger.yml | 5 ++--- .github/workflows/capsule-cypress-night-run.yml | 4 ++-- .github/workflows/capsule-cypress.yml | 2 +- .../src/integration/flow/withdrawal-flow.cy.js | 15 ++++++++------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/capsule-cypress-manual-trigger.yml b/.github/workflows/capsule-cypress-manual-trigger.yml index e759a20c5..b56fb2490 100644 --- a/.github/workflows/capsule-cypress-manual-trigger.yml +++ b/.github/workflows/capsule-cypress-manual-trigger.yml @@ -28,8 +28,7 @@ on: default: false env: GOBIN: /home/runner/go/bin - VEGA_VERSION: 'v0.58.0' - capsule-teardown: true + VEGA_VERSION: 'v0.62.0' jobs: manual: @@ -58,5 +57,5 @@ jobs: vega-version: ${{needs.manual.outputs.vega-version}} gobin: ${{needs.manual.outputs.gobin}} skip-cache: ${{needs.manual.outputs.skip-cache}} - capsule-teardown: ${{needs.manual.capsule-teardown}} tags: ${{needs.manual.outputs.tags}} + capsule-teardown: false diff --git a/.github/workflows/capsule-cypress-night-run.yml b/.github/workflows/capsule-cypress-night-run.yml index 1b9bab5de..8dbebd4f7 100644 --- a/.github/workflows/capsule-cypress-night-run.yml +++ b/.github/workflows/capsule-cypress-night-run.yml @@ -13,8 +13,8 @@ jobs: secrets: inherit with: project: '[console-lite-e2e, explorer-e2e, liquidity-provision-dashboard-e2e, stats-e2e, token-e2e, trading-e2e]' - vega-version: 'v0.58.0' + vega-version: 'v0.62.0' gobin: /home/runner/go/bin tags: --env.grepTags '[ @smoke, @regression, @slow ]' night-run: true - capsule-teardown: true + capsule-teardown: false diff --git a/.github/workflows/capsule-cypress.yml b/.github/workflows/capsule-cypress.yml index b1164e704..485cc35d3 100644 --- a/.github/workflows/capsule-cypress.yml +++ b/.github/workflows/capsule-cypress.yml @@ -14,7 +14,7 @@ on: env: GOBIN: /home/runner/go/bin - VEGA_VERSION: 'v0.58.0' + VEGA_VERSION: 'v0.62.0' jobs: pr: diff --git a/apps/token-e2e/src/integration/flow/withdrawal-flow.cy.js b/apps/token-e2e/src/integration/flow/withdrawal-flow.cy.js index 2c276a37a..0ed3ffb68 100644 --- a/apps/token-e2e/src/integration/flow/withdrawal-flow.cy.js +++ b/apps/token-e2e/src/integration/flow/withdrawal-flow.cy.js @@ -5,7 +5,6 @@ const amountInput = 'amount-input'; const balanceAvailable = 'BALANCE_AVAILABLE_value'; const withdrawalThreshold = 'WITHDRAWAL_THRESHOLD_value'; const delayTime = 'DELAY_TIME_value'; -const useMaximum = 'use-maximum'; const submitWithdrawalButton = 'submit-withdrawal'; const dialogTitle = 'dialog-title'; const dialogClose = 'dialog-close'; @@ -37,31 +36,33 @@ context( cy.navigate_to('withdrawals'); cy.vega_wallet_connect(); cy.ethereum_wallet_connect(); - waitForAssetsDisplayed(usdtName); }); it('Able to open withdrawal form with vega wallet connected', function () { + // needs to reload page for withdrawal form to be displayed in ci - not reproducible outside of ci + cy.getByTestId(withdraw).should('be.visible').click(); + cy.visit('/'); + cy.navigate_to('withdrawals'); + cy.ethereum_wallet_connect(); cy.getByTestId(withdraw).should('be.visible').click(); cy.getByTestId(selectAsset) .find('option') - .should('have.length.at.least', 5); + .should('have.length.at.least', 2); cy.getByTestId(ethAddressInput).should('be.visible'); cy.getByTestId(amountInput).should('be.visible'); }); it('Unable to submit withdrawal with invalid fields', function () { cy.getByTestId(withdraw).should('be.visible').click(); - cy.getByTestId(selectAsset).select('BTC (local)'); - cy.getByTestId(balanceAvailable).should('have.text', '0.00000'); + cy.getByTestId(selectAsset).select(usdtName); cy.getByTestId(submitWithdrawalButton).click(); cy.getByTestId(formValidationError).should('have.length', 1); - cy.getByTestId(useMaximum).click(); + cy.getByTestId(amountInput).clear().click().type('0.0000001'); cy.getByTestId(submitWithdrawalButton).click(); cy.getByTestId(formValidationError).should( 'have.text', 'Value is below minimum' ); - cy.getByTestId(selectAsset).select(usdtName); cy.getByTestId(amountInput).clear().click().type('10'); cy.getByTestId(ethAddressInput).click().type('123'); cy.getByTestId(submitWithdrawalButton).click(); From 4fedd94243d975c491418f10711ef96aee62783d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Szpiech?= Date: Thu, 10 Nov 2022 11:56:48 +0100 Subject: [PATCH 17/34] test: add orders for market in auction (#2008) --- .../src/integration/trading-deal-ticket.cy.ts | 177 ++++++++++++++++++ 1 file changed, 177 insertions(+) diff --git a/apps/trading-e2e/src/integration/trading-deal-ticket.cy.ts b/apps/trading-e2e/src/integration/trading-deal-ticket.cy.ts index b4bf48cc7..1e98d54a6 100644 --- a/apps/trading-e2e/src/integration/trading-deal-ticket.cy.ts +++ b/apps/trading-e2e/src/integration/trading-deal-ticket.cy.ts @@ -202,6 +202,183 @@ describe('must submit order', { tags: '@smoke' }, () => { }); }); +describe( + 'must submit order for market in batch auction', + { tags: '@regression' }, + () => { + before(() => { + cy.mockTradingPage( + MarketState.STATE_PENDING, + MarketTradingMode.TRADING_MODE_BATCH_AUCTION, + AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY + ); + cy.mockGQLSubscription(); + cy.visit('/#/markets/market-0'); + cy.wait('@Market'); + connectVegaWallet(); + }); + + it('successfully places limit buy order', () => { + cy.mockVegaCommandSync(mockTx); + const order: Order = { + type: 'TYPE_LIMIT', + side: 'SIDE_BUY', + size: '100', + price: '200', + timeInForce: 'TIME_IN_FORCE_GTC', + }; + testOrder(order, { price: '20000000' }); + }); + + it('successfully places limit sell order', () => { + cy.mockVegaCommandSync(mockTx); + const order: Order = { + type: 'TYPE_LIMIT', + side: 'SIDE_SELL', + size: '100', + price: '50000', + timeInForce: 'TIME_IN_FORCE_GFN', + }; + testOrder(order, { price: '5000000000' }); + }); + + it('successfully places GTT limit buy order', () => { + cy.mockVegaCommandSync(mockTx); + const order: Order = { + type: 'TYPE_LIMIT', + side: 'SIDE_SELL', + size: '100', + price: '1.00', + timeInForce: 'TIME_IN_FORCE_GTT', + expiresAt: '2022-01-01T00:00', + }; + testOrder(order, { + price: '100000', + expiresAt: + new Date(order.expiresAt as string).getTime().toString() + '000000', + }); + }); + } +); + +describe( + 'must submit order for market in batch auction', + { tags: '@regression' }, + () => { + before(() => { + cy.mockTradingPage( + MarketState.STATE_PENDING, + MarketTradingMode.TRADING_MODE_OPENING_AUCTION, + AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY + ); + cy.mockGQLSubscription(); + cy.visit('/#/markets/market-0'); + cy.wait('@Market'); + connectVegaWallet(); + }); + + it('successfully places limit buy order', () => { + cy.mockVegaCommandSync(mockTx); + const order: Order = { + type: 'TYPE_LIMIT', + side: 'SIDE_BUY', + size: '100', + price: '200', + timeInForce: 'TIME_IN_FORCE_GTC', + }; + testOrder(order, { price: '20000000' }); + }); + + it('successfully places limit sell order', () => { + cy.mockVegaCommandSync(mockTx); + const order: Order = { + type: 'TYPE_LIMIT', + side: 'SIDE_SELL', + size: '100', + price: '50000', + timeInForce: 'TIME_IN_FORCE_GFN', + }; + testOrder(order, { price: '5000000000' }); + }); + + it('successfully places GTT limit buy order', () => { + cy.mockVegaCommandSync(mockTx); + const order: Order = { + type: 'TYPE_LIMIT', + side: 'SIDE_SELL', + size: '100', + price: '1.00', + timeInForce: 'TIME_IN_FORCE_GTT', + expiresAt: '2022-01-01T00:00', + }; + testOrder(order, { + price: '100000', + expiresAt: + new Date(order.expiresAt as string).getTime().toString() + '000000', + }); + }); + } +); + +describe( + 'must submit order for market in batch auction', + { tags: '@regression' }, + () => { + before(() => { + cy.mockTradingPage( + MarketState.STATE_PENDING, + MarketTradingMode.TRADING_MODE_MONITORING_AUCTION, + AuctionTrigger.AUCTION_TRIGGER_LIQUIDITY + ); + cy.mockGQLSubscription(); + cy.visit('/#/markets/market-0'); + cy.wait('@Market'); + connectVegaWallet(); + }); + + it('successfully places limit buy order', () => { + cy.mockVegaCommandSync(mockTx); + const order: Order = { + type: 'TYPE_LIMIT', + side: 'SIDE_BUY', + size: '100', + price: '200', + timeInForce: 'TIME_IN_FORCE_GTC', + }; + testOrder(order, { price: '20000000' }); + }); + + it('successfully places limit sell order', () => { + cy.mockVegaCommandSync(mockTx); + const order: Order = { + type: 'TYPE_LIMIT', + side: 'SIDE_SELL', + size: '100', + price: '50000', + timeInForce: 'TIME_IN_FORCE_GFN', + }; + testOrder(order, { price: '5000000000' }); + }); + + it('successfully places GTT limit buy order', () => { + cy.mockVegaCommandSync(mockTx); + const order: Order = { + type: 'TYPE_LIMIT', + side: 'SIDE_SELL', + size: '100', + price: '1.00', + timeInForce: 'TIME_IN_FORCE_GTT', + expiresAt: '2022-01-01T00:00', + }; + testOrder(order, { + price: '100000', + expiresAt: + new Date(order.expiresAt as string).getTime().toString() + '000000', + }); + }); + } +); + describe('deal ticket validation', { tags: '@smoke' }, () => { beforeEach(() => { cy.mockTradingPage(); From 7f8185372d211ef825e72efca64f0d4596647f04 Mon Sep 17 00:00:00 2001 From: Sam Keen Date: Thu, 10 Nov 2022 11:31:11 +0000 Subject: [PATCH 18/34] chore(1987): persist ui behind dialog when staking (#1997) * Chore/1987: Persist UI behind dialog when staking * feat(1987): Placed staking form tx status notifications in separate component --- apps/token/src/i18n/translations/dev.json | 2 +- .../vote-details/vote-transaction-dialog.tsx | 2 +- .../src/routes/staking/node/stake-failure.tsx | 11 ++- .../src/routes/staking/node/stake-pending.tsx | 11 ++- .../routes/staking/node/stake-requested.tsx | 25 +++++++ .../src/routes/staking/node/stake-success.tsx | 7 +- .../staking/node/staking-form-tx-statuses.tsx | 67 ++++++++++++++++++ .../src/routes/staking/node/staking-form.tsx | 68 ++++++++----------- 8 files changed, 147 insertions(+), 46 deletions(-) create mode 100644 apps/token/src/routes/staking/node/stake-requested.tsx create mode 100644 apps/token/src/routes/staking/node/staking-form-tx-statuses.tsx diff --git a/apps/token/src/i18n/translations/dev.json b/apps/token/src/i18n/translations/dev.json index 68f6392a9..c13143e0d 100644 --- a/apps/token/src/i18n/translations/dev.json +++ b/apps/token/src/i18n/translations/dev.json @@ -206,7 +206,7 @@ "noGovernanceTokens": "You need some VEGA tokens to participate in governance", "youVoted": "You voted", "changeVote": "Change vote", - "voteRequested": "Please confirm transaction in wallet", + "txRequested": "Confirm transaction in wallet", "votePending": "Casting vote", "voteError": "Something went wrong, and your vote was not seen by the network", "back": "back", diff --git a/apps/token/src/routes/governance/components/vote-details/vote-transaction-dialog.tsx b/apps/token/src/routes/governance/components/vote-details/vote-transaction-dialog.tsx index 2d972017f..578dc76ef 100644 --- a/apps/token/src/routes/governance/components/vote-details/vote-transaction-dialog.tsx +++ b/apps/token/src/routes/governance/components/vote-details/vote-transaction-dialog.tsx @@ -10,7 +10,7 @@ interface VoteTransactionDialogProps { const dialogTitle = (voteState: VoteState): string | undefined => { switch (voteState) { case VoteState.Requested: - return t('voteRequested'); + return t('txRequested'); case VoteState.Pending: return t('votePending'); default: diff --git a/apps/token/src/routes/staking/node/stake-failure.tsx b/apps/token/src/routes/staking/node/stake-failure.tsx index cbc042f5b..8e45cce9a 100644 --- a/apps/token/src/routes/staking/node/stake-failure.tsx +++ b/apps/token/src/routes/staking/node/stake-failure.tsx @@ -3,15 +3,22 @@ import { useTranslation } from 'react-i18next'; interface StakeFailureProps { nodeName: string; + isDialogVisible: boolean; + toggleDialog: () => void; } -export const StakeFailure = ({ nodeName }: StakeFailureProps) => { +export const StakeFailure = ({ + nodeName, + isDialogVisible, + toggleDialog, +}: StakeFailureProps) => { const { t } = useTranslation(); return (

{t('stakeFailed', { diff --git a/apps/token/src/routes/staking/node/stake-pending.tsx b/apps/token/src/routes/staking/node/stake-pending.tsx index ebc6a068d..ff7d81f52 100644 --- a/apps/token/src/routes/staking/node/stake-pending.tsx +++ b/apps/token/src/routes/staking/node/stake-pending.tsx @@ -7,12 +7,16 @@ interface StakePendingProps { action: StakeAction; amount: string; nodeName: string; + isDialogVisible: boolean; + toggleDialog: () => void; } export const StakePending = ({ action, amount, nodeName, + isDialogVisible, + toggleDialog, }: StakePendingProps) => { const { t } = useTranslation(); const titleArgs = { amount, node: nodeName }; @@ -22,7 +26,12 @@ export const StakePending = ({ : t('stakeRemovePendingTitle', titleArgs); return ( -

} title={title} open={true}> + } + title={title} + open={isDialogVisible} + onChange={toggleDialog} + >

{t('timeForConfirmation')}

); diff --git a/apps/token/src/routes/staking/node/stake-requested.tsx b/apps/token/src/routes/staking/node/stake-requested.tsx new file mode 100644 index 000000000..57e007310 --- /dev/null +++ b/apps/token/src/routes/staking/node/stake-requested.tsx @@ -0,0 +1,25 @@ +import { Dialog, Intent } from '@vegaprotocol/ui-toolkit'; +import { useTranslation } from 'react-i18next'; +import React from 'react'; + +interface StakeRequestedProps { + isDialogVisible: boolean; + toggleDialog: () => void; +} + +export const StakeRequested = ({ + isDialogVisible, + toggleDialog, +}: StakeRequestedProps) => { + const { t } = useTranslation(); + return ( + +

{t('stakingConfirm')}

+
+ ); +}; diff --git a/apps/token/src/routes/staking/node/stake-success.tsx b/apps/token/src/routes/staking/node/stake-success.tsx index 7f6c299cd..bc8ebe721 100644 --- a/apps/token/src/routes/staking/node/stake-success.tsx +++ b/apps/token/src/routes/staking/node/stake-success.tsx @@ -10,6 +10,8 @@ interface StakeSuccessProps { amount: string; nodeName: string; removeType: RemoveType; + isDialogVisible: boolean; + toggleDialog: () => void; } export const StakeSuccess = ({ @@ -17,6 +19,8 @@ export const StakeSuccess = ({ amount, nodeName, removeType, + isDialogVisible, + toggleDialog, }: StakeSuccessProps) => { const { t } = useTranslation(); const isAdd = action === Actions.Add; @@ -34,7 +38,8 @@ export const StakeSuccess = ({ icon={} intent={Intent.Success} title={title} - open={true} + open={isDialogVisible} + onChange={toggleDialog} >

{message}

diff --git a/apps/token/src/routes/staking/node/staking-form-tx-statuses.tsx b/apps/token/src/routes/staking/node/staking-form-tx-statuses.tsx new file mode 100644 index 000000000..5463c8cf2 --- /dev/null +++ b/apps/token/src/routes/staking/node/staking-form-tx-statuses.tsx @@ -0,0 +1,67 @@ +import { StakeFailure } from './stake-failure'; +import { StakeRequested } from './stake-requested'; +import { StakePending } from './stake-pending'; +import { StakeSuccess } from './stake-success'; +import { FormState } from './staking-form'; +import type { RemoveType, StakeAction } from './staking-form'; + +interface StakeFormTxStatusesProps { + formState: FormState; + nodeName: string; + amount: string; + action: StakeAction; + removeType: RemoveType; + isDialogVisible: boolean; + toggleDialog: () => void; +} + +export const StakingFormTxStatuses = ({ + formState, + nodeName, + amount, + action, + removeType, + isDialogVisible, + toggleDialog, +}: StakeFormTxStatusesProps) => { + switch (formState) { + case FormState.Requested: + return ( + + ); + case FormState.Pending: + return ( + + ); + case FormState.Success: + return ( + + ); + case FormState.Failure: + return ( + + ); + default: + return null; + } +}; diff --git a/apps/token/src/routes/staking/node/staking-form.tsx b/apps/token/src/routes/staking/node/staking-form.tsx index 44fe9539f..07dd75100 100644 --- a/apps/token/src/routes/staking/node/staking-form.tsx +++ b/apps/token/src/routes/staking/node/staking-form.tsx @@ -1,6 +1,6 @@ import { gql, useApolloClient } from '@apollo/client'; import * as Sentry from '@sentry/react'; -import React from 'react'; +import React, { useCallback, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useNavigate } from 'react-router-dom'; @@ -12,14 +12,10 @@ import type { PartyDelegations, PartyDelegationsVariables, } from './__generated__/PartyDelegations'; -import { StakeFailure } from './stake-failure'; -import { StakePending } from './stake-pending'; -import { StakeSuccess } from './stake-success'; +import { StakingFormTxStatuses } from './staking-form-tx-statuses'; import { ButtonLink, - Dialog, FormGroup, - Intent, Radio, RadioGroup, } from '@vegaprotocol/ui-toolkit'; @@ -54,7 +50,7 @@ export const PARTY_DELEGATIONS_QUERY = gql` } `; -enum FormState { +export enum FormState { Default, Requested, Pending, @@ -93,6 +89,7 @@ export const StakingForm = ({ const { appState } = useAppState(); const { sendTx } = useVegaWallet(); const [formState, setFormState] = React.useState(FormState.Default); + const [isDialogVisible, setIsDialogVisible] = useState(false); const { t } = useTranslation(); const [action, setAction] = React.useState( params.action as StakeAction @@ -129,6 +126,7 @@ export const StakingForm = ({ async function onSubmit() { setFormState(FormState.Requested); + setIsDialogVisible(true); const delegateInput: DelegateSubmissionBody = { delegateSubmission: { nodeId, @@ -196,43 +194,24 @@ export const StakingForm = ({ return () => clearInterval(interval); }, [formState, client, pubKey, nodeId]); - if (formState === FormState.Failure) { - return ; - } else if (formState === FormState.Requested) { - return ( - -

{t('stakingConfirm')}

-
- ); - } else if (formState === FormState.Pending) { - return ; - } else if (formState === FormState.Success) { - return ( - - ); - } else if ( - availableStakeToAdd.isEqualTo(0) && - availableStakeToRemove.isEqualTo(0) - ) { - if (appState.lien.isGreaterThan(0)) { - return {t('stakeNodeWrongVegaKey')}; - } else { - return {t('stakeNodeNone')}; - } - } + const toggleDialog = useCallback(() => { + setIsDialogVisible(!isDialogVisible); + }, [isDialogVisible]); return ( <>

{t('Manage your stake')}

+ {formState === FormState.Default && + availableStakeToAdd.isEqualTo(0) && + availableStakeToRemove.isEqualTo(0) && ( +
+ {appState.lien.isGreaterThan(0) ? ( + {t('stakeNodeWrongVegaKey')} + ) : ( + {t('stakeNodeNone')} + )} +
+ )} )} + ); }; From d0d06bd4ab5b7385dbd8282eda201bac7a7675e8 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Thu, 10 Nov 2022 12:05:32 +0000 Subject: [PATCH 19/34] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 69 +++++++++++++------- 1 file changed, 46 insertions(+), 23 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index bbcbdc579..3a5e2f309 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -274,7 +274,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "92457.82283272823005893", + "locked_amount": "92398.335300546810622605", "deposits": [ { "amount": "129999.45", @@ -340,7 +340,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "42764.07854515474964", + "locked_amount": "42727.94106418062186", "deposits": [ { "amount": "2600", @@ -513,7 +513,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "4256.807299594115", + "locked_amount": "4253.3721778285135", "deposits": [ { "amount": "5000", @@ -724,7 +724,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "33914.7129860365282834614", + "locked_amount": "33856.3612584808356574266", "deposits": [ { "amount": "97499.58", @@ -757,7 +757,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "46355.55752097732147268493628", + "locked_amount": "46275.8007834141890935616754", "deposits": [ { "amount": "135173.4239508", @@ -790,7 +790,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "14267.334077459141422136", + "locked_amount": "14242.786513356899989736", "deposits": [ { "amount": "32499.86", @@ -823,7 +823,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "4643.878795280160854756", + "locked_amount": "4635.888801368804673928", "deposits": [ { "amount": "10833.29", @@ -856,7 +856,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "22749.93", "total_removed": "0", - "locked_amount": "17359.856128354057654707", + "locked_amount": "17329.987746580496157576", "deposits": [ { "amount": "6500", @@ -995,7 +995,7 @@ "tranche_end": "2023-05-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "21349.756848526704", + "locked_amount": "21318.58454189686875", "deposits": [ { "amount": "7500", @@ -1048,7 +1048,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "626880.6921411330574", - "locked_amount": "1082888.924419688642420918", + "locked_amount": "1081556.146379319624889642", "deposits": [ { "amount": "1852091.69", @@ -1345,7 +1345,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "19112.742646688810025", + "locked_amount": "19054.82163974436525", "deposits": [ { "amount": "12500", @@ -25359,7 +25359,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "284657.8276980546609", - "locked_amount": "1688524.579682737105451017603", + "locked_amount": "1686476.56385871932178183547", "deposits": [ { "amount": "1998.95815", @@ -26385,8 +26385,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", - "total_removed": "320334.7825462624739094", - "locked_amount": "11287087.3315557633630929811010128107853474", + "total_removed": "350694.8756462624739094", + "locked_amount": "11279825.1989389791145535731182717624479589", "deposits": [ { "amount": "16249.93", @@ -26925,6 +26925,11 @@ "user": "0x1A71e3ED1996CAbB91bB043f880CE963D601707e", "tx": "0x29ef7d6e50ea9025421303a3e9604348fc9dec54051a221031c2935874781c1d" }, + { + "amount": "30360.0931", + "user": "0x29f1856E73262fc4372BBF442EbB550919459308", + "tx": "0xa805c716e5fc26f0a0550ea6cca3a8c47f09fa873d2db76aa3f7d16c5b845524" + }, { "amount": "477.9430069466525", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -29518,6 +29523,12 @@ } ], "withdrawals": [ + { + "amount": "30360.0931", + "user": "0x29f1856E73262fc4372BBF442EbB550919459308", + "tranche_id": 2, + "tx": "0xa805c716e5fc26f0a0550ea6cca3a8c47f09fa873d2db76aa3f7d16c5b845524" + }, { "amount": "14125.439308", "user": "0x29f1856E73262fc4372BBF442EbB550919459308", @@ -29532,8 +29543,8 @@ } ], "total_tokens": "200000", - "withdrawn_tokens": "27481.599756", - "remaining_tokens": "172518.400244" + "withdrawn_tokens": "57841.692856", + "remaining_tokens": "142158.307144" }, { "address": "0x87D71adAbC11c35aF566eD51421eDA0c82828a3A", @@ -30318,7 +30329,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "3246517.595722321073783507", - "locked_amount": "4698721.729468916825926442033310726", + "locked_amount": "4692017.37500625612541110506574618", "deposits": [ { "amount": "129284.449", @@ -36127,7 +36138,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "2147526.429852157556378517", - "locked_amount": "1539589.96940541171108179983863658", + "locked_amount": "1536941.038409616500554301664828005", "deposits": [ { "amount": "552496.6455", @@ -37778,8 +37789,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", - "total_removed": "13448.320375372296", - "locked_amount": "267556.37166871803339185477219688", + "total_removed": "13621.800119156296", + "locked_amount": "267231.851854444795425578513445", "deposits": [ { "amount": "3000", @@ -44428,6 +44439,11 @@ "user": "0x727f82E843617c79c5E5aa7368B92f2C790D8257", "tx": "0x7c2fd8d9effeb3cf85eab924f679c34fc9da50d9afe33df3ab1a300fb4be5590" }, + { + "amount": "173.479743784", + "user": "0xb2Fb11d69DC52B76fa1Bb06Af05d4fF016cA2836", + "tx": "0x2559939f2ffdbff179b9ba0526892dc332fc076ea858081b56abad8a960fce07" + }, { "amount": "68.9518436058", "user": "0xED71B9A9b5633e9d31A0986693658CBbf23c3c1B", @@ -62869,10 +62885,17 @@ "tx": "0xc8541da6a57f410b6faba47a5e5184bae700193b7bd042914fffc562114d92f5" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "173.479743784", + "user": "0xb2Fb11d69DC52B76fa1Bb06Af05d4fF016cA2836", + "tranche_id": 5, + "tx": "0x2559939f2ffdbff179b9ba0526892dc332fc076ea858081b56abad8a960fce07" + } + ], "total_tokens": "400", - "withdrawn_tokens": "0", - "remaining_tokens": "400" + "withdrawn_tokens": "173.479743784", + "remaining_tokens": "226.520256216" }, { "address": "0x33f011bfc2Aa2231632E6ACa93751287Ff5f0A02", From dccc7501540641be1c47d84fa0227b733de091b0 Mon Sep 17 00:00:00 2001 From: Dexter Edwards Date: Thu, 10 Nov 2022 13:08:12 +0000 Subject: [PATCH 20/34] fix(1758): data node being down (#1871) * fix: timeout data node requests for node switcher * chore: generate apollo client library * chore: migrate console lite to use new apollo client package * chore: migrate explorer across * chore: remove completely unused file * chore: migrate stats * chore: migrate trading * chore: migrate multisigner app * chore: migrate token over * chore: final migrations * test: adjust tests for new behaviour * fix: build script * Update libs/apollo-client/src/lib/apollo-client.ts * chore: fix conflicts * fix: cache * test: setup mocks before each test * style: lint * style: lint * chore: resolve conflicts * test: fix tests --- apps/console-lite/src/app/app.tsx | 28 +++- .../src/app/lib/apollo-client.tsx | 88 ---------- apps/explorer/src/app/app.tsx | 12 +- apps/explorer/src/app/lib/apollo-client.tsx | 52 ------ .../src/app/app.tsx | 17 +- .../src/app/lib/apollo-client.tsx | 88 ---------- .../src/main.tsx | 35 +++- apps/multisig-signer/src/app/app.tsx | 22 ++- .../src/app/lib/apollo-client.tsx | 54 ------- apps/stats/src/app.tsx | 3 +- apps/stats/src/lib/apollo-client.tsx | 52 ------ apps/token/src/app.tsx | 143 ++++++++++++++++- apps/token/src/lib/apollo-client.ts | 150 ------------------ .../src/integration/market-info.cy.ts | 2 +- apps/trading/components/app-loader/index.tsx | 56 ++++++- apps/trading/lib/apollo-client.ts | 117 -------------- libs/apollo-client/.babelrc | 3 + libs/apollo-client/.eslintrc.json | 18 +++ libs/apollo-client/README.md | 11 ++ libs/apollo-client/jest.config.ts | 15 ++ libs/apollo-client/package.json | 4 + libs/apollo-client/project.json | 43 +++++ libs/apollo-client/src/index.ts | 1 + .../src/lib/apollo-client.ts} | 10 +- libs/apollo-client/tsconfig.json | 19 +++ libs/apollo-client/tsconfig.lib.json | 10 ++ libs/apollo-client/tsconfig.spec.json | 20 +++ .../network-loader/network-loader.spec.tsx | 31 ++-- .../network-loader/network-loader.tsx | 17 +- .../components/node-switcher/node-stats.tsx | 2 +- .../src/hooks/use-environment-errors.spec.tsx | 4 +- .../src/hooks/use-environment.spec.tsx | 4 +- libs/environment/src/hooks/use-nodes.spec.tsx | 4 +- libs/environment/src/hooks/use-nodes.tsx | 2 +- libs/environment/src/utils/request-node.ts | 2 +- package.json | 1 + tsconfig.base.json | 1 + workspace.json | 1 + yarn.lock | 5 + 39 files changed, 475 insertions(+), 672 deletions(-) delete mode 100644 apps/console-lite/src/app/lib/apollo-client.tsx delete mode 100644 apps/explorer/src/app/lib/apollo-client.tsx delete mode 100644 apps/liquidity-provision-dashboard/src/app/lib/apollo-client.tsx delete mode 100644 apps/multisig-signer/src/app/lib/apollo-client.tsx delete mode 100644 apps/stats/src/lib/apollo-client.tsx delete mode 100644 apps/token/src/lib/apollo-client.ts delete mode 100644 apps/trading/lib/apollo-client.ts create mode 100644 libs/apollo-client/.babelrc create mode 100644 libs/apollo-client/.eslintrc.json create mode 100644 libs/apollo-client/README.md create mode 100644 libs/apollo-client/jest.config.ts create mode 100644 libs/apollo-client/package.json create mode 100644 libs/apollo-client/project.json create mode 100644 libs/apollo-client/src/index.ts rename libs/{environment/src/utils/apollo-client.tsx => apollo-client/src/lib/apollo-client.ts} (82%) create mode 100644 libs/apollo-client/tsconfig.json create mode 100644 libs/apollo-client/tsconfig.lib.json create mode 100644 libs/apollo-client/tsconfig.spec.json diff --git a/apps/console-lite/src/app/app.tsx b/apps/console-lite/src/app/app.tsx index 6f6bf1b6d..452b32b1a 100644 --- a/apps/console-lite/src/app/app.tsx +++ b/apps/console-lite/src/app/app.tsx @@ -1,6 +1,5 @@ import { useEffect } from 'react'; import { useLocation } from 'react-router-dom'; -import { createClient } from './lib/apollo-client'; import { ThemeContext } from '@vegaprotocol/react-helpers'; import { useThemeSwitcher } from '@vegaprotocol/react-helpers'; import { EnvironmentProvider, NetworkLoader } from '@vegaprotocol/environment'; @@ -16,6 +15,7 @@ import Header from './components/header'; import { Main } from './components/main'; import LocalContext from './context/local-context'; import useLocalValues from './hooks/use-local-values'; +import type { InMemoryCacheConfig } from '@apollo/client'; function App() { const [theme, toggleTheme] = useThemeSwitcher(); @@ -30,10 +30,34 @@ function App() { setMenuOpen(false); }, [location, setMenuOpen]); + const cacheConfig: InMemoryCacheConfig = { + typePolicies: { + Market: { + merge: true, + }, + Party: { + merge: true, + }, + Query: {}, + Account: { + keyFields: false, + fields: { + balanceFormatted: {}, + }, + }, + Node: { + keyFields: false, + }, + Instrument: { + keyFields: false, + }, + }, + }; + return ( - + diff --git a/apps/console-lite/src/app/lib/apollo-client.tsx b/apps/console-lite/src/app/lib/apollo-client.tsx deleted file mode 100644 index e51f27871..000000000 --- a/apps/console-lite/src/app/lib/apollo-client.tsx +++ /dev/null @@ -1,88 +0,0 @@ -import { - ApolloClient, - from, - HttpLink, - InMemoryCache, - split, -} from '@apollo/client'; -import { onError } from '@apollo/client/link/error'; -import { RetryLink } from '@apollo/client/link/retry'; -import { GraphQLWsLink } from '@apollo/client/link/subscriptions'; -import { createClient as createWSClient } from 'graphql-ws'; -import { getMainDefinition } from '@apollo/client/utilities'; - -export function createClient(base?: string) { - if (!base) { - throw new Error('Base must be passed into createClient!'); - } - const urlHTTP = new URL(base); - const urlWS = new URL(base); - // Replace http with ws, preserving if its a secure connection eg. https => wss - urlWS.protocol = urlWS.protocol.replace('http', 'ws'); - - const cache = new InMemoryCache({ - typePolicies: { - Market: { - merge: true, - }, - Party: { - merge: true, - }, - Query: {}, - Account: { - keyFields: false, - fields: { - balanceFormatted: {}, - }, - }, - Node: { - keyFields: false, - }, - Instrument: { - keyFields: false, - }, - }, - }); - - const retryLink = new RetryLink({ - delay: { - initial: 300, - max: 10000, - jitter: true, - }, - }); - - const httpLink = new HttpLink({ - uri: urlHTTP.href, - credentials: 'same-origin', - }); - - const wsLink = new GraphQLWsLink( - createWSClient({ - url: urlWS.href, - }) - ); - - const splitLink = split( - ({ query }) => { - const definition = getMainDefinition(query); - return ( - definition.kind === 'OperationDefinition' && - definition.operation === 'subscription' - ); - }, - wsLink, - httpLink - ); - - const errorLink = onError(({ graphQLErrors, networkError }) => { - console.log(graphQLErrors); - console.log(networkError); - }); - - return new ApolloClient({ - connectToDevTools: process.env['NODE_ENV'] === 'development', - link: from([errorLink, retryLink, splitLink]), - cache, - }); -} diff --git a/apps/explorer/src/app/app.tsx b/apps/explorer/src/app/app.tsx index fd5493640..7de3d33a5 100644 --- a/apps/explorer/src/app/app.tsx +++ b/apps/explorer/src/app/app.tsx @@ -9,12 +9,12 @@ import { useEnvironment, } from '@vegaprotocol/environment'; import { NetworkInfo } from '@vegaprotocol/network-info'; -import { createClient } from './lib/apollo-client'; import { Nav } from './components/nav'; import { Header } from './components/header'; import { Main } from './components/main'; import { TendermintWebsocketProvider } from './contexts/websocket/tendermint-websocket-provider'; import { ENV } from './config/env'; +import type { InMemoryCacheConfig } from '@apollo/client'; function App() { const { VEGA_ENV } = useEnvironment(); @@ -36,10 +36,18 @@ function App() { }); }, [VEGA_ENV]); + const cacheConfig: InMemoryCacheConfig = { + typePolicies: { + Node: { + keyFields: false, + }, + }, + }; + return ( - +
wss - urlWS.protocol = urlWS.protocol.replace('http', 'ws'); - - const cache = new InMemoryCache({ - typePolicies: { - Query: {}, - Account: { - keyFields: false, - fields: { - balanceFormatted: {}, - }, - }, - Node: { - keyFields: false, - }, - }, - }); - - const retryLink = new RetryLink({ - delay: { - initial: 300, - max: 10000, - jitter: true, - }, - }); - - const httpLink = new HttpLink({ - uri: urlHTTP.href, - credentials: 'same-origin', - }); - - const errorLink = onError(({ graphQLErrors, networkError }) => { - console.log(graphQLErrors); - console.log(networkError); - }); - - return new ApolloClient({ - connectToDevTools: process.env['NODE_ENV'] === 'development', - link: from([errorLink, retryLink, httpLink]), - cache, - }); -} diff --git a/apps/liquidity-provision-dashboard/src/app/app.tsx b/apps/liquidity-provision-dashboard/src/app/app.tsx index 477825040..757b88c0f 100644 --- a/apps/liquidity-provision-dashboard/src/app/app.tsx +++ b/apps/liquidity-provision-dashboard/src/app/app.tsx @@ -1,7 +1,4 @@ -import { ThemeContext } from '@vegaprotocol/react-helpers'; import { useRoutes } from 'react-router-dom'; -import { EnvironmentProvider, NetworkLoader } from '@vegaprotocol/environment'; -import { createClient } from './lib/apollo-client'; import '../styles.scss'; import { Navbar } from './components/navbar'; @@ -12,16 +9,10 @@ const AppRouter = () => useRoutes(routerConfig); export function App() { return ( - - - -
- - -
-
-
-
+
+ + +
); } diff --git a/apps/liquidity-provision-dashboard/src/app/lib/apollo-client.tsx b/apps/liquidity-provision-dashboard/src/app/lib/apollo-client.tsx deleted file mode 100644 index e51f27871..000000000 --- a/apps/liquidity-provision-dashboard/src/app/lib/apollo-client.tsx +++ /dev/null @@ -1,88 +0,0 @@ -import { - ApolloClient, - from, - HttpLink, - InMemoryCache, - split, -} from '@apollo/client'; -import { onError } from '@apollo/client/link/error'; -import { RetryLink } from '@apollo/client/link/retry'; -import { GraphQLWsLink } from '@apollo/client/link/subscriptions'; -import { createClient as createWSClient } from 'graphql-ws'; -import { getMainDefinition } from '@apollo/client/utilities'; - -export function createClient(base?: string) { - if (!base) { - throw new Error('Base must be passed into createClient!'); - } - const urlHTTP = new URL(base); - const urlWS = new URL(base); - // Replace http with ws, preserving if its a secure connection eg. https => wss - urlWS.protocol = urlWS.protocol.replace('http', 'ws'); - - const cache = new InMemoryCache({ - typePolicies: { - Market: { - merge: true, - }, - Party: { - merge: true, - }, - Query: {}, - Account: { - keyFields: false, - fields: { - balanceFormatted: {}, - }, - }, - Node: { - keyFields: false, - }, - Instrument: { - keyFields: false, - }, - }, - }); - - const retryLink = new RetryLink({ - delay: { - initial: 300, - max: 10000, - jitter: true, - }, - }); - - const httpLink = new HttpLink({ - uri: urlHTTP.href, - credentials: 'same-origin', - }); - - const wsLink = new GraphQLWsLink( - createWSClient({ - url: urlWS.href, - }) - ); - - const splitLink = split( - ({ query }) => { - const definition = getMainDefinition(query); - return ( - definition.kind === 'OperationDefinition' && - definition.operation === 'subscription' - ); - }, - wsLink, - httpLink - ); - - const errorLink = onError(({ graphQLErrors, networkError }) => { - console.log(graphQLErrors); - console.log(networkError); - }); - - return new ApolloClient({ - connectToDevTools: process.env['NODE_ENV'] === 'development', - link: from([errorLink, retryLink, splitLink]), - cache, - }); -} diff --git a/apps/liquidity-provision-dashboard/src/main.tsx b/apps/liquidity-provision-dashboard/src/main.tsx index 1eebbe714..7c77b988a 100644 --- a/apps/liquidity-provision-dashboard/src/main.tsx +++ b/apps/liquidity-provision-dashboard/src/main.tsx @@ -1,16 +1,47 @@ import { StrictMode } from 'react'; import { createRoot } from 'react-dom/client'; import { BrowserRouter } from 'react-router-dom'; +import { ThemeContext } from '@vegaprotocol/react-helpers'; +import { EnvironmentProvider, NetworkLoader } from '@vegaprotocol/environment'; import App from './app/app'; +import type { InMemoryCacheConfig } from '@apollo/client'; const rootElement = document.getElementById('root'); const root = rootElement && createRoot(rootElement); - +const cache: InMemoryCacheConfig = { + typePolicies: { + Market: { + merge: true, + }, + Party: { + merge: true, + }, + Query: {}, + Account: { + keyFields: false, + fields: { + balanceFormatted: {}, + }, + }, + Node: { + keyFields: false, + }, + Instrument: { + keyFields: false, + }, + }, +}; root?.render( - + + + + + + + ); diff --git a/apps/multisig-signer/src/app/app.tsx b/apps/multisig-signer/src/app/app.tsx index 537949165..05362bff9 100644 --- a/apps/multisig-signer/src/app/app.tsx +++ b/apps/multisig-signer/src/app/app.tsx @@ -11,7 +11,6 @@ import { AsyncRenderer, Button, Lozenge } from '@vegaprotocol/ui-toolkit'; import type { EthereumConfig } from '@vegaprotocol/web3'; import { useEthereumConfig, Web3Provider } from '@vegaprotocol/web3'; import { ThemeContext, useThemeSwitcher, t } from '@vegaprotocol/react-helpers'; -import { createClient } from './lib/apollo-client'; import { ENV } from './config/env'; import { ContractsProvider } from './config/contracts/contracts-provider'; import { @@ -24,6 +23,7 @@ import { createConnectors } from './lib/web3-connectors'; import { Web3Connector } from './components/web3-connector'; import { EthWalletContainer } from './components/eth-wallet-container'; import { useWeb3React } from '@web3-react/core'; +import type { InMemoryCacheConfig } from '@apollo/client'; const pageWrapperClasses = classnames( 'min-h-screen w-screen', @@ -96,10 +96,26 @@ function App() { } const Wrapper = () => { + const cache: InMemoryCacheConfig = { + typePolicies: { + Query: {}, + Account: { + keyFields: false, + fields: { + balanceFormatted: {}, + }, + }, + Node: { + keyFields: false, + }, + }, + }; return ( - - + + + + ); diff --git a/apps/multisig-signer/src/app/lib/apollo-client.tsx b/apps/multisig-signer/src/app/lib/apollo-client.tsx deleted file mode 100644 index 742ee1f96..000000000 --- a/apps/multisig-signer/src/app/lib/apollo-client.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import * as Sentry from '@sentry/react'; -import { ApolloClient, from, HttpLink, InMemoryCache } from '@apollo/client'; -import { onError } from '@apollo/client/link/error'; -import { RetryLink } from '@apollo/client/link/retry'; - -export function createClient(base?: string) { - if (!base) { - throw new Error('Base must be passed into createClient!'); - } - const urlHTTP = new URL(base); - const urlWS = new URL(base); - // Replace http with ws, preserving if its a secure connection eg. https => wss - urlWS.protocol = urlWS.protocol.replace('http', 'ws'); - - const cache = new InMemoryCache({ - typePolicies: { - Query: {}, - Account: { - keyFields: false, - fields: { - balanceFormatted: {}, - }, - }, - Node: { - keyFields: false, - }, - }, - }); - - const retryLink = new RetryLink({ - delay: { - initial: 300, - max: 10000, - jitter: true, - }, - }); - - const httpLink = new HttpLink({ - uri: urlHTTP.href, - credentials: 'same-origin', - }); - - const errorLink = onError(({ graphQLErrors, networkError }) => { - console.log(graphQLErrors); - console.log(networkError); - Sentry.captureException(graphQLErrors); - }); - - return new ApolloClient({ - connectToDevTools: process.env['NODE_ENV'] === 'development', - link: from([errorLink, retryLink, httpLink]), - cache, - }); -} diff --git a/apps/stats/src/app.tsx b/apps/stats/src/app.tsx index 553fc6e1b..3e3a12652 100644 --- a/apps/stats/src/app.tsx +++ b/apps/stats/src/app.tsx @@ -3,14 +3,13 @@ import { Header } from './components/header'; import { StatsManager } from '@vegaprotocol/network-stats'; import { ThemeContext } from '@vegaprotocol/react-helpers'; import { useThemeSwitcher } from '@vegaprotocol/react-helpers'; -import { createClient } from './lib/apollo-client'; function App() { const [theme, toggleTheme] = useThemeSwitcher(); return ( - +
diff --git a/apps/stats/src/lib/apollo-client.tsx b/apps/stats/src/lib/apollo-client.tsx deleted file mode 100644 index d5de5e727..000000000 --- a/apps/stats/src/lib/apollo-client.tsx +++ /dev/null @@ -1,52 +0,0 @@ -import { ApolloClient, from, HttpLink, InMemoryCache } from '@apollo/client'; -import { onError } from '@apollo/client/link/error'; -import { RetryLink } from '@apollo/client/link/retry'; - -export function createClient(base?: string) { - if (!base) { - throw new Error('Base must be passed into createClient!'); - } - const urlHTTP = new URL(base); - const urlWS = new URL(base); - // Replace http with ws, preserving if its a secure connection eg. https => wss - urlWS.protocol = urlWS.protocol.replace('http', 'ws'); - - const cache = new InMemoryCache({ - typePolicies: { - Query: {}, - Account: { - keyFields: false, - fields: { - balanceFormatted: {}, - }, - }, - Node: { - keyFields: false, - }, - }, - }); - - const retryLink = new RetryLink({ - delay: { - initial: 300, - max: 10000, - jitter: true, - }, - }); - - const httpLink = new HttpLink({ - uri: urlHTTP.href, - credentials: 'same-origin', - }); - - const errorLink = onError(({ graphQLErrors, networkError }) => { - console.log(graphQLErrors); - console.log(networkError); - }); - - return new ApolloClient({ - connectToDevTools: process.env['NODE_ENV'] === 'development', - link: from([errorLink, retryLink, httpLink]), - cache, - }); -} diff --git a/apps/token/src/app.tsx b/apps/token/src/app.tsx index ee2f4652e..3c5c5cce8 100644 --- a/apps/token/src/app.tsx +++ b/apps/token/src/app.tsx @@ -26,9 +26,148 @@ import { EnvironmentProvider, NetworkLoader, } from '@vegaprotocol/environment'; -import { createClient } from './lib/apollo-client'; import { createConnectors } from './lib/web3-connectors'; import { ENV } from './config/env'; +import type { + FieldFunctionOptions, + InMemoryCacheConfig, + Reference, +} from '@apollo/client'; +import sortBy from 'lodash/sortBy'; +import uniqBy from 'lodash/uniqBy'; + +import { deterministicShuffle } from './lib/deterministic-shuffle'; +import { addDecimal } from '@vegaprotocol/react-helpers'; + +const formatUintToNumber = (amount: string, decimals = 18) => + addDecimal(amount, decimals).toString(); + +const createReadField = (fieldName: string) => ({ + [`${fieldName}Formatted`]: { + read(_: string, options: FieldFunctionOptions) { + const amount = options.readField(fieldName) as string; + return amount ? formatUintToNumber(amount) : '0'; + }, + }, +}); + +// Create seed in memory. Validator list order will remain the same +// until the page is refreshed. +const VALIDATOR_RANDOMISER_SEED = ( + Math.floor(Math.random() * 1000) + 1 +).toString(); + +const cache: InMemoryCacheConfig = { + typePolicies: { + Query: { + fields: { + nodes: { + // Merge function to make the validator list random but remain consistent + // as the user navigates around the site. If the user refreshes the list + // will be randomised. + merge: (existing = [], incoming) => { + // uniqBy will take the first of any matches + const uniq = uniqBy([...incoming, ...existing], 'id'); + // sort result so that the input is consistent + const sorted = sortBy(uniq, 'id'); + // randomise based on seed string + const random = deterministicShuffle( + VALIDATOR_RANDOMISER_SEED, + sorted + ); + return random; + }, + }, + }, + }, + Account: { + keyFields: false, + fields: { + balanceFormatted: { + read(_: string, options: FieldFunctionOptions) { + const balance = options.readField('balance'); + const asset = options.readField('asset'); + const decimals = options.readField('decimals', asset as Reference); + if (typeof balance !== 'string') return '0'; + if (typeof decimals !== 'number') return '0'; + return balance && decimals + ? formatUintToNumber(balance, decimals) + : '0'; + }, + }, + }, + }, + Delegation: { + keyFields: false, + // Only get full updates + merge(_, incoming) { + return incoming; + }, + fields: { + ...createReadField('amount'), + }, + }, + Reward: { + keyFields: false, + fields: { + ...createReadField('amount'), + }, + }, + RewardPerAssetDetail: { + keyFields: false, + fields: { + ...createReadField('totalAmount'), + }, + }, + Node: { + keyFields: false, + fields: { + ...createReadField('pendingStake'), + ...createReadField('stakedByOperator'), + ...createReadField('stakedByDelegates'), + ...createReadField('stakedTotal'), + }, + }, + NodeData: { + merge: (existing = {}, incoming) => { + return { ...existing, ...incoming }; + }, + fields: { + ...createReadField('stakedTotal'), + }, + }, + Party: { + fields: { + stake: { + merge(existing, incoming) { + return { + ...existing, + ...incoming, + }; + }, + read(stake) { + if (stake) { + return { + ...stake, + currentStakeAvailableFormatted: formatUintToNumber( + stake.currentStakeAvailable + ), + }; + } + return stake; + }, + }, + }, + }, + Withdrawal: { + fields: { + pendingOnForeignChain: { + read: (isPending = false) => isPending, + }, + }, + }, + }, +}; const Web3Container = ({ chainId, @@ -129,7 +268,7 @@ const AppContainer = () => { function App() { return ( - + diff --git a/apps/token/src/lib/apollo-client.ts b/apps/token/src/lib/apollo-client.ts deleted file mode 100644 index aea8344c6..000000000 --- a/apps/token/src/lib/apollo-client.ts +++ /dev/null @@ -1,150 +0,0 @@ -import type { FieldFunctionOptions, Reference } from '@apollo/client'; -import { ApolloClient, from, HttpLink, InMemoryCache } from '@apollo/client'; -import { onError } from '@apollo/client/link/error'; -import { RetryLink } from '@apollo/client/link/retry'; -import { addDecimal } from '@vegaprotocol/react-helpers'; -import sortBy from 'lodash/sortBy'; -import uniqBy from 'lodash/uniqBy'; - -import { deterministicShuffle } from './deterministic-shuffle'; - -// Create seed in memory. Validator list order will remain the same -// until the page is refreshed. -const VALIDATOR_RANDOMISER_SEED = ( - Math.floor(Math.random() * 1000) + 1 -).toString(); - -export function createClient(base?: string) { - if (!base) { - throw new Error('Base must be passed into createClient!'); - } - const formatUintToNumber = (amount: string, decimals = 18) => - addDecimal(amount, decimals).toString(); - - const createReadField = (fieldName: string) => ({ - [`${fieldName}Formatted`]: { - read(_: string, options: FieldFunctionOptions) { - const amount = options.readField(fieldName) as string; - return amount ? formatUintToNumber(amount) : '0'; - }, - }, - }); - - const cache = new InMemoryCache({ - typePolicies: { - Query: { - fields: { - nodes: { - // Merge function to make the validator list random but remain consistent - // as the user navigates around the site. If the user refreshes the list - // will be randomised. - merge: (existing = [], incoming) => { - // uniqBy will take the first of any matches - const uniq = uniqBy([...incoming, ...existing], 'id'); - // sort result so that the input is consistent - const sorted = sortBy(uniq, 'id'); - // randomise based on seed string - const random = deterministicShuffle( - VALIDATOR_RANDOMISER_SEED, - sorted - ); - return random; - }, - }, - }, - }, - Account: { - keyFields: false, - fields: { - balanceFormatted: { - read(_: string, options: FieldFunctionOptions) { - const balance = options.readField('balance'); - const asset = options.readField('asset'); - const decimals = options.readField( - 'decimals', - asset as Reference - ); - if (typeof balance !== 'string') return '0'; - if (typeof decimals !== 'number') return '0'; - return balance && decimals - ? formatUintToNumber(balance, decimals) - : '0'; - }, - }, - }, - }, - Delegation: { - keyFields: false, - // Only get full updates - merge(_, incoming) { - return incoming; - }, - fields: { - ...createReadField('amount'), - }, - }, - Reward: { - keyFields: false, - fields: { - ...createReadField('amount'), - }, - }, - RewardPerAssetDetail: { - keyFields: false, - fields: { - ...createReadField('totalAmount'), - }, - }, - Node: { - keyFields: false, - fields: { - ...createReadField('pendingStake'), - ...createReadField('stakedByOperator'), - ...createReadField('stakedByDelegates'), - ...createReadField('stakedTotal'), - }, - }, - NodeData: { - merge: (existing = {}, incoming) => { - return { ...existing, ...incoming }; - }, - fields: { - ...createReadField('stakedTotal'), - }, - }, - Withdrawal: { - fields: { - pendingOnForeignChain: { - read: (isPending = false) => isPending, - }, - }, - }, - }, - }); - - const retryLink = new RetryLink({ - delay: { - initial: 300, - max: 10000, - jitter: true, - }, - }); - - const httpLink = new HttpLink({ - uri: base, - credentials: 'same-origin', - }); - - const errorLink = onError(({ graphQLErrors, networkError }) => { - // eslint-disable-next-line no-console - console.log(graphQLErrors); - // eslint-disable-next-line no-console - console.log(networkError); - }); - - return new ApolloClient({ - connectToDevTools: process.env['NODE_ENV'] === 'development', - link: from([errorLink, retryLink, httpLink]), - cache, - }); -} diff --git a/apps/trading-e2e/src/integration/market-info.cy.ts b/apps/trading-e2e/src/integration/market-info.cy.ts index 16a92516d..a67b72ae4 100644 --- a/apps/trading-e2e/src/integration/market-info.cy.ts +++ b/apps/trading-e2e/src/integration/market-info.cy.ts @@ -219,7 +219,7 @@ describe('market states', { tags: '@smoke' }, function () { states.forEach((marketState) => { describe(marketState, function () { - before(function () { + beforeEach(function () { cy.mockTradingPage(marketState); cy.mockGQLSubscription(); cy.visit('/#/markets/market-0'); diff --git a/apps/trading/components/app-loader/index.tsx b/apps/trading/components/app-loader/index.tsx index 30a997e08..7550dc5e3 100644 --- a/apps/trading/components/app-loader/index.tsx +++ b/apps/trading/components/app-loader/index.tsx @@ -1,8 +1,9 @@ import type { ReactNode } from 'react'; +import { useMemo } from 'react'; import { useEagerConnect } from '@vegaprotocol/wallet'; import { NetworkLoader } from '@vegaprotocol/environment'; import { Connectors } from '../../lib/vega-connectors'; -import { createClient } from '../../lib/apollo-client'; +import type { InMemoryCacheConfig } from '@apollo/client'; interface AppLoaderProps { children: ReactNode; @@ -15,6 +16,55 @@ interface AppLoaderProps { export function AppLoader({ children }: AppLoaderProps) { // Get keys from vega wallet immediately useEagerConnect(Connectors); - - return {children}; + const cache: InMemoryCacheConfig = useMemo( + () => ({ + typePolicies: { + Account: { + keyFields: false, + fields: { + balanceFormatted: {}, + }, + }, + Instrument: { + keyFields: false, + }, + TradableInstrument: { + keyFields: ['instrument'], + }, + Product: { + keyFields: ['settlementAsset', ['id']], + }, + MarketData: { + keyFields: ['market', ['id']], + }, + Node: { + keyFields: false, + }, + Withdrawal: { + fields: { + pendingOnForeignChain: { + read: (isPending = false) => isPending, + }, + }, + }, + ERC20: { + keyFields: ['contractAddress'], + }, + PositionUpdate: { + keyFields: false, + }, + AccountUpdate: { + keyFields: false, + }, + Party: { + keyFields: false, + }, + Fees: { + keyFields: false, + }, + }, + }), + [] + ); + return {children}; } diff --git a/apps/trading/lib/apollo-client.ts b/apps/trading/lib/apollo-client.ts deleted file mode 100644 index 4e3a1a3d0..000000000 --- a/apps/trading/lib/apollo-client.ts +++ /dev/null @@ -1,117 +0,0 @@ -import { - ApolloClient, - ApolloLink, - split, - from, - HttpLink, - InMemoryCache, -} from '@apollo/client'; -import { GraphQLWsLink } from '@apollo/client/link/subscriptions'; -import { getMainDefinition } from '@apollo/client/utilities'; -import { onError } from '@apollo/client/link/error'; -import { RetryLink } from '@apollo/client/link/retry'; -import { createClient as createWSClient } from 'graphql-ws'; - -export function createClient(base?: string) { - if (!base) { - throw new Error('Base must be passed into createClient!'); - } - const urlHTTP = new URL(base); - const urlWS = new URL(base); - // Replace http with ws, preserving if its a secure connection eg. https => wss - urlWS.protocol = urlWS.protocol.replace('http', 'ws'); - - const cache = new InMemoryCache({ - typePolicies: { - Account: { - keyFields: false, - fields: { - balanceFormatted: {}, - }, - }, - Instrument: { - keyFields: false, - }, - TradableInstrument: { - keyFields: ['instrument'], - }, - Product: { - keyFields: ['settlementAsset', ['id']], - }, - MarketData: { - keyFields: ['market', ['id']], - }, - Node: { - keyFields: false, - }, - Withdrawal: { - fields: { - pendingOnForeignChain: { - read: (isPending = false) => isPending, - }, - }, - }, - ERC20: { - keyFields: ['contractAddress'], - }, - PositionUpdate: { - keyFields: false, - }, - AccountUpdate: { - keyFields: false, - }, - Party: { - keyFields: false, - }, - Fees: { - keyFields: false, - }, - }, - }); - - const retryLink = new RetryLink({ - delay: { - initial: 300, - max: 10000, - jitter: true, - }, - }); - - const httpLink = new HttpLink({ - uri: urlHTTP.href, - credentials: 'same-origin', - }); - - const wsLink = process.browser - ? new GraphQLWsLink( - createWSClient({ - url: urlWS.href, - }) - ) - : new ApolloLink((operation, forward) => forward(operation)); - - const splitLink = process.browser - ? split( - ({ query }) => { - const definition = getMainDefinition(query); - return ( - definition.kind === 'OperationDefinition' && - definition.operation === 'subscription' - ); - }, - wsLink, - httpLink - ) - : httpLink; - - const errorLink = onError(({ graphQLErrors, networkError }) => { - console.log(graphQLErrors); - console.log(networkError); - }); - - return new ApolloClient({ - connectToDevTools: process.env['NODE_ENV'] === 'development', - link: from([errorLink, retryLink, splitLink]), - cache, - }); -} diff --git a/libs/apollo-client/.babelrc b/libs/apollo-client/.babelrc new file mode 100644 index 000000000..cf7ddd99c --- /dev/null +++ b/libs/apollo-client/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": [["@nrwl/web/babel", { "useBuiltIns": "usage" }]] +} diff --git a/libs/apollo-client/.eslintrc.json b/libs/apollo-client/.eslintrc.json new file mode 100644 index 000000000..9d9c0db55 --- /dev/null +++ b/libs/apollo-client/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/libs/apollo-client/README.md b/libs/apollo-client/README.md new file mode 100644 index 000000000..c114ea893 --- /dev/null +++ b/libs/apollo-client/README.md @@ -0,0 +1,11 @@ +# apollo-client + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test apollo-client` to execute the unit tests via [Jest](https://jestjs.io). + +## Running lint + +Run `nx lint apollo-client` to execute the lint via [ESLint](https://eslint.org/). diff --git a/libs/apollo-client/jest.config.ts b/libs/apollo-client/jest.config.ts new file mode 100644 index 000000000..9da7ed406 --- /dev/null +++ b/libs/apollo-client/jest.config.ts @@ -0,0 +1,15 @@ +/* eslint-disable */ +export default { + displayName: 'apollo-client', + preset: '../../jest.preset.js', + globals: { + 'ts-jest': { + tsconfig: '/tsconfig.spec.json', + }, + }, + transform: { + '^.+\\.[tj]sx?$': 'ts-jest', + }, + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], + coverageDirectory: '../../coverage/libs/apollo-client', +}; diff --git a/libs/apollo-client/package.json b/libs/apollo-client/package.json new file mode 100644 index 000000000..bc5b3dc33 --- /dev/null +++ b/libs/apollo-client/package.json @@ -0,0 +1,4 @@ +{ + "name": "@vegaprotocol/apollo-client", + "version": "0.0.1" +} diff --git a/libs/apollo-client/project.json b/libs/apollo-client/project.json new file mode 100644 index 000000000..b69840861 --- /dev/null +++ b/libs/apollo-client/project.json @@ -0,0 +1,43 @@ +{ + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/apollo-client/src", + "projectType": "library", + "targets": { + "build": { + "executor": "@nrwl/web:rollup", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/libs/apollo-client", + "tsConfig": "libs/apollo-client/tsconfig.lib.json", + "project": "libs/apollo-client/package.json", + "entryFile": "libs/apollo-client/src/index.ts", + "external": ["react/jsx-runtime"], + "rollupConfig": "@nrwl/react/plugins/bundle-rollup", + "compiler": "babel", + "assets": [ + { + "glob": "libs/apollo-client/README.md", + "input": ".", + "output": "." + } + ] + } + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["libs/apollo-client/**/*.ts"] + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "outputs": ["coverage/libs/apollo-client"], + "options": { + "jestConfig": "libs/apollo-client/jest.config.ts", + "passWithNoTests": true + } + } + }, + "tags": [] +} diff --git a/libs/apollo-client/src/index.ts b/libs/apollo-client/src/index.ts new file mode 100644 index 000000000..bc8a1d463 --- /dev/null +++ b/libs/apollo-client/src/index.ts @@ -0,0 +1 @@ +export * from './lib/apollo-client'; diff --git a/libs/environment/src/utils/apollo-client.tsx b/libs/apollo-client/src/lib/apollo-client.ts similarity index 82% rename from libs/environment/src/utils/apollo-client.tsx rename to libs/apollo-client/src/lib/apollo-client.ts index 684394999..f88678d81 100644 --- a/libs/environment/src/utils/apollo-client.tsx +++ b/libs/apollo-client/src/lib/apollo-client.ts @@ -1,3 +1,4 @@ +import type { InMemoryCacheConfig } from '@apollo/client'; import { ApolloClient, from, @@ -11,10 +12,11 @@ import { getMainDefinition } from '@apollo/client/utilities'; import { createClient as createWSClient } from 'graphql-ws'; import { onError } from '@apollo/client/link/error'; import { RetryLink } from '@apollo/client/link/retry'; +import ApolloLinkTimeout from 'apollo-link-timeout'; const isBrowser = typeof window !== 'undefined'; -export default function createClient(base?: string) { +export function createClient(base?: string, cacheConfig?: InMemoryCacheConfig) { if (!base) { throw new Error('Base must be passed into createClient!'); } @@ -22,7 +24,7 @@ export default function createClient(base?: string) { const urlWS = new URL(base); // Replace http with ws, preserving if its a secure connection eg. https => wss urlWS.protocol = urlWS.protocol.replace('http', 'ws'); - + const timeoutLink = new ApolloLinkTimeout(10000); const retryLink = new RetryLink({ delay: { initial: 300, @@ -64,7 +66,7 @@ export default function createClient(base?: string) { }); return new ApolloClient({ - link: from([errorLink, retryLink, splitLink]), - cache: new InMemoryCache(), + link: from([errorLink, timeoutLink, retryLink, splitLink]), + cache: new InMemoryCache(cacheConfig), }); } diff --git a/libs/apollo-client/tsconfig.json b/libs/apollo-client/tsconfig.json new file mode 100644 index 000000000..e258886ff --- /dev/null +++ b/libs/apollo-client/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "../../tsconfig.base.json", + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ], + "compilerOptions": { + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + } +} diff --git a/libs/apollo-client/tsconfig.lib.json b/libs/apollo-client/tsconfig.lib.json new file mode 100644 index 000000000..b3f90c22f --- /dev/null +++ b/libs/apollo-client/tsconfig.lib.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "declaration": true, + "types": [] + }, + "include": ["**/*.ts"], + "exclude": ["jest.config.ts", "**/*.spec.ts"] +} diff --git a/libs/apollo-client/tsconfig.spec.json b/libs/apollo-client/tsconfig.spec.json new file mode 100644 index 000000000..ff08addd6 --- /dev/null +++ b/libs/apollo-client/tsconfig.spec.json @@ -0,0 +1,20 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": [ + "jest.config.ts", + "**/*.test.ts", + "**/*.spec.ts", + "**/*.test.tsx", + "**/*.spec.tsx", + "**/*.test.js", + "**/*.spec.js", + "**/*.test.jsx", + "**/*.spec.jsx", + "**/*.d.ts" + ] +} diff --git a/libs/environment/src/components/network-loader/network-loader.spec.tsx b/libs/environment/src/components/network-loader/network-loader.spec.tsx index 0348555d6..be71e9d42 100644 --- a/libs/environment/src/components/network-loader/network-loader.spec.tsx +++ b/libs/environment/src/components/network-loader/network-loader.spec.tsx @@ -3,8 +3,11 @@ import { ApolloProvider } from '@apollo/client'; import { useEnvironment } from '../../hooks'; import { render, screen } from '@testing-library/react'; import { NetworkLoader } from './network-loader'; +import { createClient } from '@vegaprotocol/apollo-client'; +import { createMockClient } from 'mock-apollo-client'; jest.mock('@apollo/client'); +jest.mock('@vegaprotocol/apollo-client'); jest.mock('../../hooks'); // @ts-ignore Typescript doesn't recognise mocked instances @@ -15,15 +18,6 @@ ApolloProvider.mockImplementation(({ children }: { children: ReactNode }) => { const SKELETON_TEXT = 'LOADING'; const SUCCESS_TEXT = 'LOADED'; -const createClient = jest.fn(); - -beforeEach(() => { - createClient.mockReset(); - createClient.mockImplementation(() => { - return jest.fn(); - }); -}); - describe('Network loader', () => { it('renders a skeleton when there is no vega url in the environment', () => { // @ts-ignore Typescript doesn't recognise mocked instances @@ -32,9 +26,7 @@ describe('Network loader', () => { })); render( - - {SUCCESS_TEXT} - + {SUCCESS_TEXT} ); expect(screen.getByText(SKELETON_TEXT)).toBeInTheDocument(); @@ -42,20 +34,19 @@ describe('Network loader', () => { expect(createClient).not.toHaveBeenCalled(); }); - it('renders the child components wrapped in an apollo provider when the environment has a vega url', () => { + it('renders the child components wrapped in an apollo provider when the environment has a vega url', async () => { + // @ts-ignore -- ts does not seem to infer this type correctly + createClient.mockReturnValueOnce(createMockClient()); + // @ts-ignore Typescript doesn't recognise mocked instances useEnvironment.mockImplementation(() => ({ VEGA_URL: 'http://vega.node', })); render( - - {SUCCESS_TEXT} - + {SUCCESS_TEXT} ); - - expect(() => screen.getByText(SKELETON_TEXT)).toThrow(); - expect(screen.getByText(SUCCESS_TEXT)).toBeInTheDocument(); - expect(createClient).toHaveBeenCalledWith('http://vega.node'); + expect(createClient).toHaveBeenCalledWith('http://vega.node', undefined); + expect(await screen.findByText(SUCCESS_TEXT)).toBeInTheDocument(); }); }); diff --git a/libs/environment/src/components/network-loader/network-loader.tsx b/libs/environment/src/components/network-loader/network-loader.tsx index ee562294d..ac12694e9 100644 --- a/libs/environment/src/components/network-loader/network-loader.tsx +++ b/libs/environment/src/components/network-loader/network-loader.tsx @@ -1,28 +1,29 @@ import { useMemo } from 'react'; import type { ReactNode } from 'react'; -import type { ApolloClient } from '@apollo/client'; +import type { InMemoryCacheConfig } from '@apollo/client'; import { ApolloProvider } from '@apollo/client'; import { useEnvironment } from '../../hooks'; +import { createClient } from '@vegaprotocol/apollo-client'; -type NetworkLoaderProps = { +type NetworkLoaderProps = { children?: ReactNode; skeleton?: ReactNode; - createClient: (url: string) => ApolloClient; + cache?: InMemoryCacheConfig; }; -export function NetworkLoader({ +export function NetworkLoader({ skeleton, children, - createClient, -}: NetworkLoaderProps) { + cache, +}: NetworkLoaderProps) { const { VEGA_URL } = useEnvironment(); const client = useMemo(() => { if (VEGA_URL) { - return createClient(VEGA_URL); + return createClient(VEGA_URL, cache); } return undefined; - }, [VEGA_URL, createClient]); + }, [VEGA_URL, cache]); if (!client) { return ( diff --git a/libs/environment/src/components/node-switcher/node-stats.tsx b/libs/environment/src/components/node-switcher/node-stats.tsx index 11055c919..9d1acab38 100644 --- a/libs/environment/src/components/node-switcher/node-stats.tsx +++ b/libs/environment/src/components/node-switcher/node-stats.tsx @@ -2,10 +2,10 @@ import type { ReactNode } from 'react'; import { ApolloProvider } from '@apollo/client'; import { t } from '@vegaprotocol/react-helpers'; import type { NodeData } from '../../types'; -import type createClient from '../../utils/apollo-client'; import { LayoutRow } from './layout-row'; import { LayoutCell } from './layout-cell'; import { NodeBlockHeight } from './node-block-height'; +import type { createClient } from '@vegaprotocol/apollo-client'; type NodeStatsContentProps = { data?: NodeData; diff --git a/libs/environment/src/hooks/use-environment-errors.spec.tsx b/libs/environment/src/hooks/use-environment-errors.spec.tsx index d3abeea9a..3d01c29af 100644 --- a/libs/environment/src/hooks/use-environment-errors.spec.tsx +++ b/libs/environment/src/hooks/use-environment-errors.spec.tsx @@ -2,11 +2,11 @@ // workaround based on: https://github.com/facebook/react/issues/11565 import type { ComponentProps, ReactNode } from 'react'; import { renderHook } from '@testing-library/react'; -import createClient from '../utils/apollo-client'; +import { createClient } from '@vegaprotocol/apollo-client'; import { useEnvironment, EnvironmentProvider } from './use-environment'; import { Networks } from '../types'; import createMockClient from './mocks/apollo-client'; -jest.mock('../utils/apollo-client'); +jest.mock('@vegaprotocol/apollo-client'); jest.mock('react-dom', () => ({ ...jest.requireActual('react-dom'), diff --git a/libs/environment/src/hooks/use-environment.spec.tsx b/libs/environment/src/hooks/use-environment.spec.tsx index 7c6c25732..0dbde2b09 100644 --- a/libs/environment/src/hooks/use-environment.spec.tsx +++ b/libs/environment/src/hooks/use-environment.spec.tsx @@ -2,14 +2,14 @@ // workaround based on: https://github.com/facebook/react/issues/11565 import type { ComponentProps, ReactNode } from 'react'; import { renderHook, waitFor, act } from '@testing-library/react'; -import createClient from '../utils/apollo-client'; +import { createClient } from '@vegaprotocol/apollo-client'; import { useEnvironment, EnvironmentProvider } from './use-environment'; import { Networks, ErrorType } from '../types'; import type { MockRequestConfig } from './mocks/apollo-client'; import createMockClient from './mocks/apollo-client'; import { getErrorByType } from '../utils/validate-node'; -jest.mock('../utils/apollo-client'); +jest.mock('@vegaprotocol/apollo-client'); jest.mock('react-dom', () => ({ ...jest.requireActual('react-dom'), diff --git a/libs/environment/src/hooks/use-nodes.spec.tsx b/libs/environment/src/hooks/use-nodes.spec.tsx index 3298f3fc8..674f825f6 100644 --- a/libs/environment/src/hooks/use-nodes.spec.tsx +++ b/libs/environment/src/hooks/use-nodes.spec.tsx @@ -1,13 +1,13 @@ import { renderHook, act } from '@testing-library/react'; import { ApolloClient } from '@apollo/client'; -import createClient from '../utils/apollo-client'; +import { createClient } from '@vegaprotocol/apollo-client'; import { useNodes } from './use-nodes'; import createMockClient, { getMockStatisticsResult, } from './mocks/apollo-client'; import { waitFor } from '@testing-library/react'; -jest.mock('../utils/apollo-client'); +jest.mock('@vegaprotocol/apollo-client'); const MOCK_DURATION = 1073; diff --git a/libs/environment/src/hooks/use-nodes.tsx b/libs/environment/src/hooks/use-nodes.tsx index 0ce98bc16..8960aaaa8 100644 --- a/libs/environment/src/hooks/use-nodes.tsx +++ b/libs/environment/src/hooks/use-nodes.tsx @@ -1,9 +1,9 @@ import type { Dispatch } from 'react'; import { useState, useEffect, useReducer } from 'react'; import { produce } from 'immer'; -import type createClient from '../utils/apollo-client'; import { initializeNode } from '../utils/initialize-node'; import type { NodeData, Configuration } from '../types'; +import type { createClient } from '@vegaprotocol/apollo-client'; type StatisticsPayload = { block: NodeData['block']['value']; diff --git a/libs/environment/src/utils/request-node.ts b/libs/environment/src/utils/request-node.ts index 827df0134..4fd133a77 100644 --- a/libs/environment/src/utils/request-node.ts +++ b/libs/environment/src/utils/request-node.ts @@ -1,9 +1,9 @@ -import createClient from './apollo-client'; import { StatisticsDocument, BlockTimeDocument } from './__generated__/Node'; import type { StatisticsQuery, BlockTimeSubscription, } from './__generated__/Node'; +import { createClient } from '@vegaprotocol/apollo-client'; type Callbacks = { onStatsSuccess: (data: StatisticsQuery) => void; diff --git a/package.json b/package.json index 81fe41ea3..02e1aa5a6 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "allotment": "^1.14.5", "alpha-lyrae": "vegaprotocol/alpha-lyrae", "apollo": "^2.33.9", + "apollo-link-timeout": "^4.0.0", "bignumber.js": "^9.0.2", "buffer": "^6.0.3", "classnames": "^2.3.1", diff --git a/tsconfig.base.json b/tsconfig.base.json index 15d548aac..c53c23b52 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -17,6 +17,7 @@ "resolveJsonModule": true, "paths": { "@vegaprotocol/accounts": ["libs/accounts/src/index.ts"], + "@vegaprotocol/apollo-client": ["libs/apollo-client/src/index.ts"], "@vegaprotocol/assets": ["libs/assets/src/index.ts"], "@vegaprotocol/candles-chart": ["libs/candles-chart/src/index.ts"], "@vegaprotocol/cypress": ["libs/cypress/src/index.ts"], diff --git a/workspace.json b/workspace.json index eedb4be7f..70341c7a2 100644 --- a/workspace.json +++ b/workspace.json @@ -2,6 +2,7 @@ "version": 2, "projects": { "accounts": "libs/accounts", + "apollo-client": "libs/apollo-client", "assets": "libs/assets", "candles-chart": "libs/candles-chart", "console-lite": "apps/console-lite", diff --git a/yarn.lock b/yarn.lock index 7ef5250aa..e1f5f4454 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7985,6 +7985,11 @@ apollo-link-http@^1.5.5: apollo-link-http-common "^0.2.16" tslib "^1.9.3" +apollo-link-timeout@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/apollo-link-timeout/-/apollo-link-timeout-4.0.0.tgz#3e255bcced6a6babdcc080b1919dd958c036e235" + integrity sha512-2tZsNvmbsAHunWSsGi+URLMQSDoSU0NRDJeYicX/eB7J94QXydgvZOG4FCsgU5hY0dhUrPrLCotcpJjvOOfSlA== + apollo-link@^1.2.14, apollo-link@^1.2.3: version "1.2.14" resolved "https://registry.yarnpkg.com/apollo-link/-/apollo-link-1.2.14.tgz#3feda4b47f9ebba7f4160bef8b977ba725b684d9" From 045454b484175cbf101e1c3b65a20042566ba577 Mon Sep 17 00:00:00 2001 From: Ciaran McGhie Date: Thu, 10 Nov 2022 14:08:57 +0000 Subject: [PATCH 21/34] feat(1355): lp dashboard adding equity like share (#2017) * refactor: use the lpAggregatedDataProvider rather than liquidityProvisionsDataProvider The lpAggregatedDataProvider seems to provide the same data as the liquidityProvisionsDataProvider, but also contains further details that we'll need for other fields on the liquitidy provider details page. * feat: replace GALPS with equity-like share and fetch value from LiquidityProviderFeeShare Updates the type for LiquidityProviders prop to more accurately reflect that we're using the data from lpAggregatedDataProvider, which includes the fee share data. We use the fee share data to display equity-like share % for each LP, and have replaced GALPS, which was previously empty, with this value. --- .../src/app/components/detail/detail.tsx | 8 ++++---- .../components/detail/providers/providers.tsx | 17 ++++++++++++++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/apps/liquidity-provision-dashboard/src/app/components/detail/detail.tsx b/apps/liquidity-provision-dashboard/src/app/components/detail/detail.tsx index ac7297b8c..bff248f4c 100644 --- a/apps/liquidity-provision-dashboard/src/app/components/detail/detail.tsx +++ b/apps/liquidity-provision-dashboard/src/app/components/detail/detail.tsx @@ -11,7 +11,7 @@ import { getFeeLevels, sumLiquidityCommitted, marketLiquidityDataProvider, - liquidityProvisionsDataProvider, + lpAggregatedDataProvider, } from '@vegaprotocol/liquidity'; import type { MarketLpQuery } from '@vegaprotocol/liquidity'; @@ -34,10 +34,10 @@ const formatMarket = (data: MarketLpQuery) => { }; export const lpDataProvider = makeDerivedDataProvider( - [marketLiquidityDataProvider, liquidityProvisionsDataProvider], - ([market, providers]) => ({ + [marketLiquidityDataProvider, lpAggregatedDataProvider], + ([market, lpAggregatedData]) => ({ market: { ...formatMarket(market) }, - liquidityProviders: providers || [], + liquidityProviders: lpAggregatedData || [], }) ); diff --git a/apps/liquidity-provision-dashboard/src/app/components/detail/providers/providers.tsx b/apps/liquidity-provision-dashboard/src/app/components/detail/providers/providers.tsx index 942862426..ea9cea89c 100644 --- a/apps/liquidity-provision-dashboard/src/app/components/detail/providers/providers.tsx +++ b/apps/liquidity-provision-dashboard/src/app/components/detail/providers/providers.tsx @@ -4,7 +4,10 @@ import { AgGridColumn } from 'ag-grid-react'; import type { GetRowIdParams } from 'ag-grid-community'; import { t } from '@vegaprotocol/react-helpers'; -import type { LiquidityProvisionFieldsFragment } from '@vegaprotocol/liquidity'; +import type { + LiquidityProviderFeeShareFieldsFragment, + LiquidityProvisionFieldsFragment, +} from '@vegaprotocol/liquidity'; import { formatWithAsset } from '@vegaprotocol/liquidity'; import { Grid } from '../../grid'; @@ -24,7 +27,8 @@ export const LPProvidersGrid = ({ liquidityProviders, settlementAsset, }: { - liquidityProviders: LiquidityProvisionFieldsFragment[]; + liquidityProviders: LiquidityProvisionFieldsFragment & + LiquidityProviderFeeShareFieldsFragment[]; settlementAsset: { decimals?: number; symbol?: string; @@ -55,7 +59,14 @@ export const LPProvidersGrid = ({ valueFormatter={formatToHours} field="createdAt" /> - + { + const valueOr0 = value ? value : ''; + return `${parseInt(valueOr0) * 100}%`; + }} + /> Date: Thu, 10 Nov 2022 15:13:58 +0100 Subject: [PATCH 22/34] chore: migrate withdrawals lib (#2009) * chore: cleanup lib types * chore: migrate withdrawals * fix: withdrawals query and types * fix: types * fix: orders build * fix: withdraws build * fix: format * fix: more build stuff in withdrawal lib * fix: format * fix: more withdrawal builds * fix: format * fix: orders build again * fix: remaining build errors * fix: format * fix: withdrawal tests * fix: trick git to pick up file rename? * fix: rename back to orders * fix: rename generated file --- .../src/support/mocks/generate-withdrawals.ts | 18 ++- .../Accounts.ts | 0 .../src/lib/accounts-data-provider.ts | 4 +- libs/accounts/src/lib/index.ts | 2 +- .../Asset.ts | 0 .../Assets.ts | 0 libs/assets/src/lib/asset-data-provider.ts | 4 +- .../src/lib/asset-details-dialog.spec.tsx | 2 +- libs/assets/src/lib/assets-data-provider.ts | 4 +- libs/assets/src/lib/index.ts | 4 +- .../Candles.ts | 0 .../Chart.ts | 0 libs/candles-chart/src/lib/data-source.ts | 8 +- libs/candles-chart/src/lib/index.ts | 4 +- .../use-order-margin-validation.tsx | 2 +- .../use-order-validation.spec.tsx | 2 +- .../use-order-validation.tsx | 2 +- .../DealTicket.ts | 0 .../deal-ticket/deal-ticket-amount.tsx | 2 +- .../deal-ticket/deal-ticket-container.tsx | 4 +- .../deal-ticket/deal-ticket-manager.tsx | 2 +- .../deal-ticket/deal-ticket.spec.tsx | 2 +- .../components/deal-ticket/deal-ticket.tsx | 2 +- .../src/components/deal-ticket/index.ts | 2 +- .../compile-grid-data.tsx | 2 +- .../src/hooks/use-order-closeout.spec.tsx | 2 +- .../src/hooks/use-order-closeout.ts | 2 +- .../src/hooks/use-order-margin.spec.ts | 2 +- .../deal-ticket/src/hooks/use-order-margin.ts | 2 +- .../Deposit.ts | 0 libs/deposits/src/lib/deposits-table.tsx | 2 +- libs/deposits/src/lib/index.ts | 2 +- libs/deposits/src/lib/use-deposits.ts | 4 +- libs/deposits/src/lib/use-submit-deposit.tsx | 4 +- libs/fills/src/index.ts | 2 +- .../Fills.ts | 0 libs/fills/src/lib/fills-data-provider.ts | 4 +- .../VoteSubsciption.ts | 0 .../src/lib/voting-hooks/use-vote-event.ts | 4 +- .../src/lib/voting-hooks/use-vote-submit.ts | 2 +- .../LedgerEntries.ts | 0 .../src/lib/ledger-entries-data-provider.ts | 4 +- .../{orders.graphql => Orders.graphql} | 0 .../orders.ts => __generated__/Orders.ts} | 0 .../components/order-data-provider/index.ts | 2 +- .../order-data-provider.ts | 4 +- .../order-feedback/order-feedback.tsx | 2 +- .../use-order-list-data.spec.ts | 2 +- .../OrderEvent.ts | 0 libs/orders/src/lib/order-hooks/index.ts | 2 +- .../lib/order-hooks/use-order-edit.spec.tsx | 4 +- .../src/lib/order-hooks/use-order-event.ts | 4 +- .../src/lib/order-hooks/use-order-submit.tsx | 2 +- libs/positions/src/index.ts | 2 +- .../Positions.ts | 0 .../positions/src/lib/margin-data-provider.ts | 4 +- .../src/lib/positions-data-providers.spec.ts | 2 +- .../src/lib/positions-data-providers.ts | 4 +- .../NetworkParams.ts | 0 libs/react-helpers/src/hooks/index.ts | 2 +- .../src/hooks/use-network-params.spec.tsx | 6 +- .../src/hooks/use-network-params.ts | 2 +- libs/react-helpers/src/index.ts | 2 +- .../ChainId.ts | 0 libs/trades/src/index.ts | 2 +- .../Trades.ts | 0 libs/trades/src/lib/trades-container.tsx | 2 +- libs/trades/src/lib/trades-data-provider.ts | 4 +- libs/types/apollo.config.js | 19 ++- libs/types/src/__generated__/globalTypes.ts | 27 ++-- libs/types/src/global-types-mappings.ts | 12 -- .../TransactionResult.ts | 0 libs/wallet/src/index.ts | 2 +- .../src/use-transaction-result.spec.tsx | 4 +- libs/wallet/src/use-transaction-result.ts | 4 +- libs/withdraws/src/index.ts | 4 +- libs/withdraws/src/lib/Withdraw.graphql | 32 ---- libs/withdraws/src/lib/Withdrawal.graphql | 20 ++- .../src/lib/__generated__/AssetFields.ts | 52 ------- .../src/lib/__generated__/Erc20Approval.ts | 98 ++++++------ .../lib/__generated__/PendingWithdrawal.ts | 20 --- .../Withdrawal.ts | 29 +++- .../src/lib/__generated__/WithdrawalEvent.ts | 125 ---------------- .../src/lib/__generated__/WithdrawalFields.ts | 100 ------------- .../src/lib/__generated__/Withdrawals.ts | 139 ------------------ .../src/lib/__generated___/Erc20Approval.ts | 54 ------- .../src/lib/__generated___/Withdraw.ts | 75 ---------- .../lib/pending-withdrawals-table.spec.tsx | 4 +- .../src/lib/pending-withdrawals-table.tsx | 18 +-- libs/withdraws/src/lib/queries.ts | 15 -- libs/withdraws/src/lib/test-helpers.ts | 20 +-- .../src/lib/use-complete-withdraw.spec.tsx | 20 ++- .../src/lib/use-complete-withdraw.ts | 29 ++-- .../src/lib/use-create-withdraw.spec.tsx | 25 ++-- libs/withdraws/src/lib/use-create-withdraw.ts | 13 +- .../src/lib/use-get-withdraw-threshold.tsx | 8 +- .../src/lib/use-verify-withdrawal.ts | 20 +-- .../src/lib/use-withdrawal-approval.ts | 15 +- .../withdraws/src/lib/use-withdrawal-event.ts | 19 ++- .../src/lib/use-withdrawals.spec.tsx | 37 ++--- libs/withdraws/src/lib/use-withdrawals.ts | 137 +++++------------ .../src/lib/withdraw-manager.spec.tsx | 10 +- .../withdraws/src/lib/withdrawal-feedback.tsx | 4 +- .../src/lib/withdrawals-table.spec.tsx | 16 +- libs/withdraws/src/lib/withdrawals-table.tsx | 27 ++-- 105 files changed, 388 insertions(+), 1027 deletions(-) rename libs/accounts/src/lib/{__generated___ => __generated__}/Accounts.ts (100%) rename libs/assets/src/lib/{__generated___ => __generated__}/Asset.ts (100%) rename libs/assets/src/lib/{__generated___ => __generated__}/Assets.ts (100%) rename libs/candles-chart/src/lib/{__generated___ => __generated__}/Candles.ts (100%) rename libs/candles-chart/src/lib/{__generated___ => __generated__}/Chart.ts (100%) rename libs/deal-ticket/src/components/deal-ticket/{__generated___ => __generated__}/DealTicket.ts (100%) rename libs/deposits/src/lib/{__generated___ => __generated__}/Deposit.ts (100%) rename libs/fills/src/lib/{__generated___ => __generated__}/Fills.ts (100%) rename libs/governance/src/lib/voting-hooks/{__generated___ => __generated__}/VoteSubsciption.ts (100%) rename libs/ledger/src/lib/{__generated___ => __generated__}/LedgerEntries.ts (100%) rename libs/orders/src/lib/components/order-data-provider/{orders.graphql => Orders.graphql} (100%) rename libs/orders/src/lib/components/order-data-provider/{__generated___/orders.ts => __generated__/Orders.ts} (100%) rename libs/orders/src/lib/order-hooks/{__generated___ => __generated__}/OrderEvent.ts (100%) rename libs/positions/src/lib/{__generated___ => __generated__}/Positions.ts (100%) rename libs/react-helpers/src/hooks/{__generated___ => __generated__}/NetworkParams.ts (100%) rename libs/react-helpers/src/lib/{__generated___ => __generated__}/ChainId.ts (100%) rename libs/trades/src/lib/{__generated___ => __generated__}/Trades.ts (100%) rename libs/wallet/src/{__generated___ => __generated__}/TransactionResult.ts (100%) delete mode 100644 libs/withdraws/src/lib/Withdraw.graphql delete mode 100644 libs/withdraws/src/lib/__generated__/AssetFields.ts delete mode 100644 libs/withdraws/src/lib/__generated__/PendingWithdrawal.ts rename libs/withdraws/src/lib/{__generated___ => __generated__}/Withdrawal.ts (75%) delete mode 100644 libs/withdraws/src/lib/__generated__/WithdrawalEvent.ts delete mode 100644 libs/withdraws/src/lib/__generated__/WithdrawalFields.ts delete mode 100644 libs/withdraws/src/lib/__generated__/Withdrawals.ts delete mode 100644 libs/withdraws/src/lib/__generated___/Erc20Approval.ts delete mode 100644 libs/withdraws/src/lib/__generated___/Withdraw.ts delete mode 100644 libs/withdraws/src/lib/queries.ts diff --git a/apps/trading-e2e/src/support/mocks/generate-withdrawals.ts b/apps/trading-e2e/src/support/mocks/generate-withdrawals.ts index 206e16a97..6b2d1a09a 100644 --- a/apps/trading-e2e/src/support/mocks/generate-withdrawals.ts +++ b/apps/trading-e2e/src/support/mocks/generate-withdrawals.ts @@ -1,10 +1,12 @@ -import { AssetStatus, WithdrawalStatus } from '@vegaprotocol/types'; -import type { Withdrawals } from '@vegaprotocol/withdraws'; +import { Schema } from '@vegaprotocol/types'; +import type { WithdrawalsQuery } from '@vegaprotocol/withdraws'; import merge from 'lodash/merge'; import type { PartialDeep } from 'type-fest'; -export const generateWithdrawals = (override?: PartialDeep) => { - const defaultResult: Withdrawals = { +export const generateWithdrawals = ( + override?: PartialDeep +) => { + const defaultResult: WithdrawalsQuery = { party: { id: 'party-0', withdrawalsConnection: { @@ -14,7 +16,7 @@ export const generateWithdrawals = (override?: PartialDeep) => { __typename: 'WithdrawalEdge', node: { id: 'withdrawal-0', - status: WithdrawalStatus.STATUS_FINALIZED, + status: Schema.WithdrawalStatus.STATUS_FINALIZED, amount: '100', txHash: null, createdTimestamp: new Date('2022-02-02').toISOString(), @@ -30,7 +32,7 @@ export const generateWithdrawals = (override?: PartialDeep) => { name: 'asset-0 name', symbol: 'AST0', decimals: 5, - status: AssetStatus.STATUS_ENABLED, + status: Schema.AssetStatus.STATUS_ENABLED, source: { __typename: 'ERC20', contractAddress: '0x123', @@ -43,7 +45,7 @@ export const generateWithdrawals = (override?: PartialDeep) => { __typename: 'WithdrawalEdge', node: { id: 'withdrawal-1', - status: WithdrawalStatus.STATUS_FINALIZED, + status: Schema.WithdrawalStatus.STATUS_FINALIZED, amount: '100', txHash: '0x5d7b1a35ba6bd23be17bb7a159c13cdbb3121fceb94e9c6c510f5503dce48d03', @@ -60,7 +62,7 @@ export const generateWithdrawals = (override?: PartialDeep) => { name: 'asset-0 name', symbol: 'AST0', decimals: 5, - status: AssetStatus.STATUS_ENABLED, + status: Schema.AssetStatus.STATUS_ENABLED, source: { __typename: 'ERC20', contractAddress: '0x123', diff --git a/libs/accounts/src/lib/__generated___/Accounts.ts b/libs/accounts/src/lib/__generated__/Accounts.ts similarity index 100% rename from libs/accounts/src/lib/__generated___/Accounts.ts rename to libs/accounts/src/lib/__generated__/Accounts.ts diff --git a/libs/accounts/src/lib/accounts-data-provider.ts b/libs/accounts/src/lib/accounts-data-provider.ts index 792ef411c..e1f49f3b3 100644 --- a/libs/accounts/src/lib/accounts-data-provider.ts +++ b/libs/accounts/src/lib/accounts-data-provider.ts @@ -10,14 +10,14 @@ import produce from 'immer'; import { AccountEventsDocument, AccountsDocument, -} from './__generated___/Accounts'; +} from './__generated__/Accounts'; import type { IterableElement } from 'type-fest'; import type { AccountFieldsFragment, AccountsQuery, AccountEventsSubscription, -} from './__generated___/Accounts'; +} from './__generated__/Accounts'; import type { Market } from '@vegaprotocol/market-list'; import type { Asset } from '@vegaprotocol/assets'; diff --git a/libs/accounts/src/lib/index.ts b/libs/accounts/src/lib/index.ts index ded2a6e4c..86e857552 100644 --- a/libs/accounts/src/lib/index.ts +++ b/libs/accounts/src/lib/index.ts @@ -1,4 +1,4 @@ -export * from './__generated___/Accounts'; +export * from './__generated__/Accounts'; export * from './accounts-data-provider'; export * from './accounts-table'; export * from './asset-balance'; diff --git a/libs/assets/src/lib/__generated___/Asset.ts b/libs/assets/src/lib/__generated__/Asset.ts similarity index 100% rename from libs/assets/src/lib/__generated___/Asset.ts rename to libs/assets/src/lib/__generated__/Asset.ts diff --git a/libs/assets/src/lib/__generated___/Assets.ts b/libs/assets/src/lib/__generated__/Assets.ts similarity index 100% rename from libs/assets/src/lib/__generated___/Assets.ts rename to libs/assets/src/lib/__generated__/Assets.ts diff --git a/libs/assets/src/lib/asset-data-provider.ts b/libs/assets/src/lib/asset-data-provider.ts index 196873b0d..f87a2af45 100644 --- a/libs/assets/src/lib/asset-data-provider.ts +++ b/libs/assets/src/lib/asset-data-provider.ts @@ -1,8 +1,8 @@ import { makeDataProvider, useDataProvider } from '@vegaprotocol/react-helpers'; import { useMemo } from 'react'; -import type { AssetQuery, AssetFieldsFragment } from './__generated___/Asset'; -import { AssetDocument } from './__generated___/Asset'; +import type { AssetQuery, AssetFieldsFragment } from './__generated__/Asset'; +import { AssetDocument } from './__generated__/Asset'; export type Asset = AssetFieldsFragment; diff --git a/libs/assets/src/lib/asset-details-dialog.spec.tsx b/libs/assets/src/lib/asset-details-dialog.spec.tsx index ec84a1ab5..95748572e 100644 --- a/libs/assets/src/lib/asset-details-dialog.spec.tsx +++ b/libs/assets/src/lib/asset-details-dialog.spec.tsx @@ -3,7 +3,7 @@ import { render, screen } from '@testing-library/react'; import { AssetStatus } from '@vegaprotocol/types'; import { AssetDetailsDialog } from './asset-details-dialog'; import { AssetDetail, testId } from './asset-details-table'; -import { AssetsDocument } from './__generated___/Assets'; +import { AssetsDocument } from './__generated__/Assets'; import { generateBuiltinAsset, generateERC20Asset } from './test-helpers'; const mockedData = { diff --git a/libs/assets/src/lib/assets-data-provider.ts b/libs/assets/src/lib/assets-data-provider.ts index aaec1684d..ffa4d3565 100644 --- a/libs/assets/src/lib/assets-data-provider.ts +++ b/libs/assets/src/lib/assets-data-provider.ts @@ -3,9 +3,9 @@ import { makeDerivedDataProvider, useDataProvider, } from '@vegaprotocol/react-helpers'; -import { AssetsDocument } from './__generated___/Assets'; +import { AssetsDocument } from './__generated__/Assets'; import { AssetStatus } from '@vegaprotocol/types'; -import type { AssetsQuery } from './__generated___/Assets'; +import type { AssetsQuery } from './__generated__/Assets'; import type { Asset } from './asset-data-provider'; export interface ERC20AssetSource { diff --git a/libs/assets/src/lib/index.ts b/libs/assets/src/lib/index.ts index e8e130fec..c1106505d 100644 --- a/libs/assets/src/lib/index.ts +++ b/libs/assets/src/lib/index.ts @@ -1,5 +1,5 @@ -export * from './__generated___/Asset'; -export * from './__generated___/Assets'; +export * from './__generated__/Asset'; +export * from './__generated__/Assets'; export * from './asset-data-provider'; export * from './assets-data-provider'; export * from './asset-details-dialog'; diff --git a/libs/candles-chart/src/lib/__generated___/Candles.ts b/libs/candles-chart/src/lib/__generated__/Candles.ts similarity index 100% rename from libs/candles-chart/src/lib/__generated___/Candles.ts rename to libs/candles-chart/src/lib/__generated__/Candles.ts diff --git a/libs/candles-chart/src/lib/__generated___/Chart.ts b/libs/candles-chart/src/lib/__generated__/Chart.ts similarity index 100% rename from libs/candles-chart/src/lib/__generated___/Chart.ts rename to libs/candles-chart/src/lib/__generated__/Chart.ts diff --git a/libs/candles-chart/src/lib/data-source.ts b/libs/candles-chart/src/lib/data-source.ts index 9c7903902..c5a3ce8cc 100644 --- a/libs/candles-chart/src/lib/data-source.ts +++ b/libs/candles-chart/src/lib/data-source.ts @@ -3,19 +3,19 @@ import type { Candle, DataSource } from 'pennant'; import { Interval as PennantInterval } from 'pennant'; import { addDecimal } from '@vegaprotocol/react-helpers'; -import { ChartDocument } from './__generated___/Chart'; -import type { ChartQuery, ChartQueryVariables } from './__generated___/Chart'; +import { ChartDocument } from './__generated__/Chart'; +import type { ChartQuery, ChartQueryVariables } from './__generated__/Chart'; import { CandlesDocument, CandlesEventsDocument, -} from './__generated___/Candles'; +} from './__generated__/Candles'; import type { CandlesQuery, CandlesQueryVariables, CandleFieldsFragment, CandlesEventsSubscription, CandlesEventsSubscriptionVariables, -} from './__generated___/Candles'; +} from './__generated__/Candles'; import type { Subscription } from 'zen-observable-ts'; import { Interval } from '@vegaprotocol/types'; diff --git a/libs/candles-chart/src/lib/index.ts b/libs/candles-chart/src/lib/index.ts index b09081938..fec9df1f3 100644 --- a/libs/candles-chart/src/lib/index.ts +++ b/libs/candles-chart/src/lib/index.ts @@ -1,4 +1,4 @@ -export * from './__generated___/Candles'; -export * from './__generated___/Chart'; +export * from './__generated__/Candles'; +export * from './__generated__/Chart'; export * from './candles-chart'; export * from './data-source'; diff --git a/libs/deal-ticket/src/components/deal-ticket-validation/use-order-margin-validation.tsx b/libs/deal-ticket/src/components/deal-ticket-validation/use-order-margin-validation.tsx index f83198bc6..40d5ebd95 100644 --- a/libs/deal-ticket/src/components/deal-ticket-validation/use-order-margin-validation.tsx +++ b/libs/deal-ticket/src/components/deal-ticket-validation/use-order-margin-validation.tsx @@ -2,7 +2,7 @@ import { useMemo } from 'react'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { AccountType } from '@vegaprotocol/types'; import { toBigNum } from '@vegaprotocol/react-helpers'; -import type { DealTicketMarketFragment } from '../deal-ticket/__generated___/DealTicket'; +import type { DealTicketMarketFragment } from '../deal-ticket/__generated__/DealTicket'; import type { OrderMargin } from '../../hooks/use-order-margin'; import { usePartyBalanceQuery, useSettlementAccount } from '../../hooks'; diff --git a/libs/deal-ticket/src/components/deal-ticket-validation/use-order-validation.spec.tsx b/libs/deal-ticket/src/components/deal-ticket-validation/use-order-validation.spec.tsx index 25477680d..314c7e15f 100644 --- a/libs/deal-ticket/src/components/deal-ticket-validation/use-order-validation.spec.tsx +++ b/libs/deal-ticket/src/components/deal-ticket-validation/use-order-validation.spec.tsx @@ -11,7 +11,7 @@ import { } from '@vegaprotocol/types'; import type { ValidationProps } from './use-order-validation'; import { marketTranslations, useOrderValidation } from './use-order-validation'; -import type { DealTicketMarketFragment } from '../deal-ticket/__generated___/DealTicket'; +import type { DealTicketMarketFragment } from '../deal-ticket/__generated__/DealTicket'; import * as OrderMarginValidation from './use-order-margin-validation'; import { ValidateMargin } from './validate-margin'; import { ERROR_SIZE_DECIMAL } from '../constants'; diff --git a/libs/deal-ticket/src/components/deal-ticket-validation/use-order-validation.tsx b/libs/deal-ticket/src/components/deal-ticket-validation/use-order-validation.tsx index 8cf5ac444..a7a8f76ca 100644 --- a/libs/deal-ticket/src/components/deal-ticket-validation/use-order-validation.tsx +++ b/libs/deal-ticket/src/components/deal-ticket-validation/use-order-validation.tsx @@ -14,7 +14,7 @@ import type { OrderSubmissionBody } from '@vegaprotocol/wallet'; import { Tooltip } from '@vegaprotocol/ui-toolkit'; import { MarketDataGrid } from '../trading-mode-tooltip'; import { compileGridData } from '../trading-mode-tooltip/compile-grid-data'; -import type { DealTicketMarketFragment } from '../deal-ticket/__generated___/DealTicket'; +import type { DealTicketMarketFragment } from '../deal-ticket/__generated__/DealTicket'; import { ValidateMargin } from './validate-margin'; import type { OrderMargin } from '../../hooks/use-order-margin'; import { useOrderMarginValidation } from './use-order-margin-validation'; diff --git a/libs/deal-ticket/src/components/deal-ticket/__generated___/DealTicket.ts b/libs/deal-ticket/src/components/deal-ticket/__generated__/DealTicket.ts similarity index 100% rename from libs/deal-ticket/src/components/deal-ticket/__generated___/DealTicket.ts rename to libs/deal-ticket/src/components/deal-ticket/__generated__/DealTicket.ts diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-amount.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-amount.tsx index a2e40beb4..55a945dc2 100644 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-amount.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-amount.tsx @@ -2,7 +2,7 @@ import type { UseFormRegister } from 'react-hook-form'; import type { OrderSubmissionBody } from '@vegaprotocol/wallet'; import { DealTicketMarketAmount } from './deal-ticket-market-amount'; import { DealTicketLimitAmount } from './deal-ticket-limit-amount'; -import type { DealTicketMarketFragment } from './__generated___/DealTicket'; +import type { DealTicketMarketFragment } from './__generated__/DealTicket'; import { Schema } from '@vegaprotocol/types'; import type { DealTicketErrorMessage } from './deal-ticket-error'; diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-container.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-container.tsx index 1a58988d4..ad02e48db 100644 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-container.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-container.tsx @@ -1,8 +1,8 @@ import { AsyncRenderer, Splash } from '@vegaprotocol/ui-toolkit'; import { DealTicketManager } from './deal-ticket-manager'; import { t } from '@vegaprotocol/react-helpers'; -import { useDealTicketQuery } from './__generated___/DealTicket'; -import type { DealTicketQuery } from './__generated___/DealTicket'; +import { useDealTicketQuery } from './__generated__/DealTicket'; +import type { DealTicketQuery } from './__generated__/DealTicket'; export interface DealTicketContainerProps { marketId: string; diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-manager.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-manager.tsx index c9bc3095a..6c7702bbf 100644 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-manager.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-manager.tsx @@ -1,7 +1,7 @@ import type { ReactNode } from 'react'; import { VegaTxStatus } from '@vegaprotocol/wallet'; import { DealTicket } from './deal-ticket'; -import type { DealTicketMarketFragment } from './__generated___/DealTicket'; +import type { DealTicketMarketFragment } from './__generated__/DealTicket'; import { useOrderSubmit, OrderFeedback } from '@vegaprotocol/orders'; import { Schema } from '@vegaprotocol/types'; import { Icon, Intent } from '@vegaprotocol/ui-toolkit'; diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket.spec.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket.spec.tsx index dc5826699..c5c29e416 100644 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket.spec.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket.spec.tsx @@ -2,7 +2,7 @@ import { VegaWalletContext } from '@vegaprotocol/wallet'; import { fireEvent, render, screen, act } from '@testing-library/react'; import { DealTicket } from './deal-ticket'; -import type { DealTicketMarketFragment } from './__generated___/DealTicket'; +import type { DealTicketMarketFragment } from './__generated__/DealTicket'; import { Schema } from '@vegaprotocol/types'; import type { OrderSubmissionBody } from '@vegaprotocol/wallet'; import type { MockedResponse } from '@apollo/client/testing'; diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx index dbebbccc7..8edbee6f6 100644 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx @@ -20,7 +20,7 @@ import { SideSelector } from './side-selector'; import { TimeInForceSelector } from './time-in-force-selector'; import { TypeSelector } from './type-selector'; -import type { DealTicketMarketFragment } from './__generated___/DealTicket'; +import type { DealTicketMarketFragment } from './__generated__/DealTicket'; import type { OrderSubmissionBody } from '@vegaprotocol/wallet'; import type { DealTicketErrorMessage } from './deal-ticket-error'; diff --git a/libs/deal-ticket/src/components/deal-ticket/index.ts b/libs/deal-ticket/src/components/deal-ticket/index.ts index aadda9f00..d9f11eae6 100644 --- a/libs/deal-ticket/src/components/deal-ticket/index.ts +++ b/libs/deal-ticket/src/components/deal-ticket/index.ts @@ -1,4 +1,4 @@ -export * from './__generated___/DealTicket'; +export * from './__generated__/DealTicket'; export * from './deal-ticket-amount'; export * from './deal-ticket-container'; export * from './deal-ticket-limit-amount'; diff --git a/libs/deal-ticket/src/components/trading-mode-tooltip/compile-grid-data.tsx b/libs/deal-ticket/src/components/trading-mode-tooltip/compile-grid-data.tsx index 624cd3725..ec07ef537 100644 --- a/libs/deal-ticket/src/components/trading-mode-tooltip/compile-grid-data.tsx +++ b/libs/deal-ticket/src/components/trading-mode-tooltip/compile-grid-data.tsx @@ -7,7 +7,7 @@ import { MarketTradingMode, AuctionTrigger } from '@vegaprotocol/types'; import { Link as UILink } from '@vegaprotocol/ui-toolkit'; import type { ReactNode } from 'react'; import type { MarketDataGridProps } from './market-data-grid'; -import type { DealTicketMarketFragment } from '../deal-ticket/__generated___/DealTicket'; +import type { DealTicketMarketFragment } from '../deal-ticket/__generated__/DealTicket'; import { Link } from 'react-router-dom'; export const compileGridData = ( diff --git a/libs/deal-ticket/src/hooks/use-order-closeout.spec.tsx b/libs/deal-ticket/src/hooks/use-order-closeout.spec.tsx index ab4b37bb7..c3bd24f99 100644 --- a/libs/deal-ticket/src/hooks/use-order-closeout.spec.tsx +++ b/libs/deal-ticket/src/hooks/use-order-closeout.spec.tsx @@ -4,7 +4,7 @@ import { MockedProvider } from '@apollo/client/testing'; import type { OrderSubmissionBody } from '@vegaprotocol/wallet'; import type { PartyBalanceQuery } from './__generated__/PartyBalance'; import { useOrderCloseOut } from './use-order-closeout'; -import type { DealTicketMarketFragment } from '../components/deal-ticket/__generated___/DealTicket'; +import type { DealTicketMarketFragment } from '../components/deal-ticket/__generated__/DealTicket'; jest.mock('@vegaprotocol/wallet', () => ({ ...jest.requireActual('@vegaprotocol/wallet'), diff --git a/libs/deal-ticket/src/hooks/use-order-closeout.ts b/libs/deal-ticket/src/hooks/use-order-closeout.ts index 33b43bea9..9dc1e01fc 100644 --- a/libs/deal-ticket/src/hooks/use-order-closeout.ts +++ b/libs/deal-ticket/src/hooks/use-order-closeout.ts @@ -6,7 +6,7 @@ import { useMarketPositions } from './use-market-positions'; import { useMarketDataMarkPrice } from './use-market-data-mark-price'; import { usePartyMarketDataQuery } from './__generated__/PartyMarketData'; import { Schema } from '@vegaprotocol/types'; -import type { DealTicketMarketFragment } from '../components/deal-ticket/__generated___/DealTicket'; +import type { DealTicketMarketFragment } from '../components/deal-ticket/__generated__/DealTicket'; import type { PartyBalanceQuery } from './__generated__/PartyBalance'; import { useSettlementAccount } from './use-settlement-account'; diff --git a/libs/deal-ticket/src/hooks/use-order-margin.spec.ts b/libs/deal-ticket/src/hooks/use-order-margin.spec.ts index 65b65f4d3..2ab0f6b35 100644 --- a/libs/deal-ticket/src/hooks/use-order-margin.spec.ts +++ b/libs/deal-ticket/src/hooks/use-order-margin.spec.ts @@ -4,7 +4,7 @@ import { BigNumber } from 'bignumber.js'; import type { OrderSubmissionBody } from '@vegaprotocol/wallet'; import type { PositionMargin } from './use-market-positions'; import { useOrderMargin } from './use-order-margin'; -import type { DealTicketMarketFragment } from '../components/deal-ticket/__generated___/DealTicket'; +import type { DealTicketMarketFragment } from '../components/deal-ticket/__generated__/DealTicket'; let mockEstimateData = { estimateOrder: { diff --git a/libs/deal-ticket/src/hooks/use-order-margin.ts b/libs/deal-ticket/src/hooks/use-order-margin.ts index 4bf3dc856..41614603a 100644 --- a/libs/deal-ticket/src/hooks/use-order-margin.ts +++ b/libs/deal-ticket/src/hooks/use-order-margin.ts @@ -6,7 +6,7 @@ import { useMarketPositions } from './use-market-positions'; import { useMarketDataMarkPrice } from './use-market-data-mark-price'; import type { EstimateOrderQuery } from './__generated__/EstimateOrder'; import { useEstimateOrderQuery } from './__generated__/EstimateOrder'; -import type { DealTicketMarketFragment } from '../components/deal-ticket/__generated___/DealTicket'; +import type { DealTicketMarketFragment } from '../components/deal-ticket/__generated__/DealTicket'; interface Props { order: OrderSubmissionBody['orderSubmission']; diff --git a/libs/deposits/src/lib/__generated___/Deposit.ts b/libs/deposits/src/lib/__generated__/Deposit.ts similarity index 100% rename from libs/deposits/src/lib/__generated___/Deposit.ts rename to libs/deposits/src/lib/__generated__/Deposit.ts diff --git a/libs/deposits/src/lib/deposits-table.tsx b/libs/deposits/src/lib/deposits-table.tsx index 705ad8b4e..0b973a9bc 100644 --- a/libs/deposits/src/lib/deposits-table.tsx +++ b/libs/deposits/src/lib/deposits-table.tsx @@ -11,7 +11,7 @@ import type { VegaValueFormatterParams, } from '@vegaprotocol/ui-toolkit'; import { AgGridDynamic as AgGrid, Link } from '@vegaprotocol/ui-toolkit'; -import type { DepositFieldsFragment } from './__generated___/Deposit'; +import type { DepositFieldsFragment } from './__generated__/Deposit'; import { useEnvironment } from '@vegaprotocol/environment'; import { DepositStatusMapping } from '@vegaprotocol/types'; diff --git a/libs/deposits/src/lib/index.ts b/libs/deposits/src/lib/index.ts index a8eca8eaa..299f49921 100644 --- a/libs/deposits/src/lib/index.ts +++ b/libs/deposits/src/lib/index.ts @@ -1,4 +1,4 @@ -export * from './__generated___/Deposit'; +export * from './__generated__/Deposit'; export * from './deposit-container'; export * from './deposit-form'; export * from './deposit-limits'; diff --git a/libs/deposits/src/lib/use-deposits.ts b/libs/deposits/src/lib/use-deposits.ts index 348791b76..3fdf138b8 100644 --- a/libs/deposits/src/lib/use-deposits.ts +++ b/libs/deposits/src/lib/use-deposits.ts @@ -8,13 +8,13 @@ import { Schema } from '@vegaprotocol/types'; import { useDepositsQuery, DepositEventDocument, -} from './__generated___/Deposit'; +} from './__generated__/Deposit'; import type { DepositFieldsFragment, DepositsQuery, DepositEventSubscription, DepositEventSubscriptionVariables, -} from './__generated___/Deposit'; +} from './__generated__/Deposit'; export const useDeposits = () => { const { pubKey } = useVegaWallet(); diff --git a/libs/deposits/src/lib/use-submit-deposit.tsx b/libs/deposits/src/lib/use-submit-deposit.tsx index a9816bea8..33a194caf 100644 --- a/libs/deposits/src/lib/use-submit-deposit.tsx +++ b/libs/deposits/src/lib/use-submit-deposit.tsx @@ -3,8 +3,8 @@ import * as Sentry from '@sentry/react'; import type { DepositEventSubscription, DepositEventSubscriptionVariables, -} from './__generated___/Deposit'; -import { DepositEventDocument } from './__generated___/Deposit'; +} from './__generated__/Deposit'; +import { DepositEventDocument } from './__generated__/Deposit'; import { Schema } from '@vegaprotocol/types'; import { useState } from 'react'; import { remove0x, removeDecimal } from '@vegaprotocol/react-helpers'; diff --git a/libs/fills/src/index.ts b/libs/fills/src/index.ts index e5512697d..a7260afe7 100644 --- a/libs/fills/src/index.ts +++ b/libs/fills/src/index.ts @@ -1,4 +1,4 @@ export * from './lib/fills-container'; export * from './lib/use-fills-list'; export * from './lib/fills-data-provider'; -export * from './lib/__generated___/Fills'; +export * from './lib/__generated__/Fills'; diff --git a/libs/fills/src/lib/__generated___/Fills.ts b/libs/fills/src/lib/__generated__/Fills.ts similarity index 100% rename from libs/fills/src/lib/__generated___/Fills.ts rename to libs/fills/src/lib/__generated__/Fills.ts diff --git a/libs/fills/src/lib/fills-data-provider.ts b/libs/fills/src/lib/fills-data-provider.ts index 8dff7d1b1..4c90729aa 100644 --- a/libs/fills/src/lib/fills-data-provider.ts +++ b/libs/fills/src/lib/fills-data-provider.ts @@ -10,13 +10,13 @@ import { import type { Market } from '@vegaprotocol/market-list'; import { marketsProvider } from '@vegaprotocol/market-list'; import type { PageInfo, Edge } from '@vegaprotocol/react-helpers'; -import { FillsDocument, FillsEventDocument } from './__generated___/Fills'; +import { FillsDocument, FillsEventDocument } from './__generated__/Fills'; import type { FillsQuery, FillFieldsFragment, FillEdgeFragment, FillsEventSubscription, -} from './__generated___/Fills'; +} from './__generated__/Fills'; const update = ( data: FillEdgeFragment[] | null, diff --git a/libs/governance/src/lib/voting-hooks/__generated___/VoteSubsciption.ts b/libs/governance/src/lib/voting-hooks/__generated__/VoteSubsciption.ts similarity index 100% rename from libs/governance/src/lib/voting-hooks/__generated___/VoteSubsciption.ts rename to libs/governance/src/lib/voting-hooks/__generated__/VoteSubsciption.ts diff --git a/libs/governance/src/lib/voting-hooks/use-vote-event.ts b/libs/governance/src/lib/voting-hooks/use-vote-event.ts index 2359c82c2..63bc970c9 100644 --- a/libs/governance/src/lib/voting-hooks/use-vote-event.ts +++ b/libs/governance/src/lib/voting-hooks/use-vote-event.ts @@ -1,13 +1,13 @@ import { useApolloClient } from '@apollo/client'; import { useCallback, useEffect, useRef } from 'react'; -import { VoteEventDocument } from './__generated___/VoteSubsciption'; +import { VoteEventDocument } from './__generated__/VoteSubsciption'; import type { Subscription } from 'zen-observable-ts'; import type { VegaTxState } from '@vegaprotocol/wallet'; import type { VoteEventFieldsFragment, VoteEventSubscription, VoteEventSubscriptionVariables, -} from './__generated___/VoteSubsciption'; +} from './__generated__/VoteSubsciption'; export const useVoteEvent = (transaction: VegaTxState) => { const client = useApolloClient(); diff --git a/libs/governance/src/lib/voting-hooks/use-vote-submit.ts b/libs/governance/src/lib/voting-hooks/use-vote-submit.ts index f5185ed8b..a900d825d 100644 --- a/libs/governance/src/lib/voting-hooks/use-vote-submit.ts +++ b/libs/governance/src/lib/voting-hooks/use-vote-submit.ts @@ -3,7 +3,7 @@ import * as Sentry from '@sentry/react'; import { useVegaTransaction, useVegaWallet } from '@vegaprotocol/wallet'; import { useVoteEvent } from './use-vote-event'; import type { VoteValue } from '@vegaprotocol/types'; -import type { VoteEventFieldsFragment } from './__generated___/VoteSubsciption'; +import type { VoteEventFieldsFragment } from './__generated__/VoteSubsciption'; export const useVoteSubmit = () => { const { pubKey } = useVegaWallet(); diff --git a/libs/ledger/src/lib/__generated___/LedgerEntries.ts b/libs/ledger/src/lib/__generated__/LedgerEntries.ts similarity index 100% rename from libs/ledger/src/lib/__generated___/LedgerEntries.ts rename to libs/ledger/src/lib/__generated__/LedgerEntries.ts diff --git a/libs/ledger/src/lib/ledger-entries-data-provider.ts b/libs/ledger/src/lib/ledger-entries-data-provider.ts index 80476a978..18d4e9056 100644 --- a/libs/ledger/src/lib/ledger-entries-data-provider.ts +++ b/libs/ledger/src/lib/ledger-entries-data-provider.ts @@ -11,8 +11,8 @@ import { useMemo } from 'react'; import type { LedgerEntriesQuery, LedgerEntryFragment, -} from './__generated___/LedgerEntries'; -import { LedgerEntriesDocument } from './__generated___/LedgerEntries'; +} from './__generated__/LedgerEntries'; +import { LedgerEntriesDocument } from './__generated__/LedgerEntries'; export type LedgerEntry = LedgerEntryFragment & { id: number; diff --git a/libs/orders/src/lib/components/order-data-provider/orders.graphql b/libs/orders/src/lib/components/order-data-provider/Orders.graphql similarity index 100% rename from libs/orders/src/lib/components/order-data-provider/orders.graphql rename to libs/orders/src/lib/components/order-data-provider/Orders.graphql diff --git a/libs/orders/src/lib/components/order-data-provider/__generated___/orders.ts b/libs/orders/src/lib/components/order-data-provider/__generated__/Orders.ts similarity index 100% rename from libs/orders/src/lib/components/order-data-provider/__generated___/orders.ts rename to libs/orders/src/lib/components/order-data-provider/__generated__/Orders.ts diff --git a/libs/orders/src/lib/components/order-data-provider/index.ts b/libs/orders/src/lib/components/order-data-provider/index.ts index 3d66ed838..4d19cff7d 100644 --- a/libs/orders/src/lib/components/order-data-provider/index.ts +++ b/libs/orders/src/lib/components/order-data-provider/index.ts @@ -1,2 +1,2 @@ -export * from './__generated___/orders'; +export * from './__generated__/Orders'; export * from './order-data-provider'; diff --git a/libs/orders/src/lib/components/order-data-provider/order-data-provider.ts b/libs/orders/src/lib/components/order-data-provider/order-data-provider.ts index 0eba1fdd6..9cab97780 100644 --- a/libs/orders/src/lib/components/order-data-provider/order-data-provider.ts +++ b/libs/orders/src/lib/components/order-data-provider/order-data-provider.ts @@ -15,8 +15,8 @@ import type { OrderFieldsFragment, OrdersQuery, OrdersUpdateSubscription, -} from './__generated___/orders'; -import { OrdersDocument, OrdersUpdateDocument } from './__generated___/orders'; +} from './__generated__/Orders'; +import { OrdersDocument, OrdersUpdateDocument } from './__generated__/Orders'; export type Order = Omit & { market?: Market; diff --git a/libs/orders/src/lib/components/order-feedback/order-feedback.tsx b/libs/orders/src/lib/components/order-feedback/order-feedback.tsx index e63b767f6..153595d51 100644 --- a/libs/orders/src/lib/components/order-feedback/order-feedback.tsx +++ b/libs/orders/src/lib/components/order-feedback/order-feedback.tsx @@ -1,5 +1,5 @@ import { useEnvironment } from '@vegaprotocol/environment'; -import type { OrderEventFieldsFragment } from '../../order-hooks/__generated___/OrderEvent'; +import type { OrderEventFieldsFragment } from '../../order-hooks/__generated__/OrderEvent'; import { addDecimalsFormatNumber, Size, t } from '@vegaprotocol/react-helpers'; import { OrderRejectionReasonMapping, diff --git a/libs/orders/src/lib/components/order-list-manager/use-order-list-data.spec.ts b/libs/orders/src/lib/components/order-list-manager/use-order-list-data.spec.ts index 816f1ed8d..f7c078ecf 100644 --- a/libs/orders/src/lib/components/order-list-manager/use-order-list-data.spec.ts +++ b/libs/orders/src/lib/components/order-list-manager/use-order-list-data.spec.ts @@ -3,7 +3,7 @@ import { MockedProvider } from '@apollo/client/testing'; import { renderHook, waitFor } from '@testing-library/react'; import { useOrderListData } from './use-order-list-data'; import type { Edge } from '@vegaprotocol/react-helpers'; -import type { OrderFieldsFragment } from '../order-data-provider/__generated___/orders'; +import type { OrderFieldsFragment } from '../order-data-provider/__generated__/Orders'; import type { IGetRowsParams } from 'ag-grid-community'; const loadMock = jest.fn(); diff --git a/libs/orders/src/lib/order-hooks/__generated___/OrderEvent.ts b/libs/orders/src/lib/order-hooks/__generated__/OrderEvent.ts similarity index 100% rename from libs/orders/src/lib/order-hooks/__generated___/OrderEvent.ts rename to libs/orders/src/lib/order-hooks/__generated__/OrderEvent.ts diff --git a/libs/orders/src/lib/order-hooks/index.ts b/libs/orders/src/lib/order-hooks/index.ts index bde41d256..9fbcf508c 100644 --- a/libs/orders/src/lib/order-hooks/index.ts +++ b/libs/orders/src/lib/order-hooks/index.ts @@ -1,4 +1,4 @@ -export * from './__generated___/OrderEvent'; +export * from './__generated__/OrderEvent'; export * from './use-order-cancel'; export * from './use-order-submit'; export * from './use-order-edit'; diff --git a/libs/orders/src/lib/order-hooks/use-order-edit.spec.tsx b/libs/orders/src/lib/order-hooks/use-order-edit.spec.tsx index 31c048c8e..0b6576ef7 100644 --- a/libs/orders/src/lib/order-hooks/use-order-edit.spec.tsx +++ b/libs/orders/src/lib/order-hooks/use-order-edit.spec.tsx @@ -3,8 +3,8 @@ import type { VegaWalletContextShape } from '@vegaprotocol/wallet'; import { VegaTxStatus, VegaWalletContext } from '@vegaprotocol/wallet'; import type { ReactNode } from 'react'; import { useOrderEdit } from './use-order-edit'; -import type { OrderEventSubscription } from './__generated___/OrderEvent'; -import { OrderEventDocument } from './__generated___/OrderEvent'; +import type { OrderEventSubscription } from './__generated__/OrderEvent'; +import { OrderEventDocument } from './__generated__/OrderEvent'; import type { MockedResponse } from '@apollo/client/testing'; import { MockedProvider } from '@apollo/client/testing'; import type { Order } from '../components'; diff --git a/libs/orders/src/lib/order-hooks/use-order-event.ts b/libs/orders/src/lib/order-hooks/use-order-event.ts index b2e6cb700..4205c0813 100644 --- a/libs/orders/src/lib/order-hooks/use-order-event.ts +++ b/libs/orders/src/lib/order-hooks/use-order-event.ts @@ -1,11 +1,11 @@ import { useApolloClient } from '@apollo/client'; import { useCallback, useEffect, useRef } from 'react'; -import { OrderEventDocument } from './__generated___/OrderEvent'; +import { OrderEventDocument } from './__generated__/OrderEvent'; import type { OrderEventSubscription, OrderEventSubscriptionVariables, OrderEventFieldsFragment, -} from './__generated___/OrderEvent'; +} from './__generated__/OrderEvent'; import type { Subscription } from 'zen-observable-ts'; import type { VegaTxState } from '@vegaprotocol/wallet'; import { Schema } from '@vegaprotocol/types'; diff --git a/libs/orders/src/lib/order-hooks/use-order-submit.tsx b/libs/orders/src/lib/order-hooks/use-order-submit.tsx index 6251c4bab..fb6b8f855 100644 --- a/libs/orders/src/lib/order-hooks/use-order-submit.tsx +++ b/libs/orders/src/lib/order-hooks/use-order-submit.tsx @@ -1,6 +1,6 @@ import { useCallback, useState } from 'react'; import type { ReactNode } from 'react'; -import type { OrderEventFieldsFragment } from './__generated___/OrderEvent'; +import type { OrderEventFieldsFragment } from './__generated__/OrderEvent'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { toNanoSeconds } from '@vegaprotocol/react-helpers'; import { useVegaTransaction, determineId } from '@vegaprotocol/wallet'; diff --git a/libs/positions/src/index.ts b/libs/positions/src/index.ts index 711411122..80a5ae96b 100644 --- a/libs/positions/src/index.ts +++ b/libs/positions/src/index.ts @@ -1,4 +1,4 @@ -export * from './lib/__generated___/Positions'; +export * from './lib/__generated__/Positions'; export * from './lib/positions-container'; export * from './lib/positions-data-providers'; export * from './lib/positions-table'; diff --git a/libs/positions/src/lib/__generated___/Positions.ts b/libs/positions/src/lib/__generated__/Positions.ts similarity index 100% rename from libs/positions/src/lib/__generated___/Positions.ts rename to libs/positions/src/lib/__generated__/Positions.ts diff --git a/libs/positions/src/lib/margin-data-provider.ts b/libs/positions/src/lib/margin-data-provider.ts index ae158485d..0ebc32f19 100644 --- a/libs/positions/src/lib/margin-data-provider.ts +++ b/libs/positions/src/lib/margin-data-provider.ts @@ -3,11 +3,11 @@ import { makeDataProvider } from '@vegaprotocol/react-helpers'; import { MarginsSubscriptionDocument, MarginsDocument, -} from './__generated___/Positions'; +} from './__generated__/Positions'; import type { MarginsQuery, MarginsSubscriptionSubscription, -} from './__generated___/Positions'; +} from './__generated__/Positions'; const update = ( data: MarginsQuery['party'], diff --git a/libs/positions/src/lib/positions-data-providers.spec.ts b/libs/positions/src/lib/positions-data-providers.spec.ts index be8e3f8b8..af8b80558 100644 --- a/libs/positions/src/lib/positions-data-providers.spec.ts +++ b/libs/positions/src/lib/positions-data-providers.spec.ts @@ -1,7 +1,7 @@ import { AccountType, MarketTradingMode } from '@vegaprotocol/types'; import type { Account } from '@vegaprotocol/accounts'; import type { MarketWithData } from '@vegaprotocol/market-list'; -import type { PositionsQuery, MarginsQuery } from './__generated___/Positions'; +import type { PositionsQuery, MarginsQuery } from './__generated__/Positions'; import { getMetrics, rejoinPositionData } from './positions-data-providers'; const accounts = [ diff --git a/libs/positions/src/lib/positions-data-providers.ts b/libs/positions/src/lib/positions-data-providers.ts index b490b4d48..a3231d45b 100644 --- a/libs/positions/src/lib/positions-data-providers.ts +++ b/libs/positions/src/lib/positions-data-providers.ts @@ -18,11 +18,11 @@ import type { PositionsSubscriptionSubscription, MarginsQuery, MarginFieldsFragment, -} from './__generated___/Positions'; +} from './__generated__/Positions'; import { PositionsDocument, PositionsSubscriptionDocument, -} from './__generated___/Positions'; +} from './__generated__/Positions'; import { marginsDataProvider } from './margin-data-provider'; type PositionMarginLevel = Pick< diff --git a/libs/react-helpers/src/hooks/__generated___/NetworkParams.ts b/libs/react-helpers/src/hooks/__generated__/NetworkParams.ts similarity index 100% rename from libs/react-helpers/src/hooks/__generated___/NetworkParams.ts rename to libs/react-helpers/src/hooks/__generated__/NetworkParams.ts diff --git a/libs/react-helpers/src/hooks/index.ts b/libs/react-helpers/src/hooks/index.ts index 8d9d134ce..c735c8e61 100644 --- a/libs/react-helpers/src/hooks/index.ts +++ b/libs/react-helpers/src/hooks/index.ts @@ -1,4 +1,4 @@ -export * from './__generated___/NetworkParams'; +export * from './__generated__/NetworkParams'; export * from './use-apply-grid-transaction'; export * from './use-data-provider'; export * from './use-fetch'; diff --git a/libs/react-helpers/src/hooks/use-network-params.spec.tsx b/libs/react-helpers/src/hooks/use-network-params.spec.tsx index 2ef22bd66..cac3f004e 100644 --- a/libs/react-helpers/src/hooks/use-network-params.spec.tsx +++ b/libs/react-helpers/src/hooks/use-network-params.spec.tsx @@ -8,9 +8,9 @@ import { useNetworkParams, } from './use-network-params'; import type { ReactNode } from 'react'; -import type { NetworkParamsQuery } from './__generated___/NetworkParams'; -import { NetworkParamDocument } from './__generated___/NetworkParams'; -import { NetworkParamsDocument } from './__generated___/NetworkParams'; +import type { NetworkParamsQuery } from './__generated__/NetworkParams'; +import { NetworkParamDocument } from './__generated__/NetworkParams'; +import { NetworkParamsDocument } from './__generated__/NetworkParams'; describe('useNetworkParam', () => { const setup = (arg: NetworkParamsKey) => { diff --git a/libs/react-helpers/src/hooks/use-network-params.ts b/libs/react-helpers/src/hooks/use-network-params.ts index 731eba089..24efccf30 100644 --- a/libs/react-helpers/src/hooks/use-network-params.ts +++ b/libs/react-helpers/src/hooks/use-network-params.ts @@ -3,7 +3,7 @@ import { useMemo } from 'react'; import { useNetworkParamQuery, useNetworkParamsQuery, -} from './__generated___/NetworkParams'; +} from './__generated__/NetworkParams'; export const NetworkParams = { blockchains_ethereumConfig: 'blockchains_ethereumConfig', diff --git a/libs/react-helpers/src/index.ts b/libs/react-helpers/src/index.ts index 5464d1c13..fdb10efc1 100644 --- a/libs/react-helpers/src/index.ts +++ b/libs/react-helpers/src/index.ts @@ -11,4 +11,4 @@ export * from './lib/remove-0x'; export * from './lib/storage'; export * from './lib/time'; export * from './lib/validate'; -export * from './lib/__generated___/ChainId'; +export * from './lib/__generated__/ChainId'; diff --git a/libs/react-helpers/src/lib/__generated___/ChainId.ts b/libs/react-helpers/src/lib/__generated__/ChainId.ts similarity index 100% rename from libs/react-helpers/src/lib/__generated___/ChainId.ts rename to libs/react-helpers/src/lib/__generated__/ChainId.ts diff --git a/libs/trades/src/index.ts b/libs/trades/src/index.ts index ca7b53e03..f0dcfa278 100644 --- a/libs/trades/src/index.ts +++ b/libs/trades/src/index.ts @@ -1,2 +1,2 @@ export * from './lib/trades-container'; -export * from './lib/__generated___/Trades'; +export * from './lib/__generated__/Trades'; diff --git a/libs/trades/src/lib/__generated___/Trades.ts b/libs/trades/src/lib/__generated__/Trades.ts similarity index 100% rename from libs/trades/src/lib/__generated___/Trades.ts rename to libs/trades/src/lib/__generated__/Trades.ts diff --git a/libs/trades/src/lib/trades-container.tsx b/libs/trades/src/lib/trades-container.tsx index 8e618c92e..3a7cbd537 100644 --- a/libs/trades/src/lib/trades-container.tsx +++ b/libs/trades/src/lib/trades-container.tsx @@ -9,7 +9,7 @@ import type { BodyScrollEvent, BodyScrollEndEvent } from 'ag-grid-community'; import { MAX_TRADES, tradesWithMarketProvider } from './trades-data-provider'; import { TradesTable } from './trades-table'; import type { Trade, TradeEdge } from './trades-data-provider'; -import type { TradesQueryVariables } from './__generated___/Trades'; +import type { TradesQueryVariables } from './__generated__/Trades'; interface TradesContainerProps { marketId: string; diff --git a/libs/trades/src/lib/trades-data-provider.ts b/libs/trades/src/lib/trades-data-provider.ts index 9026786ed..e3a80d9a2 100644 --- a/libs/trades/src/lib/trades-data-provider.ts +++ b/libs/trades/src/lib/trades-data-provider.ts @@ -12,8 +12,8 @@ import type { TradesQuery, TradeFieldsFragment, TradesUpdateSubscription, -} from './__generated___/Trades'; -import { TradesDocument, TradesUpdateDocument } from './__generated___/Trades'; +} from './__generated__/Trades'; +import { TradesDocument, TradesUpdateDocument } from './__generated__/Trades'; import orderBy from 'lodash/orderBy'; import produce from 'immer'; diff --git a/libs/types/apollo.config.js b/libs/types/apollo.config.js index eea32a900..8b6afe788 100644 --- a/libs/types/apollo.config.js +++ b/libs/types/apollo.config.js @@ -13,17 +13,34 @@ module.exports = { ], excludes: [ '**/generic-data-provider.ts', - '**/__generated___/*', + '**/__generated__/*', '../../libs/accounts/**', '../../libs/assets/**', '../../libs/candles-chart/**', + '../../libs/cypress/**', '../../libs/deal-ticket/**', '../../libs/deposits/**', '../../libs/environment/**', '../../libs/fills/**', '../../libs/governance/**', + '../../libs/ledger/**', '../../libs/liquidity/**', + // @TODO: uncomment these when migrated + // '../../libs/maket-depth/**', + // '../../libs/market-list/**', + // '../../libs/market-info/**', + '../../libs/network-info/**', '../../libs/network-stats/**', + '../../libs/orders/**', + '../../libs/positions/**', + '../../libs/react-helpers/**', + '../../libs/smart-contracts/**', + '../../libs/tailwind-config/**', + '../../libs/trades/**', + '../../libs/ui-toolkit/**', + '../../libs/wallet/**', + '../../libs/web3/**', + '../../libs/withdraws/**', ], }, }; diff --git a/libs/types/src/__generated__/globalTypes.ts b/libs/types/src/__generated__/globalTypes.ts index 510d9baf8..cdaea4691 100644 --- a/libs/types/src/__generated__/globalTypes.ts +++ b/libs/types/src/__generated__/globalTypes.ts @@ -63,6 +63,18 @@ export enum DataSourceSpecStatus { STATUS_DEACTIVATED = "STATUS_DEACTIVATED", } +/** + * The interval for trade candles when subscribing via Vega GraphQL, default is I15M + */ +export enum Interval { + INTERVAL_I15M = "INTERVAL_I15M", + INTERVAL_I1D = "INTERVAL_I1D", + INTERVAL_I1H = "INTERVAL_I1H", + INTERVAL_I1M = "INTERVAL_I1M", + INTERVAL_I5M = "INTERVAL_I5M", + INTERVAL_I6H = "INTERVAL_I6H", +} + /** * The current state of a market */ @@ -181,20 +193,17 @@ export enum StakeLinkingStatus { STATUS_REJECTED = "STATUS_REJECTED", } +export enum ValidatorStatus { + VALIDATOR_NODE_STATUS_ERSATZ = "VALIDATOR_NODE_STATUS_ERSATZ", + VALIDATOR_NODE_STATUS_PENDING = "VALIDATOR_NODE_STATUS_PENDING", + VALIDATOR_NODE_STATUS_TENDERMINT = "VALIDATOR_NODE_STATUS_TENDERMINT", +} + export enum VoteValue { VALUE_NO = "VALUE_NO", VALUE_YES = "VALUE_YES", } -/** - * The status of a withdrawal - */ -export enum WithdrawalStatus { - STATUS_FINALIZED = "STATUS_FINALIZED", - STATUS_OPEN = "STATUS_OPEN", - STATUS_REJECTED = "STATUS_REJECTED", -} - //============================================================== // END Enums and Input Objects //============================================================== diff --git a/libs/types/src/global-types-mappings.ts b/libs/types/src/global-types-mappings.ts index c938c6554..4e5d2da10 100644 --- a/libs/types/src/global-types-mappings.ts +++ b/libs/types/src/global-types-mappings.ts @@ -278,18 +278,6 @@ export enum WithdrawalStatusMapping { STATUS_REJECTED = 'Rejected', } -/** - * The interval for trade candles when subscribing via Vega GraphQL, default is I15M - */ -export enum Interval { - INTERVAL_I15M = 'INTERVAL_I15M', - INTERVAL_I1D = 'INTERVAL_I1D', - INTERVAL_I1H = 'INTERVAL_I1H', - INTERVAL_I1M = 'INTERVAL_I1M', - INTERVAL_I5M = 'INTERVAL_I5M', - INTERVAL_I6H = 'INTERVAL_I6H', -} - export enum ProposalUserAction { CREATE = 'CREATE', VOTE = 'VOTE', diff --git a/libs/wallet/src/__generated___/TransactionResult.ts b/libs/wallet/src/__generated__/TransactionResult.ts similarity index 100% rename from libs/wallet/src/__generated___/TransactionResult.ts rename to libs/wallet/src/__generated__/TransactionResult.ts diff --git a/libs/wallet/src/index.ts b/libs/wallet/src/index.ts index 0aa0108ef..a287ba4cc 100644 --- a/libs/wallet/src/index.ts +++ b/libs/wallet/src/index.ts @@ -10,4 +10,4 @@ export * from './provider'; export * from './connect-dialog'; export * from './utils'; export * from './constants'; -export * from './__generated___/TransactionResult'; +export * from './__generated__/TransactionResult'; diff --git a/libs/wallet/src/use-transaction-result.spec.tsx b/libs/wallet/src/use-transaction-result.spec.tsx index e8d993538..343870f6f 100644 --- a/libs/wallet/src/use-transaction-result.spec.tsx +++ b/libs/wallet/src/use-transaction-result.spec.tsx @@ -3,8 +3,8 @@ import type { MockedResponse } from '@apollo/client/testing'; import { MockedProvider } from '@apollo/client/testing'; import { renderHook } from '@testing-library/react'; import { Schema as Types } from '@vegaprotocol/types'; -import type { TransactionEventSubscription } from './__generated___/TransactionResult'; -import { TransactionEventDocument } from './__generated___/TransactionResult'; +import type { TransactionEventSubscription } from './__generated__/TransactionResult'; +import { TransactionEventDocument } from './__generated__/TransactionResult'; import { useTransactionResult } from './use-transaction-result'; const pubKey = 'test-pubkey'; diff --git a/libs/wallet/src/use-transaction-result.ts b/libs/wallet/src/use-transaction-result.ts index 2d0ffd093..68e5fccd0 100644 --- a/libs/wallet/src/use-transaction-result.ts +++ b/libs/wallet/src/use-transaction-result.ts @@ -5,8 +5,8 @@ import type { Subscription } from 'zen-observable-ts'; import type { TransactionEventSubscription, TransactionEventSubscriptionVariables, -} from './__generated___/TransactionResult'; -import { TransactionEventDocument } from './__generated___/TransactionResult'; +} from './__generated__/TransactionResult'; +import { TransactionEventDocument } from './__generated__/TransactionResult'; export interface TransactionResult { partyId: string; diff --git a/libs/withdraws/src/index.ts b/libs/withdraws/src/index.ts index eb989a97b..24977574f 100644 --- a/libs/withdraws/src/index.ts +++ b/libs/withdraws/src/index.ts @@ -9,5 +9,5 @@ export * from './lib/use-complete-withdraw'; export * from './lib/use-create-withdraw'; export * from './lib/use-verify-withdrawal'; export * from './lib/use-withdrawals'; -export * from './lib/__generated__/Withdrawals'; -export * from './lib/__generated__/WithdrawalFields'; +export * from './lib/__generated__/Withdrawal'; +export * from './lib/__generated__/Erc20Approval'; diff --git a/libs/withdraws/src/lib/Withdraw.graphql b/libs/withdraws/src/lib/Withdraw.graphql deleted file mode 100644 index e1702379f..000000000 --- a/libs/withdraws/src/lib/Withdraw.graphql +++ /dev/null @@ -1,32 +0,0 @@ -query WithdrawPageQuery($partyId: ID!) { - party(id: $partyId) { - id - withdrawals { - id - txHash - } - accounts { - type - balance - asset { - id - symbol - } - } - } - assetsConnection { - edges { - node { - id - symbol - name - decimals - source { - ... on ERC20 { - contractAddress - } - } - } - } - } -} diff --git a/libs/withdraws/src/lib/Withdrawal.graphql b/libs/withdraws/src/lib/Withdrawal.graphql index 59fc3483d..2651370b1 100644 --- a/libs/withdraws/src/lib/Withdrawal.graphql +++ b/libs/withdraws/src/lib/Withdrawal.graphql @@ -1,11 +1,23 @@ +fragment PendingWithdrawal on Withdrawal { + pendingOnForeignChain @client + txHash +} + fragment WithdrawalFields on Withdrawal { id status amount asset { id + name symbol decimals + status + source { + ... on ERC20 { + contractAddress + } + } } createdTimestamp withdrawnTimestamp @@ -21,8 +33,12 @@ fragment WithdrawalFields on Withdrawal { query Withdrawals($partyId: ID!) { party(id: $partyId) { id - withdrawals { - ...WithdrawalFields + withdrawalsConnection { + edges { + node { + ...WithdrawalFields + } + } } } } diff --git a/libs/withdraws/src/lib/__generated__/AssetFields.ts b/libs/withdraws/src/lib/__generated__/AssetFields.ts deleted file mode 100644 index e3a9bd4a6..000000000 --- a/libs/withdraws/src/lib/__generated__/AssetFields.ts +++ /dev/null @@ -1,52 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -// @generated -// This file was automatically generated and should not be edited. - -import { AssetStatus } from "@vegaprotocol/types"; - -// ==================================================== -// GraphQL fragment: AssetFields -// ==================================================== - -export interface AssetFields_source_BuiltinAsset { - __typename: "BuiltinAsset"; -} - -export interface AssetFields_source_ERC20 { - __typename: "ERC20"; - /** - * The address of the ERC20 contract - */ - contractAddress: string; -} - -export type AssetFields_source = AssetFields_source_BuiltinAsset | AssetFields_source_ERC20; - -export interface AssetFields { - __typename: "Asset"; - /** - * The ID of the asset - */ - id: string; - /** - * The symbol of the asset (e.g: GBP) - */ - symbol: string; - /** - * The full name of the asset (e.g: Great British Pound) - */ - name: string; - /** - * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 - */ - decimals: number; - /** - * The status of the asset in the Vega network - */ - status: AssetStatus; - /** - * The origin source of the asset (e.g: an ERC20 asset) - */ - source: AssetFields_source; -} diff --git a/libs/withdraws/src/lib/__generated__/Erc20Approval.ts b/libs/withdraws/src/lib/__generated__/Erc20Approval.ts index 764a38995..f919d989a 100644 --- a/libs/withdraws/src/lib/__generated__/Erc20Approval.ts +++ b/libs/withdraws/src/lib/__generated__/Erc20Approval.ts @@ -1,52 +1,54 @@ -/* tslint:disable */ -/* eslint-disable */ -// @generated -// This file was automatically generated and should not be edited. +import { Schema as Types } from '@vegaprotocol/types'; -// ==================================================== -// GraphQL query operation: Erc20Approval -// ==================================================== +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type Erc20ApprovalQueryVariables = Types.Exact<{ + withdrawalId: Types.Scalars['ID']; +}>; -export interface Erc20Approval_erc20WithdrawalApproval { - __typename: "Erc20WithdrawalApproval"; - /** - * The source asset in the ethereum network - */ - assetSource: string; - /** - * The amount to be withdrawn - */ - amount: string; - /** - * The nonce to be used in the request - */ - nonce: string; - /** - * Signature aggregate from the nodes, in the following format: - * 0x + sig1 + sig2 + ... + sigN - */ - signatures: string; - /** - * The target address which will receive the funds - */ - targetAddress: string; - /** - * Timestamp in seconds for expiry of the approval - */ - expiry: string; - /** - * Timestamp at which the withdrawal was created - */ - creation: string; + +export type Erc20ApprovalQuery = { __typename?: 'Query', erc20WithdrawalApproval?: { __typename?: 'Erc20WithdrawalApproval', assetSource: string, amount: string, nonce: string, signatures: string, targetAddress: string, expiry: string, creation: string } | null }; + + +export const Erc20ApprovalDocument = gql` + query Erc20Approval($withdrawalId: ID!) { + erc20WithdrawalApproval(withdrawalId: $withdrawalId) { + assetSource + amount + nonce + signatures + targetAddress + expiry + creation + } } + `; -export interface Erc20Approval { - /** - * Find an erc20 withdrawal approval using its withdrawal ID - */ - erc20WithdrawalApproval: Erc20Approval_erc20WithdrawalApproval | null; -} - -export interface Erc20ApprovalVariables { - withdrawalId: string; -} +/** + * __useErc20ApprovalQuery__ + * + * To run a query within a React component, call `useErc20ApprovalQuery` and pass it any options that fit your needs. + * When your component renders, `useErc20ApprovalQuery` 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 } = useErc20ApprovalQuery({ + * variables: { + * withdrawalId: // value for 'withdrawalId' + * }, + * }); + */ +export function useErc20ApprovalQuery(baseOptions: Apollo.QueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useQuery(Erc20ApprovalDocument, options); + } +export function useErc20ApprovalLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { + const options = {...defaultOptions, ...baseOptions} + return Apollo.useLazyQuery(Erc20ApprovalDocument, options); + } +export type Erc20ApprovalQueryHookResult = ReturnType; +export type Erc20ApprovalLazyQueryHookResult = ReturnType; +export type Erc20ApprovalQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/libs/withdraws/src/lib/__generated__/PendingWithdrawal.ts b/libs/withdraws/src/lib/__generated__/PendingWithdrawal.ts deleted file mode 100644 index 741bb584e..000000000 --- a/libs/withdraws/src/lib/__generated__/PendingWithdrawal.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -// @generated -// This file was automatically generated and should not be edited. - -// ==================================================== -// GraphQL fragment: PendingWithdrawal -// ==================================================== - -export interface PendingWithdrawal { - __typename: "Withdrawal"; - /** - * Whether or the not the withdrawal is being processed on Ethereum - */ - pendingOnForeignChain: boolean; - /** - * Hash of the transaction on the foreign chain - */ - txHash: string | null; -} diff --git a/libs/withdraws/src/lib/__generated___/Withdrawal.ts b/libs/withdraws/src/lib/__generated__/Withdrawal.ts similarity index 75% rename from libs/withdraws/src/lib/__generated___/Withdrawal.ts rename to libs/withdraws/src/lib/__generated__/Withdrawal.ts index 56e016903..82934fa70 100644 --- a/libs/withdraws/src/lib/__generated___/Withdrawal.ts +++ b/libs/withdraws/src/lib/__generated__/Withdrawal.ts @@ -3,22 +3,30 @@ import { Schema as Types } from '@vegaprotocol/types'; import { gql } from '@apollo/client'; import * as Apollo from '@apollo/client'; const defaultOptions = {} as const; -export type WithdrawalFieldsFragment = { __typename?: 'Withdrawal', id: string, status: Types.WithdrawalStatus, amount: string, createdTimestamp: string, withdrawnTimestamp?: string | null, txHash?: string | null, pendingOnForeignChain: boolean, asset: { __typename?: 'Asset', id: string, symbol: string, decimals: number }, details?: { __typename?: 'Erc20WithdrawalDetails', receiverAddress: string } | null }; +export type PendingWithdrawalFragment = { __typename?: 'Withdrawal', pendingOnForeignChain: boolean, txHash?: string | null }; + +export type WithdrawalFieldsFragment = { __typename?: 'Withdrawal', id: string, status: Types.WithdrawalStatus, amount: string, createdTimestamp: string, withdrawnTimestamp?: string | null, txHash?: string | null, pendingOnForeignChain: boolean, asset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, status: Types.AssetStatus, source: { __typename?: 'BuiltinAsset' } | { __typename?: 'ERC20', contractAddress: string } }, details?: { __typename?: 'Erc20WithdrawalDetails', receiverAddress: string } | null }; export type WithdrawalsQueryVariables = Types.Exact<{ partyId: Types.Scalars['ID']; }>; -export type WithdrawalsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, withdrawals?: Array<{ __typename?: 'Withdrawal', id: string, status: Types.WithdrawalStatus, amount: string, createdTimestamp: string, withdrawnTimestamp?: string | null, txHash?: string | null, pendingOnForeignChain: boolean, asset: { __typename?: 'Asset', id: string, symbol: string, decimals: number }, details?: { __typename?: 'Erc20WithdrawalDetails', receiverAddress: string } | null }> | null } | null }; +export type WithdrawalsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, withdrawalsConnection?: { __typename?: 'WithdrawalsConnection', edges?: Array<{ __typename?: 'WithdrawalEdge', node: { __typename?: 'Withdrawal', id: string, status: Types.WithdrawalStatus, amount: string, createdTimestamp: string, withdrawnTimestamp?: string | null, txHash?: string | null, pendingOnForeignChain: boolean, asset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, status: Types.AssetStatus, source: { __typename?: 'BuiltinAsset' } | { __typename?: 'ERC20', contractAddress: string } }, details?: { __typename?: 'Erc20WithdrawalDetails', receiverAddress: string } | null } } | null> | null } | null } | null }; export type WithdrawalEventSubscriptionVariables = Types.Exact<{ partyId: Types.Scalars['ID']; }>; -export type WithdrawalEventSubscription = { __typename?: 'Subscription', busEvents?: Array<{ __typename?: 'BusEvent', event: { __typename?: 'AccountEvent' } | { __typename?: 'Asset' } | { __typename?: 'AuctionEvent' } | { __typename?: 'Deposit' } | { __typename?: 'LiquidityProvision' } | { __typename?: 'LossSocialization' } | { __typename?: 'MarginLevels' } | { __typename?: 'Market' } | { __typename?: 'MarketData' } | { __typename?: 'MarketEvent' } | { __typename?: 'MarketTick' } | { __typename?: 'NodeSignature' } | { __typename?: 'OracleSpec' } | { __typename?: 'Order' } | { __typename?: 'Party' } | { __typename?: 'PositionResolution' } | { __typename?: 'Proposal' } | { __typename?: 'RiskFactor' } | { __typename?: 'SettleDistressed' } | { __typename?: 'SettlePosition' } | { __typename?: 'TimeUpdate' } | { __typename?: 'Trade' } | { __typename?: 'TransactionResult' } | { __typename?: 'TransferResponses' } | { __typename?: 'Vote' } | { __typename?: 'Withdrawal', id: string, status: Types.WithdrawalStatus, amount: string, createdTimestamp: string, withdrawnTimestamp?: string | null, txHash?: string | null, pendingOnForeignChain: boolean, asset: { __typename?: 'Asset', id: string, symbol: string, decimals: number }, details?: { __typename?: 'Erc20WithdrawalDetails', receiverAddress: string } | null } }> | null }; +export type WithdrawalEventSubscription = { __typename?: 'Subscription', busEvents?: Array<{ __typename?: 'BusEvent', event: { __typename?: 'AccountEvent' } | { __typename?: 'Asset' } | { __typename?: 'AuctionEvent' } | { __typename?: 'Deposit' } | { __typename?: 'LiquidityProvision' } | { __typename?: 'LossSocialization' } | { __typename?: 'MarginLevels' } | { __typename?: 'Market' } | { __typename?: 'MarketData' } | { __typename?: 'MarketEvent' } | { __typename?: 'MarketTick' } | { __typename?: 'NodeSignature' } | { __typename?: 'OracleSpec' } | { __typename?: 'Order' } | { __typename?: 'Party' } | { __typename?: 'PositionResolution' } | { __typename?: 'Proposal' } | { __typename?: 'RiskFactor' } | { __typename?: 'SettleDistressed' } | { __typename?: 'SettlePosition' } | { __typename?: 'TimeUpdate' } | { __typename?: 'Trade' } | { __typename?: 'TransactionResult' } | { __typename?: 'TransferResponses' } | { __typename?: 'Vote' } | { __typename?: 'Withdrawal', id: string, status: Types.WithdrawalStatus, amount: string, createdTimestamp: string, withdrawnTimestamp?: string | null, txHash?: string | null, pendingOnForeignChain: boolean, asset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, status: Types.AssetStatus, source: { __typename?: 'BuiltinAsset' } | { __typename?: 'ERC20', contractAddress: string } }, details?: { __typename?: 'Erc20WithdrawalDetails', receiverAddress: string } | null } }> | null }; +export const PendingWithdrawalFragmentDoc = gql` + fragment PendingWithdrawal on Withdrawal { + pendingOnForeignChain @client + txHash +} + `; export const WithdrawalFieldsFragmentDoc = gql` fragment WithdrawalFields on Withdrawal { id @@ -26,8 +34,15 @@ export const WithdrawalFieldsFragmentDoc = gql` amount asset { id + name symbol decimals + status + source { + ... on ERC20 { + contractAddress + } + } } createdTimestamp withdrawnTimestamp @@ -44,8 +59,12 @@ export const WithdrawalsDocument = gql` query Withdrawals($partyId: ID!) { party(id: $partyId) { id - withdrawals { - ...WithdrawalFields + withdrawalsConnection { + edges { + node { + ...WithdrawalFields + } + } } } } diff --git a/libs/withdraws/src/lib/__generated__/WithdrawalEvent.ts b/libs/withdraws/src/lib/__generated__/WithdrawalEvent.ts deleted file mode 100644 index fcbe8927d..000000000 --- a/libs/withdraws/src/lib/__generated__/WithdrawalEvent.ts +++ /dev/null @@ -1,125 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -// @generated -// This file was automatically generated and should not be edited. - -import { WithdrawalStatus, AssetStatus } from "@vegaprotocol/types"; - -// ==================================================== -// GraphQL subscription operation: WithdrawalEvent -// ==================================================== - -export interface WithdrawalEvent_busEvents_event_TimeUpdate { - __typename: "TimeUpdate" | "MarketEvent" | "TransferResponses" | "PositionResolution" | "Order" | "Trade" | "AccountEvent" | "Party" | "MarginLevels" | "Proposal" | "Vote" | "MarketData" | "NodeSignature" | "LossSocialization" | "SettlePosition" | "Market" | "Asset" | "MarketTick" | "SettleDistressed" | "AuctionEvent" | "RiskFactor" | "Deposit" | "OracleSpec" | "LiquidityProvision" | "TransactionResult"; -} - -export interface WithdrawalEvent_busEvents_event_Withdrawal_asset_source_BuiltinAsset { - __typename: "BuiltinAsset"; -} - -export interface WithdrawalEvent_busEvents_event_Withdrawal_asset_source_ERC20 { - __typename: "ERC20"; - /** - * The address of the ERC20 contract - */ - contractAddress: string; -} - -export type WithdrawalEvent_busEvents_event_Withdrawal_asset_source = WithdrawalEvent_busEvents_event_Withdrawal_asset_source_BuiltinAsset | WithdrawalEvent_busEvents_event_Withdrawal_asset_source_ERC20; - -export interface WithdrawalEvent_busEvents_event_Withdrawal_asset { - __typename: "Asset"; - /** - * The ID of the asset - */ - id: string; - /** - * The full name of the asset (e.g: Great British Pound) - */ - name: string; - /** - * The symbol of the asset (e.g: GBP) - */ - symbol: string; - /** - * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 - */ - decimals: number; - /** - * The status of the asset in the Vega network - */ - status: AssetStatus; - /** - * The origin source of the asset (e.g: an ERC20 asset) - */ - source: WithdrawalEvent_busEvents_event_Withdrawal_asset_source; -} - -export interface WithdrawalEvent_busEvents_event_Withdrawal_details { - __typename: "Erc20WithdrawalDetails"; - /** - * The ethereum address of the receiver of the asset funds - */ - receiverAddress: string; -} - -export interface WithdrawalEvent_busEvents_event_Withdrawal { - __typename: "Withdrawal"; - /** - * The Vega internal ID of the withdrawal - */ - id: string; - /** - * The current status of the withdrawal - */ - status: WithdrawalStatus; - /** - * The amount to be withdrawn - */ - amount: string; - /** - * The asset to be withdrawn - */ - asset: WithdrawalEvent_busEvents_event_Withdrawal_asset; - /** - * RFC3339Nano time at which the withdrawal was created - */ - createdTimestamp: string; - /** - * RFC3339Nano time at which the withdrawal was finalised - */ - withdrawnTimestamp: string | null; - /** - * Hash of the transaction on the foreign chain - */ - txHash: string | null; - /** - * Foreign chain specific details about the withdrawal - */ - details: WithdrawalEvent_busEvents_event_Withdrawal_details | null; - /** - * Whether or the not the withdrawal is being processed on Ethereum - */ - pendingOnForeignChain: boolean; -} - -export type WithdrawalEvent_busEvents_event = WithdrawalEvent_busEvents_event_TimeUpdate | WithdrawalEvent_busEvents_event_Withdrawal; - -export interface WithdrawalEvent_busEvents { - __typename: "BusEvent"; - /** - * The payload - the wrapped event - */ - event: WithdrawalEvent_busEvents_event; -} - -export interface WithdrawalEvent { - /** - * Subscribe to event data from the event bus - */ - busEvents: WithdrawalEvent_busEvents[] | null; -} - -export interface WithdrawalEventVariables { - partyId: string; -} diff --git a/libs/withdraws/src/lib/__generated__/WithdrawalFields.ts b/libs/withdraws/src/lib/__generated__/WithdrawalFields.ts deleted file mode 100644 index 8fe4e6bcb..000000000 --- a/libs/withdraws/src/lib/__generated__/WithdrawalFields.ts +++ /dev/null @@ -1,100 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -// @generated -// This file was automatically generated and should not be edited. - -import { WithdrawalStatus, AssetStatus } from "@vegaprotocol/types"; - -// ==================================================== -// GraphQL fragment: WithdrawalFields -// ==================================================== - -export interface WithdrawalFields_asset_source_BuiltinAsset { - __typename: "BuiltinAsset"; -} - -export interface WithdrawalFields_asset_source_ERC20 { - __typename: "ERC20"; - /** - * The address of the ERC20 contract - */ - contractAddress: string; -} - -export type WithdrawalFields_asset_source = WithdrawalFields_asset_source_BuiltinAsset | WithdrawalFields_asset_source_ERC20; - -export interface WithdrawalFields_asset { - __typename: "Asset"; - /** - * The ID of the asset - */ - id: string; - /** - * The full name of the asset (e.g: Great British Pound) - */ - name: string; - /** - * The symbol of the asset (e.g: GBP) - */ - symbol: string; - /** - * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 - */ - decimals: number; - /** - * The status of the asset in the Vega network - */ - status: AssetStatus; - /** - * The origin source of the asset (e.g: an ERC20 asset) - */ - source: WithdrawalFields_asset_source; -} - -export interface WithdrawalFields_details { - __typename: "Erc20WithdrawalDetails"; - /** - * The ethereum address of the receiver of the asset funds - */ - receiverAddress: string; -} - -export interface WithdrawalFields { - __typename: "Withdrawal"; - /** - * The Vega internal ID of the withdrawal - */ - id: string; - /** - * The current status of the withdrawal - */ - status: WithdrawalStatus; - /** - * The amount to be withdrawn - */ - amount: string; - /** - * The asset to be withdrawn - */ - asset: WithdrawalFields_asset; - /** - * RFC3339Nano time at which the withdrawal was created - */ - createdTimestamp: string; - /** - * RFC3339Nano time at which the withdrawal was finalised - */ - withdrawnTimestamp: string | null; - /** - * Hash of the transaction on the foreign chain - */ - txHash: string | null; - /** - * Foreign chain specific details about the withdrawal - */ - details: WithdrawalFields_details | null; - /** - * Whether or the not the withdrawal is being processed on Ethereum - */ - pendingOnForeignChain: boolean; -} diff --git a/libs/withdraws/src/lib/__generated__/Withdrawals.ts b/libs/withdraws/src/lib/__generated__/Withdrawals.ts deleted file mode 100644 index 7ae3b2960..000000000 --- a/libs/withdraws/src/lib/__generated__/Withdrawals.ts +++ /dev/null @@ -1,139 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ -// @generated -// This file was automatically generated and should not be edited. - -import { WithdrawalStatus, AssetStatus } from "@vegaprotocol/types"; - -// ==================================================== -// GraphQL query operation: Withdrawals -// ==================================================== - -export interface Withdrawals_party_withdrawalsConnection_edges_node_asset_source_BuiltinAsset { - __typename: "BuiltinAsset"; -} - -export interface Withdrawals_party_withdrawalsConnection_edges_node_asset_source_ERC20 { - __typename: "ERC20"; - /** - * The address of the ERC20 contract - */ - contractAddress: string; -} - -export type Withdrawals_party_withdrawalsConnection_edges_node_asset_source = Withdrawals_party_withdrawalsConnection_edges_node_asset_source_BuiltinAsset | Withdrawals_party_withdrawalsConnection_edges_node_asset_source_ERC20; - -export interface Withdrawals_party_withdrawalsConnection_edges_node_asset { - __typename: "Asset"; - /** - * The ID of the asset - */ - id: string; - /** - * The full name of the asset (e.g: Great British Pound) - */ - name: string; - /** - * The symbol of the asset (e.g: GBP) - */ - symbol: string; - /** - * The precision of the asset. Should match the decimal precision of the asset on its native chain, e.g: for ERC20 assets, it is often 18 - */ - decimals: number; - /** - * The status of the asset in the Vega network - */ - status: AssetStatus; - /** - * The origin source of the asset (e.g: an ERC20 asset) - */ - source: Withdrawals_party_withdrawalsConnection_edges_node_asset_source; -} - -export interface Withdrawals_party_withdrawalsConnection_edges_node_details { - __typename: "Erc20WithdrawalDetails"; - /** - * The ethereum address of the receiver of the asset funds - */ - receiverAddress: string; -} - -export interface Withdrawals_party_withdrawalsConnection_edges_node { - __typename: "Withdrawal"; - /** - * The Vega internal ID of the withdrawal - */ - id: string; - /** - * The current status of the withdrawal - */ - status: WithdrawalStatus; - /** - * The amount to be withdrawn - */ - amount: string; - /** - * The asset to be withdrawn - */ - asset: Withdrawals_party_withdrawalsConnection_edges_node_asset; - /** - * RFC3339Nano time at which the withdrawal was created - */ - createdTimestamp: string; - /** - * RFC3339Nano time at which the withdrawal was finalised - */ - withdrawnTimestamp: string | null; - /** - * Hash of the transaction on the foreign chain - */ - txHash: string | null; - /** - * Foreign chain specific details about the withdrawal - */ - details: Withdrawals_party_withdrawalsConnection_edges_node_details | null; - /** - * Whether or the not the withdrawal is being processed on Ethereum - */ - pendingOnForeignChain: boolean; -} - -export interface Withdrawals_party_withdrawalsConnection_edges { - __typename: "WithdrawalEdge"; - /** - * The withdrawal - */ - node: Withdrawals_party_withdrawalsConnection_edges_node; -} - -export interface Withdrawals_party_withdrawalsConnection { - __typename: "WithdrawalsConnection"; - /** - * The withdrawals - */ - edges: (Withdrawals_party_withdrawalsConnection_edges | null)[] | null; -} - -export interface Withdrawals_party { - __typename: "Party"; - /** - * Party identifier - */ - id: string; - /** - * The list of all withdrawals initiated by the party - */ - withdrawalsConnection: Withdrawals_party_withdrawalsConnection | null; -} - -export interface Withdrawals { - /** - * An entity that is trading on the Vega network - */ - party: Withdrawals_party | null; -} - -export interface WithdrawalsVariables { - partyId: string; -} diff --git a/libs/withdraws/src/lib/__generated___/Erc20Approval.ts b/libs/withdraws/src/lib/__generated___/Erc20Approval.ts deleted file mode 100644 index f919d989a..000000000 --- a/libs/withdraws/src/lib/__generated___/Erc20Approval.ts +++ /dev/null @@ -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 Erc20ApprovalQueryVariables = Types.Exact<{ - withdrawalId: Types.Scalars['ID']; -}>; - - -export type Erc20ApprovalQuery = { __typename?: 'Query', erc20WithdrawalApproval?: { __typename?: 'Erc20WithdrawalApproval', assetSource: string, amount: string, nonce: string, signatures: string, targetAddress: string, expiry: string, creation: string } | null }; - - -export const Erc20ApprovalDocument = gql` - query Erc20Approval($withdrawalId: ID!) { - erc20WithdrawalApproval(withdrawalId: $withdrawalId) { - assetSource - amount - nonce - signatures - targetAddress - expiry - creation - } -} - `; - -/** - * __useErc20ApprovalQuery__ - * - * To run a query within a React component, call `useErc20ApprovalQuery` and pass it any options that fit your needs. - * When your component renders, `useErc20ApprovalQuery` 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 } = useErc20ApprovalQuery({ - * variables: { - * withdrawalId: // value for 'withdrawalId' - * }, - * }); - */ -export function useErc20ApprovalQuery(baseOptions: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(Erc20ApprovalDocument, options); - } -export function useErc20ApprovalLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(Erc20ApprovalDocument, options); - } -export type Erc20ApprovalQueryHookResult = ReturnType; -export type Erc20ApprovalLazyQueryHookResult = ReturnType; -export type Erc20ApprovalQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/libs/withdraws/src/lib/__generated___/Withdraw.ts b/libs/withdraws/src/lib/__generated___/Withdraw.ts deleted file mode 100644 index 31c2972c3..000000000 --- a/libs/withdraws/src/lib/__generated___/Withdraw.ts +++ /dev/null @@ -1,75 +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 WithdrawPageQueryQueryVariables = Types.Exact<{ - partyId: Types.Scalars['ID']; -}>; - - -export type WithdrawPageQueryQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, withdrawals?: Array<{ __typename?: 'Withdrawal', id: string, txHash?: string | null }> | null, accounts?: Array<{ __typename?: 'AccountBalance', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', id: string, symbol: string } }> | null } | null, assetsConnection?: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, symbol: string, name: string, decimals: number, source: { __typename?: 'BuiltinAsset' } | { __typename?: 'ERC20', contractAddress: string } } } | null> | null } | null }; - - -export const WithdrawPageQueryDocument = gql` - query WithdrawPageQuery($partyId: ID!) { - party(id: $partyId) { - id - withdrawals { - id - txHash - } - accounts { - type - balance - asset { - id - symbol - } - } - } - assetsConnection { - edges { - node { - id - symbol - name - decimals - source { - ... on ERC20 { - contractAddress - } - } - } - } - } -} - `; - -/** - * __useWithdrawPageQueryQuery__ - * - * To run a query within a React component, call `useWithdrawPageQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useWithdrawPageQueryQuery` 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 } = useWithdrawPageQueryQuery({ - * variables: { - * partyId: // value for 'partyId' - * }, - * }); - */ -export function useWithdrawPageQueryQuery(baseOptions: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(WithdrawPageQueryDocument, options); - } -export function useWithdrawPageQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(WithdrawPageQueryDocument, options); - } -export type WithdrawPageQueryQueryHookResult = ReturnType; -export type WithdrawPageQueryLazyQueryHookResult = ReturnType; -export type WithdrawPageQueryQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/libs/withdraws/src/lib/pending-withdrawals-table.spec.tsx b/libs/withdraws/src/lib/pending-withdrawals-table.spec.tsx index 3c6f4ef41..f36a3db22 100644 --- a/libs/withdraws/src/lib/pending-withdrawals-table.spec.tsx +++ b/libs/withdraws/src/lib/pending-withdrawals-table.spec.tsx @@ -5,13 +5,13 @@ import { CompleteCell } from './pending-withdrawals-table'; import { PendingWithdrawalsTable } from './pending-withdrawals-table'; import { getTimeFormat } from '@vegaprotocol/react-helpers'; import type { TypedDataAgGrid } from '@vegaprotocol/ui-toolkit'; -import type { WithdrawalFields } from './__generated__/WithdrawalFields'; +import type { WithdrawalFieldsFragment } from './__generated__/Withdrawal'; jest.mock('@web3-react/core', () => ({ useWeb3React: () => ({ provider: undefined }), })); -const generateTable = (props: TypedDataAgGrid) => ( +const generateTable = (props: TypedDataAgGrid) => ( diff --git a/libs/withdraws/src/lib/pending-withdrawals-table.tsx b/libs/withdraws/src/lib/pending-withdrawals-table.tsx index 9955531e2..8e381dd6b 100644 --- a/libs/withdraws/src/lib/pending-withdrawals-table.tsx +++ b/libs/withdraws/src/lib/pending-withdrawals-table.tsx @@ -22,12 +22,12 @@ import { } from '@vegaprotocol/ui-toolkit'; import { useEnvironment } from '@vegaprotocol/environment'; import { useCompleteWithdraw } from './use-complete-withdraw'; -import type { WithdrawalFields } from './__generated__/WithdrawalFields'; +import type { WithdrawalFieldsFragment } from './__generated__/Withdrawal'; import type { VerifyState } from './use-verify-withdrawal'; import { ApprovalStatus, useVerifyWithdrawal } from './use-verify-withdrawal'; export const PendingWithdrawalsTable = ( - props: TypedDataAgGrid + props: TypedDataAgGrid ) => { const { ETHERSCAN_URL } = useEnvironment(); const { @@ -60,7 +60,7 @@ export const PendingWithdrawalsTable = ( valueFormatter={({ value, data, - }: VegaValueFormatterParams) => { + }: VegaValueFormatterParams) => { return isNumeric(value) && data?.asset ? addDecimalsFormatNumber(value, data.asset.decimals) : null; @@ -74,7 +74,7 @@ export const PendingWithdrawalsTable = ( value, valueFormatted, }: VegaICellRendererParams< - WithdrawalFields, + WithdrawalFieldsFragment, 'details.receiverAddress' > & { ethUrl: string; @@ -92,7 +92,7 @@ export const PendingWithdrawalsTable = ( valueFormatter={({ value, }: VegaValueFormatterParams< - WithdrawalFields, + WithdrawalFieldsFragment, 'details.receiverAddress' >) => { if (!value) return '-'; @@ -105,7 +105,7 @@ export const PendingWithdrawalsTable = ( valueFormatter={({ value, }: VegaValueFormatterParams< - WithdrawalFields, + WithdrawalFieldsFragment, 'createdTimestamp' >) => { return value ? getDateTimeFormat().format(new Date(value)) : ''; @@ -116,7 +116,7 @@ export const PendingWithdrawalsTable = ( field="status" flex={2} cellRendererParams={{ - complete: async (withdrawal: WithdrawalFields) => { + complete: async (withdrawal: WithdrawalFieldsFragment) => { const verified = await verify(withdrawal); if (!verified) { @@ -149,8 +149,8 @@ export const PendingWithdrawalsTable = ( }; export type CompleteCellProps = { - data: WithdrawalFields; - complete: (withdrawal: WithdrawalFields) => void; + data: WithdrawalFieldsFragment; + complete: (withdrawal: WithdrawalFieldsFragment) => void; }; export const CompleteCell = ({ data, complete }: CompleteCellProps) => ( +
+
+ ); +}); diff --git a/libs/react-helpers/src/lib/grid/index.ts b/libs/react-helpers/src/lib/grid/index.ts index c71250dbb..27c90efc8 100644 --- a/libs/react-helpers/src/lib/grid/index.ts +++ b/libs/react-helpers/src/lib/grid/index.ts @@ -6,3 +6,5 @@ export * from './price-flash-cell'; export * from './size'; export * from './summary-rows'; export * from './vol-cell'; +export * from './set-filter'; +export * from './date-range-filter'; diff --git a/libs/react-helpers/src/lib/grid/set-filter.tsx b/libs/react-helpers/src/lib/grid/set-filter.tsx new file mode 100644 index 000000000..89392a5b6 --- /dev/null +++ b/libs/react-helpers/src/lib/grid/set-filter.tsx @@ -0,0 +1,91 @@ +import type { ChangeEvent } from 'react'; +import React, { + forwardRef, + useEffect, + useImperativeHandle, + useState, +} from 'react'; +import type { IDoesFilterPassParams, IFilterParams } from 'ag-grid-community'; + +export const SetFilter = forwardRef((props: IFilterParams, ref) => { + const [value, setValue] = useState([]); + + // expose AG Grid Filter Lifecycle callbacks + useImperativeHandle(ref, () => { + return { + doesFilterPass(params: IDoesFilterPassParams) { + const { api, colDef, column, columnApi, context } = props; + const { node } = params; + return ( + props.valueGetter({ + api, + colDef, + column, + columnApi, + context, + data: node.data, + getValue: (field) => node.data[field], + node, + }) === value + ); + }, + + isFilterActive() { + return value.length !== 0; + }, + + getModel() { + if (!this.isFilterActive()) { + return null; + } + + return { value }; + }, + + setModel(model?: { value: string[] } | null) { + setValue(!model ? [] : model.value); + }, + }; + }); + + const onChange = (event: ChangeEvent) => { + setValue( + event.target.checked + ? [...value, event.target.value] + : value.filter((v) => v !== event.target.value) + ); + }; + + useEffect(() => { + props.filterChangedCallback(); + }, [value]); //eslint-disable-line react-hooks/exhaustive-deps + + return ( +
+
+ {Object.keys(props.colDef.filterParams.set).map((key) => ( + + ))} +
+
+ +
+
+ ); +}); diff --git a/libs/ui-toolkit/src/components/async-renderer/async-renderer.tsx b/libs/ui-toolkit/src/components/async-renderer/async-renderer.tsx index 8690b36ae..0de5a49be 100644 --- a/libs/ui-toolkit/src/components/async-renderer/async-renderer.tsx +++ b/libs/ui-toolkit/src/components/async-renderer/async-renderer.tsx @@ -11,6 +11,7 @@ interface AsyncRendererProps { noDataMessage?: string; children?: ReactNode | null; render?: (data: T) => ReactNode; + noDataCondition?(data: T): boolean; } export function AsyncRenderer({ @@ -20,6 +21,7 @@ export function AsyncRenderer({ errorMessage, data, noDataMessage, + noDataCondition, children, render, }: AsyncRendererProps) { @@ -37,7 +39,7 @@ export function AsyncRenderer({ return {loadingMessage ? loadingMessage : t('Loading...')}; } - if (!data) { + if (!data || (noDataCondition && noDataCondition(data))) { return {noDataMessage ? noDataMessage : t('No data')}; } // eslint-disable-next-line react/jsx-no-useless-fragment From e0b2fb9bf3b50836055c11b669e3b102fc96bdbb Mon Sep 17 00:00:00 2001 From: "m.ray" <16125548+MadalinaRaicu@users.noreply.github.com> Date: Thu, 10 Nov 2022 20:09:32 +0000 Subject: [PATCH 29/34] fix: deal ticket fees value formatting (#2014) * fix: #2002 use asset dp for estimate order * Update libs/deal-ticket/src/hooks/use-fee-deal-ticket-details.tsx * fix: fix linting issue for format value with market dp --- .../src/hooks/use-fee-deal-ticket-details.tsx | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/libs/deal-ticket/src/hooks/use-fee-deal-ticket-details.tsx b/libs/deal-ticket/src/hooks/use-fee-deal-ticket-details.tsx index 3b6b8d759..9d38831d7 100644 --- a/libs/deal-ticket/src/hooks/use-fee-deal-ticket-details.tsx +++ b/libs/deal-ticket/src/hooks/use-fee-deal-ticket-details.tsx @@ -96,21 +96,35 @@ export const getFeeDetailsValues = ({ estCloseOut, market, }: FeeDetails) => { - const formatValue = (value: string | number | null | undefined): string => { + const formatValueWithMarketDp = ( + value: string | number | null | undefined + ): string => { return value && !isNaN(Number(value)) ? normalizeFormatNumber(value, market.decimalPlaces) : '-'; }; + const formatValueWithAssetDp = ( + value: string | number | null | undefined + ): string => { + return value && !isNaN(Number(value)) + ? normalizeFormatNumber( + value, + market.tradableInstrument.instrument.product.settlementAsset.decimals + ) + : '-'; + }; return [ { label: t('Notional'), - value: formatValue(notionalSize), + value: formatValueWithMarketDp(notionalSize), quoteName, labelDescription: NOTIONAL_SIZE_TOOLTIP_TEXT, }, { label: t('Fees'), - value: estMargin?.totalFees && `~${formatValue(estMargin?.totalFees)}`, + value: + estMargin?.totalFees && + `~${formatValueWithAssetDp(estMargin?.totalFees)}`, labelDescription: ( <> @@ -129,13 +143,14 @@ export const getFeeDetailsValues = ({ }, { label: t('Margin'), - value: estMargin?.margin && `~${formatValue(estMargin?.margin)}`, + value: + estMargin?.margin && `~${formatValueWithAssetDp(estMargin?.margin)}`, quoteName, labelDescription: EST_MARGIN_TOOLTIP_TEXT, }, { label: t('Liquidation'), - value: estCloseOut && `~${formatValue(estCloseOut)}`, + value: estCloseOut && `~${formatValueWithMarketDp(estCloseOut)}`, quoteName, labelDescription: EST_CLOSEOUT_TOOLTIP_TEXT, }, From 0a3a7467d43e6fa90ce1775c22a10f90b826e0a4 Mon Sep 17 00:00:00 2001 From: botond <105208209+notbot00@users.noreply.github.com> Date: Fri, 11 Nov 2022 00:10:37 +0100 Subject: [PATCH 30/34] fix: remove new typegen files from console-lite to fix typegen errors (#2022) --- .../src/app/routes/assets/Assets.graphql | 27 --- .../routes/assets/__generated___/Assets.ts | 67 ------- .../app/routes/governance/Proposals.graphql | 74 -------- .../governance/__generated___/Proposals.ts | 114 ------------ .../src/app/routes/markets/Markets.graphql | 133 -------------- .../routes/markets/__generated___/Markets.ts | 173 ------------------ .../app/routes/oracles/OracleSpecs.graphql | 82 --------- .../oracles/__generated___/OracleSpecs.ts | 122 ------------ .../app/routes/parties/PartyAssets.graphql | 32 ---- .../parties/__generated___/PartyAssets.ts | 75 -------- .../src/app/routes/validators/Nodes.graphql | 22 --- .../routes/validators/__generated___/Nodes.ts | 62 ------- 12 files changed, 983 deletions(-) delete mode 100644 apps/explorer/src/app/routes/assets/Assets.graphql delete mode 100644 apps/explorer/src/app/routes/assets/__generated___/Assets.ts delete mode 100644 apps/explorer/src/app/routes/governance/Proposals.graphql delete mode 100644 apps/explorer/src/app/routes/governance/__generated___/Proposals.ts delete mode 100644 apps/explorer/src/app/routes/markets/Markets.graphql delete mode 100644 apps/explorer/src/app/routes/markets/__generated___/Markets.ts delete mode 100644 apps/explorer/src/app/routes/oracles/OracleSpecs.graphql delete mode 100644 apps/explorer/src/app/routes/oracles/__generated___/OracleSpecs.ts delete mode 100644 apps/explorer/src/app/routes/parties/PartyAssets.graphql delete mode 100644 apps/explorer/src/app/routes/parties/__generated___/PartyAssets.ts delete mode 100644 apps/explorer/src/app/routes/validators/Nodes.graphql delete mode 100644 apps/explorer/src/app/routes/validators/__generated___/Nodes.ts diff --git a/apps/explorer/src/app/routes/assets/Assets.graphql b/apps/explorer/src/app/routes/assets/Assets.graphql deleted file mode 100644 index 00e113473..000000000 --- a/apps/explorer/src/app/routes/assets/Assets.graphql +++ /dev/null @@ -1,27 +0,0 @@ -query AssetsQuery { - assetsConnection { - edges { - node { - id - name - symbol - decimals - source { - ... on ERC20 { - contractAddress - } - ... on BuiltinAsset { - maxFaucetAmountMint - } - } - infrastructureFeeAccount { - type - balance - market { - id - } - } - } - } - } -} diff --git a/apps/explorer/src/app/routes/assets/__generated___/Assets.ts b/apps/explorer/src/app/routes/assets/__generated___/Assets.ts deleted file mode 100644 index d38d54341..000000000 --- a/apps/explorer/src/app/routes/assets/__generated___/Assets.ts +++ /dev/null @@ -1,67 +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 AssetsQueryQueryVariables = Types.Exact<{ [key: string]: never; }>; - - -export type AssetsQueryQuery = { __typename?: 'Query', assetsConnection?: { __typename?: 'AssetsConnection', edges?: Array<{ __typename?: 'AssetEdge', node: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string }, infrastructureFeeAccount?: { __typename?: 'AccountBalance', type: Types.AccountType, balance: string, market?: { __typename?: 'Market', id: string } | null } | null } } | null> | null } | null }; - - -export const AssetsQueryDocument = gql` - query AssetsQuery { - assetsConnection { - edges { - node { - id - name - symbol - decimals - source { - ... on ERC20 { - contractAddress - } - ... on BuiltinAsset { - maxFaucetAmountMint - } - } - infrastructureFeeAccount { - type - balance - market { - id - } - } - } - } - } -} - `; - -/** - * __useAssetsQueryQuery__ - * - * To run a query within a React component, call `useAssetsQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useAssetsQueryQuery` 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 } = useAssetsQueryQuery({ - * variables: { - * }, - * }); - */ -export function useAssetsQueryQuery(baseOptions?: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(AssetsQueryDocument, options); - } -export function useAssetsQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(AssetsQueryDocument, options); - } -export type AssetsQueryQueryHookResult = ReturnType; -export type AssetsQueryLazyQueryHookResult = ReturnType; -export type AssetsQueryQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/explorer/src/app/routes/governance/Proposals.graphql b/apps/explorer/src/app/routes/governance/Proposals.graphql deleted file mode 100644 index 2050e56c8..000000000 --- a/apps/explorer/src/app/routes/governance/Proposals.graphql +++ /dev/null @@ -1,74 +0,0 @@ -query ProposalsQuery { - proposals { - id - reference - state - datetime - rejectionReason - party { - id - } - terms { - closingDatetime - enactmentDatetime - change { - ... on NewMarket { - instrument { - name - } - } - ... on UpdateMarket { - marketId - } - ... on NewAsset { - __typename - symbol - source { - ... on BuiltinAsset { - maxFaucetAmountMint - } - ... on ERC20 { - contractAddress - } - } - } - ... on UpdateNetworkParameter { - networkParameter { - key - value - } - } - } - } - votes { - yes { - totalTokens - totalNumber - votes { - value - party { - id - stakingSummary { - currentStakeAvailable - } - } - datetime - } - } - no { - totalTokens - totalNumber - votes { - value - party { - id - stakingSummary { - currentStakeAvailable - } - } - datetime - } - } - } - } -} diff --git a/apps/explorer/src/app/routes/governance/__generated___/Proposals.ts b/apps/explorer/src/app/routes/governance/__generated___/Proposals.ts deleted file mode 100644 index 7686cfd92..000000000 --- a/apps/explorer/src/app/routes/governance/__generated___/Proposals.ts +++ /dev/null @@ -1,114 +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 ProposalsQueryQueryVariables = Types.Exact<{ [key: string]: never; }>; - - -export type ProposalsQueryQuery = { __typename?: 'Query', proposals?: Array<{ __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: string, rejectionReason?: Types.ProposalRejectionReason | null, party: { __typename?: 'Party', id: string }, terms: { __typename?: 'ProposalTerms', closingDatetime: string, enactmentDatetime?: string | null, change: { __typename: 'NewAsset', symbol: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', instrument: { __typename?: 'InstrumentConfiguration', name: string } } | { __typename?: 'UpdateAsset' } | { __typename?: 'UpdateMarket', marketId: string } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, votes?: Array<{ __typename?: 'Vote', value: Types.VoteValue, datetime: string, party: { __typename?: 'Party', id: string, stakingSummary: { __typename?: 'StakingSummary', currentStakeAvailable: string } } }> | null }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, votes?: Array<{ __typename?: 'Vote', value: Types.VoteValue, datetime: string, party: { __typename?: 'Party', id: string, stakingSummary: { __typename?: 'StakingSummary', currentStakeAvailable: string } } }> | null } } }> | null }; - - -export const ProposalsQueryDocument = gql` - query ProposalsQuery { - proposals { - id - reference - state - datetime - rejectionReason - party { - id - } - terms { - closingDatetime - enactmentDatetime - change { - ... on NewMarket { - instrument { - name - } - } - ... on UpdateMarket { - marketId - } - ... on NewAsset { - __typename - symbol - source { - ... on BuiltinAsset { - maxFaucetAmountMint - } - ... on ERC20 { - contractAddress - } - } - } - ... on UpdateNetworkParameter { - networkParameter { - key - value - } - } - } - } - votes { - yes { - totalTokens - totalNumber - votes { - value - party { - id - stakingSummary { - currentStakeAvailable - } - } - datetime - } - } - no { - totalTokens - totalNumber - votes { - value - party { - id - stakingSummary { - currentStakeAvailable - } - } - datetime - } - } - } - } -} - `; - -/** - * __useProposalsQueryQuery__ - * - * To run a query within a React component, call `useProposalsQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useProposalsQueryQuery` 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 } = useProposalsQueryQuery({ - * variables: { - * }, - * }); - */ -export function useProposalsQueryQuery(baseOptions?: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(ProposalsQueryDocument, options); - } -export function useProposalsQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(ProposalsQueryDocument, options); - } -export type ProposalsQueryQueryHookResult = ReturnType; -export type ProposalsQueryLazyQueryHookResult = ReturnType; -export type ProposalsQueryQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/explorer/src/app/routes/markets/Markets.graphql b/apps/explorer/src/app/routes/markets/Markets.graphql deleted file mode 100644 index d656c739c..000000000 --- a/apps/explorer/src/app/routes/markets/Markets.graphql +++ /dev/null @@ -1,133 +0,0 @@ -query MarketsQuery { - markets { - id - fees { - factors { - makerFee - infrastructureFee - liquidityFee - } - } - tradableInstrument { - instrument { - name - metadata { - tags - } - id - code - product { - ... on Future { - settlementAsset { - id - name - decimals - globalRewardPoolAccount { - balance - } - } - } - } - } - riskModel { - ... on LogNormalRiskModel { - tau - riskAversionParameter - params { - r - sigma - mu - } - } - ... on SimpleRiskModel { - params { - factorLong - factorShort - } - } - } - marginCalculator { - scalingFactors { - searchLevel - initialMargin - collateralRelease - } - } - } - decimalPlaces - openingAuction { - durationSecs - volume - } - priceMonitoringSettings { - parameters { - triggers { - horizonSecs - probability - auctionExtensionSecs - } - } - } - liquidityMonitoringParameters { - triggeringRatio - targetStakeParameters { - timeWindow - scalingFactor - } - } - tradingMode - state - proposal { - id - } - state - accounts { - asset { - id - name - } - balance - type - } - data { - markPrice - bestBidPrice - bestBidVolume - bestOfferPrice - bestOfferVolume - bestStaticBidPrice - bestStaticBidVolume - bestStaticOfferPrice - bestStaticOfferVolume - midPrice - staticMidPrice - timestamp - openInterest - auctionEnd - auctionStart - indicativePrice - indicativeVolume - trigger - extensionTrigger - targetStake - suppliedStake - priceMonitoringBounds { - minValidPrice - maxValidPrice - trigger { - auctionExtensionSecs - probability - } - referencePrice - } - marketValueProxy - liquidityProviderFeeShare { - party { - id - } - equityLikeShare - averageEntryValuation - } - } - } -} diff --git a/apps/explorer/src/app/routes/markets/__generated___/Markets.ts b/apps/explorer/src/app/routes/markets/__generated___/Markets.ts deleted file mode 100644 index 4ed804377..000000000 --- a/apps/explorer/src/app/routes/markets/__generated___/Markets.ts +++ /dev/null @@ -1,173 +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 MarketsQueryQueryVariables = Types.Exact<{ [key: string]: never; }>; - - -export type MarketsQueryQuery = { __typename?: 'Query', markets?: Array<{ __typename?: 'Market', id: string, decimalPlaces: number, tradingMode: Types.MarketTradingMode, state: Types.MarketState, fees: { __typename?: 'Fees', factors: { __typename?: 'FeeFactors', makerFee: string, infrastructureFee: string, liquidityFee: string } }, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string, id: string, code: string, metadata: { __typename?: 'InstrumentMetadata', tags?: Array | null }, product: { __typename?: 'Future', settlementAsset: { __typename?: 'Asset', id: string, name: string, decimals: number, globalRewardPoolAccount?: { __typename?: 'AccountBalance', balance: string } | null } } }, riskModel: { __typename?: 'LogNormalRiskModel', tau: number, riskAversionParameter: number, params: { __typename?: 'LogNormalModelParams', r: number, sigma: number, mu: number } } | { __typename?: 'SimpleRiskModel', params: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } }, marginCalculator?: { __typename?: 'MarginCalculator', scalingFactors: { __typename?: 'ScalingFactors', searchLevel: number, initialMargin: number, collateralRelease: number } } | null }, openingAuction: { __typename?: 'AuctionDuration', durationSecs: number, volume: number }, priceMonitoringSettings: { __typename?: 'PriceMonitoringSettings', parameters?: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null } | null }, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: number, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, proposal?: { __typename?: 'Proposal', id?: string | null } | null, accounts?: Array<{ __typename?: 'AccountBalance', balance: string, type: Types.AccountType, asset: { __typename?: 'Asset', id: string, name: string } }> | null, data?: { __typename?: 'MarketData', markPrice: string, bestBidPrice: string, bestBidVolume: string, bestOfferPrice: string, bestOfferVolume: string, bestStaticBidPrice: string, bestStaticBidVolume: string, bestStaticOfferPrice: string, bestStaticOfferVolume: string, midPrice: string, staticMidPrice: string, timestamp: string, openInterest: string, auctionEnd?: string | null, auctionStart?: string | null, indicativePrice: string, indicativeVolume: string, trigger: Types.AuctionTrigger, extensionTrigger: Types.AuctionTrigger, targetStake?: string | null, suppliedStake?: string | null, marketValueProxy: string, priceMonitoringBounds?: Array<{ __typename?: 'PriceMonitoringBounds', minValidPrice: string, maxValidPrice: string, referencePrice: string, trigger: { __typename?: 'PriceMonitoringTrigger', auctionExtensionSecs: number, probability: number } }> | null, liquidityProviderFeeShare?: Array<{ __typename?: 'LiquidityProviderFeeShare', equityLikeShare: string, averageEntryValuation: string, party: { __typename?: 'Party', id: string } }> | null } | null }> | null }; - - -export const MarketsQueryDocument = gql` - query MarketsQuery { - markets { - id - fees { - factors { - makerFee - infrastructureFee - liquidityFee - } - } - tradableInstrument { - instrument { - name - metadata { - tags - } - id - code - product { - ... on Future { - settlementAsset { - id - name - decimals - globalRewardPoolAccount { - balance - } - } - } - } - } - riskModel { - ... on LogNormalRiskModel { - tau - riskAversionParameter - params { - r - sigma - mu - } - } - ... on SimpleRiskModel { - params { - factorLong - factorShort - } - } - } - marginCalculator { - scalingFactors { - searchLevel - initialMargin - collateralRelease - } - } - } - decimalPlaces - openingAuction { - durationSecs - volume - } - priceMonitoringSettings { - parameters { - triggers { - horizonSecs - probability - auctionExtensionSecs - } - } - } - liquidityMonitoringParameters { - triggeringRatio - targetStakeParameters { - timeWindow - scalingFactor - } - } - tradingMode - state - proposal { - id - } - state - accounts { - asset { - id - name - } - balance - type - } - data { - markPrice - bestBidPrice - bestBidVolume - bestOfferPrice - bestOfferVolume - bestStaticBidPrice - bestStaticBidVolume - bestStaticOfferPrice - bestStaticOfferVolume - midPrice - staticMidPrice - timestamp - openInterest - auctionEnd - auctionStart - indicativePrice - indicativeVolume - trigger - extensionTrigger - targetStake - suppliedStake - priceMonitoringBounds { - minValidPrice - maxValidPrice - trigger { - auctionExtensionSecs - probability - } - referencePrice - } - marketValueProxy - liquidityProviderFeeShare { - party { - id - } - equityLikeShare - averageEntryValuation - } - } - } -} - `; - -/** - * __useMarketsQueryQuery__ - * - * To run a query within a React component, call `useMarketsQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useMarketsQueryQuery` 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 } = useMarketsQueryQuery({ - * variables: { - * }, - * }); - */ -export function useMarketsQueryQuery(baseOptions?: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(MarketsQueryDocument, options); - } -export function useMarketsQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(MarketsQueryDocument, options); - } -export type MarketsQueryQueryHookResult = ReturnType; -export type MarketsQueryLazyQueryHookResult = ReturnType; -export type MarketsQueryQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/explorer/src/app/routes/oracles/OracleSpecs.graphql b/apps/explorer/src/app/routes/oracles/OracleSpecs.graphql deleted file mode 100644 index 4deb4346d..000000000 --- a/apps/explorer/src/app/routes/oracles/OracleSpecs.graphql +++ /dev/null @@ -1,82 +0,0 @@ -query OracleSpecs { - oracleSpecsConnection { - edges { - node { - dataSourceSpec { - spec { - id - createdAt - updatedAt - status - data { - sourceType { - ... on DataSourceDefinitionInternal { - sourceType { - ... on DataSourceSpecConfigurationTime { - conditions { - value - operator - } - } - } - } - ... on DataSourceDefinitionExternal { - sourceType { - ... on DataSourceSpecConfiguration { - signers { - signer { - ... on ETHAddress { - address - } - ... on PubKey { - key - } - } - } - filters { - key { - name - type - } - conditions { - value - operator - } - } - } - } - } - } - } - } - } - dataConnection { - edges { - node { - externalData { - data { - signers { - signer { - ... on ETHAddress { - address - } - ... on PubKey { - key - } - } - } - data { - name - value - } - matchedSpecIds - broadcastAt - } - } - } - } - } - } - } - } -} diff --git a/apps/explorer/src/app/routes/oracles/__generated___/OracleSpecs.ts b/apps/explorer/src/app/routes/oracles/__generated___/OracleSpecs.ts deleted file mode 100644 index e5605b110..000000000 --- a/apps/explorer/src/app/routes/oracles/__generated___/OracleSpecs.ts +++ /dev/null @@ -1,122 +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 OracleSpecsQueryVariables = Types.Exact<{ [key: string]: never; }>; - - -export type OracleSpecsQuery = { __typename?: 'Query', oracleSpecsConnection?: { __typename?: 'OracleSpecsConnection', edges?: Array<{ __typename?: 'OracleSpecEdge', node: { __typename?: 'OracleSpec', dataSourceSpec: { __typename?: 'ExternalDataSourceSpec', spec: { __typename?: 'DataSourceSpec', id: string, createdAt: string, updatedAt?: string | null, status: Types.DataSourceSpecStatus, data: { __typename?: 'DataSourceDefinition', sourceType: { __typename?: 'DataSourceDefinitionExternal', sourceType: { __typename?: 'DataSourceSpecConfiguration', signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, filters?: Array<{ __typename?: 'Filter', key: { __typename?: 'PropertyKey', name?: string | null, type: Types.PropertyKeyType }, conditions?: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', value?: string | null, operator: Types.ConditionOperator } | null> } } } } }, dataConnection: { __typename?: 'OracleDataConnection', edges?: Array<{ __typename?: 'OracleDataEdge', node: { __typename?: 'OracleData', externalData: { __typename?: 'ExternalData', data: { __typename?: 'Data', matchedSpecIds?: Array | null, broadcastAt: string, signers?: Array<{ __typename?: 'Signer', signer: { __typename?: 'ETHAddress', address?: string | null } | { __typename?: 'PubKey', key?: string | null } }> | null, data?: Array<{ __typename?: 'Property', name: string, value: string }> | null } } } } | null> | null } } } | null> | null } | null }; - - -export const OracleSpecsDocument = gql` - query OracleSpecs { - oracleSpecsConnection { - edges { - node { - dataSourceSpec { - spec { - id - createdAt - updatedAt - status - data { - sourceType { - ... on DataSourceDefinitionInternal { - sourceType { - ... on DataSourceSpecConfigurationTime { - conditions { - value - operator - } - } - } - } - ... on DataSourceDefinitionExternal { - sourceType { - ... on DataSourceSpecConfiguration { - signers { - signer { - ... on ETHAddress { - address - } - ... on PubKey { - key - } - } - } - filters { - key { - name - type - } - conditions { - value - operator - } - } - } - } - } - } - } - } - } - dataConnection { - edges { - node { - externalData { - data { - signers { - signer { - ... on ETHAddress { - address - } - ... on PubKey { - key - } - } - } - data { - name - value - } - matchedSpecIds - broadcastAt - } - } - } - } - } - } - } - } -} - `; - -/** - * __useOracleSpecsQuery__ - * - * To run a query within a React component, call `useOracleSpecsQuery` and pass it any options that fit your needs. - * When your component renders, `useOracleSpecsQuery` 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 } = useOracleSpecsQuery({ - * variables: { - * }, - * }); - */ -export function useOracleSpecsQuery(baseOptions?: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(OracleSpecsDocument, options); - } -export function useOracleSpecsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(OracleSpecsDocument, options); - } -export type OracleSpecsQueryHookResult = ReturnType; -export type OracleSpecsLazyQueryHookResult = ReturnType; -export type OracleSpecsQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/explorer/src/app/routes/parties/PartyAssets.graphql b/apps/explorer/src/app/routes/parties/PartyAssets.graphql deleted file mode 100644 index 508f43d4e..000000000 --- a/apps/explorer/src/app/routes/parties/PartyAssets.graphql +++ /dev/null @@ -1,32 +0,0 @@ -query PartyAssetsQuery($partyId: ID!) { - party(id: $partyId) { - id - delegations { - amount - node { - id - name - } - epoch - } - stakingSummary { - currentStakeAvailable - } - accounts { - asset { - name - id - decimals - symbol - source { - __typename - ... on ERC20 { - contractAddress - } - } - } - type - balance - } - } -} diff --git a/apps/explorer/src/app/routes/parties/__generated___/PartyAssets.ts b/apps/explorer/src/app/routes/parties/__generated___/PartyAssets.ts deleted file mode 100644 index e9f3f71d3..000000000 --- a/apps/explorer/src/app/routes/parties/__generated___/PartyAssets.ts +++ /dev/null @@ -1,75 +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 PartyAssetsQueryQueryVariables = Types.Exact<{ - partyId: Types.Scalars['ID']; -}>; - - -export type PartyAssetsQueryQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, delegations?: Array<{ __typename?: 'Delegation', amount: string, epoch: number, node: { __typename?: 'Node', id: string, name: string } }> | null, stakingSummary: { __typename?: 'StakingSummary', currentStakeAvailable: string }, accounts?: Array<{ __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 }; - - -export const PartyAssetsQueryDocument = gql` - query PartyAssetsQuery($partyId: ID!) { - party(id: $partyId) { - id - delegations { - amount - node { - id - name - } - epoch - } - stakingSummary { - currentStakeAvailable - } - accounts { - asset { - name - id - decimals - symbol - source { - __typename - ... on ERC20 { - contractAddress - } - } - } - type - balance - } - } -} - `; - -/** - * __usePartyAssetsQueryQuery__ - * - * To run a query within a React component, call `usePartyAssetsQueryQuery` and pass it any options that fit your needs. - * When your component renders, `usePartyAssetsQueryQuery` 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 } = usePartyAssetsQueryQuery({ - * variables: { - * partyId: // value for 'partyId' - * }, - * }); - */ -export function usePartyAssetsQueryQuery(baseOptions: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(PartyAssetsQueryDocument, options); - } -export function usePartyAssetsQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(PartyAssetsQueryDocument, options); - } -export type PartyAssetsQueryQueryHookResult = ReturnType; -export type PartyAssetsQueryLazyQueryHookResult = ReturnType; -export type PartyAssetsQueryQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/explorer/src/app/routes/validators/Nodes.graphql b/apps/explorer/src/app/routes/validators/Nodes.graphql deleted file mode 100644 index 17daa0a43..000000000 --- a/apps/explorer/src/app/routes/validators/Nodes.graphql +++ /dev/null @@ -1,22 +0,0 @@ -query NodesQuery { - nodes { - id - name - infoUrl - avatarUrl - pubkey - tmPubkey - ethereumAddress - location - stakedByOperator - stakedByDelegates - stakedTotal - pendingStake - epochData { - total - offline - online - } - status - } -} diff --git a/apps/explorer/src/app/routes/validators/__generated___/Nodes.ts b/apps/explorer/src/app/routes/validators/__generated___/Nodes.ts deleted file mode 100644 index ceffa4c68..000000000 --- a/apps/explorer/src/app/routes/validators/__generated___/Nodes.ts +++ /dev/null @@ -1,62 +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 NodesQueryQueryVariables = Types.Exact<{ [key: string]: never; }>; - - -export type NodesQueryQuery = { __typename?: 'Query', nodes?: Array<{ __typename?: 'Node', id: string, name: string, infoUrl: string, avatarUrl?: string | null, pubkey: string, tmPubkey: string, ethereumAddress: string, location: string, stakedByOperator: string, stakedByDelegates: string, stakedTotal: string, pendingStake: string, status: Types.NodeStatus, epochData?: { __typename?: 'EpochData', total: number, offline: number, online: number } | null }> | null }; - - -export const NodesQueryDocument = gql` - query NodesQuery { - nodes { - id - name - infoUrl - avatarUrl - pubkey - tmPubkey - ethereumAddress - location - stakedByOperator - stakedByDelegates - stakedTotal - pendingStake - epochData { - total - offline - online - } - status - } -} - `; - -/** - * __useNodesQueryQuery__ - * - * To run a query within a React component, call `useNodesQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useNodesQueryQuery` 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 } = useNodesQueryQuery({ - * variables: { - * }, - * }); - */ -export function useNodesQueryQuery(baseOptions?: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(NodesQueryDocument, options); - } -export function useNodesQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(NodesQueryDocument, options); - } -export type NodesQueryQueryHookResult = ReturnType; -export type NodesQueryLazyQueryHookResult = ReturnType; -export type NodesQueryQueryResult = Apollo.QueryResult; \ No newline at end of file From 053d83876fb5444d114c7cd1ee2906eff50ef9d9 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Fri, 11 Nov 2022 00:10:42 +0000 Subject: [PATCH 31/34] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 7eb8644ca..cc6019f53 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -274,7 +274,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "92339.08389537395807733", + "locked_amount": "92278.87150818950485914", "deposits": [ { "amount": "129999.45", @@ -340,7 +340,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "42691.94702562150638", + "locked_amount": "42655.3692097919865", "deposits": [ { "amount": "2600", @@ -513,7 +513,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "4249.950691273465", + "locked_amount": "4246.4737125824455", "deposits": [ { "amount": "5000", @@ -724,7 +724,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "33798.2411495243291753766", + "locked_amount": "33739.1784067339577252268", "deposits": [ { "amount": "97499.58", @@ -757,7 +757,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "46196.36062848885225002744376", + "locked_amount": "46115.63205585158543789037108", "deposits": [ { "amount": "135173.4239508", @@ -790,7 +790,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "14218.3363871994920888122", + "locked_amount": "14193.489711266593163882", "deposits": [ { "amount": "32499.86", @@ -823,7 +823,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "4627.930522562976230212", + "locked_amount": "4619.8431706532545255803", "deposits": [ { "amount": "10833.29", @@ -856,7 +856,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "22749.93", "total_removed": "0", - "locked_amount": "17300.237922954843686739", + "locked_amount": "17270.005595238874629207", "deposits": [ { "amount": "6500", @@ -995,7 +995,7 @@ "tranche_end": "2023-05-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "21287.535969152853", + "locked_amount": "21255.983828268876", "deposits": [ { "amount": "7500", @@ -1048,7 +1048,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "626880.6921411330574", - "locked_amount": "1080228.658605334221404356", + "locked_amount": "1078879.640677461425567674", "deposits": [ { "amount": "1852091.69", @@ -1345,7 +1345,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "18997.130541716991", + "locked_amount": "18938.503767864330125", "deposits": [ { "amount": "12500", @@ -25359,7 +25359,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "284657.8276980546609", - "locked_amount": "1684436.67733225788741820892", + "locked_amount": "1682363.611928559069918883384", "deposits": [ { "amount": "1998.95815", @@ -26386,7 +26386,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "453748.5475981423200744", - "locked_amount": "11272591.8922893805230431903437458304798594", + "locked_amount": "11265240.9354713861701101845317628251905921", "deposits": [ { "amount": "16249.93", @@ -30384,7 +30384,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "3318543.503199759478065457", - "locked_amount": "4685339.63249244686806167466952799", + "locked_amount": "4678553.276094375764662065977913855", "deposits": [ { "amount": "129284.449", @@ -36281,7 +36281,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "2147526.429852157556378517", - "locked_amount": "1534302.62195575980735536856161673", + "locked_amount": "1531621.291499339884785606758432508", "deposits": [ { "amount": "552496.6455", @@ -37933,7 +37933,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "13621.800119156296", - "locked_amount": "266908.6201738385705009074378488", + "locked_amount": "266580.1311104754024415584170472", "deposits": [ { "amount": "3000", From d5045b8ec4bfe47cb4da43526948668200fbbec4 Mon Sep 17 00:00:00 2001 From: mattrussell36 Date: Fri, 11 Nov 2022 06:04:32 +0000 Subject: [PATCH 32/34] chore: update tranches Signed-off-by: github-actions[bot] --- apps/static/src/assets/mainnet-tranches.json | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index cc6019f53..db10f254b 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -274,7 +274,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "92278.87150818950485914", + "locked_amount": "92220.581085028265986725", "deposits": [ { "amount": "129999.45", @@ -340,7 +340,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "52600", "total_removed": "0", - "locked_amount": "42655.3692097919865", + "locked_amount": "42619.95894850329646", "deposits": [ { "amount": "2600", @@ -513,7 +513,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "4246.4737125824455", + "locked_amount": "4243.107718163369", "deposits": [ { "amount": "5000", @@ -724,7 +724,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "33739.1784067339577252268", + "locked_amount": "33682.0009316113152362808", "deposits": [ { "amount": "97499.58", @@ -757,7 +757,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "46115.63205585158543789037108", + "locked_amount": "46037.48031863819208030137556", "deposits": [ { "amount": "135173.4239508", @@ -790,7 +790,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "14193.489711266593163882", + "locked_amount": "14169.4361348846779119576", "deposits": [ { "amount": "32499.86", @@ -823,7 +823,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "4619.8431706532545255803", + "locked_amount": "4612.0139649513209677735", "deposits": [ { "amount": "10833.29", @@ -856,7 +856,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "22749.93", "total_removed": "0", - "locked_amount": "17270.005595238874629207", + "locked_amount": "17240.738275703534195079", "deposits": [ { "amount": "6500", @@ -995,7 +995,7 @@ "tranche_end": "2023-05-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "21255.983828268876", + "locked_amount": "21225.438823664826", "deposits": [ { "amount": "7500", @@ -1048,7 +1048,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "626880.6921411330574", - "locked_amount": "1078879.640677461425567674", + "locked_amount": "1077573.68305736380241946", "deposits": [ { "amount": "1852091.69", @@ -1345,7 +1345,7 @@ "tranche_end": "2023-02-01T00:00:00.000Z", "total_added": "42500", "total_removed": "0", - "locked_amount": "18938.503767864330125", + "locked_amount": "18881.74834566223655", "deposits": [ { "amount": "12500", @@ -25359,7 +25359,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "284657.8276980546609", - "locked_amount": "1682363.611928559069918883384", + "locked_amount": "1680356.90427933501869095582", "deposits": [ { "amount": "1998.95815", @@ -26386,7 +26386,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "453748.5475981423200744", - "locked_amount": "11265240.9354713861701101845317628251905921", + "locked_amount": "11258125.2789901849270326963417939365436605", "deposits": [ { "amount": "16249.93", @@ -30384,7 +30384,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "3318543.503199759478065457", - "locked_amount": "4678553.276094375764662065977913855", + "locked_amount": "4671984.14746482543382160494763163", "deposits": [ { "amount": "129284.449", @@ -36281,7 +36281,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", "total_removed": "2147526.429852157556378517", - "locked_amount": "1531621.291499339884785606758432508", + "locked_amount": "1529025.789048046189829286706556968", "deposits": [ { "amount": "552496.6455", @@ -37933,7 +37933,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "13621.800119156296", - "locked_amount": "266580.1311104754024415584170472", + "locked_amount": "266262.15681262597894487928665652", "deposits": [ { "amount": "3000", From cdff4886b2b5157523c7bb3cc37827de8aa22c02 Mon Sep 17 00:00:00 2001 From: Dexter Edwards Date: Fri, 11 Nov 2022 09:08:49 +0000 Subject: [PATCH 33/34] chore: remove dead sorting logic (#2016) * chore: remove dead sorting logic * style: lint * style: lint --- apps/token/src/app.tsx | 30 ----- .../src/lib/deterministic-shuffle.test.ts | 111 ------------------ apps/token/src/lib/deterministic-shuffle.ts | 36 ------ 3 files changed, 177 deletions(-) delete mode 100644 apps/token/src/lib/deterministic-shuffle.test.ts delete mode 100644 apps/token/src/lib/deterministic-shuffle.ts diff --git a/apps/token/src/app.tsx b/apps/token/src/app.tsx index 3c5c5cce8..32a976725 100644 --- a/apps/token/src/app.tsx +++ b/apps/token/src/app.tsx @@ -33,10 +33,7 @@ import type { InMemoryCacheConfig, Reference, } from '@apollo/client'; -import sortBy from 'lodash/sortBy'; -import uniqBy from 'lodash/uniqBy'; -import { deterministicShuffle } from './lib/deterministic-shuffle'; import { addDecimal } from '@vegaprotocol/react-helpers'; const formatUintToNumber = (amount: string, decimals = 18) => @@ -51,35 +48,8 @@ const createReadField = (fieldName: string) => ({ }, }); -// Create seed in memory. Validator list order will remain the same -// until the page is refreshed. -const VALIDATOR_RANDOMISER_SEED = ( - Math.floor(Math.random() * 1000) + 1 -).toString(); - const cache: InMemoryCacheConfig = { typePolicies: { - Query: { - fields: { - nodes: { - // Merge function to make the validator list random but remain consistent - // as the user navigates around the site. If the user refreshes the list - // will be randomised. - merge: (existing = [], incoming) => { - // uniqBy will take the first of any matches - const uniq = uniqBy([...incoming, ...existing], 'id'); - // sort result so that the input is consistent - const sorted = sortBy(uniq, 'id'); - // randomise based on seed string - const random = deterministicShuffle( - VALIDATOR_RANDOMISER_SEED, - sorted - ); - return random; - }, - }, - }, - }, Account: { keyFields: false, fields: { diff --git a/apps/token/src/lib/deterministic-shuffle.test.ts b/apps/token/src/lib/deterministic-shuffle.test.ts deleted file mode 100644 index 4002ad26a..000000000 --- a/apps/token/src/lib/deterministic-shuffle.test.ts +++ /dev/null @@ -1,111 +0,0 @@ -import { - stringTo32BitHash, - createRandomGenerator, - deterministicShuffle, -} from './deterministic-shuffle'; - -it('Converts a string to a hash as expected', () => { - expect(stringTo32BitHash('test')).toEqual(1706); - expect(stringTo32BitHash('0x0ddba11')).toEqual(31040); - expect(stringTo32BitHash('Rhosllannerchrugog')).toEqual(27853302); -}); - -it('Random generator is deterministic by seed: matching output', () => { - const genSeedOne = createRandomGenerator(1); - const anotherGenSeedOne = createRandomGenerator(1); - - expect(genSeedOne()).toEqual(anotherGenSeedOne()); - expect(genSeedOne()).toEqual(anotherGenSeedOne()); - expect(genSeedOne()).toEqual(anotherGenSeedOne()); - - // Throw a result away so they are out of step - genSeedOne(); - - expect(genSeedOne()).not.toEqual(anotherGenSeedOne()); -}); - -it('Random generator is deterministic by seed: non-matching output', () => { - const genSeedOne = createRandomGenerator(1); - const genSeedTwo = createRandomGenerator(2); - - expect(genSeedOne()).not.toEqual(genSeedTwo()); - expect(genSeedOne()).not.toEqual(genSeedTwo()); - expect(genSeedOne()).not.toEqual(genSeedTwo()); -}); - -it('Random generator is deterministic by seed: switching seed overrides original seed and produces deterministic output', () => { - const genSeedOne = createRandomGenerator(1); - const genSeedTwo = createRandomGenerator(2); - - const firstTwoSeed = genSeedTwo(); - expect(genSeedOne()).not.toEqual(firstTwoSeed); - - const secondTwoSeed = genSeedTwo(); - expect(genSeedOne()).not.toEqual(secondTwoSeed); - - expect(genSeedOne(2)).toEqual(firstTwoSeed); - expect(genSeedOne()).toEqual(secondTwoSeed); -}); - -it('deterministicShuffle shuffles deterministically: strings', () => { - const defaultInputStrings = ['one', 'two', 'three', 'four', 'five']; - const testSeedOne = deterministicShuffle('test', defaultInputStrings); - const testSeedTwo = deterministicShuffle('test', defaultInputStrings); - const testSeedThree = deterministicShuffle('test', defaultInputStrings); - - expect(testSeedOne).toEqual(['three', 'four', 'one', 'two', 'five']); - expect(testSeedTwo).not.toEqual(testSeedOne); - expect(testSeedThree).not.toEqual(testSeedOne); - - const altSeedOne = deterministicShuffle( - 'anything-except-test', - defaultInputStrings - ); - expect(altSeedOne).not.toEqual(testSeedOne); -}); - -it('deterministicShuffle shuffles deterministically: numbers', () => { - const defaultInputNumbers = [1, 2, 3, 4, 5]; - const testSeedOne = deterministicShuffle('test', defaultInputNumbers); - const testSeedTwo = deterministicShuffle('test', defaultInputNumbers); - const testSeedThree = deterministicShuffle('test', defaultInputNumbers); - - expect(testSeedOne).toEqual([3, 4, 1, 2, 5]); - expect(testSeedTwo).not.toEqual(testSeedOne); - expect(testSeedThree).not.toEqual(testSeedOne); - - const altSeedOne = deterministicShuffle( - 'anything-except-test', - defaultInputNumbers - ); - expect(altSeedOne).not.toEqual(testSeedOne); -}); - -it('deterministicShuffle shuffles deterministically: objects', () => { - const defaultInputObjects = [ - { test: 1 }, - { test: 2 }, - { test: 3 }, - { test: 4 }, - { test: 5 }, - ]; - const testSeedOne = deterministicShuffle('test', defaultInputObjects); - const testSeedTwo = deterministicShuffle('test', defaultInputObjects); - const testSeedThree = deterministicShuffle('test', defaultInputObjects); - - expect(testSeedOne).toEqual([ - { test: 3 }, - { test: 4 }, - { test: 1 }, - { test: 2 }, - { test: 5 }, - ]); - expect(testSeedTwo).not.toEqual(testSeedOne); - expect(testSeedThree).not.toEqual(testSeedOne); - - const altSeedOne = deterministicShuffle( - 'anything-except-test', - defaultInputObjects - ); - expect(altSeedOne).not.toEqual(testSeedOne); -}); diff --git a/apps/token/src/lib/deterministic-shuffle.ts b/apps/token/src/lib/deterministic-shuffle.ts deleted file mode 100644 index c7addb060..000000000 --- a/apps/token/src/lib/deterministic-shuffle.ts +++ /dev/null @@ -1,36 +0,0 @@ -// creates a random number generator function. -export function createRandomGenerator(seed: number) { - const a = 5486230734; // some big numbers - const b = 6908969830; - const m = 9853205067; - let x = seed; - // returns a random value 0 <= num < 1 - return function (seed = x) { - // seed is optional. If supplied sets a new seed - x = (seed * a + b) % m; - return x / m; - }; -} - -// function creates a 32bit hash of a string -export function stringTo32BitHash(str: string) { - let v = 0; - for (let i = 0; i < str.length; i += 1) { - v += str.charCodeAt(i) << i % 24; - } - return v % 0xffffffff; -} - -// shuffle array using the str as a key. -export function deterministicShuffle( - str: string, - arr: Array -) { - const rArr = []; - const random = createRandomGenerator(stringTo32BitHash(str)); - while (arr.length > 1) { - rArr.push(arr.splice(Math.floor(random() * arr.length), 1)[0]); - } - rArr.push(arr[0]); - return rArr; -} From 38030ba1ec7f9f6ea11c15dee2180c5d6390c222 Mon Sep 17 00:00:00 2001 From: Matthew Russell Date: Fri, 11 Nov 2022 04:06:47 -0600 Subject: [PATCH 34/34] chore: make apps use stagnet3 as default env (#2024) --- apps/console-lite/.env | 6 +++--- apps/token/.env | 6 +++--- apps/trading/.env | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/apps/console-lite/.env b/apps/console-lite/.env index 2e6533105..dc0bbb167 100644 --- a/apps/console-lite/.env +++ b/apps/console-lite/.env @@ -17,9 +17,9 @@ NX_INCOMING_HOOK_BODY=$INCOMING_HOOK_BODY NX_URL=$URL NX_DEPLOY_URL=$DEPLOY_URL NX_DEPLOY_PRIME_URL=$DEPLOY_PRIME_URL -NX_VEGA_CONFIG_URL="https://static.vega.xyz/assets/testnet-network.json" -NX_VEGA_ENV = 'TESTNET' -NX_VEGA_URL="https://api.n11.testnet.vega.xyz/graphql" +NX_VEGA_CONFIG_URL="https://static.vega.xyz/assets/stagnet3-network.json" +NX_VEGA_ENV=STAGNET3 +NX_VEGA_URL="https://api.n01.stagnet3.vega.xyz/graphql" NX_VEGA_WALLET_URL=http://localhost:1789 NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHERSCAN_URL=https://sepolia.etherscan.io diff --git a/apps/token/.env b/apps/token/.env index 6a191c347..b0ccc8639 100644 --- a/apps/token/.env +++ b/apps/token/.env @@ -1,7 +1,7 @@ # App configuration variables -NX_VEGA_ENV=TESTNET -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/testnet-network.json -NX_VEGA_URL=https://api.n11.testnet.vega.xyz/graphql +NX_VEGA_ENV=STAGNET3 +NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet3-network.json +NX_VEGA_URL=https://api.n01.stagnet3.vega.xyz/graphql NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHERSCAN_URL=https://sepolia.etherscan.io NX_FAIRGROUND=false diff --git a/apps/trading/.env b/apps/trading/.env index 06fabaa06..28e6252bd 100644 --- a/apps/trading/.env +++ b/apps/trading/.env @@ -1,10 +1,10 @@ NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8 NX_ETHERSCAN_URL=https://sepolia.etherscan.io NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz -NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/testnet-network.json -NX_VEGA_ENV=TESTNET -NX_VEGA_EXPLORER_URL=https://explorer.fairground.wtf +NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet3-network.json +NX_VEGA_ENV=STAGNET3 +NX_VEGA_EXPLORER_URL=https://staging3.explorer.vega.xyz NX_VEGA_NETWORKS={\"TESTNET\":\"https://console.fairground.wtf\",\"STAGNET1\":\"https://stagnet1.console.vega.xyz\",\"STAGNET3\":\"https://stagnet3.console.vega.xyz\"} NX_VEGA_TOKEN_URL=https://token.fairground.wtf -NX_VEGA_URL=https://api.n06.testnet.vega.xyz/graphql -NX_VEGA_WALLET_URL=http://localhost:1789 +NX_VEGA_URL=https://api.n01.stagnet3.vega.xyz/graphql +NX_VEGA_WALLET_URL=http://localhost:1789 \ No newline at end of file
{t('Market status')}{t('Liquidity status')}
+ {t('Market status')} + + {t('Liquidity status')} +
-

{t(r.title)}

-

{t(r.copy)}

+
+

+ {t(r.title)} +

+

+ {t(r.copy)} +

+