Skip to content

Commit

Permalink
Add bridge actions to rollups
Browse files Browse the repository at this point in the history
  • Loading branch information
GusevPM committed Sep 10, 2024
1 parent bce64b2 commit f855e11
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 9 deletions.
2 changes: 1 addition & 1 deletion components/modules/rollup/RollupMetadata.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const showMore = ref(false)
</Flex>

<Flex align="center" :class="$style.item">
<Text size="13" weight="600" color="secondary" :class="$style.key">Actions Count</Text>
<Text size="13" weight="600" color="secondary" :class="$style.key"> {{ rollup.bridge_count > 0 ? 'Rollup ' : '' }} Actions Count </Text>

<Text size="13" weight="600" color="primary" mono :class="$style.value"> {{ rollup.actions_count }} </Text>
</Flex>
Expand Down
4 changes: 2 additions & 2 deletions components/sidebars/AccountSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ watch(

<Text size="13" weight="500" color="secondary"> Account </Text>

<Tooltip v-if="account.bridge">
<Icon name="bridge" size="18" color="brand" />
<Tooltip v-if="account.is_bridge">
<Icon name="bridge" size="16" color="brand" />

<template #content>
Bridge account
Expand Down
11 changes: 11 additions & 0 deletions components/tables/AccountsTable.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<script setup>
/** UI */
import Tooltip from "@/components/ui/Tooltip.vue"
/** Components */
import LinkToEntity from "@/components/shared/LinkToEntity.vue"
Expand Down Expand Up @@ -47,6 +50,14 @@ const props = defineProps({
<Icon name="account" size="16" color="secondary" />

<LinkToEntity :entity="{ title: midHash(account.hash), type: 'account', id: account.hash}" color="primary" />

<Tooltip v-if="account.is_bridge">
<Icon name="bridge" size="18" color="brand" />

<template #content>
Bridge account
</template>
</Tooltip>
</Flex>

<Flex align="center" gap="8">
Expand Down
2 changes: 0 additions & 2 deletions pages/accounts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ const getAccounts = async () => {
const page = ref(1)
const handleNextCondition = computed(() => lastHead.value.total_accounts - (limit.value * page.value) <= 0)
console.log(handleNextCondition.value);
const handleNext = () => {
page.value += 1
}
Expand Down
2 changes: 2 additions & 0 deletions pages/rollup/[hash].vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ const fetchActions = async () => {
const { data } = await fetchRollupActions({
hash: rollupHashSafeURL.value,
bridge_actions: true,
rollup_actions: true,
limit: limit.value,
offset: (page.value - 1) * limit.value,
sort: "desc",
Expand Down
8 changes: 6 additions & 2 deletions pages/rollups.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import RollupsTable from "@/components/tables/RollupsTable.vue"
/** API */
import { fetchRollups } from "@/services/api/rollup"
/** Store */
import { useAppStore } from "@/store/app"
const appStore = useAppStore()
definePageMeta({
layout: "default",
})
Expand Down Expand Up @@ -65,6 +69,7 @@ useHead({
const rollups = ref([])
const isLoading = ref(false)
const lastHead = computed(() => appStore.lastHead)
const limit = ref(15)
const getRollups = async () => {
Expand All @@ -75,14 +80,13 @@ const getRollups = async () => {
offset: (page.value - 1) * limit.value,
})
rollups.value = data.value
handleNextCondition.value = rollups.value.length < limit.value
isLoading.value = false
}
/** Pagination */
const page = ref(1)
const handleNextCondition = ref(true)
const handleNextCondition = computed(() => lastHead.value.total_rollups - (limit.value * page.value) <= 0)
const handleNext = () => {
page.value += 1
Expand Down
6 changes: 4 additions & 2 deletions services/api/rollup.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ export const fetchRollupByHash = async (hash) => {
}
}

export const fetchRollupActions = async ({hash, limit, offset, sort}) => {
export const fetchRollupActions = async ({hash, bridge_actions, rollup_actions, limit, offset, sort}) => {
try {
const url = new URL(`${useServerURL()}/rollup/${hash}/actions`)
const url = new URL(`${useServerURL()}/rollup/${hash}/all_actions`)

if (bridge_actions) url.searchParams.append("bridge_actions", bridge_actions)
if (rollup_actions) url.searchParams.append("rollup_actions", rollup_actions)
if (limit) url.searchParams.append("limit", limit)
if (offset) url.searchParams.append("offset", offset)
if (sort) url.searchParams.append("sort", sort)
Expand Down

0 comments on commit f855e11

Please sign in to comment.