Skip to content

Commit

Permalink
Merge pull request #4704 from ghubstan/7-cli-gettrade
Browse files Browse the repository at this point in the history
Add 'gettrade' to api method CLI
  • Loading branch information
sqrrm authored Oct 30, 2020
2 parents 8c23017 + 2b23704 commit e059342
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions cli/src/main/java/bisq/cli/CliMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import bisq.proto.grpc.GetOfferRequest;
import bisq.proto.grpc.GetOffersRequest;
import bisq.proto.grpc.GetPaymentAccountsRequest;
import bisq.proto.grpc.GetTradeRequest;
import bisq.proto.grpc.GetVersionRequest;
import bisq.proto.grpc.LockWalletRequest;
import bisq.proto.grpc.RegisterDisputeAgentRequest;
Expand Down Expand Up @@ -74,6 +75,7 @@ private enum Method {
getoffer,
getoffers,
takeoffer,
gettrade,
confirmpaymentstarted,
confirmpaymentreceived,
createpaymentacct,
Expand Down Expand Up @@ -275,6 +277,18 @@ public static void run(String[] args) {
out.printf("trade '%s' successfully taken", reply.getTrade().getShortId());
return;
}
case gettrade: {
if (nonOptionArgs.size() < 2)
throw new IllegalArgumentException("incorrect parameter count, expecting trade id");

var tradeId = nonOptionArgs.get(1);
var request = GetTradeRequest.newBuilder()
.setTradeId(tradeId)
.build();
var reply = tradesService.getTrade(request);
out.println(TradeFormat.format(reply.getTrade()));
return;
}
case confirmpaymentstarted: {
if (nonOptionArgs.size() < 2)
throw new IllegalArgumentException("incorrect parameter count, expecting trade id");
Expand Down Expand Up @@ -427,6 +441,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, "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 e059342

Please sign in to comment.