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 public KeysInterface(KeysInterfaceInterface arg) {
30 this(new bindings.LDKKeysInterface() {
31 @Override public byte[] get_node_secret() {
32 byte[] ret = arg.get_node_secret();
35 @Override public byte[] get_destination_script() {
36 byte[] ret = arg.get_destination_script();
39 @Override public byte[] get_shutdown_pubkey() {
40 byte[] ret = arg.get_shutdown_pubkey();
43 @Override public long get_channel_keys(boolean inbound, long channel_value_satoshis) {
44 ChannelKeys ret = arg.get_channel_keys(inbound, channel_value_satoshis);
45 long result = ret == null ? 0 : ret.ptr;
46 //TODO: May need to call: this.ptrs_to.add(ret);
50 @Override public byte[] get_secure_random_bytes() {
51 byte[] ret = arg.get_secure_random_bytes();
56 public byte[] get_node_secret() {
57 byte[] ret = bindings.KeysInterface_get_node_secret(this.ptr);
61 public byte[] get_destination_script() {
62 byte[] ret = bindings.KeysInterface_get_destination_script(this.ptr);
66 public byte[] get_shutdown_pubkey() {
67 byte[] ret = bindings.KeysInterface_get_shutdown_pubkey(this.ptr);
71 public ChannelKeys get_channel_keys(boolean inbound, long channel_value_satoshis) {
72 long ret = bindings.KeysInterface_get_channel_keys(this.ptr, inbound, channel_value_satoshis);
73 ChannelKeys ret_hu_conv = new ChannelKeys(null, ret);
74 ret_hu_conv.ptrs_to.add(this);
78 public byte[] get_secure_random_bytes() {
79 byte[] ret = bindings.KeysInterface_get_secure_random_bytes(this.ptr);