<groupId>org.lightningdevkit</groupId>
<artifactId>ldk-java</artifactId>
- <version>0.0.100.2</version>
+ <version>0.0.101.0</version>
<name>LDK Java Bindings and Binaries</name>
<description>LDK Java Bindings and Release Binaries</description>
LDKSemanticError_MultiplePaymentHashes,
LDKSemanticError_NoDescription,
LDKSemanticError_MultipleDescriptions,
+ LDKSemanticError_NoPaymentSecret,
LDKSemanticError_MultiplePaymentSecrets,
LDKSemanticError_InvalidFeatures,
LDKSemanticError_InvalidRecoveryId,
LDKSemanticError_InvalidSignature,
+ LDKSemanticError_ImpreciseAmount,
; static native void init();
static { init(); }
}
\ No newline at end of file
try {
// Try to load natively first, this works on Android and in testing.
System.loadLibrary("lightningjni");
- } catch (UnsatisfiedLinkError _ignored) {
+ } catch (UnsatisfiedLinkError system_load_err) {
// Otherwise try to load from the library jar.
File tmpdir = new File(System.getProperty("java.io.tmpdir"), "ldk-java-nativelib");
tmpdir.mkdir(); // If it fails to create, assume it was there already
Files.copy(is, libpath, StandardCopyOption.REPLACE_EXISTING);
Runtime.getRuntime().load(libpath.toString());
} catch (IOException e) {
+ System.err.println("Failed to load LDK native library.");
+ System.err.println("System LDK native library load failed with: " + system_load_err);
+ System.err.println("Resource-based LDK native library load failed with: " + e);
throw new IllegalArgumentException(e);
}
}
static native String get_lib_version_string();
public static String get_ldk_java_bindings_version() {
- return "v0.0.100.2";
+ return "v0.0.101.0";
}
public static native String get_ldk_c_bindings_version();
public static native String get_ldk_version();
public static native boolean LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_result_ok(long arg);
public static native long LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(long arg);
public static native long LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(long arg);
+ public static native boolean LDKCResult_TrustedClosingTransactionNoneZ_result_ok(long arg);
+ public static native long LDKCResult_TrustedClosingTransactionNoneZ_get_ok(long arg);
+ public static native void LDKCResult_TrustedClosingTransactionNoneZ_get_err(long arg);
public static native boolean LDKCResult_CommitmentTransactionDecodeErrorZ_result_ok(long arg);
public static native long LDKCResult_CommitmentTransactionDecodeErrorZ_get_ok(long arg);
public static native long LDKCResult_CommitmentTransactionDecodeErrorZ_get_err(long arg);
public long htlc_event;
HTLCEvent(long htlc_event) { this.htlc_event = htlc_event; }
}
- public final static class CommitmentTxBroadcasted extends LDKMonitorEvent {
- public long commitment_tx_broadcasted;
- CommitmentTxBroadcasted(long commitment_tx_broadcasted) { this.commitment_tx_broadcasted = commitment_tx_broadcasted; }
+ public final static class CommitmentTxConfirmed extends LDKMonitorEvent {
+ public long commitment_tx_confirmed;
+ CommitmentTxConfirmed(long commitment_tx_confirmed) { this.commitment_tx_confirmed = commitment_tx_confirmed; }
}
static native void init();
}
}
static { LDKCOption_C2Tuple_usizeTransactionZZ.init(); }
public static native LDKCOption_C2Tuple_usizeTransactionZZ LDKCOption_C2Tuple_usizeTransactionZZ_ref_from_ptr(long ptr);
+ public static class LDKNetworkUpdate {
+ private LDKNetworkUpdate() {}
+ public final static class ChannelUpdateMessage extends LDKNetworkUpdate {
+ public long msg;
+ ChannelUpdateMessage(long msg) { this.msg = msg; }
+ }
+ public final static class ChannelClosed extends LDKNetworkUpdate {
+ public long short_channel_id;
+ public boolean is_permanent;
+ ChannelClosed(long short_channel_id, boolean is_permanent) { this.short_channel_id = short_channel_id; this.is_permanent = is_permanent; }
+ }
+ public final static class NodeFailure extends LDKNetworkUpdate {
+ public byte[] node_id;
+ public boolean is_permanent;
+ NodeFailure(byte[] node_id, boolean is_permanent) { this.node_id = node_id; this.is_permanent = is_permanent; }
+ }
+ static native void init();
+ }
+ static { LDKNetworkUpdate.init(); }
+ public static native LDKNetworkUpdate LDKNetworkUpdate_ref_from_ptr(long ptr);
+ public static class LDKCOption_NetworkUpdateZ {
+ private LDKCOption_NetworkUpdateZ() {}
+ public final static class Some extends LDKCOption_NetworkUpdateZ {
+ public long some;
+ Some(long some) { this.some = some; }
+ }
+ public final static class None extends LDKCOption_NetworkUpdateZ {
+ None() { }
+ }
+ static native void init();
+ }
+ static { LDKCOption_NetworkUpdateZ.init(); }
+ public static native LDKCOption_NetworkUpdateZ LDKCOption_NetworkUpdateZ_ref_from_ptr(long ptr);
public static class LDKSpendableOutputDescriptor {
private LDKSpendableOutputDescriptor() {}
public final static class StaticOutput extends LDKSpendableOutputDescriptor {
}
static { LDKErrorAction.init(); }
public static native LDKErrorAction LDKErrorAction_ref_from_ptr(long ptr);
- public static class LDKHTLCFailChannelUpdate {
- private LDKHTLCFailChannelUpdate() {}
- public final static class ChannelUpdateMessage extends LDKHTLCFailChannelUpdate {
- public long msg;
- ChannelUpdateMessage(long msg) { this.msg = msg; }
- }
- public final static class ChannelClosed extends LDKHTLCFailChannelUpdate {
- public long short_channel_id;
- public boolean is_permanent;
- ChannelClosed(long short_channel_id, boolean is_permanent) { this.short_channel_id = short_channel_id; this.is_permanent = is_permanent; }
- }
- public final static class NodeFailure extends LDKHTLCFailChannelUpdate {
- public byte[] node_id;
- public boolean is_permanent;
- NodeFailure(byte[] node_id, boolean is_permanent) { this.node_id = node_id; this.is_permanent = is_permanent; }
- }
- static native void init();
- }
- static { LDKHTLCFailChannelUpdate.init(); }
- public static native LDKHTLCFailChannelUpdate LDKHTLCFailChannelUpdate_ref_from_ptr(long ptr);
public static class LDKMessageSendEvent {
private LDKMessageSendEvent() {}
public final static class SendAcceptChannel extends LDKMessageSendEvent {
public long action;
HandleError(byte[] node_id, long action) { this.node_id = node_id; this.action = action; }
}
- public final static class PaymentFailureNetworkUpdate extends LDKMessageSendEvent {
- public long update;
- PaymentFailureNetworkUpdate(long update) { this.update = update; }
- }
public final static class SendChannelRangeQuery extends LDKMessageSendEvent {
public byte[] node_id;
public long msg;
public static native boolean LDKCResult_SpendableOutputDescriptorDecodeErrorZ_result_ok(long arg);
public static native long LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(long arg);
public static native long LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_err(long arg);
+ public static native boolean LDKCResult_NoneNoneZ_result_ok(long arg);
+ public static native void LDKCResult_NoneNoneZ_get_ok(long arg);
+ public static native void LDKCResult_NoneNoneZ_get_err(long arg);
public static native long LDKC2Tuple_SignatureCVec_SignatureZZ_new(byte[] a, byte[][] b);
public static native byte[] LDKC2Tuple_SignatureCVec_SignatureZZ_get_a(long ptr);
public static native byte[][] LDKC2Tuple_SignatureCVec_SignatureZZ_get_b(long ptr);
public interface LDKBaseSign {
byte[] get_per_commitment_point(long idx);
byte[] release_commitment_secret(long idx);
+ long validate_holder_commitment(long holder_tx);
byte[] channel_keys_id();
long sign_counterparty_commitment(long commitment_tx);
+ long validate_counterparty_revocation(long idx, byte[] secret);
long sign_holder_commitment_and_htlcs(long commitment_tx);
long sign_justice_revoked_output(byte[] justice_tx, long input, long amount, byte[] per_commitment_key);
long sign_justice_revoked_htlc(byte[] justice_tx, long input, long amount, byte[] per_commitment_key, long htlc);
long sign_counterparty_htlc_transaction(byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, long htlc);
- long sign_closing_transaction(byte[] closing_tx);
+ long sign_closing_transaction(long closing_tx);
long sign_channel_announcement(long msg);
void ready_channel(long channel_parameters);
}
public static native byte[] BaseSign_get_per_commitment_point(long this_arg, long idx);
// LDKThirtyTwoBytes BaseSign_release_commitment_secret LDKBaseSign *NONNULL_PTR this_arg, uint64_t idx
public static native byte[] BaseSign_release_commitment_secret(long this_arg, long idx);
+ // LDKCResult_NoneNoneZ BaseSign_validate_holder_commitment LDKBaseSign *NONNULL_PTR this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx
+ public static native long BaseSign_validate_holder_commitment(long this_arg, long holder_tx);
// LDKThirtyTwoBytes BaseSign_channel_keys_id LDKBaseSign *NONNULL_PTR this_arg
public static native byte[] BaseSign_channel_keys_id(long this_arg);
// LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ BaseSign_sign_counterparty_commitment LDKBaseSign *NONNULL_PTR this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx
public static native long BaseSign_sign_counterparty_commitment(long this_arg, long commitment_tx);
+ // LDKCResult_NoneNoneZ BaseSign_validate_counterparty_revocation LDKBaseSign *NONNULL_PTR this_arg, uint64_t idx, const uint8_t (*secret)[32]
+ public static native long BaseSign_validate_counterparty_revocation(long this_arg, long idx, byte[] secret);
// LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ BaseSign_sign_holder_commitment_and_htlcs LDKBaseSign *NONNULL_PTR this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx
public static native long BaseSign_sign_holder_commitment_and_htlcs(long this_arg, long commitment_tx);
// LDKCResult_SignatureNoneZ BaseSign_sign_justice_revoked_output LDKBaseSign *NONNULL_PTR this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32]
public static native long BaseSign_sign_justice_revoked_htlc(long this_arg, byte[] justice_tx, long input, long amount, byte[] per_commitment_key, long htlc);
// LDKCResult_SignatureNoneZ BaseSign_sign_counterparty_htlc_transaction LDKBaseSign *NONNULL_PTR this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc
public static native long BaseSign_sign_counterparty_htlc_transaction(long this_arg, byte[] htlc_tx, long input, long amount, byte[] per_commitment_point, long htlc);
- // LDKCResult_SignatureNoneZ BaseSign_sign_closing_transaction LDKBaseSign *NONNULL_PTR this_arg, struct LDKTransaction closing_tx
- public static native long BaseSign_sign_closing_transaction(long this_arg, byte[] closing_tx);
+ // LDKCResult_SignatureNoneZ BaseSign_sign_closing_transaction LDKBaseSign *NONNULL_PTR this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx
+ public static native long BaseSign_sign_closing_transaction(long this_arg, long closing_tx);
// LDKCResult_SignatureNoneZ BaseSign_sign_channel_announcement LDKBaseSign *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg
public static native long BaseSign_sign_channel_announcement(long this_arg, long msg);
// void BaseSign_ready_channel LDKBaseSign *NONNULL_PTR this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters
public static native boolean LDKCResult_OutPointDecodeErrorZ_result_ok(long arg);
public static native long LDKCResult_OutPointDecodeErrorZ_get_ok(long arg);
public static native long LDKCResult_OutPointDecodeErrorZ_get_err(long arg);
+ public interface LDKType {
+ short type_id();
+ String debug_str();
+ byte[] write();
+ }
+ public static native long LDKType_new(LDKType impl);
+ // uint16_t Type_type_id LDKType *NONNULL_PTR this_arg
+ public static native short Type_type_id(long this_arg);
+ // LDKStr Type_debug_str LDKType *NONNULL_PTR this_arg
+ public static native String Type_debug_str(long this_arg);
+ // LDKCVec_u8Z Type_write LDKType *NONNULL_PTR this_arg
+ public static native byte[] Type_write(long this_arg);
+ public static class LDKCOption_TypeZ {
+ private LDKCOption_TypeZ() {}
+ public final static class Some extends LDKCOption_TypeZ {
+ public long some;
+ Some(long some) { this.some = some; }
+ }
+ public final static class None extends LDKCOption_TypeZ {
+ None() { }
+ }
+ static native void init();
+ }
+ static { LDKCOption_TypeZ.init(); }
+ public static native LDKCOption_TypeZ LDKCOption_TypeZ_ref_from_ptr(long ptr);
+ public static native boolean LDKCResult_COption_TypeZDecodeErrorZ_result_ok(long arg);
+ public static native long LDKCResult_COption_TypeZDecodeErrorZ_get_ok(long arg);
+ public static native long LDKCResult_COption_TypeZDecodeErrorZ_get_err(long arg);
public static native boolean LDKCResult_SiPrefixNoneZ_result_ok(long arg);
public static native SiPrefix LDKCResult_SiPrefixNoneZ_get_ok(long arg);
public static native void LDKCResult_SiPrefixNoneZ_get_err(long arg);
}
static { LDKPaymentPurpose.init(); }
public static native LDKPaymentPurpose LDKPaymentPurpose_ref_from_ptr(long ptr);
+ public static class LDKClosureReason {
+ private LDKClosureReason() {}
+ public final static class CounterpartyForceClosed extends LDKClosureReason {
+ public String peer_msg;
+ CounterpartyForceClosed(String peer_msg) { this.peer_msg = peer_msg; }
+ }
+ public final static class HolderForceClosed extends LDKClosureReason {
+ HolderForceClosed() { }
+ }
+ public final static class CooperativeClosure extends LDKClosureReason {
+ CooperativeClosure() { }
+ }
+ public final static class CommitmentTxConfirmed extends LDKClosureReason {
+ CommitmentTxConfirmed() { }
+ }
+ public final static class ProcessingError extends LDKClosureReason {
+ public String err;
+ ProcessingError(String err) { this.err = err; }
+ }
+ public final static class DisconnectedPeer extends LDKClosureReason {
+ DisconnectedPeer() { }
+ }
+ public final static class OutdatedChannelManager extends LDKClosureReason {
+ OutdatedChannelManager() { }
+ }
+ static native void init();
+ }
+ static { LDKClosureReason.init(); }
+ public static native LDKClosureReason LDKClosureReason_ref_from_ptr(long ptr);
public static class LDKEvent {
private LDKEvent() {}
public final static class FundingGenerationReady extends LDKEvent {
public byte[] payment_preimage;
PaymentSent(byte[] payment_preimage) { this.payment_preimage = payment_preimage; }
}
- public final static class PaymentFailed extends LDKEvent {
+ public final static class PaymentPathFailed extends LDKEvent {
public byte[] payment_hash;
public boolean rejected_by_dest;
- PaymentFailed(byte[] payment_hash, boolean rejected_by_dest) { this.payment_hash = payment_hash; this.rejected_by_dest = rejected_by_dest; }
+ public long network_update;
+ public boolean all_paths_failed;
+ public long[] path;
+ PaymentPathFailed(byte[] payment_hash, boolean rejected_by_dest, long network_update, boolean all_paths_failed, long[] path) { this.payment_hash = payment_hash; this.rejected_by_dest = rejected_by_dest; this.network_update = network_update; this.all_paths_failed = all_paths_failed; this.path = path; }
}
public final static class PendingHTLCsForwardable extends LDKEvent {
public long time_forwardable;
public boolean claim_from_onchain_tx;
PaymentForwarded(long fee_earned_msat, boolean claim_from_onchain_tx) { this.fee_earned_msat = fee_earned_msat; this.claim_from_onchain_tx = claim_from_onchain_tx; }
}
+ public final static class ChannelClosed extends LDKEvent {
+ public byte[] channel_id;
+ public long reason;
+ ChannelClosed(byte[] channel_id, long reason) { this.channel_id = channel_id; this.reason = reason; }
+ }
static native void init();
}
static { LDKEvent.init(); }
public static native byte[] LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(long ptr);
public static native long[] LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(long ptr);
public static native long LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_new(long[] elems);
+ public static class LDKBalance {
+ private LDKBalance() {}
+ public final static class ClaimableOnChannelClose extends LDKBalance {
+ public long claimable_amount_satoshis;
+ ClaimableOnChannelClose(long claimable_amount_satoshis) { this.claimable_amount_satoshis = claimable_amount_satoshis; }
+ }
+ public final static class ClaimableAwaitingConfirmations extends LDKBalance {
+ public long claimable_amount_satoshis;
+ public int confirmation_height;
+ ClaimableAwaitingConfirmations(long claimable_amount_satoshis, int confirmation_height) { this.claimable_amount_satoshis = claimable_amount_satoshis; this.confirmation_height = confirmation_height; }
+ }
+ public final static class ContentiousClaimable extends LDKBalance {
+ public long claimable_amount_satoshis;
+ public int timeout_height;
+ ContentiousClaimable(long claimable_amount_satoshis, int timeout_height) { this.claimable_amount_satoshis = claimable_amount_satoshis; this.timeout_height = timeout_height; }
+ }
+ public final static class MaybeClaimableHTLCAwaitingTimeout extends LDKBalance {
+ public long claimable_amount_satoshis;
+ public int claimable_height;
+ MaybeClaimableHTLCAwaitingTimeout(long claimable_amount_satoshis, int claimable_height) { this.claimable_amount_satoshis = claimable_amount_satoshis; this.claimable_height = claimable_height; }
+ }
+ static native void init();
+ }
+ static { LDKBalance.init(); }
+ public static native LDKBalance LDKBalance_ref_from_ptr(long ptr);
+ public static native long LDKCVec_BalanceZ_new(long[] elems);
public static native boolean LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_result_ok(long arg);
public static native long LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(long arg);
public static native long LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(long arg);
+ public static native boolean LDKCResult_NoneLightningErrorZ_result_ok(long arg);
+ public static native void LDKCResult_NoneLightningErrorZ_get_ok(long arg);
+ public static native long LDKCResult_NoneLightningErrorZ_get_err(long arg);
+ public static native long LDKC2Tuple_PublicKeyTypeZ_new(byte[] a, long b);
+ public static native byte[] LDKC2Tuple_PublicKeyTypeZ_get_a(long ptr);
+ public static native long LDKC2Tuple_PublicKeyTypeZ_get_b(long ptr);
+ public static native long LDKCVec_C2Tuple_PublicKeyTypeZZ_new(long[] elems);
public static native boolean LDKCResult_boolLightningErrorZ_result_ok(long arg);
public static native boolean LDKCResult_boolLightningErrorZ_get_ok(long arg);
public static native long LDKCResult_boolLightningErrorZ_get_err(long arg);
public static native long LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(long ptr);
public static native long LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_new(long[] elems);
public static native long LDKCVec_NodeAnnouncementZ_new(long[] elems);
- public static native boolean LDKCResult_NoneLightningErrorZ_result_ok(long arg);
- public static native void LDKCResult_NoneLightningErrorZ_get_ok(long arg);
- public static native long LDKCResult_NoneLightningErrorZ_get_err(long arg);
public static native boolean LDKCResult_CVec_u8ZPeerHandleErrorZ_result_ok(long arg);
public static native byte[] LDKCResult_CVec_u8ZPeerHandleErrorZ_get_ok(long arg);
public static native long LDKCResult_CVec_u8ZPeerHandleErrorZ_get_err(long arg);
public static native boolean LDKCResult_boolPeerHandleErrorZ_result_ok(long arg);
public static native boolean LDKCResult_boolPeerHandleErrorZ_get_ok(long arg);
public static native long LDKCResult_boolPeerHandleErrorZ_get_err(long arg);
+ public interface LDKAccess {
+ long get_utxo(byte[] genesis_hash, long short_channel_id);
+ }
+ public static native long LDKAccess_new(LDKAccess impl);
+ // LDKCResult_TxOutAccessErrorZ Access_get_utxo LDKAccess *NONNULL_PTR this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id
+ public static native long Access_get_utxo(long this_arg, byte[] genesis_hash, long short_channel_id);
+ public static class LDKCOption_AccessZ {
+ private LDKCOption_AccessZ() {}
+ public final static class Some extends LDKCOption_AccessZ {
+ public long some;
+ Some(long some) { this.some = some; }
+ }
+ public final static class None extends LDKCOption_AccessZ {
+ None() { }
+ }
+ static native void init();
+ }
+ static { LDKCOption_AccessZ.init(); }
+ public static native LDKCOption_AccessZ LDKCOption_AccessZ_ref_from_ptr(long ptr);
public static native boolean LDKCResult_DirectionalChannelInfoDecodeErrorZ_result_ok(long arg);
public static native long LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_ok(long arg);
public static native long LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_err(long arg);
public static native boolean LDKCResult_InvoiceSignOrCreationErrorZ_result_ok(long arg);
public static native long LDKCResult_InvoiceSignOrCreationErrorZ_get_ok(long arg);
public static native long LDKCResult_InvoiceSignOrCreationErrorZ_get_err(long arg);
+ public interface LDKFilter {
+ void register_tx(byte[] txid, byte[] script_pubkey);
+ long register_output(long output);
+ }
+ public static native long LDKFilter_new(LDKFilter impl);
+ // void Filter_register_tx LDKFilter *NONNULL_PTR this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey
+ public static native void Filter_register_tx(long this_arg, byte[] txid, byte[] script_pubkey);
+ // LDKCOption_C2Tuple_usizeTransactionZZ Filter_register_output LDKFilter *NONNULL_PTR this_arg, struct LDKWatchedOutput output
+ public static native long Filter_register_output(long this_arg, long output);
+ public static class LDKCOption_FilterZ {
+ private LDKCOption_FilterZ() {}
+ public final static class Some extends LDKCOption_FilterZ {
+ public long some;
+ Some(long some) { this.some = some; }
+ }
+ public final static class None extends LDKCOption_FilterZ {
+ None() { }
+ }
+ static native void init();
+ }
+ static { LDKCOption_FilterZ.init(); }
+ public static native LDKCOption_FilterZ LDKCOption_FilterZ_ref_from_ptr(long ptr);
public interface LDKMessageSendEventsProvider {
long[] get_and_clear_pending_msg_events();
}
void handle_event(long event);
}
public static native long LDKEventHandler_new(LDKEventHandler impl);
- // void EventHandler_handle_event LDKEventHandler *NONNULL_PTR this_arg, struct LDKEvent event
+ // void EventHandler_handle_event LDKEventHandler *NONNULL_PTR this_arg, const struct LDKEvent *NONNULL_PTR event
public static native void EventHandler_handle_event(long this_arg, long event);
public interface LDKEventsProvider {
void process_pending_events(long handler);
public static native long LDKEventsProvider_new(LDKEventsProvider impl);
// void EventsProvider_process_pending_events LDKEventsProvider *NONNULL_PTR this_arg, struct LDKEventHandler handler
public static native void EventsProvider_process_pending_events(long this_arg, long handler);
- public interface LDKAccess {
- long get_utxo(byte[] genesis_hash, long short_channel_id);
- }
- public static native long LDKAccess_new(LDKAccess impl);
- // LDKCResult_TxOutAccessErrorZ Access_get_utxo LDKAccess *NONNULL_PTR this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id
- public static native long Access_get_utxo(long this_arg, byte[] genesis_hash, long short_channel_id);
public interface LDKListen {
void block_connected(byte[] block, int height);
void block_disconnected(byte[] header, int height);
public static native void Confirm_best_block_updated(long this_arg, byte[] header, int height);
// LDKCVec_TxidZ Confirm_get_relevant_txids LDKConfirm *NONNULL_PTR this_arg
public static native byte[][] Confirm_get_relevant_txids(long this_arg);
- public interface LDKFilter {
- void register_tx(byte[] txid, byte[] script_pubkey);
- long register_output(long output);
- }
- public static native long LDKFilter_new(LDKFilter impl);
- // void Filter_register_tx LDKFilter *NONNULL_PTR this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey
- public static native void Filter_register_tx(long this_arg, byte[] txid, byte[] script_pubkey);
- // LDKCOption_C2Tuple_usizeTransactionZZ Filter_register_output LDKFilter *NONNULL_PTR this_arg, struct LDKWatchedOutput output
- public static native long Filter_register_output(long this_arg, long output);
public interface LDKPersist {
long persist_new_channel(long id, long data);
long update_persisted_channel(long id, long update, long data);
long handle_node_announcement(long msg);
long handle_channel_announcement(long msg);
long handle_channel_update(long msg);
- void handle_htlc_fail_channel_update(long update);
long[] get_next_channel_announcements(long starting_point, byte batch_amount);
long[] get_next_node_announcements(byte[] starting_point, byte batch_amount);
void sync_routing_table(byte[] their_node_id, long init);
public static native long RoutingMessageHandler_handle_channel_announcement(long this_arg, long msg);
// LDKCResult_boolLightningErrorZ RoutingMessageHandler_handle_channel_update LDKRoutingMessageHandler *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg
public static native long RoutingMessageHandler_handle_channel_update(long this_arg, long msg);
- // void RoutingMessageHandler_handle_htlc_fail_channel_update LDKRoutingMessageHandler *NONNULL_PTR this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update
- public static native void RoutingMessageHandler_handle_htlc_fail_channel_update(long this_arg, long update);
// LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ RoutingMessageHandler_get_next_channel_announcements LDKRoutingMessageHandler *NONNULL_PTR this_arg, uint64_t starting_point, uint8_t batch_amount
public static native long[] RoutingMessageHandler_get_next_channel_announcements(long this_arg, long starting_point, byte batch_amount);
// LDKCVec_NodeAnnouncementZ RoutingMessageHandler_get_next_node_announcements LDKRoutingMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount
public static native long RoutingMessageHandler_handle_query_channel_range(long this_arg, byte[] their_node_id, long msg);
// LDKCResult_NoneLightningErrorZ RoutingMessageHandler_handle_query_short_channel_ids LDKRoutingMessageHandler *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg
public static native long RoutingMessageHandler_handle_query_short_channel_ids(long this_arg, byte[] their_node_id, long msg);
+ public interface LDKCustomMessageReader {
+ long read(short message_type, byte[] buffer);
+ }
+ public static native long LDKCustomMessageReader_new(LDKCustomMessageReader impl);
+ // LDKCResult_COption_TypeZDecodeErrorZ CustomMessageReader_read LDKCustomMessageReader *NONNULL_PTR this_arg, uint16_t message_type, struct LDKu8slice buffer
+ public static native long CustomMessageReader_read(long this_arg, short message_type, byte[] buffer);
+ public interface LDKCustomMessageHandler {
+ long handle_custom_message(long msg, byte[] sender_node_id);
+ long[] get_and_clear_pending_msg();
+ }
+ public static native long LDKCustomMessageHandler_new(LDKCustomMessageHandler impl, LDKCustomMessageReader CustomMessageReader);
+ public static native long LDKCustomMessageHandler_get_CustomMessageReader(long arg);
+ // LDKCResult_NoneLightningErrorZ CustomMessageHandler_handle_custom_message LDKCustomMessageHandler *NONNULL_PTR this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id
+ public static native long CustomMessageHandler_handle_custom_message(long this_arg, long msg, byte[] sender_node_id);
+ // LDKCVec_C2Tuple_PublicKeyTypeZZ CustomMessageHandler_get_and_clear_pending_msg LDKCustomMessageHandler *NONNULL_PTR this_arg
+ public static native long[] CustomMessageHandler_get_and_clear_pending_msg(long this_arg);
public interface LDKSocketDescriptor {
long send_data(byte[] data, boolean resume_read);
void disconnect_socket();
public static native void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(long _res);
// struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
public static native long CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(long orig);
+ // struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o);
+ public static native long CResult_TrustedClosingTransactionNoneZ_ok(long o);
+ // struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void);
+ public static native long CResult_TrustedClosingTransactionNoneZ_err();
+ // void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res);
+ public static native void CResult_TrustedClosingTransactionNoneZ_free(long _res);
// struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
public static native long CResult_CommitmentTransactionDecodeErrorZ_ok(long o);
// struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
public static native void COption_C2Tuple_usizeTransactionZZ_free(long _res);
// struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig);
public static native long COption_C2Tuple_usizeTransactionZZ_clone(long orig);
+ // struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o);
+ public static native long COption_NetworkUpdateZ_some(long o);
+ // struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void);
+ public static native long COption_NetworkUpdateZ_none();
+ // void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res);
+ public static native void COption_NetworkUpdateZ_free(long _res);
+ // struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig);
+ public static native long COption_NetworkUpdateZ_clone(long orig);
// void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
public static native void CVec_SpendableOutputDescriptorZ_free(long[] _res);
// void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
public static native void CResult_SpendableOutputDescriptorDecodeErrorZ_free(long _res);
// struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
public static native long CResult_SpendableOutputDescriptorDecodeErrorZ_clone(long orig);
+ // struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void);
+ public static native long CResult_NoneNoneZ_ok();
+ // struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void);
+ public static native long CResult_NoneNoneZ_err();
+ // void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res);
+ public static native void CResult_NoneNoneZ_free(long _res);
+ // struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig);
+ public static native long CResult_NoneNoneZ_clone(long orig);
// struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
public static native long C2Tuple_SignatureCVec_SignatureZZ_clone(long orig);
// struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
public static native void CResult_OutPointDecodeErrorZ_free(long _res);
// struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
public static native long CResult_OutPointDecodeErrorZ_clone(long orig);
+ // struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o);
+ public static native long COption_TypeZ_some(long o);
+ // struct LDKCOption_TypeZ COption_TypeZ_none(void);
+ public static native long COption_TypeZ_none();
+ // void COption_TypeZ_free(struct LDKCOption_TypeZ _res);
+ public static native void COption_TypeZ_free(long _res);
+ // struct LDKCOption_TypeZ COption_TypeZ_clone(const struct LDKCOption_TypeZ *NONNULL_PTR orig);
+ public static native long COption_TypeZ_clone(long orig);
+ // struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o);
+ public static native long CResult_COption_TypeZDecodeErrorZ_ok(long o);
+ // struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e);
+ public static native long CResult_COption_TypeZDecodeErrorZ_err(long e);
+ // void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res);
+ public static native void CResult_COption_TypeZDecodeErrorZ_free(long _res);
+ // struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_clone(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR orig);
+ public static native long CResult_COption_TypeZDecodeErrorZ_clone(long orig);
// struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_ok(enum LDKSiPrefix o);
public static native long CResult_SiPrefixNoneZ_ok(SiPrefix o);
// struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_err(void);
public static native void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(long _res);
// void CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res);
public static native void CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(long[] _res);
+ // void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res);
+ public static native void CVec_BalanceZ_free(long[] _res);
// struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
public static native long CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(long o);
// struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
public static native long CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(long e);
// void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
public static native void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(long _res);
+ // struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
+ public static native long CResult_NoneLightningErrorZ_ok();
+ // struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
+ public static native long CResult_NoneLightningErrorZ_err(long e);
+ // void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
+ public static native void CResult_NoneLightningErrorZ_free(long _res);
+ // struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
+ public static native long CResult_NoneLightningErrorZ_clone(long orig);
+ // struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_clone(const struct LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR orig);
+ public static native long C2Tuple_PublicKeyTypeZ_clone(long orig);
+ // struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b);
+ public static native long C2Tuple_PublicKeyTypeZ_new(byte[] a, long b);
+ // void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res);
+ public static native void C2Tuple_PublicKeyTypeZ_free(long _res);
+ // void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res);
+ public static native void CVec_C2Tuple_PublicKeyTypeZZ_free(long[] _res);
// struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
public static native long CResult_boolLightningErrorZ_ok(boolean o);
// struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
public static native void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(long[] _res);
// void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
public static native void CVec_NodeAnnouncementZ_free(long[] _res);
- // struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
- public static native long CResult_NoneLightningErrorZ_ok();
- // struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
- public static native long CResult_NoneLightningErrorZ_err(long e);
- // void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
- public static native void CResult_NoneLightningErrorZ_free(long _res);
- // struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
- public static native long CResult_NoneLightningErrorZ_clone(long orig);
// void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
public static native void CVec_PublicKeyZ_free(byte[][] _res);
// struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
public static native void CResult_boolPeerHandleErrorZ_free(long _res);
// struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
public static native long CResult_boolPeerHandleErrorZ_clone(long orig);
+ // struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o);
+ public static native long COption_AccessZ_some(long o);
+ // struct LDKCOption_AccessZ COption_AccessZ_none(void);
+ public static native long COption_AccessZ_none();
+ // void COption_AccessZ_free(struct LDKCOption_AccessZ _res);
+ public static native void COption_AccessZ_free(long _res);
// struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o);
public static native long CResult_DirectionalChannelInfoDecodeErrorZ_ok(long o);
// struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
public static native long CResult_NetworkGraphDecodeErrorZ_err(long e);
// void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
public static native void CResult_NetworkGraphDecodeErrorZ_free(long _res);
- // struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
- public static native long CResult_NetworkGraphDecodeErrorZ_clone(long orig);
// struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o);
public static native long CResult_NetAddressu8Z_ok(long o);
// struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_err(uint8_t e);
public static native void CResult_InvoiceSignOrCreationErrorZ_free(long _res);
// struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
public static native long CResult_InvoiceSignOrCreationErrorZ_clone(long orig);
+ // struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o);
+ public static native long COption_FilterZ_some(long o);
+ // struct LDKCOption_FilterZ COption_FilterZ_none(void);
+ public static native long COption_FilterZ_none();
+ // void COption_FilterZ_free(struct LDKCOption_FilterZ _res);
+ public static native void COption_FilterZ_free(long _res);
// void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
public static native void PaymentPurpose_free(long this_ptr);
// struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
public static native long PaymentPurpose_invoice_payment(byte[] payment_preimage, byte[] payment_secret, long user_payment_id);
// struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
public static native long PaymentPurpose_spontaneous_payment(byte[] a);
+ // void ClosureReason_free(struct LDKClosureReason this_ptr);
+ public static native void ClosureReason_free(long this_ptr);
+ // struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig);
+ public static native long ClosureReason_clone(long orig);
+ // struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKStr peer_msg);
+ public static native long ClosureReason_counterparty_force_closed(String peer_msg);
+ // struct LDKClosureReason ClosureReason_holder_force_closed(void);
+ public static native long ClosureReason_holder_force_closed();
+ // struct LDKClosureReason ClosureReason_cooperative_closure(void);
+ public static native long ClosureReason_cooperative_closure();
+ // struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void);
+ public static native long ClosureReason_commitment_tx_confirmed();
+ // struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err);
+ public static native long ClosureReason_processing_error(String err);
+ // struct LDKClosureReason ClosureReason_disconnected_peer(void);
+ public static native long ClosureReason_disconnected_peer();
+ // struct LDKClosureReason ClosureReason_outdated_channel_manager(void);
+ public static native long ClosureReason_outdated_channel_manager();
+ // struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj);
+ public static native byte[] ClosureReason_write(long obj);
// void Event_free(struct LDKEvent this_ptr);
public static native void Event_free(long this_ptr);
// struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
public static native long Event_payment_received(byte[] payment_hash, long amt, long purpose);
// struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_preimage);
public static native long Event_payment_sent(byte[] payment_preimage);
- // struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_hash, bool rejected_by_dest);
- public static native long Event_payment_failed(byte[] payment_hash, boolean rejected_by_dest);
+ // struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_hash, bool rejected_by_dest, struct LDKCOption_NetworkUpdateZ network_update, bool all_paths_failed, struct LDKCVec_RouteHopZ path);
+ public static native long Event_payment_path_failed(byte[] payment_hash, boolean rejected_by_dest, long network_update, boolean all_paths_failed, long[] path);
// struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable);
public static native long Event_pending_htlcs_forwardable(long time_forwardable);
// struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs);
public static native long Event_spendable_outputs(long[] outputs);
// struct LDKEvent Event_payment_forwarded(struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx);
public static native long Event_payment_forwarded(long fee_earned_msat, boolean claim_from_onchain_tx);
+ // struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, struct LDKClosureReason reason);
+ public static native long Event_channel_closed(byte[] channel_id, long reason);
// struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
public static native byte[] Event_write(long obj);
// void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
public static native long MessageSendEvent_send_channel_update(byte[] node_id, long msg);
// struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action);
public static native long MessageSendEvent_handle_error(byte[] node_id, long action);
- // struct LDKMessageSendEvent MessageSendEvent_payment_failure_network_update(struct LDKHTLCFailChannelUpdate update);
- public static native long MessageSendEvent_payment_failure_network_update(long update);
// struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg);
public static native long MessageSendEvent_send_channel_range_query(byte[] node_id, long msg);
// struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg);
public static native void FeeEstimator_free(long this_ptr);
// void ChainMonitor_free(struct LDKChainMonitor this_obj);
public static native void ChainMonitor_free(long this_obj);
- // MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
+ // MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
public static native long ChainMonitor_new(long chain_source, long broadcaster, long logger, long feeest, long persister);
+ // MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels);
+ public static native long[] ChainMonitor_get_claimable_balances(long this_arg, long[] ignored_channels);
// struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
public static native long ChainMonitor_as_Listen(long this_arg);
// struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
public static native long MonitorEvent_clone(long orig);
// struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a);
public static native long MonitorEvent_htlcevent(long a);
- // struct LDKMonitorEvent MonitorEvent_commitment_tx_broadcasted(struct LDKOutPoint a);
- public static native long MonitorEvent_commitment_tx_broadcasted(long a);
+ // struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a);
+ public static native long MonitorEvent_commitment_tx_confirmed(long a);
// void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
public static native void HTLCUpdate_free(long this_obj);
// struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
public static native byte[] HTLCUpdate_write(long obj);
// struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
public static native long HTLCUpdate_read(byte[] ser);
+ // void Balance_free(struct LDKBalance this_ptr);
+ public static native void Balance_free(long this_ptr);
+ // struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig);
+ public static native long Balance_clone(long orig);
+ // struct LDKBalance Balance_claimable_on_channel_close(uint64_t claimable_amount_satoshis);
+ public static native long Balance_claimable_on_channel_close(long claimable_amount_satoshis);
+ // struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t claimable_amount_satoshis, uint32_t confirmation_height);
+ public static native long Balance_claimable_awaiting_confirmations(long claimable_amount_satoshis, int confirmation_height);
+ // struct LDKBalance Balance_contentious_claimable(uint64_t claimable_amount_satoshis, uint32_t timeout_height);
+ public static native long Balance_contentious_claimable(long claimable_amount_satoshis, int timeout_height);
+ // struct LDKBalance Balance_maybe_claimable_htlcawaiting_timeout(uint64_t claimable_amount_satoshis, uint32_t claimable_height);
+ public static native long Balance_maybe_claimable_htlcawaiting_timeout(long claimable_amount_satoshis, int claimable_height);
+ // bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b);
+ public static native boolean Balance_eq(long a, long b);
// void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
public static native void ChannelMonitor_free(long this_obj);
// struct LDKChannelMonitor ChannelMonitor_clone(const struct LDKChannelMonitor *NONNULL_PTR orig);
public static native byte[][] ChannelMonitor_get_relevant_txids(long this_arg);
// MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
public static native long ChannelMonitor_current_best_block(long this_arg);
+ // MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
+ public static native long[] ChannelMonitor_get_claimable_balances(long this_arg);
// void Persist_free(struct LDKPersist this_ptr);
public static native void Persist_free(long this_ptr);
// struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(struct LDKu8slice ser, const struct LDKKeysInterface *NONNULL_PTR arg);
public static native long ChainParameters_new(Network network_arg, long best_block_arg);
// struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig);
public static native long ChainParameters_clone(long orig);
+ // void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj);
+ public static native void CounterpartyForwardingInfo_free(long this_obj);
+ // uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
+ public static native int CounterpartyForwardingInfo_get_fee_base_msat(long this_ptr);
+ // void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
+ public static native void CounterpartyForwardingInfo_set_fee_base_msat(long this_ptr, int val);
+ // uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
+ public static native int CounterpartyForwardingInfo_get_fee_proportional_millionths(long this_ptr);
+ // void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
+ public static native void CounterpartyForwardingInfo_set_fee_proportional_millionths(long this_ptr, int val);
+ // uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
+ public static native short CounterpartyForwardingInfo_get_cltv_expiry_delta(long this_ptr);
+ // void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val);
+ public static native void CounterpartyForwardingInfo_set_cltv_expiry_delta(long this_ptr, short val);
+ // MUST_USE_RES struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_new(uint32_t fee_base_msat_arg, uint32_t fee_proportional_millionths_arg, uint16_t cltv_expiry_delta_arg);
+ public static native long CounterpartyForwardingInfo_new(int fee_base_msat_arg, int fee_proportional_millionths_arg, short cltv_expiry_delta_arg);
+ // struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig);
+ public static native long CounterpartyForwardingInfo_clone(long orig);
// void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj);
public static native void ChannelCounterparty_free(long this_obj);
// struct LDKPublicKey ChannelCounterparty_get_node_id(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
public static native long ChannelCounterparty_get_unspendable_punishment_reserve(long this_ptr);
// void ChannelCounterparty_set_unspendable_punishment_reserve(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, uint64_t val);
public static native void ChannelCounterparty_set_unspendable_punishment_reserve(long this_ptr, long val);
+ // struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
+ public static native long ChannelCounterparty_get_forwarding_info(long this_ptr);
+ // void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val);
+ public static native void ChannelCounterparty_set_forwarding_info(long this_ptr, long val);
+ // MUST_USE_RES struct LDKChannelCounterparty ChannelCounterparty_new(struct LDKPublicKey node_id_arg, struct LDKInitFeatures features_arg, uint64_t unspendable_punishment_reserve_arg, struct LDKCounterpartyForwardingInfo forwarding_info_arg);
+ public static native long ChannelCounterparty_new(byte[] node_id_arg, long features_arg, long unspendable_punishment_reserve_arg, long forwarding_info_arg);
// struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig);
public static native long ChannelCounterparty_clone(long orig);
// void ChannelDetails_free(struct LDKChannelDetails this_obj);
public static native long LightningError_clone(long orig);
// void CommitmentUpdate_free(struct LDKCommitmentUpdate this_obj);
public static native void CommitmentUpdate_free(long this_obj);
+ // struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
+ public static native long[] CommitmentUpdate_get_update_add_htlcs(long this_ptr);
// void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
public static native void CommitmentUpdate_set_update_add_htlcs(long this_ptr, long[] val);
+ // struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
+ public static native long[] CommitmentUpdate_get_update_fulfill_htlcs(long this_ptr);
// void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
public static native void CommitmentUpdate_set_update_fulfill_htlcs(long this_ptr, long[] val);
+ // struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
+ public static native long[] CommitmentUpdate_get_update_fail_htlcs(long this_ptr);
// void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
public static native void CommitmentUpdate_set_update_fail_htlcs(long this_ptr, long[] val);
+ // struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
+ public static native long[] CommitmentUpdate_get_update_fail_malformed_htlcs(long this_ptr);
// void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
public static native void CommitmentUpdate_set_update_fail_malformed_htlcs(long this_ptr, long[] val);
// struct LDKUpdateFee CommitmentUpdate_get_update_fee(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
public static native long CommitmentUpdate_new(long[] update_add_htlcs_arg, long[] update_fulfill_htlcs_arg, long[] update_fail_htlcs_arg, long[] update_fail_malformed_htlcs_arg, long update_fee_arg, long commitment_signed_arg);
// struct LDKCommitmentUpdate CommitmentUpdate_clone(const struct LDKCommitmentUpdate *NONNULL_PTR orig);
public static native long CommitmentUpdate_clone(long orig);
- // void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr);
- public static native void HTLCFailChannelUpdate_free(long this_ptr);
- // struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *NONNULL_PTR orig);
- public static native long HTLCFailChannelUpdate_clone(long orig);
- // struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_channel_update_message(struct LDKChannelUpdate msg);
- public static native long HTLCFailChannelUpdate_channel_update_message(long msg);
- // struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_channel_closed(uint64_t short_channel_id, bool is_permanent);
- public static native long HTLCFailChannelUpdate_channel_closed(long short_channel_id, boolean is_permanent);
- // struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
- public static native long HTLCFailChannelUpdate_node_failure(byte[] node_id, boolean is_permanent);
// void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
public static native void ChannelMessageHandler_free(long this_ptr);
// void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr);
public static native long QueryShortChannelIds_read(byte[] ser);
// struct LDKCVec_u8Z QueryShortChannelIds_write(const struct LDKQueryShortChannelIds *NONNULL_PTR obj);
public static native byte[] QueryShortChannelIds_write(long obj);
- // struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
- public static native long ReplyShortChannelIdsEnd_read(byte[] ser);
// struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
public static native byte[] ReplyShortChannelIdsEnd_write(long obj);
+ // struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
+ public static native long ReplyShortChannelIdsEnd_read(byte[] ser);
// MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
public static native int QueryChannelRange_end_blocknum(long this_arg);
- // struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
- public static native long QueryChannelRange_read(byte[] ser);
// struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
public static native byte[] QueryChannelRange_write(long obj);
+ // struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
+ public static native long QueryChannelRange_read(byte[] ser);
// struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
public static native long ReplyChannelRange_read(byte[] ser);
// struct LDKCVec_u8Z ReplyChannelRange_write(const struct LDKReplyChannelRange *NONNULL_PTR obj);
public static native byte[] ReplyChannelRange_write(long obj);
- // struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
- public static native long GossipTimestampFilter_read(byte[] ser);
// struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
public static native byte[] GossipTimestampFilter_write(long obj);
+ // struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
+ public static native long GossipTimestampFilter_read(byte[] ser);
+ // void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr);
+ public static native void CustomMessageHandler_free(long this_ptr);
// void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
public static native void IgnoringMessageHandler_free(long this_obj);
// MUST_USE_RES struct LDKIgnoringMessageHandler IgnoringMessageHandler_new(void);
public static native long IgnoringMessageHandler_as_MessageSendEventsProvider(long this_arg);
// struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
public static native long IgnoringMessageHandler_as_RoutingMessageHandler(long this_arg);
+ // struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
+ public static native long IgnoringMessageHandler_as_CustomMessageReader(long this_arg);
+ // struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
+ public static native long IgnoringMessageHandler_as_CustomMessageHandler(long this_arg);
// void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
public static native void ErroringMessageHandler_free(long this_obj);
// MUST_USE_RES struct LDKErroringMessageHandler ErroringMessageHandler_new(void);
public static native long PeerHandleError_clone(long orig);
// void PeerManager_free(struct LDKPeerManager this_obj);
public static native void PeerManager_free(long this_obj);
- // MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler message_handler, struct LDKSecretKey our_node_secret, const uint8_t (*ephemeral_random_data)[32], struct LDKLogger logger);
- public static native long PeerManager_new(long message_handler, byte[] our_node_secret, byte[] ephemeral_random_data, long logger);
+ // MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler message_handler, struct LDKSecretKey our_node_secret, const uint8_t (*ephemeral_random_data)[32], struct LDKLogger logger, struct LDKCustomMessageHandler custom_message_handler);
+ public static native long PeerManager_new(long message_handler, byte[] our_node_secret, byte[] ephemeral_random_data, long logger, long custom_message_handler);
// MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
public static native byte[][] PeerManager_get_peer_node_ids(long this_arg);
// MUST_USE_RES struct LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKSocketDescriptor descriptor);
public static native void PeerManager_timer_tick_occurred(long this_arg);
// struct LDKThirtyTwoBytes build_commitment_secret(const uint8_t (*commitment_seed)[32], uint64_t idx);
public static native byte[] build_commitment_secret(byte[] commitment_seed, long idx);
+ // struct LDKTransaction build_closing_transaction(uint64_t to_holder_value_sat, uint64_t to_counterparty_value_sat, struct LDKCVec_u8Z to_holder_script, struct LDKCVec_u8Z to_counterparty_script, struct LDKOutPoint funding_outpoint);
+ public static native byte[] build_closing_transaction(long to_holder_value_sat, long to_counterparty_value_sat, byte[] to_holder_script, byte[] to_counterparty_script, long funding_outpoint);
// struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
public static native long derive_private_key(byte[] per_commitment_point, byte[] base_secret);
// struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point);
public static native byte[] BuiltCommitmentTransaction_get_sighash_all(long this_arg, byte[] funding_redeemscript, long channel_value_satoshis);
// MUST_USE_RES struct LDKSignature BuiltCommitmentTransaction_sign(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
public static native byte[] BuiltCommitmentTransaction_sign(long this_arg, byte[] funding_key, byte[] funding_redeemscript, long channel_value_satoshis);
+ // void ClosingTransaction_free(struct LDKClosingTransaction this_obj);
+ public static native void ClosingTransaction_free(long this_obj);
+ // MUST_USE_RES struct LDKClosingTransaction ClosingTransaction_new(uint64_t to_holder_value_sat, uint64_t to_counterparty_value_sat, struct LDKCVec_u8Z to_holder_script, struct LDKCVec_u8Z to_counterparty_script, struct LDKOutPoint funding_outpoint);
+ public static native long ClosingTransaction_new(long to_holder_value_sat, long to_counterparty_value_sat, byte[] to_holder_script, byte[] to_counterparty_script, long funding_outpoint);
+ // MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
+ public static native long ClosingTransaction_trust(long this_arg);
+ // MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint);
+ public static native long ClosingTransaction_verify(long this_arg, long funding_outpoint);
+ // MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
+ public static native long ClosingTransaction_to_holder_value_sat(long this_arg);
+ // MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
+ public static native long ClosingTransaction_to_counterparty_value_sat(long this_arg);
+ // MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
+ public static native byte[] ClosingTransaction_to_holder_script(long this_arg);
+ // MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
+ public static native byte[] ClosingTransaction_to_counterparty_script(long this_arg);
+ // void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj);
+ public static native void TrustedClosingTransaction_free(long this_obj);
+ // MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg);
+ public static native byte[] TrustedClosingTransaction_built_transaction(long this_arg);
+ // MUST_USE_RES struct LDKThirtyTwoBytes TrustedClosingTransaction_get_sighash_all(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg, struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
+ public static native byte[] TrustedClosingTransaction_get_sighash_all(long this_arg, byte[] funding_redeemscript, long channel_value_satoshis);
+ // MUST_USE_RES struct LDKSignature TrustedClosingTransaction_sign(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
+ public static native byte[] TrustedClosingTransaction_sign(long this_arg, byte[] funding_key, byte[] funding_redeemscript, long channel_value_satoshis);
// void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
public static native void CommitmentTransaction_free(long this_obj);
// struct LDKCommitmentTransaction CommitmentTransaction_clone(const struct LDKCommitmentTransaction *NONNULL_PTR orig);
public static native long InitFeatures_empty();
// MUST_USE_RES struct LDKInitFeatures InitFeatures_known(void);
public static native long InitFeatures_known();
+ // MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg);
+ public static native boolean InitFeatures_requires_unknown_bits(long this_arg);
// MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
public static native long NodeFeatures_empty();
// MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known(void);
public static native long NodeFeatures_known();
+ // MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
+ public static native boolean NodeFeatures_requires_unknown_bits(long this_arg);
// MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
public static native long ChannelFeatures_empty();
// MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_known(void);
public static native long ChannelFeatures_known();
+ // MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg);
+ public static native boolean ChannelFeatures_requires_unknown_bits(long this_arg);
// MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
public static native long InvoiceFeatures_empty();
// MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_known(void);
public static native long InvoiceFeatures_known();
+ // MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
+ public static native boolean InvoiceFeatures_requires_unknown_bits(long this_arg);
// MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
public static native boolean InitFeatures_supports_payment_secret(long this_arg);
// MUST_USE_RES bool NodeFeatures_supports_payment_secret(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
public static native byte[] ShutdownScript_as_legacy_pubkey(long this_arg);
// MUST_USE_RES bool ShutdownScript_is_compatible(const struct LDKShutdownScript *NONNULL_PTR this_arg, const struct LDKInitFeatures *NONNULL_PTR features);
public static native boolean ShutdownScript_is_compatible(long this_arg, long features);
+ // void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr);
+ public static native void CustomMessageReader_free(long this_ptr);
+ // struct LDKType Type_clone(const struct LDKType *NONNULL_PTR orig);
+ public static native long Type_clone(long orig);
+ // void Type_free(struct LDKType this_ptr);
+ public static native void Type_free(long this_ptr);
// void RouteHop_free(struct LDKRouteHop this_obj);
public static native void RouteHop_free(long this_obj);
// struct LDKPublicKey RouteHop_get_pubkey(const struct LDKRouteHop *NONNULL_PTR this_ptr);
public static native long RouteHop_new(byte[] pubkey_arg, long node_features_arg, long short_channel_id_arg, long channel_features_arg, long fee_msat_arg, int cltv_expiry_delta_arg);
// struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
public static native long RouteHop_clone(long orig);
+ // uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o);
+ public static native long RouteHop_hash(long o);
+ // bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b);
+ public static native boolean RouteHop_eq(long a, long b);
// struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
public static native byte[] RouteHop_write(long obj);
// struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
public static native long RouteHop_read(byte[] ser);
// void Route_free(struct LDKRoute this_obj);
public static native void Route_free(long this_obj);
+ // struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr);
+ public static native long[][] Route_get_paths(long this_ptr);
// void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
public static native void Route_set_paths(long this_ptr, long[][] val);
// MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg);
public static native long Route_new(long[][] paths_arg);
// struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
public static native long Route_clone(long orig);
+ // uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o);
+ public static native long Route_hash(long o);
+ // bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b);
+ public static native boolean Route_eq(long a, long b);
+ // MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg);
+ public static native long Route_get_total_fees(long this_arg);
+ // MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg);
+ public static native long Route_get_total_amount(long this_arg);
// struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
public static native byte[] Route_write(long obj);
// struct LDKCResult_RouteDecodeErrorZ Route_read(struct LDKu8slice ser);
public static native long Route_read(byte[] ser);
// void RouteHint_free(struct LDKRouteHint this_obj);
public static native void RouteHint_free(long this_obj);
- // bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
- public static native boolean RouteHint_eq(long a, long b);
// struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
public static native long RouteHint_clone(long orig);
+ // uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o);
+ public static native long RouteHint_hash(long o);
+ // bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
+ public static native boolean RouteHint_eq(long a, long b);
// void RouteHintHop_free(struct LDKRouteHintHop this_obj);
public static native void RouteHintHop_free(long this_obj);
// struct LDKPublicKey RouteHintHop_get_src_node_id(const struct LDKRouteHintHop *NONNULL_PTR this_ptr);
public static native void RouteHintHop_set_htlc_maximum_msat(long this_ptr, long val);
// MUST_USE_RES struct LDKRouteHintHop RouteHintHop_new(struct LDKPublicKey src_node_id_arg, uint64_t short_channel_id_arg, struct LDKRoutingFees fees_arg, uint16_t cltv_expiry_delta_arg, struct LDKCOption_u64Z htlc_minimum_msat_arg, struct LDKCOption_u64Z htlc_maximum_msat_arg);
public static native long RouteHintHop_new(byte[] src_node_id_arg, long short_channel_id_arg, long fees_arg, short cltv_expiry_delta_arg, long htlc_minimum_msat_arg, long htlc_maximum_msat_arg);
- // bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
- public static native boolean RouteHintHop_eq(long a, long b);
// struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
public static native long RouteHintHop_clone(long orig);
+ // uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o);
+ public static native long RouteHintHop_hash(long o);
+ // bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
+ public static native boolean RouteHintHop_eq(long a, long b);
// struct LDKCResult_RouteLightningErrorZ get_keysend_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger);
public static native long get_keysend_route(byte[] our_node_id, long network, byte[] payee, long[] first_hops, long[] last_hops, long final_value_msat, int final_cltv, long logger);
// struct LDKCResult_RouteLightningErrorZ get_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKInvoiceFeatures payee_features, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger);
public static native long get_route(byte[] our_node_id, long network, byte[] payee, long payee_features, long[] first_hops, long[] last_hops, long final_value_msat, int final_cltv, long logger);
// void NetworkGraph_free(struct LDKNetworkGraph this_obj);
public static native void NetworkGraph_free(long this_obj);
- // struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
- public static native long NetworkGraph_clone(long orig);
- // void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_obj);
- public static native void LockedNetworkGraph_free(long this_obj);
+ // void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj);
+ public static native void ReadOnlyNetworkGraph_free(long this_obj);
+ // void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr);
+ public static native void NetworkUpdate_free(long this_ptr);
+ // struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig);
+ public static native long NetworkUpdate_clone(long orig);
+ // struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg);
+ public static native long NetworkUpdate_channel_update_message(long msg);
+ // struct LDKNetworkUpdate NetworkUpdate_channel_closed(uint64_t short_channel_id, bool is_permanent);
+ public static native long NetworkUpdate_channel_closed(long short_channel_id, boolean is_permanent);
+ // struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
+ public static native long NetworkUpdate_node_failure(byte[] node_id, boolean is_permanent);
+ // struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj);
+ public static native byte[] NetworkUpdate_write(long obj);
+ // struct LDKEventHandler NetGraphMsgHandler_as_EventHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
+ public static native long NetGraphMsgHandler_as_EventHandler(long this_arg);
// void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
public static native void NetGraphMsgHandler_free(long this_obj);
- // MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKAccess *chain_access, struct LDKLogger logger);
- public static native long NetGraphMsgHandler_new(byte[] genesis_hash, long chain_access, long logger);
- // MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(struct LDKAccess *chain_access, struct LDKLogger logger, struct LDKNetworkGraph network_graph);
- public static native long NetGraphMsgHandler_from_net_graph(long chain_access, long logger, long network_graph);
- // void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKAccess *chain_access);
+ // struct LDKNetworkGraph NetGraphMsgHandler_get_network_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_ptr);
+ public static native long NetGraphMsgHandler_get_network_graph(long this_ptr);
+ // void NetGraphMsgHandler_set_network_graph(struct LDKNetGraphMsgHandler *NONNULL_PTR this_ptr, struct LDKNetworkGraph val);
+ public static native void NetGraphMsgHandler_set_network_graph(long this_ptr, long val);
+ // MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKNetworkGraph network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger);
+ public static native long NetGraphMsgHandler_new(long network_graph, long chain_access, long logger);
+ // void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access);
public static native void NetGraphMsgHandler_add_chain_access(long this_arg, long chain_access);
- // MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
- public static native long NetGraphMsgHandler_read_locked_graph(long this_arg);
- // MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *NONNULL_PTR this_arg);
- public static native long LockedNetworkGraph_graph(long this_arg);
// struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
public static native long NetGraphMsgHandler_as_RoutingMessageHandler(long this_arg);
// struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
public static native boolean RoutingFees_eq(long a, long b);
// struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
public static native long RoutingFees_clone(long orig);
+ // uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o);
+ public static native long RoutingFees_hash(long o);
// struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
public static native byte[] RoutingFees_write(long obj);
// struct LDKCResult_RoutingFeesDecodeErrorZ RoutingFees_read(struct LDKu8slice ser);
public static native long NetworkGraph_read(byte[] ser);
// MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash);
public static native long NetworkGraph_new(byte[] genesis_hash);
- // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
+ // MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
+ public static native long NetworkGraph_read_only(long this_arg);
+ // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
public static native long NetworkGraph_update_node_from_announcement(long this_arg, long msg);
- // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
+ // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
public static native long NetworkGraph_update_node_from_unsigned_announcement(long this_arg, long msg);
- // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKAccess *chain_access);
+ // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_AccessZ chain_access);
public static native long NetworkGraph_update_channel_from_announcement(long this_arg, long msg, long chain_access);
- // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKAccess *chain_access);
+ // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_AccessZ chain_access);
public static native long NetworkGraph_update_channel_from_unsigned_announcement(long this_arg, long msg, long chain_access);
- // void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
+ // void NetworkGraph_close_channel_from_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
public static native void NetworkGraph_close_channel_from_update(long this_arg, long short_channel_id, boolean is_permanent);
- // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
+ // void NetworkGraph_fail_node(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent);
+ public static native void NetworkGraph_fail_node(long this_arg, byte[] _node_id, boolean is_permanent);
+ // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
public static native long NetworkGraph_update_channel(long this_arg, long msg);
- // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
+ // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
public static native long NetworkGraph_update_channel_unsigned(long this_arg, long msg);
// void FilesystemPersister_free(struct LDKFilesystemPersister this_obj);
public static native void FilesystemPersister_free(long this_obj);
public static native void BackgroundProcessor_free(long this_obj);
// void ChannelManagerPersister_free(struct LDKChannelManagerPersister this_ptr);
public static native void ChannelManagerPersister_free(long this_ptr);
- // MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKChannelManagerPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger);
- public static native long BackgroundProcessor_start(long persister, long event_handler, long chain_monitor, long channel_manager, long peer_manager, long logger);
+ // MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKChannelManagerPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, struct LDKNetGraphMsgHandler net_graph_msg_handler, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger);
+ public static native long BackgroundProcessor_start(long persister, long event_handler, long chain_monitor, long channel_manager, long net_graph_msg_handler, long peer_manager, long logger);
// MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg);
public static native long BackgroundProcessor_join(long this_arg);
// MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg);
public static native Currency Currency_simnet();
// enum LDKCurrency Currency_signet(void);
public static native Currency Currency_signet();
+ // uint64_t Currency_hash(const enum LDKCurrency *NONNULL_PTR o);
+ public static native long Currency_hash(long o);
// bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
public static native boolean Currency_eq(long a, long b);
// void Sha256_free(struct LDKSha256 this_obj);
public static native void Sha256_free(long this_obj);
- // bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
- public static native boolean Sha256_eq(long a, long b);
// struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
public static native long Sha256_clone(long orig);
+ // uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o);
+ public static native long Sha256_hash(long o);
+ // bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
+ public static native boolean Sha256_eq(long a, long b);
// void Description_free(struct LDKDescription this_obj);
public static native void Description_free(long this_obj);
- // bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
- public static native boolean Description_eq(long a, long b);
// struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
public static native long Description_clone(long orig);
+ // uint64_t Description_hash(const struct LDKDescription *NONNULL_PTR o);
+ public static native long Description_hash(long o);
+ // bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
+ public static native boolean Description_eq(long a, long b);
// void PayeePubKey_free(struct LDKPayeePubKey this_obj);
public static native void PayeePubKey_free(long this_obj);
- // bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
- public static native boolean PayeePubKey_eq(long a, long b);
// struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
public static native long PayeePubKey_clone(long orig);
+ // uint64_t PayeePubKey_hash(const struct LDKPayeePubKey *NONNULL_PTR o);
+ public static native long PayeePubKey_hash(long o);
+ // bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
+ public static native boolean PayeePubKey_eq(long a, long b);
// void ExpiryTime_free(struct LDKExpiryTime this_obj);
public static native void ExpiryTime_free(long this_obj);
- // bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
- public static native boolean ExpiryTime_eq(long a, long b);
// struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
public static native long ExpiryTime_clone(long orig);
+ // uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o);
+ public static native long ExpiryTime_hash(long o);
+ // bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
+ public static native boolean ExpiryTime_eq(long a, long b);
// void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
public static native void MinFinalCltvExpiry_free(long this_obj);
- // bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b);
- public static native boolean MinFinalCltvExpiry_eq(long a, long b);
// struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
public static native long MinFinalCltvExpiry_clone(long orig);
+ // uint64_t MinFinalCltvExpiry_hash(const struct LDKMinFinalCltvExpiry *NONNULL_PTR o);
+ public static native long MinFinalCltvExpiry_hash(long o);
+ // bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b);
+ public static native boolean MinFinalCltvExpiry_eq(long a, long b);
// void Fallback_free(struct LDKFallback this_ptr);
public static native void Fallback_free(long this_ptr);
// struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig);
public static native long Fallback_pub_key_hash(byte[] a);
// struct LDKFallback Fallback_script_hash(struct LDKTwentyBytes a);
public static native long Fallback_script_hash(byte[] a);
+ // uint64_t Fallback_hash(const struct LDKFallback *NONNULL_PTR o);
+ public static native long Fallback_hash(long o);
// bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
public static native boolean Fallback_eq(long a, long b);
// void InvoiceSignature_free(struct LDKInvoiceSignature this_obj);
public static native void InvoiceSignature_free(long this_obj);
- // bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
- public static native boolean InvoiceSignature_eq(long a, long b);
// struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
public static native long InvoiceSignature_clone(long orig);
+ // bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
+ public static native boolean InvoiceSignature_eq(long a, long b);
// void PrivateRoute_free(struct LDKPrivateRoute this_obj);
public static native void PrivateRoute_free(long this_obj);
- // bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
- public static native boolean PrivateRoute_eq(long a, long b);
// struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
public static native long PrivateRoute_clone(long orig);
+ // uint64_t PrivateRoute_hash(const struct LDKPrivateRoute *NONNULL_PTR o);
+ public static native long PrivateRoute_hash(long o);
+ // bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
+ public static native boolean PrivateRoute_eq(long a, long b);
// MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
public static native long SignedRawInvoice_into_parts(long this_arg);
// MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
public static native SemanticError SemanticError_no_description();
// enum LDKSemanticError SemanticError_multiple_descriptions(void);
public static native SemanticError SemanticError_multiple_descriptions();
+ // enum LDKSemanticError SemanticError_no_payment_secret(void);
+ public static native SemanticError SemanticError_no_payment_secret();
// enum LDKSemanticError SemanticError_multiple_payment_secrets(void);
public static native SemanticError SemanticError_multiple_payment_secrets();
// enum LDKSemanticError SemanticError_invalid_features(void);
public static native SemanticError SemanticError_invalid_recovery_id();
// enum LDKSemanticError SemanticError_invalid_signature(void);
public static native SemanticError SemanticError_invalid_signature();
+ // enum LDKSemanticError SemanticError_imprecise_amount(void);
+ public static native SemanticError SemanticError_imprecise_amount();
// bool SemanticError_eq(const enum LDKSemanticError *NONNULL_PTR a, const enum LDKSemanticError *NONNULL_PTR b);
public static native boolean SemanticError_eq(long a, long b);
// struct LDKStr SemanticError_to_str(const enum LDKSemanticError *NONNULL_PTR o);
/**
- * BackgroundProcessor takes care of tasks that (1) need to happen periodically to keep
+ * `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
* Rust-Lightning running properly, and (2) either can or should be run in the background. Its
* responsibilities are:
- * Monitoring whether the ChannelManager needs to be re-persisted to disk, and if so,
+ * Processing [`Event`]s with a user-provided [`EventHandler`].
+ * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so,
* writing it to disk/backups by invoking the callback given to it at startup.
- * ChannelManager persistence should be done in the background.
- * Calling `ChannelManager::timer_tick_occurred()` and
- * `PeerManager::timer_tick_occurred()` every minute (can be done in the
- * background).
+ * [`ChannelManager`] persistence should be done in the background.
+ * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
+ * at the appropriate intervals.
*
- * Note that if ChannelManager persistence fails and the persisted manager becomes out-of-date,
- * then there is a risk of channels force-closing on startup when the manager realizes it's
- * outdated. However, as long as `ChannelMonitor` backups are sound, no funds besides those used
- * for unilateral chain closure fees are at risk.
+ * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
+ * upon as doing so may result in high latency.
+ *
+ * # Note
+ *
+ * If [`ChannelManager`] persistence fails and the persisted manager becomes out-of-date, then
+ * there is a risk of channels force-closing on startup when the manager realizes it's outdated.
+ * However, as long as [`ChannelMonitor`] backups are sound, no funds besides those used for
+ * unilateral chain closure fees are at risk.
+ *
+ * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor
+ * [`Event`]: lightning::util::events::Event
* BackgroundProcessor will immediately stop on drop. It should be stored until shutdown.
*/
@SuppressWarnings("unchecked") // We correctly assign various generic arrays
* `persist_manager` returns an error. In case of an error, the error is retrieved by calling
* either [`join`] or [`stop`].
*
- * Typically, users should either implement [`ChannelManagerPersister`] to never return an
- * error or call [`join`] and handle any error that may arise. For the latter case, the
- * `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
+ * # Data Persistence
*
* `persist_manager` is responsible for writing out the [`ChannelManager`] to disk, and/or
* uploading to one or more backup services. See [`ChannelManager::write`] for writing out a
* [`ChannelManager`]. See [`FilesystemPersister::persist_manager`] for Rust-Lightning's
* provided implementation.
*
+ * Typically, users should either implement [`ChannelManagerPersister`] to never return an
+ * error or call [`join`] and handle any error that may arise. For the latter case,
+ * `BackgroundProcessor` must be restarted by calling `start` again after handling the error.
+ *
+ * # Event Handling
+ *
+ * `event_handler` is responsible for handling events that users should be notified of (e.g.,
+ * payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common
+ * functionality implemented by other handlers.
+ * [`NetGraphMsgHandler`] if given will update the [`NetworkGraph`] based on payment failures.
+ *
* [top-level documentation]: Self
* [`join`]: Self::join
* [`stop`]: Self::stop
* [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager
* [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable
* [`FilesystemPersister::persist_manager`]: lightning_persister::FilesystemPersister::persist_manager
+ * [`NetworkGraph`]: lightning::routing::network_graph::NetworkGraph
+ *
+ * Note that net_graph_msg_handler (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- public static BackgroundProcessor start(ChannelManagerPersister persister, EventHandler event_handler, ChainMonitor chain_monitor, ChannelManager channel_manager, PeerManager peer_manager, Logger logger) {
- long ret = bindings.BackgroundProcessor_start(persister == null ? 0 : persister.ptr, event_handler == null ? 0 : event_handler.ptr, chain_monitor == null ? 0 : chain_monitor.ptr & ~1, channel_manager == null ? 0 : channel_manager.ptr & ~1, peer_manager == null ? 0 : peer_manager.ptr & ~1, logger == null ? 0 : logger.ptr);
+ public static BackgroundProcessor start(ChannelManagerPersister persister, EventHandler event_handler, ChainMonitor chain_monitor, ChannelManager channel_manager, NetGraphMsgHandler net_graph_msg_handler, PeerManager peer_manager, Logger logger) {
+ long ret = bindings.BackgroundProcessor_start(persister == null ? 0 : persister.ptr, event_handler == null ? 0 : event_handler.ptr, chain_monitor == null ? 0 : chain_monitor.ptr & ~1, channel_manager == null ? 0 : channel_manager.ptr & ~1, net_graph_msg_handler == null ? 0 : net_graph_msg_handler.ptr & ~1, peer_manager == null ? 0 : peer_manager.ptr & ~1, logger == null ? 0 : logger.ptr);
if (ret < 1024) { return null; }
BackgroundProcessor ret_hu_conv = new BackgroundProcessor(null, ret);
ret_hu_conv.ptrs_to.add(ret_hu_conv);
ret_hu_conv.ptrs_to.add(event_handler);
ret_hu_conv.ptrs_to.add(chain_monitor);
ret_hu_conv.ptrs_to.add(channel_manager);
+ ret_hu_conv.ptrs_to.add(net_graph_msg_handler);
ret_hu_conv.ptrs_to.add(peer_manager);
ret_hu_conv.ptrs_to.add(logger);
return ret_hu_conv;
--- /dev/null
+package org.ldk.structs;
+
+import org.ldk.impl.bindings;
+import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
+import javax.annotation.Nullable;
+
+
+/**
+ * Details about the balance(s) available for spending once the channel appears on chain.
+ *
+ * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not
+ * be provided.
+ */
+@SuppressWarnings("unchecked") // We correctly assign various generic arrays
+public class Balance extends CommonBase {
+ private Balance(Object _dummy, long ptr) { super(ptr); }
+ @Override @SuppressWarnings("deprecation")
+ protected void finalize() throws Throwable {
+ super.finalize();
+ if (ptr != 0) { bindings.Balance_free(ptr); }
+ }
+ static Balance constr_from_ptr(long ptr) {
+ bindings.LDKBalance raw_val = bindings.LDKBalance_ref_from_ptr(ptr);
+ if (raw_val.getClass() == bindings.LDKBalance.ClaimableOnChannelClose.class) {
+ return new ClaimableOnChannelClose(ptr, (bindings.LDKBalance.ClaimableOnChannelClose)raw_val);
+ }
+ if (raw_val.getClass() == bindings.LDKBalance.ClaimableAwaitingConfirmations.class) {
+ return new ClaimableAwaitingConfirmations(ptr, (bindings.LDKBalance.ClaimableAwaitingConfirmations)raw_val);
+ }
+ if (raw_val.getClass() == bindings.LDKBalance.ContentiousClaimable.class) {
+ return new ContentiousClaimable(ptr, (bindings.LDKBalance.ContentiousClaimable)raw_val);
+ }
+ if (raw_val.getClass() == bindings.LDKBalance.MaybeClaimableHTLCAwaitingTimeout.class) {
+ return new MaybeClaimableHTLCAwaitingTimeout(ptr, (bindings.LDKBalance.MaybeClaimableHTLCAwaitingTimeout)raw_val);
+ }
+ assert false; return null; // Unreachable without extending the (internal) bindings interface
+ }
+
+ public final static class ClaimableOnChannelClose extends Balance {
+ /**
+ * The amount available to claim, in satoshis, excluding the on-chain fees which will be
+ * required to do so.
+ */
+ public final long claimable_amount_satoshis;
+ private ClaimableOnChannelClose(long ptr, bindings.LDKBalance.ClaimableOnChannelClose obj) {
+ super(null, ptr);
+ this.claimable_amount_satoshis = obj.claimable_amount_satoshis;
+ }
+ }
+ public final static class ClaimableAwaitingConfirmations extends Balance {
+ /**
+ * The amount available to claim, in satoshis, possibly excluding the on-chain fees which
+ * were spent in broadcasting the transaction.
+ */
+ public final long claimable_amount_satoshis;
+ /**
+ * The height at which an [`Event::SpendableOutputs`] event will be generated for this
+ * amount.
+ */
+ public final int confirmation_height;
+ private ClaimableAwaitingConfirmations(long ptr, bindings.LDKBalance.ClaimableAwaitingConfirmations obj) {
+ super(null, ptr);
+ this.claimable_amount_satoshis = obj.claimable_amount_satoshis;
+ this.confirmation_height = obj.confirmation_height;
+ }
+ }
+ public final static class ContentiousClaimable extends Balance {
+ /**
+ * The amount available to claim, in satoshis, excluding the on-chain fees which will be
+ * required to do so.
+ */
+ public final long claimable_amount_satoshis;
+ /**
+ * The height at which the counterparty may be able to claim the balance if we have not
+ * done so.
+ */
+ public final int timeout_height;
+ private ContentiousClaimable(long ptr, bindings.LDKBalance.ContentiousClaimable obj) {
+ super(null, ptr);
+ this.claimable_amount_satoshis = obj.claimable_amount_satoshis;
+ this.timeout_height = obj.timeout_height;
+ }
+ }
+ public final static class MaybeClaimableHTLCAwaitingTimeout extends Balance {
+ /**
+ * The amount available to claim, in satoshis, excluding the on-chain fees which will be
+ * required to do so.
+ */
+ public final long claimable_amount_satoshis;
+ /**
+ * The height at which we will be able to claim the balance if our counterparty has not
+ * done so.
+ */
+ public final int claimable_height;
+ private MaybeClaimableHTLCAwaitingTimeout(long ptr, bindings.LDKBalance.MaybeClaimableHTLCAwaitingTimeout obj) {
+ super(null, ptr);
+ this.claimable_amount_satoshis = obj.claimable_amount_satoshis;
+ this.claimable_height = obj.claimable_height;
+ }
+ }
+ /**
+ * Creates a copy of the Balance
+ */
+ public Balance clone() {
+ long ret = bindings.Balance_clone(this.ptr);
+ if (ret < 1024) { return null; }
+ Balance ret_hu_conv = Balance.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new ClaimableOnChannelClose-variant Balance
+ */
+ public static Balance claimable_on_channel_close(long claimable_amount_satoshis) {
+ long ret = bindings.Balance_claimable_on_channel_close(claimable_amount_satoshis);
+ if (ret < 1024) { return null; }
+ Balance ret_hu_conv = Balance.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance
+ */
+ public static Balance claimable_awaiting_confirmations(long claimable_amount_satoshis, int confirmation_height) {
+ long ret = bindings.Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
+ if (ret < 1024) { return null; }
+ Balance ret_hu_conv = Balance.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new ContentiousClaimable-variant Balance
+ */
+ public static Balance contentious_claimable(long claimable_amount_satoshis, int timeout_height) {
+ long ret = bindings.Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
+ if (ret < 1024) { return null; }
+ Balance ret_hu_conv = Balance.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new MaybeClaimableHTLCAwaitingTimeout-variant Balance
+ */
+ public static Balance maybe_claimable_htlcawaiting_timeout(long claimable_amount_satoshis, int claimable_height) {
+ long ret = bindings.Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
+ if (ret < 1024) { return null; }
+ Balance ret_hu_conv = Balance.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Checks if two Balances contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ */
+ public boolean eq(Balance b) {
+ boolean ret = bindings.Balance_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
+ this.ptrs_to.add(b);
+ return ret;
+ }
+
+}
* Note that the commitment number starts at (1 << 48) - 1 and counts backwards.
*/
byte[] release_commitment_secret(long idx);
+ /**
+ * Validate the counterparty's signatures on the holder commitment transaction and HTLCs.
+ *
+ * This is required in order for the signer to make sure that releasing a commitment
+ * secret won't leave us without a broadcastable holder transaction.
+ * Policy checks should be implemented in this function, including checking the amount
+ * sent to us and checking the HTLCs.
+ */
+ Result_NoneNoneZ validate_holder_commitment(HolderCommitmentTransaction holder_tx);
/**
* Gets an arbitrary identifier describing the set of keys which are provided back to you in
* some SpendableOutputDescriptor types. This should be sufficient to identify this
* Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
*
* Note that if signing fails or is rejected, the channel will be force-closed.
+ *
+ * Policy checks should be implemented in this function, including checking the amount
+ * sent to us and checking the HTLCs.
*/
Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment(CommitmentTransaction commitment_tx);
+ /**
+ * Validate the counterparty's revocation.
+ *
+ * This is required in order for the signer to make sure that the state has moved
+ * forward and it is safe to sign the next counterparty commitment.
+ */
+ Result_NoneNoneZ validate_counterparty_revocation(long idx, byte[] secret);
/**
* Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
* This will only ever be called with a non-revoked commitment_tx. This will be called with the
* Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
* chosen to forgo their output as dust.
*/
- Result_SignatureNoneZ sign_closing_transaction(byte[] closing_tx);
+ Result_SignatureNoneZ sign_closing_transaction(ClosingTransaction closing_tx);
/**
* Signs a channel announcement message with our funding key, proving it comes from one
* of the channel participants.
byte[] ret = arg.release_commitment_secret(idx);
return ret;
}
+ @Override public long validate_holder_commitment(long holder_tx) {
+ HolderCommitmentTransaction holder_tx_hu_conv = new HolderCommitmentTransaction(null, holder_tx);
+ Result_NoneNoneZ ret = arg.validate_holder_commitment(holder_tx_hu_conv);
+ long result = ret != null ? ret.ptr : 0;
+ return result;
+ }
@Override public byte[] channel_keys_id() {
byte[] ret = arg.channel_keys_id();
return ret;
long result = ret != null ? ret.ptr : 0;
return result;
}
+ @Override public long validate_counterparty_revocation(long idx, byte[] secret) {
+ Result_NoneNoneZ ret = arg.validate_counterparty_revocation(idx, secret);
+ long result = ret != null ? ret.ptr : 0;
+ return result;
+ }
@Override public long sign_holder_commitment_and_htlcs(long commitment_tx) {
HolderCommitmentTransaction commitment_tx_hu_conv = new HolderCommitmentTransaction(null, commitment_tx);
Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret = arg.sign_holder_commitment_and_htlcs(commitment_tx_hu_conv);
long result = ret != null ? ret.ptr : 0;
return result;
}
- @Override public long sign_closing_transaction(byte[] closing_tx) {
- Result_SignatureNoneZ ret = arg.sign_closing_transaction(closing_tx);
+ @Override public long sign_closing_transaction(long closing_tx) {
+ ClosingTransaction closing_tx_hu_conv = new ClosingTransaction(null, closing_tx);
+ Result_SignatureNoneZ ret = arg.sign_closing_transaction(closing_tx_hu_conv);
long result = ret != null ? ret.ptr : 0;
return result;
}
return ret;
}
+ /**
+ * Validate the counterparty's signatures on the holder commitment transaction and HTLCs.
+ *
+ * This is required in order for the signer to make sure that releasing a commitment
+ * secret won't leave us without a broadcastable holder transaction.
+ * Policy checks should be implemented in this function, including checking the amount
+ * sent to us and checking the HTLCs.
+ */
+ public Result_NoneNoneZ validate_holder_commitment(HolderCommitmentTransaction holder_tx) {
+ long ret = bindings.BaseSign_validate_holder_commitment(this.ptr, holder_tx == null ? 0 : holder_tx.ptr & ~1);
+ if (ret < 1024) { return null; }
+ Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
+ this.ptrs_to.add(holder_tx);
+ return ret_hu_conv;
+ }
+
/**
* Gets an arbitrary identifier describing the set of keys which are provided back to you in
* some SpendableOutputDescriptor types. This should be sufficient to identify this
* Create a signature for a counterparty's commitment transaction and associated HTLC transactions.
*
* Note that if signing fails or is rejected, the channel will be force-closed.
+ *
+ * Policy checks should be implemented in this function, including checking the amount
+ * sent to us and checking the HTLCs.
*/
public Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment(CommitmentTransaction commitment_tx) {
long ret = bindings.BaseSign_sign_counterparty_commitment(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr & ~1);
return ret_hu_conv;
}
+ /**
+ * Validate the counterparty's revocation.
+ *
+ * This is required in order for the signer to make sure that the state has moved
+ * forward and it is safe to sign the next counterparty commitment.
+ */
+ public Result_NoneNoneZ validate_counterparty_revocation(long idx, byte[] secret) {
+ long ret = bindings.BaseSign_validate_counterparty_revocation(this.ptr, idx, secret);
+ if (ret < 1024) { return null; }
+ Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
+ return ret_hu_conv;
+ }
+
/**
* Create a signatures for a holder's commitment transaction and its claiming HTLC transactions.
* This will only ever be called with a non-revoked commitment_tx. This will be called with the
* Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have
* chosen to forgo their output as dust.
*/
- public Result_SignatureNoneZ sign_closing_transaction(byte[] closing_tx) {
- long ret = bindings.BaseSign_sign_closing_transaction(this.ptr, closing_tx);
+ public Result_SignatureNoneZ sign_closing_transaction(ClosingTransaction closing_tx) {
+ long ret = bindings.BaseSign_sign_closing_transaction(this.ptr, closing_tx == null ? 0 : closing_tx.ptr & ~1);
if (ret < 1024) { return null; }
Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret);
+ this.ptrs_to.add(closing_tx);
return ret_hu_conv;
}
* pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
* always need to fetch full blocks absent another means for determining which blocks contain
* transactions relevant to the watched channels.
- *
- * Note that chain_source (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- public static ChainMonitor of(@Nullable Filter chain_source, BroadcasterInterface broadcaster, Logger logger, FeeEstimator feeest, Persist persister) {
- long ret = bindings.ChainMonitor_new(chain_source == null ? 0 : chain_source.ptr, broadcaster == null ? 0 : broadcaster.ptr, logger == null ? 0 : logger.ptr, feeest == null ? 0 : feeest.ptr, persister == null ? 0 : persister.ptr);
+ public static ChainMonitor of(Option_FilterZ chain_source, BroadcasterInterface broadcaster, Logger logger, FeeEstimator feeest, Persist persister) {
+ long ret = bindings.ChainMonitor_new(chain_source.ptr, broadcaster == null ? 0 : broadcaster.ptr, logger == null ? 0 : logger.ptr, feeest == null ? 0 : feeest.ptr, persister == null ? 0 : persister.ptr);
if (ret < 1024) { return null; }
ChainMonitor ret_hu_conv = new ChainMonitor(null, ret);
ret_hu_conv.ptrs_to.add(ret_hu_conv);
- ret_hu_conv.ptrs_to.add(chain_source);
ret_hu_conv.ptrs_to.add(broadcaster);
ret_hu_conv.ptrs_to.add(logger);
ret_hu_conv.ptrs_to.add(feeest);
return ret_hu_conv;
}
+ /**
+ * Gets the balances in the contained [`ChannelMonitor`]s which are claimable on-chain or
+ * claims which are awaiting confirmation.
+ *
+ * Includes the balances from each [`ChannelMonitor`] *except* those included in
+ * `ignored_channels`, allowing you to filter out balances from channels which are still open
+ * (and whose balance should likely be pulled from the [`ChannelDetails`]).
+ *
+ * See [`ChannelMonitor::get_claimable_balances`] for more details on the exact criteria for
+ * inclusion in the return value.
+ */
+ public Balance[] get_claimable_balances(ChannelDetails[] ignored_channels) {
+ long[] ret = bindings.ChainMonitor_get_claimable_balances(this.ptr, ignored_channels != null ? Arrays.stream(ignored_channels).mapToLong(ignored_channels_conv_16 -> ignored_channels_conv_16 == null ? 0 : ignored_channels_conv_16.ptr & ~1).toArray() : null);
+ Balance[] ret_conv_9_arr = new Balance[ret.length];
+ for (int j = 0; j < ret.length; j++) {
+ long ret_conv_9 = ret[j];
+ Balance ret_conv_9_hu_conv = Balance.constr_from_ptr(ret_conv_9);
+ ret_conv_9_hu_conv.ptrs_to.add(this);
+ ret_conv_9_arr[j] = ret_conv_9_hu_conv;
+ }
+ for (ChannelDetails ignored_channels_conv_16: ignored_channels) { this.ptrs_to.add(ignored_channels_conv_16); };
+ return ret_conv_9_arr;
+ }
+
/**
* Constructs a new Listen which calls the relevant methods on this_arg.
* This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
bindings.ChannelCounterparty_set_unspendable_punishment_reserve(this.ptr, val);
}
+ /**
+ * Information on the fees and requirements that the counterparty requires when forwarding
+ * payments to us through this channel.
+ *
+ * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+ @Nullable
+ public CounterpartyForwardingInfo get_forwarding_info() {
+ long ret = bindings.ChannelCounterparty_get_forwarding_info(this.ptr);
+ if (ret < 1024) { return null; }
+ CounterpartyForwardingInfo ret_hu_conv = new CounterpartyForwardingInfo(null, ret);
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Information on the fees and requirements that the counterparty requires when forwarding
+ * payments to us through this channel.
+ *
+ * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+ public void set_forwarding_info(@Nullable CounterpartyForwardingInfo val) {
+ bindings.ChannelCounterparty_set_forwarding_info(this.ptr, val == null ? 0 : val.ptr & ~1);
+ this.ptrs_to.add(val);
+ }
+
+ /**
+ * Constructs a new ChannelCounterparty given each field
+ */
+ public static ChannelCounterparty of(byte[] node_id_arg, InitFeatures features_arg, long unspendable_punishment_reserve_arg, CounterpartyForwardingInfo forwarding_info_arg) {
+ long ret = bindings.ChannelCounterparty_new(node_id_arg, features_arg == null ? 0 : features_arg.ptr & ~1, unspendable_punishment_reserve_arg, forwarding_info_arg == null ? 0 : forwarding_info_arg.ptr & ~1);
+ if (ret < 1024) { return null; }
+ ChannelCounterparty ret_hu_conv = new ChannelCounterparty(null, ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ ret_hu_conv.ptrs_to.add(features_arg);
+ ret_hu_conv.ptrs_to.add(forwarding_info_arg);
+ return ret_hu_conv;
+ }
+
/**
* Creates a copy of the ChannelCounterparty
*/
return ret_hu_conv;
}
+ /**
+ * Returns true if this `Features` object contains unknown feature flags which are set as
+ * \"required\".
+ */
+ public boolean requires_unknown_bits() {
+ boolean ret = bindings.ChannelFeatures_requires_unknown_bits(this.ptr);
+ return ret;
+ }
+
/**
* Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read
*/
*/
public void broadcast_node_announcement(byte[] rgb, byte[] alias, NetAddress[] addresses) {
bindings.ChannelManager_broadcast_node_announcement(this.ptr, rgb, alias, addresses != null ? Arrays.stream(addresses).mapToLong(addresses_conv_12 -> addresses_conv_12.ptr).toArray() : null);
- /* TODO 2 NetAddress */;
}
/**
ret_hu_conv.ptrs_to.add(tx_broadcaster);
ret_hu_conv.ptrs_to.add(logger);
ret_hu_conv.ptrs_to.add(default_config);
- /* TODO 2 ChannelMonitor */;
+ for (ChannelMonitor channel_monitors_conv_16: channel_monitors) { ret_hu_conv.ptrs_to.add(channel_monitors_conv_16); };
return ret_hu_conv;
}
// Warning: We may not free the C tuple object!
ret_conv_46_arr[u] = ret_conv_46_conv;
}
- /* TODO 2 TwoTuple<Long, byte[]> */;
this.ptrs_to.add(broadcaster);
this.ptrs_to.add(fee_estimator);
this.ptrs_to.add(logger);
// Warning: We may not free the C tuple object!
ret_conv_46_arr[u] = ret_conv_46_conv;
}
- /* TODO 2 TwoTuple<Long, byte[]> */;
this.ptrs_to.add(broadcaster);
this.ptrs_to.add(fee_estimator);
this.ptrs_to.add(logger);
return ret_hu_conv;
}
+ /**
+ * Gets the balances in this channel which are either claimable by us if we were to
+ * force-close the channel now or which are claimable on-chain (possibly awaiting
+ * confirmation).
+ *
+ * Any balances in the channel which are available on-chain (excluding on-chain fees) are
+ * included here until an [`Event::SpendableOutputs`] event has been generated for the
+ * balance, or until our counterparty has claimed the balance and accrued several
+ * confirmations on the claim transaction.
+ *
+ * Note that the balances available when you or your counterparty have broadcasted revoked
+ * state(s) may not be fully captured here.
+ *
+ * See [`Balance`] for additional details on the types of claimable balances which
+ * may be returned here and their meanings.
+ */
+ public Balance[] get_claimable_balances() {
+ long[] ret = bindings.ChannelMonitor_get_claimable_balances(this.ptr);
+ Balance[] ret_conv_9_arr = new Balance[ret.length];
+ for (int j = 0; j < ret.length; j++) {
+ long ret_conv_9 = ret[j];
+ Balance ret_conv_9_hu_conv = Balance.constr_from_ptr(ret_conv_9);
+ ret_conv_9_hu_conv.ptrs_to.add(this);
+ ret_conv_9_arr[j] = ret_conv_9_hu_conv;
+ }
+ return ret_conv_9_arr;
+ }
+
}
--- /dev/null
+package org.ldk.structs;
+
+import org.ldk.impl.bindings;
+import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
+import javax.annotation.Nullable;
+
+
+/**
+ * This class tracks the per-transaction information needed to build a closing transaction and will
+ * actually build it and sign.
+ *
+ * This class can be used inside a signer implementation to generate a signature given the relevant
+ * secret key.
+ */
+@SuppressWarnings("unchecked") // We correctly assign various generic arrays
+public class ClosingTransaction extends CommonBase {
+ ClosingTransaction(Object _dummy, long ptr) { super(ptr); }
+ @Override @SuppressWarnings("deprecation")
+ protected void finalize() throws Throwable {
+ super.finalize();
+ if (ptr != 0) { bindings.ClosingTransaction_free(ptr); }
+ }
+
+ /**
+ * Construct an object of the class
+ */
+ public static ClosingTransaction of(long to_holder_value_sat, long to_counterparty_value_sat, byte[] to_holder_script, byte[] to_counterparty_script, OutPoint funding_outpoint) {
+ long ret = bindings.ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script, to_counterparty_script, funding_outpoint == null ? 0 : funding_outpoint.ptr & ~1);
+ if (ret < 1024) { return null; }
+ ClosingTransaction ret_hu_conv = new ClosingTransaction(null, ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ ret_hu_conv.ptrs_to.add(funding_outpoint);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Trust our pre-built transaction.
+ *
+ * Applies a wrapper which allows access to the transaction.
+ *
+ * This should only be used if you fully trust the builder of this object. It should not
+ * be used by an external signer - instead use the verify function.
+ */
+ public TrustedClosingTransaction trust() {
+ long ret = bindings.ClosingTransaction_trust(this.ptr);
+ if (ret < 1024) { return null; }
+ TrustedClosingTransaction ret_hu_conv = new TrustedClosingTransaction(null, ret);
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Verify our pre-built transaction.
+ *
+ * Applies a wrapper which allows access to the transaction.
+ *
+ * An external validating signer must call this method before signing
+ * or using the built transaction.
+ */
+ public Result_TrustedClosingTransactionNoneZ verify(OutPoint funding_outpoint) {
+ long ret = bindings.ClosingTransaction_verify(this.ptr, funding_outpoint == null ? 0 : funding_outpoint.ptr & ~1);
+ if (ret < 1024) { return null; }
+ Result_TrustedClosingTransactionNoneZ ret_hu_conv = Result_TrustedClosingTransactionNoneZ.constr_from_ptr(ret);
+ this.ptrs_to.add(funding_outpoint);
+ return ret_hu_conv;
+ }
+
+ /**
+ * The value to be sent to the holder, or zero if the output will be omitted
+ */
+ public long to_holder_value_sat() {
+ long ret = bindings.ClosingTransaction_to_holder_value_sat(this.ptr);
+ return ret;
+ }
+
+ /**
+ * The value to be sent to the counterparty, or zero if the output will be omitted
+ */
+ public long to_counterparty_value_sat() {
+ long ret = bindings.ClosingTransaction_to_counterparty_value_sat(this.ptr);
+ return ret;
+ }
+
+ /**
+ * The destination of the holder's output
+ */
+ public byte[] to_holder_script() {
+ byte[] ret = bindings.ClosingTransaction_to_holder_script(this.ptr);
+ return ret;
+ }
+
+ /**
+ * The destination of the counterparty's output
+ */
+ public byte[] to_counterparty_script() {
+ byte[] ret = bindings.ClosingTransaction_to_counterparty_script(this.ptr);
+ return ret;
+ }
+
+}
--- /dev/null
+package org.ldk.structs;
+
+import org.ldk.impl.bindings;
+import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
+import javax.annotation.Nullable;
+
+
+/**
+ * The reason the channel was closed. See individual variants more details.
+ */
+@SuppressWarnings("unchecked") // We correctly assign various generic arrays
+public class ClosureReason extends CommonBase {
+ private ClosureReason(Object _dummy, long ptr) { super(ptr); }
+ @Override @SuppressWarnings("deprecation")
+ protected void finalize() throws Throwable {
+ super.finalize();
+ if (ptr != 0) { bindings.ClosureReason_free(ptr); }
+ }
+ static ClosureReason constr_from_ptr(long ptr) {
+ bindings.LDKClosureReason raw_val = bindings.LDKClosureReason_ref_from_ptr(ptr);
+ if (raw_val.getClass() == bindings.LDKClosureReason.CounterpartyForceClosed.class) {
+ return new CounterpartyForceClosed(ptr, (bindings.LDKClosureReason.CounterpartyForceClosed)raw_val);
+ }
+ if (raw_val.getClass() == bindings.LDKClosureReason.HolderForceClosed.class) {
+ return new HolderForceClosed(ptr, (bindings.LDKClosureReason.HolderForceClosed)raw_val);
+ }
+ if (raw_val.getClass() == bindings.LDKClosureReason.CooperativeClosure.class) {
+ return new CooperativeClosure(ptr, (bindings.LDKClosureReason.CooperativeClosure)raw_val);
+ }
+ if (raw_val.getClass() == bindings.LDKClosureReason.CommitmentTxConfirmed.class) {
+ return new CommitmentTxConfirmed(ptr, (bindings.LDKClosureReason.CommitmentTxConfirmed)raw_val);
+ }
+ if (raw_val.getClass() == bindings.LDKClosureReason.ProcessingError.class) {
+ return new ProcessingError(ptr, (bindings.LDKClosureReason.ProcessingError)raw_val);
+ }
+ if (raw_val.getClass() == bindings.LDKClosureReason.DisconnectedPeer.class) {
+ return new DisconnectedPeer(ptr, (bindings.LDKClosureReason.DisconnectedPeer)raw_val);
+ }
+ if (raw_val.getClass() == bindings.LDKClosureReason.OutdatedChannelManager.class) {
+ return new OutdatedChannelManager(ptr, (bindings.LDKClosureReason.OutdatedChannelManager)raw_val);
+ }
+ assert false; return null; // Unreachable without extending the (internal) bindings interface
+ }
+
+ public final static class CounterpartyForceClosed extends ClosureReason {
+ /**
+ * The error which the peer sent us.
+ *
+ * The string should be sanitized before it is used (e.g emitted to logs
+ * or printed to stdout). Otherwise, a well crafted error message may exploit
+ * a security vulnerability in the terminal emulator or the logging subsystem.
+ */
+ public final String peer_msg;
+ private CounterpartyForceClosed(long ptr, bindings.LDKClosureReason.CounterpartyForceClosed obj) {
+ super(null, ptr);
+ this.peer_msg = obj.peer_msg;
+ }
+ }
+ public final static class HolderForceClosed extends ClosureReason {
+ private HolderForceClosed(long ptr, bindings.LDKClosureReason.HolderForceClosed obj) {
+ super(null, ptr);
+ }
+ }
+ public final static class CooperativeClosure extends ClosureReason {
+ private CooperativeClosure(long ptr, bindings.LDKClosureReason.CooperativeClosure obj) {
+ super(null, ptr);
+ }
+ }
+ public final static class CommitmentTxConfirmed extends ClosureReason {
+ private CommitmentTxConfirmed(long ptr, bindings.LDKClosureReason.CommitmentTxConfirmed obj) {
+ super(null, ptr);
+ }
+ }
+ public final static class ProcessingError extends ClosureReason {
+ /**
+ * A developer-readable error message which we generated.
+ */
+ public final String err;
+ private ProcessingError(long ptr, bindings.LDKClosureReason.ProcessingError obj) {
+ super(null, ptr);
+ this.err = obj.err;
+ }
+ }
+ public final static class DisconnectedPeer extends ClosureReason {
+ private DisconnectedPeer(long ptr, bindings.LDKClosureReason.DisconnectedPeer obj) {
+ super(null, ptr);
+ }
+ }
+ public final static class OutdatedChannelManager extends ClosureReason {
+ private OutdatedChannelManager(long ptr, bindings.LDKClosureReason.OutdatedChannelManager obj) {
+ super(null, ptr);
+ }
+ }
+ /**
+ * Creates a copy of the ClosureReason
+ */
+ public ClosureReason clone() {
+ long ret = bindings.ClosureReason_clone(this.ptr);
+ if (ret < 1024) { return null; }
+ ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason
+ */
+ public static ClosureReason counterparty_force_closed(java.lang.String peer_msg) {
+ long ret = bindings.ClosureReason_counterparty_force_closed(peer_msg);
+ if (ret < 1024) { return null; }
+ ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new HolderForceClosed-variant ClosureReason
+ */
+ public static ClosureReason holder_force_closed() {
+ long ret = bindings.ClosureReason_holder_force_closed();
+ if (ret < 1024) { return null; }
+ ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new CooperativeClosure-variant ClosureReason
+ */
+ public static ClosureReason cooperative_closure() {
+ long ret = bindings.ClosureReason_cooperative_closure();
+ if (ret < 1024) { return null; }
+ ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason
+ */
+ public static ClosureReason commitment_tx_confirmed() {
+ long ret = bindings.ClosureReason_commitment_tx_confirmed();
+ if (ret < 1024) { return null; }
+ ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new ProcessingError-variant ClosureReason
+ */
+ public static ClosureReason processing_error(java.lang.String err) {
+ long ret = bindings.ClosureReason_processing_error(err);
+ if (ret < 1024) { return null; }
+ ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new DisconnectedPeer-variant ClosureReason
+ */
+ public static ClosureReason disconnected_peer() {
+ long ret = bindings.ClosureReason_disconnected_peer();
+ if (ret < 1024) { return null; }
+ ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason
+ */
+ public static ClosureReason outdated_channel_manager() {
+ long ret = bindings.ClosureReason_outdated_channel_manager();
+ if (ret < 1024) { return null; }
+ ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read
+ */
+ public byte[] write() {
+ byte[] ret = bindings.ClosureReason_write(this.ptr);
+ return ret;
+ }
+
+}
/**
- * This class tracks the per-transaction information needed to build a commitment transaction and to
+ * This class tracks the per-transaction information needed to build a commitment transaction and will
* actually build it and sign. It is used for holder transactions that we sign only when needed
* and for transactions we sign for the counterparty.
*
* Applies a wrapper which allows access to these fields.
*
* This should only be used if you fully trust the builder of this object. It should not
- * \tbe used by an external signer - instead use the verify function.
+ * be used by an external signer - instead use the verify function.
*/
public TrustedCommitmentTransaction trust() {
long ret = bindings.CommitmentTransaction_trust(this.ptr);
if (ptr != 0) { bindings.CommitmentUpdate_free(ptr); }
}
+ /**
+ * update_add_htlc messages which should be sent
+ */
+ public UpdateAddHTLC[] get_update_add_htlcs() {
+ long[] ret = bindings.CommitmentUpdate_get_update_add_htlcs(this.ptr);
+ UpdateAddHTLC[] ret_conv_15_arr = new UpdateAddHTLC[ret.length];
+ for (int p = 0; p < ret.length; p++) {
+ long ret_conv_15 = ret[p];
+ UpdateAddHTLC ret_conv_15_hu_conv = new UpdateAddHTLC(null, ret_conv_15);
+ ret_conv_15_hu_conv.ptrs_to.add(this);
+ ret_conv_15_arr[p] = ret_conv_15_hu_conv;
+ }
+ return ret_conv_15_arr;
+ }
+
/**
* update_add_htlc messages which should be sent
*/
public void set_update_add_htlcs(UpdateAddHTLC[] val) {
bindings.CommitmentUpdate_set_update_add_htlcs(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_15 -> val_conv_15 == null ? 0 : val_conv_15.ptr & ~1).toArray() : null);
- /* TODO 2 UpdateAddHTLC */;
+ for (UpdateAddHTLC val_conv_15: val) { this.ptrs_to.add(val_conv_15); };
+ }
+
+ /**
+ * update_fulfill_htlc messages which should be sent
+ */
+ public UpdateFulfillHTLC[] get_update_fulfill_htlcs() {
+ long[] ret = bindings.CommitmentUpdate_get_update_fulfill_htlcs(this.ptr);
+ UpdateFulfillHTLC[] ret_conv_19_arr = new UpdateFulfillHTLC[ret.length];
+ for (int t = 0; t < ret.length; t++) {
+ long ret_conv_19 = ret[t];
+ UpdateFulfillHTLC ret_conv_19_hu_conv = new UpdateFulfillHTLC(null, ret_conv_19);
+ ret_conv_19_hu_conv.ptrs_to.add(this);
+ ret_conv_19_arr[t] = ret_conv_19_hu_conv;
+ }
+ return ret_conv_19_arr;
}
/**
*/
public void set_update_fulfill_htlcs(UpdateFulfillHTLC[] val) {
bindings.CommitmentUpdate_set_update_fulfill_htlcs(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_19 -> val_conv_19 == null ? 0 : val_conv_19.ptr & ~1).toArray() : null);
- /* TODO 2 UpdateFulfillHTLC */;
+ for (UpdateFulfillHTLC val_conv_19: val) { this.ptrs_to.add(val_conv_19); };
+ }
+
+ /**
+ * update_fail_htlc messages which should be sent
+ */
+ public UpdateFailHTLC[] get_update_fail_htlcs() {
+ long[] ret = bindings.CommitmentUpdate_get_update_fail_htlcs(this.ptr);
+ UpdateFailHTLC[] ret_conv_16_arr = new UpdateFailHTLC[ret.length];
+ for (int q = 0; q < ret.length; q++) {
+ long ret_conv_16 = ret[q];
+ UpdateFailHTLC ret_conv_16_hu_conv = new UpdateFailHTLC(null, ret_conv_16);
+ ret_conv_16_hu_conv.ptrs_to.add(this);
+ ret_conv_16_arr[q] = ret_conv_16_hu_conv;
+ }
+ return ret_conv_16_arr;
}
/**
*/
public void set_update_fail_htlcs(UpdateFailHTLC[] val) {
bindings.CommitmentUpdate_set_update_fail_htlcs(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_16 -> val_conv_16 == null ? 0 : val_conv_16.ptr & ~1).toArray() : null);
- /* TODO 2 UpdateFailHTLC */;
+ for (UpdateFailHTLC val_conv_16: val) { this.ptrs_to.add(val_conv_16); };
+ }
+
+ /**
+ * update_fail_malformed_htlc messages which should be sent
+ */
+ public UpdateFailMalformedHTLC[] get_update_fail_malformed_htlcs() {
+ long[] ret = bindings.CommitmentUpdate_get_update_fail_malformed_htlcs(this.ptr);
+ UpdateFailMalformedHTLC[] ret_conv_25_arr = new UpdateFailMalformedHTLC[ret.length];
+ for (int z = 0; z < ret.length; z++) {
+ long ret_conv_25 = ret[z];
+ UpdateFailMalformedHTLC ret_conv_25_hu_conv = new UpdateFailMalformedHTLC(null, ret_conv_25);
+ ret_conv_25_hu_conv.ptrs_to.add(this);
+ ret_conv_25_arr[z] = ret_conv_25_hu_conv;
+ }
+ return ret_conv_25_arr;
}
/**
*/
public void set_update_fail_malformed_htlcs(UpdateFailMalformedHTLC[] val) {
bindings.CommitmentUpdate_set_update_fail_malformed_htlcs(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_25 -> val_conv_25 == null ? 0 : val_conv_25.ptr & ~1).toArray() : null);
- /* TODO 2 UpdateFailMalformedHTLC */;
+ for (UpdateFailMalformedHTLC val_conv_25: val) { this.ptrs_to.add(val_conv_25); };
}
/**
if (ret < 1024) { return null; }
CommitmentUpdate ret_hu_conv = new CommitmentUpdate(null, ret);
ret_hu_conv.ptrs_to.add(ret_hu_conv);
- /* TODO 2 UpdateAddHTLC */;
- /* TODO 2 UpdateFulfillHTLC */;
- /* TODO 2 UpdateFailHTLC */;
- /* TODO 2 UpdateFailMalformedHTLC */;
+ for (UpdateAddHTLC update_add_htlcs_arg_conv_15: update_add_htlcs_arg) { ret_hu_conv.ptrs_to.add(update_add_htlcs_arg_conv_15); };
+ for (UpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19: update_fulfill_htlcs_arg) { ret_hu_conv.ptrs_to.add(update_fulfill_htlcs_arg_conv_19); };
+ for (UpdateFailHTLC update_fail_htlcs_arg_conv_16: update_fail_htlcs_arg) { ret_hu_conv.ptrs_to.add(update_fail_htlcs_arg_conv_16); };
+ for (UpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25: update_fail_malformed_htlcs_arg) { ret_hu_conv.ptrs_to.add(update_fail_malformed_htlcs_arg_conv_25); };
ret_hu_conv.ptrs_to.add(update_fee_arg);
ret_hu_conv.ptrs_to.add(commitment_signed_arg);
return ret_hu_conv;
*/
public void transactions_confirmed(byte[] header, TwoTuple<Long, byte[]>[] txdata, int height) {
bindings.Confirm_transactions_confirmed(this.ptr, header, txdata != null ? Arrays.stream(txdata).mapToLong(txdata_conv_24 -> bindings.C2Tuple_usizeTransactionZ_new(txdata_conv_24.a, txdata_conv_24.b)).toArray() : null, height);
- /* TODO 2 TwoTuple<Long, byte[]> */;
}
/**
--- /dev/null
+package org.ldk.structs;
+
+import org.ldk.impl.bindings;
+import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
+import javax.annotation.Nullable;
+
+
+/**
+ * Information needed for constructing an invoice route hint for this channel.
+ */
+@SuppressWarnings("unchecked") // We correctly assign various generic arrays
+public class CounterpartyForwardingInfo extends CommonBase {
+ CounterpartyForwardingInfo(Object _dummy, long ptr) { super(ptr); }
+ @Override @SuppressWarnings("deprecation")
+ protected void finalize() throws Throwable {
+ super.finalize();
+ if (ptr != 0) { bindings.CounterpartyForwardingInfo_free(ptr); }
+ }
+
+ /**
+ * Base routing fee in millisatoshis.
+ */
+ public int get_fee_base_msat() {
+ int ret = bindings.CounterpartyForwardingInfo_get_fee_base_msat(this.ptr);
+ return ret;
+ }
+
+ /**
+ * Base routing fee in millisatoshis.
+ */
+ public void set_fee_base_msat(int val) {
+ bindings.CounterpartyForwardingInfo_set_fee_base_msat(this.ptr, val);
+ }
+
+ /**
+ * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
+ */
+ public int get_fee_proportional_millionths() {
+ int ret = bindings.CounterpartyForwardingInfo_get_fee_proportional_millionths(this.ptr);
+ return ret;
+ }
+
+ /**
+ * Amount in millionths of a satoshi the channel will charge per transferred satoshi.
+ */
+ public void set_fee_proportional_millionths(int val) {
+ bindings.CounterpartyForwardingInfo_set_fee_proportional_millionths(this.ptr, val);
+ }
+
+ /**
+ * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
+ * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
+ * `cltv_expiry_delta` for more details.
+ */
+ public short get_cltv_expiry_delta() {
+ short ret = bindings.CounterpartyForwardingInfo_get_cltv_expiry_delta(this.ptr);
+ return ret;
+ }
+
+ /**
+ * The minimum difference in cltv_expiry between an ingoing HTLC and its outgoing counterpart,
+ * such that the outgoing HTLC is forwardable to this counterparty. See `msgs::ChannelUpdate`'s
+ * `cltv_expiry_delta` for more details.
+ */
+ public void set_cltv_expiry_delta(short val) {
+ bindings.CounterpartyForwardingInfo_set_cltv_expiry_delta(this.ptr, val);
+ }
+
+ /**
+ * Constructs a new CounterpartyForwardingInfo given each field
+ */
+ public static CounterpartyForwardingInfo of(int fee_base_msat_arg, int fee_proportional_millionths_arg, short cltv_expiry_delta_arg) {
+ long ret = bindings.CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
+ if (ret < 1024) { return null; }
+ CounterpartyForwardingInfo ret_hu_conv = new CounterpartyForwardingInfo(null, ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Creates a copy of the CounterpartyForwardingInfo
+ */
+ public CounterpartyForwardingInfo clone() {
+ long ret = bindings.CounterpartyForwardingInfo_clone(this.ptr);
+ if (ret < 1024) { return null; }
+ CounterpartyForwardingInfo ret_hu_conv = new CounterpartyForwardingInfo(null, ret);
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;
+ }
+
+}
--- /dev/null
+package org.ldk.structs;
+
+import org.ldk.impl.bindings;
+import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
+import javax.annotation.Nullable;
+
+/**
+ * Handler for BOLT1-compliant messages.
+ */
+@SuppressWarnings("unchecked") // We correctly assign various generic arrays
+public class CustomMessageHandler extends CommonBase {
+ final bindings.LDKCustomMessageHandler bindings_instance;
+ CustomMessageHandler(Object _dummy, long ptr) { super(ptr); bindings_instance = null; }
+ private CustomMessageHandler(bindings.LDKCustomMessageHandler arg, bindings.LDKCustomMessageReader CustomMessageReader) {
+ super(bindings.LDKCustomMessageHandler_new(arg, CustomMessageReader));
+ this.ptrs_to.add(arg);
+ this.ptrs_to.add(CustomMessageReader);
+ this.bindings_instance = arg;
+ }
+ @Override @SuppressWarnings("deprecation")
+ protected void finalize() throws Throwable {
+ if (ptr != 0) { bindings.CustomMessageHandler_free(ptr); } super.finalize();
+ }
+
+ public static interface CustomMessageHandlerInterface {
+ /**
+ * Called with the message type that was received and the buffer to be read.
+ * Can return a `MessageHandlingError` if the message could not be handled.
+ */
+ Result_NoneLightningErrorZ handle_custom_message(Type msg, byte[] sender_node_id);
+ /**
+ * Gets the list of pending messages which were generated by the custom message
+ * handler, clearing the list in the process. The first tuple element must
+ * correspond to the intended recipients node ids. If no connection to one of the
+ * specified node does not exist, the message is simply not sent to it.
+ */
+ TwoTuple<byte[], Type>[] get_and_clear_pending_msg();
+ }
+ private static class LDKCustomMessageHandlerHolder { CustomMessageHandler held; }
+ public static CustomMessageHandler new_impl(CustomMessageHandlerInterface arg, CustomMessageReader.CustomMessageReaderInterface CustomMessageReader_impl) {
+ final LDKCustomMessageHandlerHolder impl_holder = new LDKCustomMessageHandlerHolder();
+ impl_holder.held = new CustomMessageHandler(new bindings.LDKCustomMessageHandler() {
+ @Override public long handle_custom_message(long msg, byte[] sender_node_id) {
+ Type ret_hu_conv = new Type(null, msg);
+ ret_hu_conv.ptrs_to.add(this);
+ Result_NoneLightningErrorZ ret = arg.handle_custom_message(ret_hu_conv, sender_node_id);
+ long result = ret != null ? ret.ptr : 0;
+ return result;
+ }
+ @Override public long[] get_and_clear_pending_msg() {
+ TwoTuple<byte[], Type>[] ret = arg.get_and_clear_pending_msg();
+ long[] result = ret != null ? Arrays.stream(ret).mapToLong(ret_conv_24 -> bindings.C2Tuple_PublicKeyTypeZ_new(ret_conv_24.a, ret_conv_24.b == null ? 0 : ret_conv_24.b.ptr)).toArray() : null;
+ for (TwoTuple<byte[], Type> ret_conv_24: ret) { impl_holder.held.ptrs_to.add(ret_conv_24.b); };
+ return result;
+ }
+ }, CustomMessageReader.new_impl(CustomMessageReader_impl).bindings_instance);
+ return impl_holder.held;
+ }
+
+ /**
+ * Gets the underlying CustomMessageReader.
+ */
+ public CustomMessageReader get_custom_message_reader() {
+ CustomMessageReader res = new CustomMessageReader(null, bindings.LDKCustomMessageHandler_get_CustomMessageReader(this.ptr));
+ this.ptrs_to.add(res);
+ return res;
+ }
+
+ /**
+ * Called with the message type that was received and the buffer to be read.
+ * Can return a `MessageHandlingError` if the message could not be handled.
+ */
+ public Result_NoneLightningErrorZ handle_custom_message(Type msg, byte[] sender_node_id) {
+ long ret = bindings.CustomMessageHandler_handle_custom_message(this.ptr, msg == null ? 0 : msg.ptr, sender_node_id);
+ if (ret < 1024) { return null; }
+ Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
+ this.ptrs_to.add(msg);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Gets the list of pending messages which were generated by the custom message
+ * handler, clearing the list in the process. The first tuple element must
+ * correspond to the intended recipients node ids. If no connection to one of the
+ * specified node does not exist, the message is simply not sent to it.
+ */
+ public TwoTuple<byte[], Type>[] get_and_clear_pending_msg() {
+ long[] ret = bindings.CustomMessageHandler_get_and_clear_pending_msg(this.ptr);
+ TwoTuple<byte[], Type>[] ret_conv_24_arr = new TwoTuple[ret.length];
+ for (int y = 0; y < ret.length; y++) {
+ long ret_conv_24 = ret[y];
+ byte[] ret_conv_24_a = bindings.LDKC2Tuple_PublicKeyTypeZ_get_a(ret_conv_24);
+ long ret_conv_24_b = bindings.LDKC2Tuple_PublicKeyTypeZ_get_b(ret_conv_24);
+ Type ret_hu_conv = new Type(null, ret_conv_24_b);
+ ret_hu_conv.ptrs_to.add(this);;
+ TwoTuple<byte[], Type> ret_conv_24_conv = new TwoTuple<byte[], Type>(ret_conv_24_a, ret_hu_conv, () -> {
+ bindings.C2Tuple_PublicKeyTypeZ_free(ret_conv_24);
+ });
+ ret_hu_conv.ptrs_to.add(ret_conv_24_conv);
+ ret_conv_24_arr[y] = ret_conv_24_conv;
+ }
+ return ret_conv_24_arr;
+ }
+
+}
--- /dev/null
+package org.ldk.structs;
+
+import org.ldk.impl.bindings;
+import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
+import javax.annotation.Nullable;
+
+/**
+ * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers)
+ * decoders.
+ */
+@SuppressWarnings("unchecked") // We correctly assign various generic arrays
+public class CustomMessageReader extends CommonBase {
+ final bindings.LDKCustomMessageReader bindings_instance;
+ CustomMessageReader(Object _dummy, long ptr) { super(ptr); bindings_instance = null; }
+ private CustomMessageReader(bindings.LDKCustomMessageReader arg) {
+ super(bindings.LDKCustomMessageReader_new(arg));
+ this.ptrs_to.add(arg);
+ this.bindings_instance = arg;
+ }
+ @Override @SuppressWarnings("deprecation")
+ protected void finalize() throws Throwable {
+ if (ptr != 0) { bindings.CustomMessageReader_free(ptr); } super.finalize();
+ }
+
+ public static interface CustomMessageReaderInterface {
+ /**
+ * Decodes a custom message to `CustomMessageType`. If the given message type is known to the
+ * implementation and the message could be decoded, must return `Ok(Some(message))`. If the
+ * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error
+ * occur, must return `Err(DecodeError::X)` where `X` details the encountered error.
+ */
+ Result_COption_TypeZDecodeErrorZ read(short message_type, byte[] buffer);
+ }
+ private static class LDKCustomMessageReaderHolder { CustomMessageReader held; }
+ public static CustomMessageReader new_impl(CustomMessageReaderInterface arg) {
+ final LDKCustomMessageReaderHolder impl_holder = new LDKCustomMessageReaderHolder();
+ impl_holder.held = new CustomMessageReader(new bindings.LDKCustomMessageReader() {
+ @Override public long read(short message_type, byte[] buffer) {
+ Result_COption_TypeZDecodeErrorZ ret = arg.read(message_type, buffer);
+ long result = ret != null ? ret.ptr : 0;
+ return result;
+ }
+ });
+ return impl_holder.held;
+ }
+ /**
+ * Decodes a custom message to `CustomMessageType`. If the given message type is known to the
+ * implementation and the message could be decoded, must return `Ok(Some(message))`. If the
+ * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error
+ * occur, must return `Err(DecodeError::X)` where `X` details the encountered error.
+ */
+ public Result_COption_TypeZDecodeErrorZ read(short message_type, byte[] buffer) {
+ long ret = bindings.CustomMessageReader_read(this.ptr, message_type, buffer);
+ if (ret < 1024) { return null; }
+ Result_COption_TypeZDecodeErrorZ ret_hu_conv = Result_COption_TypeZDecodeErrorZ.constr_from_ptr(ret);
+ return ret_hu_conv;
+ }
+
+}
if (ptr != 0) { bindings.Description_free(ptr); }
}
- /**
- * Checks if two Descriptions contain equal inner contents.
- * This ignores pointers and is_owned flags and looks at the values in fields.
- * Two objects with NULL inner values will be considered "equal" here.
- */
- public boolean eq(Description b) {
- boolean ret = bindings.Description_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
- this.ptrs_to.add(b);
- return ret;
- }
-
/**
* Creates a copy of the Description
*/
return ret_hu_conv;
}
+ /**
+ * Checks if two Descriptions contain equal inner contents.
+ */
+ public long hash() {
+ long ret = bindings.Description_hash(this.ptr);
+ return ret;
+ }
+
+ /**
+ * Checks if two Descriptions contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+ public boolean eq(Description b) {
+ boolean ret = bindings.Description_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
+ this.ptrs_to.add(b);
+ return ret;
+ }
+
/**
* Creates a new `Description` if `description` is at most 1023 __bytes__ long,
* returns `CreationError::DescriptionTooLong` otherwise
if (raw_val.getClass() == bindings.LDKEvent.PaymentSent.class) {
return new PaymentSent(ptr, (bindings.LDKEvent.PaymentSent)raw_val);
}
- if (raw_val.getClass() == bindings.LDKEvent.PaymentFailed.class) {
- return new PaymentFailed(ptr, (bindings.LDKEvent.PaymentFailed)raw_val);
+ if (raw_val.getClass() == bindings.LDKEvent.PaymentPathFailed.class) {
+ return new PaymentPathFailed(ptr, (bindings.LDKEvent.PaymentPathFailed)raw_val);
}
if (raw_val.getClass() == bindings.LDKEvent.PendingHTLCsForwardable.class) {
return new PendingHTLCsForwardable(ptr, (bindings.LDKEvent.PendingHTLCsForwardable)raw_val);
if (raw_val.getClass() == bindings.LDKEvent.PaymentForwarded.class) {
return new PaymentForwarded(ptr, (bindings.LDKEvent.PaymentForwarded)raw_val);
}
+ if (raw_val.getClass() == bindings.LDKEvent.ChannelClosed.class) {
+ return new ChannelClosed(ptr, (bindings.LDKEvent.ChannelClosed)raw_val);
+ }
assert false; return null; // Unreachable without extending the (internal) bindings interface
}
this.payment_preimage = obj.payment_preimage;
}
}
- public final static class PaymentFailed extends Event {
+ public final static class PaymentPathFailed extends Event {
/**
* The hash which was given to ChannelManager::send_payment.
*/
* retry the payment via a different route.
*/
public final boolean rejected_by_dest;
- private PaymentFailed(long ptr, bindings.LDKEvent.PaymentFailed obj) {
+ /**
+ * Any failure information conveyed via the Onion return packet by a node along the failed
+ * payment route.
+ *
+ * Should be applied to the [`NetworkGraph`] so that routing decisions can take into
+ * account the update. [`NetGraphMsgHandler`] is capable of doing this.
+ *
+ * [`NetworkGraph`]: crate::routing::network_graph::NetworkGraph
+ * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler
+ */
+ public final Option_NetworkUpdateZ network_update;
+ /**
+ * For both single-path and multi-path payments, this is set if all paths of the payment have
+ * failed. This will be set to false if (1) this is an MPP payment and (2) other parts of the
+ * larger MPP payment were still in flight when this event was generated.
+ */
+ public final boolean all_paths_failed;
+ /**
+ * The payment path that failed.
+ */
+ public final RouteHop[] path;
+ private PaymentPathFailed(long ptr, bindings.LDKEvent.PaymentPathFailed obj) {
super(null, ptr);
this.payment_hash = obj.payment_hash;
this.rejected_by_dest = obj.rejected_by_dest;
+ long network_update = obj.network_update;
+ Option_NetworkUpdateZ network_update_hu_conv = Option_NetworkUpdateZ.constr_from_ptr(network_update);
+ network_update_hu_conv.ptrs_to.add(this);
+ this.network_update = network_update_hu_conv;
+ this.all_paths_failed = obj.all_paths_failed;
+ long[] path = obj.path;
+ RouteHop[] path_conv_10_arr = new RouteHop[path.length];
+ for (int k = 0; k < path.length; k++) {
+ long path_conv_10 = path[k];
+ RouteHop path_conv_10_hu_conv = new RouteHop(null, path_conv_10);
+ path_conv_10_hu_conv.ptrs_to.add(this);
+ path_conv_10_arr[k] = path_conv_10_hu_conv;
+ }
+ this.path = path_conv_10_arr;
}
}
public final static class PendingHTLCsForwardable extends Event {
this.claim_from_onchain_tx = obj.claim_from_onchain_tx;
}
}
+ public final static class ChannelClosed extends Event {
+ /**
+ * The channel_id of the channel which has been closed. Note that on-chain transactions
+ * resolving the channel are likely still awaiting confirmation.
+ */
+ public final byte[] channel_id;
+ /**
+ * The reason the channel was closed.
+ */
+ public final ClosureReason reason;
+ private ChannelClosed(long ptr, bindings.LDKEvent.ChannelClosed obj) {
+ super(null, ptr);
+ this.channel_id = obj.channel_id;
+ long reason = obj.reason;
+ ClosureReason reason_hu_conv = ClosureReason.constr_from_ptr(reason);
+ reason_hu_conv.ptrs_to.add(this);
+ this.reason = reason_hu_conv;
+ }
+ }
/**
* Creates a copy of the Event
*/
}
/**
- * Utility method to constructs a new PaymentFailed-variant Event
+ * Utility method to constructs a new PaymentPathFailed-variant Event
*/
- public static Event payment_failed(byte[] payment_hash, boolean rejected_by_dest) {
- long ret = bindings.Event_payment_failed(payment_hash, rejected_by_dest);
+ public static Event payment_path_failed(byte[] payment_hash, boolean rejected_by_dest, Option_NetworkUpdateZ network_update, boolean all_paths_failed, RouteHop[] path) {
+ long ret = bindings.Event_payment_path_failed(payment_hash, rejected_by_dest, network_update.ptr, all_paths_failed, path != null ? Arrays.stream(path).mapToLong(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr & ~1).toArray() : null);
if (ret < 1024) { return null; }
Event ret_hu_conv = Event.constr_from_ptr(ret);
ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ for (RouteHop path_conv_10: path) { ret_hu_conv.ptrs_to.add(path_conv_10); };
return ret_hu_conv;
}
if (ret < 1024) { return null; }
Event ret_hu_conv = Event.constr_from_ptr(ret);
ret_hu_conv.ptrs_to.add(ret_hu_conv);
- /* TODO 2 SpendableOutputDescriptor */;
return ret_hu_conv;
}
return ret_hu_conv;
}
+ /**
+ * Utility method to constructs a new ChannelClosed-variant Event
+ */
+ public static Event channel_closed(byte[] channel_id, ClosureReason reason) {
+ long ret = bindings.Event_channel_closed(channel_id, reason.ptr);
+ if (ret < 1024) { return null; }
+ Event ret_hu_conv = Event.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
/**
* Serialize the Event object into a byte array which can be read by Event_read
*/
impl_holder.held = new EventHandler(new bindings.LDKEventHandler() {
@Override public void handle_event(long event) {
Event event_hu_conv = Event.constr_from_ptr(event);
- event_hu_conv.ptrs_to.add(this);
arg.handle_event(event_hu_conv);
}
});
* See [`EventsProvider`] for details that must be considered when implementing this method.
*/
public void handle_event(Event event) {
- bindings.EventHandler_handle_event(this.ptr, event.ptr);
+ bindings.EventHandler_handle_event(this.ptr, event == null ? 0 : event.ptr & ~1);
+ this.ptrs_to.add(event);
}
}
if (ptr != 0) { bindings.ExpiryTime_free(ptr); }
}
- /**
- * Checks if two ExpiryTimes contain equal inner contents.
- * This ignores pointers and is_owned flags and looks at the values in fields.
- * Two objects with NULL inner values will be considered "equal" here.
- */
- public boolean eq(ExpiryTime b) {
- boolean ret = bindings.ExpiryTime_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
- this.ptrs_to.add(b);
- return ret;
- }
-
/**
* Creates a copy of the ExpiryTime
*/
return ret_hu_conv;
}
+ /**
+ * Checks if two ExpiryTimes contain equal inner contents.
+ */
+ public long hash() {
+ long ret = bindings.ExpiryTime_hash(this.ptr);
+ return ret;
+ }
+
+ /**
+ * Checks if two ExpiryTimes contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+ public boolean eq(ExpiryTime b) {
+ boolean ret = bindings.ExpiryTime_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
+ this.ptrs_to.add(b);
+ return ret;
+ }
+
/**
* Construct an `ExpiryTime` from seconds. If there exists a `PositiveTimestamp` which would
* overflow on adding the `EpiryTime` to it then this function will return a
return ret_hu_conv;
}
+ /**
+ * Checks if two Fallbacks contain equal inner contents.
+ */
+ public long hash() {
+ long ret = bindings.Fallback_hash(this.ptr);
+ return ret;
+ }
+
/**
* Checks if two Fallbacks contain equal inner contents.
* This ignores pointers and is_owned flags and looks at the values in fields.
}
/**
- * The signature of the channel initiator (funder) on the funding transaction
+ * The signature of the channel initiator (funder) on the initial commitment transaction
*/
public byte[] get_signature() {
byte[] ret = bindings.FundingCreated_get_signature(this.ptr);
}
/**
- * The signature of the channel initiator (funder) on the funding transaction
+ * The signature of the channel initiator (funder) on the initial commitment transaction
*/
public void set_signature(byte[] val) {
bindings.FundingCreated_set_signature(this.ptr, val);
}
/**
- * The signature of the channel acceptor (fundee) on the funding transaction
+ * The signature of the channel acceptor (fundee) on the initial commitment transaction
*/
public byte[] get_signature() {
byte[] ret = bindings.FundingSigned_get_signature(this.ptr);
}
/**
- * The signature of the channel acceptor (fundee) on the funding transaction
+ * The signature of the channel acceptor (fundee) on the initial commitment transaction
*/
public void set_signature(byte[] val) {
bindings.FundingSigned_set_signature(this.ptr, val);
return ret_hu_conv;
}
+ /**
+ * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
+ */
+ public byte[] write() {
+ byte[] ret = bindings.GossipTimestampFilter_write(this.ptr);
+ return ret;
+ }
+
/**
* Read a GossipTimestampFilter from a byte array, created by GossipTimestampFilter_write
*/
return ret_hu_conv;
}
- /**
- * Serialize the GossipTimestampFilter object into a byte array which can be read by GossipTimestampFilter_read
- */
- public byte[] write() {
- byte[] ret = bindings.GossipTimestampFilter_write(this.ptr);
- return ret;
- }
-
}
+++ /dev/null
-package org.ldk.structs;
-
-import org.ldk.impl.bindings;
-import org.ldk.enums.*;
-import org.ldk.util.*;
-import java.util.Arrays;
-import javax.annotation.Nullable;
-
-
-/**
- * The information we received from a peer along the route of a payment we originated. This is
- * returned by ChannelMessageHandler::handle_update_fail_htlc to be passed into
- * RoutingMessageHandler::handle_htlc_fail_channel_update to update our network map.
- */
-@SuppressWarnings("unchecked") // We correctly assign various generic arrays
-public class HTLCFailChannelUpdate extends CommonBase {
- private HTLCFailChannelUpdate(Object _dummy, long ptr) { super(ptr); }
- @Override @SuppressWarnings("deprecation")
- protected void finalize() throws Throwable {
- super.finalize();
- if (ptr != 0) { bindings.HTLCFailChannelUpdate_free(ptr); }
- }
- static HTLCFailChannelUpdate constr_from_ptr(long ptr) {
- bindings.LDKHTLCFailChannelUpdate raw_val = bindings.LDKHTLCFailChannelUpdate_ref_from_ptr(ptr);
- if (raw_val.getClass() == bindings.LDKHTLCFailChannelUpdate.ChannelUpdateMessage.class) {
- return new ChannelUpdateMessage(ptr, (bindings.LDKHTLCFailChannelUpdate.ChannelUpdateMessage)raw_val);
- }
- if (raw_val.getClass() == bindings.LDKHTLCFailChannelUpdate.ChannelClosed.class) {
- return new ChannelClosed(ptr, (bindings.LDKHTLCFailChannelUpdate.ChannelClosed)raw_val);
- }
- if (raw_val.getClass() == bindings.LDKHTLCFailChannelUpdate.NodeFailure.class) {
- return new NodeFailure(ptr, (bindings.LDKHTLCFailChannelUpdate.NodeFailure)raw_val);
- }
- assert false; return null; // Unreachable without extending the (internal) bindings interface
- }
-
- public final static class ChannelUpdateMessage extends HTLCFailChannelUpdate {
- /**
- * The unwrapped message we received
- */
- public final ChannelUpdate msg;
- private ChannelUpdateMessage(long ptr, bindings.LDKHTLCFailChannelUpdate.ChannelUpdateMessage obj) {
- super(null, ptr);
- long msg = obj.msg;
- ChannelUpdate msg_hu_conv = new ChannelUpdate(null, msg);
- msg_hu_conv.ptrs_to.add(this);
- this.msg = msg_hu_conv;
- }
- }
- public final static class ChannelClosed extends HTLCFailChannelUpdate {
- /**
- * The short_channel_id which has now closed.
- */
- public final long short_channel_id;
- /**
- * when this true, this channel should be permanently removed from the
- * consideration. Otherwise, this channel can be restored as new channel_update is received
- */
- public final boolean is_permanent;
- private ChannelClosed(long ptr, bindings.LDKHTLCFailChannelUpdate.ChannelClosed obj) {
- super(null, ptr);
- this.short_channel_id = obj.short_channel_id;
- this.is_permanent = obj.is_permanent;
- }
- }
- public final static class NodeFailure extends HTLCFailChannelUpdate {
- /**
- * The node_id that has failed.
- */
- public final byte[] node_id;
- /**
- * when this true, node should be permanently removed from the
- * consideration. Otherwise, the channels connected to this node can be
- * restored as new channel_update is received
- */
- public final boolean is_permanent;
- private NodeFailure(long ptr, bindings.LDKHTLCFailChannelUpdate.NodeFailure obj) {
- super(null, ptr);
- this.node_id = obj.node_id;
- this.is_permanent = obj.is_permanent;
- }
- }
- /**
- * Creates a copy of the HTLCFailChannelUpdate
- */
- public HTLCFailChannelUpdate clone() {
- long ret = bindings.HTLCFailChannelUpdate_clone(this.ptr);
- if (ret < 1024) { return null; }
- HTLCFailChannelUpdate ret_hu_conv = HTLCFailChannelUpdate.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(this);
- return ret_hu_conv;
- }
-
- /**
- * Utility method to constructs a new ChannelUpdateMessage-variant HTLCFailChannelUpdate
- */
- public static HTLCFailChannelUpdate channel_update_message(ChannelUpdate msg) {
- long ret = bindings.HTLCFailChannelUpdate_channel_update_message(msg == null ? 0 : msg.ptr & ~1);
- if (ret < 1024) { return null; }
- HTLCFailChannelUpdate ret_hu_conv = HTLCFailChannelUpdate.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
- ret_hu_conv.ptrs_to.add(msg);
- return ret_hu_conv;
- }
-
- /**
- * Utility method to constructs a new ChannelClosed-variant HTLCFailChannelUpdate
- */
- public static HTLCFailChannelUpdate channel_closed(long short_channel_id, boolean is_permanent) {
- long ret = bindings.HTLCFailChannelUpdate_channel_closed(short_channel_id, is_permanent);
- if (ret < 1024) { return null; }
- HTLCFailChannelUpdate ret_hu_conv = HTLCFailChannelUpdate.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
- return ret_hu_conv;
- }
-
- /**
- * Utility method to constructs a new NodeFailure-variant HTLCFailChannelUpdate
- */
- public static HTLCFailChannelUpdate node_failure(byte[] node_id, boolean is_permanent) {
- long ret = bindings.HTLCFailChannelUpdate_node_failure(node_id, is_permanent);
- if (ret < 1024) { return null; }
- HTLCFailChannelUpdate ret_hu_conv = HTLCFailChannelUpdate.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
- return ret_hu_conv;
- }
-
-}
return ret_hu_conv;
}
+ /**
+ * Constructs a new CustomMessageReader which calls the relevant methods on this_arg.
+ * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is
+ */
+ public CustomMessageReader as_CustomMessageReader() {
+ long ret = bindings.IgnoringMessageHandler_as_CustomMessageReader(this.ptr);
+ if (ret < 1024) { return null; }
+ CustomMessageReader ret_hu_conv = new CustomMessageReader(null, ret);
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Constructs a new CustomMessageHandler which calls the relevant methods on this_arg.
+ * This copies the `inner` pointer in this_arg and thus the returned CustomMessageHandler must be freed before this_arg is
+ */
+ public CustomMessageHandler as_CustomMessageHandler() {
+ long ret = bindings.IgnoringMessageHandler_as_CustomMessageHandler(this.ptr);
+ if (ret < 1024) { return null; }
+ CustomMessageHandler ret_hu_conv = new CustomMessageHandler(null, ret);
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;
+ }
+
}
return ret_hu_conv;
}
+ /**
+ * Returns true if this `Features` object contains unknown feature flags which are set as
+ * \"required\".
+ */
+ public boolean requires_unknown_bits() {
+ boolean ret = bindings.InitFeatures_requires_unknown_bits(this.ptr);
+ return ret;
+ }
+
/**
* Returns whether the `payment_secret` feature is supported.
*/
* ```
* use lightning_invoice::*;
*
- * let invoice = \"lnbc1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdp\\
- * \tl2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaq8rkx3yf5tcsyz3d7\\
- * \t3gafnh3cax9rn449d9p5uxz9ezhhypd0elx87sjle52x86fux2ypatgddc6k63n7erqz25le42c4u4ec\\
- * \tky03ylcqca784w\";
+ * let invoice = \"lnbc100p1psj9jhxdqud3jxktt5w46x7unfv9kz6mn0v3jsnp4q0d3p2sfluzdx45tqcs\\
+ * h2pu5qc7lgq0xs578ngs6s0s68ua4h7cvspp5q6rmq35js88zp5dvwrv9m459tnk2zunwj5jalqtyxqulh0l\\
+ * 5gflssp5nf55ny5gcrfl30xuhzj3nphgj27rstekmr9fw3ny5989s300gyus9qyysgqcqpcrzjqw2sxwe993\\
+ * h5pcm4dxzpvttgza8zhkqxpgffcrf5v25nwpr3cmfg7z54kuqq8rgqqqqqqqq2qqqqq9qq9qrzjqd0ylaqcl\\
+ * j9424x9m8h2vcukcgnm6s56xfgu3j78zyqzhgs4hlpzvznlugqq9vsqqqqqqqlgqqqqqeqq9qrzjqwldmj9d\\
+ * ha74df76zhx6l9we0vjdquygcdt3kssupehe64g6yyp5yz5rhuqqwccqqyqqqqlgqqqqjcqq9qrzjqf9e58a\\
+ * guqr0rcun0ajlvmzq3ek63cw2w282gv3z5uupmuwvgjtq2z55qsqqg6qqqyqqqrtnqqqzq3cqygrzjqvphms\\
+ * ywntrrhqjcraumvc4y6r8v4z5v593trte429v4hredj7ms5z52usqq9ngqqqqqqqlgqqqqqqgq9qrzjq2v0v\\
+ * p62g49p7569ev48cmulecsxe59lvaw3wlxm7r982zxa9zzj7z5l0cqqxusqqyqqqqlgqqqqqzsqygarl9fh3\\
+ * 8s0gyuxjjgux34w75dnc6xp2l35j7es3jd4ugt3lu0xzre26yg5m7ke54n2d5sym4xcmxtl8238xxvw5h5h5\\
+ * j5r6drg6k6zcqj0fcwg\";
*
* let signed = invoice.parse::<SignedRawInvoice>().unwrap();
*
/**
* Get the payment secret if one was included in the invoice
- *
- * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- @Nullable
public byte[] payment_secret() {
byte[] ret = bindings.Invoice_payment_secret(this.ptr);
return ret;
return ret_hu_conv;
}
+ /**
+ * Returns true if this `Features` object contains unknown feature flags which are set as
+ * \"required\".
+ */
+ public boolean requires_unknown_bits() {
+ boolean ret = bindings.InvoiceFeatures_requires_unknown_bits(this.ptr);
+ return ret;
+ }
+
/**
* Returns whether the `payment_secret` feature is supported.
*/
if (ptr != 0) { bindings.InvoiceSignature_free(ptr); }
}
- /**
- * Checks if two InvoiceSignatures contain equal inner contents.
- * This ignores pointers and is_owned flags and looks at the values in fields.
- * Two objects with NULL inner values will be considered "equal" here.
- */
- public boolean eq(InvoiceSignature b) {
- boolean ret = bindings.InvoiceSignature_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
- this.ptrs_to.add(b);
- return ret;
- }
-
/**
* Creates a copy of the InvoiceSignature
*/
return ret_hu_conv;
}
+ /**
+ * Checks if two InvoiceSignatures contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+ public boolean eq(InvoiceSignature b) {
+ boolean ret = bindings.InvoiceSignature_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
+ this.ptrs_to.add(b);
+ return ret;
+ }
+
}
long ret = bindings.KeysManager_spend_spendable_outputs(this.ptr, descriptors != null ? Arrays.stream(descriptors).mapToLong(descriptors_conv_27 -> descriptors_conv_27.ptr).toArray() : null, outputs != null ? Arrays.stream(outputs).mapToLong(outputs_conv_7 -> outputs_conv_7.ptr).toArray() : null, change_destination_script, feerate_sat_per_1000_weight);
if (ret < 1024) { return null; }
Result_TransactionNoneZ ret_hu_conv = Result_TransactionNoneZ.constr_from_ptr(ret);
- /* TODO 2 SpendableOutputDescriptor */;
- /* TODO 2 TxOut */;
return ret_hu_conv;
}
+++ /dev/null
-package org.ldk.structs;
-
-import org.ldk.impl.bindings;
-import org.ldk.enums.*;
-import org.ldk.util.*;
-import java.util.Arrays;
-import javax.annotation.Nullable;
-
-
-/**
- * A simple newtype for RwLockReadGuard<'a, NetworkGraph>.
- * This exists only to make accessing a RwLock<NetworkGraph> possible from
- * the C bindings, as it can be done directly in Rust code.
- */
-@SuppressWarnings("unchecked") // We correctly assign various generic arrays
-public class LockedNetworkGraph extends CommonBase implements AutoCloseable {
- LockedNetworkGraph(Object _dummy, long ptr) { super(ptr); }
- @Override public void close() {
- if (ptr != 0) { bindings.LockedNetworkGraph_free(ptr); }
- }
-
- /**
- * Get a reference to the NetworkGraph which this read-lock contains.
- */
- public NetworkGraph graph() {
- long ret = bindings.LockedNetworkGraph_graph(this.ptr);
- if (ret < 1024) { return null; }
- NetworkGraph ret_hu_conv = new NetworkGraph(null, ret);
- ret_hu_conv.ptrs_to.add(this);
- return ret_hu_conv;
- }
-
-}
if (raw_val.getClass() == bindings.LDKMessageSendEvent.HandleError.class) {
return new HandleError(ptr, (bindings.LDKMessageSendEvent.HandleError)raw_val);
}
- if (raw_val.getClass() == bindings.LDKMessageSendEvent.PaymentFailureNetworkUpdate.class) {
- return new PaymentFailureNetworkUpdate(ptr, (bindings.LDKMessageSendEvent.PaymentFailureNetworkUpdate)raw_val);
- }
if (raw_val.getClass() == bindings.LDKMessageSendEvent.SendChannelRangeQuery.class) {
return new SendChannelRangeQuery(ptr, (bindings.LDKMessageSendEvent.SendChannelRangeQuery)raw_val);
}
this.action = action_hu_conv;
}
}
- public final static class PaymentFailureNetworkUpdate extends MessageSendEvent {
- /**
- * The channel/node update which should be sent to NetGraphMsgHandler
- */
- public final HTLCFailChannelUpdate update;
- private PaymentFailureNetworkUpdate(long ptr, bindings.LDKMessageSendEvent.PaymentFailureNetworkUpdate obj) {
- super(null, ptr);
- long update = obj.update;
- HTLCFailChannelUpdate update_hu_conv = HTLCFailChannelUpdate.constr_from_ptr(update);
- update_hu_conv.ptrs_to.add(this);
- this.update = update_hu_conv;
- }
- }
public final static class SendChannelRangeQuery extends MessageSendEvent {
/**
* The node_id of this message recipient
return ret_hu_conv;
}
- /**
- * Utility method to constructs a new PaymentFailureNetworkUpdate-variant MessageSendEvent
- */
- public static MessageSendEvent payment_failure_network_update(HTLCFailChannelUpdate update) {
- long ret = bindings.MessageSendEvent_payment_failure_network_update(update.ptr);
- if (ret < 1024) { return null; }
- MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
- return ret_hu_conv;
- }
-
/**
* Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
*/
@Override public long[] get_and_clear_pending_msg_events() {
MessageSendEvent[] ret = arg.get_and_clear_pending_msg_events();
long[] result = ret != null ? Arrays.stream(ret).mapToLong(ret_conv_18 -> ret_conv_18.ptr).toArray() : null;
- /* TODO 2 MessageSendEvent */;
return result;
}
});
if (ptr != 0) { bindings.MinFinalCltvExpiry_free(ptr); }
}
- /**
- * Checks if two MinFinalCltvExpirys contain equal inner contents.
- * This ignores pointers and is_owned flags and looks at the values in fields.
- * Two objects with NULL inner values will be considered "equal" here.
- */
- public boolean eq(MinFinalCltvExpiry b) {
- boolean ret = bindings.MinFinalCltvExpiry_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
- this.ptrs_to.add(b);
- return ret;
- }
-
/**
* Creates a copy of the MinFinalCltvExpiry
*/
return ret_hu_conv;
}
+ /**
+ * Checks if two MinFinalCltvExpirys contain equal inner contents.
+ */
+ public long hash() {
+ long ret = bindings.MinFinalCltvExpiry_hash(this.ptr);
+ return ret;
+ }
+
+ /**
+ * Checks if two MinFinalCltvExpirys contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+ public boolean eq(MinFinalCltvExpiry b) {
+ boolean ret = bindings.MinFinalCltvExpiry_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
+ this.ptrs_to.add(b);
+ return ret;
+ }
+
}
if (raw_val.getClass() == bindings.LDKMonitorEvent.HTLCEvent.class) {
return new HTLCEvent(ptr, (bindings.LDKMonitorEvent.HTLCEvent)raw_val);
}
- if (raw_val.getClass() == bindings.LDKMonitorEvent.CommitmentTxBroadcasted.class) {
- return new CommitmentTxBroadcasted(ptr, (bindings.LDKMonitorEvent.CommitmentTxBroadcasted)raw_val);
+ if (raw_val.getClass() == bindings.LDKMonitorEvent.CommitmentTxConfirmed.class) {
+ return new CommitmentTxConfirmed(ptr, (bindings.LDKMonitorEvent.CommitmentTxConfirmed)raw_val);
}
assert false; return null; // Unreachable without extending the (internal) bindings interface
}
this.htlc_event = htlc_event_hu_conv;
}
}
- public final static class CommitmentTxBroadcasted extends MonitorEvent {
- public final OutPoint commitment_tx_broadcasted;
- private CommitmentTxBroadcasted(long ptr, bindings.LDKMonitorEvent.CommitmentTxBroadcasted obj) {
+ public final static class CommitmentTxConfirmed extends MonitorEvent {
+ public final OutPoint commitment_tx_confirmed;
+ private CommitmentTxConfirmed(long ptr, bindings.LDKMonitorEvent.CommitmentTxConfirmed obj) {
super(null, ptr);
- long commitment_tx_broadcasted = obj.commitment_tx_broadcasted;
- OutPoint commitment_tx_broadcasted_hu_conv = new OutPoint(null, commitment_tx_broadcasted);
- commitment_tx_broadcasted_hu_conv.ptrs_to.add(this);
- this.commitment_tx_broadcasted = commitment_tx_broadcasted_hu_conv;
+ long commitment_tx_confirmed = obj.commitment_tx_confirmed;
+ OutPoint commitment_tx_confirmed_hu_conv = new OutPoint(null, commitment_tx_confirmed);
+ commitment_tx_confirmed_hu_conv.ptrs_to.add(this);
+ this.commitment_tx_confirmed = commitment_tx_confirmed_hu_conv;
}
}
/**
}
/**
- * Utility method to constructs a new CommitmentTxBroadcasted-variant MonitorEvent
+ * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent
*/
- public static MonitorEvent commitment_tx_broadcasted(OutPoint a) {
- long ret = bindings.MonitorEvent_commitment_tx_broadcasted(a == null ? 0 : a.ptr & ~1);
+ public static MonitorEvent commitment_tx_confirmed(OutPoint a) {
+ long ret = bindings.MonitorEvent_commitment_tx_confirmed(a == null ? 0 : a.ptr & ~1);
if (ret < 1024) { return null; }
MonitorEvent ret_hu_conv = MonitorEvent.constr_from_ptr(ret);
ret_hu_conv.ptrs_to.add(ret_hu_conv);
* This network graph is then used for routing payments.
* Provides interface to help with initial routing sync by
* serving historical announcements.
+ *
+ * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the
+ * [`NetworkGraph`].
*/
@SuppressWarnings("unchecked") // We correctly assign various generic arrays
public class NetGraphMsgHandler extends CommonBase {
}
/**
- * Creates a new tracker of the actual state of the network of channels and nodes,
- * assuming a fresh network graph.
- * Chain monitor is used to make sure announced channels exist on-chain,
- * channel data is correct, and that the announcement is signed with
- * channel owners' keys.
- *
- * Note that chain_access (or a relevant inner pointer) may be NULL or all-0s to represent None
+ * Constructs a new EventHandler which calls the relevant methods on this_arg.
+ * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is
*/
- public static NetGraphMsgHandler of(byte[] genesis_hash, @Nullable Access chain_access, Logger logger) {
- long ret = bindings.NetGraphMsgHandler_new(genesis_hash, chain_access == null ? 0 : chain_access.ptr, logger == null ? 0 : logger.ptr);
+ public EventHandler as_EventHandler() {
+ long ret = bindings.NetGraphMsgHandler_as_EventHandler(this.ptr);
if (ret < 1024) { return null; }
- NetGraphMsgHandler ret_hu_conv = new NetGraphMsgHandler(null, ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
- ret_hu_conv.ptrs_to.add(chain_access);
- ret_hu_conv.ptrs_to.add(logger);
+ EventHandler ret_hu_conv = new EventHandler(null, ret);
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Representation of the payment channel network
+ */
+ public NetworkGraph get_network_graph() {
+ long ret = bindings.NetGraphMsgHandler_get_network_graph(this.ptr);
+ if (ret < 1024) { return null; }
+ NetworkGraph ret_hu_conv = new NetworkGraph(null, ret);
+ ret_hu_conv.ptrs_to.add(this);
return ret_hu_conv;
}
+ /**
+ * Representation of the payment channel network
+ */
+ public void set_network_graph(byte[] val_genesis_hash) {
+ bindings.NetGraphMsgHandler_set_network_graph(this.ptr, bindings.NetworkGraph_new(val_genesis_hash));
+ }
+
/**
* Creates a new tracker of the actual state of the network of channels and nodes,
* assuming an existing Network Graph.
- *
- * Note that chain_access (or a relevant inner pointer) may be NULL or all-0s to represent None
+ * Chain monitor is used to make sure announced channels exist on-chain,
+ * channel data is correct, and that the announcement is signed with
+ * channel owners' keys.
*/
- public static NetGraphMsgHandler from_net_graph(@Nullable Access chain_access, Logger logger, NetworkGraph network_graph) {
- long ret = bindings.NetGraphMsgHandler_from_net_graph(chain_access == null ? 0 : chain_access.ptr, logger == null ? 0 : logger.ptr, network_graph == null ? 0 : network_graph.ptr & ~1);
+ public static NetGraphMsgHandler of(byte[] network_graph_genesis_hash, Option_AccessZ chain_access, Logger logger) {
+ long ret = bindings.NetGraphMsgHandler_new(bindings.NetworkGraph_new(network_graph_genesis_hash), chain_access.ptr, logger == null ? 0 : logger.ptr);
if (ret < 1024) { return null; }
NetGraphMsgHandler ret_hu_conv = new NetGraphMsgHandler(null, ret);
ret_hu_conv.ptrs_to.add(ret_hu_conv);
- ret_hu_conv.ptrs_to.add(chain_access);
ret_hu_conv.ptrs_to.add(logger);
- ret_hu_conv.ptrs_to.add(network_graph);
return ret_hu_conv;
}
* Adds a provider used to check new announcements. Does not affect
* existing announcements unless they are updated.
* Add, update or remove the provider would replace the current one.
- *
- * Note that chain_access (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- public void add_chain_access(@Nullable Access chain_access) {
- bindings.NetGraphMsgHandler_add_chain_access(this.ptr, chain_access == null ? 0 : chain_access.ptr);
- this.ptrs_to.add(chain_access);
- }
-
- /**
- * Take a read lock on the network_graph and return it in the C-bindings
- * newtype helper. This is likely only useful when called via the C
- * bindings as you can call `self.network_graph.read().unwrap()` in Rust
- * yourself.
- */
- public LockedNetworkGraph read_locked_graph() {
- long ret = bindings.NetGraphMsgHandler_read_locked_graph(this.ptr);
- if (ret < 1024) { return null; }
- LockedNetworkGraph ret_hu_conv = new LockedNetworkGraph(null, ret);
- ret_hu_conv.ptrs_to.add(this);
- return ret_hu_conv;
+ public void add_chain_access(Option_AccessZ chain_access) {
+ bindings.NetGraphMsgHandler_add_chain_access(this.ptr, chain_access.ptr);
}
/**
if (ptr != 0) { bindings.NetworkGraph_free(ptr); }
}
- /**
- * Creates a copy of the NetworkGraph
- */
- public NetworkGraph clone() {
- long ret = bindings.NetworkGraph_clone(this.ptr);
- if (ret < 1024) { return null; }
- NetworkGraph ret_hu_conv = new NetworkGraph(null, ret);
- ret_hu_conv.ptrs_to.add(this);
- return ret_hu_conv;
- }
-
/**
* Serialize the NetworkGraph object into a byte array which can be read by NetworkGraph_read
*/
return ret_hu_conv;
}
+ /**
+ * Returns a read-only view of the network graph.
+ */
+ public ReadOnlyNetworkGraph read_only() {
+ long ret = bindings.NetworkGraph_read_only(this.ptr);
+ if (ret < 1024) { return null; }
+ ReadOnlyNetworkGraph ret_hu_conv = new ReadOnlyNetworkGraph(null, ret);
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;
+ }
+
/**
* For an already known node (from channel announcements), update its stored properties from a
* given node announcement.
*
* If a `chain::Access` object is provided via `chain_access`, it will be called to verify
* the corresponding UTXO exists on chain and is correctly-formatted.
- *
- * Note that chain_access (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- public Result_NoneLightningErrorZ update_channel_from_announcement(ChannelAnnouncement msg, @Nullable Access chain_access) {
- long ret = bindings.NetworkGraph_update_channel_from_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1, chain_access == null ? 0 : chain_access.ptr);
+ public Result_NoneLightningErrorZ update_channel_from_announcement(ChannelAnnouncement msg, Option_AccessZ chain_access) {
+ long ret = bindings.NetworkGraph_update_channel_from_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1, chain_access.ptr);
if (ret < 1024) { return null; }
Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
this.ptrs_to.add(msg);
- this.ptrs_to.add(chain_access);
return ret_hu_conv;
}
*
* If a `chain::Access` object is provided via `chain_access`, it will be called to verify
* the corresponding UTXO exists on chain and is correctly-formatted.
- *
- * Note that chain_access (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- public Result_NoneLightningErrorZ update_channel_from_unsigned_announcement(UnsignedChannelAnnouncement msg, @Nullable Access chain_access) {
- long ret = bindings.NetworkGraph_update_channel_from_unsigned_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1, chain_access == null ? 0 : chain_access.ptr);
+ public Result_NoneLightningErrorZ update_channel_from_unsigned_announcement(UnsignedChannelAnnouncement msg, Option_AccessZ chain_access) {
+ long ret = bindings.NetworkGraph_update_channel_from_unsigned_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1, chain_access.ptr);
if (ret < 1024) { return null; }
Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
this.ptrs_to.add(msg);
- this.ptrs_to.add(chain_access);
return ret_hu_conv;
}
bindings.NetworkGraph_close_channel_from_update(this.ptr, short_channel_id, is_permanent);
}
+ /**
+ * Marks a node in the graph as failed.
+ */
+ public void fail_node(byte[] _node_id, boolean is_permanent) {
+ bindings.NetworkGraph_fail_node(this.ptr, _node_id, is_permanent);
+ }
+
/**
* For an already known (from announcement) channel, update info about one of the directions
* of the channel.
--- /dev/null
+package org.ldk.structs;
+
+import org.ldk.impl.bindings;
+import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
+import javax.annotation.Nullable;
+
+
+/**
+ * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion
+ * return packet by a node along the route. See [BOLT #4] for details.
+ *
+ * [BOLT #4]: https://github.com/lightningnetwork/lightning-rfc/blob/master/04-onion-routing.md
+ */
+@SuppressWarnings("unchecked") // We correctly assign various generic arrays
+public class NetworkUpdate extends CommonBase {
+ private NetworkUpdate(Object _dummy, long ptr) { super(ptr); }
+ @Override @SuppressWarnings("deprecation")
+ protected void finalize() throws Throwable {
+ super.finalize();
+ if (ptr != 0) { bindings.NetworkUpdate_free(ptr); }
+ }
+ static NetworkUpdate constr_from_ptr(long ptr) {
+ bindings.LDKNetworkUpdate raw_val = bindings.LDKNetworkUpdate_ref_from_ptr(ptr);
+ if (raw_val.getClass() == bindings.LDKNetworkUpdate.ChannelUpdateMessage.class) {
+ return new ChannelUpdateMessage(ptr, (bindings.LDKNetworkUpdate.ChannelUpdateMessage)raw_val);
+ }
+ if (raw_val.getClass() == bindings.LDKNetworkUpdate.ChannelClosed.class) {
+ return new ChannelClosed(ptr, (bindings.LDKNetworkUpdate.ChannelClosed)raw_val);
+ }
+ if (raw_val.getClass() == bindings.LDKNetworkUpdate.NodeFailure.class) {
+ return new NodeFailure(ptr, (bindings.LDKNetworkUpdate.NodeFailure)raw_val);
+ }
+ assert false; return null; // Unreachable without extending the (internal) bindings interface
+ }
+
+ public final static class ChannelUpdateMessage extends NetworkUpdate {
+ /**
+ * The update to apply via [`NetworkGraph::update_channel`].
+ */
+ public final ChannelUpdate msg;
+ private ChannelUpdateMessage(long ptr, bindings.LDKNetworkUpdate.ChannelUpdateMessage obj) {
+ super(null, ptr);
+ long msg = obj.msg;
+ ChannelUpdate msg_hu_conv = new ChannelUpdate(null, msg);
+ msg_hu_conv.ptrs_to.add(this);
+ this.msg = msg_hu_conv;
+ }
+ }
+ public final static class ChannelClosed extends NetworkUpdate {
+ /**
+ * The short channel id of the closed channel.
+ */
+ public final long short_channel_id;
+ /**
+ * Whether the channel should be permanently removed or temporarily disabled until a new
+ * `channel_update` message is received.
+ */
+ public final boolean is_permanent;
+ private ChannelClosed(long ptr, bindings.LDKNetworkUpdate.ChannelClosed obj) {
+ super(null, ptr);
+ this.short_channel_id = obj.short_channel_id;
+ this.is_permanent = obj.is_permanent;
+ }
+ }
+ public final static class NodeFailure extends NetworkUpdate {
+ /**
+ * The node id of the failed node.
+ */
+ public final byte[] node_id;
+ /**
+ * Whether the node should be permanently removed from consideration or can be restored
+ * when a new `channel_update` message is received.
+ */
+ public final boolean is_permanent;
+ private NodeFailure(long ptr, bindings.LDKNetworkUpdate.NodeFailure obj) {
+ super(null, ptr);
+ this.node_id = obj.node_id;
+ this.is_permanent = obj.is_permanent;
+ }
+ }
+ /**
+ * Creates a copy of the NetworkUpdate
+ */
+ public NetworkUpdate clone() {
+ long ret = bindings.NetworkUpdate_clone(this.ptr);
+ if (ret < 1024) { return null; }
+ NetworkUpdate ret_hu_conv = NetworkUpdate.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new ChannelUpdateMessage-variant NetworkUpdate
+ */
+ public static NetworkUpdate channel_update_message(ChannelUpdate msg) {
+ long ret = bindings.NetworkUpdate_channel_update_message(msg == null ? 0 : msg.ptr & ~1);
+ if (ret < 1024) { return null; }
+ NetworkUpdate ret_hu_conv = NetworkUpdate.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ ret_hu_conv.ptrs_to.add(msg);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new ChannelClosed-variant NetworkUpdate
+ */
+ public static NetworkUpdate channel_closed(long short_channel_id, boolean is_permanent) {
+ long ret = bindings.NetworkUpdate_channel_closed(short_channel_id, is_permanent);
+ if (ret < 1024) { return null; }
+ NetworkUpdate ret_hu_conv = NetworkUpdate.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Utility method to constructs a new NodeFailure-variant NetworkUpdate
+ */
+ public static NetworkUpdate node_failure(byte[] node_id, boolean is_permanent) {
+ long ret = bindings.NetworkUpdate_node_failure(node_id, is_permanent);
+ if (ret < 1024) { return null; }
+ NetworkUpdate ret_hu_conv = NetworkUpdate.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Serialize the NetworkUpdate object into a byte array which can be read by NetworkUpdate_read
+ */
+ public byte[] write() {
+ byte[] ret = bindings.NetworkUpdate_write(this.ptr);
+ return ret;
+ }
+
+}
*/
public void set_addresses(NetAddress[] val) {
bindings.NodeAnnouncementInfo_set_addresses(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_12 -> val_conv_12.ptr).toArray() : null);
- /* TODO 2 NetAddress */;
}
/**
NodeAnnouncementInfo ret_hu_conv = new NodeAnnouncementInfo(null, ret);
ret_hu_conv.ptrs_to.add(ret_hu_conv);
ret_hu_conv.ptrs_to.add(features_arg);
- /* TODO 2 NetAddress */;
ret_hu_conv.ptrs_to.add(announcement_message_arg);
return ret_hu_conv;
}
return ret_hu_conv;
}
+ /**
+ * Returns true if this `Features` object contains unknown feature flags which are set as
+ * \"required\".
+ */
+ public boolean requires_unknown_bits() {
+ boolean ret = bindings.NodeFeatures_requires_unknown_bits(this.ptr);
+ return ret;
+ }
+
/**
* Returns whether the `payment_secret` feature is supported.
*/
--- /dev/null
+package org.ldk.structs;
+
+import org.ldk.impl.bindings;
+import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
+import javax.annotation.Nullable;
+
+
+/**
+ * An enum which can either contain a crate::lightning::chain::Access or not
+ */
+@SuppressWarnings("unchecked") // We correctly assign various generic arrays
+public class Option_AccessZ extends CommonBase {
+ private Option_AccessZ(Object _dummy, long ptr) { super(ptr); }
+ @Override @SuppressWarnings("deprecation")
+ protected void finalize() throws Throwable {
+ super.finalize();
+ if (ptr != 0) { bindings.COption_AccessZ_free(ptr); }
+ }
+ static Option_AccessZ constr_from_ptr(long ptr) {
+ bindings.LDKCOption_AccessZ raw_val = bindings.LDKCOption_AccessZ_ref_from_ptr(ptr);
+ if (raw_val.getClass() == bindings.LDKCOption_AccessZ.Some.class) {
+ return new Some(ptr, (bindings.LDKCOption_AccessZ.Some)raw_val);
+ }
+ if (raw_val.getClass() == bindings.LDKCOption_AccessZ.None.class) {
+ return new None(ptr, (bindings.LDKCOption_AccessZ.None)raw_val);
+ }
+ assert false; return null; // Unreachable without extending the (internal) bindings interface
+ }
+
+ public final static class Some extends Option_AccessZ {
+ public final Access some;
+ private Some(long ptr, bindings.LDKCOption_AccessZ.Some obj) {
+ super(null, ptr);
+ long some = obj.some;
+ Access ret_hu_conv = new Access(null, some);
+ ret_hu_conv.ptrs_to.add(this);
+ this.some = ret_hu_conv;
+ }
+ }
+ public final static class None extends Option_AccessZ {
+ private None(long ptr, bindings.LDKCOption_AccessZ.None obj) {
+ super(null, ptr);
+ }
+ }
+ /**
+ * Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
+ */
+ public static Option_AccessZ some(Access o) {
+ long ret = bindings.COption_AccessZ_some(o == null ? 0 : o.ptr);
+ if (ret < 1024) { return null; }
+ Option_AccessZ ret_hu_conv = Option_AccessZ.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ ret_hu_conv.ptrs_to.add(o);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Constructs a new COption_AccessZ containing nothing
+ */
+ public static Option_AccessZ none() {
+ long ret = bindings.COption_AccessZ_none();
+ if (ret < 1024) { return null; }
+ Option_AccessZ ret_hu_conv = Option_AccessZ.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+}
--- /dev/null
+package org.ldk.structs;
+
+import org.ldk.impl.bindings;
+import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
+import javax.annotation.Nullable;
+
+
+/**
+ * An enum which can either contain a crate::lightning::chain::Filter or not
+ */
+@SuppressWarnings("unchecked") // We correctly assign various generic arrays
+public class Option_FilterZ extends CommonBase {
+ private Option_FilterZ(Object _dummy, long ptr) { super(ptr); }
+ @Override @SuppressWarnings("deprecation")
+ protected void finalize() throws Throwable {
+ super.finalize();
+ if (ptr != 0) { bindings.COption_FilterZ_free(ptr); }
+ }
+ static Option_FilterZ constr_from_ptr(long ptr) {
+ bindings.LDKCOption_FilterZ raw_val = bindings.LDKCOption_FilterZ_ref_from_ptr(ptr);
+ if (raw_val.getClass() == bindings.LDKCOption_FilterZ.Some.class) {
+ return new Some(ptr, (bindings.LDKCOption_FilterZ.Some)raw_val);
+ }
+ if (raw_val.getClass() == bindings.LDKCOption_FilterZ.None.class) {
+ return new None(ptr, (bindings.LDKCOption_FilterZ.None)raw_val);
+ }
+ assert false; return null; // Unreachable without extending the (internal) bindings interface
+ }
+
+ public final static class Some extends Option_FilterZ {
+ public final Filter some;
+ private Some(long ptr, bindings.LDKCOption_FilterZ.Some obj) {
+ super(null, ptr);
+ long some = obj.some;
+ Filter ret_hu_conv = new Filter(null, some);
+ ret_hu_conv.ptrs_to.add(this);
+ this.some = ret_hu_conv;
+ }
+ }
+ public final static class None extends Option_FilterZ {
+ private None(long ptr, bindings.LDKCOption_FilterZ.None obj) {
+ super(null, ptr);
+ }
+ }
+ /**
+ * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
+ */
+ public static Option_FilterZ some(Filter o) {
+ long ret = bindings.COption_FilterZ_some(o == null ? 0 : o.ptr);
+ if (ret < 1024) { return null; }
+ Option_FilterZ ret_hu_conv = Option_FilterZ.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ ret_hu_conv.ptrs_to.add(o);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Constructs a new COption_FilterZ containing nothing
+ */
+ public static Option_FilterZ none() {
+ long ret = bindings.COption_FilterZ_none();
+ if (ret < 1024) { return null; }
+ Option_FilterZ ret_hu_conv = Option_FilterZ.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+}
--- /dev/null
+package org.ldk.structs;
+
+import org.ldk.impl.bindings;
+import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
+import javax.annotation.Nullable;
+
+
+/**
+ * An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not
+ */
+@SuppressWarnings("unchecked") // We correctly assign various generic arrays
+public class Option_NetworkUpdateZ extends CommonBase {
+ private Option_NetworkUpdateZ(Object _dummy, long ptr) { super(ptr); }
+ @Override @SuppressWarnings("deprecation")
+ protected void finalize() throws Throwable {
+ super.finalize();
+ if (ptr != 0) { bindings.COption_NetworkUpdateZ_free(ptr); }
+ }
+ static Option_NetworkUpdateZ constr_from_ptr(long ptr) {
+ bindings.LDKCOption_NetworkUpdateZ raw_val = bindings.LDKCOption_NetworkUpdateZ_ref_from_ptr(ptr);
+ if (raw_val.getClass() == bindings.LDKCOption_NetworkUpdateZ.Some.class) {
+ return new Some(ptr, (bindings.LDKCOption_NetworkUpdateZ.Some)raw_val);
+ }
+ if (raw_val.getClass() == bindings.LDKCOption_NetworkUpdateZ.None.class) {
+ return new None(ptr, (bindings.LDKCOption_NetworkUpdateZ.None)raw_val);
+ }
+ assert false; return null; // Unreachable without extending the (internal) bindings interface
+ }
+
+ public final static class Some extends Option_NetworkUpdateZ {
+ public final NetworkUpdate some;
+ private Some(long ptr, bindings.LDKCOption_NetworkUpdateZ.Some obj) {
+ super(null, ptr);
+ long some = obj.some;
+ NetworkUpdate some_hu_conv = NetworkUpdate.constr_from_ptr(some);
+ some_hu_conv.ptrs_to.add(this);
+ this.some = some_hu_conv;
+ }
+ }
+ public final static class None extends Option_NetworkUpdateZ {
+ private None(long ptr, bindings.LDKCOption_NetworkUpdateZ.None obj) {
+ super(null, ptr);
+ }
+ }
+ /**
+ * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
+ */
+ public static Option_NetworkUpdateZ some(NetworkUpdate o) {
+ long ret = bindings.COption_NetworkUpdateZ_some(o.ptr);
+ if (ret < 1024) { return null; }
+ Option_NetworkUpdateZ ret_hu_conv = Option_NetworkUpdateZ.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Constructs a new COption_NetworkUpdateZ containing nothing
+ */
+ public static Option_NetworkUpdateZ none() {
+ long ret = bindings.COption_NetworkUpdateZ_none();
+ if (ret < 1024) { return null; }
+ Option_NetworkUpdateZ ret_hu_conv = Option_NetworkUpdateZ.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Creates a new COption_NetworkUpdateZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+ public Option_NetworkUpdateZ clone() {
+ long ret = bindings.COption_NetworkUpdateZ_clone(this.ptr);
+ if (ret < 1024) { return null; }
+ Option_NetworkUpdateZ ret_hu_conv = Option_NetworkUpdateZ.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;
+ }
+
+}
--- /dev/null
+package org.ldk.structs;
+
+import org.ldk.impl.bindings;
+import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
+import javax.annotation.Nullable;
+
+
+/**
+ * An enum which can either contain a crate::lightning::ln::wire::Type or not
+ */
+@SuppressWarnings("unchecked") // We correctly assign various generic arrays
+public class Option_TypeZ extends CommonBase {
+ private Option_TypeZ(Object _dummy, long ptr) { super(ptr); }
+ @Override @SuppressWarnings("deprecation")
+ protected void finalize() throws Throwable {
+ super.finalize();
+ if (ptr != 0) { bindings.COption_TypeZ_free(ptr); }
+ }
+ static Option_TypeZ constr_from_ptr(long ptr) {
+ bindings.LDKCOption_TypeZ raw_val = bindings.LDKCOption_TypeZ_ref_from_ptr(ptr);
+ if (raw_val.getClass() == bindings.LDKCOption_TypeZ.Some.class) {
+ return new Some(ptr, (bindings.LDKCOption_TypeZ.Some)raw_val);
+ }
+ if (raw_val.getClass() == bindings.LDKCOption_TypeZ.None.class) {
+ return new None(ptr, (bindings.LDKCOption_TypeZ.None)raw_val);
+ }
+ assert false; return null; // Unreachable without extending the (internal) bindings interface
+ }
+
+ public final static class Some extends Option_TypeZ {
+ public final Type some;
+ private Some(long ptr, bindings.LDKCOption_TypeZ.Some obj) {
+ super(null, ptr);
+ long some = obj.some;
+ Type ret_hu_conv = new Type(null, some);
+ ret_hu_conv.ptrs_to.add(this);
+ this.some = ret_hu_conv;
+ }
+ }
+ public final static class None extends Option_TypeZ {
+ private None(long ptr, bindings.LDKCOption_TypeZ.None obj) {
+ super(null, ptr);
+ }
+ }
+ /**
+ * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
+ */
+ public static Option_TypeZ some(Type o) {
+ long ret = bindings.COption_TypeZ_some(o == null ? 0 : o.ptr);
+ if (ret < 1024) { return null; }
+ Option_TypeZ ret_hu_conv = Option_TypeZ.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ ret_hu_conv.ptrs_to.add(o);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Constructs a new COption_TypeZ containing nothing
+ */
+ public static Option_TypeZ none() {
+ long ret = bindings.COption_TypeZ_none();
+ if (ret < 1024) { return null; }
+ Option_TypeZ ret_hu_conv = Option_TypeZ.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Creates a new COption_TypeZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+ public Option_TypeZ clone() {
+ long ret = bindings.COption_TypeZ_clone(this.ptr);
+ if (ret < 1024) { return null; }
+ Option_TypeZ ret_hu_conv = Option_TypeZ.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;
+ }
+
+}
if (ptr != 0) { bindings.PayeePubKey_free(ptr); }
}
- /**
- * Checks if two PayeePubKeys contain equal inner contents.
- * This ignores pointers and is_owned flags and looks at the values in fields.
- * Two objects with NULL inner values will be considered "equal" here.
- */
- public boolean eq(PayeePubKey b) {
- boolean ret = bindings.PayeePubKey_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
- this.ptrs_to.add(b);
- return ret;
- }
-
/**
* Creates a copy of the PayeePubKey
*/
return ret_hu_conv;
}
+ /**
+ * Checks if two PayeePubKeys contain equal inner contents.
+ */
+ public long hash() {
+ long ret = bindings.PayeePubKey_hash(this.ptr);
+ return ret;
+ }
+
+ /**
+ * Checks if two PayeePubKeys contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+ public boolean eq(PayeePubKey b) {
+ boolean ret = bindings.PayeePubKey_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
+ this.ptrs_to.add(b);
+ return ret;
+ }
+
}
if (ret < 1024) { return null; }
PaymentSendFailure ret_hu_conv = PaymentSendFailure.constr_from_ptr(ret);
ret_hu_conv.ptrs_to.add(ret_hu_conv);
- /* TODO 2 Result_NoneAPIErrorZ */;
return ret_hu_conv;
}
if (ret < 1024) { return null; }
PaymentSendFailure ret_hu_conv = PaymentSendFailure.constr_from_ptr(ret);
ret_hu_conv.ptrs_to.add(ret_hu_conv);
- /* TODO 2 APIError */;
return ret_hu_conv;
}
if (ret < 1024) { return null; }
PaymentSendFailure ret_hu_conv = PaymentSendFailure.constr_from_ptr(ret);
ret_hu_conv.ptrs_to.add(ret_hu_conv);
- /* TODO 2 Result_NoneAPIErrorZ */;
return ret_hu_conv;
}
* ephemeral_random_data is used to derive per-connection ephemeral keys and must be
* cryptographically secure random bytes.
*/
- public static PeerManager of(ChannelMessageHandler message_handler_chan_handler_arg, RoutingMessageHandler message_handler_route_handler_arg, byte[] our_node_secret, byte[] ephemeral_random_data, Logger logger) {
- long ret = bindings.PeerManager_new(bindings.MessageHandler_new(message_handler_chan_handler_arg == null ? 0 : message_handler_chan_handler_arg.ptr, message_handler_route_handler_arg == null ? 0 : message_handler_route_handler_arg.ptr), our_node_secret, ephemeral_random_data, logger == null ? 0 : logger.ptr);
+ public static PeerManager of(ChannelMessageHandler message_handler_chan_handler_arg, RoutingMessageHandler message_handler_route_handler_arg, byte[] our_node_secret, byte[] ephemeral_random_data, Logger logger, CustomMessageHandler custom_message_handler) {
+ long ret = bindings.PeerManager_new(bindings.MessageHandler_new(message_handler_chan_handler_arg == null ? 0 : message_handler_chan_handler_arg.ptr, message_handler_route_handler_arg == null ? 0 : message_handler_route_handler_arg.ptr), our_node_secret, ephemeral_random_data, logger == null ? 0 : logger.ptr, custom_message_handler == null ? 0 : custom_message_handler.ptr);
if (ret < 1024) { return null; }
PeerManager ret_hu_conv = new PeerManager(null, ret);
ret_hu_conv.ptrs_to.add(ret_hu_conv);
ret_hu_conv.ptrs_to.add(message_handler_chan_handler_arg);
ret_hu_conv.ptrs_to.add(message_handler_route_handler_arg);
ret_hu_conv.ptrs_to.add(logger);
+ ret_hu_conv.ptrs_to.add(custom_message_handler);
return ret_hu_conv;
}
* May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy
* issues!
*
+ * You don't have to call this function explicitly if you are using [`lightning-net-tokio`]
+ * or one of the other clients provided in our language bindings.
+ *
* [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
* [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
* [`send_data`]: SocketDescriptor::send_data
if (ptr != 0) { bindings.PrivateRoute_free(ptr); }
}
- /**
- * Checks if two PrivateRoutes contain equal inner contents.
- * This ignores pointers and is_owned flags and looks at the values in fields.
- * Two objects with NULL inner values will be considered "equal" here.
- */
- public boolean eq(PrivateRoute b) {
- boolean ret = bindings.PrivateRoute_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
- this.ptrs_to.add(b);
- return ret;
- }
-
/**
* Creates a copy of the PrivateRoute
*/
return ret_hu_conv;
}
+ /**
+ * Checks if two PrivateRoutes contain equal inner contents.
+ */
+ public long hash() {
+ long ret = bindings.PrivateRoute_hash(this.ptr);
+ return ret;
+ }
+
+ /**
+ * Checks if two PrivateRoutes contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+ public boolean eq(PrivateRoute b) {
+ boolean ret = bindings.PrivateRoute_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
+ this.ptrs_to.add(b);
+ return ret;
+ }
+
/**
* Creates a new (partial) route from a list of hops
*/
return ret;
}
+ /**
+ * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
+ */
+ public byte[] write() {
+ byte[] ret = bindings.QueryChannelRange_write(this.ptr);
+ return ret;
+ }
+
/**
* Read a QueryChannelRange from a byte array, created by QueryChannelRange_write
*/
return ret_hu_conv;
}
- /**
- * Serialize the QueryChannelRange object into a byte array which can be read by QueryChannelRange_read
- */
- public byte[] write() {
- byte[] ret = bindings.QueryChannelRange_write(this.ptr);
- return ret;
- }
-
}
--- /dev/null
+package org.ldk.structs;
+
+import org.ldk.impl.bindings;
+import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
+import javax.annotation.Nullable;
+
+
+/**
+ * A read-only view of [`NetworkGraph`].
+ */
+@SuppressWarnings("unchecked") // We correctly assign various generic arrays
+public class ReadOnlyNetworkGraph extends CommonBase {
+ ReadOnlyNetworkGraph(Object _dummy, long ptr) { super(ptr); }
+ @Override @SuppressWarnings("deprecation")
+ protected void finalize() throws Throwable {
+ super.finalize();
+ if (ptr != 0) { bindings.ReadOnlyNetworkGraph_free(ptr); }
+ }
+
+}
return ret_hu_conv;
}
+ /**
+ * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
+ */
+ public byte[] write() {
+ byte[] ret = bindings.ReplyShortChannelIdsEnd_write(this.ptr);
+ return ret;
+ }
+
/**
* Read a ReplyShortChannelIdsEnd from a byte array, created by ReplyShortChannelIdsEnd_write
*/
return ret_hu_conv;
}
- /**
- * Serialize the ReplyShortChannelIdsEnd object into a byte array which can be read by ReplyShortChannelIdsEnd_read
- */
- public byte[] write() {
- byte[] ret = bindings.ReplyShortChannelIdsEnd_write(this.ptr);
- return ret;
- }
-
}
--- /dev/null
+package org.ldk.structs;
+
+import org.ldk.impl.bindings;
+import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
+import javax.annotation.Nullable;
+
+public class Result_COption_TypeZDecodeErrorZ extends CommonBase {
+ private Result_COption_TypeZDecodeErrorZ(Object _dummy, long ptr) { super(ptr); }
+ protected void finalize() throws Throwable {
+ if (ptr != 0) { bindings.CResult_COption_TypeZDecodeErrorZ_free(ptr); } super.finalize();
+ }
+
+ static Result_COption_TypeZDecodeErrorZ constr_from_ptr(long ptr) {
+ if (bindings.LDKCResult_COption_TypeZDecodeErrorZ_result_ok(ptr)) {
+ return new Result_COption_TypeZDecodeErrorZ_OK(null, ptr);
+ } else {
+ return new Result_COption_TypeZDecodeErrorZ_Err(null, ptr);
+ }
+ }
+ public static final class Result_COption_TypeZDecodeErrorZ_OK extends Result_COption_TypeZDecodeErrorZ {
+ public final Option_TypeZ res;
+ private Result_COption_TypeZDecodeErrorZ_OK(Object _dummy, long ptr) {
+ super(_dummy, ptr);
+ long res = bindings.LDKCResult_COption_TypeZDecodeErrorZ_get_ok(ptr);
+ Option_TypeZ res_hu_conv = Option_TypeZ.constr_from_ptr(res);
+ res_hu_conv.ptrs_to.add(this);
+ this.res = res_hu_conv;
+ }
+ }
+
+ public static final class Result_COption_TypeZDecodeErrorZ_Err extends Result_COption_TypeZDecodeErrorZ {
+ public final DecodeError err;
+ private Result_COption_TypeZDecodeErrorZ_Err(Object _dummy, long ptr) {
+ super(_dummy, ptr);
+ long err = bindings.LDKCResult_COption_TypeZDecodeErrorZ_get_err(ptr);
+ DecodeError err_hu_conv = new DecodeError(null, err);
+ err_hu_conv.ptrs_to.add(this);
+ this.err = err_hu_conv;
+ }
+ }
+
+ /**
+ * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
+ */
+ public static Result_COption_TypeZDecodeErrorZ ok(Option_TypeZ o) {
+ long ret = bindings.CResult_COption_TypeZDecodeErrorZ_ok(o.ptr);
+ if (ret < 1024) { return null; }
+ Result_COption_TypeZDecodeErrorZ ret_hu_conv = Result_COption_TypeZDecodeErrorZ.constr_from_ptr(ret);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
+ */
+ public static Result_COption_TypeZDecodeErrorZ err(DecodeError e) {
+ long ret = bindings.CResult_COption_TypeZDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1);
+ if (ret < 1024) { return null; }
+ Result_COption_TypeZDecodeErrorZ ret_hu_conv = Result_COption_TypeZDecodeErrorZ.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(e);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Creates a new CResult_COption_TypeZDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+ public Result_COption_TypeZDecodeErrorZ clone() {
+ long ret = bindings.CResult_COption_TypeZDecodeErrorZ_clone(this.ptr);
+ if (ret < 1024) { return null; }
+ Result_COption_TypeZDecodeErrorZ ret_hu_conv = Result_COption_TypeZDecodeErrorZ.constr_from_ptr(ret);
+ return ret_hu_conv;
+ }
+
+}
long ret = bindings.CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o != null ? Arrays.stream(o).mapToLong(o_conv_34 -> bindings.C2Tuple_BlockHashChannelMonitorZ_new(o_conv_34.a, o_conv_34.b == null ? 0 : o_conv_34.b.ptr & ~1)).toArray() : null);
if (ret < 1024) { return null; }
Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ ret_hu_conv = Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.constr_from_ptr(ret);
- /* TODO 2 TwoTuple<byte[], ChannelMonitor> */;
+ for (TwoTuple<byte[], ChannelMonitor> o_conv_34: o) { ret_hu_conv.ptrs_to.add(o_conv_34.b); };
return ret_hu_conv;
}
/**
* Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
*/
- public static Result_NetworkGraphDecodeErrorZ ok(NetworkGraph o) {
- long ret = bindings.CResult_NetworkGraphDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1);
+ public static Result_NetworkGraphDecodeErrorZ ok(byte[] o_genesis_hash) {
+ long ret = bindings.CResult_NetworkGraphDecodeErrorZ_ok(bindings.NetworkGraph_new(o_genesis_hash));
if (ret < 1024) { return null; }
Result_NetworkGraphDecodeErrorZ ret_hu_conv = Result_NetworkGraphDecodeErrorZ.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(o);
return ret_hu_conv;
}
return ret_hu_conv;
}
- /**
- * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
- */
- public Result_NetworkGraphDecodeErrorZ clone() {
- long ret = bindings.CResult_NetworkGraphDecodeErrorZ_clone(this.ptr);
- if (ret < 1024) { return null; }
- Result_NetworkGraphDecodeErrorZ ret_hu_conv = Result_NetworkGraphDecodeErrorZ.constr_from_ptr(ret);
- return ret_hu_conv;
- }
-
}
--- /dev/null
+package org.ldk.structs;
+
+import org.ldk.impl.bindings;
+import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
+import javax.annotation.Nullable;
+
+public class Result_NoneNoneZ extends CommonBase {
+ private Result_NoneNoneZ(Object _dummy, long ptr) { super(ptr); }
+ protected void finalize() throws Throwable {
+ if (ptr != 0) { bindings.CResult_NoneNoneZ_free(ptr); } super.finalize();
+ }
+
+ static Result_NoneNoneZ constr_from_ptr(long ptr) {
+ if (bindings.LDKCResult_NoneNoneZ_result_ok(ptr)) {
+ return new Result_NoneNoneZ_OK(null, ptr);
+ } else {
+ return new Result_NoneNoneZ_Err(null, ptr);
+ }
+ }
+ public static final class Result_NoneNoneZ_OK extends Result_NoneNoneZ {
+ private Result_NoneNoneZ_OK(Object _dummy, long ptr) {
+ super(_dummy, ptr);
+ }
+ }
+
+ public static final class Result_NoneNoneZ_Err extends Result_NoneNoneZ {
+ private Result_NoneNoneZ_Err(Object _dummy, long ptr) {
+ super(_dummy, ptr);
+ }
+ }
+
+ /**
+ * Creates a new CResult_NoneNoneZ in the success state.
+ */
+ public static Result_NoneNoneZ ok() {
+ long ret = bindings.CResult_NoneNoneZ_ok();
+ if (ret < 1024) { return null; }
+ Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Creates a new CResult_NoneNoneZ in the error state.
+ */
+ public static Result_NoneNoneZ err() {
+ long ret = bindings.CResult_NoneNoneZ_err();
+ if (ret < 1024) { return null; }
+ Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
+ return ret_hu_conv;
+ }
+
+ /**
+ * Creates a new CResult_NoneNoneZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+ public Result_NoneNoneZ clone() {
+ long ret = bindings.CResult_NoneNoneZ_clone(this.ptr);
+ if (ret < 1024) { return null; }
+ Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
+ return ret_hu_conv;
+ }
+
+}
--- /dev/null
+package org.ldk.structs;
+
+import org.ldk.impl.bindings;
+import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
+import javax.annotation.Nullable;
+
+public class Result_TrustedClosingTransactionNoneZ extends CommonBase {
+ private Result_TrustedClosingTransactionNoneZ(Object _dummy, long ptr) { super(ptr); }
+ protected void finalize() throws Throwable {
+ if (ptr != 0) { bindings.CResult_TrustedClosingTransactionNoneZ_free(ptr); } super.finalize();
+ }
+
+ static Result_TrustedClosingTransactionNoneZ constr_from_ptr(long ptr) {
+ if (bindings.LDKCResult_TrustedClosingTransactionNoneZ_result_ok(ptr)) {
+ return new Result_TrustedClosingTransactionNoneZ_OK(null, ptr);
+ } else {
+ return new Result_TrustedClosingTransactionNoneZ_Err(null, ptr);
+ }
+ }
+ public static final class Result_TrustedClosingTransactionNoneZ_OK extends Result_TrustedClosingTransactionNoneZ {
+ public final TrustedClosingTransaction res;
+ private Result_TrustedClosingTransactionNoneZ_OK(Object _dummy, long ptr) {
+ super(_dummy, ptr);
+ long res = bindings.LDKCResult_TrustedClosingTransactionNoneZ_get_ok(ptr);
+ TrustedClosingTransaction res_hu_conv = new TrustedClosingTransaction(null, res);
+ res_hu_conv.ptrs_to.add(this);
+ this.res = res_hu_conv;
+ }
+ }
+
+ public static final class Result_TrustedClosingTransactionNoneZ_Err extends Result_TrustedClosingTransactionNoneZ {
+ private Result_TrustedClosingTransactionNoneZ_Err(Object _dummy, long ptr) {
+ super(_dummy, ptr);
+ }
+ }
+
+ /**
+ * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
+ */
+ public static Result_TrustedClosingTransactionNoneZ ok(TrustedClosingTransaction o) {
+ long ret = bindings.CResult_TrustedClosingTransactionNoneZ_ok(o == null ? 0 : o.ptr & ~1);
+ if (ret < 1024) { return null; }
+ Result_TrustedClosingTransactionNoneZ ret_hu_conv = Result_TrustedClosingTransactionNoneZ.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(o);
+ // Due to rust's strict-ownership memory model, in some cases we need to "move"
+ // an object to pass exclusive ownership to the function being called.
+ // In most cases, we avoid ret_hu_conv being visible in GC'd languages by cloning the object
+ // at the FFI layer, creating a new object which Rust can claim ownership of
+ // However, in some cases (eg here), there is no way to clone an object, and thus
+ // we actually have to pass full ownership to Rust.
+ // Thus, after ret_hu_conv call, o is reset to null and is now a dummy object.
+ o.ptr = 0;
+ return ret_hu_conv;
+ }
+
+ /**
+ * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
+ */
+ public static Result_TrustedClosingTransactionNoneZ err() {
+ long ret = bindings.CResult_TrustedClosingTransactionNoneZ_err();
+ if (ret < 1024) { return null; }
+ Result_TrustedClosingTransactionNoneZ ret_hu_conv = Result_TrustedClosingTransactionNoneZ.constr_from_ptr(ret);
+ return ret_hu_conv;
+ }
+
+}
if (ptr != 0) { bindings.Route_free(ptr); }
}
+ /**
+ * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
+ * last RouteHop in each path must be the same.
+ * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
+ * destination. Thus, this must always be at least length one. While the maximum length of any
+ * given path is variable, keeping the length of any path to less than 20 should currently
+ * ensure it is viable.
+ */
+ public RouteHop[][] get_paths() {
+ long[][] ret = bindings.Route_get_paths(this.ptr);
+ RouteHop[][] ret_conv_12_arr = new RouteHop[ret.length][];
+ for (int m = 0; m < ret.length; m++) {
+ long[] ret_conv_12 = ret[m];
+ RouteHop[] ret_conv_12_conv_10_arr = new RouteHop[ret_conv_12.length];
+ for (int k = 0; k < ret_conv_12.length; k++) {
+ long ret_conv_12_conv_10 = ret_conv_12[k];
+ RouteHop ret_conv_12_conv_10_hu_conv = new RouteHop(null, ret_conv_12_conv_10);
+ ret_conv_12_conv_10_hu_conv.ptrs_to.add(this);
+ ret_conv_12_conv_10_arr[k] = ret_conv_12_conv_10_hu_conv;
+ }
+ ret_conv_12_arr[m] = ret_conv_12_conv_10_arr;
+ }
+ return ret_conv_12_arr;
+ }
+
/**
* The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
* last RouteHop in each path must be the same.
*/
public void set_paths(RouteHop[][] val) {
bindings.Route_set_paths(this.ptr, val != null ? Arrays.stream(val).map(val_conv_12 -> val_conv_12 != null ? Arrays.stream(val_conv_12).mapToLong(val_conv_12_conv_10 -> val_conv_12_conv_10 == null ? 0 : val_conv_12_conv_10.ptr & ~1).toArray() : null).toArray(long[][]::new) : null);
- /* TODO 2 RouteHop[] */;
+ for (RouteHop[] val_conv_12: val) { for (RouteHop val_conv_12_conv_10: val_conv_12) { this.ptrs_to.add(val_conv_12_conv_10); }; };
}
/**
if (ret < 1024) { return null; }
Route ret_hu_conv = new Route(null, ret);
ret_hu_conv.ptrs_to.add(ret_hu_conv);
- /* TODO 2 RouteHop[] */;
+ for (RouteHop[] paths_arg_conv_12: paths_arg) { for (RouteHop paths_arg_conv_12_conv_10: paths_arg_conv_12) { ret_hu_conv.ptrs_to.add(paths_arg_conv_12_conv_10); }; };
return ret_hu_conv;
}
return ret_hu_conv;
}
+ /**
+ * Checks if two Routes contain equal inner contents.
+ */
+ public long hash() {
+ long ret = bindings.Route_hash(this.ptr);
+ return ret;
+ }
+
+ /**
+ * Checks if two Routes contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+ public boolean eq(Route b) {
+ boolean ret = bindings.Route_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
+ this.ptrs_to.add(b);
+ return ret;
+ }
+
+ /**
+ * Returns the total amount of fees paid on this [`Route`].
+ *
+ * This doesn't include any extra payment made to the recipient, which can happen in excess of
+ * the amount passed to [`get_route`]'s `final_value_msat`.
+ */
+ public long get_total_fees() {
+ long ret = bindings.Route_get_total_fees(this.ptr);
+ return ret;
+ }
+
+ /**
+ * Returns the total amount paid on this [`Route`], excluding the fees.
+ */
+ public long get_total_amount() {
+ long ret = bindings.Route_get_total_amount(this.ptr);
+ return ret;
+ }
+
/**
* Serialize the Route object into a byte array which can be read by Route_read
*/
if (ptr != 0) { bindings.RouteHint_free(ptr); }
}
- /**
- * Checks if two RouteHints contain equal inner contents.
- * This ignores pointers and is_owned flags and looks at the values in fields.
- * Two objects with NULL inner values will be considered "equal" here.
- */
- public boolean eq(RouteHint b) {
- boolean ret = bindings.RouteHint_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
- this.ptrs_to.add(b);
- return ret;
- }
-
/**
* Creates a copy of the RouteHint
*/
return ret_hu_conv;
}
+ /**
+ * Checks if two RouteHints contain equal inner contents.
+ */
+ public long hash() {
+ long ret = bindings.RouteHint_hash(this.ptr);
+ return ret;
+ }
+
+ /**
+ * Checks if two RouteHints contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+ public boolean eq(RouteHint b) {
+ boolean ret = bindings.RouteHint_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
+ this.ptrs_to.add(b);
+ return ret;
+ }
+
}
return ret_hu_conv;
}
- /**
- * Checks if two RouteHintHops contain equal inner contents.
- * This ignores pointers and is_owned flags and looks at the values in fields.
- * Two objects with NULL inner values will be considered "equal" here.
- */
- public boolean eq(RouteHintHop b) {
- boolean ret = bindings.RouteHintHop_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
- this.ptrs_to.add(b);
- return ret;
- }
-
/**
* Creates a copy of the RouteHintHop
*/
return ret_hu_conv;
}
+ /**
+ * Checks if two RouteHintHops contain equal inner contents.
+ */
+ public long hash() {
+ long ret = bindings.RouteHintHop_hash(this.ptr);
+ return ret;
+ }
+
+ /**
+ * Checks if two RouteHintHops contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+ public boolean eq(RouteHintHop b) {
+ boolean ret = bindings.RouteHintHop_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
+ this.ptrs_to.add(b);
+ return ret;
+ }
+
}
return ret_hu_conv;
}
+ /**
+ * Checks if two RouteHops contain equal inner contents.
+ */
+ public long hash() {
+ long ret = bindings.RouteHop_hash(this.ptr);
+ return ret;
+ }
+
+ /**
+ * Checks if two RouteHops contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+ public boolean eq(RouteHop b) {
+ boolean ret = bindings.RouteHop_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
+ this.ptrs_to.add(b);
+ return ret;
+ }
+
/**
* Serialize the RouteHop object into a byte array which can be read by RouteHop_read
*/
return ret_hu_conv;
}
+ /**
+ * Checks if two RoutingFeess contain equal inner contents.
+ */
+ public long hash() {
+ long ret = bindings.RoutingFees_hash(this.ptr);
+ return ret;
+ }
+
/**
* Serialize the RoutingFees object into a byte array which can be read by RoutingFees_read
*/
* false or returning an Err otherwise.
*/
Result_boolLightningErrorZ handle_channel_update(ChannelUpdate msg);
- /**
- * Handle some updates to the route graph that we learned due to an outbound failed payment.
- */
- void handle_htlc_fail_channel_update(HTLCFailChannelUpdate update);
/**
* Gets a subset of the channel announcements and updates required to dump our routing table
* to a remote node, starting at the short_channel_id indicated by starting_point and
long result = ret != null ? ret.ptr : 0;
return result;
}
- @Override public void handle_htlc_fail_channel_update(long update) {
- HTLCFailChannelUpdate update_hu_conv = HTLCFailChannelUpdate.constr_from_ptr(update);
- arg.handle_htlc_fail_channel_update(update_hu_conv);
- }
@Override public long[] get_next_channel_announcements(long starting_point, byte batch_amount) {
ThreeTuple<ChannelAnnouncement, ChannelUpdate, ChannelUpdate>[] ret = arg.get_next_channel_announcements(starting_point, batch_amount);
long[] result = ret != null ? Arrays.stream(ret).mapToLong(ret_conv_63 -> bindings.C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(ret_conv_63.a == null ? 0 : ret_conv_63.a.ptr & ~1, ret_conv_63.b == null ? 0 : ret_conv_63.b.ptr & ~1, ret_conv_63.c == null ? 0 : ret_conv_63.c.ptr & ~1)).toArray() : null;
- /* TODO 2 ThreeTuple<ChannelAnnouncement, ChannelUpdate, ChannelUpdate> */;
+ for (ThreeTuple<ChannelAnnouncement, ChannelUpdate, ChannelUpdate> ret_conv_63: ret) { impl_holder.held.ptrs_to.add(ret_conv_63.a); impl_holder.held.ptrs_to.add(ret_conv_63.b); impl_holder.held.ptrs_to.add(ret_conv_63.c); };
return result;
}
@Override public long[] get_next_node_announcements(byte[] starting_point, byte batch_amount) {
NodeAnnouncement[] ret = arg.get_next_node_announcements(starting_point, batch_amount);
long[] result = ret != null ? Arrays.stream(ret).mapToLong(ret_conv_18 -> ret_conv_18 == null ? 0 : ret_conv_18.ptr & ~1).toArray() : null;
- /* TODO 2 NodeAnnouncement */;
+ for (NodeAnnouncement ret_conv_18: ret) { impl_holder.held.ptrs_to.add(ret_conv_18); };
return result;
}
@Override public void sync_routing_table(byte[] their_node_id, long init) {
return ret_hu_conv;
}
- /**
- * Handle some updates to the route graph that we learned due to an outbound failed payment.
- */
- public void handle_htlc_fail_channel_update(HTLCFailChannelUpdate update) {
- bindings.RoutingMessageHandler_handle_htlc_fail_channel_update(this.ptr, update == null ? 0 : update.ptr & ~1);
- this.ptrs_to.add(update);
- }
-
/**
* Gets a subset of the channel announcements and updates required to dump our routing table
* to a remote node, starting at the short_channel_id indicated by starting_point and
if (ptr != 0) { bindings.Sha256_free(ptr); }
}
- /**
- * Checks if two Sha256s contain equal inner contents.
- * This ignores pointers and is_owned flags and looks at the values in fields.
- * Two objects with NULL inner values will be considered "equal" here.
- */
- public boolean eq(Sha256 b) {
- boolean ret = bindings.Sha256_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
- this.ptrs_to.add(b);
- return ret;
- }
-
/**
* Creates a copy of the Sha256
*/
return ret_hu_conv;
}
+ /**
+ * Checks if two Sha256s contain equal inner contents.
+ */
+ public long hash() {
+ long ret = bindings.Sha256_hash(this.ptr);
+ return ret;
+ }
+
+ /**
+ * Checks if two Sha256s contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+ public boolean eq(Sha256 b) {
+ boolean ret = bindings.Sha256_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
+ this.ptrs_to.add(b);
+ return ret;
+ }
+
}
}
/**
- * Generates a P2WSH script pubkey from the given segwit version and program.
+ * Generates a witness script pubkey from the given segwit version and program.
+ *
+ * Note for version-zero witness scripts you must use [`ShutdownScript::new_p2wpkh`] or
+ * [`ShutdownScript::new_p2wsh`] instead.
*
* # Errors
*
--- /dev/null
+package org.ldk.structs;
+
+import org.ldk.impl.bindings;
+import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
+import javax.annotation.Nullable;
+
+
+/**
+ * A wrapper on ClosingTransaction indicating that the built bitcoin
+ * transaction is trusted.
+ *
+ * See trust() and verify() functions on CommitmentTransaction.
+ *
+ * This structure implements Deref.
+ */
+@SuppressWarnings("unchecked") // We correctly assign various generic arrays
+public class TrustedClosingTransaction extends CommonBase {
+ TrustedClosingTransaction(Object _dummy, long ptr) { super(ptr); }
+ @Override @SuppressWarnings("deprecation")
+ protected void finalize() throws Throwable {
+ super.finalize();
+ if (ptr != 0) { bindings.TrustedClosingTransaction_free(ptr); }
+ }
+
+ /**
+ * The pre-built Bitcoin commitment transaction
+ */
+ public byte[] built_transaction() {
+ byte[] ret = bindings.TrustedClosingTransaction_built_transaction(this.ptr);
+ return ret;
+ }
+
+ /**
+ * Get the SIGHASH_ALL sighash value of the transaction.
+ *
+ * This can be used to verify a signature.
+ */
+ public byte[] get_sighash_all(byte[] funding_redeemscript, long channel_value_satoshis) {
+ byte[] ret = bindings.TrustedClosingTransaction_get_sighash_all(this.ptr, funding_redeemscript, channel_value_satoshis);
+ return ret;
+ }
+
+ /**
+ * Sign a transaction, either because we are counter-signing the counterparty's transaction or
+ * because we are about to broadcast a holder transaction.
+ */
+ public byte[] sign(byte[] funding_key, byte[] funding_redeemscript, long channel_value_satoshis) {
+ byte[] ret = bindings.TrustedClosingTransaction_sign(this.ptr, funding_key, funding_redeemscript, channel_value_satoshis);
+ return ret;
+ }
+
+}
--- /dev/null
+package org.ldk.structs;
+
+import org.ldk.impl.bindings;
+import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
+import javax.annotation.Nullable;
+
+/**
+ * Defines a type identifier for sending messages over the wire.
+ *
+ * Messages implementing this trait specify a type and must be [`Writeable`].
+ */
+@SuppressWarnings("unchecked") // We correctly assign various generic arrays
+public class Type extends CommonBase {
+ final bindings.LDKType bindings_instance;
+ Type(Object _dummy, long ptr) { super(ptr); bindings_instance = null; }
+ private Type(bindings.LDKType arg) {
+ super(bindings.LDKType_new(arg));
+ this.ptrs_to.add(arg);
+ this.bindings_instance = arg;
+ }
+ @Override @SuppressWarnings("deprecation")
+ protected void finalize() throws Throwable {
+ if (ptr != 0) { bindings.Type_free(ptr); } super.finalize();
+ }
+
+ public static interface TypeInterface {
+ /**
+ * Returns the type identifying the message payload.
+ */
+ short type_id();
+ /**
+ * Return a human-readable "debug" string describing this object
+ */
+ String debug_str();
+ /**
+ * Serialize the object into a byte array
+ */
+ byte[] write();
+ }
+ private static class LDKTypeHolder { Type held; }
+ public static Type new_impl(TypeInterface arg) {
+ final LDKTypeHolder impl_holder = new LDKTypeHolder();
+ impl_holder.held = new Type(new bindings.LDKType() {
+ @Override public short type_id() {
+ short ret = arg.type_id();
+ return ret;
+ }
+ @Override public String debug_str() {
+ String ret = arg.debug_str();
+ return ret;
+ }
+ @Override public byte[] write() {
+ byte[] ret = arg.write();
+ return ret;
+ }
+ });
+ return impl_holder.held;
+ }
+ /**
+ * Returns the type identifying the message payload.
+ */
+ public short type_id() {
+ short ret = bindings.Type_type_id(this.ptr);
+ return ret;
+ }
+
+ /**
+ * Return a human-readable "debug" string describing this object
+ */
+ public String debug_str() {
+ String ret = bindings.Type_debug_str(this.ptr);
+ return ret;
+ }
+
+ /**
+ * Serialize the object into a byte array
+ */
+ public byte[] write() {
+ byte[] ret = bindings.Type_write(this.ptr);
+ return ret;
+ }
+
+ /**
+ * Creates a copy of a Type
+ */
+ public Type clone() {
+ long ret = bindings.Type_clone(this.ptr);
+ if (ret < 1024) { return null; }
+ Type ret_hu_conv = new Type(null, ret);
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;
+ }
+
+}
*/
public void set_addresses(NetAddress[] val) {
bindings.UnsignedNodeAnnouncement_set_addresses(this.ptr, val != null ? Arrays.stream(val).mapToLong(val_conv_12 -> val_conv_12.ptr).toArray() : null);
- /* TODO 2 NetAddress */;
}
/**
ret_hu_conv.ptrs_to.add(arg_tx_broadcaster);
ret_hu_conv.ptrs_to.add(arg_logger);
ret_hu_conv.ptrs_to.add(arg_default_config);
- /* TODO 2 ChannelMonitor */;
+ for (ChannelMonitor arg_channel_monitors_conv_16: arg_channel_monitors) { ret_hu_conv.ptrs_to.add(arg_channel_monitors_conv_16); };
return ret_hu_conv;
}
return ret;
}
+ /**
+ * Build a closing transaction
+ */
+ public static byte[] build_closing_transaction(long to_holder_value_sat, long to_counterparty_value_sat, byte[] to_holder_script, byte[] to_counterparty_script, OutPoint funding_outpoint) {
+ byte[] ret = bindings.build_closing_transaction(to_holder_value_sat, to_counterparty_value_sat, to_holder_script, to_counterparty_script, funding_outpoint == null ? 0 : funding_outpoint.ptr & ~1);
+ // this.ptrs_to.add(funding_outpoint);
+ return ret;
+ }
+
/**
* Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
* from the base secret and the per_commitment_point.
if (ret < 1024) { return null; }
Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret);
ret_hu_conv.ptrs_to.add(network);
- /* TODO 2 ChannelDetails */;
- /* TODO 2 RouteHint */;
+ for (ChannelDetails first_hops_conv_16: first_hops) { ret_hu_conv.ptrs_to.add(first_hops_conv_16); };
+ for (RouteHint last_hops_conv_11: last_hops) { ret_hu_conv.ptrs_to.add(last_hops_conv_11); };
ret_hu_conv.ptrs_to.add(logger);
return ret_hu_conv;
}
Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret);
ret_hu_conv.ptrs_to.add(network);
ret_hu_conv.ptrs_to.add(payee_features);
- /* TODO 2 ChannelDetails */;
- /* TODO 2 RouteHint */;
+ for (ChannelDetails first_hops_conv_16: first_hops) { ret_hu_conv.ptrs_to.add(first_hops_conv_16); };
+ for (RouteHint last_hops_conv_11: last_hops) { ret_hu_conv.ptrs_to.add(last_hops_conv_11); };
ret_hu_conv.ptrs_to.add(logger);
return ret_hu_conv;
}
@Override public long[] release_pending_monitor_events() {
MonitorEvent[] ret = arg.release_pending_monitor_events();
long[] result = ret != null ? Arrays.stream(ret).mapToLong(ret_conv_14 -> ret_conv_14.ptr).toArray() : null;
- /* TODO 2 MonitorEvent */;
return result;
}
});
}
JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1lib_1version_1string(JNIEnv *env, jclass _c) {
- return str_ref_to_java(env, "v0.0.100.2", strlen("v0.0.100.2"));
+ return str_ref_to_java(env, "v0.0.101.0", strlen("v0.0.101.0"));
}
JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) {
return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
case 1: return LDKSemanticError_MultiplePaymentHashes;
case 2: return LDKSemanticError_NoDescription;
case 3: return LDKSemanticError_MultipleDescriptions;
- case 4: return LDKSemanticError_MultiplePaymentSecrets;
- case 5: return LDKSemanticError_InvalidFeatures;
- case 6: return LDKSemanticError_InvalidRecoveryId;
- case 7: return LDKSemanticError_InvalidSignature;
+ case 4: return LDKSemanticError_NoPaymentSecret;
+ case 5: return LDKSemanticError_MultiplePaymentSecrets;
+ case 6: return LDKSemanticError_InvalidFeatures;
+ case 7: return LDKSemanticError_InvalidRecoveryId;
+ case 8: return LDKSemanticError_InvalidSignature;
+ case 9: return LDKSemanticError_ImpreciseAmount;
}
abort();
}
static jfieldID SemanticError_LDKSemanticError_MultiplePaymentHashes = NULL;
static jfieldID SemanticError_LDKSemanticError_NoDescription = NULL;
static jfieldID SemanticError_LDKSemanticError_MultipleDescriptions = NULL;
+static jfieldID SemanticError_LDKSemanticError_NoPaymentSecret = NULL;
static jfieldID SemanticError_LDKSemanticError_MultiplePaymentSecrets = NULL;
static jfieldID SemanticError_LDKSemanticError_InvalidFeatures = NULL;
static jfieldID SemanticError_LDKSemanticError_InvalidRecoveryId = NULL;
static jfieldID SemanticError_LDKSemanticError_InvalidSignature = NULL;
+static jfieldID SemanticError_LDKSemanticError_ImpreciseAmount = NULL;
JNIEXPORT void JNICALL Java_org_ldk_enums_SemanticError_init (JNIEnv *env, jclass clz) {
SemanticError_class = (*env)->NewGlobalRef(env, clz);
CHECK(SemanticError_class != NULL);
CHECK(SemanticError_LDKSemanticError_NoDescription != NULL);
SemanticError_LDKSemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultipleDescriptions", "Lorg/ldk/enums/SemanticError;");
CHECK(SemanticError_LDKSemanticError_MultipleDescriptions != NULL);
+ SemanticError_LDKSemanticError_NoPaymentSecret = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentSecret", "Lorg/ldk/enums/SemanticError;");
+ CHECK(SemanticError_LDKSemanticError_NoPaymentSecret != NULL);
SemanticError_LDKSemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/SemanticError;");
CHECK(SemanticError_LDKSemanticError_MultiplePaymentSecrets != NULL);
SemanticError_LDKSemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidFeatures", "Lorg/ldk/enums/SemanticError;");
CHECK(SemanticError_LDKSemanticError_InvalidRecoveryId != NULL);
SemanticError_LDKSemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidSignature", "Lorg/ldk/enums/SemanticError;");
CHECK(SemanticError_LDKSemanticError_InvalidSignature != NULL);
+ SemanticError_LDKSemanticError_ImpreciseAmount = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_ImpreciseAmount", "Lorg/ldk/enums/SemanticError;");
+ CHECK(SemanticError_LDKSemanticError_ImpreciseAmount != NULL);
}
static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) {
switch (val) {
return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoDescription);
case LDKSemanticError_MultipleDescriptions:
return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultipleDescriptions);
+ case LDKSemanticError_NoPaymentSecret:
+ return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentSecret);
case LDKSemanticError_MultiplePaymentSecrets:
return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentSecrets);
case LDKSemanticError_InvalidFeatures:
return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidRecoveryId);
case LDKSemanticError_InvalidSignature:
return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidSignature);
+ case LDKSemanticError_ImpreciseAmount:
+ return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_ImpreciseAmount);
default: abort();
}
}
uint64_t err_ref = (uint64_t)err_var.inner & ~1;
return err_ref;
}
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+ return ((LDKCResult_TrustedClosingTransactionNoneZ*)arg)->result_ok;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+ LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
+ CHECK(val->result_ok);
+ LDKTrustedClosingTransaction res_var = (*val->contents.result);
+ CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t res_ref = (uint64_t)res_var.inner & ~1;
+ return res_ref;
+}
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
+ LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
+ CHECK(!val->result_ok);
+ return *val->contents.err;
+}
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
}
}
static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
-static jclass LDKMonitorEvent_CommitmentTxBroadcasted_class = NULL;
-static jmethodID LDKMonitorEvent_CommitmentTxBroadcasted_meth = NULL;
+static jclass LDKMonitorEvent_CommitmentTxConfirmed_class = NULL;
+static jmethodID LDKMonitorEvent_CommitmentTxConfirmed_meth = NULL;
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
LDKMonitorEvent_HTLCEvent_class =
(*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent;"));
CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
- LDKMonitorEvent_CommitmentTxBroadcasted_class =
- (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxBroadcasted;"));
- CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_class != NULL);
- LDKMonitorEvent_CommitmentTxBroadcasted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, "<init>", "(J)V");
- CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_meth != NULL);
+ LDKMonitorEvent_CommitmentTxConfirmed_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxConfirmed;"));
+ CHECK(LDKMonitorEvent_CommitmentTxConfirmed_class != NULL);
+ LDKMonitorEvent_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxConfirmed_class, "<init>", "(J)V");
+ CHECK(LDKMonitorEvent_CommitmentTxConfirmed_meth != NULL);
}
JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
uint64_t htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
}
- case LDKMonitorEvent_CommitmentTxBroadcasted: {
- LDKOutPoint commitment_tx_broadcasted_var = obj->commitment_tx_broadcasted;
- CHECK((((uint64_t)commitment_tx_broadcasted_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&commitment_tx_broadcasted_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t commitment_tx_broadcasted_ref = (uint64_t)commitment_tx_broadcasted_var.inner & ~1;
- return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, LDKMonitorEvent_CommitmentTxBroadcasted_meth, commitment_tx_broadcasted_ref);
+ case LDKMonitorEvent_CommitmentTxConfirmed: {
+ LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
+ CHECK((((uint64_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t commitment_tx_confirmed_ref = (uint64_t)commitment_tx_confirmed_var.inner & ~1;
+ return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxConfirmed_class, LDKMonitorEvent_CommitmentTxConfirmed_meth, commitment_tx_confirmed_ref);
}
default: abort();
}
default: abort();
}
}
+static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
+static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
+static jclass LDKNetworkUpdate_ChannelClosed_class = NULL;
+static jmethodID LDKNetworkUpdate_ChannelClosed_meth = NULL;
+static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
+static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
+ LDKNetworkUpdate_ChannelUpdateMessage_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage;"));
+ CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
+ LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
+ CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
+ LDKNetworkUpdate_ChannelClosed_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$ChannelClosed;"));
+ CHECK(LDKNetworkUpdate_ChannelClosed_class != NULL);
+ LDKNetworkUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelClosed_class, "<init>", "(JZ)V");
+ CHECK(LDKNetworkUpdate_ChannelClosed_meth != NULL);
+ LDKNetworkUpdate_NodeFailure_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure;"));
+ CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
+ LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
+ CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
+}
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
+ LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKNetworkUpdate_ChannelUpdateMessage: {
+ LDKChannelUpdate msg_var = obj->channel_update_message.msg;
+ CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
+ return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
+ }
+ case LDKNetworkUpdate_ChannelClosed: {
+ return (*env)->NewObject(env, LDKNetworkUpdate_ChannelClosed_class, LDKNetworkUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
+ }
+ case LDKNetworkUpdate_NodeFailure: {
+ int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
+ (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
+ return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
+ }
+ default: abort();
+ }
+}
+static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
+static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
+static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
+static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
+ LDKCOption_NetworkUpdateZ_Some_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some;"));
+ CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
+ LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
+ CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
+ LDKCOption_NetworkUpdateZ_None_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None;"));
+ CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
+ LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
+ CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
+}
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
+ LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKCOption_NetworkUpdateZ_Some: {
+ uint64_t some_ref = ((uint64_t)&obj->some) | 1;
+ return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
+ }
+ case LDKCOption_NetworkUpdateZ_None: {
+ return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
+ }
+ default: abort();
+ }
+}
static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
default: abort();
}
}
-static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
-static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
-static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
-static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
-static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
-static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv *env, jclass clz) {
- LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
- (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
- CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
- LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
- CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
- LDKHTLCFailChannelUpdate_ChannelClosed_class =
- (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
- CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
- LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
- CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
- LDKHTLCFailChannelUpdate_NodeFailure_class =
- (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
- CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
- LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
- CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
-}
-JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
- LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)(ptr & ~1);
- switch(obj->tag) {
- case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
- LDKChannelUpdate msg_var = obj->channel_update_message.msg;
- CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
- return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
- }
- case LDKHTLCFailChannelUpdate_ChannelClosed: {
- return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
- }
- case LDKHTLCFailChannelUpdate_NodeFailure: {
- int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
- (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
- return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
- }
- default: abort();
- }
-}
static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
static jclass LDKMessageSendEvent_HandleError_class = NULL;
static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
-static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
-static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
CHECK(LDKMessageSendEvent_HandleError_class != NULL);
LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
- LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
- (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
- CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
- LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
- CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
LDKMessageSendEvent_SendChannelRangeQuery_class =
(*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery;"));
CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
}
- case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
- uint64_t update_ref = ((uint64_t)&obj->payment_failure_network_update.update) | 1;
- return (*env)->NewObject(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
- }
case LDKMessageSendEvent_SendChannelRangeQuery: {
int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
(*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
uint64_t err_ref = (uint64_t)err_var.inner & ~1;
return err_ref;
}
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+ return ((LDKCResult_NoneNoneZ*)arg)->result_ok;
+}
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+ LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
+ CHECK(val->result_ok);
+ return *val->contents.result;
+}
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
+ LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
+ CHECK(!val->result_ok);
+ return *val->contents.err;
+}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
LDKSignature a_ref;
jweak o;
jmethodID get_per_commitment_point_meth;
jmethodID release_commitment_secret_meth;
+ jmethodID validate_holder_commitment_meth;
jmethodID channel_keys_id_meth;
jmethodID sign_counterparty_commitment_meth;
+ jmethodID validate_counterparty_revocation_meth;
jmethodID sign_holder_commitment_and_htlcs_meth;
jmethodID sign_justice_revoked_output_meth;
jmethodID sign_justice_revoked_htlc_meth;
}
return ret_ref;
}
+LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx) {
+ LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
+ holder_tx_var = HolderCommitmentTransaction_clone(holder_tx);
+ CHECK((((uint64_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t holder_tx_ref = (uint64_t)holder_tx_var.inner;
+ if (holder_tx_var.is_owned) {
+ holder_tx_ref |= 1;
+ }
+ jobject obj = (*env)->NewLocalRef(env, j_calls->o);
+ CHECK(obj != NULL);
+ uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref);
+ if ((*env)->ExceptionCheck(env)) {
+ (*env)->ExceptionDescribe(env);
+ (*env)->FatalError(env, "A call to validate_holder_commitment in LDKBaseSign from rust threw an exception.");
+ }
+ LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1);
+ ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ return ret_conv;
+}
LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
JNIEnv *env;
}
return ret_conv;
}
+LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
+ LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
+ (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
+ jobject obj = (*env)->NewLocalRef(env, j_calls->o);
+ CHECK(obj != NULL);
+ uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx, secret_arr);
+ if ((*env)->ExceptionCheck(env)) {
+ (*env)->ExceptionDescribe(env);
+ (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKBaseSign from rust threw an exception.");
+ }
+ LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1);
+ ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ return ret_conv;
+}
LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
JNIEnv *env;
}
return ret_conv;
}
-LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, LDKTransaction closing_tx) {
+LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
JNIEnv *env;
jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
} else {
DO_ASSERT(get_jenv_res == JNI_OK);
}
- LDKTransaction closing_tx_var = closing_tx;
- int8_tArray closing_tx_arr = (*env)->NewByteArray(env, closing_tx_var.datalen);
- (*env)->SetByteArrayRegion(env, closing_tx_arr, 0, closing_tx_var.datalen, closing_tx_var.data);
- Transaction_free(closing_tx_var);
+ LDKClosingTransaction closing_tx_var = *closing_tx;
+ // Warning: we may need a move here but no clone is available for LDKClosingTransaction
+ CHECK((((uint64_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t closing_tx_ref = (uint64_t)closing_tx_var.inner;
+ if (closing_tx_var.is_owned) {
+ closing_tx_ref |= 1;
+ }
jobject obj = (*env)->NewLocalRef(env, j_calls->o);
CHECK(obj != NULL);
- uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
+ uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
if ((*env)->ExceptionCheck(env)) {
(*env)->ExceptionDescribe(env);
(*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception.");
CHECK(calls->get_per_commitment_point_meth != NULL);
calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
CHECK(calls->release_commitment_secret_meth != NULL);
+ calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J)J");
+ CHECK(calls->validate_holder_commitment_meth != NULL);
calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
CHECK(calls->channel_keys_id_meth != NULL);
calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
CHECK(calls->sign_counterparty_commitment_meth != NULL);
+ calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
+ CHECK(calls->validate_counterparty_revocation_meth != NULL);
calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
- calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "([B)J");
+ calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
CHECK(calls->sign_closing_transaction_meth != NULL);
calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
CHECK(calls->sign_channel_announcement_meth != NULL);
.this_arg = (void*) calls,
.get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
.release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
+ .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
.channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
.sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
+ .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
.sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
.sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
.sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
return ret_arr;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1validate_1holder_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t holder_tx) {
+ LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
+ LDKHolderCommitmentTransaction holder_tx_conv;
+ holder_tx_conv.inner = (void*)(holder_tx & (~1));
+ holder_tx_conv.is_owned = false;
+ LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
+ *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv);
+ return (uint64_t)ret_conv;
+}
+
JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
return (uint64_t)ret_conv;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1validate_1counterparty_1revocation(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx, int8_tArray secret) {
+ LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
+ unsigned char secret_arr[32];
+ CHECK((*env)->GetArrayLength(env, secret) == 32);
+ (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
+ unsigned char (*secret_ref)[32] = &secret_arr;
+ LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
+ *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
+ return (uint64_t)ret_conv;
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1holder_1commitment_1and_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) {
LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
LDKHolderCommitmentTransaction commitment_tx_conv;
return (uint64_t)ret_conv;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray closing_tx) {
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int64_t closing_tx) {
LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
- LDKTransaction closing_tx_ref;
- closing_tx_ref.datalen = (*env)->GetArrayLength(env, closing_tx);
- closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
- (*env)->GetByteArrayRegion(env, closing_tx, 0, closing_tx_ref.datalen, closing_tx_ref.data);
- closing_tx_ref.data_is_owned = true;
+ LDKClosingTransaction closing_tx_conv;
+ closing_tx_conv.inner = (void*)(closing_tx & (~1));
+ closing_tx_conv.is_owned = false;
LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
- *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
+ *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
return (uint64_t)ret_conv;
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
CHECK(val->result_ok);
- LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
- *ret = Sign_clone(&(*val->contents.result));
- return (uint64_t)ret;
+ LDKSign* res_ret =MALLOC(sizeof(LDKSign), "LDKSign");
+ *res_ret = Sign_clone(&(*val->contents.result));
+ return (uint64_t)res_ret;
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1channel_1signer(JNIEnv *env, jclass clz, int64_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
- LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
- *ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
- return (uint64_t)ret;
+ LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
+ *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
+ return (uint64_t)ret_ret;
}
JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
uint64_t err_ref = (uint64_t)err_var.inner & ~1;
return err_ref;
}
+typedef struct LDKType_JCalls {
+ atomic_size_t refcnt;
+ JavaVM *vm;
+ jweak o;
+ jmethodID type_id_meth;
+ jmethodID debug_str_meth;
+ jmethodID write_meth;
+} LDKType_JCalls;
+static void LDKType_JCalls_free(void* this_arg) {
+ LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
+ if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ (*env)->DeleteWeakGlobalRef(env, j_calls->o);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ FREE(j_calls);
+ }
+}
+uint16_t type_id_LDKType_jcall(const void* this_arg) {
+ LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ jobject obj = (*env)->NewLocalRef(env, j_calls->o);
+ CHECK(obj != NULL);
+ int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
+ if ((*env)->ExceptionCheck(env)) {
+ (*env)->ExceptionDescribe(env);
+ (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
+ }
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ return ret;
+}
+LDKStr debug_str_LDKType_jcall(const void* this_arg) {
+ LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ jobject obj = (*env)->NewLocalRef(env, j_calls->o);
+ CHECK(obj != NULL);
+ jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
+ if ((*env)->ExceptionCheck(env)) {
+ (*env)->ExceptionDescribe(env);
+ (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
+ }
+ LDKStr ret_conv = java_to_owned_str(env, ret);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ return ret_conv;
+}
+LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
+ LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ jobject obj = (*env)->NewLocalRef(env, j_calls->o);
+ CHECK(obj != NULL);
+ int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
+ if ((*env)->ExceptionCheck(env)) {
+ (*env)->ExceptionDescribe(env);
+ (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
+ }
+ LDKCVec_u8Z ret_ref;
+ ret_ref.datalen = (*env)->GetArrayLength(env, ret);
+ ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
+ (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ return ret_ref;
+}
+static void LDKType_JCalls_cloned(LDKType* new_obj) {
+ LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
+ atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
+}
+static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
+ jclass c = (*env)->GetObjectClass(env, o);
+ CHECK(c != NULL);
+ LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
+ atomic_init(&calls->refcnt, 1);
+ DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
+ calls->o = (*env)->NewWeakGlobalRef(env, o);
+ calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
+ CHECK(calls->type_id_meth != NULL);
+ calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
+ CHECK(calls->debug_str_meth != NULL);
+ calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
+ CHECK(calls->write_meth != NULL);
+
+ LDKType ret = {
+ .this_arg = (void*) calls,
+ .type_id = type_id_LDKType_jcall,
+ .debug_str = debug_str_LDKType_jcall,
+ .write = write_LDKType_jcall,
+ .cloned = LDKType_JCalls_cloned,
+ .free = LDKType_JCalls_free,
+ };
+ return ret;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
+ LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
+ *res_ptr = LDKType_init(env, clz, o);
+ return (uint64_t)res_ptr;
+}
+JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
+ int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
+ return ret_val;
+}
+
+JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
+ LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
+ jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
+ Str_free(ret_str);
+ return ret_conv;
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
+ LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
+ int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
+ (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+static jclass LDKCOption_TypeZ_Some_class = NULL;
+static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
+static jclass LDKCOption_TypeZ_None_class = NULL;
+static jmethodID LDKCOption_TypeZ_None_meth = NULL;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
+ LDKCOption_TypeZ_Some_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_TypeZ$Some;"));
+ CHECK(LDKCOption_TypeZ_Some_class != NULL);
+ LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
+ CHECK(LDKCOption_TypeZ_Some_meth != NULL);
+ LDKCOption_TypeZ_None_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_TypeZ$None;"));
+ CHECK(LDKCOption_TypeZ_None_class != NULL);
+ LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
+ CHECK(LDKCOption_TypeZ_None_meth != NULL);
+}
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
+ LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKCOption_TypeZ_Some: {
+ LDKType* some_ret =MALLOC(sizeof(LDKType), "LDKType");
+ *some_ret = Type_clone(&obj->some);
+ return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, (uint64_t)some_ret);
+ }
+ case LDKCOption_TypeZ_None: {
+ return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
+ }
+ default: abort();
+ }
+}
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+ return ((LDKCResult_COption_TypeZDecodeErrorZ*)arg)->result_ok;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+ LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
+ CHECK(val->result_ok);
+ uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
+ return res_ref;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
+ LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
+ CHECK(!val->result_ok);
+ LDKDecodeError err_var = (*val->contents.err);
+ CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t err_ref = (uint64_t)err_var.inner & ~1;
+ return err_ref;
+}
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
}
default: abort();
}
}
+static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
+static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
+static jclass LDKClosureReason_HolderForceClosed_class = NULL;
+static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
+static jclass LDKClosureReason_CooperativeClosure_class = NULL;
+static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
+static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
+static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
+static jclass LDKClosureReason_ProcessingError_class = NULL;
+static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
+static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
+static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
+static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
+static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
+ LDKClosureReason_CounterpartyForceClosed_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed;"));
+ CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
+ LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(Ljava/lang/String;)V");
+ CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
+ LDKClosureReason_HolderForceClosed_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$HolderForceClosed;"));
+ CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
+ LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
+ CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
+ LDKClosureReason_CooperativeClosure_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CooperativeClosure;"));
+ CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
+ LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
+ CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
+ LDKClosureReason_CommitmentTxConfirmed_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed;"));
+ CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
+ LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
+ CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
+ LDKClosureReason_ProcessingError_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$ProcessingError;"));
+ CHECK(LDKClosureReason_ProcessingError_class != NULL);
+ LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
+ CHECK(LDKClosureReason_ProcessingError_meth != NULL);
+ LDKClosureReason_DisconnectedPeer_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer;"));
+ CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
+ LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
+ CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
+ LDKClosureReason_OutdatedChannelManager_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager;"));
+ CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
+ LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
+ CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
+}
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
+ LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKClosureReason_CounterpartyForceClosed: {
+ LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
+ jstring peer_msg_conv = str_ref_to_java(env, peer_msg_str.chars, peer_msg_str.len);
+ return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_conv);
+ }
+ case LDKClosureReason_HolderForceClosed: {
+ return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
+ }
+ case LDKClosureReason_CooperativeClosure: {
+ return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
+ }
+ case LDKClosureReason_CommitmentTxConfirmed: {
+ return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
+ }
+ case LDKClosureReason_ProcessingError: {
+ LDKStr err_str = obj->processing_error.err;
+ jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
+ return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
+ }
+ case LDKClosureReason_DisconnectedPeer: {
+ return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
+ }
+ case LDKClosureReason_OutdatedChannelManager: {
+ return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
+ }
+ default: abort();
+ }
+}
static jclass LDKEvent_FundingGenerationReady_class = NULL;
static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
static jclass LDKEvent_PaymentReceived_class = NULL;
static jmethodID LDKEvent_PaymentReceived_meth = NULL;
static jclass LDKEvent_PaymentSent_class = NULL;
static jmethodID LDKEvent_PaymentSent_meth = NULL;
-static jclass LDKEvent_PaymentFailed_class = NULL;
-static jmethodID LDKEvent_PaymentFailed_meth = NULL;
+static jclass LDKEvent_PaymentPathFailed_class = NULL;
+static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
static jclass LDKEvent_SpendableOutputs_class = NULL;
static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
static jclass LDKEvent_PaymentForwarded_class = NULL;
static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
+static jclass LDKEvent_ChannelClosed_class = NULL;
+static jmethodID LDKEvent_ChannelClosed_meth = NULL;
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
LDKEvent_FundingGenerationReady_class =
(*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
CHECK(LDKEvent_PaymentSent_class != NULL);
LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
CHECK(LDKEvent_PaymentSent_meth != NULL);
- LDKEvent_PaymentFailed_class =
- (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
- CHECK(LDKEvent_PaymentFailed_class != NULL);
- LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
- CHECK(LDKEvent_PaymentFailed_meth != NULL);
+ LDKEvent_PaymentPathFailed_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentPathFailed;"));
+ CHECK(LDKEvent_PaymentPathFailed_class != NULL);
+ LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "([BZJZ[J)V");
+ CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
LDKEvent_PendingHTLCsForwardable_class =
(*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
CHECK(LDKEvent_PaymentForwarded_class != NULL);
LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "(JZ)V");
CHECK(LDKEvent_PaymentForwarded_meth != NULL);
+ LDKEvent_ChannelClosed_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$ChannelClosed;"));
+ CHECK(LDKEvent_ChannelClosed_class != NULL);
+ LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([BJ)V");
+ CHECK(LDKEvent_ChannelClosed_meth != NULL);
}
JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
LDKEvent *obj = (LDKEvent*)(ptr & ~1);
(*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
}
- case LDKEvent_PaymentFailed: {
+ case LDKEvent_PaymentPathFailed: {
int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
- (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
- return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
+ (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
+ uint64_t network_update_ref = ((uint64_t)&obj->payment_path_failed.network_update) | 1;
+ LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
+ int64_tArray path_arr = (*env)->NewLongArray(env, path_var.datalen);
+ int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
+ for (size_t k = 0; k < path_var.datalen; k++) {
+ LDKRouteHop path_conv_10_var = path_var.data[k];
+ CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
+ path_arr_ptr[k] = path_conv_10_ref;
+ }
+ (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
+ return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_hash_arr, obj->payment_path_failed.rejected_by_dest, network_update_ref, obj->payment_path_failed.all_paths_failed, path_arr);
}
case LDKEvent_PendingHTLCsForwardable: {
return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, fee_earned_msat_ref, obj->payment_forwarded.claim_from_onchain_tx);
}
+ case LDKEvent_ChannelClosed: {
+ int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
+ (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
+ uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1;
+ return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, reason_ref);
+ }
default: abort();
}
}
}
return ret;
}
-JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
- return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
-}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
- LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
- CHECK(val->result_ok);
- uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
- return res_ref;
+static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
+static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
+static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
+static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
+static jclass LDKBalance_ContentiousClaimable_class = NULL;
+static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
+static jclass LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class = NULL;
+static jmethodID LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = NULL;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
+ LDKBalance_ClaimableOnChannelClose_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose;"));
+ CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
+ LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
+ CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
+ LDKBalance_ClaimableAwaitingConfirmations_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations;"));
+ CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
+ LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
+ CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
+ LDKBalance_ContentiousClaimable_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ContentiousClaimable;"));
+ CHECK(LDKBalance_ContentiousClaimable_class != NULL);
+ LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI)V");
+ CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
+ LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$MaybeClaimableHTLCAwaitingTimeout;"));
+ CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class != NULL);
+ LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = (*env)->GetMethodID(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, "<init>", "(JI)V");
+ CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth != NULL);
+}
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
+ LDKBalance *obj = (LDKBalance*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKBalance_ClaimableOnChannelClose: {
+ return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, obj->claimable_on_channel_close.claimable_amount_satoshis);
+ }
+ case LDKBalance_ClaimableAwaitingConfirmations: {
+ return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, obj->claimable_awaiting_confirmations.claimable_amount_satoshis, obj->claimable_awaiting_confirmations.confirmation_height);
+ }
+ case LDKBalance_ContentiousClaimable: {
+ return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, obj->contentious_claimable.claimable_amount_satoshis, obj->contentious_claimable.timeout_height);
+ }
+ case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
+ return (*env)->NewObject(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth, obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis, obj->maybe_claimable_htlc_awaiting_timeout.claimable_height);
+ }
+ default: abort();
+ }
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
- LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
- CHECK(!val->result_ok);
- LDKDecodeError err_var = (*val->contents.err);
- CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1BalanceZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
+ LDKCVec_BalanceZ *ret = MALLOC(sizeof(LDKCVec_BalanceZ), "LDKCVec_BalanceZ");
+ ret->datalen = (*env)->GetArrayLength(env, elems);
+ if (ret->datalen == 0) {
+ ret->data = NULL;
+ } else {
+ ret->data = MALLOC(sizeof(LDKBalance) * ret->datalen, "LDKCVec_BalanceZ Data");
+ int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
+ for (size_t i = 0; i < ret->datalen; i++) {
+ int64_t arr_elem = java_elems[i];
+ LDKBalance arr_elem_conv = *(LDKBalance*)(((uint64_t)arr_elem) & ~1);
+ arr_elem_conv = Balance_clone((LDKBalance*)(((uint64_t)arr_elem) & ~1));
+ ret->data[i] = arr_elem_conv;
+ }
+ (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
+ }
+ return (uint64_t)ret;
+}
+static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
+ LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
+ for (size_t i = 0; i < ret.datalen; i++) {
+ ret.data[i] = Balance_clone(&orig->data[i]);
+ }
+ return ret;
+}
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+ return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+ LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
+ CHECK(val->result_ok);
+ uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
+ return res_ref;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
+ LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
+ CHECK(!val->result_ok);
+ LDKDecodeError err_var = (*val->contents.err);
+ CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t err_ref = (uint64_t)err_var.inner & ~1;
+ return err_ref;
+}
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+ return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
+}
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+ LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
+ CHECK(val->result_ok);
+ return *val->contents.result;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
+ LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
+ CHECK(!val->result_ok);
+ LDKLightningError err_var = (*val->contents.err);
+ CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t err_ref = (uint64_t)err_var.inner & ~1;
return err_ref;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
+ LDKC2Tuple_PublicKeyTypeZ* ret = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
+ LDKPublicKey a_ref;
+ CHECK((*env)->GetArrayLength(env, a) == 33);
+ (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
+ ret->a = a_ref;
+ LDKType b_conv = *(LDKType*)(((uint64_t)b) & ~1);
+ b_conv = Type_clone(&b_conv);
+ ret->b = b_conv;
+ return (uint64_t)ret;
+}
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
+ LDKC2Tuple_PublicKeyTypeZ *tuple = (LDKC2Tuple_PublicKeyTypeZ*)(ptr & ~1);
+ int8_tArray a_arr = (*env)->NewByteArray(env, 33);
+ (*env)->SetByteArrayRegion(env, a_arr, 0, 33, tuple->a.compressed_form);
+ return a_arr;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
+ LDKC2Tuple_PublicKeyTypeZ *tuple = (LDKC2Tuple_PublicKeyTypeZ*)(ptr & ~1);
+ LDKType* b_ret =MALLOC(sizeof(LDKType), "LDKType");
+ *b_ret = Type_clone(&tuple->b);
+ return (uint64_t)b_ret;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1PublicKeyTypeZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
+ LDKCVec_C2Tuple_PublicKeyTypeZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_PublicKeyTypeZZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ");
+ ret->datalen = (*env)->GetArrayLength(env, elems);
+ if (ret->datalen == 0) {
+ ret->data = NULL;
+ } else {
+ ret->data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * ret->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ Data");
+ int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
+ for (size_t i = 0; i < ret->datalen; i++) {
+ int64_t arr_elem = java_elems[i];
+ LDKC2Tuple_PublicKeyTypeZ arr_elem_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1);
+ arr_elem_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1));
+ ret->data[i] = arr_elem_conv;
+ }
+ (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
+ }
+ return (uint64_t)ret;
+}
+static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
+ LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
+ for (size_t i = 0; i < ret.datalen; i++) {
+ ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
+ }
+ return ret;
+}
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
}
}
return ret;
}
-JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
- return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
-}
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
- LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
- CHECK(val->result_ok);
- return *val->contents.result;
-}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
- LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
- CHECK(!val->result_ok);
- LDKLightningError err_var = (*val->contents.err);
- CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t err_ref = (uint64_t)err_var.inner & ~1;
- return err_ref;
-}
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
}
uint64_t err_ref = (uint64_t)err_var.inner & ~1;
return err_ref;
}
+typedef struct LDKAccess_JCalls {
+ atomic_size_t refcnt;
+ JavaVM *vm;
+ jweak o;
+ jmethodID get_utxo_meth;
+} LDKAccess_JCalls;
+static void LDKAccess_JCalls_free(void* this_arg) {
+ LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
+ if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ (*env)->DeleteWeakGlobalRef(env, j_calls->o);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ FREE(j_calls);
+ }
+}
+LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
+ LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
+ (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
+ jobject obj = (*env)->NewLocalRef(env, j_calls->o);
+ CHECK(obj != NULL);
+ uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
+ if ((*env)->ExceptionCheck(env)) {
+ (*env)->ExceptionDescribe(env);
+ (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
+ }
+ LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
+ ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ return ret_conv;
+}
+static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
+ LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
+ atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
+}
+static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
+ jclass c = (*env)->GetObjectClass(env, o);
+ CHECK(c != NULL);
+ LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
+ atomic_init(&calls->refcnt, 1);
+ DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
+ calls->o = (*env)->NewWeakGlobalRef(env, o);
+ calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
+ CHECK(calls->get_utxo_meth != NULL);
+
+ LDKAccess ret = {
+ .this_arg = (void*) calls,
+ .get_utxo = get_utxo_LDKAccess_jcall,
+ .free = LDKAccess_JCalls_free,
+ };
+ return ret;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
+ LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
+ *res_ptr = LDKAccess_init(env, clz, o);
+ return (uint64_t)res_ptr;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Access_1get_1utxo(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
+ LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
+ unsigned char genesis_hash_arr[32];
+ CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
+ (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
+ unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
+ LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
+ *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
+ return (uint64_t)ret_conv;
+}
+
+static jclass LDKCOption_AccessZ_Some_class = NULL;
+static jmethodID LDKCOption_AccessZ_Some_meth = NULL;
+static jclass LDKCOption_AccessZ_None_class = NULL;
+static jmethodID LDKCOption_AccessZ_None_meth = NULL;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AccessZ_init (JNIEnv *env, jclass clz) {
+ LDKCOption_AccessZ_Some_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_AccessZ$Some;"));
+ CHECK(LDKCOption_AccessZ_Some_class != NULL);
+ LDKCOption_AccessZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_Some_class, "<init>", "(J)V");
+ CHECK(LDKCOption_AccessZ_Some_meth != NULL);
+ LDKCOption_AccessZ_None_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_AccessZ$None;"));
+ CHECK(LDKCOption_AccessZ_None_class != NULL);
+ LDKCOption_AccessZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_None_class, "<init>", "()V");
+ CHECK(LDKCOption_AccessZ_None_meth != NULL);
+}
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
+ LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKCOption_AccessZ_Some: {
+ LDKAccess* some_ret =MALLOC(sizeof(LDKAccess), "LDKAccess");
+ *some_ret = obj->some;
+ // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
+ if ((*some_ret).free == LDKAccess_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKAccess_JCalls_cloned(&(*some_ret));
+ }
+ return (*env)->NewObject(env, LDKCOption_AccessZ_Some_class, LDKCOption_AccessZ_Some_meth, (uint64_t)some_ret);
+ }
+ case LDKCOption_AccessZ_None: {
+ return (*env)->NewObject(env, LDKCOption_AccessZ_None_class, LDKCOption_AccessZ_None_meth);
+ }
+ default: abort();
+ }
+}
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
}
uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
return err_ref;
}
-typedef struct LDKMessageSendEventsProvider_JCalls {
+typedef struct LDKFilter_JCalls {
atomic_size_t refcnt;
JavaVM *vm;
jweak o;
- jmethodID get_and_clear_pending_msg_events_meth;
-} LDKMessageSendEventsProvider_JCalls;
-static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
- LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
+ jmethodID register_tx_meth;
+ jmethodID register_output_meth;
+} LDKFilter_JCalls;
+static void LDKFilter_JCalls_free(void* this_arg) {
+ LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
JNIEnv *env;
jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
FREE(j_calls);
}
}
-LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
- LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
+void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
+ LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
JNIEnv *env;
jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
if (get_jenv_res == JNI_EDETACHED) {
} else {
DO_ASSERT(get_jenv_res == JNI_OK);
}
+ int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
+ (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
+ LDKu8slice script_pubkey_var = script_pubkey;
+ int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
+ (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
jobject obj = (*env)->NewLocalRef(env, j_calls->o);
CHECK(obj != NULL);
- int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
+ (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
if ((*env)->ExceptionCheck(env)) {
(*env)->ExceptionDescribe(env);
- (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
+ (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
}
- LDKCVec_MessageSendEventZ ret_constr;
- ret_constr.datalen = (*env)->GetArrayLength(env, ret);
- if (ret_constr.datalen > 0)
- ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
- else
- ret_constr.data = NULL;
- int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
- for (size_t s = 0; s < ret_constr.datalen; s++) {
- int64_t ret_conv_18 = ret_vals[s];
- LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
- ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
- ret_constr.data[s] = ret_conv_18_conv;
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
}
- (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
+}
+LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
+ LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ LDKWatchedOutput output_var = output;
+ CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t output_ref = (uint64_t)output_var.inner;
+ if (output_var.is_owned) {
+ output_ref |= 1;
+ }
+ jobject obj = (*env)->NewLocalRef(env, j_calls->o);
+ CHECK(obj != NULL);
+ uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
+ if ((*env)->ExceptionCheck(env)) {
+ (*env)->ExceptionDescribe(env);
+ (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
+ }
+ LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
+ ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
if (get_jenv_res == JNI_EDETACHED) {
DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
}
- return ret_constr;
+ return ret_conv;
}
-static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
- LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
+static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
+ LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
}
-static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
+static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
jclass c = (*env)->GetObjectClass(env, o);
CHECK(c != NULL);
- LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
+ LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
+ atomic_init(&calls->refcnt, 1);
+ DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
+ calls->o = (*env)->NewWeakGlobalRef(env, o);
+ calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
+ CHECK(calls->register_tx_meth != NULL);
+ calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
+ CHECK(calls->register_output_meth != NULL);
+
+ LDKFilter ret = {
+ .this_arg = (void*) calls,
+ .register_tx = register_tx_LDKFilter_jcall,
+ .register_output = register_output_LDKFilter_jcall,
+ .free = LDKFilter_JCalls_free,
+ };
+ return ret;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
+ LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
+ *res_ptr = LDKFilter_init(env, clz, o);
+ return (uint64_t)res_ptr;
+}
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
+ LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
+ unsigned char txid_arr[32];
+ CHECK((*env)->GetArrayLength(env, txid) == 32);
+ (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
+ unsigned char (*txid_ref)[32] = &txid_arr;
+ LDKu8slice script_pubkey_ref;
+ script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
+ script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
+ (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
+ (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
+ LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
+ LDKWatchedOutput output_conv;
+ output_conv.inner = (void*)(output & (~1));
+ output_conv.is_owned = (output & 1) || (output == 0);
+ output_conv = WatchedOutput_clone(&output_conv);
+ LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
+ *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+static jclass LDKCOption_FilterZ_Some_class = NULL;
+static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
+static jclass LDKCOption_FilterZ_None_class = NULL;
+static jmethodID LDKCOption_FilterZ_None_meth = NULL;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
+ LDKCOption_FilterZ_Some_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_FilterZ$Some;"));
+ CHECK(LDKCOption_FilterZ_Some_class != NULL);
+ LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
+ CHECK(LDKCOption_FilterZ_Some_meth != NULL);
+ LDKCOption_FilterZ_None_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_FilterZ$None;"));
+ CHECK(LDKCOption_FilterZ_None_class != NULL);
+ LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
+ CHECK(LDKCOption_FilterZ_None_meth != NULL);
+}
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
+ LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKCOption_FilterZ_Some: {
+ LDKFilter* some_ret =MALLOC(sizeof(LDKFilter), "LDKFilter");
+ *some_ret = obj->some;
+ // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
+ if ((*some_ret).free == LDKFilter_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKFilter_JCalls_cloned(&(*some_ret));
+ }
+ return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, (uint64_t)some_ret);
+ }
+ case LDKCOption_FilterZ_None: {
+ return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
+ }
+ default: abort();
+ }
+}
+typedef struct LDKMessageSendEventsProvider_JCalls {
+ atomic_size_t refcnt;
+ JavaVM *vm;
+ jweak o;
+ jmethodID get_and_clear_pending_msg_events_meth;
+} LDKMessageSendEventsProvider_JCalls;
+static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
+ LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
+ if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ (*env)->DeleteWeakGlobalRef(env, j_calls->o);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ FREE(j_calls);
+ }
+}
+LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
+ LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ jobject obj = (*env)->NewLocalRef(env, j_calls->o);
+ CHECK(obj != NULL);
+ int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
+ if ((*env)->ExceptionCheck(env)) {
+ (*env)->ExceptionDescribe(env);
+ (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
+ }
+ LDKCVec_MessageSendEventZ ret_constr;
+ ret_constr.datalen = (*env)->GetArrayLength(env, ret);
+ if (ret_constr.datalen > 0)
+ ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
+ else
+ ret_constr.data = NULL;
+ int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
+ for (size_t s = 0; s < ret_constr.datalen; s++) {
+ int64_t ret_conv_18 = ret_vals[s];
+ LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
+ ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
+ ret_constr.data[s] = ret_conv_18_conv;
+ }
+ (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ return ret_constr;
+}
+static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
+ LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
+ atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
+}
+static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
+ jclass c = (*env)->GetObjectClass(env, o);
+ CHECK(c != NULL);
+ LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
atomic_init(&calls->refcnt, 1);
DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
calls->o = (*env)->NewWeakGlobalRef(env, o);
FREE(j_calls);
}
}
-void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
+void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
JNIEnv *env;
jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
} else {
DO_ASSERT(get_jenv_res == JNI_OK);
}
- LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
- *event_copy = event;
- uint64_t event_ref = (uint64_t)event_copy;
+ LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
+ *ret_event = Event_clone(event);
jobject obj = (*env)->NewLocalRef(env, j_calls->o);
CHECK(obj != NULL);
- (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, event_ref);
+ (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, (uint64_t)ret_event);
if ((*env)->ExceptionCheck(env)) {
(*env)->ExceptionDescribe(env);
(*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
LDKEventHandler* this_arg_conv = (LDKEventHandler*)(((uint64_t)this_arg) & ~1);
- LDKEvent event_conv = *(LDKEvent*)(((uint64_t)event) & ~1);
+ LDKEvent* event_conv = (LDKEvent*)event;
(this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
}
} else {
DO_ASSERT(get_jenv_res == JNI_OK);
}
- LDKEventHandler* ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
- *ret = handler;
+ LDKEventHandler* handler_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
+ *handler_ret = handler;
jobject obj = (*env)->NewLocalRef(env, j_calls->o);
CHECK(obj != NULL);
- (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (uint64_t)ret);
+ (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (uint64_t)handler_ret);
if ((*env)->ExceptionCheck(env)) {
(*env)->ExceptionDescribe(env);
(*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
(this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
}
-typedef struct LDKAccess_JCalls {
- atomic_size_t refcnt;
- JavaVM *vm;
- jweak o;
- jmethodID get_utxo_meth;
-} LDKAccess_JCalls;
-static void LDKAccess_JCalls_free(void* this_arg) {
- LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
- if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
- JNIEnv *env;
- jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
- if (get_jenv_res == JNI_EDETACHED) {
- DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
- } else {
- DO_ASSERT(get_jenv_res == JNI_OK);
- }
- (*env)->DeleteWeakGlobalRef(env, j_calls->o);
- if (get_jenv_res == JNI_EDETACHED) {
- DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
- }
- FREE(j_calls);
- }
-}
-LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
- LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
- JNIEnv *env;
- jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
- if (get_jenv_res == JNI_EDETACHED) {
- DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
- } else {
- DO_ASSERT(get_jenv_res == JNI_OK);
- }
- int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
- (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
- jobject obj = (*env)->NewLocalRef(env, j_calls->o);
- CHECK(obj != NULL);
- uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
- if ((*env)->ExceptionCheck(env)) {
- (*env)->ExceptionDescribe(env);
- (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
- }
- LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
- ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
- if (get_jenv_res == JNI_EDETACHED) {
- DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
- }
- return ret_conv;
-}
-static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
- LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
- atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
-}
-static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
- jclass c = (*env)->GetObjectClass(env, o);
- CHECK(c != NULL);
- LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
- atomic_init(&calls->refcnt, 1);
- DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
- calls->o = (*env)->NewWeakGlobalRef(env, o);
- calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
- CHECK(calls->get_utxo_meth != NULL);
-
- LDKAccess ret = {
- .this_arg = (void*) calls,
- .get_utxo = get_utxo_LDKAccess_jcall,
- .free = LDKAccess_JCalls_free,
- };
- return ret;
-}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
- LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
- *res_ptr = LDKAccess_init(env, clz, o);
- return (uint64_t)res_ptr;
-}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Access_1get_1utxo(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
- LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
- unsigned char genesis_hash_arr[32];
- CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
- (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
- unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
- LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
- *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
- return (uint64_t)ret_conv;
-}
-
typedef struct LDKListen_JCalls {
atomic_size_t refcnt;
JavaVM *vm;
(this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
}
-JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
- LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
- LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
- jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
- ;
- for (size_t i = 0; i < ret_var.datalen; i++) {
- int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
- (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
- (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
- }
- FREE(ret_var.data);
- return ret_arr;
-}
-
-typedef struct LDKFilter_JCalls {
- atomic_size_t refcnt;
- JavaVM *vm;
- jweak o;
- jmethodID register_tx_meth;
- jmethodID register_output_meth;
-} LDKFilter_JCalls;
-static void LDKFilter_JCalls_free(void* this_arg) {
- LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
- if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
- JNIEnv *env;
- jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
- if (get_jenv_res == JNI_EDETACHED) {
- DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
- } else {
- DO_ASSERT(get_jenv_res == JNI_OK);
- }
- (*env)->DeleteWeakGlobalRef(env, j_calls->o);
- if (get_jenv_res == JNI_EDETACHED) {
- DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
- }
- FREE(j_calls);
- }
-}
-void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
- LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
- JNIEnv *env;
- jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
- if (get_jenv_res == JNI_EDETACHED) {
- DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
- } else {
- DO_ASSERT(get_jenv_res == JNI_OK);
- }
- int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
- (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
- LDKu8slice script_pubkey_var = script_pubkey;
- int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
- (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
- jobject obj = (*env)->NewLocalRef(env, j_calls->o);
- CHECK(obj != NULL);
- (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
- if ((*env)->ExceptionCheck(env)) {
- (*env)->ExceptionDescribe(env);
- (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
- }
- if (get_jenv_res == JNI_EDETACHED) {
- DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
- }
-}
-LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
- LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
- JNIEnv *env;
- jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
- if (get_jenv_res == JNI_EDETACHED) {
- DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
- } else {
- DO_ASSERT(get_jenv_res == JNI_OK);
- }
- LDKWatchedOutput output_var = output;
- CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t output_ref = (uint64_t)output_var.inner;
- if (output_var.is_owned) {
- output_ref |= 1;
- }
- jobject obj = (*env)->NewLocalRef(env, j_calls->o);
- CHECK(obj != NULL);
- uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
- if ((*env)->ExceptionCheck(env)) {
- (*env)->ExceptionDescribe(env);
- (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
- }
- LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
- ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
- if (get_jenv_res == JNI_EDETACHED) {
- DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
- }
- return ret_conv;
-}
-static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
- LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
- atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
-}
-static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
- jclass c = (*env)->GetObjectClass(env, o);
- CHECK(c != NULL);
- LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
- atomic_init(&calls->refcnt, 1);
- DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
- calls->o = (*env)->NewWeakGlobalRef(env, o);
- calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
- CHECK(calls->register_tx_meth != NULL);
- calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
- CHECK(calls->register_output_meth != NULL);
-
- LDKFilter ret = {
- .this_arg = (void*) calls,
- .register_tx = register_tx_LDKFilter_jcall,
- .register_output = register_output_LDKFilter_jcall,
- .free = LDKFilter_JCalls_free,
- };
- return ret;
-}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
- LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
- *res_ptr = LDKFilter_init(env, clz, o);
- return (uint64_t)res_ptr;
-}
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
- LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
- unsigned char txid_arr[32];
- CHECK((*env)->GetArrayLength(env, txid) == 32);
- (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
- unsigned char (*txid_ref)[32] = &txid_arr;
- LDKu8slice script_pubkey_ref;
- script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
- script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
- (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
- (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
-}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
- LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
- LDKWatchedOutput output_conv;
- output_conv.inner = (void*)(output & (~1));
- output_conv.is_owned = (output & 1) || (output == 0);
- output_conv = WatchedOutput_clone(&output_conv);
- LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
- *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
- uint64_t ret_ref = (uint64_t)ret_copy;
- return ret_ref;
+JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
+ LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
+ jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
+ ;
+ for (size_t i = 0; i < ret_var.datalen; i++) {
+ int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
+ (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
+ (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
+ }
+ FREE(ret_var.data);
+ return ret_arr;
}
typedef struct LDKPersist_JCalls {
jmethodID handle_node_announcement_meth;
jmethodID handle_channel_announcement_meth;
jmethodID handle_channel_update_meth;
- jmethodID handle_htlc_fail_channel_update_meth;
jmethodID get_next_channel_announcements_meth;
jmethodID get_next_node_announcements_meth;
jmethodID sync_routing_table_meth;
}
return ret_conv;
}
-void handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
- LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
- JNIEnv *env;
- jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
- if (get_jenv_res == JNI_EDETACHED) {
- DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
- } else {
- DO_ASSERT(get_jenv_res == JNI_OK);
- }
- uint64_t ret_update = (uint64_t)update;
- jobject obj = (*env)->NewLocalRef(env, j_calls->o);
- CHECK(obj != NULL);
- (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
- if ((*env)->ExceptionCheck(env)) {
- (*env)->ExceptionDescribe(env);
- (*env)->FatalError(env, "A call to handle_htlc_fail_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
- }
- if (get_jenv_res == JNI_EDETACHED) {
- DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
- }
-}
LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
JNIEnv *env;
CHECK(calls->handle_channel_announcement_meth != NULL);
calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
CHECK(calls->handle_channel_update_meth != NULL);
- calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
- CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
CHECK(calls->get_next_channel_announcements_meth != NULL);
calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
.handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
.handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
.handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
- .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall,
.get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
.get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
.sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
*ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
return (uint64_t)ret_conv;
}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
- LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
- LDKChannelUpdate msg_conv;
- msg_conv.inner = (void*)(msg & (~1));
- msg_conv.is_owned = false;
- LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
- *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
- return (uint64_t)ret_conv;
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
+ LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
+ LDKChannelUpdate msg_conv;
+ msg_conv.inner = (void*)(msg & (~1));
+ msg_conv.is_owned = false;
+ LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
+ *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1channel_1announcements(JNIEnv *env, jclass clz, int64_t this_arg, int64_t starting_point, int8_t batch_amount) {
+ LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
+ LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
+ int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
+ int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
+ for (size_t l = 0; l < ret_var.datalen; l++) {
+ LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
+ *ret_conv_63_ref = ret_var.data[l];
+ ret_arr_ptr[l] = (uint64_t)ret_conv_63_ref;
+ }
+ (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
+JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1node_1announcements(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
+ LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
+ LDKPublicKey starting_point_ref;
+ CHECK((*env)->GetArrayLength(env, starting_point) == 33);
+ (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
+ LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
+ int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
+ int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
+ for (size_t s = 0; s < ret_var.datalen; s++) {
+ LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
+ CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
+ if (ret_conv_18_var.is_owned) {
+ ret_conv_18_ref |= 1;
+ }
+ ret_arr_ptr[s] = ret_conv_18_ref;
+ }
+ (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1sync_1routing_1table(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init) {
+ LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
+ LDKPublicKey their_node_id_ref;
+ CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
+ (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
+ LDKInit init_conv;
+ init_conv.inner = (void*)(init & (~1));
+ init_conv.is_owned = false;
+ (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1reply_1channel_1range(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
+ LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
+ LDKPublicKey their_node_id_ref;
+ CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
+ (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
+ LDKReplyChannelRange msg_conv;
+ msg_conv.inner = (void*)(msg & (~1));
+ msg_conv.is_owned = (msg & 1) || (msg == 0);
+ msg_conv = ReplyChannelRange_clone(&msg_conv);
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1reply_1short_1channel_1ids_1end(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
+ LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
+ LDKPublicKey their_node_id_ref;
+ CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
+ (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
+ LDKReplyShortChannelIdsEnd msg_conv;
+ msg_conv.inner = (void*)(msg & (~1));
+ msg_conv.is_owned = (msg & 1) || (msg == 0);
+ msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1query_1channel_1range(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
+ LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
+ LDKPublicKey their_node_id_ref;
+ CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
+ (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
+ LDKQueryChannelRange msg_conv;
+ msg_conv.inner = (void*)(msg & (~1));
+ msg_conv.is_owned = (msg & 1) || (msg == 0);
+ msg_conv = QueryChannelRange_clone(&msg_conv);
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1query_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
+ LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
+ LDKPublicKey their_node_id_ref;
+ CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
+ (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
+ LDKQueryShortChannelIds msg_conv;
+ msg_conv.inner = (void*)(msg & (~1));
+ msg_conv.is_owned = (msg & 1) || (msg == 0);
+ msg_conv = QueryShortChannelIds_clone(&msg_conv);
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
+ return (uint64_t)ret_conv;
+}
+
+typedef struct LDKCustomMessageReader_JCalls {
+ atomic_size_t refcnt;
+ JavaVM *vm;
+ jweak o;
+ jmethodID read_meth;
+} LDKCustomMessageReader_JCalls;
+static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
+ LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
+ if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ (*env)->DeleteWeakGlobalRef(env, j_calls->o);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ FREE(j_calls);
+ }
+}
+LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
+ LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ LDKu8slice buffer_var = buffer;
+ int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
+ (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
+ jobject obj = (*env)->NewLocalRef(env, j_calls->o);
+ CHECK(obj != NULL);
+ uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type, buffer_arr);
+ if ((*env)->ExceptionCheck(env)) {
+ (*env)->ExceptionDescribe(env);
+ (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
+ }
+ LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1);
+ ret_conv = CResult_COption_TypeZDecodeErrorZ_clone((LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1));
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ return ret_conv;
+}
+static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
+ LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
+ atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
+}
+static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
+ jclass c = (*env)->GetObjectClass(env, o);
+ CHECK(c != NULL);
+ LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
+ atomic_init(&calls->refcnt, 1);
+ DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
+ calls->o = (*env)->NewWeakGlobalRef(env, o);
+ calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
+ CHECK(calls->read_meth != NULL);
+
+ LDKCustomMessageReader ret = {
+ .this_arg = (void*) calls,
+ .read = read_LDKCustomMessageReader_jcall,
+ .free = LDKCustomMessageReader_JCalls_free,
+ };
+ return ret;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
+ LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
+ *res_ptr = LDKCustomMessageReader_init(env, clz, o);
+ return (uint64_t)res_ptr;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1read(JNIEnv *env, jclass clz, int64_t this_arg, int16_t message_type, int8_tArray buffer) {
+ LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)(((uint64_t)this_arg) & ~1);
+ LDKu8slice buffer_ref;
+ buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
+ buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
+ LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
+ *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
+ (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
+ return (uint64_t)ret_conv;
+}
+
+typedef struct LDKCustomMessageHandler_JCalls {
+ atomic_size_t refcnt;
+ JavaVM *vm;
+ jweak o;
+ LDKCustomMessageReader_JCalls* CustomMessageReader;
+ jmethodID handle_custom_message_meth;
+ jmethodID get_and_clear_pending_msg_meth;
+} LDKCustomMessageHandler_JCalls;
+static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
+ LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
+ if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ (*env)->DeleteWeakGlobalRef(env, j_calls->o);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ FREE(j_calls);
+ }
+}
+LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
+ LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ LDKType* msg_ret =MALLOC(sizeof(LDKType), "LDKType");
+ *msg_ret = msg;
+ int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
+ (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
+ jobject obj = (*env)->NewLocalRef(env, j_calls->o);
+ CHECK(obj != NULL);
+ uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, (uint64_t)msg_ret, sender_node_id_arr);
+ if ((*env)->ExceptionCheck(env)) {
+ (*env)->ExceptionDescribe(env);
+ (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
+ }
+ LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
+ ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ return ret_conv;
+}
+LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
+ LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ jobject obj = (*env)->NewLocalRef(env, j_calls->o);
+ CHECK(obj != NULL);
+ int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
+ if ((*env)->ExceptionCheck(env)) {
+ (*env)->ExceptionDescribe(env);
+ (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
+ }
+ LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
+ ret_constr.datalen = (*env)->GetArrayLength(env, ret);
+ if (ret_constr.datalen > 0)
+ ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
+ else
+ ret_constr.data = NULL;
+ int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
+ for (size_t y = 0; y < ret_constr.datalen; y++) {
+ int64_t ret_conv_24 = ret_vals[y];
+ LDKC2Tuple_PublicKeyTypeZ ret_conv_24_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_24) & ~1);
+ ret_conv_24_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_24) & ~1));
+ ret_constr.data[y] = ret_conv_24_conv;
+ }
+ (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ return ret_constr;
+}
+static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
+ LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
+ atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
+ atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
}
+static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
+ jclass c = (*env)->GetObjectClass(env, o);
+ CHECK(c != NULL);
+ LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
+ atomic_init(&calls->refcnt, 1);
+ DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
+ calls->o = (*env)->NewWeakGlobalRef(env, o);
+ calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
+ CHECK(calls->handle_custom_message_meth != NULL);
+ calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
+ CHECK(calls->get_and_clear_pending_msg_meth != NULL);
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t update) {
- LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
- LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
- (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
+ LDKCustomMessageHandler ret = {
+ .this_arg = (void*) calls,
+ .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
+ .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
+ .free = LDKCustomMessageHandler_JCalls_free,
+ .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
+ };
+ calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
+ return ret;
}
-
-JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1channel_1announcements(JNIEnv *env, jclass clz, int64_t this_arg, int64_t starting_point, int8_t batch_amount) {
- LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
- LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
- int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
- int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
- for (size_t l = 0; l < ret_var.datalen; l++) {
- LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
- *ret_conv_63_ref = ret_var.data[l];
- ret_arr_ptr[l] = (uint64_t)ret_conv_63_ref;
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
+ LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
+ *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
+ return (uint64_t)res_ptr;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
+ LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)(arg & ~1);
+ uint64_t res_ptr = (uint64_t)&inp->CustomMessageReader;
+ DO_ASSERT((res_ptr & 1) == 0);
+ return (int64_t)(res_ptr | 1);
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1handle_1custom_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg, int8_tArray sender_node_id) {
+ LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)(((uint64_t)this_arg) & ~1);
+ LDKType msg_conv = *(LDKType*)(((uint64_t)msg) & ~1);
+ if (msg_conv.free == LDKType_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKType_JCalls_cloned(&msg_conv);
}
- (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
- FREE(ret_var.data);
- return ret_arr;
+ LDKPublicKey sender_node_id_ref;
+ CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
+ (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
+ return (uint64_t)ret_conv;
}
-JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1node_1announcements(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
- LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
- LDKPublicKey starting_point_ref;
- CHECK((*env)->GetArrayLength(env, starting_point) == 33);
- (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
- LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
+JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)(((uint64_t)this_arg) & ~1);
+ LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
- for (size_t s = 0; s < ret_var.datalen; s++) {
- LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
- CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
- if (ret_conv_18_var.is_owned) {
- ret_conv_18_ref |= 1;
- }
- ret_arr_ptr[s] = ret_conv_18_ref;
+ for (size_t y = 0; y < ret_var.datalen; y++) {
+ LDKC2Tuple_PublicKeyTypeZ* ret_conv_24_ref = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
+ *ret_conv_24_ref = ret_var.data[y];
+ ret_arr_ptr[y] = (uint64_t)ret_conv_24_ref;
}
(*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
FREE(ret_var.data);
return ret_arr;
}
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1sync_1routing_1table(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init) {
- LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
- LDKPublicKey their_node_id_ref;
- CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
- (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
- LDKInit init_conv;
- init_conv.inner = (void*)(init & (~1));
- init_conv.is_owned = false;
- (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
-}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1reply_1channel_1range(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
- LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
- LDKPublicKey their_node_id_ref;
- CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
- (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
- LDKReplyChannelRange msg_conv;
- msg_conv.inner = (void*)(msg & (~1));
- msg_conv.is_owned = (msg & 1) || (msg == 0);
- msg_conv = ReplyChannelRange_clone(&msg_conv);
- LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
- *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
- return (uint64_t)ret_conv;
-}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1reply_1short_1channel_1ids_1end(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
- LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
- LDKPublicKey their_node_id_ref;
- CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
- (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
- LDKReplyShortChannelIdsEnd msg_conv;
- msg_conv.inner = (void*)(msg & (~1));
- msg_conv.is_owned = (msg & 1) || (msg == 0);
- msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
- LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
- *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
- return (uint64_t)ret_conv;
-}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1query_1channel_1range(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
- LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
- LDKPublicKey their_node_id_ref;
- CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
- (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
- LDKQueryChannelRange msg_conv;
- msg_conv.inner = (void*)(msg & (~1));
- msg_conv.is_owned = (msg & 1) || (msg == 0);
- msg_conv = QueryChannelRange_clone(&msg_conv);
- LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
- *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
- return (uint64_t)ret_conv;
-}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1query_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
- LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
- LDKPublicKey their_node_id_ref;
- CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
- (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
- LDKQueryShortChannelIds msg_conv;
- msg_conv.inner = (void*)(msg & (~1));
- msg_conv.is_owned = (msg & 1) || (msg == 0);
- msg_conv = QueryShortChannelIds_clone(&msg_conv);
- LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
- *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
- return (uint64_t)ret_conv;
-}
-
typedef struct LDKSocketDescriptor_JCalls {
atomic_size_t refcnt;
JavaVM *vm;
return (uint64_t)ret_conv;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
+ LDKTrustedClosingTransaction o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = (o & 1) || (o == 0);
+ // Warning: we need a move here but no clone is available for LDKTrustedClosingTransaction
+ LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
+ *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
+ LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
+ *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
LDKCommitmentTransaction o_conv;
o_conv.inner = (void*)(o & (~1));
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
+ o_conv = TxOut_clone((LDKTxOut*)(((uint64_t)o) & ~1));
LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
*ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
return (uint64_t)ret_conv;
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1);
+ o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1));
LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
*ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
uint64_t ret_ref = (uint64_t)ret_copy;
return ret_ref;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
+ LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(((uint64_t)o) & ~1);
+ o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uint64_t)o) & ~1));
+ LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
+ *ret_copy = COption_NetworkUpdateZ_some(o_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
+ LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
+ *ret_copy = COption_NetworkUpdateZ_none();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ COption_NetworkUpdateZ_free(_res_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
+ LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
+ *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
LDKCVec_SpendableOutputDescriptorZ _res_constr;
_res_constr.datalen = (*env)->GetArrayLength(env, _res);
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
+ o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1));
LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
*ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
return (uint64_t)ret_conv;
return (uint64_t)ret_conv;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
+ LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
+ *ret_conv = CResult_NoneNoneZ_ok();
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
+ LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
+ *ret_conv = CResult_NoneNoneZ_err();
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ CResult_NoneNoneZ_free(_res_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
+ LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
+ *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
+ return (uint64_t)ret_conv;
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
+ o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1));
LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
*ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
return (uint64_t)ret_conv;
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
+ e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
*ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
return (uint64_t)ret_conv;
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
+ e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
*ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
return (uint64_t)ret_conv;
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
+ e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
*ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
return (uint64_t)ret_conv;
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
+ e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
*ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
return (uint64_t)ret_conv;
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
+ // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
*ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
return (uint64_t)ret_conv;
return (uint64_t)ret_conv;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
+ LDKType o_conv = *(LDKType*)(((uint64_t)o) & ~1);
+ if (o_conv.free == LDKType_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKType_JCalls_cloned(&o_conv);
+ }
+ LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
+ *ret_copy = COption_TypeZ_some(o_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
+ LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
+ *ret_copy = COption_TypeZ_none();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ COption_TypeZ_free(_res_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
+ LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
+ *ret_copy = COption_TypeZ_clone(orig_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
+ LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(((uint64_t)o) & ~1);
+ o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uint64_t)o) & ~1));
+ LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
+ *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
+ LDKDecodeError e_conv;
+ e_conv.inner = (void*)(e & (~1));
+ e_conv.is_owned = (e & 1) || (e == 0);
+ e_conv = DecodeError_clone(&e_conv);
+ LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
+ *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
+ LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
+ *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
+ return (uint64_t)ret_conv;
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
+ b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
*ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
return (uint64_t)ret_ref;
CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
}
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
+ LDKCVec_BalanceZ _res_constr;
+ _res_constr.datalen = (*env)->GetArrayLength(env, _res);
+ if (_res_constr.datalen > 0)
+ _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
+ else
+ _res_constr.data = NULL;
+ int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
+ for (size_t j = 0; j < _res_constr.datalen; j++) {
+ int64_t _res_conv_9 = _res_vals[j];
+ LDKBalance _res_conv_9_conv = *(LDKBalance*)(((uint64_t)_res_conv_9) & ~1);
+ FREE((void*)_res_conv_9);
+ _res_constr.data[j] = _res_conv_9_conv;
+ }
+ (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
+ CVec_BalanceZ_free(_res_constr);
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
+ // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
*ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
return (uint64_t)ret_conv;
CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = CResult_NoneLightningErrorZ_ok();
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
+ LDKLightningError e_conv;
+ e_conv.inner = (void*)(e & (~1));
+ e_conv.is_owned = (e & 1) || (e == 0);
+ e_conv = LightningError_clone(&e_conv);
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ CResult_NoneLightningErrorZ_free(_res_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
+ LDKC2Tuple_PublicKeyTypeZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
+ *ret_ref = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
+ return (uint64_t)ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
+ LDKPublicKey a_ref;
+ CHECK((*env)->GetArrayLength(env, a) == 33);
+ (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
+ LDKType b_conv = *(LDKType*)(((uint64_t)b) & ~1);
+ if (b_conv.free == LDKType_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKType_JCalls_cloned(&b_conv);
+ }
+ LDKC2Tuple_PublicKeyTypeZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
+ *ret_ref = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
+ return (uint64_t)ret_ref;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ C2Tuple_PublicKeyTypeZ_free(_res_conv);
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
+ LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
+ _res_constr.datalen = (*env)->GetArrayLength(env, _res);
+ if (_res_constr.datalen > 0)
+ _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
+ else
+ _res_constr.data = NULL;
+ int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
+ for (size_t y = 0; y < _res_constr.datalen; y++) {
+ int64_t _res_conv_24 = _res_vals[y];
+ LDKC2Tuple_PublicKeyTypeZ _res_conv_24_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)_res_conv_24) & ~1);
+ FREE((void*)_res_conv_24);
+ _res_constr.data[y] = _res_conv_24_conv;
+ }
+ (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
+ CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
*ret_conv = CResult_boolLightningErrorZ_ok(o);
CVec_NodeAnnouncementZ_free(_res_constr);
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
- LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
- *ret_conv = CResult_NoneLightningErrorZ_ok();
- return (uint64_t)ret_conv;
-}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
- LDKLightningError e_conv;
- e_conv.inner = (void*)(e & (~1));
- e_conv.is_owned = (e & 1) || (e == 0);
- e_conv = LightningError_clone(&e_conv);
- LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
- *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
- return (uint64_t)ret_conv;
-}
-
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
- if ((_res & 1) != 0) return;
- LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
- FREE((void*)_res);
- CResult_NoneLightningErrorZ_free(_res_conv);
-}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
- LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
- LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
- *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
- return (uint64_t)ret_conv;
-}
-
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
LDKCVec_PublicKeyZ _res_constr;
_res_constr.datalen = (*env)->GetArrayLength(env, _res);
return (uint64_t)ret_conv;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some(JNIEnv *env, jclass clz, int64_t o) {
+ LDKAccess o_conv = *(LDKAccess*)(((uint64_t)o) & ~1);
+ if (o_conv.free == LDKAccess_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKAccess_JCalls_cloned(&o_conv);
+ }
+ LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
+ *ret_copy = COption_AccessZ_some(o_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none(JNIEnv *env, jclass clz) {
+ LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
+ *ret_copy = COption_AccessZ_none();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ COption_AccessZ_free(_res_conv);
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
LDKDirectionalChannelInfo o_conv;
o_conv.inner = (void*)(o & (~1));
LDKNetworkGraph o_conv;
o_conv.inner = (void*)(o & (~1));
o_conv.is_owned = (o & 1) || (o == 0);
- o_conv = NetworkGraph_clone(&o_conv);
+ // Warning: we need a move here but no clone is available for LDKNetworkGraph
LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
*ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
return (uint64_t)ret_conv;
CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
- LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
- LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
- *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
- return (uint64_t)ret_conv;
-}
-
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv *env, jclass clz, int64_t o) {
LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
+ o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
*ret_conv = CResult_NetAddressu8Z_ok(o_conv);
return (uint64_t)ret_conv;
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
+ o_conv = CResult_NetAddressu8Z_clone((LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1));
LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
*ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
return (uint64_t)ret_conv;
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
+ o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
*ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
return (uint64_t)ret_conv;
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(((uint64_t)e) & ~1);
+ e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uint64_t)e) & ~1));
LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
*ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
return (uint64_t)ret_conv;
return (uint64_t)ret_conv;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
+ LDKFilter o_conv = *(LDKFilter*)(((uint64_t)o) & ~1);
+ if (o_conv.free == LDKFilter_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKFilter_JCalls_cloned(&o_conv);
+ }
+ LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
+ *ret_copy = COption_FilterZ_some(o_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
+ LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
+ *ret_copy = COption_FilterZ_none();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ COption_FilterZ_free(_res_conv);
+}
+
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
if ((this_ptr & 1) != 0) return;
LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(((uint64_t)this_ptr) & ~1);
return ret_ref;
}
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ if ((this_ptr & 1) != 0) return;
+ LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(((uint64_t)this_ptr) & ~1);
+ FREE((void*)this_ptr);
+ ClosureReason_free(this_ptr_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_clone(orig_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, jstring peer_msg) {
+ LDKStr peer_msg_conv = java_to_owned_str(env, peer_msg);
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_holder_force_closed();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_cooperative_closure();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_commitment_tx_confirmed();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
+ LDKStr err_conv = java_to_owned_str(env, err);
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_processing_error(err_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_disconnected_peer();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_outdated_channel_manager();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
+ LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
+ LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
+ int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
+ (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
if ((this_ptr & 1) != 0) return;
LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
(*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(((uint64_t)purpose) & ~1);
+ purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uint64_t)purpose) & ~1));
LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
*ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
uint64_t ret_ref = (uint64_t)ret_copy;
return ret_ref;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1failed(JNIEnv *env, jclass clz, int8_tArray payment_hash, jboolean rejected_by_dest) {
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed(JNIEnv *env, jclass clz, int8_tArray payment_hash, jboolean rejected_by_dest, int64_t network_update, jboolean all_paths_failed, int64_tArray path) {
LDKThirtyTwoBytes payment_hash_ref;
CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
(*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
+ LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1);
+ network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1));
+ LDKCVec_RouteHopZ path_constr;
+ path_constr.datalen = (*env)->GetArrayLength(env, path);
+ if (path_constr.datalen > 0)
+ path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
+ else
+ path_constr.data = NULL;
+ int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
+ for (size_t k = 0; k < path_constr.datalen; k++) {
+ int64_t path_conv_10 = path_vals[k];
+ LDKRouteHop path_conv_10_conv;
+ path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
+ path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
+ path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
+ path_constr.data[k] = path_conv_10_conv;
+ }
+ (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
- *ret_copy = Event_payment_failed(payment_hash_ref, rejected_by_dest);
+ *ret_copy = Event_payment_path_failed(payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr);
uint64_t ret_ref = (uint64_t)ret_copy;
return ret_ref;
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1forwarded(JNIEnv *env, jclass clz, int64_t fee_earned_msat, jboolean claim_from_onchain_tx) {
LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1);
+ fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1));
LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
*ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
uint64_t ret_ref = (uint64_t)ret_copy;
return ret_ref;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1closed(JNIEnv *env, jclass clz, int8_tArray channel_id, int64_t reason) {
+ LDKThirtyTwoBytes channel_id_ref;
+ CHECK((*env)->GetArrayLength(env, channel_id) == 32);
+ (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
+ LDKClosureReason reason_conv = *(LDKClosureReason*)(((uint64_t)reason) & ~1);
+ reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1));
+ LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+ *ret_copy = Event_channel_closed(channel_id_ref, reason_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
LDKEvent* obj_conv = (LDKEvent*)obj;
LDKCVec_u8Z ret_var = Event_write(obj_conv);
CHECK((*env)->GetArrayLength(env, node_id) == 33);
(*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
LDKErrorAction action_conv = *(LDKErrorAction*)(((uint64_t)action) & ~1);
+ action_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action) & ~1));
LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
*ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
uint64_t ret_ref = (uint64_t)ret_copy;
return ret_ref;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1payment_1failure_1network_1update(JNIEnv *env, jclass clz, int64_t update) {
- LDKHTLCFailChannelUpdate update_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)update) & ~1);
- LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
- *ret_copy = MessageSendEvent_payment_failure_network_update(update_conv);
- uint64_t ret_ref = (uint64_t)ret_copy;
- return ret_ref;
-}
-
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1range_1query(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
LDKPublicKey node_id_ref;
CHECK((*env)->GetArrayLength(env, node_id) == 33);
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv *env, jclass clz, int64_t chain_source, int64_t broadcaster, int64_t logger, int64_t feeest, int64_t persister) {
- LDKFilter *chain_source_conv_ptr = NULL;
- if (chain_source != 0) {
- LDKFilter chain_source_conv;
- chain_source_conv = *(LDKFilter*)(((uint64_t)chain_source) & ~1);
- if (chain_source_conv.free == LDKFilter_JCalls_free) {
+ LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(((uint64_t)chain_source) & ~1);
+ // Warning: we may need a move here but no clone is available for LDKCOption_FilterZ
+ if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
+ // Manually implement clone for Java trait instances
+ if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
// If this_arg is a JCalls struct, then we need to increment the refcnt in it.
- LDKFilter_JCalls_cloned(&chain_source_conv);
+ LDKFilter_JCalls_cloned(&chain_source_conv.some);
}
- chain_source_conv_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
- *chain_source_conv_ptr = chain_source_conv;
}
LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
// If this_arg is a JCalls struct, then we need to increment the refcnt in it.
LDKPersist_JCalls_cloned(&persister_conv);
}
- LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv_ptr, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
+ LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_ref;
}
+JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray ignored_channels) {
+ LDKChainMonitor this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKCVec_ChannelDetailsZ ignored_channels_constr;
+ ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
+ if (ignored_channels_constr.datalen > 0)
+ ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
+ else
+ ignored_channels_constr.data = NULL;
+ int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
+ for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
+ int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
+ LDKChannelDetails ignored_channels_conv_16_conv;
+ ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
+ ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
+ ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
+ ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
+ }
+ (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
+ LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
+ int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
+ int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
+ for (size_t j = 0; j < ret_var.datalen; j++) {
+ LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
+ *ret_conv_9_copy = Balance_clone(&ret_var.data[j]);
+ uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
+ ret_arr_ptr[j] = ret_conv_9_ref;
+ }
+ (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKChainMonitor this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
- *ret = ChainMonitor_as_Listen(&this_arg_conv);
- return (uint64_t)ret;
+ LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
+ *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKChainMonitor this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
- *ret = ChainMonitor_as_Confirm(&this_arg_conv);
- return (uint64_t)ret;
+ LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
+ *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKChainMonitor this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
- *ret = ChainMonitor_as_Watch(&this_arg_conv);
- return (uint64_t)ret;
+ LDKWatch* ret_ret =MALLOC(sizeof(LDKWatch), "LDKWatch");
+ *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKChainMonitor this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
- *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
- return (uint64_t)ret;
+ LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
+ *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
return ret_ref;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1broadcasted(JNIEnv *env, jclass clz, int64_t a) {
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz, int64_t a) {
LDKOutPoint a_conv;
a_conv.inner = (void*)(a & (~1));
a_conv.is_owned = (a & 1) || (a == 0);
a_conv = OutPoint_clone(&a_conv);
LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
- *ret_copy = MonitorEvent_commitment_tx_broadcasted(a_conv);
+ *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
uint64_t ret_ref = (uint64_t)ret_copy;
return ret_ref;
}
return (uint64_t)ret_conv;
}
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ if ((this_ptr & 1) != 0) return;
+ LDKBalance this_ptr_conv = *(LDKBalance*)(((uint64_t)this_ptr) & ~1);
+ FREE((void*)this_ptr);
+ Balance_free(this_ptr_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKBalance* orig_conv = (LDKBalance*)orig;
+ LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
+ *ret_copy = Balance_clone(orig_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis) {
+ LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
+ *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1awaiting_1confirmations(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis, int32_t confirmation_height) {
+ LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
+ *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1contentious_1claimable(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis, int32_t timeout_height) {
+ LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
+ *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1maybe_1claimable_1htlcawaiting_1timeout(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis, int32_t claimable_height) {
+ LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
+ *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
+ LDKBalance* a_conv = (LDKBalance*)a;
+ LDKBalance* b_conv = (LDKBalance*)b;
+ jboolean ret_val = Balance_eq(a_conv, b_conv);
+ return ret_val;
+}
+
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
LDKChannelMonitor this_obj_conv;
this_obj_conv.inner = (void*)(this_obj & (~1));
return ret_ref;
}
+JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKChannelMonitor this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
+ int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
+ int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
+ for (size_t j = 0; j < ret_var.datalen; j++) {
+ LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
+ *ret_conv_9_copy = Balance_clone(&ret_var.data[j]);
+ uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
+ ret_arr_ptr[j] = ret_conv_9_ref;
+ }
+ (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
if ((this_ptr & 1) != 0) return;
LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
+ val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
}
CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
(*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
+ output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
LDKPublicKey revocation_pubkey_arg_ref;
CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
(*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
+ val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
}
outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
+ output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
LDKThirtyTwoBytes channel_keys_id_arg_ref;
CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
(*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
outpoint_conv = OutPoint_clone(&outpoint_conv);
LDKTxOut output_conv = *(LDKTxOut*)(((uint64_t)output) & ~1);
+ output_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output) & ~1));
LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
*ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
uint64_t ret_ref = (uint64_t)ret_copy;
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
- LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
- *ret = Sign_clone(orig_conv);
- return (uint64_t)ret;
+ LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
+ *ret_ret = Sign_clone(orig_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
LDKInMemorySigner this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKBaseSign* ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
- *ret = InMemorySigner_as_BaseSign(&this_arg_conv);
- return (uint64_t)ret;
+ LDKBaseSign* ret_ret =MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
+ *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKInMemorySigner this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
- *ret = InMemorySigner_as_Sign(&this_arg_conv);
- return (uint64_t)ret;
+ LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
+ *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
LDKKeysManager this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
- *ret = KeysManager_as_KeysInterface(&this_arg_conv);
- return (uint64_t)ret;
+ LDKKeysInterface* ret_ret =MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
+ *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
return ret_ref;
}
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+ LDKCounterpartyForwardingInfo this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ CounterpartyForwardingInfo_free(this_obj_conv);
+}
+
+JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ LDKCounterpartyForwardingInfo this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
+ return ret_val;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
+ LDKCounterpartyForwardingInfo this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
+}
+
+JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ LDKCounterpartyForwardingInfo this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
+ return ret_val;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
+ LDKCounterpartyForwardingInfo this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
+}
+
+JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ LDKCounterpartyForwardingInfo this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
+ return ret_val;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
+ LDKCounterpartyForwardingInfo this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1new(JNIEnv *env, jclass clz, int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg) {
+ LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKCounterpartyForwardingInfo orig_conv;
+ orig_conv.inner = (void*)(orig & (~1));
+ orig_conv.is_owned = false;
+ LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
LDKChannelCounterparty this_obj_conv;
this_obj_conv.inner = (void*)(this_obj & (~1));
ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ LDKChannelCounterparty this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
+ LDKChannelCounterparty this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCounterpartyForwardingInfo val_conv;
+ val_conv.inner = (void*)(val & (~1));
+ val_conv.is_owned = (val & 1) || (val == 0);
+ val_conv = CounterpartyForwardingInfo_clone(&val_conv);
+ ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1new(JNIEnv *env, jclass clz, int8_tArray node_id_arg, int64_t features_arg, int64_t unspendable_punishment_reserve_arg, int64_t forwarding_info_arg) {
+ LDKPublicKey node_id_arg_ref;
+ CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
+ (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
+ LDKInitFeatures features_arg_conv;
+ features_arg_conv.inner = (void*)(features_arg & (~1));
+ features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
+ features_arg_conv = InitFeatures_clone(&features_arg_conv);
+ LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
+ forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
+ forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
+ forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
+ LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
LDKChannelCounterparty orig_conv;
orig_conv.inner = (void*)(orig & (~1));
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)val) & ~1));
ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
}
funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1);
+ short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1));
LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1);
+ confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1));
LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1);
+ force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1));
LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_id_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
LDKAPIError a_conv = *(LDKAPIError*)(((uint64_t)a) & ~1);
+ a_conv = APIError_clone((LDKAPIError*)(((uint64_t)a) & ~1));
LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
*ret_copy = PaymentSendFailure_parameter_error(a_conv);
uint64_t ret_ref = (uint64_t)ret_copy;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
+ min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
*ret_ref = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
return (uint64_t)ret_ref;
CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
(*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
+ min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
*ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
return (uint64_t)ret_conv;
LDKChannelManager this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
- *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
- return (uint64_t)ret;
+ LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
+ *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKChannelManager this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
- *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
- return (uint64_t)ret;
+ LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
+ *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKChannelManager this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
- *ret = ChannelManager_as_Listen(&this_arg_conv);
- return (uint64_t)ret;
+ LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
+ *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKChannelManager this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
- *ret = ChannelManager_as_Confirm(&this_arg_conv);
- return (uint64_t)ret;
+ LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
+ *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
LDKChannelManager this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
- *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
- return (uint64_t)ret;
+ LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
+ *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
+ val_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)val) & ~1));
LightningError_set_action(&this_ptr_conv, val_conv);
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
+ action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action_arg) & ~1));
LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
CommitmentUpdate_free(this_obj_conv);
}
+JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ LDKCommitmentUpdate this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
+ int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
+ int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
+ for (size_t p = 0; p < ret_var.datalen; p++) {
+ LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
+ CHECK((((uint64_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_conv_15_ref = (uint64_t)ret_conv_15_var.inner;
+ if (ret_conv_15_var.is_owned) {
+ ret_conv_15_ref |= 1;
+ }
+ ret_arr_ptr[p] = ret_conv_15_ref;
+ }
+ (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
LDKCommitmentUpdate this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
}
+JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ LDKCommitmentUpdate this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
+ int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
+ int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
+ for (size_t t = 0; t < ret_var.datalen; t++) {
+ LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
+ CHECK((((uint64_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_conv_19_ref = (uint64_t)ret_conv_19_var.inner;
+ if (ret_conv_19_var.is_owned) {
+ ret_conv_19_ref |= 1;
+ }
+ ret_arr_ptr[t] = ret_conv_19_ref;
+ }
+ (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
LDKCommitmentUpdate this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
}
+JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ LDKCommitmentUpdate this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
+ int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
+ int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
+ for (size_t q = 0; q < ret_var.datalen; q++) {
+ LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
+ CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
+ if (ret_conv_16_var.is_owned) {
+ ret_conv_16_ref |= 1;
+ }
+ ret_arr_ptr[q] = ret_conv_16_ref;
+ }
+ (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
LDKCommitmentUpdate this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
}
+JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ LDKCommitmentUpdate this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
+ int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
+ int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
+ for (size_t z = 0; z < ret_var.datalen; z++) {
+ LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
+ CHECK((((uint64_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_conv_25_ref = (uint64_t)ret_conv_25_var.inner;
+ if (ret_conv_25_var.is_owned) {
+ ret_conv_25_ref |= 1;
+ }
+ ret_arr_ptr[z] = ret_conv_25_ref;
+ }
+ (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
LDKCommitmentUpdate this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
return ret_ref;
}
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
- if ((this_ptr & 1) != 0) return;
- LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
- FREE((void*)this_ptr);
- HTLCFailChannelUpdate_free(this_ptr_conv);
-}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
- LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
- LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
- *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
- uint64_t ret_ref = (uint64_t)ret_copy;
- return ret_ref;
-}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
- LDKChannelUpdate msg_conv;
- msg_conv.inner = (void*)(msg & (~1));
- msg_conv.is_owned = (msg & 1) || (msg == 0);
- msg_conv = ChannelUpdate_clone(&msg_conv);
- LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
- *ret_copy = HTLCFailChannelUpdate_channel_update_message(msg_conv);
- uint64_t ret_ref = (uint64_t)ret_copy;
- return ret_ref;
-}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1channel_1closed(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
- LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
- *ret_copy = HTLCFailChannelUpdate_channel_closed(short_channel_id, is_permanent);
- uint64_t ret_ref = (uint64_t)ret_copy;
- return ret_ref;
-}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
- LDKPublicKey node_id_ref;
- CHECK((*env)->GetArrayLength(env, node_id) == 33);
- (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
- LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
- *ret_copy = HTLCFailChannelUpdate_node_failure(node_id_ref, is_permanent);
- uint64_t ret_ref = (uint64_t)ret_copy;
- return ret_ref;
-}
-
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
if ((this_ptr & 1) != 0) return;
LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
return ret_arr;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
- LDKu8slice ser_ref;
- ser_ref.datalen = (*env)->GetArrayLength(env, ser);
- ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
- LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
- *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
- (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
- return (uint64_t)ret_conv;
-}
-
JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
LDKReplyShortChannelIdsEnd obj_conv;
obj_conv.inner = (void*)(obj & (~1));
return ret_arr;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = (*env)->GetArrayLength(env, ser);
+ ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
+ LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
+ *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
+ (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
+ return (uint64_t)ret_conv;
+}
+
JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKQueryChannelRange this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
return ret_val;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
- LDKu8slice ser_ref;
- ser_ref.datalen = (*env)->GetArrayLength(env, ser);
- ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
- LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
- *ret_conv = QueryChannelRange_read(ser_ref);
- (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
- return (uint64_t)ret_conv;
-}
-
JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
LDKQueryChannelRange obj_conv;
obj_conv.inner = (void*)(obj & (~1));
return ret_arr;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = (*env)->GetArrayLength(env, ser);
+ ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
+ LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
+ *ret_conv = QueryChannelRange_read(ser_ref);
+ (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
+ return (uint64_t)ret_conv;
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
LDKu8slice ser_ref;
ser_ref.datalen = (*env)->GetArrayLength(env, ser);
return ret_arr;
}
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
+ LDKGossipTimestampFilter obj_conv;
+ obj_conv.inner = (void*)(obj & (~1));
+ obj_conv.is_owned = false;
+ LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
+ int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
+ (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
LDKu8slice ser_ref;
ser_ref.datalen = (*env)->GetArrayLength(env, ser);
return (uint64_t)ret_conv;
}
-JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
- LDKGossipTimestampFilter obj_conv;
- obj_conv.inner = (void*)(obj & (~1));
- obj_conv.is_owned = false;
- LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
- int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
- (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
- CVec_u8Z_free(ret_var);
- return ret_arr;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ if ((this_ptr & 1) != 0) return;
+ LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(((uint64_t)this_ptr) & ~1);
+ FREE((void*)this_ptr);
+ CustomMessageHandler_free(this_ptr_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
LDKIgnoringMessageHandler this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
- *ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
- return (uint64_t)ret;
+ LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
+ *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKIgnoringMessageHandler this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
- *ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
- return (uint64_t)ret;
+ LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
+ *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
+ return (uint64_t)ret_ret;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKIgnoringMessageHandler this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKCustomMessageReader* ret_ret =MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
+ *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
+ return (uint64_t)ret_ret;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKIgnoringMessageHandler this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKCustomMessageHandler* ret_ret =MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
+ *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
LDKErroringMessageHandler this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
- *ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
- return (uint64_t)ret;
+ LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
+ *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKErroringMessageHandler this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
- *ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
- return (uint64_t)ret;
+ LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
+ *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
- LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
- *ret = SocketDescriptor_clone(orig_conv);
- return (uint64_t)ret;
+ LDKSocketDescriptor* ret_ret =MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
+ *ret_ret = SocketDescriptor_clone(orig_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
PeerManager_free(this_obj_conv);
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv *env, jclass clz, int64_t message_handler, int8_tArray our_node_secret, int8_tArray ephemeral_random_data, int64_t logger) {
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv *env, jclass clz, int64_t message_handler, int8_tArray our_node_secret, int8_tArray ephemeral_random_data, int64_t logger, int64_t custom_message_handler) {
LDKMessageHandler message_handler_conv;
message_handler_conv.inner = (void*)(message_handler & (~1));
message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
// If this_arg is a JCalls struct, then we need to increment the refcnt in it.
LDKLogger_JCalls_cloned(&logger_conv);
}
- LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
+ LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(((uint64_t)custom_message_handler) & ~1);
+ if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
+ }
+ LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_arr;
}
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1closing_1transaction(JNIEnv *env, jclass clz, int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, int64_t funding_outpoint) {
+ LDKCVec_u8Z to_holder_script_ref;
+ to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
+ to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
+ (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
+ LDKCVec_u8Z to_counterparty_script_ref;
+ to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
+ to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
+ (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
+ LDKOutPoint funding_outpoint_conv;
+ funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
+ funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
+ funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
+ LDKTransaction ret_var = build_closing_transaction(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
+ int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
+ (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
+ Transaction_free(ret_var);
+ return ret_arr;
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray base_secret) {
LDKPublicKey per_commitment_point_ref;
CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
}
CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
(*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1);
+ transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1));
LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
return ret_ref;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
- LDKBuiltCommitmentTransaction orig_conv;
- orig_conv.inner = (void*)(orig & (~1));
- orig_conv.is_owned = false;
- LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKBuiltCommitmentTransaction orig_conv;
+ orig_conv.inner = (void*)(orig & (~1));
+ orig_conv.is_owned = false;
+ LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
+ LDKBuiltCommitmentTransaction obj_conv;
+ obj_conv.inner = (void*)(obj & (~1));
+ obj_conv.is_owned = false;
+ LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
+ int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
+ (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = (*env)->GetArrayLength(env, ser);
+ ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
+ LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
+ *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
+ (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1sighash_1all(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
+ LDKBuiltCommitmentTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKu8slice funding_redeemscript_ref;
+ funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
+ funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
+ int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
+ (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
+ (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
+ return ret_arr;
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1sign(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
+ LDKBuiltCommitmentTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ unsigned char funding_key_arr[32];
+ CHECK((*env)->GetArrayLength(env, funding_key) == 32);
+ (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
+ unsigned char (*funding_key_ref)[32] = &funding_key_arr;
+ LDKu8slice funding_redeemscript_ref;
+ funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
+ funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
+ int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
+ (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
+ (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
+ return ret_arr;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+ LDKClosingTransaction this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ ClosingTransaction_free(this_obj_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1new(JNIEnv *env, jclass clz, int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, int64_t funding_outpoint) {
+ LDKCVec_u8Z to_holder_script_ref;
+ to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
+ to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
+ (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
+ LDKCVec_u8Z to_counterparty_script_ref;
+ to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
+ to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
+ (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
+ LDKOutPoint funding_outpoint_conv;
+ funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
+ funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
+ funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
+ LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_ref;
}
-JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
- LDKBuiltCommitmentTransaction obj_conv;
- obj_conv.inner = (void*)(obj & (~1));
- obj_conv.is_owned = false;
- LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
+ LDKClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKOutPoint funding_outpoint_conv;
+ funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
+ funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
+ funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
+ LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
+ *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
+ return ret_val;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
+ return ret_val;
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
(*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
- CVec_u8Z_free(ret_var);
return ret_arr;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
- LDKu8slice ser_ref;
- ser_ref.datalen = (*env)->GetArrayLength(env, ser);
- ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
- LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
- *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
- (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
- return (uint64_t)ret_conv;
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
+ int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
+ (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
+ return ret_arr;
}
-JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1sighash_1all(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
- LDKBuiltCommitmentTransaction this_arg_conv;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+ LDKTrustedClosingTransaction this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ TrustedClosingTransaction_free(this_obj_conv);
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKTrustedClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
+ int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
+ (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
+ Transaction_free(ret_var);
+ return ret_arr;
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1get_1sighash_1all(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
+ LDKTrustedClosingTransaction this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
LDKu8slice funding_redeemscript_ref;
funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
- (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
+ (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
(*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
return ret_arr;
}
-JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1sign(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
- LDKBuiltCommitmentTransaction this_arg_conv;
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1sign(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
+ LDKTrustedClosingTransaction this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
unsigned char funding_key_arr[32];
funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
- (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
+ (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
(*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
return ret_arr;
}
return ret_ref;
}
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKInitFeatures this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
+ return ret_val;
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
LDKNodeFeatures ret_var = NodeFeatures_empty();
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
return ret_ref;
}
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKNodeFeatures this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
+ return ret_val;
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
LDKChannelFeatures ret_var = ChannelFeatures_empty();
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
return ret_ref;
}
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKChannelFeatures this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
+ return ret_val;
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
return ret_ref;
}
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKInvoiceFeatures this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
+ return ret_val;
+}
+
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKInitFeatures this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
return ret_val;
}
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ if ((this_ptr & 1) != 0) return;
+ LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(((uint64_t)this_ptr) & ~1);
+ FREE((void*)this_ptr);
+ CustomMessageReader_free(this_ptr_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKType* orig_conv = (LDKType*)(((uint64_t)orig) & ~1);
+ LDKType* ret_ret =MALLOC(sizeof(LDKType), "LDKType");
+ *ret_ret = Type_clone(orig_conv);
+ return (uint64_t)ret_ret;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ if ((this_ptr & 1) != 0) return;
+ LDKType this_ptr_conv = *(LDKType*)(((uint64_t)this_ptr) & ~1);
+ FREE((void*)this_ptr);
+ Type_free(this_ptr_conv);
+}
+
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
LDKRouteHop this_obj_conv;
this_obj_conv.inner = (void*)(this_obj & (~1));
return ret_ref;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
+ LDKRouteHop o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = RouteHop_hash(&o_conv);
+ return ret_val;
+}
+
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
+ LDKRouteHop a_conv;
+ a_conv.inner = (void*)(a & (~1));
+ a_conv.is_owned = false;
+ LDKRouteHop b_conv;
+ b_conv.inner = (void*)(b & (~1));
+ b_conv.is_owned = false;
+ jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
+ return ret_val;
+}
+
JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
LDKRouteHop obj_conv;
obj_conv.inner = (void*)(obj & (~1));
Route_free(this_obj_conv);
}
+JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ LDKRoute this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
+ jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL);
+ ;
+ for (size_t m = 0; m < ret_var.datalen; m++) {
+ LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
+ int64_tArray ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen);
+ int64_t *ret_conv_12_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_conv_12_arr, NULL);
+ for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
+ LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
+ CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner;
+ if (ret_conv_12_conv_10_var.is_owned) {
+ ret_conv_12_conv_10_ref |= 1;
+ }
+ ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
+ }
+ (*env)->ReleasePrimitiveArrayCritical(env, ret_conv_12_arr, ret_conv_12_arr_ptr, 0);
+ FREE(ret_conv_12_var.data);
+ (*env)->SetObjectArrayElement(env, ret_arr, m, ret_conv_12_arr);
+ }
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
LDKRoute this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
return ret_ref;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
+ LDKRoute o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = Route_hash(&o_conv);
+ return ret_val;
+}
+
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
+ LDKRoute a_conv;
+ a_conv.inner = (void*)(a & (~1));
+ a_conv.is_owned = false;
+ LDKRoute b_conv;
+ b_conv.inner = (void*)(b & (~1));
+ b_conv.is_owned = false;
+ jboolean ret_val = Route_eq(&a_conv, &b_conv);
+ return ret_val;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKRoute this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ int64_t ret_val = Route_get_total_fees(&this_arg_conv);
+ return ret_val;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKRoute this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ int64_t ret_val = Route_get_total_amount(&this_arg_conv);
+ return ret_val;
+}
+
JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
LDKRoute obj_conv;
obj_conv.inner = (void*)(obj & (~1));
RouteHint_free(this_obj_conv);
}
-JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
- LDKRouteHint a_conv;
- a_conv.inner = (void*)(a & (~1));
- a_conv.is_owned = false;
- LDKRouteHint b_conv;
- b_conv.inner = (void*)(b & (~1));
- b_conv.is_owned = false;
- jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
- return ret_val;
-}
-
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
LDKRouteHint orig_conv;
orig_conv.inner = (void*)(orig & (~1));
return ret_ref;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
+ LDKRouteHint o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = RouteHint_hash(&o_conv);
+ return ret_val;
+}
+
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
+ LDKRouteHint a_conv;
+ a_conv.inner = (void*)(a & (~1));
+ a_conv.is_owned = false;
+ LDKRouteHint b_conv;
+ b_conv.inner = (void*)(b & (~1));
+ b_conv.is_owned = false;
+ jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
+ return ret_val;
+}
+
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
LDKRouteHintHop this_obj_conv;
this_obj_conv.inner = (void*)(this_obj & (~1));
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
}
fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
+ htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1));
LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
+ htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
LDKRouteHintHop ret_var = RouteHintHop_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg_conv, htlc_maximum_msat_arg_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
return ret_ref;
}
-JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
- LDKRouteHintHop a_conv;
- a_conv.inner = (void*)(a & (~1));
- a_conv.is_owned = false;
- LDKRouteHintHop b_conv;
- b_conv.inner = (void*)(b & (~1));
- b_conv.is_owned = false;
- jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
- return ret_val;
-}
-
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
LDKRouteHintHop orig_conv;
orig_conv.inner = (void*)(orig & (~1));
return ret_ref;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
+ LDKRouteHintHop o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = RouteHintHop_hash(&o_conv);
+ return ret_val;
+}
+
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
+ LDKRouteHintHop a_conv;
+ a_conv.inner = (void*)(a & (~1));
+ a_conv.is_owned = false;
+ LDKRouteHintHop b_conv;
+ b_conv.inner = (void*)(b & (~1));
+ b_conv.is_owned = false;
+ jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
+ return ret_val;
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1keysend_1route(JNIEnv *env, jclass clz, int8_tArray our_node_id, int64_t network, int8_tArray payee, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger) {
LDKPublicKey our_node_id_ref;
CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
NetworkGraph_free(this_obj_conv);
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) {
- LDKNetworkGraph orig_conv;
- orig_conv.inner = (void*)(orig & (~1));
- orig_conv.is_owned = false;
- LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
- CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t ret_ref = (uint64_t)ret_var.inner;
- if (ret_var.is_owned) {
- ret_ref |= 1;
- }
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+ LDKReadOnlyNetworkGraph this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ ReadOnlyNetworkGraph_free(this_obj_conv);
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ if ((this_ptr & 1) != 0) return;
+ LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(((uint64_t)this_ptr) & ~1);
+ FREE((void*)this_ptr);
+ NetworkUpdate_free(this_ptr_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
+ LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
+ *ret_copy = NetworkUpdate_clone(orig_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
return ret_ref;
}
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
- LDKLockedNetworkGraph this_obj_conv;
- this_obj_conv.inner = (void*)(this_obj & (~1));
- this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
- LockedNetworkGraph_free(this_obj_conv);
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
+ LDKChannelUpdate msg_conv;
+ msg_conv.inner = (void*)(msg & (~1));
+ msg_conv.is_owned = (msg & 1) || (msg == 0);
+ msg_conv = ChannelUpdate_clone(&msg_conv);
+ LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
+ *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
}
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
- LDKNetGraphMsgHandler this_obj_conv;
- this_obj_conv.inner = (void*)(this_obj & (~1));
- this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
- NetGraphMsgHandler_free(this_obj_conv);
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1closed(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
+ LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
+ *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash, int64_t chain_access, int64_t logger) {
- LDKThirtyTwoBytes genesis_hash_ref;
- CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
- (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
- LDKAccess *chain_access_conv_ptr = NULL;
- if (chain_access != 0) {
- LDKAccess chain_access_conv;
- chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
- if (chain_access_conv.free == LDKAccess_JCalls_free) {
- // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
- LDKAccess_JCalls_cloned(&chain_access_conv);
- }
- chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
- *chain_access_conv_ptr = chain_access_conv;
- }
- LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
- if (logger_conv.free == LDKLogger_JCalls_free) {
- // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
- LDKLogger_JCalls_cloned(&logger_conv);
- }
- LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv_ptr, logger_conv);
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
+ LDKPublicKey node_id_ref;
+ CHECK((*env)->GetArrayLength(env, node_id) == 33);
+ (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
+ LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
+ *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
+ LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
+ LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
+ int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
+ (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKNetGraphMsgHandler this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKEventHandler* ret_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
+ *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
+ return (uint64_t)ret_ret;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+ LDKNetGraphMsgHandler this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ NetGraphMsgHandler_free(this_obj_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1get_1network_1graph(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ LDKNetGraphMsgHandler this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKNetworkGraph ret_var = NetGraphMsgHandler_get_network_graph(&this_ptr_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_ref;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv *env, jclass clz, int64_t chain_access, int64_t logger, int64_t network_graph) {
- LDKAccess *chain_access_conv_ptr = NULL;
- if (chain_access != 0) {
- LDKAccess chain_access_conv;
- chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
- if (chain_access_conv.free == LDKAccess_JCalls_free) {
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1set_1network_1graph(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
+ LDKNetGraphMsgHandler this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKNetworkGraph val_conv;
+ val_conv.inner = (void*)(val & (~1));
+ val_conv.is_owned = (val & 1) || (val == 0);
+ // Warning: we need a move here but no clone is available for LDKNetworkGraph
+ NetGraphMsgHandler_set_network_graph(&this_ptr_conv, val_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t chain_access, int64_t logger) {
+ LDKNetworkGraph network_graph_conv;
+ network_graph_conv.inner = (void*)(network_graph & (~1));
+ network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
+ // Warning: we need a move here but no clone is available for LDKNetworkGraph
+ LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
+ // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
+ if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
+ // Manually implement clone for Java trait instances
+ if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
// If this_arg is a JCalls struct, then we need to increment the refcnt in it.
- LDKAccess_JCalls_cloned(&chain_access_conv);
+ LDKAccess_JCalls_cloned(&chain_access_conv.some);
}
- chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
- *chain_access_conv_ptr = chain_access_conv;
}
LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
if (logger_conv.free == LDKLogger_JCalls_free) {
// If this_arg is a JCalls struct, then we need to increment the refcnt in it.
LDKLogger_JCalls_cloned(&logger_conv);
}
- LDKNetworkGraph network_graph_conv;
- network_graph_conv.inner = (void*)(network_graph & (~1));
- network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
- network_graph_conv = NetworkGraph_clone(&network_graph_conv);
- LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv_ptr, logger_conv, network_graph_conv);
+ LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(network_graph_conv, chain_access_conv, logger_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
LDKNetGraphMsgHandler this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKAccess *chain_access_conv_ptr = NULL;
- if (chain_access != 0) {
- LDKAccess chain_access_conv;
- chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
- if (chain_access_conv.free == LDKAccess_JCalls_free) {
+ LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
+ // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
+ if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
+ // Manually implement clone for Java trait instances
+ if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
// If this_arg is a JCalls struct, then we need to increment the refcnt in it.
- LDKAccess_JCalls_cloned(&chain_access_conv);
+ LDKAccess_JCalls_cloned(&chain_access_conv.some);
}
- chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
- *chain_access_conv_ptr = chain_access_conv;
- }
- NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv_ptr);
-}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
- LDKNetGraphMsgHandler this_arg_conv;
- this_arg_conv.inner = (void*)(this_arg & (~1));
- this_arg_conv.is_owned = false;
- LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
- CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t ret_ref = (uint64_t)ret_var.inner;
- if (ret_var.is_owned) {
- ret_ref |= 1;
- }
- return ret_ref;
-}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
- LDKLockedNetworkGraph this_arg_conv;
- this_arg_conv.inner = (void*)(this_arg & (~1));
- this_arg_conv.is_owned = false;
- LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
- CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t ret_ref = (uint64_t)ret_var.inner;
- if (ret_var.is_owned) {
- ret_ref |= 1;
}
- return ret_ref;
+ NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKNetGraphMsgHandler this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
- *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
- return (uint64_t)ret;
+ LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
+ *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKNetGraphMsgHandler this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
- *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
- return (uint64_t)ret;
+ LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
+ *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1new(JNIEnv *env, jclass clz, int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int64_t fees_arg, int64_t last_update_message_arg) {
LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
+ htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
LDKRoutingFees fees_arg_conv;
fees_arg_conv.inner = (void*)(fees_arg & (~1));
fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
}
two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1);
+ capacity_sats_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1));
LDKChannelAnnouncement announcement_message_arg_conv;
announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
return ret_ref;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
+ LDKRoutingFees o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = RoutingFees_hash(&o_conv);
+ return ret_val;
+}
+
JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
LDKRoutingFees obj_conv;
obj_conv.inner = (void*)(obj & (~1));
return ret_ref;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKNetworkGraph this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1node_1from_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
LDKNetworkGraph this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
LDKChannelAnnouncement msg_conv;
msg_conv.inner = (void*)(msg & (~1));
msg_conv.is_owned = false;
- LDKAccess *chain_access_conv_ptr = NULL;
- if (chain_access != 0) {
- LDKAccess chain_access_conv;
- chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
- if (chain_access_conv.free == LDKAccess_JCalls_free) {
+ LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
+ // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
+ if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
+ // Manually implement clone for Java trait instances
+ if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
// If this_arg is a JCalls struct, then we need to increment the refcnt in it.
- LDKAccess_JCalls_cloned(&chain_access_conv);
+ LDKAccess_JCalls_cloned(&chain_access_conv.some);
}
- chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
- *chain_access_conv_ptr = chain_access_conv;
}
LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
- *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
+ *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
return (uint64_t)ret_conv;
}
LDKUnsignedChannelAnnouncement msg_conv;
msg_conv.inner = (void*)(msg & (~1));
msg_conv.is_owned = false;
- LDKAccess *chain_access_conv_ptr = NULL;
- if (chain_access != 0) {
- LDKAccess chain_access_conv;
- chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
- if (chain_access_conv.free == LDKAccess_JCalls_free) {
+ LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
+ // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
+ if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
+ // Manually implement clone for Java trait instances
+ if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
// If this_arg is a JCalls struct, then we need to increment the refcnt in it.
- LDKAccess_JCalls_cloned(&chain_access_conv);
+ LDKAccess_JCalls_cloned(&chain_access_conv.some);
}
- chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
- *chain_access_conv_ptr = chain_access_conv;
}
LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
- *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
+ *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
return (uint64_t)ret_conv;
}
NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
}
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1fail_1node(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
+ LDKNetworkGraph this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKPublicKey _node_id_ref;
+ CHECK((*env)->GetArrayLength(env, _node_id) == 33);
+ (*env)->GetByteArrayRegion(env, _node_id, 0, 33, _node_id_ref.compressed_form);
+ NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
LDKNetworkGraph this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
LDKFilesystemPersister this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKPersist* ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
- *ret = FilesystemPersister_as_Persist(&this_arg_conv);
- return (uint64_t)ret;
+ LDKPersist* ret_ret =MALLOC(sizeof(LDKPersist), "LDKPersist");
+ *ret_ret = FilesystemPersister_as_Persist(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
ChannelManagerPersister_free(this_ptr_conv);
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1start(JNIEnv *env, jclass clz, int64_t persister, int64_t event_handler, int64_t chain_monitor, int64_t channel_manager, int64_t peer_manager, int64_t logger) {
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1start(JNIEnv *env, jclass clz, int64_t persister, int64_t event_handler, int64_t chain_monitor, int64_t channel_manager, int64_t net_graph_msg_handler, int64_t peer_manager, int64_t logger) {
LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(((uint64_t)persister) & ~1);
if (persister_conv.free == LDKChannelManagerPersister_JCalls_free) {
// If this_arg is a JCalls struct, then we need to increment the refcnt in it.
LDKChannelManager channel_manager_conv;
channel_manager_conv.inner = (void*)(channel_manager & (~1));
channel_manager_conv.is_owned = false;
+ LDKNetGraphMsgHandler net_graph_msg_handler_conv;
+ net_graph_msg_handler_conv.inner = (void*)(net_graph_msg_handler & (~1));
+ net_graph_msg_handler_conv.is_owned = (net_graph_msg_handler & 1) || (net_graph_msg_handler == 0);
LDKPeerManager peer_manager_conv;
peer_manager_conv.inner = (void*)(peer_manager & (~1));
peer_manager_conv.is_owned = false;
// If this_arg is a JCalls struct, then we need to increment the refcnt in it.
LDKLogger_JCalls_cloned(&logger_conv);
}
- LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, &peer_manager_conv, logger_conv);
+ LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, net_graph_msg_handler_conv, &peer_manager_conv, logger_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_conv;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
+ LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
+ int64_t ret_val = Currency_hash(o_conv);
+ return ret_val;
+}
+
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
Sha256_free(this_obj_conv);
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKSha256 orig_conv;
+ orig_conv.inner = (void*)(orig & (~1));
+ orig_conv.is_owned = false;
+ LDKSha256 ret_var = Sha256_clone(&orig_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
+ LDKSha256 o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = Sha256_hash(&o_conv);
+ return ret_val;
+}
+
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
LDKSha256 a_conv;
a_conv.inner = (void*)(a & (~1));
return ret_val;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
- LDKSha256 orig_conv;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+ LDKDescription this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ Description_free(this_obj_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKDescription orig_conv;
orig_conv.inner = (void*)(orig & (~1));
orig_conv.is_owned = false;
- LDKSha256 ret_var = Sha256_clone(&orig_conv);
+ LDKDescription ret_var = Description_clone(&orig_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_ref;
}
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
- LDKDescription this_obj_conv;
- this_obj_conv.inner = (void*)(this_obj & (~1));
- this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
- Description_free(this_obj_conv);
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
+ LDKDescription o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = Description_hash(&o_conv);
+ return ret_val;
}
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
return ret_val;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
- LDKDescription orig_conv;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+ LDKPayeePubKey this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ PayeePubKey_free(this_obj_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKPayeePubKey orig_conv;
orig_conv.inner = (void*)(orig & (~1));
orig_conv.is_owned = false;
- LDKDescription ret_var = Description_clone(&orig_conv);
+ LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_ref;
}
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
- LDKPayeePubKey this_obj_conv;
- this_obj_conv.inner = (void*)(this_obj & (~1));
- this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
- PayeePubKey_free(this_obj_conv);
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
+ LDKPayeePubKey o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = PayeePubKey_hash(&o_conv);
+ return ret_val;
}
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
return ret_val;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
- LDKPayeePubKey orig_conv;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+ LDKExpiryTime this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ ExpiryTime_free(this_obj_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKExpiryTime orig_conv;
orig_conv.inner = (void*)(orig & (~1));
orig_conv.is_owned = false;
- LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
+ LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_ref;
}
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
- LDKExpiryTime this_obj_conv;
- this_obj_conv.inner = (void*)(this_obj & (~1));
- this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
- ExpiryTime_free(this_obj_conv);
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
+ LDKExpiryTime o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = ExpiryTime_hash(&o_conv);
+ return ret_val;
}
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
return ret_val;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
- LDKExpiryTime orig_conv;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+ LDKMinFinalCltvExpiry this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ MinFinalCltvExpiry_free(this_obj_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKMinFinalCltvExpiry orig_conv;
orig_conv.inner = (void*)(orig & (~1));
orig_conv.is_owned = false;
- LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
+ LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_ref;
}
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
- LDKMinFinalCltvExpiry this_obj_conv;
- this_obj_conv.inner = (void*)(this_obj & (~1));
- this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
- MinFinalCltvExpiry_free(this_obj_conv);
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1hash(JNIEnv *env, jclass clz, int64_t o) {
+ LDKMinFinalCltvExpiry o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = MinFinalCltvExpiry_hash(&o_conv);
+ return ret_val;
}
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
return ret_val;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
- LDKMinFinalCltvExpiry orig_conv;
- orig_conv.inner = (void*)(orig & (~1));
- orig_conv.is_owned = false;
- LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
- CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t ret_ref = (uint64_t)ret_var.inner;
- if (ret_var.is_owned) {
- ret_ref |= 1;
- }
- return ret_ref;
-}
-
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
if ((this_ptr & 1) != 0) return;
LDKFallback this_ptr_conv = *(LDKFallback*)(((uint64_t)this_ptr) & ~1);
return ret_ref;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
+ LDKFallback* o_conv = (LDKFallback*)o;
+ int64_t ret_val = Fallback_hash(o_conv);
+ return ret_val;
+}
+
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
LDKFallback* a_conv = (LDKFallback*)a;
LDKFallback* b_conv = (LDKFallback*)b;
InvoiceSignature_free(this_obj_conv);
}
-JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
- LDKInvoiceSignature a_conv;
- a_conv.inner = (void*)(a & (~1));
- a_conv.is_owned = false;
- LDKInvoiceSignature b_conv;
- b_conv.inner = (void*)(b & (~1));
- b_conv.is_owned = false;
- jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
- return ret_val;
-}
-
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
LDKInvoiceSignature orig_conv;
orig_conv.inner = (void*)(orig & (~1));
return ret_ref;
}
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
- LDKPrivateRoute this_obj_conv;
- this_obj_conv.inner = (void*)(this_obj & (~1));
- this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
- PrivateRoute_free(this_obj_conv);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
- LDKPrivateRoute a_conv;
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
+ LDKInvoiceSignature a_conv;
a_conv.inner = (void*)(a & (~1));
a_conv.is_owned = false;
- LDKPrivateRoute b_conv;
+ LDKInvoiceSignature b_conv;
b_conv.inner = (void*)(b & (~1));
b_conv.is_owned = false;
- jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
+ jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
return ret_val;
}
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+ LDKPrivateRoute this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ PrivateRoute_free(this_obj_conv);
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
LDKPrivateRoute orig_conv;
orig_conv.inner = (void*)(orig & (~1));
return ret_ref;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
+ LDKPrivateRoute o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = PrivateRoute_hash(&o_conv);
+ return ret_val;
+}
+
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
+ LDKPrivateRoute a_conv;
+ a_conv.inner = (void*)(a & (~1));
+ a_conv.is_owned = false;
+ LDKPrivateRoute b_conv;
+ b_conv.inner = (void*)(b & (~1));
+ b_conv.is_owned = false;
+ jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
+ return ret_val;
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKSignedRawInvoice this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
return ret_conv;
}
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
+ jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_secret());
+ return ret_conv;
+}
+
JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_secrets());
return ret_conv;
return ret_conv;
}
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
+ jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_imprecise_amount());
+ return ret_conv;
+}
+
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
}
LDKCurrency network_conv = LDKCurrency_from_java(env, network);
LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1);
+ amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1));
LDKStr description_conv = java_to_owned_str(env, description);
LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
*ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
}
JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1lib_1version_1string(JNIEnv *env, jclass _c) {
- return str_ref_to_java(env, "v0.0.100.2", strlen("v0.0.100.2"));
+ return str_ref_to_java(env, "v0.0.101.0", strlen("v0.0.101.0"));
}
JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_get_1ldk_1c_1bindings_1version(JNIEnv *env, jclass _c) {
return str_ref_to_java(env, check_get_ldk_bindings_version(), strlen(check_get_ldk_bindings_version()));
case 1: return LDKSemanticError_MultiplePaymentHashes;
case 2: return LDKSemanticError_NoDescription;
case 3: return LDKSemanticError_MultipleDescriptions;
- case 4: return LDKSemanticError_MultiplePaymentSecrets;
- case 5: return LDKSemanticError_InvalidFeatures;
- case 6: return LDKSemanticError_InvalidRecoveryId;
- case 7: return LDKSemanticError_InvalidSignature;
+ case 4: return LDKSemanticError_NoPaymentSecret;
+ case 5: return LDKSemanticError_MultiplePaymentSecrets;
+ case 6: return LDKSemanticError_InvalidFeatures;
+ case 7: return LDKSemanticError_InvalidRecoveryId;
+ case 8: return LDKSemanticError_InvalidSignature;
+ case 9: return LDKSemanticError_ImpreciseAmount;
}
abort();
}
static jfieldID SemanticError_LDKSemanticError_MultiplePaymentHashes = NULL;
static jfieldID SemanticError_LDKSemanticError_NoDescription = NULL;
static jfieldID SemanticError_LDKSemanticError_MultipleDescriptions = NULL;
+static jfieldID SemanticError_LDKSemanticError_NoPaymentSecret = NULL;
static jfieldID SemanticError_LDKSemanticError_MultiplePaymentSecrets = NULL;
static jfieldID SemanticError_LDKSemanticError_InvalidFeatures = NULL;
static jfieldID SemanticError_LDKSemanticError_InvalidRecoveryId = NULL;
static jfieldID SemanticError_LDKSemanticError_InvalidSignature = NULL;
+static jfieldID SemanticError_LDKSemanticError_ImpreciseAmount = NULL;
JNIEXPORT void JNICALL Java_org_ldk_enums_SemanticError_init (JNIEnv *env, jclass clz) {
SemanticError_class = (*env)->NewGlobalRef(env, clz);
CHECK(SemanticError_class != NULL);
CHECK(SemanticError_LDKSemanticError_NoDescription != NULL);
SemanticError_LDKSemanticError_MultipleDescriptions = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultipleDescriptions", "Lorg/ldk/enums/SemanticError;");
CHECK(SemanticError_LDKSemanticError_MultipleDescriptions != NULL);
+ SemanticError_LDKSemanticError_NoPaymentSecret = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_NoPaymentSecret", "Lorg/ldk/enums/SemanticError;");
+ CHECK(SemanticError_LDKSemanticError_NoPaymentSecret != NULL);
SemanticError_LDKSemanticError_MultiplePaymentSecrets = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_MultiplePaymentSecrets", "Lorg/ldk/enums/SemanticError;");
CHECK(SemanticError_LDKSemanticError_MultiplePaymentSecrets != NULL);
SemanticError_LDKSemanticError_InvalidFeatures = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidFeatures", "Lorg/ldk/enums/SemanticError;");
CHECK(SemanticError_LDKSemanticError_InvalidRecoveryId != NULL);
SemanticError_LDKSemanticError_InvalidSignature = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_InvalidSignature", "Lorg/ldk/enums/SemanticError;");
CHECK(SemanticError_LDKSemanticError_InvalidSignature != NULL);
+ SemanticError_LDKSemanticError_ImpreciseAmount = (*env)->GetStaticFieldID(env, SemanticError_class, "LDKSemanticError_ImpreciseAmount", "Lorg/ldk/enums/SemanticError;");
+ CHECK(SemanticError_LDKSemanticError_ImpreciseAmount != NULL);
}
static inline jclass LDKSemanticError_to_java(JNIEnv *env, LDKSemanticError val) {
switch (val) {
return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoDescription);
case LDKSemanticError_MultipleDescriptions:
return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultipleDescriptions);
+ case LDKSemanticError_NoPaymentSecret:
+ return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_NoPaymentSecret);
case LDKSemanticError_MultiplePaymentSecrets:
return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_MultiplePaymentSecrets);
case LDKSemanticError_InvalidFeatures:
return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidRecoveryId);
case LDKSemanticError_InvalidSignature:
return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_InvalidSignature);
+ case LDKSemanticError_ImpreciseAmount:
+ return (*env)->GetStaticObjectField(env, SemanticError_class, SemanticError_LDKSemanticError_ImpreciseAmount);
default: abort();
}
}
uint64_t err_ref = (uint64_t)err_var.inner & ~1;
return err_ref;
}
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+ return ((LDKCResult_TrustedClosingTransactionNoneZ*)arg)->result_ok;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+ LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
+ CHECK(val->result_ok);
+ LDKTrustedClosingTransaction res_var = (*val->contents.result);
+ CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t res_ref = (uint64_t)res_var.inner & ~1;
+ return res_ref;
+}
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
+ LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
+ CHECK(!val->result_ok);
+ return *val->contents.err;
+}
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CommitmentTransactionDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
}
}
static jclass LDKMonitorEvent_HTLCEvent_class = NULL;
static jmethodID LDKMonitorEvent_HTLCEvent_meth = NULL;
-static jclass LDKMonitorEvent_CommitmentTxBroadcasted_class = NULL;
-static jmethodID LDKMonitorEvent_CommitmentTxBroadcasted_meth = NULL;
+static jclass LDKMonitorEvent_CommitmentTxConfirmed_class = NULL;
+static jmethodID LDKMonitorEvent_CommitmentTxConfirmed_meth = NULL;
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMonitorEvent_init (JNIEnv *env, jclass clz) {
LDKMonitorEvent_HTLCEvent_class =
(*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$HTLCEvent;"));
CHECK(LDKMonitorEvent_HTLCEvent_class != NULL);
LDKMonitorEvent_HTLCEvent_meth = (*env)->GetMethodID(env, LDKMonitorEvent_HTLCEvent_class, "<init>", "(J)V");
CHECK(LDKMonitorEvent_HTLCEvent_meth != NULL);
- LDKMonitorEvent_CommitmentTxBroadcasted_class =
- (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxBroadcasted;"));
- CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_class != NULL);
- LDKMonitorEvent_CommitmentTxBroadcasted_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, "<init>", "(J)V");
- CHECK(LDKMonitorEvent_CommitmentTxBroadcasted_meth != NULL);
+ LDKMonitorEvent_CommitmentTxConfirmed_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMonitorEvent$CommitmentTxConfirmed;"));
+ CHECK(LDKMonitorEvent_CommitmentTxConfirmed_class != NULL);
+ LDKMonitorEvent_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKMonitorEvent_CommitmentTxConfirmed_class, "<init>", "(J)V");
+ CHECK(LDKMonitorEvent_CommitmentTxConfirmed_meth != NULL);
}
JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMonitorEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
LDKMonitorEvent *obj = (LDKMonitorEvent*)(ptr & ~1);
uint64_t htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
return (*env)->NewObject(env, LDKMonitorEvent_HTLCEvent_class, LDKMonitorEvent_HTLCEvent_meth, htlc_event_ref);
}
- case LDKMonitorEvent_CommitmentTxBroadcasted: {
- LDKOutPoint commitment_tx_broadcasted_var = obj->commitment_tx_broadcasted;
- CHECK((((uint64_t)commitment_tx_broadcasted_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&commitment_tx_broadcasted_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t commitment_tx_broadcasted_ref = (uint64_t)commitment_tx_broadcasted_var.inner & ~1;
- return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxBroadcasted_class, LDKMonitorEvent_CommitmentTxBroadcasted_meth, commitment_tx_broadcasted_ref);
+ case LDKMonitorEvent_CommitmentTxConfirmed: {
+ LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
+ CHECK((((uint64_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t commitment_tx_confirmed_ref = (uint64_t)commitment_tx_confirmed_var.inner & ~1;
+ return (*env)->NewObject(env, LDKMonitorEvent_CommitmentTxConfirmed_class, LDKMonitorEvent_CommitmentTxConfirmed_meth, commitment_tx_confirmed_ref);
}
default: abort();
}
default: abort();
}
}
+static jclass LDKNetworkUpdate_ChannelUpdateMessage_class = NULL;
+static jmethodID LDKNetworkUpdate_ChannelUpdateMessage_meth = NULL;
+static jclass LDKNetworkUpdate_ChannelClosed_class = NULL;
+static jmethodID LDKNetworkUpdate_ChannelClosed_meth = NULL;
+static jclass LDKNetworkUpdate_NodeFailure_class = NULL;
+static jmethodID LDKNetworkUpdate_NodeFailure_meth = NULL;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init (JNIEnv *env, jclass clz) {
+ LDKNetworkUpdate_ChannelUpdateMessage_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$ChannelUpdateMessage;"));
+ CHECK(LDKNetworkUpdate_ChannelUpdateMessage_class != NULL);
+ LDKNetworkUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
+ CHECK(LDKNetworkUpdate_ChannelUpdateMessage_meth != NULL);
+ LDKNetworkUpdate_ChannelClosed_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$ChannelClosed;"));
+ CHECK(LDKNetworkUpdate_ChannelClosed_class != NULL);
+ LDKNetworkUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_ChannelClosed_class, "<init>", "(JZ)V");
+ CHECK(LDKNetworkUpdate_ChannelClosed_meth != NULL);
+ LDKNetworkUpdate_NodeFailure_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetworkUpdate$NodeFailure;"));
+ CHECK(LDKNetworkUpdate_NodeFailure_class != NULL);
+ LDKNetworkUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKNetworkUpdate_NodeFailure_class, "<init>", "([BZ)V");
+ CHECK(LDKNetworkUpdate_NodeFailure_meth != NULL);
+}
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
+ LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKNetworkUpdate_ChannelUpdateMessage: {
+ LDKChannelUpdate msg_var = obj->channel_update_message.msg;
+ CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
+ return (*env)->NewObject(env, LDKNetworkUpdate_ChannelUpdateMessage_class, LDKNetworkUpdate_ChannelUpdateMessage_meth, msg_ref);
+ }
+ case LDKNetworkUpdate_ChannelClosed: {
+ return (*env)->NewObject(env, LDKNetworkUpdate_ChannelClosed_class, LDKNetworkUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
+ }
+ case LDKNetworkUpdate_NodeFailure: {
+ int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
+ (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
+ return (*env)->NewObject(env, LDKNetworkUpdate_NodeFailure_class, LDKNetworkUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
+ }
+ default: abort();
+ }
+}
+static jclass LDKCOption_NetworkUpdateZ_Some_class = NULL;
+static jmethodID LDKCOption_NetworkUpdateZ_Some_meth = NULL;
+static jclass LDKCOption_NetworkUpdateZ_None_class = NULL;
+static jmethodID LDKCOption_NetworkUpdateZ_None_meth = NULL;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init (JNIEnv *env, jclass clz) {
+ LDKCOption_NetworkUpdateZ_Some_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$Some;"));
+ CHECK(LDKCOption_NetworkUpdateZ_Some_class != NULL);
+ LDKCOption_NetworkUpdateZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_Some_class, "<init>", "(J)V");
+ CHECK(LDKCOption_NetworkUpdateZ_Some_meth != NULL);
+ LDKCOption_NetworkUpdateZ_None_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_NetworkUpdateZ$None;"));
+ CHECK(LDKCOption_NetworkUpdateZ_None_class != NULL);
+ LDKCOption_NetworkUpdateZ_None_meth = (*env)->GetMethodID(env, LDKCOption_NetworkUpdateZ_None_class, "<init>", "()V");
+ CHECK(LDKCOption_NetworkUpdateZ_None_meth != NULL);
+}
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
+ LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKCOption_NetworkUpdateZ_Some: {
+ uint64_t some_ref = ((uint64_t)&obj->some) | 1;
+ return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_Some_class, LDKCOption_NetworkUpdateZ_Some_meth, some_ref);
+ }
+ case LDKCOption_NetworkUpdateZ_None: {
+ return (*env)->NewObject(env, LDKCOption_NetworkUpdateZ_None_class, LDKCOption_NetworkUpdateZ_None_meth);
+ }
+ default: abort();
+ }
+}
static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
static jclass LDKSpendableOutputDescriptor_DelayedPaymentOutput_class = NULL;
default: abort();
}
}
-static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
-static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
-static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
-static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
-static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
-static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv *env, jclass clz) {
- LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
- (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
- CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
- LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
- CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
- LDKHTLCFailChannelUpdate_ChannelClosed_class =
- (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
- CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
- LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
- CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
- LDKHTLCFailChannelUpdate_NodeFailure_class =
- (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
- CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
- LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
- CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
-}
-JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
- LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)(ptr & ~1);
- switch(obj->tag) {
- case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
- LDKChannelUpdate msg_var = obj->channel_update_message.msg;
- CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
- return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
- }
- case LDKHTLCFailChannelUpdate_ChannelClosed: {
- return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
- }
- case LDKHTLCFailChannelUpdate_NodeFailure: {
- int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
- (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
- return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
- }
- default: abort();
- }
-}
static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
static jmethodID LDKMessageSendEvent_SendChannelUpdate_meth = NULL;
static jclass LDKMessageSendEvent_HandleError_class = NULL;
static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
-static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
-static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
static jclass LDKMessageSendEvent_SendChannelRangeQuery_class = NULL;
static jmethodID LDKMessageSendEvent_SendChannelRangeQuery_meth = NULL;
static jclass LDKMessageSendEvent_SendShortIdsQuery_class = NULL;
CHECK(LDKMessageSendEvent_HandleError_class != NULL);
LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
- LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
- (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
- CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
- LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
- CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
LDKMessageSendEvent_SendChannelRangeQuery_class =
(*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelRangeQuery;"));
CHECK(LDKMessageSendEvent_SendChannelRangeQuery_class != NULL);
uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
}
- case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
- uint64_t update_ref = ((uint64_t)&obj->payment_failure_network_update.update) | 1;
- return (*env)->NewObject(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
- }
case LDKMessageSendEvent_SendChannelRangeQuery: {
int8_tArray node_id_arr = (*env)->NewByteArray(env, 33);
(*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_range_query.node_id.compressed_form);
uint64_t err_ref = (uint64_t)err_var.inner & ~1;
return err_ref;
}
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+ return ((LDKCResult_NoneNoneZ*)arg)->result_ok;
+}
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+ LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
+ CHECK(val->result_ok);
+ return *val->contents.result;
+}
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
+ LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
+ CHECK(!val->result_ok);
+ return *val->contents.err;
+}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv *env, jclass clz, int8_tArray a, jobjectArray b) {
LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
LDKSignature a_ref;
jweak o;
jmethodID get_per_commitment_point_meth;
jmethodID release_commitment_secret_meth;
+ jmethodID validate_holder_commitment_meth;
jmethodID channel_keys_id_meth;
jmethodID sign_counterparty_commitment_meth;
+ jmethodID validate_counterparty_revocation_meth;
jmethodID sign_holder_commitment_and_htlcs_meth;
jmethodID sign_justice_revoked_output_meth;
jmethodID sign_justice_revoked_htlc_meth;
}
return ret_ref;
}
+LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx) {
+ LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
+ holder_tx_var = HolderCommitmentTransaction_clone(holder_tx);
+ CHECK((((uint64_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t holder_tx_ref = (uint64_t)holder_tx_var.inner;
+ if (holder_tx_var.is_owned) {
+ holder_tx_ref |= 1;
+ }
+ jobject obj = (*env)->NewLocalRef(env, j_calls->o);
+ CHECK(obj != NULL);
+ uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_holder_commitment_meth, holder_tx_ref);
+ if ((*env)->ExceptionCheck(env)) {
+ (*env)->ExceptionDescribe(env);
+ (*env)->FatalError(env, "A call to validate_holder_commitment in LDKBaseSign from rust threw an exception.");
+ }
+ LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1);
+ ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ return ret_conv;
+}
LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
JNIEnv *env;
}
return ret_conv;
}
+LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
+ LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ int8_tArray secret_arr = (*env)->NewByteArray(env, 32);
+ (*env)->SetByteArrayRegion(env, secret_arr, 0, 32, *secret);
+ jobject obj = (*env)->NewLocalRef(env, j_calls->o);
+ CHECK(obj != NULL);
+ uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->validate_counterparty_revocation_meth, idx, secret_arr);
+ if ((*env)->ExceptionCheck(env)) {
+ (*env)->ExceptionDescribe(env);
+ (*env)->FatalError(env, "A call to validate_counterparty_revocation in LDKBaseSign from rust threw an exception.");
+ }
+ LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1);
+ ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ return ret_conv;
+}
LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
JNIEnv *env;
}
return ret_conv;
}
-LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, LDKTransaction closing_tx) {
+LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
JNIEnv *env;
jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
} else {
DO_ASSERT(get_jenv_res == JNI_OK);
}
- LDKTransaction closing_tx_var = closing_tx;
- int8_tArray closing_tx_arr = (*env)->NewByteArray(env, closing_tx_var.datalen);
- (*env)->SetByteArrayRegion(env, closing_tx_arr, 0, closing_tx_var.datalen, closing_tx_var.data);
- Transaction_free(closing_tx_var);
+ LDKClosingTransaction closing_tx_var = *closing_tx;
+ // Warning: we may need a move here but no clone is available for LDKClosingTransaction
+ CHECK((((uint64_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t closing_tx_ref = (uint64_t)closing_tx_var.inner;
+ if (closing_tx_var.is_owned) {
+ closing_tx_ref |= 1;
+ }
jobject obj = (*env)->NewLocalRef(env, j_calls->o);
CHECK(obj != NULL);
- uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_arr);
+ uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
if ((*env)->ExceptionCheck(env)) {
(*env)->ExceptionDescribe(env);
(*env)->FatalError(env, "A call to sign_closing_transaction in LDKBaseSign from rust threw an exception.");
CHECK(calls->get_per_commitment_point_meth != NULL);
calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
CHECK(calls->release_commitment_secret_meth != NULL);
+ calls->validate_holder_commitment_meth = (*env)->GetMethodID(env, c, "validate_holder_commitment", "(J)J");
+ CHECK(calls->validate_holder_commitment_meth != NULL);
calls->channel_keys_id_meth = (*env)->GetMethodID(env, c, "channel_keys_id", "()[B");
CHECK(calls->channel_keys_id_meth != NULL);
calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(J)J");
CHECK(calls->sign_counterparty_commitment_meth != NULL);
+ calls->validate_counterparty_revocation_meth = (*env)->GetMethodID(env, c, "validate_counterparty_revocation", "(J[B)J");
+ CHECK(calls->validate_counterparty_revocation_meth != NULL);
calls->sign_holder_commitment_and_htlcs_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_and_htlcs", "(J)J");
CHECK(calls->sign_holder_commitment_and_htlcs_meth != NULL);
calls->sign_justice_revoked_output_meth = (*env)->GetMethodID(env, c, "sign_justice_revoked_output", "([BJJ[B)J");
CHECK(calls->sign_justice_revoked_htlc_meth != NULL);
calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "([BJJ[BJ)J");
CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
- calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "([B)J");
+ calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
CHECK(calls->sign_closing_transaction_meth != NULL);
calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
CHECK(calls->sign_channel_announcement_meth != NULL);
.this_arg = (void*) calls,
.get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
.release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
+ .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
.channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
.sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
+ .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
.sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
.sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
.sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
return ret_arr;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1validate_1holder_1commitment(JNIEnv *env, jclass clz, int64_t this_arg, int64_t holder_tx) {
+ LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
+ LDKHolderCommitmentTransaction holder_tx_conv;
+ holder_tx_conv.inner = (void*)(holder_tx & (~1));
+ holder_tx_conv.is_owned = false;
+ LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
+ *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv);
+ return (uint64_t)ret_conv;
+}
+
JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1channel_1keys_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
return (uint64_t)ret_conv;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1validate_1counterparty_1revocation(JNIEnv *env, jclass clz, int64_t this_arg, int64_t idx, int8_tArray secret) {
+ LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
+ unsigned char secret_arr[32];
+ CHECK((*env)->GetArrayLength(env, secret) == 32);
+ (*env)->GetByteArrayRegion(env, secret, 0, 32, secret_arr);
+ unsigned char (*secret_ref)[32] = &secret_arr;
+ LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
+ *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
+ return (uint64_t)ret_conv;
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1holder_1commitment_1and_1htlcs(JNIEnv *env, jclass clz, int64_t this_arg, int64_t commitment_tx) {
LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
LDKHolderCommitmentTransaction commitment_tx_conv;
return (uint64_t)ret_conv;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray closing_tx) {
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1closing_1transaction(JNIEnv *env, jclass clz, int64_t this_arg, int64_t closing_tx) {
LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
- LDKTransaction closing_tx_ref;
- closing_tx_ref.datalen = (*env)->GetArrayLength(env, closing_tx);
- closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
- (*env)->GetByteArrayRegion(env, closing_tx, 0, closing_tx_ref.datalen, closing_tx_ref.data);
- closing_tx_ref.data_is_owned = true;
+ LDKClosingTransaction closing_tx_conv;
+ closing_tx_conv.inner = (void*)(closing_tx & (~1));
+ closing_tx_conv.is_owned = false;
LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
- *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
+ *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
return (uint64_t)ret_conv;
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
CHECK(val->result_ok);
- LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
- *ret = Sign_clone(&(*val->contents.result));
- return (uint64_t)ret;
+ LDKSign* res_ret =MALLOC(sizeof(LDKSign), "LDKSign");
+ *res_ret = Sign_clone(&(*val->contents.result));
+ return (uint64_t)res_ret;
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1channel_1signer(JNIEnv *env, jclass clz, int64_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
- LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
- *ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
- return (uint64_t)ret;
+ LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
+ *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
+ return (uint64_t)ret_ret;
}
JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv *env, jclass clz, int64_t this_arg) {
uint64_t err_ref = (uint64_t)err_var.inner & ~1;
return err_ref;
}
+typedef struct LDKType_JCalls {
+ atomic_size_t refcnt;
+ JavaVM *vm;
+ jweak o;
+ jmethodID type_id_meth;
+ jmethodID debug_str_meth;
+ jmethodID write_meth;
+} LDKType_JCalls;
+static void LDKType_JCalls_free(void* this_arg) {
+ LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
+ if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ (*env)->DeleteWeakGlobalRef(env, j_calls->o);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ FREE(j_calls);
+ }
+}
+uint16_t type_id_LDKType_jcall(const void* this_arg) {
+ LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ jobject obj = (*env)->NewLocalRef(env, j_calls->o);
+ CHECK(obj != NULL);
+ int16_t ret = (*env)->CallShortMethod(env, obj, j_calls->type_id_meth);
+ if ((*env)->ExceptionCheck(env)) {
+ (*env)->ExceptionDescribe(env);
+ (*env)->FatalError(env, "A call to type_id in LDKType from rust threw an exception.");
+ }
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ return ret;
+}
+LDKStr debug_str_LDKType_jcall(const void* this_arg) {
+ LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ jobject obj = (*env)->NewLocalRef(env, j_calls->o);
+ CHECK(obj != NULL);
+ jstring ret = (*env)->CallObjectMethod(env, obj, j_calls->debug_str_meth);
+ if ((*env)->ExceptionCheck(env)) {
+ (*env)->ExceptionDescribe(env);
+ (*env)->FatalError(env, "A call to debug_str in LDKType from rust threw an exception.");
+ }
+ LDKStr ret_conv = java_to_owned_str(env, ret);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ return ret_conv;
+}
+LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
+ LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ jobject obj = (*env)->NewLocalRef(env, j_calls->o);
+ CHECK(obj != NULL);
+ int8_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->write_meth);
+ if ((*env)->ExceptionCheck(env)) {
+ (*env)->ExceptionDescribe(env);
+ (*env)->FatalError(env, "A call to write in LDKType from rust threw an exception.");
+ }
+ LDKCVec_u8Z ret_ref;
+ ret_ref.datalen = (*env)->GetArrayLength(env, ret);
+ ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
+ (*env)->GetByteArrayRegion(env, ret, 0, ret_ref.datalen, ret_ref.data);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ return ret_ref;
+}
+static void LDKType_JCalls_cloned(LDKType* new_obj) {
+ LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
+ atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
+}
+static inline LDKType LDKType_init (JNIEnv *env, jclass clz, jobject o) {
+ jclass c = (*env)->GetObjectClass(env, o);
+ CHECK(c != NULL);
+ LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
+ atomic_init(&calls->refcnt, 1);
+ DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
+ calls->o = (*env)->NewWeakGlobalRef(env, o);
+ calls->type_id_meth = (*env)->GetMethodID(env, c, "type_id", "()S");
+ CHECK(calls->type_id_meth != NULL);
+ calls->debug_str_meth = (*env)->GetMethodID(env, c, "debug_str", "()Ljava/lang/String;");
+ CHECK(calls->debug_str_meth != NULL);
+ calls->write_meth = (*env)->GetMethodID(env, c, "write", "()[B");
+ CHECK(calls->write_meth != NULL);
+
+ LDKType ret = {
+ .this_arg = (void*) calls,
+ .type_id = type_id_LDKType_jcall,
+ .debug_str = debug_str_LDKType_jcall,
+ .write = write_LDKType_jcall,
+ .cloned = LDKType_JCalls_cloned,
+ .free = LDKType_JCalls_free,
+ };
+ return ret;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKType_1new(JNIEnv *env, jclass clz, jobject o) {
+ LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
+ *res_ptr = LDKType_init(env, clz, o);
+ return (uint64_t)res_ptr;
+}
+JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_Type_1type_1id(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
+ int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
+ return ret_val;
+}
+
+JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
+ LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
+ jstring ret_conv = str_ref_to_java(env, ret_str.chars, ret_str.len);
+ Str_free(ret_str);
+ return ret_conv;
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Type_1write(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
+ LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
+ int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
+ (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+static jclass LDKCOption_TypeZ_Some_class = NULL;
+static jmethodID LDKCOption_TypeZ_Some_meth = NULL;
+static jclass LDKCOption_TypeZ_None_class = NULL;
+static jmethodID LDKCOption_TypeZ_None_meth = NULL;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init (JNIEnv *env, jclass clz) {
+ LDKCOption_TypeZ_Some_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_TypeZ$Some;"));
+ CHECK(LDKCOption_TypeZ_Some_class != NULL);
+ LDKCOption_TypeZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_Some_class, "<init>", "(J)V");
+ CHECK(LDKCOption_TypeZ_Some_meth != NULL);
+ LDKCOption_TypeZ_None_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_TypeZ$None;"));
+ CHECK(LDKCOption_TypeZ_None_class != NULL);
+ LDKCOption_TypeZ_None_meth = (*env)->GetMethodID(env, LDKCOption_TypeZ_None_class, "<init>", "()V");
+ CHECK(LDKCOption_TypeZ_None_meth != NULL);
+}
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
+ LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKCOption_TypeZ_Some: {
+ LDKType* some_ret =MALLOC(sizeof(LDKType), "LDKType");
+ *some_ret = Type_clone(&obj->some);
+ return (*env)->NewObject(env, LDKCOption_TypeZ_Some_class, LDKCOption_TypeZ_Some_meth, (uint64_t)some_ret);
+ }
+ case LDKCOption_TypeZ_None: {
+ return (*env)->NewObject(env, LDKCOption_TypeZ_None_class, LDKCOption_TypeZ_None_meth);
+ }
+ default: abort();
+ }
+}
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+ return ((LDKCResult_COption_TypeZDecodeErrorZ*)arg)->result_ok;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+ LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
+ CHECK(val->result_ok);
+ uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
+ return res_ref;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
+ LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
+ CHECK(!val->result_ok);
+ LDKDecodeError err_var = (*val->contents.err);
+ CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t err_ref = (uint64_t)err_var.inner & ~1;
+ return err_ref;
+}
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SiPrefixNoneZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
}
default: abort();
}
}
+static jclass LDKClosureReason_CounterpartyForceClosed_class = NULL;
+static jmethodID LDKClosureReason_CounterpartyForceClosed_meth = NULL;
+static jclass LDKClosureReason_HolderForceClosed_class = NULL;
+static jmethodID LDKClosureReason_HolderForceClosed_meth = NULL;
+static jclass LDKClosureReason_CooperativeClosure_class = NULL;
+static jmethodID LDKClosureReason_CooperativeClosure_meth = NULL;
+static jclass LDKClosureReason_CommitmentTxConfirmed_class = NULL;
+static jmethodID LDKClosureReason_CommitmentTxConfirmed_meth = NULL;
+static jclass LDKClosureReason_ProcessingError_class = NULL;
+static jmethodID LDKClosureReason_ProcessingError_meth = NULL;
+static jclass LDKClosureReason_DisconnectedPeer_class = NULL;
+static jmethodID LDKClosureReason_DisconnectedPeer_meth = NULL;
+static jclass LDKClosureReason_OutdatedChannelManager_class = NULL;
+static jmethodID LDKClosureReason_OutdatedChannelManager_meth = NULL;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init (JNIEnv *env, jclass clz) {
+ LDKClosureReason_CounterpartyForceClosed_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CounterpartyForceClosed;"));
+ CHECK(LDKClosureReason_CounterpartyForceClosed_class != NULL);
+ LDKClosureReason_CounterpartyForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_CounterpartyForceClosed_class, "<init>", "(Ljava/lang/String;)V");
+ CHECK(LDKClosureReason_CounterpartyForceClosed_meth != NULL);
+ LDKClosureReason_HolderForceClosed_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$HolderForceClosed;"));
+ CHECK(LDKClosureReason_HolderForceClosed_class != NULL);
+ LDKClosureReason_HolderForceClosed_meth = (*env)->GetMethodID(env, LDKClosureReason_HolderForceClosed_class, "<init>", "()V");
+ CHECK(LDKClosureReason_HolderForceClosed_meth != NULL);
+ LDKClosureReason_CooperativeClosure_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CooperativeClosure;"));
+ CHECK(LDKClosureReason_CooperativeClosure_class != NULL);
+ LDKClosureReason_CooperativeClosure_meth = (*env)->GetMethodID(env, LDKClosureReason_CooperativeClosure_class, "<init>", "()V");
+ CHECK(LDKClosureReason_CooperativeClosure_meth != NULL);
+ LDKClosureReason_CommitmentTxConfirmed_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$CommitmentTxConfirmed;"));
+ CHECK(LDKClosureReason_CommitmentTxConfirmed_class != NULL);
+ LDKClosureReason_CommitmentTxConfirmed_meth = (*env)->GetMethodID(env, LDKClosureReason_CommitmentTxConfirmed_class, "<init>", "()V");
+ CHECK(LDKClosureReason_CommitmentTxConfirmed_meth != NULL);
+ LDKClosureReason_ProcessingError_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$ProcessingError;"));
+ CHECK(LDKClosureReason_ProcessingError_class != NULL);
+ LDKClosureReason_ProcessingError_meth = (*env)->GetMethodID(env, LDKClosureReason_ProcessingError_class, "<init>", "(Ljava/lang/String;)V");
+ CHECK(LDKClosureReason_ProcessingError_meth != NULL);
+ LDKClosureReason_DisconnectedPeer_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$DisconnectedPeer;"));
+ CHECK(LDKClosureReason_DisconnectedPeer_class != NULL);
+ LDKClosureReason_DisconnectedPeer_meth = (*env)->GetMethodID(env, LDKClosureReason_DisconnectedPeer_class, "<init>", "()V");
+ CHECK(LDKClosureReason_DisconnectedPeer_meth != NULL);
+ LDKClosureReason_OutdatedChannelManager_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKClosureReason$OutdatedChannelManager;"));
+ CHECK(LDKClosureReason_OutdatedChannelManager_class != NULL);
+ LDKClosureReason_OutdatedChannelManager_meth = (*env)->GetMethodID(env, LDKClosureReason_OutdatedChannelManager_class, "<init>", "()V");
+ CHECK(LDKClosureReason_OutdatedChannelManager_meth != NULL);
+}
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
+ LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKClosureReason_CounterpartyForceClosed: {
+ LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
+ jstring peer_msg_conv = str_ref_to_java(env, peer_msg_str.chars, peer_msg_str.len);
+ return (*env)->NewObject(env, LDKClosureReason_CounterpartyForceClosed_class, LDKClosureReason_CounterpartyForceClosed_meth, peer_msg_conv);
+ }
+ case LDKClosureReason_HolderForceClosed: {
+ return (*env)->NewObject(env, LDKClosureReason_HolderForceClosed_class, LDKClosureReason_HolderForceClosed_meth);
+ }
+ case LDKClosureReason_CooperativeClosure: {
+ return (*env)->NewObject(env, LDKClosureReason_CooperativeClosure_class, LDKClosureReason_CooperativeClosure_meth);
+ }
+ case LDKClosureReason_CommitmentTxConfirmed: {
+ return (*env)->NewObject(env, LDKClosureReason_CommitmentTxConfirmed_class, LDKClosureReason_CommitmentTxConfirmed_meth);
+ }
+ case LDKClosureReason_ProcessingError: {
+ LDKStr err_str = obj->processing_error.err;
+ jstring err_conv = str_ref_to_java(env, err_str.chars, err_str.len);
+ return (*env)->NewObject(env, LDKClosureReason_ProcessingError_class, LDKClosureReason_ProcessingError_meth, err_conv);
+ }
+ case LDKClosureReason_DisconnectedPeer: {
+ return (*env)->NewObject(env, LDKClosureReason_DisconnectedPeer_class, LDKClosureReason_DisconnectedPeer_meth);
+ }
+ case LDKClosureReason_OutdatedChannelManager: {
+ return (*env)->NewObject(env, LDKClosureReason_OutdatedChannelManager_class, LDKClosureReason_OutdatedChannelManager_meth);
+ }
+ default: abort();
+ }
+}
static jclass LDKEvent_FundingGenerationReady_class = NULL;
static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
static jclass LDKEvent_PaymentReceived_class = NULL;
static jmethodID LDKEvent_PaymentReceived_meth = NULL;
static jclass LDKEvent_PaymentSent_class = NULL;
static jmethodID LDKEvent_PaymentSent_meth = NULL;
-static jclass LDKEvent_PaymentFailed_class = NULL;
-static jmethodID LDKEvent_PaymentFailed_meth = NULL;
+static jclass LDKEvent_PaymentPathFailed_class = NULL;
+static jmethodID LDKEvent_PaymentPathFailed_meth = NULL;
static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
static jclass LDKEvent_SpendableOutputs_class = NULL;
static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
static jclass LDKEvent_PaymentForwarded_class = NULL;
static jmethodID LDKEvent_PaymentForwarded_meth = NULL;
+static jclass LDKEvent_ChannelClosed_class = NULL;
+static jmethodID LDKEvent_ChannelClosed_meth = NULL;
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv *env, jclass clz) {
LDKEvent_FundingGenerationReady_class =
(*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
CHECK(LDKEvent_PaymentSent_class != NULL);
LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
CHECK(LDKEvent_PaymentSent_meth != NULL);
- LDKEvent_PaymentFailed_class =
- (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
- CHECK(LDKEvent_PaymentFailed_class != NULL);
- LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
- CHECK(LDKEvent_PaymentFailed_meth != NULL);
+ LDKEvent_PaymentPathFailed_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentPathFailed;"));
+ CHECK(LDKEvent_PaymentPathFailed_class != NULL);
+ LDKEvent_PaymentPathFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentPathFailed_class, "<init>", "([BZJZ[J)V");
+ CHECK(LDKEvent_PaymentPathFailed_meth != NULL);
LDKEvent_PendingHTLCsForwardable_class =
(*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
CHECK(LDKEvent_PaymentForwarded_class != NULL);
LDKEvent_PaymentForwarded_meth = (*env)->GetMethodID(env, LDKEvent_PaymentForwarded_class, "<init>", "(JZ)V");
CHECK(LDKEvent_PaymentForwarded_meth != NULL);
+ LDKEvent_ChannelClosed_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$ChannelClosed;"));
+ CHECK(LDKEvent_ChannelClosed_class != NULL);
+ LDKEvent_ChannelClosed_meth = (*env)->GetMethodID(env, LDKEvent_ChannelClosed_class, "<init>", "([BJ)V");
+ CHECK(LDKEvent_ChannelClosed_meth != NULL);
}
JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
LDKEvent *obj = (LDKEvent*)(ptr & ~1);
(*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
}
- case LDKEvent_PaymentFailed: {
+ case LDKEvent_PaymentPathFailed: {
int8_tArray payment_hash_arr = (*env)->NewByteArray(env, 32);
- (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
- return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
+ (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_path_failed.payment_hash.data);
+ uint64_t network_update_ref = ((uint64_t)&obj->payment_path_failed.network_update) | 1;
+ LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
+ int64_tArray path_arr = (*env)->NewLongArray(env, path_var.datalen);
+ int64_t *path_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, path_arr, NULL);
+ for (size_t k = 0; k < path_var.datalen; k++) {
+ LDKRouteHop path_conv_10_var = path_var.data[k];
+ CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
+ path_arr_ptr[k] = path_conv_10_ref;
+ }
+ (*env)->ReleasePrimitiveArrayCritical(env, path_arr, path_arr_ptr, 0);
+ return (*env)->NewObject(env, LDKEvent_PaymentPathFailed_class, LDKEvent_PaymentPathFailed_meth, payment_hash_arr, obj->payment_path_failed.rejected_by_dest, network_update_ref, obj->payment_path_failed.all_paths_failed, path_arr);
}
case LDKEvent_PendingHTLCsForwardable: {
return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
return (*env)->NewObject(env, LDKEvent_PaymentForwarded_class, LDKEvent_PaymentForwarded_meth, fee_earned_msat_ref, obj->payment_forwarded.claim_from_onchain_tx);
}
+ case LDKEvent_ChannelClosed: {
+ int8_tArray channel_id_arr = (*env)->NewByteArray(env, 32);
+ (*env)->SetByteArrayRegion(env, channel_id_arr, 0, 32, obj->channel_closed.channel_id.data);
+ uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1;
+ return (*env)->NewObject(env, LDKEvent_ChannelClosed_class, LDKEvent_ChannelClosed_meth, channel_id_arr, reason_ref);
+ }
default: abort();
}
}
}
return ret;
}
-JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
- return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
-}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
- LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
- CHECK(val->result_ok);
- uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
- return res_ref;
+static jclass LDKBalance_ClaimableOnChannelClose_class = NULL;
+static jmethodID LDKBalance_ClaimableOnChannelClose_meth = NULL;
+static jclass LDKBalance_ClaimableAwaitingConfirmations_class = NULL;
+static jmethodID LDKBalance_ClaimableAwaitingConfirmations_meth = NULL;
+static jclass LDKBalance_ContentiousClaimable_class = NULL;
+static jmethodID LDKBalance_ContentiousClaimable_meth = NULL;
+static jclass LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class = NULL;
+static jmethodID LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = NULL;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init (JNIEnv *env, jclass clz) {
+ LDKBalance_ClaimableOnChannelClose_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ClaimableOnChannelClose;"));
+ CHECK(LDKBalance_ClaimableOnChannelClose_class != NULL);
+ LDKBalance_ClaimableOnChannelClose_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableOnChannelClose_class, "<init>", "(J)V");
+ CHECK(LDKBalance_ClaimableOnChannelClose_meth != NULL);
+ LDKBalance_ClaimableAwaitingConfirmations_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ClaimableAwaitingConfirmations;"));
+ CHECK(LDKBalance_ClaimableAwaitingConfirmations_class != NULL);
+ LDKBalance_ClaimableAwaitingConfirmations_meth = (*env)->GetMethodID(env, LDKBalance_ClaimableAwaitingConfirmations_class, "<init>", "(JI)V");
+ CHECK(LDKBalance_ClaimableAwaitingConfirmations_meth != NULL);
+ LDKBalance_ContentiousClaimable_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$ContentiousClaimable;"));
+ CHECK(LDKBalance_ContentiousClaimable_class != NULL);
+ LDKBalance_ContentiousClaimable_meth = (*env)->GetMethodID(env, LDKBalance_ContentiousClaimable_class, "<init>", "(JI)V");
+ CHECK(LDKBalance_ContentiousClaimable_meth != NULL);
+ LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKBalance$MaybeClaimableHTLCAwaitingTimeout;"));
+ CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class != NULL);
+ LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth = (*env)->GetMethodID(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, "<init>", "(JI)V");
+ CHECK(LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth != NULL);
+}
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
+ LDKBalance *obj = (LDKBalance*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKBalance_ClaimableOnChannelClose: {
+ return (*env)->NewObject(env, LDKBalance_ClaimableOnChannelClose_class, LDKBalance_ClaimableOnChannelClose_meth, obj->claimable_on_channel_close.claimable_amount_satoshis);
+ }
+ case LDKBalance_ClaimableAwaitingConfirmations: {
+ return (*env)->NewObject(env, LDKBalance_ClaimableAwaitingConfirmations_class, LDKBalance_ClaimableAwaitingConfirmations_meth, obj->claimable_awaiting_confirmations.claimable_amount_satoshis, obj->claimable_awaiting_confirmations.confirmation_height);
+ }
+ case LDKBalance_ContentiousClaimable: {
+ return (*env)->NewObject(env, LDKBalance_ContentiousClaimable_class, LDKBalance_ContentiousClaimable_meth, obj->contentious_claimable.claimable_amount_satoshis, obj->contentious_claimable.timeout_height);
+ }
+ case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
+ return (*env)->NewObject(env, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_class, LDKBalance_MaybeClaimableHTLCAwaitingTimeout_meth, obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis, obj->maybe_claimable_htlc_awaiting_timeout.claimable_height);
+ }
+ default: abort();
+ }
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
- LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
- CHECK(!val->result_ok);
- LDKDecodeError err_var = (*val->contents.err);
- CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1BalanceZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
+ LDKCVec_BalanceZ *ret = MALLOC(sizeof(LDKCVec_BalanceZ), "LDKCVec_BalanceZ");
+ ret->datalen = (*env)->GetArrayLength(env, elems);
+ if (ret->datalen == 0) {
+ ret->data = NULL;
+ } else {
+ ret->data = MALLOC(sizeof(LDKBalance) * ret->datalen, "LDKCVec_BalanceZ Data");
+ int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
+ for (size_t i = 0; i < ret->datalen; i++) {
+ int64_t arr_elem = java_elems[i];
+ LDKBalance arr_elem_conv = *(LDKBalance*)(((uint64_t)arr_elem) & ~1);
+ arr_elem_conv = Balance_clone((LDKBalance*)(((uint64_t)arr_elem) & ~1));
+ ret->data[i] = arr_elem_conv;
+ }
+ (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
+ }
+ return (uint64_t)ret;
+}
+static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
+ LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
+ for (size_t i = 0; i < ret.datalen; i++) {
+ ret.data[i] = Balance_clone(&orig->data[i]);
+ }
+ return ret;
+}
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+ return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+ LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
+ CHECK(val->result_ok);
+ uint64_t res_ref = (uint64_t)(&(*val->contents.result)) | 1;
+ return res_ref;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
+ LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *val = (LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)(arg & ~1);
+ CHECK(!val->result_ok);
+ LDKDecodeError err_var = (*val->contents.err);
+ CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t err_ref = (uint64_t)err_var.inner & ~1;
+ return err_ref;
+}
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+ return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
+}
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
+ LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
+ CHECK(val->result_ok);
+ return *val->contents.result;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
+ LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
+ CHECK(!val->result_ok);
+ LDKLightningError err_var = (*val->contents.err);
+ CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t err_ref = (uint64_t)err_var.inner & ~1;
return err_ref;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
+ LDKC2Tuple_PublicKeyTypeZ* ret = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
+ LDKPublicKey a_ref;
+ CHECK((*env)->GetArrayLength(env, a) == 33);
+ (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
+ ret->a = a_ref;
+ LDKType b_conv = *(LDKType*)(((uint64_t)b) & ~1);
+ b_conv = Type_clone(&b_conv);
+ ret->b = b_conv;
+ return (uint64_t)ret;
+}
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PublicKeyTypeZ_1get_1a(JNIEnv *env, jclass clz, int64_t ptr) {
+ LDKC2Tuple_PublicKeyTypeZ *tuple = (LDKC2Tuple_PublicKeyTypeZ*)(ptr & ~1);
+ int8_tArray a_arr = (*env)->NewByteArray(env, 33);
+ (*env)->SetByteArrayRegion(env, a_arr, 0, 33, tuple->a.compressed_form);
+ return a_arr;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PublicKeyTypeZ_1get_1b(JNIEnv *env, jclass clz, int64_t ptr) {
+ LDKC2Tuple_PublicKeyTypeZ *tuple = (LDKC2Tuple_PublicKeyTypeZ*)(ptr & ~1);
+ LDKType* b_ret =MALLOC(sizeof(LDKType), "LDKType");
+ *b_ret = Type_clone(&tuple->b);
+ return (uint64_t)b_ret;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1PublicKeyTypeZZ_1new(JNIEnv *env, jclass clz, int64_tArray elems) {
+ LDKCVec_C2Tuple_PublicKeyTypeZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_PublicKeyTypeZZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ");
+ ret->datalen = (*env)->GetArrayLength(env, elems);
+ if (ret->datalen == 0) {
+ ret->data = NULL;
+ } else {
+ ret->data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * ret->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ Data");
+ int64_t *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
+ for (size_t i = 0; i < ret->datalen; i++) {
+ int64_t arr_elem = java_elems[i];
+ LDKC2Tuple_PublicKeyTypeZ arr_elem_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1);
+ arr_elem_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1));
+ ret->data[i] = arr_elem_conv;
+ }
+ (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
+ }
+ return (uint64_t)ret;
+}
+static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
+ LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
+ for (size_t i = 0; i < ret.datalen; i++) {
+ ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
+ }
+ return ret;
+}
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
}
}
return ret;
}
-JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
- return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
-}
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok(JNIEnv *env, jclass clz, int64_t arg) {
- LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
- CHECK(val->result_ok);
- return *val->contents.result;
-}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err(JNIEnv *env, jclass clz, int64_t arg) {
- LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
- CHECK(!val->result_ok);
- LDKLightningError err_var = (*val->contents.err);
- CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t err_ref = (uint64_t)err_var.inner & ~1;
- return err_ref;
-}
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
}
uint64_t err_ref = (uint64_t)err_var.inner & ~1;
return err_ref;
}
+typedef struct LDKAccess_JCalls {
+ atomic_size_t refcnt;
+ JavaVM *vm;
+ jweak o;
+ jmethodID get_utxo_meth;
+} LDKAccess_JCalls;
+static void LDKAccess_JCalls_free(void* this_arg) {
+ LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
+ if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ (*env)->DeleteWeakGlobalRef(env, j_calls->o);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ FREE(j_calls);
+ }
+}
+LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
+ LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
+ (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
+ jobject obj = (*env)->NewLocalRef(env, j_calls->o);
+ CHECK(obj != NULL);
+ uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
+ if ((*env)->ExceptionCheck(env)) {
+ (*env)->ExceptionDescribe(env);
+ (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
+ }
+ LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
+ ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ return ret_conv;
+}
+static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
+ LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
+ atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
+}
+static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
+ jclass c = (*env)->GetObjectClass(env, o);
+ CHECK(c != NULL);
+ LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
+ atomic_init(&calls->refcnt, 1);
+ DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
+ calls->o = (*env)->NewWeakGlobalRef(env, o);
+ calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
+ CHECK(calls->get_utxo_meth != NULL);
+
+ LDKAccess ret = {
+ .this_arg = (void*) calls,
+ .get_utxo = get_utxo_LDKAccess_jcall,
+ .free = LDKAccess_JCalls_free,
+ };
+ return ret;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
+ LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
+ *res_ptr = LDKAccess_init(env, clz, o);
+ return (uint64_t)res_ptr;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Access_1get_1utxo(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
+ LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
+ unsigned char genesis_hash_arr[32];
+ CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
+ (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
+ unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
+ LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
+ *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
+ return (uint64_t)ret_conv;
+}
+
+static jclass LDKCOption_AccessZ_Some_class = NULL;
+static jmethodID LDKCOption_AccessZ_Some_meth = NULL;
+static jclass LDKCOption_AccessZ_None_class = NULL;
+static jmethodID LDKCOption_AccessZ_None_meth = NULL;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AccessZ_init (JNIEnv *env, jclass clz) {
+ LDKCOption_AccessZ_Some_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_AccessZ$Some;"));
+ CHECK(LDKCOption_AccessZ_Some_class != NULL);
+ LDKCOption_AccessZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_Some_class, "<init>", "(J)V");
+ CHECK(LDKCOption_AccessZ_Some_meth != NULL);
+ LDKCOption_AccessZ_None_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_AccessZ$None;"));
+ CHECK(LDKCOption_AccessZ_None_class != NULL);
+ LDKCOption_AccessZ_None_meth = (*env)->GetMethodID(env, LDKCOption_AccessZ_None_class, "<init>", "()V");
+ CHECK(LDKCOption_AccessZ_None_meth != NULL);
+}
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
+ LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKCOption_AccessZ_Some: {
+ LDKAccess* some_ret =MALLOC(sizeof(LDKAccess), "LDKAccess");
+ *some_ret = obj->some;
+ // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
+ if ((*some_ret).free == LDKAccess_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKAccess_JCalls_cloned(&(*some_ret));
+ }
+ return (*env)->NewObject(env, LDKCOption_AccessZ_Some_class, LDKCOption_AccessZ_Some_meth, (uint64_t)some_ret);
+ }
+ case LDKCOption_AccessZ_None: {
+ return (*env)->NewObject(env, LDKCOption_AccessZ_None_class, LDKCOption_AccessZ_None_meth);
+ }
+ default: abort();
+ }
+}
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1DirectionalChannelInfoDecodeErrorZ_1result_1ok(JNIEnv *env, jclass clz, int64_t arg) {
return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
}
uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
return err_ref;
}
-typedef struct LDKMessageSendEventsProvider_JCalls {
+typedef struct LDKFilter_JCalls {
atomic_size_t refcnt;
JavaVM *vm;
jweak o;
- jmethodID get_and_clear_pending_msg_events_meth;
-} LDKMessageSendEventsProvider_JCalls;
-static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
- LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
+ jmethodID register_tx_meth;
+ jmethodID register_output_meth;
+} LDKFilter_JCalls;
+static void LDKFilter_JCalls_free(void* this_arg) {
+ LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
JNIEnv *env;
jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
FREE(j_calls);
}
}
-LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
- LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
+void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
+ LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
JNIEnv *env;
jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
if (get_jenv_res == JNI_EDETACHED) {
} else {
DO_ASSERT(get_jenv_res == JNI_OK);
}
+ int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
+ (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
+ LDKu8slice script_pubkey_var = script_pubkey;
+ int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
+ (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
jobject obj = (*env)->NewLocalRef(env, j_calls->o);
CHECK(obj != NULL);
- int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
+ (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
if ((*env)->ExceptionCheck(env)) {
(*env)->ExceptionDescribe(env);
- (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
+ (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
}
- LDKCVec_MessageSendEventZ ret_constr;
- ret_constr.datalen = (*env)->GetArrayLength(env, ret);
- if (ret_constr.datalen > 0)
- ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
- else
- ret_constr.data = NULL;
- int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
- for (size_t s = 0; s < ret_constr.datalen; s++) {
- int64_t ret_conv_18 = ret_vals[s];
- LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
- ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
- ret_constr.data[s] = ret_conv_18_conv;
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
}
- (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
+}
+LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
+ LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ LDKWatchedOutput output_var = output;
+ CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t output_ref = (uint64_t)output_var.inner;
+ if (output_var.is_owned) {
+ output_ref |= 1;
+ }
+ jobject obj = (*env)->NewLocalRef(env, j_calls->o);
+ CHECK(obj != NULL);
+ uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
+ if ((*env)->ExceptionCheck(env)) {
+ (*env)->ExceptionDescribe(env);
+ (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
+ }
+ LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
+ ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
if (get_jenv_res == JNI_EDETACHED) {
DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
}
- return ret_constr;
+ return ret_conv;
}
-static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
- LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
+static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
+ LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
}
-static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
+static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
jclass c = (*env)->GetObjectClass(env, o);
CHECK(c != NULL);
- LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
+ LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
+ atomic_init(&calls->refcnt, 1);
+ DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
+ calls->o = (*env)->NewWeakGlobalRef(env, o);
+ calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
+ CHECK(calls->register_tx_meth != NULL);
+ calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
+ CHECK(calls->register_output_meth != NULL);
+
+ LDKFilter ret = {
+ .this_arg = (void*) calls,
+ .register_tx = register_tx_LDKFilter_jcall,
+ .register_output = register_output_LDKFilter_jcall,
+ .free = LDKFilter_JCalls_free,
+ };
+ return ret;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
+ LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
+ *res_ptr = LDKFilter_init(env, clz, o);
+ return (uint64_t)res_ptr;
+}
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
+ LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
+ unsigned char txid_arr[32];
+ CHECK((*env)->GetArrayLength(env, txid) == 32);
+ (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
+ unsigned char (*txid_ref)[32] = &txid_arr;
+ LDKu8slice script_pubkey_ref;
+ script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
+ script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
+ (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
+ (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
+ LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
+ LDKWatchedOutput output_conv;
+ output_conv.inner = (void*)(output & (~1));
+ output_conv.is_owned = (output & 1) || (output == 0);
+ output_conv = WatchedOutput_clone(&output_conv);
+ LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
+ *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+static jclass LDKCOption_FilterZ_Some_class = NULL;
+static jmethodID LDKCOption_FilterZ_Some_meth = NULL;
+static jclass LDKCOption_FilterZ_None_class = NULL;
+static jmethodID LDKCOption_FilterZ_None_meth = NULL;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init (JNIEnv *env, jclass clz) {
+ LDKCOption_FilterZ_Some_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_FilterZ$Some;"));
+ CHECK(LDKCOption_FilterZ_Some_class != NULL);
+ LDKCOption_FilterZ_Some_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_Some_class, "<init>", "(J)V");
+ CHECK(LDKCOption_FilterZ_Some_meth != NULL);
+ LDKCOption_FilterZ_None_class =
+ (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKCOption_FilterZ$None;"));
+ CHECK(LDKCOption_FilterZ_None_class != NULL);
+ LDKCOption_FilterZ_None_meth = (*env)->GetMethodID(env, LDKCOption_FilterZ_None_class, "<init>", "()V");
+ CHECK(LDKCOption_FilterZ_None_meth != NULL);
+}
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr(JNIEnv *env, jclass clz, int64_t ptr) {
+ LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKCOption_FilterZ_Some: {
+ LDKFilter* some_ret =MALLOC(sizeof(LDKFilter), "LDKFilter");
+ *some_ret = obj->some;
+ // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
+ if ((*some_ret).free == LDKFilter_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKFilter_JCalls_cloned(&(*some_ret));
+ }
+ return (*env)->NewObject(env, LDKCOption_FilterZ_Some_class, LDKCOption_FilterZ_Some_meth, (uint64_t)some_ret);
+ }
+ case LDKCOption_FilterZ_None: {
+ return (*env)->NewObject(env, LDKCOption_FilterZ_None_class, LDKCOption_FilterZ_None_meth);
+ }
+ default: abort();
+ }
+}
+typedef struct LDKMessageSendEventsProvider_JCalls {
+ atomic_size_t refcnt;
+ JavaVM *vm;
+ jweak o;
+ jmethodID get_and_clear_pending_msg_events_meth;
+} LDKMessageSendEventsProvider_JCalls;
+static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
+ LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
+ if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ (*env)->DeleteWeakGlobalRef(env, j_calls->o);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ FREE(j_calls);
+ }
+}
+LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_LDKMessageSendEventsProvider_jcall(const void* this_arg) {
+ LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ jobject obj = (*env)->NewLocalRef(env, j_calls->o);
+ CHECK(obj != NULL);
+ int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
+ if ((*env)->ExceptionCheck(env)) {
+ (*env)->ExceptionDescribe(env);
+ (*env)->FatalError(env, "A call to get_and_clear_pending_msg_events in LDKMessageSendEventsProvider from rust threw an exception.");
+ }
+ LDKCVec_MessageSendEventZ ret_constr;
+ ret_constr.datalen = (*env)->GetArrayLength(env, ret);
+ if (ret_constr.datalen > 0)
+ ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
+ else
+ ret_constr.data = NULL;
+ int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
+ for (size_t s = 0; s < ret_constr.datalen; s++) {
+ int64_t ret_conv_18 = ret_vals[s];
+ LDKMessageSendEvent ret_conv_18_conv = *(LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1);
+ ret_conv_18_conv = MessageSendEvent_clone((LDKMessageSendEvent*)(((uint64_t)ret_conv_18) & ~1));
+ ret_constr.data[s] = ret_conv_18_conv;
+ }
+ (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ return ret_constr;
+}
+static void LDKMessageSendEventsProvider_JCalls_cloned(LDKMessageSendEventsProvider* new_obj) {
+ LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) new_obj->this_arg;
+ atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
+}
+static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv *env, jclass clz, jobject o) {
+ jclass c = (*env)->GetObjectClass(env, o);
+ CHECK(c != NULL);
+ LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
atomic_init(&calls->refcnt, 1);
DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
calls->o = (*env)->NewWeakGlobalRef(env, o);
FREE(j_calls);
}
}
-void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
+void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
JNIEnv *env;
jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
} else {
DO_ASSERT(get_jenv_res == JNI_OK);
}
- LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
- *event_copy = event;
- uint64_t event_ref = (uint64_t)event_copy;
+ LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
+ *ret_event = Event_clone(event);
jobject obj = (*env)->NewLocalRef(env, j_calls->o);
CHECK(obj != NULL);
- (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, event_ref);
+ (*env)->CallVoidMethod(env, obj, j_calls->handle_event_meth, (uint64_t)ret_event);
if ((*env)->ExceptionCheck(env)) {
(*env)->ExceptionDescribe(env);
(*env)->FatalError(env, "A call to handle_event in LDKEventHandler from rust threw an exception.");
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventHandler_1handle_1event(JNIEnv *env, jclass clz, int64_t this_arg, int64_t event) {
LDKEventHandler* this_arg_conv = (LDKEventHandler*)(((uint64_t)this_arg) & ~1);
- LDKEvent event_conv = *(LDKEvent*)(((uint64_t)event) & ~1);
+ LDKEvent* event_conv = (LDKEvent*)event;
(this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
}
} else {
DO_ASSERT(get_jenv_res == JNI_OK);
}
- LDKEventHandler* ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
- *ret = handler;
+ LDKEventHandler* handler_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
+ *handler_ret = handler;
jobject obj = (*env)->NewLocalRef(env, j_calls->o);
CHECK(obj != NULL);
- (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (uint64_t)ret);
+ (*env)->CallVoidMethod(env, obj, j_calls->process_pending_events_meth, (uint64_t)handler_ret);
if ((*env)->ExceptionCheck(env)) {
(*env)->ExceptionDescribe(env);
(*env)->FatalError(env, "A call to process_pending_events in LDKEventsProvider from rust threw an exception.");
(this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
}
-typedef struct LDKAccess_JCalls {
- atomic_size_t refcnt;
- JavaVM *vm;
- jweak o;
- jmethodID get_utxo_meth;
-} LDKAccess_JCalls;
-static void LDKAccess_JCalls_free(void* this_arg) {
- LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
- if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
- JNIEnv *env;
- jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
- if (get_jenv_res == JNI_EDETACHED) {
- DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
- } else {
- DO_ASSERT(get_jenv_res == JNI_OK);
- }
- (*env)->DeleteWeakGlobalRef(env, j_calls->o);
- if (get_jenv_res == JNI_EDETACHED) {
- DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
- }
- FREE(j_calls);
- }
-}
-LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
- LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
- JNIEnv *env;
- jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
- if (get_jenv_res == JNI_EDETACHED) {
- DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
- } else {
- DO_ASSERT(get_jenv_res == JNI_OK);
- }
- int8_tArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
- (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
- jobject obj = (*env)->NewLocalRef(env, j_calls->o);
- CHECK(obj != NULL);
- uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
- if ((*env)->ExceptionCheck(env)) {
- (*env)->ExceptionDescribe(env);
- (*env)->FatalError(env, "A call to get_utxo in LDKAccess from rust threw an exception.");
- }
- LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
- ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
- if (get_jenv_res == JNI_EDETACHED) {
- DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
- }
- return ret_conv;
-}
-static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
- LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
- atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
-}
-static inline LDKAccess LDKAccess_init (JNIEnv *env, jclass clz, jobject o) {
- jclass c = (*env)->GetObjectClass(env, o);
- CHECK(c != NULL);
- LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
- atomic_init(&calls->refcnt, 1);
- DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
- calls->o = (*env)->NewWeakGlobalRef(env, o);
- calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
- CHECK(calls->get_utxo_meth != NULL);
-
- LDKAccess ret = {
- .this_arg = (void*) calls,
- .get_utxo = get_utxo_LDKAccess_jcall,
- .free = LDKAccess_JCalls_free,
- };
- return ret;
-}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new(JNIEnv *env, jclass clz, jobject o) {
- LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
- *res_ptr = LDKAccess_init(env, clz, o);
- return (uint64_t)res_ptr;
-}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Access_1get_1utxo(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
- LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
- unsigned char genesis_hash_arr[32];
- CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
- (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_arr);
- unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
- LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
- *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
- return (uint64_t)ret_conv;
-}
-
typedef struct LDKListen_JCalls {
atomic_size_t refcnt;
JavaVM *vm;
(this_arg_conv->best_block_updated)(this_arg_conv->this_arg, header_ref, height);
}
-JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
- LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
- LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
- jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
- ;
- for (size_t i = 0; i < ret_var.datalen; i++) {
- int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
- (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
- (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
- }
- FREE(ret_var.data);
- return ret_arr;
-}
-
-typedef struct LDKFilter_JCalls {
- atomic_size_t refcnt;
- JavaVM *vm;
- jweak o;
- jmethodID register_tx_meth;
- jmethodID register_output_meth;
-} LDKFilter_JCalls;
-static void LDKFilter_JCalls_free(void* this_arg) {
- LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
- if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
- JNIEnv *env;
- jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
- if (get_jenv_res == JNI_EDETACHED) {
- DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
- } else {
- DO_ASSERT(get_jenv_res == JNI_OK);
- }
- (*env)->DeleteWeakGlobalRef(env, j_calls->o);
- if (get_jenv_res == JNI_EDETACHED) {
- DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
- }
- FREE(j_calls);
- }
-}
-void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
- LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
- JNIEnv *env;
- jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
- if (get_jenv_res == JNI_EDETACHED) {
- DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
- } else {
- DO_ASSERT(get_jenv_res == JNI_OK);
- }
- int8_tArray txid_arr = (*env)->NewByteArray(env, 32);
- (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
- LDKu8slice script_pubkey_var = script_pubkey;
- int8_tArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
- (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
- jobject obj = (*env)->NewLocalRef(env, j_calls->o);
- CHECK(obj != NULL);
- (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
- if ((*env)->ExceptionCheck(env)) {
- (*env)->ExceptionDescribe(env);
- (*env)->FatalError(env, "A call to register_tx in LDKFilter from rust threw an exception.");
- }
- if (get_jenv_res == JNI_EDETACHED) {
- DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
- }
-}
-LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
- LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
- JNIEnv *env;
- jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
- if (get_jenv_res == JNI_EDETACHED) {
- DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
- } else {
- DO_ASSERT(get_jenv_res == JNI_OK);
- }
- LDKWatchedOutput output_var = output;
- CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t output_ref = (uint64_t)output_var.inner;
- if (output_var.is_owned) {
- output_ref |= 1;
- }
- jobject obj = (*env)->NewLocalRef(env, j_calls->o);
- CHECK(obj != NULL);
- uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->register_output_meth, output_ref);
- if ((*env)->ExceptionCheck(env)) {
- (*env)->ExceptionDescribe(env);
- (*env)->FatalError(env, "A call to register_output in LDKFilter from rust threw an exception.");
- }
- LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
- ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
- if (get_jenv_res == JNI_EDETACHED) {
- DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
- }
- return ret_conv;
-}
-static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
- LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
- atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
-}
-static inline LDKFilter LDKFilter_init (JNIEnv *env, jclass clz, jobject o) {
- jclass c = (*env)->GetObjectClass(env, o);
- CHECK(c != NULL);
- LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
- atomic_init(&calls->refcnt, 1);
- DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
- calls->o = (*env)->NewWeakGlobalRef(env, o);
- calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
- CHECK(calls->register_tx_meth != NULL);
- calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J)J");
- CHECK(calls->register_output_meth != NULL);
-
- LDKFilter ret = {
- .this_arg = (void*) calls,
- .register_tx = register_tx_LDKFilter_jcall,
- .register_output = register_output_LDKFilter_jcall,
- .free = LDKFilter_JCalls_free,
- };
- return ret;
-}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new(JNIEnv *env, jclass clz, jobject o) {
- LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
- *res_ptr = LDKFilter_init(env, clz, o);
- return (uint64_t)res_ptr;
-}
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
- LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
- unsigned char txid_arr[32];
- CHECK((*env)->GetArrayLength(env, txid) == 32);
- (*env)->GetByteArrayRegion(env, txid, 0, 32, txid_arr);
- unsigned char (*txid_ref)[32] = &txid_arr;
- LDKu8slice script_pubkey_ref;
- script_pubkey_ref.datalen = (*env)->GetArrayLength(env, script_pubkey);
- script_pubkey_ref.data = (*env)->GetByteArrayElements (env, script_pubkey, NULL);
- (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
- (*env)->ReleaseByteArrayElements(env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
-}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv *env, jclass clz, int64_t this_arg, int64_t output) {
- LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
- LDKWatchedOutput output_conv;
- output_conv.inner = (void*)(output & (~1));
- output_conv.is_owned = (output & 1) || (output == 0);
- output_conv = WatchedOutput_clone(&output_conv);
- LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
- *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
- uint64_t ret_ref = (uint64_t)ret_copy;
- return ret_ref;
+JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKConfirm* this_arg_conv = (LDKConfirm*)(((uint64_t)this_arg) & ~1);
+ LDKCVec_TxidZ ret_var = (this_arg_conv->get_relevant_txids)(this_arg_conv->this_arg);
+ jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_B_clz, NULL);
+ ;
+ for (size_t i = 0; i < ret_var.datalen; i++) {
+ int8_tArray ret_conv_8_arr = (*env)->NewByteArray(env, 32);
+ (*env)->SetByteArrayRegion(env, ret_conv_8_arr, 0, 32, ret_var.data[i].data);
+ (*env)->SetObjectArrayElement(env, ret_arr, i, ret_conv_8_arr);
+ }
+ FREE(ret_var.data);
+ return ret_arr;
}
typedef struct LDKPersist_JCalls {
jmethodID handle_node_announcement_meth;
jmethodID handle_channel_announcement_meth;
jmethodID handle_channel_update_meth;
- jmethodID handle_htlc_fail_channel_update_meth;
jmethodID get_next_channel_announcements_meth;
jmethodID get_next_node_announcements_meth;
jmethodID sync_routing_table_meth;
}
return ret_conv;
}
-void handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
- LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
- JNIEnv *env;
- jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
- if (get_jenv_res == JNI_EDETACHED) {
- DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
- } else {
- DO_ASSERT(get_jenv_res == JNI_OK);
- }
- uint64_t ret_update = (uint64_t)update;
- jobject obj = (*env)->NewLocalRef(env, j_calls->o);
- CHECK(obj != NULL);
- (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, ret_update);
- if ((*env)->ExceptionCheck(env)) {
- (*env)->ExceptionDescribe(env);
- (*env)->FatalError(env, "A call to handle_htlc_fail_channel_update in LDKRoutingMessageHandler from rust threw an exception.");
- }
- if (get_jenv_res == JNI_EDETACHED) {
- DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
- }
-}
LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
JNIEnv *env;
CHECK(calls->handle_channel_announcement_meth != NULL);
calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
CHECK(calls->handle_channel_update_meth != NULL);
- calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
- CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
CHECK(calls->get_next_channel_announcements_meth != NULL);
calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
.handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
.handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
.handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
- .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall,
.get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
.get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
.sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
*ret_conv = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
return (uint64_t)ret_conv;
}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
- LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
- LDKChannelUpdate msg_conv;
- msg_conv.inner = (void*)(msg & (~1));
- msg_conv.is_owned = false;
- LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
- *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
- return (uint64_t)ret_conv;
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
+ LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
+ LDKChannelUpdate msg_conv;
+ msg_conv.inner = (void*)(msg & (~1));
+ msg_conv.is_owned = false;
+ LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
+ *ret_conv = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1channel_1announcements(JNIEnv *env, jclass clz, int64_t this_arg, int64_t starting_point, int8_t batch_amount) {
+ LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
+ LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
+ int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
+ int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
+ for (size_t l = 0; l < ret_var.datalen; l++) {
+ LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
+ *ret_conv_63_ref = ret_var.data[l];
+ ret_arr_ptr[l] = (uint64_t)ret_conv_63_ref;
+ }
+ (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
+JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1node_1announcements(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
+ LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
+ LDKPublicKey starting_point_ref;
+ CHECK((*env)->GetArrayLength(env, starting_point) == 33);
+ (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
+ LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
+ int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
+ int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
+ for (size_t s = 0; s < ret_var.datalen; s++) {
+ LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
+ CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
+ if (ret_conv_18_var.is_owned) {
+ ret_conv_18_ref |= 1;
+ }
+ ret_arr_ptr[s] = ret_conv_18_ref;
+ }
+ (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1sync_1routing_1table(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init) {
+ LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
+ LDKPublicKey their_node_id_ref;
+ CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
+ (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
+ LDKInit init_conv;
+ init_conv.inner = (void*)(init & (~1));
+ init_conv.is_owned = false;
+ (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1reply_1channel_1range(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
+ LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
+ LDKPublicKey their_node_id_ref;
+ CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
+ (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
+ LDKReplyChannelRange msg_conv;
+ msg_conv.inner = (void*)(msg & (~1));
+ msg_conv.is_owned = (msg & 1) || (msg == 0);
+ msg_conv = ReplyChannelRange_clone(&msg_conv);
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1reply_1short_1channel_1ids_1end(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
+ LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
+ LDKPublicKey their_node_id_ref;
+ CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
+ (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
+ LDKReplyShortChannelIdsEnd msg_conv;
+ msg_conv.inner = (void*)(msg & (~1));
+ msg_conv.is_owned = (msg & 1) || (msg == 0);
+ msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1query_1channel_1range(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
+ LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
+ LDKPublicKey their_node_id_ref;
+ CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
+ (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
+ LDKQueryChannelRange msg_conv;
+ msg_conv.inner = (void*)(msg & (~1));
+ msg_conv.is_owned = (msg & 1) || (msg == 0);
+ msg_conv = QueryChannelRange_clone(&msg_conv);
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1query_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
+ LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
+ LDKPublicKey their_node_id_ref;
+ CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
+ (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
+ LDKQueryShortChannelIds msg_conv;
+ msg_conv.inner = (void*)(msg & (~1));
+ msg_conv.is_owned = (msg & 1) || (msg == 0);
+ msg_conv = QueryShortChannelIds_clone(&msg_conv);
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
+ return (uint64_t)ret_conv;
+}
+
+typedef struct LDKCustomMessageReader_JCalls {
+ atomic_size_t refcnt;
+ JavaVM *vm;
+ jweak o;
+ jmethodID read_meth;
+} LDKCustomMessageReader_JCalls;
+static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
+ LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
+ if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ (*env)->DeleteWeakGlobalRef(env, j_calls->o);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ FREE(j_calls);
+ }
+}
+LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
+ LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ LDKu8slice buffer_var = buffer;
+ int8_tArray buffer_arr = (*env)->NewByteArray(env, buffer_var.datalen);
+ (*env)->SetByteArrayRegion(env, buffer_arr, 0, buffer_var.datalen, buffer_var.data);
+ jobject obj = (*env)->NewLocalRef(env, j_calls->o);
+ CHECK(obj != NULL);
+ uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->read_meth, message_type, buffer_arr);
+ if ((*env)->ExceptionCheck(env)) {
+ (*env)->ExceptionDescribe(env);
+ (*env)->FatalError(env, "A call to read in LDKCustomMessageReader from rust threw an exception.");
+ }
+ LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1);
+ ret_conv = CResult_COption_TypeZDecodeErrorZ_clone((LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1));
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ return ret_conv;
+}
+static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
+ LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
+ atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
+}
+static inline LDKCustomMessageReader LDKCustomMessageReader_init (JNIEnv *env, jclass clz, jobject o) {
+ jclass c = (*env)->GetObjectClass(env, o);
+ CHECK(c != NULL);
+ LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
+ atomic_init(&calls->refcnt, 1);
+ DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
+ calls->o = (*env)->NewWeakGlobalRef(env, o);
+ calls->read_meth = (*env)->GetMethodID(env, c, "read", "(S[B)J");
+ CHECK(calls->read_meth != NULL);
+
+ LDKCustomMessageReader ret = {
+ .this_arg = (void*) calls,
+ .read = read_LDKCustomMessageReader_jcall,
+ .free = LDKCustomMessageReader_JCalls_free,
+ };
+ return ret;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new(JNIEnv *env, jclass clz, jobject o) {
+ LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
+ *res_ptr = LDKCustomMessageReader_init(env, clz, o);
+ return (uint64_t)res_ptr;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1read(JNIEnv *env, jclass clz, int64_t this_arg, int16_t message_type, int8_tArray buffer) {
+ LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)(((uint64_t)this_arg) & ~1);
+ LDKu8slice buffer_ref;
+ buffer_ref.datalen = (*env)->GetArrayLength(env, buffer);
+ buffer_ref.data = (*env)->GetByteArrayElements (env, buffer, NULL);
+ LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
+ *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
+ (*env)->ReleaseByteArrayElements(env, buffer, (int8_t*)buffer_ref.data, 0);
+ return (uint64_t)ret_conv;
+}
+
+typedef struct LDKCustomMessageHandler_JCalls {
+ atomic_size_t refcnt;
+ JavaVM *vm;
+ jweak o;
+ LDKCustomMessageReader_JCalls* CustomMessageReader;
+ jmethodID handle_custom_message_meth;
+ jmethodID get_and_clear_pending_msg_meth;
+} LDKCustomMessageHandler_JCalls;
+static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
+ LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
+ if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ (*env)->DeleteWeakGlobalRef(env, j_calls->o);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ FREE(j_calls);
+ }
+}
+LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
+ LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ LDKType* msg_ret =MALLOC(sizeof(LDKType), "LDKType");
+ *msg_ret = msg;
+ int8_tArray sender_node_id_arr = (*env)->NewByteArray(env, 33);
+ (*env)->SetByteArrayRegion(env, sender_node_id_arr, 0, 33, sender_node_id.compressed_form);
+ jobject obj = (*env)->NewLocalRef(env, j_calls->o);
+ CHECK(obj != NULL);
+ uint64_t ret = (*env)->CallLongMethod(env, obj, j_calls->handle_custom_message_meth, (uint64_t)msg_ret, sender_node_id_arr);
+ if ((*env)->ExceptionCheck(env)) {
+ (*env)->ExceptionDescribe(env);
+ (*env)->FatalError(env, "A call to handle_custom_message in LDKCustomMessageHandler from rust threw an exception.");
+ }
+ LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
+ ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ return ret_conv;
+}
+LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
+ LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
+ JNIEnv *env;
+ jint get_jenv_res = (*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_6);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->AttachCurrentThread(j_calls->vm, (void**)&env, NULL) == JNI_OK);
+ } else {
+ DO_ASSERT(get_jenv_res == JNI_OK);
+ }
+ jobject obj = (*env)->NewLocalRef(env, j_calls->o);
+ CHECK(obj != NULL);
+ int64_tArray ret = (*env)->CallObjectMethod(env, obj, j_calls->get_and_clear_pending_msg_meth);
+ if ((*env)->ExceptionCheck(env)) {
+ (*env)->ExceptionDescribe(env);
+ (*env)->FatalError(env, "A call to get_and_clear_pending_msg in LDKCustomMessageHandler from rust threw an exception.");
+ }
+ LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
+ ret_constr.datalen = (*env)->GetArrayLength(env, ret);
+ if (ret_constr.datalen > 0)
+ ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
+ else
+ ret_constr.data = NULL;
+ int64_t* ret_vals = (*env)->GetLongArrayElements (env, ret, NULL);
+ for (size_t y = 0; y < ret_constr.datalen; y++) {
+ int64_t ret_conv_24 = ret_vals[y];
+ LDKC2Tuple_PublicKeyTypeZ ret_conv_24_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_24) & ~1);
+ ret_conv_24_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_24) & ~1));
+ ret_constr.data[y] = ret_conv_24_conv;
+ }
+ (*env)->ReleaseLongArrayElements(env, ret, ret_vals, 0);
+ if (get_jenv_res == JNI_EDETACHED) {
+ DO_ASSERT((*j_calls->vm)->DetachCurrentThread(j_calls->vm) == JNI_OK);
+ }
+ return ret_constr;
+}
+static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
+ LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
+ atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
+ atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
}
+static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
+ jclass c = (*env)->GetObjectClass(env, o);
+ CHECK(c != NULL);
+ LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
+ atomic_init(&calls->refcnt, 1);
+ DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
+ calls->o = (*env)->NewWeakGlobalRef(env, o);
+ calls->handle_custom_message_meth = (*env)->GetMethodID(env, c, "handle_custom_message", "(J[B)J");
+ CHECK(calls->handle_custom_message_meth != NULL);
+ calls->get_and_clear_pending_msg_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg", "()[J");
+ CHECK(calls->get_and_clear_pending_msg_meth != NULL);
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(JNIEnv *env, jclass clz, int64_t this_arg, int64_t update) {
- LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
- LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
- (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
+ LDKCustomMessageHandler ret = {
+ .this_arg = (void*) calls,
+ .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
+ .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
+ .free = LDKCustomMessageHandler_JCalls_free,
+ .CustomMessageReader = LDKCustomMessageReader_init(env, clz, CustomMessageReader),
+ };
+ calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
+ return ret;
}
-
-JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1channel_1announcements(JNIEnv *env, jclass clz, int64_t this_arg, int64_t starting_point, int8_t batch_amount) {
- LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
- LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
- int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
- int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
- for (size_t l = 0; l < ret_var.datalen; l++) {
- LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_conv_63_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
- *ret_conv_63_ref = ret_var.data[l];
- ret_arr_ptr[l] = (uint64_t)ret_conv_63_ref;
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new(JNIEnv *env, jclass clz, jobject o, jobject CustomMessageReader) {
+ LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
+ *res_ptr = LDKCustomMessageHandler_init(env, clz, o, CustomMessageReader);
+ return (uint64_t)res_ptr;
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t arg) {
+ LDKCustomMessageHandler *inp = (LDKCustomMessageHandler *)(arg & ~1);
+ uint64_t res_ptr = (uint64_t)&inp->CustomMessageReader;
+ DO_ASSERT((res_ptr & 1) == 0);
+ return (int64_t)(res_ptr | 1);
+}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1handle_1custom_1message(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg, int8_tArray sender_node_id) {
+ LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)(((uint64_t)this_arg) & ~1);
+ LDKType msg_conv = *(LDKType*)(((uint64_t)msg) & ~1);
+ if (msg_conv.free == LDKType_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKType_JCalls_cloned(&msg_conv);
}
- (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
- FREE(ret_var.data);
- return ret_arr;
+ LDKPublicKey sender_node_id_ref;
+ CHECK((*env)->GetArrayLength(env, sender_node_id) == 33);
+ (*env)->GetByteArrayRegion(env, sender_node_id, 0, 33, sender_node_id_ref.compressed_form);
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
+ return (uint64_t)ret_conv;
}
-JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1node_1announcements(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray starting_point, int8_t batch_amount) {
- LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
- LDKPublicKey starting_point_ref;
- CHECK((*env)->GetArrayLength(env, starting_point) == 33);
- (*env)->GetByteArrayRegion(env, starting_point, 0, 33, starting_point_ref.compressed_form);
- LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
+JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)(((uint64_t)this_arg) & ~1);
+ LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
- for (size_t s = 0; s < ret_var.datalen; s++) {
- LDKNodeAnnouncement ret_conv_18_var = ret_var.data[s];
- CHECK((((uint64_t)ret_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&ret_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t ret_conv_18_ref = (uint64_t)ret_conv_18_var.inner;
- if (ret_conv_18_var.is_owned) {
- ret_conv_18_ref |= 1;
- }
- ret_arr_ptr[s] = ret_conv_18_ref;
+ for (size_t y = 0; y < ret_var.datalen; y++) {
+ LDKC2Tuple_PublicKeyTypeZ* ret_conv_24_ref = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
+ *ret_conv_24_ref = ret_var.data[y];
+ ret_arr_ptr[y] = (uint64_t)ret_conv_24_ref;
}
(*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
FREE(ret_var.data);
return ret_arr;
}
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1sync_1routing_1table(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t init) {
- LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
- LDKPublicKey their_node_id_ref;
- CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
- (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
- LDKInit init_conv;
- init_conv.inner = (void*)(init & (~1));
- init_conv.is_owned = false;
- (this_arg_conv->sync_routing_table)(this_arg_conv->this_arg, their_node_id_ref, &init_conv);
-}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1reply_1channel_1range(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
- LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
- LDKPublicKey their_node_id_ref;
- CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
- (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
- LDKReplyChannelRange msg_conv;
- msg_conv.inner = (void*)(msg & (~1));
- msg_conv.is_owned = (msg & 1) || (msg == 0);
- msg_conv = ReplyChannelRange_clone(&msg_conv);
- LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
- *ret_conv = (this_arg_conv->handle_reply_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
- return (uint64_t)ret_conv;
-}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1reply_1short_1channel_1ids_1end(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
- LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
- LDKPublicKey their_node_id_ref;
- CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
- (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
- LDKReplyShortChannelIdsEnd msg_conv;
- msg_conv.inner = (void*)(msg & (~1));
- msg_conv.is_owned = (msg & 1) || (msg == 0);
- msg_conv = ReplyShortChannelIdsEnd_clone(&msg_conv);
- LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
- *ret_conv = (this_arg_conv->handle_reply_short_channel_ids_end)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
- return (uint64_t)ret_conv;
-}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1query_1channel_1range(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
- LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
- LDKPublicKey their_node_id_ref;
- CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
- (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
- LDKQueryChannelRange msg_conv;
- msg_conv.inner = (void*)(msg & (~1));
- msg_conv.is_owned = (msg & 1) || (msg == 0);
- msg_conv = QueryChannelRange_clone(&msg_conv);
- LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
- *ret_conv = (this_arg_conv->handle_query_channel_range)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
- return (uint64_t)ret_conv;
-}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1query_1short_1channel_1ids(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray their_node_id, int64_t msg) {
- LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
- LDKPublicKey their_node_id_ref;
- CHECK((*env)->GetArrayLength(env, their_node_id) == 33);
- (*env)->GetByteArrayRegion(env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
- LDKQueryShortChannelIds msg_conv;
- msg_conv.inner = (void*)(msg & (~1));
- msg_conv.is_owned = (msg & 1) || (msg == 0);
- msg_conv = QueryShortChannelIds_clone(&msg_conv);
- LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
- *ret_conv = (this_arg_conv->handle_query_short_channel_ids)(this_arg_conv->this_arg, their_node_id_ref, msg_conv);
- return (uint64_t)ret_conv;
-}
-
typedef struct LDKSocketDescriptor_JCalls {
atomic_size_t refcnt;
JavaVM *vm;
return (uint64_t)ret_conv;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
+ LDKTrustedClosingTransaction o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = (o & 1) || (o == 0);
+ // Warning: we need a move here but no clone is available for LDKTrustedClosingTransaction
+ LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
+ *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err(JNIEnv *env, jclass clz) {
+ LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
+ *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CommitmentTransactionDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
LDKCommitmentTransaction o_conv;
o_conv.inner = (void*)(o & (~1));
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
+ o_conv = TxOut_clone((LDKTxOut*)(((uint64_t)o) & ~1));
LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
*ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
return (uint64_t)ret_conv;
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1some(JNIEnv *env, jclass clz, int64_t o) {
LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1);
+ o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1));
LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
*ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
uint64_t ret_ref = (uint64_t)ret_copy;
return ret_ref;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some(JNIEnv *env, jclass clz, int64_t o) {
+ LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(((uint64_t)o) & ~1);
+ o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uint64_t)o) & ~1));
+ LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
+ *ret_copy = COption_NetworkUpdateZ_some(o_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none(JNIEnv *env, jclass clz) {
+ LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
+ *ret_copy = COption_NetworkUpdateZ_none();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ COption_NetworkUpdateZ_free(_res_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
+ LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
+ *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
LDKCVec_SpendableOutputDescriptorZ _res_constr;
_res_constr.datalen = (*env)->GetArrayLength(env, _res);
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
+ o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1));
LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
*ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
return (uint64_t)ret_conv;
return (uint64_t)ret_conv;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok(JNIEnv *env, jclass clz) {
+ LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
+ *ret_conv = CResult_NoneNoneZ_ok();
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err(JNIEnv *env, jclass clz) {
+ LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
+ *ret_conv = CResult_NoneNoneZ_err();
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ CResult_NoneNoneZ_free(_res_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
+ LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
+ *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
+ return (uint64_t)ret_conv;
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
+ o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1));
LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
*ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
return (uint64_t)ret_conv;
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
+ e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
*ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
return (uint64_t)ret_conv;
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
+ e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
*ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
return (uint64_t)ret_conv;
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentHashPaymentSendFailureZ_1err(JNIEnv *env, jclass clz, int64_t e) {
LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
+ e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
*ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
return (uint64_t)ret_conv;
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1PaymentSecretAPIErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
+ e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
*ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
return (uint64_t)ret_conv;
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelManagerZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
+ // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
*ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
return (uint64_t)ret_conv;
return (uint64_t)ret_conv;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some(JNIEnv *env, jclass clz, int64_t o) {
+ LDKType o_conv = *(LDKType*)(((uint64_t)o) & ~1);
+ if (o_conv.free == LDKType_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKType_JCalls_cloned(&o_conv);
+ }
+ LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
+ *ret_copy = COption_TypeZ_some(o_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none(JNIEnv *env, jclass clz) {
+ LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
+ *ret_copy = COption_TypeZ_none();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ COption_TypeZ_free(_res_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
+ LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
+ *ret_copy = COption_TypeZ_clone(orig_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
+ LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(((uint64_t)o) & ~1);
+ o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uint64_t)o) & ~1));
+ LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
+ *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
+ LDKDecodeError e_conv;
+ e_conv.inner = (void*)(e & (~1));
+ e_conv.is_owned = (e & 1) || (e == 0);
+ e_conv = DecodeError_clone(&e_conv);
+ LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
+ *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
+ LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
+ *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
+ return (uint64_t)ret_conv;
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1SiPrefixNoneZ_1ok(JNIEnv *env, jclass clz, jclass o) {
LDKSiPrefix o_conv = LDKSiPrefix_from_java(env, o);
LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u32TxOutZ_1new(JNIEnv *env, jclass clz, int32_t a, int64_t b) {
LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
+ b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
*ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
return (uint64_t)ret_ref;
CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
}
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
+ LDKCVec_BalanceZ _res_constr;
+ _res_constr.datalen = (*env)->GetArrayLength(env, _res);
+ if (_res_constr.datalen > 0)
+ _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
+ else
+ _res_constr.data = NULL;
+ int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
+ for (size_t j = 0; j < _res_constr.datalen; j++) {
+ int64_t _res_conv_9 = _res_vals[j];
+ LDKBalance _res_conv_9_conv = *(LDKBalance*)(((uint64_t)_res_conv_9) & ~1);
+ FREE((void*)_res_conv_9);
+ _res_constr.data[j] = _res_conv_9_conv;
+ }
+ (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
+ CVec_BalanceZ_free(_res_constr);
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
+ // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
*ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
return (uint64_t)ret_conv;
CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = CResult_NoneLightningErrorZ_ok();
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
+ LDKLightningError e_conv;
+ e_conv.inner = (void*)(e & (~1));
+ e_conv.is_owned = (e & 1) || (e == 0);
+ e_conv = LightningError_clone(&e_conv);
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ CResult_NoneLightningErrorZ_free(_res_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
+ LDKC2Tuple_PublicKeyTypeZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
+ *ret_ref = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
+ return (uint64_t)ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new(JNIEnv *env, jclass clz, int8_tArray a, int64_t b) {
+ LDKPublicKey a_ref;
+ CHECK((*env)->GetArrayLength(env, a) == 33);
+ (*env)->GetByteArrayRegion(env, a, 0, 33, a_ref.compressed_form);
+ LDKType b_conv = *(LDKType*)(((uint64_t)b) & ~1);
+ if (b_conv.free == LDKType_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKType_JCalls_cloned(&b_conv);
+ }
+ LDKC2Tuple_PublicKeyTypeZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
+ *ret_ref = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
+ return (uint64_t)ret_ref;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ C2Tuple_PublicKeyTypeZ_free(_res_conv);
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free(JNIEnv *env, jclass clz, int64_tArray _res) {
+ LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
+ _res_constr.datalen = (*env)->GetArrayLength(env, _res);
+ if (_res_constr.datalen > 0)
+ _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
+ else
+ _res_constr.data = NULL;
+ int64_t* _res_vals = (*env)->GetLongArrayElements (env, _res, NULL);
+ for (size_t y = 0; y < _res_constr.datalen; y++) {
+ int64_t _res_conv_24 = _res_vals[y];
+ LDKC2Tuple_PublicKeyTypeZ _res_conv_24_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)_res_conv_24) & ~1);
+ FREE((void*)_res_conv_24);
+ _res_constr.data[y] = _res_conv_24_conv;
+ }
+ (*env)->ReleaseLongArrayElements(env, _res, _res_vals, 0);
+ CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv *env, jclass clz, jboolean o) {
LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
*ret_conv = CResult_boolLightningErrorZ_ok(o);
CVec_NodeAnnouncementZ_free(_res_constr);
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok(JNIEnv *env, jclass clz) {
- LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
- *ret_conv = CResult_NoneLightningErrorZ_ok();
- return (uint64_t)ret_conv;
-}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
- LDKLightningError e_conv;
- e_conv.inner = (void*)(e & (~1));
- e_conv.is_owned = (e & 1) || (e == 0);
- e_conv = LightningError_clone(&e_conv);
- LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
- *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
- return (uint64_t)ret_conv;
-}
-
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
- if ((_res & 1) != 0) return;
- LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
- FREE((void*)_res);
- CResult_NoneLightningErrorZ_free(_res_conv);
-}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
- LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
- LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
- *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
- return (uint64_t)ret_conv;
-}
-
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv *env, jclass clz, jobjectArray _res) {
LDKCVec_PublicKeyZ _res_constr;
_res_constr.datalen = (*env)->GetArrayLength(env, _res);
return (uint64_t)ret_conv;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some(JNIEnv *env, jclass clz, int64_t o) {
+ LDKAccess o_conv = *(LDKAccess*)(((uint64_t)o) & ~1);
+ if (o_conv.free == LDKAccess_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKAccess_JCalls_cloned(&o_conv);
+ }
+ LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
+ *ret_copy = COption_AccessZ_some(o_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none(JNIEnv *env, jclass clz) {
+ LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
+ *ret_copy = COption_AccessZ_none();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ COption_AccessZ_free(_res_conv);
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1DirectionalChannelInfoDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
LDKDirectionalChannelInfo o_conv;
o_conv.inner = (void*)(o & (~1));
LDKNetworkGraph o_conv;
o_conv.inner = (void*)(o & (~1));
o_conv.is_owned = (o & 1) || (o == 0);
- o_conv = NetworkGraph_clone(&o_conv);
+ // Warning: we need a move here but no clone is available for LDKNetworkGraph
LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
*ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
return (uint64_t)ret_conv;
CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone(JNIEnv *env, jclass clz, int64_t orig) {
- LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
- LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
- *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
- return (uint64_t)ret_conv;
-}
-
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressu8Z_1ok(JNIEnv *env, jclass clz, int64_t o) {
LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
+ o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
*ret_conv = CResult_NetAddressu8Z_ok(o_conv);
return (uint64_t)ret_conv;
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1CResult_1NetAddressu8ZDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
+ o_conv = CResult_NetAddressu8Z_clone((LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1));
LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
*ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
return (uint64_t)ret_conv;
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1NetAddressDecodeErrorZ_1ok(JNIEnv *env, jclass clz, int64_t o) {
LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
+ o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
*ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
return (uint64_t)ret_conv;
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1err(JNIEnv *env, jclass clz, int64_t e) {
LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(((uint64_t)e) & ~1);
+ e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uint64_t)e) & ~1));
LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
*ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
return (uint64_t)ret_conv;
return (uint64_t)ret_conv;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some(JNIEnv *env, jclass clz, int64_t o) {
+ LDKFilter o_conv = *(LDKFilter*)(((uint64_t)o) & ~1);
+ if (o_conv.free == LDKFilter_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKFilter_JCalls_cloned(&o_conv);
+ }
+ LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
+ *ret_copy = COption_FilterZ_some(o_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none(JNIEnv *env, jclass clz) {
+ LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
+ *ret_copy = COption_FilterZ_none();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free(JNIEnv *env, jclass clz, int64_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ COption_FilterZ_free(_res_conv);
+}
+
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
if ((this_ptr & 1) != 0) return;
LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(((uint64_t)this_ptr) & ~1);
return ret_ref;
}
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ if ((this_ptr & 1) != 0) return;
+ LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(((uint64_t)this_ptr) & ~1);
+ FREE((void*)this_ptr);
+ ClosureReason_free(this_ptr_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_clone(orig_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed(JNIEnv *env, jclass clz, jstring peer_msg) {
+ LDKStr peer_msg_conv = java_to_owned_str(env, peer_msg);
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed(JNIEnv *env, jclass clz) {
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_holder_force_closed();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure(JNIEnv *env, jclass clz) {
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_cooperative_closure();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz) {
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_commitment_tx_confirmed();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error(JNIEnv *env, jclass clz, jstring err) {
+ LDKStr err_conv = java_to_owned_str(env, err);
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_processing_error(err_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer(JNIEnv *env, jclass clz) {
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_disconnected_peer();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager(JNIEnv *env, jclass clz) {
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_outdated_channel_manager();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write(JNIEnv *env, jclass clz, int64_t obj) {
+ LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
+ LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
+ int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
+ (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
if ((this_ptr & 1) != 0) return;
LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
(*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(((uint64_t)purpose) & ~1);
+ purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uint64_t)purpose) & ~1));
LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
*ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
uint64_t ret_ref = (uint64_t)ret_copy;
return ret_ref;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1failed(JNIEnv *env, jclass clz, int8_tArray payment_hash, jboolean rejected_by_dest) {
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed(JNIEnv *env, jclass clz, int8_tArray payment_hash, jboolean rejected_by_dest, int64_t network_update, jboolean all_paths_failed, int64_tArray path) {
LDKThirtyTwoBytes payment_hash_ref;
CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
(*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
+ LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1);
+ network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1));
+ LDKCVec_RouteHopZ path_constr;
+ path_constr.datalen = (*env)->GetArrayLength(env, path);
+ if (path_constr.datalen > 0)
+ path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
+ else
+ path_constr.data = NULL;
+ int64_t* path_vals = (*env)->GetLongArrayElements (env, path, NULL);
+ for (size_t k = 0; k < path_constr.datalen; k++) {
+ int64_t path_conv_10 = path_vals[k];
+ LDKRouteHop path_conv_10_conv;
+ path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
+ path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
+ path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
+ path_constr.data[k] = path_conv_10_conv;
+ }
+ (*env)->ReleaseLongArrayElements(env, path, path_vals, 0);
LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
- *ret_copy = Event_payment_failed(payment_hash_ref, rejected_by_dest);
+ *ret_copy = Event_payment_path_failed(payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr);
uint64_t ret_ref = (uint64_t)ret_copy;
return ret_ref;
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1payment_1forwarded(JNIEnv *env, jclass clz, int64_t fee_earned_msat, jboolean claim_from_onchain_tx) {
LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1);
+ fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1));
LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
*ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
uint64_t ret_ref = (uint64_t)ret_copy;
return ret_ref;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Event_1channel_1closed(JNIEnv *env, jclass clz, int8_tArray channel_id, int64_t reason) {
+ LDKThirtyTwoBytes channel_id_ref;
+ CHECK((*env)->GetArrayLength(env, channel_id) == 32);
+ (*env)->GetByteArrayRegion(env, channel_id, 0, 32, channel_id_ref.data);
+ LDKClosureReason reason_conv = *(LDKClosureReason*)(((uint64_t)reason) & ~1);
+ reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1));
+ LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+ *ret_copy = Event_channel_closed(channel_id_ref, reason_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Event_1write(JNIEnv *env, jclass clz, int64_t obj) {
LDKEvent* obj_conv = (LDKEvent*)obj;
LDKCVec_u8Z ret_var = Event_write(obj_conv);
CHECK((*env)->GetArrayLength(env, node_id) == 33);
(*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
LDKErrorAction action_conv = *(LDKErrorAction*)(((uint64_t)action) & ~1);
+ action_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action) & ~1));
LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
*ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
uint64_t ret_ref = (uint64_t)ret_copy;
return ret_ref;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1payment_1failure_1network_1update(JNIEnv *env, jclass clz, int64_t update) {
- LDKHTLCFailChannelUpdate update_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)update) & ~1);
- LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
- *ret_copy = MessageSendEvent_payment_failure_network_update(update_conv);
- uint64_t ret_ref = (uint64_t)ret_copy;
- return ret_ref;
-}
-
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1send_1channel_1range_1query(JNIEnv *env, jclass clz, int8_tArray node_id, int64_t msg) {
LDKPublicKey node_id_ref;
CHECK((*env)->GetArrayLength(env, node_id) == 33);
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv *env, jclass clz, int64_t chain_source, int64_t broadcaster, int64_t logger, int64_t feeest, int64_t persister) {
- LDKFilter *chain_source_conv_ptr = NULL;
- if (chain_source != 0) {
- LDKFilter chain_source_conv;
- chain_source_conv = *(LDKFilter*)(((uint64_t)chain_source) & ~1);
- if (chain_source_conv.free == LDKFilter_JCalls_free) {
+ LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(((uint64_t)chain_source) & ~1);
+ // Warning: we may need a move here but no clone is available for LDKCOption_FilterZ
+ if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
+ // Manually implement clone for Java trait instances
+ if (chain_source_conv.some.free == LDKFilter_JCalls_free) {
// If this_arg is a JCalls struct, then we need to increment the refcnt in it.
- LDKFilter_JCalls_cloned(&chain_source_conv);
+ LDKFilter_JCalls_cloned(&chain_source_conv.some);
}
- chain_source_conv_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
- *chain_source_conv_ptr = chain_source_conv;
}
LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
// If this_arg is a JCalls struct, then we need to increment the refcnt in it.
LDKPersist_JCalls_cloned(&persister_conv);
}
- LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv_ptr, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
+ LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_ref;
}
+JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg, int64_tArray ignored_channels) {
+ LDKChainMonitor this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKCVec_ChannelDetailsZ ignored_channels_constr;
+ ignored_channels_constr.datalen = (*env)->GetArrayLength(env, ignored_channels);
+ if (ignored_channels_constr.datalen > 0)
+ ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
+ else
+ ignored_channels_constr.data = NULL;
+ int64_t* ignored_channels_vals = (*env)->GetLongArrayElements (env, ignored_channels, NULL);
+ for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
+ int64_t ignored_channels_conv_16 = ignored_channels_vals[q];
+ LDKChannelDetails ignored_channels_conv_16_conv;
+ ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
+ ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
+ ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
+ ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
+ }
+ (*env)->ReleaseLongArrayElements(env, ignored_channels, ignored_channels_vals, 0);
+ LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
+ int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
+ int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
+ for (size_t j = 0; j < ret_var.datalen; j++) {
+ LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
+ *ret_conv_9_copy = Balance_clone(&ret_var.data[j]);
+ uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
+ ret_arr_ptr[j] = ret_conv_9_ref;
+ }
+ (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKChainMonitor this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
- *ret = ChainMonitor_as_Listen(&this_arg_conv);
- return (uint64_t)ret;
+ LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
+ *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKChainMonitor this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
- *ret = ChainMonitor_as_Confirm(&this_arg_conv);
- return (uint64_t)ret;
+ LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
+ *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKChainMonitor this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
- *ret = ChainMonitor_as_Watch(&this_arg_conv);
- return (uint64_t)ret;
+ LDKWatch* ret_ret =MALLOC(sizeof(LDKWatch), "LDKWatch");
+ *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKChainMonitor this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
- *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
- return (uint64_t)ret;
+ LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
+ *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
return ret_ref;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1broadcasted(JNIEnv *env, jclass clz, int64_t a) {
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1confirmed(JNIEnv *env, jclass clz, int64_t a) {
LDKOutPoint a_conv;
a_conv.inner = (void*)(a & (~1));
a_conv.is_owned = (a & 1) || (a == 0);
a_conv = OutPoint_clone(&a_conv);
LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
- *ret_copy = MonitorEvent_commitment_tx_broadcasted(a_conv);
+ *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
uint64_t ret_ref = (uint64_t)ret_copy;
return ret_ref;
}
return (uint64_t)ret_conv;
}
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ if ((this_ptr & 1) != 0) return;
+ LDKBalance this_ptr_conv = *(LDKBalance*)(((uint64_t)this_ptr) & ~1);
+ FREE((void*)this_ptr);
+ Balance_free(this_ptr_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKBalance* orig_conv = (LDKBalance*)orig;
+ LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
+ *ret_copy = Balance_clone(orig_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis) {
+ LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
+ *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1awaiting_1confirmations(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis, int32_t confirmation_height) {
+ LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
+ *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1contentious_1claimable(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis, int32_t timeout_height) {
+ LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
+ *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Balance_1maybe_1claimable_1htlcawaiting_1timeout(JNIEnv *env, jclass clz, int64_t claimable_amount_satoshis, int32_t claimable_height) {
+ LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
+ *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
+ LDKBalance* a_conv = (LDKBalance*)a;
+ LDKBalance* b_conv = (LDKBalance*)b;
+ jboolean ret_val = Balance_eq(a_conv, b_conv);
+ return ret_val;
+}
+
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
LDKChannelMonitor this_obj_conv;
this_obj_conv.inner = (void*)(this_obj & (~1));
return ret_ref;
}
+JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKChannelMonitor this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
+ int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
+ int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
+ for (size_t j = 0; j < ret_var.datalen; j++) {
+ LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
+ *ret_conv_9_copy = Balance_clone(&ret_var.data[j]);
+ uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
+ ret_arr_ptr[j] = ret_conv_9_ref;
+ }
+ (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Persist_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
if ((this_ptr & 1) != 0) return;
LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
+ val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
}
CHECK((*env)->GetArrayLength(env, per_commitment_point_arg) == 33);
(*env)->GetByteArrayRegion(env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
+ output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
LDKPublicKey revocation_pubkey_arg_ref;
CHECK((*env)->GetArrayLength(env, revocation_pubkey_arg) == 33);
(*env)->GetByteArrayRegion(env, revocation_pubkey_arg, 0, 33, revocation_pubkey_arg_ref.compressed_form);
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
+ val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
}
outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
+ output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
LDKThirtyTwoBytes channel_keys_id_arg_ref;
CHECK((*env)->GetArrayLength(env, channel_keys_id_arg) == 32);
(*env)->GetByteArrayRegion(env, channel_keys_id_arg, 0, 32, channel_keys_id_arg_ref.data);
outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
outpoint_conv = OutPoint_clone(&outpoint_conv);
LDKTxOut output_conv = *(LDKTxOut*)(((uint64_t)output) & ~1);
+ output_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output) & ~1));
LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
*ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
uint64_t ret_ref = (uint64_t)ret_copy;
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sign_1clone(JNIEnv *env, jclass clz, int64_t orig) {
LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
- LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
- *ret = Sign_clone(orig_conv);
- return (uint64_t)ret;
+ LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
+ *ret_ret = Sign_clone(orig_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sign_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
LDKInMemorySigner this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKBaseSign* ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
- *ret = InMemorySigner_as_BaseSign(&this_arg_conv);
- return (uint64_t)ret;
+ LDKBaseSign* ret_ret =MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
+ *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1as_1Sign(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKInMemorySigner this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
- *ret = InMemorySigner_as_Sign(&this_arg_conv);
- return (uint64_t)ret;
+ LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
+ *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_InMemorySigner_1write(JNIEnv *env, jclass clz, int64_t obj) {
LDKKeysManager this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
- *ret = KeysManager_as_KeysInterface(&this_arg_conv);
- return (uint64_t)ret;
+ LDKKeysInterface* ret_ret =MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
+ *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
return ret_ref;
}
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+ LDKCounterpartyForwardingInfo this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ CounterpartyForwardingInfo_free(this_obj_conv);
+}
+
+JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ LDKCounterpartyForwardingInfo this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
+ return ret_val;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
+ LDKCounterpartyForwardingInfo this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
+}
+
+JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ LDKCounterpartyForwardingInfo this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
+ return ret_val;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths(JNIEnv *env, jclass clz, int64_t this_ptr, int32_t val) {
+ LDKCounterpartyForwardingInfo this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
+}
+
+JNIEXPORT int16_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ LDKCounterpartyForwardingInfo this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
+ return ret_val;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta(JNIEnv *env, jclass clz, int64_t this_ptr, int16_t val) {
+ LDKCounterpartyForwardingInfo this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1new(JNIEnv *env, jclass clz, int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg) {
+ LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKCounterpartyForwardingInfo orig_conv;
+ orig_conv.inner = (void*)(orig & (~1));
+ orig_conv.is_owned = false;
+ LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
LDKChannelCounterparty this_obj_conv;
this_obj_conv.inner = (void*)(this_obj & (~1));
ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ LDKChannelCounterparty this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
+ LDKChannelCounterparty this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCounterpartyForwardingInfo val_conv;
+ val_conv.inner = (void*)(val & (~1));
+ val_conv.is_owned = (val & 1) || (val == 0);
+ val_conv = CounterpartyForwardingInfo_clone(&val_conv);
+ ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1new(JNIEnv *env, jclass clz, int8_tArray node_id_arg, int64_t features_arg, int64_t unspendable_punishment_reserve_arg, int64_t forwarding_info_arg) {
+ LDKPublicKey node_id_arg_ref;
+ CHECK((*env)->GetArrayLength(env, node_id_arg) == 33);
+ (*env)->GetByteArrayRegion(env, node_id_arg, 0, 33, node_id_arg_ref.compressed_form);
+ LDKInitFeatures features_arg_conv;
+ features_arg_conv.inner = (void*)(features_arg & (~1));
+ features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
+ features_arg_conv = InitFeatures_clone(&features_arg_conv);
+ LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
+ forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
+ forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
+ forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
+ LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone(JNIEnv *env, jclass clz, int64_t orig) {
LDKChannelCounterparty orig_conv;
orig_conv.inner = (void*)(orig & (~1));
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)val) & ~1));
ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
}
funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1);
+ short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1));
LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1);
+ confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1));
LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1);
+ force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1));
LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_id_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1parameter_1error(JNIEnv *env, jclass clz, int64_t a) {
LDKAPIError a_conv = *(LDKAPIError*)(((uint64_t)a) & ~1);
+ a_conv = APIError_clone((LDKAPIError*)(((uint64_t)a) & ~1));
LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
*ret_copy = PaymentSendFailure_parameter_error(a_conv);
uint64_t ret_ref = (uint64_t)ret_copy;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
+ min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
*ret_ref = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
return (uint64_t)ret_ref;
CHECK((*env)->GetArrayLength(env, payment_hash) == 32);
(*env)->GetByteArrayRegion(env, payment_hash, 0, 32, payment_hash_ref.data);
LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
+ min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
*ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
return (uint64_t)ret_conv;
LDKChannelManager this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
- *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
- return (uint64_t)ret;
+ LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
+ *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKChannelManager this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
- *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
- return (uint64_t)ret;
+ LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
+ *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Listen(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKChannelManager this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
- *ret = ChannelManager_as_Listen(&this_arg_conv);
- return (uint64_t)ret;
+ LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
+ *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1Confirm(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKChannelManager this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
- *ret = ChannelManager_as_Confirm(&this_arg_conv);
- return (uint64_t)ret;
+ LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
+ *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1await_1persistable_1update_1timeout(JNIEnv *env, jclass clz, int64_t this_arg, int64_t max_wait) {
LDKChannelManager this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
- *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
- return (uint64_t)ret;
+ LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
+ *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1write(JNIEnv *env, jclass clz, int64_t obj) {
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
+ val_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)val) & ~1));
LightningError_set_action(&this_ptr_conv, val_conv);
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv *env, jclass clz, jstring err_arg, int64_t action_arg) {
LDKStr err_arg_conv = java_to_owned_str(env, err_arg);
LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
+ action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action_arg) & ~1));
LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
CommitmentUpdate_free(this_obj_conv);
}
+JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ LDKCommitmentUpdate this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
+ int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
+ int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
+ for (size_t p = 0; p < ret_var.datalen; p++) {
+ LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
+ CHECK((((uint64_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_conv_15_ref = (uint64_t)ret_conv_15_var.inner;
+ if (ret_conv_15_var.is_owned) {
+ ret_conv_15_ref |= 1;
+ }
+ ret_arr_ptr[p] = ret_conv_15_ref;
+ }
+ (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
LDKCommitmentUpdate this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
}
+JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ LDKCommitmentUpdate this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
+ int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
+ int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
+ for (size_t t = 0; t < ret_var.datalen; t++) {
+ LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
+ CHECK((((uint64_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_conv_19_ref = (uint64_t)ret_conv_19_var.inner;
+ if (ret_conv_19_var.is_owned) {
+ ret_conv_19_ref |= 1;
+ }
+ ret_arr_ptr[t] = ret_conv_19_ref;
+ }
+ (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
LDKCommitmentUpdate this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
}
+JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ LDKCommitmentUpdate this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
+ int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
+ int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
+ for (size_t q = 0; q < ret_var.datalen; q++) {
+ LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
+ CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
+ if (ret_conv_16_var.is_owned) {
+ ret_conv_16_ref |= 1;
+ }
+ ret_arr_ptr[q] = ret_conv_16_ref;
+ }
+ (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
LDKCommitmentUpdate this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
}
+JNIEXPORT int64_tArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ LDKCommitmentUpdate this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
+ int64_tArray ret_arr = (*env)->NewLongArray(env, ret_var.datalen);
+ int64_t *ret_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_arr, NULL);
+ for (size_t z = 0; z < ret_var.datalen; z++) {
+ LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
+ CHECK((((uint64_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_conv_25_ref = (uint64_t)ret_conv_25_var.inner;
+ if (ret_conv_25_var.is_owned) {
+ ret_conv_25_ref |= 1;
+ }
+ ret_arr_ptr[z] = ret_conv_25_ref;
+ }
+ (*env)->ReleasePrimitiveArrayCritical(env, ret_arr, ret_arr_ptr, 0);
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv *env, jclass clz, int64_t this_ptr, int64_tArray val) {
LDKCommitmentUpdate this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
return ret_ref;
}
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
- if ((this_ptr & 1) != 0) return;
- LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
- FREE((void*)this_ptr);
- HTLCFailChannelUpdate_free(this_ptr_conv);
-}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
- LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
- LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
- *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
- uint64_t ret_ref = (uint64_t)ret_copy;
- return ret_ref;
-}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
- LDKChannelUpdate msg_conv;
- msg_conv.inner = (void*)(msg & (~1));
- msg_conv.is_owned = (msg & 1) || (msg == 0);
- msg_conv = ChannelUpdate_clone(&msg_conv);
- LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
- *ret_copy = HTLCFailChannelUpdate_channel_update_message(msg_conv);
- uint64_t ret_ref = (uint64_t)ret_copy;
- return ret_ref;
-}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1channel_1closed(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
- LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
- *ret_copy = HTLCFailChannelUpdate_channel_closed(short_channel_id, is_permanent);
- uint64_t ret_ref = (uint64_t)ret_copy;
- return ret_ref;
-}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
- LDKPublicKey node_id_ref;
- CHECK((*env)->GetArrayLength(env, node_id) == 33);
- (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
- LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
- *ret_copy = HTLCFailChannelUpdate_node_failure(node_id_ref, is_permanent);
- uint64_t ret_ref = (uint64_t)ret_copy;
- return ret_ref;
-}
-
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
if ((this_ptr & 1) != 0) return;
LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
return ret_arr;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
- LDKu8slice ser_ref;
- ser_ref.datalen = (*env)->GetArrayLength(env, ser);
- ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
- LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
- *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
- (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
- return (uint64_t)ret_conv;
-}
-
JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv *env, jclass clz, int64_t obj) {
LDKReplyShortChannelIdsEnd obj_conv;
obj_conv.inner = (void*)(obj & (~1));
return ret_arr;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = (*env)->GetArrayLength(env, ser);
+ ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
+ LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
+ *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
+ (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
+ return (uint64_t)ret_conv;
+}
+
JNIEXPORT int32_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKQueryChannelRange this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
return ret_val;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
- LDKu8slice ser_ref;
- ser_ref.datalen = (*env)->GetArrayLength(env, ser);
- ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
- LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
- *ret_conv = QueryChannelRange_read(ser_ref);
- (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
- return (uint64_t)ret_conv;
-}
-
JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv *env, jclass clz, int64_t obj) {
LDKQueryChannelRange obj_conv;
obj_conv.inner = (void*)(obj & (~1));
return ret_arr;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = (*env)->GetArrayLength(env, ser);
+ ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
+ LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
+ *ret_conv = QueryChannelRange_read(ser_ref);
+ (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
+ return (uint64_t)ret_conv;
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
LDKu8slice ser_ref;
ser_ref.datalen = (*env)->GetArrayLength(env, ser);
return ret_arr;
}
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
+ LDKGossipTimestampFilter obj_conv;
+ obj_conv.inner = (void*)(obj & (~1));
+ obj_conv.is_owned = false;
+ LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
+ int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
+ (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
LDKu8slice ser_ref;
ser_ref.datalen = (*env)->GetArrayLength(env, ser);
return (uint64_t)ret_conv;
}
-JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv *env, jclass clz, int64_t obj) {
- LDKGossipTimestampFilter obj_conv;
- obj_conv.inner = (void*)(obj & (~1));
- obj_conv.is_owned = false;
- LDKCVec_u8Z ret_var = GossipTimestampFilter_write(&obj_conv);
- int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
- (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
- CVec_u8Z_free(ret_var);
- return ret_arr;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ if ((this_ptr & 1) != 0) return;
+ LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(((uint64_t)this_ptr) & ~1);
+ FREE((void*)this_ptr);
+ CustomMessageHandler_free(this_ptr_conv);
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
LDKIgnoringMessageHandler this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
- *ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
- return (uint64_t)ret;
+ LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
+ *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKIgnoringMessageHandler this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
- *ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
- return (uint64_t)ret;
+ LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
+ *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
+ return (uint64_t)ret_ret;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKIgnoringMessageHandler this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKCustomMessageReader* ret_ret =MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
+ *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
+ return (uint64_t)ret_ret;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKIgnoringMessageHandler this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKCustomMessageHandler* ret_ret =MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
+ *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
LDKErroringMessageHandler this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
- *ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
- return (uint64_t)ret;
+ LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
+ *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ErroringMessageHandler_1as_1ChannelMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKErroringMessageHandler this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
- *ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
- return (uint64_t)ret;
+ LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
+ *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1clone(JNIEnv *env, jclass clz, int64_t orig) {
LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
- LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
- *ret = SocketDescriptor_clone(orig_conv);
- return (uint64_t)ret;
+ LDKSocketDescriptor* ret_ret =MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
+ *ret_ret = SocketDescriptor_clone(orig_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
PeerManager_free(this_obj_conv);
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv *env, jclass clz, int64_t message_handler, int8_tArray our_node_secret, int8_tArray ephemeral_random_data, int64_t logger) {
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv *env, jclass clz, int64_t message_handler, int8_tArray our_node_secret, int8_tArray ephemeral_random_data, int64_t logger, int64_t custom_message_handler) {
LDKMessageHandler message_handler_conv;
message_handler_conv.inner = (void*)(message_handler & (~1));
message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
// If this_arg is a JCalls struct, then we need to increment the refcnt in it.
LDKLogger_JCalls_cloned(&logger_conv);
}
- LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
+ LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(((uint64_t)custom_message_handler) & ~1);
+ if (custom_message_handler_conv.free == LDKCustomMessageHandler_JCalls_free) {
+ // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
+ LDKCustomMessageHandler_JCalls_cloned(&custom_message_handler_conv);
+ }
+ LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_arr;
}
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_build_1closing_1transaction(JNIEnv *env, jclass clz, int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, int64_t funding_outpoint) {
+ LDKCVec_u8Z to_holder_script_ref;
+ to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
+ to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
+ (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
+ LDKCVec_u8Z to_counterparty_script_ref;
+ to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
+ to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
+ (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
+ LDKOutPoint funding_outpoint_conv;
+ funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
+ funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
+ funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
+ LDKTransaction ret_var = build_closing_transaction(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
+ int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
+ (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
+ Transaction_free(ret_var);
+ return ret_arr;
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv *env, jclass clz, int8_tArray per_commitment_point, int8_tArray base_secret) {
LDKPublicKey per_commitment_point_ref;
CHECK((*env)->GetArrayLength(env, per_commitment_point) == 33);
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
}
CHECK((*env)->GetArrayLength(env, payment_hash_arg) == 32);
(*env)->GetByteArrayRegion(env, payment_hash_arg, 0, 32, payment_hash_arg_ref.data);
LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1);
+ transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1));
LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
return ret_ref;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
- LDKBuiltCommitmentTransaction orig_conv;
- orig_conv.inner = (void*)(orig & (~1));
- orig_conv.is_owned = false;
- LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKBuiltCommitmentTransaction orig_conv;
+ orig_conv.inner = (void*)(orig & (~1));
+ orig_conv.is_owned = false;
+ LDKBuiltCommitmentTransaction ret_var = BuiltCommitmentTransaction_clone(&orig_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
+ LDKBuiltCommitmentTransaction obj_conv;
+ obj_conv.inner = (void*)(obj & (~1));
+ obj_conv.is_owned = false;
+ LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
+ int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
+ (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = (*env)->GetArrayLength(env, ser);
+ ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
+ LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
+ *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
+ (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1sighash_1all(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
+ LDKBuiltCommitmentTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKu8slice funding_redeemscript_ref;
+ funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
+ funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
+ int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
+ (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
+ (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
+ return ret_arr;
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1sign(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
+ LDKBuiltCommitmentTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ unsigned char funding_key_arr[32];
+ CHECK((*env)->GetArrayLength(env, funding_key) == 32);
+ (*env)->GetByteArrayRegion(env, funding_key, 0, 32, funding_key_arr);
+ unsigned char (*funding_key_ref)[32] = &funding_key_arr;
+ LDKu8slice funding_redeemscript_ref;
+ funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
+ funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
+ int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
+ (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
+ (*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
+ return ret_arr;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+ LDKClosingTransaction this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ ClosingTransaction_free(this_obj_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1new(JNIEnv *env, jclass clz, int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, int64_t funding_outpoint) {
+ LDKCVec_u8Z to_holder_script_ref;
+ to_holder_script_ref.datalen = (*env)->GetArrayLength(env, to_holder_script);
+ to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
+ (*env)->GetByteArrayRegion(env, to_holder_script, 0, to_holder_script_ref.datalen, to_holder_script_ref.data);
+ LDKCVec_u8Z to_counterparty_script_ref;
+ to_counterparty_script_ref.datalen = (*env)->GetArrayLength(env, to_counterparty_script);
+ to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
+ (*env)->GetByteArrayRegion(env, to_counterparty_script, 0, to_counterparty_script_ref.datalen, to_counterparty_script_ref.data);
+ LDKOutPoint funding_outpoint_conv;
+ funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
+ funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
+ funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
+ LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_ref;
}
-JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1write(JNIEnv *env, jclass clz, int64_t obj) {
- LDKBuiltCommitmentTransaction obj_conv;
- obj_conv.inner = (void*)(obj & (~1));
- obj_conv.is_owned = false;
- LDKCVec_u8Z ret_var = BuiltCommitmentTransaction_write(&obj_conv);
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify(JNIEnv *env, jclass clz, int64_t this_arg, int64_t funding_outpoint) {
+ LDKClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKOutPoint funding_outpoint_conv;
+ funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
+ funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
+ funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
+ LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
+ *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
+ return (uint64_t)ret_conv;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
+ return ret_val;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
+ return ret_val;
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
(*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
- CVec_u8Z_free(ret_var);
return ret_arr;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1read(JNIEnv *env, jclass clz, int8_tArray ser) {
- LDKu8slice ser_ref;
- ser_ref.datalen = (*env)->GetArrayLength(env, ser);
- ser_ref.data = (*env)->GetByteArrayElements (env, ser, NULL);
- LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ), "LDKCResult_BuiltCommitmentTransactionDecodeErrorZ");
- *ret_conv = BuiltCommitmentTransaction_read(ser_ref);
- (*env)->ReleaseByteArrayElements(env, ser, (int8_t*)ser_ref.data, 0);
- return (uint64_t)ret_conv;
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
+ int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
+ (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
+ return ret_arr;
}
-JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1get_1sighash_1all(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
- LDKBuiltCommitmentTransaction this_arg_conv;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+ LDKTrustedClosingTransaction this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ TrustedClosingTransaction_free(this_obj_conv);
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKTrustedClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
+ int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
+ (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
+ Transaction_free(ret_var);
+ return ret_arr;
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1get_1sighash_1all(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
+ LDKTrustedClosingTransaction this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
LDKu8slice funding_redeemscript_ref;
funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
int8_tArray ret_arr = (*env)->NewByteArray(env, 32);
- (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, BuiltCommitmentTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
+ (*env)->SetByteArrayRegion(env, ret_arr, 0, 32, TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data);
(*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
return ret_arr;
}
-JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_BuiltCommitmentTransaction_1sign(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
- LDKBuiltCommitmentTransaction this_arg_conv;
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1sign(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
+ LDKTrustedClosingTransaction this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
unsigned char funding_key_arr[32];
funding_redeemscript_ref.datalen = (*env)->GetArrayLength(env, funding_redeemscript);
funding_redeemscript_ref.data = (*env)->GetByteArrayElements (env, funding_redeemscript, NULL);
int8_tArray ret_arr = (*env)->NewByteArray(env, 64);
- (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, BuiltCommitmentTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
+ (*env)->SetByteArrayRegion(env, ret_arr, 0, 64, TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form);
(*env)->ReleaseByteArrayElements(env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
return ret_arr;
}
return ret_ref;
}
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKInitFeatures this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
+ return ret_val;
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1empty(JNIEnv *env, jclass clz) {
LDKNodeFeatures ret_var = NodeFeatures_empty();
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
return ret_ref;
}
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKNodeFeatures this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
+ return ret_val;
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1empty(JNIEnv *env, jclass clz) {
LDKChannelFeatures ret_var = ChannelFeatures_empty();
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
return ret_ref;
}
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKChannelFeatures this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
+ return ret_val;
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1empty(JNIEnv *env, jclass clz) {
LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
return ret_ref;
}
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1unknown_1bits(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKInvoiceFeatures this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
+ return ret_val;
+}
+
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1supports_1payment_1secret(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKInitFeatures this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
return ret_val;
}
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ if ((this_ptr & 1) != 0) return;
+ LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(((uint64_t)this_ptr) & ~1);
+ FREE((void*)this_ptr);
+ CustomMessageReader_free(this_ptr_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Type_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKType* orig_conv = (LDKType*)(((uint64_t)orig) & ~1);
+ LDKType* ret_ret =MALLOC(sizeof(LDKType), "LDKType");
+ *ret_ret = Type_clone(orig_conv);
+ return (uint64_t)ret_ret;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ if ((this_ptr & 1) != 0) return;
+ LDKType this_ptr_conv = *(LDKType*)(((uint64_t)this_ptr) & ~1);
+ FREE((void*)this_ptr);
+ Type_free(this_ptr_conv);
+}
+
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
LDKRouteHop this_obj_conv;
this_obj_conv.inner = (void*)(this_obj & (~1));
return ret_ref;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
+ LDKRouteHop o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = RouteHop_hash(&o_conv);
+ return ret_val;
+}
+
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
+ LDKRouteHop a_conv;
+ a_conv.inner = (void*)(a & (~1));
+ a_conv.is_owned = false;
+ LDKRouteHop b_conv;
+ b_conv.inner = (void*)(b & (~1));
+ b_conv.is_owned = false;
+ jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
+ return ret_val;
+}
+
JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1write(JNIEnv *env, jclass clz, int64_t obj) {
LDKRouteHop obj_conv;
obj_conv.inner = (void*)(obj & (~1));
Route_free(this_obj_conv);
}
+JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ LDKRoute this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
+ jobjectArray ret_arr = (*env)->NewObjectArray(env, ret_var.datalen, arr_of_J_clz, NULL);
+ ;
+ for (size_t m = 0; m < ret_var.datalen; m++) {
+ LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
+ int64_tArray ret_conv_12_arr = (*env)->NewLongArray(env, ret_conv_12_var.datalen);
+ int64_t *ret_conv_12_arr_ptr = (*env)->GetPrimitiveArrayCritical(env, ret_conv_12_arr, NULL);
+ for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
+ LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
+ CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner;
+ if (ret_conv_12_conv_10_var.is_owned) {
+ ret_conv_12_conv_10_ref |= 1;
+ }
+ ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
+ }
+ (*env)->ReleasePrimitiveArrayCritical(env, ret_conv_12_arr, ret_conv_12_arr_ptr, 0);
+ FREE(ret_conv_12_var.data);
+ (*env)->SetObjectArrayElement(env, ret_arr, m, ret_conv_12_arr);
+ }
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv *env, jclass clz, int64_t this_ptr, jobjectArray val) {
LDKRoute this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
return ret_ref;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1hash(JNIEnv *env, jclass clz, int64_t o) {
+ LDKRoute o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = Route_hash(&o_conv);
+ return ret_val;
+}
+
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
+ LDKRoute a_conv;
+ a_conv.inner = (void*)(a & (~1));
+ a_conv.is_owned = false;
+ LDKRoute b_conv;
+ b_conv.inner = (void*)(b & (~1));
+ b_conv.is_owned = false;
+ jboolean ret_val = Route_eq(&a_conv, &b_conv);
+ return ret_val;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKRoute this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ int64_t ret_val = Route_get_total_fees(&this_arg_conv);
+ return ret_val;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKRoute this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ int64_t ret_val = Route_get_total_amount(&this_arg_conv);
+ return ret_val;
+}
+
JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv *env, jclass clz, int64_t obj) {
LDKRoute obj_conv;
obj_conv.inner = (void*)(obj & (~1));
RouteHint_free(this_obj_conv);
}
-JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
- LDKRouteHint a_conv;
- a_conv.inner = (void*)(a & (~1));
- a_conv.is_owned = false;
- LDKRouteHint b_conv;
- b_conv.inner = (void*)(b & (~1));
- b_conv.is_owned = false;
- jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
- return ret_val;
-}
-
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv *env, jclass clz, int64_t orig) {
LDKRouteHint orig_conv;
orig_conv.inner = (void*)(orig & (~1));
return ret_ref;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash(JNIEnv *env, jclass clz, int64_t o) {
+ LDKRouteHint o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = RouteHint_hash(&o_conv);
+ return ret_val;
+}
+
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
+ LDKRouteHint a_conv;
+ a_conv.inner = (void*)(a & (~1));
+ a_conv.is_owned = false;
+ LDKRouteHint b_conv;
+ b_conv.inner = (void*)(b & (~1));
+ b_conv.is_owned = false;
+ jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
+ return ret_val;
+}
+
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
LDKRouteHintHop this_obj_conv;
this_obj_conv.inner = (void*)(this_obj & (~1));
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
}
fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
+ htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1));
LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
+ htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
LDKRouteHintHop ret_var = RouteHintHop_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg_conv, htlc_maximum_msat_arg_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
return ret_ref;
}
-JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
- LDKRouteHintHop a_conv;
- a_conv.inner = (void*)(a & (~1));
- a_conv.is_owned = false;
- LDKRouteHintHop b_conv;
- b_conv.inner = (void*)(b & (~1));
- b_conv.is_owned = false;
- jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
- return ret_val;
-}
-
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone(JNIEnv *env, jclass clz, int64_t orig) {
LDKRouteHintHop orig_conv;
orig_conv.inner = (void*)(orig & (~1));
return ret_ref;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash(JNIEnv *env, jclass clz, int64_t o) {
+ LDKRouteHintHop o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = RouteHintHop_hash(&o_conv);
+ return ret_val;
+}
+
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
+ LDKRouteHintHop a_conv;
+ a_conv.inner = (void*)(a & (~1));
+ a_conv.is_owned = false;
+ LDKRouteHintHop b_conv;
+ b_conv.inner = (void*)(b & (~1));
+ b_conv.is_owned = false;
+ jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
+ return ret_val;
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_get_1keysend_1route(JNIEnv *env, jclass clz, int8_tArray our_node_id, int64_t network, int8_tArray payee, int64_tArray first_hops, int64_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, int64_t logger) {
LDKPublicKey our_node_id_ref;
CHECK((*env)->GetArrayLength(env, our_node_id) == 33);
NetworkGraph_free(this_obj_conv);
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone(JNIEnv *env, jclass clz, int64_t orig) {
- LDKNetworkGraph orig_conv;
- orig_conv.inner = (void*)(orig & (~1));
- orig_conv.is_owned = false;
- LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
- CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t ret_ref = (uint64_t)ret_var.inner;
- if (ret_var.is_owned) {
- ret_ref |= 1;
- }
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+ LDKReadOnlyNetworkGraph this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ ReadOnlyNetworkGraph_free(this_obj_conv);
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ if ((this_ptr & 1) != 0) return;
+ LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(((uint64_t)this_ptr) & ~1);
+ FREE((void*)this_ptr);
+ NetworkUpdate_free(this_ptr_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
+ LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
+ *ret_copy = NetworkUpdate_clone(orig_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
return ret_ref;
}
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
- LDKLockedNetworkGraph this_obj_conv;
- this_obj_conv.inner = (void*)(this_obj & (~1));
- this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
- LockedNetworkGraph_free(this_obj_conv);
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message(JNIEnv *env, jclass clz, int64_t msg) {
+ LDKChannelUpdate msg_conv;
+ msg_conv.inner = (void*)(msg & (~1));
+ msg_conv.is_owned = (msg & 1) || (msg == 0);
+ msg_conv = ChannelUpdate_clone(&msg_conv);
+ LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
+ *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
}
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
- LDKNetGraphMsgHandler this_obj_conv;
- this_obj_conv.inner = (void*)(this_obj & (~1));
- this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
- NetGraphMsgHandler_free(this_obj_conv);
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1closed(JNIEnv *env, jclass clz, int64_t short_channel_id, jboolean is_permanent) {
+ LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
+ *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv *env, jclass clz, int8_tArray genesis_hash, int64_t chain_access, int64_t logger) {
- LDKThirtyTwoBytes genesis_hash_ref;
- CHECK((*env)->GetArrayLength(env, genesis_hash) == 32);
- (*env)->GetByteArrayRegion(env, genesis_hash, 0, 32, genesis_hash_ref.data);
- LDKAccess *chain_access_conv_ptr = NULL;
- if (chain_access != 0) {
- LDKAccess chain_access_conv;
- chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
- if (chain_access_conv.free == LDKAccess_JCalls_free) {
- // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
- LDKAccess_JCalls_cloned(&chain_access_conv);
- }
- chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
- *chain_access_conv_ptr = chain_access_conv;
- }
- LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
- if (logger_conv.free == LDKLogger_JCalls_free) {
- // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
- LDKLogger_JCalls_cloned(&logger_conv);
- }
- LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv_ptr, logger_conv);
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure(JNIEnv *env, jclass clz, int8_tArray node_id, jboolean is_permanent) {
+ LDKPublicKey node_id_ref;
+ CHECK((*env)->GetArrayLength(env, node_id) == 33);
+ (*env)->GetByteArrayRegion(env, node_id, 0, 33, node_id_ref.compressed_form);
+ LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
+ *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write(JNIEnv *env, jclass clz, int64_t obj) {
+ LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
+ LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
+ int8_tArray ret_arr = (*env)->NewByteArray(env, ret_var.datalen);
+ (*env)->SetByteArrayRegion(env, ret_arr, 0, ret_var.datalen, ret_var.data);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1EventHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKNetGraphMsgHandler this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKEventHandler* ret_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
+ *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
+ return (uint64_t)ret_ret;
+}
+
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+ LDKNetGraphMsgHandler this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ NetGraphMsgHandler_free(this_obj_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1get_1network_1graph(JNIEnv *env, jclass clz, int64_t this_ptr) {
+ LDKNetGraphMsgHandler this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKNetworkGraph ret_var = NetGraphMsgHandler_get_network_graph(&this_ptr_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_ref;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv *env, jclass clz, int64_t chain_access, int64_t logger, int64_t network_graph) {
- LDKAccess *chain_access_conv_ptr = NULL;
- if (chain_access != 0) {
- LDKAccess chain_access_conv;
- chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
- if (chain_access_conv.free == LDKAccess_JCalls_free) {
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1set_1network_1graph(JNIEnv *env, jclass clz, int64_t this_ptr, int64_t val) {
+ LDKNetGraphMsgHandler this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKNetworkGraph val_conv;
+ val_conv.inner = (void*)(val & (~1));
+ val_conv.is_owned = (val & 1) || (val == 0);
+ // Warning: we need a move here but no clone is available for LDKNetworkGraph
+ NetGraphMsgHandler_set_network_graph(&this_ptr_conv, val_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv *env, jclass clz, int64_t network_graph, int64_t chain_access, int64_t logger) {
+ LDKNetworkGraph network_graph_conv;
+ network_graph_conv.inner = (void*)(network_graph & (~1));
+ network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
+ // Warning: we need a move here but no clone is available for LDKNetworkGraph
+ LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
+ // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
+ if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
+ // Manually implement clone for Java trait instances
+ if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
// If this_arg is a JCalls struct, then we need to increment the refcnt in it.
- LDKAccess_JCalls_cloned(&chain_access_conv);
+ LDKAccess_JCalls_cloned(&chain_access_conv.some);
}
- chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
- *chain_access_conv_ptr = chain_access_conv;
}
LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
if (logger_conv.free == LDKLogger_JCalls_free) {
// If this_arg is a JCalls struct, then we need to increment the refcnt in it.
LDKLogger_JCalls_cloned(&logger_conv);
}
- LDKNetworkGraph network_graph_conv;
- network_graph_conv.inner = (void*)(network_graph & (~1));
- network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
- network_graph_conv = NetworkGraph_clone(&network_graph_conv);
- LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv_ptr, logger_conv, network_graph_conv);
+ LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(network_graph_conv, chain_access_conv, logger_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
LDKNetGraphMsgHandler this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKAccess *chain_access_conv_ptr = NULL;
- if (chain_access != 0) {
- LDKAccess chain_access_conv;
- chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
- if (chain_access_conv.free == LDKAccess_JCalls_free) {
+ LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
+ // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
+ if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
+ // Manually implement clone for Java trait instances
+ if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
// If this_arg is a JCalls struct, then we need to increment the refcnt in it.
- LDKAccess_JCalls_cloned(&chain_access_conv);
+ LDKAccess_JCalls_cloned(&chain_access_conv.some);
}
- chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
- *chain_access_conv_ptr = chain_access_conv;
- }
- NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv_ptr);
-}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
- LDKNetGraphMsgHandler this_arg_conv;
- this_arg_conv.inner = (void*)(this_arg & (~1));
- this_arg_conv.is_owned = false;
- LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
- CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t ret_ref = (uint64_t)ret_var.inner;
- if (ret_var.is_owned) {
- ret_ref |= 1;
- }
- return ret_ref;
-}
-
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv *env, jclass clz, int64_t this_arg) {
- LDKLockedNetworkGraph this_arg_conv;
- this_arg_conv.inner = (void*)(this_arg & (~1));
- this_arg_conv.is_owned = false;
- LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
- CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t ret_ref = (uint64_t)ret_var.inner;
- if (ret_var.is_owned) {
- ret_ref |= 1;
}
- return ret_ref;
+ NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKNetGraphMsgHandler this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
- *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
- return (uint64_t)ret;
+ LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
+ *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1MessageSendEventsProvider(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKNetGraphMsgHandler this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
- *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
- return (uint64_t)ret;
+ LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
+ *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
}
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1new(JNIEnv *env, jclass clz, int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, int64_t htlc_maximum_msat_arg, int64_t fees_arg, int64_t last_update_message_arg) {
LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
+ htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
LDKRoutingFees fees_arg_conv;
fees_arg_conv.inner = (void*)(fees_arg & (~1));
fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
}
two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1);
+ capacity_sats_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1));
LDKChannelAnnouncement announcement_message_arg_conv;
announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
return ret_ref;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash(JNIEnv *env, jclass clz, int64_t o) {
+ LDKRoutingFees o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = RoutingFees_hash(&o_conv);
+ return ret_val;
+}
+
JNIEXPORT int8_tArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv *env, jclass clz, int64_t obj) {
LDKRoutingFees obj_conv;
obj_conv.inner = (void*)(obj & (~1));
return ret_ref;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only(JNIEnv *env, jclass clz, int64_t this_arg) {
+ LDKNetworkGraph this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1node_1from_1announcement(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
LDKNetworkGraph this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
LDKChannelAnnouncement msg_conv;
msg_conv.inner = (void*)(msg & (~1));
msg_conv.is_owned = false;
- LDKAccess *chain_access_conv_ptr = NULL;
- if (chain_access != 0) {
- LDKAccess chain_access_conv;
- chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
- if (chain_access_conv.free == LDKAccess_JCalls_free) {
+ LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
+ // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
+ if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
+ // Manually implement clone for Java trait instances
+ if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
// If this_arg is a JCalls struct, then we need to increment the refcnt in it.
- LDKAccess_JCalls_cloned(&chain_access_conv);
+ LDKAccess_JCalls_cloned(&chain_access_conv.some);
}
- chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
- *chain_access_conv_ptr = chain_access_conv;
}
LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
- *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
+ *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
return (uint64_t)ret_conv;
}
LDKUnsignedChannelAnnouncement msg_conv;
msg_conv.inner = (void*)(msg & (~1));
msg_conv.is_owned = false;
- LDKAccess *chain_access_conv_ptr = NULL;
- if (chain_access != 0) {
- LDKAccess chain_access_conv;
- chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
- if (chain_access_conv.free == LDKAccess_JCalls_free) {
+ LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
+ // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
+ if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
+ // Manually implement clone for Java trait instances
+ if (chain_access_conv.some.free == LDKAccess_JCalls_free) {
// If this_arg is a JCalls struct, then we need to increment the refcnt in it.
- LDKAccess_JCalls_cloned(&chain_access_conv);
+ LDKAccess_JCalls_cloned(&chain_access_conv.some);
}
- chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
- *chain_access_conv_ptr = chain_access_conv;
}
LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
- *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
+ *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
return (uint64_t)ret_conv;
}
NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
}
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1fail_1node(JNIEnv *env, jclass clz, int64_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
+ LDKNetworkGraph this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKPublicKey _node_id_ref;
+ CHECK((*env)->GetArrayLength(env, _node_id) == 33);
+ (*env)->GetByteArrayRegion(env, _node_id, 0, 33, _node_id_ref.compressed_form);
+ NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1update_1channel(JNIEnv *env, jclass clz, int64_t this_arg, int64_t msg) {
LDKNetworkGraph this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
LDKFilesystemPersister this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKPersist* ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
- *ret = FilesystemPersister_as_Persist(&this_arg_conv);
- return (uint64_t)ret;
+ LDKPersist* ret_ret =MALLOC(sizeof(LDKPersist), "LDKPersist");
+ *ret_ret = FilesystemPersister_as_Persist(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
ChannelManagerPersister_free(this_ptr_conv);
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1start(JNIEnv *env, jclass clz, int64_t persister, int64_t event_handler, int64_t chain_monitor, int64_t channel_manager, int64_t peer_manager, int64_t logger) {
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1start(JNIEnv *env, jclass clz, int64_t persister, int64_t event_handler, int64_t chain_monitor, int64_t channel_manager, int64_t net_graph_msg_handler, int64_t peer_manager, int64_t logger) {
LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(((uint64_t)persister) & ~1);
if (persister_conv.free == LDKChannelManagerPersister_JCalls_free) {
// If this_arg is a JCalls struct, then we need to increment the refcnt in it.
LDKChannelManager channel_manager_conv;
channel_manager_conv.inner = (void*)(channel_manager & (~1));
channel_manager_conv.is_owned = false;
+ LDKNetGraphMsgHandler net_graph_msg_handler_conv;
+ net_graph_msg_handler_conv.inner = (void*)(net_graph_msg_handler & (~1));
+ net_graph_msg_handler_conv.is_owned = (net_graph_msg_handler & 1) || (net_graph_msg_handler == 0);
LDKPeerManager peer_manager_conv;
peer_manager_conv.inner = (void*)(peer_manager & (~1));
peer_manager_conv.is_owned = false;
// If this_arg is a JCalls struct, then we need to increment the refcnt in it.
LDKLogger_JCalls_cloned(&logger_conv);
}
- LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, &peer_manager_conv, logger_conv);
+ LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, net_graph_msg_handler_conv, &peer_manager_conv, logger_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_conv;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Currency_1hash(JNIEnv *env, jclass clz, int64_t o) {
+ LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
+ int64_t ret_val = Currency_hash(o_conv);
+ return ret_val;
+}
+
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Currency_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
Sha256_free(this_obj_conv);
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKSha256 orig_conv;
+ orig_conv.inner = (void*)(orig & (~1));
+ orig_conv.is_owned = false;
+ LDKSha256 ret_var = Sha256_clone(&orig_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1hash(JNIEnv *env, jclass clz, int64_t o) {
+ LDKSha256 o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = Sha256_hash(&o_conv);
+ return ret_val;
+}
+
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
LDKSha256 a_conv;
a_conv.inner = (void*)(a & (~1));
return ret_val;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Sha256_1clone(JNIEnv *env, jclass clz, int64_t orig) {
- LDKSha256 orig_conv;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+ LDKDescription this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ Description_free(this_obj_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKDescription orig_conv;
orig_conv.inner = (void*)(orig & (~1));
orig_conv.is_owned = false;
- LDKSha256 ret_var = Sha256_clone(&orig_conv);
+ LDKDescription ret_var = Description_clone(&orig_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_ref;
}
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
- LDKDescription this_obj_conv;
- this_obj_conv.inner = (void*)(this_obj & (~1));
- this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
- Description_free(this_obj_conv);
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1hash(JNIEnv *env, jclass clz, int64_t o) {
+ LDKDescription o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = Description_hash(&o_conv);
+ return ret_val;
}
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
return ret_val;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Description_1clone(JNIEnv *env, jclass clz, int64_t orig) {
- LDKDescription orig_conv;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+ LDKPayeePubKey this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ PayeePubKey_free(this_obj_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKPayeePubKey orig_conv;
orig_conv.inner = (void*)(orig & (~1));
orig_conv.is_owned = false;
- LDKDescription ret_var = Description_clone(&orig_conv);
+ LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_ref;
}
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
- LDKPayeePubKey this_obj_conv;
- this_obj_conv.inner = (void*)(this_obj & (~1));
- this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
- PayeePubKey_free(this_obj_conv);
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash(JNIEnv *env, jclass clz, int64_t o) {
+ LDKPayeePubKey o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = PayeePubKey_hash(&o_conv);
+ return ret_val;
}
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
return ret_val;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1clone(JNIEnv *env, jclass clz, int64_t orig) {
- LDKPayeePubKey orig_conv;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+ LDKExpiryTime this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ ExpiryTime_free(this_obj_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKExpiryTime orig_conv;
orig_conv.inner = (void*)(orig & (~1));
orig_conv.is_owned = false;
- LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
+ LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_ref;
}
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
- LDKExpiryTime this_obj_conv;
- this_obj_conv.inner = (void*)(this_obj & (~1));
- this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
- ExpiryTime_free(this_obj_conv);
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash(JNIEnv *env, jclass clz, int64_t o) {
+ LDKExpiryTime o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = ExpiryTime_hash(&o_conv);
+ return ret_val;
}
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
return ret_val;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1clone(JNIEnv *env, jclass clz, int64_t orig) {
- LDKExpiryTime orig_conv;
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+ LDKMinFinalCltvExpiry this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ MinFinalCltvExpiry_free(this_obj_conv);
+}
+
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
+ LDKMinFinalCltvExpiry orig_conv;
orig_conv.inner = (void*)(orig & (~1));
orig_conv.is_owned = false;
- LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
+ LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_ref;
}
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
- LDKMinFinalCltvExpiry this_obj_conv;
- this_obj_conv.inner = (void*)(this_obj & (~1));
- this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
- MinFinalCltvExpiry_free(this_obj_conv);
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1hash(JNIEnv *env, jclass clz, int64_t o) {
+ LDKMinFinalCltvExpiry o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = MinFinalCltvExpiry_hash(&o_conv);
+ return ret_val;
}
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
return ret_val;
}
-JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone(JNIEnv *env, jclass clz, int64_t orig) {
- LDKMinFinalCltvExpiry orig_conv;
- orig_conv.inner = (void*)(orig & (~1));
- orig_conv.is_owned = false;
- LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
- CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t ret_ref = (uint64_t)ret_var.inner;
- if (ret_var.is_owned) {
- ret_ref |= 1;
- }
- return ret_ref;
-}
-
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Fallback_1free(JNIEnv *env, jclass clz, int64_t this_ptr) {
if ((this_ptr & 1) != 0) return;
LDKFallback this_ptr_conv = *(LDKFallback*)(((uint64_t)this_ptr) & ~1);
return ret_ref;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_Fallback_1hash(JNIEnv *env, jclass clz, int64_t o) {
+ LDKFallback* o_conv = (LDKFallback*)o;
+ int64_t ret_val = Fallback_hash(o_conv);
+ return ret_val;
+}
+
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Fallback_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
LDKFallback* a_conv = (LDKFallback*)a;
LDKFallback* b_conv = (LDKFallback*)b;
InvoiceSignature_free(this_obj_conv);
}
-JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
- LDKInvoiceSignature a_conv;
- a_conv.inner = (void*)(a & (~1));
- a_conv.is_owned = false;
- LDKInvoiceSignature b_conv;
- b_conv.inner = (void*)(b & (~1));
- b_conv.is_owned = false;
- jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
- return ret_val;
-}
-
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone(JNIEnv *env, jclass clz, int64_t orig) {
LDKInvoiceSignature orig_conv;
orig_conv.inner = (void*)(orig & (~1));
return ret_ref;
}
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
- LDKPrivateRoute this_obj_conv;
- this_obj_conv.inner = (void*)(this_obj & (~1));
- this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
- PrivateRoute_free(this_obj_conv);
-}
-
-JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
- LDKPrivateRoute a_conv;
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
+ LDKInvoiceSignature a_conv;
a_conv.inner = (void*)(a & (~1));
a_conv.is_owned = false;
- LDKPrivateRoute b_conv;
+ LDKInvoiceSignature b_conv;
b_conv.inner = (void*)(b & (~1));
b_conv.is_owned = false;
- jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
+ jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
return ret_val;
}
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free(JNIEnv *env, jclass clz, int64_t this_obj) {
+ LDKPrivateRoute this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ PrivateRoute_free(this_obj_conv);
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone(JNIEnv *env, jclass clz, int64_t orig) {
LDKPrivateRoute orig_conv;
orig_conv.inner = (void*)(orig & (~1));
return ret_ref;
}
+JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash(JNIEnv *env, jclass clz, int64_t o) {
+ LDKPrivateRoute o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = PrivateRoute_hash(&o_conv);
+ return ret_val;
+}
+
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
+ LDKPrivateRoute a_conv;
+ a_conv.inner = (void*)(a & (~1));
+ a_conv.is_owned = false;
+ LDKPrivateRoute b_conv;
+ b_conv.inner = (void*)(b & (~1));
+ b_conv.is_owned = false;
+ jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
+ return ret_val;
+}
+
JNIEXPORT int64_t JNICALL Java_org_ldk_impl_bindings_SignedRawInvoice_1into_1parts(JNIEnv *env, jclass clz, int64_t this_arg) {
LDKSignedRawInvoice this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
return ret_conv;
}
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1secret(JNIEnv *env, jclass clz) {
+ jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_no_payment_secret());
+ return ret_conv;
+}
+
JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1payment_1secrets(JNIEnv *env, jclass clz) {
jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_multiple_payment_secrets());
return ret_conv;
return ret_conv;
}
+JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_SemanticError_1imprecise_1amount(JNIEnv *env, jclass clz) {
+ jclass ret_conv = LDKSemanticError_to_java(env, SemanticError_imprecise_amount());
+ return ret_conv;
+}
+
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_SemanticError_1eq(JNIEnv *env, jclass clz, int64_t a, int64_t b) {
LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
}
LDKCurrency network_conv = LDKCurrency_from_java(env, network);
LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1);
+ amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1));
LDKStr description_conv = java_to_owned_str(env, description);
LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
*ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1BuiltCommitmentTransactionDecodeErrorZ_1get_1err
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKCResult_TrustedClosingTransactionNoneZ_result_ok
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1result_1ok
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKCResult_TrustedClosingTransactionNoneZ_get_ok
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1get_1ok
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKCResult_TrustedClosingTransactionNoneZ_get_err
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TrustedClosingTransactionNoneZ_1get_1err
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: LDKCResult_CommitmentTransactionDecodeErrorZ_result_ok
JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1C2Tuple_1usizeTransactionZZ_1ref_1from_1ptr
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKNetworkUpdate_ref_from_ptr
+ * Signature: (J)Lorg/ldk/impl/bindings/LDKNetworkUpdate;
+ */
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetworkUpdate_1ref_1from_1ptr
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKCOption_NetworkUpdateZ_ref_from_ptr
+ * Signature: (J)Lorg/ldk/impl/bindings/LDKCOption_NetworkUpdateZ;
+ */
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1NetworkUpdateZ_1ref_1from_1ptr
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: LDKSpendableOutputDescriptor_ref_from_ptr
JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr
(JNIEnv *, jclass, jlong);
-/*
- * Class: org_ldk_impl_bindings
- * Method: LDKHTLCFailChannelUpdate_ref_from_ptr
- * Signature: (J)Lorg/ldk/impl/bindings/LDKHTLCFailChannelUpdate;
- */
-JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr
- (JNIEnv *, jclass, jlong);
-
/*
* Class: org_ldk_impl_bindings
* Method: LDKMessageSendEvent_ref_from_ptr
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SpendableOutputDescriptorDecodeErrorZ_1get_1err
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKCResult_NoneNoneZ_result_ok
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1result_1ok
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKCResult_NoneNoneZ_get_ok
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1get_1ok
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKCResult_NoneNoneZ_get_err
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneNoneZ_1get_1err
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: LDKC2Tuple_SignatureCVec_SignatureZZ_new
JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_BaseSign_1release_1commitment_1secret
(JNIEnv *, jclass, jlong, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: BaseSign_validate_holder_commitment
+ * Signature: (JJ)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BaseSign_1validate_1holder_1commitment
+ (JNIEnv *, jclass, jlong, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: BaseSign_channel_keys_id
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1counterparty_1commitment
(JNIEnv *, jclass, jlong, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: BaseSign_validate_counterparty_revocation
+ * Signature: (JJ[B)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BaseSign_1validate_1counterparty_1revocation
+ (JNIEnv *, jclass, jlong, jlong, jbyteArray);
+
/*
* Class: org_ldk_impl_bindings
* Method: BaseSign_sign_holder_commitment_and_htlcs
/*
* Class: org_ldk_impl_bindings
* Method: BaseSign_sign_closing_transaction
- * Signature: (J[B)J
+ * Signature: (JJ)J
*/
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BaseSign_1sign_1closing_1transaction
- (JNIEnv *, jclass, jlong, jbyteArray);
+ (JNIEnv *, jclass, jlong, jlong);
/*
* Class: org_ldk_impl_bindings
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1OutPointDecodeErrorZ_1get_1err
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKType_new
+ * Signature: (Lorg/ldk/impl/bindings/LDKType;)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKType_1new
+ (JNIEnv *, jclass, jobject);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: Type_type_id
+ * Signature: (J)S
+ */
+JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Type_1type_1id
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: Type_debug_str
+ * Signature: (J)Ljava/lang/String;
+ */
+JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_Type_1debug_1str
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: Type_write
+ * Signature: (J)[B
+ */
+JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Type_1write
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKCOption_TypeZ_ref_from_ptr
+ * Signature: (J)Lorg/ldk/impl/bindings/LDKCOption_TypeZ;
+ */
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1TypeZ_1ref_1from_1ptr
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKCResult_COption_TypeZDecodeErrorZ_result_ok
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1result_1ok
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKCResult_COption_TypeZDecodeErrorZ_get_ok
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1get_1ok
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKCResult_COption_TypeZDecodeErrorZ_get_err
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1COption_1TypeZDecodeErrorZ_1get_1err
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: LDKCResult_SiPrefixNoneZ_result_ok
JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKPaymentPurpose_1ref_1from_1ptr
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKClosureReason_ref_from_ptr
+ * Signature: (J)Lorg/ldk/impl/bindings/LDKClosureReason;
+ */
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKClosureReason_1ref_1from_1ptr
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: LDKEvent_ref_from_ptr
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1new
(JNIEnv *, jclass, jlongArray);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKBalance_ref_from_ptr
+ * Signature: (J)Lorg/ldk/impl/bindings/LDKBalance;
+ */
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBalance_1ref_1from_1ptr
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKCVec_BalanceZ_new
+ * Signature: ([J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1BalanceZ_1new
+ (JNIEnv *, jclass, jlongArray);
+
/*
* Class: org_ldk_impl_bindings
* Method: LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_result_ok
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1get_1err
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKCResult_NoneLightningErrorZ_result_ok
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKCResult_NoneLightningErrorZ_get_ok
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKCResult_NoneLightningErrorZ_get_err
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKC2Tuple_PublicKeyTypeZ_new
+ * Signature: ([BJ)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PublicKeyTypeZ_1new
+ (JNIEnv *, jclass, jbyteArray, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKC2Tuple_PublicKeyTypeZ_get_a
+ * Signature: (J)[B
+ */
+JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PublicKeyTypeZ_1get_1a
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKC2Tuple_PublicKeyTypeZ_get_b
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2Tuple_1PublicKeyTypeZ_1get_1b
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKCVec_C2Tuple_PublicKeyTypeZZ_new
+ * Signature: ([J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1C2Tuple_1PublicKeyTypeZZ_1new
+ (JNIEnv *, jclass, jlongArray);
+
/*
* Class: org_ldk_impl_bindings
* Method: LDKCResult_boolLightningErrorZ_result_ok
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVec_1NodeAnnouncementZ_1new
(JNIEnv *, jclass, jlongArray);
-/*
- * Class: org_ldk_impl_bindings
- * Method: LDKCResult_NoneLightningErrorZ_result_ok
- * Signature: (J)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1result_1ok
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: org_ldk_impl_bindings
- * Method: LDKCResult_NoneLightningErrorZ_get_ok
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1ok
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: org_ldk_impl_bindings
- * Method: LDKCResult_NoneLightningErrorZ_get_err
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneLightningErrorZ_1get_1err
- (JNIEnv *, jclass, jlong);
-
/*
* Class: org_ldk_impl_bindings
* Method: LDKCResult_CVec_u8ZPeerHandleErrorZ_result_ok
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKAccess_new
+ * Signature: (Lorg/ldk/impl/bindings/LDKAccess;)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new
+ (JNIEnv *, jclass, jobject);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: Access_get_utxo
+ * Signature: (J[BJ)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Access_1get_1utxo
+ (JNIEnv *, jclass, jlong, jbyteArray, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKCOption_AccessZ_ref_from_ptr
+ * Signature: (J)Lorg/ldk/impl/bindings/LDKCOption_AccessZ;
+ */
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1AccessZ_1ref_1from_1ptr
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: LDKCResult_DirectionalChannelInfoDecodeErrorZ_result_ok
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1InvoiceSignOrCreationErrorZ_1get_1err
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKFilter_new
+ * Signature: (Lorg/ldk/impl/bindings/LDKFilter;)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new
+ (JNIEnv *, jclass, jobject);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: Filter_register_tx
+ * Signature: (J[B[B)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx
+ (JNIEnv *, jclass, jlong, jbyteArray, jbyteArray);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: Filter_register_output
+ * Signature: (JJ)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output
+ (JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKCOption_FilterZ_ref_from_ptr
+ * Signature: (J)Lorg/ldk/impl/bindings/LDKCOption_FilterZ;
+ */
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCOption_1FilterZ_1ref_1from_1ptr
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: LDKMessageSendEventsProvider_new
/*
* Class: org_ldk_impl_bindings
- * Method: LDKAccess_new
- * Signature: (Lorg/ldk/impl/bindings/LDKAccess;)J
- */
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new
- (JNIEnv *, jclass, jobject);
-
-/*
- * Class: org_ldk_impl_bindings
- * Method: Access_get_utxo
- * Signature: (J[BJ)J
- */
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Access_1get_1utxo
- (JNIEnv *, jclass, jlong, jbyteArray, jlong);
-
-/*
- * Class: org_ldk_impl_bindings
- * Method: LDKListen_new
- * Signature: (Lorg/ldk/impl/bindings/LDKListen;)J
+ * Method: LDKListen_new
+ * Signature: (Lorg/ldk/impl/bindings/LDKListen;)J
*/
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKListen_1new
(JNIEnv *, jclass, jobject);
JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Confirm_1get_1relevant_1txids
(JNIEnv *, jclass, jlong);
-/*
- * Class: org_ldk_impl_bindings
- * Method: LDKFilter_new
- * Signature: (Lorg/ldk/impl/bindings/LDKFilter;)J
- */
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new
- (JNIEnv *, jclass, jobject);
-
-/*
- * Class: org_ldk_impl_bindings
- * Method: Filter_register_tx
- * Signature: (J[B[B)V
- */
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx
- (JNIEnv *, jclass, jlong, jbyteArray, jbyteArray);
-
-/*
- * Class: org_ldk_impl_bindings
- * Method: Filter_register_output
- * Signature: (JJ)J
- */
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output
- (JNIEnv *, jclass, jlong, jlong);
-
/*
* Class: org_ldk_impl_bindings
* Method: LDKPersist_new
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update
(JNIEnv *, jclass, jlong, jlong);
-/*
- * Class: org_ldk_impl_bindings
- * Method: RoutingMessageHandler_handle_htlc_fail_channel_update
- * Signature: (JJ)V
- */
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update
- (JNIEnv *, jclass, jlong, jlong);
-
/*
* Class: org_ldk_impl_bindings
* Method: RoutingMessageHandler_get_next_channel_announcements
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1query_1short_1channel_1ids
(JNIEnv *, jclass, jlong, jbyteArray, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKCustomMessageReader_new
+ * Signature: (Lorg/ldk/impl/bindings/LDKCustomMessageReader;)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageReader_1new
+ (JNIEnv *, jclass, jobject);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CustomMessageReader_read
+ * Signature: (JS[B)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1read
+ (JNIEnv *, jclass, jlong, jshort, jbyteArray);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKCustomMessageHandler_new
+ * Signature: (Lorg/ldk/impl/bindings/LDKCustomMessageHandler;Lorg/ldk/impl/bindings/LDKCustomMessageReader;)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1new
+ (JNIEnv *, jclass, jobject, jobject);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: LDKCustomMessageHandler_get_CustomMessageReader
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCustomMessageHandler_1get_1CustomMessageReader
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CustomMessageHandler_handle_custom_message
+ * Signature: (JJ[B)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1handle_1custom_1message
+ (JNIEnv *, jclass, jlong, jlong, jbyteArray);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CustomMessageHandler_get_and_clear_pending_msg
+ * Signature: (J)[J
+ */
+JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1get_1and_1clear_1pending_1msg
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: LDKSocketDescriptor_new
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1BuiltCommitmentTransactionDecodeErrorZ_1clone
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CResult_TrustedClosingTransactionNoneZ_ok
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1ok
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CResult_TrustedClosingTransactionNoneZ_err
+ * Signature: ()J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1err
+ (JNIEnv *, jclass);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CResult_TrustedClosingTransactionNoneZ_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TrustedClosingTransactionNoneZ_1free
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: CResult_CommitmentTransactionDecodeErrorZ_ok
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1C2Tuple_1usizeTransactionZZ_1clone
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: COption_NetworkUpdateZ_some
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1some
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: COption_NetworkUpdateZ_none
+ * Signature: ()J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1none
+ (JNIEnv *, jclass);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: COption_NetworkUpdateZ_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1free
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: COption_NetworkUpdateZ_clone
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1NetworkUpdateZ_1clone
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: CVec_SpendableOutputDescriptorZ_free
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SpendableOutputDescriptorDecodeErrorZ_1clone
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CResult_NoneNoneZ_ok
+ * Signature: ()J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1ok
+ (JNIEnv *, jclass);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CResult_NoneNoneZ_err
+ * Signature: ()J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1err
+ (JNIEnv *, jclass);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CResult_NoneNoneZ_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1free
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CResult_NoneNoneZ_clone
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneNoneZ_1clone
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: C2Tuple_SignatureCVec_SignatureZZ_clone
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1OutPointDecodeErrorZ_1clone
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: COption_TypeZ_some
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1some
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: COption_TypeZ_none
+ * Signature: ()J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1none
+ (JNIEnv *, jclass);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: COption_TypeZ_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1free
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: COption_TypeZ_clone
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1TypeZ_1clone
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CResult_COption_TypeZDecodeErrorZ_ok
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1ok
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CResult_COption_TypeZDecodeErrorZ_err
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1err
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CResult_COption_TypeZDecodeErrorZ_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1free
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CResult_COption_TypeZDecodeErrorZ_clone
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1COption_1TypeZDecodeErrorZ_1clone
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: CResult_SiPrefixNoneZ_ok
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1C2Tuple_1u32TxOutZZZZ_1free
(JNIEnv *, jclass, jlongArray);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CVec_BalanceZ_free
+ * Signature: ([J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1BalanceZ_1free
+ (JNIEnv *, jclass, jlongArray);
+
/*
* Class: org_ldk_impl_bindings
* Method: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1BlockHashChannelMonitorZDecodeErrorZ_1free
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CResult_NoneLightningErrorZ_ok
+ * Signature: ()J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok
+ (JNIEnv *, jclass);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CResult_NoneLightningErrorZ_err
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CResult_NoneLightningErrorZ_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CResult_NoneLightningErrorZ_clone
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: C2Tuple_PublicKeyTypeZ_clone
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1clone
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: C2Tuple_PublicKeyTypeZ_new
+ * Signature: ([BJ)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1new
+ (JNIEnv *, jclass, jbyteArray, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: C2Tuple_PublicKeyTypeZ_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1PublicKeyTypeZ_1free
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CVec_C2Tuple_PublicKeyTypeZZ_free
+ * Signature: ([J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1PublicKeyTypeZZ_1free
+ (JNIEnv *, jclass, jlongArray);
+
/*
* Class: org_ldk_impl_bindings
* Method: CResult_boolLightningErrorZ_ok
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free
(JNIEnv *, jclass, jlongArray);
-/*
- * Class: org_ldk_impl_bindings
- * Method: CResult_NoneLightningErrorZ_ok
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1ok
- (JNIEnv *, jclass);
-
-/*
- * Class: org_ldk_impl_bindings
- * Method: CResult_NoneLightningErrorZ_err
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1err
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: org_ldk_impl_bindings
- * Method: CResult_NoneLightningErrorZ_free
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1free
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: org_ldk_impl_bindings
- * Method: CResult_NoneLightningErrorZ_clone
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneLightningErrorZ_1clone
- (JNIEnv *, jclass, jlong);
-
/*
* Class: org_ldk_impl_bindings
* Method: CVec_PublicKeyZ_free
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1clone
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: COption_AccessZ_some
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1some
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: COption_AccessZ_none
+ * Signature: ()J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1none
+ (JNIEnv *, jclass);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: COption_AccessZ_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1AccessZ_1free
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: CResult_DirectionalChannelInfoDecodeErrorZ_ok
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1free
(JNIEnv *, jclass, jlong);
-/*
- * Class: org_ldk_impl_bindings
- * Method: CResult_NetworkGraphDecodeErrorZ_clone
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NetworkGraphDecodeErrorZ_1clone
- (JNIEnv *, jclass, jlong);
-
/*
* Class: org_ldk_impl_bindings
* Method: CResult_NetAddressu8Z_ok
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1InvoiceSignOrCreationErrorZ_1clone
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: COption_FilterZ_some
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1some
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: COption_FilterZ_none
+ * Signature: ()J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1none
+ (JNIEnv *, jclass);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: COption_FilterZ_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_COption_1FilterZ_1free
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: PaymentPurpose_free
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PaymentPurpose_1spontaneous_1payment
(JNIEnv *, jclass, jbyteArray);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: ClosureReason_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosureReason_1free
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: ClosureReason_clone
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosureReason_1clone
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: ClosureReason_counterparty_force_closed
+ * Signature: (Ljava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosureReason_1counterparty_1force_1closed
+ (JNIEnv *, jclass, jstring);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: ClosureReason_holder_force_closed
+ * Signature: ()J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosureReason_1holder_1force_1closed
+ (JNIEnv *, jclass);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: ClosureReason_cooperative_closure
+ * Signature: ()J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosureReason_1cooperative_1closure
+ (JNIEnv *, jclass);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: ClosureReason_commitment_tx_confirmed
+ * Signature: ()J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosureReason_1commitment_1tx_1confirmed
+ (JNIEnv *, jclass);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: ClosureReason_processing_error
+ * Signature: (Ljava/lang/String;)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosureReason_1processing_1error
+ (JNIEnv *, jclass, jstring);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: ClosureReason_disconnected_peer
+ * Signature: ()J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosureReason_1disconnected_1peer
+ (JNIEnv *, jclass);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: ClosureReason_outdated_channel_manager
+ * Signature: ()J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosureReason_1outdated_1channel_1manager
+ (JNIEnv *, jclass);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: ClosureReason_write
+ * Signature: (J)[B
+ */
+JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosureReason_1write
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: Event_free
/*
* Class: org_ldk_impl_bindings
- * Method: Event_payment_failed
- * Signature: ([BZ)J
+ * Method: Event_payment_path_failed
+ * Signature: ([BZJZ[J)J
*/
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1payment_1failed
- (JNIEnv *, jclass, jbyteArray, jboolean);
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1payment_1path_1failed
+ (JNIEnv *, jclass, jbyteArray, jboolean, jlong, jboolean, jlongArray);
/*
* Class: org_ldk_impl_bindings
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1payment_1forwarded
(JNIEnv *, jclass, jlong, jboolean);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: Event_channel_closed
+ * Signature: ([BJ)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Event_1channel_1closed
+ (JNIEnv *, jclass, jbyteArray, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: Event_write
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1handle_1error
(JNIEnv *, jclass, jbyteArray, jlong);
-/*
- * Class: org_ldk_impl_bindings
- * Method: MessageSendEvent_payment_failure_network_update
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1payment_1failure_1network_1update
- (JNIEnv *, jclass, jlong);
-
/*
* Class: org_ldk_impl_bindings
* Method: MessageSendEvent_send_channel_range_query
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new
(JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: ChainMonitor_get_claimable_balances
+ * Signature: (J[J)[J
+ */
+JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1get_1claimable_1balances
+ (JNIEnv *, jclass, jlong, jlongArray);
+
/*
* Class: org_ldk_impl_bindings
* Method: ChainMonitor_as_Listen
/*
* Class: org_ldk_impl_bindings
- * Method: MonitorEvent_commitment_tx_broadcasted
+ * Method: MonitorEvent_commitment_tx_confirmed
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1broadcasted
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1commitment_1tx_1confirmed
(JNIEnv *, jclass, jlong);
/*
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read
(JNIEnv *, jclass, jbyteArray);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: Balance_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Balance_1free
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: Balance_clone
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Balance_1clone
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: Balance_claimable_on_channel_close
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1on_1channel_1close
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: Balance_claimable_awaiting_confirmations
+ * Signature: (JI)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Balance_1claimable_1awaiting_1confirmations
+ (JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: Balance_contentious_claimable
+ * Signature: (JI)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Balance_1contentious_1claimable
+ (JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: Balance_maybe_claimable_htlcawaiting_timeout
+ * Signature: (JI)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Balance_1maybe_1claimable_1htlcawaiting_1timeout
+ (JNIEnv *, jclass, jlong, jint);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: Balance_eq
+ * Signature: (JJ)Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Balance_1eq
+ (JNIEnv *, jclass, jlong, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: ChannelMonitor_free
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1current_1best_1block
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: ChannelMonitor_get_claimable_balances
+ * Signature: (J)[J
+ */
+JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1claimable_1balances
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: Persist_free
/*
* Class: org_ldk_impl_bindings
- * Method: ChannelCounterparty_free
+ * Method: CounterpartyForwardingInfo_free
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1free
(JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: ChannelCounterparty_get_node_id
- * Signature: (J)[B
+ * Method: CounterpartyForwardingInfo_get_fee_base_msat
+ * Signature: (J)I
*/
-JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id
+JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1base_1msat
(JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: ChannelCounterparty_set_node_id
- * Signature: (J[B)V
+ * Method: CounterpartyForwardingInfo_set_fee_base_msat
+ * Signature: (JI)V
*/
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id
- (JNIEnv *, jclass, jlong, jbyteArray);
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1base_1msat
+ (JNIEnv *, jclass, jlong, jint);
/*
* Class: org_ldk_impl_bindings
- * Method: ChannelCounterparty_get_features
- * Signature: (J)J
+ * Method: CounterpartyForwardingInfo_get_fee_proportional_millionths
+ * Signature: (J)I
*/
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features
+JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1fee_1proportional_1millionths
(JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: ChannelCounterparty_set_features
- * Signature: (JJ)V
+ * Method: CounterpartyForwardingInfo_set_fee_proportional_millionths
+ * Signature: (JI)V
*/
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features
- (JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1fee_1proportional_1millionths
+ (JNIEnv *, jclass, jlong, jint);
/*
* Class: org_ldk_impl_bindings
- * Method: ChannelCounterparty_get_unspendable_punishment_reserve
- * Signature: (J)J
+ * Method: CounterpartyForwardingInfo_get_cltv_expiry_delta
+ * Signature: (J)S
*/
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve
+JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1get_1cltv_1expiry_1delta
(JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: ChannelCounterparty_set_unspendable_punishment_reserve
- * Signature: (JJ)V
+ * Method: CounterpartyForwardingInfo_set_cltv_expiry_delta
+ * Signature: (JS)V
*/
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve
- (JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1set_1cltv_1expiry_1delta
+ (JNIEnv *, jclass, jlong, jshort);
/*
* Class: org_ldk_impl_bindings
- * Method: ChannelCounterparty_clone
+ * Method: CounterpartyForwardingInfo_new
+ * Signature: (IIS)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1new
+ (JNIEnv *, jclass, jint, jint, jshort);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CounterpartyForwardingInfo_clone
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CounterpartyForwardingInfo_1clone
(JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: ChannelDetails_free
+ * Method: ChannelCounterparty_free
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1free
(JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: ChannelDetails_get_channel_id
+ * Method: ChannelCounterparty_get_node_id
* Signature: (J)[B
*/
-JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id
+JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1node_1id
(JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: ChannelDetails_set_channel_id
+ * Method: ChannelCounterparty_set_node_id
* Signature: (J[B)V
*/
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1node_1id
(JNIEnv *, jclass, jlong, jbyteArray);
/*
* Class: org_ldk_impl_bindings
- * Method: ChannelDetails_get_counterparty
+ * Method: ChannelCounterparty_get_features
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1features
(JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: ChannelDetails_set_counterparty
+ * Method: ChannelCounterparty_set_features
* Signature: (JJ)V
*/
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1features
(JNIEnv *, jclass, jlong, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: ChannelDetails_get_funding_txo
+ * Method: ChannelCounterparty_get_unspendable_punishment_reserve
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1unspendable_1punishment_1reserve
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: ChannelCounterparty_set_unspendable_punishment_reserve
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1unspendable_1punishment_1reserve
+ (JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: ChannelCounterparty_get_forwarding_info
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1get_1forwarding_1info
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: ChannelCounterparty_set_forwarding_info
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1set_1forwarding_1info
+ (JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: ChannelCounterparty_new
+ * Signature: ([BJJJ)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1new
+ (JNIEnv *, jclass, jbyteArray, jlong, jlong, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: ChannelCounterparty_clone
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelCounterparty_1clone
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: ChannelDetails_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: ChannelDetails_get_channel_id
+ * Signature: (J)[B
+ */
+JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: ChannelDetails_set_channel_id
+ * Signature: (J[B)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id
+ (JNIEnv *, jclass, jlong, jbyteArray);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: ChannelDetails_get_counterparty
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: ChannelDetails_set_counterparty
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty
+ (JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: ChannelDetails_get_funding_txo
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1funding_1txo
(JNIEnv *, jclass, jlong);
/*
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CommitmentUpdate_get_update_add_htlcs
+ * Signature: (J)[J
+ */
+JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1add_1htlcs
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: CommitmentUpdate_set_update_add_htlcs
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs
(JNIEnv *, jclass, jlong, jlongArray);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CommitmentUpdate_get_update_fulfill_htlcs
+ * Signature: (J)[J
+ */
+JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fulfill_1htlcs
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: CommitmentUpdate_set_update_fulfill_htlcs
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs
(JNIEnv *, jclass, jlong, jlongArray);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CommitmentUpdate_get_update_fail_htlcs
+ * Signature: (J)[J
+ */
+JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1htlcs
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: CommitmentUpdate_set_update_fail_htlcs
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs
(JNIEnv *, jclass, jlong, jlongArray);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CommitmentUpdate_get_update_fail_malformed_htlcs
+ * Signature: (J)[J
+ */
+JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fail_1malformed_1htlcs
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: CommitmentUpdate_set_update_fail_malformed_htlcs
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone
(JNIEnv *, jclass, jlong);
-/*
- * Class: org_ldk_impl_bindings
- * Method: HTLCFailChannelUpdate_free
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: org_ldk_impl_bindings
- * Method: HTLCFailChannelUpdate_clone
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1clone
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: org_ldk_impl_bindings
- * Method: HTLCFailChannelUpdate_channel_update_message
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1channel_1update_1message
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: org_ldk_impl_bindings
- * Method: HTLCFailChannelUpdate_channel_closed
- * Signature: (JZ)J
- */
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1channel_1closed
- (JNIEnv *, jclass, jlong, jboolean);
-
-/*
- * Class: org_ldk_impl_bindings
- * Method: HTLCFailChannelUpdate_node_failure
- * Signature: ([BZ)J
- */
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1node_1failure
- (JNIEnv *, jclass, jbyteArray, jboolean);
-
/*
* Class: org_ldk_impl_bindings
* Method: ChannelMessageHandler_free
JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: ReplyShortChannelIdsEnd_write
+ * Signature: (J)[B
+ */
+JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: ReplyShortChannelIdsEnd_read
/*
* Class: org_ldk_impl_bindings
- * Method: ReplyShortChannelIdsEnd_write
- * Signature: (J)[B
+ * Method: QueryChannelRange_end_blocknum
+ * Signature: (J)I
*/
-JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write
+JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum
(JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: QueryChannelRange_end_blocknum
- * Signature: (J)I
+ * Method: QueryChannelRange_write
+ * Signature: (J)[B
*/
-JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1end_1blocknum
+JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write
(JNIEnv *, jclass, jlong);
/*
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read
(JNIEnv *, jclass, jbyteArray);
-/*
- * Class: org_ldk_impl_bindings
- * Method: QueryChannelRange_write
- * Signature: (J)[B
- */
-JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write
- (JNIEnv *, jclass, jlong);
-
/*
* Class: org_ldk_impl_bindings
* Method: ReplyChannelRange_read
JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: GossipTimestampFilter_write
+ * Signature: (J)[B
+ */
+JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: GossipTimestampFilter_read
/*
* Class: org_ldk_impl_bindings
- * Method: GossipTimestampFilter_write
- * Signature: (J)[B
+ * Method: CustomMessageHandler_free
+ * Signature: (J)V
*/
-JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageHandler_1free
(JNIEnv *, jclass, jlong);
/*
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1RoutingMessageHandler
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: IgnoringMessageHandler_as_CustomMessageReader
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageReader
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: IgnoringMessageHandler_as_CustomMessageHandler
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_IgnoringMessageHandler_1as_1CustomMessageHandler
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: ErroringMessageHandler_free
/*
* Class: org_ldk_impl_bindings
* Method: PeerManager_new
- * Signature: (J[B[BJ)J
+ * Signature: (J[B[BJJ)J
*/
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new
- (JNIEnv *, jclass, jlong, jbyteArray, jbyteArray, jlong);
+ (JNIEnv *, jclass, jlong, jbyteArray, jbyteArray, jlong, jlong);
/*
* Class: org_ldk_impl_bindings
JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret
(JNIEnv *, jclass, jbyteArray, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: build_closing_transaction
+ * Signature: (JJ[B[BJ)[B
+ */
+JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1closing_1transaction
+ (JNIEnv *, jclass, jlong, jlong, jbyteArray, jbyteArray, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: derive_private_key
/*
* Class: org_ldk_impl_bindings
- * Method: CommitmentTransaction_free
+ * Method: ClosingTransaction_free
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1free
(JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: CommitmentTransaction_clone
- * Signature: (J)J
+ * Method: ClosingTransaction_new
+ * Signature: (JJ[B[BJ)J
*/
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1new
+ (JNIEnv *, jclass, jlong, jlong, jbyteArray, jbyteArray, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: CommitmentTransaction_write
- * Signature: (J)[B
+ * Method: ClosingTransaction_trust
+ * Signature: (J)J
*/
-JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1trust
(JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: CommitmentTransaction_read
- * Signature: ([B)J
+ * Method: ClosingTransaction_verify
+ * Signature: (JJ)J
*/
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read
- (JNIEnv *, jclass, jbyteArray);
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1verify
+ (JNIEnv *, jclass, jlong, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: CommitmentTransaction_commitment_number
+ * Method: ClosingTransaction_to_holder_value_sat
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1value_1sat
(JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: CommitmentTransaction_to_broadcaster_value_sat
+ * Method: ClosingTransaction_to_counterparty_value_sat
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1value_1sat
(JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: CommitmentTransaction_to_countersignatory_value_sat
- * Signature: (J)J
+ * Method: ClosingTransaction_to_holder_script
+ * Signature: (J)[B
*/
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat
+JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1holder_1script
(JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: CommitmentTransaction_feerate_per_kw
- * Signature: (J)I
+ * Method: ClosingTransaction_to_counterparty_script
+ * Signature: (J)[B
*/
-JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw
+JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingTransaction_1to_1counterparty_1script
(JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: CommitmentTransaction_trust
- * Signature: (J)J
+ * Method: TrustedClosingTransaction_free
+ * Signature: (J)V
*/
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1free
(JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: CommitmentTransaction_verify
- * Signature: (JJJJ)J
+ * Method: TrustedClosingTransaction_built_transaction
+ * Signature: (J)[B
*/
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1verify
- (JNIEnv *, jclass, jlong, jlong, jlong, jlong);
+JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1built_1transaction
+ (JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: TrustedCommitmentTransaction_free
- * Signature: (J)V
+ * Method: TrustedClosingTransaction_get_sighash_all
+ * Signature: (J[BJ)[B
*/
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1get_1sighash_1all
+ (JNIEnv *, jclass, jlong, jbyteArray, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: TrustedCommitmentTransaction_txid
- * Signature: (J)[B
+ * Method: TrustedClosingTransaction_sign
+ * Signature: (J[B[BJ)[B
*/
-JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid
- (JNIEnv *, jclass, jlong);
+JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TrustedClosingTransaction_1sign
+ (JNIEnv *, jclass, jlong, jbyteArray, jbyteArray, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: TrustedCommitmentTransaction_built_transaction
- * Signature: (J)J
+ * Method: CommitmentTransaction_free
+ * Signature: (J)V
*/
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1free
(JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: TrustedCommitmentTransaction_keys
+ * Method: CommitmentTransaction_clone
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1clone
(JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: TrustedCommitmentTransaction_get_htlc_sigs
- * Signature: (J[BJ)J
+ * Method: CommitmentTransaction_write
+ * Signature: (J)[B
+ */
+JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1write
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CommitmentTransaction_read
+ * Signature: ([B)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1read
+ (JNIEnv *, jclass, jbyteArray);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CommitmentTransaction_commitment_number
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1commitment_1number
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CommitmentTransaction_to_broadcaster_value_sat
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1broadcaster_1value_1sat
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CommitmentTransaction_to_countersignatory_value_sat
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1to_1countersignatory_1value_1sat
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CommitmentTransaction_feerate_per_kw
+ * Signature: (J)I
+ */
+JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1feerate_1per_1kw
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CommitmentTransaction_trust
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1trust
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CommitmentTransaction_verify
+ * Signature: (JJJJ)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentTransaction_1verify
+ (JNIEnv *, jclass, jlong, jlong, jlong, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: TrustedCommitmentTransaction_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1free
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: TrustedCommitmentTransaction_txid
+ * Signature: (J)[B
+ */
+JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1txid
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: TrustedCommitmentTransaction_built_transaction
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1built_1transaction
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: TrustedCommitmentTransaction_keys
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1keys
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: TrustedCommitmentTransaction_get_htlc_sigs
+ * Signature: (J[BJ)J
*/
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TrustedCommitmentTransaction_1get_1htlc_1sigs
(JNIEnv *, jclass, jlong, jbyteArray, jlong);
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InitFeatures_1known
(JNIEnv *, jclass);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: InitFeatures_requires_unknown_bits
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InitFeatures_1requires_1unknown_1bits
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: NodeFeatures_empty
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1known
(JNIEnv *, jclass);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: NodeFeatures_requires_unknown_bits
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1requires_1unknown_1bits
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: ChannelFeatures_empty
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1known
(JNIEnv *, jclass);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: ChannelFeatures_requires_unknown_bits
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1requires_1unknown_1bits
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: InvoiceFeatures_empty
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1known
(JNIEnv *, jclass);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: InvoiceFeatures_requires_unknown_bits
+ * Signature: (J)Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_InvoiceFeatures_1requires_1unknown_1bits
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: InitFeatures_supports_payment_secret
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ShutdownScript_1is_1compatible
(JNIEnv *, jclass, jlong, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: CustomMessageReader_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CustomMessageReader_1free
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: Type_clone
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Type_1clone
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: Type_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Type_1free
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: RouteHop_free
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: RouteHop_hash
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1hash
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: RouteHop_eq
+ * Signature: (JJ)Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHop_1eq
+ (JNIEnv *, jclass, jlong, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: RouteHop_write
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: Route_get_paths
+ * Signature: (J)[[J
+ */
+JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_Route_1get_1paths
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: Route_set_paths
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1clone
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: Route_hash
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1hash
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: Route_eq
+ * Signature: (JJ)Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Route_1eq
+ (JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: Route_get_total_fees
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1fees
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: Route_get_total_amount
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1get_1total_1amount
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: Route_write
/*
* Class: org_ldk_impl_bindings
- * Method: RouteHint_eq
- * Signature: (JJ)Z
+ * Method: RouteHint_clone
+ * Signature: (J)J
*/
-JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq
- (JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone
+ (JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: RouteHint_clone
+ * Method: RouteHint_hash
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1hash
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: RouteHint_eq
+ * Signature: (JJ)Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHint_1eq
+ (JNIEnv *, jclass, jlong, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: RouteHintHop_free
/*
* Class: org_ldk_impl_bindings
- * Method: RouteHintHop_eq
- * Signature: (JJ)Z
+ * Method: RouteHintHop_clone
+ * Signature: (J)J
*/
-JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq
- (JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone
+ (JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: RouteHintHop_clone
+ * Method: RouteHintHop_hash
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1clone
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1hash
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: RouteHintHop_eq
+ * Signature: (JJ)Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RouteHintHop_1eq
+ (JNIEnv *, jclass, jlong, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: get_keysend_route
/*
* Class: org_ldk_impl_bindings
- * Method: NetworkGraph_clone
- * Signature: (J)J
+ * Method: ReadOnlyNetworkGraph_free
+ * Signature: (J)V
*/
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1clone
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReadOnlyNetworkGraph_1free
(JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: LockedNetworkGraph_free
+ * Method: NetworkUpdate_free
* Signature: (J)V
*/
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1free
(JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: NetGraphMsgHandler_free
- * Signature: (J)V
+ * Method: NetworkUpdate_clone
+ * Signature: (J)J
*/
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1clone
(JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: NetGraphMsgHandler_new
- * Signature: ([BJJ)J
+ * Method: NetworkUpdate_channel_update_message
+ * Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new
- (JNIEnv *, jclass, jbyteArray, jlong, jlong);
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1update_1message
+ (JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: NetGraphMsgHandler_from_net_graph
- * Signature: (JJJ)J
+ * Method: NetworkUpdate_channel_closed
+ * Signature: (JZ)J
*/
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph
- (JNIEnv *, jclass, jlong, jlong, jlong);
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1channel_1closed
+ (JNIEnv *, jclass, jlong, jboolean);
/*
* Class: org_ldk_impl_bindings
- * Method: NetGraphMsgHandler_add_chain_access
- * Signature: (JJ)V
+ * Method: NetworkUpdate_node_failure
+ * Signature: ([BZ)J
*/
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access
- (JNIEnv *, jclass, jlong, jlong);
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1node_1failure
+ (JNIEnv *, jclass, jbyteArray, jboolean);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: NetworkUpdate_write
+ * Signature: (J)[B
+ */
+JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NetworkUpdate_1write
+ (JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: NetGraphMsgHandler_read_locked_graph
+ * Method: NetGraphMsgHandler_as_EventHandler
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1EventHandler
(JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: LockedNetworkGraph_graph
+ * Method: NetGraphMsgHandler_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: NetGraphMsgHandler_get_network_graph
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1get_1network_1graph
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: NetGraphMsgHandler_set_network_graph
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1set_1network_1graph
+ (JNIEnv *, jclass, jlong, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: NetGraphMsgHandler_new
+ * Signature: (JJJ)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new
+ (JNIEnv *, jclass, jlong, jlong, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: NetGraphMsgHandler_add_chain_access
+ * Signature: (JJ)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1add_1chain_1access
+ (JNIEnv *, jclass, jlong, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: NetGraphMsgHandler_as_RoutingMessageHandler
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: RoutingFees_hash
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1hash
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: RoutingFees_write
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new
(JNIEnv *, jclass, jbyteArray);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: NetworkGraph_read_only
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read_1only
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: NetworkGraph_update_node_from_announcement
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1close_1channel_1from_1update
(JNIEnv *, jclass, jlong, jlong, jboolean);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: NetworkGraph_fail_node
+ * Signature: (J[BZ)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1fail_1node
+ (JNIEnv *, jclass, jlong, jbyteArray, jboolean);
+
/*
* Class: org_ldk_impl_bindings
* Method: NetworkGraph_update_channel
/*
* Class: org_ldk_impl_bindings
* Method: BackgroundProcessor_start
- * Signature: (JJJJJJ)J
+ * Signature: (JJJJJJJ)J
*/
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BackgroundProcessor_1start
- (JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong, jlong);
+ (JNIEnv *, jclass, jlong, jlong, jlong, jlong, jlong, jlong, jlong);
/*
* Class: org_ldk_impl_bindings
JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_Currency_1signet
(JNIEnv *, jclass);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: Currency_hash
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Currency_1hash
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: Currency_eq
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Sha256_1free
(JNIEnv *, jclass, jlong);
-/*
- * Class: org_ldk_impl_bindings
- * Method: Sha256_eq
- * Signature: (JJ)Z
- */
-JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq
- (JNIEnv *, jclass, jlong, jlong);
-
/*
* Class: org_ldk_impl_bindings
* Method: Sha256_clone
/*
* Class: org_ldk_impl_bindings
- * Method: Description_free
- * Signature: (J)V
+ * Method: Sha256_hash
+ * Signature: (J)J
*/
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Sha256_1hash
(JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: Description_eq
+ * Method: Sha256_eq
* Signature: (JJ)Z
*/
-JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Sha256_1eq
(JNIEnv *, jclass, jlong, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: Description_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Description_1free
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: Description_clone
/*
* Class: org_ldk_impl_bindings
- * Method: PayeePubKey_free
- * Signature: (J)V
+ * Method: Description_hash
+ * Signature: (J)J
*/
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Description_1hash
(JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: PayeePubKey_eq
+ * Method: Description_eq
* Signature: (JJ)Z
*/
-JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_Description_1eq
(JNIEnv *, jclass, jlong, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: PayeePubKey_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1free
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: PayeePubKey_clone
/*
* Class: org_ldk_impl_bindings
- * Method: ExpiryTime_free
- * Signature: (J)V
+ * Method: PayeePubKey_hash
+ * Signature: (J)J
*/
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1hash
(JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: ExpiryTime_eq
+ * Method: PayeePubKey_eq
* Signature: (JJ)Z
*/
-JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PayeePubKey_1eq
(JNIEnv *, jclass, jlong, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: ExpiryTime_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1free
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: ExpiryTime_clone
/*
* Class: org_ldk_impl_bindings
- * Method: MinFinalCltvExpiry_free
- * Signature: (J)V
+ * Method: ExpiryTime_hash
+ * Signature: (J)J
*/
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1hash
(JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: MinFinalCltvExpiry_eq
+ * Method: ExpiryTime_eq
* Signature: (JJ)Z
*/
-JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ExpiryTime_1eq
(JNIEnv *, jclass, jlong, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: MinFinalCltvExpiry_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1free
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: MinFinalCltvExpiry_clone
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1clone
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: MinFinalCltvExpiry_hash
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1hash
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: MinFinalCltvExpiry_eq
+ * Signature: (JJ)Z
+ */
+JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_MinFinalCltvExpiry_1eq
+ (JNIEnv *, jclass, jlong, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: Fallback_free
JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Fallback_1script_1hash
(JNIEnv *, jclass, jbyteArray);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: Fallback_hash
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Fallback_1hash
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: Fallback_eq
JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1free
(JNIEnv *, jclass, jlong);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: InvoiceSignature_clone
+ * Signature: (J)J
+ */
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone
+ (JNIEnv *, jclass, jlong);
+
/*
* Class: org_ldk_impl_bindings
* Method: InvoiceSignature_eq
/*
* Class: org_ldk_impl_bindings
- * Method: InvoiceSignature_clone
+ * Method: PrivateRoute_free
+ * Signature: (J)V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free
+ (JNIEnv *, jclass, jlong);
+
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: PrivateRoute_clone
* Signature: (J)J
*/
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InvoiceSignature_1clone
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone
(JNIEnv *, jclass, jlong);
/*
* Class: org_ldk_impl_bindings
- * Method: PrivateRoute_free
- * Signature: (J)V
+ * Method: PrivateRoute_hash
+ * Signature: (J)J
*/
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1free
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1hash
(JNIEnv *, jclass, jlong);
/*
JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1eq
(JNIEnv *, jclass, jlong, jlong);
-/*
- * Class: org_ldk_impl_bindings
- * Method: PrivateRoute_clone
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PrivateRoute_1clone
- (JNIEnv *, jclass, jlong);
-
/*
* Class: org_ldk_impl_bindings
* Method: SignedRawInvoice_into_parts
JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_SemanticError_1multiple_1descriptions
(JNIEnv *, jclass);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: SemanticError_no_payment_secret
+ * Signature: ()Lorg/ldk/enums/SemanticError;
+ */
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_SemanticError_1no_1payment_1secret
+ (JNIEnv *, jclass);
+
/*
* Class: org_ldk_impl_bindings
* Method: SemanticError_multiple_payment_secrets
JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_SemanticError_1invalid_1signature
(JNIEnv *, jclass);
+/*
+ * Class: org_ldk_impl_bindings
+ * Method: SemanticError_imprecise_amount
+ * Signature: ()Lorg/ldk/enums/SemanticError;
+ */
+JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_SemanticError_1imprecise_1amount
+ (JNIEnv *, jclass);
+
/*
* Class: org_ldk_impl_bindings
* Method: SemanticError_eq
--- /dev/null
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class org_ldk_impl_bindings_LDKBalance */
+
+#ifndef _Included_org_ldk_impl_bindings_LDKBalance
+#define _Included_org_ldk_impl_bindings_LDKBalance
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class: org_ldk_impl_bindings_LDKBalance
+ * Method: init
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKBalance_init
+ (JNIEnv *, jclass);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class org_ldk_impl_bindings_LDKCOption_AccessZ */
+
+#ifndef _Included_org_ldk_impl_bindings_LDKCOption_AccessZ
+#define _Included_org_ldk_impl_bindings_LDKCOption_AccessZ
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class: org_ldk_impl_bindings_LDKCOption_AccessZ
+ * Method: init
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1AccessZ_init
+ (JNIEnv *, jclass);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class org_ldk_impl_bindings_LDKCOption_FilterZ */
+
+#ifndef _Included_org_ldk_impl_bindings_LDKCOption_FilterZ
+#define _Included_org_ldk_impl_bindings_LDKCOption_FilterZ
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class: org_ldk_impl_bindings_LDKCOption_FilterZ
+ * Method: init
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1FilterZ_init
+ (JNIEnv *, jclass);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class org_ldk_impl_bindings_LDKCOption_NetworkUpdateZ */
+
+#ifndef _Included_org_ldk_impl_bindings_LDKCOption_NetworkUpdateZ
+#define _Included_org_ldk_impl_bindings_LDKCOption_NetworkUpdateZ
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class: org_ldk_impl_bindings_LDKCOption_NetworkUpdateZ
+ * Method: init
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1NetworkUpdateZ_init
+ (JNIEnv *, jclass);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class org_ldk_impl_bindings_LDKCOption_TypeZ */
+
+#ifndef _Included_org_ldk_impl_bindings_LDKCOption_TypeZ
+#define _Included_org_ldk_impl_bindings_LDKCOption_TypeZ
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class: org_ldk_impl_bindings_LDKCOption_TypeZ
+ * Method: init
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKCOption_1TypeZ_init
+ (JNIEnv *, jclass);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
--- /dev/null
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class org_ldk_impl_bindings_LDKClosureReason */
+
+#ifndef _Included_org_ldk_impl_bindings_LDKClosureReason
+#define _Included_org_ldk_impl_bindings_LDKClosureReason
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class: org_ldk_impl_bindings_LDKClosureReason
+ * Method: init
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKClosureReason_init
+ (JNIEnv *, jclass);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
+++ /dev/null
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class org_ldk_impl_bindings_LDKHTLCFailChannelUpdate */
-
-#ifndef _Included_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate
-#define _Included_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*
- * Class: org_ldk_impl_bindings_LDKHTLCFailChannelUpdate
- * Method: init
- * Signature: ()V
- */
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init
- (JNIEnv *, jclass);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
--- /dev/null
+/* DO NOT EDIT THIS FILE - it is machine generated */
+#include <jni.h>
+/* Header for class org_ldk_impl_bindings_LDKNetworkUpdate */
+
+#ifndef _Included_org_ldk_impl_bindings_LDKNetworkUpdate
+#define _Included_org_ldk_impl_bindings_LDKNetworkUpdate
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ * Class: org_ldk_impl_bindings_LDKNetworkUpdate
+ * Method: init
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetworkUpdate_init
+ (JNIEnv *, jclass);
+
+#ifdef __cplusplus
+}
+#endif
+#endif
case 1: return LDKSemanticError_MultiplePaymentHashes;
case 2: return LDKSemanticError_NoDescription;
case 3: return LDKSemanticError_MultipleDescriptions;
- case 4: return LDKSemanticError_MultiplePaymentSecrets;
- case 5: return LDKSemanticError_InvalidFeatures;
- case 6: return LDKSemanticError_InvalidRecoveryId;
- case 7: return LDKSemanticError_InvalidSignature;
+ case 4: return LDKSemanticError_NoPaymentSecret;
+ case 5: return LDKSemanticError_MultiplePaymentSecrets;
+ case 6: return LDKSemanticError_InvalidFeatures;
+ case 7: return LDKSemanticError_InvalidRecoveryId;
+ case 8: return LDKSemanticError_InvalidSignature;
+ case 9: return LDKSemanticError_ImpreciseAmount;
}
abort();
}
case LDKSemanticError_MultiplePaymentHashes: return 1;
case LDKSemanticError_NoDescription: return 2;
case LDKSemanticError_MultipleDescriptions: return 3;
- case LDKSemanticError_MultiplePaymentSecrets: return 4;
- case LDKSemanticError_InvalidFeatures: return 5;
- case LDKSemanticError_InvalidRecoveryId: return 6;
- case LDKSemanticError_InvalidSignature: return 7;
+ case LDKSemanticError_NoPaymentSecret: return 4;
+ case LDKSemanticError_MultiplePaymentSecrets: return 5;
+ case LDKSemanticError_InvalidFeatures: return 6;
+ case LDKSemanticError_InvalidRecoveryId: return 7;
+ case LDKSemanticError_InvalidSignature: return 8;
+ case LDKSemanticError_ImpreciseAmount: return 9;
default: abort();
}
}
uint64_t err_ref = (uint64_t)err_var.inner & ~1;
return err_ref;
}
+jboolean __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_result_ok(uint32_t arg) {
+ return ((LDKCResult_TrustedClosingTransactionNoneZ*)arg)->result_ok;
+}
+uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_get_ok(uint32_t arg) {
+ LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
+ CHECK(val->result_ok);
+ LDKTrustedClosingTransaction res_var = (*val->contents.result);
+ CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t res_ref = (uint64_t)res_var.inner & ~1;
+ return res_ref;
+}
+void __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_get_err(uint32_t arg) {
+ LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
+ CHECK(!val->result_ok);
+ return *val->contents.err;
+}
jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
}
uint64_t htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
return 0 /* LDKMonitorEvent - HTLCEvent */; (void) htlc_event_ref;
}
- case LDKMonitorEvent_CommitmentTxBroadcasted: {
- LDKOutPoint commitment_tx_broadcasted_var = obj->commitment_tx_broadcasted;
- CHECK((((uint64_t)commitment_tx_broadcasted_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&commitment_tx_broadcasted_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t commitment_tx_broadcasted_ref = (uint64_t)commitment_tx_broadcasted_var.inner & ~1;
- return 0 /* LDKMonitorEvent - CommitmentTxBroadcasted */; (void) commitment_tx_broadcasted_ref;
+ case LDKMonitorEvent_CommitmentTxConfirmed: {
+ LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
+ CHECK((((uint64_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t commitment_tx_confirmed_ref = (uint64_t)commitment_tx_confirmed_var.inner & ~1;
+ return 0 /* LDKMonitorEvent - CommitmentTxConfirmed */; (void) commitment_tx_confirmed_ref;
}
default: abort();
}
default: abort();
}
}
+uint32_t __attribute__((visibility("default"))) TS_LDKNetworkUpdate_ref_from_ptr(uint32_t ptr) {
+ LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKNetworkUpdate_ChannelUpdateMessage: {
+ LDKChannelUpdate msg_var = obj->channel_update_message.msg;
+ CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
+ return 0 /* LDKNetworkUpdate - ChannelUpdateMessage */; (void) msg_ref;
+ }
+ case LDKNetworkUpdate_ChannelClosed: {
+ return 0 /* LDKNetworkUpdate - ChannelClosed */; (void) obj->channel_closed.short_channel_id; (void) obj->channel_closed.is_permanent;
+ }
+ case LDKNetworkUpdate_NodeFailure: {
+ int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(node_id_arr + 4), obj->node_failure.node_id.compressed_form, 33);
+ return 0 /* LDKNetworkUpdate - NodeFailure */; (void) node_id_arr; (void) obj->node_failure.is_permanent;
+ }
+ default: abort();
+ }
+}
+uint32_t __attribute__((visibility("default"))) TS_LDKCOption_NetworkUpdateZ_ref_from_ptr(uint32_t ptr) {
+ LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKCOption_NetworkUpdateZ_Some: {
+ uint64_t some_ref = ((uint64_t)&obj->some) | 1;
+ return 0 /* LDKCOption_NetworkUpdateZ - Some */; (void) some_ref;
+ }
+ case LDKCOption_NetworkUpdateZ_None: {
+ return 0 /* LDKCOption_NetworkUpdateZ - None */;
+ }
+ default: abort();
+ }
+}
uint32_t __attribute__((visibility("default"))) TS_LDKSpendableOutputDescriptor_ref_from_ptr(uint32_t ptr) {
LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
switch(obj->tag) {
default: abort();
}
}
-uint32_t __attribute__((visibility("default"))) TS_LDKHTLCFailChannelUpdate_ref_from_ptr(uint32_t ptr) {
- LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)(ptr & ~1);
- switch(obj->tag) {
- case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
- LDKChannelUpdate msg_var = obj->channel_update_message.msg;
- CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
- return 0 /* LDKHTLCFailChannelUpdate - ChannelUpdateMessage */; (void) msg_ref;
- }
- case LDKHTLCFailChannelUpdate_ChannelClosed: {
- return 0 /* LDKHTLCFailChannelUpdate - ChannelClosed */; (void) obj->channel_closed.short_channel_id; (void) obj->channel_closed.is_permanent;
- }
- case LDKHTLCFailChannelUpdate_NodeFailure: {
- int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
- memcpy((uint8_t*)(node_id_arr + 4), obj->node_failure.node_id.compressed_form, 33);
- return 0 /* LDKHTLCFailChannelUpdate - NodeFailure */; (void) node_id_arr; (void) obj->node_failure.is_permanent;
- }
- default: abort();
- }
-}
uint32_t __attribute__((visibility("default"))) TS_LDKMessageSendEvent_ref_from_ptr(uint32_t ptr) {
LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
switch(obj->tag) {
uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
return 0 /* LDKMessageSendEvent - HandleError */; (void) node_id_arr; (void) action_ref;
}
- case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
- uint64_t update_ref = ((uint64_t)&obj->payment_failure_network_update.update) | 1;
- return 0 /* LDKMessageSendEvent - PaymentFailureNetworkUpdate */; (void) update_ref;
- }
case LDKMessageSendEvent_SendChannelRangeQuery: {
int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_range_query.node_id.compressed_form, 33);
uint64_t err_ref = (uint64_t)err_var.inner & ~1;
return err_ref;
}
+jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_result_ok(uint32_t arg) {
+ return ((LDKCResult_NoneNoneZ*)arg)->result_ok;
+}
+void __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_get_ok(uint32_t arg) {
+ LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
+ CHECK(val->result_ok);
+ return *val->contents.result;
+}
+void __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_get_err(uint32_t arg) {
+ LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
+ CHECK(!val->result_ok);
+ return *val->contents.err;
+}
uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
LDKSignature a_ref;
atomic_size_t refcnt;
uint32_t get_per_commitment_point_meth;
uint32_t release_commitment_secret_meth;
+ uint32_t validate_holder_commitment_meth;
uint32_t channel_keys_id_meth;
uint32_t sign_counterparty_commitment_meth;
+ uint32_t validate_counterparty_revocation_meth;
uint32_t sign_holder_commitment_and_htlcs_meth;
uint32_t sign_justice_revoked_output_meth;
uint32_t sign_justice_revoked_htlc_meth;
if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
js_free(j_calls->get_per_commitment_point_meth);
js_free(j_calls->release_commitment_secret_meth);
+ js_free(j_calls->validate_holder_commitment_meth);
js_free(j_calls->channel_keys_id_meth);
js_free(j_calls->sign_counterparty_commitment_meth);
+ js_free(j_calls->validate_counterparty_revocation_meth);
js_free(j_calls->sign_holder_commitment_and_htlcs_meth);
js_free(j_calls->sign_justice_revoked_output_meth);
js_free(j_calls->sign_justice_revoked_htlc_meth);
memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
return ret_ref;
}
+LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx) {
+ LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
+ LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
+ holder_tx_var = HolderCommitmentTransaction_clone(holder_tx);
+ CHECK((((uint64_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t holder_tx_ref = (uint64_t)holder_tx_var.inner;
+ if (holder_tx_var.is_owned) {
+ holder_tx_ref |= 1;
+ }
+ uint32_t ret = js_invoke_function_1(j_calls->validate_holder_commitment_meth, holder_tx_ref);
+ LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1);
+ ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
+ return ret_conv;
+}
LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
int8_tArray ret = js_invoke_function_0(j_calls->channel_keys_id_meth);
ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
return ret_conv;
}
+LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
+ LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
+ int8_tArray secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(secret_arr + 4), *secret, 32);
+ uint32_t ret = js_invoke_function_2(j_calls->validate_counterparty_revocation_meth, idx, secret_arr);
+ LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1);
+ ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
+ return ret_conv;
+}
LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
return ret_conv;
}
-LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, LDKTransaction closing_tx) {
+LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
- LDKTransaction closing_tx_var = closing_tx;
- int8_tArray closing_tx_arr = init_arr(closing_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
- memcpy((uint8_t*)(closing_tx_arr + 4), closing_tx_var.data, closing_tx_var.datalen);
- Transaction_free(closing_tx_var);
- uint32_t ret = js_invoke_function_1(j_calls->sign_closing_transaction_meth, closing_tx_arr);
+ LDKClosingTransaction closing_tx_var = *closing_tx;
+ // Warning: we may need a move here but no clone is available for LDKClosingTransaction
+ CHECK((((uint64_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t closing_tx_ref = (uint64_t)closing_tx_var.inner;
+ if (closing_tx_var.is_owned) {
+ closing_tx_ref |= 1;
+ }
+ uint32_t ret = js_invoke_function_1(j_calls->sign_closing_transaction_meth, closing_tx_ref);
LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
return ret_conv;
.this_arg = (void*) calls,
.get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
.release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
+ .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
.channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
.sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
+ .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
.sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
.sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
.sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
return ret_arr;
}
+uint32_t __attribute__((visibility("default"))) TS_BaseSign_validate_holder_commitment(uint32_t this_arg, uint32_t holder_tx) {
+ LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
+ LDKHolderCommitmentTransaction holder_tx_conv;
+ holder_tx_conv.inner = (void*)(holder_tx & (~1));
+ holder_tx_conv.is_owned = false;
+ LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
+ *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv);
+ return (uint64_t)ret_conv;
+}
+
int8_tArray __attribute__((visibility("default"))) TS_BaseSign_channel_keys_id(uint32_t this_arg) {
LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
return (uint64_t)ret_conv;
}
+uint32_t __attribute__((visibility("default"))) TS_BaseSign_validate_counterparty_revocation(uint32_t this_arg, int64_t idx, int8_tArray secret) {
+ LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
+ unsigned char secret_arr[32];
+ CHECK(*((uint32_t*)secret) == 32);
+ memcpy(secret_arr, (uint8_t*)(secret + 4), 32);
+ unsigned char (*secret_ref)[32] = &secret_arr;
+ LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
+ *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
+ return (uint64_t)ret_conv;
+}
+
uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_holder_commitment_and_htlcs(uint32_t this_arg, uint32_t commitment_tx) {
LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
LDKHolderCommitmentTransaction commitment_tx_conv;
return (uint64_t)ret_conv;
}
-uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_closing_transaction(uint32_t this_arg, int8_tArray closing_tx) {
+uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_closing_transaction(uint32_t this_arg, uint32_t closing_tx) {
LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
- LDKTransaction closing_tx_ref;
- closing_tx_ref.datalen = *((uint32_t*)closing_tx);
- closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
- memcpy(closing_tx_ref.data, (uint8_t*)(closing_tx + 4), closing_tx_ref.datalen);
- closing_tx_ref.data_is_owned = true;
+ LDKClosingTransaction closing_tx_conv;
+ closing_tx_conv.inner = (void*)(closing_tx & (~1));
+ closing_tx_conv.is_owned = false;
LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
- *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
+ *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
return (uint64_t)ret_conv;
}
uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_ok(uint32_t arg) {
LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
CHECK(val->result_ok);
- LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
- *ret = Sign_clone(&(*val->contents.result));
- return (uint64_t)ret;
+ LDKSign* res_ret =MALLOC(sizeof(LDKSign), "LDKSign");
+ *res_ret = Sign_clone(&(*val->contents.result));
+ return (uint64_t)res_ret;
}
uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_err(uint32_t arg) {
LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_channel_signer(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
- LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
- *ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
- return (uint64_t)ret;
+ LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
+ *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
+ return (uint64_t)ret_ret;
}
int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
uint64_t err_ref = (uint64_t)err_var.inner & ~1;
return err_ref;
}
+typedef struct LDKType_JCalls {
+ atomic_size_t refcnt;
+ uint32_t type_id_meth;
+ uint32_t debug_str_meth;
+ uint32_t write_meth;
+} LDKType_JCalls;
+static void LDKType_JCalls_free(void* this_arg) {
+ LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
+ if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
+ js_free(j_calls->type_id_meth);
+ js_free(j_calls->debug_str_meth);
+ js_free(j_calls->write_meth);
+ FREE(j_calls);
+ }
+}
+uint16_t type_id_LDKType_jcall(const void* this_arg) {
+ LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
+ return js_invoke_function_0(j_calls->type_id_meth);
+}
+LDKStr debug_str_LDKType_jcall(const void* this_arg) {
+ LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
+ uint32_t ret = js_invoke_function_0(j_calls->debug_str_meth);
+ LDKStr ret_conv = str_ref_to_owned_c(ret);
+ return ret_conv;
+}
+LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
+ LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
+ int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
+ LDKCVec_u8Z ret_ref;
+ ret_ref.datalen = *((uint32_t*)ret);
+ ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
+ memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
+ return ret_ref;
+}
+static void LDKType_JCalls_cloned(LDKType* new_obj) {
+ LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
+ atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
+}
+static inline LDKType LDKType_init (/*TODO: JS Object Reference */void* o) {
+ LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
+ atomic_init(&calls->refcnt, 1);
+ //TODO: Assign calls->o from o
+
+ LDKType ret = {
+ .this_arg = (void*) calls,
+ .type_id = type_id_LDKType_jcall,
+ .debug_str = debug_str_LDKType_jcall,
+ .write = write_LDKType_jcall,
+ .cloned = LDKType_JCalls_cloned,
+ .free = LDKType_JCalls_free,
+ };
+ return ret;
+}
+long __attribute__((visibility("default"))) TS_LDKType_new(/*TODO: JS Object Reference */void* o) {
+ LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
+ *res_ptr = LDKType_init(o);
+ return (long)res_ptr;
+}
+int16_t __attribute__((visibility("default"))) TS_Type_type_id(uint32_t this_arg) {
+ LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
+ int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
+ return ret_val;
+}
+
+jstring __attribute__((visibility("default"))) TS_Type_debug_str(uint32_t this_arg) {
+ LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
+ LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
+ jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
+ Str_free(ret_str);
+ return ret_conv;
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_Type_write(uint32_t this_arg) {
+ LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
+ LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
+ int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_LDKCOption_TypeZ_ref_from_ptr(uint32_t ptr) {
+ LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKCOption_TypeZ_Some: {
+ LDKType* some_ret =MALLOC(sizeof(LDKType), "LDKType");
+ *some_ret = Type_clone(&obj->some);
+ return 0 /* LDKCOption_TypeZ - Some */; (void) (uint64_t)some_ret;
+ }
+ case LDKCOption_TypeZ_None: {
+ return 0 /* LDKCOption_TypeZ - None */;
+ }
+ default: abort();
+ }
+}
+jboolean __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_result_ok(uint32_t arg) {
+ return ((LDKCResult_COption_TypeZDecodeErrorZ*)arg)->result_ok;
+}
+uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_get_ok(uint32_t arg) {
+ LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
+ CHECK(val->result_ok);
+ uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
+ return res_ref;
+}
+uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_get_err(uint32_t arg) {
+ LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
+ CHECK(!val->result_ok);
+ LDKDecodeError err_var = (*val->contents.err);
+ CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t err_ref = (uint64_t)err_var.inner & ~1;
+ return err_ref;
+}
jboolean __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_result_ok(uint32_t arg) {
return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
}
default: abort();
}
}
+uint32_t __attribute__((visibility("default"))) TS_LDKClosureReason_ref_from_ptr(uint32_t ptr) {
+ LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKClosureReason_CounterpartyForceClosed: {
+ LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
+ jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
+ return 0 /* LDKClosureReason - CounterpartyForceClosed */; (void) peer_msg_conv;
+ }
+ case LDKClosureReason_HolderForceClosed: {
+ return 0 /* LDKClosureReason - HolderForceClosed */;
+ }
+ case LDKClosureReason_CooperativeClosure: {
+ return 0 /* LDKClosureReason - CooperativeClosure */;
+ }
+ case LDKClosureReason_CommitmentTxConfirmed: {
+ return 0 /* LDKClosureReason - CommitmentTxConfirmed */;
+ }
+ case LDKClosureReason_ProcessingError: {
+ LDKStr err_str = obj->processing_error.err;
+ jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
+ return 0 /* LDKClosureReason - ProcessingError */; (void) err_conv;
+ }
+ case LDKClosureReason_DisconnectedPeer: {
+ return 0 /* LDKClosureReason - DisconnectedPeer */;
+ }
+ case LDKClosureReason_OutdatedChannelManager: {
+ return 0 /* LDKClosureReason - OutdatedChannelManager */;
+ }
+ default: abort();
+ }
+}
uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_t ptr) {
LDKEvent *obj = (LDKEvent*)(ptr & ~1);
switch(obj->tag) {
memcpy((uint8_t*)(payment_preimage_arr + 4), obj->payment_sent.payment_preimage.data, 32);
return 0 /* LDKEvent - PaymentSent */; (void) payment_preimage_arr;
}
- case LDKEvent_PaymentFailed: {
+ case LDKEvent_PaymentPathFailed: {
int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
- memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_failed.payment_hash.data, 32);
- return 0 /* LDKEvent - PaymentFailed */; (void) payment_hash_arr; (void) obj->payment_failed.rejected_by_dest;
+ memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_path_failed.payment_hash.data, 32);
+ uint64_t network_update_ref = ((uint64_t)&obj->payment_path_failed.network_update) | 1;
+ LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
+ uint32_tArray path_arr = init_arr(path_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
+ uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4);
+ for (size_t k = 0; k < path_var.datalen; k++) {
+ LDKRouteHop path_conv_10_var = path_var.data[k];
+ CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
+ path_arr_ptr[k] = path_conv_10_ref;
+ }
+ return 0 /* LDKEvent - PaymentPathFailed */; (void) payment_hash_arr; (void) obj->payment_path_failed.rejected_by_dest; (void) network_update_ref; (void) obj->payment_path_failed.all_paths_failed; (void) path_arr;
}
case LDKEvent_PendingHTLCsForwardable: {
return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable;
uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
return 0 /* LDKEvent - PaymentForwarded */; (void) fee_earned_msat_ref; (void) obj->payment_forwarded.claim_from_onchain_tx;
}
+ case LDKEvent_ChannelClosed: {
+ int8_tArray channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(channel_id_arr + 4), obj->channel_closed.channel_id.data, 32);
+ uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1;
+ return 0 /* LDKEvent - ChannelClosed */; (void) channel_id_arr; (void) reason_ref;
+ }
default: abort();
}
}
}
return ret;
}
+uint32_t __attribute__((visibility("default"))) TS_LDKBalance_ref_from_ptr(uint32_t ptr) {
+ LDKBalance *obj = (LDKBalance*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKBalance_ClaimableOnChannelClose: {
+ return 0 /* LDKBalance - ClaimableOnChannelClose */; (void) obj->claimable_on_channel_close.claimable_amount_satoshis;
+ }
+ case LDKBalance_ClaimableAwaitingConfirmations: {
+ return 0 /* LDKBalance - ClaimableAwaitingConfirmations */; (void) obj->claimable_awaiting_confirmations.claimable_amount_satoshis; (void) obj->claimable_awaiting_confirmations.confirmation_height;
+ }
+ case LDKBalance_ContentiousClaimable: {
+ return 0 /* LDKBalance - ContentiousClaimable */; (void) obj->contentious_claimable.claimable_amount_satoshis; (void) obj->contentious_claimable.timeout_height;
+ }
+ case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
+ return 0 /* LDKBalance - MaybeClaimableHTLCAwaitingTimeout */; (void) obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis; (void) obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
+ }
+ default: abort();
+ }
+}
+uint32_t __attribute__((visibility("default"))) TS_LDKCVec_BalanceZ_new(uint32_tArray elems) {
+ LDKCVec_BalanceZ *ret = MALLOC(sizeof(LDKCVec_BalanceZ), "LDKCVec_BalanceZ");
+ ret->datalen = *((uint32_t*)elems);
+ if (ret->datalen == 0) {
+ ret->data = NULL;
+ } else {
+ ret->data = MALLOC(sizeof(LDKBalance) * ret->datalen, "LDKCVec_BalanceZ Data");
+ uint32_t *java_elems = (uint32_t*)(elems + 4);
+ for (size_t i = 0; i < ret->datalen; i++) {
+ uint32_t arr_elem = java_elems[i];
+ LDKBalance arr_elem_conv = *(LDKBalance*)(((uint64_t)arr_elem) & ~1);
+ arr_elem_conv = Balance_clone((LDKBalance*)(((uint64_t)arr_elem) & ~1));
+ ret->data[i] = arr_elem_conv;
+ }
+ }
+ return (uint64_t)ret;
+}
+static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
+ LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
+ for (size_t i = 0; i < ret.datalen; i++) {
+ ret.data[i] = Balance_clone(&orig->data[i]);
+ }
+ return ret;
+}
jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_result_ok(uint32_t arg) {
return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
}
uint64_t err_ref = (uint64_t)err_var.inner & ~1;
return err_ref;
}
+jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_result_ok(uint32_t arg) {
+ return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
+}
+void __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_ok(uint32_t arg) {
+ LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
+ CHECK(val->result_ok);
+ return *val->contents.result;
+}
+uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_err(uint32_t arg) {
+ LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
+ CHECK(!val->result_ok);
+ LDKLightningError err_var = (*val->contents.err);
+ CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t err_ref = (uint64_t)err_var.inner & ~1;
+ return err_ref;
+}
+uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint32_t b) {
+ LDKC2Tuple_PublicKeyTypeZ* ret = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
+ LDKPublicKey a_ref;
+ CHECK(*((uint32_t*)a) == 33);
+ memcpy(a_ref.compressed_form, (uint8_t*)(a + 4), 33);
+ ret->a = a_ref;
+ LDKType b_conv = *(LDKType*)(((uint64_t)b) & ~1);
+ b_conv = Type_clone(&b_conv);
+ ret->b = b_conv;
+ return (uint64_t)ret;
+}
+int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_PublicKeyTypeZ_get_a(uint32_t ptr) {
+ LDKC2Tuple_PublicKeyTypeZ *tuple = (LDKC2Tuple_PublicKeyTypeZ*)(ptr & ~1);
+ int8_tArray a_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(a_arr + 4), tuple->a.compressed_form, 33);
+ return a_arr;
+}
+uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_PublicKeyTypeZ_get_b(uint32_t ptr) {
+ LDKC2Tuple_PublicKeyTypeZ *tuple = (LDKC2Tuple_PublicKeyTypeZ*)(ptr & ~1);
+ LDKType* b_ret =MALLOC(sizeof(LDKType), "LDKType");
+ *b_ret = Type_clone(&tuple->b);
+ return (uint64_t)b_ret;
+}
+uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_PublicKeyTypeZZ_new(uint32_tArray elems) {
+ LDKCVec_C2Tuple_PublicKeyTypeZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_PublicKeyTypeZZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ");
+ ret->datalen = *((uint32_t*)elems);
+ if (ret->datalen == 0) {
+ ret->data = NULL;
+ } else {
+ ret->data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * ret->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ Data");
+ uint32_t *java_elems = (uint32_t*)(elems + 4);
+ for (size_t i = 0; i < ret->datalen; i++) {
+ uint32_t arr_elem = java_elems[i];
+ LDKC2Tuple_PublicKeyTypeZ arr_elem_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1);
+ arr_elem_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1));
+ ret->data[i] = arr_elem_conv;
+ }
+ }
+ return (uint64_t)ret;
+}
+static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
+ LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
+ for (size_t i = 0; i < ret.datalen; i++) {
+ ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
+ }
+ return ret;
+}
jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_result_ok(uint32_t arg) {
return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
}
}
return ret;
}
-jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_result_ok(uint32_t arg) {
- return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
-}
-void __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_ok(uint32_t arg) {
- LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
- CHECK(val->result_ok);
- return *val->contents.result;
-}
-uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_err(uint32_t arg) {
- LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
- CHECK(!val->result_ok);
- LDKLightningError err_var = (*val->contents.err);
- CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t err_ref = (uint64_t)err_var.inner & ~1;
- return err_ref;
-}
jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_result_ok(uint32_t arg) {
return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
}
uint64_t err_ref = (uint64_t)err_var.inner & ~1;
return err_ref;
}
-jboolean __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
- return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
+typedef struct LDKAccess_JCalls {
+ atomic_size_t refcnt;
+ uint32_t get_utxo_meth;
+} LDKAccess_JCalls;
+static void LDKAccess_JCalls_free(void* this_arg) {
+ LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
+ if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
+ js_free(j_calls->get_utxo_meth);
+ FREE(j_calls);
+ }
}
-uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
- LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
- CHECK(val->result_ok);
- LDKDirectionalChannelInfo res_var = (*val->contents.result);
- CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t res_ref = (uint64_t)res_var.inner & ~1;
- return res_ref;
+LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
+ LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
+ int8_tArray genesis_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(genesis_hash_arr + 4), *genesis_hash, 32);
+ uint32_t ret = js_invoke_function_2(j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
+ LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
+ ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
+ return ret_conv;
}
-uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
- LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
- CHECK(!val->result_ok);
- LDKDecodeError err_var = (*val->contents.err);
- CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
+ LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
+ atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
+}
+static inline LDKAccess LDKAccess_init (/*TODO: JS Object Reference */void* o) {
+ LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
+ atomic_init(&calls->refcnt, 1);
+ //TODO: Assign calls->o from o
+
+ LDKAccess ret = {
+ .this_arg = (void*) calls,
+ .get_utxo = get_utxo_LDKAccess_jcall,
+ .free = LDKAccess_JCalls_free,
+ };
+ return ret;
+}
+long __attribute__((visibility("default"))) TS_LDKAccess_new(/*TODO: JS Object Reference */void* o) {
+ LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
+ *res_ptr = LDKAccess_init(o);
+ return (long)res_ptr;
+}
+uint32_t __attribute__((visibility("default"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
+ LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
+ unsigned char genesis_hash_arr[32];
+ CHECK(*((uint32_t*)genesis_hash) == 32);
+ memcpy(genesis_hash_arr, (uint8_t*)(genesis_hash + 4), 32);
+ unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
+ LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
+ *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
+ return (uint64_t)ret_conv;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_LDKCOption_AccessZ_ref_from_ptr(uint32_t ptr) {
+ LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKCOption_AccessZ_Some: {
+ LDKAccess* some_ret =MALLOC(sizeof(LDKAccess), "LDKAccess");
+ *some_ret = obj->some;
+ // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
+ return 0 /* LDKCOption_AccessZ - Some */; (void) (uint64_t)some_ret;
+ }
+ case LDKCOption_AccessZ_None: {
+ return 0 /* LDKCOption_AccessZ - None */;
+ }
+ default: abort();
+ }
+}
+jboolean __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
+ return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
+}
+uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
+ LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
+ CHECK(val->result_ok);
+ LDKDirectionalChannelInfo res_var = (*val->contents.result);
+ CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t res_ref = (uint64_t)res_var.inner & ~1;
+ return res_ref;
+}
+uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
+ LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
+ CHECK(!val->result_ok);
+ LDKDecodeError err_var = (*val->contents.err);
+ CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t err_ref = (uint64_t)err_var.inner & ~1;
return err_ref;
}
uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
return err_ref;
}
+typedef struct LDKFilter_JCalls {
+ atomic_size_t refcnt;
+ uint32_t register_tx_meth;
+ uint32_t register_output_meth;
+} LDKFilter_JCalls;
+static void LDKFilter_JCalls_free(void* this_arg) {
+ LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
+ if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
+ js_free(j_calls->register_tx_meth);
+ js_free(j_calls->register_output_meth);
+ FREE(j_calls);
+ }
+}
+void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
+ LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
+ int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
+ LDKu8slice script_pubkey_var = script_pubkey;
+ int8_tArray script_pubkey_arr = init_arr(script_pubkey_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen);
+ js_invoke_function_2(j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
+}
+LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
+ LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
+ LDKWatchedOutput output_var = output;
+ CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t output_ref = (uint64_t)output_var.inner;
+ if (output_var.is_owned) {
+ output_ref |= 1;
+ }
+ uint32_t ret = js_invoke_function_1(j_calls->register_output_meth, output_ref);
+ LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
+ ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
+ return ret_conv;
+}
+static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
+ LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
+ atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
+}
+static inline LDKFilter LDKFilter_init (/*TODO: JS Object Reference */void* o) {
+ LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
+ atomic_init(&calls->refcnt, 1);
+ //TODO: Assign calls->o from o
+
+ LDKFilter ret = {
+ .this_arg = (void*) calls,
+ .register_tx = register_tx_LDKFilter_jcall,
+ .register_output = register_output_LDKFilter_jcall,
+ .free = LDKFilter_JCalls_free,
+ };
+ return ret;
+}
+long __attribute__((visibility("default"))) TS_LDKFilter_new(/*TODO: JS Object Reference */void* o) {
+ LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
+ *res_ptr = LDKFilter_init(o);
+ return (long)res_ptr;
+}
+void __attribute__((visibility("default"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
+ LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
+ unsigned char txid_arr[32];
+ CHECK(*((uint32_t*)txid) == 32);
+ memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
+ unsigned char (*txid_ref)[32] = &txid_arr;
+ LDKu8slice script_pubkey_ref;
+ script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
+ script_pubkey_ref.data = (int8_t*)(script_pubkey + 4);
+ (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
+ LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
+ LDKWatchedOutput output_conv;
+ output_conv.inner = (void*)(output & (~1));
+ output_conv.is_owned = (output & 1) || (output == 0);
+ output_conv = WatchedOutput_clone(&output_conv);
+ LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
+ *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_LDKCOption_FilterZ_ref_from_ptr(uint32_t ptr) {
+ LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKCOption_FilterZ_Some: {
+ LDKFilter* some_ret =MALLOC(sizeof(LDKFilter), "LDKFilter");
+ *some_ret = obj->some;
+ // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
+ return 0 /* LDKCOption_FilterZ - Some */; (void) (uint64_t)some_ret;
+ }
+ case LDKCOption_FilterZ_None: {
+ return 0 /* LDKCOption_FilterZ - None */;
+ }
+ default: abort();
+ }
+}
typedef struct LDKMessageSendEventsProvider_JCalls {
atomic_size_t refcnt;
uint32_t get_and_clear_pending_msg_events_meth;
FREE(j_calls);
}
}
-void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
+void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
- LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
- *event_copy = event;
- uint64_t event_ref = (uint64_t)event_copy;
- js_invoke_function_1(j_calls->handle_event_meth, event_ref);
+ LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
+ *ret_event = Event_clone(event);
+ js_invoke_function_1(j_calls->handle_event_meth, (uint64_t)ret_event);
}
static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
}
void __attribute__((visibility("default"))) TS_EventHandler_handle_event(uint32_t this_arg, uint32_t event) {
LDKEventHandler* this_arg_conv = (LDKEventHandler*)(((uint64_t)this_arg) & ~1);
- LDKEvent event_conv = *(LDKEvent*)(((uint64_t)event) & ~1);
+ LDKEvent* event_conv = (LDKEvent*)event;
(this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
}
}
void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
- LDKEventHandler* ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
- *ret = handler;
- js_invoke_function_1(j_calls->process_pending_events_meth, (uint64_t)ret);
+ LDKEventHandler* handler_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
+ *handler_ret = handler;
+ js_invoke_function_1(j_calls->process_pending_events_meth, (uint64_t)handler_ret);
}
static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
(this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
}
-typedef struct LDKAccess_JCalls {
- atomic_size_t refcnt;
- uint32_t get_utxo_meth;
-} LDKAccess_JCalls;
-static void LDKAccess_JCalls_free(void* this_arg) {
- LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
- if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
- js_free(j_calls->get_utxo_meth);
- FREE(j_calls);
- }
-}
-LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
- LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
- int8_tArray genesis_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
- memcpy((uint8_t*)(genesis_hash_arr + 4), *genesis_hash, 32);
- uint32_t ret = js_invoke_function_2(j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
- LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
- ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
- return ret_conv;
-}
-static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
- LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
- atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
-}
-static inline LDKAccess LDKAccess_init (/*TODO: JS Object Reference */void* o) {
- LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
- atomic_init(&calls->refcnt, 1);
- //TODO: Assign calls->o from o
-
- LDKAccess ret = {
- .this_arg = (void*) calls,
- .get_utxo = get_utxo_LDKAccess_jcall,
- .free = LDKAccess_JCalls_free,
- };
- return ret;
-}
-long __attribute__((visibility("default"))) TS_LDKAccess_new(/*TODO: JS Object Reference */void* o) {
- LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
- *res_ptr = LDKAccess_init(o);
- return (long)res_ptr;
-}
-uint32_t __attribute__((visibility("default"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
- LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
- unsigned char genesis_hash_arr[32];
- CHECK(*((uint32_t*)genesis_hash) == 32);
- memcpy(genesis_hash_arr, (uint8_t*)(genesis_hash + 4), 32);
- unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
- LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
- *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
- return (uint64_t)ret_conv;
-}
-
typedef struct LDKListen_JCalls {
atomic_size_t refcnt;
uint32_t block_connected_meth;
return ret_arr;
}
-typedef struct LDKFilter_JCalls {
+typedef struct LDKPersist_JCalls {
atomic_size_t refcnt;
- uint32_t register_tx_meth;
- uint32_t register_output_meth;
-} LDKFilter_JCalls;
-static void LDKFilter_JCalls_free(void* this_arg) {
- LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
+ uint32_t persist_new_channel_meth;
+ uint32_t update_persisted_channel_meth;
+} LDKPersist_JCalls;
+static void LDKPersist_JCalls_free(void* this_arg) {
+ LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
- js_free(j_calls->register_tx_meth);
- js_free(j_calls->register_output_meth);
+ js_free(j_calls->persist_new_channel_meth);
+ js_free(j_calls->update_persisted_channel_meth);
FREE(j_calls);
}
}
-void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
- LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
- int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
- memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
- LDKu8slice script_pubkey_var = script_pubkey;
- int8_tArray script_pubkey_arr = init_arr(script_pubkey_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
- memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen);
- js_invoke_function_2(j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
-}
-LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
- LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
- LDKWatchedOutput output_var = output;
- CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t output_ref = (uint64_t)output_var.inner;
- if (output_var.is_owned) {
- output_ref |= 1;
+LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
+ LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
+ LDKOutPoint id_var = id;
+ CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t id_ref = (uint64_t)id_var.inner;
+ if (id_var.is_owned) {
+ id_ref |= 1;
}
- uint32_t ret = js_invoke_function_1(j_calls->register_output_meth, output_ref);
- LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
- ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
- return ret_conv;
-}
-static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
- LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
- atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
-}
-static inline LDKFilter LDKFilter_init (/*TODO: JS Object Reference */void* o) {
- LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
- atomic_init(&calls->refcnt, 1);
- //TODO: Assign calls->o from o
-
- LDKFilter ret = {
- .this_arg = (void*) calls,
- .register_tx = register_tx_LDKFilter_jcall,
- .register_output = register_output_LDKFilter_jcall,
- .free = LDKFilter_JCalls_free,
- };
- return ret;
-}
-long __attribute__((visibility("default"))) TS_LDKFilter_new(/*TODO: JS Object Reference */void* o) {
- LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
- *res_ptr = LDKFilter_init(o);
- return (long)res_ptr;
-}
-void __attribute__((visibility("default"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
- LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
- unsigned char txid_arr[32];
- CHECK(*((uint32_t*)txid) == 32);
- memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
- unsigned char (*txid_ref)[32] = &txid_arr;
- LDKu8slice script_pubkey_ref;
- script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
- script_pubkey_ref.data = (int8_t*)(script_pubkey + 4);
- (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
-}
-
-uint32_t __attribute__((visibility("default"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
- LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
- LDKWatchedOutput output_conv;
- output_conv.inner = (void*)(output & (~1));
- output_conv.is_owned = (output & 1) || (output == 0);
- output_conv = WatchedOutput_clone(&output_conv);
- LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
- *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
- uint64_t ret_ref = (uint64_t)ret_copy;
- return ret_ref;
-}
-
-typedef struct LDKPersist_JCalls {
- atomic_size_t refcnt;
- uint32_t persist_new_channel_meth;
- uint32_t update_persisted_channel_meth;
-} LDKPersist_JCalls;
-static void LDKPersist_JCalls_free(void* this_arg) {
- LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
- if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
- js_free(j_calls->persist_new_channel_meth);
- js_free(j_calls->update_persisted_channel_meth);
- FREE(j_calls);
- }
-}
-LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
- LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
- LDKOutPoint id_var = id;
- CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t id_ref = (uint64_t)id_var.inner;
- if (id_var.is_owned) {
- id_ref |= 1;
- }
- LDKChannelMonitor data_var = *data;
- data_var = ChannelMonitor_clone(data);
- CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t data_ref = (uint64_t)data_var.inner;
- if (data_var.is_owned) {
- data_ref |= 1;
- }
- uint32_t ret = js_invoke_function_2(j_calls->persist_new_channel_meth, id_ref, data_ref);
- LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
- ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
+ LDKChannelMonitor data_var = *data;
+ data_var = ChannelMonitor_clone(data);
+ CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t data_ref = (uint64_t)data_var.inner;
+ if (data_var.is_owned) {
+ data_ref |= 1;
+ }
+ uint32_t ret = js_invoke_function_2(j_calls->persist_new_channel_meth, id_ref, data_ref);
+ LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
+ ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
return ret_conv;
}
LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
uint32_t handle_node_announcement_meth;
uint32_t handle_channel_announcement_meth;
uint32_t handle_channel_update_meth;
- uint32_t handle_htlc_fail_channel_update_meth;
uint32_t get_next_channel_announcements_meth;
uint32_t get_next_node_announcements_meth;
uint32_t sync_routing_table_meth;
js_free(j_calls->handle_node_announcement_meth);
js_free(j_calls->handle_channel_announcement_meth);
js_free(j_calls->handle_channel_update_meth);
- js_free(j_calls->handle_htlc_fail_channel_update_meth);
js_free(j_calls->get_next_channel_announcements_meth);
js_free(j_calls->get_next_node_announcements_meth);
js_free(j_calls->sync_routing_table_meth);
ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
return ret_conv;
}
-void handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
- LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
- uint64_t ret_update = (uint64_t)update;
- js_invoke_function_1(j_calls->handle_htlc_fail_channel_update_meth, ret_update);
-}
LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
uint32_tArray ret = js_invoke_function_2(j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
.handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
.handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
.handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
- .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall,
.get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
.get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
.sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
return (uint64_t)ret_conv;
}
-void __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_htlc_fail_channel_update(uint32_t this_arg, uint32_t update) {
- LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
- LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
- (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
-}
-
uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_channel_announcements(uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
return (uint64_t)ret_conv;
}
+typedef struct LDKCustomMessageReader_JCalls {
+ atomic_size_t refcnt;
+ uint32_t read_meth;
+} LDKCustomMessageReader_JCalls;
+static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
+ LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
+ if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
+ js_free(j_calls->read_meth);
+ FREE(j_calls);
+ }
+}
+LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
+ LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
+ LDKu8slice buffer_var = buffer;
+ int8_tArray buffer_arr = init_arr(buffer_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(buffer_arr + 4), buffer_var.data, buffer_var.datalen);
+ uint32_t ret = js_invoke_function_2(j_calls->read_meth, message_type, buffer_arr);
+ LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1);
+ ret_conv = CResult_COption_TypeZDecodeErrorZ_clone((LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1));
+ return ret_conv;
+}
+static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
+ LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
+ atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
+}
+static inline LDKCustomMessageReader LDKCustomMessageReader_init (/*TODO: JS Object Reference */void* o) {
+ LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
+ atomic_init(&calls->refcnt, 1);
+ //TODO: Assign calls->o from o
+
+ LDKCustomMessageReader ret = {
+ .this_arg = (void*) calls,
+ .read = read_LDKCustomMessageReader_jcall,
+ .free = LDKCustomMessageReader_JCalls_free,
+ };
+ return ret;
+}
+long __attribute__((visibility("default"))) TS_LDKCustomMessageReader_new(/*TODO: JS Object Reference */void* o) {
+ LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
+ *res_ptr = LDKCustomMessageReader_init(o);
+ return (long)res_ptr;
+}
+uint32_t __attribute__((visibility("default"))) TS_CustomMessageReader_read(uint32_t this_arg, int16_t message_type, int8_tArray buffer) {
+ LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)(((uint64_t)this_arg) & ~1);
+ LDKu8slice buffer_ref;
+ buffer_ref.datalen = *((uint32_t*)buffer);
+ buffer_ref.data = (int8_t*)(buffer + 4);
+ LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
+ *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
+ return (uint64_t)ret_conv;
+}
+
+typedef struct LDKCustomMessageHandler_JCalls {
+ atomic_size_t refcnt;
+ LDKCustomMessageReader_JCalls* CustomMessageReader;
+ uint32_t handle_custom_message_meth;
+ uint32_t get_and_clear_pending_msg_meth;
+} LDKCustomMessageHandler_JCalls;
+static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
+ LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
+ if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
+ js_free(j_calls->handle_custom_message_meth);
+ js_free(j_calls->get_and_clear_pending_msg_meth);
+ FREE(j_calls);
+ }
+}
+LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
+ LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
+ LDKType* msg_ret =MALLOC(sizeof(LDKType), "LDKType");
+ *msg_ret = msg;
+ int8_tArray sender_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(sender_node_id_arr + 4), sender_node_id.compressed_form, 33);
+ uint32_t ret = js_invoke_function_2(j_calls->handle_custom_message_meth, (uint64_t)msg_ret, sender_node_id_arr);
+ LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
+ ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
+ return ret_conv;
+}
+LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
+ LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
+ uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_meth);
+ LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
+ ret_constr.datalen = *((uint32_t*)ret);
+ if (ret_constr.datalen > 0)
+ ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
+ else
+ ret_constr.data = NULL;
+ uint32_t* ret_vals = (uint32_t*)(ret + 4);
+ for (size_t c = 0; c < ret_constr.datalen; c++) {
+ uint32_t ret_conv_28 = ret_vals[c];
+ LDKC2Tuple_PublicKeyTypeZ ret_conv_28_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_28) & ~1);
+ ret_conv_28_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_28) & ~1));
+ ret_constr.data[c] = ret_conv_28_conv;
+ }
+ return ret_constr;
+}
+static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
+ LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
+ atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
+ atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
+}
+static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* CustomMessageReader) {
+ LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
+ atomic_init(&calls->refcnt, 1);
+ //TODO: Assign calls->o from o
+
+ LDKCustomMessageHandler ret = {
+ .this_arg = (void*) calls,
+ .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
+ .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
+ .free = LDKCustomMessageHandler_JCalls_free,
+ .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
+ };
+ calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
+ return ret;
+}
+long __attribute__((visibility("default"))) TS_LDKCustomMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* CustomMessageReader) {
+ LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
+ *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
+ return (long)res_ptr;
+}
+uint32_t __attribute__((visibility("default"))) TS_CustomMessageHandler_handle_custom_message(uint32_t this_arg, uint32_t msg, int8_tArray sender_node_id) {
+ LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)(((uint64_t)this_arg) & ~1);
+ LDKType msg_conv = *(LDKType*)(((uint64_t)msg) & ~1);
+ LDKPublicKey sender_node_id_ref;
+ CHECK(*((uint32_t*)sender_node_id) == 33);
+ memcpy(sender_node_id_ref.compressed_form, (uint8_t*)(sender_node_id + 4), 33);
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
+ return (uint64_t)ret_conv;
+}
+
+uint32_tArray __attribute__((visibility("default"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint32_t this_arg) {
+ LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)(((uint64_t)this_arg) & ~1);
+ LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
+ uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
+ uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
+ for (size_t c = 0; c < ret_var.datalen; c++) {
+ LDKC2Tuple_PublicKeyTypeZ* ret_conv_28_ref = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
+ *ret_conv_28_ref = ret_var.data[c];
+ ret_arr_ptr[c] = (uint64_t)ret_conv_28_ref;
+ }
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
typedef struct LDKSocketDescriptor_JCalls {
atomic_size_t refcnt;
uint32_t send_data_meth;
return (uint64_t)ret_conv;
}
+uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint32_t o) {
+ LDKTrustedClosingTransaction o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = (o & 1) || (o == 0);
+ // Warning: we need a move here but no clone is available for LDKTrustedClosingTransaction
+ LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
+ *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
+ return (uint64_t)ret_conv;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
+ LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
+ *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
+ return (uint64_t)ret_conv;
+}
+
+void __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint32_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
+}
+
uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
LDKCommitmentTransaction o_conv;
o_conv.inner = (void*)(o & (~1));
uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
+ o_conv = TxOut_clone((LDKTxOut*)(((uint64_t)o) & ~1));
LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
*ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
return (uint64_t)ret_conv;
uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint32_t o) {
LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1);
+ o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1));
LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
*ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
uint64_t ret_ref = (uint64_t)ret_copy;
return ret_ref;
}
+uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_some(uint32_t o) {
+ LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(((uint64_t)o) & ~1);
+ o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uint64_t)o) & ~1));
+ LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
+ *ret_copy = COption_NetworkUpdateZ_some(o_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_none() {
+ LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
+ *ret_copy = COption_NetworkUpdateZ_none();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_free(uint32_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ COption_NetworkUpdateZ_free(_res_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_clone(uint32_t orig) {
+ LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
+ LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
+ *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
void __attribute__((visibility("default"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
LDKCVec_SpendableOutputDescriptorZ _res_constr;
_res_constr.datalen = *((uint32_t*)_res);
uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
+ o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1));
LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
*ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
return (uint64_t)ret_conv;
return (uint64_t)ret_conv;
}
+uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_ok() {
+ LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
+ *ret_conv = CResult_NoneNoneZ_ok();
+ return (uint64_t)ret_conv;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_err() {
+ LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
+ *ret_conv = CResult_NoneNoneZ_err();
+ return (uint64_t)ret_conv;
+}
+
+void __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_free(uint32_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ CResult_NoneNoneZ_free(_res_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_clone(uint32_t orig) {
+ LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
+ LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
+ *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
+ return (uint64_t)ret_conv;
+}
+
uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
+ o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1));
LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
*ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
return (uint64_t)ret_conv;
uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
+ e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
*ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
return (uint64_t)ret_conv;
uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
+ e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
*ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
return (uint64_t)ret_conv;
uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_err(uint32_t e) {
LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
+ e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
*ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
return (uint64_t)ret_conv;
uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint32_t e) {
LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
+ e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
*ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
return (uint64_t)ret_conv;
uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
+ // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
*ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
return (uint64_t)ret_conv;
return (uint64_t)ret_conv;
}
+uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_some(uint32_t o) {
+ LDKType o_conv = *(LDKType*)(((uint64_t)o) & ~1);
+ LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
+ *ret_copy = COption_TypeZ_some(o_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_none() {
+ LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
+ *ret_copy = COption_TypeZ_none();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_COption_TypeZ_free(uint32_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ COption_TypeZ_free(_res_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_clone(uint32_t orig) {
+ LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
+ LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
+ *ret_copy = COption_TypeZ_clone(orig_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint32_t o) {
+ LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(((uint64_t)o) & ~1);
+ o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uint64_t)o) & ~1));
+ LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
+ *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
+ return (uint64_t)ret_conv;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint32_t e) {
+ LDKDecodeError e_conv;
+ e_conv.inner = (void*)(e & (~1));
+ e_conv.is_owned = (e & 1) || (e == 0);
+ e_conv = DecodeError_clone(&e_conv);
+ LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
+ *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
+ return (uint64_t)ret_conv;
+}
+
+void __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint32_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint32_t orig) {
+ LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
+ LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
+ *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
+ return (uint64_t)ret_conv;
+}
+
uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_ok(uint32_t o) {
LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
+ b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
*ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
return (uint64_t)ret_ref;
CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
}
+void __attribute__((visibility("default"))) TS_CVec_BalanceZ_free(uint32_tArray _res) {
+ LDKCVec_BalanceZ _res_constr;
+ _res_constr.datalen = *((uint32_t*)_res);
+ if (_res_constr.datalen > 0)
+ _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
+ else
+ _res_constr.data = NULL;
+ uint32_t* _res_vals = (uint32_t*)(_res + 4);
+ for (size_t j = 0; j < _res_constr.datalen; j++) {
+ uint32_t _res_conv_9 = _res_vals[j];
+ LDKBalance _res_conv_9_conv = *(LDKBalance*)(((uint64_t)_res_conv_9) & ~1);
+ FREE((void*)_res_conv_9);
+ _res_constr.data[j] = _res_conv_9_conv;
+ }
+ CVec_BalanceZ_free(_res_constr);
+}
+
uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
+ // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
*ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
return (uint64_t)ret_conv;
CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
}
-uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
- LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
- *ret_conv = CResult_boolLightningErrorZ_ok(o);
+uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_ok() {
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = CResult_NoneLightningErrorZ_ok();
return (uint64_t)ret_conv;
}
-uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
+uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
LDKLightningError e_conv;
e_conv.inner = (void*)(e & (~1));
e_conv.is_owned = (e & 1) || (e == 0);
e_conv = LightningError_clone(&e_conv);
- LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
- *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
return (uint64_t)ret_conv;
}
-void __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
+void __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
if ((_res & 1) != 0) return;
- LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
+ LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
FREE((void*)_res);
- CResult_boolLightningErrorZ_free(_res_conv);
+ CResult_NoneLightningErrorZ_free(_res_conv);
}
-uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
- LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
- LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
- *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
+uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
+ LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
return (uint64_t)ret_conv;
}
-uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
- LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
- LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
- *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
+uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint32_t orig) {
+ LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
+ LDKC2Tuple_PublicKeyTypeZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
+ *ret_ref = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
return (uint64_t)ret_ref;
}
-uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
+uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint32_t b) {
+ LDKPublicKey a_ref;
+ CHECK(*((uint32_t*)a) == 33);
+ memcpy(a_ref.compressed_form, (uint8_t*)(a + 4), 33);
+ LDKType b_conv = *(LDKType*)(((uint64_t)b) & ~1);
+ LDKC2Tuple_PublicKeyTypeZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
+ *ret_ref = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
+ return (uint64_t)ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_free(uint32_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ C2Tuple_PublicKeyTypeZ_free(_res_conv);
+}
+
+void __attribute__((visibility("default"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint32_tArray _res) {
+ LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
+ _res_constr.datalen = *((uint32_t*)_res);
+ if (_res_constr.datalen > 0)
+ _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
+ else
+ _res_constr.data = NULL;
+ uint32_t* _res_vals = (uint32_t*)(_res + 4);
+ for (size_t c = 0; c < _res_constr.datalen; c++) {
+ uint32_t _res_conv_28 = _res_vals[c];
+ LDKC2Tuple_PublicKeyTypeZ _res_conv_28_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)_res_conv_28) & ~1);
+ FREE((void*)_res_conv_28);
+ _res_constr.data[c] = _res_conv_28_conv;
+ }
+ CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
+ LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
+ *ret_conv = CResult_boolLightningErrorZ_ok(o);
+ return (uint64_t)ret_conv;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
+ LDKLightningError e_conv;
+ e_conv.inner = (void*)(e & (~1));
+ e_conv.is_owned = (e & 1) || (e == 0);
+ e_conv = LightningError_clone(&e_conv);
+ LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
+ *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
+ return (uint64_t)ret_conv;
+}
+
+void __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ CResult_boolLightningErrorZ_free(_res_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
+ LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
+ LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
+ *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
+ return (uint64_t)ret_conv;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
+ LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
+ LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
+ *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
+ return (uint64_t)ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
LDKChannelAnnouncement a_conv;
a_conv.inner = (void*)(a & (~1));
a_conv.is_owned = (a & 1) || (a == 0);
CVec_NodeAnnouncementZ_free(_res_constr);
}
-uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_ok() {
- LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
- *ret_conv = CResult_NoneLightningErrorZ_ok();
- return (uint64_t)ret_conv;
-}
-
-uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
- LDKLightningError e_conv;
- e_conv.inner = (void*)(e & (~1));
- e_conv.is_owned = (e & 1) || (e == 0);
- e_conv = LightningError_clone(&e_conv);
- LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
- *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
- return (uint64_t)ret_conv;
-}
-
-void __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
- if ((_res & 1) != 0) return;
- LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
- FREE((void*)_res);
- CResult_NoneLightningErrorZ_free(_res_conv);
-}
-
-uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
- LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
- LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
- *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
- return (uint64_t)ret_conv;
-}
-
void __attribute__((visibility("default"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
LDKCVec_PublicKeyZ _res_constr;
_res_constr.datalen = *((uint32_t*)_res);
return (uint64_t)ret_conv;
}
+uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_some(uint32_t o) {
+ LDKAccess o_conv = *(LDKAccess*)(((uint64_t)o) & ~1);
+ LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
+ *ret_copy = COption_AccessZ_some(o_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_none() {
+ LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
+ *ret_copy = COption_AccessZ_none();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_COption_AccessZ_free(uint32_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ COption_AccessZ_free(_res_conv);
+}
+
uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_ok(uint32_t o) {
LDKDirectionalChannelInfo o_conv;
o_conv.inner = (void*)(o & (~1));
LDKNetworkGraph o_conv;
o_conv.inner = (void*)(o & (~1));
o_conv.is_owned = (o & 1) || (o == 0);
- o_conv = NetworkGraph_clone(&o_conv);
+ // Warning: we need a move here but no clone is available for LDKNetworkGraph
LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
*ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
return (uint64_t)ret_conv;
CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
}
-uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_clone(uint32_t orig) {
- LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
- LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
- *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
- return (uint64_t)ret_conv;
-}
-
uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_ok(uint32_t o) {
LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
+ o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
*ret_conv = CResult_NetAddressu8Z_ok(o_conv);
return (uint64_t)ret_conv;
uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(uint32_t o) {
LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
+ o_conv = CResult_NetAddressu8Z_clone((LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1));
LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
*ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
return (uint64_t)ret_conv;
uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint32_t o) {
LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
+ o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
*ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
return (uint64_t)ret_conv;
uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint32_t e) {
LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(((uint64_t)e) & ~1);
+ e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uint64_t)e) & ~1));
LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
*ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
return (uint64_t)ret_conv;
return (uint64_t)ret_conv;
}
+uint32_t __attribute__((visibility("default"))) TS_COption_FilterZ_some(uint32_t o) {
+ LDKFilter o_conv = *(LDKFilter*)(((uint64_t)o) & ~1);
+ LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
+ *ret_copy = COption_FilterZ_some(o_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_COption_FilterZ_none() {
+ LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
+ *ret_copy = COption_FilterZ_none();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_COption_FilterZ_free(uint32_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ COption_FilterZ_free(_res_conv);
+}
+
void __attribute__((visibility("default"))) TS_PaymentPurpose_free(uint32_t this_ptr) {
if ((this_ptr & 1) != 0) return;
LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(((uint64_t)this_ptr) & ~1);
return ret_ref;
}
+void __attribute__((visibility("default"))) TS_ClosureReason_free(uint32_t this_ptr) {
+ if ((this_ptr & 1) != 0) return;
+ LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(((uint64_t)this_ptr) & ~1);
+ FREE((void*)this_ptr);
+ ClosureReason_free(this_ptr_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ClosureReason_clone(uint32_t orig) {
+ LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_clone(orig_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
+ LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ClosureReason_holder_force_closed() {
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_holder_force_closed();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ClosureReason_cooperative_closure() {
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_cooperative_closure();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ClosureReason_commitment_tx_confirmed() {
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_commitment_tx_confirmed();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ClosureReason_processing_error(jstring err) {
+ LDKStr err_conv = str_ref_to_owned_c(err);
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_processing_error(err_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ClosureReason_disconnected_peer() {
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_disconnected_peer();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ClosureReason_outdated_channel_manager() {
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_outdated_channel_manager();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_ClosureReason_write(uint32_t obj) {
+ LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
+ LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
+ int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
void __attribute__((visibility("default"))) TS_Event_free(uint32_t this_ptr) {
if ((this_ptr & 1) != 0) return;
LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
CHECK(*((uint32_t*)payment_hash) == 32);
memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(((uint64_t)purpose) & ~1);
+ purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uint64_t)purpose) & ~1));
LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
*ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
uint64_t ret_ref = (uint64_t)ret_copy;
return ret_ref;
}
-uint32_t __attribute__((visibility("default"))) TS_Event_payment_failed(int8_tArray payment_hash, jboolean rejected_by_dest) {
+uint32_t __attribute__((visibility("default"))) TS_Event_payment_path_failed(int8_tArray payment_hash, jboolean rejected_by_dest, uint32_t network_update, jboolean all_paths_failed, uint32_tArray path) {
LDKThirtyTwoBytes payment_hash_ref;
CHECK(*((uint32_t*)payment_hash) == 32);
memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
+ LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1);
+ network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1));
+ LDKCVec_RouteHopZ path_constr;
+ path_constr.datalen = *((uint32_t*)path);
+ if (path_constr.datalen > 0)
+ path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
+ else
+ path_constr.data = NULL;
+ uint32_t* path_vals = (uint32_t*)(path + 4);
+ for (size_t k = 0; k < path_constr.datalen; k++) {
+ uint32_t path_conv_10 = path_vals[k];
+ LDKRouteHop path_conv_10_conv;
+ path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
+ path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
+ path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
+ path_constr.data[k] = path_conv_10_conv;
+ }
LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
- *ret_copy = Event_payment_failed(payment_hash_ref, rejected_by_dest);
+ *ret_copy = Event_payment_path_failed(payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr);
uint64_t ret_ref = (uint64_t)ret_copy;
return ret_ref;
}
uint32_t __attribute__((visibility("default"))) TS_Event_payment_forwarded(uint32_t fee_earned_msat, jboolean claim_from_onchain_tx) {
LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1);
+ fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1));
LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
*ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
uint64_t ret_ref = (uint64_t)ret_copy;
return ret_ref;
}
+uint32_t __attribute__((visibility("default"))) TS_Event_channel_closed(int8_tArray channel_id, uint32_t reason) {
+ LDKThirtyTwoBytes channel_id_ref;
+ CHECK(*((uint32_t*)channel_id) == 32);
+ memcpy(channel_id_ref.data, (uint8_t*)(channel_id + 4), 32);
+ LDKClosureReason reason_conv = *(LDKClosureReason*)(((uint64_t)reason) & ~1);
+ reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1));
+ LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+ *ret_copy = Event_channel_closed(channel_id_ref, reason_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
int8_tArray __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) {
LDKEvent* obj_conv = (LDKEvent*)obj;
LDKCVec_u8Z ret_var = Event_write(obj_conv);
CHECK(*((uint32_t*)node_id) == 33);
memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
LDKErrorAction action_conv = *(LDKErrorAction*)(((uint64_t)action) & ~1);
+ action_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action) & ~1));
LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
*ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
uint64_t ret_ref = (uint64_t)ret_copy;
return ret_ref;
}
-uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_payment_failure_network_update(uint32_t update) {
- LDKHTLCFailChannelUpdate update_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)update) & ~1);
- LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
- *ret_copy = MessageSendEvent_payment_failure_network_update(update_conv);
- uint64_t ret_ref = (uint64_t)ret_copy;
- return ret_ref;
-}
-
uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint32_t msg) {
LDKPublicKey node_id_ref;
CHECK(*((uint32_t*)node_id) == 33);
}
uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_new(uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
- LDKFilter *chain_source_conv_ptr = NULL;
- if (chain_source != 0) {
- LDKFilter chain_source_conv;
- chain_source_conv = *(LDKFilter*)(((uint64_t)chain_source) & ~1);
- chain_source_conv_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
- *chain_source_conv_ptr = chain_source_conv;
+ LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(((uint64_t)chain_source) & ~1);
+ // Warning: we may need a move here but no clone is available for LDKCOption_FilterZ
+ if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
+ // Manually implement clone for Java trait instances
}
LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
- LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv_ptr, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
+ LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_ref;
}
+uint32_tArray __attribute__((visibility("default"))) TS_ChainMonitor_get_claimable_balances(uint32_t this_arg, uint32_tArray ignored_channels) {
+ LDKChainMonitor this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKCVec_ChannelDetailsZ ignored_channels_constr;
+ ignored_channels_constr.datalen = *((uint32_t*)ignored_channels);
+ if (ignored_channels_constr.datalen > 0)
+ ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
+ else
+ ignored_channels_constr.data = NULL;
+ uint32_t* ignored_channels_vals = (uint32_t*)(ignored_channels + 4);
+ for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
+ uint32_t ignored_channels_conv_16 = ignored_channels_vals[q];
+ LDKChannelDetails ignored_channels_conv_16_conv;
+ ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
+ ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
+ ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
+ ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
+ }
+ LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
+ uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
+ uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
+ for (size_t j = 0; j < ret_var.datalen; j++) {
+ LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
+ *ret_conv_9_copy = Balance_clone(&ret_var.data[j]);
+ uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
+ ret_arr_ptr[j] = ret_conv_9_ref;
+ }
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Listen(uint32_t this_arg) {
LDKChainMonitor this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
- *ret = ChainMonitor_as_Listen(&this_arg_conv);
- return (uint64_t)ret;
+ LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
+ *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Confirm(uint32_t this_arg) {
LDKChainMonitor this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
- *ret = ChainMonitor_as_Confirm(&this_arg_conv);
- return (uint64_t)ret;
+ LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
+ *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
LDKChainMonitor this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
- *ret = ChainMonitor_as_Watch(&this_arg_conv);
- return (uint64_t)ret;
+ LDKWatch* ret_ret =MALLOC(sizeof(LDKWatch), "LDKWatch");
+ *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
LDKChainMonitor this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
- *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
- return (uint64_t)ret;
+ LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
+ *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
return ret_ref;
}
-uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_commitment_tx_broadcasted(uint32_t a) {
+uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_commitment_tx_confirmed(uint32_t a) {
LDKOutPoint a_conv;
a_conv.inner = (void*)(a & (~1));
a_conv.is_owned = (a & 1) || (a == 0);
a_conv = OutPoint_clone(&a_conv);
LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
- *ret_copy = MonitorEvent_commitment_tx_broadcasted(a_conv);
+ *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
uint64_t ret_ref = (uint64_t)ret_copy;
return ret_ref;
}
return (uint64_t)ret_conv;
}
+void __attribute__((visibility("default"))) TS_Balance_free(uint32_t this_ptr) {
+ if ((this_ptr & 1) != 0) return;
+ LDKBalance this_ptr_conv = *(LDKBalance*)(((uint64_t)this_ptr) & ~1);
+ FREE((void*)this_ptr);
+ Balance_free(this_ptr_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Balance_clone(uint32_t orig) {
+ LDKBalance* orig_conv = (LDKBalance*)orig;
+ LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
+ *ret_copy = Balance_clone(orig_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
+ LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
+ *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
+ LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
+ *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
+ LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
+ *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Balance_maybe_claimable_htlcawaiting_timeout(int64_t claimable_amount_satoshis, int32_t claimable_height) {
+ LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
+ *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+jboolean __attribute__((visibility("default"))) TS_Balance_eq(uint32_t a, uint32_t b) {
+ LDKBalance* a_conv = (LDKBalance*)a;
+ LDKBalance* b_conv = (LDKBalance*)b;
+ jboolean ret_val = Balance_eq(a_conv, b_conv);
+ return ret_val;
+}
+
void __attribute__((visibility("default"))) TS_ChannelMonitor_free(uint32_t this_obj) {
LDKChannelMonitor this_obj_conv;
this_obj_conv.inner = (void*)(this_obj & (~1));
return ret_ref;
}
+uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_claimable_balances(uint32_t this_arg) {
+ LDKChannelMonitor this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
+ uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
+ uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
+ for (size_t j = 0; j < ret_var.datalen; j++) {
+ LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
+ *ret_conv_9_copy = Balance_clone(&ret_var.data[j]);
+ uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
+ ret_arr_ptr[j] = ret_conv_9_ref;
+ }
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
void __attribute__((visibility("default"))) TS_Persist_free(uint32_t this_ptr) {
if ((this_ptr & 1) != 0) return;
LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
+ val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
}
CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
+ output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
LDKPublicKey revocation_pubkey_arg_ref;
CHECK(*((uint32_t*)revocation_pubkey_arg) == 33);
memcpy(revocation_pubkey_arg_ref.compressed_form, (uint8_t*)(revocation_pubkey_arg + 4), 33);
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
+ val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
}
outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
+ output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
LDKThirtyTwoBytes channel_keys_id_arg_ref;
CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
outpoint_conv = OutPoint_clone(&outpoint_conv);
LDKTxOut output_conv = *(LDKTxOut*)(((uint64_t)output) & ~1);
+ output_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output) & ~1));
LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
*ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
uint64_t ret_ref = (uint64_t)ret_copy;
uint32_t __attribute__((visibility("default"))) TS_Sign_clone(uint32_t orig) {
LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
- LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
- *ret = Sign_clone(orig_conv);
- return (uint64_t)ret;
+ LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
+ *ret_ret = Sign_clone(orig_conv);
+ return (uint64_t)ret_ret;
}
void __attribute__((visibility("default"))) TS_Sign_free(uint32_t this_ptr) {
LDKInMemorySigner this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKBaseSign* ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
- *ret = InMemorySigner_as_BaseSign(&this_arg_conv);
- return (uint64_t)ret;
+ LDKBaseSign* ret_ret =MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
+ *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
LDKInMemorySigner this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
- *ret = InMemorySigner_as_Sign(&this_arg_conv);
- return (uint64_t)ret;
+ LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
+ *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_write(uint32_t obj) {
LDKKeysManager this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
- *ret = KeysManager_as_KeysInterface(&this_arg_conv);
- return (uint64_t)ret;
+ LDKKeysInterface* ret_ret =MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
+ *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
void __attribute__((visibility("default"))) TS_ChannelManager_free(uint32_t this_obj) {
return ret_ref;
}
-void __attribute__((visibility("default"))) TS_ChannelCounterparty_free(uint32_t this_obj) {
- LDKChannelCounterparty this_obj_conv;
+void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_free(uint32_t this_obj) {
+ LDKCounterpartyForwardingInfo this_obj_conv;
this_obj_conv.inner = (void*)(this_obj & (~1));
this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
- ChannelCounterparty_free(this_obj_conv);
+ CounterpartyForwardingInfo_free(this_obj_conv);
}
-int8_tArray __attribute__((visibility("default"))) TS_ChannelCounterparty_get_node_id(uint32_t this_ptr) {
- LDKChannelCounterparty this_ptr_conv;
+int32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint32_t this_ptr) {
+ LDKCounterpartyForwardingInfo this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
- memcpy((uint8_t*)(ret_arr + 4), ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
- return ret_arr;
+ int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
+ return ret_val;
}
-void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_node_id(uint32_t this_ptr, int8_tArray val) {
- LDKChannelCounterparty this_ptr_conv;
+void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
+ LDKCounterpartyForwardingInfo this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- LDKPublicKey val_ref;
- CHECK(*((uint32_t*)val) == 33);
- memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
- ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
+ CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
}
-uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_features(uint32_t this_ptr) {
- LDKChannelCounterparty this_ptr_conv;
+int32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint32_t this_ptr) {
+ LDKCounterpartyForwardingInfo this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
- CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t ret_ref = (uint64_t)ret_var.inner;
- if (ret_var.is_owned) {
- ret_ref |= 1;
- }
- return ret_ref;
+ int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
+ return ret_val;
}
-void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_features(uint32_t this_ptr, uint32_t val) {
- LDKChannelCounterparty this_ptr_conv;
+void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
+ LDKCounterpartyForwardingInfo this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- LDKInitFeatures val_conv;
- val_conv.inner = (void*)(val & (~1));
- val_conv.is_owned = (val & 1) || (val == 0);
- val_conv = InitFeatures_clone(&val_conv);
+ CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
+}
+
+int16_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
+ LDKCounterpartyForwardingInfo this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
+ return ret_val;
+}
+
+void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
+ LDKCounterpartyForwardingInfo this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_new(int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg) {
+ LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_clone(uint32_t orig) {
+ LDKCounterpartyForwardingInfo orig_conv;
+ orig_conv.inner = (void*)(orig & (~1));
+ orig_conv.is_owned = false;
+ LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_ChannelCounterparty_free(uint32_t this_obj) {
+ LDKChannelCounterparty this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ ChannelCounterparty_free(this_obj_conv);
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_ChannelCounterparty_get_node_id(uint32_t this_ptr) {
+ LDKChannelCounterparty this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
+ return ret_arr;
+}
+
+void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_node_id(uint32_t this_ptr, int8_tArray val) {
+ LDKChannelCounterparty this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKPublicKey val_ref;
+ CHECK(*((uint32_t*)val) == 33);
+ memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
+ ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_features(uint32_t this_ptr) {
+ LDKChannelCounterparty this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_features(uint32_t this_ptr, uint32_t val) {
+ LDKChannelCounterparty this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKInitFeatures val_conv;
+ val_conv.inner = (void*)(val & (~1));
+ val_conv.is_owned = (val & 1) || (val == 0);
+ val_conv = InitFeatures_clone(&val_conv);
ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
}
ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
}
+uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_forwarding_info(uint32_t this_ptr) {
+ LDKChannelCounterparty this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_forwarding_info(uint32_t this_ptr, uint32_t val) {
+ LDKChannelCounterparty this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCounterpartyForwardingInfo val_conv;
+ val_conv.inner = (void*)(val & (~1));
+ val_conv.is_owned = (val & 1) || (val == 0);
+ val_conv = CounterpartyForwardingInfo_clone(&val_conv);
+ ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_new(int8_tArray node_id_arg, uint32_t features_arg, int64_t unspendable_punishment_reserve_arg, uint32_t forwarding_info_arg) {
+ LDKPublicKey node_id_arg_ref;
+ CHECK(*((uint32_t*)node_id_arg) == 33);
+ memcpy(node_id_arg_ref.compressed_form, (uint8_t*)(node_id_arg + 4), 33);
+ LDKInitFeatures features_arg_conv;
+ features_arg_conv.inner = (void*)(features_arg & (~1));
+ features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
+ features_arg_conv = InitFeatures_clone(&features_arg_conv);
+ LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
+ forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
+ forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
+ forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
+ LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_clone(uint32_t orig) {
LDKChannelCounterparty orig_conv;
orig_conv.inner = (void*)(orig & (~1));
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)val) & ~1));
ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
}
funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1);
+ short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1));
LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1);
+ confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1));
LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1);
+ force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1));
LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_id_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_parameter_error(uint32_t a) {
LDKAPIError a_conv = *(LDKAPIError*)(((uint64_t)a) & ~1);
+ a_conv = APIError_clone((LDKAPIError*)(((uint64_t)a) & ~1));
LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
*ret_copy = PaymentSendFailure_parameter_error(a_conv);
uint64_t ret_ref = (uint64_t)ret_copy;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
+ min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
*ret_ref = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
return (uint64_t)ret_ref;
CHECK(*((uint32_t*)payment_hash) == 32);
memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
+ min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
*ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
return (uint64_t)ret_conv;
LDKChannelManager this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
- *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
- return (uint64_t)ret;
+ LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
+ *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
LDKChannelManager this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
- *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
- return (uint64_t)ret;
+ LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
+ *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
LDKChannelManager this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
- *ret = ChannelManager_as_Listen(&this_arg_conv);
- return (uint64_t)ret;
+ LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
+ *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Confirm(uint32_t this_arg) {
LDKChannelManager this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
- *ret = ChannelManager_as_Confirm(&this_arg_conv);
- return (uint64_t)ret;
+ LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
+ *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
jboolean __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update_timeout(uint32_t this_arg, int64_t max_wait) {
LDKChannelManager this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
- *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
- return (uint64_t)ret;
+ LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
+ *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_write(uint32_t obj) {
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
+ val_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)val) & ~1));
LightningError_set_action(&this_ptr_conv, val_conv);
}
uint32_t __attribute__((visibility("default"))) TS_LightningError_new(jstring err_arg, uint32_t action_arg) {
LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
+ action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action_arg) & ~1));
LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
CommitmentUpdate_free(this_obj_conv);
}
+uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_add_htlcs(uint32_t this_ptr) {
+ LDKCommitmentUpdate this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
+ uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
+ uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
+ for (size_t p = 0; p < ret_var.datalen; p++) {
+ LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
+ CHECK((((uint64_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_conv_15_ref = (uint64_t)ret_conv_15_var.inner;
+ if (ret_conv_15_var.is_owned) {
+ ret_conv_15_ref |= 1;
+ }
+ ret_arr_ptr[p] = ret_conv_15_ref;
+ }
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
LDKCommitmentUpdate this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
}
+uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint32_t this_ptr) {
+ LDKCommitmentUpdate this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
+ uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
+ uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
+ for (size_t t = 0; t < ret_var.datalen; t++) {
+ LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
+ CHECK((((uint64_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_conv_19_ref = (uint64_t)ret_conv_19_var.inner;
+ if (ret_conv_19_var.is_owned) {
+ ret_conv_19_ref |= 1;
+ }
+ ret_arr_ptr[t] = ret_conv_19_ref;
+ }
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
LDKCommitmentUpdate this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
}
+uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint32_t this_ptr) {
+ LDKCommitmentUpdate this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
+ uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
+ uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
+ for (size_t q = 0; q < ret_var.datalen; q++) {
+ LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
+ CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
+ if (ret_conv_16_var.is_owned) {
+ ret_conv_16_ref |= 1;
+ }
+ ret_arr_ptr[q] = ret_conv_16_ref;
+ }
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
LDKCommitmentUpdate this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
}
+uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint32_t this_ptr) {
+ LDKCommitmentUpdate this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
+ uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
+ uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
+ for (size_t z = 0; z < ret_var.datalen; z++) {
+ LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
+ CHECK((((uint64_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_conv_25_ref = (uint64_t)ret_conv_25_var.inner;
+ if (ret_conv_25_var.is_owned) {
+ ret_conv_25_ref |= 1;
+ }
+ ret_arr_ptr[z] = ret_conv_25_ref;
+ }
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_malformed_htlcs(uint32_t this_ptr, uint32_tArray val) {
LDKCommitmentUpdate this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
return ret_ref;
}
-void __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_free(uint32_t this_ptr) {
- if ((this_ptr & 1) != 0) return;
- LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
- FREE((void*)this_ptr);
- HTLCFailChannelUpdate_free(this_ptr_conv);
-}
-
-uint32_t __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_clone(uint32_t orig) {
- LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
- LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
- *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
- uint64_t ret_ref = (uint64_t)ret_copy;
- return ret_ref;
-}
-
-uint32_t __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_channel_update_message(uint32_t msg) {
- LDKChannelUpdate msg_conv;
- msg_conv.inner = (void*)(msg & (~1));
- msg_conv.is_owned = (msg & 1) || (msg == 0);
- msg_conv = ChannelUpdate_clone(&msg_conv);
- LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
- *ret_copy = HTLCFailChannelUpdate_channel_update_message(msg_conv);
- uint64_t ret_ref = (uint64_t)ret_copy;
- return ret_ref;
-}
-
-uint32_t __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_channel_closed(int64_t short_channel_id, jboolean is_permanent) {
- LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
- *ret_copy = HTLCFailChannelUpdate_channel_closed(short_channel_id, is_permanent);
- uint64_t ret_ref = (uint64_t)ret_copy;
- return ret_ref;
-}
-
-uint32_t __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
- LDKPublicKey node_id_ref;
- CHECK(*((uint32_t*)node_id) == 33);
- memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
- LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
- *ret_copy = HTLCFailChannelUpdate_node_failure(node_id_ref, is_permanent);
- uint64_t ret_ref = (uint64_t)ret_copy;
- return ret_ref;
-}
-
void __attribute__((visibility("default"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
if ((this_ptr & 1) != 0) return;
LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
return ret_arr;
}
-uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
- LDKu8slice ser_ref;
- ser_ref.datalen = *((uint32_t*)ser);
- ser_ref.data = (int8_t*)(ser + 4);
- LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
- *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
- return (uint64_t)ret_conv;
-}
-
int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
LDKReplyShortChannelIdsEnd obj_conv;
obj_conv.inner = (void*)(obj & (~1));
return ret_arr;
}
+uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = *((uint32_t*)ser);
+ ser_ref.data = (int8_t*)(ser + 4);
+ LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
+ *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
+ return (uint64_t)ret_conv;
+}
+
int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
LDKQueryChannelRange this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
return ret_val;
}
-uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_read(int8_tArray ser) {
- LDKu8slice ser_ref;
- ser_ref.datalen = *((uint32_t*)ser);
- ser_ref.data = (int8_t*)(ser + 4);
- LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
- *ret_conv = QueryChannelRange_read(ser_ref);
- return (uint64_t)ret_conv;
-}
-
int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_write(uint32_t obj) {
LDKQueryChannelRange obj_conv;
obj_conv.inner = (void*)(obj & (~1));
return ret_arr;
}
+uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_read(int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = *((uint32_t*)ser);
+ ser_ref.data = (int8_t*)(ser + 4);
+ LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
+ *ret_conv = QueryChannelRange_read(ser_ref);
+ return (uint64_t)ret_conv;
+}
+
uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_read(int8_tArray ser) {
LDKu8slice ser_ref;
ser_ref.datalen = *((uint32_t*)ser);
return ret_arr;
}
-uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
- LDKu8slice ser_ref;
- ser_ref.datalen = *((uint32_t*)ser);
- ser_ref.data = (int8_t*)(ser + 4);
- LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
- *ret_conv = GossipTimestampFilter_read(ser_ref);
- return (uint64_t)ret_conv;
-}
-
int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_write(uint32_t obj) {
LDKGossipTimestampFilter obj_conv;
obj_conv.inner = (void*)(obj & (~1));
return ret_arr;
}
+uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = *((uint32_t*)ser);
+ ser_ref.data = (int8_t*)(ser + 4);
+ LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
+ *ret_conv = GossipTimestampFilter_read(ser_ref);
+ return (uint64_t)ret_conv;
+}
+
+void __attribute__((visibility("default"))) TS_CustomMessageHandler_free(uint32_t this_ptr) {
+ if ((this_ptr & 1) != 0) return;
+ LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(((uint64_t)this_ptr) & ~1);
+ FREE((void*)this_ptr);
+ CustomMessageHandler_free(this_ptr_conv);
+}
+
void __attribute__((visibility("default"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
LDKIgnoringMessageHandler this_obj_conv;
this_obj_conv.inner = (void*)(this_obj & (~1));
LDKIgnoringMessageHandler this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
- *ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
- return (uint64_t)ret;
+ LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
+ *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
LDKIgnoringMessageHandler this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
- *ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
- return (uint64_t)ret;
+ LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
+ *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
-void __attribute__((visibility("default"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
- LDKErroringMessageHandler this_obj_conv;
+uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint32_t this_arg) {
+ LDKIgnoringMessageHandler this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKCustomMessageReader* ret_ret =MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
+ *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
+ return (uint64_t)ret_ret;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint32_t this_arg) {
+ LDKIgnoringMessageHandler this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKCustomMessageHandler* ret_ret =MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
+ *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
+ return (uint64_t)ret_ret;
+}
+
+void __attribute__((visibility("default"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
+ LDKErroringMessageHandler this_obj_conv;
this_obj_conv.inner = (void*)(this_obj & (~1));
this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
ErroringMessageHandler_free(this_obj_conv);
LDKErroringMessageHandler this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
- *ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
- return (uint64_t)ret;
+ LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
+ *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
LDKErroringMessageHandler this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
- *ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
- return (uint64_t)ret;
+ LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
+ *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
void __attribute__((visibility("default"))) TS_MessageHandler_free(uint32_t this_obj) {
uint32_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone(uint32_t orig) {
LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
- LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
- *ret = SocketDescriptor_clone(orig_conv);
- return (uint64_t)ret;
+ LDKSocketDescriptor* ret_ret =MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
+ *ret_ret = SocketDescriptor_clone(orig_conv);
+ return (uint64_t)ret_ret;
}
void __attribute__((visibility("default"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
PeerManager_free(this_obj_conv);
}
-uint32_t __attribute__((visibility("default"))) TS_PeerManager_new(uint32_t message_handler, int8_tArray our_node_secret, int8_tArray ephemeral_random_data, uint32_t logger) {
+uint32_t __attribute__((visibility("default"))) TS_PeerManager_new(uint32_t message_handler, int8_tArray our_node_secret, int8_tArray ephemeral_random_data, uint32_t logger, uint32_t custom_message_handler) {
LDKMessageHandler message_handler_conv;
message_handler_conv.inner = (void*)(message_handler & (~1));
message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
memcpy(ephemeral_random_data_arr, (uint8_t*)(ephemeral_random_data + 4), 32);
unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
- LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
+ LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(((uint64_t)custom_message_handler) & ~1);
+ LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_arr;
}
+int8_tArray __attribute__((visibility("default"))) TS_build_closing_transaction(int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, uint32_t funding_outpoint) {
+ LDKCVec_u8Z to_holder_script_ref;
+ to_holder_script_ref.datalen = *((uint32_t*)to_holder_script);
+ to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
+ memcpy(to_holder_script_ref.data, (uint8_t*)(to_holder_script + 4), to_holder_script_ref.datalen);
+ LDKCVec_u8Z to_counterparty_script_ref;
+ to_counterparty_script_ref.datalen = *((uint32_t*)to_counterparty_script);
+ to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
+ memcpy(to_counterparty_script_ref.data, (uint8_t*)(to_counterparty_script + 4), to_counterparty_script_ref.datalen);
+ LDKOutPoint funding_outpoint_conv;
+ funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
+ funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
+ funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
+ LDKTransaction ret_var = build_closing_transaction(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
+ int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
+ Transaction_free(ret_var);
+ return ret_arr;
+}
+
uint32_t __attribute__((visibility("default"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
LDKPublicKey per_commitment_point_ref;
CHECK(*((uint32_t*)per_commitment_point) == 33);
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
}
CHECK(*((uint32_t*)payment_hash_arg) == 32);
memcpy(payment_hash_arg_ref.data, (uint8_t*)(payment_hash_arg + 4), 32);
LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1);
+ transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1));
LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
return ret_arr;
}
+void __attribute__((visibility("default"))) TS_ClosingTransaction_free(uint32_t this_obj) {
+ LDKClosingTransaction this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ ClosingTransaction_free(this_obj_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_new(int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, uint32_t funding_outpoint) {
+ LDKCVec_u8Z to_holder_script_ref;
+ to_holder_script_ref.datalen = *((uint32_t*)to_holder_script);
+ to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
+ memcpy(to_holder_script_ref.data, (uint8_t*)(to_holder_script + 4), to_holder_script_ref.datalen);
+ LDKCVec_u8Z to_counterparty_script_ref;
+ to_counterparty_script_ref.datalen = *((uint32_t*)to_counterparty_script);
+ to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
+ memcpy(to_counterparty_script_ref.data, (uint8_t*)(to_counterparty_script + 4), to_counterparty_script_ref.datalen);
+ LDKOutPoint funding_outpoint_conv;
+ funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
+ funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
+ funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
+ LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_trust(uint32_t this_arg) {
+ LDKClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_verify(uint32_t this_arg, uint32_t funding_outpoint) {
+ LDKClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKOutPoint funding_outpoint_conv;
+ funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
+ funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
+ funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
+ LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
+ *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
+ return (uint64_t)ret_conv;
+}
+
+int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_to_holder_value_sat(uint32_t this_arg) {
+ LDKClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
+ return ret_val;
+}
+
+int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_to_counterparty_value_sat(uint32_t this_arg) {
+ LDKClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
+ return ret_val;
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_ClosingTransaction_to_holder_script(uint32_t this_arg) {
+ LDKClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
+ int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
+ return ret_arr;
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_ClosingTransaction_to_counterparty_script(uint32_t this_arg) {
+ LDKClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
+ int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
+ return ret_arr;
+}
+
+void __attribute__((visibility("default"))) TS_TrustedClosingTransaction_free(uint32_t this_obj) {
+ LDKTrustedClosingTransaction this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ TrustedClosingTransaction_free(this_obj_conv);
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_built_transaction(uint32_t this_arg) {
+ LDKTrustedClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
+ int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
+ Transaction_free(ret_var);
+ return ret_arr;
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
+ LDKTrustedClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKu8slice funding_redeemscript_ref;
+ funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
+ funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
+ int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
+ return ret_arr;
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_sign(uint32_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
+ LDKTrustedClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ unsigned char funding_key_arr[32];
+ CHECK(*((uint32_t*)funding_key) == 32);
+ memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
+ unsigned char (*funding_key_ref)[32] = &funding_key_arr;
+ LDKu8slice funding_redeemscript_ref;
+ funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
+ funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
+ int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
+ return ret_arr;
+}
+
void __attribute__((visibility("default"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
LDKCommitmentTransaction this_obj_conv;
this_obj_conv.inner = (void*)(this_obj & (~1));
return ret_ref;
}
+jboolean __attribute__((visibility("default"))) TS_InitFeatures_requires_unknown_bits(uint32_t this_arg) {
+ LDKInitFeatures this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
+ return ret_val;
+}
+
uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_empty() {
LDKNodeFeatures ret_var = NodeFeatures_empty();
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
return ret_ref;
}
+jboolean __attribute__((visibility("default"))) TS_NodeFeatures_requires_unknown_bits(uint32_t this_arg) {
+ LDKNodeFeatures this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
+ return ret_val;
+}
+
uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_empty() {
LDKChannelFeatures ret_var = ChannelFeatures_empty();
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
return ret_ref;
}
+jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_requires_unknown_bits(uint32_t this_arg) {
+ LDKChannelFeatures this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
+ return ret_val;
+}
+
uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_empty() {
LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
return ret_ref;
}
+jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_requires_unknown_bits(uint32_t this_arg) {
+ LDKInvoiceFeatures this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
+ return ret_val;
+}
+
jboolean __attribute__((visibility("default"))) TS_InitFeatures_supports_payment_secret(uint32_t this_arg) {
LDKInitFeatures this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
return ret_val;
}
+void __attribute__((visibility("default"))) TS_CustomMessageReader_free(uint32_t this_ptr) {
+ if ((this_ptr & 1) != 0) return;
+ LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(((uint64_t)this_ptr) & ~1);
+ FREE((void*)this_ptr);
+ CustomMessageReader_free(this_ptr_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Type_clone(uint32_t orig) {
+ LDKType* orig_conv = (LDKType*)(((uint64_t)orig) & ~1);
+ LDKType* ret_ret =MALLOC(sizeof(LDKType), "LDKType");
+ *ret_ret = Type_clone(orig_conv);
+ return (uint64_t)ret_ret;
+}
+
+void __attribute__((visibility("default"))) TS_Type_free(uint32_t this_ptr) {
+ if ((this_ptr & 1) != 0) return;
+ LDKType this_ptr_conv = *(LDKType*)(((uint64_t)this_ptr) & ~1);
+ FREE((void*)this_ptr);
+ Type_free(this_ptr_conv);
+}
+
void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_obj) {
LDKRouteHop this_obj_conv;
this_obj_conv.inner = (void*)(this_obj & (~1));
return ret_ref;
}
+int64_t __attribute__((visibility("default"))) TS_RouteHop_hash(uint32_t o) {
+ LDKRouteHop o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = RouteHop_hash(&o_conv);
+ return ret_val;
+}
+
+jboolean __attribute__((visibility("default"))) TS_RouteHop_eq(uint32_t a, uint32_t b) {
+ LDKRouteHop a_conv;
+ a_conv.inner = (void*)(a & (~1));
+ a_conv.is_owned = false;
+ LDKRouteHop b_conv;
+ b_conv.inner = (void*)(b & (~1));
+ b_conv.is_owned = false;
+ jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
+ return ret_val;
+}
+
int8_tArray __attribute__((visibility("default"))) TS_RouteHop_write(uint32_t obj) {
LDKRouteHop obj_conv;
obj_conv.inner = (void*)(obj & (~1));
Route_free(this_obj_conv);
}
+ptrArray __attribute__((visibility("default"))) TS_Route_get_paths(uint32_t this_ptr) {
+ LDKRoute this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
+ ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
+ uint32_tArray *ret_arr_ptr = (uint32_tArray*)(ret_arr + 4);
+ for (size_t m = 0; m < ret_var.datalen; m++) {
+ LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
+ uint32_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
+ uint32_t *ret_conv_12_arr_ptr = (uint32_t*)(ret_conv_12_arr + 4);
+ for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
+ LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
+ CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner;
+ if (ret_conv_12_conv_10_var.is_owned) {
+ ret_conv_12_conv_10_ref |= 1;
+ }
+ ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
+ }
+ FREE(ret_conv_12_var.data);
+ ret_arr_ptr[m] = ret_conv_12_arr;
+ }
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
LDKRoute this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
return ret_ref;
}
+int64_t __attribute__((visibility("default"))) TS_Route_hash(uint32_t o) {
+ LDKRoute o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = Route_hash(&o_conv);
+ return ret_val;
+}
+
+jboolean __attribute__((visibility("default"))) TS_Route_eq(uint32_t a, uint32_t b) {
+ LDKRoute a_conv;
+ a_conv.inner = (void*)(a & (~1));
+ a_conv.is_owned = false;
+ LDKRoute b_conv;
+ b_conv.inner = (void*)(b & (~1));
+ b_conv.is_owned = false;
+ jboolean ret_val = Route_eq(&a_conv, &b_conv);
+ return ret_val;
+}
+
+int64_t __attribute__((visibility("default"))) TS_Route_get_total_fees(uint32_t this_arg) {
+ LDKRoute this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ int64_t ret_val = Route_get_total_fees(&this_arg_conv);
+ return ret_val;
+}
+
+int64_t __attribute__((visibility("default"))) TS_Route_get_total_amount(uint32_t this_arg) {
+ LDKRoute this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ int64_t ret_val = Route_get_total_amount(&this_arg_conv);
+ return ret_val;
+}
+
int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) {
LDKRoute obj_conv;
obj_conv.inner = (void*)(obj & (~1));
RouteHint_free(this_obj_conv);
}
-jboolean __attribute__((visibility("default"))) TS_RouteHint_eq(uint32_t a, uint32_t b) {
- LDKRouteHint a_conv;
- a_conv.inner = (void*)(a & (~1));
- a_conv.is_owned = false;
- LDKRouteHint b_conv;
- b_conv.inner = (void*)(b & (~1));
- b_conv.is_owned = false;
- jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
- return ret_val;
-}
-
uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) {
LDKRouteHint orig_conv;
orig_conv.inner = (void*)(orig & (~1));
return ret_ref;
}
+int64_t __attribute__((visibility("default"))) TS_RouteHint_hash(uint32_t o) {
+ LDKRouteHint o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = RouteHint_hash(&o_conv);
+ return ret_val;
+}
+
+jboolean __attribute__((visibility("default"))) TS_RouteHint_eq(uint32_t a, uint32_t b) {
+ LDKRouteHint a_conv;
+ a_conv.inner = (void*)(a & (~1));
+ a_conv.is_owned = false;
+ LDKRouteHint b_conv;
+ b_conv.inner = (void*)(b & (~1));
+ b_conv.is_owned = false;
+ jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
+ return ret_val;
+}
+
void __attribute__((visibility("default"))) TS_RouteHintHop_free(uint32_t this_obj) {
LDKRouteHintHop this_obj_conv;
this_obj_conv.inner = (void*)(this_obj & (~1));
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
}
fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
+ htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1));
LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
+ htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
LDKRouteHintHop ret_var = RouteHintHop_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg_conv, htlc_maximum_msat_arg_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
return ret_ref;
}
-jboolean __attribute__((visibility("default"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) {
- LDKRouteHintHop a_conv;
- a_conv.inner = (void*)(a & (~1));
- a_conv.is_owned = false;
- LDKRouteHintHop b_conv;
- b_conv.inner = (void*)(b & (~1));
- b_conv.is_owned = false;
- jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
- return ret_val;
-}
-
uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_clone(uint32_t orig) {
LDKRouteHintHop orig_conv;
orig_conv.inner = (void*)(orig & (~1));
return ret_ref;
}
+int64_t __attribute__((visibility("default"))) TS_RouteHintHop_hash(uint32_t o) {
+ LDKRouteHintHop o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = RouteHintHop_hash(&o_conv);
+ return ret_val;
+}
+
+jboolean __attribute__((visibility("default"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) {
+ LDKRouteHintHop a_conv;
+ a_conv.inner = (void*)(a & (~1));
+ a_conv.is_owned = false;
+ LDKRouteHintHop b_conv;
+ b_conv.inner = (void*)(b & (~1));
+ b_conv.is_owned = false;
+ jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
+ return ret_val;
+}
+
uint32_t __attribute__((visibility("default"))) TS_get_keysend_route(int8_tArray our_node_id, uint32_t network, int8_tArray payee, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger) {
LDKPublicKey our_node_id_ref;
CHECK(*((uint32_t*)our_node_id) == 33);
NetworkGraph_free(this_obj_conv);
}
-uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_clone(uint32_t orig) {
- LDKNetworkGraph orig_conv;
- orig_conv.inner = (void*)(orig & (~1));
- orig_conv.is_owned = false;
- LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
- CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t ret_ref = (uint64_t)ret_var.inner;
- if (ret_var.is_owned) {
- ret_ref |= 1;
- }
+void __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_free(uint32_t this_obj) {
+ LDKReadOnlyNetworkGraph this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ ReadOnlyNetworkGraph_free(this_obj_conv);
+}
+
+void __attribute__((visibility("default"))) TS_NetworkUpdate_free(uint32_t this_ptr) {
+ if ((this_ptr & 1) != 0) return;
+ LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(((uint64_t)this_ptr) & ~1);
+ FREE((void*)this_ptr);
+ NetworkUpdate_free(this_ptr_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_clone(uint32_t orig) {
+ LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
+ LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
+ *ret_copy = NetworkUpdate_clone(orig_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
return ret_ref;
}
-void __attribute__((visibility("default"))) TS_LockedNetworkGraph_free(uint32_t this_obj) {
- LDKLockedNetworkGraph this_obj_conv;
- this_obj_conv.inner = (void*)(this_obj & (~1));
- this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
- LockedNetworkGraph_free(this_obj_conv);
+uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_update_message(uint32_t msg) {
+ LDKChannelUpdate msg_conv;
+ msg_conv.inner = (void*)(msg & (~1));
+ msg_conv.is_owned = (msg & 1) || (msg == 0);
+ msg_conv = ChannelUpdate_clone(&msg_conv);
+ LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
+ *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_closed(int64_t short_channel_id, jboolean is_permanent) {
+ LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
+ *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
+ LDKPublicKey node_id_ref;
+ CHECK(*((uint32_t*)node_id) == 33);
+ memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
+ LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
+ *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_NetworkUpdate_write(uint32_t obj) {
+ LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
+ LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
+ int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_EventHandler(uint32_t this_arg) {
+ LDKNetGraphMsgHandler this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKEventHandler* ret_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
+ *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) {
NetGraphMsgHandler_free(this_obj_conv);
}
-uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(int8_tArray genesis_hash, uint32_t chain_access, uint32_t logger) {
- LDKThirtyTwoBytes genesis_hash_ref;
- CHECK(*((uint32_t*)genesis_hash) == 32);
- memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
- LDKAccess *chain_access_conv_ptr = NULL;
- if (chain_access != 0) {
- LDKAccess chain_access_conv;
- chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
- chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
- *chain_access_conv_ptr = chain_access_conv;
- }
- LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
- LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv_ptr, logger_conv);
+uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_get_network_graph(uint32_t this_ptr) {
+ LDKNetGraphMsgHandler this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKNetworkGraph ret_var = NetGraphMsgHandler_get_network_graph(&this_ptr_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_ref;
}
-uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_from_net_graph(uint32_t chain_access, uint32_t logger, uint32_t network_graph) {
- LDKAccess *chain_access_conv_ptr = NULL;
- if (chain_access != 0) {
- LDKAccess chain_access_conv;
- chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
- chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
- *chain_access_conv_ptr = chain_access_conv;
- }
- LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
+void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_set_network_graph(uint32_t this_ptr, uint32_t val) {
+ LDKNetGraphMsgHandler this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKNetworkGraph val_conv;
+ val_conv.inner = (void*)(val & (~1));
+ val_conv.is_owned = (val & 1) || (val == 0);
+ // Warning: we need a move here but no clone is available for LDKNetworkGraph
+ NetGraphMsgHandler_set_network_graph(&this_ptr_conv, val_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(uint32_t network_graph, uint32_t chain_access, uint32_t logger) {
LDKNetworkGraph network_graph_conv;
network_graph_conv.inner = (void*)(network_graph & (~1));
network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
- network_graph_conv = NetworkGraph_clone(&network_graph_conv);
- LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv_ptr, logger_conv, network_graph_conv);
+ // Warning: we need a move here but no clone is available for LDKNetworkGraph
+ LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
+ // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
+ if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
+ // Manually implement clone for Java trait instances
+ }
+ LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
+ LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(network_graph_conv, chain_access_conv, logger_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
LDKNetGraphMsgHandler this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKAccess *chain_access_conv_ptr = NULL;
- if (chain_access != 0) {
- LDKAccess chain_access_conv;
- chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
- chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
- *chain_access_conv_ptr = chain_access_conv;
- }
- NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv_ptr);
-}
-
-uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_read_locked_graph(uint32_t this_arg) {
- LDKNetGraphMsgHandler this_arg_conv;
- this_arg_conv.inner = (void*)(this_arg & (~1));
- this_arg_conv.is_owned = false;
- LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
- CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t ret_ref = (uint64_t)ret_var.inner;
- if (ret_var.is_owned) {
- ret_ref |= 1;
- }
- return ret_ref;
-}
-
-uint32_t __attribute__((visibility("default"))) TS_LockedNetworkGraph_graph(uint32_t this_arg) {
- LDKLockedNetworkGraph this_arg_conv;
- this_arg_conv.inner = (void*)(this_arg & (~1));
- this_arg_conv.is_owned = false;
- LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
- CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t ret_ref = (uint64_t)ret_var.inner;
- if (ret_var.is_owned) {
- ret_ref |= 1;
+ LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
+ // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
+ if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
+ // Manually implement clone for Java trait instances
}
- return ret_ref;
+ NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
}
uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) {
LDKNetGraphMsgHandler this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
- *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
- return (uint64_t)ret;
+ LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
+ *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
LDKNetGraphMsgHandler this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
- *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
- return (uint64_t)ret;
+ LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
+ *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_free(uint32_t this_obj) {
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
}
uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_new(int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, uint32_t htlc_maximum_msat_arg, uint32_t fees_arg, uint32_t last_update_message_arg) {
LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
+ htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
LDKRoutingFees fees_arg_conv;
fees_arg_conv.inner = (void*)(fees_arg & (~1));
fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
}
two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1);
+ capacity_sats_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1));
LDKChannelAnnouncement announcement_message_arg_conv;
announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
return ret_ref;
}
+int64_t __attribute__((visibility("default"))) TS_RoutingFees_hash(uint32_t o) {
+ LDKRoutingFees o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = RoutingFees_hash(&o_conv);
+ return ret_val;
+}
+
int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_t obj) {
LDKRoutingFees obj_conv;
obj_conv.inner = (void*)(obj & (~1));
return ret_ref;
}
+uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read_only(uint32_t this_arg) {
+ LDKNetworkGraph this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
LDKNetworkGraph this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
LDKChannelAnnouncement msg_conv;
msg_conv.inner = (void*)(msg & (~1));
msg_conv.is_owned = false;
- LDKAccess *chain_access_conv_ptr = NULL;
- if (chain_access != 0) {
- LDKAccess chain_access_conv;
- chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
- chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
- *chain_access_conv_ptr = chain_access_conv;
+ LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
+ // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
+ if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
+ // Manually implement clone for Java trait instances
}
LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
- *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
+ *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
return (uint64_t)ret_conv;
}
LDKUnsignedChannelAnnouncement msg_conv;
msg_conv.inner = (void*)(msg & (~1));
msg_conv.is_owned = false;
- LDKAccess *chain_access_conv_ptr = NULL;
- if (chain_access != 0) {
- LDKAccess chain_access_conv;
- chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
- chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
- *chain_access_conv_ptr = chain_access_conv;
+ LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
+ // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
+ if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
+ // Manually implement clone for Java trait instances
}
LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
- *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
+ *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
return (uint64_t)ret_conv;
}
NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
}
+void __attribute__((visibility("default"))) TS_NetworkGraph_fail_node(uint32_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
+ LDKNetworkGraph this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKPublicKey _node_id_ref;
+ CHECK(*((uint32_t*)_node_id) == 33);
+ memcpy(_node_id_ref.compressed_form, (uint8_t*)(_node_id + 4), 33);
+ NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
+}
+
uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
LDKNetworkGraph this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
LDKFilesystemPersister this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKPersist* ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
- *ret = FilesystemPersister_as_Persist(&this_arg_conv);
- return (uint64_t)ret;
+ LDKPersist* ret_ret =MALLOC(sizeof(LDKPersist), "LDKPersist");
+ *ret_ret = FilesystemPersister_as_Persist(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
void __attribute__((visibility("default"))) TS_BackgroundProcessor_free(uint32_t this_obj) {
ChannelManagerPersister_free(this_ptr_conv);
}
-uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_start(uint32_t persister, uint32_t event_handler, uint32_t chain_monitor, uint32_t channel_manager, uint32_t peer_manager, uint32_t logger) {
+uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_start(uint32_t persister, uint32_t event_handler, uint32_t chain_monitor, uint32_t channel_manager, uint32_t net_graph_msg_handler, uint32_t peer_manager, uint32_t logger) {
LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(((uint64_t)persister) & ~1);
LDKEventHandler event_handler_conv = *(LDKEventHandler*)(((uint64_t)event_handler) & ~1);
LDKChainMonitor chain_monitor_conv;
LDKChannelManager channel_manager_conv;
channel_manager_conv.inner = (void*)(channel_manager & (~1));
channel_manager_conv.is_owned = false;
+ LDKNetGraphMsgHandler net_graph_msg_handler_conv;
+ net_graph_msg_handler_conv.inner = (void*)(net_graph_msg_handler & (~1));
+ net_graph_msg_handler_conv.is_owned = (net_graph_msg_handler & 1) || (net_graph_msg_handler == 0);
LDKPeerManager peer_manager_conv;
peer_manager_conv.inner = (void*)(peer_manager & (~1));
peer_manager_conv.is_owned = false;
LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
- LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, &peer_manager_conv, logger_conv);
+ LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, net_graph_msg_handler_conv, &peer_manager_conv, logger_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_conv;
}
+int64_t __attribute__((visibility("default"))) TS_Currency_hash(uint32_t o) {
+ LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
+ int64_t ret_val = Currency_hash(o_conv);
+ return ret_val;
+}
+
jboolean __attribute__((visibility("default"))) TS_Currency_eq(uint32_t a, uint32_t b) {
LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
Sha256_free(this_obj_conv);
}
+uint32_t __attribute__((visibility("default"))) TS_Sha256_clone(uint32_t orig) {
+ LDKSha256 orig_conv;
+ orig_conv.inner = (void*)(orig & (~1));
+ orig_conv.is_owned = false;
+ LDKSha256 ret_var = Sha256_clone(&orig_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+int64_t __attribute__((visibility("default"))) TS_Sha256_hash(uint32_t o) {
+ LDKSha256 o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = Sha256_hash(&o_conv);
+ return ret_val;
+}
+
jboolean __attribute__((visibility("default"))) TS_Sha256_eq(uint32_t a, uint32_t b) {
LDKSha256 a_conv;
a_conv.inner = (void*)(a & (~1));
return ret_val;
}
-uint32_t __attribute__((visibility("default"))) TS_Sha256_clone(uint32_t orig) {
- LDKSha256 orig_conv;
+void __attribute__((visibility("default"))) TS_Description_free(uint32_t this_obj) {
+ LDKDescription this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ Description_free(this_obj_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Description_clone(uint32_t orig) {
+ LDKDescription orig_conv;
orig_conv.inner = (void*)(orig & (~1));
orig_conv.is_owned = false;
- LDKSha256 ret_var = Sha256_clone(&orig_conv);
+ LDKDescription ret_var = Description_clone(&orig_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_ref;
}
-void __attribute__((visibility("default"))) TS_Description_free(uint32_t this_obj) {
- LDKDescription this_obj_conv;
- this_obj_conv.inner = (void*)(this_obj & (~1));
- this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
- Description_free(this_obj_conv);
+int64_t __attribute__((visibility("default"))) TS_Description_hash(uint32_t o) {
+ LDKDescription o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = Description_hash(&o_conv);
+ return ret_val;
}
jboolean __attribute__((visibility("default"))) TS_Description_eq(uint32_t a, uint32_t b) {
return ret_val;
}
-uint32_t __attribute__((visibility("default"))) TS_Description_clone(uint32_t orig) {
- LDKDescription orig_conv;
+void __attribute__((visibility("default"))) TS_PayeePubKey_free(uint32_t this_obj) {
+ LDKPayeePubKey this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ PayeePubKey_free(this_obj_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_PayeePubKey_clone(uint32_t orig) {
+ LDKPayeePubKey orig_conv;
orig_conv.inner = (void*)(orig & (~1));
orig_conv.is_owned = false;
- LDKDescription ret_var = Description_clone(&orig_conv);
+ LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_ref;
}
-void __attribute__((visibility("default"))) TS_PayeePubKey_free(uint32_t this_obj) {
- LDKPayeePubKey this_obj_conv;
- this_obj_conv.inner = (void*)(this_obj & (~1));
- this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
- PayeePubKey_free(this_obj_conv);
+int64_t __attribute__((visibility("default"))) TS_PayeePubKey_hash(uint32_t o) {
+ LDKPayeePubKey o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = PayeePubKey_hash(&o_conv);
+ return ret_val;
}
jboolean __attribute__((visibility("default"))) TS_PayeePubKey_eq(uint32_t a, uint32_t b) {
return ret_val;
}
-uint32_t __attribute__((visibility("default"))) TS_PayeePubKey_clone(uint32_t orig) {
- LDKPayeePubKey orig_conv;
+void __attribute__((visibility("default"))) TS_ExpiryTime_free(uint32_t this_obj) {
+ LDKExpiryTime this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ ExpiryTime_free(this_obj_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_clone(uint32_t orig) {
+ LDKExpiryTime orig_conv;
orig_conv.inner = (void*)(orig & (~1));
orig_conv.is_owned = false;
- LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
+ LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_ref;
}
-void __attribute__((visibility("default"))) TS_ExpiryTime_free(uint32_t this_obj) {
- LDKExpiryTime this_obj_conv;
- this_obj_conv.inner = (void*)(this_obj & (~1));
- this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
- ExpiryTime_free(this_obj_conv);
+int64_t __attribute__((visibility("default"))) TS_ExpiryTime_hash(uint32_t o) {
+ LDKExpiryTime o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = ExpiryTime_hash(&o_conv);
+ return ret_val;
}
jboolean __attribute__((visibility("default"))) TS_ExpiryTime_eq(uint32_t a, uint32_t b) {
return ret_val;
}
-uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_clone(uint32_t orig) {
- LDKExpiryTime orig_conv;
+void __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_free(uint32_t this_obj) {
+ LDKMinFinalCltvExpiry this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ MinFinalCltvExpiry_free(this_obj_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_clone(uint32_t orig) {
+ LDKMinFinalCltvExpiry orig_conv;
orig_conv.inner = (void*)(orig & (~1));
orig_conv.is_owned = false;
- LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
+ LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_ref;
}
-void __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_free(uint32_t this_obj) {
- LDKMinFinalCltvExpiry this_obj_conv;
- this_obj_conv.inner = (void*)(this_obj & (~1));
- this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
- MinFinalCltvExpiry_free(this_obj_conv);
+int64_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_hash(uint32_t o) {
+ LDKMinFinalCltvExpiry o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = MinFinalCltvExpiry_hash(&o_conv);
+ return ret_val;
}
jboolean __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_eq(uint32_t a, uint32_t b) {
return ret_val;
}
-uint32_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_clone(uint32_t orig) {
- LDKMinFinalCltvExpiry orig_conv;
- orig_conv.inner = (void*)(orig & (~1));
- orig_conv.is_owned = false;
- LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
- CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t ret_ref = (uint64_t)ret_var.inner;
- if (ret_var.is_owned) {
- ret_ref |= 1;
- }
- return ret_ref;
-}
-
void __attribute__((visibility("default"))) TS_Fallback_free(uint32_t this_ptr) {
if ((this_ptr & 1) != 0) return;
LDKFallback this_ptr_conv = *(LDKFallback*)(((uint64_t)this_ptr) & ~1);
return ret_ref;
}
+int64_t __attribute__((visibility("default"))) TS_Fallback_hash(uint32_t o) {
+ LDKFallback* o_conv = (LDKFallback*)o;
+ int64_t ret_val = Fallback_hash(o_conv);
+ return ret_val;
+}
+
jboolean __attribute__((visibility("default"))) TS_Fallback_eq(uint32_t a, uint32_t b) {
LDKFallback* a_conv = (LDKFallback*)a;
LDKFallback* b_conv = (LDKFallback*)b;
InvoiceSignature_free(this_obj_conv);
}
-jboolean __attribute__((visibility("default"))) TS_InvoiceSignature_eq(uint32_t a, uint32_t b) {
- LDKInvoiceSignature a_conv;
- a_conv.inner = (void*)(a & (~1));
- a_conv.is_owned = false;
- LDKInvoiceSignature b_conv;
- b_conv.inner = (void*)(b & (~1));
- b_conv.is_owned = false;
- jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
- return ret_val;
-}
-
uint32_t __attribute__((visibility("default"))) TS_InvoiceSignature_clone(uint32_t orig) {
LDKInvoiceSignature orig_conv;
orig_conv.inner = (void*)(orig & (~1));
return ret_ref;
}
-void __attribute__((visibility("default"))) TS_PrivateRoute_free(uint32_t this_obj) {
- LDKPrivateRoute this_obj_conv;
- this_obj_conv.inner = (void*)(this_obj & (~1));
- this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
- PrivateRoute_free(this_obj_conv);
-}
-
-jboolean __attribute__((visibility("default"))) TS_PrivateRoute_eq(uint32_t a, uint32_t b) {
- LDKPrivateRoute a_conv;
+jboolean __attribute__((visibility("default"))) TS_InvoiceSignature_eq(uint32_t a, uint32_t b) {
+ LDKInvoiceSignature a_conv;
a_conv.inner = (void*)(a & (~1));
a_conv.is_owned = false;
- LDKPrivateRoute b_conv;
+ LDKInvoiceSignature b_conv;
b_conv.inner = (void*)(b & (~1));
b_conv.is_owned = false;
- jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
+ jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
return ret_val;
}
+void __attribute__((visibility("default"))) TS_PrivateRoute_free(uint32_t this_obj) {
+ LDKPrivateRoute this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ PrivateRoute_free(this_obj_conv);
+}
+
uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_clone(uint32_t orig) {
LDKPrivateRoute orig_conv;
orig_conv.inner = (void*)(orig & (~1));
return ret_ref;
}
+int64_t __attribute__((visibility("default"))) TS_PrivateRoute_hash(uint32_t o) {
+ LDKPrivateRoute o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = PrivateRoute_hash(&o_conv);
+ return ret_val;
+}
+
+jboolean __attribute__((visibility("default"))) TS_PrivateRoute_eq(uint32_t a, uint32_t b) {
+ LDKPrivateRoute a_conv;
+ a_conv.inner = (void*)(a & (~1));
+ a_conv.is_owned = false;
+ LDKPrivateRoute b_conv;
+ b_conv.inner = (void*)(b & (~1));
+ b_conv.is_owned = false;
+ jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
+ return ret_val;
+}
+
uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_into_parts(uint32_t this_arg) {
LDKSignedRawInvoice this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
return ret_conv;
}
+uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_payment_secret() {
+ uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
+ return ret_conv;
+}
+
uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_payment_secrets() {
uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
return ret_conv;
return ret_conv;
}
+uint32_t __attribute__((visibility("default"))) TS_SemanticError_imprecise_amount() {
+ uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
+ return ret_conv;
+}
+
jboolean __attribute__((visibility("default"))) TS_SemanticError_eq(uint32_t a, uint32_t b) {
LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
LDKCurrency network_conv = LDKCurrency_from_js(network);
LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1);
+ amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1));
LDKStr description_conv = str_ref_to_owned_c(description);
LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
*ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
case 1: return LDKSemanticError_MultiplePaymentHashes;
case 2: return LDKSemanticError_NoDescription;
case 3: return LDKSemanticError_MultipleDescriptions;
- case 4: return LDKSemanticError_MultiplePaymentSecrets;
- case 5: return LDKSemanticError_InvalidFeatures;
- case 6: return LDKSemanticError_InvalidRecoveryId;
- case 7: return LDKSemanticError_InvalidSignature;
+ case 4: return LDKSemanticError_NoPaymentSecret;
+ case 5: return LDKSemanticError_MultiplePaymentSecrets;
+ case 6: return LDKSemanticError_InvalidFeatures;
+ case 7: return LDKSemanticError_InvalidRecoveryId;
+ case 8: return LDKSemanticError_InvalidSignature;
+ case 9: return LDKSemanticError_ImpreciseAmount;
}
abort();
}
case LDKSemanticError_MultiplePaymentHashes: return 1;
case LDKSemanticError_NoDescription: return 2;
case LDKSemanticError_MultipleDescriptions: return 3;
- case LDKSemanticError_MultiplePaymentSecrets: return 4;
- case LDKSemanticError_InvalidFeatures: return 5;
- case LDKSemanticError_InvalidRecoveryId: return 6;
- case LDKSemanticError_InvalidSignature: return 7;
+ case LDKSemanticError_NoPaymentSecret: return 4;
+ case LDKSemanticError_MultiplePaymentSecrets: return 5;
+ case LDKSemanticError_InvalidFeatures: return 6;
+ case LDKSemanticError_InvalidRecoveryId: return 7;
+ case LDKSemanticError_InvalidSignature: return 8;
+ case LDKSemanticError_ImpreciseAmount: return 9;
default: abort();
}
}
uint64_t err_ref = (uint64_t)err_var.inner & ~1;
return err_ref;
}
+jboolean __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_result_ok(uint32_t arg) {
+ return ((LDKCResult_TrustedClosingTransactionNoneZ*)arg)->result_ok;
+}
+uint32_t __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_get_ok(uint32_t arg) {
+ LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
+ CHECK(val->result_ok);
+ LDKTrustedClosingTransaction res_var = (*val->contents.result);
+ CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t res_ref = (uint64_t)res_var.inner & ~1;
+ return res_ref;
+}
+void __attribute__((visibility("default"))) TS_LDKCResult_TrustedClosingTransactionNoneZ_get_err(uint32_t arg) {
+ LDKCResult_TrustedClosingTransactionNoneZ *val = (LDKCResult_TrustedClosingTransactionNoneZ*)(arg & ~1);
+ CHECK(!val->result_ok);
+ return *val->contents.err;
+}
jboolean __attribute__((visibility("default"))) TS_LDKCResult_CommitmentTransactionDecodeErrorZ_result_ok(uint32_t arg) {
return ((LDKCResult_CommitmentTransactionDecodeErrorZ*)arg)->result_ok;
}
uint64_t htlc_event_ref = (uint64_t)htlc_event_var.inner & ~1;
return 0 /* LDKMonitorEvent - HTLCEvent */; (void) htlc_event_ref;
}
- case LDKMonitorEvent_CommitmentTxBroadcasted: {
- LDKOutPoint commitment_tx_broadcasted_var = obj->commitment_tx_broadcasted;
- CHECK((((uint64_t)commitment_tx_broadcasted_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&commitment_tx_broadcasted_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t commitment_tx_broadcasted_ref = (uint64_t)commitment_tx_broadcasted_var.inner & ~1;
- return 0 /* LDKMonitorEvent - CommitmentTxBroadcasted */; (void) commitment_tx_broadcasted_ref;
+ case LDKMonitorEvent_CommitmentTxConfirmed: {
+ LDKOutPoint commitment_tx_confirmed_var = obj->commitment_tx_confirmed;
+ CHECK((((uint64_t)commitment_tx_confirmed_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&commitment_tx_confirmed_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t commitment_tx_confirmed_ref = (uint64_t)commitment_tx_confirmed_var.inner & ~1;
+ return 0 /* LDKMonitorEvent - CommitmentTxConfirmed */; (void) commitment_tx_confirmed_ref;
}
default: abort();
}
default: abort();
}
}
+uint32_t __attribute__((visibility("default"))) TS_LDKNetworkUpdate_ref_from_ptr(uint32_t ptr) {
+ LDKNetworkUpdate *obj = (LDKNetworkUpdate*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKNetworkUpdate_ChannelUpdateMessage: {
+ LDKChannelUpdate msg_var = obj->channel_update_message.msg;
+ CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
+ return 0 /* LDKNetworkUpdate - ChannelUpdateMessage */; (void) msg_ref;
+ }
+ case LDKNetworkUpdate_ChannelClosed: {
+ return 0 /* LDKNetworkUpdate - ChannelClosed */; (void) obj->channel_closed.short_channel_id; (void) obj->channel_closed.is_permanent;
+ }
+ case LDKNetworkUpdate_NodeFailure: {
+ int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(node_id_arr + 4), obj->node_failure.node_id.compressed_form, 33);
+ return 0 /* LDKNetworkUpdate - NodeFailure */; (void) node_id_arr; (void) obj->node_failure.is_permanent;
+ }
+ default: abort();
+ }
+}
+uint32_t __attribute__((visibility("default"))) TS_LDKCOption_NetworkUpdateZ_ref_from_ptr(uint32_t ptr) {
+ LDKCOption_NetworkUpdateZ *obj = (LDKCOption_NetworkUpdateZ*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKCOption_NetworkUpdateZ_Some: {
+ uint64_t some_ref = ((uint64_t)&obj->some) | 1;
+ return 0 /* LDKCOption_NetworkUpdateZ - Some */; (void) some_ref;
+ }
+ case LDKCOption_NetworkUpdateZ_None: {
+ return 0 /* LDKCOption_NetworkUpdateZ - None */;
+ }
+ default: abort();
+ }
+}
uint32_t __attribute__((visibility("default"))) TS_LDKSpendableOutputDescriptor_ref_from_ptr(uint32_t ptr) {
LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)(ptr & ~1);
switch(obj->tag) {
default: abort();
}
}
-uint32_t __attribute__((visibility("default"))) TS_LDKHTLCFailChannelUpdate_ref_from_ptr(uint32_t ptr) {
- LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)(ptr & ~1);
- switch(obj->tag) {
- case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
- LDKChannelUpdate msg_var = obj->channel_update_message.msg;
- CHECK((((uint64_t)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t msg_ref = (uint64_t)msg_var.inner & ~1;
- return 0 /* LDKHTLCFailChannelUpdate - ChannelUpdateMessage */; (void) msg_ref;
- }
- case LDKHTLCFailChannelUpdate_ChannelClosed: {
- return 0 /* LDKHTLCFailChannelUpdate - ChannelClosed */; (void) obj->channel_closed.short_channel_id; (void) obj->channel_closed.is_permanent;
- }
- case LDKHTLCFailChannelUpdate_NodeFailure: {
- int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
- memcpy((uint8_t*)(node_id_arr + 4), obj->node_failure.node_id.compressed_form, 33);
- return 0 /* LDKHTLCFailChannelUpdate - NodeFailure */; (void) node_id_arr; (void) obj->node_failure.is_permanent;
- }
- default: abort();
- }
-}
uint32_t __attribute__((visibility("default"))) TS_LDKMessageSendEvent_ref_from_ptr(uint32_t ptr) {
LDKMessageSendEvent *obj = (LDKMessageSendEvent*)(ptr & ~1);
switch(obj->tag) {
uint64_t action_ref = ((uint64_t)&obj->handle_error.action) | 1;
return 0 /* LDKMessageSendEvent - HandleError */; (void) node_id_arr; (void) action_ref;
}
- case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
- uint64_t update_ref = ((uint64_t)&obj->payment_failure_network_update.update) | 1;
- return 0 /* LDKMessageSendEvent - PaymentFailureNetworkUpdate */; (void) update_ref;
- }
case LDKMessageSendEvent_SendChannelRangeQuery: {
int8_tArray node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
memcpy((uint8_t*)(node_id_arr + 4), obj->send_channel_range_query.node_id.compressed_form, 33);
uint64_t err_ref = (uint64_t)err_var.inner & ~1;
return err_ref;
}
+jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_result_ok(uint32_t arg) {
+ return ((LDKCResult_NoneNoneZ*)arg)->result_ok;
+}
+void __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_get_ok(uint32_t arg) {
+ LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
+ CHECK(val->result_ok);
+ return *val->contents.result;
+}
+void __attribute__((visibility("default"))) TS_LDKCResult_NoneNoneZ_get_err(uint32_t arg) {
+ LDKCResult_NoneNoneZ *val = (LDKCResult_NoneNoneZ*)(arg & ~1);
+ CHECK(!val->result_ok);
+ return *val->contents.err;
+}
uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_SignatureCVec_SignatureZZ_new(int8_tArray a, ptrArray b) {
LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
LDKSignature a_ref;
atomic_size_t refcnt;
uint32_t get_per_commitment_point_meth;
uint32_t release_commitment_secret_meth;
+ uint32_t validate_holder_commitment_meth;
uint32_t channel_keys_id_meth;
uint32_t sign_counterparty_commitment_meth;
+ uint32_t validate_counterparty_revocation_meth;
uint32_t sign_holder_commitment_and_htlcs_meth;
uint32_t sign_justice_revoked_output_meth;
uint32_t sign_justice_revoked_htlc_meth;
if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
js_free(j_calls->get_per_commitment_point_meth);
js_free(j_calls->release_commitment_secret_meth);
+ js_free(j_calls->validate_holder_commitment_meth);
js_free(j_calls->channel_keys_id_meth);
js_free(j_calls->sign_counterparty_commitment_meth);
+ js_free(j_calls->validate_counterparty_revocation_meth);
js_free(j_calls->sign_holder_commitment_and_htlcs_meth);
js_free(j_calls->sign_justice_revoked_output_meth);
js_free(j_calls->sign_justice_revoked_htlc_meth);
memcpy(ret_ref.data, (uint8_t*)(ret + 4), 32);
return ret_ref;
}
+LDKCResult_NoneNoneZ validate_holder_commitment_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * holder_tx) {
+ LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
+ LDKHolderCommitmentTransaction holder_tx_var = *holder_tx;
+ holder_tx_var = HolderCommitmentTransaction_clone(holder_tx);
+ CHECK((((uint64_t)holder_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&holder_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t holder_tx_ref = (uint64_t)holder_tx_var.inner;
+ if (holder_tx_var.is_owned) {
+ holder_tx_ref |= 1;
+ }
+ uint32_t ret = js_invoke_function_1(j_calls->validate_holder_commitment_meth, holder_tx_ref);
+ LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1);
+ ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
+ return ret_conv;
+}
LDKThirtyTwoBytes channel_keys_id_LDKBaseSign_jcall(const void* this_arg) {
LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
int8_tArray ret = js_invoke_function_0(j_calls->channel_keys_id_meth);
ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(((uint64_t)ret) & ~1));
return ret_conv;
}
+LDKCResult_NoneNoneZ validate_counterparty_revocation_LDKBaseSign_jcall(const void* this_arg, uint64_t idx, const uint8_t (* secret)[32]) {
+ LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
+ int8_tArray secret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(secret_arr + 4), *secret, 32);
+ uint32_t ret = js_invoke_function_2(j_calls->validate_counterparty_revocation_meth, idx, secret_arr);
+ LDKCResult_NoneNoneZ ret_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1);
+ ret_conv = CResult_NoneNoneZ_clone((LDKCResult_NoneNoneZ*)(((uint64_t)ret) & ~1));
+ return ret_conv;
+}
LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs_LDKBaseSign_jcall(const void* this_arg, const LDKHolderCommitmentTransaction * commitment_tx) {
LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
LDKHolderCommitmentTransaction commitment_tx_var = *commitment_tx;
ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
return ret_conv;
}
-LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, LDKTransaction closing_tx) {
+LDKCResult_SignatureNoneZ sign_closing_transaction_LDKBaseSign_jcall(const void* this_arg, const LDKClosingTransaction * closing_tx) {
LDKBaseSign_JCalls *j_calls = (LDKBaseSign_JCalls*) this_arg;
- LDKTransaction closing_tx_var = closing_tx;
- int8_tArray closing_tx_arr = init_arr(closing_tx_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
- memcpy((uint8_t*)(closing_tx_arr + 4), closing_tx_var.data, closing_tx_var.datalen);
- Transaction_free(closing_tx_var);
- uint32_t ret = js_invoke_function_1(j_calls->sign_closing_transaction_meth, closing_tx_arr);
+ LDKClosingTransaction closing_tx_var = *closing_tx;
+ // Warning: we may need a move here but no clone is available for LDKClosingTransaction
+ CHECK((((uint64_t)closing_tx_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&closing_tx_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t closing_tx_ref = (uint64_t)closing_tx_var.inner;
+ if (closing_tx_var.is_owned) {
+ closing_tx_ref |= 1;
+ }
+ uint32_t ret = js_invoke_function_1(j_calls->sign_closing_transaction_meth, closing_tx_ref);
LDKCResult_SignatureNoneZ ret_conv = *(LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1);
ret_conv = CResult_SignatureNoneZ_clone((LDKCResult_SignatureNoneZ*)(((uint64_t)ret) & ~1));
return ret_conv;
.this_arg = (void*) calls,
.get_per_commitment_point = get_per_commitment_point_LDKBaseSign_jcall,
.release_commitment_secret = release_commitment_secret_LDKBaseSign_jcall,
+ .validate_holder_commitment = validate_holder_commitment_LDKBaseSign_jcall,
.channel_keys_id = channel_keys_id_LDKBaseSign_jcall,
.sign_counterparty_commitment = sign_counterparty_commitment_LDKBaseSign_jcall,
+ .validate_counterparty_revocation = validate_counterparty_revocation_LDKBaseSign_jcall,
.sign_holder_commitment_and_htlcs = sign_holder_commitment_and_htlcs_LDKBaseSign_jcall,
.sign_justice_revoked_output = sign_justice_revoked_output_LDKBaseSign_jcall,
.sign_justice_revoked_htlc = sign_justice_revoked_htlc_LDKBaseSign_jcall,
return ret_arr;
}
+uint32_t __attribute__((visibility("default"))) TS_BaseSign_validate_holder_commitment(uint32_t this_arg, uint32_t holder_tx) {
+ LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
+ LDKHolderCommitmentTransaction holder_tx_conv;
+ holder_tx_conv.inner = (void*)(holder_tx & (~1));
+ holder_tx_conv.is_owned = false;
+ LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
+ *ret_conv = (this_arg_conv->validate_holder_commitment)(this_arg_conv->this_arg, &holder_tx_conv);
+ return (uint64_t)ret_conv;
+}
+
int8_tArray __attribute__((visibility("default"))) TS_BaseSign_channel_keys_id(uint32_t this_arg) {
LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
return (uint64_t)ret_conv;
}
+uint32_t __attribute__((visibility("default"))) TS_BaseSign_validate_counterparty_revocation(uint32_t this_arg, int64_t idx, int8_tArray secret) {
+ LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
+ unsigned char secret_arr[32];
+ CHECK(*((uint32_t*)secret) == 32);
+ memcpy(secret_arr, (uint8_t*)(secret + 4), 32);
+ unsigned char (*secret_ref)[32] = &secret_arr;
+ LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
+ *ret_conv = (this_arg_conv->validate_counterparty_revocation)(this_arg_conv->this_arg, idx, secret_ref);
+ return (uint64_t)ret_conv;
+}
+
uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_holder_commitment_and_htlcs(uint32_t this_arg, uint32_t commitment_tx) {
LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
LDKHolderCommitmentTransaction commitment_tx_conv;
return (uint64_t)ret_conv;
}
-uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_closing_transaction(uint32_t this_arg, int8_tArray closing_tx) {
+uint32_t __attribute__((visibility("default"))) TS_BaseSign_sign_closing_transaction(uint32_t this_arg, uint32_t closing_tx) {
LDKBaseSign* this_arg_conv = (LDKBaseSign*)(((uint64_t)this_arg) & ~1);
- LDKTransaction closing_tx_ref;
- closing_tx_ref.datalen = *((uint32_t*)closing_tx);
- closing_tx_ref.data = MALLOC(closing_tx_ref.datalen, "LDKTransaction Bytes");
- memcpy(closing_tx_ref.data, (uint8_t*)(closing_tx + 4), closing_tx_ref.datalen);
- closing_tx_ref.data_is_owned = true;
+ LDKClosingTransaction closing_tx_conv;
+ closing_tx_conv.inner = (void*)(closing_tx & (~1));
+ closing_tx_conv.is_owned = false;
LDKCResult_SignatureNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
- *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_ref);
+ *ret_conv = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, &closing_tx_conv);
return (uint64_t)ret_conv;
}
uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_ok(uint32_t arg) {
LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
CHECK(val->result_ok);
- LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
- *ret = Sign_clone(&(*val->contents.result));
- return (uint64_t)ret;
+ LDKSign* res_ret =MALLOC(sizeof(LDKSign), "LDKSign");
+ *res_ret = Sign_clone(&(*val->contents.result));
+ return (uint64_t)res_ret;
}
uint32_t __attribute__((visibility("default"))) TS_LDKCResult_SignDecodeErrorZ_get_err(uint32_t arg) {
LDKCResult_SignDecodeErrorZ *val = (LDKCResult_SignDecodeErrorZ*)(arg & ~1);
uint32_t __attribute__((visibility("default"))) TS_KeysInterface_get_channel_signer(uint32_t this_arg, jboolean inbound, int64_t channel_value_satoshis) {
LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)(((uint64_t)this_arg) & ~1);
- LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
- *ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
- return (uint64_t)ret;
+ LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
+ *ret_ret = (this_arg_conv->get_channel_signer)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
+ return (uint64_t)ret_ret;
}
int8_tArray __attribute__((visibility("default"))) TS_KeysInterface_get_secure_random_bytes(uint32_t this_arg) {
uint64_t err_ref = (uint64_t)err_var.inner & ~1;
return err_ref;
}
+typedef struct LDKType_JCalls {
+ atomic_size_t refcnt;
+ uint32_t type_id_meth;
+ uint32_t debug_str_meth;
+ uint32_t write_meth;
+} LDKType_JCalls;
+static void LDKType_JCalls_free(void* this_arg) {
+ LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
+ if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
+ js_free(j_calls->type_id_meth);
+ js_free(j_calls->debug_str_meth);
+ js_free(j_calls->write_meth);
+ FREE(j_calls);
+ }
+}
+uint16_t type_id_LDKType_jcall(const void* this_arg) {
+ LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
+ return js_invoke_function_0(j_calls->type_id_meth);
+}
+LDKStr debug_str_LDKType_jcall(const void* this_arg) {
+ LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
+ uint32_t ret = js_invoke_function_0(j_calls->debug_str_meth);
+ LDKStr ret_conv = str_ref_to_owned_c(ret);
+ return ret_conv;
+}
+LDKCVec_u8Z write_LDKType_jcall(const void* this_arg) {
+ LDKType_JCalls *j_calls = (LDKType_JCalls*) this_arg;
+ int8_tArray ret = js_invoke_function_0(j_calls->write_meth);
+ LDKCVec_u8Z ret_ref;
+ ret_ref.datalen = *((uint32_t*)ret);
+ ret_ref.data = MALLOC(ret_ref.datalen, "LDKCVec_u8Z Bytes");
+ memcpy(ret_ref.data, (uint8_t*)(ret + 4), ret_ref.datalen);
+ return ret_ref;
+}
+static void LDKType_JCalls_cloned(LDKType* new_obj) {
+ LDKType_JCalls *j_calls = (LDKType_JCalls*) new_obj->this_arg;
+ atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
+}
+static inline LDKType LDKType_init (/*TODO: JS Object Reference */void* o) {
+ LDKType_JCalls *calls = MALLOC(sizeof(LDKType_JCalls), "LDKType_JCalls");
+ atomic_init(&calls->refcnt, 1);
+ //TODO: Assign calls->o from o
+
+ LDKType ret = {
+ .this_arg = (void*) calls,
+ .type_id = type_id_LDKType_jcall,
+ .debug_str = debug_str_LDKType_jcall,
+ .write = write_LDKType_jcall,
+ .cloned = LDKType_JCalls_cloned,
+ .free = LDKType_JCalls_free,
+ };
+ return ret;
+}
+long __attribute__((visibility("default"))) TS_LDKType_new(/*TODO: JS Object Reference */void* o) {
+ LDKType *res_ptr = MALLOC(sizeof(LDKType), "LDKType");
+ *res_ptr = LDKType_init(o);
+ return (long)res_ptr;
+}
+int16_t __attribute__((visibility("default"))) TS_Type_type_id(uint32_t this_arg) {
+ LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
+ int16_t ret_val = (this_arg_conv->type_id)(this_arg_conv->this_arg);
+ return ret_val;
+}
+
+jstring __attribute__((visibility("default"))) TS_Type_debug_str(uint32_t this_arg) {
+ LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
+ LDKStr ret_str = (this_arg_conv->debug_str)(this_arg_conv->this_arg);
+ jstring ret_conv = str_ref_to_ts(ret_str.chars, ret_str.len);
+ Str_free(ret_str);
+ return ret_conv;
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_Type_write(uint32_t this_arg) {
+ LDKType* this_arg_conv = (LDKType*)(((uint64_t)this_arg) & ~1);
+ LDKCVec_u8Z ret_var = (this_arg_conv->write)(this_arg_conv->this_arg);
+ int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_LDKCOption_TypeZ_ref_from_ptr(uint32_t ptr) {
+ LDKCOption_TypeZ *obj = (LDKCOption_TypeZ*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKCOption_TypeZ_Some: {
+ LDKType* some_ret =MALLOC(sizeof(LDKType), "LDKType");
+ *some_ret = Type_clone(&obj->some);
+ return 0 /* LDKCOption_TypeZ - Some */; (void) (uint64_t)some_ret;
+ }
+ case LDKCOption_TypeZ_None: {
+ return 0 /* LDKCOption_TypeZ - None */;
+ }
+ default: abort();
+ }
+}
+jboolean __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_result_ok(uint32_t arg) {
+ return ((LDKCResult_COption_TypeZDecodeErrorZ*)arg)->result_ok;
+}
+uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_get_ok(uint32_t arg) {
+ LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
+ CHECK(val->result_ok);
+ uint64_t res_ref = ((uint64_t)&(*val->contents.result)) | 1;
+ return res_ref;
+}
+uint32_t __attribute__((visibility("default"))) TS_LDKCResult_COption_TypeZDecodeErrorZ_get_err(uint32_t arg) {
+ LDKCResult_COption_TypeZDecodeErrorZ *val = (LDKCResult_COption_TypeZDecodeErrorZ*)(arg & ~1);
+ CHECK(!val->result_ok);
+ LDKDecodeError err_var = (*val->contents.err);
+ CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t err_ref = (uint64_t)err_var.inner & ~1;
+ return err_ref;
+}
jboolean __attribute__((visibility("default"))) TS_LDKCResult_SiPrefixNoneZ_result_ok(uint32_t arg) {
return ((LDKCResult_SiPrefixNoneZ*)arg)->result_ok;
}
default: abort();
}
}
+uint32_t __attribute__((visibility("default"))) TS_LDKClosureReason_ref_from_ptr(uint32_t ptr) {
+ LDKClosureReason *obj = (LDKClosureReason*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKClosureReason_CounterpartyForceClosed: {
+ LDKStr peer_msg_str = obj->counterparty_force_closed.peer_msg;
+ jstring peer_msg_conv = str_ref_to_ts(peer_msg_str.chars, peer_msg_str.len);
+ return 0 /* LDKClosureReason - CounterpartyForceClosed */; (void) peer_msg_conv;
+ }
+ case LDKClosureReason_HolderForceClosed: {
+ return 0 /* LDKClosureReason - HolderForceClosed */;
+ }
+ case LDKClosureReason_CooperativeClosure: {
+ return 0 /* LDKClosureReason - CooperativeClosure */;
+ }
+ case LDKClosureReason_CommitmentTxConfirmed: {
+ return 0 /* LDKClosureReason - CommitmentTxConfirmed */;
+ }
+ case LDKClosureReason_ProcessingError: {
+ LDKStr err_str = obj->processing_error.err;
+ jstring err_conv = str_ref_to_ts(err_str.chars, err_str.len);
+ return 0 /* LDKClosureReason - ProcessingError */; (void) err_conv;
+ }
+ case LDKClosureReason_DisconnectedPeer: {
+ return 0 /* LDKClosureReason - DisconnectedPeer */;
+ }
+ case LDKClosureReason_OutdatedChannelManager: {
+ return 0 /* LDKClosureReason - OutdatedChannelManager */;
+ }
+ default: abort();
+ }
+}
uint32_t __attribute__((visibility("default"))) TS_LDKEvent_ref_from_ptr(uint32_t ptr) {
LDKEvent *obj = (LDKEvent*)(ptr & ~1);
switch(obj->tag) {
memcpy((uint8_t*)(payment_preimage_arr + 4), obj->payment_sent.payment_preimage.data, 32);
return 0 /* LDKEvent - PaymentSent */; (void) payment_preimage_arr;
}
- case LDKEvent_PaymentFailed: {
+ case LDKEvent_PaymentPathFailed: {
int8_tArray payment_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
- memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_failed.payment_hash.data, 32);
- return 0 /* LDKEvent - PaymentFailed */; (void) payment_hash_arr; (void) obj->payment_failed.rejected_by_dest;
+ memcpy((uint8_t*)(payment_hash_arr + 4), obj->payment_path_failed.payment_hash.data, 32);
+ uint64_t network_update_ref = ((uint64_t)&obj->payment_path_failed.network_update) | 1;
+ LDKCVec_RouteHopZ path_var = obj->payment_path_failed.path;
+ uint32_tArray path_arr = init_arr(path_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
+ uint32_t *path_arr_ptr = (uint32_t*)(path_arr + 4);
+ for (size_t k = 0; k < path_var.datalen; k++) {
+ LDKRouteHop path_conv_10_var = path_var.data[k];
+ CHECK((((uint64_t)path_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&path_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t path_conv_10_ref = (uint64_t)path_conv_10_var.inner & ~1;
+ path_arr_ptr[k] = path_conv_10_ref;
+ }
+ return 0 /* LDKEvent - PaymentPathFailed */; (void) payment_hash_arr; (void) obj->payment_path_failed.rejected_by_dest; (void) network_update_ref; (void) obj->payment_path_failed.all_paths_failed; (void) path_arr;
}
case LDKEvent_PendingHTLCsForwardable: {
return 0 /* LDKEvent - PendingHTLCsForwardable */; (void) obj->pending_htl_cs_forwardable.time_forwardable;
uint64_t fee_earned_msat_ref = ((uint64_t)&obj->payment_forwarded.fee_earned_msat) | 1;
return 0 /* LDKEvent - PaymentForwarded */; (void) fee_earned_msat_ref; (void) obj->payment_forwarded.claim_from_onchain_tx;
}
+ case LDKEvent_ChannelClosed: {
+ int8_tArray channel_id_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(channel_id_arr + 4), obj->channel_closed.channel_id.data, 32);
+ uint64_t reason_ref = ((uint64_t)&obj->channel_closed.reason) | 1;
+ return 0 /* LDKEvent - ChannelClosed */; (void) channel_id_arr; (void) reason_ref;
+ }
default: abort();
}
}
}
return ret;
}
+uint32_t __attribute__((visibility("default"))) TS_LDKBalance_ref_from_ptr(uint32_t ptr) {
+ LDKBalance *obj = (LDKBalance*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKBalance_ClaimableOnChannelClose: {
+ return 0 /* LDKBalance - ClaimableOnChannelClose */; (void) obj->claimable_on_channel_close.claimable_amount_satoshis;
+ }
+ case LDKBalance_ClaimableAwaitingConfirmations: {
+ return 0 /* LDKBalance - ClaimableAwaitingConfirmations */; (void) obj->claimable_awaiting_confirmations.claimable_amount_satoshis; (void) obj->claimable_awaiting_confirmations.confirmation_height;
+ }
+ case LDKBalance_ContentiousClaimable: {
+ return 0 /* LDKBalance - ContentiousClaimable */; (void) obj->contentious_claimable.claimable_amount_satoshis; (void) obj->contentious_claimable.timeout_height;
+ }
+ case LDKBalance_MaybeClaimableHTLCAwaitingTimeout: {
+ return 0 /* LDKBalance - MaybeClaimableHTLCAwaitingTimeout */; (void) obj->maybe_claimable_htlc_awaiting_timeout.claimable_amount_satoshis; (void) obj->maybe_claimable_htlc_awaiting_timeout.claimable_height;
+ }
+ default: abort();
+ }
+}
+uint32_t __attribute__((visibility("default"))) TS_LDKCVec_BalanceZ_new(uint32_tArray elems) {
+ LDKCVec_BalanceZ *ret = MALLOC(sizeof(LDKCVec_BalanceZ), "LDKCVec_BalanceZ");
+ ret->datalen = *((uint32_t*)elems);
+ if (ret->datalen == 0) {
+ ret->data = NULL;
+ } else {
+ ret->data = MALLOC(sizeof(LDKBalance) * ret->datalen, "LDKCVec_BalanceZ Data");
+ uint32_t *java_elems = (uint32_t*)(elems + 4);
+ for (size_t i = 0; i < ret->datalen; i++) {
+ uint32_t arr_elem = java_elems[i];
+ LDKBalance arr_elem_conv = *(LDKBalance*)(((uint64_t)arr_elem) & ~1);
+ arr_elem_conv = Balance_clone((LDKBalance*)(((uint64_t)arr_elem) & ~1));
+ ret->data[i] = arr_elem_conv;
+ }
+ }
+ return (uint64_t)ret;
+}
+static inline LDKCVec_BalanceZ CVec_BalanceZ_clone(const LDKCVec_BalanceZ *orig) {
+ LDKCVec_BalanceZ ret = { .data = MALLOC(sizeof(LDKBalance) * orig->datalen, "LDKCVec_BalanceZ clone bytes"), .datalen = orig->datalen };
+ for (size_t i = 0; i < ret.datalen; i++) {
+ ret.data[i] = Balance_clone(&orig->data[i]);
+ }
+ return ret;
+}
jboolean __attribute__((visibility("default"))) TS_LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_result_ok(uint32_t arg) {
return ((LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ*)arg)->result_ok;
}
uint64_t err_ref = (uint64_t)err_var.inner & ~1;
return err_ref;
}
+jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_result_ok(uint32_t arg) {
+ return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
+}
+void __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_ok(uint32_t arg) {
+ LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
+ CHECK(val->result_ok);
+ return *val->contents.result;
+}
+uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_err(uint32_t arg) {
+ LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
+ CHECK(!val->result_ok);
+ LDKLightningError err_var = (*val->contents.err);
+ CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t err_ref = (uint64_t)err_var.inner & ~1;
+ return err_ref;
+}
+uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint32_t b) {
+ LDKC2Tuple_PublicKeyTypeZ* ret = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
+ LDKPublicKey a_ref;
+ CHECK(*((uint32_t*)a) == 33);
+ memcpy(a_ref.compressed_form, (uint8_t*)(a + 4), 33);
+ ret->a = a_ref;
+ LDKType b_conv = *(LDKType*)(((uint64_t)b) & ~1);
+ b_conv = Type_clone(&b_conv);
+ ret->b = b_conv;
+ return (uint64_t)ret;
+}
+int8_tArray __attribute__((visibility("default"))) TS_LDKC2Tuple_PublicKeyTypeZ_get_a(uint32_t ptr) {
+ LDKC2Tuple_PublicKeyTypeZ *tuple = (LDKC2Tuple_PublicKeyTypeZ*)(ptr & ~1);
+ int8_tArray a_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(a_arr + 4), tuple->a.compressed_form, 33);
+ return a_arr;
+}
+uint32_t __attribute__((visibility("default"))) TS_LDKC2Tuple_PublicKeyTypeZ_get_b(uint32_t ptr) {
+ LDKC2Tuple_PublicKeyTypeZ *tuple = (LDKC2Tuple_PublicKeyTypeZ*)(ptr & ~1);
+ LDKType* b_ret =MALLOC(sizeof(LDKType), "LDKType");
+ *b_ret = Type_clone(&tuple->b);
+ return (uint64_t)b_ret;
+}
+uint32_t __attribute__((visibility("default"))) TS_LDKCVec_C2Tuple_PublicKeyTypeZZ_new(uint32_tArray elems) {
+ LDKCVec_C2Tuple_PublicKeyTypeZZ *ret = MALLOC(sizeof(LDKCVec_C2Tuple_PublicKeyTypeZZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ");
+ ret->datalen = *((uint32_t*)elems);
+ if (ret->datalen == 0) {
+ ret->data = NULL;
+ } else {
+ ret->data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * ret->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ Data");
+ uint32_t *java_elems = (uint32_t*)(elems + 4);
+ for (size_t i = 0; i < ret->datalen; i++) {
+ uint32_t arr_elem = java_elems[i];
+ LDKC2Tuple_PublicKeyTypeZ arr_elem_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1);
+ arr_elem_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)arr_elem) & ~1));
+ ret->data[i] = arr_elem_conv;
+ }
+ }
+ return (uint64_t)ret;
+}
+static inline LDKCVec_C2Tuple_PublicKeyTypeZZ CVec_C2Tuple_PublicKeyTypeZZ_clone(const LDKCVec_C2Tuple_PublicKeyTypeZZ *orig) {
+ LDKCVec_C2Tuple_PublicKeyTypeZZ ret = { .data = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ) * orig->datalen, "LDKCVec_C2Tuple_PublicKeyTypeZZ clone bytes"), .datalen = orig->datalen };
+ for (size_t i = 0; i < ret.datalen; i++) {
+ ret.data[i] = C2Tuple_PublicKeyTypeZ_clone(&orig->data[i]);
+ }
+ return ret;
+}
jboolean __attribute__((visibility("default"))) TS_LDKCResult_boolLightningErrorZ_result_ok(uint32_t arg) {
return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
}
}
return ret;
}
-jboolean __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_result_ok(uint32_t arg) {
- return ((LDKCResult_NoneLightningErrorZ*)arg)->result_ok;
-}
-void __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_ok(uint32_t arg) {
- LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
- CHECK(val->result_ok);
- return *val->contents.result;
-}
-uint32_t __attribute__((visibility("default"))) TS_LDKCResult_NoneLightningErrorZ_get_err(uint32_t arg) {
- LDKCResult_NoneLightningErrorZ *val = (LDKCResult_NoneLightningErrorZ*)(arg & ~1);
- CHECK(!val->result_ok);
- LDKLightningError err_var = (*val->contents.err);
- CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t err_ref = (uint64_t)err_var.inner & ~1;
- return err_ref;
-}
jboolean __attribute__((visibility("default"))) TS_LDKCResult_CVec_u8ZPeerHandleErrorZ_result_ok(uint32_t arg) {
return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
}
uint64_t err_ref = (uint64_t)err_var.inner & ~1;
return err_ref;
}
-jboolean __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
- return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
+typedef struct LDKAccess_JCalls {
+ atomic_size_t refcnt;
+ uint32_t get_utxo_meth;
+} LDKAccess_JCalls;
+static void LDKAccess_JCalls_free(void* this_arg) {
+ LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
+ if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
+ js_free(j_calls->get_utxo_meth);
+ FREE(j_calls);
+ }
}
-uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
- LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
- CHECK(val->result_ok);
- LDKDirectionalChannelInfo res_var = (*val->contents.result);
- CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t res_ref = (uint64_t)res_var.inner & ~1;
- return res_ref;
+LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
+ LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
+ int8_tArray genesis_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(genesis_hash_arr + 4), *genesis_hash, 32);
+ uint32_t ret = js_invoke_function_2(j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
+ LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
+ ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
+ return ret_conv;
}
-uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
- LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
- CHECK(!val->result_ok);
- LDKDecodeError err_var = (*val->contents.err);
- CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
+ LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
+ atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
+}
+static inline LDKAccess LDKAccess_init (/*TODO: JS Object Reference */void* o) {
+ LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
+ atomic_init(&calls->refcnt, 1);
+ //TODO: Assign calls->o from o
+
+ LDKAccess ret = {
+ .this_arg = (void*) calls,
+ .get_utxo = get_utxo_LDKAccess_jcall,
+ .free = LDKAccess_JCalls_free,
+ };
+ return ret;
+}
+long __attribute__((visibility("default"))) TS_LDKAccess_new(/*TODO: JS Object Reference */void* o) {
+ LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
+ *res_ptr = LDKAccess_init(o);
+ return (long)res_ptr;
+}
+uint32_t __attribute__((visibility("default"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
+ LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
+ unsigned char genesis_hash_arr[32];
+ CHECK(*((uint32_t*)genesis_hash) == 32);
+ memcpy(genesis_hash_arr, (uint8_t*)(genesis_hash + 4), 32);
+ unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
+ LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
+ *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
+ return (uint64_t)ret_conv;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_LDKCOption_AccessZ_ref_from_ptr(uint32_t ptr) {
+ LDKCOption_AccessZ *obj = (LDKCOption_AccessZ*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKCOption_AccessZ_Some: {
+ LDKAccess* some_ret =MALLOC(sizeof(LDKAccess), "LDKAccess");
+ *some_ret = obj->some;
+ // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
+ return 0 /* LDKCOption_AccessZ - Some */; (void) (uint64_t)some_ret;
+ }
+ case LDKCOption_AccessZ_None: {
+ return 0 /* LDKCOption_AccessZ - None */;
+ }
+ default: abort();
+ }
+}
+jboolean __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_result_ok(uint32_t arg) {
+ return ((LDKCResult_DirectionalChannelInfoDecodeErrorZ*)arg)->result_ok;
+}
+uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_ok(uint32_t arg) {
+ LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
+ CHECK(val->result_ok);
+ LDKDirectionalChannelInfo res_var = (*val->contents.result);
+ CHECK((((uint64_t)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t res_ref = (uint64_t)res_var.inner & ~1;
+ return res_ref;
+}
+uint32_t __attribute__((visibility("default"))) TS_LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_err(uint32_t arg) {
+ LDKCResult_DirectionalChannelInfoDecodeErrorZ *val = (LDKCResult_DirectionalChannelInfoDecodeErrorZ*)(arg & ~1);
+ CHECK(!val->result_ok);
+ LDKDecodeError err_var = (*val->contents.err);
+ CHECK((((uint64_t)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t err_ref = (uint64_t)err_var.inner & ~1;
return err_ref;
}
uint64_t err_ref = ((uint64_t)&(*val->contents.err)) | 1;
return err_ref;
}
+typedef struct LDKFilter_JCalls {
+ atomic_size_t refcnt;
+ uint32_t register_tx_meth;
+ uint32_t register_output_meth;
+} LDKFilter_JCalls;
+static void LDKFilter_JCalls_free(void* this_arg) {
+ LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
+ if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
+ js_free(j_calls->register_tx_meth);
+ js_free(j_calls->register_output_meth);
+ FREE(j_calls);
+ }
+}
+void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
+ LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
+ int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
+ LDKu8slice script_pubkey_var = script_pubkey;
+ int8_tArray script_pubkey_arr = init_arr(script_pubkey_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen);
+ js_invoke_function_2(j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
+}
+LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
+ LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
+ LDKWatchedOutput output_var = output;
+ CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t output_ref = (uint64_t)output_var.inner;
+ if (output_var.is_owned) {
+ output_ref |= 1;
+ }
+ uint32_t ret = js_invoke_function_1(j_calls->register_output_meth, output_ref);
+ LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
+ ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
+ return ret_conv;
+}
+static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
+ LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
+ atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
+}
+static inline LDKFilter LDKFilter_init (/*TODO: JS Object Reference */void* o) {
+ LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
+ atomic_init(&calls->refcnt, 1);
+ //TODO: Assign calls->o from o
+
+ LDKFilter ret = {
+ .this_arg = (void*) calls,
+ .register_tx = register_tx_LDKFilter_jcall,
+ .register_output = register_output_LDKFilter_jcall,
+ .free = LDKFilter_JCalls_free,
+ };
+ return ret;
+}
+long __attribute__((visibility("default"))) TS_LDKFilter_new(/*TODO: JS Object Reference */void* o) {
+ LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
+ *res_ptr = LDKFilter_init(o);
+ return (long)res_ptr;
+}
+void __attribute__((visibility("default"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
+ LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
+ unsigned char txid_arr[32];
+ CHECK(*((uint32_t*)txid) == 32);
+ memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
+ unsigned char (*txid_ref)[32] = &txid_arr;
+ LDKu8slice script_pubkey_ref;
+ script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
+ script_pubkey_ref.data = (int8_t*)(script_pubkey + 4);
+ (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
+ LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
+ LDKWatchedOutput output_conv;
+ output_conv.inner = (void*)(output & (~1));
+ output_conv.is_owned = (output & 1) || (output == 0);
+ output_conv = WatchedOutput_clone(&output_conv);
+ LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
+ *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_LDKCOption_FilterZ_ref_from_ptr(uint32_t ptr) {
+ LDKCOption_FilterZ *obj = (LDKCOption_FilterZ*)(ptr & ~1);
+ switch(obj->tag) {
+ case LDKCOption_FilterZ_Some: {
+ LDKFilter* some_ret =MALLOC(sizeof(LDKFilter), "LDKFilter");
+ *some_ret = obj->some;
+ // Warning: We likely need to clone here, but no clone is available, so we just do it for Java instances
+ return 0 /* LDKCOption_FilterZ - Some */; (void) (uint64_t)some_ret;
+ }
+ case LDKCOption_FilterZ_None: {
+ return 0 /* LDKCOption_FilterZ - None */;
+ }
+ default: abort();
+ }
+}
typedef struct LDKMessageSendEventsProvider_JCalls {
atomic_size_t refcnt;
uint32_t get_and_clear_pending_msg_events_meth;
FREE(j_calls);
}
}
-void handle_event_LDKEventHandler_jcall(const void* this_arg, LDKEvent event) {
+void handle_event_LDKEventHandler_jcall(const void* this_arg, const LDKEvent * event) {
LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) this_arg;
- LDKEvent *event_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
- *event_copy = event;
- uint64_t event_ref = (uint64_t)event_copy;
- js_invoke_function_1(j_calls->handle_event_meth, event_ref);
+ LDKEvent *ret_event = MALLOC(sizeof(LDKEvent), "LDKEvent ret conversion");
+ *ret_event = Event_clone(event);
+ js_invoke_function_1(j_calls->handle_event_meth, (uint64_t)ret_event);
}
static void LDKEventHandler_JCalls_cloned(LDKEventHandler* new_obj) {
LDKEventHandler_JCalls *j_calls = (LDKEventHandler_JCalls*) new_obj->this_arg;
}
void __attribute__((visibility("default"))) TS_EventHandler_handle_event(uint32_t this_arg, uint32_t event) {
LDKEventHandler* this_arg_conv = (LDKEventHandler*)(((uint64_t)this_arg) & ~1);
- LDKEvent event_conv = *(LDKEvent*)(((uint64_t)event) & ~1);
+ LDKEvent* event_conv = (LDKEvent*)event;
(this_arg_conv->handle_event)(this_arg_conv->this_arg, event_conv);
}
}
void process_pending_events_LDKEventsProvider_jcall(const void* this_arg, LDKEventHandler handler) {
LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
- LDKEventHandler* ret = MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
- *ret = handler;
- js_invoke_function_1(j_calls->process_pending_events_meth, (uint64_t)ret);
+ LDKEventHandler* handler_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
+ *handler_ret = handler;
+ js_invoke_function_1(j_calls->process_pending_events_meth, (uint64_t)handler_ret);
}
static void LDKEventsProvider_JCalls_cloned(LDKEventsProvider* new_obj) {
LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) new_obj->this_arg;
(this_arg_conv->process_pending_events)(this_arg_conv->this_arg, handler_conv);
}
-typedef struct LDKAccess_JCalls {
- atomic_size_t refcnt;
- uint32_t get_utxo_meth;
-} LDKAccess_JCalls;
-static void LDKAccess_JCalls_free(void* this_arg) {
- LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
- if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
- js_free(j_calls->get_utxo_meth);
- FREE(j_calls);
- }
-}
-LDKCResult_TxOutAccessErrorZ get_utxo_LDKAccess_jcall(const void* this_arg, const uint8_t (* genesis_hash)[32], uint64_t short_channel_id) {
- LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
- int8_tArray genesis_hash_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
- memcpy((uint8_t*)(genesis_hash_arr + 4), *genesis_hash, 32);
- uint32_t ret = js_invoke_function_2(j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
- LDKCResult_TxOutAccessErrorZ ret_conv = *(LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1);
- ret_conv = CResult_TxOutAccessErrorZ_clone((LDKCResult_TxOutAccessErrorZ*)(((uint64_t)ret) & ~1));
- return ret_conv;
-}
-static void LDKAccess_JCalls_cloned(LDKAccess* new_obj) {
- LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) new_obj->this_arg;
- atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
-}
-static inline LDKAccess LDKAccess_init (/*TODO: JS Object Reference */void* o) {
- LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
- atomic_init(&calls->refcnt, 1);
- //TODO: Assign calls->o from o
-
- LDKAccess ret = {
- .this_arg = (void*) calls,
- .get_utxo = get_utxo_LDKAccess_jcall,
- .free = LDKAccess_JCalls_free,
- };
- return ret;
-}
-long __attribute__((visibility("default"))) TS_LDKAccess_new(/*TODO: JS Object Reference */void* o) {
- LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
- *res_ptr = LDKAccess_init(o);
- return (long)res_ptr;
-}
-uint32_t __attribute__((visibility("default"))) TS_Access_get_utxo(uint32_t this_arg, int8_tArray genesis_hash, int64_t short_channel_id) {
- LDKAccess* this_arg_conv = (LDKAccess*)(((uint64_t)this_arg) & ~1);
- unsigned char genesis_hash_arr[32];
- CHECK(*((uint32_t*)genesis_hash) == 32);
- memcpy(genesis_hash_arr, (uint8_t*)(genesis_hash + 4), 32);
- unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
- LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
- *ret_conv = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
- return (uint64_t)ret_conv;
-}
-
typedef struct LDKListen_JCalls {
atomic_size_t refcnt;
uint32_t block_connected_meth;
return ret_arr;
}
-typedef struct LDKFilter_JCalls {
+typedef struct LDKPersist_JCalls {
atomic_size_t refcnt;
- uint32_t register_tx_meth;
- uint32_t register_output_meth;
-} LDKFilter_JCalls;
-static void LDKFilter_JCalls_free(void* this_arg) {
- LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
+ uint32_t persist_new_channel_meth;
+ uint32_t update_persisted_channel_meth;
+} LDKPersist_JCalls;
+static void LDKPersist_JCalls_free(void* this_arg) {
+ LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
- js_free(j_calls->register_tx_meth);
- js_free(j_calls->register_output_meth);
+ js_free(j_calls->persist_new_channel_meth);
+ js_free(j_calls->update_persisted_channel_meth);
FREE(j_calls);
}
}
-void register_tx_LDKFilter_jcall(const void* this_arg, const uint8_t (* txid)[32], LDKu8slice script_pubkey) {
- LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
- int8_tArray txid_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
- memcpy((uint8_t*)(txid_arr + 4), *txid, 32);
- LDKu8slice script_pubkey_var = script_pubkey;
- int8_tArray script_pubkey_arr = init_arr(script_pubkey_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
- memcpy((uint8_t*)(script_pubkey_arr + 4), script_pubkey_var.data, script_pubkey_var.datalen);
- js_invoke_function_2(j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
-}
-LDKCOption_C2Tuple_usizeTransactionZZ register_output_LDKFilter_jcall(const void* this_arg, LDKWatchedOutput output) {
- LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
- LDKWatchedOutput output_var = output;
- CHECK((((uint64_t)output_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&output_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t output_ref = (uint64_t)output_var.inner;
- if (output_var.is_owned) {
- output_ref |= 1;
+LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
+ LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
+ LDKOutPoint id_var = id;
+ CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t id_ref = (uint64_t)id_var.inner;
+ if (id_var.is_owned) {
+ id_ref |= 1;
}
- uint32_t ret = js_invoke_function_1(j_calls->register_output_meth, output_ref);
- LDKCOption_C2Tuple_usizeTransactionZZ ret_conv = *(LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1);
- ret_conv = COption_C2Tuple_usizeTransactionZZ_clone((LDKCOption_C2Tuple_usizeTransactionZZ*)(((uint64_t)ret) & ~1));
- return ret_conv;
-}
-static void LDKFilter_JCalls_cloned(LDKFilter* new_obj) {
- LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) new_obj->this_arg;
- atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
-}
-static inline LDKFilter LDKFilter_init (/*TODO: JS Object Reference */void* o) {
- LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
- atomic_init(&calls->refcnt, 1);
- //TODO: Assign calls->o from o
-
- LDKFilter ret = {
- .this_arg = (void*) calls,
- .register_tx = register_tx_LDKFilter_jcall,
- .register_output = register_output_LDKFilter_jcall,
- .free = LDKFilter_JCalls_free,
- };
- return ret;
-}
-long __attribute__((visibility("default"))) TS_LDKFilter_new(/*TODO: JS Object Reference */void* o) {
- LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
- *res_ptr = LDKFilter_init(o);
- return (long)res_ptr;
-}
-void __attribute__((visibility("default"))) TS_Filter_register_tx(uint32_t this_arg, int8_tArray txid, int8_tArray script_pubkey) {
- LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
- unsigned char txid_arr[32];
- CHECK(*((uint32_t*)txid) == 32);
- memcpy(txid_arr, (uint8_t*)(txid + 4), 32);
- unsigned char (*txid_ref)[32] = &txid_arr;
- LDKu8slice script_pubkey_ref;
- script_pubkey_ref.datalen = *((uint32_t*)script_pubkey);
- script_pubkey_ref.data = (int8_t*)(script_pubkey + 4);
- (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
-}
-
-uint32_t __attribute__((visibility("default"))) TS_Filter_register_output(uint32_t this_arg, uint32_t output) {
- LDKFilter* this_arg_conv = (LDKFilter*)(((uint64_t)this_arg) & ~1);
- LDKWatchedOutput output_conv;
- output_conv.inner = (void*)(output & (~1));
- output_conv.is_owned = (output & 1) || (output == 0);
- output_conv = WatchedOutput_clone(&output_conv);
- LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
- *ret_copy = (this_arg_conv->register_output)(this_arg_conv->this_arg, output_conv);
- uint64_t ret_ref = (uint64_t)ret_copy;
- return ret_ref;
-}
-
-typedef struct LDKPersist_JCalls {
- atomic_size_t refcnt;
- uint32_t persist_new_channel_meth;
- uint32_t update_persisted_channel_meth;
-} LDKPersist_JCalls;
-static void LDKPersist_JCalls_free(void* this_arg) {
- LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
- if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
- js_free(j_calls->persist_new_channel_meth);
- js_free(j_calls->update_persisted_channel_meth);
- FREE(j_calls);
- }
-}
-LDKCResult_NoneChannelMonitorUpdateErrZ persist_new_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitor * data) {
- LDKPersist_JCalls *j_calls = (LDKPersist_JCalls*) this_arg;
- LDKOutPoint id_var = id;
- CHECK((((uint64_t)id_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&id_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t id_ref = (uint64_t)id_var.inner;
- if (id_var.is_owned) {
- id_ref |= 1;
- }
- LDKChannelMonitor data_var = *data;
- data_var = ChannelMonitor_clone(data);
- CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t data_ref = (uint64_t)data_var.inner;
- if (data_var.is_owned) {
- data_ref |= 1;
- }
- uint32_t ret = js_invoke_function_2(j_calls->persist_new_channel_meth, id_ref, data_ref);
- LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
- ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
+ LDKChannelMonitor data_var = *data;
+ data_var = ChannelMonitor_clone(data);
+ CHECK((((uint64_t)data_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&data_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t data_ref = (uint64_t)data_var.inner;
+ if (data_var.is_owned) {
+ data_ref |= 1;
+ }
+ uint32_t ret = js_invoke_function_2(j_calls->persist_new_channel_meth, id_ref, data_ref);
+ LDKCResult_NoneChannelMonitorUpdateErrZ ret_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1);
+ ret_conv = CResult_NoneChannelMonitorUpdateErrZ_clone((LDKCResult_NoneChannelMonitorUpdateErrZ*)(((uint64_t)ret) & ~1));
return ret_conv;
}
LDKCResult_NoneChannelMonitorUpdateErrZ update_persisted_channel_LDKPersist_jcall(const void* this_arg, LDKOutPoint id, const LDKChannelMonitorUpdate * update, const LDKChannelMonitor * data) {
uint32_t handle_node_announcement_meth;
uint32_t handle_channel_announcement_meth;
uint32_t handle_channel_update_meth;
- uint32_t handle_htlc_fail_channel_update_meth;
uint32_t get_next_channel_announcements_meth;
uint32_t get_next_node_announcements_meth;
uint32_t sync_routing_table_meth;
js_free(j_calls->handle_node_announcement_meth);
js_free(j_calls->handle_channel_announcement_meth);
js_free(j_calls->handle_channel_update_meth);
- js_free(j_calls->handle_htlc_fail_channel_update_meth);
js_free(j_calls->get_next_channel_announcements_meth);
js_free(j_calls->get_next_node_announcements_meth);
js_free(j_calls->sync_routing_table_meth);
ret_conv = CResult_boolLightningErrorZ_clone((LDKCResult_boolLightningErrorZ*)(((uint64_t)ret) & ~1));
return ret_conv;
}
-void handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate * update) {
- LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
- uint64_t ret_update = (uint64_t)update;
- js_invoke_function_1(j_calls->handle_htlc_fail_channel_update_meth, ret_update);
-}
LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_LDKRoutingMessageHandler_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
uint32_tArray ret = js_invoke_function_2(j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
.handle_node_announcement = handle_node_announcement_LDKRoutingMessageHandler_jcall,
.handle_channel_announcement = handle_channel_announcement_LDKRoutingMessageHandler_jcall,
.handle_channel_update = handle_channel_update_LDKRoutingMessageHandler_jcall,
- .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_LDKRoutingMessageHandler_jcall,
.get_next_channel_announcements = get_next_channel_announcements_LDKRoutingMessageHandler_jcall,
.get_next_node_announcements = get_next_node_announcements_LDKRoutingMessageHandler_jcall,
.sync_routing_table = sync_routing_table_LDKRoutingMessageHandler_jcall,
return (uint64_t)ret_conv;
}
-void __attribute__((visibility("default"))) TS_RoutingMessageHandler_handle_htlc_fail_channel_update(uint32_t this_arg, uint32_t update) {
- LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
- LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
- (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
-}
-
uint32_tArray __attribute__((visibility("default"))) TS_RoutingMessageHandler_get_next_channel_announcements(uint32_t this_arg, int64_t starting_point, int8_t batch_amount) {
LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)(((uint64_t)this_arg) & ~1);
LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
return (uint64_t)ret_conv;
}
+typedef struct LDKCustomMessageReader_JCalls {
+ atomic_size_t refcnt;
+ uint32_t read_meth;
+} LDKCustomMessageReader_JCalls;
+static void LDKCustomMessageReader_JCalls_free(void* this_arg) {
+ LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
+ if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
+ js_free(j_calls->read_meth);
+ FREE(j_calls);
+ }
+}
+LDKCResult_COption_TypeZDecodeErrorZ read_LDKCustomMessageReader_jcall(const void* this_arg, uint16_t message_type, LDKu8slice buffer) {
+ LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) this_arg;
+ LDKu8slice buffer_var = buffer;
+ int8_tArray buffer_arr = init_arr(buffer_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(buffer_arr + 4), buffer_var.data, buffer_var.datalen);
+ uint32_t ret = js_invoke_function_2(j_calls->read_meth, message_type, buffer_arr);
+ LDKCResult_COption_TypeZDecodeErrorZ ret_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1);
+ ret_conv = CResult_COption_TypeZDecodeErrorZ_clone((LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)ret) & ~1));
+ return ret_conv;
+}
+static void LDKCustomMessageReader_JCalls_cloned(LDKCustomMessageReader* new_obj) {
+ LDKCustomMessageReader_JCalls *j_calls = (LDKCustomMessageReader_JCalls*) new_obj->this_arg;
+ atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
+}
+static inline LDKCustomMessageReader LDKCustomMessageReader_init (/*TODO: JS Object Reference */void* o) {
+ LDKCustomMessageReader_JCalls *calls = MALLOC(sizeof(LDKCustomMessageReader_JCalls), "LDKCustomMessageReader_JCalls");
+ atomic_init(&calls->refcnt, 1);
+ //TODO: Assign calls->o from o
+
+ LDKCustomMessageReader ret = {
+ .this_arg = (void*) calls,
+ .read = read_LDKCustomMessageReader_jcall,
+ .free = LDKCustomMessageReader_JCalls_free,
+ };
+ return ret;
+}
+long __attribute__((visibility("default"))) TS_LDKCustomMessageReader_new(/*TODO: JS Object Reference */void* o) {
+ LDKCustomMessageReader *res_ptr = MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
+ *res_ptr = LDKCustomMessageReader_init(o);
+ return (long)res_ptr;
+}
+uint32_t __attribute__((visibility("default"))) TS_CustomMessageReader_read(uint32_t this_arg, int16_t message_type, int8_tArray buffer) {
+ LDKCustomMessageReader* this_arg_conv = (LDKCustomMessageReader*)(((uint64_t)this_arg) & ~1);
+ LDKu8slice buffer_ref;
+ buffer_ref.datalen = *((uint32_t*)buffer);
+ buffer_ref.data = (int8_t*)(buffer + 4);
+ LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
+ *ret_conv = (this_arg_conv->read)(this_arg_conv->this_arg, message_type, buffer_ref);
+ return (uint64_t)ret_conv;
+}
+
+typedef struct LDKCustomMessageHandler_JCalls {
+ atomic_size_t refcnt;
+ LDKCustomMessageReader_JCalls* CustomMessageReader;
+ uint32_t handle_custom_message_meth;
+ uint32_t get_and_clear_pending_msg_meth;
+} LDKCustomMessageHandler_JCalls;
+static void LDKCustomMessageHandler_JCalls_free(void* this_arg) {
+ LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
+ if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
+ js_free(j_calls->handle_custom_message_meth);
+ js_free(j_calls->get_and_clear_pending_msg_meth);
+ FREE(j_calls);
+ }
+}
+LDKCResult_NoneLightningErrorZ handle_custom_message_LDKCustomMessageHandler_jcall(const void* this_arg, LDKType msg, LDKPublicKey sender_node_id) {
+ LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
+ LDKType* msg_ret =MALLOC(sizeof(LDKType), "LDKType");
+ *msg_ret = msg;
+ int8_tArray sender_node_id_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(sender_node_id_arr + 4), sender_node_id.compressed_form, 33);
+ uint32_t ret = js_invoke_function_2(j_calls->handle_custom_message_meth, (uint64_t)msg_ret, sender_node_id_arr);
+ LDKCResult_NoneLightningErrorZ ret_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1);
+ ret_conv = CResult_NoneLightningErrorZ_clone((LDKCResult_NoneLightningErrorZ*)(((uint64_t)ret) & ~1));
+ return ret_conv;
+}
+LDKCVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg_LDKCustomMessageHandler_jcall(const void* this_arg) {
+ LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) this_arg;
+ uint32_tArray ret = js_invoke_function_0(j_calls->get_and_clear_pending_msg_meth);
+ LDKCVec_C2Tuple_PublicKeyTypeZZ ret_constr;
+ ret_constr.datalen = *((uint32_t*)ret);
+ if (ret_constr.datalen > 0)
+ ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
+ else
+ ret_constr.data = NULL;
+ uint32_t* ret_vals = (uint32_t*)(ret + 4);
+ for (size_t c = 0; c < ret_constr.datalen; c++) {
+ uint32_t ret_conv_28 = ret_vals[c];
+ LDKC2Tuple_PublicKeyTypeZ ret_conv_28_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_28) & ~1);
+ ret_conv_28_conv = C2Tuple_PublicKeyTypeZ_clone((LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)ret_conv_28) & ~1));
+ ret_constr.data[c] = ret_conv_28_conv;
+ }
+ return ret_constr;
+}
+static void LDKCustomMessageHandler_JCalls_cloned(LDKCustomMessageHandler* new_obj) {
+ LDKCustomMessageHandler_JCalls *j_calls = (LDKCustomMessageHandler_JCalls*) new_obj->this_arg;
+ atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
+ atomic_fetch_add_explicit(&j_calls->CustomMessageReader->refcnt, 1, memory_order_release);
+}
+static inline LDKCustomMessageHandler LDKCustomMessageHandler_init (/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */void* CustomMessageReader) {
+ LDKCustomMessageHandler_JCalls *calls = MALLOC(sizeof(LDKCustomMessageHandler_JCalls), "LDKCustomMessageHandler_JCalls");
+ atomic_init(&calls->refcnt, 1);
+ //TODO: Assign calls->o from o
+
+ LDKCustomMessageHandler ret = {
+ .this_arg = (void*) calls,
+ .handle_custom_message = handle_custom_message_LDKCustomMessageHandler_jcall,
+ .get_and_clear_pending_msg = get_and_clear_pending_msg_LDKCustomMessageHandler_jcall,
+ .free = LDKCustomMessageHandler_JCalls_free,
+ .CustomMessageReader = LDKCustomMessageReader_init(CustomMessageReader),
+ };
+ calls->CustomMessageReader = ret.CustomMessageReader.this_arg;
+ return ret;
+}
+long __attribute__((visibility("default"))) TS_LDKCustomMessageHandler_new(/*TODO: JS Object Reference */void* o, /*TODO: JS Object Reference */ void* CustomMessageReader) {
+ LDKCustomMessageHandler *res_ptr = MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
+ *res_ptr = LDKCustomMessageHandler_init(o, CustomMessageReader);
+ return (long)res_ptr;
+}
+uint32_t __attribute__((visibility("default"))) TS_CustomMessageHandler_handle_custom_message(uint32_t this_arg, uint32_t msg, int8_tArray sender_node_id) {
+ LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)(((uint64_t)this_arg) & ~1);
+ LDKType msg_conv = *(LDKType*)(((uint64_t)msg) & ~1);
+ LDKPublicKey sender_node_id_ref;
+ CHECK(*((uint32_t*)sender_node_id) == 33);
+ memcpy(sender_node_id_ref.compressed_form, (uint8_t*)(sender_node_id + 4), 33);
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = (this_arg_conv->handle_custom_message)(this_arg_conv->this_arg, msg_conv, sender_node_id_ref);
+ return (uint64_t)ret_conv;
+}
+
+uint32_tArray __attribute__((visibility("default"))) TS_CustomMessageHandler_get_and_clear_pending_msg(uint32_t this_arg) {
+ LDKCustomMessageHandler* this_arg_conv = (LDKCustomMessageHandler*)(((uint64_t)this_arg) & ~1);
+ LDKCVec_C2Tuple_PublicKeyTypeZZ ret_var = (this_arg_conv->get_and_clear_pending_msg)(this_arg_conv->this_arg);
+ uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
+ uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
+ for (size_t c = 0; c < ret_var.datalen; c++) {
+ LDKC2Tuple_PublicKeyTypeZ* ret_conv_28_ref = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
+ *ret_conv_28_ref = ret_var.data[c];
+ ret_arr_ptr[c] = (uint64_t)ret_conv_28_ref;
+ }
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
typedef struct LDKSocketDescriptor_JCalls {
atomic_size_t refcnt;
uint32_t send_data_meth;
return (uint64_t)ret_conv;
}
+uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_ok(uint32_t o) {
+ LDKTrustedClosingTransaction o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = (o & 1) || (o == 0);
+ // Warning: we need a move here but no clone is available for LDKTrustedClosingTransaction
+ LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
+ *ret_conv = CResult_TrustedClosingTransactionNoneZ_ok(o_conv);
+ return (uint64_t)ret_conv;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_err() {
+ LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
+ *ret_conv = CResult_TrustedClosingTransactionNoneZ_err();
+ return (uint64_t)ret_conv;
+}
+
+void __attribute__((visibility("default"))) TS_CResult_TrustedClosingTransactionNoneZ_free(uint32_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCResult_TrustedClosingTransactionNoneZ _res_conv = *(LDKCResult_TrustedClosingTransactionNoneZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ CResult_TrustedClosingTransactionNoneZ_free(_res_conv);
+}
+
uint32_t __attribute__((visibility("default"))) TS_CResult_CommitmentTransactionDecodeErrorZ_ok(uint32_t o) {
LDKCommitmentTransaction o_conv;
o_conv.inner = (void*)(o & (~1));
uint32_t __attribute__((visibility("default"))) TS_CResult_TxOutAccessErrorZ_ok(uint32_t o) {
LDKTxOut o_conv = *(LDKTxOut*)(((uint64_t)o) & ~1);
+ o_conv = TxOut_clone((LDKTxOut*)(((uint64_t)o) & ~1));
LDKCResult_TxOutAccessErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
*ret_conv = CResult_TxOutAccessErrorZ_ok(o_conv);
return (uint64_t)ret_conv;
uint32_t __attribute__((visibility("default"))) TS_COption_C2Tuple_usizeTransactionZZ_some(uint32_t o) {
LDKC2Tuple_usizeTransactionZ o_conv = *(LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1);
+ o_conv = C2Tuple_usizeTransactionZ_clone((LDKC2Tuple_usizeTransactionZ*)(((uint64_t)o) & ~1));
LDKCOption_C2Tuple_usizeTransactionZZ *ret_copy = MALLOC(sizeof(LDKCOption_C2Tuple_usizeTransactionZZ), "LDKCOption_C2Tuple_usizeTransactionZZ");
*ret_copy = COption_C2Tuple_usizeTransactionZZ_some(o_conv);
uint64_t ret_ref = (uint64_t)ret_copy;
return ret_ref;
}
+uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_some(uint32_t o) {
+ LDKNetworkUpdate o_conv = *(LDKNetworkUpdate*)(((uint64_t)o) & ~1);
+ o_conv = NetworkUpdate_clone((LDKNetworkUpdate*)(((uint64_t)o) & ~1));
+ LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
+ *ret_copy = COption_NetworkUpdateZ_some(o_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_none() {
+ LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
+ *ret_copy = COption_NetworkUpdateZ_none();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_free(uint32_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCOption_NetworkUpdateZ _res_conv = *(LDKCOption_NetworkUpdateZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ COption_NetworkUpdateZ_free(_res_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_COption_NetworkUpdateZ_clone(uint32_t orig) {
+ LDKCOption_NetworkUpdateZ* orig_conv = (LDKCOption_NetworkUpdateZ*)orig;
+ LDKCOption_NetworkUpdateZ *ret_copy = MALLOC(sizeof(LDKCOption_NetworkUpdateZ), "LDKCOption_NetworkUpdateZ");
+ *ret_copy = COption_NetworkUpdateZ_clone(orig_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
void __attribute__((visibility("default"))) TS_CVec_SpendableOutputDescriptorZ_free(uint32_tArray _res) {
LDKCVec_SpendableOutputDescriptorZ _res_constr;
_res_constr.datalen = *((uint32_t*)_res);
uint32_t __attribute__((visibility("default"))) TS_CResult_SpendableOutputDescriptorDecodeErrorZ_ok(uint32_t o) {
LDKSpendableOutputDescriptor o_conv = *(LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1);
+ o_conv = SpendableOutputDescriptor_clone((LDKSpendableOutputDescriptor*)(((uint64_t)o) & ~1));
LDKCResult_SpendableOutputDescriptorDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ), "LDKCResult_SpendableOutputDescriptorDecodeErrorZ");
*ret_conv = CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o_conv);
return (uint64_t)ret_conv;
return (uint64_t)ret_conv;
}
+uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_ok() {
+ LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
+ *ret_conv = CResult_NoneNoneZ_ok();
+ return (uint64_t)ret_conv;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_err() {
+ LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
+ *ret_conv = CResult_NoneNoneZ_err();
+ return (uint64_t)ret_conv;
+}
+
+void __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_free(uint32_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCResult_NoneNoneZ _res_conv = *(LDKCResult_NoneNoneZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ CResult_NoneNoneZ_free(_res_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_CResult_NoneNoneZ_clone(uint32_t orig) {
+ LDKCResult_NoneNoneZ* orig_conv = (LDKCResult_NoneNoneZ*)(orig & ~1);
+ LDKCResult_NoneNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneNoneZ), "LDKCResult_NoneNoneZ");
+ *ret_conv = CResult_NoneNoneZ_clone(orig_conv);
+ return (uint64_t)ret_conv;
+}
+
uint32_t __attribute__((visibility("default"))) TS_C2Tuple_SignatureCVec_SignatureZZ_clone(uint32_t orig) {
LDKC2Tuple_SignatureCVec_SignatureZZ* orig_conv = (LDKC2Tuple_SignatureCVec_SignatureZZ*)(orig & ~1);
LDKC2Tuple_SignatureCVec_SignatureZZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(uint32_t o) {
LDKC2Tuple_SignatureCVec_SignatureZZ o_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1);
+ o_conv = C2Tuple_SignatureCVec_SignatureZZ_clone((LDKC2Tuple_SignatureCVec_SignatureZZ*)(((uint64_t)o) & ~1));
LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
*ret_conv = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(o_conv);
return (uint64_t)ret_conv;
uint32_t __attribute__((visibility("default"))) TS_CResult_NoneAPIErrorZ_err(uint32_t e) {
LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
+ e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
LDKCResult_NoneAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
*ret_conv = CResult_NoneAPIErrorZ_err(e_conv);
return (uint64_t)ret_conv;
uint32_t __attribute__((visibility("default"))) TS_CResult_NonePaymentSendFailureZ_err(uint32_t e) {
LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
+ e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
LDKCResult_NonePaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
*ret_conv = CResult_NonePaymentSendFailureZ_err(e_conv);
return (uint64_t)ret_conv;
uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentHashPaymentSendFailureZ_err(uint32_t e) {
LDKPaymentSendFailure e_conv = *(LDKPaymentSendFailure*)(((uint64_t)e) & ~1);
+ e_conv = PaymentSendFailure_clone((LDKPaymentSendFailure*)(((uint64_t)e) & ~1));
LDKCResult_PaymentHashPaymentSendFailureZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentHashPaymentSendFailureZ), "LDKCResult_PaymentHashPaymentSendFailureZ");
*ret_conv = CResult_PaymentHashPaymentSendFailureZ_err(e_conv);
return (uint64_t)ret_conv;
uint32_t __attribute__((visibility("default"))) TS_CResult_PaymentSecretAPIErrorZ_err(uint32_t e) {
LDKAPIError e_conv = *(LDKAPIError*)(((uint64_t)e) & ~1);
+ e_conv = APIError_clone((LDKAPIError*)(((uint64_t)e) & ~1));
LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
*ret_conv = CResult_PaymentSecretAPIErrorZ_err(e_conv);
return (uint64_t)ret_conv;
uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(uint32_t o) {
LDKC2Tuple_BlockHashChannelManagerZ o_conv = *(LDKC2Tuple_BlockHashChannelManagerZ*)(((uint64_t)o) & ~1);
+ // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelManagerZ
LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ");
*ret_conv = CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(o_conv);
return (uint64_t)ret_conv;
return (uint64_t)ret_conv;
}
+uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_some(uint32_t o) {
+ LDKType o_conv = *(LDKType*)(((uint64_t)o) & ~1);
+ LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
+ *ret_copy = COption_TypeZ_some(o_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_none() {
+ LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
+ *ret_copy = COption_TypeZ_none();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_COption_TypeZ_free(uint32_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCOption_TypeZ _res_conv = *(LDKCOption_TypeZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ COption_TypeZ_free(_res_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_COption_TypeZ_clone(uint32_t orig) {
+ LDKCOption_TypeZ* orig_conv = (LDKCOption_TypeZ*)orig;
+ LDKCOption_TypeZ *ret_copy = MALLOC(sizeof(LDKCOption_TypeZ), "LDKCOption_TypeZ");
+ *ret_copy = COption_TypeZ_clone(orig_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_ok(uint32_t o) {
+ LDKCOption_TypeZ o_conv = *(LDKCOption_TypeZ*)(((uint64_t)o) & ~1);
+ o_conv = COption_TypeZ_clone((LDKCOption_TypeZ*)(((uint64_t)o) & ~1));
+ LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
+ *ret_conv = CResult_COption_TypeZDecodeErrorZ_ok(o_conv);
+ return (uint64_t)ret_conv;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_err(uint32_t e) {
+ LDKDecodeError e_conv;
+ e_conv.inner = (void*)(e & (~1));
+ e_conv.is_owned = (e & 1) || (e == 0);
+ e_conv = DecodeError_clone(&e_conv);
+ LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
+ *ret_conv = CResult_COption_TypeZDecodeErrorZ_err(e_conv);
+ return (uint64_t)ret_conv;
+}
+
+void __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_free(uint32_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCResult_COption_TypeZDecodeErrorZ _res_conv = *(LDKCResult_COption_TypeZDecodeErrorZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ CResult_COption_TypeZDecodeErrorZ_free(_res_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_CResult_COption_TypeZDecodeErrorZ_clone(uint32_t orig) {
+ LDKCResult_COption_TypeZDecodeErrorZ* orig_conv = (LDKCResult_COption_TypeZDecodeErrorZ*)(orig & ~1);
+ LDKCResult_COption_TypeZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_COption_TypeZDecodeErrorZ), "LDKCResult_COption_TypeZDecodeErrorZ");
+ *ret_conv = CResult_COption_TypeZDecodeErrorZ_clone(orig_conv);
+ return (uint64_t)ret_conv;
+}
+
uint32_t __attribute__((visibility("default"))) TS_CResult_SiPrefixNoneZ_ok(uint32_t o) {
LDKSiPrefix o_conv = LDKSiPrefix_from_js(o);
LDKCResult_SiPrefixNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_SiPrefixNoneZ), "LDKCResult_SiPrefixNoneZ");
uint32_t __attribute__((visibility("default"))) TS_C2Tuple_u32TxOutZ_new(int32_t a, uint32_t b) {
LDKTxOut b_conv = *(LDKTxOut*)(((uint64_t)b) & ~1);
+ b_conv = TxOut_clone((LDKTxOut*)(((uint64_t)b) & ~1));
LDKC2Tuple_u32TxOutZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_u32TxOutZ), "LDKC2Tuple_u32TxOutZ");
*ret_ref = C2Tuple_u32TxOutZ_new(a, b_conv);
return (uint64_t)ret_ref;
CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res_constr);
}
+void __attribute__((visibility("default"))) TS_CVec_BalanceZ_free(uint32_tArray _res) {
+ LDKCVec_BalanceZ _res_constr;
+ _res_constr.datalen = *((uint32_t*)_res);
+ if (_res_constr.datalen > 0)
+ _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKBalance), "LDKCVec_BalanceZ Elements");
+ else
+ _res_constr.data = NULL;
+ uint32_t* _res_vals = (uint32_t*)(_res + 4);
+ for (size_t j = 0; j < _res_constr.datalen; j++) {
+ uint32_t _res_conv_9 = _res_vals[j];
+ LDKBalance _res_conv_9_conv = *(LDKBalance*)(((uint64_t)_res_conv_9) & ~1);
+ FREE((void*)_res_conv_9);
+ _res_constr.data[j] = _res_conv_9_conv;
+ }
+ CVec_BalanceZ_free(_res_constr);
+}
+
uint32_t __attribute__((visibility("default"))) TS_CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(uint32_t o) {
LDKC2Tuple_BlockHashChannelMonitorZ o_conv = *(LDKC2Tuple_BlockHashChannelMonitorZ*)(((uint64_t)o) & ~1);
+ // Warning: we may need a move here but no clone is available for LDKC2Tuple_BlockHashChannelMonitorZ
LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ), "LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ");
*ret_conv = CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o_conv);
return (uint64_t)ret_conv;
CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res_conv);
}
-uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
- LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
- *ret_conv = CResult_boolLightningErrorZ_ok(o);
+uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_ok() {
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = CResult_NoneLightningErrorZ_ok();
return (uint64_t)ret_conv;
}
-uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
+uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
LDKLightningError e_conv;
e_conv.inner = (void*)(e & (~1));
e_conv.is_owned = (e & 1) || (e == 0);
e_conv = LightningError_clone(&e_conv);
- LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
- *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
return (uint64_t)ret_conv;
}
-void __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
+void __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
if ((_res & 1) != 0) return;
- LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
+ LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
FREE((void*)_res);
- CResult_boolLightningErrorZ_free(_res_conv);
+ CResult_NoneLightningErrorZ_free(_res_conv);
}
-uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
- LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
- LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
- *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
+uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
+ LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
+ LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
+ *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
return (uint64_t)ret_conv;
}
-uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
- LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
- LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
- *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
+uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_clone(uint32_t orig) {
+ LDKC2Tuple_PublicKeyTypeZ* orig_conv = (LDKC2Tuple_PublicKeyTypeZ*)(orig & ~1);
+ LDKC2Tuple_PublicKeyTypeZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
+ *ret_ref = C2Tuple_PublicKeyTypeZ_clone(orig_conv);
return (uint64_t)ret_ref;
}
-uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
+uint32_t __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_new(int8_tArray a, uint32_t b) {
+ LDKPublicKey a_ref;
+ CHECK(*((uint32_t*)a) == 33);
+ memcpy(a_ref.compressed_form, (uint8_t*)(a + 4), 33);
+ LDKType b_conv = *(LDKType*)(((uint64_t)b) & ~1);
+ LDKC2Tuple_PublicKeyTypeZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKC2Tuple_PublicKeyTypeZ");
+ *ret_ref = C2Tuple_PublicKeyTypeZ_new(a_ref, b_conv);
+ return (uint64_t)ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_C2Tuple_PublicKeyTypeZ_free(uint32_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKC2Tuple_PublicKeyTypeZ _res_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ C2Tuple_PublicKeyTypeZ_free(_res_conv);
+}
+
+void __attribute__((visibility("default"))) TS_CVec_C2Tuple_PublicKeyTypeZZ_free(uint32_tArray _res) {
+ LDKCVec_C2Tuple_PublicKeyTypeZZ _res_constr;
+ _res_constr.datalen = *((uint32_t*)_res);
+ if (_res_constr.datalen > 0)
+ _res_constr.data = MALLOC(_res_constr.datalen * sizeof(LDKC2Tuple_PublicKeyTypeZ), "LDKCVec_C2Tuple_PublicKeyTypeZZ Elements");
+ else
+ _res_constr.data = NULL;
+ uint32_t* _res_vals = (uint32_t*)(_res + 4);
+ for (size_t c = 0; c < _res_constr.datalen; c++) {
+ uint32_t _res_conv_28 = _res_vals[c];
+ LDKC2Tuple_PublicKeyTypeZ _res_conv_28_conv = *(LDKC2Tuple_PublicKeyTypeZ*)(((uint64_t)_res_conv_28) & ~1);
+ FREE((void*)_res_conv_28);
+ _res_constr.data[c] = _res_conv_28_conv;
+ }
+ CVec_C2Tuple_PublicKeyTypeZZ_free(_res_constr);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_ok(jboolean o) {
+ LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
+ *ret_conv = CResult_boolLightningErrorZ_ok(o);
+ return (uint64_t)ret_conv;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_err(uint32_t e) {
+ LDKLightningError e_conv;
+ e_conv.inner = (void*)(e & (~1));
+ e_conv.is_owned = (e & 1) || (e == 0);
+ e_conv = LightningError_clone(&e_conv);
+ LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
+ *ret_conv = CResult_boolLightningErrorZ_err(e_conv);
+ return (uint64_t)ret_conv;
+}
+
+void __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_free(uint32_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCResult_boolLightningErrorZ _res_conv = *(LDKCResult_boolLightningErrorZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ CResult_boolLightningErrorZ_free(_res_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_CResult_boolLightningErrorZ_clone(uint32_t orig) {
+ LDKCResult_boolLightningErrorZ* orig_conv = (LDKCResult_boolLightningErrorZ*)(orig & ~1);
+ LDKCResult_boolLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
+ *ret_conv = CResult_boolLightningErrorZ_clone(orig_conv);
+ return (uint64_t)ret_conv;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(uint32_t orig) {
+ LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* orig_conv = (LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)(orig & ~1);
+ LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret_ref = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
+ *ret_ref = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig_conv);
+ return (uint64_t)ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(uint32_t a, uint32_t b, uint32_t c) {
LDKChannelAnnouncement a_conv;
a_conv.inner = (void*)(a & (~1));
a_conv.is_owned = (a & 1) || (a == 0);
CVec_NodeAnnouncementZ_free(_res_constr);
}
-uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_ok() {
- LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
- *ret_conv = CResult_NoneLightningErrorZ_ok();
- return (uint64_t)ret_conv;
-}
-
-uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_err(uint32_t e) {
- LDKLightningError e_conv;
- e_conv.inner = (void*)(e & (~1));
- e_conv.is_owned = (e & 1) || (e == 0);
- e_conv = LightningError_clone(&e_conv);
- LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
- *ret_conv = CResult_NoneLightningErrorZ_err(e_conv);
- return (uint64_t)ret_conv;
-}
-
-void __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_free(uint32_t _res) {
- if ((_res & 1) != 0) return;
- LDKCResult_NoneLightningErrorZ _res_conv = *(LDKCResult_NoneLightningErrorZ*)(((uint64_t)_res) & ~1);
- FREE((void*)_res);
- CResult_NoneLightningErrorZ_free(_res_conv);
-}
-
-uint32_t __attribute__((visibility("default"))) TS_CResult_NoneLightningErrorZ_clone(uint32_t orig) {
- LDKCResult_NoneLightningErrorZ* orig_conv = (LDKCResult_NoneLightningErrorZ*)(orig & ~1);
- LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
- *ret_conv = CResult_NoneLightningErrorZ_clone(orig_conv);
- return (uint64_t)ret_conv;
-}
-
void __attribute__((visibility("default"))) TS_CVec_PublicKeyZ_free(ptrArray _res) {
LDKCVec_PublicKeyZ _res_constr;
_res_constr.datalen = *((uint32_t*)_res);
return (uint64_t)ret_conv;
}
+uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_some(uint32_t o) {
+ LDKAccess o_conv = *(LDKAccess*)(((uint64_t)o) & ~1);
+ LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
+ *ret_copy = COption_AccessZ_some(o_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_COption_AccessZ_none() {
+ LDKCOption_AccessZ *ret_copy = MALLOC(sizeof(LDKCOption_AccessZ), "LDKCOption_AccessZ");
+ *ret_copy = COption_AccessZ_none();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_COption_AccessZ_free(uint32_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCOption_AccessZ _res_conv = *(LDKCOption_AccessZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ COption_AccessZ_free(_res_conv);
+}
+
uint32_t __attribute__((visibility("default"))) TS_CResult_DirectionalChannelInfoDecodeErrorZ_ok(uint32_t o) {
LDKDirectionalChannelInfo o_conv;
o_conv.inner = (void*)(o & (~1));
LDKNetworkGraph o_conv;
o_conv.inner = (void*)(o & (~1));
o_conv.is_owned = (o & 1) || (o == 0);
- o_conv = NetworkGraph_clone(&o_conv);
+ // Warning: we need a move here but no clone is available for LDKNetworkGraph
LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
*ret_conv = CResult_NetworkGraphDecodeErrorZ_ok(o_conv);
return (uint64_t)ret_conv;
CResult_NetworkGraphDecodeErrorZ_free(_res_conv);
}
-uint32_t __attribute__((visibility("default"))) TS_CResult_NetworkGraphDecodeErrorZ_clone(uint32_t orig) {
- LDKCResult_NetworkGraphDecodeErrorZ* orig_conv = (LDKCResult_NetworkGraphDecodeErrorZ*)(orig & ~1);
- LDKCResult_NetworkGraphDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetworkGraphDecodeErrorZ), "LDKCResult_NetworkGraphDecodeErrorZ");
- *ret_conv = CResult_NetworkGraphDecodeErrorZ_clone(orig_conv);
- return (uint64_t)ret_conv;
-}
-
uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressu8Z_ok(uint32_t o) {
LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
+ o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
LDKCResult_NetAddressu8Z* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressu8Z), "LDKCResult_NetAddressu8Z");
*ret_conv = CResult_NetAddressu8Z_ok(o_conv);
return (uint64_t)ret_conv;
uint32_t __attribute__((visibility("default"))) TS_CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(uint32_t o) {
LDKCResult_NetAddressu8Z o_conv = *(LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1);
+ o_conv = CResult_NetAddressu8Z_clone((LDKCResult_NetAddressu8Z*)(((uint64_t)o) & ~1));
LDKCResult_CResult_NetAddressu8ZDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_CResult_NetAddressu8ZDecodeErrorZ), "LDKCResult_CResult_NetAddressu8ZDecodeErrorZ");
*ret_conv = CResult_CResult_NetAddressu8ZDecodeErrorZ_ok(o_conv);
return (uint64_t)ret_conv;
uint32_t __attribute__((visibility("default"))) TS_CResult_NetAddressDecodeErrorZ_ok(uint32_t o) {
LDKNetAddress o_conv = *(LDKNetAddress*)(((uint64_t)o) & ~1);
+ o_conv = NetAddress_clone((LDKNetAddress*)(((uint64_t)o) & ~1));
LDKCResult_NetAddressDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NetAddressDecodeErrorZ), "LDKCResult_NetAddressDecodeErrorZ");
*ret_conv = CResult_NetAddressDecodeErrorZ_ok(o_conv);
return (uint64_t)ret_conv;
uint32_t __attribute__((visibility("default"))) TS_CResult_InvoiceSignOrCreationErrorZ_err(uint32_t e) {
LDKSignOrCreationError e_conv = *(LDKSignOrCreationError*)(((uint64_t)e) & ~1);
+ e_conv = SignOrCreationError_clone((LDKSignOrCreationError*)(((uint64_t)e) & ~1));
LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
*ret_conv = CResult_InvoiceSignOrCreationErrorZ_err(e_conv);
return (uint64_t)ret_conv;
return (uint64_t)ret_conv;
}
+uint32_t __attribute__((visibility("default"))) TS_COption_FilterZ_some(uint32_t o) {
+ LDKFilter o_conv = *(LDKFilter*)(((uint64_t)o) & ~1);
+ LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
+ *ret_copy = COption_FilterZ_some(o_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_COption_FilterZ_none() {
+ LDKCOption_FilterZ *ret_copy = MALLOC(sizeof(LDKCOption_FilterZ), "LDKCOption_FilterZ");
+ *ret_copy = COption_FilterZ_none();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_COption_FilterZ_free(uint32_t _res) {
+ if ((_res & 1) != 0) return;
+ LDKCOption_FilterZ _res_conv = *(LDKCOption_FilterZ*)(((uint64_t)_res) & ~1);
+ FREE((void*)_res);
+ COption_FilterZ_free(_res_conv);
+}
+
void __attribute__((visibility("default"))) TS_PaymentPurpose_free(uint32_t this_ptr) {
if ((this_ptr & 1) != 0) return;
LDKPaymentPurpose this_ptr_conv = *(LDKPaymentPurpose*)(((uint64_t)this_ptr) & ~1);
return ret_ref;
}
+void __attribute__((visibility("default"))) TS_ClosureReason_free(uint32_t this_ptr) {
+ if ((this_ptr & 1) != 0) return;
+ LDKClosureReason this_ptr_conv = *(LDKClosureReason*)(((uint64_t)this_ptr) & ~1);
+ FREE((void*)this_ptr);
+ ClosureReason_free(this_ptr_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ClosureReason_clone(uint32_t orig) {
+ LDKClosureReason* orig_conv = (LDKClosureReason*)orig;
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_clone(orig_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ClosureReason_counterparty_force_closed(jstring peer_msg) {
+ LDKStr peer_msg_conv = str_ref_to_owned_c(peer_msg);
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_counterparty_force_closed(peer_msg_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ClosureReason_holder_force_closed() {
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_holder_force_closed();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ClosureReason_cooperative_closure() {
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_cooperative_closure();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ClosureReason_commitment_tx_confirmed() {
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_commitment_tx_confirmed();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ClosureReason_processing_error(jstring err) {
+ LDKStr err_conv = str_ref_to_owned_c(err);
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_processing_error(err_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ClosureReason_disconnected_peer() {
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_disconnected_peer();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ClosureReason_outdated_channel_manager() {
+ LDKClosureReason *ret_copy = MALLOC(sizeof(LDKClosureReason), "LDKClosureReason");
+ *ret_copy = ClosureReason_outdated_channel_manager();
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_ClosureReason_write(uint32_t obj) {
+ LDKClosureReason* obj_conv = (LDKClosureReason*)obj;
+ LDKCVec_u8Z ret_var = ClosureReason_write(obj_conv);
+ int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
void __attribute__((visibility("default"))) TS_Event_free(uint32_t this_ptr) {
if ((this_ptr & 1) != 0) return;
LDKEvent this_ptr_conv = *(LDKEvent*)(((uint64_t)this_ptr) & ~1);
CHECK(*((uint32_t*)payment_hash) == 32);
memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
LDKPaymentPurpose purpose_conv = *(LDKPaymentPurpose*)(((uint64_t)purpose) & ~1);
+ purpose_conv = PaymentPurpose_clone((LDKPaymentPurpose*)(((uint64_t)purpose) & ~1));
LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
*ret_copy = Event_payment_received(payment_hash_ref, amt, purpose_conv);
uint64_t ret_ref = (uint64_t)ret_copy;
return ret_ref;
}
-uint32_t __attribute__((visibility("default"))) TS_Event_payment_failed(int8_tArray payment_hash, jboolean rejected_by_dest) {
+uint32_t __attribute__((visibility("default"))) TS_Event_payment_path_failed(int8_tArray payment_hash, jboolean rejected_by_dest, uint32_t network_update, jboolean all_paths_failed, uint32_tArray path) {
LDKThirtyTwoBytes payment_hash_ref;
CHECK(*((uint32_t*)payment_hash) == 32);
memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
+ LDKCOption_NetworkUpdateZ network_update_conv = *(LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1);
+ network_update_conv = COption_NetworkUpdateZ_clone((LDKCOption_NetworkUpdateZ*)(((uint64_t)network_update) & ~1));
+ LDKCVec_RouteHopZ path_constr;
+ path_constr.datalen = *((uint32_t*)path);
+ if (path_constr.datalen > 0)
+ path_constr.data = MALLOC(path_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
+ else
+ path_constr.data = NULL;
+ uint32_t* path_vals = (uint32_t*)(path + 4);
+ for (size_t k = 0; k < path_constr.datalen; k++) {
+ uint32_t path_conv_10 = path_vals[k];
+ LDKRouteHop path_conv_10_conv;
+ path_conv_10_conv.inner = (void*)(path_conv_10 & (~1));
+ path_conv_10_conv.is_owned = (path_conv_10 & 1) || (path_conv_10 == 0);
+ path_conv_10_conv = RouteHop_clone(&path_conv_10_conv);
+ path_constr.data[k] = path_conv_10_conv;
+ }
LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
- *ret_copy = Event_payment_failed(payment_hash_ref, rejected_by_dest);
+ *ret_copy = Event_payment_path_failed(payment_hash_ref, rejected_by_dest, network_update_conv, all_paths_failed, path_constr);
uint64_t ret_ref = (uint64_t)ret_copy;
return ret_ref;
}
uint32_t __attribute__((visibility("default"))) TS_Event_payment_forwarded(uint32_t fee_earned_msat, jboolean claim_from_onchain_tx) {
LDKCOption_u64Z fee_earned_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1);
+ fee_earned_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)fee_earned_msat) & ~1));
LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
*ret_copy = Event_payment_forwarded(fee_earned_msat_conv, claim_from_onchain_tx);
uint64_t ret_ref = (uint64_t)ret_copy;
return ret_ref;
}
+uint32_t __attribute__((visibility("default"))) TS_Event_channel_closed(int8_tArray channel_id, uint32_t reason) {
+ LDKThirtyTwoBytes channel_id_ref;
+ CHECK(*((uint32_t*)channel_id) == 32);
+ memcpy(channel_id_ref.data, (uint8_t*)(channel_id + 4), 32);
+ LDKClosureReason reason_conv = *(LDKClosureReason*)(((uint64_t)reason) & ~1);
+ reason_conv = ClosureReason_clone((LDKClosureReason*)(((uint64_t)reason) & ~1));
+ LDKEvent *ret_copy = MALLOC(sizeof(LDKEvent), "LDKEvent");
+ *ret_copy = Event_channel_closed(channel_id_ref, reason_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
int8_tArray __attribute__((visibility("default"))) TS_Event_write(uint32_t obj) {
LDKEvent* obj_conv = (LDKEvent*)obj;
LDKCVec_u8Z ret_var = Event_write(obj_conv);
CHECK(*((uint32_t*)node_id) == 33);
memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
LDKErrorAction action_conv = *(LDKErrorAction*)(((uint64_t)action) & ~1);
+ action_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action) & ~1));
LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
*ret_copy = MessageSendEvent_handle_error(node_id_ref, action_conv);
uint64_t ret_ref = (uint64_t)ret_copy;
return ret_ref;
}
-uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_payment_failure_network_update(uint32_t update) {
- LDKHTLCFailChannelUpdate update_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)update) & ~1);
- LDKMessageSendEvent *ret_copy = MALLOC(sizeof(LDKMessageSendEvent), "LDKMessageSendEvent");
- *ret_copy = MessageSendEvent_payment_failure_network_update(update_conv);
- uint64_t ret_ref = (uint64_t)ret_copy;
- return ret_ref;
-}
-
uint32_t __attribute__((visibility("default"))) TS_MessageSendEvent_send_channel_range_query(int8_tArray node_id, uint32_t msg) {
LDKPublicKey node_id_ref;
CHECK(*((uint32_t*)node_id) == 33);
}
uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_new(uint32_t chain_source, uint32_t broadcaster, uint32_t logger, uint32_t feeest, uint32_t persister) {
- LDKFilter *chain_source_conv_ptr = NULL;
- if (chain_source != 0) {
- LDKFilter chain_source_conv;
- chain_source_conv = *(LDKFilter*)(((uint64_t)chain_source) & ~1);
- chain_source_conv_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
- *chain_source_conv_ptr = chain_source_conv;
+ LDKCOption_FilterZ chain_source_conv = *(LDKCOption_FilterZ*)(((uint64_t)chain_source) & ~1);
+ // Warning: we may need a move here but no clone is available for LDKCOption_FilterZ
+ if (chain_source_conv.tag == LDKCOption_FilterZ_Some) {
+ // Manually implement clone for Java trait instances
}
LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)(((uint64_t)broadcaster) & ~1);
LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)(((uint64_t)feeest) & ~1);
LDKPersist persister_conv = *(LDKPersist*)(((uint64_t)persister) & ~1);
- LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv_ptr, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
+ LDKChainMonitor ret_var = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv, persister_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_ref;
}
+uint32_tArray __attribute__((visibility("default"))) TS_ChainMonitor_get_claimable_balances(uint32_t this_arg, uint32_tArray ignored_channels) {
+ LDKChainMonitor this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKCVec_ChannelDetailsZ ignored_channels_constr;
+ ignored_channels_constr.datalen = *((uint32_t*)ignored_channels);
+ if (ignored_channels_constr.datalen > 0)
+ ignored_channels_constr.data = MALLOC(ignored_channels_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
+ else
+ ignored_channels_constr.data = NULL;
+ uint32_t* ignored_channels_vals = (uint32_t*)(ignored_channels + 4);
+ for (size_t q = 0; q < ignored_channels_constr.datalen; q++) {
+ uint32_t ignored_channels_conv_16 = ignored_channels_vals[q];
+ LDKChannelDetails ignored_channels_conv_16_conv;
+ ignored_channels_conv_16_conv.inner = (void*)(ignored_channels_conv_16 & (~1));
+ ignored_channels_conv_16_conv.is_owned = (ignored_channels_conv_16 & 1) || (ignored_channels_conv_16 == 0);
+ ignored_channels_conv_16_conv = ChannelDetails_clone(&ignored_channels_conv_16_conv);
+ ignored_channels_constr.data[q] = ignored_channels_conv_16_conv;
+ }
+ LDKCVec_BalanceZ ret_var = ChainMonitor_get_claimable_balances(&this_arg_conv, ignored_channels_constr);
+ uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
+ uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
+ for (size_t j = 0; j < ret_var.datalen; j++) {
+ LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
+ *ret_conv_9_copy = Balance_clone(&ret_var.data[j]);
+ uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
+ ret_arr_ptr[j] = ret_conv_9_ref;
+ }
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Listen(uint32_t this_arg) {
LDKChainMonitor this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
- *ret = ChainMonitor_as_Listen(&this_arg_conv);
- return (uint64_t)ret;
+ LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
+ *ret_ret = ChainMonitor_as_Listen(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Confirm(uint32_t this_arg) {
LDKChainMonitor this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
- *ret = ChainMonitor_as_Confirm(&this_arg_conv);
- return (uint64_t)ret;
+ LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
+ *ret_ret = ChainMonitor_as_Confirm(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_Watch(uint32_t this_arg) {
LDKChainMonitor this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
- *ret = ChainMonitor_as_Watch(&this_arg_conv);
- return (uint64_t)ret;
+ LDKWatch* ret_ret =MALLOC(sizeof(LDKWatch), "LDKWatch");
+ *ret_ret = ChainMonitor_as_Watch(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
uint32_t __attribute__((visibility("default"))) TS_ChainMonitor_as_EventsProvider(uint32_t this_arg) {
LDKChainMonitor this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
- *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
- return (uint64_t)ret;
+ LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
+ *ret_ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
void __attribute__((visibility("default"))) TS_ChannelMonitorUpdate_free(uint32_t this_obj) {
return ret_ref;
}
-uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_commitment_tx_broadcasted(uint32_t a) {
+uint32_t __attribute__((visibility("default"))) TS_MonitorEvent_commitment_tx_confirmed(uint32_t a) {
LDKOutPoint a_conv;
a_conv.inner = (void*)(a & (~1));
a_conv.is_owned = (a & 1) || (a == 0);
a_conv = OutPoint_clone(&a_conv);
LDKMonitorEvent *ret_copy = MALLOC(sizeof(LDKMonitorEvent), "LDKMonitorEvent");
- *ret_copy = MonitorEvent_commitment_tx_broadcasted(a_conv);
+ *ret_copy = MonitorEvent_commitment_tx_confirmed(a_conv);
uint64_t ret_ref = (uint64_t)ret_copy;
return ret_ref;
}
return (uint64_t)ret_conv;
}
+void __attribute__((visibility("default"))) TS_Balance_free(uint32_t this_ptr) {
+ if ((this_ptr & 1) != 0) return;
+ LDKBalance this_ptr_conv = *(LDKBalance*)(((uint64_t)this_ptr) & ~1);
+ FREE((void*)this_ptr);
+ Balance_free(this_ptr_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Balance_clone(uint32_t orig) {
+ LDKBalance* orig_conv = (LDKBalance*)orig;
+ LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
+ *ret_copy = Balance_clone(orig_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Balance_claimable_on_channel_close(int64_t claimable_amount_satoshis) {
+ LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
+ *ret_copy = Balance_claimable_on_channel_close(claimable_amount_satoshis);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Balance_claimable_awaiting_confirmations(int64_t claimable_amount_satoshis, int32_t confirmation_height) {
+ LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
+ *ret_copy = Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Balance_contentious_claimable(int64_t claimable_amount_satoshis, int32_t timeout_height) {
+ LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
+ *ret_copy = Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Balance_maybe_claimable_htlcawaiting_timeout(int64_t claimable_amount_satoshis, int32_t claimable_height) {
+ LDKBalance *ret_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
+ *ret_copy = Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+jboolean __attribute__((visibility("default"))) TS_Balance_eq(uint32_t a, uint32_t b) {
+ LDKBalance* a_conv = (LDKBalance*)a;
+ LDKBalance* b_conv = (LDKBalance*)b;
+ jboolean ret_val = Balance_eq(a_conv, b_conv);
+ return ret_val;
+}
+
void __attribute__((visibility("default"))) TS_ChannelMonitor_free(uint32_t this_obj) {
LDKChannelMonitor this_obj_conv;
this_obj_conv.inner = (void*)(this_obj & (~1));
return ret_ref;
}
+uint32_tArray __attribute__((visibility("default"))) TS_ChannelMonitor_get_claimable_balances(uint32_t this_arg) {
+ LDKChannelMonitor this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKCVec_BalanceZ ret_var = ChannelMonitor_get_claimable_balances(&this_arg_conv);
+ uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
+ uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
+ for (size_t j = 0; j < ret_var.datalen; j++) {
+ LDKBalance *ret_conv_9_copy = MALLOC(sizeof(LDKBalance), "LDKBalance");
+ *ret_conv_9_copy = Balance_clone(&ret_var.data[j]);
+ uint64_t ret_conv_9_ref = (uint64_t)ret_conv_9_copy;
+ ret_arr_ptr[j] = ret_conv_9_ref;
+ }
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
void __attribute__((visibility("default"))) TS_Persist_free(uint32_t this_ptr) {
if ((this_ptr & 1) != 0) return;
LDKPersist this_ptr_conv = *(LDKPersist*)(((uint64_t)this_ptr) & ~1);
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
+ val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
DelayedPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
}
CHECK(*((uint32_t*)per_commitment_point_arg) == 33);
memcpy(per_commitment_point_arg_ref.compressed_form, (uint8_t*)(per_commitment_point_arg + 4), 33);
LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
+ output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
LDKPublicKey revocation_pubkey_arg_ref;
CHECK(*((uint32_t*)revocation_pubkey_arg) == 33);
memcpy(revocation_pubkey_arg_ref.compressed_form, (uint8_t*)(revocation_pubkey_arg + 4), 33);
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKTxOut val_conv = *(LDKTxOut*)(((uint64_t)val) & ~1);
+ val_conv = TxOut_clone((LDKTxOut*)(((uint64_t)val) & ~1));
StaticPaymentOutputDescriptor_set_output(&this_ptr_conv, val_conv);
}
outpoint_arg_conv.is_owned = (outpoint_arg & 1) || (outpoint_arg == 0);
outpoint_arg_conv = OutPoint_clone(&outpoint_arg_conv);
LDKTxOut output_arg_conv = *(LDKTxOut*)(((uint64_t)output_arg) & ~1);
+ output_arg_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output_arg) & ~1));
LDKThirtyTwoBytes channel_keys_id_arg_ref;
CHECK(*((uint32_t*)channel_keys_id_arg) == 32);
memcpy(channel_keys_id_arg_ref.data, (uint8_t*)(channel_keys_id_arg + 4), 32);
outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
outpoint_conv = OutPoint_clone(&outpoint_conv);
LDKTxOut output_conv = *(LDKTxOut*)(((uint64_t)output) & ~1);
+ output_conv = TxOut_clone((LDKTxOut*)(((uint64_t)output) & ~1));
LDKSpendableOutputDescriptor *ret_copy = MALLOC(sizeof(LDKSpendableOutputDescriptor), "LDKSpendableOutputDescriptor");
*ret_copy = SpendableOutputDescriptor_static_output(outpoint_conv, output_conv);
uint64_t ret_ref = (uint64_t)ret_copy;
uint32_t __attribute__((visibility("default"))) TS_Sign_clone(uint32_t orig) {
LDKSign* orig_conv = (LDKSign*)(((uint64_t)orig) & ~1);
- LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
- *ret = Sign_clone(orig_conv);
- return (uint64_t)ret;
+ LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
+ *ret_ret = Sign_clone(orig_conv);
+ return (uint64_t)ret_ret;
}
void __attribute__((visibility("default"))) TS_Sign_free(uint32_t this_ptr) {
LDKInMemorySigner this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKBaseSign* ret = MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
- *ret = InMemorySigner_as_BaseSign(&this_arg_conv);
- return (uint64_t)ret;
+ LDKBaseSign* ret_ret =MALLOC(sizeof(LDKBaseSign), "LDKBaseSign");
+ *ret_ret = InMemorySigner_as_BaseSign(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
uint32_t __attribute__((visibility("default"))) TS_InMemorySigner_as_Sign(uint32_t this_arg) {
LDKInMemorySigner this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKSign* ret = MALLOC(sizeof(LDKSign), "LDKSign");
- *ret = InMemorySigner_as_Sign(&this_arg_conv);
- return (uint64_t)ret;
+ LDKSign* ret_ret =MALLOC(sizeof(LDKSign), "LDKSign");
+ *ret_ret = InMemorySigner_as_Sign(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
int8_tArray __attribute__((visibility("default"))) TS_InMemorySigner_write(uint32_t obj) {
LDKKeysManager this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
- *ret = KeysManager_as_KeysInterface(&this_arg_conv);
- return (uint64_t)ret;
+ LDKKeysInterface* ret_ret =MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
+ *ret_ret = KeysManager_as_KeysInterface(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
void __attribute__((visibility("default"))) TS_ChannelManager_free(uint32_t this_obj) {
return ret_ref;
}
-void __attribute__((visibility("default"))) TS_ChannelCounterparty_free(uint32_t this_obj) {
- LDKChannelCounterparty this_obj_conv;
+void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_free(uint32_t this_obj) {
+ LDKCounterpartyForwardingInfo this_obj_conv;
this_obj_conv.inner = (void*)(this_obj & (~1));
this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
- ChannelCounterparty_free(this_obj_conv);
+ CounterpartyForwardingInfo_free(this_obj_conv);
}
-int8_tArray __attribute__((visibility("default"))) TS_ChannelCounterparty_get_node_id(uint32_t this_ptr) {
- LDKChannelCounterparty this_ptr_conv;
+int32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_fee_base_msat(uint32_t this_ptr) {
+ LDKCounterpartyForwardingInfo this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
- memcpy((uint8_t*)(ret_arr + 4), ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
- return ret_arr;
+ int32_t ret_val = CounterpartyForwardingInfo_get_fee_base_msat(&this_ptr_conv);
+ return ret_val;
}
-void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_node_id(uint32_t this_ptr, int8_tArray val) {
- LDKChannelCounterparty this_ptr_conv;
+void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_fee_base_msat(uint32_t this_ptr, int32_t val) {
+ LDKCounterpartyForwardingInfo this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- LDKPublicKey val_ref;
- CHECK(*((uint32_t*)val) == 33);
- memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
- ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
+ CounterpartyForwardingInfo_set_fee_base_msat(&this_ptr_conv, val);
}
-uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_features(uint32_t this_ptr) {
- LDKChannelCounterparty this_ptr_conv;
+int32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_fee_proportional_millionths(uint32_t this_ptr) {
+ LDKCounterpartyForwardingInfo this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
- CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t ret_ref = (uint64_t)ret_var.inner;
- if (ret_var.is_owned) {
- ret_ref |= 1;
- }
- return ret_ref;
+ int32_t ret_val = CounterpartyForwardingInfo_get_fee_proportional_millionths(&this_ptr_conv);
+ return ret_val;
}
-void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_features(uint32_t this_ptr, uint32_t val) {
- LDKChannelCounterparty this_ptr_conv;
+void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_fee_proportional_millionths(uint32_t this_ptr, int32_t val) {
+ LDKCounterpartyForwardingInfo this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
- LDKInitFeatures val_conv;
- val_conv.inner = (void*)(val & (~1));
- val_conv.is_owned = (val & 1) || (val == 0);
- val_conv = InitFeatures_clone(&val_conv);
+ CounterpartyForwardingInfo_set_fee_proportional_millionths(&this_ptr_conv, val);
+}
+
+int16_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_get_cltv_expiry_delta(uint32_t this_ptr) {
+ LDKCounterpartyForwardingInfo this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int16_t ret_val = CounterpartyForwardingInfo_get_cltv_expiry_delta(&this_ptr_conv);
+ return ret_val;
+}
+
+void __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_set_cltv_expiry_delta(uint32_t this_ptr, int16_t val) {
+ LDKCounterpartyForwardingInfo this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ CounterpartyForwardingInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_new(int32_t fee_base_msat_arg, int32_t fee_proportional_millionths_arg, int16_t cltv_expiry_delta_arg) {
+ LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_CounterpartyForwardingInfo_clone(uint32_t orig) {
+ LDKCounterpartyForwardingInfo orig_conv;
+ orig_conv.inner = (void*)(orig & (~1));
+ orig_conv.is_owned = false;
+ LDKCounterpartyForwardingInfo ret_var = CounterpartyForwardingInfo_clone(&orig_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_ChannelCounterparty_free(uint32_t this_obj) {
+ LDKChannelCounterparty this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ ChannelCounterparty_free(this_obj_conv);
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_ChannelCounterparty_get_node_id(uint32_t this_ptr) {
+ LDKChannelCounterparty this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ int8_tArray ret_arr = init_arr(33, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), ChannelCounterparty_get_node_id(&this_ptr_conv).compressed_form, 33);
+ return ret_arr;
+}
+
+void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_node_id(uint32_t this_ptr, int8_tArray val) {
+ LDKChannelCounterparty this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKPublicKey val_ref;
+ CHECK(*((uint32_t*)val) == 33);
+ memcpy(val_ref.compressed_form, (uint8_t*)(val + 4), 33);
+ ChannelCounterparty_set_node_id(&this_ptr_conv, val_ref);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_features(uint32_t this_ptr) {
+ LDKChannelCounterparty this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKInitFeatures ret_var = ChannelCounterparty_get_features(&this_ptr_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_features(uint32_t this_ptr, uint32_t val) {
+ LDKChannelCounterparty this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKInitFeatures val_conv;
+ val_conv.inner = (void*)(val & (~1));
+ val_conv.is_owned = (val & 1) || (val == 0);
+ val_conv = InitFeatures_clone(&val_conv);
ChannelCounterparty_set_features(&this_ptr_conv, val_conv);
}
ChannelCounterparty_set_unspendable_punishment_reserve(&this_ptr_conv, val);
}
+uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_get_forwarding_info(uint32_t this_ptr) {
+ LDKChannelCounterparty this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCounterpartyForwardingInfo ret_var = ChannelCounterparty_get_forwarding_info(&this_ptr_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+void __attribute__((visibility("default"))) TS_ChannelCounterparty_set_forwarding_info(uint32_t this_ptr, uint32_t val) {
+ LDKChannelCounterparty this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCounterpartyForwardingInfo val_conv;
+ val_conv.inner = (void*)(val & (~1));
+ val_conv.is_owned = (val & 1) || (val == 0);
+ val_conv = CounterpartyForwardingInfo_clone(&val_conv);
+ ChannelCounterparty_set_forwarding_info(&this_ptr_conv, val_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_new(int8_tArray node_id_arg, uint32_t features_arg, int64_t unspendable_punishment_reserve_arg, uint32_t forwarding_info_arg) {
+ LDKPublicKey node_id_arg_ref;
+ CHECK(*((uint32_t*)node_id_arg) == 33);
+ memcpy(node_id_arg_ref.compressed_form, (uint8_t*)(node_id_arg + 4), 33);
+ LDKInitFeatures features_arg_conv;
+ features_arg_conv.inner = (void*)(features_arg & (~1));
+ features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
+ features_arg_conv = InitFeatures_clone(&features_arg_conv);
+ LDKCounterpartyForwardingInfo forwarding_info_arg_conv;
+ forwarding_info_arg_conv.inner = (void*)(forwarding_info_arg & (~1));
+ forwarding_info_arg_conv.is_owned = (forwarding_info_arg & 1) || (forwarding_info_arg == 0);
+ forwarding_info_arg_conv = CounterpartyForwardingInfo_clone(&forwarding_info_arg_conv);
+ LDKChannelCounterparty ret_var = ChannelCounterparty_new(node_id_arg_ref, features_arg_conv, unspendable_punishment_reserve_arg, forwarding_info_arg_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
uint32_t __attribute__((visibility("default"))) TS_ChannelCounterparty_clone(uint32_t orig) {
LDKChannelCounterparty orig_conv;
orig_conv.inner = (void*)(orig & (~1));
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
ChannelDetails_set_short_channel_id(&this_ptr_conv, val_conv);
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
ChannelDetails_set_unspendable_punishment_reserve(&this_ptr_conv, val_conv);
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
ChannelDetails_set_confirmations_required(&this_ptr_conv, val_conv);
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u16Z val_conv = *(LDKCOption_u16Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)val) & ~1));
ChannelDetails_set_force_close_spend_delay(&this_ptr_conv, val_conv);
}
funding_txo_arg_conv.is_owned = (funding_txo_arg & 1) || (funding_txo_arg == 0);
funding_txo_arg_conv = OutPoint_clone(&funding_txo_arg_conv);
LDKCOption_u64Z short_channel_id_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1);
+ short_channel_id_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)short_channel_id_arg) & ~1));
LDKCOption_u64Z unspendable_punishment_reserve_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)unspendable_punishment_reserve_arg) & ~1);
LDKCOption_u32Z confirmations_required_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1);
+ confirmations_required_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)confirmations_required_arg) & ~1));
LDKCOption_u16Z force_close_spend_delay_arg_conv = *(LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1);
+ force_close_spend_delay_arg_conv = COption_u16Z_clone((LDKCOption_u16Z*)(((uint64_t)force_close_spend_delay_arg) & ~1));
LDKChannelDetails ret_var = ChannelDetails_new(channel_id_arg_ref, counterparty_arg_conv, funding_txo_arg_conv, short_channel_id_arg_conv, channel_value_satoshis_arg, unspendable_punishment_reserve_arg_conv, user_id_arg, outbound_capacity_msat_arg, inbound_capacity_msat_arg, confirmations_required_arg_conv, force_close_spend_delay_arg_conv, is_outbound_arg, is_funding_locked_arg, is_usable_arg, is_public_arg);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint32_t __attribute__((visibility("default"))) TS_PaymentSendFailure_parameter_error(uint32_t a) {
LDKAPIError a_conv = *(LDKAPIError*)(((uint64_t)a) & ~1);
+ a_conv = APIError_clone((LDKAPIError*)(((uint64_t)a) & ~1));
LDKPaymentSendFailure *ret_copy = MALLOC(sizeof(LDKPaymentSendFailure), "LDKPaymentSendFailure");
*ret_copy = PaymentSendFailure_parameter_error(a_conv);
uint64_t ret_ref = (uint64_t)ret_copy;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
+ min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
LDKC2Tuple_PaymentHashPaymentSecretZ* ret_ref = MALLOC(sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ), "LDKC2Tuple_PaymentHashPaymentSecretZ");
*ret_ref = ChannelManager_create_inbound_payment(&this_arg_conv, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
return (uint64_t)ret_ref;
CHECK(*((uint32_t*)payment_hash) == 32);
memcpy(payment_hash_ref.data, (uint8_t*)(payment_hash + 4), 32);
LDKCOption_u64Z min_value_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1);
+ min_value_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)min_value_msat) & ~1));
LDKCResult_PaymentSecretAPIErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_PaymentSecretAPIErrorZ), "LDKCResult_PaymentSecretAPIErrorZ");
*ret_conv = ChannelManager_create_inbound_payment_for_hash(&this_arg_conv, payment_hash_ref, min_value_msat_conv, invoice_expiry_delta_secs, user_payment_id);
return (uint64_t)ret_conv;
LDKChannelManager this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
- *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
- return (uint64_t)ret;
+ LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
+ *ret_ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_EventsProvider(uint32_t this_arg) {
LDKChannelManager this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
- *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
- return (uint64_t)ret;
+ LDKEventsProvider* ret_ret =MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
+ *ret_ret = ChannelManager_as_EventsProvider(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Listen(uint32_t this_arg) {
LDKChannelManager this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKListen* ret = MALLOC(sizeof(LDKListen), "LDKListen");
- *ret = ChannelManager_as_Listen(&this_arg_conv);
- return (uint64_t)ret;
+ LDKListen* ret_ret =MALLOC(sizeof(LDKListen), "LDKListen");
+ *ret_ret = ChannelManager_as_Listen(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
uint32_t __attribute__((visibility("default"))) TS_ChannelManager_as_Confirm(uint32_t this_arg) {
LDKChannelManager this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKConfirm* ret = MALLOC(sizeof(LDKConfirm), "LDKConfirm");
- *ret = ChannelManager_as_Confirm(&this_arg_conv);
- return (uint64_t)ret;
+ LDKConfirm* ret_ret =MALLOC(sizeof(LDKConfirm), "LDKConfirm");
+ *ret_ret = ChannelManager_as_Confirm(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
jboolean __attribute__((visibility("default"))) TS_ChannelManager_await_persistable_update_timeout(uint32_t this_arg, int64_t max_wait) {
LDKChannelManager this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
- *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
- return (uint64_t)ret;
+ LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
+ *ret_ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
int8_tArray __attribute__((visibility("default"))) TS_ChannelManager_write(uint32_t obj) {
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKErrorAction val_conv = *(LDKErrorAction*)(((uint64_t)val) & ~1);
+ val_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)val) & ~1));
LightningError_set_action(&this_ptr_conv, val_conv);
}
uint32_t __attribute__((visibility("default"))) TS_LightningError_new(jstring err_arg, uint32_t action_arg) {
LDKStr err_arg_conv = str_ref_to_owned_c(err_arg);
LDKErrorAction action_arg_conv = *(LDKErrorAction*)(((uint64_t)action_arg) & ~1);
+ action_arg_conv = ErrorAction_clone((LDKErrorAction*)(((uint64_t)action_arg) & ~1));
LDKLightningError ret_var = LightningError_new(err_arg_conv, action_arg_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
CommitmentUpdate_free(this_obj_conv);
}
+uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_add_htlcs(uint32_t this_ptr) {
+ LDKCommitmentUpdate this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCVec_UpdateAddHTLCZ ret_var = CommitmentUpdate_get_update_add_htlcs(&this_ptr_conv);
+ uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
+ uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
+ for (size_t p = 0; p < ret_var.datalen; p++) {
+ LDKUpdateAddHTLC ret_conv_15_var = ret_var.data[p];
+ CHECK((((uint64_t)ret_conv_15_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_conv_15_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_conv_15_ref = (uint64_t)ret_conv_15_var.inner;
+ if (ret_conv_15_var.is_owned) {
+ ret_conv_15_ref |= 1;
+ }
+ ret_arr_ptr[p] = ret_conv_15_ref;
+ }
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_add_htlcs(uint32_t this_ptr, uint32_tArray val) {
LDKCommitmentUpdate this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
}
+uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fulfill_htlcs(uint32_t this_ptr) {
+ LDKCommitmentUpdate this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCVec_UpdateFulfillHTLCZ ret_var = CommitmentUpdate_get_update_fulfill_htlcs(&this_ptr_conv);
+ uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
+ uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
+ for (size_t t = 0; t < ret_var.datalen; t++) {
+ LDKUpdateFulfillHTLC ret_conv_19_var = ret_var.data[t];
+ CHECK((((uint64_t)ret_conv_19_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_conv_19_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_conv_19_ref = (uint64_t)ret_conv_19_var.inner;
+ if (ret_conv_19_var.is_owned) {
+ ret_conv_19_ref |= 1;
+ }
+ ret_arr_ptr[t] = ret_conv_19_ref;
+ }
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fulfill_htlcs(uint32_t this_ptr, uint32_tArray val) {
LDKCommitmentUpdate this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
}
+uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fail_htlcs(uint32_t this_ptr) {
+ LDKCommitmentUpdate this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCVec_UpdateFailHTLCZ ret_var = CommitmentUpdate_get_update_fail_htlcs(&this_ptr_conv);
+ uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
+ uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
+ for (size_t q = 0; q < ret_var.datalen; q++) {
+ LDKUpdateFailHTLC ret_conv_16_var = ret_var.data[q];
+ CHECK((((uint64_t)ret_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_conv_16_ref = (uint64_t)ret_conv_16_var.inner;
+ if (ret_conv_16_var.is_owned) {
+ ret_conv_16_ref |= 1;
+ }
+ ret_arr_ptr[q] = ret_conv_16_ref;
+ }
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_htlcs(uint32_t this_ptr, uint32_tArray val) {
LDKCommitmentUpdate this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
}
+uint32_tArray __attribute__((visibility("default"))) TS_CommitmentUpdate_get_update_fail_malformed_htlcs(uint32_t this_ptr) {
+ LDKCommitmentUpdate this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCVec_UpdateFailMalformedHTLCZ ret_var = CommitmentUpdate_get_update_fail_malformed_htlcs(&this_ptr_conv);
+ uint32_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
+ uint32_t *ret_arr_ptr = (uint32_t*)(ret_arr + 4);
+ for (size_t z = 0; z < ret_var.datalen; z++) {
+ LDKUpdateFailMalformedHTLC ret_conv_25_var = ret_var.data[z];
+ CHECK((((uint64_t)ret_conv_25_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_conv_25_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_conv_25_ref = (uint64_t)ret_conv_25_var.inner;
+ if (ret_conv_25_var.is_owned) {
+ ret_conv_25_ref |= 1;
+ }
+ ret_arr_ptr[z] = ret_conv_25_ref;
+ }
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
void __attribute__((visibility("default"))) TS_CommitmentUpdate_set_update_fail_malformed_htlcs(uint32_t this_ptr, uint32_tArray val) {
LDKCommitmentUpdate this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
return ret_ref;
}
-void __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_free(uint32_t this_ptr) {
- if ((this_ptr & 1) != 0) return;
- LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)(((uint64_t)this_ptr) & ~1);
- FREE((void*)this_ptr);
- HTLCFailChannelUpdate_free(this_ptr_conv);
-}
-
-uint32_t __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_clone(uint32_t orig) {
- LDKHTLCFailChannelUpdate* orig_conv = (LDKHTLCFailChannelUpdate*)orig;
- LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
- *ret_copy = HTLCFailChannelUpdate_clone(orig_conv);
- uint64_t ret_ref = (uint64_t)ret_copy;
- return ret_ref;
-}
-
-uint32_t __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_channel_update_message(uint32_t msg) {
- LDKChannelUpdate msg_conv;
- msg_conv.inner = (void*)(msg & (~1));
- msg_conv.is_owned = (msg & 1) || (msg == 0);
- msg_conv = ChannelUpdate_clone(&msg_conv);
- LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
- *ret_copy = HTLCFailChannelUpdate_channel_update_message(msg_conv);
- uint64_t ret_ref = (uint64_t)ret_copy;
- return ret_ref;
-}
-
-uint32_t __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_channel_closed(int64_t short_channel_id, jboolean is_permanent) {
- LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
- *ret_copy = HTLCFailChannelUpdate_channel_closed(short_channel_id, is_permanent);
- uint64_t ret_ref = (uint64_t)ret_copy;
- return ret_ref;
-}
-
-uint32_t __attribute__((visibility("default"))) TS_HTLCFailChannelUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
- LDKPublicKey node_id_ref;
- CHECK(*((uint32_t*)node_id) == 33);
- memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
- LDKHTLCFailChannelUpdate *ret_copy = MALLOC(sizeof(LDKHTLCFailChannelUpdate), "LDKHTLCFailChannelUpdate");
- *ret_copy = HTLCFailChannelUpdate_node_failure(node_id_ref, is_permanent);
- uint64_t ret_ref = (uint64_t)ret_copy;
- return ret_ref;
-}
-
void __attribute__((visibility("default"))) TS_ChannelMessageHandler_free(uint32_t this_ptr) {
if ((this_ptr & 1) != 0) return;
LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)(((uint64_t)this_ptr) & ~1);
return ret_arr;
}
-uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
- LDKu8slice ser_ref;
- ser_ref.datalen = *((uint32_t*)ser);
- ser_ref.data = (int8_t*)(ser + 4);
- LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
- *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
- return (uint64_t)ret_conv;
-}
-
int8_tArray __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_write(uint32_t obj) {
LDKReplyShortChannelIdsEnd obj_conv;
obj_conv.inner = (void*)(obj & (~1));
return ret_arr;
}
+uint32_t __attribute__((visibility("default"))) TS_ReplyShortChannelIdsEnd_read(int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = *((uint32_t*)ser);
+ ser_ref.data = (int8_t*)(ser + 4);
+ LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ), "LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ");
+ *ret_conv = ReplyShortChannelIdsEnd_read(ser_ref);
+ return (uint64_t)ret_conv;
+}
+
int32_t __attribute__((visibility("default"))) TS_QueryChannelRange_end_blocknum(uint32_t this_arg) {
LDKQueryChannelRange this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
return ret_val;
}
-uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_read(int8_tArray ser) {
- LDKu8slice ser_ref;
- ser_ref.datalen = *((uint32_t*)ser);
- ser_ref.data = (int8_t*)(ser + 4);
- LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
- *ret_conv = QueryChannelRange_read(ser_ref);
- return (uint64_t)ret_conv;
-}
-
int8_tArray __attribute__((visibility("default"))) TS_QueryChannelRange_write(uint32_t obj) {
LDKQueryChannelRange obj_conv;
obj_conv.inner = (void*)(obj & (~1));
return ret_arr;
}
+uint32_t __attribute__((visibility("default"))) TS_QueryChannelRange_read(int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = *((uint32_t*)ser);
+ ser_ref.data = (int8_t*)(ser + 4);
+ LDKCResult_QueryChannelRangeDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ), "LDKCResult_QueryChannelRangeDecodeErrorZ");
+ *ret_conv = QueryChannelRange_read(ser_ref);
+ return (uint64_t)ret_conv;
+}
+
uint32_t __attribute__((visibility("default"))) TS_ReplyChannelRange_read(int8_tArray ser) {
LDKu8slice ser_ref;
ser_ref.datalen = *((uint32_t*)ser);
return ret_arr;
}
-uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
- LDKu8slice ser_ref;
- ser_ref.datalen = *((uint32_t*)ser);
- ser_ref.data = (int8_t*)(ser + 4);
- LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
- *ret_conv = GossipTimestampFilter_read(ser_ref);
- return (uint64_t)ret_conv;
-}
-
int8_tArray __attribute__((visibility("default"))) TS_GossipTimestampFilter_write(uint32_t obj) {
LDKGossipTimestampFilter obj_conv;
obj_conv.inner = (void*)(obj & (~1));
return ret_arr;
}
+uint32_t __attribute__((visibility("default"))) TS_GossipTimestampFilter_read(int8_tArray ser) {
+ LDKu8slice ser_ref;
+ ser_ref.datalen = *((uint32_t*)ser);
+ ser_ref.data = (int8_t*)(ser + 4);
+ LDKCResult_GossipTimestampFilterDecodeErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ), "LDKCResult_GossipTimestampFilterDecodeErrorZ");
+ *ret_conv = GossipTimestampFilter_read(ser_ref);
+ return (uint64_t)ret_conv;
+}
+
+void __attribute__((visibility("default"))) TS_CustomMessageHandler_free(uint32_t this_ptr) {
+ if ((this_ptr & 1) != 0) return;
+ LDKCustomMessageHandler this_ptr_conv = *(LDKCustomMessageHandler*)(((uint64_t)this_ptr) & ~1);
+ FREE((void*)this_ptr);
+ CustomMessageHandler_free(this_ptr_conv);
+}
+
void __attribute__((visibility("default"))) TS_IgnoringMessageHandler_free(uint32_t this_obj) {
LDKIgnoringMessageHandler this_obj_conv;
this_obj_conv.inner = (void*)(this_obj & (~1));
LDKIgnoringMessageHandler this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
- *ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
- return (uint64_t)ret;
+ LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
+ *ret_ret = IgnoringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_RoutingMessageHandler(uint32_t this_arg) {
LDKIgnoringMessageHandler this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
- *ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
- return (uint64_t)ret;
+ LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
+ *ret_ret = IgnoringMessageHandler_as_RoutingMessageHandler(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
-void __attribute__((visibility("default"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
- LDKErroringMessageHandler this_obj_conv;
+uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_CustomMessageReader(uint32_t this_arg) {
+ LDKIgnoringMessageHandler this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKCustomMessageReader* ret_ret =MALLOC(sizeof(LDKCustomMessageReader), "LDKCustomMessageReader");
+ *ret_ret = IgnoringMessageHandler_as_CustomMessageReader(&this_arg_conv);
+ return (uint64_t)ret_ret;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_IgnoringMessageHandler_as_CustomMessageHandler(uint32_t this_arg) {
+ LDKIgnoringMessageHandler this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKCustomMessageHandler* ret_ret =MALLOC(sizeof(LDKCustomMessageHandler), "LDKCustomMessageHandler");
+ *ret_ret = IgnoringMessageHandler_as_CustomMessageHandler(&this_arg_conv);
+ return (uint64_t)ret_ret;
+}
+
+void __attribute__((visibility("default"))) TS_ErroringMessageHandler_free(uint32_t this_obj) {
+ LDKErroringMessageHandler this_obj_conv;
this_obj_conv.inner = (void*)(this_obj & (~1));
this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
ErroringMessageHandler_free(this_obj_conv);
LDKErroringMessageHandler this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
- *ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
- return (uint64_t)ret;
+ LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
+ *ret_ret = ErroringMessageHandler_as_MessageSendEventsProvider(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
uint32_t __attribute__((visibility("default"))) TS_ErroringMessageHandler_as_ChannelMessageHandler(uint32_t this_arg) {
LDKErroringMessageHandler this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
- *ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
- return (uint64_t)ret;
+ LDKChannelMessageHandler* ret_ret =MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
+ *ret_ret = ErroringMessageHandler_as_ChannelMessageHandler(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
void __attribute__((visibility("default"))) TS_MessageHandler_free(uint32_t this_obj) {
uint32_t __attribute__((visibility("default"))) TS_SocketDescriptor_clone(uint32_t orig) {
LDKSocketDescriptor* orig_conv = (LDKSocketDescriptor*)(((uint64_t)orig) & ~1);
- LDKSocketDescriptor* ret = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
- *ret = SocketDescriptor_clone(orig_conv);
- return (uint64_t)ret;
+ LDKSocketDescriptor* ret_ret =MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
+ *ret_ret = SocketDescriptor_clone(orig_conv);
+ return (uint64_t)ret_ret;
}
void __attribute__((visibility("default"))) TS_SocketDescriptor_free(uint32_t this_ptr) {
PeerManager_free(this_obj_conv);
}
-uint32_t __attribute__((visibility("default"))) TS_PeerManager_new(uint32_t message_handler, int8_tArray our_node_secret, int8_tArray ephemeral_random_data, uint32_t logger) {
+uint32_t __attribute__((visibility("default"))) TS_PeerManager_new(uint32_t message_handler, int8_tArray our_node_secret, int8_tArray ephemeral_random_data, uint32_t logger, uint32_t custom_message_handler) {
LDKMessageHandler message_handler_conv;
message_handler_conv.inner = (void*)(message_handler & (~1));
message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
memcpy(ephemeral_random_data_arr, (uint8_t*)(ephemeral_random_data + 4), 32);
unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
- LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
+ LDKCustomMessageHandler custom_message_handler_conv = *(LDKCustomMessageHandler*)(((uint64_t)custom_message_handler) & ~1);
+ LDKPeerManager ret_var = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv, custom_message_handler_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_arr;
}
+int8_tArray __attribute__((visibility("default"))) TS_build_closing_transaction(int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, uint32_t funding_outpoint) {
+ LDKCVec_u8Z to_holder_script_ref;
+ to_holder_script_ref.datalen = *((uint32_t*)to_holder_script);
+ to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
+ memcpy(to_holder_script_ref.data, (uint8_t*)(to_holder_script + 4), to_holder_script_ref.datalen);
+ LDKCVec_u8Z to_counterparty_script_ref;
+ to_counterparty_script_ref.datalen = *((uint32_t*)to_counterparty_script);
+ to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
+ memcpy(to_counterparty_script_ref.data, (uint8_t*)(to_counterparty_script + 4), to_counterparty_script_ref.datalen);
+ LDKOutPoint funding_outpoint_conv;
+ funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
+ funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
+ funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
+ LDKTransaction ret_var = build_closing_transaction(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
+ int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
+ Transaction_free(ret_var);
+ return ret_arr;
+}
+
uint32_t __attribute__((visibility("default"))) TS_derive_private_key(int8_tArray per_commitment_point, int8_tArray base_secret) {
LDKPublicKey per_commitment_point_ref;
CHECK(*((uint32_t*)per_commitment_point) == 33);
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u32Z val_conv = *(LDKCOption_u32Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)val) & ~1));
HTLCOutputInCommitment_set_transaction_output_index(&this_ptr_conv, val_conv);
}
CHECK(*((uint32_t*)payment_hash_arg) == 32);
memcpy(payment_hash_arg_ref.data, (uint8_t*)(payment_hash_arg + 4), 32);
LDKCOption_u32Z transaction_output_index_arg_conv = *(LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1);
+ transaction_output_index_arg_conv = COption_u32Z_clone((LDKCOption_u32Z*)(((uint64_t)transaction_output_index_arg) & ~1));
LDKHTLCOutputInCommitment ret_var = HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg_ref, transaction_output_index_arg_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
return ret_arr;
}
+void __attribute__((visibility("default"))) TS_ClosingTransaction_free(uint32_t this_obj) {
+ LDKClosingTransaction this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ ClosingTransaction_free(this_obj_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_new(int64_t to_holder_value_sat, int64_t to_counterparty_value_sat, int8_tArray to_holder_script, int8_tArray to_counterparty_script, uint32_t funding_outpoint) {
+ LDKCVec_u8Z to_holder_script_ref;
+ to_holder_script_ref.datalen = *((uint32_t*)to_holder_script);
+ to_holder_script_ref.data = MALLOC(to_holder_script_ref.datalen, "LDKCVec_u8Z Bytes");
+ memcpy(to_holder_script_ref.data, (uint8_t*)(to_holder_script + 4), to_holder_script_ref.datalen);
+ LDKCVec_u8Z to_counterparty_script_ref;
+ to_counterparty_script_ref.datalen = *((uint32_t*)to_counterparty_script);
+ to_counterparty_script_ref.data = MALLOC(to_counterparty_script_ref.datalen, "LDKCVec_u8Z Bytes");
+ memcpy(to_counterparty_script_ref.data, (uint8_t*)(to_counterparty_script + 4), to_counterparty_script_ref.datalen);
+ LDKOutPoint funding_outpoint_conv;
+ funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
+ funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
+ funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
+ LDKClosingTransaction ret_var = ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script_ref, to_counterparty_script_ref, funding_outpoint_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_trust(uint32_t this_arg) {
+ LDKClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKTrustedClosingTransaction ret_var = ClosingTransaction_trust(&this_arg_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ClosingTransaction_verify(uint32_t this_arg, uint32_t funding_outpoint) {
+ LDKClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKOutPoint funding_outpoint_conv;
+ funding_outpoint_conv.inner = (void*)(funding_outpoint & (~1));
+ funding_outpoint_conv.is_owned = (funding_outpoint & 1) || (funding_outpoint == 0);
+ funding_outpoint_conv = OutPoint_clone(&funding_outpoint_conv);
+ LDKCResult_TrustedClosingTransactionNoneZ* ret_conv = MALLOC(sizeof(LDKCResult_TrustedClosingTransactionNoneZ), "LDKCResult_TrustedClosingTransactionNoneZ");
+ *ret_conv = ClosingTransaction_verify(&this_arg_conv, funding_outpoint_conv);
+ return (uint64_t)ret_conv;
+}
+
+int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_to_holder_value_sat(uint32_t this_arg) {
+ LDKClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ int64_t ret_val = ClosingTransaction_to_holder_value_sat(&this_arg_conv);
+ return ret_val;
+}
+
+int64_t __attribute__((visibility("default"))) TS_ClosingTransaction_to_counterparty_value_sat(uint32_t this_arg) {
+ LDKClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ int64_t ret_val = ClosingTransaction_to_counterparty_value_sat(&this_arg_conv);
+ return ret_val;
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_ClosingTransaction_to_holder_script(uint32_t this_arg) {
+ LDKClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKu8slice ret_var = ClosingTransaction_to_holder_script(&this_arg_conv);
+ int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
+ return ret_arr;
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_ClosingTransaction_to_counterparty_script(uint32_t this_arg) {
+ LDKClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKu8slice ret_var = ClosingTransaction_to_counterparty_script(&this_arg_conv);
+ int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
+ return ret_arr;
+}
+
+void __attribute__((visibility("default"))) TS_TrustedClosingTransaction_free(uint32_t this_obj) {
+ LDKTrustedClosingTransaction this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ TrustedClosingTransaction_free(this_obj_conv);
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_built_transaction(uint32_t this_arg) {
+ LDKTrustedClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKTransaction ret_var = TrustedClosingTransaction_built_transaction(&this_arg_conv);
+ int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
+ Transaction_free(ret_var);
+ return ret_arr;
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_get_sighash_all(uint32_t this_arg, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
+ LDKTrustedClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKu8slice funding_redeemscript_ref;
+ funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
+ funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
+ int8_tArray ret_arr = init_arr(32, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), TrustedClosingTransaction_get_sighash_all(&this_arg_conv, funding_redeemscript_ref, channel_value_satoshis).data, 32);
+ return ret_arr;
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_TrustedClosingTransaction_sign(uint32_t this_arg, int8_tArray funding_key, int8_tArray funding_redeemscript, int64_t channel_value_satoshis) {
+ LDKTrustedClosingTransaction this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ unsigned char funding_key_arr[32];
+ CHECK(*((uint32_t*)funding_key) == 32);
+ memcpy(funding_key_arr, (uint8_t*)(funding_key + 4), 32);
+ unsigned char (*funding_key_ref)[32] = &funding_key_arr;
+ LDKu8slice funding_redeemscript_ref;
+ funding_redeemscript_ref.datalen = *((uint32_t*)funding_redeemscript);
+ funding_redeemscript_ref.data = (int8_t*)(funding_redeemscript + 4);
+ int8_tArray ret_arr = init_arr(64, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), TrustedClosingTransaction_sign(&this_arg_conv, funding_key_ref, funding_redeemscript_ref, channel_value_satoshis).compact_form, 64);
+ return ret_arr;
+}
+
void __attribute__((visibility("default"))) TS_CommitmentTransaction_free(uint32_t this_obj) {
LDKCommitmentTransaction this_obj_conv;
this_obj_conv.inner = (void*)(this_obj & (~1));
return ret_ref;
}
+jboolean __attribute__((visibility("default"))) TS_InitFeatures_requires_unknown_bits(uint32_t this_arg) {
+ LDKInitFeatures this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ jboolean ret_val = InitFeatures_requires_unknown_bits(&this_arg_conv);
+ return ret_val;
+}
+
uint32_t __attribute__((visibility("default"))) TS_NodeFeatures_empty() {
LDKNodeFeatures ret_var = NodeFeatures_empty();
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
return ret_ref;
}
+jboolean __attribute__((visibility("default"))) TS_NodeFeatures_requires_unknown_bits(uint32_t this_arg) {
+ LDKNodeFeatures this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ jboolean ret_val = NodeFeatures_requires_unknown_bits(&this_arg_conv);
+ return ret_val;
+}
+
uint32_t __attribute__((visibility("default"))) TS_ChannelFeatures_empty() {
LDKChannelFeatures ret_var = ChannelFeatures_empty();
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
return ret_ref;
}
+jboolean __attribute__((visibility("default"))) TS_ChannelFeatures_requires_unknown_bits(uint32_t this_arg) {
+ LDKChannelFeatures this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ jboolean ret_val = ChannelFeatures_requires_unknown_bits(&this_arg_conv);
+ return ret_val;
+}
+
uint32_t __attribute__((visibility("default"))) TS_InvoiceFeatures_empty() {
LDKInvoiceFeatures ret_var = InvoiceFeatures_empty();
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
return ret_ref;
}
+jboolean __attribute__((visibility("default"))) TS_InvoiceFeatures_requires_unknown_bits(uint32_t this_arg) {
+ LDKInvoiceFeatures this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ jboolean ret_val = InvoiceFeatures_requires_unknown_bits(&this_arg_conv);
+ return ret_val;
+}
+
jboolean __attribute__((visibility("default"))) TS_InitFeatures_supports_payment_secret(uint32_t this_arg) {
LDKInitFeatures this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
return ret_val;
}
+void __attribute__((visibility("default"))) TS_CustomMessageReader_free(uint32_t this_ptr) {
+ if ((this_ptr & 1) != 0) return;
+ LDKCustomMessageReader this_ptr_conv = *(LDKCustomMessageReader*)(((uint64_t)this_ptr) & ~1);
+ FREE((void*)this_ptr);
+ CustomMessageReader_free(this_ptr_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Type_clone(uint32_t orig) {
+ LDKType* orig_conv = (LDKType*)(((uint64_t)orig) & ~1);
+ LDKType* ret_ret =MALLOC(sizeof(LDKType), "LDKType");
+ *ret_ret = Type_clone(orig_conv);
+ return (uint64_t)ret_ret;
+}
+
+void __attribute__((visibility("default"))) TS_Type_free(uint32_t this_ptr) {
+ if ((this_ptr & 1) != 0) return;
+ LDKType this_ptr_conv = *(LDKType*)(((uint64_t)this_ptr) & ~1);
+ FREE((void*)this_ptr);
+ Type_free(this_ptr_conv);
+}
+
void __attribute__((visibility("default"))) TS_RouteHop_free(uint32_t this_obj) {
LDKRouteHop this_obj_conv;
this_obj_conv.inner = (void*)(this_obj & (~1));
return ret_ref;
}
+int64_t __attribute__((visibility("default"))) TS_RouteHop_hash(uint32_t o) {
+ LDKRouteHop o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = RouteHop_hash(&o_conv);
+ return ret_val;
+}
+
+jboolean __attribute__((visibility("default"))) TS_RouteHop_eq(uint32_t a, uint32_t b) {
+ LDKRouteHop a_conv;
+ a_conv.inner = (void*)(a & (~1));
+ a_conv.is_owned = false;
+ LDKRouteHop b_conv;
+ b_conv.inner = (void*)(b & (~1));
+ b_conv.is_owned = false;
+ jboolean ret_val = RouteHop_eq(&a_conv, &b_conv);
+ return ret_val;
+}
+
int8_tArray __attribute__((visibility("default"))) TS_RouteHop_write(uint32_t obj) {
LDKRouteHop obj_conv;
obj_conv.inner = (void*)(obj & (~1));
Route_free(this_obj_conv);
}
+ptrArray __attribute__((visibility("default"))) TS_Route_get_paths(uint32_t this_ptr) {
+ LDKRoute this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKCVec_CVec_RouteHopZZ ret_var = Route_get_paths(&this_ptr_conv);
+ ptrArray ret_arr = init_arr(ret_var.datalen, sizeof(uint32_t), "Native ptrArray Bytes");
+ uint32_tArray *ret_arr_ptr = (uint32_tArray*)(ret_arr + 4);
+ for (size_t m = 0; m < ret_var.datalen; m++) {
+ LDKCVec_RouteHopZ ret_conv_12_var = ret_var.data[m];
+ uint32_tArray ret_conv_12_arr = init_arr(ret_conv_12_var.datalen, sizeof(uint32_t), "Native uint32_tArray Bytes");
+ uint32_t *ret_conv_12_arr_ptr = (uint32_t*)(ret_conv_12_arr + 4);
+ for (size_t k = 0; k < ret_conv_12_var.datalen; k++) {
+ LDKRouteHop ret_conv_12_conv_10_var = ret_conv_12_var.data[k];
+ CHECK((((uint64_t)ret_conv_12_conv_10_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_conv_12_conv_10_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_conv_12_conv_10_ref = (uint64_t)ret_conv_12_conv_10_var.inner;
+ if (ret_conv_12_conv_10_var.is_owned) {
+ ret_conv_12_conv_10_ref |= 1;
+ }
+ ret_conv_12_arr_ptr[k] = ret_conv_12_conv_10_ref;
+ }
+ FREE(ret_conv_12_var.data);
+ ret_arr_ptr[m] = ret_conv_12_arr;
+ }
+ FREE(ret_var.data);
+ return ret_arr;
+}
+
void __attribute__((visibility("default"))) TS_Route_set_paths(uint32_t this_ptr, ptrArray val) {
LDKRoute this_ptr_conv;
this_ptr_conv.inner = (void*)(this_ptr & (~1));
return ret_ref;
}
+int64_t __attribute__((visibility("default"))) TS_Route_hash(uint32_t o) {
+ LDKRoute o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = Route_hash(&o_conv);
+ return ret_val;
+}
+
+jboolean __attribute__((visibility("default"))) TS_Route_eq(uint32_t a, uint32_t b) {
+ LDKRoute a_conv;
+ a_conv.inner = (void*)(a & (~1));
+ a_conv.is_owned = false;
+ LDKRoute b_conv;
+ b_conv.inner = (void*)(b & (~1));
+ b_conv.is_owned = false;
+ jboolean ret_val = Route_eq(&a_conv, &b_conv);
+ return ret_val;
+}
+
+int64_t __attribute__((visibility("default"))) TS_Route_get_total_fees(uint32_t this_arg) {
+ LDKRoute this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ int64_t ret_val = Route_get_total_fees(&this_arg_conv);
+ return ret_val;
+}
+
+int64_t __attribute__((visibility("default"))) TS_Route_get_total_amount(uint32_t this_arg) {
+ LDKRoute this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ int64_t ret_val = Route_get_total_amount(&this_arg_conv);
+ return ret_val;
+}
+
int8_tArray __attribute__((visibility("default"))) TS_Route_write(uint32_t obj) {
LDKRoute obj_conv;
obj_conv.inner = (void*)(obj & (~1));
RouteHint_free(this_obj_conv);
}
-jboolean __attribute__((visibility("default"))) TS_RouteHint_eq(uint32_t a, uint32_t b) {
- LDKRouteHint a_conv;
- a_conv.inner = (void*)(a & (~1));
- a_conv.is_owned = false;
- LDKRouteHint b_conv;
- b_conv.inner = (void*)(b & (~1));
- b_conv.is_owned = false;
- jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
- return ret_val;
-}
-
uint32_t __attribute__((visibility("default"))) TS_RouteHint_clone(uint32_t orig) {
LDKRouteHint orig_conv;
orig_conv.inner = (void*)(orig & (~1));
return ret_ref;
}
+int64_t __attribute__((visibility("default"))) TS_RouteHint_hash(uint32_t o) {
+ LDKRouteHint o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = RouteHint_hash(&o_conv);
+ return ret_val;
+}
+
+jboolean __attribute__((visibility("default"))) TS_RouteHint_eq(uint32_t a, uint32_t b) {
+ LDKRouteHint a_conv;
+ a_conv.inner = (void*)(a & (~1));
+ a_conv.is_owned = false;
+ LDKRouteHint b_conv;
+ b_conv.inner = (void*)(b & (~1));
+ b_conv.is_owned = false;
+ jboolean ret_val = RouteHint_eq(&a_conv, &b_conv);
+ return ret_val;
+}
+
void __attribute__((visibility("default"))) TS_RouteHintHop_free(uint32_t this_obj) {
LDKRouteHintHop this_obj_conv;
this_obj_conv.inner = (void*)(this_obj & (~1));
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
RouteHintHop_set_htlc_minimum_msat(&this_ptr_conv, val_conv);
}
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
RouteHintHop_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
}
fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
LDKCOption_u64Z htlc_minimum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1);
+ htlc_minimum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_minimum_msat_arg) & ~1));
LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
+ htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
LDKRouteHintHop ret_var = RouteHintHop_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg_conv, htlc_maximum_msat_arg_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
return ret_ref;
}
-jboolean __attribute__((visibility("default"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) {
- LDKRouteHintHop a_conv;
- a_conv.inner = (void*)(a & (~1));
- a_conv.is_owned = false;
- LDKRouteHintHop b_conv;
- b_conv.inner = (void*)(b & (~1));
- b_conv.is_owned = false;
- jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
- return ret_val;
-}
-
uint32_t __attribute__((visibility("default"))) TS_RouteHintHop_clone(uint32_t orig) {
LDKRouteHintHop orig_conv;
orig_conv.inner = (void*)(orig & (~1));
return ret_ref;
}
+int64_t __attribute__((visibility("default"))) TS_RouteHintHop_hash(uint32_t o) {
+ LDKRouteHintHop o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = RouteHintHop_hash(&o_conv);
+ return ret_val;
+}
+
+jboolean __attribute__((visibility("default"))) TS_RouteHintHop_eq(uint32_t a, uint32_t b) {
+ LDKRouteHintHop a_conv;
+ a_conv.inner = (void*)(a & (~1));
+ a_conv.is_owned = false;
+ LDKRouteHintHop b_conv;
+ b_conv.inner = (void*)(b & (~1));
+ b_conv.is_owned = false;
+ jboolean ret_val = RouteHintHop_eq(&a_conv, &b_conv);
+ return ret_val;
+}
+
uint32_t __attribute__((visibility("default"))) TS_get_keysend_route(int8_tArray our_node_id, uint32_t network, int8_tArray payee, uint32_tArray first_hops, uint32_tArray last_hops, int64_t final_value_msat, int32_t final_cltv, uint32_t logger) {
LDKPublicKey our_node_id_ref;
CHECK(*((uint32_t*)our_node_id) == 33);
NetworkGraph_free(this_obj_conv);
}
-uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_clone(uint32_t orig) {
- LDKNetworkGraph orig_conv;
- orig_conv.inner = (void*)(orig & (~1));
- orig_conv.is_owned = false;
- LDKNetworkGraph ret_var = NetworkGraph_clone(&orig_conv);
- CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t ret_ref = (uint64_t)ret_var.inner;
- if (ret_var.is_owned) {
- ret_ref |= 1;
- }
+void __attribute__((visibility("default"))) TS_ReadOnlyNetworkGraph_free(uint32_t this_obj) {
+ LDKReadOnlyNetworkGraph this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ ReadOnlyNetworkGraph_free(this_obj_conv);
+}
+
+void __attribute__((visibility("default"))) TS_NetworkUpdate_free(uint32_t this_ptr) {
+ if ((this_ptr & 1) != 0) return;
+ LDKNetworkUpdate this_ptr_conv = *(LDKNetworkUpdate*)(((uint64_t)this_ptr) & ~1);
+ FREE((void*)this_ptr);
+ NetworkUpdate_free(this_ptr_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_clone(uint32_t orig) {
+ LDKNetworkUpdate* orig_conv = (LDKNetworkUpdate*)orig;
+ LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
+ *ret_copy = NetworkUpdate_clone(orig_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
return ret_ref;
}
-void __attribute__((visibility("default"))) TS_LockedNetworkGraph_free(uint32_t this_obj) {
- LDKLockedNetworkGraph this_obj_conv;
- this_obj_conv.inner = (void*)(this_obj & (~1));
- this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
- LockedNetworkGraph_free(this_obj_conv);
+uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_update_message(uint32_t msg) {
+ LDKChannelUpdate msg_conv;
+ msg_conv.inner = (void*)(msg & (~1));
+ msg_conv.is_owned = (msg & 1) || (msg == 0);
+ msg_conv = ChannelUpdate_clone(&msg_conv);
+ LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
+ *ret_copy = NetworkUpdate_channel_update_message(msg_conv);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_channel_closed(int64_t short_channel_id, jboolean is_permanent) {
+ LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
+ *ret_copy = NetworkUpdate_channel_closed(short_channel_id, is_permanent);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_NetworkUpdate_node_failure(int8_tArray node_id, jboolean is_permanent) {
+ LDKPublicKey node_id_ref;
+ CHECK(*((uint32_t*)node_id) == 33);
+ memcpy(node_id_ref.compressed_form, (uint8_t*)(node_id + 4), 33);
+ LDKNetworkUpdate *ret_copy = MALLOC(sizeof(LDKNetworkUpdate), "LDKNetworkUpdate");
+ *ret_copy = NetworkUpdate_node_failure(node_id_ref, is_permanent);
+ uint64_t ret_ref = (uint64_t)ret_copy;
+ return ret_ref;
+}
+
+int8_tArray __attribute__((visibility("default"))) TS_NetworkUpdate_write(uint32_t obj) {
+ LDKNetworkUpdate* obj_conv = (LDKNetworkUpdate*)obj;
+ LDKCVec_u8Z ret_var = NetworkUpdate_write(obj_conv);
+ int8_tArray ret_arr = init_arr(ret_var.datalen, sizeof(uint8_t), "Native int8_tArray Bytes");
+ memcpy((uint8_t*)(ret_arr + 4), ret_var.data, ret_var.datalen);
+ CVec_u8Z_free(ret_var);
+ return ret_arr;
+}
+
+uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_EventHandler(uint32_t this_arg) {
+ LDKNetGraphMsgHandler this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKEventHandler* ret_ret =MALLOC(sizeof(LDKEventHandler), "LDKEventHandler");
+ *ret_ret = NetGraphMsgHandler_as_EventHandler(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_free(uint32_t this_obj) {
NetGraphMsgHandler_free(this_obj_conv);
}
-uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(int8_tArray genesis_hash, uint32_t chain_access, uint32_t logger) {
- LDKThirtyTwoBytes genesis_hash_ref;
- CHECK(*((uint32_t*)genesis_hash) == 32);
- memcpy(genesis_hash_ref.data, (uint8_t*)(genesis_hash + 4), 32);
- LDKAccess *chain_access_conv_ptr = NULL;
- if (chain_access != 0) {
- LDKAccess chain_access_conv;
- chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
- chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
- *chain_access_conv_ptr = chain_access_conv;
- }
- LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
- LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(genesis_hash_ref, chain_access_conv_ptr, logger_conv);
+uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_get_network_graph(uint32_t this_ptr) {
+ LDKNetGraphMsgHandler this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKNetworkGraph ret_var = NetGraphMsgHandler_get_network_graph(&this_ptr_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_ref;
}
-uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_from_net_graph(uint32_t chain_access, uint32_t logger, uint32_t network_graph) {
- LDKAccess *chain_access_conv_ptr = NULL;
- if (chain_access != 0) {
- LDKAccess chain_access_conv;
- chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
- chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
- *chain_access_conv_ptr = chain_access_conv;
- }
- LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
+void __attribute__((visibility("default"))) TS_NetGraphMsgHandler_set_network_graph(uint32_t this_ptr, uint32_t val) {
+ LDKNetGraphMsgHandler this_ptr_conv;
+ this_ptr_conv.inner = (void*)(this_ptr & (~1));
+ this_ptr_conv.is_owned = false;
+ LDKNetworkGraph val_conv;
+ val_conv.inner = (void*)(val & (~1));
+ val_conv.is_owned = (val & 1) || (val == 0);
+ // Warning: we need a move here but no clone is available for LDKNetworkGraph
+ NetGraphMsgHandler_set_network_graph(&this_ptr_conv, val_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_new(uint32_t network_graph, uint32_t chain_access, uint32_t logger) {
LDKNetworkGraph network_graph_conv;
network_graph_conv.inner = (void*)(network_graph & (~1));
network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
- network_graph_conv = NetworkGraph_clone(&network_graph_conv);
- LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_from_net_graph(chain_access_conv_ptr, logger_conv, network_graph_conv);
+ // Warning: we need a move here but no clone is available for LDKNetworkGraph
+ LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
+ // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
+ if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
+ // Manually implement clone for Java trait instances
+ }
+ LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
+ LDKNetGraphMsgHandler ret_var = NetGraphMsgHandler_new(network_graph_conv, chain_access_conv, logger_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
LDKNetGraphMsgHandler this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKAccess *chain_access_conv_ptr = NULL;
- if (chain_access != 0) {
- LDKAccess chain_access_conv;
- chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
- chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
- *chain_access_conv_ptr = chain_access_conv;
- }
- NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv_ptr);
-}
-
-uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_read_locked_graph(uint32_t this_arg) {
- LDKNetGraphMsgHandler this_arg_conv;
- this_arg_conv.inner = (void*)(this_arg & (~1));
- this_arg_conv.is_owned = false;
- LDKLockedNetworkGraph ret_var = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
- CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t ret_ref = (uint64_t)ret_var.inner;
- if (ret_var.is_owned) {
- ret_ref |= 1;
- }
- return ret_ref;
-}
-
-uint32_t __attribute__((visibility("default"))) TS_LockedNetworkGraph_graph(uint32_t this_arg) {
- LDKLockedNetworkGraph this_arg_conv;
- this_arg_conv.inner = (void*)(this_arg & (~1));
- this_arg_conv.is_owned = false;
- LDKNetworkGraph ret_var = LockedNetworkGraph_graph(&this_arg_conv);
- CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t ret_ref = (uint64_t)ret_var.inner;
- if (ret_var.is_owned) {
- ret_ref |= 1;
+ LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
+ // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
+ if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
+ // Manually implement clone for Java trait instances
}
- return ret_ref;
+ NetGraphMsgHandler_add_chain_access(&this_arg_conv, chain_access_conv);
}
uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_RoutingMessageHandler(uint32_t this_arg) {
LDKNetGraphMsgHandler this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
- *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
- return (uint64_t)ret;
+ LDKRoutingMessageHandler* ret_ret =MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
+ *ret_ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
uint32_t __attribute__((visibility("default"))) TS_NetGraphMsgHandler_as_MessageSendEventsProvider(uint32_t this_arg) {
LDKNetGraphMsgHandler this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
- *ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
- return (uint64_t)ret;
+ LDKMessageSendEventsProvider* ret_ret =MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
+ *ret_ret = NetGraphMsgHandler_as_MessageSendEventsProvider(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
void __attribute__((visibility("default"))) TS_DirectionalChannelInfo_free(uint32_t this_obj) {
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
DirectionalChannelInfo_set_htlc_maximum_msat(&this_ptr_conv, val_conv);
}
uint32_t __attribute__((visibility("default"))) TS_DirectionalChannelInfo_new(int32_t last_update_arg, jboolean enabled_arg, int16_t cltv_expiry_delta_arg, int64_t htlc_minimum_msat_arg, uint32_t htlc_maximum_msat_arg, uint32_t fees_arg, uint32_t last_update_message_arg) {
LDKCOption_u64Z htlc_maximum_msat_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1);
+ htlc_maximum_msat_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)htlc_maximum_msat_arg) & ~1));
LDKRoutingFees fees_arg_conv;
fees_arg_conv.inner = (void*)(fees_arg & (~1));
fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
this_ptr_conv.inner = (void*)(this_ptr & (~1));
this_ptr_conv.is_owned = false;
LDKCOption_u64Z val_conv = *(LDKCOption_u64Z*)(((uint64_t)val) & ~1);
+ val_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)val) & ~1));
ChannelInfo_set_capacity_sats(&this_ptr_conv, val_conv);
}
two_to_one_arg_conv.is_owned = (two_to_one_arg & 1) || (two_to_one_arg == 0);
two_to_one_arg_conv = DirectionalChannelInfo_clone(&two_to_one_arg_conv);
LDKCOption_u64Z capacity_sats_arg_conv = *(LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1);
+ capacity_sats_arg_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)capacity_sats_arg) & ~1));
LDKChannelAnnouncement announcement_message_arg_conv;
announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
return ret_ref;
}
+int64_t __attribute__((visibility("default"))) TS_RoutingFees_hash(uint32_t o) {
+ LDKRoutingFees o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = RoutingFees_hash(&o_conv);
+ return ret_val;
+}
+
int8_tArray __attribute__((visibility("default"))) TS_RoutingFees_write(uint32_t obj) {
LDKRoutingFees obj_conv;
obj_conv.inner = (void*)(obj & (~1));
return ret_ref;
}
+uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_read_only(uint32_t this_arg) {
+ LDKNetworkGraph this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKReadOnlyNetworkGraph ret_var = NetworkGraph_read_only(&this_arg_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_node_from_announcement(uint32_t this_arg, uint32_t msg) {
LDKNetworkGraph this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
LDKChannelAnnouncement msg_conv;
msg_conv.inner = (void*)(msg & (~1));
msg_conv.is_owned = false;
- LDKAccess *chain_access_conv_ptr = NULL;
- if (chain_access != 0) {
- LDKAccess chain_access_conv;
- chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
- chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
- *chain_access_conv_ptr = chain_access_conv;
+ LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
+ // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
+ if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
+ // Manually implement clone for Java trait instances
}
LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
- *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
+ *ret_conv = NetworkGraph_update_channel_from_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
return (uint64_t)ret_conv;
}
LDKUnsignedChannelAnnouncement msg_conv;
msg_conv.inner = (void*)(msg & (~1));
msg_conv.is_owned = false;
- LDKAccess *chain_access_conv_ptr = NULL;
- if (chain_access != 0) {
- LDKAccess chain_access_conv;
- chain_access_conv = *(LDKAccess*)(((uint64_t)chain_access) & ~1);
- chain_access_conv_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
- *chain_access_conv_ptr = chain_access_conv;
+ LDKCOption_AccessZ chain_access_conv = *(LDKCOption_AccessZ*)(((uint64_t)chain_access) & ~1);
+ // Warning: we may need a move here but no clone is available for LDKCOption_AccessZ
+ if (chain_access_conv.tag == LDKCOption_AccessZ_Some) {
+ // Manually implement clone for Java trait instances
}
LDKCResult_NoneLightningErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_NoneLightningErrorZ), "LDKCResult_NoneLightningErrorZ");
- *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv_ptr);
+ *ret_conv = NetworkGraph_update_channel_from_unsigned_announcement(&this_arg_conv, &msg_conv, chain_access_conv);
return (uint64_t)ret_conv;
}
NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);
}
+void __attribute__((visibility("default"))) TS_NetworkGraph_fail_node(uint32_t this_arg, int8_tArray _node_id, jboolean is_permanent) {
+ LDKNetworkGraph this_arg_conv;
+ this_arg_conv.inner = (void*)(this_arg & (~1));
+ this_arg_conv.is_owned = false;
+ LDKPublicKey _node_id_ref;
+ CHECK(*((uint32_t*)_node_id) == 33);
+ memcpy(_node_id_ref.compressed_form, (uint8_t*)(_node_id + 4), 33);
+ NetworkGraph_fail_node(&this_arg_conv, _node_id_ref, is_permanent);
+}
+
uint32_t __attribute__((visibility("default"))) TS_NetworkGraph_update_channel(uint32_t this_arg, uint32_t msg) {
LDKNetworkGraph this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
LDKFilesystemPersister this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
this_arg_conv.is_owned = false;
- LDKPersist* ret = MALLOC(sizeof(LDKPersist), "LDKPersist");
- *ret = FilesystemPersister_as_Persist(&this_arg_conv);
- return (uint64_t)ret;
+ LDKPersist* ret_ret =MALLOC(sizeof(LDKPersist), "LDKPersist");
+ *ret_ret = FilesystemPersister_as_Persist(&this_arg_conv);
+ return (uint64_t)ret_ret;
}
void __attribute__((visibility("default"))) TS_BackgroundProcessor_free(uint32_t this_obj) {
ChannelManagerPersister_free(this_ptr_conv);
}
-uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_start(uint32_t persister, uint32_t event_handler, uint32_t chain_monitor, uint32_t channel_manager, uint32_t peer_manager, uint32_t logger) {
+uint32_t __attribute__((visibility("default"))) TS_BackgroundProcessor_start(uint32_t persister, uint32_t event_handler, uint32_t chain_monitor, uint32_t channel_manager, uint32_t net_graph_msg_handler, uint32_t peer_manager, uint32_t logger) {
LDKChannelManagerPersister persister_conv = *(LDKChannelManagerPersister*)(((uint64_t)persister) & ~1);
LDKEventHandler event_handler_conv = *(LDKEventHandler*)(((uint64_t)event_handler) & ~1);
LDKChainMonitor chain_monitor_conv;
LDKChannelManager channel_manager_conv;
channel_manager_conv.inner = (void*)(channel_manager & (~1));
channel_manager_conv.is_owned = false;
+ LDKNetGraphMsgHandler net_graph_msg_handler_conv;
+ net_graph_msg_handler_conv.inner = (void*)(net_graph_msg_handler & (~1));
+ net_graph_msg_handler_conv.is_owned = (net_graph_msg_handler & 1) || (net_graph_msg_handler == 0);
LDKPeerManager peer_manager_conv;
peer_manager_conv.inner = (void*)(peer_manager & (~1));
peer_manager_conv.is_owned = false;
LDKLogger logger_conv = *(LDKLogger*)(((uint64_t)logger) & ~1);
- LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, &peer_manager_conv, logger_conv);
+ LDKBackgroundProcessor ret_var = BackgroundProcessor_start(persister_conv, event_handler_conv, &chain_monitor_conv, &channel_manager_conv, net_graph_msg_handler_conv, &peer_manager_conv, logger_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_conv;
}
+int64_t __attribute__((visibility("default"))) TS_Currency_hash(uint32_t o) {
+ LDKCurrency* o_conv = (LDKCurrency*)(o & ~1);
+ int64_t ret_val = Currency_hash(o_conv);
+ return ret_val;
+}
+
jboolean __attribute__((visibility("default"))) TS_Currency_eq(uint32_t a, uint32_t b) {
LDKCurrency* a_conv = (LDKCurrency*)(a & ~1);
LDKCurrency* b_conv = (LDKCurrency*)(b & ~1);
Sha256_free(this_obj_conv);
}
+uint32_t __attribute__((visibility("default"))) TS_Sha256_clone(uint32_t orig) {
+ LDKSha256 orig_conv;
+ orig_conv.inner = (void*)(orig & (~1));
+ orig_conv.is_owned = false;
+ LDKSha256 ret_var = Sha256_clone(&orig_conv);
+ CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
+ CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
+ uint64_t ret_ref = (uint64_t)ret_var.inner;
+ if (ret_var.is_owned) {
+ ret_ref |= 1;
+ }
+ return ret_ref;
+}
+
+int64_t __attribute__((visibility("default"))) TS_Sha256_hash(uint32_t o) {
+ LDKSha256 o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = Sha256_hash(&o_conv);
+ return ret_val;
+}
+
jboolean __attribute__((visibility("default"))) TS_Sha256_eq(uint32_t a, uint32_t b) {
LDKSha256 a_conv;
a_conv.inner = (void*)(a & (~1));
return ret_val;
}
-uint32_t __attribute__((visibility("default"))) TS_Sha256_clone(uint32_t orig) {
- LDKSha256 orig_conv;
+void __attribute__((visibility("default"))) TS_Description_free(uint32_t this_obj) {
+ LDKDescription this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ Description_free(this_obj_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_Description_clone(uint32_t orig) {
+ LDKDescription orig_conv;
orig_conv.inner = (void*)(orig & (~1));
orig_conv.is_owned = false;
- LDKSha256 ret_var = Sha256_clone(&orig_conv);
+ LDKDescription ret_var = Description_clone(&orig_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_ref;
}
-void __attribute__((visibility("default"))) TS_Description_free(uint32_t this_obj) {
- LDKDescription this_obj_conv;
- this_obj_conv.inner = (void*)(this_obj & (~1));
- this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
- Description_free(this_obj_conv);
+int64_t __attribute__((visibility("default"))) TS_Description_hash(uint32_t o) {
+ LDKDescription o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = Description_hash(&o_conv);
+ return ret_val;
}
jboolean __attribute__((visibility("default"))) TS_Description_eq(uint32_t a, uint32_t b) {
return ret_val;
}
-uint32_t __attribute__((visibility("default"))) TS_Description_clone(uint32_t orig) {
- LDKDescription orig_conv;
+void __attribute__((visibility("default"))) TS_PayeePubKey_free(uint32_t this_obj) {
+ LDKPayeePubKey this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ PayeePubKey_free(this_obj_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_PayeePubKey_clone(uint32_t orig) {
+ LDKPayeePubKey orig_conv;
orig_conv.inner = (void*)(orig & (~1));
orig_conv.is_owned = false;
- LDKDescription ret_var = Description_clone(&orig_conv);
+ LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_ref;
}
-void __attribute__((visibility("default"))) TS_PayeePubKey_free(uint32_t this_obj) {
- LDKPayeePubKey this_obj_conv;
- this_obj_conv.inner = (void*)(this_obj & (~1));
- this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
- PayeePubKey_free(this_obj_conv);
+int64_t __attribute__((visibility("default"))) TS_PayeePubKey_hash(uint32_t o) {
+ LDKPayeePubKey o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = PayeePubKey_hash(&o_conv);
+ return ret_val;
}
jboolean __attribute__((visibility("default"))) TS_PayeePubKey_eq(uint32_t a, uint32_t b) {
return ret_val;
}
-uint32_t __attribute__((visibility("default"))) TS_PayeePubKey_clone(uint32_t orig) {
- LDKPayeePubKey orig_conv;
+void __attribute__((visibility("default"))) TS_ExpiryTime_free(uint32_t this_obj) {
+ LDKExpiryTime this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ ExpiryTime_free(this_obj_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_clone(uint32_t orig) {
+ LDKExpiryTime orig_conv;
orig_conv.inner = (void*)(orig & (~1));
orig_conv.is_owned = false;
- LDKPayeePubKey ret_var = PayeePubKey_clone(&orig_conv);
+ LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_ref;
}
-void __attribute__((visibility("default"))) TS_ExpiryTime_free(uint32_t this_obj) {
- LDKExpiryTime this_obj_conv;
- this_obj_conv.inner = (void*)(this_obj & (~1));
- this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
- ExpiryTime_free(this_obj_conv);
+int64_t __attribute__((visibility("default"))) TS_ExpiryTime_hash(uint32_t o) {
+ LDKExpiryTime o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = ExpiryTime_hash(&o_conv);
+ return ret_val;
}
jboolean __attribute__((visibility("default"))) TS_ExpiryTime_eq(uint32_t a, uint32_t b) {
return ret_val;
}
-uint32_t __attribute__((visibility("default"))) TS_ExpiryTime_clone(uint32_t orig) {
- LDKExpiryTime orig_conv;
+void __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_free(uint32_t this_obj) {
+ LDKMinFinalCltvExpiry this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ MinFinalCltvExpiry_free(this_obj_conv);
+}
+
+uint32_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_clone(uint32_t orig) {
+ LDKMinFinalCltvExpiry orig_conv;
orig_conv.inner = (void*)(orig & (~1));
orig_conv.is_owned = false;
- LDKExpiryTime ret_var = ExpiryTime_clone(&orig_conv);
+ LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
uint64_t ret_ref = (uint64_t)ret_var.inner;
return ret_ref;
}
-void __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_free(uint32_t this_obj) {
- LDKMinFinalCltvExpiry this_obj_conv;
- this_obj_conv.inner = (void*)(this_obj & (~1));
- this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
- MinFinalCltvExpiry_free(this_obj_conv);
+int64_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_hash(uint32_t o) {
+ LDKMinFinalCltvExpiry o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = MinFinalCltvExpiry_hash(&o_conv);
+ return ret_val;
}
jboolean __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_eq(uint32_t a, uint32_t b) {
return ret_val;
}
-uint32_t __attribute__((visibility("default"))) TS_MinFinalCltvExpiry_clone(uint32_t orig) {
- LDKMinFinalCltvExpiry orig_conv;
- orig_conv.inner = (void*)(orig & (~1));
- orig_conv.is_owned = false;
- LDKMinFinalCltvExpiry ret_var = MinFinalCltvExpiry_clone(&orig_conv);
- CHECK((((uint64_t)ret_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
- CHECK((((uint64_t)&ret_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
- uint64_t ret_ref = (uint64_t)ret_var.inner;
- if (ret_var.is_owned) {
- ret_ref |= 1;
- }
- return ret_ref;
-}
-
void __attribute__((visibility("default"))) TS_Fallback_free(uint32_t this_ptr) {
if ((this_ptr & 1) != 0) return;
LDKFallback this_ptr_conv = *(LDKFallback*)(((uint64_t)this_ptr) & ~1);
return ret_ref;
}
+int64_t __attribute__((visibility("default"))) TS_Fallback_hash(uint32_t o) {
+ LDKFallback* o_conv = (LDKFallback*)o;
+ int64_t ret_val = Fallback_hash(o_conv);
+ return ret_val;
+}
+
jboolean __attribute__((visibility("default"))) TS_Fallback_eq(uint32_t a, uint32_t b) {
LDKFallback* a_conv = (LDKFallback*)a;
LDKFallback* b_conv = (LDKFallback*)b;
InvoiceSignature_free(this_obj_conv);
}
-jboolean __attribute__((visibility("default"))) TS_InvoiceSignature_eq(uint32_t a, uint32_t b) {
- LDKInvoiceSignature a_conv;
- a_conv.inner = (void*)(a & (~1));
- a_conv.is_owned = false;
- LDKInvoiceSignature b_conv;
- b_conv.inner = (void*)(b & (~1));
- b_conv.is_owned = false;
- jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
- return ret_val;
-}
-
uint32_t __attribute__((visibility("default"))) TS_InvoiceSignature_clone(uint32_t orig) {
LDKInvoiceSignature orig_conv;
orig_conv.inner = (void*)(orig & (~1));
return ret_ref;
}
-void __attribute__((visibility("default"))) TS_PrivateRoute_free(uint32_t this_obj) {
- LDKPrivateRoute this_obj_conv;
- this_obj_conv.inner = (void*)(this_obj & (~1));
- this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
- PrivateRoute_free(this_obj_conv);
-}
-
-jboolean __attribute__((visibility("default"))) TS_PrivateRoute_eq(uint32_t a, uint32_t b) {
- LDKPrivateRoute a_conv;
+jboolean __attribute__((visibility("default"))) TS_InvoiceSignature_eq(uint32_t a, uint32_t b) {
+ LDKInvoiceSignature a_conv;
a_conv.inner = (void*)(a & (~1));
a_conv.is_owned = false;
- LDKPrivateRoute b_conv;
+ LDKInvoiceSignature b_conv;
b_conv.inner = (void*)(b & (~1));
b_conv.is_owned = false;
- jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
+ jboolean ret_val = InvoiceSignature_eq(&a_conv, &b_conv);
return ret_val;
}
+void __attribute__((visibility("default"))) TS_PrivateRoute_free(uint32_t this_obj) {
+ LDKPrivateRoute this_obj_conv;
+ this_obj_conv.inner = (void*)(this_obj & (~1));
+ this_obj_conv.is_owned = (this_obj & 1) || (this_obj == 0);
+ PrivateRoute_free(this_obj_conv);
+}
+
uint32_t __attribute__((visibility("default"))) TS_PrivateRoute_clone(uint32_t orig) {
LDKPrivateRoute orig_conv;
orig_conv.inner = (void*)(orig & (~1));
return ret_ref;
}
+int64_t __attribute__((visibility("default"))) TS_PrivateRoute_hash(uint32_t o) {
+ LDKPrivateRoute o_conv;
+ o_conv.inner = (void*)(o & (~1));
+ o_conv.is_owned = false;
+ int64_t ret_val = PrivateRoute_hash(&o_conv);
+ return ret_val;
+}
+
+jboolean __attribute__((visibility("default"))) TS_PrivateRoute_eq(uint32_t a, uint32_t b) {
+ LDKPrivateRoute a_conv;
+ a_conv.inner = (void*)(a & (~1));
+ a_conv.is_owned = false;
+ LDKPrivateRoute b_conv;
+ b_conv.inner = (void*)(b & (~1));
+ b_conv.is_owned = false;
+ jboolean ret_val = PrivateRoute_eq(&a_conv, &b_conv);
+ return ret_val;
+}
+
uint32_t __attribute__((visibility("default"))) TS_SignedRawInvoice_into_parts(uint32_t this_arg) {
LDKSignedRawInvoice this_arg_conv;
this_arg_conv.inner = (void*)(this_arg & (~1));
return ret_conv;
}
+uint32_t __attribute__((visibility("default"))) TS_SemanticError_no_payment_secret() {
+ uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_no_payment_secret());
+ return ret_conv;
+}
+
uint32_t __attribute__((visibility("default"))) TS_SemanticError_multiple_payment_secrets() {
uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_multiple_payment_secrets());
return ret_conv;
return ret_conv;
}
+uint32_t __attribute__((visibility("default"))) TS_SemanticError_imprecise_amount() {
+ uint32_t ret_conv = LDKSemanticError_to_js(SemanticError_imprecise_amount());
+ return ret_conv;
+}
+
jboolean __attribute__((visibility("default"))) TS_SemanticError_eq(uint32_t a, uint32_t b) {
LDKSemanticError* a_conv = (LDKSemanticError*)(a & ~1);
LDKSemanticError* b_conv = (LDKSemanticError*)(b & ~1);
LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)(((uint64_t)keys_manager) & ~1);
LDKCurrency network_conv = LDKCurrency_from_js(network);
LDKCOption_u64Z amt_msat_conv = *(LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1);
+ amt_msat_conv = COption_u64Z_clone((LDKCOption_u64Z*)(((uint64_t)amt_msat) & ~1));
LDKStr description_conv = str_ref_to_owned_c(description);
LDKCResult_InvoiceSignOrCreationErrorZ* ret_conv = MALLOC(sizeof(LDKCResult_InvoiceSignOrCreationErrorZ), "LDKCResult_InvoiceSignOrCreationErrorZ");
*ret_conv = create_invoice_from_channelmanager(&channelmanager_conv, keys_manager_conv, network_conv, amt_msat_conv, description_conv);
public static native boolean LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_result_ok(long arg);
public static native number LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_ok(long arg);
public static native number LDKCResult_BuiltCommitmentTransactionDecodeErrorZ_get_err(long arg);
+ public static native boolean LDKCResult_TrustedClosingTransactionNoneZ_result_ok(long arg);
+ public static native number LDKCResult_TrustedClosingTransactionNoneZ_get_ok(long arg);
+ public static native void LDKCResult_TrustedClosingTransactionNoneZ_get_err(long arg);
public static native boolean LDKCResult_CommitmentTransactionDecodeErrorZ_result_ok(long arg);
public static native number LDKCResult_CommitmentTransactionDecodeErrorZ_get_ok(long arg);
public static native number LDKCResult_CommitmentTransactionDecodeErrorZ_get_err(long arg);
public number htlc_event;
HTLCEvent(number htlc_event) { this.htlc_event = htlc_event; }
}
- export class CommitmentTxBroadcasted extends LDKMonitorEvent {
- public number commitment_tx_broadcasted;
- CommitmentTxBroadcasted(number commitment_tx_broadcasted) { this.commitment_tx_broadcasted = commitment_tx_broadcasted; }
+ export class CommitmentTxConfirmed extends LDKMonitorEvent {
+ public number commitment_tx_confirmed;
+ CommitmentTxConfirmed(number commitment_tx_confirmed) { this.commitment_tx_confirmed = commitment_tx_confirmed; }
}
static native void init();
}
}
static { LDKCOption_C2Tuple_usizeTransactionZZ.init(); }
public static native LDKCOption_C2Tuple_usizeTransactionZZ LDKCOption_C2Tuple_usizeTransactionZZ_ref_from_ptr(long ptr);
+ public static class LDKNetworkUpdate {
+ private LDKNetworkUpdate() {}
+ export class ChannelUpdateMessage extends LDKNetworkUpdate {
+ public number msg;
+ ChannelUpdateMessage(number msg) { this.msg = msg; }
+ }
+ export class ChannelClosed extends LDKNetworkUpdate {
+ public number short_channel_id;
+ public boolean is_permanent;
+ ChannelClosed(number short_channel_id, boolean is_permanent) { this.short_channel_id = short_channel_id; this.is_permanent = is_permanent; }
+ }
+ export class NodeFailure extends LDKNetworkUpdate {
+ public Uint8Array node_id;
+ public boolean is_permanent;
+ NodeFailure(Uint8Array node_id, boolean is_permanent) { this.node_id = node_id; this.is_permanent = is_permanent; }
+ }
+ static native void init();
+ }
+ static { LDKNetworkUpdate.init(); }
+ public static native LDKNetworkUpdate LDKNetworkUpdate_ref_from_ptr(long ptr);
+ public static class LDKCOption_NetworkUpdateZ {
+ private LDKCOption_NetworkUpdateZ() {}
+ export class Some extends LDKCOption_NetworkUpdateZ {
+ public number some;
+ Some(number some) { this.some = some; }
+ }
+ export class None extends LDKCOption_NetworkUpdateZ {
+ None() { }
+ }
+ static native void init();
+ }
+ static { LDKCOption_NetworkUpdateZ.init(); }
+ public static native LDKCOption_NetworkUpdateZ LDKCOption_NetworkUpdateZ_ref_from_ptr(long ptr);
public static class LDKSpendableOutputDescriptor {
private LDKSpendableOutputDescriptor() {}
export class StaticOutput extends LDKSpendableOutputDescriptor {
}
static { LDKErrorAction.init(); }
public static native LDKErrorAction LDKErrorAction_ref_from_ptr(long ptr);
- public static class LDKHTLCFailChannelUpdate {
- private LDKHTLCFailChannelUpdate() {}
- export class ChannelUpdateMessage extends LDKHTLCFailChannelUpdate {
- public number msg;
- ChannelUpdateMessage(number msg) { this.msg = msg; }
- }
- export class ChannelClosed extends LDKHTLCFailChannelUpdate {
- public number short_channel_id;
- public boolean is_permanent;
- ChannelClosed(number short_channel_id, boolean is_permanent) { this.short_channel_id = short_channel_id; this.is_permanent = is_permanent; }
- }
- export class NodeFailure extends LDKHTLCFailChannelUpdate {
- public Uint8Array node_id;
- public boolean is_permanent;
- NodeFailure(Uint8Array node_id, boolean is_permanent) { this.node_id = node_id; this.is_permanent = is_permanent; }
- }
- static native void init();
- }
- static { LDKHTLCFailChannelUpdate.init(); }
- public static native LDKHTLCFailChannelUpdate LDKHTLCFailChannelUpdate_ref_from_ptr(long ptr);
public static class LDKMessageSendEvent {
private LDKMessageSendEvent() {}
export class SendAcceptChannel extends LDKMessageSendEvent {
public number action;
HandleError(Uint8Array node_id, number action) { this.node_id = node_id; this.action = action; }
}
- export class PaymentFailureNetworkUpdate extends LDKMessageSendEvent {
- public number update;
- PaymentFailureNetworkUpdate(number update) { this.update = update; }
- }
export class SendChannelRangeQuery extends LDKMessageSendEvent {
public Uint8Array node_id;
public number msg;
public static native boolean LDKCResult_SpendableOutputDescriptorDecodeErrorZ_result_ok(long arg);
public static native number LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_ok(long arg);
public static native number LDKCResult_SpendableOutputDescriptorDecodeErrorZ_get_err(long arg);
+ public static native boolean LDKCResult_NoneNoneZ_result_ok(long arg);
+ public static native void LDKCResult_NoneNoneZ_get_ok(long arg);
+ public static native void LDKCResult_NoneNoneZ_get_err(long arg);
public static native long LDKC2Tuple_SignatureCVec_SignatureZZ_new(Uint8Array a, Uint8Array[] b);
public static native Uint8Array LDKC2Tuple_SignatureCVec_SignatureZZ_get_a(long ptr);
public static native Uint8Array[] LDKC2Tuple_SignatureCVec_SignatureZZ_get_b(long ptr);
export interface LDKBaseSign {
get_per_commitment_point (idx: number): Uint8Array;
release_commitment_secret (idx: number): Uint8Array;
+ validate_holder_commitment (holder_tx: number): number;
channel_keys_id (): Uint8Array;
sign_counterparty_commitment (commitment_tx: number): number;
+ validate_counterparty_revocation (idx: number, secret: Uint8Array): number;
sign_holder_commitment_and_htlcs (commitment_tx: number): number;
sign_justice_revoked_output (justice_tx: Uint8Array, input: number, amount: number, per_commitment_key: Uint8Array): number;
sign_justice_revoked_htlc (justice_tx: Uint8Array, input: number, amount: number, per_commitment_key: Uint8Array, htlc: number): number;
sign_counterparty_htlc_transaction (htlc_tx: Uint8Array, input: number, amount: number, per_commitment_point: Uint8Array, htlc: number): number;
- sign_closing_transaction (closing_tx: Uint8Array): number;
+ sign_closing_transaction (closing_tx: number): number;
sign_channel_announcement (msg: number): number;
ready_channel (channel_parameters: number): void;
}
const nativeResponseValue = wasm.BaseSign_release_commitment_secret(this_arg, idx);
return decodeArray(nativeResponseValue);
}
+ // LDKCResult_NoneNoneZ BaseSign_validate_holder_commitment LDKBaseSign *NONNULL_PTR this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx
+ export function BaseSign_validate_holder_commitment(this_arg: number, holder_tx: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.BaseSign_validate_holder_commitment(this_arg, holder_tx);
+ return nativeResponseValue;
+ }
// LDKThirtyTwoBytes BaseSign_channel_keys_id LDKBaseSign *NONNULL_PTR this_arg
export function BaseSign_channel_keys_id(this_arg: number): Uint8Array {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.BaseSign_sign_counterparty_commitment(this_arg, commitment_tx);
return nativeResponseValue;
}
+ // LDKCResult_NoneNoneZ BaseSign_validate_counterparty_revocation LDKBaseSign *NONNULL_PTR this_arg, uint64_t idx, const uint8_t (*secret)[32]
+ export function BaseSign_validate_counterparty_revocation(this_arg: number, idx: number, secret: Uint8Array): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.BaseSign_validate_counterparty_revocation(this_arg, idx, encodeArray(secret));
+ return nativeResponseValue;
+ }
// LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ BaseSign_sign_holder_commitment_and_htlcs LDKBaseSign *NONNULL_PTR this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx
export function BaseSign_sign_holder_commitment_and_htlcs(this_arg: number, commitment_tx: number): number {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.BaseSign_sign_counterparty_htlc_transaction(this_arg, encodeArray(htlc_tx), input, amount, encodeArray(per_commitment_point), htlc);
return nativeResponseValue;
}
- // LDKCResult_SignatureNoneZ BaseSign_sign_closing_transaction LDKBaseSign *NONNULL_PTR this_arg, struct LDKTransaction closing_tx
- export function BaseSign_sign_closing_transaction(this_arg: number, closing_tx: Uint8Array): number {
+ // LDKCResult_SignatureNoneZ BaseSign_sign_closing_transaction LDKBaseSign *NONNULL_PTR this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx
+ export function BaseSign_sign_closing_transaction(this_arg: number, closing_tx: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.BaseSign_sign_closing_transaction(this_arg, encodeArray(closing_tx));
+ const nativeResponseValue = wasm.BaseSign_sign_closing_transaction(this_arg, closing_tx);
return nativeResponseValue;
}
// LDKCResult_SignatureNoneZ BaseSign_sign_channel_announcement LDKBaseSign *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg
public static native boolean LDKCResult_OutPointDecodeErrorZ_result_ok(long arg);
public static native number LDKCResult_OutPointDecodeErrorZ_get_ok(long arg);
public static native number LDKCResult_OutPointDecodeErrorZ_get_err(long arg);
+
+
+
+// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: START
+
+ export interface LDKType {
+ type_id (): number;
+ debug_str (): String;
+ write (): Uint8Array;
+ }
+
+ export function LDKType_new(impl: LDKType): number {
+ throw new Error('unimplemented'); // TODO: bind to WASM
+ }
+
+// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
+
+
+ // uint16_t Type_type_id LDKType *NONNULL_PTR this_arg
+ export function Type_type_id(this_arg: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.Type_type_id(this_arg);
+ return nativeResponseValue;
+ }
+ // LDKStr Type_debug_str LDKType *NONNULL_PTR this_arg
+ export function Type_debug_str(this_arg: number): String {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.Type_debug_str(this_arg);
+ return nativeResponseValue;
+ }
+ // LDKCVec_u8Z Type_write LDKType *NONNULL_PTR this_arg
+ export function Type_write(this_arg: number): Uint8Array {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.Type_write(this_arg);
+ return decodeArray(nativeResponseValue);
+ }
+ public static class LDKCOption_TypeZ {
+ private LDKCOption_TypeZ() {}
+ export class Some extends LDKCOption_TypeZ {
+ public number some;
+ Some(number some) { this.some = some; }
+ }
+ export class None extends LDKCOption_TypeZ {
+ None() { }
+ }
+ static native void init();
+ }
+ static { LDKCOption_TypeZ.init(); }
+ public static native LDKCOption_TypeZ LDKCOption_TypeZ_ref_from_ptr(long ptr);
+ public static native boolean LDKCResult_COption_TypeZDecodeErrorZ_result_ok(long arg);
+ public static native number LDKCResult_COption_TypeZDecodeErrorZ_get_ok(long arg);
+ public static native number LDKCResult_COption_TypeZDecodeErrorZ_get_err(long arg);
public static native boolean LDKCResult_SiPrefixNoneZ_result_ok(long arg);
public static native SiPrefix LDKCResult_SiPrefixNoneZ_get_ok(long arg);
public static native void LDKCResult_SiPrefixNoneZ_get_err(long arg);
}
static { LDKPaymentPurpose.init(); }
public static native LDKPaymentPurpose LDKPaymentPurpose_ref_from_ptr(long ptr);
+ public static class LDKClosureReason {
+ private LDKClosureReason() {}
+ export class CounterpartyForceClosed extends LDKClosureReason {
+ public String peer_msg;
+ CounterpartyForceClosed(String peer_msg) { this.peer_msg = peer_msg; }
+ }
+ export class HolderForceClosed extends LDKClosureReason {
+ HolderForceClosed() { }
+ }
+ export class CooperativeClosure extends LDKClosureReason {
+ CooperativeClosure() { }
+ }
+ export class CommitmentTxConfirmed extends LDKClosureReason {
+ CommitmentTxConfirmed() { }
+ }
+ export class ProcessingError extends LDKClosureReason {
+ public String err;
+ ProcessingError(String err) { this.err = err; }
+ }
+ export class DisconnectedPeer extends LDKClosureReason {
+ DisconnectedPeer() { }
+ }
+ export class OutdatedChannelManager extends LDKClosureReason {
+ OutdatedChannelManager() { }
+ }
+ static native void init();
+ }
+ static { LDKClosureReason.init(); }
+ public static native LDKClosureReason LDKClosureReason_ref_from_ptr(long ptr);
public static class LDKEvent {
private LDKEvent() {}
export class FundingGenerationReady extends LDKEvent {
public Uint8Array payment_preimage;
PaymentSent(Uint8Array payment_preimage) { this.payment_preimage = payment_preimage; }
}
- export class PaymentFailed extends LDKEvent {
+ export class PaymentPathFailed extends LDKEvent {
public Uint8Array payment_hash;
public boolean rejected_by_dest;
- PaymentFailed(Uint8Array payment_hash, boolean rejected_by_dest) { this.payment_hash = payment_hash; this.rejected_by_dest = rejected_by_dest; }
+ public number network_update;
+ public boolean all_paths_failed;
+ public number[] path;
+ PaymentPathFailed(Uint8Array payment_hash, boolean rejected_by_dest, number network_update, boolean all_paths_failed, number[] path) { this.payment_hash = payment_hash; this.rejected_by_dest = rejected_by_dest; this.network_update = network_update; this.all_paths_failed = all_paths_failed; this.path = path; }
}
export class PendingHTLCsForwardable extends LDKEvent {
public number time_forwardable;
public boolean claim_from_onchain_tx;
PaymentForwarded(number fee_earned_msat, boolean claim_from_onchain_tx) { this.fee_earned_msat = fee_earned_msat; this.claim_from_onchain_tx = claim_from_onchain_tx; }
}
+ export class ChannelClosed extends LDKEvent {
+ public Uint8Array channel_id;
+ public number reason;
+ ChannelClosed(Uint8Array channel_id, number reason) { this.channel_id = channel_id; this.reason = reason; }
+ }
static native void init();
}
static { LDKEvent.init(); }
public static native Uint8Array LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_a(long ptr);
public static native number[] LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_get_b(long ptr);
public static native long LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_new(number[] elems);
+ public static class LDKBalance {
+ private LDKBalance() {}
+ export class ClaimableOnChannelClose extends LDKBalance {
+ public number claimable_amount_satoshis;
+ ClaimableOnChannelClose(number claimable_amount_satoshis) { this.claimable_amount_satoshis = claimable_amount_satoshis; }
+ }
+ export class ClaimableAwaitingConfirmations extends LDKBalance {
+ public number claimable_amount_satoshis;
+ public number confirmation_height;
+ ClaimableAwaitingConfirmations(number claimable_amount_satoshis, number confirmation_height) { this.claimable_amount_satoshis = claimable_amount_satoshis; this.confirmation_height = confirmation_height; }
+ }
+ export class ContentiousClaimable extends LDKBalance {
+ public number claimable_amount_satoshis;
+ public number timeout_height;
+ ContentiousClaimable(number claimable_amount_satoshis, number timeout_height) { this.claimable_amount_satoshis = claimable_amount_satoshis; this.timeout_height = timeout_height; }
+ }
+ export class MaybeClaimableHTLCAwaitingTimeout extends LDKBalance {
+ public number claimable_amount_satoshis;
+ public number claimable_height;
+ MaybeClaimableHTLCAwaitingTimeout(number claimable_amount_satoshis, number claimable_height) { this.claimable_amount_satoshis = claimable_amount_satoshis; this.claimable_height = claimable_height; }
+ }
+ static native void init();
+ }
+ static { LDKBalance.init(); }
+ public static native LDKBalance LDKBalance_ref_from_ptr(long ptr);
+ public static native long LDKCVec_BalanceZ_new(number[] elems);
public static native boolean LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_result_ok(long arg);
public static native number LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(long arg);
public static native number LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(long arg);
+ public static native boolean LDKCResult_NoneLightningErrorZ_result_ok(long arg);
+ public static native void LDKCResult_NoneLightningErrorZ_get_ok(long arg);
+ public static native number LDKCResult_NoneLightningErrorZ_get_err(long arg);
+ public static native long LDKC2Tuple_PublicKeyTypeZ_new(Uint8Array a, number b);
+ public static native Uint8Array LDKC2Tuple_PublicKeyTypeZ_get_a(long ptr);
+ public static native number LDKC2Tuple_PublicKeyTypeZ_get_b(long ptr);
+ public static native long LDKCVec_C2Tuple_PublicKeyTypeZZ_new(number[] elems);
public static native boolean LDKCResult_boolLightningErrorZ_result_ok(long arg);
public static native boolean LDKCResult_boolLightningErrorZ_get_ok(long arg);
public static native number LDKCResult_boolLightningErrorZ_get_err(long arg);
public static native number LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_get_c(long ptr);
public static native long LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_new(number[] elems);
public static native long LDKCVec_NodeAnnouncementZ_new(number[] elems);
- public static native boolean LDKCResult_NoneLightningErrorZ_result_ok(long arg);
- public static native void LDKCResult_NoneLightningErrorZ_get_ok(long arg);
- public static native number LDKCResult_NoneLightningErrorZ_get_err(long arg);
public static native boolean LDKCResult_CVec_u8ZPeerHandleErrorZ_result_ok(long arg);
public static native Uint8Array LDKCResult_CVec_u8ZPeerHandleErrorZ_get_ok(long arg);
public static native number LDKCResult_CVec_u8ZPeerHandleErrorZ_get_err(long arg);
public static native boolean LDKCResult_boolPeerHandleErrorZ_result_ok(long arg);
public static native boolean LDKCResult_boolPeerHandleErrorZ_get_ok(long arg);
public static native number LDKCResult_boolPeerHandleErrorZ_get_err(long arg);
+
+
+
+// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: START
+
+ export interface LDKAccess {
+ get_utxo (genesis_hash: Uint8Array, short_channel_id: number): number;
+ }
+
+ export function LDKAccess_new(impl: LDKAccess): number {
+ throw new Error('unimplemented'); // TODO: bind to WASM
+ }
+
+// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
+
+
+ // LDKCResult_TxOutAccessErrorZ Access_get_utxo LDKAccess *NONNULL_PTR this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id
+ export function Access_get_utxo(this_arg: number, genesis_hash: Uint8Array, short_channel_id: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.Access_get_utxo(this_arg, encodeArray(genesis_hash), short_channel_id);
+ return nativeResponseValue;
+ }
+ public static class LDKCOption_AccessZ {
+ private LDKCOption_AccessZ() {}
+ export class Some extends LDKCOption_AccessZ {
+ public number some;
+ Some(number some) { this.some = some; }
+ }
+ export class None extends LDKCOption_AccessZ {
+ None() { }
+ }
+ static native void init();
+ }
+ static { LDKCOption_AccessZ.init(); }
+ public static native LDKCOption_AccessZ LDKCOption_AccessZ_ref_from_ptr(long ptr);
public static native boolean LDKCResult_DirectionalChannelInfoDecodeErrorZ_result_ok(long arg);
public static native number LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_ok(long arg);
public static native number LDKCResult_DirectionalChannelInfoDecodeErrorZ_get_err(long arg);
+// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: START
+
+ export interface LDKFilter {
+ register_tx (txid: Uint8Array, script_pubkey: Uint8Array): void;
+ register_output (output: number): number;
+ }
+
+ export function LDKFilter_new(impl: LDKFilter): number {
+ throw new Error('unimplemented'); // TODO: bind to WASM
+ }
+
+// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
+
+
+ // void Filter_register_tx LDKFilter *NONNULL_PTR this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey
+ export function Filter_register_tx(this_arg: number, txid: Uint8Array, script_pubkey: Uint8Array): void {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.Filter_register_tx(this_arg, encodeArray(txid), encodeArray(script_pubkey));
+ // debug statements here
+ }
+ // LDKCOption_C2Tuple_usizeTransactionZZ Filter_register_output LDKFilter *NONNULL_PTR this_arg, struct LDKWatchedOutput output
+ export function Filter_register_output(this_arg: number, output: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.Filter_register_output(this_arg, output);
+ return nativeResponseValue;
+ }
+ public static class LDKCOption_FilterZ {
+ private LDKCOption_FilterZ() {}
+ export class Some extends LDKCOption_FilterZ {
+ public number some;
+ Some(number some) { this.some = some; }
+ }
+ export class None extends LDKCOption_FilterZ {
+ None() { }
+ }
+ static native void init();
+ }
+ static { LDKCOption_FilterZ.init(); }
+ public static native LDKCOption_FilterZ LDKCOption_FilterZ_ref_from_ptr(long ptr);
+
+
+
// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: START
export interface LDKMessageSendEventsProvider {
// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
- // void EventHandler_handle_event LDKEventHandler *NONNULL_PTR this_arg, struct LDKEvent event
+ // void EventHandler_handle_event LDKEventHandler *NONNULL_PTR this_arg, const struct LDKEvent *NONNULL_PTR event
export function EventHandler_handle_event(this_arg: number, event: number): void {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
-// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: START
-
- export interface LDKAccess {
- get_utxo (genesis_hash: Uint8Array, short_channel_id: number): number;
- }
-
- export function LDKAccess_new(impl: LDKAccess): number {
- throw new Error('unimplemented'); // TODO: bind to WASM
- }
-
-// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
-
-
- // LDKCResult_TxOutAccessErrorZ Access_get_utxo LDKAccess *NONNULL_PTR this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id
- export function Access_get_utxo(this_arg: number, genesis_hash: Uint8Array, short_channel_id: number): number {
- if(!isWasmInitialized) {
- throw new Error("initializeWasm() must be awaited first!");
- }
- const nativeResponseValue = wasm.Access_get_utxo(this_arg, encodeArray(genesis_hash), short_channel_id);
- return nativeResponseValue;
- }
-
-
-
// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: START
export interface LDKListen {
-// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: START
-
- export interface LDKFilter {
- register_tx (txid: Uint8Array, script_pubkey: Uint8Array): void;
- register_output (output: number): number;
- }
-
- export function LDKFilter_new(impl: LDKFilter): number {
- throw new Error('unimplemented'); // TODO: bind to WASM
- }
-
-// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
-
-
- // void Filter_register_tx LDKFilter *NONNULL_PTR this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey
- export function Filter_register_tx(this_arg: number, txid: Uint8Array, script_pubkey: Uint8Array): void {
- if(!isWasmInitialized) {
- throw new Error("initializeWasm() must be awaited first!");
- }
- const nativeResponseValue = wasm.Filter_register_tx(this_arg, encodeArray(txid), encodeArray(script_pubkey));
- // debug statements here
- }
- // LDKCOption_C2Tuple_usizeTransactionZZ Filter_register_output LDKFilter *NONNULL_PTR this_arg, struct LDKWatchedOutput output
- export function Filter_register_output(this_arg: number, output: number): number {
- if(!isWasmInitialized) {
- throw new Error("initializeWasm() must be awaited first!");
- }
- const nativeResponseValue = wasm.Filter_register_output(this_arg, output);
- return nativeResponseValue;
- }
-
-
-
// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: START
export interface LDKPersist {
handle_node_announcement (msg: number): number;
handle_channel_announcement (msg: number): number;
handle_channel_update (msg: number): number;
- handle_htlc_fail_channel_update (update: number): void;
get_next_channel_announcements (starting_point: number, batch_amount: number): number[];
get_next_node_announcements (starting_point: Uint8Array, batch_amount: number): number[];
sync_routing_table (their_node_id: Uint8Array, init: number): void;
const nativeResponseValue = wasm.RoutingMessageHandler_handle_channel_update(this_arg, msg);
return nativeResponseValue;
}
- // void RoutingMessageHandler_handle_htlc_fail_channel_update LDKRoutingMessageHandler *NONNULL_PTR this_arg, const struct LDKHTLCFailChannelUpdate *NONNULL_PTR update
- export function RoutingMessageHandler_handle_htlc_fail_channel_update(this_arg: number, update: number): void {
- if(!isWasmInitialized) {
- throw new Error("initializeWasm() must be awaited first!");
- }
- const nativeResponseValue = wasm.RoutingMessageHandler_handle_htlc_fail_channel_update(this_arg, update);
- // debug statements here
- }
// LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ RoutingMessageHandler_get_next_channel_announcements LDKRoutingMessageHandler *NONNULL_PTR this_arg, uint64_t starting_point, uint8_t batch_amount
export function RoutingMessageHandler_get_next_channel_announcements(this_arg: number, starting_point: number, batch_amount: number): number[] {
if(!isWasmInitialized) {
+// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: START
+
+ export interface LDKCustomMessageReader {
+ read (message_type: number, buffer: Uint8Array): number;
+ }
+
+ export function LDKCustomMessageReader_new(impl: LDKCustomMessageReader): number {
+ throw new Error('unimplemented'); // TODO: bind to WASM
+ }
+
+// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
+
+
+ // LDKCResult_COption_TypeZDecodeErrorZ CustomMessageReader_read LDKCustomMessageReader *NONNULL_PTR this_arg, uint16_t message_type, struct LDKu8slice buffer
+ export function CustomMessageReader_read(this_arg: number, message_type: number, buffer: Uint8Array): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CustomMessageReader_read(this_arg, message_type, encodeArray(buffer));
+ return nativeResponseValue;
+ }
+
+
+
+// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: START
+
+ export interface LDKCustomMessageHandler {
+ handle_custom_message (msg: number, sender_node_id: Uint8Array): number;
+ get_and_clear_pending_msg (): number[];
+ }
+
+ export function LDKCustomMessageHandler_new(impl: LDKCustomMessageHandler, CustomMessageReader: LDKCustomMessageReader): number {
+ throw new Error('unimplemented'); // TODO: bind to WASM
+ }
+
+// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: END
+
+
+ // LDKCResult_NoneLightningErrorZ CustomMessageHandler_handle_custom_message LDKCustomMessageHandler *NONNULL_PTR this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id
+ export function CustomMessageHandler_handle_custom_message(this_arg: number, msg: number, sender_node_id: Uint8Array): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CustomMessageHandler_handle_custom_message(this_arg, msg, encodeArray(sender_node_id));
+ return nativeResponseValue;
+ }
+ // LDKCVec_C2Tuple_PublicKeyTypeZZ CustomMessageHandler_get_and_clear_pending_msg LDKCustomMessageHandler *NONNULL_PTR this_arg
+ export function CustomMessageHandler_get_and_clear_pending_msg(this_arg: number): number[] {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CustomMessageHandler_get_and_clear_pending_msg(this_arg);
+ return nativeResponseValue;
+ }
+
+
+
// OUT_TYPESCRIPT_BINDINGS :: MAP_TRAIT :: START
export interface LDKSocketDescriptor {
const nativeResponseValue = wasm.CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig);
return nativeResponseValue;
}
+ // struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o);
+ export function CResult_TrustedClosingTransactionNoneZ_ok(o: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CResult_TrustedClosingTransactionNoneZ_ok(o);
+ return nativeResponseValue;
+ }
+ // struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void);
+ export function CResult_TrustedClosingTransactionNoneZ_err(): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CResult_TrustedClosingTransactionNoneZ_err();
+ return nativeResponseValue;
+ }
+ // void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res);
+ export function CResult_TrustedClosingTransactionNoneZ_free(_res: number): void {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CResult_TrustedClosingTransactionNoneZ_free(_res);
+ // debug statements here
+ }
// struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
export function CResult_CommitmentTransactionDecodeErrorZ_ok(o: number): number {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.COption_C2Tuple_usizeTransactionZZ_clone(orig);
return nativeResponseValue;
}
+ // struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o);
+ export function COption_NetworkUpdateZ_some(o: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.COption_NetworkUpdateZ_some(o);
+ return nativeResponseValue;
+ }
+ // struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void);
+ export function COption_NetworkUpdateZ_none(): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.COption_NetworkUpdateZ_none();
+ return nativeResponseValue;
+ }
+ // void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res);
+ export function COption_NetworkUpdateZ_free(_res: number): void {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.COption_NetworkUpdateZ_free(_res);
+ // debug statements here
+ }
+ // struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig);
+ export function COption_NetworkUpdateZ_clone(orig: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.COption_NetworkUpdateZ_clone(orig);
+ return nativeResponseValue;
+ }
// void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
export function CVec_SpendableOutputDescriptorZ_free(_res: number[]): void {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig);
return nativeResponseValue;
}
+ // struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void);
+ export function CResult_NoneNoneZ_ok(): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CResult_NoneNoneZ_ok();
+ return nativeResponseValue;
+ }
+ // struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void);
+ export function CResult_NoneNoneZ_err(): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CResult_NoneNoneZ_err();
+ return nativeResponseValue;
+ }
+ // void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res);
+ export function CResult_NoneNoneZ_free(_res: number): void {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CResult_NoneNoneZ_free(_res);
+ // debug statements here
+ }
+ // struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig);
+ export function CResult_NoneNoneZ_clone(orig: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CResult_NoneNoneZ_clone(orig);
+ return nativeResponseValue;
+ }
// struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
export function C2Tuple_SignatureCVec_SignatureZZ_clone(orig: number): number {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.CResult_OutPointDecodeErrorZ_clone(orig);
return nativeResponseValue;
}
+ // struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o);
+ export function COption_TypeZ_some(o: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.COption_TypeZ_some(o);
+ return nativeResponseValue;
+ }
+ // struct LDKCOption_TypeZ COption_TypeZ_none(void);
+ export function COption_TypeZ_none(): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.COption_TypeZ_none();
+ return nativeResponseValue;
+ }
+ // void COption_TypeZ_free(struct LDKCOption_TypeZ _res);
+ export function COption_TypeZ_free(_res: number): void {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.COption_TypeZ_free(_res);
+ // debug statements here
+ }
+ // struct LDKCOption_TypeZ COption_TypeZ_clone(const struct LDKCOption_TypeZ *NONNULL_PTR orig);
+ export function COption_TypeZ_clone(orig: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.COption_TypeZ_clone(orig);
+ return nativeResponseValue;
+ }
+ // struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o);
+ export function CResult_COption_TypeZDecodeErrorZ_ok(o: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CResult_COption_TypeZDecodeErrorZ_ok(o);
+ return nativeResponseValue;
+ }
+ // struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e);
+ export function CResult_COption_TypeZDecodeErrorZ_err(e: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CResult_COption_TypeZDecodeErrorZ_err(e);
+ return nativeResponseValue;
+ }
+ // void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res);
+ export function CResult_COption_TypeZDecodeErrorZ_free(_res: number): void {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CResult_COption_TypeZDecodeErrorZ_free(_res);
+ // debug statements here
+ }
+ // struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_clone(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR orig);
+ export function CResult_COption_TypeZDecodeErrorZ_clone(orig: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CResult_COption_TypeZDecodeErrorZ_clone(orig);
+ return nativeResponseValue;
+ }
// struct LDKCResult_SiPrefixNoneZ CResult_SiPrefixNoneZ_ok(enum LDKSiPrefix o);
export function CResult_SiPrefixNoneZ_ok(o: SiPrefix): number {
if(!isWasmInitialized) {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res);
- // debug statements here
+ const nativeResponseValue = wasm.C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res);
+ // debug statements here
+ }
+ // void CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res);
+ export function CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res: number[]): void {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res);
+ // debug statements here
+ }
+ // void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res);
+ export function CVec_BalanceZ_free(_res: number[]): void {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CVec_BalanceZ_free(_res);
+ // debug statements here
+ }
+ // struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
+ export function CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o);
+ return nativeResponseValue;
+ }
+ // struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
+ export function CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e);
+ return nativeResponseValue;
+ }
+ // void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
+ export function CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: number): void {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res);
+ // debug statements here
+ }
+ // struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
+ export function CResult_NoneLightningErrorZ_ok(): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CResult_NoneLightningErrorZ_ok();
+ return nativeResponseValue;
+ }
+ // struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
+ export function CResult_NoneLightningErrorZ_err(e: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CResult_NoneLightningErrorZ_err(e);
+ return nativeResponseValue;
+ }
+ // void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
+ export function CResult_NoneLightningErrorZ_free(_res: number): void {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CResult_NoneLightningErrorZ_free(_res);
+ // debug statements here
+ }
+ // struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
+ export function CResult_NoneLightningErrorZ_clone(orig: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CResult_NoneLightningErrorZ_clone(orig);
+ return nativeResponseValue;
}
- // void CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ _res);
- export function CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res: number[]): void {
+ // struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_clone(const struct LDKC2Tuple_PublicKeyTypeZ *NONNULL_PTR orig);
+ export function C2Tuple_PublicKeyTypeZ_clone(orig: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.CVec_C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZZ_free(_res);
- // debug statements here
+ const nativeResponseValue = wasm.C2Tuple_PublicKeyTypeZ_clone(orig);
+ return nativeResponseValue;
}
- // struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
- export function CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: number): number {
+ // struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b);
+ export function C2Tuple_PublicKeyTypeZ_new(a: Uint8Array, b: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o);
+ const nativeResponseValue = wasm.C2Tuple_PublicKeyTypeZ_new(encodeArray(a), b);
return nativeResponseValue;
}
- // struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
- export function CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: number): number {
+ // void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res);
+ export function C2Tuple_PublicKeyTypeZ_free(_res: number): void {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e);
- return nativeResponseValue;
+ const nativeResponseValue = wasm.C2Tuple_PublicKeyTypeZ_free(_res);
+ // debug statements here
}
- // void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
- export function CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: number): void {
+ // void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res);
+ export function CVec_C2Tuple_PublicKeyTypeZZ_free(_res: number[]): void {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res);
+ const nativeResponseValue = wasm.CVec_C2Tuple_PublicKeyTypeZZ_free(_res);
// debug statements here
}
// struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
const nativeResponseValue = wasm.CVec_NodeAnnouncementZ_free(_res);
// debug statements here
}
- // struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
- export function CResult_NoneLightningErrorZ_ok(): number {
- if(!isWasmInitialized) {
- throw new Error("initializeWasm() must be awaited first!");
- }
- const nativeResponseValue = wasm.CResult_NoneLightningErrorZ_ok();
- return nativeResponseValue;
- }
- // struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
- export function CResult_NoneLightningErrorZ_err(e: number): number {
- if(!isWasmInitialized) {
- throw new Error("initializeWasm() must be awaited first!");
- }
- const nativeResponseValue = wasm.CResult_NoneLightningErrorZ_err(e);
- return nativeResponseValue;
- }
- // void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
- export function CResult_NoneLightningErrorZ_free(_res: number): void {
- if(!isWasmInitialized) {
- throw new Error("initializeWasm() must be awaited first!");
- }
- const nativeResponseValue = wasm.CResult_NoneLightningErrorZ_free(_res);
- // debug statements here
- }
- // struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
- export function CResult_NoneLightningErrorZ_clone(orig: number): number {
- if(!isWasmInitialized) {
- throw new Error("initializeWasm() must be awaited first!");
- }
- const nativeResponseValue = wasm.CResult_NoneLightningErrorZ_clone(orig);
- return nativeResponseValue;
- }
// void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
export function CVec_PublicKeyZ_free(_res: Uint8Array[]): void {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.CResult_boolPeerHandleErrorZ_clone(orig);
return nativeResponseValue;
}
+ // struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o);
+ export function COption_AccessZ_some(o: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.COption_AccessZ_some(o);
+ return nativeResponseValue;
+ }
+ // struct LDKCOption_AccessZ COption_AccessZ_none(void);
+ export function COption_AccessZ_none(): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.COption_AccessZ_none();
+ return nativeResponseValue;
+ }
+ // void COption_AccessZ_free(struct LDKCOption_AccessZ _res);
+ export function COption_AccessZ_free(_res: number): void {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.COption_AccessZ_free(_res);
+ // debug statements here
+ }
// struct LDKCResult_DirectionalChannelInfoDecodeErrorZ CResult_DirectionalChannelInfoDecodeErrorZ_ok(struct LDKDirectionalChannelInfo o);
export function CResult_DirectionalChannelInfoDecodeErrorZ_ok(o: number): number {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.CResult_NetworkGraphDecodeErrorZ_free(_res);
// debug statements here
}
- // struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
- export function CResult_NetworkGraphDecodeErrorZ_clone(orig: number): number {
- if(!isWasmInitialized) {
- throw new Error("initializeWasm() must be awaited first!");
- }
- const nativeResponseValue = wasm.CResult_NetworkGraphDecodeErrorZ_clone(orig);
- return nativeResponseValue;
- }
// struct LDKCResult_NetAddressu8Z CResult_NetAddressu8Z_ok(struct LDKNetAddress o);
export function CResult_NetAddressu8Z_ok(o: number): number {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.CResult_InvoiceSignOrCreationErrorZ_clone(orig);
return nativeResponseValue;
}
+ // struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o);
+ export function COption_FilterZ_some(o: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.COption_FilterZ_some(o);
+ return nativeResponseValue;
+ }
+ // struct LDKCOption_FilterZ COption_FilterZ_none(void);
+ export function COption_FilterZ_none(): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.COption_FilterZ_none();
+ return nativeResponseValue;
+ }
+ // void COption_FilterZ_free(struct LDKCOption_FilterZ _res);
+ export function COption_FilterZ_free(_res: number): void {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.COption_FilterZ_free(_res);
+ // debug statements here
+ }
// void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
export function PaymentPurpose_free(this_ptr: number): void {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.PaymentPurpose_spontaneous_payment(encodeArray(a));
return nativeResponseValue;
}
+ // void ClosureReason_free(struct LDKClosureReason this_ptr);
+ export function ClosureReason_free(this_ptr: number): void {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ClosureReason_free(this_ptr);
+ // debug statements here
+ }
+ // struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig);
+ export function ClosureReason_clone(orig: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ClosureReason_clone(orig);
+ return nativeResponseValue;
+ }
+ // struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKStr peer_msg);
+ export function ClosureReason_counterparty_force_closed(peer_msg: String): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ClosureReason_counterparty_force_closed(peer_msg);
+ return nativeResponseValue;
+ }
+ // struct LDKClosureReason ClosureReason_holder_force_closed(void);
+ export function ClosureReason_holder_force_closed(): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ClosureReason_holder_force_closed();
+ return nativeResponseValue;
+ }
+ // struct LDKClosureReason ClosureReason_cooperative_closure(void);
+ export function ClosureReason_cooperative_closure(): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ClosureReason_cooperative_closure();
+ return nativeResponseValue;
+ }
+ // struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void);
+ export function ClosureReason_commitment_tx_confirmed(): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ClosureReason_commitment_tx_confirmed();
+ return nativeResponseValue;
+ }
+ // struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err);
+ export function ClosureReason_processing_error(err: String): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ClosureReason_processing_error(err);
+ return nativeResponseValue;
+ }
+ // struct LDKClosureReason ClosureReason_disconnected_peer(void);
+ export function ClosureReason_disconnected_peer(): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ClosureReason_disconnected_peer();
+ return nativeResponseValue;
+ }
+ // struct LDKClosureReason ClosureReason_outdated_channel_manager(void);
+ export function ClosureReason_outdated_channel_manager(): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ClosureReason_outdated_channel_manager();
+ return nativeResponseValue;
+ }
+ // struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj);
+ export function ClosureReason_write(obj: number): Uint8Array {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ClosureReason_write(obj);
+ return decodeArray(nativeResponseValue);
+ }
// void Event_free(struct LDKEvent this_ptr);
export function Event_free(this_ptr: number): void {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.Event_payment_sent(encodeArray(payment_preimage));
return nativeResponseValue;
}
- // struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_hash, bool rejected_by_dest);
- export function Event_payment_failed(payment_hash: Uint8Array, rejected_by_dest: boolean): number {
+ // struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_hash, bool rejected_by_dest, struct LDKCOption_NetworkUpdateZ network_update, bool all_paths_failed, struct LDKCVec_RouteHopZ path);
+ export function Event_payment_path_failed(payment_hash: Uint8Array, rejected_by_dest: boolean, network_update: number, all_paths_failed: boolean, path: number[]): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.Event_payment_failed(encodeArray(payment_hash), rejected_by_dest);
+ const nativeResponseValue = wasm.Event_payment_path_failed(encodeArray(payment_hash), rejected_by_dest, network_update, all_paths_failed, path);
return nativeResponseValue;
}
// struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable);
const nativeResponseValue = wasm.Event_payment_forwarded(fee_earned_msat, claim_from_onchain_tx);
return nativeResponseValue;
}
+ // struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, struct LDKClosureReason reason);
+ export function Event_channel_closed(channel_id: Uint8Array, reason: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.Event_channel_closed(encodeArray(channel_id), reason);
+ return nativeResponseValue;
+ }
// struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
export function Event_write(obj: number): Uint8Array {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.MessageSendEvent_handle_error(encodeArray(node_id), action);
return nativeResponseValue;
}
- // struct LDKMessageSendEvent MessageSendEvent_payment_failure_network_update(struct LDKHTLCFailChannelUpdate update);
- export function MessageSendEvent_payment_failure_network_update(update: number): number {
- if(!isWasmInitialized) {
- throw new Error("initializeWasm() must be awaited first!");
- }
- const nativeResponseValue = wasm.MessageSendEvent_payment_failure_network_update(update);
- return nativeResponseValue;
- }
// struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg);
export function MessageSendEvent_send_channel_range_query(node_id: Uint8Array, msg: number): number {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.ChainMonitor_free(this_obj);
// debug statements here
}
- // MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKFilter *chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
+ // MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
export function ChainMonitor_new(chain_source: number, broadcaster: number, logger: number, feeest: number, persister: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
const nativeResponseValue = wasm.ChainMonitor_new(chain_source, broadcaster, logger, feeest, persister);
return nativeResponseValue;
}
+ // MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels);
+ export function ChainMonitor_get_claimable_balances(this_arg: number, ignored_channels: number[]): number[] {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ChainMonitor_get_claimable_balances(this_arg, ignored_channels);
+ return nativeResponseValue;
+ }
// struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
export function ChainMonitor_as_Listen(this_arg: number): number {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.MonitorEvent_htlcevent(a);
return nativeResponseValue;
}
- // struct LDKMonitorEvent MonitorEvent_commitment_tx_broadcasted(struct LDKOutPoint a);
- export function MonitorEvent_commitment_tx_broadcasted(a: number): number {
+ // struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a);
+ export function MonitorEvent_commitment_tx_confirmed(a: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.MonitorEvent_commitment_tx_broadcasted(a);
+ const nativeResponseValue = wasm.MonitorEvent_commitment_tx_confirmed(a);
return nativeResponseValue;
}
// void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
const nativeResponseValue = wasm.HTLCUpdate_read(encodeArray(ser));
return nativeResponseValue;
}
+ // void Balance_free(struct LDKBalance this_ptr);
+ export function Balance_free(this_ptr: number): void {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.Balance_free(this_ptr);
+ // debug statements here
+ }
+ // struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig);
+ export function Balance_clone(orig: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.Balance_clone(orig);
+ return nativeResponseValue;
+ }
+ // struct LDKBalance Balance_claimable_on_channel_close(uint64_t claimable_amount_satoshis);
+ export function Balance_claimable_on_channel_close(claimable_amount_satoshis: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.Balance_claimable_on_channel_close(claimable_amount_satoshis);
+ return nativeResponseValue;
+ }
+ // struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t claimable_amount_satoshis, uint32_t confirmation_height);
+ export function Balance_claimable_awaiting_confirmations(claimable_amount_satoshis: number, confirmation_height: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
+ return nativeResponseValue;
+ }
+ // struct LDKBalance Balance_contentious_claimable(uint64_t claimable_amount_satoshis, uint32_t timeout_height);
+ export function Balance_contentious_claimable(claimable_amount_satoshis: number, timeout_height: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
+ return nativeResponseValue;
+ }
+ // struct LDKBalance Balance_maybe_claimable_htlcawaiting_timeout(uint64_t claimable_amount_satoshis, uint32_t claimable_height);
+ export function Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis: number, claimable_height: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
+ return nativeResponseValue;
+ }
+ // bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b);
+ export function Balance_eq(a: number, b: number): boolean {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.Balance_eq(a, b);
+ return nativeResponseValue;
+ }
// void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
export function ChannelMonitor_free(this_obj: number): void {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.ChannelMonitor_current_best_block(this_arg);
return nativeResponseValue;
}
+ // MUST_USE_RES struct LDKCVec_BalanceZ ChannelMonitor_get_claimable_balances(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
+ export function ChannelMonitor_get_claimable_balances(this_arg: number): number[] {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ChannelMonitor_get_claimable_balances(this_arg);
+ return nativeResponseValue;
+ }
// void Persist_free(struct LDKPersist this_ptr);
export function Persist_free(this_ptr: number): void {
if(!isWasmInitialized) {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.KeysManager_as_KeysInterface(this_arg);
+ const nativeResponseValue = wasm.KeysManager_as_KeysInterface(this_arg);
+ return nativeResponseValue;
+ }
+ // void ChannelManager_free(struct LDKChannelManager this_obj);
+ export function ChannelManager_free(this_obj: number): void {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ChannelManager_free(this_obj);
+ // debug statements here
+ }
+ // void ChainParameters_free(struct LDKChainParameters this_obj);
+ export function ChainParameters_free(this_obj: number): void {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ChainParameters_free(this_obj);
+ // debug statements here
+ }
+ // enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
+ export function ChainParameters_get_network(this_ptr: number): Network {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ChainParameters_get_network(this_ptr);
+ return nativeResponseValue;
+ }
+ // void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
+ export function ChainParameters_set_network(this_ptr: number, val: Network): void {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ChainParameters_set_network(this_ptr, val);
+ // debug statements here
+ }
+ // struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
+ export function ChainParameters_get_best_block(this_ptr: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ChainParameters_get_best_block(this_ptr);
+ return nativeResponseValue;
+ }
+ // void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
+ export function ChainParameters_set_best_block(this_ptr: number, val: number): void {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ChainParameters_set_best_block(this_ptr, val);
+ // debug statements here
+ }
+ // MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
+ export function ChainParameters_new(network_arg: Network, best_block_arg: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ChainParameters_new(network_arg, best_block_arg);
+ return nativeResponseValue;
+ }
+ // struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig);
+ export function ChainParameters_clone(orig: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ChainParameters_clone(orig);
return nativeResponseValue;
}
- // void ChannelManager_free(struct LDKChannelManager this_obj);
- export function ChannelManager_free(this_obj: number): void {
+ // void CounterpartyForwardingInfo_free(struct LDKCounterpartyForwardingInfo this_obj);
+ export function CounterpartyForwardingInfo_free(this_obj: number): void {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.ChannelManager_free(this_obj);
+ const nativeResponseValue = wasm.CounterpartyForwardingInfo_free(this_obj);
// debug statements here
}
- // void ChainParameters_free(struct LDKChainParameters this_obj);
- export function ChainParameters_free(this_obj: number): void {
+ // uint32_t CounterpartyForwardingInfo_get_fee_base_msat(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
+ export function CounterpartyForwardingInfo_get_fee_base_msat(this_ptr: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.ChainParameters_free(this_obj);
+ const nativeResponseValue = wasm.CounterpartyForwardingInfo_get_fee_base_msat(this_ptr);
+ return nativeResponseValue;
+ }
+ // void CounterpartyForwardingInfo_set_fee_base_msat(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
+ export function CounterpartyForwardingInfo_set_fee_base_msat(this_ptr: number, val: number): void {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CounterpartyForwardingInfo_set_fee_base_msat(this_ptr, val);
// debug statements here
}
- // enum LDKNetwork ChainParameters_get_network(const struct LDKChainParameters *NONNULL_PTR this_ptr);
- export function ChainParameters_get_network(this_ptr: number): Network {
+ // uint32_t CounterpartyForwardingInfo_get_fee_proportional_millionths(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
+ export function CounterpartyForwardingInfo_get_fee_proportional_millionths(this_ptr: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.ChainParameters_get_network(this_ptr);
+ const nativeResponseValue = wasm.CounterpartyForwardingInfo_get_fee_proportional_millionths(this_ptr);
return nativeResponseValue;
}
- // void ChainParameters_set_network(struct LDKChainParameters *NONNULL_PTR this_ptr, enum LDKNetwork val);
- export function ChainParameters_set_network(this_ptr: number, val: Network): void {
+ // void CounterpartyForwardingInfo_set_fee_proportional_millionths(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint32_t val);
+ export function CounterpartyForwardingInfo_set_fee_proportional_millionths(this_ptr: number, val: number): void {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.ChainParameters_set_network(this_ptr, val);
+ const nativeResponseValue = wasm.CounterpartyForwardingInfo_set_fee_proportional_millionths(this_ptr, val);
// debug statements here
}
- // struct LDKBestBlock ChainParameters_get_best_block(const struct LDKChainParameters *NONNULL_PTR this_ptr);
- export function ChainParameters_get_best_block(this_ptr: number): number {
+ // uint16_t CounterpartyForwardingInfo_get_cltv_expiry_delta(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr);
+ export function CounterpartyForwardingInfo_get_cltv_expiry_delta(this_ptr: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.ChainParameters_get_best_block(this_ptr);
+ const nativeResponseValue = wasm.CounterpartyForwardingInfo_get_cltv_expiry_delta(this_ptr);
return nativeResponseValue;
}
- // void ChainParameters_set_best_block(struct LDKChainParameters *NONNULL_PTR this_ptr, struct LDKBestBlock val);
- export function ChainParameters_set_best_block(this_ptr: number, val: number): void {
+ // void CounterpartyForwardingInfo_set_cltv_expiry_delta(struct LDKCounterpartyForwardingInfo *NONNULL_PTR this_ptr, uint16_t val);
+ export function CounterpartyForwardingInfo_set_cltv_expiry_delta(this_ptr: number, val: number): void {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.ChainParameters_set_best_block(this_ptr, val);
+ const nativeResponseValue = wasm.CounterpartyForwardingInfo_set_cltv_expiry_delta(this_ptr, val);
// debug statements here
}
- // MUST_USE_RES struct LDKChainParameters ChainParameters_new(enum LDKNetwork network_arg, struct LDKBestBlock best_block_arg);
- export function ChainParameters_new(network_arg: Network, best_block_arg: number): number {
+ // MUST_USE_RES struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_new(uint32_t fee_base_msat_arg, uint32_t fee_proportional_millionths_arg, uint16_t cltv_expiry_delta_arg);
+ export function CounterpartyForwardingInfo_new(fee_base_msat_arg: number, fee_proportional_millionths_arg: number, cltv_expiry_delta_arg: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.ChainParameters_new(network_arg, best_block_arg);
+ const nativeResponseValue = wasm.CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
return nativeResponseValue;
}
- // struct LDKChainParameters ChainParameters_clone(const struct LDKChainParameters *NONNULL_PTR orig);
- export function ChainParameters_clone(orig: number): number {
+ // struct LDKCounterpartyForwardingInfo CounterpartyForwardingInfo_clone(const struct LDKCounterpartyForwardingInfo *NONNULL_PTR orig);
+ export function CounterpartyForwardingInfo_clone(orig: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.ChainParameters_clone(orig);
+ const nativeResponseValue = wasm.CounterpartyForwardingInfo_clone(orig);
return nativeResponseValue;
}
// void ChannelCounterparty_free(struct LDKChannelCounterparty this_obj);
const nativeResponseValue = wasm.ChannelCounterparty_set_unspendable_punishment_reserve(this_ptr, val);
// debug statements here
}
+ // struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr);
+ export function ChannelCounterparty_get_forwarding_info(this_ptr: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ChannelCounterparty_get_forwarding_info(this_ptr);
+ return nativeResponseValue;
+ }
+ // void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val);
+ export function ChannelCounterparty_set_forwarding_info(this_ptr: number, val: number): void {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ChannelCounterparty_set_forwarding_info(this_ptr, val);
+ // debug statements here
+ }
+ // MUST_USE_RES struct LDKChannelCounterparty ChannelCounterparty_new(struct LDKPublicKey node_id_arg, struct LDKInitFeatures features_arg, uint64_t unspendable_punishment_reserve_arg, struct LDKCounterpartyForwardingInfo forwarding_info_arg);
+ export function ChannelCounterparty_new(node_id_arg: Uint8Array, features_arg: number, unspendable_punishment_reserve_arg: number, forwarding_info_arg: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ChannelCounterparty_new(encodeArray(node_id_arg), features_arg, unspendable_punishment_reserve_arg, forwarding_info_arg);
+ return nativeResponseValue;
+ }
// struct LDKChannelCounterparty ChannelCounterparty_clone(const struct LDKChannelCounterparty *NONNULL_PTR orig);
export function ChannelCounterparty_clone(orig: number): number {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.CommitmentUpdate_free(this_obj);
// debug statements here
}
+ // struct LDKCVec_UpdateAddHTLCZ CommitmentUpdate_get_update_add_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
+ export function CommitmentUpdate_get_update_add_htlcs(this_ptr: number): number[] {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CommitmentUpdate_get_update_add_htlcs(this_ptr);
+ return nativeResponseValue;
+ }
// void CommitmentUpdate_set_update_add_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateAddHTLCZ val);
export function CommitmentUpdate_set_update_add_htlcs(this_ptr: number, val: number[]): void {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.CommitmentUpdate_set_update_add_htlcs(this_ptr, val);
// debug statements here
}
+ // struct LDKCVec_UpdateFulfillHTLCZ CommitmentUpdate_get_update_fulfill_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
+ export function CommitmentUpdate_get_update_fulfill_htlcs(this_ptr: number): number[] {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CommitmentUpdate_get_update_fulfill_htlcs(this_ptr);
+ return nativeResponseValue;
+ }
// void CommitmentUpdate_set_update_fulfill_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFulfillHTLCZ val);
export function CommitmentUpdate_set_update_fulfill_htlcs(this_ptr: number, val: number[]): void {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.CommitmentUpdate_set_update_fulfill_htlcs(this_ptr, val);
// debug statements here
}
+ // struct LDKCVec_UpdateFailHTLCZ CommitmentUpdate_get_update_fail_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
+ export function CommitmentUpdate_get_update_fail_htlcs(this_ptr: number): number[] {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CommitmentUpdate_get_update_fail_htlcs(this_ptr);
+ return nativeResponseValue;
+ }
// void CommitmentUpdate_set_update_fail_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailHTLCZ val);
export function CommitmentUpdate_set_update_fail_htlcs(this_ptr: number, val: number[]): void {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.CommitmentUpdate_set_update_fail_htlcs(this_ptr, val);
// debug statements here
}
+ // struct LDKCVec_UpdateFailMalformedHTLCZ CommitmentUpdate_get_update_fail_malformed_htlcs(const struct LDKCommitmentUpdate *NONNULL_PTR this_ptr);
+ export function CommitmentUpdate_get_update_fail_malformed_htlcs(this_ptr: number): number[] {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CommitmentUpdate_get_update_fail_malformed_htlcs(this_ptr);
+ return nativeResponseValue;
+ }
// void CommitmentUpdate_set_update_fail_malformed_htlcs(struct LDKCommitmentUpdate *NONNULL_PTR this_ptr, struct LDKCVec_UpdateFailMalformedHTLCZ val);
export function CommitmentUpdate_set_update_fail_malformed_htlcs(this_ptr: number, val: number[]): void {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.CommitmentUpdate_clone(orig);
return nativeResponseValue;
}
- // void HTLCFailChannelUpdate_free(struct LDKHTLCFailChannelUpdate this_ptr);
- export function HTLCFailChannelUpdate_free(this_ptr: number): void {
- if(!isWasmInitialized) {
- throw new Error("initializeWasm() must be awaited first!");
- }
- const nativeResponseValue = wasm.HTLCFailChannelUpdate_free(this_ptr);
- // debug statements here
- }
- // struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_clone(const struct LDKHTLCFailChannelUpdate *NONNULL_PTR orig);
- export function HTLCFailChannelUpdate_clone(orig: number): number {
- if(!isWasmInitialized) {
- throw new Error("initializeWasm() must be awaited first!");
- }
- const nativeResponseValue = wasm.HTLCFailChannelUpdate_clone(orig);
- return nativeResponseValue;
- }
- // struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_channel_update_message(struct LDKChannelUpdate msg);
- export function HTLCFailChannelUpdate_channel_update_message(msg: number): number {
- if(!isWasmInitialized) {
- throw new Error("initializeWasm() must be awaited first!");
- }
- const nativeResponseValue = wasm.HTLCFailChannelUpdate_channel_update_message(msg);
- return nativeResponseValue;
- }
- // struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_channel_closed(uint64_t short_channel_id, bool is_permanent);
- export function HTLCFailChannelUpdate_channel_closed(short_channel_id: number, is_permanent: boolean): number {
- if(!isWasmInitialized) {
- throw new Error("initializeWasm() must be awaited first!");
- }
- const nativeResponseValue = wasm.HTLCFailChannelUpdate_channel_closed(short_channel_id, is_permanent);
- return nativeResponseValue;
- }
- // struct LDKHTLCFailChannelUpdate HTLCFailChannelUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
- export function HTLCFailChannelUpdate_node_failure(node_id: Uint8Array, is_permanent: boolean): number {
- if(!isWasmInitialized) {
- throw new Error("initializeWasm() must be awaited first!");
- }
- const nativeResponseValue = wasm.HTLCFailChannelUpdate_node_failure(encodeArray(node_id), is_permanent);
- return nativeResponseValue;
- }
// void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr);
export function ChannelMessageHandler_free(this_ptr: number): void {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.QueryShortChannelIds_write(obj);
return decodeArray(nativeResponseValue);
}
- // struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
- export function ReplyShortChannelIdsEnd_read(ser: Uint8Array): number {
- if(!isWasmInitialized) {
- throw new Error("initializeWasm() must be awaited first!");
- }
- const nativeResponseValue = wasm.ReplyShortChannelIdsEnd_read(encodeArray(ser));
- return nativeResponseValue;
- }
// struct LDKCVec_u8Z ReplyShortChannelIdsEnd_write(const struct LDKReplyShortChannelIdsEnd *NONNULL_PTR obj);
export function ReplyShortChannelIdsEnd_write(obj: number): Uint8Array {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.ReplyShortChannelIdsEnd_write(obj);
return decodeArray(nativeResponseValue);
}
- // MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
- export function QueryChannelRange_end_blocknum(this_arg: number): number {
+ // struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ ReplyShortChannelIdsEnd_read(struct LDKu8slice ser);
+ export function ReplyShortChannelIdsEnd_read(ser: Uint8Array): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.QueryChannelRange_end_blocknum(this_arg);
+ const nativeResponseValue = wasm.ReplyShortChannelIdsEnd_read(encodeArray(ser));
return nativeResponseValue;
}
- // struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
- export function QueryChannelRange_read(ser: Uint8Array): number {
+ // MUST_USE_RES uint32_t QueryChannelRange_end_blocknum(const struct LDKQueryChannelRange *NONNULL_PTR this_arg);
+ export function QueryChannelRange_end_blocknum(this_arg: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.QueryChannelRange_read(encodeArray(ser));
+ const nativeResponseValue = wasm.QueryChannelRange_end_blocknum(this_arg);
return nativeResponseValue;
}
// struct LDKCVec_u8Z QueryChannelRange_write(const struct LDKQueryChannelRange *NONNULL_PTR obj);
const nativeResponseValue = wasm.QueryChannelRange_write(obj);
return decodeArray(nativeResponseValue);
}
+ // struct LDKCResult_QueryChannelRangeDecodeErrorZ QueryChannelRange_read(struct LDKu8slice ser);
+ export function QueryChannelRange_read(ser: Uint8Array): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.QueryChannelRange_read(encodeArray(ser));
+ return nativeResponseValue;
+ }
// struct LDKCResult_ReplyChannelRangeDecodeErrorZ ReplyChannelRange_read(struct LDKu8slice ser);
export function ReplyChannelRange_read(ser: Uint8Array): number {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.ReplyChannelRange_write(obj);
return decodeArray(nativeResponseValue);
}
+ // struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
+ export function GossipTimestampFilter_write(obj: number): Uint8Array {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.GossipTimestampFilter_write(obj);
+ return decodeArray(nativeResponseValue);
+ }
// struct LDKCResult_GossipTimestampFilterDecodeErrorZ GossipTimestampFilter_read(struct LDKu8slice ser);
export function GossipTimestampFilter_read(ser: Uint8Array): number {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.GossipTimestampFilter_read(encodeArray(ser));
return nativeResponseValue;
}
- // struct LDKCVec_u8Z GossipTimestampFilter_write(const struct LDKGossipTimestampFilter *NONNULL_PTR obj);
- export function GossipTimestampFilter_write(obj: number): Uint8Array {
+ // void CustomMessageHandler_free(struct LDKCustomMessageHandler this_ptr);
+ export function CustomMessageHandler_free(this_ptr: number): void {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.GossipTimestampFilter_write(obj);
- return decodeArray(nativeResponseValue);
+ const nativeResponseValue = wasm.CustomMessageHandler_free(this_ptr);
+ // debug statements here
}
// void IgnoringMessageHandler_free(struct LDKIgnoringMessageHandler this_obj);
export function IgnoringMessageHandler_free(this_obj: number): void {
const nativeResponseValue = wasm.IgnoringMessageHandler_as_RoutingMessageHandler(this_arg);
return nativeResponseValue;
}
+ // struct LDKCustomMessageReader IgnoringMessageHandler_as_CustomMessageReader(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
+ export function IgnoringMessageHandler_as_CustomMessageReader(this_arg: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.IgnoringMessageHandler_as_CustomMessageReader(this_arg);
+ return nativeResponseValue;
+ }
+ // struct LDKCustomMessageHandler IgnoringMessageHandler_as_CustomMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg);
+ export function IgnoringMessageHandler_as_CustomMessageHandler(this_arg: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.IgnoringMessageHandler_as_CustomMessageHandler(this_arg);
+ return nativeResponseValue;
+ }
// void ErroringMessageHandler_free(struct LDKErroringMessageHandler this_obj);
export function ErroringMessageHandler_free(this_obj: number): void {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.PeerManager_free(this_obj);
// debug statements here
}
- // MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler message_handler, struct LDKSecretKey our_node_secret, const uint8_t (*ephemeral_random_data)[32], struct LDKLogger logger);
- export function PeerManager_new(message_handler: number, our_node_secret: Uint8Array, ephemeral_random_data: Uint8Array, logger: number): number {
+ // MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler message_handler, struct LDKSecretKey our_node_secret, const uint8_t (*ephemeral_random_data)[32], struct LDKLogger logger, struct LDKCustomMessageHandler custom_message_handler);
+ export function PeerManager_new(message_handler: number, our_node_secret: Uint8Array, ephemeral_random_data: Uint8Array, logger: number, custom_message_handler: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.PeerManager_new(message_handler, encodeArray(our_node_secret), encodeArray(ephemeral_random_data), logger);
+ const nativeResponseValue = wasm.PeerManager_new(message_handler, encodeArray(our_node_secret), encodeArray(ephemeral_random_data), logger, custom_message_handler);
return nativeResponseValue;
}
// MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struct LDKPeerManager *NONNULL_PTR this_arg);
const nativeResponseValue = wasm.build_commitment_secret(encodeArray(commitment_seed), idx);
return decodeArray(nativeResponseValue);
}
+ // struct LDKTransaction build_closing_transaction(uint64_t to_holder_value_sat, uint64_t to_counterparty_value_sat, struct LDKCVec_u8Z to_holder_script, struct LDKCVec_u8Z to_counterparty_script, struct LDKOutPoint funding_outpoint);
+ export function build_closing_transaction(to_holder_value_sat: number, to_counterparty_value_sat: number, to_holder_script: Uint8Array, to_counterparty_script: Uint8Array, funding_outpoint: number): Uint8Array {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.build_closing_transaction(to_holder_value_sat, to_counterparty_value_sat, encodeArray(to_holder_script), encodeArray(to_counterparty_script), funding_outpoint);
+ return decodeArray(nativeResponseValue);
+ }
// struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]);
export function derive_private_key(per_commitment_point: Uint8Array, base_secret: Uint8Array): number {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.BuiltCommitmentTransaction_sign(this_arg, encodeArray(funding_key), encodeArray(funding_redeemscript), channel_value_satoshis);
return decodeArray(nativeResponseValue);
}
+ // void ClosingTransaction_free(struct LDKClosingTransaction this_obj);
+ export function ClosingTransaction_free(this_obj: number): void {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ClosingTransaction_free(this_obj);
+ // debug statements here
+ }
+ // MUST_USE_RES struct LDKClosingTransaction ClosingTransaction_new(uint64_t to_holder_value_sat, uint64_t to_counterparty_value_sat, struct LDKCVec_u8Z to_holder_script, struct LDKCVec_u8Z to_counterparty_script, struct LDKOutPoint funding_outpoint);
+ export function ClosingTransaction_new(to_holder_value_sat: number, to_counterparty_value_sat: number, to_holder_script: Uint8Array, to_counterparty_script: Uint8Array, funding_outpoint: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, encodeArray(to_holder_script), encodeArray(to_counterparty_script), funding_outpoint);
+ return nativeResponseValue;
+ }
+ // MUST_USE_RES struct LDKTrustedClosingTransaction ClosingTransaction_trust(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
+ export function ClosingTransaction_trust(this_arg: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ClosingTransaction_trust(this_arg);
+ return nativeResponseValue;
+ }
+ // MUST_USE_RES struct LDKCResult_TrustedClosingTransactionNoneZ ClosingTransaction_verify(const struct LDKClosingTransaction *NONNULL_PTR this_arg, struct LDKOutPoint funding_outpoint);
+ export function ClosingTransaction_verify(this_arg: number, funding_outpoint: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ClosingTransaction_verify(this_arg, funding_outpoint);
+ return nativeResponseValue;
+ }
+ // MUST_USE_RES uint64_t ClosingTransaction_to_holder_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
+ export function ClosingTransaction_to_holder_value_sat(this_arg: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ClosingTransaction_to_holder_value_sat(this_arg);
+ return nativeResponseValue;
+ }
+ // MUST_USE_RES uint64_t ClosingTransaction_to_counterparty_value_sat(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
+ export function ClosingTransaction_to_counterparty_value_sat(this_arg: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ClosingTransaction_to_counterparty_value_sat(this_arg);
+ return nativeResponseValue;
+ }
+ // MUST_USE_RES struct LDKu8slice ClosingTransaction_to_holder_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
+ export function ClosingTransaction_to_holder_script(this_arg: number): Uint8Array {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ClosingTransaction_to_holder_script(this_arg);
+ return decodeArray(nativeResponseValue);
+ }
+ // MUST_USE_RES struct LDKu8slice ClosingTransaction_to_counterparty_script(const struct LDKClosingTransaction *NONNULL_PTR this_arg);
+ export function ClosingTransaction_to_counterparty_script(this_arg: number): Uint8Array {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ClosingTransaction_to_counterparty_script(this_arg);
+ return decodeArray(nativeResponseValue);
+ }
+ // void TrustedClosingTransaction_free(struct LDKTrustedClosingTransaction this_obj);
+ export function TrustedClosingTransaction_free(this_obj: number): void {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.TrustedClosingTransaction_free(this_obj);
+ // debug statements here
+ }
+ // MUST_USE_RES struct LDKTransaction TrustedClosingTransaction_built_transaction(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg);
+ export function TrustedClosingTransaction_built_transaction(this_arg: number): Uint8Array {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.TrustedClosingTransaction_built_transaction(this_arg);
+ return decodeArray(nativeResponseValue);
+ }
+ // MUST_USE_RES struct LDKThirtyTwoBytes TrustedClosingTransaction_get_sighash_all(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg, struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
+ export function TrustedClosingTransaction_get_sighash_all(this_arg: number, funding_redeemscript: Uint8Array, channel_value_satoshis: number): Uint8Array {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.TrustedClosingTransaction_get_sighash_all(this_arg, encodeArray(funding_redeemscript), channel_value_satoshis);
+ return decodeArray(nativeResponseValue);
+ }
+ // MUST_USE_RES struct LDKSignature TrustedClosingTransaction_sign(const struct LDKTrustedClosingTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
+ export function TrustedClosingTransaction_sign(this_arg: number, funding_key: Uint8Array, funding_redeemscript: Uint8Array, channel_value_satoshis: number): Uint8Array {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.TrustedClosingTransaction_sign(this_arg, encodeArray(funding_key), encodeArray(funding_redeemscript), channel_value_satoshis);
+ return decodeArray(nativeResponseValue);
+ }
// void CommitmentTransaction_free(struct LDKCommitmentTransaction this_obj);
export function CommitmentTransaction_free(this_obj: number): void {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.InitFeatures_known();
return nativeResponseValue;
}
+ // MUST_USE_RES bool InitFeatures_requires_unknown_bits(const struct LDKInitFeatures *NONNULL_PTR this_arg);
+ export function InitFeatures_requires_unknown_bits(this_arg: number): boolean {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.InitFeatures_requires_unknown_bits(this_arg);
+ return nativeResponseValue;
+ }
// MUST_USE_RES struct LDKNodeFeatures NodeFeatures_empty(void);
export function NodeFeatures_empty(): number {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.NodeFeatures_known();
return nativeResponseValue;
}
+ // MUST_USE_RES bool NodeFeatures_requires_unknown_bits(const struct LDKNodeFeatures *NONNULL_PTR this_arg);
+ export function NodeFeatures_requires_unknown_bits(this_arg: number): boolean {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.NodeFeatures_requires_unknown_bits(this_arg);
+ return nativeResponseValue;
+ }
// MUST_USE_RES struct LDKChannelFeatures ChannelFeatures_empty(void);
export function ChannelFeatures_empty(): number {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.ChannelFeatures_known();
return nativeResponseValue;
}
+ // MUST_USE_RES bool ChannelFeatures_requires_unknown_bits(const struct LDKChannelFeatures *NONNULL_PTR this_arg);
+ export function ChannelFeatures_requires_unknown_bits(this_arg: number): boolean {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ChannelFeatures_requires_unknown_bits(this_arg);
+ return nativeResponseValue;
+ }
// MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void);
export function InvoiceFeatures_empty(): number {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.InvoiceFeatures_known();
return nativeResponseValue;
}
+ // MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
+ export function InvoiceFeatures_requires_unknown_bits(this_arg: number): boolean {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.InvoiceFeatures_requires_unknown_bits(this_arg);
+ return nativeResponseValue;
+ }
// MUST_USE_RES bool InitFeatures_supports_payment_secret(const struct LDKInitFeatures *NONNULL_PTR this_arg);
export function InitFeatures_supports_payment_secret(this_arg: number): boolean {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.ShutdownScript_is_compatible(this_arg, features);
return nativeResponseValue;
}
+ // void CustomMessageReader_free(struct LDKCustomMessageReader this_ptr);
+ export function CustomMessageReader_free(this_ptr: number): void {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.CustomMessageReader_free(this_ptr);
+ // debug statements here
+ }
+ // struct LDKType Type_clone(const struct LDKType *NONNULL_PTR orig);
+ export function Type_clone(orig: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.Type_clone(orig);
+ return nativeResponseValue;
+ }
+ // void Type_free(struct LDKType this_ptr);
+ export function Type_free(this_ptr: number): void {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.Type_free(this_ptr);
+ // debug statements here
+ }
// void RouteHop_free(struct LDKRouteHop this_obj);
export function RouteHop_free(this_obj: number): void {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.RouteHop_set_cltv_expiry_delta(this_ptr, val);
// debug statements here
}
- // MUST_USE_RES struct LDKRouteHop RouteHop_new(struct LDKPublicKey pubkey_arg, struct LDKNodeFeatures node_features_arg, uint64_t short_channel_id_arg, struct LDKChannelFeatures channel_features_arg, uint64_t fee_msat_arg, uint32_t cltv_expiry_delta_arg);
- export function RouteHop_new(pubkey_arg: Uint8Array, node_features_arg: number, short_channel_id_arg: number, channel_features_arg: number, fee_msat_arg: number, cltv_expiry_delta_arg: number): number {
+ // MUST_USE_RES struct LDKRouteHop RouteHop_new(struct LDKPublicKey pubkey_arg, struct LDKNodeFeatures node_features_arg, uint64_t short_channel_id_arg, struct LDKChannelFeatures channel_features_arg, uint64_t fee_msat_arg, uint32_t cltv_expiry_delta_arg);
+ export function RouteHop_new(pubkey_arg: Uint8Array, node_features_arg: number, short_channel_id_arg: number, channel_features_arg: number, fee_msat_arg: number, cltv_expiry_delta_arg: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.RouteHop_new(encodeArray(pubkey_arg), node_features_arg, short_channel_id_arg, channel_features_arg, fee_msat_arg, cltv_expiry_delta_arg);
+ return nativeResponseValue;
+ }
+ // struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
+ export function RouteHop_clone(orig: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.RouteHop_clone(orig);
+ return nativeResponseValue;
+ }
+ // uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o);
+ export function RouteHop_hash(o: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.RouteHop_new(encodeArray(pubkey_arg), node_features_arg, short_channel_id_arg, channel_features_arg, fee_msat_arg, cltv_expiry_delta_arg);
+ const nativeResponseValue = wasm.RouteHop_hash(o);
return nativeResponseValue;
}
- // struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
- export function RouteHop_clone(orig: number): number {
+ // bool RouteHop_eq(const struct LDKRouteHop *NONNULL_PTR a, const struct LDKRouteHop *NONNULL_PTR b);
+ export function RouteHop_eq(a: number, b: number): boolean {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.RouteHop_clone(orig);
+ const nativeResponseValue = wasm.RouteHop_eq(a, b);
return nativeResponseValue;
}
// struct LDKCVec_u8Z RouteHop_write(const struct LDKRouteHop *NONNULL_PTR obj);
const nativeResponseValue = wasm.Route_free(this_obj);
// debug statements here
}
+ // struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr);
+ export function Route_get_paths(this_ptr: number): number[][] {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.Route_get_paths(this_ptr);
+ return nativeResponseValue;
+ }
// void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
export function Route_set_paths(this_ptr: number, val: number[][]): void {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.Route_clone(orig);
return nativeResponseValue;
}
+ // uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o);
+ export function Route_hash(o: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.Route_hash(o);
+ return nativeResponseValue;
+ }
+ // bool Route_eq(const struct LDKRoute *NONNULL_PTR a, const struct LDKRoute *NONNULL_PTR b);
+ export function Route_eq(a: number, b: number): boolean {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.Route_eq(a, b);
+ return nativeResponseValue;
+ }
+ // MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg);
+ export function Route_get_total_fees(this_arg: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.Route_get_total_fees(this_arg);
+ return nativeResponseValue;
+ }
+ // MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg);
+ export function Route_get_total_amount(this_arg: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.Route_get_total_amount(this_arg);
+ return nativeResponseValue;
+ }
// struct LDKCVec_u8Z Route_write(const struct LDKRoute *NONNULL_PTR obj);
export function Route_write(obj: number): Uint8Array {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.RouteHint_free(this_obj);
// debug statements here
}
- // bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
- export function RouteHint_eq(a: number, b: number): boolean {
+ // struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
+ export function RouteHint_clone(orig: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.RouteHint_eq(a, b);
+ const nativeResponseValue = wasm.RouteHint_clone(orig);
return nativeResponseValue;
}
- // struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
- export function RouteHint_clone(orig: number): number {
+ // uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o);
+ export function RouteHint_hash(o: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.RouteHint_clone(orig);
+ const nativeResponseValue = wasm.RouteHint_hash(o);
+ return nativeResponseValue;
+ }
+ // bool RouteHint_eq(const struct LDKRouteHint *NONNULL_PTR a, const struct LDKRouteHint *NONNULL_PTR b);
+ export function RouteHint_eq(a: number, b: number): boolean {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.RouteHint_eq(a, b);
return nativeResponseValue;
}
// void RouteHintHop_free(struct LDKRouteHintHop this_obj);
const nativeResponseValue = wasm.RouteHintHop_new(encodeArray(src_node_id_arg), short_channel_id_arg, fees_arg, cltv_expiry_delta_arg, htlc_minimum_msat_arg, htlc_maximum_msat_arg);
return nativeResponseValue;
}
- // bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
- export function RouteHintHop_eq(a: number, b: number): boolean {
+ // struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
+ export function RouteHintHop_clone(orig: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.RouteHintHop_eq(a, b);
+ const nativeResponseValue = wasm.RouteHintHop_clone(orig);
return nativeResponseValue;
}
- // struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
- export function RouteHintHop_clone(orig: number): number {
+ // uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o);
+ export function RouteHintHop_hash(o: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.RouteHintHop_clone(orig);
+ const nativeResponseValue = wasm.RouteHintHop_hash(o);
+ return nativeResponseValue;
+ }
+ // bool RouteHintHop_eq(const struct LDKRouteHintHop *NONNULL_PTR a, const struct LDKRouteHintHop *NONNULL_PTR b);
+ export function RouteHintHop_eq(a: number, b: number): boolean {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.RouteHintHop_eq(a, b);
return nativeResponseValue;
}
// struct LDKCResult_RouteLightningErrorZ get_keysend_route(struct LDKPublicKey our_node_id, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKPublicKey payee, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKCVec_RouteHintZ last_hops, uint64_t final_value_msat, uint32_t final_cltv, struct LDKLogger logger);
const nativeResponseValue = wasm.NetworkGraph_free(this_obj);
// debug statements here
}
- // struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig);
- export function NetworkGraph_clone(orig: number): number {
+ // void ReadOnlyNetworkGraph_free(struct LDKReadOnlyNetworkGraph this_obj);
+ export function ReadOnlyNetworkGraph_free(this_obj: number): void {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.NetworkGraph_clone(orig);
- return nativeResponseValue;
+ const nativeResponseValue = wasm.ReadOnlyNetworkGraph_free(this_obj);
+ // debug statements here
}
- // void LockedNetworkGraph_free(struct LDKLockedNetworkGraph this_obj);
- export function LockedNetworkGraph_free(this_obj: number): void {
+ // void NetworkUpdate_free(struct LDKNetworkUpdate this_ptr);
+ export function NetworkUpdate_free(this_ptr: number): void {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.LockedNetworkGraph_free(this_obj);
+ const nativeResponseValue = wasm.NetworkUpdate_free(this_ptr);
// debug statements here
}
- // void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
- export function NetGraphMsgHandler_free(this_obj: number): void {
+ // struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNULL_PTR orig);
+ export function NetworkUpdate_clone(orig: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.NetGraphMsgHandler_free(this_obj);
- // debug statements here
+ const nativeResponseValue = wasm.NetworkUpdate_clone(orig);
+ return nativeResponseValue;
}
- // MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKAccess *chain_access, struct LDKLogger logger);
- export function NetGraphMsgHandler_new(genesis_hash: Uint8Array, chain_access: number, logger: number): number {
+ // struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg);
+ export function NetworkUpdate_channel_update_message(msg: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.NetGraphMsgHandler_new(encodeArray(genesis_hash), chain_access, logger);
+ const nativeResponseValue = wasm.NetworkUpdate_channel_update_message(msg);
return nativeResponseValue;
}
- // MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_from_net_graph(struct LDKAccess *chain_access, struct LDKLogger logger, struct LDKNetworkGraph network_graph);
- export function NetGraphMsgHandler_from_net_graph(chain_access: number, logger: number, network_graph: number): number {
+ // struct LDKNetworkUpdate NetworkUpdate_channel_closed(uint64_t short_channel_id, bool is_permanent);
+ export function NetworkUpdate_channel_closed(short_channel_id: number, is_permanent: boolean): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.NetGraphMsgHandler_from_net_graph(chain_access, logger, network_graph);
+ const nativeResponseValue = wasm.NetworkUpdate_channel_closed(short_channel_id, is_permanent);
return nativeResponseValue;
}
- // void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKAccess *chain_access);
- export function NetGraphMsgHandler_add_chain_access(this_arg: number, chain_access: number): void {
+ // struct LDKNetworkUpdate NetworkUpdate_node_failure(struct LDKPublicKey node_id, bool is_permanent);
+ export function NetworkUpdate_node_failure(node_id: Uint8Array, is_permanent: boolean): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.NetGraphMsgHandler_add_chain_access(this_arg, chain_access);
+ const nativeResponseValue = wasm.NetworkUpdate_node_failure(encodeArray(node_id), is_permanent);
+ return nativeResponseValue;
+ }
+ // struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PTR obj);
+ export function NetworkUpdate_write(obj: number): Uint8Array {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.NetworkUpdate_write(obj);
+ return decodeArray(nativeResponseValue);
+ }
+ // struct LDKEventHandler NetGraphMsgHandler_as_EventHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
+ export function NetGraphMsgHandler_as_EventHandler(this_arg: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.NetGraphMsgHandler_as_EventHandler(this_arg);
+ return nativeResponseValue;
+ }
+ // void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj);
+ export function NetGraphMsgHandler_free(this_obj: number): void {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.NetGraphMsgHandler_free(this_obj);
// debug statements here
}
- // MUST_USE_RES struct LDKLockedNetworkGraph NetGraphMsgHandler_read_locked_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
- export function NetGraphMsgHandler_read_locked_graph(this_arg: number): number {
+ // struct LDKNetworkGraph NetGraphMsgHandler_get_network_graph(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_ptr);
+ export function NetGraphMsgHandler_get_network_graph(this_ptr: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.NetGraphMsgHandler_read_locked_graph(this_arg);
+ const nativeResponseValue = wasm.NetGraphMsgHandler_get_network_graph(this_ptr);
return nativeResponseValue;
}
- // MUST_USE_RES struct LDKNetworkGraph LockedNetworkGraph_graph(const struct LDKLockedNetworkGraph *NONNULL_PTR this_arg);
- export function LockedNetworkGraph_graph(this_arg: number): number {
+ // void NetGraphMsgHandler_set_network_graph(struct LDKNetGraphMsgHandler *NONNULL_PTR this_ptr, struct LDKNetworkGraph val);
+ export function NetGraphMsgHandler_set_network_graph(this_ptr: number, val: number): void {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.NetGraphMsgHandler_set_network_graph(this_ptr, val);
+ // debug statements here
+ }
+ // MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(struct LDKNetworkGraph network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger);
+ export function NetGraphMsgHandler_new(network_graph: number, chain_access: number, logger: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.LockedNetworkGraph_graph(this_arg);
+ const nativeResponseValue = wasm.NetGraphMsgHandler_new(network_graph, chain_access, logger);
return nativeResponseValue;
}
+ // void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access);
+ export function NetGraphMsgHandler_add_chain_access(this_arg: number, chain_access: number): void {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.NetGraphMsgHandler_add_chain_access(this_arg, chain_access);
+ // debug statements here
+ }
// struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg);
export function NetGraphMsgHandler_as_RoutingMessageHandler(this_arg: number): number {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.RoutingFees_clone(orig);
return nativeResponseValue;
}
+ // uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o);
+ export function RoutingFees_hash(o: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.RoutingFees_hash(o);
+ return nativeResponseValue;
+ }
// struct LDKCVec_u8Z RoutingFees_write(const struct LDKRoutingFees *NONNULL_PTR obj);
export function RoutingFees_write(obj: number): Uint8Array {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.NetworkGraph_new(encodeArray(genesis_hash));
return nativeResponseValue;
}
- // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
+ // MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg);
+ export function NetworkGraph_read_only(this_arg: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.NetworkGraph_read_only(this_arg);
+ return nativeResponseValue;
+ }
+ // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
export function NetworkGraph_update_node_from_announcement(this_arg: number, msg: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
const nativeResponseValue = wasm.NetworkGraph_update_node_from_announcement(this_arg, msg);
return nativeResponseValue;
}
- // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
+ // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR msg);
export function NetworkGraph_update_node_from_unsigned_announcement(this_arg: number, msg: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
const nativeResponseValue = wasm.NetworkGraph_update_node_from_unsigned_announcement(this_arg, msg);
return nativeResponseValue;
}
- // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKAccess *chain_access);
+ // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_AccessZ chain_access);
export function NetworkGraph_update_channel_from_announcement(this_arg: number, msg: number, chain_access: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
const nativeResponseValue = wasm.NetworkGraph_update_channel_from_announcement(this_arg, msg, chain_access);
return nativeResponseValue;
}
- // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKAccess *chain_access);
+ // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_AccessZ chain_access);
export function NetworkGraph_update_channel_from_unsigned_announcement(this_arg: number, msg: number, chain_access: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
const nativeResponseValue = wasm.NetworkGraph_update_channel_from_unsigned_announcement(this_arg, msg, chain_access);
return nativeResponseValue;
}
- // void NetworkGraph_close_channel_from_update(struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
+ // void NetworkGraph_close_channel_from_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
export function NetworkGraph_close_channel_from_update(this_arg: number, short_channel_id: number, is_permanent: boolean): void {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
const nativeResponseValue = wasm.NetworkGraph_close_channel_from_update(this_arg, short_channel_id, is_permanent);
// debug statements here
}
- // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
+ // void NetworkGraph_fail_node(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent);
+ export function NetworkGraph_fail_node(this_arg: number, _node_id: Uint8Array, is_permanent: boolean): void {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.NetworkGraph_fail_node(this_arg, encodeArray(_node_id), is_permanent);
+ // debug statements here
+ }
+ // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
export function NetworkGraph_update_channel(this_arg: number, msg: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
const nativeResponseValue = wasm.NetworkGraph_update_channel(this_arg, msg);
return nativeResponseValue;
}
- // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
+ // MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg);
export function NetworkGraph_update_channel_unsigned(this_arg: number, msg: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
const nativeResponseValue = wasm.ChannelManagerPersister_free(this_ptr);
// debug statements here
}
- // MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKChannelManagerPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger);
- export function BackgroundProcessor_start(persister: number, event_handler: number, chain_monitor: number, channel_manager: number, peer_manager: number, logger: number): number {
+ // MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKChannelManagerPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, struct LDKNetGraphMsgHandler net_graph_msg_handler, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger);
+ export function BackgroundProcessor_start(persister: number, event_handler: number, chain_monitor: number, channel_manager: number, net_graph_msg_handler: number, peer_manager: number, logger: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.BackgroundProcessor_start(persister, event_handler, chain_monitor, channel_manager, peer_manager, logger);
+ const nativeResponseValue = wasm.BackgroundProcessor_start(persister, event_handler, chain_monitor, channel_manager, net_graph_msg_handler, peer_manager, logger);
return nativeResponseValue;
}
// MUST_USE_RES struct LDKCResult_NoneErrorZ BackgroundProcessor_join(struct LDKBackgroundProcessor this_arg);
const nativeResponseValue = wasm.Currency_signet();
return nativeResponseValue;
}
+ // uint64_t Currency_hash(const enum LDKCurrency *NONNULL_PTR o);
+ export function Currency_hash(o: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.Currency_hash(o);
+ return nativeResponseValue;
+ }
// bool Currency_eq(const enum LDKCurrency *NONNULL_PTR a, const enum LDKCurrency *NONNULL_PTR b);
export function Currency_eq(a: number, b: number): boolean {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.Sha256_free(this_obj);
// debug statements here
}
- // bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
- export function Sha256_eq(a: number, b: number): boolean {
+ // struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
+ export function Sha256_clone(orig: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.Sha256_eq(a, b);
+ const nativeResponseValue = wasm.Sha256_clone(orig);
return nativeResponseValue;
}
- // struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
- export function Sha256_clone(orig: number): number {
+ // uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o);
+ export function Sha256_hash(o: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.Sha256_clone(orig);
+ const nativeResponseValue = wasm.Sha256_hash(o);
+ return nativeResponseValue;
+ }
+ // bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
+ export function Sha256_eq(a: number, b: number): boolean {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.Sha256_eq(a, b);
return nativeResponseValue;
}
// void Description_free(struct LDKDescription this_obj);
const nativeResponseValue = wasm.Description_free(this_obj);
// debug statements here
}
- // bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
- export function Description_eq(a: number, b: number): boolean {
+ // struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
+ export function Description_clone(orig: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.Description_eq(a, b);
+ const nativeResponseValue = wasm.Description_clone(orig);
return nativeResponseValue;
}
- // struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
- export function Description_clone(orig: number): number {
+ // uint64_t Description_hash(const struct LDKDescription *NONNULL_PTR o);
+ export function Description_hash(o: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.Description_clone(orig);
+ const nativeResponseValue = wasm.Description_hash(o);
+ return nativeResponseValue;
+ }
+ // bool Description_eq(const struct LDKDescription *NONNULL_PTR a, const struct LDKDescription *NONNULL_PTR b);
+ export function Description_eq(a: number, b: number): boolean {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.Description_eq(a, b);
return nativeResponseValue;
}
// void PayeePubKey_free(struct LDKPayeePubKey this_obj);
const nativeResponseValue = wasm.PayeePubKey_free(this_obj);
// debug statements here
}
- // bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
- export function PayeePubKey_eq(a: number, b: number): boolean {
+ // struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
+ export function PayeePubKey_clone(orig: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.PayeePubKey_eq(a, b);
+ const nativeResponseValue = wasm.PayeePubKey_clone(orig);
return nativeResponseValue;
}
- // struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
- export function PayeePubKey_clone(orig: number): number {
+ // uint64_t PayeePubKey_hash(const struct LDKPayeePubKey *NONNULL_PTR o);
+ export function PayeePubKey_hash(o: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.PayeePubKey_clone(orig);
+ const nativeResponseValue = wasm.PayeePubKey_hash(o);
+ return nativeResponseValue;
+ }
+ // bool PayeePubKey_eq(const struct LDKPayeePubKey *NONNULL_PTR a, const struct LDKPayeePubKey *NONNULL_PTR b);
+ export function PayeePubKey_eq(a: number, b: number): boolean {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.PayeePubKey_eq(a, b);
return nativeResponseValue;
}
// void ExpiryTime_free(struct LDKExpiryTime this_obj);
const nativeResponseValue = wasm.ExpiryTime_free(this_obj);
// debug statements here
}
- // bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
- export function ExpiryTime_eq(a: number, b: number): boolean {
+ // struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
+ export function ExpiryTime_clone(orig: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.ExpiryTime_eq(a, b);
+ const nativeResponseValue = wasm.ExpiryTime_clone(orig);
return nativeResponseValue;
}
- // struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
- export function ExpiryTime_clone(orig: number): number {
+ // uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o);
+ export function ExpiryTime_hash(o: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.ExpiryTime_clone(orig);
+ const nativeResponseValue = wasm.ExpiryTime_hash(o);
+ return nativeResponseValue;
+ }
+ // bool ExpiryTime_eq(const struct LDKExpiryTime *NONNULL_PTR a, const struct LDKExpiryTime *NONNULL_PTR b);
+ export function ExpiryTime_eq(a: number, b: number): boolean {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.ExpiryTime_eq(a, b);
return nativeResponseValue;
}
// void MinFinalCltvExpiry_free(struct LDKMinFinalCltvExpiry this_obj);
const nativeResponseValue = wasm.MinFinalCltvExpiry_free(this_obj);
// debug statements here
}
- // bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b);
- export function MinFinalCltvExpiry_eq(a: number, b: number): boolean {
+ // struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
+ export function MinFinalCltvExpiry_clone(orig: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.MinFinalCltvExpiry_eq(a, b);
+ const nativeResponseValue = wasm.MinFinalCltvExpiry_clone(orig);
return nativeResponseValue;
}
- // struct LDKMinFinalCltvExpiry MinFinalCltvExpiry_clone(const struct LDKMinFinalCltvExpiry *NONNULL_PTR orig);
- export function MinFinalCltvExpiry_clone(orig: number): number {
+ // uint64_t MinFinalCltvExpiry_hash(const struct LDKMinFinalCltvExpiry *NONNULL_PTR o);
+ export function MinFinalCltvExpiry_hash(o: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.MinFinalCltvExpiry_clone(orig);
+ const nativeResponseValue = wasm.MinFinalCltvExpiry_hash(o);
+ return nativeResponseValue;
+ }
+ // bool MinFinalCltvExpiry_eq(const struct LDKMinFinalCltvExpiry *NONNULL_PTR a, const struct LDKMinFinalCltvExpiry *NONNULL_PTR b);
+ export function MinFinalCltvExpiry_eq(a: number, b: number): boolean {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.MinFinalCltvExpiry_eq(a, b);
return nativeResponseValue;
}
// void Fallback_free(struct LDKFallback this_ptr);
const nativeResponseValue = wasm.Fallback_script_hash(encodeArray(a));
return nativeResponseValue;
}
+ // uint64_t Fallback_hash(const struct LDKFallback *NONNULL_PTR o);
+ export function Fallback_hash(o: number): number {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.Fallback_hash(o);
+ return nativeResponseValue;
+ }
// bool Fallback_eq(const struct LDKFallback *NONNULL_PTR a, const struct LDKFallback *NONNULL_PTR b);
export function Fallback_eq(a: number, b: number): boolean {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.InvoiceSignature_free(this_obj);
// debug statements here
}
- // bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
- export function InvoiceSignature_eq(a: number, b: number): boolean {
+ // struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
+ export function InvoiceSignature_clone(orig: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.InvoiceSignature_eq(a, b);
+ const nativeResponseValue = wasm.InvoiceSignature_clone(orig);
return nativeResponseValue;
}
- // struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
- export function InvoiceSignature_clone(orig: number): number {
+ // bool InvoiceSignature_eq(const struct LDKInvoiceSignature *NONNULL_PTR a, const struct LDKInvoiceSignature *NONNULL_PTR b);
+ export function InvoiceSignature_eq(a: number, b: number): boolean {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.InvoiceSignature_clone(orig);
+ const nativeResponseValue = wasm.InvoiceSignature_eq(a, b);
return nativeResponseValue;
}
// void PrivateRoute_free(struct LDKPrivateRoute this_obj);
const nativeResponseValue = wasm.PrivateRoute_free(this_obj);
// debug statements here
}
- // bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
- export function PrivateRoute_eq(a: number, b: number): boolean {
+ // struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
+ export function PrivateRoute_clone(orig: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.PrivateRoute_eq(a, b);
+ const nativeResponseValue = wasm.PrivateRoute_clone(orig);
return nativeResponseValue;
}
- // struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
- export function PrivateRoute_clone(orig: number): number {
+ // uint64_t PrivateRoute_hash(const struct LDKPrivateRoute *NONNULL_PTR o);
+ export function PrivateRoute_hash(o: number): number {
if(!isWasmInitialized) {
throw new Error("initializeWasm() must be awaited first!");
}
- const nativeResponseValue = wasm.PrivateRoute_clone(orig);
+ const nativeResponseValue = wasm.PrivateRoute_hash(o);
+ return nativeResponseValue;
+ }
+ // bool PrivateRoute_eq(const struct LDKPrivateRoute *NONNULL_PTR a, const struct LDKPrivateRoute *NONNULL_PTR b);
+ export function PrivateRoute_eq(a: number, b: number): boolean {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.PrivateRoute_eq(a, b);
return nativeResponseValue;
}
// MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
const nativeResponseValue = wasm.SemanticError_multiple_descriptions();
return nativeResponseValue;
}
+ // enum LDKSemanticError SemanticError_no_payment_secret(void);
+ export function SemanticError_no_payment_secret(): SemanticError {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.SemanticError_no_payment_secret();
+ return nativeResponseValue;
+ }
// enum LDKSemanticError SemanticError_multiple_payment_secrets(void);
export function SemanticError_multiple_payment_secrets(): SemanticError {
if(!isWasmInitialized) {
const nativeResponseValue = wasm.SemanticError_invalid_signature();
return nativeResponseValue;
}
+ // enum LDKSemanticError SemanticError_imprecise_amount(void);
+ export function SemanticError_imprecise_amount(): SemanticError {
+ if(!isWasmInitialized) {
+ throw new Error("initializeWasm() must be awaited first!");
+ }
+ const nativeResponseValue = wasm.SemanticError_imprecise_amount();
+ return nativeResponseValue;
+ }
// bool SemanticError_eq(const enum LDKSemanticError *NONNULL_PTR a, const enum LDKSemanticError *NONNULL_PTR b);
export function SemanticError_eq(a: number, b: number): boolean {
if(!isWasmInitialized) {
LDKSemanticError_MultiplePaymentHashes,
LDKSemanticError_NoDescription,
LDKSemanticError_MultipleDescriptions,
+ LDKSemanticError_NoPaymentSecret,
LDKSemanticError_MultiplePaymentSecrets,
LDKSemanticError_InvalidFeatures,
LDKSemanticError_InvalidRecoveryId,
LDKSemanticError_InvalidSignature,
+ LDKSemanticError_ImpreciseAmount,
}
bindings.BackgroundProcessor_free(this.ptr);
}
}
- public static BackgroundProcessor constructor_start(ChannelManagerPersister persister, EventHandler event_handler, ChainMonitor chain_monitor, ChannelManager channel_manager, PeerManager peer_manager, Logger logger) {
- number ret = bindings.BackgroundProcessor_start(persister == null ? 0 : persister.ptr, event_handler == null ? 0 : event_handler.ptr, chain_monitor == null ? 0 : chain_monitor.ptr & ~1, channel_manager == null ? 0 : channel_manager.ptr & ~1, peer_manager == null ? 0 : peer_manager.ptr & ~1, logger == null ? 0 : logger.ptr);
+ public static BackgroundProcessor constructor_start(ChannelManagerPersister persister, EventHandler event_handler, ChainMonitor chain_monitor, ChannelManager channel_manager, NetGraphMsgHandler net_graph_msg_handler, PeerManager peer_manager, Logger logger) {
+ number ret = bindings.BackgroundProcessor_start(persister == null ? 0 : persister.ptr, event_handler == null ? 0 : event_handler.ptr, chain_monitor == null ? 0 : chain_monitor.ptr & ~1, channel_manager == null ? 0 : channel_manager.ptr & ~1, net_graph_msg_handler == null ? 0 : net_graph_msg_handler.ptr & ~1, peer_manager == null ? 0 : peer_manager.ptr & ~1, logger == null ? 0 : logger.ptr);
const ret_hu_conv: BackgroundProcessor = new BackgroundProcessor(null, ret);
ret_hu_conv.ptrs_to.add(ret_hu_conv);
ret_hu_conv.ptrs_to.add(persister);
ret_hu_conv.ptrs_to.add(event_handler);
ret_hu_conv.ptrs_to.add(chain_monitor);
ret_hu_conv.ptrs_to.add(channel_manager);
+ ret_hu_conv.ptrs_to.add(net_graph_msg_handler);
ret_hu_conv.ptrs_to.add(peer_manager);
ret_hu_conv.ptrs_to.add(logger);
return ret_hu_conv;
--- /dev/null
+
+import CommonBase from './CommonBase';
+import * as bindings from '../bindings' // TODO: figure out location
+
+export default class Balance extends CommonBase {
+ protected constructor(_dummy: object, ptr: number) { super(ptr); }
+ protected finalize() {
+ super.finalize();
+ if (this.ptr != 0) { bindings.Balance_free(this.ptr); }
+ }
+ static constr_from_ptr(ptr: number): Balance {
+ const raw_val: bindings.LDKBalance = bindings.LDKBalance_ref_from_ptr(ptr);
+ if (raw_val instanceof bindings.LDKBalance.ClaimableOnChannelClose) {
+ return new ClaimableOnChannelClose(this.ptr, raw_val);
+ }
+ if (raw_val instanceof bindings.LDKBalance.ClaimableAwaitingConfirmations) {
+ return new ClaimableAwaitingConfirmations(this.ptr, raw_val);
+ }
+ if (raw_val instanceof bindings.LDKBalance.ContentiousClaimable) {
+ return new ContentiousClaimable(this.ptr, raw_val);
+ }
+ if (raw_val instanceof bindings.LDKBalance.MaybeClaimableHTLCAwaitingTimeout) {
+ return new MaybeClaimableHTLCAwaitingTimeout(this.ptr, raw_val);
+ }
+ throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
+ }
+
+}
+export class ClaimableOnChannelClose extends Balance {
+ public claimable_amount_satoshis: number;
+ private constructor(ptr: number, obj: bindings.LDKBalance.ClaimableOnChannelClose) {
+ super(null, ptr);
+ this.claimable_amount_satoshis = obj.claimable_amount_satoshis;
+ }
+}
+export class ClaimableAwaitingConfirmations extends Balance {
+ public claimable_amount_satoshis: number;
+ public confirmation_height: number;
+ private constructor(ptr: number, obj: bindings.LDKBalance.ClaimableAwaitingConfirmations) {
+ super(null, ptr);
+ this.claimable_amount_satoshis = obj.claimable_amount_satoshis;
+ this.confirmation_height = obj.confirmation_height;
+ }
+}
+export class ContentiousClaimable extends Balance {
+ public claimable_amount_satoshis: number;
+ public timeout_height: number;
+ private constructor(ptr: number, obj: bindings.LDKBalance.ContentiousClaimable) {
+ super(null, ptr);
+ this.claimable_amount_satoshis = obj.claimable_amount_satoshis;
+ this.timeout_height = obj.timeout_height;
+ }
+}
+export class MaybeClaimableHTLCAwaitingTimeout extends Balance {
+ public claimable_amount_satoshis: number;
+ public claimable_height: number;
+ private constructor(ptr: number, obj: bindings.LDKBalance.MaybeClaimableHTLCAwaitingTimeout) {
+ super(null, ptr);
+ this.claimable_amount_satoshis = obj.claimable_amount_satoshis;
+ this.claimable_height = obj.claimable_height;
+ }
+}
+ public Balance clone() {
+ number ret = bindings.Balance_clone(this.ptr);
+ Balance ret_hu_conv = Balance.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;
+ }
+
+ public static Balance constructor_claimable_on_channel_close(number claimable_amount_satoshis) {
+ number ret = bindings.Balance_claimable_on_channel_close(claimable_amount_satoshis);
+ Balance ret_hu_conv = Balance.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ public static Balance constructor_claimable_awaiting_confirmations(number claimable_amount_satoshis, number confirmation_height) {
+ number ret = bindings.Balance_claimable_awaiting_confirmations(claimable_amount_satoshis, confirmation_height);
+ Balance ret_hu_conv = Balance.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ public static Balance constructor_contentious_claimable(number claimable_amount_satoshis, number timeout_height) {
+ number ret = bindings.Balance_contentious_claimable(claimable_amount_satoshis, timeout_height);
+ Balance ret_hu_conv = Balance.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ public static Balance constructor_maybe_claimable_htlcawaiting_timeout(number claimable_amount_satoshis, number claimable_height) {
+ number ret = bindings.Balance_maybe_claimable_htlcawaiting_timeout(claimable_amount_satoshis, claimable_height);
+ Balance ret_hu_conv = Balance.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ public boolean eq(Balance b) {
+ boolean ret = bindings.Balance_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
+ this.ptrs_to.add(b);
+ return ret;
+ }
+
+}
return ret;
},
+ validate_holder_commitment (holder_tx: number): number {
+ const holder_tx_hu_conv: HolderCommitmentTransaction = new HolderCommitmentTransaction(null, holder_tx);
+ Result_NoneNoneZ ret = arg.validate_holder_commitment(holder_tx_hu_conv);
+ result: number = ret != null ? ret.ptr : 0;
+ return result;
+ },
+
channel_keys_id (): Uint8Array {
Uint8Array ret = arg.channel_keys_id();
return ret;
return result;
},
+ validate_counterparty_revocation (idx: number, secret: Uint8Array): number {
+ Result_NoneNoneZ ret = arg.validate_counterparty_revocation(idx, secret);
+ result: number = ret != null ? ret.ptr : 0;
+ return result;
+ },
+
sign_holder_commitment_and_htlcs (commitment_tx: number): number {
const commitment_tx_hu_conv: HolderCommitmentTransaction = new HolderCommitmentTransaction(null, commitment_tx);
Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret = arg.sign_holder_commitment_and_htlcs(commitment_tx_hu_conv);
return result;
},
- sign_closing_transaction (closing_tx: Uint8Array): number {
- Result_SignatureNoneZ ret = arg.sign_closing_transaction(closing_tx);
+ sign_closing_transaction (closing_tx: number): number {
+ const closing_tx_hu_conv: ClosingTransaction = new ClosingTransaction(null, closing_tx);
+ Result_SignatureNoneZ ret = arg.sign_closing_transaction(closing_tx_hu_conv);
result: number = ret != null ? ret.ptr : 0;
return result;
},
export interface BaseSignInterface {
get_per_commitment_point(idx: number): Uint8Array;
release_commitment_secret(idx: number): Uint8Array;
+ validate_holder_commitment(holder_tx: HolderCommitmentTransaction): Result_NoneNoneZ;
channel_keys_id(): Uint8Array;
sign_counterparty_commitment(commitment_tx: CommitmentTransaction): Result_C2Tuple_SignatureCVec_SignatureZZNoneZ;
+ validate_counterparty_revocation(idx: number, secret: Uint8Array): Result_NoneNoneZ;
sign_holder_commitment_and_htlcs(commitment_tx: HolderCommitmentTransaction): Result_C2Tuple_SignatureCVec_SignatureZZNoneZ;
sign_justice_revoked_output(justice_tx: Uint8Array, input: number, amount: number, per_commitment_key: Uint8Array): Result_SignatureNoneZ;
sign_justice_revoked_htlc(justice_tx: Uint8Array, input: number, amount: number, per_commitment_key: Uint8Array, htlc: HTLCOutputInCommitment): Result_SignatureNoneZ;
sign_counterparty_htlc_transaction(htlc_tx: Uint8Array, input: number, amount: number, per_commitment_point: Uint8Array, htlc: HTLCOutputInCommitment): Result_SignatureNoneZ;
- sign_closing_transaction(closing_tx: Uint8Array): Result_SignatureNoneZ;
+ sign_closing_transaction(closing_tx: ClosingTransaction): Result_SignatureNoneZ;
sign_channel_announcement(msg: UnsignedChannelAnnouncement): Result_SignatureNoneZ;
ready_channel(channel_parameters: ChannelTransactionParameters): void;
return ret;
}
+ public Result_NoneNoneZ validate_holder_commitment(HolderCommitmentTransaction holder_tx) {
+ number ret = bindings.BaseSign_validate_holder_commitment(this.ptr, holder_tx == null ? 0 : holder_tx.ptr & ~1);
+ Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
+ this.ptrs_to.add(holder_tx);
+ return ret_hu_conv;
+ }
+
public Uint8Array channel_keys_id() {
Uint8Array ret = bindings.BaseSign_channel_keys_id(this.ptr);
return ret;
return ret_hu_conv;
}
+ public Result_NoneNoneZ validate_counterparty_revocation(number idx, Uint8Array secret) {
+ number ret = bindings.BaseSign_validate_counterparty_revocation(this.ptr, idx, secret);
+ Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
+ return ret_hu_conv;
+ }
+
public Result_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs(HolderCommitmentTransaction commitment_tx) {
number ret = bindings.BaseSign_sign_holder_commitment_and_htlcs(this.ptr, commitment_tx == null ? 0 : commitment_tx.ptr & ~1);
Result_C2Tuple_SignatureCVec_SignatureZZNoneZ ret_hu_conv = Result_C2Tuple_SignatureCVec_SignatureZZNoneZ.constr_from_ptr(ret);
return ret_hu_conv;
}
- public Result_SignatureNoneZ sign_closing_transaction(Uint8Array closing_tx) {
- number ret = bindings.BaseSign_sign_closing_transaction(this.ptr, closing_tx);
+ public Result_SignatureNoneZ sign_closing_transaction(ClosingTransaction closing_tx) {
+ number ret = bindings.BaseSign_sign_closing_transaction(this.ptr, closing_tx == null ? 0 : closing_tx.ptr & ~1);
Result_SignatureNoneZ ret_hu_conv = Result_SignatureNoneZ.constr_from_ptr(ret);
+ this.ptrs_to.add(closing_tx);
return ret_hu_conv;
}
bindings.ChainMonitor_free(this.ptr);
}
}
- public static ChainMonitor constructor_new(Filter chain_source, BroadcasterInterface broadcaster, Logger logger, FeeEstimator feeest, Persist persister) {
- number ret = bindings.ChainMonitor_new(chain_source == null ? 0 : chain_source.ptr, broadcaster == null ? 0 : broadcaster.ptr, logger == null ? 0 : logger.ptr, feeest == null ? 0 : feeest.ptr, persister == null ? 0 : persister.ptr);
+ public static ChainMonitor constructor_new(Option_FilterZ chain_source, BroadcasterInterface broadcaster, Logger logger, FeeEstimator feeest, Persist persister) {
+ number ret = bindings.ChainMonitor_new(chain_source.ptr, broadcaster == null ? 0 : broadcaster.ptr, logger == null ? 0 : logger.ptr, feeest == null ? 0 : feeest.ptr, persister == null ? 0 : persister.ptr);
const ret_hu_conv: ChainMonitor = new ChainMonitor(null, ret);
ret_hu_conv.ptrs_to.add(ret_hu_conv);
- ret_hu_conv.ptrs_to.add(chain_source);
ret_hu_conv.ptrs_to.add(broadcaster);
ret_hu_conv.ptrs_to.add(logger);
ret_hu_conv.ptrs_to.add(feeest);
return ret_hu_conv;
}
+ public Balance[] get_claimable_balances(ChannelDetails[] ignored_channels) {
+ number[] ret = bindings.ChainMonitor_get_claimable_balances(this.ptr, ignored_channels != null ? Arrays.stream(ignored_channels).map(ignored_channels_conv_16 -> ignored_channels_conv_16 == null ? 0 : ignored_channels_conv_16.ptr & ~1).toArray(number[]::new) : null);
+ Balance[] ret_conv_9_arr = new Balance[ret.length];
+ for (int j = 0; j < ret.length; j++) {
+ number ret_conv_9 = ret[j];
+ Balance ret_conv_9_hu_conv = Balance.constr_from_ptr(ret_conv_9);
+ ret_conv_9_hu_conv.ptrs_to.add(this);
+ ret_conv_9_arr[j] = ret_conv_9_hu_conv;
+ }
+ for (ChannelDetails ignored_channels_conv_16: ignored_channels) { this.ptrs_to.add(ignored_channels_conv_16); };
+ return ret_conv_9_arr;
+ }
+
public Listen as_Listen() {
number ret = bindings.ChainMonitor_as_Listen(this.ptr);
Listen ret_hu_conv = new Listen(null, ret);
bindings.ChannelCounterparty_set_unspendable_punishment_reserve(this.ptr, val);
}
+ public CounterpartyForwardingInfo get_forwarding_info() {
+ number ret = bindings.ChannelCounterparty_get_forwarding_info(this.ptr);
+ const ret_hu_conv: CounterpartyForwardingInfo = new CounterpartyForwardingInfo(null, ret);
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;
+ }
+
+ public void set_forwarding_info(CounterpartyForwardingInfo val) {
+ bindings.ChannelCounterparty_set_forwarding_info(this.ptr, val == null ? 0 : val.ptr & ~1);
+ this.ptrs_to.add(val);
+ }
+
+ public static ChannelCounterparty constructor_new(Uint8Array node_id_arg, InitFeatures features_arg, number unspendable_punishment_reserve_arg, CounterpartyForwardingInfo forwarding_info_arg) {
+ number ret = bindings.ChannelCounterparty_new(node_id_arg, features_arg == null ? 0 : features_arg.ptr & ~1, unspendable_punishment_reserve_arg, forwarding_info_arg == null ? 0 : forwarding_info_arg.ptr & ~1);
+ const ret_hu_conv: ChannelCounterparty = new ChannelCounterparty(null, ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ ret_hu_conv.ptrs_to.add(features_arg);
+ ret_hu_conv.ptrs_to.add(forwarding_info_arg);
+ return ret_hu_conv;
+ }
+
public ChannelCounterparty clone() {
number ret = bindings.ChannelCounterparty_clone(this.ptr);
const ret_hu_conv: ChannelCounterparty = new ChannelCounterparty(null, ret);
return ret_hu_conv;
}
+ public boolean requires_unknown_bits() {
+ boolean ret = bindings.ChannelFeatures_requires_unknown_bits(this.ptr);
+ return ret;
+ }
+
public Uint8Array write() {
Uint8Array ret = bindings.ChannelFeatures_write(this.ptr);
return ret;
public void broadcast_node_announcement(Uint8Array rgb, Uint8Array alias, NetAddress[] addresses) {
bindings.ChannelManager_broadcast_node_announcement(this.ptr, rgb, alias, addresses != null ? Arrays.stream(addresses).map(addresses_conv_12 -> addresses_conv_12.ptr).toArray(number[]::new) : null);
- /* TODO 2 NetAddress */;
}
public void process_pending_htlc_forwards() {
ret_hu_conv.ptrs_to.add(tx_broadcaster);
ret_hu_conv.ptrs_to.add(logger);
ret_hu_conv.ptrs_to.add(default_config);
- /* TODO 2 ChannelMonitor */;
+ for (ChannelMonitor channel_monitors_conv_16: channel_monitors) { ret_hu_conv.ptrs_to.add(channel_monitors_conv_16); };
return ret_hu_conv;
}
// Warning: We may not free the C tuple object!
ret_conv_49_arr[x] = ret_conv_49_conv;
}
- /* TODO 2 TwoTuple<Number, Uint8Array> */;
this.ptrs_to.add(broadcaster);
this.ptrs_to.add(fee_estimator);
this.ptrs_to.add(logger);
// Warning: We may not free the C tuple object!
ret_conv_49_arr[x] = ret_conv_49_conv;
}
- /* TODO 2 TwoTuple<Number, Uint8Array> */;
this.ptrs_to.add(broadcaster);
this.ptrs_to.add(fee_estimator);
this.ptrs_to.add(logger);
return ret_hu_conv;
}
+ public Balance[] get_claimable_balances() {
+ number[] ret = bindings.ChannelMonitor_get_claimable_balances(this.ptr);
+ Balance[] ret_conv_9_arr = new Balance[ret.length];
+ for (int j = 0; j < ret.length; j++) {
+ number ret_conv_9 = ret[j];
+ Balance ret_conv_9_hu_conv = Balance.constr_from_ptr(ret_conv_9);
+ ret_conv_9_hu_conv.ptrs_to.add(this);
+ ret_conv_9_arr[j] = ret_conv_9_hu_conv;
+ }
+ return ret_conv_9_arr;
+ }
+
}
--- /dev/null
+
+
+import CommonBase from './CommonBase';
+import * as bindings from '../bindings' // TODO: figure out location
+
+
+
+ export default class ClosingTransaction extends CommonBase {
+ constructor(_dummy: object, ptr: number) {
+ super(ptr);
+ }
+
+
+ protected finalize() {
+ super.finalize();
+
+ if (this.ptr != 0) {
+ bindings.ClosingTransaction_free(this.ptr);
+ }
+ }
+ public static ClosingTransaction constructor_new(number to_holder_value_sat, number to_counterparty_value_sat, Uint8Array to_holder_script, Uint8Array to_counterparty_script, OutPoint funding_outpoint) {
+ number ret = bindings.ClosingTransaction_new(to_holder_value_sat, to_counterparty_value_sat, to_holder_script, to_counterparty_script, funding_outpoint == null ? 0 : funding_outpoint.ptr & ~1);
+ const ret_hu_conv: ClosingTransaction = new ClosingTransaction(null, ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ ret_hu_conv.ptrs_to.add(funding_outpoint);
+ return ret_hu_conv;
+ }
+
+ public TrustedClosingTransaction trust() {
+ number ret = bindings.ClosingTransaction_trust(this.ptr);
+ const ret_hu_conv: TrustedClosingTransaction = new TrustedClosingTransaction(null, ret);
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;
+ }
+
+ public Result_TrustedClosingTransactionNoneZ verify(OutPoint funding_outpoint) {
+ number ret = bindings.ClosingTransaction_verify(this.ptr, funding_outpoint == null ? 0 : funding_outpoint.ptr & ~1);
+ Result_TrustedClosingTransactionNoneZ ret_hu_conv = Result_TrustedClosingTransactionNoneZ.constr_from_ptr(ret);
+ this.ptrs_to.add(funding_outpoint);
+ return ret_hu_conv;
+ }
+
+ public number to_holder_value_sat() {
+ number ret = bindings.ClosingTransaction_to_holder_value_sat(this.ptr);
+ return ret;
+ }
+
+ public number to_counterparty_value_sat() {
+ number ret = bindings.ClosingTransaction_to_counterparty_value_sat(this.ptr);
+ return ret;
+ }
+
+ public Uint8Array to_holder_script() {
+ Uint8Array ret = bindings.ClosingTransaction_to_holder_script(this.ptr);
+ return ret;
+ }
+
+ public Uint8Array to_counterparty_script() {
+ Uint8Array ret = bindings.ClosingTransaction_to_counterparty_script(this.ptr);
+ return ret;
+ }
+
+}
--- /dev/null
+
+import CommonBase from './CommonBase';
+import * as bindings from '../bindings' // TODO: figure out location
+
+export default class ClosureReason extends CommonBase {
+ protected constructor(_dummy: object, ptr: number) { super(ptr); }
+ protected finalize() {
+ super.finalize();
+ if (this.ptr != 0) { bindings.ClosureReason_free(this.ptr); }
+ }
+ static constr_from_ptr(ptr: number): ClosureReason {
+ const raw_val: bindings.LDKClosureReason = bindings.LDKClosureReason_ref_from_ptr(ptr);
+ if (raw_val instanceof bindings.LDKClosureReason.CounterpartyForceClosed) {
+ return new CounterpartyForceClosed(this.ptr, raw_val);
+ }
+ if (raw_val instanceof bindings.LDKClosureReason.HolderForceClosed) {
+ return new HolderForceClosed(this.ptr, raw_val);
+ }
+ if (raw_val instanceof bindings.LDKClosureReason.CooperativeClosure) {
+ return new CooperativeClosure(this.ptr, raw_val);
+ }
+ if (raw_val instanceof bindings.LDKClosureReason.CommitmentTxConfirmed) {
+ return new CommitmentTxConfirmed(this.ptr, raw_val);
+ }
+ if (raw_val instanceof bindings.LDKClosureReason.ProcessingError) {
+ return new ProcessingError(this.ptr, raw_val);
+ }
+ if (raw_val instanceof bindings.LDKClosureReason.DisconnectedPeer) {
+ return new DisconnectedPeer(this.ptr, raw_val);
+ }
+ if (raw_val instanceof bindings.LDKClosureReason.OutdatedChannelManager) {
+ return new OutdatedChannelManager(this.ptr, raw_val);
+ }
+ throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
+ }
+
+}
+export class CounterpartyForceClosed extends ClosureReason {
+ public peer_msg: String;
+ private constructor(ptr: number, obj: bindings.LDKClosureReason.CounterpartyForceClosed) {
+ super(null, ptr);
+ this.peer_msg = obj.peer_msg;
+ }
+}
+export class HolderForceClosed extends ClosureReason {
+ private constructor(ptr: number, obj: bindings.LDKClosureReason.HolderForceClosed) {
+ super(null, ptr);
+ }
+}
+export class CooperativeClosure extends ClosureReason {
+ private constructor(ptr: number, obj: bindings.LDKClosureReason.CooperativeClosure) {
+ super(null, ptr);
+ }
+}
+export class CommitmentTxConfirmed extends ClosureReason {
+ private constructor(ptr: number, obj: bindings.LDKClosureReason.CommitmentTxConfirmed) {
+ super(null, ptr);
+ }
+}
+export class ProcessingError extends ClosureReason {
+ public err: String;
+ private constructor(ptr: number, obj: bindings.LDKClosureReason.ProcessingError) {
+ super(null, ptr);
+ this.err = obj.err;
+ }
+}
+export class DisconnectedPeer extends ClosureReason {
+ private constructor(ptr: number, obj: bindings.LDKClosureReason.DisconnectedPeer) {
+ super(null, ptr);
+ }
+}
+export class OutdatedChannelManager extends ClosureReason {
+ private constructor(ptr: number, obj: bindings.LDKClosureReason.OutdatedChannelManager) {
+ super(null, ptr);
+ }
+}
+ public ClosureReason clone() {
+ number ret = bindings.ClosureReason_clone(this.ptr);
+ ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;
+ }
+
+ public static ClosureReason constructor_counterparty_force_closed(String peer_msg) {
+ number ret = bindings.ClosureReason_counterparty_force_closed(peer_msg);
+ ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ public static ClosureReason constructor_holder_force_closed() {
+ number ret = bindings.ClosureReason_holder_force_closed();
+ ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ public static ClosureReason constructor_cooperative_closure() {
+ number ret = bindings.ClosureReason_cooperative_closure();
+ ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ public static ClosureReason constructor_commitment_tx_confirmed() {
+ number ret = bindings.ClosureReason_commitment_tx_confirmed();
+ ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ public static ClosureReason constructor_processing_error(String err) {
+ number ret = bindings.ClosureReason_processing_error(err);
+ ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ public static ClosureReason constructor_disconnected_peer() {
+ number ret = bindings.ClosureReason_disconnected_peer();
+ ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ public static ClosureReason constructor_outdated_channel_manager() {
+ number ret = bindings.ClosureReason_outdated_channel_manager();
+ ClosureReason ret_hu_conv = ClosureReason.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ public Uint8Array write() {
+ Uint8Array ret = bindings.ClosureReason_write(this.ptr);
+ return ret;
+ }
+
+}
bindings.CommitmentUpdate_free(this.ptr);
}
}
+ public UpdateAddHTLC[] get_update_add_htlcs() {
+ number[] ret = bindings.CommitmentUpdate_get_update_add_htlcs(this.ptr);
+ UpdateAddHTLC[] ret_conv_15_arr = new UpdateAddHTLC[ret.length];
+ for (int p = 0; p < ret.length; p++) {
+ number ret_conv_15 = ret[p];
+ const ret_conv_15_hu_conv: UpdateAddHTLC = new UpdateAddHTLC(null, ret_conv_15);
+ ret_conv_15_hu_conv.ptrs_to.add(this);
+ ret_conv_15_arr[p] = ret_conv_15_hu_conv;
+ }
+ return ret_conv_15_arr;
+ }
+
public void set_update_add_htlcs(UpdateAddHTLC[] val) {
bindings.CommitmentUpdate_set_update_add_htlcs(this.ptr, val != null ? Arrays.stream(val).map(val_conv_15 -> val_conv_15 == null ? 0 : val_conv_15.ptr & ~1).toArray(number[]::new) : null);
- /* TODO 2 UpdateAddHTLC */;
+ for (UpdateAddHTLC val_conv_15: val) { this.ptrs_to.add(val_conv_15); };
+ }
+
+ public UpdateFulfillHTLC[] get_update_fulfill_htlcs() {
+ number[] ret = bindings.CommitmentUpdate_get_update_fulfill_htlcs(this.ptr);
+ UpdateFulfillHTLC[] ret_conv_19_arr = new UpdateFulfillHTLC[ret.length];
+ for (int t = 0; t < ret.length; t++) {
+ number ret_conv_19 = ret[t];
+ const ret_conv_19_hu_conv: UpdateFulfillHTLC = new UpdateFulfillHTLC(null, ret_conv_19);
+ ret_conv_19_hu_conv.ptrs_to.add(this);
+ ret_conv_19_arr[t] = ret_conv_19_hu_conv;
+ }
+ return ret_conv_19_arr;
}
public void set_update_fulfill_htlcs(UpdateFulfillHTLC[] val) {
bindings.CommitmentUpdate_set_update_fulfill_htlcs(this.ptr, val != null ? Arrays.stream(val).map(val_conv_19 -> val_conv_19 == null ? 0 : val_conv_19.ptr & ~1).toArray(number[]::new) : null);
- /* TODO 2 UpdateFulfillHTLC */;
+ for (UpdateFulfillHTLC val_conv_19: val) { this.ptrs_to.add(val_conv_19); };
+ }
+
+ public UpdateFailHTLC[] get_update_fail_htlcs() {
+ number[] ret = bindings.CommitmentUpdate_get_update_fail_htlcs(this.ptr);
+ UpdateFailHTLC[] ret_conv_16_arr = new UpdateFailHTLC[ret.length];
+ for (int q = 0; q < ret.length; q++) {
+ number ret_conv_16 = ret[q];
+ const ret_conv_16_hu_conv: UpdateFailHTLC = new UpdateFailHTLC(null, ret_conv_16);
+ ret_conv_16_hu_conv.ptrs_to.add(this);
+ ret_conv_16_arr[q] = ret_conv_16_hu_conv;
+ }
+ return ret_conv_16_arr;
}
public void set_update_fail_htlcs(UpdateFailHTLC[] val) {
bindings.CommitmentUpdate_set_update_fail_htlcs(this.ptr, val != null ? Arrays.stream(val).map(val_conv_16 -> val_conv_16 == null ? 0 : val_conv_16.ptr & ~1).toArray(number[]::new) : null);
- /* TODO 2 UpdateFailHTLC */;
+ for (UpdateFailHTLC val_conv_16: val) { this.ptrs_to.add(val_conv_16); };
+ }
+
+ public UpdateFailMalformedHTLC[] get_update_fail_malformed_htlcs() {
+ number[] ret = bindings.CommitmentUpdate_get_update_fail_malformed_htlcs(this.ptr);
+ UpdateFailMalformedHTLC[] ret_conv_25_arr = new UpdateFailMalformedHTLC[ret.length];
+ for (int z = 0; z < ret.length; z++) {
+ number ret_conv_25 = ret[z];
+ const ret_conv_25_hu_conv: UpdateFailMalformedHTLC = new UpdateFailMalformedHTLC(null, ret_conv_25);
+ ret_conv_25_hu_conv.ptrs_to.add(this);
+ ret_conv_25_arr[z] = ret_conv_25_hu_conv;
+ }
+ return ret_conv_25_arr;
}
public void set_update_fail_malformed_htlcs(UpdateFailMalformedHTLC[] val) {
bindings.CommitmentUpdate_set_update_fail_malformed_htlcs(this.ptr, val != null ? Arrays.stream(val).map(val_conv_25 -> val_conv_25 == null ? 0 : val_conv_25.ptr & ~1).toArray(number[]::new) : null);
- /* TODO 2 UpdateFailMalformedHTLC */;
+ for (UpdateFailMalformedHTLC val_conv_25: val) { this.ptrs_to.add(val_conv_25); };
}
public UpdateFee get_update_fee() {
number ret = bindings.CommitmentUpdate_new(update_add_htlcs_arg != null ? Arrays.stream(update_add_htlcs_arg).map(update_add_htlcs_arg_conv_15 -> update_add_htlcs_arg_conv_15 == null ? 0 : update_add_htlcs_arg_conv_15.ptr & ~1).toArray(number[]::new) : null, update_fulfill_htlcs_arg != null ? Arrays.stream(update_fulfill_htlcs_arg).map(update_fulfill_htlcs_arg_conv_19 -> update_fulfill_htlcs_arg_conv_19 == null ? 0 : update_fulfill_htlcs_arg_conv_19.ptr & ~1).toArray(number[]::new) : null, update_fail_htlcs_arg != null ? Arrays.stream(update_fail_htlcs_arg).map(update_fail_htlcs_arg_conv_16 -> update_fail_htlcs_arg_conv_16 == null ? 0 : update_fail_htlcs_arg_conv_16.ptr & ~1).toArray(number[]::new) : null, update_fail_malformed_htlcs_arg != null ? Arrays.stream(update_fail_malformed_htlcs_arg).map(update_fail_malformed_htlcs_arg_conv_25 -> update_fail_malformed_htlcs_arg_conv_25 == null ? 0 : update_fail_malformed_htlcs_arg_conv_25.ptr & ~1).toArray(number[]::new) : null, update_fee_arg == null ? 0 : update_fee_arg.ptr & ~1, commitment_signed_arg == null ? 0 : commitment_signed_arg.ptr & ~1);
const ret_hu_conv: CommitmentUpdate = new CommitmentUpdate(null, ret);
ret_hu_conv.ptrs_to.add(ret_hu_conv);
- /* TODO 2 UpdateAddHTLC */;
- /* TODO 2 UpdateFulfillHTLC */;
- /* TODO 2 UpdateFailHTLC */;
- /* TODO 2 UpdateFailMalformedHTLC */;
+ for (UpdateAddHTLC update_add_htlcs_arg_conv_15: update_add_htlcs_arg) { ret_hu_conv.ptrs_to.add(update_add_htlcs_arg_conv_15); };
+ for (UpdateFulfillHTLC update_fulfill_htlcs_arg_conv_19: update_fulfill_htlcs_arg) { ret_hu_conv.ptrs_to.add(update_fulfill_htlcs_arg_conv_19); };
+ for (UpdateFailHTLC update_fail_htlcs_arg_conv_16: update_fail_htlcs_arg) { ret_hu_conv.ptrs_to.add(update_fail_htlcs_arg_conv_16); };
+ for (UpdateFailMalformedHTLC update_fail_malformed_htlcs_arg_conv_25: update_fail_malformed_htlcs_arg) { ret_hu_conv.ptrs_to.add(update_fail_malformed_htlcs_arg_conv_25); };
ret_hu_conv.ptrs_to.add(update_fee_arg);
ret_hu_conv.ptrs_to.add(commitment_signed_arg);
return ret_hu_conv;
}
public void transactions_confirmed(Uint8Array header, TwoTuple<Number, Uint8Array>[] txdata, number height) {
bindings.Confirm_transactions_confirmed(this.ptr, header, txdata != null ? Arrays.stream(txdata).map(txdata_conv_30 -> bindings.C2Tuple_usizeTransactionZ_new(txdata_conv_30.a, txdata_conv_30.b)).toArray(number[]::new) : null, height);
- /* TODO 2 TwoTuple<Number, Uint8Array> */;
}
public void transaction_unconfirmed(Uint8Array txid) {
--- /dev/null
+
+
+import CommonBase from './CommonBase';
+import * as bindings from '../bindings' // TODO: figure out location
+
+
+
+ export default class CounterpartyForwardingInfo extends CommonBase {
+ constructor(_dummy: object, ptr: number) {
+ super(ptr);
+ }
+
+
+ protected finalize() {
+ super.finalize();
+
+ if (this.ptr != 0) {
+ bindings.CounterpartyForwardingInfo_free(this.ptr);
+ }
+ }
+ public number get_fee_base_msat() {
+ number ret = bindings.CounterpartyForwardingInfo_get_fee_base_msat(this.ptr);
+ return ret;
+ }
+
+ public void set_fee_base_msat(number val) {
+ bindings.CounterpartyForwardingInfo_set_fee_base_msat(this.ptr, val);
+ }
+
+ public number get_fee_proportional_millionths() {
+ number ret = bindings.CounterpartyForwardingInfo_get_fee_proportional_millionths(this.ptr);
+ return ret;
+ }
+
+ public void set_fee_proportional_millionths(number val) {
+ bindings.CounterpartyForwardingInfo_set_fee_proportional_millionths(this.ptr, val);
+ }
+
+ public number get_cltv_expiry_delta() {
+ number ret = bindings.CounterpartyForwardingInfo_get_cltv_expiry_delta(this.ptr);
+ return ret;
+ }
+
+ public void set_cltv_expiry_delta(number val) {
+ bindings.CounterpartyForwardingInfo_set_cltv_expiry_delta(this.ptr, val);
+ }
+
+ public static CounterpartyForwardingInfo constructor_new(number fee_base_msat_arg, number fee_proportional_millionths_arg, number cltv_expiry_delta_arg) {
+ number ret = bindings.CounterpartyForwardingInfo_new(fee_base_msat_arg, fee_proportional_millionths_arg, cltv_expiry_delta_arg);
+ const ret_hu_conv: CounterpartyForwardingInfo = new CounterpartyForwardingInfo(null, ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ public CounterpartyForwardingInfo clone() {
+ number ret = bindings.CounterpartyForwardingInfo_clone(this.ptr);
+ const ret_hu_conv: CounterpartyForwardingInfo = new CounterpartyForwardingInfo(null, ret);
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;
+ }
+
+}
--- /dev/null
+
+
+import CommonBase from './CommonBase';
+import * as bindings from '../bindings' // TODO: figure out location
+
+
+
+ export class CustomMessageHandler extends CommonBase {
+
+ bindings_instance?: bindings.LDKCustomMessageHandler;
+
+ constructor(ptr?: number, arg?: bindings.LDKCustomMessageHandler, customMessageReader?: bindings.LDKCustomMessageReader) {
+ if (Number.isFinite(ptr)) {
+ super(ptr);
+ this.bindings_instance = null;
+ } else {
+ // TODO: private constructor instantiation
+ super(bindings.LDKCustomMessageHandler_new(arg, customMessageReader));
+ this.ptrs_to.push(arg);
+ this.ptrs_to.push(customMessageReader);
+
+ }
+ }
+
+ protected finalize() {
+ if (this.ptr != 0) {
+ bindings.CustomMessageHandler_free(this.ptr);
+ }
+ super.finalize();
+ }
+
+ static new_impl(arg: CustomMessageHandlerInterface, customMessageReader_impl: CustomMessageReader.CustomMessageReaderInterface): CustomMessageHandler {
+ const impl_holder: LDKCustomMessageHandlerHolder = new LDKCustomMessageHandlerHolder();
+ let structImplementation = <bindings.LDKCustomMessageHandler>{
+ // todo: in-line interface filling
+ handle_custom_message (msg: number, sender_node_id: Uint8Array): number {
+ Type ret_hu_conv = new Type(null, msg);
+ ret_hu_conv.ptrs_to.add(this);
+ Result_NoneLightningErrorZ ret = arg.handle_custom_message(ret_hu_conv, sender_node_id);
+ result: number = ret != null ? ret.ptr : 0;
+ return result;
+ },
+
+ get_and_clear_pending_msg (): number[] {
+ TwoTuple<Uint8Array, Type>[] ret = arg.get_and_clear_pending_msg();
+ result: number[] = ret != null ? Arrays.stream(ret).map(ret_conv_28 -> bindings.C2Tuple_PublicKeyTypeZ_new(ret_conv_28.a, ret_conv_28.b == null ? 0 : ret_conv_28.b.ptr)).toArray(number[]::new) : null;
+ for (TwoTuple<Uint8Array, Type> ret_conv_28: ret) { impl_holder.held.ptrs_to.add(ret_conv_28.b); };
+ return result;
+ },
+
+
+ };
+ impl_holder.held = new CustomMessageHandler (null, structImplementation, CustomMessageReader.new_impl(CustomMessageReader_impl).bindings_instance);
+ }
+ }
+
+ export interface CustomMessageHandlerInterface {
+ handle_custom_message(msg: Type, sender_node_id: Uint8Array): Result_NoneLightningErrorZ;
+ get_and_clear_pending_msg(): TwoTuple<Uint8Array, Type>[];
+
+ }
+
+ class LDKCustomMessageHandlerHolder {
+ held: CustomMessageHandler;
+ }
+ public Result_NoneLightningErrorZ handle_custom_message(Type msg, Uint8Array sender_node_id) {
+ number ret = bindings.CustomMessageHandler_handle_custom_message(this.ptr, msg == null ? 0 : msg.ptr, sender_node_id);
+ Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
+ this.ptrs_to.add(msg);
+ return ret_hu_conv;
+ }
+
+ public TwoTuple<Uint8Array, Type>[] get_and_clear_pending_msg() {
+ number[] ret = bindings.CustomMessageHandler_get_and_clear_pending_msg(this.ptr);
+ TwoTuple<Uint8Array, Type>[] ret_conv_28_arr = new TwoTuple[ret.length];
+ for (int c = 0; c < ret.length; c++) {
+ number ret_conv_28 = ret[c];
+ Uint8Array ret_conv_28_a = bindings.LDKC2Tuple_PublicKeyTypeZ_get_a(ret_conv_28);
+ number ret_conv_28_b = bindings.LDKC2Tuple_PublicKeyTypeZ_get_b(ret_conv_28);
+ Type ret_hu_conv = new Type(null, ret_conv_28_b);
+ ret_hu_conv.ptrs_to.add(this);;
+ TwoTuple<Uint8Array, Type> ret_conv_28_conv = new TwoTuple<Uint8Array, Type>(ret_conv_28_a, ret_hu_conv, () -> {
+ bindings.C2Tuple_PublicKeyTypeZ_free(ret_conv_28);
+ });
+ ret_hu_conv.ptrs_to.add(ret_conv_28_conv);
+ ret_conv_28_arr[c] = ret_conv_28_conv;
+ }
+ return ret_conv_28_arr;
+ }
+
+}
--- /dev/null
+
+
+import CommonBase from './CommonBase';
+import * as bindings from '../bindings' // TODO: figure out location
+
+
+
+ export class CustomMessageReader extends CommonBase {
+
+ bindings_instance?: bindings.LDKCustomMessageReader;
+
+ constructor(ptr?: number, arg?: bindings.LDKCustomMessageReader) {
+ if (Number.isFinite(ptr)) {
+ super(ptr);
+ this.bindings_instance = null;
+ } else {
+ // TODO: private constructor instantiation
+ super(bindings.LDKCustomMessageReader_new(arg));
+ this.ptrs_to.push(arg);
+
+ }
+ }
+
+ protected finalize() {
+ if (this.ptr != 0) {
+ bindings.CustomMessageReader_free(this.ptr);
+ }
+ super.finalize();
+ }
+
+ static new_impl(arg: CustomMessageReaderInterface): CustomMessageReader {
+ const impl_holder: LDKCustomMessageReaderHolder = new LDKCustomMessageReaderHolder();
+ let structImplementation = <bindings.LDKCustomMessageReader>{
+ // todo: in-line interface filling
+ read (message_type: number, buffer: Uint8Array): number {
+ Result_COption_TypeZDecodeErrorZ ret = arg.read(message_type, buffer);
+ result: number = ret != null ? ret.ptr : 0;
+ return result;
+ },
+
+
+ };
+ impl_holder.held = new CustomMessageReader (null, structImplementation);
+ }
+ }
+
+ export interface CustomMessageReaderInterface {
+ read(message_type: number, buffer: Uint8Array): Result_COption_TypeZDecodeErrorZ;
+
+ }
+
+ class LDKCustomMessageReaderHolder {
+ held: CustomMessageReader;
+ }
+ public Result_COption_TypeZDecodeErrorZ read(number message_type, Uint8Array buffer) {
+ number ret = bindings.CustomMessageReader_read(this.ptr, message_type, buffer);
+ Result_COption_TypeZDecodeErrorZ ret_hu_conv = Result_COption_TypeZDecodeErrorZ.constr_from_ptr(ret);
+ return ret_hu_conv;
+ }
+
+}
bindings.Description_free(this.ptr);
}
}
- public boolean eq(Description b) {
- boolean ret = bindings.Description_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
- this.ptrs_to.add(b);
- return ret;
- }
-
public Description clone() {
number ret = bindings.Description_clone(this.ptr);
const ret_hu_conv: Description = new Description(null, ret);
return ret_hu_conv;
}
+ public number hash() {
+ number ret = bindings.Description_hash(this.ptr);
+ return ret;
+ }
+
+ public boolean eq(Description b) {
+ boolean ret = bindings.Description_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
+ this.ptrs_to.add(b);
+ return ret;
+ }
+
public static Result_DescriptionCreationErrorZ constructor_new(String description) {
number ret = bindings.Description_new(description);
Result_DescriptionCreationErrorZ ret_hu_conv = Result_DescriptionCreationErrorZ.constr_from_ptr(ret);
if (raw_val instanceof bindings.LDKEvent.PaymentSent) {
return new PaymentSent(this.ptr, raw_val);
}
- if (raw_val instanceof bindings.LDKEvent.PaymentFailed) {
- return new PaymentFailed(this.ptr, raw_val);
+ if (raw_val instanceof bindings.LDKEvent.PaymentPathFailed) {
+ return new PaymentPathFailed(this.ptr, raw_val);
}
if (raw_val instanceof bindings.LDKEvent.PendingHTLCsForwardable) {
return new PendingHTLCsForwardable(this.ptr, raw_val);
if (raw_val instanceof bindings.LDKEvent.PaymentForwarded) {
return new PaymentForwarded(this.ptr, raw_val);
}
+ if (raw_val instanceof bindings.LDKEvent.ChannelClosed) {
+ return new ChannelClosed(this.ptr, raw_val);
+ }
throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
}
this.payment_preimage = obj.payment_preimage;
}
}
-export class PaymentFailed extends Event {
+export class PaymentPathFailed extends Event {
public payment_hash: Uint8Array;
public rejected_by_dest: boolean;
- private constructor(ptr: number, obj: bindings.LDKEvent.PaymentFailed) {
+ public network_update: Option_NetworkUpdateZ;
+ public all_paths_failed: boolean;
+ public path: RouteHop[];
+ private constructor(ptr: number, obj: bindings.LDKEvent.PaymentPathFailed) {
super(null, ptr);
this.payment_hash = obj.payment_hash;
this.rejected_by_dest = obj.rejected_by_dest;
+ const network_update: number = obj.network_update;
+ Option_NetworkUpdateZ network_update_hu_conv = Option_NetworkUpdateZ.constr_from_ptr(network_update);
+ network_update_hu_conv.ptrs_to.add(this);
+ this.network_update = network_update_hu_conv;
+ this.all_paths_failed = obj.all_paths_failed;
+ const path: number[] = obj.path;
+ RouteHop[] path_conv_10_arr = new RouteHop[path.length];
+ for (int k = 0; k < path.length; k++) {
+ number path_conv_10 = path[k];
+ const path_conv_10_hu_conv: RouteHop = new RouteHop(null, path_conv_10);
+ path_conv_10_hu_conv.ptrs_to.add(this);
+ path_conv_10_arr[k] = path_conv_10_hu_conv;
+ }
+ this.path = path_conv_10_arr;
}
}
export class PendingHTLCsForwardable extends Event {
this.fee_earned_msat = fee_earned_msat_hu_conv;
this.claim_from_onchain_tx = obj.claim_from_onchain_tx;
}
+}
+export class ChannelClosed extends Event {
+ public channel_id: Uint8Array;
+ public reason: ClosureReason;
+ private constructor(ptr: number, obj: bindings.LDKEvent.ChannelClosed) {
+ super(null, ptr);
+ this.channel_id = obj.channel_id;
+ const reason: number = obj.reason;
+ ClosureReason reason_hu_conv = ClosureReason.constr_from_ptr(reason);
+ reason_hu_conv.ptrs_to.add(this);
+ this.reason = reason_hu_conv;
+ }
}
public Event clone() {
number ret = bindings.Event_clone(this.ptr);
return ret_hu_conv;
}
- public static Event constructor_payment_failed(Uint8Array payment_hash, boolean rejected_by_dest) {
- number ret = bindings.Event_payment_failed(payment_hash, rejected_by_dest);
+ public static Event constructor_payment_path_failed(Uint8Array payment_hash, boolean rejected_by_dest, Option_NetworkUpdateZ network_update, boolean all_paths_failed, RouteHop[] path) {
+ number ret = bindings.Event_payment_path_failed(payment_hash, rejected_by_dest, network_update.ptr, all_paths_failed, path != null ? Arrays.stream(path).map(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr & ~1).toArray(number[]::new) : null);
Event ret_hu_conv = Event.constr_from_ptr(ret);
ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ for (RouteHop path_conv_10: path) { ret_hu_conv.ptrs_to.add(path_conv_10); };
return ret_hu_conv;
}
number ret = bindings.Event_spendable_outputs(outputs != null ? Arrays.stream(outputs).map(outputs_conv_27 -> outputs_conv_27.ptr).toArray(number[]::new) : null);
Event ret_hu_conv = Event.constr_from_ptr(ret);
ret_hu_conv.ptrs_to.add(ret_hu_conv);
- /* TODO 2 SpendableOutputDescriptor */;
return ret_hu_conv;
}
return ret_hu_conv;
}
+ public static Event constructor_channel_closed(Uint8Array channel_id, ClosureReason reason) {
+ number ret = bindings.Event_channel_closed(channel_id, reason.ptr);
+ Event ret_hu_conv = Event.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
public Uint8Array write() {
Uint8Array ret = bindings.Event_write(this.ptr);
return ret;
// todo: in-line interface filling
handle_event (event: number): void {
Event event_hu_conv = Event.constr_from_ptr(event);
- event_hu_conv.ptrs_to.add(this);
arg.handle_event(event_hu_conv);
},
held: EventHandler;
}
public void handle_event(Event event) {
- bindings.EventHandler_handle_event(this.ptr, event.ptr);
+ bindings.EventHandler_handle_event(this.ptr, event == null ? 0 : event.ptr & ~1);
+ this.ptrs_to.add(event);
}
}
bindings.ExpiryTime_free(this.ptr);
}
}
- public boolean eq(ExpiryTime b) {
- boolean ret = bindings.ExpiryTime_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
- this.ptrs_to.add(b);
- return ret;
- }
-
public ExpiryTime clone() {
number ret = bindings.ExpiryTime_clone(this.ptr);
const ret_hu_conv: ExpiryTime = new ExpiryTime(null, ret);
return ret_hu_conv;
}
+ public number hash() {
+ number ret = bindings.ExpiryTime_hash(this.ptr);
+ return ret;
+ }
+
+ public boolean eq(ExpiryTime b) {
+ boolean ret = bindings.ExpiryTime_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
+ this.ptrs_to.add(b);
+ return ret;
+ }
+
public static Result_ExpiryTimeCreationErrorZ constructor_from_seconds(number seconds) {
number ret = bindings.ExpiryTime_from_seconds(seconds);
Result_ExpiryTimeCreationErrorZ ret_hu_conv = Result_ExpiryTimeCreationErrorZ.constr_from_ptr(ret);
return ret_hu_conv;
}
+ public number hash() {
+ number ret = bindings.Fallback_hash(this.ptr);
+ return ret;
+ }
+
public boolean eq(Fallback b) {
boolean ret = bindings.Fallback_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
this.ptrs_to.add(b);
return ret_hu_conv;
}
+ public Uint8Array write() {
+ Uint8Array ret = bindings.GossipTimestampFilter_write(this.ptr);
+ return ret;
+ }
+
public static Result_GossipTimestampFilterDecodeErrorZ constructor_read(Uint8Array ser) {
number ret = bindings.GossipTimestampFilter_read(ser);
Result_GossipTimestampFilterDecodeErrorZ ret_hu_conv = Result_GossipTimestampFilterDecodeErrorZ.constr_from_ptr(ret);
return ret_hu_conv;
}
- public Uint8Array write() {
- Uint8Array ret = bindings.GossipTimestampFilter_write(this.ptr);
- return ret;
- }
-
}
+++ /dev/null
-
-import CommonBase from './CommonBase';
-import * as bindings from '../bindings' // TODO: figure out location
-
-export default class HTLCFailChannelUpdate extends CommonBase {
- protected constructor(_dummy: object, ptr: number) { super(ptr); }
- protected finalize() {
- super.finalize();
- if (this.ptr != 0) { bindings.HTLCFailChannelUpdate_free(this.ptr); }
- }
- static constr_from_ptr(ptr: number): HTLCFailChannelUpdate {
- const raw_val: bindings.LDKHTLCFailChannelUpdate = bindings.LDKHTLCFailChannelUpdate_ref_from_ptr(ptr);
- if (raw_val instanceof bindings.LDKHTLCFailChannelUpdate.ChannelUpdateMessage) {
- return new ChannelUpdateMessage(this.ptr, raw_val);
- }
- if (raw_val instanceof bindings.LDKHTLCFailChannelUpdate.ChannelClosed) {
- return new ChannelClosed(this.ptr, raw_val);
- }
- if (raw_val instanceof bindings.LDKHTLCFailChannelUpdate.NodeFailure) {
- return new NodeFailure(this.ptr, raw_val);
- }
- throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
- }
-
-}
-export class ChannelUpdateMessage extends HTLCFailChannelUpdate {
- public msg: ChannelUpdate;
- private constructor(ptr: number, obj: bindings.LDKHTLCFailChannelUpdate.ChannelUpdateMessage) {
- super(null, ptr);
- const msg: number = obj.msg;
- const msg_hu_conv: ChannelUpdate = new ChannelUpdate(null, msg);
- msg_hu_conv.ptrs_to.add(this);
- this.msg = msg_hu_conv;
- }
-}
-export class ChannelClosed extends HTLCFailChannelUpdate {
- public short_channel_id: number;
- public is_permanent: boolean;
- private constructor(ptr: number, obj: bindings.LDKHTLCFailChannelUpdate.ChannelClosed) {
- super(null, ptr);
- this.short_channel_id = obj.short_channel_id;
- this.is_permanent = obj.is_permanent;
- }
-}
-export class NodeFailure extends HTLCFailChannelUpdate {
- public node_id: Uint8Array;
- public is_permanent: boolean;
- private constructor(ptr: number, obj: bindings.LDKHTLCFailChannelUpdate.NodeFailure) {
- super(null, ptr);
- this.node_id = obj.node_id;
- this.is_permanent = obj.is_permanent;
- }
-}
- public HTLCFailChannelUpdate clone() {
- number ret = bindings.HTLCFailChannelUpdate_clone(this.ptr);
- HTLCFailChannelUpdate ret_hu_conv = HTLCFailChannelUpdate.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(this);
- return ret_hu_conv;
- }
-
- public static HTLCFailChannelUpdate constructor_channel_update_message(ChannelUpdate msg) {
- number ret = bindings.HTLCFailChannelUpdate_channel_update_message(msg == null ? 0 : msg.ptr & ~1);
- HTLCFailChannelUpdate ret_hu_conv = HTLCFailChannelUpdate.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
- ret_hu_conv.ptrs_to.add(msg);
- return ret_hu_conv;
- }
-
- public static HTLCFailChannelUpdate constructor_channel_closed(number short_channel_id, boolean is_permanent) {
- number ret = bindings.HTLCFailChannelUpdate_channel_closed(short_channel_id, is_permanent);
- HTLCFailChannelUpdate ret_hu_conv = HTLCFailChannelUpdate.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
- return ret_hu_conv;
- }
-
- public static HTLCFailChannelUpdate constructor_node_failure(Uint8Array node_id, boolean is_permanent) {
- number ret = bindings.HTLCFailChannelUpdate_node_failure(node_id, is_permanent);
- HTLCFailChannelUpdate ret_hu_conv = HTLCFailChannelUpdate.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
- return ret_hu_conv;
- }
-
-}
return ret_hu_conv;
}
+ public CustomMessageReader as_CustomMessageReader() {
+ number ret = bindings.IgnoringMessageHandler_as_CustomMessageReader(this.ptr);
+ CustomMessageReader ret_hu_conv = new CustomMessageReader(null, ret);
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;
+ }
+
+ public CustomMessageHandler as_CustomMessageHandler() {
+ number ret = bindings.IgnoringMessageHandler_as_CustomMessageHandler(this.ptr);
+ CustomMessageHandler ret_hu_conv = new CustomMessageHandler(null, ret);
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;
+ }
+
}
return ret_hu_conv;
}
+ public boolean requires_unknown_bits() {
+ boolean ret = bindings.InitFeatures_requires_unknown_bits(this.ptr);
+ return ret;
+ }
+
public boolean supports_payment_secret() {
boolean ret = bindings.InitFeatures_supports_payment_secret(this.ptr);
return ret;
return ret_hu_conv;
}
+ public boolean requires_unknown_bits() {
+ boolean ret = bindings.InvoiceFeatures_requires_unknown_bits(this.ptr);
+ return ret;
+ }
+
public boolean supports_payment_secret() {
boolean ret = bindings.InvoiceFeatures_supports_payment_secret(this.ptr);
return ret;
bindings.InvoiceSignature_free(this.ptr);
}
}
- public boolean eq(InvoiceSignature b) {
- boolean ret = bindings.InvoiceSignature_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
- this.ptrs_to.add(b);
- return ret;
- }
-
public InvoiceSignature clone() {
number ret = bindings.InvoiceSignature_clone(this.ptr);
const ret_hu_conv: InvoiceSignature = new InvoiceSignature(null, ret);
return ret_hu_conv;
}
+ public boolean eq(InvoiceSignature b) {
+ boolean ret = bindings.InvoiceSignature_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
+ this.ptrs_to.add(b);
+ return ret;
+ }
+
}
public Result_TransactionNoneZ spend_spendable_outputs(SpendableOutputDescriptor[] descriptors, TxOut[] outputs, Uint8Array change_destination_script, number feerate_sat_per_1000_weight) {
number ret = bindings.KeysManager_spend_spendable_outputs(this.ptr, descriptors != null ? Arrays.stream(descriptors).map(descriptors_conv_27 -> descriptors_conv_27.ptr).toArray(number[]::new) : null, outputs != null ? Arrays.stream(outputs).map(outputs_conv_7 -> outputs_conv_7.ptr).toArray(number[]::new) : null, change_destination_script, feerate_sat_per_1000_weight);
Result_TransactionNoneZ ret_hu_conv = Result_TransactionNoneZ.constr_from_ptr(ret);
- /* TODO 2 SpendableOutputDescriptor */;
- /* TODO 2 TxOut */;
return ret_hu_conv;
}
+++ /dev/null
-
-
-import CommonBase from './CommonBase';
-import * as bindings from '../bindings' // TODO: figure out location
-
-
-
- export default class LockedNetworkGraph extends CommonBase implements AutoCloseable {
- constructor(_dummy: object, ptr: number) {
- super(ptr);
- }
-
-
- public close() {
-
- if (this.ptr != 0) {
- bindings.LockedNetworkGraph_free(this.ptr);
- }
- }
- public NetworkGraph graph() {
- number ret = bindings.LockedNetworkGraph_graph(this.ptr);
- const ret_hu_conv: NetworkGraph = new NetworkGraph(null, ret);
- ret_hu_conv.ptrs_to.add(this);
- return ret_hu_conv;
- }
-
-}
if (raw_val instanceof bindings.LDKMessageSendEvent.HandleError) {
return new HandleError(this.ptr, raw_val);
}
- if (raw_val instanceof bindings.LDKMessageSendEvent.PaymentFailureNetworkUpdate) {
- return new PaymentFailureNetworkUpdate(this.ptr, raw_val);
- }
if (raw_val instanceof bindings.LDKMessageSendEvent.SendChannelRangeQuery) {
return new SendChannelRangeQuery(this.ptr, raw_val);
}
this.action = action_hu_conv;
}
}
-export class PaymentFailureNetworkUpdate extends MessageSendEvent {
- public update: HTLCFailChannelUpdate;
- private constructor(ptr: number, obj: bindings.LDKMessageSendEvent.PaymentFailureNetworkUpdate) {
- super(null, ptr);
- const update: number = obj.update;
- HTLCFailChannelUpdate update_hu_conv = HTLCFailChannelUpdate.constr_from_ptr(update);
- update_hu_conv.ptrs_to.add(this);
- this.update = update_hu_conv;
- }
-}
export class SendChannelRangeQuery extends MessageSendEvent {
public node_id: Uint8Array;
public msg: QueryChannelRange;
return ret_hu_conv;
}
- public static MessageSendEvent constructor_payment_failure_network_update(HTLCFailChannelUpdate update) {
- number ret = bindings.MessageSendEvent_payment_failure_network_update(update.ptr);
- MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
- return ret_hu_conv;
- }
-
public static MessageSendEvent constructor_send_channel_range_query(Uint8Array node_id, QueryChannelRange msg) {
number ret = bindings.MessageSendEvent_send_channel_range_query(node_id, msg == null ? 0 : msg.ptr & ~1);
MessageSendEvent ret_hu_conv = MessageSendEvent.constr_from_ptr(ret);
get_and_clear_pending_msg_events (): number[] {
MessageSendEvent[] ret = arg.get_and_clear_pending_msg_events();
result: number[] = ret != null ? Arrays.stream(ret).map(ret_conv_18 -> ret_conv_18.ptr).toArray(number[]::new) : null;
- /* TODO 2 MessageSendEvent */;
return result;
},
bindings.MinFinalCltvExpiry_free(this.ptr);
}
}
- public boolean eq(MinFinalCltvExpiry b) {
- boolean ret = bindings.MinFinalCltvExpiry_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
- this.ptrs_to.add(b);
- return ret;
- }
-
public MinFinalCltvExpiry clone() {
number ret = bindings.MinFinalCltvExpiry_clone(this.ptr);
const ret_hu_conv: MinFinalCltvExpiry = new MinFinalCltvExpiry(null, ret);
return ret_hu_conv;
}
+ public number hash() {
+ number ret = bindings.MinFinalCltvExpiry_hash(this.ptr);
+ return ret;
+ }
+
+ public boolean eq(MinFinalCltvExpiry b) {
+ boolean ret = bindings.MinFinalCltvExpiry_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
+ this.ptrs_to.add(b);
+ return ret;
+ }
+
}
if (raw_val instanceof bindings.LDKMonitorEvent.HTLCEvent) {
return new HTLCEvent(this.ptr, raw_val);
}
- if (raw_val instanceof bindings.LDKMonitorEvent.CommitmentTxBroadcasted) {
- return new CommitmentTxBroadcasted(this.ptr, raw_val);
+ if (raw_val instanceof bindings.LDKMonitorEvent.CommitmentTxConfirmed) {
+ return new CommitmentTxConfirmed(this.ptr, raw_val);
}
throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
}
this.htlc_event = htlc_event_hu_conv;
}
}
-export class CommitmentTxBroadcasted extends MonitorEvent {
- public commitment_tx_broadcasted: OutPoint;
- private constructor(ptr: number, obj: bindings.LDKMonitorEvent.CommitmentTxBroadcasted) {
+export class CommitmentTxConfirmed extends MonitorEvent {
+ public commitment_tx_confirmed: OutPoint;
+ private constructor(ptr: number, obj: bindings.LDKMonitorEvent.CommitmentTxConfirmed) {
super(null, ptr);
- const commitment_tx_broadcasted: number = obj.commitment_tx_broadcasted;
- const commitment_tx_broadcasted_hu_conv: OutPoint = new OutPoint(null, commitment_tx_broadcasted);
- commitment_tx_broadcasted_hu_conv.ptrs_to.add(this);
- this.commitment_tx_broadcasted = commitment_tx_broadcasted_hu_conv;
+ const commitment_tx_confirmed: number = obj.commitment_tx_confirmed;
+ const commitment_tx_confirmed_hu_conv: OutPoint = new OutPoint(null, commitment_tx_confirmed);
+ commitment_tx_confirmed_hu_conv.ptrs_to.add(this);
+ this.commitment_tx_confirmed = commitment_tx_confirmed_hu_conv;
}
}
public MonitorEvent clone() {
return ret_hu_conv;
}
- public static MonitorEvent constructor_commitment_tx_broadcasted(OutPoint a) {
- number ret = bindings.MonitorEvent_commitment_tx_broadcasted(a == null ? 0 : a.ptr & ~1);
+ public static MonitorEvent constructor_commitment_tx_confirmed(OutPoint a) {
+ number ret = bindings.MonitorEvent_commitment_tx_confirmed(a == null ? 0 : a.ptr & ~1);
MonitorEvent ret_hu_conv = MonitorEvent.constr_from_ptr(ret);
ret_hu_conv.ptrs_to.add(ret_hu_conv);
ret_hu_conv.ptrs_to.add(a);
bindings.NetGraphMsgHandler_free(this.ptr);
}
}
- public static NetGraphMsgHandler constructor_new(Uint8Array genesis_hash, Access chain_access, Logger logger) {
- number ret = bindings.NetGraphMsgHandler_new(genesis_hash, chain_access == null ? 0 : chain_access.ptr, logger == null ? 0 : logger.ptr);
- const ret_hu_conv: NetGraphMsgHandler = new NetGraphMsgHandler(null, ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
- ret_hu_conv.ptrs_to.add(chain_access);
- ret_hu_conv.ptrs_to.add(logger);
+ public EventHandler as_EventHandler() {
+ number ret = bindings.NetGraphMsgHandler_as_EventHandler(this.ptr);
+ EventHandler ret_hu_conv = new EventHandler(null, ret);
+ ret_hu_conv.ptrs_to.add(this);
return ret_hu_conv;
}
- public static NetGraphMsgHandler constructor_from_net_graph(Access chain_access, Logger logger, NetworkGraph network_graph) {
- number ret = bindings.NetGraphMsgHandler_from_net_graph(chain_access == null ? 0 : chain_access.ptr, logger == null ? 0 : logger.ptr, network_graph == null ? 0 : network_graph.ptr & ~1);
- const ret_hu_conv: NetGraphMsgHandler = new NetGraphMsgHandler(null, ret);
- ret_hu_conv.ptrs_to.add(ret_hu_conv);
- ret_hu_conv.ptrs_to.add(chain_access);
- ret_hu_conv.ptrs_to.add(logger);
- ret_hu_conv.ptrs_to.add(network_graph);
+ public NetworkGraph get_network_graph() {
+ number ret = bindings.NetGraphMsgHandler_get_network_graph(this.ptr);
+ const ret_hu_conv: NetworkGraph = new NetworkGraph(null, ret);
+ ret_hu_conv.ptrs_to.add(this);
return ret_hu_conv;
}
- public void add_chain_access(Access chain_access) {
- bindings.NetGraphMsgHandler_add_chain_access(this.ptr, chain_access == null ? 0 : chain_access.ptr);
- this.ptrs_to.add(chain_access);
+ public void set_network_graph(Uint8Array val_genesis_hash) {
+ bindings.NetGraphMsgHandler_set_network_graph(this.ptr, bindings.NetworkGraph_new(val_genesis_hash));
}
- public LockedNetworkGraph read_locked_graph() {
- number ret = bindings.NetGraphMsgHandler_read_locked_graph(this.ptr);
- const ret_hu_conv: LockedNetworkGraph = new LockedNetworkGraph(null, ret);
- ret_hu_conv.ptrs_to.add(this);
+ public static NetGraphMsgHandler constructor_new(Uint8Array network_graph_genesis_hash, Option_AccessZ chain_access, Logger logger) {
+ number ret = bindings.NetGraphMsgHandler_new(bindings.NetworkGraph_new(network_graph_genesis_hash), chain_access.ptr, logger == null ? 0 : logger.ptr);
+ const ret_hu_conv: NetGraphMsgHandler = new NetGraphMsgHandler(null, ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ ret_hu_conv.ptrs_to.add(logger);
return ret_hu_conv;
}
+ public void add_chain_access(Option_AccessZ chain_access) {
+ bindings.NetGraphMsgHandler_add_chain_access(this.ptr, chain_access.ptr);
+ }
+
public RoutingMessageHandler as_RoutingMessageHandler() {
number ret = bindings.NetGraphMsgHandler_as_RoutingMessageHandler(this.ptr);
RoutingMessageHandler ret_hu_conv = new RoutingMessageHandler(null, ret);
bindings.NetworkGraph_free(this.ptr);
}
}
- public NetworkGraph clone() {
- number ret = bindings.NetworkGraph_clone(this.ptr);
- const ret_hu_conv: NetworkGraph = new NetworkGraph(null, ret);
- ret_hu_conv.ptrs_to.add(this);
- return ret_hu_conv;
- }
-
public Uint8Array write() {
Uint8Array ret = bindings.NetworkGraph_write(this.ptr);
return ret;
return ret_hu_conv;
}
+ public ReadOnlyNetworkGraph read_only() {
+ number ret = bindings.NetworkGraph_read_only(this.ptr);
+ const ret_hu_conv: ReadOnlyNetworkGraph = new ReadOnlyNetworkGraph(null, ret);
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;
+ }
+
public Result_NoneLightningErrorZ update_node_from_announcement(NodeAnnouncement msg) {
number ret = bindings.NetworkGraph_update_node_from_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1);
Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
return ret_hu_conv;
}
- public Result_NoneLightningErrorZ update_channel_from_announcement(ChannelAnnouncement msg, Access chain_access) {
- number ret = bindings.NetworkGraph_update_channel_from_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1, chain_access == null ? 0 : chain_access.ptr);
+ public Result_NoneLightningErrorZ update_channel_from_announcement(ChannelAnnouncement msg, Option_AccessZ chain_access) {
+ number ret = bindings.NetworkGraph_update_channel_from_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1, chain_access.ptr);
Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
this.ptrs_to.add(msg);
- this.ptrs_to.add(chain_access);
return ret_hu_conv;
}
- public Result_NoneLightningErrorZ update_channel_from_unsigned_announcement(UnsignedChannelAnnouncement msg, Access chain_access) {
- number ret = bindings.NetworkGraph_update_channel_from_unsigned_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1, chain_access == null ? 0 : chain_access.ptr);
+ public Result_NoneLightningErrorZ update_channel_from_unsigned_announcement(UnsignedChannelAnnouncement msg, Option_AccessZ chain_access) {
+ number ret = bindings.NetworkGraph_update_channel_from_unsigned_announcement(this.ptr, msg == null ? 0 : msg.ptr & ~1, chain_access.ptr);
Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
this.ptrs_to.add(msg);
- this.ptrs_to.add(chain_access);
return ret_hu_conv;
}
bindings.NetworkGraph_close_channel_from_update(this.ptr, short_channel_id, is_permanent);
}
+ public void fail_node(Uint8Array _node_id, boolean is_permanent) {
+ bindings.NetworkGraph_fail_node(this.ptr, _node_id, is_permanent);
+ }
+
public Result_NoneLightningErrorZ update_channel(ChannelUpdate msg) {
number ret = bindings.NetworkGraph_update_channel(this.ptr, msg == null ? 0 : msg.ptr & ~1);
Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
--- /dev/null
+
+import CommonBase from './CommonBase';
+import * as bindings from '../bindings' // TODO: figure out location
+
+export default class NetworkUpdate extends CommonBase {
+ protected constructor(_dummy: object, ptr: number) { super(ptr); }
+ protected finalize() {
+ super.finalize();
+ if (this.ptr != 0) { bindings.NetworkUpdate_free(this.ptr); }
+ }
+ static constr_from_ptr(ptr: number): NetworkUpdate {
+ const raw_val: bindings.LDKNetworkUpdate = bindings.LDKNetworkUpdate_ref_from_ptr(ptr);
+ if (raw_val instanceof bindings.LDKNetworkUpdate.ChannelUpdateMessage) {
+ return new ChannelUpdateMessage(this.ptr, raw_val);
+ }
+ if (raw_val instanceof bindings.LDKNetworkUpdate.ChannelClosed) {
+ return new ChannelClosed(this.ptr, raw_val);
+ }
+ if (raw_val instanceof bindings.LDKNetworkUpdate.NodeFailure) {
+ return new NodeFailure(this.ptr, raw_val);
+ }
+ throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
+ }
+
+}
+export class ChannelUpdateMessage extends NetworkUpdate {
+ public msg: ChannelUpdate;
+ private constructor(ptr: number, obj: bindings.LDKNetworkUpdate.ChannelUpdateMessage) {
+ super(null, ptr);
+ const msg: number = obj.msg;
+ const msg_hu_conv: ChannelUpdate = new ChannelUpdate(null, msg);
+ msg_hu_conv.ptrs_to.add(this);
+ this.msg = msg_hu_conv;
+ }
+}
+export class ChannelClosed extends NetworkUpdate {
+ public short_channel_id: number;
+ public is_permanent: boolean;
+ private constructor(ptr: number, obj: bindings.LDKNetworkUpdate.ChannelClosed) {
+ super(null, ptr);
+ this.short_channel_id = obj.short_channel_id;
+ this.is_permanent = obj.is_permanent;
+ }
+}
+export class NodeFailure extends NetworkUpdate {
+ public node_id: Uint8Array;
+ public is_permanent: boolean;
+ private constructor(ptr: number, obj: bindings.LDKNetworkUpdate.NodeFailure) {
+ super(null, ptr);
+ this.node_id = obj.node_id;
+ this.is_permanent = obj.is_permanent;
+ }
+}
+ public NetworkUpdate clone() {
+ number ret = bindings.NetworkUpdate_clone(this.ptr);
+ NetworkUpdate ret_hu_conv = NetworkUpdate.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;
+ }
+
+ public static NetworkUpdate constructor_channel_update_message(ChannelUpdate msg) {
+ number ret = bindings.NetworkUpdate_channel_update_message(msg == null ? 0 : msg.ptr & ~1);
+ NetworkUpdate ret_hu_conv = NetworkUpdate.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ ret_hu_conv.ptrs_to.add(msg);
+ return ret_hu_conv;
+ }
+
+ public static NetworkUpdate constructor_channel_closed(number short_channel_id, boolean is_permanent) {
+ number ret = bindings.NetworkUpdate_channel_closed(short_channel_id, is_permanent);
+ NetworkUpdate ret_hu_conv = NetworkUpdate.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ public static NetworkUpdate constructor_node_failure(Uint8Array node_id, boolean is_permanent) {
+ number ret = bindings.NetworkUpdate_node_failure(node_id, is_permanent);
+ NetworkUpdate ret_hu_conv = NetworkUpdate.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ public Uint8Array write() {
+ Uint8Array ret = bindings.NetworkUpdate_write(this.ptr);
+ return ret;
+ }
+
+}
public void set_addresses(NetAddress[] val) {
bindings.NodeAnnouncementInfo_set_addresses(this.ptr, val != null ? Arrays.stream(val).map(val_conv_12 -> val_conv_12.ptr).toArray(number[]::new) : null);
- /* TODO 2 NetAddress */;
}
public NodeAnnouncement get_announcement_message() {
const ret_hu_conv: NodeAnnouncementInfo = new NodeAnnouncementInfo(null, ret);
ret_hu_conv.ptrs_to.add(ret_hu_conv);
ret_hu_conv.ptrs_to.add(features_arg);
- /* TODO 2 NetAddress */;
ret_hu_conv.ptrs_to.add(announcement_message_arg);
return ret_hu_conv;
}
return ret_hu_conv;
}
+ public boolean requires_unknown_bits() {
+ boolean ret = bindings.NodeFeatures_requires_unknown_bits(this.ptr);
+ return ret;
+ }
+
public boolean supports_payment_secret() {
boolean ret = bindings.NodeFeatures_supports_payment_secret(this.ptr);
return ret;
--- /dev/null
+
+import CommonBase from './CommonBase';
+import * as bindings from '../bindings' // TODO: figure out location
+
+export default class COption_AccessZ extends CommonBase {
+ protected constructor(_dummy: object, ptr: number) { super(ptr); }
+ protected finalize() {
+ super.finalize();
+ if (this.ptr != 0) { bindings.COption_AccessZ_free(this.ptr); }
+ }
+ static constr_from_ptr(ptr: number): COption_AccessZ {
+ const raw_val: bindings.LDKCOption_AccessZ = bindings.LDKCOption_AccessZ_ref_from_ptr(ptr);
+ if (raw_val instanceof bindings.LDKCOption_AccessZ.Some) {
+ return new Some(this.ptr, raw_val);
+ }
+ if (raw_val instanceof bindings.LDKCOption_AccessZ.None) {
+ return new None(this.ptr, raw_val);
+ }
+ throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
+ }
+
+}
+export class Some extends COption_AccessZ {
+ public some: Access;
+ private constructor(ptr: number, obj: bindings.LDKCOption_AccessZ.Some) {
+ super(null, ptr);
+ const some: number = obj.some;
+ Access ret_hu_conv = new Access(null, some);
+ ret_hu_conv.ptrs_to.add(this);
+ this.some = ret_hu_conv;
+ }
+}
+export class None extends COption_AccessZ {
+ private constructor(ptr: number, obj: bindings.LDKCOption_AccessZ.None) {
+ super(null, ptr);
+ }
+}
+ public static Option_AccessZ constructor__some(Access o) {
+ number ret = bindings.COption_AccessZ_some(o == null ? 0 : o.ptr);
+ Option_AccessZ ret_hu_conv = Option_AccessZ.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ ret_hu_conv.ptrs_to.add(o);
+ return ret_hu_conv;
+ }
+
+ public static Option_AccessZ constructor__none() {
+ number ret = bindings.COption_AccessZ_none();
+ Option_AccessZ ret_hu_conv = Option_AccessZ.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+}
--- /dev/null
+
+import CommonBase from './CommonBase';
+import * as bindings from '../bindings' // TODO: figure out location
+
+export default class COption_FilterZ extends CommonBase {
+ protected constructor(_dummy: object, ptr: number) { super(ptr); }
+ protected finalize() {
+ super.finalize();
+ if (this.ptr != 0) { bindings.COption_FilterZ_free(this.ptr); }
+ }
+ static constr_from_ptr(ptr: number): COption_FilterZ {
+ const raw_val: bindings.LDKCOption_FilterZ = bindings.LDKCOption_FilterZ_ref_from_ptr(ptr);
+ if (raw_val instanceof bindings.LDKCOption_FilterZ.Some) {
+ return new Some(this.ptr, raw_val);
+ }
+ if (raw_val instanceof bindings.LDKCOption_FilterZ.None) {
+ return new None(this.ptr, raw_val);
+ }
+ throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
+ }
+
+}
+export class Some extends COption_FilterZ {
+ public some: Filter;
+ private constructor(ptr: number, obj: bindings.LDKCOption_FilterZ.Some) {
+ super(null, ptr);
+ const some: number = obj.some;
+ Filter ret_hu_conv = new Filter(null, some);
+ ret_hu_conv.ptrs_to.add(this);
+ this.some = ret_hu_conv;
+ }
+}
+export class None extends COption_FilterZ {
+ private constructor(ptr: number, obj: bindings.LDKCOption_FilterZ.None) {
+ super(null, ptr);
+ }
+}
+ public static Option_FilterZ constructor__some(Filter o) {
+ number ret = bindings.COption_FilterZ_some(o == null ? 0 : o.ptr);
+ Option_FilterZ ret_hu_conv = Option_FilterZ.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ ret_hu_conv.ptrs_to.add(o);
+ return ret_hu_conv;
+ }
+
+ public static Option_FilterZ constructor__none() {
+ number ret = bindings.COption_FilterZ_none();
+ Option_FilterZ ret_hu_conv = Option_FilterZ.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+}
--- /dev/null
+
+import CommonBase from './CommonBase';
+import * as bindings from '../bindings' // TODO: figure out location
+
+export default class COption_NetworkUpdateZ extends CommonBase {
+ protected constructor(_dummy: object, ptr: number) { super(ptr); }
+ protected finalize() {
+ super.finalize();
+ if (this.ptr != 0) { bindings.COption_NetworkUpdateZ_free(this.ptr); }
+ }
+ static constr_from_ptr(ptr: number): COption_NetworkUpdateZ {
+ const raw_val: bindings.LDKCOption_NetworkUpdateZ = bindings.LDKCOption_NetworkUpdateZ_ref_from_ptr(ptr);
+ if (raw_val instanceof bindings.LDKCOption_NetworkUpdateZ.Some) {
+ return new Some(this.ptr, raw_val);
+ }
+ if (raw_val instanceof bindings.LDKCOption_NetworkUpdateZ.None) {
+ return new None(this.ptr, raw_val);
+ }
+ throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
+ }
+
+}
+export class Some extends COption_NetworkUpdateZ {
+ public some: NetworkUpdate;
+ private constructor(ptr: number, obj: bindings.LDKCOption_NetworkUpdateZ.Some) {
+ super(null, ptr);
+ const some: number = obj.some;
+ NetworkUpdate some_hu_conv = NetworkUpdate.constr_from_ptr(some);
+ some_hu_conv.ptrs_to.add(this);
+ this.some = some_hu_conv;
+ }
+}
+export class None extends COption_NetworkUpdateZ {
+ private constructor(ptr: number, obj: bindings.LDKCOption_NetworkUpdateZ.None) {
+ super(null, ptr);
+ }
+}
+ public static Option_NetworkUpdateZ constructor__some(NetworkUpdate o) {
+ number ret = bindings.COption_NetworkUpdateZ_some(o.ptr);
+ Option_NetworkUpdateZ ret_hu_conv = Option_NetworkUpdateZ.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ public static Option_NetworkUpdateZ constructor__none() {
+ number ret = bindings.COption_NetworkUpdateZ_none();
+ Option_NetworkUpdateZ ret_hu_conv = Option_NetworkUpdateZ.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ public Option_NetworkUpdateZ _clone() {
+ number ret = bindings.COption_NetworkUpdateZ_clone(this.ptr);
+ Option_NetworkUpdateZ ret_hu_conv = Option_NetworkUpdateZ.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;
+ }
+
+}
--- /dev/null
+
+import CommonBase from './CommonBase';
+import * as bindings from '../bindings' // TODO: figure out location
+
+export default class COption_TypeZ extends CommonBase {
+ protected constructor(_dummy: object, ptr: number) { super(ptr); }
+ protected finalize() {
+ super.finalize();
+ if (this.ptr != 0) { bindings.COption_TypeZ_free(this.ptr); }
+ }
+ static constr_from_ptr(ptr: number): COption_TypeZ {
+ const raw_val: bindings.LDKCOption_TypeZ = bindings.LDKCOption_TypeZ_ref_from_ptr(ptr);
+ if (raw_val instanceof bindings.LDKCOption_TypeZ.Some) {
+ return new Some(this.ptr, raw_val);
+ }
+ if (raw_val instanceof bindings.LDKCOption_TypeZ.None) {
+ return new None(this.ptr, raw_val);
+ }
+ throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
+ }
+
+}
+export class Some extends COption_TypeZ {
+ public some: Type;
+ private constructor(ptr: number, obj: bindings.LDKCOption_TypeZ.Some) {
+ super(null, ptr);
+ const some: number = obj.some;
+ Type ret_hu_conv = new Type(null, some);
+ ret_hu_conv.ptrs_to.add(this);
+ this.some = ret_hu_conv;
+ }
+}
+export class None extends COption_TypeZ {
+ private constructor(ptr: number, obj: bindings.LDKCOption_TypeZ.None) {
+ super(null, ptr);
+ }
+}
+ public static Option_TypeZ constructor__some(Type o) {
+ number ret = bindings.COption_TypeZ_some(o == null ? 0 : o.ptr);
+ Option_TypeZ ret_hu_conv = Option_TypeZ.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ ret_hu_conv.ptrs_to.add(o);
+ return ret_hu_conv;
+ }
+
+ public static Option_TypeZ constructor__none() {
+ number ret = bindings.COption_TypeZ_none();
+ Option_TypeZ ret_hu_conv = Option_TypeZ.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(ret_hu_conv);
+ return ret_hu_conv;
+ }
+
+ public Option_TypeZ _clone() {
+ number ret = bindings.COption_TypeZ_clone(this.ptr);
+ Option_TypeZ ret_hu_conv = Option_TypeZ.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;
+ }
+
+}
bindings.PayeePubKey_free(this.ptr);
}
}
- public boolean eq(PayeePubKey b) {
- boolean ret = bindings.PayeePubKey_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
- this.ptrs_to.add(b);
- return ret;
- }
-
public PayeePubKey clone() {
number ret = bindings.PayeePubKey_clone(this.ptr);
const ret_hu_conv: PayeePubKey = new PayeePubKey(null, ret);
return ret_hu_conv;
}
+ public number hash() {
+ number ret = bindings.PayeePubKey_hash(this.ptr);
+ return ret;
+ }
+
+ public boolean eq(PayeePubKey b) {
+ boolean ret = bindings.PayeePubKey_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
+ this.ptrs_to.add(b);
+ return ret;
+ }
+
}
number ret = bindings.PaymentSendFailure_path_parameter_error(a != null ? Arrays.stream(a).map(a_conv_22 -> a_conv_22 != null ? a_conv_22.ptr : 0).toArray(number[]::new) : null);
PaymentSendFailure ret_hu_conv = PaymentSendFailure.constr_from_ptr(ret);
ret_hu_conv.ptrs_to.add(ret_hu_conv);
- /* TODO 2 Result_NoneAPIErrorZ */;
return ret_hu_conv;
}
number ret = bindings.PaymentSendFailure_all_failed_retry_safe(a != null ? Arrays.stream(a).map(a_conv_10 -> a_conv_10.ptr).toArray(number[]::new) : null);
PaymentSendFailure ret_hu_conv = PaymentSendFailure.constr_from_ptr(ret);
ret_hu_conv.ptrs_to.add(ret_hu_conv);
- /* TODO 2 APIError */;
return ret_hu_conv;
}
number ret = bindings.PaymentSendFailure_partial_failure(a != null ? Arrays.stream(a).map(a_conv_22 -> a_conv_22 != null ? a_conv_22.ptr : 0).toArray(number[]::new) : null);
PaymentSendFailure ret_hu_conv = PaymentSendFailure.constr_from_ptr(ret);
ret_hu_conv.ptrs_to.add(ret_hu_conv);
- /* TODO 2 Result_NoneAPIErrorZ */;
return ret_hu_conv;
}
bindings.PeerManager_free(this.ptr);
}
}
- public static PeerManager constructor_new(ChannelMessageHandler message_handler_chan_handler_arg, RoutingMessageHandler message_handler_route_handler_arg, Uint8Array our_node_secret, Uint8Array ephemeral_random_data, Logger logger) {
- number ret = bindings.PeerManager_new(bindings.MessageHandler_new(message_handler_chan_handler_arg == null ? 0 : message_handler_chan_handler_arg.ptr, message_handler_route_handler_arg == null ? 0 : message_handler_route_handler_arg.ptr), our_node_secret, ephemeral_random_data, logger == null ? 0 : logger.ptr);
+ public static PeerManager constructor_new(ChannelMessageHandler message_handler_chan_handler_arg, RoutingMessageHandler message_handler_route_handler_arg, Uint8Array our_node_secret, Uint8Array ephemeral_random_data, Logger logger, CustomMessageHandler custom_message_handler) {
+ number ret = bindings.PeerManager_new(bindings.MessageHandler_new(message_handler_chan_handler_arg == null ? 0 : message_handler_chan_handler_arg.ptr, message_handler_route_handler_arg == null ? 0 : message_handler_route_handler_arg.ptr), our_node_secret, ephemeral_random_data, logger == null ? 0 : logger.ptr, custom_message_handler == null ? 0 : custom_message_handler.ptr);
const ret_hu_conv: PeerManager = new PeerManager(null, ret);
ret_hu_conv.ptrs_to.add(ret_hu_conv);
ret_hu_conv.ptrs_to.add(message_handler_chan_handler_arg);
ret_hu_conv.ptrs_to.add(message_handler_route_handler_arg);
ret_hu_conv.ptrs_to.add(logger);
+ ret_hu_conv.ptrs_to.add(custom_message_handler);
return ret_hu_conv;
}
bindings.PrivateRoute_free(this.ptr);
}
}
- public boolean eq(PrivateRoute b) {
- boolean ret = bindings.PrivateRoute_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
- this.ptrs_to.add(b);
- return ret;
- }
-
public PrivateRoute clone() {
number ret = bindings.PrivateRoute_clone(this.ptr);
const ret_hu_conv: PrivateRoute = new PrivateRoute(null, ret);
return ret_hu_conv;
}
+ public number hash() {
+ number ret = bindings.PrivateRoute_hash(this.ptr);
+ return ret;
+ }
+
+ public boolean eq(PrivateRoute b) {
+ boolean ret = bindings.PrivateRoute_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
+ this.ptrs_to.add(b);
+ return ret;
+ }
+
public static Result_PrivateRouteCreationErrorZ constructor_new(RouteHint hops) {
number ret = bindings.PrivateRoute_new(hops == null ? 0 : hops.ptr & ~1);
Result_PrivateRouteCreationErrorZ ret_hu_conv = Result_PrivateRouteCreationErrorZ.constr_from_ptr(ret);
return ret;
}
+ public Uint8Array write() {
+ Uint8Array ret = bindings.QueryChannelRange_write(this.ptr);
+ return ret;
+ }
+
public static Result_QueryChannelRangeDecodeErrorZ constructor_read(Uint8Array ser) {
number ret = bindings.QueryChannelRange_read(ser);
Result_QueryChannelRangeDecodeErrorZ ret_hu_conv = Result_QueryChannelRangeDecodeErrorZ.constr_from_ptr(ret);
return ret_hu_conv;
}
- public Uint8Array write() {
- Uint8Array ret = bindings.QueryChannelRange_write(this.ptr);
- return ret;
- }
-
}
--- /dev/null
+
+
+import CommonBase from './CommonBase';
+import * as bindings from '../bindings' // TODO: figure out location
+
+
+
+ export default class ReadOnlyNetworkGraph extends CommonBase {
+ constructor(_dummy: object, ptr: number) {
+ super(ptr);
+ }
+
+
+ protected finalize() {
+ super.finalize();
+
+ if (this.ptr != 0) {
+ bindings.ReadOnlyNetworkGraph_free(this.ptr);
+ }
+ }
+}
return ret_hu_conv;
}
+ public Uint8Array write() {
+ Uint8Array ret = bindings.ReplyShortChannelIdsEnd_write(this.ptr);
+ return ret;
+ }
+
public static Result_ReplyShortChannelIdsEndDecodeErrorZ constructor_read(Uint8Array ser) {
number ret = bindings.ReplyShortChannelIdsEnd_read(ser);
Result_ReplyShortChannelIdsEndDecodeErrorZ ret_hu_conv = Result_ReplyShortChannelIdsEndDecodeErrorZ.constr_from_ptr(ret);
return ret_hu_conv;
}
- public Uint8Array write() {
- Uint8Array ret = bindings.ReplyShortChannelIdsEnd_write(this.ptr);
- return ret;
- }
-
}
--- /dev/null
+
+import CommonBase from './CommonBase';
+import * as bindings from '../bindings' // TODO: figure out location
+
+public class Result_COption_TypeZDecodeErrorZ extends CommonBase {
+ private Result_COption_TypeZDecodeErrorZ(Object _dummy, long ptr) { super(ptr); }
+ protected void finalize() throws Throwable {
+ if (ptr != 0) { bindings.CResult_COption_TypeZDecodeErrorZ_free(ptr); } super.finalize();
+ }
+
+ static Result_COption_TypeZDecodeErrorZ constr_from_ptr(long ptr) {
+ if (bindings.LDKCResult_COption_TypeZDecodeErrorZ_result_ok(ptr)) {
+ return new Result_COption_TypeZDecodeErrorZ_OK(null, ptr);
+ } else {
+ return new Result_COption_TypeZDecodeErrorZ_Err(null, ptr);
+ }
+ }
+ public static final class Result_COption_TypeZDecodeErrorZ_OK extends Result_COption_TypeZDecodeErrorZ {
+ public final Option_TypeZ res;
+ private Result_COption_TypeZDecodeErrorZ_OK(Object _dummy, long ptr) {
+ super(_dummy, ptr);
+ number res = bindings.LDKCResult_COption_TypeZDecodeErrorZ_get_ok(ptr);
+ Option_TypeZ res_hu_conv = Option_TypeZ.constr_from_ptr(res);
+ res_hu_conv.ptrs_to.add(this);
+ this.res = res_hu_conv;
+ }
+ }
+
+ public static final class Result_COption_TypeZDecodeErrorZ_Err extends Result_COption_TypeZDecodeErrorZ {
+ public final DecodeError err;
+ private Result_COption_TypeZDecodeErrorZ_Err(Object _dummy, long ptr) {
+ super(_dummy, ptr);
+ number err = bindings.LDKCResult_COption_TypeZDecodeErrorZ_get_err(ptr);
+ const err_hu_conv: DecodeError = new DecodeError(null, err);
+ err_hu_conv.ptrs_to.add(this);
+ this.err = err_hu_conv;
+ }
+ }
+
+ public static Result_COption_TypeZDecodeErrorZ constructor__ok(Option_TypeZ o) {
+ number ret = bindings.CResult_COption_TypeZDecodeErrorZ_ok(o.ptr);
+ Result_COption_TypeZDecodeErrorZ ret_hu_conv = Result_COption_TypeZDecodeErrorZ.constr_from_ptr(ret);
+ return ret_hu_conv;
+ }
+
+ public static Result_COption_TypeZDecodeErrorZ constructor__err(DecodeError e) {
+ number ret = bindings.CResult_COption_TypeZDecodeErrorZ_err(e == null ? 0 : e.ptr & ~1);
+ Result_COption_TypeZDecodeErrorZ ret_hu_conv = Result_COption_TypeZDecodeErrorZ.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(e);
+ return ret_hu_conv;
+ }
+
+ public Result_COption_TypeZDecodeErrorZ _clone() {
+ number ret = bindings.CResult_COption_TypeZDecodeErrorZ_clone(this.ptr);
+ Result_COption_TypeZDecodeErrorZ ret_hu_conv = Result_COption_TypeZDecodeErrorZ.constr_from_ptr(ret);
+ return ret_hu_conv;
+ }
+
+}
public static Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ constructor__ok(TwoTuple<Uint8Array, ChannelMonitor>[] o) {
number ret = bindings.CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(o != null ? Arrays.stream(o).map(o_conv_38 -> bindings.C2Tuple_BlockHashChannelMonitorZ_new(o_conv_38.a, o_conv_38.b == null ? 0 : o_conv_38.b.ptr & ~1)).toArray(number[]::new) : null);
Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ ret_hu_conv = Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.constr_from_ptr(ret);
- /* TODO 2 TwoTuple<Uint8Array, ChannelMonitor> */;
+ for (TwoTuple<Uint8Array, ChannelMonitor> o_conv_38: o) { ret_hu_conv.ptrs_to.add(o_conv_38.b); };
return ret_hu_conv;
}
}
}
- public static Result_NetworkGraphDecodeErrorZ constructor__ok(NetworkGraph o) {
- number ret = bindings.CResult_NetworkGraphDecodeErrorZ_ok(o == null ? 0 : o.ptr & ~1);
+ public static Result_NetworkGraphDecodeErrorZ constructor__ok(Uint8Array o_genesis_hash) {
+ number ret = bindings.CResult_NetworkGraphDecodeErrorZ_ok(bindings.NetworkGraph_new(o_genesis_hash));
Result_NetworkGraphDecodeErrorZ ret_hu_conv = Result_NetworkGraphDecodeErrorZ.constr_from_ptr(ret);
- ret_hu_conv.ptrs_to.add(o);
return ret_hu_conv;
}
return ret_hu_conv;
}
- public Result_NetworkGraphDecodeErrorZ _clone() {
- number ret = bindings.CResult_NetworkGraphDecodeErrorZ_clone(this.ptr);
- Result_NetworkGraphDecodeErrorZ ret_hu_conv = Result_NetworkGraphDecodeErrorZ.constr_from_ptr(ret);
- return ret_hu_conv;
- }
-
}
--- /dev/null
+
+import CommonBase from './CommonBase';
+import * as bindings from '../bindings' // TODO: figure out location
+
+public class Result_NoneNoneZ extends CommonBase {
+ private Result_NoneNoneZ(Object _dummy, long ptr) { super(ptr); }
+ protected void finalize() throws Throwable {
+ if (ptr != 0) { bindings.CResult_NoneNoneZ_free(ptr); } super.finalize();
+ }
+
+ static Result_NoneNoneZ constr_from_ptr(long ptr) {
+ if (bindings.LDKCResult_NoneNoneZ_result_ok(ptr)) {
+ return new Result_NoneNoneZ_OK(null, ptr);
+ } else {
+ return new Result_NoneNoneZ_Err(null, ptr);
+ }
+ }
+ public static final class Result_NoneNoneZ_OK extends Result_NoneNoneZ {
+ private Result_NoneNoneZ_OK(Object _dummy, long ptr) {
+ super(_dummy, ptr);
+ }
+ }
+
+ public static final class Result_NoneNoneZ_Err extends Result_NoneNoneZ {
+ private Result_NoneNoneZ_Err(Object _dummy, long ptr) {
+ super(_dummy, ptr);
+ }
+ }
+
+ public static Result_NoneNoneZ constructor__ok() {
+ number ret = bindings.CResult_NoneNoneZ_ok();
+ Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
+ return ret_hu_conv;
+ }
+
+ public static Result_NoneNoneZ constructor__err() {
+ number ret = bindings.CResult_NoneNoneZ_err();
+ Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
+ return ret_hu_conv;
+ }
+
+ public Result_NoneNoneZ _clone() {
+ number ret = bindings.CResult_NoneNoneZ_clone(this.ptr);
+ Result_NoneNoneZ ret_hu_conv = Result_NoneNoneZ.constr_from_ptr(ret);
+ return ret_hu_conv;
+ }
+
+}
--- /dev/null
+
+import CommonBase from './CommonBase';
+import * as bindings from '../bindings' // TODO: figure out location
+
+public class Result_TrustedClosingTransactionNoneZ extends CommonBase {
+ private Result_TrustedClosingTransactionNoneZ(Object _dummy, long ptr) { super(ptr); }
+ protected void finalize() throws Throwable {
+ if (ptr != 0) { bindings.CResult_TrustedClosingTransactionNoneZ_free(ptr); } super.finalize();
+ }
+
+ static Result_TrustedClosingTransactionNoneZ constr_from_ptr(long ptr) {
+ if (bindings.LDKCResult_TrustedClosingTransactionNoneZ_result_ok(ptr)) {
+ return new Result_TrustedClosingTransactionNoneZ_OK(null, ptr);
+ } else {
+ return new Result_TrustedClosingTransactionNoneZ_Err(null, ptr);
+ }
+ }
+ public static final class Result_TrustedClosingTransactionNoneZ_OK extends Result_TrustedClosingTransactionNoneZ {
+ public final TrustedClosingTransaction res;
+ private Result_TrustedClosingTransactionNoneZ_OK(Object _dummy, long ptr) {
+ super(_dummy, ptr);
+ number res = bindings.LDKCResult_TrustedClosingTransactionNoneZ_get_ok(ptr);
+ const res_hu_conv: TrustedClosingTransaction = new TrustedClosingTransaction(null, res);
+ res_hu_conv.ptrs_to.add(this);
+ this.res = res_hu_conv;
+ }
+ }
+
+ public static final class Result_TrustedClosingTransactionNoneZ_Err extends Result_TrustedClosingTransactionNoneZ {
+ private Result_TrustedClosingTransactionNoneZ_Err(Object _dummy, long ptr) {
+ super(_dummy, ptr);
+ }
+ }
+
+ public static Result_TrustedClosingTransactionNoneZ constructor__ok(TrustedClosingTransaction o) {
+ number ret = bindings.CResult_TrustedClosingTransactionNoneZ_ok(o == null ? 0 : o.ptr & ~1);
+ Result_TrustedClosingTransactionNoneZ ret_hu_conv = Result_TrustedClosingTransactionNoneZ.constr_from_ptr(ret);
+ ret_hu_conv.ptrs_to.add(o);
+ // Due to rust's strict-ownership memory model, in some cases we need to "move"
+ // an object to pass exclusive ownership to the function being called.
+ // In most cases, we avoid ret_hu_conv being visible in GC'd languages by cloning the object
+ // at the FFI layer, creating a new object which Rust can claim ownership of
+ // However, in some cases (eg here), there is no way to clone an object, and thus
+ // we actually have to pass full ownership to Rust.
+ // Thus, after ret_hu_conv call, o is reset to null and is now a dummy object.
+ o.ptr = 0;
+ return ret_hu_conv;
+ }
+
+ public static Result_TrustedClosingTransactionNoneZ constructor__err() {
+ number ret = bindings.CResult_TrustedClosingTransactionNoneZ_err();
+ Result_TrustedClosingTransactionNoneZ ret_hu_conv = Result_TrustedClosingTransactionNoneZ.constr_from_ptr(ret);
+ return ret_hu_conv;
+ }
+
+}
bindings.Route_free(this.ptr);
}
}
+ public RouteHop[][] get_paths() {
+ number[][] ret = bindings.Route_get_paths(this.ptr);
+ RouteHop[][] ret_conv_12_arr = new RouteHop[ret.length][];
+ for (int m = 0; m < ret.length; m++) {
+ number[] ret_conv_12 = ret[m];
+ RouteHop[] ret_conv_12_conv_10_arr = new RouteHop[ret_conv_12.length];
+ for (int k = 0; k < ret_conv_12.length; k++) {
+ number ret_conv_12_conv_10 = ret_conv_12[k];
+ const ret_conv_12_conv_10_hu_conv: RouteHop = new RouteHop(null, ret_conv_12_conv_10);
+ ret_conv_12_conv_10_hu_conv.ptrs_to.add(this);
+ ret_conv_12_conv_10_arr[k] = ret_conv_12_conv_10_hu_conv;
+ }
+ ret_conv_12_arr[m] = ret_conv_12_conv_10_arr;
+ }
+ return ret_conv_12_arr;
+ }
+
public void set_paths(RouteHop[][] val) {
bindings.Route_set_paths(this.ptr, val != null ? Arrays.stream(val).map(val_conv_12 -> val_conv_12 != null ? Arrays.stream(val_conv_12).map(val_conv_12_conv_10 -> val_conv_12_conv_10 == null ? 0 : val_conv_12_conv_10.ptr & ~1).toArray(number[]::new) : null).toArray(number[][]::new) : null);
- /* TODO 2 RouteHop[] */;
+ for (RouteHop[] val_conv_12: val) { for (RouteHop val_conv_12_conv_10: val_conv_12) { this.ptrs_to.add(val_conv_12_conv_10); }; };
}
public static Route constructor_new(RouteHop[][] paths_arg) {
number ret = bindings.Route_new(paths_arg != null ? Arrays.stream(paths_arg).map(paths_arg_conv_12 -> paths_arg_conv_12 != null ? Arrays.stream(paths_arg_conv_12).map(paths_arg_conv_12_conv_10 -> paths_arg_conv_12_conv_10 == null ? 0 : paths_arg_conv_12_conv_10.ptr & ~1).toArray(number[]::new) : null).toArray(number[][]::new) : null);
const ret_hu_conv: Route = new Route(null, ret);
ret_hu_conv.ptrs_to.add(ret_hu_conv);
- /* TODO 2 RouteHop[] */;
+ for (RouteHop[] paths_arg_conv_12: paths_arg) { for (RouteHop paths_arg_conv_12_conv_10: paths_arg_conv_12) { ret_hu_conv.ptrs_to.add(paths_arg_conv_12_conv_10); }; };
return ret_hu_conv;
}
return ret_hu_conv;
}
+ public number hash() {
+ number ret = bindings.Route_hash(this.ptr);
+ return ret;
+ }
+
+ public boolean eq(Route b) {
+ boolean ret = bindings.Route_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
+ this.ptrs_to.add(b);
+ return ret;
+ }
+
+ public number get_total_fees() {
+ number ret = bindings.Route_get_total_fees(this.ptr);
+ return ret;
+ }
+
+ public number get_total_amount() {
+ number ret = bindings.Route_get_total_amount(this.ptr);
+ return ret;
+ }
+
public Uint8Array write() {
Uint8Array ret = bindings.Route_write(this.ptr);
return ret;
bindings.RouteHint_free(this.ptr);
}
}
- public boolean eq(RouteHint b) {
- boolean ret = bindings.RouteHint_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
- this.ptrs_to.add(b);
- return ret;
- }
-
public RouteHint clone() {
number ret = bindings.RouteHint_clone(this.ptr);
const ret_hu_conv: RouteHint = new RouteHint(null, ret);
return ret_hu_conv;
}
+ public number hash() {
+ number ret = bindings.RouteHint_hash(this.ptr);
+ return ret;
+ }
+
+ public boolean eq(RouteHint b) {
+ boolean ret = bindings.RouteHint_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
+ this.ptrs_to.add(b);
+ return ret;
+ }
+
}
return ret_hu_conv;
}
- public boolean eq(RouteHintHop b) {
- boolean ret = bindings.RouteHintHop_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
- this.ptrs_to.add(b);
- return ret;
- }
-
public RouteHintHop clone() {
number ret = bindings.RouteHintHop_clone(this.ptr);
const ret_hu_conv: RouteHintHop = new RouteHintHop(null, ret);
return ret_hu_conv;
}
+ public number hash() {
+ number ret = bindings.RouteHintHop_hash(this.ptr);
+ return ret;
+ }
+
+ public boolean eq(RouteHintHop b) {
+ boolean ret = bindings.RouteHintHop_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
+ this.ptrs_to.add(b);
+ return ret;
+ }
+
}
return ret_hu_conv;
}
+ public number hash() {
+ number ret = bindings.RouteHop_hash(this.ptr);
+ return ret;
+ }
+
+ public boolean eq(RouteHop b) {
+ boolean ret = bindings.RouteHop_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
+ this.ptrs_to.add(b);
+ return ret;
+ }
+
public Uint8Array write() {
Uint8Array ret = bindings.RouteHop_write(this.ptr);
return ret;
return ret_hu_conv;
}
+ public number hash() {
+ number ret = bindings.RoutingFees_hash(this.ptr);
+ return ret;
+ }
+
public Uint8Array write() {
Uint8Array ret = bindings.RoutingFees_write(this.ptr);
return ret;
return result;
},
- handle_htlc_fail_channel_update (update: number): void {
- HTLCFailChannelUpdate update_hu_conv = HTLCFailChannelUpdate.constr_from_ptr(update);
- arg.handle_htlc_fail_channel_update(update_hu_conv);
- },
-
get_next_channel_announcements (starting_point: number, batch_amount: number): number[] {
ThreeTuple<ChannelAnnouncement, ChannelUpdate, ChannelUpdate>[] ret = arg.get_next_channel_announcements(starting_point, batch_amount);
result: number[] = ret != null ? Arrays.stream(ret).map(ret_conv_63 -> bindings.C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(ret_conv_63.a == null ? 0 : ret_conv_63.a.ptr & ~1, ret_conv_63.b == null ? 0 : ret_conv_63.b.ptr & ~1, ret_conv_63.c == null ? 0 : ret_conv_63.c.ptr & ~1)).toArray(number[]::new) : null;
- /* TODO 2 ThreeTuple<ChannelAnnouncement, ChannelUpdate, ChannelUpdate> */;
+ for (ThreeTuple<ChannelAnnouncement, ChannelUpdate, ChannelUpdate> ret_conv_63: ret) { impl_holder.held.ptrs_to.add(ret_conv_63.a); impl_holder.held.ptrs_to.add(ret_conv_63.b); impl_holder.held.ptrs_to.add(ret_conv_63.c); };
return result;
},
get_next_node_announcements (starting_point: Uint8Array, batch_amount: number): number[] {
NodeAnnouncement[] ret = arg.get_next_node_announcements(starting_point, batch_amount);
result: number[] = ret != null ? Arrays.stream(ret).map(ret_conv_18 -> ret_conv_18 == null ? 0 : ret_conv_18.ptr & ~1).toArray(number[]::new) : null;
- /* TODO 2 NodeAnnouncement */;
+ for (NodeAnnouncement ret_conv_18: ret) { impl_holder.held.ptrs_to.add(ret_conv_18); };
return result;
},
handle_node_announcement(msg: NodeAnnouncement): Result_boolLightningErrorZ;
handle_channel_announcement(msg: ChannelAnnouncement): Result_boolLightningErrorZ;
handle_channel_update(msg: ChannelUpdate): Result_boolLightningErrorZ;
- handle_htlc_fail_channel_update(update: HTLCFailChannelUpdate): void;
get_next_channel_announcements(starting_point: number, batch_amount: number): ThreeTuple<ChannelAnnouncement, ChannelUpdate, ChannelUpdate>[];
get_next_node_announcements(starting_point: Uint8Array, batch_amount: number): NodeAnnouncement[];
sync_routing_table(their_node_id: Uint8Array, init: Init): void;
return ret_hu_conv;
}
- public void handle_htlc_fail_channel_update(HTLCFailChannelUpdate update) {
- bindings.RoutingMessageHandler_handle_htlc_fail_channel_update(this.ptr, update == null ? 0 : update.ptr & ~1);
- this.ptrs_to.add(update);
- }
-
public ThreeTuple<ChannelAnnouncement, ChannelUpdate, ChannelUpdate>[] get_next_channel_announcements(number starting_point, number batch_amount) {
number[] ret = bindings.RoutingMessageHandler_get_next_channel_announcements(this.ptr, starting_point, batch_amount);
ThreeTuple<ChannelAnnouncement, ChannelUpdate, ChannelUpdate>[] ret_conv_63_arr = new ThreeTuple[ret.length];
bindings.Sha256_free(this.ptr);
}
}
- public boolean eq(Sha256 b) {
- boolean ret = bindings.Sha256_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
- this.ptrs_to.add(b);
- return ret;
- }
-
public Sha256 clone() {
number ret = bindings.Sha256_clone(this.ptr);
const ret_hu_conv: Sha256 = new Sha256(null, ret);
return ret_hu_conv;
}
+ public number hash() {
+ number ret = bindings.Sha256_hash(this.ptr);
+ return ret;
+ }
+
+ public boolean eq(Sha256 b) {
+ boolean ret = bindings.Sha256_eq(this.ptr, b == null ? 0 : b.ptr & ~1);
+ this.ptrs_to.add(b);
+ return ret;
+ }
+
}
--- /dev/null
+
+
+import CommonBase from './CommonBase';
+import * as bindings from '../bindings' // TODO: figure out location
+
+
+
+ export default class TrustedClosingTransaction extends CommonBase {
+ constructor(_dummy: object, ptr: number) {
+ super(ptr);
+ }
+
+
+ protected finalize() {
+ super.finalize();
+
+ if (this.ptr != 0) {
+ bindings.TrustedClosingTransaction_free(this.ptr);
+ }
+ }
+ public Uint8Array built_transaction() {
+ Uint8Array ret = bindings.TrustedClosingTransaction_built_transaction(this.ptr);
+ return ret;
+ }
+
+ public Uint8Array get_sighash_all(Uint8Array funding_redeemscript, number channel_value_satoshis) {
+ Uint8Array ret = bindings.TrustedClosingTransaction_get_sighash_all(this.ptr, funding_redeemscript, channel_value_satoshis);
+ return ret;
+ }
+
+ public Uint8Array sign(Uint8Array funding_key, Uint8Array funding_redeemscript, number channel_value_satoshis) {
+ Uint8Array ret = bindings.TrustedClosingTransaction_sign(this.ptr, funding_key, funding_redeemscript, channel_value_satoshis);
+ return ret;
+ }
+
+}
--- /dev/null
+
+
+import CommonBase from './CommonBase';
+import * as bindings from '../bindings' // TODO: figure out location
+
+
+
+ export class Type extends CommonBase {
+
+ bindings_instance?: bindings.LDKType;
+
+ constructor(ptr?: number, arg?: bindings.LDKType) {
+ if (Number.isFinite(ptr)) {
+ super(ptr);
+ this.bindings_instance = null;
+ } else {
+ // TODO: private constructor instantiation
+ super(bindings.LDKType_new(arg));
+ this.ptrs_to.push(arg);
+
+ }
+ }
+
+ protected finalize() {
+ if (this.ptr != 0) {
+ bindings.Type_free(this.ptr);
+ }
+ super.finalize();
+ }
+
+ static new_impl(arg: TypeInterface): Type {
+ const impl_holder: LDKTypeHolder = new LDKTypeHolder();
+ let structImplementation = <bindings.LDKType>{
+ // todo: in-line interface filling
+ type_id (): number {
+ number ret = arg.type_id();
+ return ret;
+ },
+
+ debug_str (): String {
+ String ret = arg.debug_str();
+ return ret;
+ },
+
+ write (): Uint8Array {
+ Uint8Array ret = arg.write();
+ return ret;
+ },
+
+
+ };
+ impl_holder.held = new Type (null, structImplementation);
+ }
+ }
+
+ export interface TypeInterface {
+ type_id(): number;
+ debug_str(): String;
+ write(): Uint8Array;
+
+ }
+
+ class LDKTypeHolder {
+ held: Type;
+ }
+ public number type_id() {
+ number ret = bindings.Type_type_id(this.ptr);
+ return ret;
+ }
+
+ public String debug_str() {
+ String ret = bindings.Type_debug_str(this.ptr);
+ return ret;
+ }
+
+ public Uint8Array write() {
+ Uint8Array ret = bindings.Type_write(this.ptr);
+ return ret;
+ }
+
+ public Type clone() {
+ number ret = bindings.Type_clone(this.ptr);
+ Type ret_hu_conv = new Type(null, ret);
+ ret_hu_conv.ptrs_to.add(this);
+ return ret_hu_conv;
+ }
+
+}
public void set_addresses(NetAddress[] val) {
bindings.UnsignedNodeAnnouncement_set_addresses(this.ptr, val != null ? Arrays.stream(val).map(val_conv_12 -> val_conv_12.ptr).toArray(number[]::new) : null);
- /* TODO 2 NetAddress */;
}
public UnsignedNodeAnnouncement clone() {
ret_hu_conv.ptrs_to.add(arg_tx_broadcaster);
ret_hu_conv.ptrs_to.add(arg_logger);
ret_hu_conv.ptrs_to.add(arg_default_config);
- /* TODO 2 ChannelMonitor */;
+ for (ChannelMonitor arg_channel_monitors_conv_16: arg_channel_monitors) { ret_hu_conv.ptrs_to.add(arg_channel_monitors_conv_16); };
return ret_hu_conv;
}
return ret;
}
+ public static Uint8Array constructor_uild_closing_transaction(number to_holder_value_sat, number to_counterparty_value_sat, Uint8Array to_holder_script, Uint8Array to_counterparty_script, OutPoint funding_outpoint) {
+ Uint8Array ret = bindings.build_closing_transaction(to_holder_value_sat, to_counterparty_value_sat, to_holder_script, to_counterparty_script, funding_outpoint == null ? 0 : funding_outpoint.ptr & ~1);
+ // this.ptrs_to.add(funding_outpoint);
+ return ret;
+ }
+
public static Result_SecretKeyErrorZ constructor_erive_private_key(Uint8Array per_commitment_point, Uint8Array base_secret) {
number ret = bindings.derive_private_key(per_commitment_point, base_secret);
Result_SecretKeyErrorZ ret_hu_conv = Result_SecretKeyErrorZ.constr_from_ptr(ret);
number ret = bindings.get_keysend_route(our_node_id, network == null ? 0 : network.ptr & ~1, payee, first_hops != null ? Arrays.stream(first_hops).map(first_hops_conv_16 -> first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr & ~1).toArray(number[]::new) : null, last_hops != null ? Arrays.stream(last_hops).map(last_hops_conv_11 -> last_hops_conv_11 == null ? 0 : last_hops_conv_11.ptr & ~1).toArray(number[]::new) : null, final_value_msat, final_cltv, logger == null ? 0 : logger.ptr);
Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret);
ret_hu_conv.ptrs_to.add(network);
- /* TODO 2 ChannelDetails */;
- /* TODO 2 RouteHint */;
+ for (ChannelDetails first_hops_conv_16: first_hops) { ret_hu_conv.ptrs_to.add(first_hops_conv_16); };
+ for (RouteHint last_hops_conv_11: last_hops) { ret_hu_conv.ptrs_to.add(last_hops_conv_11); };
ret_hu_conv.ptrs_to.add(logger);
return ret_hu_conv;
}
Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret);
ret_hu_conv.ptrs_to.add(network);
ret_hu_conv.ptrs_to.add(payee_features);
- /* TODO 2 ChannelDetails */;
- /* TODO 2 RouteHint */;
+ for (ChannelDetails first_hops_conv_16: first_hops) { ret_hu_conv.ptrs_to.add(first_hops_conv_16); };
+ for (RouteHint last_hops_conv_11: last_hops) { ret_hu_conv.ptrs_to.add(last_hops_conv_11); };
ret_hu_conv.ptrs_to.add(logger);
return ret_hu_conv;
}
release_pending_monitor_events (): number[] {
MonitorEvent[] ret = arg.release_pending_monitor_events();
result: number[] = ret != null ? Arrays.stream(ret).map(ret_conv_14 -> ret_conv_14.ptr).toArray(number[]::new) : null;
- /* TODO 2 MonitorEvent */;
return result;
},