mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
loop: show correct swap type
This commit is contained in:
parent
f7f9751a1a
commit
f7676c3489
4 changed files with 18 additions and 5 deletions
|
|
@ -5,6 +5,7 @@ import (
|
|||
"fmt"
|
||||
|
||||
"github.com/btcsuite/btcutil"
|
||||
"github.com/lightninglabs/loop"
|
||||
"github.com/lightninglabs/loop/looprpc"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
|
@ -67,7 +68,7 @@ func loopIn(ctx *cli.Context) error {
|
|||
|
||||
limits := getInLimits(amt, quote)
|
||||
|
||||
if err := displayLimits(amt, limits); err != nil {
|
||||
if err := displayLimits(loop.TypeIn, amt, limits); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/lightninglabs/loop"
|
||||
"github.com/lightninglabs/loop/looprpc"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
|
@ -84,7 +85,7 @@ func loopOut(ctx *cli.Context) error {
|
|||
|
||||
limits := getLimits(amt, quote)
|
||||
|
||||
if err := displayLimits(amt, limits); err != nil {
|
||||
if err := displayLimits(loop.TypeOut, amt, limits); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ func getLimits(amt btcutil.Amount, quote *looprpc.QuoteResponse) *limits {
|
|||
}
|
||||
}
|
||||
|
||||
func displayLimits(amt btcutil.Amount, l *limits) error {
|
||||
func displayLimits(swapType loop.Type, amt btcutil.Amount, l *limits) error {
|
||||
totalSuccessMax := l.maxMinerFee + l.maxSwapFee
|
||||
if l.maxSwapRoutingFee != nil {
|
||||
totalSuccessMax += *l.maxSwapRoutingFee
|
||||
|
|
@ -125,8 +125,8 @@ func displayLimits(amt btcutil.Amount, l *limits) error {
|
|||
totalSuccessMax += *l.maxPrepayRoutingFee
|
||||
}
|
||||
|
||||
fmt.Printf("Max swap fees for %d loop out: %d\n",
|
||||
btcutil.Amount(amt), totalSuccessMax,
|
||||
fmt.Printf("Max swap fees for %d Loop %v: %d\n",
|
||||
btcutil.Amount(amt), swapType, totalSuccessMax,
|
||||
)
|
||||
|
||||
fmt.Printf("CONTINUE SWAP? (y/n), expand fee detail (x): ")
|
||||
|
|
|
|||
11
interface.go
11
interface.go
|
|
@ -267,6 +267,17 @@ const (
|
|||
TypeOut
|
||||
)
|
||||
|
||||
func (t Type) String() string {
|
||||
switch t {
|
||||
case TypeIn:
|
||||
return "In"
|
||||
case TypeOut:
|
||||
return "Out"
|
||||
default:
|
||||
return "Unknown"
|
||||
}
|
||||
}
|
||||
|
||||
// SwapInfo exposes common info fields for loop in and loop out swaps.
|
||||
type SwapInfo struct {
|
||||
LastUpdate time.Time
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue