Skip to content

Commit

Permalink
Merge pull request #4705 from ghubstan/8-gettrade-json-option
Browse files Browse the repository at this point in the history
Optionally print the json contract for a given trade id
  • Loading branch information
sqrrm authored Oct 30, 2020
2 parents e059342 + a2b2923 commit 6079a96
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions cli/src/main/java/bisq/cli/CliMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -279,14 +279,21 @@ public static void run(String[] args) {
}
case gettrade: {
if (nonOptionArgs.size() < 2)
throw new IllegalArgumentException("incorrect parameter count, expecting trade id");
throw new IllegalArgumentException("incorrect parameter count, expecting trade id, [,showcontract = true|false]");

var tradeId = nonOptionArgs.get(1);
var showContract = false;
if (nonOptionArgs.size() == 3)
showContract = Boolean.getBoolean(nonOptionArgs.get(2));

var request = GetTradeRequest.newBuilder()
.setTradeId(tradeId)
.build();
var reply = tradesService.getTrade(request);
out.println(TradeFormat.format(reply.getTrade()));
if (showContract)
out.println(reply.getTrade().getContractAsJson());
else
out.println(TradeFormat.format(reply.getTrade()));
return;
}
case confirmpaymentstarted: {
Expand Down Expand Up @@ -441,7 +448,7 @@ private static void printHelp(OptionParser parser, PrintStream stream) {
stream.format(rowFormat, "getoffer", "offer id", "Get current offer with id");
stream.format(rowFormat, "getoffers", "buy | sell, currency code", "Get current offers");
stream.format(rowFormat, "takeoffer", "offer id", "Take offer with id");
stream.format(rowFormat, "gettrade", "trade id", "Get trade details and protocol status");
stream.format(rowFormat, "gettrade", "trade id [,showcontract]", "Get trade summary or full contract");
stream.format(rowFormat, "confirmpaymentstarted", "trade id", "Confirm payment started");
stream.format(rowFormat, "confirmpaymentreceived", "trade id", "Confirm payment received");
stream.format(rowFormat, "createpaymentacct", "account name, account number, currency code", "Create PerfectMoney dummy account");
Expand Down

0 comments on commit 6079a96

Please sign in to comment.