mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-17 13:06:51 +02:00
loop+cmd: extract types into swap module
This commit is contained in:
parent
7a1680d7d6
commit
69f2af9fdc
13 changed files with 104 additions and 89 deletions
|
|
@ -5,8 +5,8 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightninglabs/loop"
|
||||
"github.com/lightninglabs/loop/looprpc"
|
||||
"github.com/lightninglabs/loop/swap"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ func loopIn(ctx *cli.Context) error {
|
|||
}
|
||||
|
||||
limits := getInLimits(amt, quote)
|
||||
err = displayLimits(loop.TypeIn, amt, limits, external)
|
||||
err = displayLimits(swap.TypeIn, amt, limits, external)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import (
|
|||
|
||||
"github.com/lightninglabs/loop"
|
||||
"github.com/lightninglabs/loop/looprpc"
|
||||
"github.com/lightninglabs/loop/swap"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
|
|
@ -93,7 +94,8 @@ func loopOut(ctx *cli.Context) error {
|
|||
|
||||
limits := getLimits(amt, quote)
|
||||
|
||||
if err := displayLimits(loop.TypeOut, amt, limits, false); err != nil {
|
||||
err = displayLimits(swap.TypeOut, amt, limits, false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ func getLimits(amt btcutil.Amount, quote *looprpc.QuoteResponse) *limits {
|
|||
}
|
||||
}
|
||||
|
||||
func displayLimits(swapType loop.Type, amt btcutil.Amount, l *limits,
|
||||
func displayLimits(swapType swap.Type, amt btcutil.Amount, l *limits,
|
||||
externalHtlc bool) error {
|
||||
|
||||
totalSuccessMax := l.maxMinerFee + l.maxSwapFee
|
||||
|
|
@ -127,7 +127,7 @@ func displayLimits(swapType loop.Type, amt btcutil.Amount, l *limits,
|
|||
totalSuccessMax += *l.maxPrepayRoutingFee
|
||||
}
|
||||
|
||||
if swapType == loop.TypeIn && externalHtlc {
|
||||
if swapType == swap.TypeIn && externalHtlc {
|
||||
fmt.Printf("On-chain fee for external loop in is not " +
|
||||
"included.\nSufficient fees will need to be paid " +
|
||||
"when constructing the transaction in the external " +
|
||||
|
|
@ -148,7 +148,7 @@ func displayLimits(swapType loop.Type, amt btcutil.Amount, l *limits,
|
|||
return nil
|
||||
case "x":
|
||||
fmt.Println()
|
||||
if swapType != loop.TypeIn || !externalHtlc {
|
||||
if swapType != swap.TypeIn || !externalHtlc {
|
||||
fmt.Printf("Max on-chain fee: %d\n",
|
||||
l.maxMinerFee)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue