mirror of
https://github.com/boldsuck/haveno.git
synced 2024-12-22 12:09:22 +00:00
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:
parent
1a1fb130c0
commit
e71f9a54ac
103 changed files with 556 additions and 1681 deletions
|
@ -161,7 +161,7 @@ abstract class AbstractTradeListBuilder extends AbstractTableBuilder {
|
|||
protected final Function<TradeInfo, String> toTradeVolumeAsString = (t) ->
|
||||
isFiatTrade.test(t)
|
||||
? t.getTradeVolume()
|
||||
: formatSatoshis(t.getAmountAsLong());
|
||||
: formatSatoshis(t.getAmount());
|
||||
|
||||
protected final Function<TradeInfo, Long> toTradeVolumeAsLong = (t) ->
|
||||
isFiatTrade.test(t)
|
||||
|
@ -170,7 +170,7 @@ abstract class AbstractTradeListBuilder extends AbstractTableBuilder {
|
|||
|
||||
protected final Function<TradeInfo, Long> toTradeAmount = (t) ->
|
||||
isFiatTrade.test(t)
|
||||
? t.getAmountAsLong()
|
||||
? t.getAmount()
|
||||
: toTradeVolumeAsLong.apply(t);
|
||||
|
||||
protected final Function<TradeInfo, String> toMarket = (t) ->
|
||||
|
@ -192,13 +192,13 @@ abstract class AbstractTradeListBuilder extends AbstractTableBuilder {
|
|||
if (isMyOffer) {
|
||||
return t.getOffer().getMakerFee();
|
||||
} else {
|
||||
return t.getTakerFeeAsLong();
|
||||
return t.getTakerFee();
|
||||
}
|
||||
};
|
||||
|
||||
protected final Function<TradeInfo, Long> toMyMakerOrTakerFee = (t) -> {
|
||||
return isTaker.test(t)
|
||||
? t.getTakerFeeAsLong()
|
||||
? t.getTakerFee()
|
||||
: t.getOffer().getMakerFee();
|
||||
};
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ class ClosedTradeTableBuilder extends AbstractTradeListBuilder {
|
|||
colMarket.addRow(toMarket.apply(t));
|
||||
colPrice.addRow(t.getPrice());
|
||||
colPriceDeviation.addRow(toPriceDeviation.apply(t));
|
||||
colAmount.addRow(t.getAmountAsLong());
|
||||
colAmount.addRow(t.getAmount());
|
||||
colMixedAmount.addRow(t.getTradeVolume());
|
||||
colCurrency.addRow(toPaymentCurrencyCode.apply(t));
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ class FailedTradeTableBuilder extends AbstractTradeListBuilder {
|
|||
colCreateDate.addRow(t.getDate());
|
||||
colMarket.addRow(toMarket.apply(t));
|
||||
colPrice.addRow(t.getPrice());
|
||||
colAmount.addRow(t.getAmountAsLong());
|
||||
colAmount.addRow(t.getAmount());
|
||||
colMixedAmount.addRow(t.getTradeVolume());
|
||||
colCurrency.addRow(toPaymentCurrencyCode.apply(t));
|
||||
colOfferType.addRow(toOfferType.apply(t));
|
||||
|
|
|
@ -51,7 +51,7 @@ class OpenTradeTableBuilder extends AbstractTradeListBuilder {
|
|||
colCreateDate.addRow(t.getDate());
|
||||
colMarket.addRow(toMarket.apply(t));
|
||||
colPrice.addRow(t.getPrice());
|
||||
colAmount.addRow(t.getAmountAsLong());
|
||||
colAmount.addRow(t.getAmount());
|
||||
colMixedAmount.addRow(t.getTradeVolume());
|
||||
colCurrency.addRow(toPaymentCurrencyCode.apply(t));
|
||||
colPaymentMethod.addRow(t.getOffer().getPaymentMethodShortName());
|
||||
|
|
|
@ -251,7 +251,7 @@ public class CoreDisputesService {
|
|||
String agentNodeAddress = checkNotNull(disputeManager.getAgentNodeAddress(dispute)).getFullAddress();
|
||||
Contract contract = dispute.getContract();
|
||||
String currencyCode = contract.getOfferPayload().getCurrencyCode();
|
||||
String amount = HavenoUtils.formatToXmrWithCode(contract.getTradeAmount());
|
||||
String amount = HavenoUtils.formatXmr(contract.getTradeAmount(), true);
|
||||
|
||||
String textToSign = Res.get("disputeSummaryWindow.close.msg",
|
||||
FormattingUtils.formatDateTime(disputeResult.getCloseDate(), true),
|
||||
|
@ -261,8 +261,8 @@ public class CoreDisputesService {
|
|||
currencyCode,
|
||||
Res.get("disputeSummaryWindow.reason." + reason.name()),
|
||||
amount,
|
||||
HavenoUtils.formatToXmrWithCode(disputeResult.getBuyerPayoutAmount()),
|
||||
HavenoUtils.formatToXmrWithCode(disputeResult.getSellerPayoutAmount()),
|
||||
HavenoUtils.formatXmr(disputeResult.getBuyerPayoutAmount(), true),
|
||||
HavenoUtils.formatXmr(disputeResult.getSellerPayoutAmount(), true),
|
||||
disputeResult.summaryNotesProperty().get()
|
||||
);
|
||||
|
||||
|
|
|
@ -33,7 +33,6 @@ import haveno.core.offer.OfferFilterService.Result;
|
|||
import haveno.core.payment.PaymentAccount;
|
||||
import haveno.core.user.User;
|
||||
import haveno.core.util.PriceUtil;
|
||||
import org.bitcoinj.core.Coin;
|
||||
import org.bitcoinj.core.Transaction;
|
||||
import org.bitcoinj.utils.Fiat;
|
||||
|
||||
|
@ -184,14 +183,12 @@ public class CoreOffersService {
|
|||
Price price = priceAsString.isEmpty() ? null : Price.valueOf(upperCaseCurrencyCode, priceStringToLong(priceAsString, upperCaseCurrencyCode));
|
||||
BigInteger amount = BigInteger.valueOf(amountAsLong);
|
||||
BigInteger minAmount = BigInteger.valueOf(minAmountAsLong);
|
||||
Coin useDefaultTxFee = Coin.ZERO;
|
||||
Offer offer = createOfferService.createAndGetOffer(offerId,
|
||||
direction,
|
||||
upperCaseCurrencyCode,
|
||||
amount,
|
||||
minAmount,
|
||||
price,
|
||||
useDefaultTxFee,
|
||||
useMarketBasedPrice,
|
||||
exactMultiply(marketPriceMargin, 0.01),
|
||||
buyerSecurityDeposit,
|
||||
|
@ -219,14 +216,12 @@ public class CoreOffersService {
|
|||
BigInteger minAmount,
|
||||
double buyerSecurityDeposit,
|
||||
PaymentAccount paymentAccount) {
|
||||
Coin useDefaultTxFee = Coin.ZERO;
|
||||
return createOfferService.createAndGetOffer(offerId,
|
||||
direction,
|
||||
currencyCode.toUpperCase(),
|
||||
amount,
|
||||
minAmount,
|
||||
price,
|
||||
useDefaultTxFee,
|
||||
useMarketBasedPrice,
|
||||
exactMultiply(marketPriceMargin, 0.01),
|
||||
buyerSecurityDeposit,
|
||||
|
|
|
@ -52,7 +52,6 @@ public class OfferInfo implements Payload {
|
|||
private final long minAmount;
|
||||
private final String volume;
|
||||
private final String minVolume;
|
||||
private final long txFee;
|
||||
private final long makerFee;
|
||||
@Nullable
|
||||
private final String offerFeePaymentTxId;
|
||||
|
@ -87,7 +86,6 @@ public class OfferInfo implements Payload {
|
|||
this.minAmount = builder.getMinAmount();
|
||||
this.volume = builder.getVolume();
|
||||
this.minVolume = builder.getMinVolume();
|
||||
this.txFee = builder.getTxFee();
|
||||
this.makerFee = builder.getMakerFee();
|
||||
this.offerFeePaymentTxId = builder.getOfferFeePaymentTxId();
|
||||
this.buyerSecurityDeposit = builder.getBuyerSecurityDeposit();
|
||||
|
@ -189,7 +187,6 @@ public class OfferInfo implements Payload {
|
|||
.setVolume(volume)
|
||||
.setMinVolume(minVolume)
|
||||
.setMakerFee(makerFee)
|
||||
.setTxFee(txFee)
|
||||
.setBuyerSecurityDeposit(buyerSecurityDeposit)
|
||||
.setSellerSecurityDeposit(sellerSecurityDeposit)
|
||||
.setTriggerPrice(triggerPrice == null ? "0" : triggerPrice)
|
||||
|
@ -224,7 +221,6 @@ public class OfferInfo implements Payload {
|
|||
.withVolume(proto.getVolume())
|
||||
.withMinVolume(proto.getMinVolume())
|
||||
.withMakerFee(proto.getMakerFee())
|
||||
.withTxFee(proto.getTxFee())
|
||||
.withOfferFeePaymentTxId(ProtoUtil.stringOrNullFromProto(proto.getOfferFeePaymentTxId()))
|
||||
.withBuyerSecurityDeposit(proto.getBuyerSecurityDeposit())
|
||||
.withSellerSecurityDeposit(proto.getSellerSecurityDeposit())
|
||||
|
|
|
@ -63,11 +63,11 @@ public class TradeInfo implements Payload {
|
|||
private final String shortId;
|
||||
private final long date;
|
||||
private final String role;
|
||||
private final long takerFeeAsLong;
|
||||
private final long takerFee;
|
||||
private final String makerDepositTxId;
|
||||
private final String takerDepositTxId;
|
||||
private final String payoutTxId;
|
||||
private final long amountAsLong;
|
||||
private final long amount;
|
||||
private final long buyerSecurityDeposit;
|
||||
private final long sellerSecurityDeposit;
|
||||
private final String price;
|
||||
|
@ -97,11 +97,11 @@ public class TradeInfo implements Payload {
|
|||
this.shortId = builder.getShortId();
|
||||
this.date = builder.getDate();
|
||||
this.role = builder.getRole();
|
||||
this.takerFeeAsLong = builder.getTakerFeeAsLong();
|
||||
this.takerFee = builder.getTakerFee();
|
||||
this.makerDepositTxId = builder.getMakerDepositTxId();
|
||||
this.takerDepositTxId = builder.getTakerDepositTxId();
|
||||
this.payoutTxId = builder.getPayoutTxId();
|
||||
this.amountAsLong = builder.getAmountAsLong();
|
||||
this.amount = builder.getAmount();
|
||||
this.buyerSecurityDeposit = builder.getBuyerSecurityDeposit();
|
||||
this.sellerSecurityDeposit = builder.getSellerSecurityDeposit();
|
||||
this.price = builder.getPrice();
|
||||
|
@ -154,11 +154,11 @@ public class TradeInfo implements Payload {
|
|||
.withShortId(trade.getShortId())
|
||||
.withDate(trade.getDate().getTime())
|
||||
.withRole(role == null ? "" : role)
|
||||
.withTakerFeeAsLong(trade.getTakerFeeAsLong())
|
||||
.withTakerFee(trade.getTakerFee().longValueExact())
|
||||
.withMakerDepositTxId(trade.getMaker().getDepositTxHash())
|
||||
.withTakerDepositTxId(trade.getTaker().getDepositTxHash())
|
||||
.withPayoutTxId(trade.getPayoutTxId())
|
||||
.withAmountAsLong(trade.getAmountAsLong())
|
||||
.withAmount(trade.getAmount().longValueExact())
|
||||
.withBuyerSecurityDeposit(trade.getBuyerSecurityDeposit() == null ? -1 : trade.getBuyerSecurityDeposit().longValueExact())
|
||||
.withSellerSecurityDeposit(trade.getSellerSecurityDeposit() == null ? -1 : trade.getSellerSecurityDeposit().longValueExact())
|
||||
.withPrice(toPreciseTradePrice.apply(trade))
|
||||
|
@ -197,11 +197,11 @@ public class TradeInfo implements Payload {
|
|||
.setShortId(shortId)
|
||||
.setDate(date)
|
||||
.setRole(role)
|
||||
.setTakerFeeAsLong(takerFeeAsLong)
|
||||
.setTakerFee(takerFee)
|
||||
.setMakerDepositTxId(makerDepositTxId == null ? "" : makerDepositTxId)
|
||||
.setTakerDepositTxId(takerDepositTxId == null ? "" : takerDepositTxId)
|
||||
.setPayoutTxId(payoutTxId == null ? "" : payoutTxId)
|
||||
.setAmountAsLong(amountAsLong)
|
||||
.setAmount(amount)
|
||||
.setBuyerSecurityDeposit(buyerSecurityDeposit)
|
||||
.setSellerSecurityDeposit(sellerSecurityDeposit)
|
||||
.setPrice(price)
|
||||
|
@ -234,11 +234,11 @@ public class TradeInfo implements Payload {
|
|||
.withShortId(proto.getShortId())
|
||||
.withDate(proto.getDate())
|
||||
.withRole(proto.getRole())
|
||||
.withTakerFeeAsLong(proto.getTakerFeeAsLong())
|
||||
.withTakerFee(proto.getTakerFee())
|
||||
.withMakerDepositTxId(proto.getMakerDepositTxId())
|
||||
.withTakerDepositTxId(proto.getTakerDepositTxId())
|
||||
.withPayoutTxId(proto.getPayoutTxId())
|
||||
.withAmountAsLong(proto.getAmountAsLong())
|
||||
.withAmount(proto.getAmount())
|
||||
.withBuyerSecurityDeposit(proto.getBuyerSecurityDeposit())
|
||||
.withSellerSecurityDeposit(proto.getSellerSecurityDeposit())
|
||||
.withPrice(proto.getPrice())
|
||||
|
@ -271,11 +271,11 @@ public class TradeInfo implements Payload {
|
|||
", shortId='" + shortId + '\'' + "\n" +
|
||||
", date='" + date + '\'' + "\n" +
|
||||
", role='" + role + '\'' + "\n" +
|
||||
", takerFeeAsLong='" + takerFeeAsLong + '\'' + "\n" +
|
||||
", takerFee='" + takerFee + '\'' + "\n" +
|
||||
", makerDepositTxId='" + makerDepositTxId + '\'' + "\n" +
|
||||
", takerDepositTxId='" + takerDepositTxId + '\'' + "\n" +
|
||||
", payoutTxId='" + payoutTxId + '\'' + "\n" +
|
||||
", amountAsLong='" + amountAsLong + '\'' + "\n" +
|
||||
", amount='" + amount + '\'' + "\n" +
|
||||
", buyerSecurityDeposit='" + buyerSecurityDeposit + '\'' + "\n" +
|
||||
", sellerSecurityDeposit='" + sellerSecurityDeposit + '\'' + "\n" +
|
||||
", price='" + price + '\'' + "\n" +
|
||||
|
|
|
@ -38,7 +38,6 @@ public final class OfferInfoBuilder {
|
|||
private long minAmount;
|
||||
private String volume;
|
||||
private String minVolume;
|
||||
private long txFee;
|
||||
private long makerFee;
|
||||
private String offerFeePaymentTxId;
|
||||
private long buyerSecurityDeposit;
|
||||
|
@ -107,11 +106,6 @@ public final class OfferInfoBuilder {
|
|||
return this;
|
||||
}
|
||||
|
||||
public OfferInfoBuilder withTxFee(long txFee) {
|
||||
this.txFee = txFee;
|
||||
return this;
|
||||
}
|
||||
|
||||
public OfferInfoBuilder withMakerFee(long makerFee) {
|
||||
this.makerFee = makerFee;
|
||||
return this;
|
||||
|
|
|
@ -37,14 +37,14 @@ public final class TradeInfoV1Builder {
|
|||
private long date;
|
||||
private String role;
|
||||
private boolean isCurrencyForTakerFeeBtc;
|
||||
private long txFeeAsLong;
|
||||
private long takerFeeAsLong;
|
||||
private long totalTxFee;
|
||||
private long takerFee;
|
||||
private long buyerSecurityDeposit;
|
||||
private long sellerSecurityDeposit;
|
||||
private String makerDepositTxId;
|
||||
private String takerDepositTxId;
|
||||
private String payoutTxId;
|
||||
private long amountAsLong;
|
||||
private long amount;
|
||||
private String price;
|
||||
private String volume;
|
||||
private String arbitratorNodeAddress;
|
||||
|
@ -97,13 +97,13 @@ public final class TradeInfoV1Builder {
|
|||
return this;
|
||||
}
|
||||
|
||||
public TradeInfoV1Builder withTxFeeAsLong(long txFeeAsLong) {
|
||||
this.txFeeAsLong = txFeeAsLong;
|
||||
public TradeInfoV1Builder withTotalTxFee(long totalTxFee) {
|
||||
this.totalTxFee = totalTxFee;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TradeInfoV1Builder withTakerFeeAsLong(long takerFeeAsLong) {
|
||||
this.takerFeeAsLong = takerFeeAsLong;
|
||||
public TradeInfoV1Builder withTakerFee(long takerFee) {
|
||||
this.takerFee = takerFee;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -132,8 +132,8 @@ public final class TradeInfoV1Builder {
|
|||
return this;
|
||||
}
|
||||
|
||||
public TradeInfoV1Builder withAmountAsLong(long amountAsLong) {
|
||||
this.amountAsLong = amountAsLong;
|
||||
public TradeInfoV1Builder withAmount(long amount) {
|
||||
this.amount = amount;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import haveno.common.config.Config;
|
|||
import haveno.common.proto.network.NetworkProtoResolver;
|
||||
import haveno.common.proto.persistable.PersistenceProtoResolver;
|
||||
import haveno.core.alert.AlertModule;
|
||||
import haveno.core.btc.BitcoinModule;
|
||||
import haveno.core.btc.MoneroModule;
|
||||
import haveno.core.filter.FilterModule;
|
||||
import haveno.core.network.CoreNetworkFilter;
|
||||
import haveno.core.network.p2p.seed.DefaultSeedNodeRepository;
|
||||
|
@ -82,7 +82,7 @@ public class CoreModule extends AppModule {
|
|||
install(new EncryptionServiceModule(config));
|
||||
install(new OfferModule(config));
|
||||
install(new P2PModule(config));
|
||||
install(new BitcoinModule(config));
|
||||
install(new MoneroModule(config));
|
||||
install(new AlertModule(config));
|
||||
install(new FilterModule(config));
|
||||
install(new CorePresentationModule(config));
|
||||
|
|
|
@ -27,7 +27,7 @@ import haveno.common.proto.network.NetworkProtoResolver;
|
|||
import haveno.common.proto.persistable.PersistenceProtoResolver;
|
||||
import haveno.core.alert.AlertModule;
|
||||
import haveno.core.app.TorSetup;
|
||||
import haveno.core.btc.BitcoinModule;
|
||||
import haveno.core.btc.MoneroModule;
|
||||
import haveno.core.filter.FilterModule;
|
||||
import haveno.core.network.CoreNetworkFilter;
|
||||
import haveno.core.network.p2p.seed.DefaultSeedNodeRepository;
|
||||
|
@ -85,7 +85,7 @@ public class ModuleForAppWithP2p extends AppModule {
|
|||
install(new EncryptionServiceModule(config));
|
||||
install(new OfferModule(config));
|
||||
install(new P2PModule(config));
|
||||
install(new BitcoinModule(config));
|
||||
install(new MoneroModule(config));
|
||||
install(new AlertModule(config));
|
||||
install(new FilterModule(config));
|
||||
install(new MoneroConnectionModule(config));
|
||||
|
|
|
@ -44,9 +44,9 @@ import static haveno.common.config.Config.PROVIDERS;
|
|||
import static haveno.common.config.Config.WALLET_DIR;
|
||||
import static haveno.common.config.Config.WALLET_RPC_BIND_PORT;
|
||||
|
||||
public class BitcoinModule extends AppModule {
|
||||
public class MoneroModule extends AppModule {
|
||||
|
||||
public BitcoinModule(Config config) {
|
||||
public MoneroModule(Config config) {
|
||||
super(config);
|
||||
}
|
||||
|
|
@ -39,7 +39,6 @@ import haveno.core.user.User;
|
|||
import haveno.core.util.coin.CoinUtil;
|
||||
import haveno.network.p2p.NodeAddress;
|
||||
import haveno.network.p2p.P2PService;
|
||||
import org.bitcoinj.core.Coin;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
@ -105,7 +104,6 @@ public class CreateOfferService {
|
|||
BigInteger amount,
|
||||
BigInteger minAmount,
|
||||
Price price,
|
||||
Coin txFee,
|
||||
boolean useMarketBasedPrice,
|
||||
double marketPriceMargin,
|
||||
double buyerSecurityDepositAsDouble,
|
||||
|
|
|
@ -112,8 +112,8 @@ public class OfferForJson {
|
|||
priceDisplayString = altcoinFormat.noCode().format(price.getMonetary()).toString();
|
||||
primaryMarketMinAmountDisplayString = altcoinFormat.noCode().format(getMinVolume().getMonetary()).toString();
|
||||
primaryMarketAmountDisplayString = altcoinFormat.noCode().format(getVolume().getMonetary()).toString();
|
||||
primaryMarketMinVolumeDisplayString = HavenoUtils.formatToXmr(getMinAmount()).toString();
|
||||
primaryMarketVolumeDisplayString = HavenoUtils.formatToXmr(getAmount()).toString();
|
||||
primaryMarketMinVolumeDisplayString = HavenoUtils.formatXmr(getMinAmount()).toString();
|
||||
primaryMarketVolumeDisplayString = HavenoUtils.formatXmr(getAmount()).toString();
|
||||
|
||||
primaryMarketPrice = price.getValue();
|
||||
primaryMarketMinAmount = getMinVolume().getValue();
|
||||
|
@ -125,8 +125,8 @@ public class OfferForJson {
|
|||
currencyPair = Res.getBaseCurrencyCode() + "/" + currencyCode;
|
||||
|
||||
priceDisplayString = fiatFormat.noCode().format(price.getMonetary()).toString();
|
||||
primaryMarketMinAmountDisplayString = HavenoUtils.formatToXmr(getMinAmount()).toString();
|
||||
primaryMarketAmountDisplayString = HavenoUtils.formatToXmr(getAmount()).toString();
|
||||
primaryMarketMinAmountDisplayString = HavenoUtils.formatXmr(getMinAmount()).toString();
|
||||
primaryMarketAmountDisplayString = HavenoUtils.formatXmr(getAmount()).toString();
|
||||
primaryMarketMinVolumeDisplayString = fiatFormat.noCode().format(getMinVolume().getMonetary()).toString();
|
||||
primaryMarketVolumeDisplayString = fiatFormat.noCode().format(getVolume().getMonetary()).toString();
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ public class XmrValidator extends NumberValidator {
|
|||
BigDecimal bd = new BigDecimal(input);
|
||||
final BigDecimal atomicUnits = bd.movePointRight(HavenoUtils.XMR_SMALLEST_UNIT_EXPONENT);
|
||||
if (atomicUnits.scale() > 0)
|
||||
return new ValidationResult(false, Res.get("validation.btc.fraction"));
|
||||
return new ValidationResult(false, Res.get("validation.xmr.fraction"));
|
||||
else
|
||||
return new ValidationResult(true);
|
||||
} catch (Throwable t) {
|
||||
|
@ -86,7 +86,7 @@ public class XmrValidator extends NumberValidator {
|
|||
try {
|
||||
final BigInteger amount = HavenoUtils.parseXmr(input);
|
||||
if (maxValue != null && amount.compareTo(maxValue) > 0)
|
||||
return new ValidationResult(false, Res.get("validation.btc.toLarge", HavenoUtils.formatToXmrWithCode(maxValue)));
|
||||
return new ValidationResult(false, Res.get("validation.xmr.tooLarge", HavenoUtils.formatXmr(maxValue, true)));
|
||||
else
|
||||
return new ValidationResult(true);
|
||||
} catch (Throwable t) {
|
||||
|
@ -98,7 +98,7 @@ public class XmrValidator extends NumberValidator {
|
|||
try {
|
||||
final BigInteger amount = HavenoUtils.parseXmr(input);
|
||||
if (maxTradeLimit != null && amount.compareTo(maxTradeLimit) > 0)
|
||||
return new ValidationResult(false, Res.get("validation.btc.exceedsMaxTradeLimit", HavenoUtils.formatToXmrWithCode(maxTradeLimit)));
|
||||
return new ValidationResult(false, Res.get("validation.btc.exceedsMaxTradeLimit", HavenoUtils.formatXmr(maxTradeLimit, true)));
|
||||
else
|
||||
return new ValidationResult(true);
|
||||
} catch (Throwable t) {
|
||||
|
@ -110,7 +110,7 @@ public class XmrValidator extends NumberValidator {
|
|||
try {
|
||||
final BigInteger amount = HavenoUtils.parseXmr(input);
|
||||
if (minValue != null && amount.compareTo(minValue) < 0)
|
||||
return new ValidationResult(false, Res.get("validation.btc.toSmall", HavenoUtils.formatToXmr(minValue)));
|
||||
return new ValidationResult(false, Res.get("validation.xmr.tooSmall", HavenoUtils.formatXmr(minValue)));
|
||||
else
|
||||
return new ValidationResult(true);
|
||||
} catch (Throwable t) {
|
||||
|
|
|
@ -42,13 +42,13 @@ public class BalancePresentation {
|
|||
@Inject
|
||||
public BalancePresentation(Balances balances) {
|
||||
balances.getAvailableBalance().addListener((observable, oldValue, newValue) -> {
|
||||
UserThread.execute(() -> availableBalance.set(HavenoUtils.formatToXmrWithCode(newValue)));
|
||||
UserThread.execute(() -> availableBalance.set(HavenoUtils.formatXmr(newValue, true)));
|
||||
});
|
||||
balances.getPendingBalance().addListener((observable, oldValue, newValue) -> {
|
||||
UserThread.execute(() -> pendingBalance.set(HavenoUtils.formatToXmrWithCode(newValue)));
|
||||
UserThread.execute(() -> pendingBalance.set(HavenoUtils.formatXmr(newValue, true)));
|
||||
});
|
||||
balances.getReservedBalance().addListener((observable, oldValue, newValue) -> {
|
||||
UserThread.execute(() -> reservedBalance.set(HavenoUtils.formatToXmrWithCode(newValue)));
|
||||
UserThread.execute(() -> reservedBalance.set(HavenoUtils.formatXmr(newValue, true)));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,7 +79,6 @@ import haveno.core.payment.payload.VenmoAccountPayload;
|
|||
import haveno.core.payment.payload.VerseAccountPayload;
|
||||
import haveno.core.payment.payload.WeChatPayAccountPayload;
|
||||
import haveno.core.payment.payload.WesternUnionAccountPayload;
|
||||
import haveno.core.trade.statistics.TradeStatistics2;
|
||||
import haveno.core.trade.statistics.TradeStatistics3;
|
||||
import java.time.Clock;
|
||||
|
||||
|
@ -250,8 +249,6 @@ public class CoreProtoResolver implements ProtoResolver {
|
|||
switch (proto.getMessageCase()) {
|
||||
case ACCOUNT_AGE_WITNESS:
|
||||
return AccountAgeWitness.fromProto(proto.getAccountAgeWitness());
|
||||
case TRADE_STATISTICS2:
|
||||
return TradeStatistics2.fromProto(proto.getTradeStatistics2());
|
||||
case SIGNED_WITNESS:
|
||||
return SignedWitness.fromProto(proto.getSignedWitness());
|
||||
case TRADE_STATISTICS3:
|
||||
|
|
|
@ -48,7 +48,6 @@ import haveno.core.trade.messages.MediatedPayoutTxPublishedMessage;
|
|||
import haveno.core.trade.messages.MediatedPayoutTxSignatureMessage;
|
||||
import haveno.core.trade.messages.PaymentReceivedMessage;
|
||||
import haveno.core.trade.messages.PaymentSentMessage;
|
||||
import haveno.core.trade.messages.RefreshTradeStateRequest;
|
||||
import haveno.core.trade.messages.SignContractRequest;
|
||||
import haveno.core.trade.messages.SignContractResponse;
|
||||
import haveno.network.p2p.AckMessage;
|
||||
|
@ -131,9 +130,6 @@ public class CoreNetworkProtoResolver extends CoreProtoResolver implements Netwo
|
|||
case PREFIXED_SEALED_AND_SIGNED_MESSAGE:
|
||||
return PrefixedSealedAndSignedMessage.fromProto(proto.getPrefixedSealedAndSignedMessage(), messageVersion);
|
||||
|
||||
// trade protocol messages
|
||||
case REFRESH_TRADE_STATE_REQUEST:
|
||||
return RefreshTradeStateRequest.fromProto(proto.getRefreshTradeStateRequest(), messageVersion);
|
||||
case INIT_TRADE_REQUEST:
|
||||
return InitTradeRequest.fromProto(proto.getInitTradeRequest(), this, messageVersion);
|
||||
case INIT_MULTISIG_REQUEST:
|
||||
|
|
|
@ -37,7 +37,6 @@ import haveno.core.support.dispute.arbitration.ArbitrationDisputeList;
|
|||
import haveno.core.support.dispute.mediation.MediationDisputeList;
|
||||
import haveno.core.support.dispute.refund.RefundDisputeList;
|
||||
import haveno.core.trade.TradableList;
|
||||
import haveno.core.trade.statistics.TradeStatistics2Store;
|
||||
import haveno.core.trade.statistics.TradeStatistics3Store;
|
||||
import haveno.core.user.PreferencesPayload;
|
||||
import haveno.core.user.UserPayload;
|
||||
|
@ -102,8 +101,6 @@ public class CorePersistenceProtoResolver extends CoreProtoResolver implements P
|
|||
return PaymentAccountList.fromProto(proto.getPaymentAccountList(), this);
|
||||
case ACCOUNT_AGE_WITNESS_STORE:
|
||||
return AccountAgeWitnessStore.fromProto(proto.getAccountAgeWitnessStore());
|
||||
case TRADE_STATISTICS2_STORE:
|
||||
return TradeStatistics2Store.fromProto(proto.getTradeStatistics2Store());
|
||||
case SIGNED_WITNESS_STORE:
|
||||
return SignedWitnessStore.fromProto(proto.getSignedWitnessStore());
|
||||
case TRADE_STATISTICS3_STORE:
|
||||
|
|
|
@ -1049,14 +1049,14 @@ public abstract class DisputeManager<T extends DisputeList<Dispute>> extends Sup
|
|||
String headline;
|
||||
if (potentialGain.compareTo(BigInteger.valueOf(0)) > 0) {
|
||||
headline = "This might be a potential option trade!";
|
||||
optionTradeDetails = "\nBTC amount calculated with price at dispute opening: " + HavenoUtils.formatToXmrWithCode(potentialAmountAtDisputeOpening) +
|
||||
"\nMax loss of security deposit is: " + HavenoUtils.formatToXmrWithCode(maxLossSecDeposit) +
|
||||
"\nPossible gain from an option trade is: " + HavenoUtils.formatToXmrWithCode(potentialGain);
|
||||
optionTradeDetails = "\nBTC amount calculated with price at dispute opening: " + HavenoUtils.formatXmr(potentialAmountAtDisputeOpening, true) +
|
||||
"\nMax loss of security deposit is: " + HavenoUtils.formatXmr(maxLossSecDeposit, true) +
|
||||
"\nPossible gain from an option trade is: " + HavenoUtils.formatXmr(potentialGain, true);
|
||||
} else {
|
||||
headline = "It does not appear to be an option trade.";
|
||||
optionTradeDetails = "\nBTC amount calculated with price at dispute opening: " + HavenoUtils.formatToXmrWithCode(potentialAmountAtDisputeOpening) +
|
||||
"\nMax loss of security deposit is: " + HavenoUtils.formatToXmrWithCode(maxLossSecDeposit) +
|
||||
"\nPossible loss from an option trade is: " + HavenoUtils.formatToXmrWithCode(potentialGain.multiply(BigInteger.valueOf(-1)));
|
||||
optionTradeDetails = "\nBTC amount calculated with price at dispute opening: " + HavenoUtils.formatXmr(potentialAmountAtDisputeOpening, true) +
|
||||
"\nMax loss of security deposit is: " + HavenoUtils.formatXmr(maxLossSecDeposit, true) +
|
||||
"\nPossible loss from an option trade is: " + HavenoUtils.formatXmr(potentialGain.multiply(BigInteger.valueOf(-1)), true);
|
||||
}
|
||||
|
||||
String percentagePriceDetails = offerPayload.isUseMarketBasedPrice() ?
|
||||
|
@ -1065,7 +1065,7 @@ public abstract class DisputeManager<T extends DisputeList<Dispute>> extends Sup
|
|||
|
||||
String priceInfoText = "System message: " + headline +
|
||||
"\n\nTrade price: " + contract.getPrice().toFriendlyString() + percentagePriceDetails +
|
||||
"\nTrade amount: " + HavenoUtils.formatToXmrWithCode(tradeAmount) +
|
||||
"\nTrade amount: " + HavenoUtils.formatXmr(tradeAmount, true) +
|
||||
"\nPrice at dispute opening: " + priceAtDisputeOpening.toFriendlyString() +
|
||||
optionTradeDetails;
|
||||
|
||||
|
|
|
@ -58,8 +58,8 @@ public class ArbitratorTrade extends Trade {
|
|||
}
|
||||
return fromProto(new ArbitratorTrade(
|
||||
Offer.fromProto(proto.getOffer()),
|
||||
BigInteger.valueOf(proto.getAmountAsLong()),
|
||||
BigInteger.valueOf(proto.getTakerFeeAsLong()),
|
||||
BigInteger.valueOf(proto.getAmount()),
|
||||
BigInteger.valueOf(proto.getTakerFee()),
|
||||
proto.getPrice(),
|
||||
xmrWalletService,
|
||||
processModel,
|
||||
|
|
|
@ -80,8 +80,8 @@ public final class BuyerAsMakerTrade extends BuyerTrade implements MakerTrade {
|
|||
}
|
||||
BuyerAsMakerTrade trade = new BuyerAsMakerTrade(
|
||||
Offer.fromProto(proto.getOffer()),
|
||||
BigInteger.valueOf(proto.getAmountAsLong()),
|
||||
BigInteger.valueOf(proto.getTakerFeeAsLong()),
|
||||
BigInteger.valueOf(proto.getAmount()),
|
||||
BigInteger.valueOf(proto.getTakerFee()),
|
||||
proto.getPrice(),
|
||||
xmrWalletService,
|
||||
processModel,
|
||||
|
@ -90,7 +90,6 @@ public final class BuyerAsMakerTrade extends BuyerTrade implements MakerTrade {
|
|||
proto.getProcessModel().getTaker().hasNodeAddress() ? NodeAddress.fromProto(proto.getProcessModel().getTaker().getNodeAddress()) : null,
|
||||
proto.getProcessModel().getArbitrator().hasNodeAddress() ? NodeAddress.fromProto(proto.getProcessModel().getArbitrator().getNodeAddress()) : null);
|
||||
|
||||
trade.setAmountAsLong(proto.getAmountAsLong());
|
||||
trade.setPrice(proto.getPrice());
|
||||
|
||||
return fromProto(trade,
|
||||
|
|
|
@ -83,8 +83,8 @@ public final class BuyerAsTakerTrade extends BuyerTrade implements TakerTrade {
|
|||
}
|
||||
return fromProto(new BuyerAsTakerTrade(
|
||||
Offer.fromProto(proto.getOffer()),
|
||||
BigInteger.valueOf(proto.getAmountAsLong()),
|
||||
BigInteger.valueOf(proto.getTakerFeeAsLong()),
|
||||
BigInteger.valueOf(proto.getAmount()),
|
||||
BigInteger.valueOf(proto.getTakerFee()),
|
||||
proto.getPrice(),
|
||||
xmrWalletService,
|
||||
processModel,
|
||||
|
|
|
@ -17,19 +17,16 @@
|
|||
|
||||
package haveno.core.trade;
|
||||
|
||||
import org.bitcoinj.core.Coin;
|
||||
import org.bitcoinj.core.Monetary;
|
||||
import org.bitcoinj.utils.Fiat;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import static haveno.core.trade.ClosedTradableUtil.*;
|
||||
import static haveno.core.trade.Trade.DisputeState.DISPUTE_CLOSED;
|
||||
import static haveno.core.trade.Trade.DisputeState.MEDIATION_CLOSED;
|
||||
import static haveno.core.trade.Trade.DisputeState.REFUND_REQUEST_CLOSED;
|
||||
import static haveno.core.util.FormattingUtils.BTC_FORMATTER_KEY;
|
||||
import static haveno.core.util.FormattingUtils.formatPercentagePrice;
|
||||
import static haveno.core.util.FormattingUtils.formatToPercentWithSymbol;
|
||||
import static haveno.core.util.VolumeUtil.formatVolume;
|
||||
|
@ -41,7 +38,9 @@ import haveno.core.monetary.Altcoin;
|
|||
import haveno.core.monetary.Volume;
|
||||
import haveno.core.offer.OpenOffer;
|
||||
import haveno.core.util.FormattingUtils;
|
||||
import haveno.core.util.coin.CoinFormatter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
@ -55,56 +54,53 @@ public class ClosedTradableFormatter {
|
|||
// having "generic-enough" property values to be referenced in the core layer.
|
||||
private static final String I18N_KEY_TOTAL_AMOUNT = "closedTradesSummaryWindow.totalAmount.value";
|
||||
private static final String I18N_KEY_TOTAL_TX_FEE = "closedTradesSummaryWindow.totalMinerFee.value";
|
||||
private static final String I18N_KEY_TOTAL_TRADE_FEE_BTC = "closedTradesSummaryWindow.totalTradeFeeInBtc.value";
|
||||
private static final String I18N_KEY_TOTAL_TRADE_FEE_BTC = "closedTradesSummaryWindow.totalTradeFeeInXmr.value";
|
||||
|
||||
private final CoinFormatter btcFormatter;
|
||||
private final ClosedTradableManager closedTradableManager;
|
||||
|
||||
@Inject
|
||||
public ClosedTradableFormatter(ClosedTradableManager closedTradableManager,
|
||||
@Named(BTC_FORMATTER_KEY) CoinFormatter btcFormatter) {
|
||||
public ClosedTradableFormatter(ClosedTradableManager closedTradableManager) {
|
||||
this.closedTradableManager = closedTradableManager;
|
||||
this.btcFormatter = btcFormatter;
|
||||
}
|
||||
|
||||
public String getAmountAsString(Tradable tradable) {
|
||||
return tradable.getOptionalAmount().map(HavenoUtils::formatToXmr).orElse("");
|
||||
return tradable.getOptionalAmount().map(HavenoUtils::formatXmr).orElse("");
|
||||
}
|
||||
|
||||
public String getTotalAmountWithVolumeAsString(Coin totalTradeAmount, Volume volume) {
|
||||
public String getTotalAmountWithVolumeAsString(BigInteger totalTradeAmount, Volume volume) {
|
||||
return Res.get(I18N_KEY_TOTAL_AMOUNT,
|
||||
btcFormatter.formatCoin(totalTradeAmount, true),
|
||||
HavenoUtils.formatXmr(totalTradeAmount, true),
|
||||
formatVolumeWithCode(volume));
|
||||
}
|
||||
|
||||
public String getTxFeeAsString(Tradable tradable) {
|
||||
return btcFormatter.formatCoin(getTxFee(tradable));
|
||||
public String getTotalTxFeeAsString(Tradable tradable) {
|
||||
return HavenoUtils.formatXmr(getTotalTxFee(tradable));
|
||||
}
|
||||
|
||||
public String getTotalTxFeeAsString(Coin totalTradeAmount, Coin totalTxFee) {
|
||||
double percentage = ((double) totalTxFee.value) / totalTradeAmount.value;
|
||||
public String getTotalTxFeeAsString(BigInteger totalTradeAmount, BigInteger totalTxFee) {
|
||||
double percentage = new BigDecimal(totalTxFee).divide(new BigDecimal(totalTradeAmount)).doubleValue();
|
||||
return Res.get(I18N_KEY_TOTAL_TX_FEE,
|
||||
btcFormatter.formatCoin(totalTxFee, true),
|
||||
HavenoUtils.formatXmr(totalTxFee, true),
|
||||
formatToPercentWithSymbol(percentage));
|
||||
}
|
||||
|
||||
public String getBuyerSecurityDepositAsString(Tradable tradable) {
|
||||
return HavenoUtils.formatToXmr(tradable.getOffer().getBuyerSecurityDeposit());
|
||||
return HavenoUtils.formatXmr(tradable.getOffer().getBuyerSecurityDeposit());
|
||||
}
|
||||
|
||||
public String getSellerSecurityDepositAsString(Tradable tradable) {
|
||||
return HavenoUtils.formatToXmr(tradable.getOffer().getSellerSecurityDeposit());
|
||||
return HavenoUtils.formatXmr(tradable.getOffer().getSellerSecurityDeposit());
|
||||
}
|
||||
|
||||
public String getTradeFeeAsString(Tradable tradable, boolean appendCode) {
|
||||
closedTradableManager.getBtcTradeFee(tradable);
|
||||
return btcFormatter.formatCoin(Coin.valueOf(closedTradableManager.getBtcTradeFee(tradable)), appendCode);
|
||||
BigInteger tradeFee = closedTradableManager.getXmrTradeFee(tradable);
|
||||
return HavenoUtils.formatXmr(tradeFee, appendCode);
|
||||
}
|
||||
|
||||
public String getTotalTradeFeeInBtcAsString(Coin totalTradeAmount, Coin totalTradeFee) {
|
||||
double percentage = ((double) totalTradeFee.value) / totalTradeAmount.value;
|
||||
public String getTotalTradeFeeAsString(BigInteger totalTradeAmount, BigInteger totalTradeFee) {
|
||||
double percentage = new BigDecimal(totalTradeFee).divide(new BigDecimal(totalTradeAmount)).doubleValue();
|
||||
return Res.get(I18N_KEY_TOTAL_TRADE_FEE_BTC,
|
||||
btcFormatter.formatCoin(totalTradeFee, true),
|
||||
HavenoUtils.formatXmr(totalTradeFee, true),
|
||||
formatToPercentWithSymbol(percentage));
|
||||
}
|
||||
|
||||
|
|
|
@ -214,20 +214,20 @@ public class ClosedTradableManager implements PersistedDataHost {
|
|||
.count();
|
||||
}
|
||||
|
||||
public Coin getTotalTradeFee(List<Tradable> tradableList) {
|
||||
return Coin.valueOf(tradableList.stream()
|
||||
.mapToLong(tradable -> getTradeFee(tradable))
|
||||
public BigInteger getTotalTradeFee(List<Tradable> tradableList) {
|
||||
return BigInteger.valueOf(tradableList.stream()
|
||||
.mapToLong(tradable -> getTradeFee(tradable).longValueExact())
|
||||
.sum());
|
||||
}
|
||||
|
||||
private long getTradeFee(Tradable tradable) {
|
||||
return getBtcTradeFee(tradable);
|
||||
private BigInteger getTradeFee(Tradable tradable) {
|
||||
return getXmrTradeFee(tradable);
|
||||
}
|
||||
|
||||
public long getBtcTradeFee(Tradable tradable) {
|
||||
public BigInteger getXmrTradeFee(Tradable tradable) {
|
||||
return isMaker(tradable) ?
|
||||
tradable.getOptionalMakerFee().orElse(BigInteger.valueOf(0)).longValueExact() :
|
||||
tradable.getOptionalTakerFee().orElse(BigInteger.valueOf(0)).longValueExact();
|
||||
tradable.getOptionalMakerFee().orElse(BigInteger.valueOf(0)) :
|
||||
tradable.getOptionalTakerFee().orElse(BigInteger.valueOf(0));
|
||||
}
|
||||
|
||||
public boolean isMaker(Tradable tradable) {
|
||||
|
|
|
@ -17,25 +17,24 @@
|
|||
|
||||
package haveno.core.trade;
|
||||
|
||||
import org.bitcoinj.core.Coin;
|
||||
import haveno.core.offer.OpenOffer;
|
||||
import haveno.core.trade.Tradable;
|
||||
import haveno.core.trade.Trade;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ClosedTradableUtil {
|
||||
public static Coin getTotalAmount(List<Tradable> tradableList) {
|
||||
return Coin.valueOf(tradableList.stream()
|
||||
.flatMap(tradable -> tradable.getOptionalAmountAsLong().stream())
|
||||
.mapToLong(value -> value)
|
||||
public static BigInteger getTotalAmount(List<Tradable> tradableList) {
|
||||
return BigInteger.valueOf(tradableList.stream()
|
||||
.flatMap(tradable -> tradable.getOptionalAmount().stream())
|
||||
.mapToLong(value -> value.longValueExact())
|
||||
.sum());
|
||||
}
|
||||
|
||||
public static Coin getTotalTxFee(List<Tradable> tradableList) {
|
||||
return Coin.valueOf(tradableList.stream()
|
||||
.mapToLong(tradable -> getTxFee(tradable).getValue())
|
||||
public static BigInteger getTotalTxFee(List<Tradable> tradableList) {
|
||||
return BigInteger.valueOf(tradableList.stream()
|
||||
.mapToLong(tradable -> getTotalTxFee(tradable).longValueExact())
|
||||
.sum());
|
||||
}
|
||||
|
||||
|
@ -51,8 +50,8 @@ public class ClosedTradableUtil {
|
|||
return map;
|
||||
}
|
||||
|
||||
public static Coin getTxFee(Tradable tradable) {
|
||||
return tradable.getOptionalTxFee().orElse(Coin.ZERO);
|
||||
public static BigInteger getTotalTxFee(Tradable tradable) {
|
||||
return tradable.getTotalTxFee();
|
||||
}
|
||||
|
||||
public static boolean isOpenOffer(Tradable tradable) {
|
||||
|
|
|
@ -132,16 +132,32 @@ public class HavenoUtils {
|
|||
|
||||
// ------------------------- FORMAT UTILS ---------------------------------
|
||||
|
||||
public static String formatToXmr(BigInteger atomicUnits) {
|
||||
public static String formatXmr(BigInteger atomicUnits) {
|
||||
return formatXmr(atomicUnits, false);
|
||||
}
|
||||
|
||||
public static String formatXmr(BigInteger atomicUnits, int decimalPlaces) {
|
||||
return formatXmr(atomicUnits, false, decimalPlaces);
|
||||
}
|
||||
|
||||
public static String formatXmr(BigInteger atomicUnits, boolean appendCode) {
|
||||
return formatXmr(atomicUnits, appendCode, 0);
|
||||
}
|
||||
|
||||
public static String formatXmr(BigInteger atomicUnits, boolean appendCode, int decimalPlaces) {
|
||||
if (atomicUnits == null) return "";
|
||||
return formatToXmr(atomicUnits.longValueExact());
|
||||
return formatXmr(atomicUnits.longValueExact(), appendCode, decimalPlaces);
|
||||
}
|
||||
|
||||
public static String formatToXmr(BigInteger atomicUnits, int decimalPlaces) {
|
||||
return applyDecimals(formatToXmr(atomicUnits), decimalPlaces);
|
||||
public static String formatXmr(long atomicUnits) {
|
||||
return formatXmr(atomicUnits, false, 0);
|
||||
}
|
||||
|
||||
public static String formatToXmr(long atomicUnits) {
|
||||
public static String formatXmr(long atomicUnits, boolean appendCode) {
|
||||
return formatXmr(atomicUnits, appendCode, 0);
|
||||
}
|
||||
|
||||
public static String formatXmr(long atomicUnits, boolean appendCode, int decimalPlaces) {
|
||||
String formatted = XMR_FORMATTER.format(atomicUnitsToXmr(atomicUnits));
|
||||
|
||||
// strip trailing 0s
|
||||
|
@ -150,7 +166,7 @@ public class HavenoUtils {
|
|||
formatted = formatted.substring(0, formatted.length() - 1);
|
||||
}
|
||||
}
|
||||
return applyDecimals(formatted, 2);
|
||||
return applyDecimals(formatted, Math.max(2, decimalPlaces)) + (appendCode ? " XMR" : "");
|
||||
}
|
||||
|
||||
private static String applyDecimals(String decimalStr, int decimalPlaces) {
|
||||
|
@ -164,15 +180,6 @@ public class HavenoUtils {
|
|||
return zeros;
|
||||
}
|
||||
|
||||
public static String formatToXmrWithCode(BigInteger atomicUnits) {
|
||||
if (atomicUnits == null) return "";
|
||||
return formatToXmrWithCode(atomicUnits.longValueExact());
|
||||
}
|
||||
|
||||
public static String formatToXmrWithCode(long atomicUnits) {
|
||||
return formatToXmr(atomicUnits).concat(" XMR");
|
||||
}
|
||||
|
||||
public static BigInteger parseXmr(String input) {
|
||||
if (input == null || input.length() == 0) return BigInteger.valueOf(0);
|
||||
try {
|
||||
|
|
|
@ -83,8 +83,8 @@ public final class SellerAsMakerTrade extends SellerTrade implements MakerTrade
|
|||
}
|
||||
SellerAsMakerTrade trade = new SellerAsMakerTrade(
|
||||
Offer.fromProto(proto.getOffer()),
|
||||
BigInteger.valueOf(proto.getAmountAsLong()),
|
||||
BigInteger.valueOf(proto.getTakerFeeAsLong()),
|
||||
BigInteger.valueOf(proto.getAmount()),
|
||||
BigInteger.valueOf(proto.getTakerFee()),
|
||||
proto.getPrice(),
|
||||
xmrWalletService,
|
||||
processModel,
|
||||
|
@ -93,7 +93,6 @@ public final class SellerAsMakerTrade extends SellerTrade implements MakerTrade
|
|||
proto.getProcessModel().getTaker().hasNodeAddress() ? NodeAddress.fromProto(proto.getProcessModel().getTaker().getNodeAddress()) : null,
|
||||
proto.getProcessModel().getArbitrator().hasNodeAddress() ? NodeAddress.fromProto(proto.getProcessModel().getArbitrator().getNodeAddress()) : null);
|
||||
|
||||
trade.setAmountAsLong(proto.getAmountAsLong());
|
||||
trade.setPrice(proto.getPrice());
|
||||
|
||||
return fromProto(trade,
|
||||
|
|
|
@ -83,8 +83,8 @@ public final class SellerAsTakerTrade extends SellerTrade implements TakerTrade
|
|||
}
|
||||
return fromProto(new SellerAsTakerTrade(
|
||||
Offer.fromProto(proto.getOffer()),
|
||||
BigInteger.valueOf(proto.getAmountAsLong()),
|
||||
BigInteger.valueOf(proto.getTakerFeeAsLong()),
|
||||
BigInteger.valueOf(proto.getAmount()),
|
||||
BigInteger.valueOf(proto.getTakerFee()),
|
||||
proto.getPrice(),
|
||||
xmrWalletService,
|
||||
processModel,
|
||||
|
|
|
@ -22,7 +22,6 @@ import haveno.core.monetary.Price;
|
|||
import haveno.core.monetary.Volume;
|
||||
import haveno.core.offer.Offer;
|
||||
import haveno.network.p2p.NodeAddress;
|
||||
import org.bitcoinj.core.Coin;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.Date;
|
||||
|
@ -57,12 +56,8 @@ public interface Tradable extends PersistablePayload {
|
|||
return asTradeModel().map(Trade::getAmount);
|
||||
}
|
||||
|
||||
default Optional<Long> getOptionalAmountAsLong() {
|
||||
return asTradeModel().map(Trade::getAmountAsLong);
|
||||
}
|
||||
|
||||
default Optional<Coin> getOptionalTxFee() {
|
||||
return asTradeModel().map(Trade::getTxFee);
|
||||
default BigInteger getTotalTxFee() {
|
||||
return asTradeModel().map(Trade::getTotalTxFee).get();
|
||||
}
|
||||
|
||||
default Optional<BigInteger> getOptionalTakerFee() {
|
||||
|
|
|
@ -324,8 +324,7 @@ public abstract class Trade implements Tradable, Model {
|
|||
private final ProcessModel processModel;
|
||||
@Getter
|
||||
private final Offer offer;
|
||||
@Getter
|
||||
private final long takerFeeAsLong;
|
||||
private final long takerFee;
|
||||
|
||||
// Added in 1.5.1
|
||||
@Getter
|
||||
|
@ -335,9 +334,7 @@ public abstract class Trade implements Tradable, Model {
|
|||
private long takeOfferDate;
|
||||
|
||||
// Mutable
|
||||
@Getter
|
||||
@Setter
|
||||
private long amountAsLong;
|
||||
private long amount;
|
||||
@Setter
|
||||
private long price;
|
||||
@Nullable
|
||||
|
@ -373,9 +370,7 @@ public abstract class Trade implements Tradable, Model {
|
|||
// Transient
|
||||
// Immutable
|
||||
@Getter
|
||||
transient final private Coin txFee;
|
||||
@Getter
|
||||
transient final private BigInteger takerFee;
|
||||
transient final private BigInteger totalTxFee;
|
||||
@Getter
|
||||
transient final private XmrWalletService xmrWalletService;
|
||||
|
||||
|
@ -401,9 +396,6 @@ public abstract class Trade implements Tradable, Model {
|
|||
transient private boolean isShutDown;
|
||||
|
||||
// Added in v1.2.0
|
||||
@Nullable
|
||||
transient private BigInteger tradeAmount;
|
||||
|
||||
transient private ObjectProperty<BigInteger> tradeAmountProperty;
|
||||
transient private ObjectProperty<Volume> tradeVolumeProperty;
|
||||
|
||||
|
@ -479,15 +471,13 @@ public abstract class Trade implements Tradable, Model {
|
|||
@Nullable NodeAddress takerNodeAddress,
|
||||
@Nullable NodeAddress arbitratorNodeAddress) {
|
||||
this.offer = offer;
|
||||
this.tradeAmount = tradeAmount;
|
||||
this.txFee = Coin.valueOf(0); // TODO (woodser): remove this field
|
||||
this.takerFee = takerFee;
|
||||
this.amount = tradeAmount.longValueExact();
|
||||
this.takerFee = takerFee.longValueExact();
|
||||
this.totalTxFee = BigInteger.valueOf(0); // TODO: sum tx fees
|
||||
this.price = tradePrice;
|
||||
this.xmrWalletService = xmrWalletService;
|
||||
this.processModel = processModel;
|
||||
this.uid = uid;
|
||||
|
||||
this.takerFeeAsLong = takerFee.longValueExact();
|
||||
this.takeOfferDate = new Date().getTime();
|
||||
this.tradeListeners = new ArrayList<TradeListener>();
|
||||
|
||||
|
@ -1262,9 +1252,8 @@ public abstract class Trade implements Tradable, Model {
|
|||
}
|
||||
|
||||
public void setAmount(BigInteger tradeAmount) {
|
||||
this.tradeAmount = tradeAmount;
|
||||
amountAsLong = tradeAmount.longValueExact();
|
||||
getAmountProperty().set(tradeAmount);
|
||||
this.amount = tradeAmount.longValueExact();
|
||||
getAmountProperty().set(getAmount());
|
||||
getVolumeProperty().set(getVolume());
|
||||
}
|
||||
|
||||
|
@ -1566,15 +1555,17 @@ public abstract class Trade implements Tradable, Model {
|
|||
|
||||
@Nullable
|
||||
public BigInteger getAmount() {
|
||||
if (tradeAmount == null)
|
||||
tradeAmount = BigInteger.valueOf(amountAsLong);
|
||||
return tradeAmount;
|
||||
return BigInteger.valueOf(amount);
|
||||
}
|
||||
|
||||
public BigInteger getMakerFee() {
|
||||
return offer.getMakerFee();
|
||||
}
|
||||
|
||||
public BigInteger getTakerFee() {
|
||||
return BigInteger.valueOf(takerFee);
|
||||
}
|
||||
|
||||
public BigInteger getBuyerSecurityDeposit() {
|
||||
if (getBuyer().getDepositTxHash() == null) return null;
|
||||
return BigInteger.valueOf(getBuyer().getSecurityDeposit());
|
||||
|
@ -1858,10 +1849,10 @@ public abstract class Trade implements Tradable, Model {
|
|||
public Message toProtoMessage() {
|
||||
protobuf.Trade.Builder builder = protobuf.Trade.newBuilder()
|
||||
.setOffer(offer.toProtoMessage())
|
||||
.setTakerFeeAsLong(takerFeeAsLong)
|
||||
.setTakerFee(takerFee)
|
||||
.setTakeOfferDate(takeOfferDate)
|
||||
.setProcessModel(processModel.toProtoMessage())
|
||||
.setAmountAsLong(amountAsLong)
|
||||
.setAmount(amount)
|
||||
.setPrice(price)
|
||||
.setState(Trade.State.toProtoMessage(state))
|
||||
.setPayoutState(Trade.PayoutState.toProtoMessage(payoutState))
|
||||
|
@ -1927,11 +1918,11 @@ public abstract class Trade implements Tradable, Model {
|
|||
public String toString() {
|
||||
return "Trade{" +
|
||||
"\n offer=" + offer +
|
||||
",\n takerFeeAsLong=" + takerFeeAsLong +
|
||||
",\n takerFee=" + takerFee +
|
||||
",\n takeOfferDate=" + takeOfferDate +
|
||||
",\n processModel=" + processModel +
|
||||
",\n payoutTxId='" + payoutTxId + '\'' +
|
||||
",\n tradeAmountAsLong=" + amountAsLong +
|
||||
",\n amount=" + amount +
|
||||
",\n tradePrice=" + price +
|
||||
",\n state=" + state +
|
||||
",\n payoutState=" + payoutState +
|
||||
|
@ -1945,7 +1936,7 @@ public abstract class Trade implements Tradable, Model {
|
|||
",\n counterCurrencyExtraData='" + counterCurrencyExtraData + '\'' +
|
||||
",\n assetTxProofResult='" + assetTxProofResult + '\'' +
|
||||
",\n chatMessages=" + chatMessages +
|
||||
",\n txFee=" + txFee +
|
||||
",\n totalTxFee=" + totalTxFee +
|
||||
",\n takerFee=" + takerFee +
|
||||
",\n xmrWalletService=" + xmrWalletService +
|
||||
",\n stateProperty=" + stateProperty +
|
||||
|
@ -1954,7 +1945,7 @@ public abstract class Trade implements Tradable, Model {
|
|||
",\n tradePeriodStateProperty=" + tradePeriodStateProperty +
|
||||
",\n errorMessageProperty=" + errorMessageProperty +
|
||||
",\n payoutTx=" + payoutTx +
|
||||
",\n tradeAmount=" + tradeAmount +
|
||||
",\n amount=" + amount +
|
||||
",\n tradeAmountProperty=" + tradeAmountProperty +
|
||||
",\n tradeVolumeProperty=" + tradeVolumeProperty +
|
||||
",\n mediationResultState=" + mediationResultState +
|
||||
|
|
|
@ -787,7 +787,7 @@ public class TradeManager implements PersistedDataHost, DecryptedDirectMessageLi
|
|||
trade.getProcessModel().setTradeMessage(model.getTradeRequest());
|
||||
trade.getProcessModel().setMakerSignature(model.getMakerSignature());
|
||||
trade.getProcessModel().setUseSavingsWallet(useSavingsWallet);
|
||||
trade.getProcessModel().setFundsNeededForTradeAsLong(fundsNeededForTrade.longValueExact());
|
||||
trade.getProcessModel().setFundsNeededForTrade(fundsNeededForTrade.longValueExact());
|
||||
trade.getMaker().setPubKeyRing(trade.getOffer().getPubKeyRing());
|
||||
trade.getSelf().setPubKeyRing(model.getPubKeyRing());
|
||||
trade.getSelf().setPaymentAccountId(paymentAccountId);
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
* This file is part of Haveno.
|
||||
*
|
||||
* Haveno is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Haveno is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package haveno.core.trade.messages;
|
||||
|
||||
import haveno.network.p2p.NodeAddress;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Value;
|
||||
|
||||
/**
|
||||
* Not used anymore since v1.4.0
|
||||
* We do the re-sending of the payment sent message via the BuyerSendPaymentSentMessage task on the
|
||||
* buyer side, so seller do not need to do anything interactively.
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("ALL")
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Value
|
||||
public class RefreshTradeStateRequest extends TradeMailboxMessage {
|
||||
private final NodeAddress senderNodeAddress;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// PROTO BUFFER
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private RefreshTradeStateRequest(String messageVersion,
|
||||
String uid,
|
||||
String tradeId,
|
||||
NodeAddress senderNodeAddress) {
|
||||
super(messageVersion, tradeId, uid);
|
||||
this.senderNodeAddress = senderNodeAddress;
|
||||
}
|
||||
|
||||
@Override
|
||||
public protobuf.NetworkEnvelope toProtoNetworkEnvelope() {
|
||||
final protobuf.RefreshTradeStateRequest.Builder builder = protobuf.RefreshTradeStateRequest.newBuilder();
|
||||
builder.setUid(uid)
|
||||
.setTradeId(tradeId)
|
||||
.setSenderNodeAddress(senderNodeAddress.toProtoMessage());
|
||||
return getNetworkEnvelopeBuilder().setRefreshTradeStateRequest(builder).build();
|
||||
}
|
||||
|
||||
public static RefreshTradeStateRequest fromProto(protobuf.RefreshTradeStateRequest proto, String messageVersion) {
|
||||
return new RefreshTradeStateRequest(messageVersion,
|
||||
proto.getUid(),
|
||||
proto.getTradeId(),
|
||||
NodeAddress.fromProto(proto.getSenderNodeAddress()));
|
||||
}
|
||||
}
|
|
@ -25,7 +25,6 @@ import haveno.common.proto.ProtoUtil;
|
|||
import haveno.common.proto.persistable.PersistablePayload;
|
||||
import haveno.common.taskrunner.Model;
|
||||
import haveno.core.account.witness.AccountAgeWitnessService;
|
||||
import haveno.core.btc.model.RawTransactionInput;
|
||||
import haveno.core.btc.wallet.BtcWalletService;
|
||||
import haveno.core.btc.wallet.TradeWalletService;
|
||||
import haveno.core.btc.wallet.XmrWalletService;
|
||||
|
@ -56,9 +55,7 @@ import org.bitcoinj.core.Transaction;
|
|||
|
||||
import javafx.beans.property.ObjectProperty;
|
||||
import javafx.beans.property.SimpleObjectProperty;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
@ -86,14 +83,6 @@ public class ProcessModel implements Model, PersistablePayload {
|
|||
transient private TradeManager tradeManager;
|
||||
transient private Offer offer;
|
||||
|
||||
// Added in v1.2.0
|
||||
@Setter
|
||||
@Nullable
|
||||
transient private byte[] delayedPayoutTxSignature;
|
||||
@Setter
|
||||
@Nullable
|
||||
transient private Transaction preparedDelayedPayoutTx;
|
||||
|
||||
// Added in v1.4.0
|
||||
// MessageState of the last message sent from the seller to the buyer in the take offer process.
|
||||
// It is used only in a task which would not be executed after restart, so no need to persist it.
|
||||
|
@ -121,21 +110,11 @@ public class ProcessModel implements Model, PersistablePayload {
|
|||
@Nullable
|
||||
@Setter
|
||||
private byte[] preparedDepositTx;
|
||||
@Nullable
|
||||
@Setter
|
||||
private List<RawTransactionInput> rawTransactionInputs;
|
||||
@Setter
|
||||
private long changeOutputValue;
|
||||
@Nullable
|
||||
@Setter
|
||||
private String changeOutputAddress;
|
||||
@Setter
|
||||
private boolean useSavingsWallet;
|
||||
@Setter
|
||||
private long fundsNeededForTradeAsLong;
|
||||
@Nullable
|
||||
@Setter
|
||||
private byte[] myMultiSigPubKey;
|
||||
private long fundsNeededForTrade;
|
||||
|
||||
// that is used to store temp. the peers address when we get an incoming message before the message is verified.
|
||||
// After successful verified we copy that over to the trade.tradePeerAddress
|
||||
@Nullable
|
||||
|
@ -229,9 +208,8 @@ public class ProcessModel implements Model, PersistablePayload {
|
|||
.setOfferId(offerId)
|
||||
.setAccountId(accountId)
|
||||
.setPubKeyRing(pubKeyRing.toProtoMessage())
|
||||
.setChangeOutputValue(changeOutputValue)
|
||||
.setUseSavingsWallet(useSavingsWallet)
|
||||
.setFundsNeededForTradeAsLong(fundsNeededForTradeAsLong)
|
||||
.setFundsNeededForTrade(fundsNeededForTrade)
|
||||
.setPaymentSentMessageState(paymentSentMessageStateProperty.get().name())
|
||||
.setBuyerPayoutAmountFromMediation(buyerPayoutAmountFromMediation)
|
||||
.setSellerPayoutAmountFromMediation(sellerPayoutAmountFromMediation)
|
||||
|
@ -241,9 +219,6 @@ public class ProcessModel implements Model, PersistablePayload {
|
|||
Optional.ofNullable(arbitrator).ifPresent(e -> builder.setArbitrator((protobuf.TradePeer) arbitrator.toProtoMessage()));
|
||||
Optional.ofNullable(takeOfferFeeTxId).ifPresent(builder::setTakeOfferFeeTxId);
|
||||
Optional.ofNullable(payoutTxSignature).ifPresent(e -> builder.setPayoutTxSignature(ByteString.copyFrom(payoutTxSignature)));
|
||||
Optional.ofNullable(rawTransactionInputs).ifPresent(e -> builder.addAllRawTransactionInputs(ProtoUtil.collectionToProto(rawTransactionInputs, protobuf.RawTransactionInput.class)));
|
||||
Optional.ofNullable(changeOutputAddress).ifPresent(builder::setChangeOutputAddress);
|
||||
Optional.ofNullable(myMultiSigPubKey).ifPresent(e -> builder.setMyMultiSigPubKey(ByteString.copyFrom(myMultiSigPubKey)));
|
||||
Optional.ofNullable(tempTradePeerNodeAddress).ifPresent(e -> builder.setTempTradePeerNodeAddress(tempTradePeerNodeAddress.toProtoMessage()));
|
||||
Optional.ofNullable(makerSignature).ifPresent(e -> builder.setMakerSignature(makerSignature));
|
||||
Optional.ofNullable(multisigAddress).ifPresent(e -> builder.setMultisigAddress(multisigAddress));
|
||||
|
@ -259,9 +234,8 @@ public class ProcessModel implements Model, PersistablePayload {
|
|||
TradePeer taker = TradePeer.fromProto(proto.getTaker(), coreProtoResolver);
|
||||
PubKeyRing pubKeyRing = PubKeyRing.fromProto(proto.getPubKeyRing());
|
||||
ProcessModel processModel = new ProcessModel(proto.getOfferId(), proto.getAccountId(), pubKeyRing, arbitrator, maker, taker);
|
||||
processModel.setChangeOutputValue(proto.getChangeOutputValue());
|
||||
processModel.setUseSavingsWallet(proto.getUseSavingsWallet());
|
||||
processModel.setFundsNeededForTradeAsLong(proto.getFundsNeededForTradeAsLong());
|
||||
processModel.setFundsNeededForTrade(proto.getFundsNeededForTrade());
|
||||
processModel.setBuyerPayoutAmountFromMediation(proto.getBuyerPayoutAmountFromMediation());
|
||||
processModel.setSellerPayoutAmountFromMediation(proto.getSellerPayoutAmountFromMediation());
|
||||
processModel.setDepositsConfirmedMessagesDelivered(proto.getDepositsConfirmedMessagesDelivered());
|
||||
|
@ -269,12 +243,6 @@ public class ProcessModel implements Model, PersistablePayload {
|
|||
// nullable
|
||||
processModel.setTakeOfferFeeTxId(ProtoUtil.stringOrNullFromProto(proto.getTakeOfferFeeTxId()));
|
||||
processModel.setPayoutTxSignature(ProtoUtil.byteArrayOrNullFromProto(proto.getPayoutTxSignature()));
|
||||
List<RawTransactionInput> rawTransactionInputs = proto.getRawTransactionInputsList().isEmpty() ?
|
||||
null : proto.getRawTransactionInputsList().stream()
|
||||
.map(RawTransactionInput::fromProto).collect(Collectors.toList());
|
||||
processModel.setRawTransactionInputs(rawTransactionInputs);
|
||||
processModel.setChangeOutputAddress(ProtoUtil.stringOrNullFromProto(proto.getChangeOutputAddress()));
|
||||
processModel.setMyMultiSigPubKey(ProtoUtil.byteArrayOrNullFromProto(proto.getMyMultiSigPubKey()));
|
||||
processModel.setTempTradePeerNodeAddress(proto.hasTempTradePeerNodeAddress() ? NodeAddress.fromProto(proto.getTempTradePeerNodeAddress()) : null);
|
||||
processModel.setMediatedPayoutTxSignature(ProtoUtil.byteArrayOrNullFromProto(proto.getMediatedPayoutTxSignature()));
|
||||
processModel.setMakerSignature(proto.getMakerSignature());
|
||||
|
@ -311,7 +279,7 @@ public class ProcessModel implements Model, PersistablePayload {
|
|||
}
|
||||
|
||||
public Coin getFundsNeededForTrade() {
|
||||
return Coin.valueOf(fundsNeededForTradeAsLong);
|
||||
return Coin.valueOf(fundsNeededForTrade);
|
||||
}
|
||||
|
||||
public MoneroTxWallet resolveTakeOfferFeeTx(Trade trade) {
|
||||
|
|
|
@ -131,7 +131,7 @@ public class ProcessInitTradeRequest extends TradeTask {
|
|||
|
||||
// check trade amount
|
||||
checkArgument(request.getTradeAmount() > 0);
|
||||
trade.setAmount(BigInteger.valueOf(request.getTradeAmount()));
|
||||
checkArgument(request.getTradeAmount() == trade.getAmount().longValueExact(), "Trade amount does not match request's trade amount");
|
||||
|
||||
// persist trade
|
||||
processModel.getTradeManager().requestPersistence();
|
||||
|
|
|
@ -1,79 +0,0 @@
|
|||
/*
|
||||
* This file is part of Haveno.
|
||||
*
|
||||
* Haveno is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Haveno is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package haveno.core.trade.protocol.tasks;
|
||||
|
||||
import haveno.common.taskrunner.TaskRunner;
|
||||
import haveno.core.offer.Offer;
|
||||
import haveno.core.offer.OfferPayload;
|
||||
import haveno.core.trade.Trade;
|
||||
import haveno.core.trade.statistics.TradeStatistics2;
|
||||
import haveno.network.p2p.NodeAddress;
|
||||
import haveno.network.p2p.network.NetworkNode;
|
||||
import haveno.network.p2p.network.TorNetworkNode;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
@Slf4j
|
||||
public class PublishTradeStatistics extends TradeTask {
|
||||
public PublishTradeStatistics(TaskRunner<Trade> taskHandler, Trade trade) {
|
||||
super(taskHandler, trade);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void run() {
|
||||
try {
|
||||
runInterceptHook();
|
||||
|
||||
checkNotNull(trade.getMakerDepositTx());
|
||||
checkNotNull(trade.getTakerDepositTx());
|
||||
|
||||
Map<String, String> extraDataMap = new HashMap<>();
|
||||
if (processModel.getReferralIdService().getOptionalReferralId().isPresent()) {
|
||||
extraDataMap.put(OfferPayload.REFERRAL_ID, processModel.getReferralIdService().getOptionalReferralId().get());
|
||||
}
|
||||
|
||||
NodeAddress mediatorNodeAddress = checkNotNull(trade.getArbitrator().getNodeAddress());
|
||||
// The first 4 chars are sufficient to identify a mediator.
|
||||
// For testing with regtest/localhost we use the full address as its localhost and would result in
|
||||
// same values for multiple mediators.
|
||||
NetworkNode networkNode = model.getProcessModel().getP2PService().getNetworkNode();
|
||||
String address = networkNode instanceof TorNetworkNode ?
|
||||
mediatorNodeAddress.getFullAddress().substring(0, 4) :
|
||||
mediatorNodeAddress.getFullAddress();
|
||||
extraDataMap.put(TradeStatistics2.ARBITRATOR_ADDRESS, address);
|
||||
|
||||
Offer offer = checkNotNull(trade.getOffer());
|
||||
TradeStatistics2 tradeStatistics = new TradeStatistics2(offer.getOfferPayload(),
|
||||
trade.getPrice(),
|
||||
trade.getAmount(),
|
||||
trade.getDate(),
|
||||
trade.getMaker().getDepositTxHash(),
|
||||
trade.getTaker().getDepositTxHash(),
|
||||
extraDataMap);
|
||||
processModel.getP2PService().addPersistableNetworkPayload(tradeStatistics, true);
|
||||
|
||||
complete();
|
||||
} catch (Throwable t) {
|
||||
failed(t);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,377 +0,0 @@
|
|||
/*
|
||||
* This file is part of Haveno.
|
||||
*
|
||||
* Haveno is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Haveno is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package haveno.core.trade.statistics;
|
||||
|
||||
import com.google.protobuf.ByteString;
|
||||
import haveno.common.app.Capabilities;
|
||||
import haveno.common.app.Capability;
|
||||
import haveno.common.crypto.Hash;
|
||||
import haveno.common.proto.ProtoUtil;
|
||||
import haveno.common.util.CollectionUtils;
|
||||
import haveno.common.util.ExtraDataMapValidator;
|
||||
import haveno.common.util.JsonExclude;
|
||||
import haveno.common.util.Utilities;
|
||||
import haveno.core.monetary.Altcoin;
|
||||
import haveno.core.monetary.AltcoinExchangeRate;
|
||||
import haveno.core.monetary.Price;
|
||||
import haveno.core.monetary.Volume;
|
||||
import haveno.core.offer.Offer;
|
||||
import haveno.core.offer.OfferDirection;
|
||||
import haveno.core.offer.OfferPayload;
|
||||
import haveno.core.trade.HavenoUtils;
|
||||
import haveno.core.trade.Trade;
|
||||
import haveno.core.util.JsonUtil;
|
||||
import haveno.core.util.VolumeUtil;
|
||||
import haveno.network.p2p.NodeAddress;
|
||||
import haveno.network.p2p.storage.payload.CapabilityRequiringPayload;
|
||||
import haveno.network.p2p.storage.payload.PersistableNetworkPayload;
|
||||
import haveno.network.p2p.storage.payload.ProcessOncePersistableNetworkPayload;
|
||||
import org.bitcoinj.utils.ExchangeRate;
|
||||
import org.bitcoinj.utils.Fiat;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import lombok.Value;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
/**
|
||||
* Serialized size is about 180-210 byte. Nov 2017 we have 5500 objects
|
||||
*/
|
||||
@Deprecated
|
||||
@Slf4j
|
||||
@Value
|
||||
public final class TradeStatistics2 implements ProcessOncePersistableNetworkPayload, PersistableNetworkPayload,
|
||||
CapabilityRequiringPayload, Comparable<TradeStatistics2> {
|
||||
|
||||
public static TradeStatistics2 from(Trade trade,
|
||||
@Nullable String referralId,
|
||||
boolean isTorNetworkNode) {
|
||||
Map<String, String> extraDataMap = new HashMap<>();
|
||||
if (referralId != null) {
|
||||
extraDataMap.put(OfferPayload.REFERRAL_ID, referralId);
|
||||
}
|
||||
|
||||
NodeAddress arbitratorNodeAddress = trade.getArbitratorNodeAddress();
|
||||
if (arbitratorNodeAddress != null) {
|
||||
// The first 4 chars are sufficient to identify a arbitrator.
|
||||
// For testing with regtest/localhost we use the full address as its localhost and would result in
|
||||
// same values for multiple arbitrators.
|
||||
String address = isTorNetworkNode ?
|
||||
arbitratorNodeAddress.getFullAddress().substring(0, 4) :
|
||||
arbitratorNodeAddress.getFullAddress();
|
||||
extraDataMap.put(TradeStatistics2.ARBITRATOR_ADDRESS, address);
|
||||
}
|
||||
|
||||
Offer offer = trade.getOffer();
|
||||
checkNotNull(offer, "offer must not ne null");
|
||||
checkNotNull(trade.getAmount(), "trade.getTradeAmount() must not ne null");
|
||||
return new TradeStatistics2(offer.getOfferPayload(),
|
||||
trade.getPrice(),
|
||||
trade.getAmount(),
|
||||
trade.getDate(),
|
||||
trade.getMaker().getDepositTxHash(),
|
||||
trade.getTaker().getDepositTxHash(),
|
||||
extraDataMap);
|
||||
}
|
||||
|
||||
@SuppressWarnings("SpellCheckingInspection")
|
||||
public static final String ARBITRATOR_ADDRESS = "arbAddr";
|
||||
@SuppressWarnings("SpellCheckingInspection")
|
||||
public static final String REFUND_AGENT_ADDRESS = "refAddr";
|
||||
|
||||
private final OfferDirection direction;
|
||||
private final String baseCurrency;
|
||||
private final String counterCurrency;
|
||||
private final String offerPaymentMethod;
|
||||
private final long offerDate;
|
||||
private final boolean offerUseMarketBasedPrice;
|
||||
private final double offerMarketPriceMargin;
|
||||
private final long offerAmount;
|
||||
private final long offerMinAmount;
|
||||
private final String offerId;
|
||||
private final long tradePrice;
|
||||
private final long tradeAmount;
|
||||
// tradeDate is different for both peers so we ignore it for hash
|
||||
@JsonExclude
|
||||
private final long tradeDate;
|
||||
@JsonExclude
|
||||
@Nullable
|
||||
private final String makerDepositTxId;
|
||||
@Nullable
|
||||
private final String takerDepositTxId;
|
||||
|
||||
// Hash get set in constructor from json of all the other data fields (with hash = null).
|
||||
@JsonExclude
|
||||
private final byte[] hash;
|
||||
// PB field signature_pub_key_bytes not used anymore from v0.6 on
|
||||
|
||||
// Should be only used in emergency case if we need to add data but do not want to break backward compatibility
|
||||
// at the P2P network storage checks. The hash of the object will be used to verify if the data is valid. Any new
|
||||
// field in a class would break that hash and therefore break the storage mechanism.
|
||||
@Nullable
|
||||
@JsonExclude
|
||||
private Map<String, String> extraDataMap;
|
||||
|
||||
public TradeStatistics2(OfferPayload offerPayload,
|
||||
Price tradePrice,
|
||||
BigInteger tradeAmount,
|
||||
Date tradeDate,
|
||||
String makerDepositTxId,
|
||||
String takerDepositTxId,
|
||||
Map<String, String> extraDataMap) {
|
||||
this(offerPayload.getDirection(),
|
||||
offerPayload.getBaseCurrencyCode(),
|
||||
offerPayload.getCounterCurrencyCode(),
|
||||
offerPayload.getPaymentMethodId(),
|
||||
offerPayload.getDate(),
|
||||
offerPayload.isUseMarketBasedPrice(),
|
||||
offerPayload.getMarketPriceMarginPct(),
|
||||
offerPayload.getAmount(),
|
||||
offerPayload.getMinAmount(),
|
||||
offerPayload.getId(),
|
||||
tradePrice.getValue(),
|
||||
tradeAmount.longValueExact(),
|
||||
tradeDate.getTime(),
|
||||
makerDepositTxId,
|
||||
takerDepositTxId,
|
||||
null,
|
||||
extraDataMap);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// PROTO BUFFER
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public TradeStatistics2(OfferDirection direction,
|
||||
String baseCurrency,
|
||||
String counterCurrency,
|
||||
String offerPaymentMethod,
|
||||
long offerDate,
|
||||
boolean offerUseMarketBasedPrice,
|
||||
double offerMarketPriceMargin,
|
||||
long offerAmount,
|
||||
long offerMinAmount,
|
||||
String offerId,
|
||||
long tradePrice,
|
||||
long tradeAmount,
|
||||
long tradeDate,
|
||||
@Nullable String makerDepositTxId,
|
||||
@Nullable String takerDepositTxId,
|
||||
@Nullable byte[] hash,
|
||||
@Nullable Map<String, String> extraDataMap) {
|
||||
this.direction = direction;
|
||||
this.baseCurrency = baseCurrency;
|
||||
this.counterCurrency = counterCurrency;
|
||||
this.offerPaymentMethod = offerPaymentMethod;
|
||||
this.offerDate = offerDate;
|
||||
this.offerUseMarketBasedPrice = offerUseMarketBasedPrice;
|
||||
this.offerMarketPriceMargin = offerMarketPriceMargin;
|
||||
this.offerAmount = offerAmount;
|
||||
this.offerMinAmount = offerMinAmount;
|
||||
this.offerId = offerId;
|
||||
this.tradePrice = tradePrice;
|
||||
this.tradeAmount = tradeAmount;
|
||||
this.tradeDate = tradeDate;
|
||||
this.makerDepositTxId = makerDepositTxId;
|
||||
this.takerDepositTxId = takerDepositTxId;
|
||||
this.extraDataMap = ExtraDataMapValidator.getValidatedExtraDataMap(extraDataMap);
|
||||
|
||||
this.hash = hash == null ? createHash() : hash;
|
||||
}
|
||||
|
||||
public byte[] createHash() {
|
||||
// We create hash from all fields excluding hash itself. We use json as simple data serialisation.
|
||||
// TradeDate is different for both peers so we ignore it for hash. ExtraDataMap is ignored as well as at
|
||||
// software updates we might have different entries which would cause a different hash.
|
||||
return Hash.getSha256Ripemd160hash(JsonUtil.objectToJson(this).getBytes(Charsets.UTF_8));
|
||||
}
|
||||
|
||||
private protobuf.TradeStatistics2.Builder getBuilder() {
|
||||
final protobuf.TradeStatistics2.Builder builder = protobuf.TradeStatistics2.newBuilder()
|
||||
.setDirection(OfferDirection.toProtoMessage(direction))
|
||||
.setBaseCurrency(baseCurrency)
|
||||
.setCounterCurrency(counterCurrency)
|
||||
.setPaymentMethodId(offerPaymentMethod)
|
||||
.setOfferDate(offerDate)
|
||||
.setOfferUseMarketBasedPrice(offerUseMarketBasedPrice)
|
||||
.setOfferMarketPriceMargin(offerMarketPriceMargin)
|
||||
.setOfferAmount(offerAmount)
|
||||
.setOfferMinAmount(offerMinAmount)
|
||||
.setOfferId(offerId)
|
||||
.setTradePrice(tradePrice)
|
||||
.setTradeAmount(tradeAmount)
|
||||
.setTradeDate(tradeDate)
|
||||
.setHash(ByteString.copyFrom(hash));
|
||||
Optional.ofNullable(extraDataMap).ifPresent(builder::putAllExtraData);
|
||||
Optional.ofNullable(makerDepositTxId).ifPresent(builder::setMakerDepositTxId);
|
||||
Optional.ofNullable(takerDepositTxId).ifPresent(builder::setTakerDepositTxId);
|
||||
return builder;
|
||||
}
|
||||
|
||||
public protobuf.TradeStatistics2 toProtoTradeStatistics2() {
|
||||
return getBuilder().build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public protobuf.PersistableNetworkPayload toProtoMessage() {
|
||||
return protobuf.PersistableNetworkPayload.newBuilder().setTradeStatistics2(getBuilder()).build();
|
||||
}
|
||||
|
||||
public static TradeStatistics2 fromProto(protobuf.TradeStatistics2 proto) {
|
||||
return new TradeStatistics2(
|
||||
OfferDirection.fromProto(proto.getDirection()),
|
||||
proto.getBaseCurrency(),
|
||||
proto.getCounterCurrency(),
|
||||
proto.getPaymentMethodId(),
|
||||
proto.getOfferDate(),
|
||||
proto.getOfferUseMarketBasedPrice(),
|
||||
proto.getOfferMarketPriceMargin(),
|
||||
proto.getOfferAmount(),
|
||||
proto.getOfferMinAmount(),
|
||||
proto.getOfferId(),
|
||||
proto.getTradePrice(),
|
||||
proto.getTradeAmount(),
|
||||
proto.getTradeDate(),
|
||||
ProtoUtil.stringOrNullFromProto(proto.getMakerDepositTxId()),
|
||||
ProtoUtil.stringOrNullFromProto(proto.getTakerDepositTxId()),
|
||||
null, // We want to clean up the hashes with the changed hash method in v.1.2.0 so we don't use the value from the proto
|
||||
CollectionUtils.isEmpty(proto.getExtraDataMap()) ? null : proto.getExtraDataMap());
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// API
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public byte[] getHash() {
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean verifyHashSize() {
|
||||
checkNotNull(hash, "hash must not be null");
|
||||
return hash.length == 20;
|
||||
}
|
||||
|
||||
// With v1.2.0 we changed the way how the hash is created. To not create too heavy load for seed nodes from
|
||||
// requests from old nodes we use the TRADE_STATISTICS_HASH_UPDATE capability to send trade statistics only to new
|
||||
// nodes. As trade statistics are only used for informational purpose it will not have any critical issue for the
|
||||
// old nodes beside that they don't see the latest trades. We added TRADE_STATISTICS_HASH_UPDATE in v1.2.2 to fix a
|
||||
// problem of not handling the hashes correctly.
|
||||
@Override
|
||||
public Capabilities getRequiredCapabilities() {
|
||||
return new Capabilities(Capability.TRADE_STATISTICS_HASH_UPDATE);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Getters
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
public Date getTradeDate() {
|
||||
return new Date(tradeDate);
|
||||
}
|
||||
|
||||
public Price getPrice() {
|
||||
return Price.valueOf(getCurrencyCode(), tradePrice);
|
||||
}
|
||||
|
||||
public String getCurrencyCode() {
|
||||
return baseCurrency.equals("XMR") ? counterCurrency : baseCurrency;
|
||||
}
|
||||
|
||||
public BigInteger getTradeAmount() {
|
||||
return BigInteger.valueOf(tradeAmount);
|
||||
}
|
||||
|
||||
public Volume getTradeVolume() {
|
||||
if (getPrice().getMonetary() instanceof Altcoin) {
|
||||
return new Volume(new AltcoinExchangeRate((Altcoin) getPrice().getMonetary()).coinToAltcoin(HavenoUtils.atomicUnitsToCoin(getTradeAmount())));
|
||||
} else {
|
||||
Volume volume = new Volume(new ExchangeRate((Fiat) getPrice().getMonetary()).coinToFiat(HavenoUtils.atomicUnitsToCoin(getTradeAmount())));
|
||||
return VolumeUtil.getRoundedFiatVolume(volume);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
// Exclude a disputed BSQ trade where the price was off by a factor 10 due to a mistake by the maker.
|
||||
// Since the trade wasn't executed it's better to filter it out to avoid it having an undue influence on the
|
||||
// BSQ trade stats.
|
||||
boolean excludedFailedTrade = offerId.equals("6E5KOI6O-3a06a037-6f03-4bfa-98c2-59f49f73466a-112");
|
||||
boolean makerDepositTxIdValid = makerDepositTxId == null || !makerDepositTxId.isEmpty();
|
||||
boolean takerDepositTxIdValid = takerDepositTxId == null || !takerDepositTxId.isEmpty();
|
||||
return tradeAmount > 0 && tradePrice > 0 && !excludedFailedTrade && makerDepositTxIdValid && takerDepositTxIdValid;
|
||||
}
|
||||
|
||||
// TODO: Can be removed as soon as everyone uses v1.2.6+
|
||||
@Override
|
||||
public int compareTo(@NotNull TradeStatistics2 o) {
|
||||
if (direction.equals(o.direction) &&
|
||||
baseCurrency.equals(o.baseCurrency) &&
|
||||
counterCurrency.equals(o.counterCurrency) &&
|
||||
offerPaymentMethod.equals(o.offerPaymentMethod) &&
|
||||
offerDate == o.offerDate &&
|
||||
offerUseMarketBasedPrice == o.offerUseMarketBasedPrice &&
|
||||
offerAmount == o.offerAmount &&
|
||||
offerMinAmount == o.offerMinAmount &&
|
||||
offerId.equals(o.offerId) &&
|
||||
tradePrice == o.tradePrice &&
|
||||
tradeAmount == o.tradeAmount) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TradeStatistics2{" +
|
||||
"\n direction=" + direction +
|
||||
",\n baseCurrency='" + baseCurrency + '\'' +
|
||||
",\n counterCurrency='" + counterCurrency + '\'' +
|
||||
",\n offerPaymentMethod='" + offerPaymentMethod + '\'' +
|
||||
",\n offerDate=" + offerDate +
|
||||
",\n offerUseMarketBasedPrice=" + offerUseMarketBasedPrice +
|
||||
",\n offerMarketPriceMargin=" + offerMarketPriceMargin +
|
||||
",\n offerAmount=" + offerAmount +
|
||||
",\n offerMinAmount=" + offerMinAmount +
|
||||
",\n offerId='" + offerId + '\'' +
|
||||
",\n tradePrice=" + tradePrice +
|
||||
",\n tradeAmount=" + tradeAmount +
|
||||
",\n tradeDate=" + tradeDate +
|
||||
",\n makerDepositTxId='" + makerDepositTxId + '\'' +
|
||||
",\n takerDepositTxId='" + takerDepositTxId + '\'' +
|
||||
",\n hash=" + Utilities.bytesAsHexString(hash) +
|
||||
",\n extraDataMap=" + extraDataMap +
|
||||
"\n}";
|
||||
}
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
/*
|
||||
* This file is part of Haveno.
|
||||
*
|
||||
* Haveno is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Haveno is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package haveno.core.trade.statistics;
|
||||
|
||||
import haveno.common.config.Config;
|
||||
import haveno.common.persistence.PersistenceManager;
|
||||
import haveno.network.p2p.storage.P2PDataStorage;
|
||||
import haveno.network.p2p.storage.payload.PersistableNetworkPayload;
|
||||
import haveno.network.p2p.storage.persistence.MapStoreService;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public class TradeStatistics2StorageService extends MapStoreService<TradeStatistics2Store, PersistableNetworkPayload> {
|
||||
private static final String FILE_NAME = "TradeStatistics2Store";
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Constructor
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Inject
|
||||
public TradeStatistics2StorageService(@Named(Config.STORAGE_DIR) File storageDir,
|
||||
PersistenceManager<TradeStatistics2Store> persistenceManager) {
|
||||
super(storageDir, persistenceManager);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// API
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
protected void initializePersistenceManager() {
|
||||
persistenceManager.initialize(store, PersistenceManager.Source.NETWORK);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFileName() {
|
||||
return FILE_NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<P2PDataStorage.ByteArray, PersistableNetworkPayload> getMap() {
|
||||
// As it is used for data request and response and we do not want to send any old trade stat data anymore.
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
// We overwrite that method to receive old trade stats from the network. As we deactivated getMap to not deliver
|
||||
// hashes we needed to use the getMapOfAllData method to actually store the data.
|
||||
// That's a bit of a hack but it's just for transition and can be removed after a few months anyway.
|
||||
// Alternatively we could create a new interface to handle it differently on the other client classes but that
|
||||
// seems to be not justified as it is needed only temporarily.
|
||||
@Override
|
||||
protected PersistableNetworkPayload putIfAbsent(P2PDataStorage.ByteArray hash, PersistableNetworkPayload payload) {
|
||||
return getMapOfAllData().putIfAbsent(hash, payload);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readFromResources(String postFix, Runnable completeHandler) {
|
||||
// We do not attempt to read from resources as that file is not provided anymore
|
||||
readStore(persisted -> completeHandler.run());
|
||||
}
|
||||
|
||||
public Map<P2PDataStorage.ByteArray, PersistableNetworkPayload> getMapOfAllData() {
|
||||
return store.getMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHandle(PersistableNetworkPayload payload) {
|
||||
return payload instanceof TradeStatistics2;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Protected
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
protected TradeStatistics2Store createStore() {
|
||||
return new TradeStatistics2Store();
|
||||
}
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
/*
|
||||
* This file is part of Haveno.
|
||||
*
|
||||
* Haveno is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Haveno is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package haveno.core.trade.statistics;
|
||||
|
||||
import com.google.protobuf.Message;
|
||||
import haveno.network.p2p.storage.persistence.PersistableNetworkPayloadStore;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* We store only the payload in the PB file to save disc space. The hash of the payload can be created anyway and
|
||||
* is only used as key in the map. So we have a hybrid data structure which is represented as list in the protobuffer
|
||||
* definition and provide a hashMap for the domain access.
|
||||
*/
|
||||
@Slf4j
|
||||
public class TradeStatistics2Store extends PersistableNetworkPayloadStore<TradeStatistics2> {
|
||||
|
||||
TradeStatistics2Store() {
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
// PROTO BUFFER
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private TradeStatistics2Store(List<TradeStatistics2> list) {
|
||||
super(list);
|
||||
}
|
||||
|
||||
public Message toProtoMessage() {
|
||||
return protobuf.PersistableEnvelope.newBuilder()
|
||||
.setTradeStatistics2Store(getBuilder())
|
||||
.build();
|
||||
}
|
||||
|
||||
private protobuf.TradeStatistics2Store.Builder getBuilder() {
|
||||
final List<protobuf.TradeStatistics2> protoList = map.values().stream()
|
||||
.map(payload -> (TradeStatistics2) payload)
|
||||
.map(TradeStatistics2::toProtoTradeStatistics2)
|
||||
.collect(Collectors.toList());
|
||||
return protobuf.TradeStatistics2Store.newBuilder().addAllItems(protoList);
|
||||
}
|
||||
|
||||
public static TradeStatistics2Store fromProto(protobuf.TradeStatistics2Store proto) {
|
||||
List<TradeStatistics2> list = proto.getItemsList().stream()
|
||||
.map(TradeStatistics2::fromProto).collect(Collectors.toList());
|
||||
return new TradeStatistics2Store(list);
|
||||
}
|
||||
}
|
|
@ -94,7 +94,7 @@ public final class TradeStatistics3 implements ProcessOncePersistableNetworkPayl
|
|||
Offer offer = checkNotNull(trade.getOffer());
|
||||
return new TradeStatistics3(offer.getCurrencyCode(),
|
||||
trade.getPrice().getValue(),
|
||||
trade.getAmountAsLong(),
|
||||
trade.getAmount().longValueExact(),
|
||||
offer.getPaymentMethod().getId(),
|
||||
trade.getTakeOfferDate().getTime(),
|
||||
truncatedArbitratorNodeAddress,
|
||||
|
|
|
@ -1,173 +0,0 @@
|
|||
/*
|
||||
* This file is part of Haveno.
|
||||
*
|
||||
* Haveno is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* Haveno is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
|
||||
* License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package haveno.core.trade.statistics;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import haveno.common.UserThread;
|
||||
import haveno.common.config.Config;
|
||||
import haveno.common.file.FileUtil;
|
||||
import haveno.common.util.Utilities;
|
||||
import haveno.core.offer.availability.DisputeAgentSelection;
|
||||
import haveno.network.p2p.BootstrapListener;
|
||||
import haveno.network.p2p.P2PService;
|
||||
import haveno.network.p2p.storage.P2PDataStorage;
|
||||
import haveno.network.p2p.storage.payload.PersistableNetworkPayload;
|
||||
import haveno.network.p2p.storage.persistence.AppendOnlyDataStoreService;
|
||||
import javax.inject.Named;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Singleton
|
||||
@Slf4j
|
||||
public class TradeStatisticsConverter {
|
||||
|
||||
private ExecutorService executor;
|
||||
|
||||
@Inject
|
||||
public TradeStatisticsConverter(P2PService p2PService,
|
||||
P2PDataStorage p2PDataStorage,
|
||||
TradeStatistics2StorageService tradeStatistics2StorageService,
|
||||
TradeStatistics3StorageService tradeStatistics3StorageService,
|
||||
AppendOnlyDataStoreService appendOnlyDataStoreService,
|
||||
@Named(Config.STORAGE_DIR) File storageDir) {
|
||||
File tradeStatistics2Store = new File(storageDir, "TradeStatistics2Store");
|
||||
appendOnlyDataStoreService.addService(tradeStatistics2StorageService);
|
||||
|
||||
p2PService.addP2PServiceListener(new BootstrapListener() {
|
||||
|
||||
@Override
|
||||
public void onTorNodeReady() {
|
||||
if (!tradeStatistics2Store.exists()) {
|
||||
return;
|
||||
}
|
||||
executor = Utilities.getSingleThreadExecutor("TradeStatisticsConverter");
|
||||
executor.submit(() -> {
|
||||
// We convert early once tor is initialized but still not ready to receive data
|
||||
Map<P2PDataStorage.ByteArray, PersistableNetworkPayload> tempMap = new HashMap<>();
|
||||
convertToTradeStatistics3(tradeStatistics2StorageService.getMapOfAllData().values())
|
||||
.forEach(e -> tempMap.put(new P2PDataStorage.ByteArray(e.getHash()), e));
|
||||
|
||||
// We map to user thread to avoid potential threading issues
|
||||
UserThread.execute(() -> {
|
||||
tradeStatistics3StorageService.getMapOfLiveData().putAll(tempMap);
|
||||
tradeStatistics3StorageService.persistNow();
|
||||
});
|
||||
|
||||
try {
|
||||
log.info("We delete now the old trade statistics file as it was converted to the new format.");
|
||||
FileUtil.deleteFileIfExists(tradeStatistics2Store);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.toString());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdatedDataReceived() {
|
||||
}
|
||||
});
|
||||
|
||||
// We listen to old TradeStatistics2 objects, convert and store them and rebroadcast.
|
||||
p2PDataStorage.addAppendOnlyDataStoreListener(payload -> {
|
||||
if (payload instanceof TradeStatistics2) {
|
||||
TradeStatistics3 tradeStatistics3 = convertToTradeStatistics3((TradeStatistics2) payload);
|
||||
// We add it to the p2PDataStorage, which handles to get the data stored in the maps and maybe
|
||||
// re-broadcast as tradeStatistics3 object if not already received.
|
||||
p2PDataStorage.addPersistableNetworkPayload(tradeStatistics3, null, true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void shutDown() {
|
||||
if (executor != null)
|
||||
executor.shutdown();
|
||||
}
|
||||
|
||||
private static List<TradeStatistics3> convertToTradeStatistics3(Collection<PersistableNetworkPayload> persistableNetworkPayloads) {
|
||||
List<TradeStatistics3> list = new ArrayList<>();
|
||||
long ts = System.currentTimeMillis();
|
||||
|
||||
// We might have duplicate entries from both traders as the trade date was different from old clients.
|
||||
// This should not be the case with converting old persisted data as we did filter those out but it is the case
|
||||
// when we receive old trade stat objects from the network of 2 not updated traders.
|
||||
// The hash was ignoring the trade date so we use that to get a unique list
|
||||
Map<P2PDataStorage.ByteArray, TradeStatistics2> mapWithoutDuplicates = new HashMap<>();
|
||||
persistableNetworkPayloads.stream()
|
||||
.filter(e -> e instanceof TradeStatistics2)
|
||||
.map(e -> (TradeStatistics2) e)
|
||||
.filter(TradeStatistics2::isValid)
|
||||
.forEach(e -> mapWithoutDuplicates.putIfAbsent(new P2PDataStorage.ByteArray(e.getHash()), e));
|
||||
|
||||
log.info("We convert the existing {} trade statistics objects to the new format.", mapWithoutDuplicates.size());
|
||||
|
||||
mapWithoutDuplicates.values().stream()
|
||||
.map(TradeStatisticsConverter::convertToTradeStatistics3)
|
||||
.filter(TradeStatistics3::isValid)
|
||||
.forEach(list::add);
|
||||
|
||||
int size = list.size();
|
||||
log.info("Conversion to {} new trade statistic objects has been completed after {} ms",
|
||||
size, System.currentTimeMillis() - ts);
|
||||
|
||||
// We prune mediator and refundAgent data from all objects but the last 100 as we only use the
|
||||
// last 100 entries (DisputeAgentSelection.LOOK_BACK_RANGE).
|
||||
list.sort(Comparator.comparing(TradeStatistics3::getDateAsLong));
|
||||
if (size > DisputeAgentSelection.LOOK_BACK_RANGE) {
|
||||
int start = size - DisputeAgentSelection.LOOK_BACK_RANGE;
|
||||
for (int i = start; i < size; i++) {
|
||||
TradeStatistics3 tradeStatistics3 = list.get(i);
|
||||
tradeStatistics3.pruneOptionalData();
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
private static TradeStatistics3 convertToTradeStatistics3(TradeStatistics2 tradeStatistics2) {
|
||||
Map<String, String> extraDataMap = tradeStatistics2.getExtraDataMap();
|
||||
String mediator = extraDataMap != null ? extraDataMap.get(TradeStatistics2.ARBITRATOR_ADDRESS) : null; // TODO (woodser): using mediator as arbitrator
|
||||
long time = tradeStatistics2.getTradeDate().getTime();
|
||||
// We need to avoid that we duplicate tradeStatistics2 objects in case both traders have not updated yet.
|
||||
// Before v1.4.0 both traders published the trade statistics. If one trader has updated he will check
|
||||
// the capabilities of the peer and if the peer has not updated he will leave publishing to the peer, so we
|
||||
// do not have the problem of duplicated objects.
|
||||
// Also at conversion of locally stored old trade statistics we need to avoid duplicated entries.
|
||||
// To ensure we add only one object we will use the hash of the tradeStatistics2 object which is the same
|
||||
// for both traders as it excluded the trade date which is different for both.
|
||||
byte[] hash = tradeStatistics2.getHash();
|
||||
return new TradeStatistics3(tradeStatistics2.getCurrencyCode(),
|
||||
tradeStatistics2.getPrice().getValue(),
|
||||
tradeStatistics2.getTradeAmount().longValueExact(),
|
||||
tradeStatistics2.getOfferPaymentMethod(),
|
||||
time,
|
||||
mediator,
|
||||
hash);
|
||||
}
|
||||
}
|
|
@ -20,7 +20,6 @@ package haveno.core.trade.statistics;
|
|||
import com.google.inject.Inject;
|
||||
import haveno.common.config.Config;
|
||||
import haveno.common.file.JsonFileManager;
|
||||
import haveno.common.util.Utilities;
|
||||
import haveno.core.locale.CurrencyTuple;
|
||||
import haveno.core.locale.CurrencyUtil;
|
||||
import haveno.core.locale.Res;
|
||||
|
@ -57,7 +56,6 @@ public class TradeStatisticsManager {
|
|||
private final P2PService p2PService;
|
||||
private final PriceFeedService priceFeedService;
|
||||
private final TradeStatistics3StorageService tradeStatistics3StorageService;
|
||||
private final TradeStatisticsConverter tradeStatisticsConverter;
|
||||
private final File storageDir;
|
||||
private final boolean dumpStatistics;
|
||||
private final ObservableSet<TradeStatistics3> observableTradeStatisticsSet = FXCollections.observableSet();
|
||||
|
@ -68,13 +66,11 @@ public class TradeStatisticsManager {
|
|||
PriceFeedService priceFeedService,
|
||||
TradeStatistics3StorageService tradeStatistics3StorageService,
|
||||
AppendOnlyDataStoreService appendOnlyDataStoreService,
|
||||
TradeStatisticsConverter tradeStatisticsConverter,
|
||||
@Named(Config.STORAGE_DIR) File storageDir,
|
||||
@Named(Config.DUMP_STATISTICS) boolean dumpStatistics) {
|
||||
this.p2PService = p2PService;
|
||||
this.priceFeedService = priceFeedService;
|
||||
this.tradeStatistics3StorageService = tradeStatistics3StorageService;
|
||||
this.tradeStatisticsConverter = tradeStatisticsConverter;
|
||||
this.storageDir = storageDir;
|
||||
this.dumpStatistics = dumpStatistics;
|
||||
|
||||
|
@ -83,7 +79,6 @@ public class TradeStatisticsManager {
|
|||
}
|
||||
|
||||
public void shutDown() {
|
||||
tradeStatisticsConverter.shutDown();
|
||||
if (jsonFileManager != null) {
|
||||
jsonFileManager.shutDown();
|
||||
}
|
||||
|
@ -184,17 +179,6 @@ public class TradeStatisticsManager {
|
|||
return;
|
||||
}
|
||||
|
||||
// If we did not find a TradeStatistics3 we look up if we find a TradeStatistics3 converted from
|
||||
// TradeStatistics2 where we used the original hash, which is not the native hash of the
|
||||
// TradeStatistics3 but of TradeStatistics2.
|
||||
TradeStatistics2 tradeStatistics2 = TradeStatistics2.from(trade, referralId, isTorNetworkNode);
|
||||
boolean hasTradeStatistics2 = hashes.contains(new P2PDataStorage.ByteArray(tradeStatistics2.getHash()));
|
||||
if (hasTradeStatistics2) {
|
||||
log.debug("Trade: {}. We have already a tradeStatistics matching the hash of tradeStatistics2. ",
|
||||
trade.getShortId());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!tradeStatistics3.isValid()) {
|
||||
log.warn("Trade: {}. Trade statistics is invalid. We do not publish it.", tradeStatistics3);
|
||||
return;
|
||||
|
|
|
@ -328,7 +328,7 @@ class XmrTxProofRequestsPerTrade implements AssetTxProofRequestsPerTrade {
|
|||
BigInteger tradeLimit = BigInteger.valueOf(autoConfirmSettings.getTradeLimit());
|
||||
if (tradeAmount != null && tradeAmount.compareTo(tradeLimit) > 0) {
|
||||
log.warn("Trade amount {} is higher than limit from auto-conf setting {}.",
|
||||
HavenoUtils.formatToXmrWithCode(tradeAmount), HavenoUtils.formatToXmrWithCode(tradeLimit));
|
||||
HavenoUtils.formatXmr(tradeAmount, true), HavenoUtils.formatXmr(tradeLimit, true));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -912,7 +912,7 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid
|
|||
|
||||
void setSelectedPaymentAccountForCreateOffer(@Nullable PaymentAccount paymentAccount);
|
||||
|
||||
void setPayFeeInBtc(boolean payFeeInBtc);
|
||||
void setPayFeeInXmr(boolean payFeeInXmr);
|
||||
|
||||
void setFiatCurrencies(List<FiatCurrency> currencies);
|
||||
|
||||
|
|
|
@ -89,9 +89,6 @@ public final class PreferencesPayload implements PersistableEnvelope {
|
|||
private List<String> ignoreTradersList = new ArrayList<>();
|
||||
private String directoryChooserPath;
|
||||
|
||||
@Deprecated // Superseded by buyerSecurityDepositAsPercent
|
||||
private long buyerSecurityDepositAsLong;
|
||||
|
||||
private boolean useAnimations;
|
||||
private int cssTheme;
|
||||
@Nullable
|
||||
|
@ -178,7 +175,6 @@ public final class PreferencesPayload implements PersistableEnvelope {
|
|||
.setBitcoinNodes(bitcoinNodes)
|
||||
.addAllIgnoreTradersList(ignoreTradersList)
|
||||
.setDirectoryChooserPath(directoryChooserPath)
|
||||
.setBuyerSecurityDepositAsLong(buyerSecurityDepositAsLong)
|
||||
.setUseAnimations(useAnimations)
|
||||
.setCssTheme(cssTheme)
|
||||
.setBridgeOptionOrdinal(bridgeOptionOrdinal)
|
||||
|
@ -268,7 +264,6 @@ public final class PreferencesPayload implements PersistableEnvelope {
|
|||
proto.getBitcoinNodes(),
|
||||
proto.getIgnoreTradersListList(),
|
||||
proto.getDirectoryChooserPath(),
|
||||
proto.getBuyerSecurityDepositAsLong(),
|
||||
proto.getUseAnimations(),
|
||||
proto.getCssTheme(),
|
||||
paymentAccount,
|
||||
|
|
|
@ -28,6 +28,9 @@ import haveno.core.monetary.AltcoinExchangeRate;
|
|||
import haveno.core.monetary.Price;
|
||||
import haveno.core.monetary.Volume;
|
||||
import haveno.core.offer.Offer;
|
||||
import haveno.core.trade.HavenoUtils;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.NumberFormat;
|
||||
|
||||
|
@ -64,11 +67,12 @@ public class VolumeUtil {
|
|||
return Volume.parse(String.valueOf(roundedVolume), volumeByAmount.getCurrencyCode());
|
||||
}
|
||||
|
||||
public static Volume getVolume(Coin amount, Price price) {
|
||||
public static Volume getVolume(BigInteger amount, Price price) {
|
||||
// TODO: conversion to Coin loses precision
|
||||
if (price.getMonetary() instanceof Altcoin) {
|
||||
return new Volume(new AltcoinExchangeRate((Altcoin) price.getMonetary()).coinToAltcoin(amount));
|
||||
return new Volume(new AltcoinExchangeRate((Altcoin) price.getMonetary()).coinToAltcoin(HavenoUtils.atomicUnitsToCoin(amount)));
|
||||
} else {
|
||||
return new Volume(new ExchangeRate((Fiat) price.getMonetary()).coinToFiat(amount));
|
||||
return new Volume(new ExchangeRate((Fiat) price.getMonetary()).coinToFiat(HavenoUtils.atomicUnitsToCoin(amount)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -45,10 +45,10 @@ public class IntegerValidator extends InputValidator {
|
|||
return new ValidationResult(false, Res.get("validation.notAnInteger"));
|
||||
|
||||
if (isBelowMinValue(intValue))
|
||||
return new ValidationResult(false, Res.get("validation.btc.toSmall", minValue));
|
||||
return new ValidationResult(false, Res.get("validation.xmr.tooSmall", minValue));
|
||||
|
||||
if (isAboveMaxValue(intValue))
|
||||
return new ValidationResult(false, Res.get("validation.btc.toLarge", maxValue));
|
||||
return new ValidationResult(false, Res.get("validation.xmr.tooLarge", maxValue));
|
||||
|
||||
return validationResult;
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public abstract class MonetaryValidator extends NumberValidator {
|
|||
protected ValidationResult validateIfNotExceedsMinValue(String input) {
|
||||
double d = Double.parseDouble(input);
|
||||
if (d < getMinValue())
|
||||
return new ValidationResult(false, Res.get("validation.fiat.toSmall"));
|
||||
return new ValidationResult(false, Res.get("validation.fiat.tooSmall"));
|
||||
else
|
||||
return new ValidationResult(true);
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public abstract class MonetaryValidator extends NumberValidator {
|
|||
protected ValidationResult validateIfNotExceedsMaxValue(String input) {
|
||||
double d = Double.parseDouble(input);
|
||||
if (d > getMaxValue())
|
||||
return new ValidationResult(false, Res.get("validation.fiat.toLarge"));
|
||||
return new ValidationResult(false, Res.get("validation.fiat.tooLarge"));
|
||||
else
|
||||
return new ValidationResult(true);
|
||||
}
|
||||
|
|
|
@ -2009,8 +2009,8 @@ closedTradesSummaryWindow.totalAmount.value={0} ({1} with current market price)
|
|||
closedTradesSummaryWindow.totalVolume.title=Total amount traded in {0}
|
||||
closedTradesSummaryWindow.totalMinerFee.title=Sum of all miner fees
|
||||
closedTradesSummaryWindow.totalMinerFee.value={0} ({1} of total trade amount)
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.title=Sum of all trade fees paid in BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.value={0} ({1} of total trade amount)
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.title=Sum of all trade fees paid in XMR
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.value={0} ({1} of total trade amount)
|
||||
walletPasswordWindow.headline=Enter password to unlock
|
||||
|
||||
torNetworkSettingWindow.header=Tor networks settings
|
||||
|
@ -3230,11 +3230,11 @@ validation.NaN=Input is not a valid number.
|
|||
validation.notAnInteger=Input is not an integer value.
|
||||
validation.zero=Input of 0 is not allowed.
|
||||
validation.negative=A negative value is not allowed.
|
||||
validation.fiat.toSmall=Input smaller than minimum possible amount is not allowed.
|
||||
validation.fiat.toLarge=Input larger than maximum possible amount is not allowed.
|
||||
validation.btc.fraction=Input will result in a bitcoin value of less than 1 satoshi
|
||||
validation.btc.toLarge=Input larger than {0} is not allowed.
|
||||
validation.btc.toSmall=Input smaller than {0} is not allowed.
|
||||
validation.fiat.tooSmall=Input smaller than minimum possible amount is not allowed.
|
||||
validation.fiat.tooLarge=Input larger than maximum possible amount is not allowed.
|
||||
validation.xmr.fraction=Input will result in a bitcoin value of less than 1 satoshi
|
||||
validation.xmr.tooLarge=Input larger than {0} is not allowed.
|
||||
validation.xmr.tooSmall=Input smaller than {0} is not allowed.
|
||||
validation.passwordTooShort=The password you entered is too short. It needs to have a min. of 8 characters.
|
||||
validation.passwordTooLong=The password you entered is too long. It cannot be longer than 50 characters.
|
||||
validation.sortCodeNumber={0} must consist of {1} numbers.
|
||||
|
|
|
@ -1511,8 +1511,8 @@ closedTradesSummaryWindow.totalAmount.value={0} ({1} podle aktuální tržní ce
|
|||
closedTradesSummaryWindow.totalVolume.title=Celkový objem obchodovaný v {0}
|
||||
closedTradesSummaryWindow.totalMinerFee.title=Suma poplatků za těžbu
|
||||
closedTradesSummaryWindow.totalMinerFee.value={0} ({1} z celkového objemu obchodů)
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.title=Suma obchodních poplatků v BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.value={0} ({1} z celkového objemu obchodů)
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.title=Suma obchodních poplatků v BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.value={0} ({1} z celkového objemu obchodů)
|
||||
walletPasswordWindow.headline=Pro odemknutí zadejte heslo
|
||||
|
||||
torNetworkSettingWindow.header=Nastavení sítě Tor
|
||||
|
@ -2152,11 +2152,11 @@ validation.NaN=Vstup není platné číslo.
|
|||
validation.notAnInteger=Vstup není celočíselná hodnota.
|
||||
validation.zero=Vstup 0 není povolen.
|
||||
validation.negative=Záporná hodnota není povolena.
|
||||
validation.fiat.toSmall=Vstup menší než minimální možné množství není povolen.
|
||||
validation.fiat.toLarge=Vstup větší než maximální možné množství není povolen.
|
||||
validation.btc.fraction=Zadání povede k hodnotě bitcoinu menší než 1 satoshi
|
||||
validation.btc.toLarge=Vstup větší než {0} není povolen.
|
||||
validation.btc.toSmall=Vstup menší než {0} není povolen.
|
||||
validation.fiat.tooSmall=Vstup menší než minimální možné množství není povolen.
|
||||
validation.fiat.tooLarge=Vstup větší než maximální možné množství není povolen.
|
||||
validation.xmr.fraction=Zadání povede k hodnotě bitcoinu menší než 1 satoshi
|
||||
validation.xmr.tooLarge=Vstup větší než {0} není povolen.
|
||||
validation.xmr.tooSmall=Vstup menší než {0} není povolen.
|
||||
validation.passwordTooShort=Zadané heslo je příliš krátké. Musí mít min. 8 znaků.
|
||||
validation.passwordTooLong=Zadané heslo je příliš dlouhé. Nemůže být delší než 50 znaků.
|
||||
validation.sortCodeNumber={0} se musí skládat z {1} čísel.
|
||||
|
|
|
@ -1511,8 +1511,8 @@ closedTradesSummaryWindow.totalAmount.value={0} ({1} with current market price)
|
|||
closedTradesSummaryWindow.totalVolume.title=Total amount traded in {0}
|
||||
closedTradesSummaryWindow.totalMinerFee.title=Sum of all miner fees
|
||||
closedTradesSummaryWindow.totalMinerFee.value={0} ({1} of total trade amount)
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.title=Sum of all trade fees paid in BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.value={0} ({1} of total trade amount)
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.title=Sum of all trade fees paid in BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.value={0} ({1} of total trade amount)
|
||||
walletPasswordWindow.headline=Passwort zum Entsperren eingeben
|
||||
|
||||
torNetworkSettingWindow.header=Tor-Netzwerkeinstellungen
|
||||
|
@ -2152,11 +2152,11 @@ validation.NaN=Die Eingabe ist keine gültige Zahl.
|
|||
validation.notAnInteger=Eingabe ist keine ganze Zahl.
|
||||
validation.zero=Die Eingabe von 0 ist nicht erlaubt.
|
||||
validation.negative=Ein negativer Wert ist nicht erlaubt.
|
||||
validation.fiat.toSmall=Eingaben kleiner als der minimal mögliche Betrag sind nicht erlaubt.
|
||||
validation.fiat.toLarge=Eingaben größer als der maximal mögliche Betrag sind nicht erlaubt.
|
||||
validation.btc.fraction=Input wird einem Bitcoin Wert von weniger als 1 satoshi entsprechen
|
||||
validation.btc.toLarge=Eingaben größer als {0} sind nicht erlaubt.
|
||||
validation.btc.toSmall=Eingabe kleiner als {0} ist nicht erlaubt.
|
||||
validation.fiat.tooSmall=Eingaben kleiner als der minimal mögliche Betrag sind nicht erlaubt.
|
||||
validation.fiat.tooLarge=Eingaben größer als der maximal mögliche Betrag sind nicht erlaubt.
|
||||
validation.xmr.fraction=Input wird einem Bitcoin Wert von weniger als 1 satoshi entsprechen
|
||||
validation.xmr.tooLarge=Eingaben größer als {0} sind nicht erlaubt.
|
||||
validation.xmr.tooSmall=Eingabe kleiner als {0} ist nicht erlaubt.
|
||||
validation.passwordTooShort=Das Passwort das Sie eingegeben haben ist zu kurz. Es muss mindestens 8 Zeichen enthalten.
|
||||
validation.passwordTooLong=Das eingegebene Passwort ist zu lang. Es darf nicht aus mehr als 50 Zeichen bestehen.
|
||||
validation.sortCodeNumber={0} muss aus {1} Zahlen bestehen.
|
||||
|
|
|
@ -1511,8 +1511,8 @@ closedTradesSummaryWindow.totalAmount.value={0} ({1} con el precio de mercado ac
|
|||
closedTradesSummaryWindow.totalVolume.title=Cantidad total intercambiada en {0}
|
||||
closedTradesSummaryWindow.totalMinerFee.title=Suma de todas las trasas de minado
|
||||
closedTradesSummaryWindow.totalMinerFee.value={0} ({1} de la cantidad total intercambiada)
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.title=Suma de todas las tasas de intercambio pagadas en BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.value={0} ({1} de la cantidad total intercambiada)
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.title=Suma de todas las tasas de intercambio pagadas en BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.value={0} ({1} de la cantidad total intercambiada)
|
||||
walletPasswordWindow.headline=Introducir contraseña para desbloquear
|
||||
|
||||
torNetworkSettingWindow.header=Confirmación de red Tor
|
||||
|
@ -2152,11 +2152,11 @@ validation.NaN=El valor introducido no es válido
|
|||
validation.notAnInteger=El valor introducido no es entero
|
||||
validation.zero=El 0 no es un valor permitido.
|
||||
validation.negative=No se permiten entradas negativas.
|
||||
validation.fiat.toSmall=No se permite introducir un valor menor que el mínimo posible
|
||||
validation.fiat.toLarge=No se permiten entradas más grandes que la mayor posible.
|
||||
validation.btc.fraction=El valor introducido resulta en un valor de bitcoin menor a 1 satoshi
|
||||
validation.btc.toLarge=No se permiten valores mayores que {0}.
|
||||
validation.btc.toSmall=Valores menores que {0} no se permiten.
|
||||
validation.fiat.tooSmall=No se permite introducir un valor menor que el mínimo posible
|
||||
validation.fiat.tooLarge=No se permiten entradas más grandes que la mayor posible.
|
||||
validation.xmr.fraction=El valor introducido resulta en un valor de bitcoin menor a 1 satoshi
|
||||
validation.xmr.tooLarge=No se permiten valores mayores que {0}.
|
||||
validation.xmr.tooSmall=Valores menores que {0} no se permiten.
|
||||
validation.passwordTooShort=El password introducido es muy corto. Necesita tener al menos 8 caracteres.
|
||||
validation.passwordTooLong=La clave introducida es demasiado larga. Máximo 50 caracteres.
|
||||
validation.sortCodeNumber={0} debe consistir en {1} números.
|
||||
|
|
|
@ -1511,8 +1511,8 @@ closedTradesSummaryWindow.totalAmount.value={0} ({1} with current market price)
|
|||
closedTradesSummaryWindow.totalVolume.title=Total amount traded in {0}
|
||||
closedTradesSummaryWindow.totalMinerFee.title=Sum of all miner fees
|
||||
closedTradesSummaryWindow.totalMinerFee.value={0} ({1} of total trade amount)
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.title=Sum of all trade fees paid in BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.value={0} ({1} of total trade amount)
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.title=Sum of all trade fees paid in BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.value={0} ({1} of total trade amount)
|
||||
walletPasswordWindow.headline=وارد کردن رمز عبور به منظور باز کردن
|
||||
|
||||
torNetworkSettingWindow.header=تنظیمات شبکه Tor
|
||||
|
@ -2152,11 +2152,11 @@ validation.NaN=ورودی، یک عدد معتبر نیست.
|
|||
validation.notAnInteger=ورودی یک مقدار صحیح نیست.
|
||||
validation.zero=ورودی 0 مجاز نیست.
|
||||
validation.negative=یک مقدار منفی مجاز نیست.
|
||||
validation.fiat.toSmall=ورودی کوچکتر از حداقل مقدار ممکن مجاز نیست.
|
||||
validation.fiat.toLarge=ورودی بزرگتر از حداکثر مقدار ممکن مجاز نیست.
|
||||
validation.btc.fraction=Input will result in a bitcoin value of less than 1 satoshi
|
||||
validation.btc.toLarge=ورودی بزرگتر از {0} مجاز نیست.
|
||||
validation.btc.toSmall=ورودی کوچکتر از {0} مجاز نیست.
|
||||
validation.fiat.tooSmall=ورودی کوچکتر از حداقل مقدار ممکن مجاز نیست.
|
||||
validation.fiat.tooLarge=ورودی بزرگتر از حداکثر مقدار ممکن مجاز نیست.
|
||||
validation.xmr.fraction=Input will result in a bitcoin value of less than 1 satoshi
|
||||
validation.xmr.tooLarge=ورودی بزرگتر از {0} مجاز نیست.
|
||||
validation.xmr.tooSmall=ورودی کوچکتر از {0} مجاز نیست.
|
||||
validation.passwordTooShort=The password you entered is too short. It needs to have a min. of 8 characters.
|
||||
validation.passwordTooLong=رمز عبور که شما وارد کرده اید خیلی طولانی است.رمز عبور بیش از 50 کاراکتر نمی تواند باشد.
|
||||
validation.sortCodeNumber={0} باید شامل {1} عدد باشد.
|
||||
|
|
|
@ -1512,8 +1512,8 @@ closedTradesSummaryWindow.totalAmount.value={0} ({1} avec le prix courant du mar
|
|||
closedTradesSummaryWindow.totalVolume.title=Montant total échangé en {0}
|
||||
closedTradesSummaryWindow.totalMinerFee.title=Somme de tous les frais de mineur
|
||||
closedTradesSummaryWindow.totalMinerFee.value={0} ({1} du montant total du trade)
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.title=Somme de tous les frais de trade payés en BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.value={0} ({1} du montant total du trade)
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.title=Somme de tous les frais de trade payés en BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.value={0} ({1} du montant total du trade)
|
||||
walletPasswordWindow.headline=Entrer le mot de passe pour déverouiller
|
||||
|
||||
torNetworkSettingWindow.header=Paramètres du réseau Tor
|
||||
|
@ -2153,11 +2153,11 @@ validation.NaN=La valeur saisie n'est pas un nombre valide.
|
|||
validation.notAnInteger=Input is not an integer value.
|
||||
validation.zero=La saisie d'une valeur égale à 0 n'est pas autorisé.
|
||||
validation.negative=Une valeur négative n'est pas autorisée.
|
||||
validation.fiat.toSmall=La saisie d'une valeur plus petite que le montant minimal possible n'est pas autorisée.
|
||||
validation.fiat.toLarge=La saisie d'une valeur supérieure au montant maximal possible n'est pas autorisée.
|
||||
validation.btc.fraction=L'entrée résultera dans une valeur bitcoin plus petite qu'1 satoshi
|
||||
validation.btc.toLarge=La saisie d''une valeur supérieure à {0} n''est pas autorisée.
|
||||
validation.btc.toSmall=La saisie d''une valeur inférieure à {0} n''est pas autorisée.
|
||||
validation.fiat.tooSmall=La saisie d'une valeur plus petite que le montant minimal possible n'est pas autorisée.
|
||||
validation.fiat.tooLarge=La saisie d'une valeur supérieure au montant maximal possible n'est pas autorisée.
|
||||
validation.xmr.fraction=L'entrée résultera dans une valeur bitcoin plus petite qu'1 satoshi
|
||||
validation.xmr.tooLarge=La saisie d''une valeur supérieure à {0} n''est pas autorisée.
|
||||
validation.xmr.tooSmall=La saisie d''une valeur inférieure à {0} n''est pas autorisée.
|
||||
validation.passwordTooShort=Le mot de passe que vous avez saisi est trop court. Il doit comporter un minimum de 8 caractères.
|
||||
validation.passwordTooLong=Le mot de passe que vous avez saisi est trop long. Il ne doit pas contenir plus de 50 caractères.
|
||||
validation.sortCodeNumber={0} doit être composer de {1} chiffres.
|
||||
|
|
|
@ -1511,8 +1511,8 @@ closedTradesSummaryWindow.totalAmount.value={0} ({1} with current market price)
|
|||
closedTradesSummaryWindow.totalVolume.title=Total amount traded in {0}
|
||||
closedTradesSummaryWindow.totalMinerFee.title=Sum of all miner fees
|
||||
closedTradesSummaryWindow.totalMinerFee.value={0} ({1} of total trade amount)
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.title=Sum of all trade fees paid in BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.value={0} ({1} of total trade amount)
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.title=Sum of all trade fees paid in BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.value={0} ({1} of total trade amount)
|
||||
walletPasswordWindow.headline=Inserisci la password per sbloccare
|
||||
|
||||
torNetworkSettingWindow.header=Impostazioni rete Tor
|
||||
|
@ -2152,11 +2152,11 @@ validation.NaN=L'input non è un numero valido.
|
|||
validation.notAnInteger=L'input non è un valore intero.
|
||||
validation.zero=Un input di 0 non è consentito.
|
||||
validation.negative=Un valore negativo non è consentito.
|
||||
validation.fiat.toSmall=Non è consentito un input inferiore al minimo possibile.
|
||||
validation.fiat.toLarge=Non è consentito un input maggiore del massimo possibile.
|
||||
validation.btc.fraction=Input will result in a bitcoin value of less than 1 satoshi
|
||||
validation.btc.toLarge=L'immissione maggiore di {0} non è consentita.
|
||||
validation.btc.toSmall=L'immissione inferiore a {0} non è consentita.
|
||||
validation.fiat.tooSmall=Non è consentito un input inferiore al minimo possibile.
|
||||
validation.fiat.tooLarge=Non è consentito un input maggiore del massimo possibile.
|
||||
validation.xmr.fraction=Input will result in a bitcoin value of less than 1 satoshi
|
||||
validation.xmr.tooLarge=L'immissione maggiore di {0} non è consentita.
|
||||
validation.xmr.tooSmall=L'immissione inferiore a {0} non è consentita.
|
||||
validation.passwordTooShort=The password you entered is too short. It needs to have a min. of 8 characters.
|
||||
validation.passwordTooLong=La password inserita è troppo lunga. Non può contenere più di 50 caratteri.
|
||||
validation.sortCodeNumber={0} deve essere composto da {1} numeri.
|
||||
|
|
|
@ -1511,8 +1511,8 @@ closedTradesSummaryWindow.totalAmount.value={0} ({1} with current market price)
|
|||
closedTradesSummaryWindow.totalVolume.title=Total amount traded in {0}
|
||||
closedTradesSummaryWindow.totalMinerFee.title=Sum of all miner fees
|
||||
closedTradesSummaryWindow.totalMinerFee.value={0} ({1} of total trade amount)
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.title=Sum of all trade fees paid in BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.value={0} ({1} of total trade amount)
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.title=Sum of all trade fees paid in BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.value={0} ({1} of total trade amount)
|
||||
walletPasswordWindow.headline=アンロックするためにパスワードを入力してください
|
||||
|
||||
torNetworkSettingWindow.header=Torネットワークの設定
|
||||
|
@ -2152,11 +2152,11 @@ validation.NaN=入力が不正な数です。
|
|||
validation.notAnInteger=入力が整数値ではありません。
|
||||
validation.zero=0の入力は許可されていません。
|
||||
validation.negative=負の値は許可されていません。
|
||||
validation.fiat.toSmall=可能な最小量より小さい入力は許可されていません。
|
||||
validation.fiat.toLarge=可能な最大量より大きい入力は許可されていません。
|
||||
validation.btc.fraction=この入力では1サトシ以下のビットコイン値が生成されます。
|
||||
validation.btc.toLarge={0}より大きい入力は許可されていません。
|
||||
validation.btc.toSmall={0}より小さい入力は許可されていません。
|
||||
validation.fiat.tooSmall=可能な最小量より小さい入力は許可されていません。
|
||||
validation.fiat.tooLarge=可能な最大量より大きい入力は許可されていません。
|
||||
validation.xmr.fraction=この入力では1サトシ以下のビットコイン値が生成されます。
|
||||
validation.xmr.tooLarge={0}より大きい入力は許可されていません。
|
||||
validation.xmr.tooSmall={0}より小さい入力は許可されていません。
|
||||
validation.passwordTooShort=入力したパスワードが短すぎます。最低8文字が必要です。
|
||||
validation.passwordTooLong=入力したパスワードが長すぎます。 50文字を超えることはできません。
|
||||
validation.sortCodeNumber={0}は{1}個の数字で構成されている必要があります。
|
||||
|
|
|
@ -1516,8 +1516,8 @@ closedTradesSummaryWindow.totalAmount.value={0} ({1} with current market price)
|
|||
closedTradesSummaryWindow.totalVolume.title=Total amount traded in {0}
|
||||
closedTradesSummaryWindow.totalMinerFee.title=Sum of all miner fees
|
||||
closedTradesSummaryWindow.totalMinerFee.value={0} ({1} of total trade amount)
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.title=Sum of all trade fees paid in BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.value={0} ({1} of total trade amount)
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.title=Sum of all trade fees paid in BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.value={0} ({1} of total trade amount)
|
||||
|
||||
walletPasswordWindow.headline=Digite senha para abrir:
|
||||
|
||||
|
@ -2160,11 +2160,11 @@ validation.NaN=Número inválido
|
|||
validation.notAnInteger=A quantia não é um valor inteiro.
|
||||
validation.zero=Número 0 não é permitido
|
||||
validation.negative=Valores negativos não são permitidos.
|
||||
validation.fiat.toSmall=Quantia menor do que a mínima permitida.
|
||||
validation.fiat.toLarge=Quantia maior do que a máxima permitida.
|
||||
validation.btc.fraction=Input will result in a bitcoin value of less than 1 satoshi
|
||||
validation.btc.toLarge=Quantia máx. permitida: {0}
|
||||
validation.btc.toSmall=Quantia mín. permitida: {0}
|
||||
validation.fiat.tooSmall=Quantia menor do que a mínima permitida.
|
||||
validation.fiat.tooLarge=Quantia maior do que a máxima permitida.
|
||||
validation.xmr.fraction=Input will result in a bitcoin value of less than 1 satoshi
|
||||
validation.xmr.tooLarge=Quantia máx. permitida: {0}
|
||||
validation.xmr.tooSmall=Quantia mín. permitida: {0}
|
||||
validation.passwordTooShort=The password you entered is too short. It needs to have a min. of 8 characters.
|
||||
validation.passwordTooLong=A senha inserida é muito longa. Não pode ser maior do que 50 caracteres
|
||||
validation.sortCodeNumber={0} deve consistir de {1} números.
|
||||
|
|
|
@ -1509,8 +1509,8 @@ closedTradesSummaryWindow.totalAmount.value={0} ({1} with current market price)
|
|||
closedTradesSummaryWindow.totalVolume.title=Total amount traded in {0}
|
||||
closedTradesSummaryWindow.totalMinerFee.title=Sum of all miner fees
|
||||
closedTradesSummaryWindow.totalMinerFee.value={0} ({1} of total trade amount)
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.title=Sum of all trade fees paid in BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.value={0} ({1} of total trade amount)
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.title=Sum of all trade fees paid in BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.value={0} ({1} of total trade amount)
|
||||
walletPasswordWindow.headline=Digite senha para abrir:
|
||||
|
||||
torNetworkSettingWindow.header=Definições de redes Tor
|
||||
|
@ -2150,11 +2150,11 @@ validation.NaN=Número inválido
|
|||
validation.notAnInteger=O input não é um número inteiro.
|
||||
validation.zero=Número 0 não é permitido
|
||||
validation.negative=Valores negativos não são permitidos.
|
||||
validation.fiat.toSmall=Input menor do que a quantia mínima permitida.
|
||||
validation.fiat.toLarge=Input maior do que a quantia máxima permitida.
|
||||
validation.btc.fraction=Input will result in a bitcoin value of less than 1 satoshi
|
||||
validation.btc.toLarge=O input maior que {0} não é permitido.
|
||||
validation.btc.toSmall=Input menor que {0} não é permitido.
|
||||
validation.fiat.tooSmall=Input menor do que a quantia mínima permitida.
|
||||
validation.fiat.tooLarge=Input maior do que a quantia máxima permitida.
|
||||
validation.xmr.fraction=Input will result in a bitcoin value of less than 1 satoshi
|
||||
validation.xmr.tooLarge=O input maior que {0} não é permitido.
|
||||
validation.xmr.tooSmall=Input menor que {0} não é permitido.
|
||||
validation.passwordTooShort=The password you entered is too short. It needs to have a min. of 8 characters.
|
||||
validation.passwordTooLong=A senha inserida é muito longa. Não pode ser maior do que 50 caracteres.
|
||||
validation.sortCodeNumber={0} deve consistir de {1} números.
|
||||
|
|
|
@ -1511,8 +1511,8 @@ closedTradesSummaryWindow.totalAmount.value={0} ({1} with current market price)
|
|||
closedTradesSummaryWindow.totalVolume.title=Total amount traded in {0}
|
||||
closedTradesSummaryWindow.totalMinerFee.title=Sum of all miner fees
|
||||
closedTradesSummaryWindow.totalMinerFee.value={0} ({1} of total trade amount)
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.title=Sum of all trade fees paid in BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.value={0} ({1} of total trade amount)
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.title=Sum of all trade fees paid in BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.value={0} ({1} of total trade amount)
|
||||
walletPasswordWindow.headline=Введите пароль для разблокировки
|
||||
|
||||
torNetworkSettingWindow.header=Настройки сети Тоr
|
||||
|
@ -2152,11 +2152,11 @@ validation.NaN=Введённое число недопустимо.
|
|||
validation.notAnInteger=Введённое число не является целым.
|
||||
validation.zero=Введённое значение не может быть равно 0.
|
||||
validation.negative=Отрицательное значение недопустимо.
|
||||
validation.fiat.toSmall=Ввод значения меньше минимально возможного не допускается.
|
||||
validation.fiat.toLarge=Ввод значения больше максимально возможного не допускается.
|
||||
validation.btc.fraction=Input will result in a bitcoin value of less than 1 satoshi
|
||||
validation.btc.toLarge=Значение не может превышать {0}.
|
||||
validation.btc.toSmall=Значение не может быть меньше {0}.
|
||||
validation.fiat.tooSmall=Ввод значения меньше минимально возможного не допускается.
|
||||
validation.fiat.tooLarge=Ввод значения больше максимально возможного не допускается.
|
||||
validation.xmr.fraction=Input will result in a bitcoin value of less than 1 satoshi
|
||||
validation.xmr.tooLarge=Значение не может превышать {0}.
|
||||
validation.xmr.tooSmall=Значение не может быть меньше {0}.
|
||||
validation.passwordTooShort=The password you entered is too short. It needs to have a min. of 8 characters.
|
||||
validation.passwordTooLong=Введенный пароль слишком длинный. Его длина не должна превышать 50 символов.
|
||||
validation.sortCodeNumber={0} должен состоять из {1} цифр.
|
||||
|
|
|
@ -1511,8 +1511,8 @@ closedTradesSummaryWindow.totalAmount.value={0} ({1} with current market price)
|
|||
closedTradesSummaryWindow.totalVolume.title=Total amount traded in {0}
|
||||
closedTradesSummaryWindow.totalMinerFee.title=Sum of all miner fees
|
||||
closedTradesSummaryWindow.totalMinerFee.value={0} ({1} of total trade amount)
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.title=Sum of all trade fees paid in BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.value={0} ({1} of total trade amount)
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.title=Sum of all trade fees paid in BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.value={0} ({1} of total trade amount)
|
||||
walletPasswordWindow.headline=ป้อนรหัสผ่านเพื่อปลดล็อก
|
||||
|
||||
torNetworkSettingWindow.header=ตั้งค่าเครือข่าย Tor
|
||||
|
@ -2152,11 +2152,11 @@ validation.NaN=การป้อนข้อมูลไม่ใช่ตั
|
|||
validation.notAnInteger=ค่าที่ป้อนไม่ใช่ค่าจำนวนเต็ม
|
||||
validation.zero=ไม่อนุญาตให้ป้อนข้อมูลเป็น 0
|
||||
validation.negative=ไม่อนุญาตให้ใช้ค่าลบ
|
||||
validation.fiat.toSmall=ไม่อนุญาตให้ป้อนข้อมูลที่มีขนาดเล็กกว่าจำนวนเป็นไปได้ต่ำสุด
|
||||
validation.fiat.toLarge=ไม่อนุญาตให้ป้อนข้อมูลที่มีขนาดใหญ่กว่าจำนวนสูงสุดที่เป็นไปได้
|
||||
validation.btc.fraction=Input will result in a bitcoin value of less than 1 satoshi
|
||||
validation.btc.toLarge=ไม่อนุญาตให้ป้อนข้อมูลขนาดใหญ่กว่า {0}
|
||||
validation.btc.toSmall=ไม่อนุญาตให้ป้อนข้อมูลที่มีขนาดเล็กกว่า {0}
|
||||
validation.fiat.tooSmall=ไม่อนุญาตให้ป้อนข้อมูลที่มีขนาดเล็กกว่าจำนวนเป็นไปได้ต่ำสุด
|
||||
validation.fiat.tooLarge=ไม่อนุญาตให้ป้อนข้อมูลที่มีขนาดใหญ่กว่าจำนวนสูงสุดที่เป็นไปได้
|
||||
validation.xmr.fraction=Input will result in a bitcoin value of less than 1 satoshi
|
||||
validation.xmr.tooLarge=ไม่อนุญาตให้ป้อนข้อมูลขนาดใหญ่กว่า {0}
|
||||
validation.xmr.tooSmall=ไม่อนุญาตให้ป้อนข้อมูลที่มีขนาดเล็กกว่า {0}
|
||||
validation.passwordTooShort=The password you entered is too short. It needs to have a min. of 8 characters.
|
||||
validation.passwordTooLong=รหัสผ่านที่คุณป้อนยาวเกินไป ต้องมีความยาวไม่เกิน 50 ตัว
|
||||
validation.sortCodeNumber={0} ต้องประกอบด้วย {1} ตัวเลข
|
||||
|
|
|
@ -1513,8 +1513,8 @@ closedTradesSummaryWindow.totalAmount.value={0} ({1} with current market price)
|
|||
closedTradesSummaryWindow.totalVolume.title=Total amount traded in {0}
|
||||
closedTradesSummaryWindow.totalMinerFee.title=Sum of all miner fees
|
||||
closedTradesSummaryWindow.totalMinerFee.value={0} ({1} of total trade amount)
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.title=Sum of all trade fees paid in BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.value={0} ({1} of total trade amount)
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.title=Sum of all trade fees paid in BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.value={0} ({1} of total trade amount)
|
||||
walletPasswordWindow.headline=Nhập mật khẩu để mở khóa
|
||||
|
||||
torNetworkSettingWindow.header=Cài đặt mạng Tor
|
||||
|
@ -2154,11 +2154,11 @@ validation.NaN=Giá trị nhập là số không có hiệu lực.
|
|||
validation.notAnInteger=Giá trị nhập không phải là một số nguyên.
|
||||
validation.zero=Không cho phép nhập giá trị 0.
|
||||
validation.negative=Không cho phép nhập giá trị âm.
|
||||
validation.fiat.toSmall=Không cho phép giá trị nhập nhỏ hơn giá trị có thể nhỏ nhất.
|
||||
validation.fiat.toLarge=Không cho phép giá trị nhập lớn hơn giá trị có thể lớn nhất.
|
||||
validation.btc.fraction=Input will result in a bitcoin value of less than 1 satoshi
|
||||
validation.btc.toLarge=Không cho phép giá trị nhập lớn hơn {0}.
|
||||
validation.btc.toSmall=Không cho phép giá trị nhập nhỏ hơn {0}.
|
||||
validation.fiat.tooSmall=Không cho phép giá trị nhập nhỏ hơn giá trị có thể nhỏ nhất.
|
||||
validation.fiat.tooLarge=Không cho phép giá trị nhập lớn hơn giá trị có thể lớn nhất.
|
||||
validation.xmr.fraction=Input will result in a bitcoin value of less than 1 satoshi
|
||||
validation.xmr.tooLarge=Không cho phép giá trị nhập lớn hơn {0}.
|
||||
validation.xmr.tooSmall=Không cho phép giá trị nhập nhỏ hơn {0}.
|
||||
validation.passwordTooShort=The password you entered is too short. It needs to have a min. of 8 characters.
|
||||
validation.passwordTooLong=Mật khẩu bạn vừa nhập quá dài. Không được quá 50 ký tự.
|
||||
validation.sortCodeNumber={0} phải có {1} số.
|
||||
|
|
|
@ -1512,8 +1512,8 @@ closedTradesSummaryWindow.totalAmount.value={0} ({1} with current market price)
|
|||
closedTradesSummaryWindow.totalVolume.title=Total amount traded in {0}
|
||||
closedTradesSummaryWindow.totalMinerFee.title=Sum of all miner fees
|
||||
closedTradesSummaryWindow.totalMinerFee.value={0} ({1} of total trade amount)
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.title=Sum of all trade fees paid in BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.value={0} ({1} of total trade amount)
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.title=Sum of all trade fees paid in BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.value={0} ({1} of total trade amount)
|
||||
|
||||
walletPasswordWindow.headline=输入密码解锁
|
||||
|
||||
|
@ -2156,11 +2156,11 @@ validation.NaN=输入的不是有效数字。
|
|||
validation.notAnInteger=输入的不是整数。
|
||||
validation.zero=不允许输入0。
|
||||
validation.negative=不允许输入负值。
|
||||
validation.fiat.toSmall=不允许输入比最小可能值还小的数值。
|
||||
validation.fiat.toLarge=不允许输入比最大可能值还大的数值。
|
||||
validation.btc.fraction=此充值将会产生小于 1 聪的比特币数量。
|
||||
validation.btc.toLarge=不允许充值大于{0}
|
||||
validation.btc.toSmall=不允许充值小于{0}
|
||||
validation.fiat.tooSmall=不允许输入比最小可能值还小的数值。
|
||||
validation.fiat.tooLarge=不允许输入比最大可能值还大的数值。
|
||||
validation.xmr.fraction=此充值将会产生小于 1 聪的比特币数量。
|
||||
validation.xmr.tooLarge=不允许充值大于{0}
|
||||
validation.xmr.tooSmall=不允许充值小于{0}
|
||||
validation.passwordTooShort=你输入的密码太短。最少 8 个字符。
|
||||
validation.passwordTooLong=你输入的密码太长。最长不要超过50个字符。
|
||||
validation.sortCodeNumber={0} 必须由 {1} 个数字构成。
|
||||
|
|
|
@ -1512,8 +1512,8 @@ closedTradesSummaryWindow.totalAmount.value={0} ({1} with current market price)
|
|||
closedTradesSummaryWindow.totalVolume.title=Total amount traded in {0}
|
||||
closedTradesSummaryWindow.totalMinerFee.title=Sum of all miner fees
|
||||
closedTradesSummaryWindow.totalMinerFee.value={0} ({1} of total trade amount)
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.title=Sum of all trade fees paid in BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInBtc.value={0} ({1} of total trade amount)
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.title=Sum of all trade fees paid in BTC
|
||||
closedTradesSummaryWindow.totalTradeFeeInXmr.value={0} ({1} of total trade amount)
|
||||
walletPasswordWindow.headline=輸入密碼解鎖
|
||||
|
||||
torNetworkSettingWindow.header=Tor 網絡設置
|
||||
|
@ -2152,11 +2152,11 @@ validation.NaN=輸入的不是有效數字。
|
|||
validation.notAnInteger=輸入的不是整數。
|
||||
validation.zero=不允許輸入0。
|
||||
validation.negative=不允許輸入負值。
|
||||
validation.fiat.toSmall=不允許輸入比最小可能值還小的數值。
|
||||
validation.fiat.toLarge=不允許輸入比最大可能值還大的數值。
|
||||
validation.btc.fraction=此充值將會產生小於 1 聰的比特幣數量。
|
||||
validation.btc.toLarge=不允許充值大於{0}
|
||||
validation.btc.toSmall=不允許充值小於{0}
|
||||
validation.fiat.tooSmall=不允許輸入比最小可能值還小的數值。
|
||||
validation.fiat.tooLarge=不允許輸入比最大可能值還大的數值。
|
||||
validation.xmr.fraction=此充值將會產生小於 1 聰的比特幣數量。
|
||||
validation.xmr.tooLarge=不允許充值大於{0}
|
||||
validation.xmr.tooSmall=不允許充值小於{0}
|
||||
validation.passwordTooShort=你輸入的密碼太短。最少 8 個字符。
|
||||
validation.passwordTooLong=你輸入的密碼太長。最長不要超過50個字符。
|
||||
validation.sortCodeNumber={0} 必須由 {1} 個數字構成。
|
||||
|
|
|
@ -67,8 +67,8 @@ public class CoinUtilTest {
|
|||
1);
|
||||
assertEquals(
|
||||
"Minimum trade amount allowed should be adjusted to the smallest trade allowed.",
|
||||
HavenoUtils.formatToXmrWithCode(Restrictions.MIN_TRADE_AMOUNT),
|
||||
HavenoUtils.formatToXmrWithCode(result)
|
||||
HavenoUtils.formatXmr(Restrictions.MIN_TRADE_AMOUNT, true),
|
||||
HavenoUtils.formatXmr(result, true)
|
||||
);
|
||||
|
||||
try {
|
||||
|
@ -94,7 +94,7 @@ public class CoinUtilTest {
|
|||
assertEquals(
|
||||
"Minimum allowed trade amount should not be adjusted.",
|
||||
"0.10 XMR",
|
||||
HavenoUtils.formatToXmrWithCode(result)
|
||||
HavenoUtils.formatXmr(result, true)
|
||||
);
|
||||
|
||||
result = CoinUtil.getAdjustedAmount(
|
||||
|
@ -105,7 +105,7 @@ public class CoinUtilTest {
|
|||
assertEquals(
|
||||
"Minimum trade amount allowed should respect maxTradeLimit and factor, if possible.",
|
||||
"0.10 XMR",
|
||||
HavenoUtils.formatToXmrWithCode(result)
|
||||
HavenoUtils.formatXmr(result, true)
|
||||
);
|
||||
|
||||
// TODO(chirhonul): The following seems like it should raise an exception or otherwise fail.
|
||||
|
@ -121,7 +121,7 @@ public class CoinUtilTest {
|
|||
assertEquals(
|
||||
"Minimum trade amount allowed with low maxTradeLimit should still respect that limit, even if result does not respect the factor specified.",
|
||||
"0.00005 XMR",
|
||||
HavenoUtils.formatToXmrWithCode(result)
|
||||
HavenoUtils.formatXmr(result, true)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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"))
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@ class TransactionsListItem {
|
|||
}
|
||||
|
||||
public String getAmountStr() {
|
||||
return HavenoUtils.formatToXmr(amount);
|
||||
return HavenoUtils.formatXmr(amount);
|
||||
}
|
||||
|
||||
public BigInteger getAmount() {
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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)));
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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(),
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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()));
|
||||
|
|
|
@ -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")
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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());
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
)
|
||||
|
|
|
@ -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 "";
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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 "";
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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: ")
|
||||
|
|
|
@ -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("");
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue