Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6636509099 | ||
|
|
40b3caa56b |
@@ -2,7 +2,7 @@
|
||||
NX_CHAIN_EXPLORER_URL=https://explorer.vega.trading/.netlify/functions/chain-explorer-api
|
||||
NX_TENDERMINT_URL=https://mainnet-observer-proxy01.ops.vega.xyz/
|
||||
NX_TENDERMINT_WEBSOCKET_URL=wss://mainnet-observer-proxy01.ops.vega.xyz/websocket
|
||||
NX_VEGA_URL=https://api.vega.community/graphql
|
||||
NX_VEGA_URL=https://api.vega.xyz/query
|
||||
NX_VEGA_ENV=MAINNET
|
||||
NX_BLOCK_EXPLORER=https://be.explorer.vega.xyz/rest
|
||||
|
||||
|
||||
+2
-2
@@ -4,14 +4,14 @@ NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
|
||||
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet1/vegawallet-stagnet1.toml
|
||||
NX_VEGA_ENV=STAGNET1
|
||||
NX_VEGA_EXPLORER_URL=https://stagnet1.explorer.vega.xyz
|
||||
NX_VEGA_TOKEN_URL=https://stagnet1.governance.vega.xyz
|
||||
NX_VEGA_TOKEN_URL=https://stagnet1.token.vega.xyz
|
||||
NX_VEGA_WALLET_URL=http://localhost:1789
|
||||
NX_TENDERMINT_URL=https://tm.n01.stagnet1.vega.xyz
|
||||
NX_TENDERMINT_WEBSOCKET_URL=wss://tm.n01.stagnet1.vega.xyz/websocket
|
||||
NX_BLOCK_EXPLORER=https://be.stagnet1.vega.xyz/rest
|
||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||
NX_ORACLE_PROOFS_URL=https://raw.githubusercontent.com/vegaprotocol/well-known/main/__generated__/oracle-proofs.json
|
||||
NX_VEGA_GOVERNANCE_URL=https://stagnet1.governance.vega.xyz
|
||||
NX_VEGA_GOVERNANCE_URL=https://stagnet1.token.vega.xyz
|
||||
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.jsoo
|
||||
|
||||
# App flags
|
||||
|
||||
@@ -4,7 +4,6 @@ NX_TENDERMINT_WEBSOCKET_URL=wss://localhost:26617/websocket
|
||||
NX_VEGA_ENV=CUSTOM
|
||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/test/announcements.json
|
||||
NX_VEGA_EXPLORER_URL=/
|
||||
|
||||
# App flags
|
||||
NX_EXPLORER_TXS_LIST=0
|
||||
|
||||
@@ -5,8 +5,7 @@ NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-inter
|
||||
NX_VEGA_ENV=DEVNET
|
||||
NX_BLOCK_EXPLORER=https://be.devnet1.vega.xyz/rest
|
||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||
NX_VEGA_GOVERNANCE_URL=https://dev.governance.vega.xyz
|
||||
NX_VEGA_GOVERNANCE_URL=https://dev.token.vega.xyz
|
||||
NX_VEGA_URL=https://api.devnet1.vega.xyz/graphql
|
||||
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/devnet1/vegawallet-devnet1.toml
|
||||
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json
|
||||
NX_VEGA_EXPLORER_URL=/
|
||||
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json
|
||||
@@ -1,10 +1,9 @@
|
||||
# App configuration variables
|
||||
NX_TENDERMINT_URL=https://be.vega.community
|
||||
NX_TENDERMINT_WEBSOCKET_URL=wss://be.vega.community/websocket
|
||||
NX_TENDERMINT_URL=https://be.explorer.vega.xyz
|
||||
NX_TENDERMINT_WEBSOCKET_URL=wss://be.explorer.vega.xyz/websocket
|
||||
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks/master/mainnet1/mainnet1.toml
|
||||
NX_VEGA_ENV=MAINNET
|
||||
NX_BLOCK_EXPLORER=https://be.vega.community/rest/
|
||||
NX_BLOCK_EXPLORER=https://be.explorer.vega.xyz/rest/
|
||||
NX_ETHERSCAN_URL=https://etherscan.io
|
||||
NX_VEGA_GOVERNANCE_URL=https://governance.vega.xyz
|
||||
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/mainnet/announcements.json
|
||||
NX_VEGA_EXPLORER_URL=https://explorer.vega.xyz/
|
||||
NX_VEGA_GOVERNANCE_URL=https://token.vega.xyz
|
||||
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/mainnet/announcements.json
|
||||
@@ -7,6 +7,5 @@ NX_VEGA_ENV=TESTNET
|
||||
NX_VEGA_URL=https://api.n07.testnet.vega.xyz/graphql
|
||||
NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
|
||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||
NX_VEGA_GOVERNANCE_URL=https://governance.fairground.wtf
|
||||
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json
|
||||
NX_VEGA_EXPLORER_URL=https://explorer.fairground.wtf
|
||||
NX_VEGA_GOVERNANCE_URL=https://token.fairground.wtf
|
||||
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json
|
||||
@@ -11,4 +11,3 @@ NX_VEGA_GOVERNANCE_URL=https://validator-testnet.governance.vega.xyz
|
||||
NX_TENDERMINT_URL=https://tm-be.validators-testnet.vega.rocks
|
||||
NX_BLOCK_EXPLORER=https://be.validators-testnet.vega.rocks/rest
|
||||
NX_TENDERMINT_WEBSOCKET_URL=wss://be.validators-testnet.vega.xyz/websocket
|
||||
NX_VEGA_EXPLORER_URL=https://validator-testnet.explorer.vega.xyz/
|
||||
@@ -5,4 +5,3 @@ NX_VEGA_ENV=CUSTOM
|
||||
NX_BLOCK_EXPLORER=
|
||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/test/announcements.json
|
||||
NX_VEGA_EXPLORER_URL=/
|
||||
@@ -6,7 +6,6 @@ export type AssetBalanceProps = {
|
||||
assetId: string;
|
||||
price: string;
|
||||
showAssetLink?: boolean;
|
||||
showAssetSymbol?: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -17,21 +16,18 @@ const AssetBalance = ({
|
||||
assetId,
|
||||
price,
|
||||
showAssetLink = true,
|
||||
showAssetSymbol = false,
|
||||
}: AssetBalanceProps) => {
|
||||
const { data: asset, loading } = useAssetDataProvider(assetId);
|
||||
const { data: asset } = useAssetDataProvider(assetId);
|
||||
|
||||
const label =
|
||||
!loading && asset && asset.decimals
|
||||
asset && asset.decimals
|
||||
? addDecimalsFormatNumber(price, asset.decimals)
|
||||
: price;
|
||||
|
||||
return (
|
||||
<div className="inline-block">
|
||||
<span>{label}</span>{' '}
|
||||
{showAssetLink && asset?.id ? (
|
||||
<AssetLink showAssetSymbol={showAssetSymbol} assetId={assetId} />
|
||||
) : null}
|
||||
{showAssetLink && asset?.id ? <AssetLink assetId={assetId} /> : null}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -13,17 +13,11 @@ const DEFAULT_DECIMALS = 18;
|
||||
* the governance asset first, which is set by a network parameter
|
||||
*/
|
||||
const GovernanceAssetBalance = ({ price }: GovernanceAssetBalanceProps) => {
|
||||
const { data, loading } = useExplorerGovernanceAssetQuery();
|
||||
const { data } = useExplorerGovernanceAssetQuery();
|
||||
|
||||
if (!loading && data && data.networkParameter?.value) {
|
||||
if (data && data.networkParameter?.value) {
|
||||
const governanceAssetId = data.networkParameter.value;
|
||||
return (
|
||||
<AssetBalance
|
||||
price={price}
|
||||
showAssetSymbol={true}
|
||||
assetId={governanceAssetId}
|
||||
/>
|
||||
);
|
||||
return <AssetBalance price={price} assetId={governanceAssetId} />;
|
||||
} else {
|
||||
return (
|
||||
<div className="inline-block">
|
||||
|
||||
@@ -20,7 +20,7 @@ export const PageHeader = ({
|
||||
copy = false,
|
||||
className,
|
||||
}: PageHeaderProps) => {
|
||||
const titleClasses = 'text-xl uppercase font-alpha calt';
|
||||
const titleClasses = 'text-4xl xl:text-5xl uppercase font-alpha calt';
|
||||
return (
|
||||
<header className={className}>
|
||||
<span className={`${titleClasses} block`}>{prefix}</span>
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ export const BundleExists = ({
|
||||
// Note if this is wrong, the wrong decoder will be used which will give incorrect data
|
||||
|
||||
return (
|
||||
<div className="w-auto h-10 max-w-lg border-2 border-solid border-vega-light-100 dark:border-vega-dark-200 p-5 mt-5">
|
||||
<div className="w-auto max-w-lg border-2 border-solid border-vega-light-100 dark:border-vega-dark-200 p-5 mt-5">
|
||||
<IconForBundleStatus status={status} />
|
||||
<h1 className="text-xl pb-1">
|
||||
{status === 'STATUS_ENABLED'
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export { TxList } from './tx-list';
|
||||
export { TxOrderType } from './tx-order-type';
|
||||
export { TxsInfiniteList } from './txs-infinite-list';
|
||||
export { TxsInfiniteListItem } from './txs-infinite-list-item';
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
import type { TendermintUnconfirmedTransactionsResponse } from '../../routes/txs/tendermint-unconfirmed-transactions-response.d';
|
||||
|
||||
interface TxsProps {
|
||||
data: TendermintUnconfirmedTransactionsResponse | undefined;
|
||||
}
|
||||
|
||||
export const TxList = ({ data }: TxsProps) => {
|
||||
if (!data) {
|
||||
return <div>{t('Awaiting transactions')}</div>;
|
||||
}
|
||||
|
||||
return <div>{JSON.stringify(data, null, ' ')}</div>;
|
||||
};
|
||||
@@ -7,7 +7,7 @@ import { toHex } from '../search/detect-search';
|
||||
import { ChainResponseCode } from './details/chain-response-code/chain-reponse.code';
|
||||
import isNumber from 'lodash/isNumber';
|
||||
|
||||
const TRUNCATE_LENGTH = 10;
|
||||
const TRUNCATE_LENGTH = 5;
|
||||
|
||||
export const TxsInfiniteListItem = ({
|
||||
hash,
|
||||
@@ -34,10 +34,10 @@ export const TxsInfiniteListItem = ({
|
||||
className="flex items-center h-full border-t border-neutral-600 dark:border-neutral-800 txs-infinite-list-item grid grid-cols-10 py-2"
|
||||
>
|
||||
<div
|
||||
className="text-sm col-span-10 md:col-span-3 leading-none"
|
||||
className="text-sm col-span-10 xl:col-span-3 leading-none"
|
||||
data-testid="tx-hash"
|
||||
>
|
||||
<span className="md:hidden uppercase text-vega-dark-300">
|
||||
<span className="xl:hidden uppercase text-vega-dark-300">
|
||||
ID:
|
||||
</span>
|
||||
<TruncatedLink
|
||||
@@ -48,10 +48,10 @@ export const TxsInfiniteListItem = ({
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
className="text-sm col-span-10 md:col-span-3 leading-none"
|
||||
className="text-sm col-span-10 xl:col-span-3 leading-none"
|
||||
data-testid="pub-key"
|
||||
>
|
||||
<span className="md:hidden uppercase text-vega-dark-300">
|
||||
<span className="xl:hidden uppercase text-vega-dark-300">
|
||||
By:
|
||||
</span>
|
||||
<TruncatedLink
|
||||
@@ -61,14 +61,14 @@ export const TxsInfiniteListItem = ({
|
||||
endChars={TRUNCATE_LENGTH}
|
||||
/>
|
||||
</div>
|
||||
<div className="text-sm col-span-5 md:col-span-2 leading-none flex items-center">
|
||||
<div className="text-sm col-span-5 xl:col-span-2 leading-none flex items-center">
|
||||
<TxOrderType orderType={type} command={command} />
|
||||
</div>
|
||||
<div
|
||||
className="text-sm col-span-3 md:col-span-1 leading-none flex items-center"
|
||||
className="text-sm col-span-3 xl:col-span-1 leading-none flex items-center"
|
||||
data-testid="tx-block"
|
||||
>
|
||||
<span className="md:hidden uppercase text-vega-dark-300">
|
||||
<span className="xl:hidden uppercase text-vega-dark-300">
|
||||
Block:
|
||||
</span>
|
||||
<TruncatedLink
|
||||
@@ -79,10 +79,10 @@ export const TxsInfiniteListItem = ({
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
className="text-sm col-span-2 md:col-span-1 leading-none flex items-center"
|
||||
className="text-sm col-span-2 xl:col-span-1 leading-none flex items-center"
|
||||
data-testid="tx-success"
|
||||
>
|
||||
<span className="md:hidden uppercase text-vega-dark-300">
|
||||
<span className="xl:hidden uppercase text-vega-dark-300">
|
||||
Success:
|
||||
</span>
|
||||
{isNumber(code) ? (
|
||||
|
||||
@@ -64,7 +64,9 @@ describe('Txs infinite list', () => {
|
||||
error={Error('test error!')}
|
||||
/>
|
||||
);
|
||||
expect(screen.getByText('Cannot fetch transaction')).toBeInTheDocument();
|
||||
expect(
|
||||
screen.getByText('Cannot fetch transaction: Error: test error!')
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('item renders data of n length into list of n length', () => {
|
||||
|
||||
@@ -30,7 +30,7 @@ const NOOP = () => {};
|
||||
const Item = ({ index, style, isLoading, error }: ItemProps) => {
|
||||
let content;
|
||||
if (error) {
|
||||
content = t(`Cannot fetch transaction`);
|
||||
content = t(`Cannot fetch transaction: ${error}`);
|
||||
} else if (isLoading) {
|
||||
content = <Loader />;
|
||||
} else {
|
||||
@@ -68,7 +68,7 @@ export const TxsInfiniteList = ({
|
||||
className,
|
||||
}: TxsInfiniteListProps) => {
|
||||
const { screenSize } = useScreenDimensions();
|
||||
const isStacked = ['xs', 'sm'].includes(screenSize);
|
||||
const isStacked = ['xs', 'sm', 'md', 'lg'].includes(screenSize);
|
||||
|
||||
if (!txs) {
|
||||
if (!areTxsLoading) {
|
||||
@@ -95,15 +95,15 @@ export const TxsInfiniteList = ({
|
||||
|
||||
return (
|
||||
<div className={className} data-testid="transactions-list">
|
||||
<div className="lg:grid grid-cols-10 w-full mb-3 hidden text-vega-dark-300 uppercase">
|
||||
<div className="xl:grid grid-cols-10 w-full mb-3 hidden text-vega-dark-300 uppercase">
|
||||
<div className="col-span-3">
|
||||
<span className="hidden xl:inline">{t('Transaction')} </span>
|
||||
<span className="hidden xl:inline">Transaction </span>
|
||||
<span>ID</span>
|
||||
</div>
|
||||
<div className="col-span-3">{t('Submitted By')}</div>
|
||||
<div className="col-span-2">{t('Type')}</div>
|
||||
<div className="col-span-1">{t('Block')}</div>
|
||||
<div className="col-span-1">{t('Success')}</div>
|
||||
<div className="col-span-3">Submitted By</div>
|
||||
<div className="col-span-2">Type</div>
|
||||
<div className="col-span-1">Block</div>
|
||||
<div className="col-span-1">Success</div>
|
||||
</div>
|
||||
<div data-testid="infinite-scroll-wrapper">
|
||||
<InfiniteLoader
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Routes } from '../../routes/route-names';
|
||||
import { RenderFetched } from '../render-fetched';
|
||||
import { TruncatedLink } from '../truncate/truncated-link';
|
||||
import { TxOrderType } from './tx-order-type';
|
||||
import { Table, TableRow, TableCell } from '../table';
|
||||
@@ -8,7 +9,7 @@ import type { BlockExplorerTransactions } from '../../routes/types/block-explore
|
||||
import isNumber from 'lodash/isNumber';
|
||||
import { ChainResponseCode } from './details/chain-response-code/chain-reponse.code';
|
||||
import { getTxsDataUrl } from '../../hooks/use-txs-data';
|
||||
import { AsyncRenderer, Loader } from '@vegaprotocol/ui-toolkit';
|
||||
import { Loader } from '@vegaprotocol/ui-toolkit';
|
||||
import EmptyList from '../empty-list/empty-list';
|
||||
|
||||
interface TxsPerBlockProps {
|
||||
@@ -26,7 +27,7 @@ export const TxsPerBlock = ({ blockHeight, txCount }: TxsPerBlockProps) => {
|
||||
} = useFetch<BlockExplorerTransactions>(url);
|
||||
|
||||
return (
|
||||
<AsyncRenderer data={data} error={error} loading={!!loading}>
|
||||
<RenderFetched error={error} loading={loading} className="text-body-large">
|
||||
{data && data.transactions.length > 0 ? (
|
||||
<div className="overflow-x-auto whitespace-nowrap mb-28">
|
||||
<Table>
|
||||
@@ -94,6 +95,6 @@ export const TxsPerBlock = ({ blockHeight, txCount }: TxsPerBlockProps) => {
|
||||
label={t('0 transactions')}
|
||||
/>
|
||||
)}
|
||||
</AsyncRenderer>
|
||||
</RenderFetched>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -144,12 +144,12 @@ afterEach(() => {
|
||||
describe('Block', () => {
|
||||
it('renders error state if error is present', async () => {
|
||||
(useFetch as jest.Mock).mockReturnValue({
|
||||
state: { data: null, loading: false, error: new Error('asd') },
|
||||
state: { data: null, loading: false, error: 'asd' },
|
||||
});
|
||||
render(renderComponent());
|
||||
|
||||
expect(screen.getByText(`BLOCK ${blockId}`)).toBeInTheDocument();
|
||||
expect(screen.getByText('Something went wrong: asd')).toBeInTheDocument();
|
||||
expect(screen.getByText('Error retrieving data')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('renders loading state if present', async () => {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import React from 'react';
|
||||
import { Link, useParams } from 'react-router-dom';
|
||||
import { DATA_SOURCES } from '../../../config';
|
||||
import { getDateTimeFormat } from '@vegaprotocol/utils';
|
||||
@@ -11,8 +12,9 @@ import {
|
||||
TableCell,
|
||||
} from '../../../components/table';
|
||||
import { TxsPerBlock } from '../../../components/txs/txs-per-block';
|
||||
import { AsyncRenderer, Button } from '@vegaprotocol/ui-toolkit';
|
||||
import { Button } from '@vegaprotocol/ui-toolkit';
|
||||
import { Routes } from '../../route-names';
|
||||
import { RenderFetched } from '../../../components/render-fetched';
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
import { useFetch } from '@vegaprotocol/react-helpers';
|
||||
import { NodeLink } from '../../../components/links';
|
||||
@@ -32,7 +34,7 @@ const Block = () => {
|
||||
return (
|
||||
<section>
|
||||
<RouteTitle data-testid="block-header">{t(`BLOCK ${block}`)}</RouteTitle>
|
||||
<AsyncRenderer data={blockData} error={error} loading={!!loading}>
|
||||
<RenderFetched error={error} loading={loading}>
|
||||
<>
|
||||
<div className="grid grid-cols-2 gap-2 mb-8">
|
||||
<Link
|
||||
@@ -121,7 +123,7 @@ const Block = () => {
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
</AsyncRenderer>
|
||||
</RenderFetched>
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
import { useFetch } from '@vegaprotocol/react-helpers';
|
||||
import { RouteTitle } from '../../components/route-title';
|
||||
import { AsyncRenderer, SyntaxHighlighter } from '@vegaprotocol/ui-toolkit';
|
||||
import { Loader, SyntaxHighlighter } from '@vegaprotocol/ui-toolkit';
|
||||
import { DATA_SOURCES } from '../../config';
|
||||
import type { TendermintGenesisResponse } from './tendermint-genesis-response';
|
||||
import { useDocumentTitle } from '../../hooks/use-document-title';
|
||||
@@ -10,26 +10,21 @@ const Genesis = () => {
|
||||
useDocumentTitle(['Genesis']);
|
||||
|
||||
const {
|
||||
state: { data, loading, error },
|
||||
state: { data: genesis, loading },
|
||||
} = useFetch<TendermintGenesisResponse>(
|
||||
`${DATA_SOURCES.tendermintUrl}/genesis`
|
||||
);
|
||||
|
||||
if (!genesis?.result.genesis) {
|
||||
if (loading) {
|
||||
return <Loader />;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<>
|
||||
<section>
|
||||
<RouteTitle data-testid="genesis-header">{t('Genesis')}</RouteTitle>
|
||||
<AsyncRenderer
|
||||
data={data}
|
||||
error={error}
|
||||
loading={!!loading}
|
||||
loadingMessage={t('Loading genesis information...')}
|
||||
errorMessage={t('Could not fetch genesis data')}
|
||||
>
|
||||
<section>
|
||||
<SyntaxHighlighter data={data?.result.genesis} />
|
||||
</section>
|
||||
</AsyncRenderer>
|
||||
</>
|
||||
<SyntaxHighlighter data={genesis?.result.genesis} />
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -49,7 +49,6 @@ export const MarketPage = () => {
|
||||
/>
|
||||
<AsyncRenderer
|
||||
noDataMessage={t('This chain has no markets')}
|
||||
errorMessage={t('Could not fetch market') + ' ' + marketId}
|
||||
data={data}
|
||||
loading={loading}
|
||||
error={error}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { AsyncRenderer, SyntaxHighlighter } from '@vegaprotocol/ui-toolkit';
|
||||
import { Loader, SyntaxHighlighter } from '@vegaprotocol/ui-toolkit';
|
||||
import { RouteTitle } from '../../../components/route-title';
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
import { useExplorerOracleSpecsQuery } from '../__generated__/Oracles';
|
||||
@@ -8,7 +8,7 @@ import { useScrollToLocation } from '../../../hooks/scroll-to-location';
|
||||
import filter from 'recursive-key-filter';
|
||||
|
||||
const Oracles = () => {
|
||||
const { data, loading, error } = useExplorerOracleSpecsQuery();
|
||||
const { data, loading } = useExplorerOracleSpecsQuery();
|
||||
|
||||
useDocumentTitle(['Oracles']);
|
||||
useScrollToLocation();
|
||||
@@ -16,40 +16,28 @@ const Oracles = () => {
|
||||
return (
|
||||
<section>
|
||||
<RouteTitle data-testid="oracle-specs-heading">{t('Oracles')}</RouteTitle>
|
||||
<AsyncRenderer
|
||||
data={data}
|
||||
loading={loading}
|
||||
error={error}
|
||||
loadingMessage={t('Loading oracle data...')}
|
||||
errorMessage={t('Oracle data could not be loaded')}
|
||||
noDataMessage={t('No oracles found')}
|
||||
noDataCondition={(data) =>
|
||||
!data?.oracleSpecsConnection?.edges ||
|
||||
data.oracleSpecsConnection.edges?.length === 0
|
||||
}
|
||||
>
|
||||
{data?.oracleSpecsConnection?.edges
|
||||
? data.oracleSpecsConnection.edges.map((o) => {
|
||||
const id = o?.node.dataSourceSpec.spec.id;
|
||||
if (!id) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<div id={id} key={id} className="mb-10">
|
||||
<OracleDetails
|
||||
id={id}
|
||||
dataSource={o?.node}
|
||||
showBroadcasts={false}
|
||||
/>
|
||||
<details>
|
||||
<summary className="pointer">JSON</summary>
|
||||
<SyntaxHighlighter data={filter(o, ['__typename'])} />
|
||||
</details>
|
||||
</div>
|
||||
);
|
||||
})
|
||||
: null}
|
||||
</AsyncRenderer>
|
||||
{loading ? <Loader /> : null}
|
||||
{data?.oracleSpecsConnection?.edges
|
||||
? data.oracleSpecsConnection.edges.map((o) => {
|
||||
const id = o?.node.dataSourceSpec.spec.id;
|
||||
if (!id) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<div id={id} key={id} className="mb-10">
|
||||
<OracleDetails
|
||||
id={id}
|
||||
dataSource={o?.node}
|
||||
showBroadcasts={false}
|
||||
/>
|
||||
<details>
|
||||
<summary className="pointer">JSON</summary>
|
||||
<SyntaxHighlighter data={filter(o, ['__typename'])} />
|
||||
</details>
|
||||
</div>
|
||||
);
|
||||
})
|
||||
: null}
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { RouteTitle } from '../../../components/route-title';
|
||||
import { RenderFetched } from '../../../components/render-fetched';
|
||||
import { truncateByChars } from '@vegaprotocol/utils';
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
import { useDocumentTitle } from '../../../hooks/use-document-title';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { useExplorerOracleSpecByIdQuery } from '../__generated__/Oracles';
|
||||
import { OracleDetails } from '../components/oracle';
|
||||
import { AsyncRenderer, SyntaxHighlighter } from '@vegaprotocol/ui-toolkit';
|
||||
import { SyntaxHighlighter } from '@vegaprotocol/ui-toolkit';
|
||||
import filter from 'recursive-key-filter';
|
||||
import { TruncateInline } from '../../../components/truncate/truncate';
|
||||
|
||||
@@ -26,14 +27,7 @@ export const Oracle = () => {
|
||||
{t(`Oracle `)}
|
||||
<TruncateInline startChars={5} endChars={5} text={id || '1'} />
|
||||
</RouteTitle>
|
||||
<AsyncRenderer
|
||||
data={data}
|
||||
error={error}
|
||||
loading={loading}
|
||||
noDataCondition={(data) => !data?.oracleSpec}
|
||||
errorMessage={t('Could not load oracle data')}
|
||||
loadingMessage={t('Loading oracle data...')}
|
||||
>
|
||||
<RenderFetched error={error} loading={loading}>
|
||||
{data?.oracleSpec ? (
|
||||
<div id={id} key={id} className="mb-10">
|
||||
<OracleDetails
|
||||
@@ -50,7 +44,7 @@ export const Oracle = () => {
|
||||
) : (
|
||||
<span></span>
|
||||
)}
|
||||
</AsyncRenderer>
|
||||
</RenderFetched>
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -48,13 +48,6 @@ query ExplorerPartyAssets($partyId: ID!) {
|
||||
}
|
||||
stakingSummary {
|
||||
currentStakeAvailable
|
||||
linkings(pagination: { first: 100 }) {
|
||||
edges {
|
||||
node {
|
||||
amount
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
accountsConnection {
|
||||
edges {
|
||||
|
||||
@@ -10,7 +10,7 @@ export type ExplorerPartyAssetsQueryVariables = Types.Exact<{
|
||||
}>;
|
||||
|
||||
|
||||
export type ExplorerPartyAssetsQuery = { __typename?: 'Query', partiesConnection?: { __typename?: 'PartyConnection', edges: Array<{ __typename?: 'PartyEdge', node: { __typename?: 'Party', id: string, delegationsConnection?: { __typename?: 'DelegationsConnection', edges?: Array<{ __typename?: 'DelegationEdge', node: { __typename?: 'Delegation', amount: string, epoch: number, node: { __typename?: 'Node', id: string, name: string } } } | null> | null } | null, stakingSummary: { __typename?: 'StakingSummary', currentStakeAvailable: string, linkings: { __typename?: 'StakesConnection', edges?: Array<{ __typename?: 'StakeLinkingEdge', node: { __typename?: 'StakeLinking', amount: string } } | null> | null } }, accountsConnection?: { __typename?: 'AccountsConnection', edges?: Array<{ __typename?: 'AccountEdge', node: { __typename?: 'AccountBalance', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', name: string, id: string, decimals: number, symbol: string, source: { __typename: 'BuiltinAsset' } | { __typename: 'ERC20', contractAddress: string } }, market?: { __typename?: 'Market', id: string, decimalPlaces: number, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string, product: { __typename?: 'Future', quoteName: string } } } } | null } } | null> | null } | null } }> } | null };
|
||||
export type ExplorerPartyAssetsQuery = { __typename?: 'Query', partiesConnection?: { __typename?: 'PartyConnection', edges: Array<{ __typename?: 'PartyEdge', node: { __typename?: 'Party', id: string, delegationsConnection?: { __typename?: 'DelegationsConnection', edges?: Array<{ __typename?: 'DelegationEdge', node: { __typename?: 'Delegation', amount: string, epoch: number, node: { __typename?: 'Node', id: string, name: string } } } | null> | null } | null, stakingSummary: { __typename?: 'StakingSummary', currentStakeAvailable: string }, accountsConnection?: { __typename?: 'AccountsConnection', edges?: Array<{ __typename?: 'AccountEdge', node: { __typename?: 'AccountBalance', type: Types.AccountType, balance: string, asset: { __typename?: 'Asset', name: string, id: string, decimals: number, symbol: string, source: { __typename: 'BuiltinAsset' } | { __typename: 'ERC20', contractAddress: string } }, market?: { __typename?: 'Market', id: string, decimalPlaces: number, tradableInstrument: { __typename?: 'TradableInstrument', instrument: { __typename?: 'Instrument', name: string, product: { __typename?: 'Future', quoteName: string } } } } | null } } | null> | null } | null } }> } | null };
|
||||
|
||||
export const ExplorerPartyAssetsAccountsFragmentDoc = gql`
|
||||
fragment ExplorerPartyAssetsAccounts on AccountBalance {
|
||||
@@ -64,13 +64,6 @@ export const ExplorerPartyAssetsDocument = gql`
|
||||
}
|
||||
stakingSummary {
|
||||
currentStakeAvailable
|
||||
linkings(pagination: {first: 100}) {
|
||||
edges {
|
||||
node {
|
||||
amount
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
accountsConnection {
|
||||
edges {
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { toNonHex } from '../../../../components/search/detect-search';
|
||||
import { PageHeader } from '../../../../components/page-header';
|
||||
import { useDocumentTitle } from '../../../../hooks/use-document-title';
|
||||
|
||||
import { PartyAccounts } from '../components/party-accounts';
|
||||
|
||||
const PartyAccountsByAsset = () => {
|
||||
const { party } = useParams<{ party: string }>();
|
||||
|
||||
useDocumentTitle(['Public keys', party || '-']);
|
||||
const partyId = toNonHex(party ? party : '');
|
||||
|
||||
return (
|
||||
<section>
|
||||
<PageHeader title={t('Balances by asset')} />
|
||||
|
||||
<PartyAccounts partyId={partyId} />
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
export { PartyAccountsByAsset };
|
||||
@@ -1,9 +1,32 @@
|
||||
import { AccountManager } from '@vegaprotocol/accounts';
|
||||
import { useCallback } from 'react';
|
||||
import { useAssetDetailsDialogStore } from '@vegaprotocol/assets';
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
import get from 'lodash/get';
|
||||
import AssetBalance from '../../../../components/asset-balance/asset-balance';
|
||||
import { AssetLink, MarketLink } from '../../../../components/links';
|
||||
import { Table, TableRow } from '../../../../components/table';
|
||||
import type * as Schema from '@vegaprotocol/types';
|
||||
import type { ExplorerPartyAssetsAccountsFragment } from '../__generated__/Party-assets';
|
||||
|
||||
const accountTypeString: Record<Schema.AccountType, string> = {
|
||||
ACCOUNT_TYPE_BOND: t('Bond'),
|
||||
ACCOUNT_TYPE_EXTERNAL: t('External'),
|
||||
ACCOUNT_TYPE_FEES_INFRASTRUCTURE: t('Fees (Infrastructure)'),
|
||||
ACCOUNT_TYPE_FEES_LIQUIDITY: t('Fees (Liquidity)'),
|
||||
ACCOUNT_TYPE_FEES_MAKER: t('Fees (Maker)'),
|
||||
ACCOUNT_TYPE_GENERAL: t('General'),
|
||||
ACCOUNT_TYPE_GLOBAL_INSURANCE: t('Global Insurance Pool'),
|
||||
ACCOUNT_TYPE_GLOBAL_REWARD: t('Global Reward Pool'),
|
||||
ACCOUNT_TYPE_INSURANCE: t('Insurance'),
|
||||
ACCOUNT_TYPE_MARGIN: t('Margin'),
|
||||
ACCOUNT_TYPE_PENDING_TRANSFERS: t('Pending Transfers'),
|
||||
ACCOUNT_TYPE_REWARD_LP_RECEIVED_FEES: t('Reward - LP Fees received'),
|
||||
ACCOUNT_TYPE_REWARD_MAKER_PAID_FEES: t('Reward - Maker fees paid'),
|
||||
ACCOUNT_TYPE_REWARD_MAKER_RECEIVED_FEES: t('Reward - Maker fees received'),
|
||||
ACCOUNT_TYPE_REWARD_MARKET_PROPOSERS: t('Reward - Market proposers'),
|
||||
ACCOUNT_TYPE_SETTLEMENT: t('Settlement'),
|
||||
};
|
||||
|
||||
interface PartyAccountsProps {
|
||||
partyId: string;
|
||||
accounts: ExplorerPartyAssetsAccountsFragment[];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -11,22 +34,49 @@ interface PartyAccountsProps {
|
||||
* probably do with sorting by asset, and then within asset, by type with general
|
||||
* appearing first and... tbd
|
||||
*/
|
||||
export const PartyAccounts = ({ partyId }: PartyAccountsProps) => {
|
||||
const { open: openAssetDetailsDialog } = useAssetDetailsDialogStore();
|
||||
const onClickAsset = useCallback(
|
||||
(assetId?: string) => {
|
||||
assetId && openAssetDetailsDialog(assetId);
|
||||
},
|
||||
[openAssetDetailsDialog]
|
||||
);
|
||||
|
||||
export const PartyAccounts = ({ accounts }: PartyAccountsProps) => {
|
||||
return (
|
||||
<div className="block min-h-44 h-60 4 w-full border-red-800 relative">
|
||||
<AccountManager
|
||||
partyId={partyId}
|
||||
onClickAsset={onClickAsset}
|
||||
isReadOnly={true}
|
||||
/>
|
||||
</div>
|
||||
<Table className="max-w-5xl min-w-fit">
|
||||
<thead>
|
||||
<TableRow modifier="bordered" className="font-mono">
|
||||
<td>{t('Type')}</td>
|
||||
<td>{t('Market')}</td>
|
||||
<td className="text-right pr-2">{t('Balance')}</td>
|
||||
<td>{t('Asset')}</td>
|
||||
</TableRow>
|
||||
</thead>
|
||||
<tbody>
|
||||
{accounts.map((account) => {
|
||||
const m = get(account, 'market.tradableInstrument.instrument.name');
|
||||
|
||||
return (
|
||||
<TableRow
|
||||
key={`pa-${account.asset.id}-${account.type}`}
|
||||
title={account.asset.name}
|
||||
id={`${accountTypeString[account.type]} ${m ? ` - ${m}` : ''}`}
|
||||
>
|
||||
<td className="text-md">{accountTypeString[account.type]}</td>
|
||||
<td className="text-md">
|
||||
{account.market?.id ? (
|
||||
<MarketLink id={account.market?.id} />
|
||||
) : (
|
||||
<p>-</p>
|
||||
)}
|
||||
</td>
|
||||
<td className="text-md text-right pr-2">
|
||||
<AssetBalance
|
||||
assetId={account.asset.id}
|
||||
price={account.balance}
|
||||
showAssetLink={false}
|
||||
/>
|
||||
</td>
|
||||
<td className="text-md">
|
||||
<AssetLink assetId={account.asset.id} asDialog={true} />
|
||||
</td>
|
||||
</TableRow>
|
||||
);
|
||||
})}
|
||||
</tbody>
|
||||
</Table>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { Routes } from '../../../../routes/route-names';
|
||||
import { Button, Icon, Loader } from '@vegaprotocol/ui-toolkit';
|
||||
import { PartyBlock } from './party-block';
|
||||
import type { AccountFields } from '@vegaprotocol/accounts';
|
||||
|
||||
export interface PartyBlockAccountProps {
|
||||
partyId: string;
|
||||
accountData: AccountFields[] | null;
|
||||
accountLoading: boolean;
|
||||
accountError?: Error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays an overview of a party's assets. This uses existing data
|
||||
* providers to structure the details by asset, rather than looking at
|
||||
* it by account. The assumption is that this is a more natural way to
|
||||
* get an idea of the assets and activity of a party.
|
||||
*/
|
||||
export const PartyBlockAccounts = ({
|
||||
partyId,
|
||||
accountData,
|
||||
accountLoading,
|
||||
accountError,
|
||||
}: PartyBlockAccountProps) => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const shouldShowActionButton =
|
||||
accountData && accountData.length > 0 && !accountLoading && !accountError;
|
||||
|
||||
const action = shouldShowActionButton ? (
|
||||
<Button
|
||||
size="sm"
|
||||
onClick={() => navigate(`/${Routes.PARTIES}/${partyId}/assets`)}
|
||||
>
|
||||
{t('Show all')}
|
||||
</Button>
|
||||
) : null;
|
||||
|
||||
return (
|
||||
<PartyBlock title={t('Assets')} action={action}>
|
||||
{accountData && accountData.length > 0 ? (
|
||||
<p>
|
||||
{accountData.length} {t('assets, including')}{' '}
|
||||
{accountData
|
||||
.map((a) => a.asset.symbol)
|
||||
.slice(0, 3)
|
||||
.join(', ')}
|
||||
</p>
|
||||
) : accountLoading && !accountError ? (
|
||||
<Loader size="small" />
|
||||
) : accountData && accountData.length === 0 ? (
|
||||
<p>{t('No accounts found')}</p>
|
||||
) : (
|
||||
<p>
|
||||
<Icon className="mr-1" name="error" />
|
||||
<span className="text-sm">{t('Could not load assets')}</span>
|
||||
</p>
|
||||
)}
|
||||
</PartyBlock>
|
||||
);
|
||||
};
|
||||
@@ -1,83 +0,0 @@
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
import { useExplorerPartyAssetsQuery } from '../__generated__/Party-assets';
|
||||
import GovernanceAssetBalance from '../../../../components/asset-balance/governance-asset-balance';
|
||||
import {
|
||||
Icon,
|
||||
KeyValueTable,
|
||||
KeyValueTableRow,
|
||||
Loader,
|
||||
} from '@vegaprotocol/ui-toolkit';
|
||||
import { PartyBlock } from './party-block';
|
||||
import BigNumber from 'bignumber.js';
|
||||
|
||||
export interface PartyBlockStakeProps {
|
||||
partyId: string;
|
||||
accountLoading: boolean;
|
||||
accountError?: Error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays an overview of a single party's staking balance, importantly maintaining'
|
||||
* the same height before and after the details are loaded in.
|
||||
*
|
||||
* Unlike PartyBlockAccounts there is not action button in the title of this block as
|
||||
* there is no page for it to link to currently. That's a future task.
|
||||
*/
|
||||
export const PartyBlockStake = ({
|
||||
partyId,
|
||||
accountLoading,
|
||||
accountError,
|
||||
}: PartyBlockStakeProps) => {
|
||||
const partyRes = useExplorerPartyAssetsQuery({
|
||||
// Don't cache data for this query, party information can move quite quickly
|
||||
fetchPolicy: 'network-only',
|
||||
variables: { partyId: partyId },
|
||||
skip: !partyId,
|
||||
});
|
||||
|
||||
const p = partyRes.data?.partiesConnection?.edges[0].node;
|
||||
|
||||
const linkedLength = p?.stakingSummary?.linkings?.edges?.length;
|
||||
const linkedStake =
|
||||
linkedLength && linkedLength > 0
|
||||
? p?.stakingSummary?.linkings?.edges
|
||||
?.reduce((total, e) => {
|
||||
return new BigNumber(total).plus(
|
||||
new BigNumber(e?.node.amount || 0)
|
||||
);
|
||||
}, new BigNumber(0))
|
||||
.toString()
|
||||
: '0';
|
||||
|
||||
return (
|
||||
<PartyBlock title={t('Staking')}>
|
||||
{p?.stakingSummary.currentStakeAvailable ? (
|
||||
<KeyValueTable>
|
||||
<KeyValueTableRow noBorder={true}>
|
||||
<div>{t('Available stake')}</div>
|
||||
<div>
|
||||
<GovernanceAssetBalance
|
||||
price={p.stakingSummary.currentStakeAvailable}
|
||||
/>
|
||||
</div>
|
||||
</KeyValueTableRow>
|
||||
<KeyValueTableRow noBorder={true}>
|
||||
<div>{t('Active stake')}</div>
|
||||
<div>
|
||||
<GovernanceAssetBalance price={linkedStake || '0'} />
|
||||
</div>
|
||||
</KeyValueTableRow>
|
||||
</KeyValueTable>
|
||||
) : accountLoading && !accountError ? (
|
||||
<Loader size="small" />
|
||||
) : !accountError ? (
|
||||
<p>{t('No staking balance')}</p>
|
||||
) : (
|
||||
<p>
|
||||
<Icon className="mr-1" name="error" />
|
||||
<span className="text-sm">{t('Could not load stake details')}</span>
|
||||
</p>
|
||||
)}
|
||||
</PartyBlock>
|
||||
);
|
||||
};
|
||||
@@ -1,24 +0,0 @@
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
export interface PartyBlockProps {
|
||||
children: ReactNode;
|
||||
title: string;
|
||||
action?: ReactNode;
|
||||
}
|
||||
|
||||
export function PartyBlock({ children, title, action }: PartyBlockProps) {
|
||||
return (
|
||||
<div className="border-2 min-h-[138px] border-solid border-vega-light-100 dark:border-vega-dark-200 p-5 mt-5">
|
||||
<div
|
||||
className="flex flex-col md:flex-row gap-1 justify-between content-start mb-2"
|
||||
data-testid="page-title"
|
||||
>
|
||||
<h3 className="font-semibold text-lg">{title}</h3>
|
||||
|
||||
{action ? action : null}
|
||||
</div>
|
||||
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -1,26 +1,24 @@
|
||||
import { getNodes } from '@vegaprotocol/utils';
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
import { useScreenDimensions } from '@vegaprotocol/react-helpers';
|
||||
import { useMemo } from 'react';
|
||||
import { useNavigate, useParams } from 'react-router-dom';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { SubHeading } from '../../../components/sub-heading';
|
||||
import { Panel } from '../../../components/panel';
|
||||
import { toNonHex } from '../../../components/search/detect-search';
|
||||
import { useTxsData } from '../../../hooks/use-txs-data';
|
||||
import { TxsInfiniteList } from '../../../components/txs';
|
||||
import { PageHeader } from '../../../components/page-header';
|
||||
import { useExplorerPartyAssetsQuery } from './__generated__/Party-assets';
|
||||
import type { ExplorerPartyAssetsAccountsFragment } from './__generated__/Party-assets';
|
||||
import { useDocumentTitle } from '../../../hooks/use-document-title';
|
||||
import { Icon, Intent, Notification, Splash } from '@vegaprotocol/ui-toolkit';
|
||||
import { aggregatedAccountsDataProvider } from '@vegaprotocol/accounts';
|
||||
import { PartyBlockStake } from './components/party-block-stake';
|
||||
import { PartyBlockAccounts } from './components/party-block-accounts';
|
||||
import { isValidPartyId } from './components/party-id-error';
|
||||
import { useDataProvider } from '@vegaprotocol/data-provider';
|
||||
import GovernanceAssetBalance from '../../../components/asset-balance/governance-asset-balance';
|
||||
import { PartyAccounts } from './components/party-accounts';
|
||||
|
||||
const Party = () => {
|
||||
const { party } = useParams<{ party: string }>();
|
||||
|
||||
useDocumentTitle(['Public keys', party || '-']);
|
||||
const navigate = useNavigate();
|
||||
|
||||
const partyId = toNonHex(party ? party : '');
|
||||
const { isMobile } = useScreenDimensions();
|
||||
const visibleChars = useMemo(() => (isMobile ? 10 : 14), [isMobile]);
|
||||
@@ -30,72 +28,71 @@ const Party = () => {
|
||||
filters,
|
||||
});
|
||||
|
||||
const variables = useMemo(() => ({ partyId }), [partyId]);
|
||||
const {
|
||||
data: AccountData,
|
||||
loading: AccountLoading,
|
||||
error: AccountError,
|
||||
} = useDataProvider({
|
||||
dataProvider: aggregatedAccountsDataProvider,
|
||||
variables,
|
||||
const partyRes = useExplorerPartyAssetsQuery({
|
||||
// Don't cache data for this query, party information can move quite quickly
|
||||
fetchPolicy: 'network-only',
|
||||
variables: { partyId: partyId },
|
||||
skip: !party,
|
||||
});
|
||||
|
||||
if (!isValidPartyId(partyId)) {
|
||||
return (
|
||||
<div className="max-w-sm mx-auto">
|
||||
<Notification
|
||||
message={t('Invalid party ID')}
|
||||
intent={Intent.Danger}
|
||||
buttonProps={{
|
||||
text: t('Go back'),
|
||||
action: () => navigate(-1),
|
||||
className: 'py-1',
|
||||
size: 'sm',
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
const p = partyRes.data?.partiesConnection?.edges[0].node;
|
||||
|
||||
const header = p?.id ? (
|
||||
<PageHeader
|
||||
title={p.id}
|
||||
copy
|
||||
truncateStart={visibleChars}
|
||||
truncateEnd={visibleChars}
|
||||
/>
|
||||
) : (
|
||||
<Panel>
|
||||
<p>No data found for public key {party}</p>
|
||||
</Panel>
|
||||
);
|
||||
|
||||
const staking = (
|
||||
<section>
|
||||
{p?.stakingSummary?.currentStakeAvailable ? (
|
||||
<div className="mt-4 leading-3">
|
||||
<strong className="font-semibold">{t('Staking Balance: ')}</strong>
|
||||
<GovernanceAssetBalance
|
||||
price={p.stakingSummary.currentStakeAvailable}
|
||||
/>
|
||||
</div>
|
||||
) : null}
|
||||
</section>
|
||||
);
|
||||
|
||||
const accounts = getNodes<ExplorerPartyAssetsAccountsFragment>(
|
||||
p?.accountsConnection
|
||||
);
|
||||
|
||||
return (
|
||||
<section>
|
||||
<PageHeader
|
||||
title={partyId}
|
||||
copy
|
||||
truncateStart={visibleChars}
|
||||
truncateEnd={visibleChars}
|
||||
/>
|
||||
<h1
|
||||
className="font-alpha calt uppercase font-xl mb-4 text-vega-dark-100 dark:text-vega-light-100"
|
||||
data-testid="parties-header"
|
||||
>
|
||||
{t('Public key')}
|
||||
</h1>
|
||||
{partyRes.data ? (
|
||||
<>
|
||||
{header}
|
||||
<SubHeading>{t('Asset data')}</SubHeading>
|
||||
{accounts ? <PartyAccounts accounts={accounts} /> : null}
|
||||
{staking}
|
||||
|
||||
<div className="grid md:grid-flow-col grid-flow-row md:space-x-4 grid-cols-1 md:grid-cols-2 w-full">
|
||||
<PartyBlockAccounts
|
||||
accountError={AccountError}
|
||||
accountLoading={AccountLoading}
|
||||
accountData={AccountData}
|
||||
partyId={partyId}
|
||||
/>
|
||||
<PartyBlockStake
|
||||
accountError={AccountError}
|
||||
accountLoading={AccountLoading}
|
||||
partyId={partyId}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<SubHeading>{t('Transactions')}</SubHeading>
|
||||
{!error && txsData ? (
|
||||
<TxsInfiniteList
|
||||
hasMoreTxs={hasMoreTxs}
|
||||
areTxsLoading={loading}
|
||||
txs={txsData}
|
||||
loadMoreTxs={loadTxs}
|
||||
error={error}
|
||||
className="mb-28"
|
||||
/>
|
||||
) : (
|
||||
<Splash>
|
||||
<Icon name="error" className="mr-1" />
|
||||
{t('Could not load transaction list for party')}
|
||||
</Splash>
|
||||
)}
|
||||
<SubHeading>{t('Transactions')}</SubHeading>
|
||||
<TxsInfiniteList
|
||||
hasMoreTxs={hasMoreTxs}
|
||||
areTxsLoading={loading}
|
||||
txs={txsData}
|
||||
loadMoreTxs={loadTxs}
|
||||
error={error}
|
||||
className="mb-28"
|
||||
/>
|
||||
</>
|
||||
) : null}
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
import { Outlet } from 'react-router-dom';
|
||||
|
||||
const PartiesSubPage = () => {
|
||||
return <Outlet />;
|
||||
};
|
||||
|
||||
export default PartiesSubPage;
|
||||
@@ -0,0 +1,35 @@
|
||||
import React from 'react';
|
||||
import { DATA_SOURCES } from '../../config';
|
||||
import type { TendermintUnconfirmedTransactionsResponse } from '../txs/tendermint-unconfirmed-transactions-response.d';
|
||||
import { TxList } from '../../components/txs';
|
||||
import { RouteTitle } from '../../components/route-title';
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
import { useFetch } from '@vegaprotocol/react-helpers';
|
||||
import { useDocumentTitle } from '../../hooks/use-document-title';
|
||||
|
||||
const PendingTxs = () => {
|
||||
const {
|
||||
state: { data: unconfirmedTransactions },
|
||||
} = useFetch<TendermintUnconfirmedTransactionsResponse>(
|
||||
`${DATA_SOURCES.tendermintUrl}/unconfirmed_txs`
|
||||
);
|
||||
|
||||
useDocumentTitle(['Pending transactions']);
|
||||
|
||||
return (
|
||||
<section>
|
||||
<RouteTitle data-testid="unconfirmed-transactions-header">
|
||||
{t('Unconfirmed transactions')}
|
||||
</RouteTitle>
|
||||
<br />
|
||||
<div>{t(`Number: ${unconfirmedTransactions?.result?.n_txs || 0}`)}</div>
|
||||
<br />
|
||||
<div>
|
||||
<br />
|
||||
<TxList data={unconfirmedTransactions} />
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
};
|
||||
|
||||
export { PendingTxs };
|
||||
@@ -14,6 +14,7 @@ import { Block } from './blocks/id';
|
||||
import { Blocks } from './blocks/home';
|
||||
import { Tx } from './txs/id';
|
||||
import { TxsList } from './txs/home';
|
||||
import { PendingTxs } from './pending';
|
||||
import flags from '../config/flags';
|
||||
import { t } from '@vegaprotocol/i18n';
|
||||
import { Routes } from './route-names';
|
||||
@@ -28,7 +29,6 @@ import compact from 'lodash/compact';
|
||||
import { AssetLink, MarketLink } from '../components/links';
|
||||
import { truncateMiddle } from '@vegaprotocol/ui-toolkit';
|
||||
import { remove0x } from '@vegaprotocol/utils';
|
||||
import { PartyAccountsByAsset } from './parties/id/accounts';
|
||||
|
||||
export type Navigable = {
|
||||
path: string;
|
||||
@@ -75,43 +75,14 @@ const partiesRoutes: Route[] = flags.parties
|
||||
},
|
||||
{
|
||||
path: ':party',
|
||||
element: <Party />,
|
||||
|
||||
children: [
|
||||
{
|
||||
index: true,
|
||||
element: <PartySingle />,
|
||||
handle: {
|
||||
breadcrumb: (params: Params<string>) => (
|
||||
<Link to={linkTo(Routes.PARTIES, params.party)}>
|
||||
{truncateMiddle(params.party as string)}
|
||||
</Link>
|
||||
),
|
||||
},
|
||||
},
|
||||
{
|
||||
path: 'assets',
|
||||
element: <Party />,
|
||||
handle: {
|
||||
breadcrumb: (params: Params<string>) => (
|
||||
<Link to={linkTo(Routes.PARTIES, params.party)}>
|
||||
{truncateMiddle(params.party as string)}
|
||||
</Link>
|
||||
),
|
||||
},
|
||||
children: [
|
||||
{
|
||||
index: true,
|
||||
element: <PartyAccountsByAsset />,
|
||||
handle: {
|
||||
breadcrumb: () => {
|
||||
return t('Assets');
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
element: <PartySingle />,
|
||||
handle: {
|
||||
breadcrumb: (params: Params<string>) => (
|
||||
<Link to={linkTo(Routes.PARTIES, params.party)}>
|
||||
{truncateMiddle(params.party as string)}
|
||||
</Link>
|
||||
),
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -266,6 +237,17 @@ export const routerConfig: Route[] = [
|
||||
breadcrumb: () => <Link to={Routes.TX}>{t('Transactions')}</Link>,
|
||||
},
|
||||
children: [
|
||||
{
|
||||
path: 'pending',
|
||||
element: <PendingTxs />,
|
||||
handle: {
|
||||
breadcrumb: () => (
|
||||
<Link to={linkTo(Routes.TX, 'pending')}>
|
||||
{t('Pending transactions')}
|
||||
</Link>
|
||||
),
|
||||
},
|
||||
},
|
||||
{
|
||||
path: ':txHash',
|
||||
element: <Tx />,
|
||||
|
||||
@@ -10,7 +10,7 @@ interface TxDetailsProps {
|
||||
|
||||
export const txDetailsTruncateLength = 30;
|
||||
|
||||
export const TxDetails = ({ txData, pubKey }: TxDetailsProps) => {
|
||||
export const TxDetails = ({ txData, pubKey, className }: TxDetailsProps) => {
|
||||
if (!txData) {
|
||||
return <>{t('Awaiting Block Explorer transaction details')}</>;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ import {
|
||||
} from '@vegaprotocol/environment';
|
||||
import classNames from 'classnames';
|
||||
import { NodeStatus, NodeStatusMapping } from '@vegaprotocol/types';
|
||||
import { PartyLink } from '../../components/links';
|
||||
|
||||
type RateProps = {
|
||||
value: BigNumber | number | undefined;
|
||||
@@ -192,9 +191,7 @@ export const ValidatorsPage = () => {
|
||||
<KeyValueTable>
|
||||
<KeyValueTableRow>
|
||||
<div>{t('ID')}</div>
|
||||
<div className="break-all text-xs font-mono">
|
||||
{v.id}
|
||||
</div>
|
||||
<div className="break-all text-xs">{v.id}</div>
|
||||
</KeyValueTableRow>
|
||||
<KeyValueTableRow>
|
||||
<div>{t('Status')}</div>
|
||||
@@ -221,14 +218,12 @@ export const ValidatorsPage = () => {
|
||||
</div>
|
||||
</KeyValueTableRow>
|
||||
<KeyValueTableRow>
|
||||
<div>{t('Key')}</div>
|
||||
<div className="break-all text-xs">
|
||||
<PartyLink id={v.pubkey} />
|
||||
</div>
|
||||
<div>{t('Public key')}</div>
|
||||
<div className="break-all text-xs">{v.pubkey}</div>
|
||||
</KeyValueTableRow>
|
||||
<KeyValueTableRow>
|
||||
<div>{t('Ethereum address')}</div>
|
||||
<div className="break-all text-xs font-mono">
|
||||
<div className="break-all text-xs">
|
||||
<EtherscanLink address={v.ethereumAddress} />{' '}
|
||||
<CopyWithTooltip text={v.ethereumAddress}>
|
||||
<button title={t('Copy address to clipboard')}>
|
||||
@@ -239,9 +234,7 @@ export const ValidatorsPage = () => {
|
||||
</KeyValueTableRow>
|
||||
<KeyValueTableRow>
|
||||
<div>{t('Tendermint public key')}</div>
|
||||
<div className="break-all text-xs font-mono">
|
||||
{v.tmPubkey}
|
||||
</div>
|
||||
<div className="break-all text-xs">{v.tmPubkey}</div>
|
||||
</KeyValueTableRow>
|
||||
|
||||
<KeyValueTableRow>
|
||||
|
||||
@@ -32,11 +32,6 @@
|
||||
line-height: calc(min(var(--ag-line-height, 26px), 26px) - 4px);
|
||||
}
|
||||
|
||||
.vega-ag-grid .ag-row {
|
||||
border-width: 1px 0;
|
||||
border-bottom: 1px solid transparent;
|
||||
}
|
||||
|
||||
/* Light variables */
|
||||
.ag-theme-balham {
|
||||
--ag-background-color: theme(colors.white);
|
||||
|
||||
@@ -30,6 +30,6 @@ CYPRESS_TRUNCATED_VEGA_PUBLIC_KEY2=7f9cf0…c25535
|
||||
CYPRESS_VEGA_ENV=CUSTOM
|
||||
CYPRESS_VEGA_PUBLIC_KEY=02eceaba4df2bef76ea10caf728d8a099a2aa846cced25737cccaa9812342f65
|
||||
CYPRESS_VEGA_PUBLIC_KEY2=7f9cf07d3a9905b1a61a1069f7a758855da428bc0f4a97de87f48644bfc25535
|
||||
CYPRESS_VEGA_TOKEN_URL=https://governance.fairground.wtf
|
||||
CYPRESS_VEGA_TOKEN_URL=https://token.fairground.wtf
|
||||
CYPRESS_VEGA_WALLET_URL=http://localhost:1789
|
||||
CYPRESS_VEGA_WALLET_API_TOKEN=
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# App configuration variables
|
||||
NX_VEGA_ENV=MAINNET
|
||||
NX_VEGA_URL=https://api.vega.community/graphql
|
||||
NX_VEGA_URL=https://api.vega.xyz/query
|
||||
NX_ETHEREUM_PROVIDER_URL=https://mainnet.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
||||
NX_ETHERSCAN_URL=https://etherscan.io
|
||||
|
||||
@@ -2,14 +2,14 @@ import {
|
||||
navigateTo,
|
||||
waitForSpinner,
|
||||
navigation,
|
||||
turnTelemetryOff,
|
||||
} from '../../support/common.functions';
|
||||
import {
|
||||
convertUnixTimestampToDateformat,
|
||||
createRawProposal,
|
||||
createTenDigitUnixTimeStampForSpecifiedDays,
|
||||
enterUniqueFreeFormProposalBody,
|
||||
generateFreeFormProposalTitle,
|
||||
getDateFormatForSpecifiedDays,
|
||||
getGovernanceProposalDateFormatForSpecifiedDays,
|
||||
getProposalIdFromList,
|
||||
getProposalInformationFromTable,
|
||||
getSubmittedProposalFromProposalList,
|
||||
@@ -23,7 +23,6 @@ import { ensureSpecifiedUnstakedTokensAreAssociated } from '../../../../governan
|
||||
import { ethereumWalletConnect } from '../../../../governance-e2e/src/support/wallet-eth.functions';
|
||||
import { vegaWalletSetSpecifiedApprovalAmount } from '../../../../governance-e2e/src/support/wallet-teardown.functions';
|
||||
import type { testFreeformProposal } from '../../support/common-interfaces';
|
||||
import { formatDateWithLocalTimezone } from '@vegaprotocol/utils';
|
||||
|
||||
const proposalVoteProgressForPercentage =
|
||||
'[data-testid="vote-progress-indicator-percentage-for"]';
|
||||
@@ -51,7 +50,6 @@ describe(
|
||||
|
||||
beforeEach('visit proposals tab', function () {
|
||||
cy.clearLocalStorage();
|
||||
turnTelemetryOff();
|
||||
cy.reload();
|
||||
waitForSpinner();
|
||||
cy.connectVegaWallet();
|
||||
@@ -101,22 +99,20 @@ describe(
|
||||
getSubmittedProposalFromProposalList(proposalTitle).within(() =>
|
||||
cy.get(viewProposalButton).click()
|
||||
);
|
||||
cy.wrap(
|
||||
formatDateWithLocalTimezone(new Date(proposalTimeStamp * 1000))
|
||||
).then((closingDate) => {
|
||||
getProposalInformationFromTable('Closes on')
|
||||
.contains(closingDate)
|
||||
.should('be.visible');
|
||||
});
|
||||
cy.wrap(
|
||||
formatDateWithLocalTimezone(
|
||||
new Date(createTenDigitUnixTimeStampForSpecifiedDays(0) * 1000)
|
||||
)
|
||||
).then((proposalDate) => {
|
||||
getProposalInformationFromTable('Proposed on')
|
||||
.contains(proposalDate)
|
||||
.should('be.visible');
|
||||
});
|
||||
convertUnixTimestampToDateformat(proposalTimeStamp).then(
|
||||
(closingDate) => {
|
||||
getProposalInformationFromTable('Closes on')
|
||||
.contains(closingDate)
|
||||
.should('be.visible');
|
||||
}
|
||||
);
|
||||
getGovernanceProposalDateFormatForSpecifiedDays(0).then(
|
||||
(proposalDate) => {
|
||||
getProposalInformationFromTable('Proposed on')
|
||||
.contains(proposalDate)
|
||||
.should('be.visible');
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
it('Newly created proposal details - shows default status set to fail', function () {
|
||||
@@ -159,16 +155,18 @@ describe(
|
||||
cy.getByTestId('vote-buttons').contains('against').should('be.visible');
|
||||
cy.getByTestId('vote-buttons').contains('for').should('be.visible');
|
||||
voteForProposal('for');
|
||||
getDateFormatForSpecifiedDays(0).then((votedDate) => {
|
||||
// 3001-VOTE-051
|
||||
// 3001-VOTE-093
|
||||
cy.contains('You voted:')
|
||||
.siblings()
|
||||
.contains('For')
|
||||
.siblings()
|
||||
.contains(votedDate)
|
||||
.should('be.visible');
|
||||
});
|
||||
getGovernanceProposalDateFormatForSpecifiedDays(0, 'shortMonth').then(
|
||||
(votedDate) => {
|
||||
// 3001-VOTE-051
|
||||
// 3001-VOTE-093
|
||||
cy.contains('You voted:')
|
||||
.siblings()
|
||||
.contains('For')
|
||||
.siblings()
|
||||
.contains(votedDate)
|
||||
.should('be.visible');
|
||||
}
|
||||
);
|
||||
cy.get(proposalVoteProgressForPercentage) // 3001-VOTE-072
|
||||
.contains('100.00%')
|
||||
.and('be.visible');
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
import {
|
||||
navigateTo,
|
||||
navigation,
|
||||
turnTelemetryOff,
|
||||
waitForSpinner,
|
||||
} from '../../support/common.functions';
|
||||
import {
|
||||
@@ -38,7 +37,6 @@ context(
|
||||
|
||||
beforeEach('visit proposals', function () {
|
||||
cy.clearLocalStorage();
|
||||
turnTelemetryOff();
|
||||
cy.reload();
|
||||
waitForSpinner();
|
||||
cy.connectVegaWallet();
|
||||
|
||||
@@ -20,7 +20,6 @@ import {
|
||||
navigateTo,
|
||||
navigation,
|
||||
closeDialog,
|
||||
turnTelemetryOff,
|
||||
} from '../../support/common.functions';
|
||||
import {
|
||||
clickOnValidatorFromList,
|
||||
@@ -86,7 +85,6 @@ context(
|
||||
|
||||
beforeEach('visit governance tab', function () {
|
||||
cy.clearLocalStorage();
|
||||
turnTelemetryOff();
|
||||
cy.reload();
|
||||
waitForSpinner();
|
||||
cy.connectVegaWallet();
|
||||
|
||||
@@ -2,7 +2,6 @@ import {
|
||||
closeDialog,
|
||||
navigateTo,
|
||||
navigation,
|
||||
turnTelemetryOff,
|
||||
waitForSpinner,
|
||||
} from '../../support/common.functions';
|
||||
import {
|
||||
@@ -78,7 +77,6 @@ context(
|
||||
|
||||
beforeEach('visit governance tab', function () {
|
||||
cy.clearLocalStorage();
|
||||
turnTelemetryOff();
|
||||
cy.reload();
|
||||
waitForSpinner();
|
||||
cy.connectVegaWallet();
|
||||
|
||||
@@ -2,7 +2,6 @@ import type { testFreeformProposal } from '../../support/common-interfaces';
|
||||
import {
|
||||
navigateTo,
|
||||
navigation,
|
||||
turnTelemetryOff,
|
||||
waitForSpinner,
|
||||
} from '../../support/common.functions';
|
||||
import {
|
||||
@@ -37,7 +36,6 @@ describe('Governance flow for proposal list', { tags: '@slow' }, function () {
|
||||
|
||||
beforeEach('visit proposals tab', function () {
|
||||
cy.clearLocalStorage();
|
||||
turnTelemetryOff();
|
||||
cy.reload();
|
||||
waitForSpinner();
|
||||
cy.connectVegaWallet();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import {
|
||||
navigateTo,
|
||||
navigation,
|
||||
turnTelemetryOff,
|
||||
waitForSpinner,
|
||||
} from '../../support/common.functions';
|
||||
import {
|
||||
@@ -27,7 +26,6 @@ const rewardsTimeOut = { timeout: 60000 };
|
||||
context('rewards - flow', { tags: '@slow' }, function () {
|
||||
before('set up environment to allow rewards', function () {
|
||||
cy.clearLocalStorage();
|
||||
turnTelemetryOff();
|
||||
cy.visit('/');
|
||||
waitForSpinner();
|
||||
depositAsset(vegaAssetAddress, '1000', 18);
|
||||
|
||||
@@ -4,7 +4,6 @@ import {
|
||||
waitForSpinner,
|
||||
navigateTo,
|
||||
navigation,
|
||||
turnTelemetryOff,
|
||||
} from '../../support/common.functions';
|
||||
import {
|
||||
stakingPageAssociateTokens,
|
||||
@@ -55,7 +54,6 @@ context(
|
||||
'teardown wallet & drill into a specific validator',
|
||||
function () {
|
||||
cy.clearLocalStorage();
|
||||
turnTelemetryOff();
|
||||
cy.reload();
|
||||
waitForSpinner();
|
||||
cy.connectVegaWallet();
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import {
|
||||
navigateTo,
|
||||
navigation,
|
||||
turnTelemetryOff,
|
||||
waitForSpinner,
|
||||
} from '../../support/common.functions';
|
||||
import { ethereumWalletConnect } from '../../support/wallet-eth.functions';
|
||||
@@ -30,8 +29,6 @@ const tableReceiverAddress = '[col-id="details.receiverAddress"]';
|
||||
const tableWithdrawnTimeStamp = '[col-id="withdrawnTimestamp"]';
|
||||
const tableWithdrawnStatus = '[col-id="status"]';
|
||||
const tableCreatedTimeStamp = '[col-id="createdTimestamp"]';
|
||||
const toastContent = 'toast-content';
|
||||
const toastPanel = 'toast-panel';
|
||||
const usdtName = 'USDC (local)';
|
||||
const usdcEthAddress = '0x1b8a1B6CBE5c93609b46D1829Cc7f3Cb8eeE23a0';
|
||||
const usdcSymbol = 'tUSDC';
|
||||
@@ -56,7 +53,6 @@ context(
|
||||
|
||||
beforeEach('Navigate to withdrawal page', function () {
|
||||
cy.clearLocalStorage();
|
||||
turnTelemetryOff();
|
||||
cy.reload();
|
||||
waitForSpinner();
|
||||
navigateTo(navigation.withdraw);
|
||||
@@ -153,6 +149,7 @@ context(
|
||||
});
|
||||
});
|
||||
|
||||
// Skipping because of bug #1857
|
||||
it('Able to withdraw asset: -eth wallet not connected', function () {
|
||||
const ethWalletAddress = Cypress.env('ethWalletPublicKey');
|
||||
cy.reload();
|
||||
@@ -190,26 +187,8 @@ context(
|
||||
.should('have.attr', 'href')
|
||||
.and('contain', 'https://sepolia.etherscan.io/address/');
|
||||
cy.get(tableCreatedTimeStamp).should('not.be.empty');
|
||||
});
|
||||
ethereumWalletConnect();
|
||||
cy.getByTestId(completeWithdrawalButton).click();
|
||||
cy.getByTestId(toastContent)
|
||||
.last()
|
||||
.should('contain.text', 'Awaiting confirmation')
|
||||
.within(() => {
|
||||
cy.getByTestId('external-link').should('exist');
|
||||
});
|
||||
cy.getByTestId(toastContent)
|
||||
.first()
|
||||
.should('contain.text', 'The withdrawal has been approved.')
|
||||
.within(() => {
|
||||
cy.getByTestId(toastPanel).should('contain.text', '110.00', 'tUSDC');
|
||||
});
|
||||
cy.getByTestId(toastContent)
|
||||
.last()
|
||||
.should('contain.text', 'Transaction confirmed')
|
||||
.within(() => {
|
||||
cy.getByTestId('external-link').should('exist');
|
||||
cy.getByTestId(completeWithdrawalButton).click();
|
||||
// Unable to complete withdrawal in Capsule
|
||||
});
|
||||
});
|
||||
|
||||
@@ -239,10 +218,7 @@ context(
|
||||
});
|
||||
|
||||
function waitForAssetsDisplayed(expectedAsset: string) {
|
||||
cy.getByTestId('currency-title', txTimeout).should(
|
||||
'contain.text',
|
||||
expectedAsset
|
||||
);
|
||||
cy.getByTestId('currency-title').should('contain.text', expectedAsset);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@@ -161,7 +161,7 @@ context('Home Page - verify elements on page', { tags: '@smoke' }, function () {
|
||||
cy.getByTestId('menu-drawer').should('be.visible');
|
||||
});
|
||||
|
||||
it.skip('should have link for proposal page', function () {
|
||||
it('should have link for proposal page', function () {
|
||||
cy.getByTestId('menu-drawer').within(() => {
|
||||
cy.get('[href="/proposals"]')
|
||||
.should('exist')
|
||||
|
||||
@@ -54,7 +54,7 @@ context(
|
||||
});
|
||||
});
|
||||
|
||||
it.skip('should be able to see button for - new proposal', function () {
|
||||
it('should be able to see button for - new proposal', function () {
|
||||
// 3001-VOTE-002
|
||||
cy.get(newProposalLink)
|
||||
.should('be.visible')
|
||||
@@ -63,7 +63,7 @@ context(
|
||||
.and('equal', '/proposals/propose');
|
||||
});
|
||||
|
||||
it.skip('should be able to see a connect wallet button - if vega wallet disconnected and user is submitting new proposal', function () {
|
||||
it('should be able to see a connect wallet button - if vega wallet disconnected and user is submitting new proposal', function () {
|
||||
goToMakeNewProposal(governanceProposalType.NETWORK_PARAMETER);
|
||||
cy.get(connectToVegaWalletButton)
|
||||
.should('be.visible')
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
import {
|
||||
navigateTo,
|
||||
navigation,
|
||||
turnTelemetryOff,
|
||||
waitForSpinner,
|
||||
} from '../../support/common.functions';
|
||||
import {
|
||||
@@ -27,7 +26,6 @@ context('View functionality with public key', { tags: '@smoke' }, function () {
|
||||
|
||||
beforeEach('visit home page', function () {
|
||||
cy.clearLocalStorage();
|
||||
turnTelemetryOff();
|
||||
cy.visit('/');
|
||||
waitForSpinner();
|
||||
cy.connectPublicKey(vegaWalletPubKey);
|
||||
@@ -46,7 +44,7 @@ context('View functionality with public key', { tags: '@smoke' }, function () {
|
||||
.and('contain.text', 'USDC (fake)');
|
||||
});
|
||||
|
||||
it.skip('Unable to submit proposal with public key', function () {
|
||||
it('Unable to submit proposal with public key', function () {
|
||||
const expectedErrorTxt = `You are connected in a view only state for public key: ${vegaWalletPubKey}. In order to send transactions you must connect to a real wallet.`;
|
||||
|
||||
navigateTo(navigation.proposals);
|
||||
|
||||
@@ -13,6 +13,7 @@ context(
|
||||
{ tags: '@regression' },
|
||||
function () {
|
||||
before('navigate to rewards page', function () {
|
||||
cy.clearLocalStorage();
|
||||
cy.visit('/');
|
||||
navigateTo(navigation.rewards);
|
||||
});
|
||||
|
||||
@@ -33,6 +33,7 @@ const stakeNumberRegex = /^\d*\.?\d*$/;
|
||||
|
||||
context('Validators Page - verify elements on page', function () {
|
||||
before('navigate to validators page', function () {
|
||||
cy.clearAllLocalStorage();
|
||||
cy.visit('/validators');
|
||||
});
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ context(
|
||||
{ tags: '@regression' },
|
||||
() => {
|
||||
before('visit token home page', () => {
|
||||
cy.clearAllLocalStorage();
|
||||
cy.visit('/');
|
||||
cy.get(walletContainer, { timeout: 60000 }).should('be.visible');
|
||||
});
|
||||
|
||||
@@ -12,6 +12,7 @@ context(
|
||||
{ tags: '@smoke' },
|
||||
function () {
|
||||
before('navigate to withdrawals page', function () {
|
||||
cy.clearAllLocalStorage();
|
||||
cy.visit('/');
|
||||
navigateTo(navigation.withdraw);
|
||||
});
|
||||
|
||||
@@ -90,10 +90,3 @@ export function verifyEthWalletAssociatedBalance(amount: string) {
|
||||
export function closeDialog() {
|
||||
cy.getByTestId('dialog-close').click();
|
||||
}
|
||||
|
||||
export function turnTelemetryOff() {
|
||||
// Ensuring the telemetry modal doesn't disrupt the tests
|
||||
cy.window().then((win) =>
|
||||
win.localStorage.setItem('vega_telemetry_on', 'false')
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { format } from 'date-fns';
|
||||
import { closeDialog, navigateTo, navigation } from './common.functions';
|
||||
import { ensureSpecifiedUnstakedTokensAreAssociated } from './staking.functions';
|
||||
|
||||
@@ -16,6 +15,35 @@ const newProposalSubmitButton = '[data-testid="proposal-submit"]';
|
||||
const epochTimeout = Cypress.env('epochTimeout');
|
||||
const proposalTimeout = { timeout: 14000 };
|
||||
|
||||
export function convertUnixTimestampToDateformat(
|
||||
unixTimestamp: number,
|
||||
monthTextLength = 'longMonth'
|
||||
) {
|
||||
const dateSupplied = new Date(unixTimestamp * 1000);
|
||||
const year = dateSupplied.getFullYear();
|
||||
const months = [
|
||||
'January',
|
||||
'February',
|
||||
'March',
|
||||
'April',
|
||||
'May',
|
||||
'June',
|
||||
'July',
|
||||
'August',
|
||||
'September',
|
||||
'October',
|
||||
'November',
|
||||
'December',
|
||||
];
|
||||
const month = months[dateSupplied.getMonth()];
|
||||
const shortMonth = months[dateSupplied.getMonth()].substring(0, 3),
|
||||
date = dateSupplied.getDate();
|
||||
|
||||
if (monthTextLength === 'longMonth') {
|
||||
return cy.wrap(`${date} ${month} ${year}`);
|
||||
} else return cy.wrap(`${date} ${shortMonth} ${year}`);
|
||||
}
|
||||
|
||||
export function createTenDigitUnixTimeStampForSpecifiedDays(
|
||||
durationDays: number
|
||||
) {
|
||||
@@ -24,13 +52,6 @@ export function createTenDigitUnixTimeStampForSpecifiedDays(
|
||||
return (timestamp = Math.floor(timestamp / 1000));
|
||||
}
|
||||
|
||||
export function getDateFormatForSpecifiedDays(days: number) {
|
||||
const date = new Date(
|
||||
createTenDigitUnixTimeStampForSpecifiedDays(days) * 1000
|
||||
);
|
||||
return cy.wrap(format(date, 'dd MMM yyyy'));
|
||||
}
|
||||
|
||||
export function enterRawProposalBody(timestamp: number) {
|
||||
cy.fixture('/proposals/raw.json').then((rawProposal) => {
|
||||
rawProposal.terms.closingTimestamp = timestamp;
|
||||
@@ -83,6 +104,16 @@ export function getProposalIdFromList(proposalTitle: string) {
|
||||
});
|
||||
}
|
||||
|
||||
export function getGovernanceProposalDateFormatForSpecifiedDays(
|
||||
days: number,
|
||||
shortOrLong?: string
|
||||
) {
|
||||
return convertUnixTimestampToDateformat(
|
||||
createTenDigitUnixTimeStampForSpecifiedDays(days),
|
||||
shortOrLong
|
||||
);
|
||||
}
|
||||
|
||||
export function getProposalInformationFromTable(heading: string) {
|
||||
return cy.get(proposalInformationTableRows).contains(heading).siblings();
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import './proposal.functions.ts';
|
||||
import registerCypressGrep from '@cypress/grep';
|
||||
import { aliasGQLQuery } from '@vegaprotocol/cypress';
|
||||
import { chainIdQuery, statisticsQuery } from '@vegaprotocol/mock';
|
||||
import { turnTelemetryOff } from './common.functions.ts';
|
||||
registerCypressGrep();
|
||||
|
||||
// Hide fetch/XHR requests - They create a lot of noise in command log
|
||||
@@ -25,9 +24,6 @@ if (!app.document.head.querySelector('[data-hide-command-log-request]')) {
|
||||
}
|
||||
|
||||
before(() => {
|
||||
cy.clearLocalStorage();
|
||||
// // Ensuring the telemetry modal doesn't disrupt the tests
|
||||
turnTelemetryOff();
|
||||
// Mock chainId fetch which happens on every page for wallet connection
|
||||
cy.mockGQL((req) => {
|
||||
aliasGQLQuery(req, 'ChainId', chainIdQuery());
|
||||
|
||||
@@ -5,7 +5,7 @@ NX_VEGA_URL=https://api.n00.stagnet1.vega.xyz/graphql
|
||||
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||
NX_FAIRGROUND=false
|
||||
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.governance.vega.xyz","STAGNET1":"https://stagnet1.governance.vega.xyz","TESTNET":"https://governance.fairground.wtf","MAINNET":"https://governance.vega.xyz"}'
|
||||
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET1":"https://stagnet1.token.vega.xyz","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
|
||||
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||
NX_VEGA_WALLET_URL=http://localhost:1789
|
||||
NX_VEGA_EXPLORER_URL=https://stagnet1.explorer.vega.xyz
|
||||
|
||||
@@ -3,7 +3,7 @@ NX_VEGA_ENV=CUSTOM
|
||||
NX_ETHEREUM_PROVIDER_URL=http://localhost:8545
|
||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||
NX_FAIRGROUND=false
|
||||
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.governance.vega.xyz","TESTNET":"https://governance.fairground.wtf","MAINNET":"https://governance.vega.xyz"}'
|
||||
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
|
||||
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/test/announcements.json
|
||||
NX_VEGA_CONFIG_URL=''
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
NX_VEGA_ENV=DEVNET
|
||||
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/devnet1/vegawallet-devnet1.toml
|
||||
NX_VEGA_URL=https://api.n00.devnet1.vega.xyz/graphql
|
||||
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.governance.vega.xyz","TESTNET":"https://governance.fairground.wtf","MAINNET":"https://governance.vega.xyz"}'
|
||||
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
|
||||
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||
@@ -10,4 +10,4 @@ NX_VEGA_EXPLORER_URL=https://dev.explorer.vega.xyz
|
||||
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
|
||||
NX_DELEGATIONS_PAGINATION=50
|
||||
NX_TRANCHES_SERVICE_URL=https://tranches-devnet1-k8s.ops.vega.xyz
|
||||
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json
|
||||
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json
|
||||
@@ -1,8 +1,8 @@
|
||||
# App configuration variables
|
||||
NX_VEGA_ENV=MAINNET
|
||||
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks/master/mainnet1/mainnet1.toml
|
||||
NX_VEGA_URL=https://api.vega.community/graphql
|
||||
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.governance.vega.xyz","TESTNET":"https://governance.fairground.wtf","MAINNET":"https://governance.vega.xyz"}'
|
||||
NX_VEGA_URL=https://api.vega.xyz/query
|
||||
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
|
||||
NX_ETHEREUM_PROVIDER_URL=https://mainnet.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
||||
NX_ETHERSCAN_URL=https://etherscan.io
|
||||
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# App configuration variables
|
||||
NX_VEGA_URL=https://api.n00.stagnet1.vega.xyz/graphql
|
||||
NX_VEGA_ENV=STAGNET1
|
||||
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.governance.vega.xyz","STAGNET1":"https://stagnet1.governance.vega.xyz","TESTNET":"https://governance.fairground.wtf","MAINNET":"https://governance.vega.xyz"}'
|
||||
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET1":"https://stagnet1.token.vega.xyz","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
|
||||
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/stagnet1/vegawallet-stagnet1.toml
|
||||
NX_VEGA_EXPLORER_URL=https://stagnet1.explorer.vega.xyz
|
||||
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
|
||||
NX_DELEGATIONS_PAGINATION=50
|
||||
NX_TRANCHES_SERVICE_URL=https://tranches-stagnet1-k8s.ops.vega.xyz
|
||||
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json
|
||||
NX_ANNOUNCEMENTS_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/announcements/fairground/announcements.json
|
||||
@@ -2,7 +2,7 @@
|
||||
NX_VEGA_ENV=TESTNET
|
||||
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks-internal/main/fairground/vegawallet-fairground.toml
|
||||
NX_VEGA_URL=https://api.n07.testnet.vega.xyz/graphql
|
||||
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.governance.vega.xyz","TESTNET":"https://governance.fairground.wtf","MAINNET":"https://governance.vega.xyz"}'
|
||||
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
|
||||
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||
|
||||
@@ -3,7 +3,7 @@ NX_VEGA_ENV=VALIDATOR_TESTNET
|
||||
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks/master/testnet2/testnet2.toml
|
||||
NX_VEGA_URL=https://api-validators-testnet.vega.rocks/graphql
|
||||
NX_VEGA_REST=https://api-validators-testnet.vega.rocks/
|
||||
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.governance.vega.xyz","TESTNET":"https://governance.fairground.wtf","MAINNET":"https://governance.vega.xyz"}'
|
||||
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
|
||||
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||
|
||||
@@ -58,15 +58,9 @@ export const AppLoader = ({ children }: { children: React.ReactElement }) => {
|
||||
token.decimals(),
|
||||
]);
|
||||
|
||||
const totalSupply = toBigNum(supply.toString(), decimals);
|
||||
const totalWallet = toBigNum(
|
||||
totalAssociatedWallet.toString(),
|
||||
decimals
|
||||
);
|
||||
const totalVesting = toBigNum(
|
||||
totalAssociatedVesting.toString(),
|
||||
decimals
|
||||
);
|
||||
const totalSupply = toBigNum(supply, decimals);
|
||||
const totalWallet = toBigNum(totalAssociatedWallet, decimals);
|
||||
const totalVesting = toBigNum(totalAssociatedVesting, decimals);
|
||||
|
||||
appDispatch({
|
||||
type: AppStateActionType.SET_TOKEN,
|
||||
|
||||
@@ -43,11 +43,6 @@ import type { InMemoryCacheConfig } from '@apollo/client';
|
||||
import { WithdrawalDialog } from '@vegaprotocol/withdraws';
|
||||
import { SplashLoader } from './components/splash-loader';
|
||||
import { ToastsManager } from './toasts-manager';
|
||||
import {
|
||||
TelemetryDialog,
|
||||
TELEMETRY_ON,
|
||||
} from './components/telemetry-dialog/telemetry-dialog';
|
||||
import { useLocalStorage } from '@vegaprotocol/react-helpers';
|
||||
|
||||
const cache: InMemoryCacheConfig = {
|
||||
typePolicies: {
|
||||
@@ -154,7 +149,6 @@ const Web3Container = ({
|
||||
<VegaWalletDialogs />
|
||||
<TransactionModal />
|
||||
<WithdrawalDialog />
|
||||
<TelemetryDialog />
|
||||
</>
|
||||
</BalanceManager>
|
||||
</AppLoader>
|
||||
@@ -183,10 +177,9 @@ const AppContainer = () => {
|
||||
const { config, loading, error } = useEthereumConfig();
|
||||
const { VEGA_ENV, GIT_COMMIT_HASH, GIT_BRANCH, ETHEREUM_PROVIDER_URL } =
|
||||
useEnvironment();
|
||||
const [telemetryOn] = useLocalStorage(TELEMETRY_ON);
|
||||
|
||||
useEffect(() => {
|
||||
if (ENV.dsn && telemetryOn) {
|
||||
if (ENV.dsn) {
|
||||
Sentry.init({
|
||||
dsn: ENV.dsn,
|
||||
integrations: [new Integrations.BrowserTracing()],
|
||||
@@ -209,10 +202,8 @@ const AppContainer = () => {
|
||||
});
|
||||
Sentry.setTag('branch', GIT_BRANCH);
|
||||
Sentry.setTag('commit', GIT_COMMIT_HASH);
|
||||
} else {
|
||||
Sentry.close();
|
||||
}
|
||||
}, [GIT_COMMIT_HASH, GIT_BRANCH, VEGA_ENV, telemetryOn]);
|
||||
}, [GIT_COMMIT_HASH, GIT_BRANCH, VEGA_ENV]);
|
||||
|
||||
return (
|
||||
<Router>
|
||||
|
||||
@@ -11,26 +11,11 @@ import {
|
||||
NavigationLink,
|
||||
NavigationList,
|
||||
NavigationTrigger,
|
||||
Icon,
|
||||
} from '@vegaprotocol/ui-toolkit';
|
||||
import { EthWallet } from '../eth-wallet';
|
||||
import { VegaWallet } from '../vega-wallet';
|
||||
import { useLocation, useMatch } from 'react-router-dom';
|
||||
import { useEffect } from 'react';
|
||||
import { useTelemetryDialog } from '../telemetry-dialog/telemetry-dialog';
|
||||
|
||||
export const SettingsLink = () => {
|
||||
const { open, isOpen, close } = useTelemetryDialog();
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => (isOpen ? close() : open())}
|
||||
aria-label="Open Telemetry Settings"
|
||||
>
|
||||
<Icon name="cog" className="w-5 h-5 mr-2" />
|
||||
</button>
|
||||
);
|
||||
};
|
||||
|
||||
export const Nav = ({ theme }: Pick<NavigationProps, 'theme'>) => {
|
||||
const { t } = useTranslation();
|
||||
@@ -57,12 +42,7 @@ export const Nav = ({ theme }: Pick<NavigationProps, 'theme'>) => {
|
||||
));
|
||||
|
||||
return (
|
||||
<Navigation
|
||||
appName="Governance"
|
||||
theme={theme}
|
||||
breakpoints={[458, 959]}
|
||||
actions={<SettingsLink />}
|
||||
>
|
||||
<Navigation appName="Governance" theme={theme} breakpoints={[458, 959]}>
|
||||
<NavigationList
|
||||
className="[.drawer-content_&]:border-b [.drawer-content_&]:border-b-vega-light-200 dark:[.drawer-content_&]:border-b-vega-dark-200 [.drawer-content_&]:pb-8 [.drawer-content_&]:mb-2"
|
||||
hide={[NavigationBreakpoint.Small]}
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
import { renderHook, act } from '@testing-library/react';
|
||||
import { useTelemetryDialog, TELEMETRY_ON } from './telemetry-dialog';
|
||||
|
||||
describe('useTelemetryDialog', () => {
|
||||
beforeEach(() => {
|
||||
localStorage.clear();
|
||||
});
|
||||
|
||||
it('should have the correct initial state based on localStorage', () => {
|
||||
localStorage.setItem(TELEMETRY_ON, 'true');
|
||||
|
||||
const { result } = renderHook(() => useTelemetryDialog());
|
||||
|
||||
expect(result.current.isOpen).toBe(false);
|
||||
expect(result.current.telemetryAccepted).toBe(true);
|
||||
});
|
||||
|
||||
it('should update localStorage and the telemetryAccepted state when setTelemetryAccepted is called', () => {
|
||||
const { result } = renderHook(() => useTelemetryDialog());
|
||||
|
||||
act(() => {
|
||||
result.current.setTelemetryAccepted(true);
|
||||
});
|
||||
|
||||
expect(result.current.telemetryAccepted).toBe(true);
|
||||
expect(localStorage.getItem(TELEMETRY_ON)).toBe('true');
|
||||
});
|
||||
|
||||
it('should update localStorage and the isOpen state when close is called', () => {
|
||||
const { result } = renderHook(() => useTelemetryDialog());
|
||||
|
||||
act(() => {
|
||||
result.current.close();
|
||||
});
|
||||
|
||||
expect(result.current.isOpen).toBe(false);
|
||||
});
|
||||
|
||||
it('should update the isOpen state when open is called', () => {
|
||||
const { result } = renderHook(() => useTelemetryDialog());
|
||||
|
||||
act(() => {
|
||||
result.current.open();
|
||||
});
|
||||
|
||||
expect(result.current.isOpen).toBe(true);
|
||||
});
|
||||
|
||||
it('should open the dialog if TELEMETRY_ON is not set', () => {
|
||||
const { result } = renderHook(() => useTelemetryDialog());
|
||||
expect(result.current.isOpen).toBe(true);
|
||||
});
|
||||
});
|
||||
@@ -1,102 +0,0 @@
|
||||
import { create } from 'zustand';
|
||||
import { useEffect } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useLocalStorage } from '@vegaprotocol/react-helpers';
|
||||
import { Dialog, Icon, Button } from '@vegaprotocol/ui-toolkit';
|
||||
import { Networks, useEnvironment } from '@vegaprotocol/environment';
|
||||
|
||||
type TelemetryDialogState = {
|
||||
isOpen: boolean;
|
||||
open: () => void;
|
||||
close: () => void;
|
||||
};
|
||||
|
||||
const useTelemetryDialogStore = create<TelemetryDialogState>((set) => ({
|
||||
isOpen: false,
|
||||
open: () => set({ isOpen: true }),
|
||||
close: () => set({ isOpen: false }),
|
||||
}));
|
||||
|
||||
export const TELEMETRY_ON = 'vega_telemetry_on';
|
||||
|
||||
export const useTelemetryDialog = () => {
|
||||
const [telemetryOn, setTelemetryOn] = useLocalStorage(TELEMETRY_ON);
|
||||
const { VEGA_ENV } = useEnvironment();
|
||||
const isMainnet = VEGA_ENV === Networks.MAINNET;
|
||||
|
||||
const defaultTelemetryAccepted = isMainnet ? 'false' : 'true';
|
||||
|
||||
const { isOpen, open, close } = useTelemetryDialogStore();
|
||||
|
||||
useEffect(() => {
|
||||
if (telemetryOn === null || telemetryOn === undefined) {
|
||||
open();
|
||||
setTelemetryOn(defaultTelemetryAccepted);
|
||||
}
|
||||
}, [defaultTelemetryAccepted, open, setTelemetryOn, telemetryOn]);
|
||||
|
||||
return {
|
||||
isOpen,
|
||||
open: open,
|
||||
close: close,
|
||||
telemetryAccepted: telemetryOn === 'true',
|
||||
setTelemetryAccepted: (value: boolean) => {
|
||||
setTelemetryOn(value.toString());
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export const TelemetryDialog = () => {
|
||||
const { t } = useTranslation();
|
||||
const { isOpen, open, close, telemetryAccepted, setTelemetryAccepted } =
|
||||
useTelemetryDialog();
|
||||
return (
|
||||
<Dialog
|
||||
title={t('ImproveVegaGovernance')}
|
||||
open={isOpen}
|
||||
onChange={(isOpen) => (isOpen ? open() : close())}
|
||||
size="small"
|
||||
>
|
||||
<div className="mt-6">{t('TelemetryModalIntro')}</div>
|
||||
<div className="flex items-center mt-6">
|
||||
<Icon name="eye-off" className="mr-6" size={6} />
|
||||
<div className="flex flex-col gap-1">
|
||||
<div className="font-semibold">{t('Anonymous')}</div>
|
||||
<div>{t('YourIdentityAnonymous')}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center mt-6">
|
||||
<Icon name="cog" className="mr-6" size={6} />
|
||||
<div className="flex flex-col gap-1">
|
||||
<div className="font-semibold">{t('Optional')}</div>
|
||||
<div>{t('OptOutOfTelemetry')}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="flex items-center mt-10 gap-4">
|
||||
<Button
|
||||
onClick={() => {
|
||||
setTelemetryAccepted(false);
|
||||
close();
|
||||
}}
|
||||
variant="default"
|
||||
data-testid="do-not-share-data-button"
|
||||
>
|
||||
{t('NoThanks')}
|
||||
</Button>
|
||||
|
||||
<Button
|
||||
onClick={() => {
|
||||
setTelemetryAccepted(true);
|
||||
close();
|
||||
}}
|
||||
variant="primary"
|
||||
data-testid="share-data-button"
|
||||
>
|
||||
{telemetryAccepted ? t('ContinueSharingData') : t('ShareData')}
|
||||
</Button>
|
||||
</div>
|
||||
</Dialog>
|
||||
);
|
||||
};
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
|
||||
export function useDocumentTitle(name?: string) {
|
||||
const base = 'VEGA Governance';
|
||||
const base = 'VEGA token';
|
||||
|
||||
React.useEffect(() => {
|
||||
if (name) {
|
||||
|
||||
@@ -21,10 +21,10 @@ export const useGetUserBalances = (account: string | undefined) => {
|
||||
token.allowance(account, config.staking_bridge_contract.address),
|
||||
]);
|
||||
|
||||
const balance = toBigNum(b.toString(), decimals);
|
||||
const walletBalance = toBigNum(w.toString(), decimals);
|
||||
const lien = toBigNum(stats.lien.toString(), decimals);
|
||||
const allowance = toBigNum(a.toString(), decimals);
|
||||
const balance = toBigNum(b, decimals);
|
||||
const walletBalance = toBigNum(w, decimals);
|
||||
const lien = toBigNum(stats.lien, decimals);
|
||||
const allowance = toBigNum(a, decimals);
|
||||
|
||||
return {
|
||||
balanceFormatted: balance,
|
||||
|
||||
@@ -21,14 +21,8 @@ export function useRefreshAssociatedBalances() {
|
||||
]);
|
||||
|
||||
updateBalances({
|
||||
walletAssociatedBalance: toBigNum(
|
||||
walletAssociatedBalance.toString(),
|
||||
decimals
|
||||
),
|
||||
vestingAssociatedBalance: toBigNum(
|
||||
vestingAssociatedBalance.toString(),
|
||||
decimals
|
||||
),
|
||||
walletAssociatedBalance: toBigNum(walletAssociatedBalance, decimals),
|
||||
vestingAssociatedBalance: toBigNum(vestingAssociatedBalance, decimals),
|
||||
});
|
||||
},
|
||||
[staking, vesting, updateBalances, decimals]
|
||||
|
||||
@@ -31,18 +31,12 @@ export const useRefreshBalances = (address: string) => {
|
||||
pubKey ? vesting.stake_balance(address, pubKey) : null,
|
||||
]);
|
||||
|
||||
const balance = toBigNum(b.toString(), decimals);
|
||||
const walletBalance = toBigNum(w.toString(), decimals);
|
||||
const lien = toBigNum(stats.lien.toString(), decimals);
|
||||
const allowance = toBigNum(a.toString(), decimals);
|
||||
const walletAssociatedBalance = toBigNum(
|
||||
walletStakeBalance ? walletStakeBalance.toString() : 0,
|
||||
decimals
|
||||
);
|
||||
const vestingAssociatedBalance = toBigNum(
|
||||
vestingStakeBalance ? vestingStakeBalance.toString() : 0,
|
||||
decimals
|
||||
);
|
||||
const balance = toBigNum(b, decimals);
|
||||
const walletBalance = toBigNum(w, decimals);
|
||||
const lien = toBigNum(stats.lien, decimals);
|
||||
const allowance = toBigNum(a, decimals);
|
||||
const walletAssociatedBalance = toBigNum(walletStakeBalance, decimals);
|
||||
const vestingAssociatedBalance = toBigNum(vestingStakeBalance, decimals);
|
||||
|
||||
updateBalances({
|
||||
balanceFormatted: balance,
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
"claim": "This code ({{code}}) entitles <bold>{{user}}</bold> to <bold>{{amount}} $VEGA</bold> tokens from <trancheLink>{{linkText}}</trancheLink> of the vesting contract. {{expiry}}.",
|
||||
"claimExpiry": "The code expires on {{date}}",
|
||||
"claimNoExpiry": "It has no expiry date",
|
||||
"showRedeem": "You'll be able to redeem your unlocked tokens at governance.vega.xyz/vesting",
|
||||
"showRedeem": "You'll be able to redeem your unlocked tokens at token.vega.xyz/vesting",
|
||||
"codeUsed": "Code already used",
|
||||
"codeUsedText": "Looks like that code has already been used. Check the Vesting page to see if you can redeem your tokens.",
|
||||
"codeExpired": "Code expired",
|
||||
@@ -86,7 +86,7 @@
|
||||
"Awaiting action in Ethereum wallet (e.g. MetaMask)": "Awaiting action in Ethereum wallet (e.g. MetaMask)",
|
||||
"Claim {amount} Vega": "Claim {{amount}} $VEGA",
|
||||
"Sorry. It is not possible to claim tokens in your country or region.": "It is not possible to claim tokens in your country or region.",
|
||||
"none redeemable": "Tokens in this tranche unlock on {{unlockDate}} and continue to unlock gradually until {{trancheEndDate}} when all tokens are unlocked. Come back to governance.vega.xyz to redeem your tokens once they begin to unlock.",
|
||||
"none redeemable": "Tokens in this tranche unlock on {{unlockDate}} and continue to unlock gradually until {{trancheEndDate}} when all tokens are unlocked. Come back to token.vega.xyz to redeem your tokens once they begin to unlock.",
|
||||
"partially redeemable": "Tokens in this tranche began to unlock on {{unlockDate}} and will continue to unlock gradually until {{trancheEndDate}} when all tokens are unlocked.",
|
||||
"fully redeemable": "Tokens in this tranche have fully unlocked and can be redeemed once claimed.",
|
||||
"This page can not be found, please check the URL and try again.": "This page can not be found, please check the URL and try again.",
|
||||
@@ -678,8 +678,6 @@
|
||||
"FilterProposalsDescription": "Filter by proposal ID or proposer ID",
|
||||
"Freeform proposal": "Freeform proposal",
|
||||
"NewProposal": "New proposal",
|
||||
"CreateProposalAndDownloadJSONToShare": "Create proposal and download JSON to share",
|
||||
"SubmitAnAgreedProposalFromTheForum": "Submit an agreed proposal from the forum",
|
||||
"ProposalTypeQuestion": "What type of proposal would you like to make?",
|
||||
"NetworkParameterProposal": "Update network parameter proposal",
|
||||
"parameter": "parameter",
|
||||
@@ -703,7 +701,6 @@
|
||||
"AssetID": "Asset ID",
|
||||
"Freeform": "Freeform",
|
||||
"RawProposal": "Let me choose (raw proposal)",
|
||||
"SubmitAgreedRawProposal": "Submit agreed raw proposal",
|
||||
"UseMin": "Use minimum",
|
||||
"UseMax": "Use maximum",
|
||||
"Proposal": "Proposal",
|
||||
@@ -802,14 +799,5 @@
|
||||
"associateVegaNow": "Associate $VEGA now",
|
||||
"disconnectedNotice": "You have been disconnected. Connect your ETH wallet to the {{correctNetwork}} network to use this app.",
|
||||
"connectAVegaWalletToVote": "Connect a Vega wallet with $VEGA tokens to vote on a proposal.",
|
||||
"findOutMoreAboutHowToVote": "Find out more about how to vote on Vega",
|
||||
"ImproveVegaGovernance": "Improve Vega governance",
|
||||
"TelemetryModalIntro": "Help us identify bugs and improve Vega Governance by sharing anonymous usage data.",
|
||||
"Anonymous": "Anonymous",
|
||||
"YourIdentityAnonymous": "Your identity is always anonymous on Vega",
|
||||
"Optional": "Optional",
|
||||
"OptOutOfTelemetry": "You can opt out any time via settings",
|
||||
"NoThanks": "No thanks",
|
||||
"ShareData": "Share data",
|
||||
"ContinueSharingData": "Continue sharing data"
|
||||
"findOutMoreAboutHowToVote": "Find out more about how to vote on Vega"
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
type="font/woff2"
|
||||
crossorigin="anonymous"
|
||||
/>
|
||||
<title>Vega Governance dApp</title>
|
||||
<title>Vega Token dApp</title>
|
||||
<script src="./assets/env-config.js"></script>
|
||||
</head>
|
||||
<body class="h-full">
|
||||
|
||||
@@ -6,14 +6,13 @@ import { ProposalsListItem } from '../proposals-list-item';
|
||||
import { ProtocolUpgradeProposalsListItem } from '../protocol-upgrade-proposals-list-item/protocol-upgrade-proposals-list-item';
|
||||
import { ProposalsListFilter } from '../proposals-list-filter';
|
||||
import Routes from '../../../routes';
|
||||
import { Button, VegaIcon, VegaIconNames } from '@vegaprotocol/ui-toolkit';
|
||||
import { Button } from '@vegaprotocol/ui-toolkit';
|
||||
import { Link } from 'react-router-dom';
|
||||
import { createDocsLinks, ExternalLinks } from '@vegaprotocol/utils';
|
||||
import { ExternalLinks } from '@vegaprotocol/utils';
|
||||
import { ExternalLink } from '@vegaprotocol/ui-toolkit';
|
||||
import type { ProposalQuery } from '../../proposal/__generated__/Proposal';
|
||||
import type { ProposalFieldsFragment } from '../../proposals/__generated__/Proposals';
|
||||
import type { ProtocolUpgradeProposalFieldsFragment } from '@vegaprotocol/proposals';
|
||||
import { useEnvironment } from '@vegaprotocol/environment';
|
||||
|
||||
interface ProposalsListProps {
|
||||
proposals: Array<ProposalFieldsFragment | ProposalQuery['proposal']>;
|
||||
@@ -36,7 +35,6 @@ export const ProposalsList = ({
|
||||
protocolUpgradeProposals,
|
||||
lastBlockHeight,
|
||||
}: ProposalsListProps) => {
|
||||
const { VEGA_DOCS_URL } = useEnvironment();
|
||||
const { t } = useTranslation();
|
||||
const [filterString, setFilterString] = useState('');
|
||||
const sortedProposals = proposals.reduce(
|
||||
@@ -83,18 +81,15 @@ export const ProposalsList = ({
|
||||
marginBottom={false}
|
||||
title={t('pageTitleProposals')}
|
||||
/>
|
||||
{VEGA_DOCS_URL && (
|
||||
<div className="xs:justify-self-end" data-testid="new-proposal-link">
|
||||
<ExternalLink href={createDocsLinks(VEGA_DOCS_URL).PROPOSALS_GUIDE}>
|
||||
<Button variant="primary" size="sm">
|
||||
<div className="flex items-center gap-1">
|
||||
{t('NewProposal')}
|
||||
<VegaIcon name={VegaIconNames.OPEN_EXTERNAL} size={13} />
|
||||
</div>
|
||||
</Button>
|
||||
</ExternalLink>
|
||||
</div>
|
||||
)}
|
||||
<Link
|
||||
className="xs:justify-self-end"
|
||||
data-testid="new-proposal-link"
|
||||
to={`${Routes.PROPOSALS}/propose`}
|
||||
>
|
||||
<Button variant="primary" size="sm">
|
||||
{t('NewProposal')}
|
||||
</Button>
|
||||
</Link>
|
||||
</div>
|
||||
<p className="mb-8">
|
||||
{t(
|
||||
|
||||
@@ -108,7 +108,7 @@ describe('Propose Freeform', () => {
|
||||
expect(screen.getByTestId('proposal-title')).toBeTruthy();
|
||||
expect(screen.getByTestId('proposal-description')).toBeTruthy();
|
||||
expect(screen.getByTestId('proposal-vote-deadline')).toBeTruthy();
|
||||
|
||||
expect(screen.getByTestId('proposal-submit')).toBeTruthy();
|
||||
expect(screen.getByTestId('proposal-download-json')).toBeTruthy();
|
||||
expect(screen.getByTestId('proposal-transaction-dialog')).toBeTruthy();
|
||||
});
|
||||
|
||||
@@ -9,6 +9,7 @@ import { useEnvironment } from '@vegaprotocol/environment';
|
||||
import {
|
||||
ProposalFormDescription,
|
||||
ProposalFormSubheader,
|
||||
ProposalFormSubmit,
|
||||
ProposalFormTitle,
|
||||
ProposalFormTransactionDialog,
|
||||
ProposalFormDownloadJson,
|
||||
@@ -47,7 +48,7 @@ export const ProposeFreeform = () => {
|
||||
const {
|
||||
register,
|
||||
handleSubmit,
|
||||
formState: { errors },
|
||||
formState: { isSubmitting, errors },
|
||||
setValue,
|
||||
watch,
|
||||
} = useForm<FreeformProposalFormFields>();
|
||||
@@ -164,6 +165,7 @@ export const ProposeFreeform = () => {
|
||||
voteMaxClose={params.governance_proposal_freeform_maxClose}
|
||||
/>
|
||||
|
||||
<ProposalFormSubmit isSubmitting={isSubmitting} />
|
||||
<ProposalFormDownloadJson downloadJson={viewJson} />
|
||||
<ProposalFormTransactionDialog
|
||||
finalizedProposal={finalizedProposal}
|
||||
|
||||
+1
-1
@@ -111,7 +111,7 @@ describe('Propose Network Parameter', () => {
|
||||
expect(screen.getByTestId('proposal-description')).toBeTruthy();
|
||||
expect(screen.getByTestId('proposal-vote-deadline')).toBeTruthy();
|
||||
expect(screen.getByTestId('proposal-enactment-deadline')).toBeTruthy();
|
||||
|
||||
expect(screen.getByTestId('proposal-submit')).toBeTruthy();
|
||||
expect(screen.getByTestId('proposal-download-json')).toBeTruthy();
|
||||
expect(screen.getByTestId('proposal-transaction-dialog')).toBeTruthy();
|
||||
});
|
||||
|
||||
+3
-1
@@ -16,6 +16,7 @@ import { useEnvironment } from '@vegaprotocol/environment';
|
||||
import {
|
||||
ProposalFormDescription,
|
||||
ProposalFormSubheader,
|
||||
ProposalFormSubmit,
|
||||
ProposalFormTitle,
|
||||
ProposalFormTransactionDialog,
|
||||
ProposalFormVoteAndEnactmentDeadline,
|
||||
@@ -89,7 +90,7 @@ export const ProposeNetworkParameter = () => {
|
||||
const {
|
||||
register,
|
||||
handleSubmit,
|
||||
formState: { errors },
|
||||
formState: { isSubmitting, errors },
|
||||
setValue,
|
||||
watch,
|
||||
} = useForm<NetworkParameterProposalFormFields>();
|
||||
@@ -309,6 +310,7 @@ export const ProposeNetworkParameter = () => {
|
||||
}
|
||||
/>
|
||||
|
||||
<ProposalFormSubmit isSubmitting={isSubmitting} />
|
||||
<ProposalFormDownloadJson downloadJson={viewJson} />
|
||||
<ProposalFormTransactionDialog
|
||||
finalizedProposal={finalizedProposal}
|
||||
|
||||
@@ -109,7 +109,7 @@ describe('Propose New Asset', () => {
|
||||
expect(screen.getByTestId('proposal-vote-deadline')).toBeTruthy();
|
||||
expect(screen.getByTestId('proposal-validation-deadline')).toBeTruthy();
|
||||
expect(screen.getByTestId('proposal-enactment-deadline')).toBeTruthy();
|
||||
|
||||
expect(screen.getByTestId('proposal-submit')).toBeTruthy();
|
||||
expect(screen.getByTestId('proposal-download-json')).toBeTruthy();
|
||||
expect(screen.getByTestId('proposal-transaction-dialog')).toBeTruthy();
|
||||
});
|
||||
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
import {
|
||||
ProposalFormDescription,
|
||||
ProposalFormSubheader,
|
||||
ProposalFormSubmit,
|
||||
ProposalFormTerms,
|
||||
ProposalFormTitle,
|
||||
ProposalFormTransactionDialog,
|
||||
@@ -58,7 +59,7 @@ export const ProposeNewAsset = () => {
|
||||
const {
|
||||
register,
|
||||
handleSubmit,
|
||||
formState: { errors },
|
||||
formState: { isSubmitting, errors },
|
||||
setValue,
|
||||
watch,
|
||||
} = useForm<NewAssetProposalFormFields>();
|
||||
@@ -225,6 +226,7 @@ export const ProposeNewAsset = () => {
|
||||
}
|
||||
/>
|
||||
|
||||
<ProposalFormSubmit isSubmitting={isSubmitting} />
|
||||
<ProposalFormDownloadJson downloadJson={viewJson} />
|
||||
<ProposalFormTransactionDialog
|
||||
finalizedProposal={finalizedProposal}
|
||||
|
||||
@@ -103,7 +103,7 @@ describe('Propose New Market', () => {
|
||||
expect(screen.getByTestId('proposal-terms')).toBeTruthy();
|
||||
expect(screen.getByTestId('proposal-vote-deadline')).toBeTruthy();
|
||||
expect(screen.getByTestId('proposal-enactment-deadline')).toBeTruthy();
|
||||
|
||||
expect(screen.getByTestId('proposal-submit')).toBeTruthy();
|
||||
expect(screen.getByTestId('proposal-download-json')).toBeTruthy();
|
||||
expect(screen.getByTestId('proposal-transaction-dialog')).toBeTruthy();
|
||||
});
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
import {
|
||||
ProposalFormDescription,
|
||||
ProposalFormSubheader,
|
||||
ProposalFormSubmit,
|
||||
ProposalFormTerms,
|
||||
ProposalFormTitle,
|
||||
ProposalFormTransactionDialog,
|
||||
@@ -56,7 +57,7 @@ export const ProposeNewMarket = () => {
|
||||
const {
|
||||
register,
|
||||
handleSubmit,
|
||||
formState: { errors },
|
||||
formState: { isSubmitting, errors },
|
||||
setValue,
|
||||
watch,
|
||||
} = useForm<NewMarketProposalFormFields>();
|
||||
@@ -207,6 +208,7 @@ export const ProposeNewMarket = () => {
|
||||
enactmentMaxClose={params.governance_proposal_market_maxEnact}
|
||||
/>
|
||||
|
||||
<ProposalFormSubmit isSubmitting={isSubmitting} />
|
||||
<ProposalFormDownloadJson downloadJson={viewJson} />
|
||||
<ProposalFormTransactionDialog
|
||||
finalizedProposal={finalizedProposal}
|
||||
|
||||
@@ -15,10 +15,10 @@ describe('Propose', () => {
|
||||
expect(baseElement).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should render the heading, proposals title and options', () => {
|
||||
it('should render the heading, proposal type question and options', () => {
|
||||
renderComponent();
|
||||
expect(
|
||||
screen.getByText('Create proposal and download JSON to share')
|
||||
screen.getByText('What type of proposal would you like to make?')
|
||||
).toBeTruthy();
|
||||
expect(screen.getByText('Network parameter')).toBeTruthy();
|
||||
expect(screen.getByText('New market')).toBeTruthy();
|
||||
@@ -26,9 +26,6 @@ describe('Propose', () => {
|
||||
expect(screen.getByText('New asset')).toBeTruthy();
|
||||
expect(screen.getByText('Update asset')).toBeTruthy();
|
||||
expect(screen.getByText('Freeform')).toBeTruthy();
|
||||
expect(
|
||||
screen.getByText('Submit an agreed proposal from the forum')
|
||||
).toBeTruthy();
|
||||
expect(screen.getByText('Submit agreed raw proposal')).toBeTruthy();
|
||||
expect(screen.getByText('Let me choose (raw proposal)')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -39,8 +39,8 @@ export const Propose = () => {
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2 className="text-h5">{t('CreateProposalAndDownloadJSONToShare')}</h2>
|
||||
<ul className="mb-6">
|
||||
<h2 className="text-h5">{t('ProposalTypeQuestion')}</h2>
|
||||
<ul>
|
||||
<li>
|
||||
<p>
|
||||
<Link
|
||||
@@ -101,14 +101,17 @@ export const Propose = () => {
|
||||
</Link>
|
||||
</p>
|
||||
</li>
|
||||
<li>
|
||||
<p>
|
||||
<Link
|
||||
className="underline"
|
||||
to={`${Routes.PROPOSALS}/propose/raw`}
|
||||
>
|
||||
{t('RawProposal')}
|
||||
</Link>
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<h2 className="text-h5">{t('SubmitAnAgreedProposalFromTheForum')}</h2>
|
||||
<p>
|
||||
<Link className="underline" to={`${Routes.PROPOSALS}/propose/raw`}>
|
||||
{t('SubmitAgreedRawProposal')}
|
||||
</Link>
|
||||
</p>
|
||||
</section>
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -18,8 +18,10 @@ import { useProposalSubmit } from '@vegaprotocol/proposals';
|
||||
import {
|
||||
ProposalFormSubmit,
|
||||
ProposalFormTransactionDialog,
|
||||
ProposalFormDownloadJson,
|
||||
} from '../../components/propose';
|
||||
import { ProposalRawMinRequirements } from './proposal-raw-min-requirements';
|
||||
import { downloadJson } from '../../../../lib/download-json';
|
||||
|
||||
export interface RawProposalFormFields {
|
||||
rawProposalData: string;
|
||||
@@ -45,6 +47,7 @@ export const ProposeRaw = () => {
|
||||
register,
|
||||
handleSubmit,
|
||||
formState: { isSubmitting, errors },
|
||||
watch,
|
||||
} = useForm<RawProposalFormFields>();
|
||||
const { finalizedProposal, submit, Dialog } = useProposalSubmit();
|
||||
|
||||
@@ -54,6 +57,11 @@ export const ProposeRaw = () => {
|
||||
await submit(JSON.parse(fields.rawProposalData));
|
||||
};
|
||||
|
||||
const viewJson = () => {
|
||||
const formData = watch();
|
||||
downloadJson(JSON.stringify(formData), 'vega-raw-proposal');
|
||||
};
|
||||
|
||||
return (
|
||||
<AsyncRenderer
|
||||
loading={networkParamsLoading}
|
||||
@@ -124,6 +132,7 @@ export const ProposeRaw = () => {
|
||||
)}
|
||||
</FormGroup>
|
||||
<ProposalFormSubmit isSubmitting={isSubmitting} />
|
||||
<ProposalFormDownloadJson downloadJson={viewJson} />
|
||||
<ProposalFormTransactionDialog
|
||||
finalizedProposal={finalizedProposal}
|
||||
TransactionDialog={Dialog}
|
||||
|
||||
+1
-1
@@ -110,7 +110,7 @@ describe('Propose Update Asset', () => {
|
||||
expect(screen.getByTestId('proposal-terms')).toBeTruthy();
|
||||
expect(screen.getByTestId('proposal-vote-deadline')).toBeTruthy();
|
||||
expect(screen.getByTestId('proposal-enactment-deadline')).toBeTruthy();
|
||||
|
||||
expect(screen.getByTestId('proposal-submit')).toBeTruthy();
|
||||
expect(screen.getByTestId('proposal-download-json')).toBeTruthy();
|
||||
expect(screen.getByTestId('proposal-transaction-dialog')).toBeTruthy();
|
||||
});
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
import {
|
||||
ProposalFormDescription,
|
||||
ProposalFormSubheader,
|
||||
ProposalFormSubmit,
|
||||
ProposalFormTerms,
|
||||
ProposalFormTitle,
|
||||
ProposalFormTransactionDialog,
|
||||
@@ -56,7 +57,7 @@ export const ProposeUpdateAsset = () => {
|
||||
const {
|
||||
register,
|
||||
handleSubmit,
|
||||
formState: { errors },
|
||||
formState: { isSubmitting, errors },
|
||||
setValue,
|
||||
watch,
|
||||
} = useForm<UpdateAssetProposalFormFields>();
|
||||
@@ -211,6 +212,7 @@ export const ProposeUpdateAsset = () => {
|
||||
}
|
||||
/>
|
||||
|
||||
<ProposalFormSubmit isSubmitting={isSubmitting} />
|
||||
<ProposalFormDownloadJson downloadJson={viewJson} />
|
||||
<ProposalFormTransactionDialog
|
||||
finalizedProposal={finalizedProposal}
|
||||
|
||||
+1
-1
@@ -261,7 +261,7 @@ describe('Propose Update Market', () => {
|
||||
expect(screen.getByTestId('proposal-terms')).toBeTruthy();
|
||||
expect(screen.getByTestId('proposal-vote-deadline')).toBeTruthy();
|
||||
expect(screen.getByTestId('proposal-enactment-deadline')).toBeTruthy();
|
||||
|
||||
expect(screen.getByTestId('proposal-submit')).toBeTruthy();
|
||||
expect(screen.getByTestId('proposal-download-json')).toBeTruthy();
|
||||
expect(screen.getByTestId('proposal-transaction-dialog')).toBeTruthy();
|
||||
});
|
||||
|
||||
+3
-1
@@ -17,6 +17,7 @@ import {
|
||||
ProposalFormDescription,
|
||||
ProposalFormDownloadJson,
|
||||
ProposalFormSubheader,
|
||||
ProposalFormSubmit,
|
||||
ProposalFormTerms,
|
||||
ProposalFormTitle,
|
||||
ProposalFormTransactionDialog,
|
||||
@@ -103,7 +104,7 @@ export const ProposeUpdateMarket = () => {
|
||||
const {
|
||||
register,
|
||||
handleSubmit,
|
||||
formState: { errors },
|
||||
formState: { isSubmitting, errors },
|
||||
setValue,
|
||||
watch,
|
||||
} = useForm<UpdateMarketProposalFormFields>();
|
||||
@@ -316,6 +317,7 @@ export const ProposeUpdateMarket = () => {
|
||||
}
|
||||
/>
|
||||
|
||||
<ProposalFormSubmit isSubmitting={isSubmitting} />
|
||||
<ProposalFormDownloadJson downloadJson={viewJson} />
|
||||
<ProposalFormTransactionDialog
|
||||
finalizedProposal={finalizedProposal}
|
||||
|
||||
@@ -34,9 +34,8 @@ export const useUserTrancheBalances = (address: string | undefined) => {
|
||||
vesting.get_vested_for_tranche(address, tId),
|
||||
]);
|
||||
|
||||
// Convert t and v EthersBigNumbers to regular BigNumbers
|
||||
const total = toBigNum(t.toString(), decimals);
|
||||
const vested = toBigNum(v.toString(), decimals);
|
||||
const total = toBigNum(t, decimals);
|
||||
const vested = toBigNum(v, decimals);
|
||||
|
||||
return {
|
||||
id: tId,
|
||||
|
||||
@@ -54,7 +54,7 @@ export const WalletAssociate = ({
|
||||
address,
|
||||
ethereumConfig.staking_bridge_contract.address
|
||||
);
|
||||
const allowance = toBigNum(a.toString(), decimals);
|
||||
const allowance = toBigNum(a, decimals);
|
||||
setAllowance(allowance);
|
||||
}
|
||||
};
|
||||
|
||||
+1
-1
@@ -131,7 +131,7 @@ export const ConsensusValidatorsTable = ({
|
||||
const gridRef = useRef<AgGridReact | null>(null);
|
||||
|
||||
const nodes = useMemo(() => {
|
||||
if (!data) return [];
|
||||
if (!data || !previousEpochData) return [];
|
||||
let canonisedNodes = data
|
||||
.sort((a, b) => {
|
||||
const aVotingPower = new BigNumber(a.rankingScore.votingPower);
|
||||
|
||||
@@ -6,7 +6,6 @@ import '@testing-library/jest-dom';
|
||||
import dev from './i18n/translations/dev.json';
|
||||
import i18n from 'i18next';
|
||||
import { initReactI18next } from 'react-i18next';
|
||||
import ResizeObserver from 'resize-observer-polyfill';
|
||||
|
||||
// Set up i18n instance so that components have the correct default
|
||||
// en translations
|
||||
@@ -23,5 +22,3 @@ i18n.use(initReactI18next).init({
|
||||
ns: ['translations'],
|
||||
defaultNS: 'translations',
|
||||
});
|
||||
|
||||
global.ResizeObserver = ResizeObserver;
|
||||
|
||||
@@ -40,11 +40,6 @@
|
||||
line-height: calc(min(var(--ag-line-height, 26px), 26px) - 4px);
|
||||
}
|
||||
|
||||
.vega-ag-grid .ag-row {
|
||||
border-width: 1px 0;
|
||||
border-bottom: 1px solid transparent;
|
||||
}
|
||||
|
||||
/* Dark variables */
|
||||
.ag-theme-balham-dark {
|
||||
--ag-background-color: theme(colors.black);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# App configuration variables
|
||||
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks/master/mainnet1/mainnet1.toml
|
||||
NX_VEGA_URL=https://api.vega.community/graphql
|
||||
NX_VEGA_URL=https://api.vega.xyz/query
|
||||
NX_VEGA_ENV=MAINNET
|
||||
NX_VEGA_NETWORKS={\"MAINNET\":\"https://alpha.console.vega.xyz\",\"TESTNET\":\"https://console.fairground.wtf\"}
|
||||
NX_ETHEREUM_PROVIDER_URL=https://mainnet.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# App configuration variables
|
||||
NX_VEGA_CONFIG_URL=https://raw.githubusercontent.com/vegaprotocol/networks/master/mainnet1/mainnet1.toml
|
||||
NX_VEGA_URL=https://api.vega.community/graphql
|
||||
NX_VEGA_URL=https://api.vega.xyz/query
|
||||
NX_VEGA_NETWORKS='{"TESTNET":"https://multisig-signer.fairground.wtf","MAINNET":"https://multisig-signer.vega.xyz"}'
|
||||
NX_VEGA_ENV=MAINNET
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
"tranche_end": "2023-05-20T00:00:00.000Z",
|
||||
"total_added": "19242.125",
|
||||
"total_removed": "1523.8177488329475",
|
||||
"locked_amount": "6891.9471601080244395475",
|
||||
"locked_amount": "7371.31511443865825548625",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "188",
|
||||
@@ -4861,7 +4861,7 @@
|
||||
"tranche_end": "2023-12-05T00:00:00.000Z",
|
||||
"total_added": "86666.297",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "49802.2753121154213651374",
|
||||
"locked_amount": "49979.7329096604869903443",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "86666.297",
|
||||
@@ -4927,7 +4927,7 @@
|
||||
"tranche_end": "2023-06-01T00:00:00.000Z",
|
||||
"total_added": "2500",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "312.4325905575906",
|
||||
"locked_amount": "322.698698870573775",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "2500",
|
||||
@@ -4960,7 +4960,7 @@
|
||||
"tranche_end": "2023-11-01T00:00:00.000Z",
|
||||
"total_added": "15000.000000000000015",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "14327.0455917874395143270455917874395",
|
||||
"locked_amount": "14387.9727128623185143879727128623185",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "1.5e-14",
|
||||
@@ -5048,7 +5048,7 @@
|
||||
"tranche_end": "2023-09-01T00:00:00.000Z",
|
||||
"total_added": "17500",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "10913.25608896940375",
|
||||
"locked_amount": "10984.33773022342925",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "12500",
|
||||
@@ -5315,7 +5315,7 @@
|
||||
"tranche_end": "2023-08-01T00:00:00.000Z",
|
||||
"total_added": "37500",
|
||||
"total_removed": "18077.0118744",
|
||||
"locked_amount": "17350.5026089625535",
|
||||
"locked_amount": "17505.34501611418125",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "7500",
|
||||
@@ -5734,7 +5734,7 @@
|
||||
"tranche_end": "2023-12-05T00:00:00.000Z",
|
||||
"total_added": "129999.45",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "49756.837002255673748325",
|
||||
"locked_amount": "49934.132692071551825937",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "129999.45",
|
||||
@@ -5767,7 +5767,7 @@
|
||||
"tranche_end": "2024-04-01T00:00:00.000Z",
|
||||
"total_added": "54144.7663",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "48485.46842731635829207292",
|
||||
"locked_amount": "48596.0321414648663214997",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "54144.7663",
|
||||
@@ -5800,7 +5800,7 @@
|
||||
"tranche_end": "2023-09-03T00:00:00.000Z",
|
||||
"total_added": "62600",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "20022.5830035514954",
|
||||
"locked_amount": "20150.76253805175029",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "10000",
|
||||
@@ -5993,7 +5993,7 @@
|
||||
"tranche_end": "2023-09-17T00:00:00.000Z",
|
||||
"total_added": "5000",
|
||||
"total_removed": "0",
|
||||
"locked_amount": "1791.028665651953",
|
||||
"locked_amount": "1801.26664764079125",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "5000",
|
||||
@@ -7062,7 +7062,7 @@
|
||||
"tranche_end": "2023-06-02T00:00:00.000Z",
|
||||
"total_added": "1939928.38",
|
||||
"total_removed": "1709370.7872515768348",
|
||||
"locked_amount": "126202.1342632826843379468",
|
||||
"locked_amount": "130174.32462609789781957",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "1852091.69",
|
||||
@@ -40934,7 +40934,7 @@
|
||||
"tranche_end": "2023-06-05T00:00:00.000Z",
|
||||
"total_added": "3732368.4671",
|
||||
"total_removed": "715655.108029600523393",
|
||||
"locked_amount": "218430.066175628697078272948",
|
||||
"locked_amount": "224533.9397934779571663606186",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "1998.95815",
|
||||
@@ -42327,7 +42327,7 @@
|
||||
"tranche_end": "2023-12-05T00:00:00.000Z",
|
||||
"total_added": "15870102.715470999700000001",
|
||||
"total_removed": "871680.07831804700259352",
|
||||
"locked_amount": "6074226.5757489411253544394273819693295485",
|
||||
"locked_amount": "6095870.51969169065811272227952994009813466",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "16249.93",
|
||||
@@ -59070,7 +59070,7 @@
|
||||
"tranche_end": "2023-06-05T00:00:00.000Z",
|
||||
"total_added": "472355.6199999996",
|
||||
"total_removed": "44479.0535455583416",
|
||||
"locked_amount": "34611.49258501772999518148756976",
|
||||
"locked_amount": "35578.671272696564429696212379508",
|
||||
"deposits": [
|
||||
{
|
||||
"amount": "3000",
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user