[TS] Update auto-generated bindings to LDK-C-Bindings 0.0.123.1
[ldk-java] / c_sharp / src / org / ldk / structs / FundingSigned.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_signed`] message to be sent to or received from a peer.
11  * 
12  * Used in V1 channel establishment
13  * 
14  * [`funding_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-funding_signed-message
15  */
16 public class FundingSigned : CommonBase {
17         internal FundingSigned(object _dummy, long ptr) : base(ptr) { }
18         ~FundingSigned() {
19                 if (ptr != 0) { bindings.FundingSigned_free(ptr); }
20         }
21
22         /**
23          * The channel ID
24          */
25         public ChannelId get_channel_id() {
26                 long ret = bindings.FundingSigned_get_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          * The channel ID
36          */
37         public void set_channel_id(org.ldk.structs.ChannelId val) {
38                 bindings.FundingSigned_set_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 signature of the channel acceptor (fundee) on the initial commitment transaction
46          */
47         public byte[] get_signature() {
48                 long ret = bindings.FundingSigned_get_signature(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 signature of the channel acceptor (fundee) on the initial commitment transaction
57          */
58         public void set_signature(byte[] val) {
59                 bindings.FundingSigned_set_signature(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 64)));
60                 GC.KeepAlive(this);
61                 GC.KeepAlive(val);
62         }
63
64         /**
65          * Constructs a new FundingSigned given each field
66          */
67         public static FundingSigned of(org.ldk.structs.ChannelId channel_id_arg, byte[] signature_arg) {
68                 long ret = bindings.FundingSigned_new(channel_id_arg.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(signature_arg, 64)));
69                 GC.KeepAlive(channel_id_arg);
70                 GC.KeepAlive(signature_arg);
71                 if (ret >= 0 && ret <= 4096) { return null; }
72                 org.ldk.structs.FundingSigned ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.FundingSigned(null, ret); }
73                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
74                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_id_arg); };
75                 return ret_hu_conv;
76         }
77
78         internal long clone_ptr() {
79                 long ret = bindings.FundingSigned_clone_ptr(this.ptr);
80                 GC.KeepAlive(this);
81                 return ret;
82         }
83
84         /**
85          * Creates a copy of the FundingSigned
86          */
87         public FundingSigned clone() {
88                 long ret = bindings.FundingSigned_clone(this.ptr);
89                 GC.KeepAlive(this);
90                 if (ret >= 0 && ret <= 4096) { return null; }
91                 org.ldk.structs.FundingSigned ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.FundingSigned(null, ret); }
92                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
93                 return ret_hu_conv;
94         }
95
96         /**
97          * Generates a non-cryptographic 64-bit hash of the FundingSigned.
98          */
99         public long hash() {
100                 long ret = bindings.FundingSigned_hash(this.ptr);
101                 GC.KeepAlive(this);
102                 return ret;
103         }
104
105         public override int GetHashCode() {
106                 return (int)this.hash();
107         }
108         /**
109          * Checks if two FundingSigneds contain equal inner contents.
110          * This ignores pointers and is_owned flags and looks at the values in fields.
111          * Two objects with NULL inner values will be considered "equal" here.
112          */
113         public bool eq(org.ldk.structs.FundingSigned b) {
114                 bool ret = bindings.FundingSigned_eq(this.ptr, b.ptr);
115                 GC.KeepAlive(this);
116                 GC.KeepAlive(b);
117                 if (this != null) { this.ptrs_to.AddLast(b); };
118                 return ret;
119         }
120
121         public override bool Equals(object o) {
122                 if (!(o is FundingSigned)) return false;
123                 return this.eq((FundingSigned)o);
124         }
125         /**
126          * Serialize the FundingSigned object into a byte array which can be read by FundingSigned_read
127          */
128         public byte[] write() {
129                 long ret = bindings.FundingSigned_write(this.ptr);
130                 GC.KeepAlive(this);
131                 if (ret >= 0 && ret <= 4096) { return null; }
132                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
133                 return ret_conv;
134         }
135
136         /**
137          * Read a FundingSigned from a byte array, created by FundingSigned_write
138          */
139         public static Result_FundingSignedDecodeErrorZ read(byte[] ser) {
140                 long ret = bindings.FundingSigned_read(InternalUtils.encodeUint8Array(ser));
141                 GC.KeepAlive(ser);
142                 if (ret >= 0 && ret <= 4096) { return null; }
143                 Result_FundingSignedDecodeErrorZ ret_hu_conv = Result_FundingSignedDecodeErrorZ.constr_from_ptr(ret);
144                 return ret_hu_conv;
145         }
146
147 }
148 } } }