Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / ChannelPublicKeys.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 javax.annotation.Nullable;
8
9
10 /**
11  * One counterparty's public keys which do not change over the life of a channel.
12  */
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class ChannelPublicKeys extends CommonBase {
15         ChannelPublicKeys(Object _dummy, long ptr) { super(ptr); }
16         @Override @SuppressWarnings("deprecation")
17         protected void finalize() throws Throwable {
18                 super.finalize();
19                 if (ptr != 0) { bindings.ChannelPublicKeys_free(ptr); }
20         }
21
22         /**
23          * The public key which is used to sign all commitment transactions, as it appears in the
24          * on-chain channel lock-in 2-of-2 multisig output.
25          */
26         public byte[] get_funding_pubkey() {
27                 byte[] ret = bindings.ChannelPublicKeys_get_funding_pubkey(this.ptr);
28                 return ret;
29         }
30
31         /**
32          * The public key which is used to sign all commitment transactions, as it appears in the
33          * on-chain channel lock-in 2-of-2 multisig output.
34          */
35         public void set_funding_pubkey(byte[] val) {
36                 bindings.ChannelPublicKeys_set_funding_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33));
37         }
38
39         /**
40          * The base point which is used (with derive_public_revocation_key) to derive per-commitment
41          * revocation keys. This is combined with the per-commitment-secret generated by the
42          * counterparty to create a secret which the counterparty can reveal to revoke previous
43          * states.
44          */
45         public byte[] get_revocation_basepoint() {
46                 byte[] ret = bindings.ChannelPublicKeys_get_revocation_basepoint(this.ptr);
47                 return ret;
48         }
49
50         /**
51          * The base point which is used (with derive_public_revocation_key) to derive per-commitment
52          * revocation keys. This is combined with the per-commitment-secret generated by the
53          * counterparty to create a secret which the counterparty can reveal to revoke previous
54          * states.
55          */
56         public void set_revocation_basepoint(byte[] val) {
57                 bindings.ChannelPublicKeys_set_revocation_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
58         }
59
60         /**
61          * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
62          * spendable primary channel balance on the broadcaster's commitment transaction. This key is
63          * static across every commitment transaction.
64          */
65         public byte[] get_payment_point() {
66                 byte[] ret = bindings.ChannelPublicKeys_get_payment_point(this.ptr);
67                 return ret;
68         }
69
70         /**
71          * The public key on which the non-broadcaster (ie the countersignatory) receives an immediately
72          * spendable primary channel balance on the broadcaster's commitment transaction. This key is
73          * static across every commitment transaction.
74          */
75         public void set_payment_point(byte[] val) {
76                 bindings.ChannelPublicKeys_set_payment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
77         }
78
79         /**
80          * The base point which is used (with derive_public_key) to derive a per-commitment payment
81          * public key which receives non-HTLC-encumbered funds which are only available for spending
82          * after some delay (or can be claimed via the revocation path).
83          */
84         public byte[] get_delayed_payment_basepoint() {
85                 byte[] ret = bindings.ChannelPublicKeys_get_delayed_payment_basepoint(this.ptr);
86                 return ret;
87         }
88
89         /**
90          * The base point which is used (with derive_public_key) to derive a per-commitment payment
91          * public key which receives non-HTLC-encumbered funds which are only available for spending
92          * after some delay (or can be claimed via the revocation path).
93          */
94         public void set_delayed_payment_basepoint(byte[] val) {
95                 bindings.ChannelPublicKeys_set_delayed_payment_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
96         }
97
98         /**
99          * The base point which is used (with derive_public_key) to derive a per-commitment public key
100          * which is used to encumber HTLC-in-flight outputs.
101          */
102         public byte[] get_htlc_basepoint() {
103                 byte[] ret = bindings.ChannelPublicKeys_get_htlc_basepoint(this.ptr);
104                 return ret;
105         }
106
107         /**
108          * The base point which is used (with derive_public_key) to derive a per-commitment public key
109          * which is used to encumber HTLC-in-flight outputs.
110          */
111         public void set_htlc_basepoint(byte[] val) {
112                 bindings.ChannelPublicKeys_set_htlc_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
113         }
114
115         /**
116          * Constructs a new ChannelPublicKeys given each field
117          */
118         public static ChannelPublicKeys of(byte[] funding_pubkey_arg, byte[] revocation_basepoint_arg, byte[] payment_point_arg, byte[] delayed_payment_basepoint_arg, byte[] htlc_basepoint_arg) {
119                 long ret = bindings.ChannelPublicKeys_new(InternalUtils.check_arr_len(funding_pubkey_arg, 33), InternalUtils.check_arr_len(revocation_basepoint_arg, 33), InternalUtils.check_arr_len(payment_point_arg, 33), InternalUtils.check_arr_len(delayed_payment_basepoint_arg, 33), InternalUtils.check_arr_len(htlc_basepoint_arg, 33));
120                 if (ret >= 0 && ret <= 4096) { return null; }
121                 ChannelPublicKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelPublicKeys(null, ret); }
122                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
123                 return ret_hu_conv;
124         }
125
126         long clone_ptr() {
127                 long ret = bindings.ChannelPublicKeys_clone_ptr(this.ptr);
128                 return ret;
129         }
130
131         /**
132          * Creates a copy of the ChannelPublicKeys
133          */
134         public ChannelPublicKeys clone() {
135                 long ret = bindings.ChannelPublicKeys_clone(this.ptr);
136                 if (ret >= 0 && ret <= 4096) { return null; }
137                 ChannelPublicKeys ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new ChannelPublicKeys(null, ret); }
138                 ret_hu_conv.ptrs_to.add(this);
139                 return ret_hu_conv;
140         }
141
142         /**
143          * Serialize the ChannelPublicKeys object into a byte array which can be read by ChannelPublicKeys_read
144          */
145         public byte[] write() {
146                 byte[] ret = bindings.ChannelPublicKeys_write(this.ptr);
147                 return ret;
148         }
149
150         /**
151          * Read a ChannelPublicKeys from a byte array, created by ChannelPublicKeys_write
152          */
153         public static Result_ChannelPublicKeysDecodeErrorZ read(byte[] ser) {
154                 long ret = bindings.ChannelPublicKeys_read(ser);
155                 if (ret >= 0 && ret <= 4096) { return null; }
156                 Result_ChannelPublicKeysDecodeErrorZ ret_hu_conv = Result_ChannelPublicKeysDecodeErrorZ.constr_from_ptr(ret);
157                 return ret_hu_conv;
158         }
159
160 }