Skip to content

Commit 84bf303

Browse files
committed
loop: client calls getInfo rpc
1 parent 043f780 commit 84bf303

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

cmd/loop/info.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package main
2+
3+
import (
4+
"context"
5+
6+
"github.com/lightninglabs/loop/looprpc"
7+
"github.com/urfave/cli"
8+
)
9+
10+
var getInfoCommand = cli.Command{
11+
Name: "getinfo",
12+
Usage: "show general information about the loop daemon",
13+
Description: "Displays general information about the daemon like " +
14+
"current version, connection parameters and basic swap " +
15+
"information.",
16+
Action: getInfo,
17+
}
18+
19+
func getInfo(ctx *cli.Context) error {
20+
client, cleanup, err := getClient(ctx)
21+
if err != nil {
22+
return err
23+
}
24+
defer cleanup()
25+
26+
cfg, err := client.GetInfo(
27+
context.Background(), &looprpc.GetInfoRequest{},
28+
)
29+
if err != nil {
30+
return err
31+
}
32+
33+
printRespJSON(cfg)
34+
35+
return nil
36+
}

cmd/loop/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ func main() {
153153
monitorCommand, quoteCommand, listAuthCommand,
154154
listSwapsCommand, swapInfoCommand, getLiquidityParamsCommand,
155155
setLiquidityRuleCommand, suggestSwapCommand, setParamsCommand,
156+
getInfoCommand,
156157
}
157158

158159
err := app.Run(os.Args)

0 commit comments

Comments
 (0)