@@ -2,6 +2,7 @@ package main
22
33import (
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,26 @@ 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+ if ! ctx .IsSet ("asset_edge_node" ) {
209+ return fmt .Errorf ("asset edge node is required when " +
210+ "assetid is set" )
211+ }
212+ }
213+
214+ var assetEdgeNode []byte
215+ if ctx .IsSet ("asset_edge_node" ) {
216+ assetEdgeNode , err = hex .DecodeString (ctx .String ("asset_edge_node" ))
217+ if err != nil {
218+ return err
219+ }
220+ }
221+
189222 client , cleanup , err := getClient (ctx )
190223 if err != nil {
191224 return err
@@ -210,6 +243,8 @@ func loopOut(ctx *cli.Context) error {
210243 Amt : int64 (amt ),
211244 ConfTarget : sweepConfTarget ,
212245 SwapPublicationDeadline : uint64 (swapDeadline .Unix ()),
246+ AssetId : assetId ,
247+ AssetEdgeNode : assetEdgeNode ,
213248 }
214249 quote , err := client .LoopOutQuote (context .Background (), quoteReq )
215250 if err != nil {
@@ -281,6 +316,8 @@ func loopOut(ctx *cli.Context) error {
281316 Label : label ,
282317 Initiator : defaultInitiator ,
283318 PaymentTimeout : uint32 (paymentTimeout ),
319+ AssetId : assetId ,
320+ AssetEdgeNode : assetEdgeNode ,
284321 })
285322 if err != nil {
286323 return err
0 commit comments