get off chain costs for channel

This commit is contained in:
Carsten Otto
2021-12-15 12:27:16 +01:00
parent 576dbd5871
commit 911614569c
7 changed files with 46 additions and 35 deletions

View File

@@ -7,12 +7,10 @@ import de.cotto.lndmanagej.controller.dto.ChannelDto;
import de.cotto.lndmanagej.controller.dto.ClosedChannelDetailsDto;
import de.cotto.lndmanagej.controller.dto.FeeReportDto;
import de.cotto.lndmanagej.controller.dto.ObjectMapperConfiguration;
import de.cotto.lndmanagej.controller.dto.OffChainCostsDto;
import de.cotto.lndmanagej.controller.dto.PoliciesDto;
import de.cotto.lndmanagej.model.BalanceInformation;
import de.cotto.lndmanagej.model.ChannelId;
import de.cotto.lndmanagej.model.ClosedChannel;
import de.cotto.lndmanagej.model.Coins;
import de.cotto.lndmanagej.model.FeeReport;
import de.cotto.lndmanagej.model.LocalChannel;
import de.cotto.lndmanagej.model.OpenCloseStatus;
@@ -89,7 +87,7 @@ public class ChannelController {
remoteAlias,
getBalanceInformation(channelId),
onChainCostService.getOnChainCostsForChannelId(channelId),
getOffChainCosts(channelId),
offChainCostService.getOffChainCostsForChannel(channelId),
getPoliciesForChannel(localChannel),
getCloseDetailsForChannel(localChannel),
getFeeReportFromService(localChannel.getId())
@@ -144,12 +142,6 @@ public class ChannelController {
.orElse(BalanceInformation.EMPTY);
}
private OffChainCostsDto getOffChainCosts(ChannelId channelId) {
Coins rebalanceSource = offChainCostService.getRebalanceSourceCostsForChannel(channelId);
Coins rebalanceTarget = offChainCostService.getRebalanceTargetCostsForChannel(channelId);
return new OffChainCostsDto(rebalanceSource, rebalanceTarget);
}
private ClosedChannelDetailsDto getCloseDetailsForChannel(LocalChannel localChannel) {
return ClosedChannelDetailsDto.createFromModel(localChannel);
}

View File

@@ -4,6 +4,7 @@ import de.cotto.lndmanagej.model.BalanceInformation;
import de.cotto.lndmanagej.model.ChannelPoint;
import de.cotto.lndmanagej.model.FeeReport;
import de.cotto.lndmanagej.model.LocalChannel;
import de.cotto.lndmanagej.model.OffChainCosts;
import de.cotto.lndmanagej.model.OnChainCosts;
import de.cotto.lndmanagej.model.OpenInitiator;
import de.cotto.lndmanagej.model.Pubkey;
@@ -33,7 +34,7 @@ public record ChannelDetailsDto(
String remoteAlias,
BalanceInformation balanceInformation,
OnChainCosts onChainCosts,
OffChainCostsDto offChainCosts,
OffChainCosts offChainCosts,
PoliciesDto policies,
FeeReport feeReport
) {
@@ -52,7 +53,7 @@ public record ChannelDetailsDto(
channelDto.status(),
BalanceInformationDto.createFromModel(balanceInformation),
OnChainCostsDto.createFromModel(onChainCosts),
offChainCosts,
OffChainCostsDto.createFromModel(offChainCosts),
policies,
channelDto.closeDetails(),
FeeReportDto.createFromModel(feeReport)
@@ -64,7 +65,7 @@ public record ChannelDetailsDto(
String remoteAlias,
BalanceInformation balanceInformation,
OnChainCosts onChainCosts,
OffChainCostsDto offChainCosts,
OffChainCosts offChainCosts,
PoliciesDto policies,
ClosedChannelDetailsDto closeDetails,
FeeReport feeReport