diff --git a/README.md b/README.md index 9892cd2f8..db0c18375 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ The trading interface built based on a component toolkit. It will provide a way ### [Token](./apps/token) -The utlity dApp for interacting with the Vega token and using its' utility. This includes; delegation, nomination, governance and redemption of tokens. +The utility dApp for interacting with the Vega token and using its' utility. This includes; delegation, nomination, governance and redemption of tokens. ### [Explorer](./apps/explorer) @@ -51,7 +51,7 @@ A utility library for connecting to the Ethereum network and interacting with Ve ### [React Helpers](./libs/react-helpers) -Generic react helpers that can be used across multilpe applications, along with other utilities. +Generic react helpers that can be used across multiple applications, along with other utilities. # 💻 Develop diff --git a/apps/explorer-e2e/cypress.config.js b/apps/explorer-e2e/cypress.config.js new file mode 100644 index 000000000..bff3c5b62 --- /dev/null +++ b/apps/explorer-e2e/cypress.config.js @@ -0,0 +1,26 @@ +const { defineConfig } = require('cypress'); +const setupNodeEvents = require('./src/plugins/index.js'); + +module.exports = defineConfig({ + projectId: 'et4snf', + + e2e: { + setupNodeEvents, + baseUrl: 'http://localhost:3000', + fileServerFolder: '.', + fixturesFolder: false, + specPattern: '**/*.feature', + excludeSpecPattern: '**/*.js', + modifyObstructiveCode: false, + supportFile: './src/support/index.ts', + video: true, + videosFolder: '../../dist/cypress/apps/explorer-e2e/videos', + screenshotsFolder: '../../dist/cypress/apps/explorer-e2e/screenshots', + chromeWebSecurity: false, + }, + env: { + environment: 'CUSTOM', + tsConfig: 'tsconfig.json', + TAGS: 'not @todo and not @ignore and not @manual', + }, +}); diff --git a/apps/explorer-e2e/cypress.json b/apps/explorer-e2e/cypress.json deleted file mode 100644 index 56edbee7e..000000000 --- a/apps/explorer-e2e/cypress.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "baseUrl": "http://localhost:3000", - "projectId": "et4snf", - "fileServerFolder": ".", - "fixturesFolder": false, - "pluginsFile": "./src/plugins/index.js", - "testFiles": "*.{ts,feature,features}", - "ignoreTestFiles": "**/*.js", - "integrationFolder": "./src/integration", - "modifyObstructiveCode": false, - "supportFile": "./src/support/index.ts", - "video": true, - "videosFolder": "../../dist/cypress/apps/explorer-e2e/videos", - "screenshotsFolder": "../../dist/cypress/apps/explorer-e2e/screenshots", - "chromeWebSecurity": false, - "env": { - "environment": "CUSTOM", - "tsConfig": "tsconfig.json", - "TAGS": "not @todo and not @ignore and not @manual" - } -} diff --git a/apps/explorer-e2e/project.json b/apps/explorer-e2e/project.json index 6edc32a5e..56548b049 100644 --- a/apps/explorer-e2e/project.json +++ b/apps/explorer-e2e/project.json @@ -6,7 +6,7 @@ "e2e": { "executor": "@nrwl/cypress:cypress", "options": { - "cypressConfig": "apps/explorer-e2e/cypress.json", + "cypressConfig": "apps/explorer-e2e/cypress.config.js", "devServerTarget": "explorer:serve" }, "configurations": { diff --git a/apps/explorer-e2e/src/integration/transactions-page.feature b/apps/explorer-e2e/src/integration/transactions-page.feature index 0eb3bc1a2..edd8709ac 100644 --- a/apps/explorer-e2e/src/integration/transactions-page.feature +++ b/apps/explorer-e2e/src/integration/transactions-page.feature @@ -1,3 +1,5 @@ +@ignore +# tendermint times out getting txs on testnet atm Feature: Transactions Page Scenario: Navigate to transactions page @@ -5,14 +7,12 @@ Feature: Transactions Page When I navigate to the transactions page Then transactions page is correctly displayed - @ignore Scenario: Navigate to transaction details page Given I am on the homepage When I navigate to the transactions page And I click on the top transaction Then transaction details are displayed - @ignore Scenario: Navigate to transactions page using mobile Given I am on mobile and open the toggle menu When I navigate to the transactions page diff --git a/apps/explorer-e2e/src/support/pages/transactions-page.ts b/apps/explorer-e2e/src/support/pages/transactions-page.ts index ad0c7f0c4..ab072e208 100644 --- a/apps/explorer-e2e/src/support/pages/transactions-page.ts +++ b/apps/explorer-e2e/src/support/pages/transactions-page.ts @@ -15,11 +15,9 @@ export default class TransactionsPage extends BasePage { txType = 'tx-type'; validateTransactionsPagedisplayed() { - cy.getByTestId(this.transactionsList).should('have.length.above', 1); - cy.getByTestId(this.blockHeight).first().should('not.be.empty'); - cy.getByTestId(this.numberOfTransactions).first().should('not.be.empty'); - cy.getByTestId(this.validatorLink).first().should('not.be.empty'); - cy.getByTestId(this.blockTime).first().should('not.be.empty'); + // eslint-disable-next-line cypress/no-unnecessary-waiting + cy.wait(5000); // Wait for transactions to load if there are any + cy.getByTestId(this.transactionRow).should('have.length.above', 1); } validateRefreshBtn() { diff --git a/apps/explorer/src/app/components/nav/index.tsx b/apps/explorer/src/app/components/nav/index.tsx index 0196b41c6..edd947519 100644 --- a/apps/explorer/src/app/components/nav/index.tsx +++ b/apps/explorer/src/app/components/nav/index.tsx @@ -28,9 +28,10 @@ export const Nav = ({ menuOpen }: NavProps) => { className={({ isActive }) => classnames( 'block mb-8 px-8', - 'text-h5 hover:bg-vega-yellow hover:text-black', + 'text-h5 hover:bg-vega-pink dark:hover:bg-vega-yellow hover:text-white dark:hover:text-black', { - 'bg-vega-yellow text-black': isActive, + 'bg-vega-pink text-white dark:bg-vega-yellow dark:text-black': + isActive, } ) } diff --git a/apps/explorer/src/app/components/txs/index.tsx b/apps/explorer/src/app/components/txs/index.tsx index bd8d26d32..74e28c13c 100644 --- a/apps/explorer/src/app/components/txs/index.tsx +++ b/apps/explorer/src/app/components/txs/index.tsx @@ -1,3 +1,5 @@ export { TxList } from './tx-list'; export { BlockTxsData } from './block-txs-data'; export { TxOrderType } from './tx-order-type'; +export { TxsInfiniteList } from './txs-infinite-list'; +export { TxsInfiniteListItem } from './txs-infinite-list-item'; diff --git a/apps/explorer/src/app/components/txs/txs-infinite-list-item.spec.tsx b/apps/explorer/src/app/components/txs/txs-infinite-list-item.spec.tsx new file mode 100644 index 000000000..2673042e9 --- /dev/null +++ b/apps/explorer/src/app/components/txs/txs-infinite-list-item.spec.tsx @@ -0,0 +1,92 @@ +import { TxsInfiniteListItem } from './txs-infinite-list-item'; +import { render, screen, fireEvent, act } from '@testing-library/react'; +import { MemoryRouter } from 'react-router-dom'; + +describe('Txs infinite list item', () => { + it('should display "missing vital data" if "Type" data missing', () => { + render( + + ); + expect(screen.getByText('Missing vital data')).toBeInTheDocument(); + }); + + it('should display "missing vital data" if "Command" data missing', () => { + render( + + ); + expect(screen.getByText('Missing vital data')).toBeInTheDocument(); + }); + + it('should display "missing vital data" if "Pubkey" data missing', () => { + render( + + ); + expect(screen.getByText('Missing vital data')).toBeInTheDocument(); + }); + + it('should display "missing vital data" if "TxHash" data missing', () => { + render( + + ); + expect(screen.getByText('Missing vital data')).toBeInTheDocument(); + }); + + it('renders data correctly', () => { + const testCommandData = JSON.stringify({ + test: 'test of command data', + }); + + render( + + + + ); + expect(screen.getByTestId('tx-hash')).toHaveTextContent('testTxHash'); + expect(screen.getByTestId('pub-key')).toHaveTextContent('testPubKey'); + expect(screen.getByTestId('type')).toHaveTextContent('testType'); + const button = screen.getByTestId('command-details'); + act(() => { + fireEvent.click(button); + }); + expect(screen.getByText('"test of command data"')).toBeInTheDocument(); + }); +}); diff --git a/apps/explorer/src/app/components/txs/txs-infinite-list-item.tsx b/apps/explorer/src/app/components/txs/txs-infinite-list-item.tsx new file mode 100644 index 000000000..caaad0bf7 --- /dev/null +++ b/apps/explorer/src/app/components/txs/txs-infinite-list-item.tsx @@ -0,0 +1,70 @@ +import React, { useState } from 'react'; +import { + Dialog, + Icon, + Intent, + SyntaxHighlighter, +} from '@vegaprotocol/ui-toolkit'; +import { TruncatedLink } from '../truncate/truncated-link'; +import { Routes } from '../../routes/route-names'; +import { TxOrderType } from './tx-order-type'; +import type { ChainExplorerTxResponse } from '../../routes/types/chain-explorer-response'; + +const TRUNCATE_LENGTH = 14; + +export const TxsInfiniteListItem = ({ + TxHash, + PubKey, + Type, + Command, +}: ChainExplorerTxResponse) => { + const [open, setOpen] = useState(false); + + if (!TxHash || !PubKey || !Type || !Command) { + return
Missing vital data
; + } + + return ( +
+
+ +
+
+ +
+
+ + +
+
+ ); +}; diff --git a/apps/explorer/src/app/components/txs/txs-infinite-list.spec.tsx b/apps/explorer/src/app/components/txs/txs-infinite-list.spec.tsx new file mode 100644 index 000000000..97e100cd5 --- /dev/null +++ b/apps/explorer/src/app/components/txs/txs-infinite-list.spec.tsx @@ -0,0 +1,134 @@ +import { TxsInfiniteList } from './txs-infinite-list'; +import { render, screen, fireEvent, act } from '@testing-library/react'; +import { MemoryRouter } from 'react-router-dom'; + +const generateTxs = (number: number) => { + return Array.from(Array(number)).map((_) => ({ + Type: 'ChainEvent', + Command: + '{"txId":"0xc8941ac4ea989988cb8f72e8fdab2e2009376fd17619491439d36b519d27bc93","nonce":"1494","stakingEvent":{"index":"263","block":"14805346","stakeDeposited":{"ethereumAddress":"0x2e5fe63e5d49c26998cf4bfa9b64de1cf9ae7ef2","vegaPublicKey":"657c2a8a5867c43c831e24820b7544e2fdcc1cf610cfe0ece940fe78137400fd","amount":"38471116086510047870875","blockTime":"1652968806"}}}', + Sig: 'fe7624ab742c492cf1e667e79de4777992aca8e093c8707e1f22685c3125c6082cd21b85cd966a61ad4ca0cca2f8bed3082565caa5915bc3b2f78c1ae35cac0b', + PubKey: + '0x7d69327393cdfaaae50e5e215feca65273eafabfb38f32b8124e66298af346d5', + Nonce: 18296387398179254000, + TxHash: + '0x9C753FA6325F7A40D9C4FA5C25E24476C54613E12B1FA2DD841E3BB00D088B77', + })); +}; + +describe('Txs infinite list', () => { + it('should display a "no items" message when no items provided', () => { + render( + null} + error={undefined} + /> + ); + expect(screen.getByText('No items')).toBeInTheDocument(); + }); + + it('error is displayed at item level', () => { + const txs = generateTxs(1); + render( + null} + error={Error('test error!')} + /> + ); + expect(screen.getByText('Error: test error!')).toBeInTheDocument(); + }); + + it('item renders data of n length into list of n length', () => { + // Provided the number of items doesn't exceed the 30 it initially + // desires, all txs will initially render + const txs = generateTxs(10); + render( + + null} + error={undefined} + /> + + ); + + expect( + screen + .getByTestId('infinite-scroll-wrapper') + .querySelectorAll('.txs-infinite-list-item') + ).toHaveLength(10); + }); + + it('tries to load more items when required to initially fill the list', () => { + // For example, if initially rendering 15, the bottom of the list is + // in view of the viewport, and the callback should be executed + const txs = generateTxs(15); + const callback = jest.fn(); + + render( + + + + ); + + expect(callback.mock.calls.length).toEqual(1); + }); + + it('does not try to load more items if there are no more', () => { + const txs = generateTxs(3); + const callback = jest.fn(); + + render( + + + + ); + + expect(callback.mock.calls.length).toEqual(0); + }); + + it('loads more items is called when scrolled', () => { + const txs = generateTxs(20); + const callback = jest.fn(); + + render( + + + + ); + + act(() => { + fireEvent.scroll(screen.getByTestId('infinite-scroll-wrapper'), { + target: { scrollY: 600 }, + }); + }); + + expect(callback.mock.calls.length).toEqual(1); + }); +}); diff --git a/apps/explorer/src/app/components/txs/txs-infinite-list.tsx b/apps/explorer/src/app/components/txs/txs-infinite-list.tsx new file mode 100644 index 000000000..6a8e9b271 --- /dev/null +++ b/apps/explorer/src/app/components/txs/txs-infinite-list.tsx @@ -0,0 +1,109 @@ +import React from 'react'; +import { FixedSizeList as List } from 'react-window'; +import InfiniteLoader from 'react-window-infinite-loader'; +import { t } from '@vegaprotocol/react-helpers'; +import { TxsInfiniteListItem } from './txs-infinite-list-item'; +import type { ChainExplorerTxResponse } from '../../routes/types/chain-explorer-response'; + +interface TxsInfiniteListProps { + hasMoreTxs: boolean; + areTxsLoading: boolean | undefined; + txs: ChainExplorerTxResponse[] | undefined; + loadMoreTxs: () => void; + error: Error | undefined; + className?: string; +} + +interface ItemProps { + index: ChainExplorerTxResponse; + style: React.CSSProperties; + isLoading: boolean; + error: Error | undefined; +} + +// eslint-disable-next-line @typescript-eslint/no-empty-function +const NOOP = () => {}; + +const Item = ({ index, style, isLoading, error }: ItemProps) => { + let content; + if (error) { + content = t(`${error}`); + } else if (isLoading) { + content = t('Loading...'); + } else { + const { TxHash, PubKey, Type, Command, Sig, Nonce } = index; + content = ( + + ); + } + + return
{content}
; +}; + +export const TxsInfiniteList = ({ + hasMoreTxs, + areTxsLoading, + txs, + loadMoreTxs, + error, + className, +}: TxsInfiniteListProps) => { + if (!txs) { + return
No items
; + } + + // If there are more items to be loaded then add an extra row to hold a loading indicator. + const itemCount = hasMoreTxs ? txs.length + 1 : txs.length; + + // Pass an empty callback to InfiniteLoader in case it asks us to load more than once. + // eslint-disable-next-line @typescript-eslint/no-empty-function + const loadMoreItems = areTxsLoading ? NOOP : loadMoreTxs; + + // Every row is loaded except for our loading indicator row. + const isItemLoaded = (index: number) => !hasMoreTxs || index < txs.length; + + return ( +
+
+
Txn hash
+
Party
+
Type
+
+
+ + {({ onItemsRendered, ref }) => ( + + {({ index, style }) => ( + + )} + + )} + +
+
+ ); +}; diff --git a/apps/explorer/src/app/routes/router-config.tsx b/apps/explorer/src/app/routes/router-config.tsx index a4f2a0560..66ea07656 100644 --- a/apps/explorer/src/app/routes/router-config.tsx +++ b/apps/explorer/src/app/routes/router-config.tsx @@ -12,7 +12,7 @@ import Genesis from './genesis'; import { Block } from './blocks/id'; import { Blocks } from './blocks/home'; import { Tx } from './txs/id'; -import { Txs as TxHome } from './txs/home'; +import { TxsHome } from './txs/home'; import { PendingTxs } from './pending'; import flags from '../config/flags'; import { t } from '@vegaprotocol/react-helpers'; @@ -129,7 +129,7 @@ const routerConfig = [ }, { index: true, - element: , + element: , }, ], }, diff --git a/apps/explorer/src/app/routes/txs/home/index.tsx b/apps/explorer/src/app/routes/txs/home/index.tsx index 049e1603e..5316a02ea 100644 --- a/apps/explorer/src/app/routes/txs/home/index.tsx +++ b/apps/explorer/src/app/routes/txs/home/index.tsx @@ -1,32 +1,122 @@ -import type { TendermintBlockchainResponse } from '../../blocks/tendermint-blockchain-response'; import { DATA_SOURCES } from '../../../config'; +import { useCallback, useState, useMemo } from 'react'; +import { t, useFetch } from '@vegaprotocol/react-helpers'; import { RouteTitle } from '../../../components/route-title'; import { BlocksRefetch } from '../../../components/blocks'; -import { RenderFetched } from '../../../components/render-fetched'; -import { BlockTxsData } from '../../../components/txs'; import { JumpToBlock } from '../../../components/jump-to-block'; -import { t, useFetch } from '@vegaprotocol/react-helpers'; +import { TxsInfiniteList } from '../../../components/txs'; +import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; +import type { ChainExplorerTxResponse } from '../../types/chain-explorer-response'; +import type { TendermintBlockchainResponse } from '../../blocks/tendermint-blockchain-response'; -const Txs = () => { - const { - state: { data, error, loading }, - refetch, - } = useFetch( - `${DATA_SOURCES.tendermintUrl}/blockchain` +interface TxsProps { + latestBlockHeight: string; +} + +interface TxsStateProps { + txsData: ChainExplorerTxResponse[]; + hasMoreTxs: boolean; + nextPage: number; +} + +const Txs = ({ latestBlockHeight }: TxsProps) => { + const [{ txsData, hasMoreTxs, nextPage }, setTxsState] = + useState({ + txsData: [], + hasMoreTxs: true, + nextPage: 1, + }); + + const reusedBodyParams = useMemo( + () => ({ + node_url: DATA_SOURCES.tendermintUrl, + transaction_height: parseInt(latestBlockHeight), + page_size: 30, + }), + [latestBlockHeight] ); + const { + state: { error, loading }, + refetch, + } = useFetch( + DATA_SOURCES.chainExplorerUrl, + { + method: 'POST', + body: JSON.stringify(reusedBodyParams), + }, + false + ); + + const loadTxs = useCallback(async () => { + const data = await refetch( + undefined, + JSON.stringify({ + ...reusedBodyParams, + page_number: nextPage, + }) + ); + + if (data) { + setTxsState((prev) => ({ + ...prev, + nextPage: prev.nextPage + 1, + hasMoreTxs: true, + txsData: [...prev.txsData, ...(data as ChainExplorerTxResponse[])], + })); + } + }, [nextPage, refetch, reusedBodyParams]); + return (
{t('Transactions')} - - <> - - - - + + refetch( + undefined, + JSON.stringify({ + ...reusedBodyParams, + page_number: 1, + }) + ) + } + /> +
); }; -export { Txs }; +const Wrapper = () => { + const { + state: { data, error, loading }, + } = useFetch( + `${DATA_SOURCES.tendermintUrl}/blockchain` + ); + + return ( + ( + + )} + /> + ); +}; + +export { Wrapper as TxsHome }; diff --git a/apps/simple-trading-app-e2e/cypress.config.js b/apps/simple-trading-app-e2e/cypress.config.js new file mode 100644 index 000000000..4df3d82f1 --- /dev/null +++ b/apps/simple-trading-app-e2e/cypress.config.js @@ -0,0 +1,18 @@ +const { defineConfig } = require('cypress'); +module.exports = defineConfig({ + projectId: 'et4snf', + + e2e: { + baseUrl: 'http://localhost:4200', + fileServerFolder: '.', + fixturesFolder: false, + specPattern: './src/integration/*.ts', + excludeSpecPattern: '**/*.js', + modifyObstructiveCode: false, + supportFile: './src/support/index.ts', + video: true, + videosFolder: '../../dist/cypress/apps/explorer-e2e/videos', + screenshotsFolder: '../../dist/cypress/apps/explorer-e2e/screenshots', + chromeWebSecurity: false, + }, +}); diff --git a/apps/simple-trading-app-e2e/cypress.json b/apps/simple-trading-app-e2e/cypress.json deleted file mode 100644 index a76041db9..000000000 --- a/apps/simple-trading-app-e2e/cypress.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "baseUrl": "http://localhost:4200", - "fileServerFolder": ".", - "testFiles": "*.{ts,feature,features}", - "ignoreTestFiles": "**/*.js", - "fixturesFolder": "./src/fixtures", - "integrationFolder": "./src/integration", - "modifyObstructiveCode": false, - "supportFile": "./src/support/index.ts", - "pluginsFile": false, - "video": true, - "videosFolder": "../../dist/cypress/apps/simple-trading-app-e2e/videos", - "screenshotsFolder": "../../dist/cypress/apps/simple-trading-app-e2e/screenshots", - "chromeWebSecurity": false, - "projectId": "et4snf" -} diff --git a/apps/simple-trading-app-e2e/project.json b/apps/simple-trading-app-e2e/project.json index 080a1350d..2603c0f51 100644 --- a/apps/simple-trading-app-e2e/project.json +++ b/apps/simple-trading-app-e2e/project.json @@ -6,7 +6,7 @@ "e2e": { "executor": "@nrwl/cypress:cypress", "options": { - "cypressConfig": "apps/simple-trading-app-e2e/cypress.json", + "cypressConfig": "apps/simple-trading-app-e2e/cypress.config.js", "devServerTarget": "simple-trading-app:serve" }, "configurations": { diff --git a/apps/simple-trading-app-e2e/src/integration/market-list.test.ts b/apps/simple-trading-app-e2e/src/integration/market-list.test.ts index 08ed6f933..7b314d2b0 100644 --- a/apps/simple-trading-app-e2e/src/integration/market-list.test.ts +++ b/apps/simple-trading-app-e2e/src/integration/market-list.test.ts @@ -60,7 +60,7 @@ describe('market list', () => { cy.intercept('POST', '/query').as('Filters'); cy.visit('/markets'); cy.wait('@Filters').then((filters) => { - if (filters?.response?.body.data.markets.length) { + if (filters?.response?.body?.data?.markets?.length) { const asset = filters.response.body.data.markets[0].tradableInstrument.instrument .product.settlementAsset.symbol; diff --git a/apps/simple-trading-app/src/app/components/simple-market-list/__generated__/SimpleMarkets.ts b/apps/simple-trading-app/src/app/components/simple-market-list/__generated__/SimpleMarkets.ts index 9e9ce7943..efeb150a4 100644 --- a/apps/simple-trading-app/src/app/components/simple-market-list/__generated__/SimpleMarkets.ts +++ b/apps/simple-trading-app/src/app/components/simple-market-list/__generated__/SimpleMarkets.ts @@ -47,6 +47,10 @@ export interface SimpleMarkets_markets_tradableInstrument_instrument_product_set export interface SimpleMarkets_markets_tradableInstrument_instrument_product { __typename: "Future"; + /** + * String representing the quote (e.g. BTCUSD -> USD is quote) + */ + quoteName: string; /** * The name of the asset (string) */ diff --git a/apps/simple-trading-app/src/app/components/simple-market-list/constants.ts b/apps/simple-trading-app/src/app/components/simple-market-list/constants.ts index 6ad352067..a346ab7bc 100644 --- a/apps/simple-trading-app/src/app/components/simple-market-list/constants.ts +++ b/apps/simple-trading-app/src/app/components/simple-market-list/constants.ts @@ -1,19 +1,5 @@ -import { Intent } from '@vegaprotocol/ui-toolkit'; -import { MarketState } from '@vegaprotocol/types'; import { t } from '@vegaprotocol/react-helpers'; - -export const MARKET_STATUS: Record = { - [MarketState.Active]: Intent.Success, - [MarketState.Cancelled]: Intent.Primary, - [MarketState.Closed]: Intent.None, - [MarketState.Pending]: Intent.Warning, - [MarketState.Proposed]: Intent.Warning, - [MarketState.Rejected]: Intent.Danger, - [MarketState.Settled]: Intent.Primary, - [MarketState.Suspended]: Intent.Warning, - [MarketState.TradingTerminated]: Intent.Danger, - '': Intent.Primary, -}; +import { themelite as theme } from '@vegaprotocol/tailwindcss-config'; export const STATES_FILTER = [ { value: 'all', text: t('All') }, @@ -27,3 +13,115 @@ export const STATES_FILTER = [ { value: 'Suspended', text: t('Suspended') }, { value: 'TradingTerminated', text: t('TradingTerminated') }, ]; + +export const agGridLightVariables = ` + .ag-theme-balham { + --ag-row-border-color: ${theme.colors.transparent}; + --ag-row-hover-color: ${theme.colors.transparent}; + --ag-font-size: 15px; + } + .ag-theme-balham .ag-row-hover { + --ag-row-border-color: ${theme.colors.black[100]}; + } + .ag-theme-balham [col-id="status"] .ag-header-cell-label, + .ag-theme-balham [col-id="asset"] .ag-header-cell-label, + .ag-theme-balham [col-id="change"] .ag-header-cell-label{ + justify-content: center; + } + .ag-theme-balham .ag-header-row .ag-header-cell:first-child{ + padding-left: 0; + } + .ag-theme-balham .ag-ltr .ag-header-cell::after, .ag-theme-balham .ag-ltr .ag-header-group-cell::after { + right: 0; + } + .ag-theme-balham .ag-header-cell::after{ + width: 0; + } + .ag-theme-balham .ag-header{ + border-bottom-width: 0; + } + .ag-theme-balham .ag-has-focus .ag-row.ag-row-focus .ag-cell-focus { + outline: none; + border-width: 0; + } + .ag-theme-balham .ag-header-label-icon .ag-icon{ + position: relative; + } + .ag-theme-balham .ag-icon::before{ + font-size: 10px; + line-height: 12px; + position: absolute; + transform: rotate(45deg); + top: -6px; + right: -14px; + content: "â—¾"; + background: -webkit-linear-gradient(135deg, rgba(0,0,0,0.54) 0%, rgba(0,0,0,0.54) 40%, rgba(0,0,0,0) 40%, rgba(0,0,0,0) 52%, rgba(0,0,0,0.54) 52%, rgba(0,0,0,0.54) 100%); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + } + .ag-theme-balham .ag-icon-desc::before{ + background: -webkit-linear-gradient(135deg, #000 0%, #000 40%, rgba(0,0,0,0) 40%, rgba(0,0,0,0) 52%, rgba(0,0,0,0.54) 52%, rgba(0,0,0,0.54) 100%); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + } + .ag-theme-balham .ag-icon-asc::before{ + background: -webkit-linear-gradient(135deg, rgba(0,0,0,0.54) 0%, rgba(0,0,0,0.54) 40%, rgba(0,0,0,0) 40%, rgba(0,0,0,0) 52%, #000 52%, #000 100%); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + } +`; + +export const agGridDarkVariables = ` + .ag-theme-balham-dark { + --ag-row-border-color: ${theme.colors.transparent}; + --ag-row-hover-color: ${theme.colors.transparent}; + --ag-font-size: 15px; + } + .ag-theme-balham-dark .ag-row-hover { + --ag-row-border-color: ${theme.colors.white[100]}; + } + .ag-theme-balham-dark [col-id="status"] .ag-header-cell-label, + .ag-theme-balham-dark [col-id="asset"] .ag-header-cell-label, + .ag-theme-balham-dark [col-id="change"] .ag-header-cell-label{ + justify-content: center; + } + .ag-theme-balham-dark .ag-header-row .ag-header-cell:first-child{ + padding-left: 0; + } + .ag-theme-balham-dark .ag-header-cell::after{ + width: 0; + } + .ag-theme-balham-dark .ag-header{ + border-bottom-width: 0; + } + .ag-theme-balham-dark .ag-has-focus .ag-row.ag-row-focus .ag-cell-focus { + outline: none; + border-width: 0; + } + .ag-theme-balham-dark .ag-header-label-icon .ag-icon{ + position: relative; + } + .ag-theme-balham-dark .ag-icon::before{ + font-size: 10px; + line-height: 12px; + position: absolute; + transform: rotate(45deg); + top: -6px; + right: -14px; + content: "â—¾"; + background: -webkit-linear-gradient(135deg, rgba(245, 245, 245, 0.64) 0%, rgba(245, 245, 245, 0.64) 40%, rgba(0,0,0,0) 40%, rgba(0,0,0,0) 52%, rgba(245, 245, 245, 0.64) 52%, rgba(245, 245, 245, 0.64) 100%); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + background-position: center; + } + .ag-theme-balham-dark .ag-icon-desc::before{ + background: -webkit-linear-gradient(135deg, #fff 0%, #fff 40%, rgba(0,0,0,0) 40%, rgba(0,0,0,0) 52%, rgba(245, 245, 245, 0.64) 52%, rgba(245, 245, 245, 0.64) 100%); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + } + .ag-theme-balham-dark .ag-icon-asc::before{ + background: -webkit-linear-gradient(135deg, rgba(245, 245, 245, 0.64) 0%, rgba(245, 245, 245, 0.64) 40%, rgba(0,0,0,0) 40%, rgba(0,0,0,0) 52%, #fff 52%, #fff 100%); + -webkit-background-clip: text; + -webkit-text-fill-color: transparent; + } +`; diff --git a/apps/simple-trading-app/src/app/components/simple-market-list/data-provider.ts b/apps/simple-trading-app/src/app/components/simple-market-list/data-provider.ts index 5e3a4ad73..4466ba980 100644 --- a/apps/simple-trading-app/src/app/components/simple-market-list/data-provider.ts +++ b/apps/simple-trading-app/src/app/components/simple-market-list/data-provider.ts @@ -36,6 +36,7 @@ export const MARKETS_QUERY = gql` product { __typename ... on Future { + quoteName settlementAsset { symbol } diff --git a/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-list.spec.tsx b/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-list.spec.tsx index 3268c1f96..c2776419f 100644 --- a/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-list.spec.tsx +++ b/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-list.spec.tsx @@ -1,6 +1,12 @@ import React from 'react'; import { act } from 'react-dom/test-utils'; -import { render, screen, waitFor } from '@testing-library/react'; +import { + render, + screen, + waitFor, + cleanup, + getAllByRole, +} from '@testing-library/react'; import { MockedProvider } from '@apollo/client/testing'; import type { MockedResponse } from '@apollo/client/testing'; import { BrowserRouter } from 'react-router-dom'; @@ -37,6 +43,7 @@ describe('SimpleMarketList', () => { afterEach(() => { jest.clearAllMocks(); + cleanup(); }); it('should be properly renderer as empty', async () => { @@ -130,8 +137,12 @@ describe('SimpleMarketList', () => { await new Promise((resolve) => setTimeout(resolve, 0)); }); await waitFor(() => { - expect(screen.getByTestId('simple-market-list')).toBeInTheDocument(); + expect( + document.querySelector('.ag-center-cols-container') + ).toBeInTheDocument(); }); - expect(screen.getByTestId('simple-market-list').children).toHaveLength(2); + + const container = document.querySelector('.ag-center-cols-container'); + expect(getAllByRole(container as HTMLDivElement, 'row')).toHaveLength(2); }); }); diff --git a/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-list.tsx b/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-list.tsx index f5ae85aab..391e9efe7 100644 --- a/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-list.tsx +++ b/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-list.tsx @@ -1,17 +1,29 @@ -import React, { useCallback, useEffect, useMemo, useRef } from 'react'; +import React, { + useCallback, + useContext, + useEffect, + useMemo, + useRef, +} from 'react'; import { useNavigate, useParams } from 'react-router-dom'; import { subDays } from 'date-fns'; +import type { AgGridReact } from 'ag-grid-react'; +import { AgGridDynamic as AgGrid } from '@vegaprotocol/ui-toolkit'; import { useDataProvider } from '@vegaprotocol/react-helpers'; import { t } from '@vegaprotocol/react-helpers'; -import { AsyncRenderer, Lozenge, Splash } from '@vegaprotocol/ui-toolkit'; -import { Button } from '@vegaprotocol/ui-toolkit'; +import { AsyncRenderer } from '@vegaprotocol/ui-toolkit'; +import { ThemeContext } from '@vegaprotocol/react-helpers'; import type { MarketState } from '@vegaprotocol/types'; -import SimpleMarketPercentChange from './simple-market-percent-change'; -import SimpleMarketExpires from './simple-market-expires'; -import DataProvider from './data-provider'; -import { MARKET_STATUS } from './constants'; -import SimpleMarketToolbar from './simple-market-toolbar'; import useMarketsFilterData from '../../hooks/use-markets-filter-data'; +import useColumnDefinitions from '../../hooks/use-column-definitions'; +import DataProvider from './data-provider'; +import * as constants from './constants'; +import SimpleMarketToolbar from './simple-market-toolbar'; +import type { SimpleMarkets_markets } from './__generated__/SimpleMarkets'; + +export type SimpleMarketsType = SimpleMarkets_markets & { + percentChange?: number | '-'; +}; export type RouterParams = Partial<{ product: string; @@ -22,8 +34,9 @@ export type RouterParams = Partial<{ const SimpleMarketList = () => { const navigate = useNavigate(); const params = useParams(); - + const theme = useContext(ThemeContext); const statusesRef = useRef>({}); + const gridRef = useRef(null); const variables = useMemo( () => ({ CandleSince: subDays(Date.now(), 1).toJSON(), @@ -40,7 +53,14 @@ const SimpleMarketList = () => { update, variables ); - const localData = useMarketsFilterData(data || [], params); + const localData: Array = useMarketsFilterData( + data || [], + params + ); + + const handleOnGridReady = useCallback(() => { + gridRef.current?.api.sizeColumnsToFit(); + }, [gridRef]); useEffect(() => { const statuses: Record = {}; @@ -50,6 +70,11 @@ const SimpleMarketList = () => { statusesRef.current = statuses; }, [data, statusesRef]); + useEffect(() => { + window.addEventListener('resize', handleOnGridReady); + return () => window.removeEventListener('resize', handleOnGridReady); + }, [handleOnGridReady]); + const onClick = useCallback( (marketId) => { navigate(`/trading/${marketId}`); @@ -57,62 +82,34 @@ const SimpleMarketList = () => { [navigate] ); + const { columnDefs, defaultColDef } = useColumnDefinitions({ onClick }); + + const getRowId = useCallback(({ data }) => data.id, []); + return ( - <> +
- {localData && localData.length > 0 ? ( -
    - {localData?.map((market) => ( -
  • -
    -
    -
    {market.name}
    - -
    {`${t('settled in')} ${ - market.tradableInstrument.instrument.product - .settlementAsset.symbol - }`}
    -
    -
    -
    - -
    -
    - - {market.data?.market.state} - -
    -
    -
    -
    -
    -
  • - ))} -
- ) : ( - {t('No data to display')} - )} +
- +
); }; diff --git a/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-percent-change.spec.tsx b/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-percent-change.spec.tsx index 0e6d4e733..b6d89c262 100644 --- a/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-percent-change.spec.tsx +++ b/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-percent-change.spec.tsx @@ -7,11 +7,16 @@ import type { SimpleMarkets_markets_candles } from './__generated__/SimpleMarket describe('SimpleMarketPercentChange should parse proper change', () => { let candles: (SimpleMarkets_markets_candles | null)[] | null; + const setValue = () => undefined; it('empty array', () => { candles = []; render( - + ); expect(screen.getByText('-')).toBeInTheDocument(); @@ -20,7 +25,11 @@ describe('SimpleMarketPercentChange should parse proper change', () => { candles = null; render( - + ); expect(screen.getByText('-')).toBeInTheDocument(); @@ -33,7 +42,11 @@ describe('SimpleMarketPercentChange should parse proper change', () => { ]; render( - + ); expect(screen.getByText('100.000%')).toBeInTheDocument(); @@ -49,7 +62,11 @@ describe('SimpleMarketPercentChange should parse proper change', () => { ]; render( - + ); expect(screen.getByText('-50.000%')).toBeInTheDocument(); diff --git a/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-percent-change.tsx b/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-percent-change.tsx index e4c094736..9b0ade0d3 100644 --- a/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-percent-change.tsx +++ b/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-percent-change.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import { InView } from 'react-intersection-observer'; import { useSubscription } from '@apollo/client'; import { themelite as theme } from '@vegaprotocol/tailwindcss-config'; @@ -12,6 +12,7 @@ import { CANDLE_SUB } from './data-provider'; interface Props { candles: (SimpleMarkets_markets_candles | null)[] | null; marketId: string; + setValue: (arg: unknown) => void; } const getChange = ( @@ -51,20 +52,32 @@ const SimpleMarketPercentChangeWrapper = (props: Props) => { return ( // @ts-ignore falsy wrong type? - + {inView && } ); }; -const SimpleMarketPercentChange = ({ candles, marketId }: Props) => { +const SimpleMarketPercentChange = ({ candles, marketId, setValue }: Props) => { const { data: { candles: { close = undefined } = {} } = {} } = useSubscription(CANDLE_SUB, { variables: { marketId }, }); const change = getChange(candles, close); const color = getColor(change); - return

{change}

; + useEffect(() => { + const value = parseFloat(change); + setValue(isNaN(value) ? '-' : value); + }, [setValue, change]); + + return ( +
+ {change} +
+ ); }; export default SimpleMarketPercentChangeWrapper; diff --git a/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-renderer.tsx b/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-renderer.tsx new file mode 100644 index 000000000..5d26e330d --- /dev/null +++ b/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-renderer.tsx @@ -0,0 +1,26 @@ +import React from 'react'; +import type { SimpleMarkets_markets } from './__generated__/SimpleMarkets'; +import SimpleMarketExpires from './simple-market-expires'; + +interface Props { + data: SimpleMarkets_markets; +} + +const MarketNameRenderer = ({ data }: Props) => { + return ( +
+
+
+ {data.name}{' '} + +
+
+ {data.tradableInstrument.instrument.product.quoteName} +
+
+ ); +}; + +export default MarketNameRenderer; diff --git a/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-toolbar.tsx b/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-toolbar.tsx index c250871aa..48e7fc78f 100644 --- a/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-toolbar.tsx +++ b/apps/simple-trading-app/src/app/components/simple-market-list/simple-market-toolbar.tsx @@ -67,7 +67,7 @@ const SimpleMarketToolbar = () => { ); return ( -
+
    {
{activeNumber > 0 && (
    diff --git a/apps/simple-trading-app/src/app/hooks/use-column-definitions.tsx b/apps/simple-trading-app/src/app/hooks/use-column-definitions.tsx new file mode 100644 index 000000000..a3882fc93 --- /dev/null +++ b/apps/simple-trading-app/src/app/hooks/use-column-definitions.tsx @@ -0,0 +1,125 @@ +import React, { useMemo } from 'react'; +import { t } from '@vegaprotocol/react-helpers'; +import type { SimpleMarkets_markets } from '../components/simple-market-list/__generated__/SimpleMarkets'; +import MarketNameRenderer from '../components/simple-market-list/simple-market-renderer'; +import SimpleMarketPercentChange from '../components/simple-market-list/simple-market-percent-change'; +import { Button } from '@vegaprotocol/ui-toolkit'; +import type { ValueSetterParams } from 'ag-grid-community'; +import type { SimpleMarketsType } from '../components/simple-market-list/simple-market-list'; + +interface Props { + onClick: (marketId: string) => void; +} + +const useColumnDefinitions = ({ onClick }: Props) => { + const columnDefs = useMemo(() => { + return [ + { + colId: 'market', + headerName: t('Markets'), + headerClass: 'uppercase', + minWidth: 300, + field: 'name', + cellRenderer: ({ data }: { data: SimpleMarketsType }) => ( + + ), + }, + { + colId: 'asset', + headerName: t('Settlement asset'), + headerClass: 'uppercase', + minWidth: 100, + cellClass: 'uppercase flex h-full items-center', + field: 'tradableInstrument.instrument.product.settlementAsset.symbol', + cellRenderer: ({ data }: { data: SimpleMarketsType }) => ( +
    + {data.tradableInstrument.instrument.product.settlementAsset.symbol} +
    + ), + }, + { + colId: 'change', + headerName: t('24h change'), + headerClass: 'uppercase', + field: 'percentChange', + minWidth: 100, + valueSetter: (params: ValueSetterParams): boolean => { + const { oldValue, newValue, api, data } = params; + if (oldValue !== newValue) { + const newdata = { percentChange: newValue, ...data }; + api.applyTransaction({ update: [newdata] }); + return true; + } + return false; + }, + cellRenderer: ({ + data, + setValue, + }: { + data: SimpleMarketsType; + setValue: (arg: unknown) => void; + }) => ( + + ), + comparator: (valueA: number | '-', valueB: number | '-') => { + if (valueA === valueB) return 0; + if (valueA === '-') { + return -1; + } + if (valueB === '-') { + return 1; + } + return valueA > valueB ? 1 : -1; + }, + }, + { + colId: 'status', + headerName: t('Status'), + field: 'data.market.state', + headerClass: 'uppercase', + minWidth: 100, + cellRenderer: ({ data }: { data: SimpleMarkets_markets }) => ( +
    +
    + {data.data?.market.state} +
    +
    + ), + }, + { + colId: 'trade', + headerName: '', + headerClass: 'uppercase', + sortable: false, + minWidth: 100, + cellRenderer: ({ data }: { data: SimpleMarkets_markets }) => ( +
    + +
    + ), + }, + ]; + }, [onClick]); + + const defaultColDef = useMemo(() => { + return { + sortable: true, + unSortIcon: true, + }; + }, []); + + return { columnDefs, defaultColDef }; +}; + +export default useColumnDefinitions; diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index d20907146..12291450d 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "124661.013711767544930765", + "locked_amount": "123949.3351449367653555", "deposits": [ { "amount": "129999.45", @@ -488,7 +488,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "97499.58", "total_removed": "0", - "locked_amount": "65503.04337545080622283", + "locked_amount": "64804.952997247079204604", "deposits": [ { "amount": "97499.58", @@ -521,7 +521,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "135173.4239508", "total_removed": "0", - "locked_amount": "89531.35166557213976323285608", + "locked_amount": "88577.18263884362270361639432", "deposits": [ { "amount": "135173.4239508", @@ -554,7 +554,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "32499.86", "total_removed": "0", - "locked_amount": "27555.99917099787937361", + "locked_amount": "27262.324604263582721104", "deposits": [ { "amount": "32499.86", @@ -587,7 +587,7 @@ "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "10833.29", "total_removed": "0", - "locked_amount": "8969.210333073256934278", + "locked_amount": "8873.622111351784071168", "deposits": [ { "amount": "10833.29", @@ -675,7 +675,7 @@ "tranche_end": "2022-11-01T00:00:00.000Z", "total_added": "22500", "total_removed": "0", - "locked_amount": "15468.3027626811615", + "locked_amount": "15101.45352128623275", "deposits": [ { "amount": "15000", @@ -761,7 +761,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "0", - "locked_amount": "1804379.69836047439128314", + "locked_amount": "1788435.020023831121162896", "deposits": [ { "amount": "1852091.69", @@ -1777,7 +1777,7 @@ "tranche_end": "2022-09-30T00:00:00.000Z", "total_added": "60916.66666633337", "total_removed": "18705.279504739679372649", - "locked_amount": "14760.0056484630890178248654459722", + "locked_amount": "14291.414097045104884895635487211", "deposits": [ { "amount": "2833.333333", @@ -5226,9 +5226,9 @@ "tranche_id": 11, "tranche_start": "2021-09-03T00:00:00.000Z", "tranche_end": "2022-09-03T00:00:00.000Z", - "total_added": "19455.000000000000000003", + "total_added": "19457.000000000000000003", "total_removed": "5056.88782409978", - "locked_amount": "3597.64752092846370375055476445966514475", + "locked_amount": "3438.09619897894364166053010683028919314", "deposits": [ { "amount": "75", @@ -5260,6 +5260,11 @@ "user": "0x3a380f7CFdEeb723228cA57d2795EA215094000d", "tx": "0x72adba1aa2d918148f1a95eb6a447da22fa06217cadafa94d56f12fd22a389be" }, + { + "amount": "2", + "user": "0xB2BddeEb907797F9be51E3f9f75824f83cD71B67", + "tx": "0x09792a45790c762f046f34979cbbe7687661ce7643da9ba6bc9c128710191b46" + }, { "amount": "30", "user": "0xb4eE687f019A8e48F7087f4b4f8653208B8cc48f", @@ -8669,6 +8674,21 @@ "withdrawn_tokens": "940.30940496195", "remaining_tokens": "649.69059503805" }, + { + "address": "0xB2BddeEb907797F9be51E3f9f75824f83cD71B67", + "deposits": [ + { + "amount": "2", + "user": "0xB2BddeEb907797F9be51E3f9f75824f83cD71B67", + "tranche_id": 11, + "tx": "0x09792a45790c762f046f34979cbbe7687661ce7643da9ba6bc9c128710191b46" + } + ], + "withdrawals": [], + "total_tokens": "2", + "withdrawn_tokens": "0", + "remaining_tokens": "2" + }, { "address": "0xb4eE687f019A8e48F7087f4b4f8653208B8cc48f", "deposits": [ @@ -14123,7 +14143,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "74162.9780761646031", - "locked_amount": "2797204.7028220379638062054", + "locked_amount": "2772703.2835660003368440463", "deposits": [ { "amount": "1998.95815", @@ -14835,8 +14855,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15788853.065470999700000001", - "total_removed": "7926.7627792759659", - "locked_amount": "15140482.7365636033722263648641426217383077", + "total_removed": "8977.81072959055965", + "locked_amount": "15054047.07609322321427388182456345806299", "deposits": [ { "amount": "16249.93", @@ -15360,6 +15380,26 @@ "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", "tx": "0xa79f7f3e6436a1f473f3beab9e0a5c8bc4f52b38ac7aedb8610a1a9a9c4a786c" }, + { + "amount": "180.278846094717375", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tx": "0xca332ec8365253d3b17445c182d287e56783ab4552f3581f3a43dc6334fbfc7b" + }, + { + "amount": "173.18268014001675", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tx": "0x793dabbba22d3e8e88f7600162ee6456d6d1b58e49ce07209d3f97eaa485161f" + }, + { + "amount": "368.40753967648125", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tx": "0x959378e42a224a7cff0dde794e80a0f07cbbe6b61e9158092a037efaa726aa28" + }, + { + "amount": "329.178884403378375", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tx": "0x57a5f040ac80c34cc5c90c2cf939c21fa2ef872042998703d69995c71184ab44" + }, { "amount": "2446.31552516990115", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -15482,6 +15522,30 @@ "tranche_id": 2, "tx": "0xa79f7f3e6436a1f473f3beab9e0a5c8bc4f52b38ac7aedb8610a1a9a9c4a786c" }, + { + "amount": "180.278846094717375", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tranche_id": 2, + "tx": "0xca332ec8365253d3b17445c182d287e56783ab4552f3581f3a43dc6334fbfc7b" + }, + { + "amount": "173.18268014001675", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tranche_id": 2, + "tx": "0x793dabbba22d3e8e88f7600162ee6456d6d1b58e49ce07209d3f97eaa485161f" + }, + { + "amount": "368.40753967648125", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tranche_id": 2, + "tx": "0x959378e42a224a7cff0dde794e80a0f07cbbe6b61e9158092a037efaa726aa28" + }, + { + "amount": "329.178884403378375", + "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", + "tranche_id": 2, + "tx": "0x57a5f040ac80c34cc5c90c2cf939c21fa2ef872042998703d69995c71184ab44" + }, { "amount": "2446.31552516990115", "user": "0x20CD77B9FC2f1fEDfb6F184E25f7127BFE991C8b", @@ -15526,8 +15590,8 @@ } ], "total_tokens": "194999.1675", - "withdrawn_tokens": "7926.7627792759659", - "remaining_tokens": "187072.4047207240341" + "withdrawn_tokens": "8977.81072959055965", + "remaining_tokens": "186021.35677040944035" }, { "address": "0x89051CAb67Bc7F8CC44F7e270c6EDaf1EC57676c", @@ -16931,8 +16995,8 @@ "tranche_start": "2021-11-05T00:00:00.000Z", "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", - "total_removed": "2113641.840890679071831632", - "locked_amount": "8328080.66510881884167481291924447", + "total_removed": "2158746.556523576443330677", + "locked_amount": "8247873.1795980633455589418403988", "deposits": [ { "amount": "129284.449", @@ -17181,6 +17245,41 @@ "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", "tx": "0xc62ffa6bf5029422f44d9406972fc074b498e02f667a86ae9faba138b6cfd758" }, + { + "amount": "331.7071722886032605", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tx": "0xc279c1a171709ff76a9875fea2e8f98ceb5797714ead511ba95a12f61412fc13" + }, + { + "amount": "321.15600624174480075", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tx": "0x7289f6af545a72235c26ecd98b8a0c14fbb5e62af98ded20862cfad2ef59d3bc" + }, + { + "amount": "679.7663781595895195", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tx": "0x4cef72f21dd9cf51cb6fbc965bc0b514b9c2ea4e2d9ca62f19c5a5defc6eef60" + }, + { + "amount": "614.746506577953841", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tx": "0x4ef5e959da18a286e010bc26fdc2bdda73f3e612334b232cb3e4af4c8c3d018d" + }, + { + "amount": "17701.463096745440206695", + "user": "0x91715128a71c9C734CDC20E5EdEEeA02E72e428E", + "tx": "0x8ff111c8ad92e1fa74add7edaadb2a7fd781d6d50e43c17d8042b32054c2a210" + }, + { + "amount": "20364.3503859717532968", + "user": "0x47FbE34Fd93416c63d35544dEE6c6f442Db8513d", + "tx": "0x0327fb136e8b6a56b8ed65d6f5e7c729455a2b3d3684fc22c92cedcce5c00fc5" + }, + { + "amount": "5091.5260869122865738", + "user": "0xcc2cf726A84e71301f9079FC177BA946aa98A694", + "tx": "0x1f9f8184e28b9dabb8878b08ea6e50c93b7f18a724b1070a62c0223f12256339" + }, { "amount": "652.48254356494551875", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -18799,6 +18898,30 @@ "tranche_id": 3, "tx": "0xc62ffa6bf5029422f44d9406972fc074b498e02f667a86ae9faba138b6cfd758" }, + { + "amount": "331.7071722886032605", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tranche_id": 3, + "tx": "0xc279c1a171709ff76a9875fea2e8f98ceb5797714ead511ba95a12f61412fc13" + }, + { + "amount": "321.15600624174480075", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tranche_id": 3, + "tx": "0x7289f6af545a72235c26ecd98b8a0c14fbb5e62af98ded20862cfad2ef59d3bc" + }, + { + "amount": "679.7663781595895195", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tranche_id": 3, + "tx": "0x4cef72f21dd9cf51cb6fbc965bc0b514b9c2ea4e2d9ca62f19c5a5defc6eef60" + }, + { + "amount": "614.746506577953841", + "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", + "tranche_id": 3, + "tx": "0x4ef5e959da18a286e010bc26fdc2bdda73f3e612334b232cb3e4af4c8c3d018d" + }, { "amount": "652.48254356494551875", "user": "0x4Aa3c35F6CC2d507E5C18205ee57099A4C80B19b", @@ -20037,8 +20160,8 @@ } ], "total_tokens": "359123.469575", - "withdrawn_tokens": "154092.9757912160630365", - "remaining_tokens": "205030.4937837839369635" + "withdrawn_tokens": "156040.35185448395445825", + "remaining_tokens": "203083.11772051604554175" }, { "address": "0xBdd412797c1B78535Afc5F71503b91fAbD0160fB", @@ -20185,6 +20308,12 @@ } ], "withdrawals": [ + { + "amount": "5091.5260869122865738", + "user": "0xcc2cf726A84e71301f9079FC177BA946aa98A694", + "tranche_id": 3, + "tx": "0x1f9f8184e28b9dabb8878b08ea6e50c93b7f18a724b1070a62c0223f12256339" + }, { "amount": "6310.1901227904940866", "user": "0xcc2cf726A84e71301f9079FC177BA946aa98A694", @@ -20211,8 +20340,8 @@ } ], "total_tokens": "66299.71746", - "withdrawn_tokens": "23745.761900811119424", - "remaining_tokens": "42553.955559188880576" + "withdrawn_tokens": "28837.2879877234059978", + "remaining_tokens": "37462.4294722765940022" }, { "address": "0x66827bCD635f2bB1779d68c46aEB16541bCA6ba8", @@ -20529,6 +20658,12 @@ } ], "withdrawals": [ + { + "amount": "20364.3503859717532968", + "user": "0x47FbE34Fd93416c63d35544dEE6c6f442Db8513d", + "tranche_id": 3, + "tx": "0x0327fb136e8b6a56b8ed65d6f5e7c729455a2b3d3684fc22c92cedcce5c00fc5" + }, { "amount": "25242.3008271937471296", "user": "0x47FbE34Fd93416c63d35544dEE6c6f442Db8513d", @@ -20555,8 +20690,8 @@ } ], "total_tokens": "265198.86984", - "withdrawn_tokens": "94983.1600369573350624", - "remaining_tokens": "170215.7098030426649376" + "withdrawn_tokens": "115347.5104229290883592", + "remaining_tokens": "149851.3594170709116408" }, { "address": "0x35022e6c85B50F4904C7BC7e692A9F3bbEE8D2CE", @@ -20726,6 +20861,12 @@ } ], "withdrawals": [ + { + "amount": "17701.463096745440206695", + "user": "0x91715128a71c9C734CDC20E5EdEEeA02E72e428E", + "tranche_id": 3, + "tx": "0x8ff111c8ad92e1fa74add7edaadb2a7fd781d6d50e43c17d8042b32054c2a210" + }, { "amount": "45513.77740810577941926", "user": "0x91715128a71c9C734CDC20E5EdEEeA02E72e428E", @@ -20746,8 +20887,8 @@ } ], "total_tokens": "230391.5181735", - "withdrawn_tokens": "82506.25192192818881679", - "remaining_tokens": "147885.26625157181118321" + "withdrawn_tokens": "100207.715018673629023485", + "remaining_tokens": "130183.803154826370976515" }, { "address": "0xC6b2864fbCD2A8dEC8DEfD1D421bC1E450C370AD", @@ -21034,8 +21175,8 @@ "tranche_start": "2021-10-05T00:00:00.000Z", "tranche_end": "2023-04-05T00:00:00.000Z", "total_added": "5778205.3912159303", - "total_removed": "1390546.591547348229906227", - "locked_amount": "2973571.63505682836710488797665665", + "total_removed": "1417003.438054406291892727", + "locked_amount": "2941881.17244069509858904234270872", "deposits": [ { "amount": "552496.6455", @@ -21184,6 +21325,21 @@ "user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90", "tx": "0xa6b9993b9288eac739756499b2997155ce8b1bc6e862c1a6569c8e04463bb31f" }, + { + "amount": "3635.564694620199747", + "user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90", + "tx": "0x89b7e9f6200ba171c5f1115f9fd110284ef4ffaba58cf174b686bbe4905fe18a" + }, + { + "amount": "10109.350358551032104", + "user": "0xBc934494675a6ceB639B9EfEe5b9C0f017D35a75", + "tx": "0xc695996be3df837d7040aec8c5532965ac6554d5615575ee46fc87d604e2ebc0" + }, + { + "amount": "12711.9314538868301355", + "user": "0x91715128a71c9C734CDC20E5EdEEeA02E72e428E", + "tx": "0x68b69c1a3ebd9666638809539b4d8ced5b1ab8fe19c720dfffdc548b378513d3" + }, { "amount": "13341.31568777778021", "user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90", @@ -21552,6 +21708,12 @@ } ], "withdrawals": [ + { + "amount": "12711.9314538868301355", + "user": "0x91715128a71c9C734CDC20E5EdEEeA02E72e428E", + "tranche_id": 4, + "tx": "0x68b69c1a3ebd9666638809539b4d8ced5b1ab8fe19c720dfffdc548b378513d3" + }, { "amount": "32683.576612762644585", "user": "0x91715128a71c9C734CDC20E5EdEEeA02E72e428E", @@ -21572,8 +21734,8 @@ } ], "total_tokens": "165749.29365", - "withdrawn_tokens": "68641.624849504055385", - "remaining_tokens": "97107.668800495944615" + "withdrawn_tokens": "81353.5563033908855205", + "remaining_tokens": "84395.7373466091144795" }, { "address": "0x72e7BB93E73b2885a22CA29c34759361399a5C0e", @@ -21666,6 +21828,12 @@ } ], "withdrawals": [ + { + "amount": "10109.350358551032104", + "user": "0xBc934494675a6ceB639B9EfEe5b9C0f017D35a75", + "tranche_id": 4, + "tx": "0xc695996be3df837d7040aec8c5532965ac6554d5615575ee46fc87d604e2ebc0" + }, { "amount": "7013.412182841867109", "user": "0xBc934494675a6ceB639B9EfEe5b9C0f017D35a75", @@ -21722,8 +21890,8 @@ } ], "total_tokens": "110499.5291", - "withdrawn_tokens": "43654.936134887817154", - "remaining_tokens": "66844.592965112182846" + "withdrawn_tokens": "53764.286493438849258", + "remaining_tokens": "56735.242606561150742" }, { "address": "0xdbC5d439F373EB646345e1c67D1d46231ACE7dD3", @@ -22018,6 +22186,12 @@ "tranche_id": 4, "tx": "0xa6b9993b9288eac739756499b2997155ce8b1bc6e862c1a6569c8e04463bb31f" }, + { + "amount": "3635.564694620199747", + "user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90", + "tranche_id": 4, + "tx": "0x89b7e9f6200ba171c5f1115f9fd110284ef4ffaba58cf174b686bbe4905fe18a" + }, { "amount": "13341.31568777778021", "user": "0xafa64cCa337eFEE0AD827F6C2684e69275226e90", @@ -22080,8 +22254,8 @@ } ], "total_tokens": "331498.5873", - "withdrawn_tokens": "157304.28913691490831", - "remaining_tokens": "174194.29816308509169" + "withdrawn_tokens": "160939.853831535108057", + "remaining_tokens": "170558.733468464891943" }, { "address": "0x16da609341ed67750A8BCC5AAa2005471006Cd77", @@ -22157,8 +22331,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", - "total_removed": "34.173053016", - "locked_amount": "443233.07466590775804275636428212", + "total_removed": "75.634316334", + "locked_amount": "439350.6847287052296870462810756", "deposits": [ { "amount": "3000", @@ -28786,6 +28960,11 @@ "amount": "23.010020292", "user": "0xD27929d68ac0E5fd5C919A5eb5968C1D06D3Fb83", "tx": "0x8daf320262d0384cf5f9c290cc33721587beabd5e93026b3e9b76dc3fcd6659c" + }, + { + "amount": "41.461263318", + "user": "0x6EfF23b65688CaE71Af19128A7674b7Dd53f7f19", + "tx": "0x16a1ae4e6602247b005985fff7824f896a344caa9b6be09f4eacd3df840fa36c" } ], "users": [ @@ -43700,10 +43879,17 @@ "tx": "0xd23813c30e93f3867eaa257b7aef7052a050b1ee1c1a90102a3f40c5d989fe82" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "41.461263318", + "user": "0x6EfF23b65688CaE71Af19128A7674b7Dd53f7f19", + "tranche_id": 5, + "tx": "0x16a1ae4e6602247b005985fff7824f896a344caa9b6be09f4eacd3df840fa36c" + } + ], "total_tokens": "600", - "withdrawn_tokens": "0", - "remaining_tokens": "600" + "withdrawn_tokens": "41.461263318", + "remaining_tokens": "558.538736682" }, { "address": "0xa37d20cd446898508Ab961c6Be8d3fe1c15413fA", @@ -47836,7 +48022,7 @@ "tranche_start": "2021-12-05T00:00:00.000Z", "tranche_end": "2022-06-05T00:00:00.000Z", "total_added": "171288.42", - "total_removed": "32094.1716569431377", + "total_removed": "32535.6624708206377", "locked_amount": "0", "deposits": [ { @@ -52136,6 +52322,26 @@ "user": "0xDD5730a33719083470e641cF0e4154Dd04D5738d", "tx": "0x49bd6332008e65069aad8012f76f15f3dae19f664237b02f9152946297db812d" }, + { + "amount": "101.100697625", + "user": "0x6886CA9FfE30C5BB86590c71799Bf5550EDF845b", + "tx": "0x204f08eb22345e352efcbfd3921f813fdf1097ea3fc33b36387c3c1cc5678936" + }, + { + "amount": "250", + "user": "0xbCc28D073f7a96c0568D36FdB21A98105ee60Ca3", + "tx": "0xf1201851e334cac5ab0920f89874163c5074c608b8d810b5eb89fb62454ddc19" + }, + { + "amount": "63.3869111225", + "user": "0x002dA530f8691f012Cecf0ba859Dd5dFa7d9871D", + "tx": "0x901a76735076a5058146ce6fc79628d78d71e8d2b3161459c2daf64ae043f1d5" + }, + { + "amount": "27.00320513", + "user": "0x2fCBC94236FeF3e5173a7ec27a25925cd2304540", + "tx": "0xf44b015cc0a7f3c369d48e8c9b71985ad5280c709fd7d541c4d3194dac79482d" + }, { "amount": "183.6335597275", "user": "0x690Fc36d52eD3f198F0eBDea1557333a1766f786", @@ -53517,6 +53723,12 @@ } ], "withdrawals": [ + { + "amount": "101.100697625", + "user": "0x6886CA9FfE30C5BB86590c71799Bf5550EDF845b", + "tranche_id": 6, + "tx": "0x204f08eb22345e352efcbfd3921f813fdf1097ea3fc33b36387c3c1cc5678936" + }, { "amount": "148.899302375", "user": "0x6886CA9FfE30C5BB86590c71799Bf5550EDF845b", @@ -53525,8 +53737,8 @@ } ], "total_tokens": "250", - "withdrawn_tokens": "148.899302375", - "remaining_tokens": "101.100697625" + "withdrawn_tokens": "250", + "remaining_tokens": "0" }, { "address": "0xDFdC0c291ee8499777272ab3A7B786518c895966", @@ -56458,6 +56670,12 @@ } ], "withdrawals": [ + { + "amount": "63.3869111225", + "user": "0x002dA530f8691f012Cecf0ba859Dd5dFa7d9871D", + "tranche_id": 6, + "tx": "0x901a76735076a5058146ce6fc79628d78d71e8d2b3161459c2daf64ae043f1d5" + }, { "amount": "186.6130888775", "user": "0x002dA530f8691f012Cecf0ba859Dd5dFa7d9871D", @@ -56466,8 +56684,8 @@ } ], "total_tokens": "250", - "withdrawn_tokens": "186.6130888775", - "remaining_tokens": "63.3869111225" + "withdrawn_tokens": "250", + "remaining_tokens": "0" }, { "address": "0xDE321bC0E688C3cfda2D07f4BE1B7D4fB019cc91", @@ -64583,6 +64801,12 @@ } ], "withdrawals": [ + { + "amount": "27.00320513", + "user": "0x2fCBC94236FeF3e5173a7ec27a25925cd2304540", + "tranche_id": 6, + "tx": "0xf44b015cc0a7f3c369d48e8c9b71985ad5280c709fd7d541c4d3194dac79482d" + }, { "amount": "129.597196785", "user": "0x2fCBC94236FeF3e5173a7ec27a25925cd2304540", @@ -64603,8 +64827,8 @@ } ], "total_tokens": "500", - "withdrawn_tokens": "472.99679487", - "remaining_tokens": "27.00320513" + "withdrawn_tokens": "500", + "remaining_tokens": "0" }, { "address": "0x45564345F125F78d3C3894A2C5226C673F8eB0Ae", @@ -65762,10 +65986,17 @@ "tx": "0xc8541da6a57f410b6faba47a5e5184bae700193b7bd042914fffc562114d92f5" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "250", + "user": "0xbCc28D073f7a96c0568D36FdB21A98105ee60Ca3", + "tranche_id": 6, + "tx": "0xf1201851e334cac5ab0920f89874163c5074c608b8d810b5eb89fb62454ddc19" + } + ], "total_tokens": "250", - "withdrawn_tokens": "0", - "remaining_tokens": "250" + "withdrawn_tokens": "250", + "remaining_tokens": "0" }, { "address": "0x8c951C54F9cd08Cf81F770248e835D7A4F491a46", diff --git a/apps/static/src/assets/stagnet1-tranches.json b/apps/static/src/assets/stagnet1-tranches.json index a78237143..bd07f8956 100644 --- a/apps/static/src/assets/stagnet1-tranches.json +++ b/apps/static/src/assets/stagnet1-tranches.json @@ -38,7 +38,7 @@ "tranche_end": "2022-11-26T13:48:10.000Z", "total_added": "100", "total_removed": "0", - "locked_amount": "41.663429096905125", + "locked_amount": "40.84151128868595", "deposits": [ { "amount": "100", @@ -242,7 +242,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1100", "total_removed": "673.04388635", - "locked_amount": "321.05967465753423", + "locked_amount": "312.01857876712325", "deposits": [ { "amount": "1000", diff --git a/apps/static/src/assets/testnet-tranches.json b/apps/static/src/assets/testnet-tranches.json index 52379dd1f..d502d2247 100644 --- a/apps/static/src/assets/testnet-tranches.json +++ b/apps/static/src/assets/testnet-tranches.json @@ -69,7 +69,7 @@ "tranche_end": "2022-10-12T00:53:20.000Z", "total_added": "1010.000000000000000001", "total_removed": "668.4622323651", - "locked_amount": "294.7911558219177930002918724315068493", + "locked_amount": "286.4897859589040750002836532534246575", "deposits": [ { "amount": "1000", diff --git a/apps/stats-e2e/cypress.config.js b/apps/stats-e2e/cypress.config.js new file mode 100644 index 000000000..d0f97a453 --- /dev/null +++ b/apps/stats-e2e/cypress.config.js @@ -0,0 +1,18 @@ +const { defineConfig } = require('cypress'); +module.exports = defineConfig({ + projectId: 'et4snf', + + e2e: { + baseUrl: 'http://localhost:3010', + fileServerFolder: '.', + fixturesFolder: false, + specPattern: './src/integration/*.ts', + excludeSpecPattern: '**/*.js', + modifyObstructiveCode: false, + supportFile: './src/support/index.ts', + video: true, + videosFolder: '../../dist/cypress/apps/explorer-e2e/videos', + screenshotsFolder: '../../dist/cypress/apps/explorer-e2e/screenshots', + chromeWebSecurity: false, + }, +}); diff --git a/apps/stats-e2e/cypress.json b/apps/stats-e2e/cypress.json deleted file mode 100644 index 146fd9bd2..000000000 --- a/apps/stats-e2e/cypress.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "baseUrl": "http://localhost:3010", - "projectId": "et4snf", - "fileServerFolder": ".", - "fixturesFolder": "./src/fixtures", - "integrationFolder": "./src/integration", - "modifyObstructiveCode": false, - "supportFile": "./src/support/index.ts", - "pluginsFile": false, - "video": true, - "videosFolder": "../../dist/cypress/apps/stats-e2e/videos", - "screenshotsFolder": "../../dist/cypress/apps/stats-e2e/screenshots", - "chromeWebSecurity": false -} diff --git a/apps/stats-e2e/project.json b/apps/stats-e2e/project.json index fcaa00685..bafde918e 100644 --- a/apps/stats-e2e/project.json +++ b/apps/stats-e2e/project.json @@ -6,7 +6,7 @@ "e2e": { "executor": "@nrwl/cypress:cypress", "options": { - "cypressConfig": "apps/stats-e2e/cypress.json", + "cypressConfig": "apps/stats-e2e/cypress.config.js", "devServerTarget": "stats:serve" }, "configurations": { diff --git a/apps/token-e2e/cypress.config.js b/apps/token-e2e/cypress.config.js new file mode 100644 index 000000000..8d67c0742 --- /dev/null +++ b/apps/token-e2e/cypress.config.js @@ -0,0 +1,17 @@ +const { defineConfig } = require('cypress'); +module.exports = defineConfig({ + projectId: 'et4snf', + + e2e: { + baseUrl: 'http://localhost:4210', + fileServerFolder: '.', + fixturesFolder: false, + specPattern: '**/*.cy.{js,jsx,ts,tsx}', + modifyObstructiveCode: false, + supportFile: './src/support/index.ts', + video: true, + videosFolder: '../../dist/cypress/apps/explorer-e2e/videos', + screenshotsFolder: '../../dist/cypress/apps/explorer-e2e/screenshots', + chromeWebSecurity: false, + }, +}); diff --git a/apps/token-e2e/cypress.json b/apps/token-e2e/cypress.json deleted file mode 100644 index 4b862778f..000000000 --- a/apps/token-e2e/cypress.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "baseUrl": "http://localhost:4210", - "projectId": "et4snf", - "fileServerFolder": ".", - "fixturesFolder": "./src/fixtures", - "integrationFolder": "./src/integration", - "modifyObstructiveCode": false, - "supportFile": "./src/support/index.ts", - "pluginsFile": false, - "video": true, - "videosFolder": "../../dist/cypress/apps/token-e2e/videos", - "screenshotsFolder": "../../dist/cypress/apps/token-e2e/screenshots", - "chromeWebSecurity": false, - "env": { - "ETH_WALLET_MNEMONIC": "ugly gallery notice network true range brave clarify flat logic someone chunk", - "VEGA_WALLET_NAME" : "capsule_wallet", - "VEGA_WALLET_LOCATION" : "~/.vegacapsule/testnet/wallet", - "VEGA_WALLET_PASSPHRASE" : "123" - } -} diff --git a/apps/token-e2e/project.json b/apps/token-e2e/project.json index 03fdfb16c..58e6a15e6 100644 --- a/apps/token-e2e/project.json +++ b/apps/token-e2e/project.json @@ -6,7 +6,7 @@ "e2e": { "executor": "@nrwl/cypress:cypress", "options": { - "cypressConfig": "apps/token-e2e/cypress.json", + "cypressConfig": "apps/token-e2e/cypress.config.js", "devServerTarget": "token:serve" }, "configurations": { diff --git a/apps/token-e2e/src/integration/app.cy.ts b/apps/token-e2e/src/integration/app.cy.ts new file mode 100644 index 000000000..d4ba0c282 --- /dev/null +++ b/apps/token-e2e/src/integration/app.cy.ts @@ -0,0 +1,12 @@ +const fairgroundSet = Cypress.env('FAIRGROUND'); + +describe('token', () => { + beforeEach(() => cy.visit('/')); + + it('should always have a header title based on environment', () => { + cy.get('[data-testid="header-title"]', { timeout: 8000 }).should( + 'have.text', + `${fairgroundSet ? 'Fairground token' : 'VEGA TOKEN'}` + ); + }); +}); diff --git a/apps/token-e2e/src/integration/view/home.test.js b/apps/token-e2e/src/integration/home.cy.js similarity index 96% rename from apps/token-e2e/src/integration/view/home.test.js rename to apps/token-e2e/src/integration/home.cy.js index 3a0fdeec7..32a5d8483 100644 --- a/apps/token-e2e/src/integration/view/home.test.js +++ b/apps/token-e2e/src/integration/home.cy.js @@ -1,6 +1,7 @@ -import navigation from '../../locators/navigation.locators'; -import home from '../../locators/home.locators'; -import vegaToken from '../../fixtures/vegaToken.json'; + +import navigation from '../locators/navigation.locators'; +import home from '../locators/home.locators'; +import vegaToken from '../fixtures/vegaToken.json'; context('Home Page - verify elements on page', function () { before('visit token home page', function () { diff --git a/apps/token-e2e/src/integration/vesting.cy.js b/apps/token-e2e/src/integration/vesting.cy.js new file mode 100644 index 000000000..56302b535 --- /dev/null +++ b/apps/token-e2e/src/integration/vesting.cy.js @@ -0,0 +1,34 @@ +import navigation from '../locators/navigation.locators'; +import vesting from '../locators/vesting.locators'; + +context('Vesting Page - verify elements on page', function () { + before('navigate to vesting page', function () { + cy.visit('/') + .get(navigation.section) + .within(() => { + cy.get(navigation.vesting).click(); + }); + }); + + describe('with wallets disconnected', function () { + it('should have vesting tab highlighted', function () { + cy.get(navigation.section).within(() => { + cy.get(navigation.vesting).should('have.attr', 'aria-current'); + }); + }); + + it('should have VESTING header visible', function () { + cy.get(vesting.header).should('be.visible').and('have.text', 'Vesting'); + }); + + it('should have connect Eth wallet info', function () { + cy.get(vesting.connectPrompt).should('be.visible'); + }); + + it('should have connect Eth wallet button', function () { + cy.get(vesting.connectButton) + .should('be.visible') + .and('have.text', 'Connect Ethereum wallet'); + }); + }); +}); diff --git a/apps/token-e2e/src/locators/vesting.locators.js b/apps/token-e2e/src/locators/vesting.locators.js new file mode 100644 index 000000000..9a78ad757 --- /dev/null +++ b/apps/token-e2e/src/locators/vesting.locators.js @@ -0,0 +1,5 @@ +export default { + header: 'header h1', + connectPrompt: '[data-testid="eth-connect-prompt"]', + connectButton: '[data-testid="connect-to-eth-btn"]', +}; diff --git a/apps/token/src/components/app-footer/app-footer.tsx b/apps/token/src/components/app-footer/app-footer.tsx index ecdbacf5c..909abc010 100644 --- a/apps/token/src/components/app-footer/app-footer.tsx +++ b/apps/token/src/components/app-footer/app-footer.tsx @@ -7,7 +7,7 @@ import { ENV } from '../../config/env'; export const AppFooter = () => { return (