@leofcoin/endpoints 0.4.4 → 0.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/exports/shared.js +5 -5
- package/package.json +1 -1
package/exports/shared.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { formatUnits
|
|
1
|
+
import { formatUnits } from '@leofcoin/utils';
|
|
2
2
|
export const networkStats = async (chain, networkVersion) => {
|
|
3
3
|
let accountsHolding = 0;
|
|
4
|
-
let accountsHoldingAmount =
|
|
4
|
+
let accountsHoldingAmount = BigInt(0);
|
|
5
5
|
let topHolders = [];
|
|
6
6
|
const balances = Object.entries(await chain.balances)
|
|
7
7
|
.map(([holder, amount]) => {
|
|
8
|
-
amount = BigNumber.from(amount)
|
|
8
|
+
// amount = BigNumber.from(amount)
|
|
9
9
|
return { holder, amount };
|
|
10
10
|
})
|
|
11
11
|
// @ts-ignore
|
|
12
12
|
.sort((a, b) => formatUnits(b.amount.sub(a.amount)));
|
|
13
13
|
for (let { holder, amount } of balances) {
|
|
14
14
|
// @ts-ignore
|
|
15
|
-
if (amount
|
|
15
|
+
if (amount > 0) {
|
|
16
16
|
// @ts-ignore
|
|
17
|
-
accountsHoldingAmount
|
|
17
|
+
accountsHoldingAmount += amount;
|
|
18
18
|
accountsHolding += 1;
|
|
19
19
|
// @ts-ignore
|
|
20
20
|
topHolders.length < 100 && topHolders.push({ holder, amount: formatUnits(amount) });
|