@@ -2,6 +2,7 @@ package main
22
33import (
44 "context"
5+ "encoding/hex"
56 "fmt"
67 "math"
78 "strconv"
@@ -101,6 +102,20 @@ 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 " +
109+ "require a connection to a taproot assets " +
110+ "daemon" ,
111+ },
112+ cli.StringFlag {
113+ Name : "asset_edge_node" ,
114+ Usage : "the pubkey of the edge node of the asset to " +
115+ "loop out, this is required if the taproot " +
116+ "assets daemon has multiple channels of the " +
117+ "given asset id with different edge nodes" ,
118+ },
104119 forceFlag ,
105120 labelFlag ,
106121 verboseFlag ,
@@ -186,6 +201,33 @@ func loopOut(ctx *cli.Context) error {
186201 }
187202 }
188203
204+ var assetLoopOutInfo * looprpc.AssetLoopOutInfo
205+
206+ var assetId []byte
207+ if ctx .IsSet ("asset_id" ) {
208+ if ! ctx .IsSet ("asset_edge_node" ) {
209+ return fmt .Errorf ("asset edge node is required when " +
210+ "assetid is set" )
211+ }
212+
213+ assetId , err = hex .DecodeString (ctx .String ("asset_id" ))
214+ if err != nil {
215+ return err
216+ }
217+
218+ assetEdgeNode , err := hex .DecodeString (
219+ ctx .String ("asset_edge_node" ),
220+ )
221+ if err != nil {
222+ return err
223+ }
224+
225+ assetLoopOutInfo = & looprpc.AssetLoopOutInfo {
226+ AssetId : assetId ,
227+ AssetEdgeNode : assetEdgeNode ,
228+ }
229+ }
230+
189231 client , cleanup , err := getClient (ctx )
190232 if err != nil {
191233 return err
@@ -210,6 +252,7 @@ func loopOut(ctx *cli.Context) error {
210252 Amt : int64 (amt ),
211253 ConfTarget : sweepConfTarget ,
212254 SwapPublicationDeadline : uint64 (swapDeadline .Unix ()),
255+ AssetInfo : assetLoopOutInfo ,
213256 }
214257 quote , err := client .LoopOutQuote (context .Background (), quoteReq )
215258 if err != nil {
@@ -281,6 +324,7 @@ func loopOut(ctx *cli.Context) error {
281324 Label : label ,
282325 Initiator : defaultInitiator ,
283326 PaymentTimeout : uint32 (paymentTimeout ),
327+ AssetInfo : assetLoopOutInfo ,
284328 })
285329 if err != nil {
286330 return err
0 commit comments