Skip to content

Commit 5ebd727

Browse files
committed
Add delegated balances to adresses table
1 parent b017b48 commit 5ebd727

2 files changed

Lines changed: 24 additions & 8 deletions

File tree

components/modules/address/AddressCharts.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const props = defineProps({
2121
},
2222
})
2323
24-
const selectedPeriodIdx = ref(0)
24+
const selectedPeriodIdx = ref(1)
2525
const periods = ref([
2626
{
2727
title: "Last 24 hours",
@@ -188,7 +188,7 @@ const getTxSeries = async () => {
188188
189189
const txSeriesRawData = await fetchAddressSeries({
190190
hash: props.hash,
191-
name: "count",
191+
name: "tx_count",
192192
timeframe: selectedPeriod.value.timeframe,
193193
from: parseInt(
194194
DateTime.now().minus({

pages/addresses.vue

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,6 @@ const getAddresses = async () => {
9494
isRefetching.value = false
9595
}
9696
97-
const calculateTotalBalance = (address) => {
98-
return parseInt(address.balance.spendable) + parseInt(address.balance.delegated) + parseInt(address.balance.unbonding)
99-
}
100-
10197
getAddresses()
10298
10399
/** Refetch addresses */
@@ -192,7 +188,7 @@ const handleLast = async () => {
192188
<th><Text size="12" weight="600" color="tertiary" noWrap>Hash</Text></th>
193189
<th @click="handleSort('spendable')" :class="$style.sortable">
194190
<Flex align="center" gap="6">
195-
<Text size="12" weight="600" color="tertiary" noWrap>Balance</Text>
191+
<Text size="12" weight="600" color="tertiary" noWrap>Spendable Balance</Text>
196192
<Icon
197193
v-if="sort.by === 'spendable'"
198194
name="chevron"
@@ -202,6 +198,18 @@ const handleLast = async () => {
202198
/>
203199
</Flex>
204200
</th>
201+
<th @click="handleSort('delegated')" :class="$style.sortable">
202+
<Flex align="center" gap="6">
203+
<Text size="12" weight="600" color="tertiary" noWrap>Delegated Balance</Text>
204+
<Icon
205+
v-if="sort.by === 'delegated'"
206+
name="chevron"
207+
size="12"
208+
color="secondary"
209+
:style="{ transform: `rotate(${sort.dir === 'asc' ? '180' : '0'}deg)` }"
210+
/>
211+
</Flex>
212+
</th>
205213
<th><Text size="12" weight="600" color="tertiary" noWrap>First Height</Text></th>
206214
<th><Text size="12" weight="600" color="tertiary" noWrap>Last Height</Text></th>
207215
</tr>
@@ -227,7 +235,15 @@ const handleLast = async () => {
227235
<td>
228236
<NuxtLink :to="`/address/${address.hash}`">
229237
<AmountInCurrency
230-
:amount="{ value: calculateTotalBalance(address) }"
238+
:amount="{ value: parseInt(address.balance.spendable) }"
239+
:styles="{ amount: { size: '13' }, currency: { size: '13' } }"
240+
/>
241+
</NuxtLink>
242+
</td>
243+
<td>
244+
<NuxtLink :to="`/address/${address.hash}`">
245+
<AmountInCurrency
246+
:amount="{ value: parseInt(address.balance.delegated) }"
231247
:styles="{ amount: { size: '13' }, currency: { size: '13' } }"
232248
/>
233249
</NuxtLink>

0 commit comments

Comments
 (0)