From 761e9c9b7ee95699cd5b97b75a840b672bd146fa Mon Sep 17 00:00:00 2001 From: Craig Raw Date: Mon, 27 Sep 2021 09:33:41 +0200 Subject: [PATCH] use wallet unit when displaying pool denomination --- .../sparrow/whirlpool/WhirlpoolController.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/sparrowwallet/sparrow/whirlpool/WhirlpoolController.java b/src/main/java/com/sparrowwallet/sparrow/whirlpool/WhirlpoolController.java index 8181d9ee..3adc27aa 100644 --- a/src/main/java/com/sparrowwallet/sparrow/whirlpool/WhirlpoolController.java +++ b/src/main/java/com/sparrowwallet/sparrow/whirlpool/WhirlpoolController.java @@ -115,8 +115,18 @@ public class WhirlpoolController { pool.setConverter(new StringConverter() { @Override - public String toString(Pool pool) { - return pool == null ? "Fetching pools..." : pool.getPoolId().replace("btc", " BTC"); + public String toString(Pool selectedPool) { + if(selectedPool == null) { + pool.setTooltip(null); + return "Fetching pools..."; + } + + BitcoinUnit bitcoinUnit = wallet.getAutoUnit(); + String satsValue = String.format(Locale.ENGLISH, "%,d", selectedPool.getDenomination()) + " sats"; + String btcValue = CoinLabel.BTC_FORMAT.format((double)selectedPool.getDenomination() / Transaction.SATOSHIS_PER_BITCOIN) + " BTC"; + + pool.setTooltip(bitcoinUnit == BitcoinUnit.BTC ? new Tooltip(satsValue) : new Tooltip(btcValue)); + return bitcoinUnit == BitcoinUnit.BTC ? btcValue : satsValue; } @Override