Skip to content

Commit e6d015f

Browse files
committed
loop: add reservation cli commands
1 parent 6807201 commit e6d015f

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed

cmd/loop/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func main() {
147147
monitorCommand, quoteCommand, listAuthCommand,
148148
listSwapsCommand, swapInfoCommand, getLiquidityParamsCommand,
149149
setLiquidityRuleCommand, suggestSwapCommand, setParamsCommand,
150-
getInfoCommand,
150+
getInfoCommand, reservationsCommands,
151151
}
152152

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

cmd/loop/reservations.go

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package main
2+
3+
import (
4+
"context"
5+
6+
"github.com/lightninglabs/loop/looprpc"
7+
"github.com/urfave/cli"
8+
)
9+
10+
var reservationsCommands = cli.Command{
11+
12+
Name: "reservations",
13+
ShortName: "r",
14+
Usage: "manage reservations",
15+
Subcommands: []cli.Command{
16+
listReservationsCommand,
17+
},
18+
}
19+
20+
var (
21+
listReservationsCommand = cli.Command{
22+
Name: "list",
23+
ShortName: "l",
24+
Usage: "list all reservations",
25+
ArgsUsage: "",
26+
Description: `
27+
List all reservations.
28+
`,
29+
Action: listReservations,
30+
}
31+
)
32+
33+
func listReservations(ctx *cli.Context) error {
34+
client, cleanup, err := getClient(ctx)
35+
if err != nil {
36+
return err
37+
}
38+
defer cleanup()
39+
40+
resp, err := client.ListReservations(
41+
context.Background(), &looprpc.ListReservationsRequest{},
42+
)
43+
if err != nil {
44+
return err
45+
}
46+
47+
printRespJSON(resp)
48+
return nil
49+
}

0 commit comments

Comments
 (0)