Merge pull request #124 from TheBlueMatt/main
[ldk-java] / c_sharp / src / org / ldk / structs / AnnouncementSignatures.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  * An announcement_signatures message to be sent or received from a peer
11  */
12 public class AnnouncementSignatures : CommonBase {
13         internal AnnouncementSignatures(object _dummy, long ptr) : base(ptr) { }
14         ~AnnouncementSignatures() {
15                 if (ptr != 0) { bindings.AnnouncementSignatures_free(ptr); }
16         }
17
18         /**
19          * The channel ID
20          */
21         public byte[] get_channel_id() {
22                 byte[] ret = bindings.AnnouncementSignatures_get_channel_id(this.ptr);
23                 GC.KeepAlive(this);
24                 return ret;
25         }
26
27         /**
28          * The channel ID
29          */
30         public void set_channel_id(byte[] val) {
31                 bindings.AnnouncementSignatures_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
32                 GC.KeepAlive(this);
33                 GC.KeepAlive(val);
34         }
35
36         /**
37          * The short channel ID
38          */
39         public long get_short_channel_id() {
40                 long ret = bindings.AnnouncementSignatures_get_short_channel_id(this.ptr);
41                 GC.KeepAlive(this);
42                 return ret;
43         }
44
45         /**
46          * The short channel ID
47          */
48         public void set_short_channel_id(long val) {
49                 bindings.AnnouncementSignatures_set_short_channel_id(this.ptr, val);
50                 GC.KeepAlive(this);
51                 GC.KeepAlive(val);
52         }
53
54         /**
55          * A signature by the node key
56          */
57         public byte[] get_node_signature() {
58                 byte[] ret = bindings.AnnouncementSignatures_get_node_signature(this.ptr);
59                 GC.KeepAlive(this);
60                 return ret;
61         }
62
63         /**
64          * A signature by the node key
65          */
66         public void set_node_signature(byte[] val) {
67                 bindings.AnnouncementSignatures_set_node_signature(this.ptr, InternalUtils.check_arr_len(val, 64));
68                 GC.KeepAlive(this);
69                 GC.KeepAlive(val);
70         }
71
72         /**
73          * A signature by the funding key
74          */
75         public byte[] get_bitcoin_signature() {
76                 byte[] ret = bindings.AnnouncementSignatures_get_bitcoin_signature(this.ptr);
77                 GC.KeepAlive(this);
78                 return ret;
79         }
80
81         /**
82          * A signature by the funding key
83          */
84         public void set_bitcoin_signature(byte[] val) {
85                 bindings.AnnouncementSignatures_set_bitcoin_signature(this.ptr, InternalUtils.check_arr_len(val, 64));
86                 GC.KeepAlive(this);
87                 GC.KeepAlive(val);
88         }
89
90         /**
91          * Constructs a new AnnouncementSignatures given each field
92          */
93         public static AnnouncementSignatures of(byte[] channel_id_arg, long short_channel_id_arg, byte[] node_signature_arg, byte[] bitcoin_signature_arg) {
94                 long ret = bindings.AnnouncementSignatures_new(InternalUtils.check_arr_len(channel_id_arg, 32), short_channel_id_arg, InternalUtils.check_arr_len(node_signature_arg, 64), InternalUtils.check_arr_len(bitcoin_signature_arg, 64));
95                 GC.KeepAlive(channel_id_arg);
96                 GC.KeepAlive(short_channel_id_arg);
97                 GC.KeepAlive(node_signature_arg);
98                 GC.KeepAlive(bitcoin_signature_arg);
99                 if (ret >= 0 && ret <= 4096) { return null; }
100                 org.ldk.structs.AnnouncementSignatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.AnnouncementSignatures(null, ret); }
101                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
102                 return ret_hu_conv;
103         }
104
105         internal long clone_ptr() {
106                 long ret = bindings.AnnouncementSignatures_clone_ptr(this.ptr);
107                 GC.KeepAlive(this);
108                 return ret;
109         }
110
111         /**
112          * Creates a copy of the AnnouncementSignatures
113          */
114         public AnnouncementSignatures clone() {
115                 long ret = bindings.AnnouncementSignatures_clone(this.ptr);
116                 GC.KeepAlive(this);
117                 if (ret >= 0 && ret <= 4096) { return null; }
118                 org.ldk.structs.AnnouncementSignatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.AnnouncementSignatures(null, ret); }
119                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
120                 return ret_hu_conv;
121         }
122
123         /**
124          * Checks if two AnnouncementSignaturess contain equal inner contents.
125          * This ignores pointers and is_owned flags and looks at the values in fields.
126          * Two objects with NULL inner values will be considered "equal" here.
127          */
128         public bool eq(org.ldk.structs.AnnouncementSignatures b) {
129                 bool ret = bindings.AnnouncementSignatures_eq(this.ptr, b == null ? 0 : b.ptr);
130                 GC.KeepAlive(this);
131                 GC.KeepAlive(b);
132                 if (this != null) { this.ptrs_to.AddLast(b); };
133                 return ret;
134         }
135
136         public override bool Equals(object o) {
137                 if (!(o is AnnouncementSignatures)) return false;
138                 return this.eq((AnnouncementSignatures)o);
139         }
140         /**
141          * Serialize the AnnouncementSignatures object into a byte array which can be read by AnnouncementSignatures_read
142          */
143         public byte[] write() {
144                 byte[] ret = bindings.AnnouncementSignatures_write(this.ptr);
145                 GC.KeepAlive(this);
146                 return ret;
147         }
148
149         /**
150          * Read a AnnouncementSignatures from a byte array, created by AnnouncementSignatures_write
151          */
152         public static Result_AnnouncementSignaturesDecodeErrorZ read(byte[] ser) {
153                 long ret = bindings.AnnouncementSignatures_read(ser);
154                 GC.KeepAlive(ser);
155                 if (ret >= 0 && ret <= 4096) { return null; }
156                 Result_AnnouncementSignaturesDecodeErrorZ ret_hu_conv = Result_AnnouncementSignaturesDecodeErrorZ.constr_from_ptr(ret);
157                 return ret_hu_conv;
158         }
159
160 }
161 } } }