]> git.bitcoin.ninja Git - ldk-java/blob - ts/structs/Option_NetworkUpdateZ.ts
Merge pull request #50 from TheBlueMatt/main
[ldk-java] / ts / structs / Option_NetworkUpdateZ.ts
1
2 import CommonBase from './CommonBase';
3 import * as bindings from '../bindings' // TODO: figure out location
4
5 export default class COption_NetworkUpdateZ extends CommonBase {
6         protected constructor(_dummy: object, ptr: number) { super(ptr); }
7         protected finalize() {
8                 super.finalize();
9                 if (this.ptr != 0) { bindings.COption_NetworkUpdateZ_free(this.ptr); }
10         }
11         static constr_from_ptr(ptr: number): COption_NetworkUpdateZ {
12                 const raw_val: bindings.LDKCOption_NetworkUpdateZ = bindings.LDKCOption_NetworkUpdateZ_ref_from_ptr(ptr);
13                 if (raw_val instanceof bindings.LDKCOption_NetworkUpdateZ.Some) {
14                         return new Some(this.ptr, raw_val);
15                 }
16                 if (raw_val instanceof bindings.LDKCOption_NetworkUpdateZ.None) {
17                         return new None(this.ptr, raw_val);
18                 }
19                 throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
20         }
21
22 }
23 export class Some extends COption_NetworkUpdateZ {
24         public some: NetworkUpdate;
25         private constructor(ptr: number, obj: bindings.LDKCOption_NetworkUpdateZ.Some) {
26                 super(null, ptr);
27                 const some: number = obj.some;
28                 NetworkUpdate some_hu_conv = NetworkUpdate.constr_from_ptr(some);
29                         some_hu_conv.ptrs_to.add(this);
30                 this.some = some_hu_conv;
31         }
32 }
33 export class None extends COption_NetworkUpdateZ {
34         private constructor(ptr: number, obj: bindings.LDKCOption_NetworkUpdateZ.None) {
35                 super(null, ptr);
36         }
37 }
38         public static Option_NetworkUpdateZ constructor_some(NetworkUpdate o) {
39                 number ret = bindings.COption_NetworkUpdateZ_some(o.ptr);
40                 Option_NetworkUpdateZ ret_hu_conv = Option_NetworkUpdateZ.constr_from_ptr(ret);
41                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
42                 return ret_hu_conv;
43         }
44
45         public static Option_NetworkUpdateZ constructor_none() {
46                 number ret = bindings.COption_NetworkUpdateZ_none();
47                 Option_NetworkUpdateZ ret_hu_conv = Option_NetworkUpdateZ.constr_from_ptr(ret);
48                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
49                 return ret_hu_conv;
50         }
51
52         public Option_NetworkUpdateZ clone() {
53                 number ret = bindings.COption_NetworkUpdateZ_clone(this.ptr);
54                 Option_NetworkUpdateZ ret_hu_conv = Option_NetworkUpdateZ.constr_from_ptr(ret);
55                 ret_hu_conv.ptrs_to.add(this);
56                 return ret_hu_conv;
57         }
58
59 }