Skip to content

Commit

Permalink
view per account transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
maarteNNNN committed Oct 2, 2021
1 parent c504427 commit 5cb5945
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/router/details.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default [
},
{
path: '/accounts/:account/transactions',
name: 'wallet transaction details',
name: 'account transaction details',
component: () =>
import(/* webpackChunkName: "accountidtransactions" */ '../views/DetailedPage'),
props: {
Expand Down
23 changes: 22 additions & 1 deletion src/views/Accounts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,33 @@
<template v-slot:address="slotProps">
<Copy :value="slotProps.row.address" :shrink="slotProps.shrink" />
</template>
<template v-slot:view="slotProps">
<div class="flex">
<Button
value="View transactions"
@click.stop.prevent="viewAccountTransactions(slotProps.row.address)"
/>
</div>
</template>
</DataTable>
</template>

<script>
import { computed, inject, onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
import { _transformMonetaryUnit } from '../utils';
import { DETAIL_MODAL } from '../components/modals/constants';
import Navbar from '../components/Navbar';
import DataTable from '../components/DataTable';
import Copy from '../components/Copy';
import Button from '../components/Button.vue';
export default {
name: 'Accounts',
setup() {
const store = inject('store');
const router = useRouter();
const columns = ref([
// { name: 'type', label: 'type', field: 'type', sortable: false },
Expand Down Expand Up @@ -54,13 +65,23 @@ export default {
sorted: 'desc',
shrinkable: false,
},
{
name: 'view',
label: 'Inspect account',
field: 'view',
sortable: false,
active: true,
slot: true,
},
]);
return {
columns,
viewAccountTransactions: address =>
router.push(`/accounts/${address}/transactions`),
};
},
components: { DataTable, Navbar, Copy },
components: { DataTable, Navbar, Copy, Button },
};
</script>

Expand Down
10 changes: 7 additions & 3 deletions src/views/Delegates.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,19 @@ export default {
);
}
delegateCount.value = (await store.client.value.getForgingDelegates()).length;
delegateCount.value = (
await store.client.value.getForgingDelegates()
).length;
let latestBlocks = await store.client.value.getBlocksBetweenHeights(
Math.max(0, maxBlockHeight.value - delegateCount.value),
maxBlockHeight.value,
delegateCount.value
delegateCount.value,
);
recentForgers.value = new Set(latestBlocks.map(block => block.forgerAddress));
recentForgers.value = new Set(
latestBlocks.map(block => block.forgerAddress),
);
});
const voteForDelegate = async (wallet, unvote) => {
Expand Down
6 changes: 4 additions & 2 deletions src/views/DetailedPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export default {
const data = ref({});
onMounted(async () => {
// dataTable is passed by the router
if (!dataTable) {
const key = Object.keys(route.params)[0];
Expand All @@ -58,14 +59,15 @@ export default {
data.value = await (sw[key] || sw.default)();
} else {
const sw = {
'Account transaction details': () => ({
// This is relative to the route name
'account transaction details': () => ({
arg: route.params.account,
fn: 'getAccountTransactions',
}),
default: () => {},
};
data.value = await (sw[route.name] || sw.default)();
data.value = (sw[route.name] || sw.default)();
}
});
Expand Down

0 comments on commit 5cb5945

Please sign in to comment.