[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / OpenChannel.cs
index a7e112223239a6fee44fdcfcec136405f83e4cd3..9a0f4536c02d3a629e7adc2a4e6f4076f61fcae5 100644 (file)
@@ -23,16 +23,18 @@ public class OpenChannel : CommonBase {
         * The genesis hash of the blockchain where the channel is to be opened
         */
        public byte[] get_chain_hash() {
-               byte[] ret = bindings.OpenChannel_get_chain_hash(this.ptr);
+               long ret = bindings.OpenChannel_get_chain_hash(this.ptr);
                GC.KeepAlive(this);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
        }
 
        /**
         * The genesis hash of the blockchain where the channel is to be opened
         */
        public void set_chain_hash(byte[] val) {
-               bindings.OpenChannel_set_chain_hash(this.ptr, InternalUtils.check_arr_len(val, 32));
+               bindings.OpenChannel_set_chain_hash(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
                GC.KeepAlive(this);
                GC.KeepAlive(val);
        }
@@ -41,16 +43,18 @@ public class OpenChannel : CommonBase {
         * A temporary channel ID, until the funding outpoint is announced
         */
        public byte[] get_temporary_channel_id() {
-               byte[] ret = bindings.OpenChannel_get_temporary_channel_id(this.ptr);
+               long ret = bindings.OpenChannel_get_temporary_channel_id(this.ptr);
                GC.KeepAlive(this);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
        }
 
        /**
         * A temporary channel ID, until the funding outpoint is announced
         */
        public void set_temporary_channel_id(byte[] val) {
-               bindings.OpenChannel_set_temporary_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
+               bindings.OpenChannel_set_temporary_channel_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
                GC.KeepAlive(this);
                GC.KeepAlive(val);
        }
@@ -225,16 +229,18 @@ public class OpenChannel : CommonBase {
         * The sender's key controlling the funding transaction
         */
        public byte[] get_funding_pubkey() {
-               byte[] ret = bindings.OpenChannel_get_funding_pubkey(this.ptr);
+               long ret = bindings.OpenChannel_get_funding_pubkey(this.ptr);
                GC.KeepAlive(this);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
        }
 
        /**
         * The sender's key controlling the funding transaction
         */
        public void set_funding_pubkey(byte[] val) {
-               bindings.OpenChannel_set_funding_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33));
+               bindings.OpenChannel_set_funding_pubkey(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
                GC.KeepAlive(this);
                GC.KeepAlive(val);
        }
@@ -243,16 +249,18 @@ public class OpenChannel : CommonBase {
         * Used to derive a revocation key for transactions broadcast by counterparty
         */
        public byte[] get_revocation_basepoint() {
-               byte[] ret = bindings.OpenChannel_get_revocation_basepoint(this.ptr);
+               long ret = bindings.OpenChannel_get_revocation_basepoint(this.ptr);
                GC.KeepAlive(this);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
        }
 
        /**
         * Used to derive a revocation key for transactions broadcast by counterparty
         */
        public void set_revocation_basepoint(byte[] val) {
-               bindings.OpenChannel_set_revocation_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
+               bindings.OpenChannel_set_revocation_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
                GC.KeepAlive(this);
                GC.KeepAlive(val);
        }
@@ -261,16 +269,18 @@ public class OpenChannel : CommonBase {
         * A payment key to sender for transactions broadcast by counterparty
         */
        public byte[] get_payment_point() {
-               byte[] ret = bindings.OpenChannel_get_payment_point(this.ptr);
+               long ret = bindings.OpenChannel_get_payment_point(this.ptr);
                GC.KeepAlive(this);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
        }
 
        /**
         * A payment key to sender for transactions broadcast by counterparty
         */
        public void set_payment_point(byte[] val) {
-               bindings.OpenChannel_set_payment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
+               bindings.OpenChannel_set_payment_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
                GC.KeepAlive(this);
                GC.KeepAlive(val);
        }
@@ -279,16 +289,18 @@ public class OpenChannel : CommonBase {
         * Used to derive a payment key to sender for transactions broadcast by sender
         */
        public byte[] get_delayed_payment_basepoint() {
-               byte[] ret = bindings.OpenChannel_get_delayed_payment_basepoint(this.ptr);
+               long ret = bindings.OpenChannel_get_delayed_payment_basepoint(this.ptr);
                GC.KeepAlive(this);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
        }
 
        /**
         * Used to derive a payment key to sender for transactions broadcast by sender
         */
        public void set_delayed_payment_basepoint(byte[] val) {
-               bindings.OpenChannel_set_delayed_payment_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
+               bindings.OpenChannel_set_delayed_payment_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
                GC.KeepAlive(this);
                GC.KeepAlive(val);
        }
@@ -297,16 +309,18 @@ public class OpenChannel : CommonBase {
         * Used to derive an HTLC payment key to sender
         */
        public byte[] get_htlc_basepoint() {
-               byte[] ret = bindings.OpenChannel_get_htlc_basepoint(this.ptr);
+               long ret = bindings.OpenChannel_get_htlc_basepoint(this.ptr);
                GC.KeepAlive(this);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
        }
 
        /**
         * Used to derive an HTLC payment key to sender
         */
        public void set_htlc_basepoint(byte[] val) {
-               bindings.OpenChannel_set_htlc_basepoint(this.ptr, InternalUtils.check_arr_len(val, 33));
+               bindings.OpenChannel_set_htlc_basepoint(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
                GC.KeepAlive(this);
                GC.KeepAlive(val);
        }
@@ -315,16 +329,18 @@ public class OpenChannel : CommonBase {
         * The first to-be-broadcast-by-sender transaction's per commitment point
         */
        public byte[] get_first_per_commitment_point() {
-               byte[] ret = bindings.OpenChannel_get_first_per_commitment_point(this.ptr);
+               long ret = bindings.OpenChannel_get_first_per_commitment_point(this.ptr);
                GC.KeepAlive(this);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
        }
 
        /**
         * The first to-be-broadcast-by-sender transaction's per commitment point
         */
        public void set_first_per_commitment_point(byte[] val) {
-               bindings.OpenChannel_set_first_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
+               bindings.OpenChannel_set_first_per_commitment_point(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33)));
                GC.KeepAlive(this);
                GC.KeepAlive(val);
        }
@@ -350,11 +366,11 @@ public class OpenChannel : CommonBase {
        /**
         * A request to pre-set the to-sender output's `scriptPubkey` for when we collaboratively close
         */
-       public Option_ScriptZ get_shutdown_scriptpubkey() {
+       public Option_CVec_u8ZZ get_shutdown_scriptpubkey() {
                long ret = bindings.OpenChannel_get_shutdown_scriptpubkey(this.ptr);
                GC.KeepAlive(this);
                if (ret >= 0 && ret <= 4096) { return null; }
-               org.ldk.structs.Option_ScriptZ ret_hu_conv = org.ldk.structs.Option_ScriptZ.constr_from_ptr(ret);
+               org.ldk.structs.Option_CVec_u8ZZ ret_hu_conv = org.ldk.structs.Option_CVec_u8ZZ.constr_from_ptr(ret);
                if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
                return ret_hu_conv;
        }
@@ -362,7 +378,7 @@ public class OpenChannel : CommonBase {
        /**
         * A request to pre-set the to-sender output's `scriptPubkey` for when we collaboratively close
         */
-       public void set_shutdown_scriptpubkey(org.ldk.structs.Option_ScriptZ val) {
+       public void set_shutdown_scriptpubkey(org.ldk.structs.Option_CVec_u8ZZ val) {
                bindings.OpenChannel_set_shutdown_scriptpubkey(this.ptr, val.ptr);
                GC.KeepAlive(this);
                GC.KeepAlive(val);
@@ -403,9 +419,11 @@ public class OpenChannel : CommonBase {
 
        /**
         * Constructs a new OpenChannel given each field
+        * 
+        * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
         */
-       public static OpenChannel of(byte[] chain_hash_arg, byte[] temporary_channel_id_arg, long funding_satoshis_arg, long push_msat_arg, long dust_limit_satoshis_arg, long max_htlc_value_in_flight_msat_arg, long channel_reserve_satoshis_arg, long htlc_minimum_msat_arg, int feerate_per_kw_arg, short to_self_delay_arg, short max_accepted_htlcs_arg, byte[] funding_pubkey_arg, byte[] revocation_basepoint_arg, byte[] payment_point_arg, byte[] delayed_payment_basepoint_arg, byte[] htlc_basepoint_arg, byte[] first_per_commitment_point_arg, byte channel_flags_arg, org.ldk.structs.Option_ScriptZ shutdown_scriptpubkey_arg, org.ldk.structs.ChannelTypeFeatures channel_type_arg) {
-               long ret = bindings.OpenChannel_new(InternalUtils.check_arr_len(chain_hash_arg, 32), InternalUtils.check_arr_len(temporary_channel_id_arg, 32), funding_satoshis_arg, push_msat_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, channel_reserve_satoshis_arg, htlc_minimum_msat_arg, feerate_per_kw_arg, to_self_delay_arg, max_accepted_htlcs_arg, InternalUtils.check_arr_len(funding_pubkey_arg, 33), InternalUtils.check_arr_len(revocation_basepoint_arg, 33), InternalUtils.check_arr_len(payment_point_arg, 33), InternalUtils.check_arr_len(delayed_payment_basepoint_arg, 33), InternalUtils.check_arr_len(htlc_basepoint_arg, 33), InternalUtils.check_arr_len(first_per_commitment_point_arg, 33), channel_flags_arg, shutdown_scriptpubkey_arg.ptr, channel_type_arg == null ? 0 : channel_type_arg.ptr);
+       public static OpenChannel of(byte[] chain_hash_arg, byte[] temporary_channel_id_arg, long funding_satoshis_arg, long push_msat_arg, long dust_limit_satoshis_arg, long max_htlc_value_in_flight_msat_arg, long channel_reserve_satoshis_arg, long htlc_minimum_msat_arg, int feerate_per_kw_arg, short to_self_delay_arg, short max_accepted_htlcs_arg, byte[] funding_pubkey_arg, byte[] revocation_basepoint_arg, byte[] payment_point_arg, byte[] delayed_payment_basepoint_arg, byte[] htlc_basepoint_arg, byte[] first_per_commitment_point_arg, byte channel_flags_arg, org.ldk.structs.Option_CVec_u8ZZ shutdown_scriptpubkey_arg, org.ldk.structs.ChannelTypeFeatures channel_type_arg) {
+               long ret = bindings.OpenChannel_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(chain_hash_arg, 32)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(temporary_channel_id_arg, 32)), funding_satoshis_arg, push_msat_arg, dust_limit_satoshis_arg, max_htlc_value_in_flight_msat_arg, channel_reserve_satoshis_arg, htlc_minimum_msat_arg, feerate_per_kw_arg, to_self_delay_arg, max_accepted_htlcs_arg, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(funding_pubkey_arg, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(revocation_basepoint_arg, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_point_arg, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(delayed_payment_basepoint_arg, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(htlc_basepoint_arg, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(first_per_commitment_point_arg, 33)), channel_flags_arg, shutdown_scriptpubkey_arg.ptr, channel_type_arg == null ? 0 : channel_type_arg.ptr);
                GC.KeepAlive(chain_hash_arg);
                GC.KeepAlive(temporary_channel_id_arg);
                GC.KeepAlive(funding_satoshis_arg);
@@ -473,16 +491,18 @@ public class OpenChannel : CommonBase {
         * Serialize the OpenChannel object into a byte array which can be read by OpenChannel_read
         */
        public byte[] write() {
-               byte[] ret = bindings.OpenChannel_write(this.ptr);
+               long ret = bindings.OpenChannel_write(this.ptr);
                GC.KeepAlive(this);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
        }
 
        /**
         * Read a OpenChannel from a byte array, created by OpenChannel_write
         */
        public static Result_OpenChannelDecodeErrorZ read(byte[] ser) {
-               long ret = bindings.OpenChannel_read(ser);
+               long ret = bindings.OpenChannel_read(InternalUtils.encodeUint8Array(ser));
                GC.KeepAlive(ser);
                if (ret >= 0 && ret <= 4096) { return null; }
                Result_OpenChannelDecodeErrorZ ret_hu_conv = Result_OpenChannelDecodeErrorZ.constr_from_ptr(ret);