Skip to content
This repository has been archived by the owner on Jan 21, 2025. It is now read-only.

PP-175: fix matterlabs links on explorer #22

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 17 additions & 47 deletions etc/js/env-config.js
Original file line number Diff line number Diff line change
@@ -1,56 +1,26 @@
export default {
'http://localhost': {
API_SERVER: 'https://localhost:3001',
WALLET_ADDRESS: 'http://localhost:3000',
EXPLORER: 'http://localhost:7001',
ETH_NETWORK: 'localhost',
WS_API_ADDR: 'ws://localhost:3031',
HTTP_RPC_API_ADDR: 'http://localhost:3030'
},
'https://stage.zksync.dev': {
API_SERVER: 'https://stage-api.zksync.dev',
ETH_NETWORK: 'rinkeby',
WS_API_ADDR: 'wss://stage-api.zksync.dev/jsrpc-ws',
HTTP_RPC_API_ADDR: 'https://stage-api.zksync.dev/jsrpc'
},
'https://rinkeby.zkscan.io': {
API_SERVER: 'https://rinkeby-api.zksync.io',
ETH_NETWORK: 'rinkeby',
WS_API_ADDR: 'wss://rinkeby-api.zksync.io/jsrpc-ws',
HTTP_RPC_API_ADDR: 'https://rinkeby-api.zksync.io/jsrpc'
},
'https://ropsten.zkscan.io': {
API_SERVER: 'https://ropsten-api.zksync.io',
ETH_NETWORK: 'ropsten',
WS_API_ADDR: 'wss://ropsten-api.zksync.io/jsrpc-ws',
HTTP_RPC_API_ADDR: 'https://ropsten-api.zksync.io/jsrpc'
},
'https://rinkeby-beta.zkscan.io': {
API_SERVER: 'https://rinkeby-beta-api.zksync.io',
ETH_NETWORK: 'rinkeby',
WS_API_ADDR: 'wss://rinkeby-beta-api.zksync.io/jsrpc-ws',
HTTP_RPC_API_ADDR: 'https://rinkeby-beta-api.zksync.io/jsrpc'
},
'https://ropsten-beta.zkscan.io': {
API_SERVER: 'https://ropsten-beta-api.zksync.io',
ETH_NETWORK: 'ropsten',
WS_API_ADDR: 'wss://ropsten-beta-api.zksync.io/jsrpc-ws',
HTTP_RPC_API_ADDR: 'https://ropsten-beta-api.zksync.io/jsrpc'
},
'https://zkscan.io': {
API_SERVER: 'https://api.zksync.io',
ETH_NETWORK: 'mainnet',
WS_API_ADDR: 'wss://api.zksync.io/jsrpc-ws',
HTTP_RPC_API_ADDR: 'https://api.zksync.io/jsrpc'
},
'https://dev.zksync.dev': {
API_SERVER: 'https://dev-api.zksync.dev',
ETH_NETWORK: 'rinkeby',
WS_API_ADDR: 'wss://dev-api.zksync.dev/jsrpc-ws',
HTTP_RPC_API_ADDR: 'https://dev-api.zksync.dev/jsrpc'
},
'https://breaking.zksync.dev': {
API_SERVER: 'https://breaking-api.zksync.dev',
ETH_NETWORK: 'rinkeby',
WS_API_ADDR: 'wss://breaking-api.zksync.dev/jsrpc-ws',
HTTP_RPC_API_ADDR: 'https://breaking-api.zksync.dev/jsrpc'
'https://explorer.dev.aggregation.rifcomputing.net': {
API_SERVER: 'https://dev.aggregation.rifcomputing.net:3029',
WALLET_ADDRESS: 'https://wallet.dev.aggregation.rifcomputing.net',
EXPLORER: 'https://explorer.testnet.rsk.co',
ETH_NETWORK: 'testnet',
WS_API_ADDR: 'https://dev.aggregation.rifcomputing.net:3031',
HTTP_RPC_API_ADDR: 'https://dev.aggregation.rifcomputing.net:3030'
},
'https://explorer.aggregation.rifcomputing.net': {
API_SERVER: 'https://aggregation.rifcomputing.net:3029',
WALLET_ADDRESS: 'https://wallet.aggregation.rifcomputing.net',
EXPLORER: 'https://explorer.rsk.co',
ETH_NETWORK: 'rsk_mainnet',
WS_API_ADDR: 'https://aggregation.rifcomputing.net:3031',
HTTP_RPC_API_ADDR: 'https://aggregation.rifcomputing.net:3030'
}
}[`${location.protocol}//${location.hostname}`];
4 changes: 2 additions & 2 deletions infrastructure/explorer/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.png">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css" integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
<title>zkSync Explorer</title>
<title>RIF Aggregation Explorer</title>
</head>
<body>
<noscript>
<strong>We're sorry but zkSync Explorer doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
<strong>We're sorry but RIF Aggregation Explorer doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
Expand Down
25 changes: 12 additions & 13 deletions infrastructure/explorer/src/Navbar.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template>
<b-navbar toggleable="md" type="dark" variant="info">
<b-navbar toggleable="md" type="dark" variant="light">
<b-container>
<b-navbar-brand>
<a href="https://zksync.io" target="_blank">
<img class="navbar-hero-img" src="./assets/ZK_dark.svg" />
<a href="/" target="_blank">
<img class="navbar-hero-img" src="./assets/rif_logo.svg" />
</a>
<b-badge variant="primary" class="hero-network-name pointer" v-on:click.prevent="goToHome">
{{ store.capitalizedNetwork }}
Expand Down Expand Up @@ -34,16 +34,6 @@
Wallet
<span style="font-size: 0.9em"><i class="fas fa-external-link-alt"></i></span>
</b-nav-item>
<b-nav-item
v-if="store.statusLink"
v-bind:href="store.statusLink"
target="_blank"
rel="noopener noreferrer"
class="nowrap"
>
Status
<span style="font-size: 0.9em"><i class="fas fa-external-link-alt"></i></span>
</b-nav-item>
</b-navbar-nav>
<b-navbar-nav class="ml-auto">
<b-nav-form>
Expand Down Expand Up @@ -110,4 +100,13 @@ export default {
.pointer {
cursor: pointer;
}

.navbar-dark .navbar-nav .nav-link {
color: #4d4d4d;
}
.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link:active,
.navbar-dark .navbar-nav .nav-link:focus {
color: #000;
}
</style>
4 changes: 2 additions & 2 deletions infrastructure/explorer/src/Tokens.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ export default {
this.loading = false;
},
urlForToken(address) {
const prefix = store.network === 'mainnet' ? '' : `${store.network}.`;
return `https://${prefix}etherscan.io/token/${address}`;
const explorerLink = store.explorerLink;
return `${explorerLink}/token/${address}`;
}
},
components
Expand Down
28 changes: 28 additions & 0 deletions infrastructure/explorer/src/assets/rif_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion infrastructure/explorer/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ window.app = new Vue({
el: '#app',
router,
created() {
document.title = `zkSync ${store.capitalizedNetwork} Explorer — trustless scalable payments`;
document.title = `RIF Aggregation ${store.capitalizedNetwork} Explorer — trustless scalable payments`;
},
render: (h) => h(App)
});
Expand Down
9 changes: 6 additions & 3 deletions infrastructure/explorer/src/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@ import config from './env-config';
import { capitalize } from './utils';

const network = config.ETH_NETWORK;
const walletLinkPrefix = network == 'mainnet' ? 'wallet' : network;
const walletLink = config.WALLET_ADDRESS;
const explorerLink = config.EXPLORER;
const explorerVersion = config.EXPLORER_VERSION;

const store = {
contractAddress: undefined,
config: network,
network: network,
capitalizedNetwork: capitalize(network),
walletLink: `https://${walletLinkPrefix}.zksync.io`,
statusLink: 'https://uptime.com/s/zksync'
walletLink: walletLink,
explorerLink: explorerLink,
explorerVersion: explorerVersion
};

export default store;
24 changes: 5 additions & 19 deletions infrastructure/explorer/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,38 +61,24 @@ export function getLocalAccountLink(address) {

export function blockchainExplorerToken(token, account) {
if (store.network === 'localhost') {
return `http://localhost:8000/${account}`;
return `${store.explorerLink}/${account}`;
}
const prefix = store.network === 'mainnet' ? '' : `${store.network}.`;
const tokenAddress = window.syncProvider.tokenSet.resolveTokenAddress(token);

if (tokenAddress != '0x0000000000000000000000000000000000000000') {
return `https://${prefix}etherscan.io/token/${tokenAddress}?a=${account}`;
return `${store.explorerLink}/token/${tokenAddress}?a=${account}`;
} else {
return `https://${prefix}etherscan.io/address/${account}`;
return `${store.explorerLink}/address/${account}`;
}
}

export function getBlockchainExplorerTx(network) {
if (network === 'localhost') {
return 'http://localhost:8000';
}
if (network === 'mainnet') {
return 'https://etherscan.io/tx';
}

return `https://${network}.etherscan.io/tx`;
return `${store.explorerLink}/tx`;
}

export function getBlockchainExplorerAddress(network) {
if (network === 'localhost') {
return 'http://localhost:8000';
}
if (network === 'mainnet') {
return 'https://etherscan.io/address';
}

return `https://${network}.etherscan.io/address`;
return `${store.explorerLink}/address`;
}

export function readyStateFromString(s) {
Expand Down