Adding latest blocks and transactions to dashboard.

This commit is contained in:
softsimon
2020-09-26 02:11:30 +07:00
parent aa3559e634
commit d4f768e3b6
10 changed files with 135 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
import { TransactionExtended } from '../interfaces';
import { Transaction, TransactionExtended, TransactionStripped } from '../interfaces';
export class Common {
static median(numbers: number[]) {
@@ -47,4 +47,13 @@ export class Common {
});
return matches;
}
static stripTransaction(tx: TransactionExtended): TransactionStripped {
return {
txid: tx.txid,
fee: tx.fee,
weight: tx.weight,
value: tx.vin.reduce((acc, vin) => acc + (vin.prevout ? vin.prevout.value : 0), 0),
};
}
}