From 5e35488b2a50d4dc5702c388902276173839fbf9 Mon Sep 17 00:00:00 2001 From: sputn1ck Date: Thu, 9 Jan 2025 16:53:53 +0100 Subject: [PATCH] cmd/loopout: add asset flags --- cmd/loop/loopout.go | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/cmd/loop/loopout.go b/cmd/loop/loopout.go index 6ff24ce5d..7c0aed314 100644 --- a/cmd/loop/loopout.go +++ b/cmd/loop/loopout.go @@ -2,6 +2,7 @@ package main import ( "context" + "encoding/hex" "fmt" "math" "strconv" @@ -101,6 +102,18 @@ var loopOutCommand = cli.Command{ "payment might be retried, the actual total " + "time may be longer", }, + cli.StringFlag{ + Name: "asset_id", + Usage: "the asset ID of the asset to loop out, " + + "if this is set, the loop daemon will require a connection " + + "to a taproot assets daemon", + }, + cli.StringFlag{ + Name: "asset_edge_node", + Usage: "the pubkey of the edge node of the asset to loop out, " + + "this is required if the taproot assets daemon has multiple " + + "channels of the given asset id with different edge nodes", + }, forceFlag, labelFlag, verboseFlag, @@ -186,6 +199,22 @@ func loopOut(ctx *cli.Context) error { } } + var assetId []byte + if ctx.IsSet("asset_id") { + assetId, err = hex.DecodeString(ctx.String("asset_id")) + if err != nil { + return err + } + } + + var assetEdgeNode []byte + if ctx.IsSet("asset_edge_node") { + assetEdgeNode, err = hex.DecodeString(ctx.String("asset_edge_node")) + if err != nil { + return err + } + } + client, cleanup, err := getClient(ctx) if err != nil { return err @@ -281,6 +310,8 @@ func loopOut(ctx *cli.Context) error { Label: label, Initiator: defaultInitiator, PaymentTimeout: uint32(paymentTimeout), + AssetId: assetId, + AssetEdgeNode: assetEdgeNode, }) if err != nil { return err