Skip to content

Commit 0642872

Browse files
committed
Fix rollups fetching
1 parent f6d442b commit 0642872

File tree

7 files changed

+26
-14
lines changed

7 files changed

+26
-14
lines changed

components/modules/address/AddressCharts.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ const seriesConfig = [
7575
series: feeSeries,
7676
title: "Fee Spent",
7777
tooltipLabel: "Spent",
78-
yAxisFormatter: (val) => (tia(val, 0) > 1 ? tia(val, 0) : tia(val, 2)),
79-
tooltipValueFormatter: (val) => tia(val),
78+
yAxisFormatter: (val) => `${(tia(val, 0) > 1 ? tia(val, 0) : tia(val, 2))} TIA`,
79+
tooltipValueFormatter: (val) => `${tia(val)} TIA`,
8080
},
8181
]
8282

components/modules/rollup/RollupCharts.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ const seriesConfig = [
101101
series: feeSeries,
102102
title: "Fee spent",
103103
tooltipLabel: "Spent",
104-
yAxisFormatter: (val) => tia(val, 1),
105-
tooltipValueFormatter: tia,
104+
yAxisFormatter: (val) => `${tia(val, 1)} TIA`,
105+
tooltipValueFormatter: (val) => `${tia(val)} TIA`,
106106
},
107107
{
108108
name: "tvl",

pages/faucet.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ onMounted(() => {
385385
</Text>
386386
387387
<Text size="13" weight="400" color="secondary">
388-
{{ tia(account?.balance?.spendable || 0, 2) }} TIA
388+
{{ tia(account?.balance?.spendable, 2) }} TIA
389389
</Text>
390390
</Flex>
391391

pages/rollups/index.vue

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,18 +280,29 @@ const itemsPerPage = 20
280280
const limit = ref(100)
281281
282282
const getRollups = async () => {
283-
const data = await fetchRollups({ limit: limit.value })
283+
const [data, rankingData] = await Promise.all([
284+
fetchRollups({ limit: limit.value }).catch(err => {
285+
console.error("fetchRollups", err)
286+
return []
287+
}),
288+
showRanking.value
289+
? fetchRollupsRanking({ limit: limit.value }).catch(err => {
290+
console.error("fetchRollupsRanking", err)
291+
return []
292+
})
293+
: Promise.resolve([]),
294+
])
295+
284296
rollups.value = data
285297
286298
if (showRanking.value) {
287299
let ranking = {}
288-
const ranking_data = await fetchRollupsRanking({ limit: limit.value })
289-
if (ranking_data?.length) {
290-
ranking_data.forEach(rank => {
300+
if (rankingData?.length) {
301+
rankingData.forEach(rank => {
291302
ranking[rank.slug] = rank
292303
})
293-
294-
if (data.length) {
304+
305+
if (data?.length) {
295306
rollups.value = data.map((r) => {
296307
const rank = ranking[r.slug]
297308
if (!rank) return r

services/api/rollup.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ export const fetchRollupsRanking = async ({ limit, offset, sort_by, sort }) => {
199199
if (offset) url.searchParams.append("offset", offset)
200200
if (sort_by) url.searchParams.append("sort_by", sort_by)
201201
if (sort) url.searchParams.append("sort", sort)
202-
202+
203203
const data = await $fetch(url.href)
204204
return data
205205
} catch (error) {

services/utils/amounts.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export const truncate = (num) => {
5757
export const tia = (amount, decimal = 6) => {
5858
if (!amount || !parseInt(amount)) return 0
5959

60-
return truncateDecimalPart(parseInt(amount) / 1_000_000, decimal) + " TIA"
60+
return truncateDecimalPart(parseInt(amount) / 1_000_000, decimal)
6161
}
6262

6363
export const utia = (amount) => {

services/utils/general.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ export const getNetworkName = () => {
142142
}
143143

144144
export const isMainnet = () => {
145-
return getNetworkName() === "Mainnet" || isSelfhosted()
145+
return true
146+
// return getNetworkName() === "Mainnet" || isSelfhosted()
146147
}
147148

148149
export const isMac = () => {

0 commit comments

Comments
 (0)