[Java] Update auto-generated Java bindings to LDK 0.0.121
[ldk-java] / src / main / java / org / ldk / structs / DelayedPaymentBasepoint.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  * Base key used in conjunction with a `per_commitment_point` to generate a [`DelayedPaymentKey`].
13  * 
14  * The delayed payment key is used to pay the commitment state broadcaster their
15  * non-HTLC-encumbered funds after a delay to give their counterparty a chance to punish if the
16  * state broadcasted was previously revoked.
17  */
18 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
19 public class DelayedPaymentBasepoint extends CommonBase {
20         DelayedPaymentBasepoint(Object _dummy, long ptr) { super(ptr); }
21         @Override @SuppressWarnings("deprecation")
22         protected void finalize() throws Throwable {
23                 super.finalize();
24                 if (ptr != 0) { bindings.DelayedPaymentBasepoint_free(ptr); }
25         }
26
27         public byte[] get_a() {
28                 byte[] ret = bindings.DelayedPaymentBasepoint_get_a(this.ptr);
29                 Reference.reachabilityFence(this);
30                 return ret;
31         }
32
33         public void set_a(byte[] val) {
34                 bindings.DelayedPaymentBasepoint_set_a(this.ptr, InternalUtils.check_arr_len(val, 33));
35                 Reference.reachabilityFence(this);
36                 Reference.reachabilityFence(val);
37         }
38
39         /**
40          * Constructs a new DelayedPaymentBasepoint given each field
41          */
42         public static DelayedPaymentBasepoint of(byte[] a_arg) {
43                 long ret = bindings.DelayedPaymentBasepoint_new(InternalUtils.check_arr_len(a_arg, 33));
44                 Reference.reachabilityFence(a_arg);
45                 if (ret >= 0 && ret <= 4096) { return null; }
46                 org.ldk.structs.DelayedPaymentBasepoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DelayedPaymentBasepoint(null, ret); }
47                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
48                 return ret_hu_conv;
49         }
50
51         /**
52          * Checks if two DelayedPaymentBasepoints contain equal inner contents.
53          * This ignores pointers and is_owned flags and looks at the values in fields.
54          * Two objects with NULL inner values will be considered "equal" here.
55          */
56         public boolean eq(org.ldk.structs.DelayedPaymentBasepoint b) {
57                 boolean ret = bindings.DelayedPaymentBasepoint_eq(this.ptr, b == null ? 0 : b.ptr);
58                 Reference.reachabilityFence(this);
59                 Reference.reachabilityFence(b);
60                 if (this != null) { this.ptrs_to.add(b); };
61                 return ret;
62         }
63
64         @Override public boolean equals(Object o) {
65                 if (!(o instanceof DelayedPaymentBasepoint)) return false;
66                 return this.eq((DelayedPaymentBasepoint)o);
67         }
68         long clone_ptr() {
69                 long ret = bindings.DelayedPaymentBasepoint_clone_ptr(this.ptr);
70                 Reference.reachabilityFence(this);
71                 return ret;
72         }
73
74         /**
75          * Creates a copy of the DelayedPaymentBasepoint
76          */
77         public DelayedPaymentBasepoint clone() {
78                 long ret = bindings.DelayedPaymentBasepoint_clone(this.ptr);
79                 Reference.reachabilityFence(this);
80                 if (ret >= 0 && ret <= 4096) { return null; }
81                 org.ldk.structs.DelayedPaymentBasepoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DelayedPaymentBasepoint(null, ret); }
82                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
83                 return ret_hu_conv;
84         }
85
86         /**
87          * Generates a non-cryptographic 64-bit hash of the DelayedPaymentBasepoint.
88          */
89         public long hash() {
90                 long ret = bindings.DelayedPaymentBasepoint_hash(this.ptr);
91                 Reference.reachabilityFence(this);
92                 return ret;
93         }
94
95         @Override public int hashCode() {
96                 return (int)this.hash();
97         }
98         /**
99          * Get inner Public Key
100          */
101         public byte[] to_public_key() {
102                 byte[] ret = bindings.DelayedPaymentBasepoint_to_public_key(this.ptr);
103                 Reference.reachabilityFence(this);
104                 return ret;
105         }
106
107         /**
108          * Serialize the DelayedPaymentBasepoint object into a byte array which can be read by DelayedPaymentBasepoint_read
109          */
110         public byte[] write() {
111                 byte[] ret = bindings.DelayedPaymentBasepoint_write(this.ptr);
112                 Reference.reachabilityFence(this);
113                 return ret;
114         }
115
116         /**
117          * Read a DelayedPaymentBasepoint from a byte array, created by DelayedPaymentBasepoint_write
118          */
119         public static Result_DelayedPaymentBasepointDecodeErrorZ read(byte[] ser) {
120                 long ret = bindings.DelayedPaymentBasepoint_read(ser);
121                 Reference.reachabilityFence(ser);
122                 if (ret >= 0 && ret <= 4096) { return null; }
123                 Result_DelayedPaymentBasepointDecodeErrorZ ret_hu_conv = Result_DelayedPaymentBasepointDecodeErrorZ.constr_from_ptr(ret);
124                 return ret_hu_conv;
125         }
126
127 }