Update auto-generated bindings
[ldk-java] / ts / structs / Event.ts
index c8374a2b73f273a2afecb9008d24d96acbe6353f..022a0b5cb0fdc7ca2b647ecf758c5258942982f4 100644 (file)
@@ -34,6 +34,9 @@ export default class Event extends CommonBase {
                if (raw_val instanceof bindings.LDKEvent.ChannelClosed) {
                        return new ChannelClosed(this.ptr, raw_val);
                }
+               if (raw_val instanceof bindings.LDKEvent.DiscardFunding) {
+                       return new DiscardFunding(this.ptr, raw_val);
+               }
                throw new Error('oops, this should be unreachable'); // Unreachable without extending the (internal) bindings interface
        }
 
@@ -66,20 +69,33 @@ export class PaymentReceived extends Event {
        }
 }
 export class PaymentSent extends Event {
+       public payment_id: Uint8Array;
        public payment_preimage: Uint8Array;
+       public payment_hash: Uint8Array;
+       public fee_paid_msat: Option_u64Z;
        private constructor(ptr: number, obj: bindings.LDKEvent.PaymentSent) {
                super(null, ptr);
+               this.payment_id = obj.payment_id;
                this.payment_preimage = obj.payment_preimage;
+               this.payment_hash = obj.payment_hash;
+               const fee_paid_msat: number = obj.fee_paid_msat;
+               Option_u64Z fee_paid_msat_hu_conv = Option_u64Z.constr_from_ptr(fee_paid_msat);
+                       fee_paid_msat_hu_conv.ptrs_to.add(this);
+               this.fee_paid_msat = fee_paid_msat_hu_conv;
        }
 }
 export class PaymentPathFailed extends Event {
+       public payment_id: Uint8Array;
        public payment_hash: Uint8Array;
        public rejected_by_dest: boolean;
        public network_update: Option_NetworkUpdateZ;
        public all_paths_failed: boolean;
        public path: RouteHop[];
+       public short_channel_id: Option_u64Z;
+       public retry: RouteParameters;
        private constructor(ptr: number, obj: bindings.LDKEvent.PaymentPathFailed) {
                super(null, ptr);
+               this.payment_id = obj.payment_id;
                this.payment_hash = obj.payment_hash;
                this.rejected_by_dest = obj.rejected_by_dest;
                const network_update: number = obj.network_update;
@@ -96,6 +112,14 @@ export class PaymentPathFailed extends Event {
                                path_conv_10_arr[k] = path_conv_10_hu_conv;
                        }
                this.path = path_conv_10_arr;
+               const short_channel_id: number = obj.short_channel_id;
+               Option_u64Z short_channel_id_hu_conv = Option_u64Z.constr_from_ptr(short_channel_id);
+                       short_channel_id_hu_conv.ptrs_to.add(this);
+               this.short_channel_id = short_channel_id_hu_conv;
+               const retry: number = obj.retry;
+               const retry_hu_conv: RouteParameters = new RouteParameters(null, retry);
+                       retry_hu_conv.ptrs_to.add(this);
+               this.retry = retry_hu_conv;
        }
 }
 export class PendingHTLCsForwardable extends Event {
@@ -134,16 +158,32 @@ export class PaymentForwarded extends Event {
 }
 export class ChannelClosed extends Event {
        public channel_id: Uint8Array;
+       public user_channel_id: number;
        public reason: ClosureReason;
        private constructor(ptr: number, obj: bindings.LDKEvent.ChannelClosed) {
                super(null, ptr);
                this.channel_id = obj.channel_id;
+               this.user_channel_id = obj.user_channel_id;
                const reason: number = obj.reason;
                ClosureReason reason_hu_conv = ClosureReason.constr_from_ptr(reason);
                        reason_hu_conv.ptrs_to.add(this);
                this.reason = reason_hu_conv;
        }
 }
+export class DiscardFunding extends Event {
+       public channel_id: Uint8Array;
+       public transaction: Uint8Array;
+       private constructor(ptr: number, obj: bindings.LDKEvent.DiscardFunding) {
+               super(null, ptr);
+               this.channel_id = obj.channel_id;
+               this.transaction = obj.transaction;
+       }
+}
+       public number clone_ptr() {
+               number ret = bindings.Event_clone_ptr(this.ptr);
+               return ret;
+       }
+
        public Event clone() {
                number ret = bindings.Event_clone(this.ptr);
                Event ret_hu_conv = Event.constr_from_ptr(ret);
@@ -152,28 +192,28 @@ export class ChannelClosed extends Event {
        }
 
        public static Event constructor_funding_generation_ready(Uint8Array temporary_channel_id, number channel_value_satoshis, Uint8Array output_script, number user_channel_id) {
-               number ret = bindings.Event_funding_generation_ready(temporary_channel_id, channel_value_satoshis, output_script, user_channel_id);
+               number ret = bindings.Event_funding_generation_ready(InternalUtils.check_arr_len(temporary_channel_id, 32), channel_value_satoshis, output_script, user_channel_id);
                Event ret_hu_conv = Event.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
                return ret_hu_conv;
        }
 
        public static Event constructor_payment_received(Uint8Array payment_hash, number amt, PaymentPurpose purpose) {
-               number ret = bindings.Event_payment_received(payment_hash, amt, purpose.ptr);
+               number ret = bindings.Event_payment_received(InternalUtils.check_arr_len(payment_hash, 32), amt, purpose.ptr);
                Event ret_hu_conv = Event.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
                return ret_hu_conv;
        }
 
-       public static Event constructor_payment_sent(Uint8Array payment_preimage) {
-               number ret = bindings.Event_payment_sent(payment_preimage);
+       public static Event constructor_payment_sent(Uint8Array payment_id, Uint8Array payment_preimage, Uint8Array payment_hash, Option_u64Z fee_paid_msat) {
+               number ret = bindings.Event_payment_sent(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_preimage, 32), InternalUtils.check_arr_len(payment_hash, 32), fee_paid_msat.ptr);
                Event ret_hu_conv = Event.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
                return ret_hu_conv;
        }
 
-       public static Event constructor_payment_path_failed(Uint8Array payment_hash, boolean rejected_by_dest, Option_NetworkUpdateZ network_update, boolean all_paths_failed, RouteHop[] path) {
-               number ret = bindings.Event_payment_path_failed(payment_hash, rejected_by_dest, network_update.ptr, all_paths_failed, path != null ? Arrays.stream(path).map(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr & ~1).toArray(number[]::new) : null);
+       public static Event constructor_payment_path_failed(Uint8Array payment_id, Uint8Array payment_hash, boolean rejected_by_dest, Option_NetworkUpdateZ network_update, boolean all_paths_failed, RouteHop[] path, Option_u64Z short_channel_id, RouteParameters retry) {
+               number ret = bindings.Event_payment_path_failed(InternalUtils.check_arr_len(payment_id, 32), InternalUtils.check_arr_len(payment_hash, 32), rejected_by_dest, network_update.ptr, all_paths_failed, path != null ? Arrays.stream(path).map(path_conv_10 -> path_conv_10 == null ? 0 : path_conv_10.ptr & ~1).toArray(number[]::new) : null, short_channel_id.ptr, retry == null ? 0 : retry.ptr & ~1);
                Event ret_hu_conv = Event.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
                return ret_hu_conv;
@@ -200,8 +240,15 @@ export class ChannelClosed extends Event {
                return ret_hu_conv;
        }
 
-       public static Event constructor_channel_closed(Uint8Array channel_id, ClosureReason reason) {
-               number ret = bindings.Event_channel_closed(channel_id, reason.ptr);
+       public static Event constructor_channel_closed(Uint8Array channel_id, number user_channel_id, ClosureReason reason) {
+               number ret = bindings.Event_channel_closed(InternalUtils.check_arr_len(channel_id, 32), user_channel_id, reason.ptr);
+               Event ret_hu_conv = Event.constr_from_ptr(ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
+       public static Event constructor_discard_funding(Uint8Array channel_id, Uint8Array transaction) {
+               number ret = bindings.Event_discard_funding(InternalUtils.check_arr_len(channel_id, 32), transaction);
                Event ret_hu_conv = Event.constr_from_ptr(ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
                return ret_hu_conv;