[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / SpliceAck.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 splice_ack message to be received by or sent to the splice initiator.
11  */
12 public class SpliceAck : CommonBase {
13         internal SpliceAck(object _dummy, long ptr) : base(ptr) { }
14         ~SpliceAck() {
15                 if (ptr != 0) { bindings.SpliceAck_free(ptr); }
16         }
17
18         /**
19          * The channel ID where splicing is intended
20          */
21         public byte[] get_channel_id() {
22                 long ret = bindings.SpliceAck_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 where splicing is intended
31          */
32         public void set_channel_id(byte[] val) {
33                 bindings.SpliceAck_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          * The genesis hash of the blockchain where the channel is intended to be spliced
40          */
41         public byte[] get_chain_hash() {
42                 long ret = bindings.SpliceAck_get_chain_hash(this.ptr);
43                 GC.KeepAlive(this);
44                 if (ret >= 0 && ret <= 4096) { return null; }
45                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
46                 return ret_conv;
47         }
48
49         /**
50          * The genesis hash of the blockchain where the channel is intended to be spliced
51          */
52         public void set_chain_hash(byte[] val) {
53                 bindings.SpliceAck_set_chain_hash(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
54                 GC.KeepAlive(this);
55                 GC.KeepAlive(val);
56         }
57
58         /**
59          * The intended change in channel capacity: the amount to be added (positive value)
60          * or removed (negative value) by the sender (splice acceptor) by splicing into/from the channel.
61          */
62         public long get_relative_satoshis() {
63                 long ret = bindings.SpliceAck_get_relative_satoshis(this.ptr);
64                 GC.KeepAlive(this);
65                 return ret;
66         }
67
68         /**
69          * The intended change in channel capacity: the amount to be added (positive value)
70          * or removed (negative value) by the sender (splice acceptor) by splicing into/from the channel.
71          */
72         public void set_relative_satoshis(long val) {
73                 bindings.SpliceAck_set_relative_satoshis(this.ptr, val);
74                 GC.KeepAlive(this);
75                 GC.KeepAlive(val);
76         }
77
78         /**
79          * The key of the sender (splice acceptor) controlling the new funding transaction
80          */
81         public byte[] get_funding_pubkey() {
82                 long ret = bindings.SpliceAck_get_funding_pubkey(this.ptr);
83                 GC.KeepAlive(this);
84                 if (ret >= 0 && ret <= 4096) { return null; }
85                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
86                 return ret_conv;
87         }
88
89         /**
90          * The key of the sender (splice acceptor) controlling the new funding transaction
91          */
92         public void set_funding_pubkey(byte[] val) {
93                 bindings.SpliceAck_set_funding_pubkey(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
94                 GC.KeepAlive(this);
95                 GC.KeepAlive(val);
96         }
97
98         /**
99          * Constructs a new SpliceAck given each field
100          */
101         public static SpliceAck of(byte[] channel_id_arg, byte[] chain_hash_arg, long relative_satoshis_arg, byte[] funding_pubkey_arg) {
102                 long ret = bindings.SpliceAck_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(channel_id_arg, 32)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(chain_hash_arg, 32)), relative_satoshis_arg, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(funding_pubkey_arg, 33)));
103                 GC.KeepAlive(channel_id_arg);
104                 GC.KeepAlive(chain_hash_arg);
105                 GC.KeepAlive(relative_satoshis_arg);
106                 GC.KeepAlive(funding_pubkey_arg);
107                 if (ret >= 0 && ret <= 4096) { return null; }
108                 org.ldk.structs.SpliceAck ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.SpliceAck(null, ret); }
109                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
110                 return ret_hu_conv;
111         }
112
113         internal long clone_ptr() {
114                 long ret = bindings.SpliceAck_clone_ptr(this.ptr);
115                 GC.KeepAlive(this);
116                 return ret;
117         }
118
119         /**
120          * Creates a copy of the SpliceAck
121          */
122         public SpliceAck clone() {
123                 long ret = bindings.SpliceAck_clone(this.ptr);
124                 GC.KeepAlive(this);
125                 if (ret >= 0 && ret <= 4096) { return null; }
126                 org.ldk.structs.SpliceAck ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.SpliceAck(null, ret); }
127                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
128                 return ret_hu_conv;
129         }
130
131         /**
132          * Checks if two SpliceAcks contain equal inner contents.
133          * This ignores pointers and is_owned flags and looks at the values in fields.
134          * Two objects with NULL inner values will be considered "equal" here.
135          */
136         public bool eq(org.ldk.structs.SpliceAck b) {
137                 bool ret = bindings.SpliceAck_eq(this.ptr, b == null ? 0 : b.ptr);
138                 GC.KeepAlive(this);
139                 GC.KeepAlive(b);
140                 if (this != null) { this.ptrs_to.AddLast(b); };
141                 return ret;
142         }
143
144         public override bool Equals(object o) {
145                 if (!(o is SpliceAck)) return false;
146                 return this.eq((SpliceAck)o);
147         }
148         /**
149          * Serialize the SpliceAck object into a byte array which can be read by SpliceAck_read
150          */
151         public byte[] write() {
152                 long ret = bindings.SpliceAck_write(this.ptr);
153                 GC.KeepAlive(this);
154                 if (ret >= 0 && ret <= 4096) { return null; }
155                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
156                 return ret_conv;
157         }
158
159         /**
160          * Read a SpliceAck from a byte array, created by SpliceAck_write
161          */
162         public static Result_SpliceAckDecodeErrorZ read(byte[] ser) {
163                 long ret = bindings.SpliceAck_read(InternalUtils.encodeUint8Array(ser));
164                 GC.KeepAlive(ser);
165                 if (ret >= 0 && ret <= 4096) { return null; }
166                 Result_SpliceAckDecodeErrorZ ret_hu_conv = Result_SpliceAckDecodeErrorZ.constr_from_ptr(ret);
167                 return ret_hu_conv;
168         }
169
170 }
171 } } }