remove unused messages and fields from protobuf models

rename BitcoinModule to MoneroModule
change to HavenoUtils.formatXmr(...)
remove "_as_long" postfix from models
This commit is contained in:
woodser 2023-03-07 13:14:27 -05:00
parent 1a1fb130c0
commit e71f9a54ac
103 changed files with 556 additions and 1681 deletions

View file

@ -56,7 +56,7 @@ public class AccountStatusTooltipLabel extends AutoTooltipLabel {
this.textIcon = FormBuilder.getIcon(witnessAgeData.getIcon());
this.popupTitle = witnessAgeData.isLimitLifted()
? Res.get("offerbook.timeSinceSigning.tooltip.accountLimitLifted")
: Res.get("offerbook.timeSinceSigning.tooltip.accountLimit", HavenoUtils.formatToXmrWithCode(OfferRestrictions.TOLERATED_SMALL_TRADE_AMOUNT));
: Res.get("offerbook.timeSinceSigning.tooltip.accountLimit", HavenoUtils.formatXmr(OfferRestrictions.TOLERATED_SMALL_TRADE_AMOUNT, true));
positionAndActivateIcon();
}

View file

@ -82,7 +82,7 @@ public class BalanceTextField extends AnchorPane {
private void updateBalance(BigInteger balance) {
if (formatter != null)
textField.setText(HavenoUtils.formatToXmrWithCode(balance));
textField.setText(HavenoUtils.formatXmr(balance, true));
//TODO: replace with new validation logic
// if (targetAmount != null) {

View file

@ -285,17 +285,17 @@ public class FiatAccountsView extends PaymentAccountsView<GridPane, FiatAccounts
} else {
String limitsInfoKey = "payment.limits.info";
String initialLimit = HavenoUtils.formatToXmrWithCode(maxTradeLimitFirstMonth);
String initialLimit = HavenoUtils.formatXmr(maxTradeLimitFirstMonth, true);
if (PaymentMethod.hasChargebackRisk(paymentAccount.getPaymentMethod(), paymentAccount.getTradeCurrencies())) {
limitsInfoKey = "payment.limits.info.withSigning";
initialLimit = HavenoUtils.formatToXmrWithCode(OfferRestrictions.TOLERATED_SMALL_TRADE_AMOUNT);
initialLimit = HavenoUtils.formatXmr(OfferRestrictions.TOLERATED_SMALL_TRADE_AMOUNT, true);
}
new Popup().information(Res.get(limitsInfoKey,
initialLimit,
HavenoUtils.formatToXmrWithCode(maxTradeLimitSecondMonth),
HavenoUtils.formatToXmrWithCode(maxTradeLimit)))
HavenoUtils.formatXmr(maxTradeLimitSecondMonth, true),
HavenoUtils.formatXmr(maxTradeLimit, true)))
.width(700)
.closeButtonText(Res.get("shared.cancel"))
.actionButtonText(Res.get("shared.iUnderstand"))

View file

@ -66,14 +66,14 @@ class DepositListItem {
@Override
public void onBalanceChanged(BigInteger balance) {
DepositListItem.this.balanceAsBI = balance;
DepositListItem.this.balance.set(HavenoUtils.formatToXmr(balanceAsBI));
DepositListItem.this.balance.set(HavenoUtils.formatXmr(balanceAsBI));
updateUsage(addressEntry.getSubaddressIndex(), null);
}
};
xmrWalletService.addBalanceListener(balanceListener);
balanceAsBI = xmrWalletService.getBalanceForSubaddress(addressEntry.getSubaddressIndex());
balance.set(HavenoUtils.formatToXmr(balanceAsBI));
balance.set(HavenoUtils.formatXmr(balanceAsBI));
updateUsage(addressEntry.getSubaddressIndex(), cachedTxs);

View file

