[C#] Update auto-generated files
[ldk-java] / c_sharp / src / org / ldk / structs / RevokeAndACK.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 [`revoke_and_ack`] message to be sent to or received from a peer.
11  * 
12  * [`revoke_and_ack`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#completing-the-transition-to-the-updated-state-revoke_and_ack
13  */
14 public class RevokeAndACK : CommonBase {
15         internal RevokeAndACK(object _dummy, long ptr) : base(ptr) { }
16         ~RevokeAndACK() {
17                 if (ptr != 0) { bindings.RevokeAndACK_free(ptr); }
18         }
19
20         /**
21          * The channel ID
22          */
23         public byte[] get_channel_id() {
24                 byte[] ret = bindings.RevokeAndACK_get_channel_id(this.ptr);
25                 GC.KeepAlive(this);
26                 return ret;
27         }
28
29         /**
30          * The channel ID
31          */
32         public void set_channel_id(byte[] val) {
33                 bindings.RevokeAndACK_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
34                 GC.KeepAlive(this);
35                 GC.KeepAlive(val);
36         }
37
38         /**
39          * The secret corresponding to the per-commitment point
40          */
41         public byte[] get_per_commitment_secret() {
42                 byte[] ret = bindings.RevokeAndACK_get_per_commitment_secret(this.ptr);
43                 GC.KeepAlive(this);
44                 return ret;
45         }
46
47         /**
48          * The secret corresponding to the per-commitment point
49          */
50         public void set_per_commitment_secret(byte[] val) {
51                 bindings.RevokeAndACK_set_per_commitment_secret(this.ptr, InternalUtils.check_arr_len(val, 32));
52                 GC.KeepAlive(this);
53                 GC.KeepAlive(val);
54         }
55
56         /**
57          * The next sender-broadcast commitment transaction's per-commitment point
58          */
59         public byte[] get_next_per_commitment_point() {
60                 byte[] ret = bindings.RevokeAndACK_get_next_per_commitment_point(this.ptr);
61                 GC.KeepAlive(this);
62                 return ret;
63         }
64
65         /**
66          * The next sender-broadcast commitment transaction's per-commitment point
67          */
68         public void set_next_per_commitment_point(byte[] val) {
69                 bindings.RevokeAndACK_set_next_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
70                 GC.KeepAlive(this);
71                 GC.KeepAlive(val);
72         }
73
74         /**
75          * Constructs a new RevokeAndACK given each field
76          */
77         public static RevokeAndACK of(byte[] channel_id_arg, byte[] per_commitment_secret_arg, byte[] next_per_commitment_point_arg) {
78                 long ret = bindings.RevokeAndACK_new(InternalUtils.check_arr_len(channel_id_arg, 32), InternalUtils.check_arr_len(per_commitment_secret_arg, 32), InternalUtils.check_arr_len(next_per_commitment_point_arg, 33));
79                 GC.KeepAlive(channel_id_arg);
80                 GC.KeepAlive(per_commitment_secret_arg);
81                 GC.KeepAlive(next_per_commitment_point_arg);
82                 if (ret >= 0 && ret <= 4096) { return null; }
83                 org.ldk.structs.RevokeAndACK ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RevokeAndACK(null, ret); }
84                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
85                 return ret_hu_conv;
86         }
87
88         internal long clone_ptr() {
89                 long ret = bindings.RevokeAndACK_clone_ptr(this.ptr);
90                 GC.KeepAlive(this);
91                 return ret;
92         }
93
94         /**
95          * Creates a copy of the RevokeAndACK
96          */
97         public RevokeAndACK clone() {
98                 long ret = bindings.RevokeAndACK_clone(this.ptr);
99                 GC.KeepAlive(this);
100                 if (ret >= 0 && ret <= 4096) { return null; }
101                 org.ldk.structs.RevokeAndACK ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RevokeAndACK(null, ret); }
102                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
103                 return ret_hu_conv;
104         }
105
106         /**
107          * Checks if two RevokeAndACKs 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.RevokeAndACK b) {
112                 bool ret = bindings.RevokeAndACK_eq(this.ptr, b == null ? 0 : 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 RevokeAndACK)) return false;
121                 return this.eq((RevokeAndACK)o);
122         }
123         /**
124          * Serialize the RevokeAndACK object into a byte array which can be read by RevokeAndACK_read
125          */
126         public byte[] write() {
127                 byte[] ret = bindings.RevokeAndACK_write(this.ptr);
128                 GC.KeepAlive(this);
129                 return ret;
130         }
131
132         /**
133          * Read a RevokeAndACK from a byte array, created by RevokeAndACK_write
134          */
135         public static Result_RevokeAndACKDecodeErrorZ read(byte[] ser) {
136                 long ret = bindings.RevokeAndACK_read(ser);
137                 GC.KeepAlive(ser);
138                 if (ret >= 0 && ret <= 4096) { return null; }
139                 Result_RevokeAndACKDecodeErrorZ ret_hu_conv = Result_RevokeAndACKDecodeErrorZ.constr_from_ptr(ret);
140                 return ret_hu_conv;
141         }
142
143 }
144 } } }