add open/closed/pending/... state, group channel status

This commit is contained in:
Carsten Otto
2021-11-24 09:21:54 +01:00
parent 679063de61
commit aefcb3c200
21 changed files with 168 additions and 83 deletions

View File

@@ -1,6 +1,5 @@
package de.cotto.lndmanagej.controller.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import de.cotto.lndmanagej.model.BalanceInformation;
import de.cotto.lndmanagej.model.ChannelPoint;
import de.cotto.lndmanagej.model.LocalChannel;
@@ -15,9 +14,7 @@ public record ChannelDetailsDto(
Pubkey remotePubkey,
String remoteAlias,
String capacity,
@JsonProperty("private") boolean privateChannel,
boolean active,
boolean closed,
ChannelStatusDto status,
BalanceInformationDto balance,
OnChainCostsDto onChainCosts
) {
@@ -36,9 +33,7 @@ public record ChannelDetailsDto(
localChannel.getRemotePubkey(),
remoteAlias,
String.valueOf(localChannel.getCapacity().satoshis()),
localChannel.isPrivateChannel(),
localChannel.isActive(),
localChannel.isClosed(),
ChannelStatusDto.createFrom(localChannel.getStatus()),
BalanceInformationDto.createFrom(balanceInformation),
onChainCosts
);

View File

@@ -0,0 +1,20 @@
package de.cotto.lndmanagej.controller.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import de.cotto.lndmanagej.model.ChannelStatus;
public record ChannelStatusDto(
@JsonProperty("private") boolean privateChannel,
boolean active,
boolean closed,
String openClosed
) {
public static ChannelStatusDto createFrom(ChannelStatus status) {
return new ChannelStatusDto(
status.privateChannel(),
status.active(),
status.closed(),
status.openCloseStatus().toString()
);
}
}