mirror of
https://github.com/lightninglabs/loop.git
synced 2026-08-13 12:33:03 +02:00
Update LND, Aperture, and Taproot Assets to revisions using the btcd v2 modules, and update lndclient to v0.21.0-3. Migrate Loop chain, transaction, and address types to their corresponding v2 packages. The lndclient release includes the migration from: https://github.com/lightninglabs/lndclient/pull/280 Taproot Assets is temporarily replaced with its btcd v2 revision because the v0.8 release branch has not adopted the new modules. This raises the minimum Go version to 1.26 and changes exported address types.
64 lines
1.2 KiB
Go
64 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/btcsuite/btcd/btcutil/v2"
|
|
"github.com/lightninglabs/loop/looprpc"
|
|
"github.com/urfave/cli/v3"
|
|
)
|
|
|
|
var termsCommand = &cli.Command{
|
|
Name: "terms",
|
|
Usage: "Display the current swap terms imposed by the server.",
|
|
Action: terms,
|
|
}
|
|
|
|
func terms(ctx context.Context, cmd *cli.Command) error {
|
|
client, cleanup, err := getClient(cmd)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
defer cleanup()
|
|
|
|
printAmountRange := func(minAmt, maxAmt int64) {
|
|
fmt.Printf("Amount: %d - %d\n",
|
|
btcutil.Amount(minAmt), btcutil.Amount(maxAmt),
|
|
)
|
|
}
|
|
|
|
fmt.Println("Loop Out")
|
|
fmt.Println("--------")
|
|
req := &looprpc.TermsRequest{}
|
|
loopOutTerms, err := client.LoopOutTerms(ctx, req)
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
} else {
|
|
printAmountRange(
|
|
loopOutTerms.MinSwapAmount,
|
|
loopOutTerms.MaxSwapAmount,
|
|
)
|
|
fmt.Printf("Cltv delta: %d - %d\n",
|
|
loopOutTerms.MinCltvDelta, loopOutTerms.MaxCltvDelta,
|
|
)
|
|
}
|
|
|
|
fmt.Println()
|
|
|
|
fmt.Println("Loop In")
|
|
fmt.Println("------")
|
|
loopInTerms, err := client.GetLoopInTerms(
|
|
ctx, &looprpc.TermsRequest{},
|
|
)
|
|
if err != nil {
|
|
fmt.Println(err)
|
|
} else {
|
|
printAmountRange(
|
|
loopInTerms.MinSwapAmount,
|
|
loopInTerms.MaxSwapAmount,
|
|
)
|
|
}
|
|
|
|
return nil
|
|
}
|