Merge remote-tracking branch 'origin/master' into feat/75-link-like-button

This commit is contained in:
sam-keen 2022-03-25 16:50:01 +00:00
commit bf2ff8af53
111 changed files with 214 additions and 108 deletions

View File

@ -2,6 +2,8 @@ NX_CHAIN_EXPLORER_URL = "https://explorer.vega.trading/.netlify/functions/chain-
NX_TENDERMINT_URL = "https://lb.testnet.vega.xyz/tm" NX_TENDERMINT_URL = "https://lb.testnet.vega.xyz/tm"
NX_TENDERMINT_WEBSOCKET_URL = "wss://lb.testnet.vega.xyz/tm/websocket" NX_TENDERMINT_WEBSOCKET_URL = "wss://lb.testnet.vega.xyz/tm/websocket"
NX_VEGA_URL = "https://lb.testnet.vega.xyz/query" NX_VEGA_URL = "https://lb.testnet.vega.xyz/query"
NX_VEGA_ENV = 'Testnet'
NX_VEGA_REST = 'https://lb.testnet.vega.xyz/datanode/rest'
NX_EXPLORER_ASSETS = 1 NX_EXPLORER_ASSETS = 1
NX_EXPLORER_GENESIS = 1 NX_EXPLORER_GENESIS = 1

View File

@ -3,6 +3,8 @@ NX_CHAIN_EXPLORER_URL = "https://explorer.vega.trading/.netlify/functions/chain-
NX_TENDERMINT_URL = "https://n04.d.vega.xyz/tm" NX_TENDERMINT_URL = "https://n04.d.vega.xyz/tm"
NX_TENDERMINT_WEBSOCKET_URL = "wss://n04.d.vega.xyz/tm/websocket" NX_TENDERMINT_WEBSOCKET_URL = "wss://n04.d.vega.xyz/tm/websocket"
NX_VEGA_URL = "https://n04.d.vega.xyz/query" NX_VEGA_URL = "https://n04.d.vega.xyz/query"
NX_VEGA_ENV = 'Devnet'
NX_VEGA_REST = 'https://n04.d.vega.xyz/datanode/rest'
# App flags # App flags
NX_EXPLORER_ASSETS = 1 NX_EXPLORER_ASSETS = 1

View File

@ -3,6 +3,8 @@ NX_CHAIN_EXPLORER_URL = "https://explorer.vega.trading/.netlify/functions/chain-
NX_TENDERMINT_URL = "https://mainnet-observer-proxy01.ops.vega.xyz/" NX_TENDERMINT_URL = "https://mainnet-observer-proxy01.ops.vega.xyz/"
NX_TENDERMINT_WEBSOCKET_URL = "wss://mainnet-observer-proxy01.ops.vega.xyz/websocket" NX_TENDERMINT_WEBSOCKET_URL = "wss://mainnet-observer-proxy01.ops.vega.xyz/websocket"
NX_VEGA_URL = "https://api.token.vega.xyz/query" NX_VEGA_URL = "https://api.token.vega.xyz/query"
NX_VEGA_ENV = 'Mainnet'
NX_VEGA_REST = 'https://api.token.vega.xyz/'
# App flags # App flags
NX_EXPLORER_ASSETS = 1 NX_EXPLORER_ASSETS = 1

View File

@ -3,6 +3,8 @@ NX_CHAIN_EXPLORER_URL = "https://explorer.vega.trading/.netlify/functions/chain-
NX_TENDERMINT_URL = "https://n03.s.vega.xyz/tm" NX_TENDERMINT_URL = "https://n03.s.vega.xyz/tm"
NX_TENDERMINT_WEBSOCKET_URL = "wss://n03.s.vega.xyz/tm/websocket" NX_TENDERMINT_WEBSOCKET_URL = "wss://n03.s.vega.xyz/tm/websocket"
NX_VEGA_URL = "https://n03.s.vega.xyz/query" NX_VEGA_URL = "https://n03.s.vega.xyz/query"
NX_VEGA_ENV = 'Stagnet 1'
NX_VEGA_REST = 'https://n03.s.vega.xyz/datanode/rest'
# App flags # App flags
NX_EXPLORER_ASSETS = 1 NX_EXPLORER_ASSETS = 1

View File

@ -3,6 +3,8 @@ NX_CHAIN_EXPLORER_URL = "https://explorer.vega.trading/.netlify/functions/chain-
NX_TENDERMINT_URL = "https://n03.stagnet2.vega.xyz/tm" NX_TENDERMINT_URL = "https://n03.stagnet2.vega.xyz/tm"
NX_TENDERMINT_WEBSOCKET_URL = "wss://n03.stagnet2.vega.xyz/tm/websocket" NX_TENDERMINT_WEBSOCKET_URL = "wss://n03.stagnet2.vega.xyz/tm/websocket"
NX_VEGA_URL = "https://n03.stagnet2.vega.xyz/query" NX_VEGA_URL = "https://n03.stagnet2.vega.xyz/query"
NX_VEGA_ENV = 'Stagnet 2'
NX_VEGA_REST = 'https://n01.stagnet2.vega.xyz/datanode/rest'
# App flags # App flags
NX_EXPLORER_ASSETS = 1 NX_EXPLORER_ASSETS = 1

View File

@ -3,6 +3,8 @@ NX_CHAIN_EXPLORER_URL = "https://explorer.vega.trading/.netlify/functions/chain-
NX_TENDERMINT_URL = "https://lb.testnet.vega.xyz/tm" NX_TENDERMINT_URL = "https://lb.testnet.vega.xyz/tm"
NX_TENDERMINT_WEBSOCKET_URL = "wss://lb.testnet.vega.xyz/tm/websocket" NX_TENDERMINT_WEBSOCKET_URL = "wss://lb.testnet.vega.xyz/tm/websocket"
NX_VEGA_URL = "https://lb.testnet.vega.xyz/query" NX_VEGA_URL = "https://lb.testnet.vega.xyz/query"
NX_VEGA_ENV = 'Testnet'
NX_VEGA_REST = 'https://lb.testnet.vega.xyz/datanode/rest'
# App flags # App flags
NX_EXPLORER_ASSETS = 1 NX_EXPLORER_ASSETS = 1

View File

@ -3,3 +3,5 @@ NX_CHAIN_EXPLORER_URL = "https://explorer.vega.trading/.netlify/functions/chain-
NX_TENDERMINT_URL = "https://n04.d.vega.xyz/tm" NX_TENDERMINT_URL = "https://n04.d.vega.xyz/tm"
NX_TENDERMINT_WEBSOCKET_URL = "wss://n04.d.vega.xyz/tm/websocket" NX_TENDERMINT_WEBSOCKET_URL = "wss://n04.d.vega.xyz/tm/websocket"
NX_VEGA_URL = "https://n04.d.vega.xyz/query" NX_VEGA_URL = "https://n04.d.vega.xyz/query"
NX_VEGA_ENV = 'Devnet'
NX_VEGA_REST = 'https://n04.d.vega.xyz/datanode/rest'

View File

@ -3,6 +3,8 @@ NX_CHAIN_EXPLORER_URL = "https://explorer.vega.trading/.netlify/functions/chain-
NX_TENDERMINT_URL = "https://lb.testnet.vega.xyz/tm" NX_TENDERMINT_URL = "https://lb.testnet.vega.xyz/tm"
NX_TENDERMINT_WEBSOCKET_URL = "wss://lb.testnet.vega.xyz/tm/websocket" NX_TENDERMINT_WEBSOCKET_URL = "wss://lb.testnet.vega.xyz/tm/websocket"
NX_VEGA_URL = "https://lb.testnet.vega.xyz/query" NX_VEGA_URL = "https://lb.testnet.vega.xyz/query"
NX_VEGA_ENV = 'Testnet'
NX_VEGA_REST = 'https://lb.testnet.vega.xyz/datanode/rest'
# App flags # App flags
NX_EXPLORER_ASSETS = 1 NX_EXPLORER_ASSETS = 1

View File

@ -3,3 +3,5 @@ NX_CHAIN_EXPLORER_URL = "https://explorer.vega.trading/.netlify/functions/chain-
NX_TENDERMINT_URL = "https://mainnet-observer-proxy01.ops.vega.xyz/" NX_TENDERMINT_URL = "https://mainnet-observer-proxy01.ops.vega.xyz/"
NX_TENDERMINT_WEBSOCKET_URL = "wss://mainnet-observer-proxy01.ops.vega.xyz/websocket" NX_TENDERMINT_WEBSOCKET_URL = "wss://mainnet-observer-proxy01.ops.vega.xyz/websocket"
NX_VEGA_URL = "https://api.token.vega.xyz/query" NX_VEGA_URL = "https://api.token.vega.xyz/query"
NX_VEGA_ENV = 'Mainnet'
NX_VEGA_REST = 'https://api.token.vega.xyz/'

View File

