mirror of
https://github.com/aljazceru/lnd-manageJ.git
synced 2026-01-27 18:04:24 +01:00
add self payments endpoints (aggregated per peer)
This commit is contained in:
@@ -4,6 +4,7 @@ import com.codahale.metrics.annotation.Timed;
|
||||
import de.cotto.lndmanagej.controller.dto.ObjectMapperConfiguration;
|
||||
import de.cotto.lndmanagej.controller.dto.SelfPaymentDto;
|
||||
import de.cotto.lndmanagej.model.ChannelId;
|
||||
import de.cotto.lndmanagej.model.Pubkey;
|
||||
import de.cotto.lndmanagej.service.SelfPaymentsService;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -23,6 +24,22 @@ public class SelfPaymentsController {
|
||||
this.selfPaymentsService = selfPaymentsService;
|
||||
}
|
||||
|
||||
@Timed
|
||||
@GetMapping("/channel/{channelId}/self-payments-from-channel")
|
||||
public List<SelfPaymentDto> getSelfPaymentsFromChannel(@PathVariable ChannelId channelId) {
|
||||
return selfPaymentsService.getSelfPaymentsFromChannel(channelId).stream()
|
||||
.map(SelfPaymentDto::createFromModel)
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Timed
|
||||
@GetMapping("/node/{pubkey}/self-payments-from-peer")
|
||||
public List<SelfPaymentDto> getSelfPaymentsFromPeer(@PathVariable Pubkey pubkey) {
|
||||
return selfPaymentsService.getSelfPaymentsFromPeer(pubkey).stream()
|
||||
.map(SelfPaymentDto::createFromModel)
|
||||
.toList();
|
||||
}
|
||||
|
||||
@Timed
|
||||
@GetMapping("/channel/{channelId}/self-payments-to-channel")
|
||||
public List<SelfPaymentDto> getSelfPaymentsToChannel(@PathVariable ChannelId channelId) {
|
||||
@@ -32,9 +49,9 @@ public class SelfPaymentsController {
|
||||
}
|
||||
|
||||
@Timed
|
||||
@GetMapping("/channel/{channelId}/self-payments-from-channel")
|
||||
public List<SelfPaymentDto> getSelfPaymentsFromChannel(@PathVariable ChannelId channelId) {
|
||||
return selfPaymentsService.getSelfPaymentsFromChannel(channelId).stream()
|
||||
@GetMapping("/node/{pubkey}/self-payments-to-peer")
|
||||
public List<SelfPaymentDto> getSelfPaymentsToPeer(@PathVariable Pubkey pubkey) {
|
||||
return selfPaymentsService.getSelfPaymentsToPeer(pubkey).stream()
|
||||
.map(SelfPaymentDto::createFromModel)
|
||||
.toList();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user