[C#] Update auto-generated files
[ldk-java] / c_sharp / src / org / ldk / structs / BlindedPath.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  * Onion messages and payments can be sent and received to blinded paths, which serve to hide the
11  * identity of the recipient.
12  */
13 public class BlindedPath : CommonBase {
14         internal BlindedPath(object _dummy, long ptr) : base(ptr) { }
15         ~BlindedPath() {
16                 if (ptr != 0) { bindings.BlindedPath_free(ptr); }
17         }
18
19         internal long clone_ptr() {
20                 long ret = bindings.BlindedPath_clone_ptr(this.ptr);
21                 GC.KeepAlive(this);
22                 return ret;
23         }
24
25         /**
26          * Creates a copy of the BlindedPath
27          */
28         public BlindedPath clone() {
29                 long ret = bindings.BlindedPath_clone(this.ptr);
30                 GC.KeepAlive(this);
31                 if (ret >= 0 && ret <= 4096) { return null; }
32                 org.ldk.structs.BlindedPath ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BlindedPath(null, ret); }
33                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
34                 return ret_hu_conv;
35         }
36
37         /**
38          * Generates a non-cryptographic 64-bit hash of the BlindedPath.
39          */
40         public long hash() {
41                 long ret = bindings.BlindedPath_hash(this.ptr);
42                 GC.KeepAlive(this);
43                 return ret;
44         }
45
46         public override int GetHashCode() {
47                 return (int)this.hash();
48         }
49         /**
50          * Checks if two BlindedPaths contain equal inner contents.
51          * This ignores pointers and is_owned flags and looks at the values in fields.
52          * Two objects with NULL inner values will be considered "equal" here.
53          */
54         public bool eq(org.ldk.structs.BlindedPath b) {
55                 bool ret = bindings.BlindedPath_eq(this.ptr, b == null ? 0 : b.ptr);
56                 GC.KeepAlive(this);
57                 GC.KeepAlive(b);
58                 if (this != null) { this.ptrs_to.AddLast(b); };
59                 return ret;
60         }
61
62         public override bool Equals(object o) {
63                 if (!(o is BlindedPath)) return false;
64                 return this.eq((BlindedPath)o);
65         }
66         /**
67          * Create a blinded path for an onion message, to be forwarded along `node_pks`. The last node
68          * pubkey in `node_pks` will be the destination node.
69          * 
70          * Errors if less than two hops are provided or if `node_pk`(s) are invalid.
71          */
72         public static Result_BlindedPathNoneZ new_for_message(byte[][] node_pks, org.ldk.structs.EntropySource entropy_source) {
73                 long ret = bindings.BlindedPath_new_for_message(node_pks != null ? InternalUtils.mapArray(node_pks, node_pks_conv_8 => InternalUtils.check_arr_len(node_pks_conv_8, 33)) : null, entropy_source.ptr);
74                 GC.KeepAlive(node_pks);
75                 GC.KeepAlive(entropy_source);
76                 if (ret >= 0 && ret <= 4096) { return null; }
77                 Result_BlindedPathNoneZ ret_hu_conv = Result_BlindedPathNoneZ.constr_from_ptr(ret);
78                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(entropy_source); };
79                 return ret_hu_conv;
80         }
81
82         /**
83          * Serialize the BlindedPath object into a byte array which can be read by BlindedPath_read
84          */
85         public byte[] write() {
86                 byte[] ret = bindings.BlindedPath_write(this.ptr);
87                 GC.KeepAlive(this);
88                 return ret;
89         }
90
91         /**
92          * Read a BlindedPath from a byte array, created by BlindedPath_write
93          */
94         public static Result_BlindedPathDecodeErrorZ read(byte[] ser) {
95                 long ret = bindings.BlindedPath_read(ser);
96                 GC.KeepAlive(ser);
97                 if (ret >= 0 && ret <= 4096) { return null; }
98                 Result_BlindedPathDecodeErrorZ ret_hu_conv = Result_BlindedPathDecodeErrorZ.constr_from_ptr(ret);
99                 return ret_hu_conv;
100         }
101
102 }
103 } } }