chore(trading,governance,explorer): comply with eslint type import rules (#5257)

This commit is contained in:
Matthew Russell 2023-11-14 16:43:36 -08:00 committed by GitHub
parent 02c425f304
commit 78add88014
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
124 changed files with 731 additions and 700 deletions

View File

@ -73,7 +73,8 @@
"error",
{
"prefer": "type-imports",
"disallowTypeAnnotations": true
"disallowTypeAnnotations": true,
"fixStyle": "inline-type-imports"
}
],
"curly": ["error", "multi-line"]

View File

@ -1,15 +1,15 @@
import { useMemo } from 'react';
import type { AssetFieldsFragment } from '@vegaprotocol/assets';
import { type AssetFieldsFragment } from '@vegaprotocol/assets';
import { AssetTypeMapping, AssetStatusMapping } from '@vegaprotocol/assets';
import { t } from '@vegaprotocol/i18n';
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 type { VegaICellRendererParams } from '@vegaprotocol/datagrid';
import { type VegaICellRendererParams } from '@vegaprotocol/datagrid';
import { useRef, useLayoutEffect } from 'react';
import { BREAKPOINT_MD } from '../../config/breakpoints';
import { useNavigate } from 'react-router-dom';
import type { RowClickedEvent, ColDef } from 'ag-grid-community';
import { type RowClickedEvent, ColDef } from 'ag-grid-community';
type AssetsTableProps = {
data: AssetFieldsFragment[] | null;

View File

@ -2,18 +2,18 @@ import { useMemo } from 'react';
import { getAsset, type MarketFieldsFragment } from '@vegaprotocol/markets';
import { t } from '@vegaprotocol/i18n';
import { ButtonLink } from '@vegaprotocol/ui-toolkit';
import type { AgGridReact } from 'ag-grid-react';
import type { ColDef } from 'ag-grid-community';
import { type AgGridReact } from 'ag-grid-react';
import { type ColDef } from 'ag-grid-community';
import { AgGrid } from '@vegaprotocol/datagrid';
import type {
VegaICellRendererParams,
VegaValueGetterParams,
import {
type VegaICellRendererParams,
type VegaValueGetterParams,
} from '@vegaprotocol/datagrid';
import { useRef, useLayoutEffect } from 'react';
import { BREAKPOINT_MD } from '../../config/breakpoints';
import { MarketStateMapping } from '@vegaprotocol/types';
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';
type MarketsTableProps = {

View File

@ -1,14 +1,14 @@
import type { ProposalListFieldsFragment } from '@vegaprotocol/proposals';
import { type ProposalListFieldsFragment } 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 { AgGrid } from '@vegaprotocol/datagrid';
import type {
VegaICellRendererParams,
VegaValueFormatterParams,
import {
type VegaICellRendererParams,
type VegaValueFormatterParams,
} from '@vegaprotocol/datagrid';
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 { t } from '@vegaprotocol/i18n';
import {
@ -105,7 +105,7 @@ export const ProposalsTable = ({ data }: ProposalsTableProps) => {
? new BigNumber(0)
: yesTokens.multipliedBy(100).dividedBy(totalTokensVoted);
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
threshold={requiredMajorityPercentage}
progress={yesPercentage}

View File

@ -3,8 +3,8 @@ import { DATA_SOURCES } from '../../../config';
import { t } from '@vegaprotocol/i18n';
import { useFetch } from '@vegaprotocol/react-helpers';
import { TxDetailsOrder } from './tx-order';
import type { BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response';
import type { TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response';
import { type BlockExplorerTransactionResult } from '../../../routes/types/block-explorer-response';
import { type TendermintBlocksResponse } from '../../../routes/blocks/tendermint-blocks-response';
import { TxDetailsHeartbeat } from './tx-hearbeat';
import { TxDetailsGeneric } from './tx-generic';
import { TxDetailsBatch } from './tx-batch';

View File

@ -1,7 +1,7 @@
import { Table, TableRow } from '../table';
import { t } from '@vegaprotocol/i18n';
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 { AsyncRenderer, Loader } from '@vegaprotocol/ui-toolkit';
import EmptyList from '../empty-list/empty-list';
@ -22,7 +22,7 @@ export const TxsPerBlock = ({ blockHeight, txCount }: TxsPerBlockProps) => {
return (
<AsyncRenderer data={data} error={error} loading={!!loading}>
{data && data.transactions.length > 0 ? (
<div className="overflow-x-auto whitespace-nowrap mb-28">
<div className="mb-28 overflow-x-auto whitespace-nowrap">
<Table>
<thead>
<TableRow modifier="bordered" className="font-mono">

View File

@ -1,14 +1,14 @@
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 { useFetch } from '@vegaprotocol/react-helpers';
import type {
BlockExplorerTransactionResult,
BlockExplorerTransactions,
import {
type BlockExplorerTransactionResult,
type BlockExplorerTransactions,
} from '../routes/types/block-explorer-response';
import isNumber from 'lodash/isNumber';
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';
export function getTypeFilters(filters?: Set<FilterOption>) {

View File

@ -9,11 +9,13 @@ import { JsonViewerDialog } from '../../components/dialogs/json-viewer-dialog';
import { useState } from 'react';
import { PageTitle } from '../../components/page-helpers/page-title';
type Params = { assetId: string };
export const AssetPage = () => {
useDocumentTitle(['Assets']);
useScrollToLocation();
const { assetId } = useParams<{ assetId: string }>();
const { assetId } = useParams<Params>();
const { data, loading, error } = useAssetDataProvider(assetId || '');
const title = data ? data.name : error ? t('Asset not found') : '';
@ -41,7 +43,7 @@ export const AssetPage = () => {
loading={loading}
error={error}
>
<div className="h-full relative">
<div className="relative h-full">
<AssetDetailsTable asset={data as AssetFieldsFragment} />
</div>
</AsyncRenderer>

View File

@ -1,8 +1,8 @@
import { useCallback, useState } from 'react';
import { DATA_SOURCES } from '../../../config';
import type {
BlockMeta,
TendermintBlockchainResponse,
import {
type BlockMeta,
type TendermintBlockchainResponse,
} from '../tendermint-blockchain-response';
import { RouteTitle } from '../../../components/route-title';
import { BlocksRefetch } from '../../../components/blocks';

View File

@ -17,8 +17,10 @@ import { NodeLink } from '../../../components/links';
import { useDocumentTitle } from '../../../hooks/use-document-title';
import EmptyList from '../../../components/empty-list/empty-list';
type Params = { block: string };
const Block = () => {
const { block } = useParams<{ block: string }>();
const { block } = useParams<Params>();
useDocumentTitle(['Blocks', `Block #${block}`]);
const {
state: { data: blockData, loading, error },
@ -29,7 +31,7 @@ const Block = () => {
<RouteTitle data-testid="block-header">{t(`BLOCK ${block}`)}</RouteTitle>
<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
data-testid="previous-block"
to={`/${Routes.BLOCKS}/${Number(block) - 1}`}

View File

@ -3,7 +3,7 @@ import { useFetch } from '@vegaprotocol/react-helpers';
import { RouteTitle } from '../../components/route-title';
import { AsyncRenderer, SyntaxHighlighter } from '@vegaprotocol/ui-toolkit';
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';
const Genesis = () => {

View File

@ -11,10 +11,12 @@ import { JsonViewerDialog } from '../../components/dialogs/json-viewer-dialog';
import { marketInfoWithDataProvider } from '@vegaprotocol/markets';
import { PageTitle } from '../../components/page-helpers/page-title';
type Params = { marketId: string };
export const MarketPage = () => {
useScrollToLocation();
const { marketId } = useParams<{ marketId: string }>();
const { marketId } = useParams<Params>();
const { data, loading, error } = useDataProvider({
dataProvider: marketInfoWithDataProvider,

View File

@ -1,8 +1,10 @@
import { getNodes } from '@vegaprotocol/utils';
import { MarketLink } from '../../../components/links';
import { TableRow, TableCell, TableHeader } from '../../../components/table';
import type { ExplorerOracleForMarketsMarketFragment } from '../__generated__/OraclesForMarkets';
import { useExplorerOracleFormMarketsQuery } from '../__generated__/OraclesForMarkets';
import {
useExplorerOracleFormMarketsQuery,
type ExplorerOracleForMarketsMarketFragment,
} from '../__generated__/OraclesForMarkets';
interface OracleMarketsProps {
id: string;

View File

@ -9,8 +9,10 @@ import { AsyncRenderer, SyntaxHighlighter } from '@vegaprotocol/ui-toolkit';
import filter from 'recursive-key-filter';
import { TruncateInline } from '../../../components/truncate/truncate';
type Params = { id: string };
export const Oracle = () => {
const { id } = useParams<{ id: string }>();
const { id } = useParams<Params>();
useDocumentTitle(['Oracle', `Oracle #${truncateByChars(id || '1', 5, 5)}`]);

View File

@ -6,8 +6,10 @@ import { useDocumentTitle } from '../../../../hooks/use-document-title';
import { PartyAccounts } from '../components/party-accounts';
type Params = { party: string };
const PartyAccountsByAsset = () => {
const { party } = useParams<{ party: string }>();
const { party } = useParams<Params>();
useDocumentTitle(['Public keys', party || '-']);
const partyId = toNonHex(party ? party : '');

View File

@ -19,11 +19,13 @@ import type { FilterOption } from '../../../components/txs/tx-filter';
import { AllFilterOptions, TxsFilter } from '../../../components/txs/tx-filter';
import { useSearchParams } from 'react-router-dom';
type Params = { party: string };
const Party = () => {
const [params] = useSearchParams();
const [filters, setFilters] = useState(new Set(AllFilterOptions));
const { party } = useParams<{ party: string }>();
const { party } = useParams<Params>();
useDocumentTitle(['Public keys', party || '-']);
const navigate = useNavigate();
@ -60,7 +62,7 @@ const Party = () => {
if (!isValidPartyId(partyId)) {
return (
<div className="max-w-sm mx-auto">
<div className="mx-auto max-w-sm">
<Notification
message={t('Invalid party ID')}
intent={Intent.Danger}
@ -84,7 +86,7 @@ const Party = () => {
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
accountError={AccountError}
accountLoading={AccountLoading}

View File

@ -4,13 +4,15 @@ import { useFetch } from '@vegaprotocol/react-helpers';
import { DATA_SOURCES } from '../../../config';
import { RenderFetched } from '../../../components/render-fetched';
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 { PageHeader } from '../../../components/page-header';
import { useDocumentTitle } from '../../../hooks/use-document-title';
type Params = { txHash: string };
const Tx = () => {
const { txHash } = useParams<{ txHash: string }>();
const { txHash } = useParams<Params>();
const hash = txHash ? toNonHex(txHash) : '';
let errorMessage: string | undefined = undefined;

View File

@ -1,6 +1,6 @@
{
"extends": ["plugin:cypress/recommended", "../../.eslintrc.json"],
"ignorePatterns": ["!**/*"],
"ignorePatterns": ["!**/*", "cypress"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],

View File

@ -31,7 +31,7 @@ import {
switchVegaWalletPubKey,
vegaWalletSetSpecifiedApprovalAmount,
} from '../../support/wallet-functions';
import type { testFreeformProposal } from '../../support/common-interfaces';
import { type testFreeformProposal } from '../../support/common-interfaces';
import { formatDateWithLocalTimezone } from '@vegaprotocol/utils';
import {
createGovernanceTransferProposalTxBody,

View File

@ -34,7 +34,7 @@ import {
vegaWalletTeardown,
} from '../../support/wallet-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 vegaWalletAssociatedBalance = 'associated-amount';

View File

@ -1,4 +1,4 @@
import type { testFreeformProposal } from '../../support/common-interfaces';
import { type testFreeformProposal } from '../../support/common-interfaces';
import {
navigateTo,
navigation,

View File

@ -10,7 +10,7 @@ import noIcon from '../../images/token-no-icon.png';
import vegaBlack from '../../images/vega_black.png';
import vegaVesting from '../../images/vega_vesting.png';
import { BigNumber } from '../../lib/bignumber';
import type { WalletCardAssetProps } from '../wallet-card';
import { type WalletCardAssetProps } from '../wallet-card';
import { useVegaWallet } from '@vegaprotocol/wallet';
import { useContracts } from '../../contexts/contracts/contracts-context';
import * as Schema from '@vegaprotocol/types';
@ -21,12 +21,12 @@ import {
toBigNum,
} from '@vegaprotocol/utils';
import { useAppState } from '../../contexts/app-state/app-state-context';
import type {
DelegationsQuery,
DelegationsQueryVariables,
WalletDelegationFieldsFragment,
import {
DelegationsDocument,
type DelegationsQuery,
type DelegationsQueryVariables,
type WalletDelegationFieldsFragment,
} from './__generated__/Delegations';
import { DelegationsDocument } from './__generated__/Delegations';
import { isPartyNotFoundError } from '../../lib/party';
export const usePollForDelegations = () => {
@ -44,6 +44,7 @@ export const usePollForDelegations = () => {
const [delegatedNodes, setDelegatedNodes] = React.useState<
{
nodeId: string;
// eslint-disable-next-line
name: string;
hasStakePending: boolean;
currentEpochStake?: BigNumber;

View File

@ -9,7 +9,7 @@ import { useWeb3React } from '@web3-react/core';
import React from 'react';
import { SplashLoader } from '../../components/splash-loader';
import type { ContractsContextShape } from './contracts-context';
import { type ContractsContextShape } from './contracts-context';
import { ContractsContext } from './contracts-context';
import { createDefaultProvider } from '../../lib/web3-connectors';
import { useEthereumConfig } from '@vegaprotocol/web3';

View File

@ -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 { Button } from '@vegaprotocol/ui-toolkit';
import { useBridgeContract, useEthereumTransaction } from '@vegaprotocol/web3';
@ -88,7 +88,7 @@ export const ListAsset = ({
assetData.erc20ListAssetBundle;
return (
<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>
<EthWalletContainer>
<Button

View File

@ -4,7 +4,7 @@ import { VoteValue } from '@vegaprotocol/types';
import { useEffect, useState } from 'react';
import { useUserVoteQuery } from './__generated__/Vote';
import { removePaginationWrapper } from '@vegaprotocol/utils';
import type { FinalizedVote } from '@vegaprotocol/proposals';
import { type FinalizedVote } from '@vegaprotocol/proposals';
export enum VoteState {
NotCast = 'NotCast',

View File

@ -5,15 +5,17 @@ import { useTranslation } from 'react-i18next';
import { SplashLoader } from '../../../components/splash-loader';
import { ProposalsList } from '../components/proposals-list';
import { useProposalsQuery } from './__generated__/Proposals';
import { getNodes, removePaginationWrapper } from '@vegaprotocol/utils';
import {
ProposalState,
ProtocolUpgradeProposalStatus,
} from '@vegaprotocol/types';
import type { NodeConnection, NodeEdge } from '@vegaprotocol/utils';
import type { ProposalFieldsFragment } from './__generated__/Proposals';
import type { ProtocolUpgradeProposalFieldsFragment } from '@vegaprotocol/proposals';
import { type NodeConnection, type NodeEdge } from '@vegaprotocol/utils';
import {
useProposalsQuery,
type ProposalFieldsFragment,
} from './__generated__/Proposals';
import { type ProtocolUpgradeProposalFieldsFragment } from '@vegaprotocol/proposals';
import { useProtocolUpgradeProposalsQuery } from '@vegaprotocol/proposals';
import { FLAGS } from '@vegaprotocol/environment';

View File

@ -5,9 +5,9 @@ import * as faker from 'faker';
import isArray from 'lodash/isArray';
import mergeWith from 'lodash/mergeWith';
import type { PartialDeep } from 'type-fest';
import type { ProposalQuery } from '../proposal/__generated__/Proposal';
import type { ProtocolUpgradeProposalFieldsFragment } from '@vegaprotocol/proposals';
import { type PartialDeep } from 'type-fest';
import { type ProposalQuery } from '../proposal/__generated__/Proposal';
import { type ProtocolUpgradeProposalFieldsFragment } from '@vegaprotocol/proposals';
export function generateProtocolUpgradeProposal(
override: PartialDeep<ProtocolUpgradeProposalFieldsFragment> = {}

View File

@ -22,11 +22,13 @@ interface UserBalances {
balance: BigNumber;
}
type Params = { address: string };
export const RedemptionInformation = () => {
const { t } = useTranslation();
const navigate = useNavigate();
const tranches = useTranches((state) => state.tranches);
const { address } = useParams<{ address: string }>();
const { address } = useParams<Params>();
const [userBalances, setUserBalances] = useState<null | UserBalances>();
const getUsersBalances = useGetUserBalances(address);
useEffect(() => {
@ -84,7 +86,7 @@ export const RedemptionInformation = () => {
i18nKey="noVestingTokens"
components={{
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}
>
<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')}
</Link>
</Callout>

View File

@ -21,9 +21,10 @@ import RoutesConfig from '../routes';
interface FormFields {
address: string;
}
type Params = { address: string };
const RedemptionRouter = () => {
const { address } = useParams<{ address: string }>();
const { address } = useParams<Params>();
const navigate = useNavigate();
const { t } = useTranslation();
const validatePubkey = useCallback(
@ -89,7 +90,7 @@ const RedemptionRouter = () => {
{t('View connected Eth Wallet')}
</Button>
)}
<p className="py-4 flex justify-center">{t('OR')}</p>
<p className="flex justify-center py-4">{t('OR')}</p>
<form
onSubmit={handleSubmit(onSubmit)}
data-testid="view-connector-form"

View File

@ -21,6 +21,8 @@ import { EthConnectPrompt } from '../../../components/eth-connect-prompt';
import { useUserTrancheBalances } from '../hooks';
import { useAppState } from '../../../contexts/app-state/app-state-context';
type Params = { id: string };
export const RedeemFromTranche = () => {
const { account: address } = useWeb3React();
const { vesting } = useContracts();
@ -34,7 +36,7 @@ export const RedeemFromTranche = () => {
tranches: state.tranches,
getTranches: state.getTranches,
}));
const { id } = useParams<{ id: string }>();
const { id } = useParams<Params>();
const numberId = Number(id);
const tranche = React.useMemo(
() => tranches?.find(({ tranche_id }) => tranche_id === numberId) || null,
@ -86,7 +88,7 @@ export const RedeemFromTranche = () => {
i18nKey="noVestingTokens"
components={{
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={{
stakingLink: (
<Link
className="underline text-white"
className="text-white underline"
to={Routes.VALIDATORS}
/>
),
governanceLink: (
<Link
className="underline text-white"
className="text-white underline"
to={Routes.PROPOSALS}
/>
),

View File

@ -11,12 +11,12 @@ import { useTransaction } from '../../../hooks/use-transaction';
import { useAppState } from '../../../contexts/app-state/app-state-context';
import { removeDecimal, removePaginationWrapper } from '@vegaprotocol/utils';
import * as Schema from '@vegaprotocol/types';
import type {
LinkingsFieldsFragment,
PartyStakeLinkingsQuery,
PartyStakeLinkingsQueryVariables,
import {
PartyStakeLinkingsDocument,
type LinkingsFieldsFragment,
type PartyStakeLinkingsQuery,
type PartyStakeLinkingsQueryVariables,
} from './__generated__/PartyStakeLinkings';
import { PartyStakeLinkingsDocument } from './__generated__/PartyStakeLinkings';
export const useAddStake = (
address: string,

View File

@ -26,9 +26,9 @@ import {
ValidatorRenderer,
VotingPowerRenderer,
} from './shared';
import type { AgGridReact } from 'ag-grid-react';
import type { ColDef, RowHeightParams } from 'ag-grid-community';
import type { ValidatorsTableProps } from './shared';
import { type AgGridReact } from 'ag-grid-react';
import { type ColDef, type RowHeightParams } from 'ag-grid-community';
import { type ValidatorsTableProps } from './shared';
import {
formatNumber,
formatNumberPercentage,
@ -83,19 +83,19 @@ const TopThirdCellRenderer = (
e.preventDefault();
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}
</div>
<div className="px-3 whitespace-normal">
<div className="whitespace-normal px-3">
<div className="mb-4">
<Button
data-testid="show-all-validators"
rightIcon={
<Icon
name="arrow-right"
className="mr-2 align-text-top fill-current"
className="mr-2 fill-current align-text-top"
/>
}
className="inline-flex items-center"

View File

@ -22,9 +22,9 @@ import {
PendingStakeRenderer,
VotingPowerRenderer,
} from './shared';
import type { AgGridReact } from 'ag-grid-react';
import type { ColDef } from 'ag-grid-community';
import type { ValidatorsTableProps } from './shared';
import { type AgGridReact } from 'ag-grid-react';
import { type ColDef } from 'ag-grid-community';
import { type ValidatorsTableProps } from './shared';
import {
formatNumber,
formatNumberPercentage,

View File

@ -28,12 +28,14 @@ interface StakingNodeProps {
previousEpochData?: PreviousEpochQuery;
}
type Params = { node: string };
export const StakingNode = ({ data, previousEpochData }: StakingNodeProps) => {
const { pubKey: vegaKey } = useVegaWallet();
const {
appState: { decimals },
} = useAppState();
const { node } = useParams<{ node: string }>();
const { node } = useParams<Params>();
const { t } = useTranslation();
const { nodeInfo, currentEpoch, delegations } = React.useMemo(

View File

@ -16,10 +16,12 @@ import Routes from '../routes';
import { TrancheLabel } from './tranche-label';
import { useTranches } from '../../lib/tranches/tranches-store';
type Params = { trancheId: string; address: string };
export const Tranche = () => {
const tranches = useTranches((state) => state.tranches);
const { t } = useTranslation();
const { trancheId } = useParams<{ trancheId: string; address: string }>();
const { trancheId } = useParams<Params>();
const { chainId } = useWeb3React();
const tranche = tranches?.find(
(tranche) => trancheId && parseInt(trancheId) === tranche.tranche_id
@ -41,7 +43,7 @@ export const Tranche = () => {
}
/>
<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"
>
<span>{t('alreadyRedeemed')}</span>

View File

@ -1,5 +1,5 @@
import { DApp, useLinks } from '@vegaprotocol/environment';
import type { Market } from '@vegaprotocol/liquidity';
import { type Market } from '@vegaprotocol/liquidity';
import {
displayChange,
formatWithAsset,
@ -12,7 +12,7 @@ import {
toBigNum,
} from '@vegaprotocol/utils';
import { t } from '@vegaprotocol/i18n';
import type { VegaValueFormatterParams } from '@vegaprotocol/datagrid';
import { type VegaValueFormatterParams } from '@vegaprotocol/datagrid';
import { PriceChangeCell } from '@vegaprotocol/datagrid';
import type * as Schema from '@vegaprotocol/types';
import {
@ -21,10 +21,10 @@ import {
HealthBar,
TooltipCellComponent,
} from '@vegaprotocol/ui-toolkit';
import type {
GetRowIdParams,
RowClickedEvent,
ColDef,
import {
type GetRowIdParams,
type RowClickedEvent,
type ColDef,
} from 'ag-grid-community';
import 'ag-grid-community/styles/ag-grid.css';
import 'ag-grid-community/styles/ag-theme-alpine.css';
@ -253,7 +253,7 @@ export const MarketList = () => {
return (
<AsyncRenderer loading={loading} error={error} data={data}>
<div
className="grow w-full"
className="w-full grow"
style={{ minHeight: 500, overflow: 'hidden' }}
>
<Grid

View File

@ -60,19 +60,21 @@ const useMarketDetails = (marketId: string | undefined) => {
};
};
type Params = { marketId: string };
export const Detail = () => {
const { marketId } = useParams<{ marketId: string }>();
const { marketId } = useParams<Params>();
const { data, loading, error } = useMarketDetails(marketId);
return (
<AsyncRenderer loading={loading} error={error} data={data}>
<div className="px-16 pt-14 pb-12 bg-greys-light-100">
<div className="max-w-screen-xl mx-auto">
<div className="bg-greys-light-100 px-16 pb-12 pt-14">
<div className="mx-auto max-w-screen-xl">
<Header name={data.name} symbol={data.symbol} />
</div>
</div>
<div className="px-16">
<div className="max-w-screen-xl mx-auto">
<div className="mx-auto max-w-screen-xl">
<div className="py-12">
{marketId && (
<Market
@ -86,7 +88,7 @@ export const Detail = () => {
)}
</div>
<div>
<h2 className="font-alpha calt text-2xl mb-4">
<h2 className="font-alpha calt mb-4 text-2xl">
{t('Current Liquidity Provision')}
</h2>
<LPProvidersGrid

View File

@ -1,11 +1,11 @@
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 type {
LiquidityProviderFeeShareFieldsFragment,
LiquidityProvisionFieldsFragment,
import {
type LiquidityProviderFeeShareFieldsFragment,
type LiquidityProvisionFieldsFragment,
} from '@vegaprotocol/liquidity';
import { formatWithAsset } from '@vegaprotocol/liquidity';

View File

@ -1,9 +1,9 @@
import { useRef, useCallback, useEffect } from 'react';
import { AgGridReact } from 'ag-grid-react';
import type {
AgGridReactProps,
AgReactUiProps,
AgGridReact as AgGridReactType,
import {
type AgGridReactProps,
type AgReactUiProps,
type AgGridReact as AgGridReactType,
} from 'ag-grid-react';
import classNames from 'classnames';
import 'ag-grid-community/styles/ag-grid.css';
@ -34,7 +34,7 @@ export const Grid = ({ isRowClickable, ...props }: Props) => {
return (
<AgGridReact
className={classNames('ag-theme-alpine h-full font-alpha calt', {
className={classNames('ag-theme-alpine font-alpha calt h-full', {
'row-hover': isRowClickable,
})}
rowHeight={92}

View File

@ -11,12 +11,12 @@ import {
Loader,
} from '@vegaprotocol/ui-toolkit';
import { useContracts } from '../../config/contracts/contracts-context';
import type { FormEvent } from 'react';
import type {
AddSignerBundle,
AddSignerBundleVariables,
import { type FormEvent } from 'react';
import {
type AddSignerBundle,
type AddSignerBundleVariables,
} from '../__generated__/AddSignerBundle';
import type { MultisigControl } from '@vegaprotocol/smart-contracts';
import { type MultisigControl } from '@vegaprotocol/smart-contracts';
export const ADD_SIGNER_QUERY = gql`
query AddSignerBundle($nodeId: ID!) {

View File

@ -11,12 +11,12 @@ import {
Loader,
} from '@vegaprotocol/ui-toolkit';
import { useContracts } from '../../config/contracts/contracts-context';
import type { FormEvent } from 'react';
import type {
RemoveSignerBundle,
RemoveSignerBundleVariables,
import { type FormEvent } from 'react';
import {
type RemoveSignerBundle,
type RemoveSignerBundleVariables,
} from '../__generated__/RemoveSignerBundle';
import type { MultisigControl } from '@vegaprotocol/smart-contracts';
import { type MultisigControl } from '@vegaprotocol/smart-contracts';
const REMOVE_SIGNER_QUERY = gql`
query RemoveSignerBundle($nodeId: ID!) {

View File

@ -1,7 +1,7 @@
import { useEffect, useState } from 'react';
import { MultisigControl } from '@vegaprotocol/smart-contracts';
import { Splash } from '@vegaprotocol/ui-toolkit';
import type { ContractsContextShape } from './contracts-context';
import { type ContractsContextShape } from './contracts-context';
import { ContractsContext } from './contracts-context';
import { useEthereumConfig } from '@vegaprotocol/web3';
import { useEnvironment } from '@vegaprotocol/environment';

View File

@ -6,22 +6,18 @@ import {
makeDerivedDataProvider,
} from '@vegaprotocol/data-provider';
import * as Schema from '@vegaprotocol/types';
import type { Market } from '@vegaprotocol/markets';
import { type Market } from '@vegaprotocol/markets';
import produce from 'immer';
import { type IterableElement } from 'type-fest';
import {
AccountEventsDocument,
AccountsDocument,
} from './__generated__/Accounts';
import type { IterableElement } from 'type-fest';
import type {
AccountFieldsFragment,
AccountsQuery,
AccountEventsSubscription,
AccountsQueryVariables,
} from './__generated__/Accounts';
import type { Asset } from '@vegaprotocol/assets';
import { type Asset } from '@vegaprotocol/assets';
const AccountType = Schema.AccountType;

View File

@ -2,16 +2,16 @@ import { useRef, memo, useState, useCallback } from 'react';
import { addDecimalsFormatNumber } from '@vegaprotocol/utils';
import { t } from '@vegaprotocol/i18n';
import { useDataProvider } from '@vegaprotocol/data-provider';
import type { AgGridReact } from 'ag-grid-react';
import { type AgGridReact } from 'ag-grid-react';
import {
aggregatedAccountsDataProvider,
aggregatedAccountDataProvider,
} from './accounts-data-provider';
import type { PinnedAsset } from './accounts-table';
import { type PinnedAsset } from './accounts-table';
import { AccountTable } from './accounts-table';
import { Dialog } from '@vegaprotocol/ui-toolkit';
import BreakdownTable from './breakdown-table';
import type { useDataGridEvents } from '@vegaprotocol/datagrid';
import { type useDataGridEvents } from '@vegaprotocol/datagrid';
const AccountBreakdown = ({
assetId,
@ -37,10 +37,10 @@ const AccountBreakdown = ({
return (
<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"
>
<h1 className="text-xl mb-4">
<h1 className="mb-4 text-xl">
{data?.asset?.symbol} {t('usage breakdown')}
</h1>
{data && (

View File

@ -5,12 +5,12 @@ import {
} from '@vegaprotocol/utils';
import { t } from '@vegaprotocol/i18n';
import { Intent, TooltipCellComponent } from '@vegaprotocol/ui-toolkit';
import type { AgGridReact, AgGridReactProps } from 'ag-grid-react';
import type { AccountFields } from './accounts-data-provider';
import { type AgGridReact, type AgGridReactProps } from 'ag-grid-react';
import { type AccountFields } from './accounts-data-provider';
import { AccountTypeMapping } from '@vegaprotocol/types';
import type {
VegaValueFormatterParams,
VegaICellRendererParams,
import {
type VegaValueFormatterParams,
type VegaICellRendererParams,
} from '@vegaprotocol/datagrid';
import { ProgressBarCell } from '@vegaprotocol/datagrid';
import { AgGrid, PriceCell } from '@vegaprotocol/datagrid';

View File

@ -7,12 +7,10 @@ import {
import {
MarginsSubscriptionDocument,
MarginsDocument,
} from './__generated__/Margins';
import type {
MarginsQuery,
MarginFieldsFragment,
MarginsSubscriptionSubscription,
MarginsQueryVariables,
type MarginsQuery,
type MarginFieldsFragment,
type MarginsSubscriptionSubscription,
type MarginsQueryVariables,
} from './__generated__/Margins';
const update = (

View File

@ -1,9 +1,9 @@
import { makeDataProvider, useDataProvider } from '@vegaprotocol/data-provider';
import type {
AssetQuery,
AssetFieldsFragment,
AssetQueryVariables,
import {
type AssetQuery,
type AssetQueryVariables,
type AssetFieldsFragment,
} from './__generated__/Asset';
import { AssetDocument } from './__generated__/Asset';

View File

@ -3,10 +3,9 @@ import {
makeDerivedDataProvider,
} 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 type { AssetsQuery } from './__generated__/Assets';
import type { Asset } from './asset-data-provider';
import { type Asset } from './asset-data-provider';
import { DENY_LIST } from './constants';
export interface BuiltinAssetSource {

View File

@ -20,7 +20,7 @@ import {
TradingDropdownTrigger,
Icon,
} from '@vegaprotocol/ui-toolkit';
import type { IconName } from '@blueprintjs/icons';
import { type IconName } from '@blueprintjs/icons';
import { IconNames } from '@blueprintjs/icons';
import { t } from '@vegaprotocol/i18n';
import { useCandlesChartSettings } from './use-candles-chart-settings';

View File

@ -1,29 +1,33 @@
import type { ApolloClient } from '@apollo/client';
import type { Duration } from 'date-fns';
import { type ApolloClient } from '@apollo/client';
import { type Duration } from 'date-fns';
import {
add,
differenceInDays,
differenceInHours,
differenceInMinutes,
} 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 { addDecimal } from '@vegaprotocol/utils';
import { ChartDocument } from './__generated__/Chart';
import type { ChartQuery, ChartQueryVariables } from './__generated__/Chart';
import {
ChartDocument,
type ChartQuery,
type ChartQueryVariables,
} from './__generated__/Chart';
import {
CandlesDocument,
CandlesEventsDocument,
type CandlesQuery,
type CandlesQueryVariables,
type CandlesEventsSubscription,
type CandlesEventsSubscriptionVariables,
type CandleFieldsFragment,
} from './__generated__/Candles';
import type {
CandlesQuery,
CandlesQueryVariables,
CandleFieldsFragment,
CandlesEventsSubscription,
CandlesEventsSubscriptionVariables,
} from './__generated__/Candles';
import type { Subscription } from 'zen-observable-ts';
import { type Subscription } from 'zen-observable-ts';
import * as Schema from '@vegaprotocol/types';
const INTERVAL_TO_PENNANT_MAP = {

View File

@ -3,29 +3,29 @@ import {
makeDerivedDataProvider,
defaultAppend,
} from './generic-data-provider';
import type {
CombineDerivedData,
CombineDerivedDelta,
CombineInsertionData,
Query,
UpdateCallback,
Update,
PageInfo,
Reload,
Load,
import {
type CombineDerivedData,
type CombineDerivedDelta,
type CombineInsertionData,
type UpdateCallback,
type Update,
type Query,
type PageInfo,
type Reload,
type Load,
} from './generic-data-provider';
import type {
ApolloClient,
FetchResult,
SubscriptionOptions,
OperationVariables,
ApolloQueryResult,
QueryOptions,
import {
type FetchResult,
type SubscriptionOptions,
type OperationVariables,
type ApolloQueryResult,
type QueryOptions,
type ApolloClient,
} from '@apollo/client';
import { ApolloError } from '@apollo/client';
import type { GraphQLErrors } from '@apollo/client/errors';
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';
type Item = {

View File

@ -1,5 +1,10 @@
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';
const getLastRow = (

View File

@ -1,7 +1,10 @@
import { renderHook, act } from '@testing-library/react';
import { useDataProvider, useThrottledDataProvider } from './use-data-provider';
import type { useDataProviderParams } from './use-data-provider';
import type { Subscribe, UpdateCallback } from './generic-data-provider';
import {
useDataProvider,
useThrottledDataProvider,
type useDataProviderParams,
} from './use-data-provider';
import { type Subscribe, type UpdateCallback } from './generic-data-provider';
import { MockedProvider } from '@apollo/client/testing';
type Data = number;

View File

@ -3,11 +3,11 @@ import throttle from 'lodash/throttle';
import isEqualWith from 'lodash/isEqualWith';
import { useApolloClient } from '@apollo/client';
import type { OperationVariables } from '@apollo/client';
import type {
Subscribe,
Load,
UpdateCallback,
PageInfo,
import {
type UpdateCallback,
type PageInfo,
type Subscribe,
type Load,
} from './generic-data-provider';
import { variablesIsEqualCustomizer } from './generic-data-provider';

View File

@ -1,5 +1,5 @@
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';
type Props = AgGridReactProps & {

View File

@ -1,6 +1,6 @@
import type { ChangeEvent } 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 type { IDoesFilterPassParams, IFilterParams } from 'ag-grid-community';
import {
@ -17,9 +17,9 @@ import { formatForInput } from '@vegaprotocol/utils';
import { t } from '@vegaprotocol/i18n';
import { TradingInputError } from '@vegaprotocol/ui-toolkit';
const defaultValue: Schema.DateRange = {};
const defaultValue: DateRange = {};
export interface DateRangeFilterProps extends IFilterParams {
defaultValue?: Schema.DateRange;
defaultValue?: DateRange;
maxSubDays?: number;
maxNextDays?: number;
maxDaysRange?: number;
@ -28,8 +28,8 @@ export interface DateRangeFilterProps extends IFilterParams {
export const DateRangeFilter = forwardRef(
(props: DateRangeFilterProps, ref) => {
const defaultDates = props?.defaultValue || defaultValue;
const [value, setValue] = useState<Schema.DateRange>(defaultDates);
const valueRef = useRef<Schema.DateRange>(value);
const [value, setValue] = useState<DateRange>(defaultDates);
const valueRef = useRef<DateRange>(value);
const [error, setError] = useState<string>('');
const [minStartDate, maxStartDate, minEndDate, maxEndDate] = useMemo(() => {
const minStartDate =
@ -105,18 +105,14 @@ export const DateRangeFilter = forwardRef(
return { value: valueRef.current };
},
setModel(model?: { value: Schema.DateRange } | null) {
setModel(model?: { value: DateRange } | null) {
valueRef.current =
model?.value || props?.defaultValue || defaultValue;
setValue(valueRef.current);
},
};
});
const validate = (
name: string,
timeValue: Date,
update?: Schema.DateRange
) => {
const validate = (name: string, timeValue: Date, update?: DateRange) => {
if (
props.maxSubDays !== undefined &&
isBefore(new Date(timeValue), subDays(Date.now(), props.maxSubDays + 1))
@ -209,7 +205,7 @@ export const DateRangeFilter = forwardRef(
<div className="ag-filter-apply-panel">
<fieldset className="ag-simple-filter-body-wrapper">
<label className="block" key="start">
<span className="block mb-1">{t('Start')}</span>
<span className="mb-1 block">{t('Start')}</span>
<input
type="datetime-local"
name="start"
@ -222,7 +218,7 @@ export const DateRangeFilter = forwardRef(
</fieldset>
<fieldset className="ag-simple-filter-body-wrapper">
<label className="block" key="end">
<span className="block mb-1">{t('End')}</span>
<span className="mb-1 block">{t('End')}</span>
<input
type="datetime-local"
name="end"

View File

@ -3,7 +3,7 @@ import { useDataGridEvents } from './use-datagrid-events';
import { AgGridThemed } from './ag-grid/ag-grid-themed';
import type { MutableRefObject } from 'react';
import { useRef } from 'react';
import type { AgGridReact } from 'ag-grid-react';
import { type AgGridReact } from 'ag-grid-react';
const gridProps = {
rowData: [{ id: 1 }],
@ -17,7 +17,7 @@ const gridProps = {
style: { width: 500, height: 300 },
};
const GRID_EVENT_DEBOUNCE_TIME = 300;
let gridRef: MutableRefObject<AgGridReact | null>;
let gridRef: MutableRefObject<AgGridReact | null> | undefined;
function TestComponent({
hookParams,
}: {
@ -61,11 +61,11 @@ describe('useDataGridEvents', () => {
// column state was not updated, so the default width provided by the
// 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
);
// no filters set
expect(gridRef.current?.api.getFilterModel()).toEqual({});
expect(gridRef?.current?.api.getFilterModel()).toEqual({});
// Set filter
const idFilter = {
@ -74,7 +74,7 @@ describe('useDataGridEvents', () => {
type: 'equals',
};
await act(async () => {
gridRef.current?.api.setFilterModel({
gridRef?.current?.api.setFilterModel({
id: idFilter,
});
});
@ -90,7 +90,7 @@ describe('useDataGridEvents', () => {
},
});
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 () => {
@ -110,8 +110,8 @@ describe('useDataGridEvents', () => {
setup(initialState, jest.fn());
await waitFor(() => {
expect(gridRef.current?.api.getFilterModel()['id']).toEqual(idFilter);
expect(gridRef.current?.columnApi.getColumnState()[0]).toEqual(
expect(gridRef?.current?.api.getFilterModel()['id']).toEqual(idFilter);
expect(gridRef?.current?.columnApi.getColumnState()[0]).toEqual(
expect.objectContaining(colState)
);
});
@ -130,7 +130,7 @@ describe('useDataGridEvents', () => {
// Set col width multiple times
await act(async () => {
gridRef.current?.columnApi.setColumnWidth('id', newWidth);
gridRef?.current?.columnApi.setColumnWidth('id', newWidth);
});
expect(callback).not.toHaveBeenCalled();
@ -150,13 +150,13 @@ describe('useDataGridEvents', () => {
};
const { rerender } = setup(initialState, callback, ['id']);
jest.spyOn(gridRef.current?.columnApi, 'autoSizeColumns');
jest.spyOn(gridRef?.current?.columnApi, 'autoSizeColumns');
rerender(<TestComponent hookParams={[initialState, callback, ['id']]} />);
act(() => {
gridRef.current?.api.setRowData([{ id: 'test-id' }]);
gridRef?.current?.api.setRowData([{ id: 'test-id' }]);
jest.advanceTimersByTime(GRID_EVENT_DEBOUNCE_TIME);
});
expect(gridRef.current?.columnApi.autoSizeColumns).toHaveBeenCalledWith([
expect(gridRef?.current?.columnApi.autoSizeColumns).toHaveBeenCalledWith([
'id',
]);
});

View File

@ -1,12 +1,12 @@
import type {
ColumnMovedEvent,
ColumnResizedEvent,
ColumnState,
ColumnVisibleEvent,
FilterChangedEvent,
FirstDataRenderedEvent,
SortChangedEvent,
GridReadyEvent,
import {
type ColumnMovedEvent,
type ColumnResizedEvent,
type ColumnState,
type ColumnVisibleEvent,
type FilterChangedEvent,
type FirstDataRenderedEvent,
type SortChangedEvent,
type GridReadyEvent,
} from 'ag-grid-community';
import { useCallback } from 'react';

View File

@ -1,8 +1,8 @@
import { useRef, useCallback, useEffect } from 'react';
import { useVegaWallet } from '@vegaprotocol/wallet';
import type {
OrderSubmissionBody,
StopOrdersSubmission,
import {
type OrderSubmissionBody,
type StopOrdersSubmission,
} from '@vegaprotocol/wallet';
import {
formatForInput,
@ -11,7 +11,7 @@ import {
toDecimal,
validateAmount,
} 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 * as Schema from '@vegaprotocol/types';
import {
@ -52,7 +52,7 @@ import {
dealTicketTypeToOrderType,
isStopOrderType,
} 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 { DealTicketFeeDetails } from './deal-ticket-fee-details';
import { validateExpiration } from '../../utils';
@ -542,7 +542,7 @@ const NotionalAndFees = ({
market.positionDecimalPlaces
);
return (
<div className="mb-4 flex flex-col gap-2 w-full">
<div className="mb-4 flex w-full flex-col gap-2">
<KeyValue
label={t('Notional')}
value={formatValue(notionalSize, market.decimalPlaces)}
@ -909,7 +909,7 @@ export const StopOrder = ({ market, marketPrice, submit }: StopOrderProps) => {
marketPrice={marketPrice}
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
control={control}
sizeStep={sizeStep}
@ -934,11 +934,11 @@ export const StopOrder = ({ market, marketPrice, submit }: StopOrderProps) => {
type={type}
/>
<TimeInForce control={control} />
<div className="flex justify-end pb-3 gap-2">
<div className="flex justify-end gap-2 pb-3">
<ReduceOnly />
</div>
<hr className="mb-4 border-vega-clight-500 dark:border-vega-cdark-500" />
<div className="flex justify-between pb-2 gap-2">
<hr className="border-vega-clight-500 dark:border-vega-cdark-500 mb-4" />
<div className="flex justify-between gap-2 pb-2">
<Controller
name="oco"
control={control}
@ -1005,7 +1005,7 @@ export const StopOrder = ({ market, marketPrice, submit }: StopOrderProps) => {
decimalPlaces={market.decimalPlaces}
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
control={control}
sizeStep={sizeStep}
@ -1034,7 +1034,7 @@ export const StopOrder = ({ market, marketPrice, submit }: StopOrderProps) => {
type={ocoType}
/>
<TimeInForce control={control} oco />
<div className="flex justify-end mb-2 gap-2">
<div className="mb-2 flex justify-end gap-2">
<ReduceOnly />
</div>
</>

View File

@ -1,6 +1,6 @@
import { t } from '@vegaprotocol/i18n';
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 { Controller, useController, useForm } from 'react-hook-form';
import {
@ -11,7 +11,7 @@ import { ExpirySelector } from './expiry-selector';
import { SideSelector } from './side-selector';
import { TimeInForceSelector } from './time-in-force-selector';
import { TypeSelector } from './type-selector';
import type { OrderSubmission } from '@vegaprotocol/wallet';
import { type OrderSubmission } from '@vegaprotocol/wallet';
import { useVegaWallet } from '@vegaprotocol/wallet';
import { mapFormValuesToOrderSubmission } from '../../utils/map-form-values-to-submission';
import {
@ -66,7 +66,7 @@ import {
useAccountBalance,
} from '@vegaprotocol/accounts';
import { useDataProvider } from '@vegaprotocol/data-provider';
import type { OrderFormValues } from '../../hooks';
import { type OrderFormValues } from '../../hooks';
import {
DealTicketType,
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
label={t('Notional')}
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
name="postOnly"
control={control}
@ -621,7 +621,7 @@ export const DealTicket = ({
</div>
{isLimitType && (
<>
<div className="flex justify-between pb-2 gap-2">
<div className="flex justify-between gap-2 pb-2">
<Controller
name="iceberg"
control={control}

View File

@ -1,6 +1,6 @@
import type {
EstimatePositionQueryVariables,
EstimatePositionQuery,
import {
type EstimatePositionQuery,
type EstimatePositionQueryVariables,
} from '@vegaprotocol/positions';
import { useEstimatePositionQuery } from '@vegaprotocol/positions';
import { useEffect, useState } from 'react';

View File

@ -2,16 +2,14 @@ import uniqBy from 'lodash/uniqBy';
import orderBy from 'lodash/orderBy';
import { getEvents, removePaginationWrapper } from '@vegaprotocol/utils';
import { makeDataProvider } from '@vegaprotocol/data-provider';
import * as Schema from '@vegaprotocol/types';
import { BusEventType } from '@vegaprotocol/types';
import {
DepositsDocument,
DepositEventDocument,
} from './__generated__/Deposit';
import type {
DepositFieldsFragment,
DepositsQuery,
DepositEventSubscription,
DepositEventSubscriptionVariables,
type DepositFieldsFragment,
type DepositsQuery,
type DepositEventSubscription,
type DepositEventSubscriptionVariables,
} from './__generated__/Deposit';
export const depositsProvider = makeDataProvider<
@ -38,7 +36,7 @@ export const depositsProvider = makeDataProvider<
return data;
}
const incoming = getEvents<DepositFieldsFragment>(
Schema.BusEventType.Deposit,
BusEventType.Deposit,
delta.busEvents
);
return uniqBy([...incoming, ...(data || [])], 'id');

View File

@ -5,14 +5,14 @@ import {
truncateByChars,
isNumeric,
} from '@vegaprotocol/utils';
import type { ColDef } from 'ag-grid-community';
import { type ColDef } from 'ag-grid-community';
import { AgGrid } from '@vegaprotocol/datagrid';
import type {
VegaICellRendererParams,
VegaValueFormatterParams,
TypedDataAgGrid,
import {
type VegaICellRendererParams,
type VegaValueFormatterParams,
type TypedDataAgGrid,
} from '@vegaprotocol/datagrid';
import type { DepositFieldsFragment } from './__generated__/Deposit';
import { type DepositFieldsFragment } from './__generated__/Deposit';
import { EtherscanLink } from '@vegaprotocol/environment';
import { DepositStatusMapping } from '@vegaprotocol/types';

View File

@ -1,14 +1,11 @@
import {
NodeCheckDocument,
NodeCheckTimeUpdateDocument,
} from '../../utils/__generated__/NodeCheck';
import type {
NodeCheckQuery,
NodeCheckTimeUpdateSubscription,
type NodeCheckQuery,
type NodeCheckTimeUpdateSubscription,
} from '../../utils/__generated__/NodeCheck';
import { Networks } from '../../types';
import type { RequestHandlerResponse } from 'mock-apollo-client';
import { createMockClient } from 'mock-apollo-client';
import { createMockClient, RequestHandlerResponse } from 'mock-apollo-client';
export type MockRequestConfig = {
hasError?: boolean;

View File

@ -4,15 +4,17 @@ import { t } from '@vegaprotocol/i18n';
import { useEffect } from 'react';
import { create } from 'zustand';
import { createClient } from '@vegaprotocol/apollo-client';
import type {
NodeCheckTimeUpdateSubscription,
NodeCheckQuery,
} from '../utils/__generated__/NodeCheck';
import {
NodeCheckDocument,
NodeCheckTimeUpdateDocument,
type NodeCheckTimeUpdateSubscription,
type NodeCheckQuery,
} 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 { compileErrors } from '../utils/compile-errors';
import { envSchema } from '../utils/validate-environment';

View File

@ -1,6 +1,5 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import { useCallback, useEffect, useState } from 'react';
import type { ReleasesState } from './use-releases';
import { type ReleasesState } from './use-releases';
import { ReleasesFeed } from './use-releases';
import { fetchReleases } from './use-releases';

View File

@ -1,20 +1,21 @@
import orderBy from 'lodash/orderBy';
import type { PageInfo, Cursor } from '@vegaprotocol/data-provider';
import { type PageInfo, type Cursor } from '@vegaprotocol/data-provider';
import {
makeDataProvider,
makeDerivedDataProvider,
defaultAppend as append,
} from '@vegaprotocol/data-provider';
import type { Market } from '@vegaprotocol/markets';
import { type Market } from '@vegaprotocol/markets';
import { marketsMapProvider } from '@vegaprotocol/markets';
import { FillsDocument, FillsEventDocument } from './__generated__/Fills';
import type {
FillsQuery,
FillsQueryVariables,
FillFieldsFragment,
FillsEventSubscription,
FillUpdateFieldsFragment,
FillsEventSubscriptionVariables,
import {
FillsDocument,
FillsEventDocument,
type FillsQuery,
type FillsQueryVariables,
type FillFieldsFragment,
type FillsEventSubscription,
type FillUpdateFieldsFragment,
type FillsEventSubscriptionVariables,
} from './__generated__/Fills';
export type Trade = Omit<FillFieldsFragment, 'market'> & {

View File

@ -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 { t } from '@vegaprotocol/i18n';
import { FillsTable } from './fills-table';
import type { useDataGridEvents } from '@vegaprotocol/datagrid';
import { type useDataGridEvents } from '@vegaprotocol/datagrid';
import { Pagination } from '@vegaprotocol/datagrid';
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';
interface FillsManagerProps {
@ -20,7 +23,7 @@ export const FillsManager = ({
gridProps,
}: FillsManagerProps) => {
const gridRef = useRef<AgGridReact | null>(null);
const filter: Schema.TradesFilter | Schema.TradesSubscriptionFilter = {
const filter: TradesFilter | TradesSubscriptionFilter = {
partyIds: [partyId],
};
const [hasDisplayedRow, setHasDisplayedRow] = useState<boolean | undefined>(
@ -38,7 +41,7 @@ export const FillsManager = ({
variables: { filter },
});
return (
<div className="flex flex-col h-full">
<div className="flex h-full flex-col">
<FillsTable
ref={gridRef}
rowData={data}

View File

@ -1,10 +1,10 @@
import { useMemo } from 'react';
import type {
AgGridReact,
AgGridReactProps,
AgReactUiProps,
import {
type AgGridReact,
type AgGridReactProps,
type AgReactUiProps,
} from 'ag-grid-react';
import type { ITooltipParams, ColDef } from 'ag-grid-community';
import { type ITooltipParams, type ColDef } from 'ag-grid-community';
import {
addDecimal,
addDecimalsFormatNumber,
@ -22,16 +22,16 @@ import {
COL_DEFS,
DateRangeFilter,
} from '@vegaprotocol/datagrid';
import type {
VegaValueFormatterParams,
VegaICellRendererParams,
import {
type VegaValueFormatterParams,
type VegaICellRendererParams,
} from '@vegaprotocol/datagrid';
import { forwardRef } from 'react';
import BigNumber from 'bignumber.js';
import type { Trade } from './fills-data-provider';
import type {
FillFieldsFragment,
TradeFeeFieldsFragment,
import { type Trade } from './fills-data-provider';
import {
type FillFieldsFragment,
type TradeFeeFieldsFragment,
} from './__generated__/Fills';
import { FillActionsDropdown } from './fill-actions-dropdown';
import { getAsset } from '@vegaprotocol/markets';
@ -337,7 +337,7 @@ const FeesBreakdownTooltip = ({
return (
<div
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 && (
<>
@ -361,20 +361,20 @@ const FeesBreakdownTooltip = ({
)}
<dl className="grid grid-cols-2 gap-x-1">
<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)}{' '}
{asset.symbol}
</dd>
<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}
</dd>
<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}
</dd>
<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}
</dd>
</dl>
@ -394,7 +394,7 @@ const FeesDiscountBreakdownTooltipItem = ({
value && value !== '0' ? (
<>
<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}
</dd>
</>
@ -415,7 +415,7 @@ export const FeesDiscountBreakdownTooltip = ({
return (
<div
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">
{(fees.infrastructureFeeReferralDiscount || '0') !== '0' ||

View File

@ -1,4 +1,4 @@
import type { PageInfo, Cursor } from '@vegaprotocol/data-provider';
import { type PageInfo, type Cursor } from '@vegaprotocol/data-provider';
import {
makeDataProvider,
makeDerivedDataProvider,
@ -6,11 +6,11 @@ import {
} from '@vegaprotocol/data-provider';
import type { Market } from '@vegaprotocol/markets';
import { marketsMapProvider } from '@vegaprotocol/markets';
import { FundingPaymentsDocument } from './__generated__/FundingPayments';
import type {
FundingPaymentsQuery,
FundingPaymentsQueryVariables,
FundingPaymentFieldsFragment,
import {
FundingPaymentsDocument,
type FundingPaymentsQueryVariables,
type FundingPaymentFieldsFragment,
type FundingPaymentsQuery,
} from './__generated__/FundingPayments';
export type FundingPayment = Omit<FundingPaymentFieldsFragment, 'market'> & {

View File

@ -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 { t } from '@vegaprotocol/i18n';
import { FundingPaymentsTable } from './funding-payments-table';
import { Pagination } from '@vegaprotocol/datagrid';
import type { useDataGridEvents } from '@vegaprotocol/datagrid';
import { type useDataGridEvents } from '@vegaprotocol/datagrid';
import { useDataProvider } from '@vegaprotocol/data-provider';
import { fundingPaymentsWithMarketProvider } from './funding-payments-data-provider';
@ -44,7 +44,7 @@ export const FundingPaymentsManager = ({
});
return (
<div className="flex flex-col h-full">
<div className="flex h-full flex-col">
<FundingPaymentsTable
ref={gridRef}
rowData={data}

View File

@ -1,10 +1,10 @@
import { useMemo } from 'react';
import type {
AgGridReact,
AgGridReactProps,
AgReactUiProps,
import {
type AgGridReact,
type AgGridReactProps,
type AgReactUiProps,
} from 'ag-grid-react';
import type { ColDef } from 'ag-grid-community';
import { type ColDef } from 'ag-grid-community';
import {
addDecimalsFormatNumber,
getDateTimeFormat,

View File

@ -5,19 +5,15 @@ import {
} from '@vegaprotocol/data-provider';
import * as Schema from '@vegaprotocol/types';
import BigNumber from 'bignumber.js';
import {
LiquidityProvidersDocument,
LiquidityProvisionsDocument,
} from './__generated__/MarketLiquidity';
import type {
LiquidityProviderFieldsFragment,
LiquidityProvidersQuery,
LiquidityProvidersQueryVariables,
LiquidityProvisionFieldsFragment,
LiquidityProvisionsQuery,
LiquidityProvisionsQueryVariables,
type LiquidityProvidersQuery,
type LiquidityProvidersQueryVariables,
type LiquidityProvisionsQuery,
type LiquidityProvisionsQueryVariables,
type LiquidityProviderFieldsFragment,
type LiquidityProvisionFieldsFragment,
} from './__generated__/MarketLiquidity';
export type LiquidityProvisionFields = LiquidityProvisionFieldsFragment &

View File

@ -6,17 +6,18 @@ import {
useDataProvider,
} from '@vegaprotocol/data-provider';
import { useYesterday } from '@vegaprotocol/react-helpers';
import type {
MarketCandles,
MarketMaybeWithDataAndCandles,
MarketsCandlesQueryVariables,
import {
type MarketsCandlesQueryVariables,
type MarketCandles,
type MarketMaybeWithDataAndCandles,
} from '@vegaprotocol/markets';
import { marketListProvider } from '@vegaprotocol/markets';
import type { LiquidityProvisionMarketsQuery } from './__generated__/MarketsLiquidity';
import { LiquidityProvisionMarketsDocument } from './__generated__/MarketsLiquidity';
import {
LiquidityProvisionMarketsDocument,
type LiquidityProvisionMarketsQuery,
} from './__generated__/MarketsLiquidity';
import {
calcDayVolume,
getCandle24hAgo,
@ -26,7 +27,7 @@ import {
getFeeLevels,
getTargetStake,
} from './utils/liquidity-utils';
import type { Provider, LiquidityProvisionMarket } from './utils';
import { type Provider, type LiquidityProvisionMarket } from './utils';
export interface FeeLevels {
commitmentAmount: number;

View File

@ -1,5 +1,5 @@
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 { SentryInit } from '../lib/sentry-utils';

View File

@ -8,13 +8,13 @@ import { useDataProvider } from '@vegaprotocol/data-provider';
import { marketDepthProvider } from './market-depth-provider';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { marketDataProvider, marketProvider } from '@vegaprotocol/markets';
import type { MarketData } from '@vegaprotocol/markets';
import type {
MarketDepthQuery,
MarketDepthUpdateSubscription,
PriceLevelFieldsFragment,
import { type MarketData } from '@vegaprotocol/markets';
import {
type MarketDepthQuery,
type MarketDepthUpdateSubscription,
type PriceLevelFieldsFragment,
} from './__generated__/MarketDepth';
import type { DepthChartProps } from 'pennant';
import { type DepthChartProps } from 'pennant';
import { parseLevel, updateLevels } from './depth-chart-utils';
interface DepthChartManagerProps {
@ -238,7 +238,7 @@ export const DepthChartContainer = ({ marketId }: DepthChartManagerProps) => {
volumeFormat={volumeFormat}
priceFormat={priceFormat}
notEnoughDataText={
<span className="text-xs text-center">{t('No open orders')}</span>
<span className="text-center text-xs">{t('No open orders')}</span>
}
/>
)}

View File

@ -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 { updateLevels } from './orderbook-data';
import { captureException } from '@sentry/react';
@ -6,11 +6,9 @@ import { captureException } from '@sentry/react';
import {
MarketDepthDocument,
MarketDepthUpdateDocument,
} from './__generated__/MarketDepth';
import type {
MarketDepthQuery,
MarketDepthQueryVariables,
MarketDepthUpdateSubscription,
type MarketDepthQuery,
type MarketDepthQueryVariables,
type MarketDepthUpdateSubscription,
} from './__generated__/MarketDepth';
export const update: Update<

View File

@ -7,10 +7,10 @@ import {
marketDataProvider,
marketProvider,
} from '@vegaprotocol/markets';
import type {
MarketDepthQuery,
MarketDepthQueryVariables,
MarketDepthUpdateSubscription,
import {
type MarketDepthQuery,
type MarketDepthQueryVariables,
type MarketDepthUpdateSubscription,
} from './__generated__/MarketDepth';
interface OrderbookManagerProps {

View File

@ -3,14 +3,16 @@ import {
makeDerivedDataProvider,
marketDataErrorPolicyGuard,
} from '@vegaprotocol/data-provider';
import type {
MarketInfoQuery,
MarketInfoQueryVariables,
import {
MarketInfoDocument,
type MarketInfoQuery,
type MarketInfoQueryVariables,
} from './__generated__/MarketInfo';
import { marketDataProvider } from '../../market-data-provider';
import type { MarketData } from '../../market-data-provider';
import {
marketDataProvider,
type MarketData,
} from '../../market-data-provider';
import type { Candle } from '../../market-candles-provider';
import { MarketInfoDocument } from './__generated__/MarketInfo';
export type MarketInfo = NonNullable<MarketInfoQuery['market']>;
export type MarketInfoWithData = MarketInfo & { data?: MarketData };

View File

@ -1,7 +1,7 @@
import { renderHook } from '@testing-library/react';
import { useMarketOracle } from './use-market-oracle';
import type { MarketFieldsFragment } from '../__generated__/markets';
import type { Provider } from '../oracle-schema';
import { type MarketFieldsFragment } from '../__generated__/markets';
import { type Provider } from '../oracle-schema';
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[]>(() => ({}));
jest.mock('@vegaprotocol/environment', () => ({
useEnvironment: jest.fn((args) => mockEnvironment()),
useEnvironment: jest.fn(() => mockEnvironment()),
}));
jest.mock('../markets-provider', () => ({
useMarket: jest.fn((args) => mockMarket()),
useMarket: jest.fn(() => mockMarket()),
}));
jest.mock('./use-oracle-proofs', () => ({
useOracleProofs: jest.fn((args) => mockOracleProofs()),
useOracleProofs: jest.fn(() => mockOracleProofs()),
}));
const marketId = 'marketId';

View File

@ -1,5 +1,5 @@
import { useEffect, useState } from 'react';
import type { Provider } from '../oracle-schema';
import { type Provider } from '../oracle-schema';
import { providersSchema } from '../oracle-schema';
export let cache: {

View File

@ -1,13 +1,11 @@
import { makeDataProvider } from '@vegaprotocol/data-provider';
import type {
MarketCandlesQuery,
MarketCandlesQueryVariables,
MarketCandlesUpdateSubscription,
MarketCandlesFieldsFragment,
} from './__generated__/market-candles';
import {
MarketCandlesDocument,
MarketCandlesUpdateDocument,
type MarketCandlesQuery,
type MarketCandlesQueryVariables,
type MarketCandlesUpdateSubscription,
type MarketCandlesFieldsFragment,
} from './__generated__/market-candles';
export type Candle = MarketCandlesFieldsFragment;

View File

@ -7,13 +7,11 @@ import { useDataProvider } from '@vegaprotocol/data-provider';
import {
MarketDataDocument,
MarketDataUpdateDocument,
} from './__generated__/market-data';
import type {
MarketDataQuery,
MarketDataFieldsFragment,
MarketDataUpdateSubscription,
MarketDataUpdateFieldsFragment,
MarketDataQueryVariables,
type MarketDataQuery,
type MarketDataFieldsFragment,
type MarketDataUpdateSubscription,
type MarketDataUpdateFieldsFragment,
type MarketDataQueryVariables,
} from './__generated__/market-data';
import { getMarketPrice } from './get-price';
import { MarketTradingMode } from '@vegaprotocol/types';

View File

@ -1,10 +1,10 @@
import { makeDataProvider } from '@vegaprotocol/data-provider';
import { MarketsCandlesDocument } from './__generated__/markets-candles';
import type {
MarketsCandlesQuery,
MarketsCandlesQueryVariables,
import {
MarketsCandlesDocument,
type MarketsCandlesQuery,
type MarketsCandlesQueryVariables,
} from './__generated__/markets-candles';
import type { Candle } from './market-candles-provider';
import { type Candle } from './market-candles-provider';
export interface MarketCandles {
marketId: string;

View File

@ -1,17 +1,17 @@
import { marketDataErrorPolicyGuard } from '@vegaprotocol/data-provider';
import { makeDataProvider } from '@vegaprotocol/data-provider';
import type {
MarketsDataQuery,
MarketsDataQueryVariables,
import {
MarketsDataDocument,
type MarketsDataQuery,
type MarketsDataQueryVariables,
} from './__generated__/markets-data';
import type {
MarketDataUpdateSubscription,
MarketDataUpdateFieldsFragment,
MarketDataUpdateSubscriptionVariables,
import {
MarketDataUpdateDocument,
type MarketDataUpdateSubscription,
type MarketDataUpdateFieldsFragment,
type MarketDataUpdateSubscriptionVariables,
} from './__generated__/market-data';
import { MarketDataUpdateDocument } from './__generated__/market-data';
import { MarketsDataDocument } from './__generated__/markets-data';
import type { MarketData } from './market-data-provider';
import { type MarketData } from './market-data-provider';
const getData = (responseData: MarketsDataQuery | null): MarketData[] =>
responseData?.marketsConnection?.edges

View File

@ -5,29 +5,30 @@ import {
marketDataErrorPolicyGuard,
useDataProvider,
} from '@vegaprotocol/data-provider';
import type {
MarketsQuery,
MarketFieldsFragment,
import {
MarketsDocument,
type MarketsQuery,
type MarketFieldsFragment,
} from './__generated__/markets';
import type { MarketsCandlesQueryVariables } from './__generated__/markets-candles';
import { type MarketsCandlesQueryVariables } from './__generated__/markets-candles';
import {
marketsDataProvider,
marketsLiveDataProvider,
mapMarketDataUpdateToMarketData,
} from './markets-data-provider';
import { marketDataProvider } from './market-data-provider';
import { marketsCandlesProvider } from './markets-candles-provider';
import type { MarketData } from './market-data-provider';
import type { MarketDataUpdateFieldsFragment } from './__generated__';
import type { MarketCandles } from './markets-candles-provider';
import { marketDataProvider, type MarketData } from './market-data-provider';
import { type MarketDataUpdateFieldsFragment } from './__generated__';
import {
marketsCandlesProvider,
type MarketCandles,
} from './markets-candles-provider';
import { useMemo } from 'react';
import * as Schema from '@vegaprotocol/types';
import {
filterAndSortClosedMarkets,
filterAndSortMarkets,
} from './market-utils';
import { MarketsDocument } from './__generated__/markets';
import type { Candle } from './market-candles-provider';
export type Market = MarketFieldsFragment;

View File

@ -5,20 +5,21 @@ import {
makeDerivedDataProvider,
defaultAppend as append,
} from '@vegaprotocol/data-provider';
import type { Market } from '@vegaprotocol/markets';
import { type Market } 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 type {
OrderFieldsFragment,
OrderUpdateFieldsFragment,
OrdersQuery,
OrdersUpdateSubscription,
OrdersQueryVariables,
OrdersUpdateSubscriptionVariables,
import {
OrdersDocument,
OrdersUpdateDocument,
type OrderFieldsFragment,
type OrdersQuery,
type OrdersUpdateSubscription,
type OrdersQueryVariables,
type OrdersUpdateSubscriptionVariables,
type OrderUpdateFieldsFragment,
} 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'> & {
market?: Market;

View File

@ -2,14 +2,14 @@ import {
makeDataProvider,
makeDerivedDataProvider,
} from '@vegaprotocol/data-provider';
import type { Market } from '@vegaprotocol/markets';
import { type Market } from '@vegaprotocol/markets';
import { marketsMapProvider } from '@vegaprotocol/markets';
import type {
StopOrderFieldsFragment,
StopOrdersQuery,
StopOrdersQueryVariables,
import {
StopOrdersDocument,
type StopOrdersQuery,
type StopOrdersQueryVariables,
type StopOrderFieldsFragment,
} from './__generated__/Orders';
import { StopOrdersDocument } from './__generated__/Orders';
export type StopOrder = StopOrderFieldsFragment & {
market: Market;

View File

@ -1,18 +1,17 @@
import { t } from '@vegaprotocol/i18n';
import { useCallback, useRef, useState, useEffect } from 'react';
import type { AgGridReact } from 'ag-grid-react';
import { OrderListTable } from '../order-list';
import type { useDataGridEvents } from '@vegaprotocol/datagrid';
import { Pagination } from '@vegaprotocol/datagrid';
import { type AgGridReact } from 'ag-grid-react';
import { Pagination, type useDataGridEvents } from '@vegaprotocol/datagrid';
import { Splash } from '@vegaprotocol/ui-toolkit';
import { useDataProvider } from '@vegaprotocol/data-provider';
import { ordersWithMarketProvider } from '../order-data-provider/order-data-provider';
import { normalizeOrderAmendment } from '@vegaprotocol/wallet';
import { useVegaTransactionStore } from '@vegaprotocol/web3';
import type { OrderTxUpdateFieldsFragment } from '@vegaprotocol/web3';
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 { Splash } from '@vegaprotocol/ui-toolkit';
import { OrderListTable } from '../order-list';
import { ordersWithMarketProvider } from '../order-data-provider/order-data-provider';
export enum Filter {
'Open' = 'Open',
@ -91,7 +90,7 @@ export const OrderListManager = ({
return (
<>
<div className="relative flex flex-col h-full">
<div className="relative flex h-full flex-col">
<OrderListTable
rowData={data}
ref={gridRef}

View File

@ -3,7 +3,7 @@ import { OrderListTable } from './order-list';
import { useState } from 'react';
import { generateOrdersArray } from '../mocks';
import { OrderEditDialog } from './order-edit-dialog';
import type { Order } from '../order-data-provider';
import { type Order } from '../order-data-provider';
export default {
component: OrderListTable,

View File

@ -1,3 +1,4 @@
import { memo, forwardRef, useMemo, type ForwardedRef } from 'react';
import {
MAXGOINT64,
addDecimalsFormatNumber,
@ -15,8 +16,6 @@ import {
VegaIcon,
VegaIconNames,
} from '@vegaprotocol/ui-toolkit';
import type { ForwardedRef } from 'react';
import { memo, forwardRef, useMemo } from 'react';
import {
AgGrid,
SetFilter,
@ -26,17 +25,15 @@ import {
MarketNameCell,
OrderTypeCell,
COL_DEFS,
type TypedDataAgGrid,
type VegaICellRendererParams,
type VegaValueFormatterParams,
type VegaValueGetterParams,
} from '@vegaprotocol/datagrid';
import type {
TypedDataAgGrid,
VegaICellRendererParams,
VegaValueFormatterParams,
VegaValueGetterParams,
} from '@vegaprotocol/datagrid';
import type { AgGridReact } from 'ag-grid-react';
import type { Order } from '../order-data-provider';
import { AgGridReact } from 'ag-grid-react';
import { type Order } from '../order-data-provider';
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 = {
resizable: true,

View File

@ -1,12 +1,15 @@
import { t } from '@vegaprotocol/i18n';
import { useCallback, useEffect, useState } from 'react';
import { StopOrdersTable } from '../stop-orders-table/stop-orders-table';
import type { useDataGridEvents } from '@vegaprotocol/datagrid';
import type { StopOrder } from '../order-data-provider/stop-orders-data-provider';
import { type useDataGridEvents } from '@vegaprotocol/datagrid';
import { type StopOrder } from '../order-data-provider/stop-orders-data-provider';
import { useDataProvider } from '@vegaprotocol/data-provider';
import { stopOrdersWithMarketProvider } from '../order-data-provider/stop-orders-data-provider';
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';
export interface StopOrdersManagerProps {

View File

@ -2,34 +2,35 @@ import isEqual from 'lodash/isEqual';
import produce from 'immer';
import BigNumber from 'bignumber.js';
import sortBy from 'lodash/sortBy';
import type { Account } from '@vegaprotocol/accounts';
import { type Account } from '@vegaprotocol/accounts';
import { accountsDataProvider } from '@vegaprotocol/accounts';
import { toBigNum, removePaginationWrapper } from '@vegaprotocol/utils';
import {
makeDataProvider,
makeDerivedDataProvider,
} from '@vegaprotocol/data-provider';
import * as Schema from '@vegaprotocol/types';
import type {
MarketMaybeWithData,
MarketDataQueryVariables,
} from '@vegaprotocol/markets';
import {
type MarketMaybeWithData,
type MarketDataQueryVariables,
allMarketsWithLiveDataProvider,
getAsset,
} from '@vegaprotocol/markets';
import type {
PositionsQuery,
PositionFieldsFragment,
PositionsSubscriptionSubscription,
PositionsQueryVariables,
PositionsSubscriptionSubscriptionVariables,
} from './__generated__/Positions';
import {
PositionsDocument,
PositionsSubscriptionDocument,
type PositionsQuery,
type PositionFieldsFragment,
type PositionsSubscriptionSubscription,
type PositionsQueryVariables,
type PositionsSubscriptionSubscriptionVariables,
} 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 {
assetId: string;
@ -43,8 +44,8 @@ export interface Position {
marketDecimalPlaces: number;
marketId: string;
marketCode: string;
marketTradingMode: Schema.MarketTradingMode;
marketState: Schema.MarketState;
marketTradingMode: MarketTradingMode;
marketState: MarketState;
markPrice: string | undefined;
notional: string | undefined;
openVolume: string;
@ -81,7 +82,7 @@ export const getMetrics = (
const generalAccount = accounts?.find(
(account) =>
account.asset.id === asset.id &&
account.type === Schema.AccountType.ACCOUNT_TYPE_GENERAL
account.type === AccountType.ACCOUNT_TYPE_GENERAL
);
const { positionDecimalPlaces, decimalPlaces: marketDecimalPlaces } =
@ -263,9 +264,9 @@ export const preparePositions = (metrics: Position[], showClosed: boolean) => {
if (
[
Schema.MarketState.STATE_ACTIVE,
Schema.MarketState.STATE_PENDING,
Schema.MarketState.STATE_SUSPENDED,
MarketState.STATE_ACTIVE,
MarketState.STATE_PENDING,
MarketState.STATE_SUSPENDED,
].includes(p.marketState)
) {
return true;

View File

@ -1,12 +1,5 @@
import { useMemo } from 'react';
import type { CSSProperties, ReactNode } from 'react';
import type { ColDef, ITooltipParams } from 'ag-grid-community';
import type {
VegaValueFormatterParams,
VegaValueGetterParams,
TypedDataAgGrid,
VegaICellRendererParams,
} from '@vegaprotocol/datagrid';
import { useMemo, type CSSProperties, type ReactNode } from 'react';
import { type ColDef, type ITooltipParams } from 'ag-grid-community';
import {
AgGrid,
COL_DEFS,
@ -16,6 +9,10 @@ import {
ProgressBarCell,
MarketProductPill,
StackedCell,
type VegaValueFormatterParams,
type VegaValueGetterParams,
type TypedDataAgGrid,
type VegaICellRendererParams,
} from '@vegaprotocol/datagrid';
import {
ButtonLink,
@ -32,7 +29,7 @@ import {
addDecimalsFormatNumberQuantum,
} from '@vegaprotocol/utils';
import { t } from '@vegaprotocol/i18n';
import type { Position } from './positions-data-providers';
import { type Position } from './positions-data-providers';
import {
MarketTradingMode,
PositionStatus,
@ -557,7 +554,7 @@ const WarningCell = ({
<VegaIcon name={VegaIconNames.EXCLAIMATION_MARK} size={12} />
</span>
)}
<span className="overflow-hidden whitespace-nowrap text-ellipsis">
<span className="overflow-hidden text-ellipsis whitespace-nowrap">
{children}
</span>
</div>

View File

@ -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 produce from 'immer';
import * as Types from '@vegaprotocol/types';
import type {
ProposalsListQuery,
ProposalsListQueryVariables,
ProposalListFieldsFragment,
MarketViewLiveProposalsSubscription,
MarketViewProposalFieldsFragment,
MarketViewProposalsQuery,
MarketViewProposalsQueryVariables,
MarketViewLiveProposalsSubscriptionVariables,
} from './__generated__/Proposals';
import {
MarketViewLiveProposalsDocument,
MarketViewProposalsDocument,
ProposalsListDocument,
type ProposalsListQuery,
type ProposalsListQueryVariables,
type ProposalListFieldsFragment,
type MarketViewLiveProposalsSubscription,
type MarketViewProposalFieldsFragment,
type MarketViewProposalsQuery,
type MarketViewProposalsQueryVariables,
type MarketViewLiveProposalsSubscriptionVariables,
} from './__generated__/Proposals';
import { removePaginationWrapper } from '@vegaprotocol/utils';

View File

@ -1,13 +1,13 @@
import { useApolloClient } from '@apollo/client';
import { useCallback, useEffect, useRef } from 'react';
import { ProposalEventDocument } from './__generated__/Proposal';
import type {
ProposalEventSubscriptionVariables,
ProposalEventSubscription,
ProposalEventFieldsFragment,
import {
ProposalEventDocument,
type ProposalEventSubscriptionVariables,
type ProposalEventSubscription,
type ProposalEventFieldsFragment,
} from './__generated__/Proposal';
import type { Subscription } from 'zen-observable-ts';
import type { VegaTxState } from '../proposals-hooks/use-vega-transaction';
import { type Subscription } from 'zen-observable-ts';
import { type VegaTxState } from '../proposals-hooks/use-vega-transaction';
export const useProposalEvent = (transaction: VegaTxState) => {
const client = useApolloClient();

View File

@ -3,8 +3,8 @@ import * as Sentry from '@sentry/react';
import { useVegaWallet, determineId } from '@vegaprotocol/wallet';
import { useVegaTransaction } from './use-vega-transaction';
import { useProposalEvent } from './use-proposal-event';
import type { ProposalSubmission } from '@vegaprotocol/wallet';
import type { ProposalEventFieldsFragment } from './__generated__/Proposal';
import { type ProposalSubmission } from '@vegaprotocol/wallet';
import { type ProposalEventFieldsFragment } from './__generated__/Proposal';
export const useProposalSubmit = () => {
const { pubKey } = useVegaWallet();

View File

@ -2,8 +2,10 @@ import { createClient } from '@vegaprotocol/apollo-client';
import { useEnvironment } from '@vegaprotocol/environment';
import { useBlockInfo } from '@vegaprotocol/tendermint';
import { useEffect, useMemo, useState } from 'react';
import type { BlockStatisticsQuery } from './__generated__/BlockStatistics';
import { BlockStatisticsDocument } from './__generated__/BlockStatistics';
import {
BlockStatisticsDocument,
type BlockStatisticsQuery,
} from './__generated__/BlockStatistics';
import compact from 'lodash/compact';
import max from 'lodash/max';

View File

@ -1,12 +1,12 @@
import { useApolloClient } from '@apollo/client';
import { useCallback, useEffect, useRef } from 'react';
import { VoteEventDocument } from './__generated__/VoteSubsciption';
import type { Subscription } from 'zen-observable-ts';
import type { VegaTxState } from '../proposals-hooks/use-vega-transaction';
import type {
VoteEventFieldsFragment,
VoteEventSubscription,
VoteEventSubscriptionVariables,
import { type Subscription } from 'zen-observable-ts';
import { type VegaTxState } from '../proposals-hooks/use-vega-transaction';
import {
VoteEventDocument,
type VoteEventSubscription,
type VoteEventSubscriptionVariables,
type VoteEventFieldsFragment,
} from './__generated__/VoteSubsciption';
export const useVoteEvent = (transaction: VegaTxState) => {

View File

@ -1,6 +1,6 @@
import { useEnvironment } from '@vegaprotocol/environment';
import { useFetch } from '@vegaprotocol/react-helpers';
import type { TendermintBlockResponse } from '../types';
import { type TendermintBlockResponse } from '../types';
export const useBlockInfo = (blockHeight?: number, canFetch = true) => {
const { TENDERMINT_URL } = useEnvironment();

Some files were not shown because too many files have changed in this diff Show More