mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-20 13:27:50 +02:00
loop: add reservation cli commands
This commit is contained in:
parent
49c40d9173
commit
30acccbb6f
2 changed files with 56 additions and 1 deletions
|
|
@ -147,7 +147,7 @@ func main() {
|
|||
monitorCommand, quoteCommand, listAuthCommand,
|
||||
listSwapsCommand, swapInfoCommand, getLiquidityParamsCommand,
|
||||
setLiquidityRuleCommand, suggestSwapCommand, setParamsCommand,
|
||||
getInfoCommand, abandonSwapCommand,
|
||||
getInfoCommand, abandonSwapCommand, reservationsCommands,
|
||||
}
|
||||
|
||||
err := app.Run(os.Args)
|
||||
|
|
|
|||
55
cmd/loop/reservations.go
Normal file
55
cmd/loop/reservations.go
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/lightninglabs/loop/looprpc"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
var reservationsCommands = cli.Command{
|
||||
|
||||
Name: "reservations",
|
||||
ShortName: "r",
|
||||
Usage: "manage reservations",
|
||||
Description: `
|
||||
With loopd running, you can use this command to manage your
|
||||
reservations. Reservations are 2-of-2 multisig utxos that
|
||||
the loop server can open to clients. The reservations are used
|
||||
to enable instant swaps.
|
||||
`,
|
||||
Subcommands: []cli.Command{
|
||||
listReservationsCommand,
|
||||
},
|
||||
}
|
||||
|
||||
var (
|
||||
listReservationsCommand = cli.Command{
|
||||
Name: "list",
|
||||
ShortName: "l",
|
||||
Usage: "list all reservations",
|
||||
ArgsUsage: "",
|
||||
Description: `
|
||||
List all reservations.
|
||||
`,
|
||||
Action: listReservations,
|
||||
}
|
||||
)
|
||||
|
||||
func listReservations(ctx *cli.Context) error {
|
||||
client, cleanup, err := getClient(ctx)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer cleanup()
|
||||
|
||||
resp, err := client.ListReservations(
|
||||
context.Background(), &looprpc.ListReservationsRequest{},
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
printRespJSON(resp)
|
||||
return nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue