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
23 changes: 4 additions & 19 deletions components/data/LatestPFBTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,16 @@ import { useServerURL } from "@/services/config"
import { comma, space, splitAddress, tia } from "@/services/utils"

/** API */
// import { fetchLatestPFBs } from "@/services/api/tx"
import { fetchLatestPFBs } from "@/services/api/tx"

const router = useRouter()

const isLoading = ref(true)
const pfbs = ref([])

const fetchLatestPFBs = async (height) => {
try {
return await $fetch(`${useServerURL()}/tx?msg_type=MsgPayForBlobs&sort=desc&limit=5`)
} catch (error) {
console.error(error)
}
}

// pfbs.value = await fetchLatestPFBs()
// pfbs.value = data.value

onBeforeMount(async() => {
isLoading.value = true

pfbs.value = await fetchLatestPFBs()

isLoading.value = false
})
const { data } = await fetchLatestPFBs()
pfbs.value = data.value
isLoading.value = false

</script>

Expand Down
28 changes: 4 additions & 24 deletions components/data/RecentNamespacesTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { useServerURL } from "@/services/config"
import { comma, space, formatBytes, getNamespaceID } from "@/services/utils"

/** API */
// import { fetchNamespaces } from "@/services/api/namespace"
import { fetchNamespaces } from "@/services/api/namespace"

const router = useRouter()

Expand All @@ -24,36 +24,16 @@ const sort = reactive({
dir: "desc",
})

const fetchNamespaces = async ({ limit, offset, sort, sort_by }) => {
try {
const url = new URL(`${useServerURL()}/namespace`)

if (limit) url.searchParams.append("limit", limit)
if (offset) url.searchParams.append("offset", offset)
if (sort) url.searchParams.append("sort", sort)
if (sort_by) url.searchParams.append("sort_by", sort_by)


return await $fetch(url.href)
} catch (error) {
console.error(error)
}
}

const getNamespaces = async () => {
isLoading.value = true

namespaces.value = await fetchNamespaces({ limit: 5, sort: sort.dir, sort_by: sort.by })
// namespaces.value = data.value
const { data } = await fetchNamespaces({ limit: 5, sort: sort.dir, sort_by: sort.by })
namespaces.value = data.value

isLoading.value = false
}

// await getNamespaces()

onBeforeMount(async() => {
await getNamespaces()
})
await getNamespaces()

const handleSort = async (by) => {
switch (sort.dir) {
Expand Down
30 changes: 8 additions & 22 deletions components/widgets/StakingWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useServerURL } from "@/services/config"
import { abbreviate, capitilize, numToPercent, shareOfTotal } from "@/services/utils"

/** API */
// import { fetchValidatorsCount } from "@/services/api/validator"
import { fetchValidatorsCount } from "@/services/api/validator"

/** Store */
import { useAppStore } from "@/store/app"
Expand All @@ -27,7 +27,7 @@ const totalVotingPowerUSD = computed(() => totalVotingPower.value * currentPrice

const bondedShare = computed(() => shareOfTotal(lastHead?.value.total_voting_power * 1_000_000, lastHead?.value.total_supply, 2))

const isRefetching = ref(false)
const isRefetching = ref(true)
const totalValidators = ref(0)
const activeValidators = ref(0)
const validatorsGraph = ref([
Expand All @@ -51,26 +51,16 @@ const validatorsGraph = ref([
},
])

const fetchValidatorsCount = async () => {
try {
const url = new URL(`${useServerURL()}/validators/count`)

return await $fetch(url.href)
} catch (error) {
console.error(error)
}
}

const getValidatorsStats = async () => {
isRefetching.value = true

const data = await fetchValidatorsCount()
if (data?.total) {
totalValidators.value = data.total
activeValidators.value = data.active
const { data } = await fetchValidatorsCount()
if (data.value?.total) {
totalValidators.value = data.value.total
activeValidators.value = data.value.active

for (let item of validatorsGraph.value) {
let value = data[item.title]
let value = data.value[item.title]

if (value) {
item.count = value
Expand All @@ -82,11 +72,7 @@ const getValidatorsStats = async () => {
isRefetching.value = false
}

// await getValidatorsStats()

onBeforeMount(async() => {
await getValidatorsStats()
})
await getValidatorsStats()

onMounted( async () => {
wrapperWidth.value = wrapperEl.value.wrapper.offsetWidth
Expand Down
2 changes: 1 addition & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export default defineNuxtConfig({
plugins: [wasm(), topLevelAwait(), nodePolyfills()],
worker: {
format: "es",
plugins: [wasm(), topLevelAwait()],
plugins: () => [wasm(), topLevelAwait()],
},
},
})
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"packageManager": "[email protected]",
"homepage": "https://celenium.io/",
"license": "MIT",
"type": "module",
"scripts": {
"build": "nuxt build",
"dev": "cross-env PORT=9090 nuxt dev",
Expand Down
4 changes: 2 additions & 2 deletions pages/blobstream.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ const handleViewCommitment = (commitment) => {
modalsStore.open("commitment")
}

getNetworks()
getCommitments()
await getNetworks()
await getCommitments()
</script>

<template>
Expand Down
20 changes: 9 additions & 11 deletions pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,18 @@ onBeforeMount(async () => {
</script>

<template>
<!-- <ClientOnly> -->
<Flex direction="column" wide :class="$style.wrapper">
<Widgets :class="$style.widgets" />
<Flex direction="column" wide :class="$style.wrapper">
<Widgets :class="$style.widgets" />

<Flex direction="column" gap="40" :class="$style.main">
<Flex gap="20" :class="$style.small_tables">
<RecentNamespacesTable />
<LatestPFBTable />
</Flex>

<BlocksTimelineTable v-if="appStore.lastHead && appStore.latestBlocks.length" />
<Flex direction="column" gap="40" :class="$style.main">
<Flex gap="20" :class="$style.small_tables">
<RecentNamespacesTable />
<LatestPFBTable />
</Flex>

<BlocksTimelineTable v-if="appStore.lastHead && appStore.latestBlocks.length" />
</Flex>
<!-- </ClientOnly> -->
</Flex>
</template>

<style module>
Expand Down
9 changes: 7 additions & 2 deletions pages/txs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,10 @@ const getTransactions = async () => {
from: filters.from,
to: filters.to,
})

transactions.value = data.value

handleNextCondition.value = transactions.value.length < limit.value
handleNextCondition.value = transactions.value?.length < limit.value
isLoaded.value = true
isRefetching.value = false
}
Expand All @@ -325,6 +326,10 @@ onBeforeMount(() => {
}
})

// onMounted(() => {
// getTransactions()
// })

/** Refetch transactions */
watch(
() => route.query,
Expand Down Expand Up @@ -585,7 +590,7 @@ const handleNext = () => {
</Flex>

<Flex direction="column" gap="16" wide :class="[$style.table, isRefetching && $style.disabled]">
<div v-if="transactions.length" :class="$style.table_scroller">
<div v-if="transactions?.length" :class="$style.table_scroller">
<table>
<thead>
<tr>
Expand Down
Loading