1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
8 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
9 public class KeysInterface extends CommonBase {
10 final bindings.LDKKeysInterface bindings_instance;
11 KeysInterface(Object _dummy, long ptr) { super(ptr); bindings_instance = null; }
12 private KeysInterface(bindings.LDKKeysInterface arg) {
13 super(bindings.LDKKeysInterface_new(arg));
14 this.ptrs_to.add(arg);
15 this.bindings_instance = arg;
17 @Override @SuppressWarnings("deprecation")
18 protected void finalize() throws Throwable {
19 if (ptr != 0) { bindings.KeysInterface_free(ptr); } super.finalize();
22 public static interface KeysInterfaceInterface {
23 byte[] get_node_secret();
24 byte[] get_destination_script();
25 byte[] get_shutdown_pubkey();
26 ChannelKeys get_channel_keys(boolean inbound, long channel_value_satoshis);
27 byte[] get_secure_random_bytes();
29 private static class LDKKeysInterfaceHolder { KeysInterface held; }
30 public static KeysInterface new_impl(KeysInterfaceInterface arg) {
31 final LDKKeysInterfaceHolder impl_holder = new LDKKeysInterfaceHolder();
32 impl_holder.held = new KeysInterface(new bindings.LDKKeysInterface() {
33 @Override public byte[] get_node_secret() {
34 byte[] ret = arg.get_node_secret();
37 @Override public byte[] get_destination_script() {
38 byte[] ret = arg.get_destination_script();
41 @Override public byte[] get_shutdown_pubkey() {
42 byte[] ret = arg.get_shutdown_pubkey();
45 @Override public long get_channel_keys(boolean inbound, long channel_value_satoshis) {
46 ChannelKeys ret = arg.get_channel_keys(inbound, channel_value_satoshis);
47 long result = ret == null ? 0 : ret.ptr;
48 impl_holder.held.ptrs_to.add(ret);
51 @Override public byte[] get_secure_random_bytes() {
52 byte[] ret = arg.get_secure_random_bytes();
56 return impl_holder.held;
58 public byte[] get_node_secret() {
59 byte[] ret = bindings.KeysInterface_get_node_secret(this.ptr);
63 public byte[] get_destination_script() {
64 byte[] ret = bindings.KeysInterface_get_destination_script(this.ptr);
68 public byte[] get_shutdown_pubkey() {
69 byte[] ret = bindings.KeysInterface_get_shutdown_pubkey(this.ptr);
73 public ChannelKeys get_channel_keys(boolean inbound, long channel_value_satoshis) {
74 long ret = bindings.KeysInterface_get_channel_keys(this.ptr, inbound, channel_value_satoshis);
75 ChannelKeys ret_hu_conv = new ChannelKeys(null, ret);
76 ret_hu_conv.ptrs_to.add(this);
80 public byte[] get_secure_random_bytes() {
81 byte[] ret = bindings.KeysInterface_get_secure_random_bytes(this.ptr);