[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / TxAbort.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8
9 /**
10  * A tx_abort message which signals the cancellation of an in-progress transaction negotiation.
11  */
12 public class TxAbort : CommonBase {
13         internal TxAbort(object _dummy, long ptr) : base(ptr) { }
14         ~TxAbort() {
15                 if (ptr != 0) { bindings.TxAbort_free(ptr); }
16         }
17
18         /**
19          * The channel ID
20          */
21         public byte[] get_channel_id() {
22                 long ret = bindings.TxAbort_get_channel_id(this.ptr);
23                 GC.KeepAlive(this);
24                 if (ret >= 0 && ret <= 4096) { return null; }
25                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
26                 return ret_conv;
27         }
28
29         /**
30          * The channel ID
31          */
32         public void set_channel_id(byte[] val) {
33                 bindings.TxAbort_set_channel_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
34                 GC.KeepAlive(this);
35                 GC.KeepAlive(val);
36         }
37
38         /**
39          * Message data
40          * 
41          * Returns a copy of the field.
42          */
43         public byte[] get_data() {
44                 long ret = bindings.TxAbort_get_data(this.ptr);
45                 GC.KeepAlive(this);
46                 if (ret >= 0 && ret <= 4096) { return null; }
47                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
48                 return ret_conv;
49         }
50
51         /**
52          * Message data
53          */
54         public void set_data(byte[] val) {
55                 bindings.TxAbort_set_data(this.ptr, InternalUtils.encodeUint8Array(val));
56                 GC.KeepAlive(this);
57                 GC.KeepAlive(val);
58         }
59
60         /**
61          * Constructs a new TxAbort given each field
62          */
63         public static TxAbort of(byte[] channel_id_arg, byte[] data_arg) {
64                 long ret = bindings.TxAbort_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(channel_id_arg, 32)), InternalUtils.encodeUint8Array(data_arg));
65                 GC.KeepAlive(channel_id_arg);
66                 GC.KeepAlive(data_arg);
67                 if (ret >= 0 && ret <= 4096) { return null; }
68                 org.ldk.structs.TxAbort ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxAbort(null, ret); }
69                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
70                 return ret_hu_conv;
71         }
72
73         internal long clone_ptr() {
74                 long ret = bindings.TxAbort_clone_ptr(this.ptr);
75                 GC.KeepAlive(this);
76                 return ret;
77         }
78
79         /**
80          * Creates a copy of the TxAbort
81          */
82         public TxAbort clone() {
83                 long ret = bindings.TxAbort_clone(this.ptr);
84                 GC.KeepAlive(this);
85                 if (ret >= 0 && ret <= 4096) { return null; }
86                 org.ldk.structs.TxAbort ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxAbort(null, ret); }
87                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
88                 return ret_hu_conv;
89         }
90
91         /**
92          * Generates a non-cryptographic 64-bit hash of the TxAbort.
93          */
94         public long hash() {
95                 long ret = bindings.TxAbort_hash(this.ptr);
96                 GC.KeepAlive(this);
97                 return ret;
98         }
99
100         public override int GetHashCode() {
101                 return (int)this.hash();
102         }
103         /**
104          * Checks if two TxAborts contain equal inner contents.
105          * This ignores pointers and is_owned flags and looks at the values in fields.
106          * Two objects with NULL inner values will be considered "equal" here.
107          */
108         public bool eq(org.ldk.structs.TxAbort b) {
109                 bool ret = bindings.TxAbort_eq(this.ptr, b == null ? 0 : b.ptr);
110                 GC.KeepAlive(this);
111                 GC.KeepAlive(b);
112                 if (this != null) { this.ptrs_to.AddLast(b); };
113                 return ret;
114         }
115
116         public override bool Equals(object o) {
117                 if (!(o is TxAbort)) return false;
118                 return this.eq((TxAbort)o);
119         }
120         /**
121          * Serialize the TxAbort object into a byte array which can be read by TxAbort_read
122          */
123         public byte[] write() {
124                 long ret = bindings.TxAbort_write(this.ptr);
125                 GC.KeepAlive(this);
126                 if (ret >= 0 && ret <= 4096) { return null; }
127                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
128                 return ret_conv;
129         }
130
131         /**
132          * Read a TxAbort from a byte array, created by TxAbort_write
133          */
134         public static Result_TxAbortDecodeErrorZ read(byte[] ser) {
135                 long ret = bindings.TxAbort_read(InternalUtils.encodeUint8Array(ser));
136                 GC.KeepAlive(ser);
137                 if (ret >= 0 && ret <= 4096) { return null; }
138                 Result_TxAbortDecodeErrorZ ret_hu_conv = Result_TxAbortDecodeErrorZ.constr_from_ptr(ret);
139                 return ret_hu_conv;
140         }
141
142 }
143 } } }