use of com.github.arteam.simplejsonrpc.client.JsonRpcClient in project sparrow by sparrowwallet.
the class SimpleElectrumServerRpc method getFeeRateHistogram.
@Override
public Map<Long, Long> getFeeRateHistogram(Transport transport) {
try {
JsonRpcClient client = new JsonRpcClient(transport);
BigInteger[][] feesArray = new RetryLogic<BigInteger[][]>(MAX_RETRIES, RETRY_DELAY, IllegalStateException.class).getResult(() -> client.createRequest().returnAs(BigInteger[][].class).method("mempool.get_fee_histogram").id(idCounter.incrementAndGet()).execute());
Map<Long, Long> feeRateHistogram = new TreeMap<>();
for (BigInteger[] feePair : feesArray) {
if (feePair[0].longValue() > 0) {
feeRateHistogram.put(feePair[0].longValue(), feePair[1].longValue());
}
}
return feeRateHistogram;
} catch (Exception e) {
throw new ElectrumServerRpcException("Error getting fee rate histogram", e);
}
}
Aggregations