add wallet

This commit is contained in:
liangping
2023-05-14 13:15:43 +08:00
parent eb79884c07
commit b195e72554
10 changed files with 95 additions and 14999 deletions
+15 -8
View File
@@ -45,10 +45,10 @@ const validators = computed(() => {
onMounted(() => {
live.value = true;
baseStore.fetchLatest().then((block) => {
latest.value = block;
commits.value.unshift(block.block.last_commit);
const height = Number(block.block.header?.height || 0);
baseStore.fetchLatest().then(b => {
latest.value = b;
commits.value.unshift(b.block.last_commit);
const height = Number(b.block.header?.height || 0);
if (height > 0) {
// constructs sequence for loading blocks
let promise = Promise.resolve();
@@ -57,7 +57,7 @@ onMounted(() => {
promise = promise.then(
() =>
new Promise((resolve, reject) => {
if (live.value) {
if (live.value && commits2.value.length < 50) {
// continue only if the page is living
baseStore.fetchBlock(i).then((x) => {
commits.value.unshift(x.block.last_commit);
@@ -78,10 +78,18 @@ onMounted(() => {
});
});
const commits2 = computed(() => {
const la = baseStore.recents.map(b => b.block.last_commit)
const all = [...commits.value, ...la]
return all.length > 50 ? all.slice(all.length - 50): all
})
onUnmounted(() => {
live.value = false;
});
watchEffect(() => {
local.value[chainStore.chainName] = selected.value;
localStorage.setItem('uptime-validators', JSON.stringify(local.value));
@@ -91,7 +99,6 @@ watchEffect(() => {
<template>
<div class="bg-base-100 px-5 pt-5">
<div class="flex items-center gap-x-4">
<div class="text-main text-lg">Current Height: {{ latest.block?.header?.height }}</div>
<input
type="text"
v-model="keyword"
@@ -131,7 +138,7 @@ watchEffect(() => {
?.missed_blocks_counter
}}
</div>
<div v-else class="mt-1 badge badge-sm text-white bg-yes">
<div v-else class="mt-1 badge badge-sm text-white bg-yes border-0">
{{
signingInfo[consensusPubkeyToHexAddress(v.consensus_pubkey)]
?.missed_blocks_counter
@@ -139,7 +146,7 @@ watchEffect(() => {
</div>
</div>
<UptimeBar
:blocks="commits"
:blocks="commits2"
:validator="
toBase64(fromHex(consensusPubkeyToHexAddress(v.consensus_pubkey)))
"
+15
View File
@@ -0,0 +1,15 @@
<script lang="ts" setup>
import { CosmosRestClient } from '@/libs/client';
async function tt() {
const address = 'echelon1uattqtrtv8944qkmh44ll97qjacj6tgrekqzm9';
const validator = 'echelonvaloper1uattqtrtv8944qkmh44ll97qjacj6tgr2cupk4';
const client = new CosmosRestClient('https://api.ech.network');
let response = await client.getBaseBlockLatest();
console.log('response:', response);
}
tt();
</script>
<template>
<div>Hello wallet</div>
</template>