forked from cerc-io/cosmos-explorer
Compare commits
No commits in common. "master" and "pj-rebase-new-changes" have entirely different histories.
master
...
pj-rebase-
@ -1,33 +0,0 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master, dev]
|
||||
paths:
|
||||
- 'src/**'
|
||||
pull_request:
|
||||
branches: [master, dev]
|
||||
paths:
|
||||
- 'src/**'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20.x'
|
||||
|
||||
- name: Enable corepack and yarn
|
||||
run: corepack enable
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install --frozen-lockfile
|
||||
|
||||
- name: Build project
|
||||
run: yarn build
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ping.pub",
|
||||
"version": "3.0.1-zenith-0.2.1",
|
||||
"version": "3.0.0-zenith-0.1.1",
|
||||
"private": true,
|
||||
"target": "",
|
||||
"scripts": {
|
||||
|
||||
@ -46,12 +46,7 @@ const chain = useBlockchain();
|
||||
<tr v-for="item in txs">
|
||||
<td>{{ item.injected }}</td>
|
||||
<td>
|
||||
<RouterLink
|
||||
v-if="item.injected === 'Injected'"
|
||||
:to="`/${chain.chainName}/tx/${item.hash}?type=injected`"
|
||||
class="text-primary dark:invert">
|
||||
{{ item.hash }}
|
||||
</RouterLink>
|
||||
<span v-if="item.injected === 'Injected'">{{ item.hash }}</span>
|
||||
<RouterLink v-else :to="`/${chain.chainName}/tx/${item.hash}`" class="text-primary dark:invert">{{
|
||||
item.hash
|
||||
}}</RouterLink>
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.05 12.623A15.378 15.378 0 0 0 8.57 1.714C8.573 1.136 8.54.564 8.477 0H0v16.287c0 1.974.752 3.949 2.258 5.454A7.69 7.69 0 0 0 7.714 24L24 24v-8.477a15.636 15.636 0 0 0-1.715-.095c-4.258 0-8.115 1.73-10.908 4.523-2.032 1.981-5.291 1.982-7.299-.026-2.006-2.006-2.007-5.266-.029-7.302Zm18.192-10.86a6.004 6.004 0 0 0-8.485 0 6.003 6.003 0 0 0 0 8.484 6.003 6.003 0 0 0 8.485 0 6.002 6.002 0 0 0 0-8.485Z" fill="var(--color-white)"></path>
|
||||
</svg>
|
||||
<div class="text-sm capitalize flex-1 text-gray-600 dark:text-gray-200">
|
||||
Zenith Network
|
||||
Laconic Network
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@ -185,14 +185,13 @@ export const useIndexModule = defineStore('module-index', {
|
||||
}),
|
||||
change: 0,
|
||||
},
|
||||
// Only show Inflation if mint module is enabled
|
||||
...(mintStore.mintModuleEnabled ? [{
|
||||
{
|
||||
title: 'Inflation',
|
||||
color: 'success',
|
||||
icon: 'mdi-chart-multiple',
|
||||
stats: formatter.formatDecimalToPercent(mintStore.inflation),
|
||||
change: 0,
|
||||
}] : []),
|
||||
},
|
||||
{
|
||||
title: 'Community Pool',
|
||||
color: 'primary',
|
||||
|
||||
@ -1,78 +1,27 @@
|
||||
<script lang="ts" setup>
|
||||
import { onMounted } from 'vue';
|
||||
import { useRoute } from 'vue-router';
|
||||
import { JsonViewer } from 'vue3-json-viewer';
|
||||
import { useBaseStore, useBlockchain, useFormatter } from '@/stores';
|
||||
import DynamicComponent from '@/components/dynamic/DynamicComponent.vue';
|
||||
import { computed, ref } from '@vue/reactivity';
|
||||
import type { Tx, TxResponse } from '@/types';
|
||||
|
||||
import { JsonViewer } from 'vue3-json-viewer';
|
||||
// if you used v1.0.5 or latster ,you should add import "vue3-json-viewer/dist/index.css"
|
||||
import 'vue3-json-viewer/dist/index.css';
|
||||
|
||||
const props = defineProps(['hash', 'chain']);
|
||||
const route = useRoute();
|
||||
|
||||
const blockchain = useBlockchain();
|
||||
const baseStore = useBaseStore();
|
||||
const chainStore = useBlockchain();
|
||||
const format = useFormatter();
|
||||
const rpcList = ref(chainStore.current?.endpoints?.rpc || [{ address: '', provider: '' }]);
|
||||
let rpc = ref('');
|
||||
const tx = ref(
|
||||
{} as {
|
||||
tx: Tx;
|
||||
tx_response: TxResponse;
|
||||
}
|
||||
);
|
||||
const voteExtension = ref(null as any);
|
||||
const bundleTx = ref(null as any);
|
||||
|
||||
const isInjected = computed(() => route.query.type === 'injected');
|
||||
|
||||
onMounted(async () => {
|
||||
rpc.value = rpcList.value[0].address;
|
||||
|
||||
if (props.hash) {
|
||||
if (isInjected.value) {
|
||||
getTxFromRPC(props.hash).then((data) => {
|
||||
if (data.result) {
|
||||
const txBytes = new Uint8Array(atob(data.result.tx).split('').map((c: string) => c.charCodeAt(0)));
|
||||
const decoded = new TextDecoder().decode(txBytes);
|
||||
|
||||
// Check if it's a bundle tx
|
||||
if (decoded.startsWith('INCLUDE_BUNDLE_TX:')) {
|
||||
const bundleJson = decoded.replace('INCLUDE_BUNDLE_TX:', '');
|
||||
bundleTx.value = {
|
||||
...data.result,
|
||||
decoded: JSON.parse(bundleJson)
|
||||
};
|
||||
} else {
|
||||
// It's a vote extension
|
||||
voteExtension.value = {
|
||||
...data.result,
|
||||
decoded: JSON.parse(decoded)
|
||||
};
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
blockchain.rpc.getTx(props.hash).then((x) => (tx.value = x));
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
async function getTxFromRPC(hash: string) {
|
||||
const response = await fetch(rpc.value + `/tx?hash=0x${hash}`);
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP error: ${response.status}`);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
return data;
|
||||
if (props.hash) {
|
||||
blockchain.rpc.getTx(props.hash).then((x) => (tx.value = x));
|
||||
}
|
||||
|
||||
const messages = computed(() => {
|
||||
return (
|
||||
tx.value.tx?.body?.messages.map((x) => {
|
||||
@ -84,22 +33,6 @@ const messages = computed(() => {
|
||||
}) || []
|
||||
);
|
||||
});
|
||||
|
||||
const jsonData = computed(() => {
|
||||
if (tx.value.tx_response) {
|
||||
return tx.value;
|
||||
}
|
||||
|
||||
if (voteExtension.value) {
|
||||
return voteExtension.value.decoded
|
||||
}
|
||||
|
||||
if (bundleTx.value) {
|
||||
return bundleTx.value.decoded
|
||||
}
|
||||
|
||||
return undefined;
|
||||
});
|
||||
</script>
|
||||
<template>
|
||||
<div>
|
||||
@ -111,50 +44,6 @@ const jsonData = computed(() => {
|
||||
<a class="tab text-gray-400 uppercase tab-active">Transaction</a>
|
||||
</div>
|
||||
|
||||
<div v-if="bundleTx" class="bg-base-100 px-4 pt-3 pb-4 rounded shadow mb-4">
|
||||
<h2 class="card-title truncate mb-2">Bundle Transaction</h2>
|
||||
<div class="overflow-hidden">
|
||||
<table class="table text-sm">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Tx Hash</td>
|
||||
<td class="overflow-hidden">{{ bundleTx.hash }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Height</td>
|
||||
<td>
|
||||
<RouterLink :to="`/${props.chain}/block/${bundleTx.height}`" class="text-primary dark:invert"
|
||||
>{{ bundleTx.height }}
|
||||
</RouterLink>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="voteExtension" class="bg-base-100 px-4 pt-3 pb-4 rounded shadow mb-4">
|
||||
<h2 class="card-title truncate mb-2">Vote Extension</h2>
|
||||
<div class="overflow-hidden">
|
||||
<table class="table text-sm">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Tx Hash</td>
|
||||
<td class="overflow-hidden">{{ voteExtension.hash }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Height</td>
|
||||
<td>
|
||||
<RouterLink :to="`/${props.chain}/block/${voteExtension.height}`" class="text-primary dark:invert"
|
||||
>{{ voteExtension.height }}
|
||||
</RouterLink>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="tx.tx_response" class="bg-base-100 px-4 pt-3 pb-4 rounded shadow mb-4">
|
||||
<h2 class="card-title truncate mb-2">{{ $t('tx.title') }}</h2>
|
||||
<div class="overflow-hidden">
|
||||
@ -227,16 +116,16 @@ const jsonData = computed(() => {
|
||||
<div v-if="messages.length === 0">{{ $t('tx.no_messages') }}</div>
|
||||
</div>
|
||||
|
||||
<div v-if="jsonData" class="bg-base-100 px-4 pt-3 pb-4 rounded shadow">
|
||||
<div v-if="tx.tx_response" class="bg-base-100 px-4 pt-3 pb-4 rounded shadow">
|
||||
<h2 class="card-title truncate mb-2">JSON</h2>
|
||||
<JsonViewer
|
||||
:value="jsonData"
|
||||
:value="tx"
|
||||
:theme="baseStore.theme"
|
||||
style="background: transparent"
|
||||
copyable
|
||||
boxed
|
||||
sort
|
||||
:expand-depth="5"
|
||||
expand-depth="5"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
"links": "Links"
|
||||
},
|
||||
"pages": {
|
||||
"title": "Zenith Dashboard",
|
||||
"title": "Ping Dashboard",
|
||||
"title_all": "404",
|
||||
"tag": "Beta",
|
||||
"tag_all": "Seite nicht gefunden",
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
"links": "Tautan"
|
||||
},
|
||||
"pages": {
|
||||
"title": "Zenith Explorer",
|
||||
"title": "Laconic Explorer",
|
||||
"title_all": "404",
|
||||
"tag": "Beta",
|
||||
"tag_all": "Halaman Tidak Ditemukan",
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
"links": "リンク"
|
||||
},
|
||||
"pages": {
|
||||
"title": "Zenith ダッシュボード",
|
||||
"title": "Ping ダッシュボード",
|
||||
"title_all": "404",
|
||||
"tag": "ベータ",
|
||||
"tag_all": "ページが見つかりません",
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
"links": "링크"
|
||||
},
|
||||
"pages": {
|
||||
"title": "제니스 대시보드",
|
||||
"title": "핑 대시보드",
|
||||
"title_all": "404",
|
||||
"tag": "베타",
|
||||
"tag_all": "페이지를 찾을 수 없습니다",
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
"links": "链接"
|
||||
},
|
||||
"pages": {
|
||||
"title": "Zenith Explorer",
|
||||
"title": "Laconic Explorer",
|
||||
"slogan": "Ping Dashboard 是一个区块链浏览器,也是一个网页钱包,还有更多 ... 🛠",
|
||||
"description": "Cosmos Ecosystem Blockchains 🚀",
|
||||
"search_placeholder": "搜索区块链",
|
||||
|
||||
@ -5,7 +5,6 @@ export const useMintStore = defineStore('mintStore', {
|
||||
state: () => {
|
||||
return {
|
||||
inflation: '0',
|
||||
mintModuleEnabled: false,
|
||||
};
|
||||
},
|
||||
getters: {
|
||||
@ -19,19 +18,14 @@ export const useMintStore = defineStore('mintStore', {
|
||||
},
|
||||
async fetchInflation() {
|
||||
try {
|
||||
const res = await this.blockchain?.rpc?.getMintInflation();
|
||||
const res = await this.blockchain?.rpc?.getMintInflation().catch(() => {
|
||||
this.inflation = '0';
|
||||
});
|
||||
if (res) {
|
||||
this.inflation = res.inflation;
|
||||
this.mintModuleEnabled = true;
|
||||
}
|
||||
} catch (e: any) {
|
||||
// Check if module is not implemented/enabled
|
||||
if (e?.status === 501) {
|
||||
// Module not enabled
|
||||
this.mintModuleEnabled = false;
|
||||
} else {
|
||||
console.error(e);
|
||||
}
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user