Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
15ee4d0a57 |
@@ -11,7 +11,7 @@ on:
|
|||||||
type: choice
|
type: choice
|
||||||
options:
|
options:
|
||||||
- explorer-e2e
|
- explorer-e2e
|
||||||
- governance-e2e
|
- token-e2e
|
||||||
- trading-e2e
|
- trading-e2e
|
||||||
tags:
|
tags:
|
||||||
description: 'Test tags to run'
|
description: 'Test tags to run'
|
||||||
|
|||||||
@@ -10,5 +10,5 @@ jobs:
|
|||||||
uses: ./.github/workflows/cypress-run.yml
|
uses: ./.github/workflows/cypress-run.yml
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
with:
|
with:
|
||||||
projects: '["explorer-e2e","governance-e2e","trading-e2e"]'
|
projects: '["explorer-e2e","token-e2e","trading-e2e"]'
|
||||||
tags: '@smoke @regression @slow'
|
tags: '@smoke @regression @slow'
|
||||||
|
|||||||
@@ -42,10 +42,10 @@ jobs:
|
|||||||
affected=$(yarn nx print-affected --base=${{ env.NX_BASE }} --head=${{ env.NX_HEAD }} --select=projects)
|
affected=$(yarn nx print-affected --base=${{ env.NX_BASE }} --head=${{ env.NX_HEAD }} --select=projects)
|
||||||
echo -n "Affected projects: $affected"
|
echo -n "Affected projects: $affected"
|
||||||
projects=""
|
projects=""
|
||||||
if [[ $affected == *"governance"* ]]; then projects+='"governance-e2e" '; fi
|
if [[ $affected == *"token"* ]]; then projects+='"token-e2e" '; fi
|
||||||
if [[ $affected == *"trading"* ]]; then projects+='"trading-e2e" '; fi
|
if [[ $affected == *"trading"* ]]; then projects+='"trading-e2e" '; fi
|
||||||
if [[ $affected == *"explorer"* ]]; then projects+='"explorer-e2e" '; fi
|
if [[ $affected == *"explorer"* ]]; then projects+='"explorer-e2e" '; fi
|
||||||
if [[ -z "$projects" ]]; then projects+='"governance-e2e" "trading-e2e" "explorer-e2e" '; fi
|
if [[ -z "$projects" ]]; then projects+='"token-e2e" "trading-e2e" "explorer-e2e" '; fi
|
||||||
projects=${projects%?}
|
projects=${projects%?}
|
||||||
projects=[${projects// /,}]
|
projects=[${projects// /,}]
|
||||||
echo PROJECTS=$projects >> $GITHUB_ENV
|
echo PROJECTS=$projects >> $GITHUB_ENV
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ jobs:
|
|||||||
run: ls -alsh /home/runner/.vegacapsule/testnet/logs/
|
run: ls -alsh /home/runner/.vegacapsule/testnet/logs/
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v3
|
||||||
if: ${{ failure() }}
|
if: ${{ always() }}
|
||||||
with:
|
with:
|
||||||
name: logs-${{ matrix.project }}
|
name: logs-${{ matrix.project }}
|
||||||
path: /home/runner/.vegacapsule/testnet/logs
|
path: /home/runner/.vegacapsule/testnet/logs
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ on:
|
|||||||
- react-helpers
|
- react-helpers
|
||||||
- tailwindcss-config
|
- tailwindcss-config
|
||||||
- types
|
- types
|
||||||
- utils
|
|
||||||
- i18n
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish:
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ In order to setup and run vegawallet for e2e capsule tests, in a separate termin
|
|||||||
bash setup-vegawallet.sh
|
bash setup-vegawallet.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
3. copy generated `api-token` and paste the token into `CYPRESS_VEGA_WALLET_API_TOKEN` environment variable in either `apps/governance-e2e/.env` or `apps/explorer-e2e/.env` depending on which project needs testing.
|
3. copy generated `api-token` and paste the token into `CYPRESS_VEGA_WALLET_API_TOKEN` environment variable in either `apps/token-e2e/.env` or `apps/explorer-e2e/.env` depending on which project needs testing.
|
||||||
|
|
||||||
Note: The script is only needed if capsule was built for first time or fresh. To run existing wallet service for capsule:
|
Note: The script is only needed if capsule was built for first time or fresh. To run existing wallet service for capsule:
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
NX_TENDERMINT_URL=https://tm.n00.stagnet3.vega.xyz
|
NX_TENDERMINT_URL=https://tm.n00.stagnet3.vega.xyz
|
||||||
NX_TENDERMINT_WEBSOCKET_URL=wss://tm.n00.stagnet3.vega.xyz/websocket
|
NX_TENDERMINT_WEBSOCKET_URL=wss://tm.n00.stagnet3.vega.xyz/websocket
|
||||||
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet3-network.json
|
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet3-network.json
|
||||||
NX_VEGA_NETWORKS='{"SANDBOX":"https://sandbox.explorer.vega.xyz","STAGNET1":"https://stagnet1.token.vega.xyz", "STAGNET3":"https://stagnet3.explorer.vega.xyz","VALIDATOR_TESTNET":"https://validator-testnet.fairground.wtf","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
|
NX_VEGA_NETWORKS={\"MAINNET"\:\"https://explorer.vega.xyz"\,\"TESTNET\":\"https://explorer.fairground.wtf\"}
|
||||||
NX_VEGA_ENV=STAGNET3
|
NX_VEGA_ENV=STAGNET3
|
||||||
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||||
NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
|
NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
# App configuration variables
|
# App configuration variables
|
||||||
NX_TENDERMINT_URL=http://localhost:26617
|
NX_TENDERMINT_URL=http://localhost:26617
|
||||||
NX_TENDERMINT_WEBSOCKET_URL=wss://localhost:26617/websocket
|
NX_TENDERMINT_WEBSOCKET_URL=wss://localhost:26617/websocket
|
||||||
|
NX_VEGA_NETWORKS={\"MAINNET"\:\"https://explorer.vega.xyz"\,\"TESTNET\":\"https://explorer.fairground.wtf\"}
|
||||||
NX_VEGA_ENV=CUSTOM
|
NX_VEGA_ENV=CUSTOM
|
||||||
|
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||||
|
|
||||||
# App flags
|
# App flags
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
# App configuration variables
|
# App configuration variables
|
||||||
NX_TENDERMINT_URL=https://tm.be.devnet1.vega.xyz/tm
|
NX_TENDERMINT_URL=https://tm.be.devnet1.vega.xyz/tm
|
||||||
NX_TENDERMINT_WEBSOCKET_URL=wss://be.devnet1.vega.xyz/websocket
|
NX_TENDERMINT_WEBSOCKET_URL=wss://tm.be.devnet1.vega.xyz/websocket
|
||||||
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/devnet-network.json
|
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/devnet-network.json
|
||||||
|
NX_VEGA_NETWORKS={\"MAINNET"\:\"https://explorer.vega.xyz"\,\"TESTNET\":\"https://explorer.fairground.wtf\"}
|
||||||
NX_VEGA_ENV=DEVNET
|
NX_VEGA_ENV=DEVNET
|
||||||
|
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||||
NX_BLOCK_EXPLORER=https://be.devnet1.vega.xyz/rest
|
NX_BLOCK_EXPLORER=https://be.devnet1.vega.xyz/rest
|
||||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||||
NX_VEGA_GOVERNANCE_URL=https://dev.token.vega.xyz
|
NX_VEGA_GOVERNANCE_URL=https://dev.token.vega.xyz
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
# App configuration variables
|
# App configuration variables
|
||||||
NX_TENDERMINT_URL=https://be.explorer.vega.xyz
|
NX_TENDERMINT_URL=https://be.explorer.vega.xyz
|
||||||
NX_TENDERMINT_WEBSOCKET_URL=wss://be.explorer.vega.xyz/websocket
|
NX_TENDERMINT_WEBSOCKET_URL=wss://be.explorer.vega.xyz
|
||||||
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/mainnet-network.json
|
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/mainnet-network.json
|
||||||
|
NX_VEGA_NETWORKS={\"MAINNET"\:\"https://explorer.vega.xyz"\,\"TESTNET\":\"https://explorer.fairground.wtf\"}
|
||||||
NX_VEGA_ENV=MAINNET
|
NX_VEGA_ENV=MAINNET
|
||||||
|
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||||
NX_BLOCK_EXPLORER=https://be.explorer.vega.xyz/rest/
|
NX_BLOCK_EXPLORER=https://be.explorer.vega.xyz/rest/
|
||||||
NX_ETHERSCAN_URL=https://etherscan.io
|
NX_ETHERSCAN_URL=https://etherscan.io
|
||||||
NX_VEGA_GOVERNANCE_URL=https://token.vega.xyz
|
NX_VEGA_GOVERNANCE_URL=https://token.vega.xyz
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
# App configuration variables
|
# App configuration variables
|
||||||
NX_TENDERMINT_URL=https://tm.be.mainnet-mirror.vega.xyz
|
NX_TENDERMINT_URL=https://tm.be.mainnet-mirror.vega.xyz
|
||||||
NX_TENDERMINT_WEBSOCKET_URL=wss://be.mainnet-mirror.vega.xyz/websocket
|
NX_TENDERMINT_WEBSOCKET_URL=https://tm.be.mainnet-mirror.vega.xyz
|
||||||
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/mirror-network.json
|
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/mirror-network.json
|
||||||
|
NX_VEGA_NETWORKS='{"DEVNET":"https://dev.token.vega.xyz","STAGNET3":"https://stagnet3.token.vega.xyz","TESTNET":"https://token.fairground.wtf","MAINNET":"https://token.vega.xyz"}'
|
||||||
NX_VEGA_ENV=MIRROR
|
NX_VEGA_ENV=MIRROR
|
||||||
|
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||||
NX_BLOCK_EXPLORER=https://be.mainnet-mirror.vega.xyz/rest/
|
NX_BLOCK_EXPLORER=https://be.mainnet-mirror.vega.xyz/rest/
|
||||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||||
NX_VEGA_GOVERNANCE_URL=https://mainnet-mirror.token.vega.xyz
|
NX_VEGA_GOVERNANCE_URL=https://mainnet-mirror.token.vega.xyz
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ NX_VEGA_EXPLORER_URL=https://sandbox.explorer.vega.xyz
|
|||||||
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
|
NX_VEGA_DOCS_URL=https://docs.vega.xyz/testnet
|
||||||
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
||||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||||
|
NX_VEGA_NETWORKS={\"MAINNET"\:\"https://explorer.vega.xyz"\,\"TESTNET\":\"https://explorer.fairground.wtf\"}
|
||||||
NX_TENDERMINT_URL=https://tm.sandbox.vega.xyz
|
NX_TENDERMINT_URL=https://tm.sandbox.vega.xyz
|
||||||
NX_TENDERMINT_WEBSOCKET_URL=wss://be.sandbox.vega.xyz/websocket
|
NX_TENDERMINT_WEBSOCKET_URL=wss://tm.sandbox.vega.xyz/websocket
|
||||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||||
NX_VEGA_GOVERNANCE_URL=https://sandbox.token.vega.xyz
|
NX_VEGA_GOVERNANCE_URL=https://sandbox.token.vega.xyz
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
|
|||||||
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet1-network.json
|
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet1-network.json
|
||||||
NX_VEGA_ENV=STAGNET1
|
NX_VEGA_ENV=STAGNET1
|
||||||
NX_VEGA_EXPLORER_URL=https://stagnet1.explorer.vega.xyz
|
NX_VEGA_EXPLORER_URL=https://stagnet1.explorer.vega.xyz
|
||||||
|
NX_VEGA_NETWORKS={\"MAINNET"\:\"https://explorer.vega.xyz"\,\"TESTNET\":\"https://explorer.fairground.wtf\"}
|
||||||
NX_VEGA_TOKEN_URL=https://stagnet1.token.vega.xyz
|
NX_VEGA_TOKEN_URL=https://stagnet1.token.vega.xyz
|
||||||
NX_VEGA_WALLET_URL=http://localhost:1789
|
NX_VEGA_WALLET_URL=http://localhost:1789
|
||||||
NX_TENDERMINT_URL=https://tm.n01.stagnet1.vega.xyz
|
NX_TENDERMINT_URL=https://tm.n01.stagnet1.vega.xyz
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
NX_TENDERMINT_URL=https://tm.n00.stagnet3.vega.xyz
|
NX_TENDERMINT_URL=https://tm.n00.stagnet3.vega.xyz
|
||||||
NX_TENDERMINT_WEBSOCKET_URL=wss://be.stagnet3.vega.xyz/websocket
|
NX_TENDERMINT_WEBSOCKET_URL=wss://tm.n00.stagnet3.vega.xyz/websocket
|
||||||
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet3-network.json
|
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/stagnet3-network.json
|
||||||
|
NX_VEGA_NETWORKS={\"MAINNET"\:\"https://explorer.vega.xyz"\,\"TESTNET\":\"https://explorer.fairground.wtf\"}
|
||||||
NX_VEGA_ENV=STAGNET3
|
NX_VEGA_ENV=STAGNET3
|
||||||
|
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||||
NX_BLOCK_EXPLORER=https://be.stagnet3.vega.xyz/rest
|
NX_BLOCK_EXPLORER=https://be.stagnet3.vega.xyz/rest
|
||||||
NX_VEGA_GOVERNANCE_URL=https://stagnet3.token.vega.xyz
|
NX_VEGA_GOVERNANCE_URL=https://stagnet3.token.vega.xyz
|
||||||
NX_VEGA_REPO_URL=https://github.com/vegaprotocol/vega-dev-releases/releases/
|
NX_VEGA_REPO_URL=https://github.com/vegaprotocol/vega-dev-releases/releases/
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
# App configuration variables
|
# App configuration variables
|
||||||
NX_TENDERMINT_URL=https://tm.be.testnet.vega.xyz
|
NX_TENDERMINT_URL=https://tm.be.testnet.vega.xyz
|
||||||
NX_BLOCK_EXPLORER=https://be.testnet.vega.xyz/rest
|
NX_BLOCK_EXPLORER=https://be.testnet.vega.xyz/rest
|
||||||
NX_TENDERMINT_WEBSOCKET_URL=wss://be.testnet.vega.xyz/websocket
|
NX_TENDERMINT_WEBSOCKET_URL=wss://tm.be.testnet.vega.xyz/websocket/
|
||||||
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/testnet-network.json
|
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/testnet-network.json
|
||||||
|
NX_VEGA_NETWORKS={\"MAINNET"\:\"https://explorer.vega.xyz"\,\"TESTNET\":\"https://explorer.fairground.wtf\"}
|
||||||
NX_VEGA_ENV=TESTNET
|
NX_VEGA_ENV=TESTNET
|
||||||
|
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||||
NX_VEGA_URL=https://api.n07.testnet.vega.xyz/graphql
|
NX_VEGA_URL=https://api.n07.testnet.vega.xyz/graphql
|
||||||
NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
|
NX_HOSTED_WALLET_URL=https://wallet.testnet.vega.xyz
|
||||||
|
NX_VEGA_NETWORKS={}
|
||||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||||
NX_VEGA_GOVERNANCE_URL=https://token.fairground.wtf
|
NX_VEGA_GOVERNANCE_URL=https://token.fairground.wtf
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
# App configuration variables
|
|
||||||
NX_VEGA_ENV=VALIDATOR_TESTNET
|
|
||||||
NX_VEGA_CONFIG_URL=https://static.vega.xyz/assets/validator-testnet-network.json
|
|
||||||
NX_VEGA_URL=https://api.validators-testnet.vega.xyz/graphql
|
|
||||||
NX_VEGA_REST=https://api.validators-testnet.vega.xyz/
|
|
||||||
NX_ETHEREUM_PROVIDER_URL=https://sepolia.infura.io/v3/4f846e79e13f44d1b51bbd7ed9edefb8
|
|
||||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
|
||||||
|
|
||||||
NX_VEGA_GOVERNANCE_URL=https://validator-testnet.governance.vega.xyz
|
|
||||||
NX_TENDERMINT_URL=https://tm.be.validators-testnet.vega.xyz
|
|
||||||
NX_BLOCK_EXPLORER=https://be.validators-testnet.vega.xyz/rest
|
|
||||||
NX_TENDERMINT_WEBSOCKET_URL=wss://be.validators-testnet.vega.xyz/websocket
|
|
||||||
@@ -2,5 +2,6 @@
|
|||||||
NX_TENDERMINT_URL=http://localhost:26607/
|
NX_TENDERMINT_URL=http://localhost:26607/
|
||||||
NX_TENDERMINT_WEBSOCKET_URL=wss://localhost:26607/websocket
|
NX_TENDERMINT_WEBSOCKET_URL=wss://localhost:26607/websocket
|
||||||
NX_VEGA_ENV=CUSTOM
|
NX_VEGA_ENV=CUSTOM
|
||||||
|
NX_GITHUB_FEEDBACK_URL=https://github.com/vegaprotocol/feedback/discussions
|
||||||
NX_BLOCK_EXPLORER=
|
NX_BLOCK_EXPLORER=
|
||||||
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
NX_ETHERSCAN_URL=https://sepolia.etherscan.io
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
function ReactMarkdown({ children }) {
|
|
||||||
return <div>{children}</div>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default ReactMarkdown;
|
|
||||||
@@ -40,9 +40,9 @@ function App() {
|
|||||||
<NetworkLoader cache={DEFAULT_CACHE_CONFIG}>
|
<NetworkLoader cache={DEFAULT_CACHE_CONFIG}>
|
||||||
<AnnouncementBanner>
|
<AnnouncementBanner>
|
||||||
<div className="font-alpha calt uppercase text-center text-lg text-white">
|
<div className="font-alpha calt uppercase text-center text-lg text-white">
|
||||||
<span className="pr-4">Mainnet sim 2 is live!</span>
|
<span className="pr-4">Mainnet sim 2 coming in March!</span>
|
||||||
<ExternalLink href="https://fairground.wtf/">
|
<ExternalLink href="https://fairground.wtf/">
|
||||||
Come help stress test the network
|
Learn more
|
||||||
</ExternalLink>
|
</ExternalLink>
|
||||||
</div>
|
</div>
|
||||||
</AnnouncementBanner>
|
</AnnouncementBanner>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useAssetDataProvider } from '@vegaprotocol/assets';
|
import { useAssetDataProvider } from '@vegaprotocol/assets';
|
||||||
import { addDecimalsFormatNumber } from '@vegaprotocol/utils';
|
import { addDecimalsFormatNumber } from '@vegaprotocol/react-helpers';
|
||||||
import { AssetLink } from '../links';
|
import { AssetLink } from '../links';
|
||||||
|
|
||||||
export type AssetBalanceProps = {
|
export type AssetBalanceProps = {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { addDecimalsFormatNumber } from '@vegaprotocol/utils';
|
import { addDecimalsFormatNumber } from '@vegaprotocol/react-helpers';
|
||||||
import { useExplorerGovernanceAssetQuery } from './__generated__/Governance-asset';
|
import { useExplorerGovernanceAssetQuery } from './__generated__/Governance-asset';
|
||||||
import AssetBalance from './asset-balance';
|
import AssetBalance from './asset-balance';
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import type { AssetFieldsFragment } from '@vegaprotocol/assets';
|
import type { AssetFieldsFragment } from '@vegaprotocol/assets';
|
||||||
import { AssetTypeMapping, AssetStatusMapping } from '@vegaprotocol/assets';
|
import { AssetTypeMapping, AssetStatusMapping } from '@vegaprotocol/assets';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
|
import type { VegaICellRendererParams } from '@vegaprotocol/ui-toolkit';
|
||||||
import { ButtonLink } from '@vegaprotocol/ui-toolkit';
|
import { ButtonLink } from '@vegaprotocol/ui-toolkit';
|
||||||
import type { AgGridReact } from 'ag-grid-react';
|
import type { AgGridReact } from 'ag-grid-react';
|
||||||
import { AgGridColumn } from 'ag-grid-react';
|
import { AgGridColumn } from 'ag-grid-react';
|
||||||
import { AgGridDynamic as AgGrid } from '@vegaprotocol/datagrid';
|
import { AgGridDynamic as AgGrid } from '@vegaprotocol/ui-toolkit';
|
||||||
import type { VegaICellRendererParams } from '@vegaprotocol/datagrid';
|
|
||||||
import { useRef, useLayoutEffect } from 'react';
|
import { useRef, useLayoutEffect } from 'react';
|
||||||
import { BREAKPOINT_MD } from '../../config/breakpoints';
|
import { BREAKPOINT_MD } from '../../config/breakpoints';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|||||||
@@ -2,11 +2,11 @@ import React from 'react';
|
|||||||
import type { BlockMeta } from '../../routes/blocks/tendermint-blockchain-response';
|
import type { BlockMeta } from '../../routes/blocks/tendermint-blockchain-response';
|
||||||
import { Routes } from '../../routes/route-names';
|
import { Routes } from '../../routes/route-names';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { getDateTimeFormat } from '@vegaprotocol/utils';
|
import { getDateTimeFormat } from '@vegaprotocol/react-helpers';
|
||||||
import { Tooltip } from '@vegaprotocol/ui-toolkit';
|
import { Tooltip } from '@vegaprotocol/ui-toolkit';
|
||||||
import { TimeAgo } from '../time-ago';
|
import { TimeAgo } from '../time-ago';
|
||||||
import { TableWithTbody, TableRow, TableCell } from '../table';
|
import { TableWithTbody, TableRow, TableCell } from '../table';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
|
|
||||||
interface BlockProps {
|
interface BlockProps {
|
||||||
block: BlockMeta;
|
block: BlockMeta;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import type { TendermintBlockchainResponse } from '../../routes/blocks/tendermint-blockchain-response';
|
import type { TendermintBlockchainResponse } from '../../routes/blocks/tendermint-blockchain-response';
|
||||||
import { BlockData } from './block-data';
|
import { BlockData } from './block-data';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { FixedSizeList as List } from 'react-window';
|
import { FixedSizeList as List } from 'react-window';
|
||||||
import InfiniteLoader from 'react-window-infinite-loader';
|
import InfiniteLoader from 'react-window-infinite-loader';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import type { BlockMeta } from '../../routes/blocks/tendermint-blockchain-response';
|
import type { BlockMeta } from '../../routes/blocks/tendermint-blockchain-response';
|
||||||
import { BlockData } from './block-data';
|
import { BlockData } from './block-data';
|
||||||
import EmptyList from '../empty-list/empty-list';
|
import EmptyList from '../empty-list/empty-list';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useState, useEffect } from 'react';
|
import { useState, useEffect } from 'react';
|
||||||
import { useTendermintWebsocket } from '../../hooks/use-tendermint-websocket';
|
import { useTendermintWebsocket } from '../../hooks/use-tendermint-websocket';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { ButtonLink } from '@vegaprotocol/ui-toolkit';
|
import { ButtonLink } from '@vegaprotocol/ui-toolkit';
|
||||||
|
|
||||||
interface BlocksRefetchProps {
|
interface BlocksRefetchProps {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Dialog,
|
Dialog,
|
||||||
|
|||||||
@@ -22,3 +22,29 @@ query ExplorerFutureEpoch {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# query ExplorerEpoch($id: ID!) {
|
||||||
|
#
|
||||||
|
##### This could be useful for calculating roughly when a future epoch will
|
||||||
|
##### occur, but epoch not exist results in a total error
|
||||||
|
# networkParameter(key: "validators.epoch.length") {
|
||||||
|
# value
|
||||||
|
# }
|
||||||
|
#
|
||||||
|
##### This could be useful for relating where we are in time, but as above
|
||||||
|
##### the total failure caused by epoch(id) not existing
|
||||||
|
##### means this is useful
|
||||||
|
# currentEpoch: epoch {
|
||||||
|
# id
|
||||||
|
# }
|
||||||
|
#
|
||||||
|
# epoch(id: $id) {
|
||||||
|
# id
|
||||||
|
# timestamps {
|
||||||
|
# start
|
||||||
|
# end
|
||||||
|
# firstBlock
|
||||||
|
# lastBlock
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
#}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { MockedProvider } from '@apollo/client/testing';
|
import { MockedProvider } from '@apollo/client/testing';
|
||||||
import { render } from '@testing-library/react';
|
import { render } from '@testing-library/react';
|
||||||
import EpochMissingOverview, { calculateEpochData } from './epoch-missing';
|
import EpochMissingOverview, { calculateEpochData } from './epoch-missing';
|
||||||
import { getSecondsFromInterval } from '@vegaprotocol/utils';
|
import { getSecondsFromInterval } from '@vegaprotocol/react-helpers';
|
||||||
const START_DATE_PAST = 'Monday, 17 February 2022 11:44:09';
|
const START_DATE_PAST = 'Monday, 17 February 2022 11:44:09';
|
||||||
|
|
||||||
describe('getSecondsFromInterval', () => {
|
describe('getSecondsFromInterval', () => {
|
||||||
|
|||||||
@@ -4,7 +4,8 @@ import addSeconds from 'date-fns/addSeconds';
|
|||||||
import formatDistance from 'date-fns/formatDistance';
|
import formatDistance from 'date-fns/formatDistance';
|
||||||
import { Icon, Tooltip } from '@vegaprotocol/ui-toolkit';
|
import { Icon, Tooltip } from '@vegaprotocol/ui-toolkit';
|
||||||
import isFuture from 'date-fns/isFuture';
|
import isFuture from 'date-fns/isFuture';
|
||||||
import { getSecondsFromInterval, isValidDate } from '@vegaprotocol/utils';
|
import { isValidDate } from '@vegaprotocol/react-helpers';
|
||||||
|
import { getSecondsFromInterval } from '@vegaprotocol/react-helpers';
|
||||||
|
|
||||||
export type EpochMissingOverviewProps = {
|
export type EpochMissingOverviewProps = {
|
||||||
missingEpochId?: string;
|
missingEpochId?: string;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useExplorerEpochQuery } from './__generated__/Epoch';
|
import { useExplorerEpochQuery } from './__generated__/Epoch';
|
||||||
|
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { BlockLink } from '../links';
|
import { BlockLink } from '../links';
|
||||||
import { Time } from '../time';
|
import { Time } from '../time';
|
||||||
import { TimeAgo } from '../time-ago';
|
import { TimeAgo } from '../time-ago';
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import { NodeSwitcherDialog, useEnvironment } from '@vegaprotocol/environment';
|
import { NodeSwitcherDialog, useEnvironment } from '@vegaprotocol/environment';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t, useScreenDimensions } from '@vegaprotocol/react-helpers';
|
||||||
import { useScreenDimensions } from '@vegaprotocol/react-helpers';
|
|
||||||
import { ExternalLink, Link } from '@vegaprotocol/ui-toolkit';
|
import { ExternalLink, Link } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useMemo, useState } from 'react';
|
import { useMemo, useState } from 'react';
|
||||||
import { ENV } from '../../config/env';
|
import { ENV } from '../../config/env';
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { ThemeSwitcher, Icon } from '@vegaprotocol/ui-toolkit';
|
import { ThemeSwitcher, Icon } from '@vegaprotocol/ui-toolkit';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { Search } from '../search';
|
import { Search } from '../search';
|
||||||
import { Routes } from '../../routes/route-names';
|
import { Routes } from '../../routes/route-names';
|
||||||
import { NetworkSwitcher } from '@vegaprotocol/environment';
|
import { NetworkSwitcher } from '@vegaprotocol/environment';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
import { Routes } from '../../routes/route-names';
|
import { Routes } from '../../routes/route-names';
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { HTMLInputTypeAttribute, SyntheticEvent } from 'react';
|
import type { HTMLInputTypeAttribute, SyntheticEvent } from 'react';
|
||||||
import { Input, Button } from '@vegaprotocol/ui-toolkit';
|
import { Input, Button } from '@vegaprotocol/ui-toolkit';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
|
|
||||||
interface JumpToProps {
|
interface JumpToProps {
|
||||||
label: string;
|
label: string;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { useExplorerMarketQuery } from './__generated__/Market';
|
|||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
import type { ComponentProps } from 'react';
|
import type { ComponentProps } from 'react';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import Hash from '../hash';
|
import Hash from '../hash';
|
||||||
|
|
||||||
export type MarketLinkProps = Partial<ComponentProps<typeof Link>> & {
|
export type MarketLinkProps = Partial<ComponentProps<typeof Link>> & {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { Link } from 'react-router-dom';
|
|||||||
|
|
||||||
import type { ComponentProps } from 'react';
|
import type { ComponentProps } from 'react';
|
||||||
import Hash from '../hash';
|
import Hash from '../hash';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { isValidPartyId } from '../../../routes/parties/id/components/party-id-error';
|
import { isValidPartyId } from '../../../routes/parties/id/components/party-id-error';
|
||||||
import { truncateMiddle } from '@vegaprotocol/ui-toolkit';
|
import { truncateMiddle } from '@vegaprotocol/ui-toolkit';
|
||||||
|
|
||||||
|
|||||||
@@ -4,14 +4,13 @@ import { ENV } from '../../../config/env';
|
|||||||
import Hash from '../hash';
|
import Hash from '../hash';
|
||||||
export type ProposalLinkProps = {
|
export type ProposalLinkProps = {
|
||||||
id: string;
|
id: string;
|
||||||
text?: string;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a proposal ID, generates an external link over to
|
* Given a proposal ID, generates an external link over to
|
||||||
* the Governance page for more information
|
* the Governance page for more information
|
||||||
*/
|
*/
|
||||||
const ProposalLink = ({ id, text }: ProposalLinkProps) => {
|
const ProposalLink = ({ id }: ProposalLinkProps) => {
|
||||||
const { data } = useExplorerProposalQuery({
|
const { data } = useExplorerProposalQuery({
|
||||||
variables: { id },
|
variables: { id },
|
||||||
});
|
});
|
||||||
@@ -21,7 +20,7 @@ const ProposalLink = ({ id, text }: ProposalLinkProps) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<ExternalLink href={`${base}/proposals/${id}`}>
|
<ExternalLink href={`${base}/proposals/${id}`}>
|
||||||
{text ? text : <Hash text={label} />}
|
<Hash text={label} />
|
||||||
</ExternalLink>
|
</ExternalLink>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,10 +2,11 @@ import {
|
|||||||
addDecimalsFormatNumber,
|
addDecimalsFormatNumber,
|
||||||
formatNumberPercentage,
|
formatNumberPercentage,
|
||||||
getMarketExpiryDateFormatted,
|
getMarketExpiryDateFormatted,
|
||||||
} from '@vegaprotocol/utils';
|
t,
|
||||||
import { t } from '@vegaprotocol/i18n';
|
} from '@vegaprotocol/react-helpers';
|
||||||
import type { MarketInfoWithData } from '@vegaprotocol/market-info';
|
import type { MarketInfoNoCandlesQuery } from '@vegaprotocol/market-info';
|
||||||
import { MarketInfoTable } from '@vegaprotocol/market-info';
|
import { MarketInfoTable } from '@vegaprotocol/market-info';
|
||||||
|
import pick from 'lodash/pick';
|
||||||
import {
|
import {
|
||||||
MarketStateMapping,
|
MarketStateMapping,
|
||||||
MarketTradingModeMapping,
|
MarketTradingModeMapping,
|
||||||
@@ -16,7 +17,11 @@ import BigNumber from 'bignumber.js';
|
|||||||
import { useMemo } from 'react';
|
import { useMemo } from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
|
||||||
export const MarketDetails = ({ market }: { market: MarketInfoWithData }) => {
|
export const MarketDetails = ({
|
||||||
|
market,
|
||||||
|
}: {
|
||||||
|
market: MarketInfoNoCandlesQuery['market'];
|
||||||
|
}) => {
|
||||||
const quoteUnit = market?.tradableInstrument.instrument.product.quoteName;
|
const quoteUnit = market?.tradableInstrument.instrument.product.quoteName;
|
||||||
const assetId = useMemo(
|
const assetId = useMemo(
|
||||||
() => market?.tradableInstrument.instrument.product?.settlementAsset.id,
|
() => market?.tradableInstrument.instrument.product?.settlementAsset.id,
|
||||||
@@ -27,9 +32,7 @@ export const MarketDetails = ({ market }: { market: MarketInfoWithData }) => {
|
|||||||
if (!market) return null;
|
if (!market) return null;
|
||||||
|
|
||||||
const keyDetails = {
|
const keyDetails = {
|
||||||
decimalPlaces: market.decimalPlaces,
|
...pick(market, 'decimalPlaces', 'positionDecimalPlaces', 'tradingMode'),
|
||||||
positionDecimalPlaces: market.positionDecimalPlaces,
|
|
||||||
tradingMode: market.tradingMode,
|
|
||||||
state: MarketStateMapping[market.state],
|
state: MarketStateMapping[market.state],
|
||||||
};
|
};
|
||||||
const assetDecimals =
|
const assetDecimals =
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import type { MarketFieldsFragment } from '@vegaprotocol/market-list';
|
import type { MarketFieldsFragment } from '@vegaprotocol/market-list';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { ButtonLink } from '@vegaprotocol/ui-toolkit';
|
|
||||||
import type { AgGridReact } from 'ag-grid-react';
|
|
||||||
import { AgGridColumn } from 'ag-grid-react';
|
|
||||||
import { AgGridDynamic as AgGrid } from '@vegaprotocol/datagrid';
|
|
||||||
import type {
|
import type {
|
||||||
VegaICellRendererParams,
|
VegaICellRendererParams,
|
||||||
VegaValueGetterParams,
|
VegaValueGetterParams,
|
||||||
} from '@vegaprotocol/datagrid';
|
} from '@vegaprotocol/ui-toolkit';
|
||||||
|
import { ButtonLink } from '@vegaprotocol/ui-toolkit';
|
||||||
|
import type { AgGridReact } from 'ag-grid-react';
|
||||||
|
import { AgGridColumn } from 'ag-grid-react';
|
||||||
|
import { AgGridDynamic as AgGrid } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useRef, useLayoutEffect } from 'react';
|
import { useRef, useLayoutEffect } from 'react';
|
||||||
import { BREAKPOINT_MD } from '../../config/breakpoints';
|
import { BREAKPOINT_MD } from '../../config/breakpoints';
|
||||||
import { MarketStateMapping } from '@vegaprotocol/types';
|
import { MarketStateMapping } from '@vegaprotocol/types';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { useExplorerDeterministicOrderQuery } from './__generated__/Order';
|
import { useExplorerDeterministicOrderQuery } from './__generated__/Order';
|
||||||
import { MarketLink } from '../links';
|
import { MarketLink } from '../links';
|
||||||
import PriceInMarket from '../price-in-market/price-in-market';
|
import PriceInMarket from '../price-in-market/price-in-market';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { useExplorerDeterministicOrderQuery } from './__generated__/Order';
|
import { useExplorerDeterministicOrderQuery } from './__generated__/Order';
|
||||||
import { MarketLink } from '../links';
|
import { MarketLink } from '../links';
|
||||||
import PriceInMarket from '../price-in-market/price-in-market';
|
import PriceInMarket from '../price-in-market/price-in-market';
|
||||||
@@ -101,7 +101,7 @@ const DeterministicOrderDetails = ({
|
|||||||
{t('Remaining')}
|
{t('Remaining')}
|
||||||
</h2>
|
</h2>
|
||||||
<h5 className="text-lg font-medium text-gray-500 mb-0">
|
<h5 className="text-lg font-medium text-gray-500 mb-0">
|
||||||
<SizeInMarket size={o.remaining} marketId={o.market.id} />
|
{o.remaining}
|
||||||
</h5>
|
</h5>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import type * as Schema from '@vegaprotocol/types';
|
import type * as Schema from '@vegaprotocol/types';
|
||||||
import type { components } from '../../../../types/explorer';
|
import type { components } from '../../../../types/explorer';
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { addDecimalsFormatNumber } from '@vegaprotocol/utils';
|
import { addDecimalsFormatNumber, t } from '@vegaprotocol/react-helpers';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
|
||||||
import isUndefined from 'lodash/isUndefined';
|
import isUndefined from 'lodash/isUndefined';
|
||||||
import { useExplorerMarketQuery } from '../links/market-link/__generated__/Market';
|
import { useExplorerMarketQuery } from '../links/market-link/__generated__/Market';
|
||||||
import get from 'lodash/get';
|
import get from 'lodash/get';
|
||||||
|
|||||||
@@ -1,18 +1,21 @@
|
|||||||
import type { ProposalListFieldsFragment } from '@vegaprotocol/proposals';
|
import type { ProposalListFieldsFragment } from '@vegaprotocol/governance';
|
||||||
import { VoteProgress } from '@vegaprotocol/proposals';
|
import { VoteProgress } from '@vegaprotocol/governance';
|
||||||
import type { AgGridReact } from 'ag-grid-react';
|
import type { AgGridReact } from 'ag-grid-react';
|
||||||
import { AgGridColumn } from 'ag-grid-react';
|
import { AgGridColumn } from 'ag-grid-react';
|
||||||
import { ExternalLink } from '@vegaprotocol/ui-toolkit';
|
|
||||||
import { AgGridDynamic as AgGrid } from '@vegaprotocol/datagrid';
|
|
||||||
import type {
|
import type {
|
||||||
VegaICellRendererParams,
|
VegaICellRendererParams,
|
||||||
VegaValueFormatterParams,
|
VegaValueFormatterParams,
|
||||||
} from '@vegaprotocol/datagrid';
|
} from '@vegaprotocol/ui-toolkit';
|
||||||
|
import { ExternalLink } from '@vegaprotocol/ui-toolkit';
|
||||||
|
import { AgGridDynamic as AgGrid } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useLayoutEffect, useMemo, useRef, useState } from 'react';
|
import { useLayoutEffect, useMemo, useRef, useState } from 'react';
|
||||||
import type { RowClickedEvent } from 'ag-grid-community';
|
import type { RowClickedEvent } from 'ag-grid-community';
|
||||||
import { getDateTimeFormat } from '@vegaprotocol/utils';
|
import {
|
||||||
import { t } from '@vegaprotocol/i18n';
|
getDateTimeFormat,
|
||||||
import { NetworkParams, useNetworkParams } from '@vegaprotocol/react-helpers';
|
NetworkParams,
|
||||||
|
t,
|
||||||
|
useNetworkParams,
|
||||||
|
} from '@vegaprotocol/react-helpers';
|
||||||
import { ProposalStateMapping } from '@vegaprotocol/types';
|
import { ProposalStateMapping } from '@vegaprotocol/types';
|
||||||
import BigNumber from 'bignumber.js';
|
import BigNumber from 'bignumber.js';
|
||||||
import { DApp, TOKEN_PROPOSAL, useLinks } from '@vegaprotocol/environment';
|
import { DApp, TOKEN_PROPOSAL, useLinks } from '@vegaprotocol/environment';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { StatusMessage } from '../status-message';
|
import { StatusMessage } from '../status-message';
|
||||||
|
|
||||||
interface RenderFetchedProps {
|
interface RenderFetchedProps {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
interface RouteErrorBoundaryProps {
|
interface RouteErrorBoundaryProps {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useCallback, useState } from 'react';
|
import { useCallback, useState } from 'react';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { Button, Input, InputError } from '@vegaprotocol/ui-toolkit';
|
import { Button, Input, InputError } from '@vegaprotocol/ui-toolkit';
|
||||||
import { useForm } from 'react-hook-form';
|
import { useForm } from 'react-hook-form';
|
||||||
import { useNavigate } from 'react-router-dom';
|
import { useNavigate } from 'react-router-dom';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useAssetDataProvider } from '@vegaprotocol/assets';
|
import { useAssetDataProvider } from '@vegaprotocol/assets';
|
||||||
import { addDecimalsFormatNumber } from '@vegaprotocol/utils';
|
import { addDecimalsFormatNumber } from '@vegaprotocol/react-helpers';
|
||||||
import { AssetLink } from '../links';
|
import { AssetLink } from '../links';
|
||||||
|
|
||||||
export type DecimalSource = 'ASSET';
|
export type DecimalSource = 'ASSET';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { addDecimalsFormatNumber } from '@vegaprotocol/utils';
|
import { addDecimalsFormatNumber } from '@vegaprotocol/react-helpers';
|
||||||
import { useExplorerMarketQuery } from '../links/market-link/__generated__/Market';
|
import { useExplorerMarketQuery } from '../links/market-link/__generated__/Market';
|
||||||
|
|
||||||
export type DecimalSource = 'MARKET';
|
export type DecimalSource = 'MARKET';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { formatDistanceToNowStrict } from 'date-fns';
|
import { formatDistanceToNowStrict } from 'date-fns';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
|
|
||||||
interface TimeAgoProps {
|
interface TimeAgoProps {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
|
|
||||||
interface TimeProps {
|
interface TimeProps {
|
||||||
date: string | null | undefined;
|
date: string | null | undefined;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { truncateByChars } from '@vegaprotocol/utils';
|
import { truncateByChars } from '@vegaprotocol/react-helpers';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
interface TruncateInlineProps {
|
interface TruncateInlineProps {
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import { render } from '@testing-library/react';
|
import { render } from '@testing-library/react';
|
||||||
import { TxDetailsChainEventBuiltinDeposit } from './tx-builtin-deposit';
|
import { TxDetailsChainEventBuiltinDeposit } from './tx-builtin-deposit';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
|
|
||||||
import type { components } from '../../../../../types/explorer';
|
import type { components } from '../../../../../types/explorer';
|
||||||
import omit from 'lodash/omit';
|
import omit from 'lodash/omit';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { TableRow, TableCell } from '../../../table';
|
import { TableRow, TableCell } from '../../../table';
|
||||||
import type { components } from '../../../../../types/explorer';
|
import type { components } from '../../../../../types/explorer';
|
||||||
import { AssetLink, PartyLink } from '../../../links';
|
import { AssetLink, PartyLink } from '../../../links';
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
import { render } from '@testing-library/react';
|
import { render } from '@testing-library/react';
|
||||||
import { TxDetailsChainEventBuiltinWithdrawal } from './tx-builtin-withdrawal';
|
import { TxDetailsChainEventBuiltinWithdrawal } from './tx-builtin-withdrawal';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
|
|
||||||
import type { components } from '../../../../../types/explorer';
|
import type { components } from '../../../../../types/explorer';
|
||||||
import omit from 'lodash/omit';
|
import omit from 'lodash/omit';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { TableRow, TableCell } from '../../../table';
|
import { TableRow, TableCell } from '../../../table';
|
||||||
import type { components } from '../../../../../types/explorer';
|
import type { components } from '../../../../../types/explorer';
|
||||||
import { AssetLink, PartyLink } from '../../../links';
|
import { AssetLink, PartyLink } from '../../../links';
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import { render } from '@testing-library/react';
|
import { render } from '@testing-library/react';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
|
|
||||||
import type { components } from '../../../../../types/explorer';
|
import type { components } from '../../../../../types/explorer';
|
||||||
import omit from 'lodash/omit';
|
import omit from 'lodash/omit';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { TableRow, TableCell } from '../../../table';
|
import { TableRow, TableCell } from '../../../table';
|
||||||
import type { components } from '../../../../../types/explorer';
|
import type { components } from '../../../../../types/explorer';
|
||||||
import { AssetLink } from '../../../links';
|
import { AssetLink } from '../../../links';
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import { render } from '@testing-library/react';
|
import { render } from '@testing-library/react';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
|
|
||||||
import type { components } from '../../../../../types/explorer';
|
import type { components } from '../../../../../types/explorer';
|
||||||
import omit from 'lodash/omit';
|
import omit from 'lodash/omit';
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { TableRow, TableCell } from '../../../table';
|
import { TableRow, TableCell } from '../../../table';
|
||||||
import type { components } from '../../../../../types/explorer';
|
import type { components } from '../../../../../types/explorer';
|
||||||
import { AssetLink } from '../../../links';
|
import { AssetLink } from '../../../links';
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import { render } from '@testing-library/react';
|
import { render } from '@testing-library/react';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
|
|
||||||
import type { components } from '../../../../../types/explorer';
|
import type { components } from '../../../../../types/explorer';
|
||||||
import omit from 'lodash/omit';
|
import omit from 'lodash/omit';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { TableRow, TableCell } from '../../../table';
|
import { TableRow, TableCell } from '../../../table';
|
||||||
import type { components } from '../../../../../types/explorer';
|
import type { components } from '../../../../../types/explorer';
|
||||||
import { AssetLink } from '../../../links';
|
import { AssetLink } from '../../../links';
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import { render } from '@testing-library/react';
|
import { render } from '@testing-library/react';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { TxDetailsChainEventErc20BridgePause } from './tx-erc20-bridge-pause';
|
import { TxDetailsChainEventErc20BridgePause } from './tx-erc20-bridge-pause';
|
||||||
|
|
||||||
describe('Chain Event: ERC20 bridge pause', () => {
|
describe('Chain Event: ERC20 bridge pause', () => {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { TableRow, TableCell } from '../../../table';
|
import { TableRow, TableCell } from '../../../table';
|
||||||
|
|
||||||
export interface TxDetailsChainEventErc20BridgePauseProps {
|
export interface TxDetailsChainEventErc20BridgePauseProps {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { render } from '@testing-library/react';
|
import { render } from '@testing-library/react';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
|
|
||||||
import type { components } from '../../../../../types/explorer';
|
import type { components } from '../../../../../types/explorer';
|
||||||
import omit from 'lodash/omit';
|
import omit from 'lodash/omit';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { TableRow, TableCell } from '../../../table';
|
import { TableRow, TableCell } from '../../../table';
|
||||||
import type { components } from '../../../../../types/explorer';
|
import type { components } from '../../../../../types/explorer';
|
||||||
import { AssetLink, PartyLink } from '../../../links';
|
import { AssetLink, PartyLink } from '../../../links';
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import { render } from '@testing-library/react';
|
import { render } from '@testing-library/react';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
|
|
||||||
import type { components } from '../../../../../types/explorer';
|
import type { components } from '../../../../../types/explorer';
|
||||||
import omit from 'lodash/omit';
|
import omit from 'lodash/omit';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { TableRow, TableCell } from '../../../table';
|
import { TableRow, TableCell } from '../../../table';
|
||||||
import type { components } from '../../../../../types/explorer';
|
import type { components } from '../../../../../types/explorer';
|
||||||
import { AssetLink } from '../../../links';
|
import { AssetLink } from '../../../links';
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import { render } from '@testing-library/react';
|
import { render } from '@testing-library/react';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
|
|
||||||
import type { components } from '../../../../../types/explorer';
|
import type { components } from '../../../../../types/explorer';
|
||||||
import { MockedProvider } from '@apollo/client/testing';
|
import { MockedProvider } from '@apollo/client/testing';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { TableRow, TableCell } from '../../../table';
|
import { TableRow, TableCell } from '../../../table';
|
||||||
import type { components } from '../../../../../types/explorer';
|
import type { components } from '../../../../../types/explorer';
|
||||||
import { getBlockTime } from './lib/get-block-time';
|
import { getBlockTime } from './lib/get-block-time';
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import { render } from '@testing-library/react';
|
import { render } from '@testing-library/react';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
|
|
||||||
import type { components } from '../../../../../types/explorer';
|
import type { components } from '../../../../../types/explorer';
|
||||||
import { MockedProvider } from '@apollo/client/testing';
|
import { MockedProvider } from '@apollo/client/testing';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { TableRow, TableCell } from '../../../table';
|
import { TableRow, TableCell } from '../../../table';
|
||||||
import type { components } from '../../../../../types/explorer';
|
import type { components } from '../../../../../types/explorer';
|
||||||
import isNumber from 'lodash/isNumber';
|
import isNumber from 'lodash/isNumber';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { render } from '@testing-library/react';
|
import { render } from '@testing-library/react';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
|
|
||||||
import type { components } from '../../../../../types/explorer';
|
import type { components } from '../../../../../types/explorer';
|
||||||
import omit from 'lodash/omit';
|
import omit from 'lodash/omit';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { TableRow, TableCell } from '../../../table';
|
import { TableRow, TableCell } from '../../../table';
|
||||||
import type { components } from '../../../../../types/explorer';
|
import type { components } from '../../../../../types/explorer';
|
||||||
import { PartyLink } from '../../../links';
|
import { PartyLink } from '../../../links';
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { render } from '@testing-library/react';
|
import { render } from '@testing-library/react';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
|
|
||||||
import type { components } from '../../../../../types/explorer';
|
import type { components } from '../../../../../types/explorer';
|
||||||
import omit from 'lodash/omit';
|
import omit from 'lodash/omit';
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { TableRow, TableCell } from '../../../table';
|
import { TableRow, TableCell } from '../../../table';
|
||||||
import type { components } from '../../../../../types/explorer';
|
import type { components } from '../../../../../types/explorer';
|
||||||
import { PartyLink } from '../../../links';
|
import { PartyLink } from '../../../links';
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import { render } from '@testing-library/react';
|
import { render } from '@testing-library/react';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
|
|
||||||
import type { components } from '../../../../../types/explorer';
|
import type { components } from '../../../../../types/explorer';
|
||||||
import omit from 'lodash/omit';
|
import omit from 'lodash/omit';
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { formatNumber, toBigNum } from '@vegaprotocol/utils';
|
import { formatNumber, t, toBigNum } from '@vegaprotocol/react-helpers';
|
||||||
import { t } from '@vegaprotocol/i18n';
|
|
||||||
import { TableRow, TableCell } from '../../../table';
|
import { TableRow, TableCell } from '../../../table';
|
||||||
import type { components } from '../../../../../types/explorer';
|
import type { components } from '../../../../../types/explorer';
|
||||||
import {
|
import {
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
|
|
||||||
import type { components } from '../../../../../../types/explorer';
|
import type { components } from '../../../../../../types/explorer';
|
||||||
import { TableRow } from '../../../../table';
|
import { TableRow } from '../../../../table';
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
import { useExplorerSettlementAssetForMarketQuery } from '../__generated__/Explorer-settlement-asset';
|
import { useExplorerSettlementAssetForMarketQuery } from '../__generated__/Explorer-settlement-asset';
|
||||||
import { addDecimalsFormatNumber } from '@vegaprotocol/utils';
|
import { addDecimalsFormatNumber } from '@vegaprotocol/react-helpers';
|
||||||
import type { ExplorerSettlementAssetForMarketQuery } from '../__generated__/Explorer-settlement-asset';
|
import type { ExplorerSettlementAssetForMarketQuery } from '../__generated__/Explorer-settlement-asset';
|
||||||
import type { VegaSide } from './liquidity-provision-details-row';
|
import type { VegaSide } from './liquidity-provision-details-row';
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
|
|
||||||
import type { components } from '../../../../../types/explorer';
|
import type { components } from '../../../../../types/explorer';
|
||||||
import type { LiquiditySubmission } from '../tx-liquidity-submission';
|
import type { LiquiditySubmission } from '../tx-liquidity-submission';
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
|
|
||||||
interface JSONOracleDataProps {
|
interface JSONOracleDataProps {
|
||||||
payload: string;
|
payload: string;
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { NestedDataList } from '../../../nested-data-list';
|
import { NestedDataList } from '../../../nested-data-list';
|
||||||
import { OpenOraclePrices } from './open-oracle/open-oracle-prices';
|
import { OpenOraclePrices } from './open-oracle/open-oracle-prices';
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
import { t } from '@vegaprotocol/react-helpers';
|
||||||
import { CopyWithTooltip } from '@vegaprotocol/ui-toolkit';
|
import { CopyWithTooltip } from '@vegaprotocol/ui-toolkit';
|
||||||
import { TableRow } from '../../../../table';
|
import { TableRow } from '../../../../table';
|
||||||
import { TruncateInline } from '../../../../truncate/truncate';
|
import { TruncateInline } from '../../../../truncate/truncate';
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
query ExplorerProposalStatus($id: ID!) {
|
|
||||||
proposal(id: $id) {
|
|
||||||
id
|
|
||||||
state
|
|
||||||
rejectionReason
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
query ExplorerNewAssetSignatureBundle($id: ID!) {
|
|
||||||
erc20ListAssetBundle(assetId: $id) {
|
|
||||||
signatures
|
|
||||||
nonce
|
|
||||||
}
|
|
||||||
asset(id: $id) {
|
|
||||||
status
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
query ExplorerUpdateAssetSignatureBundle($id: ID!) {
|
|
||||||
erc20SetAssetLimitsBundle(proposalId: $id) {
|
|
||||||
signatures
|
|
||||||
nonce
|
|
||||||
}
|
|
||||||
asset(id: $id) {
|
|
||||||
status
|
|
||||||
}
|
|
||||||
}
|
|
||||||
-50
@@ -1,50 +0,0 @@
|
|||||||
import * as Types from '@vegaprotocol/types';
|
|
||||||
|
|
||||||
import { gql } from '@apollo/client';
|
|
||||||
import * as Apollo from '@apollo/client';
|
|
||||||
const defaultOptions = {} as const;
|
|
||||||
export type ExplorerProposalStatusQueryVariables = Types.Exact<{
|
|
||||||
id: Types.Scalars['ID'];
|
|
||||||
}>;
|
|
||||||
|
|
||||||
|
|
||||||
export type ExplorerProposalStatusQuery = { __typename?: 'Query', proposal?: { __typename?: 'Proposal', id?: string | null, state: Types.ProposalState, rejectionReason?: Types.ProposalRejectionReason | null } | null };
|
|
||||||
|
|
||||||
|
|
||||||
export const ExplorerProposalStatusDocument = gql`
|
|
||||||
query ExplorerProposalStatus($id: ID!) {
|
|
||||||
proposal(id: $id) {
|
|
||||||
id
|
|
||||||
state
|
|
||||||
rejectionReason
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* __useExplorerProposalStatusQuery__
|
|
||||||
*
|
|
||||||
* To run a query within a React component, call `useExplorerProposalStatusQuery` and pass it any options that fit your needs.
|
|
||||||
* When your component renders, `useExplorerProposalStatusQuery` returns an object from Apollo Client that contains loading, error, and data properties
|
|
||||||
* you can use to render your UI.
|
|
||||||
*
|
|
||||||
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* const { data, loading, error } = useExplorerProposalStatusQuery({
|
|
||||||
* variables: {
|
|
||||||
* id: // value for 'id'
|
|
||||||
* },
|
|
||||||
* });
|
|
||||||
*/
|
|
||||||
export function useExplorerProposalStatusQuery(baseOptions: Apollo.QueryHookOptions<ExplorerProposalStatusQuery, ExplorerProposalStatusQueryVariables>) {
|
|
||||||
const options = {...defaultOptions, ...baseOptions}
|
|
||||||
return Apollo.useQuery<ExplorerProposalStatusQuery, ExplorerProposalStatusQueryVariables>(ExplorerProposalStatusDocument, options);
|
|
||||||
}
|
|
||||||
export function useExplorerProposalStatusLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<ExplorerProposalStatusQuery, ExplorerProposalStatusQueryVariables>) {
|
|
||||||
const options = {...defaultOptions, ...baseOptions}
|
|
||||||
return Apollo.useLazyQuery<ExplorerProposalStatusQuery, ExplorerProposalStatusQueryVariables>(ExplorerProposalStatusDocument, options);
|
|
||||||
}
|
|
||||||
export type ExplorerProposalStatusQueryHookResult = ReturnType<typeof useExplorerProposalStatusQuery>;
|
|
||||||
export type ExplorerProposalStatusLazyQueryHookResult = ReturnType<typeof useExplorerProposalStatusLazyQuery>;
|
|
||||||
export type ExplorerProposalStatusQueryResult = Apollo.QueryResult<ExplorerProposalStatusQuery, ExplorerProposalStatusQueryVariables>;
|
|
||||||
-98
@@ -1,98 +0,0 @@
|
|||||||
import * as Types from '@vegaprotocol/types';
|
|
||||||
|
|
||||||
import { gql } from '@apollo/client';
|
|
||||||
import * as Apollo from '@apollo/client';
|
|
||||||
const defaultOptions = {} as const;
|
|
||||||
export type ExplorerNewAssetSignatureBundleQueryVariables = Types.Exact<{
|
|
||||||
id: Types.Scalars['ID'];
|
|
||||||
}>;
|
|
||||||
|
|
||||||
|
|
||||||
export type ExplorerNewAssetSignatureBundleQuery = { __typename?: 'Query', erc20ListAssetBundle?: { __typename?: 'Erc20ListAssetBundle', signatures: string, nonce: string } | null, asset?: { __typename?: 'Asset', status: Types.AssetStatus } | null };
|
|
||||||
|
|
||||||
export type ExplorerUpdateAssetSignatureBundleQueryVariables = Types.Exact<{
|
|
||||||
id: Types.Scalars['ID'];
|
|
||||||
}>;
|
|
||||||
|
|
||||||
|
|
||||||
export type ExplorerUpdateAssetSignatureBundleQuery = { __typename?: 'Query', erc20SetAssetLimitsBundle: { __typename?: 'ERC20SetAssetLimitsBundle', signatures: string, nonce: string }, asset?: { __typename?: 'Asset', status: Types.AssetStatus } | null };
|
|
||||||
|
|
||||||
|
|
||||||
export const ExplorerNewAssetSignatureBundleDocument = gql`
|
|
||||||
query ExplorerNewAssetSignatureBundle($id: ID!) {
|
|
||||||
erc20ListAssetBundle(assetId: $id) {
|
|
||||||
signatures
|
|
||||||
nonce
|
|
||||||
}
|
|
||||||
asset(id: $id) {
|
|
||||||
status
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* __useExplorerNewAssetSignatureBundleQuery__
|
|
||||||
*
|
|
||||||
* To run a query within a React component, call `useExplorerNewAssetSignatureBundleQuery` and pass it any options that fit your needs.
|
|
||||||
* When your component renders, `useExplorerNewAssetSignatureBundleQuery` returns an object from Apollo Client that contains loading, error, and data properties
|
|
||||||
* you can use to render your UI.
|
|
||||||
*
|
|
||||||
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* const { data, loading, error } = useExplorerNewAssetSignatureBundleQuery({
|
|
||||||
* variables: {
|
|
||||||
* id: // value for 'id'
|
|
||||||
* },
|
|
||||||
* });
|
|
||||||
*/
|
|
||||||
export function useExplorerNewAssetSignatureBundleQuery(baseOptions: Apollo.QueryHookOptions<ExplorerNewAssetSignatureBundleQuery, ExplorerNewAssetSignatureBundleQueryVariables>) {
|
|
||||||
const options = {...defaultOptions, ...baseOptions}
|
|
||||||
return Apollo.useQuery<ExplorerNewAssetSignatureBundleQuery, ExplorerNewAssetSignatureBundleQueryVariables>(ExplorerNewAssetSignatureBundleDocument, options);
|
|
||||||
}
|
|
||||||
export function useExplorerNewAssetSignatureBundleLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<ExplorerNewAssetSignatureBundleQuery, ExplorerNewAssetSignatureBundleQueryVariables>) {
|
|
||||||
const options = {...defaultOptions, ...baseOptions}
|
|
||||||
return Apollo.useLazyQuery<ExplorerNewAssetSignatureBundleQuery, ExplorerNewAssetSignatureBundleQueryVariables>(ExplorerNewAssetSignatureBundleDocument, options);
|
|
||||||
}
|
|
||||||
export type ExplorerNewAssetSignatureBundleQueryHookResult = ReturnType<typeof useExplorerNewAssetSignatureBundleQuery>;
|
|
||||||
export type ExplorerNewAssetSignatureBundleLazyQueryHookResult = ReturnType<typeof useExplorerNewAssetSignatureBundleLazyQuery>;
|
|
||||||
export type ExplorerNewAssetSignatureBundleQueryResult = Apollo.QueryResult<ExplorerNewAssetSignatureBundleQuery, ExplorerNewAssetSignatureBundleQueryVariables>;
|
|
||||||
export const ExplorerUpdateAssetSignatureBundleDocument = gql`
|
|
||||||
query ExplorerUpdateAssetSignatureBundle($id: ID!) {
|
|
||||||
erc20SetAssetLimitsBundle(proposalId: $id) {
|
|
||||||
signatures
|
|
||||||
nonce
|
|
||||||
}
|
|
||||||
asset(id: $id) {
|
|
||||||
status
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* __useExplorerUpdateAssetSignatureBundleQuery__
|
|
||||||
*
|
|
||||||
* To run a query within a React component, call `useExplorerUpdateAssetSignatureBundleQuery` and pass it any options that fit your needs.
|
|
||||||
* When your component renders, `useExplorerUpdateAssetSignatureBundleQuery` returns an object from Apollo Client that contains loading, error, and data properties
|
|
||||||
* you can use to render your UI.
|
|
||||||
*
|
|
||||||
* @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options;
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* const { data, loading, error } = useExplorerUpdateAssetSignatureBundleQuery({
|
|
||||||
* variables: {
|
|
||||||
* id: // value for 'id'
|
|
||||||
* },
|
|
||||||
* });
|
|
||||||
*/
|
|
||||||
export function useExplorerUpdateAssetSignatureBundleQuery(baseOptions: Apollo.QueryHookOptions<ExplorerUpdateAssetSignatureBundleQuery, ExplorerUpdateAssetSignatureBundleQueryVariables>) {
|
|
||||||
const options = {...defaultOptions, ...baseOptions}
|
|
||||||
return Apollo.useQuery<ExplorerUpdateAssetSignatureBundleQuery, ExplorerUpdateAssetSignatureBundleQueryVariables>(ExplorerUpdateAssetSignatureBundleDocument, options);
|
|
||||||
}
|
|
||||||
export function useExplorerUpdateAssetSignatureBundleLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions<ExplorerUpdateAssetSignatureBundleQuery, ExplorerUpdateAssetSignatureBundleQueryVariables>) {
|
|
||||||
const options = {...defaultOptions, ...baseOptions}
|
|
||||||
return Apollo.useLazyQuery<ExplorerUpdateAssetSignatureBundleQuery, ExplorerUpdateAssetSignatureBundleQueryVariables>(ExplorerUpdateAssetSignatureBundleDocument, options);
|
|
||||||
}
|
|
||||||
export type ExplorerUpdateAssetSignatureBundleQueryHookResult = ReturnType<typeof useExplorerUpdateAssetSignatureBundleQuery>;
|
|
||||||
export type ExplorerUpdateAssetSignatureBundleLazyQueryHookResult = ReturnType<typeof useExplorerUpdateAssetSignatureBundleLazyQuery>;
|
|
||||||
export type ExplorerUpdateAssetSignatureBundleQueryResult = Apollo.QueryResult<ExplorerUpdateAssetSignatureBundleQuery, ExplorerUpdateAssetSignatureBundleQueryVariables>;
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
|
||||||
import { Lozenge } from '@vegaprotocol/ui-toolkit';
|
|
||||||
import type { components } from '../../../../../types/explorer';
|
|
||||||
import type { ExplorerProposalStatusQuery } from './__generated__/Proposal';
|
|
||||||
import { useExplorerProposalStatusQuery } from './__generated__/Proposal';
|
|
||||||
|
|
||||||
type Terms = components['schemas']['vegaProposalTerms'];
|
|
||||||
|
|
||||||
export function format(date: string | undefined, def: string) {
|
|
||||||
if (!date) {
|
|
||||||
return def;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Date().toLocaleDateString() || def;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getDate(
|
|
||||||
data: ExplorerProposalStatusQuery | undefined,
|
|
||||||
terms: Terms
|
|
||||||
): string {
|
|
||||||
const DEFAULT = t('Unknown');
|
|
||||||
if (!data?.proposal?.state) {
|
|
||||||
return DEFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (data.proposal.state) {
|
|
||||||
case 'STATE_DECLINED':
|
|
||||||
return `${t('Rejected on')}: ${format(terms.closingTimestamp, DEFAULT)}`;
|
|
||||||
case 'STATE_ENACTED':
|
|
||||||
return `${t('Vote passed on')}: ${format(
|
|
||||||
terms.enactmentTimestamp,
|
|
||||||
DEFAULT
|
|
||||||
)}`;
|
|
||||||
case 'STATE_FAILED':
|
|
||||||
return `${t('Failed on')}: ${format(terms.validationTimestamp, DEFAULT)}`;
|
|
||||||
case 'STATE_OPEN':
|
|
||||||
return `${t('Open until')}: ${format(terms.closingTimestamp, DEFAULT)}`;
|
|
||||||
case 'STATE_PASSED':
|
|
||||||
return `${t('Passed on')}: ${format(terms.closingTimestamp, DEFAULT)}`;
|
|
||||||
case 'STATE_REJECTED':
|
|
||||||
return `${t('Rejected on submission')}`;
|
|
||||||
case 'STATE_WAITING_FOR_NODE_VOTE':
|
|
||||||
return `${t('Opening')}...`;
|
|
||||||
default:
|
|
||||||
return DEFAULT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ProposalDateProps {
|
|
||||||
id: string;
|
|
||||||
terms: Terms;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Shows the most relevant date for the proposal summary view. Depending on the
|
|
||||||
* state returned by GraphQL, we show either the validation, closing or enactment
|
|
||||||
* timestamp
|
|
||||||
*/
|
|
||||||
export const ProposalDate = ({ terms, id }: ProposalDateProps) => {
|
|
||||||
const { data } = useExplorerProposalStatusQuery({
|
|
||||||
variables: {
|
|
||||||
id,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Lozenge className="font-sans text-xs float-right">
|
|
||||||
{getDate(data, terms)}
|
|
||||||
</Lozenge>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -1,117 +0,0 @@
|
|||||||
import { Icon, Tooltip } from '@vegaprotocol/ui-toolkit';
|
|
||||||
import type { IconProps } from '@vegaprotocol/ui-toolkit';
|
|
||||||
import { useExplorerProposalStatusQuery } from './__generated__/Proposal';
|
|
||||||
import type { ExplorerProposalStatusQuery } from './__generated__/Proposal';
|
|
||||||
import type * as Apollo from '@apollo/client';
|
|
||||||
import type * as Types from '@vegaprotocol/types';
|
|
||||||
import { t } from '@vegaprotocol/i18n';
|
|
||||||
|
|
||||||
type ProposalQueryResult = Apollo.QueryResult<
|
|
||||||
ExplorerProposalStatusQuery,
|
|
||||||
Types.Exact<{
|
|
||||||
id: string;
|
|
||||||
}>
|
|
||||||
>;
|
|
||||||
|
|
||||||
interface ProposalStatusIconProps {
|
|
||||||
id: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
type IconAndLabel = {
|
|
||||||
icon: IconProps['name'];
|
|
||||||
label: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Select an icon for a given query result. Tolerates queries that don't return
|
|
||||||
* any data
|
|
||||||
*
|
|
||||||
* @param data a data result from useExplorerProposalStatusQuery
|
|
||||||
* @returns Icon name
|
|
||||||
*/
|
|
||||||
export function getIconAndLabelForStatus(
|
|
||||||
res: ProposalQueryResult
|
|
||||||
): IconAndLabel {
|
|
||||||
const DEFAULT: IconAndLabel = {
|
|
||||||
icon: 'error',
|
|
||||||
label: t('Proposal state unknown'),
|
|
||||||
};
|
|
||||||
|
|
||||||
if (res.loading) {
|
|
||||||
return {
|
|
||||||
icon: 'more',
|
|
||||||
label: t('Loading data'),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!res?.data?.proposal || res.error) {
|
|
||||||
return {
|
|
||||||
icon: 'error',
|
|
||||||
label: res.error?.message || DEFAULT.label,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (res.data.proposal.state) {
|
|
||||||
case 'STATE_DECLINED':
|
|
||||||
return {
|
|
||||||
icon: 'stop',
|
|
||||||
label: t('Proposal did not have enough participation to be valid'),
|
|
||||||
};
|
|
||||||
case 'STATE_ENACTED':
|
|
||||||
return {
|
|
||||||
icon: 'tick-circle',
|
|
||||||
label: t('Vote passed and the proposal has been enacted'),
|
|
||||||
};
|
|
||||||
case 'STATE_FAILED':
|
|
||||||
return {
|
|
||||||
icon: 'thumbs-down',
|
|
||||||
label: t('Proposal became invalid and was not processed'),
|
|
||||||
};
|
|
||||||
case 'STATE_OPEN':
|
|
||||||
return {
|
|
||||||
// A checklist to indicate in progress
|
|
||||||
icon: 'form',
|
|
||||||
label: t('Voting is in progress'),
|
|
||||||
};
|
|
||||||
case 'STATE_PASSED':
|
|
||||||
return {
|
|
||||||
icon: 'thumbs-up',
|
|
||||||
label: t(
|
|
||||||
'Voting is complete and this proposal was approved. It is not yet enacted.'
|
|
||||||
),
|
|
||||||
};
|
|
||||||
case 'STATE_REJECTED':
|
|
||||||
return {
|
|
||||||
icon: 'disable',
|
|
||||||
label: t('The proposal was invalid'),
|
|
||||||
};
|
|
||||||
case 'STATE_WAITING_FOR_NODE_VOTE':
|
|
||||||
return {
|
|
||||||
// A sparkly thing indicating it's new
|
|
||||||
icon: 'clean',
|
|
||||||
label: t('Proposal is being checked by validators'),
|
|
||||||
};
|
|
||||||
default:
|
|
||||||
return DEFAULT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
export const ProposalStatusIcon = ({ id }: ProposalStatusIconProps) => {
|
|
||||||
const { icon, label } = getIconAndLabelForStatus(
|
|
||||||
useExplorerProposalStatusQuery({
|
|
||||||
variables: {
|
|
||||||
id,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="float-left mr-3">
|
|
||||||
<Tooltip description={<p>{label}</p>}>
|
|
||||||
<Icon name={icon} />
|
|
||||||
</Tooltip>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
import { Loader } from '@vegaprotocol/ui-toolkit';
|
|
||||||
import { BundleError } from './signature-bundle/bundle-error';
|
|
||||||
import { BundleExists } from './signature-bundle/bundle-exists';
|
|
||||||
import { useExplorerNewAssetSignatureBundleQuery } from './__generated__/SignatureBundle';
|
|
||||||
|
|
||||||
export interface ProposalSignatureBundleByTypeProps {
|
|
||||||
id: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If a proposal needs a signature bundle, AND that signature bundle exists
|
|
||||||
* AND that proposal is a New Asset Proposal, render an overview of the
|
|
||||||
* signature bundle. Or an error.
|
|
||||||
*
|
|
||||||
* There is an almost identical component, ProposalSignatureBundleUpdateAsset
|
|
||||||
*/
|
|
||||||
export const ProposalSignatureBundleNewAsset = ({
|
|
||||||
id,
|
|
||||||
}: ProposalSignatureBundleByTypeProps) => {
|
|
||||||
const { data, error, loading } = useExplorerNewAssetSignatureBundleQuery({
|
|
||||||
variables: {
|
|
||||||
id,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
if (loading) {
|
|
||||||
return <Loader />;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data?.erc20ListAssetBundle?.signatures) {
|
|
||||||
return (
|
|
||||||
<BundleExists
|
|
||||||
signatures={data.erc20ListAssetBundle.signatures}
|
|
||||||
nonce={data.erc20ListAssetBundle.nonce}
|
|
||||||
status={data.asset?.status}
|
|
||||||
proposalId={id}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return <BundleError status={data?.asset?.status} error={error} />;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
import { Loader } from '@vegaprotocol/ui-toolkit';
|
|
||||||
import type { ProposalSignatureBundleByTypeProps } from './signature-bundle-new';
|
|
||||||
import { BundleError } from './signature-bundle/bundle-error';
|
|
||||||
import { BundleExists } from './signature-bundle/bundle-exists';
|
|
||||||
import { useExplorerUpdateAssetSignatureBundleQuery } from './__generated__/SignatureBundle';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If a proposal needs a signature bundle, AND that signature bundle exists
|
|
||||||
* AND that proposal is a Asset Limits Proposal, render an overview of the
|
|
||||||
* signature bundle. Or an error.
|
|
||||||
*
|
|
||||||
* There is an almost identical component, ProposalSignatureBundleNewAsset
|
|
||||||
*/
|
|
||||||
export const ProposalSignatureBundleUpdateAsset = ({
|
|
||||||
id,
|
|
||||||
}: ProposalSignatureBundleByTypeProps) => {
|
|
||||||
const { data, error, loading } = useExplorerUpdateAssetSignatureBundleQuery({
|
|
||||||
variables: {
|
|
||||||
id,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
if (loading) {
|
|
||||||
return <Loader />;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data?.erc20SetAssetLimitsBundle?.signatures) {
|
|
||||||
return (
|
|
||||||
<BundleExists
|
|
||||||
signatures={data.erc20SetAssetLimitsBundle.signatures}
|
|
||||||
nonce={data.erc20SetAssetLimitsBundle.nonce}
|
|
||||||
status={data.asset?.status}
|
|
||||||
proposalId={id}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return <BundleError status={data?.asset?.status} error={error} />;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
import { ProposalSignatureBundleNewAsset } from './signature-bundle-new';
|
|
||||||
import { ProposalSignatureBundleUpdateAsset } from './signature-bundle-update';
|
|
||||||
|
|
||||||
export function format(date: string | undefined, def: string) {
|
|
||||||
if (!date) {
|
|
||||||
return def;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Date().toLocaleDateString() || def;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ProposalSignatureBundleProps {
|
|
||||||
id: string;
|
|
||||||
type: 'NewAsset' | 'UpdateAsset';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Some proposals, if enacted, generate a signature bundle.
|
|
||||||
* The queries have to be split due to the way the API returns
|
|
||||||
* errors, hence this slightly redundant feeling switcher.
|
|
||||||
*/
|
|
||||||
export const ProposalSignatureBundle = ({
|
|
||||||
id,
|
|
||||||
type,
|
|
||||||
}: ProposalSignatureBundleProps) => {
|
|
||||||
return type === 'NewAsset' ? (
|
|
||||||
<ProposalSignatureBundleNewAsset id={id} />
|
|
||||||
) : (
|
|
||||||
<ProposalSignatureBundleUpdateAsset id={id} />
|
|
||||||
);
|
|
||||||
};
|
|
||||||
-67
@@ -1,67 +0,0 @@
|
|||||||
import type { ApolloError } from '@apollo/client';
|
|
||||||
import { MockedProvider } from '@apollo/client/testing';
|
|
||||||
import { render } from '@testing-library/react';
|
|
||||||
import { AssetStatus } from '@vegaprotocol/types';
|
|
||||||
import { MemoryRouter } from 'react-router-dom';
|
|
||||||
import { BundleError } from './bundle-error';
|
|
||||||
|
|
||||||
describe('Bundle Error', () => {
|
|
||||||
const NON_ENABLED_STATUS: AssetStatus[] = [
|
|
||||||
AssetStatus.STATUS_PENDING_LISTING,
|
|
||||||
AssetStatus.STATUS_PROPOSED,
|
|
||||||
AssetStatus.STATUS_REJECTED,
|
|
||||||
];
|
|
||||||
|
|
||||||
const ENABLED_STATUS: AssetStatus[] = [AssetStatus.STATUS_ENABLED];
|
|
||||||
|
|
||||||
it.each(NON_ENABLED_STATUS)(
|
|
||||||
'shows the apollo error if not enabled and a message is provided',
|
|
||||||
(status) => {
|
|
||||||
const screen = render(
|
|
||||||
<MemoryRouter>
|
|
||||||
<MockedProvider>
|
|
||||||
<BundleError
|
|
||||||
error={{ message: 'test-error-message' } as ApolloError}
|
|
||||||
status={status}
|
|
||||||
/>
|
|
||||||
</MockedProvider>
|
|
||||||
</MemoryRouter>
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(screen.getByText('test-error-message')).toBeInTheDocument();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
it.each(NON_ENABLED_STATUS)(
|
|
||||||
'shows some fallback error message if the bundle has not been used and there is no error',
|
|
||||||
(status) => {
|
|
||||||
const screen = render(
|
|
||||||
<MemoryRouter>
|
|
||||||
<MockedProvider>
|
|
||||||
<BundleError status={status} />
|
|
||||||
</MockedProvider>
|
|
||||||
</MemoryRouter>
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(screen.getByText('No bundle for proposal ID')).toBeInTheDocument();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
it.each(ENABLED_STATUS)(
|
|
||||||
'hides ProposalLink if the status is enabled',
|
|
||||||
(status) => {
|
|
||||||
const screen = render(
|
|
||||||
<MemoryRouter>
|
|
||||||
<MockedProvider>
|
|
||||||
<BundleError
|
|
||||||
error={{ message: 'irrelevant ' } as ApolloError}
|
|
||||||
status={status}
|
|
||||||
/>
|
|
||||||
</MockedProvider>
|
|
||||||
</MemoryRouter>
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(screen.getByText('Asset already enabled')).toBeInTheDocument();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
-34
@@ -1,34 +0,0 @@
|
|||||||
import type { ApolloError } from '@apollo/client';
|
|
||||||
import type { AssetStatus } from '@vegaprotocol/types';
|
|
||||||
|
|
||||||
import { t } from '@vegaprotocol/i18n';
|
|
||||||
import Hash from '../../../../links/hash';
|
|
||||||
import { IconForBundleStatus } from './bundle-icon';
|
|
||||||
|
|
||||||
export interface BundleErrorProps {
|
|
||||||
status?: AssetStatus;
|
|
||||||
error?: ApolloError;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Renders if a proposal signature bundle cannot be found.
|
|
||||||
* It is also possible that a data node has dropped the bundle
|
|
||||||
* from its retention so there is a backup case where we check
|
|
||||||
* the status - if it's already enabled, pretend this isn't an error
|
|
||||||
*/
|
|
||||||
export const BundleError = ({ status, error }: BundleErrorProps) => {
|
|
||||||
return (
|
|
||||||
<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">{t('No signature bundle found')}</h1>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
{status === 'STATUS_ENABLED' ? (
|
|
||||||
t('Asset already enabled')
|
|
||||||
) : (
|
|
||||||
<Hash text={error ? error.message : t('No bundle for proposal ID')} />
|
|
||||||
)}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
-64
@@ -1,64 +0,0 @@
|
|||||||
import { MockedProvider } from '@apollo/client/testing';
|
|
||||||
import { render } from '@testing-library/react';
|
|
||||||
import { AssetStatus } from '@vegaprotocol/types';
|
|
||||||
import { MemoryRouter } from 'react-router-dom';
|
|
||||||
import { BundleExists } from './bundle-exists';
|
|
||||||
|
|
||||||
describe('Bundle Exists', () => {
|
|
||||||
const NON_ENABLED_STATUS: AssetStatus[] = [
|
|
||||||
AssetStatus.STATUS_PENDING_LISTING,
|
|
||||||
AssetStatus.STATUS_PROPOSED,
|
|
||||||
AssetStatus.STATUS_REJECTED,
|
|
||||||
];
|
|
||||||
|
|
||||||
const ENABLED_STATUS: AssetStatus[] = [AssetStatus.STATUS_ENABLED];
|
|
||||||
|
|
||||||
const MOCK_SIGNATURES =
|
|
||||||
'0x1760ce4efec01d5bb9fe57c0660a39a27e0b5a1bd39b4d3fc0452bf142a4ef733baaf4dbedd74cd676c759f96ac7f412ec05e136bbff8a81d9f0c2428df8e099004c4d166ece0527d86e202386e8758580790d0a46f6429baaa268b4bf5c11c9e3402e175a9022ae8295e543853c01383ef17cd58458ddfc9c706fca0ecffa0d3d0160eb5234e63a78b9649428ca7659eb693fdde86edfc6c2707ef2e8fbf4c76a9f0eebe183da571a58837e2fa995d7b10955ecf04c138dc0ce964f17c3de1f5c6d0060ec132cc515cf974ead1da38e2ff8d4b870335865e8d4d8c982182bddea18bb513e2d37fd32de7fedc0c4f694e6bcdcf20f8547f19e7d9d25ce32c6ca9ea51e01ad3b92475778d9da7251d3943071f59107c9cd7ad9dd1923c06e88d3352869d919a591bf30732bad2c3fcf30a9f664dbb7a9c65a64875a48cbeb5741bd0a853901';
|
|
||||||
const MOCK_NONCE =
|
|
||||||
'18250011763873610289536200551900545467959221115607409799241178172533618346952';
|
|
||||||
const MOCK_PROPOSAL_ID =
|
|
||||||
'285923fed8c66ffb416b163e8ec72d3a87b9b8e2570e7ee7fe97d7092a918bc8';
|
|
||||||
|
|
||||||
const PROPOSAL_LINK_TEXT = 'Visit our Governance site to submit this';
|
|
||||||
|
|
||||||
it.each(NON_ENABLED_STATUS)(
|
|
||||||
'shows a handy ProposalLink if the status is anything except enabled',
|
|
||||||
(status) => {
|
|
||||||
const screen = render(
|
|
||||||
<MemoryRouter>
|
|
||||||
<MockedProvider>
|
|
||||||
<BundleExists
|
|
||||||
nonce={MOCK_NONCE}
|
|
||||||
proposalId={MOCK_PROPOSAL_ID}
|
|
||||||
signatures={MOCK_SIGNATURES}
|
|
||||||
status={status}
|
|
||||||
/>
|
|
||||||
</MockedProvider>
|
|
||||||
</MemoryRouter>
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(screen.getByText(PROPOSAL_LINK_TEXT)).toBeInTheDocument();
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
it.each(ENABLED_STATUS)(
|
|
||||||
'hides ProposalLink if the status is enabled',
|
|
||||||
(status) => {
|
|
||||||
const screen = render(
|
|
||||||
<MemoryRouter>
|
|
||||||
<MockedProvider>
|
|
||||||
<BundleExists
|
|
||||||
nonce={MOCK_NONCE}
|
|
||||||
proposalId={MOCK_PROPOSAL_ID}
|
|
||||||
signatures={MOCK_SIGNATURES}
|
|
||||||
status={status}
|
|
||||||
/>
|
|
||||||
</MockedProvider>
|
|
||||||
</MemoryRouter>
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(screen.queryAllByText(PROPOSAL_LINK_TEXT)).toEqual([]);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
-46
@@ -1,46 +0,0 @@
|
|||||||
import { t } from '@vegaprotocol/i18n';
|
|
||||||
import type { AssetStatus } from '@vegaprotocol/types';
|
|
||||||
import ProposalLink from '../../../../links/proposal-link/proposal-link';
|
|
||||||
import { IconForBundleStatus } from './bundle-icon';
|
|
||||||
import { ProposalSignatureBundleDetails } from './details';
|
|
||||||
|
|
||||||
export interface BundleExistsProps {
|
|
||||||
signatures: string;
|
|
||||||
nonce: string;
|
|
||||||
status?: AssetStatus;
|
|
||||||
proposalId: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If a proposal needs a signature bundle, AND that signature bundle exists,
|
|
||||||
* this component renders that signature bundle.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
export const BundleExists = ({
|
|
||||||
signatures,
|
|
||||||
nonce,
|
|
||||||
status,
|
|
||||||
proposalId,
|
|
||||||
}: BundleExistsProps) => {
|
|
||||||
return (
|
|
||||||
<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'
|
|
||||||
? t('Asset added to bridge')
|
|
||||||
: t('Signature bundle generated')}
|
|
||||||
</h1>
|
|
||||||
|
|
||||||
<ProposalSignatureBundleDetails signatures={signatures} nonce={nonce} />
|
|
||||||
|
|
||||||
{status !== 'STATUS_ENABLED' ? (
|
|
||||||
<p className="mt-5">
|
|
||||||
<ProposalLink
|
|
||||||
id={proposalId}
|
|
||||||
text={t('Visit our Governance site to submit this')}
|
|
||||||
/>
|
|
||||||
</p>
|
|
||||||
) : null}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
-33
@@ -1,33 +0,0 @@
|
|||||||
import { render } from '@testing-library/react';
|
|
||||||
import { AssetStatus } from '@vegaprotocol/types';
|
|
||||||
import { IconForBundleStatus } from './bundle-icon';
|
|
||||||
|
|
||||||
describe('Bundle status icon', () => {
|
|
||||||
const NON_ENABLED_STATUS: AssetStatus[] = [
|
|
||||||
AssetStatus.STATUS_PENDING_LISTING,
|
|
||||||
AssetStatus.STATUS_PROPOSED,
|
|
||||||
AssetStatus.STATUS_REJECTED,
|
|
||||||
];
|
|
||||||
|
|
||||||
const ENABLED_STATUS: AssetStatus[] = [AssetStatus.STATUS_ENABLED];
|
|
||||||
|
|
||||||
it.each(NON_ENABLED_STATUS)(
|
|
||||||
'show a sparkle icon if the bundle is unused',
|
|
||||||
(status) => {
|
|
||||||
const screen = render(<IconForBundleStatus status={status} />);
|
|
||||||
const i = screen.getByRole('img');
|
|
||||||
expect(i).toHaveAttribute('aria-label');
|
|
||||||
expect(i.getAttribute('aria-label')).toMatch(/clean/);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
it.each(ENABLED_STATUS)(
|
|
||||||
'shows a tick if the bundle is already used',
|
|
||||||
(status) => {
|
|
||||||
const screen = render(<IconForBundleStatus status={status} />);
|
|
||||||
const i = screen.getByRole('img');
|
|
||||||
expect(i).toHaveAttribute('aria-label');
|
|
||||||
expect(i.getAttribute('aria-label')).toMatch(/tick-circle/);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
});
|
|
||||||
-17
@@ -1,17 +0,0 @@
|
|||||||
import type { AssetStatus } from '@vegaprotocol/types';
|
|
||||||
import type { IconName } from '@vegaprotocol/ui-toolkit';
|
|
||||||
import { Icon } from '@vegaprotocol/ui-toolkit';
|
|
||||||
|
|
||||||
export interface IconForBundleStatusProps {
|
|
||||||
status?: AssetStatus;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Naively select an icon for an asset. If it is enabled, we show a tick - anything
|
|
||||||
* else is assumed to be 'in progress'. There should only be a signature bundle or the
|
|
||||||
* asset should not exist
|
|
||||||
*/
|
|
||||||
export const IconForBundleStatus = ({ status }: IconForBundleStatusProps) => {
|
|
||||||
const i: IconName = status === 'STATUS_ENABLED' ? 'tick-circle' : 'clean';
|
|
||||||
return <Icon className="float-left mt-2 mr-3" name={i} />;
|
|
||||||
};
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user