mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
cmd/loop: add fast option to quote cmd
This commit is contained in:
parent
b102802ce5
commit
dcc5a8ce88
1 changed files with 20 additions and 2 deletions
|
|
@ -2,6 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/lightninglabs/loop/looprpc"
|
||||
"github.com/urfave/cli"
|
||||
|
|
@ -20,6 +21,16 @@ var quoteCommand = cli.Command{
|
|||
"should be swept within in a Loop Out",
|
||||
Value: 6,
|
||||
},
|
||||
cli.BoolFlag{
|
||||
Name: "fast",
|
||||
Usage: "Indicate you want to swap immediately, " +
|
||||
"paying potentially a higher fee. If not " +
|
||||
"set the swap server might choose to wait up " +
|
||||
"to 30 minutes before publishing the swap " +
|
||||
"HTLC on-chain, to save on chain fees. Not " +
|
||||
"setting this flag might result in a lower " +
|
||||
"swap fee.",
|
||||
},
|
||||
},
|
||||
Action: quote,
|
||||
}
|
||||
|
|
@ -43,10 +54,17 @@ func quote(ctx *cli.Context) error {
|
|||
}
|
||||
defer cleanup()
|
||||
|
||||
fast := ctx.Bool("fast")
|
||||
swapDeadline := time.Now()
|
||||
if !fast {
|
||||
swapDeadline = time.Now().Add(defaultSwapWaitTime)
|
||||
}
|
||||
|
||||
ctxb := context.Background()
|
||||
resp, err := client.LoopOutQuote(ctxb, &looprpc.QuoteRequest{
|
||||
Amt: int64(amt),
|
||||
ConfTarget: int32(ctx.Uint64("conf_target")),
|
||||
Amt: int64(amt),
|
||||
ConfTarget: int32(ctx.Uint64("conf_target")),
|
||||
SwapPublicationDeadline: uint64(swapDeadline.Unix()),
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue