Move enums into their own (non-impl) folder
[ldk-java] / src / main / java / org / ldk / impl / bindings.java
index b9d228b0fe3e414b1a9e5fbbc491698115f9af86..cdf23173e53bb327ec417186273d0823ee076833 100644 (file)
@@ -1,63 +1,40 @@
 package org.ldk.impl;
+import org.ldk.enums.*;
 
 public class bindings {
+       public static class VecOrSliceDef {
+               public long dataptr;
+               public long datalen;
+               public long stride;
+               public VecOrSliceDef(long dataptr, long datalen, long stride) {
+                       this.dataptr = dataptr; this.datalen = datalen; this.stride = stride;
+               }
+       }
        static {
                System.loadLibrary("lightningjni");
-               init(java.lang.Enum.class);
+               init(java.lang.Enum.class, VecOrSliceDef.class);
        }
-
-       static native void init(java.lang.Class c);
+       static native void init(java.lang.Class c, java.lang.Class slicedef);
 
        public static native boolean deref_bool(long ptr);
        public static native long deref_long(long ptr);
        public static native void free_heap_ptr(long ptr);
        public static native byte[] get_u8_slice_bytes(long slice_ptr);
        public static native long bytes_to_u8_vec(byte[] bytes);
-       public static native long u8_vec_len(long vec);
+       public static native long vec_slice_len(long vec);
+       public static native long new_empty_slice_vec();
 
        public static native long LDKSecretKey_new();
 
-       public enum LDKAccessError {
-          LDKAccessError_UnknownChain,
-          LDKAccessError_UnknownTx,
-       }
-       public enum LDKChannelMonitorUpdateErr {
-          LDKChannelMonitorUpdateErr_TemporaryFailure,
-          LDKChannelMonitorUpdateErr_PermanentFailure,
-       }
-       public enum LDKConfirmationTarget {
-          LDKConfirmationTarget_Background,
-          LDKConfirmationTarget_Normal,
-          LDKConfirmationTarget_HighPriority,
-       }
-       public enum LDKLevel {
-          LDKLevel_Off,
-          LDKLevel_Error,
-          LDKLevel_Warn,
-          LDKLevel_Info,
-          LDKLevel_Debug,
-          LDKLevel_Trace,
-       }
-       public enum LDKNetwork {
-          LDKNetwork_Bitcoin,
-          LDKNetwork_Testnet,
-          LDKNetwork_Regtest,
-       }
-       public enum LDKSecp256k1Error {
-          LDKSecp256k1Error_IncorrectSignature,
-          LDKSecp256k1Error_InvalidMessage,
-          LDKSecp256k1Error_InvalidPublicKey,
-          LDKSecp256k1Error_InvalidSignature,
-          LDKSecp256k1Error_InvalidSecretKey,
-          LDKSecp256k1Error_InvalidRecoveryId,
-          LDKSecp256k1Error_InvalidTweak,
-          LDKSecp256k1Error_NotEnoughMemory,
-          LDKSecp256k1Error_CallbackPanicked,
-       }
+       public static native VecOrSliceDef LDKCVecTempl_u8_arr_info(long vec_ptr);
        public static native boolean LDKCResult_NoneChannelMonitorUpdateErrZ_result_ok(long arg);
        public static native long LDKCResult_NoneChannelMonitorUpdateErrZ_get_inner(long arg);
+       public static native long LDKMonitorUpdateError_optional_none();
        public static native boolean LDKCResult_NoneMonitorUpdateErrorZ_result_ok(long arg);
        public static native long LDKCResult_NoneMonitorUpdateErrorZ_get_inner(long arg);
+       public static native long LDKOutPoint_optional_none();
+       public static native VecOrSliceDef LDKCVecTempl_TxOut_arr_info(long vec_ptr);
+       public static native VecOrSliceDef LDKCVecTempl_Signature_arr_info(long vec_ptr);
        public static native boolean LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_result_ok(long arg);
        public static native long LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_get_inner(long arg);
        public static native boolean LDKCResult_SignatureNoneZ_result_ok(long arg);
@@ -66,10 +43,30 @@ public class bindings {
        public static native long LDKCResult_CVec_SignatureZNoneZ_get_inner(long arg);
        public static native boolean LDKCResult_NoneAPIErrorZ_result_ok(long arg);
        public static native long LDKCResult_NoneAPIErrorZ_get_inner(long arg);
+       public static native long LDKPaymentSendFailure_optional_none();
        public static native boolean LDKCResult_NonePaymentSendFailureZ_result_ok(long arg);
        public static native long LDKCResult_NonePaymentSendFailureZ_get_inner(long arg);
+       public static native long LDKChannelAnnouncement_optional_none();
+       public static native long LDKChannelUpdate_optional_none();
+       public static native long LDKPeerHandleError_optional_none();
        public static native boolean LDKCResult_NonePeerHandleErrorZ_result_ok(long arg);
        public static native long LDKCResult_NonePeerHandleErrorZ_get_inner(long arg);
+       public static native long LDKHTLCOutputInCommitment_optional_none();
+       public static native VecOrSliceDef LDKCVecTempl_SpendableOutputDescriptor_arr_info(long vec_ptr);
+       public static native long LDKAcceptChannel_optional_none();
+       public static native long LDKOpenChannel_optional_none();
+       public static native long LDKFundingCreated_optional_none();
+       public static native long LDKFundingSigned_optional_none();
+       public static native long LDKFundingLocked_optional_none();
+       public static native long LDKAnnouncementSignatures_optional_none();
+       public static native long LDKCommitmentUpdate_optional_none();
+       public static native long LDKRevokeAndACK_optional_none();
+       public static native long LDKClosingSigned_optional_none();
+       public static native long LDKShutdown_optional_none();
+       public static native long LDKChannelReestablish_optional_none();
+       public static native long LDKNodeAnnouncement_optional_none();
+       public static native long LDKErrorMessage_optional_none();
+       public static native VecOrSliceDef LDKCVecTempl_MessageSendEvent_arr_info(long vec_ptr);
        public interface LDKMessageSendEventsProvider {
                 long get_and_clear_pending_msg_events();
        }
@@ -77,6 +74,7 @@ public class bindings {
        public static native LDKMessageSendEventsProvider LDKMessageSendEventsProvider_get_obj_from_jcalls(long val);
        // LDKCVec_MessageSendEventZ LDKMessageSendEventsProvider_call_get_and_clear_pending_msg_events LDKMessageSendEventsProvider* arg
        public static native long LDKMessageSendEventsProvider_call_get_and_clear_pending_msg_events(long arg);
+       public static native VecOrSliceDef LDKCVecTempl_Event_arr_info(long vec_ptr);
        public interface LDKEventsProvider {
                 long get_and_clear_pending_events();
        }
@@ -89,6 +87,10 @@ public class bindings {
        }
        public static native long LDKLogger_new(LDKLogger impl);
        public static native LDKLogger LDKLogger_get_obj_from_jcalls(long val);
+       public static native long LDKChannelHandshakeConfig_optional_none();
+       public static native long LDKChannelHandshakeLimits_optional_none();
+       public static native long LDKChannelConfig_optional_none();
+       public static native long LDKUserConfig_optional_none();
        public static native boolean LDKCResult_TxOutAccessErrorZ_result_ok(long arg);
        public static native long LDKCResult_TxOutAccessErrorZ_get_inner(long arg);
        public interface LDKAccess {
@@ -98,6 +100,11 @@ public class bindings {
        public static native LDKAccess LDKAccess_get_obj_from_jcalls(long val);
        // LDKCResult_TxOutAccessErrorZ LDKAccess_call_get_utxo LDKAccess* arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id
        public static native long LDKAccess_call_get_utxo(long arg, byte[] genesis_hash, long short_channel_id);
+       public static native long LDKChannelPublicKeys_optional_none();
+       public static native long LDKPreCalculatedTxCreationKeys_optional_none();
+       public static native VecOrSliceDef LDKCVecTempl_HTLCOutputInCommitment_arr_info(long vec_ptr);
+       public static native long LDKHolderCommitmentTransaction_optional_none();
+       public static native long LDKUnsignedChannelAnnouncement_optional_none();
        public interface LDKChannelKeys {
                 long get_per_commitment_point(long idx);
                 long release_commitment_secret(long idx);
@@ -135,6 +142,10 @@ public class bindings {
        public static native long LDKChannelKeys_call_sign_channel_announcement(long arg, long msg);
        // void LDKChannelKeys_call_on_accept LDKChannelKeys* arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay
        public static native void LDKChannelKeys_call_on_accept(long arg, long channel_points, short counterparty_selected_contest_delay, short holder_selected_contest_delay);
+       public static native long LDKChannelMonitor_optional_none();
+       public static native long LDKChannelMonitorUpdate_optional_none();
+       public static native long LDKMonitorEvent_optional_none();
+       public static native VecOrSliceDef LDKCVecTempl_MonitorEvent_arr_info(long vec_ptr);
        public interface LDKWatch {
                 long watch_channel(long funding_txo, long monitor);
                 long update_channel(long funding_txo, long update);
@@ -172,6 +183,11 @@ public class bindings {
        public static native LDKFeeEstimator LDKFeeEstimator_get_obj_from_jcalls(long val);
        // uint32_t LDKFeeEstimator_call_get_est_sat_per_1000_weight LDKFeeEstimator* arg, LDKConfirmationTarget confirmation_target
        public static native int LDKFeeEstimator_call_get_est_sat_per_1000_weight(long arg, LDKConfirmationTarget confirmation_target);
+       public static native long LDKChainMonitor_optional_none();
+       public static native VecOrSliceDef LDKCVecTempl_C2TupleTempl_usize__Transaction_arr_info(long vec_ptr);
+       public static native long LDKHTLCUpdate_optional_none();
+       public static native VecOrSliceDef LDKCVecTempl_Transaction_arr_info(long vec_ptr);
+       public static native VecOrSliceDef LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut_arr_info(long vec_ptr);
        public interface LDKKeysInterface {
                 long get_node_secret();
                 long get_destination_script();
@@ -191,6 +207,21 @@ public class bindings {
        public static native long LDKKeysInterface_call_get_channel_keys(long arg, boolean inbound, long channel_value_satoshis);
        // LDKThirtyTwoBytes LDKKeysInterface_call_get_secure_random_bytes LDKKeysInterface* arg
        public static native long LDKKeysInterface_call_get_secure_random_bytes(long arg);
+       public static native long LDKInMemoryChannelKeys_optional_none();
+       public static native long LDKKeysManager_optional_none();
+       public static native long LDKChannelManager_optional_none();
+       public static native long LDKChannelDetails_optional_none();
+       public static native long LDKInitFeatures_optional_none();
+       public static native VecOrSliceDef LDKCVecTempl_ChannelDetails_arr_info(long vec_ptr);
+       public static native long LDKRoute_optional_none();
+       public static native VecOrSliceDef LDKCVecTempl_NetAddress_arr_info(long vec_ptr);
+       public static native long LDKUpdateAddHTLC_optional_none();
+       public static native long LDKUpdateFulfillHTLC_optional_none();
+       public static native long LDKUpdateFailHTLC_optional_none();
+       public static native long LDKUpdateFailMalformedHTLC_optional_none();
+       public static native long LDKCommitmentSigned_optional_none();
+       public static native long LDKUpdateFee_optional_none();
+       public static native long LDKInit_optional_none();
        public interface LDKChannelMessageHandler {
                 void handle_open_channel(long their_node_id, long their_features, long msg);
                 void handle_accept_channel(long their_node_id, long their_features, long msg);
@@ -252,8 +283,31 @@ public class bindings {
        public static native void LDKChannelMessageHandler_call_handle_channel_reestablish(long arg, long their_node_id, long msg);
        // void LDKChannelMessageHandler_call_handle_error LDKChannelMessageHandler* arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg
        public static native void LDKChannelMessageHandler_call_handle_error(long arg, long their_node_id, long msg);
+       public static native long LDKChannelManagerReadArgs_optional_none();
+       public static native VecOrSliceDef LDKCVecTempl_ChannelMonitor_arr_info(long vec_ptr);
+       public static native long LDKDecodeError_optional_none();
+       public static native long LDKPing_optional_none();
+       public static native long LDKPong_optional_none();
+       public static native long LDKDataLossProtect_optional_none();
+       public static native long LDKUnsignedNodeAnnouncement_optional_none();
+       public static native long LDKNodeFeatures_optional_none();
+       public static native long LDKChannelFeatures_optional_none();
+       public static native long LDKUnsignedChannelUpdate_optional_none();
+       public static native long LDKQueryChannelRange_optional_none();
+       public static native long LDKReplyChannelRange_optional_none();
+       public static native VecOrSliceDef LDKCVecTempl_u64_arr_info(long vec_ptr);
+       public static native long LDKQueryShortChannelIds_optional_none();
+       public static native long LDKReplyShortChannelIdsEnd_optional_none();
+       public static native long LDKGossipTimestampFilter_optional_none();
+       public static native long LDKLightningError_optional_none();
+       public static native VecOrSliceDef LDKCVecTempl_UpdateAddHTLC_arr_info(long vec_ptr);
+       public static native VecOrSliceDef LDKCVecTempl_UpdateFulfillHTLC_arr_info(long vec_ptr);
+       public static native VecOrSliceDef LDKCVecTempl_UpdateFailHTLC_arr_info(long vec_ptr);
+       public static native VecOrSliceDef LDKCVecTempl_UpdateFailMalformedHTLC_arr_info(long vec_ptr);
        public static native boolean LDKCResult_boolLightningErrorZ_result_ok(long arg);
        public static native long LDKCResult_boolLightningErrorZ_get_inner(long arg);
+       public static native VecOrSliceDef LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate_arr_info(long vec_ptr);
+       public static native VecOrSliceDef LDKCVecTempl_NodeAnnouncement_arr_info(long vec_ptr);
        public interface LDKRoutingMessageHandler {
                 long handle_node_announcement(long msg);
                 long handle_channel_announcement(long msg);
@@ -279,6 +333,7 @@ public class bindings {
        public static native long LDKRoutingMessageHandler_call_get_next_node_announcements(long arg, long starting_point, byte batch_amount);
        // bool LDKRoutingMessageHandler_call_should_request_full_sync LDKRoutingMessageHandler* arg, LDKPublicKey node_id
        public static native boolean LDKRoutingMessageHandler_call_should_request_full_sync(long arg, long node_id);
+       public static native long LDKMessageHandler_optional_none();
        public interface LDKSocketDescriptor {
                 long send_data(long data, boolean resume_read);
                 void disconnect_socket();
@@ -293,6 +348,8 @@ public class bindings {
        public static native void LDKSocketDescriptor_call_disconnect_socket(long arg);
        // uint64_t LDKSocketDescriptor_call_hash LDKSocketDescriptor* arg
        public static native long LDKSocketDescriptor_call_hash(long arg);
+       public static native long LDKPeerManager_optional_none();
+       public static native VecOrSliceDef LDKCVecTempl_PublicKey_arr_info(long vec_ptr);
        public static native boolean LDKCResult_CVec_u8ZPeerHandleErrorZ_result_ok(long arg);
        public static native long LDKCResult_CVec_u8ZPeerHandleErrorZ_get_inner(long arg);
        public static native boolean LDKCResult_boolPeerHandleErrorZ_result_ok(long arg);
@@ -301,10 +358,25 @@ public class bindings {
        public static native long LDKCResult_SecretKeySecpErrorZ_get_inner(long arg);
        public static native boolean LDKCResult_PublicKeySecpErrorZ_result_ok(long arg);
        public static native long LDKCResult_PublicKeySecpErrorZ_get_inner(long arg);
+       public static native long LDKTxCreationKeys_optional_none();
        public static native boolean LDKCResult_TxCreationKeysSecpErrorZ_result_ok(long arg);
        public static native long LDKCResult_TxCreationKeysSecpErrorZ_get_inner(long arg);
+       public static native VecOrSliceDef LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature_arr_info(long vec_ptr);
+       public static native long LDKRouteHop_optional_none();
+       public static native VecOrSliceDef LDKCVecTempl_RouteHop_arr_info(long vec_ptr);
+       public static native VecOrSliceDef LDKCVecTempl_CVecTempl_RouteHop_arr_info(long vec_ptr);
+       public static native long LDKRouteHint_optional_none();
+       public static native long LDKRoutingFees_optional_none();
        public static native boolean LDKCResult_RouteLightningErrorZ_result_ok(long arg);
        public static native long LDKCResult_RouteLightningErrorZ_get_inner(long arg);
+       public static native long LDKNetworkGraph_optional_none();
+       public static native VecOrSliceDef LDKCVecTempl_RouteHint_arr_info(long vec_ptr);
+       public static native long LDKLockedNetworkGraph_optional_none();
+       public static native long LDKNetGraphMsgHandler_optional_none();
+       public static native long LDKDirectionalChannelInfo_optional_none();
+       public static native long LDKChannelInfo_optional_none();
+       public static native long LDKNodeAnnouncementInfo_optional_none();
+       public static native long LDKNodeInfo_optional_none();
        // extern const void (*C2Tuple_HTLCOutputInCommitmentSignatureZ_free)(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ);
        public static native void C2Tuple_HTLCOutputInCommitmentSignatureZ_free(long arg);
        // extern const void (*C2Tuple_OutPointScriptZ_free)(LDKC2Tuple_OutPointScriptZ);