From 52f33bee2a6465938a1b70902825e83822c502a9 Mon Sep 17 00:00:00 2001 From: GussevPM Date: Thu, 17 Oct 2024 21:13:50 +0200 Subject: [PATCH 1/4] Change config for dusk-11 --- services/config.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/config.js b/services/config.js index 753524c..e681fcc 100644 --- a/services/config.js +++ b/services/config.js @@ -1,13 +1,13 @@ export const Server = { API: { - mainnet: "https://api-dusk.astrotrek.io/v1", + mainnet: "https://api-dusk-11.astrotrek.io/v1", dawn: "https://api-dawn-0.astrotrek.io/v1", - dev: process.env.API_DEV || "https://api-dusk.astrotrek.io/v1", + dev: process.env.API_DEV || "https://api-dusk-11.astrotrek.io/v1", }, WSS: { - mainnet: "wss://api-dusk.astrotrek.io/v1/ws", + mainnet: "wss://api-dusk-11.astrotrek.io/v1/ws", dawn: "wss://api-dawn-0.astrotrek.io/v1/ws", - dev: process.env.WSS_DEV || "wss://api-dusk.astrotrek.io/v1/ws", + dev: process.env.WSS_DEV || "wss://api-dusk-11.astrotrek.io/v1/ws", }, } From 7d3ba66d4cd2d7219f1a875a24c7bee418ce230d Mon Sep 17 00:00:00 2001 From: GussevPM Date: Fri, 18 Oct 2024 01:00:29 +0200 Subject: [PATCH 2/4] Handle data submission actions --- components/tables/AccountsTable.vue | 2 +- components/tables/ActionsTable.vue | 2 +- pages/account/[hash].vue | 2 -- services/constants/index.js | 2 +- services/utils/actions.js | 2 +- 5 files changed, 4 insertions(+), 6 deletions(-) diff --git a/components/tables/AccountsTable.vue b/components/tables/AccountsTable.vue index 250c2c9..de5a27b 100644 --- a/components/tables/AccountsTable.vue +++ b/components/tables/AccountsTable.vue @@ -63,7 +63,7 @@ const props = defineProps({ Balance - {{ `${spaces(account.balances[0]?.value)}${account.balances.length ? account.balances[0]?.currency.toUpperCase() : ''}` }} + {{ `${spaces(account.balances[0]?.value)}${account.balances.length ? ' ' + account.balances[0]?.currency.toUpperCase() : ''}` }}
diff --git a/components/tables/ActionsTable.vue b/components/tables/ActionsTable.vue index fe9838a..3839852 100644 --- a/components/tables/ActionsTable.vue +++ b/components/tables/ActionsTable.vue @@ -62,7 +62,7 @@ const handleOpenTx = async (action) => { - + {{ `Pushed ${getActionDataLength(act)} to` }} diff --git a/pages/account/[hash].vue b/pages/account/[hash].vue index e38ca47..37d95c5 100644 --- a/pages/account/[hash].vue +++ b/pages/account/[hash].vue @@ -240,8 +240,6 @@ watch( watch( () => page.value, async () => { - // console.log('isUpdatingPaage.value', isUpdatingPaage.value); - if (isUpdatingPaage.value) return await fetchData() diff --git a/services/constants/index.js b/services/constants/index.js index da1a290..8a285d5 100644 --- a/services/constants/index.js +++ b/services/constants/index.js @@ -1,5 +1,5 @@ export const ActionIconMap = { - sequence: "sequence", + rollup_data_submission: "sequence", transfer: "transfer", } diff --git a/services/utils/actions.js b/services/utils/actions.js index 9dc3497..4ec226f 100644 --- a/services/utils/actions.js +++ b/services/utils/actions.js @@ -28,7 +28,7 @@ export const getActionDescription = (action) => { let description = "" let data = action.data switch (action.type) { - case "sequence": + case "rollup_data_submission": description = `Pushed ${formatBytes(base64Decode(data.data).length)} to ${data.rollup_id}` break; case "transfer": From 9f45fa6db5c38844a6c5de161c24a7b93628ebfc Mon Sep 17 00:00:00 2001 From: GussevPM Date: Fri, 18 Oct 2024 16:58:15 +0200 Subject: [PATCH 3/4] Add bridge deposits --- components/SearchField.vue | 20 +- .../modules/account/AccountDeposits.vue | 35 ++++ components/modules/rollup/RollupDeposits.vue | 35 ++++ components/tables/ActionsTable.vue | 2 +- components/tables/DepositsTable.vue | 185 ++++++++++++++++++ pages/account/[hash].vue | 54 +++-- pages/rollup/[hash].vue | 32 ++- services/api/account.js | 15 ++ services/api/rollup.js | 14 ++ 9 files changed, 357 insertions(+), 35 deletions(-) create mode 100644 components/modules/account/AccountDeposits.vue create mode 100644 components/modules/rollup/RollupDeposits.vue create mode 100644 components/tables/DepositsTable.vue diff --git a/components/SearchField.vue b/components/SearchField.vue index 5d7f3d6..dec1ad5 100644 --- a/components/SearchField.vue +++ b/components/SearchField.vue @@ -116,6 +116,8 @@ const handleSaveToHistory = (target) => { } const getResultPath = (result) => { + if (!result) return + switch (result.type) { case "address": return `/account/${result.body.hash}` @@ -133,29 +135,13 @@ const getResultPath = (result) => { } } -const getItemLink = (item) => { - switch (item.type) { - case "address": - return `/account/${result.body.hash}` - case "block": - return `/block/${result.body.height}` - case "validator": - return `/validator/${result.body.id}` - case "bridge": - return `/account/${result.body.address}` - - default: - return `/${item.type === 'address' ? 'account' : item.type}/${item.body.hash}` - } -} - const onKeydown = (e) => { if (e.code === "Escape") { show.value = false inputEl.value.blur() } - if (e.code === "Enter") { + if (e.code === "Enter" && results.value.length) { const target = results.value[0] router.push(getResultPath(target)) diff --git a/components/modules/account/AccountDeposits.vue b/components/modules/account/AccountDeposits.vue new file mode 100644 index 0000000..980cf8b --- /dev/null +++ b/components/modules/account/AccountDeposits.vue @@ -0,0 +1,35 @@ + + + + + diff --git a/components/modules/rollup/RollupDeposits.vue b/components/modules/rollup/RollupDeposits.vue new file mode 100644 index 0000000..da55cbb --- /dev/null +++ b/components/modules/rollup/RollupDeposits.vue @@ -0,0 +1,35 @@ + + + + + diff --git a/components/tables/ActionsTable.vue b/components/tables/ActionsTable.vue index 3839852..50ca5d0 100644 --- a/components/tables/ActionsTable.vue +++ b/components/tables/ActionsTable.vue @@ -297,7 +297,7 @@ const handleOpenTx = async (action) => { Block - +
diff --git a/components/tables/DepositsTable.vue b/components/tables/DepositsTable.vue new file mode 100644 index 0000000..128717c --- /dev/null +++ b/components/tables/DepositsTable.vue @@ -0,0 +1,185 @@ + + + + + diff --git a/pages/account/[hash].vue b/pages/account/[hash].vue index 37d95c5..bf64966 100644 --- a/pages/account/[hash].vue +++ b/pages/account/[hash].vue @@ -3,12 +3,13 @@ import { shortHash } from "~/services/utils" /** Modules */ +import AccountActions from "~/components/modules/account/AccountActions.vue" import AccountBridgeInfo from "~/components/modules/account/AccountBridgeInfo.vue" import AccountBridgeRoles from "~/components/modules/account/AccountBridgeRoles.vue" +import AccountDeposits from "~/components/modules/account/AccountDeposits.vue" import AccountMetadata from "~/components/modules/account/AccountMetadata.vue" -import AccountTransactions from "~/components/modules/account/AccountTransactions.vue" -import AccountActions from "~/components/modules/account/AccountActions.vue" import AccountRollups from "~/components/modules/account/AccountRollups.vue" +import AccountTransactions from "~/components/modules/account/AccountTransactions.vue" /** Components */ import RawDataView from "@/components/shared/RawDataView.vue" @@ -21,7 +22,7 @@ import Tooltip from "~/components/ui/Tooltip.vue" import { capitalizeAndReplaceUnderscore } from "~/services/utils" /** API */ -import { fetchAccountActions, fetchAccountBridgeRoles, fetchAccountByHash, fetchAccountRollups, fetchAccountTransactions } from "~/services/api/account.js" +import { fetchAccountActions, fetchAccountBridgeRoles, fetchAccountByHash, fetchAccountDeposits, fetchAccountRollups, fetchAccountTransactions } from "~/services/api/account.js" definePageMeta({ layout: "default", @@ -31,10 +32,12 @@ const route = useRoute() const router = useRouter() const account = ref() -const txs = ref([]) const actions = ref([]) -const rollups = ref([]) const bridgeRoles = ref([]) +const deposits = ref([]) +const rollups = ref([]) +const txs = ref([]) + const isLoading = ref(false) const { data } = await fetchAccountByHash(route.params.hash) @@ -127,6 +130,21 @@ const fetchBridgeRoles = async () => { isLoading.value = false } +const fetchDeposits = async () => { + isLoading.value = true + + const { data } = await fetchAccountDeposits({ + hash: account.value?.hash, + limit: limit.value, + offset: (page.value - 1) * limit.value, + sort: "desc", + }) + deposits.value = data.value + handleNextCondition.value = deposits.value.length < limit.value + + isLoading.value = false +} + const fetchData = async () => { switch (activeTab.value) { case "transactions": @@ -141,6 +159,9 @@ const fetchData = async () => { case "bridge_roles": fetchBridgeRoles() break + case "deposits": + fetchDeposits() + break } } @@ -169,7 +190,7 @@ useHead({ name: "description", content: `Astria Account ${account.value?.hash.toUpperCase().slice(0, 4)} ••• ${account.value?.hash .toUpperCase() - .slice(-4)}. The hash, actions, rollups, transactions.`, + .slice(-4)}. The hash, actions, rollups, transactions, deposits.`, }, { property: "og:title", @@ -181,7 +202,7 @@ useHead({ property: "og:description", content: `Astria Account ${account.value?.hash.toUpperCase().slice(0, 4)} ••• ${account.value?.hash .toUpperCase() - .slice(-4)}. The hash, actions, rollups, transactions.`, + .slice(-4)}. The hash, actions, rollups, transactions, deposits.`, }, { property: "og:url", @@ -197,17 +218,18 @@ useHead({ name: "twitter:description", content: `Astria Account ${account.value?.hash.toUpperCase().slice(0, 4)} ••• ${account.value?.hash .toUpperCase() - .slice(-4)}. The hash, actions, rollups, transactions.`, + .slice(-4)}. The hash, actions, rollups, transactions, deposits.`, }, ], }) const tabs = ref( [ - { name: "transactions", }, - { name: "actions" }, - { name: "rollups" }, - { name: "bridge_roles" }, + { name: "transactions", visible: true }, + { name: "actions", visible: true }, + { name: "rollups", visible: true }, + { name: "bridge_roles", visible: true }, + { name: "deposits", visible: account.value?.is_bridge }, ] ) const activeTab = ref(route.query.tab && tabs.value.map((tab) => tab.name).includes(route.query.tab) ? route.query.tab : tabs.value[0].name) @@ -267,7 +289,7 @@ watch( Account {{ shortHash(account.hash) }} - + diff --git a/pages/rollup/[hash].vue b/pages/rollup/[hash].vue index f46f012..7b76ca0 100644 --- a/pages/rollup/[hash].vue +++ b/pages/rollup/[hash].vue @@ -1,9 +1,11 @@