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