mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-17 13:06:51 +02:00
loop: rename setparam command to setrule
As we add more paramters to the liqudity manager, it will become more difficult to include them in a single cli endpoint with rules. This commit renames the existing setparam command (which is only used for rules at present), so that we can have a dedicated paramters cli command for all the new values we are adding.
This commit is contained in:
parent
f23a527927
commit
8931fd370c
2 changed files with 13 additions and 11 deletions
|
|
@ -36,8 +36,8 @@ func getParams(ctx *cli.Context) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
var setLiquidityParamCommand = cli.Command{
|
||||
Name: "setparam",
|
||||
var setLiquidityRuleCommand = cli.Command{
|
||||
Name: "setrule",
|
||||
Usage: "set liquidity manager rule for a channel",
|
||||
Description: "Update or remove the liquidity rule for a channel.",
|
||||
ArgsUsage: "shortchanid",
|
||||
|
|
@ -58,10 +58,10 @@ var setLiquidityParamCommand = cli.Command{
|
|||
Usage: "remove the rule currently set for the channel.",
|
||||
},
|
||||
},
|
||||
Action: setParam,
|
||||
Action: setRule,
|
||||
}
|
||||
|
||||
func setParam(ctx *cli.Context) error {
|
||||
func setRule(ctx *cli.Context) error {
|
||||
// We require that a channel ID is set for this rule update.
|
||||
if ctx.NArg() != 1 {
|
||||
return fmt.Errorf("please set a channel id for the rule " +
|
||||
|
|
@ -122,12 +122,11 @@ func setParam(ctx *cli.Context) error {
|
|||
"flag")
|
||||
}
|
||||
|
||||
params.Rules = otherRules
|
||||
_, err = client.SetLiquidityParams(
|
||||
context.Background(),
|
||||
&looprpc.SetLiquidityParamsRequest{
|
||||
Parameters: &looprpc.LiquidityParameters{
|
||||
Rules: otherRules,
|
||||
},
|
||||
Parameters: params,
|
||||
},
|
||||
)
|
||||
return err
|
||||
|
|
@ -158,13 +157,16 @@ func setParam(ctx *cli.Context) error {
|
|||
)
|
||||
}
|
||||
|
||||
// Just set the rules on our current set of parameters and leave the
|
||||
// other values untouched.
|
||||
otherRules = append(otherRules, newRule)
|
||||
params.Rules = otherRules
|
||||
|
||||
// Update our parameters to the existing set, plus our new rule.
|
||||
_, err = client.SetLiquidityParams(
|
||||
context.Background(),
|
||||
&looprpc.SetLiquidityParamsRequest{
|
||||
Parameters: &looprpc.LiquidityParameters{
|
||||
Rules: append(otherRules, newRule),
|
||||
},
|
||||
Parameters: params,
|
||||
},
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ func main() {
|
|||
loopOutCommand, loopInCommand, termsCommand,
|
||||
monitorCommand, quoteCommand, listAuthCommand,
|
||||
listSwapsCommand, swapInfoCommand, getLiquidityParamsCommand,
|
||||
setLiquidityParamCommand, suggestSwapCommand,
|
||||
setLiquidityRuleCommand, suggestSwapCommand,
|
||||
}
|
||||
|
||||
err := app.Run(os.Args)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue