chore(trading,governance,explorer): comply with eslint type import rules (#5257)
This commit is contained in:
parent
02c425f304
commit
78add88014
@ -73,7 +73,8 @@
|
|||||||
"error",
|
"error",
|
||||||
{
|
{
|
||||||
"prefer": "type-imports",
|
"prefer": "type-imports",
|
||||||
"disallowTypeAnnotations": true
|
"disallowTypeAnnotations": true,
|
||||||
|
"fixStyle": "inline-type-imports"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"curly": ["error", "multi-line"]
|
"curly": ["error", "multi-line"]
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import type { AssetFieldsFragment } from '@vegaprotocol/assets';
|
import { type AssetFieldsFragment } from '@vegaprotocol/assets';
|
||||||
import { AssetTypeMapping, AssetStatusMapping } from '@vegaprotocol/assets';
|
import { AssetTypeMapping, AssetStatusMapping } from '@vegaprotocol/assets';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import { ButtonLink } from '@vegaprotocol/ui-toolkit';
|
import { ButtonLink } from '@vegaprotocol/ui-toolkit';
|
||||||
import type { AgGridReact } from 'ag-grid-react';
|
import { type AgGridReact } from 'ag-grid-react';
|
||||||
import { AgGrid } from '@vegaprotocol/datagrid';
|
import { AgGrid } from '@vegaprotocol/datagrid';
|
||||||
import type { VegaICellRendererParams } from '@vegaprotocol/datagrid';
|
import { type VegaICellRendererParams } from '@vegaprotocol/datagrid';
|
||||||
import { useRef, useLayoutEffect } from 'react';
|
import { useRef, useLayoutEffect } from 'react';
|
||||||
import { BREAKPOINT_MD } from '../../config/breakpoints';
|
import { BREAKPOINT_MD } from '../../config/breakpoints';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import type { RowClickedEvent, ColDef } from 'ag-grid-community';
|
import { type RowClickedEvent, ColDef } from 'ag-grid-community';
|
||||||
|
|
||||||
type AssetsTableProps = {
|
type AssetsTableProps = {
|
||||||
data: AssetFieldsFragment[] | null;
|
data: AssetFieldsFragment[] | null;
|
||||||
|
@ -2,18 +2,18 @@ import { useMemo } from 'react';
|
|||||||
import { getAsset, type MarketFieldsFragment } from '@vegaprotocol/markets';
|
import { getAsset, type MarketFieldsFragment } from '@vegaprotocol/markets';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import { ButtonLink } from '@vegaprotocol/ui-toolkit';
|
import { ButtonLink } from '@vegaprotocol/ui-toolkit';
|
||||||
import type { AgGridReact } from 'ag-grid-react';
|
import { type AgGridReact } from 'ag-grid-react';
|
||||||
import type { ColDef } from 'ag-grid-community';
|
import { type ColDef } from 'ag-grid-community';
|
||||||
import { AgGrid } from '@vegaprotocol/datagrid';
|
import { AgGrid } from '@vegaprotocol/datagrid';
|
||||||
import type {
|
import {
|
||||||
VegaICellRendererParams,
|
type VegaICellRendererParams,
|
||||||
VegaValueGetterParams,
|
type VegaValueGetterParams,
|
||||||
} from '@vegaprotocol/datagrid';
|
} from '@vegaprotocol/datagrid';
|
||||||
import { useRef, useLayoutEffect } from 'react';
|
import { useRef, useLayoutEffect } from 'react';
|
||||||
import { BREAKPOINT_MD } from '../../config/breakpoints';
|
import { BREAKPOINT_MD } from '../../config/breakpoints';
|
||||||
import { MarketStateMapping } from '@vegaprotocol/types';
|
import { MarketStateMapping } from '@vegaprotocol/types';
|
||||||
import { useAssetDetailsDialogStore } from '@vegaprotocol/assets';
|
import { useAssetDetailsDialogStore } from '@vegaprotocol/assets';
|
||||||
import type { RowClickedEvent } from 'ag-grid-community';
|
import { type RowClickedEvent } from 'ag-grid-community';
|
||||||
import { Link, useNavigate } from 'react-router-dom';
|
import { Link, useNavigate } from 'react-router-dom';
|
||||||
|
|
||||||
type MarketsTableProps = {
|
type MarketsTableProps = {
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import type { ProposalListFieldsFragment } from '@vegaprotocol/proposals';
|
import { type ProposalListFieldsFragment } from '@vegaprotocol/proposals';
|
||||||
import { VoteProgress } from '@vegaprotocol/proposals';
|
import { VoteProgress } from '@vegaprotocol/proposals';
|
||||||
import type { AgGridReact } from 'ag-grid-react';
|
import { type AgGridReact } from 'ag-grid-react';
|
||||||
import { ExternalLink } from '@vegaprotocol/ui-toolkit';
|
import { ExternalLink } from '@vegaprotocol/ui-toolkit';
|
||||||
import { AgGrid } from '@vegaprotocol/datagrid';
|
import { AgGrid } from '@vegaprotocol/datagrid';
|
||||||
import type {
|
import {
|
||||||
VegaICellRendererParams,
|
type VegaICellRendererParams,
|
||||||
VegaValueFormatterParams,
|
type VegaValueFormatterParams,
|
||||||
} from '@vegaprotocol/datagrid';
|
} from '@vegaprotocol/datagrid';
|
||||||
import { useLayoutEffect, useMemo, useRef, useState } from 'react';
|
import { useLayoutEffect, useMemo, useRef, useState } from 'react';
|
||||||
import type { RowClickedEvent, ColDef } from 'ag-grid-community';
|
import { type RowClickedEvent, ColDef } from 'ag-grid-community';
|
||||||
import { getDateTimeFormat } from '@vegaprotocol/utils';
|
import { getDateTimeFormat } from '@vegaprotocol/utils';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import {
|
import {
|
||||||
@ -105,7 +105,7 @@ export const ProposalsTable = ({ data }: ProposalsTableProps) => {
|
|||||||
? new BigNumber(0)
|
? new BigNumber(0)
|
||||||
: yesTokens.multipliedBy(100).dividedBy(totalTokensVoted);
|
: yesTokens.multipliedBy(100).dividedBy(totalTokensVoted);
|
||||||
return (
|
return (
|
||||||
<div className="flex items-center justify-center h-full pt-2 uppercase">
|
<div className="flex h-full items-center justify-center pt-2 uppercase">
|
||||||
<VoteProgress
|
<VoteProgress
|
||||||
threshold={requiredMajorityPercentage}
|
threshold={requiredMajorityPercentage}
|
||||||
progress={yesPercentage}
|
progress={yesPercentage}
|
||||||
|
@ -3,8 +3,8 @@ import { DATA_SOURCES } from '../../../config';
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import { useFetch } from '@vegaprotocol/react-helpers';
|
import { useFetch } from '@vegaprotocol/react-helpers';
|
||||||
import { TxDetailsOrder } from './tx-order';
|
import { TxDetailsOrder } from './tx-order';
|
||||||
import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response';
|
import { type BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response';
|
||||||
import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response';
|
import { type TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response';
|
||||||
import { TxDetailsHeartbeat } from './tx-hearbeat';
|
import { TxDetailsHeartbeat } from './tx-hearbeat';
|
||||||
import { TxDetailsGeneric } from './tx-generic';
|
import { TxDetailsGeneric } from './tx-generic';
|
||||||
import { TxDetailsBatch } from './tx-batch';
|
import { TxDetailsBatch } from './tx-batch';
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { Table, TableRow } from '../table';
|
import { Table, TableRow } from '../table';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import { useFetch } from '@vegaprotocol/react-helpers';
|
import { useFetch } from '@vegaprotocol/react-helpers';
|
||||||
import type { BlockExplorerTransactions } from '../../routes/types/block-explorer-response';
|
import { type BlockExplorerTransactions } from '../../routes/types/block-explorer-response';
|
||||||
import { getTxsDataUrl } from '../../hooks/get-txs-data-url';
|
import { getTxsDataUrl } from '../../hooks/get-txs-data-url';
|
||||||
import { AsyncRenderer, Loader } from '@vegaprotocol/ui-toolkit';
|
import { AsyncRenderer, Loader } from '@vegaprotocol/ui-toolkit';
|
||||||
import EmptyList from '../empty-list/empty-list';
|
import EmptyList from '../empty-list/empty-list';
|
||||||
@ -22,7 +22,7 @@ export const TxsPerBlock = ({ blockHeight, txCount }: TxsPerBlockProps) => {
|
|||||||
return (
|
return (
|
||||||
<AsyncRenderer data={data} error={error} loading={!!loading}>
|
<AsyncRenderer data={data} error={error} loading={!!loading}>
|
||||||
{data && data.transactions.length > 0 ? (
|
{data && data.transactions.length > 0 ? (
|
||||||
<div className="overflow-x-auto whitespace-nowrap mb-28">
|
<div className="mb-28 overflow-x-auto whitespace-nowrap">
|
||||||
<Table>
|
<Table>
|
||||||
<thead>
|
<thead>
|
||||||
<TableRow modifier="bordered" className="font-mono">
|
<TableRow modifier="bordered" className="font-mono">
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
import { useSearchParams } from 'react-router-dom';
|
import { useSearchParams } from 'react-router-dom';
|
||||||
import type { URLSearchParamsInit } from 'react-router-dom';
|
import { type URLSearchParamsInit } from 'react-router-dom';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
import { useFetch } from '@vegaprotocol/react-helpers';
|
import { useFetch } from '@vegaprotocol/react-helpers';
|
||||||
import type {
|
import {
|
||||||
BlockExplorerTransactionResult,
|
type BlockExplorerTransactionResult,
|
||||||
BlockExplorerTransactions,
|
type BlockExplorerTransactions,
|
||||||
} from '../routes/types/block-explorer-response';
|
} from '../routes/types/block-explorer-response';
|
||||||
import isNumber from 'lodash/isNumber';
|
import isNumber from 'lodash/isNumber';
|
||||||
import { AllFilterOptions } from '../components/txs/tx-filter';
|
import { AllFilterOptions } from '../components/txs/tx-filter';
|
||||||
import type { FilterOption } from '../components/txs/tx-filter';
|
import { type FilterOption } from '../components/txs/tx-filter';
|
||||||
import { BE_TXS_PER_REQUEST, getTxsDataUrl } from './get-txs-data-url';
|
import { BE_TXS_PER_REQUEST, getTxsDataUrl } from './get-txs-data-url';
|
||||||
|
|
||||||
export function getTypeFilters(filters?: Set<FilterOption>) {
|
export function getTypeFilters(filters?: Set<FilterOption>) {
|
||||||
|
@ -9,11 +9,13 @@ import { JsonViewerDialog } from '../../components/dialogs/json-viewer-dialog';
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { PageTitle } from '../../components/page-helpers/page-title';
|
import { PageTitle } from '../../components/page-helpers/page-title';
|
||||||
|
|
||||||
|
type Params = { assetId: string };
|
||||||
|
|
||||||
export const AssetPage = () => {
|
export const AssetPage = () => {
|
||||||
useDocumentTitle(['Assets']);
|
useDocumentTitle(['Assets']);
|
||||||
useScrollToLocation();
|
useScrollToLocation();
|
||||||
|
|
||||||
const { assetId } = useParams<{ assetId: string }>();
|
const { assetId } = useParams<Params>();
|
||||||
const { data, loading, error } = useAssetDataProvider(assetId || '');
|
const { data, loading, error } = useAssetDataProvider(assetId || '');
|
||||||
|
|
||||||
const title = data ? data.name : error ? t('Asset not found') : '';
|
const title = data ? data.name : error ? t('Asset not found') : '';
|
||||||
@ -41,7 +43,7 @@ export const AssetPage = () => {
|
|||||||
loading={loading}
|
loading={loading}
|
||||||
error={error}
|
error={error}
|
||||||
>
|
>
|
||||||
<div className="h-full relative">
|
<div className="relative h-full">
|
||||||
<AssetDetailsTable asset={data as AssetFieldsFragment} />
|
<AssetDetailsTable asset={data as AssetFieldsFragment} />
|
||||||
</div>
|
</div>
|
||||||
</AsyncRenderer>
|
</AsyncRenderer>
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import { DATA_SOURCES } from '../../../config';
|
import { DATA_SOURCES } from '../../../config';
|
||||||
import type {
|
import {
|
||||||
BlockMeta,
|
type BlockMeta,
|
||||||
TendermintBlockchainResponse,
|
type TendermintBlockchainResponse,
|
||||||
} from '../tendermint-blockchain-response';
|
} from '../tendermint-blockchain-response';
|
||||||
import { RouteTitle } from '../../../components/route-title';
|
import { RouteTitle } from '../../../components/route-title';
|
||||||
import { BlocksRefetch } from '../../../components/blocks';
|
import { BlocksRefetch } from '../../../components/blocks';
|
||||||
|
@ -17,8 +17,10 @@ import { NodeLink } from '../../../components/links';
|
|||||||
import { useDocumentTitle } from '../../../hooks/use-document-title';
|
import { useDocumentTitle } from '../../../hooks/use-document-title';
|
||||||
import EmptyList from '../../../components/empty-list/empty-list';
|
import EmptyList from '../../../components/empty-list/empty-list';
|
||||||
|
|
||||||
|
type Params = { block: string };
|
||||||
|
|
||||||
const Block = () => {
|
const Block = () => {
|
||||||
const { block } = useParams<{ block: string }>();
|
const { block } = useParams<Params>();
|
||||||
useDocumentTitle(['Blocks', `Block #${block}`]);
|
useDocumentTitle(['Blocks', `Block #${block}`]);
|
||||||
const {
|
const {
|
||||||
state: { data: blockData, loading, error },
|
state: { data: blockData, loading, error },
|
||||||
@ -29,7 +31,7 @@ const Block = () => {
|
|||||||
<RouteTitle data-testid="block-header">{t(`BLOCK ${block}`)}</RouteTitle>
|
<RouteTitle data-testid="block-header">{t(`BLOCK ${block}`)}</RouteTitle>
|
||||||
<AsyncRenderer data={blockData} error={error} loading={!!loading}>
|
<AsyncRenderer data={blockData} error={error} loading={!!loading}>
|
||||||
<>
|
<>
|
||||||
<div className="grid grid-cols-2 gap-2 mb-8">
|
<div className="mb-8 grid grid-cols-2 gap-2">
|
||||||
<Link
|
<Link
|
||||||
data-testid="previous-block"
|
data-testid="previous-block"
|
||||||
to={`/${Routes.BLOCKS}/${Number(block) - 1}`}
|
to={`/${Routes.BLOCKS}/${Number(block) - 1}`}
|
||||||
|
@ -3,7 +3,7 @@ import { useFetch } from '@vegaprotocol/react-helpers';
|
|||||||
import { RouteTitle } from '../../components/route-title';
|
import { RouteTitle } from '../../components/route-title';
|
||||||
import { AsyncRenderer, SyntaxHighlighter } from '@vegaprotocol/ui-toolkit';
|
import { AsyncRenderer, SyntaxHighlighter } from '@vegaprotocol/ui-toolkit';
|
||||||
import { DATA_SOURCES } from '../../config';
|
import { DATA_SOURCES } from '../../config';
|
||||||
import type { TendermintGenesisResponse } from './tendermint-genesis-response';
|
import { type TendermintGenesisResponse } from './tendermint-genesis-response';
|
||||||
import { useDocumentTitle } from '../../hooks/use-document-title';
|
import { useDocumentTitle } from '../../hooks/use-document-title';
|
||||||
|
|
||||||
const Genesis = () => {
|
const Genesis = () => {
|
||||||
|
@ -11,10 +11,12 @@ import { JsonViewerDialog } from '../../components/dialogs/json-viewer-dialog';
|
|||||||
import { marketInfoWithDataProvider } from '@vegaprotocol/markets';
|
import { marketInfoWithDataProvider } from '@vegaprotocol/markets';
|
||||||
import { PageTitle } from '../../components/page-helpers/page-title';
|
import { PageTitle } from '../../components/page-helpers/page-title';
|
||||||
|
|
||||||
|
type Params = { marketId: string };
|
||||||
|
|
||||||
export const MarketPage = () => {
|
export const MarketPage = () => {
|
||||||
useScrollToLocation();
|
useScrollToLocation();
|
||||||
|
|
||||||
const { marketId } = useParams<{ marketId: string }>();
|
const { marketId } = useParams<Params>();
|
||||||
|
|
||||||
const { data, loading, error } = useDataProvider({
|
const { data, loading, error } = useDataProvider({
|
||||||
dataProvider: marketInfoWithDataProvider,
|
dataProvider: marketInfoWithDataProvider,
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
import { getNodes } from '@vegaprotocol/utils';
|
import { getNodes } from '@vegaprotocol/utils';
|
||||||
import { MarketLink } from '../../../components/links';
|
import { MarketLink } from '../../../components/links';
|
||||||
import { TableRow, TableCell, TableHeader } from '../../../components/table';
|
import { TableRow, TableCell, TableHeader } from '../../../components/table';
|
||||||
import type { ExplorerOracleForMarketsMarketFragment } from '../__generated__/OraclesForMarkets';
|
import {
|
||||||
import { useExplorerOracleFormMarketsQuery } from '../__generated__/OraclesForMarkets';
|
useExplorerOracleFormMarketsQuery,
|
||||||
|
type ExplorerOracleForMarketsMarketFragment,
|
||||||
|
} from '../__generated__/OraclesForMarkets';
|
||||||
|
|
||||||
interface OracleMarketsProps {
|
interface OracleMarketsProps {
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -9,8 +9,10 @@ import { AsyncRenderer, SyntaxHighlighter } from '@vegaprotocol/ui-toolkit';
|
|||||||
import filter from 'recursive-key-filter';
|
import filter from 'recursive-key-filter';
|
||||||
import { TruncateInline } from '../../../components/truncate/truncate';
|
import { TruncateInline } from '../../../components/truncate/truncate';
|
||||||
|
|
||||||
|
type Params = { id: string };
|
||||||
|
|
||||||
export const Oracle = () => {
|
export const Oracle = () => {
|
||||||
const { id } = useParams<{ id: string }>();
|
const { id } = useParams<Params>();
|
||||||
|
|
||||||
useDocumentTitle(['Oracle', `Oracle #${truncateByChars(id || '1', 5, 5)}`]);
|
useDocumentTitle(['Oracle', `Oracle #${truncateByChars(id || '1', 5, 5)}`]);
|
||||||
|
|
||||||
|
@ -6,8 +6,10 @@ import { useDocumentTitle } from '../../../../hooks/use-document-title';
|
|||||||
|
|
||||||
import { PartyAccounts } from '../components/party-accounts';
|
import { PartyAccounts } from '../components/party-accounts';
|
||||||
|
|
||||||
|
type Params = { party: string };
|
||||||
|
|
||||||
const PartyAccountsByAsset = () => {
|
const PartyAccountsByAsset = () => {
|
||||||
const { party } = useParams<{ party: string }>();
|
const { party } = useParams<Params>();
|
||||||
|
|
||||||
useDocumentTitle(['Public keys', party || '-']);
|
useDocumentTitle(['Public keys', party || '-']);
|
||||||
const partyId = toNonHex(party ? party : '');
|
const partyId = toNonHex(party ? party : '');
|
||||||
|
@ -19,11 +19,13 @@ import type { FilterOption } from '../../../components/txs/tx-filter';
|
|||||||
import { AllFilterOptions, TxsFilter } from '../../../components/txs/tx-filter';
|
import { AllFilterOptions, TxsFilter } from '../../../components/txs/tx-filter';
|
||||||
import { useSearchParams } from 'react-router-dom';
|
import { useSearchParams } from 'react-router-dom';
|
||||||
|
|
||||||
|
type Params = { party: string };
|
||||||
|
|
||||||
const Party = () => {
|
const Party = () => {
|
||||||
const [params] = useSearchParams();
|
const [params] = useSearchParams();
|
||||||
|
|
||||||
const [filters, setFilters] = useState(new Set(AllFilterOptions));
|
const [filters, setFilters] = useState(new Set(AllFilterOptions));
|
||||||
const { party } = useParams<{ party: string }>();
|
const { party } = useParams<Params>();
|
||||||
|
|
||||||
useDocumentTitle(['Public keys', party || '-']);
|
useDocumentTitle(['Public keys', party || '-']);
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
@ -60,7 +62,7 @@ const Party = () => {
|
|||||||
|
|
||||||
if (!isValidPartyId(partyId)) {
|
if (!isValidPartyId(partyId)) {
|
||||||
return (
|
return (
|
||||||
<div className="max-w-sm mx-auto">
|
<div className="mx-auto max-w-sm">
|
||||||
<Notification
|
<Notification
|
||||||
message={t('Invalid party ID')}
|
message={t('Invalid party ID')}
|
||||||
intent={Intent.Danger}
|
intent={Intent.Danger}
|
||||||
@ -84,7 +86,7 @@ const Party = () => {
|
|||||||
truncateEnd={visibleChars}
|
truncateEnd={visibleChars}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<div className="grid md:grid-flow-col grid-flow-row md:space-x-4 grid-cols-1 md:grid-cols-2 w-full">
|
<div className="grid w-full grid-flow-row grid-cols-1 md:grid-flow-col md:grid-cols-2 md:space-x-4">
|
||||||
<PartyBlockAccounts
|
<PartyBlockAccounts
|
||||||
accountError={AccountError}
|
accountError={AccountError}
|
||||||
accountLoading={AccountLoading}
|
accountLoading={AccountLoading}
|
||||||
|
@ -4,13 +4,15 @@ import { useFetch } from '@vegaprotocol/react-helpers';
|
|||||||
import { DATA_SOURCES } from '../../../config';
|
import { DATA_SOURCES } from '../../../config';
|
||||||
import { RenderFetched } from '../../../components/render-fetched';
|
import { RenderFetched } from '../../../components/render-fetched';
|
||||||
import { TxDetails } from './tx-details';
|
import { TxDetails } from './tx-details';
|
||||||
import type { BlockExplorerTransaction } from '../../../routes/types/block-explorer-response';
|
import { type BlockExplorerTransaction } from '../../../routes/types/block-explorer-response';
|
||||||
import { toNonHex } from '../../../components/search/detect-search';
|
import { toNonHex } from '../../../components/search/detect-search';
|
||||||
import { PageHeader } from '../../../components/page-header';
|
import { PageHeader } from '../../../components/page-header';
|
||||||
import { useDocumentTitle } from '../../../hooks/use-document-title';
|
import { useDocumentTitle } from '../../../hooks/use-document-title';
|
||||||
|
|
||||||
|
type Params = { txHash: string };
|
||||||
|
|
||||||
const Tx = () => {
|
const Tx = () => {
|
||||||
const { txHash } = useParams<{ txHash: string }>();
|
const { txHash } = useParams<Params>();
|
||||||
const hash = txHash ? toNonHex(txHash) : '';
|
const hash = txHash ? toNonHex(txHash) : '';
|
||||||
let errorMessage: string | undefined = undefined;
|
let errorMessage: string | undefined = undefined;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"extends": ["plugin:cypress/recommended", "../../.eslintrc.json"],
|
"extends": ["plugin:cypress/recommended", "../../.eslintrc.json"],
|
||||||
"ignorePatterns": ["!**/*"],
|
"ignorePatterns": ["!**/*", "cypress"],
|
||||||
"overrides": [
|
"overrides": [
|
||||||
{
|
{
|
||||||
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
|
||||||
|
@ -31,7 +31,7 @@ import {
|
|||||||
switchVegaWalletPubKey,
|
switchVegaWalletPubKey,
|
||||||
vegaWalletSetSpecifiedApprovalAmount,
|
vegaWalletSetSpecifiedApprovalAmount,
|
||||||
} from '../../support/wallet-functions';
|
} from '../../support/wallet-functions';
|
||||||
import type { testFreeformProposal } from '../../support/common-interfaces';
|
import { type testFreeformProposal } from '../../support/common-interfaces';
|
||||||
import { formatDateWithLocalTimezone } from '@vegaprotocol/utils';
|
import { formatDateWithLocalTimezone } from '@vegaprotocol/utils';
|
||||||
import {
|
import {
|
||||||
createGovernanceTransferProposalTxBody,
|
createGovernanceTransferProposalTxBody,
|
||||||
|
@ -34,7 +34,7 @@ import {
|
|||||||
vegaWalletTeardown,
|
vegaWalletTeardown,
|
||||||
} from '../../support/wallet-functions';
|
} from '../../support/wallet-functions';
|
||||||
import { ethereumWalletConnect } from '../../support/wallet-eth.functions';
|
import { ethereumWalletConnect } from '../../support/wallet-eth.functions';
|
||||||
import type { testFreeformProposal } from '../../support/common-interfaces';
|
import { type testFreeformProposal } from '../../support/common-interfaces';
|
||||||
|
|
||||||
const vegaWalletStakedBalances = 'vega-wallet-balance-staked-validators';
|
const vegaWalletStakedBalances = 'vega-wallet-balance-staked-validators';
|
||||||
const vegaWalletAssociatedBalance = 'associated-amount';
|
const vegaWalletAssociatedBalance = 'associated-amount';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import type { testFreeformProposal } from '../../support/common-interfaces';
|
import { type testFreeformProposal } from '../../support/common-interfaces';
|
||||||
import {
|
import {
|
||||||
navigateTo,
|
navigateTo,
|
||||||
navigation,
|
navigation,
|
||||||
|
@ -10,7 +10,7 @@ import noIcon from '../../images/token-no-icon.png';
|
|||||||
import vegaBlack from '../../images/vega_black.png';
|
import vegaBlack from '../../images/vega_black.png';
|
||||||
import vegaVesting from '../../images/vega_vesting.png';
|
import vegaVesting from '../../images/vega_vesting.png';
|
||||||
import { BigNumber } from '../../lib/bignumber';
|
import { BigNumber } from '../../lib/bignumber';
|
||||||
import type { WalletCardAssetProps } from '../wallet-card';
|
import { type WalletCardAssetProps } from '../wallet-card';
|
||||||
import { useVegaWallet } from '@vegaprotocol/wallet';
|
import { useVegaWallet } from '@vegaprotocol/wallet';
|
||||||
import { useContracts } from '../../contexts/contracts/contracts-context';
|
import { useContracts } from '../../contexts/contracts/contracts-context';
|
||||||
import * as Schema from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
@ -21,12 +21,12 @@ import {
|
|||||||
toBigNum,
|
toBigNum,
|
||||||
} from '@vegaprotocol/utils';
|
} from '@vegaprotocol/utils';
|
||||||
import { useAppState } from '../../contexts/app-state/app-state-context';
|
import { useAppState } from '../../contexts/app-state/app-state-context';
|
||||||
import type {
|
import {
|
||||||
DelegationsQuery,
|
DelegationsDocument,
|
||||||
DelegationsQueryVariables,
|
type DelegationsQuery,
|
||||||
WalletDelegationFieldsFragment,
|
type DelegationsQueryVariables,
|
||||||
|
type WalletDelegationFieldsFragment,
|
||||||
} from './__generated__/Delegations';
|
} from './__generated__/Delegations';
|
||||||
import { DelegationsDocument } from './__generated__/Delegations';
|
|
||||||
import { isPartyNotFoundError } from '../../lib/party';
|
import { isPartyNotFoundError } from '../../lib/party';
|
||||||
|
|
||||||
export const usePollForDelegations = () => {
|
export const usePollForDelegations = () => {
|
||||||
@ -44,6 +44,7 @@ export const usePollForDelegations = () => {
|
|||||||
const [delegatedNodes, setDelegatedNodes] = React.useState<
|
const [delegatedNodes, setDelegatedNodes] = React.useState<
|
||||||
{
|
{
|
||||||
nodeId: string;
|
nodeId: string;
|
||||||
|
// eslint-disable-next-line
|
||||||
name: string;
|
name: string;
|
||||||
hasStakePending: boolean;
|
hasStakePending: boolean;
|
||||||
currentEpochStake?: BigNumber;
|
currentEpochStake?: BigNumber;
|
||||||
|
@ -9,7 +9,7 @@ import { useWeb3React } from '@web3-react/core';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { SplashLoader } from '../../components/splash-loader';
|
import { SplashLoader } from '../../components/splash-loader';
|
||||||
import type { ContractsContextShape } from './contracts-context';
|
import { type ContractsContextShape } from './contracts-context';
|
||||||
import { ContractsContext } from './contracts-context';
|
import { ContractsContext } from './contracts-context';
|
||||||
import { createDefaultProvider } from '../../lib/web3-connectors';
|
import { createDefaultProvider } from '../../lib/web3-connectors';
|
||||||
import { useEthereumConfig } from '@vegaprotocol/web3';
|
import { useEthereumConfig } from '@vegaprotocol/web3';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import type { CollateralBridge } from '@vegaprotocol/smart-contracts';
|
import { type CollateralBridge } from '@vegaprotocol/smart-contracts';
|
||||||
import * as Schema from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import { Button } from '@vegaprotocol/ui-toolkit';
|
import { Button } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useBridgeContract, useEthereumTransaction } from '@vegaprotocol/web3';
|
import { useBridgeContract, useEthereumTransaction } from '@vegaprotocol/web3';
|
||||||
@ -88,7 +88,7 @@ export const ListAsset = ({
|
|||||||
assetData.erc20ListAssetBundle;
|
assetData.erc20ListAssetBundle;
|
||||||
return (
|
return (
|
||||||
<div className="mb-8">
|
<div className="mb-8">
|
||||||
<h3 className="text-xl mb-2">{t('ListAsset')}</h3>
|
<h3 className="mb-2 text-xl">{t('ListAsset')}</h3>
|
||||||
<p className="pr-8">{t('ListAssetDescription')}</p>
|
<p className="pr-8">{t('ListAssetDescription')}</p>
|
||||||
<EthWalletContainer>
|
<EthWalletContainer>
|
||||||
<Button
|
<Button
|
||||||
|
@ -4,7 +4,7 @@ import { VoteValue } from '@vegaprotocol/types';
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { useUserVoteQuery } from './__generated__/Vote';
|
import { useUserVoteQuery } from './__generated__/Vote';
|
||||||
import { removePaginationWrapper } from '@vegaprotocol/utils';
|
import { removePaginationWrapper } from '@vegaprotocol/utils';
|
||||||
import type { FinalizedVote } from '@vegaprotocol/proposals';
|
import { type FinalizedVote } from '@vegaprotocol/proposals';
|
||||||
|
|
||||||
export enum VoteState {
|
export enum VoteState {
|
||||||
NotCast = 'NotCast',
|
NotCast = 'NotCast',
|
||||||
|
@ -5,15 +5,17 @@ import { useTranslation } from 'react-i18next';
|
|||||||
|
|
||||||
import { SplashLoader } from '../../../components/splash-loader';
|
import { SplashLoader } from '../../../components/splash-loader';
|
||||||
import { ProposalsList } from '../components/proposals-list';
|
import { ProposalsList } from '../components/proposals-list';
|
||||||
import { useProposalsQuery } from './__generated__/Proposals';
|
|
||||||
import { getNodes, removePaginationWrapper } from '@vegaprotocol/utils';
|
import { getNodes, removePaginationWrapper } from '@vegaprotocol/utils';
|
||||||
import {
|
import {
|
||||||
ProposalState,
|
ProposalState,
|
||||||
ProtocolUpgradeProposalStatus,
|
ProtocolUpgradeProposalStatus,
|
||||||
} from '@vegaprotocol/types';
|
} from '@vegaprotocol/types';
|
||||||
import type { NodeConnection, NodeEdge } from '@vegaprotocol/utils';
|
import { type NodeConnection, type NodeEdge } from '@vegaprotocol/utils';
|
||||||
import type { ProposalFieldsFragment } from './__generated__/Proposals';
|
import {
|
||||||
import type { ProtocolUpgradeProposalFieldsFragment } from '@vegaprotocol/proposals';
|
useProposalsQuery,
|
||||||
|
type ProposalFieldsFragment,
|
||||||
|
} from './__generated__/Proposals';
|
||||||
|
import { type ProtocolUpgradeProposalFieldsFragment } from '@vegaprotocol/proposals';
|
||||||
import { useProtocolUpgradeProposalsQuery } from '@vegaprotocol/proposals';
|
import { useProtocolUpgradeProposalsQuery } from '@vegaprotocol/proposals';
|
||||||
import { FLAGS } from '@vegaprotocol/environment';
|
import { FLAGS } from '@vegaprotocol/environment';
|
||||||
|
|
||||||
|
@ -5,9 +5,9 @@ import * as faker from 'faker';
|
|||||||
import isArray from 'lodash/isArray';
|
import isArray from 'lodash/isArray';
|
||||||
import mergeWith from 'lodash/mergeWith';
|
import mergeWith from 'lodash/mergeWith';
|
||||||
|
|
||||||
import type { PartialDeep } from 'type-fest';
|
import { type PartialDeep } from 'type-fest';
|
||||||
import type { ProposalQuery } from '../proposal/__generated__/Proposal';
|
import { type ProposalQuery } from '../proposal/__generated__/Proposal';
|
||||||
import type { ProtocolUpgradeProposalFieldsFragment } from '@vegaprotocol/proposals';
|
import { type ProtocolUpgradeProposalFieldsFragment } from '@vegaprotocol/proposals';
|
||||||
|
|
||||||
export function generateProtocolUpgradeProposal(
|
export function generateProtocolUpgradeProposal(
|
||||||
override: PartialDeep<ProtocolUpgradeProposalFieldsFragment> = {}
|
override: PartialDeep<ProtocolUpgradeProposalFieldsFragment> = {}
|
||||||
|
@ -22,11 +22,13 @@ interface UserBalances {
|
|||||||
balance: BigNumber;
|
balance: BigNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Params = { address: string };
|
||||||
|
|
||||||
export const RedemptionInformation = () => {
|
export const RedemptionInformation = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const tranches = useTranches((state) => state.tranches);
|
const tranches = useTranches((state) => state.tranches);
|
||||||
const { address } = useParams<{ address: string }>();
|
const { address } = useParams<Params>();
|
||||||
const [userBalances, setUserBalances] = useState<null | UserBalances>();
|
const [userBalances, setUserBalances] = useState<null | UserBalances>();
|
||||||
const getUsersBalances = useGetUserBalances(address);
|
const getUsersBalances = useGetUserBalances(address);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -84,7 +86,7 @@ export const RedemptionInformation = () => {
|
|||||||
i18nKey="noVestingTokens"
|
i18nKey="noVestingTokens"
|
||||||
components={{
|
components={{
|
||||||
tranchesLink: (
|
tranchesLink: (
|
||||||
<Link className="underline text-white" to={Routes.SUPPLY} />
|
<Link className="text-white underline" to={Routes.SUPPLY} />
|
||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@ -160,7 +162,7 @@ export const RedemptionInformation = () => {
|
|||||||
intent={Intent.Warning}
|
intent={Intent.Warning}
|
||||||
>
|
>
|
||||||
<p>{t('Find out more about Staking.')}</p>
|
<p>{t('Find out more about Staking.')}</p>
|
||||||
<Link to={Routes.VALIDATORS} className="underline text-white">
|
<Link to={Routes.VALIDATORS} className="text-white underline">
|
||||||
{t('Stake VEGA tokens')}
|
{t('Stake VEGA tokens')}
|
||||||
</Link>
|
</Link>
|
||||||
</Callout>
|
</Callout>
|
||||||
|
@ -21,9 +21,10 @@ import RoutesConfig from '../routes';
|
|||||||
interface FormFields {
|
interface FormFields {
|
||||||
address: string;
|
address: string;
|
||||||
}
|
}
|
||||||
|
type Params = { address: string };
|
||||||
|
|
||||||
const RedemptionRouter = () => {
|
const RedemptionRouter = () => {
|
||||||
const { address } = useParams<{ address: string }>();
|
const { address } = useParams<Params>();
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const validatePubkey = useCallback(
|
const validatePubkey = useCallback(
|
||||||
@ -89,7 +90,7 @@ const RedemptionRouter = () => {
|
|||||||
{t('View connected Eth Wallet')}
|
{t('View connected Eth Wallet')}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
<p className="py-4 flex justify-center">{t('OR')}</p>
|
<p className="flex justify-center py-4">{t('OR')}</p>
|
||||||
<form
|
<form
|
||||||
onSubmit={handleSubmit(onSubmit)}
|
onSubmit={handleSubmit(onSubmit)}
|
||||||
data-testid="view-connector-form"
|
data-testid="view-connector-form"
|
||||||
|
@ -21,6 +21,8 @@ import { EthConnectPrompt } from '../../../components/eth-connect-prompt';
|
|||||||
import { useUserTrancheBalances } from '../hooks';
|
import { useUserTrancheBalances } from '../hooks';
|
||||||
import { useAppState } from '../../../contexts/app-state/app-state-context';
|
import { useAppState } from '../../../contexts/app-state/app-state-context';
|
||||||
|
|
||||||
|
type Params = { id: string };
|
||||||
|
|
||||||
export const RedeemFromTranche = () => {
|
export const RedeemFromTranche = () => {
|
||||||
const { account: address } = useWeb3React();
|
const { account: address } = useWeb3React();
|
||||||
const { vesting } = useContracts();
|
const { vesting } = useContracts();
|
||||||
@ -34,7 +36,7 @@ export const RedeemFromTranche = () => {
|
|||||||
tranches: state.tranches,
|
tranches: state.tranches,
|
||||||
getTranches: state.getTranches,
|
getTranches: state.getTranches,
|
||||||
}));
|
}));
|
||||||
const { id } = useParams<{ id: string }>();
|
const { id } = useParams<Params>();
|
||||||
const numberId = Number(id);
|
const numberId = Number(id);
|
||||||
const tranche = React.useMemo(
|
const tranche = React.useMemo(
|
||||||
() => tranches?.find(({ tranche_id }) => tranche_id === numberId) || null,
|
() => tranches?.find(({ tranche_id }) => tranche_id === numberId) || null,
|
||||||
@ -86,7 +88,7 @@ export const RedeemFromTranche = () => {
|
|||||||
i18nKey="noVestingTokens"
|
i18nKey="noVestingTokens"
|
||||||
components={{
|
components={{
|
||||||
tranchesLink: (
|
tranchesLink: (
|
||||||
<Link className="underline text-white" to={Routes.SUPPLY} />
|
<Link className="text-white underline" to={Routes.SUPPLY} />
|
||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
@ -128,13 +130,13 @@ export const RedeemFromTranche = () => {
|
|||||||
components={{
|
components={{
|
||||||
stakingLink: (
|
stakingLink: (
|
||||||
<Link
|
<Link
|
||||||
className="underline text-white"
|
className="text-white underline"
|
||||||
to={Routes.VALIDATORS}
|
to={Routes.VALIDATORS}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
governanceLink: (
|
governanceLink: (
|
||||||
<Link
|
<Link
|
||||||
className="underline text-white"
|
className="text-white underline"
|
||||||
to={Routes.PROPOSALS}
|
to={Routes.PROPOSALS}
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
|
@ -11,12 +11,12 @@ import { useTransaction } from '../../../hooks/use-transaction';
|
|||||||
import { useAppState } from '../../../contexts/app-state/app-state-context';
|
import { useAppState } from '../../../contexts/app-state/app-state-context';
|
||||||
import { removeDecimal, removePaginationWrapper } from '@vegaprotocol/utils';
|
import { removeDecimal, removePaginationWrapper } from '@vegaprotocol/utils';
|
||||||
import * as Schema from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import type {
|
import {
|
||||||
LinkingsFieldsFragment,
|
PartyStakeLinkingsDocument,
|
||||||
PartyStakeLinkingsQuery,
|
type LinkingsFieldsFragment,
|
||||||
PartyStakeLinkingsQueryVariables,
|
type PartyStakeLinkingsQuery,
|
||||||
|
type PartyStakeLinkingsQueryVariables,
|
||||||
} from './__generated__/PartyStakeLinkings';
|
} from './__generated__/PartyStakeLinkings';
|
||||||
import { PartyStakeLinkingsDocument } from './__generated__/PartyStakeLinkings';
|
|
||||||
|
|
||||||
export const useAddStake = (
|
export const useAddStake = (
|
||||||
address: string,
|
address: string,
|
||||||
|
@ -26,9 +26,9 @@ import {
|
|||||||
ValidatorRenderer,
|
ValidatorRenderer,
|
||||||
VotingPowerRenderer,
|
VotingPowerRenderer,
|
||||||
} from './shared';
|
} from './shared';
|
||||||
import type { AgGridReact } from 'ag-grid-react';
|
import { type AgGridReact } from 'ag-grid-react';
|
||||||
import type { ColDef, RowHeightParams } from 'ag-grid-community';
|
import { type ColDef, type RowHeightParams } from 'ag-grid-community';
|
||||||
import type { ValidatorsTableProps } from './shared';
|
import { type ValidatorsTableProps } from './shared';
|
||||||
import {
|
import {
|
||||||
formatNumber,
|
formatNumber,
|
||||||
formatNumberPercentage,
|
formatNumberPercentage,
|
||||||
@ -83,19 +83,19 @@ const TopThirdCellRenderer = (
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
setHideTopThird(false);
|
setHideTopThird(false);
|
||||||
}}
|
}}
|
||||||
className="grid grid-cols-[60px_1fr] w-full h-full py-4 px-0 text-sm text-white text-center overflow-scroll"
|
className="grid h-full w-full grid-cols-[60px_1fr] overflow-scroll px-0 py-4 text-center text-sm text-white"
|
||||||
>
|
>
|
||||||
<div className="px-3 text-xs text-left">
|
<div className="px-3 text-left text-xs">
|
||||||
{params?.data?.rankingDisplay}
|
{params?.data?.rankingDisplay}
|
||||||
</div>
|
</div>
|
||||||
<div className="px-3 whitespace-normal">
|
<div className="whitespace-normal px-3">
|
||||||
<div className="mb-4">
|
<div className="mb-4">
|
||||||
<Button
|
<Button
|
||||||
data-testid="show-all-validators"
|
data-testid="show-all-validators"
|
||||||
rightIcon={
|
rightIcon={
|
||||||
<Icon
|
<Icon
|
||||||
name="arrow-right"
|
name="arrow-right"
|
||||||
className="mr-2 align-text-top fill-current"
|
className="mr-2 fill-current align-text-top"
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
className="inline-flex items-center"
|
className="inline-flex items-center"
|
||||||
|
@ -22,9 +22,9 @@ import {
|
|||||||
PendingStakeRenderer,
|
PendingStakeRenderer,
|
||||||
VotingPowerRenderer,
|
VotingPowerRenderer,
|
||||||
} from './shared';
|
} from './shared';
|
||||||
import type { AgGridReact } from 'ag-grid-react';
|
import { type AgGridReact } from 'ag-grid-react';
|
||||||
import type { ColDef } from 'ag-grid-community';
|
import { type ColDef } from 'ag-grid-community';
|
||||||
import type { ValidatorsTableProps } from './shared';
|
import { type ValidatorsTableProps } from './shared';
|
||||||
import {
|
import {
|
||||||
formatNumber,
|
formatNumber,
|
||||||
formatNumberPercentage,
|
formatNumberPercentage,
|
||||||
|
@ -28,12 +28,14 @@ interface StakingNodeProps {
|
|||||||
previousEpochData?: PreviousEpochQuery;
|
previousEpochData?: PreviousEpochQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Params = { node: string };
|
||||||
|
|
||||||
export const StakingNode = ({ data, previousEpochData }: StakingNodeProps) => {
|
export const StakingNode = ({ data, previousEpochData }: StakingNodeProps) => {
|
||||||
const { pubKey: vegaKey } = useVegaWallet();
|
const { pubKey: vegaKey } = useVegaWallet();
|
||||||
const {
|
const {
|
||||||
appState: { decimals },
|
appState: { decimals },
|
||||||
} = useAppState();
|
} = useAppState();
|
||||||
const { node } = useParams<{ node: string }>();
|
const { node } = useParams<Params>();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const { nodeInfo, currentEpoch, delegations } = React.useMemo(
|
const { nodeInfo, currentEpoch, delegations } = React.useMemo(
|
||||||
|
@ -16,10 +16,12 @@ import Routes from '../routes';
|
|||||||
import { TrancheLabel } from './tranche-label';
|
import { TrancheLabel } from './tranche-label';
|
||||||
import { useTranches } from '../../lib/tranches/tranches-store';
|
import { useTranches } from '../../lib/tranches/tranches-store';
|
||||||
|
|
||||||
|
type Params = { trancheId: string; address: string };
|
||||||
|
|
||||||
export const Tranche = () => {
|
export const Tranche = () => {
|
||||||
const tranches = useTranches((state) => state.tranches);
|
const tranches = useTranches((state) => state.tranches);
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { trancheId } = useParams<{ trancheId: string; address: string }>();
|
const { trancheId } = useParams<Params>();
|
||||||
const { chainId } = useWeb3React();
|
const { chainId } = useWeb3React();
|
||||||
const tranche = tranches?.find(
|
const tranche = tranches?.find(
|
||||||
(tranche) => trancheId && parseInt(trancheId) === tranche.tranche_id
|
(tranche) => trancheId && parseInt(trancheId) === tranche.tranche_id
|
||||||
@ -41,7 +43,7 @@ export const Tranche = () => {
|
|||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
className="flex justify-between gap-x-4 py-2 px-4"
|
className="flex justify-between gap-x-4 px-4 py-2"
|
||||||
data-testid="redeemed-tranche-tokens"
|
data-testid="redeemed-tranche-tokens"
|
||||||
>
|
>
|
||||||
<span>{t('alreadyRedeemed')}</span>
|
<span>{t('alreadyRedeemed')}</span>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { DApp, useLinks } from '@vegaprotocol/environment';
|
import { DApp, useLinks } from '@vegaprotocol/environment';
|
||||||
import type { Market } from '@vegaprotocol/liquidity';
|
import { type Market } from '@vegaprotocol/liquidity';
|
||||||
import {
|
import {
|
||||||
displayChange,
|
displayChange,
|
||||||
formatWithAsset,
|
formatWithAsset,
|
||||||
@ -12,7 +12,7 @@ import {
|
|||||||
toBigNum,
|
toBigNum,
|
||||||
} from '@vegaprotocol/utils';
|
} from '@vegaprotocol/utils';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import type { VegaValueFormatterParams } from '@vegaprotocol/datagrid';
|
import { type VegaValueFormatterParams } from '@vegaprotocol/datagrid';
|
||||||
import { PriceChangeCell } from '@vegaprotocol/datagrid';
|
import { PriceChangeCell } from '@vegaprotocol/datagrid';
|
||||||
import type * as Schema from '@vegaprotocol/types';
|
import type * as Schema from '@vegaprotocol/types';
|
||||||
import {
|
import {
|
||||||
@ -21,10 +21,10 @@ import {
|
|||||||
HealthBar,
|
HealthBar,
|
||||||
TooltipCellComponent,
|
TooltipCellComponent,
|
||||||
} from '@vegaprotocol/ui-toolkit';
|
} from '@vegaprotocol/ui-toolkit';
|
||||||
import type {
|
import {
|
||||||
GetRowIdParams,
|
type GetRowIdParams,
|
||||||
RowClickedEvent,
|
type RowClickedEvent,
|
||||||
ColDef,
|
type ColDef,
|
||||||
} from 'ag-grid-community';
|
} from 'ag-grid-community';
|
||||||
import 'ag-grid-community/styles/ag-grid.css';
|
import 'ag-grid-community/styles/ag-grid.css';
|
||||||
import 'ag-grid-community/styles/ag-theme-alpine.css';
|
import 'ag-grid-community/styles/ag-theme-alpine.css';
|
||||||
@ -253,7 +253,7 @@ export const MarketList = () => {
|
|||||||
return (
|
return (
|
||||||
<AsyncRenderer loading={loading} error={error} data={data}>
|
<AsyncRenderer loading={loading} error={error} data={data}>
|
||||||
<div
|
<div
|
||||||
className="grow w-full"
|
className="w-full grow"
|
||||||
style={{ minHeight: 500, overflow: 'hidden' }}
|
style={{ minHeight: 500, overflow: 'hidden' }}
|
||||||
>
|
>
|
||||||
<Grid
|
<Grid
|
||||||
|
@ -60,19 +60,21 @@ const useMarketDetails = (marketId: string | undefined) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type Params = { marketId: string };
|
||||||
|
|
||||||
export const Detail = () => {
|
export const Detail = () => {
|
||||||
const { marketId } = useParams<{ marketId: string }>();
|
const { marketId } = useParams<Params>();
|
||||||
const { data, loading, error } = useMarketDetails(marketId);
|
const { data, loading, error } = useMarketDetails(marketId);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<AsyncRenderer loading={loading} error={error} data={data}>
|
<AsyncRenderer loading={loading} error={error} data={data}>
|
||||||
<div className="px-16 pt-14 pb-12 bg-greys-light-100">
|
<div className="bg-greys-light-100 px-16 pb-12 pt-14">
|
||||||
<div className="max-w-screen-xl mx-auto">
|
<div className="mx-auto max-w-screen-xl">
|
||||||
<Header name={data.name} symbol={data.symbol} />
|
<Header name={data.name} symbol={data.symbol} />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="px-16">
|
<div className="px-16">
|
||||||
<div className="max-w-screen-xl mx-auto">
|
<div className="mx-auto max-w-screen-xl">
|
||||||
<div className="py-12">
|
<div className="py-12">
|
||||||
{marketId && (
|
{marketId && (
|
||||||
<Market
|
<Market
|
||||||
@ -86,7 +88,7 @@ export const Detail = () => {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h2 className="font-alpha calt text-2xl mb-4">
|
<h2 className="font-alpha calt mb-4 text-2xl">
|
||||||
{t('Current Liquidity Provision')}
|
{t('Current Liquidity Provision')}
|
||||||
</h2>
|
</h2>
|
||||||
<LPProvidersGrid
|
<LPProvidersGrid
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import { useCallback, useMemo } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
|
|
||||||
import type { GetRowIdParams, ColDef } from 'ag-grid-community';
|
import { type GetRowIdParams, type ColDef } from 'ag-grid-community';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
|
|
||||||
import type {
|
import {
|
||||||
LiquidityProviderFeeShareFieldsFragment,
|
type LiquidityProviderFeeShareFieldsFragment,
|
||||||
LiquidityProvisionFieldsFragment,
|
type LiquidityProvisionFieldsFragment,
|
||||||
} from '@vegaprotocol/liquidity';
|
} from '@vegaprotocol/liquidity';
|
||||||
import { formatWithAsset } from '@vegaprotocol/liquidity';
|
import { formatWithAsset } from '@vegaprotocol/liquidity';
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { useRef, useCallback, useEffect } from 'react';
|
import { useRef, useCallback, useEffect } from 'react';
|
||||||
import { AgGridReact } from 'ag-grid-react';
|
import { AgGridReact } from 'ag-grid-react';
|
||||||
import type {
|
import {
|
||||||
AgGridReactProps,
|
type AgGridReactProps,
|
||||||
AgReactUiProps,
|
type AgReactUiProps,
|
||||||
AgGridReact as AgGridReactType,
|
type AgGridReact as AgGridReactType,
|
||||||
} from 'ag-grid-react';
|
} from 'ag-grid-react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import 'ag-grid-community/styles/ag-grid.css';
|
import 'ag-grid-community/styles/ag-grid.css';
|
||||||
@ -34,7 +34,7 @@ export const Grid = ({ isRowClickable, ...props }: Props) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<AgGridReact
|
<AgGridReact
|
||||||
className={classNames('ag-theme-alpine h-full font-alpha calt', {
|
className={classNames('ag-theme-alpine font-alpha calt h-full', {
|
||||||
'row-hover': isRowClickable,
|
'row-hover': isRowClickable,
|
||||||
})}
|
})}
|
||||||
rowHeight={92}
|
rowHeight={92}
|
||||||
|
@ -11,12 +11,12 @@ import {
|
|||||||
Loader,
|
Loader,
|
||||||
} from '@vegaprotocol/ui-toolkit';
|
} from '@vegaprotocol/ui-toolkit';
|
||||||
import { useContracts } from '../../config/contracts/contracts-context';
|
import { useContracts } from '../../config/contracts/contracts-context';
|
||||||
import type { FormEvent } from 'react';
|
import { type FormEvent } from 'react';
|
||||||
import type {
|
import {
|
||||||
AddSignerBundle,
|
type AddSignerBundle,
|
||||||
AddSignerBundleVariables,
|
type AddSignerBundleVariables,
|
||||||
} from '../__generated__/AddSignerBundle';
|
} from '../__generated__/AddSignerBundle';
|
||||||
import type { MultisigControl } from '@vegaprotocol/smart-contracts';
|
import { type MultisigControl } from '@vegaprotocol/smart-contracts';
|
||||||
|
|
||||||
export const ADD_SIGNER_QUERY = gql`
|
export const ADD_SIGNER_QUERY = gql`
|
||||||
query AddSignerBundle($nodeId: ID!) {
|
query AddSignerBundle($nodeId: ID!) {
|
||||||
|
@ -11,12 +11,12 @@ import {
|
|||||||
Loader,
|
Loader,
|
||||||
} from '@vegaprotocol/ui-toolkit';
|
} from '@vegaprotocol/ui-toolkit';
|
||||||
import { useContracts } from '../../config/contracts/contracts-context';
|
import { useContracts } from '../../config/contracts/contracts-context';
|
||||||
import type { FormEvent } from 'react';
|
import { type FormEvent } from 'react';
|
||||||
import type {
|
import {
|
||||||
RemoveSignerBundle,
|
type RemoveSignerBundle,
|
||||||
RemoveSignerBundleVariables,
|
type RemoveSignerBundleVariables,
|
||||||
} from '../__generated__/RemoveSignerBundle';
|
} from '../__generated__/RemoveSignerBundle';
|
||||||
import type { MultisigControl } from '@vegaprotocol/smart-contracts';
|
import { type MultisigControl } from '@vegaprotocol/smart-contracts';
|
||||||
|
|
||||||
const REMOVE_SIGNER_QUERY = gql`
|
const REMOVE_SIGNER_QUERY = gql`
|
||||||
query RemoveSignerBundle($nodeId: ID!) {
|
query RemoveSignerBundle($nodeId: ID!) {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { MultisigControl } from '@vegaprotocol/smart-contracts';
|
import { MultisigControl } from '@vegaprotocol/smart-contracts';
|
||||||
import { Splash } from '@vegaprotocol/ui-toolkit';
|
import { Splash } from '@vegaprotocol/ui-toolkit';
|
||||||
import type { ContractsContextShape } from './contracts-context';
|
import { type ContractsContextShape } from './contracts-context';
|
||||||
import { ContractsContext } from './contracts-context';
|
import { ContractsContext } from './contracts-context';
|
||||||
import { useEthereumConfig } from '@vegaprotocol/web3';
|
import { useEthereumConfig } from '@vegaprotocol/web3';
|
||||||
import { useEnvironment } from '@vegaprotocol/environment';
|
import { useEnvironment } from '@vegaprotocol/environment';
|
||||||
|
@ -6,22 +6,18 @@ import {
|
|||||||
makeDerivedDataProvider,
|
makeDerivedDataProvider,
|
||||||
} from '@vegaprotocol/data-provider';
|
} from '@vegaprotocol/data-provider';
|
||||||
import * as Schema from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import type { Market } from '@vegaprotocol/markets';
|
import { type Market } from '@vegaprotocol/markets';
|
||||||
import produce from 'immer';
|
import produce from 'immer';
|
||||||
|
import { type IterableElement } from 'type-fest';
|
||||||
import {
|
import {
|
||||||
AccountEventsDocument,
|
AccountEventsDocument,
|
||||||
AccountsDocument,
|
AccountsDocument,
|
||||||
} from './__generated__/Accounts';
|
|
||||||
|
|
||||||
import type { IterableElement } from 'type-fest';
|
|
||||||
import type {
|
|
||||||
AccountFieldsFragment,
|
AccountFieldsFragment,
|
||||||
AccountsQuery,
|
AccountsQuery,
|
||||||
AccountEventsSubscription,
|
AccountEventsSubscription,
|
||||||
AccountsQueryVariables,
|
AccountsQueryVariables,
|
||||||
} from './__generated__/Accounts';
|
} from './__generated__/Accounts';
|
||||||
import type { Asset } from '@vegaprotocol/assets';
|
import { type Asset } from '@vegaprotocol/assets';
|
||||||
|
|
||||||
const AccountType = Schema.AccountType;
|
const AccountType = Schema.AccountType;
|
||||||
|
|
||||||
|
@ -2,16 +2,16 @@ import { useRef, memo, useState, useCallback } from 'react';
|
|||||||
import { addDecimalsFormatNumber } from '@vegaprotocol/utils';
|
import { addDecimalsFormatNumber } from '@vegaprotocol/utils';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import { useDataProvider } from '@vegaprotocol/data-provider';
|
import { useDataProvider } from '@vegaprotocol/data-provider';
|
||||||
import type { AgGridReact } from 'ag-grid-react';
|
import { type AgGridReact } from 'ag-grid-react';
|
||||||
import {
|
import {
|
||||||
aggregatedAccountsDataProvider,
|
aggregatedAccountsDataProvider,
|
||||||
aggregatedAccountDataProvider,
|
aggregatedAccountDataProvider,
|
||||||
} from './accounts-data-provider';
|
} from './accounts-data-provider';
|
||||||
import type { PinnedAsset } from './accounts-table';
|
import { type PinnedAsset } from './accounts-table';
|
||||||
import { AccountTable } from './accounts-table';
|
import { AccountTable } from './accounts-table';
|
||||||
import { Dialog } from '@vegaprotocol/ui-toolkit';
|
import { Dialog } from '@vegaprotocol/ui-toolkit';
|
||||||
import BreakdownTable from './breakdown-table';
|
import BreakdownTable from './breakdown-table';
|
||||||
import type { useDataGridEvents } from '@vegaprotocol/datagrid';
|
import { type useDataGridEvents } from '@vegaprotocol/datagrid';
|
||||||
|
|
||||||
const AccountBreakdown = ({
|
const AccountBreakdown = ({
|
||||||
assetId,
|
assetId,
|
||||||
@ -37,10 +37,10 @@ const AccountBreakdown = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="h-[35vh] w-full m-auto flex flex-col"
|
className="m-auto flex h-[35vh] w-full flex-col"
|
||||||
data-testid="usage-breakdown"
|
data-testid="usage-breakdown"
|
||||||
>
|
>
|
||||||
<h1 className="text-xl mb-4">
|
<h1 className="mb-4 text-xl">
|
||||||
{data?.asset?.symbol} {t('usage breakdown')}
|
{data?.asset?.symbol} {t('usage breakdown')}
|
||||||
</h1>
|
</h1>
|
||||||
{data && (
|
{data && (
|
||||||
|
@ -5,12 +5,12 @@ import {
|
|||||||
} from '@vegaprotocol/utils';
|
} from '@vegaprotocol/utils';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import { Intent, TooltipCellComponent } from '@vegaprotocol/ui-toolkit';
|
import { Intent, TooltipCellComponent } from '@vegaprotocol/ui-toolkit';
|
||||||
import type { AgGridReact, AgGridReactProps } from 'ag-grid-react';
|
import { type AgGridReact, type AgGridReactProps } from 'ag-grid-react';
|
||||||
import type { AccountFields } from './accounts-data-provider';
|
import { type AccountFields } from './accounts-data-provider';
|
||||||
import { AccountTypeMapping } from '@vegaprotocol/types';
|
import { AccountTypeMapping } from '@vegaprotocol/types';
|
||||||
import type {
|
import {
|
||||||
VegaValueFormatterParams,
|
type VegaValueFormatterParams,
|
||||||
VegaICellRendererParams,
|
type VegaICellRendererParams,
|
||||||
} from '@vegaprotocol/datagrid';
|
} from '@vegaprotocol/datagrid';
|
||||||
import { ProgressBarCell } from '@vegaprotocol/datagrid';
|
import { ProgressBarCell } from '@vegaprotocol/datagrid';
|
||||||
import { AgGrid, PriceCell } from '@vegaprotocol/datagrid';
|
import { AgGrid, PriceCell } from '@vegaprotocol/datagrid';
|
||||||
|
@ -7,12 +7,10 @@ import {
|
|||||||
import {
|
import {
|
||||||
MarginsSubscriptionDocument,
|
MarginsSubscriptionDocument,
|
||||||
MarginsDocument,
|
MarginsDocument,
|
||||||
} from './__generated__/Margins';
|
type MarginsQuery,
|
||||||
import type {
|
type MarginFieldsFragment,
|
||||||
MarginsQuery,
|
type MarginsSubscriptionSubscription,
|
||||||
MarginFieldsFragment,
|
type MarginsQueryVariables,
|
||||||
MarginsSubscriptionSubscription,
|
|
||||||
MarginsQueryVariables,
|
|
||||||
} from './__generated__/Margins';
|
} from './__generated__/Margins';
|
||||||
|
|
||||||
const update = (
|
const update = (
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { makeDataProvider, useDataProvider } from '@vegaprotocol/data-provider';
|
import { makeDataProvider, useDataProvider } from '@vegaprotocol/data-provider';
|
||||||
|
|
||||||
import type {
|
import {
|
||||||
AssetQuery,
|
type AssetQuery,
|
||||||
AssetFieldsFragment,
|
type AssetQueryVariables,
|
||||||
AssetQueryVariables,
|
type AssetFieldsFragment,
|
||||||
} from './__generated__/Asset';
|
} from './__generated__/Asset';
|
||||||
import { AssetDocument } from './__generated__/Asset';
|
import { AssetDocument } from './__generated__/Asset';
|
||||||
|
|
||||||
|
@ -3,10 +3,9 @@ import {
|
|||||||
makeDerivedDataProvider,
|
makeDerivedDataProvider,
|
||||||
} from '@vegaprotocol/data-provider';
|
} from '@vegaprotocol/data-provider';
|
||||||
import { useDataProvider } from '@vegaprotocol/data-provider';
|
import { useDataProvider } from '@vegaprotocol/data-provider';
|
||||||
import { AssetsDocument } from './__generated__/Assets';
|
import { AssetsDocument, type AssetsQuery } from './__generated__/Assets';
|
||||||
import { AssetStatus } from '@vegaprotocol/types';
|
import { AssetStatus } from '@vegaprotocol/types';
|
||||||
import type { AssetsQuery } from './__generated__/Assets';
|
import { type Asset } from './asset-data-provider';
|
||||||
import type { Asset } from './asset-data-provider';
|
|
||||||
import { DENY_LIST } from './constants';
|
import { DENY_LIST } from './constants';
|
||||||
|
|
||||||
export interface BuiltinAssetSource {
|
export interface BuiltinAssetSource {
|
||||||
|
@ -20,7 +20,7 @@ import {
|
|||||||
TradingDropdownTrigger,
|
TradingDropdownTrigger,
|
||||||
Icon,
|
Icon,
|
||||||
} from '@vegaprotocol/ui-toolkit';
|
} from '@vegaprotocol/ui-toolkit';
|
||||||
import type { IconName } from '@blueprintjs/icons';
|
import { type IconName } from '@blueprintjs/icons';
|
||||||
import { IconNames } from '@blueprintjs/icons';
|
import { IconNames } from '@blueprintjs/icons';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import { useCandlesChartSettings } from './use-candles-chart-settings';
|
import { useCandlesChartSettings } from './use-candles-chart-settings';
|
||||||
|
@ -1,29 +1,33 @@
|
|||||||
import type { ApolloClient } from '@apollo/client';
|
import { type ApolloClient } from '@apollo/client';
|
||||||
import type { Duration } from 'date-fns';
|
import { type Duration } from 'date-fns';
|
||||||
import {
|
import {
|
||||||
add,
|
add,
|
||||||
differenceInDays,
|
differenceInDays,
|
||||||
differenceInHours,
|
differenceInHours,
|
||||||
differenceInMinutes,
|
differenceInMinutes,
|
||||||
} from 'date-fns';
|
} from 'date-fns';
|
||||||
import type { Candle, DataSource, PriceMonitoringBounds } from 'pennant';
|
import {
|
||||||
|
type Candle,
|
||||||
|
type DataSource,
|
||||||
|
type PriceMonitoringBounds,
|
||||||
|
} from 'pennant';
|
||||||
import { Interval as PennantInterval } from 'pennant';
|
import { Interval as PennantInterval } from 'pennant';
|
||||||
|
|
||||||
import { addDecimal } from '@vegaprotocol/utils';
|
import { addDecimal } from '@vegaprotocol/utils';
|
||||||
import { ChartDocument } from './__generated__/Chart';
|
import {
|
||||||
import type { ChartQuery, ChartQueryVariables } from './__generated__/Chart';
|
ChartDocument,
|
||||||
|
type ChartQuery,
|
||||||
|
type ChartQueryVariables,
|
||||||
|
} from './__generated__/Chart';
|
||||||
import {
|
import {
|
||||||
CandlesDocument,
|
CandlesDocument,
|
||||||
CandlesEventsDocument,
|
CandlesEventsDocument,
|
||||||
|
type CandlesQuery,
|
||||||
|
type CandlesQueryVariables,
|
||||||
|
type CandlesEventsSubscription,
|
||||||
|
type CandlesEventsSubscriptionVariables,
|
||||||
|
type CandleFieldsFragment,
|
||||||
} from './__generated__/Candles';
|
} from './__generated__/Candles';
|
||||||
import type {
|
import { type Subscription } from 'zen-observable-ts';
|
||||||
CandlesQuery,
|
|
||||||
CandlesQueryVariables,
|
|
||||||
CandleFieldsFragment,
|
|
||||||
CandlesEventsSubscription,
|
|
||||||
CandlesEventsSubscriptionVariables,
|
|
||||||
} from './__generated__/Candles';
|
|
||||||
import type { Subscription } from 'zen-observable-ts';
|
|
||||||
import * as Schema from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
|
|
||||||
const INTERVAL_TO_PENNANT_MAP = {
|
const INTERVAL_TO_PENNANT_MAP = {
|
||||||
|
@ -3,29 +3,29 @@ import {
|
|||||||
makeDerivedDataProvider,
|
makeDerivedDataProvider,
|
||||||
defaultAppend,
|
defaultAppend,
|
||||||
} from './generic-data-provider';
|
} from './generic-data-provider';
|
||||||
import type {
|
import {
|
||||||
CombineDerivedData,
|
type CombineDerivedData,
|
||||||
CombineDerivedDelta,
|
type CombineDerivedDelta,
|
||||||
CombineInsertionData,
|
type CombineInsertionData,
|
||||||
Query,
|
type UpdateCallback,
|
||||||
UpdateCallback,
|
type Update,
|
||||||
Update,
|
type Query,
|
||||||
PageInfo,
|
type PageInfo,
|
||||||
Reload,
|
type Reload,
|
||||||
Load,
|
type Load,
|
||||||
} from './generic-data-provider';
|
} from './generic-data-provider';
|
||||||
import type {
|
import {
|
||||||
ApolloClient,
|
type FetchResult,
|
||||||
FetchResult,
|
type SubscriptionOptions,
|
||||||
SubscriptionOptions,
|
type OperationVariables,
|
||||||
OperationVariables,
|
type ApolloQueryResult,
|
||||||
ApolloQueryResult,
|
type QueryOptions,
|
||||||
QueryOptions,
|
type ApolloClient,
|
||||||
} from '@apollo/client';
|
} from '@apollo/client';
|
||||||
import { ApolloError } from '@apollo/client';
|
import { ApolloError } from '@apollo/client';
|
||||||
import type { GraphQLErrors } from '@apollo/client/errors';
|
import type { GraphQLErrors } from '@apollo/client/errors';
|
||||||
import { GraphQLError } from 'graphql';
|
import { GraphQLError } from 'graphql';
|
||||||
import type { Subscription, Observable } from 'zen-observable-ts';
|
import { Subscription, Observable } from 'zen-observable-ts';
|
||||||
import { waitFor } from '@testing-library/react';
|
import { waitFor } from '@testing-library/react';
|
||||||
|
|
||||||
type Item = {
|
type Item = {
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
import type { IGetRowsParams } from 'ag-grid-community';
|
import type { IGetRowsParams } from 'ag-grid-community';
|
||||||
import type { Load, DerivedPart, Node, Edge } from './generic-data-provider';
|
import {
|
||||||
|
type Edge,
|
||||||
|
type Load,
|
||||||
|
type DerivedPart,
|
||||||
|
type Node,
|
||||||
|
} from './generic-data-provider';
|
||||||
import type { MutableRefObject } from 'react';
|
import type { MutableRefObject } from 'react';
|
||||||
|
|
||||||
const getLastRow = (
|
const getLastRow = (
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
import { renderHook, act } from '@testing-library/react';
|
import { renderHook, act } from '@testing-library/react';
|
||||||
import { useDataProvider, useThrottledDataProvider } from './use-data-provider';
|
import {
|
||||||
import type { useDataProviderParams } from './use-data-provider';
|
useDataProvider,
|
||||||
import type { Subscribe, UpdateCallback } from './generic-data-provider';
|
useThrottledDataProvider,
|
||||||
|
type useDataProviderParams,
|
||||||
|
} from './use-data-provider';
|
||||||
|
import { type Subscribe, type UpdateCallback } from './generic-data-provider';
|
||||||
import { MockedProvider } from '@apollo/client/testing';
|
import { MockedProvider } from '@apollo/client/testing';
|
||||||
|
|
||||||
type Data = number;
|
type Data = number;
|
||||||
|
@ -3,11 +3,11 @@ import throttle from 'lodash/throttle';
|
|||||||
import isEqualWith from 'lodash/isEqualWith';
|
import isEqualWith from 'lodash/isEqualWith';
|
||||||
import { useApolloClient } from '@apollo/client';
|
import { useApolloClient } from '@apollo/client';
|
||||||
import type { OperationVariables } from '@apollo/client';
|
import type { OperationVariables } from '@apollo/client';
|
||||||
import type {
|
import {
|
||||||
Subscribe,
|
type UpdateCallback,
|
||||||
Load,
|
type PageInfo,
|
||||||
UpdateCallback,
|
type Subscribe,
|
||||||
PageInfo,
|
type Load,
|
||||||
} from './generic-data-provider';
|
} from './generic-data-provider';
|
||||||
import { variablesIsEqualCustomizer } from './generic-data-provider';
|
import { variablesIsEqualCustomizer } from './generic-data-provider';
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { forwardRef } from 'react';
|
import { forwardRef } from 'react';
|
||||||
import type { AgGridReactProps, AgGridReact } from 'ag-grid-react';
|
import { type AgGridReactProps, type AgGridReact } from 'ag-grid-react';
|
||||||
import { AgGridThemed } from './ag-grid-themed';
|
import { AgGridThemed } from './ag-grid-themed';
|
||||||
|
|
||||||
type Props = AgGridReactProps & {
|
type Props = AgGridReactProps & {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import type { ChangeEvent } from 'react';
|
import type { ChangeEvent } from 'react';
|
||||||
import { useEffect, useMemo, useRef } from 'react';
|
import { useEffect, useMemo, useRef } from 'react';
|
||||||
import type * as Schema from '@vegaprotocol/types';
|
import { type DateRange } from '@vegaprotocol/types';
|
||||||
import { forwardRef, useImperativeHandle, useState } from 'react';
|
import { forwardRef, useImperativeHandle, useState } from 'react';
|
||||||
import type { IDoesFilterPassParams, IFilterParams } from 'ag-grid-community';
|
import type { IDoesFilterPassParams, IFilterParams } from 'ag-grid-community';
|
||||||
import {
|
import {
|
||||||
@ -17,9 +17,9 @@ import { formatForInput } from '@vegaprotocol/utils';
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import { TradingInputError } from '@vegaprotocol/ui-toolkit';
|
import { TradingInputError } from '@vegaprotocol/ui-toolkit';
|
||||||
|
|
||||||
const defaultValue: Schema.DateRange = {};
|
const defaultValue: DateRange = {};
|
||||||
export interface DateRangeFilterProps extends IFilterParams {
|
export interface DateRangeFilterProps extends IFilterParams {
|
||||||
defaultValue?: Schema.DateRange;
|
defaultValue?: DateRange;
|
||||||
maxSubDays?: number;
|
maxSubDays?: number;
|
||||||
maxNextDays?: number;
|
maxNextDays?: number;
|
||||||
maxDaysRange?: number;
|
maxDaysRange?: number;
|
||||||
@ -28,8 +28,8 @@ export interface DateRangeFilterProps extends IFilterParams {
|
|||||||
export const DateRangeFilter = forwardRef(
|
export const DateRangeFilter = forwardRef(
|
||||||
(props: DateRangeFilterProps, ref) => {
|
(props: DateRangeFilterProps, ref) => {
|
||||||
const defaultDates = props?.defaultValue || defaultValue;
|
const defaultDates = props?.defaultValue || defaultValue;
|
||||||
const [value, setValue] = useState<Schema.DateRange>(defaultDates);
|
const [value, setValue] = useState<DateRange>(defaultDates);
|
||||||
const valueRef = useRef<Schema.DateRange>(value);
|
const valueRef = useRef<DateRange>(value);
|
||||||
const [error, setError] = useState<string>('');
|
const [error, setError] = useState<string>('');
|
||||||
const [minStartDate, maxStartDate, minEndDate, maxEndDate] = useMemo(() => {
|
const [minStartDate, maxStartDate, minEndDate, maxEndDate] = useMemo(() => {
|
||||||
const minStartDate =
|
const minStartDate =
|
||||||
@ -105,18 +105,14 @@ export const DateRangeFilter = forwardRef(
|
|||||||
return { value: valueRef.current };
|
return { value: valueRef.current };
|
||||||
},
|
},
|
||||||
|
|
||||||
setModel(model?: { value: Schema.DateRange } | null) {
|
setModel(model?: { value: DateRange } | null) {
|
||||||
valueRef.current =
|
valueRef.current =
|
||||||
model?.value || props?.defaultValue || defaultValue;
|
model?.value || props?.defaultValue || defaultValue;
|
||||||
setValue(valueRef.current);
|
setValue(valueRef.current);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
const validate = (
|
const validate = (name: string, timeValue: Date, update?: DateRange) => {
|
||||||
name: string,
|
|
||||||
timeValue: Date,
|
|
||||||
update?: Schema.DateRange
|
|
||||||
) => {
|
|
||||||
if (
|
if (
|
||||||
props.maxSubDays !== undefined &&
|
props.maxSubDays !== undefined &&
|
||||||
isBefore(new Date(timeValue), subDays(Date.now(), props.maxSubDays + 1))
|
isBefore(new Date(timeValue), subDays(Date.now(), props.maxSubDays + 1))
|
||||||
@ -209,7 +205,7 @@ export const DateRangeFilter = forwardRef(
|
|||||||
<div className="ag-filter-apply-panel">
|
<div className="ag-filter-apply-panel">
|
||||||
<fieldset className="ag-simple-filter-body-wrapper">
|
<fieldset className="ag-simple-filter-body-wrapper">
|
||||||
<label className="block" key="start">
|
<label className="block" key="start">
|
||||||
<span className="block mb-1">{t('Start')}</span>
|
<span className="mb-1 block">{t('Start')}</span>
|
||||||
<input
|
<input
|
||||||
type="datetime-local"
|
type="datetime-local"
|
||||||
name="start"
|
name="start"
|
||||||
@ -222,7 +218,7 @@ export const DateRangeFilter = forwardRef(
|
|||||||
</fieldset>
|
</fieldset>
|
||||||
<fieldset className="ag-simple-filter-body-wrapper">
|
<fieldset className="ag-simple-filter-body-wrapper">
|
||||||
<label className="block" key="end">
|
<label className="block" key="end">
|
||||||
<span className="block mb-1">{t('End')}</span>
|
<span className="mb-1 block">{t('End')}</span>
|
||||||
<input
|
<input
|
||||||
type="datetime-local"
|
type="datetime-local"
|
||||||
name="end"
|
name="end"
|
||||||
|
@ -3,7 +3,7 @@ import { useDataGridEvents } from './use-datagrid-events';
|
|||||||
import { AgGridThemed } from './ag-grid/ag-grid-themed';
|
import { AgGridThemed } from './ag-grid/ag-grid-themed';
|
||||||
import type { MutableRefObject } from 'react';
|
import type { MutableRefObject } from 'react';
|
||||||
import { useRef } from 'react';
|
import { useRef } from 'react';
|
||||||
import type { AgGridReact } from 'ag-grid-react';
|
import { type AgGridReact } from 'ag-grid-react';
|
||||||
|
|
||||||
const gridProps = {
|
const gridProps = {
|
||||||
rowData: [{ id: 1 }],
|
rowData: [{ id: 1 }],
|
||||||
@ -17,7 +17,7 @@ const gridProps = {
|
|||||||
style: { width: 500, height: 300 },
|
style: { width: 500, height: 300 },
|
||||||
};
|
};
|
||||||
const GRID_EVENT_DEBOUNCE_TIME = 300;
|
const GRID_EVENT_DEBOUNCE_TIME = 300;
|
||||||
let gridRef: MutableRefObject<AgGridReact | null>;
|
let gridRef: MutableRefObject<AgGridReact | null> | undefined;
|
||||||
function TestComponent({
|
function TestComponent({
|
||||||
hookParams,
|
hookParams,
|
||||||
}: {
|
}: {
|
||||||
@ -61,11 +61,11 @@ describe('useDataGridEvents', () => {
|
|||||||
|
|
||||||
// column state was not updated, so the default width provided by the
|
// column state was not updated, so the default width provided by the
|
||||||
// col def should be set
|
// col def should be set
|
||||||
expect(gridRef.current?.columnApi.getColumnState()[0].width).toEqual(
|
expect(gridRef?.current?.columnApi.getColumnState()[0].width).toEqual(
|
||||||
gridProps.columnDefs[0].width
|
gridProps.columnDefs[0].width
|
||||||
);
|
);
|
||||||
// no filters set
|
// no filters set
|
||||||
expect(gridRef.current?.api.getFilterModel()).toEqual({});
|
expect(gridRef?.current?.api.getFilterModel()).toEqual({});
|
||||||
|
|
||||||
// Set filter
|
// Set filter
|
||||||
const idFilter = {
|
const idFilter = {
|
||||||
@ -74,7 +74,7 @@ describe('useDataGridEvents', () => {
|
|||||||
type: 'equals',
|
type: 'equals',
|
||||||
};
|
};
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
gridRef.current?.api.setFilterModel({
|
gridRef?.current?.api.setFilterModel({
|
||||||
id: idFilter,
|
id: idFilter,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -90,7 +90,7 @@ describe('useDataGridEvents', () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
callback.mockClear();
|
callback.mockClear();
|
||||||
expect(gridRef.current?.api.getFilterModel()['id']).toEqual(idFilter);
|
expect(gridRef?.current?.api.getFilterModel()['id']).toEqual(idFilter);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('applies grid state on ready', async () => {
|
it('applies grid state on ready', async () => {
|
||||||
@ -110,8 +110,8 @@ describe('useDataGridEvents', () => {
|
|||||||
setup(initialState, jest.fn());
|
setup(initialState, jest.fn());
|
||||||
|
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
expect(gridRef.current?.api.getFilterModel()['id']).toEqual(idFilter);
|
expect(gridRef?.current?.api.getFilterModel()['id']).toEqual(idFilter);
|
||||||
expect(gridRef.current?.columnApi.getColumnState()[0]).toEqual(
|
expect(gridRef?.current?.columnApi.getColumnState()[0]).toEqual(
|
||||||
expect.objectContaining(colState)
|
expect.objectContaining(colState)
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
@ -130,7 +130,7 @@ describe('useDataGridEvents', () => {
|
|||||||
|
|
||||||
// Set col width multiple times
|
// Set col width multiple times
|
||||||
await act(async () => {
|
await act(async () => {
|
||||||
gridRef.current?.columnApi.setColumnWidth('id', newWidth);
|
gridRef?.current?.columnApi.setColumnWidth('id', newWidth);
|
||||||
});
|
});
|
||||||
|
|
||||||
expect(callback).not.toHaveBeenCalled();
|
expect(callback).not.toHaveBeenCalled();
|
||||||
@ -150,13 +150,13 @@ describe('useDataGridEvents', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const { rerender } = setup(initialState, callback, ['id']);
|
const { rerender } = setup(initialState, callback, ['id']);
|
||||||
jest.spyOn(gridRef.current?.columnApi, 'autoSizeColumns');
|
jest.spyOn(gridRef?.current?.columnApi, 'autoSizeColumns');
|
||||||
rerender(<TestComponent hookParams={[initialState, callback, ['id']]} />);
|
rerender(<TestComponent hookParams={[initialState, callback, ['id']]} />);
|
||||||
act(() => {
|
act(() => {
|
||||||
gridRef.current?.api.setRowData([{ id: 'test-id' }]);
|
gridRef?.current?.api.setRowData([{ id: 'test-id' }]);
|
||||||
jest.advanceTimersByTime(GRID_EVENT_DEBOUNCE_TIME);
|
jest.advanceTimersByTime(GRID_EVENT_DEBOUNCE_TIME);
|
||||||
});
|
});
|
||||||
expect(gridRef.current?.columnApi.autoSizeColumns).toHaveBeenCalledWith([
|
expect(gridRef?.current?.columnApi.autoSizeColumns).toHaveBeenCalledWith([
|
||||||
'id',
|
'id',
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import type {
|
import {
|
||||||
ColumnMovedEvent,
|
type ColumnMovedEvent,
|
||||||
ColumnResizedEvent,
|
type ColumnResizedEvent,
|
||||||
ColumnState,
|
type ColumnState,
|
||||||
ColumnVisibleEvent,
|
type ColumnVisibleEvent,
|
||||||
FilterChangedEvent,
|
type FilterChangedEvent,
|
||||||
FirstDataRenderedEvent,
|
type FirstDataRenderedEvent,
|
||||||
SortChangedEvent,
|
type SortChangedEvent,
|
||||||
GridReadyEvent,
|
type GridReadyEvent,
|
||||||
} from 'ag-grid-community';
|
} from 'ag-grid-community';
|
||||||
import { useCallback } from 'react';
|
import { useCallback } from 'react';
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { useRef, useCallback, useEffect } from 'react';
|
import { useRef, useCallback, useEffect } from 'react';
|
||||||
import { useVegaWallet } from '@vegaprotocol/wallet';
|
import { useVegaWallet } from '@vegaprotocol/wallet';
|
||||||
import type {
|
import {
|
||||||
OrderSubmissionBody,
|
type OrderSubmissionBody,
|
||||||
StopOrdersSubmission,
|
type StopOrdersSubmission,
|
||||||
} from '@vegaprotocol/wallet';
|
} from '@vegaprotocol/wallet';
|
||||||
import {
|
import {
|
||||||
formatForInput,
|
formatForInput,
|
||||||
@ -11,7 +11,7 @@ import {
|
|||||||
toDecimal,
|
toDecimal,
|
||||||
validateAmount,
|
validateAmount,
|
||||||
} from '@vegaprotocol/utils';
|
} from '@vegaprotocol/utils';
|
||||||
import type { Control, UseFormWatch } from 'react-hook-form';
|
import { type Control, type UseFormWatch } from 'react-hook-form';
|
||||||
import { useForm, Controller, useController } from 'react-hook-form';
|
import { useForm, Controller, useController } from 'react-hook-form';
|
||||||
import * as Schema from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import {
|
import {
|
||||||
@ -52,7 +52,7 @@ import {
|
|||||||
dealTicketTypeToOrderType,
|
dealTicketTypeToOrderType,
|
||||||
isStopOrderType,
|
isStopOrderType,
|
||||||
} from '../../hooks/use-form-values';
|
} from '../../hooks/use-form-values';
|
||||||
import type { StopOrderFormValues } from '../../hooks/use-form-values';
|
import { type StopOrderFormValues } from '../../hooks/use-form-values';
|
||||||
import { mapFormValuesToStopOrdersSubmission } from '../../utils/map-form-values-to-submission';
|
import { mapFormValuesToStopOrdersSubmission } from '../../utils/map-form-values-to-submission';
|
||||||
import { DealTicketFeeDetails } from './deal-ticket-fee-details';
|
import { DealTicketFeeDetails } from './deal-ticket-fee-details';
|
||||||
import { validateExpiration } from '../../utils';
|
import { validateExpiration } from '../../utils';
|
||||||
@ -542,7 +542,7 @@ const NotionalAndFees = ({
|
|||||||
market.positionDecimalPlaces
|
market.positionDecimalPlaces
|
||||||
);
|
);
|
||||||
return (
|
return (
|
||||||
<div className="mb-4 flex flex-col gap-2 w-full">
|
<div className="mb-4 flex w-full flex-col gap-2">
|
||||||
<KeyValue
|
<KeyValue
|
||||||
label={t('Notional')}
|
label={t('Notional')}
|
||||||
value={formatValue(notionalSize, market.decimalPlaces)}
|
value={formatValue(notionalSize, market.decimalPlaces)}
|
||||||
@ -909,7 +909,7 @@ export const StopOrder = ({ market, marketPrice, submit }: StopOrderProps) => {
|
|||||||
marketPrice={marketPrice}
|
marketPrice={marketPrice}
|
||||||
decimalPlaces={market.decimalPlaces}
|
decimalPlaces={market.decimalPlaces}
|
||||||
/>
|
/>
|
||||||
<hr className="mb-4 border-vega-clight-500 dark:border-vega-cdark-500" />
|
<hr className="border-vega-clight-500 dark:border-vega-cdark-500 mb-4" />
|
||||||
<Size
|
<Size
|
||||||
control={control}
|
control={control}
|
||||||
sizeStep={sizeStep}
|
sizeStep={sizeStep}
|
||||||
@ -934,11 +934,11 @@ export const StopOrder = ({ market, marketPrice, submit }: StopOrderProps) => {
|
|||||||
type={type}
|
type={type}
|
||||||
/>
|
/>
|
||||||
<TimeInForce control={control} />
|
<TimeInForce control={control} />
|
||||||
<div className="flex justify-end pb-3 gap-2">
|
<div className="flex justify-end gap-2 pb-3">
|
||||||
<ReduceOnly />
|
<ReduceOnly />
|
||||||
</div>
|
</div>
|
||||||
<hr className="mb-4 border-vega-clight-500 dark:border-vega-cdark-500" />
|
<hr className="border-vega-clight-500 dark:border-vega-cdark-500 mb-4" />
|
||||||
<div className="flex justify-between pb-2 gap-2">
|
<div className="flex justify-between gap-2 pb-2">
|
||||||
<Controller
|
<Controller
|
||||||
name="oco"
|
name="oco"
|
||||||
control={control}
|
control={control}
|
||||||
@ -1005,7 +1005,7 @@ export const StopOrder = ({ market, marketPrice, submit }: StopOrderProps) => {
|
|||||||
decimalPlaces={market.decimalPlaces}
|
decimalPlaces={market.decimalPlaces}
|
||||||
oco
|
oco
|
||||||
/>
|
/>
|
||||||
<hr className="mb-2 border-vega-clight-500 dark:border-vega-cdark-500" />
|
<hr className="border-vega-clight-500 dark:border-vega-cdark-500 mb-2" />
|
||||||
<Size
|
<Size
|
||||||
control={control}
|
control={control}
|
||||||
sizeStep={sizeStep}
|
sizeStep={sizeStep}
|
||||||
@ -1034,7 +1034,7 @@ export const StopOrder = ({ market, marketPrice, submit }: StopOrderProps) => {
|
|||||||
type={ocoType}
|
type={ocoType}
|
||||||
/>
|
/>
|
||||||
<TimeInForce control={control} oco />
|
<TimeInForce control={control} oco />
|
||||||
<div className="flex justify-end mb-2 gap-2">
|
<div className="mb-2 flex justify-end gap-2">
|
||||||
<ReduceOnly />
|
<ReduceOnly />
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import * as Schema from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import type { FormEventHandler } from 'react';
|
import { type FormEventHandler } from 'react';
|
||||||
import { memo, useCallback, useEffect, useRef, useMemo } from 'react';
|
import { memo, useCallback, useEffect, useRef, useMemo } from 'react';
|
||||||
import { Controller, useController, useForm } from 'react-hook-form';
|
import { Controller, useController, useForm } from 'react-hook-form';
|
||||||
import {
|
import {
|
||||||
@ -11,7 +11,7 @@ import { ExpirySelector } from './expiry-selector';
|
|||||||
import { SideSelector } from './side-selector';
|
import { SideSelector } from './side-selector';
|
||||||
import { TimeInForceSelector } from './time-in-force-selector';
|
import { TimeInForceSelector } from './time-in-force-selector';
|
||||||
import { TypeSelector } from './type-selector';
|
import { TypeSelector } from './type-selector';
|
||||||
import type { OrderSubmission } from '@vegaprotocol/wallet';
|
import { type OrderSubmission } from '@vegaprotocol/wallet';
|
||||||
import { useVegaWallet } from '@vegaprotocol/wallet';
|
import { useVegaWallet } from '@vegaprotocol/wallet';
|
||||||
import { mapFormValuesToOrderSubmission } from '../../utils/map-form-values-to-submission';
|
import { mapFormValuesToOrderSubmission } from '../../utils/map-form-values-to-submission';
|
||||||
import {
|
import {
|
||||||
@ -66,7 +66,7 @@ import {
|
|||||||
useAccountBalance,
|
useAccountBalance,
|
||||||
} from '@vegaprotocol/accounts';
|
} from '@vegaprotocol/accounts';
|
||||||
import { useDataProvider } from '@vegaprotocol/data-provider';
|
import { useDataProvider } from '@vegaprotocol/data-provider';
|
||||||
import type { OrderFormValues } from '../../hooks';
|
import { type OrderFormValues } from '../../hooks';
|
||||||
import {
|
import {
|
||||||
DealTicketType,
|
DealTicketType,
|
||||||
dealTicketTypeToOrderType,
|
dealTicketTypeToOrderType,
|
||||||
@ -471,7 +471,7 @@ export const DealTicket = ({
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<div className="flex flex-col w-full mb-4 gap-2">
|
<div className="mb-4 flex w-full flex-col gap-2">
|
||||||
<KeyValue
|
<KeyValue
|
||||||
label={t('Notional')}
|
label={t('Notional')}
|
||||||
value={formatValue(notionalSize, market.decimalPlaces)}
|
value={formatValue(notionalSize, market.decimalPlaces)}
|
||||||
@ -545,7 +545,7 @@ export const DealTicket = ({
|
|||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<div className="flex justify-between pb-2 gap-2">
|
<div className="flex justify-between gap-2 pb-2">
|
||||||
<Controller
|
<Controller
|
||||||
name="postOnly"
|
name="postOnly"
|
||||||
control={control}
|
control={control}
|
||||||
@ -621,7 +621,7 @@ export const DealTicket = ({
|
|||||||
</div>
|
</div>
|
||||||
{isLimitType && (
|
{isLimitType && (
|
||||||
<>
|
<>
|
||||||
<div className="flex justify-between pb-2 gap-2">
|
<div className="flex justify-between gap-2 pb-2">
|
||||||
<Controller
|
<Controller
|
||||||
name="iceberg"
|
name="iceberg"
|
||||||
control={control}
|
control={control}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import type {
|
import {
|
||||||
EstimatePositionQueryVariables,
|
type EstimatePositionQuery,
|
||||||
EstimatePositionQuery,
|
type EstimatePositionQueryVariables,
|
||||||
} from '@vegaprotocol/positions';
|
} from '@vegaprotocol/positions';
|
||||||
import { useEstimatePositionQuery } from '@vegaprotocol/positions';
|
import { useEstimatePositionQuery } from '@vegaprotocol/positions';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
@ -2,16 +2,14 @@ import uniqBy from 'lodash/uniqBy';
|
|||||||
import orderBy from 'lodash/orderBy';
|
import orderBy from 'lodash/orderBy';
|
||||||
import { getEvents, removePaginationWrapper } from '@vegaprotocol/utils';
|
import { getEvents, removePaginationWrapper } from '@vegaprotocol/utils';
|
||||||
import { makeDataProvider } from '@vegaprotocol/data-provider';
|
import { makeDataProvider } from '@vegaprotocol/data-provider';
|
||||||
import * as Schema from '@vegaprotocol/types';
|
import { BusEventType } from '@vegaprotocol/types';
|
||||||
import {
|
import {
|
||||||
DepositsDocument,
|
DepositsDocument,
|
||||||
DepositEventDocument,
|
DepositEventDocument,
|
||||||
} from './__generated__/Deposit';
|
type DepositFieldsFragment,
|
||||||
import type {
|
type DepositsQuery,
|
||||||
DepositFieldsFragment,
|
type DepositEventSubscription,
|
||||||
DepositsQuery,
|
type DepositEventSubscriptionVariables,
|
||||||
DepositEventSubscription,
|
|
||||||
DepositEventSubscriptionVariables,
|
|
||||||
} from './__generated__/Deposit';
|
} from './__generated__/Deposit';
|
||||||
|
|
||||||
export const depositsProvider = makeDataProvider<
|
export const depositsProvider = makeDataProvider<
|
||||||
@ -38,7 +36,7 @@ export const depositsProvider = makeDataProvider<
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
const incoming = getEvents<DepositFieldsFragment>(
|
const incoming = getEvents<DepositFieldsFragment>(
|
||||||
Schema.BusEventType.Deposit,
|
BusEventType.Deposit,
|
||||||
delta.busEvents
|
delta.busEvents
|
||||||
);
|
);
|
||||||
return uniqBy([...incoming, ...(data || [])], 'id');
|
return uniqBy([...incoming, ...(data || [])], 'id');
|
||||||
|
@ -5,14 +5,14 @@ import {
|
|||||||
truncateByChars,
|
truncateByChars,
|
||||||
isNumeric,
|
isNumeric,
|
||||||
} from '@vegaprotocol/utils';
|
} from '@vegaprotocol/utils';
|
||||||
import type { ColDef } from 'ag-grid-community';
|
import { type ColDef } from 'ag-grid-community';
|
||||||
import { AgGrid } from '@vegaprotocol/datagrid';
|
import { AgGrid } from '@vegaprotocol/datagrid';
|
||||||
import type {
|
import {
|
||||||
VegaICellRendererParams,
|
type VegaICellRendererParams,
|
||||||
VegaValueFormatterParams,
|
type VegaValueFormatterParams,
|
||||||
TypedDataAgGrid,
|
type TypedDataAgGrid,
|
||||||
} from '@vegaprotocol/datagrid';
|
} from '@vegaprotocol/datagrid';
|
||||||
import type { DepositFieldsFragment } from './__generated__/Deposit';
|
import { type DepositFieldsFragment } from './__generated__/Deposit';
|
||||||
import { EtherscanLink } from '@vegaprotocol/environment';
|
import { EtherscanLink } from '@vegaprotocol/environment';
|
||||||
import { DepositStatusMapping } from '@vegaprotocol/types';
|
import { DepositStatusMapping } from '@vegaprotocol/types';
|
||||||
|
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
import {
|
import {
|
||||||
NodeCheckDocument,
|
NodeCheckDocument,
|
||||||
NodeCheckTimeUpdateDocument,
|
NodeCheckTimeUpdateDocument,
|
||||||
} from '../../utils/__generated__/NodeCheck';
|
type NodeCheckQuery,
|
||||||
import type {
|
type NodeCheckTimeUpdateSubscription,
|
||||||
NodeCheckQuery,
|
|
||||||
NodeCheckTimeUpdateSubscription,
|
|
||||||
} from '../../utils/__generated__/NodeCheck';
|
} from '../../utils/__generated__/NodeCheck';
|
||||||
import { Networks } from '../../types';
|
import { Networks } from '../../types';
|
||||||
import type { RequestHandlerResponse } from 'mock-apollo-client';
|
import { createMockClient, RequestHandlerResponse } from 'mock-apollo-client';
|
||||||
import { createMockClient } from 'mock-apollo-client';
|
|
||||||
|
|
||||||
export type MockRequestConfig = {
|
export type MockRequestConfig = {
|
||||||
hasError?: boolean;
|
hasError?: boolean;
|
||||||
|
@ -4,15 +4,17 @@ import { t } from '@vegaprotocol/i18n';
|
|||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { create } from 'zustand';
|
import { create } from 'zustand';
|
||||||
import { createClient } from '@vegaprotocol/apollo-client';
|
import { createClient } from '@vegaprotocol/apollo-client';
|
||||||
import type {
|
|
||||||
NodeCheckTimeUpdateSubscription,
|
|
||||||
NodeCheckQuery,
|
|
||||||
} from '../utils/__generated__/NodeCheck';
|
|
||||||
import {
|
import {
|
||||||
NodeCheckDocument,
|
NodeCheckDocument,
|
||||||
NodeCheckTimeUpdateDocument,
|
NodeCheckTimeUpdateDocument,
|
||||||
|
type NodeCheckTimeUpdateSubscription,
|
||||||
|
type NodeCheckQuery,
|
||||||
} from '../utils/__generated__/NodeCheck';
|
} from '../utils/__generated__/NodeCheck';
|
||||||
import type { CosmicElevatorFlags, Environment, FeatureFlags } from '../types';
|
import {
|
||||||
|
type CosmicElevatorFlags,
|
||||||
|
type Environment,
|
||||||
|
type FeatureFlags,
|
||||||
|
} from '../types';
|
||||||
import { Networks } from '../types';
|
import { Networks } from '../types';
|
||||||
import { compileErrors } from '../utils/compile-errors';
|
import { compileErrors } from '../utils/compile-errors';
|
||||||
import { envSchema } from '../utils/validate-environment';
|
import { envSchema } from '../utils/validate-environment';
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
||||||
import { useCallback, useEffect, useState } from 'react';
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
import type { ReleasesState } from './use-releases';
|
import { type ReleasesState } from './use-releases';
|
||||||
import { ReleasesFeed } from './use-releases';
|
import { ReleasesFeed } from './use-releases';
|
||||||
import { fetchReleases } from './use-releases';
|
import { fetchReleases } from './use-releases';
|
||||||
|
|
||||||
|
@ -1,20 +1,21 @@
|
|||||||
import orderBy from 'lodash/orderBy';
|
import orderBy from 'lodash/orderBy';
|
||||||
import type { PageInfo, Cursor } from '@vegaprotocol/data-provider';
|
import { type PageInfo, type Cursor } from '@vegaprotocol/data-provider';
|
||||||
import {
|
import {
|
||||||
makeDataProvider,
|
makeDataProvider,
|
||||||
makeDerivedDataProvider,
|
makeDerivedDataProvider,
|
||||||
defaultAppend as append,
|
defaultAppend as append,
|
||||||
} from '@vegaprotocol/data-provider';
|
} from '@vegaprotocol/data-provider';
|
||||||
import type { Market } from '@vegaprotocol/markets';
|
import { type Market } from '@vegaprotocol/markets';
|
||||||
import { marketsMapProvider } from '@vegaprotocol/markets';
|
import { marketsMapProvider } from '@vegaprotocol/markets';
|
||||||
import { FillsDocument, FillsEventDocument } from './__generated__/Fills';
|
import {
|
||||||
import type {
|
FillsDocument,
|
||||||
FillsQuery,
|
FillsEventDocument,
|
||||||
FillsQueryVariables,
|
type FillsQuery,
|
||||||
FillFieldsFragment,
|
type FillsQueryVariables,
|
||||||
FillsEventSubscription,
|
type FillFieldsFragment,
|
||||||
FillUpdateFieldsFragment,
|
type FillsEventSubscription,
|
||||||
FillsEventSubscriptionVariables,
|
type FillUpdateFieldsFragment,
|
||||||
|
type FillsEventSubscriptionVariables,
|
||||||
} from './__generated__/Fills';
|
} from './__generated__/Fills';
|
||||||
|
|
||||||
export type Trade = Omit<FillFieldsFragment, 'market'> & {
|
export type Trade = Omit<FillFieldsFragment, 'market'> & {
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
import type { AgGridReact } from 'ag-grid-react';
|
import { type AgGridReact } from 'ag-grid-react';
|
||||||
import { useCallback, useRef, useState } from 'react';
|
import { useCallback, useRef, useState } from 'react';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import { FillsTable } from './fills-table';
|
import { FillsTable } from './fills-table';
|
||||||
import type { useDataGridEvents } from '@vegaprotocol/datagrid';
|
import { type useDataGridEvents } from '@vegaprotocol/datagrid';
|
||||||
import { Pagination } from '@vegaprotocol/datagrid';
|
import { Pagination } from '@vegaprotocol/datagrid';
|
||||||
import { useDataProvider } from '@vegaprotocol/data-provider';
|
import { useDataProvider } from '@vegaprotocol/data-provider';
|
||||||
import type * as Schema from '@vegaprotocol/types';
|
import {
|
||||||
|
type TradesFilter,
|
||||||
|
type TradesSubscriptionFilter,
|
||||||
|
} from '@vegaprotocol/types';
|
||||||
import { fillsWithMarketProvider } from './fills-data-provider';
|
import { fillsWithMarketProvider } from './fills-data-provider';
|
||||||
|
|
||||||
interface FillsManagerProps {
|
interface FillsManagerProps {
|
||||||
@ -20,7 +23,7 @@ export const FillsManager = ({
|
|||||||
gridProps,
|
gridProps,
|
||||||
}: FillsManagerProps) => {
|
}: FillsManagerProps) => {
|
||||||
const gridRef = useRef<AgGridReact | null>(null);
|
const gridRef = useRef<AgGridReact | null>(null);
|
||||||
const filter: Schema.TradesFilter | Schema.TradesSubscriptionFilter = {
|
const filter: TradesFilter | TradesSubscriptionFilter = {
|
||||||
partyIds: [partyId],
|
partyIds: [partyId],
|
||||||
};
|
};
|
||||||
const [hasDisplayedRow, setHasDisplayedRow] = useState<boolean | undefined>(
|
const [hasDisplayedRow, setHasDisplayedRow] = useState<boolean | undefined>(
|
||||||
@ -38,7 +41,7 @@ export const FillsManager = ({
|
|||||||
variables: { filter },
|
variables: { filter },
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col h-full">
|
<div className="flex h-full flex-col">
|
||||||
<FillsTable
|
<FillsTable
|
||||||
ref={gridRef}
|
ref={gridRef}
|
||||||
rowData={data}
|
rowData={data}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import type {
|
import {
|
||||||
AgGridReact,
|
type AgGridReact,
|
||||||
AgGridReactProps,
|
type AgGridReactProps,
|
||||||
AgReactUiProps,
|
type AgReactUiProps,
|
||||||
} from 'ag-grid-react';
|
} from 'ag-grid-react';
|
||||||
import type { ITooltipParams, ColDef } from 'ag-grid-community';
|
import { type ITooltipParams, type ColDef } from 'ag-grid-community';
|
||||||
import {
|
import {
|
||||||
addDecimal,
|
addDecimal,
|
||||||
addDecimalsFormatNumber,
|
addDecimalsFormatNumber,
|
||||||
@ -22,16 +22,16 @@ import {
|
|||||||
COL_DEFS,
|
COL_DEFS,
|
||||||
DateRangeFilter,
|
DateRangeFilter,
|
||||||
} from '@vegaprotocol/datagrid';
|
} from '@vegaprotocol/datagrid';
|
||||||
import type {
|
import {
|
||||||
VegaValueFormatterParams,
|
type VegaValueFormatterParams,
|
||||||
VegaICellRendererParams,
|
type VegaICellRendererParams,
|
||||||
} from '@vegaprotocol/datagrid';
|
} from '@vegaprotocol/datagrid';
|
||||||
import { forwardRef } from 'react';
|
import { forwardRef } from 'react';
|
||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
import type { Trade } from './fills-data-provider';
|
import { type Trade } from './fills-data-provider';
|
||||||
import type {
|
import {
|
||||||
FillFieldsFragment,
|
type FillFieldsFragment,
|
||||||
TradeFeeFieldsFragment,
|
type TradeFeeFieldsFragment,
|
||||||
} from './__generated__/Fills';
|
} from './__generated__/Fills';
|
||||||
import { FillActionsDropdown } from './fill-actions-dropdown';
|
import { FillActionsDropdown } from './fill-actions-dropdown';
|
||||||
import { getAsset } from '@vegaprotocol/markets';
|
import { getAsset } from '@vegaprotocol/markets';
|
||||||
@ -337,7 +337,7 @@ const FeesBreakdownTooltip = ({
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-testid="fee-breakdown-tooltip"
|
data-testid="fee-breakdown-tooltip"
|
||||||
className="z-20 max-w-sm px-4 py-2 text-sm text-black border rounded bg-vega-light-100 dark:bg-vega-dark-100 border-vega-light-200 dark:border-vega-dark-200 break-word dark:text-white"
|
className="bg-vega-light-100 dark:bg-vega-dark-100 border-vega-light-200 dark:border-vega-dark-200 break-word z-20 max-w-sm rounded border px-4 py-2 text-sm text-black dark:text-white"
|
||||||
>
|
>
|
||||||
{role === MAKER && (
|
{role === MAKER && (
|
||||||
<>
|
<>
|
||||||
@ -361,20 +361,20 @@ const FeesBreakdownTooltip = ({
|
|||||||
)}
|
)}
|
||||||
<dl className="grid grid-cols-2 gap-x-1">
|
<dl className="grid grid-cols-2 gap-x-1">
|
||||||
<dt className="col-span-1">{t('Infrastructure fee')}</dt>
|
<dt className="col-span-1">{t('Infrastructure fee')}</dt>
|
||||||
<dd className="text-right col-span-1">
|
<dd className="col-span-1 text-right">
|
||||||
{addDecimalsFormatNumber(infrastructureFee, asset.decimals)}{' '}
|
{addDecimalsFormatNumber(infrastructureFee, asset.decimals)}{' '}
|
||||||
{asset.symbol}
|
{asset.symbol}
|
||||||
</dd>
|
</dd>
|
||||||
<dt className="col-span-1">{t('Liquidity fee')}</dt>
|
<dt className="col-span-1">{t('Liquidity fee')}</dt>
|
||||||
<dd className="text-right col-span-1">
|
<dd className="col-span-1 text-right">
|
||||||
{addDecimalsFormatNumber(liquidityFee, asset.decimals)} {asset.symbol}
|
{addDecimalsFormatNumber(liquidityFee, asset.decimals)} {asset.symbol}
|
||||||
</dd>
|
</dd>
|
||||||
<dt className="col-span-1">{t('Maker fee')}</dt>
|
<dt className="col-span-1">{t('Maker fee')}</dt>
|
||||||
<dd className="text-right col-span-1">
|
<dd className="col-span-1 text-right">
|
||||||
{addDecimalsFormatNumber(makerFee, asset.decimals)} {asset.symbol}
|
{addDecimalsFormatNumber(makerFee, asset.decimals)} {asset.symbol}
|
||||||
</dd>
|
</dd>
|
||||||
<dt className="col-span-1">{t('Total fees')}</dt>
|
<dt className="col-span-1">{t('Total fees')}</dt>
|
||||||
<dd className="text-right col-span-1">
|
<dd className="col-span-1 text-right">
|
||||||
{addDecimalsFormatNumber(totalFee, asset.decimals)} {asset.symbol}
|
{addDecimalsFormatNumber(totalFee, asset.decimals)} {asset.symbol}
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
@ -394,7 +394,7 @@ const FeesDiscountBreakdownTooltipItem = ({
|
|||||||
value && value !== '0' ? (
|
value && value !== '0' ? (
|
||||||
<>
|
<>
|
||||||
<dt className="col-span-1">{label}</dt>
|
<dt className="col-span-1">{label}</dt>
|
||||||
<dd className="text-right col-span-1">
|
<dd className="col-span-1 text-right">
|
||||||
{addDecimalsFormatNumber(value, asset.decimals)} {asset.symbol}
|
{addDecimalsFormatNumber(value, asset.decimals)} {asset.symbol}
|
||||||
</dd>
|
</dd>
|
||||||
</>
|
</>
|
||||||
@ -415,7 +415,7 @@ export const FeesDiscountBreakdownTooltip = ({
|
|||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
data-testid="fee-discount-breakdown-tooltip"
|
data-testid="fee-discount-breakdown-tooltip"
|
||||||
className="max-w-sm bg-vega-light-100 dark:bg-vega-dark-100 border border-vega-light-200 dark:border-vega-dark-200 px-4 py-2 z-20 rounded text-sm break-word text-black dark:text-white"
|
className="bg-vega-light-100 dark:bg-vega-dark-100 border-vega-light-200 dark:border-vega-dark-200 break-word z-20 max-w-sm rounded border px-4 py-2 text-sm text-black dark:text-white"
|
||||||
>
|
>
|
||||||
<dl className="grid grid-cols-2 gap-x-1">
|
<dl className="grid grid-cols-2 gap-x-1">
|
||||||
{(fees.infrastructureFeeReferralDiscount || '0') !== '0' ||
|
{(fees.infrastructureFeeReferralDiscount || '0') !== '0' ||
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import type { PageInfo, Cursor } from '@vegaprotocol/data-provider';
|
import { type PageInfo, type Cursor } from '@vegaprotocol/data-provider';
|
||||||
import {
|
import {
|
||||||
makeDataProvider,
|
makeDataProvider,
|
||||||
makeDerivedDataProvider,
|
makeDerivedDataProvider,
|
||||||
@ -6,11 +6,11 @@ import {
|
|||||||
} from '@vegaprotocol/data-provider';
|
} from '@vegaprotocol/data-provider';
|
||||||
import type { Market } from '@vegaprotocol/markets';
|
import type { Market } from '@vegaprotocol/markets';
|
||||||
import { marketsMapProvider } from '@vegaprotocol/markets';
|
import { marketsMapProvider } from '@vegaprotocol/markets';
|
||||||
import { FundingPaymentsDocument } from './__generated__/FundingPayments';
|
import {
|
||||||
import type {
|
FundingPaymentsDocument,
|
||||||
FundingPaymentsQuery,
|
type FundingPaymentsQueryVariables,
|
||||||
FundingPaymentsQueryVariables,
|
type FundingPaymentFieldsFragment,
|
||||||
FundingPaymentFieldsFragment,
|
type FundingPaymentsQuery,
|
||||||
} from './__generated__/FundingPayments';
|
} from './__generated__/FundingPayments';
|
||||||
|
|
||||||
export type FundingPayment = Omit<FundingPaymentFieldsFragment, 'market'> & {
|
export type FundingPayment = Omit<FundingPaymentFieldsFragment, 'market'> & {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import type { AgGridReact } from 'ag-grid-react';
|
import { type AgGridReact } from 'ag-grid-react';
|
||||||
import { useCallback, useRef, useState } from 'react';
|
import { useCallback, useRef, useState } from 'react';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import { FundingPaymentsTable } from './funding-payments-table';
|
import { FundingPaymentsTable } from './funding-payments-table';
|
||||||
import { Pagination } from '@vegaprotocol/datagrid';
|
import { Pagination } from '@vegaprotocol/datagrid';
|
||||||
import type { useDataGridEvents } from '@vegaprotocol/datagrid';
|
import { type useDataGridEvents } from '@vegaprotocol/datagrid';
|
||||||
import { useDataProvider } from '@vegaprotocol/data-provider';
|
import { useDataProvider } from '@vegaprotocol/data-provider';
|
||||||
import { fundingPaymentsWithMarketProvider } from './funding-payments-data-provider';
|
import { fundingPaymentsWithMarketProvider } from './funding-payments-data-provider';
|
||||||
|
|
||||||
@ -44,7 +44,7 @@ export const FundingPaymentsManager = ({
|
|||||||
});
|
});
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col h-full">
|
<div className="flex h-full flex-col">
|
||||||
<FundingPaymentsTable
|
<FundingPaymentsTable
|
||||||
ref={gridRef}
|
ref={gridRef}
|
||||||
rowData={data}
|
rowData={data}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import type {
|
import {
|
||||||
AgGridReact,
|
type AgGridReact,
|
||||||
AgGridReactProps,
|
type AgGridReactProps,
|
||||||
AgReactUiProps,
|
type AgReactUiProps,
|
||||||
} from 'ag-grid-react';
|
} from 'ag-grid-react';
|
||||||
import type { ColDef } from 'ag-grid-community';
|
import { type ColDef } from 'ag-grid-community';
|
||||||
import {
|
import {
|
||||||
addDecimalsFormatNumber,
|
addDecimalsFormatNumber,
|
||||||
getDateTimeFormat,
|
getDateTimeFormat,
|
||||||
|
@ -5,19 +5,15 @@ import {
|
|||||||
} from '@vegaprotocol/data-provider';
|
} from '@vegaprotocol/data-provider';
|
||||||
import * as Schema from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
LiquidityProvidersDocument,
|
LiquidityProvidersDocument,
|
||||||
LiquidityProvisionsDocument,
|
LiquidityProvisionsDocument,
|
||||||
} from './__generated__/MarketLiquidity';
|
type LiquidityProvidersQuery,
|
||||||
|
type LiquidityProvidersQueryVariables,
|
||||||
import type {
|
type LiquidityProvisionsQuery,
|
||||||
LiquidityProviderFieldsFragment,
|
type LiquidityProvisionsQueryVariables,
|
||||||
LiquidityProvidersQuery,
|
type LiquidityProviderFieldsFragment,
|
||||||
LiquidityProvidersQueryVariables,
|
type LiquidityProvisionFieldsFragment,
|
||||||
LiquidityProvisionFieldsFragment,
|
|
||||||
LiquidityProvisionsQuery,
|
|
||||||
LiquidityProvisionsQueryVariables,
|
|
||||||
} from './__generated__/MarketLiquidity';
|
} from './__generated__/MarketLiquidity';
|
||||||
|
|
||||||
export type LiquidityProvisionFields = LiquidityProvisionFieldsFragment &
|
export type LiquidityProvisionFields = LiquidityProvisionFieldsFragment &
|
||||||
|
@ -6,17 +6,18 @@ import {
|
|||||||
useDataProvider,
|
useDataProvider,
|
||||||
} from '@vegaprotocol/data-provider';
|
} from '@vegaprotocol/data-provider';
|
||||||
import { useYesterday } from '@vegaprotocol/react-helpers';
|
import { useYesterday } from '@vegaprotocol/react-helpers';
|
||||||
import type {
|
import {
|
||||||
MarketCandles,
|
type MarketsCandlesQueryVariables,
|
||||||
MarketMaybeWithDataAndCandles,
|
type MarketCandles,
|
||||||
MarketsCandlesQueryVariables,
|
type MarketMaybeWithDataAndCandles,
|
||||||
} from '@vegaprotocol/markets';
|
} from '@vegaprotocol/markets';
|
||||||
|
|
||||||
import { marketListProvider } from '@vegaprotocol/markets';
|
import { marketListProvider } from '@vegaprotocol/markets';
|
||||||
|
|
||||||
import type { LiquidityProvisionMarketsQuery } from './__generated__/MarketsLiquidity';
|
import {
|
||||||
import { LiquidityProvisionMarketsDocument } from './__generated__/MarketsLiquidity';
|
LiquidityProvisionMarketsDocument,
|
||||||
|
type LiquidityProvisionMarketsQuery,
|
||||||
|
} from './__generated__/MarketsLiquidity';
|
||||||
import {
|
import {
|
||||||
calcDayVolume,
|
calcDayVolume,
|
||||||
getCandle24hAgo,
|
getCandle24hAgo,
|
||||||
@ -26,7 +27,7 @@ import {
|
|||||||
getFeeLevels,
|
getFeeLevels,
|
||||||
getTargetStake,
|
getTargetStake,
|
||||||
} from './utils/liquidity-utils';
|
} from './utils/liquidity-utils';
|
||||||
import type { Provider, LiquidityProvisionMarket } from './utils';
|
import { type Provider, type LiquidityProvisionMarket } from './utils';
|
||||||
|
|
||||||
export interface FeeLevels {
|
export interface FeeLevels {
|
||||||
commitmentAmount: number;
|
commitmentAmount: number;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { useRef } from 'react';
|
import { useRef } from 'react';
|
||||||
import type { LocalLogger, LoggerConf } from '../lib/local-logger';
|
import { type LocalLogger, type LoggerConf } from '../lib/local-logger';
|
||||||
import { localLoggerFactory } from '../lib/local-logger';
|
import { localLoggerFactory } from '../lib/local-logger';
|
||||||
import { SentryInit } from '../lib/sentry-utils';
|
import { SentryInit } from '../lib/sentry-utils';
|
||||||
|
|
||||||
|
@ -8,13 +8,13 @@ import { useDataProvider } from '@vegaprotocol/data-provider';
|
|||||||
import { marketDepthProvider } from './market-depth-provider';
|
import { marketDepthProvider } from './market-depth-provider';
|
||||||
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { marketDataProvider, marketProvider } from '@vegaprotocol/markets';
|
import { marketDataProvider, marketProvider } from '@vegaprotocol/markets';
|
||||||
import type { MarketData } from '@vegaprotocol/markets';
|
import { type MarketData } from '@vegaprotocol/markets';
|
||||||
import type {
|
import {
|
||||||
MarketDepthQuery,
|
type MarketDepthQuery,
|
||||||
MarketDepthUpdateSubscription,
|
type MarketDepthUpdateSubscription,
|
||||||
PriceLevelFieldsFragment,
|
type PriceLevelFieldsFragment,
|
||||||
} from './__generated__/MarketDepth';
|
} from './__generated__/MarketDepth';
|
||||||
import type { DepthChartProps } from 'pennant';
|
import { type DepthChartProps } from 'pennant';
|
||||||
import { parseLevel, updateLevels } from './depth-chart-utils';
|
import { parseLevel, updateLevels } from './depth-chart-utils';
|
||||||
|
|
||||||
interface DepthChartManagerProps {
|
interface DepthChartManagerProps {
|
||||||
@ -238,7 +238,7 @@ export const DepthChartContainer = ({ marketId }: DepthChartManagerProps) => {
|
|||||||
volumeFormat={volumeFormat}
|
volumeFormat={volumeFormat}
|
||||||
priceFormat={priceFormat}
|
priceFormat={priceFormat}
|
||||||
notEnoughDataText={
|
notEnoughDataText={
|
||||||
<span className="text-xs text-center">{t('No open orders')}</span>
|
<span className="text-center text-xs">{t('No open orders')}</span>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import type { Update } from '@vegaprotocol/data-provider';
|
import { type Update } from '@vegaprotocol/data-provider';
|
||||||
import { makeDataProvider } from '@vegaprotocol/data-provider';
|
import { makeDataProvider } from '@vegaprotocol/data-provider';
|
||||||
import { updateLevels } from './orderbook-data';
|
import { updateLevels } from './orderbook-data';
|
||||||
import { captureException } from '@sentry/react';
|
import { captureException } from '@sentry/react';
|
||||||
@ -6,11 +6,9 @@ import { captureException } from '@sentry/react';
|
|||||||
import {
|
import {
|
||||||
MarketDepthDocument,
|
MarketDepthDocument,
|
||||||
MarketDepthUpdateDocument,
|
MarketDepthUpdateDocument,
|
||||||
} from './__generated__/MarketDepth';
|
type MarketDepthQuery,
|
||||||
import type {
|
type MarketDepthQueryVariables,
|
||||||
MarketDepthQuery,
|
type MarketDepthUpdateSubscription,
|
||||||
MarketDepthQueryVariables,
|
|
||||||
MarketDepthUpdateSubscription,
|
|
||||||
} from './__generated__/MarketDepth';
|
} from './__generated__/MarketDepth';
|
||||||
|
|
||||||
export const update: Update<
|
export const update: Update<
|
||||||
|
@ -7,10 +7,10 @@ import {
|
|||||||
marketDataProvider,
|
marketDataProvider,
|
||||||
marketProvider,
|
marketProvider,
|
||||||
} from '@vegaprotocol/markets';
|
} from '@vegaprotocol/markets';
|
||||||
import type {
|
import {
|
||||||
MarketDepthQuery,
|
type MarketDepthQuery,
|
||||||
MarketDepthQueryVariables,
|
type MarketDepthQueryVariables,
|
||||||
MarketDepthUpdateSubscription,
|
type MarketDepthUpdateSubscription,
|
||||||
} from './__generated__/MarketDepth';
|
} from './__generated__/MarketDepth';
|
||||||
|
|
||||||
interface OrderbookManagerProps {
|
interface OrderbookManagerProps {
|
||||||
|
@ -3,14 +3,16 @@ import {
|
|||||||
makeDerivedDataProvider,
|
makeDerivedDataProvider,
|
||||||
marketDataErrorPolicyGuard,
|
marketDataErrorPolicyGuard,
|
||||||
} from '@vegaprotocol/data-provider';
|
} from '@vegaprotocol/data-provider';
|
||||||
import type {
|
import {
|
||||||
MarketInfoQuery,
|
MarketInfoDocument,
|
||||||
MarketInfoQueryVariables,
|
type MarketInfoQuery,
|
||||||
|
type MarketInfoQueryVariables,
|
||||||
} from './__generated__/MarketInfo';
|
} from './__generated__/MarketInfo';
|
||||||
import { marketDataProvider } from '../../market-data-provider';
|
import {
|
||||||
import type { MarketData } from '../../market-data-provider';
|
marketDataProvider,
|
||||||
|
type MarketData,
|
||||||
|
} from '../../market-data-provider';
|
||||||
import type { Candle } from '../../market-candles-provider';
|
import type { Candle } from '../../market-candles-provider';
|
||||||
import { MarketInfoDocument } from './__generated__/MarketInfo';
|
|
||||||
|
|
||||||
export type MarketInfo = NonNullable<MarketInfoQuery['market']>;
|
export type MarketInfo = NonNullable<MarketInfoQuery['market']>;
|
||||||
export type MarketInfoWithData = MarketInfo & { data?: MarketData };
|
export type MarketInfoWithData = MarketInfo & { data?: MarketData };
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { renderHook } from '@testing-library/react';
|
import { renderHook } from '@testing-library/react';
|
||||||
import { useMarketOracle } from './use-market-oracle';
|
import { useMarketOracle } from './use-market-oracle';
|
||||||
import type { MarketFieldsFragment } from '../__generated__/markets';
|
import { type MarketFieldsFragment } from '../__generated__/markets';
|
||||||
import type { Provider } from '../oracle-schema';
|
import { type Provider } from '../oracle-schema';
|
||||||
|
|
||||||
const ORACLE_PROOFS_URL = 'ORACLE_PROOFS_URL';
|
const ORACLE_PROOFS_URL = 'ORACLE_PROOFS_URL';
|
||||||
|
|
||||||
@ -51,15 +51,15 @@ const mockMarket = jest.fn<{ data: MarketFieldsFragment | null }, unknown[]>(
|
|||||||
const mockOracleProofs = jest.fn<{ data?: Provider[] }, unknown[]>(() => ({}));
|
const mockOracleProofs = jest.fn<{ data?: Provider[] }, unknown[]>(() => ({}));
|
||||||
|
|
||||||
jest.mock('@vegaprotocol/environment', () => ({
|
jest.mock('@vegaprotocol/environment', () => ({
|
||||||
useEnvironment: jest.fn((args) => mockEnvironment()),
|
useEnvironment: jest.fn(() => mockEnvironment()),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
jest.mock('../markets-provider', () => ({
|
jest.mock('../markets-provider', () => ({
|
||||||
useMarket: jest.fn((args) => mockMarket()),
|
useMarket: jest.fn(() => mockMarket()),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
jest.mock('./use-oracle-proofs', () => ({
|
jest.mock('./use-oracle-proofs', () => ({
|
||||||
useOracleProofs: jest.fn((args) => mockOracleProofs()),
|
useOracleProofs: jest.fn(() => mockOracleProofs()),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const marketId = 'marketId';
|
const marketId = 'marketId';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import type { Provider } from '../oracle-schema';
|
import { type Provider } from '../oracle-schema';
|
||||||
import { providersSchema } from '../oracle-schema';
|
import { providersSchema } from '../oracle-schema';
|
||||||
|
|
||||||
export let cache: {
|
export let cache: {
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
import { makeDataProvider } from '@vegaprotocol/data-provider';
|
import { makeDataProvider } from '@vegaprotocol/data-provider';
|
||||||
import type {
|
|
||||||
MarketCandlesQuery,
|
|
||||||
MarketCandlesQueryVariables,
|
|
||||||
MarketCandlesUpdateSubscription,
|
|
||||||
MarketCandlesFieldsFragment,
|
|
||||||
} from './__generated__/market-candles';
|
|
||||||
import {
|
import {
|
||||||
MarketCandlesDocument,
|
MarketCandlesDocument,
|
||||||
MarketCandlesUpdateDocument,
|
MarketCandlesUpdateDocument,
|
||||||
|
type MarketCandlesQuery,
|
||||||
|
type MarketCandlesQueryVariables,
|
||||||
|
type MarketCandlesUpdateSubscription,
|
||||||
|
type MarketCandlesFieldsFragment,
|
||||||
} from './__generated__/market-candles';
|
} from './__generated__/market-candles';
|
||||||
|
|
||||||
export type Candle = MarketCandlesFieldsFragment;
|
export type Candle = MarketCandlesFieldsFragment;
|
||||||
|
@ -7,13 +7,11 @@ import { useDataProvider } from '@vegaprotocol/data-provider';
|
|||||||
import {
|
import {
|
||||||
MarketDataDocument,
|
MarketDataDocument,
|
||||||
MarketDataUpdateDocument,
|
MarketDataUpdateDocument,
|
||||||
} from './__generated__/market-data';
|
type MarketDataQuery,
|
||||||
import type {
|
type MarketDataFieldsFragment,
|
||||||
MarketDataQuery,
|
type MarketDataUpdateSubscription,
|
||||||
MarketDataFieldsFragment,
|
type MarketDataUpdateFieldsFragment,
|
||||||
MarketDataUpdateSubscription,
|
type MarketDataQueryVariables,
|
||||||
MarketDataUpdateFieldsFragment,
|
|
||||||
MarketDataQueryVariables,
|
|
||||||
} from './__generated__/market-data';
|
} from './__generated__/market-data';
|
||||||
import { getMarketPrice } from './get-price';
|
import { getMarketPrice } from './get-price';
|
||||||
import { MarketTradingMode } from '@vegaprotocol/types';
|
import { MarketTradingMode } from '@vegaprotocol/types';
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import { makeDataProvider } from '@vegaprotocol/data-provider';
|
import { makeDataProvider } from '@vegaprotocol/data-provider';
|
||||||
import { MarketsCandlesDocument } from './__generated__/markets-candles';
|
import {
|
||||||
import type {
|
MarketsCandlesDocument,
|
||||||
MarketsCandlesQuery,
|
type MarketsCandlesQuery,
|
||||||
MarketsCandlesQueryVariables,
|
type MarketsCandlesQueryVariables,
|
||||||
} from './__generated__/markets-candles';
|
} from './__generated__/markets-candles';
|
||||||
import type { Candle } from './market-candles-provider';
|
import { type Candle } from './market-candles-provider';
|
||||||
|
|
||||||
export interface MarketCandles {
|
export interface MarketCandles {
|
||||||
marketId: string;
|
marketId: string;
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
import { marketDataErrorPolicyGuard } from '@vegaprotocol/data-provider';
|
import { marketDataErrorPolicyGuard } from '@vegaprotocol/data-provider';
|
||||||
import { makeDataProvider } from '@vegaprotocol/data-provider';
|
import { makeDataProvider } from '@vegaprotocol/data-provider';
|
||||||
import type {
|
import {
|
||||||
MarketsDataQuery,
|
MarketsDataDocument,
|
||||||
MarketsDataQueryVariables,
|
type MarketsDataQuery,
|
||||||
|
type MarketsDataQueryVariables,
|
||||||
} from './__generated__/markets-data';
|
} from './__generated__/markets-data';
|
||||||
import type {
|
import {
|
||||||
MarketDataUpdateSubscription,
|
MarketDataUpdateDocument,
|
||||||
MarketDataUpdateFieldsFragment,
|
type MarketDataUpdateSubscription,
|
||||||
MarketDataUpdateSubscriptionVariables,
|
type MarketDataUpdateFieldsFragment,
|
||||||
|
type MarketDataUpdateSubscriptionVariables,
|
||||||
} from './__generated__/market-data';
|
} from './__generated__/market-data';
|
||||||
import { MarketDataUpdateDocument } from './__generated__/market-data';
|
import { type MarketData } from './market-data-provider';
|
||||||
import { MarketsDataDocument } from './__generated__/markets-data';
|
|
||||||
import type { MarketData } from './market-data-provider';
|
|
||||||
|
|
||||||
const getData = (responseData: MarketsDataQuery | null): MarketData[] =>
|
const getData = (responseData: MarketsDataQuery | null): MarketData[] =>
|
||||||
responseData?.marketsConnection?.edges
|
responseData?.marketsConnection?.edges
|
||||||
|
@ -5,29 +5,30 @@ import {
|
|||||||
marketDataErrorPolicyGuard,
|
marketDataErrorPolicyGuard,
|
||||||
useDataProvider,
|
useDataProvider,
|
||||||
} from '@vegaprotocol/data-provider';
|
} from '@vegaprotocol/data-provider';
|
||||||
import type {
|
import {
|
||||||
MarketsQuery,
|
MarketsDocument,
|
||||||
MarketFieldsFragment,
|
type MarketsQuery,
|
||||||
|
type MarketFieldsFragment,
|
||||||
} from './__generated__/markets';
|
} from './__generated__/markets';
|
||||||
import type { MarketsCandlesQueryVariables } from './__generated__/markets-candles';
|
import { type MarketsCandlesQueryVariables } from './__generated__/markets-candles';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
marketsDataProvider,
|
marketsDataProvider,
|
||||||
marketsLiveDataProvider,
|
marketsLiveDataProvider,
|
||||||
mapMarketDataUpdateToMarketData,
|
mapMarketDataUpdateToMarketData,
|
||||||
} from './markets-data-provider';
|
} from './markets-data-provider';
|
||||||
import { marketDataProvider } from './market-data-provider';
|
import { marketDataProvider, type MarketData } from './market-data-provider';
|
||||||
import { marketsCandlesProvider } from './markets-candles-provider';
|
import { type MarketDataUpdateFieldsFragment } from './__generated__';
|
||||||
import type { MarketData } from './market-data-provider';
|
import {
|
||||||
import type { MarketDataUpdateFieldsFragment } from './__generated__';
|
marketsCandlesProvider,
|
||||||
import type { MarketCandles } from './markets-candles-provider';
|
type MarketCandles,
|
||||||
|
} from './markets-candles-provider';
|
||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import * as Schema from '@vegaprotocol/types';
|
import * as Schema from '@vegaprotocol/types';
|
||||||
import {
|
import {
|
||||||
filterAndSortClosedMarkets,
|
filterAndSortClosedMarkets,
|
||||||
filterAndSortMarkets,
|
filterAndSortMarkets,
|
||||||
} from './market-utils';
|
} from './market-utils';
|
||||||
import { MarketsDocument } from './__generated__/markets';
|
|
||||||
import type { Candle } from './market-candles-provider';
|
import type { Candle } from './market-candles-provider';
|
||||||
|
|
||||||
export type Market = MarketFieldsFragment;
|
export type Market = MarketFieldsFragment;
|
||||||
|
@ -5,20 +5,21 @@ import {
|
|||||||
makeDerivedDataProvider,
|
makeDerivedDataProvider,
|
||||||
defaultAppend as append,
|
defaultAppend as append,
|
||||||
} from '@vegaprotocol/data-provider';
|
} from '@vegaprotocol/data-provider';
|
||||||
import type { Market } from '@vegaprotocol/markets';
|
import { type Market } from '@vegaprotocol/markets';
|
||||||
import { marketsMapProvider } from '@vegaprotocol/markets';
|
import { marketsMapProvider } from '@vegaprotocol/markets';
|
||||||
import type { PageInfo, Edge, Cursor } from '@vegaprotocol/data-provider';
|
import { Cursor, type PageInfo, type Edge } from '@vegaprotocol/data-provider';
|
||||||
import { OrderStatus } from '@vegaprotocol/types';
|
import { OrderStatus } from '@vegaprotocol/types';
|
||||||
import type {
|
import {
|
||||||
OrderFieldsFragment,
|
OrdersDocument,
|
||||||
OrderUpdateFieldsFragment,
|
OrdersUpdateDocument,
|
||||||
OrdersQuery,
|
type OrderFieldsFragment,
|
||||||
OrdersUpdateSubscription,
|
type OrdersQuery,
|
||||||
OrdersQueryVariables,
|
type OrdersUpdateSubscription,
|
||||||
OrdersUpdateSubscriptionVariables,
|
type OrdersQueryVariables,
|
||||||
|
type OrdersUpdateSubscriptionVariables,
|
||||||
|
type OrderUpdateFieldsFragment,
|
||||||
} from './__generated__/Orders';
|
} from './__generated__/Orders';
|
||||||
import { OrdersDocument, OrdersUpdateDocument } from './__generated__/Orders';
|
import { type ApolloClient } from '@apollo/client';
|
||||||
import type { ApolloClient } from '@apollo/client';
|
|
||||||
|
|
||||||
export type Order = Omit<OrderFieldsFragment, 'market'> & {
|
export type Order = Omit<OrderFieldsFragment, 'market'> & {
|
||||||
market?: Market;
|
market?: Market;
|
||||||
|
@ -2,14 +2,14 @@ import {
|
|||||||
makeDataProvider,
|
makeDataProvider,
|
||||||
makeDerivedDataProvider,
|
makeDerivedDataProvider,
|
||||||
} from '@vegaprotocol/data-provider';
|
} from '@vegaprotocol/data-provider';
|
||||||
import type { Market } from '@vegaprotocol/markets';
|
import { type Market } from '@vegaprotocol/markets';
|
||||||
import { marketsMapProvider } from '@vegaprotocol/markets';
|
import { marketsMapProvider } from '@vegaprotocol/markets';
|
||||||
import type {
|
import {
|
||||||
StopOrderFieldsFragment,
|
StopOrdersDocument,
|
||||||
StopOrdersQuery,
|
type StopOrdersQuery,
|
||||||
StopOrdersQueryVariables,
|
type StopOrdersQueryVariables,
|
||||||
|
type StopOrderFieldsFragment,
|
||||||
} from './__generated__/Orders';
|
} from './__generated__/Orders';
|
||||||
import { StopOrdersDocument } from './__generated__/Orders';
|
|
||||||
|
|
||||||
export type StopOrder = StopOrderFieldsFragment & {
|
export type StopOrder = StopOrderFieldsFragment & {
|
||||||
market: Market;
|
market: Market;
|
||||||
|
@ -1,18 +1,17 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import { useCallback, useRef, useState, useEffect } from 'react';
|
import { useCallback, useRef, useState, useEffect } from 'react';
|
||||||
import type { AgGridReact } from 'ag-grid-react';
|
import { type AgGridReact } from 'ag-grid-react';
|
||||||
import { OrderListTable } from '../order-list';
|
import { Pagination, type useDataGridEvents } from '@vegaprotocol/datagrid';
|
||||||
import type { useDataGridEvents } from '@vegaprotocol/datagrid';
|
import { Splash } from '@vegaprotocol/ui-toolkit';
|
||||||
import { Pagination } from '@vegaprotocol/datagrid';
|
|
||||||
import { useDataProvider } from '@vegaprotocol/data-provider';
|
import { useDataProvider } from '@vegaprotocol/data-provider';
|
||||||
import { ordersWithMarketProvider } from '../order-data-provider/order-data-provider';
|
|
||||||
import { normalizeOrderAmendment } from '@vegaprotocol/wallet';
|
import { normalizeOrderAmendment } from '@vegaprotocol/wallet';
|
||||||
import { useVegaTransactionStore } from '@vegaprotocol/web3';
|
import { useVegaTransactionStore } from '@vegaprotocol/web3';
|
||||||
import type { OrderTxUpdateFieldsFragment } from '@vegaprotocol/web3';
|
import type { OrderTxUpdateFieldsFragment } from '@vegaprotocol/web3';
|
||||||
import { OrderEditDialog } from '../order-list/order-edit-dialog';
|
import { OrderEditDialog } from '../order-list/order-edit-dialog';
|
||||||
import type { Order } from '../order-data-provider';
|
import { type Order } from '../order-data-provider';
|
||||||
import { OrderViewDialog } from '../order-list/order-view-dialog';
|
import { OrderViewDialog } from '../order-list/order-view-dialog';
|
||||||
import { Splash } from '@vegaprotocol/ui-toolkit';
|
import { OrderListTable } from '../order-list';
|
||||||
|
import { ordersWithMarketProvider } from '../order-data-provider/order-data-provider';
|
||||||
|
|
||||||
export enum Filter {
|
export enum Filter {
|
||||||
'Open' = 'Open',
|
'Open' = 'Open',
|
||||||
@ -91,7 +90,7 @@ export const OrderListManager = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="relative flex flex-col h-full">
|
<div className="relative flex h-full flex-col">
|
||||||
<OrderListTable
|
<OrderListTable
|
||||||
rowData={data}
|
rowData={data}
|
||||||
ref={gridRef}
|
ref={gridRef}
|
||||||
|
@ -3,7 +3,7 @@ import { OrderListTable } from './order-list';
|
|||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { generateOrdersArray } from '../mocks';
|
import { generateOrdersArray } from '../mocks';
|
||||||
import { OrderEditDialog } from './order-edit-dialog';
|
import { OrderEditDialog } from './order-edit-dialog';
|
||||||
import type { Order } from '../order-data-provider';
|
import { type Order } from '../order-data-provider';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
component: OrderListTable,
|
component: OrderListTable,
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { memo, forwardRef, useMemo, type ForwardedRef } from 'react';
|
||||||
import {
|
import {
|
||||||
MAXGOINT64,
|
MAXGOINT64,
|
||||||
addDecimalsFormatNumber,
|
addDecimalsFormatNumber,
|
||||||
@ -15,8 +16,6 @@ import {
|
|||||||
VegaIcon,
|
VegaIcon,
|
||||||
VegaIconNames,
|
VegaIconNames,
|
||||||
} from '@vegaprotocol/ui-toolkit';
|
} from '@vegaprotocol/ui-toolkit';
|
||||||
import type { ForwardedRef } from 'react';
|
|
||||||
import { memo, forwardRef, useMemo } from 'react';
|
|
||||||
import {
|
import {
|
||||||
AgGrid,
|
AgGrid,
|
||||||
SetFilter,
|
SetFilter,
|
||||||
@ -26,17 +25,15 @@ import {
|
|||||||
MarketNameCell,
|
MarketNameCell,
|
||||||
OrderTypeCell,
|
OrderTypeCell,
|
||||||
COL_DEFS,
|
COL_DEFS,
|
||||||
|
type TypedDataAgGrid,
|
||||||
|
type VegaICellRendererParams,
|
||||||
|
type VegaValueFormatterParams,
|
||||||
|
type VegaValueGetterParams,
|
||||||
} from '@vegaprotocol/datagrid';
|
} from '@vegaprotocol/datagrid';
|
||||||
import type {
|
import { AgGridReact } from 'ag-grid-react';
|
||||||
TypedDataAgGrid,
|
import { type Order } from '../order-data-provider';
|
||||||
VegaICellRendererParams,
|
|
||||||
VegaValueFormatterParams,
|
|
||||||
VegaValueGetterParams,
|
|
||||||
} from '@vegaprotocol/datagrid';
|
|
||||||
import type { AgGridReact } from 'ag-grid-react';
|
|
||||||
import type { Order } from '../order-data-provider';
|
|
||||||
import { Filter } from '../order-list-manager/order-list-manager';
|
import { Filter } from '../order-list-manager/order-list-manager';
|
||||||
import type { ColDef } from 'ag-grid-community';
|
import { type ColDef } from 'ag-grid-community';
|
||||||
|
|
||||||
const defaultColDef = {
|
const defaultColDef = {
|
||||||
resizable: true,
|
resizable: true,
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import { useCallback, useEffect, useState } from 'react';
|
import { useCallback, useEffect, useState } from 'react';
|
||||||
import { StopOrdersTable } from '../stop-orders-table/stop-orders-table';
|
import { StopOrdersTable } from '../stop-orders-table/stop-orders-table';
|
||||||
import type { useDataGridEvents } from '@vegaprotocol/datagrid';
|
import { type useDataGridEvents } from '@vegaprotocol/datagrid';
|
||||||
import type { StopOrder } from '../order-data-provider/stop-orders-data-provider';
|
import { type StopOrder } from '../order-data-provider/stop-orders-data-provider';
|
||||||
import { useDataProvider } from '@vegaprotocol/data-provider';
|
import { useDataProvider } from '@vegaprotocol/data-provider';
|
||||||
import { stopOrdersWithMarketProvider } from '../order-data-provider/stop-orders-data-provider';
|
import { stopOrdersWithMarketProvider } from '../order-data-provider/stop-orders-data-provider';
|
||||||
import { OrderViewDialog } from '../order-list/order-view-dialog';
|
import { OrderViewDialog } from '../order-list/order-view-dialog';
|
||||||
import type { Order, StopOrdersQueryVariables } from '../order-data-provider';
|
import {
|
||||||
|
type Order,
|
||||||
|
type StopOrdersQueryVariables,
|
||||||
|
} from '../order-data-provider';
|
||||||
import { useVegaTransactionStore } from '@vegaprotocol/web3';
|
import { useVegaTransactionStore } from '@vegaprotocol/web3';
|
||||||
|
|
||||||
export interface StopOrdersManagerProps {
|
export interface StopOrdersManagerProps {
|
||||||
|
@ -2,34 +2,35 @@ import isEqual from 'lodash/isEqual';
|
|||||||
import produce from 'immer';
|
import produce from 'immer';
|
||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
import sortBy from 'lodash/sortBy';
|
import sortBy from 'lodash/sortBy';
|
||||||
import type { Account } from '@vegaprotocol/accounts';
|
import { type Account } from '@vegaprotocol/accounts';
|
||||||
import { accountsDataProvider } from '@vegaprotocol/accounts';
|
import { accountsDataProvider } from '@vegaprotocol/accounts';
|
||||||
import { toBigNum, removePaginationWrapper } from '@vegaprotocol/utils';
|
import { toBigNum, removePaginationWrapper } from '@vegaprotocol/utils';
|
||||||
import {
|
import {
|
||||||
makeDataProvider,
|
makeDataProvider,
|
||||||
makeDerivedDataProvider,
|
makeDerivedDataProvider,
|
||||||
} from '@vegaprotocol/data-provider';
|
} from '@vegaprotocol/data-provider';
|
||||||
import * as Schema from '@vegaprotocol/types';
|
|
||||||
import type {
|
|
||||||
MarketMaybeWithData,
|
|
||||||
MarketDataQueryVariables,
|
|
||||||
} from '@vegaprotocol/markets';
|
|
||||||
import {
|
import {
|
||||||
|
type MarketMaybeWithData,
|
||||||
|
type MarketDataQueryVariables,
|
||||||
allMarketsWithLiveDataProvider,
|
allMarketsWithLiveDataProvider,
|
||||||
getAsset,
|
getAsset,
|
||||||
} from '@vegaprotocol/markets';
|
} from '@vegaprotocol/markets';
|
||||||
import type {
|
|
||||||
PositionsQuery,
|
|
||||||
PositionFieldsFragment,
|
|
||||||
PositionsSubscriptionSubscription,
|
|
||||||
PositionsQueryVariables,
|
|
||||||
PositionsSubscriptionSubscriptionVariables,
|
|
||||||
} from './__generated__/Positions';
|
|
||||||
import {
|
import {
|
||||||
PositionsDocument,
|
PositionsDocument,
|
||||||
PositionsSubscriptionDocument,
|
PositionsSubscriptionDocument,
|
||||||
|
type PositionsQuery,
|
||||||
|
type PositionFieldsFragment,
|
||||||
|
type PositionsSubscriptionSubscription,
|
||||||
|
type PositionsQueryVariables,
|
||||||
|
type PositionsSubscriptionSubscriptionVariables,
|
||||||
} from './__generated__/Positions';
|
} from './__generated__/Positions';
|
||||||
import type { PositionStatus, ProductType } from '@vegaprotocol/types';
|
import {
|
||||||
|
AccountType,
|
||||||
|
MarketState,
|
||||||
|
type MarketTradingMode,
|
||||||
|
type PositionStatus,
|
||||||
|
type ProductType,
|
||||||
|
} from '@vegaprotocol/types';
|
||||||
|
|
||||||
export interface Position {
|
export interface Position {
|
||||||
assetId: string;
|
assetId: string;
|
||||||
@ -43,8 +44,8 @@ export interface Position {
|
|||||||
marketDecimalPlaces: number;
|
marketDecimalPlaces: number;
|
||||||
marketId: string;
|
marketId: string;
|
||||||
marketCode: string;
|
marketCode: string;
|
||||||
marketTradingMode: Schema.MarketTradingMode;
|
marketTradingMode: MarketTradingMode;
|
||||||
marketState: Schema.MarketState;
|
marketState: MarketState;
|
||||||
markPrice: string | undefined;
|
markPrice: string | undefined;
|
||||||
notional: string | undefined;
|
notional: string | undefined;
|
||||||
openVolume: string;
|
openVolume: string;
|
||||||
@ -81,7 +82,7 @@ export const getMetrics = (
|
|||||||
const generalAccount = accounts?.find(
|
const generalAccount = accounts?.find(
|
||||||
(account) =>
|
(account) =>
|
||||||
account.asset.id === asset.id &&
|
account.asset.id === asset.id &&
|
||||||
account.type === Schema.AccountType.ACCOUNT_TYPE_GENERAL
|
account.type === AccountType.ACCOUNT_TYPE_GENERAL
|
||||||
);
|
);
|
||||||
|
|
||||||
const { positionDecimalPlaces, decimalPlaces: marketDecimalPlaces } =
|
const { positionDecimalPlaces, decimalPlaces: marketDecimalPlaces } =
|
||||||
@ -263,9 +264,9 @@ export const preparePositions = (metrics: Position[], showClosed: boolean) => {
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
[
|
[
|
||||||
Schema.MarketState.STATE_ACTIVE,
|
MarketState.STATE_ACTIVE,
|
||||||
Schema.MarketState.STATE_PENDING,
|
MarketState.STATE_PENDING,
|
||||||
Schema.MarketState.STATE_SUSPENDED,
|
MarketState.STATE_SUSPENDED,
|
||||||
].includes(p.marketState)
|
].includes(p.marketState)
|
||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,12 +1,5 @@
|
|||||||
import { useMemo } from 'react';
|
import { useMemo, type CSSProperties, type ReactNode } from 'react';
|
||||||
import type { CSSProperties, ReactNode } from 'react';
|
import { type ColDef, type ITooltipParams } from 'ag-grid-community';
|
||||||
import type { ColDef, ITooltipParams } from 'ag-grid-community';
|
|
||||||
import type {
|
|
||||||
VegaValueFormatterParams,
|
|
||||||
VegaValueGetterParams,
|
|
||||||
TypedDataAgGrid,
|
|
||||||
VegaICellRendererParams,
|
|
||||||
} from '@vegaprotocol/datagrid';
|
|
||||||
import {
|
import {
|
||||||
AgGrid,
|
AgGrid,
|
||||||
COL_DEFS,
|
COL_DEFS,
|
||||||
@ -16,6 +9,10 @@ import {
|
|||||||
ProgressBarCell,
|
ProgressBarCell,
|
||||||
MarketProductPill,
|
MarketProductPill,
|
||||||
StackedCell,
|
StackedCell,
|
||||||
|
type VegaValueFormatterParams,
|
||||||
|
type VegaValueGetterParams,
|
||||||
|
type TypedDataAgGrid,
|
||||||
|
type VegaICellRendererParams,
|
||||||
} from '@vegaprotocol/datagrid';
|
} from '@vegaprotocol/datagrid';
|
||||||
import {
|
import {
|
||||||
ButtonLink,
|
ButtonLink,
|
||||||
@ -32,7 +29,7 @@ import {
|
|||||||
addDecimalsFormatNumberQuantum,
|
addDecimalsFormatNumberQuantum,
|
||||||
} from '@vegaprotocol/utils';
|
} from '@vegaprotocol/utils';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/i18n';
|
||||||
import type { Position } from './positions-data-providers';
|
import { type Position } from './positions-data-providers';
|
||||||
import {
|
import {
|
||||||
MarketTradingMode,
|
MarketTradingMode,
|
||||||
PositionStatus,
|
PositionStatus,
|
||||||
@ -557,7 +554,7 @@ const WarningCell = ({
|
|||||||
<VegaIcon name={VegaIconNames.EXCLAIMATION_MARK} size={12} />
|
<VegaIcon name={VegaIconNames.EXCLAIMATION_MARK} size={12} />
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
<span className="overflow-hidden whitespace-nowrap text-ellipsis">
|
<span className="overflow-hidden text-ellipsis whitespace-nowrap">
|
||||||
{children}
|
{children}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,21 +1,19 @@
|
|||||||
import type { Update } from '@vegaprotocol/data-provider';
|
import { type Update } from '@vegaprotocol/data-provider';
|
||||||
import { makeDataProvider } from '@vegaprotocol/data-provider';
|
import { makeDataProvider } from '@vegaprotocol/data-provider';
|
||||||
import produce from 'immer';
|
import produce from 'immer';
|
||||||
import * as Types from '@vegaprotocol/types';
|
import * as Types from '@vegaprotocol/types';
|
||||||
import type {
|
|
||||||
ProposalsListQuery,
|
|
||||||
ProposalsListQueryVariables,
|
|
||||||
ProposalListFieldsFragment,
|
|
||||||
MarketViewLiveProposalsSubscription,
|
|
||||||
MarketViewProposalFieldsFragment,
|
|
||||||
MarketViewProposalsQuery,
|
|
||||||
MarketViewProposalsQueryVariables,
|
|
||||||
MarketViewLiveProposalsSubscriptionVariables,
|
|
||||||
} from './__generated__/Proposals';
|
|
||||||
import {
|
import {
|
||||||
MarketViewLiveProposalsDocument,
|
MarketViewLiveProposalsDocument,
|
||||||
MarketViewProposalsDocument,
|
MarketViewProposalsDocument,
|
||||||
ProposalsListDocument,
|
ProposalsListDocument,
|
||||||
|
type ProposalsListQuery,
|
||||||
|
type ProposalsListQueryVariables,
|
||||||
|
type ProposalListFieldsFragment,
|
||||||
|
type MarketViewLiveProposalsSubscription,
|
||||||
|
type MarketViewProposalFieldsFragment,
|
||||||
|
type MarketViewProposalsQuery,
|
||||||
|
type MarketViewProposalsQueryVariables,
|
||||||
|
type MarketViewLiveProposalsSubscriptionVariables,
|
||||||
} from './__generated__/Proposals';
|
} from './__generated__/Proposals';
|
||||||
import { removePaginationWrapper } from '@vegaprotocol/utils';
|
import { removePaginationWrapper } from '@vegaprotocol/utils';
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import { useApolloClient } from '@apollo/client';
|
import { useApolloClient } from '@apollo/client';
|
||||||
import { useCallback, useEffect, useRef } from 'react';
|
import { useCallback, useEffect, useRef } from 'react';
|
||||||
import { ProposalEventDocument } from './__generated__/Proposal';
|
import {
|
||||||
import type {
|
ProposalEventDocument,
|
||||||
ProposalEventSubscriptionVariables,
|
type ProposalEventSubscriptionVariables,
|
||||||
ProposalEventSubscription,
|
type ProposalEventSubscription,
|
||||||
ProposalEventFieldsFragment,
|
type ProposalEventFieldsFragment,
|
||||||
} from './__generated__/Proposal';
|
} from './__generated__/Proposal';
|
||||||
import type { Subscription } from 'zen-observable-ts';
|
import { type Subscription } from 'zen-observable-ts';
|
||||||
import type { VegaTxState } from '../proposals-hooks/use-vega-transaction';
|
import { type VegaTxState } from '../proposals-hooks/use-vega-transaction';
|
||||||
|
|
||||||
export const useProposalEvent = (transaction: VegaTxState) => {
|
export const useProposalEvent = (transaction: VegaTxState) => {
|
||||||
const client = useApolloClient();
|
const client = useApolloClient();
|
||||||
|
@ -3,8 +3,8 @@ import * as Sentry from '@sentry/react';
|
|||||||
import { useVegaWallet, determineId } from '@vegaprotocol/wallet';
|
import { useVegaWallet, determineId } from '@vegaprotocol/wallet';
|
||||||
import { useVegaTransaction } from './use-vega-transaction';
|
import { useVegaTransaction } from './use-vega-transaction';
|
||||||
import { useProposalEvent } from './use-proposal-event';
|
import { useProposalEvent } from './use-proposal-event';
|
||||||
import type { ProposalSubmission } from '@vegaprotocol/wallet';
|
import { type ProposalSubmission } from '@vegaprotocol/wallet';
|
||||||
import type { ProposalEventFieldsFragment } from './__generated__/Proposal';
|
import { type ProposalEventFieldsFragment } from './__generated__/Proposal';
|
||||||
|
|
||||||
export const useProposalSubmit = () => {
|
export const useProposalSubmit = () => {
|
||||||
const { pubKey } = useVegaWallet();
|
const { pubKey } = useVegaWallet();
|
||||||
|
@ -2,8 +2,10 @@ import { createClient } from '@vegaprotocol/apollo-client';
|
|||||||
import { useEnvironment } from '@vegaprotocol/environment';
|
import { useEnvironment } from '@vegaprotocol/environment';
|
||||||
import { useBlockInfo } from '@vegaprotocol/tendermint';
|
import { useBlockInfo } from '@vegaprotocol/tendermint';
|
||||||
import { useEffect, useMemo, useState } from 'react';
|
import { useEffect, useMemo, useState } from 'react';
|
||||||
import type { BlockStatisticsQuery } from './__generated__/BlockStatistics';
|
import {
|
||||||
import { BlockStatisticsDocument } from './__generated__/BlockStatistics';
|
BlockStatisticsDocument,
|
||||||
|
type BlockStatisticsQuery,
|
||||||
|
} from './__generated__/BlockStatistics';
|
||||||
import compact from 'lodash/compact';
|
import compact from 'lodash/compact';
|
||||||
import max from 'lodash/max';
|
import max from 'lodash/max';
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
import { useApolloClient } from '@apollo/client';
|
import { useApolloClient } from '@apollo/client';
|
||||||
import { useCallback, useEffect, useRef } from 'react';
|
import { useCallback, useEffect, useRef } from 'react';
|
||||||
import { VoteEventDocument } from './__generated__/VoteSubsciption';
|
import { type Subscription } from 'zen-observable-ts';
|
||||||
import type { Subscription } from 'zen-observable-ts';
|
import { type VegaTxState } from '../proposals-hooks/use-vega-transaction';
|
||||||
import type { VegaTxState } from '../proposals-hooks/use-vega-transaction';
|
import {
|
||||||
import type {
|
VoteEventDocument,
|
||||||
VoteEventFieldsFragment,
|
type VoteEventSubscription,
|
||||||
VoteEventSubscription,
|
type VoteEventSubscriptionVariables,
|
||||||
VoteEventSubscriptionVariables,
|
type VoteEventFieldsFragment,
|
||||||
} from './__generated__/VoteSubsciption';
|
} from './__generated__/VoteSubsciption';
|
||||||
|
|
||||||
export const useVoteEvent = (transaction: VegaTxState) => {
|
export const useVoteEvent = (transaction: VegaTxState) => {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { useEnvironment } from '@vegaprotocol/environment';
|
import { useEnvironment } from '@vegaprotocol/environment';
|
||||||
import { useFetch } from '@vegaprotocol/react-helpers';
|
import { useFetch } from '@vegaprotocol/react-helpers';
|
||||||
import type { TendermintBlockResponse } from '../types';
|
import { type TendermintBlockResponse } from '../types';
|
||||||
|
|
||||||
export const useBlockInfo = (blockHeight?: number, canFetch = true) => {
|
export const useBlockInfo = (blockHeight?: number, canFetch = true) => {
|
||||||
const { TENDERMINT_URL } = useEnvironment();
|
const { TENDERMINT_URL } = useEnvironment();
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user