[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / BlindedTail.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 /**
10  * The blinded portion of a [`Path`], if we're routing to a recipient who provided blinded paths in
11  * their [`Bolt12Invoice`].
12  * 
13  * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
14  */
15 public class BlindedTail : CommonBase {
16         internal BlindedTail(object _dummy, long ptr) : base(ptr) { }
17         ~BlindedTail() {
18                 if (ptr != 0) { bindings.BlindedTail_free(ptr); }
19         }
20
21         /**
22          * The hops of the [`BlindedPath`] provided by the recipient.
23          * 
24          * [`BlindedPath`]: crate::blinded_path::BlindedPath
25          */
26         public BlindedHop[] get_hops() {
27                 long ret = bindings.BlindedTail_get_hops(this.ptr);
28                 GC.KeepAlive(this);
29                 if (ret >= 0 && ret <= 4096) { return null; }
30                 int ret_conv_12_len = InternalUtils.getArrayLength(ret);
31                 BlindedHop[] ret_conv_12_arr = new BlindedHop[ret_conv_12_len];
32                 for (int m = 0; m < ret_conv_12_len; m++) {
33                         long ret_conv_12 = InternalUtils.getU64ArrayElem(ret, m);
34                         org.ldk.structs.BlindedHop ret_conv_12_hu_conv = null; if (ret_conv_12 < 0 || ret_conv_12 > 4096) { ret_conv_12_hu_conv = new org.ldk.structs.BlindedHop(null, ret_conv_12); }
35                         if (ret_conv_12_hu_conv != null) { ret_conv_12_hu_conv.ptrs_to.AddLast(this); };
36                         ret_conv_12_arr[m] = ret_conv_12_hu_conv;
37                 }
38                 bindings.free_buffer(ret);
39                 return ret_conv_12_arr;
40         }
41
42         /**
43          * The hops of the [`BlindedPath`] provided by the recipient.
44          * 
45          * [`BlindedPath`]: crate::blinded_path::BlindedPath
46          */
47         public void set_hops(BlindedHop[] val) {
48                 bindings.BlindedTail_set_hops(this.ptr, InternalUtils.encodeUint64Array(InternalUtils.mapArray(val, val_conv_12 => val_conv_12 == null ? 0 : val_conv_12.ptr)));
49                 GC.KeepAlive(this);
50                 GC.KeepAlive(val);
51                 foreach (BlindedHop val_conv_12 in val) { if (this != null) { this.ptrs_to.AddLast(val_conv_12); }; };
52         }
53
54         /**
55          * The blinding point of the [`BlindedPath`] provided by the recipient.
56          * 
57          * [`BlindedPath`]: crate::blinded_path::BlindedPath
58          */
59         public byte[] get_blinding_point() {
60                 long ret = bindings.BlindedTail_get_blinding_point(this.ptr);
61                 GC.KeepAlive(this);
62                 if (ret >= 0 && ret <= 4096) { return null; }
63                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
64                 return ret_conv;
65         }
66
67         /**
68          * The blinding point of the [`BlindedPath`] provided by the recipient.
69          * 
70          * [`BlindedPath`]: crate::blinded_path::BlindedPath
71          */
72         public void set_blinding_point(byte[] val) {
73                 bindings.BlindedTail_set_blinding_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
74                 GC.KeepAlive(this);
75                 GC.KeepAlive(val);
76         }
77
78         /**
79          * Excess CLTV delta added to the recipient's CLTV expiry to deter intermediate nodes from
80          * inferring the destination. May be 0.
81          */
82         public int get_excess_final_cltv_expiry_delta() {
83                 int ret = bindings.BlindedTail_get_excess_final_cltv_expiry_delta(this.ptr);
84                 GC.KeepAlive(this);
85                 return ret;
86         }
87
88         /**
89          * Excess CLTV delta added to the recipient's CLTV expiry to deter intermediate nodes from
90          * inferring the destination. May be 0.
91          */
92         public void set_excess_final_cltv_expiry_delta(int val) {
93                 bindings.BlindedTail_set_excess_final_cltv_expiry_delta(this.ptr, val);
94                 GC.KeepAlive(this);
95                 GC.KeepAlive(val);
96         }
97
98         /**
99          * The total amount paid on this [`Path`], excluding the fees.
100          */
101         public long get_final_value_msat() {
102                 long ret = bindings.BlindedTail_get_final_value_msat(this.ptr);
103                 GC.KeepAlive(this);
104                 return ret;
105         }
106
107         /**
108          * The total amount paid on this [`Path`], excluding the fees.
109          */
110         public void set_final_value_msat(long val) {
111                 bindings.BlindedTail_set_final_value_msat(this.ptr, val);
112                 GC.KeepAlive(this);
113                 GC.KeepAlive(val);
114         }
115
116         /**
117          * Constructs a new BlindedTail given each field
118          */
119         public static BlindedTail of(BlindedHop[] hops_arg, byte[] blinding_point_arg, int excess_final_cltv_expiry_delta_arg, long final_value_msat_arg) {
120                 long ret = bindings.BlindedTail_new(InternalUtils.encodeUint64Array(InternalUtils.mapArray(hops_arg, hops_arg_conv_12 => hops_arg_conv_12 == null ? 0 : hops_arg_conv_12.ptr)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(blinding_point_arg, 33)), excess_final_cltv_expiry_delta_arg, final_value_msat_arg);
121                 GC.KeepAlive(hops_arg);
122                 GC.KeepAlive(blinding_point_arg);
123                 GC.KeepAlive(excess_final_cltv_expiry_delta_arg);
124                 GC.KeepAlive(final_value_msat_arg);
125                 if (ret >= 0 && ret <= 4096) { return null; }
126                 org.ldk.structs.BlindedTail ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BlindedTail(null, ret); }
127                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
128                 foreach (BlindedHop hops_arg_conv_12 in hops_arg) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(hops_arg_conv_12); }; };
129                 return ret_hu_conv;
130         }
131
132         internal long clone_ptr() {
133                 long ret = bindings.BlindedTail_clone_ptr(this.ptr);
134                 GC.KeepAlive(this);
135                 return ret;
136         }
137
138         /**
139          * Creates a copy of the BlindedTail
140          */
141         public BlindedTail clone() {
142                 long ret = bindings.BlindedTail_clone(this.ptr);
143                 GC.KeepAlive(this);
144                 if (ret >= 0 && ret <= 4096) { return null; }
145                 org.ldk.structs.BlindedTail ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BlindedTail(null, ret); }
146                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
147                 return ret_hu_conv;
148         }
149
150         /**
151          * Generates a non-cryptographic 64-bit hash of the BlindedTail.
152          */
153         public long hash() {
154                 long ret = bindings.BlindedTail_hash(this.ptr);
155                 GC.KeepAlive(this);
156                 return ret;
157         }
158
159         public override int GetHashCode() {
160                 return (int)this.hash();
161         }
162         /**
163          * Checks if two BlindedTails contain equal inner contents.
164          * This ignores pointers and is_owned flags and looks at the values in fields.
165          * Two objects with NULL inner values will be considered "equal" here.
166          */
167         public bool eq(org.ldk.structs.BlindedTail b) {
168                 bool ret = bindings.BlindedTail_eq(this.ptr, b == null ? 0 : b.ptr);
169                 GC.KeepAlive(this);
170                 GC.KeepAlive(b);
171                 if (this != null) { this.ptrs_to.AddLast(b); };
172                 return ret;
173         }
174
175         public override bool Equals(object o) {
176                 if (!(o is BlindedTail)) return false;
177                 return this.eq((BlindedTail)o);
178         }
179         /**
180          * Serialize the BlindedTail object into a byte array which can be read by BlindedTail_read
181          */
182         public byte[] write() {
183                 long ret = bindings.BlindedTail_write(this.ptr);
184                 GC.KeepAlive(this);
185                 if (ret >= 0 && ret <= 4096) { return null; }
186                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
187                 return ret_conv;
188         }
189
190         /**
191          * Read a BlindedTail from a byte array, created by BlindedTail_write
192          */
193         public static Result_BlindedTailDecodeErrorZ read(byte[] ser) {
194                 long ret = bindings.BlindedTail_read(InternalUtils.encodeUint8Array(ser));
195                 GC.KeepAlive(ser);
196                 if (ret >= 0 && ret <= 4096) { return null; }
197                 Result_BlindedTailDecodeErrorZ ret_hu_conv = Result_BlindedTailDecodeErrorZ.constr_from_ptr(ret);
198                 return ret_hu_conv;
199         }
200
201 }
202 } } }