diff --git a/apps/governance-e2e/src/integration/flow/staking-flow.cy.ts b/apps/governance-e2e/src/integration/flow/staking-flow.cy.ts index 985844e09..07cfb79d6 100644 --- a/apps/governance-e2e/src/integration/flow/staking-flow.cy.ts +++ b/apps/governance-e2e/src/integration/flow/staking-flow.cy.ts @@ -7,6 +7,7 @@ import { navigateTo, navigation, turnTelemetryOff, + setRiskAccepted, } from '../../support/common.functions'; import { clickOnValidatorFromList, @@ -57,6 +58,7 @@ context( // 1002-STKE-002, 1002-STKE-032 before('visit staking tab and connect vega wallet', function () { cy.visit('/'); + setRiskAccepted(); ethereumWalletConnect(); cy.connectVegaWallet(); vegaWalletSetSpecifiedApprovalAmount('1000'); diff --git a/apps/governance-e2e/src/integration/flow/token-association-flow.cy.ts b/apps/governance-e2e/src/integration/flow/token-association-flow.cy.ts index af57804e5..212420c2c 100644 --- a/apps/governance-e2e/src/integration/flow/token-association-flow.cy.ts +++ b/apps/governance-e2e/src/integration/flow/token-association-flow.cy.ts @@ -5,6 +5,7 @@ import { navigateTo, navigation, turnTelemetryOff, + setRiskAccepted, } from '../../support/common.functions'; import { stakingPageAssociateTokens, @@ -57,6 +58,7 @@ context( function () { cy.clearLocalStorage(); turnTelemetryOff(); + setRiskAccepted(); cy.mockChainId(); cy.reload(); waitForSpinner(); diff --git a/apps/governance-e2e/src/integration/view/home.cy.ts b/apps/governance-e2e/src/integration/view/home.cy.ts index 0c77b8162..47ce0e4a6 100644 --- a/apps/governance-e2e/src/integration/view/home.cy.ts +++ b/apps/governance-e2e/src/integration/view/home.cy.ts @@ -82,20 +82,20 @@ context('Home Page - verify elements on page', { tags: '@smoke' }, function () { it('should have information on active nodes', function () { cy.getByTestId('node-information') .first() - .should('contain.text', '1') + .should('contain.text', '2') .and('contain.text', 'active nodes'); }); it('should have information on consensus nodes', function () { cy.getByTestId('node-information') .last() - .should('contain.text', '1') + .should('contain.text', '2') .and('contain.text', 'consensus nodes'); }); it('should contain link to specific validators', function () { cy.getByTestId('validators') - .should('have.length', '1') + .should('have.length', '2') .each(($validator) => { cy.wrap($validator).find('a').should('have.attr', 'href'); }); diff --git a/apps/governance-e2e/src/integration/view/validators.cy.ts b/apps/governance-e2e/src/integration/view/validators.cy.ts index 791bf01d4..149866a8c 100644 --- a/apps/governance-e2e/src/integration/view/validators.cy.ts +++ b/apps/governance-e2e/src/integration/view/validators.cy.ts @@ -3,6 +3,7 @@ import { aliasGQLQuery } from '@vegaprotocol/cypress'; import { navigation, + setRiskAccepted, verifyPageHeader, verifyTabHighlighted, } from '../../support/common.functions'; @@ -187,6 +188,7 @@ context('Validators Page - verify elements on page', function () { before('connect wallets and click on validator', function () { cy.mockChainId(); cy.visit('/validators'); + setRiskAccepted(); cy.connectVegaWallet(); clickOnValidatorFromList(0); }); diff --git a/apps/governance-e2e/src/integration/view/wallet-vega.cy.ts b/apps/governance-e2e/src/integration/view/wallet-vega.cy.ts index 58011cc60..14a7c5d72 100644 --- a/apps/governance-e2e/src/integration/view/wallet-vega.cy.ts +++ b/apps/governance-e2e/src/integration/view/wallet-vega.cy.ts @@ -1,5 +1,8 @@ import { truncateByChars } from '@vegaprotocol/utils'; -import { waitForSpinner } from '../../support/common.functions'; +import { + setRiskAccepted, + waitForSpinner, +} from '../../support/common.functions'; import { vegaWalletFaucetAssetsWithoutCheck, vegaWalletTeardown, @@ -11,7 +14,6 @@ const connectButton = 'connect-vega-wallet'; const getVegaLink = 'link'; const dialog = '[role="dialog"]:visible'; const dialogHeader = 'dialog-title'; -const walletDialogHeader = 'wallet-dialog-title'; const connectorsList = 'connectors-list'; const dialogCloseBtn = 'dialog-close'; const accountNo = 'vega-account-truncated'; @@ -34,6 +36,7 @@ context( () => { before('visit token home page', () => { cy.visit('/'); + setRiskAccepted(); cy.get(walletContainer, { timeout: 60000 }).should('be.visible'); }); @@ -63,17 +66,12 @@ context( it('should have Connect Vega header visible', () => { cy.get(dialog).within(() => { - cy.getByTestId(walletDialogHeader) + cy.getByTestId(connectorsList) .should('be.visible') - .and('have.text', 'Get a Vega wallet'); - }); - }); - - it('should have jsonRpc and hosted connection options visible on list', function () { - cy.getByTestId(connectorsList).within(() => { - cy.getByTestId('connector-jsonRpc') - .should('be.visible') - .and('have.text', 'Use the Desktop App/CLI'); + .and( + 'have.text', + 'Get the Vega WalletGet MetaMask>_Command Line WalletView as public key' + ); }); }); @@ -88,7 +86,6 @@ context( before('connect vega wallet', function () { cy.mockChainId(); cy.visit('/'); - cy.wait('@ChainId'); cy.connectVegaWallet(); vegaWalletTeardown(); }); diff --git a/apps/governance-e2e/src/support/common.functions.ts b/apps/governance-e2e/src/support/common.functions.ts index c440176de..4ac18831e 100644 --- a/apps/governance-e2e/src/support/common.functions.ts +++ b/apps/governance-e2e/src/support/common.functions.ts @@ -102,6 +102,12 @@ export function turnTelemetryOff() { ); } +export function setRiskAccepted() { + cy.window().then((win) => + win.localStorage.setItem('vega_wallet_risk_accepted', 'true') + ); +} + export function dissociateFromSecondWalletKey() { const secondWalletKey = Cypress.env('vegaWalletPublicKey2Short'); cy.getByTestId('vega-in-wallet') diff --git a/apps/governance/src/components/notifications/rewards-moved-notification.tsx b/apps/governance/src/components/notifications/rewards-moved-notification.tsx new file mode 100644 index 000000000..7c669e6b5 --- /dev/null +++ b/apps/governance/src/components/notifications/rewards-moved-notification.tsx @@ -0,0 +1,44 @@ +import { + useLinks, + DApp, + CONSOLE_REWARDS_PAGE, +} from '@vegaprotocol/environment'; +import { + ExternalLink, + Intent, + NotificationBanner, + VegaIcon, + VegaIconNames, +} from '@vegaprotocol/ui-toolkit'; +import { Trans } from 'react-i18next'; +import { useMatch } from 'react-router-dom'; +import Routes from '../../routes/routes'; +import { type ReactNode } from 'react'; + +const ConsoleRewardsLink = ({ children }: { children: ReactNode }) => { + const consoleLink = useLinks(DApp.Console); + return ( + + {children} + + + ); +}; + +export const RewardsMovedNotification = () => { + const onRewardsPage = useMatch(Routes.REWARDS); + if (!onRewardsPage) return null; + + return ( + + Console]} + /> + + ); +}; diff --git a/apps/governance/src/components/page-templates/app-layout.tsx b/apps/governance/src/components/page-templates/app-layout.tsx index bf934830e..5d72c045a 100644 --- a/apps/governance/src/components/page-templates/app-layout.tsx +++ b/apps/governance/src/components/page-templates/app-layout.tsx @@ -10,6 +10,7 @@ import { ProtocolUpgradeProposalNotification, } from '@vegaprotocol/proposals'; import { ViewingAsBanner } from '@vegaprotocol/ui-toolkit'; +import { RewardsMovedNotification } from '../notifications/rewards-moved-notification'; interface AppLayoutProps { children: ReactNode; @@ -45,8 +46,10 @@ export const AppLayout = ({ children }: AppLayoutProps) => { const NotificationsContainer = () => { const { isReadOnly, pubKey, disconnect } = useVegaWallet(); + return (
+ diff --git a/apps/governance/src/routes/staking/home/validator-tables/consensus-validators-table.spec.tsx b/apps/governance/src/routes/staking/home/validator-tables/consensus-validators-table.spec.tsx index d11d729b7..bae509c58 100644 --- a/apps/governance/src/routes/staking/home/validator-tables/consensus-validators-table.spec.tsx +++ b/apps/governance/src/routes/staking/home/validator-tables/consensus-validators-table.spec.tsx @@ -288,7 +288,7 @@ describe('Consensus validators table', () => { expect( grid.querySelector('[role="gridcell"][col-id="totalPenalties"]') - ).toHaveTextContent('13.16%'); + ).toHaveTextContent('10.07%'); expect( grid.querySelector('[role="gridcell"][col-id="normalisedVotingPower"]') diff --git a/apps/governance/src/routes/staking/home/validator-tables/consensus-validators-table.tsx b/apps/governance/src/routes/staking/home/validator-tables/consensus-validators-table.tsx index 63272683f..915d7f394 100644 --- a/apps/governance/src/routes/staking/home/validator-tables/consensus-validators-table.tsx +++ b/apps/governance/src/routes/staking/home/validator-tables/consensus-validators-table.tsx @@ -185,15 +185,19 @@ export const ConsensusValidatorsTable = ({ const { rawValidatorScore: previousEpochValidatorScore } = getLastEpochScoreAndPerformance(previousEpochData, id); - const overstakingPenalty = calculateOverallPenalty( + const overstakingPenalty = calculateOverstakedPenalty( id, allNodesInPreviousEpoch ); - const totalPenalty = calculateOverstakedPenalty( + const totalPenalty = calculateOverallPenalty( id, allNodesInPreviousEpoch ); + const lastEpochDataForNode = allNodesInPreviousEpoch.find( + (node) => node.id === id + ); + return { id, [ValidatorFields.RANKING_INDEX]: stakedTotalRanking, @@ -239,6 +243,12 @@ export const ConsensusValidatorsTable = ({ : undefined, [ValidatorFields.MULTISIG_ERROR]: multisigStatus?.showMultisigStatusError, + [ValidatorFields.MULTISIG_PENALTY]: formatNumberPercentage( + new BigNumber(1) + .minus(lastEpochDataForNode?.rewardScore?.multisigScore ?? 1) + .times(100), + 2 + ), }; } ); @@ -378,7 +388,6 @@ export const ConsensusValidatorsTable = ({ headerTooltip: t('StakeDescription').toString(), cellRenderer: TotalStakeRenderer, width: 120, - sort: 'desc', }, { field: ValidatorFields.PENDING_STAKE, @@ -400,6 +409,7 @@ export const ConsensusValidatorsTable = ({ headerTooltip: t('NormalisedVotingPowerDescription').toString(), cellRenderer: VotingPowerRenderer, width: 120, + sort: 'desc', }, { field: ValidatorFields.TOTAL_PENALTIES, diff --git a/apps/governance/src/routes/staking/home/validator-tables/shared.tsx b/apps/governance/src/routes/staking/home/validator-tables/shared.tsx index 1abc3f8d3..fd804ce2e 100644 --- a/apps/governance/src/routes/staking/home/validator-tables/shared.tsx +++ b/apps/governance/src/routes/staking/home/validator-tables/shared.tsx @@ -40,6 +40,7 @@ export enum ValidatorFields { PENDING_USER_STAKE = 'pendingUserStake', USER_STAKE_SHARE = 'userStakeShare', MULTISIG_ERROR = 'multisigError', + MULTISIG_PENALTY = 'multisigPenalty', } export const addUserDataToValidator = ( @@ -327,7 +328,7 @@ interface TotalPenaltiesRendererProps { overstakedAmount: string; overstakingPenalty: string; totalPenalties: string; - multisigError?: boolean; + multisigPenalty: string; }; } @@ -346,11 +347,9 @@ export const TotalPenaltiesRenderer = ({
{t('overstakedPenalty')}: {data.overstakingPenalty}
- {data.multisigError && ( -
- {t('multisigPenalty')}: 100% -
- )} +
+ {t('multisigPenalty')}: {data.multisigPenalty} +
} > diff --git a/apps/governance/src/routes/staking/node/validator-table.tsx b/apps/governance/src/routes/staking/node/validator-table.tsx index 7c0c79a19..550052796 100644 --- a/apps/governance/src/routes/staking/node/validator-table.tsx +++ b/apps/governance/src/routes/staking/node/validator-table.tsx @@ -37,7 +37,6 @@ import { import type { ReactNode } from 'react'; import type { StakingNodeFieldsFragment } from '../__generated__/Staking'; import type { PreviousEpochQuery } from '../__generated__/PreviousEpoch'; -import { getMultisigStatusInfo } from '../../../lib/get-multisig-status-info'; const statuses = { [Schema.ValidatorStatus.VALIDATOR_NODE_STATUS_ERSATZ]: 'status-ersatz', @@ -105,9 +104,10 @@ export const ValidatorTable = ({ }; }, [node, previousEpochData?.epoch.validatorsConnection?.edges]); - const multisigStatus = previousEpochData - ? getMultisigStatusInfo(previousEpochData) - : undefined; + const previousNodeData = + previousEpochData?.epoch.validatorsConnection?.edges?.find( + (e) => e?.node.id === node.id + ); return ( <> @@ -293,21 +293,15 @@ export const ValidatorTable = ({ data-testid="multisig-penalty" className="flex gap-2 items-baseline" > - {multisigStatus?.zeroScoreNodes.find( - (n) => n.id === node.id - ) ? ( - - - - ) : null} {formatNumberPercentage( - BigNumber( - multisigStatus?.showMultisigStatusError ? 100 : 0 - ), + new BigNumber(1) + .minus( + previousNodeData?.node.rewardScore?.multisigScore ?? + 1 + ) + .times(100), 2 )} diff --git a/apps/trading/e2e/.env b/apps/trading/e2e/.env index 1332aef55..d13c2c7ed 100644 --- a/apps/trading/e2e/.env +++ b/apps/trading/e2e/.env @@ -1,3 +1,3 @@ CONSOLE_IMAGE_NAME=vegaprotocol/trading:latest -VEGA_VERSION=v0.74.6 +VEGA_VERSION=v0.75.0-preview.2 LOCAL_SERVER=false diff --git a/apps/trading/e2e/poetry.lock b/apps/trading/e2e/poetry.lock index f53798991..611b9af36 100644 --- a/apps/trading/e2e/poetry.lock +++ b/apps/trading/e2e/poetry.lock @@ -877,13 +877,13 @@ testing = ["filelock"] [[package]] name = "python-dateutil" -version = "2.8.2" +version = "2.9.0.post0" description = "Extensions to the standard Python datetime module" optional = false python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7" files = [ - {file = "python-dateutil-2.8.2.tar.gz", hash = "sha256:0123cacc1627ae19ddf3c27a5de5bd67ee4586fbdd6440d9748f8abb483d3e86"}, - {file = "python_dateutil-2.8.2-py2.py3-none-any.whl", hash = "sha256:961d03dc3453ebbc59dbdea9e4e11c5651520a876d0f4db161e8674aae935da9"}, + {file = "python-dateutil-2.9.0.post0.tar.gz", hash = "sha256:37dd54208da7e1cd875388217d5e00ebd4179249f90fb72437e91a35459a0ad3"}, + {file = "python_dateutil-2.9.0.post0-py2.py3-none-any.whl", hash = "sha256:a8b2bc7bffae282281c8140a97d3aa9c14da0b136dfe83f850eea9a5f7470427"}, ] [package.dependencies] @@ -1166,7 +1166,7 @@ profile = ["pytest-profiling", "snakeviz"] type = "git" url = "https://github.com/vegaprotocol/vega-market-sim.git/" reference = "HEAD" -resolved_reference = "33fec45ce8044ef7f53b625584ce590d174f9057" +resolved_reference = "53eed8942acb670783105cb1115bab76710a46dc" [[package]] name = "websocket-client" diff --git a/apps/trading/e2e/tests/market/test_market_info.py b/apps/trading/e2e/tests/market/test_market_info.py index 287f2ebe2..c5223a0ee 100644 --- a/apps/trading/e2e/tests/market/test_market_info.py +++ b/apps/trading/e2e/tests/market/test_market_info.py @@ -77,7 +77,7 @@ def test_market_info_market_volume(page: Page): page.get_by_test_id(market_title_test_id).get_by_text( "Market volume").click() fields = [ - ["24 Hour Volume", "-"], + ["24 Hour Volume", "0 (0 )"], ["Open Interest", "1"], ["Best Bid Volume", "99"], ["Best Offer Volume", "99"], diff --git a/apps/trading/e2e/tests/perpetual_market/test_perpetuals.py b/apps/trading/e2e/tests/perpetual_market/test_perpetuals.py index 252a41872..7b12a0b1f 100644 --- a/apps/trading/e2e/tests/perpetual_market/test_perpetuals.py +++ b/apps/trading/e2e/tests/perpetual_market/test_perpetuals.py @@ -57,7 +57,7 @@ class TestPerpetuals: page.goto(f"/#/markets/{perps_market}") page.get_by_test_id("Funding payments").click() row = page.locator(row_selector) - expect(row.locator(col_amount)).to_have_text("9.00 tDAI") + expect(row.locator(col_amount)).to_have_text("4.45 tDAI") @pytest.mark.usefixtures("risk_accepted", "auth") def test_funding_payment_loss(self, perps_market, page: Page, vega): @@ -65,7 +65,7 @@ class TestPerpetuals: change_keys(page, vega, "market_maker") page.get_by_test_id("Funding payments").click() row = page.locator(row_selector) - expect(row.locator(col_amount)).to_have_text("-27.00 tDAI") + expect(row.locator(col_amount)).to_have_text("-13.35 tDAI") @pytest.mark.usefixtures("risk_accepted", "auth") def test_funding_header(self, perps_market, page: Page): diff --git a/apps/trading/pages/_app.page.tsx b/apps/trading/pages/_app.page.tsx index e6913f4d2..8928d781b 100644 --- a/apps/trading/pages/_app.page.tsx +++ b/apps/trading/pages/_app.page.tsx @@ -24,7 +24,6 @@ import { ProtocolUpgradeInProgressNotification, ProtocolUpgradeProposalNotification, } from '@vegaprotocol/proposals'; -import { ViewingBanner } from '../components/viewing-banner'; import { Telemetry } from '../components/telemetry'; import { SSRLoader } from './ssr-loader'; import { PartyActiveOrdersHandler } from './party-active-orders-handler'; @@ -77,7 +76,6 @@ function AppBody({ Component }: AppProps) { mode={ProtocolUpgradeCountdownMode.IN_ESTIMATED_TIME_REMAINING} /> -
diff --git a/libs/cypress/src/lib/commands/mock-chain-id.ts b/libs/cypress/src/lib/commands/mock-chain-id.ts index 1c90f7938..e510a661b 100644 --- a/libs/cypress/src/lib/commands/mock-chain-id.ts +++ b/libs/cypress/src/lib/commands/mock-chain-id.ts @@ -12,7 +12,7 @@ declare global { } } -const chainId = 'test-id'; +const chainId = 'vega-stagnet1-202307191148'; export function addMockChainId() { Cypress.Commands.add('mockChainId', () => { diff --git a/libs/cypress/src/lib/commands/vega-wallet-connect.ts b/libs/cypress/src/lib/commands/vega-wallet-connect.ts index d3e6e9486..63c5049bc 100644 --- a/libs/cypress/src/lib/commands/vega-wallet-connect.ts +++ b/libs/cypress/src/lib/commands/vega-wallet-connect.ts @@ -37,10 +37,12 @@ export function addVegaWalletConnect() { Cypress.Commands.add('connectVegaWallet', (isMobile) => { mockConnectWallet(); cy.highlight(`Connecting Vega Wallet`); + cy.get('[data-testid="splash-loader"]', { timeout: 20000 }).should( + 'not.exist' + ); const connectVegaWalletButton = `[data-testid=connect-vega-wallet${ isMobile ? '-mobile' : '' }]:visible`; - cy.get(connectVegaWalletButton).then((btn) => { if (btn.length === 0) { cy.log('could not find the button, perhaps already connected'); diff --git a/libs/cypress/src/lib/mock-rest.ts b/libs/cypress/src/lib/mock-rest.ts index 359a37a48..f83306a65 100644 --- a/libs/cypress/src/lib/mock-rest.ts +++ b/libs/cypress/src/lib/mock-rest.ts @@ -13,7 +13,8 @@ declare global { const hasMethod = (req: CyHttpMessages.IncomingHttpRequest, method: string) => { const { body } = req; - return 'method' in body && body.method === method; + const b = JSON.parse(body); + return 'method' in b && b.method === method; }; export function addMockWalletCommand() { @@ -72,7 +73,7 @@ export const aliasWalletConnectQuery = ( body: { jsonrpc: '2.0', result: { - chainID: 'test-id', + chainID: 'vega-fairground-202305051805', }, id: '1', }, diff --git a/libs/environment/src/hooks/use-links.ts b/libs/environment/src/hooks/use-links.ts index ad860aba8..0a16bd5af 100644 --- a/libs/environment/src/hooks/use-links.ts +++ b/libs/environment/src/hooks/use-links.ts @@ -134,6 +134,7 @@ export const CONSOLE_TRANSFER = '#/portfolio/assets/transfer'; export const CONSOLE_TRANSFER_ASSET = '#/portfolio/assets/transfer?assetId=:assetId'; export const CONSOLE_MARKET_PAGE = '#/markets/:marketId'; +export const CONSOLE_REWARDS_PAGE = '#/rewards'; // Governance pages export const TOKEN_NEW_MARKET_PROPOSAL = '/proposals/propose/new-market'; diff --git a/libs/i18n/src/locales/en/governance.json b/libs/i18n/src/locales/en/governance.json index 222651edd..10a0be08d 100644 --- a/libs/i18n/src/locales/en/governance.json +++ b/libs/i18n/src/locales/en/governance.json @@ -971,5 +971,6 @@ "YourIdentityAnonymous": "Your identity is always anonymous on Vega", "yourStake": "Your stake", "yourVote": "Your vote", - "youVoted": "You voted" + "youVoted": "You voted", + "rewardsMovedNotification": "Trading and liquidity rewards have moved. Visit <0>Console to view your rewards." } diff --git a/libs/i18n/src/locales/en/markets.json b/libs/i18n/src/locales/en/markets.json index d9c51d509..37658239e 100644 --- a/libs/i18n/src/locales/en/markets.json +++ b/libs/i18n/src/locales/en/markets.json @@ -1,8 +1,6 @@ { "{{liquidityPriceRange}} of mid price": "{{liquidityPriceRange}} of mid price", "{{probability}} probability price bounds": "{{probability}} probability price bounds", - "24 hour change is unavailable at this time. The price change in the last 120 hours is:": "24 hour change is unavailable at this time. The price change in the last 120 hours is:", - "24 hour change is unavailable at this time. The volume change in the last 120 hours is {{candleVolumeValue}} for a total of {{candleVolumePrice}} {{quoteUnit}}": "24 hour change is unavailable at this time. The volume change in the last 120 hours is {{candleVolumeValue}} for a total of {{candleVolumePrice}} {{quoteUnit}}", "A concept derived from traditional markets. It is a calculated value for the ‘current market price’ on a market.": "A concept derived from traditional markets. It is a calculated value for the ‘current market price’ on a market.", "A number that will be calculated by an appropriate stochastic risk model, dependent on the type of risk model used and its parameters.": "A number that will be calculated by an appropriate stochastic risk model, dependent on the type of risk model used and its parameters.", "A sliding penalty for how much an LP bond is slashed if an LP fails to reach the minimum SLA. This is a network parameter.": "A sliding penalty for how much an LP bond is slashed if an LP fails to reach the minimum SLA. This is a network parameter.", @@ -51,9 +49,6 @@ "Market": "Market", "Market data": "Market data", "Market governance": "Market governance", - "Market has not been active for 24 hours. The price change between {{start}} and {{end}} is:": "Market has not been active for 24 hours. The price change between {{start}} and {{end}} is:", - "Market has not been active for 24 hours. The volume traded between {{start}} and {{end}} is:": "Market has not been active for 24 hours. The volume traded between {{start}} and {{end}} is:", - "Market has not been active for 24 hours. The volume traded between {{start}} and {{end}} is {{candleVolumeValue}} for a total of {{candleVolumePrice}} {{quoteUnit}}": "Market has not been active for 24 hours. The volume traded between {{start}} and {{end}} is {{candleVolumeValue}} for a total of {{candleVolumePrice}} {{quoteUnit}}", "Market ID": "Market ID", "Market price": "Market price", "Market specification": "Market specification", diff --git a/libs/markets/src/lib/components/last-24h-price-change/last-24h-price-change.tsx b/libs/markets/src/lib/components/last-24h-price-change/last-24h-price-change.tsx index 4d1a9d4d7..0eb29029f 100644 --- a/libs/markets/src/lib/components/last-24h-price-change/last-24h-price-change.tsx +++ b/libs/markets/src/lib/components/last-24h-price-change/last-24h-price-change.tsx @@ -2,16 +2,14 @@ import { type ReactNode } from 'react'; import { addDecimalsFormatNumber, formatNumberPercentage, - getDateTimeFormat, priceChange, priceChangePercentage, } from '@vegaprotocol/utils'; -import { PriceChangeCell, signedNumberCssClass } from '@vegaprotocol/datagrid'; -import { Tooltip, VegaIcon, VegaIconNames } from '@vegaprotocol/ui-toolkit'; +import { signedNumberCssClass } from '@vegaprotocol/datagrid'; +import { VegaIcon, VegaIconNames } from '@vegaprotocol/ui-toolkit'; import { useCandles } from '../../hooks/use-candles'; import BigNumber from 'bignumber.js'; import classNames from 'classnames'; -import { useT } from '../../use-t'; interface Props { marketId?: string; @@ -24,7 +22,6 @@ export const Last24hPriceChange = ({ decimalPlaces, fallback, }: Props) => { - const t = useT(); const { oneDayCandles, fiveDaysCandles, error } = useCandles({ marketId, }); @@ -35,56 +32,6 @@ export const Last24hPriceChange = ({ return nonIdeal; } - if (fiveDaysCandles.length < 24) { - return ( - - {t( - 'Market has not been active for 24 hours. The price change between {{start}} and {{end}} is:', - { - start: getDateTimeFormat().format( - new Date(fiveDaysCandles[0].periodStart) - ), - end: getDateTimeFormat().format( - new Date( - fiveDaysCandles[fiveDaysCandles.length - 1].periodStart - ) - ), - } - )} - c.close) || []} - decimalPlaces={decimalPlaces} - /> - - } - > - {nonIdeal} - - ); - } - - if (oneDayCandles.length < 24) { - return ( - - {t( - '24 hour change is unavailable at this time. The price change in the last 120 hours is:' - )}{' '} - c.close) || []} - decimalPlaces={decimalPlaces} - /> - - } - > - {nonIdeal} - - ); - } - const candles = oneDayCandles?.map((c) => c.close) || []; const change = priceChange(candles); const changePercentage = priceChangePercentage(candles); diff --git a/libs/markets/src/lib/components/last-24h-volume/last-24h-volume.tsx b/libs/markets/src/lib/components/last-24h-volume/last-24h-volume.tsx index c8b1f24cd..354f427c9 100644 --- a/libs/markets/src/lib/components/last-24h-volume/last-24h-volume.tsx +++ b/libs/markets/src/lib/components/last-24h-volume/last-24h-volume.tsx @@ -2,7 +2,6 @@ import { calcCandleVolume, calcCandleVolumePrice } from '../../market-utils'; import { addDecimalsFormatNumber, formatNumber, - getDateTimeFormat, isNumeric, } from '@vegaprotocol/utils'; import { Tooltip } from '@vegaprotocol/ui-toolkit'; @@ -37,83 +36,6 @@ export const Last24hVolume = ({ return nonIdeal; } - if (fiveDaysCandles.length < 24) { - const candleVolume = calcCandleVolume(fiveDaysCandles); - const candleVolumePrice = calcCandleVolumePrice( - fiveDaysCandles, - marketDecimals, - positionDecimalPlaces - ); - const candleVolumeValue = - candleVolume && isNumeric(positionDecimalPlaces) - ? addDecimalsFormatNumber( - candleVolume, - positionDecimalPlaces, - formatDecimals - ) - : '-'; - return ( - - - {t( - 'Market has not been active for 24 hours. The volume traded between {{start}} and {{end}} is {{candleVolumeValue}} for a total of {{candleVolumePrice}} {{quoteUnit}}', - { - start: getDateTimeFormat().format( - new Date(fiveDaysCandles[0].periodStart) - ), - end: getDateTimeFormat().format( - new Date( - fiveDaysCandles[fiveDaysCandles.length - 1].periodStart - ) - ), - candleVolumeValue, - candleVolumePrice, - quoteUnit, - } - )} - -
- } - > - {nonIdeal} - - ); - } - - if (oneDayCandles.length < 24) { - const candleVolume = calcCandleVolume(fiveDaysCandles); - const candleVolumePrice = calcCandleVolumePrice( - fiveDaysCandles, - marketDecimals, - positionDecimalPlaces - ); - const candleVolumeValue = - candleVolume && isNumeric(positionDecimalPlaces) - ? addDecimalsFormatNumber( - candleVolume, - positionDecimalPlaces, - formatDecimals - ) - : '-'; - return ( - - - {t( - '24 hour change is unavailable at this time. The volume change in the last 120 hours is {{candleVolumeValue}} for a total of ({{candleVolumePrice}} {{quoteUnit}})', - { candleVolumeValue, candleVolumePrice, quoteUnit } - )} - - - } - > - {nonIdeal} - - ); - } const candleVolume = oneDayCandles ? calcCandleVolume(oneDayCandles) : initialValue; diff --git a/libs/markets/src/lib/hooks/use-candles.ts b/libs/markets/src/lib/hooks/use-candles.ts index d22adc991..0916b7945 100644 --- a/libs/markets/src/lib/hooks/use-candles.ts +++ b/libs/markets/src/lib/hooks/use-candles.ts @@ -8,7 +8,7 @@ export const useCandles = ({ marketId }: { marketId?: string }) => { const fiveDaysAgo = useFiveDaysAgo(); const yesterday = useYesterday(); const since = new Date(fiveDaysAgo).toISOString(); - const { data, error } = useThrottledDataProvider({ + const { data: fiveDaysCandles, error } = useThrottledDataProvider({ dataProvider: marketCandlesProvider, variables: { marketId: marketId || '', @@ -18,13 +18,6 @@ export const useCandles = ({ marketId }: { marketId?: string }) => { skip: !marketId, }); - const fiveDaysCandles = data?.filter((c) => { - if (c.open === '' || c.close === '' || c.high === '' || c.close === '') { - return false; - } - return true; - }); - const oneDayCandles = fiveDaysCandles?.filter((candle) => isCandleLessThan24hOld(candle, yesterday) ); diff --git a/package.json b/package.json index af5c7b41c..360f97de5 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,6 @@ "build:all": "nx run-many --all --target=build", "build-spec:all": "nx run-many --all --target=build-spec", "lint:all": "nx run-many --all --target=lint", - "e2e:all": "nx run-many --all --target=e2e", "vegacapsule": "vegacapsule network bootstrap --config-path=../frontend-monorepo/vegacapsule/config.hcl", "release": "git checkout develop ; git pull ; node scripts/make-release.js", "trading:test": "cd apps/trading/e2e && poetry run pytest -k", diff --git a/tools/ci/check-affected.py b/tools/ci/check-affected.py index 6e35f3f98..430312a1a 100644 --- a/tools/ci/check-affected.py +++ b/tools/ci/check-affected.py @@ -7,18 +7,18 @@ projects = [] projects_e2e = [] previews = { - 'governance': 'not deployed', - 'explorer': 'not deployed', - 'trading': 'not deployed', - 'tools': 'not deployed', + 'governance': 'not deployed', + 'explorer': 'not deployed', + 'trading': 'not deployed', + 'tools': 'not deployed', } main_apps = ['governance', 'explorer', 'trading'] -preview_governance="not deployed" -preview_trading="not deployed" -preview_explorer="not deployed" -preview_tools="not deployed" +preview_governance = "not deployed" +preview_trading = "not deployed" +preview_explorer = "not deployed" +preview_tools = "not deployed" # take input from the pipeline parser = ArgumentParser() @@ -30,7 +30,8 @@ parser.add_argument('--event-name', help='name of event in CI') args = parser.parse_args() # run yarn affected command -affected=check_output(f'yarn nx print-affected --base={environ["NX_BASE"]} --head={environ["NX_HEAD"]} --select=projects'.split()).decode('utf-8') +affected = check_output( + f'yarn nx print-affected --base={environ["NX_BASE"]} --head={environ["NX_HEAD"]} --select=projects'.split()).decode('utf-8') # print useful information @@ -44,49 +45,54 @@ print(affected) print(">>>> eof debug") # define affection actions -> add to projects arrays and generate preview link + + def affect_app(app, preview_name=None): - print(f"{app} is affected") - projects.append(app) - if not preview_name: - preview_name=app - previews[app] = f'https://{preview_name}.{args.branch_slug}.vega.rocks' + print(f"{app} is affected") + projects.append(app) + if not preview_name: + preview_name = app + previews[app] = f'https://{preview_name}.{args.branch_slug}.vega.rocks' + # check appearance in the affected string for main apps for app in main_apps: - if app in affected: - affect_app(app) + if app in affected: + affect_app(app) # if non of main apps is affected - test all of them if not projects: - for app in main_apps: - affect_app(app) + for app in main_apps: + affect_app(app) # generate e2e targets projects_e2e = [f'{app}-e2e' for app in projects] +# remove trading-e2e because it doesn't exists any more (new target is: console-e2e) +if "trading-e2e" in projects_e2e: + projects_e2e.remove("trading-e2e") + # check affection for multisig-signer which is deployed only from develop and pull requests if args.event_name == 'pull_request' or 'develop' in args.github_ref: - if 'multisig-signer' in affected: - affect_app('multisig-signer', 'tools') + if 'multisig-signer' in affected: + affect_app('multisig-signer', 'tools') # now parse apps that are deployed from develop but don't have previews if 'develop' in args.github_ref: - for app in ['static', 'ui-toolkit']: - if app in affected: - projects.append(app) + for app in ['static', 'ui-toolkit']: + if app in affected: + projects.append(app) # if ref is in format release/{env}-{app} then only {app} is deployed if 'release' in args.github_ref: - for app in main_apps: - if f'{args.github_ref}'.endswith(app): - projects = [app] - projects_e2e = [f'{app}-e2e'] + for app in main_apps: + if f'{args.github_ref}'.endswith(app): + projects = [app] + projects_e2e = [f'{app}-e2e'] projects = json.dumps(projects) -# The trading project does not use the deafult NX e2e setup (cypress) -projects_e2e.remove('trading-e2e') projects_e2e = json.dumps(projects_e2e) print(f'Projects: {projects}') @@ -94,20 +100,20 @@ print(f'Projects E2E: {projects_e2e}') print('>> Previews') for preview, preview_value in previews.items(): - print(f'{preview}: {preview_value}') + print(f'{preview}: {preview_value}') print('>> EOF Previews') lines_to_write = [ - f'PREVIEW_GOVERNANCE={previews["governance"]}', - f'PREVIEW_EXPLORER={previews["explorer"]}', - f'PREVIEW_TRADING={previews["trading"]}', - f'PREVIEW_TOOLS={previews["tools"]}', - f'PROJECTS={projects}', - f'PROJECTS_E2E={projects_e2e}', + f'PREVIEW_GOVERNANCE={previews["governance"]}', + f'PREVIEW_EXPLORER={previews["explorer"]}', + f'PREVIEW_TRADING={previews["trading"]}', + f'PREVIEW_TOOLS={previews["tools"]}', + f'PROJECTS={projects}', + f'PROJECTS_E2E={projects_e2e}', ] env_file = environ['GITHUB_ENV'] print(f'Line to add to GITHUB_ENV file: {env_file}') print(lines_to_write) with open(env_file, 'a') as _f: - _f.write('\n'.join(lines_to_write)) + _f.write('\n'.join(lines_to_write))