[TS] Update auto-generated bindings to LDK-C-Bindings 0.0.123.1
[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 ChannelId get_temporary_channel_id() {
26                 long ret = bindings.FundingCreated_get_temporary_channel_id(this.ptr);
27                 GC.KeepAlive(this);
28                 if (ret >= 0 && ret <= 4096) { return null; }
29                 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
30                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
31                 return ret_hu_conv;
32         }
33
34         /**
35          * A temporary channel ID, until the funding is established
36          */
37         public void set_temporary_channel_id(org.ldk.structs.ChannelId val) {
38                 bindings.FundingCreated_set_temporary_channel_id(this.ptr, val.ptr);
39                 GC.KeepAlive(this);
40                 GC.KeepAlive(val);
41                 if (this != null) { this.ptrs_to.AddLast(val); };
42         }
43
44         /**
45          * The funding transaction ID
46          */
47         public byte[] get_funding_txid() {
48                 long ret = bindings.FundingCreated_get_funding_txid(this.ptr);
49                 GC.KeepAlive(this);
50                 if (ret >= 0 && ret <= 4096) { return null; }
51                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
52                 return ret_conv;
53         }
54
55         /**
56          * The funding transaction ID
57          */
58         public void set_funding_txid(byte[] val) {
59                 bindings.FundingCreated_set_funding_txid(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
60                 GC.KeepAlive(this);
61                 GC.KeepAlive(val);
62         }
63
64         /**
65          * The specific output index funding this channel
66          */
67         public short get_funding_output_index() {
68                 short ret = bindings.FundingCreated_get_funding_output_index(this.ptr);
69                 GC.KeepAlive(this);
70                 return ret;
71         }
72
73         /**
74          * The specific output index funding this channel
75          */
76         public void set_funding_output_index(short val) {
77                 bindings.FundingCreated_set_funding_output_index(this.ptr, val);
78                 GC.KeepAlive(this);
79                 GC.KeepAlive(val);
80         }
81
82         /**
83          * The signature of the channel initiator (funder) on the initial commitment transaction
84          */
85         public byte[] get_signature() {
86                 long ret = bindings.FundingCreated_get_signature(this.ptr);
87                 GC.KeepAlive(this);
88                 if (ret >= 0 && ret <= 4096) { return null; }
89                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
90                 return ret_conv;
91         }
92
93         /**
94          * The signature of the channel initiator (funder) on the initial commitment transaction
95          */
96         public void set_signature(byte[] val) {
97                 bindings.FundingCreated_set_signature(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 64)));
98                 GC.KeepAlive(this);
99                 GC.KeepAlive(val);
100         }
101
102         /**
103          * Constructs a new FundingCreated given each field
104          */
105         public static FundingCreated of(org.ldk.structs.ChannelId temporary_channel_id_arg, byte[] funding_txid_arg, short funding_output_index_arg, byte[] signature_arg) {
106                 long ret = bindings.FundingCreated_new(temporary_channel_id_arg.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(funding_txid_arg, 32)), funding_output_index_arg, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(signature_arg, 64)));
107                 GC.KeepAlive(temporary_channel_id_arg);
108                 GC.KeepAlive(funding_txid_arg);
109                 GC.KeepAlive(funding_output_index_arg);
110                 GC.KeepAlive(signature_arg);
111                 if (ret >= 0 && ret <= 4096) { return null; }
112                 org.ldk.structs.FundingCreated ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.FundingCreated(null, ret); }
113                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
114                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(temporary_channel_id_arg); };
115                 return ret_hu_conv;
116         }
117
118         internal long clone_ptr() {
119                 long ret = bindings.FundingCreated_clone_ptr(this.ptr);
120                 GC.KeepAlive(this);
121                 return ret;
122         }
123
124         /**
125          * Creates a copy of the FundingCreated
126          */
127         public FundingCreated clone() {
128                 long ret = bindings.FundingCreated_clone(this.ptr);
129                 GC.KeepAlive(this);
130                 if (ret >= 0 && ret <= 4096) { return null; }
131                 org.ldk.structs.FundingCreated ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.FundingCreated(null, ret); }
132                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
133                 return ret_hu_conv;
134         }
135
136         /**
137          * Generates a non-cryptographic 64-bit hash of the FundingCreated.
138          */
139         public long hash() {
140                 long ret = bindings.FundingCreated_hash(this.ptr);
141                 GC.KeepAlive(this);
142                 return ret;
143         }
144
145         public override int GetHashCode() {
146                 return (int)this.hash();
147         }
148         /**
149          * Checks if two FundingCreateds contain equal inner contents.
150          * This ignores pointers and is_owned flags and looks at the values in fields.
151          * Two objects with NULL inner values will be considered "equal" here.
152          */
153         public bool eq(org.ldk.structs.FundingCreated b) {
154                 bool ret = bindings.FundingCreated_eq(this.ptr, b.ptr);
155                 GC.KeepAlive(this);
156                 GC.KeepAlive(b);
157                 if (this != null) { this.ptrs_to.AddLast(b); };
158                 return ret;
159         }
160
161         public override bool Equals(object o) {
162                 if (!(o is FundingCreated)) return false;
163                 return this.eq((FundingCreated)o);
164         }
165         /**
166          * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
167          */
168         public byte[] write() {
169                 long ret = bindings.FundingCreated_write(this.ptr);
170                 GC.KeepAlive(this);
171                 if (ret >= 0 && ret <= 4096) { return null; }
172                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
173                 return ret_conv;
174         }
175
176         /**
177          * Read a FundingCreated from a byte array, created by FundingCreated_write
178          */
179         public static Result_FundingCreatedDecodeErrorZ read(byte[] ser) {
180                 long ret = bindings.FundingCreated_read(InternalUtils.encodeUint8Array(ser));
181                 GC.KeepAlive(ser);
182                 if (ret >= 0 && ret <= 4096) { return null; }
183                 Result_FundingCreatedDecodeErrorZ ret_hu_conv = Result_FundingCreatedDecodeErrorZ.constr_from_ptr(ret);
184                 return ret_hu_conv;
185         }
186
187 }
188 } } }