[Java] Update auto-generated Java bindings to LDK 0.0.121
[ldk-java] / src / main / java / org / ldk / structs / RevocationBasepoint.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10
11 /**
12  * 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.
13  * A watcher can be given a [RevocationBasepoint] to generate per commitment [RevocationKey] to create justice transactions.
14  */
15 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
16 public class RevocationBasepoint extends CommonBase {
17         RevocationBasepoint(Object _dummy, long ptr) { super(ptr); }
18         @Override @SuppressWarnings("deprecation")
19         protected void finalize() throws Throwable {
20                 super.finalize();
21                 if (ptr != 0) { bindings.RevocationBasepoint_free(ptr); }
22         }
23
24         public byte[] get_a() {
25                 byte[] ret = bindings.RevocationBasepoint_get_a(this.ptr);
26                 Reference.reachabilityFence(this);
27                 return ret;
28         }
29
30         public void set_a(byte[] val) {
31                 bindings.RevocationBasepoint_set_a(this.ptr, InternalUtils.check_arr_len(val, 33));
32                 Reference.reachabilityFence(this);
33                 Reference.reachabilityFence(val);
34         }
35
36         /**
37          * Constructs a new RevocationBasepoint given each field
38          */
39         public static RevocationBasepoint of(byte[] a_arg) {
40                 long ret = bindings.RevocationBasepoint_new(InternalUtils.check_arr_len(a_arg, 33));
41                 Reference.reachabilityFence(a_arg);
42                 if (ret >= 0 && ret <= 4096) { return null; }
43                 org.ldk.structs.RevocationBasepoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RevocationBasepoint(null, ret); }
44                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
45                 return ret_hu_conv;
46         }
47
48         /**
49          * Checks if two RevocationBasepoints contain equal inner contents.
50          * This ignores pointers and is_owned flags and looks at the values in fields.
51          * Two objects with NULL inner values will be considered "equal" here.
52          */
53         public boolean eq(org.ldk.structs.RevocationBasepoint b) {
54                 boolean ret = bindings.RevocationBasepoint_eq(this.ptr, b == null ? 0 : b.ptr);
55                 Reference.reachabilityFence(this);
56                 Reference.reachabilityFence(b);
57                 if (this != null) { this.ptrs_to.add(b); };
58                 return ret;
59         }
60
61         @Override public boolean equals(Object o) {
62                 if (!(o instanceof RevocationBasepoint)) return false;
63                 return this.eq((RevocationBasepoint)o);
64         }
65         long clone_ptr() {
66                 long ret = bindings.RevocationBasepoint_clone_ptr(this.ptr);
67                 Reference.reachabilityFence(this);
68                 return ret;
69         }
70
71         /**
72          * Creates a copy of the RevocationBasepoint
73          */
74         public RevocationBasepoint clone() {
75                 long ret = bindings.RevocationBasepoint_clone(this.ptr);
76                 Reference.reachabilityFence(this);
77                 if (ret >= 0 && ret <= 4096) { return null; }
78                 org.ldk.structs.RevocationBasepoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RevocationBasepoint(null, ret); }
79                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
80                 return ret_hu_conv;
81         }
82
83         /**
84          * Generates a non-cryptographic 64-bit hash of the RevocationBasepoint.
85          */
86         public long hash() {
87                 long ret = bindings.RevocationBasepoint_hash(this.ptr);
88                 Reference.reachabilityFence(this);
89                 return ret;
90         }
91
92         @Override public int hashCode() {
93                 return (int)this.hash();
94         }
95         /**
96          * Get inner Public Key
97          */
98         public byte[] to_public_key() {
99                 byte[] ret = bindings.RevocationBasepoint_to_public_key(this.ptr);
100                 Reference.reachabilityFence(this);
101                 return ret;
102         }
103
104         /**
105          * Serialize the RevocationBasepoint object into a byte array which can be read by RevocationBasepoint_read
106          */
107         public byte[] write() {
108                 byte[] ret = bindings.RevocationBasepoint_write(this.ptr);
109                 Reference.reachabilityFence(this);
110                 return ret;
111         }
112
113         /**
114          * Read a RevocationBasepoint from a byte array, created by RevocationBasepoint_write
115          */
116         public static Result_RevocationBasepointDecodeErrorZ read(byte[] ser) {
117                 long ret = bindings.RevocationBasepoint_read(ser);
118                 Reference.reachabilityFence(ser);
119                 if (ret >= 0 && ret <= 4096) { return null; }
120                 Result_RevocationBasepointDecodeErrorZ ret_hu_conv = Result_RevocationBasepointDecodeErrorZ.constr_from_ptr(ret);
121                 return ret_hu_conv;
122         }
123
124 }