1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
11 * An open_channel message to be sent or received from a peer
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class OpenChannel extends CommonBase {
15 OpenChannel(Object _dummy, long ptr) { super(ptr); }
16 @Override @SuppressWarnings("deprecation")
17 protected void finalize() throws Throwable {
19 if (ptr != 0) { bindings.OpenChannel_free(ptr); }
23 * The genesis hash of the blockchain where the channel is to be opened
25 public byte[] get_chain_hash() {
26 byte[] ret = bindings.OpenChannel_get_chain_hash(this.ptr);
31 * The genesis hash of the blockchain where the channel is to be opened
33 public void set_chain_hash(byte[] val) {
34 bindings.OpenChannel_set_chain_hash(this.ptr, val);
38 * A temporary channel ID, until the funding outpoint is announced
40 public byte[] get_temporary_channel_id() {
41 byte[] ret = bindings.OpenChannel_get_temporary_channel_id(this.ptr);
46 * A temporary channel ID, until the funding outpoint is announced
48 public void set_temporary_channel_id(byte[] val) {
49 bindings.OpenChannel_set_temporary_channel_id(this.ptr, val);
55 public long get_funding_satoshis() {
56 long ret = bindings.OpenChannel_get_funding_satoshis(this.ptr);
63 public void set_funding_satoshis(long val) {
64 bindings.OpenChannel_set_funding_satoshis(this.ptr, val);
68 * The amount to push to the counterparty as part of the open, in milli-satoshi
70 public long get_push_msat() {
71 long ret = bindings.OpenChannel_get_push_msat(this.ptr);
76 * The amount to push to the counterparty as part of the open, in milli-satoshi
78 public void set_push_msat(long val) {
79 bindings.OpenChannel_set_push_msat(this.ptr, val);
83 * The threshold below which outputs on transactions broadcast by sender will be omitted
85 public long get_dust_limit_satoshis() {
86 long ret = bindings.OpenChannel_get_dust_limit_satoshis(this.ptr);
91 * The threshold below which outputs on transactions broadcast by sender will be omitted
93 public void set_dust_limit_satoshis(long val) {
94 bindings.OpenChannel_set_dust_limit_satoshis(this.ptr, val);
98 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
100 public long get_max_htlc_value_in_flight_msat() {
101 long ret = bindings.OpenChannel_get_max_htlc_value_in_flight_msat(this.ptr);
106 * The maximum inbound HTLC value in flight towards sender, in milli-satoshi
108 public void set_max_htlc_value_in_flight_msat(long val) {
109 bindings.OpenChannel_set_max_htlc_value_in_flight_msat(this.ptr, val);
113 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
115 public long get_channel_reserve_satoshis() {
116 long ret = bindings.OpenChannel_get_channel_reserve_satoshis(this.ptr);
121 * The minimum value unencumbered by HTLCs for the counterparty to keep in the channel
123 public void set_channel_reserve_satoshis(long val) {
124 bindings.OpenChannel_set_channel_reserve_satoshis(this.ptr, val);
128 * The minimum HTLC size incoming to sender, in milli-satoshi
130 public long get_htlc_minimum_msat() {
131 long ret = bindings.OpenChannel_get_htlc_minimum_msat(this.ptr);
136 * The minimum HTLC size incoming to sender, in milli-satoshi
138 public void set_htlc_minimum_msat(long val) {
139 bindings.OpenChannel_set_htlc_minimum_msat(this.ptr, val);
143 * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
145 public int get_feerate_per_kw() {
146 int ret = bindings.OpenChannel_get_feerate_per_kw(this.ptr);
151 * The feerate per 1000-weight of sender generated transactions, until updated by update_fee
153 public void set_feerate_per_kw(int val) {
154 bindings.OpenChannel_set_feerate_per_kw(this.ptr, val);
158 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
160 public short get_to_self_delay() {
161 short ret = bindings.OpenChannel_get_to_self_delay(this.ptr);
166 * The number of blocks which the counterparty will have to wait to claim on-chain funds if they broadcast a commitment transaction
168 public void set_to_self_delay(short val) {
169 bindings.OpenChannel_set_to_self_delay(this.ptr, val);
173 * The maximum number of inbound HTLCs towards sender
175 public short get_max_accepted_htlcs() {
176 short ret = bindings.OpenChannel_get_max_accepted_htlcs(this.ptr);
181 * The maximum number of inbound HTLCs towards sender
183 public void set_max_accepted_htlcs(short val) {
184 bindings.OpenChannel_set_max_accepted_htlcs(this.ptr, val);
188 * The sender's key controlling the funding transaction
190 public byte[] get_funding_pubkey() {
191 byte[] ret = bindings.OpenChannel_get_funding_pubkey(this.ptr);
196 * The sender's key controlling the funding transaction
198 public void set_funding_pubkey(byte[] val) {
199 bindings.OpenChannel_set_funding_pubkey(this.ptr, val);
203 * Used to derive a revocation key for transactions broadcast by counterparty
205 public byte[] get_revocation_basepoint() {
206 byte[] ret = bindings.OpenChannel_get_revocation_basepoint(this.ptr);
211 * Used to derive a revocation key for transactions broadcast by counterparty
213 public void set_revocation_basepoint(byte[] val) {
214 bindings.OpenChannel_set_revocation_basepoint(this.ptr, val);
218 * A payment key to sender for transactions broadcast by counterparty
220 public byte[] get_payment_point() {
221 byte[] ret = bindings.OpenChannel_get_payment_point(this.ptr);
226 * A payment key to sender for transactions broadcast by counterparty
228 public void set_payment_point(byte[] val) {
229 bindings.OpenChannel_set_payment_point(this.ptr, val);
233 * Used to derive a payment key to sender for transactions broadcast by sender
235 public byte[] get_delayed_payment_basepoint() {
236 byte[] ret = bindings.OpenChannel_get_delayed_payment_basepoint(this.ptr);
241 * Used to derive a payment key to sender for transactions broadcast by sender
243 public void set_delayed_payment_basepoint(byte[] val) {
244 bindings.OpenChannel_set_delayed_payment_basepoint(this.ptr, val);
248 * Used to derive an HTLC payment key to sender
250 public byte[] get_htlc_basepoint() {
251 byte[] ret = bindings.OpenChannel_get_htlc_basepoint(this.ptr);
256 * Used to derive an HTLC payment key to sender
258 public void set_htlc_basepoint(byte[] val) {
259 bindings.OpenChannel_set_htlc_basepoint(this.ptr, val);
263 * The first to-be-broadcast-by-sender transaction's per commitment point
265 public byte[] get_first_per_commitment_point() {
266 byte[] ret = bindings.OpenChannel_get_first_per_commitment_point(this.ptr);
271 * The first to-be-broadcast-by-sender transaction's per commitment point
273 public void set_first_per_commitment_point(byte[] val) {
274 bindings.OpenChannel_set_first_per_commitment_point(this.ptr, val);
280 public byte get_channel_flags() {
281 byte ret = bindings.OpenChannel_get_channel_flags(this.ptr);
288 public void set_channel_flags(byte val) {
289 bindings.OpenChannel_set_channel_flags(this.ptr, val);
293 * Creates a copy of the OpenChannel
295 public OpenChannel clone() {
296 long ret = bindings.OpenChannel_clone(this.ptr);
297 if (ret < 1024) { return null; }
298 OpenChannel ret_hu_conv = new OpenChannel(null, ret);
299 ret_hu_conv.ptrs_to.add(this);
304 * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
306 public byte[] write() {
307 byte[] ret = bindings.OpenChannel_write(this.ptr);
312 * Read a OpenChannel from a byte array, created by OpenChannel_write
314 public static Result_OpenChannelDecodeErrorZ read(byte[] ser) {
315 long ret = bindings.OpenChannel_read(ser);
316 if (ret < 1024) { return null; }
317 Result_OpenChannelDecodeErrorZ ret_hu_conv = Result_OpenChannelDecodeErrorZ.constr_from_ptr(ret);