6 namespace org { namespace ldk { namespace structs {
10 * A splice message to be sent by or received from the stfu initiator (splice initiator).
12 public class Splice : CommonBase {
13 internal Splice(object _dummy, long ptr) : base(ptr) { }
15 if (ptr != 0) { bindings.Splice_free(ptr); }
19 * The channel ID where splicing is intended
21 public byte[] get_channel_id() {
22 long ret = bindings.Splice_get_channel_id(this.ptr);
24 if (ret >= 0 && ret <= 4096) { return null; }
25 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
30 * The channel ID where splicing is intended
32 public void set_channel_id(byte[] val) {
33 bindings.Splice_set_channel_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
39 * The genesis hash of the blockchain where the channel is intended to be spliced
41 public byte[] get_chain_hash() {
42 long ret = bindings.Splice_get_chain_hash(this.ptr);
44 if (ret >= 0 && ret <= 4096) { return null; }
45 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
50 * The genesis hash of the blockchain where the channel is intended to be spliced
52 public void set_chain_hash(byte[] val) {
53 bindings.Splice_set_chain_hash(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
59 * The intended change in channel capacity: the amount to be added (positive value)
60 * or removed (negative value) by the sender (splice initiator) by splicing into/from the channel.
62 public long get_relative_satoshis() {
63 long ret = bindings.Splice_get_relative_satoshis(this.ptr);
69 * The intended change in channel capacity: the amount to be added (positive value)
70 * or removed (negative value) by the sender (splice initiator) by splicing into/from the channel.
72 public void set_relative_satoshis(long val) {
73 bindings.Splice_set_relative_satoshis(this.ptr, val);
79 * The feerate for the new funding transaction, set by the splice initiator
81 public int get_funding_feerate_perkw() {
82 int ret = bindings.Splice_get_funding_feerate_perkw(this.ptr);
88 * The feerate for the new funding transaction, set by the splice initiator
90 public void set_funding_feerate_perkw(int val) {
91 bindings.Splice_set_funding_feerate_perkw(this.ptr, val);
97 * The locktime for the new funding transaction
99 public int get_locktime() {
100 int ret = bindings.Splice_get_locktime(this.ptr);
106 * The locktime for the new funding transaction
108 public void set_locktime(int val) {
109 bindings.Splice_set_locktime(this.ptr, val);
115 * The key of the sender (splice initiator) controlling the new funding transaction
117 public byte[] get_funding_pubkey() {
118 long ret = bindings.Splice_get_funding_pubkey(this.ptr);
120 if (ret >= 0 && ret <= 4096) { return null; }
121 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
126 * The key of the sender (splice initiator) controlling the new funding transaction
128 public void set_funding_pubkey(byte[] val) {
129 bindings.Splice_set_funding_pubkey(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
135 * Constructs a new Splice given each field
137 public static Splice of(byte[] channel_id_arg, byte[] chain_hash_arg, long relative_satoshis_arg, int funding_feerate_perkw_arg, int locktime_arg, byte[] funding_pubkey_arg) {
138 long ret = bindings.Splice_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(channel_id_arg, 32)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(chain_hash_arg, 32)), relative_satoshis_arg, funding_feerate_perkw_arg, locktime_arg, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(funding_pubkey_arg, 33)));
139 GC.KeepAlive(channel_id_arg);
140 GC.KeepAlive(chain_hash_arg);
141 GC.KeepAlive(relative_satoshis_arg);
142 GC.KeepAlive(funding_feerate_perkw_arg);
143 GC.KeepAlive(locktime_arg);
144 GC.KeepAlive(funding_pubkey_arg);
145 if (ret >= 0 && ret <= 4096) { return null; }
146 org.ldk.structs.Splice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Splice(null, ret); }
147 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
151 internal long clone_ptr() {
152 long ret = bindings.Splice_clone_ptr(this.ptr);
158 * Creates a copy of the Splice
160 public Splice clone() {
161 long ret = bindings.Splice_clone(this.ptr);
163 if (ret >= 0 && ret <= 4096) { return null; }
164 org.ldk.structs.Splice ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Splice(null, ret); }
165 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
170 * Checks if two Splices contain equal inner contents.
171 * This ignores pointers and is_owned flags and looks at the values in fields.
172 * Two objects with NULL inner values will be considered "equal" here.
174 public bool eq(org.ldk.structs.Splice b) {
175 bool ret = bindings.Splice_eq(this.ptr, b == null ? 0 : b.ptr);
178 if (this != null) { this.ptrs_to.AddLast(b); };
182 public override bool Equals(object o) {
183 if (!(o is Splice)) return false;
184 return this.eq((Splice)o);
187 * Serialize the Splice object into a byte array which can be read by Splice_read
189 public byte[] write() {
190 long ret = bindings.Splice_write(this.ptr);
192 if (ret >= 0 && ret <= 4096) { return null; }
193 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
198 * Read a Splice from a byte array, created by Splice_write
200 public static Result_SpliceDecodeErrorZ read(byte[] ser) {
201 long ret = bindings.Splice_read(InternalUtils.encodeUint8Array(ser));
203 if (ret >= 0 && ret <= 4096) { return null; }
204 Result_SpliceDecodeErrorZ ret_hu_conv = Result_SpliceDecodeErrorZ.constr_from_ptr(ret);