[bisq-network/bisq] Add getRole(tradeId) to core api (#4701)

sqrrm notifications at github.com
Fri Oct 30 16:32:56 UTC 2020


@sqrrm commented on this pull request.



> +     * @return String describing a trader's role for a given trade
+     */
+    public String getRole(Trade trade) {
+        Contract contract = trade.getContract();
+        if (contract == null)
+            throw new IllegalStateException(format("could not get role because no contract was found for trade '%s'",
+                    trade.getShortId()));
+
+        Offer offer = trade.getOffer();
+        if (offer == null)
+            throw new IllegalStateException(format("could not get role because no offer was found for trade '%s'",
+                    trade.getShortId()));
+
+        return getRole(contract.isBuyerMakerAndSellerTaker(),
+                offer.isMyOffer(keyRing),
+                offer.getCurrencyCode());

Ok, I get it, thanks.

-- 
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/4701#discussion_r515225366
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20201030/ba400284/attachment-0001.html>


More information about the bisq-github mailing list