6 namespace org { namespace ldk { namespace structs {
10 * A [`channel_ready`] message to be sent to or received from a peer.
12 * [`channel_ready`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-channel_ready-message
14 public class ChannelReady : CommonBase {
15 internal ChannelReady(object _dummy, long ptr) : base(ptr) { }
17 if (ptr != 0) { bindings.ChannelReady_free(ptr); }
23 public byte[] get_channel_id() {
24 long ret = bindings.ChannelReady_get_channel_id(this.ptr);
26 if (ret >= 0 && ret <= 4096) { return null; }
27 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
34 public void set_channel_id(byte[] val) {
35 bindings.ChannelReady_set_channel_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
41 * The per-commitment point of the second commitment transaction
43 public byte[] get_next_per_commitment_point() {
44 long ret = bindings.ChannelReady_get_next_per_commitment_point(this.ptr);
46 if (ret >= 0 && ret <= 4096) { return null; }
47 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
52 * The per-commitment point of the second commitment transaction
54 public void set_next_per_commitment_point(byte[] val) {
55 bindings.ChannelReady_set_next_per_commitment_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
61 * If set, provides a `short_channel_id` alias for this channel.
63 * The sender will accept payments to be forwarded over this SCID and forward them to this
64 * messages' recipient.
66 public Option_u64Z get_short_channel_id_alias() {
67 long ret = bindings.ChannelReady_get_short_channel_id_alias(this.ptr);
69 if (ret >= 0 && ret <= 4096) { return null; }
70 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
71 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
76 * If set, provides a `short_channel_id` alias for this channel.
78 * The sender will accept payments to be forwarded over this SCID and forward them to this
79 * messages' recipient.
81 public void set_short_channel_id_alias(org.ldk.structs.Option_u64Z val) {
82 bindings.ChannelReady_set_short_channel_id_alias(this.ptr, val.ptr);
85 if (this != null) { this.ptrs_to.AddLast(val); };
89 * Constructs a new ChannelReady given each field
91 public static ChannelReady of(byte[] channel_id_arg, byte[] next_per_commitment_point_arg, org.ldk.structs.Option_u64Z short_channel_id_alias_arg) {
92 long ret = bindings.ChannelReady_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(channel_id_arg, 32)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(next_per_commitment_point_arg, 33)), short_channel_id_alias_arg.ptr);
93 GC.KeepAlive(channel_id_arg);
94 GC.KeepAlive(next_per_commitment_point_arg);
95 GC.KeepAlive(short_channel_id_alias_arg);
96 if (ret >= 0 && ret <= 4096) { return null; }
97 org.ldk.structs.ChannelReady ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelReady(null, ret); }
98 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
99 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(short_channel_id_alias_arg); };
103 internal long clone_ptr() {
104 long ret = bindings.ChannelReady_clone_ptr(this.ptr);
110 * Creates a copy of the ChannelReady
112 public ChannelReady clone() {
113 long ret = bindings.ChannelReady_clone(this.ptr);
115 if (ret >= 0 && ret <= 4096) { return null; }
116 org.ldk.structs.ChannelReady ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelReady(null, ret); }
117 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
122 * Checks if two ChannelReadys contain equal inner contents.
123 * This ignores pointers and is_owned flags and looks at the values in fields.
124 * Two objects with NULL inner values will be considered "equal" here.
126 public bool eq(org.ldk.structs.ChannelReady b) {
127 bool ret = bindings.ChannelReady_eq(this.ptr, b == null ? 0 : b.ptr);
130 if (this != null) { this.ptrs_to.AddLast(b); };
134 public override bool Equals(object o) {
135 if (!(o is ChannelReady)) return false;
136 return this.eq((ChannelReady)o);
139 * Serialize the ChannelReady object into a byte array which can be read by ChannelReady_read
141 public byte[] write() {
142 long ret = bindings.ChannelReady_write(this.ptr);
144 if (ret >= 0 && ret <= 4096) { return null; }
145 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
150 * Read a ChannelReady from a byte array, created by ChannelReady_write
152 public static Result_ChannelReadyDecodeErrorZ read(byte[] ser) {
153 long ret = bindings.ChannelReady_read(InternalUtils.encodeUint8Array(ser));
155 if (ret >= 0 && ret <= 4096) { return null; }
156 Result_ChannelReadyDecodeErrorZ ret_hu_conv = Result_ChannelReadyDecodeErrorZ.constr_from_ptr(ret);