Skip to content

Commit 81ff855

Browse files
committed
Add event types
1 parent 7ba625a commit 81ff855

File tree

2 files changed

+101
-14
lines changed

2 files changed

+101
-14
lines changed

components/modules/block/BlockOverview.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@ if (props.block.stats.tx_count) {
102102
activeTab.value = t
103103
}
104104
})
105+
if (!finded) {
106+
activeTab.value = "Other"
107+
}
105108
} else {
106109
activeTab.value = "Events"
107110
}

components/shared/tables/Events.vue

Lines changed: 98 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
11
<script setup>
2-
/** Vendor */
3-
import { DateTime } from "luxon"
4-
52
/** UI */
6-
import { Dropdown, DropdownItem } from "@/components/ui/Dropdown"
73
import Tooltip from "~/components/ui/Tooltip.vue"
84
import Button from "~/components/ui/Button.vue"
95
10-
/** Shared Components */
11-
import MessageTypeBadge from "@/components/shared/MessageTypeBadge.vue"
12-
import MessagesTable from "@/components/modules/tx/MessagesTable.vue"
13-
146
/** Services */
15-
import { comma, tia, splitAddress } from "@/services/utils"
7+
import { tia, splitAddress } from "@/services/utils"
168
179
/** API */
1810
import { fetchTxEvents } from "@/services/api/tx"
@@ -21,12 +13,8 @@ import { fetchBlockEvents } from "@/services/api/block"
2113
/** Store */
2214
import { useModalsStore } from "@/store/modals"
2315
import { useCacheStore } from "@/store/cache"
24-
import { useBookmarksStore } from "@/store/bookmarks"
25-
import { useNotificationsStore } from "@/store/notifications"
2616
const modalsStore = useModalsStore()
2717
const cacheStore = useCacheStore()
28-
const bookmarksStore = useBookmarksStore()
29-
const notificationsStore = useNotificationsStore()
3018
3119
const router = useRouter()
3220
@@ -50,6 +38,11 @@ const EventIconMapping = {
5038
withdraw_rewards: "coins",
5139
withdraw_commission: "tag",
5240
tx: "zap",
41+
proposer_reward: "coins_down",
42+
commission: "coins_down",
43+
rewards: "coins_down",
44+
mint: "coins_down",
45+
coinbase: "coins_down"
5346
}
5447
5548
const getEvents = async () => {
@@ -104,7 +97,6 @@ watch(
10497
getEvents()
10598
},
10699
)
107-
108100
</script>
109101

110102
<template>
@@ -381,6 +373,98 @@ watch(
381373
{{ tia(event.data.amount.replace("utia", "")) }} TIA
382374
</Text>
383375
</Flex>
376+
<!-- Event: proposer_reward -->
377+
<Flex v-else-if="event.type === 'proposer_reward'" align="center" gap="4" color="secondary" :class="$style.text">
378+
<Text size="12" weight="500" color="secondary">Proposer</Text>
379+
380+
<Tooltip :class="$style.tooltip">
381+
<NuxtLink :to="`/address/${event.data.validator}`" @click.stop>
382+
<Text size="12" weight="500" color="primary" mono>
383+
{{ splitAddress(event.data.validator) }}
384+
</Text>
385+
</NuxtLink>
386+
387+
<template #content>
388+
{{ event.data.validator }}
389+
</template>
390+
</Tooltip>
391+
392+
<Text size="12" weight="500" color="secondary">received rewards</Text>
393+
394+
<Text size="12" weight="500" color="primary" mono no-wrap>
395+
{{ event.data.amount ? tia(event.data.amount.replace("utia", "")) : 0 }} TIA
396+
</Text>
397+
</Flex>
398+
<!-- Event: rewards -->
399+
<Flex v-else-if="event.type === 'rewards'" align="center" gap="4" color="secondary" :class="$style.text">
400+
<Text size="12" weight="500" color="secondary">Validator</Text>
401+
402+
<Tooltip :class="$style.tooltip">
403+
<NuxtLink :to="`/address/${event.data.validator}`" @click.stop>
404+
<Text size="12" weight="500" color="primary" mono>
405+
{{ splitAddress(event.data.validator) }}
406+
</Text>
407+
</NuxtLink>
408+
409+
<template #content>
410+
{{ event.data.validator }}
411+
</template>
412+
</Tooltip>
413+
414+
<Text size="12" weight="500" color="secondary">received rewards</Text>
415+
416+
<Text size="12" weight="500" color="primary" mono no-wrap>
417+
{{ event.data.amount ? tia(event.data.amount.replace("utia", "")) : 0 }} TIA
418+
</Text>
419+
</Flex>
420+
<!-- Event: commission -->
421+
<Flex v-else-if="event.type === 'commission'" align="center" gap="4" color="secondary" :class="$style.text">
422+
<Tooltip :class="$style.tooltip">
423+
<NuxtLink :to="`/address/${event.data.validator}`" @click.stop>
424+
<Text size="12" weight="500" color="primary" mono>
425+
{{ splitAddress(event.data.validator) }}
426+
</Text>
427+
</NuxtLink>
428+
429+
<template #content>
430+
{{ event.data.validator }}
431+
</template>
432+
</Tooltip>
433+
434+
<Text size="12" weight="500" color="secondary">received commission of</Text>
435+
436+
<Text size="12" weight="500" color="primary" mono no-wrap>
437+
{{ event.data.amount ? tia(event.data.amount.replace("utia", "")) : 0 }} TIA
438+
</Text>
439+
</Flex>
440+
<!-- Event: coinbase -->
441+
<Flex v-else-if="event.type === 'coinbase'" align="center" gap="4" color="secondary" :class="$style.text">
442+
<Tooltip :class="$style.tooltip">
443+
<NuxtLink :to="`/address/${event.data.minter}`" @click.stop>
444+
<Text size="12" weight="500" color="primary" mono>
445+
{{ splitAddress(event.data.minter) }}
446+
</Text>
447+
</NuxtLink>
448+
449+
<template #content>
450+
{{ event.data.minter }}
451+
</template>
452+
</Tooltip>
453+
454+
<Text size="12" weight="500" color="secondary">received</Text>
455+
456+
<Text size="12" weight="500" color="primary" mono no-wrap>
457+
{{ event.data.amount ? tia(event.data.amount.replace("utia", "")) : 0 }} TIA
458+
</Text>
459+
</Flex>
460+
<!-- Event: mint -->
461+
<Flex v-else-if="event.type === 'mint'" align="center" gap="4" color="secondary" :class="$style.text">
462+
<Text size="12" weight="500" color="primary" mono no-wrap>
463+
{{ event.data.amount ? tia(event.data.amount.replace("utia", "")) : 0 }} TIA</Text
464+
>
465+
466+
<Text size="12" weight="500" color="secondary">was minted</Text>
467+
</Flex>
384468

385469
<Text size="12" weight="600" color="tertiary" mono>
386470
{{ event.type }}

0 commit comments

Comments
 (0)