diff --git a/package.json b/package.json
index 82f6646d693..be5fa1c364d 100644
--- a/package.json
+++ b/package.json
@@ -53,6 +53,7 @@
"flickity-fade": "^2.0.0",
"globby": "^13.1.4",
"hast-util-is-element": "1.1.0",
+ "humanize-duration": "^3.30.0",
"plugin-image-zoom": "flexanalytics/plugin-image-zoom",
"raw-loader": "^4.0.2",
"react": "18.2.0",
diff --git a/src/components/ManaCalculator/components/OutputForm.tsx b/src/components/ManaCalculator/components/OutputForm.tsx
index 0a32f742614..6104bd95563 100644
--- a/src/components/ManaCalculator/components/OutputForm.tsx
+++ b/src/components/ManaCalculator/components/OutputForm.tsx
@@ -1,10 +1,18 @@
import React from 'react';
import { useManaState, useResults } from '../hooks';
import { fromMicro } from '../utils';
+import humanizeDuration from 'humanize-duration';
export function OutputForm() {
const { state } = useManaState();
- const { manaGenerated, passiveRewards, totalTPS } = useResults(state);
+ const {
+ generatedRewards,
+ passiveRewards,
+ totalTPS,
+ msToTransaction,
+ passiveMsToTransaction,
+ } = useResults(state);
+
return (
@@ -15,13 +23,29 @@ export function OutputForm() {
Mana rewards
-
{fromMicro(manaGenerated)}
+
{fromMicro(generatedRewards)}
-
Total TPS granted with
{totalTPS}
+
+
+ Time it takes to accumulate enough mana for a standard transaction...
+
+
+
+
...as a delegator/validator
+
+ {humanizeDuration(msToTransaction * 1000)}
+
+
+
+
...as a holder
+
+ {humanizeDuration(passiveMsToTransaction * 1000)}
+
+
);
}
diff --git a/src/components/ManaCalculator/hooks/useResults.ts b/src/components/ManaCalculator/hooks/useResults.ts
index 8e6df3ef0bb..e279eadf24e 100644
--- a/src/components/ManaCalculator/hooks/useResults.ts
+++ b/src/components/ManaCalculator/hooks/useResults.ts
@@ -13,22 +13,22 @@ export function useResults(state: ManaCalculatorProps) {
state.finalEpoch,
);
- const additionalTPS = calculateTPS(passiveRewards, state.congestion);
+ const passiveTPS = calculateTPS(passiveRewards, state.congestion);
const validatorParameters =
state.userType === UserType.VALIDATOR
? ({
- performanceFactor: state.validator.performanceFactor,
- fixedCost: state.validator.fixedCost,
- shareOfYourStakeLocked: state.validator.shareOfYourStakeLocked,
- attractedNewDelegatedStake:
- state.validator.attractedNewDelegatedStake,
- attractedDelegatedStakeFromOtherPools:
- state.validator.attractedDelegatedStakeFromOtherPools,
- } as ValidatorParameters)
+ performanceFactor: state.validator.performanceFactor,
+ fixedCost: state.validator.fixedCost,
+ shareOfYourStakeLocked: state.validator.shareOfYourStakeLocked,
+ attractedNewDelegatedStake:
+ state.validator.attractedNewDelegatedStake,
+ attractedDelegatedStakeFromOtherPools:
+ state.validator.attractedDelegatedStakeFromOtherPools,
+ } as ValidatorParameters)
: null;
- const manaGenerated = calculateManaRewards(
+ const generatedRewards = calculateManaRewards(
state.stakedOrDelegatedTokens,
state.delegator.validator,
validatorParameters,
@@ -39,12 +39,17 @@ export function useResults(state: ManaCalculatorProps) {
state.network,
);
- const grantedTPS = calculateTPS(manaGenerated, state.congestion);
- const totalTPS = grantedTPS + additionalTPS;
+ const generatedTPS = calculateTPS(generatedRewards, state.congestion);
+ const totalTPS = generatedTPS + passiveTPS;
+
+ const msToTransaction = (1 / totalTPS) * 1_000;
+ const passiveMsToTransaction = (1 / passiveTPS) * 1_000;
return {
- manaGenerated,
+ generatedRewards,
passiveRewards,
totalTPS,
+ msToTransaction,
+ passiveMsToTransaction,
};
}
diff --git a/src/components/ManaCalculator/hooks/useResultsPerEpoch.ts b/src/components/ManaCalculator/hooks/useResultsPerEpoch.ts
index 8126d308776..dde820bd288 100644
--- a/src/components/ManaCalculator/hooks/useResultsPerEpoch.ts
+++ b/src/components/ManaCalculator/hooks/useResultsPerEpoch.ts
@@ -27,7 +27,7 @@ export function useResultsPerEpoch(state: ManaCalculatorProps): EpochReward[] {
const results = [];
for (let i = state.initialEpoch; i <= state.finalEpoch; i++) {
- const manaGenerated = calculateManaRewards(
+ const generatedRewards = calculateManaRewards(
state.stakedOrDelegatedTokens,
state.delegator.validator,
validatorParameters,
@@ -44,13 +44,13 @@ export function useResultsPerEpoch(state: ManaCalculatorProps): EpochReward[] {
i,
);
- const mana = manaGenerated + passiveRewards;
+ const mana = generatedRewards + passiveRewards;
const tpsFromPassiveRewards = calculateTPS(
passiveRewards,
state.congestion,
);
- const tpsFromGeneratedMana = calculateTPS(manaGenerated, state.congestion);
+ const tpsFromGeneratedMana = calculateTPS(generatedRewards, state.congestion);
const totalTps = tpsFromPassiveRewards + tpsFromGeneratedMana;
results.push({
diff --git a/yarn.lock b/yarn.lock
index d5e520df5f8..126884029e9 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2835,6 +2835,7 @@ __metadata:
flickity-fade: ^2.0.0
globby: ^13.1.4
hast-util-is-element: 1.1.0
+ humanize-duration: ^3.30.0
plugin-image-zoom: flexanalytics/plugin-image-zoom
prettier: ^2.8.8
raw-loader: ^4.0.2
@@ -10752,6 +10753,13 @@ __metadata:
languageName: node
linkType: hard
+"humanize-duration@npm:^3.30.0":
+ version: 3.30.0
+ resolution: "humanize-duration@npm:3.30.0"
+ checksum: 6eaf888219801d47d42cfb03523e736367c260e3f32cddb4e30c30f49500e08e7cdfd413f02a5ed24943ef382b3e89c8a11e6eda3a432846385903a9f49e576a
+ languageName: node
+ linkType: hard
+
"humanize-ms@npm:^1.2.1":
version: 1.2.1
resolution: "humanize-ms@npm:1.2.1"