6 namespace org { namespace ldk { namespace structs {
9 * The current status of the output spend.
11 public class OutputSpendStatus : CommonBase {
12 protected OutputSpendStatus(object _dummy, long ptr) : base(ptr) { }
13 ~OutputSpendStatus() {
14 if (ptr != 0) { bindings.OutputSpendStatus_free(ptr); }
17 internal static OutputSpendStatus constr_from_ptr(long ptr) {
18 long raw_ty = bindings.LDKOutputSpendStatus_ty_from_ptr(ptr);
20 case 0: return new OutputSpendStatus_PendingInitialBroadcast(ptr);
21 case 1: return new OutputSpendStatus_PendingFirstConfirmation(ptr);
22 case 2: return new OutputSpendStatus_PendingThresholdConfirmations(ptr);
24 throw new ArgumentException("Impossible enum variant");
28 /** A OutputSpendStatus of type PendingInitialBroadcast */
29 public class OutputSpendStatus_PendingInitialBroadcast : OutputSpendStatus {
31 * The height at which we will first generate and broadcast a spending transaction.
33 public Option_u32Z delayed_until_height;
34 internal OutputSpendStatus_PendingInitialBroadcast(long ptr) : base(null, ptr) {
35 long delayed_until_height = bindings.LDKOutputSpendStatus_PendingInitialBroadcast_get_delayed_until_height(ptr);
36 org.ldk.structs.Option_u32Z delayed_until_height_hu_conv = org.ldk.structs.Option_u32Z.constr_from_ptr(delayed_until_height);
37 if (delayed_until_height_hu_conv != null) { delayed_until_height_hu_conv.ptrs_to.AddLast(this); };
38 this.delayed_until_height = delayed_until_height_hu_conv;
41 /** A OutputSpendStatus of type PendingFirstConfirmation */
42 public class OutputSpendStatus_PendingFirstConfirmation : OutputSpendStatus {
44 * The hash of the chain tip when we first broadcast a transaction spending this output.
46 public byte[] first_broadcast_hash;
48 * The best height when we last broadcast a transaction spending this output.
50 public int latest_broadcast_height;
52 * The transaction spending this output we last broadcasted.
54 public byte[] latest_spending_tx;
55 internal OutputSpendStatus_PendingFirstConfirmation(long ptr) : base(null, ptr) {
56 long first_broadcast_hash = bindings.LDKOutputSpendStatus_PendingFirstConfirmation_get_first_broadcast_hash(ptr);
57 byte[] first_broadcast_hash_conv = InternalUtils.decodeUint8Array(first_broadcast_hash);
58 this.first_broadcast_hash = first_broadcast_hash_conv;
59 this.latest_broadcast_height = bindings.LDKOutputSpendStatus_PendingFirstConfirmation_get_latest_broadcast_height(ptr);
60 long latest_spending_tx = bindings.LDKOutputSpendStatus_PendingFirstConfirmation_get_latest_spending_tx(ptr);
61 byte[] latest_spending_tx_conv = InternalUtils.decodeUint8Array(latest_spending_tx);
62 this.latest_spending_tx = latest_spending_tx_conv;
65 /** A OutputSpendStatus of type PendingThresholdConfirmations */
66 public class OutputSpendStatus_PendingThresholdConfirmations : OutputSpendStatus {
68 * The hash of the chain tip when we first broadcast a transaction spending this output.
70 public byte[] first_broadcast_hash;
72 * The best height when we last broadcast a transaction spending this output.
74 public int latest_broadcast_height;
76 * The transaction spending this output we saw confirmed on-chain.
78 public byte[] latest_spending_tx;
80 * The height at which the spending transaction was confirmed.
82 public int confirmation_height;
84 * The hash of the block in which the spending transaction was confirmed.
86 public byte[] confirmation_hash;
87 internal OutputSpendStatus_PendingThresholdConfirmations(long ptr) : base(null, ptr) {
88 long first_broadcast_hash = bindings.LDKOutputSpendStatus_PendingThresholdConfirmations_get_first_broadcast_hash(ptr);
89 byte[] first_broadcast_hash_conv = InternalUtils.decodeUint8Array(first_broadcast_hash);
90 this.first_broadcast_hash = first_broadcast_hash_conv;
91 this.latest_broadcast_height = bindings.LDKOutputSpendStatus_PendingThresholdConfirmations_get_latest_broadcast_height(ptr);
92 long latest_spending_tx = bindings.LDKOutputSpendStatus_PendingThresholdConfirmations_get_latest_spending_tx(ptr);
93 byte[] latest_spending_tx_conv = InternalUtils.decodeUint8Array(latest_spending_tx);
94 this.latest_spending_tx = latest_spending_tx_conv;
95 this.confirmation_height = bindings.LDKOutputSpendStatus_PendingThresholdConfirmations_get_confirmation_height(ptr);
96 long confirmation_hash = bindings.LDKOutputSpendStatus_PendingThresholdConfirmations_get_confirmation_hash(ptr);
97 byte[] confirmation_hash_conv = InternalUtils.decodeUint8Array(confirmation_hash);
98 this.confirmation_hash = confirmation_hash_conv;
101 internal long clone_ptr() {
102 long ret = bindings.OutputSpendStatus_clone_ptr(this.ptr);
108 * Creates a copy of the OutputSpendStatus
110 public OutputSpendStatus clone() {
111 long ret = bindings.OutputSpendStatus_clone(this.ptr);
113 if (ret >= 0 && ret <= 4096) { return null; }
114 org.ldk.structs.OutputSpendStatus ret_hu_conv = org.ldk.structs.OutputSpendStatus.constr_from_ptr(ret);
115 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
120 * Utility method to constructs a new PendingInitialBroadcast-variant OutputSpendStatus
122 public static OutputSpendStatus pending_initial_broadcast(org.ldk.structs.Option_u32Z delayed_until_height) {
123 long ret = bindings.OutputSpendStatus_pending_initial_broadcast(delayed_until_height.ptr);
124 GC.KeepAlive(delayed_until_height);
125 if (ret >= 0 && ret <= 4096) { return null; }
126 org.ldk.structs.OutputSpendStatus ret_hu_conv = org.ldk.structs.OutputSpendStatus.constr_from_ptr(ret);
127 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
128 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(delayed_until_height); };
133 * Utility method to constructs a new PendingFirstConfirmation-variant OutputSpendStatus
135 public static OutputSpendStatus pending_first_confirmation(byte[] first_broadcast_hash, int latest_broadcast_height, byte[] latest_spending_tx) {
136 long ret = bindings.OutputSpendStatus_pending_first_confirmation(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(first_broadcast_hash, 32)), latest_broadcast_height, InternalUtils.encodeUint8Array(latest_spending_tx));
137 GC.KeepAlive(first_broadcast_hash);
138 GC.KeepAlive(latest_broadcast_height);
139 GC.KeepAlive(latest_spending_tx);
140 if (ret >= 0 && ret <= 4096) { return null; }
141 org.ldk.structs.OutputSpendStatus ret_hu_conv = org.ldk.structs.OutputSpendStatus.constr_from_ptr(ret);
142 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
147 * Utility method to constructs a new PendingThresholdConfirmations-variant OutputSpendStatus
149 public static OutputSpendStatus pending_threshold_confirmations(byte[] first_broadcast_hash, int latest_broadcast_height, byte[] latest_spending_tx, int confirmation_height, byte[] confirmation_hash) {
150 long ret = bindings.OutputSpendStatus_pending_threshold_confirmations(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(first_broadcast_hash, 32)), latest_broadcast_height, InternalUtils.encodeUint8Array(latest_spending_tx), confirmation_height, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(confirmation_hash, 32)));
151 GC.KeepAlive(first_broadcast_hash);
152 GC.KeepAlive(latest_broadcast_height);
153 GC.KeepAlive(latest_spending_tx);
154 GC.KeepAlive(confirmation_height);
155 GC.KeepAlive(confirmation_hash);
156 if (ret >= 0 && ret <= 4096) { return null; }
157 org.ldk.structs.OutputSpendStatus ret_hu_conv = org.ldk.structs.OutputSpendStatus.constr_from_ptr(ret);
158 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
163 * Checks if two OutputSpendStatuss contain equal inner contents.
164 * This ignores pointers and is_owned flags and looks at the values in fields.
166 public bool eq(org.ldk.structs.OutputSpendStatus b) {
167 bool ret = bindings.OutputSpendStatus_eq(this.ptr, b.ptr);
173 public override bool Equals(object o) {
174 if (!(o is OutputSpendStatus)) return false;
175 return this.eq((OutputSpendStatus)o);
178 * Serialize the OutputSpendStatus object into a byte array which can be read by OutputSpendStatus_read
180 public byte[] write() {
181 long ret = bindings.OutputSpendStatus_write(this.ptr);
183 if (ret >= 0 && ret <= 4096) { return null; }
184 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
189 * Read a OutputSpendStatus from a byte array, created by OutputSpendStatus_write
191 public static Result_OutputSpendStatusDecodeErrorZ read(byte[] ser) {
192 long ret = bindings.OutputSpendStatus_read(InternalUtils.encodeUint8Array(ser));
194 if (ret >= 0 && ret <= 4096) { return null; }
195 Result_OutputSpendStatusDecodeErrorZ ret_hu_conv = Result_OutputSpendStatusDecodeErrorZ.constr_from_ptr(ret);