Skip to content

Commit

Permalink
Minimize
Browse files Browse the repository at this point in the history
  • Loading branch information
Liquid369 committed Apr 25, 2023
1 parent 96a6818 commit eab868b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 17 deletions.
6 changes: 3 additions & 3 deletions scripts/global.js
Original file line number Diff line number Diff line change
Expand Up @@ -513,15 +513,15 @@ export async function updateStakingRewardsGUI() {

export async function updateMasternodeRewardsGUI() {
const network = getNetwork();
const arrMnRewards = await network.getMasternodeRewards();
const arrMasternodeRewards = await network.getMasternodeRewards();

if (network.areRewardsMasternodeComplete) {
// Hide the load more button
doms.domGuiMasternodeLoadMore.style.display = 'none';
}

//DOMS.DOM-optimised list generation
const strList = arrMnRewards
const strList = arrMasternodeRewards
.map(
(cReward) =>
`<i style="opacity: 0.75; cursor: pointer" onclick="window.open('${
Expand All @@ -534,7 +534,7 @@ export async function updateMasternodeRewardsGUI() {
)
.join('<br>');
// Calculate total
const nRewards = arrMnRewards.reduce(
const nRewards = arrMasternodeRewards.reduce(
(total, reward) => total + reward.amount,
0
);
Expand Down
17 changes: 3 additions & 14 deletions scripts/network.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class ExplorerNetwork extends Network {
this.blocks = 0;

this.arrRewards = [];
this.masternodeRewards = [];
this.arrMnRewards = [];
this.rewardsSyncing = false;
this.rewardsMasternodeSyncing = false;
}
Expand Down Expand Up @@ -367,17 +367,6 @@ export class ExplorerNetwork extends Network {
? this.arrMnRewards[this.arrMnRewards.length - 1].blockHeight
: 0;
const mapPaths = new Map();
const txSum = (v) =>
v.reduce(
(t, s) =>
t +
(s.addresses
.map((strAddr) => mapPaths.get(strAddr))
.filter((v) => v).length && s.addresses.length === 2
? parseInt(s.value)
: 0),
0
);
let cData;
cData = await (
await fetch(
Expand All @@ -401,15 +390,15 @@ export class ExplorerNetwork extends Network {
id: tx.txid,
time: tx.blockTime,
blockHeight: tx.blockHeight,
amount: txSum(tx.vout[2].value) / COIN,
amount: tx.vout[2].value / COIN,
};
})
.filter((tx) => tx.amount != 0)
);

// If the results don't match the full 'max/requested results', then we know the rewards are complete
if (cData.transactions.length !== cData.itemsOnPage) {
this.arearrMnRewardsComplete = true;
this.areMasternodeRewardsComplete = true;
}
}
return this.arrMnRewards;
Expand Down

0 comments on commit eab868b

Please sign in to comment.