@@ -114,6 +114,21 @@ type Parameters struct {
114
114
// EasyAutoloopTarget is the target amount of liquidity that we want to
115
115
// maintain in our channels.
116
116
EasyAutoloopTarget btcutil.Amount
117
+
118
+ // AssetAutoloopParams maps an asset id hex encoded string to its
119
+ // easy autoloop parameters.
120
+ AssetAutoloopParams map [string ]AssetParams
121
+ }
122
+
123
+ // AssetParams define the asset specific autoloop parameters.
124
+ type AssetParams struct {
125
+ // EnableEasyOut is a boolean that indicates whether we should use the
126
+ // easy autoloop feature for this asset.
127
+ EnableEasyOut bool
128
+
129
+ // LocalTargetAssetAmount is the target amount of liquidity that we
130
+ // want to maintain in our channels.
131
+ LocalTargetAssetAmount uint64
117
132
}
118
133
119
134
// String returns the string representation of our parameters.
@@ -413,6 +428,14 @@ func RpcToParameters(req *clientrpc.LiquidityParameters) (*Parameters,
413
428
addrType = walletrpc .AddressType_TAPROOT_PUBKEY
414
429
}
415
430
431
+ easyAssetParams := make (map [string ]AssetParams )
432
+ for asset , params := range req .EasyAssetParams {
433
+ easyAssetParams [asset ] = AssetParams {
434
+ EnableEasyOut : params .Enabled ,
435
+ LocalTargetAssetAmount : params .LocalTargetAssetAmt ,
436
+ }
437
+ }
438
+
416
439
params := & Parameters {
417
440
FeeLimit : feeLimit ,
418
441
SweepConfTarget : req .SweepConfTarget ,
@@ -437,9 +460,10 @@ func RpcToParameters(req *clientrpc.LiquidityParameters) (*Parameters,
437
460
Minimum : btcutil .Amount (req .MinSwapAmount ),
438
461
Maximum : btcutil .Amount (req .MaxSwapAmount ),
439
462
},
440
- HtlcConfTarget : req .HtlcConfTarget ,
441
- EasyAutoloop : req .EasyAutoloop ,
442
- EasyAutoloopTarget : btcutil .Amount (req .EasyAutoloopLocalTargetSat ),
463
+ HtlcConfTarget : req .HtlcConfTarget ,
464
+ EasyAutoloop : req .EasyAutoloop ,
465
+ EasyAutoloopTarget : btcutil .Amount (req .EasyAutoloopLocalTargetSat ),
466
+ AssetAutoloopParams : easyAssetParams ,
443
467
}
444
468
445
469
if req .AutoloopBudgetRefreshPeriodSec != 0 {
@@ -528,6 +552,18 @@ func ParametersToRpc(cfg Parameters) (*clientrpc.LiquidityParameters,
528
552
addrType = clientrpc .AddressType_ADDRESS_TYPE_UNKNOWN
529
553
}
530
554
555
+ easyAssetMap := make (
556
+ map [string ]* clientrpc.EasyAssetAutoloopParams ,
557
+ len (cfg .AssetAutoloopParams ),
558
+ )
559
+
560
+ for asset , params := range cfg .AssetAutoloopParams {
561
+ easyAssetMap [asset ] = & clientrpc.EasyAssetAutoloopParams {
562
+ Enabled : params .EnableEasyOut ,
563
+ LocalTargetAssetAmt : params .LocalTargetAssetAmount ,
564
+ }
565
+ }
566
+
531
567
rpcCfg := & clientrpc.LiquidityParameters {
532
568
SweepConfTarget : cfg .SweepConfTarget ,
533
569
FailureBackoffSec : uint64 (cfg .FailureBackOff .Seconds ()),
@@ -555,6 +591,7 @@ func ParametersToRpc(cfg Parameters) (*clientrpc.LiquidityParameters,
555
591
EasyAutoloopLocalTargetSat : uint64 (cfg .EasyAutoloopTarget ),
556
592
Account : cfg .Account ,
557
593
AccountAddrType : addrType ,
594
+ EasyAssetParams : easyAssetMap ,
558
595
}
559
596
560
597
switch f := cfg .FeeLimit .(type ) {
0 commit comments