From 024af8db81367cd42cc4cdaba6eab9a715cf45b7 Mon Sep 17 00:00:00 2001 From: Alex Coseru Date: Fri, 8 Oct 2021 12:25:47 +0300 Subject: [PATCH] Add support for Energy Web Chain (#907) * add energy web * add energyweb * maybe fix that damn git+ssh problem * remove unneccessary name overwrite * add Energy Web Chain icon * fix all datatoken links * base on ddo.chainId * check for more networks * closes #910 Co-authored-by: Matthias Kretschmann --- app.config.js | 4 ++-- src/components/atoms/NetworkName.tsx | 3 +++ src/components/organisms/AssetContent/MetaMain.tsx | 9 ++++++--- src/images/energyweb.svg | 3 +++ 4 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 src/images/energyweb.svg diff --git a/app.config.js b/app.config.js index 4343de7ee..95670ab3f 100644 --- a/app.config.js +++ b/app.config.js @@ -10,10 +10,10 @@ module.exports = { // List of chainIds which metadata cache queries will return by default. // This preselects the Chains user preferences. - chainIds: [1, 137, 56, 1285], + chainIds: [1, 137, 56, 1285, 246], // List of all supported chainIds. Used to populate the Chains user preferences list. - chainIdsSupported: [1, 3, 4, 137, 80001, 1287, 56, 2021000, 1285], + chainIdsSupported: [1, 3, 4, 137, 80001, 1287, 56, 2021000, 1285, 246], rbacUrl: process.env.GATSBY_RBAC_URL, diff --git a/src/components/atoms/NetworkName.tsx b/src/components/atoms/NetworkName.tsx index 9ddb777bd..ebfe3c7bc 100644 --- a/src/components/atoms/NetworkName.tsx +++ b/src/components/atoms/NetworkName.tsx @@ -3,6 +3,7 @@ import { ReactComponent as EthIcon } from '../../images/eth.svg' import { ReactComponent as PolygonIcon } from '../../images/polygon.svg' import { ReactComponent as MoonbeamIcon } from '../../images/moonbeam.svg' import { ReactComponent as BscIcon } from '../../images/bsc.svg' +import { ReactComponent as EnergywebIcon } from '../../images/energyweb.svg' import { getNetworkDataById, getNetworkDisplayName } from '../../utils/web3' import styles from './NetworkName.module.css' import useNetworkMetadata from '../../hooks/useNetworkMetadata' @@ -16,6 +17,8 @@ export function NetworkIcon({ name }: { name: string }): ReactElement { ? MoonbeamIcon : name.includes('BSC') ? BscIcon + : name.includes('Energy Web') + ? EnergywebIcon : EthIcon // ETH icon as fallback return IconMapped ? : null diff --git a/src/components/organisms/AssetContent/MetaMain.tsx b/src/components/organisms/AssetContent/MetaMain.tsx index 8dfc8d375..4a073cff3 100644 --- a/src/components/organisms/AssetContent/MetaMain.tsx +++ b/src/components/organisms/AssetContent/MetaMain.tsx @@ -10,9 +10,12 @@ import styles from './MetaMain.module.css' export default function MetaMain(): ReactElement { const { ddo, owner, type, isAssetNetwork } = useAsset() - const { networkId, web3ProviderInfo } = useWeb3() + const { web3ProviderInfo } = useWeb3() + const isCompute = Boolean(ddo?.findServiceByType('compute')) const accessType = isCompute ? 'compute' : 'access' + const blockscoutNetworks = [1287, 2021000, 2021001, 44787, 246, 1285] + const isBlockscoutExplorer = blockscoutNetworks.includes(ddo?.chainId) return (