[C#] Update auto-generated files
[ldk-java] / c_sharp / src / org / ldk / structs / FundingCreated.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 [`funding_created`] message to be sent to or received from a peer.
11  * 
12  * Used in V1 channel establishment
13  * 
14  * [`funding_created`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-funding_created-message
15  */
16 public class FundingCreated : CommonBase {
17         internal FundingCreated(object _dummy, long ptr) : base(ptr) { }
18         ~FundingCreated() {
19                 if (ptr != 0) { bindings.FundingCreated_free(ptr); }
20         }
21
22         /**
23          * A temporary channel ID, until the funding is established
24          */
25         public byte[] get_temporary_channel_id() {
26                 byte[] ret = bindings.FundingCreated_get_temporary_channel_id(this.ptr);
27                 GC.KeepAlive(this);
28                 return ret;
29         }
30
31         /**
32          * A temporary channel ID, until the funding is established
33          */
34         public void set_temporary_channel_id(byte[] val) {
35                 bindings.FundingCreated_set_temporary_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
36                 GC.KeepAlive(this);
37                 GC.KeepAlive(val);
38         }
39
40         /**
41          * The funding transaction ID
42          */
43         public byte[] get_funding_txid() {
44                 byte[] ret = bindings.FundingCreated_get_funding_txid(this.ptr);
45                 GC.KeepAlive(this);
46                 return ret;
47         }
48
49         /**
50          * The funding transaction ID
51          */
52         public void set_funding_txid(byte[] val) {
53                 bindings.FundingCreated_set_funding_txid(this.ptr, InternalUtils.check_arr_len(val, 32));
54                 GC.KeepAlive(this);
55                 GC.KeepAlive(val);
56         }
57
58         /**
59          * The specific output index funding this channel
60          */
61         public short get_funding_output_index() {
62                 short ret = bindings.FundingCreated_get_funding_output_index(this.ptr);
63                 GC.KeepAlive(this);
64                 return ret;
65         }
66
67         /**
68          * The specific output index funding this channel
69          */
70         public void set_funding_output_index(short val) {
71                 bindings.FundingCreated_set_funding_output_index(this.ptr, val);
72                 GC.KeepAlive(this);
73                 GC.KeepAlive(val);
74         }
75
76         /**
77          * The signature of the channel initiator (funder) on the initial commitment transaction
78          */
79         public byte[] get_signature() {
80                 byte[] ret = bindings.FundingCreated_get_signature(this.ptr);
81                 GC.KeepAlive(this);
82                 return ret;
83         }
84
85         /**
86          * The signature of the channel initiator (funder) on the initial commitment transaction
87          */
88         public void set_signature(byte[] val) {
89                 bindings.FundingCreated_set_signature(this.ptr, InternalUtils.check_arr_len(val, 64));
90                 GC.KeepAlive(this);
91                 GC.KeepAlive(val);
92         }
93
94         /**
95          * Constructs a new FundingCreated given each field
96          */
97         public static FundingCreated of(byte[] temporary_channel_id_arg, byte[] funding_txid_arg, short funding_output_index_arg, byte[] signature_arg) {
98                 long ret = bindings.FundingCreated_new(InternalUtils.check_arr_len(temporary_channel_id_arg, 32), InternalUtils.check_arr_len(funding_txid_arg, 32), funding_output_index_arg, InternalUtils.check_arr_len(signature_arg, 64));
99                 GC.KeepAlive(temporary_channel_id_arg);
100                 GC.KeepAlive(funding_txid_arg);
101                 GC.KeepAlive(funding_output_index_arg);
102                 GC.KeepAlive(signature_arg);
103                 if (ret >= 0 && ret <= 4096) { return null; }
104                 org.ldk.structs.FundingCreated ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.FundingCreated(null, ret); }
105                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
106                 return ret_hu_conv;
107         }
108
109         internal long clone_ptr() {
110                 long ret = bindings.FundingCreated_clone_ptr(this.ptr);
111                 GC.KeepAlive(this);
112                 return ret;
113         }
114
115         /**
116          * Creates a copy of the FundingCreated
117          */
118         public FundingCreated clone() {
119                 long ret = bindings.FundingCreated_clone(this.ptr);
120                 GC.KeepAlive(this);
121                 if (ret >= 0 && ret <= 4096) { return null; }
122                 org.ldk.structs.FundingCreated ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.FundingCreated(null, ret); }
123                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
124                 return ret_hu_conv;
125         }
126
127         /**
128          * Checks if two FundingCreateds contain equal inner contents.
129          * This ignores pointers and is_owned flags and looks at the values in fields.
130          * Two objects with NULL inner values will be considered "equal" here.
131          */
132         public bool eq(org.ldk.structs.FundingCreated b) {
133                 bool ret = bindings.FundingCreated_eq(this.ptr, b == null ? 0 : b.ptr);
134                 GC.KeepAlive(this);
135                 GC.KeepAlive(b);
136                 if (this != null) { this.ptrs_to.AddLast(b); };
137                 return ret;
138         }
139
140         public override bool Equals(object o) {
141                 if (!(o is FundingCreated)) return false;
142                 return this.eq((FundingCreated)o);
143         }
144         /**
145          * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
146          */
147         public byte[] write() {
148                 byte[] ret = bindings.FundingCreated_write(this.ptr);
149                 GC.KeepAlive(this);
150                 return ret;
151         }
152
153         /**
154          * Read a FundingCreated from a byte array, created by FundingCreated_write
155          */
156         public static Result_FundingCreatedDecodeErrorZ read(byte[] ser) {
157                 long ret = bindings.FundingCreated_read(ser);
158                 GC.KeepAlive(ser);
159                 if (ret >= 0 && ret <= 4096) { return null; }
160                 Result_FundingCreatedDecodeErrorZ ret_hu_conv = Result_FundingCreatedDecodeErrorZ.constr_from_ptr(ret);
161                 return ret_hu_conv;
162         }
163
164 }
165 } } }