[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / RevocationBasepoint.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  * Master key used in conjunction with per_commitment_point to generate [htlcpubkey](https://github.com/lightning/bolts/blob/master/03-transactions.md#key-derivation) for the latest state of a channel.
11  * A watcher can be given a [RevocationBasepoint] to generate per commitment [RevocationKey] to create justice transactions.
12  */
13 public class RevocationBasepoint : CommonBase {
14         internal RevocationBasepoint(object _dummy, long ptr) : base(ptr) { }
15         ~RevocationBasepoint() {
16                 if (ptr != 0) { bindings.RevocationBasepoint_free(ptr); }
17         }
18
19         public byte[] get_a() {
20                 long ret = bindings.RevocationBasepoint_get_a(this.ptr);
21                 GC.KeepAlive(this);
22                 if (ret >= 0 && ret <= 4096) { return null; }
23                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
24                 return ret_conv;
25         }
26
27         public void set_a(byte[] val) {
28                 bindings.RevocationBasepoint_set_a(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
29                 GC.KeepAlive(this);
30                 GC.KeepAlive(val);
31         }
32
33         /**
34          * Constructs a new RevocationBasepoint given each field
35          */
36         public static RevocationBasepoint of(byte[] a_arg) {
37                 long ret = bindings.RevocationBasepoint_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(a_arg, 33)));
38                 GC.KeepAlive(a_arg);
39                 if (ret >= 0 && ret <= 4096) { return null; }
40                 org.ldk.structs.RevocationBasepoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RevocationBasepoint(null, ret); }
41                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
42                 return ret_hu_conv;
43         }
44
45         /**
46          * Checks if two RevocationBasepoints contain equal inner contents.
47          * This ignores pointers and is_owned flags and looks at the values in fields.
48          * Two objects with NULL inner values will be considered "equal" here.
49          */
50         public bool eq(org.ldk.structs.RevocationBasepoint b) {
51                 bool ret = bindings.RevocationBasepoint_eq(this.ptr, b == null ? 0 : b.ptr);
52                 GC.KeepAlive(this);
53                 GC.KeepAlive(b);
54                 if (this != null) { this.ptrs_to.AddLast(b); };
55                 return ret;
56         }
57
58         public override bool Equals(object o) {
59                 if (!(o is RevocationBasepoint)) return false;
60                 return this.eq((RevocationBasepoint)o);
61         }
62         internal long clone_ptr() {
63                 long ret = bindings.RevocationBasepoint_clone_ptr(this.ptr);
64                 GC.KeepAlive(this);
65                 return ret;
66         }
67
68         /**
69          * Creates a copy of the RevocationBasepoint
70          */
71         public RevocationBasepoint clone() {
72                 long ret = bindings.RevocationBasepoint_clone(this.ptr);
73                 GC.KeepAlive(this);
74                 if (ret >= 0 && ret <= 4096) { return null; }
75                 org.ldk.structs.RevocationBasepoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RevocationBasepoint(null, ret); }
76                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
77                 return ret_hu_conv;
78         }
79
80         /**
81          * Generates a non-cryptographic 64-bit hash of the RevocationBasepoint.
82          */
83         public long hash() {
84                 long ret = bindings.RevocationBasepoint_hash(this.ptr);
85                 GC.KeepAlive(this);
86                 return ret;
87         }
88
89         public override int GetHashCode() {
90                 return (int)this.hash();
91         }
92         /**
93          * Get inner Public Key
94          */
95         public byte[] to_public_key() {
96                 long ret = bindings.RevocationBasepoint_to_public_key(this.ptr);
97                 GC.KeepAlive(this);
98                 if (ret >= 0 && ret <= 4096) { return null; }
99                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
100                 return ret_conv;
101         }
102
103         /**
104          * Serialize the RevocationBasepoint object into a byte array which can be read by RevocationBasepoint_read
105          */
106         public byte[] write() {
107                 long ret = bindings.RevocationBasepoint_write(this.ptr);
108                 GC.KeepAlive(this);
109                 if (ret >= 0 && ret <= 4096) { return null; }
110                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
111                 return ret_conv;
112         }
113
114         /**
115          * Read a RevocationBasepoint from a byte array, created by RevocationBasepoint_write
116          */
117         public static Result_RevocationBasepointDecodeErrorZ read(byte[] ser) {
118                 long ret = bindings.RevocationBasepoint_read(InternalUtils.encodeUint8Array(ser));
119                 GC.KeepAlive(ser);
120                 if (ret >= 0 && ret <= 4096) { return null; }
121                 Result_RevocationBasepointDecodeErrorZ ret_hu_conv = Result_RevocationBasepointDecodeErrorZ.constr_from_ptr(ret);
122                 return ret_hu_conv;
123         }
124
125 }
126 } } }