5b2d6c20ce77faf5a071e9a3c859369332c2ad02
[ldk-java] / ts / structs / Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.ts
1
2 import CommonBase from './CommonBase';
3 import * as bindings from '../bindings' // TODO: figure out location
4
5 public class Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ extends CommonBase {
6         private Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(Object _dummy, long ptr) { super(ptr); }
7         protected void finalize() throws Throwable {
8                 if (ptr != 0) { bindings.CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(ptr); } super.finalize();
9         }
10
11         static Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ constr_from_ptr(long ptr) {
12                 if (bindings.LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_result_ok(ptr)) {
13                         return new Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_OK(null, ptr);
14                 } else {
15                         return new Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_Err(null, ptr);
16                 }
17         }
18         public static final class Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_OK extends Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
19                 public final TwoTuple<Uint8Array, ChannelMonitor> res;
20                 private Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_OK(Object _dummy, long ptr) {
21                         super(_dummy, ptr);
22                         number res = bindings.LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_ok(ptr);
23                         Uint8Array res_a = bindings.LDKC2Tuple_BlockHashChannelMonitorZ_get_a(res);
24                         number res_b = bindings.LDKC2Tuple_BlockHashChannelMonitorZ_get_b(res);
25                         const res_b_hu_conv: ChannelMonitor = new ChannelMonitor(null, res_b);
26                         res_b_hu_conv.ptrs_to.add(this);;
27                         TwoTuple<Uint8Array, ChannelMonitor> res_conv = new TwoTuple<Uint8Array, ChannelMonitor>(res_a, res_b_hu_conv);
28                         this.res = res_conv;
29                 }
30                 public Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_OK(TwoTuple<Uint8Array, ChannelMonitor> res) {
31                         this(null, bindings.CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(bindings.C2Tuple_BlockHashChannelMonitorZ_new(res.a, res.b == null ? 0 : res.b.ptr & ~1)));
32                         this.ptrs_to.add(res.b);
33                 }
34         }
35
36         public static final class Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_Err extends Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
37                 public final DecodeError err;
38                 private Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_Err(Object _dummy, long ptr) {
39                         super(_dummy, ptr);
40                         number err = bindings.LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_get_err(ptr);
41                         const err_hu_conv: DecodeError = new DecodeError(null, err);
42                         err_hu_conv.ptrs_to.add(this);
43                         this.err = err_hu_conv;
44                 }
45                 public Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_Err(DecodeError err) {
46                         this(null, bindings.CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(err == null ? 0 : err.ptr & ~1));
47                         this.ptrs_to.add(err);
48                 }
49         }
50 }