@ -3,3 +3,5 @@ NX_CHAIN_EXPLORER_URL = "https://explorer.vega.trading/.netlify/functions/chain-
NX_TENDERMINT_URL = "https://n03.s.vega.xyz/tm" NX_TENDERMINT_URL = "https://n03.s.vega.xyz/tm"
NX_TENDERMINT_WEBSOCKET_URL = "wss://n03.s.vega.xyz/tm/websocket" NX_TENDERMINT_WEBSOCKET_URL = "wss://n03.s.vega.xyz/tm/websocket"
NX_VEGA_URL = "https://n03.s.vega.xyz/query" NX_VEGA_URL = "https://n03.s.vega.xyz/query"
NX_VEGA_ENV = 'Stagnet 1'
NX_VEGA_REST = 'https://n03.s.vega.xyz/datanode/rest'

View File

@ -3,3 +3,5 @@ NX_CHAIN_EXPLORER_URL = "https://explorer.vega.trading/.netlify/functions/chain-
NX_TENDERMINT_URL = "https://n03.stagnet2.vega.xyz/tm" NX_TENDERMINT_URL = "https://n03.stagnet2.vega.xyz/tm"
NX_TENDERMINT_WEBSOCKET_URL = "wss://n03.stagnet2.vega.xyz/tm/websocket" NX_TENDERMINT_WEBSOCKET_URL = "wss://n03.stagnet2.vega.xyz/tm/websocket"
NX_VEGA_URL = "https://n03.stagnet2.vega.xyz/query" NX_VEGA_URL = "https://n03.stagnet2.vega.xyz/query"
NX_VEGA_ENV = 'Stagnet 2'
NX_VEGA_REST = 'https://n01.stagnet2.vega.xyz/datanode/rest'

View File

@ -3,3 +3,5 @@ NX_CHAIN_EXPLORER_URL = "https://explorer.vega.trading/.netlify/functions/chain-
NX_TENDERMINT_URL = "https://lb.testnet.vega.xyz/tm" NX_TENDERMINT_URL = "https://lb.testnet.vega.xyz/tm"
NX_TENDERMINT_WEBSOCKET_URL = "wss://lb.testnet.vega.xyz/tm/websocket" NX_TENDERMINT_WEBSOCKET_URL = "wss://lb.testnet.vega.xyz/tm/websocket"
NX_VEGA_URL = "https://lb.testnet.vega.xyz/query" NX_VEGA_URL = "https://lb.testnet.vega.xyz/query"
NX_VEGA_ENV = 'Testnet'
NX_VEGA_REST = 'https://lb.testnet.vega.xyz/datanode/rest'

View File

@ -28,7 +28,6 @@ body,
.template-sidebar { .template-sidebar {
border-bottom: 1px solid $white; border-bottom: 1px solid $white;
border-top: 1px solid $white;
display: grid; display: grid;
grid-template-rows: auto minmax(700px, 1fr); grid-template-rows: auto minmax(700px, 1fr);
grid-template-columns: 300px minmax(auto, 1fr); grid-template-columns: 300px minmax(auto, 1fr);

View File

@ -19,7 +19,7 @@ export const BlockData = ({ block, className }: BlockProps) => {
<TableRow data-testid="block-row" modifier="background"> <TableRow data-testid="block-row" modifier="background">
<TableCell <TableCell
data-testid="block-height" data-testid="block-height"
className="pl-4 py-2" className="pl-4 py-2 font-mono"
aria-label="Block height" aria-label="Block height"
> >
<Link <Link
@ -40,7 +40,7 @@ export const BlockData = ({ block, className }: BlockProps) => {
</TableCell> </TableCell>
<TableCell <TableCell
data-testid="validator-link" data-testid="validator-link"
className="px-8 text-center" className="px-8 text-center font-mono"
aria-label="Validator" aria-label="Validator"
> >
<Link to={`/${Routes.VALIDATORS}`}> <Link to={`/${Routes.VALIDATORS}`}>
@ -49,7 +49,7 @@ export const BlockData = ({ block, className }: BlockProps) => {
</TableCell> </TableCell>
<TableCell <TableCell
data-testid="block-time" data-testid="block-time"
className="text-center pr-28 text-neutral-300" className="text-center pr-28 text-neutral-300 w-[170px]"
aria-label="Block genesis" aria-label="Block genesis"
> >
<SecondsAgo date={block.header?.time} /> <SecondsAgo date={block.header?.time} />

View File

@ -3,4 +3,6 @@ export const DATA_SOURCES = {
tendermintUrl: process.env['NX_TENDERMINT_URL'] as string, tendermintUrl: process.env['NX_TENDERMINT_URL'] as string,
tendermintWebsocketUrl: process.env['NX_TENDERMINT_WEBSOCKET_URL'] as string, tendermintWebsocketUrl: process.env['NX_TENDERMINT_WEBSOCKET_URL'] as string,
dataNodeUrl: process.env['NX_VEGA_URL'] as string, dataNodeUrl: process.env['NX_VEGA_URL'] as string,
envName: process.env['NX_VEGA_ENV'] as string,
restEndpoint: process.env['NX_VEGA_REST'] as string,
}; };

View File

@ -36,7 +36,7 @@ const Block = () => {
<TableCell modifier="bordered"> <TableCell modifier="bordered">
<Link <Link
data-testid="block-validator" data-testid="block-validator"
className="text-vega-yellow" className="text-vega-yellow font-mono"
to={'/validators'} to={'/validators'}
> >
{header.proposer_address} {header.proposer_address}

View File

@ -1,9 +1,20 @@
import { StatsManager } from '@vegaprotocol/mainnet-stats-manager'; import { DATA_SOURCES } from '../../config';
import { StatsManager } from '@vegaprotocol/network-stats';
const envName = DATA_SOURCES.envName;
const restEndpoint = DATA_SOURCES.restEndpoint;
const statsEndpoint = `${restEndpoint}/statistics`;
const nodesEndpoint = `${restEndpoint}/nodes-data`;
const Home = () => { const Home = () => {
return ( return (
<section> <section>
<StatsManager className="mt-12 grid grid-cols-1 lg:grid-cols-2 lg:gap-16" /> <StatsManager
envName={envName}
statsEndpoint={statsEndpoint}
nodesEndpoint={nodesEndpoint}
className="mt-12 grid grid-cols-1 lg:grid-cols-2 lg:gap-16"
/>
</section> </section>
); );
}; };

4
apps/stats-e2e/.env Normal file
View File

@ -0,0 +1,4 @@
# App configuration variables
NX_VEGA_ENV = 'TESTNET'
CYPRESS_VEGA_ENV = 'TESTNET'
NX_VEGA_REST = 'https://lb.testnet.vega.xyz/datanode/rest'

View File

@ -0,0 +1,4 @@
# App configuration variables
NX_VEGA_ENV = 'DEVNET'
CYPRESS_VEGA_ENV = 'DEVNET'
NX_VEGA_REST = 'https://n04.d.vega.xyz/datanode/rest'

View File

@ -0,0 +1,4 @@
# App configuration variables
NX_VEGA_ENV = 'MAINNET'
CYPRESS_VEGA_ENV = 'MAINNET'
NX_VEGA_REST = 'https://api.token.vega.xyz/'

View File

@ -0,0 +1,4 @@
# App configuration variables
NX_VEGA_ENV = 'STAGNET 1'
CYPRESS_VEGA_ENV = 'STAGNET 1'
NX_VEGA_REST = 'https://n03.s.vega.xyz/datanode/rest'

View File

@ -0,0 +1,4 @@
# App configuration variables
NX_VEGA_ENV = 'STAGNET 2'
CYPRESS_VEGA_ENV = 'STAGNET 2'
NX_VEGA_REST = 'https://n01.stagnet2.vega.xyz/datanode/rest'

View File

@ -0,0 +1,4 @@
# App configuration variables
NX_VEGA_ENV = 'TESTNET'
CYPRESS_VEGA_ENV = 'TESTNET'
NX_VEGA_REST = 'https://lb.testnet.vega.xyz/datanode/rest'

View File

@ -8,7 +8,7 @@
"supportFile": "./src/support/index.ts", "supportFile": "./src/support/index.ts",
"pluginsFile": false, "pluginsFile": false,
"video": true, "video": true,
"videosFolder": "../../dist/cypress/apps/stats-mainnet-e2e/videos", "videosFolder": "../../dist/cypress/apps/stats-e2e/videos",
"screenshotsFolder": "../../dist/cypress/apps/stats-mainnet-e2e/screenshots", "screenshotsFolder": "../../dist/cypress/apps/stats-e2e/screenshots",
"chromeWebSecurity": false "chromeWebSecurity": false
} }

View File

@ -0,0 +1,28 @@
{
"root": "apps/stats-e2e",
"sourceRoot": "apps/stats-e2e/src",
"projectType": "application",
"targets": {
"e2e": {
"executor": "@nrwl/cypress:cypress",
"options": {
"cypressConfig": "apps/stats-e2e/cypress.json",
"devServerTarget": "stats:serve"
},
"configurations": {
"production": {
"devServerTarget": "stats:serve:production"
}
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/stats-e2e/**/*.{js,ts}"]
}
}
},
"tags": [],
"implicitDependencies": ["stats"]
}

View File

@ -0,0 +1,9 @@
const textToCheck = Cypress.env('VEGA_ENV');
describe('stats', () => {
beforeEach(() => cy.visit('/'));
it('should display header based on environment name', () => {
cy.get('h3').should('have.text', `/ ${textToCheck}`);
});
});

View File

@ -1,28 +0,0 @@
{
"root": "apps/stats-mainnet-e2e",
"sourceRoot": "apps/stats-mainnet-e2e/src",
"projectType": "application",
"targets": {
"e2e": {
"executor": "@nrwl/cypress:cypress",
"options": {
"cypressConfig": "apps/stats-mainnet-e2e/cypress.json",
"devServerTarget": "stats-mainnet:serve"
},
"configurations": {
"production": {
"devServerTarget": "stats-mainnet:serve:production"
}
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": ["apps/stats-mainnet-e2e/**/*.{js,ts}"]
}
}
},
"tags": [],
"implicitDependencies": ["stats-mainnet"]
}

View File

@ -1,7 +0,0 @@
describe('stats-mainnet', () => {
beforeEach(() => cy.visit('/'));
it('should display header', () => {
cy.get('h3').should('have.text', '/ Mainnet');
});
});

3
apps/stats/.env.devnet Normal file
View File

@ -0,0 +1,3 @@
# App configuration variables
NX_VEGA_ENV = 'DEVNET'
NX_VEGA_REST = 'https://n04.d.vega.xyz/datanode/rest'

3
apps/stats/.env.mainnet Normal file
View File

@ -0,0 +1,3 @@
# App configuration variables
NX_VEGA_ENV = 'MAINNET'
NX_VEGA_REST = 'https://api.token.vega.xyz/'

3
apps/stats/.env.stagnet1 Normal file
View File

@ -0,0 +1,3 @@
# App configuration variables
NX_VEGA_ENV = 'STAGNET 1'
NX_VEGA_REST = 'https://n03.s.vega.xyz/datanode/rest'

3
apps/stats/.env.stagnet2 Normal file
View File

@ -0,0 +1,3 @@
# App configuration variables
NX_VEGA_ENV = 'STAGNET 2'
NX_VEGA_REST = 'https://n01.stagnet2.vega.xyz/datanode/rest'

3
apps/stats/.env.testnet Normal file
View File

@ -0,0 +1,3 @@
# App configuration variables
NX_VEGA_ENV = 'TESTNET'
NX_VEGA_REST = 'https://lb.testnet.vega.xyz/datanode/rest'

View File

@ -1,11 +1,11 @@
module.exports = { module.exports = {
displayName: 'stats-mainnet', displayName: 'stats',
preset: '../../jest.preset.js', preset: '../../jest.preset.js',
transform: { transform: {
'^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest', '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest',
'^.+\\.[tj]sx?$': 'babel-jest', '^.+\\.[tj]sx?$': 'babel-jest',
}, },
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/apps/stats-mainnet', coverageDirectory: '../../coverage/apps/stats',
setupFilesAfterEnv: ['./src/setup-tests.ts'], setupFilesAfterEnv: ['./src/setup-tests.ts'],
}; };

View File

@ -1,6 +1,6 @@
{ {
"root": "apps/stats-mainnet", "root": "apps/stats",
"sourceRoot": "apps/stats-mainnet/src", "sourceRoot": "apps/stats/src",
"projectType": "application", "projectType": "application",
"targets": { "targets": {
"build": { "build": {
@ -9,17 +9,17 @@
"defaultConfiguration": "production", "defaultConfiguration": "production",
"options": { "options": {
"compiler": "babel", "compiler": "babel",
"outputPath": "dist/apps/stats-mainnet", "outputPath": "dist/apps/stats",
"index": "apps/stats-mainnet/src/index.html", "index": "apps/stats/src/index.html",
"baseHref": "/", "baseHref": "/",
"main": "apps/stats-mainnet/src/main.tsx", "main": "apps/stats/src/main.tsx",
"polyfills": "apps/stats-mainnet/src/polyfills.ts", "polyfills": "apps/stats/src/polyfills.ts",
"tsConfig": "apps/stats-mainnet/tsconfig.app.json", "tsConfig": "apps/stats/tsconfig.app.json",
"assets": [ "assets": [
"apps/stats-mainnet/src/assets/favicon.ico", "apps/stats/src/assets/favicon.ico",
"apps/stats-mainnet/src/assets" "apps/stats/src/assets"
], ],
"styles": ["apps/stats-mainnet/src/styles/styles.css"], "styles": ["apps/stats/src/styles/styles.css"],
"scripts": [], "scripts": [],
"webpackConfig": "@nrwl/react/plugins/webpack" "webpackConfig": "@nrwl/react/plugins/webpack"
}, },
@ -27,8 +27,8 @@
"production": { "production": {
"fileReplacements": [ "fileReplacements": [
{ {
"replace": "apps/stats-mainnet/src/environments/environment.ts", "replace": "apps/stats/src/environments/environment.ts",
"with": "apps/stats-mainnet/src/environments/environment.prod.ts" "with": "apps/stats/src/environments/environment.prod.ts"
} }
], ],
"optimization": true, "optimization": true,
@ -44,12 +44,12 @@
"executor": "@nrwl/web:dev-server", "executor": "@nrwl/web:dev-server",
"options": { "options": {
"port": 3010, "port": 3010,
"buildTarget": "stats-mainnet:build", "buildTarget": "stats:build",
"hmr": true "hmr": true
}, },
"configurations": { "configurations": {
"production": { "production": {
"buildTarget": "stats-mainnet:build:production", "buildTarget": "stats:build:production",
"hmr": false "hmr": false
} }
} }
@ -58,14 +58,14 @@
"executor": "@nrwl/linter:eslint", "executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"], "outputs": ["{options.outputFile}"],
"options": { "options": {
"lintFilePatterns": ["apps/stats-mainnet/**/*.{ts,tsx,js,jsx}"] "lintFilePatterns": ["apps/stats/**/*.{ts,tsx,js,jsx}"]
} }
}, },
"test": { "test": {
"executor": "@nrwl/jest:jest", "executor": "@nrwl/jest:jest",
"outputs": ["coverage/apps/stats-mainnet"], "outputs": ["coverage/apps/stats"],
"options": { "options": {
"jestConfig": "apps/stats-mainnet/jest.config.js", "jestConfig": "apps/stats/jest.config.js",
"passWithNoTests": true "passWithNoTests": true
} }
} }

View File

@ -1,6 +1,12 @@
import React, { useState } from 'react'; import React, { useState } from 'react';
import { DATA_SOURCES } from './config';
import { Header } from './components/header'; import { Header } from './components/header';
import { StatsManager } from '@vegaprotocol/mainnet-stats-manager'; import { StatsManager } from '@vegaprotocol/network-stats';
const envName = DATA_SOURCES.envName;
const restEndpoint = DATA_SOURCES.restEndpoint;
const statsEndpoint = `${restEndpoint}/statistics`;
const nodesEndpoint = `${restEndpoint}/nodes-data`;
function App() { function App() {
const [darkMode, setDarkMode] = useState<boolean>( const [darkMode, setDarkMode] = useState<boolean>(
@ -15,7 +21,12 @@ function App() {
> >
<div className="layout-grid w-screen justify-self-center"> <div className="layout-grid w-screen justify-self-center">
<Header darkMode={darkMode} setDarkMode={setDarkMode} /> <Header darkMode={darkMode} setDarkMode={setDarkMode} />
<StatsManager className="max-w-3xl px-24" /> <StatsManager
envName={envName}
statsEndpoint={statsEndpoint}
nodesEndpoint={nodesEndpoint}
className="max-w-3xl px-24"
/>
</div> </div>
</div> </div>
); );

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

Before

Width:  |  Height:  |  Size: 547 B

After

Width:  |  Height:  |  Size: 547 B

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@ -0,0 +1,4 @@
export const DATA_SOURCES = {
envName: process.env['NX_VEGA_ENV'] as string,
restEndpoint: process.env['NX_VEGA_REST'] as string,
};

View File

@ -21,4 +21,4 @@ NX_DEPLOY_PRIME_URL=$DEPLOY_PRIME_URL
# App configuration variables # App configuration variables
NX_VEGA_URL = "https://lb.testnet.vega.xyz/query" NX_VEGA_URL = "https://lb.testnet.vega.xyz/query"
NX_ETHEREUM_CHAIN_ID = 3 NX_ETHEREUM_CHAIN_ID = 3
NX_INFURA_ID = "4f846e79e13f44d1b51bbd7ed9edefb8"; NX_INFURA_ID = "4f846e79e13f44d1b51bbd7ed9edefb8"

View File

@ -1,4 +1,4 @@
# App configuration variables # App configuration variables
NX_VEGA_URL = "https://n04.d.vega.xyz/query" NX_VEGA_URL = "https://n04.d.vega.xyz/query"
NX_ETHEREUM_CHAIN_ID = 3 NX_ETHEREUM_CHAIN_ID = 3
NX_INFURA_ID = "4f846e79e13f44d1b51bbd7ed9edefb8"; NX_INFURA_ID = "4f846e79e13f44d1b51bbd7ed9edefb8"

View File

@ -1,4 +1,4 @@
# App configuration variables # App configuration variables
NX_VEGA_URL = "https://api.token.vega.xyz/query" NX_VEGA_URL = "https://api.token.vega.xyz/query"
NX_ETHEREUM_CHAIN_ID = 1 NX_ETHEREUM_CHAIN_ID = 1
NX_INFURA_ID = "4f846e79e13f44d1b51bbd7ed9edefb8"; NX_INFURA_ID = "4f846e79e13f44d1b51bbd7ed9edefb8"

View File

@ -1,4 +1,4 @@
# App configuration variables # App configuration variables
NX_VEGA_URL = "https://n03.s.vega.xyz/query" NX_VEGA_URL = "https://n03.s.vega.xyz/query"
NX_ETHEREUM_CHAIN_ID = 3 NX_ETHEREUM_CHAIN_ID = 3
NX_INFURA_ID = "4f846e79e13f44d1b51bbd7ed9edefb8"; NX_INFURA_ID = "4f846e79e13f44d1b51bbd7ed9edefb8"

View File

@ -1,4 +1,4 @@
# App configuration variables # App configuration variables
NX_VEGA_URL = "https://n03.stagnet2.vega.xyz/query" NX_VEGA_URL = "https://n03.stagnet2.vega.xyz/query"
NX_ETHEREUM_CHAIN_ID = 3 NX_ETHEREUM_CHAIN_ID = 3
NX_INFURA_ID = "4f846e79e13f44d1b51bbd7ed9edefb8"; NX_INFURA_ID = "4f846e79e13f44d1b51bbd7ed9edefb8"

View File

@ -1,4 +1,4 @@
# App configuration variables # App configuration variables
NX_VEGA_URL = "https://lb.testnet.vega.xyz/query" NX_VEGA_URL = "https://lb.testnet.vega.xyz/query"
NX_ETHEREUM_CHAIN_ID = 3 NX_ETHEREUM_CHAIN_ID = 3
NX_INFURA_ID = "4f846e79e13f44d1b51bbd7ed9edefb8"; NX_INFURA_ID = "4f846e79e13f44d1b51bbd7ed9edefb8"

View File

@ -6,12 +6,14 @@ export const metamask = initializeConnector<MetaMask>(
(actions) => new MetaMask(actions) (actions) => new MetaMask(actions)
); );
const infuraId = process.env['NX_INFURA_ID'];
export const walletconnect = initializeConnector<WalletConnect>( export const walletconnect = initializeConnector<WalletConnect>(
(actions) => (actions) =>
new WalletConnect(actions, { new WalletConnect(actions, {
rpc: { rpc: {
1: `https://mainnet.infura.io/v3/${process.env['NX_INFURA_ID']}`, 1: `https://mainnet.infura.io/v3/${infuraId}`,
3: `https://ropsten.infura.io/v3/${process.env['NX_INFURA_ID']}`, 3: `https://ropsten.infura.io/v3/${infuraId}`,
}, },
}), }),
[1, 3] [1, 3]

View File

@ -1,7 +0,0 @@
# mainnet-stats-manager
This library was generated with [Nx](https://nx.dev).
## Running unit tests
Run `nx test mainnet-stats-manager` to execute the unit tests via [Jest](https://jestjs.io).

View File

@ -1,4 +0,0 @@
{
"name": "@vegaprotocol/mainnet-stats-manager",
"version": "0.0.1"
}

View File

@ -0,0 +1,7 @@
# network-stats
This library was generated with [Nx](https://nx.dev).
## Running unit tests
Run `nx test network-stats` to execute the unit tests via [Jest](https://jestjs.io).

View File

@ -1,9 +1,9 @@
module.exports = { module.exports = {
displayName: 'mainnet-stats-manager', displayName: 'network-stats',
preset: '../../jest.preset.js', preset: '../../jest.preset.js',
transform: { transform: {
'^.+\\.[tj]sx?$': 'babel-jest', '^.+\\.[tj]sx?$': 'babel-jest',
}, },
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
coverageDirectory: '../../coverage/libs/mainnet-stats-manager', coverageDirectory: '../../coverage/libs/network-stats',
}; };

View File

@ -0,0 +1,4 @@
{
"name": "@vegaprotocol/network-stats",
"version": "0.0.1"
}

View File

@ -1,6 +1,6 @@
{ {
"root": "libs/mainnet-stats-manager", "root": "libs/network-stats",
"sourceRoot": "libs/mainnet-stats-manager/src", "sourceRoot": "libs/network-stats/src",
"projectType": "library", "projectType": "library",
"tags": [], "tags": [],
"targets": { "targets": {
@ -8,16 +8,16 @@
"executor": "@nrwl/web:rollup", "executor": "@nrwl/web:rollup",
"outputs": ["{options.outputPath}"], "outputs": ["{options.outputPath}"],
"options": { "options": {
"outputPath": "dist/libs/mainnet-stats-manager", "outputPath": "dist/libs/network-stats",
"tsConfig": "libs/mainnet-stats-manager/tsconfig.lib.json", "tsConfig": "libs/network-stats/tsconfig.lib.json",
"project": "libs/mainnet-stats-manager/package.json", "project": "libs/network-stats/package.json",
"entryFile": "libs/mainnet-stats-manager/src/index.ts", "entryFile": "libs/network-stats/src/index.ts",
"external": ["react/jsx-runtime"], "external": ["react/jsx-runtime"],
"rollupConfig": "@nrwl/react/plugins/bundle-rollup", "rollupConfig": "@nrwl/react/plugins/bundle-rollup",
"compiler": "babel", "compiler": "babel",
"assets": [ "assets": [
{ {
"glob": "libs/mainnet-stats-manager/README.md", "glob": "libs/network-stats/README.md",
"input": ".", "input": ".",
"output": "." "output": "."
} }
@ -28,14 +28,14 @@
"executor": "@nrwl/linter:eslint", "executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"], "outputs": ["{options.outputFile}"],
"options": { "options": {
"lintFilePatterns": ["libs/mainnet-stats-manager/**/*.{ts,tsx,js,jsx}"] "lintFilePatterns": ["libs/network-stats/**/*.{ts,tsx,js,jsx}"]
} }
}, },
"test": { "test": {
"executor": "@nrwl/jest:jest", "executor": "@nrwl/jest:jest",
"outputs": ["coverage/libs/mainnet-stats-manager"], "outputs": ["coverage/libs/network-stats"],
"options": { "options": {
"jestConfig": "libs/mainnet-stats-manager/jest.config.js", "jestConfig": "libs/network-stats/jest.config.js",
"passWithNoTests": true "passWithNoTests": true
} }
} }

View File

@ -10,11 +10,19 @@ import { TableRow } from '../table-row';
import { PromotedStats } from '../promoted-stats'; import { PromotedStats } from '../promoted-stats';
import { PromotedStatsItem } from '../promoted-stats-item'; import { PromotedStatsItem } from '../promoted-stats-item';
interface statsManagerProps { interface StatsManagerProps {
envName: string;
statsEndpoint: string;
nodesEndpoint: string;
className?: string; className?: string;
} }
export const StatsManager = ({ className }: statsManagerProps) => { export const StatsManager = ({
envName,
statsEndpoint,
nodesEndpoint,
className,
}: StatsManagerProps) => {
const [data, setData] = useState<IStructuredStats | null>(null); const [data, setData] = useState<IStructuredStats | null>(null);
const [error, setError] = useState<Error | null>(null); const [error, setError] = useState<Error | null>(null);
@ -22,8 +30,8 @@ export const StatsManager = ({ className }: statsManagerProps) => {
async function getStats() { async function getStats() {
try { try {
const [res1, res2] = await Promise.all([ const [res1, res2] = await Promise.all([
fetch('https://api.token.vega.xyz/statistics'), fetch(statsEndpoint),
fetch('https://api.token.vega.xyz/nodes-data'), fetch(nodesEndpoint),
]); ]);
const [{ statistics }, { nodeData }] = await Promise.all([ const [{ statistics }, { nodeData }] = await Promise.all([
res1.json(), res1.json(),
@ -69,7 +77,7 @@ export const StatsManager = ({ className }: statsManagerProps) => {
return () => { return () => {
clearInterval(interval); clearInterval(interval);
}; };
}, []); }, [nodesEndpoint, statsEndpoint]);
const classes = classnames( const classes = classnames(
className, className,
@ -79,7 +87,7 @@ export const StatsManager = ({ className }: statsManagerProps) => {
return ( return (
<div className={classes}> <div className={classes}>
<h3 className="font-alpha uppercase text-h3 pb-16 col-span-full"> <h3 className="font-alpha uppercase text-h3 pb-16 col-span-full">
{(error && `/ ${error}`) || (data ? '/ Mainnet' : '/ Connecting...')} {(error && `/ ${error}`) || (data ? `/ ${envName}` : '/ Connecting...')}
</h3> </h3>
{data?.promoted ? ( {data?.promoted ? (

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