mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-22 22:45:21 +01:00
Move maker classes back to desktop module
This commit is contained in:
parent
29193ad928
commit
a9e32c0bdd
13 changed files with 127 additions and 30 deletions
|
@ -38,10 +38,10 @@ import org.junit.Before;
|
|||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static bisq.core.locale.TradeCurrencyMakers.usd;
|
||||
import static bisq.core.user.PreferenceMakers.empty;
|
||||
import static bisq.desktop.main.offer.offerbook.OfferBookListItemMaker.btcBuyItem;
|
||||
import static bisq.desktop.main.offer.offerbook.OfferBookListItemMaker.btcSellItem;
|
||||
import static bisq.desktop.maker.PreferenceMakers.empty;
|
||||
import static bisq.desktop.maker.TradeCurrencyMakers.usd;
|
||||
import static com.natpryce.makeiteasy.MakeItEasy.make;
|
||||
import static com.natpryce.makeiteasy.MakeItEasy.with;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
|
|
@ -54,7 +54,7 @@ import org.junit.Before;
|
|||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static bisq.core.user.PreferenceMakers.empty;
|
||||
import static bisq.desktop.maker.PreferenceMakers.empty;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
|
||||
package bisq.desktop.main.offer.offerbook;
|
||||
|
||||
import bisq.core.offer.OfferMaker;
|
||||
import bisq.desktop.maker.OfferMaker;
|
||||
|
||||
import bisq.core.offer.OfferPayload;
|
||||
|
||||
import com.natpryce.makeiteasy.Instantiator;
|
||||
|
@ -25,7 +26,7 @@ import com.natpryce.makeiteasy.MakeItEasy;
|
|||
import com.natpryce.makeiteasy.Maker;
|
||||
import com.natpryce.makeiteasy.Property;
|
||||
|
||||
import static bisq.core.offer.OfferMaker.btcUsdOffer;
|
||||
import static bisq.desktop.maker.OfferMaker.btcUsdOffer;
|
||||
import static com.natpryce.makeiteasy.MakeItEasy.a;
|
||||
import static com.natpryce.makeiteasy.MakeItEasy.make;
|
||||
import static com.natpryce.makeiteasy.MakeItEasy.with;
|
||||
|
|
|
@ -69,9 +69,9 @@ import org.junit.Ignore;
|
|||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static bisq.core.locale.TradeCurrencyMakers.usd;
|
||||
import static bisq.core.user.PreferenceMakers.empty;
|
||||
import static bisq.desktop.main.offer.offerbook.OfferBookListItemMaker.*;
|
||||
import static bisq.desktop.maker.PreferenceMakers.empty;
|
||||
import static bisq.desktop.maker.TradeCurrencyMakers.usd;
|
||||
import static com.natpryce.makeiteasy.MakeItEasy.make;
|
||||
import static com.natpryce.makeiteasy.MakeItEasy.with;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
|
|
@ -17,9 +17,10 @@
|
|||
|
||||
package bisq.desktop.main.settings.preferences;
|
||||
|
||||
import bisq.desktop.maker.PreferenceMakers;
|
||||
|
||||
import bisq.core.arbitration.Arbitrator;
|
||||
import bisq.core.arbitration.ArbitratorManager;
|
||||
import bisq.core.user.PreferenceMakers;
|
||||
import bisq.core.user.Preferences;
|
||||
|
||||
import bisq.network.p2p.NodeAddress;
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.desktop.util;
|
||||
package bisq.desktop.maker;
|
||||
|
||||
import bisq.desktop.util.CurrencyListItem;
|
||||
|
||||
import bisq.core.locale.TradeCurrency;
|
||||
|
||||
|
@ -23,14 +25,14 @@ import com.natpryce.makeiteasy.Instantiator;
|
|||
import com.natpryce.makeiteasy.Maker;
|
||||
import com.natpryce.makeiteasy.Property;
|
||||
|
||||
import static bisq.core.locale.TradeCurrencyMakers.bitcoin;
|
||||
import static bisq.core.locale.TradeCurrencyMakers.euro;
|
||||
import static bisq.desktop.maker.TradeCurrencyMakers.bitcoin;
|
||||
import static bisq.desktop.maker.TradeCurrencyMakers.euro;
|
||||
import static com.natpryce.makeiteasy.MakeItEasy.a;
|
||||
import static com.natpryce.makeiteasy.MakeItEasy.with;
|
||||
|
||||
public class CurrencyListItemMakers {
|
||||
|
||||
public static final Property<CurrencyListItem, TradeCurrency> tradeCurrency = new Property<>();
|
||||
public static final Property<bisq.desktop.util.CurrencyListItem, TradeCurrency> tradeCurrency = new Property<>();
|
||||
public static final Property<CurrencyListItem, Integer> numberOfTrades = new Property<>();
|
||||
|
||||
public static final Instantiator<CurrencyListItem> CurrencyListItem = lookup ->
|
82
desktop/src/test/java/bisq/desktop/maker/OfferMaker.java
Normal file
82
desktop/src/test/java/bisq/desktop/maker/OfferMaker.java
Normal file
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* This file is part of Bisq.
|
||||
*
|
||||
* Bisq 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.
|
||||
*
|
||||
* Bisq 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 Bisq. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.desktop.maker;
|
||||
|
||||
import bisq.core.offer.Offer;
|
||||
import bisq.core.offer.OfferPayload;
|
||||
|
||||
import com.natpryce.makeiteasy.Instantiator;
|
||||
import com.natpryce.makeiteasy.Maker;
|
||||
import com.natpryce.makeiteasy.Property;
|
||||
|
||||
import static com.natpryce.makeiteasy.MakeItEasy.a;
|
||||
|
||||
public class OfferMaker {
|
||||
|
||||
public static final Property<Offer, Long> price = new Property<>();
|
||||
public static final Property<Offer, Long> minAmount = new Property<>();
|
||||
public static final Property<Offer, Long> amount = new Property<>();
|
||||
public static final Property<Offer, String> baseCurrencyCode = new Property<>();
|
||||
public static final Property<Offer, String> counterCurrencyCode = new Property<>();
|
||||
public static final Property<Offer, OfferPayload.Direction> direction = new Property<>();
|
||||
public static final Property<Offer, Boolean> useMarketBasedPrice = new Property<>();
|
||||
public static final Property<Offer, Double> marketPriceMargin = new Property<>();
|
||||
public static final Property<Offer, String> id = new Property<>();
|
||||
|
||||
public static final Instantiator<Offer> Offer = lookup -> new Offer(
|
||||
new OfferPayload(lookup.valueOf(id, "1234"),
|
||||
0L,
|
||||
null,
|
||||
null,
|
||||
lookup.valueOf(direction, OfferPayload.Direction.BUY),
|
||||
lookup.valueOf(price, 100000L),
|
||||
lookup.valueOf(marketPriceMargin, 0.0),
|
||||
lookup.valueOf(useMarketBasedPrice, false),
|
||||
lookup.valueOf(amount, 100000L),
|
||||
lookup.valueOf(minAmount, 100000L),
|
||||
lookup.valueOf(baseCurrencyCode, "BTC"),
|
||||
lookup.valueOf(counterCurrencyCode, "USD"),
|
||||
null,
|
||||
null,
|
||||
"SEPA",
|
||||
"",
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
"",
|
||||
0L,
|
||||
0L,
|
||||
0L,
|
||||
false,
|
||||
0L,
|
||||
0L,
|
||||
0L,
|
||||
0L,
|
||||
false,
|
||||
false,
|
||||
0L,
|
||||
0L,
|
||||
false,
|
||||
null,
|
||||
null,
|
||||
0));
|
||||
|
||||
public static final Maker<Offer> btcUsdOffer = a(Offer);
|
||||
}
|
|
@ -15,9 +15,10 @@
|
|||
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.core.user;
|
||||
package bisq.desktop.maker;
|
||||
|
||||
import bisq.core.app.BisqEnvironment;
|
||||
import bisq.core.user.Preferences;
|
||||
|
||||
import bisq.common.storage.Storage;
|
||||
|
||||
|
@ -30,7 +31,7 @@ import static com.natpryce.makeiteasy.MakeItEasy.make;
|
|||
|
||||
public class PreferenceMakers {
|
||||
|
||||
public static final Property<Preferences, Storage> storage = new Property<>();
|
||||
public static final Property<bisq.core.user.Preferences, Storage> storage = new Property<>();
|
||||
public static final Property<Preferences, BisqEnvironment> bisqEnvironment = new Property<>();
|
||||
public static final Property<Preferences, String> btcNodesFromOptions = new Property<>();
|
||||
public static final Property<Preferences, String> useTorFlagFromOptions = new Property<>();
|
|
@ -15,7 +15,10 @@
|
|||
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.core.monetary;
|
||||
package bisq.desktop.maker;
|
||||
|
||||
import bisq.core.monetary.Altcoin;
|
||||
import bisq.core.monetary.Price;
|
||||
|
||||
import org.bitcoinj.utils.Fiat;
|
||||
|
|
@ -15,7 +15,11 @@
|
|||
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.core.locale;
|
||||
package bisq.desktop.maker;
|
||||
|
||||
import bisq.core.locale.CryptoCurrency;
|
||||
import bisq.core.locale.FiatCurrency;
|
||||
import bisq.core.locale.TradeCurrency;
|
||||
|
||||
import com.natpryce.makeiteasy.Instantiator;
|
||||
import com.natpryce.makeiteasy.Property;
|
||||
|
@ -29,10 +33,10 @@ public class TradeCurrencyMakers {
|
|||
public static final Property<TradeCurrency, String> currencyCode = new Property<>();
|
||||
public static final Property<TradeCurrency, String> currencyName = new Property<>();
|
||||
|
||||
public static final Instantiator<CryptoCurrency> CryptoCurrency = lookup ->
|
||||
public static final Instantiator<bisq.core.locale.CryptoCurrency> CryptoCurrency = lookup ->
|
||||
new CryptoCurrency(lookup.valueOf(currencyCode, "BTC"), lookup.valueOf(currencyName, "Bitcoin"));
|
||||
|
||||
public static final Instantiator<FiatCurrency> FiatCurrency = lookup ->
|
||||
public static final Instantiator<bisq.core.locale.FiatCurrency> FiatCurrency = lookup ->
|
||||
new FiatCurrency(lookup.valueOf(currencyCode, "EUR"));
|
||||
|
||||
public static final CryptoCurrency bitcoin = make(a(CryptoCurrency));
|
|
@ -15,7 +15,10 @@
|
|||
* along with Bisq. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package bisq.core.monetary;
|
||||
package bisq.desktop.maker;
|
||||
|
||||
import bisq.core.monetary.Altcoin;
|
||||
import bisq.core.monetary.Volume;
|
||||
|
||||
import org.bitcoinj.utils.Fiat;
|
||||
|
|
@ -37,11 +37,11 @@ import org.junit.Before;
|
|||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static bisq.core.monetary.PriceMaker.priceString;
|
||||
import static bisq.core.monetary.PriceMaker.usdPrice;
|
||||
import static bisq.core.monetary.VolumeMaker.usdVolume;
|
||||
import static bisq.core.monetary.VolumeMaker.volumeString;
|
||||
import static bisq.core.offer.OfferMaker.btcUsdOffer;
|
||||
import static bisq.desktop.maker.OfferMaker.btcUsdOffer;
|
||||
import static bisq.desktop.maker.PriceMaker.priceString;
|
||||
import static bisq.desktop.maker.PriceMaker.usdPrice;
|
||||
import static bisq.desktop.maker.VolumeMaker.usdVolume;
|
||||
import static bisq.desktop.maker.VolumeMaker.volumeString;
|
||||
import static com.natpryce.makeiteasy.MakeItEasy.a;
|
||||
import static com.natpryce.makeiteasy.MakeItEasy.make;
|
||||
import static com.natpryce.makeiteasy.MakeItEasy.with;
|
||||
|
|
|
@ -30,12 +30,12 @@ import java.util.Map;
|
|||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import static bisq.core.locale.TradeCurrencyMakers.bitcoin;
|
||||
import static bisq.core.locale.TradeCurrencyMakers.euro;
|
||||
import static bisq.core.user.PreferenceMakers.empty;
|
||||
import static bisq.desktop.util.CurrencyListItemMakers.bitcoinItem;
|
||||
import static bisq.desktop.util.CurrencyListItemMakers.euroItem;
|
||||
import static bisq.desktop.util.CurrencyListItemMakers.numberOfTrades;
|
||||
import static bisq.desktop.maker.CurrencyListItemMakers.bitcoinItem;
|
||||
import static bisq.desktop.maker.CurrencyListItemMakers.euroItem;
|
||||
import static bisq.desktop.maker.CurrencyListItemMakers.numberOfTrades;
|
||||
import static bisq.desktop.maker.PreferenceMakers.empty;
|
||||
import static bisq.desktop.maker.TradeCurrencyMakers.bitcoin;
|
||||
import static bisq.desktop.maker.TradeCurrencyMakers.euro;
|
||||
import static com.natpryce.makeiteasy.MakeItEasy.make;
|
||||
import static com.natpryce.makeiteasy.MakeItEasy.with;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
|
Loading…
Add table
Reference in a new issue