add incoming-base-fee and outgoing-base-fee endpoints

This commit is contained in:
Carsten Otto
2021-11-12 14:58:53 +01:00
parent 6cbced801a
commit 3b28617eb9
7 changed files with 130 additions and 11 deletions

View File

@@ -74,4 +74,14 @@ public class LegacyController {
public long getOutgoingFeeRate(@PathVariable ChannelId channelId) {
return feeService.getOutgoingFeeRate(channelId);
}
@GetMapping("/channel/{channelId}/incoming-base-fee")
public long getIncomingBaseFee(@PathVariable ChannelId channelId) {
return feeService.getIncomingBaseFee(channelId).milliSatoshis();
}
@GetMapping("/channel/{channelId}/outgoing-base-fee")
public long getOutgoingBaseFee(@PathVariable ChannelId channelId) {
return feeService.getOutgoingBaseFee(channelId).milliSatoshis();
}
}

View File

@@ -2,6 +2,7 @@ package de.cotto.lndmanagej.service;
import de.cotto.lndmanagej.grpc.GrpcFees;
import de.cotto.lndmanagej.model.ChannelId;
import de.cotto.lndmanagej.model.Coins;
import org.springframework.stereotype.Component;
@Component
@@ -19,4 +20,12 @@ public class FeeService {
public long getOutgoingFeeRate(ChannelId channelId) {
return grpcFees.getOutgoingFeeRate(channelId).orElseThrow(IllegalStateException::new);
}
public Coins getOutgoingBaseFee(ChannelId channelId) {
return grpcFees.getOutgoingBaseFee(channelId).orElseThrow(IllegalStateException::new);
}
public Coins getIncomingBaseFee(ChannelId channelId) {
return grpcFees.getIncomingBaseFee(channelId).orElseThrow(IllegalStateException::new);
}
}