loop: add swap suggestions command

This commit is contained in:
carla 2020-09-03 10:36:45 +02:00
parent 6b93c70b8a
commit d54d7055fa
No known key found for this signature in database
GPG key ID: 4CA7FE54A6213C91
2 changed files with 29 additions and 1 deletions

View file

@ -170,3 +170,31 @@ func setParam(ctx *cli.Context) error {
return err
}
var suggestSwapCommand = cli.Command{
Name: "suggestswaps",
Usage: "show a list of suggested swaps",
Description: "Displays a list of suggested swaps that aim to obtain " +
"the liquidity balance as specified by the rules set in " +
"the liquidity manager.",
Action: suggestSwap,
}
func suggestSwap(ctx *cli.Context) error {
client, cleanup, err := getClient(ctx)
if err != nil {
return err
}
defer cleanup()
resp, err := client.SuggestSwaps(
context.Background(), &looprpc.SuggestSwapsRequest{},
)
if err != nil {
return err
}
printJSON(resp)
return nil
}

View file

@ -110,7 +110,7 @@ func main() {
loopOutCommand, loopInCommand, termsCommand,
monitorCommand, quoteCommand, listAuthCommand,
listSwapsCommand, swapInfoCommand, getLiquidityParamsCommand,
setLiquidityParamCommand,
setLiquidityParamCommand, suggestSwapCommand,
}
err := app.Run(os.Args)