[TS] Update auto-generated bindings to LDK-C-Bindings 0.0.123.1
[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 ChannelId 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                 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
26                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
27                 return ret_hu_conv;
28         }
29
30         /**
31          * The channel ID
32          */
33         public void set_channel_id(org.ldk.structs.ChannelId val) {
34                 bindings.TxAbort_set_channel_id(this.ptr, val.ptr);
35                 GC.KeepAlive(this);
36                 GC.KeepAlive(val);
37                 if (this != null) { this.ptrs_to.AddLast(val); };
38         }
39
40         /**
41          * Message data
42          * 
43          * Returns a copy of the field.
44          */
45         public byte[] get_data() {
46                 long ret = bindings.TxAbort_get_data(this.ptr);
47                 GC.KeepAlive(this);
48                 if (ret >= 0 && ret <= 4096) { return null; }
49                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
50                 return ret_conv;
51         }
52
53         /**
54          * Message data
55          */
56         public void set_data(byte[] val) {
57                 bindings.TxAbort_set_data(this.ptr, InternalUtils.encodeUint8Array(val));
58                 GC.KeepAlive(this);
59                 GC.KeepAlive(val);
60         }
61
62         /**
63          * Constructs a new TxAbort given each field
64          */
65         public static TxAbort of(org.ldk.structs.ChannelId channel_id_arg, byte[] data_arg) {
66                 long ret = bindings.TxAbort_new(channel_id_arg.ptr, InternalUtils.encodeUint8Array(data_arg));
67                 GC.KeepAlive(channel_id_arg);
68                 GC.KeepAlive(data_arg);
69                 if (ret >= 0 && ret <= 4096) { return null; }
70                 org.ldk.structs.TxAbort ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxAbort(null, ret); }
71                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
72                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_id_arg); };
73                 return ret_hu_conv;
74         }
75
76         internal long clone_ptr() {
77                 long ret = bindings.TxAbort_clone_ptr(this.ptr);
78                 GC.KeepAlive(this);
79                 return ret;
80         }
81
82         /**
83          * Creates a copy of the TxAbort
84          */
85         public TxAbort clone() {
86                 long ret = bindings.TxAbort_clone(this.ptr);
87                 GC.KeepAlive(this);
88                 if (ret >= 0 && ret <= 4096) { return null; }
89                 org.ldk.structs.TxAbort ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TxAbort(null, ret); }
90                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
91                 return ret_hu_conv;
92         }
93
94         /**
95          * Generates a non-cryptographic 64-bit hash of the TxAbort.
96          */
97         public long hash() {
98                 long ret = bindings.TxAbort_hash(this.ptr);
99                 GC.KeepAlive(this);
100                 return ret;
101         }
102
103         public override int GetHashCode() {
104                 return (int)this.hash();
105         }
106         /**
107          * Checks if two TxAborts contain equal inner contents.
108          * This ignores pointers and is_owned flags and looks at the values in fields.
109          * Two objects with NULL inner values will be considered "equal" here.
110          */
111         public bool eq(org.ldk.structs.TxAbort b) {
112                 bool ret = bindings.TxAbort_eq(this.ptr, b.ptr);
113                 GC.KeepAlive(this);
114                 GC.KeepAlive(b);
115                 if (this != null) { this.ptrs_to.AddLast(b); };
116                 return ret;
117         }
118
119         public override bool Equals(object o) {
120                 if (!(o is TxAbort)) return false;
121                 return this.eq((TxAbort)o);
122         }
123         /**
124          * Serialize the TxAbort object into a byte array which can be read by TxAbort_read
125          */
126         public byte[] write() {
127                 long ret = bindings.TxAbort_write(this.ptr);
128                 GC.KeepAlive(this);
129                 if (ret >= 0 && ret <= 4096) { return null; }
130                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
131                 return ret_conv;
132         }
133
134         /**
135          * Read a TxAbort from a byte array, created by TxAbort_write
136          */
137         public static Result_TxAbortDecodeErrorZ read(byte[] ser) {
138                 long ret = bindings.TxAbort_read(InternalUtils.encodeUint8Array(ser));
139                 GC.KeepAlive(ser);
140                 if (ret >= 0 && ret <= 4096) { return null; }
141                 Result_TxAbortDecodeErrorZ ret_hu_conv = Result_TxAbortDecodeErrorZ.constr_from_ptr(ret);
142                 return ret_hu_conv;
143         }
144
145 }
146 } } }