From 1eea458e462a09acee8f3f2a17f3944a16a01b4d Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Tue, 18 Oct 2022 20:52:14 +0100 Subject: [PATCH] output contract addresses --- package-lock.json | 84 +++++++++++++++++++++++ package.json | 4 +- src/pages/index.tsx | 134 +++++++++++++++++++++++-------------- src/styles/Home.module.css | 22 ++++-- 4 files changed, 188 insertions(+), 56 deletions(-) diff --git a/package-lock.json b/package-lock.json index 801485c..73e128e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,7 @@ "name": "status-frontend", "version": "0.1.0", "dependencies": { + "@oceanprotocol/contracts": "^1.1.7", "@oceanprotocol/typographies": "^0.1.0", "@svgr/webpack": "^6.5.0", "axios": "^1.1.3", @@ -2832,6 +2833,11 @@ "node": ">= 8" } }, + "node_modules/@oceanprotocol/contracts": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-1.1.7.tgz", + "integrity": "sha512-Oe+oBRiu1dlco9PQ7eUYcTYi2Nua69S3TiSw62H46AIpwnFK8ORuO0Ny20No++KisBA9F+84b5lDn6kQy5Lt/Q==" + }, "node_modules/@oceanprotocol/typographies": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/@oceanprotocol/typographies/-/typographies-0.1.0.tgz", @@ -3578,6 +3584,21 @@ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" } }, + "node_modules/bufferutil": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.7.tgz", + "integrity": "sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "peer": true, + "dependencies": { + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" + } + }, "node_modules/call-bind": { "version": "1.0.2", "license": "MIT", @@ -5505,6 +5526,19 @@ } } }, + "node_modules/node-gyp-build": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz", + "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==", + "dev": true, + "optional": true, + "peer": true, + "bin": { + "node-gyp-build": "bin.js", + "node-gyp-build-optional": "optional.js", + "node-gyp-build-test": "build-test.js" + } + }, "node_modules/node-releases": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.6.tgz", @@ -6589,6 +6623,21 @@ "react": "^16.8.0 || ^17.0.0 || ^18.0.0" } }, + "node_modules/utf-8-validate": { + "version": "5.0.10", + "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", + "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "peer": true, + "dependencies": { + "node-gyp-build": "^4.3.0" + }, + "engines": { + "node": ">=6.14.2" + } + }, "node_modules/which": { "version": "2.0.2", "dev": true, @@ -8445,6 +8494,11 @@ "fastq": "^1.6.0" } }, + "@oceanprotocol/contracts": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/@oceanprotocol/contracts/-/contracts-1.1.7.tgz", + "integrity": "sha512-Oe+oBRiu1dlco9PQ7eUYcTYi2Nua69S3TiSw62H46AIpwnFK8ORuO0Ny20No++KisBA9F+84b5lDn6kQy5Lt/Q==" + }, "@oceanprotocol/typographies": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/@oceanprotocol/typographies/-/typographies-0.1.0.tgz", @@ -8910,6 +8964,17 @@ "update-browserslist-db": "^1.0.9" } }, + "bufferutil": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/bufferutil/-/bufferutil-4.0.7.tgz", + "integrity": "sha512-kukuqc39WOHtdxtw4UScxF/WVnMFVSQVKhtx3AjZJzhd0RGZZldcrfSEbVsWWe6KNH253574cq5F+wpv0G9pJw==", + "dev": true, + "optional": true, + "peer": true, + "requires": { + "node-gyp-build": "^4.3.0" + } + }, "call-bind": { "version": "1.0.2", "requires": { @@ -10185,6 +10250,14 @@ "use-sync-external-store": "1.2.0" } }, + "node-gyp-build": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-4.5.0.tgz", + "integrity": "sha512-2iGbaQBV+ITgCz76ZEjmhUKAKVf7xfY1sRl4UiKQspfZMH2h06SyhNsnSVy50cwkFQDGLyif6m/6uFXHkOZ6rg==", + "dev": true, + "optional": true, + "peer": true + }, "node-releases": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.6.tgz", @@ -10854,6 +10927,17 @@ "version": "1.2.0", "requires": {} }, + "utf-8-validate": { + "version": "5.0.10", + "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", + "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", + "dev": true, + "optional": true, + "peer": true, + "requires": { + "node-gyp-build": "^4.3.0" + } + }, "which": { "version": "2.0.2", "dev": true, diff --git a/package.json b/package.json index 243d44a..888e31c 100644 --- a/package.json +++ b/package.json @@ -7,9 +7,11 @@ "build": "next build", "start": "next start", "lint": "next lint", - "test": "npm run lint && tsc --noEmit" + "type-check": "tsc --noEmit", + "test": "npm run lint" }, "dependencies": { + "@oceanprotocol/contracts": "^1.1.7", "@oceanprotocol/typographies": "^0.1.0", "@svgr/webpack": "^6.5.0", "axios": "^1.1.3", diff --git a/src/pages/index.tsx b/src/pages/index.tsx index 5995ee8..b11ff08 100644 --- a/src/pages/index.tsx +++ b/src/pages/index.tsx @@ -5,6 +5,7 @@ import styles from '../styles/Home.module.css' import { getData } from '../utils/getData' import LogoAsset from '../images/logo.svg' import CheckAsset from '../images/check.svg' +import addresses from '@oceanprotocol/contracts/addresses/address.json' function statusIcon(state: State): ReactElement { if (state === State.Up) { @@ -48,64 +49,95 @@ export default function HomePage(): ReactElement {
-

Ocean Status

-

Current Status of Ocean Components

+

Ocean Protocol Status

+

+ Status overview of all{' '} + + deployed components + {' '} + hosted by the Ocean Protocol Foundation. +

- {Object.entries(data || {}).map(([key, value]) => ( - -

{key}

-
- {Object.entries(value) - .filter( - // TODO: Remove this filter if we fix this on API level - // Needs a new `components` key under Status response - ([key]) => - key !== 'currentBlock' && - key !== 'lastUpdatedOn' && - key !== 'network' && - key !== '_id' && - key !== '__v' - ) - .map(([key, value]) => ( -
-

- {statusIcon( + {Object.entries(data || {}).map(([key, value]) => { + const networkKey = key + + return ( + +

{networkKey}

+
+ {Object.entries(value) + .filter( + // TODO: Remove this filter if we fix this on API level + // Needs a new `components` key under Status response + ([key]) => + key !== 'currentBlock' && + key !== 'lastUpdatedOn' && + key !== 'network' && + key !== '_id' && + key !== '__v' + ) + .map(([key, value]) => ( +
- {value.version} - -

+ )}`} + > +

+ {statusIcon( + key === 'market' || key === 'dataFarming' + ? value + : value.status + )}{' '} + {key} + + {value.version} + +

- {value.statusMessages && value.statusMessages !== '' && ( -
    - {value.statusMessages - .split(',') - .map((message: string, i: number) => ( -
  • - {message} -
  • - ))} -
- )} -
- ))} -
-
- ))} + {value.statusMessages && value.statusMessages !== '' && ( + + )} + + ))} + + +
+ +

Deployed Contracts

+
+
    + {Object.entries((addresses as any)[networkKey]).map( + ([key, value]) => + key !== 'chainId' && + key !== 'startBlock' && ( +
  • + {key}:{' '} + {JSON.stringify(value)} +
  • + ) + )} +
+
+ + ) + })}
diff --git a/src/styles/Home.module.css b/src/styles/Home.module.css index b9c81b9..ea52c61 100644 --- a/src/styles/Home.module.css +++ b/src/styles/Home.module.css @@ -14,8 +14,7 @@ } .title { - margin: 0; - line-height: 1.15; + margin-bottom: calc(var(--spacer) / 4); font-size: 3rem; } @@ -26,6 +25,8 @@ .description { font-size: var(--font-size-large); + margin: 0 auto; + max-width: 50rem; } .grid { @@ -48,8 +49,7 @@ border: 2px solid var(--border-color); } -.card h2 { - margin: 0 0 1rem 0; +.titleComponent { font-size: var(--font-size-large); margin: 0; } @@ -96,3 +96,17 @@ list-style-position: outside; color: var(--brand-alert-orange); } + +.contracts { + margin-top: var(--spacer); + margin-left: 1rem; +} + +.contracts summary { + margin-left: -1rem; + cursor: pointer; +} + +.contracts .titleComponent { + display: inline-block; +}