Skip to content

Commit

Permalink
Added blockheight to transaction details
Browse files Browse the repository at this point in the history
  • Loading branch information
n9lsjr committed Nov 29, 2023
1 parent 6d9f85a commit 85c721a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/backend/electron.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -489,11 +489,11 @@ ipcMain.handle('get-transactions', async (e, startIndex, all = false) => {
const pages = Math.ceil(allTx.length / showPerPage)
const pageTx = []
for (const tx of await walletBackend.getTransactions(startIndex, showPerPage)) {

pageTx.push({
hash: tx.hash,
amount: tx.totalAmount(),
time: tx.timestamp,
height: tx.blockHeight
})
}

Expand Down
18 changes: 14 additions & 4 deletions src/routes/wallet/transaction/[hash]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
const url = `https://xkr.network/transaction?hash=${hash}`;
window.api.openLink(url);
}
function getBlockDetails(hash) {
//We need the block hash for this
return;
}
</script>

<div class="header">
Expand All @@ -43,19 +48,24 @@
</div>
<div class="wrapper">
{#if transaction}
<div style="margin-top: .5em">
<div>
<h4>Amount</h4>
<p class="amount" class:incoming={transaction.incoming}>
{#if transaction.incoming}+{/if}{transaction.amount / 100000} XKR
</p>
</div>
<div style="margin-top: .5em">
<div style="margin-top: .8em">
<h4>Hash</h4>
<p style="cursor: pointer;" on:click={() => getTxDetails(transaction.hash)}>{transaction.hash}</p>
</div>
<div style="margin-top: .5em">
<div style="margin-top: .8em">
<h4>Timestamp</h4>
<p>{new Date(transaction.time * 1000).toLocaleString()}</p>
</div>
<div style="margin-top: .8em">
<h4>Block</h4>
<p on:click={() => getBlockDetails(transaction.height)}>{transaction.height}</p>
</div>
{/if}
</div>

Expand All @@ -73,7 +83,7 @@
word-break: break-all;
width: 100%;
height: 100%;
padding: 30px;
padding: 25px;
}
.wrapper p {
-moz-user-select: text;
Expand Down

0 comments on commit 85c721a

Please sign in to comment.