Skip to content

Commit 5e35488

Browse files
committed
cmd/loopout: add asset flags
1 parent 08a0362 commit 5e35488

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

cmd/loop/loopout.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package main
22

33
import (
44
"context"
5+
"encoding/hex"
56
"fmt"
67
"math"
78
"strconv"
@@ -101,6 +102,18 @@ var loopOutCommand = cli.Command{
101102
"payment might be retried, the actual total " +
102103
"time may be longer",
103104
},
105+
cli.StringFlag{
106+
Name: "asset_id",
107+
Usage: "the asset ID of the asset to loop out, " +
108+
"if this is set, the loop daemon will require a connection " +
109+
"to a taproot assets daemon",
110+
},
111+
cli.StringFlag{
112+
Name: "asset_edge_node",
113+
Usage: "the pubkey of the edge node of the asset to loop out, " +
114+
"this is required if the taproot assets daemon has multiple " +
115+
"channels of the given asset id with different edge nodes",
116+
},
104117
forceFlag,
105118
labelFlag,
106119
verboseFlag,
@@ -186,6 +199,22 @@ func loopOut(ctx *cli.Context) error {
186199
}
187200
}
188201

202+
var assetId []byte
203+
if ctx.IsSet("asset_id") {
204+
assetId, err = hex.DecodeString(ctx.String("asset_id"))
205+
if err != nil {
206+
return err
207+
}
208+
}
209+
210+
var assetEdgeNode []byte
211+
if ctx.IsSet("asset_edge_node") {
212+
assetEdgeNode, err = hex.DecodeString(ctx.String("asset_edge_node"))
213+
if err != nil {
214+
return err
215+
}
216+
}
217+
189218
client, cleanup, err := getClient(ctx)
190219
if err != nil {
191220
return err
@@ -281,6 +310,8 @@ func loopOut(ctx *cli.Context) error {
281310
Label: label,
282311
Initiator: defaultInitiator,
283312
PaymentTimeout: uint32(paymentTimeout),
313+
AssetId: assetId,
314+
AssetEdgeNode: assetEdgeNode,
284315
})
285316
if err != nil {
286317
return err

0 commit comments

Comments
 (0)