]> git.bitcoin.ninja Git - ldk-java/blob - c_sharp/src/org/ldk/structs/CommitmentSigned.cs
[C#] Check in initial auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / CommitmentSigned.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 commitment_signed message to be sent or received from a peer
11  */
12 public class CommitmentSigned : CommonBase {
13         internal CommitmentSigned(object _dummy, long ptr) : base(ptr) { }
14         ~CommitmentSigned() {
15                 if (ptr != 0) { bindings.CommitmentSigned_free(ptr); }
16         }
17
18         /**
19          * The channel ID
20          */
21         public byte[] get_channel_id() {
22                 byte[] ret = bindings.CommitmentSigned_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.CommitmentSigned_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
32                 GC.KeepAlive(this);
33                 GC.KeepAlive(val);
34         }
35
36         /**
37          * A signature on the commitment transaction
38          */
39         public byte[] get_signature() {
40                 byte[] ret = bindings.CommitmentSigned_get_signature(this.ptr);
41                 GC.KeepAlive(this);
42                 return ret;
43         }
44
45         /**
46          * A signature on the commitment transaction
47          */
48         public void set_signature(byte[] val) {
49                 bindings.CommitmentSigned_set_signature(this.ptr, InternalUtils.check_arr_len(val, 64));
50                 GC.KeepAlive(this);
51                 GC.KeepAlive(val);
52         }
53
54         /**
55          * Signatures on the HTLC transactions
56          * 
57          * Returns a copy of the field.
58          */
59         public byte[][] get_htlc_signatures() {
60                 byte[][] ret = bindings.CommitmentSigned_get_htlc_signatures(this.ptr);
61                 GC.KeepAlive(this);
62                 return ret;
63         }
64
65         /**
66          * Signatures on the HTLC transactions
67          */
68         public void set_htlc_signatures(byte[][] val) {
69                 bindings.CommitmentSigned_set_htlc_signatures(this.ptr, val != null ? InternalUtils.mapArray(val, val_conv_8 => InternalUtils.check_arr_len(val_conv_8, 64)) : null);
70                 GC.KeepAlive(this);
71                 GC.KeepAlive(val);
72         }
73
74         /**
75          * Constructs a new CommitmentSigned given each field
76          */
77         public static CommitmentSigned of(byte[] channel_id_arg, byte[] signature_arg, byte[][] htlc_signatures_arg) {
78                 long ret = bindings.CommitmentSigned_new(InternalUtils.check_arr_len(channel_id_arg, 32), InternalUtils.check_arr_len(signature_arg, 64), htlc_signatures_arg != null ? InternalUtils.mapArray(htlc_signatures_arg, htlc_signatures_arg_conv_8 => InternalUtils.check_arr_len(htlc_signatures_arg_conv_8, 64)) : null);
79                 GC.KeepAlive(channel_id_arg);
80                 GC.KeepAlive(signature_arg);
81                 GC.KeepAlive(htlc_signatures_arg);
82                 if (ret >= 0 && ret <= 4096) { return null; }
83                 org.ldk.structs.CommitmentSigned ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.CommitmentSigned(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.CommitmentSigned_clone_ptr(this.ptr);
90                 GC.KeepAlive(this);
91                 return ret;
92         }
93
94         /**
95          * Creates a copy of the CommitmentSigned
96          */
97         public CommitmentSigned clone() {
98                 long ret = bindings.CommitmentSigned_clone(this.ptr);
99                 GC.KeepAlive(this);
100                 if (ret >= 0 && ret <= 4096) { return null; }
101                 org.ldk.structs.CommitmentSigned ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.CommitmentSigned(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 CommitmentSigneds 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.CommitmentSigned b) {
112                 bool ret = bindings.CommitmentSigned_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 CommitmentSigned)) return false;
121                 return this.eq((CommitmentSigned)o);
122         }
123         /**
124          * Serialize the CommitmentSigned object into a byte array which can be read by CommitmentSigned_read
125          */
126         public byte[] write() {
127                 byte[] ret = bindings.CommitmentSigned_write(this.ptr);
128                 GC.KeepAlive(this);
129                 return ret;
130         }
131
132         /**
133          * Read a CommitmentSigned from a byte array, created by CommitmentSigned_write
134          */
135         public static Result_CommitmentSignedDecodeErrorZ read(byte[] ser) {
136                 long ret = bindings.CommitmentSigned_read(ser);
137                 GC.KeepAlive(ser);
138                 if (ret >= 0 && ret <= 4096) { return null; }
139                 Result_CommitmentSignedDecodeErrorZ ret_hu_conv = Result_CommitmentSignedDecodeErrorZ.constr_from_ptr(ret);
140                 return ret_hu_conv;
141         }
142
143 }
144 } } }