2 import CommonBase from './CommonBase';
3 import * as bindings from '../bindings' // TODO: figure out location
5 public class Access extends CommonBase {
6 final bindings.LDKAccess bindings_instance;
7 Access(Object _dummy, long ptr) { super(ptr); bindings_instance = null; }
8 private Access(bindings.LDKAccess arg) {
9 super(bindings.LDKAccess_new(arg));
10 this.ptrs_to.add(arg);
11 this.bindings_instance = arg;
13 @Override @SuppressWarnings("deprecation")
14 protected void finalize() throws Throwable {
15 if (ptr != 0) { bindings.Access_free(ptr); } super.finalize();
18 public static interface AccessInterface {
19 Result_TxOutAccessErrorZ get_utxo(byte[] genesis_hash, long short_channel_id);
21 private static class LDKAccessHolder { Access held; }
22 public static Access new_impl(AccessInterface arg) {
23 final LDKAccessHolder impl_holder = new LDKAccessHolder();
24 impl_holder.held = new Access(new bindings.LDKAccess() {
25 @Override public uint32_t get_utxo(byte[] genesis_hash, long short_channel_id) {
26 Result_TxOutAccessErrorZ ret = arg.get_utxo(genesis_hash, short_channel_id);
27 uint32_t result = ret != null ? ret.ptr : 0;
32 return impl_holder.held;
34 public Result_TxOutAccessErrorZ get_utxo(byte[] genesis_hash, long short_channel_id) {
35 uint32_t ret = bindings.Access_get_utxo(this.ptr, genesis_hash, short_channel_id);
36 Result_TxOutAccessErrorZ ret_hu_conv = Result_TxOutAccessErrorZ.constr_from_ptr(ret);