[bisq-network/bisq] Implement api methods 'keepfunds', 'withdrawfunds' (#4711)

Stan notifications at github.com
Sat Oct 31 18:48:06 UTC 2020


@ghubstan commented on this pull request.



>      }
 
     String getTradeRole(String tradeId) {
         return tradeUtil.getRole(getTrade(tradeId));
     }
 
     Trade getTrade(String tradeId) {
-        return tradeManager.getTradeById(tradeId).orElseThrow(() ->
-                new IllegalArgumentException(format("trade with id '%s' not found", tradeId)));
+        return getOpenTrade(tradeId).orElseGet(() ->
+                getClosedTrade(tradeId).orElseThrow(() ->
+                        new IllegalArgumentException(format("trade with id '%s' not found", tradeId))
+                ));
+    }
+
+    private Optional<Trade> getOpenTrade(String tradeId) {
+        return tradeManager.getTradeById(tradeId);
+    }
+
+    private Optional<Trade> getClosedTrade(String tradeId) {
+        return closedTradableManager.getTradableById(tradeId).map(value -> (Trade) value);

Fixed in PR https://github.com/bisq-network/bisq/pull/4731, commit https://github.com/bisq-network/bisq/pull/4731/commits/fcdfc687e45d1d613838d7189aa4e8edd41228e2.

-- 
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/4711#discussion_r515526928
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20201031/310fd7fd/attachment.html>


More information about the bisq-github mailing list