Skip to content
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
4 changes: 4 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# rename to .env.local or .env.<your_environment>
VITE_REFRESH_INTERVAL=2000
VITE_FETCH_ALL_BLOCKS=true
VITE_RECENT_BLOCK_LIMIT=100
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ node_modules/
**/.vscode
yarn-error.log
dist
.idea
.idea

.env*
!.env.example
149 changes: 149 additions & 0 deletions chains/mainnet/xion.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
{
"chain_name": "xion",
"registry_name": "xion",
"coingecko": "xion",
"network_type": "mainnet",
"rpc": [
{
"address": "https://rpc.xion-mainnet-1.burnt.com",
"provider": "🔥BurntLabs🔥"
},
{
"address": "https://rpc-burnt.imperator.co/",
"provider": "Imperator.co"
},
{
"address": "https://xion-rpc.polkachu.com",
"provider": "Polkachu"
}
],
"api": [
{
"address": "https://api.xion-mainnet-1.burnt.com",
"provider": "🔥BurntLabs🔥"
},
{
"address": "https://lcd-burnt.imperator.co/",
"provider": "Imperator.co"
},
{
"address": "https://xion-api.polkachu.com",
"provider": "Polkachu"
}
],
"snapshot_provider": "",
"sdk_version": "0.50.13",
"coin_type": "118",
"min_tx_fee": "100",
"addr_prefix": "xion",
"theme_color": "#96b325",
"logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/xion/images/burnt-round.png",
"assets": [
{
"base": "uxion",
"symbol": "XION",
"exponent": "6",
"coingecko_id": "xion-2",
"logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/xion/images/burnt-round.png"
},
{
"base": "ibc/0471F1C4E7AFD3F07702BEF6DC365268D64570F7C1FDC98EA6098DD6DE59817B",
"symbol": "OSMO",
"exponent": "6",
"coingecko_id": "osmosis",
"logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/osmo.png"
},
{
"base": "ibc/F082B65C88E4B6D5EF1DB243CDA1D331D002759E938A0F5CD3FFDC5D53B3E349",
"symbol": "USDC",
"exponent": "6",
"coingecko_id": "usd-coin",
"logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/noble/images/USDCoin.png"
},
{
"base": "ibc/CC7B293B3F08EA7DB96AFD4765BD0C7F95ABD7ECEAF21C74F3ACCBF7CEFB6591",
"symbol": "OSMO",
"exponent": "6",
"coingecko_id": "osmosis",
"logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/osmosis/images/osmo.png"
},
{
"base": "ibc/9463E39D230614B313B487836D13A392BD1731928713D4C8427A083627048DB3",
"symbol": "AXL",
"exponent": "6",
"coingecko_id": "axelar",
"logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axl.png"
},
{
"base": "ibc/6490A7EAB61059BFC1CDDEB05917DD70BDF3A611654162A1A47DB930D40D8AF4",
"symbol": "axlUSDC",
"exponent": "6",
"coingecko_id": "usd-coin",
"logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axlusdc.png"
},
{
"base": "ibc/0000000000000000000000000000000000000000000000000000000000000000",
"symbol": "axlUSDT",
"exponent": "6",
"coingecko_id": "tether",
"logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axlusdc.png"
},
{
"base": "ibc/0000000000000000000000000000000000000000000000000000000000000000",
"symbol": "axlDAI",
"exponent": "18",
"coingecko_id": "dai",
"logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axldai.png"
},
{
"base": "ibc/0000000000000000000000000000000000000000000000000000000000000000",
"symbol": "axlFRAX",
"exponent": "6",
"coingecko_id": "frax",
"logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/axlfrax.png"
},
{
"base": "ibc/AAD7136DD626569C3DDE7C5F764968BB2E939875EFC568AE5712B62081850814",
"symbol": "axlWETH",
"exponent": "18",
"coingecko_id": "axlweth",
"logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/axelar/images/weth.png"
},
{
"base": "ibc/056EA54C3D9B49B3C0418955A27980A91DD4F210914BFE240A1DB19E27895ECA",
"symbol": "KYVE",
"exponent": "6",
"coingecko_id": "kyve-network",
"logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/kyve/images/kyve-token.png"
},
{
"base": "ibc/DBE9697AC1044255A305A2034AD360B4152632BFBFB5785234731F60196B9645",
"symbol": "ELYS",
"exponent": "6",
"coingecko_id": "elys",
"logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/elys/images/elys.png"
},
{
"base": "ibc/E706A0C6CACB374ADC2BCF6A74FE1B260840FC822E45DCB776DEA962A57FED30",
"symbol": "axlARB",
"exponent": "18",
"coingecko_id": "arb",
"logo": "https://raw.githubusercontent.com/cosmos/chain-registry/master/_non-cosmos/arbitrum/images/arb.png"
}
],
"features": [
"dashboard",
"governance",
"staking",
"blocks",
"tx",
"uptime",
"ibc",
"supply",
"parameters",
"consensus",
"cosmwasm",
"account"
],
"keplr_features": ["ibc-go", "ibc-transfer", "no-legacy-stdTx"]
}
2 changes: 1 addition & 1 deletion src/components/ChainSummary.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import { useDashboard } from '@/stores/useDashboard';
import { useDashboard } from '@/stores';
import { computed } from 'vue';
import { Icon } from '@iconify/vue';

Expand Down
3 changes: 2 additions & 1 deletion src/components/charts/TxsInBlocksChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ const options = computed(() => {
},
show: false,
categories: baseStore.recents
.slice(0, 50)
.map((x) => x.block.header.height)
.concat(Array(50 - baseStore.recents.length).fill('')),
.concat(Array(Math.max(0, 50)).fill('')),
},
};
});
Expand Down
6 changes: 4 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { createPinia } from 'pinia';
import LazyLoad from 'lazy-load-vue3';

import router from './router';
import { useBaseStore } from './stores/useBaseStore';
import { useBaseStore } from '@/stores';

// Create vue app
const app = createApp(App);
Expand All @@ -19,6 +19,8 @@ app.use(LazyLoad, { component: true });
// Mount vue app
app.mount('#app');

const REFRESH_INTERVAL = import.meta.env.VITE_REFRESH_INTERVAL || 6000; // 6 seconds

// fetch latest block every 6s
const blockStore = useBaseStore();
const requestCounter = ref(0);
Expand All @@ -28,4 +30,4 @@ setInterval(() => {
// max allowed request
blockStore.fetchLatest().finally(() => (requestCounter.value -= 1));
}
}, 6000);
}, REFRESH_INTERVAL);
62 changes: 18 additions & 44 deletions src/modules/[chain]/block/block.ts
Original file line number Diff line number Diff line change
@@ -1,68 +1,42 @@
import { defineStore } from 'pinia';
import { decodeTxRaw, type DecodedTxRaw } from '@cosmjs/proto-signing';
import { useBlockchain } from '@/stores';
import { hashTx } from '@/libs';
import type { Block } from '@/types';
import { useBaseStore, useBlockchain } from '@/stores';

export const useBlockModule = defineStore('blockModule', {
state: () => {
return {
latest: {} as Block,
current: {} as Block,
recents: [] as Block[],
};
},
getters: {
baseStore() {
return useBaseStore();
},
blockchain() {
return useBlockchain();
},
blocktime() {
if (this.recents.length < 2) return 6000;
return 6000; // todo later
return useBaseStore().blocktime;
},
txsInRecents() {
const txs = [] as { hash: string; tx: DecodedTxRaw }[];
this.recents.forEach((x) =>
x.block?.data?.txs.forEach((tx: Uint8Array) => {
if (tx) {
try {
txs.push({
hash: hashTx(tx),
tx: decodeTxRaw(tx),
});
} catch (e) {}
}
})
);
return txs;
return useBaseStore().txsInRecents;
},
latest(){
return useBaseStore().latest;
},
earliest() {
return useBaseStore().earliest;
},
recents() {
return useBaseStore().recents;
}
},
actions: {
initial() {
this.clearRecentBlocks();
this.autoFetch();
},
async clearRecentBlocks() {
this.recents = [];
},
autoFetch() {
this.fetchLatest().then((x) => {
const timer = this.autoFetch;
this.latest = x;
// if(this.recents.length >= 50) this.recents.pop()
// this.recents.push(x)
// setTimeout(timer, 6000)
});
return this.baseStore.clearRecentBlocks()
},
async fetchLatest() {
this.latest = await this.blockchain.rpc?.getBaseBlockLatest();
if (this.recents.length >= 50) this.recents.shift();
this.recents.push(this.latest);
return this.latest;
return this.baseStore.fetchLatest()
},
async fetchBlock(height: string) {
this.current = await this.blockchain.rpc?.getBaseBlockAt(height);
return this.current;
return this.baseStore.fetchBlock(height)
},
},
});
7 changes: 4 additions & 3 deletions src/modules/[chain]/consensus/index.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<script lang="ts" setup>
import fetch from 'cross-fetch';
import { onMounted, ref, computed, onUnmounted } from 'vue';
import { useBlockchain, useFormatter, useStakingStore } from '@/stores';
import { useBlockchain, useFormatter, useStakingStore, useBaseStore } from '@/stores';
import { consensusPubkeyToHexAddress } from '@/libs';

const format = useFormatter();
const chainStore = useBlockchain();
const stakingStore = useStakingStore();
const baseStore = useBaseStore();
const rpcList = ref(chainStore.current?.endpoints?.rpc || [{ address: '', provider: '' }]);
let rpc = ref('');
const validators = ref(stakingStore.validators);
Expand All @@ -31,7 +32,7 @@ onMounted(async () => {
clearTime();
timer = setInterval(() => {
update();
}, 6000);
}, Math.round(baseStore.blocktime / 2));
});
onUnmounted(() => {
clearTime();
Expand Down Expand Up @@ -87,7 +88,7 @@ async function onChange() {
update();
timer = setInterval(() => {
update();
}, 6000);
}, Math.round(baseStore.blocktime / 2));
}

async function fetchPosition() {
Expand Down
25 changes: 13 additions & 12 deletions src/modules/[chain]/indexStore.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import { useBlockchain, useCoingecko, useBaseStore, useBankStore, useFormatter, useGovStore } from '@/stores';
import { useDistributionStore } from '@/stores/useDistributionStore';
import { useMintStore } from '@/stores/useMintStore';
import { useStakingStore } from '@/stores/useStakingStore';
import {
useBlockchain,
useCoingecko,
useBaseStore,
useBankStore,
useFormatter,
useGovStore,
useDistributionStore,
useMintStore,
useStakingStore,
} from '@/stores';
import type { Coin, Tally } from '@/types';
import numeral from 'numeral';
import { defineStore } from 'pinia';
Expand Down Expand Up @@ -157,9 +164,7 @@ export const useIndexModule = defineStore('module-index', {
title: 'Validators',
color: 'error',
icon: 'mdi-human-queue',
stats: String(
base?.latest?.block?.last_commit?.signatures.length || 0
),
stats: String(base?.latest?.block?.last_commit?.signatures.length || 0),
change: 0,
},
{
Expand Down Expand Up @@ -256,11 +261,7 @@ export const useIndexModule = defineStore('module-index', {
* @param value - The value to set for the parameter.
* @returns The new URL with the parameter added or replaced.
*/
export function addOrReplaceUrlParam(
url: string,
param: string,
value: string
): string {
export function addOrReplaceUrlParam(url: string, param: string, value: string): string {
// Parse the URL
const urlObj = new URL(url, window.location.origin);

Expand Down
Loading