[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / MaxDustHTLCExposure.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8 /**
9  * Options for how to set the max dust HTLC exposure allowed on a channel. See
10  * [`ChannelConfig::max_dust_htlc_exposure`] for details.
11  */
12 public class MaxDustHTLCExposure : CommonBase {
13         protected MaxDustHTLCExposure(object _dummy, long ptr) : base(ptr) { }
14         ~MaxDustHTLCExposure() {
15                 if (ptr != 0) { bindings.MaxDustHTLCExposure_free(ptr); }
16         }
17
18         internal static MaxDustHTLCExposure constr_from_ptr(long ptr) {
19                 long raw_ty = bindings.LDKMaxDustHTLCExposure_ty_from_ptr(ptr);
20                 switch (raw_ty) {
21                         case 0: return new MaxDustHTLCExposure_FixedLimitMsat(ptr);
22                         case 1: return new MaxDustHTLCExposure_FeeRateMultiplier(ptr);
23                         default:
24                                 throw new ArgumentException("Impossible enum variant");
25                 }
26         }
27
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);
33                 }
34         }
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);
40                 }
41         }
42         internal long clone_ptr() {
43                 long ret = bindings.MaxDustHTLCExposure_clone_ptr(this.ptr);
44                 GC.KeepAlive(this);
45                 return ret;
46         }
47
48         /**
49          * Creates a copy of the MaxDustHTLCExposure
50          */
51         public MaxDustHTLCExposure clone() {
52                 long ret = bindings.MaxDustHTLCExposure_clone(this.ptr);
53                 GC.KeepAlive(this);
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); };
57                 return ret_hu_conv;
58         }
59
60         /**
61          * Utility method to constructs a new FixedLimitMsat-variant MaxDustHTLCExposure
62          */
63         public static MaxDustHTLCExposure fixed_limit_msat(long a) {
64                 long ret = bindings.MaxDustHTLCExposure_fixed_limit_msat(a);
65                 GC.KeepAlive(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); };
69                 return ret_hu_conv;
70         }
71
72         /**
73          * Utility method to constructs a new FeeRateMultiplier-variant MaxDustHTLCExposure
74          */
75         public static MaxDustHTLCExposure fee_rate_multiplier(long a) {
76                 long ret = bindings.MaxDustHTLCExposure_fee_rate_multiplier(a);
77                 GC.KeepAlive(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); };
81                 return ret_hu_conv;
82         }
83
84         /**
85          * Checks if two MaxDustHTLCExposures contain equal inner contents.
86          * This ignores pointers and is_owned flags and looks at the values in fields.
87          */
88         public bool eq(org.ldk.structs.MaxDustHTLCExposure b) {
89                 bool ret = bindings.MaxDustHTLCExposure_eq(this.ptr, b == null ? 0 : b.ptr);
90                 GC.KeepAlive(this);
91                 GC.KeepAlive(b);
92                 return ret;
93         }
94
95         public override bool Equals(object o) {
96                 if (!(o is MaxDustHTLCExposure)) return false;
97                 return this.eq((MaxDustHTLCExposure)o);
98         }
99         /**
100          * Serialize the MaxDustHTLCExposure object into a byte array which can be read by MaxDustHTLCExposure_read
101          */
102         public byte[] write() {
103                 long ret = bindings.MaxDustHTLCExposure_write(this.ptr);
104                 GC.KeepAlive(this);
105                 if (ret >= 0 && ret <= 4096) { return null; }
106                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
107                 return ret_conv;
108         }
109
110         /**
111          * Read a MaxDustHTLCExposure from a byte array, created by MaxDustHTLCExposure_write
112          */
113         public static Result_MaxDustHTLCExposureDecodeErrorZ read(byte[] ser) {
114                 long ret = bindings.MaxDustHTLCExposure_read(InternalUtils.encodeUint8Array(ser));
115                 GC.KeepAlive(ser);
116                 if (ret >= 0 && ret <= 4096) { return null; }
117                 Result_MaxDustHTLCExposureDecodeErrorZ ret_hu_conv = Result_MaxDustHTLCExposureDecodeErrorZ.constr_from_ptr(ret);
118                 return ret_hu_conv;
119         }
120
121 }
122 } } }