Skip to content

Commit

Permalink
Merge pull request #917 from telosnetwork/915-abstract-the-network-co…
Browse files Browse the repository at this point in the history
…nfiguration-for-easiest-multichain-support

#915 | abstract the network configuration for easiest multichain support
  • Loading branch information
poplexity authored Dec 24, 2024
2 parents ac65fe1 + 8c3018d commit 6e3f72b
Show file tree
Hide file tree
Showing 32 changed files with 1,229 additions and 600 deletions.
28 changes: 17 additions & 11 deletions env.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,24 @@ const sharedEnv = {
PROJECT_ID: '14ec76c44bae7d461fa0f5fd5f8a9da1',
};

const TESTNET = {
...sharedEnv,
APP_NAME: 'Teloscan (testnet)',
NETWORK_EVM_NAME: 'telos-evm-testnet',
const chains = {
testnet: {
...sharedEnv,
APP_NAME: 'Teloscan (testnet)',
NETWORK_EVM_NAME: 'telos-evm-testnet',
},
mainnet: {
...sharedEnv,
APP_NAME: 'Teloscan',
NETWORK_EVM_NAME: 'telos-evm',
},
zkevm_testnet: {
...sharedEnv,
APP_NAME: 'Teloscan zkEVM (testnet)',
NETWORK_EVM_NAME: 'telos-zkevm-testnet',
},
};

const MAINNET = {
...sharedEnv,
APP_NAME: 'Teloscan',
NETWORK_EVM_NAME: 'telos-evm',
};

const env = process.env.NETWORK === 'mainnet' ? MAINNET : TESTNET;
const env = chains[process.env.NETWORK?.toLowerCase()] || chains.testnet;

module.exports = env;
Binary file added public/branding/telos-teloscan-logo--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/branding/telos-teloscan-logo-testnet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/branding/telos-teloscan-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/branding/teloszk-teloscan-logo--dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/branding/teloszk-teloscan-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/networks/telos-zkevm-logo-256.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/networks/telos-zkevm-logo-32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { useQuasar } from 'quasar';
import moment from 'moment';
import { getCore, useChainStore } from 'src/core';
import { TELOS_NETWORK_NAMES } from 'src/core/mocks/chain-constants';
import { TELOS_NETWORK_NAMES } from 'src/config/chains';
import { providerManager } from 'src/boot/evm';
import { useRoute } from 'vue-router';
Expand Down
Binary file added src/assets/telos-teloscan-logo.xcf
Binary file not shown.
63 changes: 0 additions & 63 deletions src/components/ContractTab/ContractByteCode.vue

This file was deleted.

24 changes: 12 additions & 12 deletions src/components/header/AppHeaderBottomBar.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script setup lang="ts">
import { ref, watchEffect } from 'vue';
import { computed, ref, watchEffect } from 'vue';
import { useQuasar } from 'quasar';
import { useI18n } from 'vue-i18n';
Expand All @@ -11,6 +11,7 @@ import { useChainStore } from 'src/core';
const $q = useQuasar();
const { t: $t } = useI18n();
defineProps<{
topBarHidden: boolean;
}>();
Expand All @@ -27,8 +28,11 @@ watchEffect(() => {
function scrollHandler(info: { direction: string; }) {
menuBottomBarHidden.value = info.direction === 'down';
}
const settings = computed(() => useChainStore().currentChain.settings);
</script>


<template>
<div
:class="{
Expand All @@ -41,19 +45,15 @@ function scrollHandler(info: { direction: string; }) {
<router-link to="/" class="c-header-bottom-bar__logo-container">
<div class="c-header-bottom-bar__logo-image-container">
<img
v-if="!$q.dark.isActive"
:alt="$t('components.header.telos_evm_logo_alt')"
src="/branding/telos-scan.png"
height="32"
:src="settings.getThemes().light['title-image']"
>
<img
v-if="-$q.dark.isActive"
:alt="$t('components.header.telos_evm_logo_alt')"
:src="settings.getThemes().dark['title-image']"
>
</div>

<div class="c-header-bottom-bar__logo-text-container">
<span class="c-header-bottom-bar__logo-text">
Teloscan
</span>
<span v-if="useChainStore().currentChain.settings.isTestnet()" class="c-header-bottom-bar__testnet-indicator">
Testnet
</span>
</div>
</router-link>

Expand Down
4 changes: 2 additions & 2 deletions src/components/header/AppHeaderTopBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ function toggleDarkMode() {
<div class="c-header-top-bar">
<div class="c-header-top-bar__inner-container">
<div class="c-header-top-bar__left-container">
<div v-if="!chainStore.currentChain.settings.isTestnet()" class="text-caption q-mr-md">
<div v-if="chainStore.currentChain.settings.getHeaderIndicators().price" class="text-caption q-mr-md">
<span class="c-header-top-bar__grey-text">
{{ $t('components.header.system_token_price', { token: systemTokenSymbol }) }}
</span> ${{ tlosPrice }}
</div>

<div v-if="!chainStore.currentChain.settings.isTestnet()" class="text-caption u-flex--center-y">
<div v-if="chainStore.currentChain.settings.getHeaderIndicators().gasPrice" class="text-caption u-flex--center-y">
<q-icon name="fas fa-gas-pump" class="c-header-top-bar__grey-text q-mr-xs" />
<span class="c-header-top-bar__grey-text">
{{ $t('components.header.gas') }}:
Expand Down
2 changes: 2 additions & 0 deletions src/config/chains/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const TELOS_CHAIN_IDS = ['40', '41', '1310'];
export const TELOS_NETWORK_NAMES = ['telos-evm', 'telos-evm-testnet', 'telos-zkevm-testnet'];
Loading

0 comments on commit 6e3f72b

Please sign in to comment.