add /balance endpoint for channels

This commit is contained in:
Carsten Otto
2021-11-24 12:59:04 +01:00
parent 09a57923a5
commit da9518d711
3 changed files with 39 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
package de.cotto.lndmanagej.controller;
import com.codahale.metrics.MetricRegistry;
import de.cotto.lndmanagej.controller.dto.BalanceInformationDto;
import de.cotto.lndmanagej.controller.dto.ChannelDetailsDto;
import de.cotto.lndmanagej.controller.dto.FeeConfigurationDto;
import de.cotto.lndmanagej.controller.dto.ObjectMapperConfiguration;
@@ -71,6 +72,14 @@ public class ChannelController {
);
}
@GetMapping("/balance")
public BalanceInformationDto getBalance(@PathVariable ChannelId channelId) {
metrics.mark(MetricRegistry.name(getClass(), "getBalance"));
BalanceInformation balanceInformation = balanceService.getBalanceInformation(channelId)
.orElse(BalanceInformation.EMPTY);
return BalanceInformationDto.createFrom(balanceInformation);
}
@GetMapping("/fee-configuration")
public FeeConfigurationDto getFeeConfiguration(@PathVariable ChannelId channelId) {
metrics.mark(MetricRegistry.name(getClass(), "getFeeConfiguration"));