Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / BuiltCommitmentTransaction.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
9 /**
10  * A pre-built Bitcoin commitment transaction and its txid.
11  */
12 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
13 public class BuiltCommitmentTransaction extends CommonBase {
14         BuiltCommitmentTransaction(Object _dummy, long ptr) { super(ptr); }
15         @Override @SuppressWarnings("deprecation")
16         protected void finalize() throws Throwable {
17                 super.finalize();
18                 if (ptr != 0) { bindings.BuiltCommitmentTransaction_free(ptr); }
19         }
20
21         /**
22          * The commitment transaction
23          */
24         public byte[] get_transaction() {
25                 byte[] ret = bindings.BuiltCommitmentTransaction_get_transaction(this.ptr);
26                 return ret;
27         }
28
29         /**
30          * The commitment transaction
31          */
32         public void set_transaction(byte[] val) {
33                 bindings.BuiltCommitmentTransaction_set_transaction(this.ptr, val);
34         }
35
36         /**
37          * The txid for the commitment transaction.
38          * 
39          * This is provided as a performance optimization, instead of calling transaction.txid()
40          * multiple times.
41          */
42         public byte[] get_txid() {
43                 byte[] ret = bindings.BuiltCommitmentTransaction_get_txid(this.ptr);
44                 return ret;
45         }
46
47         /**
48          * The txid for the commitment transaction.
49          * 
50          * This is provided as a performance optimization, instead of calling transaction.txid()
51          * multiple times.
52          */
53         public void set_txid(byte[] val) {
54                 bindings.BuiltCommitmentTransaction_set_txid(this.ptr, val);
55         }
56
57         /**
58          * Constructs a new BuiltCommitmentTransaction given each field
59          */
60         public static BuiltCommitmentTransaction of(byte[] transaction_arg, byte[] txid_arg) {
61                 long ret = bindings.BuiltCommitmentTransaction_new(transaction_arg, txid_arg);
62                 BuiltCommitmentTransaction ret_hu_conv = new BuiltCommitmentTransaction(null, ret);
63                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
64                 return ret_hu_conv;
65         }
66
67         /**
68          * Creates a copy of the BuiltCommitmentTransaction
69          */
70         public BuiltCommitmentTransaction clone() {
71                 long ret = bindings.BuiltCommitmentTransaction_clone(this.ptr);
72                 BuiltCommitmentTransaction ret_hu_conv = new BuiltCommitmentTransaction(null, ret);
73                 ret_hu_conv.ptrs_to.add(this);
74                 return ret_hu_conv;
75         }
76
77         /**
78          * Serialize the BuiltCommitmentTransaction object into a byte array which can be read by BuiltCommitmentTransaction_read
79          */
80         public byte[] write() {
81                 byte[] ret = bindings.BuiltCommitmentTransaction_write(this.ptr);
82                 return ret;
83         }
84
85         /**
86          * Read a BuiltCommitmentTransaction from a byte array, created by BuiltCommitmentTransaction_write
87          */
88         public static Result_BuiltCommitmentTransactionDecodeErrorZ read(byte[] ser) {
89                 long ret = bindings.BuiltCommitmentTransaction_read(ser);
90                 Result_BuiltCommitmentTransactionDecodeErrorZ ret_hu_conv = Result_BuiltCommitmentTransactionDecodeErrorZ.constr_from_ptr(ret);
91                 return ret_hu_conv;
92         }
93
94         /**
95          * Get the SIGHASH_ALL sighash value of the transaction.
96          * 
97          * This can be used to verify a signature.
98          */
99         public byte[] get_sighash_all(byte[] funding_redeemscript, long channel_value_satoshis) {
100                 byte[] ret = bindings.BuiltCommitmentTransaction_get_sighash_all(this.ptr, funding_redeemscript, channel_value_satoshis);
101                 return ret;
102         }
103
104         /**
105          * Sign a transaction, either because we are counter-signing the counterparty's transaction or
106          * because we are about to broadcast a holder transaction.
107          */
108         public byte[] sign(byte[] funding_key, byte[] funding_redeemscript, long channel_value_satoshis) {
109                 byte[] ret = bindings.BuiltCommitmentTransaction_sign(this.ptr, funding_key, funding_redeemscript, channel_value_satoshis);
110                 return ret;
111         }
112
113 }