Provide human versions of trait interfaces, with a bunch of fixes to make it work
[ldk-java] / src / main / java / org / ldk / structs / KeysInterface.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7
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;
16         }
17         @Override @SuppressWarnings("deprecation")
18         protected void finalize() throws Throwable {
19                 if (ptr != 0) { bindings.KeysInterface_free(ptr); } super.finalize();
20         }
21
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();
28         }
29         public KeysInterface(KeysInterfaceInterface arg) {
30                 this(new bindings.LDKKeysInterface() {
31                         @Override public byte[] get_node_secret() {
32                                 byte[] ret = arg.get_node_secret();
33                                 return ret;
34                         }
35                         @Override public byte[] get_destination_script() {
36                                 byte[] ret = arg.get_destination_script();
37                                 return ret;
38                         }
39                         @Override public byte[] get_shutdown_pubkey() {
40                                 byte[] ret = arg.get_shutdown_pubkey();
41                                 return ret;
42                         }
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.ptr;
46                                 ret.ptr = 0;
47                                 return result;
48                         }
49                         @Override public byte[] get_secure_random_bytes() {
50                                 byte[] ret = arg.get_secure_random_bytes();
51                                 return ret;
52                         }
53                 });
54         }
55         public byte[] get_node_secret() {
56                 byte[] ret = bindings.KeysInterface_get_node_secret(this.ptr);
57                 return ret;
58         }
59
60         public byte[] get_destination_script() {
61                 byte[] ret = bindings.KeysInterface_get_destination_script(this.ptr);
62                 return ret;
63         }
64
65         public byte[] get_shutdown_pubkey() {
66                 byte[] ret = bindings.KeysInterface_get_shutdown_pubkey(this.ptr);
67                 return ret;
68         }
69
70         public ChannelKeys get_channel_keys(boolean inbound, long channel_value_satoshis) {
71                 long ret = bindings.KeysInterface_get_channel_keys(this.ptr, inbound, channel_value_satoshis);
72                 ChannelKeys ret_hu_conv = new ChannelKeys(null, ret);
73                 ret_hu_conv.ptrs_to.add(this);
74                 return ret_hu_conv;
75         }
76
77         public byte[] get_secure_random_bytes() {
78                 byte[] ret = bindings.KeysInterface_get_secure_random_bytes(this.ptr);
79                 return ret;
80         }
81
82 }