mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
loop: client calls getInfo rpc
This commit is contained in:
parent
043f780198
commit
84bf30301f
2 changed files with 37 additions and 0 deletions
36
cmd/loop/info.go
Normal file
36
cmd/loop/info.go
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/lightninglabs/loop/looprpc"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
var getInfoCommand = cli.Command{
|
||||
Name: "getinfo",
|
||||
Usage: "show general information about the loop daemon",
|
||||
Description: "Displays general information about the daemon like " +
|
||||
"current version, connection parameters and basic swap " +
|
||||
"information.",
|
||||
Action: getInfo,
|
||||
}
|
||||
|
||||
func getInfo(ctx *cli.Context) error {
|
||||
client, cleanup, err := getClient(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer cleanup()
|
||||
|
||||
cfg, err := client.GetInfo(
|
||||
context.Background(), &looprpc.GetInfoRequest{},
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
printRespJSON(cfg)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
@ -153,6 +153,7 @@ func main() {
|
|||
monitorCommand, quoteCommand, listAuthCommand,
|
||||
listSwapsCommand, swapInfoCommand, getLiquidityParamsCommand,
|
||||
setLiquidityRuleCommand, suggestSwapCommand, setParamsCommand,
|
||||
getInfoCommand,
|
||||
}
|
||||
|
||||
err := app.Run(os.Args)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue