loop: add reservation cli commands

pull/632/head
sputn1ck 8 months ago
parent 49c40d9173
commit 30acccbb6f
No known key found for this signature in database
GPG Key ID: 671103D881A5F0E4

@ -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)

@ -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…
Cancel
Save