6 namespace org { namespace ldk { namespace structs {
10 * This class tracks the per-transaction information needed to build a closing transaction and will
11 * actually build it and sign.
13 * This class can be used inside a signer implementation to generate a signature given the relevant
16 public class ClosingTransaction : CommonBase {
17 internal ClosingTransaction(object _dummy, long ptr) : base(ptr) { }
18 ~ClosingTransaction() {
19 if (ptr != 0) { bindings.ClosingTransaction_free(ptr); }
22 internal long clone_ptr() {
23 long ret = bindings.ClosingTransaction_clone_ptr(this.ptr);
29 * Creates a copy of the ClosingTransaction
31 public ClosingTransaction clone() {
32 long ret = bindings.ClosingTransaction_clone(this.ptr);
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); };
41 * Checks if two ClosingTransactions contain equal inner contents.
44 long ret = bindings.ClosingTransaction_hash(this.ptr);
49 public override int GetHashCode() {
50 return (int)this.hash();
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.
57 public bool eq(org.ldk.structs.ClosingTransaction b) {
58 bool ret = bindings.ClosingTransaction_eq(this.ptr, b == null ? 0 : b.ptr);
61 if (this != null) { this.ptrs_to.AddLast(b); };
65 public override bool Equals(object o) {
66 if (!(o is ClosingTransaction)) return false;
67 return this.eq((ClosingTransaction)o);
70 * Construct an object of the class
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, to_holder_script, 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); };
87 * Trust our pre-built transaction.
89 * Applies a wrapper which allows access to the transaction.
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.
94 public TrustedClosingTransaction trust() {
95 long ret = bindings.ClosingTransaction_trust(this.ptr);
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); };
104 * Verify our pre-built transaction.
106 * Applies a wrapper which allows access to the transaction.
108 * An external validating signer must call this method before signing
109 * or using the built transaction.
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);
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); };
122 * The value to be sent to the holder, or zero if the output will be omitted
124 public long to_holder_value_sat() {
125 long ret = bindings.ClosingTransaction_to_holder_value_sat(this.ptr);
131 * The value to be sent to the counterparty, or zero if the output will be omitted
133 public long to_counterparty_value_sat() {
134 long ret = bindings.ClosingTransaction_to_counterparty_value_sat(this.ptr);
140 * The destination of the holder's output
142 public byte[] to_holder_script() {
143 byte[] ret = bindings.ClosingTransaction_to_holder_script(this.ptr);
149 * The destination of the counterparty's output
151 public byte[] to_counterparty_script() {
152 byte[] ret = bindings.ClosingTransaction_to_counterparty_script(this.ptr);