Fix write method generation w/ upstream changes
[ldk-java] / src / main / java / org / ldk / structs / HolderCommitmentTransaction.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
8 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
9 public class HolderCommitmentTransaction extends CommonBase {
10         HolderCommitmentTransaction(Object _dummy, long ptr) { super(ptr); }
11         @Override @SuppressWarnings("deprecation")
12         protected void finalize() throws Throwable {
13                 super.finalize();
14                 if (ptr != 0) { bindings.HolderCommitmentTransaction_free(ptr); }
15         }
16
17         public static HolderCommitmentTransaction constructor_clone(HolderCommitmentTransaction orig) {
18                 long ret = bindings.HolderCommitmentTransaction_clone(orig == null ? 0 : orig.ptr & ~1);
19                 HolderCommitmentTransaction ret_hu_conv = new HolderCommitmentTransaction(null, ret);
20                 ret_hu_conv.ptrs_to.add(orig);
21                 return ret_hu_conv;
22         }
23
24         public byte[] get_unsigned_tx() {
25                 byte[] ret = bindings.HolderCommitmentTransaction_get_unsigned_tx(this.ptr);
26                 return ret;
27         }
28
29         public void set_unsigned_tx(byte[] val) {
30                 bindings.HolderCommitmentTransaction_set_unsigned_tx(this.ptr, val);
31         }
32
33         public byte[] get_counterparty_sig() {
34                 byte[] ret = bindings.HolderCommitmentTransaction_get_counterparty_sig(this.ptr);
35                 return ret;
36         }
37
38         public void set_counterparty_sig(byte[] val) {
39                 bindings.HolderCommitmentTransaction_set_counterparty_sig(this.ptr, val);
40         }
41
42         public int get_feerate_per_kw() {
43                 int ret = bindings.HolderCommitmentTransaction_get_feerate_per_kw(this.ptr);
44                 return ret;
45         }
46
47         public void set_feerate_per_kw(int val) {
48                 bindings.HolderCommitmentTransaction_set_feerate_per_kw(this.ptr, val);
49         }
50
51         public void set_per_htlc(TwoTuple<HTLCOutputInCommitment, byte[]>[] val) {
52                 bindings.HolderCommitmentTransaction_set_per_htlc(this.ptr, Arrays.stream(val).mapToLong(arr_conv_42 -> bindings.C2Tuple_HTLCOutputInCommitmentSignatureZ_new(arr_conv_42.a == null ? 0 : arr_conv_42.a.ptr & ~1/*XXX: this.ptrs_to.add(arr_conv_42_a)*/, arr_conv_42.b)).toArray());
53                 /* TODO 2 TwoTuple<HTLCOutputInCommitment, byte[]>  */;
54         }
55
56         public static HolderCommitmentTransaction constructor_new_missing_holder_sig(byte[] unsigned_tx, byte[] counterparty_sig, byte[] holder_funding_key, byte[] counterparty_funding_key, TxCreationKeys keys, int feerate_per_kw, TwoTuple<HTLCOutputInCommitment, byte[]>[] htlc_data) {
57                 long ret = bindings.HolderCommitmentTransaction_new_missing_holder_sig(unsigned_tx, counterparty_sig, holder_funding_key, counterparty_funding_key, keys == null ? 0 : keys.ptr & ~1, feerate_per_kw, Arrays.stream(htlc_data).mapToLong(arr_conv_42 -> bindings.C2Tuple_HTLCOutputInCommitmentSignatureZ_new(arr_conv_42.a == null ? 0 : arr_conv_42.a.ptr & ~1/*XXX: this.ptrs_to.add(arr_conv_42_a)*/, arr_conv_42.b)).toArray());
58                 HolderCommitmentTransaction ret_hu_conv = new HolderCommitmentTransaction(null, ret);
59                 ret_hu_conv.ptrs_to.add(keys);
60                 /* TODO 2 TwoTuple<HTLCOutputInCommitment, byte[]>  */;
61                 return ret_hu_conv;
62         }
63
64         public TxCreationKeys trust_key_derivation() {
65                 long ret = bindings.HolderCommitmentTransaction_trust_key_derivation(this.ptr);
66                 TxCreationKeys ret_hu_conv = new TxCreationKeys(null, ret);
67                 return ret_hu_conv;
68         }
69
70         public byte[] txid() {
71                 byte[] ret = bindings.HolderCommitmentTransaction_txid(this.ptr);
72                 return ret;
73         }
74
75         public byte[] get_holder_sig(byte[] funding_key, byte[] funding_redeemscript, long channel_value_satoshis) {
76                 byte[] ret = bindings.HolderCommitmentTransaction_get_holder_sig(this.ptr, funding_key, funding_redeemscript, channel_value_satoshis);
77                 return ret;
78         }
79
80         public Result_CVec_SignatureZNoneZ get_htlc_sigs(byte[] htlc_base_key, short counterparty_selected_contest_delay) {
81                 long ret = bindings.HolderCommitmentTransaction_get_htlc_sigs(this.ptr, htlc_base_key, counterparty_selected_contest_delay);
82                 Result_CVec_SignatureZNoneZ ret_hu_conv = Result_CVec_SignatureZNoneZ.constr_from_ptr(ret);
83                 ret_hu_conv.ptrs_to.add(this);
84                 return ret_hu_conv;
85         }
86
87         public byte[] write() {
88                 byte[] ret = bindings.HolderCommitmentTransaction_write(this.ptr);
89                 return ret;
90         }
91
92         public static HolderCommitmentTransaction constructor_read(byte[] ser) {
93                 long ret = bindings.HolderCommitmentTransaction_read(ser);
94                 HolderCommitmentTransaction ret_hu_conv = new HolderCommitmentTransaction(null, ret);
95                 return ret_hu_conv;
96         }
97
98 }