Skip to content

Commit

Permalink
Prepare for createoffer development
Browse files Browse the repository at this point in the history
This change is to tidy up the code supporting createoffer functionality.

* Delete an unused, extra createOffer(...) method in CoreApi that takes
  an offerId argument.

* Delete a comment that should not have been added in the first place
  from grpc.proto.

* Change the CreateOfferReply return type from bool to string (offerId).
  After createoffer impl is completed, CreateOfferReply should return a
  proto containing important offer details.

* Change GrpcOffersService's CreateOfferReply ID field value = "todo".

Note:  this change will be part of a new createoffer PR, but not these
particular comments.
  • Loading branch information
ghubstan committed Aug 22, 2020
1 parent ea56c87 commit 4d25596
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 33 deletions.
30 changes: 0 additions & 30 deletions core/src/main/java/bisq/core/api/CoreApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,14 @@
package bisq.core.api;

import bisq.core.api.model.AddressBalanceInfo;
import bisq.core.monetary.Price;
import bisq.core.offer.Offer;
import bisq.core.offer.OfferPayload;
import bisq.core.payment.PaymentAccount;
import bisq.core.trade.handlers.TransactionResultHandler;
import bisq.core.trade.statistics.TradeStatistics2;
import bisq.core.trade.statistics.TradeStatisticsManager;

import bisq.common.app.Version;

import org.bitcoinj.core.Coin;

import javax.inject.Inject;

import java.util.ArrayList;
Expand Down Expand Up @@ -105,32 +101,6 @@ public void createOffer(String currencyCode,
resultHandler);
}

public void createOffer(String offerId,
String currencyCode,
OfferPayload.Direction direction,
Price price,
boolean useMarketBasedPrice,
double marketPriceMargin,
Coin amount,
Coin minAmount,
double buyerSecurityDeposit,
PaymentAccount paymentAccount,
boolean useSavingsWallet,
TransactionResultHandler resultHandler) {
coreOffersService.createOffer(offerId,
currencyCode,
direction,
price,
useMarketBasedPrice,
marketPriceMargin,
amount,
minAmount,
buyerSecurityDeposit,
paymentAccount,
useSavingsWallet,
resultHandler);
}

///////////////////////////////////////////////////////////////////////////////////////////
// PaymentAccounts
///////////////////////////////////////////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void getOffers(GetOffersRequest req,
public void createOffer(CreateOfferRequest req,
StreamObserver<CreateOfferReply> responseObserver) {
TransactionResultHandler resultHandler = transaction -> {
CreateOfferReply reply = CreateOfferReply.newBuilder().setResult(true).build();
CreateOfferReply reply = CreateOfferReply.newBuilder().setId("todo").build();
responseObserver.onNext(reply);
responseObserver.onCompleted();
};
Expand Down
4 changes: 2 additions & 2 deletions proto/src/main/proto/grpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ message GetOffersReply {
}

message CreateOfferRequest {
string currencyCode = 1; // TODO switch order w/ direction field in next PR
string currencyCode = 1;
string direction = 2;
uint64 price = 3;
bool useMarketBasedPrice = 4;
Expand All @@ -88,7 +88,7 @@ message CreateOfferRequest {
}

message CreateOfferReply {
bool result = 1;
string id = 1;
}

message OfferInfo {
Expand Down

0 comments on commit 4d25596

Please sign in to comment.