From 2f7a9247925f7a16e886accfbccff6f753237de8 Mon Sep 17 00:00:00 2001 From: Justin Carter Date: Tue, 19 Nov 2019 12:18:10 +0100 Subject: [PATCH 1/7] Remove dead code from BSFormatter --- .../main/java/bisq/core/util/BSFormatter.java | 36 ------------------- 1 file changed, 36 deletions(-) diff --git a/core/src/main/java/bisq/core/util/BSFormatter.java b/core/src/main/java/bisq/core/util/BSFormatter.java index 164d63da754..c0cd426b86e 100644 --- a/core/src/main/java/bisq/core/util/BSFormatter.java +++ b/core/src/main/java/bisq/core/util/BSFormatter.java @@ -18,41 +18,12 @@ package bisq.core.util; import bisq.core.app.BisqEnvironment; -import bisq.core.locale.CurrencyUtil; -import bisq.core.locale.GlobalSettings; -import bisq.core.locale.Res; -import bisq.core.monetary.Altcoin; -import bisq.core.monetary.Price; -import bisq.core.offer.OfferPayload; - -import bisq.network.p2p.NodeAddress; - -import bisq.common.util.MathUtils; - import org.bitcoinj.core.Coin; -import org.bitcoinj.core.Monetary; -import org.bitcoinj.utils.Fiat; import org.bitcoinj.utils.MonetaryFormat; import javax.inject.Inject; import javax.inject.Singleton; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.time.DateUtils; -import org.apache.commons.lang3.time.DurationFormatUtils; - -import java.text.DateFormat; -import java.text.DecimalFormat; -import java.text.SimpleDateFormat; - -import java.math.BigDecimal; - -import java.util.Date; -import java.util.List; -import java.util.Locale; -import java.util.TimeZone; -import java.util.stream.Collectors; - import lombok.Getter; import lombok.extern.slf4j.Slf4j; @@ -103,11 +74,4 @@ public String formatCoinWithCode(Coin coin) { public String formatCoinWithCode(long value) { return FormattingUtils.formatCoinWithCode(Coin.valueOf(value), monetaryFormat); } - - public static String getDateFromBlockHeight(long blockHeight) { - long now = new Date().getTime(); - SimpleDateFormat dateFormatter = new SimpleDateFormat("dd MMM", Locale.getDefault()); - SimpleDateFormat timeFormatter = new SimpleDateFormat("HH:mm", Locale.getDefault()); - return FormattingUtils.formatDateTime(new Date(now + blockHeight * 10 * 60 * 1000L), dateFormatter, timeFormatter); - } } From d10683e192c97330de1d5f87dc91ad7929f3bc1f Mon Sep 17 00:00:00 2001 From: Justin Carter Date: Tue, 19 Nov 2019 12:30:31 +0100 Subject: [PATCH 2/7] Extract CoinFormatter interface --- .../bisq/core/offer/CreateOfferService.java | 2 +- .../main/java/bisq/core/offer/OfferUtil.java | 8 ++-- .../main/java/bisq/core/util/BSFormatter.java | 9 +++- .../java/bisq/core/util/BsqFormatter.java | 46 ++++++++++++++++--- .../java/bisq/core/util/ParsingUtils.java | 5 +- .../bisq/core/util/coin/CoinFormatter.java | 20 ++++++++ .../bisq/core/util/{ => coin}/CoinUtil.java | 2 +- .../bisq/core/util/CoinCryptoUtilsTest.java | 2 + .../main/dao/bonding/BondingViewUtils.java | 2 +- .../main/dao/wallet/send/BsqSendView.java | 5 +- .../main/funds/withdrawal/WithdrawalView.java | 2 +- .../main/offer/MutableOfferDataModel.java | 2 +- .../offer/takeoffer/TakeOfferDataModel.java | 2 +- .../windows/DisputeSummaryWindow.java | 2 +- .../editoffer/EditOfferDataModel.java | 2 +- .../steps/buyer/BuyerStep4View.java | 2 +- .../java/bisq/desktop/util/DisplayUtils.java | 3 +- .../main/java/bisq/desktop/util/GUIUtil.java | 2 +- .../desktop/util/validation/BsqValidator.java | 2 +- 19 files changed, 92 insertions(+), 28 deletions(-) create mode 100644 core/src/main/java/bisq/core/util/coin/CoinFormatter.java rename core/src/main/java/bisq/core/util/{ => coin}/CoinUtil.java (99%) diff --git a/core/src/main/java/bisq/core/offer/CreateOfferService.java b/core/src/main/java/bisq/core/offer/CreateOfferService.java index 35475e4d77e..106f28e96a1 100644 --- a/core/src/main/java/bisq/core/offer/CreateOfferService.java +++ b/core/src/main/java/bisq/core/offer/CreateOfferService.java @@ -34,7 +34,7 @@ import bisq.core.trade.statistics.ReferralIdService; import bisq.core.user.Preferences; import bisq.core.user.User; -import bisq.core.util.CoinUtil; +import bisq.core.util.coin.CoinUtil; import bisq.network.p2p.NodeAddress; import bisq.network.p2p.P2PService; diff --git a/core/src/main/java/bisq/core/offer/OfferUtil.java b/core/src/main/java/bisq/core/offer/OfferUtil.java index a8c9406d682..3e8ee6213f9 100644 --- a/core/src/main/java/bisq/core/offer/OfferUtil.java +++ b/core/src/main/java/bisq/core/offer/OfferUtil.java @@ -32,8 +32,8 @@ import bisq.core.provider.price.PriceFeedService; import bisq.core.trade.statistics.ReferralIdService; import bisq.core.user.Preferences; -import bisq.core.util.BsqFormatter; -import bisq.core.util.CoinUtil; +import bisq.core.util.coin.CoinFormatter; +import bisq.core.util.coin.CoinUtil; import bisq.network.p2p.P2PService; @@ -281,7 +281,7 @@ static Coin getAdjustedAmount(Coin amount, Price price, long maxTradeLimit, int public static Optional getFeeInUserFiatCurrency(Coin makerFee, boolean isCurrencyForMakerFeeBtc, Preferences preferences, PriceFeedService priceFeedService, - BsqFormatter bsqFormatter) { + CoinFormatter bsqFormatter) { String countryCode = preferences.getUserCountry().code; String userCurrencyCode = CurrencyUtil.getCurrencyByCountryCode(countryCode).getCode(); return getFeeInUserFiatCurrency(makerFee, @@ -293,7 +293,7 @@ public static Optional getFeeInUserFiatCurrency(Coin makerFee, boolean i public static Optional getFeeInUserFiatCurrency(Coin makerFee, boolean isCurrencyForMakerFeeBtc, String userCurrencyCode, PriceFeedService priceFeedService, - BsqFormatter bsqFormatter) { + CoinFormatter bsqFormatter) { // We use the users currency derived from his selected country. // We don't use the preferredTradeCurrency from preferences as that can be also set to an altcoin. diff --git a/core/src/main/java/bisq/core/util/BSFormatter.java b/core/src/main/java/bisq/core/util/BSFormatter.java index c0cd426b86e..1906a1a48b0 100644 --- a/core/src/main/java/bisq/core/util/BSFormatter.java +++ b/core/src/main/java/bisq/core/util/BSFormatter.java @@ -18,6 +18,8 @@ package bisq.core.util; import bisq.core.app.BisqEnvironment; +import bisq.core.util.coin.CoinFormatter; + import org.bitcoinj.core.Coin; import org.bitcoinj.utils.MonetaryFormat; @@ -31,7 +33,7 @@ @Slf4j @Singleton -public class BSFormatter { +public class BSFormatter implements CoinFormatter { // We don't support localized formatting. Format is always using "." as decimal mark and no grouping separator. // Input of "," as decimal mark (like in german locale) will be replaced with ".". @@ -54,23 +56,28 @@ public BSFormatter() { // BTC /////////////////////////////////////////////////////////////////////////////////////////// + @Override public String formatCoin(Coin coin) { return formatCoin(coin, -1); } + @Override @NotNull public String formatCoin(Coin coin, int decimalPlaces) { return formatCoin(coin, decimalPlaces, false, 0); } + @Override public String formatCoin(Coin coin, int decimalPlaces, boolean decimalAligned, int maxNumberOfDigits) { return FormattingUtils.formatCoin(coin, decimalPlaces, decimalAligned, maxNumberOfDigits, monetaryFormat); } + @Override public String formatCoinWithCode(Coin coin) { return FormattingUtils.formatCoinWithCode(coin, monetaryFormat); } + @Override public String formatCoinWithCode(long value) { return FormattingUtils.formatCoinWithCode(Coin.valueOf(value), monetaryFormat); } diff --git a/core/src/main/java/bisq/core/util/BsqFormatter.java b/core/src/main/java/bisq/core/util/BsqFormatter.java index 97595107343..32db6a3b3f0 100644 --- a/core/src/main/java/bisq/core/util/BsqFormatter.java +++ b/core/src/main/java/bisq/core/util/BsqFormatter.java @@ -23,6 +23,7 @@ import bisq.core.locale.GlobalSettings; import bisq.core.locale.Res; import bisq.core.provider.price.MarketPrice; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.BtcAddressValidator; import bisq.core.util.validation.InputValidator; @@ -44,29 +45,32 @@ import lombok.extern.slf4j.Slf4j; +import org.jetbrains.annotations.NotNull; + @Slf4j @Singleton -public class BsqFormatter extends BSFormatter { +public class BsqFormatter implements CoinFormatter { @SuppressWarnings("PointlessBooleanExpression") private static final boolean useBsqAddressFormat = true || !DevEnv.isDevMode(); private final String prefix = "B"; + private final BSFormatter bsFormatter; private DecimalFormat amountFormat; private DecimalFormat marketCapFormat; private final MonetaryFormat btcCoinFormat; @Inject public BsqFormatter() { - super(); + bsFormatter = new BSFormatter(); GlobalSettings.localeProperty().addListener((observable, oldValue, newValue) -> setFormatter(newValue)); setFormatter(GlobalSettings.getLocale()); - btcCoinFormat = super.monetaryFormat; + btcCoinFormat = bsFormatter.monetaryFormat; final String baseCurrencyCode = BisqEnvironment.getBaseCurrencyNetwork().getCurrencyCode(); switch (baseCurrencyCode) { case "BTC": - monetaryFormat = new MonetaryFormat().shift(6).code(6, "BSQ").minDecimals(2); + bsFormatter.monetaryFormat = new MonetaryFormat().shift(6).code(6, "BSQ").minDecimals(2); break; default: throw new RuntimeException("baseCurrencyCode not defined. baseCurrencyCode=" + baseCurrencyCode); @@ -123,11 +127,11 @@ public String formatMarketCap(MarketPrice bsqPriceMarketPrice, MarketPrice fiatM } public String formatBSQSatoshis(long satoshi) { - return FormattingUtils.formatCoin(satoshi, monetaryFormat); + return FormattingUtils.formatCoin(satoshi, bsFormatter.monetaryFormat); } public String formatBSQSatoshisWithCode(long satoshi) { - return FormattingUtils.formatCoinWithCode(satoshi, monetaryFormat); + return FormattingUtils.formatCoinWithCode(satoshi, bsFormatter.monetaryFormat); } public String formatBTCSatoshis(long satoshi) { @@ -155,7 +159,7 @@ public void validateBtcInput(String input) throws ProposalValidationException { } public void validateBsqInput(String input) throws ProposalValidationException { - validateCoinInput(input, this.monetaryFormat); + validateCoinInput(input, bsFormatter.monetaryFormat); } private void validateCoinInput(String input, MonetaryFormat coinFormat) throws ProposalValidationException { @@ -230,4 +234,32 @@ public String parseParamValueToString(Param param, String inputValue) throws Pro return Res.get("shared.na"); } } + + public String formatCoin(Coin coin) { + return bsFormatter.formatCoin(coin); + } + + @NotNull + public String formatCoin(Coin coin, int decimalPlaces) { + return bsFormatter.formatCoin(coin, decimalPlaces); + } + + public String formatCoin(Coin coin, + int decimalPlaces, + boolean decimalAligned, + int maxNumberOfDigits) { + return bsFormatter.formatCoin(coin, decimalPlaces, decimalAligned, maxNumberOfDigits); + } + + public String formatCoinWithCode(Coin coin) { + return bsFormatter.formatCoinWithCode(coin); + } + + public String formatCoinWithCode(long value) { + return bsFormatter.formatCoinWithCode(value); + } + + public MonetaryFormat getMonetaryFormat() { + return bsFormatter.getMonetaryFormat(); + } } diff --git a/core/src/main/java/bisq/core/util/ParsingUtils.java b/core/src/main/java/bisq/core/util/ParsingUtils.java index e20521e83ce..1be01f71af1 100644 --- a/core/src/main/java/bisq/core/util/ParsingUtils.java +++ b/core/src/main/java/bisq/core/util/ParsingUtils.java @@ -1,6 +1,7 @@ package bisq.core.util; import bisq.core.monetary.Price; +import bisq.core.util.coin.CoinFormatter; import bisq.common.util.MathUtils; @@ -13,8 +14,8 @@ @Slf4j public class ParsingUtils { - public static Coin parseToCoin(String input, BSFormatter bsFormatter) { - return parseToCoin(input, bsFormatter.getMonetaryFormat()); + public static Coin parseToCoin(String input, CoinFormatter coinFormatter) { + return parseToCoin(input, coinFormatter.getMonetaryFormat()); } public static Coin parseToCoin(String input, MonetaryFormat coinFormat) { diff --git a/core/src/main/java/bisq/core/util/coin/CoinFormatter.java b/core/src/main/java/bisq/core/util/coin/CoinFormatter.java new file mode 100644 index 00000000000..1959e64b7ff --- /dev/null +++ b/core/src/main/java/bisq/core/util/coin/CoinFormatter.java @@ -0,0 +1,20 @@ +package bisq.core.util.coin; + +import org.bitcoinj.core.Coin; + +import org.jetbrains.annotations.NotNull; + +public interface CoinFormatter { + String formatCoin(Coin coin); + + @NotNull + String formatCoin(Coin coin, int decimalPlaces); + + String formatCoin(Coin coin, int decimalPlaces, boolean decimalAligned, int maxNumberOfDigits); + + String formatCoinWithCode(Coin coin); + + String formatCoinWithCode(long value); + + org.bitcoinj.utils.MonetaryFormat getMonetaryFormat(); +} diff --git a/core/src/main/java/bisq/core/util/CoinUtil.java b/core/src/main/java/bisq/core/util/coin/CoinUtil.java similarity index 99% rename from core/src/main/java/bisq/core/util/CoinUtil.java rename to core/src/main/java/bisq/core/util/coin/CoinUtil.java index fa2c1a1922d..d6c90d9e364 100644 --- a/core/src/main/java/bisq/core/util/CoinUtil.java +++ b/core/src/main/java/bisq/core/util/coin/CoinUtil.java @@ -15,7 +15,7 @@ * along with Bisq. If not, see . */ -package bisq.core.util; +package bisq.core.util.coin; import bisq.common.util.MathUtils; diff --git a/core/src/test/java/bisq/core/util/CoinCryptoUtilsTest.java b/core/src/test/java/bisq/core/util/CoinCryptoUtilsTest.java index 254cdee23f9..2f04b7a75f4 100644 --- a/core/src/test/java/bisq/core/util/CoinCryptoUtilsTest.java +++ b/core/src/test/java/bisq/core/util/CoinCryptoUtilsTest.java @@ -17,6 +17,8 @@ package bisq.core.util; +import bisq.core.util.coin.CoinUtil; + import org.bitcoinj.core.Coin; import org.slf4j.Logger; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/bonding/BondingViewUtils.java b/desktop/src/main/java/bisq/desktop/main/dao/bonding/BondingViewUtils.java index 83634b03087..a5e56c88aaa 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/bonding/BondingViewUtils.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/bonding/BondingViewUtils.java @@ -36,7 +36,7 @@ import bisq.core.locale.Res; import bisq.core.util.BSFormatter; import bisq.core.util.BsqFormatter; -import bisq.core.util.CoinUtil; +import bisq.core.util.coin.CoinUtil; import bisq.core.util.FormattingUtils; import bisq.network.p2p.P2PService; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.java b/desktop/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.java index 902e19fad15..1d67420fe1a 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.java @@ -46,7 +46,8 @@ import bisq.core.locale.Res; import bisq.core.util.BSFormatter; import bisq.core.util.BsqFormatter; -import bisq.core.util.CoinUtil; +import bisq.core.util.coin.CoinFormatter; +import bisq.core.util.coin.CoinUtil; import bisq.core.util.ParsingUtils; import bisq.core.util.validation.BtcAddressValidator; @@ -347,7 +348,7 @@ private void showPublishTxPopup(Coin receiverAmount, TxType txType, Coin miningFee, int txSize, String address, - BSFormatter amountFormatter, // can be BSQ or BTC formatter + CoinFormatter amountFormatter, // can be BSQ or BTC formatter BSFormatter feeFormatter, ResultHandler resultHandler) { new Popup<>().headLine(Res.get("dao.wallet.send.sendFunds.headline")) diff --git a/desktop/src/main/java/bisq/desktop/main/funds/withdrawal/WithdrawalView.java b/desktop/src/main/java/bisq/desktop/main/funds/withdrawal/WithdrawalView.java index 1278c9c5b4a..f3727ba566b 100644 --- a/desktop/src/main/java/bisq/desktop/main/funds/withdrawal/WithdrawalView.java +++ b/desktop/src/main/java/bisq/desktop/main/funds/withdrawal/WithdrawalView.java @@ -41,7 +41,7 @@ import bisq.core.trade.TradeManager; import bisq.core.user.Preferences; import bisq.core.util.BSFormatter; -import bisq.core.util.CoinUtil; +import bisq.core.util.coin.CoinUtil; import bisq.core.util.ParsingUtils; import bisq.core.util.validation.BtcAddressValidator; diff --git a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferDataModel.java b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferDataModel.java index f28fc1f38fd..b555581d1e0 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferDataModel.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferDataModel.java @@ -46,7 +46,7 @@ import bisq.core.user.Preferences; import bisq.core.user.User; import bisq.core.util.BSFormatter; -import bisq.core.util.CoinUtil; +import bisq.core.util.coin.CoinUtil; import bisq.network.p2p.P2PService; diff --git a/desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferDataModel.java b/desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferDataModel.java index eb47b7d3e1a..593d2192ae3 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferDataModel.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferDataModel.java @@ -47,7 +47,7 @@ import bisq.core.trade.handlers.TradeResultHandler; import bisq.core.user.Preferences; import bisq.core.user.User; -import bisq.core.util.CoinUtil; +import bisq.core.util.coin.CoinUtil; import bisq.network.p2p.P2PService; diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/windows/DisputeSummaryWindow.java b/desktop/src/main/java/bisq/desktop/main/overlays/windows/DisputeSummaryWindow.java index 16e9bccce0e..e8bba8fd9bd 100644 --- a/desktop/src/main/java/bisq/desktop/main/overlays/windows/DisputeSummaryWindow.java +++ b/desktop/src/main/java/bisq/desktop/main/overlays/windows/DisputeSummaryWindow.java @@ -46,7 +46,7 @@ import bisq.core.support.dispute.refund.RefundManager; import bisq.core.trade.Contract; import bisq.core.util.BSFormatter; -import bisq.core.util.CoinUtil; +import bisq.core.util.coin.CoinUtil; import bisq.core.util.FormattingUtils; import bisq.core.util.ParsingUtils; diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModel.java b/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModel.java index 388dd13a9e6..3aba3f99ae5 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModel.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModel.java @@ -40,7 +40,7 @@ import bisq.core.user.Preferences; import bisq.core.user.User; import bisq.core.util.BSFormatter; -import bisq.core.util.CoinUtil; +import bisq.core.util.coin.CoinUtil; import bisq.network.p2p.P2PService; diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep4View.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep4View.java index 30deb5fb4f5..0f7870c9fb1 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep4View.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/steps/buyer/BuyerStep4View.java @@ -39,7 +39,7 @@ import bisq.core.locale.Res; import bisq.core.user.DontShowAgainLookup; import bisq.core.util.BSFormatter; -import bisq.core.util.CoinUtil; +import bisq.core.util.coin.CoinUtil; import bisq.core.util.validation.BtcAddressValidator; import bisq.common.UserThread; diff --git a/desktop/src/main/java/bisq/desktop/util/DisplayUtils.java b/desktop/src/main/java/bisq/desktop/util/DisplayUtils.java index cd66eadcdc9..7d5b8abe4ea 100644 --- a/desktop/src/main/java/bisq/desktop/util/DisplayUtils.java +++ b/desktop/src/main/java/bisq/desktop/util/DisplayUtils.java @@ -9,6 +9,7 @@ import bisq.core.offer.Offer; import bisq.core.offer.OfferPayload; import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.FormattingUtils; import bisq.core.util.ParsingUtils; @@ -245,7 +246,7 @@ public static String formatPrice(Price price, Boolean decimalAligned, int maxPla public static String getFeeWithFiatAmount(Coin makerFeeAsCoin, Optional optionalFeeInFiat, - BSFormatter formatter) { + CoinFormatter formatter) { String fee = makerFeeAsCoin != null ? formatter.formatCoinWithCode(makerFeeAsCoin) : Res.get("shared.na"); String feeInFiatAsString; if (optionalFeeInFiat != null && optionalFeeInFiat.isPresent()) { diff --git a/desktop/src/main/java/bisq/desktop/util/GUIUtil.java b/desktop/src/main/java/bisq/desktop/util/GUIUtil.java index c4525f16a2a..c38a8d82d84 100644 --- a/desktop/src/main/java/bisq/desktop/util/GUIUtil.java +++ b/desktop/src/main/java/bisq/desktop/util/GUIUtil.java @@ -51,7 +51,7 @@ import bisq.core.user.User; import bisq.core.util.BSFormatter; import bisq.core.util.BsqFormatter; -import bisq.core.util.CoinUtil; +import bisq.core.util.coin.CoinUtil; import bisq.core.util.FormattingUtils; import bisq.network.p2p.P2PService; diff --git a/desktop/src/main/java/bisq/desktop/util/validation/BsqValidator.java b/desktop/src/main/java/bisq/desktop/util/validation/BsqValidator.java index 0ab87710ae4..a5110ada79e 100644 --- a/desktop/src/main/java/bisq/desktop/util/validation/BsqValidator.java +++ b/desktop/src/main/java/bisq/desktop/util/validation/BsqValidator.java @@ -20,7 +20,7 @@ import bisq.core.btc.wallet.Restrictions; import bisq.core.locale.Res; import bisq.core.util.BsqFormatter; -import bisq.core.util.CoinUtil; +import bisq.core.util.coin.CoinUtil; import bisq.core.util.ParsingUtils; import org.bitcoinj.core.Coin; From ed97f7a9e50854a2258dc26c2316be00cc9849f4 Mon Sep 17 00:00:00 2001 From: Justin Carter Date: Tue, 19 Nov 2019 14:00:22 +0100 Subject: [PATCH 3/7] Use interface instead of class name for CoinFormatter --- .../main/java/bisq/core/app/BisqSetup.java | 6 ++--- .../java/bisq/core/app/WalletAppSetup.java | 6 ++--- .../bisq/core/dao/presentation/DaoUtil.java | 6 ++--- .../alerts/market/MarketAlerts.java | 6 ++--- .../alerts/price/PriceAlert.java | 6 ++--- .../presentation/BalancePresentation.java | 4 +-- .../desktop/components/BalanceTextField.java | 6 ++--- .../BalanceWithConfirmationTextField.java | 6 ++--- .../desktop/components/PeerInfoIconSmall.java | 4 +-- .../paymentmethods/AdvancedCashForm.java | 4 +-- .../components/paymentmethods/AliPayForm.java | 4 +-- .../components/paymentmethods/AssetsForm.java | 4 +-- .../components/paymentmethods/BankForm.java | 4 +-- .../paymentmethods/CashDepositForm.java | 4 +-- .../paymentmethods/ChaseQuickPayForm.java | 4 +-- .../paymentmethods/ClearXchangeForm.java | 4 +-- .../components/paymentmethods/F2FForm.java | 4 +-- .../paymentmethods/FasterPaymentsForm.java | 4 +-- .../GeneralAccountNumberForm.java | 4 +-- .../paymentmethods/GeneralBankForm.java | 4 +-- .../paymentmethods/GeneralSepaForm.java | 4 +-- .../paymentmethods/HalCashForm.java | 4 +-- .../paymentmethods/InteracETransferForm.java | 4 +-- .../paymentmethods/JapanBankTransferForm.java | 4 +-- .../paymentmethods/MoneyBeamForm.java | 4 +-- .../paymentmethods/MoneyGramForm.java | 4 +-- .../paymentmethods/NationalBankForm.java | 4 +-- .../paymentmethods/PaymentMethodForm.java | 6 ++--- .../paymentmethods/PerfectMoneyForm.java | 4 +-- .../paymentmethods/PopmoneyForm.java | 4 +-- .../paymentmethods/PromptPayForm.java | 4 +-- .../paymentmethods/RevolutForm.java | 4 +-- .../paymentmethods/SameBankForm.java | 4 +-- .../components/paymentmethods/SepaForm.java | 4 +-- .../paymentmethods/SepaInstantForm.java | 4 +-- .../paymentmethods/SpecificBankForm.java | 4 +-- .../components/paymentmethods/SwishForm.java | 4 +-- .../USPostalMoneyOrderForm.java | 4 +-- .../components/paymentmethods/UpholdForm.java | 4 +-- .../paymentmethods/WeChatPayForm.java | 4 +-- .../paymentmethods/WesternUnionForm.java | 4 +-- .../main/java/bisq/desktop/main/MainView.java | 6 ++--- .../altcoinaccounts/AltCoinAccountsView.java | 6 ++--- .../fiataccounts/FiatAccountsView.java | 6 ++--- .../ManageMarketAlertsWindow.java | 6 ++--- .../MobileNotificationsView.java | 6 ++--- .../main/dao/bonding/BondingViewUtils.java | 5 ++-- .../dao/burnbsq/assetfee/AssetFeeView.java | 6 ++--- .../burnbsq/proofofburn/ProofOfBurnView.java | 6 ++--- .../dashboard/GovernanceDashboardView.java | 6 ++--- .../dao/governance/make/MakeProposalView.java | 6 ++--- .../governance/proposals/ProposalsView.java | 6 ++--- .../main/dao/wallet/send/BsqSendView.java | 7 +++-- .../main/funds/deposit/DepositListItem.java | 4 +-- .../main/funds/deposit/DepositView.java | 6 ++--- .../main/funds/locked/LockedListItem.java | 6 ++--- .../desktop/main/funds/locked/LockedView.java | 6 ++--- .../main/funds/reserved/ReservedListItem.java | 6 ++--- .../main/funds/reserved/ReservedView.java | 6 ++--- .../TransactionListItemFactory.java | 6 ++--- .../transactions/TransactionsListItem.java | 6 ++--- .../funds/transactions/TransactionsView.java | 6 ++--- .../funds/withdrawal/WithdrawalListItem.java | 6 ++--- .../main/funds/withdrawal/WithdrawalView.java | 6 ++--- .../bisq/desktop/main/market/MarketView.java | 6 ++--- .../market/offerbook/OfferBookChartView.java | 6 ++--- .../offerbook/OfferBookChartViewModel.java | 6 ++--- .../main/market/spread/SpreadView.java | 6 ++--- .../main/market/spread/SpreadViewModel.java | 6 ++--- .../main/market/trades/TradesChartsView.java | 6 ++--- .../market/trades/TradesChartsViewModel.java | 6 ++--- .../main/offer/MutableOfferDataModel.java | 6 ++--- .../desktop/main/offer/MutableOfferView.java | 6 ++--- .../main/offer/MutableOfferViewModel.java | 10 +++---- .../createoffer/CreateOfferDataModel.java | 4 +-- .../offer/createoffer/CreateOfferView.java | 4 +-- .../createoffer/CreateOfferViewModel.java | 4 +-- .../main/offer/offerbook/OfferBookView.java | 6 ++--- .../offer/offerbook/OfferBookViewModel.java | 6 ++--- .../main/offer/takeoffer/TakeOfferView.java | 6 ++--- .../offer/takeoffer/TakeOfferViewModel.java | 10 +++---- .../main/overlays/windows/ContractWindow.java | 6 ++--- .../windows/DisputeSummaryWindow.java | 6 ++--- .../overlays/windows/EmptyWalletWindow.java | 8 +++--- .../overlays/windows/OfferDetailsWindow.java | 6 ++--- .../overlays/windows/TradeDetailsWindow.java | 6 ++--- .../closedtrades/ClosedTradesView.java | 6 ++--- .../closedtrades/ClosedTradesViewModel.java | 6 ++--- .../editoffer/EditOfferDataModel.java | 4 +-- .../portfolio/editoffer/EditOfferView.java | 4 +-- .../editoffer/EditOfferViewModel.java | 4 +-- .../failedtrades/FailedTradesViewModel.java | 6 ++--- .../openoffer/OpenOffersViewModel.java | 6 ++--- .../pendingtrades/PendingTradesView.java | 6 ++--- .../pendingtrades/PendingTradesViewModel.java | 6 ++--- .../steps/buyer/BuyerStep4View.java | 4 +-- .../presentation/MarketPricePresentation.java | 6 ++--- .../settings/network/NetworkSettingsView.java | 6 ++--- .../settings/network/P2pNetworkListItem.java | 6 ++--- .../settings/preferences/PreferencesView.java | 6 ++--- .../bisq/desktop/main/shared/ChatView.java | 6 ++--- .../main/support/dispute/DisputeView.java | 6 ++--- .../dispute/agent/DisputeAgentView.java | 4 +-- .../agent/arbitration/ArbitratorView.java | 4 +-- .../dispute/agent/mediation/MediatorView.java | 4 +-- .../dispute/agent/refund/RefundAgentView.java | 4 +-- .../dispute/client/DisputeClientView.java | 4 +-- .../arbitration/ArbitrationClientView.java | 4 +-- .../client/mediation/MediationClientView.java | 4 +-- .../client/refund/RefundClientView.java | 4 +-- .../java/bisq/desktop/util/DisplayUtils.java | 27 +++++++++---------- .../main/java/bisq/desktop/util/GUIUtil.java | 8 +++--- .../desktop/util/validation/BtcValidator.java | 6 ++--- .../createoffer/CreateOfferViewModelTest.java | 9 ++++--- .../editoffer/EditOfferDataModelTest.java | 3 ++- .../bisq/desktop/util/BSFormatterTest.java | 7 ++--- .../bisq/desktop/util/DisplayUtilsTest.java | 3 ++- 117 files changed, 317 insertions(+), 318 deletions(-) diff --git a/core/src/main/java/bisq/core/app/BisqSetup.java b/core/src/main/java/bisq/core/app/BisqSetup.java index 4b72f65ede7..1279032b1df 100644 --- a/core/src/main/java/bisq/core/app/BisqSetup.java +++ b/core/src/main/java/bisq/core/app/BisqSetup.java @@ -60,7 +60,7 @@ import bisq.core.trade.statistics.TradeStatisticsManager; import bisq.core.user.Preferences; import bisq.core.user.User; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.network.crypto.DecryptedDataTuple; import bisq.network.crypto.EncryptionService; @@ -184,7 +184,7 @@ default void onRequestWalletPassword() { private final AssetService assetService; private final TorSetup torSetup; private final TradeLimits tradeLimits; - private final BSFormatter formatter; + private final CoinFormatter formatter; @Setter @Nullable private Consumer displayTacHandler; @@ -270,7 +270,7 @@ public BisqSetup(P2PNetworkSetup p2PNetworkSetup, AssetService assetService, TorSetup torSetup, TradeLimits tradeLimits, - BSFormatter formatter) { + CoinFormatter formatter) { this.p2PNetworkSetup = p2PNetworkSetup; diff --git a/core/src/main/java/bisq/core/app/WalletAppSetup.java b/core/src/main/java/bisq/core/app/WalletAppSetup.java index 17c309b8229..6ce43b94e0b 100644 --- a/core/src/main/java/bisq/core/app/WalletAppSetup.java +++ b/core/src/main/java/bisq/core/app/WalletAppSetup.java @@ -22,8 +22,8 @@ import bisq.core.btc.wallet.WalletsManager; import bisq.core.locale.Res; import bisq.core.user.Preferences; -import bisq.core.util.BSFormatter; import bisq.core.util.FormattingUtils; +import bisq.core.util.coin.CoinFormatter; import org.bitcoinj.core.VersionMessage; import org.bitcoinj.store.BlockStoreException; @@ -59,7 +59,7 @@ public class WalletAppSetup { private final WalletsSetup walletsSetup; private final BisqEnvironment bisqEnvironment; private final Preferences preferences; - private final BSFormatter formatter; + private final CoinFormatter formatter; @SuppressWarnings("FieldCanBeLocal") private MonadicBinding btcInfoBinding; @@ -84,7 +84,7 @@ public WalletAppSetup(WalletsManager walletsManager, WalletsSetup walletsSetup, BisqEnvironment bisqEnvironment, Preferences preferences, - BSFormatter formatter) { + CoinFormatter formatter) { this.walletsManager = walletsManager; this.walletsSetup = walletsSetup; this.bisqEnvironment = bisqEnvironment; diff --git a/core/src/main/java/bisq/core/dao/presentation/DaoUtil.java b/core/src/main/java/bisq/core/dao/presentation/DaoUtil.java index 0cfb677c1de..bb251f564de 100644 --- a/core/src/main/java/bisq/core/dao/presentation/DaoUtil.java +++ b/core/src/main/java/bisq/core/dao/presentation/DaoUtil.java @@ -20,8 +20,8 @@ import bisq.core.dao.DaoFacade; import bisq.core.dao.state.model.governance.DaoPhase; import bisq.core.locale.Res; -import bisq.core.util.BSFormatter; import bisq.core.util.FormattingUtils; +import bisq.core.util.coin.CoinFormatter; import java.text.SimpleDateFormat; @@ -33,7 +33,7 @@ */ public class DaoUtil { - public static String getNextPhaseDuration(int height, DaoPhase.Phase phase, DaoFacade daoFacade, BSFormatter formatter) { + public static String getNextPhaseDuration(int height, DaoPhase.Phase phase, DaoFacade daoFacade, CoinFormatter formatter) { final int currentCycleDuration = daoFacade.getCurrentCycleDuration(); long start = daoFacade.getFirstBlockOfPhaseForDisplay(height, phase) + currentCycleDuration; long end = daoFacade.getLastBlockOfPhaseForDisplay(height, phase) + currentCycleDuration; @@ -47,7 +47,7 @@ public static String getNextPhaseDuration(int height, DaoPhase.Phase phase, DaoF return Res.get("dao.cycle.phaseDurationWithoutBlocks", start, end, startDateTime, endDateTime); } - public static String getPhaseDuration(int height, DaoPhase.Phase phase, DaoFacade daoFacade, BSFormatter formatter) { + public static String getPhaseDuration(int height, DaoPhase.Phase phase, DaoFacade daoFacade, CoinFormatter formatter) { long start = daoFacade.getFirstBlockOfPhaseForDisplay(height, phase); long end = daoFacade.getLastBlockOfPhaseForDisplay(height, phase); long duration = daoFacade.getDurationForPhaseForDisplay(phase); diff --git a/core/src/main/java/bisq/core/notifications/alerts/market/MarketAlerts.java b/core/src/main/java/bisq/core/notifications/alerts/market/MarketAlerts.java index 5ab49fbb2e4..2663cb46fc7 100644 --- a/core/src/main/java/bisq/core/notifications/alerts/market/MarketAlerts.java +++ b/core/src/main/java/bisq/core/notifications/alerts/market/MarketAlerts.java @@ -30,8 +30,8 @@ import bisq.core.provider.price.MarketPrice; import bisq.core.provider.price.PriceFeedService; import bisq.core.user.User; -import bisq.core.util.BSFormatter; import bisq.core.util.FormattingUtils; +import bisq.core.util.coin.CoinFormatter; import bisq.common.crypto.KeyRing; import bisq.common.util.MathUtils; @@ -54,11 +54,11 @@ public class MarketAlerts { private final User user; private final PriceFeedService priceFeedService; private final KeyRing keyRing; - private final BSFormatter formatter; + private final CoinFormatter formatter; @Inject public MarketAlerts(OfferBookService offerBookService, MobileNotificationService mobileNotificationService, - User user, PriceFeedService priceFeedService, KeyRing keyRing, BSFormatter formatter) { + User user, PriceFeedService priceFeedService, KeyRing keyRing, CoinFormatter formatter) { this.offerBookService = offerBookService; this.mobileNotificationService = mobileNotificationService; this.user = user; diff --git a/core/src/main/java/bisq/core/notifications/alerts/price/PriceAlert.java b/core/src/main/java/bisq/core/notifications/alerts/price/PriceAlert.java index 4d57f4dad65..6798b2c91d5 100644 --- a/core/src/main/java/bisq/core/notifications/alerts/price/PriceAlert.java +++ b/core/src/main/java/bisq/core/notifications/alerts/price/PriceAlert.java @@ -26,8 +26,8 @@ import bisq.core.provider.price.MarketPrice; import bisq.core.provider.price.PriceFeedService; import bisq.core.user.User; -import bisq.core.util.BSFormatter; import bisq.core.util.FormattingUtils; +import bisq.core.util.coin.CoinFormatter; import bisq.common.util.MathUtils; @@ -44,10 +44,10 @@ public class PriceAlert { private final PriceFeedService priceFeedService; private final MobileNotificationService mobileNotificationService; private final User user; - private final BSFormatter formatter; + private final CoinFormatter formatter; @Inject - public PriceAlert(PriceFeedService priceFeedService, MobileNotificationService mobileNotificationService, User user, BSFormatter formatter) { + public PriceAlert(PriceFeedService priceFeedService, MobileNotificationService mobileNotificationService, User user, CoinFormatter formatter) { this.priceFeedService = priceFeedService; this.user = user; this.mobileNotificationService = mobileNotificationService; diff --git a/core/src/main/java/bisq/core/presentation/BalancePresentation.java b/core/src/main/java/bisq/core/presentation/BalancePresentation.java index 3b42d19ac6a..3c66e90ad5d 100644 --- a/core/src/main/java/bisq/core/presentation/BalancePresentation.java +++ b/core/src/main/java/bisq/core/presentation/BalancePresentation.java @@ -18,7 +18,7 @@ package bisq.core.presentation; import bisq.core.btc.Balances; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import javax.inject.Inject; @@ -38,7 +38,7 @@ public class BalancePresentation { private final StringProperty lockedBalance = new SimpleStringProperty(); @Inject - public BalancePresentation(Balances balances, BSFormatter formatter) { + public BalancePresentation(Balances balances, CoinFormatter formatter) { balances.getAvailableBalance().addListener((observable, oldValue, newValue) -> { String value = formatter.formatCoinWithCode(newValue); // If we get full precision the BTC postfix breaks layout so we omit it diff --git a/desktop/src/main/java/bisq/desktop/components/BalanceTextField.java b/desktop/src/main/java/bisq/desktop/components/BalanceTextField.java index 4409ee39ef2..5ab785428f3 100644 --- a/desktop/src/main/java/bisq/desktop/components/BalanceTextField.java +++ b/desktop/src/main/java/bisq/desktop/components/BalanceTextField.java @@ -17,7 +17,7 @@ package bisq.desktop.components; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import org.bitcoinj.core.Coin; @@ -37,7 +37,7 @@ public class BalanceTextField extends AnchorPane { private final JFXTextField textField; private final Effect fundedEffect = new DropShadow(BlurType.THREE_PASS_BOX, Color.GREEN, 4, 0.0, 0, 0); private final Effect notFundedEffect = new DropShadow(BlurType.THREE_PASS_BOX, Color.ORANGERED, 4, 0.0, 0, 0); - private BSFormatter formatter; + private CoinFormatter formatter; @Nullable private Coin balance; @@ -60,7 +60,7 @@ public BalanceTextField(String label) { getChildren().addAll(textField); } - public void setFormatter(BSFormatter formatter) { + public void setFormatter(CoinFormatter formatter) { this.formatter = formatter; } diff --git a/desktop/src/main/java/bisq/desktop/components/BalanceWithConfirmationTextField.java b/desktop/src/main/java/bisq/desktop/components/BalanceWithConfirmationTextField.java index 17a6155bc64..7625cc7460e 100644 --- a/desktop/src/main/java/bisq/desktop/components/BalanceWithConfirmationTextField.java +++ b/desktop/src/main/java/bisq/desktop/components/BalanceWithConfirmationTextField.java @@ -23,7 +23,7 @@ import bisq.core.btc.listeners.AddressConfidenceListener; import bisq.core.btc.listeners.BalanceListener; import bisq.core.btc.wallet.BtcWalletService; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import org.bitcoinj.core.Address; import org.bitcoinj.core.Coin; @@ -56,7 +56,7 @@ public static void setWalletService(BtcWalletService walletService) { private final Effect fundedEffect = new DropShadow(BlurType.THREE_PASS_BOX, Color.GREEN, 4, 0.0, 0, 0); private final Effect notFundedEffect = new DropShadow(BlurType.THREE_PASS_BOX, Color.ORANGERED, 4, 0.0, 0, 0); - private BSFormatter formatter; + private CoinFormatter formatter; /////////////////////////////////////////////////////////////////////////////////////////// @@ -91,7 +91,7 @@ public void cleanup() { walletService.removeAddressConfidenceListener(confidenceListener); } - public void setup(Address address, BSFormatter formatter) { + public void setup(Address address, CoinFormatter formatter) { this.formatter = formatter; confidenceListener = new AddressConfidenceListener(address) { @Override diff --git a/desktop/src/main/java/bisq/desktop/components/PeerInfoIconSmall.java b/desktop/src/main/java/bisq/desktop/components/PeerInfoIconSmall.java index 1cd2331eda0..ca1afb51513 100644 --- a/desktop/src/main/java/bisq/desktop/components/PeerInfoIconSmall.java +++ b/desktop/src/main/java/bisq/desktop/components/PeerInfoIconSmall.java @@ -4,7 +4,7 @@ import bisq.core.alert.PrivateNotificationManager; import bisq.core.offer.Offer; import bisq.core.user.Preferences; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.network.p2p.NodeAddress; @@ -13,7 +13,7 @@ public PeerInfoIconSmall(NodeAddress nodeAddress, String role, Offer offer, Preferences preferences, AccountAgeWitnessService accountAgeWitnessService, - BSFormatter formatter, + CoinFormatter formatter, boolean useDevPrivilegeKeys) { // We don't want to show number of trades in that case as it would be unreadable. // Also we don't need the privateNotificationManager as no interaction will take place with this icon. diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/AdvancedCashForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/AdvancedCashForm.java index e605b48cfa5..f384b5a1c63 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/AdvancedCashForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/AdvancedCashForm.java @@ -29,7 +29,7 @@ import bisq.core.payment.PaymentAccount; import bisq.core.payment.payload.AdvancedCashAccountPayload; import bisq.core.payment.payload.PaymentAccountPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import bisq.common.util.Tuple2; @@ -63,7 +63,7 @@ public static int addFormForBuyer(GridPane gridPane, int gridRow, } public AdvancedCashForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, AdvancedCashValidator advancedCashValidator, - InputValidator inputValidator, GridPane gridPane, int gridRow, BSFormatter formatter) { + InputValidator inputValidator, GridPane gridPane, int gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); this.advancedCashAccount = (AdvancedCashAccount) paymentAccount; this.advancedCashValidator = advancedCashValidator; diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/AliPayForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/AliPayForm.java index 1d93e374f06..f29712a0f0f 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/AliPayForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/AliPayForm.java @@ -25,7 +25,7 @@ import bisq.core.payment.PaymentAccount; import bisq.core.payment.payload.AliPayAccountPayload; import bisq.core.payment.payload.PaymentAccountPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import javafx.scene.layout.GridPane; @@ -41,7 +41,7 @@ public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccount return gridRow; } - public AliPayForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, AliPayValidator aliPayValidator, InputValidator inputValidator, GridPane gridPane, int gridRow, BSFormatter formatter) { + public AliPayForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, AliPayValidator aliPayValidator, InputValidator inputValidator, GridPane gridPane, int gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); this.aliPayAccount = (AliPayAccount) paymentAccount; } diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/AssetsForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/AssetsForm.java index 9eb967bf738..6a4514cb9fb 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/AssetsForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/AssetsForm.java @@ -36,7 +36,7 @@ import bisq.core.payment.payload.PaymentAccountPayload; import bisq.core.payment.validation.AltCoinAddressValidator; import bisq.core.user.Preferences; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import bisq.common.util.Tuple3; @@ -86,7 +86,7 @@ public AssetsForm(PaymentAccount paymentAccount, InputValidator inputValidator, GridPane gridPane, int gridRow, - BSFormatter formatter, + CoinFormatter formatter, AssetService assetService, FilterManager filterManager, Preferences preferences) { diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/BankForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/BankForm.java index ad61e51f2eb..8e6b11b719b 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/BankForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/BankForm.java @@ -33,7 +33,7 @@ import bisq.core.payment.PaymentAccount; import bisq.core.payment.payload.BankAccountPayload; import bisq.core.payment.payload.PaymentAccountPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import bisq.common.util.Tuple2; @@ -167,7 +167,7 @@ static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccountPayload private Country selectedCountry; BankForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, InputValidator inputValidator, - GridPane gridPane, int gridRow, BSFormatter formatter) { + GridPane gridPane, int gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); this.bankAccountPayload = (BankAccountPayload) paymentAccount.paymentAccountPayload; } diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/CashDepositForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/CashDepositForm.java index 63b3d0a98a2..c48f20d77aa 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/CashDepositForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/CashDepositForm.java @@ -34,7 +34,7 @@ import bisq.core.payment.PaymentAccount; import bisq.core.payment.payload.CashDepositAccountPayload; import bisq.core.payment.payload.PaymentAccountPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import bisq.common.util.Tuple2; @@ -182,7 +182,7 @@ public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccount private Country selectedCountry; public CashDepositForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, InputValidator inputValidator, - GridPane gridPane, int gridRow, BSFormatter formatter) { + GridPane gridPane, int gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); this.cashDepositAccountPayload = (CashDepositAccountPayload) paymentAccount.paymentAccountPayload; diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/ChaseQuickPayForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/ChaseQuickPayForm.java index 77bc4f7eaec..67e7337ccc4 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/ChaseQuickPayForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/ChaseQuickPayForm.java @@ -29,7 +29,7 @@ import bisq.core.payment.PaymentAccount; import bisq.core.payment.payload.ChaseQuickPayAccountPayload; import bisq.core.payment.payload.PaymentAccountPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import javafx.scene.control.TextField; @@ -53,7 +53,7 @@ public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccount } public ChaseQuickPayForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, ChaseQuickPayValidator chaseQuickPayValidator, - InputValidator inputValidator, GridPane gridPane, int gridRow, BSFormatter formatter) { + InputValidator inputValidator, GridPane gridPane, int gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); this.chaseQuickPayAccount = (ChaseQuickPayAccount) paymentAccount; this.chaseQuickPayValidator = chaseQuickPayValidator; diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/ClearXchangeForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/ClearXchangeForm.java index 6dd50449a55..72ecbd4911c 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/ClearXchangeForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/ClearXchangeForm.java @@ -29,7 +29,7 @@ import bisq.core.payment.PaymentAccount; import bisq.core.payment.payload.ClearXchangeAccountPayload; import bisq.core.payment.payload.PaymentAccountPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import javafx.scene.control.TextField; @@ -52,7 +52,7 @@ public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccount return gridRow; } - public ClearXchangeForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, ClearXchangeValidator clearXchangeValidator, InputValidator inputValidator, GridPane gridPane, int gridRow, BSFormatter formatter) { + public ClearXchangeForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, ClearXchangeValidator clearXchangeValidator, InputValidator inputValidator, GridPane gridPane, int gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); this.clearXchangeAccount = (ClearXchangeAccount) paymentAccount; this.clearXchangeValidator = clearXchangeValidator; diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/F2FForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/F2FForm.java index 10f10f2e7da..6f2e7a8613f 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/F2FForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/F2FForm.java @@ -36,7 +36,7 @@ import bisq.core.payment.PaymentAccount; import bisq.core.payment.payload.F2FAccountPayload; import bisq.core.payment.payload.PaymentAccountPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import bisq.common.util.Tuple2; @@ -74,7 +74,7 @@ public static int addFormForBuyer(GridPane gridPane, int gridRow, public F2FForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, F2FValidator f2fValidator, - InputValidator inputValidator, GridPane gridPane, int gridRow, BSFormatter formatter) { + InputValidator inputValidator, GridPane gridPane, int gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); this.f2fAccount = (F2FAccount) paymentAccount; diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/FasterPaymentsForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/FasterPaymentsForm.java index ad68a8f8dc1..7b0a9ff06dd 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/FasterPaymentsForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/FasterPaymentsForm.java @@ -30,7 +30,7 @@ import bisq.core.payment.PaymentAccount; import bisq.core.payment.payload.FasterPaymentsAccountPayload; import bisq.core.payment.payload.PaymentAccountPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import javafx.scene.control.TextField; @@ -58,7 +58,7 @@ public static int addFormForBuyer(GridPane gridPane, int gridRow, private InputTextField sortCodeInputTextField; public FasterPaymentsForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, InputValidator inputValidator, GridPane gridPane, - int gridRow, BSFormatter formatter) { + int gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); this.fasterPaymentsAccount = (FasterPaymentsAccount) paymentAccount; } diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/GeneralAccountNumberForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/GeneralAccountNumberForm.java index 07a69a56731..8d620a09962 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/GeneralAccountNumberForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/GeneralAccountNumberForm.java @@ -8,7 +8,7 @@ import bisq.core.locale.TradeCurrency; import bisq.core.payment.PaymentAccount; import bisq.core.payment.payload.PaymentMethod; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import javafx.scene.control.TextField; @@ -22,7 +22,7 @@ public abstract class GeneralAccountNumberForm extends PaymentMethodForm { private InputTextField accountNrInputTextField; - GeneralAccountNumberForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, InputValidator inputValidator, GridPane gridPane, int gridRow, BSFormatter formatter) { + GeneralAccountNumberForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, InputValidator inputValidator, GridPane gridPane, int gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); } diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/GeneralBankForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/GeneralBankForm.java index 97f422964e8..2889abc1301 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/GeneralBankForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/GeneralBankForm.java @@ -11,7 +11,7 @@ import bisq.core.locale.Res; import bisq.core.payment.PaymentAccount; import bisq.core.payment.payload.CountryBasedPaymentAccountPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import org.apache.commons.lang3.StringUtils; @@ -38,7 +38,7 @@ public abstract class GeneralBankForm extends PaymentMethodForm { boolean accountNrInputTextFieldEdited; - public GeneralBankForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, InputValidator inputValidator, GridPane gridPane, int gridRow, BSFormatter formatter) { + public GeneralBankForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, InputValidator inputValidator, GridPane gridPane, int gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); } diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/GeneralSepaForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/GeneralSepaForm.java index 83a14f39234..1b9dc2f6953 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/GeneralSepaForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/GeneralSepaForm.java @@ -10,7 +10,7 @@ import bisq.core.locale.TradeCurrency; import bisq.core.payment.CountryBasedPaymentAccount; import bisq.core.payment.PaymentAccount; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import org.apache.commons.lang3.StringUtils; @@ -45,7 +45,7 @@ public abstract class GeneralSepaForm extends PaymentMethodForm { private ComboBox currencyComboBox; InputTextField ibanInputTextField; - GeneralSepaForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, InputValidator inputValidator, GridPane gridPane, int gridRow, BSFormatter formatter) { + GeneralSepaForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, InputValidator inputValidator, GridPane gridPane, int gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); } diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/HalCashForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/HalCashForm.java index 2aaff157a57..f0aa34ce70f 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/HalCashForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/HalCashForm.java @@ -29,7 +29,7 @@ import bisq.core.payment.PaymentAccount; import bisq.core.payment.payload.HalCashAccountPayload; import bisq.core.payment.payload.PaymentAccountPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import javafx.scene.control.TextField; @@ -51,7 +51,7 @@ public static int addFormForBuyer(GridPane gridPane, int gridRow, } public HalCashForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, HalCashValidator halCashValidator, - InputValidator inputValidator, GridPane gridPane, int gridRow, BSFormatter formatter) { + InputValidator inputValidator, GridPane gridPane, int gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); this.halCashAccount = (HalCashAccount) paymentAccount; this.halCashValidator = halCashValidator; diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/InteracETransferForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/InteracETransferForm.java index bbde09363fd..5a8fc6cea95 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/InteracETransferForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/InteracETransferForm.java @@ -29,7 +29,7 @@ import bisq.core.payment.PaymentAccount; import bisq.core.payment.payload.InteracETransferAccountPayload; import bisq.core.payment.payload.PaymentAccountPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import javafx.scene.layout.GridPane; @@ -57,7 +57,7 @@ public static int addFormForBuyer(GridPane gridPane, int gridRow, } public InteracETransferForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, InteracETransferValidator interacETransferValidator, - InputValidator inputValidator, GridPane gridPane, int gridRow, BSFormatter formatter) { + InputValidator inputValidator, GridPane gridPane, int gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); this.interacETransferAccount = (InteracETransferAccount) paymentAccount; this.interacETransferValidator = interacETransferValidator; diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/JapanBankTransferForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/JapanBankTransferForm.java index 6d9dd140c4a..bdf0e056fef 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/JapanBankTransferForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/JapanBankTransferForm.java @@ -36,7 +36,7 @@ import bisq.core.payment.PaymentAccount; import bisq.core.payment.payload.JapanBankAccountPayload; import bisq.core.payment.payload.PaymentAccountPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import bisq.common.util.Tuple2; @@ -96,7 +96,7 @@ public JapanBankTransferForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, JapanBankTransferValidator japanBankTransferValidator, InputValidator inputValidator, GridPane gridPane, - int gridRow, BSFormatter formatter) + int gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); this.japanBankAccount = (JapanBankAccount) paymentAccount; diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/MoneyBeamForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/MoneyBeamForm.java index 54f5b12e46b..6f20897395d 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/MoneyBeamForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/MoneyBeamForm.java @@ -29,7 +29,7 @@ import bisq.core.payment.PaymentAccount; import bisq.core.payment.payload.MoneyBeamAccountPayload; import bisq.core.payment.payload.PaymentAccountPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import javafx.scene.control.TextField; @@ -49,7 +49,7 @@ public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccount return gridRow; } - public MoneyBeamForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, MoneyBeamValidator moneyBeamValidator, InputValidator inputValidator, GridPane gridPane, int gridRow, BSFormatter formatter) { + public MoneyBeamForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, MoneyBeamValidator moneyBeamValidator, InputValidator inputValidator, GridPane gridPane, int gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); this.account = (MoneyBeamAccount) paymentAccount; this.validator = moneyBeamValidator; diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/MoneyGramForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/MoneyGramForm.java index 42855cf1266..799a79a35f8 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/MoneyGramForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/MoneyGramForm.java @@ -32,7 +32,7 @@ import bisq.core.payment.PaymentAccount; import bisq.core.payment.payload.MoneyGramAccountPayload; import bisq.core.payment.payload.PaymentAccountPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import bisq.common.util.Tuple2; @@ -74,7 +74,7 @@ public static int addFormForBuyer(GridPane gridPane, int gridRow, private final EmailValidator emailValidator; public MoneyGramForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, InputValidator inputValidator, - GridPane gridPane, int gridRow, BSFormatter formatter) { + GridPane gridPane, int gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); this.moneyGramAccountPayload = (MoneyGramAccountPayload) paymentAccount.paymentAccountPayload; diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/NationalBankForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/NationalBankForm.java index c0753c61af2..a6a37069c6b 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/NationalBankForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/NationalBankForm.java @@ -20,7 +20,7 @@ import bisq.core.account.witness.AccountAgeWitnessService; import bisq.core.payment.PaymentAccount; import bisq.core.payment.payload.PaymentAccountPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import javafx.scene.layout.GridPane; @@ -31,7 +31,7 @@ public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccount } public NationalBankForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, InputValidator inputValidator, - GridPane gridPane, int gridRow, BSFormatter formatter) { + GridPane gridPane, int gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); } } diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/PaymentMethodForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/PaymentMethodForm.java index 1b0aefe0044..abdd1e10158 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/PaymentMethodForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/PaymentMethodForm.java @@ -38,7 +38,7 @@ import bisq.core.payment.AssetAccount; import bisq.core.payment.PaymentAccount; import bisq.core.payment.payload.PaymentMethod; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import bisq.common.util.Tuple3; @@ -81,7 +81,7 @@ public abstract class PaymentMethodForm { protected final InputValidator inputValidator; protected final GridPane gridPane; protected int gridRow; - private final BSFormatter formatter; + private final CoinFormatter formatter; protected final BooleanProperty allInputsValid = new SimpleBooleanProperty(); protected int gridRowFrom; @@ -90,7 +90,7 @@ public abstract class PaymentMethodForm { protected ComboBox currencyComboBox; public PaymentMethodForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, - InputValidator inputValidator, GridPane gridPane, int gridRow, BSFormatter formatter) { + InputValidator inputValidator, GridPane gridPane, int gridRow, CoinFormatter formatter) { this.paymentAccount = paymentAccount; this.accountAgeWitnessService = accountAgeWitnessService; this.inputValidator = inputValidator; diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/PerfectMoneyForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/PerfectMoneyForm.java index 4e71a5a92ef..c54aeafd545 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/PerfectMoneyForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/PerfectMoneyForm.java @@ -26,7 +26,7 @@ import bisq.core.payment.PerfectMoneyAccount; import bisq.core.payment.payload.PaymentAccountPayload; import bisq.core.payment.payload.PerfectMoneyAccountPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import javafx.scene.layout.GridPane; @@ -45,7 +45,7 @@ public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccount } public PerfectMoneyForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, PerfectMoneyValidator perfectMoneyValidator, InputValidator inputValidator, GridPane gridPane, int - gridRow, BSFormatter formatter) { + gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); this.perfectMoneyAccount = (PerfectMoneyAccount) paymentAccount; } diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/PopmoneyForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/PopmoneyForm.java index 637427e7288..7265ff3a309 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/PopmoneyForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/PopmoneyForm.java @@ -29,7 +29,7 @@ import bisq.core.payment.PopmoneyAccount; import bisq.core.payment.payload.PaymentAccountPayload; import bisq.core.payment.payload.PopmoneyAccountPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import javafx.scene.control.TextField; @@ -51,7 +51,7 @@ public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccount return gridRow; } - public PopmoneyForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, PopmoneyValidator popmoneyValidator, InputValidator inputValidator, GridPane gridPane, int gridRow, BSFormatter formatter) { + public PopmoneyForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, PopmoneyValidator popmoneyValidator, InputValidator inputValidator, GridPane gridPane, int gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); this.account = (PopmoneyAccount) paymentAccount; this.validator = popmoneyValidator; diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/PromptPayForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/PromptPayForm.java index c5c5f47ff5e..3f5e02a37c4 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/PromptPayForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/PromptPayForm.java @@ -28,7 +28,7 @@ import bisq.core.payment.PromptPayAccount; import bisq.core.payment.payload.PaymentAccountPayload; import bisq.core.payment.payload.PromptPayAccountPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import javafx.scene.control.TextField; @@ -51,7 +51,7 @@ public static int addFormForBuyer(GridPane gridPane, int gridRow, } public PromptPayForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, PromptPayValidator promptPayValidator, - InputValidator inputValidator, GridPane gridPane, int gridRow, BSFormatter formatter) { + InputValidator inputValidator, GridPane gridPane, int gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); this.promptPayAccount = (PromptPayAccount) paymentAccount; this.promptPayValidator = promptPayValidator; diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/RevolutForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/RevolutForm.java index 06b12267526..a51943240b7 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/RevolutForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/RevolutForm.java @@ -29,7 +29,7 @@ import bisq.core.payment.RevolutAccount; import bisq.core.payment.payload.PaymentAccountPayload; import bisq.core.payment.payload.RevolutAccountPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import javafx.scene.control.TextField; @@ -64,7 +64,7 @@ private static String getTitle(String accountId) { public RevolutForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, RevolutValidator revolutValidator, InputValidator inputValidator, GridPane gridPane, - int gridRow, BSFormatter formatter) { + int gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); this.account = (RevolutAccount) paymentAccount; this.validator = revolutValidator; diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/SameBankForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/SameBankForm.java index 617e224f4c6..17ae884a29a 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/SameBankForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/SameBankForm.java @@ -20,7 +20,7 @@ import bisq.core.account.witness.AccountAgeWitnessService; import bisq.core.payment.PaymentAccount; import bisq.core.payment.payload.PaymentAccountPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import javafx.scene.layout.GridPane; @@ -32,7 +32,7 @@ public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccount } public SameBankForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, InputValidator inputValidator, - GridPane gridPane, int gridRow, BSFormatter formatter) { + GridPane gridPane, int gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); } } diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/SepaForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/SepaForm.java index fe9d2619f7c..5550e8470f4 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/SepaForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/SepaForm.java @@ -34,7 +34,7 @@ import bisq.core.payment.SepaAccount; import bisq.core.payment.payload.PaymentAccountPayload; import bisq.core.payment.payload.SepaAccountPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import javafx.scene.control.CheckBox; @@ -77,7 +77,7 @@ public static int addFormForBuyer(GridPane gridPane, int gridRow, public SepaForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, IBANValidator ibanValidator, BICValidator bicValidator, InputValidator inputValidator, - GridPane gridPane, int gridRow, BSFormatter formatter) { + GridPane gridPane, int gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); this.sepaAccount = (SepaAccount) paymentAccount; this.ibanValidator = ibanValidator; diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/SepaInstantForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/SepaInstantForm.java index 9d2149bfc37..7a15188f379 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/SepaInstantForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/SepaInstantForm.java @@ -34,7 +34,7 @@ import bisq.core.payment.SepaInstantAccount; import bisq.core.payment.payload.PaymentAccountPayload; import bisq.core.payment.payload.SepaInstantAccountPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import javafx.scene.control.CheckBox; @@ -77,7 +77,7 @@ public static int addFormForBuyer(GridPane gridPane, int gridRow, public SepaInstantForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, IBANValidator ibanValidator, BICValidator bicValidator, InputValidator inputValidator, - GridPane gridPane, int gridRow, BSFormatter formatter) { + GridPane gridPane, int gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); this.sepaInstantAccount = (SepaInstantAccount) paymentAccount; this.ibanValidator = ibanValidator; diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/SpecificBankForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/SpecificBankForm.java index 96bcb07a6ed..614053ebe02 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/SpecificBankForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/SpecificBankForm.java @@ -24,7 +24,7 @@ import bisq.core.payment.PaymentAccount; import bisq.core.payment.payload.PaymentAccountPayload; import bisq.core.payment.payload.SpecificBanksAccountPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import bisq.common.util.Tuple3; @@ -53,7 +53,7 @@ public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccount } public SpecificBankForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, InputValidator inputValidator, - GridPane gridPane, int gridRow, BSFormatter formatter) { + GridPane gridPane, int gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); this.specificBanksAccountPayload = (SpecificBanksAccountPayload) paymentAccount.paymentAccountPayload; } diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/SwishForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/SwishForm.java index 6f7880dbef5..cb138c84fc2 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/SwishForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/SwishForm.java @@ -29,7 +29,7 @@ import bisq.core.payment.SwishAccount; import bisq.core.payment.payload.PaymentAccountPayload; import bisq.core.payment.payload.SwishAccountPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import javafx.scene.control.TextField; @@ -53,7 +53,7 @@ public SwishForm(PaymentAccount paymentAccount, InputValidator inputValidator, GridPane gridPane, int gridRow, - BSFormatter formatter) { + CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); this.swishAccount = (SwishAccount) paymentAccount; this.swishValidator = swishValidator; diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/USPostalMoneyOrderForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/USPostalMoneyOrderForm.java index fbb988e8c6e..601cccc1858 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/USPostalMoneyOrderForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/USPostalMoneyOrderForm.java @@ -29,7 +29,7 @@ import bisq.core.payment.USPostalMoneyOrderAccount; import bisq.core.payment.payload.PaymentAccountPayload; import bisq.core.payment.payload.USPostalMoneyOrderAccountPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import javafx.scene.control.TextArea; @@ -56,7 +56,7 @@ public static int addFormForBuyer(GridPane gridPane, int gridRow, public USPostalMoneyOrderForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, USPostalMoneyOrderValidator usPostalMoneyOrderValidator, - InputValidator inputValidator, GridPane gridPane, int gridRow, BSFormatter formatter) { + InputValidator inputValidator, GridPane gridPane, int gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); this.usPostalMoneyOrderAccount = (USPostalMoneyOrderAccount) paymentAccount; this.usPostalMoneyOrderValidator = usPostalMoneyOrderValidator; diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/UpholdForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/UpholdForm.java index 1012d224a31..e3c4f03248b 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/UpholdForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/UpholdForm.java @@ -29,7 +29,7 @@ import bisq.core.payment.UpholdAccount; import bisq.core.payment.payload.PaymentAccountPayload; import bisq.core.payment.payload.UpholdAccountPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import javafx.scene.control.TextField; @@ -54,7 +54,7 @@ public static int addFormForBuyer(GridPane gridPane, int gridRow, public UpholdForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, UpholdValidator upholdValidator, InputValidator inputValidator, GridPane gridPane, - int gridRow, BSFormatter formatter) { + int gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); this.upholdAccount = (UpholdAccount) paymentAccount; this.upholdValidator = upholdValidator; diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/WeChatPayForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/WeChatPayForm.java index 60ba1bd3eee..8086e42f9af 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/WeChatPayForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/WeChatPayForm.java @@ -25,7 +25,7 @@ import bisq.core.payment.WeChatPayAccount; import bisq.core.payment.payload.PaymentAccountPayload; import bisq.core.payment.payload.WeChatPayAccountPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import javafx.scene.layout.GridPane; @@ -41,7 +41,7 @@ public static int addFormForBuyer(GridPane gridPane, int gridRow, PaymentAccount return gridRow; } - public WeChatPayForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, WeChatPayValidator weChatPayValidator, InputValidator inputValidator, GridPane gridPane, int gridRow, BSFormatter formatter) { + public WeChatPayForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, WeChatPayValidator weChatPayValidator, InputValidator inputValidator, GridPane gridPane, int gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); this.weChatPayAccount = (WeChatPayAccount) paymentAccount; } diff --git a/desktop/src/main/java/bisq/desktop/components/paymentmethods/WesternUnionForm.java b/desktop/src/main/java/bisq/desktop/components/paymentmethods/WesternUnionForm.java index 1526ece2842..b00ebdbe369 100644 --- a/desktop/src/main/java/bisq/desktop/components/paymentmethods/WesternUnionForm.java +++ b/desktop/src/main/java/bisq/desktop/components/paymentmethods/WesternUnionForm.java @@ -34,7 +34,7 @@ import bisq.core.payment.PaymentAccount; import bisq.core.payment.payload.PaymentAccountPayload; import bisq.core.payment.payload.WesternUnionAccountPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import bisq.common.util.Tuple2; @@ -76,7 +76,7 @@ public static int addFormForBuyer(GridPane gridPane, int gridRow, private Country selectedCountry; public WesternUnionForm(PaymentAccount paymentAccount, AccountAgeWitnessService accountAgeWitnessService, InputValidator inputValidator, - GridPane gridPane, int gridRow, BSFormatter formatter) { + GridPane gridPane, int gridRow, CoinFormatter formatter) { super(paymentAccount, accountAgeWitnessService, inputValidator, gridPane, gridRow, formatter); this.westernUnionAccountPayload = (WesternUnionAccountPayload) paymentAccount.paymentAccountPayload; diff --git a/desktop/src/main/java/bisq/desktop/main/MainView.java b/desktop/src/main/java/bisq/desktop/main/MainView.java index 4ea2030b9a7..5b6aa5ad408 100644 --- a/desktop/src/main/java/bisq/desktop/main/MainView.java +++ b/desktop/src/main/java/bisq/desktop/main/MainView.java @@ -47,7 +47,7 @@ import bisq.core.locale.GlobalSettings; import bisq.core.locale.LanguageUtil; import bisq.core.locale.Res; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.common.Timer; import bisq.common.UserThread; @@ -144,7 +144,7 @@ public static void removeEffect() { private final ViewLoader viewLoader; private final Navigation navigation; - private final BSFormatter formatter; + private final CoinFormatter formatter; private final ToggleGroup navButtons = new ToggleGroup(); private ChangeListener walletServiceErrorMsgListener; @@ -164,7 +164,7 @@ public MainView(MainViewModel model, CachingViewLoader viewLoader, Navigation navigation, Transitions transitions, - BSFormatter formatter, + CoinFormatter formatter, DaoStateMonitoringService daoStateMonitoringService) { super(model); this.viewLoader = viewLoader; diff --git a/desktop/src/main/java/bisq/desktop/main/account/content/altcoinaccounts/AltCoinAccountsView.java b/desktop/src/main/java/bisq/desktop/main/account/content/altcoinaccounts/AltCoinAccountsView.java index 1a639f90a27..2ef187d623a 100644 --- a/desktop/src/main/java/bisq/desktop/main/account/content/altcoinaccounts/AltCoinAccountsView.java +++ b/desktop/src/main/java/bisq/desktop/main/account/content/altcoinaccounts/AltCoinAccountsView.java @@ -38,7 +38,7 @@ import bisq.core.payment.payload.PaymentMethod; import bisq.core.payment.validation.AltCoinAddressValidator; import bisq.core.user.Preferences; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import bisq.asset.AltCoinAccountDisclaimer; @@ -75,7 +75,7 @@ public class AltCoinAccountsView extends PaymentAccountsView paymentMethodComboBox; private PaymentMethodForm paymentMethodForm; private TitledGroupBg accountTitledGroupBg; @@ -171,7 +171,7 @@ public FiatAccountsView(FiatAccountsViewModel model, PromptPayValidator promptPayValidator, AdvancedCashValidator advancedCashValidator, AccountAgeWitnessService accountAgeWitnessService, - BSFormatter formatter) { + CoinFormatter formatter) { super(model, accountAgeWitnessService); this.ibanValidator = ibanValidator; diff --git a/desktop/src/main/java/bisq/desktop/main/account/content/notifications/ManageMarketAlertsWindow.java b/desktop/src/main/java/bisq/desktop/main/account/content/notifications/ManageMarketAlertsWindow.java index b8818d85900..f6f2bba8c15 100644 --- a/desktop/src/main/java/bisq/desktop/main/account/content/notifications/ManageMarketAlertsWindow.java +++ b/desktop/src/main/java/bisq/desktop/main/account/content/notifications/ManageMarketAlertsWindow.java @@ -26,8 +26,8 @@ import bisq.core.locale.Res; import bisq.core.notifications.alerts.market.MarketAlertFilter; import bisq.core.notifications.alerts.market.MarketAlerts; -import bisq.core.util.BSFormatter; import bisq.core.util.FormattingUtils; +import bisq.core.util.coin.CoinFormatter; import bisq.common.UserThread; @@ -54,9 +54,9 @@ public class ManageMarketAlertsWindow extends Overlay { private final MarketAlerts marketAlerts; - private final BSFormatter formatter; + private final CoinFormatter formatter; - ManageMarketAlertsWindow(MarketAlerts marketAlerts, BSFormatter formatter) { + ManageMarketAlertsWindow(MarketAlerts marketAlerts, CoinFormatter formatter) { this.marketAlerts = marketAlerts; this.formatter = formatter; type = Type.Attention; diff --git a/desktop/src/main/java/bisq/desktop/main/account/content/notifications/MobileNotificationsView.java b/desktop/src/main/java/bisq/desktop/main/account/content/notifications/MobileNotificationsView.java index 469346f901f..91a860f8647 100644 --- a/desktop/src/main/java/bisq/desktop/main/account/content/notifications/MobileNotificationsView.java +++ b/desktop/src/main/java/bisq/desktop/main/account/content/notifications/MobileNotificationsView.java @@ -47,9 +47,9 @@ import bisq.core.provider.price.PriceFeedService; import bisq.core.user.Preferences; import bisq.core.user.User; -import bisq.core.util.BSFormatter; import bisq.core.util.FormattingUtils; import bisq.core.util.ParsingUtils; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import bisq.common.UserThread; @@ -90,7 +90,7 @@ public class MobileNotificationsView extends ActivatableView { private final PriceFeedService priceFeedService; private final MarketAlerts marketAlerts; private final MobileNotificationService mobileNotificationService; - private final BSFormatter formatter; + private final CoinFormatter formatter; private WebCamWindow webCamWindow; private QrCodeReader qrCodeReader; @@ -127,7 +127,7 @@ private MobileNotificationsView(Preferences preferences, PriceFeedService priceFeedService, MarketAlerts marketAlerts, MobileNotificationService mobileNotificationService, - BSFormatter formatter) { + CoinFormatter formatter) { super(); this.preferences = preferences; this.user = user; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/bonding/BondingViewUtils.java b/desktop/src/main/java/bisq/desktop/main/dao/bonding/BondingViewUtils.java index a5e56c88aaa..ae0c91fb37c 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/bonding/BondingViewUtils.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/bonding/BondingViewUtils.java @@ -36,6 +36,7 @@ import bisq.core.locale.Res; import bisq.core.util.BSFormatter; import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.coin.CoinUtil; import bisq.core.util.FormattingUtils; @@ -113,7 +114,7 @@ private void lockupBond(byte[] hash, Coin lockupAmount, int lockupTime, LockupRe Tuple2 miningFeeAndTxSize = daoFacade.getLockupTxMiningFeeAndTxSize(lockupAmount, lockupTime, lockupReason, hash); Coin miningFee = miningFeeAndTxSize.first; int txSize = miningFeeAndTxSize.second; - BSFormatter formatter = new BSFormatter(); + CoinFormatter formatter = new BSFormatter(); String duration = FormattingUtils.formatDurationAsWords(lockupTime * 10 * 60 * 1000L, false, false); new Popup<>().headLine(Res.get("dao.bond.reputation.lockup.headline")) .confirmation(Res.get("dao.bond.reputation.lockup.details", @@ -172,7 +173,7 @@ public void unLock(String lockupTxId, Consumer resultHandler) { Tuple2 miningFeeAndTxSize = daoFacade.getUnlockTxMiningFeeAndTxSize(lockupTxId); Coin miningFee = miningFeeAndTxSize.first; int txSize = miningFeeAndTxSize.second; - BSFormatter formatter = new BSFormatter(); + CoinFormatter formatter = new BSFormatter(); String duration = FormattingUtils.formatDurationAsWords(lockTime * 10 * 60 * 1000L, false, false); new Popup<>().headLine(Res.get("dao.bond.reputation.unlock.headline")) .confirmation(Res.get("dao.bond.reputation.unlock.details", diff --git a/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/assetfee/AssetFeeView.java b/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/assetfee/AssetFeeView.java index 1a40b35fa49..5269e39b877 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/assetfee/AssetFeeView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/assetfee/AssetFeeView.java @@ -34,9 +34,9 @@ import bisq.core.dao.governance.proposal.TxException; import bisq.core.locale.CurrencyUtil; import bisq.core.locale.Res; -import bisq.core.util.BSFormatter; import bisq.core.util.BsqFormatter; import bisq.core.util.ParsingUtils; +import bisq.core.util.coin.CoinFormatter; import bisq.common.app.DevEnv; @@ -86,7 +86,7 @@ public class AssetFeeView extends ActivatableView implements Bsq private final BsqWalletService bsqWalletService; private final BsqValidator bsqValidator; private final AssetService assetService; - private final BSFormatter btcFormatter; + private final CoinFormatter btcFormatter; private final ObservableList observableList = FXCollections.observableArrayList(); private final SortedList sortedList = new SortedList<>(observableList); @@ -109,7 +109,7 @@ private AssetFeeView(BsqFormatter bsqFormatter, BsqWalletService bsqWalletService, BsqValidator bsqValidator, AssetService assetService, - BSFormatter btcFormatter) { + CoinFormatter btcFormatter) { this.bsqFormatter = bsqFormatter; this.bsqWalletService = bsqWalletService; this.bsqValidator = bsqValidator; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/proofofburn/ProofOfBurnView.java b/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/proofofburn/ProofOfBurnView.java index 14ebdda11a6..8b6c6449195 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/proofofburn/ProofOfBurnView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/proofofburn/ProofOfBurnView.java @@ -37,9 +37,9 @@ import bisq.core.dao.governance.proposal.TxException; import bisq.core.locale.Res; import bisq.core.user.Preferences; -import bisq.core.util.BSFormatter; import bisq.core.util.BsqFormatter; import bisq.core.util.ParsingUtils; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import bisq.common.app.DevEnv; @@ -81,7 +81,7 @@ public class ProofOfBurnView extends ActivatableView implements private final ProofOfBurnService proofOfBurnService; private final MyProofOfBurnListService myProofOfBurnListService; private final Preferences preferences; - private final BSFormatter btcFormatter; + private final CoinFormatter btcFormatter; private final BsqFormatter bsqFormatter; private final BsqWalletService bsqWalletService; private final BsqValidator bsqValidator; @@ -116,7 +116,7 @@ private ProofOfBurnView(BsqFormatter bsqFormatter, ProofOfBurnService proofOfBurnService, MyProofOfBurnListService myProofOfBurnListService, Preferences preferences, - BSFormatter btcFormatter) { + CoinFormatter btcFormatter) { this.bsqFormatter = bsqFormatter; this.bsqWalletService = bsqWalletService; this.bsqValidator = bsqValidator; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/dashboard/GovernanceDashboardView.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/dashboard/GovernanceDashboardView.java index 8a691ff4a6e..10fbf808f8a 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/dashboard/GovernanceDashboardView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/dashboard/GovernanceDashboardView.java @@ -30,7 +30,7 @@ import bisq.core.dao.state.model.blockchain.Block; import bisq.core.dao.state.model.governance.DaoPhase; import bisq.core.locale.Res; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import javax.inject.Inject; @@ -48,7 +48,7 @@ public class GovernanceDashboardView extends ActivatableView imp private final DaoFacade daoFacade; private final PeriodService periodService; private final PhasesView phasesView; - private final BSFormatter formatter; + private final CoinFormatter formatter; private int gridRow = 0; private TextField currentPhaseTextField, currentBlockHeightTextField, proposalTextField, blindVoteTextField, voteRevealTextField, voteResultTextField; @@ -59,7 +59,7 @@ public class GovernanceDashboardView extends ActivatableView imp /////////////////////////////////////////////////////////////////////////////////////////// @Inject - public GovernanceDashboardView(DaoFacade daoFacade, PeriodService periodService, PhasesView phasesView, BSFormatter formatter) { + public GovernanceDashboardView(DaoFacade daoFacade, PeriodService periodService, PhasesView phasesView, CoinFormatter formatter) { this.daoFacade = daoFacade; this.periodService = periodService; this.phasesView = phasesView; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.java index 702f9a8410a..ae048ba8ac5 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.java @@ -50,9 +50,9 @@ import bisq.core.dao.state.model.governance.Proposal; import bisq.core.dao.state.model.governance.Role; import bisq.core.locale.Res; -import bisq.core.util.BSFormatter; import bisq.core.util.BsqFormatter; import bisq.core.util.ParsingUtils; +import bisq.core.util.coin.CoinFormatter; import bisq.asset.Asset; @@ -108,7 +108,7 @@ public class MakeProposalView extends ActivatableView implements private final P2PService p2PService; private final PhasesView phasesView; private final ChangeParamValidator changeParamValidator; - private final BSFormatter btcFormatter; + private final CoinFormatter btcFormatter; private final BsqFormatter bsqFormatter; private final Navigation navigation; private final BsqWalletService bsqWalletService; @@ -144,7 +144,7 @@ private MakeProposalView(DaoFacade daoFacade, BsqWalletService bsqWalletService, PhasesView phasesView, ChangeParamValidator changeParamValidator, - BSFormatter btcFormatter, + CoinFormatter btcFormatter, BsqFormatter bsqFormatter, Navigation navigation) { this.daoFacade = daoFacade; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java index 6fac36ab43d..1052ac26b01 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java @@ -53,9 +53,9 @@ import bisq.core.dao.state.model.governance.Vote; import bisq.core.locale.Res; import bisq.core.user.Preferences; -import bisq.core.util.BSFormatter; import bisq.core.util.BsqFormatter; import bisq.core.util.ParsingUtils; +import bisq.core.util.coin.CoinFormatter; import bisq.common.UserThread; import bisq.common.app.DevEnv; @@ -119,7 +119,7 @@ public class ProposalsView extends ActivatableView implements Bs private final MyBlindVoteListService myBlindVoteListService; private final Preferences preferences; private final BsqFormatter bsqFormatter; - private final BSFormatter btcFormatter; + private final CoinFormatter btcFormatter; private final SelectProposalWindow selectProposalWindow; private final ObservableList listItems = FXCollections.observableArrayList(); @@ -170,7 +170,7 @@ private ProposalsView(DaoFacade daoFacade, MyBlindVoteListService myBlindVoteListService, Preferences preferences, BsqFormatter bsqFormatter, - BSFormatter btcFormatter, + CoinFormatter btcFormatter, SelectProposalWindow selectProposalWindow) { this.daoFacade = daoFacade; this.bsqWalletService = bsqWalletService; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.java b/desktop/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.java index 1d67420fe1a..d3fc1d63e21 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.java @@ -44,7 +44,6 @@ import bisq.core.btc.wallet.WalletsManager; import bisq.core.dao.state.model.blockchain.TxType; import bisq.core.locale.Res; -import bisq.core.util.BSFormatter; import bisq.core.util.BsqFormatter; import bisq.core.util.coin.CoinFormatter; import bisq.core.util.coin.CoinUtil; @@ -78,7 +77,7 @@ public class BsqSendView extends ActivatableView implements BsqB private final WalletsSetup walletsSetup; private final P2PService p2PService; private final BsqFormatter bsqFormatter; - private final BSFormatter btcFormatter; + private final CoinFormatter btcFormatter; private final Navigation navigation; private final BsqBalanceUtil bsqBalanceUtil; private final BsqValidator bsqValidator; @@ -106,7 +105,7 @@ private BsqSendView(BsqWalletService bsqWalletService, WalletsSetup walletsSetup, P2PService p2PService, BsqFormatter bsqFormatter, - BSFormatter btcFormatter, + CoinFormatter btcFormatter, Navigation navigation, BsqBalanceUtil bsqBalanceUtil, BsqValidator bsqValidator, @@ -349,7 +348,7 @@ private void showPublishTxPopup(Coin receiverAmount, Coin miningFee, int txSize, String address, CoinFormatter amountFormatter, // can be BSQ or BTC formatter - BSFormatter feeFormatter, + CoinFormatter feeFormatter, ResultHandler resultHandler) { new Popup<>().headLine(Res.get("dao.wallet.send.sendFunds.headline")) .confirmation(Res.get("dao.wallet.send.sendFunds.details", diff --git a/desktop/src/main/java/bisq/desktop/main/funds/deposit/DepositListItem.java b/desktop/src/main/java/bisq/desktop/main/funds/deposit/DepositListItem.java index 93b71ad2b99..5c0706bedae 100644 --- a/desktop/src/main/java/bisq/desktop/main/funds/deposit/DepositListItem.java +++ b/desktop/src/main/java/bisq/desktop/main/funds/deposit/DepositListItem.java @@ -25,7 +25,7 @@ import bisq.core.btc.model.AddressEntry; import bisq.core.btc.wallet.BtcWalletService; import bisq.core.locale.Res; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import org.bitcoinj.core.Address; import org.bitcoinj.core.Coin; @@ -53,7 +53,7 @@ class DepositListItem { private TxConfidenceListener txConfidenceListener; private int numTxOutputs = 0; - public DepositListItem(AddressEntry addressEntry, BtcWalletService walletService, BSFormatter formatter) { + public DepositListItem(AddressEntry addressEntry, BtcWalletService walletService, CoinFormatter formatter) { this.walletService = walletService; addressString = addressEntry.getAddressString(); diff --git a/desktop/src/main/java/bisq/desktop/main/funds/deposit/DepositView.java b/desktop/src/main/java/bisq/desktop/main/funds/deposit/DepositView.java index 5df670497ba..7b6a2181a83 100644 --- a/desktop/src/main/java/bisq/desktop/main/funds/deposit/DepositView.java +++ b/desktop/src/main/java/bisq/desktop/main/funds/deposit/DepositView.java @@ -36,8 +36,8 @@ import bisq.core.locale.Res; import bisq.core.provider.fee.FeeService; import bisq.core.user.Preferences; -import bisq.core.util.BSFormatter; import bisq.core.util.ParsingUtils; +import bisq.core.util.coin.CoinFormatter; import bisq.common.UserThread; import bisq.common.app.DevEnv; @@ -106,7 +106,7 @@ public class DepositView extends ActivatableView { private final BtcWalletService walletService; private final Preferences preferences; - private final BSFormatter formatter; + private final CoinFormatter formatter; private String paymentLabelString; private final ObservableList observableList = FXCollections.observableArrayList(); private final SortedList sortedList = new SortedList<>(observableList); @@ -123,7 +123,7 @@ public class DepositView extends ActivatableView { private DepositView(BtcWalletService walletService, FeeService feeService, Preferences preferences, - BSFormatter formatter) { + CoinFormatter formatter) { this.walletService = walletService; this.preferences = preferences; this.formatter = formatter; diff --git a/desktop/src/main/java/bisq/desktop/main/funds/locked/LockedListItem.java b/desktop/src/main/java/bisq/desktop/main/funds/locked/LockedListItem.java index 1bbd53b836b..910521042f4 100644 --- a/desktop/src/main/java/bisq/desktop/main/funds/locked/LockedListItem.java +++ b/desktop/src/main/java/bisq/desktop/main/funds/locked/LockedListItem.java @@ -25,7 +25,7 @@ import bisq.core.btc.wallet.WalletService; import bisq.core.trade.Tradable; import bisq.core.trade.Trade; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import org.bitcoinj.core.Address; import org.bitcoinj.core.Coin; @@ -41,13 +41,13 @@ class LockedListItem { private final Trade trade; private final AddressEntry addressEntry; private final BtcWalletService btcWalletService; - private final BSFormatter formatter; + private final CoinFormatter formatter; private final String addressString; @Nullable private final Address address; private Coin balance; - public LockedListItem(Trade trade, AddressEntry addressEntry, BtcWalletService btcWalletService, BSFormatter formatter) { + public LockedListItem(Trade trade, AddressEntry addressEntry, BtcWalletService btcWalletService, CoinFormatter formatter) { this.trade = trade; this.addressEntry = addressEntry; this.btcWalletService = btcWalletService; diff --git a/desktop/src/main/java/bisq/desktop/main/funds/locked/LockedView.java b/desktop/src/main/java/bisq/desktop/main/funds/locked/LockedView.java index 84e55264806..f4dd5e8df8d 100644 --- a/desktop/src/main/java/bisq/desktop/main/funds/locked/LockedView.java +++ b/desktop/src/main/java/bisq/desktop/main/funds/locked/LockedView.java @@ -37,7 +37,7 @@ import bisq.core.trade.Trade; import bisq.core.trade.TradeManager; import bisq.core.user.Preferences; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import org.bitcoinj.core.Coin; import org.bitcoinj.core.Transaction; @@ -80,7 +80,7 @@ public class LockedView extends ActivatableView { private final TradeManager tradeManager; private final OpenOfferManager openOfferManager; private final Preferences preferences; - private final BSFormatter formatter; + private final CoinFormatter formatter; private final OfferDetailsWindow offerDetailsWindow; private final TradeDetailsWindow tradeDetailsWindow; private final ObservableList observableList = FXCollections.observableArrayList(); @@ -96,7 +96,7 @@ public class LockedView extends ActivatableView { @Inject private LockedView(BtcWalletService btcWalletService, TradeManager tradeManager, OpenOfferManager openOfferManager, Preferences preferences, - BSFormatter formatter, OfferDetailsWindow offerDetailsWindow, TradeDetailsWindow tradeDetailsWindow) { + CoinFormatter formatter, OfferDetailsWindow offerDetailsWindow, TradeDetailsWindow tradeDetailsWindow) { this.btcWalletService = btcWalletService; this.tradeManager = tradeManager; this.openOfferManager = openOfferManager; diff --git a/desktop/src/main/java/bisq/desktop/main/funds/reserved/ReservedListItem.java b/desktop/src/main/java/bisq/desktop/main/funds/reserved/ReservedListItem.java index 34cb41be4d2..4b36ce9f129 100644 --- a/desktop/src/main/java/bisq/desktop/main/funds/reserved/ReservedListItem.java +++ b/desktop/src/main/java/bisq/desktop/main/funds/reserved/ReservedListItem.java @@ -24,7 +24,7 @@ import bisq.core.btc.wallet.BtcWalletService; import bisq.core.offer.OpenOffer; import bisq.core.trade.Tradable; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import org.bitcoinj.core.Address; import org.bitcoinj.core.Coin; @@ -40,11 +40,11 @@ class ReservedListItem { private final OpenOffer openOffer; private final AddressEntry addressEntry; private final BtcWalletService btcWalletService; - private final BSFormatter formatter; + private final CoinFormatter formatter; private final String addressString; private Coin balance; - public ReservedListItem(OpenOffer openOffer, AddressEntry addressEntry, BtcWalletService btcWalletService, BSFormatter formatter) { + public ReservedListItem(OpenOffer openOffer, AddressEntry addressEntry, BtcWalletService btcWalletService, CoinFormatter formatter) { this.openOffer = openOffer; this.addressEntry = addressEntry; this.btcWalletService = btcWalletService; diff --git a/desktop/src/main/java/bisq/desktop/main/funds/reserved/ReservedView.java b/desktop/src/main/java/bisq/desktop/main/funds/reserved/ReservedView.java index cdfa2fe69f0..0c0e4e5aa67 100644 --- a/desktop/src/main/java/bisq/desktop/main/funds/reserved/ReservedView.java +++ b/desktop/src/main/java/bisq/desktop/main/funds/reserved/ReservedView.java @@ -37,7 +37,7 @@ import bisq.core.trade.Trade; import bisq.core.trade.TradeManager; import bisq.core.user.Preferences; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import org.bitcoinj.core.Coin; import org.bitcoinj.core.Transaction; @@ -80,7 +80,7 @@ public class ReservedView extends ActivatableView { private final TradeManager tradeManager; private final OpenOfferManager openOfferManager; private final Preferences preferences; - private final BSFormatter formatter; + private final CoinFormatter formatter; private final OfferDetailsWindow offerDetailsWindow; private final TradeDetailsWindow tradeDetailsWindow; private final ObservableList observableList = FXCollections.observableArrayList(); @@ -96,7 +96,7 @@ public class ReservedView extends ActivatableView { @Inject private ReservedView(BtcWalletService btcWalletService, TradeManager tradeManager, OpenOfferManager openOfferManager, Preferences preferences, - BSFormatter formatter, OfferDetailsWindow offerDetailsWindow, TradeDetailsWindow tradeDetailsWindow) { + CoinFormatter formatter, OfferDetailsWindow offerDetailsWindow, TradeDetailsWindow tradeDetailsWindow) { this.btcWalletService = btcWalletService; this.tradeManager = tradeManager; this.openOfferManager = openOfferManager; diff --git a/desktop/src/main/java/bisq/desktop/main/funds/transactions/TransactionListItemFactory.java b/desktop/src/main/java/bisq/desktop/main/funds/transactions/TransactionListItemFactory.java index 63ad288f1c1..2045a8bb52d 100644 --- a/desktop/src/main/java/bisq/desktop/main/funds/transactions/TransactionListItemFactory.java +++ b/desktop/src/main/java/bisq/desktop/main/funds/transactions/TransactionListItemFactory.java @@ -21,7 +21,7 @@ import bisq.core.btc.wallet.BtcWalletService; import bisq.core.dao.DaoFacade; import bisq.core.user.Preferences; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.common.crypto.PubKeyRing; @@ -39,7 +39,7 @@ public class TransactionListItemFactory { private final BsqWalletService bsqWalletService; private final DaoFacade daoFacade; private final PubKeyRing pubKeyRing; - private final BSFormatter formatter; + private final CoinFormatter formatter; private final Preferences preferences; @Inject @@ -47,7 +47,7 @@ public class TransactionListItemFactory { BsqWalletService bsqWalletService, DaoFacade daoFacade, PubKeyRing pubKeyRing, - BSFormatter formatter, + CoinFormatter formatter, Preferences preferences) { this.btcWalletService = btcWalletService; this.bsqWalletService = bsqWalletService; diff --git a/desktop/src/main/java/bisq/desktop/main/funds/transactions/TransactionsListItem.java b/desktop/src/main/java/bisq/desktop/main/funds/transactions/TransactionsListItem.java index 2dab2c11a93..ef18da24dc4 100644 --- a/desktop/src/main/java/bisq/desktop/main/funds/transactions/TransactionsListItem.java +++ b/desktop/src/main/java/bisq/desktop/main/funds/transactions/TransactionsListItem.java @@ -32,7 +32,7 @@ import bisq.core.offer.OpenOffer; import bisq.core.trade.Tradable; import bisq.core.trade.Trade; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.common.crypto.PubKeyRing; @@ -54,7 +54,7 @@ @Slf4j class TransactionsListItem { private final BtcWalletService btcWalletService; - private final BSFormatter formatter; + private final CoinFormatter formatter; private String dateString; private final Date date; private final String txId; @@ -90,7 +90,7 @@ class TransactionsListItem { TransactionAwareTradable transactionAwareTradable, DaoFacade daoFacade, PubKeyRing pubKeyRing, - BSFormatter formatter, + CoinFormatter formatter, long ignoreDustThreshold) { this.btcWalletService = btcWalletService; this.formatter = formatter; diff --git a/desktop/src/main/java/bisq/desktop/main/funds/transactions/TransactionsView.java b/desktop/src/main/java/bisq/desktop/main/funds/transactions/TransactionsView.java index a1ac3ac6aaa..3ca39ccb4f8 100644 --- a/desktop/src/main/java/bisq/desktop/main/funds/transactions/TransactionsView.java +++ b/desktop/src/main/java/bisq/desktop/main/funds/transactions/TransactionsView.java @@ -36,7 +36,7 @@ import bisq.core.trade.Tradable; import bisq.core.trade.Trade; import bisq.core.user.Preferences; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.network.p2p.P2PService; @@ -110,7 +110,7 @@ public class TransactionsView extends ActivatableView { private final BtcWalletService btcWalletService; private final P2PService p2PService; private final WalletsSetup walletsSetup; - private final BSFormatter formatter; + private final CoinFormatter formatter; private final Preferences preferences; private final TradeDetailsWindow tradeDetailsWindow; private final OfferDetailsWindow offerDetailsWindow; @@ -127,7 +127,7 @@ public class TransactionsView extends ActivatableView { private TransactionsView(BtcWalletService btcWalletService, P2PService p2PService, WalletsSetup walletsSetup, - BSFormatter formatter, + CoinFormatter formatter, Preferences preferences, TradeDetailsWindow tradeDetailsWindow, OfferDetailsWindow offerDetailsWindow, diff --git a/desktop/src/main/java/bisq/desktop/main/funds/withdrawal/WithdrawalListItem.java b/desktop/src/main/java/bisq/desktop/main/funds/withdrawal/WithdrawalListItem.java index acba8ef5bac..0aebe8e23ae 100644 --- a/desktop/src/main/java/bisq/desktop/main/funds/withdrawal/WithdrawalListItem.java +++ b/desktop/src/main/java/bisq/desktop/main/funds/withdrawal/WithdrawalListItem.java @@ -23,7 +23,7 @@ import bisq.core.btc.model.AddressEntry; import bisq.core.btc.wallet.BtcWalletService; import bisq.core.locale.Res; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import org.bitcoinj.core.Address; import org.bitcoinj.core.Coin; @@ -39,7 +39,7 @@ class WithdrawalListItem { private final Label balanceLabel; private final AddressEntry addressEntry; private final BtcWalletService walletService; - private final BSFormatter formatter; + private final CoinFormatter formatter; private Coin balance; private final String addressString; @Setter @@ -47,7 +47,7 @@ class WithdrawalListItem { private boolean isSelected; public WithdrawalListItem(AddressEntry addressEntry, BtcWalletService walletService, - BSFormatter formatter) { + CoinFormatter formatter) { this.addressEntry = addressEntry; this.walletService = walletService; this.formatter = formatter; diff --git a/desktop/src/main/java/bisq/desktop/main/funds/withdrawal/WithdrawalView.java b/desktop/src/main/java/bisq/desktop/main/funds/withdrawal/WithdrawalView.java index f3727ba566b..49d57bb571a 100644 --- a/desktop/src/main/java/bisq/desktop/main/funds/withdrawal/WithdrawalView.java +++ b/desktop/src/main/java/bisq/desktop/main/funds/withdrawal/WithdrawalView.java @@ -40,7 +40,7 @@ import bisq.core.trade.Trade; import bisq.core.trade.TradeManager; import bisq.core.user.Preferences; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.coin.CoinUtil; import bisq.core.util.ParsingUtils; import bisq.core.util.validation.BtcAddressValidator; @@ -126,7 +126,7 @@ public class WithdrawalView extends ActivatableView { private final TradeManager tradeManager; private final P2PService p2PService; private final WalletsSetup walletsSetup; - private final BSFormatter formatter; + private final CoinFormatter formatter; private final Preferences preferences; private final BtcAddressValidator btcAddressValidator; private final WalletPasswordWindow walletPasswordWindow; @@ -156,7 +156,7 @@ private WithdrawalView(BtcWalletService walletService, TradeManager tradeManager, P2PService p2PService, WalletsSetup walletsSetup, - BSFormatter formatter, + CoinFormatter formatter, Preferences preferences, BtcAddressValidator btcAddressValidator, WalletPasswordWindow walletPasswordWindow) { diff --git a/desktop/src/main/java/bisq/desktop/main/market/MarketView.java b/desktop/src/main/java/bisq/desktop/main/market/MarketView.java index d006f08e058..2c25a991bf1 100644 --- a/desktop/src/main/java/bisq/desktop/main/market/MarketView.java +++ b/desktop/src/main/java/bisq/desktop/main/market/MarketView.java @@ -36,8 +36,8 @@ import bisq.core.locale.Res; import bisq.core.offer.OfferPayload; import bisq.core.trade.statistics.TradeStatistics2; -import bisq.core.util.BSFormatter; import bisq.core.util.FormattingUtils; +import bisq.core.util.coin.CoinFormatter; import bisq.network.p2p.P2PService; @@ -72,7 +72,7 @@ public class MarketView extends ActivatableView { private final ViewLoader viewLoader; private final P2PService p2PService; private final OfferBook offerBook; - private final BSFormatter formatter; + private final CoinFormatter formatter; private final Navigation navigation; private Navigation.Listener navigationListener; private ChangeListener tabChangeListener; @@ -81,7 +81,7 @@ public class MarketView extends ActivatableView { @Inject - public MarketView(CachingViewLoader viewLoader, P2PService p2PService, OfferBook offerBook, BSFormatter formatter, + public MarketView(CachingViewLoader viewLoader, P2PService p2PService, OfferBook offerBook, CoinFormatter formatter, Navigation navigation) { this.viewLoader = viewLoader; this.p2PService = p2PService; diff --git a/desktop/src/main/java/bisq/desktop/main/market/offerbook/OfferBookChartView.java b/desktop/src/main/java/bisq/desktop/main/market/offerbook/OfferBookChartView.java index 68001d63e4d..f36806bef96 100644 --- a/desktop/src/main/java/bisq/desktop/main/market/offerbook/OfferBookChartView.java +++ b/desktop/src/main/java/bisq/desktop/main/market/offerbook/OfferBookChartView.java @@ -38,8 +38,8 @@ import bisq.core.locale.Res; import bisq.core.offer.Offer; import bisq.core.offer.OfferPayload; -import bisq.core.util.BSFormatter; import bisq.core.util.FormattingUtils; +import bisq.core.util.coin.CoinFormatter; import bisq.network.p2p.NodeAddress; @@ -103,7 +103,7 @@ public class OfferBookChartView extends ActivatableViewAndModel seriesBuy, seriesSell; private final Navigation navigation; - private final BSFormatter formatter; + private final CoinFormatter formatter; private TableView buyOfferTableView; private TableView sellOfferTableView; private AreaChart areaChart; @@ -134,7 +134,7 @@ public class OfferBookChartView extends ActivatableViewAndModel topBuyOfferList = FXCollections.observableArrayList(); private final ObservableList topSellOfferList = FXCollections.observableArrayList(); private final ChangeListener currenciesUpdatedListener; - private final BSFormatter formatter; + private final CoinFormatter formatter; private int selectedTabIndex; public final IntegerProperty maxPlacesForBuyPrice = new SimpleIntegerProperty(); public final IntegerProperty maxPlacesForBuyVolume = new SimpleIntegerProperty(); @@ -96,7 +96,7 @@ class OfferBookChartViewModel extends ActivatableViewModel { @SuppressWarnings("WeakerAccess") @Inject public OfferBookChartViewModel(OfferBook offerBook, Preferences preferences, PriceFeedService priceFeedService, - AccountAgeWitnessService accountAgeWitnessService, Navigation navigation, BSFormatter formatter) { + AccountAgeWitnessService accountAgeWitnessService, Navigation navigation, CoinFormatter formatter) { this.offerBook = offerBook; this.preferences = preferences; this.priceFeedService = priceFeedService; diff --git a/desktop/src/main/java/bisq/desktop/main/market/spread/SpreadView.java b/desktop/src/main/java/bisq/desktop/main/market/spread/SpreadView.java index 167d547d48c..c45381f7afc 100644 --- a/desktop/src/main/java/bisq/desktop/main/market/spread/SpreadView.java +++ b/desktop/src/main/java/bisq/desktop/main/market/spread/SpreadView.java @@ -26,7 +26,7 @@ import bisq.core.locale.CurrencyUtil; import bisq.core.locale.Res; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import org.bitcoinj.core.Coin; @@ -50,7 +50,7 @@ @FxmlView public class SpreadView extends ActivatableViewAndModel { - private final BSFormatter formatter; + private final CoinFormatter formatter; private TableView tableView; private SortedList sortedList; private ListChangeListener itemListChangeListener; @@ -61,7 +61,7 @@ public class SpreadView extends ActivatableViewAndModel offerBookListItems; private final ListChangeListener listChangeListener; final ObservableList spreadItems = FXCollections.observableArrayList(); @@ -74,7 +74,7 @@ class SpreadViewModel extends ActivatableViewModel { /////////////////////////////////////////////////////////////////////////////////////////// @Inject - public SpreadViewModel(OfferBook offerBook, PriceFeedService priceFeedService, BSFormatter formatter) { + public SpreadViewModel(OfferBook offerBook, PriceFeedService priceFeedService, CoinFormatter formatter) { this.offerBook = offerBook; this.priceFeedService = priceFeedService; this.formatter = formatter; diff --git a/desktop/src/main/java/bisq/desktop/main/market/trades/TradesChartsView.java b/desktop/src/main/java/bisq/desktop/main/market/trades/TradesChartsView.java index 275d2d5decf..1a73f65cd16 100644 --- a/desktop/src/main/java/bisq/desktop/main/market/trades/TradesChartsView.java +++ b/desktop/src/main/java/bisq/desktop/main/market/trades/TradesChartsView.java @@ -36,8 +36,8 @@ import bisq.core.monetary.Volume; import bisq.core.offer.OfferPayload; import bisq.core.trade.statistics.TradeStatistics2; -import bisq.core.util.BSFormatter; import bisq.core.util.FormattingUtils; +import bisq.core.util.coin.CoinFormatter; import bisq.common.UserThread; import bisq.common.util.MathUtils; @@ -100,7 +100,7 @@ @FxmlView public class TradesChartsView extends ActivatableViewAndModel { - private final BSFormatter formatter; + private final CoinFormatter formatter; private TableView tableView; private AutocompleteComboBox currencyComboBox; @@ -140,7 +140,7 @@ public class TradesChartsView extends ActivatableViewAndModel setChangeListener; final ObjectProperty selectedTradeCurrencyProperty = new SimpleObjectProperty<>(); @@ -121,7 +121,7 @@ public enum TickUnit { @SuppressWarnings("WeakerAccess") @Inject - public TradesChartsViewModel(TradeStatisticsManager tradeStatisticsManager, Preferences preferences, PriceFeedService priceFeedService, Navigation navigation, BSFormatter formatter) { + public TradesChartsViewModel(TradeStatisticsManager tradeStatisticsManager, Preferences preferences, PriceFeedService priceFeedService, Navigation navigation, CoinFormatter formatter) { this.tradeStatisticsManager = tradeStatisticsManager; this.preferences = preferences; this.priceFeedService = priceFeedService; diff --git a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferDataModel.java b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferDataModel.java index b555581d1e0..ef57b1604c7 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferDataModel.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferDataModel.java @@ -45,7 +45,7 @@ import bisq.core.trade.handlers.TransactionResultHandler; import bisq.core.user.Preferences; import bisq.core.user.User; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.coin.CoinUtil; import bisq.network.p2p.P2PService; @@ -94,7 +94,7 @@ public abstract class MutableOfferDataModel extends OfferDataModel implements Bs final String shortOfferId; private final AccountAgeWitnessService accountAgeWitnessService; private final FeeService feeService; - private final BSFormatter btcFormatter; + private final CoinFormatter btcFormatter; private final MakerFeeProvider makerFeeProvider; private final Navigation navigation; private final String offerId; @@ -140,7 +140,7 @@ public MutableOfferDataModel(CreateOfferService createOfferService, PriceFeedService priceFeedService, AccountAgeWitnessService accountAgeWitnessService, FeeService feeService, - BSFormatter btcFormatter, + CoinFormatter btcFormatter, MakerFeeProvider makerFeeProvider, Navigation navigation) { super(btcWalletService); diff --git a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java index a9535131c62..c8f24bcfa45 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java @@ -56,8 +56,8 @@ import bisq.core.payment.payload.PaymentMethod; import bisq.core.user.DontShowAgainLookup; import bisq.core.user.Preferences; -import bisq.core.util.BSFormatter; import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.common.UserThread; import bisq.common.app.DevEnv; @@ -127,7 +127,7 @@ public abstract class MutableOfferView> exten private final Preferences preferences; private final Transitions transitions; private final OfferDetailsWindow offerDetailsWindow; - private final BSFormatter btcFormatter; + private final CoinFormatter btcFormatter; private final BsqFormatter bsqFormatter; private ScrollPane scrollPane; @@ -185,7 +185,7 @@ public MutableOfferView(M model, Preferences preferences, Transitions transitions, OfferDetailsWindow offerDetailsWindow, - BSFormatter btcFormatter, + CoinFormatter btcFormatter, BsqFormatter bsqFormatter) { super(model); diff --git a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferViewModel.java b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferViewModel.java index 22aa8aa6347..76b7258eb69 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferViewModel.java @@ -51,10 +51,10 @@ import bisq.core.provider.price.MarketPrice; import bisq.core.provider.price.PriceFeedService; import bisq.core.user.Preferences; -import bisq.core.util.BSFormatter; import bisq.core.util.BsqFormatter; import bisq.core.util.FormattingUtils; import bisq.core.util.ParsingUtils; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import bisq.common.Timer; @@ -97,7 +97,7 @@ public abstract class MutableOfferViewModel ext private AccountAgeWitnessService accountAgeWitnessService; private final Navigation navigation; private final Preferences preferences; - protected final BSFormatter btcFormatter; + protected final CoinFormatter btcFormatter; private final BsqFormatter bsqFormatter; private final FiatVolumeValidator fiatVolumeValidator; private final FiatPriceValidator fiatPriceValidator; @@ -197,7 +197,7 @@ public MutableOfferViewModel(M dataModel, AccountAgeWitnessService accountAgeWitnessService, Navigation navigation, Preferences preferences, - BSFormatter btcFormatter, + CoinFormatter btcFormatter, BsqFormatter bsqFormatter) { super(dataModel); @@ -941,7 +941,7 @@ private void displayPriceOutOfRangePopup() { .show(); } - BSFormatter getBtcFormatter() { + CoinFormatter getBtcFormatter() { return btcFormatter; } @@ -1211,7 +1211,7 @@ private void stopTimeoutTimer() { } } - private BSFormatter getFormatterForMakerFee() { + private CoinFormatter getFormatterForMakerFee() { return dataModel.isCurrencyForMakerFeeBtc() ? btcFormatter : bsqFormatter; } diff --git a/desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferDataModel.java b/desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferDataModel.java index 361ee6694cb..ba92f8732e3 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferDataModel.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferDataModel.java @@ -34,7 +34,7 @@ import bisq.core.provider.price.PriceFeedService; import bisq.core.user.Preferences; import bisq.core.user.User; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.network.p2p.P2PService; @@ -58,7 +58,7 @@ public CreateOfferDataModel(CreateOfferService createOfferService, PriceFeedService priceFeedService, AccountAgeWitnessService accountAgeWitnessService, FeeService feeService, - BSFormatter btcFormatter, + CoinFormatter btcFormatter, MakerFeeProvider makerFeeProvider, Navigation navigation) { super(createOfferService, diff --git a/desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferView.java b/desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferView.java index f87ae6b6c1e..65e30561508 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferView.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferView.java @@ -24,8 +24,8 @@ import bisq.desktop.util.Transitions; import bisq.core.user.Preferences; -import bisq.core.util.BSFormatter; import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.CoinFormatter; import com.google.inject.Inject; @@ -33,7 +33,7 @@ public class CreateOfferView extends MutableOfferView { @Inject - public CreateOfferView(CreateOfferViewModel model, Navigation navigation, Preferences preferences, Transitions transitions, OfferDetailsWindow offerDetailsWindow, BSFormatter btcFormatter, BsqFormatter bsqFormatter) { + public CreateOfferView(CreateOfferViewModel model, Navigation navigation, Preferences preferences, Transitions transitions, OfferDetailsWindow offerDetailsWindow, CoinFormatter btcFormatter, BsqFormatter bsqFormatter) { super(model, navigation, preferences, transitions, offerDetailsWindow, btcFormatter, bsqFormatter); } } diff --git a/desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModel.java b/desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModel.java index 0736cc65385..114421bcfd7 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModel.java @@ -30,8 +30,8 @@ import bisq.core.account.witness.AccountAgeWitnessService; import bisq.core.provider.price.PriceFeedService; import bisq.core.user.Preferences; -import bisq.core.util.BSFormatter; import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.CoinFormatter; import com.google.inject.Inject; @@ -49,7 +49,7 @@ public CreateOfferViewModel(CreateOfferDataModel dataModel, AccountAgeWitnessService accountAgeWitnessService, Navigation navigation, Preferences preferences, - BSFormatter btcFormatter, + CoinFormatter btcFormatter, BsqFormatter bsqFormatter) { super(dataModel, fiatVolumeValidator, diff --git a/desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookView.java b/desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookView.java index 06c69fa7d49..b710a50a389 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookView.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookView.java @@ -56,7 +56,7 @@ import bisq.core.payment.PaymentAccount; import bisq.core.payment.payload.PaymentMethod; import bisq.core.user.DontShowAgainLookup; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.network.p2p.NodeAddress; @@ -120,7 +120,7 @@ public class OfferBookView extends ActivatableViewAndModel priceSortTypeProperty = new SimpleObjectProperty<>(); @@ -146,7 +146,7 @@ public OfferBookViewModel(User user, FilterManager filterManager, AccountAgeWitnessService accountAgeWitnessService, Navigation navigation, - BSFormatter btcFormatter, + CoinFormatter btcFormatter, BsqFormatter bsqFormatter) { super(); diff --git a/desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferView.java b/desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferView.java index 65b1ff64a99..4387b59749e 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferView.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferView.java @@ -54,8 +54,8 @@ import bisq.core.payment.PaymentAccount; import bisq.core.payment.payload.PaymentMethod; import bisq.core.user.DontShowAgainLookup; -import bisq.core.util.BSFormatter; import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.common.UserThread; import bisq.common.app.DevEnv; @@ -118,7 +118,7 @@ @FxmlView public class TakeOfferView extends ActivatableViewAndModel { private final Navigation navigation; - private final BSFormatter formatter; + private final CoinFormatter formatter; private final BsqFormatter bsqFormatter; private final OfferDetailsWindow offerDetailsWindow; private final Transitions transitions; @@ -172,7 +172,7 @@ public class TakeOfferView extends ActivatableViewAndModel im private final PriceFeedService priceFeedService; private AccountAgeWitnessService accountAgeWitnessService; private final Navigation navigation; - private final BSFormatter btcFormatter; + private final CoinFormatter btcFormatter; private final BsqFormatter bsqFormatter; private String amountRange; @@ -152,7 +152,7 @@ public TakeOfferViewModel(TakeOfferDataModel dataModel, PriceFeedService priceFeedService, AccountAgeWitnessService accountAgeWitnessService, Navigation navigation, - BSFormatter btcFormatter, + CoinFormatter btcFormatter, BsqFormatter bsqFormatter) { super(dataModel); this.dataModel = dataModel; @@ -665,7 +665,7 @@ private boolean isAmountEqualMinAmount(Coin amount) { // Getters /////////////////////////////////////////////////////////////////////////////////////////// - BSFormatter getBtcFormatter() { + CoinFormatter getBtcFormatter() { return btcFormatter; } @@ -788,7 +788,7 @@ public String getSellerSecurityDeposit() { return btcFormatter.formatCoin(dataModel.getSellerSecurityDeposit()); } - private BSFormatter getFormatterForTakerFee() { + private CoinFormatter getFormatterForTakerFee() { return dataModel.isCurrencyForTakerFeeBtc() ? btcFormatter : bsqFormatter; } diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/windows/ContractWindow.java b/desktop/src/main/java/bisq/desktop/main/overlays/windows/ContractWindow.java index 100f646714f..612f6a337cc 100644 --- a/desktop/src/main/java/bisq/desktop/main/overlays/windows/ContractWindow.java +++ b/desktop/src/main/java/bisq/desktop/main/overlays/windows/ContractWindow.java @@ -37,8 +37,8 @@ import bisq.core.support.dispute.mediation.MediationManager; import bisq.core.support.dispute.refund.RefundManager; import bisq.core.trade.Contract; -import bisq.core.util.BSFormatter; import bisq.core.util.FormattingUtils; +import bisq.core.util.coin.CoinFormatter; import bisq.network.p2p.NodeAddress; @@ -78,7 +78,7 @@ public class ContractWindow extends Overlay { private final MediationManager mediationManager; private final RefundManager refundManager; private final AccountAgeWitnessService accountAgeWitnessService; - private final BSFormatter formatter; + private final CoinFormatter formatter; private Dispute dispute; @@ -91,7 +91,7 @@ public ContractWindow(ArbitrationManager arbitrationManager, MediationManager mediationManager, RefundManager refundManager, AccountAgeWitnessService accountAgeWitnessService, - BSFormatter formatter) { + CoinFormatter formatter) { this.arbitrationManager = arbitrationManager; this.mediationManager = mediationManager; this.refundManager = refundManager; diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/windows/DisputeSummaryWindow.java b/desktop/src/main/java/bisq/desktop/main/overlays/windows/DisputeSummaryWindow.java index e8bba8fd9bd..5fecb6e0528 100644 --- a/desktop/src/main/java/bisq/desktop/main/overlays/windows/DisputeSummaryWindow.java +++ b/desktop/src/main/java/bisq/desktop/main/overlays/windows/DisputeSummaryWindow.java @@ -45,7 +45,7 @@ import bisq.core.support.dispute.mediation.MediationManager; import bisq.core.support.dispute.refund.RefundManager; import bisq.core.trade.Contract; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.coin.CoinUtil; import bisq.core.util.FormattingUtils; import bisq.core.util.ParsingUtils; @@ -97,7 +97,7 @@ public class DisputeSummaryWindow extends Overlay { private static final Logger log = LoggerFactory.getLogger(DisputeSummaryWindow.class); - private final BSFormatter formatter; + private final CoinFormatter formatter; private final MediationManager mediationManager; private final RefundManager refundManager; private final TradeWalletService tradeWalletService; @@ -131,7 +131,7 @@ public class DisputeSummaryWindow extends Overlay { /////////////////////////////////////////////////////////////////////////////////////////// @Inject - public DisputeSummaryWindow(BSFormatter formatter, + public DisputeSummaryWindow(CoinFormatter formatter, MediationManager mediationManager, RefundManager refundManager, TradeWalletService tradeWalletService, diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/windows/EmptyWalletWindow.java b/desktop/src/main/java/bisq/desktop/main/overlays/windows/EmptyWalletWindow.java index 239e64b0a69..eea2cb1ebe5 100644 --- a/desktop/src/main/java/bisq/desktop/main/overlays/windows/EmptyWalletWindow.java +++ b/desktop/src/main/java/bisq/desktop/main/overlays/windows/EmptyWalletWindow.java @@ -31,8 +31,8 @@ import bisq.core.btc.wallet.WalletService; import bisq.core.locale.Res; import bisq.core.offer.OpenOfferManager; -import bisq.core.util.BSFormatter; import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.network.p2p.P2PService; @@ -71,7 +71,7 @@ public class EmptyWalletWindow extends Overlay { private final WalletsSetup walletsSetup; private final BtcWalletService btcWalletService; private final BsqWalletService bsqWalletService; - private final BSFormatter btcFormatter; + private final CoinFormatter btcFormatter; private final BsqFormatter bsqFormatter; private final OpenOfferManager openOfferManager; @@ -92,7 +92,7 @@ public EmptyWalletWindow(WalletPasswordWindow walletPasswordWindow, WalletsSetup walletsSetup, BtcWalletService btcWalletService, BsqWalletService bsqWalletService, - BSFormatter btcFormatter, + CoinFormatter btcFormatter, BsqFormatter bsqFormatter) { this.walletPasswordWindow = walletPasswordWindow; this.openOfferManager = openOfferManager; @@ -250,7 +250,7 @@ private WalletService getWalletService() { return isBtc ? btcWalletService : bsqWalletService; } - private BSFormatter getFormatter() { + private CoinFormatter getFormatter() { return isBtc ? btcFormatter : bsqFormatter; } } diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/windows/OfferDetailsWindow.java b/desktop/src/main/java/bisq/desktop/main/overlays/windows/OfferDetailsWindow.java index 46e07bcc9e8..a2b0d768a4b 100644 --- a/desktop/src/main/java/bisq/desktop/main/overlays/windows/OfferDetailsWindow.java +++ b/desktop/src/main/java/bisq/desktop/main/overlays/windows/OfferDetailsWindow.java @@ -34,8 +34,8 @@ import bisq.core.payment.PaymentAccount; import bisq.core.payment.payload.PaymentMethod; import bisq.core.user.User; -import bisq.core.util.BSFormatter; import bisq.core.util.FormattingUtils; +import bisq.core.util.coin.CoinFormatter; import bisq.common.crypto.KeyRing; import bisq.common.util.Tuple2; @@ -69,7 +69,7 @@ public class OfferDetailsWindow extends Overlay { protected static final Logger log = LoggerFactory.getLogger(OfferDetailsWindow.class); - private final BSFormatter formatter; + private final CoinFormatter formatter; private final User user; private final KeyRing keyRing; private final Navigation navigation; @@ -86,7 +86,7 @@ public class OfferDetailsWindow extends Overlay { /////////////////////////////////////////////////////////////////////////////////////////// @Inject - public OfferDetailsWindow(BSFormatter formatter, User user, KeyRing keyRing, + public OfferDetailsWindow(CoinFormatter formatter, User user, KeyRing keyRing, Navigation navigation) { this.formatter = formatter; this.user = user; diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/windows/TradeDetailsWindow.java b/desktop/src/main/java/bisq/desktop/main/overlays/windows/TradeDetailsWindow.java index 78ed986af2b..fe6ebfd0c1e 100644 --- a/desktop/src/main/java/bisq/desktop/main/overlays/windows/TradeDetailsWindow.java +++ b/desktop/src/main/java/bisq/desktop/main/overlays/windows/TradeDetailsWindow.java @@ -33,8 +33,8 @@ import bisq.core.trade.Contract; import bisq.core.trade.Trade; import bisq.core.trade.TradeManager; -import bisq.core.util.BSFormatter; import bisq.core.util.FormattingUtils; +import bisq.core.util.coin.CoinFormatter; import bisq.network.p2p.NodeAddress; @@ -70,7 +70,7 @@ public class TradeDetailsWindow extends Overlay { protected static final Logger log = LoggerFactory.getLogger(TradeDetailsWindow.class); - private final BSFormatter formatter; + private final CoinFormatter formatter; private final ArbitrationManager arbitrationManager; private final TradeManager tradeManager; private final AccountAgeWitnessService accountAgeWitnessService; @@ -86,7 +86,7 @@ public class TradeDetailsWindow extends Overlay { /////////////////////////////////////////////////////////////////////////////////////////// @Inject - public TradeDetailsWindow(BSFormatter formatter, + public TradeDetailsWindow(CoinFormatter formatter, ArbitrationManager arbitrationManager, TradeManager tradeManager, AccountAgeWitnessService accountAgeWitnessService) { diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/closedtrades/ClosedTradesView.java b/desktop/src/main/java/bisq/desktop/main/portfolio/closedtrades/ClosedTradesView.java index 5a2d9f5d941..e8b1ddbf64f 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/closedtrades/ClosedTradesView.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/closedtrades/ClosedTradesView.java @@ -38,7 +38,7 @@ import bisq.core.trade.Tradable; import bisq.core.trade.Trade; import bisq.core.user.Preferences; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.network.p2p.NodeAddress; @@ -98,7 +98,7 @@ public class ClosedTradesView extends ActivatableViewAndModel sortedList; @@ -111,7 +111,7 @@ public ClosedTradesView(ClosedTradesViewModel model, Preferences preferences, TradeDetailsWindow tradeDetailsWindow, PrivateNotificationManager privateNotificationManager, - BSFormatter formatter, + CoinFormatter formatter, @Named(AppOptionKeys.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) { super(model); this.offerDetailsWindow = offerDetailsWindow; diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/closedtrades/ClosedTradesViewModel.java b/desktop/src/main/java/bisq/desktop/main/portfolio/closedtrades/ClosedTradesViewModel.java index f6f146ef59b..d3d4170a21f 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/closedtrades/ClosedTradesViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/closedtrades/ClosedTradesViewModel.java @@ -27,8 +27,8 @@ import bisq.core.offer.OpenOffer; import bisq.core.trade.Tradable; import bisq.core.trade.Trade; -import bisq.core.util.BSFormatter; import bisq.core.util.FormattingUtils; +import bisq.core.util.coin.CoinFormatter; import com.google.inject.Inject; @@ -37,13 +37,13 @@ import java.util.stream.Collectors; class ClosedTradesViewModel extends ActivatableWithDataModel implements ViewModel { - private final BSFormatter formatter; + private final CoinFormatter formatter; final AccountAgeWitnessService accountAgeWitnessService; @Inject public ClosedTradesViewModel(ClosedTradesDataModel dataModel, AccountAgeWitnessService accountAgeWitnessService, - BSFormatter formatter) { + CoinFormatter formatter) { super(dataModel); this.accountAgeWitnessService = accountAgeWitnessService; this.formatter = formatter; diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModel.java b/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModel.java index 3aba3f99ae5..d5d21f39ca7 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModel.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModel.java @@ -39,7 +39,7 @@ import bisq.core.provider.price.PriceFeedService; import bisq.core.user.Preferences; import bisq.core.user.User; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.coin.CoinUtil; import bisq.network.p2p.P2PService; @@ -68,7 +68,7 @@ class EditOfferDataModel extends MutableOfferDataModel { PriceFeedService priceFeedService, AccountAgeWitnessService accountAgeWitnessService, FeeService feeService, - BSFormatter btcFormatter, + CoinFormatter btcFormatter, CorePersistenceProtoResolver corePersistenceProtoResolver, MakerFeeProvider makerFeeProvider, Navigation navigation) { diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferView.java b/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferView.java index 4ff83ecba75..fcfe908698d 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferView.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferView.java @@ -30,8 +30,8 @@ import bisq.core.locale.Res; import bisq.core.offer.OpenOffer; import bisq.core.user.Preferences; -import bisq.core.util.BSFormatter; import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.common.util.Tuple4; @@ -61,7 +61,7 @@ public class EditOfferView extends MutableOfferView { /////////////////////////////////////////////////////////////////////////////////////////// @Inject - private EditOfferView(EditOfferViewModel model, Navigation navigation, Preferences preferences, Transitions transitions, OfferDetailsWindow offerDetailsWindow, BSFormatter btcFormatter, BsqFormatter bsqFormatter) { + private EditOfferView(EditOfferViewModel model, Navigation navigation, Preferences preferences, Transitions transitions, OfferDetailsWindow offerDetailsWindow, CoinFormatter btcFormatter, BsqFormatter bsqFormatter) { super(model, navigation, preferences, transitions, offerDetailsWindow, btcFormatter, bsqFormatter); } diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferViewModel.java b/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferViewModel.java index 0e82033f3c8..064548ba159 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferViewModel.java @@ -30,9 +30,9 @@ import bisq.core.offer.OpenOffer; import bisq.core.provider.price.PriceFeedService; import bisq.core.user.Preferences; -import bisq.core.util.BSFormatter; import bisq.core.util.BsqFormatter; import bisq.core.util.FormattingUtils; +import bisq.core.util.coin.CoinFormatter; import bisq.common.handlers.ErrorMessageHandler; import bisq.common.handlers.ResultHandler; @@ -53,7 +53,7 @@ public EditOfferViewModel(EditOfferDataModel dataModel, AccountAgeWitnessService accountAgeWitnessService, Navigation navigation, Preferences preferences, - BSFormatter btcFormatter, + CoinFormatter btcFormatter, BsqFormatter bsqFormatter) { super(dataModel, fiatVolumeValidator, diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/failedtrades/FailedTradesViewModel.java b/desktop/src/main/java/bisq/desktop/main/portfolio/failedtrades/FailedTradesViewModel.java index a3937f9c63c..2f4863020ae 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/failedtrades/FailedTradesViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/failedtrades/FailedTradesViewModel.java @@ -23,19 +23,19 @@ import bisq.core.locale.CurrencyUtil; import bisq.core.locale.Res; -import bisq.core.util.BSFormatter; import bisq.core.util.FormattingUtils; +import bisq.core.util.coin.CoinFormatter; import com.google.inject.Inject; import javafx.collections.ObservableList; class FailedTradesViewModel extends ActivatableWithDataModel implements ViewModel { - private final BSFormatter formatter; + private final CoinFormatter formatter; @Inject - public FailedTradesViewModel(FailedTradesDataModel dataModel, BSFormatter formatter) { + public FailedTradesViewModel(FailedTradesDataModel dataModel, CoinFormatter formatter) { super(dataModel); this.formatter = formatter; diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/openoffer/OpenOffersViewModel.java b/desktop/src/main/java/bisq/desktop/main/portfolio/openoffer/OpenOffersViewModel.java index 11241be9122..b1b18135855 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/openoffer/OpenOffersViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/openoffer/OpenOffersViewModel.java @@ -27,9 +27,9 @@ import bisq.core.monetary.Price; import bisq.core.offer.Offer; import bisq.core.offer.OpenOffer; -import bisq.core.util.BSFormatter; import bisq.core.util.BsqFormatter; import bisq.core.util.FormattingUtils; +import bisq.core.util.coin.CoinFormatter; import bisq.network.p2p.P2PService; @@ -42,14 +42,14 @@ class OpenOffersViewModel extends ActivatableWithDataModel implements ViewModel { private final P2PService p2PService; - private final BSFormatter btcFormatter; + private final CoinFormatter btcFormatter; private final BsqFormatter bsqFormatter; @Inject public OpenOffersViewModel(OpenOffersDataModel dataModel, P2PService p2PService, - BSFormatter btcFormatter, + CoinFormatter btcFormatter, BsqFormatter bsqFormatter) { super(dataModel); diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesView.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesView.java index 2af42d08957..b5bb960f668 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesView.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesView.java @@ -39,8 +39,8 @@ import bisq.core.support.traderchat.TraderChatManager; import bisq.core.trade.Trade; import bisq.core.user.Preferences; -import bisq.core.util.BSFormatter; import bisq.core.util.FormattingUtils; +import bisq.core.util.coin.CoinFormatter; import bisq.network.p2p.NodeAddress; @@ -100,7 +100,7 @@ public class PendingTradesView extends ActivatableViewAndModel { private final TradeDetailsWindow tradeDetailsWindow; - private final BSFormatter formatter; + private final CoinFormatter formatter; private final PrivateNotificationManager privateNotificationManager; private final boolean useDevPrivilegeKeys; private final Preferences preferences; @@ -139,7 +139,7 @@ public class PendingTradesView extends ActivatableViewAndModel priceFeedComboBoxItems = FXCollections.observableArrayList(); @@ -93,7 +93,7 @@ public MarketPricePresentation(BtcWalletService btcWalletService, PriceFeedService priceFeedService, Preferences preferences, FeeService feeService, - BSFormatter formatter) { + CoinFormatter formatter) { this.priceFeedService = priceFeedService; this.preferences = preferences; this.formatter = formatter; diff --git a/desktop/src/main/java/bisq/desktop/main/settings/network/NetworkSettingsView.java b/desktop/src/main/java/bisq/desktop/main/settings/network/NetworkSettingsView.java index 2c58462bce0..8b38ee57910 100644 --- a/desktop/src/main/java/bisq/desktop/main/settings/network/NetworkSettingsView.java +++ b/desktop/src/main/java/bisq/desktop/main/settings/network/NetworkSettingsView.java @@ -35,8 +35,8 @@ import bisq.core.filter.FilterManager; import bisq.core.locale.Res; import bisq.core.user.Preferences; -import bisq.core.util.BSFormatter; import bisq.core.util.FormattingUtils; +import bisq.core.util.coin.CoinFormatter; import bisq.network.p2p.P2PService; import bisq.network.p2p.network.Statistic; @@ -111,7 +111,7 @@ public class NetworkSettingsView extends ActivatableView { private final BisqEnvironment bisqEnvironment; private final TorNetworkSettingsWindow torNetworkSettingsWindow; private final ClockWatcher clockWatcher; - private final BSFormatter formatter; + private final CoinFormatter formatter; private final WalletsSetup walletsSetup; private final P2PService p2PService; @@ -142,7 +142,7 @@ public NetworkSettingsView(WalletsSetup walletsSetup, BisqEnvironment bisqEnvironment, TorNetworkSettingsWindow torNetworkSettingsWindow, ClockWatcher clockWatcher, - BSFormatter formatter) { + CoinFormatter formatter) { super(); this.walletsSetup = walletsSetup; this.p2PService = p2PService; diff --git a/desktop/src/main/java/bisq/desktop/main/settings/network/P2pNetworkListItem.java b/desktop/src/main/java/bisq/desktop/main/settings/network/P2pNetworkListItem.java index b43243838df..81f558de24d 100644 --- a/desktop/src/main/java/bisq/desktop/main/settings/network/P2pNetworkListItem.java +++ b/desktop/src/main/java/bisq/desktop/main/settings/network/P2pNetworkListItem.java @@ -20,8 +20,8 @@ import bisq.desktop.util.DisplayUtils; import bisq.core.locale.Res; -import bisq.core.util.BSFormatter; import bisq.core.util.FormattingUtils; +import bisq.core.util.coin.CoinFormatter; import bisq.network.p2p.network.Connection; import bisq.network.p2p.network.OutboundConnection; @@ -47,7 +47,7 @@ public class P2pNetworkListItem { private final Connection connection; private final Subscription sentBytesSubscription, receivedBytesSubscription, onionAddressSubscription, roundTripTimeSubscription; private final ClockWatcher clockWatcher; - private final BSFormatter formatter; + private final CoinFormatter formatter; private final StringProperty lastActivity = new SimpleStringProperty(); private final StringProperty sentBytes = new SimpleStringProperty(); @@ -58,7 +58,7 @@ public class P2pNetworkListItem { private final StringProperty onionAddress = new SimpleStringProperty(); private final ClockWatcher.Listener listener; - public P2pNetworkListItem(Connection connection, ClockWatcher clockWatcher, BSFormatter formatter) { + public P2pNetworkListItem(Connection connection, ClockWatcher clockWatcher, CoinFormatter formatter) { this.connection = connection; this.clockWatcher = clockWatcher; this.formatter = formatter; diff --git a/desktop/src/main/java/bisq/desktop/main/settings/preferences/PreferencesView.java b/desktop/src/main/java/bisq/desktop/main/settings/preferences/PreferencesView.java index 0c7bfb65b2e..723dd9c8016 100644 --- a/desktop/src/main/java/bisq/desktop/main/settings/preferences/PreferencesView.java +++ b/desktop/src/main/java/bisq/desktop/main/settings/preferences/PreferencesView.java @@ -46,9 +46,9 @@ import bisq.core.provider.fee.FeeService; import bisq.core.user.BlockChainExplorer; import bisq.core.user.Preferences; -import bisq.core.util.BSFormatter; import bisq.core.util.FormattingUtils; import bisq.core.util.ParsingUtils; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.IntegerValidator; import bisq.common.UserThread; @@ -122,7 +122,7 @@ public class PreferencesView extends ActivatableViewAndModel fiatCurrenciesListView; private ComboBox fiatCurrenciesComboBox; @@ -158,7 +158,7 @@ public PreferencesView(PreferencesViewModel model, AssetService assetService, FilterManager filterManager, DaoFacade daoFacade, - BSFormatter formatter, + CoinFormatter formatter, @Named(DaoOptionKeys.FULL_DAO_NODE) String fullDaoNode, @Named(DaoOptionKeys.RPC_USER) String rpcUser, @Named(DaoOptionKeys.RPC_PASSWORD) String rpcPassword, diff --git a/desktop/src/main/java/bisq/desktop/main/shared/ChatView.java b/desktop/src/main/java/bisq/desktop/main/shared/ChatView.java index de86265576f..71fe1a57c69 100644 --- a/desktop/src/main/java/bisq/desktop/main/shared/ChatView.java +++ b/desktop/src/main/java/bisq/desktop/main/shared/ChatView.java @@ -32,7 +32,7 @@ import bisq.core.support.SupportSession; import bisq.core.support.dispute.Attachment; import bisq.core.support.messages.ChatMessage; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.network.p2p.network.Connection; @@ -133,12 +133,12 @@ public class ChatView extends AnchorPane { private ChangeListener storedInMailboxPropertyListener, arrivedPropertyListener; private ChangeListener sendMessageErrorPropertyListener; - protected final BSFormatter formatter; + protected final CoinFormatter formatter; private EventHandler keyEventEventHandler; private SupportManager supportManager; private Optional optionalSupportSession = Optional.empty(); - public ChatView(SupportManager supportManager, BSFormatter formatter) { + public ChatView(SupportManager supportManager, CoinFormatter formatter) { this.supportManager = supportManager; this.formatter = formatter; allowAttachments = true; diff --git a/desktop/src/main/java/bisq/desktop/main/support/dispute/DisputeView.java b/desktop/src/main/java/bisq/desktop/main/support/dispute/DisputeView.java index 333fe0078a0..2b3fb0b47ac 100644 --- a/desktop/src/main/java/bisq/desktop/main/support/dispute/DisputeView.java +++ b/desktop/src/main/java/bisq/desktop/main/support/dispute/DisputeView.java @@ -45,7 +45,7 @@ import bisq.core.trade.Contract; import bisq.core.trade.Trade; import bisq.core.trade.TradeManager; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.network.p2p.NodeAddress; @@ -105,7 +105,7 @@ public abstract class DisputeView extends ActivatableView { protected final DisputeManager> disputeManager; protected final KeyRing keyRing; private final TradeManager tradeManager; - protected final BSFormatter formatter; + protected final CoinFormatter formatter; protected final DisputeSummaryWindow disputeSummaryWindow; private final PrivateNotificationManager privateNotificationManager; private final ContractWindow contractWindow; @@ -139,7 +139,7 @@ public abstract class DisputeView extends ActivatableView { public DisputeView(DisputeManager> disputeManager, KeyRing keyRing, TradeManager tradeManager, - BSFormatter formatter, + CoinFormatter formatter, DisputeSummaryWindow disputeSummaryWindow, PrivateNotificationManager privateNotificationManager, ContractWindow contractWindow, diff --git a/desktop/src/main/java/bisq/desktop/main/support/dispute/agent/DisputeAgentView.java b/desktop/src/main/java/bisq/desktop/main/support/dispute/agent/DisputeAgentView.java index 0ded420d501..6e0f08d62d5 100644 --- a/desktop/src/main/java/bisq/desktop/main/support/dispute/agent/DisputeAgentView.java +++ b/desktop/src/main/java/bisq/desktop/main/support/dispute/agent/DisputeAgentView.java @@ -34,7 +34,7 @@ import bisq.core.support.dispute.DisputeManager; import bisq.core.support.dispute.DisputeSession; import bisq.core.trade.TradeManager; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.common.crypto.KeyRing; @@ -48,7 +48,7 @@ public abstract class DisputeAgentView extends DisputeView { public DisputeAgentView(DisputeManager> disputeManager, KeyRing keyRing, TradeManager tradeManager, - BSFormatter formatter, + CoinFormatter formatter, DisputeSummaryWindow disputeSummaryWindow, PrivateNotificationManager privateNotificationManager, ContractWindow contractWindow, diff --git a/desktop/src/main/java/bisq/desktop/main/support/dispute/agent/arbitration/ArbitratorView.java b/desktop/src/main/java/bisq/desktop/main/support/dispute/agent/arbitration/ArbitratorView.java index a173b90fdee..bf12660412b 100644 --- a/desktop/src/main/java/bisq/desktop/main/support/dispute/agent/arbitration/ArbitratorView.java +++ b/desktop/src/main/java/bisq/desktop/main/support/dispute/agent/arbitration/ArbitratorView.java @@ -34,7 +34,7 @@ import bisq.core.support.dispute.arbitration.ArbitrationManager; import bisq.core.support.dispute.arbitration.ArbitrationSession; import bisq.core.trade.TradeManager; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.common.crypto.KeyRing; @@ -53,7 +53,7 @@ public class ArbitratorView extends DisputeAgentView { public ArbitratorView(ArbitrationManager arbitrationManager, KeyRing keyRing, TradeManager tradeManager, - BSFormatter formatter, + CoinFormatter formatter, DisputeSummaryWindow disputeSummaryWindow, PrivateNotificationManager privateNotificationManager, ContractWindow contractWindow, diff --git a/desktop/src/main/java/bisq/desktop/main/support/dispute/agent/mediation/MediatorView.java b/desktop/src/main/java/bisq/desktop/main/support/dispute/agent/mediation/MediatorView.java index f120f1482d5..8eec3397498 100644 --- a/desktop/src/main/java/bisq/desktop/main/support/dispute/agent/mediation/MediatorView.java +++ b/desktop/src/main/java/bisq/desktop/main/support/dispute/agent/mediation/MediatorView.java @@ -32,7 +32,7 @@ import bisq.core.support.dispute.mediation.MediationManager; import bisq.core.support.dispute.mediation.MediationSession; import bisq.core.trade.TradeManager; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.common.crypto.KeyRing; @@ -47,7 +47,7 @@ public class MediatorView extends DisputeAgentView { public MediatorView(MediationManager mediationManager, KeyRing keyRing, TradeManager tradeManager, - BSFormatter formatter, + CoinFormatter formatter, DisputeSummaryWindow disputeSummaryWindow, PrivateNotificationManager privateNotificationManager, ContractWindow contractWindow, diff --git a/desktop/src/main/java/bisq/desktop/main/support/dispute/agent/refund/RefundAgentView.java b/desktop/src/main/java/bisq/desktop/main/support/dispute/agent/refund/RefundAgentView.java index 3f34b2b9c23..4971de6ffe6 100644 --- a/desktop/src/main/java/bisq/desktop/main/support/dispute/agent/refund/RefundAgentView.java +++ b/desktop/src/main/java/bisq/desktop/main/support/dispute/agent/refund/RefundAgentView.java @@ -32,7 +32,7 @@ import bisq.core.support.dispute.refund.RefundManager; import bisq.core.support.dispute.refund.RefundSession; import bisq.core.trade.TradeManager; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.common.crypto.KeyRing; @@ -47,7 +47,7 @@ public class RefundAgentView extends DisputeAgentView { public RefundAgentView(RefundManager refundManager, KeyRing keyRing, TradeManager tradeManager, - BSFormatter formatter, + CoinFormatter formatter, DisputeSummaryWindow disputeSummaryWindow, PrivateNotificationManager privateNotificationManager, ContractWindow contractWindow, diff --git a/desktop/src/main/java/bisq/desktop/main/support/dispute/client/DisputeClientView.java b/desktop/src/main/java/bisq/desktop/main/support/dispute/client/DisputeClientView.java index 4575b2e5803..71bd01f0590 100644 --- a/desktop/src/main/java/bisq/desktop/main/support/dispute/client/DisputeClientView.java +++ b/desktop/src/main/java/bisq/desktop/main/support/dispute/client/DisputeClientView.java @@ -30,7 +30,7 @@ import bisq.core.support.dispute.DisputeManager; import bisq.core.support.dispute.DisputeSession; import bisq.core.trade.TradeManager; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.common.crypto.KeyRing; @@ -39,7 +39,7 @@ public abstract class DisputeClientView extends DisputeView { public DisputeClientView(DisputeManager> DisputeManager, KeyRing keyRing, TradeManager tradeManager, - BSFormatter formatter, + CoinFormatter formatter, DisputeSummaryWindow disputeSummaryWindow, PrivateNotificationManager privateNotificationManager, ContractWindow contractWindow, diff --git a/desktop/src/main/java/bisq/desktop/main/support/dispute/client/arbitration/ArbitrationClientView.java b/desktop/src/main/java/bisq/desktop/main/support/dispute/client/arbitration/ArbitrationClientView.java index 0b81ab83afc..4e81129eb93 100644 --- a/desktop/src/main/java/bisq/desktop/main/support/dispute/client/arbitration/ArbitrationClientView.java +++ b/desktop/src/main/java/bisq/desktop/main/support/dispute/client/arbitration/ArbitrationClientView.java @@ -32,7 +32,7 @@ import bisq.core.support.dispute.arbitration.ArbitrationManager; import bisq.core.support.dispute.arbitration.ArbitrationSession; import bisq.core.trade.TradeManager; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.common.crypto.KeyRing; @@ -46,7 +46,7 @@ public class ArbitrationClientView extends DisputeClientView { public ArbitrationClientView(ArbitrationManager arbitrationManager, KeyRing keyRing, TradeManager tradeManager, - BSFormatter formatter, + CoinFormatter formatter, DisputeSummaryWindow disputeSummaryWindow, PrivateNotificationManager privateNotificationManager, ContractWindow contractWindow, diff --git a/desktop/src/main/java/bisq/desktop/main/support/dispute/client/mediation/MediationClientView.java b/desktop/src/main/java/bisq/desktop/main/support/dispute/client/mediation/MediationClientView.java index 551fdef6680..04f5c85caab 100644 --- a/desktop/src/main/java/bisq/desktop/main/support/dispute/client/mediation/MediationClientView.java +++ b/desktop/src/main/java/bisq/desktop/main/support/dispute/client/mediation/MediationClientView.java @@ -32,7 +32,7 @@ import bisq.core.support.dispute.mediation.MediationManager; import bisq.core.support.dispute.mediation.MediationSession; import bisq.core.trade.TradeManager; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.common.crypto.KeyRing; @@ -46,7 +46,7 @@ public class MediationClientView extends DisputeClientView { public MediationClientView(MediationManager mediationManager, KeyRing keyRing, TradeManager tradeManager, - BSFormatter formatter, + CoinFormatter formatter, DisputeSummaryWindow disputeSummaryWindow, PrivateNotificationManager privateNotificationManager, ContractWindow contractWindow, diff --git a/desktop/src/main/java/bisq/desktop/main/support/dispute/client/refund/RefundClientView.java b/desktop/src/main/java/bisq/desktop/main/support/dispute/client/refund/RefundClientView.java index 91d5c75cd8c..b855aa40a7f 100644 --- a/desktop/src/main/java/bisq/desktop/main/support/dispute/client/refund/RefundClientView.java +++ b/desktop/src/main/java/bisq/desktop/main/support/dispute/client/refund/RefundClientView.java @@ -32,7 +32,7 @@ import bisq.core.support.dispute.refund.RefundManager; import bisq.core.support.dispute.refund.RefundSession; import bisq.core.trade.TradeManager; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.common.crypto.KeyRing; @@ -46,7 +46,7 @@ public class RefundClientView extends DisputeClientView { public RefundClientView(RefundManager refundManager, KeyRing keyRing, TradeManager tradeManager, - BSFormatter formatter, + CoinFormatter formatter, DisputeSummaryWindow disputeSummaryWindow, PrivateNotificationManager privateNotificationManager, ContractWindow contractWindow, diff --git a/desktop/src/main/java/bisq/desktop/util/DisplayUtils.java b/desktop/src/main/java/bisq/desktop/util/DisplayUtils.java index 7d5b8abe4ea..4fe981f11f3 100644 --- a/desktop/src/main/java/bisq/desktop/util/DisplayUtils.java +++ b/desktop/src/main/java/bisq/desktop/util/DisplayUtils.java @@ -8,7 +8,6 @@ import bisq.core.monetary.Volume; import bisq.core.offer.Offer; import bisq.core.offer.OfferPayload; -import bisq.core.util.BSFormatter; import bisq.core.util.coin.CoinFormatter; import bisq.core.util.FormattingUtils; import bisq.core.util.ParsingUtils; @@ -206,12 +205,12 @@ public static String getOfferDirectionForCreateOffer(OfferPayload.Direction dire // Amount /////////////////////////////////////////////////////////////////////////////////////////// - public static String formatAmount(Offer offer, BSFormatter formatter) { + public static String formatAmount(Offer offer, CoinFormatter formatter) { return formatAmount(offer, false, formatter); } - private static String formatAmount(Offer offer, boolean decimalAligned, BSFormatter bsFormatter) { - String formattedAmount = offer.isRange() ? bsFormatter.formatCoin(offer.getMinAmount()) + FormattingUtils.RANGE_SEPARATOR + bsFormatter.formatCoin(offer.getAmount()) : bsFormatter.formatCoin(offer.getAmount()); + private static String formatAmount(Offer offer, boolean decimalAligned, CoinFormatter coinFormatter) { + String formattedAmount = offer.isRange() ? coinFormatter.formatCoin(offer.getMinAmount()) + FormattingUtils.RANGE_SEPARATOR + coinFormatter.formatCoin(offer.getAmount()) : coinFormatter.formatCoin(offer.getAmount()); if (decimalAligned) { formattedAmount = FormattingUtils.fillUpPlacesWithEmptyStrings(formattedAmount, 15); } @@ -222,8 +221,8 @@ public static String formatAmount(Offer offer, int decimalPlaces, boolean decimalAligned, int maxPlaces, - BSFormatter bsFormatter) { - String formattedAmount = offer.isRange() ? bsFormatter.formatCoin(offer.getMinAmount(), decimalPlaces) + FormattingUtils.RANGE_SEPARATOR + bsFormatter.formatCoin(offer.getAmount(), decimalPlaces) : bsFormatter.formatCoin(offer.getAmount(), decimalPlaces); + CoinFormatter coinFormatter) { + String formattedAmount = offer.isRange() ? coinFormatter.formatCoin(offer.getMinAmount(), decimalPlaces) + FormattingUtils.RANGE_SEPARATOR + coinFormatter.formatCoin(offer.getAmount(), decimalPlaces) : coinFormatter.formatCoin(offer.getAmount(), decimalPlaces); if (decimalAligned) { formattedAmount = FormattingUtils.fillUpPlacesWithEmptyStrings(formattedAmount, maxPlaces); @@ -263,12 +262,12 @@ public static String getFeeWithFiatAmount(Coin makerFeeAsCoin, * 0.01235 -> 0.0124 * * @param input - * @param bsFormatter + * @param coinFormatter * @return */ - public static Coin parseToCoinWith4Decimals(String input, BSFormatter bsFormatter) { + public static Coin parseToCoinWith4Decimals(String input, CoinFormatter coinFormatter) { try { - return Coin.valueOf(new BigDecimal(ParsingUtils.parseToCoin(ParsingUtils.cleanDoubleInput(input), bsFormatter).value).setScale(-scale - 1, + return Coin.valueOf(new BigDecimal(ParsingUtils.parseToCoin(ParsingUtils.cleanDoubleInput(input), coinFormatter).value).setScale(-scale - 1, BigDecimal.ROUND_HALF_UP).setScale(scale + 1, BigDecimal.ROUND_HALF_UP).toBigInteger().longValue()); } catch (Throwable t) { if (input != null && input.length() > 0) @@ -277,18 +276,18 @@ public static Coin parseToCoinWith4Decimals(String input, BSFormatter bsFormatte } } - public static boolean hasBtcValidDecimals(String input, BSFormatter bsFormatter) { - return ParsingUtils.parseToCoin(input, bsFormatter).equals(parseToCoinWith4Decimals(input, bsFormatter)); + public static boolean hasBtcValidDecimals(String input, CoinFormatter coinFormatter) { + return ParsingUtils.parseToCoin(input, coinFormatter).equals(parseToCoinWith4Decimals(input, coinFormatter)); } /** * Transform a coin with the properties defined in the format (used to reduce decimal places) * * @param coin The coin which should be transformed - * @param bsFormatter + * @param coinFormatter * @return The transformed coin */ - public static Coin reduceTo4Decimals(Coin coin, BSFormatter bsFormatter) { - return ParsingUtils.parseToCoin(bsFormatter.formatCoin(coin), bsFormatter); + public static Coin reduceTo4Decimals(Coin coin, CoinFormatter coinFormatter) { + return ParsingUtils.parseToCoin(coinFormatter.formatCoin(coin), coinFormatter); } } diff --git a/desktop/src/main/java/bisq/desktop/util/GUIUtil.java b/desktop/src/main/java/bisq/desktop/util/GUIUtil.java index c38a8d82d84..ae86360876c 100644 --- a/desktop/src/main/java/bisq/desktop/util/GUIUtil.java +++ b/desktop/src/main/java/bisq/desktop/util/GUIUtil.java @@ -49,8 +49,8 @@ import bisq.core.user.DontShowAgainLookup; import bisq.core.user.Preferences; import bisq.core.user.User; -import bisq.core.util.BSFormatter; import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.coin.CoinUtil; import bisq.core.util.FormattingUtils; @@ -752,7 +752,7 @@ public static boolean canCreateOrTakeOfferOrShowPopup(User user, Navigation navi return true; } - public static void showWantToBurnBTCPopup(Coin miningFee, Coin amount, BSFormatter btcFormatter) { + public static void showWantToBurnBTCPopup(Coin miningFee, Coin amount, CoinFormatter btcFormatter) { new Popup<>().warning(Res.get("popup.warning.burnBTC", btcFormatter.formatCoinWithCode(miningFee), btcFormatter.formatCoinWithCode(amount))).show(); } @@ -904,7 +904,7 @@ public static void showBsqFeeInfoPopup(Coin fee, Coin btcForIssuance, int txSize, BsqFormatter bsqFormatter, - BSFormatter btcFormatter, + CoinFormatter btcFormatter, String type, Runnable actionHandler) { String confirmationMessage; @@ -937,7 +937,7 @@ public static void showBsqFeeInfoPopup(Coin fee, } public static void showBsqFeeInfoPopup(Coin fee, Coin miningFee, int txSize, BsqFormatter bsqFormatter, - BSFormatter btcFormatter, String type, + CoinFormatter btcFormatter, String type, Runnable actionHandler) { showBsqFeeInfoPopup(fee, miningFee, null, txSize, bsqFormatter, btcFormatter, type, actionHandler); } diff --git a/desktop/src/main/java/bisq/desktop/util/validation/BtcValidator.java b/desktop/src/main/java/bisq/desktop/util/validation/BtcValidator.java index d1b8d3d8173..730aa05575a 100644 --- a/desktop/src/main/java/bisq/desktop/util/validation/BtcValidator.java +++ b/desktop/src/main/java/bisq/desktop/util/validation/BtcValidator.java @@ -19,7 +19,7 @@ import bisq.core.btc.wallet.Restrictions; import bisq.core.locale.Res; -import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import org.bitcoinj.core.Coin; @@ -34,7 +34,7 @@ public class BtcValidator extends NumberValidator { - protected final BSFormatter formatter; + protected final CoinFormatter formatter; @Nullable @Setter @@ -50,7 +50,7 @@ public class BtcValidator extends NumberValidator { protected Coin maxTradeLimit; @Inject - public BtcValidator(BSFormatter formatter) { + public BtcValidator(CoinFormatter formatter) { this.formatter = formatter; } diff --git a/desktop/src/test/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModelTest.java b/desktop/src/test/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModelTest.java index 149f39a892b..1bfc03e9dbb 100644 --- a/desktop/src/test/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModelTest.java @@ -41,6 +41,7 @@ import bisq.core.user.User; import bisq.core.util.BSFormatter; import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import org.bitcoinj.core.Coin; @@ -75,8 +76,8 @@ public void setUp() { GlobalSettings.setDefaultTradeCurrency(btc); Res.setup(); - final BSFormatter bsFormatter = new BSFormatter(); - final BtcValidator btcValidator = new BtcValidator(bsFormatter); + final CoinFormatter coinFormatter = new BSFormatter(); + final BtcValidator btcValidator = new BtcValidator(coinFormatter); final AltcoinValidator altcoinValidator = new AltcoinValidator(); final FiatPriceValidator fiatPriceValidator = new FiatPriceValidator(); @@ -110,13 +111,13 @@ public void setUp() { CreateOfferDataModel dataModel = new CreateOfferDataModel(createOfferService, null, btcWalletService, bsqWalletService, empty, user, null, priceFeedService, accountAgeWitnessService, feeService, - bsFormatter, mock(MakerFeeProvider.class), null); + coinFormatter, mock(MakerFeeProvider.class), null); dataModel.initWithData(OfferPayload.Direction.BUY, new CryptoCurrency("BTC", "bitcoin")); dataModel.activate(); model = new CreateOfferViewModel(dataModel, null, fiatPriceValidator, altcoinValidator, btcValidator, null, securityDepositValidator, priceFeedService, null, null, - preferences, bsFormatter, bsqFormatter); + preferences, coinFormatter, bsqFormatter); model.activate(); } diff --git a/desktop/src/test/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModelTest.java b/desktop/src/test/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModelTest.java index 2ee6a5bfde4..d3cc59304f2 100644 --- a/desktop/src/test/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModelTest.java @@ -23,6 +23,7 @@ import bisq.core.user.User; import bisq.core.util.BSFormatter; import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; import org.bitcoinj.core.Coin; @@ -65,7 +66,7 @@ public void setUp() { GlobalSettings.setDefaultTradeCurrency(btc); Res.setup(); - final BSFormatter bsFormatter = new BSFormatter(); + final CoinFormatter coinFormatter = new BSFormatter(); FeeService feeService = mock(FeeService.class); AddressEntry addressEntry = mock(AddressEntry.class); diff --git a/desktop/src/test/java/bisq/desktop/util/BSFormatterTest.java b/desktop/src/test/java/bisq/desktop/util/BSFormatterTest.java index 1a1202c4b40..a8ca1ada7d8 100644 --- a/desktop/src/test/java/bisq/desktop/util/BSFormatterTest.java +++ b/desktop/src/test/java/bisq/desktop/util/BSFormatterTest.java @@ -19,18 +19,15 @@ import bisq.core.locale.Res; import bisq.core.util.BSFormatter; -import bisq.core.util.FormattingUtils; +import bisq.core.util.coin.CoinFormatter; import org.bitcoinj.core.CoinMaker; import java.util.Locale; -import java.util.concurrent.TimeUnit; import org.junit.Before; import org.junit.Test; -import static bisq.desktop.maker.PriceMaker.priceString; -import static bisq.desktop.maker.PriceMaker.usdPrice; import static com.natpryce.makeiteasy.MakeItEasy.a; import static com.natpryce.makeiteasy.MakeItEasy.make; import static com.natpryce.makeiteasy.MakeItEasy.with; @@ -42,7 +39,7 @@ public class BSFormatterTest { - private BSFormatter formatter; + private CoinFormatter formatter; @Before public void setUp() { diff --git a/desktop/src/test/java/bisq/desktop/util/DisplayUtilsTest.java b/desktop/src/test/java/bisq/desktop/util/DisplayUtilsTest.java index b19bb890c2e..4dd40551ec1 100644 --- a/desktop/src/test/java/bisq/desktop/util/DisplayUtilsTest.java +++ b/desktop/src/test/java/bisq/desktop/util/DisplayUtilsTest.java @@ -5,6 +5,7 @@ import bisq.core.offer.Offer; import bisq.core.offer.OfferPayload; import bisq.core.util.BSFormatter; +import bisq.core.util.coin.CoinFormatter; import org.bitcoinj.core.Coin; @@ -24,7 +25,7 @@ import static org.mockito.Mockito.when; public class DisplayUtilsTest { - private final BSFormatter formatter = new BSFormatter(); + private final CoinFormatter formatter = new BSFormatter(); @Before public void setUp() { From d23ae558e720b8a18e0d9d0381ba412bc31b64d7 Mon Sep 17 00:00:00 2001 From: Justin Carter Date: Tue, 19 Nov 2019 14:11:01 +0100 Subject: [PATCH 4/7] Rename BSFormatter to ImmutableCoinFormatter --- .../java/bisq/core/util/BsqFormatter.java | 46 +++++++++++-------- ...atter.java => ImmutableCoinFormatter.java} | 6 +-- .../main/dao/bonding/BondingViewUtils.java | 6 +-- .../economy/dashboard/BsqDashboardView.java | 1 - .../windows/SignPaymentAccountsWindow.java | 1 - .../validation/SecurityDepositValidator.java | 1 - .../java/bisq/desktop/GuiceSetupTest.java | 4 +- .../OfferBookChartViewModelTest.java | 22 ++++----- .../market/spread/SpreadViewModelTest.java | 8 ++-- .../trades/TradesChartsViewModelTest.java | 4 +- .../createoffer/CreateOfferViewModelTest.java | 4 +- .../offerbook/OfferBookViewModelTest.java | 24 +++++----- .../editoffer/EditOfferDataModelTest.java | 4 +- .../bisq/desktop/util/DisplayUtilsTest.java | 4 +- ...t.java => ImmutableCoinFormatterTest.java} | 6 +-- .../util/validation/BtcValidatorTest.java | 4 +- 16 files changed, 75 insertions(+), 70 deletions(-) rename core/src/main/java/bisq/core/util/{BSFormatter.java => ImmutableCoinFormatter.java} (94%) rename desktop/src/test/java/bisq/desktop/util/{BSFormatterTest.java => ImmutableCoinFormatterTest.java} (93%) diff --git a/core/src/main/java/bisq/core/util/BsqFormatter.java b/core/src/main/java/bisq/core/util/BsqFormatter.java index 32db6a3b3f0..475e0bf5909 100644 --- a/core/src/main/java/bisq/core/util/BsqFormatter.java +++ b/core/src/main/java/bisq/core/util/BsqFormatter.java @@ -43,6 +43,7 @@ import java.util.Locale; +import lombok.Getter; import lombok.extern.slf4j.Slf4j; import org.jetbrains.annotations.NotNull; @@ -50,27 +51,38 @@ @Slf4j @Singleton public class BsqFormatter implements CoinFormatter { + private final ImmutableCoinFormatter immutableCoinFormatter; + + // We don't support localized formatting. Format is always using "." as decimal mark and no grouping separator. + // Input of "," as decimal mark (like in german locale) will be replaced with ".". + // Input of a group separator (1,123,45) lead to an validation error. + // Note: BtcFormat was intended to be used, but it lead to many problems (automatic format to mBit, + // no way to remove grouping separator). It seems to be not optimal for user input formatting. + @Getter + private MonetaryFormat monetaryFormat; + + @SuppressWarnings("PointlessBooleanExpression") private static final boolean useBsqAddressFormat = true || !DevEnv.isDevMode(); private final String prefix = "B"; - private final BSFormatter bsFormatter; private DecimalFormat amountFormat; private DecimalFormat marketCapFormat; private final MonetaryFormat btcCoinFormat; @Inject public BsqFormatter() { - bsFormatter = new BSFormatter(); + this.monetaryFormat = BisqEnvironment.getParameters().getMonetaryFormat(); + this.immutableCoinFormatter = new ImmutableCoinFormatter(); - GlobalSettings.localeProperty().addListener((observable, oldValue, newValue) -> setFormatter(newValue)); - setFormatter(GlobalSettings.getLocale()); + GlobalSettings.localeProperty().addListener((observable, oldValue, newValue) -> switchLocale(newValue)); + switchLocale(GlobalSettings.getLocale()); - btcCoinFormat = bsFormatter.monetaryFormat; + btcCoinFormat = monetaryFormat; final String baseCurrencyCode = BisqEnvironment.getBaseCurrencyNetwork().getCurrencyCode(); switch (baseCurrencyCode) { case "BTC": - bsFormatter.monetaryFormat = new MonetaryFormat().shift(6).code(6, "BSQ").minDecimals(2); + monetaryFormat = new MonetaryFormat().shift(6).code(6, "BSQ").minDecimals(2); break; default: throw new RuntimeException("baseCurrencyCode not defined. baseCurrencyCode=" + baseCurrencyCode); @@ -79,7 +91,7 @@ public BsqFormatter() { amountFormat.setMinimumFractionDigits(2); } - private void setFormatter(Locale locale) { + private void switchLocale(Locale locale) { amountFormat = (DecimalFormat) NumberFormat.getNumberInstance(locale); amountFormat.setMinimumFractionDigits(2); amountFormat.setMaximumFractionDigits(2); @@ -127,11 +139,11 @@ public String formatMarketCap(MarketPrice bsqPriceMarketPrice, MarketPrice fiatM } public String formatBSQSatoshis(long satoshi) { - return FormattingUtils.formatCoin(satoshi, bsFormatter.monetaryFormat); + return FormattingUtils.formatCoin(satoshi, monetaryFormat); } public String formatBSQSatoshisWithCode(long satoshi) { - return FormattingUtils.formatCoinWithCode(satoshi, bsFormatter.monetaryFormat); + return FormattingUtils.formatCoinWithCode(satoshi, monetaryFormat); } public String formatBTCSatoshis(long satoshi) { @@ -159,7 +171,7 @@ public void validateBtcInput(String input) throws ProposalValidationException { } public void validateBsqInput(String input) throws ProposalValidationException { - validateCoinInput(input, bsFormatter.monetaryFormat); + validateCoinInput(input, monetaryFormat); } private void validateCoinInput(String input, MonetaryFormat coinFormat) throws ProposalValidationException { @@ -236,30 +248,26 @@ public String parseParamValueToString(Param param, String inputValue) throws Pro } public String formatCoin(Coin coin) { - return bsFormatter.formatCoin(coin); + return immutableCoinFormatter.formatCoin(coin); } @NotNull public String formatCoin(Coin coin, int decimalPlaces) { - return bsFormatter.formatCoin(coin, decimalPlaces); + return immutableCoinFormatter.formatCoin(coin, decimalPlaces); } public String formatCoin(Coin coin, int decimalPlaces, boolean decimalAligned, int maxNumberOfDigits) { - return bsFormatter.formatCoin(coin, decimalPlaces, decimalAligned, maxNumberOfDigits); + return immutableCoinFormatter.formatCoin(coin, decimalPlaces, decimalAligned, maxNumberOfDigits); } public String formatCoinWithCode(Coin coin) { - return bsFormatter.formatCoinWithCode(coin); + return immutableCoinFormatter.formatCoinWithCode(coin); } public String formatCoinWithCode(long value) { - return bsFormatter.formatCoinWithCode(value); - } - - public MonetaryFormat getMonetaryFormat() { - return bsFormatter.getMonetaryFormat(); + return immutableCoinFormatter.formatCoinWithCode(value); } } diff --git a/core/src/main/java/bisq/core/util/BSFormatter.java b/core/src/main/java/bisq/core/util/ImmutableCoinFormatter.java similarity index 94% rename from core/src/main/java/bisq/core/util/BSFormatter.java rename to core/src/main/java/bisq/core/util/ImmutableCoinFormatter.java index 1906a1a48b0..b7748b82f50 100644 --- a/core/src/main/java/bisq/core/util/BSFormatter.java +++ b/core/src/main/java/bisq/core/util/ImmutableCoinFormatter.java @@ -33,7 +33,7 @@ @Slf4j @Singleton -public class BSFormatter implements CoinFormatter { +public class ImmutableCoinFormatter implements CoinFormatter { // We don't support localized formatting. Format is always using "." as decimal mark and no grouping separator. // Input of "," as decimal mark (like in german locale) will be replaced with ".". @@ -41,13 +41,13 @@ public class BSFormatter implements CoinFormatter { // Note: BtcFormat was intended to be used, but it lead to many problems (automatic format to mBit, // no way to remove grouping separator). It seems to be not optimal for user input formatting. @Getter - protected MonetaryFormat monetaryFormat; + private MonetaryFormat monetaryFormat; // protected String currencyCode = CurrencyUtil.getDefaultFiatCurrencyAsCode(); @Inject - public BSFormatter() { + public ImmutableCoinFormatter() { monetaryFormat = BisqEnvironment.getParameters().getMonetaryFormat(); } diff --git a/desktop/src/main/java/bisq/desktop/main/dao/bonding/BondingViewUtils.java b/desktop/src/main/java/bisq/desktop/main/dao/bonding/BondingViewUtils.java index ae0c91fb37c..6581c39aa8a 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/bonding/BondingViewUtils.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/bonding/BondingViewUtils.java @@ -34,7 +34,7 @@ import bisq.core.dao.state.model.governance.Role; import bisq.core.dao.state.model.governance.RoleProposal; import bisq.core.locale.Res; -import bisq.core.util.BSFormatter; +import bisq.core.util.ImmutableCoinFormatter; import bisq.core.util.BsqFormatter; import bisq.core.util.coin.CoinFormatter; import bisq.core.util.coin.CoinUtil; @@ -114,7 +114,7 @@ private void lockupBond(byte[] hash, Coin lockupAmount, int lockupTime, LockupRe Tuple2 miningFeeAndTxSize = daoFacade.getLockupTxMiningFeeAndTxSize(lockupAmount, lockupTime, lockupReason, hash); Coin miningFee = miningFeeAndTxSize.first; int txSize = miningFeeAndTxSize.second; - CoinFormatter formatter = new BSFormatter(); + CoinFormatter formatter = new ImmutableCoinFormatter(); String duration = FormattingUtils.formatDurationAsWords(lockupTime * 10 * 60 * 1000L, false, false); new Popup<>().headLine(Res.get("dao.bond.reputation.lockup.headline")) .confirmation(Res.get("dao.bond.reputation.lockup.details", @@ -173,7 +173,7 @@ public void unLock(String lockupTxId, Consumer resultHandler) { Tuple2 miningFeeAndTxSize = daoFacade.getUnlockTxMiningFeeAndTxSize(lockupTxId); Coin miningFee = miningFeeAndTxSize.first; int txSize = miningFeeAndTxSize.second; - CoinFormatter formatter = new BSFormatter(); + CoinFormatter formatter = new ImmutableCoinFormatter(); String duration = FormattingUtils.formatDurationAsWords(lockTime * 10 * 60 * 1000L, false, false); new Popup<>().headLine(Res.get("dao.bond.reputation.unlock.headline")) .confirmation(Res.get("dao.bond.reputation.unlock.details", diff --git a/desktop/src/main/java/bisq/desktop/main/dao/economy/dashboard/BsqDashboardView.java b/desktop/src/main/java/bisq/desktop/main/dao/economy/dashboard/BsqDashboardView.java index c75591a2304..3b457c3bcd9 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/economy/dashboard/BsqDashboardView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/economy/dashboard/BsqDashboardView.java @@ -34,7 +34,6 @@ import bisq.core.trade.statistics.TradeStatistics2; import bisq.core.trade.statistics.TradeStatisticsManager; import bisq.core.user.Preferences; -import bisq.core.util.BSFormatter; import bisq.core.util.BsqFormatter; import bisq.core.util.FormattingUtils; diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/windows/SignPaymentAccountsWindow.java b/desktop/src/main/java/bisq/desktop/main/overlays/windows/SignPaymentAccountsWindow.java index 4215d6896c8..a61c91e9253 100644 --- a/desktop/src/main/java/bisq/desktop/main/overlays/windows/SignPaymentAccountsWindow.java +++ b/desktop/src/main/java/bisq/desktop/main/overlays/windows/SignPaymentAccountsWindow.java @@ -30,7 +30,6 @@ import bisq.core.support.dispute.arbitration.ArbitrationManager; import bisq.core.support.dispute.arbitration.TraderDataItem; import bisq.core.support.dispute.arbitration.arbitrator.ArbitratorManager; -import bisq.core.util.BSFormatter; import bisq.core.util.FormattingUtils; import bisq.common.util.Tuple2; diff --git a/desktop/src/main/java/bisq/desktop/util/validation/SecurityDepositValidator.java b/desktop/src/main/java/bisq/desktop/util/validation/SecurityDepositValidator.java index c3b510d33e1..61f613b0039 100644 --- a/desktop/src/main/java/bisq/desktop/util/validation/SecurityDepositValidator.java +++ b/desktop/src/main/java/bisq/desktop/util/validation/SecurityDepositValidator.java @@ -20,7 +20,6 @@ import bisq.core.btc.wallet.Restrictions; import bisq.core.locale.Res; import bisq.core.payment.PaymentAccount; -import bisq.core.util.BSFormatter; import bisq.core.util.FormattingUtils; import bisq.core.util.ParsingUtils; diff --git a/desktop/src/test/java/bisq/desktop/GuiceSetupTest.java b/desktop/src/test/java/bisq/desktop/GuiceSetupTest.java index 7b0f54a5ee3..1e359df2c27 100644 --- a/desktop/src/test/java/bisq/desktop/GuiceSetupTest.java +++ b/desktop/src/test/java/bisq/desktop/GuiceSetupTest.java @@ -47,7 +47,7 @@ import bisq.core.support.traderchat.TraderChatManager; import bisq.core.user.Preferences; import bisq.core.user.User; -import bisq.core.util.BSFormatter; +import bisq.core.util.ImmutableCoinFormatter; import bisq.core.util.BsqFormatter; import bisq.network.p2p.network.BridgeAddressProvider; @@ -95,7 +95,7 @@ public void testGuiceSetup() { assertSingleton(Navigation.class); assertSingleton(InjectorViewFactory.class); assertSingleton(NotificationCenter.class); - assertSingleton(BSFormatter.class); + assertSingleton(ImmutableCoinFormatter.class); assertSingleton(BsqFormatter.class); assertSingleton(TorNetworkSettingsWindow.class); assertSingleton(MarketPricePresentation.class); diff --git a/desktop/src/test/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModelTest.java b/desktop/src/test/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModelTest.java index 24a012b824f..f6e2abd5f24 100644 --- a/desktop/src/test/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModelTest.java @@ -23,7 +23,7 @@ import bisq.core.locale.GlobalSettings; import bisq.core.provider.price.PriceFeedService; -import bisq.core.util.BSFormatter; +import bisq.core.util.ImmutableCoinFormatter; import javafx.beans.property.SimpleIntegerProperty; @@ -58,7 +58,7 @@ public void testMaxCharactersForBuyPriceWithNoOffers() { when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems); - final OfferBookChartViewModel model = new OfferBookChartViewModel(offerBook, empty, null, null, null, new BSFormatter()); + final OfferBookChartViewModel model = new OfferBookChartViewModel(offerBook, empty, null, null, null, new ImmutableCoinFormatter()); assertEquals(0, model.maxPlacesForBuyPrice.intValue()); } @@ -77,7 +77,7 @@ public void testMaxCharactersForBuyPriceWithOfflinePriceFeedService() { when(priceFeedService.updateCounterProperty()).thenReturn(new SimpleIntegerProperty()); when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems); - final OfferBookChartViewModel model = new OfferBookChartViewModel(offerBook, empty, priceFeedService, null, null, new BSFormatter()); + final OfferBookChartViewModel model = new OfferBookChartViewModel(offerBook, empty, priceFeedService, null, null, new ImmutableCoinFormatter()); model.activate(); assertEquals(0, model.maxPlacesForBuyPrice.intValue()); } @@ -91,7 +91,7 @@ public void testMaxCharactersForFiatBuyPrice() { when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems); - final OfferBookChartViewModel model = new OfferBookChartViewModel(offerBook, empty, service, null, null, new BSFormatter()); + final OfferBookChartViewModel model = new OfferBookChartViewModel(offerBook, empty, service, null, null, new ImmutableCoinFormatter()); model.activate(); assertEquals(7, model.maxPlacesForBuyPrice.intValue()); offerBookListItems.addAll(make(btcBuyItem.but(with(OfferBookListItemMaker.price, 94016475L)))); @@ -107,7 +107,7 @@ public void testMaxCharactersForBuyVolumeWithNoOffers() { when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems); - final OfferBookChartViewModel model = new OfferBookChartViewModel(offerBook, empty, null, null, null, new BSFormatter()); + final OfferBookChartViewModel model = new OfferBookChartViewModel(offerBook, empty, null, null, null, new ImmutableCoinFormatter()); assertEquals(0, model.maxPlacesForBuyVolume.intValue()); } @@ -120,7 +120,7 @@ public void testMaxCharactersForFiatBuyVolume() { when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems); - final OfferBookChartViewModel model = new OfferBookChartViewModel(offerBook, empty, service, null, null, new BSFormatter()); + final OfferBookChartViewModel model = new OfferBookChartViewModel(offerBook, empty, service, null, null, new ImmutableCoinFormatter()); model.activate(); assertEquals(4, model.maxPlacesForBuyVolume.intValue()); //0.01 offerBookListItems.addAll(make(btcBuyItem.but(with(OfferBookListItemMaker.amount, 100000000L)))); @@ -136,7 +136,7 @@ public void testMaxCharactersForSellPriceWithNoOffers() { when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems); - final OfferBookChartViewModel model = new OfferBookChartViewModel(offerBook, empty, null, null, null, new BSFormatter()); + final OfferBookChartViewModel model = new OfferBookChartViewModel(offerBook, empty, null, null, null, new ImmutableCoinFormatter()); assertEquals(0, model.maxPlacesForSellPrice.intValue()); } @@ -155,7 +155,7 @@ public void testMaxCharactersForSellPriceWithOfflinePriceFeedService() { when(priceFeedService.updateCounterProperty()).thenReturn(new SimpleIntegerProperty()); when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems); - final OfferBookChartViewModel model = new OfferBookChartViewModel(offerBook, empty, priceFeedService, null, null, new BSFormatter()); + final OfferBookChartViewModel model = new OfferBookChartViewModel(offerBook, empty, priceFeedService, null, null, new ImmutableCoinFormatter()); model.activate(); assertEquals(0, model.maxPlacesForSellPrice.intValue()); } @@ -169,7 +169,7 @@ public void testMaxCharactersForFiatSellPrice() { when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems); - final OfferBookChartViewModel model = new OfferBookChartViewModel(offerBook, empty, service, null, null, new BSFormatter()); + final OfferBookChartViewModel model = new OfferBookChartViewModel(offerBook, empty, service, null, null, new ImmutableCoinFormatter()); model.activate(); assertEquals(7, model.maxPlacesForSellPrice.intValue()); // 10.0000 default price offerBookListItems.addAll(make(btcSellItem.but(with(OfferBookListItemMaker.price, 94016475L)))); @@ -185,7 +185,7 @@ public void testMaxCharactersForSellVolumeWithNoOffers() { when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems); - final OfferBookChartViewModel model = new OfferBookChartViewModel(offerBook, empty, null, null, null, new BSFormatter()); + final OfferBookChartViewModel model = new OfferBookChartViewModel(offerBook, empty, null, null, null, new ImmutableCoinFormatter()); assertEquals(0, model.maxPlacesForSellVolume.intValue()); } @@ -198,7 +198,7 @@ public void testMaxCharactersForFiatSellVolume() { when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems); - final OfferBookChartViewModel model = new OfferBookChartViewModel(offerBook, empty, service, null, null, new BSFormatter()); + final OfferBookChartViewModel model = new OfferBookChartViewModel(offerBook, empty, service, null, null, new ImmutableCoinFormatter()); model.activate(); assertEquals(4, model.maxPlacesForSellVolume.intValue()); //0.01 offerBookListItems.addAll(make(btcSellItem.but(with(OfferBookListItemMaker.amount, 100000000L)))); diff --git a/desktop/src/test/java/bisq/desktop/main/market/spread/SpreadViewModelTest.java b/desktop/src/test/java/bisq/desktop/main/market/spread/SpreadViewModelTest.java index f32326bb8a5..62d01608ad7 100644 --- a/desktop/src/test/java/bisq/desktop/main/market/spread/SpreadViewModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/market/spread/SpreadViewModelTest.java @@ -23,7 +23,7 @@ import bisq.desktop.main.offer.offerbook.OfferBookListItemMaker; import bisq.core.provider.price.PriceFeedService; -import bisq.core.util.BSFormatter; +import bisq.core.util.ImmutableCoinFormatter; import javafx.collections.FXCollections; import javafx.collections.ObservableList; @@ -48,7 +48,7 @@ public void testMaxCharactersForAmountWithNoOffers() { when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems); - SpreadViewModel model = new SpreadViewModel(offerBook, null, new BSFormatter()); + SpreadViewModel model = new SpreadViewModel(offerBook, null, new ImmutableCoinFormatter()); assertEquals(0, model.maxPlacesForAmount.intValue()); } @@ -60,7 +60,7 @@ public void testMaxCharactersForAmount() { when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems); - SpreadViewModel model = new SpreadViewModel(offerBook, null, new BSFormatter()); + SpreadViewModel model = new SpreadViewModel(offerBook, null, new ImmutableCoinFormatter()); model.activate(); assertEquals(6, model.maxPlacesForAmount.intValue()); // 0.001 offerBookListItems.addAll(make(btcBuyItem.but(with(OfferBookListItemMaker.amount, 1403000000L)))); @@ -76,7 +76,7 @@ public void testFilterSpreadItemsForUniqueOffers() { when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems); - SpreadViewModel model = new SpreadViewModel(offerBook, priceFeedService, new BSFormatter()); + SpreadViewModel model = new SpreadViewModel(offerBook, priceFeedService, new ImmutableCoinFormatter()); model.activate(); assertEquals(1, model.spreadItems.get(0).numberOfOffers); diff --git a/desktop/src/test/java/bisq/desktop/main/market/trades/TradesChartsViewModelTest.java b/desktop/src/test/java/bisq/desktop/main/market/trades/TradesChartsViewModelTest.java index 7e969c41006..f1027327201 100644 --- a/desktop/src/test/java/bisq/desktop/main/market/trades/TradesChartsViewModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/market/trades/TradesChartsViewModelTest.java @@ -27,7 +27,7 @@ import bisq.core.trade.statistics.TradeStatistics2; import bisq.core.trade.statistics.TradeStatisticsManager; import bisq.core.user.Preferences; -import bisq.core.util.BSFormatter; +import bisq.core.util.ImmutableCoinFormatter; import bisq.common.crypto.KeyRing; import bisq.common.crypto.KeyStorage; @@ -111,7 +111,7 @@ public class TradesChartsViewModelTest { public void setup() throws IOException { tradeStatisticsManager = mock(TradeStatisticsManager.class); model = new TradesChartsViewModel(tradeStatisticsManager, mock(Preferences.class), mock(PriceFeedService.class), - mock(Navigation.class), mock(BSFormatter.class)); + mock(Navigation.class), mock(ImmutableCoinFormatter.class)); dir = File.createTempFile("temp_tests1", ""); //noinspection ResultOfMethodCallIgnored dir.delete(); diff --git a/desktop/src/test/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModelTest.java b/desktop/src/test/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModelTest.java index 1bfc03e9dbb..bac6a2bc71a 100644 --- a/desktop/src/test/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModelTest.java @@ -39,7 +39,7 @@ import bisq.core.provider.price.PriceFeedService; import bisq.core.user.Preferences; import bisq.core.user.User; -import bisq.core.util.BSFormatter; +import bisq.core.util.ImmutableCoinFormatter; import bisq.core.util.BsqFormatter; import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; @@ -76,7 +76,7 @@ public void setUp() { GlobalSettings.setDefaultTradeCurrency(btc); Res.setup(); - final CoinFormatter coinFormatter = new BSFormatter(); + final CoinFormatter coinFormatter = new ImmutableCoinFormatter(); final BtcValidator btcValidator = new BtcValidator(coinFormatter); final AltcoinValidator altcoinValidator = new AltcoinValidator(); final FiatPriceValidator fiatPriceValidator = new FiatPriceValidator(); diff --git a/desktop/src/test/java/bisq/desktop/main/offer/offerbook/OfferBookViewModelTest.java b/desktop/src/test/java/bisq/desktop/main/offer/offerbook/OfferBookViewModelTest.java index a4efee143f9..39e27294d08 100644 --- a/desktop/src/test/java/bisq/desktop/main/offer/offerbook/OfferBookViewModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/offer/offerbook/OfferBookViewModelTest.java @@ -41,7 +41,7 @@ import bisq.core.payment.payload.SpecificBanksAccountPayload; import bisq.core.provider.price.MarketPrice; import bisq.core.provider.price.PriceFeedService; -import bisq.core.util.BSFormatter; +import bisq.core.util.ImmutableCoinFormatter; import bisq.core.util.BsqFormatter; import javafx.beans.property.SimpleIntegerProperty; @@ -226,7 +226,7 @@ public void testMaxCharactersForAmountWithNoOffes() { when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems); final OfferBookViewModel model = new OfferBookViewModel(null, null, offerBook, empty, null, null, - null, null, null, null, new BSFormatter(), new BsqFormatter()); + null, null, null, null, new ImmutableCoinFormatter(), new BsqFormatter()); assertEquals(0, model.maxPlacesForAmount.intValue()); } @@ -240,7 +240,7 @@ public void testMaxCharactersForAmount() { when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems); final OfferBookViewModel model = new OfferBookViewModel(null, openOfferManager, offerBook, empty, null, null, - null, null, null, null, new BSFormatter(), new BsqFormatter()); + null, null, null, null, new ImmutableCoinFormatter(), new BsqFormatter()); model.activate(); assertEquals(6, model.maxPlacesForAmount.intValue()); @@ -258,7 +258,7 @@ public void testMaxCharactersForAmountRange() { when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems); final OfferBookViewModel model = new OfferBookViewModel(null, openOfferManager, offerBook, empty, null, null, - null, null, null, null, new BSFormatter(), new BsqFormatter()); + null, null, null, null, new ImmutableCoinFormatter(), new BsqFormatter()); model.activate(); assertEquals(15, model.maxPlacesForAmount.intValue()); @@ -277,7 +277,7 @@ public void testMaxCharactersForVolumeWithNoOffes() { when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems); final OfferBookViewModel model = new OfferBookViewModel(null, null, offerBook, empty, null, null, - null, null, null, null, new BSFormatter(), new BsqFormatter()); + null, null, null, null, new ImmutableCoinFormatter(), new BsqFormatter()); assertEquals(0, model.maxPlacesForVolume.intValue()); } @@ -291,7 +291,7 @@ public void testMaxCharactersForVolume() { when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems); final OfferBookViewModel model = new OfferBookViewModel(null, openOfferManager, offerBook, empty, null, null, - null, null, null, null, new BSFormatter(), new BsqFormatter()); + null, null, null, null, new ImmutableCoinFormatter(), new BsqFormatter()); model.activate(); assertEquals(8, model.maxPlacesForVolume.intValue()); @@ -309,7 +309,7 @@ public void testMaxCharactersForVolumeRange() { when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems); final OfferBookViewModel model = new OfferBookViewModel(null, openOfferManager, offerBook, empty, null, null, - null, null, null, null, new BSFormatter(), new BsqFormatter()); + null, null, null, null, new ImmutableCoinFormatter(), new BsqFormatter()); model.activate(); assertEquals(15, model.maxPlacesForVolume.intValue()); @@ -328,7 +328,7 @@ public void testMaxCharactersForPriceWithNoOffers() { when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems); final OfferBookViewModel model = new OfferBookViewModel(null, null, offerBook, empty, null, null, - null, null, null, null, new BSFormatter(), new BsqFormatter()); + null, null, null, null, new ImmutableCoinFormatter(), new BsqFormatter()); assertEquals(0, model.maxPlacesForPrice.intValue()); } @@ -342,7 +342,7 @@ public void testMaxCharactersForPrice() { when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems); final OfferBookViewModel model = new OfferBookViewModel(null, openOfferManager, offerBook, empty, null, null, - null, null, null, null, new BSFormatter(), new BsqFormatter()); + null, null, null, null, new ImmutableCoinFormatter(), new BsqFormatter()); model.activate(); assertEquals(7, model.maxPlacesForPrice.intValue()); @@ -360,7 +360,7 @@ public void testMaxCharactersForPriceDistanceWithNoOffers() { when(offerBook.getOfferBookListItems()).thenReturn(offerBookListItems); final OfferBookViewModel model = new OfferBookViewModel(null, null, offerBook, empty, null, null, - null, null, null, null, new BSFormatter(), new BsqFormatter()); + null, null, null, null, new ImmutableCoinFormatter(), new BsqFormatter()); assertEquals(0, model.maxPlacesForMarketPriceMargin.intValue()); } @@ -388,7 +388,7 @@ public void testMaxCharactersForPriceDistance() { offerBookListItems.addAll(item1, item2); final OfferBookViewModel model = new OfferBookViewModel(null, openOfferManager, offerBook, empty, null, priceFeedService, - null, null, null, null, new BSFormatter(), new BsqFormatter()); + null, null, null, null, new ImmutableCoinFormatter(), new BsqFormatter()); model.activate(); assertEquals(8, model.maxPlacesForMarketPriceMargin.intValue()); //" (1.97%)" @@ -409,7 +409,7 @@ public void testGetPrice() { when(priceFeedService.getMarketPrice(anyString())).thenReturn(new MarketPrice("USD", 12684.0450, Instant.now().getEpochSecond(), true)); final OfferBookViewModel model = new OfferBookViewModel(null, openOfferManager, offerBook, empty, null, null, - null, null, null, null, new BSFormatter(), new BsqFormatter()); + null, null, null, null, new ImmutableCoinFormatter(), new BsqFormatter()); final OfferBookListItem item = make(btcBuyItem.but( with(useMarketBasedPrice, true), diff --git a/desktop/src/test/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModelTest.java b/desktop/src/test/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModelTest.java index d3cc59304f2..6dbd92a48e0 100644 --- a/desktop/src/test/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModelTest.java @@ -21,7 +21,7 @@ import bisq.core.provider.price.PriceFeedService; import bisq.core.user.Preferences; import bisq.core.user.User; -import bisq.core.util.BSFormatter; +import bisq.core.util.ImmutableCoinFormatter; import bisq.core.util.BsqFormatter; import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; @@ -66,7 +66,7 @@ public void setUp() { GlobalSettings.setDefaultTradeCurrency(btc); Res.setup(); - final CoinFormatter coinFormatter = new BSFormatter(); + final CoinFormatter coinFormatter = new ImmutableCoinFormatter(); FeeService feeService = mock(FeeService.class); AddressEntry addressEntry = mock(AddressEntry.class); diff --git a/desktop/src/test/java/bisq/desktop/util/DisplayUtilsTest.java b/desktop/src/test/java/bisq/desktop/util/DisplayUtilsTest.java index 4dd40551ec1..272bdc8fb87 100644 --- a/desktop/src/test/java/bisq/desktop/util/DisplayUtilsTest.java +++ b/desktop/src/test/java/bisq/desktop/util/DisplayUtilsTest.java @@ -4,7 +4,7 @@ import bisq.core.monetary.Volume; import bisq.core.offer.Offer; import bisq.core.offer.OfferPayload; -import bisq.core.util.BSFormatter; +import bisq.core.util.ImmutableCoinFormatter; import bisq.core.util.coin.CoinFormatter; import org.bitcoinj.core.Coin; @@ -25,7 +25,7 @@ import static org.mockito.Mockito.when; public class DisplayUtilsTest { - private final CoinFormatter formatter = new BSFormatter(); + private final CoinFormatter formatter = new ImmutableCoinFormatter(); @Before public void setUp() { diff --git a/desktop/src/test/java/bisq/desktop/util/BSFormatterTest.java b/desktop/src/test/java/bisq/desktop/util/ImmutableCoinFormatterTest.java similarity index 93% rename from desktop/src/test/java/bisq/desktop/util/BSFormatterTest.java rename to desktop/src/test/java/bisq/desktop/util/ImmutableCoinFormatterTest.java index a8ca1ada7d8..1933354653b 100644 --- a/desktop/src/test/java/bisq/desktop/util/BSFormatterTest.java +++ b/desktop/src/test/java/bisq/desktop/util/ImmutableCoinFormatterTest.java @@ -18,7 +18,7 @@ package bisq.desktop.util; import bisq.core.locale.Res; -import bisq.core.util.BSFormatter; +import bisq.core.util.ImmutableCoinFormatter; import bisq.core.util.coin.CoinFormatter; import org.bitcoinj.core.CoinMaker; @@ -37,14 +37,14 @@ import static org.junit.Assert.assertTrue; import static org.mockito.Mockito.mock; -public class BSFormatterTest { +public class ImmutableCoinFormatterTest { private CoinFormatter formatter; @Before public void setUp() { Locale.setDefault(new Locale("en", "US")); - formatter = new BSFormatter(); + formatter = new ImmutableCoinFormatter(); Res.setBaseCurrencyCode("BTC"); Res.setBaseCurrencyName("Bitcoin"); } diff --git a/desktop/src/test/java/bisq/desktop/util/validation/BtcValidatorTest.java b/desktop/src/test/java/bisq/desktop/util/validation/BtcValidatorTest.java index 067d6b3a14a..6824c6baed7 100644 --- a/desktop/src/test/java/bisq/desktop/util/validation/BtcValidatorTest.java +++ b/desktop/src/test/java/bisq/desktop/util/validation/BtcValidatorTest.java @@ -21,7 +21,7 @@ import bisq.core.btc.BaseCurrencyNetwork; import bisq.core.locale.CurrencyUtil; import bisq.core.locale.Res; -import bisq.core.util.BSFormatter; +import bisq.core.util.ImmutableCoinFormatter; import org.bitcoinj.core.Coin; @@ -44,7 +44,7 @@ public void setup() { @Test public void testIsValid() { - BtcValidator validator = new BtcValidator(new BSFormatter()); + BtcValidator validator = new BtcValidator(new ImmutableCoinFormatter()); assertTrue(validator.validate("1").isValid); assertTrue(validator.validate("0,1").isValid); From cb8873fa6d1b9a35fad565a9833357413f840eb1 Mon Sep 17 00:00:00 2001 From: Justin Carter Date: Tue, 19 Nov 2019 14:23:18 +0100 Subject: [PATCH 5/7] Move BsqFormatter and ImmutableCoinFormatter under .coin package --- .../java/bisq/core/dao/governance/asset/AssetService.java | 2 +- .../dao/governance/proposal/param/ChangeParamValidator.java | 2 +- core/src/main/java/bisq/core/dao/state/DaoStateService.java | 2 +- .../main/java/bisq/core/util/{ => coin}/BsqFormatter.java | 5 +++-- .../bisq/core/util/{ => coin}/ImmutableCoinFormatter.java | 3 ++- .../governance/proposal/param/ChangeParamValidatorTest.java | 2 +- .../test/java/bisq/core/dao/state/DaoStateServiceTest.java | 2 +- .../java/bisq/desktop/main/dao/bonding/BondingViewUtils.java | 4 ++-- .../bisq/desktop/main/dao/bonding/bonds/BondListItem.java | 2 +- .../java/bisq/desktop/main/dao/bonding/bonds/BondsView.java | 2 +- .../main/dao/bonding/reputation/MyReputationListItem.java | 2 +- .../main/dao/bonding/reputation/MyReputationView.java | 2 +- .../desktop/main/dao/bonding/roles/RoleDetailsWindow.java | 2 +- .../java/bisq/desktop/main/dao/bonding/roles/RolesView.java | 2 +- .../bisq/desktop/main/dao/burnbsq/assetfee/AssetFeeView.java | 2 +- .../desktop/main/dao/burnbsq/assetfee/AssetListItem.java | 2 +- .../main/dao/burnbsq/proofofburn/MyProofOfBurnListItem.java | 2 +- .../main/dao/burnbsq/proofofburn/ProofOfBurnListItem.java | 2 +- .../main/dao/burnbsq/proofofburn/ProofOfBurnView.java | 2 +- .../desktop/main/dao/economy/dashboard/BsqDashboardView.java | 2 +- .../bisq/desktop/main/dao/economy/supply/SupplyView.java | 2 +- .../bisq/desktop/main/dao/governance/ProposalDisplay.java | 2 +- .../desktop/main/dao/governance/make/MakeProposalView.java | 2 +- .../main/dao/governance/proposals/ProposalsListItem.java | 2 +- .../desktop/main/dao/governance/proposals/ProposalsView.java | 2 +- .../desktop/main/dao/governance/result/CycleListItem.java | 2 +- .../desktop/main/dao/governance/result/ProposalListItem.java | 2 +- .../desktop/main/dao/governance/result/VoteListItem.java | 2 +- .../desktop/main/dao/governance/result/VoteResultView.java | 2 +- .../src/main/java/bisq/desktop/main/dao/news/NewsView.java | 2 +- .../java/bisq/desktop/main/dao/wallet/BsqBalanceUtil.java | 2 +- .../bisq/desktop/main/dao/wallet/receive/BsqReceiveView.java | 2 +- .../java/bisq/desktop/main/dao/wallet/send/BsqSendView.java | 2 +- .../java/bisq/desktop/main/dao/wallet/tx/BsqTxListItem.java | 2 +- .../main/java/bisq/desktop/main/dao/wallet/tx/BsqTxView.java | 2 +- .../main/java/bisq/desktop/main/offer/MutableOfferView.java | 2 +- .../java/bisq/desktop/main/offer/MutableOfferViewModel.java | 2 +- .../bisq/desktop/main/offer/createoffer/CreateOfferView.java | 2 +- .../desktop/main/offer/createoffer/CreateOfferViewModel.java | 2 +- .../desktop/main/offer/offerbook/OfferBookViewModel.java | 2 +- .../bisq/desktop/main/offer/takeoffer/TakeOfferView.java | 2 +- .../desktop/main/offer/takeoffer/TakeOfferViewModel.java | 2 +- .../desktop/main/overlays/windows/EmptyWalletWindow.java | 2 +- .../desktop/main/overlays/windows/ProposalResultsWindow.java | 2 +- .../desktop/main/overlays/windows/SelectProposalWindow.java | 2 +- .../bisq/desktop/main/portfolio/editoffer/EditOfferView.java | 2 +- .../desktop/main/portfolio/editoffer/EditOfferViewModel.java | 2 +- .../main/portfolio/openoffer/OpenOffersViewModel.java | 2 +- .../main/portfolio/pendingtrades/PendingTradesViewModel.java | 2 +- desktop/src/main/java/bisq/desktop/util/GUIUtil.java | 2 +- .../bisq/desktop/util/validation/BsqAddressValidator.java | 2 +- .../main/java/bisq/desktop/util/validation/BsqValidator.java | 2 +- desktop/src/test/java/bisq/desktop/GuiceSetupTest.java | 4 ++-- .../main/market/offerbook/OfferBookChartViewModelTest.java | 2 +- .../bisq/desktop/main/market/spread/SpreadViewModelTest.java | 2 +- .../main/market/trades/TradesChartsViewModelTest.java | 2 +- .../main/offer/createoffer/CreateOfferViewModelTest.java | 4 ++-- .../desktop/main/offer/offerbook/OfferBookViewModelTest.java | 4 ++-- .../main/portfolio/editoffer/EditOfferDataModelTest.java | 4 ++-- .../src/test/java/bisq/desktop/util/DisplayUtilsTest.java | 2 +- .../java/bisq/desktop/util/ImmutableCoinFormatterTest.java | 2 +- .../java/bisq/desktop/util/validation/BtcValidatorTest.java | 2 +- 62 files changed, 70 insertions(+), 68 deletions(-) rename core/src/main/java/bisq/core/util/{ => coin}/BsqFormatter.java (99%) rename core/src/main/java/bisq/core/util/{ => coin}/ImmutableCoinFormatter.java (97%) diff --git a/core/src/main/java/bisq/core/dao/governance/asset/AssetService.java b/core/src/main/java/bisq/core/dao/governance/asset/AssetService.java index c765697a704..86080746814 100644 --- a/core/src/main/java/bisq/core/dao/governance/asset/AssetService.java +++ b/core/src/main/java/bisq/core/dao/governance/asset/AssetService.java @@ -38,7 +38,7 @@ import bisq.core.locale.CurrencyUtil; import bisq.core.trade.statistics.TradeStatistics2; import bisq.core.trade.statistics.TradeStatisticsManager; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.common.Timer; import bisq.common.UserThread; diff --git a/core/src/main/java/bisq/core/dao/governance/proposal/param/ChangeParamValidator.java b/core/src/main/java/bisq/core/dao/governance/proposal/param/ChangeParamValidator.java index 626d30a5186..230ee8903dd 100644 --- a/core/src/main/java/bisq/core/dao/governance/proposal/param/ChangeParamValidator.java +++ b/core/src/main/java/bisq/core/dao/governance/proposal/param/ChangeParamValidator.java @@ -28,7 +28,7 @@ import bisq.core.dao.state.model.governance.ChangeParamProposal; import bisq.core.dao.state.model.governance.Proposal; import bisq.core.locale.Res; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.validation.BtcAddressValidator; import bisq.core.util.validation.InputValidator; diff --git a/core/src/main/java/bisq/core/dao/state/DaoStateService.java b/core/src/main/java/bisq/core/dao/state/DaoStateService.java index c4e226c746c..ecb33ae229e 100644 --- a/core/src/main/java/bisq/core/dao/state/DaoStateService.java +++ b/core/src/main/java/bisq/core/dao/state/DaoStateService.java @@ -35,7 +35,7 @@ import bisq.core.dao.state.model.governance.Issuance; import bisq.core.dao.state.model.governance.IssuanceType; import bisq.core.dao.state.model.governance.ParamChange; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.ParsingUtils; import org.bitcoinj.core.Coin; diff --git a/core/src/main/java/bisq/core/util/BsqFormatter.java b/core/src/main/java/bisq/core/util/coin/BsqFormatter.java similarity index 99% rename from core/src/main/java/bisq/core/util/BsqFormatter.java rename to core/src/main/java/bisq/core/util/coin/BsqFormatter.java index 475e0bf5909..e1369b7812e 100644 --- a/core/src/main/java/bisq/core/util/BsqFormatter.java +++ b/core/src/main/java/bisq/core/util/coin/BsqFormatter.java @@ -15,7 +15,7 @@ * along with Bisq. If not, see . */ -package bisq.core.util; +package bisq.core.util.coin; import bisq.core.app.BisqEnvironment; import bisq.core.dao.governance.param.Param; @@ -23,7 +23,8 @@ import bisq.core.locale.GlobalSettings; import bisq.core.locale.Res; import bisq.core.provider.price.MarketPrice; -import bisq.core.util.coin.CoinFormatter; +import bisq.core.util.FormattingUtils; +import bisq.core.util.ParsingUtils; import bisq.core.util.validation.BtcAddressValidator; import bisq.core.util.validation.InputValidator; diff --git a/core/src/main/java/bisq/core/util/ImmutableCoinFormatter.java b/core/src/main/java/bisq/core/util/coin/ImmutableCoinFormatter.java similarity index 97% rename from core/src/main/java/bisq/core/util/ImmutableCoinFormatter.java rename to core/src/main/java/bisq/core/util/coin/ImmutableCoinFormatter.java index b7748b82f50..1cb2ae40122 100644 --- a/core/src/main/java/bisq/core/util/ImmutableCoinFormatter.java +++ b/core/src/main/java/bisq/core/util/coin/ImmutableCoinFormatter.java @@ -15,9 +15,10 @@ * along with Bisq. If not, see . */ -package bisq.core.util; +package bisq.core.util.coin; import bisq.core.app.BisqEnvironment; +import bisq.core.util.FormattingUtils; import bisq.core.util.coin.CoinFormatter; import org.bitcoinj.core.Coin; diff --git a/core/src/test/java/bisq/core/dao/governance/proposal/param/ChangeParamValidatorTest.java b/core/src/test/java/bisq/core/dao/governance/proposal/param/ChangeParamValidatorTest.java index 790d543e5a0..0ba4bed83d6 100644 --- a/core/src/test/java/bisq/core/dao/governance/proposal/param/ChangeParamValidatorTest.java +++ b/core/src/test/java/bisq/core/dao/governance/proposal/param/ChangeParamValidatorTest.java @@ -19,7 +19,7 @@ import bisq.core.dao.governance.param.Param; import bisq.core.locale.Res; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import org.junit.Assert; import org.junit.Before; diff --git a/core/src/test/java/bisq/core/dao/state/DaoStateServiceTest.java b/core/src/test/java/bisq/core/dao/state/DaoStateServiceTest.java index 9b2dee42c8f..96857e59bba 100644 --- a/core/src/test/java/bisq/core/dao/state/DaoStateServiceTest.java +++ b/core/src/test/java/bisq/core/dao/state/DaoStateServiceTest.java @@ -19,7 +19,7 @@ import bisq.core.dao.state.model.DaoState; import bisq.core.dao.state.model.blockchain.Block; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import org.bitcoinj.core.Coin; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/bonding/BondingViewUtils.java b/desktop/src/main/java/bisq/desktop/main/dao/bonding/BondingViewUtils.java index 6581c39aa8a..e6c0a61366c 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/bonding/BondingViewUtils.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/bonding/BondingViewUtils.java @@ -34,8 +34,8 @@ import bisq.core.dao.state.model.governance.Role; import bisq.core.dao.state.model.governance.RoleProposal; import bisq.core.locale.Res; -import bisq.core.util.ImmutableCoinFormatter; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.ImmutableCoinFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.coin.CoinFormatter; import bisq.core.util.coin.CoinUtil; import bisq.core.util.FormattingUtils; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/bonding/bonds/BondListItem.java b/desktop/src/main/java/bisq/desktop/main/dao/bonding/bonds/BondListItem.java index edcbfb46827..6164a6a3409 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/bonding/bonds/BondListItem.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/bonding/bonds/BondListItem.java @@ -23,7 +23,7 @@ import bisq.core.dao.governance.bond.BondState; import bisq.core.dao.governance.bond.role.BondedRole; import bisq.core.locale.Res; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.common.util.Utilities; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/bonding/bonds/BondsView.java b/desktop/src/main/java/bisq/desktop/main/dao/bonding/bonds/BondsView.java index 1d3db94c500..93d736e03f7 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/bonding/bonds/BondsView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/bonding/bonds/BondsView.java @@ -33,7 +33,7 @@ import bisq.core.dao.governance.bond.role.BondedRolesRepository; import bisq.core.locale.Res; import bisq.core.user.Preferences; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import javax.inject.Inject; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/bonding/reputation/MyReputationListItem.java b/desktop/src/main/java/bisq/desktop/main/dao/bonding/reputation/MyReputationListItem.java index fe5536794a6..d3e75f1010f 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/bonding/reputation/MyReputationListItem.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/bonding/reputation/MyReputationListItem.java @@ -23,7 +23,7 @@ import bisq.core.dao.governance.bond.reputation.MyBondedReputation; import bisq.core.dao.governance.bond.reputation.MyReputation; import bisq.core.locale.Res; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.common.util.Utilities; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/bonding/reputation/MyReputationView.java b/desktop/src/main/java/bisq/desktop/main/dao/bonding/reputation/MyReputationView.java index 4d52a31476e..764d073abb3 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/bonding/reputation/MyReputationView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/bonding/reputation/MyReputationView.java @@ -38,7 +38,7 @@ import bisq.core.dao.governance.bond.reputation.MyBondedReputation; import bisq.core.locale.Res; import bisq.core.user.Preferences; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.ParsingUtils; import bisq.core.util.validation.HexStringValidator; import bisq.core.util.validation.IntegerValidator; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/bonding/roles/RoleDetailsWindow.java b/desktop/src/main/java/bisq/desktop/main/dao/bonding/roles/RoleDetailsWindow.java index 89b50b977a1..b23e6066d4c 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/bonding/roles/RoleDetailsWindow.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/bonding/roles/RoleDetailsWindow.java @@ -25,7 +25,7 @@ import bisq.core.dao.state.model.governance.BondedRoleType; import bisq.core.dao.state.model.governance.RoleProposal; import bisq.core.locale.Res; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import org.bitcoinj.core.Coin; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/bonding/roles/RolesView.java b/desktop/src/main/java/bisq/desktop/main/dao/bonding/roles/RolesView.java index 5bd97b8d3ac..595c45d16d9 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/bonding/roles/RolesView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/bonding/roles/RolesView.java @@ -34,7 +34,7 @@ import bisq.core.dao.state.model.governance.RoleProposal; import bisq.core.locale.Res; import bisq.core.user.Preferences; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import javax.inject.Inject; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/assetfee/AssetFeeView.java b/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/assetfee/AssetFeeView.java index 5269e39b877..d93f3dc2448 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/assetfee/AssetFeeView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/assetfee/AssetFeeView.java @@ -34,7 +34,7 @@ import bisq.core.dao.governance.proposal.TxException; import bisq.core.locale.CurrencyUtil; import bisq.core.locale.Res; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.ParsingUtils; import bisq.core.util.coin.CoinFormatter; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/assetfee/AssetListItem.java b/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/assetfee/AssetListItem.java index 4e3a4063645..3f49e0edabe 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/assetfee/AssetListItem.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/assetfee/AssetListItem.java @@ -19,7 +19,7 @@ import bisq.core.dao.governance.asset.StatefulAsset; import bisq.core.locale.Res; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import lombok.Value; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/proofofburn/MyProofOfBurnListItem.java b/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/proofofburn/MyProofOfBurnListItem.java index fe2e11e1bd2..0fe3afe1894 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/proofofburn/MyProofOfBurnListItem.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/proofofburn/MyProofOfBurnListItem.java @@ -23,7 +23,7 @@ import bisq.core.dao.governance.proofofburn.ProofOfBurnService; import bisq.core.dao.state.model.blockchain.Tx; import bisq.core.locale.Res; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.common.util.Utilities; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/proofofburn/ProofOfBurnListItem.java b/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/proofofburn/ProofOfBurnListItem.java index 912ff42c7df..5dfe0fbdf8b 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/proofofburn/ProofOfBurnListItem.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/proofofburn/ProofOfBurnListItem.java @@ -21,7 +21,7 @@ import bisq.core.dao.governance.proofofburn.ProofOfBurnService; import bisq.core.dao.state.model.blockchain.Tx; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.common.util.Utilities; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/proofofburn/ProofOfBurnView.java b/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/proofofburn/ProofOfBurnView.java index 8b6c6449195..04f0fb8f3dc 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/proofofburn/ProofOfBurnView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/proofofburn/ProofOfBurnView.java @@ -37,7 +37,7 @@ import bisq.core.dao.governance.proposal.TxException; import bisq.core.locale.Res; import bisq.core.user.Preferences; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.ParsingUtils; import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/economy/dashboard/BsqDashboardView.java b/desktop/src/main/java/bisq/desktop/main/dao/economy/dashboard/BsqDashboardView.java index 3b457c3bcd9..85b256e7912 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/economy/dashboard/BsqDashboardView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/economy/dashboard/BsqDashboardView.java @@ -34,7 +34,7 @@ import bisq.core.trade.statistics.TradeStatistics2; import bisq.core.trade.statistics.TradeStatisticsManager; import bisq.core.user.Preferences; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.FormattingUtils; import bisq.common.util.MathUtils; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/economy/supply/SupplyView.java b/desktop/src/main/java/bisq/desktop/main/dao/economy/supply/SupplyView.java index 84152440351..ae6bf1fb584 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/economy/supply/SupplyView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/economy/supply/SupplyView.java @@ -31,7 +31,7 @@ import bisq.core.dao.state.model.governance.IssuanceType; import bisq.core.locale.GlobalSettings; import bisq.core.locale.Res; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.common.util.Tuple3; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/ProposalDisplay.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/ProposalDisplay.java index 5eabf28ac21..1e7439fe240 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/ProposalDisplay.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/ProposalDisplay.java @@ -58,7 +58,7 @@ import bisq.core.locale.CurrencyUtil; import bisq.core.locale.Res; import bisq.core.user.Preferences; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.validation.InputValidator; import bisq.asset.Asset; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.java index ae048ba8ac5..916a81835ee 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.java @@ -50,7 +50,7 @@ import bisq.core.dao.state.model.governance.Proposal; import bisq.core.dao.state.model.governance.Role; import bisq.core.locale.Res; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.ParsingUtils; import bisq.core.util.coin.CoinFormatter; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsListItem.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsListItem.java index 005d42c52b4..9fd0b1bf072 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsListItem.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsListItem.java @@ -25,7 +25,7 @@ import bisq.core.dao.state.model.governance.Proposal; import bisq.core.dao.state.model.governance.Vote; import bisq.core.locale.Res; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import de.jensd.fx.fontawesome.AwesomeIcon; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java index 1052ac26b01..80b8715fa65 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java @@ -53,7 +53,7 @@ import bisq.core.dao.state.model.governance.Vote; import bisq.core.locale.Res; import bisq.core.user.Preferences; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.ParsingUtils; import bisq.core.util.coin.CoinFormatter; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/result/CycleListItem.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/result/CycleListItem.java index a46958af9d5..773df3a0766 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/result/CycleListItem.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/result/CycleListItem.java @@ -20,7 +20,7 @@ import bisq.core.dao.governance.proposal.IssuanceProposal; import bisq.core.dao.state.model.governance.EvaluatedProposal; import bisq.core.locale.Res; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.FormattingUtils; import org.bitcoinj.core.Coin; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/result/ProposalListItem.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/result/ProposalListItem.java index 6c91dc49182..d90af7def03 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/result/ProposalListItem.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/result/ProposalListItem.java @@ -32,7 +32,7 @@ import bisq.core.dao.state.model.governance.Vote; import bisq.core.locale.CurrencyUtil; import bisq.core.locale.Res; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import org.bitcoinj.core.Coin; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteListItem.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteListItem.java index 823e44d2bfc..8fc531824c4 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteListItem.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteListItem.java @@ -21,7 +21,7 @@ import bisq.core.dao.state.model.governance.Ballot; import bisq.core.dao.state.model.governance.DecryptedBallotsWithMerits; import bisq.core.dao.state.model.governance.Proposal; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.common.util.Tuple2; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteResultView.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteResultView.java index 1620a414c4c..277fd3463d4 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteResultView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/result/VoteResultView.java @@ -60,7 +60,7 @@ import bisq.core.dao.state.model.governance.RoleProposal; import bisq.core.dao.state.model.governance.Vote; import bisq.core.locale.Res; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.common.UserThread; import bisq.common.util.Utilities; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/news/NewsView.java b/desktop/src/main/java/bisq/desktop/main/dao/news/NewsView.java index 9029119ce36..53a92c6dca8 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/news/NewsView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/news/NewsView.java @@ -10,7 +10,7 @@ import bisq.core.btc.wallet.BsqWalletService; import bisq.core.locale.Res; import bisq.core.user.Preferences; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.common.util.Tuple3; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/wallet/BsqBalanceUtil.java b/desktop/src/main/java/bisq/desktop/main/dao/wallet/BsqBalanceUtil.java index 9e7dc5b36a9..3ab09309525 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/wallet/BsqBalanceUtil.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/wallet/BsqBalanceUtil.java @@ -27,7 +27,7 @@ import bisq.core.dao.state.DaoStateService; import bisq.core.dao.state.model.blockchain.Block; import bisq.core.locale.Res; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.common.util.Tuple3; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/wallet/receive/BsqReceiveView.java b/desktop/src/main/java/bisq/desktop/main/dao/wallet/receive/BsqReceiveView.java index 343ef09e145..ca89d8026ff 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/wallet/receive/BsqReceiveView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/wallet/receive/BsqReceiveView.java @@ -26,7 +26,7 @@ import bisq.core.btc.wallet.BsqWalletService; import bisq.core.locale.Res; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.common.app.DevEnv; import bisq.common.util.Tuple3; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.java b/desktop/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.java index d3fc1d63e21..d0ba127588c 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.java @@ -44,7 +44,7 @@ import bisq.core.btc.wallet.WalletsManager; import bisq.core.dao.state.model.blockchain.TxType; import bisq.core.locale.Res; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.coin.CoinFormatter; import bisq.core.util.coin.CoinUtil; import bisq.core.util.ParsingUtils; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/wallet/tx/BsqTxListItem.java b/desktop/src/main/java/bisq/desktop/main/dao/wallet/tx/BsqTxListItem.java index de8c4b35166..86c8cc47a8d 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/wallet/tx/BsqTxListItem.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/wallet/tx/BsqTxListItem.java @@ -25,7 +25,7 @@ import bisq.core.dao.DaoFacade; import bisq.core.dao.state.model.blockchain.TxType; import bisq.core.locale.Res; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import org.bitcoinj.core.Coin; import org.bitcoinj.core.Transaction; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/wallet/tx/BsqTxView.java b/desktop/src/main/java/bisq/desktop/main/dao/wallet/tx/BsqTxView.java index a00841c731c..9afcba9d50d 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/wallet/tx/BsqTxView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/wallet/tx/BsqTxView.java @@ -40,7 +40,7 @@ import bisq.core.dao.state.model.governance.IssuanceType; import bisq.core.locale.Res; import bisq.core.user.Preferences; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.common.Timer; import bisq.common.UserThread; diff --git a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java index c8f24bcfa45..21d2ee3af89 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferView.java @@ -56,7 +56,7 @@ import bisq.core.payment.payload.PaymentMethod; import bisq.core.user.DontShowAgainLookup; import bisq.core.user.Preferences; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.coin.CoinFormatter; import bisq.common.UserThread; diff --git a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferViewModel.java b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferViewModel.java index 76b7258eb69..3c8b3466021 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/MutableOfferViewModel.java @@ -51,7 +51,7 @@ import bisq.core.provider.price.MarketPrice; import bisq.core.provider.price.PriceFeedService; import bisq.core.user.Preferences; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.FormattingUtils; import bisq.core.util.ParsingUtils; import bisq.core.util.coin.CoinFormatter; diff --git a/desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferView.java b/desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferView.java index 65e30561508..57313ca5382 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferView.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferView.java @@ -24,7 +24,7 @@ import bisq.desktop.util.Transitions; import bisq.core.user.Preferences; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.coin.CoinFormatter; import com.google.inject.Inject; diff --git a/desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModel.java b/desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModel.java index 114421bcfd7..3786263bf65 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModel.java @@ -30,7 +30,7 @@ import bisq.core.account.witness.AccountAgeWitnessService; import bisq.core.provider.price.PriceFeedService; import bisq.core.user.Preferences; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.coin.CoinFormatter; import com.google.inject.Inject; diff --git a/desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookViewModel.java b/desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookViewModel.java index 8c481eb8d8d..74f34060caf 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookViewModel.java @@ -47,7 +47,7 @@ import bisq.core.trade.closed.ClosedTradableManager; import bisq.core.user.Preferences; import bisq.core.user.User; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.FormattingUtils; import bisq.core.util.coin.CoinFormatter; diff --git a/desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferView.java b/desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferView.java index 4387b59749e..7be15eb743c 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferView.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferView.java @@ -54,7 +54,7 @@ import bisq.core.payment.PaymentAccount; import bisq.core.payment.payload.PaymentMethod; import bisq.core.user.DontShowAgainLookup; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.coin.CoinFormatter; import bisq.common.UserThread; diff --git a/desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferViewModel.java b/desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferViewModel.java index da88036248a..6f599d81a11 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/takeoffer/TakeOfferViewModel.java @@ -43,7 +43,7 @@ import bisq.core.provider.price.PriceFeedService; import bisq.core.trade.Trade; import bisq.core.user.Preferences; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.FormattingUtils; import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/windows/EmptyWalletWindow.java b/desktop/src/main/java/bisq/desktop/main/overlays/windows/EmptyWalletWindow.java index eea2cb1ebe5..54477937614 100644 --- a/desktop/src/main/java/bisq/desktop/main/overlays/windows/EmptyWalletWindow.java +++ b/desktop/src/main/java/bisq/desktop/main/overlays/windows/EmptyWalletWindow.java @@ -31,7 +31,7 @@ import bisq.core.btc.wallet.WalletService; import bisq.core.locale.Res; import bisq.core.offer.OpenOfferManager; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.coin.CoinFormatter; import bisq.network.p2p.P2PService; diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/windows/ProposalResultsWindow.java b/desktop/src/main/java/bisq/desktop/main/overlays/windows/ProposalResultsWindow.java index 0482caff060..4501e6051d8 100644 --- a/desktop/src/main/java/bisq/desktop/main/overlays/windows/ProposalResultsWindow.java +++ b/desktop/src/main/java/bisq/desktop/main/overlays/windows/ProposalResultsWindow.java @@ -36,7 +36,7 @@ import bisq.core.dao.state.model.governance.Proposal; import bisq.core.locale.Res; import bisq.core.user.Preferences; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.common.util.Tuple2; diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/windows/SelectProposalWindow.java b/desktop/src/main/java/bisq/desktop/main/overlays/windows/SelectProposalWindow.java index 3327d26875e..82017d8303c 100644 --- a/desktop/src/main/java/bisq/desktop/main/overlays/windows/SelectProposalWindow.java +++ b/desktop/src/main/java/bisq/desktop/main/overlays/windows/SelectProposalWindow.java @@ -15,7 +15,7 @@ import bisq.core.dao.state.model.governance.Vote; import bisq.core.locale.Res; import bisq.core.user.Preferences; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.common.util.Tuple2; import bisq.common.util.Tuple3; diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferView.java b/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferView.java index fcfe908698d..c38adad0437 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferView.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferView.java @@ -30,7 +30,7 @@ import bisq.core.locale.Res; import bisq.core.offer.OpenOffer; import bisq.core.user.Preferences; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.coin.CoinFormatter; import bisq.common.util.Tuple4; diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferViewModel.java b/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferViewModel.java index 064548ba159..3d262b5d5eb 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferViewModel.java @@ -30,7 +30,7 @@ import bisq.core.offer.OpenOffer; import bisq.core.provider.price.PriceFeedService; import bisq.core.user.Preferences; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.FormattingUtils; import bisq.core.util.coin.CoinFormatter; diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/openoffer/OpenOffersViewModel.java b/desktop/src/main/java/bisq/desktop/main/portfolio/openoffer/OpenOffersViewModel.java index b1b18135855..63318ac1af4 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/openoffer/OpenOffersViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/openoffer/OpenOffersViewModel.java @@ -27,7 +27,7 @@ import bisq.core.monetary.Price; import bisq.core.offer.Offer; import bisq.core.offer.OpenOffer; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.FormattingUtils; import bisq.core.util.coin.CoinFormatter; diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesViewModel.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesViewModel.java index 0563b373473..d723e2f041a 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesViewModel.java @@ -32,7 +32,7 @@ import bisq.core.trade.Trade; import bisq.core.trade.closed.ClosedTradableManager; import bisq.core.user.User; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.FormattingUtils; import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.BtcAddressValidator; diff --git a/desktop/src/main/java/bisq/desktop/util/GUIUtil.java b/desktop/src/main/java/bisq/desktop/util/GUIUtil.java index ae86360876c..7a570583918 100644 --- a/desktop/src/main/java/bisq/desktop/util/GUIUtil.java +++ b/desktop/src/main/java/bisq/desktop/util/GUIUtil.java @@ -49,7 +49,7 @@ import bisq.core.user.DontShowAgainLookup; import bisq.core.user.Preferences; import bisq.core.user.User; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.coin.CoinFormatter; import bisq.core.util.coin.CoinUtil; import bisq.core.util.FormattingUtils; diff --git a/desktop/src/main/java/bisq/desktop/util/validation/BsqAddressValidator.java b/desktop/src/main/java/bisq/desktop/util/validation/BsqAddressValidator.java index f4dd1c45090..c4f441b5f0d 100644 --- a/desktop/src/main/java/bisq/desktop/util/validation/BsqAddressValidator.java +++ b/desktop/src/main/java/bisq/desktop/util/validation/BsqAddressValidator.java @@ -18,7 +18,7 @@ package bisq.desktop.util.validation; import bisq.core.locale.Res; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.validation.InputValidator; import javax.inject.Inject; diff --git a/desktop/src/main/java/bisq/desktop/util/validation/BsqValidator.java b/desktop/src/main/java/bisq/desktop/util/validation/BsqValidator.java index a5110ada79e..306314455a8 100644 --- a/desktop/src/main/java/bisq/desktop/util/validation/BsqValidator.java +++ b/desktop/src/main/java/bisq/desktop/util/validation/BsqValidator.java @@ -19,7 +19,7 @@ import bisq.core.btc.wallet.Restrictions; import bisq.core.locale.Res; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.coin.CoinUtil; import bisq.core.util.ParsingUtils; diff --git a/desktop/src/test/java/bisq/desktop/GuiceSetupTest.java b/desktop/src/test/java/bisq/desktop/GuiceSetupTest.java index 1e359df2c27..64ebac25634 100644 --- a/desktop/src/test/java/bisq/desktop/GuiceSetupTest.java +++ b/desktop/src/test/java/bisq/desktop/GuiceSetupTest.java @@ -47,8 +47,8 @@ import bisq.core.support.traderchat.TraderChatManager; import bisq.core.user.Preferences; import bisq.core.user.User; -import bisq.core.util.ImmutableCoinFormatter; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.ImmutableCoinFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.network.p2p.network.BridgeAddressProvider; import bisq.network.p2p.seed.SeedNodeRepository; diff --git a/desktop/src/test/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModelTest.java b/desktop/src/test/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModelTest.java index f6e2abd5f24..397276265c1 100644 --- a/desktop/src/test/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/market/offerbook/OfferBookChartViewModelTest.java @@ -23,7 +23,7 @@ import bisq.core.locale.GlobalSettings; import bisq.core.provider.price.PriceFeedService; -import bisq.core.util.ImmutableCoinFormatter; +import bisq.core.util.coin.ImmutableCoinFormatter; import javafx.beans.property.SimpleIntegerProperty; diff --git a/desktop/src/test/java/bisq/desktop/main/market/spread/SpreadViewModelTest.java b/desktop/src/test/java/bisq/desktop/main/market/spread/SpreadViewModelTest.java index 62d01608ad7..3967264f2d8 100644 --- a/desktop/src/test/java/bisq/desktop/main/market/spread/SpreadViewModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/market/spread/SpreadViewModelTest.java @@ -23,7 +23,7 @@ import bisq.desktop.main.offer.offerbook.OfferBookListItemMaker; import bisq.core.provider.price.PriceFeedService; -import bisq.core.util.ImmutableCoinFormatter; +import bisq.core.util.coin.ImmutableCoinFormatter; import javafx.collections.FXCollections; import javafx.collections.ObservableList; diff --git a/desktop/src/test/java/bisq/desktop/main/market/trades/TradesChartsViewModelTest.java b/desktop/src/test/java/bisq/desktop/main/market/trades/TradesChartsViewModelTest.java index f1027327201..61076cbf8a0 100644 --- a/desktop/src/test/java/bisq/desktop/main/market/trades/TradesChartsViewModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/market/trades/TradesChartsViewModelTest.java @@ -27,7 +27,7 @@ import bisq.core.trade.statistics.TradeStatistics2; import bisq.core.trade.statistics.TradeStatisticsManager; import bisq.core.user.Preferences; -import bisq.core.util.ImmutableCoinFormatter; +import bisq.core.util.coin.ImmutableCoinFormatter; import bisq.common.crypto.KeyRing; import bisq.common.crypto.KeyStorage; diff --git a/desktop/src/test/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModelTest.java b/desktop/src/test/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModelTest.java index bac6a2bc71a..b374ce29018 100644 --- a/desktop/src/test/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModelTest.java @@ -39,8 +39,8 @@ import bisq.core.provider.price.PriceFeedService; import bisq.core.user.Preferences; import bisq.core.user.User; -import bisq.core.util.ImmutableCoinFormatter; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.ImmutableCoinFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; diff --git a/desktop/src/test/java/bisq/desktop/main/offer/offerbook/OfferBookViewModelTest.java b/desktop/src/test/java/bisq/desktop/main/offer/offerbook/OfferBookViewModelTest.java index 39e27294d08..5b103e81ccc 100644 --- a/desktop/src/test/java/bisq/desktop/main/offer/offerbook/OfferBookViewModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/offer/offerbook/OfferBookViewModelTest.java @@ -41,8 +41,8 @@ import bisq.core.payment.payload.SpecificBanksAccountPayload; import bisq.core.provider.price.MarketPrice; import bisq.core.provider.price.PriceFeedService; -import bisq.core.util.ImmutableCoinFormatter; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.ImmutableCoinFormatter; +import bisq.core.util.coin.BsqFormatter; import javafx.beans.property.SimpleIntegerProperty; diff --git a/desktop/src/test/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModelTest.java b/desktop/src/test/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModelTest.java index 6dbd92a48e0..d7fe69d6c57 100644 --- a/desktop/src/test/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModelTest.java +++ b/desktop/src/test/java/bisq/desktop/main/portfolio/editoffer/EditOfferDataModelTest.java @@ -21,8 +21,8 @@ import bisq.core.provider.price.PriceFeedService; import bisq.core.user.Preferences; import bisq.core.user.User; -import bisq.core.util.ImmutableCoinFormatter; -import bisq.core.util.BsqFormatter; +import bisq.core.util.coin.ImmutableCoinFormatter; +import bisq.core.util.coin.BsqFormatter; import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; diff --git a/desktop/src/test/java/bisq/desktop/util/DisplayUtilsTest.java b/desktop/src/test/java/bisq/desktop/util/DisplayUtilsTest.java index 272bdc8fb87..9d4053c0de3 100644 --- a/desktop/src/test/java/bisq/desktop/util/DisplayUtilsTest.java +++ b/desktop/src/test/java/bisq/desktop/util/DisplayUtilsTest.java @@ -4,7 +4,7 @@ import bisq.core.monetary.Volume; import bisq.core.offer.Offer; import bisq.core.offer.OfferPayload; -import bisq.core.util.ImmutableCoinFormatter; +import bisq.core.util.coin.ImmutableCoinFormatter; import bisq.core.util.coin.CoinFormatter; import org.bitcoinj.core.Coin; diff --git a/desktop/src/test/java/bisq/desktop/util/ImmutableCoinFormatterTest.java b/desktop/src/test/java/bisq/desktop/util/ImmutableCoinFormatterTest.java index 1933354653b..cd3daf78b5f 100644 --- a/desktop/src/test/java/bisq/desktop/util/ImmutableCoinFormatterTest.java +++ b/desktop/src/test/java/bisq/desktop/util/ImmutableCoinFormatterTest.java @@ -18,7 +18,7 @@ package bisq.desktop.util; import bisq.core.locale.Res; -import bisq.core.util.ImmutableCoinFormatter; +import bisq.core.util.coin.ImmutableCoinFormatter; import bisq.core.util.coin.CoinFormatter; import org.bitcoinj.core.CoinMaker; diff --git a/desktop/src/test/java/bisq/desktop/util/validation/BtcValidatorTest.java b/desktop/src/test/java/bisq/desktop/util/validation/BtcValidatorTest.java index 6824c6baed7..aab040fb8c0 100644 --- a/desktop/src/test/java/bisq/desktop/util/validation/BtcValidatorTest.java +++ b/desktop/src/test/java/bisq/desktop/util/validation/BtcValidatorTest.java @@ -21,7 +21,7 @@ import bisq.core.btc.BaseCurrencyNetwork; import bisq.core.locale.CurrencyUtil; import bisq.core.locale.Res; -import bisq.core.util.ImmutableCoinFormatter; +import bisq.core.util.coin.ImmutableCoinFormatter; import org.bitcoinj.core.Coin; From 68a988b3a81179f33e363ec2a5102813601476b6 Mon Sep 17 00:00:00 2001 From: Justin Carter Date: Tue, 19 Nov 2019 14:24:30 +0100 Subject: [PATCH 6/7] Remove dead code --- .../bisq/core/util/coin/BsqFormatter.java | 20 ++----------------- .../util/coin/ImmutableCoinFormatter.java | 3 --- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/core/src/main/java/bisq/core/util/coin/BsqFormatter.java b/core/src/main/java/bisq/core/util/coin/BsqFormatter.java index e1369b7812e..30816d864a0 100644 --- a/core/src/main/java/bisq/core/util/coin/BsqFormatter.java +++ b/core/src/main/java/bisq/core/util/coin/BsqFormatter.java @@ -159,7 +159,7 @@ public String formatBTCWithCode(Coin coin) { return FormattingUtils.formatCoinWithCode(coin, btcCoinFormat); } - public String formatBTC(Coin coin) { + private String formatBTC(Coin coin) { return FormattingUtils.formatCoin(coin.value, btcCoinFormat); } @@ -167,22 +167,6 @@ public Coin parseToBTC(String input) { return ParsingUtils.parseToCoin(input, btcCoinFormat); } - public void validateBtcInput(String input) throws ProposalValidationException { - validateCoinInput(input, btcCoinFormat); - } - - public void validateBsqInput(String input) throws ProposalValidationException { - validateCoinInput(input, monetaryFormat); - } - - private void validateCoinInput(String input, MonetaryFormat coinFormat) throws ProposalValidationException { - try { - coinFormat.parse(ParsingUtils.cleanDoubleInput(input)); - } catch (Throwable t) { - throw new ProposalValidationException("Invalid format for a " + coinFormat.code() + " value"); - } - } - public String formatParamValue(Param param, String value) { switch (param.getParamType()) { case UNDEFINED: @@ -215,7 +199,7 @@ public Coin parseParamValueToCoin(Param param, String inputValue) { } } - public int parseParamValueToBlocks(Param param, String inputValue) { + private int parseParamValueToBlocks(Param param, String inputValue) { switch (param.getParamType()) { case BLOCK: return Integer.parseInt(inputValue); diff --git a/core/src/main/java/bisq/core/util/coin/ImmutableCoinFormatter.java b/core/src/main/java/bisq/core/util/coin/ImmutableCoinFormatter.java index 1cb2ae40122..465824529c2 100644 --- a/core/src/main/java/bisq/core/util/coin/ImmutableCoinFormatter.java +++ b/core/src/main/java/bisq/core/util/coin/ImmutableCoinFormatter.java @@ -44,9 +44,6 @@ public class ImmutableCoinFormatter implements CoinFormatter { @Getter private MonetaryFormat monetaryFormat; - // protected String currencyCode = CurrencyUtil.getDefaultFiatCurrencyAsCode(); - - @Inject public ImmutableCoinFormatter() { monetaryFormat = BisqEnvironment.getParameters().getMonetaryFormat(); From 80fda1ec2ce521ea2216140a5cf817073742f86e Mon Sep 17 00:00:00 2001 From: Justin Carter Date: Tue, 19 Nov 2019 15:25:36 +0100 Subject: [PATCH 7/7] Inject CoinFormatter via BTC_FORMATTER_KEY --- core/src/main/java/bisq/core/CoreModule.java | 6 +++++ .../main/java/bisq/core/app/BisqSetup.java | 4 ++- .../java/bisq/core/app/WalletAppSetup.java | 3 ++- .../alerts/market/MarketAlerts.java | 3 ++- .../alerts/price/PriceAlert.java | 5 +--- .../presentation/BalancePresentation.java | 4 ++- .../java/bisq/core/util/FormattingUtils.java | 2 ++ .../bisq/core/util/coin/BsqFormatter.java | 2 +- .../util/coin/ImmutableCoinFormatter.java | 5 ++-- .../main/java/bisq/desktop/main/MainView.java | 4 ++- .../altcoinaccounts/AltCoinAccountsView.java | 4 ++- .../fiataccounts/FiatAccountsView.java | 4 ++- .../MobileNotificationsView.java | 3 ++- .../main/dao/bonding/BondingViewUtils.java | 6 ++--- .../dao/burnbsq/assetfee/AssetFeeView.java | 4 ++- .../burnbsq/proofofburn/ProofOfBurnView.java | 4 ++- .../dashboard/GovernanceDashboardView.java | 4 ++- .../dao/governance/make/MakeProposalView.java | 4 ++- .../governance/proposals/ProposalsView.java | 4 ++- .../main/dao/wallet/send/BsqSendView.java | 4 ++- .../main/funds/deposit/DepositView.java | 4 ++- .../desktop/main/funds/locked/LockedView.java | 4 ++- .../main/funds/reserved/ReservedView.java | 4 ++- .../TransactionListItemFactory.java | 4 ++- .../main/funds/withdrawal/WithdrawalView.java | 4 ++- .../bisq/desktop/main/market/MarketView.java | 3 ++- .../market/offerbook/OfferBookChartView.java | 2 +- .../offerbook/OfferBookChartViewModel.java | 5 +++- .../main/market/spread/SpreadView.java | 4 ++- .../main/market/spread/SpreadViewModel.java | 4 ++- .../main/market/trades/TradesChartsView.java | 3 ++- .../market/trades/TradesChartsViewModel.java | 5 +++- .../main/offer/MutableOfferDataModel.java | 5 +++- .../main/offer/MutableOfferViewModel.java | 3 ++- .../createoffer/CreateOfferDataModel.java | 5 +++- .../offer/createoffer/CreateOfferView.java | 5 +++- .../createoffer/CreateOfferViewModel.java | 5 +++- .../main/offer/offerbook/OfferBookView.java | 3 ++- .../offer/offerbook/OfferBookViewModel.java | 4 ++- .../offer/takeoffer/TakeOfferViewModel.java | 3 ++- .../main/overlays/windows/ContractWindow.java | 3 ++- .../windows/DisputeSummaryWindow.java | 3 ++- .../overlays/windows/EmptyWalletWindow.java | 4 ++- .../overlays/windows/OfferDetailsWindow.java | 3 ++- .../overlays/windows/TradeDetailsWindow.java | 3 ++- .../closedtrades/ClosedTradesView.java | 3 ++- .../closedtrades/ClosedTradesViewModel.java | 4 ++- .../editoffer/EditOfferDataModel.java | 5 +++- .../portfolio/editoffer/EditOfferView.java | 5 +++- .../editoffer/EditOfferViewModel.java | 4 ++- .../failedtrades/FailedTradesViewModel.java | 4 ++- .../openoffer/OpenOffersViewModel.java | 4 ++- .../pendingtrades/PendingTradesView.java | 2 +- .../pendingtrades/PendingTradesViewModel.java | 4 ++- .../presentation/MarketPricePresentation.java | 3 ++- .../settings/network/NetworkSettingsView.java | 3 ++- .../settings/preferences/PreferencesView.java | 2 +- .../agent/arbitration/ArbitratorView.java | 3 ++- .../dispute/agent/mediation/MediatorView.java | 3 ++- .../dispute/agent/refund/RefundAgentView.java | 3 ++- .../arbitration/ArbitrationClientView.java | 3 ++- .../client/mediation/MediationClientView.java | 3 ++- .../client/refund/RefundClientView.java | 3 ++- .../desktop/util/validation/BtcValidator.java | 4 ++- .../java/bisq/desktop/GuiceSetupTest.java | 2 -- .../OfferBookChartViewModelTest.java | 24 ++++++++++-------- .../market/spread/SpreadViewModelTest.java | 10 +++++--- .../createoffer/CreateOfferViewModelTest.java | 3 ++- .../offerbook/OfferBookViewModelTest.java | 25 +++++++++++-------- .../editoffer/EditOfferDataModelTest.java | 3 +-- .../bisq/desktop/util/DisplayUtilsTest.java | 3 ++- .../util/ImmutableCoinFormatterTest.java | 4 +-- .../util/validation/BtcValidatorTest.java | 5 +++- 73 files changed, 215 insertions(+), 103 deletions(-) diff --git a/core/src/main/java/bisq/core/CoreModule.java b/core/src/main/java/bisq/core/CoreModule.java index 3e5812bbe3f..4d921e6501e 100644 --- a/core/src/main/java/bisq/core/CoreModule.java +++ b/core/src/main/java/bisq/core/CoreModule.java @@ -30,6 +30,9 @@ import bisq.core.proto.persistable.CorePersistenceProtoResolver; import bisq.core.trade.TradeModule; import bisq.core.user.Preferences; +import bisq.core.util.FormattingUtils; +import bisq.core.util.coin.CoinFormatter; +import bisq.core.util.coin.ImmutableCoinFormatter; import bisq.network.crypto.EncryptionServiceModule; import bisq.network.p2p.P2PModule; @@ -70,6 +73,9 @@ protected void configure() { File storageDir = new File(environment.getRequiredProperty(Storage.STORAGE_DIR)); bind(File.class).annotatedWith(named(Storage.STORAGE_DIR)).toInstance(storageDir); + CoinFormatter btcFormatter = new ImmutableCoinFormatter(BisqEnvironment.getParameters().getMonetaryFormat()); + bind(CoinFormatter.class).annotatedWith(named(FormattingUtils.BTC_FORMATTER_KEY)).toInstance(btcFormatter); + File keyStorageDir = new File(environment.getRequiredProperty(KeyStorage.KEY_STORAGE_DIR)); bind(File.class).annotatedWith(named(KeyStorage.KEY_STORAGE_DIR)).toInstance(keyStorageDir); diff --git a/core/src/main/java/bisq/core/app/BisqSetup.java b/core/src/main/java/bisq/core/app/BisqSetup.java index 1279032b1df..0bdc9960bd5 100644 --- a/core/src/main/java/bisq/core/app/BisqSetup.java +++ b/core/src/main/java/bisq/core/app/BisqSetup.java @@ -60,6 +60,7 @@ import bisq.core.trade.statistics.TradeStatisticsManager; import bisq.core.user.Preferences; import bisq.core.user.User; +import bisq.core.util.FormattingUtils; import bisq.core.util.coin.CoinFormatter; import bisq.network.crypto.DecryptedDataTuple; @@ -82,6 +83,7 @@ import org.bitcoinj.core.Coin; import javax.inject.Inject; +import javax.inject.Named; import javax.inject.Singleton; import com.google.common.net.InetAddresses; @@ -270,7 +272,7 @@ public BisqSetup(P2PNetworkSetup p2PNetworkSetup, AssetService assetService, TorSetup torSetup, TradeLimits tradeLimits, - CoinFormatter formatter) { + @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter) { this.p2PNetworkSetup = p2PNetworkSetup; diff --git a/core/src/main/java/bisq/core/app/WalletAppSetup.java b/core/src/main/java/bisq/core/app/WalletAppSetup.java index 6ce43b94e0b..229d5626d23 100644 --- a/core/src/main/java/bisq/core/app/WalletAppSetup.java +++ b/core/src/main/java/bisq/core/app/WalletAppSetup.java @@ -30,6 +30,7 @@ import org.bitcoinj.store.ChainFileLockedException; import javax.inject.Inject; +import javax.inject.Named; import javax.inject.Singleton; import org.fxmisc.easybind.EasyBind; @@ -84,7 +85,7 @@ public WalletAppSetup(WalletsManager walletsManager, WalletsSetup walletsSetup, BisqEnvironment bisqEnvironment, Preferences preferences, - CoinFormatter formatter) { + @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter) { this.walletsManager = walletsManager; this.walletsSetup = walletsSetup; this.bisqEnvironment = bisqEnvironment; diff --git a/core/src/main/java/bisq/core/notifications/alerts/market/MarketAlerts.java b/core/src/main/java/bisq/core/notifications/alerts/market/MarketAlerts.java index 2663cb46fc7..eef24d1b660 100644 --- a/core/src/main/java/bisq/core/notifications/alerts/market/MarketAlerts.java +++ b/core/src/main/java/bisq/core/notifications/alerts/market/MarketAlerts.java @@ -39,6 +39,7 @@ import org.bitcoinj.utils.Fiat; import javax.inject.Inject; +import javax.inject.Named; import javax.inject.Singleton; import java.util.List; @@ -58,7 +59,7 @@ public class MarketAlerts { @Inject public MarketAlerts(OfferBookService offerBookService, MobileNotificationService mobileNotificationService, - User user, PriceFeedService priceFeedService, KeyRing keyRing, CoinFormatter formatter) { + User user, PriceFeedService priceFeedService, KeyRing keyRing, @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter) { this.offerBookService = offerBookService; this.mobileNotificationService = mobileNotificationService; this.user = user; diff --git a/core/src/main/java/bisq/core/notifications/alerts/price/PriceAlert.java b/core/src/main/java/bisq/core/notifications/alerts/price/PriceAlert.java index 6798b2c91d5..70c8ac91709 100644 --- a/core/src/main/java/bisq/core/notifications/alerts/price/PriceAlert.java +++ b/core/src/main/java/bisq/core/notifications/alerts/price/PriceAlert.java @@ -27,7 +27,6 @@ import bisq.core.provider.price.PriceFeedService; import bisq.core.user.User; import bisq.core.util.FormattingUtils; -import bisq.core.util.coin.CoinFormatter; import bisq.common.util.MathUtils; @@ -44,14 +43,12 @@ public class PriceAlert { private final PriceFeedService priceFeedService; private final MobileNotificationService mobileNotificationService; private final User user; - private final CoinFormatter formatter; @Inject - public PriceAlert(PriceFeedService priceFeedService, MobileNotificationService mobileNotificationService, User user, CoinFormatter formatter) { + public PriceAlert(PriceFeedService priceFeedService, MobileNotificationService mobileNotificationService, User user) { this.priceFeedService = priceFeedService; this.user = user; this.mobileNotificationService = mobileNotificationService; - this.formatter = formatter; } public void onAllServicesInitialized() { diff --git a/core/src/main/java/bisq/core/presentation/BalancePresentation.java b/core/src/main/java/bisq/core/presentation/BalancePresentation.java index 3c66e90ad5d..a7a035e1a77 100644 --- a/core/src/main/java/bisq/core/presentation/BalancePresentation.java +++ b/core/src/main/java/bisq/core/presentation/BalancePresentation.java @@ -18,9 +18,11 @@ package bisq.core.presentation; import bisq.core.btc.Balances; +import bisq.core.util.FormattingUtils; import bisq.core.util.coin.CoinFormatter; import javax.inject.Inject; +import javax.inject.Named; import javafx.beans.property.SimpleStringProperty; import javafx.beans.property.StringProperty; @@ -38,7 +40,7 @@ public class BalancePresentation { private final StringProperty lockedBalance = new SimpleStringProperty(); @Inject - public BalancePresentation(Balances balances, CoinFormatter formatter) { + public BalancePresentation(Balances balances, @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter) { balances.getAvailableBalance().addListener((observable, oldValue, newValue) -> { String value = formatter.formatCoinWithCode(newValue); // If we get full precision the BTC postfix breaks layout so we omit it diff --git a/core/src/main/java/bisq/core/util/FormattingUtils.java b/core/src/main/java/bisq/core/util/FormattingUtils.java index a3d535944fa..7c470c727d8 100644 --- a/core/src/main/java/bisq/core/util/FormattingUtils.java +++ b/core/src/main/java/bisq/core/util/FormattingUtils.java @@ -31,6 +31,8 @@ @Slf4j public class FormattingUtils { + public static final String BTC_FORMATTER_KEY = "BTC"; + public final static String RANGE_SEPARATOR = " - "; private static final MonetaryFormat fiatPriceFormat = new MonetaryFormat().shift(0).minDecimals(4).repeatOptionalDecimals(0, 0); diff --git a/core/src/main/java/bisq/core/util/coin/BsqFormatter.java b/core/src/main/java/bisq/core/util/coin/BsqFormatter.java index 30816d864a0..9a39930b9ba 100644 --- a/core/src/main/java/bisq/core/util/coin/BsqFormatter.java +++ b/core/src/main/java/bisq/core/util/coin/BsqFormatter.java @@ -73,7 +73,7 @@ public class BsqFormatter implements CoinFormatter { @Inject public BsqFormatter() { this.monetaryFormat = BisqEnvironment.getParameters().getMonetaryFormat(); - this.immutableCoinFormatter = new ImmutableCoinFormatter(); + this.immutableCoinFormatter = new ImmutableCoinFormatter(BisqEnvironment.getParameters().getMonetaryFormat()); GlobalSettings.localeProperty().addListener((observable, oldValue, newValue) -> switchLocale(newValue)); switchLocale(GlobalSettings.getLocale()); diff --git a/core/src/main/java/bisq/core/util/coin/ImmutableCoinFormatter.java b/core/src/main/java/bisq/core/util/coin/ImmutableCoinFormatter.java index 465824529c2..ef2c58b2041 100644 --- a/core/src/main/java/bisq/core/util/coin/ImmutableCoinFormatter.java +++ b/core/src/main/java/bisq/core/util/coin/ImmutableCoinFormatter.java @@ -33,7 +33,6 @@ import org.jetbrains.annotations.NotNull; @Slf4j -@Singleton public class ImmutableCoinFormatter implements CoinFormatter { // We don't support localized formatting. Format is always using "." as decimal mark and no grouping separator. @@ -45,8 +44,8 @@ public class ImmutableCoinFormatter implements CoinFormatter { private MonetaryFormat monetaryFormat; @Inject - public ImmutableCoinFormatter() { - monetaryFormat = BisqEnvironment.getParameters().getMonetaryFormat(); + public ImmutableCoinFormatter(MonetaryFormat monetaryFormat) { + this.monetaryFormat = monetaryFormat; } diff --git a/desktop/src/main/java/bisq/desktop/main/MainView.java b/desktop/src/main/java/bisq/desktop/main/MainView.java index 5b6aa5ad408..ba5e561c7de 100644 --- a/desktop/src/main/java/bisq/desktop/main/MainView.java +++ b/desktop/src/main/java/bisq/desktop/main/MainView.java @@ -47,6 +47,7 @@ import bisq.core.locale.GlobalSettings; import bisq.core.locale.LanguageUtil; import bisq.core.locale.Res; +import bisq.core.util.FormattingUtils; import bisq.core.util.coin.CoinFormatter; import bisq.common.Timer; @@ -56,6 +57,7 @@ import bisq.common.util.Utilities; import javax.inject.Inject; +import javax.inject.Named; import com.jfoenix.controls.JFXBadge; import com.jfoenix.controls.JFXComboBox; @@ -164,7 +166,7 @@ public MainView(MainViewModel model, CachingViewLoader viewLoader, Navigation navigation, Transitions transitions, - CoinFormatter formatter, + @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter, DaoStateMonitoringService daoStateMonitoringService) { super(model); this.viewLoader = viewLoader; diff --git a/desktop/src/main/java/bisq/desktop/main/account/content/altcoinaccounts/AltCoinAccountsView.java b/desktop/src/main/java/bisq/desktop/main/account/content/altcoinaccounts/AltCoinAccountsView.java index 2ef187d623a..f325baf535f 100644 --- a/desktop/src/main/java/bisq/desktop/main/account/content/altcoinaccounts/AltCoinAccountsView.java +++ b/desktop/src/main/java/bisq/desktop/main/account/content/altcoinaccounts/AltCoinAccountsView.java @@ -38,6 +38,7 @@ import bisq.core.payment.payload.PaymentMethod; import bisq.core.payment.validation.AltCoinAddressValidator; import bisq.core.user.Preferences; +import bisq.core.util.FormattingUtils; import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; @@ -49,6 +50,7 @@ import bisq.common.util.Tuple3; import javax.inject.Inject; +import javax.inject.Named; import javafx.stage.Stage; @@ -90,7 +92,7 @@ public AltCoinAccountsView(AltCoinAccountsViewModel model, AccountAgeWitnessService accountAgeWitnessService, AssetService assetService, FilterManager filterManager, - CoinFormatter formatter, + @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter, Preferences preferences) { super(model, accountAgeWitnessService); diff --git a/desktop/src/main/java/bisq/desktop/main/account/content/fiataccounts/FiatAccountsView.java b/desktop/src/main/java/bisq/desktop/main/account/content/fiataccounts/FiatAccountsView.java index 40de6d6e5c4..12131435168 100644 --- a/desktop/src/main/java/bisq/desktop/main/account/content/fiataccounts/FiatAccountsView.java +++ b/desktop/src/main/java/bisq/desktop/main/account/content/fiataccounts/FiatAccountsView.java @@ -86,6 +86,7 @@ import bisq.core.payment.USPostalMoneyOrderAccount; import bisq.core.payment.WesternUnionAccount; import bisq.core.payment.payload.PaymentMethod; +import bisq.core.util.FormattingUtils; import bisq.core.util.coin.CoinFormatter; import bisq.core.util.validation.InputValidator; @@ -95,6 +96,7 @@ import org.bitcoinj.core.Coin; import javax.inject.Inject; +import javax.inject.Named; import javafx.stage.Stage; @@ -171,7 +173,7 @@ public FiatAccountsView(FiatAccountsViewModel model, PromptPayValidator promptPayValidator, AdvancedCashValidator advancedCashValidator, AccountAgeWitnessService accountAgeWitnessService, - CoinFormatter formatter) { + @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter) { super(model, accountAgeWitnessService); this.ibanValidator = ibanValidator; diff --git a/desktop/src/main/java/bisq/desktop/main/account/content/notifications/MobileNotificationsView.java b/desktop/src/main/java/bisq/desktop/main/account/content/notifications/MobileNotificationsView.java index 91a860f8647..d121354db85 100644 --- a/desktop/src/main/java/bisq/desktop/main/account/content/notifications/MobileNotificationsView.java +++ b/desktop/src/main/java/bisq/desktop/main/account/content/notifications/MobileNotificationsView.java @@ -57,6 +57,7 @@ import bisq.common.util.Tuple3; import javax.inject.Inject; +import javax.inject.Named; import javafx.scene.control.Button; import javafx.scene.control.ComboBox; @@ -127,7 +128,7 @@ private MobileNotificationsView(Preferences preferences, PriceFeedService priceFeedService, MarketAlerts marketAlerts, MobileNotificationService mobileNotificationService, - CoinFormatter formatter) { + @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter) { super(); this.preferences = preferences; this.user = user; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/bonding/BondingViewUtils.java b/desktop/src/main/java/bisq/desktop/main/dao/bonding/BondingViewUtils.java index e6c0a61366c..ce3cd533545 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/bonding/BondingViewUtils.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/bonding/BondingViewUtils.java @@ -114,14 +114,13 @@ private void lockupBond(byte[] hash, Coin lockupAmount, int lockupTime, LockupRe Tuple2 miningFeeAndTxSize = daoFacade.getLockupTxMiningFeeAndTxSize(lockupAmount, lockupTime, lockupReason, hash); Coin miningFee = miningFeeAndTxSize.first; int txSize = miningFeeAndTxSize.second; - CoinFormatter formatter = new ImmutableCoinFormatter(); String duration = FormattingUtils.formatDurationAsWords(lockupTime * 10 * 60 * 1000L, false, false); new Popup<>().headLine(Res.get("dao.bond.reputation.lockup.headline")) .confirmation(Res.get("dao.bond.reputation.lockup.details", bsqFormatter.formatCoinWithCode(lockupAmount), lockupTime, duration, - formatter.formatCoinWithCode(miningFee), + bsqFormatter.formatBTCWithCode(miningFee), CoinUtil.getFeePerByte(miningFee, txSize), txSize / 1000d )) @@ -173,14 +172,13 @@ public void unLock(String lockupTxId, Consumer resultHandler) { Tuple2 miningFeeAndTxSize = daoFacade.getUnlockTxMiningFeeAndTxSize(lockupTxId); Coin miningFee = miningFeeAndTxSize.first; int txSize = miningFeeAndTxSize.second; - CoinFormatter formatter = new ImmutableCoinFormatter(); String duration = FormattingUtils.formatDurationAsWords(lockTime * 10 * 60 * 1000L, false, false); new Popup<>().headLine(Res.get("dao.bond.reputation.unlock.headline")) .confirmation(Res.get("dao.bond.reputation.unlock.details", bsqFormatter.formatCoinWithCode(unlockAmount), lockTime, duration, - formatter.formatCoinWithCode(miningFee), + bsqFormatter.formatBTCWithCode(miningFee), CoinUtil.getFeePerByte(miningFee, txSize), txSize / 1000d )) diff --git a/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/assetfee/AssetFeeView.java b/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/assetfee/AssetFeeView.java index d93f3dc2448..de773e7e32d 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/assetfee/AssetFeeView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/assetfee/AssetFeeView.java @@ -34,6 +34,7 @@ import bisq.core.dao.governance.proposal.TxException; import bisq.core.locale.CurrencyUtil; import bisq.core.locale.Res; +import bisq.core.util.FormattingUtils; import bisq.core.util.coin.BsqFormatter; import bisq.core.util.ParsingUtils; import bisq.core.util.coin.CoinFormatter; @@ -45,6 +46,7 @@ import org.bitcoinj.core.Transaction; import javax.inject.Inject; +import javax.inject.Named; import javafx.scene.control.Button; import javafx.scene.control.ComboBox; @@ -109,7 +111,7 @@ private AssetFeeView(BsqFormatter bsqFormatter, BsqWalletService bsqWalletService, BsqValidator bsqValidator, AssetService assetService, - CoinFormatter btcFormatter) { + @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter btcFormatter) { this.bsqFormatter = bsqFormatter; this.bsqWalletService = bsqWalletService; this.bsqValidator = bsqValidator; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/proofofburn/ProofOfBurnView.java b/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/proofofburn/ProofOfBurnView.java index 04f0fb8f3dc..30bea2183a7 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/proofofburn/ProofOfBurnView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/burnbsq/proofofburn/ProofOfBurnView.java @@ -37,6 +37,7 @@ import bisq.core.dao.governance.proposal.TxException; import bisq.core.locale.Res; import bisq.core.user.Preferences; +import bisq.core.util.FormattingUtils; import bisq.core.util.coin.BsqFormatter; import bisq.core.util.ParsingUtils; import bisq.core.util.coin.CoinFormatter; @@ -49,6 +50,7 @@ import org.bitcoinj.core.Transaction; import javax.inject.Inject; +import javax.inject.Named; import javafx.scene.control.Button; import javafx.scene.control.TableCell; @@ -116,7 +118,7 @@ private ProofOfBurnView(BsqFormatter bsqFormatter, ProofOfBurnService proofOfBurnService, MyProofOfBurnListService myProofOfBurnListService, Preferences preferences, - CoinFormatter btcFormatter) { + @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter btcFormatter) { this.bsqFormatter = bsqFormatter; this.bsqWalletService = bsqWalletService; this.bsqValidator = bsqValidator; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/dashboard/GovernanceDashboardView.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/dashboard/GovernanceDashboardView.java index 10fbf808f8a..1080eacb4c2 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/dashboard/GovernanceDashboardView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/dashboard/GovernanceDashboardView.java @@ -30,9 +30,11 @@ import bisq.core.dao.state.model.blockchain.Block; import bisq.core.dao.state.model.governance.DaoPhase; import bisq.core.locale.Res; +import bisq.core.util.FormattingUtils; import bisq.core.util.coin.CoinFormatter; import javax.inject.Inject; +import javax.inject.Named; import javafx.scene.control.TextField; import javafx.scene.layout.GridPane; @@ -59,7 +61,7 @@ public class GovernanceDashboardView extends ActivatableView imp /////////////////////////////////////////////////////////////////////////////////////////// @Inject - public GovernanceDashboardView(DaoFacade daoFacade, PeriodService periodService, PhasesView phasesView, CoinFormatter formatter) { + public GovernanceDashboardView(DaoFacade daoFacade, PeriodService periodService, PhasesView phasesView, @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter) { this.daoFacade = daoFacade; this.periodService = periodService; this.phasesView = phasesView; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.java index 916a81835ee..a6bb2295c1f 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/make/MakeProposalView.java @@ -50,6 +50,7 @@ import bisq.core.dao.state.model.governance.Proposal; import bisq.core.dao.state.model.governance.Role; import bisq.core.locale.Res; +import bisq.core.util.FormattingUtils; import bisq.core.util.coin.BsqFormatter; import bisq.core.util.ParsingUtils; import bisq.core.util.coin.CoinFormatter; @@ -67,6 +68,7 @@ import org.bitcoinj.core.Transaction; import javax.inject.Inject; +import javax.inject.Named; import javafx.scene.control.Button; import javafx.scene.control.ComboBox; @@ -144,7 +146,7 @@ private MakeProposalView(DaoFacade daoFacade, BsqWalletService bsqWalletService, PhasesView phasesView, ChangeParamValidator changeParamValidator, - CoinFormatter btcFormatter, + @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter btcFormatter, BsqFormatter bsqFormatter, Navigation navigation) { this.daoFacade = daoFacade; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java b/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java index 80b8715fa65..d68fae03664 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/governance/proposals/ProposalsView.java @@ -53,6 +53,7 @@ import bisq.core.dao.state.model.governance.Vote; import bisq.core.locale.Res; import bisq.core.user.Preferences; +import bisq.core.util.FormattingUtils; import bisq.core.util.coin.BsqFormatter; import bisq.core.util.ParsingUtils; import bisq.core.util.coin.CoinFormatter; @@ -67,6 +68,7 @@ import org.bitcoinj.core.InsufficientMoneyException; import javax.inject.Inject; +import javax.inject.Named; import com.jfoenix.controls.JFXButton; @@ -170,7 +172,7 @@ private ProposalsView(DaoFacade daoFacade, MyBlindVoteListService myBlindVoteListService, Preferences preferences, BsqFormatter bsqFormatter, - CoinFormatter btcFormatter, + @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter btcFormatter, SelectProposalWindow selectProposalWindow) { this.daoFacade = daoFacade; this.bsqWalletService = bsqWalletService; diff --git a/desktop/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.java b/desktop/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.java index d0ba127588c..0cb5d01c58e 100644 --- a/desktop/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.java +++ b/desktop/src/main/java/bisq/desktop/main/dao/wallet/send/BsqSendView.java @@ -44,6 +44,7 @@ import bisq.core.btc.wallet.WalletsManager; import bisq.core.dao.state.model.blockchain.TxType; import bisq.core.locale.Res; +import bisq.core.util.FormattingUtils; import bisq.core.util.coin.BsqFormatter; import bisq.core.util.coin.CoinFormatter; import bisq.core.util.coin.CoinUtil; @@ -59,6 +60,7 @@ import org.bitcoinj.core.Transaction; import javax.inject.Inject; +import javax.inject.Named; import javafx.scene.control.Button; import javafx.scene.layout.GridPane; @@ -105,7 +107,7 @@ private BsqSendView(BsqWalletService bsqWalletService, WalletsSetup walletsSetup, P2PService p2PService, BsqFormatter bsqFormatter, - CoinFormatter btcFormatter, + @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter btcFormatter, Navigation navigation, BsqBalanceUtil bsqBalanceUtil, BsqValidator bsqValidator, diff --git a/desktop/src/main/java/bisq/desktop/main/funds/deposit/DepositView.java b/desktop/src/main/java/bisq/desktop/main/funds/deposit/DepositView.java index 7b6a2181a83..5869d2c60b2 100644 --- a/desktop/src/main/java/bisq/desktop/main/funds/deposit/DepositView.java +++ b/desktop/src/main/java/bisq/desktop/main/funds/deposit/DepositView.java @@ -36,6 +36,7 @@ import bisq.core.locale.Res; import bisq.core.provider.fee.FeeService; import bisq.core.user.Preferences; +import bisq.core.util.FormattingUtils; import bisq.core.util.ParsingUtils; import bisq.core.util.coin.CoinFormatter; @@ -49,6 +50,7 @@ import net.glxn.qrgen.image.ImageType; import javax.inject.Inject; +import javax.inject.Named; import javafx.fxml.FXML; @@ -123,7 +125,7 @@ public class DepositView extends ActivatableView { private DepositView(BtcWalletService walletService, FeeService feeService, Preferences preferences, - CoinFormatter formatter) { + @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter) { this.walletService = walletService; this.preferences = preferences; this.formatter = formatter; diff --git a/desktop/src/main/java/bisq/desktop/main/funds/locked/LockedView.java b/desktop/src/main/java/bisq/desktop/main/funds/locked/LockedView.java index f4dd5e8df8d..dcdc8e4891d 100644 --- a/desktop/src/main/java/bisq/desktop/main/funds/locked/LockedView.java +++ b/desktop/src/main/java/bisq/desktop/main/funds/locked/LockedView.java @@ -37,12 +37,14 @@ import bisq.core.trade.Trade; import bisq.core.trade.TradeManager; import bisq.core.user.Preferences; +import bisq.core.util.FormattingUtils; import bisq.core.util.coin.CoinFormatter; import org.bitcoinj.core.Coin; import org.bitcoinj.core.Transaction; import javax.inject.Inject; +import javax.inject.Named; import de.jensd.fx.fontawesome.AwesomeIcon; @@ -96,7 +98,7 @@ public class LockedView extends ActivatableView { @Inject private LockedView(BtcWalletService btcWalletService, TradeManager tradeManager, OpenOfferManager openOfferManager, Preferences preferences, - CoinFormatter formatter, OfferDetailsWindow offerDetailsWindow, TradeDetailsWindow tradeDetailsWindow) { + @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter, OfferDetailsWindow offerDetailsWindow, TradeDetailsWindow tradeDetailsWindow) { this.btcWalletService = btcWalletService; this.tradeManager = tradeManager; this.openOfferManager = openOfferManager; diff --git a/desktop/src/main/java/bisq/desktop/main/funds/reserved/ReservedView.java b/desktop/src/main/java/bisq/desktop/main/funds/reserved/ReservedView.java index 0c0e4e5aa67..fc485d31ebf 100644 --- a/desktop/src/main/java/bisq/desktop/main/funds/reserved/ReservedView.java +++ b/desktop/src/main/java/bisq/desktop/main/funds/reserved/ReservedView.java @@ -37,12 +37,14 @@ import bisq.core.trade.Trade; import bisq.core.trade.TradeManager; import bisq.core.user.Preferences; +import bisq.core.util.FormattingUtils; import bisq.core.util.coin.CoinFormatter; import org.bitcoinj.core.Coin; import org.bitcoinj.core.Transaction; import javax.inject.Inject; +import javax.inject.Named; import de.jensd.fx.fontawesome.AwesomeIcon; @@ -96,7 +98,7 @@ public class ReservedView extends ActivatableView { @Inject private ReservedView(BtcWalletService btcWalletService, TradeManager tradeManager, OpenOfferManager openOfferManager, Preferences preferences, - CoinFormatter formatter, OfferDetailsWindow offerDetailsWindow, TradeDetailsWindow tradeDetailsWindow) { + @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter, OfferDetailsWindow offerDetailsWindow, TradeDetailsWindow tradeDetailsWindow) { this.btcWalletService = btcWalletService; this.tradeManager = tradeManager; this.openOfferManager = openOfferManager; diff --git a/desktop/src/main/java/bisq/desktop/main/funds/transactions/TransactionListItemFactory.java b/desktop/src/main/java/bisq/desktop/main/funds/transactions/TransactionListItemFactory.java index 2045a8bb52d..64294a045f8 100644 --- a/desktop/src/main/java/bisq/desktop/main/funds/transactions/TransactionListItemFactory.java +++ b/desktop/src/main/java/bisq/desktop/main/funds/transactions/TransactionListItemFactory.java @@ -21,6 +21,7 @@ import bisq.core.btc.wallet.BtcWalletService; import bisq.core.dao.DaoFacade; import bisq.core.user.Preferences; +import bisq.core.util.FormattingUtils; import bisq.core.util.coin.CoinFormatter; import bisq.common.crypto.PubKeyRing; @@ -28,6 +29,7 @@ import org.bitcoinj.core.Transaction; import javax.inject.Inject; +import javax.inject.Named; import javax.inject.Singleton; import javax.annotation.Nullable; @@ -47,7 +49,7 @@ public class TransactionListItemFactory { BsqWalletService bsqWalletService, DaoFacade daoFacade, PubKeyRing pubKeyRing, - CoinFormatter formatter, + @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter, Preferences preferences) { this.btcWalletService = btcWalletService; this.bsqWalletService = bsqWalletService; diff --git a/desktop/src/main/java/bisq/desktop/main/funds/withdrawal/WithdrawalView.java b/desktop/src/main/java/bisq/desktop/main/funds/withdrawal/WithdrawalView.java index 49d57bb571a..898301004b3 100644 --- a/desktop/src/main/java/bisq/desktop/main/funds/withdrawal/WithdrawalView.java +++ b/desktop/src/main/java/bisq/desktop/main/funds/withdrawal/WithdrawalView.java @@ -40,6 +40,7 @@ import bisq.core.trade.Trade; import bisq.core.trade.TradeManager; import bisq.core.user.Preferences; +import bisq.core.util.FormattingUtils; import bisq.core.util.coin.CoinFormatter; import bisq.core.util.coin.CoinUtil; import bisq.core.util.ParsingUtils; @@ -58,6 +59,7 @@ import org.bitcoinj.wallet.Wallet; import javax.inject.Inject; +import javax.inject.Named; import com.google.common.util.concurrent.FutureCallback; @@ -156,7 +158,7 @@ private WithdrawalView(BtcWalletService walletService, TradeManager tradeManager, P2PService p2PService, WalletsSetup walletsSetup, - CoinFormatter formatter, + @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter, Preferences preferences, BtcAddressValidator btcAddressValidator, WalletPasswordWindow walletPasswordWindow) { diff --git a/desktop/src/main/java/bisq/desktop/main/market/MarketView.java b/desktop/src/main/java/bisq/desktop/main/market/MarketView.java index 2c25a991bf1..8bfbe7f4f90 100644 --- a/desktop/src/main/java/bisq/desktop/main/market/MarketView.java +++ b/desktop/src/main/java/bisq/desktop/main/market/MarketView.java @@ -44,6 +44,7 @@ import bisq.common.util.Utilities; import javax.inject.Inject; +import javax.inject.Named; import com.google.common.base.Joiner; @@ -81,7 +82,7 @@ public class MarketView extends ActivatableView { @Inject - public MarketView(CachingViewLoader viewLoader, P2PService p2PService, OfferBook offerBook, CoinFormatter formatter, + public MarketView(CachingViewLoader viewLoader, P2PService p2PService, OfferBook offerBook, @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter, Navigation navigation) { this.viewLoader = viewLoader; this.p2PService = p2PService; diff --git a/desktop/src/main/java/bisq/desktop/main/market/offerbook/OfferBookChartView.java b/desktop/src/main/java/bisq/desktop/main/market/offerbook/OfferBookChartView.java index f36806bef96..a0b7f20d501 100644 --- a/desktop/src/main/java/bisq/desktop/main/market/offerbook/OfferBookChartView.java +++ b/desktop/src/main/java/bisq/desktop/main/market/offerbook/OfferBookChartView.java @@ -134,7 +134,7 @@ public class OfferBookChartView extends ActivatableViewAndModel { @Inject - public CreateOfferView(CreateOfferViewModel model, Navigation navigation, Preferences preferences, Transitions transitions, OfferDetailsWindow offerDetailsWindow, CoinFormatter btcFormatter, BsqFormatter bsqFormatter) { + public CreateOfferView(CreateOfferViewModel model, Navigation navigation, Preferences preferences, Transitions transitions, OfferDetailsWindow offerDetailsWindow, @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter btcFormatter, BsqFormatter bsqFormatter) { super(model, navigation, preferences, transitions, offerDetailsWindow, btcFormatter, bsqFormatter); } } diff --git a/desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModel.java b/desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModel.java index 3786263bf65..2543a002ef5 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/createoffer/CreateOfferViewModel.java @@ -30,11 +30,14 @@ import bisq.core.account.witness.AccountAgeWitnessService; import bisq.core.provider.price.PriceFeedService; import bisq.core.user.Preferences; +import bisq.core.util.FormattingUtils; import bisq.core.util.coin.BsqFormatter; import bisq.core.util.coin.CoinFormatter; import com.google.inject.Inject; +import javax.inject.Named; + class CreateOfferViewModel extends MutableOfferViewModel implements ViewModel { @Inject @@ -49,7 +52,7 @@ public CreateOfferViewModel(CreateOfferDataModel dataModel, AccountAgeWitnessService accountAgeWitnessService, Navigation navigation, Preferences preferences, - CoinFormatter btcFormatter, + @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter btcFormatter, BsqFormatter bsqFormatter) { super(dataModel, fiatVolumeValidator, diff --git a/desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookView.java b/desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookView.java index b710a50a389..7798f424477 100644 --- a/desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookView.java +++ b/desktop/src/main/java/bisq/desktop/main/offer/offerbook/OfferBookView.java @@ -56,6 +56,7 @@ import bisq.core.payment.PaymentAccount; import bisq.core.payment.payload.PaymentMethod; import bisq.core.user.DontShowAgainLookup; +import bisq.core.util.FormattingUtils; import bisq.core.util.coin.CoinFormatter; import bisq.network.p2p.NodeAddress; @@ -148,7 +149,7 @@ public class OfferBookView extends ActivatableViewAndModel { /////////////////////////////////////////////////////////////////////////////////////////// @Inject - public DisputeSummaryWindow(CoinFormatter formatter, + public DisputeSummaryWindow(@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter, MediationManager mediationManager, RefundManager refundManager, TradeWalletService tradeWalletService, diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/windows/EmptyWalletWindow.java b/desktop/src/main/java/bisq/desktop/main/overlays/windows/EmptyWalletWindow.java index 54477937614..0758de67e7d 100644 --- a/desktop/src/main/java/bisq/desktop/main/overlays/windows/EmptyWalletWindow.java +++ b/desktop/src/main/java/bisq/desktop/main/overlays/windows/EmptyWalletWindow.java @@ -31,6 +31,7 @@ import bisq.core.btc.wallet.WalletService; import bisq.core.locale.Res; import bisq.core.offer.OpenOfferManager; +import bisq.core.util.FormattingUtils; import bisq.core.util.coin.BsqFormatter; import bisq.core.util.coin.CoinFormatter; @@ -43,6 +44,7 @@ import org.bitcoinj.core.InsufficientMoneyException; import javax.inject.Inject; +import javax.inject.Named; import javafx.scene.Scene; import javafx.scene.control.Button; @@ -92,7 +94,7 @@ public EmptyWalletWindow(WalletPasswordWindow walletPasswordWindow, WalletsSetup walletsSetup, BtcWalletService btcWalletService, BsqWalletService bsqWalletService, - CoinFormatter btcFormatter, + @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter btcFormatter, BsqFormatter bsqFormatter) { this.walletPasswordWindow = walletPasswordWindow; this.openOfferManager = openOfferManager; diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/windows/OfferDetailsWindow.java b/desktop/src/main/java/bisq/desktop/main/overlays/windows/OfferDetailsWindow.java index a2b0d768a4b..e07b9515b9e 100644 --- a/desktop/src/main/java/bisq/desktop/main/overlays/windows/OfferDetailsWindow.java +++ b/desktop/src/main/java/bisq/desktop/main/overlays/windows/OfferDetailsWindow.java @@ -44,6 +44,7 @@ import org.bitcoinj.core.Coin; import javax.inject.Inject; +import javax.inject.Named; import com.google.common.base.Joiner; @@ -86,7 +87,7 @@ public class OfferDetailsWindow extends Overlay { /////////////////////////////////////////////////////////////////////////////////////////// @Inject - public OfferDetailsWindow(CoinFormatter formatter, User user, KeyRing keyRing, + public OfferDetailsWindow(@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter, User user, KeyRing keyRing, Navigation navigation) { this.formatter = formatter; this.user = user; diff --git a/desktop/src/main/java/bisq/desktop/main/overlays/windows/TradeDetailsWindow.java b/desktop/src/main/java/bisq/desktop/main/overlays/windows/TradeDetailsWindow.java index fe6ebfd0c1e..0bf49ec660a 100644 --- a/desktop/src/main/java/bisq/desktop/main/overlays/windows/TradeDetailsWindow.java +++ b/desktop/src/main/java/bisq/desktop/main/overlays/windows/TradeDetailsWindow.java @@ -43,6 +43,7 @@ import org.bitcoinj.core.Utils; import javax.inject.Inject; +import javax.inject.Named; import javafx.stage.Modality; import javafx.stage.Stage; @@ -86,7 +87,7 @@ public class TradeDetailsWindow extends Overlay { /////////////////////////////////////////////////////////////////////////////////////////// @Inject - public TradeDetailsWindow(CoinFormatter formatter, + public TradeDetailsWindow(@Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter, ArbitrationManager arbitrationManager, TradeManager tradeManager, AccountAgeWitnessService accountAgeWitnessService) { diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/closedtrades/ClosedTradesView.java b/desktop/src/main/java/bisq/desktop/main/portfolio/closedtrades/ClosedTradesView.java index e8b1ddbf64f..1a316f85b3c 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/closedtrades/ClosedTradesView.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/closedtrades/ClosedTradesView.java @@ -38,6 +38,7 @@ import bisq.core.trade.Tradable; import bisq.core.trade.Trade; import bisq.core.user.Preferences; +import bisq.core.util.FormattingUtils; import bisq.core.util.coin.CoinFormatter; import bisq.network.p2p.NodeAddress; @@ -111,7 +112,7 @@ public ClosedTradesView(ClosedTradesViewModel model, Preferences preferences, TradeDetailsWindow tradeDetailsWindow, PrivateNotificationManager privateNotificationManager, - CoinFormatter formatter, + @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter formatter, @Named(AppOptionKeys.USE_DEV_PRIVILEGE_KEYS) boolean useDevPrivilegeKeys) { super(model); this.offerDetailsWindow = offerDetailsWindow; diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/closedtrades/ClosedTradesViewModel.java b/desktop/src/main/java/bisq/desktop/main/portfolio/closedtrades/ClosedTradesViewModel.java index d3d4170a21f..26ae7a903d7 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/closedtrades/ClosedTradesViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/closedtrades/ClosedTradesViewModel.java @@ -32,6 +32,8 @@ import com.google.inject.Inject; +import javax.inject.Named; + import javafx.collections.ObservableList; import java.util.stream.Collectors; @@ -43,7 +45,7 @@ class ClosedTradesViewModel extends ActivatableWithDataModel { /////////////////////////////////////////////////////////////////////////////////////////// @Inject - private EditOfferView(EditOfferViewModel model, Navigation navigation, Preferences preferences, Transitions transitions, OfferDetailsWindow offerDetailsWindow, CoinFormatter btcFormatter, BsqFormatter bsqFormatter) { + private EditOfferView(EditOfferViewModel model, Navigation navigation, Preferences preferences, Transitions transitions, OfferDetailsWindow offerDetailsWindow, @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter btcFormatter, BsqFormatter bsqFormatter) { super(model, navigation, preferences, transitions, offerDetailsWindow, btcFormatter, bsqFormatter); } diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferViewModel.java b/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferViewModel.java index 3d262b5d5eb..0960653ec40 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/editoffer/EditOfferViewModel.java @@ -39,6 +39,8 @@ import com.google.inject.Inject; +import javax.inject.Named; + class EditOfferViewModel extends MutableOfferViewModel { @Inject @@ -53,7 +55,7 @@ public EditOfferViewModel(EditOfferDataModel dataModel, AccountAgeWitnessService accountAgeWitnessService, Navigation navigation, Preferences preferences, - CoinFormatter btcFormatter, + @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter btcFormatter, BsqFormatter bsqFormatter) { super(dataModel, fiatVolumeValidator, diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/failedtrades/FailedTradesViewModel.java b/desktop/src/main/java/bisq/desktop/main/portfolio/failedtrades/FailedTradesViewModel.java index 2f4863020ae..cf24bb02e8c 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/failedtrades/FailedTradesViewModel.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/failedtrades/FailedTradesViewModel.java @@ -28,6 +28,8 @@ import com.google.inject.Inject; +import javax.inject.Named; + import javafx.collections.ObservableList; class FailedTradesViewModel extends ActivatableWithDataModel implements ViewModel { @@ -35,7 +37,7 @@ class FailedTradesViewModel extends ActivatableWithDataModel implements ViewModel { @@ -49,7 +51,7 @@ class OpenOffersViewModel extends ActivatableWithDataModel @Inject public OpenOffersViewModel(OpenOffersDataModel dataModel, P2PService p2PService, - CoinFormatter btcFormatter, + @Named(FormattingUtils.BTC_FORMATTER_KEY) CoinFormatter btcFormatter, BsqFormatter bsqFormatter) { super(dataModel); diff --git a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesView.java b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesView.java index b5bb960f668..8ace9377d5b 100644 --- a/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesView.java +++ b/desktop/src/main/java/bisq/desktop/main/portfolio/pendingtrades/PendingTradesView.java @@ -139,7 +139,7 @@ public class PendingTradesView extends ActivatableViewAndModel