@ -204,7 +204,7 @@ class TransactionsListItem {
}
public String getAmountStr() {
return HavenoUtils.formatToXmr(amount);
return HavenoUtils.formatXmr(amount);
}
public BigInteger getAmount() {

View file

@ -70,7 +70,7 @@ class WithdrawalListItem {
private void updateBalance() {
balance = walletService.getBalanceForSubaddress(addressEntry.getSubaddressIndex());
if (balance != null)
balanceLabel.setText(HavenoUtils.formatToXmr(this.balance));
balanceLabel.setText(HavenoUtils.formatXmr(this.balance));
}
public final String getLabel() {

View file

@ -134,7 +134,7 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
amountFocusListener = (observable, oldValue, newValue) -> {
if (oldValue && !newValue) {
if (amount.compareTo(BigInteger.valueOf(0)) > 0)
amountTextField.setText(HavenoUtils.formatToXmr(amount));
amountTextField.setText(HavenoUtils.formatXmr(amount));
else
amountTextField.setText("");
}
@ -186,10 +186,10 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
BigInteger sendersAmount = receiverAmount;
BigInteger fee = tx.getFee();
String messageText = Res.get("shared.sendFundsDetailsWithFee",
HavenoUtils.formatToXmrWithCode(sendersAmount),
HavenoUtils.formatXmr(sendersAmount, true),
withdrawToAddress,
HavenoUtils.formatToXmrWithCode(fee),
HavenoUtils.formatToXmrWithCode(receiverAmount));
HavenoUtils.formatXmr(fee, true),
HavenoUtils.formatXmr(receiverAmount, true));
// popup confirmation message
new Popup().headLine(Res.get("funds.withdrawal.confirmWithdrawalRequest"))
@ -203,7 +203,7 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
xmrWalletService.getWallet().setTxNote(tx.getHash(), withdrawMemoTextField.getText()); // TODO (monero-java): tx note does not persist when tx created then relayed
String key = "showTransactionSent";
if (DontShowAgainLookup.showAgain(key)) {
new TxDetails(tx.getHash(), withdrawToAddress, HavenoUtils.formatToXmrWithCode(sendersAmount), HavenoUtils.formatToXmrWithCode(fee), xmrWalletService.getWallet().getTxNote(tx.getHash()))
new TxDetails(tx.getHash(), withdrawToAddress, HavenoUtils.formatXmr(sendersAmount, true), HavenoUtils.formatXmr(fee, true), xmrWalletService.getWallet().getTxNote(tx.getHash()))
.dontShowAgainId(key)
.show();
}

View file

@ -129,7 +129,7 @@ public class SpreadView extends ActivatableViewAndModel<GridPane, SpreadViewMode
BigInteger totalAmount = BigInteger.valueOf(0);
for (SpreadItem item : sortedList) totalAmount = totalAmount.add(item.totalAmount);
String total = HavenoUtils.formatToXmr(totalAmount);
String total = HavenoUtils.formatXmr(totalAmount);
UserThread.execute(() -> {
numberOfOffersColumn.setGraphic(new AutoTooltipLabel(Res.get("market.spread.numberOfOffersColumn", numberOfOffers)));

View file

@ -54,9 +54,9 @@ public class VolumeBar extends Group {
public void update(double height, double candleWidth, CandleData candleData) {
bar.resizeRelocate(-candleWidth / 2, 0, candleWidth, height);
String volumeInBtc = volumeStringConverter.toString(candleData.accumulatedAmount);
String volumeInXmr = volumeStringConverter.toString(candleData.accumulatedAmount);
String volumeInUsd = VolumeUtil.formatLargeFiat(candleData.volumeInUsd, "USD");
tooltip.setText(Res.get("market.trades.tooltip.volumeBar", volumeInBtc, volumeInUsd, candleData.numTrades, candleData.date));
tooltip.setText(Res.get("market.trades.tooltip.volumeBar", volumeInXmr, volumeInUsd, candleData.numTrades, candleData.date));
}
private void updateStyleClasses() {

View file

@ -17,7 +17,6 @@
package haveno.desktop.main.offer;
import org.bitcoinj.core.Coin;
import org.jetbrains.annotations.NotNull;
import com.google.inject.Inject;
import haveno.common.handlers.ErrorMessageHandler;
@ -290,7 +289,6 @@ public abstract class MutableOfferDataModel extends OfferDataModel {
amount.get(),
minAmount.get(),
useMarketBasedPrice.get() ? null : price.get(),
Coin.ZERO,
useMarketBasedPrice.get(),
marketPriceMargin,
buyerSecurityDepositPct.get(),

View file

@ -136,7 +136,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
private FundsTextField totalToPayTextField;
private Label amountDescriptionLabel, priceCurrencyLabel, priceDescriptionLabel, volumeDescriptionLabel,
waitingForFundsLabel, marketBasedPriceLabel, percentagePriceDescriptionLabel, tradeFeeDescriptionLabel,
resultLabel, tradeFeeInBtcLabel, xLabel, fakeXLabel, buyerSecurityDepositLabel,
resultLabel, tradeFeeInXmrLabel, xLabel, fakeXLabel, buyerSecurityDepositLabel,
buyerSecurityDepositPercentageLabel, triggerPriceCurrencyLabel, triggerPriceDescriptionLabel;
protected Label amountBtcLabel, volumeCurrencyLabel, minAmountBtcLabel;
private ComboBox<PaymentAccount> paymentAccountsComboBox;
@ -548,7 +548,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
addressTextField.amountAsProperty().bind(model.getDataModel().getMissingCoin());
buyerSecurityDepositInputTextField.textProperty().bindBidirectional(model.buyerSecurityDeposit);
buyerSecurityDepositLabel.textProperty().bind(model.buyerSecurityDepositLabel);
tradeFeeInBtcLabel.textProperty().bind(model.tradeFeeInBtcWithFiat);
tradeFeeInXmrLabel.textProperty().bind(model.tradeFeeInXmrWithFiat);
tradeFeeDescriptionLabel.textProperty().bind(model.tradeFeeDescription);
// Validation
@ -596,9 +596,9 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
addressTextField.amountAsProperty().unbind();
buyerSecurityDepositInputTextField.textProperty().unbindBidirectional(model.buyerSecurityDeposit);
buyerSecurityDepositLabel.textProperty().unbind();
tradeFeeInBtcLabel.textProperty().unbind();
tradeFeeInXmrLabel.textProperty().unbind();
tradeFeeDescriptionLabel.textProperty().unbind();
tradeFeeInBtcLabel.visibleProperty().unbind();
tradeFeeInXmrLabel.visibleProperty().unbind();
tradeFeeDescriptionLabel.visibleProperty().unbind();
// Validation
@ -731,7 +731,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
if (newValue) {
Notification walletFundedNotification = new Notification()
.headLine(Res.get("notification.walletUpdate.headline"))
.notification(Res.get("notification.walletUpdate.msg", HavenoUtils.formatToXmrWithCode(model.getDataModel().getTotalToPay().get())))
.notification(Res.get("notification.walletUpdate.msg", HavenoUtils.formatXmr(model.getDataModel().getTotalToPay().get(), true)))
.autoClose();
walletFundedNotification.show();
@ -1347,14 +1347,14 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
}
private VBox getTradeFeeFieldsBox() {
tradeFeeInBtcLabel = new Label();
tradeFeeInBtcLabel.setMouseTransparent(true);
tradeFeeInBtcLabel.setId("trade-fee-textfield");
tradeFeeInXmrLabel = new Label();
tradeFeeInXmrLabel.setMouseTransparent(true);
tradeFeeInXmrLabel.setId("trade-fee-textfield");
VBox vBox = new VBox();
vBox.setSpacing(6);
vBox.setMaxWidth(300);
vBox.setAlignment(Pos.CENTER_LEFT);
vBox.getChildren().addAll(tradeFeeInBtcLabel);
vBox.getChildren().addAll(tradeFeeInXmrLabel);
HBox hBox = new HBox();
hBox.getChildren().addAll(vBox);

View file

@ -121,7 +121,7 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
public final StringProperty price = new SimpleStringProperty();
public final StringProperty triggerPrice = new SimpleStringProperty("");
final StringProperty tradeFee = new SimpleStringProperty();
final StringProperty tradeFeeInBtcWithFiat = new SimpleStringProperty();
final StringProperty tradeFeeInXmrWithFiat = new SimpleStringProperty();
final StringProperty tradeFeeCurrencyCode = new SimpleStringProperty();
final StringProperty tradeFeeDescription = new SimpleStringProperty();
final BooleanProperty isTradeFeeVisible = new SimpleBooleanProperty(false);
@ -271,10 +271,10 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
() -> Res.get("createOffer.volume.prompt", dataModel.getTradeCurrencyCode().get()),
dataModel.getTradeCurrencyCode()));
totalToPay.bind(createStringBinding(() -> HavenoUtils.formatToXmrWithCode(dataModel.totalToPayAsProperty().get()),
totalToPay.bind(createStringBinding(() -> HavenoUtils.formatXmr(dataModel.totalToPayAsProperty().get(), true),
dataModel.totalToPayAsProperty()));
tradeAmount.bind(createStringBinding(() -> HavenoUtils.formatToXmrWithCode(dataModel.getAmount().get()),
tradeAmount.bind(createStringBinding(() -> HavenoUtils.formatXmr(dataModel.getAmount().get(), true),
dataModel.getAmount()));
tradeCurrencyCode.bind(dataModel.getTradeCurrencyCode());
@ -433,8 +433,8 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
amountListener = (ov, oldValue, newValue) -> {
if (newValue != null) {
amount.set(HavenoUtils.formatToXmr(newValue));
buyerSecurityDepositInBTC.set(HavenoUtils.formatToXmrWithCode(dataModel.getBuyerSecurityDeposit()));
amount.set(HavenoUtils.formatXmr(newValue));
buyerSecurityDepositInBTC.set(HavenoUtils.formatXmr(dataModel.getBuyerSecurityDeposit(), true));
} else {
amount.set("");
buyerSecurityDepositInBTC.set("");
@ -444,7 +444,7 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
};
minAmountListener = (ov, oldValue, newValue) -> {
if (newValue != null)
minAmount.set(HavenoUtils.formatToXmr(newValue));
minAmount.set(HavenoUtils.formatXmr(newValue));
else
minAmount.set("");
};
@ -473,7 +473,7 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
if (newValue != null) {
buyerSecurityDeposit.set(FormattingUtils.formatToPercent((double) newValue));
if (dataModel.getAmount().get() != null) {
buyerSecurityDepositInBTC.set(HavenoUtils.formatToXmrWithCode(dataModel.getBuyerSecurityDeposit()));
buyerSecurityDepositInBTC.set(HavenoUtils.formatXmr(dataModel.getBuyerSecurityDeposit(), true));
}
updateBuyerSecurityDeposit();
} else {
@ -504,8 +504,8 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
}
isTradeFeeVisible.setValue(true);
tradeFee.set(HavenoUtils.formatToXmr(makerFee));
tradeFeeInBtcWithFiat.set(OfferViewModelUtil.getTradeFeeWithFiatEquivalent(offerUtil,
tradeFee.set(HavenoUtils.formatXmr(makerFee));
tradeFeeInXmrWithFiat.set(OfferViewModelUtil.getTradeFeeWithFiatEquivalent(offerUtil,
dataModel.getMakerFee(),
btcFormatter));
}
@ -659,8 +659,8 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
updateButtonDisableState();
} else {
new Popup().warning(Res.get("shared.notEnoughFunds",
HavenoUtils.formatToXmrWithCode(dataModel.totalToPayAsProperty().get()),
HavenoUtils.formatToXmrWithCode(dataModel.getTotalBalance())))
HavenoUtils.formatXmr(dataModel.totalToPayAsProperty().get(), true),
HavenoUtils.formatXmr(dataModel.getTotalBalance(), true)))
.actionButtonTextWithGoTo("navigation.funds.depositFunds")
.onAction(() -> navigation.navigateTo(MainView.class, FundsView.class, DepositView.class))
.show();
@ -680,7 +680,7 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
if (result.isValid) {
setAmountToModel();
ignoreAmountStringListener = true;
amount.set(HavenoUtils.formatToXmr(dataModel.getAmount().get()));
amount.set(HavenoUtils.formatXmr(dataModel.getAmount().get()));
ignoreAmountStringListener = false;
dataModel.calculateVolume();
@ -692,10 +692,10 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
if (minAmount.get() != null)
minAmountValidationResult.set(isXmrInputValid(minAmount.get()));
} else if (amount.get() != null && xmrValidator.getMaxTradeLimit() != null && xmrValidator.getMaxTradeLimit().longValueExact() == OfferRestrictions.TOLERATED_SMALL_TRADE_AMOUNT.longValueExact()) {
amount.set(HavenoUtils.formatToXmr(xmrValidator.getMaxTradeLimit()));
amount.set(HavenoUtils.formatXmr(xmrValidator.getMaxTradeLimit()));
boolean isBuy = dataModel.getDirection() == OfferDirection.BUY;
new Popup().information(Res.get(isBuy ? "popup.warning.tradeLimitDueAccountAgeRestriction.buyer" : "popup.warning.tradeLimitDueAccountAgeRestriction.seller",
HavenoUtils.formatToXmrWithCode(OfferRestrictions.TOLERATED_SMALL_TRADE_AMOUNT),
HavenoUtils.formatXmr(OfferRestrictions.TOLERATED_SMALL_TRADE_AMOUNT, true),
Res.get("offerbook.warning.newVersionAnnouncement")))
.width(900)
.show();
@ -732,7 +732,7 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
updateButtonDisableState();
}
this.minAmount.set(HavenoUtils.formatToXmr(minAmount));
this.minAmount.set(HavenoUtils.formatXmr(minAmount));
if (!dataModel.isMinAmountLessOrEqualAmount()) {
this.amount.set(this.minAmount.get());
@ -990,7 +990,7 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
}
public String getSecurityDepositWithCode() {
return HavenoUtils.formatToXmrWithCode(dataModel.getSecurityDeposit());
return HavenoUtils.formatXmr(dataModel.getSecurityDeposit(), true);
}
@ -1219,7 +1219,7 @@ public abstract class MutableOfferViewModel<M extends MutableOfferDataModel> ext
if (dataModel.isMinBuyerSecurityDeposit()) {
buyerSecurityDepositLabel.set(Res.get("createOffer.minSecurityDepositUsed"));
buyerSecurityDeposit.set(HavenoUtils.formatToXmr(Restrictions.getMinBuyerSecurityDeposit()));
buyerSecurityDeposit.set(HavenoUtils.formatXmr(Restrictions.getMinBuyerSecurityDeposit()));
} else {
buyerSecurityDepositLabel.set(getSecurityDepositLabel());
buyerSecurityDeposit.set(FormattingUtils.formatToPercent(dataModel.getBuyerSecurityDepositPct().get()));

View file

@ -45,7 +45,7 @@ public class OfferViewModelUtil {
BigInteger tradeAmount,
CoinFormatter formatter,
BigInteger minTradeFee) {
String feeAsBtc = HavenoUtils.formatToXmrWithCode(tradeFee);
String feeAsBtc = HavenoUtils.formatXmr(tradeFee, true);
String percentage;
if (tradeFee.compareTo(minTradeFee) <= 0) {
percentage = Res.get("guiUtil.requiredMinimum")

View file

@ -1185,7 +1185,7 @@ abstract public class OfferBookView<R extends GridPane, M extends OfferBookViewM
Res.get("offerbook.timeSinceSigning"),
Res.get("offerbook.timeSinceSigning.help",
SignedWitnessService.SIGNER_AGE_DAYS,
HavenoUtils.formatToXmrWithCode(OfferRestrictions.TOLERATED_SMALL_TRADE_AMOUNT))) {
HavenoUtils.formatXmr(OfferRestrictions.TOLERATED_SMALL_TRADE_AMOUNT, true))) {
{
setMinWidth(60);
setSortable(true);

View file

@ -622,7 +622,7 @@ abstract class OfferBookViewModel extends ActivatableViewModel {
}
public String getMakerFeeAsString(Offer offer) {
return HavenoUtils.formatToXmrWithCode(offer.getMakerFee());
return HavenoUtils.formatXmr(offer.getMakerFee(), true);
}
private static String getDirectionWithCodeDetailed(OfferDirection direction, String currencyCode) {
@ -634,7 +634,7 @@ abstract class OfferBookViewModel extends ActivatableViewModel {
public String formatDepositString(BigInteger deposit, long amount) {
var percentage = FormattingUtils.formatToRoundedPercentWithSymbol(BigDecimal.valueOf(deposit.longValueExact()).divide(BigDecimal.valueOf(amount)).doubleValue());
return HavenoUtils.formatToXmr(deposit) + " (" + percentage + ")";
return HavenoUtils.formatXmr(deposit) + " (" + percentage + ")";
}
PaymentMethod getShowAllEntryForPaymentMethod() {

View file

@ -134,7 +134,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
priceCurrencyLabel, priceAsPercentageLabel,
volumeCurrencyLabel, priceDescriptionLabel, volumeDescriptionLabel,
waitingForFundsLabel, offerAvailabilityLabel, priceAsPercentageDescription,
tradeFeeDescriptionLabel, resultLabel, tradeFeeInBtcLabel, xLabel,
tradeFeeDescriptionLabel, resultLabel, tradeFeeInXmrLabel, xLabel,
fakeXLabel;
private InputTextField amountTextField;
private TextField paymentMethodTextField, currencyTextField, priceTextField, priceAsPercentageTextField,
@ -204,7 +204,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
if (newValue) {
Notification walletFundedNotification = new Notification()
.headLine(Res.get("notification.walletUpdate.headline"))
.notification(Res.get("notification.walletUpdate.msg", HavenoUtils.formatToXmrWithCode(model.dataModel.getTotalToPay().get())))
.notification(Res.get("notification.walletUpdate.msg", HavenoUtils.formatXmr(model.dataModel.getTotalToPay().get(), true)))
.autoClose();
walletFundedNotification.show();
@ -477,7 +477,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
if (walletFundedNotification == null) {
walletFundedNotification = new Notification()
.headLine(Res.get("notification.walletUpdate.headline"))
.notification(Res.get("notification.takeOffer.walletUpdate.msg", HavenoUtils.formatToXmrWithCode(model.dataModel.getTotalToPay().get())))
.notification(Res.get("notification.takeOffer.walletUpdate.msg", HavenoUtils.formatXmr(model.dataModel.getTotalToPay().get(), true)))
.autoClose();
walletFundedNotification.show();
}
@ -543,9 +543,9 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
priceCurrencyLabel.textProperty().bind(createStringBinding(() -> CurrencyUtil.getCounterCurrency(model.dataModel.getCurrencyCode())));
priceAsPercentageLabel.prefWidthProperty().bind(priceCurrencyLabel.widthProperty());
nextButton.disableProperty().bind(model.isNextButtonDisabled);
tradeFeeInBtcLabel.textProperty().bind(model.tradeFeeInXmrWithFiat);
tradeFeeInXmrLabel.textProperty().bind(model.tradeFeeInXmrWithFiat);
tradeFeeDescriptionLabel.textProperty().bind(model.tradeFeeDescription);
tradeFeeInBtcLabel.visibleProperty().bind(model.isTradeFeeVisible);
tradeFeeInXmrLabel.visibleProperty().bind(model.isTradeFeeVisible);
tradeFeeDescriptionLabel.visibleProperty().bind(model.isTradeFeeVisible);
tradeFeeDescriptionLabel.managedProperty().bind(tradeFeeDescriptionLabel.visibleProperty());
@ -567,9 +567,9 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
priceCurrencyLabel.textProperty().unbind();
priceAsPercentageLabel.prefWidthProperty().unbind();
nextButton.disableProperty().unbind();
tradeFeeInBtcLabel.textProperty().unbind();
tradeFeeInXmrLabel.textProperty().unbind();
tradeFeeDescriptionLabel.textProperty().unbind();
tradeFeeInBtcLabel.visibleProperty().unbind();
tradeFeeInXmrLabel.visibleProperty().unbind();
tradeFeeDescriptionLabel.visibleProperty().unbind();
tradeFeeDescriptionLabel.managedProperty().unbind();
@ -1057,15 +1057,15 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
}
private VBox getTradeFeeFieldsBox() {
tradeFeeInBtcLabel = new Label();
tradeFeeInBtcLabel.setMouseTransparent(true);
tradeFeeInBtcLabel.setId("trade-fee-textfield");
tradeFeeInXmrLabel = new Label();
tradeFeeInXmrLabel.setMouseTransparent(true);
tradeFeeInXmrLabel.setId("trade-fee-textfield");
VBox vBox = new VBox();
vBox.setSpacing(6);
vBox.setMaxWidth(300);
vBox.setAlignment(Pos.CENTER_LEFT);
vBox.getChildren().addAll(tradeFeeInBtcLabel);
vBox.getChildren().addAll(tradeFeeInXmrLabel);
HBox hBox = new HBox();
hBox.getChildren().addAll(vBox);

View file

@ -166,7 +166,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
volumeDescriptionLabel.set(Res.get(sellVolumeDescriptionKey, dataModel.getCurrencyCode()));
}
amount.set(HavenoUtils.formatToXmr(dataModel.getAmount().get()));
amount.set(HavenoUtils.formatXmr(dataModel.getAmount().get()));
showTransactionPublishedScreen.set(false);
// when getting back to an open screen we want to re-check again
@ -207,7 +207,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
? Res.get(buyAmountDescriptionKey)
: Res.get(sellAmountDescriptionKey);
amountRange = HavenoUtils.formatToXmr(offer.getMinAmount()) + " - " + HavenoUtils.formatToXmr(offer.getAmount());
amountRange = HavenoUtils.formatXmr(offer.getMinAmount()) + " - " + HavenoUtils.formatXmr(offer.getAmount());
price = FormattingUtils.formatPrice(dataModel.tradePrice);
marketPriceMargin = FormattingUtils.formatToPercent(offer.getMarketPriceMarginPct());
paymentLabel = Res.get("takeOffer.fundsBox.paymentLabel", offer.getShortId());
@ -263,8 +263,8 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
return true;
} else {
new Popup().warning(Res.get("shared.notEnoughFunds",
HavenoUtils.formatToXmrWithCode(dataModel.getTotalToPay().get()),
HavenoUtils.formatToXmrWithCode(dataModel.getTotalAvailableBalance())))
HavenoUtils.formatXmr(dataModel.getTotalToPay().get(), true),
HavenoUtils.formatXmr(dataModel.getTotalAvailableBalance(), true)))
.actionButtonTextWithGoTo("navigation.funds.depositFunds")
.onAction(() -> navigation.navigateTo(MainView.class, FundsView.class, DepositView.class))
.show();
@ -280,7 +280,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
}
isTradeFeeVisible.setValue(true);
tradeFee.set(HavenoUtils.formatToXmr(takerFee));
tradeFee.set(HavenoUtils.formatXmr(takerFee));
tradeFeeInXmrWithFiat.set(OfferViewModelUtil.getTradeFeeWithFiatEquivalent(offerUtil,
dataModel.getTakerFee(),
xmrFormatter));
@ -301,7 +301,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
// only allow max 4 decimal places for btc values
setAmountToModel();
// reformat input
amount.set(HavenoUtils.formatToXmr(dataModel.getAmount().get()));
amount.set(HavenoUtils.formatXmr(dataModel.getAmount().get()));
calculateVolume();
@ -312,7 +312,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
tradePrice,
maxTradeLimit);
dataModel.applyAmount(adjustedAmountForHalCash);
amount.set(HavenoUtils.formatToXmr(dataModel.getAmount().get()));
amount.set(HavenoUtils.formatXmr(dataModel.getAmount().get()));
} else if (dataModel.getOffer().isFiatOffer()) {
if (!isAmountEqualMinAmount(dataModel.getAmount().get()) && (!isAmountEqualMaxAmount(dataModel.getAmount().get()))) {
// We only apply the rounding if the amount is variable (minAmount is lower as amount).
@ -321,7 +321,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
maxTradeLimit);
dataModel.applyAmount(roundedAmount);
}
amount.set(HavenoUtils.formatToXmr(dataModel.getAmount().get()));
amount.set(HavenoUtils.formatXmr(dataModel.getAmount().get()));
}
if (!dataModel.isMinAmountLessOrEqualAmount())
@ -338,13 +338,13 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
} else if (btcValidator.getMaxTradeLimit() != null && btcValidator.getMaxTradeLimit().equals(OfferRestrictions.TOLERATED_SMALL_TRADE_AMOUNT)) {
if (dataModel.getDirection() == OfferDirection.BUY) {
new Popup().information(Res.get("popup.warning.tradeLimitDueAccountAgeRestriction.seller",
HavenoUtils.formatToXmrWithCode(OfferRestrictions.TOLERATED_SMALL_TRADE_AMOUNT),
HavenoUtils.formatXmr(OfferRestrictions.TOLERATED_SMALL_TRADE_AMOUNT, true),
Res.get("offerbook.warning.newVersionAnnouncement")))
.width(900)
.show();
} else {
new Popup().information(Res.get("popup.warning.tradeLimitDueAccountAgeRestriction.buyer",
HavenoUtils.formatToXmrWithCode(OfferRestrictions.TOLERATED_SMALL_TRADE_AMOUNT),
HavenoUtils.formatXmr(OfferRestrictions.TOLERATED_SMALL_TRADE_AMOUNT, true),
Res.get("offerbook.warning.newVersionAnnouncement")))
.width(900)
.show();
@ -466,7 +466,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
private void addBindings() {
volume.bind(createStringBinding(() -> VolumeUtil.formatVolume(dataModel.volume.get()), dataModel.volume));
totalToPay.bind(createStringBinding(() -> HavenoUtils.formatToXmrWithCode(dataModel.getTotalToPay().get()), dataModel.getTotalToPay()));
totalToPay.bind(createStringBinding(() -> HavenoUtils.formatXmr(dataModel.getTotalToPay().get(), true), dataModel.getTotalToPay()));
}
@ -487,7 +487,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
updateButtonDisableState();
};
amountListener = (ov, oldValue, newValue) -> {
amount.set(HavenoUtils.formatToXmr(newValue));
amount.set(HavenoUtils.formatXmr(newValue));
applyTakerFee();
};
isWalletFundedListener = (ov, oldValue, newValue) -> updateButtonDisableState();
@ -682,7 +682,7 @@ class TakeOfferViewModel extends ActivatableWithDataModel<TakeOfferDataModel> im
}
public String getSecurityDepositWithCode() {
return HavenoUtils.formatToXmrWithCode(dataModel.getSecurityDeposit());
return HavenoUtils.formatXmr(dataModel.getSecurityDeposit(), true);
}
public String getTradeFee() {

View file

@ -24,12 +24,12 @@ import haveno.core.locale.Res;
import haveno.desktop.main.overlays.Overlay;
import haveno.desktop.main.portfolio.closedtrades.ClosedTradesViewModel;
import haveno.desktop.util.Layout;
import org.bitcoinj.core.Coin;
import javax.inject.Inject;
import javafx.geometry.Insets;
import java.math.BigInteger;
import java.util.Map;
public class ClosedTradesSummaryWindow extends Overlay<ClosedTradesSummaryWindow> {
@ -66,7 +66,7 @@ public class ClosedTradesSummaryWindow extends Overlay<ClosedTradesSummaryWindow
Map<String, String> totalVolumeByCurrency = model.getTotalVolumeByCurrency();
int rowSpan = totalVolumeByCurrency.size() + 4;
addTitledGroupBg(gridPane, rowIndex, rowSpan, Res.get("closedTradesSummaryWindow.headline"));
Coin totalTradeAmount = model.getTotalTradeAmount();
BigInteger totalTradeAmount = model.getTotalTradeAmount();
addConfirmationLabelLabel(gridPane, rowIndex,
Res.get("closedTradesSummaryWindow.totalAmount.title"),
model.getTotalAmountWithVolume(totalTradeAmount), Layout.TWICE_FIRST_ROW_DISTANCE);
@ -78,7 +78,7 @@ public class ClosedTradesSummaryWindow extends Overlay<ClosedTradesSummaryWindow
Res.get("closedTradesSummaryWindow.totalMinerFee.title"),
model.getTotalTxFee(totalTradeAmount));
addConfirmationLabelLabel(gridPane, ++rowIndex,
Res.get("closedTradesSummaryWindow.totalTradeFeeInBtc.title"),
model.getTotalTradeFeeInBtc(totalTradeAmount));
Res.get("closedTradesSummaryWindow.totalTradeFeeInXmr.title"),
model.getTotalTradeFee(totalTradeAmount));
}
}

View file

@ -148,18 +148,18 @@ public class ContractWindow extends Overlay<ContractWindow> {
addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.tradePrice"),
FormattingUtils.formatPrice(contract.getPrice()));
addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.tradeAmount"),
HavenoUtils.formatToXmrWithCode(contract.getTradeAmount()));
HavenoUtils.formatXmr(contract.getTradeAmount(), true));
addConfirmationLabelTextField(gridPane,
++rowIndex,
VolumeUtil.formatVolumeLabel(currencyCode, ":"),
VolumeUtil.formatVolumeWithCode(contract.getTradeVolume()));
String securityDeposit = Res.getWithColAndCap("shared.buyer") +
" " +
HavenoUtils.formatToXmrWithCode(offer.getBuyerSecurityDeposit()) +
HavenoUtils.formatXmr(offer.getBuyerSecurityDeposit(), true) +
" / " +
Res.getWithColAndCap("shared.seller") +
" " +
HavenoUtils.formatToXmrWithCode(offer.getSellerSecurityDeposit());
HavenoUtils.formatXmr(offer.getSellerSecurityDeposit(), true);
addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.securityDeposit"), securityDeposit);
addConfirmationLabelTextField(gridPane,
++rowIndex,

View file

@ -273,26 +273,26 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
}
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("disputeSummaryWindow.role"), role);
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.tradeAmount"),
HavenoUtils.formatToXmrWithCode(contract.getTradeAmount()));
HavenoUtils.formatXmr(contract.getTradeAmount(), true));
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.tradePrice"),
FormattingUtils.formatPrice(contract.getPrice()));
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.tradeVolume"),
VolumeUtil.formatVolumeWithCode(contract.getTradeVolume()));
String tradeFee = Res.getWithColAndCap("shared.buyer") +
" " +
HavenoUtils.formatToXmrWithCode(trade.getBuyer() == trade.getMaker() ? trade.getMakerFee() : trade.getTakerFee()) +
HavenoUtils.formatXmr(trade.getBuyer() == trade.getMaker() ? trade.getMakerFee() : trade.getTakerFee(), true) +
" / " +
Res.getWithColAndCap("shared.seller") +
" " +
HavenoUtils.formatToXmrWithCode(trade.getSeller() == trade.getMaker() ? trade.getMakerFee() : trade.getTakerFee());
HavenoUtils.formatXmr(trade.getSeller() == trade.getMaker() ? trade.getMakerFee() : trade.getTakerFee(), true);
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.tradeFee"), tradeFee);
String securityDeposit = Res.getWithColAndCap("shared.buyer") +
" " +
HavenoUtils.formatToXmrWithCode(trade.getBuyerSecurityDeposit()) +
HavenoUtils.formatXmr(trade.getBuyerSecurityDeposit(), true) +
" / " +
Res.getWithColAndCap("shared.seller") +
" " +
HavenoUtils.formatToXmrWithCode(trade.getSellerSecurityDeposit());
HavenoUtils.formatXmr(trade.getSellerSecurityDeposit(), true);
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.securityDeposit"), securityDeposit);
}
@ -388,10 +388,10 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
if (enteredAmount.compareTo(available) > 0) {
enteredAmount = available;
BigInteger finalEnteredAmount = enteredAmount;
inputTextField.setText(HavenoUtils.formatToXmr(finalEnteredAmount));
inputTextField.setText(HavenoUtils.formatXmr(finalEnteredAmount));
}
BigInteger counterPart = available.subtract(enteredAmount);
String formattedCounterPartAmount = HavenoUtils.formatToXmr(counterPart);
String formattedCounterPartAmount = HavenoUtils.formatXmr(counterPart);
BigInteger buyerAmount;
BigInteger sellerAmount;
if (inputTextField == buyerPayoutAmountInputTextField) {
@ -622,20 +622,20 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
String buyerDetails = "";
if (buyerPayoutAmount.compareTo(BigInteger.valueOf(0)) > 0) {
buyerDetails = Res.get("disputeSummaryWindow.close.txDetails.buyer",
HavenoUtils.formatToXmrWithCode(buyerPayoutAmount),
HavenoUtils.formatXmr(buyerPayoutAmount, true),
buyerPayoutAddressString);
}
String sellerDetails = "";
if (sellerPayoutAmount.compareTo(BigInteger.valueOf(0)) > 0) {
sellerDetails = Res.get("disputeSummaryWindow.close.txDetails.seller",
HavenoUtils.formatToXmrWithCode(sellerPayoutAmount),
HavenoUtils.formatXmr(sellerPayoutAmount, true),
sellerPayoutAddressString);
}
if (outputAmount.compareTo(BigInteger.valueOf(0)) > 0) {
new Popup().width(900)
.headLine(Res.get("disputeSummaryWindow.close.txDetails.headline"))
.confirmation(Res.get("disputeSummaryWindow.close.txDetails",
HavenoUtils.formatToXmrWithCode(outputAmount),
HavenoUtils.formatXmr(outputAmount, true),
buyerDetails,
sellerDetails,
formatter.formatCoinWithCode(HavenoUtils.atomicUnitsToCoin(payoutTx.getFee()))))
@ -711,8 +711,8 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
throw new IllegalStateException("Unknown radio button");
}
disputesService.applyPayoutAmountsToDisputeResult(payout, dispute, disputeResult, -1);
buyerPayoutAmountInputTextField.setText(HavenoUtils.formatToXmr(disputeResult.getBuyerPayoutAmount()));
sellerPayoutAmountInputTextField.setText(HavenoUtils.formatToXmr(disputeResult.getSellerPayoutAmount()));
buyerPayoutAmountInputTextField.setText(HavenoUtils.formatXmr(disputeResult.getBuyerPayoutAmount()));
sellerPayoutAmountInputTextField.setText(HavenoUtils.formatXmr(disputeResult.getSellerPayoutAmount()));
}
private void applyTradeAmountRadioButtonStates() {
@ -724,8 +724,8 @@ public class DisputeSummaryWindow extends Overlay<DisputeSummaryWindow> {
BigInteger buyerPayoutAmount = disputeResult.getBuyerPayoutAmount();
BigInteger sellerPayoutAmount = disputeResult.getSellerPayoutAmount();
buyerPayoutAmountInputTextField.setText(HavenoUtils.formatToXmr(buyerPayoutAmount));
sellerPayoutAmountInputTextField.setText(HavenoUtils.formatToXmr(sellerPayoutAmount));
buyerPayoutAmountInputTextField.setText(HavenoUtils.formatXmr(buyerPayoutAmount));
sellerPayoutAmountInputTextField.setText(HavenoUtils.formatXmr(sellerPayoutAmount));
if (buyerPayoutAmount.equals(tradeAmount.add(buyerSecurityDeposit)) &&
sellerPayoutAmount.equals(sellerSecurityDeposit)) {

View file

@ -206,14 +206,14 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
String btcAmount = Res.get("shared.btcAmount");
if (takeOfferHandlerOptional.isPresent()) {
addConfirmationLabelLabel(gridPane, ++rowIndex, btcAmount + btcDirectionInfo,
HavenoUtils.formatToXmrWithCode(tradeAmount));
HavenoUtils.formatXmr(tradeAmount, true));
addConfirmationLabelLabel(gridPane, ++rowIndex, VolumeUtil.formatVolumeLabel(currencyCode) + fiatDirectionInfo,
VolumeUtil.formatVolumeWithCode(offer.getVolumeByAmount(tradeAmount)));
} else {
addConfirmationLabelLabel(gridPane, ++rowIndex, btcAmount + btcDirectionInfo,
HavenoUtils.formatToXmrWithCode(offer.getAmount()));
HavenoUtils.formatXmr(offer.getAmount(), true));
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("offerDetailsWindow.minBtcAmount"),
HavenoUtils.formatToXmrWithCode(offer.getMinAmount()));
HavenoUtils.formatXmr(offer.getMinAmount(), true));
String volume = VolumeUtil.formatVolumeWithCode(offer.getVolume());
String minVolume = "";
if (offer.getVolume() != null && offer.getMinVolume() != null &&
@ -322,11 +322,11 @@ public class OfferDetailsWindow extends Overlay<OfferDetailsWindow> {
DisplayUtils.formatDateTime(offer.getDate()));
String value = Res.getWithColAndCap("shared.buyer") +
" " +
HavenoUtils.formatToXmrWithCode(offer.getBuyerSecurityDeposit()) +
HavenoUtils.formatXmr(offer.getBuyerSecurityDeposit(), true) +
" / " +
Res.getWithColAndCap("shared.seller") +
" " +
HavenoUtils.formatToXmrWithCode(offer.getSellerSecurityDeposit());
HavenoUtils.formatXmr(offer.getSellerSecurityDeposit(), true);
addConfirmationLabelLabel(gridPane, ++rowIndex, Res.get("shared.securityDeposit"), value);
if (countryCode != null && !isF2F)

View file

@ -159,7 +159,7 @@ public class TradeDetailsWindow extends Overlay<TradeDetailsWindow> {
}
addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.btcAmount") + btcDirectionInfo,
HavenoUtils.formatToXmrWithCode(trade.getAmount()));
HavenoUtils.formatXmr(trade.getAmount(), true));
addConfirmationLabelTextField(gridPane, ++rowIndex,
VolumeUtil.formatVolumeLabel(offer.getCurrencyCode()) + fiatDirectionInfo,
VolumeUtil.formatVolumeWithCode(trade.getVolume()));
@ -212,11 +212,11 @@ public class TradeDetailsWindow extends Overlay<TradeDetailsWindow> {
DisplayUtils.formatDateTime(trade.getDate()));
String securityDeposit = Res.getWithColAndCap("shared.buyer") +
" " +
HavenoUtils.formatToXmrWithCode(offer.getBuyerSecurityDeposit()) +
HavenoUtils.formatXmr(offer.getBuyerSecurityDeposit(), true) +
" / " +
Res.getWithColAndCap("shared.seller") +
" " +
HavenoUtils.formatToXmrWithCode(offer.getSellerSecurityDeposit());
HavenoUtils.formatXmr(offer.getSellerSecurityDeposit(), true);
addConfirmationLabelTextField(gridPane, ++rowIndex, Res.get("shared.securityDeposit"), securityDeposit);
NodeAddress arbitratorNodeAddress = trade.getArbitratorNodeAddress();

View file

@ -17,8 +17,6 @@
package haveno.desktop.main.portfolio.closedtrades;
import org.bitcoinj.core.Coin;
import com.google.inject.Inject;
import haveno.core.account.witness.AccountAgeWitnessService;
import haveno.core.monetary.Price;
@ -37,6 +35,7 @@ import javafx.collections.FXCollections;
import javafx.collections.ListChangeListener;
import javafx.collections.ObservableList;
import java.math.BigInteger;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
@ -85,15 +84,15 @@ class ClosedTradesDataModel extends ActivatableDataModel {
return list.stream().map(ClosedTradesListItem::getTradable).collect(Collectors.toList());
}
Coin getTotalAmount() {
BigInteger getTotalAmount() {
return ClosedTradableUtil.getTotalAmount(getListAsTradables());
}
Optional<Volume> getVolumeInUserFiatCurrency(Coin amount) {
Optional<Volume> getVolumeInUserFiatCurrency(BigInteger amount) {
return getVolume(amount, preferences.getPreferredTradeCurrency().getCode());
}
Optional<Volume> getVolume(Coin amount, String currencyCode) {
Optional<Volume> getVolume(BigInteger amount, String currencyCode) {
MarketPrice marketPrice = priceFeedService.getMarketPrice(currencyCode);
if (marketPrice == null) {
return Optional.empty();
@ -103,15 +102,11 @@ class ClosedTradesDataModel extends ActivatableDataModel {
return Optional.of(VolumeUtil.getVolume(amount, price));
}
Volume getBsqVolumeInUsdWithAveragePrice(Coin amount) {
return closedTradableManager.getBsqVolumeInUsdWithAveragePrice(amount);
}
Coin getTotalTxFee() {
BigInteger getTotalTxFee() {
return ClosedTradableUtil.getTotalTxFee(getListAsTradables());
}
Coin getTotalTradeFee() {
BigInteger getTotalTradeFee() {
return closedTradableManager.getTotalTradeFee(getListAsTradables());
}

View file

@ -84,7 +84,7 @@ public class ClosedTradesListItem implements FilterableListItem {
}
public String getTxFeeAsString() {
return closedTradableFormatter.getTxFeeAsString(tradable);
return closedTradableFormatter.getTotalTxFeeAsString(tradable);
}
public String getTradeFeeAsString(boolean appendCode) {

View file

@ -17,12 +17,12 @@
package haveno.desktop.main.portfolio.closedtrades;
import org.bitcoinj.core.Coin;
import com.google.inject.Inject;
import haveno.core.trade.ClosedTradableFormatter;
import haveno.desktop.common.model.ActivatableWithDataModel;
import haveno.desktop.common.model.ViewModel;
import java.math.BigInteger;
import java.util.Map;
public class ClosedTradesViewModel extends ActivatableWithDataModel<ClosedTradesDataModel> implements ViewModel {
@ -39,11 +39,11 @@ public class ClosedTradesViewModel extends ActivatableWithDataModel<ClosedTrades
// Used in ClosedTradesSummaryWindow
///////////////////////////////////////////////////////////////////////////////////////////
public Coin getTotalTradeAmount() {
public BigInteger getTotalTradeAmount() {
return dataModel.getTotalAmount();
}
public String getTotalAmountWithVolume(Coin totalTradeAmount) {
public String getTotalAmountWithVolume(BigInteger totalTradeAmount) {
return dataModel.getVolumeInUserFiatCurrency(totalTradeAmount)
.map(volume -> closedTradableFormatter.getTotalAmountWithVolumeAsString(totalTradeAmount, volume))
.orElse("");
@ -53,13 +53,13 @@ public class ClosedTradesViewModel extends ActivatableWithDataModel<ClosedTrades
return closedTradableFormatter.getTotalVolumeByCurrencyAsString(dataModel.getListAsTradables());
}
public String getTotalTxFee(Coin totalTradeAmount) {
Coin totalTxFee = dataModel.getTotalTxFee();
public String getTotalTxFee(BigInteger totalTradeAmount) {
BigInteger totalTxFee = dataModel.getTotalTxFee();
return closedTradableFormatter.getTotalTxFeeAsString(totalTradeAmount, totalTxFee);
}
public String getTotalTradeFeeInBtc(Coin totalTradeAmount) {
Coin totalTradeFee = dataModel.getTotalTradeFee();
return closedTradableFormatter.getTotalTradeFeeInBtcAsString(totalTradeAmount, totalTradeFee);
public String getTotalTradeFee(BigInteger totalTradeAmount) {
BigInteger totalTradeFee = dataModel.getTotalTradeFee();
return closedTradableFormatter.getTotalTradeFeeAsString(totalTradeAmount, totalTradeFee);
}
}

View file

@ -275,7 +275,7 @@ public class FailedTradesView extends ActivatableViewAndModel<VBox, FailedTrades
new Popup().warning(Res.get(msgKey,
buyerOrSeller,
makerOrTaker,
HavenoUtils.formatToXmrWithCode(fee),
HavenoUtils.formatXmr(fee, true),
"todo", // TODO: set reserve tx miner fee when verified
reserveTxHash
)

View file

@ -52,7 +52,7 @@ class FailedTradesViewModel extends ActivatableWithDataModel<FailedTradesDataMod
String getAmount(FailedTradesListItem item) {
if (item != null && item.getTrade() != null)
return HavenoUtils.formatToXmr(item.getTrade().getAmount());
return HavenoUtils.formatXmr(item.getTrade().getAmount());
else
return "";
}

View file

@ -159,7 +159,7 @@ class OpenOffersViewModel extends ActivatableWithDataModel<OpenOffersDataModel>
public String getMakerFeeAsString(OpenOffer openOffer) {
Offer offer = openOffer.getOffer();
return HavenoUtils.formatToXmrWithCode(offer.getMakerFee());
return HavenoUtils.formatXmr(offer.getMakerFee(), true);
}
String getTriggerPrice(OpenOfferListItem item) {

View file

@ -272,7 +272,7 @@ public class PendingTradesDataModel extends ActivatableDataModel {
return isMaker;
}
BigInteger getTradeFeeInBTC() {
BigInteger getTradeFee() {
Trade trade = getTrade();
if (trade != null) {
Offer offer = trade.getOffer();

View file

@ -56,7 +56,7 @@ public class PendingTradesListItem implements FilterableListItem {
}
public String getAmountAsString() {
return HavenoUtils.formatToXmr(trade.getAmount());
return HavenoUtils.formatXmr(trade.getAmount());
}
public String getPaymentMethod() {

View file

@ -695,7 +695,7 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
public void updateItem(final PendingTradesListItem item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty)
setGraphic(new AutoTooltipLabel(HavenoUtils.formatToXmr(item.getTrade().getAmount())));
setGraphic(new AutoTooltipLabel(HavenoUtils.formatXmr(item.getTrade().getAmount())));
else
setGraphic(null);
}

View file

@ -230,7 +230,7 @@ public class PendingTradesViewModel extends ActivatableWithDataModel<PendingTrad
public String getPayoutAmount() {
return dataModel.getTrade() != null
? HavenoUtils.formatToXmrWithCode(dataModel.getTrade().getPayoutAmount())
? HavenoUtils.formatXmr(dataModel.getTrade().getPayoutAmount(), true)
: "";
}
@ -276,7 +276,7 @@ public class PendingTradesViewModel extends ActivatableWithDataModel<PendingTrad
// summary
public String getTradeVolume() {
return dataModel.getTrade() != null
? HavenoUtils.formatToXmrWithCode(dataModel.getTrade().getAmount())
? HavenoUtils.formatXmr(dataModel.getTrade().getAmount(), true)
: "";
}
@ -290,15 +290,15 @@ public class PendingTradesViewModel extends ActivatableWithDataModel<PendingTrad
if (trade != null && dataModel.getOffer() != null && trade.getAmount() != null) {
checkNotNull(dataModel.getTrade());
BigInteger tradeFeeInBTC = dataModel.getTradeFeeInBTC();
BigInteger tradeFeeInXmr = dataModel.getTradeFee();
BigInteger minTradeFee = dataModel.isMaker() ?
HavenoUtils.getMinMakerFee() :
HavenoUtils.getMinTakerFee();
String percentage = GUIUtil.getPercentageOfTradeAmount(tradeFeeInBTC, trade.getAmount(),
String percentage = GUIUtil.getPercentageOfTradeAmount(tradeFeeInXmr, trade.getAmount(),
minTradeFee);
return HavenoUtils.formatToXmrWithCode(tradeFeeInBTC) + percentage;
return HavenoUtils.formatXmr(tradeFeeInXmr, true) + percentage;
} else {
return "";
}
@ -319,7 +319,7 @@ public class PendingTradesViewModel extends ActivatableWithDataModel<PendingTrad
String percentage = GUIUtil.getPercentageOfTradeAmount(securityDeposit,
trade.getAmount(),
minSecurityDeposit);
return HavenoUtils.formatToXmrWithCode(securityDeposit) + percentage;
return HavenoUtils.formatXmr(securityDeposit, true) + percentage;
} else {
return "";
}

View file

@ -669,8 +669,8 @@ public abstract class TradeStepView extends AnchorPane {
DisputeResult disputeResult = optionalDispute.get().getDisputeResultProperty().get();
Contract contract = checkNotNull(trade.getContract(), "contract must not be null");
boolean isMyRoleBuyer = contract.isMyRoleBuyer(model.dataModel.getPubKeyRingProvider().get());
String buyerPayoutAmount = HavenoUtils.formatToXmrWithCode(disputeResult.getBuyerPayoutAmount());
String sellerPayoutAmount = HavenoUtils.formatToXmrWithCode(disputeResult.getSellerPayoutAmount());
String buyerPayoutAmount = HavenoUtils.formatXmr(disputeResult.getBuyerPayoutAmount(), true);
String sellerPayoutAmount = HavenoUtils.formatXmr(disputeResult.getSellerPayoutAmount(), true);
String myPayoutAmount = isMyRoleBuyer ? buyerPayoutAmount : sellerPayoutAmount;
String peersPayoutAmount = isMyRoleBuyer ? sellerPayoutAmount : buyerPayoutAmount;

View file

@ -655,8 +655,8 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> {
DisputeResult disputeResult = firstDispute.getDisputeResultProperty().get();
String winner = disputeResult != null &&
disputeResult.getWinner() == DisputeResult.Winner.BUYER ? "Buyer" : "Seller";
String buyerPayoutAmount = disputeResult != null ? HavenoUtils.formatToXmrWithCode(disputeResult.getBuyerPayoutAmount()) : "";
String sellerPayoutAmount = disputeResult != null ? HavenoUtils.formatToXmrWithCode(disputeResult.getSellerPayoutAmount()) : "";
String buyerPayoutAmount = disputeResult != null ? HavenoUtils.formatXmr(disputeResult.getBuyerPayoutAmount(), true) : "";
String sellerPayoutAmount = disputeResult != null ? HavenoUtils.formatXmr(disputeResult.getSellerPayoutAmount(), true) : "";
int index = disputeIndex.incrementAndGet();
String tradeDateString = dateFormatter.format(firstDispute.getTradeDate());
@ -703,7 +703,7 @@ public abstract class DisputeView extends ActivatableView<VBox, Void> {
String paymentMethod = Res.get(contract.getPaymentMethodId());
String currency = CurrencyUtil.getNameAndCode(contract.getOfferPayload().getCurrencyCode());
String tradeAmount = HavenoUtils.formatToXmrWithCode(contract.getTradeAmount());
String tradeAmount = HavenoUtils.formatXmr(contract.getTradeAmount(), true);
String buyerDeposit = Coin.valueOf(contract.getOfferPayload().getBuyerSecurityDeposit()).toFriendlyString();
String sellerDeposit = Coin.valueOf(contract.getOfferPayload().getSellerSecurityDeposit()).toFriendlyString();
stringBuilder.append("Payment method: ")

View file

@ -163,8 +163,8 @@ public class SignedOfferView extends ActivatableView<VBox, Void> {
if(selectedSignedOffer != null) {
new Popup().warning(Res.get("support.prompt.signedOffer.penalty.msg",
selectedSignedOffer.getOfferId(),
HavenoUtils.formatToXmrWithCode(selectedSignedOffer.getMakerTradeFee()),
HavenoUtils.formatToXmrWithCode(selectedSignedOffer.getReserveTxMinerFee()),
HavenoUtils.formatXmr(selectedSignedOffer.getMakerTradeFee(), true),
HavenoUtils.formatXmr(selectedSignedOffer.getReserveTxMinerFee(), true),
selectedSignedOffer.getReserveTxHash(),
selectedSignedOffer.getReserveTxKeyImages())
).onAction(() -> OfferViewUtil.submitTransactionHex(xmrWalletService, tableView,
@ -405,7 +405,7 @@ public class SignedOfferView extends ActivatableView<VBox, Void> {
public void updateItem(final SignedOffer item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty)
setText(HavenoUtils.formatToXmrWithCode(item.getMakerTradeFee()));
setText(HavenoUtils.formatXmr(item.getMakerTradeFee(), true));
else
setText("");
}
@ -431,7 +431,7 @@ public class SignedOfferView extends ActivatableView<VBox, Void> {
public void updateItem(final SignedOffer item, boolean empty) {
super.updateItem(item, empty);
if (item != null && !empty)
setText(HavenoUtils.formatToXmrWithCode(item.getReserveTxMinerFee()));
setText(HavenoUtils.formatXmr(item.getReserveTxMinerFee(), true));
else
setText("");
}

View file

@ -193,8 +193,8 @@ public class DisplayUtils {
public static String formatAmount(Offer offer, CoinFormatter coinFormatter) {
return offer.isRange()
? HavenoUtils.formatToXmr(offer.getMinAmount()) + FormattingUtils.RANGE_SEPARATOR + HavenoUtils.formatToXmr(offer.getAmount())
: HavenoUtils.formatToXmr(offer.getAmount());
? HavenoUtils.formatXmr(offer.getMinAmount()) + FormattingUtils.RANGE_SEPARATOR + HavenoUtils.formatXmr(offer.getAmount())
: HavenoUtils.formatXmr(offer.getAmount());
}
public static String formatAmount(Offer offer,
@ -203,8 +203,8 @@ public class DisplayUtils {
int maxPlaces,
CoinFormatter coinFormatter) {
String formattedAmount = offer.isRange()
? HavenoUtils.formatToXmr(offer.getMinAmount(), decimalPlaces) + FormattingUtils.RANGE_SEPARATOR + HavenoUtils.formatToXmr(offer.getAmount(), decimalPlaces)
: HavenoUtils.formatToXmr(offer.getAmount(), decimalPlaces);
? HavenoUtils.formatXmr(offer.getMinAmount(), decimalPlaces) + FormattingUtils.RANGE_SEPARATOR + HavenoUtils.formatXmr(offer.getAmount(), decimalPlaces)
: HavenoUtils.formatXmr(offer.getAmount(), decimalPlaces);
if (decimalAligned) {
formattedAmount = FormattingUtils.fillUpPlacesWithEmptyStrings(formattedAmount, maxPlaces);
@ -228,7 +228,7 @@ public class DisplayUtils {
public static String getFeeWithFiatAmount(BigInteger makerFee,
Optional<Volume> optionalFeeInFiat,
CoinFormatter formatter) {
String feeInXmr = makerFee != null ? HavenoUtils.formatToXmrWithCode(makerFee) : Res.get("shared.na");
String feeInXmr = makerFee != null ? HavenoUtils.formatXmr(makerFee, true) : Res.get("shared.na");
if (optionalFeeInFiat != null && optionalFeeInFiat.isPresent()) {
String feeInFiat = VolumeUtil.formatAverageVolumeWithCode(optionalFeeInFiat.get());
return Res.get("feeOptionWindow.fee", feeInXmr, feeInFiat);