X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=c_sharp%2Fsrc%2Forg%2Fldk%2Fstructs%2FKeysManager.cs;h=1b7802854c8c68d8bfa0cfe44bc1f4b087c2579f;hb=8de7213fbf663ff60322896282dad51e8ab2f001;hp=1edacca57906952c8257693e53976e2be6cac1d0;hpb=afc50e5d491a11364849383b75a8f939df703bac;p=ldk-java diff --git a/c_sharp/src/org/ldk/structs/KeysManager.cs b/c_sharp/src/org/ldk/structs/KeysManager.cs index 1edacca5..1b780285 100644 --- a/c_sharp/src/org/ldk/structs/KeysManager.cs +++ b/c_sharp/src/org/ldk/structs/KeysManager.cs @@ -47,7 +47,7 @@ public class KeysManager : CommonBase { * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor */ public static KeysManager of(byte[] seed, long starting_time_secs, int starting_time_nanos) { - long ret = bindings.KeysManager_new(InternalUtils.check_arr_len(seed, 32), starting_time_secs, starting_time_nanos); + long ret = bindings.KeysManager_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(seed, 32)), starting_time_secs, starting_time_nanos); GC.KeepAlive(seed); GC.KeepAlive(starting_time_secs); GC.KeepAlive(starting_time_nanos); @@ -61,16 +61,18 @@ public class KeysManager : CommonBase { * Gets the \"node_id\" secret key used to sign gossip announcements, decode onion data, etc. */ public byte[] get_node_secret_key() { - byte[] ret = bindings.KeysManager_get_node_secret_key(this.ptr); + long ret = bindings.KeysManager_get_node_secret_key(this.ptr); GC.KeepAlive(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + byte[] ret_conv = InternalUtils.decodeUint8Array(ret); + return ret_conv; } /** * Derive an old [`WriteableEcdsaChannelSigner`] containing per-channel secrets based on a key derivation parameters. */ public InMemorySigner derive_channel_keys(long channel_value_satoshis, byte[] _params) { - long ret = bindings.KeysManager_derive_channel_keys(this.ptr, channel_value_satoshis, InternalUtils.check_arr_len(_params, 32)); + long ret = bindings.KeysManager_derive_channel_keys(this.ptr, channel_value_satoshis, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(_params, 32))); GC.KeepAlive(this); GC.KeepAlive(channel_value_satoshis); GC.KeepAlive(_params); @@ -90,13 +92,13 @@ public class KeysManager : CommonBase { * May panic if the [`SpendableOutputDescriptor`]s were not generated by channels which used * this [`KeysManager`] or one of the [`InMemorySigner`] created by this [`KeysManager`]. */ - public Result_PartiallySignedTransactionNoneZ sign_spendable_outputs_psbt(SpendableOutputDescriptor[] descriptors, byte[] psbt) { - long ret = bindings.KeysManager_sign_spendable_outputs_psbt(this.ptr, descriptors != null ? InternalUtils.mapArray(descriptors, descriptors_conv_27 => descriptors_conv_27.ptr) : null, psbt); + public Result_CVec_u8ZNoneZ sign_spendable_outputs_psbt(SpendableOutputDescriptor[] descriptors, byte[] psbt) { + long ret = bindings.KeysManager_sign_spendable_outputs_psbt(this.ptr, InternalUtils.encodeUint64Array(InternalUtils.mapArray(descriptors, descriptors_conv_27 => descriptors_conv_27.ptr)), InternalUtils.encodeUint8Array(psbt)); GC.KeepAlive(this); GC.KeepAlive(descriptors); GC.KeepAlive(psbt); if (ret >= 0 && ret <= 4096) { return null; } - Result_PartiallySignedTransactionNoneZ ret_hu_conv = Result_PartiallySignedTransactionNoneZ.constr_from_ptr(ret); + Result_CVec_u8ZNoneZ ret_hu_conv = Result_CVec_u8ZNoneZ.constr_from_ptr(ret); foreach (SpendableOutputDescriptor descriptors_conv_27 in descriptors) { if (this != null) { this.ptrs_to.AddLast(descriptors_conv_27); }; }; return ret_hu_conv; } @@ -120,8 +122,8 @@ public class KeysManager : CommonBase { * May panic if the [`SpendableOutputDescriptor`]s were not generated by channels which used * this [`KeysManager`] or one of the [`InMemorySigner`] created by this [`KeysManager`]. */ - public Result_TransactionNoneZ spend_spendable_outputs(SpendableOutputDescriptor[] descriptors, TxOut[] outputs, byte[] change_destination_script, int feerate_sat_per_1000_weight, org.ldk.structs.Option_PackedLockTimeZ locktime) { - long ret = bindings.KeysManager_spend_spendable_outputs(this.ptr, descriptors != null ? InternalUtils.mapArray(descriptors, descriptors_conv_27 => descriptors_conv_27.ptr) : null, outputs != null ? InternalUtils.mapArray(outputs, outputs_conv_7 => outputs_conv_7.ptr) : null, change_destination_script, feerate_sat_per_1000_weight, locktime.ptr); + public Result_TransactionNoneZ spend_spendable_outputs(SpendableOutputDescriptor[] descriptors, TxOut[] outputs, byte[] change_destination_script, int feerate_sat_per_1000_weight, org.ldk.structs.Option_u32Z locktime) { + long ret = bindings.KeysManager_spend_spendable_outputs(this.ptr, InternalUtils.encodeUint64Array(InternalUtils.mapArray(descriptors, descriptors_conv_27 => descriptors_conv_27.ptr)), InternalUtils.encodeUint64Array(InternalUtils.mapArray(outputs, outputs_conv_7 => outputs_conv_7.ptr)), InternalUtils.encodeUint8Array(change_destination_script), feerate_sat_per_1000_weight, locktime.ptr); GC.KeepAlive(this); GC.KeepAlive(descriptors); GC.KeepAlive(outputs);