@@ -3,6 +3,7 @@ package main
33import (
44 "encoding/hex"
55 "fmt"
6+ "math"
67 "os"
78
89 taprootassets "github.com/lightninglabs/taproot-assets"
4849 groupByGroupName = "by_group"
4950 assetIDName = "asset_id"
5051 shortResponseName = "short"
52+ feeRateName = "fee_rate"
5153 assetAmountName = "amount"
5254 burnOverrideConfirmationName = "override_confirmation_destroy_assets"
5355)
@@ -250,17 +252,41 @@ var finalizeBatchCommand = cli.Command{
250252 "in order to avoid printing a large amount " +
251253 "of data in case of large batches" ,
252254 },
255+ cli.Uint64Flag {
256+ Name : feeRateName ,
257+ Usage : "if set, the fee rate in sat/kw to use for the" +
258+ "minting transaction" ,
259+ },
253260 },
254261 Action : finalizeBatch ,
255262}
256263
264+ func parseFeeRate (ctx * cli.Context ) (uint32 , error ) {
265+ if ctx .IsSet (feeRateName ) {
266+ feeRate := ctx .Uint64 (feeRateName )
267+ if feeRate > math .MaxUint32 {
268+ return 0 , fmt .Errorf ("fee rate exceeds 2^32" )
269+ }
270+
271+ return uint32 (feeRate ), nil
272+ }
273+
274+ return uint32 (0 ), nil
275+ }
276+
257277func finalizeBatch (ctx * cli.Context ) error {
258278 ctxc := getContext ()
259279 client , cleanUp := getMintClient (ctx )
260280 defer cleanUp ()
261281
282+ feeRate , err := parseFeeRate (ctx )
283+ if err != nil {
284+ return err
285+ }
286+
262287 resp , err := client .FinalizeBatch (ctxc , & mintrpc.FinalizeBatchRequest {
263288 ShortResponse : ctx .Bool (shortResponseName ),
289+ FeeRate : feeRate ,
264290 })
265291 if err != nil {
266292 return fmt .Errorf ("unable to finalize batch: %w" , err )
@@ -496,6 +522,11 @@ var sendAssetsCommand = cli.Command{
496522 Usage : "addr to send to; can be specified multiple " +
497523 "times to send to multiple addresses at once" ,
498524 },
525+ cli.Uint64Flag {
526+ Name : feeRateName ,
527+ Usage : "if set, the fee rate in sat/kw to use for the" +
528+ "anchor transaction" ,
529+ },
499530 // TODO(roasbeef): add arg for file name to write sender proof
500531 // blob
501532 },
@@ -512,8 +543,14 @@ func sendAssets(ctx *cli.Context) error {
512543 client , cleanUp := getClient (ctx )
513544 defer cleanUp ()
514545
546+ feeRate , err := parseFeeRate (ctx )
547+ if err != nil {
548+ return err
549+ }
550+
515551 resp , err := client .SendAsset (ctxc , & taprpc.SendAssetRequest {
516552 TapAddrs : addrs ,
553+ FeeRate : feeRate ,
517554 })
518555 if err != nil {
519556 return fmt .Errorf ("unable to send assets: %w" , err )
0 commit comments