Skip to content

Commit dcc5a8c

Browse files
committed
cmd/loop: add fast option to quote cmd
1 parent b102802 commit dcc5a8c

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

cmd/loop/quote.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"context"
5+
"time"
56

67
"github.com/lightninglabs/loop/looprpc"
78
"github.com/urfave/cli"
@@ -20,6 +21,16 @@ var quoteCommand = cli.Command{
2021
"should be swept within in a Loop Out",
2122
Value: 6,
2223
},
24+
cli.BoolFlag{
25+
Name: "fast",
26+
Usage: "Indicate you want to swap immediately, " +
27+
"paying potentially a higher fee. If not " +
28+
"set the swap server might choose to wait up " +
29+
"to 30 minutes before publishing the swap " +
30+
"HTLC on-chain, to save on chain fees. Not " +
31+
"setting this flag might result in a lower " +
32+
"swap fee.",
33+
},
2334
},
2435
Action: quote,
2536
}
@@ -43,10 +54,17 @@ func quote(ctx *cli.Context) error {
4354
}
4455
defer cleanup()
4556

57+
fast := ctx.Bool("fast")
58+
swapDeadline := time.Now()
59+
if !fast {
60+
swapDeadline = time.Now().Add(defaultSwapWaitTime)
61+
}
62+
4663
ctxb := context.Background()
4764
resp, err := client.LoopOutQuote(ctxb, &looprpc.QuoteRequest{
48-
Amt: int64(amt),
49-
ConfTarget: int32(ctx.Uint64("conf_target")),
65+
Amt: int64(amt),
66+
ConfTarget: int32(ctx.Uint64("conf_target")),
67+
SwapPublicationDeadline: uint64(swapDeadline.Unix()),
5068
})
5169
if err != nil {
5270
return err

0 commit comments

Comments
 (0)