mirror of
https://github.com/aljazceru/lnd-manageJ.git
synced 2026-01-22 23:44:21 +01:00
add rebalance amounts endpoints, rename controller
This commit is contained in:
@@ -4,6 +4,7 @@ import com.codahale.metrics.annotation.Timed;
|
||||
import de.cotto.lndmanagej.model.ChannelId;
|
||||
import de.cotto.lndmanagej.model.Pubkey;
|
||||
import de.cotto.lndmanagej.service.OffChainCostService;
|
||||
import de.cotto.lndmanagej.service.RebalanceService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -11,11 +12,13 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/")
|
||||
public class OffChainCostsController {
|
||||
public class RebalancesController {
|
||||
private final OffChainCostService offChainCostService;
|
||||
private final RebalanceService rebalanceService;
|
||||
|
||||
public OffChainCostsController(OffChainCostService offChainCostService) {
|
||||
public RebalancesController(OffChainCostService offChainCostService, RebalanceService rebalanceService) {
|
||||
this.offChainCostService = offChainCostService;
|
||||
this.rebalanceService = rebalanceService;
|
||||
}
|
||||
|
||||
@Timed
|
||||
@@ -24,21 +27,45 @@ public class OffChainCostsController {
|
||||
return offChainCostService.getRebalanceSourceCostsForPeer(pubkey).milliSatoshis();
|
||||
}
|
||||
|
||||
@Timed
|
||||
@GetMapping("/node/{pubkey}/rebalance-source-amount")
|
||||
public long getRebalanceSourceAmountForPeer(@PathVariable Pubkey pubkey) {
|
||||
return rebalanceService.getRebalanceAmountFromPeer(pubkey).milliSatoshis();
|
||||
}
|
||||
|
||||
@Timed
|
||||
@GetMapping("/channel/{channelId}/rebalance-source-costs")
|
||||
public long getRebalanceSourceCostsForChannel(@PathVariable ChannelId channelId) {
|
||||
return offChainCostService.getRebalanceSourceCostsForChannel(channelId).milliSatoshis();
|
||||
}
|
||||
|
||||
@Timed
|
||||
@GetMapping("/channel/{channelId}/rebalance-source-amount")
|
||||
public long getRebalanceSourceAmountForChannel(@PathVariable ChannelId channelId) {
|
||||
return rebalanceService.getRebalanceAmountFromChannel(channelId).milliSatoshis();
|
||||
}
|
||||
|
||||
@Timed
|
||||
@GetMapping("/node/{pubkey}/rebalance-target-costs")
|
||||
public long getRebalanceTargetCostsForPeer(@PathVariable Pubkey pubkey) {
|
||||
return offChainCostService.getRebalanceTargetCostsForPeer(pubkey).milliSatoshis();
|
||||
}
|
||||
|
||||
@Timed
|
||||
@GetMapping("/node/{pubkey}/rebalance-target-amount")
|
||||
public long getRebalanceTargetAmountForPeer(@PathVariable Pubkey pubkey) {
|
||||
return rebalanceService.getRebalanceAmountToPeer(pubkey).milliSatoshis();
|
||||
}
|
||||
|
||||
@Timed
|
||||
@GetMapping("/channel/{channelId}/rebalance-target-costs")
|
||||
public long getRebalanceTargetCostsForChannel(@PathVariable ChannelId channelId) {
|
||||
return offChainCostService.getRebalanceTargetCostsForChannel(channelId).milliSatoshis();
|
||||
}
|
||||
|
||||
@Timed
|
||||
@GetMapping("/channel/{channelId}/rebalance-target-amount")
|
||||
public long getRebalanceTargetAmountForChannel(@PathVariable ChannelId channelId) {
|
||||
return rebalanceService.getRebalanceAmountToChannel(channelId).milliSatoshis();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user