mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-29 03:01:52 +01:00
cmd: expose ChannelBalance for decoration
This commit is contained in:
parent
675931ac9a
commit
7a3246855f
@ -1463,15 +1463,19 @@ func walletBalance(ctx *cli.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
var channelBalanceCommand = cli.Command{
|
||||
var ChannelBalanceCommand = cli.Command{
|
||||
Name: "channelbalance",
|
||||
Category: "Channels",
|
||||
Usage: "Returns the sum of the total available channel balance across " +
|
||||
"all open channels.",
|
||||
Action: actionDecorator(channelBalance),
|
||||
Action: actionDecorator(func(c *cli.Context) error {
|
||||
return ChannelBalance(c, nil)
|
||||
}),
|
||||
}
|
||||
|
||||
func channelBalance(ctx *cli.Context) error {
|
||||
func ChannelBalance(ctx *cli.Context,
|
||||
respDecorator ResponseDecorator[*lnrpc.ChannelBalanceResponse]) error {
|
||||
|
||||
ctxc := getContext()
|
||||
client, cleanUp := getClient(ctx)
|
||||
defer cleanUp()
|
||||
@ -1482,6 +1486,13 @@ func channelBalance(ctx *cli.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if respDecorator != nil {
|
||||
err = respDecorator(ctx, resp)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
printRespJSON(resp)
|
||||
return nil
|
||||
}
|
||||
|
@ -458,7 +458,7 @@ func Main() {
|
||||
abandonChannelCommand,
|
||||
listPeersCommand,
|
||||
walletBalanceCommand,
|
||||
channelBalanceCommand,
|
||||
ChannelBalanceCommand,
|
||||
getInfoCommand,
|
||||
getDebugInfoCommand,
|
||||
encryptDebugPackageCommand,
|
||||
|
Loading…
x
Reference in New Issue
Block a user