mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-06-19 19:26:12 -07:00
41 lines
861 B
JavaScript
41 lines
861 B
JavaScript
/**
|
|
* @typedef {Object} AddressStatsPart
|
|
* @property {number} fundedTxoSum
|
|
* @property {number} spentTxoSum
|
|
* @property {number} txCount
|
|
*/
|
|
|
|
/**
|
|
* @typedef {AddressStatsPart & {
|
|
* typeIndex: number,
|
|
* }} AddressChainStats
|
|
*/
|
|
|
|
/**
|
|
* @typedef {Object} AddressStats
|
|
* @property {string} address
|
|
* @property {AddressChainStats} chainStats
|
|
* @property {AddressStatsPart} mempoolStats
|
|
*/
|
|
|
|
/**
|
|
* @param {AddressStats} stats
|
|
*/
|
|
export function getAddressReceived(stats) {
|
|
return stats.chainStats.fundedTxoSum + stats.mempoolStats.fundedTxoSum;
|
|
}
|
|
|
|
/**
|
|
* @param {AddressStats} stats
|
|
*/
|
|
export function getAddressSent(stats) {
|
|
return stats.chainStats.spentTxoSum + stats.mempoolStats.spentTxoSum;
|
|
}
|
|
|
|
/**
|
|
* @param {AddressStats} stats
|
|
*/
|
|
export function getAddressTxCount(stats) {
|
|
return stats.chainStats.txCount + stats.mempoolStats.txCount;
|
|
}
|