6 namespace org { namespace ldk { namespace structs {
10 * The state of a spendable output currently tracked by an [`OutputSweeper`].
12 public class TrackedSpendableOutput : CommonBase {
13 internal TrackedSpendableOutput(object _dummy, long ptr) : base(ptr) { }
14 ~TrackedSpendableOutput() {
15 if (ptr != 0) { bindings.TrackedSpendableOutput_free(ptr); }
19 * The tracked output descriptor.
21 public SpendableOutputDescriptor get_descriptor() {
22 long ret = bindings.TrackedSpendableOutput_get_descriptor(this.ptr);
24 if (ret >= 0 && ret <= 4096) { return null; }
25 org.ldk.structs.SpendableOutputDescriptor ret_hu_conv = org.ldk.structs.SpendableOutputDescriptor.constr_from_ptr(ret);
26 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
31 * The tracked output descriptor.
33 public void set_descriptor(org.ldk.structs.SpendableOutputDescriptor val) {
34 bindings.TrackedSpendableOutput_set_descriptor(this.ptr, val.ptr);
37 if (this != null) { this.ptrs_to.AddLast(val); };
41 * The channel this output belongs to.
43 * Will be `None` if no `channel_id` was given to [`OutputSweeper::track_spendable_outputs`]
45 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
47 public ChannelId get_channel_id() {
48 long ret = bindings.TrackedSpendableOutput_get_channel_id(this.ptr);
50 if (ret >= 0 && ret <= 4096) { return null; }
51 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
52 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
57 * The channel this output belongs to.
59 * Will be `None` if no `channel_id` was given to [`OutputSweeper::track_spendable_outputs`]
61 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
63 public void set_channel_id(org.ldk.structs.ChannelId val) {
64 bindings.TrackedSpendableOutput_set_channel_id(this.ptr, val == null ? 0 : val.ptr);
67 if (this != null) { this.ptrs_to.AddLast(val); };
71 * The current status of the output spend.
73 public OutputSpendStatus get_status() {
74 long ret = bindings.TrackedSpendableOutput_get_status(this.ptr);
76 if (ret >= 0 && ret <= 4096) { return null; }
77 org.ldk.structs.OutputSpendStatus ret_hu_conv = org.ldk.structs.OutputSpendStatus.constr_from_ptr(ret);
78 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
83 * The current status of the output spend.
85 public void set_status(org.ldk.structs.OutputSpendStatus val) {
86 bindings.TrackedSpendableOutput_set_status(this.ptr, val.ptr);
89 if (this != null) { this.ptrs_to.AddLast(val); };
93 * Constructs a new TrackedSpendableOutput given each field
95 * Note that channel_id_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
97 public static TrackedSpendableOutput of(org.ldk.structs.SpendableOutputDescriptor descriptor_arg, org.ldk.structs.ChannelId channel_id_arg, org.ldk.structs.OutputSpendStatus status_arg) {
98 long ret = bindings.TrackedSpendableOutput_new(descriptor_arg.ptr, channel_id_arg == null ? 0 : channel_id_arg.ptr, status_arg.ptr);
99 GC.KeepAlive(descriptor_arg);
100 GC.KeepAlive(channel_id_arg);
101 GC.KeepAlive(status_arg);
102 if (ret >= 0 && ret <= 4096) { return null; }
103 org.ldk.structs.TrackedSpendableOutput ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TrackedSpendableOutput(null, ret); }
104 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
105 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(descriptor_arg); };
106 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_id_arg); };
107 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(status_arg); };
111 internal long clone_ptr() {
112 long ret = bindings.TrackedSpendableOutput_clone_ptr(this.ptr);
118 * Creates a copy of the TrackedSpendableOutput
120 public TrackedSpendableOutput clone() {
121 long ret = bindings.TrackedSpendableOutput_clone(this.ptr);
123 if (ret >= 0 && ret <= 4096) { return null; }
124 org.ldk.structs.TrackedSpendableOutput ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TrackedSpendableOutput(null, ret); }
125 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
130 * Checks if two TrackedSpendableOutputs contain equal inner contents.
131 * This ignores pointers and is_owned flags and looks at the values in fields.
132 * Two objects with NULL inner values will be considered "equal" here.
134 public bool eq(org.ldk.structs.TrackedSpendableOutput b) {
135 bool ret = bindings.TrackedSpendableOutput_eq(this.ptr, b.ptr);
138 if (this != null) { this.ptrs_to.AddLast(b); };
142 public override bool Equals(object o) {
143 if (!(o is TrackedSpendableOutput)) return false;
144 return this.eq((TrackedSpendableOutput)o);
147 * Returns whether the output is spent in the given transaction.
149 public bool is_spent_in(byte[] tx) {
150 bool ret = bindings.TrackedSpendableOutput_is_spent_in(this.ptr, InternalUtils.encodeUint8Array(tx));
157 * Serialize the TrackedSpendableOutput object into a byte array which can be read by TrackedSpendableOutput_read
159 public byte[] write() {
160 long ret = bindings.TrackedSpendableOutput_write(this.ptr);
162 if (ret >= 0 && ret <= 4096) { return null; }
163 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
168 * Read a TrackedSpendableOutput from a byte array, created by TrackedSpendableOutput_write
170 public static Result_TrackedSpendableOutputDecodeErrorZ read(byte[] ser) {
171 long ret = bindings.TrackedSpendableOutput_read(InternalUtils.encodeUint8Array(ser));
173 if (ret >= 0 && ret <= 4096) { return null; }
174 Result_TrackedSpendableOutputDecodeErrorZ ret_hu_conv = Result_TrackedSpendableOutputDecodeErrorZ.constr_from_ptr(ret);