mirror of
https://github.com/haveno-dex/haveno.git
synced 2024-12-22 11:39:29 +00:00
fix fiat trades by changing base currency to xmr #7
This commit is contained in:
parent
69ee113dae
commit
01f183b7a7
38 changed files with 106 additions and 102 deletions
|
@ -57,6 +57,7 @@ public class ApiTestConfig {
|
||||||
// Global constants
|
// Global constants
|
||||||
public static final String BSQ = "BSQ";
|
public static final String BSQ = "BSQ";
|
||||||
public static final String BTC = "BTC";
|
public static final String BTC = "BTC";
|
||||||
|
public static final String XMR = "XMR";
|
||||||
public static final String ARBITRATOR = "arbitrator";
|
public static final String ARBITRATOR = "arbitrator";
|
||||||
public static final String MEDIATOR = "mediator";
|
public static final String MEDIATOR = "mediator";
|
||||||
public static final String REFUND_AGENT = "refundagent";
|
public static final String REFUND_AGENT = "refundagent";
|
||||||
|
|
|
@ -28,7 +28,7 @@ import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.TestMethodOrder;
|
import org.junit.jupiter.api.TestMethodOrder;
|
||||||
|
|
||||||
import static bisq.apitest.config.ApiTestConfig.BSQ;
|
import static bisq.apitest.config.ApiTestConfig.BSQ;
|
||||||
import static bisq.apitest.config.ApiTestConfig.BTC;
|
import static bisq.apitest.config.ApiTestConfig.XMR;
|
||||||
import static bisq.cli.TableFormat.formatOfferTable;
|
import static bisq.cli.TableFormat.formatOfferTable;
|
||||||
import static bisq.core.btc.wallet.Restrictions.getDefaultBuyerSecurityDepositAsPercent;
|
import static bisq.core.btc.wallet.Restrictions.getDefaultBuyerSecurityDepositAsPercent;
|
||||||
import static java.util.Collections.singletonList;
|
import static java.util.Collections.singletonList;
|
||||||
|
@ -47,7 +47,7 @@ public class CreateOfferUsingFixedPriceTest extends AbstractOfferTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(1)
|
@Order(1)
|
||||||
public void testCreateAUDBTCBuyOfferUsingFixedPrice16000() {
|
public void testCreateAUDXMRBuyOfferUsingFixedPrice16000() {
|
||||||
PaymentAccount audAccount = createDummyF2FAccount(aliceClient, "AU");
|
PaymentAccount audAccount = createDummyF2FAccount(aliceClient, "AU");
|
||||||
var newOffer = aliceClient.createFixedPricedOffer(BUY.name(),
|
var newOffer = aliceClient.createFixedPricedOffer(BUY.name(),
|
||||||
"aud",
|
"aud",
|
||||||
|
@ -67,7 +67,7 @@ public class CreateOfferUsingFixedPriceTest extends AbstractOfferTest {
|
||||||
assertEquals(10_000_000, newOffer.getMinAmount());
|
assertEquals(10_000_000, newOffer.getMinAmount());
|
||||||
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
|
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
|
||||||
assertEquals(audAccount.getId(), newOffer.getPaymentAccountId());
|
assertEquals(audAccount.getId(), newOffer.getPaymentAccountId());
|
||||||
assertEquals(BTC, newOffer.getBaseCurrencyCode());
|
assertEquals(XMR, newOffer.getBaseCurrencyCode());
|
||||||
assertEquals("AUD", newOffer.getCounterCurrencyCode());
|
assertEquals("AUD", newOffer.getCounterCurrencyCode());
|
||||||
assertFalse(newOffer.getIsCurrencyForMakerFeeBtc());
|
assertFalse(newOffer.getIsCurrencyForMakerFeeBtc());
|
||||||
|
|
||||||
|
@ -80,14 +80,14 @@ public class CreateOfferUsingFixedPriceTest extends AbstractOfferTest {
|
||||||
assertEquals(10_000_000, newOffer.getMinAmount());
|
assertEquals(10_000_000, newOffer.getMinAmount());
|
||||||
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
|
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
|
||||||
assertEquals(audAccount.getId(), newOffer.getPaymentAccountId());
|
assertEquals(audAccount.getId(), newOffer.getPaymentAccountId());
|
||||||
assertEquals(BTC, newOffer.getBaseCurrencyCode());
|
assertEquals(XMR, newOffer.getBaseCurrencyCode());
|
||||||
assertEquals("AUD", newOffer.getCounterCurrencyCode());
|
assertEquals("AUD", newOffer.getCounterCurrencyCode());
|
||||||
assertFalse(newOffer.getIsCurrencyForMakerFeeBtc());
|
assertFalse(newOffer.getIsCurrencyForMakerFeeBtc());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(2)
|
@Order(2)
|
||||||
public void testCreateUSDBTCBuyOfferUsingFixedPrice100001234() {
|
public void testCreateUSDXMRBuyOfferUsingFixedPrice100001234() {
|
||||||
PaymentAccount usdAccount = createDummyF2FAccount(aliceClient, "US");
|
PaymentAccount usdAccount = createDummyF2FAccount(aliceClient, "US");
|
||||||
var newOffer = aliceClient.createFixedPricedOffer(BUY.name(),
|
var newOffer = aliceClient.createFixedPricedOffer(BUY.name(),
|
||||||
"usd",
|
"usd",
|
||||||
|
@ -107,7 +107,7 @@ public class CreateOfferUsingFixedPriceTest extends AbstractOfferTest {
|
||||||
assertEquals(10_000_000, newOffer.getMinAmount());
|
assertEquals(10_000_000, newOffer.getMinAmount());
|
||||||
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
|
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
|
||||||
assertEquals(usdAccount.getId(), newOffer.getPaymentAccountId());
|
assertEquals(usdAccount.getId(), newOffer.getPaymentAccountId());
|
||||||
assertEquals(BTC, newOffer.getBaseCurrencyCode());
|
assertEquals(XMR, newOffer.getBaseCurrencyCode());
|
||||||
assertEquals("USD", newOffer.getCounterCurrencyCode());
|
assertEquals("USD", newOffer.getCounterCurrencyCode());
|
||||||
assertFalse(newOffer.getIsCurrencyForMakerFeeBtc());
|
assertFalse(newOffer.getIsCurrencyForMakerFeeBtc());
|
||||||
|
|
||||||
|
@ -120,14 +120,14 @@ public class CreateOfferUsingFixedPriceTest extends AbstractOfferTest {
|
||||||
assertEquals(10_000_000, newOffer.getMinAmount());
|
assertEquals(10_000_000, newOffer.getMinAmount());
|
||||||
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
|
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
|
||||||
assertEquals(usdAccount.getId(), newOffer.getPaymentAccountId());
|
assertEquals(usdAccount.getId(), newOffer.getPaymentAccountId());
|
||||||
assertEquals(BTC, newOffer.getBaseCurrencyCode());
|
assertEquals(XMR, newOffer.getBaseCurrencyCode());
|
||||||
assertEquals("USD", newOffer.getCounterCurrencyCode());
|
assertEquals("USD", newOffer.getCounterCurrencyCode());
|
||||||
assertFalse(newOffer.getIsCurrencyForMakerFeeBtc());
|
assertFalse(newOffer.getIsCurrencyForMakerFeeBtc());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(3)
|
@Order(3)
|
||||||
public void testCreateEURBTCSellOfferUsingFixedPrice95001234() {
|
public void testCreateEURXMRSellOfferUsingFixedPrice95001234() {
|
||||||
PaymentAccount eurAccount = createDummyF2FAccount(aliceClient, "FR");
|
PaymentAccount eurAccount = createDummyF2FAccount(aliceClient, "FR");
|
||||||
var newOffer = aliceClient.createFixedPricedOffer(SELL.name(),
|
var newOffer = aliceClient.createFixedPricedOffer(SELL.name(),
|
||||||
"eur",
|
"eur",
|
||||||
|
@ -147,7 +147,7 @@ public class CreateOfferUsingFixedPriceTest extends AbstractOfferTest {
|
||||||
assertEquals(5_000_000, newOffer.getMinAmount());
|
assertEquals(5_000_000, newOffer.getMinAmount());
|
||||||
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
|
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
|
||||||
assertEquals(eurAccount.getId(), newOffer.getPaymentAccountId());
|
assertEquals(eurAccount.getId(), newOffer.getPaymentAccountId());
|
||||||
assertEquals(BTC, newOffer.getBaseCurrencyCode());
|
assertEquals(XMR, newOffer.getBaseCurrencyCode());
|
||||||
assertEquals("EUR", newOffer.getCounterCurrencyCode());
|
assertEquals("EUR", newOffer.getCounterCurrencyCode());
|
||||||
assertFalse(newOffer.getIsCurrencyForMakerFeeBtc());
|
assertFalse(newOffer.getIsCurrencyForMakerFeeBtc());
|
||||||
|
|
||||||
|
@ -160,7 +160,7 @@ public class CreateOfferUsingFixedPriceTest extends AbstractOfferTest {
|
||||||
assertEquals(5_000_000, newOffer.getMinAmount());
|
assertEquals(5_000_000, newOffer.getMinAmount());
|
||||||
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
|
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
|
||||||
assertEquals(eurAccount.getId(), newOffer.getPaymentAccountId());
|
assertEquals(eurAccount.getId(), newOffer.getPaymentAccountId());
|
||||||
assertEquals(BTC, newOffer.getBaseCurrencyCode());
|
assertEquals(XMR, newOffer.getBaseCurrencyCode());
|
||||||
assertEquals("EUR", newOffer.getCounterCurrencyCode());
|
assertEquals("EUR", newOffer.getCounterCurrencyCode());
|
||||||
assertFalse(newOffer.getIsCurrencyForMakerFeeBtc());
|
assertFalse(newOffer.getIsCurrencyForMakerFeeBtc());
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ import org.junit.jupiter.api.Order;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.junit.jupiter.api.TestMethodOrder;
|
import org.junit.jupiter.api.TestMethodOrder;
|
||||||
|
|
||||||
import static bisq.apitest.config.ApiTestConfig.BTC;
|
import static bisq.apitest.config.ApiTestConfig.XMR;
|
||||||
import static bisq.cli.TableFormat.formatOfferTable;
|
import static bisq.cli.TableFormat.formatOfferTable;
|
||||||
import static bisq.common.util.MathUtils.scaleDownByPowerOf10;
|
import static bisq.common.util.MathUtils.scaleDownByPowerOf10;
|
||||||
import static bisq.common.util.MathUtils.scaleUpByPowerOf10;
|
import static bisq.common.util.MathUtils.scaleUpByPowerOf10;
|
||||||
|
@ -54,11 +54,11 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest {
|
||||||
private static final double MKT_PRICE_MARGIN_ERROR_TOLERANCE = 0.0050; // 0.50%
|
private static final double MKT_PRICE_MARGIN_ERROR_TOLERANCE = 0.0050; // 0.50%
|
||||||
private static final double MKT_PRICE_MARGIN_WARNING_TOLERANCE = 0.0001; // 0.01%
|
private static final double MKT_PRICE_MARGIN_WARNING_TOLERANCE = 0.0001; // 0.01%
|
||||||
|
|
||||||
private static final String MAKER_FEE_CURRENCY_CODE = BTC;
|
private static final String MAKER_FEE_CURRENCY_CODE = XMR;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(1)
|
@Order(1)
|
||||||
public void testCreateUSDBTCBuyOffer5PctPriceMargin() {
|
public void testCreateUSDXMRBuyOffer5PctPriceMargin() {
|
||||||
PaymentAccount usdAccount = createDummyF2FAccount(aliceClient, "US");
|
PaymentAccount usdAccount = createDummyF2FAccount(aliceClient, "US");
|
||||||
double priceMarginPctInput = 5.00;
|
double priceMarginPctInput = 5.00;
|
||||||
var newOffer = aliceClient.createMarketBasedPricedOffer(BUY.name(),
|
var newOffer = aliceClient.createMarketBasedPricedOffer(BUY.name(),
|
||||||
|
@ -78,7 +78,7 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest {
|
||||||
assertEquals(10_000_000, newOffer.getMinAmount());
|
assertEquals(10_000_000, newOffer.getMinAmount());
|
||||||
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
|
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
|
||||||
assertEquals(usdAccount.getId(), newOffer.getPaymentAccountId());
|
assertEquals(usdAccount.getId(), newOffer.getPaymentAccountId());
|
||||||
assertEquals(BTC, newOffer.getBaseCurrencyCode());
|
assertEquals(XMR, newOffer.getBaseCurrencyCode());
|
||||||
assertEquals("USD", newOffer.getCounterCurrencyCode());
|
assertEquals("USD", newOffer.getCounterCurrencyCode());
|
||||||
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());
|
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest {
|
||||||
assertEquals(10_000_000, newOffer.getMinAmount());
|
assertEquals(10_000_000, newOffer.getMinAmount());
|
||||||
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
|
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
|
||||||
assertEquals(usdAccount.getId(), newOffer.getPaymentAccountId());
|
assertEquals(usdAccount.getId(), newOffer.getPaymentAccountId());
|
||||||
assertEquals(BTC, newOffer.getBaseCurrencyCode());
|
assertEquals(XMR, newOffer.getBaseCurrencyCode());
|
||||||
assertEquals("USD", newOffer.getCounterCurrencyCode());
|
assertEquals("USD", newOffer.getCounterCurrencyCode());
|
||||||
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());
|
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(2)
|
@Order(2)
|
||||||
public void testCreateNZDBTCBuyOfferMinus2PctPriceMargin() {
|
public void testCreateNZDXMRBuyOfferMinus2PctPriceMargin() {
|
||||||
PaymentAccount nzdAccount = createDummyF2FAccount(aliceClient, "NZ");
|
PaymentAccount nzdAccount = createDummyF2FAccount(aliceClient, "NZ");
|
||||||
double priceMarginPctInput = -2.00;
|
double priceMarginPctInput = -2.00;
|
||||||
var newOffer = aliceClient.createMarketBasedPricedOffer(BUY.name(),
|
var newOffer = aliceClient.createMarketBasedPricedOffer(BUY.name(),
|
||||||
|
@ -119,7 +119,7 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest {
|
||||||
assertEquals(10_000_000, newOffer.getMinAmount());
|
assertEquals(10_000_000, newOffer.getMinAmount());
|
||||||
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
|
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
|
||||||
assertEquals(nzdAccount.getId(), newOffer.getPaymentAccountId());
|
assertEquals(nzdAccount.getId(), newOffer.getPaymentAccountId());
|
||||||
assertEquals(BTC, newOffer.getBaseCurrencyCode());
|
assertEquals(XMR, newOffer.getBaseCurrencyCode());
|
||||||
assertEquals("NZD", newOffer.getCounterCurrencyCode());
|
assertEquals("NZD", newOffer.getCounterCurrencyCode());
|
||||||
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());
|
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest {
|
||||||
assertEquals(10_000_000, newOffer.getMinAmount());
|
assertEquals(10_000_000, newOffer.getMinAmount());
|
||||||
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
|
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
|
||||||
assertEquals(nzdAccount.getId(), newOffer.getPaymentAccountId());
|
assertEquals(nzdAccount.getId(), newOffer.getPaymentAccountId());
|
||||||
assertEquals(BTC, newOffer.getBaseCurrencyCode());
|
assertEquals(XMR, newOffer.getBaseCurrencyCode());
|
||||||
assertEquals("NZD", newOffer.getCounterCurrencyCode());
|
assertEquals("NZD", newOffer.getCounterCurrencyCode());
|
||||||
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());
|
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(3)
|
@Order(3)
|
||||||
public void testCreateGBPBTCSellOfferMinus1Point5PctPriceMargin() {
|
public void testCreateGBPXMRSellOfferMinus1Point5PctPriceMargin() {
|
||||||
PaymentAccount gbpAccount = createDummyF2FAccount(aliceClient, "GB");
|
PaymentAccount gbpAccount = createDummyF2FAccount(aliceClient, "GB");
|
||||||
double priceMarginPctInput = -1.5;
|
double priceMarginPctInput = -1.5;
|
||||||
var newOffer = aliceClient.createMarketBasedPricedOffer(SELL.name(),
|
var newOffer = aliceClient.createMarketBasedPricedOffer(SELL.name(),
|
||||||
|
@ -160,7 +160,7 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest {
|
||||||
assertEquals(5_000_000, newOffer.getMinAmount());
|
assertEquals(5_000_000, newOffer.getMinAmount());
|
||||||
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
|
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
|
||||||
assertEquals(gbpAccount.getId(), newOffer.getPaymentAccountId());
|
assertEquals(gbpAccount.getId(), newOffer.getPaymentAccountId());
|
||||||
assertEquals(BTC, newOffer.getBaseCurrencyCode());
|
assertEquals(XMR, newOffer.getBaseCurrencyCode());
|
||||||
assertEquals("GBP", newOffer.getCounterCurrencyCode());
|
assertEquals("GBP", newOffer.getCounterCurrencyCode());
|
||||||
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());
|
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest {
|
||||||
assertEquals(5_000_000, newOffer.getMinAmount());
|
assertEquals(5_000_000, newOffer.getMinAmount());
|
||||||
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
|
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
|
||||||
assertEquals(gbpAccount.getId(), newOffer.getPaymentAccountId());
|
assertEquals(gbpAccount.getId(), newOffer.getPaymentAccountId());
|
||||||
assertEquals(BTC, newOffer.getBaseCurrencyCode());
|
assertEquals(XMR, newOffer.getBaseCurrencyCode());
|
||||||
assertEquals("GBP", newOffer.getCounterCurrencyCode());
|
assertEquals("GBP", newOffer.getCounterCurrencyCode());
|
||||||
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());
|
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(4)
|
@Order(4)
|
||||||
public void testCreateBRLBTCSellOffer6Point55PctPriceMargin() {
|
public void testCreateBRLXMRSellOffer6Point55PctPriceMargin() {
|
||||||
PaymentAccount brlAccount = createDummyF2FAccount(aliceClient, "BR");
|
PaymentAccount brlAccount = createDummyF2FAccount(aliceClient, "BR");
|
||||||
double priceMarginPctInput = 6.55;
|
double priceMarginPctInput = 6.55;
|
||||||
var newOffer = aliceClient.createMarketBasedPricedOffer(SELL.name(),
|
var newOffer = aliceClient.createMarketBasedPricedOffer(SELL.name(),
|
||||||
|
@ -201,7 +201,7 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest {
|
||||||
assertEquals(5_000_000, newOffer.getMinAmount());
|
assertEquals(5_000_000, newOffer.getMinAmount());
|
||||||
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
|
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
|
||||||
assertEquals(brlAccount.getId(), newOffer.getPaymentAccountId());
|
assertEquals(brlAccount.getId(), newOffer.getPaymentAccountId());
|
||||||
assertEquals(BTC, newOffer.getBaseCurrencyCode());
|
assertEquals(XMR, newOffer.getBaseCurrencyCode());
|
||||||
assertEquals("BRL", newOffer.getCounterCurrencyCode());
|
assertEquals("BRL", newOffer.getCounterCurrencyCode());
|
||||||
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());
|
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest {
|
||||||
assertEquals(5_000_000, newOffer.getMinAmount());
|
assertEquals(5_000_000, newOffer.getMinAmount());
|
||||||
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
|
assertEquals(1_500_000, newOffer.getBuyerSecurityDeposit());
|
||||||
assertEquals(brlAccount.getId(), newOffer.getPaymentAccountId());
|
assertEquals(brlAccount.getId(), newOffer.getPaymentAccountId());
|
||||||
assertEquals(BTC, newOffer.getBaseCurrencyCode());
|
assertEquals(XMR, newOffer.getBaseCurrencyCode());
|
||||||
assertEquals("BRL", newOffer.getCounterCurrencyCode());
|
assertEquals("BRL", newOffer.getCounterCurrencyCode());
|
||||||
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());
|
assertTrue(newOffer.getIsCurrencyForMakerFeeBtc());
|
||||||
|
|
||||||
|
|
|
@ -58,19 +58,19 @@ public class OfferTest extends AbstractOfferTest {
|
||||||
@Order(3)
|
@Order(3)
|
||||||
public void testCreateOfferUsingFixedPrice() {
|
public void testCreateOfferUsingFixedPrice() {
|
||||||
CreateOfferUsingFixedPriceTest test = new CreateOfferUsingFixedPriceTest();
|
CreateOfferUsingFixedPriceTest test = new CreateOfferUsingFixedPriceTest();
|
||||||
test.testCreateAUDBTCBuyOfferUsingFixedPrice16000();
|
test.testCreateAUDXMRBuyOfferUsingFixedPrice16000();
|
||||||
test.testCreateUSDBTCBuyOfferUsingFixedPrice100001234();
|
test.testCreateUSDXMRBuyOfferUsingFixedPrice100001234();
|
||||||
test.testCreateEURBTCSellOfferUsingFixedPrice95001234();
|
test.testCreateEURXMRSellOfferUsingFixedPrice95001234();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@Order(4)
|
@Order(4)
|
||||||
public void testCreateOfferUsingMarketPriceMargin() {
|
public void testCreateOfferUsingMarketPriceMargin() {
|
||||||
CreateOfferUsingMarketPriceMarginTest test = new CreateOfferUsingMarketPriceMarginTest();
|
CreateOfferUsingMarketPriceMarginTest test = new CreateOfferUsingMarketPriceMarginTest();
|
||||||
test.testCreateUSDBTCBuyOffer5PctPriceMargin();
|
test.testCreateUSDXMRBuyOffer5PctPriceMargin();
|
||||||
test.testCreateNZDBTCBuyOfferMinus2PctPriceMargin();
|
test.testCreateNZDXMRBuyOfferMinus2PctPriceMargin();
|
||||||
test.testCreateGBPBTCSellOfferMinus1Point5PctPriceMargin();
|
test.testCreateGBPXMRSellOfferMinus1Point5PctPriceMargin();
|
||||||
test.testCreateBRLBTCSellOffer6Point55PctPriceMargin();
|
test.testCreateBRLXMRSellOffer6Point55PctPriceMargin();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -532,9 +532,9 @@ public class CurrencyUtil {
|
||||||
.filter(cryptoCurrency -> cryptoCurrency.getCode().equals(currencyCode))
|
.filter(cryptoCurrency -> cryptoCurrency.getCode().equals(currencyCode))
|
||||||
.findAny();
|
.findAny();
|
||||||
|
|
||||||
String btcOrRemovedAsset = "BTC".equals(currencyCode) ? "Bitcoin" :
|
String xmrOrRemovedAsset = "XMR".equals(currencyCode) ? "Monero" :
|
||||||
removedCryptoCurrency.isPresent() ? removedCryptoCurrency.get().getName() : Res.get("shared.na");
|
removedCryptoCurrency.isPresent() ? removedCryptoCurrency.get().getName() : Res.get("shared.na");
|
||||||
return getCryptoCurrency(currencyCode).map(TradeCurrency::getName).orElse(btcOrRemovedAsset);
|
return getCryptoCurrency(currencyCode).map(TradeCurrency::getName).orElse(xmrOrRemovedAsset);
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return Currency.getInstance(currencyCode).getDisplayName();
|
return Currency.getInstance(currencyCode).getDisplayName();
|
||||||
|
|
|
@ -433,7 +433,7 @@ public class Offer implements NetworkPayload, PersistablePayload {
|
||||||
return currencyCode;
|
return currencyCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
currencyCode = offerPayload.getBaseCurrencyCode().equals("BTC") ?
|
currencyCode = offerPayload.getBaseCurrencyCode().equals("XMR") ?
|
||||||
offerPayload.getCounterCurrencyCode() :
|
offerPayload.getCounterCurrencyCode() :
|
||||||
offerPayload.getBaseCurrencyCode();
|
offerPayload.getBaseCurrencyCode();
|
||||||
return currencyCode;
|
return currencyCode;
|
||||||
|
|
|
@ -384,12 +384,12 @@ public final class OfferPayload implements ProtectedStoragePayload, ExpirablePay
|
||||||
}
|
}
|
||||||
|
|
||||||
// In the offer we support base and counter currency
|
// In the offer we support base and counter currency
|
||||||
// Fiat offers have base currency BTC and counterCurrency Fiat
|
// Fiat offers have base currency XMR and counterCurrency Fiat
|
||||||
// Altcoins have base currency Altcoin and counterCurrency BTC
|
// Altcoins have base currency Altcoin and counterCurrency XMR
|
||||||
// The rest of the app does not support yet that concept of base currency and counter currencies
|
// The rest of the app does not support yet that concept of base currency and counter currencies
|
||||||
// so we map here for convenience
|
// so we map here for convenience
|
||||||
public String getCurrencyCode() {
|
public String getCurrencyCode() {
|
||||||
return getBaseCurrencyCode().equals("BTC") ? getCounterCurrencyCode() : getBaseCurrencyCode();
|
return getBaseCurrencyCode().equals("XMR") ? getCounterCurrencyCode() : getBaseCurrencyCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -307,7 +307,7 @@ public final class TradeStatistics2 implements ProcessOncePersistableNetworkPayl
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCurrencyCode() {
|
public String getCurrencyCode() {
|
||||||
return baseCurrency.equals("BTC") ? counterCurrency : baseCurrency;
|
return baseCurrency.equals("XMR") ? counterCurrency : baseCurrency;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Coin getTradeAmount() {
|
public Coin getTradeAmount() {
|
||||||
|
|
|
@ -284,7 +284,7 @@ public final class Preferences implements PersistedDataHost, BridgeAddressProvid
|
||||||
setCryptoCurrencies(CurrencyUtil.getMainCryptoCurrencies());
|
setCryptoCurrencies(CurrencyUtil.getMainCryptoCurrencies());
|
||||||
|
|
||||||
BaseCurrencyNetwork baseCurrencyNetwork = Config.baseCurrencyNetwork();
|
BaseCurrencyNetwork baseCurrencyNetwork = Config.baseCurrencyNetwork();
|
||||||
if ("BTC".equals(baseCurrencyNetwork.getCurrencyCode())) {
|
if ("BTC".equals(baseCurrencyNetwork.getCurrencyCode())) { // TODO (woodser): change to XMR when --baseCurrencyNetwork=XMR_REGTEST supported
|
||||||
setBlockChainExplorerMainNet(BTC_MAIN_NET_EXPLORERS.get(0));
|
setBlockChainExplorerMainNet(BTC_MAIN_NET_EXPLORERS.get(0));
|
||||||
setBlockChainExplorerTestNet(BTC_TEST_NET_EXPLORERS.get(0));
|
setBlockChainExplorerTestNet(BTC_TEST_NET_EXPLORERS.get(0));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -15,8 +15,8 @@ public class BankUtilTest {
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Locale.setDefault(new Locale("en", "US"));
|
Locale.setDefault(new Locale("en", "US"));
|
||||||
GlobalSettings.setLocale(new Locale("en", "US"));
|
GlobalSettings.setLocale(new Locale("en", "US"));
|
||||||
Res.setBaseCurrencyCode("BTC");
|
Res.setBaseCurrencyCode("XMR");
|
||||||
Res.setBaseCurrencyName("Bitcoin");
|
Res.setBaseCurrencyName("Monero");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -45,8 +45,8 @@ public class CurrencyUtilTest {
|
||||||
public void setup() {
|
public void setup() {
|
||||||
|
|
||||||
Locale.setDefault(new Locale("en", "US"));
|
Locale.setDefault(new Locale("en", "US"));
|
||||||
Res.setBaseCurrencyCode("BTC");
|
Res.setBaseCurrencyCode("XMR");
|
||||||
Res.setBaseCurrencyName("Bitcoin");
|
Res.setBaseCurrencyName("Monero");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class OfferMaker {
|
||||||
lookup.valueOf(useMarketBasedPrice, false),
|
lookup.valueOf(useMarketBasedPrice, false),
|
||||||
lookup.valueOf(amount, 100000L),
|
lookup.valueOf(amount, 100000L),
|
||||||
lookup.valueOf(minAmount, 100000L),
|
lookup.valueOf(minAmount, 100000L),
|
||||||
lookup.valueOf(baseCurrencyCode, "BTC"),
|
lookup.valueOf(baseCurrencyCode, "XMR"),
|
||||||
lookup.valueOf(counterCurrencyCode, "USD"),
|
lookup.valueOf(counterCurrencyCode, "USD"),
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
|
|
|
@ -44,6 +44,9 @@ public class AltCoinAddressValidatorTest {
|
||||||
|
|
||||||
validator.setCurrencyCode("BTC");
|
validator.setCurrencyCode("BTC");
|
||||||
assertTrue(validator.validate("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem").isValid);
|
assertTrue(validator.validate("17VZNX1SN5NtKa8UQFxwQbFeFc3iqRYhem").isValid);
|
||||||
|
|
||||||
|
validator.setCurrencyCode("XMR");
|
||||||
|
assertTrue(validator.validate("4AuUM6PedofLWKfRCX1fP3SoNZUzq6FSAbpevHRR6tVuMpZc3HznVeudmNGkEB75apjE7WKVgZZh1YvPVxZoHFN88NCdmWw").isValid);
|
||||||
|
|
||||||
validator.setCurrencyCode("LTC");
|
validator.setCurrencyCode("LTC");
|
||||||
assertTrue(validator.validate("Lg3PX8wRWmApFCoCMAsPF5P9dPHYQHEWKW").isValid);
|
assertTrue(validator.validate("Lg3PX8wRWmApFCoCMAsPF5P9dPHYQHEWKW").isValid);
|
||||||
|
|
|
@ -54,8 +54,8 @@ public class PreferencesTest {
|
||||||
final Locale en_US = new Locale("en", "US");
|
final Locale en_US = new Locale("en", "US");
|
||||||
Locale.setDefault(en_US);
|
Locale.setDefault(en_US);
|
||||||
GlobalSettings.setLocale(en_US);
|
GlobalSettings.setLocale(en_US);
|
||||||
Res.setBaseCurrencyCode("BTC");
|
Res.setBaseCurrencyCode("XMR");
|
||||||
Res.setBaseCurrencyName("Bitcoin");
|
Res.setBaseCurrencyName("Monero");
|
||||||
|
|
||||||
persistenceManager = mock(PersistenceManager.class);
|
persistenceManager = mock(PersistenceManager.class);
|
||||||
Config config = new Config();
|
Config config = new Config();
|
||||||
|
|
|
@ -31,8 +31,8 @@ public class FormattingUtilsTest {
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
Locale.setDefault(new Locale("en", "US"));
|
Locale.setDefault(new Locale("en", "US"));
|
||||||
Res.setBaseCurrencyCode("BTC");
|
Res.setBaseCurrencyCode("XMR");
|
||||||
Res.setBaseCurrencyName("Bitcoin");
|
Res.setBaseCurrencyName("Monero");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -37,8 +37,8 @@ public class RegexValidatorTest {
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Locale.setDefault(new Locale("en", "US"));
|
Locale.setDefault(new Locale("en", "US"));
|
||||||
GlobalSettings.setLocale(new Locale("en", "US"));
|
GlobalSettings.setLocale(new Locale("en", "US"));
|
||||||
Res.setBaseCurrencyCode("BTC");
|
Res.setBaseCurrencyCode("XMR");
|
||||||
Res.setBaseCurrencyName("Bitcoin");
|
Res.setBaseCurrencyName("Monero");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -251,7 +251,7 @@ public class MainView extends InitializableView<StackPane, MainViewModel>
|
||||||
try {
|
try {
|
||||||
String preferredTradeCurrency = model.getPreferences().getPreferredTradeCurrency().getCode();
|
String preferredTradeCurrency = model.getPreferences().getPreferredTradeCurrency().getCode();
|
||||||
double availableBalance = Double.parseDouble(
|
double availableBalance = Double.parseDouble(
|
||||||
model.getAvailableBalance().getValue().replace("BTC", ""));
|
model.getAvailableBalance().getValue().replace("XMR", ""));
|
||||||
double marketPrice = Double.parseDouble(model.getMarketPrice(preferredTradeCurrency).getValue());
|
double marketPrice = Double.parseDouble(model.getMarketPrice(preferredTradeCurrency).getValue());
|
||||||
tooltipText += "\n" + currencyFormat.format(availableBalance * marketPrice) +
|
tooltipText += "\n" + currencyFormat.format(availableBalance * marketPrice) +
|
||||||
" " + preferredTradeCurrency;
|
" " + preferredTradeCurrency;
|
||||||
|
@ -276,7 +276,7 @@ public class MainView extends InitializableView<StackPane, MainViewModel>
|
||||||
try {
|
try {
|
||||||
String preferredTradeCurrency = model.getPreferences().getPreferredTradeCurrency().getCode();
|
String preferredTradeCurrency = model.getPreferences().getPreferredTradeCurrency().getCode();
|
||||||
double reservedBalance = Double.parseDouble(
|
double reservedBalance = Double.parseDouble(
|
||||||
model.getReservedBalance().getValue().replace("BTC", ""));
|
model.getReservedBalance().getValue().replace("XMR", ""));
|
||||||
double marketPrice = Double.parseDouble(model.getMarketPrice(preferredTradeCurrency).getValue());
|
double marketPrice = Double.parseDouble(model.getMarketPrice(preferredTradeCurrency).getValue());
|
||||||
tooltipText += "\n" + currencyFormat.format(reservedBalance * marketPrice) +
|
tooltipText += "\n" + currencyFormat.format(reservedBalance * marketPrice) +
|
||||||
" " + preferredTradeCurrency;
|
" " + preferredTradeCurrency;
|
||||||
|
@ -301,7 +301,7 @@ public class MainView extends InitializableView<StackPane, MainViewModel>
|
||||||
try {
|
try {
|
||||||
String preferredTradeCurrency = model.getPreferences().getPreferredTradeCurrency().getCode();
|
String preferredTradeCurrency = model.getPreferences().getPreferredTradeCurrency().getCode();
|
||||||
double lockedBalance = Double.parseDouble(
|
double lockedBalance = Double.parseDouble(
|
||||||
model.getLockedBalance().getValue().replace("BTC", ""));
|
model.getLockedBalance().getValue().replace("XMR", ""));
|
||||||
double marketPrice = Double.parseDouble(model.getMarketPrice(preferredTradeCurrency).getValue());
|
double marketPrice = Double.parseDouble(model.getMarketPrice(preferredTradeCurrency).getValue());
|
||||||
tooltipText += "\n" + currencyFormat.format(lockedBalance * marketPrice) +
|
tooltipText += "\n" + currencyFormat.format(lockedBalance * marketPrice) +
|
||||||
" " + preferredTradeCurrency;
|
" " + preferredTradeCurrency;
|
||||||
|
|
|
@ -1464,7 +1464,7 @@ public abstract class MutableOfferView<M extends MutableOfferViewModel<?>> exten
|
||||||
vBox.getChildren().addAll(tradeFeeInBtcLabel, tradeFeeInBsqLabel);
|
vBox.getChildren().addAll(tradeFeeInBtcLabel, tradeFeeInBsqLabel);
|
||||||
|
|
||||||
tradeFeeInBtcToggle = new AutoTooltipSlideToggleButton();
|
tradeFeeInBtcToggle = new AutoTooltipSlideToggleButton();
|
||||||
tradeFeeInBtcToggle.setText("BTC");
|
tradeFeeInBtcToggle.setText("BTC"); // TODO (woodser): update to XMR
|
||||||
tradeFeeInBtcToggle.setVisible(false);
|
tradeFeeInBtcToggle.setVisible(false);
|
||||||
tradeFeeInBtcToggle.setPadding(new Insets(-8, 5, -10, 5));
|
tradeFeeInBtcToggle.setPadding(new Insets(-8, 5, -10, 5));
|
||||||
|
|
||||||
|
|
|
@ -1201,7 +1201,7 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
|
||||||
vBox.getChildren().addAll(tradeFeeInBtcLabel, tradeFeeInBsqLabel);
|
vBox.getChildren().addAll(tradeFeeInBtcLabel, tradeFeeInBsqLabel);
|
||||||
|
|
||||||
tradeFeeInBtcToggle = new AutoTooltipSlideToggleButton();
|
tradeFeeInBtcToggle = new AutoTooltipSlideToggleButton();
|
||||||
tradeFeeInBtcToggle.setText("BTC");
|
tradeFeeInBtcToggle.setText("BTC"); // TODO (woodser): update to XMR
|
||||||
tradeFeeInBtcToggle.setPadding(new Insets(-8, 5, -10, 5));
|
tradeFeeInBtcToggle.setPadding(new Insets(-8, 5, -10, 5));
|
||||||
|
|
||||||
tradeFeeInBsqToggle = new AutoTooltipSlideToggleButton();
|
tradeFeeInBsqToggle = new AutoTooltipSlideToggleButton();
|
||||||
|
|
|
@ -72,15 +72,15 @@ public class AboutView extends ActivatableView<GridPane, Void> {
|
||||||
hyperlinkWithIcon = addHyperlinkWithIcon(root, ++gridRow, Res.get("setting.about.contribute"), "https://bisq.network/contribute");
|
hyperlinkWithIcon = addHyperlinkWithIcon(root, ++gridRow, Res.get("setting.about.contribute"), "https://bisq.network/contribute");
|
||||||
GridPane.setColumnSpan(hyperlinkWithIcon, 2);
|
GridPane.setColumnSpan(hyperlinkWithIcon, 2);
|
||||||
|
|
||||||
boolean isBtc = Res.getBaseCurrencyCode().equals("BTC");
|
boolean isXmr = Res.getBaseCurrencyCode().equals("XMR");
|
||||||
addTitledGroupBg(root, ++gridRow, isBtc ? 3 : 2, Res.get("setting.about.providers"), Layout.GROUP_DISTANCE);
|
addTitledGroupBg(root, ++gridRow, isXmr ? 3 : 2, Res.get("setting.about.providers"), Layout.GROUP_DISTANCE);
|
||||||
|
|
||||||
label = addLabel(root, gridRow, Res.get(isBtc ? "setting.about.apisWithFee" : "setting.about.apis"), Layout.TWICE_FIRST_ROW_AND_GROUP_DISTANCE);
|
label = addLabel(root, gridRow, Res.get(isXmr ? "setting.about.apisWithFee" : "setting.about.apis"), Layout.TWICE_FIRST_ROW_AND_GROUP_DISTANCE);
|
||||||
label.setWrapText(true);
|
label.setWrapText(true);
|
||||||
GridPane.setHalignment(label, HPos.LEFT);
|
GridPane.setHalignment(label, HPos.LEFT);
|
||||||
addCompactTopLabelTextField(root, ++gridRow, Res.get("setting.about.pricesProvided"),
|
addCompactTopLabelTextField(root, ++gridRow, Res.get("setting.about.pricesProvided"),
|
||||||
"Bisq Price Index (https://bisq.wiki/Bisq_Price_Index)");
|
"Bisq Price Index (https://bisq.wiki/Bisq_Price_Index)");
|
||||||
if (isBtc)
|
if (isXmr)
|
||||||
addCompactTopLabelTextField(root, ++gridRow, Res.get("setting.about.feeEstimation.label"), "mempool.space (https://mempool.space)");
|
addCompactTopLabelTextField(root, ++gridRow, Res.get("setting.about.feeEstimation.label"), "mempool.space (https://mempool.space)");
|
||||||
|
|
||||||
addTitledGroupBg(root, ++gridRow, 2, Res.get("setting.about.versionDetails"), Layout.GROUP_DISTANCE);
|
addTitledGroupBg(root, ++gridRow, 2, Res.get("setting.about.versionDetails"), Layout.GROUP_DISTANCE);
|
||||||
|
|
|
@ -51,8 +51,8 @@ public class ComponentsDemo extends Application {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start(Stage primaryStage) throws Exception {
|
public void start(Stage primaryStage) throws Exception {
|
||||||
final CryptoCurrency btc = new CryptoCurrency("BTC", "bitcoin");
|
final CryptoCurrency xmr = new CryptoCurrency("XMR", "monero");
|
||||||
GlobalSettings.setDefaultTradeCurrency(btc);
|
GlobalSettings.setDefaultTradeCurrency(xmr);
|
||||||
GlobalSettings.setLocale(Locale.US);
|
GlobalSettings.setLocale(Locale.US);
|
||||||
Res.setup();
|
Res.setup();
|
||||||
|
|
||||||
|
@ -85,9 +85,9 @@ public class ComponentsDemo extends Application {
|
||||||
|
|
||||||
final Button buttonEnabled = FormBuilder.addButton(gridPane, rowIndex++, "Hello World");
|
final Button buttonEnabled = FormBuilder.addButton(gridPane, rowIndex++, "Hello World");
|
||||||
buttonEnabled.setOnMouseClicked((click) -> {
|
buttonEnabled.setOnMouseClicked((click) -> {
|
||||||
//bar.enqueue(new JFXSnackbar.SnackbarEvent(Res.get("notification.walletUpdate.msg", "0.345 BTC"), "CLOSE", 3000, true, b -> bar.close()));
|
//bar.enqueue(new JFXSnackbar.SnackbarEvent(Res.get("notification.walletUpdate.msg", "0.345 XMR"), "CLOSE", 3000, true, b -> bar.close()));
|
||||||
// new Popup<>().headLine(Res.get("popup.roundedFiatValues.headline"))
|
// new Popup<>().headLine(Res.get("popup.roundedFiatValues.headline"))
|
||||||
// .message(Res.get("popup.roundedFiatValues.msg", "BTC"))
|
// .message(Res.get("popup.roundedFiatValues.msg", "XMR"))
|
||||||
// .show();
|
// .show();
|
||||||
// new Notification().headLine(Res.get("notification.tradeCompleted.headline"))
|
// new Notification().headLine(Res.get("notification.tradeCompleted.headline"))
|
||||||
// .notification(Res.get("notification.tradeCompleted.msg"))
|
// .notification(Res.get("notification.tradeCompleted.msg"))
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class MarketsPrintTool {
|
||||||
final Collection<FiatCurrency> allSortedFiatCurrencies = CurrencyUtil.getAllSortedFiatCurrencies();
|
final Collection<FiatCurrency> allSortedFiatCurrencies = CurrencyUtil.getAllSortedFiatCurrencies();
|
||||||
final Stream<MarketCurrency> fiatStream = allSortedFiatCurrencies.stream()
|
final Stream<MarketCurrency> fiatStream = allSortedFiatCurrencies.stream()
|
||||||
.filter(e -> !e.getCurrency().getCurrencyCode().equals("BSQ"))
|
.filter(e -> !e.getCurrency().getCurrencyCode().equals("BSQ"))
|
||||||
.filter(e -> !e.getCurrency().getCurrencyCode().equals("BTC"))
|
.filter(e -> !e.getCurrency().getCurrencyCode().equals("BTC")) // TODO (woodser): update to XMR
|
||||||
.map(e -> new MarketCurrency("btc_" + e.getCode().toLowerCase(), e.getName(), e.getCode()))
|
.map(e -> new MarketCurrency("btc_" + e.getCode().toLowerCase(), e.getName(), e.getCode()))
|
||||||
.distinct();
|
.distinct();
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,8 @@ public class DaoStateBlockListItemTest {
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Locale.setDefault(new Locale("en", "US"));
|
Locale.setDefault(new Locale("en", "US"));
|
||||||
Res.setBaseCurrencyCode("BTC");
|
Res.setBaseCurrencyCode("XMR");
|
||||||
Res.setBaseCurrencyName("Bitcoin");
|
Res.setBaseCurrencyName("Monero");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -70,7 +70,7 @@ public class TradesChartsViewModelTest {
|
||||||
false,
|
false,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
"BTC",
|
"XMR",
|
||||||
"EUR",
|
"EUR",
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
|
|
|
@ -43,8 +43,8 @@ public class CreateOfferDataModelTest {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
final CryptoCurrency btc = new CryptoCurrency("BTC", "bitcoin");
|
final CryptoCurrency xmr = new CryptoCurrency("XMR", "monero");
|
||||||
GlobalSettings.setDefaultTradeCurrency(btc);
|
GlobalSettings.setDefaultTradeCurrency(xmr);
|
||||||
Res.setup();
|
Res.setup();
|
||||||
|
|
||||||
XmrAddressEntry addressEntry = mock(XmrAddressEntry.class);
|
XmrAddressEntry addressEntry = mock(XmrAddressEntry.class);
|
||||||
|
|
|
@ -78,7 +78,7 @@ public class CreateOfferViewModelTest {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
final CryptoCurrency btc = new CryptoCurrency("BTC", "bitcoin");
|
final CryptoCurrency btc = new CryptoCurrency("XMR", "monero");
|
||||||
GlobalSettings.setDefaultTradeCurrency(btc);
|
GlobalSettings.setDefaultTradeCurrency(btc);
|
||||||
Res.setup();
|
Res.setup();
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ public class CreateOfferViewModelTest {
|
||||||
coinFormatter,
|
coinFormatter,
|
||||||
tradeStats,
|
tradeStats,
|
||||||
null);
|
null);
|
||||||
dataModel.initWithData(OfferPayload.Direction.BUY, new CryptoCurrency("BTC", "bitcoin"));
|
dataModel.initWithData(OfferPayload.Direction.BUY, new CryptoCurrency("XMR", "monero"));
|
||||||
dataModel.activate();
|
dataModel.activate();
|
||||||
|
|
||||||
model = new CreateOfferViewModel(dataModel,
|
model = new CreateOfferViewModel(dataModel,
|
||||||
|
|
|
@ -51,7 +51,7 @@ public class OfferBookListItemMaker {
|
||||||
with(OfferMaker.direction, lookup.valueOf(direction, OfferPayload.Direction.BUY)),
|
with(OfferMaker.direction, lookup.valueOf(direction, OfferPayload.Direction.BUY)),
|
||||||
with(OfferMaker.useMarketBasedPrice, lookup.valueOf(useMarketBasedPrice, false)),
|
with(OfferMaker.useMarketBasedPrice, lookup.valueOf(useMarketBasedPrice, false)),
|
||||||
with(OfferMaker.marketPriceMargin, lookup.valueOf(marketPriceMargin, 0.0)),
|
with(OfferMaker.marketPriceMargin, lookup.valueOf(marketPriceMargin, 0.0)),
|
||||||
with(OfferMaker.baseCurrencyCode, lookup.valueOf(baseCurrencyCode, "BTC")),
|
with(OfferMaker.baseCurrencyCode, lookup.valueOf(baseCurrencyCode, "XMR")),
|
||||||
with(OfferMaker.counterCurrencyCode, lookup.valueOf(counterCurrencyCode, "USD")),
|
with(OfferMaker.counterCurrencyCode, lookup.valueOf(counterCurrencyCode, "USD")),
|
||||||
with(OfferMaker.id, lookup.valueOf(id, "1234"))
|
with(OfferMaker.id, lookup.valueOf(id, "1234"))
|
||||||
)));
|
)));
|
||||||
|
|
|
@ -594,7 +594,7 @@ public class OfferBookViewModelTest {
|
||||||
false,
|
false,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
"BTC",
|
"XMR",
|
||||||
tradeCurrencyCode,
|
tradeCurrencyCode,
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
|
|
|
@ -61,8 +61,8 @@ public class EditOfferDataModelTest {
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
|
|
||||||
final CryptoCurrency btc = new CryptoCurrency("BTC", "bitcoin");
|
final CryptoCurrency xmr = new CryptoCurrency("XMR", "monero");
|
||||||
GlobalSettings.setDefaultTradeCurrency(btc);
|
GlobalSettings.setDefaultTradeCurrency(xmr);
|
||||||
Res.setup();
|
Res.setup();
|
||||||
|
|
||||||
FeeService feeService = mock(FeeService.class);
|
FeeService feeService = mock(FeeService.class);
|
||||||
|
|
|
@ -25,7 +25,7 @@ import com.natpryce.makeiteasy.Instantiator;
|
||||||
import com.natpryce.makeiteasy.Maker;
|
import com.natpryce.makeiteasy.Maker;
|
||||||
import com.natpryce.makeiteasy.Property;
|
import com.natpryce.makeiteasy.Property;
|
||||||
|
|
||||||
import static bisq.desktop.maker.TradeCurrencyMakers.bitcoin;
|
import static bisq.desktop.maker.TradeCurrencyMakers.monero;
|
||||||
import static bisq.desktop.maker.TradeCurrencyMakers.euro;
|
import static bisq.desktop.maker.TradeCurrencyMakers.euro;
|
||||||
import static com.natpryce.makeiteasy.MakeItEasy.a;
|
import static com.natpryce.makeiteasy.MakeItEasy.a;
|
||||||
import static com.natpryce.makeiteasy.MakeItEasy.with;
|
import static com.natpryce.makeiteasy.MakeItEasy.with;
|
||||||
|
@ -36,7 +36,7 @@ public class CurrencyListItemMakers {
|
||||||
public static final Property<CurrencyListItem, Integer> numberOfTrades = new Property<>();
|
public static final Property<CurrencyListItem, Integer> numberOfTrades = new Property<>();
|
||||||
|
|
||||||
public static final Instantiator<CurrencyListItem> CurrencyListItem = lookup ->
|
public static final Instantiator<CurrencyListItem> CurrencyListItem = lookup ->
|
||||||
new CurrencyListItem(lookup.valueOf(tradeCurrency, bitcoin), lookup.valueOf(numberOfTrades, 0));
|
new CurrencyListItem(lookup.valueOf(tradeCurrency, monero), lookup.valueOf(numberOfTrades, 0));
|
||||||
|
|
||||||
public static final Maker<CurrencyListItem> bitcoinItem = a(CurrencyListItem);
|
public static final Maker<CurrencyListItem> bitcoinItem = a(CurrencyListItem);
|
||||||
public static final Maker<CurrencyListItem> euroItem = a(CurrencyListItem, with(tradeCurrency, euro));
|
public static final Maker<CurrencyListItem> euroItem = a(CurrencyListItem, with(tradeCurrency, euro));
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class OfferMaker {
|
||||||
lookup.valueOf(useMarketBasedPrice, false),
|
lookup.valueOf(useMarketBasedPrice, false),
|
||||||
lookup.valueOf(amount, 100000L),
|
lookup.valueOf(amount, 100000L),
|
||||||
lookup.valueOf(minAmount, 100000L),
|
lookup.valueOf(minAmount, 100000L),
|
||||||
lookup.valueOf(baseCurrencyCode, "BTC"),
|
lookup.valueOf(baseCurrencyCode, "XMR"),
|
||||||
lookup.valueOf(counterCurrencyCode, "USD"),
|
lookup.valueOf(counterCurrencyCode, "USD"),
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
|
|
|
@ -34,12 +34,12 @@ public class TradeCurrencyMakers {
|
||||||
public static final Property<TradeCurrency, String> currencyName = new Property<>();
|
public static final Property<TradeCurrency, String> currencyName = new Property<>();
|
||||||
|
|
||||||
public static final Instantiator<bisq.core.locale.CryptoCurrency> CryptoCurrency = lookup ->
|
public static final Instantiator<bisq.core.locale.CryptoCurrency> CryptoCurrency = lookup ->
|
||||||
new CryptoCurrency(lookup.valueOf(currencyCode, "BTC"), lookup.valueOf(currencyName, "Bitcoin"));
|
new CryptoCurrency(lookup.valueOf(currencyCode, "XMR"), lookup.valueOf(currencyName, "Monero"));
|
||||||
|
|
||||||
public static final Instantiator<bisq.core.locale.FiatCurrency> FiatCurrency = lookup ->
|
public static final Instantiator<bisq.core.locale.FiatCurrency> FiatCurrency = lookup ->
|
||||||
new FiatCurrency(lookup.valueOf(currencyCode, "EUR"));
|
new FiatCurrency(lookup.valueOf(currencyCode, "EUR"));
|
||||||
|
|
||||||
public static final CryptoCurrency bitcoin = make(a(CryptoCurrency));
|
public static final CryptoCurrency monero = make(a(CryptoCurrency));
|
||||||
public static final FiatCurrency euro = make(a(FiatCurrency));
|
public static final FiatCurrency euro = make(a(FiatCurrency));
|
||||||
public static final FiatCurrency usd = make(a(FiatCurrency).but(with(currencyCode, "USD")));
|
public static final FiatCurrency usd = make(a(FiatCurrency).but(with(currencyCode, "USD")));
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,8 @@ public class DisplayUtilsTest {
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
Locale.setDefault(new Locale("en", "US"));
|
Locale.setDefault(new Locale("en", "US"));
|
||||||
Res.setBaseCurrencyCode("BTC");
|
Res.setBaseCurrencyCode("XMR");
|
||||||
Res.setBaseCurrencyName("Bitcoin");
|
Res.setBaseCurrencyName("Monero");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -57,9 +57,9 @@ public class DisplayUtilsTest {
|
||||||
@Test
|
@Test
|
||||||
public void testFormatSameVolume() {
|
public void testFormatSameVolume() {
|
||||||
Offer offer = mock(Offer.class);
|
Offer offer = mock(Offer.class);
|
||||||
Volume btc = Volume.parse("0.10", "BTC");
|
Volume xmr = Volume.parse("0.10", "XMR");
|
||||||
when(offer.getMinVolume()).thenReturn(btc);
|
when(offer.getMinVolume()).thenReturn(xmr);
|
||||||
when(offer.getVolume()).thenReturn(btc);
|
when(offer.getVolume()).thenReturn(xmr);
|
||||||
|
|
||||||
assertEquals("0.10000000", DisplayUtils.formatVolume(offer.getVolume()));
|
assertEquals("0.10000000", DisplayUtils.formatVolume(offer.getVolume()));
|
||||||
}
|
}
|
||||||
|
@ -67,11 +67,11 @@ public class DisplayUtilsTest {
|
||||||
@Test
|
@Test
|
||||||
public void testFormatDifferentVolume() {
|
public void testFormatDifferentVolume() {
|
||||||
Offer offer = mock(Offer.class);
|
Offer offer = mock(Offer.class);
|
||||||
Volume btcMin = Volume.parse("0.10", "BTC");
|
Volume xmrMin = Volume.parse("0.10", "XMR");
|
||||||
Volume btcMax = Volume.parse("0.25", "BTC");
|
Volume xmrMax = Volume.parse("0.25", "XMR");
|
||||||
when(offer.isRange()).thenReturn(true);
|
when(offer.isRange()).thenReturn(true);
|
||||||
when(offer.getMinVolume()).thenReturn(btcMin);
|
when(offer.getMinVolume()).thenReturn(xmrMin);
|
||||||
when(offer.getVolume()).thenReturn(btcMax);
|
when(offer.getVolume()).thenReturn(xmrMax);
|
||||||
|
|
||||||
assertEquals("0.10000000 - 0.25000000", DisplayUtils.formatVolume(offer, false, 0));
|
assertEquals("0.10000000 - 0.25000000", DisplayUtils.formatVolume(offer, false, 0));
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ import java.util.Map;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import static bisq.desktop.maker.TradeCurrencyMakers.bitcoin;
|
import static bisq.desktop.maker.TradeCurrencyMakers.monero;
|
||||||
import static bisq.desktop.maker.TradeCurrencyMakers.euro;
|
import static bisq.desktop.maker.TradeCurrencyMakers.euro;
|
||||||
import static com.natpryce.makeiteasy.MakeItEasy.a;
|
import static com.natpryce.makeiteasy.MakeItEasy.a;
|
||||||
import static com.natpryce.makeiteasy.MakeItEasy.make;
|
import static com.natpryce.makeiteasy.MakeItEasy.make;
|
||||||
|
@ -57,14 +57,14 @@ public class GUIUtilTest {
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Locale.setDefault(new Locale("en", "US"));
|
Locale.setDefault(new Locale("en", "US"));
|
||||||
GlobalSettings.setLocale(new Locale("en", "US"));
|
GlobalSettings.setLocale(new Locale("en", "US"));
|
||||||
Res.setBaseCurrencyCode("BTC");
|
Res.setBaseCurrencyCode("XMR");
|
||||||
Res.setBaseCurrencyName("Bitcoin");
|
Res.setBaseCurrencyName("Monero");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTradeCurrencyConverter() {
|
public void testTradeCurrencyConverter() {
|
||||||
Map<String, Integer> offerCounts = new HashMap<>() {{
|
Map<String, Integer> offerCounts = new HashMap<>() {{
|
||||||
put("BTC", 11);
|
put("XMR", 11);
|
||||||
put("EUR", 10);
|
put("EUR", 10);
|
||||||
}};
|
}};
|
||||||
StringConverter<TradeCurrency> tradeCurrencyConverter = GUIUtil.getTradeCurrencyConverter(
|
StringConverter<TradeCurrency> tradeCurrencyConverter = GUIUtil.getTradeCurrencyConverter(
|
||||||
|
@ -73,7 +73,7 @@ public class GUIUtilTest {
|
||||||
offerCounts
|
offerCounts
|
||||||
);
|
);
|
||||||
|
|
||||||
assertEquals("✦ Bitcoin (BTC) - 11 offers", tradeCurrencyConverter.toString(bitcoin));
|
assertEquals("✦ Monero (XMR) - 11 offers", tradeCurrencyConverter.toString(monero));
|
||||||
assertEquals("★ Euro (EUR) - 10 offers", tradeCurrencyConverter.toString(euro));
|
assertEquals("★ Euro (EUR) - 10 offers", tradeCurrencyConverter.toString(euro));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,8 +44,8 @@ public class ImmutableCoinFormatterTest {
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
Locale.setDefault(new Locale("en", "US"));
|
Locale.setDefault(new Locale("en", "US"));
|
||||||
Res.setBaseCurrencyCode("BTC");
|
Res.setBaseCurrencyCode("XMR");
|
||||||
Res.setBaseCurrencyName("Bitcoin");
|
Res.setBaseCurrencyName("Monero");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -14,8 +14,8 @@ public class AccountNrValidatorTest {
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Locale.setDefault(new Locale("en", "US"));
|
Locale.setDefault(new Locale("en", "US"));
|
||||||
Res.setBaseCurrencyCode("BTC");
|
Res.setBaseCurrencyCode("XMR");
|
||||||
Res.setBaseCurrencyName("Bitcoin");
|
Res.setBaseCurrencyName("Monero");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -15,8 +15,8 @@ public class BranchIdValidatorTest {
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Locale.setDefault(new Locale("en", "US"));
|
Locale.setDefault(new Locale("en", "US"));
|
||||||
Res.setBaseCurrencyCode("BTC");
|
Res.setBaseCurrencyCode("XMR");
|
||||||
Res.setBaseCurrencyName("Bitcoin");
|
Res.setBaseCurrencyName("Monero");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -15,8 +15,8 @@ public class NationalAccountIdValidatorTest {
|
||||||
@Before
|
@Before
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Locale.setDefault(new Locale("en", "US"));
|
Locale.setDefault(new Locale("en", "US"));
|
||||||
Res.setBaseCurrencyCode("BTC");
|
Res.setBaseCurrencyCode("XMR");
|
||||||
Res.setBaseCurrencyName("Bitcoin");
|
Res.setBaseCurrencyName("Monero");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
Loading…
Reference in a new issue