updated atlas

This commit is contained in:
Sebastian Gerske 2019-09-17 12:22:11 +02:00
parent 19dee496e5
commit 220550d5de
4 changed files with 16 additions and 12 deletions

6
package-lock.json generated
View File

@ -955,9 +955,9 @@
"integrity": "sha512-6It2EVfGskxZCQhuykrfnALg7oVeiI6KclWSmGDqB0AiInVrTGB9Jp9i4/Ad21u9Jde/voVQz6eFX/eSg/UsPA=="
},
"@ethereum-navigator/atlas": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/@ethereum-navigator/atlas/-/atlas-0.4.0.tgz",
"integrity": "sha512-NZO5bc7E++Fd8GRkOWpTvfJPQjEGOEPxjcwAsmX7BArdYa3uQn1Ug/ij+QiGQ8xziJLwnU1jQxWb5jqVDObOdw=="
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/@ethereum-navigator/atlas/-/atlas-0.5.0.tgz",
"integrity": "sha512-vrr1mN82keDzY5iDwyvG9+9RshmxOdBmEh2LX9vNLXcVrrr2e2hh7KsVQKWKSnubgv2Mo9WY/Y2IHxvRlUREeg=="
},
"@hapi/address": {
"version": "2.1.1",

View File

@ -12,7 +12,7 @@
"format": "prettier ./src/**/*.{js,scss,json} --write"
},
"dependencies": {
"@ethereum-navigator/atlas": "^0.4.0",
"@ethereum-navigator/atlas": "^0.5.0",
"@oceanprotocol/art": "^2.2.0",
"@oceanprotocol/typographies": "^0.1.0",
"axios": "^0.19.0",

View File

@ -8,8 +8,8 @@ Network.propTypes = {
name: PropTypes.string.isRequired,
networkId: PropTypes.string.isRequired,
type: PropTypes.string.isRequired,
url: PropTypes.string.isRequired,
explorer: PropTypes.string.isRequired
rpcUrl: PropTypes.string.isRequired,
explorerUrl: PropTypes.string.isRequired
})
}
@ -21,7 +21,7 @@ export default function Network({ network }) {
useEffect(() => {
async function getStatusAndBlock() {
const response = await axiosRpcRequest(network.url, 'eth_blockNumber')
const response = await axiosRpcRequest(network.rpcUrl, 'eth_blockNumber')
if (!response || response.status !== 200) {
setStatus('Offline')
@ -38,7 +38,10 @@ export default function Network({ network }) {
}
async function getClientVersion() {
const response = await axiosRpcRequest(network.url, 'web3_clientVersion')
const response = await axiosRpcRequest(
network.rpcUrl,
'web3_clientVersion'
)
response && response.data && setClientVersion(response.data.result)
}
@ -64,7 +67,7 @@ export default function Network({ network }) {
<span>{network.type}</span>
</h2>
<p>
<code>{network.url}</code>
<code>{network.rpcUrl}</code>
</p>
<p className={styles.status}>
<span className={isOnline ? styles.success : styles.error}>
@ -78,7 +81,8 @@ export default function Network({ network }) {
</p>
{block && (
<p className={styles.block} title="Current block number">
At block #<a href={`${network.explorer}/blocks/${block}`}>{block}</a>
At block #
<a href={`${network.explorerUrl}/blocks/${block}`}>{block}</a>
</p>
)}
{clientVersion && <p className={styles.clientVersion}>{clientVersion}</p>}

View File

@ -20,8 +20,8 @@ describe('Network', () => {
project: 'Ocean Protocol',
type: 'mainnet',
networkId: '0xCEA11',
url: 'https://pacific.oceanprotocol.com',
explorer: 'https://submarine.oceanprotocol.com'
rpcUrl: 'https://pacific.oceanprotocol.com',
explorerUrl: 'https://submarine.oceanprotocol.com'
}
it('renders without crashing', async () => {