-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
123 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,71 @@ | ||
'package:ldk_node_package/ChannelConfig'; | ||
|
||
ChannelConfig({ | ||
required this.forwardingFeeProportionalMillionths, | ||
required this.forwardingFeeBaseMsat, | ||
required this.cltvExpiryDelta, | ||
required this.maxDustHtlcExposure, | ||
required this.forceCloseAvoidanceMaxFeeSatoshis, | ||
required this.acceptUnderpayingHtlcs, | ||
}); | ||
class ChannelConfig { | ||
final int forwardingFeeProportionalMillionths; | ||
final int forwardingFeeBaseMsat; | ||
final int cltvExpiryDelta; | ||
final int maxDustHtlcExposure; | ||
final int forceCloseAvoidanceMaxFeeSatoshis; | ||
final bool acceptUnderpayingHtlcs; | ||
|
||
class ChannelConfigBuilder { | ||
late int forwardingFeeProportionalMillionths; | ||
late int forwardingFeeBaseMsat; | ||
late int cltvExpiryDelta; | ||
late int maxDustHtlcExposure; | ||
late int forceCloseAvoidanceMaxFeeSatoshis; | ||
late bool acceptUnderpayingHtlcs; | ||
} | ||
|
||
ChannelConfigBuilder({ | ||
ChannelConfig({ | ||
required this.forwardingFeeProportionalMillionths, | ||
required this.forwardingFeeBaseMsat, | ||
required this.cltvExpiryDelta, | ||
required this.maxDustHtlcExposure, | ||
required this.forceCloseAvoidanceMaxFeeSatoshis, | ||
required this.acceptUnderpayingHtlcs, | ||
}); | ||
} | ||
|
||
class ChannelConfigBuilder { | ||
late int forwardingFeeProportionalMillionths; | ||
late int forwardingFeeBaseMsat; | ||
late int cltvExpiryDelta; | ||
late int maxDustHtlcExposure; | ||
late int forceCloseAvoidanceMaxFeeSatoshis; | ||
late bool acceptUnderpayingHtlcs; | ||
int forwardingFeeProportionalMillionths = 0; | ||
int forwardingFeeBaseMsat = 0; | ||
int cltvExpiryDelta = 0; | ||
int maxDustHtlcExposure = 0; | ||
int forceCloseAvoidanceMaxFeeSatoshis = 0; | ||
bool acceptUnderpayingHtlcs = false; | ||
|
||
ChannelConfigBuilder(); | ||
|
||
ChannelConfigBuilder setForwardingFeeProportionalMillionths(int value) { | ||
forwardingFeeProportionalMillionths = value; | ||
return this; | ||
} | ||
|
||
ChannelConfigBuilder setForwardingFeeBaseMsat(int value) { | ||
forwardingFeeBaseMsat = value; | ||
return this; | ||
} | ||
|
||
ChannelConfigBuilder setCltvExpiryDelta(int value) { | ||
cltvExpiryDelta = value; | ||
return this; | ||
} | ||
|
||
ChannelConfigBuilder setMaxDustHtlcExposure(int value) { | ||
maxDustHtlcExposure = value; | ||
return this; | ||
} | ||
|
||
ChannelConfigBuilder setForceCloseAvoidanceMaxFeeSatoshis(int value) { | ||
forceCloseAvoidanceMaxFeeSatoshis = value; | ||
return this; | ||
} | ||
|
||
ChannelConfigBuilder setAcceptUnderpayingHtlcs(bool value) { | ||
acceptUnderpayingHtlcs = value; | ||
return this; | ||
} | ||
|
||
ChannelConfig build() { | ||
return ChannelConfig( | ||
forwardingFeeProportionalMillionths: forwardingFeeProportionalMillionths, | ||
forwardingFeeBaseMsat: forwardingFeeBaseMsat, | ||
cltvExpiryDelta: cltvExpiryDelta, | ||
maxDustHtlcExposure: maxDustHtlcExposure, | ||
forceCloseAvoidanceMaxFeeSatoshis: forceCloseAvoidanceMaxFeeSatoshis, | ||
acceptUnderpayingHtlcs: acceptUnderpayingHtlcs, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters