add /balance endpoint for nodes

This commit is contained in:
Carsten Otto
2021-11-24 12:52:43 +01:00
parent 30aae170fe
commit 09a57923a5
3 changed files with 28 additions and 3 deletions

View File

@@ -84,6 +84,12 @@ public class NodeController {
return new ChannelsForNodeDto(pubkey, channels);
}
@GetMapping("/balance")
public BalanceInformationDto getBalance(@PathVariable Pubkey pubkey) {
mark("getBalance");
return BalanceInformationDto.createFrom(balanceService.getBalanceInformation(pubkey));
}
private List<ChannelId> toSortedList(Set<? extends Channel> channels) {
return channels.stream()
.map(Channel::getId)