[bisq-network/bisq] Add tx fee rate api methods: gettxfeerate, settxfeerate, unsettxfeerate (#4858)

sqrrm notifications at github.com
Tue Dec 1 22:11:36 CET 2020


@sqrrm commented on this pull request.



> @@ -185,6 +196,37 @@ void sendBsq(String address,
         }
     }
 
+    TxFeeRateInfo getTxFeeRate() {
+        try {
+            CompletableFuture<Void> feeRequestFuture = CompletableFuture.runAsync(feeService::requestFees);
+            feeRequestFuture.get();  // Block until async fee request is complete.

I was thinking something like, in CoreWalletService
```
    TxFeeRateInfo getTxFeeRate(ResultHandler resultHandler, ErrorMessageHandler errorMessageHandler) {
            CompletableFuture<Void> feeRequestFuture = CompletableFuture.runAsync(feeService::requestFees);
            Futures.addCallback(feeRequestFuture, new FutureCallback<>() {

                @Override
                public void onSuccess(@Nullable Object result) {
                    resultHandler.handleResult();
                }

                @Override
                public void onFailure(Throwable t) {
                    errorMessageHandler.handleErrorMessage(t.getMessage());
                }
            }, MoreExecutors.directExecutor());
    }
```
where the resultHandler is doing the gRPC reply, something like
```
    @Override
    public void getTxFeeRate(GetTxFeeRateRequest req,
                             StreamObserver<GetTxFeeRateReply> responseObserver) {
        ResultHandler resultHandler = () -> {
            var reply = GetTxFeeRateReply.newBuilder()
                    .setTxFeeRateInfo(txFeeRateInfo.toProtoMessage())
                    .build();
            responseObserver.onNext(reply);
            responseObserver.onCompleted();
        };
        coreApi.getTxFeeRate(resultHandler, errorHandler);
    }
```
Bad code, just to illustrate the idea.

-- 
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/4858#discussion_r533723729
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20201201/6537e77e/attachment.htm>


More information about the bisq-github mailing list