[TS] Update auto-generated bindings to LDK-C-Bindings 0.0.123.1
[ldk-java] / c_sharp / src / org / ldk / structs / SpliceLocked.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_locked message to be sent to or received from a peer.
11  */
12 public class SpliceLocked : CommonBase {
13         internal SpliceLocked(object _dummy, long ptr) : base(ptr) { }
14         ~SpliceLocked() {
15                 if (ptr != 0) { bindings.SpliceLocked_free(ptr); }
16         }
17
18         /**
19          * The channel ID
20          */
21         public ChannelId get_channel_id() {
22                 long ret = bindings.SpliceLocked_get_channel_id(this.ptr);
23                 GC.KeepAlive(this);
24                 if (ret >= 0 && ret <= 4096) { return null; }
25                 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
26                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
27                 return ret_hu_conv;
28         }
29
30         /**
31          * The channel ID
32          */
33         public void set_channel_id(org.ldk.structs.ChannelId val) {
34                 bindings.SpliceLocked_set_channel_id(this.ptr, val.ptr);
35                 GC.KeepAlive(this);
36                 GC.KeepAlive(val);
37                 if (this != null) { this.ptrs_to.AddLast(val); };
38         }
39
40         /**
41          * Constructs a new SpliceLocked given each field
42          */
43         public static SpliceLocked of(org.ldk.structs.ChannelId channel_id_arg) {
44                 long ret = bindings.SpliceLocked_new(channel_id_arg.ptr);
45                 GC.KeepAlive(channel_id_arg);
46                 if (ret >= 0 && ret <= 4096) { return null; }
47                 org.ldk.structs.SpliceLocked ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.SpliceLocked(null, ret); }
48                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
49                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_id_arg); };
50                 return ret_hu_conv;
51         }
52
53         internal long clone_ptr() {
54                 long ret = bindings.SpliceLocked_clone_ptr(this.ptr);
55                 GC.KeepAlive(this);
56                 return ret;
57         }
58
59         /**
60          * Creates a copy of the SpliceLocked
61          */
62         public SpliceLocked clone() {
63                 long ret = bindings.SpliceLocked_clone(this.ptr);
64                 GC.KeepAlive(this);
65                 if (ret >= 0 && ret <= 4096) { return null; }
66                 org.ldk.structs.SpliceLocked ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.SpliceLocked(null, ret); }
67                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
68                 return ret_hu_conv;
69         }
70
71         /**
72          * Checks if two SpliceLockeds contain equal inner contents.
73          * This ignores pointers and is_owned flags and looks at the values in fields.
74          * Two objects with NULL inner values will be considered "equal" here.
75          */
76         public bool eq(org.ldk.structs.SpliceLocked b) {
77                 bool ret = bindings.SpliceLocked_eq(this.ptr, b.ptr);
78                 GC.KeepAlive(this);
79                 GC.KeepAlive(b);
80                 if (this != null) { this.ptrs_to.AddLast(b); };
81                 return ret;
82         }
83
84         public override bool Equals(object o) {
85                 if (!(o is SpliceLocked)) return false;
86                 return this.eq((SpliceLocked)o);
87         }
88         /**
89          * Serialize the SpliceLocked object into a byte array which can be read by SpliceLocked_read
90          */
91         public byte[] write() {
92                 long ret = bindings.SpliceLocked_write(this.ptr);
93                 GC.KeepAlive(this);
94                 if (ret >= 0 && ret <= 4096) { return null; }
95                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
96                 return ret_conv;
97         }
98
99         /**
100          * Read a SpliceLocked from a byte array, created by SpliceLocked_write
101          */
102         public static Result_SpliceLockedDecodeErrorZ read(byte[] ser) {
103                 long ret = bindings.SpliceLocked_read(InternalUtils.encodeUint8Array(ser));
104                 GC.KeepAlive(ser);
105                 if (ret >= 0 && ret <= 4096) { return null; }
106                 Result_SpliceLockedDecodeErrorZ ret_hu_conv = Result_SpliceLockedDecodeErrorZ.constr_from_ptr(ret);
107                 return ret_hu_conv;
108         }
109
110 }
111 } } }