Setting BTC on Proof of Brain or @ecency, leaves you with all of the rewards showing 0.00 BTC. One one hundredth of a bitcoin is a handsome sum of money. This is not something we should expect from Hive in 2024. So, you could have more decimal places, so 32 Satoshis would be expressed as 0.00000032 BTC or 0.000,000,32 BTC. But instead I emplpy metric prefixes 'milli-' and 'micro-'. In the image above we have 0.01 mBTC, 0.43 µBTC and 0.32 µBTC in terms of Hive rewards.
Here is a patch that does this for Ecency.
--- a/src/common/components/formatted-currency/index.tsx
+++ b/src/common/components/formatted-currency/index.tsx
@@ -10,6 +10,8 @@ interface Props {
fixAt: number;
}
+const prefixes = ["", "m", "µ", "n", "p", "f", "a"];
+
export default class FormattedCurrency extends Component<Props> {
public static defaultProps: Partial<Props> = {
fixAt: 2
@@ -21,6 +23,26 @@ export default class FormattedCurrency extends Component<Props> {
const valInCurrency = value * currencyRate;
- return <>{formattedNumber(valInCurrency, { fractionDigits: fixAt, prefix: currencySymbol })}</>;
+ let decimal_places = 0;
+ let currency_string: string;
+ let multiplier = 1.0;
+ for (; decimal_places < 18; decimal_places += 3, multiplier *= 1000) {
+ currency_string = formattedNumber(valInCurrency * multiplier, { fractionDigits: fixAt });
+ const parsed_amount = parseFloat(currency_string);
+ console.log(currency_string, parsed_amount);
+ if (isNaN(parsed_amount) || parsed_amount > 0) break;
+ }
+ const prefix = prefixes[decimal_places / 3];
+
+ console.log(prefix);
+
+ return (
+ <>
+ {formattedNumber(valInCurrency * multiplier, {
+ fractionDigits: fixAt,
+ prefix: prefix + currencySymbol
+ })}
+ </>
+ );
}
}
Posted with proof of brain.... Prove your brain now.🧠🧠🧠