Allow clients to pass empty string for minAmount param

This commit is contained in:
ghubstan 2022-02-26 17:43:17 -03:00
parent b904002991
commit c20f2568d4
No known key found for this signature in database
GPG Key ID: E35592D6800A861E

View File

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