6 namespace org { namespace ldk { namespace structs {
9 * Options for how to set the max dust HTLC exposure allowed on a channel. See
10 * [`ChannelConfig::max_dust_htlc_exposure`] for details.
12 public class MaxDustHTLCExposure : CommonBase {
13 protected MaxDustHTLCExposure(object _dummy, long ptr) : base(ptr) { }
14 ~MaxDustHTLCExposure() {
15 if (ptr != 0) { bindings.MaxDustHTLCExposure_free(ptr); }
18 internal static MaxDustHTLCExposure constr_from_ptr(long ptr) {
19 long raw_ty = bindings.LDKMaxDustHTLCExposure_ty_from_ptr(ptr);
21 case 0: return new MaxDustHTLCExposure_FixedLimitMsat(ptr);
22 case 1: return new MaxDustHTLCExposure_FeeRateMultiplier(ptr);
24 throw new ArgumentException("Impossible enum variant");
28 /** A MaxDustHTLCExposure of type FixedLimitMsat */
29 public class MaxDustHTLCExposure_FixedLimitMsat : MaxDustHTLCExposure {
30 public long fixed_limit_msat;
31 internal MaxDustHTLCExposure_FixedLimitMsat(long ptr) : base(null, ptr) {
32 this.fixed_limit_msat = bindings.LDKMaxDustHTLCExposure_FixedLimitMsat_get_fixed_limit_msat(ptr);
35 /** A MaxDustHTLCExposure of type FeeRateMultiplier */
36 public class MaxDustHTLCExposure_FeeRateMultiplier : MaxDustHTLCExposure {
37 public long fee_rate_multiplier;
38 internal MaxDustHTLCExposure_FeeRateMultiplier(long ptr) : base(null, ptr) {
39 this.fee_rate_multiplier = bindings.LDKMaxDustHTLCExposure_FeeRateMultiplier_get_fee_rate_multiplier(ptr);
42 internal long clone_ptr() {
43 long ret = bindings.MaxDustHTLCExposure_clone_ptr(this.ptr);
49 * Creates a copy of the MaxDustHTLCExposure
51 public MaxDustHTLCExposure clone() {
52 long ret = bindings.MaxDustHTLCExposure_clone(this.ptr);
54 if (ret >= 0 && ret <= 4096) { return null; }
55 org.ldk.structs.MaxDustHTLCExposure ret_hu_conv = org.ldk.structs.MaxDustHTLCExposure.constr_from_ptr(ret);
56 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
61 * Utility method to constructs a new FixedLimitMsat-variant MaxDustHTLCExposure
63 public static MaxDustHTLCExposure fixed_limit_msat(long a) {
64 long ret = bindings.MaxDustHTLCExposure_fixed_limit_msat(a);
66 if (ret >= 0 && ret <= 4096) { return null; }
67 org.ldk.structs.MaxDustHTLCExposure ret_hu_conv = org.ldk.structs.MaxDustHTLCExposure.constr_from_ptr(ret);
68 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
73 * Utility method to constructs a new FeeRateMultiplier-variant MaxDustHTLCExposure
75 public static MaxDustHTLCExposure fee_rate_multiplier(long a) {
76 long ret = bindings.MaxDustHTLCExposure_fee_rate_multiplier(a);
78 if (ret >= 0 && ret <= 4096) { return null; }
79 org.ldk.structs.MaxDustHTLCExposure ret_hu_conv = org.ldk.structs.MaxDustHTLCExposure.constr_from_ptr(ret);
80 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
85 * Checks if two MaxDustHTLCExposures contain equal inner contents.
86 * This ignores pointers and is_owned flags and looks at the values in fields.
88 public bool eq(org.ldk.structs.MaxDustHTLCExposure b) {
89 bool ret = bindings.MaxDustHTLCExposure_eq(this.ptr, b == null ? 0 : b.ptr);
95 public override bool Equals(object o) {
96 if (!(o is MaxDustHTLCExposure)) return false;
97 return this.eq((MaxDustHTLCExposure)o);
100 * Serialize the MaxDustHTLCExposure object into a byte array which can be read by MaxDustHTLCExposure_read
102 public byte[] write() {
103 long ret = bindings.MaxDustHTLCExposure_write(this.ptr);
105 if (ret >= 0 && ret <= 4096) { return null; }
106 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
111 * Read a MaxDustHTLCExposure from a byte array, created by MaxDustHTLCExposure_write
113 public static Result_MaxDustHTLCExposureDecodeErrorZ read(byte[] ser) {
114 long ret = bindings.MaxDustHTLCExposure_read(InternalUtils.encodeUint8Array(ser));
116 if (ret >= 0 && ret <= 4096) { return null; }
117 Result_MaxDustHTLCExposureDecodeErrorZ ret_hu_conv = Result_MaxDustHTLCExposureDecodeErrorZ.constr_from_ptr(ret);