[TS] Update auto-generated TypeScript Bindings
[ldk-java] / ts / structs / Option_MonitorEventZ.mts
index 31836ca211bd1c68322d89aa1095309c9ac820b4..1b0c7f8bc5af67f9f6a243d6c8a452df1a1ccec7 100644 (file)
@@ -279,22 +279,26 @@ import { MultiThreadedLockableScore } from '../structs/MultiThreadedLockableScor
 
 import CommonBase from './CommonBase.mjs';
 import * as bindings from '../bindings.mjs'
-import * as InternalUtils from '../InternalUtils.mjs'
 
+/**
+ * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
+ */
 export class Option_MonitorEventZ extends CommonBase {
        protected constructor(_dummy: object, ptr: number) { super(ptr, bindings.COption_MonitorEventZ_free); }
        /* @internal */
        public static constr_from_ptr(ptr: number): Option_MonitorEventZ {
-               const raw_val: bindings.LDKCOption_MonitorEventZ = bindings.LDKCOption_MonitorEventZ_ref_from_ptr(ptr);
-               if (raw_val instanceof bindings.LDKCOption_MonitorEventZ_Some) {
-                       return new Option_MonitorEventZ_Some(ptr, raw_val);
+               const raw_ty: number = bindings.LDKCOption_MonitorEventZ_ty_from_ptr(ptr);
+               switch (raw_ty) {
+                       case 0: return new Option_MonitorEventZ_Some(ptr);
+                       case 1: return new Option_MonitorEventZ_None(ptr);
+                       default:
+                               throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
                }
-               if (raw_val instanceof bindings.LDKCOption_MonitorEventZ_None) {
-                       return new Option_MonitorEventZ_None(ptr, raw_val);
-               }
-               throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
        }
 
+       /**
+        * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
+        */
        public static constructor_some(o: MonitorEvent): Option_MonitorEventZ {
                const ret: number = bindings.COption_MonitorEventZ_some(CommonBase.get_ptr_of(o));
                const ret_hu_conv: Option_MonitorEventZ = Option_MonitorEventZ.constr_from_ptr(ret);
@@ -302,6 +306,9 @@ export class Option_MonitorEventZ extends CommonBase {
                return ret_hu_conv;
        }
 
+       /**
+        * Constructs a new COption_MonitorEventZ containing nothing
+        */
        public static constructor_none(): Option_MonitorEventZ {
                const ret: number = bindings.COption_MonitorEventZ_none();
                const ret_hu_conv: Option_MonitorEventZ = Option_MonitorEventZ.constr_from_ptr(ret);
@@ -314,6 +321,10 @@ export class Option_MonitorEventZ extends CommonBase {
                return ret;
        }
 
+       /**
+        * Creates a new COption_MonitorEventZ which has the same data as `orig`
+        * but with all dynamically-allocated buffers duplicated in new buffers.
+        */
        public clone(): Option_MonitorEventZ {
                const ret: number = bindings.COption_MonitorEventZ_clone(this.ptr);
                const ret_hu_conv: Option_MonitorEventZ = Option_MonitorEventZ.constr_from_ptr(ret);
@@ -322,20 +333,22 @@ export class Option_MonitorEventZ extends CommonBase {
        }
 
 }
+/** A Option_MonitorEventZ of type Some */
 export class Option_MonitorEventZ_Some extends Option_MonitorEventZ {
        public some: MonitorEvent;
        /* @internal */
-       public constructor(ptr: number, obj: bindings.LDKCOption_MonitorEventZ_Some) {
+       public constructor(ptr: number) {
                super(null, ptr);
-               const some: number = obj.some;
+               const some: number = bindings.LDKCOption_MonitorEventZ_Some_get_some(ptr);
                const some_hu_conv: MonitorEvent = MonitorEvent.constr_from_ptr(some);
                        CommonBase.add_ref_from(some_hu_conv, this);
                this.some = some_hu_conv;
        }
 }
+/** A Option_MonitorEventZ of type None */
 export class Option_MonitorEventZ_None extends Option_MonitorEventZ {
        /* @internal */
-       public constructor(ptr: number, obj: bindings.LDKCOption_MonitorEventZ_None) {
+       public constructor(ptr: number) {
                super(null, ptr);
        }
 }