mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
14 lines
366 B
TypeScript
14 lines
366 B
TypeScript
import BigNumber from 'bignumber.js';
|
|
|
|
import type { Block } from 'types/api/block';
|
|
|
|
import { WEI, ZERO } from 'lib/consts';
|
|
|
|
export default function getBlockTotalReward(block: Block) {
|
|
const totalReward = block.rewards
|
|
?.map(({ reward }) => BigNumber(reward))
|
|
.reduce((result, item) => result.plus(item), ZERO) || ZERO;
|
|
|
|
return totalReward.div(WEI);
|
|
}
|