forked from cerc-io/cosmos-explorer
feat: merge
This commit is contained in:
commit
d18639204c
14982
package-lock.json
generated
14982
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -184,7 +184,6 @@ const changeOpen = (index: Number) => {
|
||||
<div class="flex-1 w-0"></div>
|
||||
|
||||
<!-- <NavSearchBar />-->
|
||||
<NavBarNotifications class="hidden md:inline-block" />
|
||||
<NavBarI18n class="hidden md:inline-block" />
|
||||
<NavbarThemeSwitcher class="hidden md:inline-block" />
|
||||
|
||||
|
@ -9,10 +9,24 @@ walletStore.$subscribe((m, s) => {
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<span v-if="walletStore.currentAddress">{{
|
||||
walletStore.currentAddress
|
||||
}}</span>
|
||||
|
||||
<div v-if="walletStore.currentAddress"
|
||||
class="dropdown dropdown-hover ping-connect-dropdown"
|
||||
>
|
||||
<label tabindex="3" class="btn m-1" >{{ walletStore.shortAddress }}</label>
|
||||
<ul
|
||||
tabindex="3"
|
||||
class="dropdown-content menu p-2 shadow bg-base-100 rounded-box w-52"
|
||||
>
|
||||
<li>
|
||||
<a>{{ walletStore.connectedWallet }}</a>
|
||||
</li>
|
||||
<li>
|
||||
<a>{{ walletStore.currentAddress }}</a>
|
||||
</li>
|
||||
<div class="divider"></div>
|
||||
<li><a @click="walletStore.disconnect()">Disconnected</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<label
|
||||
v-else
|
||||
for="PingConnectWallet"
|
||||
|
@ -26,6 +26,9 @@ export class BaseRestClient<R extends AbstractRegistry> {
|
||||
}
|
||||
|
||||
export class CosmosRestClient extends BaseRestClient<RequestRegistry> {
|
||||
constructor(endpoint: string) {
|
||||
super(endpoint, DEFAULT)
|
||||
}
|
||||
// Auth Module
|
||||
async getAuthAccounts() {
|
||||
return this.request(this.registry.auth_accounts, {});
|
||||
|
@ -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,9 +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"
|
||||
@ -136,7 +141,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
|
||||
@ -144,7 +149,7 @@ watchEffect(() => {
|
||||
</div>
|
||||
</div>
|
||||
<UptimeBar
|
||||
:blocks="commits"
|
||||
:blocks="commits2"
|
||||
:validator="
|
||||
toBase64(fromHex(consensusPubkeyToHexAddress(v.consensus_pubkey)))
|
||||
"
|
||||
|
15
src/modules/wallet/portfollio.vue
Normal file
15
src/modules/wallet/portfollio.vue
Normal 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>
|
@ -71,6 +71,13 @@ export const useWalletStore = defineStore('walletStore', {
|
||||
const chainStore = useBlockchain();
|
||||
return toBech32(chainStore.current?.bech32Prefix || prefix, data);
|
||||
},
|
||||
shortAddress() {
|
||||
const address: string = this.currentAddress
|
||||
if(address.length > 4) {
|
||||
return `${address.substring(address.length -4)}`
|
||||
}
|
||||
return ""
|
||||
}
|
||||
},
|
||||
actions: {
|
||||
async loadMyAsset() {
|
||||
@ -105,5 +112,12 @@ export const useWalletStore = defineStore('walletStore', {
|
||||
this.currentAddress
|
||||
);
|
||||
},
|
||||
disconnect() {
|
||||
const chainStore = useBlockchain();
|
||||
const key = chainStore.defaultHDPath;
|
||||
|
||||
localStorage.removeItem(key);
|
||||
this.$reset()
|
||||
}
|
||||
},
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user