diff --git a/apitest/docs/api-beta-test-guide.md b/apitest/docs/api-beta-test-guide.md index 5eb57131f0..1d79ec1a00 100644 --- a/apitest/docs/api-beta-test-guide.md +++ b/apitest/docs/api-beta-test-guide.md @@ -399,7 +399,7 @@ $ ./bisq-cli --password=xyz --port=9998 getmyoffers --direction= --cur To look at a specific offer you created: ``` -$ ./bisq-cli --password=xyz --port=9998 getmyoffer --offer-id= +$ ./bisq-cli --password=xyz --port=9998 getoffer --offer-id= ``` ### Browsing Available Offers diff --git a/apitest/scripts/bsqswap-simulation.sh b/apitest/scripts/bsqswap-simulation.sh index 482a0fc40c..96ecf2cef4 100755 --- a/apitest/scripts/bsqswap-simulation.sh +++ b/apitest/scripts/bsqswap-simulation.sh @@ -60,7 +60,7 @@ sleeptraced 2 # Show Alice's new bsq swap offer. printdate "Alice looking at her new $DIRECTION $CURRENCY_CODE offer." -CMD="$CLI_BASE --port=$ALICE_PORT getmyoffer --offer-id=$OFFER_ID" +CMD="$CLI_BASE --port=$ALICE_PORT getoffer --offer-id=$OFFER_ID" printdate "ALICE CLI: $CMD" OFFER=$($CMD) exitoncommandalert $? diff --git a/apitest/scripts/limit-order-simulation.sh b/apitest/scripts/limit-order-simulation.sh index 3ee50b63dd..5636b0758d 100755 --- a/apitest/scripts/limit-order-simulation.sh +++ b/apitest/scripts/limit-order-simulation.sh @@ -135,7 +135,7 @@ sleeptraced 3 # Show Alice's new offer. printdate "ALICE: Looking at her new $DIRECTION $CURRENCY_CODE offer." -CMD="$CLI_BASE --port=$ALICE_PORT getmyoffer --offer-id=$OFFER_ID" +CMD="$CLI_BASE --port=$ALICE_PORT getoffer --offer-id=$OFFER_ID" printdate "ALICE CLI: $CMD" OFFER=$($CMD) exitoncommandalert $? diff --git a/apitest/scripts/rolling-offer-simulation.sh b/apitest/scripts/rolling-offer-simulation.sh index 3bbfba4eb5..48fc431f63 100755 --- a/apitest/scripts/rolling-offer-simulation.sh +++ b/apitest/scripts/rolling-offer-simulation.sh @@ -94,7 +94,7 @@ while : ; do # Show Alice's new offer. printdate "ALICE $ALICE_ROLE: Looking at her new $DIRECTION $CURRENCY_CODE offer." - CMD="$CLI_BASE --port=$ALICE_PORT getmyoffer --offer-id=$OFFER_ID" + CMD="$CLI_BASE --port=$ALICE_PORT getoffer --offer-id=$OFFER_ID" printdate "ALICE CLI: $CMD" OFFER=$($CMD) exitoncommandalert $? diff --git a/apitest/scripts/trade-simulation.sh b/apitest/scripts/trade-simulation.sh index 0af66535aa..5be7659cd4 100755 --- a/apitest/scripts/trade-simulation.sh +++ b/apitest/scripts/trade-simulation.sh @@ -95,7 +95,7 @@ sleeptraced 3 # Show Alice's new offer. printdate "ALICE $ALICE_ROLE: Looking at her new $DIRECTION $CURRENCY_CODE offer." -CMD="$CLI_BASE --port=$ALICE_PORT getmyoffer --offer-id=$OFFER_ID" +CMD="$CLI_BASE --port=$ALICE_PORT getoffer --offer-id=$OFFER_ID" printdate "ALICE CLI: $CMD" OFFER=$($CMD) exitoncommandalert $? diff --git a/apitest/scripts/trade-xmr-simulation.sh b/apitest/scripts/trade-xmr-simulation.sh index 8d48649635..e361353da9 100755 --- a/apitest/scripts/trade-xmr-simulation.sh +++ b/apitest/scripts/trade-xmr-simulation.sh @@ -92,7 +92,7 @@ sleeptraced 3 # Show Alice's new offer. printdate "ALICE $ALICE_ROLE: Looking at her new $DIRECTION $CURRENCY_CODE offer." -CMD="$CLI_BASE --port=$ALICE_PORT getmyoffer --offer-id=$OFFER_ID" +CMD="$CLI_BASE --port=$ALICE_PORT getoffer --offer-id=$OFFER_ID" printdate "ALICE CLI: $CMD" OFFER=$($CMD) exitoncommandalert $? diff --git a/apitest/src/test/java/bisq/apitest/method/offer/BsqSwapOfferTest.java b/apitest/src/test/java/bisq/apitest/method/offer/BsqSwapOfferTest.java index 2810938f5c..c506794201 100644 --- a/apitest/src/test/java/bisq/apitest/method/offer/BsqSwapOfferTest.java +++ b/apitest/src/test/java/bisq/apitest/method/offer/BsqSwapOfferTest.java @@ -132,7 +132,7 @@ public class BsqSwapOfferTest extends AbstractOfferTest { while (true) { try { numFetchAttempts++; - var fetchedBsqSwapOffer = aliceClient.getMyOffer(bsqSwapOffer.getId()); + var fetchedBsqSwapOffer = aliceClient.getOffer(bsqSwapOffer.getId()); assertEquals(bsqSwapOffer.getId(), fetchedBsqSwapOffer.getId()); log.debug("Alice found her (my) new bsq swap offer on attempt # {}.", numFetchAttempts); break; diff --git a/apitest/src/test/java/bisq/apitest/method/offer/CreateBSQOffersTest.java b/apitest/src/test/java/bisq/apitest/method/offer/CreateBSQOffersTest.java index 0f2c970284..43f87fd156 100644 --- a/apitest/src/test/java/bisq/apitest/method/offer/CreateBSQOffersTest.java +++ b/apitest/src/test/java/bisq/apitest/method/offer/CreateBSQOffersTest.java @@ -85,7 +85,7 @@ public class CreateBSQOffersTest extends AbstractOfferTest { genBtcBlockAndWaitForOfferPreparation(); - newOffer = aliceClient.getMyOffer(newOfferId); + newOffer = aliceClient.getOffer(newOfferId); assertTrue(newOffer.getIsMyOffer()); assertFalse(newOffer.getIsMyPendingOffer()); assertEquals(newOfferId, newOffer.getId()); @@ -132,7 +132,7 @@ public class CreateBSQOffersTest extends AbstractOfferTest { genBtcBlockAndWaitForOfferPreparation(); - newOffer = aliceClient.getMyOffer(newOfferId); + newOffer = aliceClient.getOffer(newOfferId); assertTrue(newOffer.getIsMyOffer()); assertFalse(newOffer.getIsMyPendingOffer()); assertEquals(newOfferId, newOffer.getId()); @@ -179,7 +179,7 @@ public class CreateBSQOffersTest extends AbstractOfferTest { genBtcBlockAndWaitForOfferPreparation(); - newOffer = aliceClient.getMyOffer(newOfferId); + newOffer = aliceClient.getOffer(newOfferId); assertTrue(newOffer.getIsMyOffer()); assertFalse(newOffer.getIsMyPendingOffer()); assertEquals(newOfferId, newOffer.getId()); @@ -226,7 +226,7 @@ public class CreateBSQOffersTest extends AbstractOfferTest { genBtcBlockAndWaitForOfferPreparation(); - newOffer = aliceClient.getMyOffer(newOfferId); + newOffer = aliceClient.getOffer(newOfferId); assertTrue(newOffer.getIsMyOffer()); assertFalse(newOffer.getIsMyPendingOffer()); assertEquals(newOfferId, newOffer.getId()); diff --git a/apitest/src/test/java/bisq/apitest/method/offer/CreateOfferUsingFixedPriceTest.java b/apitest/src/test/java/bisq/apitest/method/offer/CreateOfferUsingFixedPriceTest.java index d24840f669..7ec7d98d1d 100644 --- a/apitest/src/test/java/bisq/apitest/method/offer/CreateOfferUsingFixedPriceTest.java +++ b/apitest/src/test/java/bisq/apitest/method/offer/CreateOfferUsingFixedPriceTest.java @@ -75,7 +75,7 @@ public class CreateOfferUsingFixedPriceTest extends AbstractOfferTest { assertEquals("AUD", newOffer.getCounterCurrencyCode()); assertFalse(newOffer.getIsCurrencyForMakerFeeBtc()); - newOffer = aliceClient.getMyOffer(newOfferId); + newOffer = aliceClient.getOffer(newOfferId); assertTrue(newOffer.getIsMyOffer()); assertFalse(newOffer.getIsMyPendingOffer()); assertEquals(newOfferId, newOffer.getId()); @@ -120,7 +120,7 @@ public class CreateOfferUsingFixedPriceTest extends AbstractOfferTest { assertEquals(USD, newOffer.getCounterCurrencyCode()); assertFalse(newOffer.getIsCurrencyForMakerFeeBtc()); - newOffer = aliceClient.getMyOffer(newOfferId); + newOffer = aliceClient.getOffer(newOfferId); assertTrue(newOffer.getIsMyOffer()); assertFalse(newOffer.getIsMyPendingOffer()); assertEquals(newOfferId, newOffer.getId()); @@ -165,7 +165,7 @@ public class CreateOfferUsingFixedPriceTest extends AbstractOfferTest { assertEquals(EUR, newOffer.getCounterCurrencyCode()); assertFalse(newOffer.getIsCurrencyForMakerFeeBtc()); - newOffer = aliceClient.getMyOffer(newOfferId); + newOffer = aliceClient.getOffer(newOfferId); assertTrue(newOffer.getIsMyOffer()); assertFalse(newOffer.getIsMyPendingOffer()); assertEquals(newOfferId, newOffer.getId()); diff --git a/apitest/src/test/java/bisq/apitest/method/offer/CreateOfferUsingMarketPriceMarginTest.java b/apitest/src/test/java/bisq/apitest/method/offer/CreateOfferUsingMarketPriceMarginTest.java index f40565ed61..cce443206a 100644 --- a/apitest/src/test/java/bisq/apitest/method/offer/CreateOfferUsingMarketPriceMarginTest.java +++ b/apitest/src/test/java/bisq/apitest/method/offer/CreateOfferUsingMarketPriceMarginTest.java @@ -96,7 +96,7 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest { assertEquals(USD, newOffer.getCounterCurrencyCode()); assertTrue(newOffer.getIsCurrencyForMakerFeeBtc()); - newOffer = aliceClient.getMyOffer(newOfferId); + newOffer = aliceClient.getOffer(newOfferId); assertTrue(newOffer.getIsMyOffer()); assertFalse(newOffer.getIsMyPendingOffer()); assertEquals(newOfferId, newOffer.getId()); @@ -143,7 +143,7 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest { assertEquals("NZD", newOffer.getCounterCurrencyCode()); assertTrue(newOffer.getIsCurrencyForMakerFeeBtc()); - newOffer = aliceClient.getMyOffer(newOfferId); + newOffer = aliceClient.getOffer(newOfferId); assertTrue(newOffer.getIsMyOffer()); assertFalse(newOffer.getIsMyPendingOffer()); assertEquals(newOfferId, newOffer.getId()); @@ -190,7 +190,7 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest { assertEquals("GBP", newOffer.getCounterCurrencyCode()); assertTrue(newOffer.getIsCurrencyForMakerFeeBtc()); - newOffer = aliceClient.getMyOffer(newOfferId); + newOffer = aliceClient.getOffer(newOfferId); assertTrue(newOffer.getIsMyOffer()); assertFalse(newOffer.getIsMyPendingOffer()); assertEquals(newOfferId, newOffer.getId()); @@ -237,7 +237,7 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest { assertEquals("BRL", newOffer.getCounterCurrencyCode()); assertTrue(newOffer.getIsCurrencyForMakerFeeBtc()); - newOffer = aliceClient.getMyOffer(newOfferId); + newOffer = aliceClient.getOffer(newOfferId); assertTrue(newOffer.getIsMyOffer()); assertFalse(newOffer.getIsMyPendingOffer()); assertEquals(newOfferId, newOffer.getId()); @@ -276,7 +276,7 @@ public class CreateOfferUsingMarketPriceMarginTest extends AbstractOfferTest { assertTrue(newOffer.getIsMyPendingOffer()); genBtcBlocksThenWait(1, 4000); // give time to add to offer book - newOffer = aliceClient.getMyOffer(newOffer.getId()); + newOffer = aliceClient.getOffer(newOffer.getId()); log.debug("OFFER #5:\n{}", toOfferTable.apply(newOffer)); assertTrue(newOffer.getIsMyOffer()); assertFalse(newOffer.getIsMyPendingOffer()); diff --git a/apitest/src/test/java/bisq/apitest/method/offer/CreateXMROffersTest.java b/apitest/src/test/java/bisq/apitest/method/offer/CreateXMROffersTest.java index 6cf609498a..cf40632e8d 100644 --- a/apitest/src/test/java/bisq/apitest/method/offer/CreateXMROffersTest.java +++ b/apitest/src/test/java/bisq/apitest/method/offer/CreateXMROffersTest.java @@ -88,7 +88,7 @@ public class CreateXMROffersTest extends AbstractOfferTest { genBtcBlockAndWaitForOfferPreparation(); - newOffer = aliceClient.getMyOffer(newOfferId); + newOffer = aliceClient.getOffer(newOfferId); assertTrue(newOffer.getIsMyOffer()); assertFalse(newOffer.getIsMyPendingOffer()); assertEquals(newOfferId, newOffer.getId()); @@ -135,7 +135,7 @@ public class CreateXMROffersTest extends AbstractOfferTest { genBtcBlockAndWaitForOfferPreparation(); - newOffer = aliceClient.getMyOffer(newOfferId); + newOffer = aliceClient.getOffer(newOfferId); assertTrue(newOffer.getIsMyOffer()); assertFalse(newOffer.getIsMyPendingOffer()); assertEquals(newOfferId, newOffer.getId()); @@ -188,7 +188,7 @@ public class CreateXMROffersTest extends AbstractOfferTest { genBtcBlockAndWaitForOfferPreparation(); - newOffer = aliceClient.getMyOffer(newOfferId); + newOffer = aliceClient.getOffer(newOfferId); log.debug("Available Sell XMR (Buy BTC) offer:\n{}", toOfferTable.apply(newOffer)); assertTrue(newOffer.getIsMyOffer()); assertFalse(newOffer.getIsMyPendingOffer()); @@ -240,7 +240,7 @@ public class CreateXMROffersTest extends AbstractOfferTest { genBtcBlockAndWaitForOfferPreparation(); - newOffer = aliceClient.getMyOffer(newOfferId); + newOffer = aliceClient.getOffer(newOfferId); assertTrue(newOffer.getIsMyOffer()); assertFalse(newOffer.getIsMyPendingOffer()); assertEquals(newOfferId, newOffer.getId()); diff --git a/apitest/src/test/java/bisq/apitest/method/offer/EditOfferTest.java b/apitest/src/test/java/bisq/apitest/method/offer/EditOfferTest.java index 70e7ce7a96..33944dece8 100644 --- a/apitest/src/test/java/bisq/apitest/method/offer/EditOfferTest.java +++ b/apitest/src/test/java/bisq/apitest/method/offer/EditOfferTest.java @@ -68,19 +68,19 @@ public class EditOfferTest extends AbstractOfferTest { log.debug("Original EUR offer:\n{}", toOfferTable.apply(originalOffer)); assertFalse(originalOffer.getIsActivated()); // Not activated until prep is done. genBtcBlocksThenWait(1, 2_500); // Wait for offer book entry. - originalOffer = aliceClient.getMyOffer(originalOffer.getId()); + originalOffer = aliceClient.getOffer(originalOffer.getId()); assertTrue(originalOffer.getIsActivated()); // Disable offer aliceClient.editOfferActivationState(originalOffer.getId(), DEACTIVATE_OFFER); genBtcBlocksThenWait(1, 1500); // Wait for offer book removal. - OfferInfo editedOffer = aliceClient.getMyOffer(originalOffer.getId()); + OfferInfo editedOffer = aliceClient.getOffer(originalOffer.getId()); log.debug("Edited EUR offer:\n{}", toOfferTable.apply(editedOffer)); assertFalse(editedOffer.getIsActivated()); assertTrue(editedOffer.getUseMarketBasedPrice()); // Re-enable offer aliceClient.editOfferActivationState(editedOffer.getId(), ACTIVATE_OFFER); genBtcBlocksThenWait(1, 1500); // Wait for offer book re-entry. - editedOffer = aliceClient.getMyOffer(originalOffer.getId()); + editedOffer = aliceClient.getOffer(originalOffer.getId()); log.debug("Edited EUR offer:\n{}", toOfferTable.apply(editedOffer)); assertTrue(editedOffer.getIsActivated()); assertTrue(editedOffer.getUseMarketBasedPrice()); @@ -99,7 +99,7 @@ public class EditOfferTest extends AbstractOfferTest { NO_TRIGGER_PRICE); log.debug("Original EUR offer:\n{}", toOfferTable.apply(originalOffer)); genBtcBlocksThenWait(1, 2_500); // Wait for offer book entry. - originalOffer = aliceClient.getMyOffer(originalOffer.getId()); + originalOffer = aliceClient.getOffer(originalOffer.getId()); assertEquals(0 /*no trigger price*/, originalOffer.getTriggerPrice()); // Edit the offer's trigger price, nothing else. @@ -109,7 +109,7 @@ public class EditOfferTest extends AbstractOfferTest { aliceClient.editOfferTriggerPrice(originalOffer.getId(), newTriggerPriceAsLong); sleep(2_500); // Wait for offer book re-entry. - OfferInfo editedOffer = aliceClient.getMyOffer(originalOffer.getId()); + OfferInfo editedOffer = aliceClient.getOffer(originalOffer.getId()); log.debug("Edited EUR offer:\n{}", toOfferTable.apply(editedOffer)); assertEquals(newTriggerPriceAsLong, editedOffer.getTriggerPrice()); assertTrue(editedOffer.getUseMarketBasedPrice()); @@ -153,7 +153,7 @@ public class EditOfferTest extends AbstractOfferTest { // Edit the offer's price margin, nothing else. var newMktPriceMargin = new BigDecimal("0.5").doubleValue(); aliceClient.editOfferPriceMargin(originalOffer.getId(), newMktPriceMargin); - OfferInfo editedOffer = aliceClient.getMyOffer(originalOffer.getId()); + OfferInfo editedOffer = aliceClient.getOffer(originalOffer.getId()); log.debug("Edited USD offer:\n{}", toOfferTable.apply(editedOffer)); assertEquals(scaledDownMktPriceMargin.apply(newMktPriceMargin), editedOffer.getMarketPriceMargin()); assertTrue(editedOffer.getUseMarketBasedPrice()); @@ -178,7 +178,7 @@ public class EditOfferTest extends AbstractOfferTest { aliceClient.editOfferFixedPrice(originalOffer.getId(), editedFixedPriceAsString); // Wait for edited offer to be removed from offer-book, edited, and re-published. genBtcBlocksThenWait(1, 2_500); - OfferInfo editedOffer = aliceClient.getMyOffer(originalOffer.getId()); + OfferInfo editedOffer = aliceClient.getOffer(originalOffer.getId()); log.debug("Edited RUB offer:\n{}", toOfferTable.apply(editedOffer)); var expectedNewFixedPrice = scaledUpFiatOfferPrice.apply(new BigDecimal(editedFixedPriceAsString)); assertEquals(expectedNewFixedPrice, editedOffer.getPrice()); @@ -210,7 +210,7 @@ public class EditOfferTest extends AbstractOfferTest { FIXED_PRICE_AND_ACTIVATION_STATE); // Wait for edited offer to be removed from offer-book, edited, and re-published. genBtcBlocksThenWait(1, 2_500); - OfferInfo editedOffer = aliceClient.getMyOffer(originalOffer.getId()); + OfferInfo editedOffer = aliceClient.getOffer(originalOffer.getId()); log.debug("Edited RUB offer:\n{}", toOfferTable.apply(editedOffer)); var expectedNewFixedPrice = scaledUpFiatOfferPrice.apply(new BigDecimal(editedFixedPriceAsString)); assertEquals(expectedNewFixedPrice, editedOffer.getPrice()); @@ -233,7 +233,7 @@ public class EditOfferTest extends AbstractOfferTest { 0); log.debug("Original USD offer:\n{}", toOfferTable.apply(originalOffer)); genBtcBlocksThenWait(1, 2_500); // Wait for offer book entry. - originalOffer = aliceClient.getMyOffer(originalOffer.getId()); + originalOffer = aliceClient.getOffer(originalOffer.getId()); assertEquals(scaledDownMktPriceMargin.apply(originalMktPriceMargin), originalOffer.getMarketPriceMargin()); // Edit the offer's price margin and trigger price, and deactivate it. @@ -247,7 +247,7 @@ public class EditOfferTest extends AbstractOfferTest { MKT_PRICE_MARGIN_AND_ACTIVATION_STATE); // Wait for edited offer to be removed from offer-book, edited, and re-published. genBtcBlocksThenWait(1, 2_500); - OfferInfo editedOffer = aliceClient.getMyOffer(originalOffer.getId()); + OfferInfo editedOffer = aliceClient.getOffer(originalOffer.getId()); log.debug("Edited USD offer:\n{}", toOfferTable.apply(editedOffer)); assertEquals(scaledDownMktPriceMargin.apply(newMktPriceMargin), editedOffer.getMarketPriceMargin()); assertEquals(0, editedOffer.getTriggerPrice()); @@ -271,7 +271,7 @@ public class EditOfferTest extends AbstractOfferTest { originalTriggerPriceAsLong); log.debug("Original USD offer:\n{}", toOfferTable.apply(originalOffer)); genBtcBlocksThenWait(1, 2_500); // Wait for offer book entry. - originalOffer = aliceClient.getMyOffer(originalOffer.getId()); + originalOffer = aliceClient.getOffer(originalOffer.getId()); assertEquals(scaledDownMktPriceMargin.apply(originalMktPriceMargin), originalOffer.getMarketPriceMargin()); assertEquals(originalTriggerPriceAsLong, originalOffer.getTriggerPrice()); @@ -287,7 +287,7 @@ public class EditOfferTest extends AbstractOfferTest { MKT_PRICE_MARGIN_AND_TRIGGER_PRICE_AND_ACTIVATION_STATE); // Wait for edited offer to be removed from offer-book, edited, and re-published. genBtcBlocksThenWait(1, 2_500); - OfferInfo editedOffer = aliceClient.getMyOffer(originalOffer.getId()); + OfferInfo editedOffer = aliceClient.getOffer(originalOffer.getId()); log.debug("Edited USD offer:\n{}", toOfferTable.apply(editedOffer)); assertEquals(scaledDownMktPriceMargin.apply(newMktPriceMargin), editedOffer.getMarketPriceMargin()); assertEquals(newTriggerPriceAsLong, editedOffer.getTriggerPrice()); @@ -375,7 +375,7 @@ public class EditOfferTest extends AbstractOfferTest { MKT_PRICE_MARGIN_AND_TRIGGER_PRICE); // Wait for edited offer to be removed from offer-book, edited, and re-published. genBtcBlocksThenWait(1, 2_500); - OfferInfo editedOffer = aliceClient.getMyOffer(originalOffer.getId()); + OfferInfo editedOffer = aliceClient.getOffer(originalOffer.getId()); log.debug("Edited MXN offer:\n{}", toOfferTable.apply(editedOffer)); assertTrue(editedOffer.getUseMarketBasedPrice()); assertEquals(scaledDownMktPriceMargin.apply(newMktPriceMargin), editedOffer.getMarketPriceMargin()); @@ -411,7 +411,7 @@ public class EditOfferTest extends AbstractOfferTest { FIXED_PRICE_AND_ACTIVATION_STATE); // Wait for edited offer to be removed from offer-book, edited, and re-published. genBtcBlocksThenWait(1, 2_500); - OfferInfo editedOffer = aliceClient.getMyOffer(originalOffer.getId()); + OfferInfo editedOffer = aliceClient.getOffer(originalOffer.getId()); log.debug("Edited GBP offer:\n{}", toOfferTable.apply(editedOffer)); assertEquals(scaledUpFiatOfferPrice.apply(new BigDecimal(fixedPriceAsString)), editedOffer.getPrice()); assertFalse(editedOffer.getUseMarketBasedPrice()); @@ -499,7 +499,7 @@ public class EditOfferTest extends AbstractOfferTest { FIXED_PRICE_ONLY); // Wait for edited offer to be edited and removed from offer-book. genBtcBlocksThenWait(1, 2_500); - OfferInfo editedOffer = aliceClient.getMyOffer(originalOffer.getId()); + OfferInfo editedOffer = aliceClient.getOffer(originalOffer.getId()); log.debug("Edited BSQ offer:\n{}", toOfferTable.apply(editedOffer)); assertEquals(scaledUpAltcoinOfferPrice.apply(newFixedPriceAsString), editedOffer.getPrice()); assertTrue(editedOffer.getIsActivated()); @@ -531,7 +531,7 @@ public class EditOfferTest extends AbstractOfferTest { ACTIVATION_STATE_ONLY); // Wait for edited offer to be removed from offer-book. genBtcBlocksThenWait(1, 2_500); - OfferInfo editedOffer = aliceClient.getMyOffer(originalOffer.getId()); + OfferInfo editedOffer = aliceClient.getOffer(originalOffer.getId()); log.debug("Edited BSQ offer:\n{}", toOfferTable.apply(editedOffer)); assertFalse(editedOffer.getIsActivated()); assertEquals(scaledUpAltcoinOfferPrice.apply(fixedPriceAsString), editedOffer.getPrice()); @@ -564,7 +564,7 @@ public class EditOfferTest extends AbstractOfferTest { FIXED_PRICE_AND_ACTIVATION_STATE); // Wait for edited offer to be edited and removed from offer-book. genBtcBlocksThenWait(1, 2_500); - OfferInfo editedOffer = aliceClient.getMyOffer(originalOffer.getId()); + OfferInfo editedOffer = aliceClient.getOffer(originalOffer.getId()); log.debug("Edited BSQ offer:\n{}", toOfferTable.apply(editedOffer)); assertFalse(editedOffer.getIsActivated()); assertEquals(scaledUpAltcoinOfferPrice.apply(newFixedPriceAsString), editedOffer.getPrice()); @@ -589,7 +589,7 @@ public class EditOfferTest extends AbstractOfferTest { log.debug("Pending XMR offer:\n{}", toOfferTable.apply(originalOffer)); genBtcBlocksThenWait(1, 2500); // Wait for offer book entry. - originalOffer = aliceClient.getMyOffer(originalOffer.getId()); + originalOffer = aliceClient.getOffer(originalOffer.getId()); log.debug("Original XMR offer:\n{}", toOfferTable.apply(originalOffer)); String newFixedPriceAsString = calcPriceAsString.apply(mktPriceAsDouble, -0.001); @@ -602,7 +602,7 @@ public class EditOfferTest extends AbstractOfferTest { FIXED_PRICE_AND_ACTIVATION_STATE); // Wait for edited offer to be removed from offer-book, edited & not re-published. genBtcBlocksThenWait(1, 2500); - OfferInfo editedOffer = aliceClient.getMyOffer(originalOffer.getId()); + OfferInfo editedOffer = aliceClient.getOffer(originalOffer.getId()); log.debug("Edited XMR offer:\n{}", toOfferTable.apply(editedOffer)); assertEquals(scaledUpAltcoinOfferPrice.apply(newFixedPriceAsString), editedOffer.getPrice()); assertFalse(editedOffer.getUseMarketBasedPrice()); @@ -626,7 +626,7 @@ public class EditOfferTest extends AbstractOfferTest { log.debug("Pending XMR offer:\n{}", toOfferTable.apply(originalOffer)); genBtcBlocksThenWait(1, 2500); // Wait for offer book entry. - originalOffer = aliceClient.getMyOffer(originalOffer.getId()); + originalOffer = aliceClient.getOffer(originalOffer.getId()); log.info("Original XMR offer:\n{}", toOfferTable.apply(originalOffer)); double mktPriceAsDouble = aliceClient.getBtcPrice(XMR); @@ -640,7 +640,7 @@ public class EditOfferTest extends AbstractOfferTest { TRIGGER_PRICE_ONLY); // Wait for edited offer to be removed from offer-book, edited & not re-published. genBtcBlocksThenWait(1, 2500); - OfferInfo editedOffer = aliceClient.getMyOffer(originalOffer.getId()); + OfferInfo editedOffer = aliceClient.getOffer(originalOffer.getId()); log.info("Edited XMR offer:\n{}", toOfferTable.apply(editedOffer)); assertTrue(editedOffer.getUseMarketBasedPrice()); assertEquals(scaledDownMktPriceMargin.apply(mktPriceMargin), editedOffer.getMarketPriceMargin()); @@ -667,7 +667,7 @@ public class EditOfferTest extends AbstractOfferTest { log.debug("Pending XMR offer:\n{}", toOfferTable.apply(originalOffer)); genBtcBlocksThenWait(1, 2500); // Wait for offer book entry. - originalOffer = aliceClient.getMyOffer(originalOffer.getId()); + originalOffer = aliceClient.getOffer(originalOffer.getId()); log.debug("Original XMR offer:\n{}", toOfferTable.apply(originalOffer)); // Change the offer to mkt price based and set a trigger price. @@ -683,7 +683,7 @@ public class EditOfferTest extends AbstractOfferTest { MKT_PRICE_MARGIN_AND_TRIGGER_PRICE); // Wait for edited offer to be removed from offer-book, edited, and re-published. genBtcBlocksThenWait(1, 2500); - OfferInfo editedOffer = aliceClient.getMyOffer(originalOffer.getId()); + OfferInfo editedOffer = aliceClient.getOffer(originalOffer.getId()); log.debug("Edited XMR offer:\n{}", toOfferTable.apply(editedOffer)); assertTrue(editedOffer.getUseMarketBasedPrice()); assertEquals(scaledDownMktPriceMargin.apply(newMktPriceMargin), editedOffer.getMarketPriceMargin()); @@ -748,7 +748,7 @@ public class EditOfferTest extends AbstractOfferTest { FIXED_PRICE_ONLY); // Wait for edited offer to be edited and removed from offer-book. genBtcBlocksThenWait(1, 2500); - OfferInfo editedOffer = aliceClient.getMyOffer(originalOffer.getId()); + OfferInfo editedOffer = aliceClient.getOffer(originalOffer.getId()); log.debug("Edited XMR offer:\n{}", toOfferTable.apply(editedOffer)); assertEquals(scaledUpAltcoinOfferPrice.apply(newFixedPriceAsString), editedOffer.getPrice()); assertTrue(editedOffer.getIsActivated()); @@ -781,7 +781,7 @@ public class EditOfferTest extends AbstractOfferTest { ACTIVATION_STATE_ONLY); // Wait for edited offer to be removed from offer-book. genBtcBlocksThenWait(1, 2500); - OfferInfo editedOffer = aliceClient.getMyOffer(originalOffer.getId()); + OfferInfo editedOffer = aliceClient.getOffer(originalOffer.getId()); log.debug("Edited XMR offer:\n{}", toOfferTable.apply(editedOffer)); assertFalse(editedOffer.getIsActivated()); assertEquals(scaledUpAltcoinOfferPrice.apply(fixedPriceAsString), editedOffer.getPrice()); @@ -815,7 +815,7 @@ public class EditOfferTest extends AbstractOfferTest { FIXED_PRICE_AND_ACTIVATION_STATE); // Wait for edited offer to be edited and removed from offer-book. genBtcBlocksThenWait(1, 2500); - OfferInfo editedOffer = aliceClient.getMyOffer(originalOffer.getId()); + OfferInfo editedOffer = aliceClient.getOffer(originalOffer.getId()); log.debug("Edited XMR offer:\n{}", toOfferTable.apply(editedOffer)); assertFalse(editedOffer.getIsActivated()); assertEquals(scaledUpAltcoinOfferPrice.apply(newFixedPriceAsString), editedOffer.getPrice()); diff --git a/apitest/src/test/java/bisq/apitest/method/trade/BsqSwapTradeTest.java b/apitest/src/test/java/bisq/apitest/method/trade/BsqSwapTradeTest.java index 8938231c74..bbf2074c7b 100644 --- a/apitest/src/test/java/bisq/apitest/method/trade/BsqSwapTradeTest.java +++ b/apitest/src/test/java/bisq/apitest/method/trade/BsqSwapTradeTest.java @@ -98,7 +98,7 @@ public class BsqSwapTradeTest extends AbstractTradeTest { genBtcBlocksThenWait(1, 2_500); - mySwapOffer = aliceClient.getMyOffer(newOfferId); + mySwapOffer = aliceClient.getOffer(newOfferId); log.debug("My fetched BsqSwap Sell BSQ (Buy BTC) OFFER:\n{}", toOfferTable.apply(mySwapOffer)); assertNotEquals(0, mySwapOffer.getMakerFee()); diff --git a/apitest/src/test/java/bisq/apitest/scenario/LongRunningOfferDeactivationTest.java b/apitest/src/test/java/bisq/apitest/scenario/LongRunningOfferDeactivationTest.java index 39660d42a3..61904bfad8 100644 --- a/apitest/src/test/java/bisq/apitest/scenario/LongRunningOfferDeactivationTest.java +++ b/apitest/src/test/java/bisq/apitest/scenario/LongRunningOfferDeactivationTest.java @@ -75,13 +75,13 @@ public class LongRunningOfferDeactivationTest extends AbstractOfferTest { formatPrice(offer.getPrice())); genBtcBlocksThenWait(1, 2500); // Wait for offer book entry. - offer = aliceClient.getMyOffer(offer.getId()); // Offer has trigger price now. + offer = aliceClient.getOffer(offer.getId()); // Offer has trigger price now. log.info("SELL offer should be automatically disabled when mkt price falls below {}.", formatPrice(offer.getTriggerPrice())); int numIterations = 0; while (++numIterations < MAX_ITERATIONS) { - offer = aliceClient.getMyOffer(offer.getId()); + offer = aliceClient.getOffer(offer.getId()); var mktPrice = aliceClient.getBtcPrice("USD"); if (offer.getIsActivated()) { @@ -123,13 +123,13 @@ public class LongRunningOfferDeactivationTest extends AbstractOfferTest { formatPrice(offer.getPrice())); genBtcBlocksThenWait(1, 2500); // Wait for offer book entry. - offer = aliceClient.getMyOffer(offer.getId()); // Offer has trigger price now. + offer = aliceClient.getOffer(offer.getId()); // Offer has trigger price now. log.info("BUY offer should be automatically disabled when mkt price rises above {}.", formatPrice(offer.getTriggerPrice())); int numIterations = 0; while (++numIterations < MAX_ITERATIONS) { - offer = aliceClient.getMyOffer(offer.getId()); + offer = aliceClient.getOffer(offer.getId()); var mktPrice = aliceClient.getBtcPrice("USD"); if (offer.getIsActivated()) { diff --git a/cli/src/main/java/bisq/cli/CliMain.java b/cli/src/main/java/bisq/cli/CliMain.java index 5689fbdad0..1170774e3e 100644 --- a/cli/src/main/java/bisq/cli/CliMain.java +++ b/cli/src/main/java/bisq/cli/CliMain.java @@ -753,7 +753,7 @@ public class CliMain { // how to scale the trigger-price (for a fiat or altcoin offer) param sent // to the server in its 'editoffer' request. That means a preliminary round // trip to the server: a 'getmyoffer' request. - var offer = client.getMyOffer(offerId); + var offer = client.getOffer(offerId); if (offer.getCounterCurrencyCode().equals("BTC")) return toInternalCryptoCurrencyPrice(unscaledTriggerPrice); else diff --git a/cli/src/main/java/bisq/cli/GrpcClient.java b/cli/src/main/java/bisq/cli/GrpcClient.java index 17eb49e43c..99af68ca30 100644 --- a/cli/src/main/java/bisq/cli/GrpcClient.java +++ b/cli/src/main/java/bisq/cli/GrpcClient.java @@ -274,6 +274,8 @@ public final class GrpcClient { return offersServiceRequest.getMyBsqSwapOffer(offerId); } + @Deprecated // Since 5-Dec-2021. + // Endpoint to be removed from future version. Use getOffer service method instead. public OfferInfo getMyOffer(String offerId) { return offersServiceRequest.getMyOffer(offerId); } diff --git a/cli/src/main/java/bisq/cli/Method.java b/cli/src/main/java/bisq/cli/Method.java index 7601187731..273150aad5 100644 --- a/cli/src/main/java/bisq/cli/Method.java +++ b/cli/src/main/java/bisq/cli/Method.java @@ -32,7 +32,8 @@ public enum Method { getbalance, getbtcprice, getfundingaddresses, - getmyoffer, + @Deprecated // Since 27-Dec-2021. + getmyoffer, // Endpoint to be removed from future version. Use getoffer instead. getmyoffers, getoffer, getoffers, diff --git a/core/src/main/java/bisq/core/api/CoreApi.java b/core/src/main/java/bisq/core/api/CoreApi.java index 137f81c74c..9808d2e7d9 100644 --- a/core/src/main/java/bisq/core/api/CoreApi.java +++ b/core/src/main/java/bisq/core/api/CoreApi.java @@ -46,6 +46,7 @@ import com.google.common.util.concurrent.FutureCallback; import java.util.ArrayList; import java.util.List; +import java.util.Optional; import java.util.Set; import java.util.function.Consumer; @@ -140,10 +141,18 @@ public class CoreApi { return coreOffersService.getOffer(id); } + public Optional findAvailableOffer(String id) { + return coreOffersService.findAvailableOffer(id); + } + public OpenOffer getMyOffer(String id) { return coreOffersService.getMyOffer(id); } + public Optional findMyOpenOffer(String id) { + return coreOffersService.findMyOpenOffer(id); + } + public Offer getMyBsqSwapOffer(String id) { return coreOffersService.getMyBsqSwapOffer(id); } diff --git a/core/src/main/java/bisq/core/api/CoreOffersService.java b/core/src/main/java/bisq/core/api/CoreOffersService.java index ce6219d20c..f321ad17d0 100644 --- a/core/src/main/java/bisq/core/api/CoreOffersService.java +++ b/core/src/main/java/bisq/core/api/CoreOffersService.java @@ -145,21 +145,53 @@ class CoreOffersService { new IllegalStateException(format("offer with id '%s' not found", id))); } + Optional findAvailableOffer(String id) { + return offerBookService.getOffers().stream() + .filter(o -> o.getId().equals(id)) + .filter(o -> !o.isMyOffer(keyRing)) + .filter(o -> offerFilterService.canTakeOffer(o, coreContext.isApiUser()).isValid()) + .findAny(); + } + OpenOffer getMyOffer(String id) { return findMyOpenOffer(id).orElseThrow(() -> new IllegalStateException(format("offer with id '%s' not found", id))); } + Optional findMyOpenOffer(String id) { + return openOfferManager.getObservableList().stream() + .filter(o -> o.getId().equals(id)) + .filter(o -> o.getOffer().isMyOffer(keyRing)) + .findAny(); + } + Offer getBsqSwapOffer(String id) { return findAvailableBsqSwapOffer(id).orElseThrow(() -> new IllegalStateException(format("offer with id '%s' not found", id))); } + Optional findAvailableBsqSwapOffer(String id) { + return offerBookService.getOffers().stream() + .filter(o -> o.getId().equals(id)) + .filter(o -> !o.isMyOffer(keyRing)) + .filter(o -> offerFilterService.canTakeOffer(o, coreContext.isApiUser()).isValid()) + .filter(Offer::isBsqSwapOffer) + .findAny(); + } + Offer getMyBsqSwapOffer(String id) { return findMyBsqSwapOffer(id).orElseThrow(() -> new IllegalStateException(format("offer with id '%s' not found", id))); } + Optional findMyBsqSwapOffer(String id) { + return offerBookService.getOffers().stream() + .filter(o -> o.getId().equals(id)) + .filter(o -> o.isMyOffer(keyRing)) + .filter(Offer::isBsqSwapOffer) + .findAny(); + } + List getBsqSwapOffers(String direction) { return offerBookService.getOffers().stream() .filter(o -> !o.isMyOffer(keyRing)) @@ -364,38 +396,6 @@ class CoreOffersService { throw new IllegalStateException(offer.getErrorMessage()); } - private Optional findAvailableBsqSwapOffer(String id) { - return offerBookService.getOffers().stream() - .filter(o -> o.getId().equals(id)) - .filter(o -> !o.isMyOffer(keyRing)) - .filter(o -> offerFilterService.canTakeOffer(o, coreContext.isApiUser()).isValid()) - .filter(Offer::isBsqSwapOffer) - .findAny(); - } - - private Optional findMyBsqSwapOffer(String id) { - return offerBookService.getOffers().stream() - .filter(o -> o.getId().equals(id)) - .filter(o -> o.isMyOffer(keyRing)) - .filter(Offer::isBsqSwapOffer) - .findAny(); - } - - private Optional findAvailableOffer(String id) { - return offerBookService.getOffers().stream() - .filter(o -> o.getId().equals(id)) - .filter(o -> !o.isMyOffer(keyRing)) - .filter(o -> offerFilterService.canTakeOffer(o, coreContext.isApiUser()).isValid()) - .findAny(); - } - - private Optional findMyOpenOffer(String id) { - return openOfferManager.getObservableList().stream() - .filter(o -> o.getId().equals(id)) - .filter(o -> o.getOffer().isMyOffer(keyRing)) - .findAny(); - } - private OfferPayload getMergedOfferPayload(EditOfferValidator editOfferValidator, OpenOffer openOffer, String editedPriceAsString, diff --git a/daemon/src/main/java/bisq/daemon/grpc/GrpcOffersService.java b/daemon/src/main/java/bisq/daemon/grpc/GrpcOffersService.java index edfa09a3d6..f49881e171 100644 --- a/daemon/src/main/java/bisq/daemon/grpc/GrpcOffersService.java +++ b/daemon/src/main/java/bisq/daemon/grpc/GrpcOffersService.java @@ -58,6 +58,7 @@ import java.util.stream.Collectors; import lombok.extern.slf4j.Slf4j; +import static bisq.core.api.model.OfferInfo.toMyOfferInfo; import static bisq.core.api.model.OfferInfo.toMyPendingOfferInfo; import static bisq.core.api.model.OfferInfo.toOfferInfo; import static bisq.daemon.grpc.interceptor.GrpcServiceRateMeteringConfig.getCustomRateMeteringInterceptor; @@ -122,9 +123,13 @@ class GrpcOffersService extends OffersImplBase { public void getOffer(GetOfferRequest req, StreamObserver responseObserver) { try { - Offer offer = coreApi.getOffer(req.getId()); + String offerId = req.getId(); + Optional myOpenOffer = coreApi.findMyOpenOffer(offerId); + OfferInfo offerInfo = myOpenOffer.isPresent() + ? toMyOfferInfo(myOpenOffer.get()) + : toOfferInfo(coreApi.getOffer(offerId)); var reply = GetOfferReply.newBuilder() - .setOffer(toOfferInfo(offer).toProtoMessage()) + .setOffer(offerInfo.toProtoMessage()) .build(); responseObserver.onNext(reply); responseObserver.onCompleted(); @@ -148,13 +153,15 @@ class GrpcOffersService extends OffersImplBase { } } + @Deprecated // Since 27-Dec-2021. + // Endpoint to be removed from future version. Use getOffer service method instead. @Override public void getMyOffer(GetMyOfferRequest req, StreamObserver responseObserver) { try { OpenOffer openOffer = coreApi.getMyOffer(req.getId()); var reply = GetMyOfferReply.newBuilder() - .setOffer(OfferInfo.toMyOfferInfo(openOffer).toProtoMessage()) + .setOffer(toMyOfferInfo(openOffer).toProtoMessage()) .build(); responseObserver.onNext(reply); responseObserver.onCompleted(); diff --git a/proto/src/main/proto/grpc.proto b/proto/src/main/proto/grpc.proto index 10a90940db..646ab0a85c 100644 --- a/proto/src/main/proto/grpc.proto +++ b/proto/src/main/proto/grpc.proto @@ -70,6 +70,7 @@ service Offers { } rpc GetMyBsqSwapOffer (GetMyOfferRequest) returns (GetMyBsqSwapOfferReply) { } + // @Deprecated since 27-Dec-2021 (v1.8.0) rpc GetMyOffer (GetMyOfferRequest) returns (GetMyOfferReply) { } rpc GetBsqSwapOffers (GetBsqSwapOffersRequest) returns (GetBsqSwapOffersReply) { @@ -121,10 +122,12 @@ message GetMyBsqSwapOfferReply { OfferInfo bsqSwapOffer = 1; } +// @Deprecated since 27-Dec-2021 (v1.8.0) message GetMyOfferRequest { string id = 1; } +// @Deprecated since 27-Dec-2021 (v1.8.0) message GetMyOfferReply { OfferInfo offer = 1; }