default to compact form, add channel point to channel details

This commit is contained in:
Carsten Otto
2021-11-22 19:10:21 +01:00
parent 1d41b532c8
commit a82cb13ef7
5 changed files with 14 additions and 7 deletions

View File

@@ -2,14 +2,15 @@ package de.cotto.lndmanagej.controller.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import de.cotto.lndmanagej.model.BalanceInformation;
import de.cotto.lndmanagej.model.ChannelId;
import de.cotto.lndmanagej.model.ChannelPoint;
import de.cotto.lndmanagej.model.LocalChannel;
import de.cotto.lndmanagej.model.Pubkey;
public record ChannelDetailsDto(
ChannelId channelId,
String channelIdShort,
String channelIdCompact,
String channelIdCompactLnd,
ChannelPoint channelPoint,
Pubkey remotePubkey,
String remoteAlias,
@JsonProperty("private") boolean privateChannel,
@@ -23,9 +24,10 @@ public record ChannelDetailsDto(
OnChainCostsDto onChainCosts
) {
this(
localChannel.getId(),
String.valueOf(localChannel.getId().getShortChannelId()),
localChannel.getId().getCompactForm(),
localChannel.getId().getCompactFormLnd(),
localChannel.getChannelPoint(),
localChannel.getRemotePubkey(),
remoteAlias,
localChannel.isPrivateChannel(),

View File

@@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import de.cotto.lndmanagej.model.ChannelId;
import de.cotto.lndmanagej.model.ChannelPoint;
import de.cotto.lndmanagej.model.Pubkey;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -21,6 +22,7 @@ public class ObjectMapperConfiguration {
SimpleModule module = new SimpleModule("SimpleModule");
module.addSerializer(Pubkey.class, new ToStringSerializer());
module.addSerializer(ChannelId.class, new ToStringSerializer());
module.addSerializer(ChannelPoint.class, new ToStringSerializer());
return new ObjectMapper().registerModule(module);
}
}