Skip to content

Commit

Permalink
cmd/loopout: add asset flags
Browse files Browse the repository at this point in the history
  • Loading branch information
sputn1ck committed Jan 9, 2025
1 parent 08a0362 commit 5e35488
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions cmd/loop/loopout.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"context"
"encoding/hex"
"fmt"
"math"
"strconv"
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5e35488

Please sign in to comment.