From 034bc246caa32dc852950ab4de55abd02dc57f95 Mon Sep 17 00:00:00 2001 From: sputn1ck Date: Fri, 1 Mar 2024 14:35:15 +0100 Subject: [PATCH] cmd: add listinstantouts cmd --- cmd/loop/instantout.go | 28 ++++++++++++++++++++++++++++ cmd/loop/main.go | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/cmd/loop/instantout.go b/cmd/loop/instantout.go index 017828f..3c3a113 100644 --- a/cmd/loop/instantout.go +++ b/cmd/loop/instantout.go @@ -202,3 +202,31 @@ func instantOut(ctx *cli.Context) error { return nil } + +var listInstantOutsCommand = cli.Command{ + Name: "listinstantouts", + Usage: "list all instant out swaps", + Description: ` + List all instant out swaps. + `, + Action: listInstantOuts, +} + +func listInstantOuts(ctx *cli.Context) error { + // First set up the swap client itself. + client, cleanup, err := getClient(ctx) + if err != nil { + return err + } + defer cleanup() + + resp, err := client.ListInstantOuts( + context.Background(), &looprpc.ListInstantOutsRequest{}, + ) + if err != nil { + return err + } + + printRespJSON(resp) + return nil +} diff --git a/cmd/loop/main.go b/cmd/loop/main.go index 0e970c2..65485ff 100644 --- a/cmd/loop/main.go +++ b/cmd/loop/main.go @@ -148,7 +148,7 @@ func main() { listSwapsCommand, swapInfoCommand, getLiquidityParamsCommand, setLiquidityRuleCommand, suggestSwapCommand, setParamsCommand, getInfoCommand, abandonSwapCommand, reservationsCommands, - instantOutCommand, + instantOutCommand, listInstantOutsCommand, } err := app.Run(os.Args)