[bisq-network/bisq] Add mempool fees to PriceServer getAllMarketPrices endpoint (#5553)

Kai notifications at github.com
Mon Jun 7 10:21:32 CEST 2021


@KaiWitt commented on this pull request.



> @@ -124,6 +124,7 @@
     public static final String BTC_TX_FEE = "btcTxFee";
     public static final String BTC_MIN_TX_FEE = "btcMinTxFee";
     public static final String BTC_FEES_TS = "bitcoinFeesTs";
+    public static final String BTC_FEES_INFO = "bitcoinFeeInfo";

```suggestion
    public static final String BTC_FEE_INFO = "bitcoinFeeInfo";
```

> +        Map<String, Object> feeInfo = feeRateService.getFees();
+        for (String key : feeInfo.keySet()) {
+            retVal.put(translateFieldName(key), feeInfo.get(key));
+        }

It's better to either iterate over `feeRateService.getFees().entrySet()` to avoid value lookups for each key and to make your intent clearer or use `feeRateService.getFees().forEach((k, v) -> ...)`

> +public
 class FeeRateService {

```suggestion
public class FeeRateService {
```

>      }
 
     @GetMapping(path = "/getAllMarketPrices")
     public Map<String, Object> getAllMarketPrices() {
-        return exchangeRateService.getAllMarketPrices();
+        Map<String, Object> retVal = exchangeRateService.getAllMarketPrices();
+
+        // add the fee info to results
+        Map<String, Object> feeInfo = feeRateService.getFees();
+        for (String key : feeInfo.keySet()) {
+            retVal.put(translateFieldName(key), feeInfo.get(key));
+        }
+
+        return retVal;
+    }
+
+    static String translateFieldName(String name) {
+        if (name.equals("dataMap"))

`"dataMap"` should be a variable, as it is used across multiple methods

-- 
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/5553#pullrequestreview-677108693
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20210607/7159631f/attachment.htm>


More information about the bisq-github mailing list