[bisq-network/bisq] Add rpc method 'getoffers' (#4329)
dmos62
notifications at github.com
Tue Jun 23 18:24:35 UTC 2020
@dmos62 requested changes on this pull request.
> +
+ @Inject
+ public CoreOffersService(CreateOfferService createOfferService,
+ OfferBookService offerBookService,
+ OpenOfferManager openOfferManager,
+ User user) {
+ this.createOfferService = createOfferService;
+ this.offerBookService = offerBookService;
+ this.openOfferManager = openOfferManager;
+ this.user = user;
+ }
+
+ public List<Offer> getOffers(String direction, String fiatCurrencyCode) {
+ List<Offer> offers = offerBookService.getOffers().stream()
+ .filter(o -> !o.getDirection().name().equalsIgnoreCase(direction)
+ && o.getOfferPayload().getCounterCurrencyCode().equalsIgnoreCase(fiatCurrencyCode))
Would like to see these predicates moved into descriptive intermediate variables for the sake of readability.
```
o -> {
var offerOfWantedDirection = !o.getDirection().name().equalsIgnoreCase(direction);
var offerInWantedCurrency = o.getOfferPayload().getCounterCurrencyCode().equalsIgnoreCase(fiatCurrencyCode);
return offerOfWantedDirection && offerInWantedCurrency;
}
```
> + private final User user;
+
+ @Inject
+ public CoreOffersService(CreateOfferService createOfferService,
+ OfferBookService offerBookService,
+ OpenOfferManager openOfferManager,
+ User user) {
+ this.createOfferService = createOfferService;
+ this.offerBookService = offerBookService;
+ this.openOfferManager = openOfferManager;
+ this.user = user;
+ }
+
+ public List<Offer> getOffers(String direction, String fiatCurrencyCode) {
+ List<Offer> offers = offerBookService.getOffers().stream()
+ .filter(o -> !o.getDirection().name().equalsIgnoreCase(direction)
There is an inconsistency here. If we call with `direction = sell`, this will return offers with `direction = buy`. Not yet sure how to fix it.
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/4329#pullrequestreview-436033502
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20200623/ba8cf38d/attachment.html>
More information about the bisq-github
mailing list