1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
8 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
9 public class CommitmentUpdate extends CommonBase {
10 CommitmentUpdate(Object _dummy, long ptr) { super(ptr); }
11 @Override @SuppressWarnings("deprecation")
12 protected void finalize() throws Throwable {
14 if (ptr != 0) { bindings.CommitmentUpdate_free(ptr); }
17 public static CommitmentUpdate constructor_clone(CommitmentUpdate orig) {
18 long ret = bindings.CommitmentUpdate_clone(orig == null ? 0 : orig.ptr & ~1);
19 CommitmentUpdate ret_hu_conv = new CommitmentUpdate(null, ret);
20 ret_hu_conv.ptrs_to.add(orig);
24 public void set_update_add_htlcs(UpdateAddHTLC[] val) {
25 bindings.CommitmentUpdate_set_update_add_htlcs(this.ptr, Arrays.stream(val).mapToLong(arr_conv_15 -> arr_conv_15 == null ? 0 : arr_conv_15.ptr & ~1).toArray());
26 /* TODO 2 UpdateAddHTLC */;
29 public void set_update_fulfill_htlcs(UpdateFulfillHTLC[] val) {
30 bindings.CommitmentUpdate_set_update_fulfill_htlcs(this.ptr, Arrays.stream(val).mapToLong(arr_conv_19 -> arr_conv_19 == null ? 0 : arr_conv_19.ptr & ~1).toArray());
31 /* TODO 2 UpdateFulfillHTLC */;
34 public void set_update_fail_htlcs(UpdateFailHTLC[] val) {
35 bindings.CommitmentUpdate_set_update_fail_htlcs(this.ptr, Arrays.stream(val).mapToLong(arr_conv_16 -> arr_conv_16 == null ? 0 : arr_conv_16.ptr & ~1).toArray());
36 /* TODO 2 UpdateFailHTLC */;
39 public void set_update_fail_malformed_htlcs(UpdateFailMalformedHTLC[] val) {
40 bindings.CommitmentUpdate_set_update_fail_malformed_htlcs(this.ptr, Arrays.stream(val).mapToLong(arr_conv_25 -> arr_conv_25 == null ? 0 : arr_conv_25.ptr & ~1).toArray());
41 /* TODO 2 UpdateFailMalformedHTLC */;
44 public UpdateFee get_update_fee() {
45 long ret = bindings.CommitmentUpdate_get_update_fee(this.ptr);
46 UpdateFee ret_hu_conv = new UpdateFee(null, ret);
50 public void set_update_fee(UpdateFee val) {
51 bindings.CommitmentUpdate_set_update_fee(this.ptr, val == null ? 0 : val.ptr & ~1);
52 this.ptrs_to.add(val);
55 public CommitmentSigned get_commitment_signed() {
56 long ret = bindings.CommitmentUpdate_get_commitment_signed(this.ptr);
57 CommitmentSigned ret_hu_conv = new CommitmentSigned(null, ret);
61 public void set_commitment_signed(CommitmentSigned val) {
62 bindings.CommitmentUpdate_set_commitment_signed(this.ptr, val == null ? 0 : val.ptr & ~1);
63 this.ptrs_to.add(val);
66 public static CommitmentUpdate constructor_new(UpdateAddHTLC[] update_add_htlcs_arg, UpdateFulfillHTLC[] update_fulfill_htlcs_arg, UpdateFailHTLC[] update_fail_htlcs_arg, UpdateFailMalformedHTLC[] update_fail_malformed_htlcs_arg, UpdateFee update_fee_arg, CommitmentSigned commitment_signed_arg) {
67 long ret = bindings.CommitmentUpdate_new(Arrays.stream(update_add_htlcs_arg).mapToLong(arr_conv_15 -> arr_conv_15 == null ? 0 : arr_conv_15.ptr & ~1).toArray(), Arrays.stream(update_fulfill_htlcs_arg).mapToLong(arr_conv_19 -> arr_conv_19 == null ? 0 : arr_conv_19.ptr & ~1).toArray(), Arrays.stream(update_fail_htlcs_arg).mapToLong(arr_conv_16 -> arr_conv_16 == null ? 0 : arr_conv_16.ptr & ~1).toArray(), Arrays.stream(update_fail_malformed_htlcs_arg).mapToLong(arr_conv_25 -> arr_conv_25 == null ? 0 : arr_conv_25.ptr & ~1).toArray(), update_fee_arg == null ? 0 : update_fee_arg.ptr & ~1, commitment_signed_arg == null ? 0 : commitment_signed_arg.ptr & ~1);
68 CommitmentUpdate ret_hu_conv = new CommitmentUpdate(null, ret);
69 /* TODO 2 UpdateAddHTLC */;
70 /* TODO 2 UpdateFulfillHTLC */;
71 /* TODO 2 UpdateFailHTLC */;
72 /* TODO 2 UpdateFailMalformedHTLC */;
73 ret_hu_conv.ptrs_to.add(update_fee_arg);
74 ret_hu_conv.ptrs_to.add(commitment_signed_arg);