mirror of
https://github.com/boldsuck/haveno.git
synced 2024-12-22 20:19:21 +00:00
trigger price handled as string, same as price
This commit is contained in:
parent
9d4ec0a532
commit
c2f5adac9b
23 changed files with 46 additions and 54 deletions
|
@ -432,7 +432,7 @@ public class CoreApi {
|
|||
long amountAsLong,
|
||||
long minAmountAsLong,
|
||||
double buyerSecurityDeposit,
|
||||
long triggerPrice,
|
||||
String triggerPriceAsString,
|
||||
String paymentAccountId,
|
||||
Consumer<Offer> resultHandler,
|
||||
ErrorMessageHandler errorMessageHandler) {
|
||||
|
@ -444,7 +444,7 @@ public class CoreApi {
|
|||
amountAsLong,
|
||||
minAmountAsLong,
|
||||
buyerSecurityDeposit,
|
||||
triggerPrice,
|
||||
triggerPriceAsString,
|
||||
paymentAccountId,
|
||||
resultHandler,
|
||||
errorMessageHandler);
|
||||
|
|
|
@ -30,7 +30,7 @@ import bisq.core.offer.OpenOffer;
|
|||
import bisq.core.offer.OpenOfferManager;
|
||||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.user.User;
|
||||
|
||||
import bisq.core.util.PriceUtil;
|
||||
import bisq.common.crypto.KeyRing;
|
||||
import bisq.common.handlers.ErrorMessageHandler;
|
||||
import org.bitcoinj.core.Coin;
|
||||
|
@ -176,7 +176,7 @@ class CoreOffersService {
|
|||
for (Offer offer : offers) {
|
||||
for (String keyImage : offer.getOfferPayload().getReserveTxKeyImages()) {
|
||||
if (!allKeyImages.add(keyImage)) {
|
||||
log.warn("Key image {} belongs to another offer, removing offer {}", keyImage, offer.getId());
|
||||
log.warn("Key image {} belongs to another offer, removing offer {}", keyImage, offer.getId()); // TODO (woodser): this is list, not set, so not checking for duplicates
|
||||
unreservedOffers.add(offer);
|
||||
}
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ class CoreOffersService {
|
|||
long amountAsLong,
|
||||
long minAmountAsLong,
|
||||
double buyerSecurityDeposit,
|
||||
long triggerPrice,
|
||||
String triggerPriceAsString,
|
||||
String paymentAccountId,
|
||||
Consumer<Offer> resultHandler,
|
||||
ErrorMessageHandler errorMessageHandler) {
|
||||
|
@ -257,7 +257,7 @@ class CoreOffersService {
|
|||
//noinspection ConstantConditions
|
||||
placeOffer(offer,
|
||||
buyerSecurityDeposit,
|
||||
triggerPrice,
|
||||
triggerPriceAsString,
|
||||
useSavingsWallet,
|
||||
transaction -> resultHandler.accept(offer),
|
||||
errorMessageHandler);
|
||||
|
@ -309,14 +309,15 @@ class CoreOffersService {
|
|||
|
||||
private void placeOffer(Offer offer,
|
||||
double buyerSecurityDeposit,
|
||||
long triggerPrice,
|
||||
String triggerPriceAsString,
|
||||
boolean useSavingsWallet,
|
||||
Consumer<Transaction> resultHandler,
|
||||
ErrorMessageHandler errorMessageHandler) {
|
||||
long triggerPriceAsLong = PriceUtil.getMarketPriceAsLong(triggerPriceAsString, offer.getCurrencyCode());
|
||||
openOfferManager.placeOffer(offer,
|
||||
buyerSecurityDeposit,
|
||||
useSavingsWallet,
|
||||
triggerPrice,
|
||||
triggerPriceAsLong,
|
||||
resultHandler::accept,
|
||||
errorMessageHandler);
|
||||
}
|
||||
|
|
|
@ -75,6 +75,8 @@ public class ValidateOffer extends Task<PlaceOfferModel> {
|
|||
|
||||
checkArgument(offer.getDate().getTime() > 0,
|
||||
"Date must not be 0. date=" + offer.getDate().toString());
|
||||
|
||||
System.out.println("OFFER PRICE: " + offer.getPrice());
|
||||
|
||||
checkNotNull(offer.getCurrencyCode(), "Currency is null");
|
||||
checkNotNull(offer.getDirection(), "Direction is null");
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.desktop.main;
|
||||
package bisq.core.util;
|
||||
|
||||
import bisq.desktop.util.validation.AltcoinValidator;
|
||||
import bisq.desktop.util.validation.FiatPriceValidator;
|
||||
import bisq.desktop.util.validation.MonetaryValidator;
|
||||
import bisq.core.util.validation.AltcoinValidator;
|
||||
import bisq.core.util.validation.FiatPriceValidator;
|
||||
import bisq.core.util.validation.MonetaryValidator;
|
||||
|
||||
import bisq.core.locale.CurrencyUtil;
|
||||
import bisq.core.locale.Res;
|
||||
|
@ -31,8 +31,6 @@ import bisq.core.provider.price.MarketPrice;
|
|||
import bisq.core.provider.price.PriceFeedService;
|
||||
import bisq.core.trade.statistics.TradeStatisticsManager;
|
||||
import bisq.core.user.Preferences;
|
||||
import bisq.core.util.FormattingUtils;
|
||||
import bisq.core.util.ParsingUtils;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
import bisq.common.util.MathUtils;
|
||||
|
@ -41,14 +39,12 @@ import org.bitcoinj.utils.Fiat;
|
|||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import static bisq.desktop.main.shared.ChatView.log;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
@Slf4j
|
||||
@Singleton
|
||||
public class PriceUtil {
|
||||
private final PriceFeedService priceFeedService;
|
|
@ -15,7 +15,7 @@
|
|||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.desktop.util.validation;
|
||||
package bisq.core.util.validation;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.desktop.util.validation;
|
||||
package bisq.core.util.validation;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
|
@ -15,10 +15,9 @@
|
|||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.desktop.util.validation;
|
||||
package bisq.core.util.validation;
|
||||
|
||||
import bisq.core.locale.Res;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
public abstract class MonetaryValidator extends NumberValidator {
|
|
@ -15,11 +15,10 @@
|
|||
* along with Haveno. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.desktop.util.validation;
|
||||
package bisq.core.util.validation;
|
||||
|
||||
import bisq.core.locale.Res;
|
||||
import bisq.core.util.ParsingUtils;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
/**
|
||||
* NumberValidator for validating basic number values.
|
|
@ -21,13 +21,10 @@ import bisq.desktop.common.view.ActivatableView;
|
|||
import bisq.desktop.common.view.FxmlView;
|
||||
import bisq.desktop.components.InfoInputTextField;
|
||||
import bisq.desktop.components.InputTextField;
|
||||
import bisq.desktop.main.PriceUtil;
|
||||
import bisq.desktop.main.overlays.popups.Popup;
|
||||
import bisq.desktop.util.FormBuilder;
|
||||
import bisq.desktop.util.GUIUtil;
|
||||
import bisq.desktop.util.Layout;
|
||||
import bisq.desktop.util.validation.AltcoinValidator;
|
||||
import bisq.desktop.util.validation.FiatPriceValidator;
|
||||
import bisq.desktop.util.validation.PercentageNumberValidator;
|
||||
|
||||
import bisq.core.locale.CurrencyUtil;
|
||||
|
@ -48,6 +45,9 @@ import bisq.core.user.Preferences;
|
|||
import bisq.core.user.User;
|
||||
import bisq.core.util.FormattingUtils;
|
||||
import bisq.core.util.ParsingUtils;
|
||||
import bisq.core.util.PriceUtil;
|
||||
import bisq.core.util.validation.AltcoinValidator;
|
||||
import bisq.core.util.validation.FiatPriceValidator;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
import bisq.common.UserThread;
|
||||
|
|
|
@ -20,7 +20,6 @@ package bisq.desktop.main.offer;
|
|||
import bisq.desktop.Navigation;
|
||||
import bisq.desktop.common.model.ActivatableWithDataModel;
|
||||
import bisq.desktop.main.MainView;
|
||||
import bisq.desktop.main.PriceUtil;
|
||||
import bisq.desktop.main.funds.FundsView;
|
||||
import bisq.desktop.main.funds.deposit.DepositView;
|
||||
import bisq.desktop.main.overlays.popups.Popup;
|
||||
|
@ -28,11 +27,8 @@ import bisq.desktop.main.settings.SettingsView;
|
|||
import bisq.desktop.main.settings.preferences.PreferencesView;
|
||||
import bisq.desktop.util.DisplayUtils;
|
||||
import bisq.desktop.util.GUIUtil;
|
||||
import bisq.desktop.util.validation.AltcoinValidator;
|
||||
import bisq.desktop.util.validation.BtcValidator;
|
||||
import bisq.desktop.util.validation.FiatPriceValidator;
|
||||
import bisq.desktop.util.validation.FiatVolumeValidator;
|
||||
import bisq.desktop.util.validation.MonetaryValidator;
|
||||
import bisq.desktop.util.validation.SecurityDepositValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
|
@ -55,11 +51,14 @@ import bisq.core.provider.price.PriceFeedService;
|
|||
import bisq.core.user.Preferences;
|
||||
import bisq.core.util.FormattingUtils;
|
||||
import bisq.core.util.ParsingUtils;
|
||||
import bisq.core.util.PriceUtil;
|
||||
import bisq.core.util.VolumeUtil;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.coin.CoinUtil;
|
||||
import bisq.core.util.validation.AltcoinValidator;
|
||||
import bisq.core.util.validation.FiatPriceValidator;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
import bisq.core.util.validation.MonetaryValidator;
|
||||
import bisq.common.Timer;
|
||||
import bisq.common.UserThread;
|
||||
import bisq.common.app.DevEnv;
|
||||
|
|
|
@ -20,9 +20,7 @@ package bisq.desktop.main.offer.createoffer;
|
|||
import bisq.desktop.Navigation;
|
||||
import bisq.desktop.common.model.ViewModel;
|
||||
import bisq.desktop.main.offer.MutableOfferViewModel;
|
||||
import bisq.desktop.util.validation.AltcoinValidator;
|
||||
import bisq.desktop.util.validation.BtcValidator;
|
||||
import bisq.desktop.util.validation.FiatPriceValidator;
|
||||
import bisq.desktop.util.validation.FiatVolumeValidator;
|
||||
import bisq.desktop.util.validation.SecurityDepositValidator;
|
||||
|
||||
|
@ -32,7 +30,8 @@ import bisq.core.provider.price.PriceFeedService;
|
|||
import bisq.core.user.Preferences;
|
||||
import bisq.core.util.FormattingUtils;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
|
||||
import bisq.core.util.validation.AltcoinValidator;
|
||||
import bisq.core.util.validation.FiatPriceValidator;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import javax.inject.Named;
|
||||
|
|
|
@ -20,7 +20,6 @@ package bisq.desktop.main.offer.offerbook;
|
|||
import bisq.desktop.Navigation;
|
||||
import bisq.desktop.common.model.ActivatableViewModel;
|
||||
import bisq.desktop.main.MainView;
|
||||
import bisq.desktop.main.PriceUtil;
|
||||
import bisq.desktop.main.settings.SettingsView;
|
||||
import bisq.desktop.main.settings.preferences.PreferencesView;
|
||||
import bisq.desktop.util.DisplayUtils;
|
||||
|
@ -50,6 +49,7 @@ import bisq.core.trade.closed.ClosedTradableManager;
|
|||
import bisq.core.user.Preferences;
|
||||
import bisq.core.user.User;
|
||||
import bisq.core.util.FormattingUtils;
|
||||
import bisq.core.util.PriceUtil;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
|
||||
import bisq.network.p2p.NodeAddress;
|
||||
|
|
|
@ -18,8 +18,6 @@
|
|||
package bisq.desktop.main.portfolio.closedtrades;
|
||||
|
||||
import bisq.desktop.common.model.ActivatableDataModel;
|
||||
import bisq.desktop.main.PriceUtil;
|
||||
|
||||
import bisq.core.monetary.Price;
|
||||
import bisq.core.monetary.Volume;
|
||||
import bisq.core.offer.Offer;
|
||||
|
@ -32,6 +30,7 @@ import bisq.core.trade.Trade;
|
|||
import bisq.core.trade.closed.ClosedTradableManager;
|
||||
import bisq.core.trade.statistics.TradeStatisticsManager;
|
||||
import bisq.core.user.Preferences;
|
||||
import bisq.core.util.PriceUtil;
|
||||
import bisq.core.util.VolumeUtil;
|
||||
|
||||
import bisq.common.util.Tuple2;
|
||||
|
|
|
@ -19,9 +19,7 @@ package bisq.desktop.main.portfolio.duplicateoffer;
|
|||
|
||||
import bisq.desktop.Navigation;
|
||||
import bisq.desktop.main.offer.MutableOfferViewModel;
|
||||
import bisq.desktop.util.validation.AltcoinValidator;
|
||||
import bisq.desktop.util.validation.BtcValidator;
|
||||
import bisq.desktop.util.validation.FiatPriceValidator;
|
||||
import bisq.desktop.util.validation.FiatVolumeValidator;
|
||||
import bisq.desktop.util.validation.SecurityDepositValidator;
|
||||
|
||||
|
@ -33,7 +31,8 @@ import bisq.core.provider.price.PriceFeedService;
|
|||
import bisq.core.user.Preferences;
|
||||
import bisq.core.util.FormattingUtils;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
|
||||
import bisq.core.util.validation.AltcoinValidator;
|
||||
import bisq.core.util.validation.FiatPriceValidator;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import javax.inject.Named;
|
||||
|
|
|
@ -18,11 +18,8 @@
|
|||
package bisq.desktop.main.portfolio.editoffer;
|
||||
|
||||
import bisq.desktop.Navigation;
|
||||
import bisq.desktop.main.PriceUtil;
|
||||
import bisq.desktop.main.offer.MutableOfferViewModel;
|
||||
import bisq.desktop.util.validation.AltcoinValidator;
|
||||
import bisq.desktop.util.validation.BtcValidator;
|
||||
import bisq.desktop.util.validation.FiatPriceValidator;
|
||||
import bisq.desktop.util.validation.FiatVolumeValidator;
|
||||
import bisq.desktop.util.validation.SecurityDepositValidator;
|
||||
|
||||
|
@ -32,8 +29,10 @@ import bisq.core.offer.OpenOffer;
|
|||
import bisq.core.provider.price.PriceFeedService;
|
||||
import bisq.core.user.Preferences;
|
||||
import bisq.core.util.FormattingUtils;
|
||||
import bisq.core.util.PriceUtil;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
|
||||
import bisq.core.util.validation.AltcoinValidator;
|
||||
import bisq.core.util.validation.FiatPriceValidator;
|
||||
import bisq.common.handlers.ErrorMessageHandler;
|
||||
import bisq.common.handlers.ResultHandler;
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ package bisq.desktop.main.portfolio.openoffer;
|
|||
|
||||
import bisq.desktop.common.model.ActivatableWithDataModel;
|
||||
import bisq.desktop.common.model.ViewModel;
|
||||
import bisq.desktop.main.PriceUtil;
|
||||
import bisq.desktop.util.DisplayUtils;
|
||||
import bisq.desktop.util.GUIUtil;
|
||||
|
||||
|
@ -29,6 +28,7 @@ import bisq.core.monetary.Price;
|
|||
import bisq.core.offer.Offer;
|
||||
import bisq.core.offer.OpenOffer;
|
||||
import bisq.core.util.FormattingUtils;
|
||||
import bisq.core.util.PriceUtil;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
|
||||
import bisq.network.p2p.P2PService;
|
||||
|
|
|
@ -21,7 +21,7 @@ import bisq.core.btc.wallet.Restrictions;
|
|||
import bisq.core.locale.Res;
|
||||
import bisq.core.util.FormattingUtils;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
|
||||
import bisq.core.util.validation.NumberValidator;
|
||||
import org.bitcoinj.core.Coin;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package bisq.desktop.util.validation;
|
||||
|
||||
import bisq.core.util.validation.MonetaryValidator;
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class FiatVolumeValidator extends MonetaryValidator {
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
package bisq.desktop.util.validation;
|
||||
|
||||
import bisq.core.locale.Res;
|
||||
|
||||
import bisq.core.util.validation.NumberValidator;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
|
|
@ -22,7 +22,7 @@ import bisq.core.locale.Res;
|
|||
import bisq.core.payment.PaymentAccount;
|
||||
import bisq.core.util.FormattingUtils;
|
||||
import bisq.core.util.ParsingUtils;
|
||||
|
||||
import bisq.core.util.validation.NumberValidator;
|
||||
import javax.inject.Inject;
|
||||
|
||||
public class SecurityDepositValidator extends NumberValidator {
|
||||
|
|
|
@ -17,9 +17,7 @@
|
|||
|
||||
package bisq.desktop.main.offer.createoffer;
|
||||
|
||||
import bisq.desktop.util.validation.AltcoinValidator;
|
||||
import bisq.desktop.util.validation.BtcValidator;
|
||||
import bisq.desktop.util.validation.FiatPriceValidator;
|
||||
import bisq.desktop.util.validation.SecurityDepositValidator;
|
||||
|
||||
import bisq.core.account.witness.AccountAgeWitnessService;
|
||||
|
@ -42,6 +40,8 @@ import bisq.core.user.Preferences;
|
|||
import bisq.core.user.User;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.coin.ImmutableCoinFormatter;
|
||||
import bisq.core.util.validation.AltcoinValidator;
|
||||
import bisq.core.util.validation.FiatPriceValidator;
|
||||
import bisq.core.util.validation.InputValidator;
|
||||
|
||||
import bisq.common.config.Config;
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
package bisq.desktop.main.offer.offerbook;
|
||||
|
||||
import bisq.desktop.main.PriceUtil;
|
||||
|
||||
import bisq.core.locale.Country;
|
||||
import bisq.core.locale.CryptoCurrency;
|
||||
import bisq.core.locale.FiatCurrency;
|
||||
|
@ -44,6 +42,7 @@ import bisq.core.payment.payload.SpecificBanksAccountPayload;
|
|||
import bisq.core.provider.price.MarketPrice;
|
||||
import bisq.core.provider.price.PriceFeedService;
|
||||
import bisq.core.trade.statistics.TradeStatisticsManager;
|
||||
import bisq.core.util.PriceUtil;
|
||||
import bisq.core.util.coin.CoinFormatter;
|
||||
import bisq.core.util.coin.ImmutableCoinFormatter;
|
||||
|
||||
|
|
|
@ -486,7 +486,7 @@ message CreateOfferRequest {
|
|||
uint64 amount = 6 [jstype = JS_STRING];
|
||||
uint64 min_amount = 7 [jstype = JS_STRING];
|
||||
double buyer_security_deposit = 8;
|
||||
uint64 trigger_price = 9 [jstype = JS_STRING];
|
||||
string trigger_price = 9;
|
||||
string payment_account_id = 10;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue