Merge branch '7-more-grpcproto-comments' into 8-remove-trdstats-service

This commit is contained in:
ghubstan 2022-02-26 17:53:04 -03:00
commit a1f059ded4
No known key found for this signature in database
GPG Key ID: E35592D6800A861E
3 changed files with 7 additions and 7 deletions

View File

@ -204,7 +204,7 @@ public class CoreApi {
Consumer<Offer> resultHandler) { Consumer<Offer> resultHandler) {
coreOffersService.createAndPlaceOffer(currencyCode, coreOffersService.createAndPlaceOffer(currencyCode,
directionAsString, directionAsString,
price, useMarketBasedPrice ? "0" : price,
useMarketBasedPrice, useMarketBasedPrice,
marketPriceMargin, marketPriceMargin,
amountAsLong, amountAsLong,

View File

@ -259,7 +259,7 @@ class CoreOffersService {
String offerId = getRandomOfferId(); String offerId = getRandomOfferId();
OfferDirection direction = OfferDirection.valueOf(directionAsString.toUpperCase()); OfferDirection direction = OfferDirection.valueOf(directionAsString.toUpperCase());
Coin amount = Coin.valueOf(amountAsLong); Coin amount = Coin.valueOf(amountAsLong);
Coin minAmount = Coin.valueOf(minAmountAsLong); Coin minAmount = minAmountAsLong == 0 ? amount : Coin.valueOf(minAmountAsLong);
Price price = Price.valueOf(currencyCode, priceStringToLong(priceAsString, currencyCode)); Price price = Price.valueOf(currencyCode, priceStringToLong(priceAsString, currencyCode));
openBsqSwapOfferService.requestNewOffer(offerId, openBsqSwapOfferService.requestNewOffer(offerId,
direction, direction,
@ -294,7 +294,7 @@ class CoreOffersService {
OfferDirection direction = OfferDirection.valueOf(directionAsString.toUpperCase()); OfferDirection direction = OfferDirection.valueOf(directionAsString.toUpperCase());
Price price = Price.valueOf(upperCaseCurrencyCode, priceStringToLong(priceAsString, upperCaseCurrencyCode)); Price price = Price.valueOf(upperCaseCurrencyCode, priceStringToLong(priceAsString, upperCaseCurrencyCode));
Coin amount = Coin.valueOf(amountAsLong); Coin amount = Coin.valueOf(amountAsLong);
Coin minAmount = Coin.valueOf(minAmountAsLong); Coin minAmount = minAmountAsLong == 0 ? amount : Coin.valueOf(minAmountAsLong);
Coin useDefaultTxFee = Coin.ZERO; Coin useDefaultTxFee = Coin.ZERO;
// Almost ready to call createOfferService.createAndGetOffer(), but first: // Almost ready to call createOfferService.createAndGetOffer(), but first:

View File

@ -68,7 +68,7 @@ class EditOfferValidator {
int newEnable, int newEnable,
EditOfferRequest.EditType editType) { EditOfferRequest.EditType editType) {
this.currentlyOpenOffer = currentlyOpenOffer; this.currentlyOpenOffer = currentlyOpenOffer;
this.newPrice = newPrice; this.newPrice = newPrice.isBlank() ? "0" : newPrice;
// The client cannot determine what offer.isUseMarketBasedPrice should be // The client cannot determine what offer.isUseMarketBasedPrice should be
// when editType = ACTIVATION_STATE_ONLY. Override newIsUseMarketBasedPrice // when editType = ACTIVATION_STATE_ONLY. Override newIsUseMarketBasedPrice
// param for the ACTIVATION_STATE_ONLY case. // param for the ACTIVATION_STATE_ONLY case.
@ -78,12 +78,12 @@ class EditOfferValidator {
? currentlyOpenOffer.getOffer().isUseMarketBasedPrice() ? currentlyOpenOffer.getOffer().isUseMarketBasedPrice()
: newIsUseMarketBasedPrice; : newIsUseMarketBasedPrice;
this.newMarketPriceMargin = newMarketPriceMargin; this.newMarketPriceMargin = newMarketPriceMargin;
this.newTriggerPrice = newTriggerPrice; this.newTriggerPrice = newTriggerPrice.isBlank() ? "0" : newTriggerPrice;
this.newEnable = newEnable; this.newEnable = newEnable;
this.editType = editType; this.editType = editType;
this.isZeroEditedFixedPriceString = new BigDecimal(newPrice).doubleValue() == 0; this.isZeroEditedFixedPriceString = new BigDecimal(this.newPrice).doubleValue() == 0;
this.isZeroEditedTriggerPrice = new BigDecimal(newTriggerPrice).equals(ZERO); this.isZeroEditedTriggerPrice = new BigDecimal(this.newTriggerPrice).equals(ZERO);
} }
EditOfferValidator validate() { EditOfferValidator validate() {