diff --git a/apps/explorer-e2e/.eslintrc.json b/apps/explorer-e2e/.eslintrc.json new file mode 100644 index 000000000..696cb8b12 --- /dev/null +++ b/apps/explorer-e2e/.eslintrc.json @@ -0,0 +1,10 @@ +{ + "extends": ["plugin:cypress/recommended", "../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/apps/explorer-e2e/cypress.json b/apps/explorer-e2e/cypress.json new file mode 100644 index 000000000..123a4de4e --- /dev/null +++ b/apps/explorer-e2e/cypress.json @@ -0,0 +1,12 @@ +{ + "fileServerFolder": ".", + "fixturesFolder": "./src/fixtures", + "integrationFolder": "./src/integration", + "modifyObstructiveCode": false, + "supportFile": "./src/support/index.ts", + "pluginsFile": false, + "video": true, + "videosFolder": "../../dist/cypress/apps/explorer-e2e/videos", + "screenshotsFolder": "../../dist/cypress/apps/explorer-e2e/screenshots", + "chromeWebSecurity": false +} diff --git a/apps/explorer-e2e/project.json b/apps/explorer-e2e/project.json new file mode 100644 index 000000000..6edc32a5e --- /dev/null +++ b/apps/explorer-e2e/project.json @@ -0,0 +1,28 @@ +{ + "root": "apps/explorer-e2e", + "sourceRoot": "apps/explorer-e2e/src", + "projectType": "application", + "targets": { + "e2e": { + "executor": "@nrwl/cypress:cypress", + "options": { + "cypressConfig": "apps/explorer-e2e/cypress.json", + "devServerTarget": "explorer:serve" + }, + "configurations": { + "production": { + "devServerTarget": "explorer:serve:production" + } + } + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["apps/explorer-e2e/**/*.{js,ts}"] + } + } + }, + "tags": [], + "implicitDependencies": ["explorer"] +} diff --git a/apps/explorer-e2e/src/fixtures/example.json b/apps/explorer-e2e/src/fixtures/example.json new file mode 100644 index 000000000..294cbed6c --- /dev/null +++ b/apps/explorer-e2e/src/fixtures/example.json @@ -0,0 +1,4 @@ +{ + "name": "Using fixtures to represent data", + "email": "hello@cypress.io" +} diff --git a/apps/explorer-e2e/src/integration/app.spec.ts b/apps/explorer-e2e/src/integration/app.spec.ts new file mode 100644 index 000000000..118c4e4fc --- /dev/null +++ b/apps/explorer-e2e/src/integration/app.spec.ts @@ -0,0 +1,13 @@ +import { getGreeting } from '../support/app.po'; + +describe('explorer', () => { + beforeEach(() => cy.visit('/')); + + it('should display welcome message', () => { + // Custom command example, see `../support/commands.ts` file + cy.login('my-email@something.com', 'myPassword'); + + // Function helper example, see `../support/app.po.ts` file + getGreeting().contains('Welcome explorer'); + }); +}); diff --git a/apps/explorer-e2e/src/support/app.po.ts b/apps/explorer-e2e/src/support/app.po.ts new file mode 100644 index 000000000..329342469 --- /dev/null +++ b/apps/explorer-e2e/src/support/app.po.ts @@ -0,0 +1 @@ +export const getGreeting = () => cy.get('h1'); diff --git a/apps/explorer-e2e/src/support/commands.ts b/apps/explorer-e2e/src/support/commands.ts new file mode 100644 index 000000000..310f1fa0e --- /dev/null +++ b/apps/explorer-e2e/src/support/commands.ts @@ -0,0 +1,33 @@ +// *********************************************** +// This example commands.js shows you how to +// create various custom commands and overwrite +// existing commands. +// +// For more comprehensive examples of custom +// commands please read more here: +// https://on.cypress.io/custom-commands +// *********************************************** + +// eslint-disable-next-line @typescript-eslint/no-namespace +declare namespace Cypress { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + interface Chainable { + login(email: string, password: string): void; + } +} +// +// -- This is a parent command -- +Cypress.Commands.add('login', (email, password) => { + console.log('Custom command example: Login', email, password); +}); +// +// -- This is a child command -- +// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) +// +// +// -- This is a dual command -- +// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) +// +// +// -- This will overwrite an existing command -- +// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) diff --git a/apps/explorer-e2e/src/support/index.ts b/apps/explorer-e2e/src/support/index.ts new file mode 100644 index 000000000..3d469a6b6 --- /dev/null +++ b/apps/explorer-e2e/src/support/index.ts @@ -0,0 +1,17 @@ +// *********************************************************** +// This example support/index.js is processed and +// loaded automatically before your test files. +// +// This is a great place to put global configuration and +// behavior that modifies Cypress. +// +// You can change the location of this file or turn off +// automatically serving support files with the +// 'supportFile' configuration option. +// +// You can read more here: +// https://on.cypress.io/configuration +// *********************************************************** + +// Import commands.js using ES2015 syntax: +import './commands'; diff --git a/apps/explorer-e2e/tsconfig.json b/apps/explorer-e2e/tsconfig.json new file mode 100644 index 000000000..c4f818ecd --- /dev/null +++ b/apps/explorer-e2e/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "sourceMap": false, + "outDir": "../../dist/out-tsc", + "allowJs": true, + "types": ["cypress", "node"] + }, + "include": ["src/**/*.ts", "src/**/*.js"] +} diff --git a/apps/explorer/.babelrc b/apps/explorer/.babelrc new file mode 100644 index 000000000..61641ec8a --- /dev/null +++ b/apps/explorer/.babelrc @@ -0,0 +1,11 @@ +{ + "presets": [ + [ + "@nrwl/react/babel", + { + "runtime": "automatic" + } + ] + ], + "plugins": [] +} diff --git a/apps/explorer/.browserslistrc b/apps/explorer/.browserslistrc new file mode 100644 index 000000000..f1d12df4f --- /dev/null +++ b/apps/explorer/.browserslistrc @@ -0,0 +1,16 @@ +# This file is used by: +# 1. autoprefixer to adjust CSS to support the below specified browsers +# 2. babel preset-env to adjust included polyfills +# +# For additional information regarding the format and rule options, please see: +# https://github.com/browserslist/browserslist#queries +# +# If you need to support different browsers in production, you may tweak the list below. + +last 1 Chrome version +last 1 Firefox version +last 2 Edge major versions +last 2 Safari major version +last 2 iOS major versions +Firefox ESR +not IE 9-11 # For IE 9-11 support, remove 'not'. \ No newline at end of file diff --git a/apps/explorer/.env b/apps/explorer/.env new file mode 100644 index 000000000..c934862c2 --- /dev/null +++ b/apps/explorer/.env @@ -0,0 +1,25 @@ +# React Environment Variables +# https://facebook.github.io/create-react-app/docs/adding-custom-environment-variables#expanding-environment-variables-in-env + +# Netlify Environment Variables +# https://www.netlify.com/docs/continuous-deployment/#environment-variables +REACT_APP_VERSION=$npm_package_version +REACT_APP_REPOSITORY_URL=$REPOSITORY_URL +REACT_APP_BRANCH=$BRANCH +REACT_APP_PULL_REQUEST=$PULL_REQUEST +REACT_APP_HEAD=$HEAD +REACT_APP_COMMIT_REF=$COMMIT_REF +REACT_APP_CONTEXT=$CONTEXT +REACT_APP_REVIEW_ID=$REVIEW_ID +REACT_APP_INCOMING_HOOK_TITLE=$INCOMING_HOOK_TITLE +REACT_APP_INCOMING_HOOK_URL=$INCOMING_HOOK_URL +REACT_APP_INCOMING_HOOK_BODY=$INCOMING_HOOK_BODY +REACT_APP_URL=$URL +REACT_APP_DEPLOY_URL=$DEPLOY_URL +REACT_APP_DEPLOY_PRIME_URL=$DEPLOY_PRIME_URL + +# App configuration variables +REACT_APP_CHAIN_EXPLORER_URL = "https://explorer.vega.trading/.netlify/functions/chain-explorer-api" +REACT_APP_TENDERMINT_URL = "https://lb.testnet.vega.xyz/tm" +REACT_APP_TENDERMINT_WEBSOCKET_URL = "wss://lb.testnet.vega.xyz/tm/websocket" +REACT_APP_VEGA_URL = "https://lb.testnet.vega.xyz/query" diff --git a/apps/explorer/.eslintrc.json b/apps/explorer/.eslintrc.json new file mode 100644 index 000000000..734ddacee --- /dev/null +++ b/apps/explorer/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["plugin:@nrwl/nx/react", "../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/apps/explorer/jest.config.js b/apps/explorer/jest.config.js new file mode 100644 index 000000000..591654a09 --- /dev/null +++ b/apps/explorer/jest.config.js @@ -0,0 +1,10 @@ +module.exports = { + displayName: 'explorer', + preset: '../../jest.preset.js', + transform: { + '^(?!.*\\.(js|jsx|ts|tsx|css|json)$)': '@nrwl/react/plugins/jest', + '^.+\\.[tj]sx?$': 'babel-jest', + }, + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], + coverageDirectory: '../../coverage/apps/explorer', +}; diff --git a/apps/explorer/project.json b/apps/explorer/project.json new file mode 100644 index 000000000..f3bee88e6 --- /dev/null +++ b/apps/explorer/project.json @@ -0,0 +1,70 @@ +{ + "root": "apps/explorer", + "sourceRoot": "apps/explorer/src", + "projectType": "application", + "targets": { + "build": { + "executor": "@nrwl/web:webpack", + "outputs": ["{options.outputPath}"], + "defaultConfiguration": "production", + "options": { + "compiler": "babel", + "outputPath": "dist/apps/explorer", + "index": "apps/explorer/src/index.html", + "baseHref": "/", + "main": "apps/explorer/src/main.tsx", + "polyfills": "apps/explorer/src/polyfills.ts", + "tsConfig": "apps/explorer/tsconfig.app.json", + "assets": ["apps/explorer/src/favicon.ico", "apps/explorer/src/assets"], + "styles": ["apps/explorer/src/styles.scss"], + "scripts": [], + "webpackConfig": "@nrwl/react/plugins/webpack" + }, + "configurations": { + "production": { + "fileReplacements": [ + { + "replace": "apps/explorer/src/environments/environment.ts", + "with": "apps/explorer/src/environments/environment.prod.ts" + } + ], + "optimization": true, + "outputHashing": "all", + "sourceMap": false, + "namedChunks": false, + "extractLicenses": true, + "vendorChunk": false + } + } + }, + "serve": { + "executor": "@nrwl/web:dev-server", + "options": { + "buildTarget": "explorer:build", + "hmr": true + }, + "configurations": { + "production": { + "buildTarget": "explorer:build:production", + "hmr": false + } + } + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["apps/explorer/**/*.{ts,tsx,js,jsx}"] + } + }, + "test": { + "executor": "@nrwl/jest:jest", + "outputs": ["coverage/apps/explorer"], + "options": { + "jestConfig": "apps/explorer/jest.config.js", + "passWithNoTests": true + } + } + }, + "tags": [] +} diff --git a/apps/explorer/src/app/app.module.scss b/apps/explorer/src/app/app.module.scss new file mode 100644 index 000000000..7b88fbabf --- /dev/null +++ b/apps/explorer/src/app/app.module.scss @@ -0,0 +1 @@ +/* Your styles goes here. */ diff --git a/apps/explorer/src/app/app.spec.tsx b/apps/explorer/src/app/app.spec.tsx new file mode 100644 index 000000000..2f23a1c6d --- /dev/null +++ b/apps/explorer/src/app/app.spec.tsx @@ -0,0 +1,27 @@ +import { render } from '@testing-library/react'; + +import { BrowserRouter } from 'react-router-dom'; + +import App from './app'; + +describe('App', () => { + it('should render successfully', () => { + const { baseElement } = render( + + + + ); + + expect(baseElement).toBeTruthy(); + }); + + it('should have a greeting as the title', () => { + const { getByText } = render( + + + + ); + + expect(getByText(/Welcome explorer/gi)).toBeTruthy(); + }); +}); diff --git a/apps/explorer/src/app/app.tsx b/apps/explorer/src/app/app.tsx new file mode 100644 index 000000000..0bbe4e013 --- /dev/null +++ b/apps/explorer/src/app/app.tsx @@ -0,0 +1,11 @@ +// eslint-disable-next-line @typescript-eslint/no-unused-vars +import styles from './app.module.scss'; + +import { Route, Link } from 'react-router-dom'; +import App2 from './src/App'; + +export function App() { + return ; +} + +export default App; diff --git a/apps/vega-explorer/src/App.scss b/apps/explorer/src/app/src/App.scss similarity index 100% rename from apps/vega-explorer/src/App.scss rename to apps/explorer/src/app/src/App.scss diff --git a/apps/vega-explorer/src/App.test.tsx b/apps/explorer/src/app/src/App.test.tsx similarity index 100% rename from apps/vega-explorer/src/App.test.tsx rename to apps/explorer/src/app/src/App.test.tsx diff --git a/apps/explorer/src/app/src/App.tsx b/apps/explorer/src/app/src/App.tsx new file mode 100644 index 000000000..1f9740647 --- /dev/null +++ b/apps/explorer/src/app/src/App.tsx @@ -0,0 +1,33 @@ +import './App.scss'; + +import { ApolloProvider } from '@apollo/client'; + +import { createClient } from './lib/apollo-client'; +import { BrowserRouter as Router } from 'react-router-dom'; +import { Nav } from './components/nav'; +import { Footer } from './components/footer'; +import { Header } from './components/header'; +import { Main } from './components/main'; +import React from 'react'; +import { DATA_SOURCES } from './config'; +import { TendermintWebsocketProvider } from './contexts/websocket/tendermint-websocket-provider'; + +function App() { + const [client] = React.useState(createClient(DATA_SOURCES.dataNodeUrl)); + return ( + + +
+
+
+
+
+
+ ); +} + +export default App; diff --git a/apps/vega-explorer/src/__generated__/globalTypes.ts b/apps/explorer/src/app/src/__generated__/globalTypes.ts similarity index 100% rename from apps/vega-explorer/src/__generated__/globalTypes.ts rename to apps/explorer/src/app/src/__generated__/globalTypes.ts diff --git a/apps/vega-explorer/src/components/footer/index.tsx b/apps/explorer/src/app/src/components/footer/index.tsx similarity index 52% rename from apps/vega-explorer/src/components/footer/index.tsx rename to apps/explorer/src/app/src/components/footer/index.tsx index af166c2a8..8cd16cd76 100644 --- a/apps/vega-explorer/src/components/footer/index.tsx +++ b/apps/explorer/src/app/src/components/footer/index.tsx @@ -1,4 +1,4 @@ -import packageJson from "../../../package.json"; +// import packageJson from "../../../package.json"; export const Footer = () => { return ( @@ -6,8 +6,8 @@ export const Footer = () => {
Reading Vega Fairground data from
- Version/commit hash: {packageJson.version} / - {process.env.REACT_APP_COMMIT_REF || "dev"} + {/* Version/commit hash: {packageJson.version} / */} + {process.env['REACT_APP_COMMIT_REF'] || 'dev'}
diff --git a/apps/vega-explorer/src/components/header/index.tsx b/apps/explorer/src/app/src/components/header/index.tsx similarity index 100% rename from apps/vega-explorer/src/components/header/index.tsx rename to apps/explorer/src/app/src/components/header/index.tsx diff --git a/apps/vega-explorer/src/components/main/index.tsx b/apps/explorer/src/app/src/components/main/index.tsx similarity index 100% rename from apps/vega-explorer/src/components/main/index.tsx rename to apps/explorer/src/app/src/components/main/index.tsx diff --git a/apps/explorer/src/app/src/components/nav/index.tsx b/apps/explorer/src/app/src/components/nav/index.tsx new file mode 100644 index 000000000..6e2f4af77 --- /dev/null +++ b/apps/explorer/src/app/src/components/nav/index.tsx @@ -0,0 +1,16 @@ +import { Link } from 'react-router-dom'; +import routerConfig from '../../routes/router-config'; + +export const Nav = () => { + return ( + + ); +}; diff --git a/apps/vega-explorer/src/components/router-error-boundary/index.tsx b/apps/explorer/src/app/src/components/router-error-boundary/index.tsx similarity index 85% rename from apps/vega-explorer/src/components/router-error-boundary/index.tsx rename to apps/explorer/src/app/src/components/router-error-boundary/index.tsx index 38a8d965d..9453c8178 100644 --- a/apps/vega-explorer/src/components/router-error-boundary/index.tsx +++ b/apps/explorer/src/app/src/components/router-error-boundary/index.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React from 'react'; interface RouteErrorBoundaryProps { children: React.ReactElement; @@ -17,11 +17,11 @@ export class RouteErrorBoundary extends React.Component< return { hasError: true }; } - componentDidCatch(error: Error) { + override componentDidCatch(error: Error) { console.log(`Error caught in App error boundary ${error.message}`, error); } - render() { + override render() { if (this.state.hasError) { return

Something went wrong

; } diff --git a/apps/vega-explorer/src/components/search/index.tsx b/apps/explorer/src/app/src/components/search/index.tsx similarity index 100% rename from apps/vega-explorer/src/components/search/index.tsx rename to apps/explorer/src/app/src/components/search/index.tsx diff --git a/apps/vega-explorer/src/components/splash-loader/index.ts b/apps/explorer/src/app/src/components/splash-loader/index.ts similarity index 100% rename from apps/vega-explorer/src/components/splash-loader/index.ts rename to apps/explorer/src/app/src/components/splash-loader/index.ts diff --git a/apps/vega-explorer/src/components/splash-loader/splash-loader.scss b/apps/explorer/src/app/src/components/splash-loader/splash-loader.scss similarity index 100% rename from apps/vega-explorer/src/components/splash-loader/splash-loader.scss rename to apps/explorer/src/app/src/components/splash-loader/splash-loader.scss diff --git a/apps/vega-explorer/src/components/splash-loader/splash-loader.tsx b/apps/explorer/src/app/src/components/splash-loader/splash-loader.tsx similarity index 100% rename from apps/vega-explorer/src/components/splash-loader/splash-loader.tsx rename to apps/explorer/src/app/src/components/splash-loader/splash-loader.tsx diff --git a/apps/vega-explorer/src/components/splash-screen/index.ts b/apps/explorer/src/app/src/components/splash-screen/index.ts similarity index 100% rename from apps/vega-explorer/src/components/splash-screen/index.ts rename to apps/explorer/src/app/src/components/splash-screen/index.ts diff --git a/apps/vega-explorer/src/components/splash-screen/splash-screen.scss b/apps/explorer/src/app/src/components/splash-screen/splash-screen.scss similarity index 100% rename from apps/vega-explorer/src/components/splash-screen/splash-screen.scss rename to apps/explorer/src/app/src/components/splash-screen/splash-screen.scss diff --git a/apps/vega-explorer/src/components/splash-screen/splash-screen.tsx b/apps/explorer/src/app/src/components/splash-screen/splash-screen.tsx similarity index 100% rename from apps/vega-explorer/src/components/splash-screen/splash-screen.tsx rename to apps/explorer/src/app/src/components/splash-screen/splash-screen.tsx diff --git a/apps/explorer/src/app/src/config/index.tsx b/apps/explorer/src/app/src/config/index.tsx new file mode 100644 index 000000000..825a41e0c --- /dev/null +++ b/apps/explorer/src/app/src/config/index.tsx @@ -0,0 +1,7 @@ +export const DATA_SOURCES = { + chainExplorerUrl: + 'https://explorer.vega.trading/.netlify/functions/chain-explorer-api', + tendermintUrl: 'https://lb.testnet.vega.xyz/tm', + tendermintWebsocketUrl: 'wss://lb.testnet.vega.xyz/tm/websocket', + dataNodeUrl: 'https://lb.testnet.vega.xyz/query', +}; diff --git a/apps/vega-explorer/src/contexts/websocket/tendermint-websocket-context.ts b/apps/explorer/src/app/src/contexts/websocket/tendermint-websocket-context.ts similarity index 100% rename from apps/vega-explorer/src/contexts/websocket/tendermint-websocket-context.ts rename to apps/explorer/src/app/src/contexts/websocket/tendermint-websocket-context.ts diff --git a/apps/vega-explorer/src/contexts/websocket/tendermint-websocket-provider.tsx b/apps/explorer/src/app/src/contexts/websocket/tendermint-websocket-provider.tsx similarity index 100% rename from apps/vega-explorer/src/contexts/websocket/tendermint-websocket-provider.tsx rename to apps/explorer/src/app/src/contexts/websocket/tendermint-websocket-provider.tsx diff --git a/apps/vega-explorer/src/hooks/use-fetch.tsx b/apps/explorer/src/app/src/hooks/use-fetch.tsx similarity index 100% rename from apps/vega-explorer/src/hooks/use-fetch.tsx rename to apps/explorer/src/app/src/hooks/use-fetch.tsx diff --git a/apps/vega-explorer/src/hooks/use-tendermint-websocket.tsx b/apps/explorer/src/app/src/hooks/use-tendermint-websocket.tsx similarity index 100% rename from apps/vega-explorer/src/hooks/use-tendermint-websocket.tsx rename to apps/explorer/src/app/src/hooks/use-tendermint-websocket.tsx diff --git a/apps/explorer/src/app/src/index.tsx b/apps/explorer/src/app/src/index.tsx new file mode 100644 index 000000000..c1f31c5f4 --- /dev/null +++ b/apps/explorer/src/app/src/index.tsx @@ -0,0 +1,10 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; +import App from './App'; + +ReactDOM.render( + + + , + document.getElementById('root') +); diff --git a/apps/vega-explorer/src/lib/apollo-client.tsx b/apps/explorer/src/app/src/lib/apollo-client.tsx similarity index 95% rename from apps/vega-explorer/src/lib/apollo-client.tsx rename to apps/explorer/src/app/src/lib/apollo-client.tsx index 364cdd965..8a30d5ea0 100644 --- a/apps/vega-explorer/src/lib/apollo-client.tsx +++ b/apps/explorer/src/app/src/lib/apollo-client.tsx @@ -46,7 +46,7 @@ export function createClient(base?: string) { }); return new ApolloClient({ - connectToDevTools: process.env.NODE_ENV === "development", + connectToDevTools: process.env["NODE_ENV"] === "development", link: from([errorLink, retryLink, httpLink]), cache, }); diff --git a/apps/vega-explorer/src/react-app-env.d.ts b/apps/explorer/src/app/src/react-app-env.d.ts similarity index 100% rename from apps/vega-explorer/src/react-app-env.d.ts rename to apps/explorer/src/app/src/react-app-env.d.ts diff --git a/apps/vega-explorer/src/routes/assets/__generated__/AssetsQuery.ts b/apps/explorer/src/app/src/routes/assets/__generated__/AssetsQuery.ts similarity index 86% rename from apps/vega-explorer/src/routes/assets/__generated__/AssetsQuery.ts rename to apps/explorer/src/app/src/routes/assets/__generated__/AssetsQuery.ts index 8cf556798..966cafc71 100644 --- a/apps/vega-explorer/src/routes/assets/__generated__/AssetsQuery.ts +++ b/apps/explorer/src/app/src/routes/assets/__generated__/AssetsQuery.ts @@ -3,14 +3,14 @@ // @generated // This file was automatically generated and should not be edited. -import { AccountType } from "./../../../__generated__/globalTypes"; +import { AccountType } from '../../../__generated__/globalTypes'; // ==================================================== // GraphQL query operation: AssetsQuery // ==================================================== export interface AssetsQuery_assets_source_ERC20 { - __typename: "ERC20"; + __typename: 'ERC20'; /** * The address of the erc20 contract */ @@ -18,17 +18,19 @@ export interface AssetsQuery_assets_source_ERC20 { } export interface AssetsQuery_assets_source_BuiltinAsset { - __typename: "BuiltinAsset"; + __typename: 'BuiltinAsset'; /** * Maximum amount that can be requested by a party through the built-in asset faucet at a time */ maxFaucetAmountMint: string; } -export type AssetsQuery_assets_source = AssetsQuery_assets_source_ERC20 | AssetsQuery_assets_source_BuiltinAsset; +export type AssetsQuery_assets_source = + | AssetsQuery_assets_source_ERC20 + | AssetsQuery_assets_source_BuiltinAsset; export interface AssetsQuery_assets_infrastructureFeeAccount_market { - __typename: "Market"; + __typename: 'Market'; /** * Market ID */ @@ -36,7 +38,7 @@ export interface AssetsQuery_assets_infrastructureFeeAccount_market { } export interface AssetsQuery_assets_infrastructureFeeAccount { - __typename: "Account"; + __typename: 'Account'; /** * Account type (General, Margin, etc) */ @@ -52,7 +54,7 @@ export interface AssetsQuery_assets_infrastructureFeeAccount { } export interface AssetsQuery_assets { - __typename: "Asset"; + __typename: 'Asset'; /** * The id of the asset */ diff --git a/apps/vega-explorer/src/routes/assets/index.tsx b/apps/explorer/src/app/src/routes/assets/index.tsx similarity index 100% rename from apps/vega-explorer/src/routes/assets/index.tsx rename to apps/explorer/src/app/src/routes/assets/index.tsx diff --git a/apps/vega-explorer/src/routes/blocks/home/index.tsx b/apps/explorer/src/app/src/routes/blocks/home/index.tsx similarity index 100% rename from apps/vega-explorer/src/routes/blocks/home/index.tsx rename to apps/explorer/src/app/src/routes/blocks/home/index.tsx diff --git a/apps/vega-explorer/src/routes/blocks/id/index.tsx b/apps/explorer/src/app/src/routes/blocks/id/index.tsx similarity index 51% rename from apps/vega-explorer/src/routes/blocks/id/index.tsx rename to apps/explorer/src/app/src/routes/blocks/id/index.tsx index 8c598eb23..f74a3bab5 100644 --- a/apps/vega-explorer/src/routes/blocks/id/index.tsx +++ b/apps/explorer/src/app/src/routes/blocks/id/index.tsx @@ -1,22 +1,22 @@ -import React from "react"; -import { useParams } from "react-router-dom"; -import { DATA_SOURCES } from "../../../config"; -import useFetch from "../../../hooks/use-fetch"; -import { ChainExplorerTxResponse } from "../../types/chain-explorer-response"; -import { TendermintBlocksResponse } from "../tendermint-blocks-response"; +import React from 'react'; +import { useParams } from 'react-router-dom'; +import { DATA_SOURCES } from '../../../config'; +import useFetch from '../../../hooks/use-fetch'; +import { ChainExplorerTxResponse } from '../../types/chain-explorer-response'; +import { TendermintBlocksResponse } from '../tendermint-blocks-response'; const Block = () => { const { block } = useParams<{ block: string }>(); const { data: decodedBlockData } = useFetch( DATA_SOURCES.chainExplorerUrl, { - method: "POST", - mode: "cors", + method: 'POST', + mode: 'cors', headers: { - "Content-Type": "application/json", + 'Content-Type': 'application/json', }, body: JSON.stringify({ - block_height: parseInt(block), + block_height: parseInt(block!), node_url: `${DATA_SOURCES.tendermintUrl}/`, }), } @@ -30,9 +30,9 @@ const Block = () => {

block

Tendermint Data

-
{JSON.stringify(blockData, null, "  ")}
+
{JSON.stringify(blockData, null, '  ')}

Decoded data

-
{JSON.stringify(decodedBlockData, null, "  ")}
+
{JSON.stringify(decodedBlockData, null, '  ')}
); }; diff --git a/apps/explorer/src/app/src/routes/blocks/index.tsx b/apps/explorer/src/app/src/routes/blocks/index.tsx new file mode 100644 index 000000000..c8602378b --- /dev/null +++ b/apps/explorer/src/app/src/routes/blocks/index.tsx @@ -0,0 +1,15 @@ +import React from 'react'; +import { Route, Routes } from 'react-router-dom'; +import { Blocks } from './home'; +import { Block } from './id'; + +const BlockPage = () => { + return ( + + } /> + } /> + + ); +}; + +export default BlockPage; diff --git a/apps/vega-explorer/src/routes/blocks/tendermint-blockchain-response.d.ts b/apps/explorer/src/app/src/routes/blocks/tendermint-blockchain-response.d.ts similarity index 100% rename from apps/vega-explorer/src/routes/blocks/tendermint-blockchain-response.d.ts rename to apps/explorer/src/app/src/routes/blocks/tendermint-blockchain-response.d.ts diff --git a/apps/vega-explorer/src/routes/blocks/tendermint-blocks-response.d.ts b/apps/explorer/src/app/src/routes/blocks/tendermint-blocks-response.d.ts similarity index 100% rename from apps/vega-explorer/src/routes/blocks/tendermint-blocks-response.d.ts rename to apps/explorer/src/app/src/routes/blocks/tendermint-blocks-response.d.ts diff --git a/apps/vega-explorer/src/routes/blocks/tendermint-new-block.d.ts b/apps/explorer/src/app/src/routes/blocks/tendermint-new-block.d.ts similarity index 100% rename from apps/vega-explorer/src/routes/blocks/tendermint-new-block.d.ts rename to apps/explorer/src/app/src/routes/blocks/tendermint-new-block.d.ts diff --git a/apps/vega-explorer/src/routes/genesis/index.tsx b/apps/explorer/src/app/src/routes/genesis/index.tsx similarity index 100% rename from apps/vega-explorer/src/routes/genesis/index.tsx rename to apps/explorer/src/app/src/routes/genesis/index.tsx diff --git a/apps/vega-explorer/src/routes/genesis/tendermint-genesis-response.d.ts b/apps/explorer/src/app/src/routes/genesis/tendermint-genesis-response.d.ts similarity index 100% rename from apps/vega-explorer/src/routes/genesis/tendermint-genesis-response.d.ts rename to apps/explorer/src/app/src/routes/genesis/tendermint-genesis-response.d.ts diff --git a/apps/vega-explorer/src/routes/governance/__generated__/ProposalsQuery.ts b/apps/explorer/src/app/src/routes/governance/__generated__/ProposalsQuery.ts similarity index 84% rename from apps/vega-explorer/src/routes/governance/__generated__/ProposalsQuery.ts rename to apps/explorer/src/app/src/routes/governance/__generated__/ProposalsQuery.ts index da0146b45..44688a848 100644 --- a/apps/vega-explorer/src/routes/governance/__generated__/ProposalsQuery.ts +++ b/apps/explorer/src/app/src/routes/governance/__generated__/ProposalsQuery.ts @@ -3,14 +3,18 @@ // @generated // This file was automatically generated and should not be edited. -import { ProposalState, ProposalRejectionReason, VoteValue } from "./../../../__generated__/globalTypes"; +import { + ProposalState, + ProposalRejectionReason, + VoteValue, +} from '../../../__generated__/globalTypes'; // ==================================================== // GraphQL query operation: ProposalsQuery // ==================================================== export interface ProposalsQuery_proposals_party { - __typename: "Party"; + __typename: 'Party'; /** * Party identifier */ @@ -18,7 +22,7 @@ export interface ProposalsQuery_proposals_party { } export interface ProposalsQuery_proposals_terms_change_NewMarket_instrument { - __typename: "InstrumentConfiguration"; + __typename: 'InstrumentConfiguration'; /** * Full and fairly descriptive name for the instrument */ @@ -26,7 +30,7 @@ export interface ProposalsQuery_proposals_terms_change_NewMarket_instrument { } export interface ProposalsQuery_proposals_terms_change_NewMarket { - __typename: "NewMarket"; + __typename: 'NewMarket'; /** * New market instrument configuration */ @@ -34,12 +38,12 @@ export interface ProposalsQuery_proposals_terms_change_NewMarket { } export interface ProposalsQuery_proposals_terms_change_UpdateMarket { - __typename: "UpdateMarket"; + __typename: 'UpdateMarket'; marketId: string; } export interface ProposalsQuery_proposals_terms_change_NewAsset_source_BuiltinAsset { - __typename: "BuiltinAsset"; + __typename: 'BuiltinAsset'; /** * Maximum amount that can be requested by a party through the built-in asset faucet at a time */ @@ -47,17 +51,19 @@ export interface ProposalsQuery_proposals_terms_change_NewAsset_source_BuiltinAs } export interface ProposalsQuery_proposals_terms_change_NewAsset_source_ERC20 { - __typename: "ERC20"; + __typename: 'ERC20'; /** * The address of the erc20 contract */ contractAddress: string; } -export type ProposalsQuery_proposals_terms_change_NewAsset_source = ProposalsQuery_proposals_terms_change_NewAsset_source_BuiltinAsset | ProposalsQuery_proposals_terms_change_NewAsset_source_ERC20; +export type ProposalsQuery_proposals_terms_change_NewAsset_source = + | ProposalsQuery_proposals_terms_change_NewAsset_source_BuiltinAsset + | ProposalsQuery_proposals_terms_change_NewAsset_source_ERC20; export interface ProposalsQuery_proposals_terms_change_NewAsset { - __typename: "NewAsset"; + __typename: 'NewAsset'; /** * The symbol of the asset (e.g: GBP) */ @@ -69,7 +75,7 @@ export interface ProposalsQuery_proposals_terms_change_NewAsset { } export interface ProposalsQuery_proposals_terms_change_UpdateNetworkParameter_networkParameter { - __typename: "NetworkParameter"; + __typename: 'NetworkParameter'; /** * The name of the network parameter */ @@ -81,14 +87,18 @@ export interface ProposalsQuery_proposals_terms_change_UpdateNetworkParameter_ne } export interface ProposalsQuery_proposals_terms_change_UpdateNetworkParameter { - __typename: "UpdateNetworkParameter"; + __typename: 'UpdateNetworkParameter'; networkParameter: ProposalsQuery_proposals_terms_change_UpdateNetworkParameter_networkParameter; } -export type ProposalsQuery_proposals_terms_change = ProposalsQuery_proposals_terms_change_NewMarket | ProposalsQuery_proposals_terms_change_UpdateMarket | ProposalsQuery_proposals_terms_change_NewAsset | ProposalsQuery_proposals_terms_change_UpdateNetworkParameter; +export type ProposalsQuery_proposals_terms_change = + | ProposalsQuery_proposals_terms_change_NewMarket + | ProposalsQuery_proposals_terms_change_UpdateMarket + | ProposalsQuery_proposals_terms_change_NewAsset + | ProposalsQuery_proposals_terms_change_UpdateNetworkParameter; export interface ProposalsQuery_proposals_terms { - __typename: "ProposalTerms"; + __typename: 'ProposalTerms'; /** * RFC3339Nano time and date when voting closes for this proposal. * Constrained by "minClose" and "maxClose" network parameters. @@ -106,7 +116,7 @@ export interface ProposalsQuery_proposals_terms { } export interface ProposalsQuery_proposals_votes_yes_votes_party_stake { - __typename: "PartyStake"; + __typename: 'PartyStake'; /** * The stake currently available for the party */ @@ -114,7 +124,7 @@ export interface ProposalsQuery_proposals_votes_yes_votes_party_stake { } export interface ProposalsQuery_proposals_votes_yes_votes_party { - __typename: "Party"; + __typename: 'Party'; /** * Party identifier */ @@ -126,7 +136,7 @@ export interface ProposalsQuery_proposals_votes_yes_votes_party { } export interface ProposalsQuery_proposals_votes_yes_votes { - __typename: "Vote"; + __typename: 'Vote'; /** * The vote value cast */ @@ -142,7 +152,7 @@ export interface ProposalsQuery_proposals_votes_yes_votes { } export interface ProposalsQuery_proposals_votes_yes { - __typename: "ProposalVoteSide"; + __typename: 'ProposalVoteSide'; /** * Total tokens of governance token from the votes casted for this side */ @@ -158,7 +168,7 @@ export interface ProposalsQuery_proposals_votes_yes { } export interface ProposalsQuery_proposals_votes_no_votes_party_stake { - __typename: "PartyStake"; + __typename: 'PartyStake'; /** * The stake currently available for the party */ @@ -166,7 +176,7 @@ export interface ProposalsQuery_proposals_votes_no_votes_party_stake { } export interface ProposalsQuery_proposals_votes_no_votes_party { - __typename: "Party"; + __typename: 'Party'; /** * Party identifier */ @@ -178,7 +188,7 @@ export interface ProposalsQuery_proposals_votes_no_votes_party { } export interface ProposalsQuery_proposals_votes_no_votes { - __typename: "Vote"; + __typename: 'Vote'; /** * The vote value cast */ @@ -194,7 +204,7 @@ export interface ProposalsQuery_proposals_votes_no_votes { } export interface ProposalsQuery_proposals_votes_no { - __typename: "ProposalVoteSide"; + __typename: 'ProposalVoteSide'; /** * Total tokens of governance token from the votes casted for this side */ @@ -210,7 +220,7 @@ export interface ProposalsQuery_proposals_votes_no { } export interface ProposalsQuery_proposals_votes { - __typename: "ProposalVotes"; + __typename: 'ProposalVotes'; /** * Yes votes cast for this proposal */ @@ -222,7 +232,7 @@ export interface ProposalsQuery_proposals_votes { } export interface ProposalsQuery_proposals { - __typename: "Proposal"; + __typename: 'Proposal'; /** * Proposal ID that is filled by VEGA once proposal reaches the network */ diff --git a/apps/vega-explorer/src/routes/governance/index.tsx b/apps/explorer/src/app/src/routes/governance/index.tsx similarity index 100% rename from apps/vega-explorer/src/routes/governance/index.tsx rename to apps/explorer/src/app/src/routes/governance/index.tsx diff --git a/apps/vega-explorer/src/routes/home/index.tsx b/apps/explorer/src/app/src/routes/home/index.tsx similarity index 100% rename from apps/vega-explorer/src/routes/home/index.tsx rename to apps/explorer/src/app/src/routes/home/index.tsx diff --git a/apps/explorer/src/app/src/routes/index.tsx b/apps/explorer/src/app/src/routes/index.tsx new file mode 100644 index 000000000..0001733e1 --- /dev/null +++ b/apps/explorer/src/app/src/routes/index.tsx @@ -0,0 +1,34 @@ +import React from 'react'; +import { Route, Routes } from 'react-router-dom'; +import { RouteErrorBoundary } from '../components/router-error-boundary'; + +import { SplashLoader } from '../components/splash-loader'; +import { SplashScreen } from '../components/splash-screen'; +import Home from './home'; +import routerConfig from './router-config'; + +export interface RouteChildProps { + name: string; +} + +export const AppRouter = () => { + const splashLoading = ( + + + + ); + + return ( + + + + <> + {routerConfig.map(({ path, component: Component, name }) => ( + } /> + ))} + + + + + ); +}; diff --git a/apps/vega-explorer/src/routes/markets/__generated__/MarketsQuery.ts b/apps/explorer/src/app/src/routes/markets/__generated__/MarketsQuery.ts similarity index 89% rename from apps/vega-explorer/src/routes/markets/__generated__/MarketsQuery.ts rename to apps/explorer/src/app/src/routes/markets/__generated__/MarketsQuery.ts index 33e2a022e..cfee79215 100644 --- a/apps/vega-explorer/src/routes/markets/__generated__/MarketsQuery.ts +++ b/apps/explorer/src/app/src/routes/markets/__generated__/MarketsQuery.ts @@ -3,14 +3,19 @@ // @generated // This file was automatically generated and should not be edited. -import { MarketTradingMode, MarketState, AccountType, AuctionTrigger } from "./../../../__generated__/globalTypes"; +import { + MarketTradingMode, + MarketState, + AccountType, + AuctionTrigger, +} from '../../../__generated__/globalTypes'; // ==================================================== // GraphQL query operation: MarketsQuery // ==================================================== export interface MarketsQuery_markets_fees_factors { - __typename: "FeeFactors"; + __typename: 'FeeFactors'; /** * The factor applied to calculate MakerFees, a non-negative float */ @@ -26,7 +31,7 @@ export interface MarketsQuery_markets_fees_factors { } export interface MarketsQuery_markets_fees { - __typename: "Fees"; + __typename: 'Fees'; /** * The factors used to calculate the different fees */ @@ -34,7 +39,7 @@ export interface MarketsQuery_markets_fees { } export interface MarketsQuery_markets_tradableInstrument_instrument_metadata { - __typename: "InstrumentMetadata"; + __typename: 'InstrumentMetadata'; /** * An arbitrary list of tags to associated to associate to the Instrument (string list) */ @@ -42,7 +47,7 @@ export interface MarketsQuery_markets_tradableInstrument_instrument_metadata { } export interface MarketsQuery_markets_tradableInstrument_instrument_product_settlementAsset_globalRewardPoolAccount { - __typename: "Account"; + __typename: 'Account'; /** * Balance as string - current account balance (approx. as balances can be updated several times per second) */ @@ -50,7 +55,7 @@ export interface MarketsQuery_markets_tradableInstrument_instrument_product_sett } export interface MarketsQuery_markets_tradableInstrument_instrument_product_settlementAsset { - __typename: "Asset"; + __typename: 'Asset'; /** * The id of the asset */ @@ -74,7 +79,7 @@ export interface MarketsQuery_markets_tradableInstrument_instrument_product_sett } export interface MarketsQuery_markets_tradableInstrument_instrument_product { - __typename: "Future"; + __typename: 'Future'; /** * RFC3339Nano maturity date of the product */ @@ -86,7 +91,7 @@ export interface MarketsQuery_markets_tradableInstrument_instrument_product { } export interface MarketsQuery_markets_tradableInstrument_instrument { - __typename: "Instrument"; + __typename: 'Instrument'; /** * Full and fairly descriptive name for the instrument */ @@ -110,7 +115,7 @@ export interface MarketsQuery_markets_tradableInstrument_instrument { } export interface MarketsQuery_markets_tradableInstrument_riskModel_LogNormalRiskModel_params { - __typename: "LogNormalModelParams"; + __typename: 'LogNormalModelParams'; /** * r parameter */ @@ -126,7 +131,7 @@ export interface MarketsQuery_markets_tradableInstrument_riskModel_LogNormalRisk } export interface MarketsQuery_markets_tradableInstrument_riskModel_LogNormalRiskModel { - __typename: "LogNormalRiskModel"; + __typename: 'LogNormalRiskModel'; /** * Tau parameter of the risk model */ @@ -142,7 +147,7 @@ export interface MarketsQuery_markets_tradableInstrument_riskModel_LogNormalRisk } export interface MarketsQuery_markets_tradableInstrument_riskModel_SimpleRiskModel_params { - __typename: "SimpleRiskModelParams"; + __typename: 'SimpleRiskModelParams'; /** * Risk factor for long */ @@ -154,17 +159,19 @@ export interface MarketsQuery_markets_tradableInstrument_riskModel_SimpleRiskMod } export interface MarketsQuery_markets_tradableInstrument_riskModel_SimpleRiskModel { - __typename: "SimpleRiskModel"; + __typename: 'SimpleRiskModel'; /** * Params for the simple risk model */ params: MarketsQuery_markets_tradableInstrument_riskModel_SimpleRiskModel_params; } -export type MarketsQuery_markets_tradableInstrument_riskModel = MarketsQuery_markets_tradableInstrument_riskModel_LogNormalRiskModel | MarketsQuery_markets_tradableInstrument_riskModel_SimpleRiskModel; +export type MarketsQuery_markets_tradableInstrument_riskModel = + | MarketsQuery_markets_tradableInstrument_riskModel_LogNormalRiskModel + | MarketsQuery_markets_tradableInstrument_riskModel_SimpleRiskModel; export interface MarketsQuery_markets_tradableInstrument_marginCalculator_scalingFactors { - __typename: "ScalingFactors"; + __typename: 'ScalingFactors'; /** * the scaling factor that determines the margin level at which Vega has to search for more money */ @@ -180,7 +187,7 @@ export interface MarketsQuery_markets_tradableInstrument_marginCalculator_scalin } export interface MarketsQuery_markets_tradableInstrument_marginCalculator { - __typename: "MarginCalculator"; + __typename: 'MarginCalculator'; /** * The scaling factors that will be used for margin calculation */ @@ -188,7 +195,7 @@ export interface MarketsQuery_markets_tradableInstrument_marginCalculator { } export interface MarketsQuery_markets_tradableInstrument { - __typename: "TradableInstrument"; + __typename: 'TradableInstrument'; /** * An instance of or reference to a fully specified instrument. */ @@ -204,7 +211,7 @@ export interface MarketsQuery_markets_tradableInstrument { } export interface MarketsQuery_markets_openingAuction { - __typename: "AuctionDuration"; + __typename: 'AuctionDuration'; /** * Duration of the auction in seconds */ @@ -216,7 +223,7 @@ export interface MarketsQuery_markets_openingAuction { } export interface MarketsQuery_markets_priceMonitoringSettings_parameters_triggers { - __typename: "PriceMonitoringTrigger"; + __typename: 'PriceMonitoringTrigger'; /** * Price monitoring projection horizon τ in seconds (> 0). */ @@ -234,15 +241,17 @@ export interface MarketsQuery_markets_priceMonitoringSettings_parameters_trigger } export interface MarketsQuery_markets_priceMonitoringSettings_parameters { - __typename: "PriceMonitoringParameters"; + __typename: 'PriceMonitoringParameters'; /** * The list of triggers for this price monitoring */ - triggers: MarketsQuery_markets_priceMonitoringSettings_parameters_triggers[] | null; + triggers: + | MarketsQuery_markets_priceMonitoringSettings_parameters_triggers[] + | null; } export interface MarketsQuery_markets_priceMonitoringSettings { - __typename: "PriceMonitoringSettings"; + __typename: 'PriceMonitoringSettings'; /** * Specified a set of PriceMonitoringParameters to be use for price monitoring purposes */ @@ -254,7 +263,7 @@ export interface MarketsQuery_markets_priceMonitoringSettings { } export interface MarketsQuery_markets_liquidityMonitoringParameters_targetStakeParameters { - __typename: "TargetStakeParameters"; + __typename: 'TargetStakeParameters'; /** * Specifies length of time window expressed in seconds for target stake calculation */ @@ -266,7 +275,7 @@ export interface MarketsQuery_markets_liquidityMonitoringParameters_targetStakeP } export interface MarketsQuery_markets_liquidityMonitoringParameters { - __typename: "LiquidityMonitoringParameters"; + __typename: 'LiquidityMonitoringParameters'; /** * Specifies the triggering ratio for entering liquidity auction */ @@ -278,7 +287,7 @@ export interface MarketsQuery_markets_liquidityMonitoringParameters { } export interface MarketsQuery_markets_proposal { - __typename: "Proposal"; + __typename: 'Proposal'; /** * Proposal ID that is filled by VEGA once proposal reaches the network */ @@ -286,7 +295,7 @@ export interface MarketsQuery_markets_proposal { } export interface MarketsQuery_markets_accounts_asset { - __typename: "Asset"; + __typename: 'Asset'; /** * The id of the asset */ @@ -298,7 +307,7 @@ export interface MarketsQuery_markets_accounts_asset { } export interface MarketsQuery_markets_accounts { - __typename: "Account"; + __typename: 'Account'; /** * Asset, the 'currency' */ @@ -314,7 +323,7 @@ export interface MarketsQuery_markets_accounts { } export interface MarketsQuery_markets_data_priceMonitoringBounds_trigger { - __typename: "PriceMonitoringTrigger"; + __typename: 'PriceMonitoringTrigger'; /** * Price monitoring auction extension duration in seconds should the price * breach it's theoretical level over the specified horizon at the specified @@ -328,7 +337,7 @@ export interface MarketsQuery_markets_data_priceMonitoringBounds_trigger { } export interface MarketsQuery_markets_data_priceMonitoringBounds { - __typename: "PriceMonitoringBounds"; + __typename: 'PriceMonitoringBounds'; /** * Minimum price that isn't currently breaching the specified price monitoring trigger */ @@ -348,7 +357,7 @@ export interface MarketsQuery_markets_data_priceMonitoringBounds { } export interface MarketsQuery_markets_data_liquidityProviderFeeShare_party { - __typename: "Party"; + __typename: 'Party'; /** * Party identifier */ @@ -356,7 +365,7 @@ export interface MarketsQuery_markets_data_liquidityProviderFeeShare_party { } export interface MarketsQuery_markets_data_liquidityProviderFeeShare { - __typename: "LiquidityProviderFeeShare"; + __typename: 'LiquidityProviderFeeShare'; /** * The liquidity provider party id */ @@ -372,7 +381,7 @@ export interface MarketsQuery_markets_data_liquidityProviderFeeShare { } export interface MarketsQuery_markets_data { - __typename: "MarketData"; + __typename: 'MarketData'; /** * the mark price (actually an unsgined int) */ @@ -460,7 +469,9 @@ export interface MarketsQuery_markets_data { /** * A list of valid price ranges per associated trigger */ - priceMonitoringBounds: MarketsQuery_markets_data_priceMonitoringBounds[] | null; + priceMonitoringBounds: + | MarketsQuery_markets_data_priceMonitoringBounds[] + | null; /** * the market value proxy */ @@ -468,11 +479,13 @@ export interface MarketsQuery_markets_data { /** * the equity like share of liquidity fee for each liquidity provider */ - liquidityProviderFeeShare: MarketsQuery_markets_data_liquidityProviderFeeShare[] | null; + liquidityProviderFeeShare: + | MarketsQuery_markets_data_liquidityProviderFeeShare[] + | null; } export interface MarketsQuery_markets { - __typename: "Market"; + __typename: 'Market'; /** * Market ID */ @@ -492,14 +505,14 @@ export interface MarketsQuery_markets { /** * decimalPlaces indicates the number of decimal places that an integer must be shifted by in order to get a correct * number denominated in the currency of the Market. (uint64) - * + * * Examples: * Currency Balance decimalPlaces Real Balance * GBP 100 0 GBP 100 * GBP 100 2 GBP 1.00 * GBP 100 4 GBP 0.01 * GBP 1 4 GBP 0.0001 ( 0.01p ) - * + * * GBX (pence) 100 0 GBP 1.00 (100p ) * GBX (pence) 100 2 GBP 0.01 ( 1p ) * GBX (pence) 100 4 GBP 0.0001 ( 0.01p ) diff --git a/apps/vega-explorer/src/routes/markets/index.tsx b/apps/explorer/src/app/src/routes/markets/index.tsx similarity index 100% rename from apps/vega-explorer/src/routes/markets/index.tsx rename to apps/explorer/src/app/src/routes/markets/index.tsx diff --git a/apps/vega-explorer/src/routes/network-parameters/__generated__/NetworkParametersQuery.ts b/apps/explorer/src/app/src/routes/network-parameters/__generated__/NetworkParametersQuery.ts similarity index 100% rename from apps/vega-explorer/src/routes/network-parameters/__generated__/NetworkParametersQuery.ts rename to apps/explorer/src/app/src/routes/network-parameters/__generated__/NetworkParametersQuery.ts diff --git a/apps/vega-explorer/src/routes/network-parameters/index.tsx b/apps/explorer/src/app/src/routes/network-parameters/index.tsx similarity index 100% rename from apps/vega-explorer/src/routes/network-parameters/index.tsx rename to apps/explorer/src/app/src/routes/network-parameters/index.tsx diff --git a/apps/vega-explorer/src/routes/parties/home/index.tsx b/apps/explorer/src/app/src/routes/parties/home/index.tsx similarity index 100% rename from apps/vega-explorer/src/routes/parties/home/index.tsx rename to apps/explorer/src/app/src/routes/parties/home/index.tsx diff --git a/apps/vega-explorer/src/routes/parties/id/__generated__/PartyAssetsQuery.ts b/apps/explorer/src/app/src/routes/parties/id/__generated__/PartyAssetsQuery.ts similarity index 84% rename from apps/vega-explorer/src/routes/parties/id/__generated__/PartyAssetsQuery.ts rename to apps/explorer/src/app/src/routes/parties/id/__generated__/PartyAssetsQuery.ts index b6a275288..e613eea6d 100644 --- a/apps/vega-explorer/src/routes/parties/id/__generated__/PartyAssetsQuery.ts +++ b/apps/explorer/src/app/src/routes/parties/id/__generated__/PartyAssetsQuery.ts @@ -3,14 +3,14 @@ // @generated // This file was automatically generated and should not be edited. -import { AccountType } from "./../../../../__generated__/globalTypes"; +import { AccountType } from '../../../../__generated__/globalTypes'; // ==================================================== // GraphQL query operation: PartyAssetsQuery // ==================================================== export interface PartyAssetsQuery_party_delegations_node { - __typename: "Node"; + __typename: 'Node'; /** * The node url eg n01.vega.xyz */ @@ -19,7 +19,7 @@ export interface PartyAssetsQuery_party_delegations_node { } export interface PartyAssetsQuery_party_delegations { - __typename: "Delegation"; + __typename: 'Delegation'; /** * Amount delegated */ @@ -35,7 +35,7 @@ export interface PartyAssetsQuery_party_delegations { } export interface PartyAssetsQuery_party_stake { - __typename: "PartyStake"; + __typename: 'PartyStake'; /** * The stake currently available for the party */ @@ -43,21 +43,23 @@ export interface PartyAssetsQuery_party_stake { } export interface PartyAssetsQuery_party_accounts_asset_source_BuiltinAsset { - __typename: "BuiltinAsset"; + __typename: 'BuiltinAsset'; } export interface PartyAssetsQuery_party_accounts_asset_source_ERC20 { - __typename: "ERC20"; + __typename: 'ERC20'; /** * The address of the erc20 contract */ contractAddress: string; } -export type PartyAssetsQuery_party_accounts_asset_source = PartyAssetsQuery_party_accounts_asset_source_BuiltinAsset | PartyAssetsQuery_party_accounts_asset_source_ERC20; +export type PartyAssetsQuery_party_accounts_asset_source = + | PartyAssetsQuery_party_accounts_asset_source_BuiltinAsset + | PartyAssetsQuery_party_accounts_asset_source_ERC20; export interface PartyAssetsQuery_party_accounts_asset { - __typename: "Asset"; + __typename: 'Asset'; /** * The full name of the asset (e.g: Great British Pound) */ @@ -81,7 +83,7 @@ export interface PartyAssetsQuery_party_accounts_asset { } export interface PartyAssetsQuery_party_accounts { - __typename: "Account"; + __typename: 'Account'; /** * Asset, the 'currency' */ @@ -97,7 +99,7 @@ export interface PartyAssetsQuery_party_accounts { } export interface PartyAssetsQuery_party { - __typename: "Party"; + __typename: 'Party'; /** * Party identifier */ diff --git a/apps/vega-explorer/src/routes/parties/id/index.tsx b/apps/explorer/src/app/src/routes/parties/id/index.tsx similarity index 66% rename from apps/vega-explorer/src/routes/parties/id/index.tsx rename to apps/explorer/src/app/src/routes/parties/id/index.tsx index 6a2136ba6..55453b066 100644 --- a/apps/vega-explorer/src/routes/parties/id/index.tsx +++ b/apps/explorer/src/app/src/routes/parties/id/index.tsx @@ -1,14 +1,14 @@ -import { useQuery } from "@apollo/client"; -import { gql } from "@apollo/client"; -import React from "react"; -import { useParams } from "react-router-dom"; -import { DATA_SOURCES } from "../../../config"; -import useFetch from "../../../hooks/use-fetch"; -import { TendermintSearchTransactionResponse } from "../tendermint-transaction-response"; +import { useQuery } from '@apollo/client'; +import { gql } from '@apollo/client'; +import React from 'react'; +import { useParams } from 'react-router-dom'; +import { DATA_SOURCES } from '../../../config'; +import useFetch from '../../../hooks/use-fetch'; +import { TendermintSearchTransactionResponse } from '../tendermint-transaction-response'; import { PartyAssetsQuery, PartyAssetsQueryVariables, -} from "./__generated__/PartyAssetsQuery"; +} from './__generated__/PartyAssetsQuery'; const PARTY_ASSETS_QUERY = gql` query PartyAssetsQuery($partyId: ID!) { @@ -55,8 +55,9 @@ const Party = () => { PARTY_ASSETS_QUERY, { // Don't cache data for this query, party information can move quite quickly - fetchPolicy: "network-only", - variables: { partyId: party.replace("0x", "") }, + fetchPolicy: 'network-only', + variables: { partyId: party!.replace('0x', '') }, + skip: !party, } ); @@ -64,9 +65,9 @@ const Party = () => {

Party

Tendermint Data

-
{JSON.stringify(partyData, null, "  ")}
+
{JSON.stringify(partyData, null, '  ')}

Asset data

-
{JSON.stringify(data, null, "  ")}
+
{JSON.stringify(data, null, '  ')}
); }; diff --git a/apps/explorer/src/app/src/routes/parties/index.tsx b/apps/explorer/src/app/src/routes/parties/index.tsx new file mode 100644 index 000000000..92878ac31 --- /dev/null +++ b/apps/explorer/src/app/src/routes/parties/index.tsx @@ -0,0 +1,15 @@ +import React from 'react'; +import { Route, Routes } from 'react-router-dom'; +import { Parties } from './home'; +import { Party } from './id'; + +const PartiesPage = () => { + return ( + + } /> + } /> + + ); +}; + +export default PartiesPage; diff --git a/apps/vega-explorer/src/routes/parties/tendermint-transaction-response.d.ts b/apps/explorer/src/app/src/routes/parties/tendermint-transaction-response.d.ts similarity index 100% rename from apps/vega-explorer/src/routes/parties/tendermint-transaction-response.d.ts rename to apps/explorer/src/app/src/routes/parties/tendermint-transaction-response.d.ts diff --git a/apps/explorer/src/app/src/routes/router-config.ts b/apps/explorer/src/app/src/routes/router-config.ts new file mode 100644 index 000000000..49ab5a3d3 --- /dev/null +++ b/apps/explorer/src/app/src/routes/router-config.ts @@ -0,0 +1,79 @@ +import Assets from './assets'; +import Blocks from './blocks'; +import Governance from './governance'; +import Home from './home'; +import Markets from './markets'; +import Party from './parties'; +import Txs from './txs'; +import Validators from './validators'; +import Genesis from './genesis'; +import NetworkParameters from './network-parameters'; + +export const Routes = { + HOME: '/', + TX: 'txs/*', + BLOCKS: 'blocks/*', + PARTIES: 'parties/*', + VALIDATORS: 'validators/*', + ASSETS: 'assets/*', + GENESIS: 'genesis/*', + GOVERNANCE: 'governance/*', + MARKETS: 'markets/*', + NETWORK_PARAMETERS: 'network-parameters/*', +}; + +const routerConfig = [ + { + path: Routes.HOME, + name: 'Home', + component: Home, + index: true, + }, + { + path: `${Routes.TX}/*`, + name: 'Txs', + component: Txs, + }, + { + path: Routes.BLOCKS, + name: 'Blocks', + component: Blocks, + }, + { + path: Routes.PARTIES, + name: 'Parties', + component: Party, + }, + { + path: Routes.ASSETS, + name: 'Assets', + component: Assets, + }, + { + path: Routes.GENESIS, + name: 'Genesis', + component: Genesis, + }, + { + path: Routes.GOVERNANCE, + name: 'Governance', + component: Governance, + }, + { + path: Routes.MARKETS, + name: 'Markets', + component: Markets, + }, + { + path: Routes.NETWORK_PARAMETERS, + name: 'NetworkParameters', + component: NetworkParameters, + }, + { + path: Routes.VALIDATORS, + name: 'Validators', + component: Validators, + }, +]; + +export default routerConfig; diff --git a/apps/vega-explorer/src/routes/txs/home/index.tsx b/apps/explorer/src/app/src/routes/txs/home/index.tsx similarity index 100% rename from apps/vega-explorer/src/routes/txs/home/index.tsx rename to apps/explorer/src/app/src/routes/txs/home/index.tsx diff --git a/apps/vega-explorer/src/routes/txs/id/index.tsx b/apps/explorer/src/app/src/routes/txs/id/index.tsx similarity index 100% rename from apps/vega-explorer/src/routes/txs/id/index.tsx rename to apps/explorer/src/app/src/routes/txs/id/index.tsx diff --git a/apps/explorer/src/app/src/routes/txs/index.tsx b/apps/explorer/src/app/src/routes/txs/index.tsx new file mode 100644 index 000000000..fc6002f33 --- /dev/null +++ b/apps/explorer/src/app/src/routes/txs/index.tsx @@ -0,0 +1,15 @@ +import React from 'react'; +import { Route, Routes } from 'react-router-dom'; +import { Txs } from './home'; +import { Tx } from './id'; + +const TxPage = () => { + return ( + + } /> + } /> + + ); +}; + +export default TxPage; diff --git a/apps/vega-explorer/src/routes/txs/tendermint-transaction-response.d.tsx b/apps/explorer/src/app/src/routes/txs/tendermint-transaction-response.d.tsx similarity index 100% rename from apps/vega-explorer/src/routes/txs/tendermint-transaction-response.d.tsx rename to apps/explorer/src/app/src/routes/txs/tendermint-transaction-response.d.tsx diff --git a/apps/vega-explorer/src/routes/txs/tendermint-unconfirmed-transactions-response.d.tsx b/apps/explorer/src/app/src/routes/txs/tendermint-unconfirmed-transactions-response.d.tsx similarity index 100% rename from apps/vega-explorer/src/routes/txs/tendermint-unconfirmed-transactions-response.d.tsx rename to apps/explorer/src/app/src/routes/txs/tendermint-unconfirmed-transactions-response.d.tsx diff --git a/apps/vega-explorer/src/routes/types/chain-explorer-response.d.ts b/apps/explorer/src/app/src/routes/types/chain-explorer-response.d.ts similarity index 100% rename from apps/vega-explorer/src/routes/types/chain-explorer-response.d.ts rename to apps/explorer/src/app/src/routes/types/chain-explorer-response.d.ts diff --git a/apps/vega-explorer/src/routes/types/tenderming-error-response.d.ts b/apps/explorer/src/app/src/routes/types/tenderming-error-response.d.ts similarity index 100% rename from apps/vega-explorer/src/routes/types/tenderming-error-response.d.ts rename to apps/explorer/src/app/src/routes/types/tenderming-error-response.d.ts diff --git a/apps/vega-explorer/src/routes/validators/__generated__/NodesQuery.ts b/apps/explorer/src/app/src/routes/validators/__generated__/NodesQuery.ts similarity index 93% rename from apps/vega-explorer/src/routes/validators/__generated__/NodesQuery.ts rename to apps/explorer/src/app/src/routes/validators/__generated__/NodesQuery.ts index d66be6459..9c9d4d1eb 100644 --- a/apps/vega-explorer/src/routes/validators/__generated__/NodesQuery.ts +++ b/apps/explorer/src/app/src/routes/validators/__generated__/NodesQuery.ts @@ -3,14 +3,14 @@ // @generated // This file was automatically generated and should not be edited. -import { NodeStatus } from "./../../../__generated__/globalTypes"; +import { NodeStatus } from '../../../__generated__/globalTypes'; // ==================================================== // GraphQL query operation: NodesQuery // ==================================================== export interface NodesQuery_nodes_epochData { - __typename: "EpochData"; + __typename: 'EpochData'; /** * Total number of epochs since node was created */ @@ -26,7 +26,7 @@ export interface NodesQuery_nodes_epochData { } export interface NodesQuery_nodes { - __typename: "Node"; + __typename: 'Node'; /** * The node url eg n01.vega.xyz */ diff --git a/apps/vega-explorer/src/routes/validators/index.tsx b/apps/explorer/src/app/src/routes/validators/index.tsx similarity index 100% rename from apps/vega-explorer/src/routes/validators/index.tsx rename to apps/explorer/src/app/src/routes/validators/index.tsx diff --git a/apps/vega-explorer/src/routes/validators/tendermint-validator-response.tsx b/apps/explorer/src/app/src/routes/validators/tendermint-validator-response.tsx similarity index 100% rename from apps/vega-explorer/src/routes/validators/tendermint-validator-response.tsx rename to apps/explorer/src/app/src/routes/validators/tendermint-validator-response.tsx diff --git a/apps/vega-explorer/src/setupTests.ts b/apps/explorer/src/app/src/setupTests.ts similarity index 100% rename from apps/vega-explorer/src/setupTests.ts rename to apps/explorer/src/app/src/setupTests.ts diff --git a/apps/vega-explorer/src/styles/AlphaLyrae-Medium.woff b/apps/explorer/src/app/src/styles/AlphaLyrae-Medium.woff similarity index 100% rename from apps/vega-explorer/src/styles/AlphaLyrae-Medium.woff rename to apps/explorer/src/app/src/styles/AlphaLyrae-Medium.woff diff --git a/apps/vega-explorer/src/styles/_colors.scss b/apps/explorer/src/app/src/styles/_colors.scss similarity index 100% rename from apps/vega-explorer/src/styles/_colors.scss rename to apps/explorer/src/app/src/styles/_colors.scss diff --git a/apps/explorer/src/app/src/styles/_fonts.scss b/apps/explorer/src/app/src/styles/_fonts.scss new file mode 100644 index 000000000..2f8d3f101 --- /dev/null +++ b/apps/explorer/src/app/src/styles/_fonts.scss @@ -0,0 +1,16 @@ +$font-main: 'Helvetica neue', 'Helvetica', arial, sans-serif; +$font-mono: 'Roboto Mono', monospace; +$font-alpa-lyrae: AlphaLyrae, 'Helvetica neue', 'Helvetica', arial, sans-serif; + +.font-main { + font-family: $font-main; +} + +.font-mono { + font-family: $font-mono; +} + +@font-face { + font-family: AlphaLyrae; + // src: url(./AlphaLyrae-Medium.woff); +} diff --git a/apps/vega-explorer/src/styles/_reset.scss b/apps/explorer/src/app/src/styles/_reset.scss similarity index 100% rename from apps/vega-explorer/src/styles/_reset.scss rename to apps/explorer/src/app/src/styles/_reset.scss diff --git a/apps/explorer/src/assets/.gitkeep b/apps/explorer/src/assets/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/apps/explorer/src/environments/environment.prod.ts b/apps/explorer/src/environments/environment.prod.ts new file mode 100644 index 000000000..c9669790b --- /dev/null +++ b/apps/explorer/src/environments/environment.prod.ts @@ -0,0 +1,3 @@ +export const environment = { + production: true, +}; diff --git a/apps/explorer/src/environments/environment.ts b/apps/explorer/src/environments/environment.ts new file mode 100644 index 000000000..7ed83767f --- /dev/null +++ b/apps/explorer/src/environments/environment.ts @@ -0,0 +1,6 @@ +// This file can be replaced during build by using the `fileReplacements` array. +// When building for production, this file is replaced with `environment.prod.ts`. + +export const environment = { + production: false, +}; diff --git a/apps/explorer/src/favicon.ico b/apps/explorer/src/favicon.ico new file mode 100644 index 000000000..317ebcb23 Binary files /dev/null and b/apps/explorer/src/favicon.ico differ diff --git a/apps/explorer/src/index.html b/apps/explorer/src/index.html new file mode 100644 index 000000000..b51ae59f9 --- /dev/null +++ b/apps/explorer/src/index.html @@ -0,0 +1,14 @@ + + + + + Explorer + + + + + + +
+ + diff --git a/apps/explorer/src/main.tsx b/apps/explorer/src/main.tsx new file mode 100644 index 000000000..0bb92da1b --- /dev/null +++ b/apps/explorer/src/main.tsx @@ -0,0 +1,14 @@ +import { StrictMode } from 'react'; +import * as ReactDOM from 'react-dom'; +import { BrowserRouter } from 'react-router-dom'; + +import App from './app/app'; + +ReactDOM.render( + + + + + , + document.getElementById('root') +); diff --git a/apps/explorer/src/polyfills.ts b/apps/explorer/src/polyfills.ts new file mode 100644 index 000000000..2adf3d05b --- /dev/null +++ b/apps/explorer/src/polyfills.ts @@ -0,0 +1,7 @@ +/** + * Polyfill stable language features. These imports will be optimized by `@babel/preset-env`. + * + * See: https://github.com/zloirock/core-js#babel + */ +import 'core-js/stable'; +import 'regenerator-runtime/runtime'; diff --git a/apps/explorer/src/styles.scss b/apps/explorer/src/styles.scss new file mode 100644 index 000000000..90d4ee007 --- /dev/null +++ b/apps/explorer/src/styles.scss @@ -0,0 +1 @@ +/* You can add global styles to this file, and also import other style files */ diff --git a/apps/explorer/tsconfig.app.json b/apps/explorer/tsconfig.app.json new file mode 100644 index 000000000..252904bb7 --- /dev/null +++ b/apps/explorer/tsconfig.app.json @@ -0,0 +1,22 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "types": ["node"] + }, + "files": [ + "../../node_modules/@nrwl/react/typings/cssmodule.d.ts", + "../../node_modules/@nrwl/react/typings/image.d.ts" + ], + "exclude": [ + "**/*.spec.ts", + "**/*.test.ts", + "**/*.spec.tsx", + "**/*.test.tsx", + "**/*.spec.js", + "**/*.test.js", + "**/*.spec.jsx", + "**/*.test.jsx" + ], + "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"] +} diff --git a/apps/explorer/tsconfig.json b/apps/explorer/tsconfig.json new file mode 100644 index 000000000..9657042e4 --- /dev/null +++ b/apps/explorer/tsconfig.json @@ -0,0 +1,25 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "jsx": "react-jsx", + "allowJs": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.app.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/apps/explorer/tsconfig.spec.json b/apps/explorer/tsconfig.spec.json new file mode 100644 index 000000000..95ef66a08 --- /dev/null +++ b/apps/explorer/tsconfig.spec.json @@ -0,0 +1,23 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": [ + "**/*.test.ts", + "**/*.spec.ts", + "**/*.test.tsx", + "**/*.spec.tsx", + "**/*.test.js", + "**/*.spec.js", + "**/*.test.jsx", + "**/*.spec.jsx", + "**/*.d.ts" + ], + "files": [ + "../../node_modules/@nrwl/react/typings/cssmodule.d.ts", + "../../node_modules/@nrwl/react/typings/image.d.ts" + ] +} diff --git a/apps/vega-explorer/src/App.tsx b/apps/vega-explorer/src/App.tsx deleted file mode 100644 index ba1a344da..000000000 --- a/apps/vega-explorer/src/App.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import "./App.scss"; - -import { ApolloProvider } from "@apollo/client"; - -import { createClient } from "./lib/apollo-client"; -import { BrowserRouter as Router } from "react-router-dom"; -import { Nav } from "./components/nav"; -import { Footer } from "./components/footer"; -import { Header } from "./components/header"; -import { Main } from "./components/main"; -import React from "react"; -import { DATA_SOURCES } from "./config"; -import { TendermintWebsocketProvider } from "./contexts/websocket/tendermint-websocket-provider"; - -function App() { - const [client] = React.useState(createClient(DATA_SOURCES.dataNodeUrl)); - return ( - - - -
-
-
-
-
-
-
- ); -} - -export default App; diff --git a/apps/vega-explorer/src/components/nav/index.tsx b/apps/vega-explorer/src/components/nav/index.tsx deleted file mode 100644 index 02335c99b..000000000 --- a/apps/vega-explorer/src/components/nav/index.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { Link } from "react-router-dom"; -import routerConfig from "../../routes/router-config"; - -export const Nav = () => { - return ( - - ); -}; diff --git a/apps/vega-explorer/src/config/index.tsx b/apps/vega-explorer/src/config/index.tsx deleted file mode 100644 index f27c5dde3..000000000 --- a/apps/vega-explorer/src/config/index.tsx +++ /dev/null @@ -1,7 +0,0 @@ -export const DATA_SOURCES = { - chainExplorerUrl: process.env.REACT_APP_CHAIN_EXPLORER_URL as string, - tendermintUrl: process.env.REACT_APP_TENDERMINT_URL as string, - tendermintWebsocketUrl: process.env - .REACT_APP_TENDERMINT_WEBSOCKET_URL as string, - dataNodeUrl: process.env.REACT_APP_VEGA_URL as string, -}; diff --git a/apps/vega-explorer/src/index.tsx b/apps/vega-explorer/src/index.tsx deleted file mode 100644 index a85797d03..000000000 --- a/apps/vega-explorer/src/index.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import React from "react"; -import ReactDOM from "react-dom"; -import App from "./App"; -import reportWebVitals from "./reportWebVitals"; - -ReactDOM.render( - - - , - document.getElementById("root") -); - -// If you want to start measuring performance in your app, pass a function -// to log results (for example: reportWebVitals(console.log)) -// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals -reportWebVitals(); diff --git a/apps/vega-explorer/src/reportWebVitals.ts b/apps/vega-explorer/src/reportWebVitals.ts deleted file mode 100644 index 49a2a16e0..000000000 --- a/apps/vega-explorer/src/reportWebVitals.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { ReportHandler } from 'web-vitals'; - -const reportWebVitals = (onPerfEntry?: ReportHandler) => { - if (onPerfEntry && onPerfEntry instanceof Function) { - import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => { - getCLS(onPerfEntry); - getFID(onPerfEntry); - getFCP(onPerfEntry); - getLCP(onPerfEntry); - getTTFB(onPerfEntry); - }); - } -}; - -export default reportWebVitals; diff --git a/apps/vega-explorer/src/routes/blocks/index.tsx b/apps/vega-explorer/src/routes/blocks/index.tsx deleted file mode 100644 index 3f2a532ba..000000000 --- a/apps/vega-explorer/src/routes/blocks/index.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import React from "react"; -import { Route, Switch, useRouteMatch } from "react-router-dom"; -import { Blocks } from "./home"; -import { Block } from "./id"; - -const BlockPage = () => { - const match = useRouteMatch(); - - return ( - - - - - - - - - ); -}; - -export default BlockPage; diff --git a/apps/vega-explorer/src/routes/index.tsx b/apps/vega-explorer/src/routes/index.tsx deleted file mode 100644 index bc51d35ef..000000000 --- a/apps/vega-explorer/src/routes/index.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import React from "react"; -import { Route, Switch } from "react-router-dom"; -import { RouteErrorBoundary } from "../components/router-error-boundary"; - -import { SplashLoader } from "../components/splash-loader"; -import { SplashScreen } from "../components/splash-screen"; -import routerConfig from "./router-config"; - -export interface RouteChildProps { - name: string; -} - -export const AppRouter = () => { - const splashLoading = ( - - - - ); - - return ( - - - - {routerConfig.map( - ({ path, component: Component, exact = false, name }) => ( - - - - ) - )} - - - - ); -}; diff --git a/apps/vega-explorer/src/routes/parties/index.tsx b/apps/vega-explorer/src/routes/parties/index.tsx deleted file mode 100644 index 026b5ac0a..000000000 --- a/apps/vega-explorer/src/routes/parties/index.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import React from "react"; -import { Route, Switch, useRouteMatch } from "react-router-dom"; -import { Parties } from "./home"; -import { Party } from "./id"; - -const PartiesPage = () => { - const match = useRouteMatch(); - - return ( - - - - - - - - - ); -}; - -export default PartiesPage; diff --git a/apps/vega-explorer/src/routes/router-config.ts b/apps/vega-explorer/src/routes/router-config.ts deleted file mode 100644 index 1fec283d4..000000000 --- a/apps/vega-explorer/src/routes/router-config.ts +++ /dev/null @@ -1,79 +0,0 @@ -import Assets from "./assets"; -import Blocks from "./blocks"; -import Governance from "./governance"; -import Home from "./home"; -import Markets from "./markets"; -import Party from "./parties"; -import Txs from "./txs"; -import Validators from "./validators"; -import Genesis from "./genesis"; -import NetworkParameters from "./network-parameters"; - -export const Routes = { - HOME: "/", - TX: "/txs", - BLOCKS: "/blocks", - PARTIES: "/parties", - VALIDATORS: "/validators", - ASSETS: "/assets", - GENESIS: "/genesis", - GOVERNANCE: "/governance", - MARKETS: "/markets", - NETWORK_PARAMETERS: "/network-parameters", -}; - -const routerConfig = [ - { - path: Routes.HOME, - name: "Home", - component: Home, - exact: true, - }, - { - path: Routes.TX, - name: "Txs", - component: Txs, - }, - { - path: Routes.BLOCKS, - name: "Blocks", - component: Blocks, - }, - { - path: Routes.PARTIES, - name: "Parties", - component: Party, - }, - { - path: Routes.ASSETS, - name: "Assets", - component: Assets, - }, - { - path: Routes.GENESIS, - name: "Genesis", - component: Genesis, - }, - { - path: Routes.GOVERNANCE, - name: "Governance", - component: Governance, - }, - { - path: Routes.MARKETS, - name: "Markets", - component: Markets, - }, - { - path: Routes.NETWORK_PARAMETERS, - name: "NetworkParameters", - component: NetworkParameters, - }, - { - path: Routes.VALIDATORS, - name: "Validators", - component: Validators, - }, -]; - -export default routerConfig; diff --git a/apps/vega-explorer/src/routes/txs/index.tsx b/apps/vega-explorer/src/routes/txs/index.tsx deleted file mode 100644 index 3f6e72285..000000000 --- a/apps/vega-explorer/src/routes/txs/index.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import React from "react"; -import { Route, Switch, useRouteMatch } from "react-router-dom"; -import { Txs } from "./home"; -import { Tx } from "./id"; - -const TxPage = () => { - const match = useRouteMatch(); - console.log(match); - return ( - - - - - - - - - ); -}; - -export default TxPage; diff --git a/apps/vega-explorer/src/styles/_fonts.scss b/apps/vega-explorer/src/styles/_fonts.scss deleted file mode 100644 index ccad33c03..000000000 --- a/apps/vega-explorer/src/styles/_fonts.scss +++ /dev/null @@ -1,17 +0,0 @@ -$font-main: "Helvetica neue", "Helvetica", arial, sans-serif; -$font-mono: "Roboto Mono", monospace; -$font-alpa-lyrae: AlphaLyrae, "Helvetica neue", "Helvetica", arial, - sans-serif; - -.font-main { - font-family: $font-main; -} - -.font-mono { - font-family: $font-mono; -} - -@font-face { - font-family: AlphaLyrae; - src: url(./AlphaLyrae-Medium.woff); -} diff --git a/nx.json b/nx.json index 00dab3d53..7a038e690 100644 --- a/nx.json +++ b/nx.json @@ -33,7 +33,16 @@ "generators": { "@nrwl/react": { "application": { + "style": "scss", + "linter": "eslint", "babel": true + }, + "component": { + "style": "scss" + }, + "library": { + "style": "scss", + "linter": "eslint" } }, "@nrwl/next": { diff --git a/package.json b/package.json index 6ce61d125..9f6f36ae5 100644 --- a/package.json +++ b/package.json @@ -13,11 +13,14 @@ }, "private": true, "dependencies": { + "@apollo/client": "^3.5.8", "@nrwl/next": "13.8.1", "core-js": "^3.6.5", + "graphql": "^16.3.0", "next": "12.0.7", "react": "17.0.2", "react-dom": "17.0.2", + "react-use-websocket": "^3.0.0", "regenerator-runtime": "0.13.7", "tslib": "^2.0.0" }, diff --git a/workspace.json b/workspace.json index 5a81360d7..a03038533 100644 --- a/workspace.json +++ b/workspace.json @@ -1,6 +1,8 @@ { "version": 2, "projects": { + "explorer": "apps/explorer", + "explorer-e2e": "apps/explorer-e2e", "react-helpers": "libs/react-helpers", "trading": "apps/trading", "trading-e2e": "apps/trading-e2e", diff --git a/yarn.lock b/yarn.lock index d9248ca6d..eef6d6f03 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9,6 +9,24 @@ dependencies: "@jridgewell/trace-mapping" "^0.3.0" +"@apollo/client@^3.5.8": + version "3.5.8" + resolved "https://registry.yarnpkg.com/@apollo/client/-/client-3.5.8.tgz#7215b974c5988b6157530eb69369209210349fe0" + integrity sha512-MAm05+I1ullr64VLpZwon/ISnkMuNLf6vDqgo9wiMhHYBGT4yOAbAIseRdjCHZwfSx/7AUuBgaTNOssZPIr6FQ== + dependencies: + "@graphql-typed-document-node/core" "^3.0.0" + "@wry/context" "^0.6.0" + "@wry/equality" "^0.5.0" + "@wry/trie" "^0.3.0" + graphql-tag "^2.12.3" + hoist-non-react-statics "^3.3.2" + optimism "^0.16.1" + prop-types "^15.7.2" + symbol-observable "^4.0.0" + ts-invariant "^0.9.4" + tslib "^2.3.0" + zen-observable-ts "^1.2.0" + "@babel/code-frame@7.12.11": version "7.12.11" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.12.11.tgz#f4ad435aa263db935b8f10f2c552d23fb716a63f" @@ -1383,6 +1401,11 @@ resolved "https://registry.yarnpkg.com/@gar/promisify/-/promisify-1.1.2.tgz#30aa825f11d438671d585bd44e7fd564535fc210" integrity sha512-82cpyJyKRoQoRi+14ibCeGPu0CwypgtBAdBhq1WfvagpCZNKqwXbKwXllYSMG91DhmG4jt9gN8eP6lGOtozuaw== +"@graphql-typed-document-node/core@^3.0.0": + version "3.1.1" + resolved "https://registry.yarnpkg.com/@graphql-typed-document-node/core/-/core-3.1.1.tgz#076d78ce99822258cf813ecc1e7fa460fa74d052" + integrity sha512-NQ17ii0rK1b34VZonlmT2QMJFI70m0TRwbknO/ihlbatXyaktDhN/98vBiUU6kNBPljqGqyIrl2T4nY2RpFANg== + "@hapi/accept@5.0.2": version "5.0.2" resolved "https://registry.yarnpkg.com/@hapi/accept/-/accept-5.0.2.tgz#ab7043b037e68b722f93f376afb05e85c0699523" @@ -4559,6 +4582,27 @@ "@webassemblyjs/wast-parser" "1.9.0" "@xtuc/long" "4.2.2" +"@wry/context@^0.6.0": + version "0.6.1" + resolved "https://registry.yarnpkg.com/@wry/context/-/context-0.6.1.tgz#c3c29c0ad622adb00f6a53303c4f965ee06ebeb2" + integrity sha512-LOmVnY1iTU2D8tv4Xf6MVMZZ+juIJ87Kt/plMijjN20NMAXGmH4u8bS1t0uT74cZ5gwpocYueV58YwyI8y+GKw== + dependencies: + tslib "^2.3.0" + +"@wry/equality@^0.5.0": + version "0.5.2" + resolved "https://registry.yarnpkg.com/@wry/equality/-/equality-0.5.2.tgz#72c8a7a7d884dff30b612f4f8464eba26c080e73" + integrity sha512-oVMxbUXL48EV/C0/M7gLVsoK6qRHPS85x8zECofEZOVvxGmIPLA9o5Z27cc2PoAyZz1S2VoM2A7FLAnpfGlneA== + dependencies: + tslib "^2.3.0" + +"@wry/trie@^0.3.0": + version "0.3.1" + resolved "https://registry.yarnpkg.com/@wry/trie/-/trie-0.3.1.tgz#2279b790f15032f8bcea7fc944d27988e5b3b139" + integrity sha512-WwB53ikYudh9pIorgxrkHKrQZcCqNM/Q/bDzZBffEaGUKGuHrRb3zZUT9Sh2qw9yogC7SsdRmQ1ER0pqvd3bfw== + dependencies: + tslib "^2.3.0" + "@xtuc/ieee754@^1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@xtuc/ieee754/-/ieee754-1.2.0.tgz#eef014a3145ae477a1cbc00cd1e552336dceb790" @@ -8865,6 +8909,18 @@ graceful-fs@^4.1.11, graceful-fs@^4.1.15, graceful-fs@^4.1.2, graceful-fs@^4.1.6 resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.9.tgz#041b05df45755e587a24942279b9d113146e1c96" integrity sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ== +graphql-tag@^2.12.3: + version "2.12.6" + resolved "https://registry.yarnpkg.com/graphql-tag/-/graphql-tag-2.12.6.tgz#d441a569c1d2537ef10ca3d1633b48725329b5f1" + integrity sha512-FdSNcu2QQcWnM2VNvSCCDCVS5PpPqpzgFT8+GXzqJuoDd0CBncxCY278u4mhRO7tMgo2JjgJA5aZ+nWSQ/Z+xg== + dependencies: + tslib "^2.1.0" + +graphql@^16.3.0: + version "16.3.0" + resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.3.0.tgz#a91e24d10babf9e60c706919bb182b53ccdffc05" + integrity sha512-xm+ANmA16BzCT5pLjuXySbQVFwH3oJctUVdy81w1sV0vBU0KgDdBGtxQOUd5zqOBk/JayAFeG8Dlmeq74rjm/A== + handle-thing@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/handle-thing/-/handle-thing-2.0.1.tgz#857f79ce359580c340d43081cc648970d0bb234e" @@ -9082,7 +9138,7 @@ hmac-drbg@^1.0.1: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.1" -hoist-non-react-statics@^3.3.0: +hoist-non-react-statics@^3.3.0, hoist-non-react-statics@^3.3.2: version "3.3.2" resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz#ece0acaf71d62c2969c2ec59feff42a4b1a85b45" integrity sha512-/gGivxi8JPKWNm/W0jSmzcMPpfpPLc3dY/6GxhX2hQ9iGj3aDfklV4ET7NjKpSinLpJ5vafa9iiGIEZg10SfBw== @@ -12036,6 +12092,14 @@ opener@^1.5.1: resolved "https://registry.yarnpkg.com/opener/-/opener-1.5.2.tgz#5d37e1f35077b9dcac4301372271afdeb2a13598" integrity sha512-ur5UIdyw5Y7yEj9wLzhqXiy6GZ3Mwx0yGI+5sMn2r0N0v3cKJvUmFH5yPP+WXh9e0xfyzyJX95D8l088DNFj7A== +optimism@^0.16.1: + version "0.16.1" + resolved "https://registry.yarnpkg.com/optimism/-/optimism-0.16.1.tgz#7c8efc1f3179f18307b887e18c15c5b7133f6e7d" + integrity sha512-64i+Uw3otrndfq5kaoGNoY7pvOhSsjFEN4bdEFh80MWVk/dbgJfMv7VFDeCT8LxNAlEVhQmdVEbfE7X2nWNIIg== + dependencies: + "@wry/context" "^0.6.0" + "@wry/trie" "^0.3.0" + optionator@^0.8.1: version "0.8.3" resolved "https://registry.yarnpkg.com/optionator/-/optionator-0.8.3.tgz#84fa1d036fe9d3c7e21d99884b601167ec8fb495" @@ -13353,6 +13417,11 @@ react-textarea-autosize@^8.3.0: use-composed-ref "^1.0.0" use-latest "^1.0.0" +react-use-websocket@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/react-use-websocket/-/react-use-websocket-3.0.0.tgz#754cb8eea76f55d31c5676d4abe3e573bc2cea04" + integrity sha512-BInlbhXYrODBPKIplDAmI0J1VPM+1KhCLN09o+dzgQ8qMyrYs4t5kEYmCrTqyRuMTmpahylHFZWQXpfYyDkqOw== + react@17.0.2: version "17.0.2" resolved "https://registry.yarnpkg.com/react/-/react-17.0.2.tgz#d0b5cc516d29eb3eee383f75b62864cfb6800037" @@ -14909,6 +14978,11 @@ svgo@^2.5.0, svgo@^2.7.0: picocolors "^1.0.0" stable "^0.1.8" +symbol-observable@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-4.0.0.tgz#5b425f192279e87f2f9b937ac8540d1984b39205" + integrity sha512-b19dMThMV4HVFynSAM1++gBHAbk2Tc/osgLIBZMKsyqh34jb2e8Os7T6ZW/Bt3pJFdBTd2JwAnAAEQV7rSNvcQ== + symbol-tree@^3.2.4: version "3.2.4" resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" @@ -15221,6 +15295,13 @@ ts-dedent@^2.0.0: resolved "https://registry.yarnpkg.com/ts-dedent/-/ts-dedent-2.2.0.tgz#39e4bd297cd036292ae2394eb3412be63f563bb5" integrity sha512-q5W7tVM71e2xjHZTlgfTDoPF/SmqKG5hddq9SzR49CH2hayqRKJtQ4mtRlSxKaJlR/+9rEM+mnBHf7I2/BQcpQ== +ts-invariant@^0.9.4: + version "0.9.4" + resolved "https://registry.yarnpkg.com/ts-invariant/-/ts-invariant-0.9.4.tgz#42ac6c791aade267dd9dc65276549df5c5d71cac" + integrity sha512-63jtX/ZSwnUNi/WhXjnK8kz4cHHpYS60AnmA6ixz17l7E12a5puCWFlNpkne5Rl0J8TBPVHpGjsj4fxs8ObVLQ== + dependencies: + tslib "^2.1.0" + ts-jest@27.0.5: version "27.0.5" resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-27.0.5.tgz#0b0604e2271167ec43c12a69770f0bb65ad1b750" @@ -16395,6 +16476,18 @@ yocto-queue@^0.1.0: resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== +zen-observable-ts@^1.2.0: + version "1.2.3" + resolved "https://registry.yarnpkg.com/zen-observable-ts/-/zen-observable-ts-1.2.3.tgz#c2f5ccebe812faf0cfcde547e6004f65b1a6d769" + integrity sha512-hc/TGiPkAWpByykMwDcem3SdUgA4We+0Qb36bItSuJC9xD0XVBZoFHYoadAomDSNf64CG8Ydj0Qb8Od8BUWz5g== + dependencies: + zen-observable "0.8.15" + +zen-observable@0.8.15: + version "0.8.15" + resolved "https://registry.yarnpkg.com/zen-observable/-/zen-observable-0.8.15.tgz#96415c512d8e3ffd920afd3889604e30b9eaac15" + integrity sha512-PQ2PC7R9rslx84ndNBZB/Dkv8V8fZEpk83RLgXtYd0fwUgEjseMn1Dgajh2x6S8QbZAFa9p2qVCEuYZNgve0dQ== + zwitch@^1.0.0: version "1.0.5" resolved "https://registry.yarnpkg.com/zwitch/-/zwitch-1.0.5.tgz#d11d7381ffed16b742f6af7b3f223d5cd9fe9920"