2 import CommonBase from './CommonBase';
3 import * as bindings from '../bindings' // TODO: figure out location
5 public class Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ extends CommonBase {
6 private Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ(Object _dummy, long ptr) { super(ptr); }
7 protected void finalize() throws Throwable {
8 if (ptr != 0) { bindings.CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(ptr); } super.finalize();
11 static Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ constr_from_ptr(long ptr) {
12 if (bindings.LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_result_ok(ptr)) {
13 return new Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_OK(null, ptr);
15 return new Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_Err(null, ptr);
18 public static final class Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_OK extends Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
19 public final TwoTuple<Uint8Array, ChannelMonitor>[] res;
20 private Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_OK(Object _dummy, long ptr) {
22 number[] res = bindings.LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_ok(ptr);
23 TwoTuple<Uint8Array, ChannelMonitor>[] res_conv_38_arr = new TwoTuple[res.length];
24 for (int m = 0; m < res.length; m++) {
25 number res_conv_38 = res[m];
26 Uint8Array res_conv_38_a = bindings.LDKC2Tuple_BlockHashChannelMonitorZ_get_a(res_conv_38);
27 number res_conv_38_b = bindings.LDKC2Tuple_BlockHashChannelMonitorZ_get_b(res_conv_38);
28 const res_conv_38_b_hu_conv: ChannelMonitor = new ChannelMonitor(null, res_conv_38_b);
29 res_conv_38_b_hu_conv.ptrs_to.add(this);;
30 TwoTuple<Uint8Array, ChannelMonitor> res_conv_38_conv = new TwoTuple<Uint8Array, ChannelMonitor>(res_conv_38_a, res_conv_38_b_hu_conv, () -> {
31 bindings.C2Tuple_BlockHashChannelMonitorZ_free(res_conv_38);
33 res_conv_38_b_hu_conv.ptrs_to.add(res_conv_38_conv);
34 res_conv_38_arr[m] = res_conv_38_conv;
36 this.res = res_conv_38_arr;
40 public static final class Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_Err extends Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
41 public final IOError err;
42 private Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_Err(Object _dummy, long ptr) {
44 this.err = bindings.LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_get_err(ptr);
48 public static Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ constructor__ok(TwoTuple<Uint8Array, ChannelMonitor>[] o) {
49 number ret = bindings.CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(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));
50 Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ ret_hu_conv = Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.constr_from_ptr(ret);
51 /* TODO 2 TwoTuple<Uint8Array, ChannelMonitor> */;
55 public static Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ constructor__err(IOError e) {
56 number ret = bindings.CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(e);
57 Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ ret_hu_conv = Result_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.constr_from_ptr(ret);