Skip to content

Commit

Permalink
Adjust gRPC client & CLI opt parsers for XMR support
Browse files Browse the repository at this point in the history
  • Loading branch information
ghubstan committed Sep 17, 2021
1 parent 427363c commit a733034
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 23 deletions.
12 changes: 4 additions & 8 deletions cli/src/main/java/bisq/cli/GrpcClient.java
Expand Up @@ -267,8 +267,8 @@ public List<OfferInfo> getOffersSortedByDate(String direction, String currencyCo
return offersServiceRequest.getOffersSortedByDate(direction, currencyCode);
}

public List<OfferInfo> getBsqOffersSortedByDate() {
return offersServiceRequest.getBsqOffersSortedByDate();
public List<OfferInfo> getCryptoCurrencyOffersSortedByDate(String currencyCode) {
return offersServiceRequest.getCryptoCurrencyOffersSortedByDate(currencyCode);
}

public List<OfferInfo> getMyOffers(String direction, String currencyCode) {
Expand All @@ -283,12 +283,8 @@ public List<OfferInfo> getMyOffersSortedByDate(String direction, String currency
return offersServiceRequest.getMyOffersSortedByDate(direction, currencyCode);
}

public List<OfferInfo> getMyOffersSortedByDate(String currencyCode) {
return offersServiceRequest.getMyOffersSortedByDate(currencyCode);
}

public List<OfferInfo> getMyBsqOffersSortedByDate() {
return offersServiceRequest.getMyBsqOffersSortedByDate();
public List<OfferInfo> getMyCryptoCurrencyOffersSortedByDate(String currencyCode) {
return offersServiceRequest.getMyCryptoCurrencyOffersSortedByDate(currencyCode);
}

public OfferInfo getMostRecentOffer(String direction, String currencyCode) {
Expand Down
4 changes: 2 additions & 2 deletions cli/src/main/java/bisq/cli/opts/CreateOfferOptionParser.java
Expand Up @@ -28,14 +28,14 @@
public class CreateOfferOptionParser extends AbstractMethodOptionParser implements MethodOpts {

final OptionSpec<String> paymentAccountIdOpt = parser.accepts(OPT_PAYMENT_ACCOUNT,
"id of payment account used for offer")
"id of payment account used for offer")
.withRequiredArg()
.defaultsTo(EMPTY);

final OptionSpec<String> directionOpt = parser.accepts(OPT_DIRECTION, "offer direction (buy|sell)")
.withRequiredArg();

final OptionSpec<String> currencyCodeOpt = parser.accepts(OPT_CURRENCY_CODE, "currency code (eur|usd|...)")
final OptionSpec<String> currencyCodeOpt = parser.accepts(OPT_CURRENCY_CODE, "currency code (bsq|xmr|eur|usd|...)")
.withRequiredArg();

final OptionSpec<String> amountOpt = parser.accepts(OPT_AMOUNT, "amount of btc to buy or sell")
Expand Down
19 changes: 6 additions & 13 deletions cli/src/main/java/bisq/cli/request/OffersServiceRequest.java
Expand Up @@ -251,10 +251,10 @@ public List<OfferInfo> getOffersSortedByDate(String direction, String currencyCo
return offers.isEmpty() ? offers : sortOffersByDate(offers);
}

public List<OfferInfo> getBsqOffersSortedByDate() {
public List<OfferInfo> getCryptoCurrencyOffersSortedByDate(String currencyCode) {
ArrayList<OfferInfo> offers = new ArrayList<>();
offers.addAll(getCryptoCurrencyOffers(BUY.name(), "BSQ"));
offers.addAll(getCryptoCurrencyOffers(SELL.name(), "BSQ"));
offers.addAll(getCryptoCurrencyOffers(BUY.name(), currencyCode));
offers.addAll(getCryptoCurrencyOffers(SELL.name(), currencyCode));
return sortOffersByDate(offers);
}

Expand All @@ -281,17 +281,10 @@ public List<OfferInfo> getMyOffersSortedByDate(String direction, String currency
return offers.isEmpty() ? offers : sortOffersByDate(offers);
}

public List<OfferInfo> getMyOffersSortedByDate(String currencyCode) {
public List<OfferInfo> getMyCryptoCurrencyOffersSortedByDate(String currencyCode) {
ArrayList<OfferInfo> offers = new ArrayList<>();
offers.addAll(getMyOffers(BUY.name(), currencyCode));
offers.addAll(getMyOffers(SELL.name(), currencyCode));
return sortOffersByDate(offers);
}

public List<OfferInfo> getMyBsqOffersSortedByDate() {
ArrayList<OfferInfo> offers = new ArrayList<>();
offers.addAll(getMyCryptoCurrencyOffers(BUY.name(), "BSQ"));
offers.addAll(getMyCryptoCurrencyOffers(SELL.name(), "BSQ"));
offers.addAll(getMyCryptoCurrencyOffers(BUY.name(), currencyCode));
offers.addAll(getMyCryptoCurrencyOffers(SELL.name(), currencyCode));
return sortOffersByDate(offers);
}

Expand Down

0 comments on commit a733034

Please sign in to comment.