Skip to content
This repository has been archived by the owner on Jul 22, 2020. It is now read-only.

Commit

Permalink
feat: total bonded tokens in cluster-info API response
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnygleason committed Jul 17, 2019
1 parent b187ff2 commit 86b2dae
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion api/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,11 @@ async function getClusterInfo() {
let supply = await connection.getTotalSupply();
let cluster = await connection.getClusterNodes();
let voting = await connection.getEpochVoteAccounts();
let totalBonded = _.reduce(voting, (a, v) => {
a += (v.stake || 0);

return a;
}, 0);

cluster = _.map(cluster, c => {
let ip = c.gossip.split(':')[0];
Expand All @@ -515,7 +520,7 @@ async function getClusterInfo() {
return newc;
});

let rest = {feeCalculator, supply, cluster, voting, ts};
let rest = {feeCalculator, supply, totalBonded, cluster, voting, ts};
await setexAsync(
'!clusterInfo',
CLUSTER_INFO_CACHE_TIME_SECS,
Expand Down

0 comments on commit 86b2dae

Please sign in to comment.