6 namespace org { namespace ldk { namespace structs {
10 * A tx_signatures message containing the sender's signatures for a transaction constructed with
11 * interactive transaction construction.
13 public class TxSignatures : CommonBase {
14 internal TxSignatures(object _dummy, long ptr) : base(ptr) { }
16 if (ptr != 0) { bindings.TxSignatures_free(ptr); }
22 public ChannelId get_channel_id() {
23 long ret = bindings.TxSignatures_get_channel_id(this.ptr);
25 if (ret >= 0 && ret <= 4096) { return null; }
26 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
27 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
34 public void set_channel_id(org.ldk.structs.ChannelId val) {
35 bindings.TxSignatures_set_channel_id(this.ptr, val.ptr);
38 if (this != null) { this.ptrs_to.AddLast(val); };
44 public byte[] get_tx_hash() {
45 long ret = bindings.TxSignatures_get_tx_hash(this.ptr);
47 if (ret >= 0 && ret <= 4096) { return null; }
48 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
55 public void set_tx_hash(byte[] val) {
56 bindings.TxSignatures_set_tx_hash(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
62 * The list of witnesses
64 * Returns a copy of the field.
66 public byte[][] get_witnesses() {
67 long ret = bindings.TxSignatures_get_witnesses(this.ptr);
69 if (ret >= 0 && ret <= 4096) { return null; }
70 int ret_conv_8_len = InternalUtils.getArrayLength(ret);
71 byte[][] ret_conv_8_arr = new byte[ret_conv_8_len][];
72 for (int i = 0; i < ret_conv_8_len; i++) {
73 long ret_conv_8 = InternalUtils.getU64ArrayElem(ret, i);
74 byte[] ret_conv_8_conv = InternalUtils.decodeUint8Array(ret_conv_8);
75 ret_conv_8_arr[i] = ret_conv_8_conv;
77 bindings.free_buffer(ret);
78 return ret_conv_8_arr;
82 * The list of witnesses
84 public void set_witnesses(byte[][] val) {
85 bindings.TxSignatures_set_witnesses(this.ptr, InternalUtils.encodeUint64Array(InternalUtils.mapArray(val, val_conv_8 => InternalUtils.encodeUint8Array(val_conv_8))));
91 * Optional signature for the shared input -- the previous funding outpoint -- signed by both peers
93 public Option_ECDSASignatureZ get_funding_outpoint_sig() {
94 long ret = bindings.TxSignatures_get_funding_outpoint_sig(this.ptr);
96 if (ret >= 0 && ret <= 4096) { return null; }
97 org.ldk.structs.Option_ECDSASignatureZ ret_hu_conv = org.ldk.structs.Option_ECDSASignatureZ.constr_from_ptr(ret);
98 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
103 * Optional signature for the shared input -- the previous funding outpoint -- signed by both peers
105 public void set_funding_outpoint_sig(org.ldk.structs.Option_ECDSASignatureZ val) {
106 bindings.TxSignatures_set_funding_outpoint_sig(this.ptr, val.ptr);
109 if (this != null) { this.ptrs_to.AddLast(val); };
113 * Constructs a new TxSignatures given each field
115 public static TxSignatures of(org.ldk.structs.ChannelId channel_id_arg, byte[] tx_hash_arg, byte[][] witnesses_arg, org.ldk.structs.Option_ECDSASignatureZ funding_outpoint_sig_arg) {
116 long ret = bindings.TxSignatures_new(channel_id_arg.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(tx_hash_arg, 32)), InternalUtils.encodeUint64Array(InternalUtils.mapArray(witnesses_arg, witnesses_arg_conv_8 => InternalUtils.encodeUint8Array(witnesses_arg_conv_8))), funding_outpoint_sig_arg.ptr);
117 GC.KeepAlive(channel_id_arg);
118 GC.KeepAlive(tx_hash_arg);
119 GC.KeepAlive(witnesses_arg);
120 GC.KeepAlive(funding_outpoint_sig_arg);
121 if (ret >= 0 && ret <= 4096) { return null; }
122 org.ldk.structs.TxSignatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxSignatures(null, ret); }
123 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
124 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_id_arg); };
125 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(funding_outpoint_sig_arg); };
129 internal long clone_ptr() {
130 long ret = bindings.TxSignatures_clone_ptr(this.ptr);
136 * Creates a copy of the TxSignatures
138 public TxSignatures clone() {
139 long ret = bindings.TxSignatures_clone(this.ptr);
141 if (ret >= 0 && ret <= 4096) { return null; }
142 org.ldk.structs.TxSignatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxSignatures(null, ret); }
143 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
148 * Generates a non-cryptographic 64-bit hash of the TxSignatures.
151 long ret = bindings.TxSignatures_hash(this.ptr);
156 public override int GetHashCode() {
157 return (int)this.hash();
160 * Checks if two TxSignaturess contain equal inner contents.
161 * This ignores pointers and is_owned flags and looks at the values in fields.
162 * Two objects with NULL inner values will be considered "equal" here.
164 public bool eq(org.ldk.structs.TxSignatures b) {
165 bool ret = bindings.TxSignatures_eq(this.ptr, b.ptr);
168 if (this != null) { this.ptrs_to.AddLast(b); };
172 public override bool Equals(object o) {
173 if (!(o is TxSignatures)) return false;
174 return this.eq((TxSignatures)o);
177 * Serialize the TxSignatures object into a byte array which can be read by TxSignatures_read
179 public byte[] write() {
180 long ret = bindings.TxSignatures_write(this.ptr);
182 if (ret >= 0 && ret <= 4096) { return null; }
183 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
188 * Read a TxSignatures from a byte array, created by TxSignatures_write
190 public static Result_TxSignaturesDecodeErrorZ read(byte[] ser) {
191 long ret = bindings.TxSignatures_read(InternalUtils.encodeUint8Array(ser));
193 if (ret >= 0 && ret <= 4096) { return null; }
194 Result_TxSignaturesDecodeErrorZ ret_hu_conv = Result_TxSignaturesDecodeErrorZ.constr_from_ptr(ret);