6 namespace org { namespace ldk { namespace structs {
10 * A tx_add_input message for adding an input during interactive transaction construction
12 public class TxAddInput : CommonBase {
13 internal TxAddInput(object _dummy, long ptr) : base(ptr) { }
15 if (ptr != 0) { bindings.TxAddInput_free(ptr); }
21 public byte[] get_channel_id() {
22 long ret = bindings.TxAddInput_get_channel_id(this.ptr);
24 if (ret >= 0 && ret <= 4096) { return null; }
25 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
32 public void set_channel_id(byte[] val) {
33 bindings.TxAddInput_set_channel_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
39 * A randomly chosen unique identifier for this input, which is even for initiators and odd for
42 public long get_serial_id() {
43 long ret = bindings.TxAddInput_get_serial_id(this.ptr);
49 * A randomly chosen unique identifier for this input, which is even for initiators and odd for
52 public void set_serial_id(long val) {
53 bindings.TxAddInput_set_serial_id(this.ptr, val);
59 * Serialized transaction that contains the output this input spends to verify that it is non
62 public TransactionU16LenLimited get_prevtx() {
63 long ret = bindings.TxAddInput_get_prevtx(this.ptr);
65 if (ret >= 0 && ret <= 4096) { return null; }
66 org.ldk.structs.TransactionU16LenLimited ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TransactionU16LenLimited(null, ret); }
67 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
72 * Serialized transaction that contains the output this input spends to verify that it is non
75 public void set_prevtx(org.ldk.structs.TransactionU16LenLimited val) {
76 bindings.TxAddInput_set_prevtx(this.ptr, val == null ? 0 : val.ptr);
79 if (this != null) { this.ptrs_to.AddLast(val); };
83 * The index of the output being spent
85 public int get_prevtx_out() {
86 int ret = bindings.TxAddInput_get_prevtx_out(this.ptr);
92 * The index of the output being spent
94 public void set_prevtx_out(int val) {
95 bindings.TxAddInput_set_prevtx_out(this.ptr, val);
101 * The sequence number of this input
103 public int get_sequence() {
104 int ret = bindings.TxAddInput_get_sequence(this.ptr);
110 * The sequence number of this input
112 public void set_sequence(int val) {
113 bindings.TxAddInput_set_sequence(this.ptr, val);
119 * Constructs a new TxAddInput given each field
121 public static TxAddInput of(byte[] channel_id_arg, long serial_id_arg, org.ldk.structs.TransactionU16LenLimited prevtx_arg, int prevtx_out_arg, int sequence_arg) {
122 long ret = bindings.TxAddInput_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(channel_id_arg, 32)), serial_id_arg, prevtx_arg == null ? 0 : prevtx_arg.ptr, prevtx_out_arg, sequence_arg);
123 GC.KeepAlive(channel_id_arg);
124 GC.KeepAlive(serial_id_arg);
125 GC.KeepAlive(prevtx_arg);
126 GC.KeepAlive(prevtx_out_arg);
127 GC.KeepAlive(sequence_arg);
128 if (ret >= 0 && ret <= 4096) { return null; }
129 org.ldk.structs.TxAddInput ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxAddInput(null, ret); }
130 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
131 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(prevtx_arg); };
135 internal long clone_ptr() {
136 long ret = bindings.TxAddInput_clone_ptr(this.ptr);
142 * Creates a copy of the TxAddInput
144 public TxAddInput clone() {
145 long ret = bindings.TxAddInput_clone(this.ptr);
147 if (ret >= 0 && ret <= 4096) { return null; }
148 org.ldk.structs.TxAddInput ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxAddInput(null, ret); }
149 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
154 * Generates a non-cryptographic 64-bit hash of the TxAddInput.
157 long ret = bindings.TxAddInput_hash(this.ptr);
162 public override int GetHashCode() {
163 return (int)this.hash();
166 * Checks if two TxAddInputs contain equal inner contents.
167 * This ignores pointers and is_owned flags and looks at the values in fields.
168 * Two objects with NULL inner values will be considered "equal" here.
170 public bool eq(org.ldk.structs.TxAddInput b) {
171 bool ret = bindings.TxAddInput_eq(this.ptr, b == null ? 0 : b.ptr);
174 if (this != null) { this.ptrs_to.AddLast(b); };
178 public override bool Equals(object o) {
179 if (!(o is TxAddInput)) return false;
180 return this.eq((TxAddInput)o);
183 * Serialize the TxAddInput object into a byte array which can be read by TxAddInput_read
185 public byte[] write() {
186 long ret = bindings.TxAddInput_write(this.ptr);
188 if (ret >= 0 && ret <= 4096) { return null; }
189 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
194 * Read a TxAddInput from a byte array, created by TxAddInput_write
196 public static Result_TxAddInputDecodeErrorZ read(byte[] ser) {
197 long ret = bindings.TxAddInput_read(InternalUtils.encodeUint8Array(ser));
199 if (ret >= 0 && ret <= 4096) { return null; }
200 Result_TxAddInputDecodeErrorZ ret_hu_conv = Result_TxAddInputDecodeErrorZ.constr_from_ptr(ret);