[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / ClosingTransaction.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8
9 /**
10  * This class tracks the per-transaction information needed to build a closing transaction and will
11  * actually build it and sign.
12  * 
13  * This class can be used inside a signer implementation to generate a signature given the relevant
14  * secret key.
15  */
16 public class ClosingTransaction : CommonBase {
17         internal ClosingTransaction(object _dummy, long ptr) : base(ptr) { }
18         ~ClosingTransaction() {
19                 if (ptr != 0) { bindings.ClosingTransaction_free(ptr); }
20         }
21
22         internal long clone_ptr() {
23                 long ret = bindings.ClosingTransaction_clone_ptr(this.ptr);
24                 GC.KeepAlive(this);
25                 return ret;
26         }
27
28         /**
29          * Creates a copy of the ClosingTransaction
30          */
31         public ClosingTransaction clone() {
32                 long ret = bindings.ClosingTransaction_clone(this.ptr);
33                 GC.KeepAlive(this);
34                 if (ret >= 0 && ret <= 4096) { return null; }
35                 org.ldk.structs.ClosingTransaction ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ClosingTransaction(null, ret); }
36                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
37                 return ret_hu_conv;
38         }
39
40         /**
41          * Generates a non-cryptographic 64-bit hash of the ClosingTransaction.
42          */
43         public long hash() {
44                 long ret = bindings.ClosingTransaction_hash(this.ptr);
45                 GC.KeepAlive(this);
46                 return ret;
47         }
48
49         public override int GetHashCode() {
50                 return (int)this.hash();
51         }
52         /**
53          * Checks if two ClosingTransactions contain equal inner contents.
54          * This ignores pointers and is_owned flags and looks at the values in fields.
55          * Two objects with NULL inner values will be considered "equal" here.
56          */
57         public bool eq(org.ldk.structs.ClosingTransaction b) {
58                 bool ret = bindings.ClosingTransaction_eq(this.ptr, b == null ? 0 : b.ptr);
59                 GC.KeepAlive(this);
60                 GC.KeepAlive(b);
61                 if (this != null) { this.ptrs_to.AddLast(b); };
62                 return ret;
63         }
64
65         public override bool Equals(object o) {
66                 if (!(o is ClosingTransaction)) return false;
67                 return this.eq((ClosingTransaction)o);
68         }
69         /**
70          * Construct an object of the class
71          */
72         public static ClosingTransaction of(long to_holder_value_sat, long to_counterparty_value_sat, byte[] to_holder_script, byte[] to_counterparty_script, org.ldk.structs.OutPoint funding_outpoint) {
73                 long ret = bindings.ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, InternalUtils.encodeUint8Array(to_holder_script), InternalUtils.encodeUint8Array(to_counterparty_script), funding_outpoint == null ? 0 : funding_outpoint.ptr);
74                 GC.KeepAlive(to_holder_value_sat);
75                 GC.KeepAlive(to_counterparty_value_sat);
76                 GC.KeepAlive(to_holder_script);
77                 GC.KeepAlive(to_counterparty_script);
78                 GC.KeepAlive(funding_outpoint);
79                 if (ret >= 0 && ret <= 4096) { return null; }
80                 org.ldk.structs.ClosingTransaction ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ClosingTransaction(null, ret); }
81                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
82                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(funding_outpoint); };
83                 return ret_hu_conv;
84         }
85
86         /**
87          * Trust our pre-built transaction.
88          * 
89          * Applies a wrapper which allows access to the transaction.
90          * 
91          * This should only be used if you fully trust the builder of this object. It should not
92          * be used by an external signer - instead use the verify function.
93          */
94         public TrustedClosingTransaction trust() {
95                 long ret = bindings.ClosingTransaction_trust(this.ptr);
96                 GC.KeepAlive(this);
97                 if (ret >= 0 && ret <= 4096) { return null; }
98                 org.ldk.structs.TrustedClosingTransaction ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TrustedClosingTransaction(null, ret); }
99                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
100                 return ret_hu_conv;
101         }
102
103         /**
104          * Verify our pre-built transaction.
105          * 
106          * Applies a wrapper which allows access to the transaction.
107          * 
108          * An external validating signer must call this method before signing
109          * or using the built transaction.
110          */
111         public Result_TrustedClosingTransactionNoneZ verify(org.ldk.structs.OutPoint funding_outpoint) {
112                 long ret = bindings.ClosingTransaction_verify(this.ptr, funding_outpoint == null ? 0 : funding_outpoint.ptr);
113                 GC.KeepAlive(this);
114                 GC.KeepAlive(funding_outpoint);
115                 if (ret >= 0 && ret <= 4096) { return null; }
116                 Result_TrustedClosingTransactionNoneZ ret_hu_conv = Result_TrustedClosingTransactionNoneZ.constr_from_ptr(ret);
117                 if (this != null) { this.ptrs_to.AddLast(funding_outpoint); };
118                 return ret_hu_conv;
119         }
120
121         /**
122          * The value to be sent to the holder, or zero if the output will be omitted
123          */
124         public long to_holder_value_sat() {
125                 long ret = bindings.ClosingTransaction_to_holder_value_sat(this.ptr);
126                 GC.KeepAlive(this);
127                 return ret;
128         }
129
130         /**
131          * The value to be sent to the counterparty, or zero if the output will be omitted
132          */
133         public long to_counterparty_value_sat() {
134                 long ret = bindings.ClosingTransaction_to_counterparty_value_sat(this.ptr);
135                 GC.KeepAlive(this);
136                 return ret;
137         }
138
139         /**
140          * The destination of the holder's output
141          */
142         public byte[] to_holder_script() {
143                 long ret = bindings.ClosingTransaction_to_holder_script(this.ptr);
144                 GC.KeepAlive(this);
145                 if (ret >= 0 && ret <= 4096) { return null; }
146                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
147                 return ret_conv;
148         }
149
150         /**
151          * The destination of the counterparty's output
152          */
153         public byte[] to_counterparty_script() {
154                 long ret = bindings.ClosingTransaction_to_counterparty_script(this.ptr);
155                 GC.KeepAlive(this);
156                 if (ret >= 0 && ret <= 4096) { return null; }
157                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
158                 return ret_conv;
159         }
160
161 }
162 } } }