diff --git a/apps/explorer/src/app/components/asset-balance/asset-balance.tsx b/apps/explorer/src/app/components/asset-balance/asset-balance.tsx index 7f0b2896d..6a614c4b0 100644 --- a/apps/explorer/src/app/components/asset-balance/asset-balance.tsx +++ b/apps/explorer/src/app/components/asset-balance/asset-balance.tsx @@ -1,5 +1,5 @@ import { useAssetDataProvider } from '@vegaprotocol/assets'; -import { addDecimalsFormatNumber } from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber } from '@vegaprotocol/utils'; import { AssetLink } from '../links'; export type AssetBalanceProps = { diff --git a/apps/explorer/src/app/components/asset-balance/governance-asset-balance.tsx b/apps/explorer/src/app/components/asset-balance/governance-asset-balance.tsx index 11889990c..fe33f36fd 100644 --- a/apps/explorer/src/app/components/asset-balance/governance-asset-balance.tsx +++ b/apps/explorer/src/app/components/asset-balance/governance-asset-balance.tsx @@ -1,4 +1,4 @@ -import { addDecimalsFormatNumber } from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber } from '@vegaprotocol/utils'; import { useExplorerGovernanceAssetQuery } from './__generated__/Governance-asset'; import AssetBalance from './asset-balance'; diff --git a/apps/explorer/src/app/components/assets/assets-table.tsx b/apps/explorer/src/app/components/assets/assets-table.tsx index fb90dd293..6f9afc60b 100644 --- a/apps/explorer/src/app/components/assets/assets-table.tsx +++ b/apps/explorer/src/app/components/assets/assets-table.tsx @@ -1,11 +1,11 @@ import type { AssetFieldsFragment } from '@vegaprotocol/assets'; import { AssetTypeMapping, AssetStatusMapping } from '@vegaprotocol/assets'; -import { t } from '@vegaprotocol/react-helpers'; -import type { VegaICellRendererParams } from '@vegaprotocol/ui-toolkit'; +import { t } from '@vegaprotocol/i18n'; import { ButtonLink } from '@vegaprotocol/ui-toolkit'; import type { AgGridReact } from 'ag-grid-react'; import { AgGridColumn } from 'ag-grid-react'; -import { AgGridDynamic as AgGrid } from '@vegaprotocol/ui-toolkit'; +import { AgGridDynamic as AgGrid } from '@vegaprotocol/datagrid'; +import type { VegaICellRendererParams } from '@vegaprotocol/datagrid'; import { useRef, useLayoutEffect } from 'react'; import { BREAKPOINT_MD } from '../../config/breakpoints'; import { useNavigate } from 'react-router-dom'; diff --git a/apps/explorer/src/app/components/blocks/block-data.tsx b/apps/explorer/src/app/components/blocks/block-data.tsx index 42e2913f7..8fc6c572d 100644 --- a/apps/explorer/src/app/components/blocks/block-data.tsx +++ b/apps/explorer/src/app/components/blocks/block-data.tsx @@ -2,11 +2,11 @@ import React from 'react'; import type { BlockMeta } from '../../routes/blocks/tendermint-blockchain-response'; import { Routes } from '../../routes/route-names'; import { Link } from 'react-router-dom'; -import { getDateTimeFormat } from '@vegaprotocol/react-helpers'; +import { getDateTimeFormat } from '@vegaprotocol/utils'; import { Tooltip } from '@vegaprotocol/ui-toolkit'; import { TimeAgo } from '../time-ago'; import { TableWithTbody, TableRow, TableCell } from '../table'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; interface BlockProps { block: BlockMeta; diff --git a/apps/explorer/src/app/components/blocks/blocks-data.tsx b/apps/explorer/src/app/components/blocks/blocks-data.tsx index 708f16f75..95752e7e2 100644 --- a/apps/explorer/src/app/components/blocks/blocks-data.tsx +++ b/apps/explorer/src/app/components/blocks/blocks-data.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import React from 'react'; import type { TendermintBlockchainResponse } from '../../routes/blocks/tendermint-blockchain-response'; import { BlockData } from './block-data'; diff --git a/apps/explorer/src/app/components/blocks/blocks-infinite-list.tsx b/apps/explorer/src/app/components/blocks/blocks-infinite-list.tsx index f57765c14..254071e1e 100644 --- a/apps/explorer/src/app/components/blocks/blocks-infinite-list.tsx +++ b/apps/explorer/src/app/components/blocks/blocks-infinite-list.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { FixedSizeList as List } from 'react-window'; import InfiniteLoader from 'react-window-infinite-loader'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { BlockMeta } from '../../routes/blocks/tendermint-blockchain-response'; import { BlockData } from './block-data'; import EmptyList from '../empty-list/empty-list'; diff --git a/apps/explorer/src/app/components/blocks/blocks-refetch.tsx b/apps/explorer/src/app/components/blocks/blocks-refetch.tsx index 08c5c5e00..4a8ebe9ac 100644 --- a/apps/explorer/src/app/components/blocks/blocks-refetch.tsx +++ b/apps/explorer/src/app/components/blocks/blocks-refetch.tsx @@ -1,6 +1,6 @@ import { useState, useEffect } from 'react'; import { useTendermintWebsocket } from '../../hooks/use-tendermint-websocket'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { ButtonLink } from '@vegaprotocol/ui-toolkit'; interface BlocksRefetchProps { diff --git a/apps/explorer/src/app/components/dialogs/json-viewer-dialog.tsx b/apps/explorer/src/app/components/dialogs/json-viewer-dialog.tsx index a3c032f4e..4e80854a3 100644 --- a/apps/explorer/src/app/components/dialogs/json-viewer-dialog.tsx +++ b/apps/explorer/src/app/components/dialogs/json-viewer-dialog.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Button, Dialog, diff --git a/apps/explorer/src/app/components/epoch-overview/epoch-missing.spec.tsx b/apps/explorer/src/app/components/epoch-overview/epoch-missing.spec.tsx index 5bfa05c36..9537decb8 100644 --- a/apps/explorer/src/app/components/epoch-overview/epoch-missing.spec.tsx +++ b/apps/explorer/src/app/components/epoch-overview/epoch-missing.spec.tsx @@ -1,7 +1,7 @@ import { MockedProvider } from '@apollo/client/testing'; import { render } from '@testing-library/react'; import EpochMissingOverview, { calculateEpochData } from './epoch-missing'; -import { getSecondsFromInterval } from '@vegaprotocol/react-helpers'; +import { getSecondsFromInterval } from '@vegaprotocol/utils'; const START_DATE_PAST = 'Monday, 17 February 2022 11:44:09'; describe('getSecondsFromInterval', () => { diff --git a/apps/explorer/src/app/components/epoch-overview/epoch-missing.tsx b/apps/explorer/src/app/components/epoch-overview/epoch-missing.tsx index 099f93807..a3e53efa1 100644 --- a/apps/explorer/src/app/components/epoch-overview/epoch-missing.tsx +++ b/apps/explorer/src/app/components/epoch-overview/epoch-missing.tsx @@ -4,8 +4,7 @@ import addSeconds from 'date-fns/addSeconds'; import formatDistance from 'date-fns/formatDistance'; import { Icon, Tooltip } from '@vegaprotocol/ui-toolkit'; import isFuture from 'date-fns/isFuture'; -import { isValidDate } from '@vegaprotocol/react-helpers'; -import { getSecondsFromInterval } from '@vegaprotocol/react-helpers'; +import { getSecondsFromInterval, isValidDate } from '@vegaprotocol/utils'; export type EpochMissingOverviewProps = { missingEpochId?: string; diff --git a/apps/explorer/src/app/components/epoch-overview/epoch.tsx b/apps/explorer/src/app/components/epoch-overview/epoch.tsx index 3321045bb..6f25abaa8 100644 --- a/apps/explorer/src/app/components/epoch-overview/epoch.tsx +++ b/apps/explorer/src/app/components/epoch-overview/epoch.tsx @@ -1,6 +1,6 @@ import { useExplorerEpochQuery } from './__generated__/Epoch'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { BlockLink } from '../links'; import { Time } from '../time'; import { TimeAgo } from '../time-ago'; diff --git a/apps/explorer/src/app/components/footer/footer.tsx b/apps/explorer/src/app/components/footer/footer.tsx index c44a5b149..ce817c809 100644 --- a/apps/explorer/src/app/components/footer/footer.tsx +++ b/apps/explorer/src/app/components/footer/footer.tsx @@ -1,5 +1,6 @@ import { NodeSwitcherDialog, useEnvironment } from '@vegaprotocol/environment'; -import { t, useScreenDimensions } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; +import { useScreenDimensions } from '@vegaprotocol/react-helpers'; import { ExternalLink, Link } from '@vegaprotocol/ui-toolkit'; import { useMemo, useState } from 'react'; import { ENV } from '../../config/env'; diff --git a/apps/explorer/src/app/components/header/header.tsx b/apps/explorer/src/app/components/header/header.tsx index 67cc12488..74d91e3c9 100644 --- a/apps/explorer/src/app/components/header/header.tsx +++ b/apps/explorer/src/app/components/header/header.tsx @@ -1,7 +1,7 @@ import classnames from 'classnames'; import { Link } from 'react-router-dom'; import { ThemeSwitcher, Icon } from '@vegaprotocol/ui-toolkit'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Search } from '../search'; import { Routes } from '../../routes/route-names'; import { NetworkSwitcher } from '@vegaprotocol/environment'; diff --git a/apps/explorer/src/app/components/jump-to-block/index.tsx b/apps/explorer/src/app/components/jump-to-block/index.tsx index 41396344d..b8385d7f9 100644 --- a/apps/explorer/src/app/components/jump-to-block/index.tsx +++ b/apps/explorer/src/app/components/jump-to-block/index.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import React from 'react'; import { useNavigate } from 'react-router-dom'; import { Routes } from '../../routes/route-names'; diff --git a/apps/explorer/src/app/components/jump-to/index.tsx b/apps/explorer/src/app/components/jump-to/index.tsx index 2420e7586..0aad73f3d 100644 --- a/apps/explorer/src/app/components/jump-to/index.tsx +++ b/apps/explorer/src/app/components/jump-to/index.tsx @@ -1,6 +1,6 @@ import type { HTMLInputTypeAttribute, SyntheticEvent } from 'react'; import { Input, Button } from '@vegaprotocol/ui-toolkit'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; interface JumpToProps { label: string; diff --git a/apps/explorer/src/app/components/links/market-link/market-link.tsx b/apps/explorer/src/app/components/links/market-link/market-link.tsx index 2d02322a2..dbc45ea01 100644 --- a/apps/explorer/src/app/components/links/market-link/market-link.tsx +++ b/apps/explorer/src/app/components/links/market-link/market-link.tsx @@ -3,7 +3,7 @@ import { useExplorerMarketQuery } from './__generated__/Market'; import { Link } from 'react-router-dom'; import type { ComponentProps } from 'react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import Hash from '../hash'; export type MarketLinkProps = Partial> & { diff --git a/apps/explorer/src/app/components/links/party-link/party-link.tsx b/apps/explorer/src/app/components/links/party-link/party-link.tsx index 726b323a9..3524cdadf 100644 --- a/apps/explorer/src/app/components/links/party-link/party-link.tsx +++ b/apps/explorer/src/app/components/links/party-link/party-link.tsx @@ -3,7 +3,7 @@ import { Link } from 'react-router-dom'; import type { ComponentProps } from 'react'; import Hash from '../hash'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { isValidPartyId } from '../../../routes/parties/id/components/party-id-error'; import { truncateMiddle } from '@vegaprotocol/ui-toolkit'; diff --git a/apps/explorer/src/app/components/markets/market-details.tsx b/apps/explorer/src/app/components/markets/market-details.tsx index 2b642a6d3..ab6e17549 100644 --- a/apps/explorer/src/app/components/markets/market-details.tsx +++ b/apps/explorer/src/app/components/markets/market-details.tsx @@ -2,8 +2,8 @@ import { addDecimalsFormatNumber, formatNumberPercentage, getMarketExpiryDateFormatted, - t, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import type { MarketInfoNoCandlesQuery } from '@vegaprotocol/market-info'; import { MarketInfoTable } from '@vegaprotocol/market-info'; import pick from 'lodash/pick'; diff --git a/apps/explorer/src/app/components/markets/markets-table.tsx b/apps/explorer/src/app/components/markets/markets-table.tsx index 680cbaa61..dd3c52127 100644 --- a/apps/explorer/src/app/components/markets/markets-table.tsx +++ b/apps/explorer/src/app/components/markets/markets-table.tsx @@ -1,13 +1,13 @@ import type { MarketFieldsFragment } from '@vegaprotocol/market-list'; -import { t } from '@vegaprotocol/react-helpers'; -import type { - VegaICellRendererParams, - VegaValueGetterParams, -} from '@vegaprotocol/ui-toolkit'; +import { t } from '@vegaprotocol/i18n'; import { ButtonLink } from '@vegaprotocol/ui-toolkit'; import type { AgGridReact } from 'ag-grid-react'; import { AgGridColumn } from 'ag-grid-react'; -import { AgGridDynamic as AgGrid } from '@vegaprotocol/ui-toolkit'; +import { AgGridDynamic as AgGrid } from '@vegaprotocol/datagrid'; +import type { + VegaICellRendererParams, + VegaValueGetterParams, +} from '@vegaprotocol/datagrid'; import { useRef, useLayoutEffect } from 'react'; import { BREAKPOINT_MD } from '../../config/breakpoints'; import { MarketStateMapping } from '@vegaprotocol/types'; diff --git a/apps/explorer/src/app/components/order-details/amend-order-details.tsx b/apps/explorer/src/app/components/order-details/amend-order-details.tsx index 8d04c2d0a..28d831c21 100644 --- a/apps/explorer/src/app/components/order-details/amend-order-details.tsx +++ b/apps/explorer/src/app/components/order-details/amend-order-details.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { useExplorerDeterministicOrderQuery } from './__generated__/Order'; import { MarketLink } from '../links'; import PriceInMarket from '../price-in-market/price-in-market'; diff --git a/apps/explorer/src/app/components/order-details/deterministic-order-details.tsx b/apps/explorer/src/app/components/order-details/deterministic-order-details.tsx index b8f64176a..b4b96cdd1 100644 --- a/apps/explorer/src/app/components/order-details/deterministic-order-details.tsx +++ b/apps/explorer/src/app/components/order-details/deterministic-order-details.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { useExplorerDeterministicOrderQuery } from './__generated__/Order'; import { MarketLink } from '../links'; import PriceInMarket from '../price-in-market/price-in-market'; diff --git a/apps/explorer/src/app/components/order-details/lib/order-labels.tsx b/apps/explorer/src/app/components/order-details/lib/order-labels.tsx index ebb05b41e..e0545cf1d 100644 --- a/apps/explorer/src/app/components/order-details/lib/order-labels.tsx +++ b/apps/explorer/src/app/components/order-details/lib/order-labels.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type * as Schema from '@vegaprotocol/types'; import type { components } from '../../../../types/explorer'; diff --git a/apps/explorer/src/app/components/price-in-market/price-in-market.tsx b/apps/explorer/src/app/components/price-in-market/price-in-market.tsx index a40c67333..bfa9d932d 100644 --- a/apps/explorer/src/app/components/price-in-market/price-in-market.tsx +++ b/apps/explorer/src/app/components/price-in-market/price-in-market.tsx @@ -1,4 +1,5 @@ -import { addDecimalsFormatNumber, t } from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import isUndefined from 'lodash/isUndefined'; import { useExplorerMarketQuery } from '../links/market-link/__generated__/Market'; import get from 'lodash/get'; diff --git a/apps/explorer/src/app/components/proposals/proposals-table.tsx b/apps/explorer/src/app/components/proposals/proposals-table.tsx index 6670fd3c5..25aea5de5 100644 --- a/apps/explorer/src/app/components/proposals/proposals-table.tsx +++ b/apps/explorer/src/app/components/proposals/proposals-table.tsx @@ -1,21 +1,18 @@ -import type { ProposalListFieldsFragment } from '@vegaprotocol/governance'; -import { VoteProgress } from '@vegaprotocol/governance'; +import type { ProposalListFieldsFragment } from '@vegaprotocol/proposals'; +import { VoteProgress } from '@vegaprotocol/proposals'; import type { AgGridReact } from 'ag-grid-react'; import { AgGridColumn } from 'ag-grid-react'; +import { ExternalLink } from '@vegaprotocol/ui-toolkit'; +import { AgGridDynamic as AgGrid } from '@vegaprotocol/datagrid'; import type { VegaICellRendererParams, VegaValueFormatterParams, -} from '@vegaprotocol/ui-toolkit'; -import { ExternalLink } from '@vegaprotocol/ui-toolkit'; -import { AgGridDynamic as AgGrid } from '@vegaprotocol/ui-toolkit'; +} from '@vegaprotocol/datagrid'; import { useLayoutEffect, useMemo, useRef, useState } from 'react'; import type { RowClickedEvent } from 'ag-grid-community'; -import { - getDateTimeFormat, - NetworkParams, - t, - useNetworkParams, -} from '@vegaprotocol/react-helpers'; +import { getDateTimeFormat } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; +import { NetworkParams, useNetworkParams } from '@vegaprotocol/react-helpers'; import { ProposalStateMapping } from '@vegaprotocol/types'; import BigNumber from 'bignumber.js'; import { DApp, TOKEN_PROPOSAL, useLinks } from '@vegaprotocol/environment'; diff --git a/apps/explorer/src/app/components/render-fetched/index.tsx b/apps/explorer/src/app/components/render-fetched/index.tsx index 49a288981..931511382 100644 --- a/apps/explorer/src/app/components/render-fetched/index.tsx +++ b/apps/explorer/src/app/components/render-fetched/index.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { StatusMessage } from '../status-message'; interface RenderFetchedProps { diff --git a/apps/explorer/src/app/components/router-error-boundary/index.tsx b/apps/explorer/src/app/components/router-error-boundary/index.tsx index 0d4445114..2dec60db8 100644 --- a/apps/explorer/src/app/components/router-error-boundary/index.tsx +++ b/apps/explorer/src/app/components/router-error-boundary/index.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import React from 'react'; interface RouteErrorBoundaryProps { diff --git a/apps/explorer/src/app/components/search/search.tsx b/apps/explorer/src/app/components/search/search.tsx index b4603e0c9..34e20569c 100644 --- a/apps/explorer/src/app/components/search/search.tsx +++ b/apps/explorer/src/app/components/search/search.tsx @@ -1,5 +1,5 @@ import { useCallback, useState } from 'react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Button, Input, InputError } from '@vegaprotocol/ui-toolkit'; import { useForm } from 'react-hook-form'; import { useNavigate } from 'react-router-dom'; diff --git a/apps/explorer/src/app/components/size-in-asset/size-in-asset.tsx b/apps/explorer/src/app/components/size-in-asset/size-in-asset.tsx index 9f7231621..ba6b06146 100644 --- a/apps/explorer/src/app/components/size-in-asset/size-in-asset.tsx +++ b/apps/explorer/src/app/components/size-in-asset/size-in-asset.tsx @@ -1,5 +1,5 @@ import { useAssetDataProvider } from '@vegaprotocol/assets'; -import { addDecimalsFormatNumber } from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber } from '@vegaprotocol/utils'; import { AssetLink } from '../links'; export type DecimalSource = 'ASSET'; diff --git a/apps/explorer/src/app/components/size-in-market/size-in-market.tsx b/apps/explorer/src/app/components/size-in-market/size-in-market.tsx index 4c993f426..e74382f7b 100644 --- a/apps/explorer/src/app/components/size-in-market/size-in-market.tsx +++ b/apps/explorer/src/app/components/size-in-market/size-in-market.tsx @@ -1,4 +1,4 @@ -import { addDecimalsFormatNumber } from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber } from '@vegaprotocol/utils'; import { useExplorerMarketQuery } from '../links/market-link/__generated__/Market'; export type DecimalSource = 'MARKET'; diff --git a/apps/explorer/src/app/components/time-ago/index.tsx b/apps/explorer/src/app/components/time-ago/index.tsx index e1b4ce672..d47a7d9d8 100644 --- a/apps/explorer/src/app/components/time-ago/index.tsx +++ b/apps/explorer/src/app/components/time-ago/index.tsx @@ -1,5 +1,5 @@ import { formatDistanceToNowStrict } from 'date-fns'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { useEffect, useState } from 'react'; interface TimeAgoProps { diff --git a/apps/explorer/src/app/components/time/index.tsx b/apps/explorer/src/app/components/time/index.tsx index 10e9bc3af..8d168d9cb 100644 --- a/apps/explorer/src/app/components/time/index.tsx +++ b/apps/explorer/src/app/components/time/index.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; interface TimeProps { date: string | null | undefined; diff --git a/apps/explorer/src/app/components/truncate/truncate.tsx b/apps/explorer/src/app/components/truncate/truncate.tsx index 4fdf481f1..39d83022f 100644 --- a/apps/explorer/src/app/components/truncate/truncate.tsx +++ b/apps/explorer/src/app/components/truncate/truncate.tsx @@ -1,4 +1,4 @@ -import { truncateByChars } from '@vegaprotocol/react-helpers'; +import { truncateByChars } from '@vegaprotocol/utils'; import * as React from 'react'; interface TruncateInlineProps { diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-deposit.spec.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-deposit.spec.tsx index 8ba5e0fb0..d4be0b459 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-deposit.spec.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-deposit.spec.tsx @@ -1,6 +1,6 @@ import { render } from '@testing-library/react'; import { TxDetailsChainEventBuiltinDeposit } from './tx-builtin-deposit'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { components } from '../../../../../types/explorer'; import omit from 'lodash/omit'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-deposit.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-deposit.tsx index 28b97ab5f..f9a446d15 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-deposit.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-deposit.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { TableRow, TableCell } from '../../../table'; import type { components } from '../../../../../types/explorer'; import { AssetLink, PartyLink } from '../../../links'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-withdrawal.spec.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-withdrawal.spec.tsx index 73f572316..7b443b9f4 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-withdrawal.spec.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-withdrawal.spec.tsx @@ -1,6 +1,6 @@ import { render } from '@testing-library/react'; import { TxDetailsChainEventBuiltinWithdrawal } from './tx-builtin-withdrawal'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { components } from '../../../../../types/explorer'; import omit from 'lodash/omit'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-withdrawal.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-withdrawal.tsx index 06ad25bfb..44b3140c0 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-withdrawal.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-builtin-withdrawal.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { TableRow, TableCell } from '../../../table'; import type { components } from '../../../../../types/explorer'; import { AssetLink, PartyLink } from '../../../links'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-delist.spec.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-delist.spec.tsx index 1ffc35317..7456aff8c 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-delist.spec.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-delist.spec.tsx @@ -1,5 +1,5 @@ import { render } from '@testing-library/react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { components } from '../../../../../types/explorer'; import omit from 'lodash/omit'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-delist.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-delist.tsx index f0143f8f8..36ce586af 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-delist.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-delist.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { TableRow, TableCell } from '../../../table'; import type { components } from '../../../../../types/explorer'; import { AssetLink } from '../../../links'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-limits-updated.spec.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-limits-updated.spec.tsx index bd8ee5408..69af0f55d 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-limits-updated.spec.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-limits-updated.spec.tsx @@ -1,5 +1,5 @@ import { render } from '@testing-library/react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { components } from '../../../../../types/explorer'; import omit from 'lodash/omit'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-limits-updated.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-limits-updated.tsx index f359cea53..394a16158 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-limits-updated.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-limits-updated.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { TableRow, TableCell } from '../../../table'; import type { components } from '../../../../../types/explorer'; import { AssetLink } from '../../../links'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-list.spec.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-list.spec.tsx index ef6436853..8cd93217c 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-list.spec.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-list.spec.tsx @@ -1,5 +1,5 @@ import { render } from '@testing-library/react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { components } from '../../../../../types/explorer'; import omit from 'lodash/omit'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-list.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-list.tsx index 537468fe2..597e317db 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-list.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-asset-list.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { TableRow, TableCell } from '../../../table'; import type { components } from '../../../../../types/explorer'; import { AssetLink } from '../../../links'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-bridge-pause.spec.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-bridge-pause.spec.tsx index b8db75286..7f6e1029a 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-bridge-pause.spec.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-bridge-pause.spec.tsx @@ -1,5 +1,5 @@ import { render } from '@testing-library/react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { TxDetailsChainEventErc20BridgePause } from './tx-erc20-bridge-pause'; describe('Chain Event: ERC20 bridge pause', () => { diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-bridge-pause.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-bridge-pause.tsx index 6217fb082..e2ccbbf00 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-bridge-pause.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-bridge-pause.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { TableRow, TableCell } from '../../../table'; export interface TxDetailsChainEventErc20BridgePauseProps { diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-deposit.spec.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-deposit.spec.tsx index 9452f615e..cb6720b1f 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-deposit.spec.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-deposit.spec.tsx @@ -1,5 +1,5 @@ import { render } from '@testing-library/react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { components } from '../../../../../types/explorer'; import omit from 'lodash/omit'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-deposit.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-deposit.tsx index f7495a266..9615a2537 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-deposit.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-deposit.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { TableRow, TableCell } from '../../../table'; import type { components } from '../../../../../types/explorer'; import { AssetLink, PartyLink } from '../../../links'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-withdrawal.spec.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-withdrawal.spec.tsx index b44926c44..97eeae76e 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-withdrawal.spec.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-withdrawal.spec.tsx @@ -1,5 +1,5 @@ import { render } from '@testing-library/react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { components } from '../../../../../types/explorer'; import omit from 'lodash/omit'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-withdrawal.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-withdrawal.tsx index 034d78f55..e34ab1a73 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-withdrawal.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-erc20-withdrawal.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { TableRow, TableCell } from '../../../table'; import type { components } from '../../../../../types/explorer'; import { AssetLink } from '../../../links'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-signer.spec.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-signer.spec.tsx index 039e11520..23dca02c0 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-signer.spec.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-signer.spec.tsx @@ -1,5 +1,5 @@ import { render } from '@testing-library/react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { components } from '../../../../../types/explorer'; import { MockedProvider } from '@apollo/client/testing'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-signer.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-signer.tsx index 9a0f9a115..9ad8dae22 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-signer.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-signer.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { TableRow, TableCell } from '../../../table'; import type { components } from '../../../../../types/explorer'; import { getBlockTime } from './lib/get-block-time'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-threshold.spec.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-threshold.spec.tsx index 1bfd31d06..df51ffee5 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-threshold.spec.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-threshold.spec.tsx @@ -1,5 +1,5 @@ import { render } from '@testing-library/react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { components } from '../../../../../types/explorer'; import { MockedProvider } from '@apollo/client/testing'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-threshold.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-threshold.tsx index c225b82b1..50209e0fc 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-threshold.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-multisig-threshold.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { TableRow, TableCell } from '../../../table'; import type { components } from '../../../../../types/explorer'; import isNumber from 'lodash/isNumber'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-deposit.spec.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-deposit.spec.tsx index 2f00e0314..47d7b6541 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-deposit.spec.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-deposit.spec.tsx @@ -1,5 +1,5 @@ import { render } from '@testing-library/react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { components } from '../../../../../types/explorer'; import omit from 'lodash/omit'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-deposit.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-deposit.tsx index 8e4bbb185..356f70f27 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-deposit.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-deposit.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { TableRow, TableCell } from '../../../table'; import type { components } from '../../../../../types/explorer'; import { PartyLink } from '../../../links'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-remove.spec.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-remove.spec.tsx index 555049abf..9b61ea8e8 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-remove.spec.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-remove.spec.tsx @@ -1,5 +1,5 @@ import { render } from '@testing-library/react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { components } from '../../../../../types/explorer'; import omit from 'lodash/omit'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-remove.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-remove.tsx index f3a60d424..54dcb3695 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-remove.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-remove.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { TableRow, TableCell } from '../../../table'; import type { components } from '../../../../../types/explorer'; import { PartyLink } from '../../../links'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-totalsupply.spec.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-totalsupply.spec.tsx index cc840655e..2294ebf11 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-totalsupply.spec.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-totalsupply.spec.tsx @@ -1,5 +1,5 @@ import { render } from '@testing-library/react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { components } from '../../../../../types/explorer'; import omit from 'lodash/omit'; diff --git a/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-totalsupply.tsx b/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-totalsupply.tsx index a423735ba..81ab43d86 100644 --- a/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-totalsupply.tsx +++ b/apps/explorer/src/app/components/txs/details/chain-events/tx-stake-totalsupply.tsx @@ -1,4 +1,5 @@ -import { formatNumber, t, toBigNum } from '@vegaprotocol/react-helpers'; +import { formatNumber, toBigNum } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { TableRow, TableCell } from '../../../table'; import type { components } from '../../../../../types/explorer'; import { diff --git a/apps/explorer/src/app/components/txs/details/liquidity-provision/components/liquidity-provision-details-row.tsx b/apps/explorer/src/app/components/txs/details/liquidity-provision/components/liquidity-provision-details-row.tsx index 3c7eb29fb..520ff5968 100644 --- a/apps/explorer/src/app/components/txs/details/liquidity-provision/components/liquidity-provision-details-row.tsx +++ b/apps/explorer/src/app/components/txs/details/liquidity-provision/components/liquidity-provision-details-row.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { components } from '../../../../../../types/explorer'; import { TableRow } from '../../../../table'; diff --git a/apps/explorer/src/app/components/txs/details/liquidity-provision/components/liquidity-provision-offset.tsx b/apps/explorer/src/app/components/txs/details/liquidity-provision/components/liquidity-provision-offset.tsx index e43a053d4..cad1e7019 100644 --- a/apps/explorer/src/app/components/txs/details/liquidity-provision/components/liquidity-provision-offset.tsx +++ b/apps/explorer/src/app/components/txs/details/liquidity-provision/components/liquidity-provision-offset.tsx @@ -1,5 +1,5 @@ import { useExplorerSettlementAssetForMarketQuery } from '../__generated__/Explorer-settlement-asset'; -import { addDecimalsFormatNumber } from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber } from '@vegaprotocol/utils'; import type { ExplorerSettlementAssetForMarketQuery } from '../__generated__/Explorer-settlement-asset'; import type { VegaSide } from './liquidity-provision-details-row'; diff --git a/apps/explorer/src/app/components/txs/details/liquidity-provision/liquidity-provision-details.tsx b/apps/explorer/src/app/components/txs/details/liquidity-provision/liquidity-provision-details.tsx index e9c9c4ff3..ae8de5113 100644 --- a/apps/explorer/src/app/components/txs/details/liquidity-provision/liquidity-provision-details.tsx +++ b/apps/explorer/src/app/components/txs/details/liquidity-provision/liquidity-provision-details.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { components } from '../../../../../types/explorer'; import type { LiquiditySubmission } from '../tx-liquidity-submission'; diff --git a/apps/explorer/src/app/components/txs/details/oracle-data/data-submission-json-oracle.tsx b/apps/explorer/src/app/components/txs/details/oracle-data/data-submission-json-oracle.tsx index 06562c2a1..b9afa226d 100644 --- a/apps/explorer/src/app/components/txs/details/oracle-data/data-submission-json-oracle.tsx +++ b/apps/explorer/src/app/components/txs/details/oracle-data/data-submission-json-oracle.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; interface JSONOracleDataProps { payload: string; diff --git a/apps/explorer/src/app/components/txs/details/oracle-data/data-submission-open-oracle.tsx b/apps/explorer/src/app/components/txs/details/oracle-data/data-submission-open-oracle.tsx index 4b312e341..c9c78f10c 100644 --- a/apps/explorer/src/app/components/txs/details/oracle-data/data-submission-open-oracle.tsx +++ b/apps/explorer/src/app/components/txs/details/oracle-data/data-submission-open-oracle.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { NestedDataList } from '../../../nested-data-list'; import { OpenOraclePrices } from './open-oracle/open-oracle-prices'; diff --git a/apps/explorer/src/app/components/txs/details/oracle-data/open-oracle/open-oracle-prices.tsx b/apps/explorer/src/app/components/txs/details/oracle-data/open-oracle/open-oracle-prices.tsx index 4b7199e65..4a44e9086 100644 --- a/apps/explorer/src/app/components/txs/details/oracle-data/open-oracle/open-oracle-prices.tsx +++ b/apps/explorer/src/app/components/txs/details/oracle-data/open-oracle/open-oracle-prices.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { CopyWithTooltip } from '@vegaprotocol/ui-toolkit'; import { TableRow } from '../../../../table'; import { TruncateInline } from '../../../../truncate/truncate'; diff --git a/apps/explorer/src/app/components/txs/details/shared/tx-details-shared.tsx b/apps/explorer/src/app/components/txs/details/shared/tx-details-shared.tsx index e7c892afc..39e6930e5 100644 --- a/apps/explorer/src/app/components/txs/details/shared/tx-details-shared.tsx +++ b/apps/explorer/src/app/components/txs/details/shared/tx-details-shared.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { TableRow, TableCell } from '../../../table'; import { BlockLink, PartyLink } from '../../../links/'; import { TimeAgo } from '../../../time-ago'; diff --git a/apps/explorer/src/app/components/txs/details/state-variable/bound-factors.tsx b/apps/explorer/src/app/components/txs/details/state-variable/bound-factors.tsx index 8260ec21e..28ea7880a 100644 --- a/apps/explorer/src/app/components/txs/details/state-variable/bound-factors.tsx +++ b/apps/explorer/src/app/components/txs/details/state-variable/bound-factors.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { components } from '../../../../../types/explorer'; import { Table, TableRow, TableHeader, TableCell } from '../../../table'; diff --git a/apps/explorer/src/app/components/txs/details/state-variable/risk-factors.tsx b/apps/explorer/src/app/components/txs/details/state-variable/risk-factors.tsx index e211f4f71..fb7db6b18 100644 --- a/apps/explorer/src/app/components/txs/details/state-variable/risk-factors.tsx +++ b/apps/explorer/src/app/components/txs/details/state-variable/risk-factors.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import zip from 'lodash/zip'; import type { components } from '../../../../../types/explorer'; import { Table, TableRow, TableHeader, TableCell } from '../../../table'; diff --git a/apps/explorer/src/app/components/txs/details/state-variable/trading-probability.tsx b/apps/explorer/src/app/components/txs/details/state-variable/trading-probability.tsx index f66a50432..b30fa3fb2 100644 --- a/apps/explorer/src/app/components/txs/details/state-variable/trading-probability.tsx +++ b/apps/explorer/src/app/components/txs/details/state-variable/trading-probability.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { components } from '../../../../../types/explorer'; import { Table, TableRow, TableHeader, TableCell } from '../../../table'; import { getValues } from './bound-factors'; diff --git a/apps/explorer/src/app/components/txs/details/transfer/blocks/transfer-participants.tsx b/apps/explorer/src/app/components/txs/details/transfer/blocks/transfer-participants.tsx index c49ae257b..b43d3423a 100644 --- a/apps/explorer/src/app/components/txs/details/transfer/blocks/transfer-participants.tsx +++ b/apps/explorer/src/app/components/txs/details/transfer/blocks/transfer-participants.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Icon, Tooltip } from '@vegaprotocol/ui-toolkit'; import { PartyLink } from '../../../../links'; import { diff --git a/apps/explorer/src/app/components/txs/details/transfer/blocks/transfer-repeat.tsx b/apps/explorer/src/app/components/txs/details/transfer/blocks/transfer-repeat.tsx index e29cf25ed..014ac9c85 100644 --- a/apps/explorer/src/app/components/txs/details/transfer/blocks/transfer-repeat.tsx +++ b/apps/explorer/src/app/components/txs/details/transfer/blocks/transfer-repeat.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Icon } from '@vegaprotocol/ui-toolkit'; import EpochOverview from '../../../../epoch-overview/epoch'; import { useExplorerFutureEpochQuery } from '../../../../epoch-overview/__generated__/Epoch'; diff --git a/apps/explorer/src/app/components/txs/details/transfer/blocks/transfer-rewards.tsx b/apps/explorer/src/app/components/txs/details/transfer/blocks/transfer-rewards.tsx index b9d9bb710..f3510f273 100644 --- a/apps/explorer/src/app/components/txs/details/transfer/blocks/transfer-rewards.tsx +++ b/apps/explorer/src/app/components/txs/details/transfer/blocks/transfer-rewards.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { AssetLink, MarketLink } from '../../../../links'; import { headerClasses, wrapperClasses } from '../transfer-details'; import type { components } from '../../../../../../types/explorer'; diff --git a/apps/explorer/src/app/components/txs/details/tx-batch.tsx b/apps/explorer/src/app/components/txs/details/tx-batch.tsx index 6272192c0..95fc4ba2b 100644 --- a/apps/explorer/src/app/components/txs/details/tx-batch.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-batch.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { BatchCancellationInstruction, BatchInstruction, diff --git a/apps/explorer/src/app/components/txs/details/tx-chain-event.tsx b/apps/explorer/src/app/components/txs/details/tx-chain-event.tsx index 5de5a5782..9cb410964 100644 --- a/apps/explorer/src/app/components/txs/details/tx-chain-event.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-chain-event.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { TxDetailsShared } from './shared/tx-details-shared'; import { TableWithTbody } from '../../table'; diff --git a/apps/explorer/src/app/components/txs/details/tx-data-submission.tsx b/apps/explorer/src/app/components/txs/details/tx-data-submission.tsx index e3a994d7b..c92ecdc01 100644 --- a/apps/explorer/src/app/components/txs/details/tx-data-submission.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-data-submission.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; import { TxDetailsShared } from './shared/tx-details-shared'; diff --git a/apps/explorer/src/app/components/txs/details/tx-delegation.tsx b/apps/explorer/src/app/components/txs/details/tx-delegation.tsx index 4dfe1c553..32ba16c3e 100644 --- a/apps/explorer/src/app/components/txs/details/tx-delegation.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-delegation.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; import { TxDetailsShared } from './shared/tx-details-shared'; diff --git a/apps/explorer/src/app/components/txs/details/tx-details-protocol-upgrade.tsx b/apps/explorer/src/app/components/txs/details/tx-details-protocol-upgrade.tsx index 3002e2393..91bd7782d 100644 --- a/apps/explorer/src/app/components/txs/details/tx-details-protocol-upgrade.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-details-protocol-upgrade.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { TxDetailsShared } from './shared/tx-details-shared'; import { TableCell, TableRow, TableWithTbody } from '../../table'; import { BlockLink } from '../../links'; diff --git a/apps/explorer/src/app/components/txs/details/tx-details-wrapper.tsx b/apps/explorer/src/app/components/txs/details/tx-details-wrapper.tsx index 23aaf671f..117000aaa 100644 --- a/apps/explorer/src/app/components/txs/details/tx-details-wrapper.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-details-wrapper.tsx @@ -1,6 +1,7 @@ import { useMemo } from 'react'; import { DATA_SOURCES } from '../../../config'; -import { t, useFetch } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; +import { useFetch } from '@vegaprotocol/react-helpers'; import { TxDetailsOrder } from './tx-order'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; diff --git a/apps/explorer/src/app/components/txs/details/tx-eth-key-rotate.tsx b/apps/explorer/src/app/components/txs/details/tx-eth-key-rotate.tsx index a38258838..ecd49e6c6 100644 --- a/apps/explorer/src/app/components/txs/details/tx-eth-key-rotate.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-eth-key-rotate.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; import { TxDetailsShared } from './shared/tx-details-shared'; diff --git a/apps/explorer/src/app/components/txs/details/tx-generic.tsx b/apps/explorer/src/app/components/txs/details/tx-generic.tsx index 21efd825c..1620a2de8 100644 --- a/apps/explorer/src/app/components/txs/details/tx-generic.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-generic.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; import { TxDetailsShared } from './shared/tx-details-shared'; diff --git a/apps/explorer/src/app/components/txs/details/tx-hearbeat.tsx b/apps/explorer/src/app/components/txs/details/tx-hearbeat.tsx index b5204e0a5..7e51f93de 100644 --- a/apps/explorer/src/app/components/txs/details/tx-hearbeat.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-hearbeat.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import { BlockLink, NodeLink } from '../../links/'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; diff --git a/apps/explorer/src/app/components/txs/details/tx-issue-signatures.tsx b/apps/explorer/src/app/components/txs/details/tx-issue-signatures.tsx index a3c55929a..4cc4967ea 100644 --- a/apps/explorer/src/app/components/txs/details/tx-issue-signatures.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-issue-signatures.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; import { TxDetailsShared } from './shared/tx-details-shared'; diff --git a/apps/explorer/src/app/components/txs/details/tx-key-rotate.tsx b/apps/explorer/src/app/components/txs/details/tx-key-rotate.tsx index 35dd80725..dde68583b 100644 --- a/apps/explorer/src/app/components/txs/details/tx-key-rotate.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-key-rotate.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; import { TxDetailsShared } from './shared/tx-details-shared'; diff --git a/apps/explorer/src/app/components/txs/details/tx-liquidity-amend.tsx b/apps/explorer/src/app/components/txs/details/tx-liquidity-amend.tsx index 7e06b47fc..bc9fc350f 100644 --- a/apps/explorer/src/app/components/txs/details/tx-liquidity-amend.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-liquidity-amend.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import { MarketLink } from '../../links'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; diff --git a/apps/explorer/src/app/components/txs/details/tx-liquidity-cancel.tsx b/apps/explorer/src/app/components/txs/details/tx-liquidity-cancel.tsx index 4dfe1d21b..759d1114a 100644 --- a/apps/explorer/src/app/components/txs/details/tx-liquidity-cancel.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-liquidity-cancel.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { MarketLink } from '../../links'; import { TxDetailsShared } from './shared/tx-details-shared'; import { TableCell, TableRow, TableWithTbody } from '../../table'; diff --git a/apps/explorer/src/app/components/txs/details/tx-liquidity-submission.tsx b/apps/explorer/src/app/components/txs/details/tx-liquidity-submission.tsx index a0d513c8b..cba6d8f32 100644 --- a/apps/explorer/src/app/components/txs/details/tx-liquidity-submission.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-liquidity-submission.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import { MarketLink } from '../../links/'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; diff --git a/apps/explorer/src/app/components/txs/details/tx-node-announce.tsx b/apps/explorer/src/app/components/txs/details/tx-node-announce.tsx index 7c8add106..46a9806d8 100644 --- a/apps/explorer/src/app/components/txs/details/tx-node-announce.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-node-announce.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; import { TxDetailsShared } from './shared/tx-details-shared'; diff --git a/apps/explorer/src/app/components/txs/details/tx-node-vote.tsx b/apps/explorer/src/app/components/txs/details/tx-node-vote.tsx index db140cb33..f5159cae2 100644 --- a/apps/explorer/src/app/components/txs/details/tx-node-vote.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-node-vote.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; import { TxDetailsShared } from './shared/tx-details-shared'; diff --git a/apps/explorer/src/app/components/txs/details/tx-order-amend.tsx b/apps/explorer/src/app/components/txs/details/tx-order-amend.tsx index 4dc5c95e9..380a5d949 100644 --- a/apps/explorer/src/app/components/txs/details/tx-order-amend.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-order-amend.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import { MarketLink } from '../../links'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; diff --git a/apps/explorer/src/app/components/txs/details/tx-order-cancel.tsx b/apps/explorer/src/app/components/txs/details/tx-order-cancel.tsx index 3d38d876c..d0074b8e4 100644 --- a/apps/explorer/src/app/components/txs/details/tx-order-cancel.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-order-cancel.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import { MarketLink } from '../../links/'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; diff --git a/apps/explorer/src/app/components/txs/details/tx-order.tsx b/apps/explorer/src/app/components/txs/details/tx-order.tsx index bc7e685ae..57faafa85 100644 --- a/apps/explorer/src/app/components/txs/details/tx-order.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-order.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import { MarketLink } from '../../links/'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; diff --git a/apps/explorer/src/app/components/txs/details/tx-proposal-vote.tsx b/apps/explorer/src/app/components/txs/details/tx-proposal-vote.tsx index d4c82055a..b0b62a4ff 100644 --- a/apps/explorer/src/app/components/txs/details/tx-proposal-vote.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-proposal-vote.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; import { TxDetailsShared } from './shared/tx-details-shared'; diff --git a/apps/explorer/src/app/components/txs/details/tx-state-variable-proposal.tsx b/apps/explorer/src/app/components/txs/details/tx-state-variable-proposal.tsx index 0f131360b..33e2d1db7 100644 --- a/apps/explorer/src/app/components/txs/details/tx-state-variable-proposal.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-state-variable-proposal.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { TxDetailsShared } from './shared/tx-details-shared'; import { TableCell, TableRow, TableWithTbody } from '../../table'; import { MarketLink } from '../../links'; diff --git a/apps/explorer/src/app/components/txs/details/tx-transfer.tsx b/apps/explorer/src/app/components/txs/details/tx-transfer.tsx index 9329abc27..85790687d 100644 --- a/apps/explorer/src/app/components/txs/details/tx-transfer.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-transfer.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; import { sharedHeaderProps, TxDetailsShared } from './shared/tx-details-shared'; diff --git a/apps/explorer/src/app/components/txs/details/tx-undelegation.tsx b/apps/explorer/src/app/components/txs/details/tx-undelegation.tsx index 4fc4875f2..bd35129da 100644 --- a/apps/explorer/src/app/components/txs/details/tx-undelegation.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-undelegation.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; import { TxDetailsShared } from './shared/tx-details-shared'; diff --git a/apps/explorer/src/app/components/txs/details/tx-withdraw-submission.tsx b/apps/explorer/src/app/components/txs/details/tx-withdraw-submission.tsx index 7ecb5deab..2377e29e8 100644 --- a/apps/explorer/src/app/components/txs/details/tx-withdraw-submission.tsx +++ b/apps/explorer/src/app/components/txs/details/tx-withdraw-submission.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response'; import { TxDetailsShared } from './shared/tx-details-shared'; diff --git a/apps/explorer/src/app/components/txs/tx-data-view.tsx b/apps/explorer/src/app/components/txs/tx-data-view.tsx index 5370b5aa9..ea2b8f038 100644 --- a/apps/explorer/src/app/components/txs/tx-data-view.tsx +++ b/apps/explorer/src/app/components/txs/tx-data-view.tsx @@ -1,5 +1,5 @@ import { useState } from 'react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import get from 'lodash/get'; import { Select } from '@vegaprotocol/ui-toolkit'; diff --git a/apps/explorer/src/app/components/txs/tx-list.tsx b/apps/explorer/src/app/components/txs/tx-list.tsx index cd55be663..d87828651 100644 --- a/apps/explorer/src/app/components/txs/tx-list.tsx +++ b/apps/explorer/src/app/components/txs/tx-list.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { TendermintUnconfirmedTransactionsResponse } from '../../routes/txs/tendermint-unconfirmed-transactions-response.d'; interface TxsProps { diff --git a/apps/explorer/src/app/components/txs/tx-order-type.tsx b/apps/explorer/src/app/components/txs/tx-order-type.tsx index 41ef7b68e..cb11be8d8 100644 --- a/apps/explorer/src/app/components/txs/tx-order-type.tsx +++ b/apps/explorer/src/app/components/txs/tx-order-type.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { components } from '../../../types/explorer'; interface TxOrderTypeProps { diff --git a/apps/explorer/src/app/components/txs/txs-infinite-list.tsx b/apps/explorer/src/app/components/txs/txs-infinite-list.tsx index 1ca72187d..6ce52bfd0 100644 --- a/apps/explorer/src/app/components/txs/txs-infinite-list.tsx +++ b/apps/explorer/src/app/components/txs/txs-infinite-list.tsx @@ -1,7 +1,8 @@ import React from 'react'; import { FixedSizeList as List } from 'react-window'; import InfiniteLoader from 'react-window-infinite-loader'; -import { t, useScreenDimensions } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; +import { useScreenDimensions } from '@vegaprotocol/react-helpers'; import { TxsInfiniteListItem } from './txs-infinite-list-item'; import type { BlockExplorerTransactionResult } from '../../routes/types/block-explorer-response'; import EmptyList from '../empty-list/empty-list'; diff --git a/apps/explorer/src/app/components/txs/txs-per-block.tsx b/apps/explorer/src/app/components/txs/txs-per-block.tsx index afd1e0a19..6acf31d26 100644 --- a/apps/explorer/src/app/components/txs/txs-per-block.tsx +++ b/apps/explorer/src/app/components/txs/txs-per-block.tsx @@ -3,7 +3,8 @@ import { RenderFetched } from '../render-fetched'; import { TruncatedLink } from '../truncate/truncated-link'; import { TxOrderType } from './tx-order-type'; import { Table, TableRow, TableCell } from '../table'; -import { t, useFetch } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; +import { useFetch } from '@vegaprotocol/react-helpers'; import type { BlockExplorerTransactions } from '../../routes/types/block-explorer-response'; import isNumber from 'lodash/isNumber'; import { ChainResponseCode } from './details/chain-response-code/chain-reponse.code'; diff --git a/apps/explorer/src/app/components/withdrawal/withdrawal-progress.tsx b/apps/explorer/src/app/components/withdrawal/withdrawal-progress.tsx index c59628310..02daa7e40 100644 --- a/apps/explorer/src/app/components/withdrawal/withdrawal-progress.tsx +++ b/apps/explorer/src/app/components/withdrawal/withdrawal-progress.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { ReactNode } from 'react'; import { Time } from '../time'; import { useExplorerWithdrawalQuery } from './__generated__/Withdrawal'; diff --git a/apps/explorer/src/app/routes/assets/asset-page.tsx b/apps/explorer/src/app/routes/assets/asset-page.tsx index d3b3cac3b..9288bafab 100644 --- a/apps/explorer/src/app/routes/assets/asset-page.tsx +++ b/apps/explorer/src/app/routes/assets/asset-page.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { AsyncRenderer, Button } from '@vegaprotocol/ui-toolkit'; import { useScrollToLocation } from '../../hooks/scroll-to-location'; import { useDocumentTitle } from '../../hooks/use-document-title'; diff --git a/apps/explorer/src/app/routes/assets/assets-page.tsx b/apps/explorer/src/app/routes/assets/assets-page.tsx index 72f42d046..6d573183c 100644 --- a/apps/explorer/src/app/routes/assets/assets-page.tsx +++ b/apps/explorer/src/app/routes/assets/assets-page.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { RouteTitle } from '../../components/route-title'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; import { useScrollToLocation } from '../../hooks/scroll-to-location'; diff --git a/apps/explorer/src/app/routes/blocks/home/index.tsx b/apps/explorer/src/app/routes/blocks/home/index.tsx index c742cab5e..a92050a7d 100644 --- a/apps/explorer/src/app/routes/blocks/home/index.tsx +++ b/apps/explorer/src/app/routes/blocks/home/index.tsx @@ -8,7 +8,8 @@ import { RouteTitle } from '../../../components/route-title'; import { BlocksRefetch } from '../../../components/blocks'; import { BlocksInfiniteList } from '../../../components/blocks/blocks-infinite-list'; import { JumpToBlock } from '../../../components/jump-to-block'; -import { t, useFetch } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; +import { useFetch } from '@vegaprotocol/react-helpers'; import { useDocumentTitle } from '../../../hooks/use-document-title'; // This constant should only be changed if Tendermint API changes the max blocks returned diff --git a/apps/explorer/src/app/routes/blocks/id/block.tsx b/apps/explorer/src/app/routes/blocks/id/block.tsx index aa102a085..20643dab9 100644 --- a/apps/explorer/src/app/routes/blocks/id/block.tsx +++ b/apps/explorer/src/app/routes/blocks/id/block.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { Link, useParams } from 'react-router-dom'; import { DATA_SOURCES } from '../../../config'; -import { getDateTimeFormat } from '@vegaprotocol/react-helpers'; +import { getDateTimeFormat } from '@vegaprotocol/utils'; import type { TendermintBlocksResponse } from '../tendermint-blocks-response'; import { RouteTitle } from '../../../components/route-title'; import { TimeAgo } from '../../../components/time-ago'; @@ -15,7 +15,8 @@ import { TxsPerBlock } from '../../../components/txs/txs-per-block'; import { Button } from '@vegaprotocol/ui-toolkit'; import { Routes } from '../../route-names'; import { RenderFetched } from '../../../components/render-fetched'; -import { t, useFetch } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; +import { useFetch } from '@vegaprotocol/react-helpers'; import { NodeLink } from '../../../components/links'; import { useDocumentTitle } from '../../../hooks/use-document-title'; import EmptyList from '../../../components/empty-list/empty-list'; diff --git a/apps/explorer/src/app/routes/genesis/index.tsx b/apps/explorer/src/app/routes/genesis/index.tsx index 7c5126290..225ea2ed6 100644 --- a/apps/explorer/src/app/routes/genesis/index.tsx +++ b/apps/explorer/src/app/routes/genesis/index.tsx @@ -1,4 +1,5 @@ -import { t, useFetch } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; +import { useFetch } from '@vegaprotocol/react-helpers'; import { RouteTitle } from '../../components/route-title'; import { Loader, SyntaxHighlighter } from '@vegaprotocol/ui-toolkit'; import { DATA_SOURCES } from '../../config'; diff --git a/apps/explorer/src/app/routes/governance/proposals-page.tsx b/apps/explorer/src/app/routes/governance/proposals-page.tsx index 538f950d1..0f05026fb 100644 --- a/apps/explorer/src/app/routes/governance/proposals-page.tsx +++ b/apps/explorer/src/app/routes/governance/proposals-page.tsx @@ -1,5 +1,6 @@ -import { proposalsDataProvider } from '@vegaprotocol/governance'; -import { t, useDataProvider } from '@vegaprotocol/react-helpers'; +import { proposalsDataProvider } from '@vegaprotocol/proposals'; +import { t } from '@vegaprotocol/i18n'; +import { useDataProvider } from '@vegaprotocol/react-helpers'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; import { ProposalsTable } from '../../components/proposals/proposals-table'; import { RouteTitle } from '../../components/route-title'; diff --git a/apps/explorer/src/app/routes/markets/market-page.tsx b/apps/explorer/src/app/routes/markets/market-page.tsx index d1483a935..63362ee10 100644 --- a/apps/explorer/src/app/routes/markets/market-page.tsx +++ b/apps/explorer/src/app/routes/markets/market-page.tsx @@ -1,4 +1,5 @@ -import { t, useDataProvider } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; +import { useDataProvider } from '@vegaprotocol/react-helpers'; import { AsyncRenderer, Button } from '@vegaprotocol/ui-toolkit'; import { useMemo, useState } from 'react'; import { useParams } from 'react-router-dom'; diff --git a/apps/explorer/src/app/routes/markets/markets-page.tsx b/apps/explorer/src/app/routes/markets/markets-page.tsx index 04033c957..d422e6aa8 100644 --- a/apps/explorer/src/app/routes/markets/markets-page.tsx +++ b/apps/explorer/src/app/routes/markets/markets-page.tsx @@ -3,7 +3,8 @@ import { useDocumentTitle } from '../../hooks/use-document-title'; import { marketsProvider } from '@vegaprotocol/market-list'; import { RouteTitle } from '../../components/route-title'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; -import { t, useDataProvider } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; +import { useDataProvider } from '@vegaprotocol/react-helpers'; import { MarketsTable } from '../../components/markets/markets-table'; export const MarketsPage = () => { diff --git a/apps/explorer/src/app/routes/network-parameters/network-parameters.tsx b/apps/explorer/src/app/routes/network-parameters/network-parameters.tsx index fa8684038..c9ffa72a6 100644 --- a/apps/explorer/src/app/routes/network-parameters/network-parameters.tsx +++ b/apps/explorer/src/app/routes/network-parameters/network-parameters.tsx @@ -9,11 +9,11 @@ import { formatNumber, removePaginationWrapper, suitableForSyntaxHighlighter, - t, - useNetworkParamsQuery, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { RouteTitle } from '../../components/route-title'; import orderBy from 'lodash/orderBy'; +import { useNetworkParamsQuery } from '@vegaprotocol/react-helpers'; import type { NetworkParamsQuery } from '@vegaprotocol/react-helpers'; import { useScrollToLocation } from '../../hooks/scroll-to-location'; import { useDocumentTitle } from '../../hooks/use-document-title'; diff --git a/apps/explorer/src/app/routes/oracles/components/oracle-data.tsx b/apps/explorer/src/app/routes/oracles/components/oracle-data.tsx index 5bd4b75fc..feb73368a 100644 --- a/apps/explorer/src/app/routes/oracles/components/oracle-data.tsx +++ b/apps/explorer/src/app/routes/oracles/components/oracle-data.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { SyntaxHighlighter } from '@vegaprotocol/ui-toolkit'; import filter from 'recursive-key-filter'; import type { ExplorerOracleDataConnectionFragment } from '../__generated__/Oracles'; diff --git a/apps/explorer/src/app/routes/oracles/components/oracle-filter.tsx b/apps/explorer/src/app/routes/oracles/components/oracle-filter.tsx index 62b373a09..4fce780cf 100644 --- a/apps/explorer/src/app/routes/oracles/components/oracle-filter.tsx +++ b/apps/explorer/src/app/routes/oracles/components/oracle-filter.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { SyntaxHighlighter } from '@vegaprotocol/ui-toolkit'; import filter from 'recursive-key-filter'; import type { ExplorerOracleDataSourceFragment } from '../__generated__/Oracles'; diff --git a/apps/explorer/src/app/routes/oracles/components/oracle-markets.tsx b/apps/explorer/src/app/routes/oracles/components/oracle-markets.tsx index 195847f0d..a77486b47 100644 --- a/apps/explorer/src/app/routes/oracles/components/oracle-markets.tsx +++ b/apps/explorer/src/app/routes/oracles/components/oracle-markets.tsx @@ -1,4 +1,5 @@ -import { getNodes, t } from '@vegaprotocol/react-helpers'; +import { getNodes } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { MarketLink } from '../../../components/links'; import { TableRow, TableCell, TableHeader } from '../../../components/table'; import type { ExplorerOracleForMarketsMarketFragment } from '../__generated__/OraclesForMarkets'; diff --git a/apps/explorer/src/app/routes/oracles/components/oracle-signers.tsx b/apps/explorer/src/app/routes/oracles/components/oracle-signers.tsx index 428e6410e..3e8bdf325 100644 --- a/apps/explorer/src/app/routes/oracles/components/oracle-signers.tsx +++ b/apps/explorer/src/app/routes/oracles/components/oracle-signers.tsx @@ -4,7 +4,7 @@ import { EthExplorerLinkTypes, } from '../../../components/links/eth-explorer-link/eth-explorer-link'; import { TableRow, TableCell, TableHeader } from '../../../components/table'; -import { remove0x } from '@vegaprotocol/react-helpers'; +import { remove0x } from '@vegaprotocol/utils'; import type { SourceType } from './oracle'; diff --git a/apps/explorer/src/app/routes/oracles/components/oracle.tsx b/apps/explorer/src/app/routes/oracles/components/oracle.tsx index efb7a2f1e..ec1c625d8 100644 --- a/apps/explorer/src/app/routes/oracles/components/oracle.tsx +++ b/apps/explorer/src/app/routes/oracles/components/oracle.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { TableRow, TableCell, diff --git a/apps/explorer/src/app/routes/oracles/home/index.tsx b/apps/explorer/src/app/routes/oracles/home/index.tsx index d999b789b..192fb6891 100644 --- a/apps/explorer/src/app/routes/oracles/home/index.tsx +++ b/apps/explorer/src/app/routes/oracles/home/index.tsx @@ -1,6 +1,6 @@ import { Loader, SyntaxHighlighter } from '@vegaprotocol/ui-toolkit'; import { RouteTitle } from '../../../components/route-title'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { useExplorerOracleSpecsQuery } from '../__generated__/Oracles'; import { useDocumentTitle } from '../../../hooks/use-document-title'; import { OracleDetails } from '../components/oracle'; diff --git a/apps/explorer/src/app/routes/oracles/id/index.tsx b/apps/explorer/src/app/routes/oracles/id/index.tsx index ca23b6647..0362c6f66 100644 --- a/apps/explorer/src/app/routes/oracles/id/index.tsx +++ b/apps/explorer/src/app/routes/oracles/id/index.tsx @@ -1,6 +1,7 @@ import { RouteTitle } from '../../../components/route-title'; import { RenderFetched } from '../../../components/render-fetched'; -import { t, truncateByChars } from '@vegaprotocol/react-helpers'; +import { truncateByChars } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { useDocumentTitle } from '../../../hooks/use-document-title'; import { useParams } from 'react-router-dom'; import { useExplorerOracleSpecByIdQuery } from '../__generated__/Oracles'; diff --git a/apps/explorer/src/app/routes/parties/home/index.tsx b/apps/explorer/src/app/routes/parties/home/index.tsx index 99096c35a..56a092b63 100644 --- a/apps/explorer/src/app/routes/parties/home/index.tsx +++ b/apps/explorer/src/app/routes/parties/home/index.tsx @@ -4,7 +4,7 @@ import { JumpTo } from '../../../components/jump-to'; import { useNavigate } from 'react-router-dom'; import { Routes } from '../../route-names'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { useDocumentTitle } from '../../../hooks/use-document-title'; export const JumpToParty = () => { diff --git a/apps/explorer/src/app/routes/parties/id/components/party-accounts.tsx b/apps/explorer/src/app/routes/parties/id/components/party-accounts.tsx index 759c3cac7..5259a7410 100644 --- a/apps/explorer/src/app/routes/parties/id/components/party-accounts.tsx +++ b/apps/explorer/src/app/routes/parties/id/components/party-accounts.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import get from 'lodash/get'; import AssetBalance from '../../../../components/asset-balance/asset-balance'; import { AssetLink, MarketLink } from '../../../../components/links'; diff --git a/apps/explorer/src/app/routes/parties/id/components/party-id-error.tsx b/apps/explorer/src/app/routes/parties/id/components/party-id-error.tsx index be2799ef9..7bddd618c 100644 --- a/apps/explorer/src/app/routes/parties/id/components/party-id-error.tsx +++ b/apps/explorer/src/app/routes/parties/id/components/party-id-error.tsx @@ -1,4 +1,5 @@ -import { remove0x, t } from '@vegaprotocol/react-helpers'; +import { remove0x } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import type { ApolloError } from '@apollo/client'; export function isValidPartyId(rawId: string) { diff --git a/apps/explorer/src/app/routes/parties/id/index.tsx b/apps/explorer/src/app/routes/parties/id/index.tsx index cb5f3c662..a2764de41 100644 --- a/apps/explorer/src/app/routes/parties/id/index.tsx +++ b/apps/explorer/src/app/routes/parties/id/index.tsx @@ -1,4 +1,6 @@ -import { getNodes, t, useScreenDimensions } from '@vegaprotocol/react-helpers'; +import { getNodes } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; +import { useScreenDimensions } from '@vegaprotocol/react-helpers'; import { useMemo } from 'react'; import { useParams } from 'react-router-dom'; import { SubHeading } from '../../../components/sub-heading'; diff --git a/apps/explorer/src/app/routes/pending/index.tsx b/apps/explorer/src/app/routes/pending/index.tsx index 6adcf382a..5c0834875 100644 --- a/apps/explorer/src/app/routes/pending/index.tsx +++ b/apps/explorer/src/app/routes/pending/index.tsx @@ -3,7 +3,8 @@ import { DATA_SOURCES } from '../../config'; import type { TendermintUnconfirmedTransactionsResponse } from '../txs/tendermint-unconfirmed-transactions-response.d'; import { TxList } from '../../components/txs'; import { RouteTitle } from '../../components/route-title'; -import { t, useFetch } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; +import { useFetch } from '@vegaprotocol/react-helpers'; import { useDocumentTitle } from '../../hooks/use-document-title'; const PendingTxs = () => { diff --git a/apps/explorer/src/app/routes/router-config.tsx b/apps/explorer/src/app/routes/router-config.tsx index ade048209..772b60c64 100644 --- a/apps/explorer/src/app/routes/router-config.tsx +++ b/apps/explorer/src/app/routes/router-config.tsx @@ -17,7 +17,7 @@ import { Tx } from './txs/id'; import { TxsList } from './txs/home'; import { PendingTxs } from './pending'; import flags from '../config/flags'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Routes } from './route-names'; import { NetworkParameters } from './network-parameters'; import type { RouteObject } from 'react-router-dom'; diff --git a/apps/explorer/src/app/routes/txs/home/index.tsx b/apps/explorer/src/app/routes/txs/home/index.tsx index a81ed928b..08f839739 100644 --- a/apps/explorer/src/app/routes/txs/home/index.tsx +++ b/apps/explorer/src/app/routes/txs/home/index.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { RouteTitle } from '../../../components/route-title'; import { BlocksRefetch } from '../../../components/blocks'; import { TxsInfiniteList } from '../../../components/txs'; diff --git a/apps/explorer/src/app/routes/txs/id/index.tsx b/apps/explorer/src/app/routes/txs/id/index.tsx index 882b9877f..2957f2092 100644 --- a/apps/explorer/src/app/routes/txs/id/index.tsx +++ b/apps/explorer/src/app/routes/txs/id/index.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { Link, useParams } from 'react-router-dom'; -import { remove0x, useFetch } from '@vegaprotocol/react-helpers'; +import { remove0x } from '@vegaprotocol/utils'; +import { useFetch } from '@vegaprotocol/react-helpers'; import { DATA_SOURCES } from '../../../config'; import { RenderFetched } from '../../../components/render-fetched'; import { TxDetails } from './tx-details'; diff --git a/apps/explorer/src/app/routes/txs/id/tx-content.tsx b/apps/explorer/src/app/routes/txs/id/tx-content.tsx index 62d4e71d2..1e2c23d45 100644 --- a/apps/explorer/src/app/routes/txs/id/tx-content.tsx +++ b/apps/explorer/src/app/routes/txs/id/tx-content.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { StatusMessage } from '../../../components/status-message'; import { NestedDataList } from '../../../components/nested-data-list'; import type { UnknownObject } from '../../../components/nested-data-list'; diff --git a/apps/explorer/src/app/routes/txs/id/tx-details.tsx b/apps/explorer/src/app/routes/txs/id/tx-details.tsx index 06a0e149b..2c9892110 100644 --- a/apps/explorer/src/app/routes/txs/id/tx-details.tsx +++ b/apps/explorer/src/app/routes/txs/id/tx-details.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response'; import { TxDetailsWrapper } from '../../../components/txs/details/tx-details-wrapper'; diff --git a/apps/explorer/src/app/routes/validators/validators-page.tsx b/apps/explorer/src/app/routes/validators/validators-page.tsx index 1cbc6851f..cf70d1547 100644 --- a/apps/explorer/src/app/routes/validators/validators-page.tsx +++ b/apps/explorer/src/app/routes/validators/validators-page.tsx @@ -1,4 +1,5 @@ -import { countryCodeToFlagEmoji, t } from '@vegaprotocol/react-helpers'; +import { countryCodeToFlagEmoji } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { AsyncRenderer, Button, diff --git a/apps/token-e2e/.env b/apps/governance-e2e/.env similarity index 100% rename from apps/token-e2e/.env rename to apps/governance-e2e/.env diff --git a/apps/token-e2e/.env.devnet b/apps/governance-e2e/.env.devnet similarity index 100% rename from apps/token-e2e/.env.devnet rename to apps/governance-e2e/.env.devnet diff --git a/apps/token-e2e/.env.mainnet b/apps/governance-e2e/.env.mainnet similarity index 100% rename from apps/token-e2e/.env.mainnet rename to apps/governance-e2e/.env.mainnet diff --git a/apps/token-e2e/.env.stagnet3 b/apps/governance-e2e/.env.stagnet3 similarity index 100% rename from apps/token-e2e/.env.stagnet3 rename to apps/governance-e2e/.env.stagnet3 diff --git a/apps/token-e2e/.env.testnet b/apps/governance-e2e/.env.testnet similarity index 100% rename from apps/token-e2e/.env.testnet rename to apps/governance-e2e/.env.testnet diff --git a/apps/token-e2e/.eslintrc.json b/apps/governance-e2e/.eslintrc.json similarity index 100% rename from apps/token-e2e/.eslintrc.json rename to apps/governance-e2e/.eslintrc.json diff --git a/apps/token-e2e/README.md b/apps/governance-e2e/README.md similarity index 84% rename from apps/token-e2e/README.md rename to apps/governance-e2e/README.md index b38535602..d55f35211 100644 --- a/apps/token-e2e/README.md +++ b/apps/governance-e2e/README.md @@ -3,13 +3,13 @@ To run the UI automation tests with Vega Capsule, run: ```bash -yarn nx run token-e2e:e2e +yarn nx run governance-e2e:e2e ``` To open Cypress and run in interactive mode, run: ```bash -yarn nx run token-e2e:e2e --watch +yarn nx run governance-e2e:e2e --watch ``` ## Vega Capsule Setup @@ -36,4 +36,4 @@ vegacapsule network bootstrap --config-path=../frontend-monorepo/vegacapsule/con You can then refer to (or run) `frontend-monorepo/vegacapsule/setup-vegawallet.sh`. This will initialise and configure your wallet to have the correct public keys and network config to run against capsule. -Go to the .env file in `apps/token-e2e` and set the `CYPRESS_VEGA_WALLET_API_TOKEN` environment variable by pasting in your wallets long lived api token +Go to the .env file in `apps/governance-e2e` and set the `CYPRESS_VEGA_WALLET_API_TOKEN` environment variable by pasting in your wallets long lived api token diff --git a/apps/token-e2e/cypress.config.js b/apps/governance-e2e/cypress.config.js similarity index 100% rename from apps/token-e2e/cypress.config.js rename to apps/governance-e2e/cypress.config.js diff --git a/apps/token-e2e/project.json b/apps/governance-e2e/project.json similarity index 58% rename from apps/token-e2e/project.json rename to apps/governance-e2e/project.json index a0e139abb..c5bb3559c 100644 --- a/apps/token-e2e/project.json +++ b/apps/governance-e2e/project.json @@ -1,17 +1,17 @@ { "$schema": "../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "apps/token-e2e/src", + "sourceRoot": "apps/governance-e2e/src", "projectType": "application", "targets": { "e2e": { "executor": "@nrwl/cypress:cypress", "options": { - "cypressConfig": "apps/token-e2e/cypress.config.js", - "devServerTarget": "token:serve" + "cypressConfig": "apps/governance-e2e/cypress.config.js", + "devServerTarget": "governance:serve" }, "configurations": { "production": { - "devServerTarget": "token:serve:production" + "devServerTarget": "governance:serve:production" } } }, @@ -19,17 +19,17 @@ "executor": "@nrwl/linter:eslint", "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": ["apps/token-e2e/**/*.{js,ts}"] + "lintFilePatterns": ["apps/governance-e2e/**/*.{js,ts}"] } }, "build": { "executor": "@nrwl/workspace:run-commands", "outputs": [], "options": { - "command": "yarn tsc --project ./apps/token-e2e/" + "command": "yarn tsc --project ./apps/governance-e2e/" } } }, "tags": [], - "implicitDependencies": ["token"] + "implicitDependencies": ["governance"] } diff --git a/apps/token-e2e/src/fixtures/proposals/asset.json b/apps/governance-e2e/src/fixtures/proposals/asset.json similarity index 100% rename from apps/token-e2e/src/fixtures/proposals/asset.json rename to apps/governance-e2e/src/fixtures/proposals/asset.json diff --git a/apps/token-e2e/src/fixtures/proposals/new-asset.json b/apps/governance-e2e/src/fixtures/proposals/new-asset.json similarity index 100% rename from apps/token-e2e/src/fixtures/proposals/new-asset.json rename to apps/governance-e2e/src/fixtures/proposals/new-asset.json diff --git a/apps/token-e2e/src/fixtures/proposals/new-market.json b/apps/governance-e2e/src/fixtures/proposals/new-market.json similarity index 100% rename from apps/token-e2e/src/fixtures/proposals/new-market.json rename to apps/governance-e2e/src/fixtures/proposals/new-market.json diff --git a/apps/token-e2e/src/fixtures/proposals/raw.json b/apps/governance-e2e/src/fixtures/proposals/raw.json similarity index 100% rename from apps/token-e2e/src/fixtures/proposals/raw.json rename to apps/governance-e2e/src/fixtures/proposals/raw.json diff --git a/apps/token-e2e/src/fixtures/proposals/update-asset.json b/apps/governance-e2e/src/fixtures/proposals/update-asset.json similarity index 100% rename from apps/token-e2e/src/fixtures/proposals/update-asset.json rename to apps/governance-e2e/src/fixtures/proposals/update-asset.json diff --git a/apps/token-e2e/src/fixtures/proposals/update-market.json b/apps/governance-e2e/src/fixtures/proposals/update-market.json similarity index 100% rename from apps/token-e2e/src/fixtures/proposals/update-market.json rename to apps/governance-e2e/src/fixtures/proposals/update-market.json diff --git a/apps/token-e2e/src/fixtures/wallet/passphrase b/apps/governance-e2e/src/fixtures/wallet/passphrase similarity index 100% rename from apps/token-e2e/src/fixtures/wallet/passphrase rename to apps/governance-e2e/src/fixtures/wallet/passphrase diff --git a/apps/token-e2e/src/fixtures/wallet/recovery b/apps/governance-e2e/src/fixtures/wallet/recovery similarity index 100% rename from apps/token-e2e/src/fixtures/wallet/recovery rename to apps/governance-e2e/src/fixtures/wallet/recovery diff --git a/apps/token-e2e/src/integration/flow/proposal-details.cy.js b/apps/governance-e2e/src/integration/flow/proposal-details.cy.js similarity index 100% rename from apps/token-e2e/src/integration/flow/proposal-details.cy.js rename to apps/governance-e2e/src/integration/flow/proposal-details.cy.js diff --git a/apps/token-e2e/src/integration/flow/proposal-enacted.cy.js b/apps/governance-e2e/src/integration/flow/proposal-enacted.cy.js similarity index 100% rename from apps/token-e2e/src/integration/flow/proposal-enacted.cy.js rename to apps/governance-e2e/src/integration/flow/proposal-enacted.cy.js diff --git a/apps/token-e2e/src/integration/flow/proposal-flow.cy.js b/apps/governance-e2e/src/integration/flow/proposal-flow.cy.js similarity index 100% rename from apps/token-e2e/src/integration/flow/proposal-flow.cy.js rename to apps/governance-e2e/src/integration/flow/proposal-flow.cy.js diff --git a/apps/token-e2e/src/integration/flow/proposal-forms.cy.js b/apps/governance-e2e/src/integration/flow/proposal-forms.cy.js similarity index 100% rename from apps/token-e2e/src/integration/flow/proposal-forms.cy.js rename to apps/governance-e2e/src/integration/flow/proposal-forms.cy.js diff --git a/apps/token-e2e/src/integration/flow/proposal-list.cy.js b/apps/governance-e2e/src/integration/flow/proposal-list.cy.js similarity index 100% rename from apps/token-e2e/src/integration/flow/proposal-list.cy.js rename to apps/governance-e2e/src/integration/flow/proposal-list.cy.js diff --git a/apps/token-e2e/src/integration/flow/staking-flow.cy.js b/apps/governance-e2e/src/integration/flow/staking-flow.cy.js similarity index 100% rename from apps/token-e2e/src/integration/flow/staking-flow.cy.js rename to apps/governance-e2e/src/integration/flow/staking-flow.cy.js diff --git a/apps/token-e2e/src/integration/flow/token-association-flow.cy.js b/apps/governance-e2e/src/integration/flow/token-association-flow.cy.js similarity index 100% rename from apps/token-e2e/src/integration/flow/token-association-flow.cy.js rename to apps/governance-e2e/src/integration/flow/token-association-flow.cy.js diff --git a/apps/token-e2e/src/integration/flow/withdrawal-flow.cy.js b/apps/governance-e2e/src/integration/flow/withdrawal-flow.cy.js similarity index 100% rename from apps/token-e2e/src/integration/flow/withdrawal-flow.cy.js rename to apps/governance-e2e/src/integration/flow/withdrawal-flow.cy.js diff --git a/apps/token-e2e/src/integration/view/home.cy.js b/apps/governance-e2e/src/integration/view/home.cy.js similarity index 100% rename from apps/token-e2e/src/integration/view/home.cy.js rename to apps/governance-e2e/src/integration/view/home.cy.js diff --git a/apps/token-e2e/src/integration/view/proposal.cy.js b/apps/governance-e2e/src/integration/view/proposal.cy.js similarity index 100% rename from apps/token-e2e/src/integration/view/proposal.cy.js rename to apps/governance-e2e/src/integration/view/proposal.cy.js diff --git a/apps/token-e2e/src/integration/view/pubkey-view.cy.js b/apps/governance-e2e/src/integration/view/pubkey-view.cy.js similarity index 100% rename from apps/token-e2e/src/integration/view/pubkey-view.cy.js rename to apps/governance-e2e/src/integration/view/pubkey-view.cy.js diff --git a/apps/token-e2e/src/integration/view/rewards.cy.js b/apps/governance-e2e/src/integration/view/rewards.cy.js similarity index 100% rename from apps/token-e2e/src/integration/view/rewards.cy.js rename to apps/governance-e2e/src/integration/view/rewards.cy.js diff --git a/apps/token-e2e/src/integration/view/token.cy.js b/apps/governance-e2e/src/integration/view/token.cy.js similarity index 100% rename from apps/token-e2e/src/integration/view/token.cy.js rename to apps/governance-e2e/src/integration/view/token.cy.js diff --git a/apps/token-e2e/src/integration/view/validators.cy.js b/apps/governance-e2e/src/integration/view/validators.cy.js similarity index 100% rename from apps/token-e2e/src/integration/view/validators.cy.js rename to apps/governance-e2e/src/integration/view/validators.cy.js diff --git a/apps/token-e2e/src/integration/view/vesting.cy.js b/apps/governance-e2e/src/integration/view/vesting.cy.js similarity index 100% rename from apps/token-e2e/src/integration/view/vesting.cy.js rename to apps/governance-e2e/src/integration/view/vesting.cy.js diff --git a/apps/token-e2e/src/integration/view/wallet-eth.cy.js b/apps/governance-e2e/src/integration/view/wallet-eth.cy.js similarity index 100% rename from apps/token-e2e/src/integration/view/wallet-eth.cy.js rename to apps/governance-e2e/src/integration/view/wallet-eth.cy.js diff --git a/apps/token-e2e/src/integration/view/wallet-vega.cy.js b/apps/governance-e2e/src/integration/view/wallet-vega.cy.js similarity index 99% rename from apps/token-e2e/src/integration/view/wallet-vega.cy.js rename to apps/governance-e2e/src/integration/view/wallet-vega.cy.js index 1c9fcaf77..c32037a42 100644 --- a/apps/token-e2e/src/integration/view/wallet-vega.cy.js +++ b/apps/governance-e2e/src/integration/view/wallet-vega.cy.js @@ -1,4 +1,4 @@ -import { truncateByChars } from '@vegaprotocol/react-helpers'; +import { truncateByChars } from '@vegaprotocol/utils'; const walletContainer = '[data-testid="vega-wallet"]'; const walletHeader = '[data-testid="wallet-header"] h1'; diff --git a/apps/token-e2e/src/integration/view/withdraw.cy.js b/apps/governance-e2e/src/integration/view/withdraw.cy.js similarity index 100% rename from apps/token-e2e/src/integration/view/withdraw.cy.js rename to apps/governance-e2e/src/integration/view/withdraw.cy.js diff --git a/apps/token-e2e/src/support/common.functions.js b/apps/governance-e2e/src/support/common.functions.js similarity index 100% rename from apps/token-e2e/src/support/common.functions.js rename to apps/governance-e2e/src/support/common.functions.js diff --git a/apps/token-e2e/src/support/governance.functions.js b/apps/governance-e2e/src/support/governance.functions.js similarity index 100% rename from apps/token-e2e/src/support/governance.functions.js rename to apps/governance-e2e/src/support/governance.functions.js diff --git a/apps/token-e2e/src/support/index.js b/apps/governance-e2e/src/support/index.js similarity index 100% rename from apps/token-e2e/src/support/index.js rename to apps/governance-e2e/src/support/index.js diff --git a/apps/token-e2e/src/support/proposal.functions.ts b/apps/governance-e2e/src/support/proposal.functions.ts similarity index 100% rename from apps/token-e2e/src/support/proposal.functions.ts rename to apps/governance-e2e/src/support/proposal.functions.ts diff --git a/apps/token-e2e/src/support/staking.functions.js b/apps/governance-e2e/src/support/staking.functions.js similarity index 100% rename from apps/token-e2e/src/support/staking.functions.js rename to apps/governance-e2e/src/support/staking.functions.js diff --git a/apps/token-e2e/src/support/wallet-eth.functions.js b/apps/governance-e2e/src/support/wallet-eth.functions.js similarity index 100% rename from apps/token-e2e/src/support/wallet-eth.functions.js rename to apps/governance-e2e/src/support/wallet-eth.functions.js diff --git a/apps/token-e2e/src/support/wallet-teardown.functions.js b/apps/governance-e2e/src/support/wallet-teardown.functions.js similarity index 100% rename from apps/token-e2e/src/support/wallet-teardown.functions.js rename to apps/governance-e2e/src/support/wallet-teardown.functions.js diff --git a/apps/token-e2e/src/support/wallet-vega.functions.js b/apps/governance-e2e/src/support/wallet-vega.functions.js similarity index 100% rename from apps/token-e2e/src/support/wallet-vega.functions.js rename to apps/governance-e2e/src/support/wallet-vega.functions.js diff --git a/apps/token-e2e/tsconfig.json b/apps/governance-e2e/tsconfig.json similarity index 100% rename from apps/token-e2e/tsconfig.json rename to apps/governance-e2e/tsconfig.json diff --git a/apps/token/.babelrc b/apps/governance/.babelrc similarity index 100% rename from apps/token/.babelrc rename to apps/governance/.babelrc diff --git a/apps/token/.browserslistrc b/apps/governance/.browserslistrc similarity index 100% rename from apps/token/.browserslistrc rename to apps/governance/.browserslistrc diff --git a/apps/token/.env b/apps/governance/.env similarity index 100% rename from apps/token/.env rename to apps/governance/.env diff --git a/apps/token/.env.capsule b/apps/governance/.env.capsule similarity index 100% rename from apps/token/.env.capsule rename to apps/governance/.env.capsule diff --git a/apps/token/.env.devnet b/apps/governance/.env.devnet similarity index 100% rename from apps/token/.env.devnet rename to apps/governance/.env.devnet diff --git a/apps/token/.env.mainnet b/apps/governance/.env.mainnet similarity index 100% rename from apps/token/.env.mainnet rename to apps/governance/.env.mainnet diff --git a/apps/token/.env.mirror b/apps/governance/.env.mirror similarity index 100% rename from apps/token/.env.mirror rename to apps/governance/.env.mirror diff --git a/apps/token/.env.sandbox b/apps/governance/.env.sandbox similarity index 100% rename from apps/token/.env.sandbox rename to apps/governance/.env.sandbox diff --git a/apps/token/.env.stagnet1 b/apps/governance/.env.stagnet1 similarity index 100% rename from apps/token/.env.stagnet1 rename to apps/governance/.env.stagnet1 diff --git a/apps/token/.env.stagnet3 b/apps/governance/.env.stagnet3 similarity index 100% rename from apps/token/.env.stagnet3 rename to apps/governance/.env.stagnet3 diff --git a/apps/token/.env.testnet b/apps/governance/.env.testnet similarity index 100% rename from apps/token/.env.testnet rename to apps/governance/.env.testnet diff --git a/apps/token/.env.validator-testnet b/apps/governance/.env.validator-testnet similarity index 100% rename from apps/token/.env.validator-testnet rename to apps/governance/.env.validator-testnet diff --git a/apps/token/.eslintrc.json b/apps/governance/.eslintrc.json similarity index 100% rename from apps/token/.eslintrc.json rename to apps/governance/.eslintrc.json diff --git a/apps/token/README.md b/apps/governance/README.md similarity index 84% rename from apps/token/README.md rename to apps/governance/README.md index 04f524243..a6caec825 100644 --- a/apps/token/README.md +++ b/apps/governance/README.md @@ -1,15 +1,15 @@ -# The Vega token website +# The Vega governance website -**_Control panel for your VEGA tokens_** +**_Control panel for your VEGA governances_** Screenshot 2021-12-11 at 06 32 51 ## Features - View vesting progress -- Redeem VEGA tokens -- Stake VEGA tokens -- Withdraw tokens +- Redeem VEGA governances +- Stake VEGA governances +- Withdraw governances - Vote on proposals # Development @@ -17,7 +17,7 @@ Starting the app: ```bash -yarn nx serve token +yarn nx serve governance ``` ## Configuration @@ -32,7 +32,7 @@ Example configurations are provided here: For convenience, you can boot the app injecting one of the configurations above by running: ```bash -yarn nx run token:serve --env={env} # e.g. stagnet3 +yarn nx run governance:serve --env={env} # e.g. stagnet3 ``` There are a few different configuration options offered for this app: @@ -58,22 +58,22 @@ For example configurations, check out our [netlify.toml](./netlify.toml). To run the minimal set of unit tests, run the following: ```bash -yarn nx test token +yarn nx test governance ``` To run the UI automation tests with a mocked API, run: ```bash -yarn nx run token-e2e:e2e +yarn nx run governance-e2e:e2e ``` ## See also - [vega-locked-erc20](https://github.com/vegaprotocol/vega-locked-erc20) - proxy contract that shows your current balance - of locked tokens -- [VEGA Tokens: Vesting Details](https://blog.vega.xyz/vega-tokens-vesting-details-890b00fc238e) - blog describing + of locked governances +- [VEGA Tokens: Vesting Details](https://blog.vega.xyz/vega-governances-vesting-details-890b00fc238e) - blog describing the vesting process & key dates -- [Introducing the VEGA token](https://blog.vega.xyz/introducing-the-vega-token-40dac090b5c1) - blog about the VEGA - token -- [The VEGA Token Listing & LP Incentives](https://blog.vega.xyz/unlocking-vega-coinlist-pro-uniswap-sushiswap-b1414750e358) - blog about the token and site +- [Introducing the VEGA governance](https://blog.vega.xyz/introducing-the-vega-governance-40dac090b5c1) - blog about the VEGA + governance +- [The VEGA Token Listing & LP Incentives](https://blog.vega.xyz/unlocking-vega-coinlist-pro-uniswap-sushiswap-b1414750e358) - blog about the governance and site - [vega.xyz](https://vega.xyz) - about Vega Protocol diff --git a/apps/token/index.d.ts b/apps/governance/index.d.ts similarity index 100% rename from apps/token/index.d.ts rename to apps/governance/index.d.ts diff --git a/apps/token/jest.config.ts b/apps/governance/jest.config.ts similarity index 85% rename from apps/token/jest.config.ts rename to apps/governance/jest.config.ts index fe3593884..211d3395f 100644 --- a/apps/token/jest.config.ts +++ b/apps/governance/jest.config.ts @@ -1,13 +1,13 @@ /* eslint-disable */ export default { - displayName: 'token', + displayName: 'governance', preset: '../../jest.preset.js', transform: { '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest', '^.+\\.[tj]sx?$': 'babel-jest', }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], - coverageDirectory: '../../coverage/apps/token', + coverageDirectory: '../../coverage/apps/governance', setupFilesAfterEnv: ['./src/setup-tests.ts'], moduleNameMapper: { '^d3-(.*)$': `d3-$1/dist/d3-$1`, diff --git a/apps/token/netlify.toml b/apps/governance/netlify.toml similarity index 100% rename from apps/token/netlify.toml rename to apps/governance/netlify.toml diff --git a/apps/token/postcss.config.js b/apps/governance/postcss.config.js similarity index 100% rename from apps/token/postcss.config.js rename to apps/governance/postcss.config.js diff --git a/apps/token/project.json b/apps/governance/project.json similarity index 57% rename from apps/token/project.json rename to apps/governance/project.json index 35013c747..6e43c937a 100644 --- a/apps/token/project.json +++ b/apps/governance/project.json @@ -1,6 +1,6 @@ { "$schema": "../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "apps/token/src", + "sourceRoot": "apps/governance/src", "projectType": "application", "targets": { "build": { @@ -9,23 +9,26 @@ "defaultConfiguration": "production", "options": { "compiler": "babel", - "outputPath": "dist/apps/token", - "index": "apps/token/src/index.html", + "outputPath": "dist/apps/governance", + "index": "apps/governance/src/index.html", "baseHref": "/", - "main": "apps/token/src/main.tsx", - "polyfills": "apps/token/src/polyfills.ts", - "tsConfig": "apps/token/tsconfig.app.json", - "assets": ["apps/token/src/favicon.ico", "apps/token/src/assets"], - "styles": ["apps/token/src/styles.css"], + "main": "apps/governance/src/main.tsx", + "polyfills": "apps/governance/src/polyfills.ts", + "tsConfig": "apps/governance/tsconfig.app.json", + "assets": [ + "apps/governance/src/favicon.ico", + "apps/governance/src/assets" + ], + "styles": ["apps/governance/src/styles.css"], "scripts": [], - "webpackConfig": "apps/token/webpack.config.js" + "webpackConfig": "apps/governance/webpack.config.js" }, "configurations": { "production": { "fileReplacements": [ { - "replace": "apps/token/src/environments/environment.ts", - "with": "apps/token/src/environments/environment.prod.ts" + "replace": "apps/governance/src/environments/environment.ts", + "with": "apps/governance/src/environments/environment.prod.ts" } ], "optimization": true, @@ -41,12 +44,12 @@ "executor": "./tools/executors/webpack:serve", "options": { "port": 4210, - "buildTarget": "token:build:development", + "buildTarget": "governance:build:development", "hmr": true }, "configurations": { "production": { - "buildTarget": "token:build:production", + "buildTarget": "governance:build:production", "hmr": false } } @@ -55,14 +58,14 @@ "executor": "@nrwl/linter:eslint", "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": ["apps/token/**/*.{ts,tsx,js,jsx}"] + "lintFilePatterns": ["apps/governance/**/*.{ts,tsx,js,jsx}"] } }, "test": { "executor": "@nrwl/jest:jest", - "outputs": ["coverage/apps/token"], + "outputs": ["coverage/apps/governance"], "options": { - "jestConfig": "apps/token/jest.config.ts", + "jestConfig": "apps/governance/jest.config.ts", "passWithNoTests": true } }, @@ -70,7 +73,7 @@ "executor": "@nrwl/workspace:run-commands", "options": { "commands": [ - "cp apps/token/netlify.toml netlify.toml", + "cp apps/governance/netlify.toml netlify.toml", "nx build token" ] } @@ -79,7 +82,7 @@ "executor": "@nrwl/workspace:run-commands", "outputs": [], "options": { - "command": "yarn tsc --project ./apps/token/tsconfig.spec.json" + "command": "yarn tsc --project ./apps/governance/tsconfig.spec.json" } } }, diff --git a/apps/token/src/app-loader.tsx b/apps/governance/src/app-loader.tsx similarity index 98% rename from apps/token/src/app-loader.tsx rename to apps/governance/src/app-loader.tsx index 15e907c8b..0aaa27d84 100644 --- a/apps/token/src/app-loader.tsx +++ b/apps/governance/src/app-loader.tsx @@ -1,5 +1,5 @@ import * as Sentry from '@sentry/react'; -import { toBigNum } from '@vegaprotocol/react-helpers'; +import { toBigNum } from '@vegaprotocol/utils'; import { Splash } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet, useEagerConnect } from '@vegaprotocol/wallet'; import { useEnvironment } from '@vegaprotocol/environment'; diff --git a/apps/token/src/app.tsx b/apps/governance/src/app.tsx similarity index 100% rename from apps/token/src/app.tsx rename to apps/governance/src/app.tsx diff --git a/apps/token/src/assets/apple-touch-icon.png b/apps/governance/src/assets/apple-touch-icon.png similarity index 100% rename from apps/token/src/assets/apple-touch-icon.png rename to apps/governance/src/assets/apple-touch-icon.png diff --git a/apps/token/src/assets/env-config.js b/apps/governance/src/assets/env-config.js similarity index 100% rename from apps/token/src/assets/env-config.js rename to apps/governance/src/assets/env-config.js diff --git a/apps/token/src/assets/logo.png b/apps/governance/src/assets/logo.png similarity index 100% rename from apps/token/src/assets/logo.png rename to apps/governance/src/assets/logo.png diff --git a/apps/token/src/assets/logo192.png b/apps/governance/src/assets/logo192.png similarity index 100% rename from apps/token/src/assets/logo192.png rename to apps/governance/src/assets/logo192.png diff --git a/apps/token/src/assets/manifest.json b/apps/governance/src/assets/manifest.json similarity index 100% rename from apps/token/src/assets/manifest.json rename to apps/governance/src/assets/manifest.json diff --git a/apps/token/src/assets/robots.txt b/apps/governance/src/assets/robots.txt similarity index 100% rename from apps/token/src/assets/robots.txt rename to apps/governance/src/assets/robots.txt diff --git a/apps/token/src/components/add-locked-token/add-locked-token.tsx b/apps/governance/src/components/add-locked-token/add-locked-token.tsx similarity index 100% rename from apps/token/src/components/add-locked-token/add-locked-token.tsx rename to apps/governance/src/components/add-locked-token/add-locked-token.tsx diff --git a/apps/token/src/components/add-locked-token/index.tsx b/apps/governance/src/components/add-locked-token/index.tsx similarity index 100% rename from apps/token/src/components/add-locked-token/index.tsx rename to apps/governance/src/components/add-locked-token/index.tsx diff --git a/apps/token/src/components/add-token-button/add-token-button.tsx b/apps/governance/src/components/add-token-button/add-token-button.tsx similarity index 100% rename from apps/token/src/components/add-token-button/add-token-button.tsx rename to apps/governance/src/components/add-token-button/add-token-button.tsx diff --git a/apps/token/src/components/add-token-button/index.tsx b/apps/governance/src/components/add-token-button/index.tsx similarity index 100% rename from apps/token/src/components/add-token-button/index.tsx rename to apps/governance/src/components/add-token-button/index.tsx diff --git a/apps/token/src/components/balance-manager/balance-manager.tsx b/apps/governance/src/components/balance-manager/balance-manager.tsx similarity index 100% rename from apps/token/src/components/balance-manager/balance-manager.tsx rename to apps/governance/src/components/balance-manager/balance-manager.tsx diff --git a/apps/token/src/components/balance-manager/index.ts b/apps/governance/src/components/balance-manager/index.ts similarity index 100% rename from apps/token/src/components/balance-manager/index.ts rename to apps/governance/src/components/balance-manager/index.ts diff --git a/apps/token/src/components/bullet-header/bullet-header.tsx b/apps/governance/src/components/bullet-header/bullet-header.tsx similarity index 100% rename from apps/token/src/components/bullet-header/bullet-header.tsx rename to apps/governance/src/components/bullet-header/bullet-header.tsx diff --git a/apps/token/src/components/bullet-header/index.ts b/apps/governance/src/components/bullet-header/index.ts similarity index 100% rename from apps/token/src/components/bullet-header/index.ts rename to apps/governance/src/components/bullet-header/index.ts diff --git a/apps/token/src/components/connect-to-vega/connect-to-vega.tsx b/apps/governance/src/components/connect-to-vega/connect-to-vega.tsx similarity index 100% rename from apps/token/src/components/connect-to-vega/connect-to-vega.tsx rename to apps/governance/src/components/connect-to-vega/connect-to-vega.tsx diff --git a/apps/token/src/components/connect-to-vega/index.ts b/apps/governance/src/components/connect-to-vega/index.ts similarity index 100% rename from apps/token/src/components/connect-to-vega/index.ts rename to apps/governance/src/components/connect-to-vega/index.ts diff --git a/apps/token/src/components/connected-vega-key/connected-vega-key.tsx.tsx b/apps/governance/src/components/connected-vega-key/connected-vega-key.tsx.tsx similarity index 100% rename from apps/token/src/components/connected-vega-key/connected-vega-key.tsx.tsx rename to apps/governance/src/components/connected-vega-key/connected-vega-key.tsx.tsx diff --git a/apps/token/src/components/connected-vega-key/index.ts b/apps/governance/src/components/connected-vega-key/index.ts similarity index 100% rename from apps/token/src/components/connected-vega-key/index.ts rename to apps/governance/src/components/connected-vega-key/index.ts diff --git a/apps/token/src/components/country-selector/country-data.js b/apps/governance/src/components/country-selector/country-data.js similarity index 100% rename from apps/token/src/components/country-selector/country-data.js rename to apps/governance/src/components/country-selector/country-data.js diff --git a/apps/token/src/components/country-selector/country-selector.tsx b/apps/governance/src/components/country-selector/country-selector.tsx similarity index 100% rename from apps/token/src/components/country-selector/country-selector.tsx rename to apps/governance/src/components/country-selector/country-selector.tsx diff --git a/apps/token/src/components/country-selector/index.ts b/apps/governance/src/components/country-selector/index.ts similarity index 100% rename from apps/token/src/components/country-selector/index.ts rename to apps/governance/src/components/country-selector/index.ts diff --git a/apps/token/src/components/epoch-countdown/epoch-countdown.tsx b/apps/governance/src/components/epoch-countdown/epoch-countdown.tsx similarity index 100% rename from apps/token/src/components/epoch-countdown/epoch-countdown.tsx rename to apps/governance/src/components/epoch-countdown/epoch-countdown.tsx diff --git a/apps/token/src/components/epoch-countdown/index.tsx b/apps/governance/src/components/epoch-countdown/index.tsx similarity index 100% rename from apps/token/src/components/epoch-countdown/index.tsx rename to apps/governance/src/components/epoch-countdown/index.tsx diff --git a/apps/token/src/components/eth-connect-prompt/eth-connect-promp.tsx b/apps/governance/src/components/eth-connect-prompt/eth-connect-promp.tsx similarity index 100% rename from apps/token/src/components/eth-connect-prompt/eth-connect-promp.tsx rename to apps/governance/src/components/eth-connect-prompt/eth-connect-promp.tsx diff --git a/apps/token/src/components/eth-connect-prompt/index.ts b/apps/governance/src/components/eth-connect-prompt/index.ts similarity index 100% rename from apps/token/src/components/eth-connect-prompt/index.ts rename to apps/governance/src/components/eth-connect-prompt/index.ts diff --git a/apps/token/src/components/eth-wallet-container/eth-wallet-container.tsx b/apps/governance/src/components/eth-wallet-container/eth-wallet-container.tsx similarity index 100% rename from apps/token/src/components/eth-wallet-container/eth-wallet-container.tsx rename to apps/governance/src/components/eth-wallet-container/eth-wallet-container.tsx diff --git a/apps/token/src/components/eth-wallet-container/index.tsx b/apps/governance/src/components/eth-wallet-container/index.tsx similarity index 100% rename from apps/token/src/components/eth-wallet-container/index.tsx rename to apps/governance/src/components/eth-wallet-container/index.tsx diff --git a/apps/token/src/components/eth-wallet/eth-wallet.tsx b/apps/governance/src/components/eth-wallet/eth-wallet.tsx similarity index 100% rename from apps/token/src/components/eth-wallet/eth-wallet.tsx rename to apps/governance/src/components/eth-wallet/eth-wallet.tsx diff --git a/apps/token/src/components/eth-wallet/index.tsx b/apps/governance/src/components/eth-wallet/index.tsx similarity index 100% rename from apps/token/src/components/eth-wallet/index.tsx rename to apps/governance/src/components/eth-wallet/index.tsx diff --git a/apps/token/src/components/heading/heading.tsx b/apps/governance/src/components/heading/heading.tsx similarity index 100% rename from apps/token/src/components/heading/heading.tsx rename to apps/governance/src/components/heading/heading.tsx diff --git a/apps/token/src/components/heading/index.ts b/apps/governance/src/components/heading/index.ts similarity index 100% rename from apps/token/src/components/heading/index.ts rename to apps/governance/src/components/heading/index.ts diff --git a/apps/token/src/components/icons/error.tsx b/apps/governance/src/components/icons/error.tsx similarity index 100% rename from apps/token/src/components/icons/error.tsx rename to apps/governance/src/components/icons/error.tsx diff --git a/apps/token/src/components/icons/ethereum.tsx b/apps/governance/src/components/icons/ethereum.tsx similarity index 100% rename from apps/token/src/components/icons/ethereum.tsx rename to apps/governance/src/components/icons/ethereum.tsx diff --git a/apps/token/src/components/icons/hand-up.tsx b/apps/governance/src/components/icons/hand-up.tsx similarity index 100% rename from apps/token/src/components/icons/hand-up.tsx rename to apps/governance/src/components/icons/hand-up.tsx diff --git a/apps/token/src/components/icons/index.ts b/apps/governance/src/components/icons/index.ts similarity index 100% rename from apps/token/src/components/icons/index.ts rename to apps/governance/src/components/icons/index.ts diff --git a/apps/token/src/components/icons/tick.tsx b/apps/governance/src/components/icons/tick.tsx similarity index 100% rename from apps/token/src/components/icons/tick.tsx rename to apps/governance/src/components/icons/tick.tsx diff --git a/apps/token/src/components/locked-progress/index.ts b/apps/governance/src/components/locked-progress/index.ts similarity index 100% rename from apps/token/src/components/locked-progress/index.ts rename to apps/governance/src/components/locked-progress/index.ts diff --git a/apps/token/src/components/locked-progress/locked-progress.tsx b/apps/governance/src/components/locked-progress/locked-progress.tsx similarity index 100% rename from apps/token/src/components/locked-progress/locked-progress.tsx rename to apps/governance/src/components/locked-progress/locked-progress.tsx diff --git a/apps/token/src/components/nav/index.ts b/apps/governance/src/components/nav/index.ts similarity index 100% rename from apps/token/src/components/nav/index.ts rename to apps/governance/src/components/nav/index.ts diff --git a/apps/token/src/components/nav/nav-draw.tsx b/apps/governance/src/components/nav/nav-draw.tsx similarity index 100% rename from apps/token/src/components/nav/nav-draw.tsx rename to apps/governance/src/components/nav/nav-draw.tsx diff --git a/apps/token/src/components/nav/nav-dropdown.tsx b/apps/governance/src/components/nav/nav-dropdown.tsx similarity index 100% rename from apps/token/src/components/nav/nav-dropdown.tsx rename to apps/governance/src/components/nav/nav-dropdown.tsx diff --git a/apps/token/src/components/nav/nav-link.tsx b/apps/governance/src/components/nav/nav-link.tsx similarity index 100% rename from apps/token/src/components/nav/nav-link.tsx rename to apps/governance/src/components/nav/nav-link.tsx diff --git a/apps/token/src/components/nav/nav.css b/apps/governance/src/components/nav/nav.css similarity index 100% rename from apps/token/src/components/nav/nav.css rename to apps/governance/src/components/nav/nav.css diff --git a/apps/token/src/components/nav/nav.spec.tsx b/apps/governance/src/components/nav/nav.spec.tsx similarity index 100% rename from apps/token/src/components/nav/nav.spec.tsx rename to apps/governance/src/components/nav/nav.spec.tsx diff --git a/apps/token/src/components/nav/nav.tsx b/apps/governance/src/components/nav/nav.tsx similarity index 100% rename from apps/token/src/components/nav/nav.tsx rename to apps/governance/src/components/nav/nav.tsx diff --git a/apps/token/src/components/page-templates/app-layout.tsx b/apps/governance/src/components/page-templates/app-layout.tsx similarity index 100% rename from apps/token/src/components/page-templates/app-layout.tsx rename to apps/governance/src/components/page-templates/app-layout.tsx diff --git a/apps/token/src/components/page-templates/template-sidebar.tsx b/apps/governance/src/components/page-templates/template-sidebar.tsx similarity index 100% rename from apps/token/src/components/page-templates/template-sidebar.tsx rename to apps/governance/src/components/page-templates/template-sidebar.tsx diff --git a/apps/token/src/components/progress-bar/index.ts b/apps/governance/src/components/progress-bar/index.ts similarity index 100% rename from apps/token/src/components/progress-bar/index.ts rename to apps/governance/src/components/progress-bar/index.ts diff --git a/apps/token/src/components/progress-bar/progress-bar.tsx b/apps/governance/src/components/progress-bar/progress-bar.tsx similarity index 100% rename from apps/token/src/components/progress-bar/progress-bar.tsx rename to apps/governance/src/components/progress-bar/progress-bar.tsx diff --git a/apps/token/src/components/splash-error/index.ts b/apps/governance/src/components/splash-error/index.ts similarity index 100% rename from apps/token/src/components/splash-error/index.ts rename to apps/governance/src/components/splash-error/index.ts diff --git a/apps/token/src/components/splash-error/splash-error.tsx b/apps/governance/src/components/splash-error/splash-error.tsx similarity index 100% rename from apps/token/src/components/splash-error/splash-error.tsx rename to apps/governance/src/components/splash-error/splash-error.tsx diff --git a/apps/token/src/components/splash-loader/index.ts b/apps/governance/src/components/splash-loader/index.ts similarity index 100% rename from apps/token/src/components/splash-loader/index.ts rename to apps/governance/src/components/splash-loader/index.ts diff --git a/apps/token/src/components/splash-loader/splash-loader.tsx b/apps/governance/src/components/splash-loader/splash-loader.tsx similarity index 100% rename from apps/token/src/components/splash-loader/splash-loader.tsx rename to apps/governance/src/components/splash-loader/splash-loader.tsx diff --git a/apps/token/src/components/staking-method-radio/index.tsx b/apps/governance/src/components/staking-method-radio/index.tsx similarity index 100% rename from apps/token/src/components/staking-method-radio/index.tsx rename to apps/governance/src/components/staking-method-radio/index.tsx diff --git a/apps/token/src/components/token-input/index.tsx b/apps/governance/src/components/token-input/index.tsx similarity index 100% rename from apps/token/src/components/token-input/index.tsx rename to apps/governance/src/components/token-input/index.tsx diff --git a/apps/token/src/components/token-input/token-input.tsx b/apps/governance/src/components/token-input/token-input.tsx similarity index 99% rename from apps/token/src/components/token-input/token-input.tsx rename to apps/governance/src/components/token-input/token-input.tsx index d8c8c9f31..44228247e 100644 --- a/apps/token/src/components/token-input/token-input.tsx +++ b/apps/governance/src/components/token-input/token-input.tsx @@ -7,7 +7,7 @@ import { Lozenge, ButtonLink, } from '@vegaprotocol/ui-toolkit'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import React from 'react'; import { useTranslation } from 'react-i18next'; diff --git a/apps/token/src/components/transaction-callout/index.ts b/apps/governance/src/components/transaction-callout/index.ts similarity index 100% rename from apps/token/src/components/transaction-callout/index.ts rename to apps/governance/src/components/transaction-callout/index.ts diff --git a/apps/token/src/components/transaction-callout/transaction-callout.tsx b/apps/governance/src/components/transaction-callout/transaction-callout.tsx similarity index 100% rename from apps/token/src/components/transaction-callout/transaction-callout.tsx rename to apps/governance/src/components/transaction-callout/transaction-callout.tsx diff --git a/apps/token/src/components/transaction-callout/transaction-complete.tsx b/apps/governance/src/components/transaction-callout/transaction-complete.tsx similarity index 100% rename from apps/token/src/components/transaction-callout/transaction-complete.tsx rename to apps/governance/src/components/transaction-callout/transaction-complete.tsx diff --git a/apps/token/src/components/transaction-callout/transaction-error.tsx b/apps/governance/src/components/transaction-callout/transaction-error.tsx similarity index 100% rename from apps/token/src/components/transaction-callout/transaction-error.tsx rename to apps/governance/src/components/transaction-callout/transaction-error.tsx diff --git a/apps/token/src/components/transaction-callout/transaction-pending.tsx b/apps/governance/src/components/transaction-callout/transaction-pending.tsx similarity index 100% rename from apps/token/src/components/transaction-callout/transaction-pending.tsx rename to apps/governance/src/components/transaction-callout/transaction-pending.tsx diff --git a/apps/token/src/components/transaction-callout/transaction-requested.tsx b/apps/governance/src/components/transaction-callout/transaction-requested.tsx similarity index 100% rename from apps/token/src/components/transaction-callout/transaction-requested.tsx rename to apps/governance/src/components/transaction-callout/transaction-requested.tsx diff --git a/apps/token/src/components/transactions-modal/index.ts b/apps/governance/src/components/transactions-modal/index.ts similarity index 100% rename from apps/token/src/components/transactions-modal/index.ts rename to apps/governance/src/components/transactions-modal/index.ts diff --git a/apps/token/src/components/transactions-modal/transactions-modal.tsx b/apps/governance/src/components/transactions-modal/transactions-modal.tsx similarity index 100% rename from apps/token/src/components/transactions-modal/transactions-modal.tsx rename to apps/governance/src/components/transactions-modal/transactions-modal.tsx diff --git a/apps/token/src/components/vega-wallet-container/index.ts b/apps/governance/src/components/vega-wallet-container/index.ts similarity index 100% rename from apps/token/src/components/vega-wallet-container/index.ts rename to apps/governance/src/components/vega-wallet-container/index.ts diff --git a/apps/token/src/components/vega-wallet-container/vega-wallet-container.tsx b/apps/governance/src/components/vega-wallet-container/vega-wallet-container.tsx similarity index 100% rename from apps/token/src/components/vega-wallet-container/vega-wallet-container.tsx rename to apps/governance/src/components/vega-wallet-container/vega-wallet-container.tsx diff --git a/apps/token/src/components/vega-wallet-dialogs/index.ts b/apps/governance/src/components/vega-wallet-dialogs/index.ts similarity index 100% rename from apps/token/src/components/vega-wallet-dialogs/index.ts rename to apps/governance/src/components/vega-wallet-dialogs/index.ts diff --git a/apps/token/src/components/vega-wallet-dialogs/vega-wallet-dialogs.tsx b/apps/governance/src/components/vega-wallet-dialogs/vega-wallet-dialogs.tsx similarity index 100% rename from apps/token/src/components/vega-wallet-dialogs/vega-wallet-dialogs.tsx rename to apps/governance/src/components/vega-wallet-dialogs/vega-wallet-dialogs.tsx diff --git a/apps/token/src/components/vega-wallet/Delegations.graphql b/apps/governance/src/components/vega-wallet/Delegations.graphql similarity index 100% rename from apps/token/src/components/vega-wallet/Delegations.graphql rename to apps/governance/src/components/vega-wallet/Delegations.graphql diff --git a/apps/governance/src/components/vega-wallet/__generated__/Delegations.ts b/apps/governance/src/components/vega-wallet/__generated__/Delegations.ts new file mode 100644 index 000000000..86044aecd --- /dev/null +++ b/apps/governance/src/components/vega-wallet/__generated__/Delegations.ts @@ -0,0 +1,164 @@ +import * as Types from '@vegaprotocol/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type WalletDelegationFieldsFragment = { + __typename?: 'Delegation'; + amount: string; + epoch: number; + node: { __typename?: 'Node'; id: string; name: string }; +}; + +export type DelegationsQueryVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; + delegationsPagination?: Types.InputMaybe; +}>; + +export type DelegationsQuery = { + __typename?: 'Query'; + epoch: { __typename?: 'Epoch'; id: string }; + party?: { + __typename?: 'Party'; + id: string; + delegationsConnection?: { + __typename?: 'DelegationsConnection'; + edges?: Array<{ + __typename?: 'DelegationEdge'; + node: { + __typename?: 'Delegation'; + amount: string; + epoch: number; + node: { __typename?: 'Node'; id: string; name: string }; + }; + } | null> | null; + } | null; + stakingSummary: { + __typename?: 'StakingSummary'; + currentStakeAvailable: string; + }; + accountsConnection?: { + __typename?: 'AccountsConnection'; + edges?: Array<{ + __typename?: 'AccountEdge'; + node: { + __typename?: 'AccountBalance'; + type: Types.AccountType; + balance: string; + asset: { + __typename?: 'Asset'; + name: string; + id: string; + decimals: number; + symbol: string; + source: + | { __typename: 'BuiltinAsset' } + | { __typename: 'ERC20'; contractAddress: string }; + }; + }; + } | null> | null; + } | null; + } | null; +}; + +export const WalletDelegationFieldsFragmentDoc = gql` + fragment WalletDelegationFields on Delegation { + amount + node { + id + name + } + epoch + } +`; +export const DelegationsDocument = gql` + query Delegations($partyId: ID!, $delegationsPagination: Pagination) { + epoch { + id + } + party(id: $partyId) { + id + delegationsConnection(pagination: $delegationsPagination) { + edges { + node { + ...WalletDelegationFields + } + } + } + stakingSummary { + currentStakeAvailable + } + accountsConnection { + edges { + node { + asset { + name + id + decimals + symbol + source { + __typename + ... on ERC20 { + contractAddress + } + } + } + type + balance + } + } + } + } + } + ${WalletDelegationFieldsFragmentDoc} +`; + +/** + * __useDelegationsQuery__ + * + * To run a query within a React component, call `useDelegationsQuery` and pass it any options that fit your needs. + * When your component renders, `useDelegationsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useDelegationsQuery({ + * variables: { + * partyId: // value for 'partyId' + * delegationsPagination: // value for 'delegationsPagination' + * }, + * }); + */ +export function useDelegationsQuery( + baseOptions: Apollo.QueryHookOptions< + DelegationsQuery, + DelegationsQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery( + DelegationsDocument, + options + ); +} +export function useDelegationsLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + DelegationsQuery, + DelegationsQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery( + DelegationsDocument, + options + ); +} +export type DelegationsQueryHookResult = ReturnType; +export type DelegationsLazyQueryHookResult = ReturnType< + typeof useDelegationsLazyQuery +>; +export type DelegationsQueryResult = Apollo.QueryResult< + DelegationsQuery, + DelegationsQueryVariables +>; diff --git a/apps/token/src/components/vega-wallet/download-wallet-prompt.tsx b/apps/governance/src/components/vega-wallet/download-wallet-prompt.tsx similarity index 87% rename from apps/token/src/components/vega-wallet/download-wallet-prompt.tsx rename to apps/governance/src/components/vega-wallet/download-wallet-prompt.tsx index 98a6cdc3d..6dd9f567e 100644 --- a/apps/token/src/components/vega-wallet/download-wallet-prompt.tsx +++ b/apps/governance/src/components/vega-wallet/download-wallet-prompt.tsx @@ -1,6 +1,6 @@ import { Link } from '@vegaprotocol/ui-toolkit'; import { useTranslation } from 'react-i18next'; -import { ExternalLinks } from '@vegaprotocol/react-helpers'; +import { ExternalLinks } from '@vegaprotocol/utils'; export const DownloadWalletPrompt = () => { const { t } = useTranslation(); diff --git a/apps/token/src/components/vega-wallet/hooks.ts b/apps/governance/src/components/vega-wallet/hooks.ts similarity index 98% rename from apps/token/src/components/vega-wallet/hooks.ts rename to apps/governance/src/components/vega-wallet/hooks.ts index 881b6a3ca..a98cb413a 100644 --- a/apps/token/src/components/vega-wallet/hooks.ts +++ b/apps/governance/src/components/vega-wallet/hooks.ts @@ -14,12 +14,12 @@ import { useVegaWallet } from '@vegaprotocol/wallet'; import { useContracts } from '../../contexts/contracts/contracts-context'; import * as Schema from '@vegaprotocol/types'; import { + addDecimal, isAssetTypeERC20, removePaginationWrapper, toBigNum, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { useAppState } from '../../contexts/app-state/app-state-context'; -import { addDecimal } from '@vegaprotocol/react-helpers'; import type { DelegationsQuery, DelegationsQueryVariables, diff --git a/apps/token/src/components/vega-wallet/index.ts b/apps/governance/src/components/vega-wallet/index.ts similarity index 100% rename from apps/token/src/components/vega-wallet/index.ts rename to apps/governance/src/components/vega-wallet/index.ts diff --git a/apps/token/src/components/vega-wallet/vega-wallet.tsx b/apps/governance/src/components/vega-wallet/vega-wallet.tsx similarity index 99% rename from apps/token/src/components/vega-wallet/vega-wallet.tsx rename to apps/governance/src/components/vega-wallet/vega-wallet.tsx index b50e29f5d..4f4ea4b45 100644 --- a/apps/token/src/components/vega-wallet/vega-wallet.tsx +++ b/apps/governance/src/components/vega-wallet/vega-wallet.tsx @@ -24,7 +24,7 @@ import { DownloadWalletPrompt } from './download-wallet-prompt'; import { usePollForDelegations } from './hooks'; import { useVegaWallet, useVegaWalletDialogStore } from '@vegaprotocol/wallet'; import { Button, ButtonLink } from '@vegaprotocol/ui-toolkit'; -import { toBigNum } from '@vegaprotocol/react-helpers'; +import { toBigNum } from '@vegaprotocol/utils'; import { usePendingBalancesStore } from '../../hooks/use-pending-balances-manager'; import { StakingEventType } from '../../hooks/use-get-association-breakdown'; diff --git a/apps/token/src/components/wallet-card/index.ts b/apps/governance/src/components/wallet-card/index.ts similarity index 100% rename from apps/token/src/components/wallet-card/index.ts rename to apps/governance/src/components/wallet-card/index.ts diff --git a/apps/token/src/components/wallet-card/wallet-card.tsx b/apps/governance/src/components/wallet-card/wallet-card.tsx similarity index 100% rename from apps/token/src/components/wallet-card/wallet-card.tsx rename to apps/governance/src/components/wallet-card/wallet-card.tsx diff --git a/apps/token/src/components/web3-connector/index.ts b/apps/governance/src/components/web3-connector/index.ts similarity index 100% rename from apps/token/src/components/web3-connector/index.ts rename to apps/governance/src/components/web3-connector/index.ts diff --git a/apps/token/src/components/web3-connector/web3-connector.tsx b/apps/governance/src/components/web3-connector/web3-connector.tsx similarity index 100% rename from apps/token/src/components/web3-connector/web3-connector.tsx rename to apps/governance/src/components/web3-connector/web3-connector.tsx diff --git a/apps/token/src/config/env.ts b/apps/governance/src/config/env.ts similarity index 100% rename from apps/token/src/config/env.ts rename to apps/governance/src/config/env.ts diff --git a/apps/token/src/config/flags.ts b/apps/governance/src/config/flags.ts similarity index 100% rename from apps/token/src/config/flags.ts rename to apps/governance/src/config/flags.ts diff --git a/apps/token/src/config/index.ts b/apps/governance/src/config/index.ts similarity index 100% rename from apps/token/src/config/index.ts rename to apps/governance/src/config/index.ts diff --git a/apps/token/src/contexts/app-state/app-state-context.ts b/apps/governance/src/contexts/app-state/app-state-context.ts similarity index 100% rename from apps/token/src/contexts/app-state/app-state-context.ts rename to apps/governance/src/contexts/app-state/app-state-context.ts diff --git a/apps/token/src/contexts/app-state/app-state-provider.tsx b/apps/governance/src/contexts/app-state/app-state-provider.tsx similarity index 100% rename from apps/token/src/contexts/app-state/app-state-provider.tsx rename to apps/governance/src/contexts/app-state/app-state-provider.tsx diff --git a/apps/token/src/contexts/contracts/contracts-context.ts b/apps/governance/src/contexts/contracts/contracts-context.ts similarity index 100% rename from apps/token/src/contexts/contracts/contracts-context.ts rename to apps/governance/src/contexts/contracts/contracts-context.ts diff --git a/apps/token/src/contexts/contracts/contracts-provider.tsx b/apps/governance/src/contexts/contracts/contracts-provider.tsx similarity index 100% rename from apps/token/src/contexts/contracts/contracts-provider.tsx rename to apps/governance/src/contexts/contracts/contracts-provider.tsx diff --git a/apps/token/src/favicon.ico b/apps/governance/src/favicon.ico similarity index 100% rename from apps/token/src/favicon.ico rename to apps/governance/src/favicon.ico diff --git a/apps/token/src/hooks/transaction-reducer.ts b/apps/governance/src/hooks/transaction-reducer.ts similarity index 100% rename from apps/token/src/hooks/transaction-reducer.ts rename to apps/governance/src/hooks/transaction-reducer.ts diff --git a/apps/token/src/hooks/use-add-asset-to-wallet.ts b/apps/governance/src/hooks/use-add-asset-to-wallet.ts similarity index 100% rename from apps/token/src/hooks/use-add-asset-to-wallet.ts rename to apps/governance/src/hooks/use-add-asset-to-wallet.ts diff --git a/apps/token/src/hooks/use-animate-value.ts b/apps/governance/src/hooks/use-animate-value.ts similarity index 100% rename from apps/token/src/hooks/use-animate-value.ts rename to apps/governance/src/hooks/use-animate-value.ts diff --git a/apps/token/src/hooks/use-document-title.ts b/apps/governance/src/hooks/use-document-title.ts similarity index 100% rename from apps/token/src/hooks/use-document-title.ts rename to apps/governance/src/hooks/use-document-title.ts diff --git a/apps/token/src/hooks/use-get-association-breakdown.ts b/apps/governance/src/hooks/use-get-association-breakdown.ts similarity index 98% rename from apps/token/src/hooks/use-get-association-breakdown.ts rename to apps/governance/src/hooks/use-get-association-breakdown.ts index d5fa37358..e903adc9a 100644 --- a/apps/token/src/hooks/use-get-association-breakdown.ts +++ b/apps/governance/src/hooks/use-get-association-breakdown.ts @@ -1,7 +1,7 @@ import React from 'react'; import type { ethers } from 'ethers'; import * as Sentry from '@sentry/react'; -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; import type { StakingBridge, TokenVesting, diff --git a/apps/token/src/hooks/use-get-user-balances.ts b/apps/governance/src/hooks/use-get-user-balances.ts similarity index 95% rename from apps/token/src/hooks/use-get-user-balances.ts rename to apps/governance/src/hooks/use-get-user-balances.ts index a9cef3922..d6456ab8f 100644 --- a/apps/token/src/hooks/use-get-user-balances.ts +++ b/apps/governance/src/hooks/use-get-user-balances.ts @@ -1,6 +1,6 @@ import { useCallback } from 'react'; import * as Sentry from '@sentry/react'; -import { toBigNum } from '@vegaprotocol/react-helpers'; +import { toBigNum } from '@vegaprotocol/utils'; import { useContracts } from '../contexts/contracts/contracts-context'; import { useAppState } from '../contexts/app-state/app-state-context'; import { useEthereumConfig } from '@vegaprotocol/web3'; diff --git a/apps/token/src/hooks/use-listen-for-pending-eth-events.spec.ts b/apps/governance/src/hooks/use-listen-for-pending-eth-events.spec.ts similarity index 100% rename from apps/token/src/hooks/use-listen-for-pending-eth-events.spec.ts rename to apps/governance/src/hooks/use-listen-for-pending-eth-events.spec.ts diff --git a/apps/token/src/hooks/use-listen-for-pending-eth-events.ts b/apps/governance/src/hooks/use-listen-for-pending-eth-events.ts similarity index 100% rename from apps/token/src/hooks/use-listen-for-pending-eth-events.ts rename to apps/governance/src/hooks/use-listen-for-pending-eth-events.ts diff --git a/apps/token/src/hooks/use-listen-for-staking-events.ts b/apps/governance/src/hooks/use-listen-for-staking-events.ts similarity index 100% rename from apps/token/src/hooks/use-listen-for-staking-events.ts rename to apps/governance/src/hooks/use-listen-for-staking-events.ts diff --git a/apps/token/src/hooks/use-pending-balances-manager.spec.ts b/apps/governance/src/hooks/use-pending-balances-manager.spec.ts similarity index 100% rename from apps/token/src/hooks/use-pending-balances-manager.spec.ts rename to apps/governance/src/hooks/use-pending-balances-manager.spec.ts diff --git a/apps/token/src/hooks/use-pending-balances-manager.ts b/apps/governance/src/hooks/use-pending-balances-manager.ts similarity index 100% rename from apps/token/src/hooks/use-pending-balances-manager.ts rename to apps/governance/src/hooks/use-pending-balances-manager.ts diff --git a/apps/token/src/hooks/use-pending-transactions.ts b/apps/governance/src/hooks/use-pending-transactions.ts similarity index 100% rename from apps/token/src/hooks/use-pending-transactions.ts rename to apps/governance/src/hooks/use-pending-transactions.ts diff --git a/apps/token/src/hooks/use-refresh-after-epoch.ts b/apps/governance/src/hooks/use-refresh-after-epoch.ts similarity index 100% rename from apps/token/src/hooks/use-refresh-after-epoch.ts rename to apps/governance/src/hooks/use-refresh-after-epoch.ts diff --git a/apps/token/src/hooks/use-refresh-associated-balances.ts b/apps/governance/src/hooks/use-refresh-associated-balances.ts similarity index 94% rename from apps/token/src/hooks/use-refresh-associated-balances.ts rename to apps/governance/src/hooks/use-refresh-associated-balances.ts index 6bd65b95b..f6ca9dfaf 100644 --- a/apps/token/src/hooks/use-refresh-associated-balances.ts +++ b/apps/governance/src/hooks/use-refresh-associated-balances.ts @@ -1,4 +1,4 @@ -import { toBigNum } from '@vegaprotocol/react-helpers'; +import { toBigNum } from '@vegaprotocol/utils'; import React from 'react'; import { useAppState } from '../contexts/app-state/app-state-context'; diff --git a/apps/token/src/hooks/use-refresh-balances.ts b/apps/governance/src/hooks/use-refresh-balances.ts similarity index 97% rename from apps/token/src/hooks/use-refresh-balances.ts rename to apps/governance/src/hooks/use-refresh-balances.ts index 0c9abfab6..24cfd9e7d 100644 --- a/apps/token/src/hooks/use-refresh-balances.ts +++ b/apps/governance/src/hooks/use-refresh-balances.ts @@ -1,5 +1,5 @@ import * as Sentry from '@sentry/react'; -import { toBigNum } from '@vegaprotocol/react-helpers'; +import { toBigNum } from '@vegaprotocol/utils'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { useEthereumConfig } from '@vegaprotocol/web3'; import React from 'react'; diff --git a/apps/token/src/hooks/use-search-params.ts b/apps/governance/src/hooks/use-search-params.ts similarity index 100% rename from apps/token/src/hooks/use-search-params.ts rename to apps/governance/src/hooks/use-search-params.ts diff --git a/apps/token/src/hooks/use-transaction.ts b/apps/governance/src/hooks/use-transaction.ts similarity index 100% rename from apps/token/src/hooks/use-transaction.ts rename to apps/governance/src/hooks/use-transaction.ts diff --git a/apps/token/src/i18n/index.ts b/apps/governance/src/i18n/index.ts similarity index 100% rename from apps/token/src/i18n/index.ts rename to apps/governance/src/i18n/index.ts diff --git a/apps/token/src/i18n/translations/dev.json b/apps/governance/src/i18n/translations/dev.json similarity index 100% rename from apps/token/src/i18n/translations/dev.json rename to apps/governance/src/i18n/translations/dev.json diff --git a/apps/token/src/images/back.png b/apps/governance/src/images/back.png similarity index 100% rename from apps/token/src/images/back.png rename to apps/governance/src/images/back.png diff --git a/apps/token/src/images/banner.png b/apps/governance/src/images/banner.png similarity index 100% rename from apps/token/src/images/banner.png rename to apps/governance/src/images/banner.png diff --git a/apps/token/src/images/clouds.png b/apps/governance/src/images/clouds.png similarity index 100% rename from apps/token/src/images/clouds.png rename to apps/governance/src/images/clouds.png diff --git a/apps/token/src/images/logo-black-text.png b/apps/governance/src/images/logo-black-text.png similarity index 100% rename from apps/token/src/images/logo-black-text.png rename to apps/governance/src/images/logo-black-text.png diff --git a/apps/token/src/images/logo-white-text.png b/apps/governance/src/images/logo-white-text.png similarity index 100% rename from apps/token/src/images/logo-white-text.png rename to apps/governance/src/images/logo-white-text.png diff --git a/apps/token/src/images/token-no-icon.png b/apps/governance/src/images/token-no-icon.png similarity index 100% rename from apps/token/src/images/token-no-icon.png rename to apps/governance/src/images/token-no-icon.png diff --git a/apps/token/src/images/vega_black.png b/apps/governance/src/images/vega_black.png similarity index 100% rename from apps/token/src/images/vega_black.png rename to apps/governance/src/images/vega_black.png diff --git a/apps/token/src/images/vega_vesting.png b/apps/governance/src/images/vega_vesting.png similarity index 100% rename from apps/token/src/images/vega_vesting.png rename to apps/governance/src/images/vega_vesting.png diff --git a/apps/token/src/images/vega_white.png b/apps/governance/src/images/vega_white.png similarity index 100% rename from apps/token/src/images/vega_white.png rename to apps/governance/src/images/vega_white.png diff --git a/apps/token/src/index.html b/apps/governance/src/index.html similarity index 100% rename from apps/token/src/index.html rename to apps/governance/src/index.html diff --git a/apps/token/src/lib/abbreviate-number.test.ts b/apps/governance/src/lib/abbreviate-number.test.ts similarity index 100% rename from apps/token/src/lib/abbreviate-number.test.ts rename to apps/governance/src/lib/abbreviate-number.test.ts diff --git a/apps/token/src/lib/abbreviate-number.ts b/apps/governance/src/lib/abbreviate-number.ts similarity index 79% rename from apps/token/src/lib/abbreviate-number.ts rename to apps/governance/src/lib/abbreviate-number.ts index f411a3c86..2e9e4296f 100644 --- a/apps/token/src/lib/abbreviate-number.ts +++ b/apps/governance/src/lib/abbreviate-number.ts @@ -1,4 +1,4 @@ -import { getUserLocale } from '@vegaprotocol/react-helpers'; +import { getUserLocale } from '@vegaprotocol/utils'; import type { BigNumber } from './bignumber'; export const getAbbreviatedNumber = (num: BigNumber) => { diff --git a/apps/token/src/lib/balances/balances-store.ts b/apps/governance/src/lib/balances/balances-store.ts similarity index 100% rename from apps/token/src/lib/balances/balances-store.ts rename to apps/governance/src/lib/balances/balances-store.ts diff --git a/apps/token/src/lib/bignumber.test.ts b/apps/governance/src/lib/bignumber.test.ts similarity index 100% rename from apps/token/src/lib/bignumber.test.ts rename to apps/governance/src/lib/bignumber.test.ts diff --git a/apps/token/src/lib/bignumber.ts b/apps/governance/src/lib/bignumber.ts similarity index 100% rename from apps/token/src/lib/bignumber.ts rename to apps/governance/src/lib/bignumber.ts diff --git a/apps/token/src/lib/client.graphql b/apps/governance/src/lib/client.graphql similarity index 100% rename from apps/token/src/lib/client.graphql rename to apps/governance/src/lib/client.graphql diff --git a/apps/token/src/lib/date-formats.ts b/apps/governance/src/lib/date-formats.ts similarity index 100% rename from apps/token/src/lib/date-formats.ts rename to apps/governance/src/lib/date-formats.ts diff --git a/apps/token/src/lib/download-json.ts b/apps/governance/src/lib/download-json.ts similarity index 100% rename from apps/token/src/lib/download-json.ts rename to apps/governance/src/lib/download-json.ts diff --git a/apps/token/src/lib/format-number.spec.ts b/apps/governance/src/lib/format-number.spec.ts similarity index 100% rename from apps/token/src/lib/format-number.spec.ts rename to apps/governance/src/lib/format-number.spec.ts diff --git a/apps/token/src/lib/format-number.ts b/apps/governance/src/lib/format-number.ts similarity index 76% rename from apps/token/src/lib/format-number.ts rename to apps/governance/src/lib/format-number.ts index b89af71dd..b26e69bf3 100644 --- a/apps/token/src/lib/format-number.ts +++ b/apps/governance/src/lib/format-number.ts @@ -1,5 +1,5 @@ import type { BigNumber } from './bignumber'; -import { formatNumber as format } from '@vegaprotocol/react-helpers'; +import { formatNumber as format } from '@vegaprotocol/utils'; export const formatNumber = (value: BigNumber, decimals?: number) => { return format( diff --git a/apps/token/src/lib/tranches/tranches-store.tsx b/apps/governance/src/lib/tranches/tranches-store.tsx similarity index 97% rename from apps/token/src/lib/tranches/tranches-store.tsx rename to apps/governance/src/lib/tranches/tranches-store.tsx index 11b9901aa..49c785f95 100644 --- a/apps/token/src/lib/tranches/tranches-store.tsx +++ b/apps/governance/src/lib/tranches/tranches-store.tsx @@ -1,4 +1,4 @@ -import { toBigNum } from '@vegaprotocol/react-helpers'; +import { toBigNum } from '@vegaprotocol/utils'; import type { TrancheServiceResponse } from '@vegaprotocol/smart-contracts'; import type BigNumber from 'bignumber.js'; import create from 'zustand'; diff --git a/apps/token/src/lib/truncate-middle.spec.ts b/apps/governance/src/lib/truncate-middle.spec.ts similarity index 100% rename from apps/token/src/lib/truncate-middle.spec.ts rename to apps/governance/src/lib/truncate-middle.spec.ts diff --git a/apps/token/src/lib/truncate-middle.ts b/apps/governance/src/lib/truncate-middle.ts similarity index 100% rename from apps/token/src/lib/truncate-middle.ts rename to apps/governance/src/lib/truncate-middle.ts diff --git a/apps/token/src/lib/vega-connectors.ts b/apps/governance/src/lib/vega-connectors.ts similarity index 100% rename from apps/token/src/lib/vega-connectors.ts rename to apps/governance/src/lib/vega-connectors.ts diff --git a/apps/token/src/lib/web3-connectors.ts b/apps/governance/src/lib/web3-connectors.ts similarity index 100% rename from apps/token/src/lib/web3-connectors.ts rename to apps/governance/src/lib/web3-connectors.ts diff --git a/apps/token/src/lib/web3-utils.ts b/apps/governance/src/lib/web3-utils.ts similarity index 100% rename from apps/token/src/lib/web3-utils.ts rename to apps/governance/src/lib/web3-utils.ts diff --git a/apps/token/src/main.tsx b/apps/governance/src/main.tsx similarity index 100% rename from apps/token/src/main.tsx rename to apps/governance/src/main.tsx diff --git a/apps/token/src/polyfills.ts b/apps/governance/src/polyfills.ts similarity index 100% rename from apps/token/src/polyfills.ts rename to apps/governance/src/polyfills.ts diff --git a/apps/token/src/react-app-env.d.ts b/apps/governance/src/react-app-env.d.ts similarity index 100% rename from apps/token/src/react-app-env.d.ts rename to apps/governance/src/react-app-env.d.ts diff --git a/apps/token/src/report-web-vitals.ts b/apps/governance/src/report-web-vitals.ts similarity index 100% rename from apps/token/src/report-web-vitals.ts rename to apps/governance/src/report-web-vitals.ts diff --git a/apps/token/src/routes/claim/claim-error.tsx b/apps/governance/src/routes/claim/claim-error.tsx similarity index 100% rename from apps/token/src/routes/claim/claim-error.tsx rename to apps/governance/src/routes/claim/claim-error.tsx diff --git a/apps/token/src/routes/claim/claim-flow.tsx b/apps/governance/src/routes/claim/claim-flow.tsx similarity index 100% rename from apps/token/src/routes/claim/claim-flow.tsx rename to apps/governance/src/routes/claim/claim-flow.tsx diff --git a/apps/token/src/routes/claim/claim-form/claim-form.tsx b/apps/governance/src/routes/claim/claim-form/claim-form.tsx similarity index 100% rename from apps/token/src/routes/claim/claim-form/claim-form.tsx rename to apps/governance/src/routes/claim/claim-form/claim-form.tsx diff --git a/apps/token/src/routes/claim/claim-form/index.ts b/apps/governance/src/routes/claim/claim-form/index.ts similarity index 100% rename from apps/token/src/routes/claim/claim-form/index.ts rename to apps/governance/src/routes/claim/claim-form/index.ts diff --git a/apps/token/src/routes/claim/claim-info.tsx b/apps/governance/src/routes/claim/claim-info.tsx similarity index 100% rename from apps/token/src/routes/claim/claim-info.tsx rename to apps/governance/src/routes/claim/claim-info.tsx diff --git a/apps/token/src/routes/claim/claim-reducer.test.ts b/apps/governance/src/routes/claim/claim-reducer.test.ts similarity index 100% rename from apps/token/src/routes/claim/claim-reducer.test.ts rename to apps/governance/src/routes/claim/claim-reducer.test.ts diff --git a/apps/token/src/routes/claim/claim-reducer.ts b/apps/governance/src/routes/claim/claim-reducer.ts similarity index 98% rename from apps/token/src/routes/claim/claim-reducer.ts rename to apps/governance/src/routes/claim/claim-reducer.ts index 6ac740f3e..4c68e16b8 100644 --- a/apps/token/src/routes/claim/claim-reducer.ts +++ b/apps/governance/src/routes/claim/claim-reducer.ts @@ -1,6 +1,6 @@ import { BigNumber } from '../../lib/bignumber'; import type { IClaimTokenParams } from '@vegaprotocol/smart-contracts'; -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; export enum ClaimStatus { Ready, diff --git a/apps/token/src/routes/claim/claim-restricted.tsx b/apps/governance/src/routes/claim/claim-restricted.tsx similarity index 100% rename from apps/token/src/routes/claim/claim-restricted.tsx rename to apps/governance/src/routes/claim/claim-restricted.tsx diff --git a/apps/token/src/routes/claim/claim-step-1/claim-step-1.tsx b/apps/governance/src/routes/claim/claim-step-1/claim-step-1.tsx similarity index 100% rename from apps/token/src/routes/claim/claim-step-1/claim-step-1.tsx rename to apps/governance/src/routes/claim/claim-step-1/claim-step-1.tsx diff --git a/apps/token/src/routes/claim/claim-step-1/index.ts b/apps/governance/src/routes/claim/claim-step-1/index.ts similarity index 100% rename from apps/token/src/routes/claim/claim-step-1/index.ts rename to apps/governance/src/routes/claim/claim-step-1/index.ts diff --git a/apps/token/src/routes/claim/claim-step-2/claim-step-2.tsx b/apps/governance/src/routes/claim/claim-step-2/claim-step-2.tsx similarity index 100% rename from apps/token/src/routes/claim/claim-step-2/claim-step-2.tsx rename to apps/governance/src/routes/claim/claim-step-2/claim-step-2.tsx diff --git a/apps/token/src/routes/claim/claim-step-2/index.ts b/apps/governance/src/routes/claim/claim-step-2/index.ts similarity index 100% rename from apps/token/src/routes/claim/claim-step-2/index.ts rename to apps/governance/src/routes/claim/claim-step-2/index.ts diff --git a/apps/token/src/routes/claim/claim.tsx b/apps/governance/src/routes/claim/claim.tsx similarity index 100% rename from apps/token/src/routes/claim/claim.tsx rename to apps/governance/src/routes/claim/claim.tsx diff --git a/apps/token/src/routes/claim/code-used.tsx b/apps/governance/src/routes/claim/code-used.tsx similarity index 100% rename from apps/token/src/routes/claim/code-used.tsx rename to apps/governance/src/routes/claim/code-used.tsx diff --git a/apps/token/src/routes/claim/complete.tsx b/apps/governance/src/routes/claim/complete.tsx similarity index 100% rename from apps/token/src/routes/claim/complete.tsx rename to apps/governance/src/routes/claim/complete.tsx diff --git a/apps/token/src/routes/claim/expired.tsx b/apps/governance/src/routes/claim/expired.tsx similarity index 100% rename from apps/token/src/routes/claim/expired.tsx rename to apps/governance/src/routes/claim/expired.tsx diff --git a/apps/token/src/routes/claim/hooks.ts b/apps/governance/src/routes/claim/hooks.ts similarity index 93% rename from apps/token/src/routes/claim/hooks.ts rename to apps/governance/src/routes/claim/hooks.ts index b446175af..802c7fcfc 100644 --- a/apps/token/src/routes/claim/hooks.ts +++ b/apps/governance/src/routes/claim/hooks.ts @@ -1,7 +1,7 @@ import { useContracts } from '../../contexts/contracts/contracts-context'; import { useTransaction } from '../../hooks/use-transaction'; import type { IClaimTokenParams } from '@vegaprotocol/smart-contracts'; -import { removeDecimal } from '@vegaprotocol/react-helpers'; +import { removeDecimal } from '@vegaprotocol/utils'; import { useAppState } from '../../contexts/app-state/app-state-context'; export const useClaim = (claimData: IClaimTokenParams, address: string) => { diff --git a/apps/token/src/routes/claim/index.tsx b/apps/governance/src/routes/claim/index.tsx similarity index 100% rename from apps/token/src/routes/claim/index.tsx rename to apps/governance/src/routes/claim/index.tsx diff --git a/apps/token/src/routes/claim/lib/is-restricted.test.ts b/apps/governance/src/routes/claim/lib/is-restricted.test.ts similarity index 100% rename from apps/token/src/routes/claim/lib/is-restricted.test.ts rename to apps/governance/src/routes/claim/lib/is-restricted.test.ts diff --git a/apps/token/src/routes/claim/lib/is-restricted.ts b/apps/governance/src/routes/claim/lib/is-restricted.ts similarity index 100% rename from apps/token/src/routes/claim/lib/is-restricted.ts rename to apps/governance/src/routes/claim/lib/is-restricted.ts diff --git a/apps/token/src/routes/claim/target-address-mismatch.tsx b/apps/governance/src/routes/claim/target-address-mismatch.tsx similarity index 100% rename from apps/token/src/routes/claim/target-address-mismatch.tsx rename to apps/governance/src/routes/claim/target-address-mismatch.tsx diff --git a/apps/token/src/routes/claim/targeted-claim/index.ts b/apps/governance/src/routes/claim/targeted-claim/index.ts similarity index 100% rename from apps/token/src/routes/claim/targeted-claim/index.ts rename to apps/governance/src/routes/claim/targeted-claim/index.ts diff --git a/apps/token/src/routes/claim/targeted-claim/targeted-claim.tsx b/apps/governance/src/routes/claim/targeted-claim/targeted-claim.tsx similarity index 100% rename from apps/token/src/routes/claim/targeted-claim/targeted-claim.tsx rename to apps/governance/src/routes/claim/targeted-claim/targeted-claim.tsx diff --git a/apps/token/src/routes/claim/tranche-not-found.tsx b/apps/governance/src/routes/claim/tranche-not-found.tsx similarity index 100% rename from apps/token/src/routes/claim/tranche-not-found.tsx rename to apps/governance/src/routes/claim/tranche-not-found.tsx diff --git a/apps/token/src/routes/claim/untargeted-claim/index.ts b/apps/governance/src/routes/claim/untargeted-claim/index.ts similarity index 100% rename from apps/token/src/routes/claim/untargeted-claim/index.ts rename to apps/governance/src/routes/claim/untargeted-claim/index.ts diff --git a/apps/token/src/routes/claim/untargeted-claim/untargeted-claim.tsx b/apps/governance/src/routes/claim/untargeted-claim/untargeted-claim.tsx similarity index 100% rename from apps/token/src/routes/claim/untargeted-claim/untargeted-claim.tsx rename to apps/governance/src/routes/claim/untargeted-claim/untargeted-claim.tsx diff --git a/apps/token/src/routes/claim/verifying.tsx b/apps/governance/src/routes/claim/verifying.tsx similarity index 100% rename from apps/token/src/routes/claim/verifying.tsx rename to apps/governance/src/routes/claim/verifying.tsx diff --git a/apps/token/src/routes/contracts/index.tsx b/apps/governance/src/routes/contracts/index.tsx similarity index 97% rename from apps/token/src/routes/contracts/index.tsx rename to apps/governance/src/routes/contracts/index.tsx index 9d5f03a99..bf730d991 100644 --- a/apps/token/src/routes/contracts/index.tsx +++ b/apps/governance/src/routes/contracts/index.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Link, Splash } from '@vegaprotocol/ui-toolkit'; import type { EthereumConfig } from '@vegaprotocol/web3'; import { useEthereumConfig } from '@vegaprotocol/web3'; diff --git a/apps/token/src/routes/home/index.tsx b/apps/governance/src/routes/home/index.tsx similarity index 98% rename from apps/token/src/routes/home/index.tsx rename to apps/governance/src/routes/home/index.tsx index cd78f00cc..e69e31712 100644 --- a/apps/token/src/routes/home/index.tsx +++ b/apps/governance/src/routes/home/index.tsx @@ -11,10 +11,7 @@ import { useDocumentTitle } from '../../hooks/use-document-title'; import { useRefreshAfterEpoch } from '../../hooks/use-refresh-after-epoch'; import { ProposalsListItem } from '../proposals/components/proposals-list-item'; import Routes from '../routes'; -import { - ExternalLinks, - removePaginationWrapper, -} from '@vegaprotocol/react-helpers'; +import { ExternalLinks, removePaginationWrapper } from '@vegaprotocol/utils'; import { useNodesQuery } from '../staking/home/__generated___/Nodes'; import { useProposalsQuery } from '../proposals/proposals/__generated__/Proposals'; import { getNotRejectedProposals } from '../proposals/proposals/proposals-container'; diff --git a/apps/token/src/routes/index.tsx b/apps/governance/src/routes/index.tsx similarity index 100% rename from apps/token/src/routes/index.tsx rename to apps/governance/src/routes/index.tsx diff --git a/apps/token/src/routes/not-found/index.tsx b/apps/governance/src/routes/not-found/index.tsx similarity index 100% rename from apps/token/src/routes/not-found/index.tsx rename to apps/governance/src/routes/not-found/index.tsx diff --git a/apps/token/src/routes/not-permitted/index.tsx b/apps/governance/src/routes/not-permitted/index.tsx similarity index 100% rename from apps/token/src/routes/not-permitted/index.tsx rename to apps/governance/src/routes/not-permitted/index.tsx diff --git a/apps/token/src/routes/proposals/components/current-proposal-state/current-proposal-state.tsx b/apps/governance/src/routes/proposals/components/current-proposal-state/current-proposal-state.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/current-proposal-state/current-proposal-state.tsx rename to apps/governance/src/routes/proposals/components/current-proposal-state/current-proposal-state.tsx diff --git a/apps/token/src/routes/proposals/components/current-proposal-state/index.tsx b/apps/governance/src/routes/proposals/components/current-proposal-state/index.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/current-proposal-state/index.tsx rename to apps/governance/src/routes/proposals/components/current-proposal-state/index.tsx diff --git a/apps/token/src/routes/proposals/components/current-proposal-status/current-proposal-status.spec.tsx b/apps/governance/src/routes/proposals/components/current-proposal-status/current-proposal-status.spec.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/current-proposal-status/current-proposal-status.spec.tsx rename to apps/governance/src/routes/proposals/components/current-proposal-status/current-proposal-status.spec.tsx diff --git a/apps/token/src/routes/proposals/components/current-proposal-status/current-proposal-status.tsx b/apps/governance/src/routes/proposals/components/current-proposal-status/current-proposal-status.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/current-proposal-status/current-proposal-status.tsx rename to apps/governance/src/routes/proposals/components/current-proposal-status/current-proposal-status.tsx diff --git a/apps/token/src/routes/proposals/components/current-proposal-status/index.tsx b/apps/governance/src/routes/proposals/components/current-proposal-status/index.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/current-proposal-status/index.tsx rename to apps/governance/src/routes/proposals/components/current-proposal-status/index.tsx diff --git a/apps/token/src/routes/proposals/components/list-asset/Asset.graphql b/apps/governance/src/routes/proposals/components/list-asset/Asset.graphql similarity index 100% rename from apps/token/src/routes/proposals/components/list-asset/Asset.graphql rename to apps/governance/src/routes/proposals/components/list-asset/Asset.graphql diff --git a/apps/governance/src/routes/proposals/components/list-asset/__generated__/Asset.ts b/apps/governance/src/routes/proposals/components/list-asset/__generated__/Asset.ts new file mode 100644 index 000000000..69f4eb993 --- /dev/null +++ b/apps/governance/src/routes/proposals/components/list-asset/__generated__/Asset.ts @@ -0,0 +1,159 @@ +import * as Types from '@vegaprotocol/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type ProposalAssetQueryVariables = Types.Exact<{ + assetId: Types.Scalars['ID']; +}>; + +export type ProposalAssetQuery = { + __typename?: 'Query'; + asset?: { + __typename?: 'Asset'; + status: Types.AssetStatus; + source: + | { __typename?: 'BuiltinAsset' } + | { __typename?: 'ERC20'; contractAddress: string }; + } | null; +}; + +export type AssetListBundleQueryVariables = Types.Exact<{ + assetId: Types.Scalars['ID']; +}>; + +export type AssetListBundleQuery = { + __typename?: 'Query'; + erc20ListAssetBundle?: { + __typename?: 'Erc20ListAssetBundle'; + assetSource: string; + vegaAssetId: string; + nonce: string; + signatures: string; + } | null; +}; + +export const ProposalAssetDocument = gql` + query ProposalAsset($assetId: ID!) { + asset(id: $assetId) { + status + source { + ... on ERC20 { + contractAddress + } + } + } + } +`; + +/** + * __useProposalAssetQuery__ + * + * To run a query within a React component, call `useProposalAssetQuery` and pass it any options that fit your needs. + * When your component renders, `useProposalAssetQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useProposalAssetQuery({ + * variables: { + * assetId: // value for 'assetId' + * }, + * }); + */ +export function useProposalAssetQuery( + baseOptions: Apollo.QueryHookOptions< + ProposalAssetQuery, + ProposalAssetQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery( + ProposalAssetDocument, + options + ); +} +export function useProposalAssetLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + ProposalAssetQuery, + ProposalAssetQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery( + ProposalAssetDocument, + options + ); +} +export type ProposalAssetQueryHookResult = ReturnType< + typeof useProposalAssetQuery +>; +export type ProposalAssetLazyQueryHookResult = ReturnType< + typeof useProposalAssetLazyQuery +>; +export type ProposalAssetQueryResult = Apollo.QueryResult< + ProposalAssetQuery, + ProposalAssetQueryVariables +>; +export const AssetListBundleDocument = gql` + query AssetListBundle($assetId: ID!) { + erc20ListAssetBundle(assetId: $assetId) { + assetSource + vegaAssetId + nonce + signatures + } + } +`; + +/** + * __useAssetListBundleQuery__ + * + * To run a query within a React component, call `useAssetListBundleQuery` and pass it any options that fit your needs. + * When your component renders, `useAssetListBundleQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useAssetListBundleQuery({ + * variables: { + * assetId: // value for 'assetId' + * }, + * }); + */ +export function useAssetListBundleQuery( + baseOptions: Apollo.QueryHookOptions< + AssetListBundleQuery, + AssetListBundleQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery( + AssetListBundleDocument, + options + ); +} +export function useAssetListBundleLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + AssetListBundleQuery, + AssetListBundleQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery< + AssetListBundleQuery, + AssetListBundleQueryVariables + >(AssetListBundleDocument, options); +} +export type AssetListBundleQueryHookResult = ReturnType< + typeof useAssetListBundleQuery +>; +export type AssetListBundleLazyQueryHookResult = ReturnType< + typeof useAssetListBundleLazyQuery +>; +export type AssetListBundleQueryResult = Apollo.QueryResult< + AssetListBundleQuery, + AssetListBundleQueryVariables +>; diff --git a/apps/governance/src/routes/proposals/components/list-asset/__generated___/Asset.ts b/apps/governance/src/routes/proposals/components/list-asset/__generated___/Asset.ts new file mode 100644 index 000000000..69f4eb993 --- /dev/null +++ b/apps/governance/src/routes/proposals/components/list-asset/__generated___/Asset.ts @@ -0,0 +1,159 @@ +import * as Types from '@vegaprotocol/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type ProposalAssetQueryVariables = Types.Exact<{ + assetId: Types.Scalars['ID']; +}>; + +export type ProposalAssetQuery = { + __typename?: 'Query'; + asset?: { + __typename?: 'Asset'; + status: Types.AssetStatus; + source: + | { __typename?: 'BuiltinAsset' } + | { __typename?: 'ERC20'; contractAddress: string }; + } | null; +}; + +export type AssetListBundleQueryVariables = Types.Exact<{ + assetId: Types.Scalars['ID']; +}>; + +export type AssetListBundleQuery = { + __typename?: 'Query'; + erc20ListAssetBundle?: { + __typename?: 'Erc20ListAssetBundle'; + assetSource: string; + vegaAssetId: string; + nonce: string; + signatures: string; + } | null; +}; + +export const ProposalAssetDocument = gql` + query ProposalAsset($assetId: ID!) { + asset(id: $assetId) { + status + source { + ... on ERC20 { + contractAddress + } + } + } + } +`; + +/** + * __useProposalAssetQuery__ + * + * To run a query within a React component, call `useProposalAssetQuery` and pass it any options that fit your needs. + * When your component renders, `useProposalAssetQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useProposalAssetQuery({ + * variables: { + * assetId: // value for 'assetId' + * }, + * }); + */ +export function useProposalAssetQuery( + baseOptions: Apollo.QueryHookOptions< + ProposalAssetQuery, + ProposalAssetQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery( + ProposalAssetDocument, + options + ); +} +export function useProposalAssetLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + ProposalAssetQuery, + ProposalAssetQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery( + ProposalAssetDocument, + options + ); +} +export type ProposalAssetQueryHookResult = ReturnType< + typeof useProposalAssetQuery +>; +export type ProposalAssetLazyQueryHookResult = ReturnType< + typeof useProposalAssetLazyQuery +>; +export type ProposalAssetQueryResult = Apollo.QueryResult< + ProposalAssetQuery, + ProposalAssetQueryVariables +>; +export const AssetListBundleDocument = gql` + query AssetListBundle($assetId: ID!) { + erc20ListAssetBundle(assetId: $assetId) { + assetSource + vegaAssetId + nonce + signatures + } + } +`; + +/** + * __useAssetListBundleQuery__ + * + * To run a query within a React component, call `useAssetListBundleQuery` and pass it any options that fit your needs. + * When your component renders, `useAssetListBundleQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useAssetListBundleQuery({ + * variables: { + * assetId: // value for 'assetId' + * }, + * }); + */ +export function useAssetListBundleQuery( + baseOptions: Apollo.QueryHookOptions< + AssetListBundleQuery, + AssetListBundleQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery( + AssetListBundleDocument, + options + ); +} +export function useAssetListBundleLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + AssetListBundleQuery, + AssetListBundleQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery< + AssetListBundleQuery, + AssetListBundleQueryVariables + >(AssetListBundleDocument, options); +} +export type AssetListBundleQueryHookResult = ReturnType< + typeof useAssetListBundleQuery +>; +export type AssetListBundleLazyQueryHookResult = ReturnType< + typeof useAssetListBundleLazyQuery +>; +export type AssetListBundleQueryResult = Apollo.QueryResult< + AssetListBundleQuery, + AssetListBundleQueryVariables +>; diff --git a/apps/token/src/routes/proposals/components/list-asset/index.tsx b/apps/governance/src/routes/proposals/components/list-asset/index.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/list-asset/index.tsx rename to apps/governance/src/routes/proposals/components/list-asset/index.tsx diff --git a/apps/token/src/routes/proposals/components/list-asset/list-asset.spec.tsx b/apps/governance/src/routes/proposals/components/list-asset/list-asset.spec.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/list-asset/list-asset.spec.tsx rename to apps/governance/src/routes/proposals/components/list-asset/list-asset.spec.tsx diff --git a/apps/token/src/routes/proposals/components/list-asset/list-asset.tsx b/apps/governance/src/routes/proposals/components/list-asset/list-asset.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/list-asset/list-asset.tsx rename to apps/governance/src/routes/proposals/components/list-asset/list-asset.tsx diff --git a/apps/token/src/routes/proposals/components/proposal-change-table/index.tsx b/apps/governance/src/routes/proposals/components/proposal-change-table/index.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/proposal-change-table/index.tsx rename to apps/governance/src/routes/proposals/components/proposal-change-table/index.tsx diff --git a/apps/token/src/routes/proposals/components/proposal-change-table/proposal-change-table.spec.tsx b/apps/governance/src/routes/proposals/components/proposal-change-table/proposal-change-table.spec.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/proposal-change-table/proposal-change-table.spec.tsx rename to apps/governance/src/routes/proposals/components/proposal-change-table/proposal-change-table.spec.tsx diff --git a/apps/token/src/routes/proposals/components/proposal-change-table/proposal-change-table.tsx b/apps/governance/src/routes/proposals/components/proposal-change-table/proposal-change-table.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/proposal-change-table/proposal-change-table.tsx rename to apps/governance/src/routes/proposals/components/proposal-change-table/proposal-change-table.tsx diff --git a/apps/token/src/routes/proposals/components/proposal-detail-header/proposal-header.spec.tsx b/apps/governance/src/routes/proposals/components/proposal-detail-header/proposal-header.spec.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/proposal-detail-header/proposal-header.spec.tsx rename to apps/governance/src/routes/proposals/components/proposal-detail-header/proposal-header.spec.tsx diff --git a/apps/token/src/routes/proposals/components/proposal-detail-header/proposal-header.tsx b/apps/governance/src/routes/proposals/components/proposal-detail-header/proposal-header.tsx similarity index 98% rename from apps/token/src/routes/proposals/components/proposal-detail-header/proposal-header.tsx rename to apps/governance/src/routes/proposals/components/proposal-detail-header/proposal-header.tsx index ca4292efb..327ef478c 100644 --- a/apps/token/src/routes/proposals/components/proposal-detail-header/proposal-header.tsx +++ b/apps/governance/src/routes/proposals/components/proposal-detail-header/proposal-header.tsx @@ -1,6 +1,6 @@ import { useTranslation } from 'react-i18next'; import { Intent, Lozenge } from '@vegaprotocol/ui-toolkit'; -import { shorten } from '@vegaprotocol/react-helpers'; +import { shorten } from '@vegaprotocol/utils'; import { Heading, SubHeading } from '../../../../components/heading'; import type { ReactNode } from 'react'; import type { ProposalFieldsFragment } from '../../proposals/__generated__/Proposals'; diff --git a/apps/token/src/routes/proposals/components/proposal-not-found/index.tsx b/apps/governance/src/routes/proposals/components/proposal-not-found/index.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/proposal-not-found/index.tsx rename to apps/governance/src/routes/proposals/components/proposal-not-found/index.tsx diff --git a/apps/token/src/routes/proposals/components/proposal-not-found/proposal-not-found.spec.tsx b/apps/governance/src/routes/proposals/components/proposal-not-found/proposal-not-found.spec.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/proposal-not-found/proposal-not-found.spec.tsx rename to apps/governance/src/routes/proposals/components/proposal-not-found/proposal-not-found.spec.tsx diff --git a/apps/token/src/routes/proposals/components/proposal-not-found/proposal-not-found.tsx b/apps/governance/src/routes/proposals/components/proposal-not-found/proposal-not-found.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/proposal-not-found/proposal-not-found.tsx rename to apps/governance/src/routes/proposals/components/proposal-not-found/proposal-not-found.tsx diff --git a/apps/token/src/routes/proposals/components/proposal-terms-json/index.tsx b/apps/governance/src/routes/proposals/components/proposal-terms-json/index.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/proposal-terms-json/index.tsx rename to apps/governance/src/routes/proposals/components/proposal-terms-json/index.tsx diff --git a/apps/token/src/routes/proposals/components/proposal-terms-json/proposal-terms-json.tsx b/apps/governance/src/routes/proposals/components/proposal-terms-json/proposal-terms-json.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/proposal-terms-json/proposal-terms-json.tsx rename to apps/governance/src/routes/proposals/components/proposal-terms-json/proposal-terms-json.tsx diff --git a/apps/token/src/routes/proposals/components/proposal-votes-table/index.tsx b/apps/governance/src/routes/proposals/components/proposal-votes-table/index.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/proposal-votes-table/index.tsx rename to apps/governance/src/routes/proposals/components/proposal-votes-table/index.tsx diff --git a/apps/token/src/routes/proposals/components/proposal-votes-table/proposal-votes-table.spec.tsx b/apps/governance/src/routes/proposals/components/proposal-votes-table/proposal-votes-table.spec.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/proposal-votes-table/proposal-votes-table.spec.tsx rename to apps/governance/src/routes/proposals/components/proposal-votes-table/proposal-votes-table.spec.tsx diff --git a/apps/token/src/routes/proposals/components/proposal-votes-table/proposal-votes-table.tsx b/apps/governance/src/routes/proposals/components/proposal-votes-table/proposal-votes-table.tsx similarity index 98% rename from apps/token/src/routes/proposals/components/proposal-votes-table/proposal-votes-table.tsx rename to apps/governance/src/routes/proposals/components/proposal-votes-table/proposal-votes-table.tsx index 09f8ec6cb..d15ce463a 100644 --- a/apps/token/src/routes/proposals/components/proposal-votes-table/proposal-votes-table.tsx +++ b/apps/governance/src/routes/proposals/components/proposal-votes-table/proposal-votes-table.tsx @@ -5,10 +5,7 @@ import { Thumbs, RoundedWrapper, } from '@vegaprotocol/ui-toolkit'; -import { - formatNumber, - formatNumberPercentage, -} from '@vegaprotocol/react-helpers'; +import { formatNumber, formatNumberPercentage } from '@vegaprotocol/utils'; import { SubHeading } from '../../../../components/heading'; import { useVoteInformation } from '../../hooks'; import { useAppState } from '../../../../contexts/app-state/app-state-context'; diff --git a/apps/token/src/routes/proposals/components/proposal/index.tsx b/apps/governance/src/routes/proposals/components/proposal/index.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/proposal/index.tsx rename to apps/governance/src/routes/proposals/components/proposal/index.tsx diff --git a/apps/token/src/routes/proposals/components/proposal/proposal.spec.tsx b/apps/governance/src/routes/proposals/components/proposal/proposal.spec.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/proposal/proposal.spec.tsx rename to apps/governance/src/routes/proposals/components/proposal/proposal.spec.tsx diff --git a/apps/token/src/routes/proposals/components/proposal/proposal.tsx b/apps/governance/src/routes/proposals/components/proposal/proposal.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/proposal/proposal.tsx rename to apps/governance/src/routes/proposals/components/proposal/proposal.tsx diff --git a/apps/token/src/routes/proposals/components/proposals-list-filter/index.tsx b/apps/governance/src/routes/proposals/components/proposals-list-filter/index.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/proposals-list-filter/index.tsx rename to apps/governance/src/routes/proposals/components/proposals-list-filter/index.tsx diff --git a/apps/token/src/routes/proposals/components/proposals-list-filter/proposals-list-filter.tsx b/apps/governance/src/routes/proposals/components/proposals-list-filter/proposals-list-filter.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/proposals-list-filter/proposals-list-filter.tsx rename to apps/governance/src/routes/proposals/components/proposals-list-filter/proposals-list-filter.tsx diff --git a/apps/token/src/routes/proposals/components/proposals-list-item/index.tsx b/apps/governance/src/routes/proposals/components/proposals-list-item/index.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/proposals-list-item/index.tsx rename to apps/governance/src/routes/proposals/components/proposals-list-item/index.tsx diff --git a/apps/token/src/routes/proposals/components/proposals-list-item/proposals-list-item-details.spec.tsx b/apps/governance/src/routes/proposals/components/proposals-list-item/proposals-list-item-details.spec.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/proposals-list-item/proposals-list-item-details.spec.tsx rename to apps/governance/src/routes/proposals/components/proposals-list-item/proposals-list-item-details.spec.tsx diff --git a/apps/token/src/routes/proposals/components/proposals-list-item/proposals-list-item-details.tsx b/apps/governance/src/routes/proposals/components/proposals-list-item/proposals-list-item-details.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/proposals-list-item/proposals-list-item-details.tsx rename to apps/governance/src/routes/proposals/components/proposals-list-item/proposals-list-item-details.tsx diff --git a/apps/token/src/routes/proposals/components/proposals-list-item/proposals-list-item.tsx b/apps/governance/src/routes/proposals/components/proposals-list-item/proposals-list-item.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/proposals-list-item/proposals-list-item.tsx rename to apps/governance/src/routes/proposals/components/proposals-list-item/proposals-list-item.tsx diff --git a/apps/token/src/routes/proposals/components/proposals-list/index.tsx b/apps/governance/src/routes/proposals/components/proposals-list/index.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/proposals-list/index.tsx rename to apps/governance/src/routes/proposals/components/proposals-list/index.tsx diff --git a/apps/token/src/routes/proposals/components/proposals-list/proposals-list.spec.tsx b/apps/governance/src/routes/proposals/components/proposals-list/proposals-list.spec.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/proposals-list/proposals-list.spec.tsx rename to apps/governance/src/routes/proposals/components/proposals-list/proposals-list.spec.tsx diff --git a/apps/token/src/routes/proposals/components/proposals-list/proposals-list.tsx b/apps/governance/src/routes/proposals/components/proposals-list/proposals-list.tsx similarity index 98% rename from apps/token/src/routes/proposals/components/proposals-list/proposals-list.tsx rename to apps/governance/src/routes/proposals/components/proposals-list/proposals-list.tsx index 2051ed593..ab09aef1f 100644 --- a/apps/token/src/routes/proposals/components/proposals-list/proposals-list.tsx +++ b/apps/governance/src/routes/proposals/components/proposals-list/proposals-list.tsx @@ -9,7 +9,7 @@ import { Button } from '@vegaprotocol/ui-toolkit'; import { Link } from 'react-router-dom'; import type { ProposalQuery } from '../../proposal/__generated__/Proposal'; import type { ProposalFieldsFragment } from '../../proposals/__generated__/Proposals'; -import { ExternalLinks } from '@vegaprotocol/react-helpers'; +import { ExternalLinks } from '@vegaprotocol/utils'; import { ExternalLink } from '@vegaprotocol/ui-toolkit'; interface ProposalsListProps { diff --git a/apps/token/src/routes/proposals/components/proposals-list/rejected-proposals-list.spec.tsx b/apps/governance/src/routes/proposals/components/proposals-list/rejected-proposals-list.spec.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/proposals-list/rejected-proposals-list.spec.tsx rename to apps/governance/src/routes/proposals/components/proposals-list/rejected-proposals-list.spec.tsx diff --git a/apps/token/src/routes/proposals/components/proposals-list/rejected-proposals-list.tsx b/apps/governance/src/routes/proposals/components/proposals-list/rejected-proposals-list.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/proposals-list/rejected-proposals-list.tsx rename to apps/governance/src/routes/proposals/components/proposals-list/rejected-proposals-list.tsx diff --git a/apps/token/src/routes/proposals/components/propose/index.tsx b/apps/governance/src/routes/proposals/components/propose/index.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/propose/index.tsx rename to apps/governance/src/routes/proposals/components/propose/index.tsx diff --git a/apps/token/src/routes/proposals/components/propose/proposal-form-description.spec.tsx b/apps/governance/src/routes/proposals/components/propose/proposal-form-description.spec.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/propose/proposal-form-description.spec.tsx rename to apps/governance/src/routes/proposals/components/propose/proposal-form-description.spec.tsx diff --git a/apps/token/src/routes/proposals/components/propose/proposal-form-description.tsx b/apps/governance/src/routes/proposals/components/propose/proposal-form-description.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/propose/proposal-form-description.tsx rename to apps/governance/src/routes/proposals/components/propose/proposal-form-description.tsx diff --git a/apps/token/src/routes/proposals/components/propose/proposal-form-download-json.spec.tsx b/apps/governance/src/routes/proposals/components/propose/proposal-form-download-json.spec.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/propose/proposal-form-download-json.spec.tsx rename to apps/governance/src/routes/proposals/components/propose/proposal-form-download-json.spec.tsx diff --git a/apps/token/src/routes/proposals/components/propose/proposal-form-download-json.tsx b/apps/governance/src/routes/proposals/components/propose/proposal-form-download-json.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/propose/proposal-form-download-json.tsx rename to apps/governance/src/routes/proposals/components/propose/proposal-form-download-json.tsx diff --git a/apps/token/src/routes/proposals/components/propose/proposal-form-subheader.tsx b/apps/governance/src/routes/proposals/components/propose/proposal-form-subheader.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/propose/proposal-form-subheader.tsx rename to apps/governance/src/routes/proposals/components/propose/proposal-form-subheader.tsx diff --git a/apps/token/src/routes/proposals/components/propose/proposal-form-submit.spec.tsx b/apps/governance/src/routes/proposals/components/propose/proposal-form-submit.spec.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/propose/proposal-form-submit.spec.tsx rename to apps/governance/src/routes/proposals/components/propose/proposal-form-submit.spec.tsx diff --git a/apps/token/src/routes/proposals/components/propose/proposal-form-submit.tsx b/apps/governance/src/routes/proposals/components/propose/proposal-form-submit.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/propose/proposal-form-submit.tsx rename to apps/governance/src/routes/proposals/components/propose/proposal-form-submit.tsx diff --git a/apps/token/src/routes/proposals/components/propose/proposal-form-terms.spec.tsx b/apps/governance/src/routes/proposals/components/propose/proposal-form-terms.spec.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/propose/proposal-form-terms.spec.tsx rename to apps/governance/src/routes/proposals/components/propose/proposal-form-terms.spec.tsx diff --git a/apps/token/src/routes/proposals/components/propose/proposal-form-terms.tsx b/apps/governance/src/routes/proposals/components/propose/proposal-form-terms.tsx similarity index 96% rename from apps/token/src/routes/proposals/components/propose/proposal-form-terms.tsx rename to apps/governance/src/routes/proposals/components/propose/proposal-form-terms.tsx index fa1552858..5eba02411 100644 --- a/apps/token/src/routes/proposals/components/propose/proposal-form-terms.tsx +++ b/apps/governance/src/routes/proposals/components/propose/proposal-form-terms.tsx @@ -5,7 +5,7 @@ import { ExternalLink, TextArea, } from '@vegaprotocol/ui-toolkit'; -import { createDocsLinks } from '@vegaprotocol/react-helpers'; +import { createDocsLinks } from '@vegaprotocol/utils'; import { useEnvironment } from '@vegaprotocol/environment'; import type { UseFormRegisterReturn } from 'react-hook-form'; diff --git a/apps/token/src/routes/proposals/components/propose/proposal-form-title.spec.tsx b/apps/governance/src/routes/proposals/components/propose/proposal-form-title.spec.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/propose/proposal-form-title.spec.tsx rename to apps/governance/src/routes/proposals/components/propose/proposal-form-title.spec.tsx diff --git a/apps/token/src/routes/proposals/components/propose/proposal-form-title.tsx b/apps/governance/src/routes/proposals/components/propose/proposal-form-title.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/propose/proposal-form-title.tsx rename to apps/governance/src/routes/proposals/components/propose/proposal-form-title.tsx diff --git a/apps/token/src/routes/proposals/components/propose/proposal-form-transaction-dialog.tsx b/apps/governance/src/routes/proposals/components/propose/proposal-form-transaction-dialog.tsx similarity index 96% rename from apps/token/src/routes/proposals/components/propose/proposal-form-transaction-dialog.tsx rename to apps/governance/src/routes/proposals/components/propose/proposal-form-transaction-dialog.tsx index d6a32f2df..1761981f8 100644 --- a/apps/token/src/routes/proposals/components/propose/proposal-form-transaction-dialog.tsx +++ b/apps/governance/src/routes/proposals/components/propose/proposal-form-transaction-dialog.tsx @@ -2,8 +2,8 @@ import { getProposalDialogIcon, getProposalDialogIntent, getProposalDialogTitle, -} from '@vegaprotocol/governance'; -import type { ProposalEventFieldsFragment } from '@vegaprotocol/governance'; +} from '@vegaprotocol/proposals'; +import type { ProposalEventFieldsFragment } from '@vegaprotocol/proposals'; import type { DialogProps } from '@vegaprotocol/wallet'; interface ProposalFormTransactionDialogProps { diff --git a/apps/token/src/routes/proposals/components/propose/proposal-form-vote-and-enactment-deadline.spec.tsx b/apps/governance/src/routes/proposals/components/propose/proposal-form-vote-and-enactment-deadline.spec.tsx similarity index 98% rename from apps/token/src/routes/proposals/components/propose/proposal-form-vote-and-enactment-deadline.spec.tsx rename to apps/governance/src/routes/proposals/components/propose/proposal-form-vote-and-enactment-deadline.spec.tsx index 0e04c8c7e..743f319ff 100644 --- a/apps/token/src/routes/proposals/components/propose/proposal-form-vote-and-enactment-deadline.spec.tsx +++ b/apps/governance/src/routes/proposals/components/propose/proposal-form-vote-and-enactment-deadline.spec.tsx @@ -1,8 +1,8 @@ import { render, screen, fireEvent, act } from '@testing-library/react'; import { ProposalFormVoteAndEnactmentDeadline } from './proposal-form-vote-and-enactment-deadline'; -jest.mock('@vegaprotocol/react-helpers', () => ({ - ...jest.requireActual('@vegaprotocol/react-helpers'), +jest.mock('@vegaprotocol/utils', () => ({ + ...jest.requireActual('@vegaprotocol/utils'), getDateTimeFormat: jest.fn(() => ({ format: (date: Date) => date.toISOString(), })), diff --git a/apps/token/src/routes/proposals/components/propose/proposal-form-vote-and-enactment-deadline.tsx b/apps/governance/src/routes/proposals/components/propose/proposal-form-vote-and-enactment-deadline.tsx similarity index 99% rename from apps/token/src/routes/proposals/components/propose/proposal-form-vote-and-enactment-deadline.tsx rename to apps/governance/src/routes/proposals/components/propose/proposal-form-vote-and-enactment-deadline.tsx index 9f2c3125f..39041500b 100644 --- a/apps/token/src/routes/proposals/components/propose/proposal-form-vote-and-enactment-deadline.tsx +++ b/apps/governance/src/routes/proposals/components/propose/proposal-form-vote-and-enactment-deadline.tsx @@ -6,14 +6,14 @@ import { Input, InputError, } from '@vegaprotocol/ui-toolkit'; -import { getDateTimeFormat } from '@vegaprotocol/react-helpers'; +import { getDateTimeFormat } from '@vegaprotocol/utils'; import { addHours } from 'date-fns'; import { addTwoMinutes, deadlineToSeconds, secondsToRoundedHours, subtractTwoSeconds, -} from '@vegaprotocol/governance'; +} from '@vegaprotocol/proposals'; import { ProposalFormSubheader } from './proposal-form-subheader'; import type { UseFormRegisterReturn } from 'react-hook-form'; diff --git a/apps/token/src/routes/proposals/components/shared/index.tsx b/apps/governance/src/routes/proposals/components/shared/index.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/shared/index.tsx rename to apps/governance/src/routes/proposals/components/shared/index.tsx diff --git a/apps/token/src/routes/proposals/components/shared/proposal-min-requirements.spec.tsx b/apps/governance/src/routes/proposals/components/shared/proposal-min-requirements.spec.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/shared/proposal-min-requirements.spec.tsx rename to apps/governance/src/routes/proposals/components/shared/proposal-min-requirements.spec.tsx diff --git a/apps/token/src/routes/proposals/components/shared/proposal-min-requirements.tsx b/apps/governance/src/routes/proposals/components/shared/proposal-min-requirements.tsx similarity index 95% rename from apps/token/src/routes/proposals/components/shared/proposal-min-requirements.tsx rename to apps/governance/src/routes/proposals/components/shared/proposal-min-requirements.tsx index db958aae2..3c93c2e8f 100644 --- a/apps/token/src/routes/proposals/components/shared/proposal-min-requirements.tsx +++ b/apps/governance/src/routes/proposals/components/shared/proposal-min-requirements.tsx @@ -1,6 +1,6 @@ import { useTranslation } from 'react-i18next'; import BigNumber from 'bignumber.js'; -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; export enum ProposalUserAction { CREATE = 'CREATE', diff --git a/apps/token/src/routes/proposals/components/vote-details/Stake.graphql b/apps/governance/src/routes/proposals/components/vote-details/Stake.graphql similarity index 100% rename from apps/token/src/routes/proposals/components/vote-details/Stake.graphql rename to apps/governance/src/routes/proposals/components/vote-details/Stake.graphql diff --git a/apps/token/src/routes/proposals/components/vote-details/Vote.graphql b/apps/governance/src/routes/proposals/components/vote-details/Vote.graphql similarity index 100% rename from apps/token/src/routes/proposals/components/vote-details/Vote.graphql rename to apps/governance/src/routes/proposals/components/vote-details/Vote.graphql diff --git a/apps/governance/src/routes/proposals/components/vote-details/__generated__/Stake.ts b/apps/governance/src/routes/proposals/components/vote-details/__generated__/Stake.ts new file mode 100644 index 000000000..0e4e61719 --- /dev/null +++ b/apps/governance/src/routes/proposals/components/vote-details/__generated__/Stake.ts @@ -0,0 +1,80 @@ +import * as Types from '@vegaprotocol/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type VoteButtonsQueryVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + +export type VoteButtonsQuery = { + __typename?: 'Query'; + party?: { + __typename?: 'Party'; + id: string; + stakingSummary: { + __typename?: 'StakingSummary'; + currentStakeAvailable: string; + }; + } | null; +}; + +export const VoteButtonsDocument = gql` + query VoteButtons($partyId: ID!) { + party(id: $partyId) { + id + stakingSummary { + currentStakeAvailable + } + } + } +`; + +/** + * __useVoteButtonsQuery__ + * + * To run a query within a React component, call `useVoteButtonsQuery` and pass it any options that fit your needs. + * When your component renders, `useVoteButtonsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useVoteButtonsQuery({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function useVoteButtonsQuery( + baseOptions: Apollo.QueryHookOptions< + VoteButtonsQuery, + VoteButtonsQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery( + VoteButtonsDocument, + options + ); +} +export function useVoteButtonsLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + VoteButtonsQuery, + VoteButtonsQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery( + VoteButtonsDocument, + options + ); +} +export type VoteButtonsQueryHookResult = ReturnType; +export type VoteButtonsLazyQueryHookResult = ReturnType< + typeof useVoteButtonsLazyQuery +>; +export type VoteButtonsQueryResult = Apollo.QueryResult< + VoteButtonsQuery, + VoteButtonsQueryVariables +>; diff --git a/apps/governance/src/routes/proposals/components/vote-details/__generated__/Vote.ts b/apps/governance/src/routes/proposals/components/vote-details/__generated__/Vote.ts new file mode 100644 index 000000000..b8fb48e2f --- /dev/null +++ b/apps/governance/src/routes/proposals/components/vote-details/__generated__/Vote.ts @@ -0,0 +1,90 @@ +import * as Types from '@vegaprotocol/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type UserVoteQueryVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + +export type UserVoteQuery = { + __typename?: 'Query'; + party?: { + __typename?: 'Party'; + votesConnection?: { + __typename?: 'ProposalVoteConnection'; + edges?: Array<{ + __typename?: 'ProposalVoteEdge'; + node: { + __typename?: 'ProposalVote'; + proposalId: string; + vote: { __typename?: 'Vote'; value: Types.VoteValue; datetime: any }; + }; + }> | null; + } | null; + } | null; +}; + +export const UserVoteDocument = gql` + query UserVote($partyId: ID!) { + party(id: $partyId) { + votesConnection { + edges { + node { + proposalId + vote { + value + datetime + } + } + } + } + } + } +`; + +/** + * __useUserVoteQuery__ + * + * To run a query within a React component, call `useUserVoteQuery` and pass it any options that fit your needs. + * When your component renders, `useUserVoteQuery` 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 } = useUserVoteQuery({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function useUserVoteQuery( + baseOptions: Apollo.QueryHookOptions +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery( + UserVoteDocument, + options + ); +} +export function useUserVoteLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + UserVoteQuery, + UserVoteQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery( + UserVoteDocument, + options + ); +} +export type UserVoteQueryHookResult = ReturnType; +export type UserVoteLazyQueryHookResult = ReturnType< + typeof useUserVoteLazyQuery +>; +export type UserVoteQueryResult = Apollo.QueryResult< + UserVoteQuery, + UserVoteQueryVariables +>; diff --git a/apps/token/src/routes/proposals/components/vote-details/index.tsx b/apps/governance/src/routes/proposals/components/vote-details/index.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/vote-details/index.tsx rename to apps/governance/src/routes/proposals/components/vote-details/index.tsx diff --git a/apps/token/src/routes/proposals/components/vote-details/use-user-vote.tsx b/apps/governance/src/routes/proposals/components/vote-details/use-user-vote.tsx similarity index 95% rename from apps/token/src/routes/proposals/components/vote-details/use-user-vote.tsx rename to apps/governance/src/routes/proposals/components/vote-details/use-user-vote.tsx index 610c2cd27..826794ac7 100644 --- a/apps/token/src/routes/proposals/components/vote-details/use-user-vote.tsx +++ b/apps/governance/src/routes/proposals/components/vote-details/use-user-vote.tsx @@ -4,8 +4,8 @@ import { useVegaWallet } from '@vegaprotocol/wallet'; import { VoteValue } from '@vegaprotocol/types'; import { useEffect, useState } from 'react'; import { useUserVoteQuery } from './__generated__/Vote'; -import { removePaginationWrapper } from '@vegaprotocol/react-helpers'; -import type { FinalizedVote } from '@vegaprotocol/governance'; +import type { FinalizedVote } from '@vegaprotocol/proposals'; +import { removePaginationWrapper } from '@vegaprotocol/utils'; export enum VoteState { NotCast = 'NotCast', diff --git a/apps/token/src/routes/proposals/components/vote-details/vote-buttons.spec.tsx b/apps/governance/src/routes/proposals/components/vote-details/vote-buttons.spec.tsx similarity index 100% rename from apps/token/src/routes/proposals/components/vote-details/vote-buttons.spec.tsx rename to apps/governance/src/routes/proposals/components/vote-details/vote-buttons.spec.tsx diff --git a/apps/token/src/routes/proposals/components/vote-details/vote-buttons.tsx b/apps/governance/src/routes/proposals/components/vote-details/vote-buttons.tsx similarity index 98% rename from apps/token/src/routes/proposals/components/vote-details/vote-buttons.tsx rename to apps/governance/src/routes/proposals/components/vote-details/vote-buttons.tsx index bf6ec86ec..106f5c575 100644 --- a/apps/token/src/routes/proposals/components/vote-details/vote-buttons.tsx +++ b/apps/governance/src/routes/proposals/components/vote-details/vote-buttons.tsx @@ -3,7 +3,7 @@ import React, { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { useVegaWallet, useVegaWalletDialogStore } from '@vegaprotocol/wallet'; import { AsyncRenderer, Button, ButtonLink } from '@vegaprotocol/ui-toolkit'; -import { addDecimal, toBigNum } from '@vegaprotocol/react-helpers'; +import { addDecimal, toBigNum } from '@vegaprotocol/utils'; import { ProposalState, VoteValue } from '@vegaprotocol/types'; import { AppStateActionType, diff --git a/apps/token/src/routes/proposals/components/vote-details/vote-details.tsx b/apps/governance/src/routes/proposals/components/vote-details/vote-details.tsx similarity index 98% rename from apps/token/src/routes/proposals/components/vote-details/vote-details.tsx rename to apps/governance/src/routes/proposals/components/vote-details/vote-details.tsx index fa307b8eb..c1d781106 100644 --- a/apps/token/src/routes/proposals/components/vote-details/vote-details.tsx +++ b/apps/governance/src/routes/proposals/components/vote-details/vote-details.tsx @@ -2,7 +2,7 @@ import { useTranslation } from 'react-i18next'; import { formatDistanceToNow } from 'date-fns'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { ProposalState } from '@vegaprotocol/types'; -import { useVoteSubmit, VoteProgress } from '@vegaprotocol/governance'; +import { useVoteSubmit, VoteProgress } from '@vegaprotocol/proposals'; import { formatNumber } from '../../../../lib/format-number'; import { ConnectToVega } from '../../../../components/connect-to-vega'; import { useVoteInformation } from '../../hooks'; diff --git a/apps/token/src/routes/proposals/components/vote-details/vote-transaction-dialog.tsx b/apps/governance/src/routes/proposals/components/vote-details/vote-transaction-dialog.tsx similarity index 95% rename from apps/token/src/routes/proposals/components/vote-details/vote-transaction-dialog.tsx rename to apps/governance/src/routes/proposals/components/vote-details/vote-transaction-dialog.tsx index 578dc76ef..59f04d705 100644 --- a/apps/token/src/routes/proposals/components/vote-details/vote-transaction-dialog.tsx +++ b/apps/governance/src/routes/proposals/components/vote-details/vote-transaction-dialog.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { VoteState } from './use-user-vote'; import type { DialogProps } from '@vegaprotocol/wallet'; diff --git a/apps/token/src/routes/proposals/hooks/index.tsx b/apps/governance/src/routes/proposals/hooks/index.tsx similarity index 100% rename from apps/token/src/routes/proposals/hooks/index.tsx rename to apps/governance/src/routes/proposals/hooks/index.tsx diff --git a/apps/token/src/routes/proposals/hooks/use-proposal-network-params.spec.ts b/apps/governance/src/routes/proposals/hooks/use-proposal-network-params.spec.ts similarity index 100% rename from apps/token/src/routes/proposals/hooks/use-proposal-network-params.spec.ts rename to apps/governance/src/routes/proposals/hooks/use-proposal-network-params.spec.ts diff --git a/apps/token/src/routes/proposals/hooks/use-proposal-network-params.ts b/apps/governance/src/routes/proposals/hooks/use-proposal-network-params.ts similarity index 100% rename from apps/token/src/routes/proposals/hooks/use-proposal-network-params.ts rename to apps/governance/src/routes/proposals/hooks/use-proposal-network-params.ts diff --git a/apps/token/src/routes/proposals/hooks/use-vote-information.spec.ts b/apps/governance/src/routes/proposals/hooks/use-vote-information.spec.ts similarity index 100% rename from apps/token/src/routes/proposals/hooks/use-vote-information.spec.ts rename to apps/governance/src/routes/proposals/hooks/use-vote-information.spec.ts diff --git a/apps/token/src/routes/proposals/hooks/use-vote-information.ts b/apps/governance/src/routes/proposals/hooks/use-vote-information.ts similarity index 99% rename from apps/token/src/routes/proposals/hooks/use-vote-information.ts rename to apps/governance/src/routes/proposals/hooks/use-vote-information.ts index 7b475d225..741e8f6c8 100644 --- a/apps/token/src/routes/proposals/hooks/use-vote-information.ts +++ b/apps/governance/src/routes/proposals/hooks/use-vote-information.ts @@ -4,7 +4,7 @@ import { BigNumber } from '../../../lib/bignumber'; import { useProposalNetworkParams } from './use-proposal-network-params'; import type { ProposalFieldsFragment } from '../proposals/__generated__/Proposals'; import type { ProposalQuery } from '../proposal/__generated__/Proposal'; -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; export const useVoteInformation = ({ proposal, diff --git a/apps/token/src/routes/proposals/index.tsx b/apps/governance/src/routes/proposals/index.tsx similarity index 100% rename from apps/token/src/routes/proposals/index.tsx rename to apps/governance/src/routes/proposals/index.tsx diff --git a/apps/token/src/routes/proposals/proposal/Proposal.graphql b/apps/governance/src/routes/proposals/proposal/Proposal.graphql similarity index 100% rename from apps/token/src/routes/proposals/proposal/Proposal.graphql rename to apps/governance/src/routes/proposals/proposal/Proposal.graphql diff --git a/apps/governance/src/routes/proposals/proposal/__generated__/Proposal.ts b/apps/governance/src/routes/proposals/proposal/__generated__/Proposal.ts new file mode 100644 index 000000000..4764d5458 --- /dev/null +++ b/apps/governance/src/routes/proposals/proposal/__generated__/Proposal.ts @@ -0,0 +1,774 @@ +import * as Types from '@vegaprotocol/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type ProposalQueryVariables = Types.Exact<{ + proposalId: Types.Scalars['ID']; +}>; + +export type ProposalQuery = { + __typename?: 'Query'; + proposal?: { + __typename?: 'Proposal'; + id?: string | null; + reference: string; + state: Types.ProposalState; + datetime: any; + rejectionReason?: Types.ProposalRejectionReason | null; + errorDetails?: string | null; + rationale: { + __typename?: 'ProposalRationale'; + title: string; + description: string; + }; + party: { __typename?: 'Party'; id: string }; + terms: { + __typename?: 'ProposalTerms'; + closingDatetime: any; + enactmentDatetime?: any | null; + change: + | { + __typename?: 'NewAsset'; + name: string; + symbol: string; + decimals: number; + quantum: string; + source: + | { __typename?: 'BuiltinAsset'; maxFaucetAmountMint: string } + | { + __typename?: 'ERC20'; + contractAddress: string; + lifetimeLimit: string; + withdrawThreshold: string; + }; + } + | { __typename?: 'NewFreeform' } + | { + __typename?: 'NewMarket'; + decimalPlaces: number; + metadata?: Array | null; + lpPriceRange: string; + positionDecimalPlaces: number; + linearSlippageFactor: string; + quadraticSlippageFactor: string; + riskParameters: + | { + __typename?: 'LogNormalRiskModel'; + riskAversionParameter: number; + tau: number; + params: { + __typename?: 'LogNormalModelParams'; + mu: number; + r: number; + sigma: number; + }; + } + | { + __typename?: 'SimpleRiskModel'; + params: { + __typename?: 'SimpleRiskModelParams'; + factorLong: number; + factorShort: number; + }; + }; + instrument: { + __typename?: 'InstrumentConfiguration'; + name: string; + code: string; + futureProduct?: { + __typename?: 'FutureProduct'; + quoteName: string; + settlementAsset: { + __typename?: 'Asset'; + id: string; + name: string; + symbol: string; + decimals: number; + quantum: string; + }; + dataSourceSpecForSettlementData: { + __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'; + operator: Types.ConditionOperator; + value?: string | null; + }> | null; + }> | null; + }; + } + | { + __typename?: 'DataSourceDefinitionInternal'; + sourceType: { + __typename?: 'DataSourceSpecConfigurationTime'; + conditions: Array<{ + __typename?: 'Condition'; + operator: Types.ConditionOperator; + value?: string | null; + } | null>; + }; + }; + }; + dataSourceSpecForTradingTermination: { + __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'; + operator: Types.ConditionOperator; + value?: string | null; + }> | null; + }> | null; + }; + } + | { + __typename?: 'DataSourceDefinitionInternal'; + sourceType: { + __typename?: 'DataSourceSpecConfigurationTime'; + conditions: Array<{ + __typename?: 'Condition'; + operator: Types.ConditionOperator; + value?: string | null; + } | null>; + }; + }; + }; + dataSourceSpecBinding: { + __typename?: 'DataSourceSpecToFutureBinding'; + settlementDataProperty: string; + tradingTerminationProperty: string; + }; + } | null; + }; + priceMonitoringParameters: { + __typename?: 'PriceMonitoringParameters'; + triggers?: Array<{ + __typename?: 'PriceMonitoringTrigger'; + horizonSecs: number; + probability: number; + auctionExtensionSecs: number; + }> | null; + }; + liquidityMonitoringParameters: { + __typename?: 'LiquidityMonitoringParameters'; + triggeringRatio: string; + targetStakeParameters: { + __typename?: 'TargetStakeParameters'; + timeWindow: number; + scalingFactor: number; + }; + }; + } + | { + __typename?: 'UpdateAsset'; + quantum: string; + assetId: string; + source: { + __typename?: 'UpdateERC20'; + lifetimeLimit: string; + withdrawThreshold: string; + }; + } + | { + __typename?: 'UpdateMarket'; + marketId: string; + updateMarketConfiguration: { + __typename?: 'UpdateMarketConfiguration'; + metadata?: Array | null; + instrument: { + __typename?: 'UpdateInstrumentConfiguration'; + code: string; + product: { + __typename?: 'UpdateFutureProduct'; + quoteName: string; + dataSourceSpecForSettlementData: { + __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'; + operator: Types.ConditionOperator; + value?: string | null; + }> | null; + }> | null; + }; + } + | { + __typename?: 'DataSourceDefinitionInternal'; + sourceType: { + __typename?: 'DataSourceSpecConfigurationTime'; + conditions: Array<{ + __typename?: 'Condition'; + operator: Types.ConditionOperator; + value?: string | null; + } | null>; + }; + }; + }; + dataSourceSpecForTradingTermination: { + __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'; + operator: Types.ConditionOperator; + value?: string | null; + }> | null; + }> | null; + }; + } + | { + __typename?: 'DataSourceDefinitionInternal'; + sourceType: { + __typename?: 'DataSourceSpecConfigurationTime'; + conditions: Array<{ + __typename?: 'Condition'; + operator: Types.ConditionOperator; + value?: string | null; + } | null>; + }; + }; + }; + dataSourceSpecBinding: { + __typename?: 'DataSourceSpecToFutureBinding'; + settlementDataProperty: string; + tradingTerminationProperty: string; + }; + }; + }; + priceMonitoringParameters: { + __typename?: 'PriceMonitoringParameters'; + triggers?: Array<{ + __typename?: 'PriceMonitoringTrigger'; + horizonSecs: number; + probability: number; + auctionExtensionSecs: number; + }> | null; + }; + liquidityMonitoringParameters: { + __typename?: 'LiquidityMonitoringParameters'; + triggeringRatio: string; + targetStakeParameters: { + __typename?: 'TargetStakeParameters'; + timeWindow: number; + scalingFactor: number; + }; + }; + riskParameters: + | { + __typename?: 'UpdateMarketLogNormalRiskModel'; + logNormal?: { + __typename?: 'LogNormalRiskModel'; + riskAversionParameter: number; + tau: number; + params: { + __typename?: 'LogNormalModelParams'; + r: number; + sigma: number; + mu: number; + }; + } | null; + } + | { + __typename?: 'UpdateMarketSimpleRiskModel'; + simple?: { + __typename?: 'SimpleRiskModelParams'; + factorLong: number; + factorShort: number; + } | null; + }; + }; + } + | { + __typename?: 'UpdateNetworkParameter'; + networkParameter: { + __typename?: 'NetworkParameter'; + key: string; + value: string; + }; + }; + }; + votes: { + __typename?: 'ProposalVotes'; + yes: { + __typename?: 'ProposalVoteSide'; + totalTokens: string; + totalNumber: string; + totalEquityLikeShareWeight: string; + }; + no: { + __typename?: 'ProposalVoteSide'; + totalTokens: string; + totalNumber: string; + totalEquityLikeShareWeight: string; + }; + }; + } | null; +}; + +export const ProposalDocument = gql` + query Proposal($proposalId: ID!) { + proposal(id: $proposalId) { + id + rationale { + title + description + } + reference + state + datetime + rejectionReason + party { + id + } + errorDetails + terms { + closingDatetime + enactmentDatetime + change { + ... on NewMarket { + decimalPlaces + metadata + lpPriceRange + riskParameters { + ... on LogNormalRiskModel { + riskAversionParameter + tau + params { + mu + r + sigma + } + } + ... on SimpleRiskModel { + params { + factorLong + factorShort + } + } + } + instrument { + name + code + futureProduct { + settlementAsset { + id + name + symbol + decimals + quantum + } + quoteName + dataSourceSpecForSettlementData { + sourceType { + ... on DataSourceDefinitionInternal { + sourceType { + ... on DataSourceSpecConfigurationTime { + conditions { + operator + value + } + } + } + } + ... on DataSourceDefinitionExternal { + sourceType { + ... on DataSourceSpecConfiguration { + signers { + signer { + ... on PubKey { + key + } + ... on ETHAddress { + address + } + } + } + filters { + key { + name + type + } + conditions { + operator + value + } + } + } + } + } + } + } + dataSourceSpecForTradingTermination { + sourceType { + ... on DataSourceDefinitionInternal { + sourceType { + ... on DataSourceSpecConfigurationTime { + conditions { + operator + value + } + } + } + } + ... on DataSourceDefinitionExternal { + sourceType { + ... on DataSourceSpecConfiguration { + signers { + signer { + ... on PubKey { + key + } + ... on ETHAddress { + address + } + } + } + filters { + key { + name + type + } + conditions { + operator + value + } + } + } + } + } + } + } + dataSourceSpecBinding { + settlementDataProperty + tradingTerminationProperty + } + } + } + priceMonitoringParameters { + triggers { + horizonSecs + probability + auctionExtensionSecs + } + } + liquidityMonitoringParameters { + triggeringRatio + targetStakeParameters { + timeWindow + scalingFactor + } + } + positionDecimalPlaces + lpPriceRange + linearSlippageFactor + quadraticSlippageFactor + } + ... on UpdateMarket { + marketId + updateMarketConfiguration { + instrument { + code + product { + quoteName + dataSourceSpecForSettlementData { + sourceType { + ... on DataSourceDefinitionInternal { + sourceType { + ... on DataSourceSpecConfigurationTime { + conditions { + operator + value + } + } + } + } + ... on DataSourceDefinitionExternal { + sourceType { + ... on DataSourceSpecConfiguration { + signers { + signer { + ... on PubKey { + key + } + ... on ETHAddress { + address + } + } + } + filters { + key { + name + type + } + conditions { + operator + value + } + } + } + } + } + } + } + dataSourceSpecForTradingTermination { + sourceType { + ... on DataSourceDefinitionInternal { + sourceType { + ... on DataSourceSpecConfigurationTime { + conditions { + operator + value + } + } + } + } + ... on DataSourceDefinitionExternal { + sourceType { + ... on DataSourceSpecConfiguration { + signers { + signer { + ... on PubKey { + key + } + ... on ETHAddress { + address + } + } + } + filters { + key { + name + type + } + conditions { + operator + value + } + } + } + } + } + } + } + dataSourceSpecBinding { + settlementDataProperty + tradingTerminationProperty + } + } + } + metadata + priceMonitoringParameters { + triggers { + horizonSecs + probability + auctionExtensionSecs + } + } + liquidityMonitoringParameters { + triggeringRatio + targetStakeParameters { + timeWindow + scalingFactor + } + } + riskParameters { + ... on UpdateMarketSimpleRiskModel { + simple { + factorLong + factorShort + } + } + ... on UpdateMarketLogNormalRiskModel { + logNormal { + riskAversionParameter + tau + params { + r + sigma + mu + } + } + } + } + } + } + ... on NewAsset { + name + symbol + decimals + quantum + source { + ... on BuiltinAsset { + maxFaucetAmountMint + } + ... on ERC20 { + contractAddress + lifetimeLimit + withdrawThreshold + } + } + } + ... on UpdateNetworkParameter { + networkParameter { + key + value + } + } + ... on UpdateAsset { + quantum + assetId + source { + ... on UpdateERC20 { + lifetimeLimit + withdrawThreshold + } + } + } + } + } + votes { + yes { + totalTokens + totalNumber + totalEquityLikeShareWeight + } + no { + totalTokens + totalNumber + totalEquityLikeShareWeight + } + } + } + } +`; + +/** + * __useProposalQuery__ + * + * To run a query within a React component, call `useProposalQuery` and pass it any options that fit your needs. + * When your component renders, `useProposalQuery` 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 } = useProposalQuery({ + * variables: { + * proposalId: // value for 'proposalId' + * }, + * }); + */ +export function useProposalQuery( + baseOptions: Apollo.QueryHookOptions +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery( + ProposalDocument, + options + ); +} +export function useProposalLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + ProposalQuery, + ProposalQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery( + ProposalDocument, + options + ); +} +export type ProposalQueryHookResult = ReturnType; +export type ProposalLazyQueryHookResult = ReturnType< + typeof useProposalLazyQuery +>; +export type ProposalQueryResult = Apollo.QueryResult< + ProposalQuery, + ProposalQueryVariables +>; diff --git a/apps/token/src/routes/proposals/proposal/index.tsx b/apps/governance/src/routes/proposals/proposal/index.tsx similarity index 100% rename from apps/token/src/routes/proposals/proposal/index.tsx rename to apps/governance/src/routes/proposals/proposal/index.tsx diff --git a/apps/token/src/routes/proposals/proposal/proposal-container.spec.tsx b/apps/governance/src/routes/proposals/proposal/proposal-container.spec.tsx similarity index 100% rename from apps/token/src/routes/proposals/proposal/proposal-container.spec.tsx rename to apps/governance/src/routes/proposals/proposal/proposal-container.spec.tsx diff --git a/apps/token/src/routes/proposals/proposal/proposal-container.tsx b/apps/governance/src/routes/proposals/proposal/proposal-container.tsx similarity index 100% rename from apps/token/src/routes/proposals/proposal/proposal-container.tsx rename to apps/governance/src/routes/proposals/proposal/proposal-container.tsx diff --git a/apps/token/src/routes/proposals/proposals/Proposals.graphql b/apps/governance/src/routes/proposals/proposals/Proposals.graphql similarity index 100% rename from apps/token/src/routes/proposals/proposals/Proposals.graphql rename to apps/governance/src/routes/proposals/proposals/Proposals.graphql diff --git a/apps/governance/src/routes/proposals/proposals/__generated__/Proposals.ts b/apps/governance/src/routes/proposals/proposals/__generated__/Proposals.ts new file mode 100644 index 000000000..594a034e7 --- /dev/null +++ b/apps/governance/src/routes/proposals/proposals/__generated__/Proposals.ts @@ -0,0 +1,323 @@ +import * as Types from '@vegaprotocol/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type ProposalFieldsFragment = { + __typename?: 'Proposal'; + id?: string | null; + reference: string; + state: Types.ProposalState; + datetime: any; + rejectionReason?: Types.ProposalRejectionReason | null; + errorDetails?: string | null; + rationale: { + __typename?: 'ProposalRationale'; + title: string; + description: string; + }; + party: { __typename?: 'Party'; id: string }; + terms: { + __typename?: 'ProposalTerms'; + closingDatetime: any; + enactmentDatetime?: any | null; + change: + | { + __typename: 'NewAsset'; + name: string; + symbol: string; + decimals: number; + quantum: string; + source: + | { __typename?: 'BuiltinAsset'; maxFaucetAmountMint: string } + | { + __typename?: 'ERC20'; + contractAddress: string; + withdrawThreshold: string; + lifetimeLimit: string; + }; + } + | { __typename?: 'NewFreeform' } + | { + __typename?: 'NewMarket'; + instrument: { + __typename?: 'InstrumentConfiguration'; + name: string; + code: string; + futureProduct?: { + __typename?: 'FutureProduct'; + settlementAsset: { __typename?: 'Asset'; symbol: string }; + } | null; + }; + } + | { + __typename?: 'UpdateAsset'; + quantum: string; + assetId: string; + source: { + __typename?: 'UpdateERC20'; + lifetimeLimit: string; + withdrawThreshold: string; + }; + } + | { __typename?: 'UpdateMarket'; marketId: string } + | { + __typename?: 'UpdateNetworkParameter'; + networkParameter: { + __typename?: 'NetworkParameter'; + key: string; + value: string; + }; + }; + }; + votes: { + __typename?: 'ProposalVotes'; + yes: { + __typename?: 'ProposalVoteSide'; + totalTokens: string; + totalNumber: string; + totalEquityLikeShareWeight: string; + }; + no: { + __typename?: 'ProposalVoteSide'; + totalTokens: string; + totalNumber: string; + totalEquityLikeShareWeight: string; + }; + }; +}; + +export type ProposalsQueryVariables = Types.Exact<{ [key: string]: never }>; + +export type ProposalsQuery = { + __typename?: 'Query'; + proposalsConnection?: { + __typename?: 'ProposalsConnection'; + edges?: Array<{ + __typename?: 'ProposalEdge'; + node: { + __typename?: 'Proposal'; + id?: string | null; + reference: string; + state: Types.ProposalState; + datetime: any; + rejectionReason?: Types.ProposalRejectionReason | null; + errorDetails?: string | null; + rationale: { + __typename?: 'ProposalRationale'; + title: string; + description: string; + }; + party: { __typename?: 'Party'; id: string }; + terms: { + __typename?: 'ProposalTerms'; + closingDatetime: any; + enactmentDatetime?: any | null; + change: + | { + __typename: 'NewAsset'; + name: string; + symbol: string; + decimals: number; + quantum: string; + source: + | { __typename?: 'BuiltinAsset'; maxFaucetAmountMint: string } + | { + __typename?: 'ERC20'; + contractAddress: string; + withdrawThreshold: string; + lifetimeLimit: string; + }; + } + | { __typename?: 'NewFreeform' } + | { + __typename?: 'NewMarket'; + instrument: { + __typename?: 'InstrumentConfiguration'; + name: string; + code: string; + futureProduct?: { + __typename?: 'FutureProduct'; + settlementAsset: { __typename?: 'Asset'; symbol: string }; + } | null; + }; + } + | { + __typename?: 'UpdateAsset'; + quantum: string; + assetId: string; + source: { + __typename?: 'UpdateERC20'; + lifetimeLimit: string; + withdrawThreshold: string; + }; + } + | { __typename?: 'UpdateMarket'; marketId: string } + | { + __typename?: 'UpdateNetworkParameter'; + networkParameter: { + __typename?: 'NetworkParameter'; + key: string; + value: string; + }; + }; + }; + votes: { + __typename?: 'ProposalVotes'; + yes: { + __typename?: 'ProposalVoteSide'; + totalTokens: string; + totalNumber: string; + totalEquityLikeShareWeight: string; + }; + no: { + __typename?: 'ProposalVoteSide'; + totalTokens: string; + totalNumber: string; + totalEquityLikeShareWeight: string; + }; + }; + }; + } | null> | null; + } | null; +}; + +export const ProposalFieldsFragmentDoc = gql` + fragment ProposalFields on Proposal { + id + rationale { + title + description + } + reference + state + datetime + rejectionReason + party { + id + } + errorDetails + terms { + closingDatetime + enactmentDatetime + change { + ... on NewMarket { + instrument { + name + code + futureProduct { + settlementAsset { + symbol + } + } + } + } + ... on UpdateMarket { + marketId + } + ... on NewAsset { + __typename + name + symbol + decimals + quantum + source { + ... on BuiltinAsset { + maxFaucetAmountMint + } + ... on ERC20 { + contractAddress + withdrawThreshold + lifetimeLimit + } + } + } + ... on UpdateNetworkParameter { + networkParameter { + key + value + } + } + ... on UpdateAsset { + quantum + assetId + source { + ... on UpdateERC20 { + lifetimeLimit + withdrawThreshold + } + } + } + } + } + votes { + yes { + totalTokens + totalNumber + totalEquityLikeShareWeight + } + no { + totalTokens + totalNumber + totalEquityLikeShareWeight + } + } + } +`; +export const ProposalsDocument = gql` + query Proposals { + proposalsConnection { + edges { + node { + ...ProposalFields + } + } + } + } + ${ProposalFieldsFragmentDoc} +`; + +/** + * __useProposalsQuery__ + * + * To run a query within a React component, call `useProposalsQuery` and pass it any options that fit your needs. + * When your component renders, `useProposalsQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useProposalsQuery({ + * variables: { + * }, + * }); + */ +export function useProposalsQuery( + baseOptions?: Apollo.QueryHookOptions +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery( + ProposalsDocument, + options + ); +} +export function useProposalsLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + ProposalsQuery, + ProposalsQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery( + ProposalsDocument, + options + ); +} +export type ProposalsQueryHookResult = ReturnType; +export type ProposalsLazyQueryHookResult = ReturnType< + typeof useProposalsLazyQuery +>; +export type ProposalsQueryResult = Apollo.QueryResult< + ProposalsQuery, + ProposalsQueryVariables +>; diff --git a/apps/token/src/routes/proposals/proposals/index.tsx b/apps/governance/src/routes/proposals/proposals/index.tsx similarity index 100% rename from apps/token/src/routes/proposals/proposals/index.tsx rename to apps/governance/src/routes/proposals/proposals/index.tsx diff --git a/apps/token/src/routes/proposals/proposals/proposals-container.tsx b/apps/governance/src/routes/proposals/proposals/proposals-container.tsx similarity index 93% rename from apps/token/src/routes/proposals/proposals/proposals-container.tsx rename to apps/governance/src/routes/proposals/proposals/proposals-container.tsx index da03e2298..92a2ef4e9 100644 --- a/apps/token/src/routes/proposals/proposals/proposals-container.tsx +++ b/apps/governance/src/routes/proposals/proposals/proposals-container.tsx @@ -6,8 +6,8 @@ import { SplashLoader } from '../../../components/splash-loader'; import { ProposalsList } from '../components/proposals-list'; import { useProposalsQuery } from './__generated__/Proposals'; import type { ProposalFieldsFragment } from './__generated__/Proposals'; -import type { NodeConnection, NodeEdge } from '@vegaprotocol/react-helpers'; -import { getNodes } from '@vegaprotocol/react-helpers'; +import type { NodeConnection, NodeEdge } from '@vegaprotocol/utils'; +import { getNodes } from '@vegaprotocol/utils'; import flow from 'lodash/flow'; import { ProposalState } from '@vegaprotocol/types'; diff --git a/apps/token/src/routes/proposals/propose/freeform/index.tsx b/apps/governance/src/routes/proposals/propose/freeform/index.tsx similarity index 100% rename from apps/token/src/routes/proposals/propose/freeform/index.tsx rename to apps/governance/src/routes/proposals/propose/freeform/index.tsx diff --git a/apps/token/src/routes/proposals/propose/freeform/propose-freeform.spec.tsx b/apps/governance/src/routes/proposals/propose/freeform/propose-freeform.spec.tsx similarity index 100% rename from apps/token/src/routes/proposals/propose/freeform/propose-freeform.spec.tsx rename to apps/governance/src/routes/proposals/propose/freeform/propose-freeform.spec.tsx diff --git a/apps/token/src/routes/proposals/propose/freeform/propose-freeform.tsx b/apps/governance/src/routes/proposals/propose/freeform/propose-freeform.tsx similarity index 97% rename from apps/token/src/routes/proposals/propose/freeform/propose-freeform.tsx rename to apps/governance/src/routes/proposals/propose/freeform/propose-freeform.tsx index 3e4786551..18f837d06 100644 --- a/apps/token/src/routes/proposals/propose/freeform/propose-freeform.tsx +++ b/apps/governance/src/routes/proposals/propose/freeform/propose-freeform.tsx @@ -4,7 +4,7 @@ import { getClosingTimestamp, useProposalSubmit, deadlineToRoundedHours, -} from '@vegaprotocol/governance'; +} from '@vegaprotocol/proposals'; import { useEnvironment } from '@vegaprotocol/environment'; import { ProposalFormDescription, @@ -18,11 +18,8 @@ import { import { ProposalMinRequirements } from '../../components/shared'; import { AsyncRenderer, ExternalLink } from '@vegaprotocol/ui-toolkit'; import { Heading } from '../../../../components/heading'; -import { - createDocsLinks, - NetworkParams, - useNetworkParams, -} from '@vegaprotocol/react-helpers'; +import { createDocsLinks } from '@vegaprotocol/utils'; +import { NetworkParams, useNetworkParams } from '@vegaprotocol/react-helpers'; import { ProposalUserAction } from '../../components/shared'; import { downloadJson } from '../../../../lib/download-json'; diff --git a/apps/token/src/routes/proposals/propose/index.tsx b/apps/governance/src/routes/proposals/propose/index.tsx similarity index 100% rename from apps/token/src/routes/proposals/propose/index.tsx rename to apps/governance/src/routes/proposals/propose/index.tsx diff --git a/apps/token/src/routes/proposals/propose/network-parameter/index.tsx b/apps/governance/src/routes/proposals/propose/network-parameter/index.tsx similarity index 100% rename from apps/token/src/routes/proposals/propose/network-parameter/index.tsx rename to apps/governance/src/routes/proposals/propose/network-parameter/index.tsx diff --git a/apps/token/src/routes/proposals/propose/network-parameter/propose-network-parameter.spec.tsx b/apps/governance/src/routes/proposals/propose/network-parameter/propose-network-parameter.spec.tsx similarity index 100% rename from apps/token/src/routes/proposals/propose/network-parameter/propose-network-parameter.spec.tsx rename to apps/governance/src/routes/proposals/propose/network-parameter/propose-network-parameter.spec.tsx diff --git a/apps/token/src/routes/proposals/propose/network-parameter/propose-network-parameter.tsx b/apps/governance/src/routes/proposals/propose/network-parameter/propose-network-parameter.tsx similarity index 98% rename from apps/token/src/routes/proposals/propose/network-parameter/propose-network-parameter.tsx rename to apps/governance/src/routes/proposals/propose/network-parameter/propose-network-parameter.tsx index 2e0315246..eaa57e9ba 100644 --- a/apps/token/src/routes/proposals/propose/network-parameter/propose-network-parameter.tsx +++ b/apps/governance/src/routes/proposals/propose/network-parameter/propose-network-parameter.tsx @@ -4,14 +4,14 @@ import { useForm } from 'react-hook-form'; import { createDocsLinks, suitableForSyntaxHighlighter, - useNetworkParams, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; +import { useNetworkParams } from '@vegaprotocol/react-helpers'; import { getClosingTimestamp, getEnactmentTimestamp, useProposalSubmit, doesValueEquateToParam, -} from '@vegaprotocol/governance'; +} from '@vegaprotocol/proposals'; import { useEnvironment } from '@vegaprotocol/environment'; import { ProposalFormDescription, diff --git a/apps/token/src/routes/proposals/propose/new-asset/index.tsx b/apps/governance/src/routes/proposals/propose/new-asset/index.tsx similarity index 100% rename from apps/token/src/routes/proposals/propose/new-asset/index.tsx rename to apps/governance/src/routes/proposals/propose/new-asset/index.tsx diff --git a/apps/token/src/routes/proposals/propose/new-asset/propose-new-asset.spec.tsx b/apps/governance/src/routes/proposals/propose/new-asset/propose-new-asset.spec.tsx similarity index 100% rename from apps/token/src/routes/proposals/propose/new-asset/propose-new-asset.spec.tsx rename to apps/governance/src/routes/proposals/propose/new-asset/propose-new-asset.spec.tsx diff --git a/apps/token/src/routes/proposals/propose/new-asset/propose-new-asset.tsx b/apps/governance/src/routes/proposals/propose/new-asset/propose-new-asset.tsx similarity index 97% rename from apps/token/src/routes/proposals/propose/new-asset/propose-new-asset.tsx rename to apps/governance/src/routes/proposals/propose/new-asset/propose-new-asset.tsx index 86740467b..77bde4964 100644 --- a/apps/token/src/routes/proposals/propose/new-asset/propose-new-asset.tsx +++ b/apps/governance/src/routes/proposals/propose/new-asset/propose-new-asset.tsx @@ -6,14 +6,10 @@ import { getValidationTimestamp, useProposalSubmit, doesValueEquateToParam, -} from '@vegaprotocol/governance'; +} from '@vegaprotocol/proposals'; import { useEnvironment } from '@vegaprotocol/environment'; -import { - createDocsLinks, - NetworkParams, - useNetworkParams, - validateJson, -} from '@vegaprotocol/react-helpers'; +import { createDocsLinks, validateJson } from '@vegaprotocol/utils'; +import { NetworkParams, useNetworkParams } from '@vegaprotocol/react-helpers'; import { ProposalFormDescription, ProposalFormSubheader, diff --git a/apps/token/src/routes/proposals/propose/new-market/index.tsx b/apps/governance/src/routes/proposals/propose/new-market/index.tsx similarity index 100% rename from apps/token/src/routes/proposals/propose/new-market/index.tsx rename to apps/governance/src/routes/proposals/propose/new-market/index.tsx diff --git a/apps/token/src/routes/proposals/propose/new-market/propose-new-market.spec.tsx b/apps/governance/src/routes/proposals/propose/new-market/propose-new-market.spec.tsx similarity index 100% rename from apps/token/src/routes/proposals/propose/new-market/propose-new-market.spec.tsx rename to apps/governance/src/routes/proposals/propose/new-market/propose-new-market.spec.tsx diff --git a/apps/token/src/routes/proposals/propose/new-market/propose-new-market.tsx b/apps/governance/src/routes/proposals/propose/new-market/propose-new-market.tsx similarity index 97% rename from apps/token/src/routes/proposals/propose/new-market/propose-new-market.tsx rename to apps/governance/src/routes/proposals/propose/new-market/propose-new-market.tsx index 95979a3c6..d67f75f36 100644 --- a/apps/token/src/routes/proposals/propose/new-market/propose-new-market.tsx +++ b/apps/governance/src/routes/proposals/propose/new-market/propose-new-market.tsx @@ -5,14 +5,10 @@ import { getEnactmentTimestamp, useProposalSubmit, doesValueEquateToParam, -} from '@vegaprotocol/governance'; +} from '@vegaprotocol/proposals'; import { useEnvironment } from '@vegaprotocol/environment'; -import { - createDocsLinks, - NetworkParams, - useNetworkParams, - validateJson, -} from '@vegaprotocol/react-helpers'; +import { createDocsLinks, validateJson } from '@vegaprotocol/utils'; +import { NetworkParams, useNetworkParams } from '@vegaprotocol/react-helpers'; import { ProposalFormDescription, ProposalFormSubheader, diff --git a/apps/token/src/routes/proposals/propose/propose.spec.tsx b/apps/governance/src/routes/proposals/propose/propose.spec.tsx similarity index 100% rename from apps/token/src/routes/proposals/propose/propose.spec.tsx rename to apps/governance/src/routes/proposals/propose/propose.spec.tsx diff --git a/apps/token/src/routes/proposals/propose/propose.tsx b/apps/governance/src/routes/proposals/propose/propose.tsx similarity index 98% rename from apps/token/src/routes/proposals/propose/propose.tsx rename to apps/governance/src/routes/proposals/propose/propose.tsx index 8a8fc951c..45a8d1cc5 100644 --- a/apps/token/src/routes/proposals/propose/propose.tsx +++ b/apps/governance/src/routes/proposals/propose/propose.tsx @@ -4,7 +4,7 @@ import { Link } from 'react-router-dom'; import { ExternalLink } from '@vegaprotocol/ui-toolkit'; import { useEnvironment } from '@vegaprotocol/environment'; import { Heading } from '../../../components/heading'; -import { createDocsLinks } from '@vegaprotocol/react-helpers'; +import { createDocsLinks } from '@vegaprotocol/utils'; export const Propose = () => { const { VEGA_DOCS_URL, VEGA_EXPLORER_URL } = useEnvironment(); diff --git a/apps/token/src/routes/proposals/propose/raw/index.tsx b/apps/governance/src/routes/proposals/propose/raw/index.tsx similarity index 100% rename from apps/token/src/routes/proposals/propose/raw/index.tsx rename to apps/governance/src/routes/proposals/propose/raw/index.tsx diff --git a/apps/token/src/routes/proposals/propose/raw/proposal-raw-min-requirements.tsx b/apps/governance/src/routes/proposals/propose/raw/proposal-raw-min-requirements.tsx similarity index 100% rename from apps/token/src/routes/proposals/propose/raw/proposal-raw-min-requirements.tsx rename to apps/governance/src/routes/proposals/propose/raw/proposal-raw-min-requirements.tsx diff --git a/apps/token/src/routes/proposals/propose/raw/proposal-raw.spec.tsx b/apps/governance/src/routes/proposals/propose/raw/proposal-raw.spec.tsx similarity index 98% rename from apps/token/src/routes/proposals/propose/raw/proposal-raw.spec.tsx rename to apps/governance/src/routes/proposals/propose/raw/proposal-raw.spec.tsx index 240065317..4e6e7d026 100644 --- a/apps/token/src/routes/proposals/propose/raw/proposal-raw.spec.tsx +++ b/apps/governance/src/routes/proposals/propose/raw/proposal-raw.spec.tsx @@ -7,8 +7,8 @@ import type { VegaWalletContextShape } from '@vegaprotocol/wallet'; import { VegaWalletContext } from '@vegaprotocol/wallet'; import * as Schema from '@vegaprotocol/types'; import { ProposeRaw } from './propose-raw'; -import { ProposalEventDocument } from '@vegaprotocol/governance'; -import type { ProposalEventSubscription } from '@vegaprotocol/governance'; +import { ProposalEventDocument } from '@vegaprotocol/proposals'; +import type { ProposalEventSubscription } from '@vegaprotocol/proposals'; import type { NetworkParamsQuery } from '@vegaprotocol/react-helpers'; import { NetworkParamsDocument } from '@vegaprotocol/react-helpers'; diff --git a/apps/token/src/routes/proposals/propose/raw/propose-raw.tsx b/apps/governance/src/routes/proposals/propose/raw/propose-raw.tsx similarity index 95% rename from apps/token/src/routes/proposals/propose/raw/propose-raw.tsx rename to apps/governance/src/routes/proposals/propose/raw/propose-raw.tsx index 6d74f0a84..9485ccb84 100644 --- a/apps/token/src/routes/proposals/propose/raw/propose-raw.tsx +++ b/apps/governance/src/routes/proposals/propose/raw/propose-raw.tsx @@ -9,13 +9,9 @@ import { InputError, TextArea, } from '@vegaprotocol/ui-toolkit'; -import { - createDocsLinks, - NetworkParams, - useNetworkParams, - validateJson, -} from '@vegaprotocol/react-helpers'; -import { useProposalSubmit } from '@vegaprotocol/governance'; +import { createDocsLinks, validateJson } from '@vegaprotocol/utils'; +import { NetworkParams, useNetworkParams } from '@vegaprotocol/react-helpers'; +import { useProposalSubmit } from '@vegaprotocol/proposals'; import { ProposalFormSubmit, ProposalFormTransactionDialog, diff --git a/apps/token/src/routes/proposals/propose/update-asset/index.tsx b/apps/governance/src/routes/proposals/propose/update-asset/index.tsx similarity index 100% rename from apps/token/src/routes/proposals/propose/update-asset/index.tsx rename to apps/governance/src/routes/proposals/propose/update-asset/index.tsx diff --git a/apps/token/src/routes/proposals/propose/update-asset/propose-update-asset.spec.tsx b/apps/governance/src/routes/proposals/propose/update-asset/propose-update-asset.spec.tsx similarity index 100% rename from apps/token/src/routes/proposals/propose/update-asset/propose-update-asset.spec.tsx rename to apps/governance/src/routes/proposals/propose/update-asset/propose-update-asset.spec.tsx diff --git a/apps/token/src/routes/proposals/propose/update-asset/propose-update-asset.tsx b/apps/governance/src/routes/proposals/propose/update-asset/propose-update-asset.tsx similarity index 97% rename from apps/token/src/routes/proposals/propose/update-asset/propose-update-asset.tsx rename to apps/governance/src/routes/proposals/propose/update-asset/propose-update-asset.tsx index e11da2411..e6a825e45 100644 --- a/apps/token/src/routes/proposals/propose/update-asset/propose-update-asset.tsx +++ b/apps/governance/src/routes/proposals/propose/update-asset/propose-update-asset.tsx @@ -5,14 +5,10 @@ import { getEnactmentTimestamp, useProposalSubmit, doesValueEquateToParam, -} from '@vegaprotocol/governance'; +} from '@vegaprotocol/proposals'; import { useEnvironment } from '@vegaprotocol/environment'; -import { - createDocsLinks, - NetworkParams, - useNetworkParams, - validateJson, -} from '@vegaprotocol/react-helpers'; +import { createDocsLinks, validateJson } from '@vegaprotocol/utils'; +import { NetworkParams, useNetworkParams } from '@vegaprotocol/react-helpers'; import { ProposalFormDescription, ProposalFormSubheader, diff --git a/apps/token/src/routes/proposals/propose/update-market/UpdateMarket.graphql b/apps/governance/src/routes/proposals/propose/update-market/UpdateMarket.graphql similarity index 100% rename from apps/token/src/routes/proposals/propose/update-market/UpdateMarket.graphql rename to apps/governance/src/routes/proposals/propose/update-market/UpdateMarket.graphql diff --git a/apps/governance/src/routes/proposals/propose/update-market/__generated__/UpdateMarket.ts b/apps/governance/src/routes/proposals/propose/update-market/__generated__/UpdateMarket.ts new file mode 100644 index 000000000..1454716f4 --- /dev/null +++ b/apps/governance/src/routes/proposals/propose/update-market/__generated__/UpdateMarket.ts @@ -0,0 +1,94 @@ +import * as Types from '@vegaprotocol/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type ProposalMarketsQueryQueryVariables = Types.Exact<{ + [key: string]: never; +}>; + +export type ProposalMarketsQueryQuery = { + __typename?: 'Query'; + marketsConnection?: { + __typename?: 'MarketConnection'; + edges: Array<{ + __typename?: 'MarketEdge'; + node: { + __typename?: 'Market'; + id: string; + tradableInstrument: { + __typename?: 'TradableInstrument'; + instrument: { __typename?: 'Instrument'; name: string; code: string }; + }; + }; + }>; + } | null; +}; + +export const ProposalMarketsQueryDocument = gql` + query ProposalMarketsQuery { + marketsConnection { + edges { + node { + id + tradableInstrument { + instrument { + name + code + } + } + } + } + } + } +`; + +/** + * __useProposalMarketsQueryQuery__ + * + * To run a query within a React component, call `useProposalMarketsQueryQuery` and pass it any options that fit your needs. + * When your component renders, `useProposalMarketsQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useProposalMarketsQueryQuery({ + * variables: { + * }, + * }); + */ +export function useProposalMarketsQueryQuery( + baseOptions?: Apollo.QueryHookOptions< + ProposalMarketsQueryQuery, + ProposalMarketsQueryQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery< + ProposalMarketsQueryQuery, + ProposalMarketsQueryQueryVariables + >(ProposalMarketsQueryDocument, options); +} +export function useProposalMarketsQueryLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + ProposalMarketsQueryQuery, + ProposalMarketsQueryQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery< + ProposalMarketsQueryQuery, + ProposalMarketsQueryQueryVariables + >(ProposalMarketsQueryDocument, options); +} +export type ProposalMarketsQueryQueryHookResult = ReturnType< + typeof useProposalMarketsQueryQuery +>; +export type ProposalMarketsQueryLazyQueryHookResult = ReturnType< + typeof useProposalMarketsQueryLazyQuery +>; +export type ProposalMarketsQueryQueryResult = Apollo.QueryResult< + ProposalMarketsQueryQuery, + ProposalMarketsQueryQueryVariables +>; diff --git a/apps/governance/src/routes/proposals/propose/update-market/__generated___/UpdateMarket.ts b/apps/governance/src/routes/proposals/propose/update-market/__generated___/UpdateMarket.ts new file mode 100644 index 000000000..1454716f4 --- /dev/null +++ b/apps/governance/src/routes/proposals/propose/update-market/__generated___/UpdateMarket.ts @@ -0,0 +1,94 @@ +import * as Types from '@vegaprotocol/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type ProposalMarketsQueryQueryVariables = Types.Exact<{ + [key: string]: never; +}>; + +export type ProposalMarketsQueryQuery = { + __typename?: 'Query'; + marketsConnection?: { + __typename?: 'MarketConnection'; + edges: Array<{ + __typename?: 'MarketEdge'; + node: { + __typename?: 'Market'; + id: string; + tradableInstrument: { + __typename?: 'TradableInstrument'; + instrument: { __typename?: 'Instrument'; name: string; code: string }; + }; + }; + }>; + } | null; +}; + +export const ProposalMarketsQueryDocument = gql` + query ProposalMarketsQuery { + marketsConnection { + edges { + node { + id + tradableInstrument { + instrument { + name + code + } + } + } + } + } + } +`; + +/** + * __useProposalMarketsQueryQuery__ + * + * To run a query within a React component, call `useProposalMarketsQueryQuery` and pass it any options that fit your needs. + * When your component renders, `useProposalMarketsQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useProposalMarketsQueryQuery({ + * variables: { + * }, + * }); + */ +export function useProposalMarketsQueryQuery( + baseOptions?: Apollo.QueryHookOptions< + ProposalMarketsQueryQuery, + ProposalMarketsQueryQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery< + ProposalMarketsQueryQuery, + ProposalMarketsQueryQueryVariables + >(ProposalMarketsQueryDocument, options); +} +export function useProposalMarketsQueryLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + ProposalMarketsQueryQuery, + ProposalMarketsQueryQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery< + ProposalMarketsQueryQuery, + ProposalMarketsQueryQueryVariables + >(ProposalMarketsQueryDocument, options); +} +export type ProposalMarketsQueryQueryHookResult = ReturnType< + typeof useProposalMarketsQueryQuery +>; +export type ProposalMarketsQueryLazyQueryHookResult = ReturnType< + typeof useProposalMarketsQueryLazyQuery +>; +export type ProposalMarketsQueryQueryResult = Apollo.QueryResult< + ProposalMarketsQueryQuery, + ProposalMarketsQueryQueryVariables +>; diff --git a/apps/token/src/routes/proposals/propose/update-market/index.tsx b/apps/governance/src/routes/proposals/propose/update-market/index.tsx similarity index 100% rename from apps/token/src/routes/proposals/propose/update-market/index.tsx rename to apps/governance/src/routes/proposals/propose/update-market/index.tsx diff --git a/apps/token/src/routes/proposals/propose/update-market/propose-update-market.spec.tsx b/apps/governance/src/routes/proposals/propose/update-market/propose-update-market.spec.tsx similarity index 100% rename from apps/token/src/routes/proposals/propose/update-market/propose-update-market.spec.tsx rename to apps/governance/src/routes/proposals/propose/update-market/propose-update-market.spec.tsx diff --git a/apps/token/src/routes/proposals/propose/update-market/propose-update-market.tsx b/apps/governance/src/routes/proposals/propose/update-market/propose-update-market.tsx similarity index 98% rename from apps/token/src/routes/proposals/propose/update-market/propose-update-market.tsx rename to apps/governance/src/routes/proposals/propose/update-market/propose-update-market.tsx index a2421ff03..8e5d99018 100644 --- a/apps/token/src/routes/proposals/propose/update-market/propose-update-market.tsx +++ b/apps/governance/src/routes/proposals/propose/update-market/propose-update-market.tsx @@ -6,14 +6,10 @@ import { getEnactmentTimestamp, useProposalSubmit, doesValueEquateToParam, -} from '@vegaprotocol/governance'; +} from '@vegaprotocol/proposals'; import { useEnvironment } from '@vegaprotocol/environment'; -import { - createDocsLinks, - NetworkParams, - useNetworkParams, - validateJson, -} from '@vegaprotocol/react-helpers'; +import { createDocsLinks, validateJson } from '@vegaprotocol/utils'; +import { NetworkParams, useNetworkParams } from '@vegaprotocol/react-helpers'; import { ProposalFormDescription, ProposalFormSubheader, diff --git a/apps/token/src/routes/proposals/rejected/index.tsx b/apps/governance/src/routes/proposals/rejected/index.tsx similarity index 100% rename from apps/token/src/routes/proposals/rejected/index.tsx rename to apps/governance/src/routes/proposals/rejected/index.tsx diff --git a/apps/token/src/routes/proposals/rejected/rejected-proposals-container.tsx b/apps/governance/src/routes/proposals/rejected/rejected-proposals-container.tsx similarity index 93% rename from apps/token/src/routes/proposals/rejected/rejected-proposals-container.tsx rename to apps/governance/src/routes/proposals/rejected/rejected-proposals-container.tsx index 298525c32..b65e239b9 100644 --- a/apps/token/src/routes/proposals/rejected/rejected-proposals-container.tsx +++ b/apps/governance/src/routes/proposals/rejected/rejected-proposals-container.tsx @@ -6,8 +6,8 @@ import { SplashLoader } from '../../../components/splash-loader'; import { RejectedProposalsList } from '../components/proposals-list'; import type { ProposalFieldsFragment } from '../proposals/__generated__/Proposals'; import { useProposalsQuery } from '../proposals/__generated__/Proposals'; -import type { NodeConnection, NodeEdge } from '@vegaprotocol/react-helpers'; -import { getNodes } from '@vegaprotocol/react-helpers'; +import type { NodeConnection, NodeEdge } from '@vegaprotocol/utils'; +import { getNodes } from '@vegaprotocol/utils'; import flow from 'lodash/flow'; import orderBy from 'lodash/orderBy'; import { ProposalState } from '@vegaprotocol/types'; diff --git a/apps/token/src/routes/proposals/test-helpers/generate-proposals.ts b/apps/governance/src/routes/proposals/test-helpers/generate-proposals.ts similarity index 100% rename from apps/token/src/routes/proposals/test-helpers/generate-proposals.ts rename to apps/governance/src/routes/proposals/test-helpers/generate-proposals.ts diff --git a/apps/token/src/routes/proposals/test-helpers/mocks.ts b/apps/governance/src/routes/proposals/test-helpers/mocks.ts similarity index 100% rename from apps/token/src/routes/proposals/test-helpers/mocks.ts rename to apps/governance/src/routes/proposals/test-helpers/mocks.ts diff --git a/apps/token/src/routes/redemption/home/redemption-information.tsx b/apps/governance/src/routes/redemption/home/redemption-information.tsx similarity index 100% rename from apps/token/src/routes/redemption/home/redemption-information.tsx rename to apps/governance/src/routes/redemption/home/redemption-information.tsx diff --git a/apps/token/src/routes/redemption/home/vesting-table.tsx b/apps/governance/src/routes/redemption/home/vesting-table.tsx similarity index 100% rename from apps/token/src/routes/redemption/home/vesting-table.tsx rename to apps/governance/src/routes/redemption/home/vesting-table.tsx diff --git a/apps/token/src/routes/redemption/hooks.ts b/apps/governance/src/routes/redemption/hooks.ts similarity index 96% rename from apps/token/src/routes/redemption/hooks.ts rename to apps/governance/src/routes/redemption/hooks.ts index 2afefe4eb..6d7638d7b 100644 --- a/apps/token/src/routes/redemption/hooks.ts +++ b/apps/governance/src/routes/redemption/hooks.ts @@ -3,7 +3,7 @@ import { useCallback, useEffect, useState } from 'react'; import { useTranches } from '../../lib/tranches/tranches-store'; import { useContracts } from '../../contexts/contracts/contracts-context'; import BigNumber from 'bignumber.js'; -import { toBigNum } from '@vegaprotocol/react-helpers'; +import { toBigNum } from '@vegaprotocol/utils'; import { useAppState } from '../../contexts/app-state/app-state-context'; export const useUserTrancheBalances = (address: string | undefined) => { diff --git a/apps/token/src/routes/redemption/index.tsx b/apps/governance/src/routes/redemption/index.tsx similarity index 100% rename from apps/token/src/routes/redemption/index.tsx rename to apps/governance/src/routes/redemption/index.tsx diff --git a/apps/token/src/routes/redemption/redemption.tsx b/apps/governance/src/routes/redemption/redemption.tsx similarity index 100% rename from apps/token/src/routes/redemption/redemption.tsx rename to apps/governance/src/routes/redemption/redemption.tsx diff --git a/apps/token/src/routes/redemption/tranche-item.tsx b/apps/governance/src/routes/redemption/tranche-item.tsx similarity index 100% rename from apps/token/src/routes/redemption/tranche-item.tsx rename to apps/governance/src/routes/redemption/tranche-item.tsx diff --git a/apps/token/src/routes/redemption/tranche-table.tsx b/apps/governance/src/routes/redemption/tranche-table.tsx similarity index 100% rename from apps/token/src/routes/redemption/tranche-table.tsx rename to apps/governance/src/routes/redemption/tranche-table.tsx diff --git a/apps/token/src/routes/redemption/tranche/index.tsx b/apps/governance/src/routes/redemption/tranche/index.tsx similarity index 100% rename from apps/token/src/routes/redemption/tranche/index.tsx rename to apps/governance/src/routes/redemption/tranche/index.tsx diff --git a/apps/token/src/routes/rewards/connect-to-see-rewards.spec.tsx b/apps/governance/src/routes/rewards/connect-to-see-rewards.spec.tsx similarity index 100% rename from apps/token/src/routes/rewards/connect-to-see-rewards.spec.tsx rename to apps/governance/src/routes/rewards/connect-to-see-rewards.spec.tsx diff --git a/apps/token/src/routes/rewards/connect-to-see-rewards.tsx b/apps/governance/src/routes/rewards/connect-to-see-rewards.tsx similarity index 100% rename from apps/token/src/routes/rewards/connect-to-see-rewards.tsx rename to apps/governance/src/routes/rewards/connect-to-see-rewards.tsx diff --git a/apps/token/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards-table.spec.tsx b/apps/governance/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards-table.spec.tsx similarity index 100% rename from apps/token/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards-table.spec.tsx rename to apps/governance/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards-table.spec.tsx diff --git a/apps/token/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards-table.tsx b/apps/governance/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards-table.tsx similarity index 97% rename from apps/token/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards-table.tsx rename to apps/governance/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards-table.tsx index 3a38e8098..eed2a8f24 100644 --- a/apps/token/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards-table.tsx +++ b/apps/governance/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards-table.tsx @@ -1,4 +1,4 @@ -import { formatNumber, toBigNum } from '@vegaprotocol/react-helpers'; +import { formatNumber, toBigNum } from '@vegaprotocol/utils'; import { Tooltip } from '@vegaprotocol/ui-toolkit'; import { useAppState } from '../../../contexts/app-state/app-state-context'; import { diff --git a/apps/token/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards.tsx b/apps/governance/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards.tsx similarity index 96% rename from apps/token/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards.tsx rename to apps/governance/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards.tsx index a3a3ec01d..287b94fb5 100644 --- a/apps/token/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards.tsx +++ b/apps/governance/src/routes/rewards/epoch-individual-rewards/epoch-individual-rewards.tsx @@ -1,7 +1,7 @@ import { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; -import { removePaginationWrapper } from '@vegaprotocol/react-helpers'; +import { removePaginationWrapper } from '@vegaprotocol/utils'; import { useRewardsQuery } from '../home/__generated__/Rewards'; import { ENV } from '../../../config'; import { useVegaWallet } from '@vegaprotocol/wallet'; diff --git a/apps/token/src/routes/rewards/epoch-individual-rewards/generate-epoch-individual-rewards-list.spec.ts b/apps/governance/src/routes/rewards/epoch-individual-rewards/generate-epoch-individual-rewards-list.spec.ts similarity index 100% rename from apps/token/src/routes/rewards/epoch-individual-rewards/generate-epoch-individual-rewards-list.spec.ts rename to apps/governance/src/routes/rewards/epoch-individual-rewards/generate-epoch-individual-rewards-list.spec.ts diff --git a/apps/token/src/routes/rewards/epoch-individual-rewards/generate-epoch-individual-rewards-list.ts b/apps/governance/src/routes/rewards/epoch-individual-rewards/generate-epoch-individual-rewards-list.ts similarity index 100% rename from apps/token/src/routes/rewards/epoch-individual-rewards/generate-epoch-individual-rewards-list.ts rename to apps/governance/src/routes/rewards/epoch-individual-rewards/generate-epoch-individual-rewards-list.ts diff --git a/apps/token/src/routes/rewards/epoch-total-rewards/epoch-total-rewards-table.spec.tsx b/apps/governance/src/routes/rewards/epoch-total-rewards/epoch-total-rewards-table.spec.tsx similarity index 100% rename from apps/token/src/routes/rewards/epoch-total-rewards/epoch-total-rewards-table.spec.tsx rename to apps/governance/src/routes/rewards/epoch-total-rewards/epoch-total-rewards-table.spec.tsx diff --git a/apps/token/src/routes/rewards/epoch-total-rewards/epoch-total-rewards-table.tsx b/apps/governance/src/routes/rewards/epoch-total-rewards/epoch-total-rewards-table.tsx similarity index 96% rename from apps/token/src/routes/rewards/epoch-total-rewards/epoch-total-rewards-table.tsx rename to apps/governance/src/routes/rewards/epoch-total-rewards/epoch-total-rewards-table.tsx index 094afa8ac..45f5caa1f 100644 --- a/apps/token/src/routes/rewards/epoch-total-rewards/epoch-total-rewards-table.tsx +++ b/apps/governance/src/routes/rewards/epoch-total-rewards/epoch-total-rewards-table.tsx @@ -1,4 +1,4 @@ -import { formatNumber, toBigNum } from '@vegaprotocol/react-helpers'; +import { formatNumber, toBigNum } from '@vegaprotocol/utils'; import { Tooltip } from '@vegaprotocol/ui-toolkit'; import { useAppState } from '../../../contexts/app-state/app-state-context'; import { diff --git a/apps/token/src/routes/rewards/epoch-total-rewards/epoch-total-rewards.tsx b/apps/governance/src/routes/rewards/epoch-total-rewards/epoch-total-rewards.tsx similarity index 100% rename from apps/token/src/routes/rewards/epoch-total-rewards/epoch-total-rewards.tsx rename to apps/governance/src/routes/rewards/epoch-total-rewards/epoch-total-rewards.tsx diff --git a/apps/token/src/routes/rewards/epoch-total-rewards/generate-epoch-total-rewards-list.spec.ts b/apps/governance/src/routes/rewards/epoch-total-rewards/generate-epoch-total-rewards-list.spec.ts similarity index 100% rename from apps/token/src/routes/rewards/epoch-total-rewards/generate-epoch-total-rewards-list.spec.ts rename to apps/governance/src/routes/rewards/epoch-total-rewards/generate-epoch-total-rewards-list.spec.ts diff --git a/apps/token/src/routes/rewards/epoch-total-rewards/generate-epoch-total-rewards-list.ts b/apps/governance/src/routes/rewards/epoch-total-rewards/generate-epoch-total-rewards-list.ts similarity index 98% rename from apps/token/src/routes/rewards/epoch-total-rewards/generate-epoch-total-rewards-list.ts rename to apps/governance/src/routes/rewards/epoch-total-rewards/generate-epoch-total-rewards-list.ts index dc35bf97a..87c51b010 100644 --- a/apps/token/src/routes/rewards/epoch-total-rewards/generate-epoch-total-rewards-list.ts +++ b/apps/governance/src/routes/rewards/epoch-total-rewards/generate-epoch-total-rewards-list.ts @@ -2,7 +2,7 @@ import type { EpochAssetsRewardsQuery, EpochRewardSummaryFieldsFragment, } from '../home/__generated__/Rewards'; -import { removePaginationWrapper } from '@vegaprotocol/react-helpers'; +import { removePaginationWrapper } from '@vegaprotocol/utils'; import { RowAccountTypes } from '../shared-rewards-table-assets/shared-rewards-table-assets'; import type { AccountType } from '@vegaprotocol/types'; import { BigNumber } from '../../../lib/bignumber'; diff --git a/apps/token/src/routes/rewards/home/Rewards.graphql b/apps/governance/src/routes/rewards/home/Rewards.graphql similarity index 100% rename from apps/token/src/routes/rewards/home/Rewards.graphql rename to apps/governance/src/routes/rewards/home/Rewards.graphql diff --git a/apps/token/src/routes/rewards/home/__generated__/Rewards.ts b/apps/governance/src/routes/rewards/home/__generated__/Rewards.ts similarity index 100% rename from apps/token/src/routes/rewards/home/__generated__/Rewards.ts rename to apps/governance/src/routes/rewards/home/__generated__/Rewards.ts diff --git a/apps/token/src/routes/rewards/home/index.tsx b/apps/governance/src/routes/rewards/home/index.tsx similarity index 100% rename from apps/token/src/routes/rewards/home/index.tsx rename to apps/governance/src/routes/rewards/home/index.tsx diff --git a/apps/token/src/routes/rewards/home/rewards-page.tsx b/apps/governance/src/routes/rewards/home/rewards-page.tsx similarity index 97% rename from apps/token/src/routes/rewards/home/rewards-page.tsx rename to apps/governance/src/routes/rewards/home/rewards-page.tsx index b65359786..bc4d04f29 100644 --- a/apps/token/src/routes/rewards/home/rewards-page.tsx +++ b/apps/governance/src/routes/rewards/home/rewards-page.tsx @@ -11,13 +11,9 @@ import { ExternalLink, } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet } from '@vegaprotocol/wallet'; -import { - useNetworkParams, - NetworkParams, - createDocsLinks, -} from '@vegaprotocol/react-helpers'; +import { createDocsLinks } from '@vegaprotocol/utils'; +import { useNetworkParams, NetworkParams } from '@vegaprotocol/react-helpers'; import { useEpochQuery } from './__generated__/Rewards'; - import { EpochCountdown } from '../../../components/epoch-countdown'; import { Heading, SubHeading } from '../../../components/heading'; import { EpochIndividualRewards } from '../epoch-individual-rewards/epoch-individual-rewards'; diff --git a/apps/token/src/routes/rewards/index.tsx b/apps/governance/src/routes/rewards/index.tsx similarity index 100% rename from apps/token/src/routes/rewards/index.tsx rename to apps/governance/src/routes/rewards/index.tsx diff --git a/apps/token/src/routes/rewards/no-rewards.tsx b/apps/governance/src/routes/rewards/no-rewards.tsx similarity index 100% rename from apps/token/src/routes/rewards/no-rewards.tsx rename to apps/governance/src/routes/rewards/no-rewards.tsx diff --git a/apps/token/src/routes/rewards/shared-rewards-table-assets/shared-rewards-table-assets.tsx b/apps/governance/src/routes/rewards/shared-rewards-table-assets/shared-rewards-table-assets.tsx similarity index 100% rename from apps/token/src/routes/rewards/shared-rewards-table-assets/shared-rewards-table-assets.tsx rename to apps/governance/src/routes/rewards/shared-rewards-table-assets/shared-rewards-table-assets.tsx diff --git a/apps/token/src/routes/router-config.tsx b/apps/governance/src/routes/router-config.tsx similarity index 100% rename from apps/token/src/routes/router-config.tsx rename to apps/governance/src/routes/router-config.tsx diff --git a/apps/token/src/routes/routes.ts b/apps/governance/src/routes/routes.ts similarity index 100% rename from apps/token/src/routes/routes.ts rename to apps/governance/src/routes/routes.ts diff --git a/apps/token/src/routes/staking/PreviousEpoch.graphql b/apps/governance/src/routes/staking/PreviousEpoch.graphql similarity index 100% rename from apps/token/src/routes/staking/PreviousEpoch.graphql rename to apps/governance/src/routes/staking/PreviousEpoch.graphql diff --git a/apps/governance/src/routes/staking/__generated__/PreviousEpoch.ts b/apps/governance/src/routes/staking/__generated__/PreviousEpoch.ts new file mode 100644 index 000000000..6618cfd89 --- /dev/null +++ b/apps/governance/src/routes/staking/__generated__/PreviousEpoch.ts @@ -0,0 +1,106 @@ +import * as Types from '@vegaprotocol/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type PreviousEpochQueryVariables = Types.Exact<{ + epochId?: Types.InputMaybe; +}>; + +export type PreviousEpochQuery = { + __typename?: 'Query'; + epoch: { + __typename?: 'Epoch'; + id: string; + validatorsConnection?: { + __typename?: 'NodesConnection'; + edges?: Array<{ + __typename?: 'NodeEdge'; + node: { + __typename?: 'Node'; + id: string; + rewardScore?: { + __typename?: 'RewardScore'; + rawValidatorScore: string; + } | null; + rankingScore: { + __typename?: 'RankingScore'; + performanceScore: string; + }; + }; + } | null> | null; + } | null; + }; +}; + +export const PreviousEpochDocument = gql` + query PreviousEpoch($epochId: ID) { + epoch(id: $epochId) { + id + validatorsConnection { + edges { + node { + id + rewardScore { + rawValidatorScore + } + rankingScore { + performanceScore + } + } + } + } + } + } +`; + +/** + * __usePreviousEpochQuery__ + * + * To run a query within a React component, call `usePreviousEpochQuery` and pass it any options that fit your needs. + * When your component renders, `usePreviousEpochQuery` 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 } = usePreviousEpochQuery({ + * variables: { + * epochId: // value for 'epochId' + * }, + * }); + */ +export function usePreviousEpochQuery( + baseOptions?: Apollo.QueryHookOptions< + PreviousEpochQuery, + PreviousEpochQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery( + PreviousEpochDocument, + options + ); +} +export function usePreviousEpochLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + PreviousEpochQuery, + PreviousEpochQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery( + PreviousEpochDocument, + options + ); +} +export type PreviousEpochQueryHookResult = ReturnType< + typeof usePreviousEpochQuery +>; +export type PreviousEpochLazyQueryHookResult = ReturnType< + typeof usePreviousEpochLazyQuery +>; +export type PreviousEpochQueryResult = Apollo.QueryResult< + PreviousEpochQuery, + PreviousEpochQueryVariables +>; diff --git a/apps/governance/src/routes/staking/__generated___/PreviousEpoch.ts b/apps/governance/src/routes/staking/__generated___/PreviousEpoch.ts new file mode 100644 index 000000000..6618cfd89 --- /dev/null +++ b/apps/governance/src/routes/staking/__generated___/PreviousEpoch.ts @@ -0,0 +1,106 @@ +import * as Types from '@vegaprotocol/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type PreviousEpochQueryVariables = Types.Exact<{ + epochId?: Types.InputMaybe; +}>; + +export type PreviousEpochQuery = { + __typename?: 'Query'; + epoch: { + __typename?: 'Epoch'; + id: string; + validatorsConnection?: { + __typename?: 'NodesConnection'; + edges?: Array<{ + __typename?: 'NodeEdge'; + node: { + __typename?: 'Node'; + id: string; + rewardScore?: { + __typename?: 'RewardScore'; + rawValidatorScore: string; + } | null; + rankingScore: { + __typename?: 'RankingScore'; + performanceScore: string; + }; + }; + } | null> | null; + } | null; + }; +}; + +export const PreviousEpochDocument = gql` + query PreviousEpoch($epochId: ID) { + epoch(id: $epochId) { + id + validatorsConnection { + edges { + node { + id + rewardScore { + rawValidatorScore + } + rankingScore { + performanceScore + } + } + } + } + } + } +`; + +/** + * __usePreviousEpochQuery__ + * + * To run a query within a React component, call `usePreviousEpochQuery` and pass it any options that fit your needs. + * When your component renders, `usePreviousEpochQuery` 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 } = usePreviousEpochQuery({ + * variables: { + * epochId: // value for 'epochId' + * }, + * }); + */ +export function usePreviousEpochQuery( + baseOptions?: Apollo.QueryHookOptions< + PreviousEpochQuery, + PreviousEpochQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery( + PreviousEpochDocument, + options + ); +} +export function usePreviousEpochLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + PreviousEpochQuery, + PreviousEpochQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery( + PreviousEpochDocument, + options + ); +} +export type PreviousEpochQueryHookResult = ReturnType< + typeof usePreviousEpochQuery +>; +export type PreviousEpochLazyQueryHookResult = ReturnType< + typeof usePreviousEpochLazyQuery +>; +export type PreviousEpochQueryResult = Apollo.QueryResult< + PreviousEpochQuery, + PreviousEpochQueryVariables +>; diff --git a/apps/token/src/routes/staking/associate/PartyStakeLinkings.graphql b/apps/governance/src/routes/staking/associate/PartyStakeLinkings.graphql similarity index 100% rename from apps/token/src/routes/staking/associate/PartyStakeLinkings.graphql rename to apps/governance/src/routes/staking/associate/PartyStakeLinkings.graphql diff --git a/apps/governance/src/routes/staking/associate/__generated__/PartyStakeLinkings.ts b/apps/governance/src/routes/staking/associate/__generated__/PartyStakeLinkings.ts new file mode 100644 index 000000000..84460d5f4 --- /dev/null +++ b/apps/governance/src/routes/staking/associate/__generated__/PartyStakeLinkings.ts @@ -0,0 +1,114 @@ +import * as Types from '@vegaprotocol/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type LinkingsFieldsFragment = { + __typename?: 'StakeLinking'; + id: string; + txHash: string; + status: Types.StakeLinkingStatus; +}; + +export type PartyStakeLinkingsQueryVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + +export type PartyStakeLinkingsQuery = { + __typename?: 'Query'; + party?: { + __typename?: 'Party'; + id: string; + stakingSummary: { + __typename?: 'StakingSummary'; + linkings: { + __typename?: 'StakesConnection'; + edges?: Array<{ + __typename?: 'StakeLinkingEdge'; + node: { + __typename?: 'StakeLinking'; + id: string; + txHash: string; + status: Types.StakeLinkingStatus; + }; + } | null> | null; + }; + }; + } | null; +}; + +export const LinkingsFieldsFragmentDoc = gql` + fragment LinkingsFields on StakeLinking { + id + txHash + status + } +`; +export const PartyStakeLinkingsDocument = gql` + query PartyStakeLinkings($partyId: ID!) { + party(id: $partyId) { + id + stakingSummary { + linkings { + edges { + node { + ...LinkingsFields + } + } + } + } + } + } + ${LinkingsFieldsFragmentDoc} +`; + +/** + * __usePartyStakeLinkingsQuery__ + * + * To run a query within a React component, call `usePartyStakeLinkingsQuery` and pass it any options that fit your needs. + * When your component renders, `usePartyStakeLinkingsQuery` 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 } = usePartyStakeLinkingsQuery({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function usePartyStakeLinkingsQuery( + baseOptions: Apollo.QueryHookOptions< + PartyStakeLinkingsQuery, + PartyStakeLinkingsQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery< + PartyStakeLinkingsQuery, + PartyStakeLinkingsQueryVariables + >(PartyStakeLinkingsDocument, options); +} +export function usePartyStakeLinkingsLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + PartyStakeLinkingsQuery, + PartyStakeLinkingsQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery< + PartyStakeLinkingsQuery, + PartyStakeLinkingsQueryVariables + >(PartyStakeLinkingsDocument, options); +} +export type PartyStakeLinkingsQueryHookResult = ReturnType< + typeof usePartyStakeLinkingsQuery +>; +export type PartyStakeLinkingsLazyQueryHookResult = ReturnType< + typeof usePartyStakeLinkingsLazyQuery +>; +export type PartyStakeLinkingsQueryResult = Apollo.QueryResult< + PartyStakeLinkingsQuery, + PartyStakeLinkingsQueryVariables +>; diff --git a/apps/governance/src/routes/staking/associate/__generated___/PartyStakeLinkings.ts b/apps/governance/src/routes/staking/associate/__generated___/PartyStakeLinkings.ts new file mode 100644 index 000000000..84460d5f4 --- /dev/null +++ b/apps/governance/src/routes/staking/associate/__generated___/PartyStakeLinkings.ts @@ -0,0 +1,114 @@ +import * as Types from '@vegaprotocol/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type LinkingsFieldsFragment = { + __typename?: 'StakeLinking'; + id: string; + txHash: string; + status: Types.StakeLinkingStatus; +}; + +export type PartyStakeLinkingsQueryVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + +export type PartyStakeLinkingsQuery = { + __typename?: 'Query'; + party?: { + __typename?: 'Party'; + id: string; + stakingSummary: { + __typename?: 'StakingSummary'; + linkings: { + __typename?: 'StakesConnection'; + edges?: Array<{ + __typename?: 'StakeLinkingEdge'; + node: { + __typename?: 'StakeLinking'; + id: string; + txHash: string; + status: Types.StakeLinkingStatus; + }; + } | null> | null; + }; + }; + } | null; +}; + +export const LinkingsFieldsFragmentDoc = gql` + fragment LinkingsFields on StakeLinking { + id + txHash + status + } +`; +export const PartyStakeLinkingsDocument = gql` + query PartyStakeLinkings($partyId: ID!) { + party(id: $partyId) { + id + stakingSummary { + linkings { + edges { + node { + ...LinkingsFields + } + } + } + } + } + } + ${LinkingsFieldsFragmentDoc} +`; + +/** + * __usePartyStakeLinkingsQuery__ + * + * To run a query within a React component, call `usePartyStakeLinkingsQuery` and pass it any options that fit your needs. + * When your component renders, `usePartyStakeLinkingsQuery` 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 } = usePartyStakeLinkingsQuery({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function usePartyStakeLinkingsQuery( + baseOptions: Apollo.QueryHookOptions< + PartyStakeLinkingsQuery, + PartyStakeLinkingsQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery< + PartyStakeLinkingsQuery, + PartyStakeLinkingsQueryVariables + >(PartyStakeLinkingsDocument, options); +} +export function usePartyStakeLinkingsLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + PartyStakeLinkingsQuery, + PartyStakeLinkingsQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery< + PartyStakeLinkingsQuery, + PartyStakeLinkingsQueryVariables + >(PartyStakeLinkingsDocument, options); +} +export type PartyStakeLinkingsQueryHookResult = ReturnType< + typeof usePartyStakeLinkingsQuery +>; +export type PartyStakeLinkingsLazyQueryHookResult = ReturnType< + typeof usePartyStakeLinkingsLazyQuery +>; +export type PartyStakeLinkingsQueryResult = Apollo.QueryResult< + PartyStakeLinkingsQuery, + PartyStakeLinkingsQueryVariables +>; diff --git a/apps/token/src/routes/staking/associate/associate-info.tsx b/apps/governance/src/routes/staking/associate/associate-info.tsx similarity index 100% rename from apps/token/src/routes/staking/associate/associate-info.tsx rename to apps/governance/src/routes/staking/associate/associate-info.tsx diff --git a/apps/token/src/routes/staking/associate/associate-page-container.tsx b/apps/governance/src/routes/staking/associate/associate-page-container.tsx similarity index 100% rename from apps/token/src/routes/staking/associate/associate-page-container.tsx rename to apps/governance/src/routes/staking/associate/associate-page-container.tsx diff --git a/apps/token/src/routes/staking/associate/associate-page-no-vega.tsx b/apps/governance/src/routes/staking/associate/associate-page-no-vega.tsx similarity index 100% rename from apps/token/src/routes/staking/associate/associate-page-no-vega.tsx rename to apps/governance/src/routes/staking/associate/associate-page-no-vega.tsx diff --git a/apps/token/src/routes/staking/associate/associate-page.tsx b/apps/governance/src/routes/staking/associate/associate-page.tsx similarity index 100% rename from apps/token/src/routes/staking/associate/associate-page.tsx rename to apps/governance/src/routes/staking/associate/associate-page.tsx diff --git a/apps/token/src/routes/staking/associate/associate-transaction.tsx b/apps/governance/src/routes/staking/associate/associate-transaction.tsx similarity index 100% rename from apps/token/src/routes/staking/associate/associate-transaction.tsx rename to apps/governance/src/routes/staking/associate/associate-transaction.tsx diff --git a/apps/token/src/routes/staking/associate/components/staking-wallets-container/index.ts b/apps/governance/src/routes/staking/associate/components/staking-wallets-container/index.ts similarity index 100% rename from apps/token/src/routes/staking/associate/components/staking-wallets-container/index.ts rename to apps/governance/src/routes/staking/associate/components/staking-wallets-container/index.ts diff --git a/apps/token/src/routes/staking/associate/components/staking-wallets-container/staking-wallets-container.spec.tsx b/apps/governance/src/routes/staking/associate/components/staking-wallets-container/staking-wallets-container.spec.tsx similarity index 100% rename from apps/token/src/routes/staking/associate/components/staking-wallets-container/staking-wallets-container.spec.tsx rename to apps/governance/src/routes/staking/associate/components/staking-wallets-container/staking-wallets-container.spec.tsx diff --git a/apps/token/src/routes/staking/associate/components/staking-wallets-container/staking-wallets-container.tsx b/apps/governance/src/routes/staking/associate/components/staking-wallets-container/staking-wallets-container.tsx similarity index 100% rename from apps/token/src/routes/staking/associate/components/staking-wallets-container/staking-wallets-container.tsx rename to apps/governance/src/routes/staking/associate/components/staking-wallets-container/staking-wallets-container.tsx diff --git a/apps/token/src/routes/staking/associate/contract-associate.tsx b/apps/governance/src/routes/staking/associate/contract-associate.tsx similarity index 100% rename from apps/token/src/routes/staking/associate/contract-associate.tsx rename to apps/governance/src/routes/staking/associate/contract-associate.tsx diff --git a/apps/token/src/routes/staking/associate/hooks.ts b/apps/governance/src/routes/staking/associate/hooks.ts similarity index 97% rename from apps/token/src/routes/staking/associate/hooks.ts rename to apps/governance/src/routes/staking/associate/hooks.ts index 954fab689..65d967556 100644 --- a/apps/token/src/routes/staking/associate/hooks.ts +++ b/apps/governance/src/routes/staking/associate/hooks.ts @@ -9,10 +9,7 @@ import { useGetAssociationBreakdown } from '../../../hooks/use-get-association-b import { useRefreshBalances } from '../../../hooks/use-refresh-balances'; import { useTransaction } from '../../../hooks/use-transaction'; import { useAppState } from '../../../contexts/app-state/app-state-context'; -import { - removeDecimal, - removePaginationWrapper, -} from '@vegaprotocol/react-helpers'; +import { removeDecimal, removePaginationWrapper } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import type { LinkingsFieldsFragment, diff --git a/apps/token/src/routes/staking/associate/wallet-associate.tsx b/apps/governance/src/routes/staking/associate/wallet-associate.tsx similarity index 97% rename from apps/token/src/routes/staking/associate/wallet-associate.tsx rename to apps/governance/src/routes/staking/associate/wallet-associate.tsx index bd099d2cf..67c815620 100644 --- a/apps/token/src/routes/staking/associate/wallet-associate.tsx +++ b/apps/governance/src/routes/staking/associate/wallet-associate.tsx @@ -8,7 +8,7 @@ import { TxState } from '../../../hooks/transaction-reducer'; import { useTransaction } from '../../../hooks/use-transaction'; import { BigNumber } from '../../../lib/bignumber'; import { AssociateInfo } from './associate-info'; -import { removeDecimal, toBigNum } from '@vegaprotocol/react-helpers'; +import { removeDecimal, toBigNum } from '@vegaprotocol/utils'; import type { EthereumConfig } from '@vegaprotocol/web3'; import { useBalances } from '../../../lib/balances/balances-store'; diff --git a/apps/token/src/routes/staking/disassociate/components/disassociate-page/disassociate-page.tsx b/apps/governance/src/routes/staking/disassociate/components/disassociate-page/disassociate-page.tsx similarity index 98% rename from apps/token/src/routes/staking/disassociate/components/disassociate-page/disassociate-page.tsx rename to apps/governance/src/routes/staking/disassociate/components/disassociate-page/disassociate-page.tsx index ab21eba2c..59426a955 100644 --- a/apps/token/src/routes/staking/disassociate/components/disassociate-page/disassociate-page.tsx +++ b/apps/governance/src/routes/staking/disassociate/components/disassociate-page/disassociate-page.tsx @@ -1,6 +1,6 @@ import { DisassociateTransaction } from '../disassociate-transaction'; import { formatNumber } from '../../../../../lib/format-number'; -import { remove0x, toBigNum } from '@vegaprotocol/react-helpers'; +import { remove0x, toBigNum } from '@vegaprotocol/utils'; import { Select } from '@vegaprotocol/ui-toolkit'; import { StakingMethod } from '../../../../../components/staking-method-radio'; import { TokenInput } from '../../../../../components/token-input'; diff --git a/apps/token/src/routes/staking/disassociate/components/disassociate-page/index.ts b/apps/governance/src/routes/staking/disassociate/components/disassociate-page/index.ts similarity index 100% rename from apps/token/src/routes/staking/disassociate/components/disassociate-page/index.ts rename to apps/governance/src/routes/staking/disassociate/components/disassociate-page/index.ts diff --git a/apps/token/src/routes/staking/disassociate/components/disassociate-transaction/disassociate-transaction.tsx b/apps/governance/src/routes/staking/disassociate/components/disassociate-transaction/disassociate-transaction.tsx similarity index 100% rename from apps/token/src/routes/staking/disassociate/components/disassociate-transaction/disassociate-transaction.tsx rename to apps/governance/src/routes/staking/disassociate/components/disassociate-transaction/disassociate-transaction.tsx diff --git a/apps/token/src/routes/staking/disassociate/components/disassociate-transaction/index.tsx b/apps/governance/src/routes/staking/disassociate/components/disassociate-transaction/index.tsx similarity index 100% rename from apps/token/src/routes/staking/disassociate/components/disassociate-transaction/index.tsx rename to apps/governance/src/routes/staking/disassociate/components/disassociate-transaction/index.tsx diff --git a/apps/token/src/routes/staking/disassociate/hooks.ts b/apps/governance/src/routes/staking/disassociate/hooks.ts similarity index 97% rename from apps/token/src/routes/staking/disassociate/hooks.ts rename to apps/governance/src/routes/staking/disassociate/hooks.ts index 8f29a18ab..3390eae7e 100644 --- a/apps/token/src/routes/staking/disassociate/hooks.ts +++ b/apps/governance/src/routes/staking/disassociate/hooks.ts @@ -1,4 +1,4 @@ -import { removeDecimal } from '@vegaprotocol/react-helpers'; +import { removeDecimal } from '@vegaprotocol/utils'; import { useAppState } from '../../../contexts/app-state/app-state-context'; import React from 'react'; diff --git a/apps/token/src/routes/staking/disassociate/index.spec.tsx b/apps/governance/src/routes/staking/disassociate/index.spec.tsx similarity index 100% rename from apps/token/src/routes/staking/disassociate/index.spec.tsx rename to apps/governance/src/routes/staking/disassociate/index.spec.tsx diff --git a/apps/token/src/routes/staking/disassociate/index.tsx b/apps/governance/src/routes/staking/disassociate/index.tsx similarity index 100% rename from apps/token/src/routes/staking/disassociate/index.tsx rename to apps/governance/src/routes/staking/disassociate/index.tsx diff --git a/apps/token/src/routes/staking/home/Nodes.graphql b/apps/governance/src/routes/staking/home/Nodes.graphql similarity index 100% rename from apps/token/src/routes/staking/home/Nodes.graphql rename to apps/governance/src/routes/staking/home/Nodes.graphql diff --git a/apps/governance/src/routes/staking/home/__generated__/Nodes.ts b/apps/governance/src/routes/staking/home/__generated__/Nodes.ts new file mode 100644 index 000000000..a611de245 --- /dev/null +++ b/apps/governance/src/routes/staking/home/__generated__/Nodes.ts @@ -0,0 +1,149 @@ +import * as Types from '@vegaprotocol/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type NodesFragmentFragment = { + __typename?: 'Node'; + avatarUrl?: string | null; + id: string; + name: string; + pubkey: string; + stakedByOperator: string; + stakedByDelegates: string; + stakedTotal: string; + pendingStake: string; + rankingScore: { + __typename?: 'RankingScore'; + rankingScore: string; + stakeScore: string; + performanceScore: string; + votingPower: string; + status: Types.ValidatorStatus; + }; +}; + +export type NodesQueryVariables = Types.Exact<{ [key: string]: never }>; + +export type NodesQuery = { + __typename?: 'Query'; + epoch: { + __typename?: 'Epoch'; + id: string; + timestamps: { + __typename?: 'EpochTimestamps'; + start?: any | null; + end?: any | null; + expiry?: any | null; + }; + }; + nodesConnection: { + __typename?: 'NodesConnection'; + edges?: Array<{ + __typename?: 'NodeEdge'; + node: { + __typename?: 'Node'; + avatarUrl?: string | null; + id: string; + name: string; + pubkey: string; + stakedByOperator: string; + stakedByDelegates: string; + stakedTotal: string; + pendingStake: string; + rankingScore: { + __typename?: 'RankingScore'; + rankingScore: string; + stakeScore: string; + performanceScore: string; + votingPower: string; + status: Types.ValidatorStatus; + }; + }; + } | null> | null; + }; + nodeData?: { __typename?: 'NodeData'; stakedTotal: string } | null; +}; + +export const NodesFragmentFragmentDoc = gql` + fragment NodesFragment on Node { + avatarUrl + id + name + pubkey + stakedByOperator + stakedByDelegates + stakedTotal + pendingStake + rankingScore { + rankingScore + stakeScore + performanceScore + votingPower + status + } + } +`; +export const NodesDocument = gql` + query Nodes { + epoch { + id + timestamps { + start + end + expiry + } + } + nodesConnection { + edges { + node { + ...NodesFragment + } + } + } + nodeData { + stakedTotal + } + } + ${NodesFragmentFragmentDoc} +`; + +/** + * __useNodesQuery__ + * + * To run a query within a React component, call `useNodesQuery` and pass it any options that fit your needs. + * When your component renders, `useNodesQuery` 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 } = useNodesQuery({ + * variables: { + * }, + * }); + */ +export function useNodesQuery( + baseOptions?: Apollo.QueryHookOptions +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery( + NodesDocument, + options + ); +} +export function useNodesLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery( + NodesDocument, + options + ); +} +export type NodesQueryHookResult = ReturnType; +export type NodesLazyQueryHookResult = ReturnType; +export type NodesQueryResult = Apollo.QueryResult< + NodesQuery, + NodesQueryVariables +>; diff --git a/apps/governance/src/routes/staking/home/__generated___/Nodes.ts b/apps/governance/src/routes/staking/home/__generated___/Nodes.ts new file mode 100644 index 000000000..a611de245 --- /dev/null +++ b/apps/governance/src/routes/staking/home/__generated___/Nodes.ts @@ -0,0 +1,149 @@ +import * as Types from '@vegaprotocol/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type NodesFragmentFragment = { + __typename?: 'Node'; + avatarUrl?: string | null; + id: string; + name: string; + pubkey: string; + stakedByOperator: string; + stakedByDelegates: string; + stakedTotal: string; + pendingStake: string; + rankingScore: { + __typename?: 'RankingScore'; + rankingScore: string; + stakeScore: string; + performanceScore: string; + votingPower: string; + status: Types.ValidatorStatus; + }; +}; + +export type NodesQueryVariables = Types.Exact<{ [key: string]: never }>; + +export type NodesQuery = { + __typename?: 'Query'; + epoch: { + __typename?: 'Epoch'; + id: string; + timestamps: { + __typename?: 'EpochTimestamps'; + start?: any | null; + end?: any | null; + expiry?: any | null; + }; + }; + nodesConnection: { + __typename?: 'NodesConnection'; + edges?: Array<{ + __typename?: 'NodeEdge'; + node: { + __typename?: 'Node'; + avatarUrl?: string | null; + id: string; + name: string; + pubkey: string; + stakedByOperator: string; + stakedByDelegates: string; + stakedTotal: string; + pendingStake: string; + rankingScore: { + __typename?: 'RankingScore'; + rankingScore: string; + stakeScore: string; + performanceScore: string; + votingPower: string; + status: Types.ValidatorStatus; + }; + }; + } | null> | null; + }; + nodeData?: { __typename?: 'NodeData'; stakedTotal: string } | null; +}; + +export const NodesFragmentFragmentDoc = gql` + fragment NodesFragment on Node { + avatarUrl + id + name + pubkey + stakedByOperator + stakedByDelegates + stakedTotal + pendingStake + rankingScore { + rankingScore + stakeScore + performanceScore + votingPower + status + } + } +`; +export const NodesDocument = gql` + query Nodes { + epoch { + id + timestamps { + start + end + expiry + } + } + nodesConnection { + edges { + node { + ...NodesFragment + } + } + } + nodeData { + stakedTotal + } + } + ${NodesFragmentFragmentDoc} +`; + +/** + * __useNodesQuery__ + * + * To run a query within a React component, call `useNodesQuery` and pass it any options that fit your needs. + * When your component renders, `useNodesQuery` 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 } = useNodesQuery({ + * variables: { + * }, + * }); + */ +export function useNodesQuery( + baseOptions?: Apollo.QueryHookOptions +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery( + NodesDocument, + options + ); +} +export function useNodesLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery( + NodesDocument, + options + ); +} +export type NodesQueryHookResult = ReturnType; +export type NodesLazyQueryHookResult = ReturnType; +export type NodesQueryResult = Apollo.QueryResult< + NodesQuery, + NodesQueryVariables +>; diff --git a/apps/token/src/routes/staking/home/epoch-data.tsx b/apps/governance/src/routes/staking/home/epoch-data.tsx similarity index 100% rename from apps/token/src/routes/staking/home/epoch-data.tsx rename to apps/governance/src/routes/staking/home/epoch-data.tsx diff --git a/apps/token/src/routes/staking/home/index.ts b/apps/governance/src/routes/staking/home/index.ts similarity index 100% rename from apps/token/src/routes/staking/home/index.ts rename to apps/governance/src/routes/staking/home/index.ts diff --git a/apps/token/src/routes/staking/home/staking.tsx b/apps/governance/src/routes/staking/home/staking.tsx similarity index 93% rename from apps/token/src/routes/staking/home/staking.tsx rename to apps/governance/src/routes/staking/home/staking.tsx index 1c0ee89b3..15bc597b0 100644 --- a/apps/token/src/routes/staking/home/staking.tsx +++ b/apps/governance/src/routes/staking/home/staking.tsx @@ -2,7 +2,7 @@ import { useTranslation } from 'react-i18next'; import { EpochData } from './epoch-data'; import { useEnvironment } from '@vegaprotocol/environment'; import { ExternalLink } from '@vegaprotocol/ui-toolkit'; -import { createDocsLinks } from '@vegaprotocol/react-helpers'; +import { createDocsLinks } from '@vegaprotocol/utils'; import { Heading } from '../../../components/heading'; import React from 'react'; diff --git a/apps/token/src/routes/staking/home/validator-tables/consensus-validators-table.spec.tsx b/apps/governance/src/routes/staking/home/validator-tables/consensus-validators-table.spec.tsx similarity index 100% rename from apps/token/src/routes/staking/home/validator-tables/consensus-validators-table.spec.tsx rename to apps/governance/src/routes/staking/home/validator-tables/consensus-validators-table.spec.tsx diff --git a/apps/token/src/routes/staking/home/validator-tables/consensus-validators-table.tsx b/apps/governance/src/routes/staking/home/validator-tables/consensus-validators-table.tsx similarity index 98% rename from apps/token/src/routes/staking/home/validator-tables/consensus-validators-table.tsx rename to apps/governance/src/routes/staking/home/validator-tables/consensus-validators-table.tsx index d8a91e02d..ae82f8228 100644 --- a/apps/token/src/routes/staking/home/validator-tables/consensus-validators-table.tsx +++ b/apps/governance/src/routes/staking/home/validator-tables/consensus-validators-table.tsx @@ -2,7 +2,8 @@ import type { Dispatch, SetStateAction } from 'react'; import { forwardRef, useMemo, useRef, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { useNavigate } from 'react-router-dom'; -import { AgGridDynamic as AgGrid, Button } from '@vegaprotocol/ui-toolkit'; +import { Button } from '@vegaprotocol/ui-toolkit'; +import { AgGridDynamic as AgGrid } from '@vegaprotocol/datagrid'; import { useAppState } from '../../../../contexts/app-state/app-state-context'; import { BigNumber } from '../../../../lib/bignumber'; import { @@ -32,7 +33,7 @@ import { formatNumber, formatNumberPercentage, toBigNum, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; interface CanonisedConsensusNodeProps { id: string; diff --git a/apps/token/src/routes/staking/home/validator-tables/index.ts b/apps/governance/src/routes/staking/home/validator-tables/index.ts similarity index 100% rename from apps/token/src/routes/staking/home/validator-tables/index.ts rename to apps/governance/src/routes/staking/home/validator-tables/index.ts diff --git a/apps/token/src/routes/staking/home/validator-tables/shared.spec.tsx b/apps/governance/src/routes/staking/home/validator-tables/shared.spec.tsx similarity index 100% rename from apps/token/src/routes/staking/home/validator-tables/shared.spec.tsx rename to apps/governance/src/routes/staking/home/validator-tables/shared.spec.tsx diff --git a/apps/token/src/routes/staking/home/validator-tables/shared.tsx b/apps/governance/src/routes/staking/home/validator-tables/shared.tsx similarity index 99% rename from apps/token/src/routes/staking/home/validator-tables/shared.tsx rename to apps/governance/src/routes/staking/home/validator-tables/shared.tsx index a86dee9b5..9cd23f2d6 100644 --- a/apps/token/src/routes/staking/home/validator-tables/shared.tsx +++ b/apps/governance/src/routes/staking/home/validator-tables/shared.tsx @@ -4,7 +4,7 @@ import { formatNumber, formatNumberPercentage, toBigNum, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { Button, Tooltip, diff --git a/apps/token/src/routes/staking/home/validator-tables/standby-pending-validators-table.tsx b/apps/governance/src/routes/staking/home/validator-tables/standby-pending-validators-table.tsx similarity index 98% rename from apps/token/src/routes/staking/home/validator-tables/standby-pending-validators-table.tsx rename to apps/governance/src/routes/staking/home/validator-tables/standby-pending-validators-table.tsx index 3d2d5b07e..5887fe7c3 100644 --- a/apps/token/src/routes/staking/home/validator-tables/standby-pending-validators-table.tsx +++ b/apps/governance/src/routes/staking/home/validator-tables/standby-pending-validators-table.tsx @@ -1,7 +1,7 @@ import { forwardRef, useMemo, useRef } from 'react'; import { useTranslation } from 'react-i18next'; import { useNavigate } from 'react-router-dom'; -import { AgGridDynamic as AgGrid } from '@vegaprotocol/ui-toolkit'; +import { AgGridDynamic as AgGrid } from '@vegaprotocol/datagrid'; import { useAppState } from '../../../../contexts/app-state/app-state-context'; import { BigNumber } from '../../../../lib/bignumber'; import { @@ -25,7 +25,7 @@ import { import type { AgGridReact } from 'ag-grid-react'; import type { ColDef } from 'ag-grid-community'; import type { ValidatorsTableProps } from './shared'; -import { formatNumber, toBigNum } from '@vegaprotocol/react-helpers'; +import { formatNumber, toBigNum } from '@vegaprotocol/utils'; interface StandbyPendingValidatorsTableProps extends ValidatorsTableProps { stakeNeededForPromotion: string | undefined; diff --git a/apps/token/src/routes/staking/home/validator-tables/validator-tables.tsx b/apps/governance/src/routes/staking/home/validator-tables/validator-tables.tsx similarity index 99% rename from apps/token/src/routes/staking/home/validator-tables/validator-tables.tsx rename to apps/governance/src/routes/staking/home/validator-tables/validator-tables.tsx index 315873ec7..df5523311 100644 --- a/apps/token/src/routes/staking/home/validator-tables/validator-tables.tsx +++ b/apps/governance/src/routes/staking/home/validator-tables/validator-tables.tsx @@ -8,7 +8,7 @@ import { createDocsLinks, removePaginationWrapper, toBigNum, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { Link as UTLink } from '@vegaprotocol/ui-toolkit'; import { SubHeading } from '../../../../components/heading'; import { useEnvironment } from '@vegaprotocol/environment'; diff --git a/apps/token/src/routes/staking/index.tsx b/apps/governance/src/routes/staking/index.tsx similarity index 100% rename from apps/token/src/routes/staking/index.tsx rename to apps/governance/src/routes/staking/index.tsx diff --git a/apps/token/src/routes/staking/node/PartyDelegations.graphql b/apps/governance/src/routes/staking/node/PartyDelegations.graphql similarity index 100% rename from apps/token/src/routes/staking/node/PartyDelegations.graphql rename to apps/governance/src/routes/staking/node/PartyDelegations.graphql diff --git a/apps/token/src/routes/staking/node/Staking.graphql b/apps/governance/src/routes/staking/node/Staking.graphql similarity index 100% rename from apps/token/src/routes/staking/node/Staking.graphql rename to apps/governance/src/routes/staking/node/Staking.graphql diff --git a/apps/governance/src/routes/staking/node/__generated__/PartyDelegations.ts b/apps/governance/src/routes/staking/node/__generated__/PartyDelegations.ts new file mode 100644 index 000000000..e2c7972d6 --- /dev/null +++ b/apps/governance/src/routes/staking/node/__generated__/PartyDelegations.ts @@ -0,0 +1,117 @@ +import * as Types from '@vegaprotocol/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type StakingDelegationsFieldsFragment = { + __typename?: 'Delegation'; + amount: string; + epoch: number; + node: { __typename?: 'Node'; id: string }; +}; + +export type PartyDelegationsQueryVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; + delegationsPagination?: Types.InputMaybe; +}>; + +export type PartyDelegationsQuery = { + __typename?: 'Query'; + party?: { + __typename?: 'Party'; + id: string; + delegationsConnection?: { + __typename?: 'DelegationsConnection'; + edges?: Array<{ + __typename?: 'DelegationEdge'; + node: { + __typename?: 'Delegation'; + amount: string; + epoch: number; + node: { __typename?: 'Node'; id: string }; + }; + } | null> | null; + } | null; + } | null; + epoch: { __typename?: 'Epoch'; id: string }; +}; + +export const StakingDelegationsFieldsFragmentDoc = gql` + fragment StakingDelegationsFields on Delegation { + amount + node { + id + } + epoch + } +`; +export const PartyDelegationsDocument = gql` + query PartyDelegations($partyId: ID!, $delegationsPagination: Pagination) { + party(id: $partyId) { + id + delegationsConnection(pagination: $delegationsPagination) { + edges { + node { + ...StakingDelegationsFields + } + } + } + } + epoch { + id + } + } + ${StakingDelegationsFieldsFragmentDoc} +`; + +/** + * __usePartyDelegationsQuery__ + * + * To run a query within a React component, call `usePartyDelegationsQuery` and pass it any options that fit your needs. + * When your component renders, `usePartyDelegationsQuery` 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 } = usePartyDelegationsQuery({ + * variables: { + * partyId: // value for 'partyId' + * delegationsPagination: // value for 'delegationsPagination' + * }, + * }); + */ +export function usePartyDelegationsQuery( + baseOptions: Apollo.QueryHookOptions< + PartyDelegationsQuery, + PartyDelegationsQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery( + PartyDelegationsDocument, + options + ); +} +export function usePartyDelegationsLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + PartyDelegationsQuery, + PartyDelegationsQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery< + PartyDelegationsQuery, + PartyDelegationsQueryVariables + >(PartyDelegationsDocument, options); +} +export type PartyDelegationsQueryHookResult = ReturnType< + typeof usePartyDelegationsQuery +>; +export type PartyDelegationsLazyQueryHookResult = ReturnType< + typeof usePartyDelegationsLazyQuery +>; +export type PartyDelegationsQueryResult = Apollo.QueryResult< + PartyDelegationsQuery, + PartyDelegationsQueryVariables +>; diff --git a/apps/governance/src/routes/staking/node/__generated__/Staking.ts b/apps/governance/src/routes/staking/node/__generated__/Staking.ts new file mode 100644 index 000000000..248e38ed4 --- /dev/null +++ b/apps/governance/src/routes/staking/node/__generated__/Staking.ts @@ -0,0 +1,223 @@ +import * as Types from '@vegaprotocol/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type StakingNodeFieldsFragment = { + __typename?: 'Node'; + id: string; + name: string; + pubkey: string; + infoUrl: string; + location: string; + ethereumAddress: string; + stakedByOperator: string; + stakedByDelegates: string; + stakedTotal: string; + pendingStake: string; + epochData?: { + __typename?: 'EpochData'; + total: number; + offline: number; + online: number; + } | null; + rankingScore: { + __typename?: 'RankingScore'; + rankingScore: string; + stakeScore: string; + performanceScore: string; + votingPower: string; + status: Types.ValidatorStatus; + }; +}; + +export type StakingQueryVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; + delegationsPagination?: Types.InputMaybe; +}>; + +export type StakingQuery = { + __typename?: 'Query'; + party?: { + __typename?: 'Party'; + id: string; + stakingSummary: { + __typename?: 'StakingSummary'; + currentStakeAvailable: string; + }; + delegationsConnection?: { + __typename?: 'DelegationsConnection'; + edges?: Array<{ + __typename?: 'DelegationEdge'; + node: { + __typename?: 'Delegation'; + amount: string; + epoch: number; + node: { __typename?: 'Node'; id: string }; + }; + } | null> | null; + } | null; + } | null; + epoch: { + __typename?: 'Epoch'; + id: string; + timestamps: { + __typename?: 'EpochTimestamps'; + start?: any | null; + end?: any | null; + expiry?: any | null; + }; + }; + nodesConnection: { + __typename?: 'NodesConnection'; + edges?: Array<{ + __typename?: 'NodeEdge'; + node: { + __typename?: 'Node'; + id: string; + name: string; + pubkey: string; + infoUrl: string; + location: string; + ethereumAddress: string; + stakedByOperator: string; + stakedByDelegates: string; + stakedTotal: string; + pendingStake: string; + epochData?: { + __typename?: 'EpochData'; + total: number; + offline: number; + online: number; + } | null; + rankingScore: { + __typename?: 'RankingScore'; + rankingScore: string; + stakeScore: string; + performanceScore: string; + votingPower: string; + status: Types.ValidatorStatus; + }; + }; + } | null> | null; + }; + nodeData?: { + __typename?: 'NodeData'; + stakedTotal: string; + totalNodes: number; + inactiveNodes: number; + uptime: number; + } | null; +}; + +export const StakingNodeFieldsFragmentDoc = gql` + fragment StakingNodeFields on Node { + id + name + pubkey + infoUrl + location + ethereumAddress + stakedByOperator + stakedByDelegates + stakedTotal + pendingStake + epochData { + total + offline + online + } + rankingScore { + rankingScore + stakeScore + performanceScore + votingPower + status + } + } +`; +export const StakingDocument = gql` + query Staking($partyId: ID!, $delegationsPagination: Pagination) { + party(id: $partyId) { + id + stakingSummary { + currentStakeAvailable + } + delegationsConnection(pagination: $delegationsPagination) { + edges { + node { + amount + epoch + node { + id + } + } + } + } + } + epoch { + id + timestamps { + start + end + expiry + } + } + nodesConnection { + edges { + node { + ...StakingNodeFields + } + } + } + nodeData { + stakedTotal + totalNodes + inactiveNodes + uptime + } + } + ${StakingNodeFieldsFragmentDoc} +`; + +/** + * __useStakingQuery__ + * + * To run a query within a React component, call `useStakingQuery` and pass it any options that fit your needs. + * When your component renders, `useStakingQuery` 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 } = useStakingQuery({ + * variables: { + * partyId: // value for 'partyId' + * delegationsPagination: // value for 'delegationsPagination' + * }, + * }); + */ +export function useStakingQuery( + baseOptions: Apollo.QueryHookOptions +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery( + StakingDocument, + options + ); +} +export function useStakingLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery( + StakingDocument, + options + ); +} +export type StakingQueryHookResult = ReturnType; +export type StakingLazyQueryHookResult = ReturnType; +export type StakingQueryResult = Apollo.QueryResult< + StakingQuery, + StakingQueryVariables +>; diff --git a/apps/token/src/routes/staking/node/index.ts b/apps/governance/src/routes/staking/node/index.ts similarity index 100% rename from apps/token/src/routes/staking/node/index.ts rename to apps/governance/src/routes/staking/node/index.ts diff --git a/apps/token/src/routes/staking/node/node.tsx b/apps/governance/src/routes/staking/node/node.tsx similarity index 99% rename from apps/token/src/routes/staking/node/node.tsx rename to apps/governance/src/routes/staking/node/node.tsx index 987c11150..888f9ab12 100644 --- a/apps/token/src/routes/staking/node/node.tsx +++ b/apps/governance/src/routes/staking/node/node.tsx @@ -7,7 +7,7 @@ import { addDecimal, removePaginationWrapper, toBigNum, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import { Link } from 'react-router-dom'; import { Icon } from '@vegaprotocol/ui-toolkit'; import { EpochCountdown } from '../../../components/epoch-countdown'; diff --git a/apps/token/src/routes/staking/node/nodes-container.tsx b/apps/governance/src/routes/staking/node/nodes-container.tsx similarity index 100% rename from apps/token/src/routes/staking/node/nodes-container.tsx rename to apps/governance/src/routes/staking/node/nodes-container.tsx diff --git a/apps/token/src/routes/staking/node/pending-stake.tsx b/apps/governance/src/routes/staking/node/pending-stake.tsx similarity index 97% rename from apps/token/src/routes/staking/node/pending-stake.tsx rename to apps/governance/src/routes/staking/node/pending-stake.tsx index 8a140efe5..8007baa01 100644 --- a/apps/token/src/routes/staking/node/pending-stake.tsx +++ b/apps/governance/src/routes/staking/node/pending-stake.tsx @@ -6,7 +6,7 @@ import { useAppState } from '../../../contexts/app-state/app-state-context'; import type { BigNumber } from '../../../lib/bignumber'; import type { UndelegateSubmissionBody } from '@vegaprotocol/wallet'; import { useVegaWallet } from '@vegaprotocol/wallet'; -import { removeDecimal } from '@vegaprotocol/react-helpers'; +import { removeDecimal } from '@vegaprotocol/utils'; interface PendingStakeProps { pendingAmount: BigNumber; diff --git a/apps/token/src/routes/staking/node/stake-failure.tsx b/apps/governance/src/routes/staking/node/stake-failure.tsx similarity index 100% rename from apps/token/src/routes/staking/node/stake-failure.tsx rename to apps/governance/src/routes/staking/node/stake-failure.tsx diff --git a/apps/token/src/routes/staking/node/stake-pending.tsx b/apps/governance/src/routes/staking/node/stake-pending.tsx similarity index 100% rename from apps/token/src/routes/staking/node/stake-pending.tsx rename to apps/governance/src/routes/staking/node/stake-pending.tsx diff --git a/apps/token/src/routes/staking/node/stake-requested.tsx b/apps/governance/src/routes/staking/node/stake-requested.tsx similarity index 100% rename from apps/token/src/routes/staking/node/stake-requested.tsx rename to apps/governance/src/routes/staking/node/stake-requested.tsx diff --git a/apps/token/src/routes/staking/node/stake-success.tsx b/apps/governance/src/routes/staking/node/stake-success.tsx similarity index 100% rename from apps/token/src/routes/staking/node/stake-success.tsx rename to apps/governance/src/routes/staking/node/stake-success.tsx diff --git a/apps/token/src/routes/staking/node/staking-form-tx-statuses.tsx b/apps/governance/src/routes/staking/node/staking-form-tx-statuses.tsx similarity index 100% rename from apps/token/src/routes/staking/node/staking-form-tx-statuses.tsx rename to apps/governance/src/routes/staking/node/staking-form-tx-statuses.tsx diff --git a/apps/token/src/routes/staking/node/staking-form.tsx b/apps/governance/src/routes/staking/node/staking-form.tsx similarity index 98% rename from apps/token/src/routes/staking/node/staking-form.tsx rename to apps/governance/src/routes/staking/node/staking-form.tsx index f6bfba5bf..760486403 100644 --- a/apps/token/src/routes/staking/node/staking-form.tsx +++ b/apps/governance/src/routes/staking/node/staking-form.tsx @@ -17,12 +17,11 @@ import { RadioGroup, } from '@vegaprotocol/ui-toolkit'; import { - useNetworkParam, - NetworkParams, removeDecimal, addDecimal, removePaginationWrapper, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; +import { useNetworkParam, NetworkParams } from '@vegaprotocol/react-helpers'; import { useBalances } from '../../../lib/balances/balances-store'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { SubHeading } from '../../../components/heading'; diff --git a/apps/token/src/routes/staking/node/validator-table.spec.tsx b/apps/governance/src/routes/staking/node/validator-table.spec.tsx similarity index 98% rename from apps/token/src/routes/staking/node/validator-table.spec.tsx rename to apps/governance/src/routes/staking/node/validator-table.spec.tsx index b1dd90e90..9e2ea3099 100644 --- a/apps/token/src/routes/staking/node/validator-table.spec.tsx +++ b/apps/governance/src/routes/staking/node/validator-table.spec.tsx @@ -3,7 +3,7 @@ import { AppStateProvider } from '../../../contexts/app-state/app-state-provider import { ValidatorTable } from './validator-table'; import { ValidatorStatus } from '@vegaprotocol/types'; import countryData from '../../../components/country-selector/country-data'; -import { formatNumber, toBigNum } from '@vegaprotocol/react-helpers'; +import { formatNumber, toBigNum } from '@vegaprotocol/utils'; const mockNode = { id: 'bb1822715aa86ce0e205aa4c78e9b71cdeaec94596ce72d366f0d50589eb1bf5', diff --git a/apps/token/src/routes/staking/node/validator-table.tsx b/apps/governance/src/routes/staking/node/validator-table.tsx similarity index 99% rename from apps/token/src/routes/staking/node/validator-table.tsx rename to apps/governance/src/routes/staking/node/validator-table.tsx index 7e03dfcb9..e47deae89 100644 --- a/apps/token/src/routes/staking/node/validator-table.tsx +++ b/apps/governance/src/routes/staking/node/validator-table.tsx @@ -1,11 +1,7 @@ import React, { useMemo } from 'react'; import { useTranslation } from 'react-i18next'; import { useEnvironment } from '@vegaprotocol/environment'; -import { - createDocsLinks, - ExternalLinks, - toBigNum, -} from '@vegaprotocol/react-helpers'; +import { createDocsLinks, ExternalLinks, toBigNum } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import { Link as UTLink, diff --git a/apps/token/src/routes/staking/node/your-stake.tsx b/apps/governance/src/routes/staking/node/your-stake.tsx similarity index 100% rename from apps/token/src/routes/staking/node/your-stake.tsx rename to apps/governance/src/routes/staking/node/your-stake.tsx diff --git a/apps/token/src/routes/staking/shared.spec.ts b/apps/governance/src/routes/staking/shared.spec.ts similarity index 100% rename from apps/token/src/routes/staking/shared.spec.ts rename to apps/governance/src/routes/staking/shared.spec.ts diff --git a/apps/token/src/routes/staking/shared.ts b/apps/governance/src/routes/staking/shared.ts similarity index 98% rename from apps/token/src/routes/staking/shared.ts rename to apps/governance/src/routes/staking/shared.ts index 31e727710..520af5798 100644 --- a/apps/token/src/routes/staking/shared.ts +++ b/apps/governance/src/routes/staking/shared.ts @@ -1,7 +1,7 @@ import { formatNumberPercentage, removePaginationWrapper, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import type { PreviousEpochQuery } from './__generated___/PreviousEpoch'; import { BigNumber } from '../../lib/bignumber'; diff --git a/apps/token/src/routes/token/NodeData.graphql b/apps/governance/src/routes/token/NodeData.graphql similarity index 100% rename from apps/token/src/routes/token/NodeData.graphql rename to apps/governance/src/routes/token/NodeData.graphql diff --git a/apps/governance/src/routes/token/__generated__/NodeData.ts b/apps/governance/src/routes/token/__generated__/NodeData.ts new file mode 100644 index 000000000..475dcba58 --- /dev/null +++ b/apps/governance/src/routes/token/__generated__/NodeData.ts @@ -0,0 +1,64 @@ +import * as Types from '@vegaprotocol/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type NodeDataQueryVariables = Types.Exact<{ [key: string]: never }>; + +export type NodeDataQuery = { + __typename?: 'Query'; + nodeData?: { __typename?: 'NodeData'; stakedTotal: string } | null; +}; + +export const NodeDataDocument = gql` + query NodeData { + nodeData { + stakedTotal + } + } +`; + +/** + * __useNodeDataQuery__ + * + * To run a query within a React component, call `useNodeDataQuery` and pass it any options that fit your needs. + * When your component renders, `useNodeDataQuery` 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 } = useNodeDataQuery({ + * variables: { + * }, + * }); + */ +export function useNodeDataQuery( + baseOptions?: Apollo.QueryHookOptions +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery( + NodeDataDocument, + options + ); +} +export function useNodeDataLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + NodeDataQuery, + NodeDataQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery( + NodeDataDocument, + options + ); +} +export type NodeDataQueryHookResult = ReturnType; +export type NodeDataLazyQueryHookResult = ReturnType< + typeof useNodeDataLazyQuery +>; +export type NodeDataQueryResult = Apollo.QueryResult< + NodeDataQuery, + NodeDataQueryVariables +>; diff --git a/apps/governance/src/routes/token/__generated___/NodeData.ts b/apps/governance/src/routes/token/__generated___/NodeData.ts new file mode 100644 index 000000000..475dcba58 --- /dev/null +++ b/apps/governance/src/routes/token/__generated___/NodeData.ts @@ -0,0 +1,64 @@ +import * as Types from '@vegaprotocol/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type NodeDataQueryVariables = Types.Exact<{ [key: string]: never }>; + +export type NodeDataQuery = { + __typename?: 'Query'; + nodeData?: { __typename?: 'NodeData'; stakedTotal: string } | null; +}; + +export const NodeDataDocument = gql` + query NodeData { + nodeData { + stakedTotal + } + } +`; + +/** + * __useNodeDataQuery__ + * + * To run a query within a React component, call `useNodeDataQuery` and pass it any options that fit your needs. + * When your component renders, `useNodeDataQuery` 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 } = useNodeDataQuery({ + * variables: { + * }, + * }); + */ +export function useNodeDataQuery( + baseOptions?: Apollo.QueryHookOptions +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery( + NodeDataDocument, + options + ); +} +export function useNodeDataLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + NodeDataQuery, + NodeDataQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery( + NodeDataDocument, + options + ); +} +export type NodeDataQueryHookResult = ReturnType; +export type NodeDataLazyQueryHookResult = ReturnType< + typeof useNodeDataLazyQuery +>; +export type NodeDataQueryResult = Apollo.QueryResult< + NodeDataQuery, + NodeDataQueryVariables +>; diff --git a/apps/token/src/routes/token/index.tsx b/apps/governance/src/routes/token/index.tsx similarity index 97% rename from apps/token/src/routes/token/index.tsx rename to apps/governance/src/routes/token/index.tsx index dd5c64982..c30eb53c5 100644 --- a/apps/token/src/routes/token/index.tsx +++ b/apps/governance/src/routes/token/index.tsx @@ -3,14 +3,13 @@ import { Trans, useTranslation } from 'react-i18next'; import { Link } from 'react-router-dom'; import { Heading, SubHeading } from '../../components/heading'; -import { ExternalLinks } from '@vegaprotocol/react-helpers'; +import { ExternalLinks, toBigNum } from '@vegaprotocol/utils'; import { useAppState } from '../../contexts/app-state/app-state-context'; import { useDocumentTitle } from '../../hooks/use-document-title'; import type { RouteChildProps } from '..'; import Routes from '../routes'; import { TokenDetails } from './token-details'; import { Button } from '@vegaprotocol/ui-toolkit'; -import { toBigNum } from '@vegaprotocol/react-helpers'; import { useNodeDataQuery } from './__generated___/NodeData'; const Home = ({ name }: RouteChildProps) => { diff --git a/apps/token/src/routes/token/token-details/index.tsx b/apps/governance/src/routes/token/token-details/index.tsx similarity index 100% rename from apps/token/src/routes/token/token-details/index.tsx rename to apps/governance/src/routes/token/token-details/index.tsx diff --git a/apps/token/src/routes/token/token-details/token-details-circulating.test.ts b/apps/governance/src/routes/token/token-details/token-details-circulating.test.ts similarity index 100% rename from apps/token/src/routes/token/token-details/token-details-circulating.test.ts rename to apps/governance/src/routes/token/token-details/token-details-circulating.test.ts diff --git a/apps/token/src/routes/token/token-details/token-details-circulating.tsx b/apps/governance/src/routes/token/token-details/token-details-circulating.tsx similarity index 100% rename from apps/token/src/routes/token/token-details/token-details-circulating.tsx rename to apps/governance/src/routes/token/token-details/token-details-circulating.tsx diff --git a/apps/token/src/routes/token/token-details/token-details.tsx b/apps/governance/src/routes/token/token-details/token-details.tsx similarity index 100% rename from apps/token/src/routes/token/token-details/token-details.tsx rename to apps/governance/src/routes/token/token-details/token-details.tsx diff --git a/apps/token/src/routes/tranches/data.json b/apps/governance/src/routes/tranches/data.json similarity index 100% rename from apps/token/src/routes/tranches/data.json rename to apps/governance/src/routes/tranches/data.json diff --git a/apps/token/src/routes/tranches/index.tsx b/apps/governance/src/routes/tranches/index.tsx similarity index 100% rename from apps/token/src/routes/tranches/index.tsx rename to apps/governance/src/routes/tranches/index.tsx diff --git a/apps/token/src/routes/tranches/progress-bar.tsx b/apps/governance/src/routes/tranches/progress-bar.tsx similarity index 100% rename from apps/token/src/routes/tranches/progress-bar.tsx rename to apps/governance/src/routes/tranches/progress-bar.tsx diff --git a/apps/token/src/routes/tranches/tranche-dates.tsx b/apps/governance/src/routes/tranches/tranche-dates.tsx similarity index 100% rename from apps/token/src/routes/tranches/tranche-dates.tsx rename to apps/governance/src/routes/tranches/tranche-dates.tsx diff --git a/apps/token/src/routes/tranches/tranche-label.spec.tsx b/apps/governance/src/routes/tranches/tranche-label.spec.tsx similarity index 100% rename from apps/token/src/routes/tranches/tranche-label.spec.tsx rename to apps/governance/src/routes/tranches/tranche-label.spec.tsx diff --git a/apps/token/src/routes/tranches/tranche-label.tsx b/apps/governance/src/routes/tranches/tranche-label.tsx similarity index 100% rename from apps/token/src/routes/tranches/tranche-label.tsx rename to apps/governance/src/routes/tranches/tranche-label.tsx diff --git a/apps/token/src/routes/tranches/tranche-progress.tsx b/apps/governance/src/routes/tranches/tranche-progress.tsx similarity index 100% rename from apps/token/src/routes/tranches/tranche-progress.tsx rename to apps/governance/src/routes/tranches/tranche-progress.tsx diff --git a/apps/token/src/routes/tranches/tranche.tsx b/apps/governance/src/routes/tranches/tranche.tsx similarity index 97% rename from apps/token/src/routes/tranches/tranche.tsx rename to apps/governance/src/routes/tranches/tranche.tsx index 748afb1f7..eb433d6d7 100644 --- a/apps/token/src/routes/tranches/tranche.tsx +++ b/apps/governance/src/routes/tranches/tranche.tsx @@ -9,7 +9,7 @@ import { useWeb3React } from '@web3-react/core'; import { useTranslation } from 'react-i18next'; import { useParams } from 'react-router'; import { Navigate } from 'react-router-dom'; -import { formatNumber } from '@vegaprotocol/react-helpers'; +import { formatNumber } from '@vegaprotocol/utils'; import { useEnvironment } from '@vegaprotocol/environment'; import { TrancheItem } from '../redemption/tranche-item'; diff --git a/apps/token/src/routes/tranches/tranches.tsx b/apps/governance/src/routes/tranches/tranches.tsx similarity index 100% rename from apps/token/src/routes/tranches/tranches.tsx rename to apps/governance/src/routes/tranches/tranches.tsx diff --git a/apps/token/src/routes/tranches/vesting-chart.tsx b/apps/governance/src/routes/tranches/vesting-chart.tsx similarity index 100% rename from apps/token/src/routes/tranches/vesting-chart.tsx rename to apps/governance/src/routes/tranches/vesting-chart.tsx diff --git a/apps/token/src/routes/withdrawals/index.tsx b/apps/governance/src/routes/withdrawals/index.tsx similarity index 100% rename from apps/token/src/routes/withdrawals/index.tsx rename to apps/governance/src/routes/withdrawals/index.tsx diff --git a/apps/token/src/setup-tests.ts b/apps/governance/src/setup-tests.ts similarity index 100% rename from apps/token/src/setup-tests.ts rename to apps/governance/src/setup-tests.ts diff --git a/apps/token/src/stores/transactions.ts b/apps/governance/src/stores/transactions.ts similarity index 100% rename from apps/token/src/stores/transactions.ts rename to apps/governance/src/stores/transactions.ts diff --git a/apps/token/src/styles.css b/apps/governance/src/styles.css similarity index 100% rename from apps/token/src/styles.css rename to apps/governance/src/styles.css diff --git a/apps/token/tailwind.config.js b/apps/governance/tailwind.config.js similarity index 100% rename from apps/token/tailwind.config.js rename to apps/governance/tailwind.config.js diff --git a/apps/token/tsconfig.app.json b/apps/governance/tsconfig.app.json similarity index 100% rename from apps/token/tsconfig.app.json rename to apps/governance/tsconfig.app.json diff --git a/apps/token/tsconfig.json b/apps/governance/tsconfig.json similarity index 100% rename from apps/token/tsconfig.json rename to apps/governance/tsconfig.json diff --git a/apps/token/tsconfig.spec.json b/apps/governance/tsconfig.spec.json similarity index 100% rename from apps/token/tsconfig.spec.json rename to apps/governance/tsconfig.spec.json diff --git a/apps/token/webpack.config.js b/apps/governance/webpack.config.js similarity index 100% rename from apps/token/webpack.config.js rename to apps/governance/webpack.config.js diff --git a/apps/liquidity-provision-dashboard/src/app/components/dashboard/dashboard.tsx b/apps/liquidity-provision-dashboard/src/app/components/dashboard/dashboard.tsx index 55fd95cfb..58a4bf70f 100644 --- a/apps/liquidity-provision-dashboard/src/app/components/dashboard/dashboard.tsx +++ b/apps/liquidity-provision-dashboard/src/app/components/dashboard/dashboard.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Intro } from './intro'; import { MarketList } from './market-list'; diff --git a/apps/liquidity-provision-dashboard/src/app/components/dashboard/intro/intro.tsx b/apps/liquidity-provision-dashboard/src/app/components/dashboard/intro/intro.tsx index 11808ddb6..013c54191 100644 --- a/apps/liquidity-provision-dashboard/src/app/components/dashboard/intro/intro.tsx +++ b/apps/liquidity-provision-dashboard/src/app/components/dashboard/intro/intro.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { ExternalLink } from '@vegaprotocol/ui-toolkit'; // TODO: add mainnet links once docs have been updated 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 index 6e81c279c..06924c615 100644 --- 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 @@ -8,15 +8,16 @@ import { import { addDecimalsFormatNumber, formatNumberPercentage, - t, + getExpiryDate, toBigNum, -} from '@vegaprotocol/react-helpers'; -import type { VegaValueFormatterParams } from '@vegaprotocol/ui-toolkit'; +} from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; +import type { VegaValueFormatterParams } from '@vegaprotocol/datagrid'; +import { PriceChangeCell } from '@vegaprotocol/datagrid'; import type * as Schema from '@vegaprotocol/types'; import { AsyncRenderer, Icon, - PriceCellChange, TooltipCellComponent, } from '@vegaprotocol/ui-toolkit'; import type { GetRowIdParams, RowClickedEvent } from 'ag-grid-community'; @@ -30,7 +31,6 @@ import { HealthBar } from '../../health-bar'; import { HealthDialog } from '../../health-dialog'; import { Status } from '../../status'; import { formatDistanceToNow } from 'date-fns'; -import { getExpiryDate } from '@vegaprotocol/react-helpers'; export const MarketList = () => { const { data, error, loading } = useMarketsLiquidity(); @@ -134,7 +134,7 @@ export const MarketList = () => { if (data && data.candles) { const prices = data.candles.map((candle) => candle.close); return ( - 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 1a4b0eed7..e2972db42 100644 --- a/apps/liquidity-provision-dashboard/src/app/components/detail/detail.tsx +++ b/apps/liquidity-provision-dashboard/src/app/components/detail/detail.tsx @@ -1,10 +1,8 @@ import { useParams } from 'react-router-dom'; import { useMemo } from 'react'; -import { - t, - useDataProvider, - makeDerivedDataProvider, -} from '@vegaprotocol/react-helpers'; +import { makeDerivedDataProvider } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; +import { useDataProvider } from '@vegaprotocol/react-helpers'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; import { 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 index b97e2393d..abf8efc7c 100644 --- a/apps/liquidity-provision-dashboard/src/app/components/detail/header/header.tsx +++ b/apps/liquidity-provision-dashboard/src/app/components/detail/header/header.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Link } from 'react-router-dom'; import { Icon } from '@vegaprotocol/ui-toolkit'; 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 index 6b4a96c83..e5dca07d3 100644 --- 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 @@ -1,10 +1,7 @@ import { useState, useMemo, useRef, useCallback } from 'react'; import throttle from 'lodash/throttle'; -import { - useYesterday, - useDataProvider, - addDecimalsFormatNumber, -} from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber } from '@vegaprotocol/utils'; +import { useYesterday, useDataProvider } from '@vegaprotocol/react-helpers'; import * as Schema from '@vegaprotocol/types'; import { calcDayVolume, 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 index 9f7b208c6..ee465081d 100644 --- a/apps/liquidity-provision-dashboard/src/app/components/detail/market/market.tsx +++ b/apps/liquidity-provision-dashboard/src/app/components/detail/market/market.tsx @@ -1,5 +1,5 @@ import { useState } from 'react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Icon } from '@vegaprotocol/ui-toolkit'; import { formatWithAsset } from '@vegaprotocol/liquidity'; 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 382449ac9..9a1a79b56 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 @@ -2,7 +2,7 @@ import { useCallback } from 'react'; import { AgGridColumn } from 'ag-grid-react'; import type { GetRowIdParams } from 'ag-grid-community'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { LiquidityProviderFeeShareFieldsFragment, diff --git a/apps/liquidity-provision-dashboard/src/app/components/health-bar/health-bar.tsx b/apps/liquidity-provision-dashboard/src/app/components/health-bar/health-bar.tsx index 282af4368..947f5fc72 100644 --- a/apps/liquidity-provision-dashboard/src/app/components/health-bar/health-bar.tsx +++ b/apps/liquidity-provision-dashboard/src/app/components/health-bar/health-bar.tsx @@ -1,6 +1,7 @@ import classNames from 'classnames'; import type * as Schema from '@vegaprotocol/types'; -import { t, addDecimalsFormatNumber } from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { BigNumber } from 'bignumber.js'; import type { ReactNode } from 'react'; diff --git a/apps/liquidity-provision-dashboard/src/app/components/health-dialog/health-dialog.tsx b/apps/liquidity-provision-dashboard/src/app/components/health-dialog/health-dialog.tsx index 96f439399..d383e9357 100644 --- a/apps/liquidity-provision-dashboard/src/app/components/health-dialog/health-dialog.tsx +++ b/apps/liquidity-provision-dashboard/src/app/components/health-dialog/health-dialog.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Dialog } from '@vegaprotocol/ui-toolkit'; import * as Schema from '@vegaprotocol/types'; import classNames from 'classnames'; diff --git a/apps/liquidity-provision-dashboard/src/app/components/status/status.tsx b/apps/liquidity-provision-dashboard/src/app/components/status/status.tsx index 6ee5f2dc0..235c83917 100644 --- a/apps/liquidity-provision-dashboard/src/app/components/status/status.tsx +++ b/apps/liquidity-provision-dashboard/src/app/components/status/status.tsx @@ -2,7 +2,7 @@ import { Lozenge, Tooltip } from '@vegaprotocol/ui-toolkit'; import classNames from 'classnames'; import * as Schema from '@vegaprotocol/types'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Indicator } from '../indicator'; diff --git a/apps/liquidity-provision-dashboard/src/app/routes/router-config.tsx b/apps/liquidity-provision-dashboard/src/app/routes/router-config.tsx index 239ca061a..1568b43b8 100644 --- a/apps/liquidity-provision-dashboard/src/app/routes/router-config.tsx +++ b/apps/liquidity-provision-dashboard/src/app/routes/router-config.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Dashboard } from '../components/dashboard'; import { Detail } from '../components/detail'; diff --git a/apps/multisig-signer/src/app/app.tsx b/apps/multisig-signer/src/app/app.tsx index 4707f6f50..d5dfc7bb5 100644 --- a/apps/multisig-signer/src/app/app.tsx +++ b/apps/multisig-signer/src/app/app.tsx @@ -10,7 +10,7 @@ import { import { AsyncRenderer, Button, Lozenge } from '@vegaprotocol/ui-toolkit'; import type { EthereumConfig } from '@vegaprotocol/web3'; import { useEthereumConfig, Web3Provider } from '@vegaprotocol/web3'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { ENV } from './config/env'; import { ContractsProvider } from './config/contracts/contracts-provider'; import { diff --git a/apps/multisig-signer/src/app/components/add-signer-form/add-signer-form.tsx b/apps/multisig-signer/src/app/components/add-signer-form/add-signer-form.tsx index 9b81d74fe..997c536a8 100644 --- a/apps/multisig-signer/src/app/components/add-signer-form/add-signer-form.tsx +++ b/apps/multisig-signer/src/app/components/add-signer-form/add-signer-form.tsx @@ -1,7 +1,7 @@ import { useState } from 'react'; import { gql, useLazyQuery } from '@apollo/client'; import { captureException } from '@sentry/react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { useEthereumTransaction } from '@vegaprotocol/web3'; import { FormGroup, diff --git a/apps/multisig-signer/src/app/components/remove-signer-form/remove-signer-form.tsx b/apps/multisig-signer/src/app/components/remove-signer-form/remove-signer-form.tsx index a8f0ac211..a6628430a 100644 --- a/apps/multisig-signer/src/app/components/remove-signer-form/remove-signer-form.tsx +++ b/apps/multisig-signer/src/app/components/remove-signer-form/remove-signer-form.tsx @@ -1,7 +1,7 @@ import { useState } from 'react'; import { gql, useLazyQuery } from '@apollo/client'; import { captureException } from '@sentry/react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { useEthereumTransaction } from '@vegaprotocol/web3'; import { FormGroup, diff --git a/apps/token/src/components/vega-wallet/__generated__/Delegations.ts b/apps/token/src/components/vega-wallet/__generated__/Delegations.ts deleted file mode 100644 index 6076e18fc..000000000 --- a/apps/token/src/components/vega-wallet/__generated__/Delegations.ts +++ /dev/null @@ -1,94 +0,0 @@ -import * as Types from '@vegaprotocol/types'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type WalletDelegationFieldsFragment = { __typename?: 'Delegation', amount: string, epoch: number, node: { __typename?: 'Node', id: string, name: string } }; - -export type DelegationsQueryVariables = Types.Exact<{ - partyId: Types.Scalars['ID']; - delegationsPagination?: Types.InputMaybe; -}>; - - -export type DelegationsQuery = { __typename?: 'Query', epoch: { __typename?: 'Epoch', id: string }, party?: { __typename?: 'Party', id: string, delegationsConnection?: { __typename?: 'DelegationsConnection', edges?: Array<{ __typename?: 'DelegationEdge', node: { __typename?: 'Delegation', amount: string, epoch: number, node: { __typename?: 'Node', id: string, name: string } } } | null> | null } | null, stakingSummary: { __typename?: 'StakingSummary', currentStakeAvailable: string }, accountsConnection?: { __typename?: 'AccountsConnection', edges?: Array<{ __typename?: 'AccountEdge', node: { __typename?: 'AccountBalance', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', name: string, id: string, decimals: number, symbol: string, source: { __typename: 'BuiltinAsset' } | { __typename: 'ERC20', contractAddress: string } } } } | null> | null } | null } | null }; - -export const WalletDelegationFieldsFragmentDoc = gql` - fragment WalletDelegationFields on Delegation { - amount - node { - id - name - } - epoch -} - `; -export const DelegationsDocument = gql` - query Delegations($partyId: ID!, $delegationsPagination: Pagination) { - epoch { - id - } - party(id: $partyId) { - id - delegationsConnection(pagination: $delegationsPagination) { - edges { - node { - ...WalletDelegationFields - } - } - } - stakingSummary { - currentStakeAvailable - } - accountsConnection { - edges { - node { - asset { - name - id - decimals - symbol - source { - __typename - ... on ERC20 { - contractAddress - } - } - } - type - balance - } - } - } - } -} - ${WalletDelegationFieldsFragmentDoc}`; - -/** - * __useDelegationsQuery__ - * - * To run a query within a React component, call `useDelegationsQuery` and pass it any options that fit your needs. - * When your component renders, `useDelegationsQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useDelegationsQuery({ - * variables: { - * partyId: // value for 'partyId' - * delegationsPagination: // value for 'delegationsPagination' - * }, - * }); - */ -export function useDelegationsQuery(baseOptions: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(DelegationsDocument, options); - } -export function useDelegationsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(DelegationsDocument, options); - } -export type DelegationsQueryHookResult = ReturnType; -export type DelegationsLazyQueryHookResult = ReturnType; -export type DelegationsQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/token/src/routes/proposals/components/list-asset/__generated__/Asset.ts b/apps/token/src/routes/proposals/components/list-asset/__generated__/Asset.ts deleted file mode 100644 index 0e83465f4..000000000 --- a/apps/token/src/routes/proposals/components/list-asset/__generated__/Asset.ts +++ /dev/null @@ -1,98 +0,0 @@ -import * as Types from '@vegaprotocol/types'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type ProposalAssetQueryVariables = Types.Exact<{ - assetId: Types.Scalars['ID']; -}>; - - -export type ProposalAssetQuery = { __typename?: 'Query', asset?: { __typename?: 'Asset', status: Types.AssetStatus, source: { __typename?: 'BuiltinAsset' } | { __typename?: 'ERC20', contractAddress: string } } | null }; - -export type AssetListBundleQueryVariables = Types.Exact<{ - assetId: Types.Scalars['ID']; -}>; - - -export type AssetListBundleQuery = { __typename?: 'Query', erc20ListAssetBundle?: { __typename?: 'Erc20ListAssetBundle', assetSource: string, vegaAssetId: string, nonce: string, signatures: string } | null }; - - -export const ProposalAssetDocument = gql` - query ProposalAsset($assetId: ID!) { - asset(id: $assetId) { - status - source { - ... on ERC20 { - contractAddress - } - } - } -} - `; - -/** - * __useProposalAssetQuery__ - * - * To run a query within a React component, call `useProposalAssetQuery` and pass it any options that fit your needs. - * When your component renders, `useProposalAssetQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useProposalAssetQuery({ - * variables: { - * assetId: // value for 'assetId' - * }, - * }); - */ -export function useProposalAssetQuery(baseOptions: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(ProposalAssetDocument, options); - } -export function useProposalAssetLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(ProposalAssetDocument, options); - } -export type ProposalAssetQueryHookResult = ReturnType; -export type ProposalAssetLazyQueryHookResult = ReturnType; -export type ProposalAssetQueryResult = Apollo.QueryResult; -export const AssetListBundleDocument = gql` - query AssetListBundle($assetId: ID!) { - erc20ListAssetBundle(assetId: $assetId) { - assetSource - vegaAssetId - nonce - signatures - } -} - `; - -/** - * __useAssetListBundleQuery__ - * - * To run a query within a React component, call `useAssetListBundleQuery` and pass it any options that fit your needs. - * When your component renders, `useAssetListBundleQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useAssetListBundleQuery({ - * variables: { - * assetId: // value for 'assetId' - * }, - * }); - */ -export function useAssetListBundleQuery(baseOptions: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(AssetListBundleDocument, options); - } -export function useAssetListBundleLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(AssetListBundleDocument, options); - } -export type AssetListBundleQueryHookResult = ReturnType; -export type AssetListBundleLazyQueryHookResult = ReturnType; -export type AssetListBundleQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/token/src/routes/proposals/components/list-asset/__generated___/Asset.ts b/apps/token/src/routes/proposals/components/list-asset/__generated___/Asset.ts deleted file mode 100644 index 0e83465f4..000000000 --- a/apps/token/src/routes/proposals/components/list-asset/__generated___/Asset.ts +++ /dev/null @@ -1,98 +0,0 @@ -import * as Types from '@vegaprotocol/types'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type ProposalAssetQueryVariables = Types.Exact<{ - assetId: Types.Scalars['ID']; -}>; - - -export type ProposalAssetQuery = { __typename?: 'Query', asset?: { __typename?: 'Asset', status: Types.AssetStatus, source: { __typename?: 'BuiltinAsset' } | { __typename?: 'ERC20', contractAddress: string } } | null }; - -export type AssetListBundleQueryVariables = Types.Exact<{ - assetId: Types.Scalars['ID']; -}>; - - -export type AssetListBundleQuery = { __typename?: 'Query', erc20ListAssetBundle?: { __typename?: 'Erc20ListAssetBundle', assetSource: string, vegaAssetId: string, nonce: string, signatures: string } | null }; - - -export const ProposalAssetDocument = gql` - query ProposalAsset($assetId: ID!) { - asset(id: $assetId) { - status - source { - ... on ERC20 { - contractAddress - } - } - } -} - `; - -/** - * __useProposalAssetQuery__ - * - * To run a query within a React component, call `useProposalAssetQuery` and pass it any options that fit your needs. - * When your component renders, `useProposalAssetQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useProposalAssetQuery({ - * variables: { - * assetId: // value for 'assetId' - * }, - * }); - */ -export function useProposalAssetQuery(baseOptions: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(ProposalAssetDocument, options); - } -export function useProposalAssetLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(ProposalAssetDocument, options); - } -export type ProposalAssetQueryHookResult = ReturnType; -export type ProposalAssetLazyQueryHookResult = ReturnType; -export type ProposalAssetQueryResult = Apollo.QueryResult; -export const AssetListBundleDocument = gql` - query AssetListBundle($assetId: ID!) { - erc20ListAssetBundle(assetId: $assetId) { - assetSource - vegaAssetId - nonce - signatures - } -} - `; - -/** - * __useAssetListBundleQuery__ - * - * To run a query within a React component, call `useAssetListBundleQuery` and pass it any options that fit your needs. - * When your component renders, `useAssetListBundleQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useAssetListBundleQuery({ - * variables: { - * assetId: // value for 'assetId' - * }, - * }); - */ -export function useAssetListBundleQuery(baseOptions: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(AssetListBundleDocument, options); - } -export function useAssetListBundleLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(AssetListBundleDocument, options); - } -export type AssetListBundleQueryHookResult = ReturnType; -export type AssetListBundleLazyQueryHookResult = ReturnType; -export type AssetListBundleQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/token/src/routes/proposals/components/vote-details/__generated__/Stake.ts b/apps/token/src/routes/proposals/components/vote-details/__generated__/Stake.ts deleted file mode 100644 index e32890aa3..000000000 --- a/apps/token/src/routes/proposals/components/vote-details/__generated__/Stake.ts +++ /dev/null @@ -1,51 +0,0 @@ -import * as Types from '@vegaprotocol/types'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type VoteButtonsQueryVariables = Types.Exact<{ - partyId: Types.Scalars['ID']; -}>; - - -export type VoteButtonsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, stakingSummary: { __typename?: 'StakingSummary', currentStakeAvailable: string } } | null }; - - -export const VoteButtonsDocument = gql` - query VoteButtons($partyId: ID!) { - party(id: $partyId) { - id - stakingSummary { - currentStakeAvailable - } - } -} - `; - -/** - * __useVoteButtonsQuery__ - * - * To run a query within a React component, call `useVoteButtonsQuery` and pass it any options that fit your needs. - * When your component renders, `useVoteButtonsQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useVoteButtonsQuery({ - * variables: { - * partyId: // value for 'partyId' - * }, - * }); - */ -export function useVoteButtonsQuery(baseOptions: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(VoteButtonsDocument, options); - } -export function useVoteButtonsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(VoteButtonsDocument, options); - } -export type VoteButtonsQueryHookResult = ReturnType; -export type VoteButtonsLazyQueryHookResult = ReturnType; -export type VoteButtonsQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/token/src/routes/proposals/components/vote-details/__generated__/Vote.ts b/apps/token/src/routes/proposals/components/vote-details/__generated__/Vote.ts deleted file mode 100644 index 538fcba9a..000000000 --- a/apps/token/src/routes/proposals/components/vote-details/__generated__/Vote.ts +++ /dev/null @@ -1,58 +0,0 @@ -import * as Types from '@vegaprotocol/types'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type UserVoteQueryVariables = Types.Exact<{ - partyId: Types.Scalars['ID']; -}>; - - -export type UserVoteQuery = { __typename?: 'Query', party?: { __typename?: 'Party', votesConnection?: { __typename?: 'ProposalVoteConnection', edges?: Array<{ __typename?: 'ProposalVoteEdge', node: { __typename?: 'ProposalVote', proposalId: string, vote: { __typename?: 'Vote', value: Types.VoteValue, datetime: any } } }> | null } | null } | null }; - - -export const UserVoteDocument = gql` - query UserVote($partyId: ID!) { - party(id: $partyId) { - votesConnection { - edges { - node { - proposalId - vote { - value - datetime - } - } - } - } - } -} - `; - -/** - * __useUserVoteQuery__ - * - * To run a query within a React component, call `useUserVoteQuery` and pass it any options that fit your needs. - * When your component renders, `useUserVoteQuery` 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 } = useUserVoteQuery({ - * variables: { - * partyId: // value for 'partyId' - * }, - * }); - */ -export function useUserVoteQuery(baseOptions: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(UserVoteDocument, options); - } -export function useUserVoteLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(UserVoteDocument, options); - } -export type UserVoteQueryHookResult = ReturnType; -export type UserVoteLazyQueryHookResult = ReturnType; -export type UserVoteQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/token/src/routes/proposals/proposal/__generated__/Proposal.ts b/apps/token/src/routes/proposals/proposal/__generated__/Proposal.ts deleted file mode 100644 index da0dd6d52..000000000 --- a/apps/token/src/routes/proposals/proposal/__generated__/Proposal.ts +++ /dev/null @@ -1,377 +0,0 @@ -import * as Types from '@vegaprotocol/types'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type ProposalQueryVariables = Types.Exact<{ - proposalId: Types.Scalars['ID']; -}>; - - -export type ProposalQuery = { __typename?: 'Query', proposal?: { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: any, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, terms: { __typename?: 'ProposalTerms', closingDatetime: any, enactmentDatetime?: any | null, change: { __typename?: 'NewAsset', name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', decimalPlaces: number, metadata?: Array | null, lpPriceRange: string, positionDecimalPlaces: number, linearSlippageFactor: string, quadraticSlippageFactor: string, riskParameters: { __typename?: 'LogNormalRiskModel', riskAversionParameter: number, tau: number, params: { __typename?: 'LogNormalModelParams', mu: number, r: number, sigma: number } } | { __typename?: 'SimpleRiskModel', params: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } }, instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string }, dataSourceSpecForSettlementData: { __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', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } }, dataSourceSpecForTradingTermination: { __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', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } | null }, priceMonitoringParameters: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null }, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: string, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } } } | { __typename?: 'UpdateAsset', quantum: string, assetId: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'UpdateMarket', marketId: string, updateMarketConfiguration: { __typename?: 'UpdateMarketConfiguration', metadata?: Array | null, instrument: { __typename?: 'UpdateInstrumentConfiguration', code: string, product: { __typename?: 'UpdateFutureProduct', quoteName: string, dataSourceSpecForSettlementData: { __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', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } }, dataSourceSpecForTradingTermination: { __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', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } }, priceMonitoringParameters: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null }, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: string, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, riskParameters: { __typename?: 'UpdateMarketLogNormalRiskModel', logNormal?: { __typename?: 'LogNormalRiskModel', riskAversionParameter: number, tau: number, params: { __typename?: 'LogNormalModelParams', r: number, sigma: number, mu: number } } | null } | { __typename?: 'UpdateMarketSimpleRiskModel', simple?: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } | null } } } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string } } } | null }; - - -export const ProposalDocument = gql` - query Proposal($proposalId: ID!) { - proposal(id: $proposalId) { - id - rationale { - title - description - } - reference - state - datetime - rejectionReason - party { - id - } - errorDetails - terms { - closingDatetime - enactmentDatetime - change { - ... on NewMarket { - decimalPlaces - metadata - lpPriceRange - riskParameters { - ... on LogNormalRiskModel { - riskAversionParameter - tau - params { - mu - r - sigma - } - } - ... on SimpleRiskModel { - params { - factorLong - factorShort - } - } - } - instrument { - name - code - futureProduct { - settlementAsset { - id - name - symbol - decimals - quantum - } - quoteName - dataSourceSpecForSettlementData { - sourceType { - ... on DataSourceDefinitionInternal { - sourceType { - ... on DataSourceSpecConfigurationTime { - conditions { - operator - value - } - } - } - } - ... on DataSourceDefinitionExternal { - sourceType { - ... on DataSourceSpecConfiguration { - signers { - signer { - ... on PubKey { - key - } - ... on ETHAddress { - address - } - } - } - filters { - key { - name - type - } - conditions { - operator - value - } - } - } - } - } - } - } - dataSourceSpecForTradingTermination { - sourceType { - ... on DataSourceDefinitionInternal { - sourceType { - ... on DataSourceSpecConfigurationTime { - conditions { - operator - value - } - } - } - } - ... on DataSourceDefinitionExternal { - sourceType { - ... on DataSourceSpecConfiguration { - signers { - signer { - ... on PubKey { - key - } - ... on ETHAddress { - address - } - } - } - filters { - key { - name - type - } - conditions { - operator - value - } - } - } - } - } - } - } - dataSourceSpecBinding { - settlementDataProperty - tradingTerminationProperty - } - } - } - priceMonitoringParameters { - triggers { - horizonSecs - probability - auctionExtensionSecs - } - } - liquidityMonitoringParameters { - triggeringRatio - targetStakeParameters { - timeWindow - scalingFactor - } - } - positionDecimalPlaces - lpPriceRange - linearSlippageFactor - quadraticSlippageFactor - } - ... on UpdateMarket { - marketId - updateMarketConfiguration { - instrument { - code - product { - quoteName - dataSourceSpecForSettlementData { - sourceType { - ... on DataSourceDefinitionInternal { - sourceType { - ... on DataSourceSpecConfigurationTime { - conditions { - operator - value - } - } - } - } - ... on DataSourceDefinitionExternal { - sourceType { - ... on DataSourceSpecConfiguration { - signers { - signer { - ... on PubKey { - key - } - ... on ETHAddress { - address - } - } - } - filters { - key { - name - type - } - conditions { - operator - value - } - } - } - } - } - } - } - dataSourceSpecForTradingTermination { - sourceType { - ... on DataSourceDefinitionInternal { - sourceType { - ... on DataSourceSpecConfigurationTime { - conditions { - operator - value - } - } - } - } - ... on DataSourceDefinitionExternal { - sourceType { - ... on DataSourceSpecConfiguration { - signers { - signer { - ... on PubKey { - key - } - ... on ETHAddress { - address - } - } - } - filters { - key { - name - type - } - conditions { - operator - value - } - } - } - } - } - } - } - dataSourceSpecBinding { - settlementDataProperty - tradingTerminationProperty - } - } - } - metadata - priceMonitoringParameters { - triggers { - horizonSecs - probability - auctionExtensionSecs - } - } - liquidityMonitoringParameters { - triggeringRatio - targetStakeParameters { - timeWindow - scalingFactor - } - } - riskParameters { - ... on UpdateMarketSimpleRiskModel { - simple { - factorLong - factorShort - } - } - ... on UpdateMarketLogNormalRiskModel { - logNormal { - riskAversionParameter - tau - params { - r - sigma - mu - } - } - } - } - } - } - ... on NewAsset { - name - symbol - decimals - quantum - source { - ... on BuiltinAsset { - maxFaucetAmountMint - } - ... on ERC20 { - contractAddress - lifetimeLimit - withdrawThreshold - } - } - } - ... on UpdateNetworkParameter { - networkParameter { - key - value - } - } - ... on UpdateAsset { - quantum - assetId - source { - ... on UpdateERC20 { - lifetimeLimit - withdrawThreshold - } - } - } - } - } - votes { - yes { - totalTokens - totalNumber - totalEquityLikeShareWeight - } - no { - totalTokens - totalNumber - totalEquityLikeShareWeight - } - } - } -} - `; - -/** - * __useProposalQuery__ - * - * To run a query within a React component, call `useProposalQuery` and pass it any options that fit your needs. - * When your component renders, `useProposalQuery` 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 } = useProposalQuery({ - * variables: { - * proposalId: // value for 'proposalId' - * }, - * }); - */ -export function useProposalQuery(baseOptions: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(ProposalDocument, options); - } -export function useProposalLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(ProposalDocument, options); - } -export type ProposalQueryHookResult = ReturnType; -export type ProposalLazyQueryHookResult = ReturnType; -export type ProposalQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/token/src/routes/proposals/proposals/__generated__/Proposals.ts b/apps/token/src/routes/proposals/proposals/__generated__/Proposals.ts deleted file mode 100644 index 948495462..000000000 --- a/apps/token/src/routes/proposals/proposals/__generated__/Proposals.ts +++ /dev/null @@ -1,132 +0,0 @@ -import * as Types from '@vegaprotocol/types'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type ProposalFieldsFragment = { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: any, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, terms: { __typename?: 'ProposalTerms', closingDatetime: any, enactmentDatetime?: any | null, change: { __typename: 'NewAsset', name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string, withdrawThreshold: string, lifetimeLimit: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', settlementAsset: { __typename?: 'Asset', symbol: string } } | null } } | { __typename?: 'UpdateAsset', quantum: string, assetId: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'UpdateMarket', marketId: string } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string } } }; - -export type ProposalsQueryVariables = Types.Exact<{ [key: string]: never; }>; - - -export type ProposalsQuery = { __typename?: 'Query', proposalsConnection?: { __typename?: 'ProposalsConnection', edges?: Array<{ __typename?: 'ProposalEdge', node: { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: any, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, terms: { __typename?: 'ProposalTerms', closingDatetime: any, enactmentDatetime?: any | null, change: { __typename: 'NewAsset', name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string, withdrawThreshold: string, lifetimeLimit: string } } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket', instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', settlementAsset: { __typename?: 'Asset', symbol: string } } | null } } | { __typename?: 'UpdateAsset', quantum: string, assetId: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename?: 'UpdateMarket', marketId: string } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalEquityLikeShareWeight: string } } } } | null> | null } | null }; - -export const ProposalFieldsFragmentDoc = gql` - fragment ProposalFields on Proposal { - id - rationale { - title - description - } - reference - state - datetime - rejectionReason - party { - id - } - errorDetails - terms { - closingDatetime - enactmentDatetime - change { - ... on NewMarket { - instrument { - name - code - futureProduct { - settlementAsset { - symbol - } - } - } - } - ... on UpdateMarket { - marketId - } - ... on NewAsset { - __typename - name - symbol - decimals - quantum - source { - ... on BuiltinAsset { - maxFaucetAmountMint - } - ... on ERC20 { - contractAddress - withdrawThreshold - lifetimeLimit - } - } - } - ... on UpdateNetworkParameter { - networkParameter { - key - value - } - } - ... on UpdateAsset { - quantum - assetId - source { - ... on UpdateERC20 { - lifetimeLimit - withdrawThreshold - } - } - } - } - } - votes { - yes { - totalTokens - totalNumber - totalEquityLikeShareWeight - } - no { - totalTokens - totalNumber - totalEquityLikeShareWeight - } - } -} - `; -export const ProposalsDocument = gql` - query Proposals { - proposalsConnection { - edges { - node { - ...ProposalFields - } - } - } -} - ${ProposalFieldsFragmentDoc}`; - -/** - * __useProposalsQuery__ - * - * To run a query within a React component, call `useProposalsQuery` and pass it any options that fit your needs. - * When your component renders, `useProposalsQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useProposalsQuery({ - * variables: { - * }, - * }); - */ -export function useProposalsQuery(baseOptions?: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(ProposalsDocument, options); - } -export function useProposalsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(ProposalsDocument, options); - } -export type ProposalsQueryHookResult = ReturnType; -export type ProposalsLazyQueryHookResult = ReturnType; -export type ProposalsQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/token/src/routes/proposals/propose/update-market/__generated__/UpdateMarket.ts b/apps/token/src/routes/proposals/propose/update-market/__generated__/UpdateMarket.ts deleted file mode 100644 index e9e984537..000000000 --- a/apps/token/src/routes/proposals/propose/update-market/__generated__/UpdateMarket.ts +++ /dev/null @@ -1,55 +0,0 @@ -import * as Types from '@vegaprotocol/types'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type ProposalMarketsQueryQueryVariables = Types.Exact<{ [key: string]: never; }>; - - -export type ProposalMarketsQueryQuery = { __typename?: 'Query', marketsConnection?: { __typename?: 'MarketConnection', edges: Array<{ __typename?: 'MarketEdge', node: { __typename?: 'Market', id: string, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string, code: string } } } }> } | null }; - - -export const ProposalMarketsQueryDocument = gql` - query ProposalMarketsQuery { - marketsConnection { - edges { - node { - id - tradableInstrument { - instrument { - name - code - } - } - } - } - } -} - `; - -/** - * __useProposalMarketsQueryQuery__ - * - * To run a query within a React component, call `useProposalMarketsQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useProposalMarketsQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useProposalMarketsQueryQuery({ - * variables: { - * }, - * }); - */ -export function useProposalMarketsQueryQuery(baseOptions?: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(ProposalMarketsQueryDocument, options); - } -export function useProposalMarketsQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(ProposalMarketsQueryDocument, options); - } -export type ProposalMarketsQueryQueryHookResult = ReturnType; -export type ProposalMarketsQueryLazyQueryHookResult = ReturnType; -export type ProposalMarketsQueryQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/token/src/routes/proposals/propose/update-market/__generated___/UpdateMarket.ts b/apps/token/src/routes/proposals/propose/update-market/__generated___/UpdateMarket.ts deleted file mode 100644 index e9e984537..000000000 --- a/apps/token/src/routes/proposals/propose/update-market/__generated___/UpdateMarket.ts +++ /dev/null @@ -1,55 +0,0 @@ -import * as Types from '@vegaprotocol/types'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type ProposalMarketsQueryQueryVariables = Types.Exact<{ [key: string]: never; }>; - - -export type ProposalMarketsQueryQuery = { __typename?: 'Query', marketsConnection?: { __typename?: 'MarketConnection', edges: Array<{ __typename?: 'MarketEdge', node: { __typename?: 'Market', id: string, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string, code: string } } } }> } | null }; - - -export const ProposalMarketsQueryDocument = gql` - query ProposalMarketsQuery { - marketsConnection { - edges { - node { - id - tradableInstrument { - instrument { - name - code - } - } - } - } - } -} - `; - -/** - * __useProposalMarketsQueryQuery__ - * - * To run a query within a React component, call `useProposalMarketsQueryQuery` and pass it any options that fit your needs. - * When your component renders, `useProposalMarketsQueryQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useProposalMarketsQueryQuery({ - * variables: { - * }, - * }); - */ -export function useProposalMarketsQueryQuery(baseOptions?: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(ProposalMarketsQueryDocument, options); - } -export function useProposalMarketsQueryLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(ProposalMarketsQueryDocument, options); - } -export type ProposalMarketsQueryQueryHookResult = ReturnType; -export type ProposalMarketsQueryLazyQueryHookResult = ReturnType; -export type ProposalMarketsQueryQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/token/src/routes/staking/__generated__/PreviousEpoch.ts b/apps/token/src/routes/staking/__generated__/PreviousEpoch.ts deleted file mode 100644 index ff0183023..000000000 --- a/apps/token/src/routes/staking/__generated__/PreviousEpoch.ts +++ /dev/null @@ -1,61 +0,0 @@ -import * as Types from '@vegaprotocol/types'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type PreviousEpochQueryVariables = Types.Exact<{ - epochId?: Types.InputMaybe; -}>; - - -export type PreviousEpochQuery = { __typename?: 'Query', epoch: { __typename?: 'Epoch', id: string, validatorsConnection?: { __typename?: 'NodesConnection', edges?: Array<{ __typename?: 'NodeEdge', node: { __typename?: 'Node', id: string, rewardScore?: { __typename?: 'RewardScore', rawValidatorScore: string } | null, rankingScore: { __typename?: 'RankingScore', performanceScore: string } } } | null> | null } | null } }; - - -export const PreviousEpochDocument = gql` - query PreviousEpoch($epochId: ID) { - epoch(id: $epochId) { - id - validatorsConnection { - edges { - node { - id - rewardScore { - rawValidatorScore - } - rankingScore { - performanceScore - } - } - } - } - } -} - `; - -/** - * __usePreviousEpochQuery__ - * - * To run a query within a React component, call `usePreviousEpochQuery` and pass it any options that fit your needs. - * When your component renders, `usePreviousEpochQuery` 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 } = usePreviousEpochQuery({ - * variables: { - * epochId: // value for 'epochId' - * }, - * }); - */ -export function usePreviousEpochQuery(baseOptions?: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(PreviousEpochDocument, options); - } -export function usePreviousEpochLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(PreviousEpochDocument, options); - } -export type PreviousEpochQueryHookResult = ReturnType; -export type PreviousEpochLazyQueryHookResult = ReturnType; -export type PreviousEpochQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/token/src/routes/staking/__generated___/PreviousEpoch.ts b/apps/token/src/routes/staking/__generated___/PreviousEpoch.ts deleted file mode 100644 index ff0183023..000000000 --- a/apps/token/src/routes/staking/__generated___/PreviousEpoch.ts +++ /dev/null @@ -1,61 +0,0 @@ -import * as Types from '@vegaprotocol/types'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type PreviousEpochQueryVariables = Types.Exact<{ - epochId?: Types.InputMaybe; -}>; - - -export type PreviousEpochQuery = { __typename?: 'Query', epoch: { __typename?: 'Epoch', id: string, validatorsConnection?: { __typename?: 'NodesConnection', edges?: Array<{ __typename?: 'NodeEdge', node: { __typename?: 'Node', id: string, rewardScore?: { __typename?: 'RewardScore', rawValidatorScore: string } | null, rankingScore: { __typename?: 'RankingScore', performanceScore: string } } } | null> | null } | null } }; - - -export const PreviousEpochDocument = gql` - query PreviousEpoch($epochId: ID) { - epoch(id: $epochId) { - id - validatorsConnection { - edges { - node { - id - rewardScore { - rawValidatorScore - } - rankingScore { - performanceScore - } - } - } - } - } -} - `; - -/** - * __usePreviousEpochQuery__ - * - * To run a query within a React component, call `usePreviousEpochQuery` and pass it any options that fit your needs. - * When your component renders, `usePreviousEpochQuery` 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 } = usePreviousEpochQuery({ - * variables: { - * epochId: // value for 'epochId' - * }, - * }); - */ -export function usePreviousEpochQuery(baseOptions?: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(PreviousEpochDocument, options); - } -export function usePreviousEpochLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(PreviousEpochDocument, options); - } -export type PreviousEpochQueryHookResult = ReturnType; -export type PreviousEpochLazyQueryHookResult = ReturnType; -export type PreviousEpochQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/token/src/routes/staking/associate/__generated__/PartyStakeLinkings.ts b/apps/token/src/routes/staking/associate/__generated__/PartyStakeLinkings.ts deleted file mode 100644 index f5431c1ac..000000000 --- a/apps/token/src/routes/staking/associate/__generated__/PartyStakeLinkings.ts +++ /dev/null @@ -1,65 +0,0 @@ -import * as Types from '@vegaprotocol/types'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type LinkingsFieldsFragment = { __typename?: 'StakeLinking', id: string, txHash: string, status: Types.StakeLinkingStatus }; - -export type PartyStakeLinkingsQueryVariables = Types.Exact<{ - partyId: Types.Scalars['ID']; -}>; - - -export type PartyStakeLinkingsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, stakingSummary: { __typename?: 'StakingSummary', linkings: { __typename?: 'StakesConnection', edges?: Array<{ __typename?: 'StakeLinkingEdge', node: { __typename?: 'StakeLinking', id: string, txHash: string, status: Types.StakeLinkingStatus } } | null> | null } } } | null }; - -export const LinkingsFieldsFragmentDoc = gql` - fragment LinkingsFields on StakeLinking { - id - txHash - status -} - `; -export const PartyStakeLinkingsDocument = gql` - query PartyStakeLinkings($partyId: ID!) { - party(id: $partyId) { - id - stakingSummary { - linkings { - edges { - node { - ...LinkingsFields - } - } - } - } - } -} - ${LinkingsFieldsFragmentDoc}`; - -/** - * __usePartyStakeLinkingsQuery__ - * - * To run a query within a React component, call `usePartyStakeLinkingsQuery` and pass it any options that fit your needs. - * When your component renders, `usePartyStakeLinkingsQuery` 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 } = usePartyStakeLinkingsQuery({ - * variables: { - * partyId: // value for 'partyId' - * }, - * }); - */ -export function usePartyStakeLinkingsQuery(baseOptions: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(PartyStakeLinkingsDocument, options); - } -export function usePartyStakeLinkingsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(PartyStakeLinkingsDocument, options); - } -export type PartyStakeLinkingsQueryHookResult = ReturnType; -export type PartyStakeLinkingsLazyQueryHookResult = ReturnType; -export type PartyStakeLinkingsQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/token/src/routes/staking/associate/__generated___/PartyStakeLinkings.ts b/apps/token/src/routes/staking/associate/__generated___/PartyStakeLinkings.ts deleted file mode 100644 index f5431c1ac..000000000 --- a/apps/token/src/routes/staking/associate/__generated___/PartyStakeLinkings.ts +++ /dev/null @@ -1,65 +0,0 @@ -import * as Types from '@vegaprotocol/types'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type LinkingsFieldsFragment = { __typename?: 'StakeLinking', id: string, txHash: string, status: Types.StakeLinkingStatus }; - -export type PartyStakeLinkingsQueryVariables = Types.Exact<{ - partyId: Types.Scalars['ID']; -}>; - - -export type PartyStakeLinkingsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, stakingSummary: { __typename?: 'StakingSummary', linkings: { __typename?: 'StakesConnection', edges?: Array<{ __typename?: 'StakeLinkingEdge', node: { __typename?: 'StakeLinking', id: string, txHash: string, status: Types.StakeLinkingStatus } } | null> | null } } } | null }; - -export const LinkingsFieldsFragmentDoc = gql` - fragment LinkingsFields on StakeLinking { - id - txHash - status -} - `; -export const PartyStakeLinkingsDocument = gql` - query PartyStakeLinkings($partyId: ID!) { - party(id: $partyId) { - id - stakingSummary { - linkings { - edges { - node { - ...LinkingsFields - } - } - } - } - } -} - ${LinkingsFieldsFragmentDoc}`; - -/** - * __usePartyStakeLinkingsQuery__ - * - * To run a query within a React component, call `usePartyStakeLinkingsQuery` and pass it any options that fit your needs. - * When your component renders, `usePartyStakeLinkingsQuery` 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 } = usePartyStakeLinkingsQuery({ - * variables: { - * partyId: // value for 'partyId' - * }, - * }); - */ -export function usePartyStakeLinkingsQuery(baseOptions: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(PartyStakeLinkingsDocument, options); - } -export function usePartyStakeLinkingsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(PartyStakeLinkingsDocument, options); - } -export type PartyStakeLinkingsQueryHookResult = ReturnType; -export type PartyStakeLinkingsLazyQueryHookResult = ReturnType; -export type PartyStakeLinkingsQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/token/src/routes/staking/home/__generated__/Nodes.ts b/apps/token/src/routes/staking/home/__generated__/Nodes.ts deleted file mode 100644 index e932ba5fc..000000000 --- a/apps/token/src/routes/staking/home/__generated__/Nodes.ts +++ /dev/null @@ -1,80 +0,0 @@ -import * as Types from '@vegaprotocol/types'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type NodesFragmentFragment = { __typename?: 'Node', avatarUrl?: string | null, id: string, name: string, pubkey: string, stakedByOperator: string, stakedByDelegates: string, stakedTotal: string, pendingStake: string, rankingScore: { __typename?: 'RankingScore', rankingScore: string, stakeScore: string, performanceScore: string, votingPower: string, status: Types.ValidatorStatus } }; - -export type NodesQueryVariables = Types.Exact<{ [key: string]: never; }>; - - -export type NodesQuery = { __typename?: 'Query', epoch: { __typename?: 'Epoch', id: string, timestamps: { __typename?: 'EpochTimestamps', start?: any | null, end?: any | null, expiry?: any | null } }, nodesConnection: { __typename?: 'NodesConnection', edges?: Array<{ __typename?: 'NodeEdge', node: { __typename?: 'Node', avatarUrl?: string | null, id: string, name: string, pubkey: string, stakedByOperator: string, stakedByDelegates: string, stakedTotal: string, pendingStake: string, rankingScore: { __typename?: 'RankingScore', rankingScore: string, stakeScore: string, performanceScore: string, votingPower: string, status: Types.ValidatorStatus } } } | null> | null }, nodeData?: { __typename?: 'NodeData', stakedTotal: string } | null }; - -export const NodesFragmentFragmentDoc = gql` - fragment NodesFragment on Node { - avatarUrl - id - name - pubkey - stakedByOperator - stakedByDelegates - stakedTotal - pendingStake - rankingScore { - rankingScore - stakeScore - performanceScore - votingPower - status - } -} - `; -export const NodesDocument = gql` - query Nodes { - epoch { - id - timestamps { - start - end - expiry - } - } - nodesConnection { - edges { - node { - ...NodesFragment - } - } - } - nodeData { - stakedTotal - } -} - ${NodesFragmentFragmentDoc}`; - -/** - * __useNodesQuery__ - * - * To run a query within a React component, call `useNodesQuery` and pass it any options that fit your needs. - * When your component renders, `useNodesQuery` 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 } = useNodesQuery({ - * variables: { - * }, - * }); - */ -export function useNodesQuery(baseOptions?: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(NodesDocument, options); - } -export function useNodesLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(NodesDocument, options); - } -export type NodesQueryHookResult = ReturnType; -export type NodesLazyQueryHookResult = ReturnType; -export type NodesQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/token/src/routes/staking/home/__generated___/Nodes.ts b/apps/token/src/routes/staking/home/__generated___/Nodes.ts deleted file mode 100644 index e932ba5fc..000000000 --- a/apps/token/src/routes/staking/home/__generated___/Nodes.ts +++ /dev/null @@ -1,80 +0,0 @@ -import * as Types from '@vegaprotocol/types'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type NodesFragmentFragment = { __typename?: 'Node', avatarUrl?: string | null, id: string, name: string, pubkey: string, stakedByOperator: string, stakedByDelegates: string, stakedTotal: string, pendingStake: string, rankingScore: { __typename?: 'RankingScore', rankingScore: string, stakeScore: string, performanceScore: string, votingPower: string, status: Types.ValidatorStatus } }; - -export type NodesQueryVariables = Types.Exact<{ [key: string]: never; }>; - - -export type NodesQuery = { __typename?: 'Query', epoch: { __typename?: 'Epoch', id: string, timestamps: { __typename?: 'EpochTimestamps', start?: any | null, end?: any | null, expiry?: any | null } }, nodesConnection: { __typename?: 'NodesConnection', edges?: Array<{ __typename?: 'NodeEdge', node: { __typename?: 'Node', avatarUrl?: string | null, id: string, name: string, pubkey: string, stakedByOperator: string, stakedByDelegates: string, stakedTotal: string, pendingStake: string, rankingScore: { __typename?: 'RankingScore', rankingScore: string, stakeScore: string, performanceScore: string, votingPower: string, status: Types.ValidatorStatus } } } | null> | null }, nodeData?: { __typename?: 'NodeData', stakedTotal: string } | null }; - -export const NodesFragmentFragmentDoc = gql` - fragment NodesFragment on Node { - avatarUrl - id - name - pubkey - stakedByOperator - stakedByDelegates - stakedTotal - pendingStake - rankingScore { - rankingScore - stakeScore - performanceScore - votingPower - status - } -} - `; -export const NodesDocument = gql` - query Nodes { - epoch { - id - timestamps { - start - end - expiry - } - } - nodesConnection { - edges { - node { - ...NodesFragment - } - } - } - nodeData { - stakedTotal - } -} - ${NodesFragmentFragmentDoc}`; - -/** - * __useNodesQuery__ - * - * To run a query within a React component, call `useNodesQuery` and pass it any options that fit your needs. - * When your component renders, `useNodesQuery` 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 } = useNodesQuery({ - * variables: { - * }, - * }); - */ -export function useNodesQuery(baseOptions?: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(NodesDocument, options); - } -export function useNodesLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(NodesDocument, options); - } -export type NodesQueryHookResult = ReturnType; -export type NodesLazyQueryHookResult = ReturnType; -export type NodesQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/token/src/routes/staking/node/__generated__/PartyDelegations.ts b/apps/token/src/routes/staking/node/__generated__/PartyDelegations.ts deleted file mode 100644 index d032552c8..000000000 --- a/apps/token/src/routes/staking/node/__generated__/PartyDelegations.ts +++ /dev/null @@ -1,70 +0,0 @@ -import * as Types from '@vegaprotocol/types'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type StakingDelegationsFieldsFragment = { __typename?: 'Delegation', amount: string, epoch: number, node: { __typename?: 'Node', id: string } }; - -export type PartyDelegationsQueryVariables = Types.Exact<{ - partyId: Types.Scalars['ID']; - delegationsPagination?: Types.InputMaybe; -}>; - - -export type PartyDelegationsQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, delegationsConnection?: { __typename?: 'DelegationsConnection', edges?: Array<{ __typename?: 'DelegationEdge', node: { __typename?: 'Delegation', amount: string, epoch: number, node: { __typename?: 'Node', id: string } } } | null> | null } | null } | null, epoch: { __typename?: 'Epoch', id: string } }; - -export const StakingDelegationsFieldsFragmentDoc = gql` - fragment StakingDelegationsFields on Delegation { - amount - node { - id - } - epoch -} - `; -export const PartyDelegationsDocument = gql` - query PartyDelegations($partyId: ID!, $delegationsPagination: Pagination) { - party(id: $partyId) { - id - delegationsConnection(pagination: $delegationsPagination) { - edges { - node { - ...StakingDelegationsFields - } - } - } - } - epoch { - id - } -} - ${StakingDelegationsFieldsFragmentDoc}`; - -/** - * __usePartyDelegationsQuery__ - * - * To run a query within a React component, call `usePartyDelegationsQuery` and pass it any options that fit your needs. - * When your component renders, `usePartyDelegationsQuery` 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 } = usePartyDelegationsQuery({ - * variables: { - * partyId: // value for 'partyId' - * delegationsPagination: // value for 'delegationsPagination' - * }, - * }); - */ -export function usePartyDelegationsQuery(baseOptions: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(PartyDelegationsDocument, options); - } -export function usePartyDelegationsLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(PartyDelegationsDocument, options); - } -export type PartyDelegationsQueryHookResult = ReturnType; -export type PartyDelegationsLazyQueryHookResult = ReturnType; -export type PartyDelegationsQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/token/src/routes/staking/node/__generated__/Staking.ts b/apps/token/src/routes/staking/node/__generated__/Staking.ts deleted file mode 100644 index 65576f470..000000000 --- a/apps/token/src/routes/staking/node/__generated__/Staking.ts +++ /dev/null @@ -1,112 +0,0 @@ -import * as Types from '@vegaprotocol/types'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type StakingNodeFieldsFragment = { __typename?: 'Node', id: string, name: string, pubkey: string, infoUrl: string, location: string, ethereumAddress: string, stakedByOperator: string, stakedByDelegates: string, stakedTotal: string, pendingStake: string, epochData?: { __typename?: 'EpochData', total: number, offline: number, online: number } | null, rankingScore: { __typename?: 'RankingScore', rankingScore: string, stakeScore: string, performanceScore: string, votingPower: string, status: Types.ValidatorStatus } }; - -export type StakingQueryVariables = Types.Exact<{ - partyId: Types.Scalars['ID']; - delegationsPagination?: Types.InputMaybe; -}>; - - -export type StakingQuery = { __typename?: 'Query', party?: { __typename?: 'Party', id: string, stakingSummary: { __typename?: 'StakingSummary', currentStakeAvailable: string }, delegationsConnection?: { __typename?: 'DelegationsConnection', edges?: Array<{ __typename?: 'DelegationEdge', node: { __typename?: 'Delegation', amount: string, epoch: number, node: { __typename?: 'Node', id: string } } } | null> | null } | null } | null, epoch: { __typename?: 'Epoch', id: string, timestamps: { __typename?: 'EpochTimestamps', start?: any | null, end?: any | null, expiry?: any | null } }, nodesConnection: { __typename?: 'NodesConnection', edges?: Array<{ __typename?: 'NodeEdge', node: { __typename?: 'Node', id: string, name: string, pubkey: string, infoUrl: string, location: string, ethereumAddress: string, stakedByOperator: string, stakedByDelegates: string, stakedTotal: string, pendingStake: string, epochData?: { __typename?: 'EpochData', total: number, offline: number, online: number } | null, rankingScore: { __typename?: 'RankingScore', rankingScore: string, stakeScore: string, performanceScore: string, votingPower: string, status: Types.ValidatorStatus } } } | null> | null }, nodeData?: { __typename?: 'NodeData', stakedTotal: string, totalNodes: number, inactiveNodes: number, uptime: number } | null }; - -export const StakingNodeFieldsFragmentDoc = gql` - fragment StakingNodeFields on Node { - id - name - pubkey - infoUrl - location - ethereumAddress - stakedByOperator - stakedByDelegates - stakedTotal - pendingStake - epochData { - total - offline - online - } - rankingScore { - rankingScore - stakeScore - performanceScore - votingPower - status - } -} - `; -export const StakingDocument = gql` - query Staking($partyId: ID!, $delegationsPagination: Pagination) { - party(id: $partyId) { - id - stakingSummary { - currentStakeAvailable - } - delegationsConnection(pagination: $delegationsPagination) { - edges { - node { - amount - epoch - node { - id - } - } - } - } - } - epoch { - id - timestamps { - start - end - expiry - } - } - nodesConnection { - edges { - node { - ...StakingNodeFields - } - } - } - nodeData { - stakedTotal - totalNodes - inactiveNodes - uptime - } -} - ${StakingNodeFieldsFragmentDoc}`; - -/** - * __useStakingQuery__ - * - * To run a query within a React component, call `useStakingQuery` and pass it any options that fit your needs. - * When your component renders, `useStakingQuery` 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 } = useStakingQuery({ - * variables: { - * partyId: // value for 'partyId' - * delegationsPagination: // value for 'delegationsPagination' - * }, - * }); - */ -export function useStakingQuery(baseOptions: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(StakingDocument, options); - } -export function useStakingLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(StakingDocument, options); - } -export type StakingQueryHookResult = ReturnType; -export type StakingLazyQueryHookResult = ReturnType; -export type StakingQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/token/src/routes/token/__generated__/NodeData.ts b/apps/token/src/routes/token/__generated__/NodeData.ts deleted file mode 100644 index 5802f4915..000000000 --- a/apps/token/src/routes/token/__generated__/NodeData.ts +++ /dev/null @@ -1,45 +0,0 @@ -import * as Types from '@vegaprotocol/types'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type NodeDataQueryVariables = Types.Exact<{ [key: string]: never; }>; - - -export type NodeDataQuery = { __typename?: 'Query', nodeData?: { __typename?: 'NodeData', stakedTotal: string } | null }; - - -export const NodeDataDocument = gql` - query NodeData { - nodeData { - stakedTotal - } -} - `; - -/** - * __useNodeDataQuery__ - * - * To run a query within a React component, call `useNodeDataQuery` and pass it any options that fit your needs. - * When your component renders, `useNodeDataQuery` 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 } = useNodeDataQuery({ - * variables: { - * }, - * }); - */ -export function useNodeDataQuery(baseOptions?: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(NodeDataDocument, options); - } -export function useNodeDataLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(NodeDataDocument, options); - } -export type NodeDataQueryHookResult = ReturnType; -export type NodeDataLazyQueryHookResult = ReturnType; -export type NodeDataQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/token/src/routes/token/__generated___/NodeData.ts b/apps/token/src/routes/token/__generated___/NodeData.ts deleted file mode 100644 index 5802f4915..000000000 --- a/apps/token/src/routes/token/__generated___/NodeData.ts +++ /dev/null @@ -1,45 +0,0 @@ -import * as Types from '@vegaprotocol/types'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type NodeDataQueryVariables = Types.Exact<{ [key: string]: never; }>; - - -export type NodeDataQuery = { __typename?: 'Query', nodeData?: { __typename?: 'NodeData', stakedTotal: string } | null }; - - -export const NodeDataDocument = gql` - query NodeData { - nodeData { - stakedTotal - } -} - `; - -/** - * __useNodeDataQuery__ - * - * To run a query within a React component, call `useNodeDataQuery` and pass it any options that fit your needs. - * When your component renders, `useNodeDataQuery` 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 } = useNodeDataQuery({ - * variables: { - * }, - * }); - */ -export function useNodeDataQuery(baseOptions?: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(NodeDataDocument, options); - } -export function useNodeDataLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(NodeDataDocument, options); - } -export type NodeDataQueryHookResult = ReturnType; -export type NodeDataLazyQueryHookResult = ReturnType; -export type NodeDataQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/apps/trading-e2e/src/integration/home.cy.ts b/apps/trading-e2e/src/integration/home.cy.ts index a1c17e1b7..43144738c 100644 --- a/apps/trading-e2e/src/integration/home.cy.ts +++ b/apps/trading-e2e/src/integration/home.cy.ts @@ -1,5 +1,5 @@ import { aliasGQLQuery } from '@vegaprotocol/cypress'; -import type { ProposalListFieldsFragment } from '@vegaprotocol/governance'; +import type { ProposalListFieldsFragment } from '@vegaprotocol/proposals'; import { marketsDataQuery } from '@vegaprotocol/mock'; import * as Schema from '@vegaprotocol/types'; diff --git a/apps/trading-e2e/src/integration/markets.cy.ts b/apps/trading-e2e/src/integration/markets.cy.ts index 0ca5eea9a..3a9e23198 100644 --- a/apps/trading-e2e/src/integration/markets.cy.ts +++ b/apps/trading-e2e/src/integration/markets.cy.ts @@ -1,7 +1,7 @@ import * as Schema from '@vegaprotocol/types'; import { aliasGQLQuery } from '@vegaprotocol/cypress'; import { marketsQuery } from '@vegaprotocol/mock'; -import { getDateTimeFormat } from '@vegaprotocol/react-helpers'; +import { getDateTimeFormat } from '@vegaprotocol/utils'; const dialogCloseBtn = 'dialog-close'; const popoverTrigger = 'popover-trigger'; diff --git a/apps/trading/client-pages/liquidity/liquidity.tsx b/apps/trading/client-pages/liquidity/liquidity.tsx index bcf0b231f..f453db9b0 100644 --- a/apps/trading/client-pages/liquidity/liquidity.tsx +++ b/apps/trading/client-pages/liquidity/liquidity.tsx @@ -8,8 +8,10 @@ import { tooltipMapping } from '@vegaprotocol/market-info'; import { addDecimalsFormatNumber, formatNumberPercentage, +} from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; +import { NetworkParams, - t, useDataProvider, useNetworkParams, updateGridData, diff --git a/apps/trading/client-pages/market/constants.ts b/apps/trading/client-pages/market/constants.ts index 6cc7dbad6..13cb2d9d6 100644 --- a/apps/trading/client-pages/market/constants.ts +++ b/apps/trading/client-pages/market/constants.ts @@ -1,3 +1,3 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; export const NO_MARKET = t('No market'); diff --git a/apps/trading/client-pages/market/market.tsx b/apps/trading/client-pages/market/market.tsx index 72e7024a7..613a0a6c2 100644 --- a/apps/trading/client-pages/market/market.tsx +++ b/apps/trading/client-pages/market/market.tsx @@ -1,9 +1,8 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react'; import debounce from 'lodash/debounce'; +import { addDecimalsFormatNumber, titlefy } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { - addDecimalsFormatNumber, - t, - titlefy, useDataProvider, useThrottledDataProvider, } from '@vegaprotocol/react-helpers'; diff --git a/apps/trading/client-pages/market/trade-grid.tsx b/apps/trading/client-pages/market/trade-grid.tsx index 37fd8d38b..c73755154 100644 --- a/apps/trading/client-pages/market/trade-grid.tsx +++ b/apps/trading/client-pages/market/trade-grid.tsx @@ -19,7 +19,7 @@ import { ResizableGridPanel, Splash, } from '@vegaprotocol/ui-toolkit'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { AccountsContainer } from '../../components/accounts-container'; import type { Market } from '@vegaprotocol/market-list'; import { VegaWalletContainer } from '../../components/vega-wallet-container'; diff --git a/apps/trading/client-pages/market/trade-market-header.tsx b/apps/trading/client-pages/market/trade-market-header.tsx index 19225893e..b43593289 100644 --- a/apps/trading/client-pages/market/trade-market-header.tsx +++ b/apps/trading/client-pages/market/trade-market-header.tsx @@ -1,13 +1,10 @@ import { useAssetDetailsDialogStore } from '@vegaprotocol/assets'; import { useEnvironment } from '@vegaprotocol/environment'; import { ButtonLink, Link } from '@vegaprotocol/ui-toolkit'; -import { MarketProposalNotification } from '@vegaprotocol/governance'; +import { MarketProposalNotification } from '@vegaprotocol/proposals'; import type { Market } from '@vegaprotocol/market-list'; -import { - getExpiryDate, - getMarketExpiryDate, - t, -} from '@vegaprotocol/react-helpers'; +import { getExpiryDate, getMarketExpiryDate } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { ColumnKind, SelectMarketPopover, diff --git a/apps/trading/client-pages/markets/markets-page.tsx b/apps/trading/client-pages/markets/markets-page.tsx index 01538afdf..49c90ea64 100644 --- a/apps/trading/client-pages/markets/markets-page.tsx +++ b/apps/trading/client-pages/markets/markets-page.tsx @@ -1,5 +1,6 @@ import React, { useEffect } from 'react'; -import { t, titlefy } from '@vegaprotocol/react-helpers'; +import { titlefy } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { Tabs, Tab } from '@vegaprotocol/ui-toolkit'; import { Markets } from './markets'; import { Proposed } from './proposed'; diff --git a/apps/trading/client-pages/markets/proposed.tsx b/apps/trading/client-pages/markets/proposed.tsx index c8a543f6e..a577e6cfc 100644 --- a/apps/trading/client-pages/markets/proposed.tsx +++ b/apps/trading/client-pages/markets/proposed.tsx @@ -1,10 +1,10 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { DApp, TOKEN_NEW_MARKET_PROPOSAL, useLinks, } from '@vegaprotocol/environment'; -import { ProposalsList } from '@vegaprotocol/governance'; +import { ProposalsList } from '@vegaprotocol/proposals'; import { ExternalLink } from '@vegaprotocol/ui-toolkit'; export const Proposed = () => { diff --git a/apps/trading/client-pages/portfolio/account-history-container.tsx b/apps/trading/client-pages/portfolio/account-history-container.tsx index db75ceee4..f83695dec 100644 --- a/apps/trading/client-pages/portfolio/account-history-container.tsx +++ b/apps/trading/client-pages/portfolio/account-history-container.tsx @@ -1,9 +1,5 @@ -import { - addDecimal, - fromNanoSeconds, - t, - useThemeSwitcher, -} from '@vegaprotocol/react-helpers'; +import { addDecimal, fromNanoSeconds } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { useVegaWallet } from '@vegaprotocol/wallet'; import compact from 'lodash/compact'; import uniqBy from 'lodash/uniqBy'; @@ -28,7 +24,7 @@ import { PriceChart } from 'pennant'; import 'pennant/dist/style.css'; import type { Account } from '@vegaprotocol/accounts'; import { accountsDataProvider } from '@vegaprotocol/accounts'; -import { useDataProvider } from '@vegaprotocol/react-helpers'; +import { useDataProvider, useThemeSwitcher } from '@vegaprotocol/react-helpers'; import type { Market } from '@vegaprotocol/market-list'; const DateRange = { diff --git a/apps/trading/client-pages/portfolio/deposits-container.tsx b/apps/trading/client-pages/portfolio/deposits-container.tsx index 23c7d2518..917d4da13 100644 --- a/apps/trading/client-pages/portfolio/deposits-container.tsx +++ b/apps/trading/client-pages/portfolio/deposits-container.tsx @@ -1,7 +1,8 @@ import { AsyncRenderer, Button } from '@vegaprotocol/ui-toolkit'; import { useDepositDialog, DepositsTable } from '@vegaprotocol/deposits'; import { depositsProvider } from '@vegaprotocol/deposits'; -import { t, useDataProvider } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; +import { useDataProvider } from '@vegaprotocol/react-helpers'; import { useVegaWallet } from '@vegaprotocol/wallet'; export const DepositsContainer = () => { diff --git a/apps/trading/client-pages/portfolio/portfolio.tsx b/apps/trading/client-pages/portfolio/portfolio.tsx index c21c46472..128d44605 100644 --- a/apps/trading/client-pages/portfolio/portfolio.tsx +++ b/apps/trading/client-pages/portfolio/portfolio.tsx @@ -1,4 +1,5 @@ -import { t, titlefy } from '@vegaprotocol/react-helpers'; +import { titlefy } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { PositionsContainer } from '@vegaprotocol/positions'; import { OrderListContainer } from '@vegaprotocol/orders'; import { ResizableGridPanel, Tab, Tabs } from '@vegaprotocol/ui-toolkit'; diff --git a/apps/trading/client-pages/portfolio/withdrawals-container.tsx b/apps/trading/client-pages/portfolio/withdrawals-container.tsx index 3fe597265..13f7e48f9 100644 --- a/apps/trading/client-pages/portfolio/withdrawals-container.tsx +++ b/apps/trading/client-pages/portfolio/withdrawals-container.tsx @@ -5,7 +5,8 @@ import { WithdrawalsTable, } from '@vegaprotocol/withdraws'; import { useVegaWallet } from '@vegaprotocol/wallet'; -import { t, useDataProvider } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; +import { useDataProvider } from '@vegaprotocol/react-helpers'; import { VegaWalletContainer } from '../../components/vega-wallet-container'; export const WithdrawalsContainer = () => { diff --git a/apps/trading/components/accounts-container/accounts-container.tsx b/apps/trading/components/accounts-container/accounts-container.tsx index 8dd6d4f73..95f9f9ae2 100644 --- a/apps/trading/components/accounts-container/accounts-container.tsx +++ b/apps/trading/components/accounts-container/accounts-container.tsx @@ -1,6 +1,6 @@ import { useCallback } from 'react'; import { Button } from '@vegaprotocol/ui-toolkit'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { useWithdrawalDialog } from '@vegaprotocol/withdraws'; import { useAssetDetailsDialogStore } from '@vegaprotocol/assets'; import { Splash } from '@vegaprotocol/ui-toolkit'; diff --git a/apps/trading/components/app-loader/app-failure.tsx b/apps/trading/components/app-loader/app-failure.tsx index 0057955ed..842db1e2c 100644 --- a/apps/trading/components/app-loader/app-failure.tsx +++ b/apps/trading/components/app-loader/app-failure.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Button } from '@vegaprotocol/ui-toolkit'; import { useGlobalStore } from '../../stores'; diff --git a/apps/trading/components/app-loader/app-loader.tsx b/apps/trading/components/app-loader/app-loader.tsx index caeae848f..8a63dd8cb 100644 --- a/apps/trading/components/app-loader/app-loader.tsx +++ b/apps/trading/components/app-loader/app-loader.tsx @@ -4,7 +4,7 @@ import { NodeGuard, useEnvironment, } from '@vegaprotocol/environment'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { MaintenancePage } from '@vegaprotocol/ui-toolkit'; import { VegaWalletProvider } from '@vegaprotocol/wallet'; import dynamic from 'next/dynamic'; diff --git a/apps/trading/components/app-loader/web3-provider.tsx b/apps/trading/components/app-loader/web3-provider.tsx index 290d9309c..f26ca6956 100644 --- a/apps/trading/components/app-loader/web3-provider.tsx +++ b/apps/trading/components/app-loader/web3-provider.tsx @@ -5,7 +5,7 @@ import { useWeb3ConnectStore, } from '@vegaprotocol/web3'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { useEnvironment } from '@vegaprotocol/environment'; import type { ReactNode } from 'react'; import { useEffect } from 'react'; diff --git a/apps/trading/components/constants.ts b/apps/trading/components/constants.ts index 014fa9835..5a41d2910 100644 --- a/apps/trading/components/constants.ts +++ b/apps/trading/components/constants.ts @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; export const THROTTLE_UPDATE_TIME = 500; export const RISK_ACCEPTED_KEY = 'vega-risk-accepted'; export const MAINNET_WELCOME_HEADER = t( diff --git a/apps/trading/components/footer/footer.tsx b/apps/trading/components/footer/footer.tsx index de0e14d2d..3484f5f28 100644 --- a/apps/trading/components/footer/footer.tsx +++ b/apps/trading/components/footer/footer.tsx @@ -1,5 +1,6 @@ import { useEnvironment, useNodeHealth } from '@vegaprotocol/environment'; -import { t, useNavigatorOnline } from '@vegaprotocol/react-helpers'; +import { useNavigatorOnline } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Indicator, Intent } from '@vegaprotocol/ui-toolkit'; import classNames from 'classnames'; import type { ButtonHTMLAttributes, ReactNode } from 'react'; diff --git a/apps/trading/components/last-24h-price-change/last-24h-price-change.tsx b/apps/trading/components/last-24h-price-change/last-24h-price-change.tsx index 31e5621ab..23ac5f620 100644 --- a/apps/trading/components/last-24h-price-change/last-24h-price-change.tsx +++ b/apps/trading/components/last-24h-price-change/last-24h-price-change.tsx @@ -1,12 +1,12 @@ import type { RefObject } from 'react'; import { useMemo } from 'react'; import { useInView } from 'react-intersection-observer'; +import { isNumeric } from '@vegaprotocol/utils'; import { - isNumeric, useThrottledDataProvider, useYesterday, } from '@vegaprotocol/react-helpers'; -import { PriceCellChange } from '@vegaprotocol/ui-toolkit'; +import { PriceChangeCell } from '@vegaprotocol/datagrid'; import * as Schema from '@vegaprotocol/types'; import type { CandleClose } from '@vegaprotocol/types'; import type { Candle } from '@vegaprotocol/market-list'; @@ -57,7 +57,7 @@ export const Last24hPriceChange = ({ return -; } return ( - - {compiledGrid && } + + + {t('Supplied stake')} + + {market?.suppliedStake + ? addDecimalsFormatNumber( + new BigNumber(market?.suppliedStake).toString(), + assetDecimals + ) + : '-'} + + + + {t('Target stake')} + + {market?.targetStake + ? addDecimalsFormatNumber( + new BigNumber(market?.targetStake).toString(), + assetDecimals + ) + : '-'} + + +
{t('View liquidity provision table')} diff --git a/apps/trading/components/market-mark-price/market-mark-price.tsx b/apps/trading/components/market-mark-price/market-mark-price.tsx index 423b23ed3..96aeafbb2 100644 --- a/apps/trading/components/market-mark-price/market-mark-price.tsx +++ b/apps/trading/components/market-mark-price/market-mark-price.tsx @@ -1,12 +1,9 @@ import type { RefObject } from 'react'; import { useMemo } from 'react'; import { useInView } from 'react-intersection-observer'; -import { - addDecimalsFormatNumber, - PriceCell, - useThrottledDataProvider, - isNumeric, -} from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber, isNumeric } from '@vegaprotocol/utils'; +import { useThrottledDataProvider } from '@vegaprotocol/react-helpers'; +import { PriceCell } from '@vegaprotocol/datagrid'; import type { MarketData, MarketDataUpdateFieldsFragment, diff --git a/apps/trading/components/market-state/market-state.tsx b/apps/trading/components/market-state/market-state.tsx index 4a0e88da1..cd11604c6 100644 --- a/apps/trading/components/market-state/market-state.tsx +++ b/apps/trading/components/market-state/market-state.tsx @@ -5,7 +5,8 @@ import type { Market, } from '@vegaprotocol/market-list'; import { marketDataProvider } from '@vegaprotocol/market-list'; -import { t, useDataProvider } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; +import { useDataProvider } from '@vegaprotocol/react-helpers'; import * as Schema from '@vegaprotocol/types'; import { HeaderStat } from '../header'; import { useCallback, useMemo, useRef, useState } from 'react'; diff --git a/apps/trading/components/market-trading-mode/market-trading-mode.tsx b/apps/trading/components/market-trading-mode/market-trading-mode.tsx index cea617357..c3c1a50e3 100644 --- a/apps/trading/components/market-trading-mode/market-trading-mode.tsx +++ b/apps/trading/components/market-trading-mode/market-trading-mode.tsx @@ -1,5 +1,5 @@ import type { RefObject } from 'react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { TradingModeTooltip } from '@vegaprotocol/deal-ticket'; import { useInView } from 'react-intersection-observer'; import * as Schema from '@vegaprotocol/types'; diff --git a/apps/trading/components/market-volume/market-volume.tsx b/apps/trading/components/market-volume/market-volume.tsx index 1272e51eb..9d24df184 100644 --- a/apps/trading/components/market-volume/market-volume.tsx +++ b/apps/trading/components/market-volume/market-volume.tsx @@ -1,10 +1,8 @@ import { useCallback, useMemo, useRef, useState } from 'react'; import throttle from 'lodash/throttle'; -import { - addDecimalsFormatNumber, - t, - useDataProvider, -} from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; +import { useDataProvider } from '@vegaprotocol/react-helpers'; import type { MarketData, MarketDataUpdateFieldsFragment, diff --git a/apps/trading/components/navbar/navbar.tsx b/apps/trading/components/navbar/navbar.tsx index 55d26ab20..bc65bcaae 100644 --- a/apps/trading/components/navbar/navbar.tsx +++ b/apps/trading/components/navbar/navbar.tsx @@ -7,7 +7,7 @@ import { TOKEN_GOVERNANCE, useLinks, } from '@vegaprotocol/environment'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { useGlobalStore } from '../../stores'; import { VegaWalletConnectButton } from '../vega-wallet-connect-button'; import { diff --git a/apps/trading/components/select-market/select-market-columns.tsx b/apps/trading/components/select-market/select-market-columns.tsx index e004f386b..817992b94 100644 --- a/apps/trading/components/select-market/select-market-columns.tsx +++ b/apps/trading/components/select-market/select-market-columns.tsx @@ -5,12 +5,9 @@ import { calcCandleLow, calcCandleVolume, } from '@vegaprotocol/market-list'; -import { - addDecimalsFormatNumber, - PriceCell, - signedNumberCssClass, - t, -} from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; +import { PriceCell, signedNumberCssClass } from '@vegaprotocol/datagrid'; import { Link as UILink, Sparkline, Tooltip } from '@vegaprotocol/ui-toolkit'; import isNil from 'lodash/isNil'; import type { CandleClose } from '@vegaprotocol/types'; diff --git a/apps/trading/components/select-market/select-market.tsx b/apps/trading/components/select-market/select-market.tsx index cdc659d3e..6f08ab8de 100644 --- a/apps/trading/components/select-market/select-market.tsx +++ b/apps/trading/components/select-market/select-market.tsx @@ -2,7 +2,8 @@ import { useCallback, useEffect, useMemo, useState, useRef } from 'react'; import type { RefObject } from 'react'; import { useMarketList } from '@vegaprotocol/market-list'; import { positionsDataProvider } from '@vegaprotocol/positions'; -import { t, useDataProvider } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; +import { useDataProvider } from '@vegaprotocol/react-helpers'; import { ExternalLink, Icon, Loader, Popover } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { diff --git a/apps/trading/components/vega-wallet-connect-button/vega-wallet-connect-button.spec.tsx b/apps/trading/components/vega-wallet-connect-button/vega-wallet-connect-button.spec.tsx index 255b5336a..c6d4a3844 100644 --- a/apps/trading/components/vega-wallet-connect-button/vega-wallet-connect-button.spec.tsx +++ b/apps/trading/components/vega-wallet-connect-button/vega-wallet-connect-button.spec.tsx @@ -2,7 +2,7 @@ import { fireEvent, render, screen } from '@testing-library/react'; import { VegaWalletContext } from '@vegaprotocol/wallet'; import type { VegaWalletContextShape } from '@vegaprotocol/wallet'; import { VegaWalletConnectButton } from './vega-wallet-connect-button'; -import { truncateByChars } from '@vegaprotocol/react-helpers'; +import { truncateByChars } from '@vegaprotocol/utils'; import userEvent from '@testing-library/user-event'; const mockUpdateDialogOpen = jest.fn(); diff --git a/apps/trading/components/vega-wallet-connect-button/vega-wallet-connect-button.tsx b/apps/trading/components/vega-wallet-connect-button/vega-wallet-connect-button.tsx index d0ccbc370..a83a59479 100644 --- a/apps/trading/components/vega-wallet-connect-button/vega-wallet-connect-button.tsx +++ b/apps/trading/components/vega-wallet-connect-button/vega-wallet-connect-button.tsx @@ -1,7 +1,8 @@ import { useCallback, useEffect, useMemo, useState } from 'react'; import CopyToClipboard from 'react-copy-to-clipboard'; import classNames from 'classnames'; -import { t, truncateByChars } from '@vegaprotocol/react-helpers'; +import { truncateByChars } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { Button, DropdownMenu, diff --git a/apps/trading/components/vega-wallet-container/vega-wallet-container.tsx b/apps/trading/components/vega-wallet-container/vega-wallet-container.tsx index 14e1f3b59..18d72ecae 100644 --- a/apps/trading/components/vega-wallet-container/vega-wallet-container.tsx +++ b/apps/trading/components/vega-wallet-container/vega-wallet-container.tsx @@ -1,5 +1,5 @@ import type { ReactNode } from 'react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Button, Splash } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet, useVegaWalletDialogStore } from '@vegaprotocol/wallet'; diff --git a/apps/trading/components/welcome-dialog/proposed-markets.tsx b/apps/trading/components/welcome-dialog/proposed-markets.tsx index c36561363..fbeacfe09 100644 --- a/apps/trading/components/welcome-dialog/proposed-markets.tsx +++ b/apps/trading/components/welcome-dialog/proposed-markets.tsx @@ -1,6 +1,7 @@ import { useMemo } from 'react'; -import { t, useDataProvider } from '@vegaprotocol/react-helpers'; -import { proposalsDataProvider } from '@vegaprotocol/governance'; +import { t } from '@vegaprotocol/i18n'; +import { useDataProvider } from '@vegaprotocol/react-helpers'; +import { proposalsDataProvider } from '@vegaprotocol/proposals'; import take from 'lodash/take'; import * as Types from '@vegaprotocol/types'; import { ExternalLink } from '@vegaprotocol/ui-toolkit'; diff --git a/apps/trading/components/welcome-dialog/risk-notice-dialog.tsx b/apps/trading/components/welcome-dialog/risk-notice-dialog.tsx index 1bc65266d..650d59da7 100644 --- a/apps/trading/components/welcome-dialog/risk-notice-dialog.tsx +++ b/apps/trading/components/welcome-dialog/risk-notice-dialog.tsx @@ -1,7 +1,7 @@ import { useCallback } from 'react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Button } from '@vegaprotocol/ui-toolkit'; -import { LocalStorage } from '@vegaprotocol/react-helpers'; +import { LocalStorage } from '@vegaprotocol/utils'; import { RISK_ACCEPTED_KEY } from '../constants'; interface Props { diff --git a/apps/trading/components/welcome-dialog/welcome-dialog.tsx b/apps/trading/components/welcome-dialog/welcome-dialog.tsx index bdeac4a63..de47d6694 100644 --- a/apps/trading/components/welcome-dialog/welcome-dialog.tsx +++ b/apps/trading/components/welcome-dialog/welcome-dialog.tsx @@ -1,11 +1,8 @@ import React, { useCallback } from 'react'; import { useLocation } from 'react-router-dom'; import { Dialog } from '@vegaprotocol/ui-toolkit'; -import { - t, - useDataProvider, - useLocalStorage, -} from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; +import { useDataProvider, useLocalStorage } from '@vegaprotocol/react-helpers'; import { activeMarketsProvider } from '@vegaprotocol/market-list'; import { useEnvironment, Networks } from '@vegaprotocol/environment'; import * as constants from '../constants'; diff --git a/apps/trading/components/welcome-dialog/welcome-landing-dialog.tsx b/apps/trading/components/welcome-dialog/welcome-landing-dialog.tsx index 241b2360d..b65f0cbe3 100644 --- a/apps/trading/components/welcome-dialog/welcome-landing-dialog.tsx +++ b/apps/trading/components/welcome-dialog/welcome-landing-dialog.tsx @@ -1,6 +1,6 @@ import React, { useCallback } from 'react'; import { useMarketList } from '@vegaprotocol/market-list'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { useAssetDetailsDialogStore } from '@vegaprotocol/assets'; import { Link as UILink } from '@vegaprotocol/ui-toolkit'; import type { OnCellClickHandler } from '../select-market'; diff --git a/apps/trading/components/welcome-dialog/welcome-notice-dialog.tsx b/apps/trading/components/welcome-dialog/welcome-notice-dialog.tsx index 5ad9b0a2f..a6540d3cc 100644 --- a/apps/trading/components/welcome-dialog/welcome-notice-dialog.tsx +++ b/apps/trading/components/welcome-dialog/welcome-notice-dialog.tsx @@ -1,5 +1,5 @@ import { ExternalLink } from '@vegaprotocol/ui-toolkit'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { BLOG, DApp, diff --git a/apps/trading/lib/hooks/use-ethereum-transaction-toasts.tsx b/apps/trading/lib/hooks/use-ethereum-transaction-toasts.tsx index afa57846b..c41cfcfeb 100644 --- a/apps/trading/lib/hooks/use-ethereum-transaction-toasts.tsx +++ b/apps/trading/lib/hooks/use-ethereum-transaction-toasts.tsx @@ -1,7 +1,8 @@ import type { ReactNode } from 'react'; import { useAssetsDataProvider } from '@vegaprotocol/assets'; import { ETHERSCAN_TX, useEtherscanLink } from '@vegaprotocol/environment'; -import { formatNumber, t, toBigNum } from '@vegaprotocol/react-helpers'; +import { formatNumber, toBigNum } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import type { Toast, ToastContent } from '@vegaprotocol/ui-toolkit'; import { ToastHeading } from '@vegaprotocol/ui-toolkit'; import { Panel } from '@vegaprotocol/ui-toolkit'; diff --git a/apps/trading/lib/hooks/use-ethereum-withdraw-approval-toasts.tsx b/apps/trading/lib/hooks/use-ethereum-withdraw-approval-toasts.tsx index 132b34725..1582b57d4 100644 --- a/apps/trading/lib/hooks/use-ethereum-withdraw-approval-toasts.tsx +++ b/apps/trading/lib/hooks/use-ethereum-withdraw-approval-toasts.tsx @@ -1,4 +1,5 @@ -import { formatNumber, t, toBigNum } from '@vegaprotocol/react-helpers'; +import { formatNumber, toBigNum } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import type { Toast } from '@vegaprotocol/ui-toolkit'; import { ToastHeading } from '@vegaprotocol/ui-toolkit'; import { Panel } from '@vegaprotocol/ui-toolkit'; diff --git a/apps/trading/lib/hooks/use-vega-transaction-toasts.tsx b/apps/trading/lib/hooks/use-vega-transaction-toasts.tsx index ef59d0493..d8163a552 100644 --- a/apps/trading/lib/hooks/use-vega-transaction-toasts.tsx +++ b/apps/trading/lib/hooks/use-vega-transaction-toasts.tsx @@ -32,11 +32,10 @@ import { Button, ExternalLink, Intent } from '@vegaprotocol/ui-toolkit'; import { addDecimalsFormatNumber, formatNumber, - Size, - t, toBigNum, truncateByChars, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { useAssetsDataProvider } from '@vegaprotocol/assets'; import { useEthWithdrawApprovalsStore } from '@vegaprotocol/web3'; import { DApp, EXPLORER_TX, useLinks } from '@vegaprotocol/environment'; @@ -45,6 +44,7 @@ import { useMarketList } from '@vegaprotocol/market-list'; import type { Side } from '@vegaprotocol/types'; import { OrderStatus } from '@vegaprotocol/types'; import { OrderStatusMapping } from '@vegaprotocol/types'; +import { Size } from '@vegaprotocol/react-helpers'; const intentMap: { [s in VegaTxStatus]: Intent } = { Default: Intent.Primary, diff --git a/apps/trading/pages/_app.page.tsx b/apps/trading/pages/_app.page.tsx index d2a2f7c37..c55ee0b80 100644 --- a/apps/trading/pages/_app.page.tsx +++ b/apps/trading/pages/_app.page.tsx @@ -1,7 +1,7 @@ import Head from 'next/head'; import type { AppProps } from 'next/app'; import { Navbar } from '../components/navbar'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { useEagerConnect as useVegaEagerConnect, useVegaTransactionManager, diff --git a/apps/trading/pages/client-router.tsx b/apps/trading/pages/client-router.tsx index 7fa7c15ed..8a569bfd7 100644 --- a/apps/trading/pages/client-router.tsx +++ b/apps/trading/pages/client-router.tsx @@ -2,7 +2,7 @@ import { Suspense } from 'react'; import type { RouteObject } from 'react-router-dom'; import { useRoutes } from 'react-router-dom'; import dynamic from 'next/dynamic'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Loader, Splash } from '@vegaprotocol/ui-toolkit'; import trimEnd from 'lodash/trimEnd'; diff --git a/apps/trading/pages/toasts-manager.tsx b/apps/trading/pages/toasts-manager.tsx index 84f1aade7..b293b67eb 100644 --- a/apps/trading/pages/toasts-manager.tsx +++ b/apps/trading/pages/toasts-manager.tsx @@ -1,5 +1,5 @@ import { ToastsContainer, useToasts } from '@vegaprotocol/ui-toolkit'; -import { useUpdateNetworkParametersToasts } from '@vegaprotocol/governance'; +import { useUpdateNetworkParametersToasts } from '@vegaprotocol/proposals'; import { useVegaTransactionToasts } from '../lib/hooks/use-vega-transaction-toasts'; import { useEthereumTransactionToasts } from '../lib/hooks/use-ethereum-transaction-toasts'; import { useEthereumWithdrawApprovalsToasts } from '../lib/hooks/use-ethereum-withdraw-approval-toasts'; diff --git a/apps/trading/stores/global.ts b/apps/trading/stores/global.ts index 90852d776..18e11a2ac 100644 --- a/apps/trading/stores/global.ts +++ b/apps/trading/stores/global.ts @@ -1,4 +1,4 @@ -import { LocalStorage } from '@vegaprotocol/react-helpers'; +import { LocalStorage } from '@vegaprotocol/utils'; import { create } from 'zustand'; import produce from 'immer'; diff --git a/libs/accounts/.storybook/preview.js b/libs/accounts/.storybook/preview.js index c1b81a5b8..77cf7b2b5 100644 --- a/libs/accounts/.storybook/preview.js +++ b/libs/accounts/.storybook/preview.js @@ -1,5 +1,5 @@ import './styles.scss'; -import { useStorybookThemeObserver } from '@vegaprotocol/react-helpers'; +import { useStorybookThemeObserver } from '@vegaprotocol/utils'; export const parameters = { actions: { argTypesRegex: '^on[A-Z].*' }, backgrounds: { disable: true }, diff --git a/libs/accounts/src/lib/accounts-data-provider.ts b/libs/accounts/src/lib/accounts-data-provider.ts index 34d131e34..486862744 100644 --- a/libs/accounts/src/lib/accounts-data-provider.ts +++ b/libs/accounts/src/lib/accounts-data-provider.ts @@ -4,7 +4,7 @@ import { makeDataProvider, makeDerivedDataProvider, removePaginationWrapper, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import produce from 'immer'; diff --git a/libs/accounts/src/lib/accounts-manager.tsx b/libs/accounts/src/lib/accounts-manager.tsx index 833254047..32fe795ee 100644 --- a/libs/accounts/src/lib/accounts-manager.tsx +++ b/libs/accounts/src/lib/accounts-manager.tsx @@ -1,4 +1,5 @@ -import { t, useDataProvider } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; +import { useDataProvider } from '@vegaprotocol/react-helpers'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; import type { AgGridReact } from 'ag-grid-react'; import { useRef, useMemo, memo } from 'react'; diff --git a/libs/accounts/src/lib/accounts-table.tsx b/libs/accounts/src/lib/accounts-table.tsx index 0a68a1e2d..2958a10f7 100644 --- a/libs/accounts/src/lib/accounts-table.tsx +++ b/libs/accounts/src/lib/accounts-table.tsx @@ -1,17 +1,16 @@ import { forwardRef, useMemo, useState } from 'react'; -import { - addDecimalsFormatNumber, - isNumeric, - t, -} from '@vegaprotocol/react-helpers'; -import type { VegaICellRendererParams } from '@vegaprotocol/ui-toolkit'; +import { addDecimalsFormatNumber, isNumeric } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; +import type { + VegaICellRendererParams, + VegaValueFormatterParams, +} from '@vegaprotocol/datagrid'; import { ButtonLink, Dialog } from '@vegaprotocol/ui-toolkit'; import { TooltipCellComponent } from '@vegaprotocol/ui-toolkit'; -import { AgGridDynamic as AgGrid } from '@vegaprotocol/ui-toolkit'; +import { AgGridDynamic as AgGrid } from '@vegaprotocol/datagrid'; import { AgGridColumn } from 'ag-grid-react'; import type { IDatasource, IGetRowsParams } from 'ag-grid-community'; import type { AgGridReact, AgGridReactProps } from 'ag-grid-react'; -import type { VegaValueFormatterParams } from '@vegaprotocol/ui-toolkit'; import BreakdownTable from './breakdown-table'; import type { AccountFields } from './accounts-data-provider'; import type { Asset } from '@vegaprotocol/types'; diff --git a/libs/accounts/src/lib/asset-balance.tsx b/libs/accounts/src/lib/asset-balance.tsx index 51bd4b9fa..b6db46cf5 100644 --- a/libs/accounts/src/lib/asset-balance.tsx +++ b/libs/accounts/src/lib/asset-balance.tsx @@ -1,9 +1,7 @@ import { useMemo } from 'react'; -import { - addDecimalsFormatNumber, - useDataProvider, -} from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber } from '@vegaprotocol/utils'; import { accountsDataProvider } from './accounts-data-provider'; +import { useDataProvider } from '@vegaprotocol/react-helpers'; interface AssetBalanceProps { partyId: string; diff --git a/libs/accounts/src/lib/breakdown-table.tsx b/libs/accounts/src/lib/breakdown-table.tsx index caf24a9e1..4ac287f5b 100644 --- a/libs/accounts/src/lib/breakdown-table.tsx +++ b/libs/accounts/src/lib/breakdown-table.tsx @@ -1,12 +1,7 @@ import { forwardRef } from 'react'; +import { addDecimalsFormatNumber, isNumeric } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { - addDecimalsFormatNumber, - isNumeric, - PriceCell, - t, -} from '@vegaprotocol/react-helpers'; -import { - AgGridDynamic as AgGrid, Intent, progressBarCellRendererSelector, } from '@vegaprotocol/ui-toolkit'; @@ -14,10 +9,9 @@ import { AgGridColumn } from 'ag-grid-react'; import type { AgGridReact, AgGridReactProps } from 'ag-grid-react'; import type { AccountFields } from './accounts-data-provider'; import { AccountTypeMapping } from '@vegaprotocol/types'; -import type { - ValueProps, - VegaValueFormatterParams, -} from '@vegaprotocol/ui-toolkit'; +import type { ValueProps } from '@vegaprotocol/ui-toolkit'; +import type { VegaValueFormatterParams } from '@vegaprotocol/datagrid'; +import { AgGridDynamic as AgGrid, PriceCell } from '@vegaprotocol/datagrid'; import type { ValueFormatterParams } from 'ag-grid-community'; export const progressBarValueFormatter = ({ diff --git a/libs/accounts/src/lib/transfer-container.tsx b/libs/accounts/src/lib/transfer-container.tsx index b03e313ed..b8e98ef01 100644 --- a/libs/accounts/src/lib/transfer-container.tsx +++ b/libs/accounts/src/lib/transfer-container.tsx @@ -1,9 +1,8 @@ import * as Schema from '@vegaprotocol/types'; +import { addDecimal, truncateByChars } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { - addDecimal, NetworkParams, - t, - truncateByChars, useDataProvider, useNetworkParam, } from '@vegaprotocol/react-helpers'; diff --git a/libs/accounts/src/lib/transfer-dialog.tsx b/libs/accounts/src/lib/transfer-dialog.tsx index 998eaf253..0627bddf4 100644 --- a/libs/accounts/src/lib/transfer-dialog.tsx +++ b/libs/accounts/src/lib/transfer-dialog.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Dialog } from '@vegaprotocol/ui-toolkit'; import { create } from 'zustand'; import { TransferContainer } from './transfer-container'; diff --git a/libs/accounts/src/lib/transfer-form.spec.tsx b/libs/accounts/src/lib/transfer-form.spec.tsx index eb977217a..601274c5a 100644 --- a/libs/accounts/src/lib/transfer-form.spec.tsx +++ b/libs/accounts/src/lib/transfer-form.spec.tsx @@ -2,7 +2,7 @@ import { fireEvent, render, screen, waitFor } from '@testing-library/react'; import BigNumber from 'bignumber.js'; import { AddressField, TransferFee, TransferForm } from './transfer-form'; import { AccountType } from '@vegaprotocol/types'; -import { formatNumber, removeDecimal } from '@vegaprotocol/react-helpers'; +import { formatNumber, removeDecimal } from '@vegaprotocol/utils'; describe('TransferForm', () => { const submit = () => fireEvent.submit(screen.getByTestId('transfer-form')); diff --git a/libs/accounts/src/lib/transfer-form.tsx b/libs/accounts/src/lib/transfer-form.tsx index 53d1bf020..417d17ede 100644 --- a/libs/accounts/src/lib/transfer-form.tsx +++ b/libs/accounts/src/lib/transfer-form.tsx @@ -1,12 +1,12 @@ import { - t, minSafe, maxSafe, required, vegaPublicKey, addDecimal, formatNumber, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { Button, FormGroup, diff --git a/libs/apollo-client/src/lib/apollo-client.ts b/libs/apollo-client/src/lib/apollo-client.ts index a2fcb9285..94b74aaa8 100644 --- a/libs/apollo-client/src/lib/apollo-client.ts +++ b/libs/apollo-client/src/lib/apollo-client.ts @@ -13,7 +13,7 @@ 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'; -import { localLoggerFactory } from '@vegaprotocol/react-helpers'; +import { localLoggerFactory } from '@vegaprotocol/utils'; import { useHeaderStore } from './header-store'; const isBrowser = typeof window !== 'undefined'; diff --git a/libs/assets/src/lib/asset-data-provider.ts b/libs/assets/src/lib/asset-data-provider.ts index 0a045ccd6..e7b1e3ac9 100644 --- a/libs/assets/src/lib/asset-data-provider.ts +++ b/libs/assets/src/lib/asset-data-provider.ts @@ -1,4 +1,5 @@ -import { makeDataProvider, useDataProvider } from '@vegaprotocol/react-helpers'; +import { makeDataProvider } from '@vegaprotocol/utils'; +import { useDataProvider } from '@vegaprotocol/react-helpers'; import { useMemo } from 'react'; import type { AssetQuery, AssetFieldsFragment } from './__generated__/Asset'; diff --git a/libs/assets/src/lib/asset-details-dialog.tsx b/libs/assets/src/lib/asset-details-dialog.tsx index a45789b3a..88efa90c0 100644 --- a/libs/assets/src/lib/asset-details-dialog.tsx +++ b/libs/assets/src/lib/asset-details-dialog.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { useAssetsDataProvider } from './assets-data-provider'; import { Button, @@ -9,7 +9,7 @@ import { } from '@vegaprotocol/ui-toolkit'; import { create } from 'zustand'; import { AssetDetailsTable } from './asset-details-table'; -import { AssetProposalNotification } from '@vegaprotocol/governance'; +import { AssetProposalNotification } from '@vegaprotocol/proposals'; export type AssetDetailsDialogStore = { isOpen: boolean; diff --git a/libs/assets/src/lib/asset-details-table.tsx b/libs/assets/src/lib/asset-details-table.tsx index f92e01484..09fc6eefb 100644 --- a/libs/assets/src/lib/asset-details-table.tsx +++ b/libs/assets/src/lib/asset-details-table.tsx @@ -1,5 +1,6 @@ import { ContractAddressLink } from '@vegaprotocol/environment'; -import { addDecimalsFormatNumber, t } from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import type * as Schema from '@vegaprotocol/types'; import type { KeyValueTableRowProps } from '@vegaprotocol/ui-toolkit'; import { CopyWithTooltip, Icon } from '@vegaprotocol/ui-toolkit'; diff --git a/libs/assets/src/lib/assets-data-provider.ts b/libs/assets/src/lib/assets-data-provider.ts index 883a27436..b39e98671 100644 --- a/libs/assets/src/lib/assets-data-provider.ts +++ b/libs/assets/src/lib/assets-data-provider.ts @@ -1,8 +1,5 @@ -import { - makeDataProvider, - makeDerivedDataProvider, - useDataProvider, -} from '@vegaprotocol/react-helpers'; +import { makeDataProvider, makeDerivedDataProvider } from '@vegaprotocol/utils'; +import { useDataProvider } from '@vegaprotocol/react-helpers'; import { AssetsDocument } from './__generated__/Assets'; import * as Schema from '@vegaprotocol/types'; import type { AssetsQuery } from './__generated__/Assets'; diff --git a/libs/candles-chart/src/lib/candles-chart.tsx b/libs/candles-chart/src/lib/candles-chart.tsx index 1dd9d4c87..0990c5b0e 100644 --- a/libs/candles-chart/src/lib/candles-chart.tsx +++ b/libs/candles-chart/src/lib/candles-chart.tsx @@ -27,7 +27,7 @@ import { } from '@vegaprotocol/ui-toolkit'; import type { IconName } from '@blueprintjs/icons'; import { IconNames } from '@blueprintjs/icons'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; const chartTypeIcon = new Map([ [ChartType.AREA, IconNames.TIMELINE_AREA_CHART], diff --git a/libs/candles-chart/src/lib/data-source.ts b/libs/candles-chart/src/lib/data-source.ts index 571114f62..237cadad2 100644 --- a/libs/candles-chart/src/lib/data-source.ts +++ b/libs/candles-chart/src/lib/data-source.ts @@ -2,7 +2,7 @@ import type { ApolloClient } from '@apollo/client'; import type { Candle, DataSource } from 'pennant'; import { Interval as PennantInterval } from 'pennant'; -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; import { ChartDocument } from './__generated__/Chart'; import type { ChartQuery, ChartQueryVariables } from './__generated__/Chart'; import { diff --git a/libs/cypress/mock.ts b/libs/cypress/mock.ts index 33d6ad12c..5a6a4df26 100644 --- a/libs/cypress/mock.ts +++ b/libs/cypress/mock.ts @@ -8,7 +8,7 @@ export * from '../deal-ticket/src/hooks/estimate-order.mock'; export * from '../deposits/src/lib/deposit.mock'; export * from '../environment/src/utils/node.mock'; export * from '../fills/src/lib/fills.mock'; -export * from '../governance/src/lib/proposals-data-provider/proposals.mock'; +export * from '../proposals/src/lib/proposals-data-provider/proposals.mock'; export * from '../ledger/src/lib/ledger-entries.mock'; export * from '../market-depth/src/lib/market-depth.mock'; export * from '../market-info/src/components/market-info/market-info.mock'; diff --git a/libs/governance/.babelrc b/libs/datagrid/.babelrc similarity index 100% rename from libs/governance/.babelrc rename to libs/datagrid/.babelrc diff --git a/libs/datagrid/.eslintrc.json b/libs/datagrid/.eslintrc.json new file mode 100644 index 000000000..734ddacee --- /dev/null +++ b/libs/datagrid/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/libs/datagrid/README.md b/libs/datagrid/README.md new file mode 100644 index 000000000..84bc48c2d --- /dev/null +++ b/libs/datagrid/README.md @@ -0,0 +1,7 @@ +# datagrid + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test datagrid` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/libs/datagrid/jest.config.ts b/libs/datagrid/jest.config.ts new file mode 100644 index 000000000..7ff10146f --- /dev/null +++ b/libs/datagrid/jest.config.ts @@ -0,0 +1,12 @@ +/* eslint-disable */ +process.env.TZ = 'UTC'; +export default { + displayName: 'datagrid', + preset: '../../jest.preset.js', + transform: { + '^.+\\.[tj]sx?$': 'babel-jest', + }, + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], + coverageDirectory: '../../coverage/libs/datagrid', + setupFilesAfterEnv: ['./src/setup-tests.ts'], +}; diff --git a/libs/datagrid/package.json b/libs/datagrid/package.json new file mode 100644 index 000000000..37b30e1ff --- /dev/null +++ b/libs/datagrid/package.json @@ -0,0 +1,4 @@ +{ + "name": "@vegaprotocol/datagrid", + "version": "0.0.1" +} diff --git a/libs/datagrid/project.json b/libs/datagrid/project.json new file mode 100644 index 000000000..f5e7c4f0d --- /dev/null +++ b/libs/datagrid/project.json @@ -0,0 +1,43 @@ +{ + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/datagrid/src", + "projectType": "library", + "tags": [], + "targets": { + "build": { + "executor": "@nrwl/web:rollup", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/libs/datagrid", + "tsConfig": "libs/datagrid/tsconfig.lib.json", + "project": "libs/datagrid/package.json", + "entryFile": "libs/datagrid/src/index.ts", + "external": ["react/jsx-runtime"], + "rollupConfig": "@nrwl/react/plugins/bundle-rollup", + "compiler": "babel", + "assets": [ + { + "glob": "libs/datagrid/README.md", + "input": ".", + "output": "." + } + ] + } + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["libs/datagrid/**/*.{ts,tsx,js,jsx}"] + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "outputs": ["coverage/libs/datagrid"], + "options": { + "jestConfig": "libs/datagrid/jest.config.ts", + "passWithNoTests": true + } + } + } +} diff --git a/libs/datagrid/src/index.ts b/libs/datagrid/src/index.ts new file mode 100644 index 000000000..178426318 --- /dev/null +++ b/libs/datagrid/src/index.ts @@ -0,0 +1,16 @@ +export * from './lib/ag-grid/ag-grid-dynamic'; +export * from './lib/ag-grid/ag-grid-lazy'; + +export * from './lib/cells/cumulative-vol-cell'; +export * from './lib/cells/flash-cell'; +export * from './lib/cells/numeric-cell'; +export * from './lib/cells/price-cell'; +export * from './lib/cells/price-change-cell'; +export * from './lib/cells/price-flash-cell'; +export * from './lib/cells/vol-cell'; + +export * from './lib/filters/date-range-filter'; +export * from './lib/filters/set-filter'; + +export * from './lib/cell-class-rules'; +export * from './lib/type-helpers'; diff --git a/libs/ui-toolkit/src/components/ag-grid/ag-grid-dark.tsx b/libs/datagrid/src/lib/ag-grid/ag-grid-dark.tsx similarity index 100% rename from libs/ui-toolkit/src/components/ag-grid/ag-grid-dark.tsx rename to libs/datagrid/src/lib/ag-grid/ag-grid-dark.tsx diff --git a/libs/ui-toolkit/src/components/ag-grid/ag-grid-dynamic-themed.tsx b/libs/datagrid/src/lib/ag-grid/ag-grid-dynamic-themed.tsx similarity index 100% rename from libs/ui-toolkit/src/components/ag-grid/ag-grid-dynamic-themed.tsx rename to libs/datagrid/src/lib/ag-grid/ag-grid-dynamic-themed.tsx diff --git a/libs/ui-toolkit/src/components/ag-grid/ag-grid-dynamic.tsx b/libs/datagrid/src/lib/ag-grid/ag-grid-dynamic.tsx similarity index 100% rename from libs/ui-toolkit/src/components/ag-grid/ag-grid-dynamic.tsx rename to libs/datagrid/src/lib/ag-grid/ag-grid-dynamic.tsx diff --git a/libs/ui-toolkit/src/components/ag-grid/ag-grid-lazy-themed.tsx b/libs/datagrid/src/lib/ag-grid/ag-grid-lazy-themed.tsx similarity index 100% rename from libs/ui-toolkit/src/components/ag-grid/ag-grid-lazy-themed.tsx rename to libs/datagrid/src/lib/ag-grid/ag-grid-lazy-themed.tsx diff --git a/libs/ui-toolkit/src/components/ag-grid/ag-grid-lazy.tsx b/libs/datagrid/src/lib/ag-grid/ag-grid-lazy.tsx similarity index 100% rename from libs/ui-toolkit/src/components/ag-grid/ag-grid-lazy.tsx rename to libs/datagrid/src/lib/ag-grid/ag-grid-lazy.tsx diff --git a/libs/ui-toolkit/src/components/ag-grid/ag-grid-light.tsx b/libs/datagrid/src/lib/ag-grid/ag-grid-light.tsx similarity index 100% rename from libs/ui-toolkit/src/components/ag-grid/ag-grid-light.tsx rename to libs/datagrid/src/lib/ag-grid/ag-grid-light.tsx diff --git a/libs/react-helpers/src/lib/grid/cell-class-rules.ts b/libs/datagrid/src/lib/cell-class-rules.ts similarity index 100% rename from libs/react-helpers/src/lib/grid/cell-class-rules.ts rename to libs/datagrid/src/lib/cell-class-rules.ts diff --git a/libs/react-helpers/src/lib/grid/cumulative-vol-cell.tsx b/libs/datagrid/src/lib/cells/cumulative-vol-cell.tsx similarity index 97% rename from libs/react-helpers/src/lib/grid/cumulative-vol-cell.tsx rename to libs/datagrid/src/lib/cells/cumulative-vol-cell.tsx index 1a5844b2e..b5603d38a 100644 --- a/libs/react-helpers/src/lib/grid/cumulative-vol-cell.tsx +++ b/libs/datagrid/src/lib/cells/cumulative-vol-cell.tsx @@ -1,7 +1,7 @@ import { memo } from 'react'; import { BID_COLOR, ASK_COLOR } from './vol-cell'; +import { addDecimalsFormatNumber } from '@vegaprotocol/utils'; import { NumericCell } from './numeric-cell'; -import { addDecimalsFormatNumber } from '../format'; export interface CumulativeVolProps { ask?: number; diff --git a/libs/react-helpers/src/lib/grid/flash-cell.spec.tsx b/libs/datagrid/src/lib/cells/flash-cell.spec.tsx similarity index 100% rename from libs/react-helpers/src/lib/grid/flash-cell.spec.tsx rename to libs/datagrid/src/lib/cells/flash-cell.spec.tsx diff --git a/libs/react-helpers/src/lib/grid/flash-cell.stories.tsx b/libs/datagrid/src/lib/cells/flash-cell.stories.tsx similarity index 93% rename from libs/react-helpers/src/lib/grid/flash-cell.stories.tsx rename to libs/datagrid/src/lib/cells/flash-cell.stories.tsx index c0fc5dedb..a48d91900 100644 --- a/libs/react-helpers/src/lib/grid/flash-cell.stories.tsx +++ b/libs/datagrid/src/lib/cells/flash-cell.stories.tsx @@ -1,6 +1,5 @@ import { FlashCell } from './flash-cell'; import type { Meta, Story } from '@storybook/react'; -import * as React from 'react'; export default { title: 'Component/FlashCell', diff --git a/libs/react-helpers/src/lib/grid/flash-cell.tsx b/libs/datagrid/src/lib/cells/flash-cell.tsx similarity index 98% rename from libs/react-helpers/src/lib/grid/flash-cell.tsx rename to libs/datagrid/src/lib/cells/flash-cell.tsx index 27b4ffd32..b28e02e6a 100644 --- a/libs/react-helpers/src/lib/grid/flash-cell.tsx +++ b/libs/datagrid/src/lib/cells/flash-cell.tsx @@ -10,7 +10,7 @@ import { memo, useRef, useEffect } from 'react'; import { theme } from '@vegaprotocol/tailwindcss-config'; -import { splitAt } from '../format'; +import { splitAt } from '@vegaprotocol/utils'; const FLASH_DURATION = 800; // Duration of flash animation in milliseconds diff --git a/libs/react-helpers/src/lib/grid/numeric-cell.spec.tsx b/libs/datagrid/src/lib/cells/numeric-cell.spec.tsx similarity index 100% rename from libs/react-helpers/src/lib/grid/numeric-cell.spec.tsx rename to libs/datagrid/src/lib/cells/numeric-cell.spec.tsx diff --git a/libs/react-helpers/src/lib/grid/numeric-cell.tsx b/libs/datagrid/src/lib/cells/numeric-cell.tsx similarity index 94% rename from libs/react-helpers/src/lib/grid/numeric-cell.tsx rename to libs/datagrid/src/lib/cells/numeric-cell.tsx index 16b4ef44b..0164cea8c 100644 --- a/libs/react-helpers/src/lib/grid/numeric-cell.tsx +++ b/libs/datagrid/src/lib/cells/numeric-cell.tsx @@ -1,5 +1,5 @@ import { forwardRef } from 'react'; -import { getDecimalSeparator, isNumeric } from '../format'; +import { getDecimalSeparator, isNumeric } from '@vegaprotocol/utils'; interface NumericCellProps { value: number | bigint | null | undefined; diff --git a/libs/react-helpers/src/lib/grid/price-cell.spec.tsx b/libs/datagrid/src/lib/cells/price-cell.spec.tsx similarity index 100% rename from libs/react-helpers/src/lib/grid/price-cell.spec.tsx rename to libs/datagrid/src/lib/cells/price-cell.spec.tsx diff --git a/libs/react-helpers/src/lib/grid/price-cell.tsx b/libs/datagrid/src/lib/cells/price-cell.tsx similarity index 95% rename from libs/react-helpers/src/lib/grid/price-cell.tsx rename to libs/datagrid/src/lib/cells/price-cell.tsx index 823c6c014..56a5d772b 100644 --- a/libs/react-helpers/src/lib/grid/price-cell.tsx +++ b/libs/datagrid/src/lib/cells/price-cell.tsx @@ -1,5 +1,5 @@ import { memo, forwardRef } from 'react'; -import { isNumeric } from '../format'; +import { isNumeric } from '@vegaprotocol/utils'; import { NumericCell } from './numeric-cell'; export interface IPriceCellProps { value: number | bigint | null | undefined; diff --git a/libs/ui-toolkit/src/components/price-change/price-change-cell.spec.tsx b/libs/datagrid/src/lib/cells/price-change-cell.spec.tsx similarity index 81% rename from libs/ui-toolkit/src/components/price-change/price-change-cell.spec.tsx rename to libs/datagrid/src/lib/cells/price-change-cell.spec.tsx index 04c08e679..8122a59e3 100644 --- a/libs/ui-toolkit/src/components/price-change/price-change-cell.spec.tsx +++ b/libs/datagrid/src/lib/cells/price-change-cell.spec.tsx @@ -1,10 +1,10 @@ import { render, screen } from '@testing-library/react'; -import { PriceCellChange } from '..'; +import { PriceChangeCell } from './price-change-cell'; describe('PriceChangeCell', () => { it('renders correctly and calculates the price change', () => { render( - @@ -14,7 +14,7 @@ describe('PriceChangeCell', () => { }); it('renders correctly and calculates the price change without decimals', () => { - render(); + render(); expect(screen.getByText('-48.51%')).toBeInTheDocument(); expect(screen.getByText('-22,100.00')).toBeInTheDocument(); }); diff --git a/libs/ui-toolkit/src/components/price-change/price-change-cell.tsx b/libs/datagrid/src/lib/cells/price-change-cell.tsx similarity index 89% rename from libs/ui-toolkit/src/components/price-change/price-change-cell.tsx rename to libs/datagrid/src/lib/cells/price-change-cell.tsx index dbda4080b..2d6d21556 100644 --- a/libs/ui-toolkit/src/components/price-change/price-change-cell.tsx +++ b/libs/datagrid/src/lib/cells/price-change-cell.tsx @@ -1,11 +1,11 @@ import { addDecimalsFormatNumber, formatNumberPercentage, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import BigNumber from 'bignumber.js'; import { memo, forwardRef } from 'react'; -import { signedNumberCssClass } from '@vegaprotocol/react-helpers'; -import { Arrow } from '../arrows/arrow'; +import { Arrow } from '@vegaprotocol/ui-toolkit'; +import { signedNumberCssClass } from '../cell-class-rules'; export interface PriceChangeCellProps { /** either candle `close`or `open` values to be filtered and used here in order to calculate the price change */ @@ -36,7 +36,7 @@ export const priceChange = (candles: string[]) => { : 0; }; -export const PriceCellChange = memo( +export const PriceChangeCell = memo( forwardRef( ({ candles, decimalPlaces }: PriceChangeCellProps, ref) => { const change = priceChange(candles); @@ -65,4 +65,4 @@ export const PriceCellChange = memo( ) ); -PriceCellChange.displayName = 'PriceCellChange'; +PriceChangeCell.displayName = 'PriceChangeCell'; diff --git a/libs/react-helpers/src/lib/grid/price-flash-cell.spec.tsx b/libs/datagrid/src/lib/cells/price-flash-cell.spec.tsx similarity index 100% rename from libs/react-helpers/src/lib/grid/price-flash-cell.spec.tsx rename to libs/datagrid/src/lib/cells/price-flash-cell.spec.tsx diff --git a/libs/react-helpers/src/lib/grid/price-flash-cell.tsx b/libs/datagrid/src/lib/cells/price-flash-cell.tsx similarity index 100% rename from libs/react-helpers/src/lib/grid/price-flash-cell.tsx rename to libs/datagrid/src/lib/cells/price-flash-cell.tsx diff --git a/libs/react-helpers/src/lib/grid/vol-cell.spec.tsx b/libs/datagrid/src/lib/cells/vol-cell.spec.tsx similarity index 89% rename from libs/react-helpers/src/lib/grid/vol-cell.spec.tsx rename to libs/datagrid/src/lib/cells/vol-cell.spec.tsx index 9c3965c77..5c31dd44d 100644 --- a/libs/react-helpers/src/lib/grid/vol-cell.spec.tsx +++ b/libs/datagrid/src/lib/cells/vol-cell.spec.tsx @@ -1,5 +1,5 @@ import { render, screen } from '@testing-library/react'; -import { VolCell, VolumeType } from './vol-cell'; +import { VolCell } from './vol-cell'; import * as tailwind from '@vegaprotocol/tailwindcss-config'; describe('VolCell', () => { @@ -8,7 +8,7 @@ describe('VolCell', () => { const props = { value: 1234567, valueFormatted: `${significantPart}.${decimalPart}`, - type: VolumeType.ask, + type: 'ask' as const, testId: 'cell', }; @@ -32,7 +32,7 @@ describe('VolCell', () => { }); it('renders bid volume bar', () => { - render(); + render(); expect(screen.getByTestId('vol-bar')).toHaveClass('left-0'); // renders bid bars from the left expect(screen.getByTestId('vol-bar')).toHaveStyle({ backgroundColor: tailwind.theme.colors.vega.green.DEFAULT, @@ -40,7 +40,7 @@ describe('VolCell', () => { }); it('renders ask volume bar', () => { - render(); + render(); expect(screen.getByTestId('vol-bar')).toHaveClass('right-0'); // renders ask bars from the right expect(screen.getByTestId('vol-bar')).toHaveStyle({ backgroundColor: tailwind.theme.colors.vega.pink.DEFAULT, diff --git a/libs/react-helpers/src/lib/grid/vol-cell.tsx b/libs/datagrid/src/lib/cells/vol-cell.tsx similarity index 67% rename from libs/react-helpers/src/lib/grid/vol-cell.tsx rename to libs/datagrid/src/lib/cells/vol-cell.tsx index 6bdd8a54c..9de4e8a68 100644 --- a/libs/react-helpers/src/lib/grid/vol-cell.tsx +++ b/libs/datagrid/src/lib/cells/vol-cell.tsx @@ -1,18 +1,14 @@ -import React from 'react'; +import { memo } from 'react'; import type { ICellRendererParams } from 'ag-grid-community'; import classNames from 'classnames'; -import * as tailwind from '@vegaprotocol/tailwindcss-config'; +import { theme } from '@vegaprotocol/tailwindcss-config'; import { NumericCell } from './numeric-cell'; -export enum VolumeType { - bid, - ask, -} export interface VolCellProps { value: number | bigint | null | undefined; valueFormatted: string; relativeValue?: number; - type: VolumeType; + type: 'ask' | 'bid'; testId?: string; } export interface IVolCellProps extends ICellRendererParams { @@ -20,10 +16,10 @@ export interface IVolCellProps extends ICellRendererParams { valueFormatted: Omit; } -export const BID_COLOR = tailwind.theme.colors.vega.green.DEFAULT; -export const ASK_COLOR = tailwind.theme.colors.vega.pink.DEFAULT; +export const BID_COLOR = theme.colors.vega.green.DEFAULT; +export const ASK_COLOR = theme.colors.vega.pink.DEFAULT; -export const VolCell = React.memo( +export const VolCell = memo( ({ value, valueFormatted, relativeValue, type, testId }: VolCellProps) => { if ((!value && value !== 0) || isNaN(Number(value))) { return
-
; @@ -35,14 +31,14 @@ export const VolCell = React.memo( className={classNames( 'h-full absolute top-0 opacity-40 dark:opacity-100', { - 'left-0': type === VolumeType.bid, - 'right-0': type === VolumeType.ask, + 'left-0': type === 'bid', + 'right-0': type === 'ask', } )} style={{ width: relativeValue ? `${relativeValue}%` : '0%', - backgroundColor: type === VolumeType.bid ? BID_COLOR : ASK_COLOR, - opacity: type === VolumeType.bid ? 0.6 : 0.6, + backgroundColor: type === 'bid' ? BID_COLOR : ASK_COLOR, + opacity: 0.6, }} /> diff --git a/libs/react-helpers/src/lib/grid/date-range-filter.spec.tsx b/libs/datagrid/src/lib/filters/date-range-filter.spec.tsx similarity index 100% rename from libs/react-helpers/src/lib/grid/date-range-filter.spec.tsx rename to libs/datagrid/src/lib/filters/date-range-filter.spec.tsx diff --git a/libs/react-helpers/src/lib/grid/date-range-filter.tsx b/libs/datagrid/src/lib/filters/date-range-filter.tsx similarity index 96% rename from libs/react-helpers/src/lib/grid/date-range-filter.tsx rename to libs/datagrid/src/lib/filters/date-range-filter.tsx index 7c389f91e..fb1b96c67 100644 --- a/libs/react-helpers/src/lib/grid/date-range-filter.tsx +++ b/libs/datagrid/src/lib/filters/date-range-filter.tsx @@ -13,8 +13,9 @@ import { max, isValid, } from 'date-fns'; -import { t } from '../i18n'; -import { formatForInput } from '../format/date'; +import { formatForInput } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; +import { InputError } from '@vegaprotocol/ui-toolkit'; const defaultFilterValue: Schema.DateRange = {}; export interface DateRangeFilterProps extends IFilterParams { @@ -195,14 +196,7 @@ export const DateRangeFilter = forwardRef( }, [value, props]); const notification = useMemo(() => { - const not = error ? ( -
- {error} -
- ) : null; + const not = error ? {error} : null; return (
{not}
); diff --git a/libs/react-helpers/src/lib/grid/set-filter.tsx b/libs/datagrid/src/lib/filters/set-filter.tsx similarity index 94% rename from libs/react-helpers/src/lib/grid/set-filter.tsx rename to libs/datagrid/src/lib/filters/set-filter.tsx index a37d0dff3..c3dbc0d58 100644 --- a/libs/react-helpers/src/lib/grid/set-filter.tsx +++ b/libs/datagrid/src/lib/filters/set-filter.tsx @@ -1,12 +1,7 @@ import type { ChangeEvent } from 'react'; -import React, { - forwardRef, - useEffect, - useImperativeHandle, - useState, -} from 'react'; +import { forwardRef, useEffect, useImperativeHandle, useState } from 'react'; import type { IDoesFilterPassParams, IFilterParams } from 'ag-grid-community'; -import { t } from '../i18n'; +import { t } from '@vegaprotocol/i18n'; export const SetFilter = forwardRef((props: IFilterParams, ref) => { const [value, setValue] = useState([]); diff --git a/libs/ui-toolkit/src/components/ag-grid/index.tsx b/libs/datagrid/src/lib/type-helpers.ts similarity index 94% rename from libs/ui-toolkit/src/components/ag-grid/index.tsx rename to libs/datagrid/src/lib/type-helpers.ts index 8352ec599..f4becc173 100644 --- a/libs/ui-toolkit/src/components/ag-grid/index.tsx +++ b/libs/datagrid/src/lib/type-helpers.ts @@ -4,13 +4,9 @@ import type { ValueFormatterParams, ValueGetterParams, } from 'ag-grid-community'; - import type { IDatasource, IGetRowsParams } from 'ag-grid-community'; import type { AgGridReactProps } from 'ag-grid-react'; -export * from './ag-grid-lazy'; -export * from './ag-grid-dynamic'; - type Field = string | readonly string[]; type RowHelper = Omit< diff --git a/libs/governance/src/setup-tests.ts b/libs/datagrid/src/setup-tests.ts similarity index 100% rename from libs/governance/src/setup-tests.ts rename to libs/datagrid/src/setup-tests.ts diff --git a/libs/datagrid/tsconfig.json b/libs/datagrid/tsconfig.json new file mode 100644 index 000000000..4c089585e --- /dev/null +++ b/libs/datagrid/tsconfig.json @@ -0,0 +1,25 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "jsx": "react-jsx", + "allowJs": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/libs/datagrid/tsconfig.lib.json b/libs/datagrid/tsconfig.lib.json new file mode 100644 index 000000000..af84f21cf --- /dev/null +++ b/libs/datagrid/tsconfig.lib.json @@ -0,0 +1,23 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "types": ["node"] + }, + "files": [ + "../../node_modules/@nrwl/react/typings/cssmodule.d.ts", + "../../node_modules/@nrwl/react/typings/image.d.ts" + ], + "exclude": [ + "jest.config.ts", + "**/*.spec.ts", + "**/*.test.ts", + "**/*.spec.tsx", + "**/*.test.tsx", + "**/*.spec.js", + "**/*.test.js", + "**/*.spec.jsx", + "**/*.test.jsx" + ], + "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"] +} diff --git a/libs/datagrid/tsconfig.spec.json b/libs/datagrid/tsconfig.spec.json new file mode 100644 index 000000000..cdb57bc25 --- /dev/null +++ b/libs/datagrid/tsconfig.spec.json @@ -0,0 +1,20 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node", "@testing-library/jest-dom"] + }, + "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/deal-ticket/src/components/deal-ticket-estimates.tsx b/libs/deal-ticket/src/components/deal-ticket-estimates.tsx index a0cfd969c..1df6b7834 100644 --- a/libs/deal-ticket/src/components/deal-ticket-estimates.tsx +++ b/libs/deal-ticket/src/components/deal-ticket-estimates.tsx @@ -1,6 +1,6 @@ import React from 'react'; import type { ReactNode } from 'react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Icon, Tooltip, TrafficLight } from '@vegaprotocol/ui-toolkit'; import { IconNames } from '@blueprintjs/icons'; import * as constants from '../constants'; diff --git a/libs/deal-ticket/src/components/deal-ticket-validation/margin-warning.tsx b/libs/deal-ticket/src/components/deal-ticket-validation/margin-warning.tsx index 260b4290a..774c7de40 100644 --- a/libs/deal-ticket/src/components/deal-ticket-validation/margin-warning.tsx +++ b/libs/deal-ticket/src/components/deal-ticket-validation/margin-warning.tsx @@ -1,4 +1,5 @@ -import { formatNumber, t } from '@vegaprotocol/react-helpers'; +import { formatNumber } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { Notification, Intent } from '@vegaprotocol/ui-toolkit'; import { DepositDialog, useDepositDialog } from '@vegaprotocol/deposits'; diff --git a/libs/deal-ticket/src/components/deal-ticket-validation/zero-balance-error.tsx b/libs/deal-ticket/src/components/deal-ticket-validation/zero-balance-error.tsx index d89e9b0fa..6a4c83eec 100644 --- a/libs/deal-ticket/src/components/deal-ticket-validation/zero-balance-error.tsx +++ b/libs/deal-ticket/src/components/deal-ticket-validation/zero-balance-error.tsx @@ -1,6 +1,6 @@ import { Intent, Notification, Link } from '@vegaprotocol/ui-toolkit'; import { useDepositDialog } from '@vegaprotocol/deposits'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; interface ZeroBalanceErrorProps { asset: { diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-button.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-button.tsx index 1eae3d5a6..a7e84fcfa 100644 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-button.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-button.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { ButtonVariant } from '@vegaprotocol/ui-toolkit'; import { Button } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet } from '@vegaprotocol/wallet'; 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 5f9b384a5..c7db7eca1 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,6 +1,6 @@ import { useMemo } from 'react'; import { AsyncRenderer, Splash } from '@vegaprotocol/ui-toolkit'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { useThrottledDataProvider } from '@vegaprotocol/react-helpers'; import { useVegaTransactionStore } from '@vegaprotocol/wallet'; import { useMarket, marketDataProvider } from '@vegaprotocol/market-list'; diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-limit-amount.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-limit-amount.tsx index 31136e5c2..a2946dc2f 100644 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-limit-amount.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-limit-amount.tsx @@ -1,5 +1,6 @@ import { FormGroup, Input, InputError } from '@vegaprotocol/ui-toolkit'; -import { t, toDecimal, validateAmount } from '@vegaprotocol/react-helpers'; +import { toDecimal, validateAmount } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import type { DealTicketAmountProps } from './deal-ticket-amount'; export type DealTicketLimitAmountProps = Omit< diff --git a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-market-amount.tsx b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-market-amount.tsx index c4371d213..86ca473e0 100644 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket-market-amount.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket-market-amount.tsx @@ -1,9 +1,9 @@ import { addDecimalsFormatNumber, - t, toDecimal, validateAmount, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { Input, InputError, Tooltip } from '@vegaprotocol/ui-toolkit'; import { isMarketInAuction } from '../../utils'; import type { DealTicketAmountProps } from './deal-ticket-amount'; 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 b0fe2483b..6ef4e3eb4 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 @@ -8,7 +8,8 @@ import type { OrderSubmissionBody } from '@vegaprotocol/wallet'; import type { MockedResponse } from '@apollo/client/testing'; import { MockedProvider } from '@apollo/client/testing'; import type { ChainIdQuery } from '@vegaprotocol/react-helpers'; -import { ChainIdDocument, addDecimal } from '@vegaprotocol/react-helpers'; +import { ChainIdDocument } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; const market = generateMarket(); const marketData = generateMarketData(); 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 0b0aaefa0..a71611c53 100644 --- a/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/deal-ticket.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import * as Schema from '@vegaprotocol/types'; import { memo, useCallback, useEffect } from 'react'; import { Controller, useForm } from 'react-hook-form'; diff --git a/libs/deal-ticket/src/components/deal-ticket/expiry-selector.tsx b/libs/deal-ticket/src/components/deal-ticket/expiry-selector.tsx index 921812fce..0ab9972dd 100644 --- a/libs/deal-ticket/src/components/deal-ticket/expiry-selector.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/expiry-selector.tsx @@ -1,6 +1,6 @@ import { FormGroup, Input, InputError } from '@vegaprotocol/ui-toolkit'; -import { formatForInput } from '@vegaprotocol/react-helpers'; -import { t } from '@vegaprotocol/react-helpers'; +import { formatForInput } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import type { UseFormRegister } from 'react-hook-form'; import { validateExpiration } from '../../utils/validate-expiration'; import type { DealTicketFormFields } from '.'; diff --git a/libs/deal-ticket/src/components/deal-ticket/market-selector.tsx b/libs/deal-ticket/src/components/deal-ticket/market-selector.tsx index 74b2031e8..a6d3ad8a4 100644 --- a/libs/deal-ticket/src/components/deal-ticket/market-selector.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/market-selector.tsx @@ -16,11 +16,11 @@ import { Splash, } from '@vegaprotocol/ui-toolkit'; import { - t, useScreenDimensions, useOutsideClick, useDataProvider, } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { IconNames } from '@blueprintjs/icons'; import * as Schema from '@vegaprotocol/types'; import type { Market } from '@vegaprotocol/market-list'; diff --git a/libs/deal-ticket/src/components/deal-ticket/side-selector.tsx b/libs/deal-ticket/src/components/deal-ticket/side-selector.tsx index 20faa544d..08a636972 100644 --- a/libs/deal-ticket/src/components/deal-ticket/side-selector.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/side-selector.tsx @@ -1,6 +1,6 @@ import { FormGroup } from '@vegaprotocol/ui-toolkit'; import { Toggle } from '@vegaprotocol/ui-toolkit'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import * as Schema from '@vegaprotocol/types'; interface SideSelectorProps { diff --git a/libs/deal-ticket/src/components/deal-ticket/time-in-force-selector.tsx b/libs/deal-ticket/src/components/deal-ticket/time-in-force-selector.tsx index 9eb0ef2b2..5cd343907 100644 --- a/libs/deal-ticket/src/components/deal-ticket/time-in-force-selector.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/time-in-force-selector.tsx @@ -4,9 +4,10 @@ import { InputError, Select, Tooltip, + SimpleGrid, } from '@vegaprotocol/ui-toolkit'; import * as Schema from '@vegaprotocol/types'; -import { DataGrid, t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { timeInForceLabel } from '@vegaprotocol/orders'; import { compileGridData } from '../trading-mode-tooltip'; import { MarketModeValidationType } from '../../constants'; @@ -82,7 +83,7 @@ export const TimeInForceSelector = ({ {t('This market is in auction until it reaches')}{' '} + } > {t('sufficient liquidity')} @@ -101,7 +102,7 @@ export const TimeInForceSelector = ({ {t('This market is in auction due to')}{' '} + } > {t('high price volatility')} diff --git a/libs/deal-ticket/src/components/deal-ticket/type-selector.tsx b/libs/deal-ticket/src/components/deal-ticket/type-selector.tsx index f2b1cacb7..e17dc2f72 100644 --- a/libs/deal-ticket/src/components/deal-ticket/type-selector.tsx +++ b/libs/deal-ticket/src/components/deal-ticket/type-selector.tsx @@ -1,5 +1,10 @@ -import { FormGroup, InputError, Tooltip } from '@vegaprotocol/ui-toolkit'; -import { DataGrid, t } from '@vegaprotocol/react-helpers'; +import { + FormGroup, + InputError, + SimpleGrid, + Tooltip, +} from '@vegaprotocol/ui-toolkit'; +import { t } from '@vegaprotocol/i18n'; import * as Schema from '@vegaprotocol/types'; import { Toggle } from '@vegaprotocol/ui-toolkit'; import type { Market, MarketData } from '@vegaprotocol/market-list'; @@ -37,7 +42,7 @@ export const TypeSelector = ({ {t('This market is in auction until it reaches')}{' '} + } > {t('sufficient liquidity')} @@ -54,7 +59,7 @@ export const TypeSelector = ({ {t('This market is in auction due to')}{' '} + } > {t('high price volatility')} 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 2851163fe..f91891fbf 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 @@ -1,11 +1,11 @@ -import type { DataGridProps } from '@vegaprotocol/react-helpers'; import { - t, getDateTimeFormat, addDecimalsFormatNumber, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import * as Schema from '@vegaprotocol/types'; import { Link as UILink } from '@vegaprotocol/ui-toolkit'; +import type { SimpleGridProps } from '@vegaprotocol/ui-toolkit'; import type { ReactNode } from 'react'; import { Link } from 'react-router-dom'; import type { Market, MarketData } from '@vegaprotocol/market-list'; @@ -28,7 +28,7 @@ export const compileGridData = ( > | null, onSelect?: (id: string) => void ): { label: ReactNode; value?: ReactNode }[] => { - const grid: DataGridProps['grid'] = []; + const grid: SimpleGridProps['grid'] = []; const isLiquidityMonitoringAuction = marketData?.marketTradingMode === Schema.MarketTradingMode.TRADING_MODE_MONITORING_AUCTION && diff --git a/libs/deal-ticket/src/components/trading-mode-tooltip/trading-mode-tooltip.tsx b/libs/deal-ticket/src/components/trading-mode-tooltip/trading-mode-tooltip.tsx index 349f548e9..316c64660 100644 --- a/libs/deal-ticket/src/components/trading-mode-tooltip/trading-mode-tooltip.tsx +++ b/libs/deal-ticket/src/components/trading-mode-tooltip/trading-mode-tooltip.tsx @@ -1,12 +1,12 @@ import { useMemo } from 'react'; import { parseISO, isValid, isAfter } from 'date-fns'; import classNames from 'classnames'; -import { useProposalOfMarketQuery } from '@vegaprotocol/governance'; +import { useProposalOfMarketQuery } from '@vegaprotocol/proposals'; import { useEnvironment } from '@vegaprotocol/environment'; -import { DataGrid, getDateTimeFormat, t } from '@vegaprotocol/react-helpers'; +import { createDocsLinks, getDateTimeFormat } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import * as Schema from '@vegaprotocol/types'; -import { ExternalLink } from '@vegaprotocol/ui-toolkit'; -import { createDocsLinks } from '@vegaprotocol/react-helpers'; +import { ExternalLink, SimpleGrid } from '@vegaprotocol/ui-toolkit'; import { compileGridData } from './compile-grid-data'; import { useMarket, useStaticMarketData } from '@vegaprotocol/market-list'; import BigNumber from 'bignumber.js'; @@ -109,7 +109,7 @@ export const TradingModeTooltip = ({ )}

- {compiledGrid && } + {compiledGrid && } ); } @@ -143,7 +143,7 @@ export const TradingModeTooltip = ({ )}

- {compiledGrid && } + {compiledGrid && } ); } @@ -165,7 +165,7 @@ export const TradingModeTooltip = ({ )}

- {compiledGrid && } + {compiledGrid && } ); } diff --git a/libs/deal-ticket/src/constants.ts b/libs/deal-ticket/src/constants.ts index 9af0dbd77..61095fda3 100644 --- a/libs/deal-ticket/src/constants.ts +++ b/libs/deal-ticket/src/constants.ts @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; export const EST_MARGIN_TOOLTIP_TEXT = (settlementAsset: string) => t( diff --git a/libs/deal-ticket/src/hooks/use-calculate-slippage.ts b/libs/deal-ticket/src/hooks/use-calculate-slippage.ts index 225ca5232..e9d154013 100644 --- a/libs/deal-ticket/src/hooks/use-calculate-slippage.ts +++ b/libs/deal-ticket/src/hooks/use-calculate-slippage.ts @@ -4,11 +4,8 @@ import * as Schema from '@vegaprotocol/types'; import type { Market } from '@vegaprotocol/market-list'; import type { OrderSubmissionBody } from '@vegaprotocol/wallet'; import { BigNumber } from 'bignumber.js'; -import { - formatNumber, - toBigNum, - useThrottledDataProvider, -} from '@vegaprotocol/react-helpers'; +import { formatNumber, toBigNum } from '@vegaprotocol/utils'; +import { useThrottledDataProvider } from '@vegaprotocol/react-helpers'; interface Props { market: Market; 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 e2e561402..6fa925ffa 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 @@ -3,8 +3,8 @@ import { addDecimal, addDecimalsFormatNumber, formatNumber, - t, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import * as Schema from '@vegaprotocol/types'; import { useVegaWallet } from '@vegaprotocol/wallet'; import BigNumber from 'bignumber.js'; diff --git a/libs/deal-ticket/src/hooks/use-has-no-balance.tsx b/libs/deal-ticket/src/hooks/use-has-no-balance.tsx index d95bc024d..d0a81914c 100644 --- a/libs/deal-ticket/src/hooks/use-has-no-balance.tsx +++ b/libs/deal-ticket/src/hooks/use-has-no-balance.tsx @@ -1,5 +1,5 @@ import { useAccountBalance } from '@vegaprotocol/accounts'; -import { toBigNum } from '@vegaprotocol/react-helpers'; +import { toBigNum } from '@vegaprotocol/utils'; export const useHasNoBalance = (assetId: string) => { const { accountBalance, accountDecimals } = useAccountBalance(assetId); diff --git a/libs/deal-ticket/src/hooks/use-order-closeout.ts b/libs/deal-ticket/src/hooks/use-order-closeout.ts index e1469f103..e061693d0 100644 --- a/libs/deal-ticket/src/hooks/use-order-closeout.ts +++ b/libs/deal-ticket/src/hooks/use-order-closeout.ts @@ -1,6 +1,6 @@ import { BigNumber } from 'bignumber.js'; import type { OrderSubmissionBody } from '@vegaprotocol/wallet'; -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import type { Market, MarketData } from '@vegaprotocol/market-list'; import { diff --git a/libs/deal-ticket/src/hooks/use-order-margin-validation.ts b/libs/deal-ticket/src/hooks/use-order-margin-validation.ts index f44b308c6..5138ad3c4 100644 --- a/libs/deal-ticket/src/hooks/use-order-margin-validation.ts +++ b/libs/deal-ticket/src/hooks/use-order-margin-validation.ts @@ -1,6 +1,6 @@ import { useMemo } from 'react'; import { useVegaWallet } from '@vegaprotocol/wallet'; -import { toBigNum } from '@vegaprotocol/react-helpers'; +import { toBigNum } from '@vegaprotocol/utils'; import { useAccountBalance } from '@vegaprotocol/accounts'; import type { OrderSubmissionBody } from '@vegaprotocol/wallet'; import { useOrderMargin } from './use-order-margin'; diff --git a/libs/deal-ticket/src/hooks/use-order-margin.ts b/libs/deal-ticket/src/hooks/use-order-margin.ts index c13cc8de9..7797f19c3 100644 --- a/libs/deal-ticket/src/hooks/use-order-margin.ts +++ b/libs/deal-ticket/src/hooks/use-order-margin.ts @@ -1,7 +1,7 @@ import { useMemo } from 'react'; import { BigNumber } from 'bignumber.js'; import type { OrderSubmissionBody } from '@vegaprotocol/wallet'; -import { removeDecimal } from '@vegaprotocol/react-helpers'; +import { removeDecimal } from '@vegaprotocol/utils'; import { useMarketPositions } from './use-market-positions'; import { useEstimateOrderQuery } from './__generated__/EstimateOrder'; import type { Market, MarketData } from '@vegaprotocol/market-list'; diff --git a/libs/deal-ticket/src/utils/get-default-order.ts b/libs/deal-ticket/src/utils/get-default-order.ts index aeb1b2b37..73956ba9a 100644 --- a/libs/deal-ticket/src/utils/get-default-order.ts +++ b/libs/deal-ticket/src/utils/get-default-order.ts @@ -1,4 +1,4 @@ -import { toDecimal } from '@vegaprotocol/react-helpers'; +import { toDecimal } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import type { OrderSubmissionBody } from '@vegaprotocol/wallet'; diff --git a/libs/deal-ticket/src/utils/get-price.ts b/libs/deal-ticket/src/utils/get-price.ts index 1e661e2a6..ea97c7d27 100644 --- a/libs/deal-ticket/src/utils/get-price.ts +++ b/libs/deal-ticket/src/utils/get-price.ts @@ -1,4 +1,4 @@ -import { removeDecimal } from '@vegaprotocol/react-helpers'; +import { removeDecimal } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import { isMarketInAuction } from './is-market-in-auction'; import type { MarketData, Market } from '@vegaprotocol/market-list'; diff --git a/libs/deal-ticket/src/utils/validate-expiration.ts b/libs/deal-ticket/src/utils/validate-expiration.ts index 3797792f3..294816960 100644 --- a/libs/deal-ticket/src/utils/validate-expiration.ts +++ b/libs/deal-ticket/src/utils/validate-expiration.ts @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { Validate } from 'react-hook-form'; export const validateExpiration: Validate = ( diff --git a/libs/deal-ticket/src/utils/validate-market-state.ts b/libs/deal-ticket/src/utils/validate-market-state.ts index b5a13c6be..0208ab973 100644 --- a/libs/deal-ticket/src/utils/validate-market-state.ts +++ b/libs/deal-ticket/src/utils/validate-market-state.ts @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import * as Schema from '@vegaprotocol/types'; export const validateMarketState = (state: Schema.MarketState) => { diff --git a/libs/deal-ticket/src/utils/validate-market-trading-mode.ts b/libs/deal-ticket/src/utils/validate-market-trading-mode.ts index e0f3f3b07..687de02d0 100644 --- a/libs/deal-ticket/src/utils/validate-market-trading-mode.ts +++ b/libs/deal-ticket/src/utils/validate-market-trading-mode.ts @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import * as Schema from '@vegaprotocol/types'; export const validateMarketTradingMode = ( diff --git a/libs/deposits/src/lib/deposit-container.tsx b/libs/deposits/src/lib/deposit-container.tsx index 58743be2a..ea1b2ea85 100644 --- a/libs/deposits/src/lib/deposit-container.tsx +++ b/libs/deposits/src/lib/deposit-container.tsx @@ -1,7 +1,8 @@ import { Networks, useEnvironment } from '@vegaprotocol/environment'; import { AsyncRenderer, Splash } from '@vegaprotocol/ui-toolkit'; import { DepositManager } from './deposit-manager'; -import { t, useDataProvider } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; +import { useDataProvider } from '@vegaprotocol/react-helpers'; import { enabledAssetsProvider } from '@vegaprotocol/assets'; import type { DepositDialogStylePropsSetter } from './deposit-dialog'; diff --git a/libs/deposits/src/lib/deposit-dialog.tsx b/libs/deposits/src/lib/deposit-dialog.tsx index 58e9aa4d7..a73f56c0d 100644 --- a/libs/deposits/src/lib/deposit-dialog.tsx +++ b/libs/deposits/src/lib/deposit-dialog.tsx @@ -1,5 +1,5 @@ import { create } from 'zustand'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { Intent } from '@vegaprotocol/ui-toolkit'; import { Dialog } from '@vegaprotocol/ui-toolkit'; import { useCallback, useState } from 'react'; diff --git a/libs/deposits/src/lib/deposit-form.tsx b/libs/deposits/src/lib/deposit-form.tsx index 2df087e12..577015263 100644 --- a/libs/deposits/src/lib/deposit-form.tsx +++ b/libs/deposits/src/lib/deposit-form.tsx @@ -1,16 +1,16 @@ import type { Asset } from '@vegaprotocol/assets'; import { AssetOption } from '@vegaprotocol/assets'; import { - t, ethereumAddress, required, vegaPublicKey, minSafe, maxSafe, addDecimal, - useLocalStorage, isAssetTypeERC20, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; +import { useLocalStorage } from '@vegaprotocol/react-helpers'; import { Button, FormGroup, diff --git a/libs/deposits/src/lib/deposit-limits.tsx b/libs/deposits/src/lib/deposit-limits.tsx index cb2a3ea62..8cf74c020 100644 --- a/libs/deposits/src/lib/deposit-limits.tsx +++ b/libs/deposits/src/lib/deposit-limits.tsx @@ -1,5 +1,6 @@ import type { Asset } from '@vegaprotocol/assets'; -import { compactNumber, t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; +import { CompactNumber } from '@vegaprotocol/react-helpers'; import { KeyValueTable, KeyValueTableRow } from '@vegaprotocol/ui-toolkit'; import type BigNumber from 'bignumber.js'; @@ -26,31 +27,44 @@ export const DepositLimits = ({ key: 'BALANCE_AVAILABLE', label: t('Balance available'), rawValue: balance, - value: balance ? compactNumber(balance, asset.decimals) : '-', + value: balance ? ( + + ) : ( + '-' + ), }, { key: 'MAX_LIMIT', label: t('Maximum total deposit amount'), rawValue: max, - value: compactNumber(max, asset.decimals), + value: , }, { key: 'DEPOSITED', label: t('Deposited'), rawValue: deposited, - value: compactNumber(deposited, asset.decimals), + value: , }, { key: 'REMAINING', label: t('Remaining'), rawValue: max.minus(deposited), - value: compactNumber(max.minus(deposited), asset.decimals), + value: ( + + ), }, { key: 'ALLOWANCE', label: t('Approved'), rawValue: allowance, - value: allowance ? compactNumber(allowance, asset.decimals) : '-', + value: allowance ? ( + + ) : ( + '-' + ), }, ]; diff --git a/libs/deposits/src/lib/deposit-manager.tsx b/libs/deposits/src/lib/deposit-manager.tsx index 6a3fde583..b57f9c6ca 100644 --- a/libs/deposits/src/lib/deposit-manager.tsx +++ b/libs/deposits/src/lib/deposit-manager.tsx @@ -1,6 +1,6 @@ import { DepositForm } from './deposit-form'; import type { DepositFormProps } from './deposit-form'; -import { removeDecimal } from '@vegaprotocol/react-helpers'; +import { removeDecimal } from '@vegaprotocol/utils'; import { prepend0x } from '@vegaprotocol/smart-contracts'; import sortBy from 'lodash/sortBy'; import { useSubmitApproval } from './use-submit-approval'; @@ -18,7 +18,7 @@ import { useBridgeContract, useEthereumConfig, } from '@vegaprotocol/web3'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; interface DepositManagerProps { assetId?: string; diff --git a/libs/deposits/src/lib/deposits-provider.ts b/libs/deposits/src/lib/deposits-provider.ts index 3d9c4595c..216ac4aed 100644 --- a/libs/deposits/src/lib/deposits-provider.ts +++ b/libs/deposits/src/lib/deposits-provider.ts @@ -4,7 +4,7 @@ import { getEvents, makeDataProvider, removePaginationWrapper, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import { DepositsDocument, diff --git a/libs/deposits/src/lib/deposits-table.tsx b/libs/deposits/src/lib/deposits-table.tsx index b50f4f427..2145f30f6 100644 --- a/libs/deposits/src/lib/deposits-table.tsx +++ b/libs/deposits/src/lib/deposits-table.tsx @@ -1,19 +1,20 @@ import { forwardRef } from 'react'; import { AgGridColumn } from 'ag-grid-react'; import { - t, addDecimalsFormatNumber, getDateTimeFormat, truncateByChars, isNumeric, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; +import type { AgGridReact } from 'ag-grid-react'; +import { Link } from '@vegaprotocol/ui-toolkit'; +import { AgGridDynamic as AgGrid } from '@vegaprotocol/datagrid'; import type { VegaICellRendererParams, VegaValueFormatterParams, TypedDataAgGrid, -} from '@vegaprotocol/ui-toolkit'; -import type { AgGridReact } from 'ag-grid-react'; -import { AgGridDynamic as AgGrid, Link } from '@vegaprotocol/ui-toolkit'; +} from '@vegaprotocol/datagrid'; import type { DepositFieldsFragment } from './__generated__/Deposit'; import { useEnvironment } from '@vegaprotocol/environment'; import { DepositStatusMapping } from '@vegaprotocol/types'; diff --git a/libs/deposits/src/lib/use-deposit-balances.ts b/libs/deposits/src/lib/use-deposit-balances.ts index 4dd2c5b19..f5880d414 100644 --- a/libs/deposits/src/lib/use-deposit-balances.ts +++ b/libs/deposits/src/lib/use-deposit-balances.ts @@ -6,7 +6,8 @@ import { useGetAllowance } from './use-get-allowance'; import { useGetBalanceOfERC20Token } from './use-get-balance-of-erc20-token'; import { useGetDepositMaximum } from './use-get-deposit-maximum'; import { useGetDepositedAmount } from './use-get-deposited-amount'; -import { isAssetTypeERC20, usePrevious } from '@vegaprotocol/react-helpers'; +import { isAssetTypeERC20 } from '@vegaprotocol/utils'; +import { usePrevious } from '@vegaprotocol/react-helpers'; import { useAccountBalance } from '@vegaprotocol/accounts'; import type { Asset } from '@vegaprotocol/assets'; diff --git a/libs/deposits/src/lib/use-get-allowance.ts b/libs/deposits/src/lib/use-get-allowance.ts index 5e2be32f5..7e6db2f7d 100644 --- a/libs/deposits/src/lib/use-get-allowance.ts +++ b/libs/deposits/src/lib/use-get-allowance.ts @@ -5,7 +5,7 @@ import { useCallback } from 'react'; import { useEthereumConfig } from '@vegaprotocol/web3'; import BigNumber from 'bignumber.js'; import type { Asset } from '@vegaprotocol/assets'; -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; export const useGetAllowance = ( contract: Token | null, diff --git a/libs/deposits/src/lib/use-get-balance-of-erc20-token.ts b/libs/deposits/src/lib/use-get-balance-of-erc20-token.ts index 3e87d40ea..4daf1c28b 100644 --- a/libs/deposits/src/lib/use-get-balance-of-erc20-token.ts +++ b/libs/deposits/src/lib/use-get-balance-of-erc20-token.ts @@ -4,7 +4,7 @@ import { useWeb3React } from '@web3-react/core'; import { useCallback } from 'react'; import BigNumber from 'bignumber.js'; import type { Asset } from '@vegaprotocol/assets'; -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; export const useGetBalanceOfERC20Token = ( contract: Token | null, diff --git a/libs/deposits/src/lib/use-get-deposit-maximum.ts b/libs/deposits/src/lib/use-get-deposit-maximum.ts index 8c3182e9f..2c343c5de 100644 --- a/libs/deposits/src/lib/use-get-deposit-maximum.ts +++ b/libs/deposits/src/lib/use-get-deposit-maximum.ts @@ -2,7 +2,7 @@ import { useCallback } from 'react'; import * as Sentry from '@sentry/react'; import BigNumber from 'bignumber.js'; import type { Asset } from '@vegaprotocol/assets'; -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; import type { CollateralBridge } from '@vegaprotocol/smart-contracts'; export const useGetDepositMaximum = ( diff --git a/libs/deposits/src/lib/use-get-deposited-amount.ts b/libs/deposits/src/lib/use-get-deposited-amount.ts index a268e2b96..89ed89ba3 100644 --- a/libs/deposits/src/lib/use-get-deposited-amount.ts +++ b/libs/deposits/src/lib/use-get-deposited-amount.ts @@ -4,7 +4,7 @@ import { ethers } from 'ethers'; import { useEthereumConfig } from '@vegaprotocol/web3'; import BigNumber from 'bignumber.js'; import type { Asset } from '@vegaprotocol/assets'; -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; import { useWeb3React } from '@web3-react/core'; export const useGetDepositedAmount = (asset: Asset | undefined) => { diff --git a/libs/deposits/src/lib/use-submit-approval.ts b/libs/deposits/src/lib/use-submit-approval.ts index bbaeb9624..e5904dea3 100644 --- a/libs/deposits/src/lib/use-submit-approval.ts +++ b/libs/deposits/src/lib/use-submit-approval.ts @@ -1,4 +1,4 @@ -import { isAssetTypeERC20, removeDecimal } from '@vegaprotocol/react-helpers'; +import { isAssetTypeERC20, removeDecimal } from '@vegaprotocol/utils'; import * as Sentry from '@sentry/react'; import type { Token } from '@vegaprotocol/smart-contracts'; import { diff --git a/libs/deposits/src/lib/use-submit-faucet.ts b/libs/deposits/src/lib/use-submit-faucet.ts index 0da95cb72..b16df2f7b 100644 --- a/libs/deposits/src/lib/use-submit-faucet.ts +++ b/libs/deposits/src/lib/use-submit-faucet.ts @@ -1,7 +1,7 @@ import type { TokenFaucetable } from '@vegaprotocol/smart-contracts'; import * as Sentry from '@sentry/react'; import { useEthereumTransaction, useTokenContract } from '@vegaprotocol/web3'; -import { isAssetTypeERC20 } from '@vegaprotocol/react-helpers'; +import { isAssetTypeERC20 } from '@vegaprotocol/utils'; import type { Asset } from '@vegaprotocol/assets'; export const useSubmitFaucet = (asset?: Asset) => { diff --git a/libs/environment/src/components/contract-address-link.tsx b/libs/environment/src/components/contract-address-link.tsx index 4ade72b35..6e025e2f3 100644 --- a/libs/environment/src/components/contract-address-link.tsx +++ b/libs/environment/src/components/contract-address-link.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Link } from '@vegaprotocol/ui-toolkit'; import { useEtherscanLink } from '../hooks'; diff --git a/libs/environment/src/components/network-switcher/network-switcher.spec.tsx b/libs/environment/src/components/network-switcher/network-switcher.spec.tsx index 0911c8cdd..a6bf46f6b 100644 --- a/libs/environment/src/components/network-switcher/network-switcher.spec.tsx +++ b/libs/environment/src/components/network-switcher/network-switcher.spec.tsx @@ -1,6 +1,6 @@ import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { useEnvironment } from '../../hooks/use-environment'; import { NetworkSwitcher, diff --git a/libs/environment/src/components/network-switcher/network-switcher.tsx b/libs/environment/src/components/network-switcher/network-switcher.tsx index ddcd4e200..8effd6489 100644 --- a/libs/environment/src/components/network-switcher/network-switcher.tsx +++ b/libs/environment/src/components/network-switcher/network-switcher.tsx @@ -1,5 +1,5 @@ import { useState, useCallback, useRef } from 'react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Link, DropdownMenu, diff --git a/libs/environment/src/components/node-switcher/layout-cell.tsx b/libs/environment/src/components/node-switcher/layout-cell.tsx index b335c77ea..c5491a7fb 100644 --- a/libs/environment/src/components/node-switcher/layout-cell.tsx +++ b/libs/environment/src/components/node-switcher/layout-cell.tsx @@ -1,6 +1,6 @@ import type { ReactNode } from 'react'; import classnames from 'classnames'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; type LayoutCellProps = { label?: string; diff --git a/libs/environment/src/components/node-switcher/node-switcher.tsx b/libs/environment/src/components/node-switcher/node-switcher.tsx index 1ec3414d7..9dee3bbd4 100644 --- a/libs/environment/src/components/node-switcher/node-switcher.tsx +++ b/libs/environment/src/components/node-switcher/node-switcher.tsx @@ -1,5 +1,6 @@ import { useCallback, useState } from 'react'; -import { isValidUrl, t } from '@vegaprotocol/react-helpers'; +import { isValidUrl } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { Button, ButtonLink, diff --git a/libs/environment/src/components/node-switcher/row-data.tsx b/libs/environment/src/components/node-switcher/row-data.tsx index c8437f37c..a1a4daee1 100644 --- a/libs/environment/src/components/node-switcher/row-data.tsx +++ b/libs/environment/src/components/node-switcher/row-data.tsx @@ -1,6 +1,7 @@ import type { ApolloError } from '@apollo/client'; import { useHeaderStore } from '@vegaprotocol/apollo-client'; -import { isValidUrl, t } from '@vegaprotocol/react-helpers'; +import { isValidUrl } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { Radio } from '@vegaprotocol/ui-toolkit'; import { useEffect, useState } from 'react'; import { CUSTOM_NODE_KEY } from '../../types'; diff --git a/libs/environment/src/hooks/use-environment.ts b/libs/environment/src/hooks/use-environment.ts index 968a91bc5..73696cc88 100644 --- a/libs/environment/src/hooks/use-environment.ts +++ b/libs/environment/src/hooks/use-environment.ts @@ -1,4 +1,5 @@ -import { isValidUrl, LocalStorage, t } from '@vegaprotocol/react-helpers'; +import { isValidUrl, LocalStorage } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { useEffect } from 'react'; import { create } from 'zustand'; import { createClient } from '@vegaprotocol/apollo-client'; diff --git a/libs/environment/src/hooks/use-node-health.ts b/libs/environment/src/hooks/use-node-health.ts index f5610cead..299f8faea 100644 --- a/libs/environment/src/hooks/use-node-health.ts +++ b/libs/environment/src/hooks/use-node-health.ts @@ -2,7 +2,7 @@ import { useEffect, useMemo } from 'react'; import { useStatisticsQuery } from '../utils/__generated__/Node'; import { useHeaderStore } from '@vegaprotocol/apollo-client'; import { useEnvironment } from './use-environment'; -import { fromNanoSeconds } from '@vegaprotocol/react-helpers'; +import { fromNanoSeconds } from '@vegaprotocol/utils'; const POLL_INTERVAL = 1000; diff --git a/libs/fills/.storybook/preview.js b/libs/fills/.storybook/preview.js index 3dbf92472..3b0971710 100644 --- a/libs/fills/.storybook/preview.js +++ b/libs/fills/.storybook/preview.js @@ -1,5 +1,5 @@ import './styles.css'; -import { useStorybookThemeObserver } from '@vegaprotocol/react-helpers'; +import { useStorybookThemeObserver } from '@vegaprotocol/utils'; export const parameters = { actions: { argTypesRegex: '^on[A-Z].*' }, diff --git a/libs/fills/src/lib/fills-container.tsx b/libs/fills/src/lib/fills-container.tsx index f15e42e87..df759df4a 100644 --- a/libs/fills/src/lib/fills-container.tsx +++ b/libs/fills/src/lib/fills-container.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Splash } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { FillsManager } from './fills-manager'; diff --git a/libs/fills/src/lib/fills-data-provider.ts b/libs/fills/src/lib/fills-data-provider.ts index f7ae3132e..ff3b72126 100644 --- a/libs/fills/src/lib/fills-data-provider.ts +++ b/libs/fills/src/lib/fills-data-provider.ts @@ -6,10 +6,10 @@ import { defaultAppend as append, paginatedCombineDelta as combineDelta, paginatedCombineInsertionData as combineInsertionData, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import type { Market } from '@vegaprotocol/market-list'; import { marketsProvider } from '@vegaprotocol/market-list'; -import type { PageInfo, Edge } from '@vegaprotocol/react-helpers'; +import type { PageInfo, Edge } from '@vegaprotocol/utils'; import { FillsDocument, FillsEventDocument } from './__generated__/Fills'; import type { FillsQuery, diff --git a/libs/fills/src/lib/fills-manager.tsx b/libs/fills/src/lib/fills-manager.tsx index 5b2b04f56..ba776ef17 100644 --- a/libs/fills/src/lib/fills-manager.tsx +++ b/libs/fills/src/lib/fills-manager.tsx @@ -1,7 +1,7 @@ import type { AgGridReact } from 'ag-grid-react'; import { useRef } from 'react'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { FillsTable } from './fills-table'; import type { BodyScrollEvent, BodyScrollEndEvent } from 'ag-grid-community'; import { useFillsList } from './use-fills-list'; diff --git a/libs/fills/src/lib/fills-table.spec.tsx b/libs/fills/src/lib/fills-table.spec.tsx index 756dc3206..b7ef03bab 100644 --- a/libs/fills/src/lib/fills-table.spec.tsx +++ b/libs/fills/src/lib/fills-table.spec.tsx @@ -1,6 +1,6 @@ import { act, render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { getDateTimeFormat } from '@vegaprotocol/react-helpers'; +import { getDateTimeFormat } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import type { PartialDeep } from 'type-fest'; import type { Trade } from './fills-data-provider'; diff --git a/libs/fills/src/lib/fills-table.tsx b/libs/fills/src/lib/fills-table.tsx index 445f01ba7..f500f9d98 100644 --- a/libs/fills/src/lib/fills-table.tsx +++ b/libs/fills/src/lib/fills-table.tsx @@ -9,19 +9,21 @@ import { addDecimalsFormatNumber, formatNumber, getDateTimeFormat, - positiveClassNames, - negativeClassNames, - t, isNumeric, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import * as Schema from '@vegaprotocol/types'; import { AgGridColumn } from 'ag-grid-react'; +import { Link } from '@vegaprotocol/ui-toolkit'; +import { + AgGridDynamic as AgGrid, + positiveClassNames, + negativeClassNames, +} from '@vegaprotocol/datagrid'; import type { VegaICellRendererParams, VegaValueFormatterParams, -} from '@vegaprotocol/ui-toolkit'; -import { Link } from '@vegaprotocol/ui-toolkit'; -import { AgGridDynamic as AgGrid } from '@vegaprotocol/ui-toolkit'; +} from '@vegaprotocol/datagrid'; import { forwardRef } from 'react'; import BigNumber from 'bignumber.js'; import type { Trade } from './fills-data-provider'; diff --git a/libs/fills/src/lib/use-fills-list.ts b/libs/fills/src/lib/use-fills-list.ts index 07a0fc1fc..5b6ef7cd9 100644 --- a/libs/fills/src/lib/use-fills-list.ts +++ b/libs/fills/src/lib/use-fills-list.ts @@ -1,11 +1,8 @@ import type { RefObject } from 'react'; import type { AgGridReact } from 'ag-grid-react'; import { useCallback, useMemo, useRef } from 'react'; -import { - makeInfiniteScrollGetRows, - useDataProvider, - updateGridData, -} from '@vegaprotocol/react-helpers'; +import { makeInfiniteScrollGetRows } from '@vegaprotocol/utils'; +import { useDataProvider, updateGridData } from '@vegaprotocol/react-helpers'; import type { Trade, TradeEdge } from './fills-data-provider'; import { fillsWithMarketProvider } from './fills-data-provider'; diff --git a/libs/governance/README.md b/libs/governance/README.md deleted file mode 100644 index 0bdcff800..000000000 --- a/libs/governance/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# governance - -This library was generated with [Nx](https://nx.dev). - -## Running unit tests - -Run `nx test governance` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/libs/governance/package.json b/libs/governance/package.json deleted file mode 100644 index 24c7e4376..000000000 --- a/libs/governance/package.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "@vegaprotocol/governance", - "version": "0.0.1" -} diff --git a/libs/governance/src/lib/proposals-data-provider/__generated__/Proposals.ts b/libs/governance/src/lib/proposals-data-provider/__generated__/Proposals.ts deleted file mode 100644 index c726f4768..000000000 --- a/libs/governance/src/lib/proposals-data-provider/__generated__/Proposals.ts +++ /dev/null @@ -1,417 +0,0 @@ -import * as Types from '@vegaprotocol/types'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type NewMarketFieldsFragment = { __typename?: 'NewMarket', decimalPlaces: number, metadata?: Array | null, lpPriceRange: string, instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string }, dataSourceSpecForSettlementData: { __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', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } }, dataSourceSpecForTradingTermination: { __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', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } | null }, riskParameters: { __typename?: 'LogNormalRiskModel', riskAversionParameter: number, tau: number, params: { __typename?: 'LogNormalModelParams', mu: number, r: number, sigma: number } } | { __typename?: 'SimpleRiskModel', params: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } } }; - -export type UpdateMarketFieldsFragment = { __typename?: 'UpdateMarket', marketId: string, updateMarketConfiguration: { __typename?: 'UpdateMarketConfiguration', metadata?: Array | null, instrument: { __typename?: 'UpdateInstrumentConfiguration', code: string, product: { __typename?: 'UpdateFutureProduct', quoteName: string, dataSourceSpecForSettlementData: { __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', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } }, dataSourceSpecForTradingTermination: { __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', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } }, priceMonitoringParameters: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null }, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: string, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, riskParameters: { __typename: 'UpdateMarketLogNormalRiskModel', logNormal?: { __typename?: 'LogNormalRiskModel', riskAversionParameter: number, tau: number, params: { __typename?: 'LogNormalModelParams', mu: number, r: number, sigma: number } } | null } | { __typename: 'UpdateMarketSimpleRiskModel', simple?: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } | null } } }; - -export type NewAssetFieldsFragment = { __typename?: 'NewAsset', name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string } }; - -export type UpdateAssetFieldsFragment = { __typename?: 'UpdateAsset', assetId: string, quantum: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } }; - -export type UpdateNetworkParameterFielsFragment = { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } }; - -export type ProposalListFieldsFragment = { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: any, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, requiredMajority: string, requiredParticipation: string, requiredLpMajority?: string | null, requiredLpParticipation?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalWeight: string } }, terms: { __typename?: 'ProposalTerms', closingDatetime: any, enactmentDatetime?: any | null, change: { __typename: 'NewAsset', name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string } } | { __typename: 'NewFreeform' } | { __typename: 'NewMarket', decimalPlaces: number, metadata?: Array | null, lpPriceRange: string, instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string }, dataSourceSpecForSettlementData: { __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', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } }, dataSourceSpecForTradingTermination: { __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', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } | null }, riskParameters: { __typename?: 'LogNormalRiskModel', riskAversionParameter: number, tau: number, params: { __typename?: 'LogNormalModelParams', mu: number, r: number, sigma: number } } | { __typename?: 'SimpleRiskModel', params: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } } } | { __typename: 'UpdateAsset', assetId: string, quantum: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename: 'UpdateMarket', marketId: string, updateMarketConfiguration: { __typename?: 'UpdateMarketConfiguration', metadata?: Array | null, instrument: { __typename?: 'UpdateInstrumentConfiguration', code: string, product: { __typename?: 'UpdateFutureProduct', quoteName: string, dataSourceSpecForSettlementData: { __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', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } }, dataSourceSpecForTradingTermination: { __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', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } }, priceMonitoringParameters: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null }, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: string, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, riskParameters: { __typename: 'UpdateMarketLogNormalRiskModel', logNormal?: { __typename?: 'LogNormalRiskModel', riskAversionParameter: number, tau: number, params: { __typename?: 'LogNormalModelParams', mu: number, r: number, sigma: number } } | null } | { __typename: 'UpdateMarketSimpleRiskModel', simple?: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } | null } } } | { __typename: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } } }; - -export type ProposalsListQueryVariables = Types.Exact<{ - proposalType?: Types.InputMaybe; - inState?: Types.InputMaybe; -}>; - - -export type ProposalsListQuery = { __typename?: 'Query', proposalsConnection?: { __typename?: 'ProposalsConnection', edges?: Array<{ __typename?: 'ProposalEdge', node: { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, datetime: any, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null, requiredMajority: string, requiredParticipation: string, requiredLpMajority?: string | null, requiredLpParticipation?: string | null, rationale: { __typename?: 'ProposalRationale', title: string, description: string }, party: { __typename?: 'Party', id: string }, votes: { __typename?: 'ProposalVotes', yes: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalWeight: string }, no: { __typename?: 'ProposalVoteSide', totalTokens: string, totalNumber: string, totalWeight: string } }, terms: { __typename?: 'ProposalTerms', closingDatetime: any, enactmentDatetime?: any | null, change: { __typename: 'NewAsset', name: string, symbol: string, decimals: number, quantum: string, source: { __typename?: 'BuiltinAsset', maxFaucetAmountMint: string } | { __typename?: 'ERC20', contractAddress: string, lifetimeLimit: string, withdrawThreshold: string } } | { __typename: 'NewFreeform' } | { __typename: 'NewMarket', decimalPlaces: number, metadata?: Array | null, lpPriceRange: string, instrument: { __typename?: 'InstrumentConfiguration', name: string, code: string, futureProduct?: { __typename?: 'FutureProduct', quoteName: string, settlementAsset: { __typename?: 'Asset', id: string, name: string, symbol: string, decimals: number, quantum: string }, dataSourceSpecForSettlementData: { __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', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } }, dataSourceSpecForTradingTermination: { __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', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } | null }, riskParameters: { __typename?: 'LogNormalRiskModel', riskAversionParameter: number, tau: number, params: { __typename?: 'LogNormalModelParams', mu: number, r: number, sigma: number } } | { __typename?: 'SimpleRiskModel', params: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } } } | { __typename: 'UpdateAsset', assetId: string, quantum: string, source: { __typename?: 'UpdateERC20', lifetimeLimit: string, withdrawThreshold: string } } | { __typename: 'UpdateMarket', marketId: string, updateMarketConfiguration: { __typename?: 'UpdateMarketConfiguration', metadata?: Array | null, instrument: { __typename?: 'UpdateInstrumentConfiguration', code: string, product: { __typename?: 'UpdateFutureProduct', quoteName: string, dataSourceSpecForSettlementData: { __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', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } }, dataSourceSpecForTradingTermination: { __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', operator: Types.ConditionOperator, value?: string | null }> | null }> | null } } | { __typename?: 'DataSourceDefinitionInternal', sourceType: { __typename?: 'DataSourceSpecConfigurationTime', conditions: Array<{ __typename?: 'Condition', operator: Types.ConditionOperator, value?: string | null } | null> } } }, dataSourceSpecBinding: { __typename?: 'DataSourceSpecToFutureBinding', settlementDataProperty: string, tradingTerminationProperty: string } } }, priceMonitoringParameters: { __typename?: 'PriceMonitoringParameters', triggers?: Array<{ __typename?: 'PriceMonitoringTrigger', horizonSecs: number, probability: number, auctionExtensionSecs: number }> | null }, liquidityMonitoringParameters: { __typename?: 'LiquidityMonitoringParameters', triggeringRatio: string, targetStakeParameters: { __typename?: 'TargetStakeParameters', timeWindow: number, scalingFactor: number } }, riskParameters: { __typename: 'UpdateMarketLogNormalRiskModel', logNormal?: { __typename?: 'LogNormalRiskModel', riskAversionParameter: number, tau: number, params: { __typename?: 'LogNormalModelParams', mu: number, r: number, sigma: number } } | null } | { __typename: 'UpdateMarketSimpleRiskModel', simple?: { __typename?: 'SimpleRiskModelParams', factorLong: number, factorShort: number } | null } } } | { __typename: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } } } } | null> | null } | null }; - -export const NewMarketFieldsFragmentDoc = gql` - fragment NewMarketFields on NewMarket { - instrument { - name - code - futureProduct { - settlementAsset { - id - name - symbol - decimals - quantum - } - quoteName - dataSourceSpecForSettlementData { - sourceType { - ... on DataSourceDefinitionInternal { - sourceType { - ... on DataSourceSpecConfigurationTime { - conditions { - operator - value - } - } - } - } - ... on DataSourceDefinitionExternal { - sourceType { - ... on DataSourceSpecConfiguration { - signers { - signer { - ... on PubKey { - key - } - ... on ETHAddress { - address - } - } - } - filters { - key { - name - type - } - conditions { - operator - value - } - } - } - } - } - } - } - dataSourceSpecForTradingTermination { - sourceType { - ... on DataSourceDefinitionInternal { - sourceType { - ... on DataSourceSpecConfigurationTime { - conditions { - operator - value - } - } - } - } - ... on DataSourceDefinitionExternal { - sourceType { - ... on DataSourceSpecConfiguration { - signers { - signer { - ... on PubKey { - key - } - ... on ETHAddress { - address - } - } - } - filters { - key { - name - type - } - conditions { - operator - value - } - } - } - } - } - } - } - dataSourceSpecBinding { - settlementDataProperty - tradingTerminationProperty - } - } - } - decimalPlaces - riskParameters { - ... on LogNormalRiskModel { - riskAversionParameter - tau - params { - mu - r - sigma - } - } - ... on SimpleRiskModel { - params { - factorLong - factorShort - } - } - } - metadata - lpPriceRange -} - `; -export const UpdateMarketFieldsFragmentDoc = gql` - fragment UpdateMarketFields on UpdateMarket { - marketId - updateMarketConfiguration { - instrument { - code - product { - quoteName - dataSourceSpecForSettlementData { - sourceType { - ... on DataSourceDefinitionInternal { - sourceType { - ... on DataSourceSpecConfigurationTime { - conditions { - operator - value - } - } - } - } - ... on DataSourceDefinitionExternal { - sourceType { - ... on DataSourceSpecConfiguration { - signers { - signer { - ... on PubKey { - key - } - ... on ETHAddress { - address - } - } - } - filters { - key { - name - type - } - conditions { - operator - value - } - } - } - } - } - } - } - dataSourceSpecForTradingTermination { - sourceType { - ... on DataSourceDefinitionInternal { - sourceType { - ... on DataSourceSpecConfigurationTime { - conditions { - operator - value - } - } - } - } - ... on DataSourceDefinitionExternal { - sourceType { - ... on DataSourceSpecConfiguration { - signers { - signer { - ... on PubKey { - key - } - ... on ETHAddress { - address - } - } - } - filters { - key { - name - type - } - conditions { - operator - value - } - } - } - } - } - } - } - dataSourceSpecBinding { - settlementDataProperty - tradingTerminationProperty - } - } - } - metadata - priceMonitoringParameters { - triggers { - horizonSecs - probability - auctionExtensionSecs - } - } - liquidityMonitoringParameters { - targetStakeParameters { - timeWindow - scalingFactor - } - triggeringRatio - } - riskParameters { - __typename - ... on UpdateMarketSimpleRiskModel { - simple { - factorLong - factorShort - } - } - ... on UpdateMarketLogNormalRiskModel { - logNormal { - riskAversionParameter - tau - params { - mu - r - sigma - } - } - } - } - } -} - `; -export const NewAssetFieldsFragmentDoc = gql` - fragment NewAssetFields on NewAsset { - name - symbol - decimals - quantum - source { - ... on BuiltinAsset { - maxFaucetAmountMint - } - ... on ERC20 { - contractAddress - lifetimeLimit - withdrawThreshold - } - } -} - `; -export const UpdateAssetFieldsFragmentDoc = gql` - fragment UpdateAssetFields on UpdateAsset { - assetId - quantum - source { - ... on UpdateERC20 { - lifetimeLimit - withdrawThreshold - } - } -} - `; -export const UpdateNetworkParameterFielsFragmentDoc = gql` - fragment UpdateNetworkParameterFiels on UpdateNetworkParameter { - networkParameter { - key - value - } -} - `; -export const ProposalListFieldsFragmentDoc = gql` - fragment ProposalListFields on Proposal { - id - rationale { - title - description - } - reference - state - datetime - rejectionReason - party { - id - } - votes { - yes { - totalTokens - totalNumber - totalWeight - } - no { - totalTokens - totalNumber - totalWeight - } - } - errorDetails - rejectionReason - requiredMajority - requiredParticipation - requiredLpMajority - requiredLpParticipation - terms { - closingDatetime - enactmentDatetime - change { - __typename - ... on NewMarket { - ...NewMarketFields - } - ... on UpdateMarket { - ...UpdateMarketFields - } - ... on NewAsset { - ...NewAssetFields - } - ... on UpdateAsset { - ...UpdateAssetFields - } - ... on UpdateNetworkParameter { - ...UpdateNetworkParameterFiels - } - } - } -} - ${NewMarketFieldsFragmentDoc} -${UpdateMarketFieldsFragmentDoc} -${NewAssetFieldsFragmentDoc} -${UpdateAssetFieldsFragmentDoc} -${UpdateNetworkParameterFielsFragmentDoc}`; -export const ProposalsListDocument = gql` - query ProposalsList($proposalType: ProposalType, $inState: ProposalState) { - proposalsConnection(proposalType: $proposalType, inState: $inState) { - edges { - node { - ...ProposalListFields - } - } - } -} - ${ProposalListFieldsFragmentDoc}`; - -/** - * __useProposalsListQuery__ - * - * To run a query within a React component, call `useProposalsListQuery` and pass it any options that fit your needs. - * When your component renders, `useProposalsListQuery` 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 } = useProposalsListQuery({ - * variables: { - * proposalType: // value for 'proposalType' - * inState: // value for 'inState' - * }, - * }); - */ -export function useProposalsListQuery(baseOptions?: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(ProposalsListDocument, options); - } -export function useProposalsListLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(ProposalsListDocument, options); - } -export type ProposalsListQueryHookResult = ReturnType; -export type ProposalsListLazyQueryHookResult = ReturnType; -export type ProposalsListQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/libs/governance/src/lib/proposals-hooks/__generated__/Proposal.ts b/libs/governance/src/lib/proposals-hooks/__generated__/Proposal.ts deleted file mode 100644 index 2c10bb94d..000000000 --- a/libs/governance/src/lib/proposals-hooks/__generated__/Proposal.ts +++ /dev/null @@ -1,150 +0,0 @@ -import * as Types from '@vegaprotocol/types'; - -import { gql } from '@apollo/client'; -import { UpdateNetworkParameterFielsFragmentDoc } from '../../proposals-data-provider/__generated__/Proposals'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type ProposalEventFieldsFragment = { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null }; - -export type ProposalEventSubscriptionVariables = Types.Exact<{ - partyId: Types.Scalars['ID']; -}>; - - -export type ProposalEventSubscription = { __typename?: 'Subscription', proposals: { __typename?: 'Proposal', id?: string | null, reference: string, state: Types.ProposalState, rejectionReason?: Types.ProposalRejectionReason | null, errorDetails?: string | null } }; - -export type UpdateNetworkParameterProposalFragment = { __typename?: 'Proposal', id?: string | null, state: Types.ProposalState, datetime: any, terms: { __typename?: 'ProposalTerms', enactmentDatetime?: any | null, change: { __typename?: 'NewAsset' } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket' } | { __typename?: 'UpdateAsset' } | { __typename?: 'UpdateMarket' } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } } }; - -export type OnUpdateNetworkParametersSubscriptionVariables = Types.Exact<{ [key: string]: never; }>; - - -export type OnUpdateNetworkParametersSubscription = { __typename?: 'Subscription', proposals: { __typename?: 'Proposal', id?: string | null, state: Types.ProposalState, datetime: any, terms: { __typename?: 'ProposalTerms', enactmentDatetime?: any | null, change: { __typename?: 'NewAsset' } | { __typename?: 'NewFreeform' } | { __typename?: 'NewMarket' } | { __typename?: 'UpdateAsset' } | { __typename?: 'UpdateMarket' } | { __typename?: 'UpdateNetworkParameter', networkParameter: { __typename?: 'NetworkParameter', key: string, value: string } } } } }; - -export type ProposalOfMarketQueryVariables = Types.Exact<{ - marketId: Types.Scalars['ID']; -}>; - - -export type ProposalOfMarketQuery = { __typename?: 'Query', proposal?: { __typename?: 'Proposal', id?: string | null, terms: { __typename?: 'ProposalTerms', enactmentDatetime?: any | null } } | null }; - -export const ProposalEventFieldsFragmentDoc = gql` - fragment ProposalEventFields on Proposal { - id - reference - state - rejectionReason - errorDetails -} - `; -export const UpdateNetworkParameterProposalFragmentDoc = gql` - fragment UpdateNetworkParameterProposal on Proposal { - id - state - datetime - terms { - enactmentDatetime - change { - ... on UpdateNetworkParameter { - ...UpdateNetworkParameterFiels - } - } - } -} - ${UpdateNetworkParameterFielsFragmentDoc}`; -export const ProposalEventDocument = gql` - subscription ProposalEvent($partyId: ID!) { - proposals(partyId: $partyId) { - ...ProposalEventFields - } -} - ${ProposalEventFieldsFragmentDoc}`; - -/** - * __useProposalEventSubscription__ - * - * To run a query within a React component, call `useProposalEventSubscription` and pass it any options that fit your needs. - * When your component renders, `useProposalEventSubscription` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useProposalEventSubscription({ - * variables: { - * partyId: // value for 'partyId' - * }, - * }); - */ -export function useProposalEventSubscription(baseOptions: Apollo.SubscriptionHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useSubscription(ProposalEventDocument, options); - } -export type ProposalEventSubscriptionHookResult = ReturnType; -export type ProposalEventSubscriptionResult = Apollo.SubscriptionResult; -export const OnUpdateNetworkParametersDocument = gql` - subscription OnUpdateNetworkParameters { - proposals { - ...UpdateNetworkParameterProposal - } -} - ${UpdateNetworkParameterProposalFragmentDoc}`; - -/** - * __useOnUpdateNetworkParametersSubscription__ - * - * To run a query within a React component, call `useOnUpdateNetworkParametersSubscription` and pass it any options that fit your needs. - * When your component renders, `useOnUpdateNetworkParametersSubscription` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useOnUpdateNetworkParametersSubscription({ - * variables: { - * }, - * }); - */ -export function useOnUpdateNetworkParametersSubscription(baseOptions?: Apollo.SubscriptionHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useSubscription(OnUpdateNetworkParametersDocument, options); - } -export type OnUpdateNetworkParametersSubscriptionHookResult = ReturnType; -export type OnUpdateNetworkParametersSubscriptionResult = Apollo.SubscriptionResult; -export const ProposalOfMarketDocument = gql` - query ProposalOfMarket($marketId: ID!) { - proposal(id: $marketId) { - id - terms { - enactmentDatetime - } - } -} - `; - -/** - * __useProposalOfMarketQuery__ - * - * To run a query within a React component, call `useProposalOfMarketQuery` and pass it any options that fit your needs. - * When your component renders, `useProposalOfMarketQuery` 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 } = useProposalOfMarketQuery({ - * variables: { - * marketId: // value for 'marketId' - * }, - * }); - */ -export function useProposalOfMarketQuery(baseOptions: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(ProposalOfMarketDocument, options); - } -export function useProposalOfMarketLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(ProposalOfMarketDocument, options); - } -export type ProposalOfMarketQueryHookResult = ReturnType; -export type ProposalOfMarketLazyQueryHookResult = ReturnType; -export type ProposalOfMarketQueryResult = Apollo.QueryResult; \ No newline at end of file diff --git a/libs/governance/src/lib/voting-hooks/__generated__/VoteSubsciption.ts b/libs/governance/src/lib/voting-hooks/__generated__/VoteSubsciption.ts deleted file mode 100644 index aea13f5f4..000000000 --- a/libs/governance/src/lib/voting-hooks/__generated__/VoteSubsciption.ts +++ /dev/null @@ -1,53 +0,0 @@ -import * as Types from '@vegaprotocol/types'; - -import { gql } from '@apollo/client'; -import * as Apollo from '@apollo/client'; -const defaultOptions = {} as const; -export type VoteEventFieldsFragment = { __typename?: 'ProposalVote', proposalId: string, vote: { __typename?: 'Vote', value: Types.VoteValue, datetime: any } }; - -export type VoteEventSubscriptionVariables = Types.Exact<{ - partyId: Types.Scalars['ID']; -}>; - - -export type VoteEventSubscription = { __typename?: 'Subscription', votes: { __typename?: 'ProposalVote', proposalId: string, vote: { __typename?: 'Vote', value: Types.VoteValue, datetime: any } } }; - -export const VoteEventFieldsFragmentDoc = gql` - fragment VoteEventFields on ProposalVote { - proposalId - vote { - value - datetime - } -} - `; -export const VoteEventDocument = gql` - subscription VoteEvent($partyId: ID!) { - votes(partyId: $partyId) { - ...VoteEventFields - } -} - ${VoteEventFieldsFragmentDoc}`; - -/** - * __useVoteEventSubscription__ - * - * To run a query within a React component, call `useVoteEventSubscription` and pass it any options that fit your needs. - * When your component renders, `useVoteEventSubscription` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useVoteEventSubscription({ - * variables: { - * partyId: // value for 'partyId' - * }, - * }); - */ -export function useVoteEventSubscription(baseOptions: Apollo.SubscriptionHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useSubscription(VoteEventDocument, options); - } -export type VoteEventSubscriptionHookResult = ReturnType; -export type VoteEventSubscriptionResult = Apollo.SubscriptionResult; \ No newline at end of file diff --git a/libs/i18n/.babelrc b/libs/i18n/.babelrc new file mode 100644 index 000000000..e24a5465f --- /dev/null +++ b/libs/i18n/.babelrc @@ -0,0 +1,10 @@ +{ + "presets": [ + [ + "@nrwl/web/babel", + { + "useBuiltIns": "usage" + } + ] + ] +} diff --git a/libs/i18n/.eslintrc.json b/libs/i18n/.eslintrc.json new file mode 100644 index 000000000..9d9c0db55 --- /dev/null +++ b/libs/i18n/.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/i18n/README.md b/libs/i18n/README.md new file mode 100644 index 000000000..507c17a09 --- /dev/null +++ b/libs/i18n/README.md @@ -0,0 +1,11 @@ +# i18n + +This library was generated with [Nx](https://nx.dev). + +## Building + +Run `nx build i18n` to build the library. + +## Running unit tests + +Run `nx test i18n` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/libs/i18n/jest.config.ts b/libs/i18n/jest.config.ts new file mode 100644 index 000000000..80cde765e --- /dev/null +++ b/libs/i18n/jest.config.ts @@ -0,0 +1,15 @@ +/* eslint-disable */ +export default { + displayName: 'i18n', + preset: '../../jest.preset.js', + globals: { + 'ts-jest': { + tsconfig: '/tsconfig.spec.json', + }, + }, + transform: { + '^.+\\.[tj]s$': 'ts-jest', + }, + moduleFileExtensions: ['ts', 'js', 'html'], + coverageDirectory: '../../coverage/libs/i18n', +}; diff --git a/libs/i18n/package.json b/libs/i18n/package.json new file mode 100644 index 000000000..09cfaad85 --- /dev/null +++ b/libs/i18n/package.json @@ -0,0 +1,5 @@ +{ + "name": "@vegaprotocol/i18n", + "version": "0.0.1", + "type": "commonjs" +} diff --git a/libs/i18n/project.json b/libs/i18n/project.json new file mode 100644 index 000000000..073eb1ee5 --- /dev/null +++ b/libs/i18n/project.json @@ -0,0 +1,45 @@ +{ + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/i18n/src", + "projectType": "library", + "targets": { + "build": { + "executor": "@nrwl/js:tsc", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/libs/i18n", + "main": "libs/i18n/src/index.ts", + "tsConfig": "libs/i18n/tsconfig.lib.json", + "assets": ["libs/i18n/*.md"] + } + }, + "publish": { + "executor": "@nrwl/workspace:run-commands", + "options": { + "command": "node tools/scripts/publish.mjs i18n {args.ver} {args.tag}" + }, + "dependsOn": [ + { + "projects": "self", + "target": "build" + } + ] + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["libs/i18n/**/*.ts"] + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "outputs": ["coverage/libs/i18n"], + "options": { + "jestConfig": "libs/i18n/jest.config.ts", + "passWithNoTests": true + } + } + }, + "tags": [] +} diff --git a/libs/i18n/src/index.ts b/libs/i18n/src/index.ts new file mode 100644 index 000000000..cda584c32 --- /dev/null +++ b/libs/i18n/src/index.ts @@ -0,0 +1 @@ +export * from './lib/i18n'; diff --git a/libs/react-helpers/src/lib/i18n.ts b/libs/i18n/src/lib/i18n.ts similarity index 100% rename from libs/react-helpers/src/lib/i18n.ts rename to libs/i18n/src/lib/i18n.ts diff --git a/libs/i18n/tsconfig.json b/libs/i18n/tsconfig.json new file mode 100644 index 000000000..f5b85657a --- /dev/null +++ b/libs/i18n/tsconfig.json @@ -0,0 +1,22 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "module": "commonjs", + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/libs/i18n/tsconfig.lib.json b/libs/i18n/tsconfig.lib.json new file mode 100644 index 000000000..623dd477a --- /dev/null +++ b/libs/i18n/tsconfig.lib.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "declaration": true, + "types": [] + }, + "include": ["**/*.ts", "../utils/src/lib/i18n.ts"], + "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"] +} diff --git a/libs/i18n/tsconfig.spec.json b/libs/i18n/tsconfig.spec.json new file mode 100644 index 000000000..546f12877 --- /dev/null +++ b/libs/i18n/tsconfig.spec.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] +} diff --git a/libs/ledger/src/lib/ledger-container.tsx b/libs/ledger/src/lib/ledger-container.tsx index f158fc46c..820a8713a 100644 --- a/libs/ledger/src/lib/ledger-container.tsx +++ b/libs/ledger/src/lib/ledger-container.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Splash } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { LedgerManager } from './ledger-manager'; diff --git a/libs/ledger/src/lib/ledger-entries-data-provider.ts b/libs/ledger/src/lib/ledger-entries-data-provider.ts index 94df404db..3022803db 100644 --- a/libs/ledger/src/lib/ledger-entries-data-provider.ts +++ b/libs/ledger/src/lib/ledger-entries-data-provider.ts @@ -2,13 +2,12 @@ import type { Asset } from '@vegaprotocol/assets'; import { assetsProvider } from '@vegaprotocol/assets'; import type { Market } from '@vegaprotocol/market-list'; import { marketsProvider } from '@vegaprotocol/market-list'; -import { makeInfiniteScrollGetRows } from '@vegaprotocol/react-helpers'; import { makeDataProvider, makeDerivedDataProvider, - useDataProvider, - updateGridData, -} from '@vegaprotocol/react-helpers'; + makeInfiniteScrollGetRows, +} from '@vegaprotocol/utils'; +import { useDataProvider, updateGridData } from '@vegaprotocol/react-helpers'; import type * as Schema from '@vegaprotocol/types'; import type { AgGridReact } from 'ag-grid-react'; import produce from 'immer'; diff --git a/libs/ledger/src/lib/ledger-manager.tsx b/libs/ledger/src/lib/ledger-manager.tsx index 7ad7883f2..a6771d2e1 100644 --- a/libs/ledger/src/lib/ledger-manager.tsx +++ b/libs/ledger/src/lib/ledger-manager.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type * as Schema from '@vegaprotocol/types'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; import type { FilterChangedEvent } from 'ag-grid-community'; diff --git a/libs/ledger/src/lib/ledger-table.tsx b/libs/ledger/src/lib/ledger-table.tsx index 564eac2d2..12e9a96c7 100644 --- a/libs/ledger/src/lib/ledger-table.tsx +++ b/libs/ledger/src/lib/ledger-table.tsx @@ -1,17 +1,19 @@ import { addDecimalsFormatNumber, - DateRangeFilter, fromNanoSeconds, getDateTimeFormat, - SetFilter, - t, truncateByChars, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import type { VegaValueFormatterParams, TypedDataAgGrid, -} from '@vegaprotocol/ui-toolkit'; -import { AgGridDynamic as AgGrid } from '@vegaprotocol/ui-toolkit'; +} from '@vegaprotocol/datagrid'; +import { + AgGridDynamic as AgGrid, + DateRangeFilter, + SetFilter, +} from '@vegaprotocol/datagrid'; import type { AgGridReact } from 'ag-grid-react'; import { AgGridColumn } from 'ag-grid-react'; import type * as Types from '@vegaprotocol/types'; diff --git a/libs/liquidity/project.json b/libs/liquidity/project.json index dd2ec595f..dc7f4d8d5 100644 --- a/libs/liquidity/project.json +++ b/libs/liquidity/project.json @@ -1,5 +1,4 @@ { - "root": "libs/liquidity", "sourceRoot": "libs/liquidity/src", "projectType": "library", "tags": [], diff --git a/libs/liquidity/src/lib/liquidity-data-provider.ts b/libs/liquidity/src/lib/liquidity-data-provider.ts index 3a7ebd99d..633bff267 100644 --- a/libs/liquidity/src/lib/liquidity-data-provider.ts +++ b/libs/liquidity/src/lib/liquidity-data-provider.ts @@ -1,8 +1,5 @@ import compact from 'lodash/compact'; -import { - makeDataProvider, - makeDerivedDataProvider, -} from '@vegaprotocol/react-helpers'; +import { makeDataProvider, makeDerivedDataProvider } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import BigNumber from 'bignumber.js'; import produce from 'immer'; diff --git a/libs/liquidity/src/lib/liquidity-table.tsx b/libs/liquidity/src/lib/liquidity-table.tsx index 334cbabd2..13f834513 100644 --- a/libs/liquidity/src/lib/liquidity-table.tsx +++ b/libs/liquidity/src/lib/liquidity-table.tsx @@ -3,16 +3,14 @@ import { addDecimalsFormatNumber, formatNumberPercentage, getDateTimeFormat, - t, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import type { VegaValueFormatterParams, TypedDataAgGrid, -} from '@vegaprotocol/ui-toolkit'; -import { - AgGridDynamic as AgGrid, - TooltipCellComponent, -} from '@vegaprotocol/ui-toolkit'; +} from '@vegaprotocol/datagrid'; +import { AgGridDynamic as AgGrid } from '@vegaprotocol/datagrid'; +import { TooltipCellComponent } from '@vegaprotocol/ui-toolkit'; import type { AgGridReact } from 'ag-grid-react'; import { AgGridColumn } from 'ag-grid-react'; import type { ValueFormatterParams } from 'ag-grid-community'; diff --git a/libs/liquidity/src/lib/markets-liquidity-provider.ts b/libs/liquidity/src/lib/markets-liquidity-provider.ts index 3e2887170..cad55b51f 100644 --- a/libs/liquidity/src/lib/markets-liquidity-provider.ts +++ b/libs/liquidity/src/lib/markets-liquidity-provider.ts @@ -1,12 +1,7 @@ import { useMemo } from 'react'; import * as Schema from '@vegaprotocol/types'; -import { - makeDataProvider, - makeDerivedDataProvider, - useDataProvider, - useYesterday, -} from '@vegaprotocol/react-helpers'; - +import { makeDataProvider, makeDerivedDataProvider } from '@vegaprotocol/utils'; +import { useDataProvider, useYesterday } from '@vegaprotocol/react-helpers'; import type { MarketCandles, MarketMaybeWithDataAndCandles, diff --git a/libs/liquidity/src/lib/utils/liquidity-utils.ts b/libs/liquidity/src/lib/utils/liquidity-utils.ts index 4f36a527f..b42d45a02 100644 --- a/libs/liquidity/src/lib/utils/liquidity-utils.ts +++ b/libs/liquidity/src/lib/utils/liquidity-utils.ts @@ -1,5 +1,5 @@ import BigNumber from 'bignumber.js'; -import { addDecimalsFormatNumber } from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber } from '@vegaprotocol/utils'; import type { MarketNodeFragment } from './../__generated__/MarketsLiquidity'; import { Intent } from '@vegaprotocol/ui-toolkit'; diff --git a/libs/market-depth/src/lib/depth-chart-utils.ts b/libs/market-depth/src/lib/depth-chart-utils.ts index 5d4ded542..3e2a936cb 100644 --- a/libs/market-depth/src/lib/depth-chart-utils.ts +++ b/libs/market-depth/src/lib/depth-chart-utils.ts @@ -1,4 +1,4 @@ -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; interface PriceLevel { price: number; diff --git a/libs/market-depth/src/lib/depth-chart.tsx b/libs/market-depth/src/lib/depth-chart.tsx index d6ffa1876..7bbc0b4e5 100644 --- a/libs/market-depth/src/lib/depth-chart.tsx +++ b/libs/market-depth/src/lib/depth-chart.tsx @@ -1,13 +1,9 @@ import { DepthChart } from 'pennant'; import throttle from 'lodash/throttle'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; -import { - useDataProvider, - addDecimal, - getNumberFormat, - useThemeSwitcher, - t, -} from '@vegaprotocol/react-helpers'; +import { addDecimal, getNumberFormat } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; +import { useDataProvider, useThemeSwitcher } from '@vegaprotocol/react-helpers'; import { marketDepthProvider } from './market-depth-provider'; import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { marketDataProvider, marketProvider } from '@vegaprotocol/market-list'; diff --git a/libs/market-depth/src/lib/market-depth-provider.ts b/libs/market-depth/src/lib/market-depth-provider.ts index 27353c3da..a4f58b97e 100644 --- a/libs/market-depth/src/lib/market-depth-provider.ts +++ b/libs/market-depth/src/lib/market-depth-provider.ts @@ -1,6 +1,6 @@ -import { makeDataProvider } from '@vegaprotocol/react-helpers'; +import { makeDataProvider } from '@vegaprotocol/utils'; import { updateLevels } from './orderbook-data'; -import type { Update } from '@vegaprotocol/react-helpers'; +import type { Update } from '@vegaprotocol/utils'; import { captureException } from '@sentry/react'; import { diff --git a/libs/market-depth/src/lib/orderbook-data.ts b/libs/market-depth/src/lib/orderbook-data.ts index e24bed573..e74142d6a 100644 --- a/libs/market-depth/src/lib/orderbook-data.ts +++ b/libs/market-depth/src/lib/orderbook-data.ts @@ -2,10 +2,14 @@ import groupBy from 'lodash/groupBy'; import uniqBy from 'lodash/uniqBy'; import reverse from 'lodash/reverse'; import cloneDeep from 'lodash/cloneDeep'; -import { VolumeType } from '@vegaprotocol/react-helpers'; import * as Schema from '@vegaprotocol/types'; import type { MarketData } from '@vegaprotocol/market-list'; import type { PriceLevelFieldsFragment } from './__generated__/MarketDepth'; + +export enum VolumeType { + bid, + ask, +} export interface CumulativeVol { bid: number; relativeBid?: number; diff --git a/libs/market-depth/src/lib/orderbook-manager.tsx b/libs/market-depth/src/lib/orderbook-manager.tsx index bca813f55..79b855139 100644 --- a/libs/market-depth/src/lib/orderbook-manager.tsx +++ b/libs/market-depth/src/lib/orderbook-manager.tsx @@ -2,7 +2,8 @@ import React from 'react'; import throttle from 'lodash/throttle'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; import { Orderbook } from './orderbook'; -import { addDecimal, useDataProvider } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; +import { useDataProvider } from '@vegaprotocol/react-helpers'; import { marketDepthProvider } from './market-depth-provider'; import { marketDataProvider, marketProvider } from '@vegaprotocol/market-list'; import type { MarketData } from '@vegaprotocol/market-list'; diff --git a/libs/market-depth/src/lib/orderbook-row.tsx b/libs/market-depth/src/lib/orderbook-row.tsx index c82fd9f0c..ec47a9121 100644 --- a/libs/market-depth/src/lib/orderbook-row.tsx +++ b/libs/market-depth/src/lib/orderbook-row.tsx @@ -1,11 +1,6 @@ import React from 'react'; -import { - PriceCell, - VolCell, - CumulativeVol, - addDecimalsFormatNumber, - VolumeType, -} from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber } from '@vegaprotocol/utils'; +import { PriceCell, VolCell, CumulativeVol } from '@vegaprotocol/datagrid'; interface OrderbookRowProps { ask: number; @@ -46,14 +41,14 @@ export const OrderbookRow = React.memo( value={bid} valueFormatted={addDecimalsFormatNumber(bid, positionDecimalPlaces)} relativeValue={relativeBid} - type={VolumeType.bid} + type="bid" /> = { diff --git a/libs/market-list/src/lib/components/markets-container/market-list-table.tsx b/libs/market-list/src/lib/components/markets-container/market-list-table.tsx index 667ce3a1a..358c1daa3 100644 --- a/libs/market-list/src/lib/components/markets-container/market-list-table.tsx +++ b/libs/market-list/src/lib/components/markets-container/market-list-table.tsx @@ -1,17 +1,17 @@ import { forwardRef } from 'react'; -import { - PriceFlashCell, - addDecimalsFormatNumber, - t, - toBigNum, -} from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber, toBigNum } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import type { VegaValueGetterParams, VegaValueFormatterParams, VegaICellRendererParams, TypedDataAgGrid, -} from '@vegaprotocol/ui-toolkit'; -import { AgGridDynamic as AgGrid, ButtonLink } from '@vegaprotocol/ui-toolkit'; +} from '@vegaprotocol/datagrid'; +import { + AgGridDynamic as AgGrid, + PriceFlashCell, +} from '@vegaprotocol/datagrid'; +import { ButtonLink } from '@vegaprotocol/ui-toolkit'; import { AgGridColumn } from 'ag-grid-react'; import type { AgGridReact } from 'ag-grid-react'; import * as Schema from '@vegaprotocol/types'; diff --git a/libs/market-list/src/lib/components/markets-container/markets-container.tsx b/libs/market-list/src/lib/components/markets-container/markets-container.tsx index 0095d9459..a6a80df7b 100644 --- a/libs/market-list/src/lib/components/markets-container/markets-container.tsx +++ b/libs/market-list/src/lib/components/markets-container/markets-container.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; import { MarketListTable } from './market-list-table'; import { useDataProvider } from '@vegaprotocol/react-helpers'; diff --git a/libs/market-list/src/lib/market-candles-provider.ts b/libs/market-list/src/lib/market-candles-provider.ts index 5013d0a5d..40e7286c0 100644 --- a/libs/market-list/src/lib/market-candles-provider.ts +++ b/libs/market-list/src/lib/market-candles-provider.ts @@ -1,4 +1,4 @@ -import { makeDataProvider } from '@vegaprotocol/react-helpers'; +import { makeDataProvider } from '@vegaprotocol/utils'; import type { MarketCandlesQuery, MarketCandlesUpdateSubscription, diff --git a/libs/market-list/src/lib/market-data-provider.ts b/libs/market-list/src/lib/market-data-provider.ts index 06a269f19..cf8bb8ed7 100644 --- a/libs/market-list/src/lib/market-data-provider.ts +++ b/libs/market-list/src/lib/market-data-provider.ts @@ -1,10 +1,7 @@ import produce from 'immer'; import { useMemo } from 'react'; -import { - makeDerivedDataProvider, - useDataProvider, -} from '@vegaprotocol/react-helpers'; -import { makeDataProvider } from '@vegaprotocol/react-helpers'; +import { makeDataProvider, makeDerivedDataProvider } from '@vegaprotocol/utils'; +import { useDataProvider } from '@vegaprotocol/react-helpers'; import { MarketDataDocument, MarketDataUpdateDocument, diff --git a/libs/market-list/src/lib/markets-candles-provider.ts b/libs/market-list/src/lib/markets-candles-provider.ts index 3f53f7a02..3220b883a 100644 --- a/libs/market-list/src/lib/markets-candles-provider.ts +++ b/libs/market-list/src/lib/markets-candles-provider.ts @@ -1,4 +1,4 @@ -import { makeDataProvider } from '@vegaprotocol/react-helpers'; +import { makeDataProvider } from '@vegaprotocol/utils'; import { MarketsCandlesDocument } from './__generated__/markets-candles'; import type { MarketsCandlesQuery } from './__generated__/markets-candles'; import type { Candle } from './market-candles-provider'; diff --git a/libs/market-list/src/lib/markets-data-provider.ts b/libs/market-list/src/lib/markets-data-provider.ts index 09f88099c..4304bd87e 100644 --- a/libs/market-list/src/lib/markets-data-provider.ts +++ b/libs/market-list/src/lib/markets-data-provider.ts @@ -1,7 +1,7 @@ import { makeDataProvider, marketDataErrorPolicyGuard, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import type { MarketsDataQuery } from './__generated__/markets-data'; import { MarketsDataDocument } from './__generated__/markets-data'; import type { MarketData } from './market-data-provider'; diff --git a/libs/market-list/src/lib/markets-provider.ts b/libs/market-list/src/lib/markets-provider.ts index 4392c0080..3850f3da1 100644 --- a/libs/market-list/src/lib/markets-provider.ts +++ b/libs/market-list/src/lib/markets-provider.ts @@ -1,9 +1,5 @@ -import { - makeDataProvider, - makeDerivedDataProvider, - useDataProvider, - useYesterday, -} from '@vegaprotocol/react-helpers'; +import { makeDataProvider, makeDerivedDataProvider } from '@vegaprotocol/utils'; +import { useDataProvider, useYesterday } from '@vegaprotocol/react-helpers'; import type { MarketsQuery, MarketFieldsFragment, diff --git a/libs/market-list/src/lib/utils/market-utils.ts b/libs/market-list/src/lib/utils/market-utils.ts index 9f00b378d..e58fc86c1 100644 --- a/libs/market-list/src/lib/utils/market-utils.ts +++ b/libs/market-list/src/lib/utils/market-utils.ts @@ -1,4 +1,4 @@ -import { formatNumberPercentage } from '@vegaprotocol/react-helpers'; +import { formatNumberPercentage } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import BigNumber from 'bignumber.js'; import orderBy from 'lodash/orderBy'; diff --git a/libs/network-info/src/network-info.tsx b/libs/network-info/src/network-info.tsx index dbdc7610a..f64e41fc9 100644 --- a/libs/network-info/src/network-info.tsx +++ b/libs/network-info/src/network-info.tsx @@ -1,5 +1,5 @@ import { Fragment, useState } from 'react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Link, Lozenge } from '@vegaprotocol/ui-toolkit'; import { NodeSwitcherDialog, useEnvironment } from '@vegaprotocol/environment'; diff --git a/libs/network-stats/src/config/stats-fields.ts b/libs/network-stats/src/config/stats-fields.ts index e90efa3ad..5839d2543 100644 --- a/libs/network-stats/src/config/stats-fields.ts +++ b/libs/network-stats/src/config/stats-fields.ts @@ -3,8 +3,8 @@ import { getDateTimeFormat, getTimeFormat, isValidDate, - t, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import type { Stats, StatFields } from './types'; // Stats fields config. Keys will correspond to graphql queries when used, and values diff --git a/libs/orders/src/lib/components/order-data-provider/order-data-provider.spec.ts b/libs/orders/src/lib/components/order-data-provider/order-data-provider.spec.ts index d5e7380f1..c630e0241 100644 --- a/libs/orders/src/lib/components/order-data-provider/order-data-provider.spec.ts +++ b/libs/orders/src/lib/components/order-data-provider/order-data-provider.spec.ts @@ -1,6 +1,6 @@ import { update } from './order-data-provider'; import type { OrderUpdateFieldsFragment, OrderFieldsFragment } from '../'; -import type { Edge } from '@vegaprotocol/react-helpers'; +import type { Edge } from '@vegaprotocol/utils'; describe('order data provider', () => { it('puts incoming data in proper place', () => { const data = [ 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 402995f44..f1c0ccda0 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 @@ -7,10 +7,10 @@ import { defaultAppend as append, paginatedCombineDelta as combineDelta, paginatedCombineInsertionData as combineInsertionData, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import type { Market } from '@vegaprotocol/market-list'; import { marketsProvider } from '@vegaprotocol/market-list'; -import type { PageInfo, Edge } from '@vegaprotocol/react-helpers'; +import type { PageInfo, Edge } from '@vegaprotocol/utils'; import type { OrderFieldsFragment, OrderUpdateFieldsFragment, diff --git a/libs/orders/src/lib/components/order-list-container.tsx b/libs/orders/src/lib/components/order-list-container.tsx index 84ce3e4bc..5b91ff427 100644 --- a/libs/orders/src/lib/components/order-list-container.tsx +++ b/libs/orders/src/lib/components/order-list-container.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Splash } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { OrderListManager } from './order-list-manager'; diff --git a/libs/orders/src/lib/components/order-list-manager/order-list-manager.tsx b/libs/orders/src/lib/components/order-list-manager/order-list-manager.tsx index a2895b635..49aaec2da 100644 --- a/libs/orders/src/lib/components/order-list-manager/order-list-manager.tsx +++ b/libs/orders/src/lib/components/order-list-manager/order-list-manager.tsx @@ -1,5 +1,6 @@ import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; -import { t, truncateByChars } from '@vegaprotocol/react-helpers'; +import { truncateByChars } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { useRef, useState } from 'react'; import type { BodyScrollEvent, 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 ea39ab17a..370b3eabc 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 @@ -2,7 +2,7 @@ import type { AgGridReact } from 'ag-grid-react'; 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 { Edge } from '@vegaprotocol/utils'; import type { OrderFieldsFragment } from '../order-data-provider/__generated__/Orders'; import type { IGetRowsParams } from 'ag-grid-community'; diff --git a/libs/orders/src/lib/components/order-list-manager/use-order-list-data.ts b/libs/orders/src/lib/components/order-list-manager/use-order-list-data.ts index ed88da89f..dd9e3882c 100644 --- a/libs/orders/src/lib/components/order-list-manager/use-order-list-data.ts +++ b/libs/orders/src/lib/components/order-list-manager/use-order-list-data.ts @@ -1,11 +1,8 @@ import { useCallback, useMemo, useRef } from 'react'; import type { RefObject } from 'react'; import type { AgGridReact } from 'ag-grid-react'; -import { - makeInfiniteScrollGetRows, - useDataProvider, - updateGridData, -} from '@vegaprotocol/react-helpers'; +import { makeInfiniteScrollGetRows } from '@vegaprotocol/utils'; +import { useDataProvider, updateGridData } from '@vegaprotocol/react-helpers'; import { ordersWithMarketProvider } from '../order-data-provider/order-data-provider'; import type { OrderEdge, diff --git a/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx b/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx index a0aa068a3..6a50033b5 100644 --- a/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx +++ b/libs/orders/src/lib/components/order-list/order-edit-dialog.tsx @@ -1,12 +1,12 @@ import { - t, toDecimal, - Size, getDateTimeFormat, addDecimal, addDecimalsFormatNumber, validateAmount, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; +import { Size } from '@vegaprotocol/react-helpers'; import * as Schema from '@vegaprotocol/types'; import { FormGroup, diff --git a/libs/orders/src/lib/components/order-list/order-list.spec.tsx b/libs/orders/src/lib/components/order-list/order-list.spec.tsx index 8ffae3a80..de97833d0 100644 --- a/libs/orders/src/lib/components/order-list/order-list.spec.tsx +++ b/libs/orders/src/lib/components/order-list/order-list.spec.tsx @@ -1,6 +1,6 @@ import { act, render, screen, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { getDateTimeFormat } from '@vegaprotocol/react-helpers'; +import { getDateTimeFormat } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import type { PartialDeep } from 'type-fest'; import type { VegaWalletContextShape } from '@vegaprotocol/wallet'; diff --git a/libs/orders/src/lib/components/order-list/order-list.tsx b/libs/orders/src/lib/components/order-list/order-list.tsx index 321af666d..4af68a4cb 100644 --- a/libs/orders/src/lib/components/order-list/order-list.tsx +++ b/libs/orders/src/lib/components/order-list/order-list.tsx @@ -2,27 +2,25 @@ import { addDecimalsFormatNumber, getDateTimeFormat, isNumeric, - negativeClassNames, - positiveClassNames, - t, - SetFilter, - DateRangeFilter, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import * as Schema from '@vegaprotocol/types'; -import { - AgGridDynamic as AgGrid, - ButtonLink, - Link, -} from '@vegaprotocol/ui-toolkit'; +import { ButtonLink, Link } from '@vegaprotocol/ui-toolkit'; import { AgGridColumn } from 'ag-grid-react'; import BigNumber from 'bignumber.js'; import { forwardRef } from 'react'; -import type { TypedDataAgGrid } from '@vegaprotocol/ui-toolkit'; - +import { + AgGridDynamic as AgGrid, + SetFilter, + DateRangeFilter, + negativeClassNames, + positiveClassNames, +} from '@vegaprotocol/datagrid'; import type { + TypedDataAgGrid, VegaICellRendererParams, VegaValueFormatterParams, -} from '@vegaprotocol/ui-toolkit'; +} from '@vegaprotocol/datagrid'; import type { AgGridReact } from 'ag-grid-react'; import type { Order } from '../order-data-provider'; diff --git a/libs/orders/src/lib/order-hooks/use-order-edit.tsx b/libs/orders/src/lib/order-hooks/use-order-edit.tsx index 6c02cb046..9069e50fa 100644 --- a/libs/orders/src/lib/order-hooks/use-order-edit.tsx +++ b/libs/orders/src/lib/order-hooks/use-order-edit.tsx @@ -1,4 +1,4 @@ -import { removeDecimal, toNanoSeconds } from '@vegaprotocol/react-helpers'; +import { removeDecimal, toNanoSeconds } from '@vegaprotocol/utils'; import { useState, useCallback } from 'react'; import { useVegaTransaction, useVegaWallet } from '@vegaprotocol/wallet'; import type { OrderSubFieldsFragment } from './'; 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 cf2f827ed..4be232443 100644 --- a/libs/orders/src/lib/order-hooks/use-order-submit.tsx +++ b/libs/orders/src/lib/order-hooks/use-order-submit.tsx @@ -10,7 +10,7 @@ import * as Sentry from '@sentry/react'; import { useOrderUpdate } from './use-order-update'; import * as Schema from '@vegaprotocol/types'; import { Icon, Intent } from '@vegaprotocol/ui-toolkit'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { OrderSubmissionBody } from '@vegaprotocol/wallet'; export const getOrderDialogTitle = ( diff --git a/libs/orders/src/lib/utils.ts b/libs/orders/src/lib/utils.ts index 790579b3d..b9e4060ed 100644 --- a/libs/orders/src/lib/utils.ts +++ b/libs/orders/src/lib/utils.ts @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import * as Schema from '@vegaprotocol/types'; import type { OrderSubFieldsFragment } from './order-hooks'; diff --git a/libs/positions/.storybook/preview.js b/libs/positions/.storybook/preview.js index c1b81a5b8..77cf7b2b5 100644 --- a/libs/positions/.storybook/preview.js +++ b/libs/positions/.storybook/preview.js @@ -1,5 +1,5 @@ import './styles.scss'; -import { useStorybookThemeObserver } from '@vegaprotocol/react-helpers'; +import { useStorybookThemeObserver } from '@vegaprotocol/utils'; export const parameters = { actions: { argTypesRegex: '^on[A-Z].*' }, backgrounds: { disable: true }, diff --git a/libs/positions/src/lib/close-position-dialog/complete.tsx b/libs/positions/src/lib/close-position-dialog/complete.tsx index 577009635..2bc3bc23e 100644 --- a/libs/positions/src/lib/close-position-dialog/complete.tsx +++ b/libs/positions/src/lib/close-position-dialog/complete.tsx @@ -1,6 +1,7 @@ import { useEnvironment } from '@vegaprotocol/environment'; -import type { OrderEventFieldsFragment } from '@vegaprotocol/orders'; -import { t, truncateByChars } from '@vegaprotocol/react-helpers'; +import type { OrderFieldsFragment } from '@vegaprotocol/orders'; +import { truncateByChars } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import * as Schema from '@vegaprotocol/types'; import { Link } from '@vegaprotocol/ui-toolkit'; import type { TransactionResult, VegaTxState } from '@vegaprotocol/wallet'; @@ -13,7 +14,7 @@ interface CompleteProps { transaction: VegaTxState; transactionResult?: TransactionResult; closingOrder?: IClosingOrder; - closingOrderResult?: OrderEventFieldsFragment; + closingOrderResult?: OrderFieldsFragment; } export const Complete = ({ @@ -89,7 +90,7 @@ const Error = ({ closingOrderResult, }: { transactionResult: TransactionResult; - closingOrderResult: OrderEventFieldsFragment; + closingOrderResult: OrderFieldsFragment; }) => { const reason = closingOrderResult.rejectionReason && diff --git a/libs/positions/src/lib/close-position-dialog/requested.tsx b/libs/positions/src/lib/close-position-dialog/requested.tsx index 32ed31e5a..8d965661b 100644 --- a/libs/positions/src/lib/close-position-dialog/requested.tsx +++ b/libs/positions/src/lib/close-position-dialog/requested.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import type { ClosingOrder as IClosingOrder } from '../use-close-position'; import { useRequestClosePositionData } from '../use-request-close-position-data'; import { ActiveOrders, ClosingOrder } from './shared'; diff --git a/libs/positions/src/lib/close-position-dialog/shared.tsx b/libs/positions/src/lib/close-position-dialog/shared.tsx index a950e1543..e8d6df8aa 100644 --- a/libs/positions/src/lib/close-position-dialog/shared.tsx +++ b/libs/positions/src/lib/close-position-dialog/shared.tsx @@ -1,7 +1,9 @@ import type { MarketData, Market } from '@vegaprotocol/market-list'; import type { Order } from '@vegaprotocol/orders'; import { timeInForceLabel } from '@vegaprotocol/orders'; -import { addDecimalsFormatNumber, Size, t } from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; +import { Size } from '@vegaprotocol/react-helpers'; import type { ReactNode } from 'react'; import type { ClosingOrder as IClosingOrder } from '../use-close-position'; diff --git a/libs/positions/src/lib/margin-data-provider.ts b/libs/positions/src/lib/margin-data-provider.ts index 0561cbc2d..bc1a65b6d 100644 --- a/libs/positions/src/lib/margin-data-provider.ts +++ b/libs/positions/src/lib/margin-data-provider.ts @@ -1,8 +1,5 @@ import produce from 'immer'; -import { - makeDataProvider, - removePaginationWrapper, -} from '@vegaprotocol/react-helpers'; +import { makeDataProvider, removePaginationWrapper } from '@vegaprotocol/utils'; import { MarginsSubscriptionDocument, MarginsDocument, diff --git a/libs/positions/src/lib/positions-container.tsx b/libs/positions/src/lib/positions-container.tsx index 9de092ec3..4f079c318 100644 --- a/libs/positions/src/lib/positions-container.tsx +++ b/libs/positions/src/lib/positions-container.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Splash } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { PositionsManager } from './positions-manager'; diff --git a/libs/positions/src/lib/positions-data-providers.ts b/libs/positions/src/lib/positions-data-providers.ts index d54e6d674..902ae62cd 100644 --- a/libs/positions/src/lib/positions-data-providers.ts +++ b/libs/positions/src/lib/positions-data-providers.ts @@ -9,7 +9,7 @@ import { makeDataProvider, makeDerivedDataProvider, removePaginationWrapper, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import type { MarketMaybeWithData } from '@vegaprotocol/market-list'; import { marketsWithDataProvider } from '@vegaprotocol/market-list'; diff --git a/libs/positions/src/lib/positions-manager.tsx b/libs/positions/src/lib/positions-manager.tsx index 130431057..f3dcece01 100644 --- a/libs/positions/src/lib/positions-manager.tsx +++ b/libs/positions/src/lib/positions-manager.tsx @@ -4,7 +4,7 @@ import { usePositionsData, PositionsTable } from '../'; import type { AgGridReact } from 'ag-grid-react'; import * as Schema from '@vegaprotocol/types'; import { useVegaTransactionStore } from '@vegaprotocol/wallet'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; interface PositionsManagerProps { partyId: string; diff --git a/libs/positions/src/lib/positions-table.tsx b/libs/positions/src/lib/positions-table.tsx index 00d0ca63d..0acec30bd 100644 --- a/libs/positions/src/lib/positions-table.tsx +++ b/libs/positions/src/lib/positions-table.tsx @@ -6,28 +6,34 @@ import type { VegaValueFormatterParams, VegaValueGetterParams, TypedDataAgGrid, -} from '@vegaprotocol/ui-toolkit'; -import { ProgressBarCell } from '@vegaprotocol/ui-toolkit'; + VegaICellRendererParams, +} from '@vegaprotocol/datagrid'; import { + AgGridDynamic as AgGrid, + DateRangeFilter, PriceFlashCell, + signedNumberCssClass, + signedNumberCssClassRules, +} from '@vegaprotocol/datagrid'; +import { volumePrefix, - t, toBigNum, formatNumber, getDateTimeFormat, - signedNumberCssClass, - signedNumberCssClassRules, - DateRangeFilter, addDecimalsFormatNumber, -} from '@vegaprotocol/react-helpers'; -import { AgGridDynamic as AgGrid, Link } from '@vegaprotocol/ui-toolkit'; +} from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { AgGridColumn } from 'ag-grid-react'; import type { AgGridReact } from 'ag-grid-react'; import type { Position } from './positions-data-providers'; import * as Schema from '@vegaprotocol/types'; -import { ButtonLink, TooltipCellComponent } from '@vegaprotocol/ui-toolkit'; +import { + ButtonLink, + Link, + ProgressBarCell, + TooltipCellComponent, +} from '@vegaprotocol/ui-toolkit'; import { getRowId } from './use-positions-data'; -import type { VegaICellRendererParams } from '@vegaprotocol/ui-toolkit'; interface Props extends TypedDataAgGrid { onClose?: (data: Position) => void; diff --git a/libs/positions/src/lib/use-positions-data.tsx b/libs/positions/src/lib/use-positions-data.tsx index c58122d23..d64c852d9 100644 --- a/libs/positions/src/lib/use-positions-data.tsx +++ b/libs/positions/src/lib/use-positions-data.tsx @@ -5,7 +5,7 @@ import type { Position } from './positions-data-providers'; import { positionsMetricsProvider } from './positions-data-providers'; import type { PositionsMetricsProviderVariables } from './positions-data-providers'; import { useDataProvider, updateGridData } from '@vegaprotocol/react-helpers'; -import type { GetRowsParams } from '@vegaprotocol/ui-toolkit'; +import type { GetRowsParams } from '@vegaprotocol/datagrid'; export const getRowId = ({ data }: { data: Position }) => data.marketId; diff --git a/libs/proposals/.babelrc b/libs/proposals/.babelrc new file mode 100644 index 000000000..ccae900be --- /dev/null +++ b/libs/proposals/.babelrc @@ -0,0 +1,12 @@ +{ + "presets": [ + [ + "@nrwl/react/babel", + { + "runtime": "automatic", + "useBuiltIns": "usage" + } + ] + ], + "plugins": [] +} diff --git a/libs/governance/.eslintrc.json b/libs/proposals/.eslintrc.json similarity index 100% rename from libs/governance/.eslintrc.json rename to libs/proposals/.eslintrc.json diff --git a/libs/proposals/README.md b/libs/proposals/README.md new file mode 100644 index 000000000..b299c6f3e --- /dev/null +++ b/libs/proposals/README.md @@ -0,0 +1,7 @@ +# proposals + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test proposals` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/libs/governance/jest.config.ts b/libs/proposals/jest.config.ts similarity index 73% rename from libs/governance/jest.config.ts rename to libs/proposals/jest.config.ts index e636f7be0..24312caa3 100644 --- a/libs/governance/jest.config.ts +++ b/libs/proposals/jest.config.ts @@ -1,11 +1,11 @@ /* eslint-disable */ export default { - displayName: 'governance', + displayName: 'proposals', preset: '../../jest.preset.js', transform: { '^.+\\.[tj]sx?$': 'babel-jest', }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], - coverageDirectory: '../../coverage/libs/governance', + coverageDirectory: '../../coverage/libs/proposals', setupFilesAfterEnv: ['./src/setup-tests.ts'], }; diff --git a/libs/proposals/package.json b/libs/proposals/package.json new file mode 100644 index 000000000..8e7654567 --- /dev/null +++ b/libs/proposals/package.json @@ -0,0 +1,4 @@ +{ + "name": "@vegaprotocol/proposals", + "version": "0.0.1" +} diff --git a/libs/governance/project.json b/libs/proposals/project.json similarity index 61% rename from libs/governance/project.json rename to libs/proposals/project.json index a403bc8d4..982eb3c92 100644 --- a/libs/governance/project.json +++ b/libs/proposals/project.json @@ -1,6 +1,6 @@ { "$schema": "../../node_modules/nx/schemas/project-schema.json", - "sourceRoot": "libs/governance/src", + "sourceRoot": "libs/proposals/src", "projectType": "library", "tags": [], "targets": { @@ -8,16 +8,16 @@ "executor": "@nrwl/web:rollup", "outputs": ["{options.outputPath}"], "options": { - "outputPath": "dist/libs/governance", - "tsConfig": "libs/governance/tsconfig.lib.json", - "project": "libs/governance/package.json", - "entryFile": "libs/governance/src/index.ts", + "outputPath": "dist/libs/proposals", + "tsConfig": "libs/proposals/tsconfig.lib.json", + "project": "libs/proposals/package.json", + "entryFile": "libs/proposals/src/index.ts", "external": ["react/jsx-runtime"], "rollupConfig": "@nrwl/react/plugins/bundle-rollup", "compiler": "babel", "assets": [ { - "glob": "libs/governance/README.md", + "glob": "libs/proposals/README.md", "input": ".", "output": "." } @@ -28,14 +28,14 @@ "executor": "@nrwl/linter:eslint", "outputs": ["{options.outputFile}"], "options": { - "lintFilePatterns": ["libs/governance/**/*.{ts,tsx,js,jsx}"] + "lintFilePatterns": ["libs/proposals/**/*.{ts,tsx,js,jsx}"] } }, "test": { "executor": "@nrwl/jest:jest", - "outputs": ["coverage/libs/governance"], + "outputs": ["coverage/libs/proposals"], "options": { - "jestConfig": "libs/governance/jest.config.ts", + "jestConfig": "libs/proposals/jest.config.ts", "passWithNoTests": true } }, @@ -43,7 +43,7 @@ "executor": "@nrwl/workspace:run-commands", "outputs": [], "options": { - "command": "yarn tsc --project ./libs/governance/tsconfig.spec.json" + "command": "yarn tsc --project ./libs/proposals/tsconfig.spec.json" } } } diff --git a/libs/governance/src/components/asset-proposal-notification.tsx b/libs/proposals/src/components/asset-proposal-notification.tsx similarity index 95% rename from libs/governance/src/components/asset-proposal-notification.tsx rename to libs/proposals/src/components/asset-proposal-notification.tsx index 1ed187b21..2301d8a3e 100644 --- a/libs/governance/src/components/asset-proposal-notification.tsx +++ b/libs/proposals/src/components/asset-proposal-notification.tsx @@ -1,5 +1,5 @@ import { DApp, TOKEN_PROPOSAL, useLinks } from '@vegaprotocol/environment'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import * as Schema from '@vegaprotocol/types'; import { ExternalLink, Intent, Notification } from '@vegaprotocol/ui-toolkit'; import { useUpdateProposal } from '../lib'; diff --git a/libs/governance/src/components/index.ts b/libs/proposals/src/components/index.ts similarity index 100% rename from libs/governance/src/components/index.ts rename to libs/proposals/src/components/index.ts diff --git a/libs/governance/src/components/market-proposal-notification.tsx b/libs/proposals/src/components/market-proposal-notification.tsx similarity index 96% rename from libs/governance/src/components/market-proposal-notification.tsx rename to libs/proposals/src/components/market-proposal-notification.tsx index f1ebb5b43..99ee236fc 100644 --- a/libs/governance/src/components/market-proposal-notification.tsx +++ b/libs/proposals/src/components/market-proposal-notification.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import * as Schema from '@vegaprotocol/types'; import { ExternalLink, Intent, Notification } from '@vegaprotocol/ui-toolkit'; import { DApp, TOKEN_PROPOSAL, useLinks } from '@vegaprotocol/environment'; diff --git a/libs/governance/src/index.ts b/libs/proposals/src/index.ts similarity index 100% rename from libs/governance/src/index.ts rename to libs/proposals/src/index.ts diff --git a/libs/governance/src/lib/index.ts b/libs/proposals/src/lib/index.ts similarity index 100% rename from libs/governance/src/lib/index.ts rename to libs/proposals/src/lib/index.ts diff --git a/libs/governance/src/lib/proposals-data-provider/Proposals.graphql b/libs/proposals/src/lib/proposals-data-provider/Proposals.graphql similarity index 100% rename from libs/governance/src/lib/proposals-data-provider/Proposals.graphql rename to libs/proposals/src/lib/proposals-data-provider/Proposals.graphql diff --git a/libs/proposals/src/lib/proposals-data-provider/__generated__/Proposals.ts b/libs/proposals/src/lib/proposals-data-provider/__generated__/Proposals.ts new file mode 100644 index 000000000..d74b48523 --- /dev/null +++ b/libs/proposals/src/lib/proposals-data-provider/__generated__/Proposals.ts @@ -0,0 +1,1470 @@ +import * as Types from '@vegaprotocol/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type NewMarketFieldsFragment = { + __typename?: 'NewMarket'; + decimalPlaces: number; + metadata?: Array | null; + lpPriceRange: string; + instrument: { + __typename?: 'InstrumentConfiguration'; + name: string; + code: string; + futureProduct?: { + __typename?: 'FutureProduct'; + quoteName: string; + settlementAsset: { + __typename?: 'Asset'; + id: string; + name: string; + symbol: string; + decimals: number; + quantum: string; + }; + dataSourceSpecForSettlementData: { + __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'; + operator: Types.ConditionOperator; + value?: string | null; + }> | null; + }> | null; + }; + } + | { + __typename?: 'DataSourceDefinitionInternal'; + sourceType: { + __typename?: 'DataSourceSpecConfigurationTime'; + conditions: Array<{ + __typename?: 'Condition'; + operator: Types.ConditionOperator; + value?: string | null; + } | null>; + }; + }; + }; + dataSourceSpecForTradingTermination: { + __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'; + operator: Types.ConditionOperator; + value?: string | null; + }> | null; + }> | null; + }; + } + | { + __typename?: 'DataSourceDefinitionInternal'; + sourceType: { + __typename?: 'DataSourceSpecConfigurationTime'; + conditions: Array<{ + __typename?: 'Condition'; + operator: Types.ConditionOperator; + value?: string | null; + } | null>; + }; + }; + }; + dataSourceSpecBinding: { + __typename?: 'DataSourceSpecToFutureBinding'; + settlementDataProperty: string; + tradingTerminationProperty: string; + }; + } | null; + }; + riskParameters: + | { + __typename?: 'LogNormalRiskModel'; + riskAversionParameter: number; + tau: number; + params: { + __typename?: 'LogNormalModelParams'; + mu: number; + r: number; + sigma: number; + }; + } + | { + __typename?: 'SimpleRiskModel'; + params: { + __typename?: 'SimpleRiskModelParams'; + factorLong: number; + factorShort: number; + }; + }; +}; + +export type UpdateMarketFieldsFragment = { + __typename?: 'UpdateMarket'; + marketId: string; + updateMarketConfiguration: { + __typename?: 'UpdateMarketConfiguration'; + metadata?: Array | null; + instrument: { + __typename?: 'UpdateInstrumentConfiguration'; + code: string; + product: { + __typename?: 'UpdateFutureProduct'; + quoteName: string; + dataSourceSpecForSettlementData: { + __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'; + operator: Types.ConditionOperator; + value?: string | null; + }> | null; + }> | null; + }; + } + | { + __typename?: 'DataSourceDefinitionInternal'; + sourceType: { + __typename?: 'DataSourceSpecConfigurationTime'; + conditions: Array<{ + __typename?: 'Condition'; + operator: Types.ConditionOperator; + value?: string | null; + } | null>; + }; + }; + }; + dataSourceSpecForTradingTermination: { + __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'; + operator: Types.ConditionOperator; + value?: string | null; + }> | null; + }> | null; + }; + } + | { + __typename?: 'DataSourceDefinitionInternal'; + sourceType: { + __typename?: 'DataSourceSpecConfigurationTime'; + conditions: Array<{ + __typename?: 'Condition'; + operator: Types.ConditionOperator; + value?: string | null; + } | null>; + }; + }; + }; + dataSourceSpecBinding: { + __typename?: 'DataSourceSpecToFutureBinding'; + settlementDataProperty: string; + tradingTerminationProperty: string; + }; + }; + }; + priceMonitoringParameters: { + __typename?: 'PriceMonitoringParameters'; + triggers?: Array<{ + __typename?: 'PriceMonitoringTrigger'; + horizonSecs: number; + probability: number; + auctionExtensionSecs: number; + }> | null; + }; + liquidityMonitoringParameters: { + __typename?: 'LiquidityMonitoringParameters'; + triggeringRatio: string; + targetStakeParameters: { + __typename?: 'TargetStakeParameters'; + timeWindow: number; + scalingFactor: number; + }; + }; + riskParameters: + | { + __typename: 'UpdateMarketLogNormalRiskModel'; + logNormal?: { + __typename?: 'LogNormalRiskModel'; + riskAversionParameter: number; + tau: number; + params: { + __typename?: 'LogNormalModelParams'; + mu: number; + r: number; + sigma: number; + }; + } | null; + } + | { + __typename: 'UpdateMarketSimpleRiskModel'; + simple?: { + __typename?: 'SimpleRiskModelParams'; + factorLong: number; + factorShort: number; + } | null; + }; + }; +}; + +export type NewAssetFieldsFragment = { + __typename?: 'NewAsset'; + name: string; + symbol: string; + decimals: number; + quantum: string; + source: + | { __typename?: 'BuiltinAsset'; maxFaucetAmountMint: string } + | { + __typename?: 'ERC20'; + contractAddress: string; + lifetimeLimit: string; + withdrawThreshold: string; + }; +}; + +export type UpdateAssetFieldsFragment = { + __typename?: 'UpdateAsset'; + assetId: string; + quantum: string; + source: { + __typename?: 'UpdateERC20'; + lifetimeLimit: string; + withdrawThreshold: string; + }; +}; + +export type UpdateNetworkParameterFielsFragment = { + __typename?: 'UpdateNetworkParameter'; + networkParameter: { + __typename?: 'NetworkParameter'; + key: string; + value: string; + }; +}; + +export type ProposalListFieldsFragment = { + __typename?: 'Proposal'; + id?: string | null; + reference: string; + state: Types.ProposalState; + datetime: any; + rejectionReason?: Types.ProposalRejectionReason | null; + errorDetails?: string | null; + requiredMajority: string; + requiredParticipation: string; + requiredLpMajority?: string | null; + requiredLpParticipation?: string | null; + rationale: { + __typename?: 'ProposalRationale'; + title: string; + description: string; + }; + party: { __typename?: 'Party'; id: string }; + votes: { + __typename?: 'ProposalVotes'; + yes: { + __typename?: 'ProposalVoteSide'; + totalTokens: string; + totalNumber: string; + totalWeight: string; + }; + no: { + __typename?: 'ProposalVoteSide'; + totalTokens: string; + totalNumber: string; + totalWeight: string; + }; + }; + terms: { + __typename?: 'ProposalTerms'; + closingDatetime: any; + enactmentDatetime?: any | null; + change: + | { + __typename: 'NewAsset'; + name: string; + symbol: string; + decimals: number; + quantum: string; + source: + | { __typename?: 'BuiltinAsset'; maxFaucetAmountMint: string } + | { + __typename?: 'ERC20'; + contractAddress: string; + lifetimeLimit: string; + withdrawThreshold: string; + }; + } + | { __typename: 'NewFreeform' } + | { + __typename: 'NewMarket'; + decimalPlaces: number; + metadata?: Array | null; + lpPriceRange: string; + instrument: { + __typename?: 'InstrumentConfiguration'; + name: string; + code: string; + futureProduct?: { + __typename?: 'FutureProduct'; + quoteName: string; + settlementAsset: { + __typename?: 'Asset'; + id: string; + name: string; + symbol: string; + decimals: number; + quantum: string; + }; + dataSourceSpecForSettlementData: { + __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'; + operator: Types.ConditionOperator; + value?: string | null; + }> | null; + }> | null; + }; + } + | { + __typename?: 'DataSourceDefinitionInternal'; + sourceType: { + __typename?: 'DataSourceSpecConfigurationTime'; + conditions: Array<{ + __typename?: 'Condition'; + operator: Types.ConditionOperator; + value?: string | null; + } | null>; + }; + }; + }; + dataSourceSpecForTradingTermination: { + __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'; + operator: Types.ConditionOperator; + value?: string | null; + }> | null; + }> | null; + }; + } + | { + __typename?: 'DataSourceDefinitionInternal'; + sourceType: { + __typename?: 'DataSourceSpecConfigurationTime'; + conditions: Array<{ + __typename?: 'Condition'; + operator: Types.ConditionOperator; + value?: string | null; + } | null>; + }; + }; + }; + dataSourceSpecBinding: { + __typename?: 'DataSourceSpecToFutureBinding'; + settlementDataProperty: string; + tradingTerminationProperty: string; + }; + } | null; + }; + riskParameters: + | { + __typename?: 'LogNormalRiskModel'; + riskAversionParameter: number; + tau: number; + params: { + __typename?: 'LogNormalModelParams'; + mu: number; + r: number; + sigma: number; + }; + } + | { + __typename?: 'SimpleRiskModel'; + params: { + __typename?: 'SimpleRiskModelParams'; + factorLong: number; + factorShort: number; + }; + }; + } + | { + __typename: 'UpdateAsset'; + assetId: string; + quantum: string; + source: { + __typename?: 'UpdateERC20'; + lifetimeLimit: string; + withdrawThreshold: string; + }; + } + | { + __typename: 'UpdateMarket'; + marketId: string; + updateMarketConfiguration: { + __typename?: 'UpdateMarketConfiguration'; + metadata?: Array | null; + instrument: { + __typename?: 'UpdateInstrumentConfiguration'; + code: string; + product: { + __typename?: 'UpdateFutureProduct'; + quoteName: string; + dataSourceSpecForSettlementData: { + __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'; + operator: Types.ConditionOperator; + value?: string | null; + }> | null; + }> | null; + }; + } + | { + __typename?: 'DataSourceDefinitionInternal'; + sourceType: { + __typename?: 'DataSourceSpecConfigurationTime'; + conditions: Array<{ + __typename?: 'Condition'; + operator: Types.ConditionOperator; + value?: string | null; + } | null>; + }; + }; + }; + dataSourceSpecForTradingTermination: { + __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'; + operator: Types.ConditionOperator; + value?: string | null; + }> | null; + }> | null; + }; + } + | { + __typename?: 'DataSourceDefinitionInternal'; + sourceType: { + __typename?: 'DataSourceSpecConfigurationTime'; + conditions: Array<{ + __typename?: 'Condition'; + operator: Types.ConditionOperator; + value?: string | null; + } | null>; + }; + }; + }; + dataSourceSpecBinding: { + __typename?: 'DataSourceSpecToFutureBinding'; + settlementDataProperty: string; + tradingTerminationProperty: string; + }; + }; + }; + priceMonitoringParameters: { + __typename?: 'PriceMonitoringParameters'; + triggers?: Array<{ + __typename?: 'PriceMonitoringTrigger'; + horizonSecs: number; + probability: number; + auctionExtensionSecs: number; + }> | null; + }; + liquidityMonitoringParameters: { + __typename?: 'LiquidityMonitoringParameters'; + triggeringRatio: string; + targetStakeParameters: { + __typename?: 'TargetStakeParameters'; + timeWindow: number; + scalingFactor: number; + }; + }; + riskParameters: + | { + __typename: 'UpdateMarketLogNormalRiskModel'; + logNormal?: { + __typename?: 'LogNormalRiskModel'; + riskAversionParameter: number; + tau: number; + params: { + __typename?: 'LogNormalModelParams'; + mu: number; + r: number; + sigma: number; + }; + } | null; + } + | { + __typename: 'UpdateMarketSimpleRiskModel'; + simple?: { + __typename?: 'SimpleRiskModelParams'; + factorLong: number; + factorShort: number; + } | null; + }; + }; + } + | { + __typename: 'UpdateNetworkParameter'; + networkParameter: { + __typename?: 'NetworkParameter'; + key: string; + value: string; + }; + }; + }; +}; + +export type ProposalsListQueryVariables = Types.Exact<{ + proposalType?: Types.InputMaybe; + inState?: Types.InputMaybe; +}>; + +export type ProposalsListQuery = { + __typename?: 'Query'; + proposalsConnection?: { + __typename?: 'ProposalsConnection'; + edges?: Array<{ + __typename?: 'ProposalEdge'; + node: { + __typename?: 'Proposal'; + id?: string | null; + reference: string; + state: Types.ProposalState; + datetime: any; + rejectionReason?: Types.ProposalRejectionReason | null; + errorDetails?: string | null; + requiredMajority: string; + requiredParticipation: string; + requiredLpMajority?: string | null; + requiredLpParticipation?: string | null; + rationale: { + __typename?: 'ProposalRationale'; + title: string; + description: string; + }; + party: { __typename?: 'Party'; id: string }; + votes: { + __typename?: 'ProposalVotes'; + yes: { + __typename?: 'ProposalVoteSide'; + totalTokens: string; + totalNumber: string; + totalWeight: string; + }; + no: { + __typename?: 'ProposalVoteSide'; + totalTokens: string; + totalNumber: string; + totalWeight: string; + }; + }; + terms: { + __typename?: 'ProposalTerms'; + closingDatetime: any; + enactmentDatetime?: any | null; + change: + | { + __typename: 'NewAsset'; + name: string; + symbol: string; + decimals: number; + quantum: string; + source: + | { __typename?: 'BuiltinAsset'; maxFaucetAmountMint: string } + | { + __typename?: 'ERC20'; + contractAddress: string; + lifetimeLimit: string; + withdrawThreshold: string; + }; + } + | { __typename: 'NewFreeform' } + | { + __typename: 'NewMarket'; + decimalPlaces: number; + metadata?: Array | null; + lpPriceRange: string; + instrument: { + __typename?: 'InstrumentConfiguration'; + name: string; + code: string; + futureProduct?: { + __typename?: 'FutureProduct'; + quoteName: string; + settlementAsset: { + __typename?: 'Asset'; + id: string; + name: string; + symbol: string; + decimals: number; + quantum: string; + }; + dataSourceSpecForSettlementData: { + __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'; + operator: Types.ConditionOperator; + value?: string | null; + }> | null; + }> | null; + }; + } + | { + __typename?: 'DataSourceDefinitionInternal'; + sourceType: { + __typename?: 'DataSourceSpecConfigurationTime'; + conditions: Array<{ + __typename?: 'Condition'; + operator: Types.ConditionOperator; + value?: string | null; + } | null>; + }; + }; + }; + dataSourceSpecForTradingTermination: { + __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'; + operator: Types.ConditionOperator; + value?: string | null; + }> | null; + }> | null; + }; + } + | { + __typename?: 'DataSourceDefinitionInternal'; + sourceType: { + __typename?: 'DataSourceSpecConfigurationTime'; + conditions: Array<{ + __typename?: 'Condition'; + operator: Types.ConditionOperator; + value?: string | null; + } | null>; + }; + }; + }; + dataSourceSpecBinding: { + __typename?: 'DataSourceSpecToFutureBinding'; + settlementDataProperty: string; + tradingTerminationProperty: string; + }; + } | null; + }; + riskParameters: + | { + __typename?: 'LogNormalRiskModel'; + riskAversionParameter: number; + tau: number; + params: { + __typename?: 'LogNormalModelParams'; + mu: number; + r: number; + sigma: number; + }; + } + | { + __typename?: 'SimpleRiskModel'; + params: { + __typename?: 'SimpleRiskModelParams'; + factorLong: number; + factorShort: number; + }; + }; + } + | { + __typename: 'UpdateAsset'; + assetId: string; + quantum: string; + source: { + __typename?: 'UpdateERC20'; + lifetimeLimit: string; + withdrawThreshold: string; + }; + } + | { + __typename: 'UpdateMarket'; + marketId: string; + updateMarketConfiguration: { + __typename?: 'UpdateMarketConfiguration'; + metadata?: Array | null; + instrument: { + __typename?: 'UpdateInstrumentConfiguration'; + code: string; + product: { + __typename?: 'UpdateFutureProduct'; + quoteName: string; + dataSourceSpecForSettlementData: { + __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'; + operator: Types.ConditionOperator; + value?: string | null; + }> | null; + }> | null; + }; + } + | { + __typename?: 'DataSourceDefinitionInternal'; + sourceType: { + __typename?: 'DataSourceSpecConfigurationTime'; + conditions: Array<{ + __typename?: 'Condition'; + operator: Types.ConditionOperator; + value?: string | null; + } | null>; + }; + }; + }; + dataSourceSpecForTradingTermination: { + __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'; + operator: Types.ConditionOperator; + value?: string | null; + }> | null; + }> | null; + }; + } + | { + __typename?: 'DataSourceDefinitionInternal'; + sourceType: { + __typename?: 'DataSourceSpecConfigurationTime'; + conditions: Array<{ + __typename?: 'Condition'; + operator: Types.ConditionOperator; + value?: string | null; + } | null>; + }; + }; + }; + dataSourceSpecBinding: { + __typename?: 'DataSourceSpecToFutureBinding'; + settlementDataProperty: string; + tradingTerminationProperty: string; + }; + }; + }; + priceMonitoringParameters: { + __typename?: 'PriceMonitoringParameters'; + triggers?: Array<{ + __typename?: 'PriceMonitoringTrigger'; + horizonSecs: number; + probability: number; + auctionExtensionSecs: number; + }> | null; + }; + liquidityMonitoringParameters: { + __typename?: 'LiquidityMonitoringParameters'; + triggeringRatio: string; + targetStakeParameters: { + __typename?: 'TargetStakeParameters'; + timeWindow: number; + scalingFactor: number; + }; + }; + riskParameters: + | { + __typename: 'UpdateMarketLogNormalRiskModel'; + logNormal?: { + __typename?: 'LogNormalRiskModel'; + riskAversionParameter: number; + tau: number; + params: { + __typename?: 'LogNormalModelParams'; + mu: number; + r: number; + sigma: number; + }; + } | null; + } + | { + __typename: 'UpdateMarketSimpleRiskModel'; + simple?: { + __typename?: 'SimpleRiskModelParams'; + factorLong: number; + factorShort: number; + } | null; + }; + }; + } + | { + __typename: 'UpdateNetworkParameter'; + networkParameter: { + __typename?: 'NetworkParameter'; + key: string; + value: string; + }; + }; + }; + }; + } | null> | null; + } | null; +}; + +export const NewMarketFieldsFragmentDoc = gql` + fragment NewMarketFields on NewMarket { + instrument { + name + code + futureProduct { + settlementAsset { + id + name + symbol + decimals + quantum + } + quoteName + dataSourceSpecForSettlementData { + sourceType { + ... on DataSourceDefinitionInternal { + sourceType { + ... on DataSourceSpecConfigurationTime { + conditions { + operator + value + } + } + } + } + ... on DataSourceDefinitionExternal { + sourceType { + ... on DataSourceSpecConfiguration { + signers { + signer { + ... on PubKey { + key + } + ... on ETHAddress { + address + } + } + } + filters { + key { + name + type + } + conditions { + operator + value + } + } + } + } + } + } + } + dataSourceSpecForTradingTermination { + sourceType { + ... on DataSourceDefinitionInternal { + sourceType { + ... on DataSourceSpecConfigurationTime { + conditions { + operator + value + } + } + } + } + ... on DataSourceDefinitionExternal { + sourceType { + ... on DataSourceSpecConfiguration { + signers { + signer { + ... on PubKey { + key + } + ... on ETHAddress { + address + } + } + } + filters { + key { + name + type + } + conditions { + operator + value + } + } + } + } + } + } + } + dataSourceSpecBinding { + settlementDataProperty + tradingTerminationProperty + } + } + } + decimalPlaces + riskParameters { + ... on LogNormalRiskModel { + riskAversionParameter + tau + params { + mu + r + sigma + } + } + ... on SimpleRiskModel { + params { + factorLong + factorShort + } + } + } + metadata + lpPriceRange + } +`; +export const UpdateMarketFieldsFragmentDoc = gql` + fragment UpdateMarketFields on UpdateMarket { + marketId + updateMarketConfiguration { + instrument { + code + product { + quoteName + dataSourceSpecForSettlementData { + sourceType { + ... on DataSourceDefinitionInternal { + sourceType { + ... on DataSourceSpecConfigurationTime { + conditions { + operator + value + } + } + } + } + ... on DataSourceDefinitionExternal { + sourceType { + ... on DataSourceSpecConfiguration { + signers { + signer { + ... on PubKey { + key + } + ... on ETHAddress { + address + } + } + } + filters { + key { + name + type + } + conditions { + operator + value + } + } + } + } + } + } + } + dataSourceSpecForTradingTermination { + sourceType { + ... on DataSourceDefinitionInternal { + sourceType { + ... on DataSourceSpecConfigurationTime { + conditions { + operator + value + } + } + } + } + ... on DataSourceDefinitionExternal { + sourceType { + ... on DataSourceSpecConfiguration { + signers { + signer { + ... on PubKey { + key + } + ... on ETHAddress { + address + } + } + } + filters { + key { + name + type + } + conditions { + operator + value + } + } + } + } + } + } + } + dataSourceSpecBinding { + settlementDataProperty + tradingTerminationProperty + } + } + } + metadata + priceMonitoringParameters { + triggers { + horizonSecs + probability + auctionExtensionSecs + } + } + liquidityMonitoringParameters { + targetStakeParameters { + timeWindow + scalingFactor + } + triggeringRatio + } + riskParameters { + __typename + ... on UpdateMarketSimpleRiskModel { + simple { + factorLong + factorShort + } + } + ... on UpdateMarketLogNormalRiskModel { + logNormal { + riskAversionParameter + tau + params { + mu + r + sigma + } + } + } + } + } + } +`; +export const NewAssetFieldsFragmentDoc = gql` + fragment NewAssetFields on NewAsset { + name + symbol + decimals + quantum + source { + ... on BuiltinAsset { + maxFaucetAmountMint + } + ... on ERC20 { + contractAddress + lifetimeLimit + withdrawThreshold + } + } + } +`; +export const UpdateAssetFieldsFragmentDoc = gql` + fragment UpdateAssetFields on UpdateAsset { + assetId + quantum + source { + ... on UpdateERC20 { + lifetimeLimit + withdrawThreshold + } + } + } +`; +export const UpdateNetworkParameterFielsFragmentDoc = gql` + fragment UpdateNetworkParameterFiels on UpdateNetworkParameter { + networkParameter { + key + value + } + } +`; +export const ProposalListFieldsFragmentDoc = gql` + fragment ProposalListFields on Proposal { + id + rationale { + title + description + } + reference + state + datetime + rejectionReason + party { + id + } + votes { + yes { + totalTokens + totalNumber + totalWeight + } + no { + totalTokens + totalNumber + totalWeight + } + } + errorDetails + rejectionReason + requiredMajority + requiredParticipation + requiredLpMajority + requiredLpParticipation + terms { + closingDatetime + enactmentDatetime + change { + __typename + ... on NewMarket { + ...NewMarketFields + } + ... on UpdateMarket { + ...UpdateMarketFields + } + ... on NewAsset { + ...NewAssetFields + } + ... on UpdateAsset { + ...UpdateAssetFields + } + ... on UpdateNetworkParameter { + ...UpdateNetworkParameterFiels + } + } + } + } + ${NewMarketFieldsFragmentDoc} + ${UpdateMarketFieldsFragmentDoc} + ${NewAssetFieldsFragmentDoc} + ${UpdateAssetFieldsFragmentDoc} + ${UpdateNetworkParameterFielsFragmentDoc} +`; +export const ProposalsListDocument = gql` + query ProposalsList($proposalType: ProposalType, $inState: ProposalState) { + proposalsConnection(proposalType: $proposalType, inState: $inState) { + edges { + node { + ...ProposalListFields + } + } + } + } + ${ProposalListFieldsFragmentDoc} +`; + +/** + * __useProposalsListQuery__ + * + * To run a query within a React component, call `useProposalsListQuery` and pass it any options that fit your needs. + * When your component renders, `useProposalsListQuery` 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 } = useProposalsListQuery({ + * variables: { + * proposalType: // value for 'proposalType' + * inState: // value for 'inState' + * }, + * }); + */ +export function useProposalsListQuery( + baseOptions?: Apollo.QueryHookOptions< + ProposalsListQuery, + ProposalsListQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery( + ProposalsListDocument, + options + ); +} +export function useProposalsListLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + ProposalsListQuery, + ProposalsListQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery( + ProposalsListDocument, + options + ); +} +export type ProposalsListQueryHookResult = ReturnType< + typeof useProposalsListQuery +>; +export type ProposalsListLazyQueryHookResult = ReturnType< + typeof useProposalsListLazyQuery +>; +export type ProposalsListQueryResult = Apollo.QueryResult< + ProposalsListQuery, + ProposalsListQueryVariables +>; diff --git a/libs/governance/src/lib/proposals-data-provider/index.ts b/libs/proposals/src/lib/proposals-data-provider/index.ts similarity index 100% rename from libs/governance/src/lib/proposals-data-provider/index.ts rename to libs/proposals/src/lib/proposals-data-provider/index.ts diff --git a/libs/governance/src/lib/proposals-data-provider/proposals-data-provider.tsx b/libs/proposals/src/lib/proposals-data-provider/proposals-data-provider.tsx similarity index 89% rename from libs/governance/src/lib/proposals-data-provider/proposals-data-provider.tsx rename to libs/proposals/src/lib/proposals-data-provider/proposals-data-provider.tsx index 318f08821..749effbeb 100644 --- a/libs/governance/src/lib/proposals-data-provider/proposals-data-provider.tsx +++ b/libs/proposals/src/lib/proposals-data-provider/proposals-data-provider.tsx @@ -1,4 +1,4 @@ -import { makeDataProvider } from '@vegaprotocol/react-helpers'; +import { makeDataProvider } from '@vegaprotocol/utils'; import type { ProposalsListQuery, ProposalListFieldsFragment, diff --git a/libs/governance/src/lib/proposals-data-provider/proposals.mock.ts b/libs/proposals/src/lib/proposals-data-provider/proposals.mock.ts similarity index 100% rename from libs/governance/src/lib/proposals-data-provider/proposals.mock.ts rename to libs/proposals/src/lib/proposals-data-provider/proposals.mock.ts diff --git a/libs/governance/src/lib/proposals-hooks/Proposal.graphql b/libs/proposals/src/lib/proposals-hooks/Proposal.graphql similarity index 100% rename from libs/governance/src/lib/proposals-hooks/Proposal.graphql rename to libs/proposals/src/lib/proposals-hooks/Proposal.graphql diff --git a/libs/proposals/src/lib/proposals-hooks/__generated__/Proposal.ts b/libs/proposals/src/lib/proposals-hooks/__generated__/Proposal.ts new file mode 100644 index 000000000..e942c3937 --- /dev/null +++ b/libs/proposals/src/lib/proposals-hooks/__generated__/Proposal.ts @@ -0,0 +1,270 @@ +import * as Types from '@vegaprotocol/types'; + +import { gql } from '@apollo/client'; +import { UpdateNetworkParameterFielsFragmentDoc } from '../../proposals-data-provider/__generated__/Proposals'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type ProposalEventFieldsFragment = { + __typename?: 'Proposal'; + id?: string | null; + reference: string; + state: Types.ProposalState; + rejectionReason?: Types.ProposalRejectionReason | null; + errorDetails?: string | null; +}; + +export type ProposalEventSubscriptionVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + +export type ProposalEventSubscription = { + __typename?: 'Subscription'; + proposals: { + __typename?: 'Proposal'; + id?: string | null; + reference: string; + state: Types.ProposalState; + rejectionReason?: Types.ProposalRejectionReason | null; + errorDetails?: string | null; + }; +}; + +export type UpdateNetworkParameterProposalFragment = { + __typename?: 'Proposal'; + id?: string | null; + state: Types.ProposalState; + datetime: any; + terms: { + __typename?: 'ProposalTerms'; + enactmentDatetime?: any | null; + change: + | { __typename?: 'NewAsset' } + | { __typename?: 'NewFreeform' } + | { __typename?: 'NewMarket' } + | { __typename?: 'UpdateAsset' } + | { __typename?: 'UpdateMarket' } + | { + __typename?: 'UpdateNetworkParameter'; + networkParameter: { + __typename?: 'NetworkParameter'; + key: string; + value: string; + }; + }; + }; +}; + +export type OnUpdateNetworkParametersSubscriptionVariables = Types.Exact<{ + [key: string]: never; +}>; + +export type OnUpdateNetworkParametersSubscription = { + __typename?: 'Subscription'; + proposals: { + __typename?: 'Proposal'; + id?: string | null; + state: Types.ProposalState; + datetime: any; + terms: { + __typename?: 'ProposalTerms'; + enactmentDatetime?: any | null; + change: + | { __typename?: 'NewAsset' } + | { __typename?: 'NewFreeform' } + | { __typename?: 'NewMarket' } + | { __typename?: 'UpdateAsset' } + | { __typename?: 'UpdateMarket' } + | { + __typename?: 'UpdateNetworkParameter'; + networkParameter: { + __typename?: 'NetworkParameter'; + key: string; + value: string; + }; + }; + }; + }; +}; + +export type ProposalOfMarketQueryVariables = Types.Exact<{ + marketId: Types.Scalars['ID']; +}>; + +export type ProposalOfMarketQuery = { + __typename?: 'Query'; + proposal?: { + __typename?: 'Proposal'; + id?: string | null; + terms: { __typename?: 'ProposalTerms'; enactmentDatetime?: any | null }; + } | null; +}; + +export const ProposalEventFieldsFragmentDoc = gql` + fragment ProposalEventFields on Proposal { + id + reference + state + rejectionReason + errorDetails + } +`; +export const UpdateNetworkParameterProposalFragmentDoc = gql` + fragment UpdateNetworkParameterProposal on Proposal { + id + state + datetime + terms { + enactmentDatetime + change { + ... on UpdateNetworkParameter { + ...UpdateNetworkParameterFiels + } + } + } + } + ${UpdateNetworkParameterFielsFragmentDoc} +`; +export const ProposalEventDocument = gql` + subscription ProposalEvent($partyId: ID!) { + proposals(partyId: $partyId) { + ...ProposalEventFields + } + } + ${ProposalEventFieldsFragmentDoc} +`; + +/** + * __useProposalEventSubscription__ + * + * To run a query within a React component, call `useProposalEventSubscription` and pass it any options that fit your needs. + * When your component renders, `useProposalEventSubscription` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useProposalEventSubscription({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function useProposalEventSubscription( + baseOptions: Apollo.SubscriptionHookOptions< + ProposalEventSubscription, + ProposalEventSubscriptionVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useSubscription< + ProposalEventSubscription, + ProposalEventSubscriptionVariables + >(ProposalEventDocument, options); +} +export type ProposalEventSubscriptionHookResult = ReturnType< + typeof useProposalEventSubscription +>; +export type ProposalEventSubscriptionResult = + Apollo.SubscriptionResult; +export const OnUpdateNetworkParametersDocument = gql` + subscription OnUpdateNetworkParameters { + proposals { + ...UpdateNetworkParameterProposal + } + } + ${UpdateNetworkParameterProposalFragmentDoc} +`; + +/** + * __useOnUpdateNetworkParametersSubscription__ + * + * To run a query within a React component, call `useOnUpdateNetworkParametersSubscription` and pass it any options that fit your needs. + * When your component renders, `useOnUpdateNetworkParametersSubscription` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useOnUpdateNetworkParametersSubscription({ + * variables: { + * }, + * }); + */ +export function useOnUpdateNetworkParametersSubscription( + baseOptions?: Apollo.SubscriptionHookOptions< + OnUpdateNetworkParametersSubscription, + OnUpdateNetworkParametersSubscriptionVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useSubscription< + OnUpdateNetworkParametersSubscription, + OnUpdateNetworkParametersSubscriptionVariables + >(OnUpdateNetworkParametersDocument, options); +} +export type OnUpdateNetworkParametersSubscriptionHookResult = ReturnType< + typeof useOnUpdateNetworkParametersSubscription +>; +export type OnUpdateNetworkParametersSubscriptionResult = + Apollo.SubscriptionResult; +export const ProposalOfMarketDocument = gql` + query ProposalOfMarket($marketId: ID!) { + proposal(id: $marketId) { + id + terms { + enactmentDatetime + } + } + } +`; + +/** + * __useProposalOfMarketQuery__ + * + * To run a query within a React component, call `useProposalOfMarketQuery` and pass it any options that fit your needs. + * When your component renders, `useProposalOfMarketQuery` 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 } = useProposalOfMarketQuery({ + * variables: { + * marketId: // value for 'marketId' + * }, + * }); + */ +export function useProposalOfMarketQuery( + baseOptions: Apollo.QueryHookOptions< + ProposalOfMarketQuery, + ProposalOfMarketQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useQuery( + ProposalOfMarketDocument, + options + ); +} +export function useProposalOfMarketLazyQuery( + baseOptions?: Apollo.LazyQueryHookOptions< + ProposalOfMarketQuery, + ProposalOfMarketQueryVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useLazyQuery< + ProposalOfMarketQuery, + ProposalOfMarketQueryVariables + >(ProposalOfMarketDocument, options); +} +export type ProposalOfMarketQueryHookResult = ReturnType< + typeof useProposalOfMarketQuery +>; +export type ProposalOfMarketLazyQueryHookResult = ReturnType< + typeof useProposalOfMarketLazyQuery +>; +export type ProposalOfMarketQueryResult = Apollo.QueryResult< + ProposalOfMarketQuery, + ProposalOfMarketQueryVariables +>; diff --git a/libs/governance/src/lib/proposals-hooks/index.ts b/libs/proposals/src/lib/proposals-hooks/index.ts similarity index 100% rename from libs/governance/src/lib/proposals-hooks/index.ts rename to libs/proposals/src/lib/proposals-hooks/index.ts diff --git a/libs/governance/src/lib/proposals-hooks/use-proposal-event.ts b/libs/proposals/src/lib/proposals-hooks/use-proposal-event.ts similarity index 100% rename from libs/governance/src/lib/proposals-hooks/use-proposal-event.ts rename to libs/proposals/src/lib/proposals-hooks/use-proposal-event.ts diff --git a/libs/governance/src/lib/proposals-hooks/use-proposal-submit.ts b/libs/proposals/src/lib/proposals-hooks/use-proposal-submit.ts similarity index 100% rename from libs/governance/src/lib/proposals-hooks/use-proposal-submit.ts rename to libs/proposals/src/lib/proposals-hooks/use-proposal-submit.ts diff --git a/libs/governance/src/lib/proposals-hooks/use-update-network-paramaters-toasts.tsx b/libs/proposals/src/lib/proposals-hooks/use-update-network-paramaters-toasts.tsx similarity index 96% rename from libs/governance/src/lib/proposals-hooks/use-update-network-paramaters-toasts.tsx rename to libs/proposals/src/lib/proposals-hooks/use-update-network-paramaters-toasts.tsx index 6681d52c9..6145262cd 100644 --- a/libs/governance/src/lib/proposals-hooks/use-update-network-paramaters-toasts.tsx +++ b/libs/proposals/src/lib/proposals-hooks/use-update-network-paramaters-toasts.tsx @@ -1,5 +1,6 @@ import { DApp, TOKEN_PROPOSAL, useLinks } from '@vegaprotocol/environment'; -import { getDateTimeFormat, t } from '@vegaprotocol/react-helpers'; +import { getDateTimeFormat } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import type { UpdateNetworkParameter } from '@vegaprotocol/types'; import { ProposalStateMapping } from '@vegaprotocol/types'; import { ProposalState } from '@vegaprotocol/types'; diff --git a/libs/governance/src/lib/proposals-hooks/use-update-network-parameters-toasts.spec.tsx b/libs/proposals/src/lib/proposals-hooks/use-update-network-parameters-toasts.spec.tsx similarity index 100% rename from libs/governance/src/lib/proposals-hooks/use-update-network-parameters-toasts.spec.tsx rename to libs/proposals/src/lib/proposals-hooks/use-update-network-parameters-toasts.spec.tsx diff --git a/libs/governance/src/lib/proposals-hooks/use-update-proposal.spec.ts b/libs/proposals/src/lib/proposals-hooks/use-update-proposal.spec.ts similarity index 100% rename from libs/governance/src/lib/proposals-hooks/use-update-proposal.spec.ts rename to libs/proposals/src/lib/proposals-hooks/use-update-proposal.spec.ts diff --git a/libs/governance/src/lib/proposals-hooks/use-update-proposal.ts b/libs/proposals/src/lib/proposals-hooks/use-update-proposal.ts similarity index 100% rename from libs/governance/src/lib/proposals-hooks/use-update-proposal.ts rename to libs/proposals/src/lib/proposals-hooks/use-update-proposal.ts diff --git a/libs/governance/src/lib/proposals-list/index.ts b/libs/proposals/src/lib/proposals-list/index.ts similarity index 100% rename from libs/governance/src/lib/proposals-list/index.ts rename to libs/proposals/src/lib/proposals-list/index.ts diff --git a/libs/governance/src/lib/proposals-list/proposal-list.spec.tsx b/libs/proposals/src/lib/proposals-list/proposal-list.spec.tsx similarity index 100% rename from libs/governance/src/lib/proposals-list/proposal-list.spec.tsx rename to libs/proposals/src/lib/proposals-list/proposal-list.spec.tsx diff --git a/libs/governance/src/lib/proposals-list/proposals-list.tsx b/libs/proposals/src/lib/proposals-list/proposals-list.tsx similarity index 93% rename from libs/governance/src/lib/proposals-list/proposals-list.tsx rename to libs/proposals/src/lib/proposals-list/proposals-list.tsx index 7dd90060d..1540c448c 100644 --- a/libs/governance/src/lib/proposals-list/proposals-list.tsx +++ b/libs/proposals/src/lib/proposals-list/proposals-list.tsx @@ -1,7 +1,5 @@ -import { - AgGridDynamic as AgGrid, - AsyncRenderer, -} from '@vegaprotocol/ui-toolkit'; +import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; +import { AgGridDynamic as AgGrid } from '@vegaprotocol/datagrid'; import { useDataProvider } from '@vegaprotocol/react-helpers'; import * as Types from '@vegaprotocol/types'; import { proposalsDataProvider } from '../proposals-data-provider'; diff --git a/libs/governance/src/lib/proposals-list/use-column-defs.tsx b/libs/proposals/src/lib/proposals-list/use-column-defs.tsx similarity index 95% rename from libs/governance/src/lib/proposals-list/use-column-defs.tsx rename to libs/proposals/src/lib/proposals-list/use-column-defs.tsx index 27724cf58..097b0d7e4 100644 --- a/libs/governance/src/lib/proposals-list/use-column-defs.tsx +++ b/libs/proposals/src/lib/proposals-list/use-column-defs.tsx @@ -2,16 +2,13 @@ import { useMemo } from 'react'; import BigNumber from 'bignumber.js'; import type { ColDef } from 'ag-grid-community'; import { useEnvironment } from '@vegaprotocol/environment'; -import { - t, - NetworkParams, - useNetworkParams, - getDateTimeFormat, -} from '@vegaprotocol/react-helpers'; +import { getDateTimeFormat } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; +import { NetworkParams, useNetworkParams } from '@vegaprotocol/react-helpers'; import type { VegaICellRendererParams, VegaValueFormatterParams, -} from '@vegaprotocol/ui-toolkit'; +} from '@vegaprotocol/datagrid'; import { ExternalLink } from '@vegaprotocol/ui-toolkit'; import { ProposalStateMapping } from '@vegaprotocol/types'; import type { ProposalListFieldsFragment } from '../proposals-data-provider/__generated__/Proposals'; diff --git a/libs/governance/src/lib/voting-hooks/VoteSubsciption.graphql b/libs/proposals/src/lib/voting-hooks/VoteSubsciption.graphql similarity index 100% rename from libs/governance/src/lib/voting-hooks/VoteSubsciption.graphql rename to libs/proposals/src/lib/voting-hooks/VoteSubsciption.graphql diff --git a/libs/proposals/src/lib/voting-hooks/__generated__/VoteSubsciption.ts b/libs/proposals/src/lib/voting-hooks/__generated__/VoteSubsciption.ts new file mode 100644 index 000000000..fd59eaa3d --- /dev/null +++ b/libs/proposals/src/lib/voting-hooks/__generated__/VoteSubsciption.ts @@ -0,0 +1,75 @@ +import * as Types from '@vegaprotocol/types'; + +import { gql } from '@apollo/client'; +import * as Apollo from '@apollo/client'; +const defaultOptions = {} as const; +export type VoteEventFieldsFragment = { + __typename?: 'ProposalVote'; + proposalId: string; + vote: { __typename?: 'Vote'; value: Types.VoteValue; datetime: any }; +}; + +export type VoteEventSubscriptionVariables = Types.Exact<{ + partyId: Types.Scalars['ID']; +}>; + +export type VoteEventSubscription = { + __typename?: 'Subscription'; + votes: { + __typename?: 'ProposalVote'; + proposalId: string; + vote: { __typename?: 'Vote'; value: Types.VoteValue; datetime: any }; + }; +}; + +export const VoteEventFieldsFragmentDoc = gql` + fragment VoteEventFields on ProposalVote { + proposalId + vote { + value + datetime + } + } +`; +export const VoteEventDocument = gql` + subscription VoteEvent($partyId: ID!) { + votes(partyId: $partyId) { + ...VoteEventFields + } + } + ${VoteEventFieldsFragmentDoc} +`; + +/** + * __useVoteEventSubscription__ + * + * To run a query within a React component, call `useVoteEventSubscription` and pass it any options that fit your needs. + * When your component renders, `useVoteEventSubscription` returns an object from Apollo Client that contains loading, error, and data properties + * you can use to render your UI. + * + * @param baseOptions options that will be passed into the subscription, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; + * + * @example + * const { data, loading, error } = useVoteEventSubscription({ + * variables: { + * partyId: // value for 'partyId' + * }, + * }); + */ +export function useVoteEventSubscription( + baseOptions: Apollo.SubscriptionHookOptions< + VoteEventSubscription, + VoteEventSubscriptionVariables + > +) { + const options = { ...defaultOptions, ...baseOptions }; + return Apollo.useSubscription< + VoteEventSubscription, + VoteEventSubscriptionVariables + >(VoteEventDocument, options); +} +export type VoteEventSubscriptionHookResult = ReturnType< + typeof useVoteEventSubscription +>; +export type VoteEventSubscriptionResult = + Apollo.SubscriptionResult; diff --git a/libs/governance/src/lib/voting-hooks/index.ts b/libs/proposals/src/lib/voting-hooks/index.ts similarity index 100% rename from libs/governance/src/lib/voting-hooks/index.ts rename to libs/proposals/src/lib/voting-hooks/index.ts diff --git a/libs/governance/src/lib/voting-hooks/use-vote-event.ts b/libs/proposals/src/lib/voting-hooks/use-vote-event.ts similarity index 100% rename from libs/governance/src/lib/voting-hooks/use-vote-event.ts rename to libs/proposals/src/lib/voting-hooks/use-vote-event.ts diff --git a/libs/governance/src/lib/voting-hooks/use-vote-submit.ts b/libs/proposals/src/lib/voting-hooks/use-vote-submit.ts similarity index 100% rename from libs/governance/src/lib/voting-hooks/use-vote-submit.ts rename to libs/proposals/src/lib/voting-hooks/use-vote-submit.ts diff --git a/libs/governance/src/lib/voting-progress/index.ts b/libs/proposals/src/lib/voting-progress/index.ts similarity index 100% rename from libs/governance/src/lib/voting-progress/index.ts rename to libs/proposals/src/lib/voting-progress/index.ts diff --git a/libs/governance/src/lib/voting-progress/vote-progress.spec.tsx b/libs/proposals/src/lib/voting-progress/vote-progress.spec.tsx similarity index 100% rename from libs/governance/src/lib/voting-progress/vote-progress.spec.tsx rename to libs/proposals/src/lib/voting-progress/vote-progress.spec.tsx diff --git a/libs/governance/src/lib/voting-progress/voting-progress.tsx b/libs/proposals/src/lib/voting-progress/voting-progress.tsx similarity index 100% rename from libs/governance/src/lib/voting-progress/voting-progress.tsx rename to libs/proposals/src/lib/voting-progress/voting-progress.tsx diff --git a/libs/proposals/src/setup-tests.ts b/libs/proposals/src/setup-tests.ts new file mode 100644 index 000000000..7b0828bfa --- /dev/null +++ b/libs/proposals/src/setup-tests.ts @@ -0,0 +1 @@ +import '@testing-library/jest-dom'; diff --git a/libs/governance/src/utils/deadline-helpers.spec.ts b/libs/proposals/src/utils/deadline-helpers.spec.ts similarity index 100% rename from libs/governance/src/utils/deadline-helpers.spec.ts rename to libs/proposals/src/utils/deadline-helpers.spec.ts diff --git a/libs/governance/src/utils/deadline-helpers.ts b/libs/proposals/src/utils/deadline-helpers.ts similarity index 100% rename from libs/governance/src/utils/deadline-helpers.ts rename to libs/proposals/src/utils/deadline-helpers.ts diff --git a/libs/governance/src/utils/get-closing-timestamp.spec.ts b/libs/proposals/src/utils/get-closing-timestamp.spec.ts similarity index 100% rename from libs/governance/src/utils/get-closing-timestamp.spec.ts rename to libs/proposals/src/utils/get-closing-timestamp.spec.ts diff --git a/libs/governance/src/utils/get-closing-timestamp.ts b/libs/proposals/src/utils/get-closing-timestamp.ts similarity index 100% rename from libs/governance/src/utils/get-closing-timestamp.ts rename to libs/proposals/src/utils/get-closing-timestamp.ts diff --git a/libs/governance/src/utils/get-enactment-timestamp.spec.ts b/libs/proposals/src/utils/get-enactment-timestamp.spec.ts similarity index 100% rename from libs/governance/src/utils/get-enactment-timestamp.spec.ts rename to libs/proposals/src/utils/get-enactment-timestamp.spec.ts diff --git a/libs/governance/src/utils/get-enactment-timestamp.ts b/libs/proposals/src/utils/get-enactment-timestamp.ts similarity index 100% rename from libs/governance/src/utils/get-enactment-timestamp.ts rename to libs/proposals/src/utils/get-enactment-timestamp.ts diff --git a/libs/governance/src/utils/get-validation-timestamp.spec.ts b/libs/proposals/src/utils/get-validation-timestamp.spec.ts similarity index 100% rename from libs/governance/src/utils/get-validation-timestamp.spec.ts rename to libs/proposals/src/utils/get-validation-timestamp.spec.ts diff --git a/libs/governance/src/utils/get-validation-timestamp.ts b/libs/proposals/src/utils/get-validation-timestamp.ts similarity index 100% rename from libs/governance/src/utils/get-validation-timestamp.ts rename to libs/proposals/src/utils/get-validation-timestamp.ts diff --git a/libs/governance/src/utils/index.ts b/libs/proposals/src/utils/index.ts similarity index 100% rename from libs/governance/src/utils/index.ts rename to libs/proposals/src/utils/index.ts diff --git a/libs/governance/src/utils/proposal-dialog-helpers.tsx b/libs/proposals/src/utils/proposal-dialog-helpers.tsx similarity index 97% rename from libs/governance/src/utils/proposal-dialog-helpers.tsx rename to libs/proposals/src/utils/proposal-dialog-helpers.tsx index f351d16f8..342a882a7 100644 --- a/libs/governance/src/utils/proposal-dialog-helpers.tsx +++ b/libs/proposals/src/utils/proposal-dialog-helpers.tsx @@ -1,5 +1,5 @@ import { ProposalState } from '@vegaprotocol/types'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Icon, Intent } from '@vegaprotocol/ui-toolkit'; import type { ReactNode } from 'react'; diff --git a/libs/governance/tsconfig.json b/libs/proposals/tsconfig.json similarity index 100% rename from libs/governance/tsconfig.json rename to libs/proposals/tsconfig.json diff --git a/libs/governance/tsconfig.lib.json b/libs/proposals/tsconfig.lib.json similarity index 100% rename from libs/governance/tsconfig.lib.json rename to libs/proposals/tsconfig.lib.json diff --git a/libs/governance/tsconfig.spec.json b/libs/proposals/tsconfig.spec.json similarity index 100% rename from libs/governance/tsconfig.spec.json rename to libs/proposals/tsconfig.spec.json diff --git a/libs/react-helpers/src/hooks/index.ts b/libs/react-helpers/src/hooks/index.ts index 3567c15a9..790a8d714 100644 --- a/libs/react-helpers/src/hooks/index.ts +++ b/libs/react-helpers/src/hooks/index.ts @@ -2,9 +2,11 @@ export * from './__generated__/NetworkParams'; export * from './use-apply-grid-transaction'; export * from './use-data-provider'; export * from './use-fetch'; +export * from './use-local-storage'; export * from './use-mutation-observer'; export * from './use-network-params'; export * from './use-navigator-online'; +export * from './use-number-parts'; export * from './use-outside-click'; export * from './use-resize-observer'; export * from './use-resize'; diff --git a/libs/react-helpers/src/hooks/use-data-provider.spec.ts b/libs/react-helpers/src/hooks/use-data-provider.spec.ts index 47aee7a78..f8dad028f 100644 --- a/libs/react-helpers/src/hooks/use-data-provider.spec.ts +++ b/libs/react-helpers/src/hooks/use-data-provider.spec.ts @@ -1,7 +1,7 @@ import { renderHook, act } from '@testing-library/react'; import { useDataProvider, useThrottledDataProvider } from './use-data-provider'; import type { useDataProviderParams } from './use-data-provider'; -import type { Subscribe, UpdateCallback } from '../lib/generic-data-provider'; +import type { Subscribe, UpdateCallback } from '@vegaprotocol/utils'; import { MockedProvider } from '@apollo/client/testing'; type Data = number; diff --git a/libs/react-helpers/src/hooks/use-data-provider.ts b/libs/react-helpers/src/hooks/use-data-provider.ts index 7dd4d2c85..908f36498 100644 --- a/libs/react-helpers/src/hooks/use-data-provider.ts +++ b/libs/react-helpers/src/hooks/use-data-provider.ts @@ -4,11 +4,7 @@ import isEqual from 'lodash/isEqual'; import { useApolloClient } from '@apollo/client'; import { usePrevious } from './use-previous'; import type { OperationVariables } from '@apollo/client'; -import type { - Subscribe, - Load, - UpdateCallback, -} from '../lib/generic-data-provider'; +import type { Subscribe, Load, UpdateCallback } from '@vegaprotocol/utils'; export interface useDataProviderParams< Data, diff --git a/libs/react-helpers/src/lib/storage/local-storage.spec.ts b/libs/react-helpers/src/hooks/use-local-storage.spec.ts similarity index 97% rename from libs/react-helpers/src/lib/storage/local-storage.spec.ts rename to libs/react-helpers/src/hooks/use-local-storage.spec.ts index 1d8aed501..2ac2388e1 100644 --- a/libs/react-helpers/src/lib/storage/local-storage.spec.ts +++ b/libs/react-helpers/src/hooks/use-local-storage.spec.ts @@ -1,5 +1,5 @@ import { act, renderHook } from '@testing-library/react'; -import { useLocalStorage } from './local-storage'; +import { useLocalStorage } from './use-local-storage'; describe('useLocalStorage', () => { afterEach(() => window.localStorage.clear()); diff --git a/libs/react-helpers/src/lib/storage/local-storage.ts b/libs/react-helpers/src/hooks/use-local-storage.ts similarity index 72% rename from libs/react-helpers/src/lib/storage/local-storage.ts rename to libs/react-helpers/src/hooks/use-local-storage.ts index 5d0341b91..d542d08db 100644 --- a/libs/react-helpers/src/lib/storage/local-storage.ts +++ b/libs/react-helpers/src/hooks/use-local-storage.ts @@ -1,33 +1,5 @@ import { useCallback, useEffect, useMemo, useSyncExternalStore } from 'react'; - -export const LocalStorage = { - getItem: (key: string) => { - if (typeof window === 'undefined') return; - try { - const item = window.localStorage.getItem(key); - return item; - } catch (error) { - console.error(error); - return null; - } - }, - setItem: (key: string, value: string) => { - if (typeof window === 'undefined') return; - try { - window.localStorage.setItem(key, value); - } catch (error) { - console.error(error); - } - }, - removeItem: (key: string) => { - if (typeof window === 'undefined') return; - try { - window.localStorage.removeItem(key); - } catch (error) { - console.error(error); - } - }, -}; +import { LocalStorage } from '@vegaprotocol/utils'; type LocalStorageCallback = (key: string) => void; const LOCAL_STORAGE_CALLBACKS = new Set(); diff --git a/libs/react-helpers/src/hooks/use-logger.ts b/libs/react-helpers/src/hooks/use-logger.ts index fd9fc7eb8..f19227151 100644 --- a/libs/react-helpers/src/hooks/use-logger.ts +++ b/libs/react-helpers/src/hooks/use-logger.ts @@ -1,8 +1,8 @@ import { useRef } from 'react'; import { BrowserTracing } from '@sentry/tracing'; import * as Sentry from '@sentry/browser'; -import type { LocalLogger } from '../lib/local-logger'; -import { localLoggerFactory } from '../lib/local-logger'; +import type { LocalLogger } from '@vegaprotocol/utils'; +import { localLoggerFactory } from '@vegaprotocol/utils'; interface Props { dsn?: string; diff --git a/libs/react-helpers/src/hooks/use-number-parts.ts b/libs/react-helpers/src/hooks/use-number-parts.ts new file mode 100644 index 000000000..606e854a8 --- /dev/null +++ b/libs/react-helpers/src/hooks/use-number-parts.ts @@ -0,0 +1,10 @@ +import { useMemo } from 'react'; +import type { BigNumber } from 'bignumber.js'; +import { toNumberParts } from '@vegaprotocol/utils'; + +export const useNumberParts = ( + value: BigNumber | null | undefined, + decimals: number +): [integers: string, decimalPlaces: string] => { + return useMemo(() => toNumberParts(value, decimals), [decimals, value]); +}; diff --git a/libs/react-helpers/src/hooks/use-theme-switcher.ts b/libs/react-helpers/src/hooks/use-theme-switcher.ts index 9778de0db..32882c91b 100644 --- a/libs/react-helpers/src/hooks/use-theme-switcher.ts +++ b/libs/react-helpers/src/hooks/use-theme-switcher.ts @@ -1,5 +1,5 @@ import { create } from 'zustand'; -import { LocalStorage } from '../lib/storage'; +import { LocalStorage } from '@vegaprotocol/utils'; const THEME_STORAGE_KEY = 'theme'; const Themes = { diff --git a/libs/react-helpers/src/lib/data-grid/index.ts b/libs/react-helpers/src/lib/data-grid/index.ts deleted file mode 100644 index 143006fef..000000000 --- a/libs/react-helpers/src/lib/data-grid/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './data-grid'; diff --git a/libs/react-helpers/src/lib/format/index.ts b/libs/react-helpers/src/lib/format/index.ts index 0aca8c478..3238b292c 100644 --- a/libs/react-helpers/src/lib/format/index.ts +++ b/libs/react-helpers/src/lib/format/index.ts @@ -1,5 +1 @@ -export * from './date'; export * from './number'; -export * from './size'; -export * from './strings'; -export * from './utils'; diff --git a/libs/react-helpers/src/lib/format/number.spec.tsx b/libs/react-helpers/src/lib/format/number.spec.tsx index 21a6bdb4d..9dd693568 100644 --- a/libs/react-helpers/src/lib/format/number.spec.tsx +++ b/libs/react-helpers/src/lib/format/number.spec.tsx @@ -1,116 +1,10 @@ +import { render, screen } from '@testing-library/react'; import BigNumber from 'bignumber.js'; -import { - addDecimalsFormatNumber, - compactNumber, - formatNumber, - formatNumberPercentage, - isNumeric, - toDecimal, - toNumberParts, -} from './number'; +import { CompactNumber } from './number'; -describe('number react-helpers', () => { - it.each([ - { v: new BigNumber(123000), d: 5, o: '1.23' }, - { v: new BigNumber(123000), d: 3, o: '123.00' }, - { v: new BigNumber(123000), d: 1, o: '12,300.0' }, - { v: new BigNumber(123001), d: 2, o: '1,230.01' }, - { v: new BigNumber(123001000), d: 2, o: '1,230,010.00' }, - ])( - 'formats with addDecimalsFormatNumber given number correctly', - ({ v, d, o }) => { - expect(addDecimalsFormatNumber(v.toString(), d)).toStrictEqual(o); - } - ); - - it.each([ - { v: new BigNumber(123), d: 3, o: '123.00' }, - { v: new BigNumber(123.123), d: 3, o: '123.123' }, - { v: new BigNumber(123.6666), d: 3, o: '123.667' }, - { v: new BigNumber(123.123), d: 6, o: '123.123' }, - { v: new BigNumber(123.123), d: 0, o: '123' }, - { v: new BigNumber(123), d: undefined, o: '123' }, - { v: new BigNumber(30000), d: undefined, o: '30,000' }, - { v: new BigNumber(3.000001), d: undefined, o: '3' }, - ])('formats with formatNumber given number correctly', ({ v, d, o }) => { - expect(formatNumber(v, d)).toStrictEqual(o); - }); - - it.each([ - { v: new BigNumber(123), d: 3, o: '123.00%' }, - { v: new BigNumber(123.123), d: 3, o: '123.123%' }, - { v: new BigNumber(123.123), d: 6, o: '123.123%' }, - { v: new BigNumber(123.123), d: 0, o: '123%' }, - { v: new BigNumber(123), d: undefined, o: '123.00%' }, // it default to 2 decimal places - { v: new BigNumber(30000), d: undefined, o: '30,000.00%' }, - { v: new BigNumber(3.000001), d: undefined, o: '3.000001%' }, - ])('formats given number correctly', ({ v, d, o }) => { - expect(formatNumberPercentage(v, d)).toStrictEqual(o); - }); -}); - -describe('toNumberParts', () => { - it.each([ - { v: null, d: 3, o: ['0', '000'] }, - { v: undefined, d: 3, o: ['0', '000'] }, - { v: new BigNumber(123), d: 3, o: ['123', '00'] }, - { v: new BigNumber(123.123), d: 3, o: ['123', '123'] }, - { v: new BigNumber(123.123), d: 6, o: ['123', '123'] }, - { v: new BigNumber(123.123), d: 0, o: ['123', ''] }, - { v: new BigNumber(123), d: undefined, o: ['123', '00'] }, - { - v: new BigNumber(30000), - d: undefined, - o: ['30,000', '00'], - }, - ])('returns correct tuple given the different arguments', ({ v, d, o }) => { - expect(toNumberParts(v, d)).toStrictEqual(o); - }); -}); - -describe('isNumeric', () => { - it.each([ - { i: null, o: false }, - { i: undefined, o: false }, - { i: 1, o: true }, - { i: '1', o: true }, - { i: '-1', o: true }, - { i: 0.1, o: true }, - { i: '.1', o: true }, - { i: '-.1', o: true }, - { i: 123, o: true }, - { i: -123, o: true }, - { i: '123', o: true }, - { i: '123.01', o: true }, - { i: '-123.01', o: true }, - { i: '--123.01', o: false }, - { i: '123.', o: false }, - { i: '123.1.1', o: false }, - { i: BigInt(123), o: true }, - { i: BigInt(-1), o: true }, - { i: new BigNumber(123), o: true }, - { i: new BigNumber(123.123), o: true }, - { i: new BigNumber(123.123).toString(), o: true }, - { i: new BigNumber(123), o: true }, - { i: Infinity, o: false }, - { i: NaN, o: false }, - ])( - 'returns correct results', - ({ - i, - o, - }: { - i: number | string | undefined | null | BigNumber | bigint; - o: boolean; - }) => { - expect(isNumeric(i)).toStrictEqual(o); - } - ); -}); - -describe('compactNumber', () => { - const short: [BigNumber, string | JSX.Element, number | 'infer'][] = [ +describe('CompactNumber', () => { + const short: [BigNumber, string, number | 'infer'][] = [ [new BigNumber(Infinity), '∞', 'infer'], [new BigNumber(-Infinity), '-∞', 'infer'], [new BigNumber(0), '0', 'infer'], @@ -125,36 +19,18 @@ describe('compactNumber', () => { [new BigNumber(1_000_000_000_000), '1T', 'infer'], [new BigNumber(3.23e12), '3.23T', 2], [new BigNumber(3.23e12), '3.23000T', 5], - [ - new BigNumber(3.23e24), - - 3.23000{' '} - - × 1024 - - , - 5, - ], - [ - new BigNumber(1.579208923731619e59), - - 1.57921{' '} - - × 10 - 59 - - , - 5, - ], + [new BigNumber(3.23e24), '3.23000 \u00d7 1024', 5], // \u00d7 is times 'x' + [new BigNumber(1.579208923731619e59), '1.57921 \u00d7 1059', 5], ]; it.each(short)( 'compacts %d to %p (decimal places: %p)', (input, output, decimals) => { - expect(compactNumber(input, decimals)).toEqual(output); + render(); + expect(screen.getByTestId('compact-number')).toHaveTextContent(output); } ); - const long: [BigNumber, string | JSX.Element, number | 'infer'][] = [ + const long: [BigNumber, string, number | 'infer'][] = [ [new BigNumber(Infinity), '∞', 'infer'], [new BigNumber(-Infinity), '-∞', 'infer'], [new BigNumber(0), '0', 'infer'], @@ -169,49 +45,20 @@ describe('compactNumber', () => { [new BigNumber(1_000_000_000_000), '1 trillion', 'infer'], [new BigNumber(3.23e12), '3.23 trillion', 2], [new BigNumber(3.23e12), '3.23000 trillion', 5], - [ - new BigNumber(3.23e24), - - 3.23000{' '} - - × 1024 - - , - 5, - ], - [ - new BigNumber(1.579208923731619e59), - - 1.57921{' '} - - × 10 - 59 - - , - 5, - ], + [new BigNumber(3.23e24), '3.23000 \u00d7 1024', 5], // \u00d7 is times 'x' + [new BigNumber(1.579208923731619e59), '1.57921 \u00d7 1059', 5], // \u00d7 is times 'x' ]; it.each(long)( 'compacts %d to %p (decimal places: %p)', (input, output, decimals) => { - expect(compactNumber(input, decimals, 'long')).toEqual(output); + render( + + ); + expect(screen.getByTestId('compact-number')).toHaveTextContent(output); } ); }); - -describe('toDecimal', () => { - it.each([ - { v: 0, o: '1' }, - { v: 1, o: '0.1' }, - { v: 2, o: '0.01' }, - { v: 3, o: '0.001' }, - { v: 4, o: '0.0001' }, - { v: 5, o: '0.00001' }, - { v: 6, o: '0.000001' }, - { v: 7, o: '0.0000001' }, - { v: 8, o: '0.00000001' }, - { v: 9, o: '0.000000001' }, - ])('formats with toNumber given number correctly', ({ v, o }) => { - expect(toDecimal(v)).toStrictEqual(o); - }); -}); diff --git a/libs/react-helpers/src/lib/format/number.tsx b/libs/react-helpers/src/lib/format/number.tsx index 162a7fad6..a16c94551 100644 --- a/libs/react-helpers/src/lib/format/number.tsx +++ b/libs/react-helpers/src/lib/format/number.tsx @@ -1,147 +1,5 @@ import { BigNumber } from 'bignumber.js'; -import { BigNumber as EthersBigNumber } from 'ethers'; -import isNil from 'lodash/isNil'; -import memoize from 'lodash/memoize'; -import React from 'react'; - -import { getUserLocale } from './utils'; - -const MIN_FRACTION_DIGITS = 2; -const MAX_FRACTION_DIGITS = 20; - -export function toDecimal(numberOfDecimals: number) { - return new BigNumber(1) - .dividedBy(Math.pow(10, numberOfDecimals)) - .toString(10); -} - -export function toBigNum( - rawValue: string | number | EthersBigNumber, - decimals: number -): BigNumber { - return new BigNumber( - rawValue instanceof EthersBigNumber ? rawValue.toString() : rawValue || 0 - ).dividedBy(Math.pow(10, decimals)); -} - -export function addDecimal( - value: string | number | EthersBigNumber, - decimals: number, - decimalPrecision = decimals -): string { - if (!decimals) return value.toString(); - if (!decimalPrecision || decimalPrecision < 0) { - return toBigNum(value, decimals).toFixed(0); - } - return toBigNum(value, decimals).toFixed(decimalPrecision); -} - -export function removeDecimal(value: string, decimals: number): string { - if (!decimals) return value; - return new BigNumber(value || 0).times(Math.pow(10, decimals)).toFixed(0); -} - -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat -export const getNumberFormat = memoize((digits: number) => { - if (isNil(digits) || digits < 0) { - return new Intl.NumberFormat(getUserLocale()); - } - return new Intl.NumberFormat(getUserLocale(), { - minimumFractionDigits: Math.min(Math.max(0, digits), MIN_FRACTION_DIGITS), - maximumFractionDigits: Math.min(Math.max(0, digits), MAX_FRACTION_DIGITS), - }); -}); - -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat -export const getFixedNumberFormat = memoize((digits: number) => { - if (isNil(digits) || digits < 0) { - return new Intl.NumberFormat(getUserLocale()); - } - return new Intl.NumberFormat(getUserLocale(), { - minimumFractionDigits: Math.min(Math.max(0, digits), MAX_FRACTION_DIGITS), - maximumFractionDigits: Math.min(Math.max(0, digits), MAX_FRACTION_DIGITS), - }); -}); - -export const getDecimalSeparator = memoize( - () => - getNumberFormat(1) - .formatToParts(1.1) - .find((part) => part.type === 'decimal')?.value -); - -/** formatNumber will format the number with fixed decimals - * @param rawValue - should be a number that is not outside the safe range fail as in https://mikemcl.github.io/bignumber.js/#toN - * @param formatDecimals - number of decimals to use - */ -export const formatNumber = ( - rawValue: string | number | BigNumber, - formatDecimals = 0 -) => { - return getNumberFormat(formatDecimals).format(Number(rawValue)); -}; - -/** formatNumberFixed will format the number with fixed decimals - * @param rawValue - should be a number that is not outside the safe range fail as in https://mikemcl.github.io/bignumber.js/#toN - * @param formatDecimals - number of decimals to use - */ -export const formatNumberFixed = ( - rawValue: string | number | BigNumber, - formatDecimals = 0 -) => { - return getFixedNumberFormat(formatDecimals).format(Number(rawValue)); -}; - -export const addDecimalsFormatNumber = ( - rawValue: string | number, - decimalPlaces: number, - formatDecimals: number = decimalPlaces -) => { - const x = addDecimal(rawValue, decimalPlaces); - - return formatNumber(x, formatDecimals); -}; - -export const addDecimalsFixedFormatNumber = ( - rawValue: string | number, - decimalPlaces: number, - formatDecimals: number = decimalPlaces -) => { - const x = addDecimal(rawValue, decimalPlaces); - - return formatNumberFixed(x, formatDecimals); -}; - -export const formatNumberPercentage = (value: BigNumber, decimals?: number) => { - const decimalPlaces = - typeof decimals === 'undefined' ? Math.max(value.dp() || 0, 2) : decimals; - return `${formatNumber(value, decimalPlaces)}%`; -}; - -export const toNumberParts = ( - value: BigNumber | null | undefined, - decimals = 18 -): [integers: string, decimalPlaces: string] => { - if (!value) { - return ['0', '0'.repeat(decimals)]; - } - const separator = getDecimalSeparator() || '.'; - const [integers, decimalsPlaces] = formatNumber(value, decimals) - .toString() - .split(separator); - return [integers, decimalsPlaces || '']; -}; - -export const useNumberParts = ( - value: BigNumber | null | undefined, - decimals: number -): [integers: string, decimalPlaces: string] => { - return React.useMemo(() => toNumberParts(value, decimals), [decimals, value]); -}; - -export const isNumeric = ( - value?: string | number | BigNumber | bigint | null -): value is NonNullable => /^-?\d*\.?\d+$/.test(String(value)); +import { getUserLocale, formatNumber } from '@vegaprotocol/utils'; const INFINITY = '∞'; const DEFAULT_COMPACT_ABOVE = 1_000_000; @@ -154,20 +12,33 @@ const DEFAULT_COMPACT_CAP = new BigNumber(1e24); * @param compactAbove Compact number above threshold * @param cap Use scientific notation above threshold */ -export const compactNumber = ( - number: BigNumber, - decimals: number | 'infer' = 'infer', - compactDisplay: 'short' | 'long' = 'short', - compactAbove = DEFAULT_COMPACT_ABOVE, - cap = DEFAULT_COMPACT_CAP -) => { - if (!number.isFinite()) return `${number.isNegative() ? '-' : ''}${INFINITY}`; +export const CompactNumber = ({ + number, + decimals = 'infer', + compactDisplay = 'short', + testId = 'compact-number', +}: { + number: BigNumber; + decimals?: number | 'infer'; + compactDisplay?: 'short' | 'long'; + testId?: string; +}) => { + if (!number.isFinite()) { + return ( + + {number.isNegative() ? '-' : ''} + {INFINITY} + + ); + } const decimalPlaces = (decimals === 'infer' ? number.decimalPlaces() : decimals) || 0; if (number.isLessThan(DEFAULT_COMPACT_ABOVE)) { - return formatNumber(number, decimalPlaces); + return ( + {formatNumber(number, decimalPlaces)} + ); } /** @@ -193,7 +64,7 @@ export const compactNumber = ( if (eNotation && eNotation.length > 1) { const power = eNotation[1]; return ( - + {formatted.replace(r, '')}{' '} × 10 @@ -204,5 +75,7 @@ export const compactNumber = ( } } - return compactNumFormat.format(Number(number)); + return ( + {compactNumFormat.format(Number(number))} + ); }; diff --git a/libs/react-helpers/src/lib/grid/index.ts b/libs/react-helpers/src/lib/grid/index.ts index a9aba6268..4c39bf472 100644 --- a/libs/react-helpers/src/lib/grid/index.ts +++ b/libs/react-helpers/src/lib/grid/index.ts @@ -1,11 +1,2 @@ -export * from './cell-class-rules'; -export * from './cumulative-vol-cell'; -export * from './flash-cell'; -export * from './price-cell'; -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'; -export * from './numeric-cell'; diff --git a/libs/react-helpers/src/lib/grid/size.tsx b/libs/react-helpers/src/lib/grid/size.tsx index 50d98654f..37d3458d8 100644 --- a/libs/react-helpers/src/lib/grid/size.tsx +++ b/libs/react-helpers/src/lib/grid/size.tsx @@ -1,7 +1,7 @@ import * as Schema from '@vegaprotocol/types'; import type { ICellRendererParams } from 'ag-grid-community'; import classNames from 'classnames'; -import { addDecimalsFormatNumber } from '../format'; +import { addDecimalsFormatNumber } from '@vegaprotocol/utils'; export const Size = ({ value, diff --git a/libs/react-helpers/src/lib/index.ts b/libs/react-helpers/src/lib/index.ts index 4996f0bc9..97dadfd5f 100644 --- a/libs/react-helpers/src/lib/index.ts +++ b/libs/react-helpers/src/lib/index.ts @@ -1,22 +1,4 @@ export * from './__generated__/ChainId'; export * from './ag-grid-update'; -export * from './apollo-client'; -export * from './data-grid'; export * from './format'; -export * from './generic-data-provider'; -export * from './get-events'; -export * from './get-nodes'; export * from './grid'; -export * from './i18n'; -export * from './is-asset-erc20'; -export * from './is-valid-url'; -export * from './links'; -export * from './local-logger'; -export * from './market-expires'; -export * from './pagination'; -export * from './remove-0x'; -export * from './remove-pagination-wrapper'; -export * from './storage'; -export * from './time'; -export * from './validate'; -export * from './flag-emoji'; diff --git a/libs/react-helpers/src/lib/links/index.ts b/libs/react-helpers/src/lib/links/index.ts deleted file mode 100644 index 26f360af9..000000000 --- a/libs/react-helpers/src/lib/links/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './links'; diff --git a/libs/react-helpers/src/lib/market-expires.spec.tsx b/libs/react-helpers/src/lib/market-expires.spec.tsx deleted file mode 100644 index 04988fdb6..000000000 --- a/libs/react-helpers/src/lib/market-expires.spec.tsx +++ /dev/null @@ -1,66 +0,0 @@ -import { render, screen } from '@testing-library/react'; -import React from 'react'; - -import { MarketExpires } from './market-expires'; - -jest.mock('./format', () => ({ - getDateTimeFormat: () => - Intl.DateTimeFormat('en-GB', { - year: 'numeric', - month: 'numeric', - day: 'numeric', - hour: 'numeric', - minute: 'numeric', - second: 'numeric', - }), -})); - -jest.mock('./i18n', () => ({ - t: jest.fn().mockImplementation((text) => text), -})); - -describe('MarketExpires', () => { - describe('should properly parse different tags', () => { - it('settlement:date', () => { - const tags = [ - 'foo:buzz', - 'test:20220625T1200', - 'settlement', - 'settlement:notadate', - 'settlement:20220525T1200', - ]; - render(); - expect(screen.getByText('25/05/2022, 12:00:00')).toBeInTheDocument(); - }); - - it('settlement-date:date', () => { - const tags = [ - 'settlement', - 'settlement:20220525T1200', - 'settlement-date:2022-04-25T1200', - ]; - render(); - expect(screen.getByText('25/04/2022, 12:00:00')).toBeInTheDocument(); - }); - - it('last one proper tag should matter', () => { - const tags = [ - 'settlement', - 'settlement-date:20220525T1200', - 'settlement-expiry-date:2022-03-25T12:00:00', - ]; - render(); - expect(screen.getByText('25/03/2022, 12:00:00')).toBeInTheDocument(); - }); - - it('when no proper tag nor date should be null', () => { - const tags = [ - 'settlement', - 'settlemenz:20220525T1200', - 'settlemenx-date:20220425T1200', - ]; - const { container } = render(); - expect(container.firstChild).toBeNull(); - }); - }); -}); diff --git a/libs/react-helpers/src/lib/storage/index.ts b/libs/react-helpers/src/lib/storage/index.ts deleted file mode 100644 index 72dd18f3d..000000000 --- a/libs/react-helpers/src/lib/storage/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './local-storage'; diff --git a/libs/trades/src/lib/trades-container.tsx b/libs/trades/src/lib/trades-container.tsx index 22e119d6b..1c364c031 100644 --- a/libs/trades/src/lib/trades-container.tsx +++ b/libs/trades/src/lib/trades-container.tsx @@ -1,7 +1,5 @@ -import { - useDataProvider, - makeInfiniteScrollGetRows, -} from '@vegaprotocol/react-helpers'; +import { makeInfiniteScrollGetRows } from '@vegaprotocol/utils'; +import { useDataProvider } from '@vegaprotocol/react-helpers'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; import type { AgGridReact } from 'ag-grid-react'; import { useCallback, useMemo, useRef } from 'react'; diff --git a/libs/trades/src/lib/trades-data-provider.ts b/libs/trades/src/lib/trades-data-provider.ts index 13ae7a1a2..e66237185 100644 --- a/libs/trades/src/lib/trades-data-provider.ts +++ b/libs/trades/src/lib/trades-data-provider.ts @@ -4,8 +4,8 @@ import { defaultAppend as append, paginatedCombineDelta as combineDelta, paginatedCombineInsertionData as combineInsertionData, -} from '@vegaprotocol/react-helpers'; -import type { PageInfo, Edge } from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; +import type { PageInfo, Edge } from '@vegaprotocol/utils'; import type { Market } from '@vegaprotocol/market-list'; import { marketsProvider } from '@vegaprotocol/market-list'; import type { diff --git a/libs/trades/src/lib/trades-table.spec.tsx b/libs/trades/src/lib/trades-table.spec.tsx index b50f61271..60380db6a 100644 --- a/libs/trades/src/lib/trades-table.spec.tsx +++ b/libs/trades/src/lib/trades-table.spec.tsx @@ -1,5 +1,5 @@ import { act, render, screen } from '@testing-library/react'; -import { getDateTimeFormat } from '@vegaprotocol/react-helpers'; +import { getDateTimeFormat } from '@vegaprotocol/utils'; import { SELL_CLASS, TradesTable, BUY_CLASS } from './trades-table'; import type { Trade } from './trades-data-provider'; import { Side } from '@vegaprotocol/types'; diff --git a/libs/trades/src/lib/trades-table.tsx b/libs/trades/src/lib/trades-table.tsx index 1acdd1882..54284992e 100644 --- a/libs/trades/src/lib/trades-table.tsx +++ b/libs/trades/src/lib/trades-table.tsx @@ -4,15 +4,14 @@ import { forwardRef } from 'react'; import type { VegaICellRendererParams, VegaValueFormatterParams, -} from '@vegaprotocol/ui-toolkit'; -import { AgGridDynamic as AgGrid } from '@vegaprotocol/ui-toolkit'; +} from '@vegaprotocol/datagrid'; +import { AgGridDynamic as AgGrid, NumericCell } from '@vegaprotocol/datagrid'; import { addDecimal, addDecimalsFormatNumber, getDateTimeFormat, - NumericCell, - t, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import type { IDatasource, IGetRowsParams } from 'ag-grid-community'; import type { CellClassParams } from 'ag-grid-community'; import type { AgGridReactProps } from 'ag-grid-react'; diff --git a/libs/ui-toolkit/.storybook/preview.js b/libs/ui-toolkit/.storybook/preview.js index 59e6d1d77..c7f808a90 100644 --- a/libs/ui-toolkit/.storybook/preview.js +++ b/libs/ui-toolkit/.storybook/preview.js @@ -1,4 +1,4 @@ -import { useThemeSwitcher } from '@vegaprotocol/react-helpers'; +import { useThemeSwitcher } from '@vegaprotocol/utils'; import classNames from 'classnames'; import { useEffect } from 'react'; import '../src/styles.css'; 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 75da83586..854df25b7 100644 --- a/libs/ui-toolkit/src/components/async-renderer/async-renderer.tsx +++ b/libs/ui-toolkit/src/components/async-renderer/async-renderer.tsx @@ -1,6 +1,6 @@ import { Splash } from '../splash'; import type { ReactNode } from 'react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Button } from '../button'; interface AsyncRendererProps { diff --git a/libs/ui-toolkit/src/components/index.ts b/libs/ui-toolkit/src/components/index.ts index 23c1ac4b1..abfd9d66d 100644 --- a/libs/ui-toolkit/src/components/index.ts +++ b/libs/ui-toolkit/src/components/index.ts @@ -1,5 +1,4 @@ export * from './accordion'; -export * from './ag-grid'; export * from './arrows'; export * from './async-renderer'; export * from './background-video'; @@ -23,11 +22,11 @@ export * from './lozenge'; export * from './nav'; export * from './nav-dropdown'; export * from './popover'; -export * from './price-change'; export * from './progress-bar'; export * from './radio-group'; export * from './resizable-grid'; export * from './select'; +export * from './simple-grid'; export * from './slider'; export * from './sparkline'; export * from './splash'; diff --git a/libs/ui-toolkit/src/components/maintenance-page/maintenance-page.tsx b/libs/ui-toolkit/src/components/maintenance-page/maintenance-page.tsx index 59e102d54..ea2a8c7f1 100644 --- a/libs/ui-toolkit/src/components/maintenance-page/maintenance-page.tsx +++ b/libs/ui-toolkit/src/components/maintenance-page/maintenance-page.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { ExternalLink } from '../link'; import { BackgroundVideo } from '../background-video'; diff --git a/libs/ui-toolkit/src/components/price-change/index.ts b/libs/ui-toolkit/src/components/price-change/index.ts deleted file mode 100644 index 667cc5c33..000000000 --- a/libs/ui-toolkit/src/components/price-change/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './price-change-cell'; diff --git a/libs/ui-toolkit/src/components/price-change/price-change-cell.stories.tsx b/libs/ui-toolkit/src/components/price-change/price-change-cell.stories.tsx deleted file mode 100644 index c10695ea7..000000000 --- a/libs/ui-toolkit/src/components/price-change/price-change-cell.stories.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import type { Story, Meta } from '@storybook/react'; -import { PriceCellChange } from './price-change-cell'; - -export default { - component: PriceCellChange, - title: 'PriceCellChange', -} as Meta; - -const Template: Story = (args) => ( - -); - -export const Increased = Template.bind({}); -Increased.args = { - candles: ['4564', '5674', '6784'], - decimalPlaces: 3, -}; - -export const Decreased = Template.bind({}); -Decreased.args = { - candles: ['6784', '4564', '5674'], - decimalPlaces: 3, -}; diff --git a/libs/ui-toolkit/src/components/simple-grid/index.ts b/libs/ui-toolkit/src/components/simple-grid/index.ts new file mode 100644 index 000000000..fb6391c05 --- /dev/null +++ b/libs/ui-toolkit/src/components/simple-grid/index.ts @@ -0,0 +1 @@ +export * from './simple-grid'; diff --git a/libs/react-helpers/src/lib/data-grid/data-grid.tsx b/libs/ui-toolkit/src/components/simple-grid/simple-grid.tsx similarity index 84% rename from libs/react-helpers/src/lib/data-grid/data-grid.tsx rename to libs/ui-toolkit/src/components/simple-grid/simple-grid.tsx index db07ceea1..5abcc9709 100644 --- a/libs/react-helpers/src/lib/data-grid/data-grid.tsx +++ b/libs/ui-toolkit/src/components/simple-grid/simple-grid.tsx @@ -1,13 +1,13 @@ import type { ReactNode } from 'react'; -export type DataGridProps = { +export type SimpleGridProps = { grid: { label: string | ReactNode; value?: ReactNode; }[]; }; -export const DataGrid = ({ grid }: DataGridProps) => { +export const SimpleGrid = ({ grid }: SimpleGridProps) => { return ( <> {grid.map( diff --git a/libs/ui-toolkit/src/components/theme-switcher/theme-switcher.tsx b/libs/ui-toolkit/src/components/theme-switcher/theme-switcher.tsx index 6e377c046..6ca96ecc6 100644 --- a/libs/ui-toolkit/src/components/theme-switcher/theme-switcher.tsx +++ b/libs/ui-toolkit/src/components/theme-switcher/theme-switcher.tsx @@ -1,4 +1,5 @@ -import { useThemeSwitcher, t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; +import { useThemeSwitcher } from '@vegaprotocol/react-helpers'; import { SunIcon, MoonIcon } from './icons'; import { Toggle } from '../toggle'; diff --git a/libs/ui-toolkit/src/components/toast/toasts-container.stories.tsx b/libs/ui-toolkit/src/components/toast/toasts-container.stories.tsx index 8ab25f0e3..1c1f704fd 100644 --- a/libs/ui-toolkit/src/components/toast/toasts-container.stories.tsx +++ b/libs/ui-toolkit/src/components/toast/toasts-container.stories.tsx @@ -10,7 +10,7 @@ import uniqueId from 'lodash/uniqueId'; import { useToasts } from './use-toasts'; import { create } from 'zustand'; import { useEffect } from '@storybook/addons'; -import { formatNumber } from '@vegaprotocol/react-helpers'; +import { formatNumber } from '@vegaprotocol/utils'; export default { title: 'ToastContainer', diff --git a/libs/ui-toolkit/src/components/toast/toasts-container.tsx b/libs/ui-toolkit/src/components/toast/toasts-container.tsx index e4a022d70..a1675d6b3 100644 --- a/libs/ui-toolkit/src/components/toast/toasts-container.tsx +++ b/libs/ui-toolkit/src/components/toast/toasts-container.tsx @@ -1,4 +1,5 @@ -import { t, usePrevious } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; +import { usePrevious } from '@vegaprotocol/react-helpers'; import classNames from 'classnames'; import type { Ref } from 'react'; import { useLayoutEffect, useRef } from 'react'; diff --git a/libs/ui-toolkit/src/components/vega-logo/vega-logo.tsx b/libs/ui-toolkit/src/components/vega-logo/vega-logo.tsx index 991788d99..73ce63c4a 100644 --- a/libs/ui-toolkit/src/components/vega-logo/vega-logo.tsx +++ b/libs/ui-toolkit/src/components/vega-logo/vega-logo.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; export const VegaLogo = () => { return ( diff --git a/libs/ui-toolkit/src/components/viewing-as-user/index.tsx b/libs/ui-toolkit/src/components/viewing-as-user/index.tsx index 30878be44..deb69c510 100644 --- a/libs/ui-toolkit/src/components/viewing-as-user/index.tsx +++ b/libs/ui-toolkit/src/components/viewing-as-user/index.tsx @@ -1,6 +1,5 @@ import { Button } from '../button'; -import React from 'react'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; export function truncateMiddle(address: string) { if (address.length < 11) return address; diff --git a/libs/ui-toolkit/src/utils/intent.tsx b/libs/ui-toolkit/src/utils/intent.ts similarity index 100% rename from libs/ui-toolkit/src/utils/intent.tsx rename to libs/ui-toolkit/src/utils/intent.ts diff --git a/libs/utils/.babelrc b/libs/utils/.babelrc new file mode 100644 index 000000000..e24a5465f --- /dev/null +++ b/libs/utils/.babelrc @@ -0,0 +1,10 @@ +{ + "presets": [ + [ + "@nrwl/web/babel", + { + "useBuiltIns": "usage" + } + ] + ] +} diff --git a/libs/utils/.eslintrc.json b/libs/utils/.eslintrc.json new file mode 100644 index 000000000..9d9c0db55 --- /dev/null +++ b/libs/utils/.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/utils/README.md b/libs/utils/README.md new file mode 100644 index 000000000..ad4ba3d0e --- /dev/null +++ b/libs/utils/README.md @@ -0,0 +1,11 @@ +# utils + +This library was generated with [Nx](https://nx.dev). + +## Building + +Run `nx build utils` to build the library. + +## Running unit tests + +Run `nx test utils` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/libs/utils/jest.config.ts b/libs/utils/jest.config.ts new file mode 100644 index 000000000..69e6c23eb --- /dev/null +++ b/libs/utils/jest.config.ts @@ -0,0 +1,15 @@ +/* eslint-disable */ +export default { + displayName: 'utils', + preset: '../../jest.preset.js', + globals: { + 'ts-jest': { + tsconfig: '/tsconfig.spec.json', + }, + }, + transform: { + '^.+\\.[tj]s$': 'ts-jest', + }, + moduleFileExtensions: ['ts', 'js', 'html'], + coverageDirectory: '../../coverage/libs/utils', +}; diff --git a/libs/utils/package.json b/libs/utils/package.json new file mode 100644 index 000000000..f614fd229 --- /dev/null +++ b/libs/utils/package.json @@ -0,0 +1,5 @@ +{ + "name": "@vegaprotocol/utils", + "version": "0.0.1", + "type": "commonjs" +} diff --git a/libs/utils/project.json b/libs/utils/project.json new file mode 100644 index 000000000..cc8a09255 --- /dev/null +++ b/libs/utils/project.json @@ -0,0 +1,45 @@ +{ + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/utils/src", + "projectType": "library", + "targets": { + "build": { + "executor": "@nrwl/js:tsc", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/libs/utils", + "main": "libs/utils/src/index.ts", + "tsConfig": "libs/utils/tsconfig.lib.json", + "assets": ["libs/utils/*.md"] + } + }, + "publish": { + "executor": "@nrwl/workspace:run-commands", + "options": { + "command": "node tools/scripts/publish.mjs utils {args.ver} {args.tag}" + }, + "dependsOn": [ + { + "projects": "self", + "target": "build" + } + ] + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["libs/utils/**/*.ts"] + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "outputs": ["coverage/libs/utils"], + "options": { + "jestConfig": "libs/utils/jest.config.ts", + "passWithNoTests": true + } + } + }, + "tags": [] +} diff --git a/libs/utils/src/index.ts b/libs/utils/src/index.ts new file mode 100644 index 000000000..f099ed873 --- /dev/null +++ b/libs/utils/src/index.ts @@ -0,0 +1,19 @@ +export * from './lib/apollo-client'; +export * from './lib/flag-emoji'; +export * from './lib/format'; +export * from './lib/generic-data-provider'; +export * from './lib/get-events'; +export * from './lib/get-nodes'; +export * from './lib/get-user-locale'; +export * from './lib/helpers'; +export * from './lib/is-asset-erc20'; +export * from './lib/is-valid-url'; +export * from './lib/links'; +export * from './lib/local-logger'; +export * from './lib/local-storage'; +export * from './lib/markets'; +export * from './lib/pagination'; +export * from './lib/remove-0x'; +export * from './lib/remove-pagination-wrapper'; +export * from './lib/time'; +export * from './lib/validate'; diff --git a/libs/react-helpers/src/lib/apollo-client.ts b/libs/utils/src/lib/apollo-client.ts similarity index 100% rename from libs/react-helpers/src/lib/apollo-client.ts rename to libs/utils/src/lib/apollo-client.ts diff --git a/libs/react-helpers/src/lib/flag-emoji.spec.ts b/libs/utils/src/lib/flag-emoji.spec.ts similarity index 100% rename from libs/react-helpers/src/lib/flag-emoji.spec.ts rename to libs/utils/src/lib/flag-emoji.spec.ts diff --git a/libs/react-helpers/src/lib/flag-emoji.ts b/libs/utils/src/lib/flag-emoji.ts similarity index 100% rename from libs/react-helpers/src/lib/flag-emoji.ts rename to libs/utils/src/lib/flag-emoji.ts diff --git a/libs/react-helpers/src/lib/format/date.ts b/libs/utils/src/lib/format/date.ts similarity index 96% rename from libs/react-helpers/src/lib/format/date.ts rename to libs/utils/src/lib/format/date.ts index 3bc6c39da..151d34410 100644 --- a/libs/react-helpers/src/lib/format/date.ts +++ b/libs/utils/src/lib/format/date.ts @@ -1,5 +1,5 @@ import once from 'lodash/once'; -import { getUserLocale } from './utils'; +import { getUserLocale } from '../get-user-locale'; export const isValidDate = (date: Date) => date instanceof Date && !isNaN(date.getTime()); diff --git a/libs/utils/src/lib/format/index.ts b/libs/utils/src/lib/format/index.ts new file mode 100644 index 000000000..fefb8320f --- /dev/null +++ b/libs/utils/src/lib/format/index.ts @@ -0,0 +1,4 @@ +export * from './date'; +export * from './number'; +export * from './size'; +export * from './strings'; diff --git a/libs/utils/src/lib/format/number.spec.ts b/libs/utils/src/lib/format/number.spec.ts new file mode 100644 index 000000000..3c2024d38 --- /dev/null +++ b/libs/utils/src/lib/format/number.spec.ts @@ -0,0 +1,126 @@ +import BigNumber from 'bignumber.js'; + +import { + addDecimalsFormatNumber, + formatNumber, + formatNumberPercentage, + isNumeric, + toDecimal, + toNumberParts, +} from './number'; + +describe('number utils', () => { + it.each([ + { v: new BigNumber(123000), d: 5, o: '1.23' }, + { v: new BigNumber(123000), d: 3, o: '123.00' }, + { v: new BigNumber(123000), d: 1, o: '12,300.0' }, + { v: new BigNumber(123001), d: 2, o: '1,230.01' }, + { v: new BigNumber(123001000), d: 2, o: '1,230,010.00' }, + ])( + 'formats with addDecimalsFormatNumber given number correctly', + ({ v, d, o }) => { + expect(addDecimalsFormatNumber(v.toString(), d)).toStrictEqual(o); + } + ); + + it.each([ + { v: new BigNumber(123), d: 3, o: '123.00' }, + { v: new BigNumber(123.123), d: 3, o: '123.123' }, + { v: new BigNumber(123.6666), d: 3, o: '123.667' }, + { v: new BigNumber(123.123), d: 6, o: '123.123' }, + { v: new BigNumber(123.123), d: 0, o: '123' }, + { v: new BigNumber(123), d: undefined, o: '123' }, + { v: new BigNumber(30000), d: undefined, o: '30,000' }, + { v: new BigNumber(3.000001), d: undefined, o: '3' }, + ])('formats with formatNumber given number correctly', ({ v, d, o }) => { + expect(formatNumber(v, d)).toStrictEqual(o); + }); + + it.each([ + { v: new BigNumber(123), d: 3, o: '123.00%' }, + { v: new BigNumber(123.123), d: 3, o: '123.123%' }, + { v: new BigNumber(123.123), d: 6, o: '123.123%' }, + { v: new BigNumber(123.123), d: 0, o: '123%' }, + { v: new BigNumber(123), d: undefined, o: '123.00%' }, // it default to 2 decimal places + { v: new BigNumber(30000), d: undefined, o: '30,000.00%' }, + { v: new BigNumber(3.000001), d: undefined, o: '3.000001%' }, + ])('formats given number correctly', ({ v, d, o }) => { + expect(formatNumberPercentage(v, d)).toStrictEqual(o); + }); +}); + +describe('toNumberParts', () => { + it.each([ + { v: null, d: 3, o: ['0', '000'] }, + { v: undefined, d: 3, o: ['0', '000'] }, + { v: new BigNumber(123), d: 3, o: ['123', '00'] }, + { v: new BigNumber(123.123), d: 3, o: ['123', '123'] }, + { v: new BigNumber(123.123), d: 6, o: ['123', '123'] }, + { v: new BigNumber(123.123), d: 0, o: ['123', ''] }, + { v: new BigNumber(123), d: undefined, o: ['123', '00'] }, + { + v: new BigNumber(30000), + d: undefined, + o: ['30,000', '00'], + }, + ])('returns correct tuple given the different arguments', ({ v, d, o }) => { + expect(toNumberParts(v, d)).toStrictEqual(o); + }); +}); + +describe('isNumeric', () => { + it.each([ + { i: null, o: false }, + { i: undefined, o: false }, + { i: 1, o: true }, + { i: '1', o: true }, + { i: '-1', o: true }, + { i: 0.1, o: true }, + { i: '.1', o: true }, + { i: '-.1', o: true }, + { i: 123, o: true }, + { i: -123, o: true }, + { i: '123', o: true }, + { i: '123.01', o: true }, + { i: '-123.01', o: true }, + { i: '--123.01', o: false }, + { i: '123.', o: false }, + { i: '123.1.1', o: false }, + { i: BigInt(123), o: true }, + { i: BigInt(-1), o: true }, + { i: new BigNumber(123), o: true }, + { i: new BigNumber(123.123), o: true }, + { i: new BigNumber(123.123).toString(), o: true }, + { i: new BigNumber(123), o: true }, + { i: Infinity, o: false }, + { i: NaN, o: false }, + ])( + 'returns correct results', + ({ + i, + o, + }: { + i: number | string | undefined | null | BigNumber | bigint; + o: boolean; + }) => { + expect(isNumeric(i)).toStrictEqual(o); + } + ); +}); + +describe('toDecimal', () => { + it.each([ + { v: 0, o: '1' }, + { v: 1, o: '0.1' }, + { v: 2, o: '0.01' }, + { v: 3, o: '0.001' }, + { v: 4, o: '0.0001' }, + { v: 5, o: '0.00001' }, + { v: 6, o: '0.000001' }, + { v: 7, o: '0.0000001' }, + { v: 8, o: '0.00000001' }, + { v: 9, o: '0.000000001' }, + ])('formats with toNumber given number correctly', ({ v, o }) => { + expect(toDecimal(v)).toStrictEqual(o); + }); +}); diff --git a/libs/utils/src/lib/format/number.ts b/libs/utils/src/lib/format/number.ts new file mode 100644 index 000000000..ddcf0b9b8 --- /dev/null +++ b/libs/utils/src/lib/format/number.ts @@ -0,0 +1,136 @@ +import { BigNumber } from 'bignumber.js'; +import { BigNumber as EthersBigNumber } from 'ethers'; +import isNil from 'lodash/isNil'; +import memoize from 'lodash/memoize'; + +import { getUserLocale } from '../get-user-locale'; + +const MIN_FRACTION_DIGITS = 2; +const MAX_FRACTION_DIGITS = 20; + +export function toDecimal(numberOfDecimals: number) { + return new BigNumber(1) + .dividedBy(Math.pow(10, numberOfDecimals)) + .toString(10); +} + +export function toBigNum( + rawValue: string | number | EthersBigNumber, + decimals: number +): BigNumber { + return new BigNumber( + rawValue instanceof EthersBigNumber ? rawValue.toString() : rawValue || 0 + ).dividedBy(Math.pow(10, decimals)); +} + +export function addDecimal( + value: string | number | EthersBigNumber, + decimals: number, + decimalPrecision = decimals +): string { + if (!decimals) return value.toString(); + if (!decimalPrecision || decimalPrecision < 0) { + return toBigNum(value, decimals).toFixed(0); + } + return toBigNum(value, decimals).toFixed(decimalPrecision); +} + +export function removeDecimal(value: string, decimals: number): string { + if (!decimals) return value; + return new BigNumber(value || 0).times(Math.pow(10, decimals)).toFixed(0); +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat +export const getNumberFormat = memoize((digits: number) => { + if (isNil(digits) || digits < 0) { + return new Intl.NumberFormat(getUserLocale()); + } + return new Intl.NumberFormat(getUserLocale(), { + minimumFractionDigits: Math.min(Math.max(0, digits), MIN_FRACTION_DIGITS), + maximumFractionDigits: Math.min(Math.max(0, digits), MAX_FRACTION_DIGITS), + }); +}); + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat +export const getFixedNumberFormat = memoize((digits: number) => { + if (isNil(digits) || digits < 0) { + return new Intl.NumberFormat(getUserLocale()); + } + return new Intl.NumberFormat(getUserLocale(), { + minimumFractionDigits: Math.min(Math.max(0, digits), MAX_FRACTION_DIGITS), + maximumFractionDigits: Math.min(Math.max(0, digits), MAX_FRACTION_DIGITS), + }); +}); + +export const getDecimalSeparator = memoize( + () => + getNumberFormat(1) + .formatToParts(1.1) + .find((part) => part.type === 'decimal')?.value +); + +/** formatNumber will format the number with fixed decimals + * @param rawValue - should be a number that is not outside the safe range fail as in https://mikemcl.github.io/bignumber.js/#toN + * @param formatDecimals - number of decimals to use + */ +export const formatNumber = ( + rawValue: string | number | BigNumber, + formatDecimals = 0 +) => { + return getNumberFormat(formatDecimals).format(Number(rawValue)); +}; + +/** formatNumberFixed will format the number with fixed decimals + * @param rawValue - should be a number that is not outside the safe range fail as in https://mikemcl.github.io/bignumber.js/#toN + * @param formatDecimals - number of decimals to use + */ +export const formatNumberFixed = ( + rawValue: string | number | BigNumber, + formatDecimals = 0 +) => { + return getFixedNumberFormat(formatDecimals).format(Number(rawValue)); +}; + +export const addDecimalsFormatNumber = ( + rawValue: string | number, + decimalPlaces: number, + formatDecimals: number = decimalPlaces +) => { + const x = addDecimal(rawValue, decimalPlaces); + + return formatNumber(x, formatDecimals); +}; + +export const addDecimalsFixedFormatNumber = ( + rawValue: string | number, + decimalPlaces: number, + formatDecimals: number = decimalPlaces +) => { + const x = addDecimal(rawValue, decimalPlaces); + + return formatNumberFixed(x, formatDecimals); +}; + +export const formatNumberPercentage = (value: BigNumber, decimals?: number) => { + const decimalPlaces = + typeof decimals === 'undefined' ? Math.max(value.dp() || 0, 2) : decimals; + return `${formatNumber(value, decimalPlaces)}%`; +}; + +export const toNumberParts = ( + value: BigNumber | null | undefined, + decimals = 18 +): [integers: string, decimalPlaces: string] => { + if (!value) { + return ['0', '0'.repeat(decimals)]; + } + const separator = getDecimalSeparator() || '.'; + const [integers, decimalsPlaces] = formatNumber(value, decimals) + .toString() + .split(separator); + return [integers, decimalsPlaces || '']; +}; + +export const isNumeric = ( + value?: string | number | BigNumber | bigint | null +): value is NonNullable => /^-?\d*\.?\d+$/.test(String(value)); diff --git a/libs/react-helpers/src/lib/format/size.ts b/libs/utils/src/lib/format/size.ts similarity index 100% rename from libs/react-helpers/src/lib/format/size.ts rename to libs/utils/src/lib/format/size.ts diff --git a/libs/react-helpers/src/lib/format/strings.spec.ts b/libs/utils/src/lib/format/strings.spec.ts similarity index 100% rename from libs/react-helpers/src/lib/format/strings.spec.ts rename to libs/utils/src/lib/format/strings.spec.ts diff --git a/libs/react-helpers/src/lib/format/strings.ts b/libs/utils/src/lib/format/strings.ts similarity index 100% rename from libs/react-helpers/src/lib/format/strings.ts rename to libs/utils/src/lib/format/strings.ts diff --git a/libs/react-helpers/src/lib/generic-data-provider.spec.ts b/libs/utils/src/lib/generic-data-provider.spec.ts similarity index 99% rename from libs/react-helpers/src/lib/generic-data-provider.spec.ts rename to libs/utils/src/lib/generic-data-provider.spec.ts index 7a00ac42e..c3f50e9cd 100644 --- a/libs/react-helpers/src/lib/generic-data-provider.spec.ts +++ b/libs/utils/src/lib/generic-data-provider.spec.ts @@ -311,7 +311,7 @@ describe('data provider', () => { const subscription = subscribe(callback, client); await resolveQuery({ data }); const delta: Item[] = []; - update.mockImplementationOnce((data, delta) => data || []); + update.mockImplementationOnce((data) => data || []); const callbackCallsLength = callback.mock.calls.length; // calling onNext from client.subscribe({ query }).subscribe(onNext) await clientSubscribeSubscribe.mock.calls[ diff --git a/libs/react-helpers/src/lib/generic-data-provider.ts b/libs/utils/src/lib/generic-data-provider.ts similarity index 99% rename from libs/react-helpers/src/lib/generic-data-provider.ts rename to libs/utils/src/lib/generic-data-provider.ts index 4118399c7..d70359569 100644 --- a/libs/react-helpers/src/lib/generic-data-provider.ts +++ b/libs/utils/src/lib/generic-data-provider.ts @@ -280,7 +280,7 @@ function makeDataProviderInternal< } }); - const load = async (start?: number, end?: number) => { + const load = async (start?: number) => { if (!pagination) { return Promise.reject(); } diff --git a/libs/react-helpers/src/lib/get-events.ts b/libs/utils/src/lib/get-events.ts similarity index 100% rename from libs/react-helpers/src/lib/get-events.ts rename to libs/utils/src/lib/get-events.ts diff --git a/libs/react-helpers/src/lib/get-nodes.ts b/libs/utils/src/lib/get-nodes.ts similarity index 100% rename from libs/react-helpers/src/lib/get-nodes.ts rename to libs/utils/src/lib/get-nodes.ts diff --git a/libs/utils/src/lib/get-user-locale.ts b/libs/utils/src/lib/get-user-locale.ts new file mode 100644 index 000000000..1aca59ecf --- /dev/null +++ b/libs/utils/src/lib/get-user-locale.ts @@ -0,0 +1 @@ +export const getUserLocale = () => 'default'; diff --git a/libs/react-helpers/src/lib/format/utils.ts b/libs/utils/src/lib/helpers.ts similarity index 85% rename from libs/react-helpers/src/lib/format/utils.ts rename to libs/utils/src/lib/helpers.ts index f6e3a072b..1ee1ac777 100644 --- a/libs/react-helpers/src/lib/format/utils.ts +++ b/libs/utils/src/lib/helpers.ts @@ -1,8 +1,6 @@ import capitalize from 'lodash/capitalize'; import startCase from 'lodash/startCase'; -export const getUserLocale = () => 'default'; - export const splitAt = (index: number) => (x: string) => [x.slice(0, index), x.slice(index)]; diff --git a/libs/react-helpers/src/lib/is-asset-erc20.ts b/libs/utils/src/lib/is-asset-erc20.ts similarity index 100% rename from libs/react-helpers/src/lib/is-asset-erc20.ts rename to libs/utils/src/lib/is-asset-erc20.ts diff --git a/libs/react-helpers/src/lib/is-valid-url.ts b/libs/utils/src/lib/is-valid-url.ts similarity index 100% rename from libs/react-helpers/src/lib/is-valid-url.ts rename to libs/utils/src/lib/is-valid-url.ts diff --git a/libs/react-helpers/src/lib/links/links.ts b/libs/utils/src/lib/links.ts similarity index 100% rename from libs/react-helpers/src/lib/links/links.ts rename to libs/utils/src/lib/links.ts diff --git a/libs/react-helpers/src/lib/local-logger.spec.ts b/libs/utils/src/lib/local-logger.spec.ts similarity index 100% rename from libs/react-helpers/src/lib/local-logger.spec.ts rename to libs/utils/src/lib/local-logger.spec.ts diff --git a/libs/react-helpers/src/lib/local-logger.ts b/libs/utils/src/lib/local-logger.ts similarity index 100% rename from libs/react-helpers/src/lib/local-logger.ts rename to libs/utils/src/lib/local-logger.ts diff --git a/libs/utils/src/lib/local-storage.ts b/libs/utils/src/lib/local-storage.ts new file mode 100644 index 000000000..cf547d14c --- /dev/null +++ b/libs/utils/src/lib/local-storage.ts @@ -0,0 +1,28 @@ +export const LocalStorage = { + getItem: (key: string) => { + if (typeof window === 'undefined') return; + try { + const item = window.localStorage.getItem(key); + return item; + } catch (error) { + console.error(error); + return null; + } + }, + setItem: (key: string, value: string) => { + if (typeof window === 'undefined') return; + try { + window.localStorage.setItem(key, value); + } catch (error) { + console.error(error); + } + }, + removeItem: (key: string) => { + if (typeof window === 'undefined') return; + try { + window.localStorage.removeItem(key); + } catch (error) { + console.error(error); + } + }, +}; diff --git a/libs/react-helpers/src/lib/market-expires.tsx b/libs/utils/src/lib/markets.ts similarity index 85% rename from libs/react-helpers/src/lib/market-expires.tsx rename to libs/utils/src/lib/markets.ts index c4b97b564..11a56607f 100644 --- a/libs/react-helpers/src/lib/market-expires.tsx +++ b/libs/utils/src/lib/markets.ts @@ -1,7 +1,7 @@ -import { t } from './i18n'; -import { getDateTimeFormat } from './format'; -import { isValid, parseISO } from 'date-fns'; import { MarketState } from '@vegaprotocol/types'; +import { t } from '@vegaprotocol/i18n'; +import { isValid, parseISO } from 'date-fns'; +import { getDateTimeFormat } from './format'; export const getMarketExpiryDate = ( tags?: ReadonlyArray | null @@ -62,14 +62,3 @@ export const getExpiryDate = ( } return content; }; - -export const MarketExpires = ({ - tags, -}: { - tags?: ReadonlyArray | null; -}) => { - const date = getMarketExpiryDateFormatted(tags); - return date ? ( -
{`${date}`}
- ) : null; -}; diff --git a/libs/react-helpers/src/lib/pagination.ts b/libs/utils/src/lib/pagination.ts similarity index 100% rename from libs/react-helpers/src/lib/pagination.ts rename to libs/utils/src/lib/pagination.ts diff --git a/libs/react-helpers/src/lib/remove-0x.spec.ts b/libs/utils/src/lib/remove-0x.spec.ts similarity index 100% rename from libs/react-helpers/src/lib/remove-0x.spec.ts rename to libs/utils/src/lib/remove-0x.spec.ts diff --git a/libs/react-helpers/src/lib/remove-0x.ts b/libs/utils/src/lib/remove-0x.ts similarity index 100% rename from libs/react-helpers/src/lib/remove-0x.ts rename to libs/utils/src/lib/remove-0x.ts diff --git a/libs/react-helpers/src/lib/remove-pagination-wrapper.spec.ts b/libs/utils/src/lib/remove-pagination-wrapper.spec.ts similarity index 100% rename from libs/react-helpers/src/lib/remove-pagination-wrapper.spec.ts rename to libs/utils/src/lib/remove-pagination-wrapper.spec.ts diff --git a/libs/react-helpers/src/lib/remove-pagination-wrapper.ts b/libs/utils/src/lib/remove-pagination-wrapper.ts similarity index 100% rename from libs/react-helpers/src/lib/remove-pagination-wrapper.ts rename to libs/utils/src/lib/remove-pagination-wrapper.ts diff --git a/libs/react-helpers/src/lib/time.spec.ts b/libs/utils/src/lib/time.spec.ts similarity index 100% rename from libs/react-helpers/src/lib/time.spec.ts rename to libs/utils/src/lib/time.spec.ts diff --git a/libs/react-helpers/src/lib/time.ts b/libs/utils/src/lib/time.ts similarity index 100% rename from libs/react-helpers/src/lib/time.ts rename to libs/utils/src/lib/time.ts diff --git a/libs/react-helpers/src/lib/validate/common.ts b/libs/utils/src/lib/validate/common.ts similarity index 96% rename from libs/react-helpers/src/lib/validate/common.ts rename to libs/utils/src/lib/validate/common.ts index acbdeb957..434fd5e37 100644 --- a/libs/react-helpers/src/lib/validate/common.ts +++ b/libs/utils/src/lib/validate/common.ts @@ -1,6 +1,6 @@ import BigNumber from 'bignumber.js'; import { ethers } from 'ethers'; -import { t } from '../i18n'; +import { t } from '@vegaprotocol/i18n'; export const required = (value: string) => { if (value === null || value === undefined || value === '') { diff --git a/libs/react-helpers/src/lib/validate/index.ts b/libs/utils/src/lib/validate/index.ts similarity index 100% rename from libs/react-helpers/src/lib/validate/index.ts rename to libs/utils/src/lib/validate/index.ts diff --git a/libs/react-helpers/src/lib/validate/validate-amount.ts b/libs/utils/src/lib/validate/validate-amount.ts similarity index 92% rename from libs/react-helpers/src/lib/validate/validate-amount.ts rename to libs/utils/src/lib/validate/validate-amount.ts index 2e861e960..55d9f1941 100644 --- a/libs/react-helpers/src/lib/validate/validate-amount.ts +++ b/libs/utils/src/lib/validate/validate-amount.ts @@ -1,4 +1,4 @@ -import { t } from '../i18n'; +import { t } from '@vegaprotocol/i18n'; export const validateAmount = (step: number | string, field: string) => { const [, stepDecimals = ''] = String(step).split('.'); diff --git a/libs/utils/tsconfig.json b/libs/utils/tsconfig.json new file mode 100644 index 000000000..e302a4d20 --- /dev/null +++ b/libs/utils/tsconfig.json @@ -0,0 +1,23 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "module": "commonjs", + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": false, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + "esModuleInterop": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/libs/utils/tsconfig.lib.json b/libs/utils/tsconfig.lib.json new file mode 100644 index 000000000..bcdddcf3e --- /dev/null +++ b/libs/utils/tsconfig.lib.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "declaration": true, + "types": [] + }, + "include": ["**/*.ts", "../ui-toolkit/src/utils/cell-class-rules.ts"], + "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"] +} diff --git a/libs/utils/tsconfig.spec.json b/libs/utils/tsconfig.spec.json new file mode 100644 index 000000000..546f12877 --- /dev/null +++ b/libs/utils/tsconfig.spec.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] +} diff --git a/libs/wallet/src/connect-dialog/connect-dialog-elements.tsx b/libs/wallet/src/connect-dialog/connect-dialog-elements.tsx index 5cc04840b..820ae9505 100644 --- a/libs/wallet/src/connect-dialog/connect-dialog-elements.tsx +++ b/libs/wallet/src/connect-dialog/connect-dialog-elements.tsx @@ -1,5 +1,6 @@ import { useEnvironment } from '@vegaprotocol/environment'; -import { createDocsLinks, ExternalLinks, t } from '@vegaprotocol/react-helpers'; +import { createDocsLinks, ExternalLinks } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { Link } from '@vegaprotocol/ui-toolkit'; import type { ReactNode } from 'react'; diff --git a/libs/wallet/src/connect-dialog/connect-dialog.tsx b/libs/wallet/src/connect-dialog/connect-dialog.tsx index d3a6b330b..131998236 100644 --- a/libs/wallet/src/connect-dialog/connect-dialog.tsx +++ b/libs/wallet/src/connect-dialog/connect-dialog.tsx @@ -10,7 +10,9 @@ import { } from '@vegaprotocol/ui-toolkit'; import { useCallback, useState } from 'react'; import type { WalletClientError } from '@vegaprotocol/wallet-client'; -import { ExternalLinks, t, useChainIdQuery } from '@vegaprotocol/react-helpers'; +import { ExternalLinks } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; +import { useChainIdQuery } from '@vegaprotocol/react-helpers'; import type { VegaConnector } from '../connectors'; import { ViewConnector } from '../connectors'; import { JsonRpcConnector, RestConnector } from '../connectors'; diff --git a/libs/wallet/src/connect-dialog/json-rpc-connector-form.tsx b/libs/wallet/src/connect-dialog/json-rpc-connector-form.tsx index ce038ecf1..b3cb78874 100644 --- a/libs/wallet/src/connect-dialog/json-rpc-connector-form.tsx +++ b/libs/wallet/src/connect-dialog/json-rpc-connector-form.tsx @@ -1,5 +1,6 @@ import capitalize from 'lodash/capitalize'; -import { createDocsLinks, t } from '@vegaprotocol/react-helpers'; +import { createDocsLinks } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { ButtonLink, Diamond, diff --git a/libs/wallet/src/connect-dialog/rest-connector-form.tsx b/libs/wallet/src/connect-dialog/rest-connector-form.tsx index 9be2acefa..d2e90c97c 100644 --- a/libs/wallet/src/connect-dialog/rest-connector-form.tsx +++ b/libs/wallet/src/connect-dialog/rest-connector-form.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Button, FormGroup, Input, InputError } from '@vegaprotocol/ui-toolkit'; import { useState } from 'react'; import { useForm } from 'react-hook-form'; diff --git a/libs/wallet/src/connect-dialog/view-connector-form.tsx b/libs/wallet/src/connect-dialog/view-connector-form.tsx index 990222fb9..d6367f2a7 100644 --- a/libs/wallet/src/connect-dialog/view-connector-form.tsx +++ b/libs/wallet/src/connect-dialog/view-connector-form.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Button, FormGroup, diff --git a/libs/wallet/src/connectors/json-rpc-connector.ts b/libs/wallet/src/connectors/json-rpc-connector.ts index a9c0dacbf..7a1186b48 100644 --- a/libs/wallet/src/connectors/json-rpc-connector.ts +++ b/libs/wallet/src/connectors/json-rpc-connector.ts @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { WalletClient, WalletClientError } from '@vegaprotocol/wallet-client'; import { clearConfig, getConfig, setConfig } from '../storage'; import type { Transaction, VegaConnector } from './vega-connector'; diff --git a/libs/wallet/src/connectors/rest-connector.ts b/libs/wallet/src/connectors/rest-connector.ts index 0e68da3f7..f7dc1b3be 100644 --- a/libs/wallet/src/connectors/rest-connector.ts +++ b/libs/wallet/src/connectors/rest-connector.ts @@ -3,7 +3,7 @@ import { clearConfig, getConfig, setConfig } from '../storage'; import type { Transaction, VegaConnector } from './vega-connector'; import { WalletError } from './vega-connector'; import { z } from 'zod'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; type TransactionError = | { diff --git a/libs/wallet/src/manage-dialog/manage-dialog.spec.tsx b/libs/wallet/src/manage-dialog/manage-dialog.spec.tsx index 58e6297a5..32513e078 100644 --- a/libs/wallet/src/manage-dialog/manage-dialog.spec.tsx +++ b/libs/wallet/src/manage-dialog/manage-dialog.spec.tsx @@ -4,7 +4,7 @@ import { VegaWalletContext } from '../context'; import type { VegaWalletContextShape } from '../context'; import type { VegaManageDialogProps } from '.'; import { VegaManageDialog } from '.'; -import { truncateByChars } from '@vegaprotocol/react-helpers'; +import { truncateByChars } from '@vegaprotocol/utils'; let props: VegaManageDialogProps; let context: Partial; diff --git a/libs/wallet/src/manage-dialog/manage-dialog.tsx b/libs/wallet/src/manage-dialog/manage-dialog.tsx index 73ef6c397..738837f55 100644 --- a/libs/wallet/src/manage-dialog/manage-dialog.tsx +++ b/libs/wallet/src/manage-dialog/manage-dialog.tsx @@ -1,4 +1,5 @@ -import { t, truncateByChars } from '@vegaprotocol/react-helpers'; +import { truncateByChars } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { Button, Dialog, diff --git a/libs/wallet/src/provider.spec.tsx b/libs/wallet/src/provider.spec.tsx index 03db43057..241d5a5d0 100644 --- a/libs/wallet/src/provider.spec.tsx +++ b/libs/wallet/src/provider.spec.tsx @@ -4,7 +4,7 @@ import { ViewConnector } from './connectors'; import { RestConnector } from './connectors'; import { useVegaWallet } from './use-vega-wallet'; import { VegaWalletProvider } from './provider'; -import { LocalStorage } from '@vegaprotocol/react-helpers'; +import { LocalStorage } from '@vegaprotocol/utils'; import type { ReactNode } from 'react'; import { WALLET_KEY } from './storage'; diff --git a/libs/wallet/src/provider.tsx b/libs/wallet/src/provider.tsx index 2d2c3c4cc..67f68e3b7 100644 --- a/libs/wallet/src/provider.tsx +++ b/libs/wallet/src/provider.tsx @@ -1,4 +1,4 @@ -import { LocalStorage } from '@vegaprotocol/react-helpers'; +import { LocalStorage } from '@vegaprotocol/utils'; import type { ReactNode } from 'react'; import { useCallback, useMemo, useRef, useState } from 'react'; import { WalletClientError } from '@vegaprotocol/wallet-client'; diff --git a/libs/wallet/src/storage.ts b/libs/wallet/src/storage.ts index a3e1aa0b5..d5fa8874c 100644 --- a/libs/wallet/src/storage.ts +++ b/libs/wallet/src/storage.ts @@ -1,4 +1,4 @@ -import { LocalStorage } from '@vegaprotocol/react-helpers'; +import { LocalStorage } from '@vegaprotocol/utils'; interface ConnectorConfig { token: string | null; diff --git a/libs/wallet/src/utils.ts b/libs/wallet/src/utils.ts index af5f4fd50..ff96d1710 100644 --- a/libs/wallet/src/utils.ts +++ b/libs/wallet/src/utils.ts @@ -1,4 +1,4 @@ -import { removeDecimal, toNanoSeconds } from '@vegaprotocol/react-helpers'; +import { removeDecimal, toNanoSeconds } from '@vegaprotocol/utils'; import type { Market, Order } from '@vegaprotocol/types'; import { OrderTimeInForce, OrderType, AccountType } from '@vegaprotocol/types'; import BigNumber from 'bignumber.js'; diff --git a/libs/wallet/src/vega-transaction-dialog/vega-transaction-dialog.tsx b/libs/wallet/src/vega-transaction-dialog/vega-transaction-dialog.tsx index e71606db4..7c5ff30f4 100644 --- a/libs/wallet/src/vega-transaction-dialog/vega-transaction-dialog.tsx +++ b/libs/wallet/src/vega-transaction-dialog/vega-transaction-dialog.tsx @@ -1,5 +1,5 @@ import { Networks, useEnvironment } from '@vegaprotocol/environment'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Dialog, Icon, Intent, Loader } from '@vegaprotocol/ui-toolkit'; import type { ReactNode } from 'react'; import { WalletClientError } from '@vegaprotocol/wallet-client'; diff --git a/libs/web3/src/lib/ethereum-transaction-dialog/dialog-rows.tsx b/libs/web3/src/lib/ethereum-transaction-dialog/dialog-rows.tsx index 49b2c24cf..f9994d2cb 100644 --- a/libs/web3/src/lib/ethereum-transaction-dialog/dialog-rows.tsx +++ b/libs/web3/src/lib/ethereum-transaction-dialog/dialog-rows.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Link } from '@vegaprotocol/ui-toolkit'; import { useEnvironment } from '@vegaprotocol/environment'; import { EthTxStatus } from '../use-ethereum-transaction'; diff --git a/libs/web3/src/lib/ethereum-transaction-dialog/ethereum-transaction-dialog.tsx b/libs/web3/src/lib/ethereum-transaction-dialog/ethereum-transaction-dialog.tsx index 8a0b02086..6e9ab909e 100644 --- a/libs/web3/src/lib/ethereum-transaction-dialog/ethereum-transaction-dialog.tsx +++ b/libs/web3/src/lib/ethereum-transaction-dialog/ethereum-transaction-dialog.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Button, Dialog, Icon, Intent, Loader } from '@vegaprotocol/ui-toolkit'; import { isEthereumError } from '../ethereum-error'; import type { EthTxState, TxError } from '../use-ethereum-transaction'; diff --git a/libs/web3/src/lib/use-ethereum-config.ts b/libs/web3/src/lib/use-ethereum-config.ts index 87df9ccad..c38e5f0b1 100644 --- a/libs/web3/src/lib/use-ethereum-config.ts +++ b/libs/web3/src/lib/use-ethereum-config.ts @@ -1,7 +1,5 @@ -import { - removePaginationWrapper, - useNetworkParamsQuery, -} from '@vegaprotocol/react-helpers'; +import { useNetworkParamsQuery } from '@vegaprotocol/react-helpers'; +import { removePaginationWrapper } from '@vegaprotocol/utils'; import { useMemo } from 'react'; export interface EthereumConfig { diff --git a/libs/web3/src/lib/use-ethereum-transaction.tsx b/libs/web3/src/lib/use-ethereum-transaction.tsx index 36c76fee3..95c7335d0 100644 --- a/libs/web3/src/lib/use-ethereum-transaction.tsx +++ b/libs/web3/src/lib/use-ethereum-transaction.tsx @@ -1,4 +1,4 @@ -import { formatLabel } from '@vegaprotocol/react-helpers'; +import { formatLabel } from '@vegaprotocol/utils'; import type { ethers } from 'ethers'; import { useCallback, useMemo, useState } from 'react'; import type { EthereumError } from './ethereum-error'; diff --git a/libs/web3/src/lib/use-ethereum-withdraw-approvals-manager.tsx b/libs/web3/src/lib/use-ethereum-withdraw-approvals-manager.tsx index 0d670a9a6..fa9bdf272 100644 --- a/libs/web3/src/lib/use-ethereum-withdraw-approvals-manager.tsx +++ b/libs/web3/src/lib/use-ethereum-withdraw-approvals-manager.tsx @@ -1,10 +1,10 @@ import { useApolloClient } from '@apollo/client'; import BigNumber from 'bignumber.js'; import { useRef, useEffect } from 'react'; -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; import { useGetWithdrawThreshold } from './use-get-withdraw-threshold'; import { useGetWithdrawDelay } from './use-get-withdraw-delay'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { CollateralBridge } from '@vegaprotocol/smart-contracts'; diff --git a/libs/web3/src/lib/use-get-withdraw-threshold.tsx b/libs/web3/src/lib/use-get-withdraw-threshold.tsx index a6c90cabc..77f1cff78 100644 --- a/libs/web3/src/lib/use-get-withdraw-threshold.tsx +++ b/libs/web3/src/lib/use-get-withdraw-threshold.tsx @@ -1,7 +1,7 @@ import { useCallback } from 'react'; import { useBridgeContract } from './use-bridge-contract'; import BigNumber from 'bignumber.js'; -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; import type { WithdrawalBusEventFieldsFragment } from '@vegaprotocol/wallet'; /** diff --git a/libs/web3/src/lib/web3-connect-dialog.tsx b/libs/web3/src/lib/web3-connect-dialog.tsx index 67b433bca..3ebc85794 100644 --- a/libs/web3/src/lib/web3-connect-dialog.tsx +++ b/libs/web3/src/lib/web3-connect-dialog.tsx @@ -1,4 +1,5 @@ -import { t, useLocalStorage } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; +import { useLocalStorage } from '@vegaprotocol/react-helpers'; import { Dialog, Intent } from '@vegaprotocol/ui-toolkit'; import { MetaMask } from '@web3-react/metamask'; import { WalletConnect } from '@web3-react/walletconnect'; diff --git a/libs/withdraws/src/lib/create-withdrawal-dialog.tsx b/libs/withdraws/src/lib/create-withdrawal-dialog.tsx index 3150d76d0..ed3760664 100644 --- a/libs/withdraws/src/lib/create-withdrawal-dialog.tsx +++ b/libs/withdraws/src/lib/create-withdrawal-dialog.tsx @@ -1,4 +1,4 @@ -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Dialog } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { WithdrawFormContainer } from './withdraw-form-container'; diff --git a/libs/withdraws/src/lib/use-verify-withdrawal.ts b/libs/withdraws/src/lib/use-verify-withdrawal.ts index 85cd4e387..6e75f6a6c 100644 --- a/libs/withdraws/src/lib/use-verify-withdrawal.ts +++ b/libs/withdraws/src/lib/use-verify-withdrawal.ts @@ -1,7 +1,8 @@ import { useCallback, useState } from 'react'; import { captureException } from '@sentry/react'; import BigNumber from 'bignumber.js'; -import { addDecimal, t } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { useGetWithdrawThreshold, useGetWithdrawDelay, diff --git a/libs/withdraws/src/lib/use-withdraw-asset.tsx b/libs/withdraws/src/lib/use-withdraw-asset.tsx index 874f3b30f..3cb6759bc 100644 --- a/libs/withdraws/src/lib/use-withdraw-asset.tsx +++ b/libs/withdraws/src/lib/use-withdraw-asset.tsx @@ -1,6 +1,6 @@ import { captureException } from '@sentry/react'; import type { Asset } from '@vegaprotocol/assets'; -import { addDecimal } from '@vegaprotocol/react-helpers'; +import { addDecimal } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import BigNumber from 'bignumber.js'; import { useCallback, useEffect } from 'react'; diff --git a/libs/withdraws/src/lib/withdraw-form-container.tsx b/libs/withdraws/src/lib/withdraw-form-container.tsx index 06b227d19..7e6b4c614 100644 --- a/libs/withdraws/src/lib/withdraw-form-container.tsx +++ b/libs/withdraws/src/lib/withdraw-form-container.tsx @@ -1,5 +1,7 @@ import { useMemo } from 'react'; -import { useDataProvider, t, toBigNum } from '@vegaprotocol/react-helpers'; +import { toBigNum } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; +import { useDataProvider } from '@vegaprotocol/react-helpers'; import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; import { accountsDataProvider } from '@vegaprotocol/accounts'; import type { WithdrawalArgs } from './use-create-withdraw'; diff --git a/libs/withdraws/src/lib/withdraw-form.tsx b/libs/withdraws/src/lib/withdraw-form.tsx index 8c61707db..108ea5e84 100644 --- a/libs/withdraws/src/lib/withdraw-form.tsx +++ b/libs/withdraws/src/lib/withdraw-form.tsx @@ -3,12 +3,12 @@ import { AssetOption } from '@vegaprotocol/assets'; import { ethereumAddress, minSafe, - t, removeDecimal, required, - useLocalStorage, isAssetTypeERC20, -} from '@vegaprotocol/react-helpers'; +} from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; +import { useLocalStorage } from '@vegaprotocol/react-helpers'; import { Button, FormGroup, diff --git a/libs/withdraws/src/lib/withdraw-limits.tsx b/libs/withdraws/src/lib/withdraw-limits.tsx index f67a720a9..c56fd0f6e 100644 --- a/libs/withdraws/src/lib/withdraw-limits.tsx +++ b/libs/withdraws/src/lib/withdraw-limits.tsx @@ -1,5 +1,6 @@ import type { Asset } from '@vegaprotocol/assets'; -import { compactNumber, t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; +import { CompactNumber } from '@vegaprotocol/react-helpers'; import { KeyValueTable, KeyValueTableRow } from '@vegaprotocol/ui-toolkit'; import BigNumber from 'bignumber.js'; import { formatDistanceToNow } from 'date-fns'; @@ -29,13 +30,17 @@ export const WithdrawLimits = ({ key: 'BALANCE_AVAILABLE', label: t('Balance available'), rawValue: balance, - value: balance ? compactNumber(balance, asset.decimals) : '-', + value: balance ? ( + + ) : ( + '-' + ), }, { key: 'WITHDRAWAL_THRESHOLD', label: t('Delayed withdrawal threshold'), rawValue: threshold, - value: compactNumber(threshold, asset.decimals), + value: , }, { key: 'DELAY_TIME', diff --git a/libs/withdraws/src/lib/withdrawal-dialog.tsx b/libs/withdraws/src/lib/withdrawal-dialog.tsx index 2ca6a45db..d31cf9bc6 100644 --- a/libs/withdraws/src/lib/withdrawal-dialog.tsx +++ b/libs/withdraws/src/lib/withdrawal-dialog.tsx @@ -1,5 +1,5 @@ import { create } from 'zustand'; -import { t } from '@vegaprotocol/react-helpers'; +import { t } from '@vegaprotocol/i18n'; import { Dialog } from '@vegaprotocol/ui-toolkit'; import { useVegaWallet } from '@vegaprotocol/wallet'; import { useCompleteWithdraw } from './use-complete-withdraw'; diff --git a/libs/withdraws/src/lib/withdrawal-feedback.tsx b/libs/withdraws/src/lib/withdrawal-feedback.tsx index bca2abd50..647cd5fa1 100644 --- a/libs/withdraws/src/lib/withdrawal-feedback.tsx +++ b/libs/withdraws/src/lib/withdrawal-feedback.tsx @@ -1,9 +1,6 @@ import { useEnvironment } from '@vegaprotocol/environment'; -import { - addDecimalsFormatNumber, - t, - truncateByChars, -} from '@vegaprotocol/react-helpers'; +import { addDecimalsFormatNumber, truncateByChars } from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { Button, KeyValueTable, diff --git a/libs/withdraws/src/lib/withdrawals-provider.ts b/libs/withdraws/src/lib/withdrawals-provider.ts index 23d0a0923..1c056d1ae 100644 --- a/libs/withdraws/src/lib/withdrawals-provider.ts +++ b/libs/withdraws/src/lib/withdrawals-provider.ts @@ -1,5 +1,9 @@ import uniqBy from 'lodash/uniqBy'; -import { makeDataProvider } from '@vegaprotocol/react-helpers'; +import { + makeDataProvider, + removePaginationWrapper, + getEvents, +} from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; import { WithdrawalsDocument, @@ -11,10 +15,6 @@ import type { WithdrawalEventSubscription, WithdrawalEventSubscriptionVariables, } from './__generated__/Withdrawal'; -import { - removePaginationWrapper, - getEvents, -} from '@vegaprotocol/react-helpers'; const sortWithdrawals = (data: WithdrawalFieldsFragment[]) => data.sort((a, b) => { diff --git a/libs/withdraws/src/lib/withdrawals-table.spec.tsx b/libs/withdraws/src/lib/withdrawals-table.spec.tsx index ed43874bf..52fb21b70 100644 --- a/libs/withdraws/src/lib/withdrawals-table.spec.tsx +++ b/libs/withdraws/src/lib/withdrawals-table.spec.tsx @@ -1,8 +1,8 @@ import { MockedProvider } from '@apollo/client/testing'; import { act, render, screen } from '@testing-library/react'; -import { getTimeFormat } from '@vegaprotocol/react-helpers'; +import { getTimeFormat } from '@vegaprotocol/utils'; import * as Schema from '@vegaprotocol/types'; -import type { TypedDataAgGrid } from '@vegaprotocol/ui-toolkit'; +import type { TypedDataAgGrid } from '@vegaprotocol/datagrid'; import { generateWithdrawal } from './test-helpers'; import { StatusCell } from './withdrawals-table'; import { WithdrawalsTable } from './withdrawals-table'; diff --git a/libs/withdraws/src/lib/withdrawals-table.tsx b/libs/withdraws/src/lib/withdrawals-table.tsx index 653bcfd5e..d21887bff 100644 --- a/libs/withdraws/src/lib/withdrawals-table.tsx +++ b/libs/withdraws/src/lib/withdrawals-table.tsx @@ -1,24 +1,24 @@ import { AgGridColumn } from 'ag-grid-react'; import { getDateTimeFormat, - t, truncateByChars, addDecimalsFormatNumber, isNumeric, -} from '@vegaprotocol/react-helpers'; -import type { - TypedDataAgGrid, - VegaICellRendererParams, - VegaValueFormatterParams, -} from '@vegaprotocol/ui-toolkit'; +} from '@vegaprotocol/utils'; +import { t } from '@vegaprotocol/i18n'; import { Link, ButtonLink, - AgGridDynamic as AgGrid, Intent, Icon, Loader, } from '@vegaprotocol/ui-toolkit'; +import { AgGridDynamic as AgGrid } from '@vegaprotocol/datagrid'; +import type { + TypedDataAgGrid, + VegaICellRendererParams, + VegaValueFormatterParams, +} from '@vegaprotocol/datagrid'; import { useEnvironment } from '@vegaprotocol/environment'; import type { WithdrawalFieldsFragment } from './__generated__/Withdrawal'; import { useEthWithdrawApprovalsStore } from '@vegaprotocol/web3'; diff --git a/tools/scripts/publish.mjs b/tools/scripts/publish.mjs new file mode 100644 index 000000000..ecb8d7b05 --- /dev/null +++ b/tools/scripts/publish.mjs @@ -0,0 +1,61 @@ +/** + * This is a minimal script to publish your package to "npm". + * This is meant to be used as-is or customize as you see fit. + * + * This script is executed on "dist/path/to/library" as "cwd" by default. + * + * You might need to authenticate with NPM before running this script. + */ + +import { readCachedProjectGraph } from '@nrwl/devkit'; +import { execSync } from 'child_process'; +import { readFileSync, writeFileSync } from 'fs'; +import chalk from 'chalk'; + +function invariant(condition, message) { + if (!condition) { + console.error(chalk.bold.red(message)); + process.exit(1); + } +} + +// Executing publish script: node path/to/publish.mjs {name} --version {version} --tag {tag} +// Default "tag" to "next" so we won't publish the "latest" tag by accident. +const [, , name, version, tag = 'next'] = process.argv; + +// A simple SemVer validation to validate the version +const validVersion = /^\d+\.\d+\.\d+(-\w+\.\d+)?/; +invariant( + version && validVersion.test(version), + `No version provided or version did not match Semantic Versioning, expected: #.#.#-tag.# or #.#.#, got ${version}.` +); + +const graph = readCachedProjectGraph(); +const project = graph.nodes[name]; + +invariant( + project, + `Could not find project "${name}" in the workspace. Is the project.json configured correctly?` +); + +const outputPath = project.data?.targets?.build?.options?.outputPath; +invariant( + outputPath, + `Could not find "build.options.outputPath" of project "${name}". Is project.json configured correctly?` +); + +process.chdir(outputPath); + +// Updating the version in "package.json" before publishing +try { + const json = JSON.parse(readFileSync(`package.json`).toString()); + json.version = version; + writeFileSync(`package.json`, JSON.stringify(json, null, 2)); +} catch (e) { + console.error( + chalk.bold.red(`Error reading package.json file from library build output.`) + ); +} + +// Execute "npm publish" to publish +execSync(`npm publish --access public --tag ${tag}`); diff --git a/tsconfig.base.json b/tsconfig.base.json index 3031bbc04..e75afceba 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -21,11 +21,12 @@ "@vegaprotocol/assets": ["libs/assets/src/index.ts"], "@vegaprotocol/candles-chart": ["libs/candles-chart/src/index.ts"], "@vegaprotocol/cypress": ["libs/cypress/src/index.ts"], + "@vegaprotocol/datagrid": ["libs/datagrid/src/index.ts"], "@vegaprotocol/deal-ticket": ["libs/deal-ticket/src/index.ts"], "@vegaprotocol/deposits": ["libs/deposits/src/index.ts"], "@vegaprotocol/environment": ["libs/environment/src/index.ts"], "@vegaprotocol/fills": ["libs/fills/src/index.ts"], - "@vegaprotocol/governance": ["libs/governance/src/index.ts"], + "@vegaprotocol/i18n": ["libs/i18n/src/index.ts"], "@vegaprotocol/ledger": ["libs/ledger/src/index.ts"], "@vegaprotocol/liquidity": ["libs/liquidity/src/index.ts"], "@vegaprotocol/market-depth": ["libs/market-depth/src/index.ts"], @@ -36,6 +37,7 @@ "@vegaprotocol/network-stats": ["libs/network-stats/src/index.ts"], "@vegaprotocol/orders": ["libs/orders/src/index.ts"], "@vegaprotocol/positions": ["libs/positions/src/index.ts"], + "@vegaprotocol/proposals": ["libs/proposals/src/index.ts"], "@vegaprotocol/react-helpers": ["libs/react-helpers/src/index.ts"], "@vegaprotocol/smart-contracts": ["libs/smart-contracts/src/index.ts"], "@vegaprotocol/tailwindcss-config": [ @@ -44,6 +46,7 @@ "@vegaprotocol/trades": ["libs/trades/src/index.ts"], "@vegaprotocol/types": ["libs/types/src/index.ts"], "@vegaprotocol/ui-toolkit": ["libs/ui-toolkit/src/index.ts"], + "@vegaprotocol/utils": ["libs/utils/src/index.ts"], "@vegaprotocol/wallet": ["libs/wallet/src/index.ts"], "@vegaprotocol/web3": ["libs/web3/src/index.ts"], "@vegaprotocol/withdraws": ["libs/withdraws/src/index.ts"] diff --git a/workspace.json b/workspace.json index fcb25e693..15f7a8c23 100644 --- a/workspace.json +++ b/workspace.json @@ -6,13 +6,16 @@ "assets": "libs/assets", "candles-chart": "libs/candles-chart", "cypress": "libs/cypress", + "datagrid": "libs/datagrid", "deal-ticket": "libs/deal-ticket", "deposits": "libs/deposits", "environment": "libs/environment", "explorer": "apps/explorer", "explorer-e2e": "apps/explorer-e2e", "fills": "libs/fills", - "governance": "libs/governance", + "governance": "apps/governance", + "governance-e2e": "apps/governance-e2e", + "i18n": "libs/i18n", "ledger": "libs/ledger", "liquidity": "libs/liquidity", "liquidity-provision-dashboard": "apps/liquidity-provision-dashboard", @@ -24,17 +27,17 @@ "network-stats": "libs/network-stats", "orders": "libs/orders", "positions": "libs/positions", + "proposals": "libs/proposals", "react-helpers": "libs/react-helpers", "smart-contracts": "libs/smart-contracts", "static": "apps/static", "tailwindcss-config": "libs/tailwindcss-config", - "token": "apps/token", - "token-e2e": "apps/token-e2e", "trades": "libs/trades", "trading": "apps/trading", "trading-e2e": "apps/trading-e2e", "types": "libs/types", "ui-toolkit": "libs/ui-toolkit", + "utils": "libs/utils", "wallet": "libs/wallet", "web3": "libs/web3", "withdraws": "libs/withdraws"