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