loop: allow setting swap type for individual rules

pull/419/head
carla 2 years ago
parent 5e24beb5a7
commit 2542038243
No known key found for this signature in database
GPG Key ID: 4CA7FE54A6213C91

@ -48,6 +48,14 @@ var setLiquidityRuleCommand = cli.Command{
Description: "Update or remove the liquidity rule for a channel/peer.",
ArgsUsage: "{shortchanid | peerpubkey}",
Flags: []cli.Flag{
cli.StringFlag{
Name: "type",
Usage: "the type of swap to perform, set to 'out' " +
"for acquiring inbound liquidity or 'in' for " +
"acquiring outbound liquidity.",
Value: "out",
},
cli.IntFlag{
Name: "incoming_threshold",
Usage: "the minimum percentage of incoming liquidity " +
@ -168,7 +176,18 @@ func setRule(ctx *cli.Context) error {
newRule := &looprpc.LiquidityRule{
ChannelId: chanID,
Type: looprpc.LiquidityRuleType_THRESHOLD,
SwapType: looprpc.SwapType_LOOP_OUT,
}
if ctx.IsSet("type") {
switch ctx.String("type") {
case "in":
newRule.SwapType = looprpc.SwapType_LOOP_IN
case "out":
newRule.SwapType = looprpc.SwapType_LOOP_OUT
default:
return errors.New("please set type to in or out")
}
}
if pubkeyRule {

Loading…
Cancel
Save