mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
loop: allow setting swap type for individual rules
This commit is contained in:
parent
5e24beb5a7
commit
2542038243
1 changed files with 20 additions and 1 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue